3 dnl syx - Smalltalk YX programming language
7 m4_define([syx_version], [0.1.7])
10 AC_INIT([syx], [syx_version], [lethalman88@gmail.com])
17 AM_INIT_AUTOMAKE([syx], [syx_version()])
18 AM_CONFIG_HEADER(syx/syx-config.h)
21 CFLAGS="$CFLAGS -Wall -Wno-strict-aliasing -DROOT_PATH=$datadir/syx -DIMAGE_PATH=$datadir/syx/default.sim -DPLUGIN_PATH=$libdir/syx"
23 dnl check for basic programs
30 dnl check for standard header files
33 AC_CHECK_HEADERS([string.h sys/stat.h time.h stdio.h assert.h fcntl.h],,
34 AC_MSG_ERROR(cannot build Syx without $ac_header header))
35 AC_CHECK_HEADERS([stdarg.h byteswap.h errno.h unistd.h stdint.h sys/time.h])
37 AC_CHECK_FUNCS([strtol strtod],,
38 AC_MSG_ERROR(cannot build Syx without $ac_func function))
39 AC_CHECK_FUNCS([fstat access getenv perror signal select])
41 AC_CHECK_TYPES(int64_t)
43 dnl check C Compiler characteristics
45 if test "$ac_cv_c_inline" != no; then
46 AC_DEFINE(HAVE_INLINE, 1, [Define to 1 if you have 'inline'.])
56 CFLAGS="$CFLAGS -no-cpp-precomp -fno-common"
61 CFLAGS="$CFLAGS -DWINCE"
68 AM_CONDITIONAL(WIN32, test "$native_win32" != no)
70 dnl default final output
79 AC_MSG_CHECKING([the build debug level])
81 AC_HELP_STRING([--enable-debug],
82 [debug level (no, normal, info, full) [default=normal]]),
83 [],[enable_debug="normal"])
84 AC_MSG_RESULT([$enable_debug])
87 AC_MSG_CHECKING([whether to build with big numbers support])
89 AC_HELP_STRING([--without-gmp],
90 [do not support big numbers [default=yes]]),
92 AC_MSG_RESULT([$with_gmp])
95 AC_MSG_CHECKING([whether to build with plugins support])
97 AC_HELP_STRING([--without-plugins],
98 [do not support plugins [default=yes]]),
99 [],[with_plugins="yes"])
100 AC_MSG_RESULT([$with_plugins])
103 AC_MSG_CHECKING([whether to compile and link with -pg])
104 AC_ARG_ENABLE(profile,
105 AC_HELP_STRING([--enable-profile],
106 [compile and link with -pg [default=no]]),
107 [],[enable_profile="no"])
108 AC_MSG_RESULT([$enable_profile])
110 dnl internal profiling
111 AC_MSG_CHECKING([whether to enable internal profiling])
112 AC_ARG_ENABLE(iprofile,
113 AC_HELP_STRING([--enable-iprofile],
114 [enable internal profiling [default=no]]),
115 [],[enable_iprofile="no"])
116 AC_MSG_RESULT([$enable_iprofile])
119 AC_MSG_CHECKING([whether to build the GTK+ plugin])
121 AC_HELP_STRING([--disable-gtk],
122 [enable build the GTK+ plugin [default=yes]]),
123 [],[enable_gtk="yes"])
124 AC_MSG_RESULT([$enable_gtk])
127 AC_MSG_CHECKING([whether to build the X11 plugin])
129 AC_HELP_STRING([--disable-x11],
130 [enable build the X11 plugin [default=yes]]),
131 [],[enable_x11="yes"])
132 AC_MSG_RESULT([$enable_x11])
135 AC_MSG_CHECKING([whether to build the Readline plugin])
136 AC_ARG_ENABLE(readline,
137 AC_HELP_STRING([--disable-readline],
138 [enable build the Readline plugin [default=yes]]),
139 [],[enable_readline="yes"])
140 AC_MSG_RESULT([$enable_readline])
143 AC_MSG_CHECKING([whether to build the WinGui plugin])
144 AC_ARG_ENABLE(wingui,
145 AC_HELP_STRING([--enable-wingui],
146 [enable build the WinGui plugin]),
147 [],[enable_wingui=$native_win32])
148 AC_MSG_RESULT([$enable_wingui])
150 dnl check for debug level
151 case "$enable_debug" in
156 CFLAGS="$CFLAGS -g -O2"
159 CFLAGS="$CFLAGS -g3 -O -DSYX_DEBUG_INFO"
162 CFLAGS="$CFLAGS -g3 -O -DSYX_DEBUG_INFO -DSYX_DEBUG_FULL"
167 if test "$native_win32" == yes; then
168 SYX_OTHER_CFLAGS="$SYX_OTHER_CFLAGS -DWINDOWS -D_DLL"
169 SYX_OTHER_LIBS="$SYX_OTHER_LIBS -lwsock32"
172 dnl check for profile
173 if test "$enable_profile" == yes; then
174 SYX_OTHER_CFLAGS="$SYX_OTHER_CFLAGS -pg"
175 SYX_OTHER_LIBS="$SYX_OTHER_LIBS -pg"
178 dnl check for internal profiling
179 if test "$enable_iprofile" == yes; then
180 CFLAGS="$CFLAGS -DSYX_PROFILE"
183 dnl check for math library
184 AC_CHECK_LIB(m, floor, [SYX_OTHER_LIBS="$SYX_OTHER_LIBS -lm"])
186 dnl check for gmp library
187 if test "$with_gmp" != no; then
188 AC_CACHE_CHECK(for mpz_init in -lgmp, syx_cv_gmp_libs, [
189 syx_cv_gmp_libs="-lgmp"
191 LIBS="$LIBS $syx_cv_gmp_libs"
193 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
199 ]])],, [syx_cv_gmp_libs="not found"])
203 if test "$syx_cv_gmp_libs" != "not found"; then
204 SYX_OTHER_LIBS="$SYX_OTHER_LIBS $syx_cv_gmp_libs"
205 AC_DEFINE(HAVE_LIBGMP, 1, [Define to 1 if you have the 'gmp' library (-lgmp).])
212 dnl check for plugins
213 if test "$with_plugins" != no; then
214 AC_CHECK_LIB(dl, dlopen, [
215 AC_DEFINE(HAVE_LIBDL, 1, [Define to 1 if you have the 'ltdl' library (-ldl).])
216 SYX_OTHER_LIBS="$SYX_OTHER_LIBS -ldl"
217 SYX_OTHER_CFLAGS="$SYX_OTHER_CFLAGS -DWITH_PLUGINS"
218 build_plugins="yes"], [build_plugins="no"])
221 AC_SUBST(SYX_OTHER_CFLAGS)
222 AC_SUBST(SYX_OTHER_LIBS)
224 dnl set syx/st/kernel dir
225 stkerneldatadir="$datadir/syx/st/kernel"
226 AC_SUBST(stkerneldatadir)
228 dnl set syx/st/foreign dir
229 stforeigndatadir="$datadir/syx/st/foreign"
230 AC_SUBST(stforeigndatadir)
232 dnl stuff to go in the syx-config.h file
234 [#ifndef SYX_CONFIG_H
235 #define SYX_CONFIG_H])
237 [#endif /* SYX_CONFIG_H */])
247 examples/basic/Makefile
248 examples/console/Makefile
249 examples/embedding/Makefile
250 examples/web/Makefile
251 examples/gtk/Makefile
252 examples/x11/Makefile
258 if test "$build_plugins" == yes; then
261 if test "$enable_gtk" != no; then
262 PKG_CHECK_MODULES([GTK_DEP],
263 [gthread-2.0 >= 2.12.0
266 plugin_subdirs="$plugin_subdirs gtk"
267 AC_CONFIG_FILES([plugins/gtk/Makefile])
268 stgtkdatadir="$datadir/syx/st/gtk"
269 AC_SUBST(stgtkdatadir)])
273 if test "$enable_readline" != no; then
274 AC_CHECK_LIB([readline], [add_history],
275 [build_readline="yes"
276 READLINE_DEP_LIBS="-lreadline"
277 AC_SUBST([READLINE_DEP_LIBS])
278 plugin_subdirs="$plugin_subdirs readline"
279 AC_CONFIG_FILES([plugins/readline/Makefile])
280 streadlinedatadir="$datadir/syx/st/readline"
281 AC_SUBST(streadlinedatadir)])
285 if test "$enable_x11" != no; then
286 AC_CHECK_LIB([X11], [XOpenDisplay],
289 AC_SUBST([X11_DEP_LIBS])
290 plugin_subdirs="$plugin_subdirs x11"
291 AC_CONFIG_FILES([plugins/x11/Makefile])
292 stx11datadir="$datadir/syx/st/x11"
293 AC_SUBST(stx11datadir)])
297 if test "$enable_wingui" != no; then
298 if test "$target_wince" == yes; then
299 AC_CHECK_LIB([commctrl], [MessageBox],
300 [build_wingui="yes"])
305 if test "$build_wingui" == yes; then
306 WINGUI_DEP_LIBS="-lcommctrl"
307 AC_SUBST([WINGUI_DEP_LIBS])
308 plugin_subdirs="$plugin_subdirs wingui"
309 AC_CONFIG_FILES([plugins/wingui/Makefile])
310 stwinguidatadir="$datadir/syx/st/wingui"
311 AC_SUBST(stwinguidatadir)
316 AC_CONFIG_FILES([plugins/Makefile])
318 AC_SUBST(plugin_subdirs)
320 plugindir="$libdir/syx"
326 Smalltalk YX was configured with the following options:
328 Debug level : $enable_debug
329 Big numbers support : $build_gmp
330 Plugins support : $build_plugins
333 if test "$build_plugins" == "yes"; then
335 The following plugins will be built:
338 Readline : $build_readline
340 WinGui : $build_wingui