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(HAVE_DLOPEN)
74 AC_DEFINE(DYNAMIC_LINKING)
76 AC_CHECK_LIB(dld,dld_link)
77 if test "$ac_cv_lib_dld_dld_link" = "yes"; then
78 AC_DEFINE(DYNAMIC_LINKING)
80 AC_CHECK_FUNCS(shl_load)
81 if test "$ac_cv_func_shl_load" = "yes"; then
82 AC_DEFINE(DYNAMIC_LINKING)
84 AC_CHECK_FUNCS(dlopen)
85 if test "$ac_cv_func_dlopen" = "yes"; then
86 AC_DEFINE(DYNAMIC_LINKING)
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)
100 AC_CHECK_HEADER(sys/un.h, have_sys_un_h=1)
101 if test -n "$have_sys_un_h" ; then
102 AC_DEFINE(HAVE_UNIX_DOMAIN_SOCKETS)
105 AC_CHECK_FUNCS(socketpair getgroups setpwent pause tzset)
107 dnl I don't know what this prefixing of cygwin32_ is for.
108 dnl scmconfig.h wasn't updated with the test results.
109 dnl so use AC_CHECK_FUNCS for now.
113 dnl if test $ac_cv_cigwin = yes; then
114 dnl modify confdefs.h
116 dnl AC_CHECK_FUNCS...
117 dnl restore confdefs.h
119 dnl cp confdefs.h confdefs.h.bak
120 dnl for func in sethostent endhostent getnetent setnetent endnetent getprotoent endprotoent getservent endservent getnetbyaddr getnetbyname inet_lnaof inet_makeaddr inet_netof ; do
121 dnl cp confdefs.h.bak confdefs.h
122 dnl cat >> confdefs.h << EOF
123 dnl #ifdef __CYGWIN32__
124 dnl #define $func cygwin32_$func
127 dnl AC_CHECK_FUNC($func)
129 dnl cp confdefs.h.bak confdefs.h
131 AC_CHECK_FUNCS(sethostent endhostent getnetent setnetent endnetent getprotoent endprotoent getservent endservent getnetbyaddr getnetbyname inet_lnaof inet_makeaddr inet_netof)
133 dnl </GNU-WIN32 hacks>
135 AC_CACHE_CHECK([for restartable system calls], scm_cv_restarts,
136 if test $ac_cv_func_sigaction = yes; then
137 [AC_TRY_COMPILE([#include <signal.h>],
138 [int a = SA_RESTART],
144 if test $scm_cv_restarts = yes; then
145 AC_DEFINE(HAVE_RESTARTS)
148 if test "$ac_cv_header_regex_h" = yes ||
149 test "$ac_cv_header_rxposix_h" = yes ||
150 test "$ac_cv_header_rx_rxposix_h" = yes; then
151 GUILE_NAMED_CHECK_FUNC(regcomp, norx, [LIBOBJS="regex-posix.o $LIBOBJS"],
152 [AC_CHECK_LIB(rx, main)
153 GUILE_NAMED_CHECK_FUNC(regcomp, rx, [LIBOBJS="regex-posix.o $LIBOBJS"])]
155 dnl The following should not be necessary, but for some reason
156 dnl autoheader misses it if we don't include it!
157 if test "$ac_cv_func_regcomp_norx" = yes ||
158 test "$ac_cv_func_regcomp_rx" = yes; then
159 AC_DEFINE(HAVE_REGCOMP)
163 AC_REPLACE_FUNCS(inet_aton putenv strerror)
165 # When testing for the presence of alloca, we need to add alloca.o
166 # explicitly to LIBOBJS to make sure that it is translated to
167 # `alloca.lo' for libtool later on. This can and should be done more cleanly.
169 if test "$ALLOCA" = "alloca.o"; then LIBOBJS="alloca.o $LIBOBJS"; fi
174 # We could use AC_STRUCT_ST_BLOCKS here, but that adds fileblocks.o to
175 # LIBOBJS, which we don't need. This seems more direct.
176 AC_CACHE_CHECK([for st_blocks in struct stat], ac_cv_struct_st_blocks,
177 [AC_TRY_COMPILE([#include <sys/types.h>
178 #include <sys/stat.h>], [struct stat s; s.st_blocks;],
179 ac_cv_struct_st_blocks=yes, ac_cv_struct_st_blocks=no)])
180 if test $ac_cv_struct_st_blocks = yes; then
181 AC_DEFINE(HAVE_ST_BLOCKS)
187 #--------------------------------------------------------------------
189 # Which way does the stack grow?
191 #--------------------------------------------------------------------
193 AC_TRY_RUN(aux (l) unsigned long l;
194 { int x; exit (l >= ((unsigned long)&x)); }
195 main () { int q; aux((unsigned long)&q); },
196 AC_DEFINE(SCM_STACK_GROWS_UP),,AC_MSG_WARN(Guessing that stack grows down -- see scmconfig.h.in))
199 AC_TRY_RUN(main () { exit (sizeof(float) != sizeof(long)); },
200 AC_DEFINE(SCM_SINGLES),,AC_DEFINE(SCM_SINGLES)
201 AC_MSG_WARN(Guessing that sizeof(long) == sizeof(float) -- see scmconfig.h.in))
203 AC_MSG_CHECKING(for struct linger)
204 AC_CACHE_VAL(scm_cv_struct_linger,
206 #include <sys/types.h>
207 #include <sys/socket.h>],
208 [struct linger lgr; lgr.l_linger = 100],
209 scm_cv_struct_linger="yes",
210 scm_cv_struct_linger="no"))
211 AC_MSG_RESULT($scm_cv_struct_linger)
212 if test $scm_cv_struct_linger = yes; then
213 AC_DEFINE(HAVE_STRUCT_LINGER)
216 #--------------------------------------------------------------------
218 # How can you violate a stdio abstraction by setting a stream's fd?
220 #--------------------------------------------------------------------
222 AC_MSG_CHECKING(how to set a stream file descriptor)
223 AC_CACHE_VAL(scm_cv_fd_setter,
224 AC_TRY_COMPILE([#include <stdio.h>],
226 scm_cv_fd_setter="_file",
227 AC_TRY_COMPILE([#include <stdio.h>],
228 [stdout->_fileno = 1],
229 scm_cv_fd_setter="_fileno",
230 scm_cv_fd_setter="")))
232 if test "$scm_cv_fd_setter"; then
233 AC_MSG_RESULT($scm_cv_fd_setter)
234 AC_DEFINE_UNQUOTED(FD_SETTER, $scm_cv_fd_setter)
236 AC_MSG_RESULT(we couldn't do it!)
239 #--------------------------------------------------------------------
240 # How to find out whether a FILE structure contains buffered data.
241 # From Tk we have the following list:
242 # _cnt: Most UNIX systems
246 # Or, in GNU libc there are two fields, _gptr and _egptr, which
247 # have to be compared.
248 # These can also be known as _IO_read_ptr and _IO_read_end.
249 #--------------------------------------------------------------------
251 AC_MSG_CHECKING(how to get buffer char count from FILE structure)
252 AC_CACHE_VAL(scm_cv_struct_file_count,
253 AC_TRY_COMPILE([#include <stdio.h>],
254 [FILE *f = stdin; f->_cnt = 0],
255 scm_cv_struct_file_count="_cnt",
256 AC_TRY_COMPILE([#include <stdio.h>],
257 [FILE *f = stdin; f->_r = 0],
258 scm_cv_struct_file_count="_r",
259 AC_TRY_COMPILE([#include <stdio.h>],
260 [FILE *f = stdin; f->readCount = 0],
261 scm_cv_struct_file_count="readCount",
262 scm_cv_struct_file_count=""))))
263 if test "$scm_cv_struct_file_count"; then
264 AC_MSG_RESULT($scm_cv_struct_file_count)
265 AC_DEFINE_UNQUOTED(FILE_CNT_FIELD, $scm_cv_struct_file_count)
267 AC_CACHE_VAL(scm_cv_struct_file_gptr,
268 AC_TRY_COMPILE([#include <stdio.h>],
269 [FILE *f = stdin; f->_gptr = f->egptr;],
270 scm_cv_struct_file_gptr=1,
271 scm_cv_struct_file_gptr=""))
272 if test "$scm_cv_struct_gptr"; then
274 AC_DEFINE_UNQUOTED(FILE_CNT_GPTR, $scm_cv_struct_file_gptr)
276 AC_CACHE_VAL(scm_cv_struct_file_readptr,
277 AC_TRY_COMPILE([#include <stdio.h>],
278 [FILE *f = stdin; f->_IO_read_ptr = f->_IO_read_end;],
279 scm_cv_struct_file_readptr=1))
280 if test "$scm_cv_struct_file_readptr"; then
281 AC_MSG_RESULT(read_ptr)
282 AC_DEFINE_UNQUOTED(FILE_CNT_READPTR, $scm_cv_struct_file_readptr)
284 AC_MSG_RESULT(we couldn't do it!)
289 #--------------------------------------------------------------------
291 # Flags for thread support
293 #--------------------------------------------------------------------
296 CFLAGS="$CFLAGS $cy_cv_threads_cflags"
297 THREAD_LIBS="$cy_cv_threads_libs"
298 AC_SUBST(THREAD_LIBS)
301 dnl Set the appropriate flags!
303 if test "$cy_cv_threads_package" = FSU; then
304 AC_DEFINE(USE_FSU_PTHREADS, 1)
305 else if test "$cy_cv_threads_package" = COOP; then
306 AC_DEFINE(USE_COOP_THREADS, 1)
307 else if test "$cy_cv_threads_package" = MIT; then
308 AC_DEFINE(USE_MIT_PTHREADS, 1)
309 else if test "$cy_cv_threads_package" = PCthreads; then
310 AC_DEFINE(USE_PCTHREADS_PTHREADS, 1)
311 else if test "$cy_cv_threads_package" = unknown; then
312 AC_MSG_ERROR("cannot find threads installation")
319 if test "$cy_cv_threads_package" != ""; then
320 AC_DEFINE(USE_THREADS)
321 LIBOBJS="$LIBOBJS threads.o"
324 #--------------------------------------------------------------------
326 # scm_internal_select
328 #--------------------------------------------------------------------
330 if test "$cy_cv_threads_package" != "" &&
331 test $ac_cv_func_gettimeofday = yes &&
332 test $ac_cv_func_select = yes; then
333 AC_DEFINE(GUILE_ISELECT, 1)
334 LIBOBJS="$LIBOBJS iselect.o"
337 ## If we're using GCC, ask for aggressive warnings.
339 yes ) CFLAGS="$CFLAGS -Wall -Wpointer-arith" ;;
344 ## If we're creating a shared library (using libtool!), then we'll
345 ## need to generate a list of .lo files corresponding to the .o files
346 ## given in LIBOBJS. We'll call it LIBLOBJS.
347 LIBLOBJS="`echo ${LIBOBJS} | sed 's/\.o/.lo/g'`"
349 AC_SUBST(GUILE_MAJOR_VERSION)
350 AC_SUBST(GUILE_MINOR_VERSION)
351 AC_SUBST(GUILE_VERSION)
352 GUILE_LIBS="$LDFLAGS $THREAD_LIBS $LIBS"
355 dnl timestamping the interpreter and scheme libraries:
357 dnl Help us notice when we're running one version of the Guile
358 dnl interpreter against a different version of the ice-9 Scheme code.
359 dnl This will definitely detect version skew due to differing
360 dnl snapshots and releases, but may not catch skew for the developers.
361 dnl Hopefully it will not detect skew when there is none; if that
362 dnl happens, the warnings will be useless, and we should remove this.
364 AC_SUBST(GUILE_STAMP)
370 dnl ======================================================================
371 dnl configuration for the Qt package
372 dnl ======================================================================
374 threads_enabled=false
375 if test "$cy_cv_threads_package" = COOP; then
379 # Determine the host we are working on
382 # How can we refer to the qt source directory from within the qt build
383 # directory? For headers, we can rely on the fact that the qt src
384 # directory appears in the #include path.
386 qtsrcdir="`(cd $srcdir; pwd)`/qt"
388 changequote(,)dnl We use [ and ] in a regexp in the case
391 qtmds_s=$qtsrcdir/md/i386.s
393 qtmdc_c=$qtsrcdir/md/null.c
396 qtmds_s=$qtsrcdir/md/mips-irix5.s
398 qtmdc_c=$qtsrcdir/md/null.c
399 qtdmdb_s=$qtsrcdir/md/mips_b.s
402 qtmds_s=$qtsrcdir/md/mips.s
404 qtmdc_c=$qtsrcdir/md/null.c
405 qtdmdb_s=$qtsrcdir/md/mips_b.s
409 qtmdc_c=$qtsrcdir/md/null.c
410 qtmds_s=$qtsrcdir/md/_sparc.s
411 qtdmdb_s=$qtsrcdir/md/_sparc_b.s
415 qtmdc_c=$qtsrcdir/md/null.c
416 qtmds_s=$qtsrcdir/md/sparc.s
417 qtdmdb_s=$qtsrcdir/md/sparc_b.s
421 qtmdc_c=$qtsrcdir/md/null.c
422 qtmds_s=$qtsrcdir/md/axp.s
423 qtdmdb_s=$qtsrcdir/md/axp_b.s
426 echo "Unknown configuration; threads package disabled"
427 threads_enabled=false
433 if $threads_enabled; then
434 target_libs=libqthreads.a
439 # Give the Makefile the names of the object files that will be
440 # generated by compiling $qtmdc_c and $qtmds_s.
441 qtmdc_o="`echo ${qtmdc_c} | sed -e 's:^.*/::' | sed -e 's:\.c$:\.o:'`"
442 qtmds_o="`echo ${qtmds_s} | sed -e 's:^.*/::' | sed -e 's:\.s$:\.o:'`"
444 AC_SUBST(target_libs)
452 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])
455 dnl comment-start: "dnl "
457 dnl comment-start-skip: "\\bdnl\\b\\s *"