*** empty log message ***
[bpt/guile.git] / configure.in
CommitLineData
733943b9 1dnl Process this file with autoconf to produce configure.
0f2d19dd 2AC_INIT(Makefile.in)
2d26def0 3. $srcdir/GUILE-VERSION
3a629497 4AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
15ae1bee 5AM_MAINTAINER_MODE
3a629497 6AM_CONFIG_HEADER(libguile/scmconfig.h)
2d26def0 7
3a629497
JB
8#--------------------------------------------------------------------
9#
10# User options
11#
12#--------------------------------------------------------------------
86789f9b 13
3a629497
JB
14AC_ARG_ENABLE(debug,
15[ --disable-debug Don't include debugging support])
16if 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"
20fi
21
22AC_ARG_ENABLE(dynamic-linking,
af8865f7
JB
23 [ --enable-dynamic-linking Include support for dynamic linking],,
24 enable_dynamic_linking=yes)
3a629497
JB
25
26AC_ARG_ENABLE(guile-debug,
27[ --enable-guile-debug Include internal debugging functions])
28if test "$enableval" = y || test "$enableval" = yes; then
29 AC_DEFINE(GUILE_DEBUG)
30fi
31
32#--------------------------------------------------------------------
33
34AC_PROG_CC
35AC_PROG_CPP
36AM_PROG_LIBTOOL
37
38AC_AIX
39AC_ISC_POSIX
40AC_MINIX
41
42AC_C_CONST
43
44AC_HEADER_STDC
45AC_HEADER_DIRENT
46AC_HEADER_TIME
47AC_HEADER_SYS_WAIT
e9cd5d2f 48AC_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)
3a629497
JB
49GUILE_HEADER_LIBC_WITH_UNISTD
50
51AC_TYPE_GETGROUPS
52AC_TYPE_SIGNAL
53AC_TYPE_MODE_T
54
5852c051 55AC_CHECK_LIB(m, main)
4c787b52 56AC_CHECK_FUNCS(gethostbyname)
5852c051
JB
57if test $ac_cv_func_gethostbyname = no; then
58 AC_CHECK_LIB(nsl, gethostbyname)
59fi
4c787b52 60AC_CHECK_FUNCS(connect)
5852c051
JB
61if test $ac_cv_func_connect = no; then
62 AC_CHECK_LIB(socket, connect)
63fi
81e9e32f
JB
64AC_CHECK_LIB(termcap, tgoto)
65AC_CHECK_LIB(readline, readline)
7e0fee6e 66AC_CHECK_FUNCS(rl_getc_function rl_clear_signals rl_cleanup_after_signal)
c700db4f
MD
67if 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.'
69fi
5852c051 70
90fcac06
JB
71# Checks for dynamic linking
72
5852c051
JB
73if test "$enable_dynamic_linking" = "yes"; then
74
75AC_CHECK_LIB(dl,dlopen)
76if test "$ac_cv_lib_dl_dlopen" = "yes"; then
4c787b52 77 AC_CHECK_FUNCS(dlopen)
5852c051
JB
78 AC_DEFINE(DYNAMIC_LINKING)
79else
80AC_CHECK_LIB(dld,dld_link)
81if test "$ac_cv_lib_dld_dld_link" = "yes"; then
5852c051
JB
82 AC_DEFINE(DYNAMIC_LINKING)
83else
4c787b52 84AC_CHECK_FUNCS(shl_load)
5852c051
JB
85if test "$ac_cv_func_shl_load" = "yes"; then
86 AC_DEFINE(DYNAMIC_LINKING)
a4995389 87else
4c787b52 88AC_CHECK_FUNCS(dlopen)
a4995389
MV
89if test "$ac_cv_func_dlopen" = "yes"; then
90 AC_DEFINE(DYNAMIC_LINKING)
91fi
5852c051
JB
92fi
93fi
94fi
95
96fi
97
2a0d7176 98GUILE_DLSYM_USCORE
5852c051 99
95fc06d5 100AC_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)
64e121dc
MD
101
102# Determine the host we are working on
103AC_CANONICAL_HOST
104
105# Some operating systems don't declare all functions
106case "$host_os" in
107 solaris2.5*)
108 AC_DEFINE(DECLARE_BZERO)
109 AC_DEFINE(DECLARE_USLEEP)
110 ;;
111esac
e1a191a8 112
d9eb6fb7 113# On some systems usleep has no return value
0935d604
MD
114AC_EGREP_HEADER(changequote(<, >)<void[ ][ ]*usleep>changequote([, ]),
115 /usr/include/unistd.h,
116 AC_DEFINE(USLEEP_RETURNS_VOID)
117)
118
119
da88f0cb
JB
120dnl <GNU-WIN32 hacks>
121
122AC_CHECK_HEADER(sys/un.h, have_sys_un_h=1)
123if test -n "$have_sys_un_h" ; then
124AC_DEFINE(HAVE_UNIX_DOMAIN_SOCKETS)
125fi
126
127AC_CHECK_FUNCS(socketpair getgroups setpwent pause tzset)
128
f4e5b810
GH
129dnl I don't know what this prefixing of cygwin32_ is for.
130dnl scmconfig.h wasn't updated with the test results.
131dnl so use AC_CHECK_FUNCS for now.
132
133dnl how about:
134dnl save confdefs.h
135dnl if test $ac_cv_cigwin = yes; then
136dnl modify confdefs.h
137dnl fi
138dnl AC_CHECK_FUNCS...
139dnl restore confdefs.h
140
141dnl cp confdefs.h confdefs.h.bak
142dnl for func in sethostent endhostent getnetent setnetent endnetent getprotoent endprotoent getservent endservent getnetbyaddr getnetbyname inet_lnaof inet_makeaddr inet_netof ; do
143dnl cp confdefs.h.bak confdefs.h
144dnl cat >> confdefs.h << EOF
145dnl #ifdef __CYGWIN32__
146dnl #define $func cygwin32_$func
147dnl #endif
148dnl EOF
149dnl AC_CHECK_FUNC($func)
150dnl done
151dnl cp confdefs.h.bak confdefs.h
152
153AC_CHECK_FUNCS(sethostent endhostent getnetent setnetent endnetent getprotoent endprotoent getservent endservent getnetbyaddr getnetbyname inet_lnaof inet_makeaddr inet_netof)
da88f0cb
JB
154
155dnl </GNU-WIN32 hacks>
156
e1a191a8
GH
157AC_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],
161 scm_cv_restarts=yes,
162 scm_cv_restarts=no)]
163 else
164 scm_cv_restarts=no
165 fi)
166if test $scm_cv_restarts = yes; then
167 AC_DEFINE(HAVE_RESTARTS)
168fi
169
e9cd5d2f
MD
170if 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
0b89e78e
MD
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"])]
176 )
e9cd5d2f
MD
177 dnl The following should not be necessary, but for some reason
178 dnl autoheader misses it if we don't include it!
0b89e78e
MD
179 if test "$ac_cv_func_regcomp_norx" = yes ||
180 test "$ac_cv_func_regcomp_rx" = yes; then
e9cd5d2f
MD
181 AC_DEFINE(HAVE_REGCOMP)
182 fi
da88f0cb 183fi
8e1bfcd0 184
3a629497
JB
185AC_REPLACE_FUNCS(inet_aton putenv strerror)
186
4a5fa91c
TP
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.
3a629497 190AC_FUNC_ALLOCA
4a5fa91c 191if test "$ALLOCA" = "alloca.o"; then LIBOBJS="alloca.o $LIBOBJS"; fi
3a629497
JB
192
193AC_STRUCT_ST_RDEV
194AC_STRUCT_ST_BLKSIZE
075edbde
JB
195
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.
198AC_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;],
201ac_cv_struct_st_blocks=yes, ac_cv_struct_st_blocks=no)])
202if test $ac_cv_struct_st_blocks = yes; then
203 AC_DEFINE(HAVE_ST_BLOCKS)
204fi
205
3a629497
JB
206AC_STRUCT_TIMEZONE
207GUILE_STRUCT_UTIMBUF
208
3a629497
JB
209#--------------------------------------------------------------------
210#
211# Which way does the stack grow?
212#
213#--------------------------------------------------------------------
214
215AC_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))
219
220
221AC_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))
224
225AC_MSG_CHECKING(for struct linger)
226AC_CACHE_VAL(scm_cv_struct_linger,
227 AC_TRY_COMPILE([
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"))
233AC_MSG_RESULT($scm_cv_struct_linger)
234if test $scm_cv_struct_linger = yes; then
235 AC_DEFINE(HAVE_STRUCT_LINGER)
236fi
237
238#--------------------------------------------------------------------
239#
240# How can you violate a stdio abstraction by setting a stream's fd?
241#
242#--------------------------------------------------------------------
243
244AC_MSG_CHECKING(how to set a stream file descriptor)
245AC_CACHE_VAL(scm_cv_fd_setter,
246 AC_TRY_COMPILE([#include <stdio.h>],
247 [stdout->_file = 1],
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="")))
253
254if test "$scm_cv_fd_setter"; then
255 AC_MSG_RESULT($scm_cv_fd_setter)
256 AC_DEFINE_UNQUOTED(FD_SETTER, $scm_cv_fd_setter)
257else
258 AC_MSG_RESULT(we couldn't do it!)
259fi
260
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
265# __cnt: HPUX
266# _r: BSD
267# readCount: Sprite
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#--------------------------------------------------------------------
272
273AC_MSG_CHECKING(how to get buffer char count from FILE structure)
274AC_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=""))))
285if 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)
288else
289AC_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=""))
294if test "$scm_cv_struct_gptr"; then
295 AC_MSG_RESULT(gptr)
296 AC_DEFINE_UNQUOTED(FILE_CNT_GPTR, $scm_cv_struct_file_gptr)
297else
298AC_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))
302if 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)
305else
306 AC_MSG_RESULT(we couldn't do it!)
307fi
308fi
309fi
310
311#--------------------------------------------------------------------
312#
313# Flags for thread support
314#
315#--------------------------------------------------------------------
316
539c89a1
JB
317### What thread package has the user asked for?
318AC_ARG_WITH(threads, [ --with-threads thread interface],
319 , with_threads=no)
320
321### Turn $with_threads into either the name of a threads package, like
322### `qt', or `no', meaning that threads should not be supported.
e0f54bcc 323AC_MSG_CHECKING(whether to support threads)
539c89a1
JB
324case "$with_threads" in
325 "yes" | "qt" | "coop" | "")
326 with_threads=qt
327 ;;
328 "no" )
329 ;;
330 * )
331 AC_MSG_ERROR(invalid value for --with-threads: $with_threads)
332 ;;
333esac
e0f54bcc 334AC_MSG_RESULT($with_threads)
3a629497 335
539c89a1
JB
336## Make sure the threads package we've chosen is actually supported on
337## the present platform.
338case "${with_threads}" in
339 "qt" )
340 ## This configures the QuickThreads package, and sets or clears
341 ## the THREAD_PACKAGE variable if qthreads don't configure
342 ## correctly.
343 QTHREADS_CONFIGURE
344 ;;
345esac
3a629497 346
539c89a1
JB
347## If we're using threads, bring in some other parts of Guile which
348## work with them.
349if test "${THREAD_PACKAGE}" != "" ; then
350 AC_DEFINE(USE_THREADS, 1)
3a629497 351
539c89a1
JB
352 ## Include the Guile thread interface in the library...
353 LIBOBJS="$LIBOBJS threads.o"
933a7411 354
539c89a1
JB
355 ## ... and tell it which package to talk to.
356 case "${THREAD_PACKAGE}" in
357 "QT" )
358 AC_DEFINE(USE_COOP_THREADS, 1)
359 ;;
360 * )
361 AC_MSG_ERROR(invalid value for THREAD_PACKAGE: ${THREAD_PACKAGE})
362 ;;
363 esac
364
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)
370 fi
933a7411
MD
371fi
372
3a629497
JB
373## If we're using GCC, ask for aggressive warnings.
374case "$GCC" in
375 yes ) CFLAGS="$CFLAGS -Wall -Wpointer-arith" ;;
376esac
377
378AC_PROG_AWK
379
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.
383LIBLOBJS="`echo ${LIBOBJS} | sed 's/\.o/.lo/g'`"
384
7c86ae05
JB
385AC_SUBST(GUILE_MAJOR_VERSION)
386AC_SUBST(GUILE_MINOR_VERSION)
387AC_SUBST(GUILE_VERSION)
539c89a1
JB
388
389dnl Tell build-guile what flags guile users should link against.
390GUILE_LIBS="$LDFLAGS $THREAD_LIBS_INSTALLED $LIBS"
daa4f38c 391AC_SUBST(GUILE_LIBS)
7c86ae05
JB
392
393dnl timestamping the interpreter and scheme libraries:
394dnl
395dnl Help us notice when we're running one version of the Guile
396dnl interpreter against a different version of the ice-9 Scheme code.
397dnl This will definitely detect version skew due to differing
398dnl snapshots and releases, but may not catch skew for the developers.
399dnl Hopefully it will not detect skew when there is none; if that
400dnl happens, the warnings will be useless, and we should remove this.
401GUILE_STAMP="`date`"
402AC_SUBST(GUILE_STAMP)
3a629497
JB
403
404AC_SUBST(AWK)
405AC_SUBST(LIBLOBJS)
406
9ba3d403 407AC_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])
0f2d19dd 408
3a629497
JB
409dnl Local Variables:
410dnl comment-start: "dnl "
411dnl comment-end: ""
412dnl comment-start-skip: "\\bdnl\\b\\s *"
413dnl End: