1 dnl Process this file with autoconf to produce configure.
3 . $srcdir/GUILE-VERSION
4 AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
6 AM_CONFIG_HEADER(libguile/scmconfig.h)
8 #--------------------------------------------------------------------
12 #--------------------------------------------------------------------
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"
22 AC_ARG_ENABLE(dynamic-linking,
23 [ --enable-dynamic-linking Include support for dynamic linking],,
24 enable_dynamic_linking=yes)
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)
32 #--------------------------------------------------------------------
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
56 AC_CHECK_FUNC(gethostbyname)
57 if test $ac_cv_func_gethostbyname = no; then
58 AC_CHECK_LIB(nsl, gethostbyname)
60 AC_CHECK_FUNC(connect)
61 if test $ac_cv_func_connect = no; then
62 AC_CHECK_LIB(socket, connect)
64 AC_CHECK_LIB(termcap, tgoto)
65 AC_CHECK_LIB(readline, readline)
67 # Checks for dynamic linking
69 if test "$enable_dynamic_linking" = "yes"; then
71 AC_CHECK_LIB(dl,dlopen)
72 if test "$ac_cv_lib_dl_dlopen" = "yes"; then
73 AC_DEFINE(DYNAMIC_LINKING)
75 AC_CHECK_LIB(dld,dld_link)
76 if test "$ac_cv_lib_dld_dld_link" = "yes"; then
77 AC_DEFINE(DYNAMIC_LINKING)
79 AC_CHECK_FUNCS(shl_load)
80 if test "$ac_cv_func_shl_load" = "yes"; then
81 AC_DEFINE(DYNAMIC_LINKING)
83 AC_CHECK_FUNCS(dlopen)
84 if test "$ac_cv_func_dlopen" = "yes"; then
85 AC_DEFINE(DYNAMIC_LINKING)
95 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)
99 AC_CHECK_HEADER(sys/un.h, have_sys_un_h=1)
100 if test -n "$have_sys_un_h" ; then
101 AC_DEFINE(HAVE_UNIX_DOMAIN_SOCKETS)
104 AC_CHECK_FUNCS(socketpair getgroups setpwent pause tzset)
106 dnl I don't know what this prefixing of cygwin32_ is for.
107 dnl scmconfig.h wasn't updated with the test results.
108 dnl so use AC_CHECK_FUNCS for now.
112 dnl if test $ac_cv_cigwin = yes; then
113 dnl modify confdefs.h
115 dnl AC_CHECK_FUNCS...
116 dnl restore confdefs.h
118 dnl cp confdefs.h confdefs.h.bak
119 dnl for func in sethostent endhostent getnetent setnetent endnetent getprotoent endprotoent getservent endservent getnetbyaddr getnetbyname inet_lnaof inet_makeaddr inet_netof ; do
120 dnl cp confdefs.h.bak confdefs.h
121 dnl cat >> confdefs.h << EOF
122 dnl #ifdef __CYGWIN32__
123 dnl #define $func cygwin32_$func
126 dnl AC_CHECK_FUNC($func)
128 dnl cp confdefs.h.bak confdefs.h
130 AC_CHECK_FUNCS(sethostent endhostent getnetent setnetent endnetent getprotoent endprotoent getservent endservent getnetbyaddr getnetbyname inet_lnaof inet_makeaddr inet_netof)
132 dnl </GNU-WIN32 hacks>
134 AC_CACHE_CHECK([for restartable system calls], scm_cv_restarts,
135 if test $ac_cv_func_sigaction = yes; then
136 [AC_TRY_COMPILE([#include <signal.h>],
137 [int a = SA_RESTART],
143 if test $scm_cv_restarts = yes; then
144 AC_DEFINE(HAVE_RESTARTS)
147 if test "$ac_cv_header_regex_h" = yes ||
148 test "$ac_cv_header_rxposix_h" = yes ||
149 test "$ac_cv_header_rx_rxposix_h" = yes; then
150 GUILE_NAMED_CHECK_FUNC(regcomp, norx, [LIBOBJS="regex-posix.o $LIBOBJS"],
151 [AC_CHECK_LIB(rx, main)
152 GUILE_NAMED_CHECK_FUNC(regcomp, rx, [LIBOBJS="regex-posix.o $LIBOBJS"])]
154 dnl The following should not be necessary, but for some reason
155 dnl autoheader misses it if we don't include it!
156 if test "$ac_cv_func_regcomp_norx" = yes ||
157 test "$ac_cv_func_regcomp_rx" = yes; then
158 AC_DEFINE(HAVE_REGCOMP)
162 AC_REPLACE_FUNCS(inet_aton putenv strerror)
164 # When testing for the presence of alloca, we need to add alloca.o
165 # explicitly to LIBOBJS to make sure that it is translated to
166 # `alloca.lo' for libtool later on. This can and should be done more cleanly.
168 if test "$ALLOCA" = "alloca.o"; then LIBOBJS="alloca.o $LIBOBJS"; fi
173 # We could use AC_STRUCT_ST_BLOCKS here, but that adds fileblocks.o to
174 # LIBOBJS, which we don't need. This seems more direct.
175 AC_CACHE_CHECK([for st_blocks in struct stat], ac_cv_struct_st_blocks,
176 [AC_TRY_COMPILE([#include <sys/types.h>
177 #include <sys/stat.h>], [struct stat s; s.st_blocks;],
178 ac_cv_struct_st_blocks=yes, ac_cv_struct_st_blocks=no)])
179 if test $ac_cv_struct_st_blocks = yes; then
180 AC_DEFINE(HAVE_ST_BLOCKS)
186 #--------------------------------------------------------------------
188 # Which way does the stack grow?
190 #--------------------------------------------------------------------
192 AC_TRY_RUN(aux (l) unsigned long l;
193 { int x; exit (l >= ((unsigned long)&x)); }
194 main () { int q; aux((unsigned long)&q); },
195 AC_DEFINE(SCM_STACK_GROWS_UP),,AC_MSG_WARN(Guessing that stack grows down -- see scmconfig.h.in))
198 AC_TRY_RUN(main () { exit (sizeof(float) != sizeof(long)); },
199 AC_DEFINE(SCM_SINGLES),,AC_DEFINE(SCM_SINGLES)
200 AC_MSG_WARN(Guessing that sizeof(long) == sizeof(float) -- see scmconfig.h.in))
202 AC_MSG_CHECKING(for struct linger)
203 AC_CACHE_VAL(scm_cv_struct_linger,
205 #include <sys/types.h>
206 #include <sys/socket.h>],
207 [struct linger lgr; lgr.l_linger = 100],
208 scm_cv_struct_linger="yes",
209 scm_cv_struct_linger="no"))
210 AC_MSG_RESULT($scm_cv_struct_linger)
211 if test $scm_cv_struct_linger = yes; then
212 AC_DEFINE(HAVE_STRUCT_LINGER)
215 #--------------------------------------------------------------------
217 # How can you violate a stdio abstraction by setting a stream's fd?
219 #--------------------------------------------------------------------
221 AC_MSG_CHECKING(how to set a stream file descriptor)
222 AC_CACHE_VAL(scm_cv_fd_setter,
223 AC_TRY_COMPILE([#include <stdio.h>],
225 scm_cv_fd_setter="_file",
226 AC_TRY_COMPILE([#include <stdio.h>],
227 [stdout->_fileno = 1],
228 scm_cv_fd_setter="_fileno",
229 scm_cv_fd_setter="")))
231 if test "$scm_cv_fd_setter"; then
232 AC_MSG_RESULT($scm_cv_fd_setter)
233 AC_DEFINE_UNQUOTED(FD_SETTER, $scm_cv_fd_setter)
235 AC_MSG_RESULT(we couldn't do it!)
238 #--------------------------------------------------------------------
239 # How to find out whether a FILE structure contains buffered data.
240 # From Tk we have the following list:
241 # _cnt: Most UNIX systems
245 # Or, in GNU libc there are two fields, _gptr and _egptr, which
246 # have to be compared.
247 # These can also be known as _IO_read_ptr and _IO_read_end.
248 #--------------------------------------------------------------------
250 AC_MSG_CHECKING(how to get buffer char count from FILE structure)
251 AC_CACHE_VAL(scm_cv_struct_file_count,
252 AC_TRY_COMPILE([#include <stdio.h>],
253 [FILE *f = stdin; f->_cnt = 0],
254 scm_cv_struct_file_count="_cnt",
255 AC_TRY_COMPILE([#include <stdio.h>],
256 [FILE *f = stdin; f->_r = 0],
257 scm_cv_struct_file_count="_r",
258 AC_TRY_COMPILE([#include <stdio.h>],
259 [FILE *f = stdin; f->readCount = 0],
260 scm_cv_struct_file_count="readCount",
261 scm_cv_struct_file_count=""))))
262 if test "$scm_cv_struct_file_count"; then
263 AC_MSG_RESULT($scm_cv_struct_file_count)
264 AC_DEFINE_UNQUOTED(FILE_CNT_FIELD, $scm_cv_struct_file_count)
266 AC_CACHE_VAL(scm_cv_struct_file_gptr,
267 AC_TRY_COMPILE([#include <stdio.h>],
268 [FILE *f = stdin; f->_gptr = f->egptr;],
269 scm_cv_struct_file_gptr=1,
270 scm_cv_struct_file_gptr=""))
271 if test "$scm_cv_struct_gptr"; then
273 AC_DEFINE_UNQUOTED(FILE_CNT_GPTR, $scm_cv_struct_file_gptr)
275 AC_CACHE_VAL(scm_cv_struct_file_readptr,
276 AC_TRY_COMPILE([#include <stdio.h>],
277 [FILE *f = stdin; f->_IO_read_ptr = f->_IO_read_end;],
278 scm_cv_struct_file_readptr=1))
279 if test "$scm_cv_struct_file_readptr"; then
280 AC_MSG_RESULT(read_ptr)
281 AC_DEFINE_UNQUOTED(FILE_CNT_READPTR, $scm_cv_struct_file_readptr)
283 AC_MSG_RESULT(we couldn't do it!)
288 #--------------------------------------------------------------------
290 # Flags for thread support
292 #--------------------------------------------------------------------
295 CFLAGS="$CFLAGS $cy_cv_threads_cflags"
296 THREAD_LIBS="$cy_cv_threads_libs"
297 AC_SUBST(THREAD_LIBS)
300 dnl Set the appropriate flags!
302 if test "$cy_cv_threads_package" = FSU; then
303 AC_DEFINE(USE_FSU_PTHREADS, 1)
304 else if test "$cy_cv_threads_package" = COOP; then
305 AC_DEFINE(USE_COOP_THREADS, 1)
306 else if test "$cy_cv_threads_package" = MIT; then
307 AC_DEFINE(USE_MIT_PTHREADS, 1)
308 else if test "$cy_cv_threads_package" = PCthreads; then
309 AC_DEFINE(USE_PCTHREADS_PTHREADS, 1)
310 else if test "$cy_cv_threads_package" = unknown; then
311 AC_MSG_ERROR("cannot find threads installation")
318 if test "$cy_cv_threads_package" != ""; then
319 AC_DEFINE(USE_THREADS)
320 LIBOBJS="$LIBOBJS threads.o"
323 ## If we're using GCC, ask for aggressive warnings.
325 yes ) CFLAGS="$CFLAGS -Wall -Wpointer-arith" ;;
330 ## If we're creating a shared library (using libtool!), then we'll
331 ## need to generate a list of .lo files corresponding to the .o files
332 ## given in LIBOBJS. We'll call it LIBLOBJS.
333 LIBLOBJS="`echo ${LIBOBJS} | sed 's/\.o/.lo/g'`"
335 AC_SUBST(GUILE_MAJOR_VERSION)
336 AC_SUBST(GUILE_MINOR_VERSION)
337 AC_SUBST(GUILE_VERSION)
339 dnl timestamping the interpreter and scheme libraries:
341 dnl Help us notice when we're running one version of the Guile
342 dnl interpreter against a different version of the ice-9 Scheme code.
343 dnl This will definitely detect version skew due to differing
344 dnl snapshots and releases, but may not catch skew for the developers.
345 dnl Hopefully it will not detect skew when there is none; if that
346 dnl happens, the warnings will be useless, and we should remove this.
348 AC_SUBST(GUILE_STAMP)
354 dnl ======================================================================
355 dnl configuration for the Qt package
356 dnl ======================================================================
358 threads_enabled=false
359 if test "$cy_cv_threads_package" = COOP; then
363 # Determine the host we are working on
366 # How can we refer to the qt source directory from within the qt build
367 # directory? For headers, we can rely on the fact that the qt src
368 # directory appears in the #include path.
370 qtsrcdir="`(cd $srcdir; pwd)`/qt"
372 changequote(,)dnl We use [ and ] in a regexp in the case
375 qtmds_s=$qtsrcdir/md/i386.s
377 qtmdc_c=$qtsrcdir/md/null.c
380 qtmds_s=$qtsrcdir/md/mips-irix5.s
382 qtmdc_c=$qtsrcdir/md/null.c
383 qtdmdb_s=$qtsrcdir/md/mips_b.s
386 qtmds_s=$qtsrcdir/md/mips.s
388 qtmdc_c=$qtsrcdir/md/null.c
389 qtdmdb_s=$qtsrcdir/md/mips_b.s
393 qtmdc_c=$qtsrcdir/md/null.c
394 qtmds_s=$qtsrcdir/md/_sparc.s
395 qtdmdb_s=$qtsrcdir/md/_sparc_b.s
399 qtmdc_c=$qtsrcdir/md/null.c
400 qtmds_s=$qtsrcdir/md/sparc.s
401 qtdmdb_s=$qtsrcdir/md/sparc_b.s
405 qtmdc_c=$qtsrcdir/md/null.c
406 qtmds_s=$qtsrcdir/md/axp.s
407 qtdmdb_s=$qtsrcdir/md/axp_b.s
410 echo "Unknown configuration; threads package disabled"
411 threads_enabled=false
417 if $threads_enabled; then
418 target_libs=libqthreads.a
423 # Give the Makefile the names of the object files that will be
424 # generated by compiling $qtmdc_c and $qtmds_s.
425 qtmdc_o="`echo ${qtmdc_c} | sed -e 's:^.*/::' | sed -e 's:\.c$:\.o:'`"
426 qtmds_o="`echo ${qtmds_s} | sed -e 's:^.*/::' | sed -e 's:\.s$:\.o:'`"
428 AC_SUBST(target_libs)
436 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])
439 dnl comment-start: "dnl "
441 dnl comment-start-skip: "\\bdnl\\b\\s *"