1 dnl Process this file with autoconf to produce configure.
3 . $srcdir/GUILE-VERSION
4 AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
6 AM_CONFIG_HEADER(libguile/scmconfig.h)
8 #--------------------------------------------------------------------
12 #--------------------------------------------------------------------
15 [ --disable-debug Don't include debugging support])
16 if test "$enableval" != n && test "$enableval" != no; then
17 AC_DEFINE(DEBUG_EXTENSIONS)
18 AC_DEFINE(READER_EXTENSIONS)
19 LIBOBJS="backtrace.o stacks.o debug.o srcprop.o $LIBOBJS"
22 AC_ARG_ENABLE(dynamic-linking,
23 [ --enable-dynamic-linking Include support for dynamic linking],,
24 enable_dynamic_linking=yes)
26 AC_ARG_ENABLE(guile-debug,
27 [ --enable-guile-debug Include internal debugging functions])
28 if test "$enableval" = y || test "$enableval" = yes; then
29 AC_DEFINE(GUILE_DEBUG)
32 #--------------------------------------------------------------------
48 AC_CHECK_HEADERS(libc.h limits.h malloc.h memory.h string.h regex.h rxposix.h rx/rxposix.h sys/ioctl.h sys/select.h sys/time.h sys/timeb.h sys/times.h sys/types.h sys/utime.h time.h unistd.h utime.h)
49 GUILE_HEADER_LIBC_WITH_UNISTD
56 AC_CHECK_FUNCS(gethostbyname)
57 if test $ac_cv_func_gethostbyname = no; then
58 AC_CHECK_LIB(nsl, gethostbyname)
60 AC_CHECK_FUNCS(connect)
61 if test $ac_cv_func_connect = no; then
62 AC_CHECK_LIB(socket, connect)
64 AC_CHECK_LIB(termcap, tgoto)
65 AC_CHECK_LIB(readline, readline)
66 AC_CHECK_FUNCS(rl_getc_function rl_clear_signals rl_cleanup_after_signal)
67 if test $ac_cv_lib_readline_readline = yes -a $ac_cv_func_rl_getc_function = no; then
68 echo 'Warning: libreadline is too old on your system. Need >= 2.1.'
71 # The following test defines TOTORO if we're configuring on
72 # totoro.red-bean.com. For some etheric reason, totoro refuses to
73 # perform the test for presence of rl_getc_function in libreadline
74 # correctly. This variable is used in a workaround which forces
75 # totoro to include readline support regardless. This kludge should
76 # obviously be removed as fast as possible.
78 AC_CHECK_PROG(HOSTNAME, hostname, hostname)
79 if test "$HOSTNAME" = hostname; then
80 if test "`hostname`" = totoro.red-bean.com; then
85 # Checks for dynamic linking
87 if test "$enable_dynamic_linking" = "yes"; then
89 AC_CHECK_LIB(dl,dlopen)
90 if test "$ac_cv_lib_dl_dlopen" = "yes"; then
91 AC_CHECK_FUNCS(dlopen)
92 AC_DEFINE(DYNAMIC_LINKING)
94 AC_CHECK_LIB(dld,dld_link)
95 if test "$ac_cv_lib_dld_dld_link" = "yes"; then
96 AC_DEFINE(DYNAMIC_LINKING)
98 AC_CHECK_FUNCS(shl_load)
99 if test "$ac_cv_func_shl_load" = "yes"; then
100 AC_DEFINE(DYNAMIC_LINKING)
102 AC_CHECK_FUNCS(dlopen)
103 if test "$ac_cv_func_dlopen" = "yes"; then
104 AC_DEFINE(DYNAMIC_LINKING)
114 AC_CHECK_FUNCS(ctermid ftime getcwd geteuid gethostent gettimeofday lstat mkdir mknod nice readlink rename rmdir select setegid seteuid setlocale setpgid setsid sigaction strftime strptime symlink sync tcgetpgrp tcsetpgrp times uname waitpid bzero strdup system usleep)
116 # Determine the host we are working on
119 # Some operating systems don't declare all functions
122 AC_DEFINE(DECLARE_BZERO)
123 AC_DEFINE(DECLARE_USLEEP)
127 # On some systems usleep have no return value
128 AC_EGREP_HEADER(changequote(<, >)<void[ ][ ]*usleep>changequote([, ]),
129 /usr/include/unistd.h,
130 AC_DEFINE(USLEEP_RETURNS_VOID)
134 dnl <GNU-WIN32 hacks>
136 AC_CHECK_HEADER(sys/un.h, have_sys_un_h=1)
137 if test -n "$have_sys_un_h" ; then
138 AC_DEFINE(HAVE_UNIX_DOMAIN_SOCKETS)
141 AC_CHECK_FUNCS(socketpair getgroups setpwent pause tzset)
143 dnl I don't know what this prefixing of cygwin32_ is for.
144 dnl scmconfig.h wasn't updated with the test results.
145 dnl so use AC_CHECK_FUNCS for now.
149 dnl if test $ac_cv_cigwin = yes; then
150 dnl modify confdefs.h
152 dnl AC_CHECK_FUNCS...
153 dnl restore confdefs.h
155 dnl cp confdefs.h confdefs.h.bak
156 dnl for func in sethostent endhostent getnetent setnetent endnetent getprotoent endprotoent getservent endservent getnetbyaddr getnetbyname inet_lnaof inet_makeaddr inet_netof ; do
157 dnl cp confdefs.h.bak confdefs.h
158 dnl cat >> confdefs.h << EOF
159 dnl #ifdef __CYGWIN32__
160 dnl #define $func cygwin32_$func
163 dnl AC_CHECK_FUNC($func)
165 dnl cp confdefs.h.bak confdefs.h
167 AC_CHECK_FUNCS(sethostent endhostent getnetent setnetent endnetent getprotoent endprotoent getservent endservent getnetbyaddr getnetbyname inet_lnaof inet_makeaddr inet_netof)
169 dnl </GNU-WIN32 hacks>
171 AC_CACHE_CHECK([for restartable system calls], scm_cv_restarts,
172 if test $ac_cv_func_sigaction = yes; then
173 [AC_TRY_COMPILE([#include <signal.h>],
174 [int a = SA_RESTART],
180 if test $scm_cv_restarts = yes; then
181 AC_DEFINE(HAVE_RESTARTS)
184 if test "$ac_cv_header_regex_h" = yes ||
185 test "$ac_cv_header_rxposix_h" = yes ||
186 test "$ac_cv_header_rx_rxposix_h" = yes; then
187 GUILE_NAMED_CHECK_FUNC(regcomp, norx, [LIBOBJS="regex-posix.o $LIBOBJS"],
188 [AC_CHECK_LIB(rx, main)
189 GUILE_NAMED_CHECK_FUNC(regcomp, rx, [LIBOBJS="regex-posix.o $LIBOBJS"])]
191 dnl The following should not be necessary, but for some reason
192 dnl autoheader misses it if we don't include it!
193 if test "$ac_cv_func_regcomp_norx" = yes ||
194 test "$ac_cv_func_regcomp_rx" = yes; then
195 AC_DEFINE(HAVE_REGCOMP)
199 AC_REPLACE_FUNCS(inet_aton putenv strerror)
201 # When testing for the presence of alloca, we need to add alloca.o
202 # explicitly to LIBOBJS to make sure that it is translated to
203 # `alloca.lo' for libtool later on. This can and should be done more cleanly.
205 if test "$ALLOCA" = "alloca.o"; then LIBOBJS="alloca.o $LIBOBJS"; fi
210 # We could use AC_STRUCT_ST_BLOCKS here, but that adds fileblocks.o to
211 # LIBOBJS, which we don't need. This seems more direct.
212 AC_CACHE_CHECK([for st_blocks in struct stat], ac_cv_struct_st_blocks,
213 [AC_TRY_COMPILE([#include <sys/types.h>
214 #include <sys/stat.h>], [struct stat s; s.st_blocks;],
215 ac_cv_struct_st_blocks=yes, ac_cv_struct_st_blocks=no)])
216 if test $ac_cv_struct_st_blocks = yes; then
217 AC_DEFINE(HAVE_ST_BLOCKS)
223 #--------------------------------------------------------------------
225 # Which way does the stack grow?
227 #--------------------------------------------------------------------
229 AC_TRY_RUN(aux (l) unsigned long l;
230 { int x; exit (l >= ((unsigned long)&x)); }
231 main () { int q; aux((unsigned long)&q); },
232 AC_DEFINE(SCM_STACK_GROWS_UP),,AC_MSG_WARN(Guessing that stack grows down -- see scmconfig.h.in))
235 AC_TRY_RUN(main () { exit (sizeof(float) != sizeof(long)); },
236 AC_DEFINE(SCM_SINGLES),,AC_DEFINE(SCM_SINGLES)
237 AC_MSG_WARN(Guessing that sizeof(long) == sizeof(float) -- see scmconfig.h.in))
239 AC_MSG_CHECKING(for struct linger)
240 AC_CACHE_VAL(scm_cv_struct_linger,
242 #include <sys/types.h>
243 #include <sys/socket.h>],
244 [struct linger lgr; lgr.l_linger = 100],
245 scm_cv_struct_linger="yes",
246 scm_cv_struct_linger="no"))
247 AC_MSG_RESULT($scm_cv_struct_linger)
248 if test $scm_cv_struct_linger = yes; then
249 AC_DEFINE(HAVE_STRUCT_LINGER)
252 #--------------------------------------------------------------------
254 # How can you violate a stdio abstraction by setting a stream's fd?
256 #--------------------------------------------------------------------
258 AC_MSG_CHECKING(how to set a stream file descriptor)
259 AC_CACHE_VAL(scm_cv_fd_setter,
260 AC_TRY_COMPILE([#include <stdio.h>],
262 scm_cv_fd_setter="_file",
263 AC_TRY_COMPILE([#include <stdio.h>],
264 [stdout->_fileno = 1],
265 scm_cv_fd_setter="_fileno",
266 scm_cv_fd_setter="")))
268 if test "$scm_cv_fd_setter"; then
269 AC_MSG_RESULT($scm_cv_fd_setter)
270 AC_DEFINE_UNQUOTED(FD_SETTER, $scm_cv_fd_setter)
272 AC_MSG_RESULT(we couldn't do it!)
275 #--------------------------------------------------------------------
276 # How to find out whether a FILE structure contains buffered data.
277 # From Tk we have the following list:
278 # _cnt: Most UNIX systems
282 # Or, in GNU libc there are two fields, _gptr and _egptr, which
283 # have to be compared.
284 # These can also be known as _IO_read_ptr and _IO_read_end.
285 #--------------------------------------------------------------------
287 AC_MSG_CHECKING(how to get buffer char count from FILE structure)
288 AC_CACHE_VAL(scm_cv_struct_file_count,
289 AC_TRY_COMPILE([#include <stdio.h>],
290 [FILE *f = stdin; f->_cnt = 0],
291 scm_cv_struct_file_count="_cnt",
292 AC_TRY_COMPILE([#include <stdio.h>],
293 [FILE *f = stdin; f->_r = 0],
294 scm_cv_struct_file_count="_r",
295 AC_TRY_COMPILE([#include <stdio.h>],
296 [FILE *f = stdin; f->readCount = 0],
297 scm_cv_struct_file_count="readCount",
298 scm_cv_struct_file_count=""))))
299 if test "$scm_cv_struct_file_count"; then
300 AC_MSG_RESULT($scm_cv_struct_file_count)
301 AC_DEFINE_UNQUOTED(FILE_CNT_FIELD, $scm_cv_struct_file_count)
303 AC_CACHE_VAL(scm_cv_struct_file_gptr,
304 AC_TRY_COMPILE([#include <stdio.h>],
305 [FILE *f = stdin; f->_gptr = f->egptr;],
306 scm_cv_struct_file_gptr=1,
307 scm_cv_struct_file_gptr=""))
308 if test "$scm_cv_struct_gptr"; then
310 AC_DEFINE_UNQUOTED(FILE_CNT_GPTR, $scm_cv_struct_file_gptr)
312 AC_CACHE_VAL(scm_cv_struct_file_readptr,
313 AC_TRY_COMPILE([#include <stdio.h>],
314 [FILE *f = stdin; f->_IO_read_ptr = f->_IO_read_end;],
315 scm_cv_struct_file_readptr=1))
316 if test "$scm_cv_struct_file_readptr"; then
317 AC_MSG_RESULT(read_ptr)
318 AC_DEFINE_UNQUOTED(FILE_CNT_READPTR, $scm_cv_struct_file_readptr)
320 AC_MSG_RESULT(we couldn't do it!)
325 #--------------------------------------------------------------------
327 # Flags for thread support
329 #--------------------------------------------------------------------
332 CFLAGS="$CFLAGS $cy_cv_threads_cflags"
333 THREAD_LIBS="$cy_cv_threads_libs"
334 AC_SUBST(THREAD_LIBS)
337 dnl Set the appropriate flags!
339 if test "$cy_cv_threads_package" = FSU; then
340 AC_DEFINE(USE_FSU_PTHREADS, 1)
341 else if test "$cy_cv_threads_package" = COOP; then
342 AC_DEFINE(USE_COOP_THREADS, 1)
343 else if test "$cy_cv_threads_package" = MIT; then
344 AC_DEFINE(USE_MIT_PTHREADS, 1)
345 else if test "$cy_cv_threads_package" = PCthreads; then
346 AC_DEFINE(USE_PCTHREADS_PTHREADS, 1)
347 else if test "$cy_cv_threads_package" = unknown; then
348 AC_MSG_ERROR("cannot find threads installation")
355 if test "$cy_cv_threads_package" != ""; then
356 AC_DEFINE(USE_THREADS)
357 LIBOBJS="$LIBOBJS threads.o"
360 #--------------------------------------------------------------------
362 # scm_internal_select
364 #--------------------------------------------------------------------
366 if test "$cy_cv_threads_package" != "" &&
367 test $ac_cv_func_gettimeofday = yes &&
368 test $ac_cv_func_select = yes; then
369 AC_DEFINE(GUILE_ISELECT, 1)
370 LIBOBJS="$LIBOBJS iselect.o"
373 ## If we're using GCC, ask for aggressive warnings.
375 yes ) CFLAGS="$CFLAGS -Wall -Wpointer-arith" ;;
380 ## If we're creating a shared library (using libtool!), then we'll
381 ## need to generate a list of .lo files corresponding to the .o files
382 ## given in LIBOBJS. We'll call it LIBLOBJS.
383 LIBLOBJS="`echo ${LIBOBJS} | sed 's/\.o/.lo/g'`"
385 AC_SUBST(GUILE_MAJOR_VERSION)
386 AC_SUBST(GUILE_MINOR_VERSION)
387 AC_SUBST(GUILE_VERSION)
388 GUILE_LIBS="$LDFLAGS $THREAD_LIBS $LIBS"
391 dnl timestamping the interpreter and scheme libraries:
393 dnl Help us notice when we're running one version of the Guile
394 dnl interpreter against a different version of the ice-9 Scheme code.
395 dnl This will definitely detect version skew due to differing
396 dnl snapshots and releases, but may not catch skew for the developers.
397 dnl Hopefully it will not detect skew when there is none; if that
398 dnl happens, the warnings will be useless, and we should remove this.
400 AC_SUBST(GUILE_STAMP)
406 dnl ======================================================================
407 dnl configuration for the Qt package
408 dnl ======================================================================
410 threads_enabled=false
411 if test "$cy_cv_threads_package" = COOP; then
415 # How can we refer to the qt source directory from within the qt build
416 # directory? For headers, we can rely on the fact that the qt src
417 # directory appears in the #include path.
419 qtsrcdir="`(cd $srcdir; pwd)`/qt"
421 changequote(,)dnl We use [ and ] in a regexp in the case
424 qtmds_s=$qtsrcdir/md/i386.s
426 qtmdc_c=$qtsrcdir/md/null.c
429 qtmds_s=$qtsrcdir/md/mips-irix5.s
431 qtmdc_c=$qtsrcdir/md/null.c
432 qtdmdb_s=$qtsrcdir/md/mips_b.s
435 qtmds_s=$qtsrcdir/md/mips.s
437 qtmdc_c=$qtsrcdir/md/null.c
438 qtdmdb_s=$qtsrcdir/md/mips_b.s
442 qtmdc_c=$qtsrcdir/md/null.c
443 qtmds_s=$qtsrcdir/md/_sparc.s
444 qtdmdb_s=$qtsrcdir/md/_sparc_b.s
448 qtmdc_c=$qtsrcdir/md/null.c
449 qtmds_s=$qtsrcdir/md/sparc.s
450 qtdmdb_s=$qtsrcdir/md/sparc_b.s
454 qtmdc_c=$qtsrcdir/md/null.c
455 qtmds_s=$qtsrcdir/md/axp.s
456 qtdmdb_s=$qtsrcdir/md/axp_b.s
459 echo "Unknown configuration; threads package disabled"
460 threads_enabled=false
466 if $threads_enabled; then
467 target_libs=libqthreads.a
472 # Give the Makefile the names of the object files that will be
473 # generated by compiling $qtmdc_c and $qtmds_s.
474 qtmdc_o="`echo ${qtmdc_c} | sed -e 's:^.*/::' | sed -e 's:\.c$:\.o:'`"
475 qtmds_o="`echo ${qtmds_s} | sed -e 's:^.*/::' | sed -e 's:\.s$:\.o:'`"
477 AC_SUBST(target_libs)
485 AC_OUTPUT([Makefile libguile/Makefile libguile/guile-snarf ice-9/Makefile ice-9/version.scm qt/Makefile qt/qt.h qt/md/Makefile qt/time/Makefile build/Makefile], [chmod +x libguile/guile-snarf])
488 dnl comment-start: "dnl "
490 dnl comment-start-skip: "\\bdnl\\b\\s *"