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