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 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_LIB(rx, main)
57 AC_CHECK_FUNC(gethostbyname)
58 if test $ac_cv_func_gethostbyname = no; then
59 AC_CHECK_LIB(nsl, gethostbyname)
61 AC_CHECK_FUNC(connect)
62 if test $ac_cv_func_connect = no; then
63 AC_CHECK_LIB(socket, connect)
66 # Checks for dynamic linking
68 if test "$enable_dynamic_linking" = "yes"; then
70 AC_CHECK_LIB(dl,dlopen)
71 if test "$ac_cv_lib_dl_dlopen" = "yes"; then
72 AC_DEFINE(DYNAMIC_LINKING)
74 AC_CHECK_LIB(dld,dld_link)
75 if test "$ac_cv_lib_dld_dld_link" = "yes"; then
76 AC_DEFINE(DYNAMIC_LINKING)
78 AC_CHECK_FUNCS(shl_load)
79 if test "$ac_cv_func_shl_load" = "yes"; then
80 AC_DEFINE(DYNAMIC_LINKING)
88 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)
92 AC_CHECK_HEADER(sys/un.h, have_sys_un_h=1)
93 if test -n "$have_sys_un_h" ; then
94 AC_DEFINE(HAVE_UNIX_DOMAIN_SOCKETS)
97 AC_CHECK_FUNCS(socketpair getgroups setpwent pause tzset)
99 dnl I don't know what this prefixing of cygwin32_ is for.
100 dnl scmconfig.h wasn't updated with the test results.
101 dnl so use AC_CHECK_FUNCS for now.
105 dnl if test $ac_cv_cigwin = yes; then
106 dnl modify confdefs.h
108 dnl AC_CHECK_FUNCS...
109 dnl restore confdefs.h
111 dnl cp confdefs.h confdefs.h.bak
112 dnl for func in sethostent endhostent getnetent setnetent endnetent getprotoent endprotoent getservent endservent getnetbyaddr getnetbyname inet_lnaof inet_makeaddr inet_netof ; do
113 dnl cp confdefs.h.bak confdefs.h
114 dnl cat >> confdefs.h << EOF
115 dnl #ifdef __CYGWIN32__
116 dnl #define $func cygwin32_$func
119 dnl AC_CHECK_FUNC($func)
121 dnl cp confdefs.h.bak confdefs.h
123 AC_CHECK_FUNCS(sethostent endhostent getnetent setnetent endnetent getprotoent endprotoent getservent endservent getnetbyaddr getnetbyname inet_lnaof inet_makeaddr inet_netof)
125 dnl </GNU-WIN32 hacks>
127 AC_CACHE_CHECK([for restartable system calls], scm_cv_restarts,
128 if test $ac_cv_func_sigaction = yes; then
129 [AC_TRY_COMPILE([#include <signal.h>],
130 [int a = SA_RESTART],
136 if test $scm_cv_restarts = yes; then
137 AC_DEFINE(HAVE_RESTARTS)
140 if test "$ac_cv_header_regex_h" = yes; then
141 AC_CHECK_FUNCS(regcomp, [LIBOBJS="regex-posix.o $LIBOBJS"])
144 AC_REPLACE_FUNCS(inet_aton putenv strerror)
146 # When testing for the presence of alloca, we need to add alloca.o
147 # explicitly to LIBOBJS to make sure that it is translated to
148 # `alloca.lo' for libtool later on. This can and should be done more cleanly.
150 if test "$ALLOCA" = "alloca.o"; then LIBOBJS="alloca.o $LIBOBJS"; fi
155 # We could use AC_STRUCT_ST_BLOCKS here, but that adds fileblocks.o to
156 # LIBOBJS, which we don't need. This seems more direct.
157 AC_CACHE_CHECK([for st_blocks in struct stat], ac_cv_struct_st_blocks,
158 [AC_TRY_COMPILE([#include <sys/types.h>
159 #include <sys/stat.h>], [struct stat s; s.st_blocks;],
160 ac_cv_struct_st_blocks=yes, ac_cv_struct_st_blocks=no)])
161 if test $ac_cv_struct_st_blocks = yes; then
162 AC_DEFINE(HAVE_ST_BLOCKS)
168 #--------------------------------------------------------------------
170 # Which way does the stack grow?
172 #--------------------------------------------------------------------
174 AC_TRY_RUN(aux (l) unsigned long l;
175 { int x; exit (l >= ((unsigned long)&x)); }
176 main () { int q; aux((unsigned long)&q); },
177 AC_DEFINE(SCM_STACK_GROWS_UP),,AC_MSG_WARN(Guessing that stack grows down -- see scmconfig.h.in))
180 AC_TRY_RUN(main () { exit (sizeof(float) != sizeof(long)); },
181 AC_DEFINE(SCM_SINGLES),,AC_DEFINE(SCM_SINGLES)
182 AC_MSG_WARN(Guessing that sizeof(long) == sizeof(float) -- see scmconfig.h.in))
184 AC_MSG_CHECKING(for struct linger)
185 AC_CACHE_VAL(scm_cv_struct_linger,
187 #include <sys/types.h>
188 #include <sys/socket.h>],
189 [struct linger lgr; lgr.l_linger = 100],
190 scm_cv_struct_linger="yes",
191 scm_cv_struct_linger="no"))
192 AC_MSG_RESULT($scm_cv_struct_linger)
193 if test $scm_cv_struct_linger = yes; then
194 AC_DEFINE(HAVE_STRUCT_LINGER)
197 #--------------------------------------------------------------------
199 # How can you violate a stdio abstraction by setting a stream's fd?
201 #--------------------------------------------------------------------
203 AC_MSG_CHECKING(how to set a stream file descriptor)
204 AC_CACHE_VAL(scm_cv_fd_setter,
205 AC_TRY_COMPILE([#include <stdio.h>],
207 scm_cv_fd_setter="_file",
208 AC_TRY_COMPILE([#include <stdio.h>],
209 [stdout->_fileno = 1],
210 scm_cv_fd_setter="_fileno",
211 scm_cv_fd_setter="")))
213 if test "$scm_cv_fd_setter"; then
214 AC_MSG_RESULT($scm_cv_fd_setter)
215 AC_DEFINE_UNQUOTED(FD_SETTER, $scm_cv_fd_setter)
217 AC_MSG_RESULT(we couldn't do it!)
220 #--------------------------------------------------------------------
221 # How to find out whether a FILE structure contains buffered data.
222 # From Tk we have the following list:
223 # _cnt: Most UNIX systems
227 # Or, in GNU libc there are two fields, _gptr and _egptr, which
228 # have to be compared.
229 # These can also be known as _IO_read_ptr and _IO_read_end.
230 #--------------------------------------------------------------------
232 AC_MSG_CHECKING(how to get buffer char count from FILE structure)
233 AC_CACHE_VAL(scm_cv_struct_file_count,
234 AC_TRY_COMPILE([#include <stdio.h>],
235 [FILE *f = stdin; f->_cnt = 0],
236 scm_cv_struct_file_count="_cnt",
237 AC_TRY_COMPILE([#include <stdio.h>],
238 [FILE *f = stdin; f->_r = 0],
239 scm_cv_struct_file_count="_r",
240 AC_TRY_COMPILE([#include <stdio.h>],
241 [FILE *f = stdin; f->readCount = 0],
242 scm_cv_struct_file_count="readCount",
243 scm_cv_struct_file_count=""))))
244 if test "$scm_cv_struct_file_count"; then
245 AC_MSG_RESULT($scm_cv_struct_file_count)
246 AC_DEFINE_UNQUOTED(FILE_CNT_FIELD, $scm_cv_struct_file_count)
248 AC_CACHE_VAL(scm_cv_struct_file_gptr,
249 AC_TRY_COMPILE([#include <stdio.h>],
250 [FILE *f = stdin; f->_gptr = f->egptr;],
251 scm_cv_struct_file_gptr=1,
252 scm_cv_struct_file_gptr=""))
253 if test "$scm_cv_struct_gptr"; then
255 AC_DEFINE_UNQUOTED(FILE_CNT_GPTR, $scm_cv_struct_file_gptr)
257 AC_CACHE_VAL(scm_cv_struct_file_readptr,
258 AC_TRY_COMPILE([#include <stdio.h>],
259 [FILE *f = stdin; f->_IO_read_ptr = f->_IO_read_end;],
260 scm_cv_struct_file_readptr=1))
261 if test "$scm_cv_struct_file_readptr"; then
262 AC_MSG_RESULT(read_ptr)
263 AC_DEFINE_UNQUOTED(FILE_CNT_READPTR, $scm_cv_struct_file_readptr)
265 AC_MSG_RESULT(we couldn't do it!)
270 #--------------------------------------------------------------------
272 # Flags for thread support
274 #--------------------------------------------------------------------
277 CFLAGS="$CFLAGS $cy_cv_threads_cflags"
278 THREAD_LIBS="$cy_cv_threads_libs"
279 AC_SUBST(THREAD_LIBS)
282 dnl Set the appropriate flags!
284 if test "$cy_cv_threads_package" = FSU; then
285 AC_DEFINE(USE_FSU_PTHREADS, 1)
286 else if test "$cy_cv_threads_package" = COOP; then
287 AC_DEFINE(USE_COOP_THREADS, 1)
288 else if test "$cy_cv_threads_package" = MIT; then
289 AC_DEFINE(USE_MIT_PTHREADS, 1)
290 else if test "$cy_cv_threads_package" = PCthreads; then
291 AC_DEFINE(USE_PCTHREADS_PTHREADS, 1)
292 else if test "$cy_cv_threads_package" = unknown; then
293 AC_MSG_ERROR("cannot find threads installation")
300 if test "$cy_cv_threads_package" != ""; then
301 AC_DEFINE(USE_THREADS)
302 LIBOBJS="$LIBOBJS threads.o"
305 ## If we're using GCC, ask for aggressive warnings.
307 yes ) CFLAGS="$CFLAGS -Wall -Wpointer-arith" ;;
312 ## If we're creating a shared library (using libtool!), then we'll
313 ## need to generate a list of .lo files corresponding to the .o files
314 ## given in LIBOBJS. We'll call it LIBLOBJS.
315 LIBLOBJS="`echo ${LIBOBJS} | sed 's/\.o/.lo/g'`"
317 AC_SUBST(GUILE_MAJOR_VERSION)
318 AC_SUBST(GUILE_MINOR_VERSION)
319 AC_SUBST(GUILE_VERSION)
321 dnl timestamping the interpreter and scheme libraries:
323 dnl Help us notice when we're running one version of the Guile
324 dnl interpreter against a different version of the ice-9 Scheme code.
325 dnl This will definitely detect version skew due to differing
326 dnl snapshots and releases, but may not catch skew for the developers.
327 dnl Hopefully it will not detect skew when there is none; if that
328 dnl happens, the warnings will be useless, and we should remove this.
330 AC_SUBST(GUILE_STAMP)
336 dnl ======================================================================
337 dnl configuration for the Qt package
338 dnl ======================================================================
340 threads_enabled=false
341 if test "$cy_cv_threads_package" = COOP; then
345 # Determine the host we are working on
348 # How can we refer to the qt source directory from within the qt build
349 # directory? For headers, we can rely on the fact that the qt src
350 # directory appears in the #include path.
352 qtsrcdir="`(cd $srcdir; pwd)`/qt"
354 changequote(,)dnl We use [ and ] in a regexp in the case
357 qtmds_s=$qtsrcdir/md/i386.s
359 qtmdc_c=$qtsrcdir/md/null.c
362 qtmds_s=$qtsrcdir/md/mips-irix5.s
364 qtmdc_c=$qtsrcdir/md/null.c
365 qtdmdb_s=$qtsrcdir/md/mips_b.s
368 qtmds_s=$qtsrcdir/md/mips.s
370 qtmdc_c=$qtsrcdir/md/null.c
371 qtdmdb_s=$qtsrcdir/md/mips_b.s
375 qtmdc_c=$qtsrcdir/md/null.c
376 qtmds_s=$qtsrcdir/md/_sparc.s
377 qtdmdb_s=$qtsrcdir/md/_sparc_b.s
381 qtmdc_c=$qtsrcdir/md/null.c
382 qtmds_s=$qtsrcdir/md/sparc.s
383 qtdmdb_s=$qtsrcdir/md/sparc_b.s
386 echo "Unknown configuration; threads package disabled"
387 threads_enabled=false
393 if $threads_enabled; then
399 # Give the Makefile the names of the object files that will be
400 # generated by compiling $qtmdc_c and $qtmds_s.
401 qtmdc_o="`echo ${qtmdc_c} | sed -e 's:^.*/::' | sed -e 's:\.c$:\.o:'`"
402 qtmds_o="`echo ${qtmds_s} | sed -e 's:^.*/::' | sed -e 's:\.s$:\.o:'`"
404 AC_SUBST(target_libs)
412 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])
415 dnl comment-start: "dnl "
417 dnl comment-start-skip: "\\bdnl\\b\\s *"