* configure.in: Replaced some AC_CHECK_FUNC --> AC_CHECK_FUNCS 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
67 # Checks for dynamic linking
68
69 if test "$enable_dynamic_linking" = "yes"; then
70
71 AC_CHECK_LIB(dl,dlopen)
72 if test "$ac_cv_lib_dl_dlopen" = "yes"; then
73 AC_CHECK_FUNCS(dlopen)
74 AC_DEFINE(DYNAMIC_LINKING)
75 else
76 AC_CHECK_LIB(dld,dld_link)
77 if test "$ac_cv_lib_dld_dld_link" = "yes"; then
78 AC_DEFINE(DYNAMIC_LINKING)
79 else
80 AC_CHECK_FUNCS(shl_load)
81 if test "$ac_cv_func_shl_load" = "yes"; then
82 AC_DEFINE(DYNAMIC_LINKING)
83 else
84 AC_CHECK_FUNCS(dlopen)
85 if test "$ac_cv_func_dlopen" = "yes"; then
86 AC_DEFINE(DYNAMIC_LINKING)
87 fi
88 fi
89 fi
90 fi
91
92 fi
93
94 GUILE_DLSYM_USCORE
95
96 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 system usleep)
97
98 # Determine the host we are working on
99 AC_CANONICAL_HOST
100
101 # Some operating systems don't declare all functions
102 case "$host_os" in
103 solaris2.5*)
104 AC_DEFINE(DECLARE_BZERO)
105 AC_DEFINE(DECLARE_USLEEP)
106 ;;
107 esac
108
109 # On some systems usleep have no return value
110 AC_EGREP_HEADER(changequote(<, >)<void[ ][ ]*usleep>changequote([, ]),
111 /usr/include/unistd.h,
112 AC_DEFINE(USLEEP_RETURNS_VOID)
113 )
114
115
116 dnl <GNU-WIN32 hacks>
117
118 AC_CHECK_HEADER(sys/un.h, have_sys_un_h=1)
119 if test -n "$have_sys_un_h" ; then
120 AC_DEFINE(HAVE_UNIX_DOMAIN_SOCKETS)
121 fi
122
123 AC_CHECK_FUNCS(socketpair getgroups setpwent pause tzset)
124
125 dnl I don't know what this prefixing of cygwin32_ is for.
126 dnl scmconfig.h wasn't updated with the test results.
127 dnl so use AC_CHECK_FUNCS for now.
128
129 dnl how about:
130 dnl save confdefs.h
131 dnl if test $ac_cv_cigwin = yes; then
132 dnl modify confdefs.h
133 dnl fi
134 dnl AC_CHECK_FUNCS...
135 dnl restore confdefs.h
136
137 dnl cp confdefs.h confdefs.h.bak
138 dnl for func in sethostent endhostent getnetent setnetent endnetent getprotoent endprotoent getservent endservent getnetbyaddr getnetbyname inet_lnaof inet_makeaddr inet_netof ; do
139 dnl cp confdefs.h.bak confdefs.h
140 dnl cat >> confdefs.h << EOF
141 dnl #ifdef __CYGWIN32__
142 dnl #define $func cygwin32_$func
143 dnl #endif
144 dnl EOF
145 dnl AC_CHECK_FUNC($func)
146 dnl done
147 dnl cp confdefs.h.bak confdefs.h
148
149 AC_CHECK_FUNCS(sethostent endhostent getnetent setnetent endnetent getprotoent endprotoent getservent endservent getnetbyaddr getnetbyname inet_lnaof inet_makeaddr inet_netof)
150
151 dnl </GNU-WIN32 hacks>
152
153 AC_CACHE_CHECK([for restartable system calls], scm_cv_restarts,
154 if test $ac_cv_func_sigaction = yes; then
155 [AC_TRY_COMPILE([#include <signal.h>],
156 [int a = SA_RESTART],
157 scm_cv_restarts=yes,
158 scm_cv_restarts=no)]
159 else
160 scm_cv_restarts=no
161 fi)
162 if test $scm_cv_restarts = yes; then
163 AC_DEFINE(HAVE_RESTARTS)
164 fi
165
166 if test "$ac_cv_header_regex_h" = yes ||
167 test "$ac_cv_header_rxposix_h" = yes ||
168 test "$ac_cv_header_rx_rxposix_h" = yes; then
169 GUILE_NAMED_CHECK_FUNC(regcomp, norx, [LIBOBJS="regex-posix.o $LIBOBJS"],
170 [AC_CHECK_LIB(rx, main)
171 GUILE_NAMED_CHECK_FUNC(regcomp, rx, [LIBOBJS="regex-posix.o $LIBOBJS"])]
172 )
173 dnl The following should not be necessary, but for some reason
174 dnl autoheader misses it if we don't include it!
175 if test "$ac_cv_func_regcomp_norx" = yes ||
176 test "$ac_cv_func_regcomp_rx" = yes; then
177 AC_DEFINE(HAVE_REGCOMP)
178 fi
179 fi
180
181 AC_REPLACE_FUNCS(inet_aton putenv strerror)
182
183 # When testing for the presence of alloca, we need to add alloca.o
184 # explicitly to LIBOBJS to make sure that it is translated to
185 # `alloca.lo' for libtool later on. This can and should be done more cleanly.
186 AC_FUNC_ALLOCA
187 if test "$ALLOCA" = "alloca.o"; then LIBOBJS="alloca.o $LIBOBJS"; fi
188
189 AC_STRUCT_ST_RDEV
190 AC_STRUCT_ST_BLKSIZE
191
192 # We could use AC_STRUCT_ST_BLOCKS here, but that adds fileblocks.o to
193 # LIBOBJS, which we don't need. This seems more direct.
194 AC_CACHE_CHECK([for st_blocks in struct stat], ac_cv_struct_st_blocks,
195 [AC_TRY_COMPILE([#include <sys/types.h>
196 #include <sys/stat.h>], [struct stat s; s.st_blocks;],
197 ac_cv_struct_st_blocks=yes, ac_cv_struct_st_blocks=no)])
198 if test $ac_cv_struct_st_blocks = yes; then
199 AC_DEFINE(HAVE_ST_BLOCKS)
200 fi
201
202 AC_STRUCT_TIMEZONE
203 GUILE_STRUCT_UTIMBUF
204
205 #--------------------------------------------------------------------
206 #
207 # Which way does the stack grow?
208 #
209 #--------------------------------------------------------------------
210
211 AC_TRY_RUN(aux (l) unsigned long l;
212 { int x; exit (l >= ((unsigned long)&x)); }
213 main () { int q; aux((unsigned long)&q); },
214 AC_DEFINE(SCM_STACK_GROWS_UP),,AC_MSG_WARN(Guessing that stack grows down -- see scmconfig.h.in))
215
216
217 AC_TRY_RUN(main () { exit (sizeof(float) != sizeof(long)); },
218 AC_DEFINE(SCM_SINGLES),,AC_DEFINE(SCM_SINGLES)
219 AC_MSG_WARN(Guessing that sizeof(long) == sizeof(float) -- see scmconfig.h.in))
220
221 AC_MSG_CHECKING(for struct linger)
222 AC_CACHE_VAL(scm_cv_struct_linger,
223 AC_TRY_COMPILE([
224 #include <sys/types.h>
225 #include <sys/socket.h>],
226 [struct linger lgr; lgr.l_linger = 100],
227 scm_cv_struct_linger="yes",
228 scm_cv_struct_linger="no"))
229 AC_MSG_RESULT($scm_cv_struct_linger)
230 if test $scm_cv_struct_linger = yes; then
231 AC_DEFINE(HAVE_STRUCT_LINGER)
232 fi
233
234 #--------------------------------------------------------------------
235 #
236 # How can you violate a stdio abstraction by setting a stream's fd?
237 #
238 #--------------------------------------------------------------------
239
240 AC_MSG_CHECKING(how to set a stream file descriptor)
241 AC_CACHE_VAL(scm_cv_fd_setter,
242 AC_TRY_COMPILE([#include <stdio.h>],
243 [stdout->_file = 1],
244 scm_cv_fd_setter="_file",
245 AC_TRY_COMPILE([#include <stdio.h>],
246 [stdout->_fileno = 1],
247 scm_cv_fd_setter="_fileno",
248 scm_cv_fd_setter="")))
249
250 if test "$scm_cv_fd_setter"; then
251 AC_MSG_RESULT($scm_cv_fd_setter)
252 AC_DEFINE_UNQUOTED(FD_SETTER, $scm_cv_fd_setter)
253 else
254 AC_MSG_RESULT(we couldn't do it!)
255 fi
256
257 #--------------------------------------------------------------------
258 # How to find out whether a FILE structure contains buffered data.
259 # From Tk we have the following list:
260 # _cnt: Most UNIX systems
261 # __cnt: HPUX
262 # _r: BSD
263 # readCount: Sprite
264 # Or, in GNU libc there are two fields, _gptr and _egptr, which
265 # have to be compared.
266 # These can also be known as _IO_read_ptr and _IO_read_end.
267 #--------------------------------------------------------------------
268
269 AC_MSG_CHECKING(how to get buffer char count from FILE structure)
270 AC_CACHE_VAL(scm_cv_struct_file_count,
271 AC_TRY_COMPILE([#include <stdio.h>],
272 [FILE *f = stdin; f->_cnt = 0],
273 scm_cv_struct_file_count="_cnt",
274 AC_TRY_COMPILE([#include <stdio.h>],
275 [FILE *f = stdin; f->_r = 0],
276 scm_cv_struct_file_count="_r",
277 AC_TRY_COMPILE([#include <stdio.h>],
278 [FILE *f = stdin; f->readCount = 0],
279 scm_cv_struct_file_count="readCount",
280 scm_cv_struct_file_count=""))))
281 if test "$scm_cv_struct_file_count"; then
282 AC_MSG_RESULT($scm_cv_struct_file_count)
283 AC_DEFINE_UNQUOTED(FILE_CNT_FIELD, $scm_cv_struct_file_count)
284 else
285 AC_CACHE_VAL(scm_cv_struct_file_gptr,
286 AC_TRY_COMPILE([#include <stdio.h>],
287 [FILE *f = stdin; f->_gptr = f->egptr;],
288 scm_cv_struct_file_gptr=1,
289 scm_cv_struct_file_gptr=""))
290 if test "$scm_cv_struct_gptr"; then
291 AC_MSG_RESULT(gptr)
292 AC_DEFINE_UNQUOTED(FILE_CNT_GPTR, $scm_cv_struct_file_gptr)
293 else
294 AC_CACHE_VAL(scm_cv_struct_file_readptr,
295 AC_TRY_COMPILE([#include <stdio.h>],
296 [FILE *f = stdin; f->_IO_read_ptr = f->_IO_read_end;],
297 scm_cv_struct_file_readptr=1))
298 if test "$scm_cv_struct_file_readptr"; then
299 AC_MSG_RESULT(read_ptr)
300 AC_DEFINE_UNQUOTED(FILE_CNT_READPTR, $scm_cv_struct_file_readptr)
301 else
302 AC_MSG_RESULT(we couldn't do it!)
303 fi
304 fi
305 fi
306
307 #--------------------------------------------------------------------
308 #
309 # Flags for thread support
310 #
311 #--------------------------------------------------------------------
312
313 CY_AC_WITH_THREADS
314 CFLAGS="$CFLAGS $cy_cv_threads_cflags"
315 THREAD_LIBS="$cy_cv_threads_libs"
316 AC_SUBST(THREAD_LIBS)
317
318 dnl
319 dnl Set the appropriate flags!
320 dnl
321 if test "$cy_cv_threads_package" = FSU; then
322 AC_DEFINE(USE_FSU_PTHREADS, 1)
323 else if test "$cy_cv_threads_package" = COOP; then
324 AC_DEFINE(USE_COOP_THREADS, 1)
325 else if test "$cy_cv_threads_package" = MIT; then
326 AC_DEFINE(USE_MIT_PTHREADS, 1)
327 else if test "$cy_cv_threads_package" = PCthreads; then
328 AC_DEFINE(USE_PCTHREADS_PTHREADS, 1)
329 else if test "$cy_cv_threads_package" = unknown; then
330 AC_MSG_ERROR("cannot find threads installation")
331 fi
332 fi
333 fi
334 fi
335 fi
336
337 if test "$cy_cv_threads_package" != ""; then
338 AC_DEFINE(USE_THREADS)
339 LIBOBJS="$LIBOBJS threads.o"
340 fi
341
342 #--------------------------------------------------------------------
343 #
344 # scm_internal_select
345 #
346 #--------------------------------------------------------------------
347
348 if test "$cy_cv_threads_package" != "" &&
349 test $ac_cv_func_gettimeofday = yes &&
350 test $ac_cv_func_select = yes; then
351 AC_DEFINE(GUILE_ISELECT, 1)
352 LIBOBJS="$LIBOBJS iselect.o"
353 fi
354
355 ## If we're using GCC, ask for aggressive warnings.
356 case "$GCC" in
357 yes ) CFLAGS="$CFLAGS -Wall -Wpointer-arith" ;;
358 esac
359
360 AC_PROG_AWK
361
362 ## If we're creating a shared library (using libtool!), then we'll
363 ## need to generate a list of .lo files corresponding to the .o files
364 ## given in LIBOBJS. We'll call it LIBLOBJS.
365 LIBLOBJS="`echo ${LIBOBJS} | sed 's/\.o/.lo/g'`"
366
367 AC_SUBST(GUILE_MAJOR_VERSION)
368 AC_SUBST(GUILE_MINOR_VERSION)
369 AC_SUBST(GUILE_VERSION)
370 GUILE_LIBS="$LDFLAGS $THREAD_LIBS $LIBS"
371 AC_SUBST(GUILE_LIBS)
372
373 dnl timestamping the interpreter and scheme libraries:
374 dnl
375 dnl Help us notice when we're running one version of the Guile
376 dnl interpreter against a different version of the ice-9 Scheme code.
377 dnl This will definitely detect version skew due to differing
378 dnl snapshots and releases, but may not catch skew for the developers.
379 dnl Hopefully it will not detect skew when there is none; if that
380 dnl happens, the warnings will be useless, and we should remove this.
381 GUILE_STAMP="`date`"
382 AC_SUBST(GUILE_STAMP)
383
384 AC_SUBST(AWK)
385 AC_SUBST(LIBLOBJS)
386
387
388 dnl ======================================================================
389 dnl configuration for the Qt package
390 dnl ======================================================================
391
392 threads_enabled=false
393 if test "$cy_cv_threads_package" = COOP; then
394 threads_enabled=true
395 fi
396
397 # How can we refer to the qt source directory from within the qt build
398 # directory? For headers, we can rely on the fact that the qt src
399 # directory appears in the #include path.
400
401 qtsrcdir="`(cd $srcdir; pwd)`/qt"
402
403 changequote(,)dnl We use [ and ] in a regexp in the case
404 case "$host" in
405 i[3456]86-*-*)
406 qtmds_s=$qtsrcdir/md/i386.s
407 qtmd_h=md/i386.h
408 qtmdc_c=$qtsrcdir/md/null.c
409 ;;
410 mips-sgi-irix[56]*)
411 qtmds_s=$qtsrcdir/md/mips-irix5.s
412 qtmd_h=md/mips.h
413 qtmdc_c=$qtsrcdir/md/null.c
414 qtdmdb_s=$qtsrcdir/md/mips_b.s
415 ;;
416 mips-*-*)
417 qtmds_s=$qtsrcdir/md/mips.s
418 qtmd_h=md/mips.h
419 qtmdc_c=$qtsrcdir/md/null.c
420 qtdmdb_s=$qtsrcdir/md/mips_b.s
421 ;;
422 sparc-*-sunos*)
423 qtmd_h=md/sparc.h
424 qtmdc_c=$qtsrcdir/md/null.c
425 qtmds_s=$qtsrcdir/md/_sparc.s
426 qtdmdb_s=$qtsrcdir/md/_sparc_b.s
427 ;;
428 sparc-*-*)
429 qtmd_h=md/sparc.h
430 qtmdc_c=$qtsrcdir/md/null.c
431 qtmds_s=$qtsrcdir/md/sparc.s
432 qtdmdb_s=$qtsrcdir/md/sparc_b.s
433 ;;
434 alpha-*-*)
435 qtmd_h=md/axp.h
436 qtmdc_c=$qtsrcdir/md/null.c
437 qtmds_s=$qtsrcdir/md/axp.s
438 qtdmdb_s=$qtsrcdir/md/axp_b.s
439 ;;
440 *)
441 echo "Unknown configuration; threads package disabled"
442 threads_enabled=false
443 ;;
444 esac
445 changequote([, ])
446
447
448 if $threads_enabled; then
449 target_libs=libqthreads.a
450 else
451 target_libs=
452 fi
453
454 # Give the Makefile the names of the object files that will be
455 # generated by compiling $qtmdc_c and $qtmds_s.
456 qtmdc_o="`echo ${qtmdc_c} | sed -e 's:^.*/::' | sed -e 's:\.c$:\.o:'`"
457 qtmds_o="`echo ${qtmds_s} | sed -e 's:^.*/::' | sed -e 's:\.s$:\.o:'`"
458
459 AC_SUBST(target_libs)
460 AC_SUBST(qtmd_h)
461 AC_SUBST(qtmdc_c)
462 AC_SUBST(qtmdc_o)
463 AC_SUBST(qtmds_s)
464 AC_SUBST(qtmds_o)
465 AC_SUBST(qtmdb_s)
466
467 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])
468
469 dnl Local Variables:
470 dnl comment-start: "dnl "
471 dnl comment-end: ""
472 dnl comment-start-skip: "\\bdnl\\b\\s *"
473 dnl End: