forked from dylan-lang/opendylan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
212 lines (192 loc) · 6.48 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
AC_INIT([Open Dylan], [2012.1])
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
AC_CANONICAL_TARGET
case $target in
i*86-*-linux*)
OPEN_DYLAN_PLATFORM_NAME=x86-linux;
RUNTIME_SOURCES=sources/lib/run-time;
SUPPORT_GC_MPS=yes;
SUPPORT_GC_BOEHM=no
;;
i*86-*-freebsd*)
OPEN_DYLAN_PLATFORM_NAME=x86-freebsd;
RUNTIME_SOURCES=sources/lib/run-time;
SUPPORT_GC_MPS=yes;
SUPPORT_GC_BOEHM=no
;;
i*86-*-darwin*)
OPEN_DYLAN_PLATFORM_NAME=x86-darwin;
RUNTIME_SOURCES=sources/dfmc/c-run-time
GC_USE_STATIC_BOEHM=true
;;
x86_64-*-darwin*)
OPEN_DYLAN_PLATFORM_NAME=x86-darwin;
RUNTIME_SOURCES=sources/dfmc/c-run-time
GC_USE_STATIC_BOEHM=true
;;
powerpc-*-darwin*)
OPEN_DYLAN_PLATFORM_NAME=ppc-darwin;
RUNTIME_SOURCES=sources/dfmc/c-run-time
;;
amd64-*-freebsd*)
OPEN_DYLAN_PLATFORM_NAME=amd64-freebsd;
RUNTIME_SOURCES=sources/dfmc/c-run-time
GC_LIB="-lgc-threaded"
;;
x86_64-*-linux*)
OPEN_DYLAN_PLATFORM_NAME=x86_64-linux;
RUNTIME_SOURCES=sources/dfmc/c-run-time
;;
*)
AC_MSG_ERROR([The $target platform is not supported.])
;;
esac
AC_SUBST(OPEN_DYLAN_PLATFORM_NAME)
AC_SUBST(RUNTIME_SOURCES)
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])
test "$DYLANCOMPILER" = dylan-compiler && DYLANCOMPILER="$DYLANCOMPILER -build"
test "$DYLANCOMPILER" = opendylan && DYLANCOMPILER="$DYLANCOMPILER -build"
test "$DYLANCOMPILER" = minimal-console-compiler && DYLANCOMPILER="$DYLANCOMPILER -build"
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(mps,
AS_HELP_STRING([--with-mps=PATH],
[Path to MPS distribution and build.]))
AC_ARG_WITH(gc,
AS_HELP_STRING([--with-gc=PATH],
[Path of Boehm GC installation.]))
AS_IF([test x${GC_USE_STATIC_BOEHM} == xtrue],
[
GC_LIB_NAME=libgc.a
],
[
AS_IF([test x${OPEN_DYLAN_PLATFORM_NAME} == xx86-darwin],
[
GC_LIB_NAME=libgc.dylib
],
[
GC_LIB_NAME=libgc.so
])
]
)
AS_IF([test x$with_mps != x],
[
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_mps}/code"
GC_CHOICE="mps"
old_CPPFLAGS=$CPPFLAGS
CPPFLAGS="-I${with_mps}/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_mps}/code/lii4gc.gmk],[AC_MSG_ERROR([You have an old version of MPS and need to update.])],[])
]
)
AS_IF([test x$with_gc != x],
[
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}/include"
GC_LFLAGS="-L${with_gc}/lib ${GC_LIB:--lgc}"
AC_CHECK_FILE([${with_gc}/lib/${GC_LIB_NAME}],
[
GC_LIBRARY="${with_gc}/lib/${GC_LIB_NAME}"
],
[])
GC_CHOICE="boehm"
]
)
AS_IF([test x${with_gc}x${with_mps} == xx],
[
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"
GC_LFLAGS="${GC_LIB:--lgc}"
GC_CHOICE="boehm"
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}"
],
[])
])
]
)
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])
]
)
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)
# for now, replace mps only in pentium-linux
# gc is also replaced in sources/dfmc/c-run-time
AC_CONFIG_FILES(Makefile
sources/jamfiles/Makefile
sources/jamfiles/config.jam
sources/lib/run-time/Makefile
sources/dfmc/c-run-time/Makefile)
AC_OUTPUT