forked from dherman/es4
-
Notifications
You must be signed in to change notification settings - Fork 1
/
configure.ac
executable file
·146 lines (124 loc) · 4.23 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
AC_INIT([es4],
[0.0m0],
[ECMAScript Edition 4 Reference Implementation])
AC_COPYRIGHT([
Copyright (c) 2007 Adobe Systems Inc., The Mozilla Foundation, Opera
Software ASA, and others.
])
AC_DEFUN([UNLESS_EXECUTABLE],
[AC_MSG_CHECKING([whether $1 is executable])
if test -x "$2"; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
$3
fi])
AC_DEFUN([CHECK_EXECUTABLE],
[UNLESS_EXECUTABLE([$1], [$2], [AC_MSG_ERROR([cannot execute $2])])])
AC_DEFUN([EXEC_SMLNJ],
[echo '$1;' | (${ES4_SMLNJ} >/dev/null) 2>&1])
AC_DEFUN([EVAL_SMLNJ_STRING],
[$1=`echo 'TextIO.output (TextIO.stdErr, $2);' | (${ES4_SMLNJ} >/dev/null) 2>&1`])
AC_DEFUN([GET_SMLNJ_HEAP_SUFFIX],
[EVAL_SMLNJ_STRING($1, [SMLofNJ.SysInfo.getHeapSuffix()])])
AC_DEFUN([GET_SMLNJ_CM_ANCHOR_HOME],
[EVAL_SMLNJ_STRING($1, [valOf(case (CM.Anchor.anchor "$2") of { get, ... } => get ())])])
ES4_SML_DIALECT=smlnj
ES4_SMLNJ="<<search>>"
ES4_MLTON="<<search>>"
ES4_DEBUG=no
AC_ARG_WITH([smlnj],
AC_HELP_STRING([--with-smlnj=FULLPATH],
[set full path to SML/NJ executable]),
[ES4_SMLNJ="$withval"])
AC_ARG_WITH([mlton],
AC_HELP_STRING([--with-mlton=FULLPATH],
[set full path to MLton compiler]),
[ES4_MLTON="$withval"])
AC_ARG_WITH([dialect],
AC_HELP_STRING([--with-dialect=(smlnj|mlton)],
[choose dialect of Standard ML (default smlnj)]),
[ES4_SML_DIALECT="$withval"])
AC_ARG_ENABLE([debug],
AC_HELP_STRING([--enable-debug],
[compile SML with debugging information (default no)]),
[ES4_DEBUG="$enableval"])
AC_MSG_NOTICE([using ${ES4_SML_DIALECT} dialect for building releases])
# 1. Find SML/NJ installation information.
if test "${ES4_SMLNJ}" = "yes" -o "${ES4_SMLNJ}" = "<<search>>"; then
AC_PATH_PROGS([ES4_SMLNJ], [sml])
fi
if test -n "${ES4_SMLNJ}" -a -x "${ES4_SMLNJ}"; then
ES4_SMLNJ_HOME=`dirname ${ES4_SMLNJ}`
ES4_MLBUILD="${ES4_SMLNJ_HOME}"/ml-build
ES4_HEAP2EXEC="${ES4_SMLNJ_HOME}"/heap2exec
AC_MSG_CHECKING([platform-specific heapfile suffix])
GET_SMLNJ_HEAP_SUFFIX([ES4_HEAP_SUFFIX])
AC_MSG_RESULT([${ES4_HEAP_SUFFIX}])
else
ES4_SMLNJ=false
ES4_SMLNJ_HOME=XXX
ES4_MLBUILD=false
ES4_HEAP2EXEC=false
ES4_HEAP_SUFFIX=XXX
fi
# 2. SML/NJ dialect
if test "${ES4_SML_DIALECT}" = "smlnj"; then
if test "${ES4_SMLNJ}" = "false"; then
AC_MSG_ERROR([cannot execute sml])
fi
CHECK_EXECUTABLE([ml-build], [${ES4_MLBUILD}])
AC_MSG_CHECKING([usability of heap2exec on this platform])
if test -x "${ES4_HEAP2EXEC}"; then
EXEC_SMLNJ([SMLofNJ.exportFn("autoconf-test.heap",(fn _ => OS.Process.success))])
"${ES4_HEAP2EXEC}" autoconf-test.heap.${ES4_HEAP_SUFFIX} autoconf-test >/dev/null 2>&1
if test "$?" = "0"; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
ES4_HEAP2EXEC=false
fi
else
AC_MSG_RESULT([no])
ES4_HEAP2EXEC=false
fi
rm -f autoconf-test.heap.${ES4_HEAP_SUFFIX}
rm -f autoconf-test
AC_MSG_CHECKING([availability of smlnj-tdp tools])
GET_SMLNJ_CM_ANCHOR_HOME([ES4_SMLNJ_TDP], [smlnj-tdp])
if test -z "${ES4_SMLNJ_TDP}"; then
AC_MSG_RESULT([no])
else
AC_MSG_RESULT([${ES4_SMLNJ_TDP}])
fi
fi
# 3. MLton dialect
if test "${ES4_SML_DIALECT}" = "mlton"; then
if test "${ES4_MLTON}" = "yes" -o "${ES4_MLTON}" = "<<search>>"; then
AC_PATH_PROGS([ES4_MLTON], [mlton])
if test -z "${ES4_MLTON}"; then
AC_MSG_ERROR([cannot find installation of MLton])
fi
fi
CHECK_EXECUTABLE([mlton], [${ES4_MLTON}])
else
ES4_MLTON=false
fi
# 4. Platform-specific executable suffix
AC_PROG_CC
AC_EXEEXT
dnl COMMON_SOURCES=`ls -1 *.sml | grep -v mlton | grep -v smlnj | grep -v decimal-external | xargs echo`
dnl AC_SUBST([COMMON_SOURCES])
AC_SUBST([ES4_SML_DIALECT])
AC_SUBST([ES4_DEBUG])
AC_SUBST([ES4_HEAP_SUFFIX])
AC_SUBST([ES4_SMLNJ_TDP])
AC_SUBST([ES4_SMLNJ])
AC_SUBST([ES4_MLBUILD])
AC_SUBST([ES4_HEAP2EXEC])
AC_SUBST([ES4_MLTON])
AC_CONFIG_FILES([
Makefile
])
AC_OUTPUT