* acconfig.h, configure.in: Define TOTORO if configuring on
[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 # 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.
77
78 AC_CHECK_PROG(HOSTNAME, hostname, hostname)
79 if test "$HOSTNAME" = hostname; then
80 if test "`hostname`" = totoro.red-bean.com; then
81 AC_DEFINE(TOTORO)
82 fi
83 fi
84
85 # Checks for dynamic linking
86
87 if test "$enable_dynamic_linking" = "yes"; then
88
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)
93 else
94 AC_CHECK_LIB(dld,dld_link)
95 if test "$ac_cv_lib_dld_dld_link" = "yes"; then
96 AC_DEFINE(DYNAMIC_LINKING)
97 else
98 AC_CHECK_FUNCS(shl_load)
99 if test "$ac_cv_func_shl_load" = "yes"; then
100 AC_DEFINE(DYNAMIC_LINKING)
101 else
102 AC_CHECK_FUNCS(dlopen)
103 if test "$ac_cv_func_dlopen" = "yes"; then
104 AC_DEFINE(DYNAMIC_LINKING)
105 fi
106 fi
107 fi
108 fi
109
110 fi
111
112 GUILE_DLSYM_USCORE
113
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)
115
116 # Determine the host we are working on
117 AC_CANONICAL_HOST
118
119 # Some operating systems don't declare all functions
120 case "$host_os" in
121 solaris2.5*)
122 AC_DEFINE(DECLARE_BZERO)
123 AC_DEFINE(DECLARE_USLEEP)
124 ;;
125 esac
126
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)
131 )
132
133
134 dnl <GNU-WIN32 hacks>
135
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)
139 fi
140
141 AC_CHECK_FUNCS(socketpair getgroups setpwent pause tzset)
142
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.
146
147 dnl how about:
148 dnl save confdefs.h
149 dnl if test $ac_cv_cigwin = yes; then
150 dnl modify confdefs.h
151 dnl fi
152 dnl AC_CHECK_FUNCS...
153 dnl restore confdefs.h
154
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
161 dnl #endif
162 dnl EOF
163 dnl AC_CHECK_FUNC($func)
164 dnl done
165 dnl cp confdefs.h.bak confdefs.h
166
167 AC_CHECK_FUNCS(sethostent endhostent getnetent setnetent endnetent getprotoent endprotoent getservent endservent getnetbyaddr getnetbyname inet_lnaof inet_makeaddr inet_netof)
168
169 dnl </GNU-WIN32 hacks>
170
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],
175 scm_cv_restarts=yes,
176 scm_cv_restarts=no)]
177 else
178 scm_cv_restarts=no
179 fi)
180 if test $scm_cv_restarts = yes; then
181 AC_DEFINE(HAVE_RESTARTS)
182 fi
183
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"])]
190 )
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)
196 fi
197 fi
198
199 AC_REPLACE_FUNCS(inet_aton putenv strerror)
200
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.
204 AC_FUNC_ALLOCA
205 if test "$ALLOCA" = "alloca.o"; then LIBOBJS="alloca.o $LIBOBJS"; fi
206
207 AC_STRUCT_ST_RDEV
208 AC_STRUCT_ST_BLKSIZE
209
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)
218 fi
219
220 AC_STRUCT_TIMEZONE
221 GUILE_STRUCT_UTIMBUF
222
223 #--------------------------------------------------------------------
224 #
225 # Which way does the stack grow?
226 #
227 #--------------------------------------------------------------------
228
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))
233
234
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))
238
239 AC_MSG_CHECKING(for struct linger)
240 AC_CACHE_VAL(scm_cv_struct_linger,
241 AC_TRY_COMPILE([
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)
250 fi
251
252 #--------------------------------------------------------------------
253 #
254 # How can you violate a stdio abstraction by setting a stream's fd?
255 #
256 #--------------------------------------------------------------------
257
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>],
261 [stdout->_file = 1],
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="")))
267
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)
271 else
272 AC_MSG_RESULT(we couldn't do it!)
273 fi
274
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
279 # __cnt: HPUX
280 # _r: BSD
281 # readCount: Sprite
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 #--------------------------------------------------------------------
286
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)
302 else
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
309 AC_MSG_RESULT(gptr)
310 AC_DEFINE_UNQUOTED(FILE_CNT_GPTR, $scm_cv_struct_file_gptr)
311 else
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)
319 else
320 AC_MSG_RESULT(we couldn't do it!)
321 fi
322 fi
323 fi
324
325 #--------------------------------------------------------------------
326 #
327 # Flags for thread support
328 #
329 #--------------------------------------------------------------------
330
331 CY_AC_WITH_THREADS
332 CFLAGS="$CFLAGS $cy_cv_threads_cflags"
333 THREAD_LIBS="$cy_cv_threads_libs"
334 AC_SUBST(THREAD_LIBS)
335
336 dnl
337 dnl Set the appropriate flags!
338 dnl
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")
349 fi
350 fi
351 fi
352 fi
353 fi
354
355 if test "$cy_cv_threads_package" != ""; then
356 AC_DEFINE(USE_THREADS)
357 LIBOBJS="$LIBOBJS threads.o"
358 fi
359
360 #--------------------------------------------------------------------
361 #
362 # scm_internal_select
363 #
364 #--------------------------------------------------------------------
365
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"
371 fi
372
373 ## If we're using GCC, ask for aggressive warnings.
374 case "$GCC" in
375 yes ) CFLAGS="$CFLAGS -Wall -Wpointer-arith" ;;
376 esac
377
378 AC_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.
383 LIBLOBJS="`echo ${LIBOBJS} | sed 's/\.o/.lo/g'`"
384
385 AC_SUBST(GUILE_MAJOR_VERSION)
386 AC_SUBST(GUILE_MINOR_VERSION)
387 AC_SUBST(GUILE_VERSION)
388 GUILE_LIBS="$LDFLAGS $THREAD_LIBS $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
406 dnl ======================================================================
407 dnl configuration for the Qt package
408 dnl ======================================================================
409
410 threads_enabled=false
411 if test "$cy_cv_threads_package" = COOP; then
412 threads_enabled=true
413 fi
414
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.
418
419 qtsrcdir="`(cd $srcdir; pwd)`/qt"
420
421 changequote(,)dnl We use [ and ] in a regexp in the case
422 case "$host" in
423 i[3456]86-*-*)
424 qtmds_s=$qtsrcdir/md/i386.s
425 qtmd_h=md/i386.h
426 qtmdc_c=$qtsrcdir/md/null.c
427 ;;
428 mips-sgi-irix[56]*)
429 qtmds_s=$qtsrcdir/md/mips-irix5.s
430 qtmd_h=md/mips.h
431 qtmdc_c=$qtsrcdir/md/null.c
432 qtdmdb_s=$qtsrcdir/md/mips_b.s
433 ;;
434 mips-*-*)
435 qtmds_s=$qtsrcdir/md/mips.s
436 qtmd_h=md/mips.h
437 qtmdc_c=$qtsrcdir/md/null.c
438 qtdmdb_s=$qtsrcdir/md/mips_b.s
439 ;;
440 sparc-*-sunos*)
441 qtmd_h=md/sparc.h
442 qtmdc_c=$qtsrcdir/md/null.c
443 qtmds_s=$qtsrcdir/md/_sparc.s
444 qtdmdb_s=$qtsrcdir/md/_sparc_b.s
445 ;;
446 sparc-*-*)
447 qtmd_h=md/sparc.h
448 qtmdc_c=$qtsrcdir/md/null.c
449 qtmds_s=$qtsrcdir/md/sparc.s
450 qtdmdb_s=$qtsrcdir/md/sparc_b.s
451 ;;
452 alpha-*-*)
453 qtmd_h=md/axp.h
454 qtmdc_c=$qtsrcdir/md/null.c
455 qtmds_s=$qtsrcdir/md/axp.s
456 qtdmdb_s=$qtsrcdir/md/axp_b.s
457 ;;
458 *)
459 echo "Unknown configuration; threads package disabled"
460 threads_enabled=false
461 ;;
462 esac
463 changequote([, ])
464
465
466 if $threads_enabled; then
467 target_libs=libqthreads.a
468 else
469 target_libs=
470 fi
471
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:'`"
476
477 AC_SUBST(target_libs)
478 AC_SUBST(qtmd_h)
479 AC_SUBST(qtmdc_c)
480 AC_SUBST(qtmdc_o)
481 AC_SUBST(qtmds_s)
482 AC_SUBST(qtmds_o)
483 AC_SUBST(qtmdb_s)
484
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])
486
487 dnl Local Variables:
488 dnl comment-start: "dnl "
489 dnl comment-end: ""
490 dnl comment-start-skip: "\\bdnl\\b\\s *"
491 dnl End: