1dnl Hey Emacs, I want this in -*- Autoconf -*- mode, please.
2dnl ---
3dnl Copyright 1992-2009 Free Software Foundation, Inc.
4dnl Please see COPYING for a description your rights and responsibilities
5dnl with this software.
6dnl Process this file with autoconf to produce a configure script.
7
8dnl 2.63 needed by testsuite, actually
9AC_PREREQ(2.63)
10AC_INIT([GNU Smalltalk], 3.2.5, help-smalltalk@gnu.org, smalltalk,
11        [http://smalltalk.gnu.org/])
12MAINTAINER="bonzini@gnu.org"
13
14dnl CURRENT:REVISION:AGE means this is the REVISION-th version of
15dnl the CURRENT-th interface; all the interface from CURRENT-AGE
16dnl to CURRENT are supported.
17GST_REVISION(8:3:1)
18AC_CONFIG_AUX_DIR([build-aux])
19AC_CONFIG_MACRO_DIR([build-aux])
20AC_CONFIG_SRCDIR([main.c])
21AC_CONFIG_TESTDIR(tests)
22AC_CONFIG_HEADERS([config.h])
23GST_PROG_GAWK
24AM_INIT_AUTOMAKE
25AC_CANONICAL_HOST
26
27if test -d $srcdir/.git; then
28  GIT_REVISION=-`git rev-parse --short HEAD 2>/dev/null || echo git`
29else
30  GIT_REVISION=
31fi
32AC_DEFINE_UNQUOTED([PACKAGE_GIT_REVISION], ["$GIT_REVISION"],
33		   [The git version that GNU Smalltalk was compiled from.])
34
35
36RSE_BOLD
37
38dnl
39dnl ------------------------------- PROGRAMS ------------------
40
41{ echo; echo "${term_bold}Build Tools:${term_norm}"; } >& AS_MESSAGE_FD
42
43GST_PROG_CC(strict-aliasing,	   	 		           dnl enabled optimizations
44    gcse,                               	                   dnl disabled optimizations
45    all write-strings pointer-arith declaration-after-statement,   dnl enabled warnings
46    strict-aliasing pointer-sign long-double format switch)	   dnl disabled warnings
47
48if test "$GCC" != yes; then
49  AC_MSG_ERROR([Please use GCC to compile GNU Smalltalk.])
50fi
51
52case "$host" in
53  alpha*-*-*) CFLAGS="$CFLAGS -mieee" ;;
54esac
55
56# We don't require Automake 1.10, so invoke _AM_DEPENDENCIES manually.  And
57# since we actually use Objective-C only on Mac OS (for libsdl), for now we
58# get by with using gcc as an Objective-C compiler.
59AC_SUBST(OBJC, [$CC])
60AC_SUBST(OBJCFLAGS, [$CFLAGS])
61_AM_DEPENDENCIES(OBJC)
62
63AC_PROG_SED
64AC_PROG_LN_S
65GST_PROG_LN
66PKG_PROG_PKG_CONFIG
67AC_PATH_TOOL(WINDRES, windres, no)
68AC_PATH_PROG(INSTALL_INFO, install-info, :, $PATH:/sbin:/usr/sbin)
69AC_PATH_PROG(ZIP, zip, no, $PATH)
70AC_CHECK_PROG(TIMEOUT, timeout, [timeout 600s], [env])
71if test "$ZIP" = no; then
72  AC_MSG_ERROR([Please install InfoZIP to use GNU Smalltalk.])
73fi
74
75# For Wine, compile in GST a generic path to zip.exe.  For build time,
76# wrap the native zip with winewrapper to hide Windows paths from it.
77GST_WINE_IF([WINEWRAPPERDEP='winewrapper$(EXEEXT)'
78	     WINEWRAPPER='$(abs_top_builddir)/winewrapper$(EXEEXT)'
79	     XZIP='$(WINEWRAPPER) '$ZIP
80	     ZIP=zip.exe,
81             AC_CONFIG_FILES([makesetup], [chmod +x makesetup])],
82	    [WINEWRAPPER=
83	     WINEWRAPPERDEP=
84	     XZIP=$ZIP])
85AC_SUBST([WINEWRAPPER])
86AC_SUBST([WINEWRAPPERDEP])
87AC_SUBST([XZIP])
88
89AC_ARG_WITH(emacs,
90[  --without-emacs         disable Emacs modes for Smalltalk], ,
91with_emacs=yes)
92test "$with_emacs" = no && EMACS=no
93
94AM_PATH_LISPDIR
95GST_PATH_LISPSTARTDIR
96GST_EMACS_PACKAGE(comint)
97
98AM_CONDITIONAL(WITH_EMACS, test "$EMACS" != no)
99AM_CONDITIONAL(WITH_EMACS_COMINT, test "$ac_cv_emacs_comint" != no)
100
101dnl We only want the GNU implementations
102AM_MISSING_PROG(LEX, flex, $missing_dir)
103AM_MISSING_PROG(YACC, bison, $missing_dir)
104AM_MISSING_PROG(GPERF, gperf, $missing_dir)
105AM_MISSING_PROG(AUTOM4TE, autom4te, $missing_dir)
106
107dnl
108dnl ------------------------------ SUBDIRS --------------------
109
110PKG_CHECK_MODULES(GNUTLS, gnutls,
111                  [ac_cv_lib_gnutls_gnutls_global_init=yes],
112                  [GST_HAVE_LIB(gnutls, gnutls_global_init)])
113if test "$ac_cv_lib_gnutls_gnutls_global_init" = yes; then
114  AC_DEFINE(HAVE_GNUTLS, 1, [Define to 1 if gnutls is being used])
115fi
116
117dnl Throw all these away in 3.3, and just require the system
118dnl lib{ltdl,ffi,sigsegv}.  Before that, however, we need to
119dnl ensure Fedora has a cross-compiled libffi and libsigsegv.
120
121AC_ARG_WITH(system-libltdl,
122[  --with-system-libltdl[=PATH]  use system libltdl.la (search in PATH if given)],
123[], [with_system_libltdl=detect])
124
125GST_HAVE_LIB([ltdl], [lt_dlopen])
126if test $with_system_libltdl = detect; then
127  with_system_libltdl=$ac_cv_lib_ltdl_lt_dlopen
128fi
129
130if test $with_system_libltdl = no; then
131  AC_MSG_WARN([using included copy of libltdl])
132  AC_MSG_WARN([this is deprecated and will go away])
133  AC_MSG_WARN([it is suggested to install libltdl])
134  AC_LIBOBJ(ltdl)
135  AC_CONFIG_LINKS([lib-src/ltdl.h:lib-src/ltdl_.h])
136  INCLTDL= LIBLTDL=
137elif test $with_system_libltdl = yes; then
138  INCLTDL= LIBLTDL=-lltdl
139else
140  INCLTDL="-I$with_system_libltdl/../include"
141  LIBLTDL="-L$with_system_libltdl -lltdl"
142fi
143AC_SUBST(INCLTDL)
144AC_SUBST(LIBLTDL)
145
146AC_ARG_WITH(system-libffi,
147[  --with-system-libffi[=PATH]   use system libffi.la (search in PATH if given)],
148[], [with_system_libffi=detect])
149
150PKG_CHECK_MODULES(LIBFFI, libffi,
151                  [ac_cv_lib_libffi_ffi_prep_cif=yes],
152                  [GST_HAVE_LIB(libffi, ffi_prep_cif)])
153if test $with_system_libffi = detect; then
154  with_system_libffi=$ac_cv_lib_libffi_ffi_prep_cif
155fi
156if test $with_system_libffi = no; then
157  AC_MSG_WARN([using included copy of libffi])
158  AC_MSG_WARN([this is deprecated and will go away])
159  AC_MSG_WARN([it is suggested to install libffi])
160  AC_CONFIG_SUBDIRS(libffi)
161  INCFFI='-I$(top_srcdir)/libffi/include -I$(top_builddir)/libffi/include'
162  LIBFFI='$(top_builddir)/libffi/libffi.la'
163elif test $with_system_libffi = yes; then
164  INCFFI=$LIBFFI_CFLAGS
165  LIBFFI=${LIBFFI_LIBS:-'-lffi'}
166else
167  INCFFI="-I$with_system_libffi/../include"
168  LIBFFI="-L$with_system_libffi -lffi"
169fi
170case $host in
171  *-*-darwin[[912]]* ) LIBFFI_EXECUTABLE_LDFLAGS=-Wl,-allow_stack_execute ;;
172  *) LIBFFI_EXECUTABLE_LDFLAGS= ;;
173esac
174AC_SUBST(INCFFI)
175AC_SUBST(LIBFFI)
176AC_SUBST(LIBFFI_EXECUTABLE_LDFLAGS)
177
178case $ac_configure_args in
179  *--enable-subdir) ;;
180  *) ac_configure_args="$ac_configure_args --enable-subdir" ;;
181esac
182AC_SNPRINTFV_CONVENIENCE
183AC_CONFIG_SUBDIRS(snprintfv)
184
185AC_ARG_ENABLE(generational-gc,
186[  --disable-generational-gc disable generational garbage collection], ,
187[case $host in
188	*-k*bsd-gnu | \
189        *-*-cygwin* | *-*-mingw* | \
190	ia64-*-* | alpha*-*-* | sparc*-*-* )
191	  enable_generational_gc=no ;;
192        *)
193	  enable_generational_gc=yes ;;
194esac])
195
196AC_ARG_WITH(system-libsigsegv,
197[  --with-system-libsigsegv[=PATH]   use system libsigsegv.la likewise],
198[], [with_system_libsigsegv=detect])
199
200GST_HAVE_LIB([sigsegv], [sigsegv_install_handler])
201if test $with_system_libsigsegv = detect; then
202  with_system_libsigsegv=$ac_cv_lib_sigsegv_sigsegv_install_handler
203fi
204
205if test $enable_generational_gc = no; then
206  INCSIGSEGV= LIBSIGSEGV=
207else
208  AC_DEFINE(HAVE_SIGSEGV_H, 1, [Define to 1 if libsigsegv is being used])
209  if test $with_system_libsigsegv = no; then
210    case $host in
211      x86_64-apple-darwin*)
212        AC_MSG_ERROR(dnl
213[a pre-installed libsigsegv is required on 64-bit Darwin.  To
214configure: error: proceed without it, use the --disable-generational-gc
215configure: error: option for configure.])
216        ;;
217      *)
218       AC_MSG_WARN([using included copy of libsigsegv])
219       AC_MSG_WARN([this is deprecated and will go away])
220       AC_MSG_WARN([it is suggested to install libsigsegv])
221    esac
222    AC_CONFIG_SUBDIRS(sigsegv)
223    INCSIGSEGV='-I$(top_srcdir)/sigsegv/src -I$(top_builddir)/sigsegv/src'
224    LIBSIGSEGV='$(top_builddir)/sigsegv/src/libsigsegv_convenience.la'
225  elif test $with_system_libsigsegv = yes; then
226    INCSIGSEGV= LIBSIGSEGV=-lsigsegv
227  else
228    INCSIGSEGV="-I$with_system_libsigsegv/../include"
229    LIBSIGSEGV="-L$with_system_libsigsegv -lsigsegv"
230  fi
231fi
232AC_SUBST(INCSIGSEGV)
233AC_SUBST(LIBSIGSEGV)
234
235AC_ARG_WITH(imagedir,
236[  --with-imagedir=PATH   path where to place the system image
237			  (default: /usr/local/var/lib/$PACKAGE)],
238[imagedir="$withval"],
239[imagedir=`echo "$libdir" | sed \
240		-e 's,${exec_prefix},${localstatedir},' \
241		-e "s,${exec_prefix},\${localstatedir}," `/$PACKAGE ])
242AC_SUBST(imagedir)
243
244AC_ARG_WITH(moduledir,
245[  --with-moduledir=PATH  path where to look for modules
246			  (default: /usr/local/lib/$PACKAGE)],
247[moduledir="$withval"],
248[moduledir='${pkglibdir}'])
249moduleexecdir='${moduledir}'
250AC_SUBST(moduledir)
251AC_SUBST(moduleexecdir)
252
253dnl
254dnl ------------------------------ C COMPILER / OS ------------
255
256{ echo; echo "${term_bold}Platform environment:${term_norm}"; } >& AS_MESSAGE_FD
257
258GST_C_SYNC_BUILTINS
259if test $gst_cv_have_sync_fetch_and_add = no; then
260  AC_MSG_ERROR([Synchronization primitives not found, please use a newer compiler.])
261fi
262
263GST_LOCK
264AC_SYS_LARGEFILE
265AC_C_INLINE
266AC_C_RESTRICT
267
268dnl Test for broken solaris include file.  Should be moved to gnulib maybe?
269AC_MSG_CHECKING([for broken sys/avl.h])
270AC_PREPROC_IFELSE([AC_LANG_SOURCE([#include <sys/avl.h>
271  #ifndef _AVL_H
272  would be useless anyway
273  #endif
274])], [
275  AC_MSG_RESULT(yes)
276  AC_DEFINE(_AVL_H, 1,
277    [Define to 1 if, like Solaris, your system has a sys/avl.h header that
278pollutes the name space.])], [
279  AC_MSG_RESULT(no)])
280
281GST_C_HIDDEN_VISIBILITY
282GST_C_LONG_DOUBLE
283GST_C_GOTO_VOID_P
284
285AC_DEFINE_UNQUOTED(HOST_SYSTEM, "$host",
286  [Define to the host triplet.])
287
288AC_DEFINE_UNQUOTED(EXEEXT, "$ac_exeext",
289  [Define to the extension for executable files.])
290
291case "$ac_exeext:$host_os" in
292  :*) ac_argv_exeext= ;;
293  .exe:cygwin*) ac_argv_exeext= ;;
294  .exe:*) ac_argv_exeext=$ac_exeext ;;
295esac
296AC_DEFINE_UNQUOTED(ARGV_EXEEXT, "$ac_argv_exeext",
297  [Define to the extension for executable files, as it appears in argv[0].])
298
299AC_C_BIGENDIAN
300AC_CHECK_ALIGNOF(double)
301AC_CHECK_ALIGNOF(long double)
302AC_CHECK_ALIGNOF(long long)
303AC_CHECK_SIZEOF(off_t)
304AC_CHECK_SIZEOF(int)
305AC_CHECK_SIZEOF(long)
306AC_CHECK_SIZEOF(wchar_t, , [[
307#include <wchar.h>]])
308AC_CHECK_SIZEOF(OOP, , [[
309typedef void *OOP;]])
310
311AC_LIBTOOL_DLOPEN
312AC_LIBTOOL_WIN32_DLL
313AC_PROG_LIBTOOL
314
315LIBGST_CFLAGS="$SYNC_CFLAGS"
316case '$host_cpu: $CFLAGS ' in
317   i*86:*' -pg '*) ;;
318   i*86:*) LIBGST_CFLAGS="$LIBGST_CFLAGS -fomit-frame-pointer" ;;
319   *) ;;
320esac
321AC_SUBST(LIBGST_CFLAGS)
322
323case "$host_os:$WINDRES" in
324  *:no) ICON= ;;
325  cygwin*|mingw*) ICON=gsticon.o ;;
326  *) ICON= ;;
327esac
328AC_SUBST(ICON)
329
330dnl
331dnl ------------------------------- C LIBRARY -----------------
332
333{ echo; echo "${term_bold}C library features:${term_norm}"; } >& AS_MESSAGE_FD
334
335AC_TYPE_SIGNAL
336AC_TYPE_PID_T
337AC_TYPE_SIZE_T
338
339AC_HEADER_ASSERT
340AC_CHECK_HEADERS_ONCE(stdint.h inttypes.h unistd.h poll.h sys/ioctl.h \
341	sys/resource.h sys/utsname.h stropts.h sys/param.h stddef.h limits.h \
342	sys/timeb.h termios.h sys/mman.h sys/file.h execinfo.h utime.h \
343	sys/select.h sys/wait.h fcntl.h crt_externs.h, [], [], [AC_INCLUDES_DEFAULT])
344
345AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec, struct stat.st_mtimensec,
346		  struct stat.st_mtimespec.tv_nsec])
347
348AC_TYPE_INT8_T
349AC_TYPE_INT16_T
350AC_TYPE_INT32_T
351AC_TYPE_INT64_T
352AC_TYPE_INTMAX_T
353AC_TYPE_INTPTR_T
354AC_TYPE_UINT8_T
355AC_TYPE_UINT16_T
356AC_TYPE_UINT32_T
357AC_TYPE_UINT64_T
358AC_TYPE_UINTMAX_T
359AC_TYPE_UINTPTR_T
360
361if test x$ac_cv_header_poll_h = xno; then
362  AC_CONFIG_LINKS([lib-src/poll.h:lib-src/poll_.h])
363fi
364
365AC_FUNC_ALLOCA
366AC_FUNC_OBSTACK
367
368AC_CHECK_LIB(m, atan)
369GST_REPLACE_POLL
370gt_FUNC_SETENV
371GST_SOCKETS
372AC_REPLACE_FUNCS(putenv strdup strerror strsignal mkstemp getpagesize \
373	getdtablesize strstr ftruncate floorl ceill sqrtl frexpl ldexpl asinl \
374	acosl atanl logl expl tanl sinl cosl powl truncl lrintl truncf lrintf \
375        lrint trunc strsep strpbrk symlink mkdtemp)
376AC_CHECK_FUNCS_ONCE(gethostname memcpy memmove sighold uname usleep lstat \
377	grantpt popen getrusage gettimeofday fork strchr utimes utime readlink \
378	sigsetmask alarm select mprotect madvise waitpid accept4 \
379	setsid spawnl pread pwrite _NSGetExecutablePath _NSGetEnviron \
380	chown getgrnam getpwnam endgrent endpwent setgroupent setpassent)
381
382if test "$ac_cv_func__NSGetEnviron" = yes; then
383  AC_DEFINE([environ], [_NSGetEnviron()],
384    [Define to an appropriate function call if the system does not provide the
385     environ variable.])
386fi
387
388AC_SEARCH_LIBS([nanosleep], [rt])
389if test "$ac_cv_search_nanosleep" != no; then
390  AC_DEFINE(HAVE_NANOSLEEP, 1,
391    [Define if the system provides nanosleep.])
392fi
393
394AC_SEARCH_LIBS([clock_gettime], [rt])
395if test "$ac_cv_search_clock_gettime" != no; then
396  AC_DEFINE(HAVE_CLOCK_GETTIME, 1,
397    [Define if the system provides clock_gettime.])
398fi
399
400AC_SEARCH_LIBS([timer_create], [rt])
401if test "$ac_cv_search_timer_create" != no; then
402  AC_DEFINE(HAVE_TIMER_CREATE, 1,
403    [Define if the system provides timer_create.])
404fi
405
406GST_FUNC_LRINT
407GST_FUNC_STRTOUL
408GST_FUNC_LOCALTIME
409
410{ echo; echo "${term_bold}Dynamic linking capabilities:${term_norm}"; } >& AS_MESSAGE_FD
411
412GST_LIB_LTDL
413
414dnl ------------------------- OTHER LIBRARIES -------------------
415
416{ echo; echo "${term_bold}Auxiliary libraries:${term_norm}"; } >& AS_MESSAGE_FD
417
418GST_LIBC_SO_NAME
419GST_HAVE_GMP
420GST_HAVE_READLINE
421
422GST_PACKAGE_ALLOW_DISABLING
423GST_PACKAGE_PREFIX([packages])
424GST_PACKAGE_DEPENDENCIES([gst-tool$(EXEEXT) gst.im $(WINEWRAPPERDEP)])
425
426GST_PACKAGE_ENABLE([Announcements], [announcements])
427GST_PACKAGE_ENABLE([BloxTK], [blox/tk],
428   [GST_HAVE_TCLTK],
429   [gst_cv_tcltk_libs],
430   [Makefile], [blox-tk.la])
431GST_PACKAGE_ENABLE([BLOXBrowser], [blox/browser])
432GST_PACKAGE_ENABLE([Complex], [complex])
433GST_PACKAGE_ENABLE([Continuations], [continuations])
434GST_PACKAGE_ENABLE([CParser], [cpp])
435GST_PACKAGE_ENABLE([DebugTools], [debug])
436
437GST_PACKAGE_ENABLE([DBD-MySQL], [dbd-mysql])
438AC_MSG_CHECKING([whether to run MySQL tests])
439AC_ARG_ENABLE(mysql-tests,
440[  --enable-mysql-tests=USER:PWD:DATABASE
441                          test MySQL bindings [default=root:root:test]], ,
442[enable_mysql_tests=no])
443AC_SUBST(enable_mysql_tests)
444AC_MSG_RESULT($enable_mysql_tests)
445
446GST_PACKAGE_ENABLE([DBD-PostgreSQL], [dbd-postgresql],
447   [GST_HAVE_LIB(pq, PQconnectdb)],
448   [ac_cv_lib_pq_PQconnectdb])
449
450GST_PACKAGE_ENABLE([DBD-SQLite], [dbd-sqlite],
451   [AC_CHECK_HEADER([sqlite3.h])
452    GST_HAVE_LIB(sqlite3, sqlite3_clear_bindings)],
453   [ac_cv_header_sqlite3_h],
454   [Makefile], [dbd-sqlite3.la])
455
456GST_PACKAGE_ENABLE([DBI], [dbi])
457
458GST_PACKAGE_ENABLE([GDBM], [gdbm],
459   [AC_CHECK_HEADER([gdbm.h])],
460   [ac_cv_header_gdbm_h],
461   [Makefile], [gdbm.la])
462GST_PACKAGE_ENABLE([Glorp], [glorp])
463GST_PACKAGE_ENABLE([Cairo], [cairo],
464  [PKG_CHECK_MODULES([CAIRO], cairo, [gst_cv_cairo=yes], [gst_cv_cairo=no])],
465  [gst_cv_cairo])
466
467GST_PACKAGE_ENABLE([GTK], [gtk], [
468  AC_ARG_ENABLE(gtk,
469  [  --enable-gtk={yes,no,blox}
470                          enable GTK+ bindings.  Blox/GTK is experimental.], ,
471  enable_gtk=yes)
472
473  if test "$enable_gtk" != no; then
474    maybe_enable_gtk=$enable_gtk
475    enable_gtk=no
476    AM_PATH_GLIB_2_0(2.0.0, [
477      AM_PATH_GTK_2_0(2.0.0, [
478        PKG_CHECK_MODULES(ATK, atk >= 1.0.0, [
479          PKG_CHECK_MODULES(PANGO, pango >= 1.0.0, [
480            PKG_CHECK_MODULES(GTHREAD, gthread-2.0 >= 2.0.0, [enable_gtk=$maybe_enable_gtk])
481          ])
482        ])
483      ])
484    ], [], gobject)
485    if test $enable_gtk = yes; then
486      ac_save_LIBS=$LIBS
487      ac_save_CFLAGS=$CFLAGS
488      LIBS="$LIBS $GLIB_LIBS"
489      CFLAGS="$CFLAGS $GLIB_CFLAGS"
490      AC_CHECK_FUNCS([g_poll])
491      if test $ac_cv_func_g_poll = no; then
492        AC_DEFINE([g_poll], [poll], [Define to poll if your glib does not provide g_poll.])
493      fi
494      LIBS=$ac_save_LIBS
495      CFLAGS=$ac_save_CFLAGS
496    fi
497  fi],
498  [enable_gtk gst_cv_cairo],
499  [Makefile], [gst-gtk.la])
500GST_PACKAGE_ENABLE([BloxGTK], [blox/gtk],, [enable_gtk])
501GST_PACKAGE_ENABLE([Blox], [blox/tests],
502	    [enable_blox=no
503	     case x"$enable_gtk" in
504		 xno|xnot\ found) ;; *) enable_blox=yes ;; esac
505	     case x"$gst_cv_tcltk_libs" in
506		 xno|xnot\ found) ;; *) enable_blox=yes ;; esac],
507	    [enable_blox], [package.xml])
508GST_PACKAGE_ENABLE([WebServer], [httpd])
509GST_PACKAGE_ENABLE([I18N], [i18n],
510  [AC_CHECK_FUNCS_ONCE([nl_langinfo])
511  AM_LANGINFO_CODESET
512  AM_ICONV],
513  [ac_cv_func_nl_langinfo am_cv_func_iconv],
514  [Makefile], [i18n.la])
515GST_PACKAGE_ENABLE([Iconv], [iconv],
516  [AM_ICONV],
517  [am_cv_func_iconv],
518  [Makefile], [iconv.la])
519GST_PACKAGE_ENABLE([Java], [java])
520GST_PACKAGE_ENABLE([Digest], [digest], [], [], [Makefile], [digest.la])
521GST_PACKAGE_ENABLE([GNUPlot], [gnuplot])
522GST_PACKAGE_ENABLE([Magritte], [magritte])
523GST_PACKAGE_ENABLE([Magritte-Seaside], [seaside/magritte])
524
525GST_PACKAGE_ENABLE([NCurses],
526  [ncurses],
527  [GST_HAVE_LIB(ncurses, initscr)],
528  [ac_cv_lib_ncurses_initscr])
529GST_PACKAGE_ENABLE([NetClients], [net], [], [], [Makefile])
530GST_PACKAGE_ENABLE([DhbNumericalMethods], [numerics])
531GST_PACKAGE_ENABLE([OpenGL], [opengl],
532   [GST_HAVE_OPENGL],
533   [gst_cv_opengl_libs],
534   [Makefile], [gstopengl.la])
535GST_PACKAGE_ENABLE([GLUT], [glut],
536   [GST_HAVE_GLUT],
537   [gst_cv_glut_libs],
538   [Makefile], [gstglut.la])
539
540GST_PACKAGE_ENABLE([LibSDL], [sdl/libsdl],
541  [PKG_CHECK_MODULES(SDL, sdl >= 1.2.0, [gst_cv_sdl=yes], [gst_cv_sdl=no])
542  case "$SDL_LIBS" in
543    *-framework,Cocoa* | *"-framework Cocoa"*) gst_cv_sdl_uses_cocoa=yes ;;
544    *) gst_cv_sdl_uses_cocoa=no ;;
545  esac
546
547  save_CFLAGS=$CFLAGS
548  save_LIBS=$LIBS
549  CFLAGS="$CFLAGS $SDL_CFLAGS"
550  LIBS="$LIBS $SDL_LIBS"
551  AC_LINK_IFELSE([AC_LANG_SOURCE([
552      #include <SDL.h>
553      #include <SDL_main.h>
554      int main(int argc, char **argv) { SDL_Init(0); return 0; }])],
555    [], [gst_cv_sdl=no])
556
557  LIBS=$save_LIBS
558  CFLAGS=$save_CFLAGS
559
560  # We do SDLmain's job on our own, and mingw32 is linked automatically
561  # into the DLL.  If we do not do this, libtool refuses to create a DLL
562  # for the SDL module.
563  SDL_LIBS=`echo " $SDL_LIBS " | sed 's/ -lSDLmain / /; s/ -lmingw32 / /' `
564
565  AM_CONDITIONAL([HAVE_COCOA], [test $gst_cv_sdl_uses_cocoa = yes])],
566  [gst_cv_sdl],
567  [Makefile], [sdl.la])
568GST_PACKAGE_ENABLE([LibSDL_GL], [sdl/libsdl_gl], [],
569		   [gst_cv_sdl gst_cv_opengl_libs])
570GST_PACKAGE_ENABLE([CairoSDL], [sdl/cairo],
571  [],
572  [gst_cv_cairo gst_cv_sdl])
573GST_PACKAGE_ENABLE([LibSDL_image], [sdl/libsdl_image],
574  [GST_HAVE_LIB(SDL_image, IMG_Linked_Version)],
575  [ac_cv_lib_SDL_image_IMG_Linked_Version])
576GST_PACKAGE_ENABLE([LibSDL_mixer], [sdl/libsdl_mixer],
577  [GST_HAVE_LIB(SDL_mixer, Mix_Linked_Version)],
578  [ac_cv_lib_SDL_mixer_Mix_Linked_Version])
579GST_PACKAGE_ENABLE([LibSDL_sound], [sdl/libsdl_sound],
580  [GST_HAVE_LIB(SDL_sound, Sound_GetLinkedVersion)],
581  [ac_cv_lib_SDL_sound_Sound_GetLinkedVersion])
582GST_PACKAGE_ENABLE([LibSDL_ttf], [sdl/libsdl_ttf],
583  [GST_HAVE_LIB(SDL_ttf, TTF_Init)],
584  [ac_cv_lib_SDL_ttf_TTF_Init])
585
586GST_PACKAGE_ENABLE([Compiler], [stinst/compiler])
587GST_PACKAGE_ENABLE([Parser], [stinst/parser])
588GST_PACKAGE_ENABLE([ClassPublisher], [stinst/doc])
589GST_PACKAGE_ENABLE([ProfileTools], [profile])
590GST_PACKAGE_ENABLE([ROE], [roe])
591GST_PACKAGE_ENABLE([SandstoneDb], [sandstonedb])
592GST_PACKAGE_ENABLE([Seaside-Core], [seaside/core])
593GST_PACKAGE_ENABLE([Seaside-Development], [seaside/dev])
594GST_PACKAGE_ENABLE([Seaside-Examples], [seaside/examples])
595GST_PACKAGE_ENABLE([Seaside], [seaside/swazoo])
596GST_PACKAGE_ENABLE([Sport], [sport])
597GST_PACKAGE_ENABLE([SUnit], [sunit])
598GST_PACKAGE_ENABLE([Swazoo], [swazoo-httpd])
599GST_PACKAGE_ENABLE([Sockets], [sockets], [], [gst_cv_sockets])
600GST_PACKAGE_ENABLE([VFSAddOns], [vfs], [], [], [Makefile])
601GST_PACKAGE_ENABLE([VisualGST], [visualgst])
602GST_PACKAGE_ENABLE([XML-XMLNodeBuilder], [xml/builder])
603GST_PACKAGE_ENABLE([XML-DOM], [xml/dom])
604GST_PACKAGE_ENABLE([XML-ParserTests], [xml/tests])
605GST_PACKAGE_ENABLE([XML-PullParser], [xml/pullparser])
606GST_PACKAGE_ENABLE([XML-Expat], [xml/expat],
607  [AC_CHECK_HEADER([expat.h])
608   GST_HAVE_LIB(expat, XML_ParserCreateNS)],
609  [ac_cv_header_expat_h ac_cv_lib_expat_XML_ParserCreateNS],
610  [Makefile], [expat.la])
611GST_PACKAGE_ENABLE([XML-XMLParser], [xml/parser])
612GST_PACKAGE_ENABLE([XML-SAXDriver], [xml/saxdriver])
613GST_PACKAGE_ENABLE([XML-SAXParser], [xml/saxparser])
614GST_PACKAGE_ENABLE([XPath], [xml/xpath])
615GST_PACKAGE_ENABLE([XSL], [xml/xsl])
616GST_PACKAGE_ENABLE([ZLib],
617  [zlib],
618  [AC_CHECK_HEADER([zlib.h])
619   GST_HAVE_LIB(z, inflate)],
620  [ac_cv_header_zlib_h ac_cv_lib_z_inflate],
621  [Makefile], [zlib.la])
622
623if test "$enable_gtk" = blox; then
624  BLOX_IMPLEMENTATION=BloxGTK
625else
626  BLOX_IMPLEMENTATION=BloxTK
627fi
628AC_SUBST(BLOX_IMPLEMENTATION)
629
630AC_ARG_ENABLE(jit,
631[  --enable-jit            enable dynamic translation to machine code], ,
632enable_jit=no)
633
634LIGHTNING_CONFIGURE_IF_NOT_FOUND([], enable_jit=no)
635if test "$enable_jit" != no; then
636  AC_DEFINE(ENABLE_JIT_TRANSLATION, 1,
637    [Define to enable dynamic translation to machine code])
638fi
639
640AC_ARG_ENABLE(disassembler,
641[  --enable-disassembler   include a disassembler in the gst executable], ,
642enable_disassembler=no)
643AM_CONDITIONAL(ENABLE_DISASSEMBLER, test "$enable_disassembler" != no)
644if test "$enable_disassembler" != no; then
645  AC_DEFINE(ENABLE_DISASSEMBLER, 1,
646    [Define to include a disassembler in the gst executable])
647fi
648
649AC_ARG_ENABLE(dld,
650[  --disable-dld           disable loading of external modules at runtime], ,
651enable_dld=yes)
652
653if test "$enable_dld" != no; then
654  AC_DEFINE(ENABLE_DLD, 1,
655    [Define to enable usage of libltdl to load external modules at runtime])
656fi
657
658AC_ARG_ENABLE(checking,
659[  --enable-checking       enable assertions at runtime], ,
660enable_checking=no)
661
662if test "$enable_checking" = no; then
663  AC_DEFINE(OPTIMIZE, 1,
664    [Define to disable assertion checking at runtime])
665fi
666
667AC_ARG_ENABLE(preemption,
668[  --enable-preemption     enable preemptive multitasking], ,
669enable_preemption=no)
670
671if test "$enable_preemption" != no; then
672  AC_DEFINE(ENABLE_PREEMPTION, 1,
673    [Define to enable preemptive multitasking of Smalltalk processes])
674fi
675
676GST_ARG_ENABLE_MODULES([Blox,TCP])
677
678dnl
679dnl ------------------------------- RELOCATABILITY ------------
680
681# See if we can make the installed binaries relocatable
682
683AC_MSG_CHECKING([whether to enable relocatable install])
684AC_RELOCATABLE_NOP
685relocatable_reason=$RELOCATABLE
686
687# First of all, compute the final paths for the various components.
688
689AC_LIB_PREPARE_PREFIX
690
691acl_final_datadir=`echo "${datadir}" | sed \
692	-e "s,\\\${datarootdir},$datarootdir," \
693	-e "s,\\\${exec_prefix},$acl_final_exec_prefix," \
694	-e "s,\\\${prefix},$acl_final_prefix," `
695acl_final_bindir=`echo "${bindir}" | sed \
696	-e "s,\\\${exec_prefix},$acl_final_exec_prefix," \
697	-e "s,\\\${prefix},$acl_final_prefix," `
698acl_final_libdir=`echo "${libdir}" | sed \
699	-e "s,\\\${exec_prefix},$acl_final_exec_prefix," \
700	-e "s,\\\${prefix},$acl_final_prefix," `
701acl_final_libexecdir=`echo "${libexecdir}" | sed \
702	-e "s,\\\${exec_prefix},$acl_final_exec_prefix," \
703	-e "s,\\\${prefix},$acl_final_prefix," `
704
705acl_final_pkgdatadir="$acl_final_datadir/$PACKAGE"
706acl_final_pkglibdir="$acl_final_libdir/$PACKAGE"
707
708acl_final_imagedir=`echo "${imagedir}" | sed \
709	-e "s,\\\${localstatedir},$localstatedir," \
710	-e "s,\\\${pkgdatadir},$pkgdatadir," \
711	-e "s,\\\${datadir},$datadir," \
712	-e "s,\\\${docdir},$docdir," \
713	-e "s,\\\${datarootdir},$datarootdir," \
714	-e "s,\\\${pkglibdir},$acl_final_pkglibdir," \
715	-e "s,\\\${libdir},$acl_final_libdir," \
716	-e "s,\\\${exec_prefix},$acl_final_exec_prefix," \
717	-e "s,\\\${prefix},$acl_final_prefix," `
718acl_final_moduledir=`echo "${moduledir}" | sed \
719	-e "s,\\\${localstatedir},$localstatedir," \
720	-e "s,\\\${pkgdatadir},$pkgdatadir," \
721	-e "s,\\\${datadir},$datadir," \
722	-e "s,\\\${docdir},$docdir," \
723	-e "s,\\\${datarootdir},$datarootdir," \
724	-e "s,\\\${pkglibdir},$acl_final_pkglibdir," \
725	-e "s,\\\${libdir},$acl_final_libdir," \
726	-e "s,\\\${exec_prefix},$acl_final_exec_prefix," \
727	-e "s,\\\${prefix},$acl_final_prefix," `
728
729
730# If shared libraries are enabled, there are a few extra constraints.
731
732if test "$enable_shared" != no; then
733  case $host in
734    *-*-cygwin* | *-*-mingw*)
735      # For Windows, the shared library will be installed in bindir anyway
736      ;;
737
738    *-gnu*)
739      # For glibc, we can use a relative rpath via -Wl,-rpath,...
740      case "$acl_final_libdir" in
741        "${acl_final_exec_prefix}"/*) ;;
742        /*) relocatable_reason='no, libdir outside exec_prefix' ;;
743        *) relocatable_reason='no, relative libdir' ;;
744      esac
745      ;;
746
747    *)
748      relocatable_reason="no,
749	relocatable shared libraries not supported on $host"
750      ;;
751  esac
752fi
753
754# Further OS-independent tests ensure that we can make relative
755# paths from the executable's location.
756
757if test "$relocatable_reason" = yes; then
758  case "${acl_final_bindir}" in
759    "${acl_final_exec_prefix}") ;;
760    "${acl_final_exec_prefix}"/*) ;;
761    /*) relocatable_reason='no, bindir outside exec_prefix' ;;
762    *) relocatable_reason='no, relative bindir' ;;
763  esac
764  case "${acl_final_libexecdir}" in
765    "${acl_final_exec_prefix}") ;;
766    ${acl_final_exec_prefix}/*) ;;
767    /*) relocatable_reason='no, libexecdir outside exec_prefix' ;;
768    *) relocatable_reason='no, relative libexecdir' ;;
769  esac
770  case "${acl_final_datadir}" in
771    ${acl_final_prefix}) ;;
772    ${acl_final_prefix}/*) ;;
773    /*) relocatable_reason='no, datadir outside prefix' ;;
774    *) relocatable_reason='no, relative datadir' ;;
775  esac
776  case "${acl_final_imagedir}" in
777    ${acl_final_prefix}) ;;
778    ${acl_final_prefix}/*) ;;
779    /*) relocatable_reason='no, imagedir outside prefix' ;;
780    *) relocatable_reason='no, relative imagedir' ;;
781  esac
782  case "${acl_final_moduledir}" in
783    ${acl_final_prefix}) ;;
784    ${acl_final_prefix}/*) ;;
785    /*) relocatable_reason='no, moduledir outside prefix' ;;
786    *) relocatable_reason='no, relative moduledir' ;;
787  esac
788
789  test "$acl_final_prefix" != "$acl_final_exec_prefix" && \
790    relocatable_reason='no, prefix does not match exec prefix'
791fi
792
793# echo the relative path from ${acl_final_bindir} to $1
794# (Works only if both are absolute.)
795[func_make_relpath ()
796{
797  dir=$1
798  idir=${acl_final_bindir}
799
800  while true; do
801    dfirst=`echo "$dir" | sed -n -e 's,^//*\([^/]*\).*$,/\1,p'`
802    ifirst=`echo "$idir" | sed -n -e 's,^//*\([^/]*\).*$,/\1,p'`
803    test x"$dfirst" = x && break
804    test x"$ifirst" = x && break
805    test "$dfirst" != "$ifirst" && break
806
807    dir=`echo "$dir" | sed -e 's,^//*[^/]*,,'`
808    idir=`echo "$idir" | sed -e 's,^//*[^/]*,,'`
809  done
810  idir=`echo "$idir" | sed -e 's,//*[^/]*,/..,g' -e 's,^/,,' `
811  echo "${idir:-.}$dir"
812}]
813
814case "$relocatable_reason" in
815  yes)
816    # Command-line option to include a relative search path for
817    # shared libraries
818    if test "$enable_shared" != no; then
819      case "$host" in
820        *-linux*)
821          RELOC_LDFLAGS='-Wl,-rpath,"\$$ORIGIN/'`func_make_relpath ${acl_final_libdir}`'"'
822	  ;;
823      esac
824    fi
825
826    KERNEL_PATH=`func_make_relpath ${acl_final_pkgdatadir}/kernel`
827    IMAGE_PATH=`func_make_relpath ${acl_final_imagedir}`
828    MODULE_PATH=`func_make_relpath ${acl_final_moduledir}`
829    LIBEXEC_PATH=`func_make_relpath "${acl_final_libexecdir}/${PACKAGE}"`
830    PREFIX=`func_make_relpath "${acl_final_prefix}"`
831    EXEC_PREFIX=`func_make_relpath "${acl_final_exec_prefix}"`
832    AC_DEFINE_UNQUOTED(KERNEL_PATH, "$KERNEL_PATH",
833		       [The relative path from the program to the kernel path.
834		        Defined only for relocatable installs.])
835    AC_DEFINE_UNQUOTED(IMAGE_PATH, "$IMAGE_PATH",
836		       [The relative path from the program to the image path.
837		        Defined only for relocatable installs.])
838    AC_DEFINE_UNQUOTED(MODULE_PATH, "$MODULE_PATH",
839		       [The relative path from the program to the module path.
840		        Defined only for relocatable installs.])
841    AC_DEFINE_UNQUOTED(LIBEXEC_PATH, "$LIBEXEC_PATH",
842		       [The relative path from the program to the per-package
843			libexec path.  Defined only for relocatable installs.])
844    AC_DEFINE_UNQUOTED(PREFIX, "$PREFIX",
845		       [The relative path from the program to the prefix.
846		        Defined only for relocatable installs.])
847    AC_DEFINE_UNQUOTED(EXEC_PREFIX, "$EXEC_PREFIX",
848		       [The relative path from the program to the exec_prefix.
849			Defined only for relocatable installs.])
850    ;;
851
852  *)
853    # Pass paths on the command-line to allow specifying a prefix at "make"
854    # time.
855    RELOC_CPPFLAGS='-DKERNEL_PATH=\""${pkgdatadir}/kernel"\" \
856	-DIMAGE_PATH=\""${imagedir}"\" \
857	-DMODULE_PATH=\""${moduledir}"\" \
858	-DLIBEXEC_PATH=\""${libexecdir}/${PACKAGE}"\" \
859	-DPREFIX=\""${prefix}"\" \
860	-DEXEC_PREFIX=\""${exec_prefix}"\" '
861    ;;
862esac
863
864RELOC_CPPFLAGS=$RELOC_CPPFLAGS' \
865	-DDEFAULT_EXECUTABLE=\""${bindir}/gst${EXEEXT}"\"'
866AC_MSG_RESULT([$relocatable_reason])
867AC_SUBST(RELOC_CPPFLAGS)
868AC_SUBST(RELOC_LDFLAGS)
869
870dnl
871dnl ------------------------------- FILE GENERATION -----------
872
873{ echo; echo "${term_bold}Output substitutions:${term_norm}"; } >& AS_MESSAGE_FD
874
875AC_CONFIG_COMMANDS_PRE([
876  LTLIBOBJS=`echo "$LIB@&t@OBJS" |
877                sed 's,\.[[^.]]* ,.lo ,g;s,\.[[^.]]*$,.lo,'`
878
879  LTALLOCA=`echo "$ALLOCA" | sed 's/\.o/.lo/g'`
880])
881
882GST_RUN='$(top_builddir)/gst -I $(top_builddir)/gst.im -f'
883
884AC_SUBST(GST_RUN)
885AC_SUBST(CFLAGS)
886AC_SUBST(INCLTDL)
887AC_SUBST(LIBLTDL)
888AC_SUBST(LTALLOCA)
889AC_SUBST(LTLIBOBJS)
890
891dnl Scripts & data files
892AC_CONFIG_FILES(gnu-smalltalk.pc)
893AC_CONFIG_FILES(gst-config, chmod +x gst-config)
894AC_CONFIG_FILES(tests/gst, chmod +x tests/gst)
895AC_CONFIG_FILES(tests/atlocal)
896
897dnl Master Makefile
898AC_CONFIG_FILES(Makefile)
899
900dnl VM makefiles
901AC_CONFIG_FILES(doc/Makefile lib-src/Makefile libgst/Makefile)
902AC_CONFIG_FILES(opcode/Makefile lightning/Makefile tests/Makefile)
903
904AC_OUTPUT
905