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)
65 # Checks for dynamic linking
67 if test "$enable_dynamic_linking" = "yes"; then
69 AC_CHECK_LIB(dl,dlopen)
70 if test "$ac_cv_lib_dl_dlopen" = "yes"; then
71 AC_DEFINE(DYNAMIC_LINKING)
73 AC_CHECK_LIB(dld,dld_link)
74 if test "$ac_cv_lib_dld_dld_link" = "yes"; then
75 AC_DEFINE(DYNAMIC_LINKING)
77 AC_CHECK_FUNCS(shl_load)
78 if test "$ac_cv_func_shl_load" = "yes"; then
79 AC_DEFINE(DYNAMIC_LINKING)
87 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)
91 AC_CHECK_HEADER(sys/un.h, have_sys_un_h=1)
92 if test -n "$have_sys_un_h" ; then
93 AC_DEFINE(HAVE_UNIX_DOMAIN_SOCKETS)
96 AC_CHECK_FUNCS(socketpair getgroups setpwent pause tzset)
98 dnl I don't know what this prefixing of cygwin32_ is for.
99 dnl scmconfig.h wasn't updated with the test results.
100 dnl so use AC_CHECK_FUNCS for now.
104 dnl if test $ac_cv_cigwin = yes; then
105 dnl modify confdefs.h
107 dnl AC_CHECK_FUNCS...
108 dnl restore confdefs.h
110 dnl cp confdefs.h confdefs.h.bak
111 dnl for func in sethostent endhostent getnetent setnetent endnetent getprotoent endprotoent getservent endservent getnetbyaddr getnetbyname inet_lnaof inet_makeaddr inet_netof ; do
112 dnl cp confdefs.h.bak confdefs.h
113 dnl cat >> confdefs.h << EOF
114 dnl #ifdef __CYGWIN32__
115 dnl #define $func cygwin32_$func
118 dnl AC_CHECK_FUNC($func)
120 dnl cp confdefs.h.bak confdefs.h
122 AC_CHECK_FUNCS(sethostent endhostent getnetent setnetent endnetent getprotoent endprotoent getservent endservent getnetbyaddr getnetbyname inet_lnaof inet_makeaddr inet_netof)
124 dnl </GNU-WIN32 hacks>
126 AC_CACHE_CHECK([for restartable system calls], scm_cv_restarts,
127 if test $ac_cv_func_sigaction = yes; then
128 [AC_TRY_COMPILE([#include <signal.h>],
129 [int a = SA_RESTART],
135 if test $scm_cv_restarts = yes; then
136 AC_DEFINE(HAVE_RESTARTS)
139 if test "$ac_cv_header_regex_h" = yes ||
140 test "$ac_cv_header_rxposix_h" = yes ||
141 test "$ac_cv_header_rx_rxposix_h" = yes; then
142 GUILE_NAMED_CHECK_FUNC(regcomp, norx, [LIBOBJS="regex-posix.o $LIBOBJS"],
143 [AC_CHECK_LIB(rx, main)
144 GUILE_NAMED_CHECK_FUNC(regcomp, rx, [LIBOBJS="regex-posix.o $LIBOBJS"])]
146 dnl The following should not be necessary, but for some reason
147 dnl autoheader misses it if we don't include it!
148 if test "$ac_cv_func_regcomp_norx" = yes ||
149 test "$ac_cv_func_regcomp_rx" = yes; then
150 AC_DEFINE(HAVE_REGCOMP)
154 AC_REPLACE_FUNCS(inet_aton putenv strerror)
156 # When testing for the presence of alloca, we need to add alloca.o
157 # explicitly to LIBOBJS to make sure that it is translated to
158 # `alloca.lo' for libtool later on. This can and should be done more cleanly.
160 if test "$ALLOCA" = "alloca.o"; then LIBOBJS="alloca.o $LIBOBJS"; fi
165 # We could use AC_STRUCT_ST_BLOCKS here, but that adds fileblocks.o to
166 # LIBOBJS, which we don't need. This seems more direct.
167 AC_CACHE_CHECK([for st_blocks in struct stat], ac_cv_struct_st_blocks,
168 [AC_TRY_COMPILE([#include <sys/types.h>
169 #include <sys/stat.h>], [struct stat s; s.st_blocks;],
170 ac_cv_struct_st_blocks=yes, ac_cv_struct_st_blocks=no)])
171 if test $ac_cv_struct_st_blocks = yes; then
172 AC_DEFINE(HAVE_ST_BLOCKS)
178 #--------------------------------------------------------------------
180 # Which way does the stack grow?
182 #--------------------------------------------------------------------
184 AC_TRY_RUN(aux (l) unsigned long l;
185 { int x; exit (l >= ((unsigned long)&x)); }
186 main () { int q; aux((unsigned long)&q); },
187 AC_DEFINE(SCM_STACK_GROWS_UP),,AC_MSG_WARN(Guessing that stack grows down -- see scmconfig.h.in))
190 AC_TRY_RUN(main () { exit (sizeof(float) != sizeof(long)); },
191 AC_DEFINE(SCM_SINGLES),,AC_DEFINE(SCM_SINGLES)
192 AC_MSG_WARN(Guessing that sizeof(long) == sizeof(float) -- see scmconfig.h.in))
194 AC_MSG_CHECKING(for struct linger)
195 AC_CACHE_VAL(scm_cv_struct_linger,
197 #include <sys/types.h>
198 #include <sys/socket.h>],
199 [struct linger lgr; lgr.l_linger = 100],
200 scm_cv_struct_linger="yes",
201 scm_cv_struct_linger="no"))
202 AC_MSG_RESULT($scm_cv_struct_linger)
203 if test $scm_cv_struct_linger = yes; then
204 AC_DEFINE(HAVE_STRUCT_LINGER)
207 #--------------------------------------------------------------------
209 # How can you violate a stdio abstraction by setting a stream's fd?
211 #--------------------------------------------------------------------
213 AC_MSG_CHECKING(how to set a stream file descriptor)
214 AC_CACHE_VAL(scm_cv_fd_setter,
215 AC_TRY_COMPILE([#include <stdio.h>],
217 scm_cv_fd_setter="_file",
218 AC_TRY_COMPILE([#include <stdio.h>],
219 [stdout->_fileno = 1],
220 scm_cv_fd_setter="_fileno",
221 scm_cv_fd_setter="")))
223 if test "$scm_cv_fd_setter"; then
224 AC_MSG_RESULT($scm_cv_fd_setter)
225 AC_DEFINE_UNQUOTED(FD_SETTER, $scm_cv_fd_setter)
227 AC_MSG_RESULT(we couldn't do it!)
230 #--------------------------------------------------------------------
231 # How to find out whether a FILE structure contains buffered data.
232 # From Tk we have the following list:
233 # _cnt: Most UNIX systems
237 # Or, in GNU libc there are two fields, _gptr and _egptr, which
238 # have to be compared.
239 # These can also be known as _IO_read_ptr and _IO_read_end.
240 #--------------------------------------------------------------------
242 AC_MSG_CHECKING(how to get buffer char count from FILE structure)
243 AC_CACHE_VAL(scm_cv_struct_file_count,
244 AC_TRY_COMPILE([#include <stdio.h>],
245 [FILE *f = stdin; f->_cnt = 0],
246 scm_cv_struct_file_count="_cnt",
247 AC_TRY_COMPILE([#include <stdio.h>],
248 [FILE *f = stdin; f->_r = 0],
249 scm_cv_struct_file_count="_r",
250 AC_TRY_COMPILE([#include <stdio.h>],
251 [FILE *f = stdin; f->readCount = 0],
252 scm_cv_struct_file_count="readCount",
253 scm_cv_struct_file_count=""))))
254 if test "$scm_cv_struct_file_count"; then
255 AC_MSG_RESULT($scm_cv_struct_file_count)
256 AC_DEFINE_UNQUOTED(FILE_CNT_FIELD, $scm_cv_struct_file_count)
258 AC_CACHE_VAL(scm_cv_struct_file_gptr,
259 AC_TRY_COMPILE([#include <stdio.h>],
260 [FILE *f = stdin; f->_gptr = f->egptr;],
261 scm_cv_struct_file_gptr=1,
262 scm_cv_struct_file_gptr=""))
263 if test "$scm_cv_struct_gptr"; then
265 AC_DEFINE_UNQUOTED(FILE_CNT_GPTR, $scm_cv_struct_file_gptr)
267 AC_CACHE_VAL(scm_cv_struct_file_readptr,
268 AC_TRY_COMPILE([#include <stdio.h>],
269 [FILE *f = stdin; f->_IO_read_ptr = f->_IO_read_end;],
270 scm_cv_struct_file_readptr=1))
271 if test "$scm_cv_struct_file_readptr"; then
272 AC_MSG_RESULT(read_ptr)
273 AC_DEFINE_UNQUOTED(FILE_CNT_READPTR, $scm_cv_struct_file_readptr)
275 AC_MSG_RESULT(we couldn't do it!)
280 #--------------------------------------------------------------------
282 # Flags for thread support
284 #--------------------------------------------------------------------
287 CFLAGS="$CFLAGS $cy_cv_threads_cflags"
288 THREAD_LIBS="$cy_cv_threads_libs"
289 AC_SUBST(THREAD_LIBS)
292 dnl Set the appropriate flags!
294 if test "$cy_cv_threads_package" = FSU; then
295 AC_DEFINE(USE_FSU_PTHREADS, 1)
296 else if test "$cy_cv_threads_package" = COOP; then
297 AC_DEFINE(USE_COOP_THREADS, 1)
298 else if test "$cy_cv_threads_package" = MIT; then
299 AC_DEFINE(USE_MIT_PTHREADS, 1)
300 else if test "$cy_cv_threads_package" = PCthreads; then
301 AC_DEFINE(USE_PCTHREADS_PTHREADS, 1)
302 else if test "$cy_cv_threads_package" = unknown; then
303 AC_MSG_ERROR("cannot find threads installation")
310 if test "$cy_cv_threads_package" != ""; then
311 AC_DEFINE(USE_THREADS)
312 LIBOBJS="$LIBOBJS threads.o"
315 ## If we're using GCC, ask for aggressive warnings.
317 yes ) CFLAGS="$CFLAGS -Wall -Wpointer-arith" ;;
322 ## If we're creating a shared library (using libtool!), then we'll
323 ## need to generate a list of .lo files corresponding to the .o files
324 ## given in LIBOBJS. We'll call it LIBLOBJS.
325 LIBLOBJS="`echo ${LIBOBJS} | sed 's/\.o/.lo/g'`"
327 AC_SUBST(GUILE_MAJOR_VERSION)
328 AC_SUBST(GUILE_MINOR_VERSION)
329 AC_SUBST(GUILE_VERSION)
331 dnl timestamping the interpreter and scheme libraries:
333 dnl Help us notice when we're running one version of the Guile
334 dnl interpreter against a different version of the ice-9 Scheme code.
335 dnl This will definitely detect version skew due to differing
336 dnl snapshots and releases, but may not catch skew for the developers.
337 dnl Hopefully it will not detect skew when there is none; if that
338 dnl happens, the warnings will be useless, and we should remove this.
340 AC_SUBST(GUILE_STAMP)
346 dnl ======================================================================
347 dnl configuration for the Qt package
348 dnl ======================================================================
350 threads_enabled=false
351 if test "$cy_cv_threads_package" = COOP; then
355 # Determine the host we are working on
358 # How can we refer to the qt source directory from within the qt build
359 # directory? For headers, we can rely on the fact that the qt src
360 # directory appears in the #include path.
362 qtsrcdir="`(cd $srcdir; pwd)`/qt"
364 changequote(,)dnl We use [ and ] in a regexp in the case
367 qtmds_s=$qtsrcdir/md/i386.s
369 qtmdc_c=$qtsrcdir/md/null.c
372 qtmds_s=$qtsrcdir/md/mips-irix5.s
374 qtmdc_c=$qtsrcdir/md/null.c
375 qtdmdb_s=$qtsrcdir/md/mips_b.s
378 qtmds_s=$qtsrcdir/md/mips.s
380 qtmdc_c=$qtsrcdir/md/null.c
381 qtdmdb_s=$qtsrcdir/md/mips_b.s
385 qtmdc_c=$qtsrcdir/md/null.c
386 qtmds_s=$qtsrcdir/md/_sparc.s
387 qtdmdb_s=$qtsrcdir/md/_sparc_b.s
391 qtmdc_c=$qtsrcdir/md/null.c
392 qtmds_s=$qtsrcdir/md/sparc.s
393 qtdmdb_s=$qtsrcdir/md/sparc_b.s
397 qtmdc_c=$qtsrcdir/md/null.c
398 qtmds_s=$qtsrcdir/md/axp.s
399 qtdmdb_s=$qtsrcdir/md/axp_b.s
402 echo "Unknown configuration; threads package disabled"
403 threads_enabled=false
409 if $threads_enabled; then
415 # Give the Makefile the names of the object files that will be
416 # generated by compiling $qtmdc_c and $qtmds_s.
417 qtmdc_o="`echo ${qtmdc_c} | sed -e 's:^.*/::' | sed -e 's:\.c$:\.o:'`"
418 qtmds_o="`echo ${qtmds_s} | sed -e 's:^.*/::' | sed -e 's:\.s$:\.o:'`"
420 AC_SUBST(target_libs)
428 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], [chmod +x libguile/guile-snarf])
431 dnl comment-start: "dnl "
433 dnl comment-start-skip: "\\bdnl\\b\\s *"