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