forked from dylan-lang/opendylan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
249 lines (224 loc) · 8.29 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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
AC_INIT([Open Dylan], [2013.2])
AC_PREREQ(2.50)
# Directory for config.guess etc.
AC_CONFIG_AUX_DIR(build-aux)
#---------------------
# Make srcdir absolute
#---------------------
srcdir=`(cd $srcdir; pwd)`
SUPPORT_GC_MPS=no
SUPPORT_GC_BOEHM=yes
GC_USE_STATIC_BOEHM=false
GC_LIB=-lgc
ADDITIONAL_RUNTIME_TARGET_PLATFORMS=
AC_CANONICAL_TARGET
MULTIARCH=$host
case $host in
i*86-*-linux*)
OPEN_DYLAN_TARGET_PLATFORM=x86-linux;
SUPPORT_GC_MPS=yes;
MULTIARCH=i386-linux-gnu
;;
i*86-*-freebsd*)
OPEN_DYLAN_TARGET_PLATFORM=x86-freebsd;
SUPPORT_GC_MPS=yes;
;;
i*86-*-darwin*)
OPEN_DYLAN_TARGET_PLATFORM=x86-darwin;
ADDITIONAL_RUNTIME_TARGET_PLATFORMS="x86_64-darwin";
GC_USE_STATIC_BOEHM=true
;;
x86_64-*-darwin*)
OPEN_DYLAN_TARGET_PLATFORM=x86-darwin;
ADDITIONAL_RUNTIME_TARGET_PLATFORMS="x86_64-darwin";
GC_USE_STATIC_BOEHM=true
;;
amd64-*-freebsd* | x86_64-*-freebsd*)
OPEN_DYLAN_TARGET_PLATFORM=x86_64-freebsd;
GC_LIB=-lgc-threaded
;;
x86_64-*-linux*)
OPEN_DYLAN_TARGET_PLATFORM=x86_64-linux;
MULTIARCH=x86_64-linux-gnu
;;
arm-*-linux*)
OPEN_DYLAN_TARGET_PLATFORM=arm-linux;
;;
*)
AC_MSG_ERROR([The $host platform is not supported.])
;;
esac
AC_SUBST(OPEN_DYLAN_TARGET_PLATFORM)
AC_SUBST(ADDITIONAL_RUNTIME_TARGET_PLATFORMS)
AM_INIT_AUTOMAKE
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PATH_PROG(PERL, perl, no)
test "$PERL" = no && AC_MSG_ERROR([
perl is required to build Open Dylan])
AC_SUBST(PERL)
PERL_MODULES="File::Spec Getopt::Long"
for module in $PERL_MODULES; do
AC_MSG_CHECKING(for Perl module $module)
$PERL -M$module -e 'exit 0' || AC_MSG_ERROR([
$module is required to build Open Dylan])
AC_MSG_RESULT(yes)
done
AC_CHECK_PROGS(DYLANCOMPILER, dylan-compiler opendylan minimal-console-compiler, no)
test "$DYLANCOMPILER" = no && AC_MSG_ERROR([
dylan-compiler, opendylan or minimal-console-compiler is required to bootstrap Open Dylan. Please download and install a build from http://opendylan.org/download/index.html])
# In 2014.1 and later we need -verbose so fdmake.pl gets warning count summaries.
AC_MSG_CHECKING(if $DYLANCOMPILER supports the -verbose flag)
if $DYLANCOMPILER -version -verbose >/dev/null 2>&1 ; then
DYLANCOMPILER="$DYLANCOMPILER -verbose -build"
AC_MSG_RESULT(yes)
else
test "$DYLANCOMPILER" = dylan-compiler && DYLANCOMPILER="$DYLANCOMPILER -build"
test "$DYLANCOMPILER" = opendylan && DYLANCOMPILER="$DYLANCOMPILER -build"
test "$DYLANCOMPILER" = minimal-console-compiler && DYLANCOMPILER="$DYLANCOMPILER -build"
AC_MSG_RESULT(no)
fi
AC_SUBST(DYLANCOMPILER)
# TODO: figure out the bootstrap type given the fdcompile version
bootstrap_target=1-stage-bootstrap
AC_SUBST(bootstrap_target)
AC_PROG_CC([clang gcc cc])
AC_CHECK_PROGS([MAKE],[gnumake gmake make],[AC_MSG_ERROR([Unable to find a make program.])])
if ! $MAKE --version | grep -q "GNU" 2> /dev/null; then
AC_MSG_ERROR([OpenDylan requires GNU make to build.])
fi
AC_ARG_WITH(gc-path,
AS_HELP_STRING([--with-gc-path=PATH],
[Path to GC distribution and build.]))
AC_ARG_WITH(gc,
AS_HELP_STRING([--with-gc=mps|boehm],
[Which GC (MPS or Boehm) to use.]))
AS_IF([test x${with_gc} == x],
[
with_gc=boehm
])
AC_ARG_WITH(mps,
AS_HELP_STRING([--with-mps=PATH],
[Deprecated option. Use --with-gc and --with-gc-path instead.]))
AS_IF([test x${with_mps} != x],
[
AC_MSG_WARN([You are using a deprecated configure flag. Please use --with-gc and --with-gc-path instead.])
with_gc=mps
with_gc_path=${with_mps}
])
AC_MSG_CHECKING([which GC to use])
AC_MSG_RESULT(${with_gc})
AC_MSG_CHECKING([which GC path to use])
AC_MSG_RESULT(${with_gc_path})
if test "$cross_compiling" != "yes"; then
AS_IF([test x${GC_USE_STATIC_BOEHM} == xtrue],
[
GC_LIB_NAME=libgc.a
],
[
AS_IF([test x${OPEN_DYLAN_TARGET_PLATFORM} == xx86-darwin -o x${OPEN_DYLAN_TARGET_PLATFORM} == xx86_64-darwin],
[
GC_LIB_NAME=libgc.dylib
],
[
GC_LIB_NAME=libgc.so
])
]
)
AS_IF([test x${with_gc} == xmalloc],
[
GC_CFLAGS="-DGC_USE_MALLOC"
GC_LFLAGS=""
GC_LIBRARY=""
GC_USE_STATIC_BOEHM=false
GC_CHOICE="malloc"
]
)
AS_IF([test x${with_gc} == xmps],
[
AS_IF([test x${SUPPORT_GC_MPS} == xno],
[
AC_MSG_ERROR([The platform that you are building for requires the Boehm GC.])
]
)
GC_CFLAGS="-DGC_USE_MPS -I${with_gc_path}/code"
GC_CHOICE="mps"
old_CPPFLAGS=$CPPFLAGS
CPPFLAGS="-I${with_gc_path}/code"
AC_CHECK_HEADER([mps.h],[],[AC_MSG_ERROR([Incorrect path to MPS specified. Please make sure you specified an absolute path to the root MPS directory.])])
CPPFLAGS=$old_CPPFLAGS
# This is to help catch people who haven't updated to the new MPS yet.
AC_CHECK_FILE([${with_gc_path}/code/lii4gc.gmk],[AC_MSG_ERROR([You have an old version of MPS and need to update.])],[])
]
)
AS_IF([test x$with_gc == xboehm],
[
AS_IF([test x${SUPPORT_GC_BOEHM} == xno],
[
AC_MSG_ERROR([The platform that you are building for requires the MPS GC.])
])
GC_CFLAGS="-DGC_USE_BOEHM -DGC_THREADS -I${with_gc_path}/include"
GC_LFLAGS="-L${with_gc_path}/lib ${GC_LIB}"
AS_IF([test x${with_gc_path} != x],
[
AC_CHECK_FILE([${with_gc_path}/lib/${GC_LIB_NAME}],
[
GC_LIBRARY="${with_gc_path}/lib/${GC_LIB_NAME}"
],
[])
])
AS_IF([test x${GC_LIBRARY} == x],
[
AC_CHECK_FILE([/usr/lib/${GC_LIB_NAME}],
[
GC_LIBRARY="/usr/lib/${GC_LIB_NAME}"
],
[
AC_CHECK_FILE([/usr/local/lib/${GC_LIB_NAME}],
[
GC_LIBRARY="/usr/local/lib/${GC_LIB_NAME}"
],
[
AC_CHECK_FILE([/usr/lib/${MULTIARCH}/${GC_LIB_NAME}],
[
GC_LIBRARY="/usr/lib/${MULTIARCH}/${GC_LIB_NAME}"
],
[])
])
])
])
GC_CHOICE="boehm"
])
fi
AS_IF([test x${GC_CHOICE}x${GC_LIBRARY} == xboehmx],
[
AC_MSG_ERROR([Could not find ${GC_LIB_NAME}. Please specify the path to the Boehm GC installation via --with-gc-path])
])
AS_IF([test x${GC_CHOICE} == x],
[
AC_MSG_ERROR([Invalid GC choice. Please select either 'boehm' or 'mps'.])
])
AC_SUBST(GC_CFLAGS)
AC_SUBST(GC_LFLAGS)
AC_SUBST(GC_LIBRARY)
AC_SUBST(GC_CHOICE)
AC_SUBST(GC_USE_STATIC_BOEHM)
# We don't want to build generated code with warnings enabled usually.
# The exception to this is if the person running configure has passed
# in CFLAGS with -W options ...
AC_MSG_CHECKING(if we should disable C compiler warnings for generated code)
AS_IF([echo "$CFLAGS" | grep -q -- "-W" 2> /dev/null],
[
DISABLE_WARNINGS_CFLAGS=
AC_MSG_RESULT(no)
],[
DISABLE_WARNINGS_CFLAGS=-w
AC_MSG_RESULT(yes)
]
)
AC_SUBST(DISABLE_WARNINGS_CFLAGS)
AC_CONFIG_FILES(Makefile
sources/jamfiles/Makefile
sources/jamfiles/config.jam
sources/lib/run-time/Makefile)
AC_OUTPUT