*** empty log message ***
[bpt/guile.git] / configure.in
... / ...
CommitLineData
1dnl Process this file with autoconf to produce configure.
2AC_INIT(Makefile.in)
3. $srcdir/GUILE-VERSION
4AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
5AM_MAINTAINER_MODE
6AM_CONFIG_HEADER(libguile/scmconfig.h)
7
8#--------------------------------------------------------------------
9#
10# User options
11#
12#--------------------------------------------------------------------
13
14AC_ARG_ENABLE(debug,
15[ --disable-debug Don't include debugging support])
16if 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"
20fi
21
22AC_ARG_ENABLE(dynamic-linking,
23 [ --enable-dynamic-linking Include support for dynamic linking],,
24 enable_dynamic_linking=yes)
25
26AC_ARG_ENABLE(guile-debug,
27[ --enable-guile-debug Include internal debugging functions])
28if test "$enableval" = y || test "$enableval" = yes; then
29 AC_DEFINE(GUILE_DEBUG)
30fi
31
32#--------------------------------------------------------------------
33
34AC_PROG_CC
35AC_PROG_CPP
36AM_PROG_LIBTOOL
37
38AC_AIX
39AC_ISC_POSIX
40AC_MINIX
41
42AC_C_CONST
43
44AC_HEADER_STDC
45AC_HEADER_DIRENT
46AC_HEADER_TIME
47AC_HEADER_SYS_WAIT
48AC_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)
49GUILE_HEADER_LIBC_WITH_UNISTD
50
51AC_TYPE_GETGROUPS
52AC_TYPE_SIGNAL
53AC_TYPE_MODE_T
54
55AC_CHECK_LIB(m, main)
56AC_CHECK_LIB(rx, main)
57AC_CHECK_FUNC(gethostbyname)
58if test $ac_cv_func_gethostbyname = no; then
59 AC_CHECK_LIB(nsl, gethostbyname)
60fi
61AC_CHECK_FUNC(connect)
62if test $ac_cv_func_connect = no; then
63 AC_CHECK_LIB(socket, connect)
64fi
65
66# Checks for dynamic linking
67
68if test "$enable_dynamic_linking" = "yes"; then
69
70AC_CHECK_LIB(dl,dlopen)
71if test "$ac_cv_lib_dl_dlopen" = "yes"; then
72 AC_DEFINE(DYNAMIC_LINKING)
73else
74AC_CHECK_LIB(dld,dld_link)
75if test "$ac_cv_lib_dld_dld_link" = "yes"; then
76 AC_DEFINE(DYNAMIC_LINKING)
77else
78AC_CHECK_FUNCS(shl_load)
79if test "$ac_cv_func_shl_load" = "yes"; then
80 AC_DEFINE(DYNAMIC_LINKING)
81fi
82fi
83fi
84
85fi
86
87
88AC_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)
89
90dnl <GNU-WIN32 hacks>
91
92AC_CHECK_HEADER(sys/un.h, have_sys_un_h=1)
93if test -n "$have_sys_un_h" ; then
94AC_DEFINE(HAVE_UNIX_DOMAIN_SOCKETS)
95fi
96
97AC_CHECK_FUNCS(socketpair getgroups setpwent pause tzset)
98
99dnl I don't know what this prefixing of cygwin32_ is for.
100dnl scmconfig.h wasn't updated with the test results.
101dnl so use AC_CHECK_FUNCS for now.
102
103dnl how about:
104dnl save confdefs.h
105dnl if test $ac_cv_cigwin = yes; then
106dnl modify confdefs.h
107dnl fi
108dnl AC_CHECK_FUNCS...
109dnl restore confdefs.h
110
111dnl cp confdefs.h confdefs.h.bak
112dnl for func in sethostent endhostent getnetent setnetent endnetent getprotoent endprotoent getservent endservent getnetbyaddr getnetbyname inet_lnaof inet_makeaddr inet_netof ; do
113dnl cp confdefs.h.bak confdefs.h
114dnl cat >> confdefs.h << EOF
115dnl #ifdef __CYGWIN32__
116dnl #define $func cygwin32_$func
117dnl #endif
118dnl EOF
119dnl AC_CHECK_FUNC($func)
120dnl done
121dnl cp confdefs.h.bak confdefs.h
122
123AC_CHECK_FUNCS(sethostent endhostent getnetent setnetent endnetent getprotoent endprotoent getservent endservent getnetbyaddr getnetbyname inet_lnaof inet_makeaddr inet_netof)
124
125dnl </GNU-WIN32 hacks>
126
127AC_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],
131 scm_cv_restarts=yes,
132 scm_cv_restarts=no)]
133 else
134 scm_cv_restarts=no
135 fi)
136if test $scm_cv_restarts = yes; then
137 AC_DEFINE(HAVE_RESTARTS)
138fi
139
140if test "$ac_cv_header_regex_h" = yes; then
141 AC_CHECK_FUNCS(regcomp, [LIBOBJS="regex-posix.o $LIBOBJS"])
142fi
143
144AC_REPLACE_FUNCS(inet_aton putenv strerror)
145
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.
149AC_FUNC_ALLOCA
150if test "$ALLOCA" = "alloca.o"; then LIBOBJS="alloca.o $LIBOBJS"; fi
151
152AC_STRUCT_ST_RDEV
153AC_STRUCT_ST_BLKSIZE
154
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.
157AC_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;],
160ac_cv_struct_st_blocks=yes, ac_cv_struct_st_blocks=no)])
161if test $ac_cv_struct_st_blocks = yes; then
162 AC_DEFINE(HAVE_ST_BLOCKS)
163fi
164
165AC_STRUCT_TIMEZONE
166GUILE_STRUCT_UTIMBUF
167
168#--------------------------------------------------------------------
169#
170# Which way does the stack grow?
171#
172#--------------------------------------------------------------------
173
174AC_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))
178
179
180AC_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))
183
184AC_MSG_CHECKING(for struct linger)
185AC_CACHE_VAL(scm_cv_struct_linger,
186 AC_TRY_COMPILE([
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"))
192AC_MSG_RESULT($scm_cv_struct_linger)
193if test $scm_cv_struct_linger = yes; then
194 AC_DEFINE(HAVE_STRUCT_LINGER)
195fi
196
197#--------------------------------------------------------------------
198#
199# How can you violate a stdio abstraction by setting a stream's fd?
200#
201#--------------------------------------------------------------------
202
203AC_MSG_CHECKING(how to set a stream file descriptor)
204AC_CACHE_VAL(scm_cv_fd_setter,
205 AC_TRY_COMPILE([#include <stdio.h>],
206 [stdout->_file = 1],
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="")))
212
213if test "$scm_cv_fd_setter"; then
214 AC_MSG_RESULT($scm_cv_fd_setter)
215 AC_DEFINE_UNQUOTED(FD_SETTER, $scm_cv_fd_setter)
216else
217 AC_MSG_RESULT(we couldn't do it!)
218fi
219
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
224# __cnt: HPUX
225# _r: BSD
226# readCount: Sprite
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#--------------------------------------------------------------------
231
232AC_MSG_CHECKING(how to get buffer char count from FILE structure)
233AC_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=""))))
244if 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)
247else
248AC_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=""))
253if test "$scm_cv_struct_gptr"; then
254 AC_MSG_RESULT(gptr)
255 AC_DEFINE_UNQUOTED(FILE_CNT_GPTR, $scm_cv_struct_file_gptr)
256else
257AC_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))
261if 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)
264else
265 AC_MSG_RESULT(we couldn't do it!)
266fi
267fi
268fi
269
270#--------------------------------------------------------------------
271#
272# Flags for thread support
273#
274#--------------------------------------------------------------------
275
276CY_AC_WITH_THREADS
277CFLAGS="$CFLAGS $cy_cv_threads_cflags"
278THREAD_LIBS="$cy_cv_threads_libs"
279AC_SUBST(THREAD_LIBS)
280
281dnl
282dnl Set the appropriate flags!
283dnl
284if 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")
294 fi
295 fi
296 fi
297 fi
298fi
299
300if test "$cy_cv_threads_package" != ""; then
301 AC_DEFINE(USE_THREADS)
302 LIBOBJS="$LIBOBJS threads.o"
303fi
304
305## If we're using GCC, ask for aggressive warnings.
306case "$GCC" in
307 yes ) CFLAGS="$CFLAGS -Wall -Wpointer-arith" ;;
308esac
309
310AC_PROG_AWK
311
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.
315LIBLOBJS="`echo ${LIBOBJS} | sed 's/\.o/.lo/g'`"
316
317AC_SUBST(GUILE_MAJOR_VERSION)
318AC_SUBST(GUILE_MINOR_VERSION)
319AC_SUBST(GUILE_VERSION)
320
321dnl timestamping the interpreter and scheme libraries:
322dnl
323dnl Help us notice when we're running one version of the Guile
324dnl interpreter against a different version of the ice-9 Scheme code.
325dnl This will definitely detect version skew due to differing
326dnl snapshots and releases, but may not catch skew for the developers.
327dnl Hopefully it will not detect skew when there is none; if that
328dnl happens, the warnings will be useless, and we should remove this.
329GUILE_STAMP="`date`"
330AC_SUBST(GUILE_STAMP)
331
332AC_SUBST(AWK)
333AC_SUBST(LIBLOBJS)
334
335
336dnl ======================================================================
337dnl configuration for the Qt package
338dnl ======================================================================
339
340threads_enabled=false
341if test "$cy_cv_threads_package" = COOP; then
342 threads_enabled=true
343fi
344
345# Determine the host we are working on
346AC_CANONICAL_HOST
347
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.
351
352qtsrcdir="`(cd $srcdir; pwd)`/qt"
353
354changequote(,)dnl We use [ and ] in a regexp in the case
355case "$host" in
356i[3456]86-*-*)
357 qtmds_s=$qtsrcdir/md/i386.s
358 qtmd_h=md/i386.h
359 qtmdc_c=$qtsrcdir/md/null.c
360 ;;
361mips-sgi-irix5*)
362 qtmds_s=$qtsrcdir/md/mips-irix5.s
363 qtmd_h=md/mips.h
364 qtmdc_c=$qtsrcdir/md/null.c
365 qtdmdb_s=$qtsrcdir/md/mips_b.s
366 ;;
367mips-*-*)
368 qtmds_s=$qtsrcdir/md/mips.s
369 qtmd_h=md/mips.h
370 qtmdc_c=$qtsrcdir/md/null.c
371 qtdmdb_s=$qtsrcdir/md/mips_b.s
372 ;;
373sparc-*-sunos*)
374 qtmd_h=md/sparc.h
375 qtmdc_c=$qtsrcdir/md/null.c
376 qtmds_s=$qtsrcdir/md/_sparc.s
377 qtdmdb_s=$qtsrcdir/md/_sparc_b.s
378 ;;
379sparc-*-*)
380 qtmd_h=md/sparc.h
381 qtmdc_c=$qtsrcdir/md/null.c
382 qtmds_s=$qtsrcdir/md/sparc.s
383 qtdmdb_s=$qtsrcdir/md/sparc_b.s
384 ;;
385*)
386 echo "Unknown configuration; threads package disabled"
387 threads_enabled=false
388 ;;
389esac
390changequote([, ])
391
392
393if $threads_enabled; then
394 target_libs=libqt.a
395else
396 target_libs=
397fi
398
399# Give the Makefile the names of the object files that will be
400# generated by compiling $qtmdc_c and $qtmds_s.
401qtmdc_o="`echo ${qtmdc_c} | sed -e 's:^.*/::' | sed -e 's:\.c$:\.o:'`"
402qtmds_o="`echo ${qtmds_s} | sed -e 's:^.*/::' | sed -e 's:\.s$:\.o:'`"
403
404AC_SUBST(target_libs)
405AC_SUBST(qtmd_h)
406AC_SUBST(qtmdc_c)
407AC_SUBST(qtmdc_o)
408AC_SUBST(qtmds_s)
409AC_SUBST(qtmds_o)
410AC_SUBST(qtmdb_s)
411
412AC_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])
413
414dnl Local Variables:
415dnl comment-start: "dnl "
416dnl comment-end: ""
417dnl comment-start-skip: "\\bdnl\\b\\s *"
418dnl End: