* configure.in: Remove --disable-debug option. The debugging
[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(dynamic-linking,
15 [ --enable-dynamic-linking Include support for dynamic linking],,
16 enable_dynamic_linking=yes)
17
18 AC_ARG_ENABLE(guile-debug,
19 [ --enable-guile-debug Include internal debugging functions])
20 if test "$enableval" = y || test "$enableval" = yes; then
21 AC_DEFINE(GUILE_DEBUG)
22 fi
23
24 dnl The --disable-debug used to control these two. But now they are
25 dnl a required part of the distribution.
26 AC_DEFINE(DEBUG_EXTENSIONS)
27 AC_DEFINE(READER_EXTENSIONS)
28
29 #--------------------------------------------------------------------
30
31 AC_PROG_CC
32 AC_PROG_CPP
33 AM_PROG_LIBTOOL
34
35 AC_AIX
36 AC_ISC_POSIX
37 AC_MINIX
38
39 AC_C_CONST
40
41 AC_HEADER_STDC
42 AC_HEADER_DIRENT
43 AC_HEADER_TIME
44 AC_HEADER_SYS_WAIT
45 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)
46 GUILE_HEADER_LIBC_WITH_UNISTD
47
48 AC_TYPE_GETGROUPS
49 AC_TYPE_SIGNAL
50 AC_TYPE_MODE_T
51
52 AC_CHECK_LIB(m, main)
53 AC_CHECK_FUNCS(gethostbyname)
54 if test $ac_cv_func_gethostbyname = no; then
55 AC_CHECK_LIB(nsl, gethostbyname)
56 fi
57 AC_CHECK_FUNCS(connect)
58 if test $ac_cv_func_connect = no; then
59 AC_CHECK_LIB(socket, connect)
60 fi
61 AC_CHECK_LIB(termcap, tgoto)
62 AC_CHECK_LIB(readline, readline)
63 AC_CHECK_FUNCS(rl_getc_function rl_clear_signals rl_cleanup_after_signal)
64 if test $ac_cv_lib_readline_readline = yes -a $ac_cv_func_rl_getc_function = no; then
65 echo 'Warning: libreadline is too old on your system. Need >= 2.1.'
66 fi
67
68 # Checks for dynamic linking
69
70 if test "$enable_dynamic_linking" = "yes"; then
71
72 AC_CHECK_LIB(dl,dlopen)
73 if test "$ac_cv_lib_dl_dlopen" = "yes"; then
74 AC_CHECK_FUNCS(dlopen)
75 AC_DEFINE(DYNAMIC_LINKING)
76 else
77 AC_CHECK_LIB(dld,dld_link)
78 if test "$ac_cv_lib_dld_dld_link" = "yes"; then
79 AC_DEFINE(DYNAMIC_LINKING)
80 else
81 AC_CHECK_FUNCS(shl_load)
82 if test "$ac_cv_func_shl_load" = "yes"; then
83 AC_DEFINE(DYNAMIC_LINKING)
84 else
85 AC_CHECK_FUNCS(dlopen)
86 if test "$ac_cv_func_dlopen" = "yes"; then
87 AC_DEFINE(DYNAMIC_LINKING)
88 fi
89 fi
90 fi
91 fi
92
93 fi
94
95 GUILE_DLSYM_USCORE
96
97 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)
98
99 # Determine the host we are working on
100 AC_CANONICAL_HOST
101
102 # Some operating systems don't declare all functions
103 case "$host_os" in
104 solaris2.5*)
105 AC_DEFINE(DECLARE_BZERO)
106 AC_DEFINE(DECLARE_USLEEP)
107 ;;
108 esac
109
110 # On some systems usleep has no return value
111 AC_EGREP_HEADER(changequote(<, >)<void[ ][ ]*usleep>changequote([, ]),
112 /usr/include/unistd.h,
113 AC_DEFINE(USLEEP_RETURNS_VOID)
114 )
115
116
117 dnl <GNU-WIN32 hacks>
118
119 AC_CHECK_HEADER(sys/un.h, have_sys_un_h=1)
120 if test -n "$have_sys_un_h" ; then
121 AC_DEFINE(HAVE_UNIX_DOMAIN_SOCKETS)
122 fi
123
124 AC_CHECK_FUNCS(socketpair getgroups setpwent pause tzset)
125
126 dnl I don't know what this prefixing of cygwin32_ is for.
127 dnl scmconfig.h wasn't updated with the test results.
128 dnl so use AC_CHECK_FUNCS for now.
129
130 dnl how about:
131 dnl save confdefs.h
132 dnl if test $ac_cv_cigwin = yes; then
133 dnl modify confdefs.h
134 dnl fi
135 dnl AC_CHECK_FUNCS...
136 dnl restore confdefs.h
137
138 dnl cp confdefs.h confdefs.h.bak
139 dnl for func in sethostent endhostent getnetent setnetent endnetent getprotoent endprotoent getservent endservent getnetbyaddr getnetbyname inet_lnaof inet_makeaddr inet_netof ; do
140 dnl cp confdefs.h.bak confdefs.h
141 dnl cat >> confdefs.h << EOF
142 dnl #ifdef __CYGWIN32__
143 dnl #define $func cygwin32_$func
144 dnl #endif
145 dnl EOF
146 dnl AC_CHECK_FUNC($func)
147 dnl done
148 dnl cp confdefs.h.bak confdefs.h
149
150 AC_CHECK_FUNCS(sethostent endhostent getnetent setnetent endnetent getprotoent endprotoent getservent endservent getnetbyaddr getnetbyname inet_lnaof inet_makeaddr inet_netof)
151
152 dnl </GNU-WIN32 hacks>
153
154 AC_CACHE_CHECK([for restartable system calls], scm_cv_restarts,
155 if test $ac_cv_func_sigaction = yes; then
156 [AC_TRY_COMPILE([#include <signal.h>],
157 [int a = SA_RESTART],
158 scm_cv_restarts=yes,
159 scm_cv_restarts=no)]
160 else
161 scm_cv_restarts=no
162 fi)
163 if test $scm_cv_restarts = yes; then
164 AC_DEFINE(HAVE_RESTARTS)
165 fi
166
167 if test "$ac_cv_header_regex_h" = yes ||
168 test "$ac_cv_header_rxposix_h" = yes ||
169 test "$ac_cv_header_rx_rxposix_h" = yes; then
170 GUILE_NAMED_CHECK_FUNC(regcomp, norx, [LIBOBJS="regex-posix.o $LIBOBJS"],
171 [AC_CHECK_LIB(rx, main)
172 GUILE_NAMED_CHECK_FUNC(regcomp, rx, [LIBOBJS="regex-posix.o $LIBOBJS"])]
173 )
174 dnl The following should not be necessary, but for some reason
175 dnl autoheader misses it if we don't include it!
176 if test "$ac_cv_func_regcomp_norx" = yes ||
177 test "$ac_cv_func_regcomp_rx" = yes; then
178 AC_DEFINE(HAVE_REGCOMP)
179 fi
180 fi
181
182 AC_REPLACE_FUNCS(inet_aton putenv strerror)
183
184 # When testing for the presence of alloca, we need to add alloca.o
185 # explicitly to LIBOBJS to make sure that it is translated to
186 # `alloca.lo' for libtool later on. This can and should be done more cleanly.
187 AC_FUNC_ALLOCA
188 if test "$ALLOCA" = "alloca.o"; then LIBOBJS="alloca.o $LIBOBJS"; fi
189
190 AC_STRUCT_ST_RDEV
191 AC_STRUCT_ST_BLKSIZE
192
193 # We could use AC_STRUCT_ST_BLOCKS here, but that adds fileblocks.o to
194 # LIBOBJS, which we don't need. This seems more direct.
195 AC_CACHE_CHECK([for st_blocks in struct stat], ac_cv_struct_st_blocks,
196 [AC_TRY_COMPILE([#include <sys/types.h>
197 #include <sys/stat.h>], [struct stat s; s.st_blocks;],
198 ac_cv_struct_st_blocks=yes, ac_cv_struct_st_blocks=no)])
199 if test $ac_cv_struct_st_blocks = yes; then
200 AC_DEFINE(HAVE_ST_BLOCKS)
201 fi
202
203 AC_STRUCT_TIMEZONE
204 GUILE_STRUCT_UTIMBUF
205
206 #--------------------------------------------------------------------
207 #
208 # Which way does the stack grow?
209 #
210 #--------------------------------------------------------------------
211
212 AC_TRY_RUN(aux (l) unsigned long l;
213 { int x; exit (l >= ((unsigned long)&x)); }
214 main () { int q; aux((unsigned long)&q); },
215 AC_DEFINE(SCM_STACK_GROWS_UP),,AC_MSG_WARN(Guessing that stack grows down -- see scmconfig.h.in))
216
217
218 AC_TRY_RUN(main () { exit (sizeof(float) != sizeof(long)); },
219 AC_DEFINE(SCM_SINGLES),,AC_DEFINE(SCM_SINGLES)
220 AC_MSG_WARN(Guessing that sizeof(long) == sizeof(float) -- see scmconfig.h.in))
221
222 AC_MSG_CHECKING(for struct linger)
223 AC_CACHE_VAL(scm_cv_struct_linger,
224 AC_TRY_COMPILE([
225 #include <sys/types.h>
226 #include <sys/socket.h>],
227 [struct linger lgr; lgr.l_linger = 100],
228 scm_cv_struct_linger="yes",
229 scm_cv_struct_linger="no"))
230 AC_MSG_RESULT($scm_cv_struct_linger)
231 if test $scm_cv_struct_linger = yes; then
232 AC_DEFINE(HAVE_STRUCT_LINGER)
233 fi
234
235 #--------------------------------------------------------------------
236 #
237 # How can you violate a stdio abstraction by setting a stream's fd?
238 #
239 #--------------------------------------------------------------------
240
241 AC_MSG_CHECKING(how to set a stream file descriptor)
242 AC_CACHE_VAL(scm_cv_fd_setter,
243 AC_TRY_COMPILE([#include <stdio.h>],
244 [stdout->_file = 1],
245 scm_cv_fd_setter="_file",
246 AC_TRY_COMPILE([#include <stdio.h>],
247 [stdout->_fileno = 1],
248 scm_cv_fd_setter="_fileno",
249 scm_cv_fd_setter="")))
250
251 if test "$scm_cv_fd_setter"; then
252 AC_MSG_RESULT($scm_cv_fd_setter)
253 AC_DEFINE_UNQUOTED(FD_SETTER, $scm_cv_fd_setter)
254 else
255 AC_MSG_RESULT(we couldn't do it!)
256 fi
257
258 #--------------------------------------------------------------------
259 # How to find out whether a FILE structure contains buffered data.
260 # From Tk we have the following list:
261 # _cnt: Most UNIX systems
262 # __cnt: HPUX
263 # _r: BSD
264 # readCount: Sprite
265 # Or, in GNU libc there are two fields, _gptr and _egptr, which
266 # have to be compared.
267 # These can also be known as _IO_read_ptr and _IO_read_end.
268 #--------------------------------------------------------------------
269
270 AC_MSG_CHECKING(how to get buffer char count from FILE structure)
271 AC_CACHE_VAL(scm_cv_struct_file_count,
272 AC_TRY_COMPILE([#include <stdio.h>],
273 [FILE *f = stdin; f->_cnt = 0],
274 scm_cv_struct_file_count="_cnt",
275 AC_TRY_COMPILE([#include <stdio.h>],
276 [FILE *f = stdin; f->_r = 0],
277 scm_cv_struct_file_count="_r",
278 AC_TRY_COMPILE([#include <stdio.h>],
279 [FILE *f = stdin; f->readCount = 0],
280 scm_cv_struct_file_count="readCount",
281 scm_cv_struct_file_count=""))))
282 if test "$scm_cv_struct_file_count"; then
283 AC_MSG_RESULT($scm_cv_struct_file_count)
284 AC_DEFINE_UNQUOTED(FILE_CNT_FIELD, $scm_cv_struct_file_count)
285 else
286 AC_CACHE_VAL(scm_cv_struct_file_gptr,
287 AC_TRY_COMPILE([#include <stdio.h>],
288 [FILE *f = stdin; f->_gptr = f->egptr;],
289 scm_cv_struct_file_gptr=1,
290 scm_cv_struct_file_gptr=""))
291 if test "$scm_cv_struct_gptr"; then
292 AC_MSG_RESULT(gptr)
293 AC_DEFINE_UNQUOTED(FILE_CNT_GPTR, $scm_cv_struct_file_gptr)
294 else
295 AC_CACHE_VAL(scm_cv_struct_file_readptr,
296 AC_TRY_COMPILE([#include <stdio.h>],
297 [FILE *f = stdin; f->_IO_read_ptr = f->_IO_read_end;],
298 scm_cv_struct_file_readptr=1))
299 if test "$scm_cv_struct_file_readptr"; then
300 AC_MSG_RESULT(read_ptr)
301 AC_DEFINE_UNQUOTED(FILE_CNT_READPTR, $scm_cv_struct_file_readptr)
302 else
303 AC_MSG_RESULT(we couldn't do it!)
304 fi
305 fi
306 fi
307
308 #--------------------------------------------------------------------
309 #
310 # Flags for thread support
311 #
312 #--------------------------------------------------------------------
313
314 ### What thread package has the user asked for?
315 AC_ARG_WITH(threads, [ --with-threads thread interface],
316 , with_threads=no)
317
318 ### Turn $with_threads into either the name of a threads package, like
319 ### `qt', or `no', meaning that threads should not be supported.
320 AC_MSG_CHECKING(whether to support threads)
321 case "$with_threads" in
322 "yes" | "qt" | "coop" | "")
323 with_threads=qt
324 ;;
325 "no" )
326 ;;
327 * )
328 AC_MSG_ERROR(invalid value for --with-threads: $with_threads)
329 ;;
330 esac
331 AC_MSG_RESULT($with_threads)
332
333 ## Make sure the threads package we've chosen is actually supported on
334 ## the present platform.
335 case "${with_threads}" in
336 "qt" )
337 ## This configures the QuickThreads package, and sets or clears
338 ## the THREAD_PACKAGE variable if qthreads don't configure
339 ## correctly.
340 QTHREADS_CONFIGURE
341 ;;
342 esac
343
344 ## If we're using threads, bring in some other parts of Guile which
345 ## work with them.
346 if test "${THREAD_PACKAGE}" != "" ; then
347 AC_DEFINE(USE_THREADS, 1)
348
349 ## Include the Guile thread interface in the library...
350 LIBOBJS="$LIBOBJS threads.o"
351
352 ## ... and tell it which package to talk to.
353 case "${THREAD_PACKAGE}" in
354 "QT" )
355 AC_DEFINE(USE_COOP_THREADS, 1)
356 ;;
357 * )
358 AC_MSG_ERROR(invalid value for THREAD_PACKAGE: ${THREAD_PACKAGE})
359 ;;
360 esac
361
362 ## Bring in scm_internal_select, if appropriate.
363 if test $ac_cv_func_gettimeofday = yes &&
364 test $ac_cv_func_select = yes; then
365 LIBOBJS="$LIBOBJS iselect.o"
366 AC_DEFINE(GUILE_ISELECT, 1)
367 fi
368 fi
369
370 ## If we're using GCC, ask for aggressive warnings.
371 case "$GCC" in
372 yes )
373 ## We had -Wstrict-prototypes in here for a bit, but Guile does too
374 ## much stuff with generic function pointers for that to really be
375 ## less than exasperating.
376 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wmissing-prototypes" ;;
377 esac
378
379 AC_PROG_AWK
380
381 ## If we're creating a shared library (using libtool!), then we'll
382 ## need to generate a list of .lo files corresponding to the .o files
383 ## given in LIBOBJS. We'll call it LIBLOBJS.
384 LIBLOBJS="`echo ${LIBOBJS} | sed 's/\.o/.lo/g'`"
385
386 AC_SUBST(GUILE_MAJOR_VERSION)
387 AC_SUBST(GUILE_MINOR_VERSION)
388 AC_SUBST(GUILE_VERSION)
389
390 dnl Tell build-guile what flags guile users should link against.
391 GUILE_LIBS="$LDFLAGS $THREAD_LIBS_INSTALLED $LIBS"
392 AC_SUBST(GUILE_LIBS)
393
394 dnl timestamping the interpreter and scheme libraries:
395 dnl
396 dnl Help us notice when we're running one version of the Guile
397 dnl interpreter against a different version of the ice-9 Scheme code.
398 dnl This will definitely detect version skew due to differing
399 dnl snapshots and releases, but may not catch skew for the developers.
400 dnl Hopefully it will not detect skew when there is none; if that
401 dnl happens, the warnings will be useless, and we should remove this.
402 GUILE_STAMP="`date`"
403 AC_SUBST(GUILE_STAMP)
404
405 AC_SUBST(AWK)
406 AC_SUBST(LIBLOBJS)
407
408 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])
409
410 dnl Local Variables:
411 dnl comment-start: "dnl "
412 dnl comment-end: ""
413 dnl comment-start-skip: "\\bdnl\\b\\s *"
414 dnl End: