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