Remove the TOTORO kludge. We're not doing snapshots any more, so
[bpt/guile.git] / configure.in
1 dnl Process this file with autoconf to produce configure.
2 AC_INIT(Makefile.in)
3 . $srcdir/GUILE-VERSION
4 AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
5 AM_MAINTAINER_MODE
6 AM_CONFIG_HEADER(libguile/scmconfig.h)
7
8 #--------------------------------------------------------------------
9 #
10 # User options
11 #
12 #--------------------------------------------------------------------
13
14 AC_ARG_ENABLE(debug,
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"
20 fi
21
22 AC_ARG_ENABLE(dynamic-linking,
23 [ --enable-dynamic-linking Include support for dynamic linking],,
24 enable_dynamic_linking=yes)
25
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)
30 fi
31
32 #--------------------------------------------------------------------
33
34 AC_PROG_CC
35 AC_PROG_CPP
36 AM_PROG_LIBTOOL
37
38 AC_AIX
39 AC_ISC_POSIX
40 AC_MINIX
41
42 AC_C_CONST
43
44 AC_HEADER_STDC
45 AC_HEADER_DIRENT
46 AC_HEADER_TIME
47 AC_HEADER_SYS_WAIT
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
50
51 AC_TYPE_GETGROUPS
52 AC_TYPE_SIGNAL
53 AC_TYPE_MODE_T
54
55 AC_CHECK_LIB(m, main)
56 AC_CHECK_FUNCS(gethostbyname)
57 if test $ac_cv_func_gethostbyname = no; then
58 AC_CHECK_LIB(nsl, gethostbyname)
59 fi
60 AC_CHECK_FUNCS(connect)
61 if test $ac_cv_func_connect = no; then
62 AC_CHECK_LIB(socket, connect)
63 fi
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.'
69 fi
70
71 # Checks for dynamic linking
72
73 if test "$enable_dynamic_linking" = "yes"; then
74
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)
79 else
80 AC_CHECK_LIB(dld,dld_link)
81 if test "$ac_cv_lib_dld_dld_link" = "yes"; then
82 AC_DEFINE(DYNAMIC_LINKING)
83 else
84 AC_CHECK_FUNCS(shl_load)
85 if test "$ac_cv_func_shl_load" = "yes"; then
86 AC_DEFINE(DYNAMIC_LINKING)
87 else
88 AC_CHECK_FUNCS(dlopen)
89 if test "$ac_cv_func_dlopen" = "yes"; then
90 AC_DEFINE(DYNAMIC_LINKING)
91 fi
92 fi
93 fi
94 fi
95
96 fi
97
98 GUILE_DLSYM_USCORE
99
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)
101
102 # Determine the host we are working on
103 AC_CANONICAL_HOST
104
105 # Some operating systems don't declare all functions
106 case "$host_os" in
107 solaris2.5*)
108 AC_DEFINE(DECLARE_BZERO)
109 AC_DEFINE(DECLARE_USLEEP)
110 ;;
111 esac
112
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)
117 )
118
119
120 dnl <GNU-WIN32 hacks>
121
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)
125 fi
126
127 AC_CHECK_FUNCS(socketpair getgroups setpwent pause tzset)
128
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.
132
133 dnl how about:
134 dnl save confdefs.h
135 dnl if test $ac_cv_cigwin = yes; then
136 dnl modify confdefs.h
137 dnl fi
138 dnl AC_CHECK_FUNCS...
139 dnl restore confdefs.h
140
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
147 dnl #endif
148 dnl EOF
149 dnl AC_CHECK_FUNC($func)
150 dnl done
151 dnl cp confdefs.h.bak confdefs.h
152
153 AC_CHECK_FUNCS(sethostent endhostent getnetent setnetent endnetent getprotoent endprotoent getservent endservent getnetbyaddr getnetbyname inet_lnaof inet_makeaddr inet_netof)
154
155 dnl </GNU-WIN32 hacks>
156
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],
161 scm_cv_restarts=yes,
162 scm_cv_restarts=no)]
163 else
164 scm_cv_restarts=no
165 fi)
166 if test $scm_cv_restarts = yes; then
167 AC_DEFINE(HAVE_RESTARTS)
168 fi
169
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"])]
176 )
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)
182 fi
183 fi
184
185 AC_REPLACE_FUNCS(inet_aton putenv strerror)
186
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.
190 AC_FUNC_ALLOCA
191 if test "$ALLOCA" = "alloca.o"; then LIBOBJS="alloca.o $LIBOBJS"; fi
192
193 AC_STRUCT_ST_RDEV
194 AC_STRUCT_ST_BLKSIZE
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.
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)
204 fi
205
206 AC_STRUCT_TIMEZONE
207 GUILE_STRUCT_UTIMBUF
208
209 #--------------------------------------------------------------------
210 #
211 # Which way does the stack grow?
212 #
213 #--------------------------------------------------------------------
214
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))
219
220
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))
224
225 AC_MSG_CHECKING(for struct linger)
226 AC_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"))
233 AC_MSG_RESULT($scm_cv_struct_linger)
234 if test $scm_cv_struct_linger = yes; then
235 AC_DEFINE(HAVE_STRUCT_LINGER)
236 fi
237
238 #--------------------------------------------------------------------
239 #
240 # How can you violate a stdio abstraction by setting a stream's fd?
241 #
242 #--------------------------------------------------------------------
243
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>],
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
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)
257 else
258 AC_MSG_RESULT(we couldn't do it!)
259 fi
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
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)
288 else
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
295 AC_MSG_RESULT(gptr)
296 AC_DEFINE_UNQUOTED(FILE_CNT_GPTR, $scm_cv_struct_file_gptr)
297 else
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)
305 else
306 AC_MSG_RESULT(we couldn't do it!)
307 fi
308 fi
309 fi
310
311 #--------------------------------------------------------------------
312 #
313 # Flags for thread support
314 #
315 #--------------------------------------------------------------------
316
317 ### What thread package has the user asked for?
318 AC_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.
323 case "$with_threads" in
324 "yes" | "qt" | "coop" | "")
325 with_threads=qt
326 ;;
327 "no" )
328 ;;
329 * )
330 AC_MSG_ERROR(invalid value for --with-threads: $with_threads)
331 ;;
332 esac
333
334 ## Make sure the threads package we've chosen is actually supported on
335 ## the present platform.
336 case "${with_threads}" in
337 "qt" )
338 ## This configures the QuickThreads package, and sets or clears
339 ## the THREAD_PACKAGE variable if qthreads don't configure
340 ## correctly.
341 QTHREADS_CONFIGURE
342 ;;
343 esac
344
345 ## If we're using threads, bring in some other parts of Guile which
346 ## work with them.
347 if test "${THREAD_PACKAGE}" != "" ; then
348 AC_DEFINE(USE_THREADS, 1)
349
350 ## Include the Guile thread interface in the library...
351 LIBOBJS="$LIBOBJS threads.o"
352
353 ## ... and tell it which package to talk to.
354 case "${THREAD_PACKAGE}" in
355 "QT" )
356 AC_DEFINE(USE_COOP_THREADS, 1)
357 ;;
358 * )
359 AC_MSG_ERROR(invalid value for THREAD_PACKAGE: ${THREAD_PACKAGE})
360 ;;
361 esac
362
363 ## Bring in scm_internal_select, if appropriate.
364 if test $ac_cv_func_gettimeofday = yes &&
365 test $ac_cv_func_select = yes; then
366 LIBOBJS="$LIBOBJS iselect.o"
367 AC_DEFINE(GUILE_ISELECT, 1)
368 fi
369 fi
370
371 ## If we're using GCC, ask for aggressive warnings.
372 case "$GCC" in
373 yes ) CFLAGS="$CFLAGS -Wall -Wpointer-arith" ;;
374 esac
375
376 AC_PROG_AWK
377
378 ## If we're creating a shared library (using libtool!), then we'll
379 ## need to generate a list of .lo files corresponding to the .o files
380 ## given in LIBOBJS. We'll call it LIBLOBJS.
381 LIBLOBJS="`echo ${LIBOBJS} | sed 's/\.o/.lo/g'`"
382
383 AC_SUBST(GUILE_MAJOR_VERSION)
384 AC_SUBST(GUILE_MINOR_VERSION)
385 AC_SUBST(GUILE_VERSION)
386
387 dnl Tell build-guile what flags guile users should link against.
388 GUILE_LIBS="$LDFLAGS $THREAD_LIBS_INSTALLED $LIBS"
389 AC_SUBST(GUILE_LIBS)
390
391 dnl timestamping the interpreter and scheme libraries:
392 dnl
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.
399 GUILE_STAMP="`date`"
400 AC_SUBST(GUILE_STAMP)
401
402 AC_SUBST(AWK)
403 AC_SUBST(LIBLOBJS)
404
405 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])
406
407 dnl Local Variables:
408 dnl comment-start: "dnl "
409 dnl comment-end: ""
410 dnl comment-start-skip: "\\bdnl\\b\\s *"
411 dnl End: