Changes to compile under gnu-win32, from Marcus Daniels:
[bpt/guile.git] / configure.in
CommitLineData
733943b9 1dnl Process this file with autoconf to produce configure.
0f2d19dd 2AC_INIT(Makefile.in)
2d26def0 3. $srcdir/GUILE-VERSION
3a629497 4AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
15ae1bee 5AM_MAINTAINER_MODE
3a629497 6AM_CONFIG_HEADER(libguile/scmconfig.h)
2d26def0 7
3a629497
JB
8#--------------------------------------------------------------------
9#
10# User options
11#
12#--------------------------------------------------------------------
86789f9b 13
3a629497
JB
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,
af8865f7
JB
23 [ --enable-dynamic-linking Include support for dynamic linking],,
24 enable_dynamic_linking=yes)
3a629497
JB
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
da88f0cb 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)
3a629497
JB
49GUILE_HEADER_LIBC_WITH_UNISTD
50
51AC_TYPE_GETGROUPS
52AC_TYPE_SIGNAL
53AC_TYPE_MODE_T
54
5852c051 55AC_CHECK_LIB(m, main)
90fcac06 56AC_CHECK_LIB(rx, main)
5852c051
JB
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
90fcac06
JB
66# Checks for dynamic linking
67
5852c051
JB
68if test "$enable_dynamic_linking" = "yes"; then
69
70AC_CHECK_LIB(dl,dlopen)
71if test "$ac_cv_lib_dl_dlopen" = "yes"; then
5852c051
JB
72 AC_DEFINE(DYNAMIC_LINKING)
73else
74AC_CHECK_LIB(dld,dld_link)
75if test "$ac_cv_lib_dld_dld_link" = "yes"; then
5852c051
JB
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
e1a191a8
GH
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
da88f0cb
JB
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
99cp confdefs.h confdefs.h.bak
100for func in sethostent endhostent getnetent setnetent endnetent getprotoent endprotoent getservent endservent getnetbyaddr getnetbyname inet_lnaof inet_makeaddr inet_netof ; do
101cp confdefs.h.bak confdefs.h
102cat >> confdefs.h << EOF
103#ifdef __CYGWIN32__
104#define $func cygwin32_$func
105#endif
106EOF
107AC_CHECK_FUNC($func)
108done
109cp confdefs.h.bak confdefs.h
110
111dnl </GNU-WIN32 hacks>
112
e1a191a8
GH
113AC_CACHE_CHECK([for restartable system calls], scm_cv_restarts,
114 if test $ac_cv_func_sigaction = yes; then
115 [AC_TRY_COMPILE([#include <signal.h>],
116 [int a = SA_RESTART],
117 scm_cv_restarts=yes,
118 scm_cv_restarts=no)]
119 else
120 scm_cv_restarts=no
121 fi)
122if test $scm_cv_restarts = yes; then
123 AC_DEFINE(HAVE_RESTARTS)
124fi
125
da88f0cb
JB
126if test "$ac_cv_header_regex_h" = yes; then
127 AC_CHECK_FUNCS(regcomp, [LIBOBJS="regex-posix.o $LIBOBJS"])
128fi
8e1bfcd0 129
3a629497
JB
130AC_REPLACE_FUNCS(inet_aton putenv strerror)
131
4a5fa91c
TP
132# When testing for the presence of alloca, we need to add alloca.o
133# explicitly to LIBOBJS to make sure that it is translated to
134# `alloca.lo' for libtool later on. This can and should be done more cleanly.
3a629497 135AC_FUNC_ALLOCA
4a5fa91c 136if test "$ALLOCA" = "alloca.o"; then LIBOBJS="alloca.o $LIBOBJS"; fi
3a629497
JB
137
138AC_STRUCT_ST_RDEV
139AC_STRUCT_ST_BLKSIZE
075edbde
JB
140
141# We could use AC_STRUCT_ST_BLOCKS here, but that adds fileblocks.o to
142# LIBOBJS, which we don't need. This seems more direct.
143AC_CACHE_CHECK([for st_blocks in struct stat], ac_cv_struct_st_blocks,
144[AC_TRY_COMPILE([#include <sys/types.h>
145#include <sys/stat.h>], [struct stat s; s.st_blocks;],
146ac_cv_struct_st_blocks=yes, ac_cv_struct_st_blocks=no)])
147if test $ac_cv_struct_st_blocks = yes; then
148 AC_DEFINE(HAVE_ST_BLOCKS)
149fi
150
3a629497
JB
151AC_STRUCT_TIMEZONE
152GUILE_STRUCT_UTIMBUF
153
3a629497
JB
154#--------------------------------------------------------------------
155#
156# Which way does the stack grow?
157#
158#--------------------------------------------------------------------
159
160AC_TRY_RUN(aux (l) unsigned long l;
161 { int x; exit (l >= ((unsigned long)&x)); }
162 main () { int q; aux((unsigned long)&q); },
163 AC_DEFINE(SCM_STACK_GROWS_UP),,AC_MSG_WARN(Guessing that stack grows down -- see scmconfig.h.in))
164
165
166AC_TRY_RUN(main () { exit (sizeof(float) != sizeof(long)); },
167 AC_DEFINE(SCM_SINGLES),,AC_DEFINE(SCM_SINGLES)
168 AC_MSG_WARN(Guessing that sizeof(long) == sizeof(float) -- see scmconfig.h.in))
169
170AC_MSG_CHECKING(for struct linger)
171AC_CACHE_VAL(scm_cv_struct_linger,
172 AC_TRY_COMPILE([
173#include <sys/types.h>
174#include <sys/socket.h>],
175 [struct linger lgr; lgr.l_linger = 100],
176 scm_cv_struct_linger="yes",
177 scm_cv_struct_linger="no"))
178AC_MSG_RESULT($scm_cv_struct_linger)
179if test $scm_cv_struct_linger = yes; then
180 AC_DEFINE(HAVE_STRUCT_LINGER)
181fi
182
183#--------------------------------------------------------------------
184#
185# How can you violate a stdio abstraction by setting a stream's fd?
186#
187#--------------------------------------------------------------------
188
189AC_MSG_CHECKING(how to set a stream file descriptor)
190AC_CACHE_VAL(scm_cv_fd_setter,
191 AC_TRY_COMPILE([#include <stdio.h>],
192 [stdout->_file = 1],
193 scm_cv_fd_setter="_file",
194 AC_TRY_COMPILE([#include <stdio.h>],
195 [stdout->_fileno = 1],
196 scm_cv_fd_setter="_fileno",
197 scm_cv_fd_setter="")))
198
199if test "$scm_cv_fd_setter"; then
200 AC_MSG_RESULT($scm_cv_fd_setter)
201 AC_DEFINE_UNQUOTED(FD_SETTER, $scm_cv_fd_setter)
202else
203 AC_MSG_RESULT(we couldn't do it!)
204fi
205
206#--------------------------------------------------------------------
207# How to find out whether a FILE structure contains buffered data.
208# From Tk we have the following list:
209# _cnt: Most UNIX systems
210# __cnt: HPUX
211# _r: BSD
212# readCount: Sprite
213# Or, in GNU libc there are two fields, _gptr and _egptr, which
214# have to be compared.
215# These can also be known as _IO_read_ptr and _IO_read_end.
216#--------------------------------------------------------------------
217
218AC_MSG_CHECKING(how to get buffer char count from FILE structure)
219AC_CACHE_VAL(scm_cv_struct_file_count,
220 AC_TRY_COMPILE([#include <stdio.h>],
221 [FILE *f = stdin; f->_cnt = 0],
222 scm_cv_struct_file_count="_cnt",
223 AC_TRY_COMPILE([#include <stdio.h>],
224 [FILE *f = stdin; f->_r = 0],
225 scm_cv_struct_file_count="_r",
226 AC_TRY_COMPILE([#include <stdio.h>],
227 [FILE *f = stdin; f->readCount = 0],
228 scm_cv_struct_file_count="readCount",
229 scm_cv_struct_file_count=""))))
230if test "$scm_cv_struct_file_count"; then
231 AC_MSG_RESULT($scm_cv_struct_file_count)
232 AC_DEFINE_UNQUOTED(FILE_CNT_FIELD, $scm_cv_struct_file_count)
233else
234AC_CACHE_VAL(scm_cv_struct_file_gptr,
235 AC_TRY_COMPILE([#include <stdio.h>],
236 [FILE *f = stdin; f->_gptr = f->egptr;],
237 scm_cv_struct_file_gptr=1,
238 scm_cv_struct_file_gptr=""))
239if test "$scm_cv_struct_gptr"; then
240 AC_MSG_RESULT(gptr)
241 AC_DEFINE_UNQUOTED(FILE_CNT_GPTR, $scm_cv_struct_file_gptr)
242else
243AC_CACHE_VAL(scm_cv_struct_file_readptr,
244 AC_TRY_COMPILE([#include <stdio.h>],
245 [FILE *f = stdin; f->_IO_read_ptr = f->_IO_read_end;],
246 scm_cv_struct_file_readptr=1))
247if test "$scm_cv_struct_file_readptr"; then
248 AC_MSG_RESULT(read_ptr)
249 AC_DEFINE_UNQUOTED(FILE_CNT_READPTR, $scm_cv_struct_file_readptr)
250else
251 AC_MSG_RESULT(we couldn't do it!)
252fi
253fi
254fi
255
256#--------------------------------------------------------------------
257#
258# Flags for thread support
259#
260#--------------------------------------------------------------------
261
262CY_AC_WITH_THREADS
263CFLAGS="$CFLAGS $cy_cv_threads_cflags"
264THREAD_LIBS="$cy_cv_threads_libs"
265AC_SUBST(THREAD_LIBS)
266
267dnl
268dnl Set the appropriate flags!
269dnl
270if test "$cy_cv_threads_package" = FSU; then
271 AC_DEFINE(USE_FSU_PTHREADS, 1)
272 else if test "$cy_cv_threads_package" = COOP; then
273 AC_DEFINE(USE_COOP_THREADS, 1)
274 else if test "$cy_cv_threads_package" = MIT; then
275 AC_DEFINE(USE_MIT_PTHREADS, 1)
276 else if test "$cy_cv_threads_package" = PCthreads; then
277 AC_DEFINE(USE_PCTHREADS_PTHREADS, 1)
278 else if test "$cy_cv_threads_package" = unknown; then
279 AC_MSG_ERROR("cannot find threads installation")
280 fi
281 fi
282 fi
0f2d19dd 283 fi
3a629497
JB
284fi
285
286if test "$cy_cv_threads_package" != ""; then
287 AC_DEFINE(USE_THREADS)
288 LIBOBJS="$LIBOBJS threads.o"
289fi
290
291## If we're using GCC, ask for aggressive warnings.
292case "$GCC" in
293 yes ) CFLAGS="$CFLAGS -Wall -Wpointer-arith" ;;
294esac
295
296AC_PROG_AWK
297
298## If we're creating a shared library (using libtool!), then we'll
299## need to generate a list of .lo files corresponding to the .o files
300## given in LIBOBJS. We'll call it LIBLOBJS.
301LIBLOBJS="`echo ${LIBOBJS} | sed 's/\.o/.lo/g'`"
302
7c86ae05
JB
303AC_SUBST(GUILE_MAJOR_VERSION)
304AC_SUBST(GUILE_MINOR_VERSION)
305AC_SUBST(GUILE_VERSION)
306
307dnl timestamping the interpreter and scheme libraries:
308dnl
309dnl Help us notice when we're running one version of the Guile
310dnl interpreter against a different version of the ice-9 Scheme code.
311dnl This will definitely detect version skew due to differing
312dnl snapshots and releases, but may not catch skew for the developers.
313dnl Hopefully it will not detect skew when there is none; if that
314dnl happens, the warnings will be useless, and we should remove this.
315GUILE_STAMP="`date`"
316AC_SUBST(GUILE_STAMP)
3a629497
JB
317
318AC_SUBST(AWK)
319AC_SUBST(LIBLOBJS)
320
321
322dnl ======================================================================
323dnl configuration for the Qt package
324dnl ======================================================================
325
326threads_enabled=false
327if test "$cy_cv_threads_package" = COOP; then
328 threads_enabled=true
329fi
330
331# Determine the host we are working on
332AC_CANONICAL_HOST
333
77c7a433
JB
334# How can we refer to the qt source directory from within the qt build
335# directory? For headers, we can rely on the fact that the qt src
336# directory appears in the #include path.
337
338qtsrcdir="`(cd $srcdir; pwd)`/qt"
339
3a629497
JB
340changequote(,)dnl We use [ and ] in a regexp in the case
341case "$host" in
342i[3456]86-*-*)
77c7a433
JB
343 qtmds_s=$qtsrcdir/md/i386.s
344 qtmd_h=md/i386.h
345 qtmdc_c=$qtsrcdir/md/null.c
3a629497
JB
346 ;;
347mips-sgi-irix5*)
77c7a433
JB
348 qtmds_s=$qtsrcdir/md/mips-irix5.s
349 qtmd_h=md/mips.h
350 qtmdc_c=$qtsrcdir/md/null.c
351 qtdmdb_s=$qtsrcdir/md/mips_b.s
3a629497
JB
352 ;;
353mips-*-*)
77c7a433
JB
354 qtmds_s=$qtsrcdir/md/mips.s
355 qtmd_h=md/mips.h
356 qtmdc_c=$qtsrcdir/md/null.c
357 qtdmdb_s=$qtsrcdir/md/mips_b.s
3a629497 358 ;;
2a18e748 359sparc-*-sunos*)
77c7a433
JB
360 qtmd_h=md/sparc.h
361 qtmdc_c=$qtsrcdir/md/null.c
2a18e748
JB
362 qtmds_s=$qtsrcdir/md/_sparc.s
363 qtdmdb_s=$qtsrcdir/md/_sparc_b.s
3a629497
JB
364 ;;
365sparc-*-*)
77c7a433
JB
366 qtmd_h=md/sparc.h
367 qtmdc_c=$qtsrcdir/md/null.c
2a18e748
JB
368 qtmds_s=$qtsrcdir/md/sparc.s
369 qtdmdb_s=$qtsrcdir/md/sparc_b.s
3a629497
JB
370 ;;
371*)
372 echo "Unknown configuration; threads package disabled"
373 threads_enabled=false
374 ;;
375esac
376changequote([, ])
377
378
379if $threads_enabled; then
380 target_libs=libqt.a
381else
382 target_libs=
383fi
384
385# Give the Makefile the names of the object files that will be
386# generated by compiling $qtmdc_c and $qtmds_s.
387qtmdc_o="`echo ${qtmdc_c} | sed -e 's:^.*/::' | sed -e 's:\.c$:\.o:'`"
388qtmds_o="`echo ${qtmds_s} | sed -e 's:^.*/::' | sed -e 's:\.s$:\.o:'`"
389
390AC_SUBST(target_libs)
391AC_SUBST(qtmd_h)
392AC_SUBST(qtmdc_c)
393AC_SUBST(qtmdc_o)
394AC_SUBST(qtmds_s)
395AC_SUBST(qtmds_o)
396AC_SUBST(qtmdb_s)
0f2d19dd 397
7c86ae05 398AC_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])
0f2d19dd 399
3a629497
JB
400dnl Local Variables:
401dnl comment-start: "dnl "
402dnl comment-end: ""
403dnl comment-start-skip: "\\bdnl\\b\\s *"
404dnl End: