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 # Checks for dynamic linking
73 if test "$enable_dynamic_linking" = "yes"; then
75 AC_CHECK_LIB(dl,dlopen)
76 if test "$ac_cv_lib_dl_dlopen" = "yes"; then
77 AC_CHECK_FUNCS(dlopen)
78 AC_DEFINE(DYNAMIC_LINKING)
80 AC_CHECK_LIB(dld,dld_link)
81 if test "$ac_cv_lib_dld_dld_link" = "yes"; then
82 AC_DEFINE(DYNAMIC_LINKING)
84 AC_CHECK_FUNCS(shl_load)
85 if test "$ac_cv_func_shl_load" = "yes"; then
86 AC_DEFINE(DYNAMIC_LINKING)
88 AC_CHECK_FUNCS(dlopen)
89 if test "$ac_cv_func_dlopen" = "yes"; then
90 AC_DEFINE(DYNAMIC_LINKING)
100 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)
102 # Determine the host we are working on
105 # Some operating systems don't declare all functions
108 AC_DEFINE(DECLARE_BZERO)
109 AC_DEFINE(DECLARE_USLEEP)
113 # On some systems usleep has no return value
114 AC_EGREP_HEADER(changequote(<, >)<void[ ][ ]*usleep>changequote([, ]),
115 /usr/include/unistd.h,
116 AC_DEFINE(USLEEP_RETURNS_VOID)
120 dnl <GNU-WIN32 hacks>
122 AC_CHECK_HEADER(sys/un.h, have_sys_un_h=1)
123 if test -n "$have_sys_un_h" ; then
124 AC_DEFINE(HAVE_UNIX_DOMAIN_SOCKETS)
127 AC_CHECK_FUNCS(socketpair getgroups setpwent pause tzset)
129 dnl I don't know what this prefixing of cygwin32_ is for.
130 dnl scmconfig.h wasn't updated with the test results.
131 dnl so use AC_CHECK_FUNCS for now.
135 dnl if test $ac_cv_cigwin = yes; then
136 dnl modify confdefs.h
138 dnl AC_CHECK_FUNCS...
139 dnl restore confdefs.h
141 dnl cp confdefs.h confdefs.h.bak
142 dnl for func in sethostent endhostent getnetent setnetent endnetent getprotoent endprotoent getservent endservent getnetbyaddr getnetbyname inet_lnaof inet_makeaddr inet_netof ; do
143 dnl cp confdefs.h.bak confdefs.h
144 dnl cat >> confdefs.h << EOF
145 dnl #ifdef __CYGWIN32__
146 dnl #define $func cygwin32_$func
149 dnl AC_CHECK_FUNC($func)
151 dnl cp confdefs.h.bak confdefs.h
153 AC_CHECK_FUNCS(sethostent endhostent getnetent setnetent endnetent getprotoent endprotoent getservent endservent getnetbyaddr getnetbyname inet_lnaof inet_makeaddr inet_netof)
155 dnl </GNU-WIN32 hacks>
157 AC_CACHE_CHECK([for restartable system calls], scm_cv_restarts,
158 if test $ac_cv_func_sigaction = yes; then
159 [AC_TRY_COMPILE([#include <signal.h>],
160 [int a = SA_RESTART],
166 if test $scm_cv_restarts = yes; then
167 AC_DEFINE(HAVE_RESTARTS)
170 if test "$ac_cv_header_regex_h" = yes ||
171 test "$ac_cv_header_rxposix_h" = yes ||
172 test "$ac_cv_header_rx_rxposix_h" = yes; then
173 GUILE_NAMED_CHECK_FUNC(regcomp, norx, [LIBOBJS="regex-posix.o $LIBOBJS"],
174 [AC_CHECK_LIB(rx, main)
175 GUILE_NAMED_CHECK_FUNC(regcomp, rx, [LIBOBJS="regex-posix.o $LIBOBJS"])]
177 dnl The following should not be necessary, but for some reason
178 dnl autoheader misses it if we don't include it!
179 if test "$ac_cv_func_regcomp_norx" = yes ||
180 test "$ac_cv_func_regcomp_rx" = yes; then
181 AC_DEFINE(HAVE_REGCOMP)
185 AC_REPLACE_FUNCS(inet_aton putenv strerror)
187 # When testing for the presence of alloca, we need to add alloca.o
188 # explicitly to LIBOBJS to make sure that it is translated to
189 # `alloca.lo' for libtool later on. This can and should be done more cleanly.
191 if test "$ALLOCA" = "alloca.o"; then LIBOBJS="alloca.o $LIBOBJS"; fi
196 # We could use AC_STRUCT_ST_BLOCKS here, but that adds fileblocks.o to
197 # LIBOBJS, which we don't need. This seems more direct.
198 AC_CACHE_CHECK([for st_blocks in struct stat], ac_cv_struct_st_blocks,
199 [AC_TRY_COMPILE([#include <sys/types.h>
200 #include <sys/stat.h>], [struct stat s; s.st_blocks;],
201 ac_cv_struct_st_blocks=yes, ac_cv_struct_st_blocks=no)])
202 if test $ac_cv_struct_st_blocks = yes; then
203 AC_DEFINE(HAVE_ST_BLOCKS)
209 #--------------------------------------------------------------------
211 # Which way does the stack grow?
213 #--------------------------------------------------------------------
215 AC_TRY_RUN(aux (l) unsigned long l;
216 { int x; exit (l >= ((unsigned long)&x)); }
217 main () { int q; aux((unsigned long)&q); },
218 AC_DEFINE(SCM_STACK_GROWS_UP),,AC_MSG_WARN(Guessing that stack grows down -- see scmconfig.h.in))
221 AC_TRY_RUN(main () { exit (sizeof(float) != sizeof(long)); },
222 AC_DEFINE(SCM_SINGLES),,AC_DEFINE(SCM_SINGLES)
223 AC_MSG_WARN(Guessing that sizeof(long) == sizeof(float) -- see scmconfig.h.in))
225 AC_MSG_CHECKING(for struct linger)
226 AC_CACHE_VAL(scm_cv_struct_linger,
228 #include <sys/types.h>
229 #include <sys/socket.h>],
230 [struct linger lgr; lgr.l_linger = 100],
231 scm_cv_struct_linger="yes",
232 scm_cv_struct_linger="no"))
233 AC_MSG_RESULT($scm_cv_struct_linger)
234 if test $scm_cv_struct_linger = yes; then
235 AC_DEFINE(HAVE_STRUCT_LINGER)
238 #--------------------------------------------------------------------
240 # How can you violate a stdio abstraction by setting a stream's fd?
242 #--------------------------------------------------------------------
244 AC_MSG_CHECKING(how to set a stream file descriptor)
245 AC_CACHE_VAL(scm_cv_fd_setter,
246 AC_TRY_COMPILE([#include <stdio.h>],
248 scm_cv_fd_setter="_file",
249 AC_TRY_COMPILE([#include <stdio.h>],
250 [stdout->_fileno = 1],
251 scm_cv_fd_setter="_fileno",
252 scm_cv_fd_setter="")))
254 if test "$scm_cv_fd_setter"; then
255 AC_MSG_RESULT($scm_cv_fd_setter)
256 AC_DEFINE_UNQUOTED(FD_SETTER, $scm_cv_fd_setter)
258 AC_MSG_RESULT(we couldn't do it!)
261 #--------------------------------------------------------------------
262 # How to find out whether a FILE structure contains buffered data.
263 # From Tk we have the following list:
264 # _cnt: Most UNIX systems
268 # Or, in GNU libc there are two fields, _gptr and _egptr, which
269 # have to be compared.
270 # These can also be known as _IO_read_ptr and _IO_read_end.
271 #--------------------------------------------------------------------
273 AC_MSG_CHECKING(how to get buffer char count from FILE structure)
274 AC_CACHE_VAL(scm_cv_struct_file_count,
275 AC_TRY_COMPILE([#include <stdio.h>],
276 [FILE *f = stdin; f->_cnt = 0],
277 scm_cv_struct_file_count="_cnt",
278 AC_TRY_COMPILE([#include <stdio.h>],
279 [FILE *f = stdin; f->_r = 0],
280 scm_cv_struct_file_count="_r",
281 AC_TRY_COMPILE([#include <stdio.h>],
282 [FILE *f = stdin; f->readCount = 0],
283 scm_cv_struct_file_count="readCount",
284 scm_cv_struct_file_count=""))))
285 if test "$scm_cv_struct_file_count"; then
286 AC_MSG_RESULT($scm_cv_struct_file_count)
287 AC_DEFINE_UNQUOTED(FILE_CNT_FIELD, $scm_cv_struct_file_count)
289 AC_CACHE_VAL(scm_cv_struct_file_gptr,
290 AC_TRY_COMPILE([#include <stdio.h>],
291 [FILE *f = stdin; f->_gptr = f->egptr;],
292 scm_cv_struct_file_gptr=1,
293 scm_cv_struct_file_gptr=""))
294 if test "$scm_cv_struct_gptr"; then
296 AC_DEFINE_UNQUOTED(FILE_CNT_GPTR, $scm_cv_struct_file_gptr)
298 AC_CACHE_VAL(scm_cv_struct_file_readptr,
299 AC_TRY_COMPILE([#include <stdio.h>],
300 [FILE *f = stdin; f->_IO_read_ptr = f->_IO_read_end;],
301 scm_cv_struct_file_readptr=1))
302 if test "$scm_cv_struct_file_readptr"; then
303 AC_MSG_RESULT(read_ptr)
304 AC_DEFINE_UNQUOTED(FILE_CNT_READPTR, $scm_cv_struct_file_readptr)
306 AC_MSG_RESULT(we couldn't do it!)
311 #--------------------------------------------------------------------
313 # Flags for thread support
315 #--------------------------------------------------------------------
317 ### What thread package has the user asked for?
318 AC_ARG_WITH(threads, [ --with-threads thread interface],
321 ### Turn $with_threads into either the name of a threads package, like
322 ### `qt', or `no', meaning that threads should not be supported.
323 AC_MSG_CHECKING(whether to support threads)
324 case "$with_threads" in
325 "yes" | "qt" | "coop" | "")
331 AC_MSG_ERROR(invalid value for --with-threads: $with_threads)
334 AC_MSG_RESULT($with_threads)
336 ## Make sure the threads package we've chosen is actually supported on
337 ## the present platform.
338 case "${with_threads}" in
340 ## This configures the QuickThreads package, and sets or clears
341 ## the THREAD_PACKAGE variable if qthreads don't configure
347 ## If we're using threads, bring in some other parts of Guile which
349 if test "${THREAD_PACKAGE}" != "" ; then
350 AC_DEFINE(USE_THREADS, 1)
352 ## Include the Guile thread interface in the library...
353 LIBOBJS="$LIBOBJS threads.o"
355 ## ... and tell it which package to talk to.
356 case "${THREAD_PACKAGE}" in
358 AC_DEFINE(USE_COOP_THREADS, 1)
361 AC_MSG_ERROR(invalid value for THREAD_PACKAGE: ${THREAD_PACKAGE})
365 ## Bring in scm_internal_select, if appropriate.
366 if test $ac_cv_func_gettimeofday = yes &&
367 test $ac_cv_func_select = yes; then
368 LIBOBJS="$LIBOBJS iselect.o"
369 AC_DEFINE(GUILE_ISELECT, 1)
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)
389 dnl Tell build-guile what flags guile users should link against.
390 GUILE_LIBS="$LDFLAGS $THREAD_LIBS_INSTALLED $LIBS"
393 dnl timestamping the interpreter and scheme libraries:
395 dnl Help us notice when we're running one version of the Guile
396 dnl interpreter against a different version of the ice-9 Scheme code.
397 dnl This will definitely detect version skew due to differing
398 dnl snapshots and releases, but may not catch skew for the developers.
399 dnl Hopefully it will not detect skew when there is none; if that
400 dnl happens, the warnings will be useless, and we should remove this.
402 AC_SUBST(GUILE_STAMP)
407 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])
410 dnl comment-start: "dnl "
412 dnl comment-start-skip: "\\bdnl\\b\\s *"