-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
339 lines (285 loc) · 9.04 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
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
dnl configure.ac
dnl
dnl syx - Smalltalk YX programming language
dnl
dnl version info
m4_define([syx_version], [0.1.6])
dnl init autoconf
AC_INIT([syx], [syx_version], [lethalman88@gmail.com])
AC_PREREQ([2.59])
dnl set $target
AC_CANONICAL_TARGET
dnl init automake
AM_INIT_AUTOMAKE([syx], [syx_version()])
AM_CONFIG_HEADER(syx/syx-config.h)
CFLAGS="$CFLAGS -Wall -Wno-strict-aliasing -DROOT_PATH=$datadir/syx -DIMAGE_PATH=$datadir/syx/default.sim -DPLUGIN_PATH=$libdir/syx"
dnl check for basic programs
AC_PROG_CC
AC_PROG_CC_STDC
AC_PROG_INSTALL
AC_PROG_LIBTOOL
PKG_PROG_PKG_CONFIG
dnl check for standard header files
AC_HEADER_STDC
AC_CHECK_HEADERS([string.h sys/stat.h time.h stdio.h assert.h fcntl.h],,
AC_MSG_ERROR(cannot build Syx without $ac_header header))
AC_CHECK_HEADERS([stdarg.h byteswap.h errno.h unistd.h stdint.h sys/time.h])
AC_CHECK_FUNCS([strtol strtod],,
AC_MSG_ERROR(cannot build Syx without $ac_func function))
AC_CHECK_FUNCS([fstat access getenv perror signal select])
AC_CHECK_TYPES(int64_t)
dnl check C Compiler characteristics
AC_C_INLINE
if test "$ac_cv_c_inline" != no; then
AC_DEFINE(HAVE_INLINE, 1, [Define to 1 if you have 'inline'.])
fi
AC_C_BIGENDIAN
dnl target specific
native_win32=no
case "$target" in
*-darwin*)
CFLAGS="$CFLAGS -no-cpp-precomp -fno-common"
;;
*-wince*)
native_win32=yes
target_wince=yes
CFLAGS="$CFLAGS -DWINCE"
;;
*-*-mingw*)
native_win32=yes
;;
esac
dnl default final output
build_gmp="no"
build_plugins="no"
build_gtk="no"
build_x11="no"
build_readline="no"
build_wingui="no"
dnl debug level
AC_MSG_CHECKING([the build debug level])
AC_ARG_ENABLE(debug,
AC_HELP_STRING([--enable-debug],
[debug level (no, normal, info, full) [default=normal]]),
[],[enable_debug="normal"])
AC_MSG_RESULT([$enable_debug])
dnl gmp support
AC_MSG_CHECKING([whether to build with big numbers support])
AC_ARG_WITH(gmp,
AC_HELP_STRING([--without-gmp],
[do not support big numbers [default=yes]]),
[],[with_gmp="yes"])
AC_MSG_RESULT([$with_gmp])
dnl plugins support
AC_MSG_CHECKING([whether to build with plugins support])
AC_ARG_WITH(plugins,
AC_HELP_STRING([--without-plugins],
[do not support plugins [default=yes]]),
[],[with_plugins="yes"])
AC_MSG_RESULT([$with_plugins])
dnl gprof profiling
AC_MSG_CHECKING([whether to compile and link with -pg])
AC_ARG_ENABLE(profile,
AC_HELP_STRING([--enable-profile],
[compile and link with -pg [default=no]]),
[],[enable_profile="no"])
AC_MSG_RESULT([$enable_profile])
dnl internal profiling
AC_MSG_CHECKING([whether to enable internal profiling])
AC_ARG_ENABLE(iprofile,
AC_HELP_STRING([--enable-iprofile],
[enable internal profiling [default=no]]),
[],[enable_iprofile="no"])
AC_MSG_RESULT([$enable_iprofile])
dnl gtk
AC_MSG_CHECKING([whether to build the GTK+ plugin])
AC_ARG_ENABLE(gtk,
AC_HELP_STRING([--disable-gtk],
[enable build the GTK+ plugin [default=yes]]),
[],[enable_gtk="yes"])
AC_MSG_RESULT([$enable_gtk])
dnl x11
AC_MSG_CHECKING([whether to build the X11 plugin])
AC_ARG_ENABLE(x11,
AC_HELP_STRING([--disable-x11],
[enable build the X11 plugin [default=yes]]),
[],[enable_x11="yes"])
AC_MSG_RESULT([$enable_x11])
dnl readline
AC_MSG_CHECKING([whether to build the Readline plugin])
AC_ARG_ENABLE(readline,
AC_HELP_STRING([--disable-readline],
[enable build the Readline plugin [default=yes]]),
[],[enable_readline="yes"])
AC_MSG_RESULT([$enable_readline])
dnl wingui
AC_MSG_CHECKING([whether to build the WinGui plugin])
AC_ARG_ENABLE(wingui,
AC_HELP_STRING([--enable-wingui],
[enable build the WinGui plugin]),
[],[enable_wingui=$native_win32])
AC_MSG_RESULT([$enable_wingui])
dnl check for debug level
case "$enable_debug" in
no)
CFLAGS="$CFLAGS -O3"
;;
normal)
CFLAGS="$CFLAGS -g -O2"
;;
info)
CFLAGS="$CFLAGS -g -O -DSYX_DEBUG_INFO"
;;
full)
CFLAGS="$CFLAGS -g -O -DSYX_DEBUG_INFO -DSYX_DEBUG_FULL"
;;
esac
dnl win32 specific
if test "$native_win32" == yes; then
SYX_OTHER_CFLAGS="$SYX_OTHER_CFLAGS -DWINDOWS -D_DLL"
SYX_OTHER_LIBS="$SYX_OTHER_LIBS -lwsock32"
fi
dnl check for profile
if test "$enable_profile" == yes; then
SYX_OTHER_CFLAGS="$SYX_OTHER_CFLAGS -pg"
SYX_OTHER_LIBS="$SYX_OTHER_LIBS -pg"
fi
dnl check for internal profiling
if test "$enable_iprofile" == yes; then
CFLAGS="$CFLAGS -DSYX_PROFILE"
fi
dnl check for math library
AC_CHECK_LIB(m, floor, [SYX_OTHER_LIBS="$SYX_OTHER_LIBS -lm"])
dnl check for gmp library
if test "$with_gmp" != no; then
AC_CACHE_CHECK(for mpz_init in -lgmp, syx_cv_gmp_libs, [
syx_cv_gmp_libs="-lgmp"
ac_save_LIBS="$LIBS"
LIBS="$LIBS $syx_cv_gmp_libs"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <stdio.h>
#include <gmp.h>
]], [[
mpz_t z;
mpz_init (z);
]])],, [syx_cv_gmp_libs="not found"])
LIBS="$ac_save_LIBS"
])
if test "$syx_cv_gmp_libs" != "not found"; then
SYX_OTHER_LIBS="$SYX_OTHER_LIBS $syx_cv_gmp_libs"
AC_DEFINE(HAVE_LIBGMP, 1, [Define to 1 if you have the 'gmp' library (-lgmp).])
build_gmp="yes"
else
build_gmp="no"
fi
fi
dnl check for plugins
if test "$with_plugins" != no; then
AC_CHECK_LIB(dl, dlopen, [
AC_DEFINE(HAVE_LIBDL, 1, [Define to 1 if you have the 'ltdl' library (-ldl).])
SYX_OTHER_LIBS="$SYX_OTHER_LIBS -ldl"
SYX_OTHER_CFLAGS="$SYX_OTHER_CFLAGS -DWITH_PLUGINS"
build_plugins="yes"], [build_plugins="no"])
fi
AC_SUBST(SYX_OTHER_CFLAGS)
AC_SUBST(SYX_OTHER_LIBS)
dnl set syx/st/kernel dir
stkerneldatadir="$datadir/syx/st/kernel"
AC_SUBST(stkerneldatadir)
dnl set syx/st/foreign dir
stforeigndatadir="$datadir/syx/st/foreign"
AC_SUBST(stforeigndatadir)
dnl stuff to go in the syx-config.h file
AH_TOP(
[#ifndef SYX_CONFIG_H
#define SYX_CONFIG_H])
AH_BOTTOM(
[#endif /* SYX_CONFIG_H */])
AC_CONFIG_FILES([
Makefile
syx/Makefile
src/Makefile
share/Makefile
doc/Makefile
examples/Makefile
examples/basic/Makefile
examples/console/Makefile
examples/embedding/Makefile
examples/web/Makefile
examples/gtk/Makefile
examples/x11/Makefile
tests/Makefile
])
plugin_subdirs=
if test "$build_plugins" == yes; then
dnl enable gtk
if test "$enable_gtk" != no; then
PKG_CHECK_MODULES([GTK_DEP],
[gthread-2.0 >= 2.12.0
gtk+-2.0 >= 2.12.0],
[build_gtk="yes"
plugin_subdirs="$plugin_subdirs gtk"
AC_CONFIG_FILES([plugins/gtk/Makefile])
stgtkdatadir="$datadir/syx/st/gtk"
AC_SUBST(stgtkdatadir)])
fi
dnl enable readline
if test "$enable_readline" != no; then
AC_CHECK_LIB([readline], [add_history],
[build_readline="yes"
READLINE_DEP_LIBS="-lreadline"
AC_SUBST([READLINE_DEP_LIBS])
plugin_subdirs="$plugin_subdirs readline"
AC_CONFIG_FILES([plugins/readline/Makefile])
streadlinedatadir="$datadir/syx/st/readline"
AC_SUBST(streadlinedatadir)])
fi
dnl enable x11
if test "$enable_x11" != no; then
AC_CHECK_LIB([X11], [XOpenDisplay],
[build_x11="yes"
X11_DEP_LIBS="-lX11"
AC_SUBST([X11_DEP_LIBS])
plugin_subdirs="$plugin_subdirs x11"
AC_CONFIG_FILES([plugins/x11/Makefile])
stx11datadir="$datadir/syx/st/x11"
AC_SUBST(stx11datadir)])
fi
dnl enable wingui
if test "$enable_wingui" != no; then
if test "$target_wince" == yes; then
AC_CHECK_LIB([commctrl], [MessageBox],
[build_wingui="yes"])
else
build_wingui="yes"
fi
if test "$build_wingui" == yes; then
WINGUI_DEP_LIBS="-lcommctrl"
AC_SUBST([WINGUI_DEP_LIBS])
plugin_subdirs="$plugin_subdirs wingui"
AC_CONFIG_FILES([plugins/wingui/Makefile])
stwinguidatadir="$datadir/syx/st/wingui"
AC_SUBST(stwinguidatadir)
fi
fi
fi
AC_CONFIG_FILES([plugins/Makefile])
AC_SUBST(plugin_subdirs)
plugindir="$libdir/syx"
AC_SUBST(plugindir)
AC_OUTPUT
echo "
Smalltalk YX was configured with the following options:
Debug level : $enable_debug
Big numbers support : $build_gmp
Plugins support : $build_plugins
"
if test "$build_plugins" == "yes"; then
echo "
The following plugins will be built:
GTK+ : $build_gtk
Readline : $build_readline
X11 : $build_x11
WinGui : $build_wingui
"
fi