forked from dylan-lang/opendylan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
303 lines (269 loc) · 11.3 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
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
AC_INIT([Open Dylan], [2024.2pre])
AC_PREREQ(2.50)
# Directory for config.guess etc.
AC_CONFIG_AUX_DIR(config/build-aux)
SUPPORT_HARP=
SUPPORT_LLVM=
BDW_GC_STATIC=
BDW_GC_MODULE=bdw-gc
ADDITIONAL_RUNTIME_TARGET_PLATFORMS=
MACOS_SDK=
AC_CANONICAL_TARGET
# Shared library filename extension
shrext=so
MULTIARCH=$host
case $host in
i*86-*-linux*)
OPEN_DYLAN_TARGET_PLATFORM=x86-linux;
MULTIARCH=i386-linux-gnu
SUPPORT_LLVM=yes
;;
i*86-*-freebsd*)
OPEN_DYLAN_TARGET_PLATFORM=x86-freebsd;
BDW_GC_MODULE=bdw-gc-threaded
SUPPORT_HARP=yes
SUPPORT_LLVM=yes
;;
x86_64-*-darwin*)
OPEN_DYLAN_TARGET_PLATFORM="x86_64-darwin";
MACOS_SDK=`xcrun --show-sdk-path`
SUPPORT_LLVM=yes
shrext=dylib
;;
amd64-*-freebsd* | x86_64-*-freebsd*)
OPEN_DYLAN_TARGET_PLATFORM=x86_64-freebsd;
BDW_GC_MODULE=bdw-gc-threaded
SUPPORT_LLVM=yes
;;
x86_64-*-linux*)
OPEN_DYLAN_TARGET_PLATFORM=x86_64-linux;
MULTIARCH=x86_64-linux-gnu
SUPPORT_LLVM=yes
;;
arm-*-linux*)
OPEN_DYLAN_TARGET_PLATFORM=arm-linux;
;;
aarch64-*-linux*)
OPEN_DYLAN_TARGET_PLATFORM=aarch64-linux;
SUPPORT_LLVM=yes
;;
riscv64-*-linux*)
OPEN_DYLAN_TARGET_PLATFORM=riscv64-linux;
SUPPORT_LLVM=yes
;;
i*86-*-netbsd*)
OPEN_DYLAN_TARGET_PLATFORM=x86-netbsd;
;;
amd64-*-netbsd* | x86_64-*-netbsd*)
OPEN_DYLAN_TARGET_PLATFORM=x86_64-netbsd;
;;
*)
AC_MSG_ERROR([The $host platform is not supported.])
;;
esac
AC_SUBST(OPEN_DYLAN_TARGET_PLATFORM)
AC_SUBST(ADDITIONAL_RUNTIME_TARGET_PLATFORMS)
AC_SUBST(MACOS_SDK)
AC_SUBST(shrext)
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 Time::HiRes"
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_PATH_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_MSG_CHECKING(if $DYLANCOMPILER supports the -jobs flag)
if $DYLANCOMPILER -version -jobs 1 >/dev/null 2>&1 ; then
DYLANCOMPILER="$DYLANCOMPILER -jobs \$(DYLAN_JOBS)"
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
AC_SUBST(DYLANCOMPILER)
# TODO: figure out the bootstrap type given the fdcompile version
# as we may be able to just do a 1-stage-bootstrap. But for now,
# default to a 3-stage-bootstrap to be safe.
bootstrap_target=3-stage-bootstrap
AC_SUBST(bootstrap_target)
AC_PROG_CC([clang-17 clang-16 clang-15 clang-14 clang14 clang-12 clang12 clang-11 clang11 clang-10 clang10 clang-9 clang90 clang-8 clang80 clang gcc cc])
AC_PROG_CXX([clang++-17 clang++-16 clang++-15 clang++-14 clang++14 clang++-12 clang++12 clang++-11 clang++11 clang++-10 clang++10 clang++-9 clang++90 clang++-8 clang++80 clang++ g++ c++])
AS_IF([test -n "$SUPPORT_LLVM"],
[AC_MSG_CHECKING([if LLVM bitcode can be compiled])
cp $srcdir/config/llvm/$OPEN_DYLAN_TARGET_PLATFORM.bc conftest.bc
AS_IF([$CC -c $CFLAGS conftest.bc >&AS_MESSAGE_LOG_FD 2>&1 &&
{ test -f conftest.o || test -f conftest.obj; }],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
SUPPORT_LLVM=])
rm -f conftest.bc conftest.o conftest.obj])
AC_SUBST(SUPPORT_LLVM)
DEFAULT_COMPILER_BACK_END=c
SUPPORTED_COMPILER_BACK_ENDS=c
AS_IF([test -n "$SUPPORT_HARP"],
[DEFAULT_COMPILER_BACK_END=harp
SUPPORTED_COMPILER_BACK_ENDS="harp $SUPPORTED_COMPILER_BACK_ENDS"])
AS_IF([test -n "$SUPPORT_LLVM"],
[DEFAULT_COMPILER_BACK_END=llvm
SUPPORTED_COMPILER_BACK_ENDS="llvm $SUPPORTED_COMPILER_BACK_ENDS"])
AC_SUBST(SUPPORTED_COMPILER_BACK_ENDS)
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_DEFUN([CANONICALIZE_COLLECTOR_NAME],
[AS_CASE(${$1},
[mps|MPS], [$1=MPS],
[gc|boehm|Boehm|BDW|BDW_GC], [$1=BDW_GC],
[malloc], [$1=MALLOC],
AC_MSG_ERROR([Collector name `${$1}' is unrecognized.]))])
AC_ARG_WITH(harp-collector,
AS_HELP_STRING([--with-harp-collector=mps|boehm|malloc],
[Which GC to use with the HARP back-end]),
[HARP_COLLECTOR=$withval],
[HARP_COLLECTOR=mps])
AS_IF([test -n "$SUPPORT_HARP"],
[AC_MSG_CHECKING([which GC to use with the HARP back-end])
AC_MSG_RESULT($HARP_COLLECTOR)])
CANONICALIZE_COLLECTOR_NAME(HARP_COLLECTOR)
AC_SUBST(HARP_COLLECTOR)
AC_ARG_WITH(c-collector,
AS_HELP_STRING([--with-c-collector=boehm|malloc],
[Which GC to use with the C back-end]),
[C_COLLECTOR=$withval],
[C_COLLECTOR=boehm])
AC_MSG_CHECKING([which GC to use with the C back-end ])
AC_MSG_RESULT($C_COLLECTOR)
CANONICALIZE_COLLECTOR_NAME(C_COLLECTOR)
AC_SUBST(C_COLLECTOR)
AC_ARG_WITH(llvm-collector,
AS_HELP_STRING([--with-llvm-collector=boehm|malloc],
[Which GC to use with the LLVM back-end]),
[LLVM_COLLECTOR=$withval],
[LLVM_COLLECTOR=boehm])
AS_IF([test -n "$SUPPORT_LLVM"],
[AC_MSG_CHECKING([which GC to use with the LLVM back-end ])
AC_MSG_RESULT($LLVM_COLLECTOR)])
CANONICALIZE_COLLECTOR_NAME(LLVM_COLLECTOR)
AC_SUBST(LLVM_COLLECTOR)
AC_ARG_WITH(mps,
AS_HELP_STRING([--with-mps=DIR],
[Memory Pool System (MPS) source directory]))
AS_IF([test -n "$SUPPORT_HARP" && test x$HARP_COLLECTOR = xMPS],
[VALIDATE_MPS=yes])
AS_IF([test -n "$SUPPORT_LLVM" && test x$LLVM_COLLECTOR = xMPS],
[VALIDATE_MPS=yes])
AS_IF([test -n "$VALIDATE_MPS"],
[MPS_CFLAGS="-I${with_mps}/code"
MPS_LIBS=
save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $MPS_CFLAGS"
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 using --with-mps=DIR])])
CPPFLAGS="$save_CPPFLAGS"
# This is to help catch people who haven't updated to the new MPS yet.
AS_IF([test ! -f ${with_mps}/code/mps.c],
[AC_MSG_ERROR([You have an old version of MPS and need to update.])])])
AC_SUBST(MPS_CFLAGS)
AC_SUBST(MPS_LIBS)
AC_ARG_WITH(gc,
AS_HELP_STRING([--with-gc=DIR],
[Directory prefix where the Boehm-Demers-Weiser Garbage Collector is installed]),
[BDW_GC_CFLAGS="-I${with_gc}/include"
BDW_GC_LIBS="-L${with_gc}/lib -lgc"
save_CPPFLAGS="$CPPFLAGS"
save_LIBS="$LIBS"
LIBS="$BDW_GC_LIBS $LIBS"
AC_CHECK_LIB(gc, [GC_malloc],
[],
[AC_MSG_ERROR([Could not find the Boehm-Demers-Weiser Garbage Collector. Please specify the prefix directory using --with-gc=DIR, or omit --with-gc to search using pkg-config.])])
CPPFLAGS="$save_CPPFLAGS"
LIBS="$save_LIBS"],
[PKG_CHECK_MODULES(BDW_GC, $BDW_GC_MODULE,
[AS_IF([test -n "$BDW_GC_STATIC"],
[AC_MSG_CHECKING(if static gc library is present)
BDW_GC_LIBDIR=`$PKG_CONFIG --variable=libdir $BDW_GC_MODULE`
BDW_GC_STATIC_LIB=$BDW_GC_LIBDIR/libgc.a
AS_IF([test -f "$BDW_GC_STATIC_LIB"],
[AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
BDW_GC_STATIC=
BDW_GC_STATIC_LIB=])])],
[AC_CHECK_LIB(gc, [GC_malloc],
[],
[AC_MSG_ERROR([Could not find the Boehm-Demers-Weiser Garbage Collector. Please specify the prefix directory using --with-gc=DIR, or omit --with-gc to search using pkg-config.])])
BDW_GC_LIBS=-lgc])])
AC_SUBST(BDW_GC_STATIC)
AC_SUBST(BDW_GC_STATIC_LIB)
# 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_CHECK_FUNC(sigaction,
AC_CHECK_TYPE(siginfo_t,
AC_DEFINE(HAVE_SIGINFO_T, 1,
[Define if you have 'siginfo_t']),
[],
[#include <signal.h>]))
# libm
AC_SEARCH_LIBS([atan], [m])
# libunwind
AC_CHECK_HEADERS([libunwind.h], [backtrace=yes], [backtrace=no])
AC_MSG_CHECKING(for libunwind library)
AC_LANG_CONFTEST([AC_LANG_PROGRAM([#define UNW_LOCAL_ONLY
#include <stddef.h>
#include <libunwind.h>],
[unw_step(NULL)])])
AC_LINK_IFELSE([], [AC_MSG_RESULT(none needed)],
[save_LIBS="$LIBS"
LIBS="$LIBS -lunwind"
AC_LINK_IFELSE([], [AC_MSG_RESULT(-lunwind)],
[AC_MSG_RESULT(not found)
LIBS="$save_LIBS"])])
AS_ECHO(["
Targeting '${target}' ('${OPEN_DYLAN_TARGET_PLATFORM}')
Default compiler back-end ${DEFAULT_COMPILER_BACK_END}
LLVM support ${SUPPORT_LLVM:-no}"])
AS_IF([test -n "$SUPPORT_LLVM"],
[AS_ECHO([" LLVM back-end collector ${LLVM_COLLECTOR}"])])
AS_ECHO([" HARP support ${SUPPORT_HARP:-no}"])
AS_IF([test -n "$SUPPORT_HARP"],
[AS_ECHO([" HARP back-end collector ${HARP_COLLECTOR}"])])
AS_ECHO([" C back-end collector ${C_COLLECTOR}
Backtrace support using libunwind ${backtrace}
"])
AC_CONFIG_FILES(Makefile
sources/jamfiles/Makefile
sources/jamfiles/config.jam
sources/lib/run-time/Makefile)
AC_OUTPUT