*** empty log message ***
[bpt/guile.git] / aclocal.m4
CommitLineData
9bd368c0 1dnl aclocal.m4 generated automatically by aclocal 1.4
5aadf8c1 2
9bd368c0
MD
3dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5aadf8c1
MG
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7
8dnl This program is distributed in the hope that it will be useful,
9dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11dnl PARTICULAR PURPOSE.
ebf50833 12
3a629497
JB
13dnl On the NeXT, #including <utime.h> doesn't give you a definition for
14dnl struct utime, unless you #define _POSIX_SOURCE.
15
16AC_DEFUN(GUILE_STRUCT_UTIMBUF, [
17 AC_CACHE_CHECK([whether we need POSIX to get struct utimbuf],
18 guile_cv_struct_utimbuf_needs_posix,
19 [AC_TRY_CPP([
20#ifdef __EMX__
21#include <sys/utime.h>
22#else
23#include <utime.h>
24#endif
25struct utime blah;
26],
27 guile_cv_struct_utimbuf_needs_posix=no,
28 guile_cv_struct_utimbuf_needs_posix=yes)])
29 if test "$guile_cv_struct_utimbuf_needs_posix" = yes; then
30 AC_DEFINE(UTIMBUF_NEEDS_POSIX)
31 fi])
32
33
34
35
36dnl
37dnl Apparently, at CMU they have a weird version of libc.h that is
38dnl installed in /usr/local/include and conflicts with unistd.h.
39dnl In these situations, we should not #include libc.h.
40dnl This test arranges to #define LIBC_H_WITH_UNISTD_H iff libc.h is
41dnl present on the system, and is safe to #include.
42dnl
43AC_DEFUN([GUILE_HEADER_LIBC_WITH_UNISTD],
44 [
45 AC_CHECK_HEADERS(libc.h unistd.h)
46 AC_CACHE_CHECK(
47 "whether libc.h and unistd.h can be included together",
48 guile_cv_header_libc_with_unistd,
49 [
50 if test "$ac_cv_header_libc_h" = "no"; then
51 guile_cv_header_libc_with_unistd="no"
52 elif test "$ac_cv_header_unistd.h" = "no"; then
53 guile_cv_header_libc_with_unistd="yes"
54 else
55 AC_TRY_COMPILE(
56 [
57# include <libc.h>
58# include <unistd.h>
59 ],
60 [],
61 [guile_cv_header_libc_with_unistd=yes],
62 [guile_cv_header_libc_with_unistd=no]
63 )
64 fi
65 ]
66 )
67 if test "$guile_cv_header_libc_with_unistd" = yes; then
68 AC_DEFINE(LIBC_H_WITH_UNISTD_H)
69 fi
70 ]
71)
72
0b89e78e
MD
73
74
75dnl This is needed when we want to check for the same function repeatedly
76dnl with other parameters, such as libraries, varying.
77dnl
78dnl GUILE_NAMED_CHECK_FUNC(FUNCTION, TESTNAME,
79dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
80AC_DEFUN(GUILE_NAMED_CHECK_FUNC,
81[AC_MSG_CHECKING([for $1])
82AC_CACHE_VAL(ac_cv_func_$1_$2,
83[AC_TRY_LINK(
84dnl Don't include <ctype.h> because on OSF/1 3.0 it includes <sys/types.h>
85dnl which includes <sys/select.h> which contains a prototype for
86dnl select. Similarly for bzero.
87[/* System header to define __stub macros and hopefully few prototypes,
88 which can conflict with char $1(); below. */
89#include <assert.h>
90/* Override any gcc2 internal prototype to avoid an error. */
91]ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplus
92extern "C"
93#endif
94])dnl
95[/* We use char because int might match the return type of a gcc2
96 builtin and then its argument prototype would still apply. */
97char $1();
98], [
99/* The GNU C library defines this for functions which it implements
100 to always fail with ENOSYS. Some functions are actually named
101 something starting with __ and the normal name is an alias. */
102#if defined (__stub_$1) || defined (__stub___$1)
103choke me
104#else
105$1();
106#endif
107], eval "ac_cv_func_$1_$2=yes", eval "ac_cv_func_$1_$2=no")])
108if eval "test \"`echo '$ac_cv_func_'$1'_'$2`\" = yes"; then
109 AC_MSG_RESULT(yes)
110 ifelse([$3], , :, [$3])
111else
112 AC_MSG_RESULT(no)
113ifelse([$4], , , [$4
114])dnl
115fi
116])
117
db1e65d5
TP
118
119
120dnl Check checks whether dlsym (if present) requires a leading underscore.
121dnl Written by Dan Hagerty <hag@ai.mit.edu> for scsh-0.5.0.
122AC_DEFUN(GUILE_DLSYM_USCORE, [
123 AC_MSG_CHECKING(for underscore before symbols)
124 AC_CACHE_VAL(guile_cv_uscore,[
125 echo "main(){int i=1;}
126 fnord(){int i=23; int ltuae=42;}" > conftest.c
127 ${CC} conftest.c > /dev/null
128 if (nm a.out | grep _fnord) > /dev/null; then
129 guile_cv_uscore=yes
130 else
131 guile_cv_uscore=no
132 fi])
133 AC_MSG_RESULT($guile_cv_uscore)
134 rm -f conftest.c a.out
135
136 if test $guile_cv_uscore = yes; then
137 AC_DEFINE(USCORE)
138
139 if test $ac_cv_func_dlopen = yes -o $ac_cv_lib_dl_dlopen = yes ; then
140 AC_MSG_CHECKING(whether dlsym always adds an underscore for us)
141 AC_CACHE_VAL(guile_cv_dlsym_adds_uscore,AC_TRY_RUN( [
142#include <dlfcn.h>
143#include <stdio.h>
144fnord() { int i=42;}
145main() { void *self, *ptr1, *ptr2; self=dlopen(NULL,RTLD_LAZY);
146 if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord");
147 if(ptr1 && !ptr2) exit(0); } exit(1); }
148], [guile_cv_dlsym_adds_uscore=yes
5aadf8c1
MG
149 AC_DEFINE(DLSYM_ADDS_USCORE) ], guile_cv_dlsym_adds_uscore=no,
150 guile_cv_dlsym_adds_uscore=no))
db1e65d5
TP
151
152 AC_MSG_RESULT($guile_cv_dlsym_adds_uscore)
153 fi
154 fi
155])
156
733943b9
TT
157# Do all the work for Automake. This macro actually does too much --
158# some checks are only needed if your package does certain things.
159# But this isn't really a big deal.
160
161# serial 1
162
163dnl Usage:
1dc9c5b0 164dnl AM_INIT_AUTOMAKE(package,version, [no-define])
733943b9
TT
165
166AC_DEFUN(AM_INIT_AUTOMAKE,
9bd368c0 167[AC_REQUIRE([AC_PROG_INSTALL])
733943b9
TT
168PACKAGE=[$1]
169AC_SUBST(PACKAGE)
733943b9
TT
170VERSION=[$2]
171AC_SUBST(VERSION)
c7b6463e
JB
172dnl test to see if srcdir already configured
173if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
174 AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
175fi
1dc9c5b0 176ifelse([$3],,
9bd368c0
MD
177AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
178AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
341eaef0
GH
179AC_REQUIRE([AM_SANITY_CHECK])
180AC_REQUIRE([AC_ARG_PROGRAM])
1dc9c5b0
JB
181dnl FIXME This is truly gross.
182missing_dir=`cd $ac_aux_dir && pwd`
183AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
184AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
185AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
186AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
187AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
341eaef0 188AC_REQUIRE([AC_PROG_MAKE_SET])])
733943b9 189
733943b9
TT
190#
191# Check to make sure that the build environment is sane.
192#
193
194AC_DEFUN(AM_SANITY_CHECK,
195[AC_MSG_CHECKING([whether build environment is sane])
1dc9c5b0
JB
196# Just in case
197sleep 1
733943b9 198echo timestamp > conftestfile
1dc9c5b0
JB
199# Do `set' in a subshell so we don't clobber the current shell's
200# arguments. Must try -L first in case configure is actually a
201# symlink; some systems play weird games with the mod time of symlinks
202# (eg FreeBSD returns the mod time of the symlink's containing
203# directory).
204if (
205 set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
5aadf8c1 206 if test "[$]*" = "X"; then
1dc9c5b0
JB
207 # -L didn't work.
208 set X `ls -t $srcdir/configure conftestfile`
209 fi
341eaef0
GH
210 if test "[$]*" != "X $srcdir/configure conftestfile" \
211 && test "[$]*" != "X conftestfile $srcdir/configure"; then
212
213 # If neither matched, then we have a broken ls. This can happen
214 # if, for instance, CONFIG_SHELL is bash and it inherits a
215 # broken ls alias from the environment. This has actually
216 # happened. Such a system could not be considered "sane".
217 AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
218alias in your environment])
219 fi
220
1dc9c5b0
JB
221 test "[$]2" = conftestfile
222 )
733943b9
TT
223then
224 # Ok.
225 :
226else
227 AC_MSG_ERROR([newly created file is older than distributed files!
228Check your system clock])
229fi
230rm -f conftest*
231AC_MSG_RESULT(yes)])
232
1dc9c5b0
JB
233dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
234dnl The program must properly implement --version.
235AC_DEFUN(AM_MISSING_PROG,
236[AC_MSG_CHECKING(for working $2)
237# Run test in a subshell; some versions of sh will print an error if
238# an executable is not found, even if stderr is redirected.
c7b6463e
JB
239# Redirect stdin to placate older versions of autoconf. Sigh.
240if ($2 --version) < /dev/null > /dev/null 2>&1; then
1dc9c5b0
JB
241 $1=$2
242 AC_MSG_RESULT(found)
243else
244 $1="$3/missing $2"
245 AC_MSG_RESULT(missing)
246fi
247AC_SUBST($1)])
248
15ae1bee
MD
249# Add --enable-maintainer-mode option to configure.
250# From Jim Meyering
251
252# serial 1
253
254AC_DEFUN(AM_MAINTAINER_MODE,
255[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
256 dnl maintainer-mode is disabled by default
257 AC_ARG_ENABLE(maintainer-mode,
258[ --enable-maintainer-mode enable make rules and dependencies not useful
259 (and sometimes confusing) to the casual installer],
260 USE_MAINTAINER_MODE=$enableval,
261 USE_MAINTAINER_MODE=no)
262 AC_MSG_RESULT($USE_MAINTAINER_MODE)
9bd368c0
MD
263 AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
264 MAINT=$MAINTAINER_MODE_TRUE
15ae1bee
MD
265 AC_SUBST(MAINT)dnl
266]
267)
268
9bd368c0
MD
269# Define a conditional.
270
271AC_DEFUN(AM_CONDITIONAL,
272[AC_SUBST($1_TRUE)
273AC_SUBST($1_FALSE)
274if $2; then
275 $1_TRUE=
276 $1_FALSE='#'
277else
278 $1_TRUE='#'
279 $1_FALSE=
280fi])
281
3a629497
JB
282# Like AC_CONFIG_HEADER, but automatically create stamp file.
283
284AC_DEFUN(AM_CONFIG_HEADER,
285[AC_PREREQ([2.12])
286AC_CONFIG_HEADER([$1])
287dnl When config.status generates a header, we must update the stamp-h file.
288dnl This file resides in the same directory as the config header
289dnl that is generated. We must strip everything past the first ":",
290dnl and everything past the last "/".
291AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
c7b6463e
JB
292ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
293<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
294<<am_indx=1
295for am_file in <<$1>>; do
296 case " <<$>>CONFIG_HEADERS " in
297 *" <<$>>am_file "*<<)>>
298 echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
299 ;;
300 esac
301 am_indx=`expr "<<$>>am_indx" + 1`
302done<<>>dnl>>)
3a629497
JB
303changequote([,]))])
304
5aadf8c1 305
0e8a8468 306# serial 39 AC_PROG_LIBTOOL
1630ea6c
JB
307AC_DEFUN(AC_PROG_LIBTOOL,
308[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
309
310# Save cache, so that ltconfig can load it
311AC_CACHE_SAVE
312
313# Actually configure libtool. ac_aux_dir is where install-sh is found.
314CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
0e8a8468
MV
315LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
316LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
317DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
1630ea6c
JB
318${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
319$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
320|| AC_MSG_ERROR([libtool configure failed])
321
322# Reload cache, that may have been modified by ltconfig
323AC_CACHE_LOAD
324
325# This can be used to rebuild libtool when needed
326LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
327
328# Always use our own libtool.
329LIBTOOL='$(SHELL) $(top_builddir)/libtool'
330AC_SUBST(LIBTOOL)dnl
331
332# Redirect the config.log output again, so that the ltconfig log is not
333# clobbered by the next message.
334exec 5>>./config.log
335])
336
337AC_DEFUN(AC_LIBTOOL_SETUP,
338[AC_PREREQ(2.13)dnl
339AC_REQUIRE([AC_ENABLE_SHARED])dnl
340AC_REQUIRE([AC_ENABLE_STATIC])dnl
341AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
5798fd97 342AC_REQUIRE([AC_CANONICAL_HOST])dnl
1630ea6c 343AC_REQUIRE([AC_CANONICAL_BUILD])dnl
5798fd97
MD
344AC_REQUIRE([AC_PROG_RANLIB])dnl
345AC_REQUIRE([AC_PROG_CC])dnl
1630ea6c
JB
346AC_REQUIRE([AC_PROG_LD])dnl
347AC_REQUIRE([AC_PROG_NM])dnl
5798fd97
MD
348AC_REQUIRE([AC_PROG_LN_S])dnl
349dnl
5aadf8c1 350
5798fd97 351# Check for any special flags to pass to ltconfig.
1630ea6c 352libtool_flags="--cache-file=$cache_file"
5798fd97
MD
353test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
354test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
1630ea6c 355test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
5aadf8c1
MG
356test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
357test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
0e8a8468
MV
358ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
359[libtool_flags="$libtool_flags --enable-dlopen"])
360ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
361[libtool_flags="$libtool_flags --enable-win32-dll"])
362AC_ARG_ENABLE(libtool-lock,
363 [ --disable-libtool-lock avoid locking (might break parallel builds)])
364test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
365test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
5aadf8c1
MG
366
367# Some flags need to be propagated to the compiler or linker for good
368# libtool support.
5798fd97 369case "$host" in
5aadf8c1 370*-*-irix6*)
5798fd97
MD
371 # Find out which ABI we are using.
372 echo '[#]line __oline__ "configure"' > conftest.$ac_ext
373 if AC_TRY_EVAL(ac_compile); then
374 case "`/usr/bin/file conftest.o`" in
375 *32-bit*)
376 LD="${LD-ld} -32"
377 ;;
378 *N32*)
379 LD="${LD-ld} -n32"
380 ;;
381 *64-bit*)
382 LD="${LD-ld} -64"
383 ;;
384 esac
385 fi
386 rm -rf conftest*
5aadf8c1
MG
387 ;;
388
389*-*-sco3.2v5*)
390 # On SCO OpenServer 5, we need -belf to get full-featured binaries.
1630ea6c 391 SAVE_CFLAGS="$CFLAGS"
5aadf8c1 392 CFLAGS="$CFLAGS -belf"
1630ea6c
JB
393 AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
394 [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])])
395 if test x"$lt_cv_cc_needs_belf" != x"yes"; then
396 # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
397 CFLAGS="$SAVE_CFLAGS"
398 fi
3668b8c7 399 ;;
1630ea6c 400
0e8a8468
MV
401ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
402[*-*-cygwin* | *-*-mingw*)
403 AC_CHECK_TOOL(DLLTOOL, dlltool, false)
404 AC_CHECK_TOOL(AS, as, false)
405 AC_CHECK_TOOL(OBJDUMP, objdump, false)
1630ea6c 406 ;;
0e8a8468 407])
5798fd97 408esac
5aadf8c1
MG
409])
410
0e8a8468
MV
411# AC_LIBTOOL_DLOPEN - enable checks for dlopen support
412AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
413
414# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
415AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
1630ea6c
JB
416
417# AC_ENABLE_SHARED - implement the --enable-shared flag
418# Usage: AC_ENABLE_SHARED[(DEFAULT)]
5798fd97
MD
419# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
420# `yes'.
0e8a8468
MV
421AC_DEFUN(AC_ENABLE_SHARED, [dnl
422define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
5798fd97
MD
423AC_ARG_ENABLE(shared,
424changequote(<<, >>)dnl
1630ea6c 425<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
5798fd97 426changequote([, ])dnl
5798fd97
MD
427[p=${PACKAGE-default}
428case "$enableval" in
429yes) enable_shared=yes ;;
430no) enable_shared=no ;;
431*)
432 enable_shared=no
433 # Look at the argument we got. We use all the common list separators.
434 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
435 for pkg in $enableval; do
436 if test "X$pkg" = "X$p"; then
437 enable_shared=yes
438 fi
439 done
440 IFS="$ac_save_ifs"
441 ;;
442esac],
1630ea6c 443enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
5798fd97
MD
444])
445
1630ea6c 446# AC_DISABLE_SHARED - set the default shared flag to --disable-shared
0e8a8468
MV
447AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
448AC_ENABLE_SHARED(no)])
6c951427 449
1630ea6c
JB
450# AC_ENABLE_STATIC - implement the --enable-static flag
451# Usage: AC_ENABLE_STATIC[(DEFAULT)]
5798fd97
MD
452# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
453# `yes'.
0e8a8468
MV
454AC_DEFUN(AC_ENABLE_STATIC, [dnl
455define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
5798fd97
MD
456AC_ARG_ENABLE(static,
457changequote(<<, >>)dnl
1630ea6c 458<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
5798fd97 459changequote([, ])dnl
5798fd97
MD
460[p=${PACKAGE-default}
461case "$enableval" in
462yes) enable_static=yes ;;
463no) enable_static=no ;;
464*)
465 enable_static=no
466 # Look at the argument we got. We use all the common list separators.
467 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
468 for pkg in $enableval; do
469 if test "X$pkg" = "X$p"; then
470 enable_static=yes
471 fi
472 done
473 IFS="$ac_save_ifs"
474 ;;
475esac],
1630ea6c
JB
476enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
477])
478
479# AC_DISABLE_STATIC - set the default static flag to --disable-static
0e8a8468
MV
480AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
481AC_ENABLE_STATIC(no)])
1630ea6c
JB
482
483
484# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
485# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
486# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
487# `yes'.
0e8a8468
MV
488AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl
489define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
1630ea6c
JB
490AC_ARG_ENABLE(fast-install,
491changequote(<<, >>)dnl
492<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
493changequote([, ])dnl
494[p=${PACKAGE-default}
495case "$enableval" in
496yes) enable_fast_install=yes ;;
497no) enable_fast_install=no ;;
498*)
499 enable_fast_install=no
500 # Look at the argument we got. We use all the common list separators.
501 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
502 for pkg in $enableval; do
503 if test "X$pkg" = "X$p"; then
504 enable_fast_install=yes
505 fi
506 done
507 IFS="$ac_save_ifs"
508 ;;
509esac],
510enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
3668b8c7
MD
511])
512
1630ea6c 513# AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
0e8a8468
MV
514AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
515AC_ENABLE_FAST_INSTALL(no)])
1630ea6c
JB
516
517# AC_PROG_LD - find the path to the GNU or non-GNU linker
518AC_DEFUN(AC_PROG_LD,
5aadf8c1
MG
519[AC_ARG_WITH(gnu-ld,
520[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
521test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
1630ea6c
JB
522AC_REQUIRE([AC_PROG_CC])dnl
523AC_REQUIRE([AC_CANONICAL_HOST])dnl
524AC_REQUIRE([AC_CANONICAL_BUILD])dnl
5aadf8c1
MG
525ac_prog=ld
526if test "$ac_cv_prog_gcc" = yes; then
527 # Check if gcc -print-prog-name=ld gives a path.
528 AC_MSG_CHECKING([for ld used by GCC])
529 ac_prog=`($CC -print-prog-name=ld) 2>&5`
530 case "$ac_prog" in
1630ea6c 531 # Accept absolute paths.
3668b8c7 532changequote(,)dnl
0e8a8468 533 [\\/]* | [A-Za-z]:[\\/]*)
1630ea6c 534 re_direlt='/[^/][^/]*/\.\./'
3668b8c7 535changequote([,])dnl
1630ea6c
JB
536 # Canonicalize the path of ld
537 ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
538 while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
539 ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
540 done
541 test -z "$LD" && LD="$ac_prog"
542 ;;
5aadf8c1
MG
543 "")
544 # If it fails, then pretend we aren't using GCC.
545 ac_prog=ld
546 ;;
547 *)
548 # If it is relative, then search for the first ld in PATH.
549 with_gnu_ld=unknown
550 ;;
551 esac
552elif test "$with_gnu_ld" = yes; then
553 AC_MSG_CHECKING([for GNU ld])
554else
555 AC_MSG_CHECKING([for non-GNU ld])
556fi
557AC_CACHE_VAL(ac_cv_path_LD,
558[if test -z "$LD"; then
0e8a8468 559 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
5aadf8c1
MG
560 for ac_dir in $PATH; do
561 test -z "$ac_dir" && ac_dir=.
0e8a8468 562 if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
5aadf8c1
MG
563 ac_cv_path_LD="$ac_dir/$ac_prog"
564 # Check to see if the program is GNU ld. I'd rather use --version,
565 # but apparently some GNU ld's only accept -v.
566 # Break only if it was the GNU/non-GNU ld that we prefer.
567 if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
568 test "$with_gnu_ld" != no && break
569 else
1630ea6c 570 test "$with_gnu_ld" != yes && break
5aadf8c1
MG
571 fi
572 fi
573 done
574 IFS="$ac_save_ifs"
575else
576 ac_cv_path_LD="$LD" # Let the user override the test with a path.
577fi])
578LD="$ac_cv_path_LD"
579if test -n "$LD"; then
580 AC_MSG_RESULT($LD)
581else
582 AC_MSG_RESULT(no)
583fi
584test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
585AC_SUBST(LD)
1630ea6c 586AC_PROG_LD_GNU
5aadf8c1
MG
587])
588
1630ea6c 589AC_DEFUN(AC_PROG_LD_GNU,
5aadf8c1
MG
590[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
591[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
592if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
593 ac_cv_prog_gnu_ld=yes
594else
595 ac_cv_prog_gnu_ld=no
596fi])
597])
598
1630ea6c
JB
599# AC_PROG_NM - find the path to a BSD-compatible name lister
600AC_DEFUN(AC_PROG_NM,
5aadf8c1
MG
601[AC_MSG_CHECKING([for BSD-compatible nm])
602AC_CACHE_VAL(ac_cv_path_NM,
3668b8c7
MD
603[if test -n "$NM"; then
604 # Let the user override the test.
605 ac_cv_path_NM="$NM"
606else
0e8a8468 607 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
1630ea6c 608 for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
5798fd97 609 test -z "$ac_dir" && ac_dir=.
0e8a8468 610 if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then
5aadf8c1 611 # Check to see if the nm accepts a BSD-compat flag.
5798fd97
MD
612 # Adding the `sed 1q' prevents false positives on HP-UX, which says:
613 # nm: unknown option "B" ignored
614 if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
1630ea6c
JB
615 ac_cv_path_NM="$ac_dir/nm -B"
616 break
5798fd97 617 elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
1630ea6c
JB
618 ac_cv_path_NM="$ac_dir/nm -p"
619 break
5aadf8c1 620 else
1630ea6c
JB
621 ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
622 continue # so that we can try to find one that supports BSD flags
5aadf8c1 623 fi
5aadf8c1
MG
624 fi
625 done
626 IFS="$ac_save_ifs"
627 test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
3668b8c7 628fi])
5aadf8c1
MG
629NM="$ac_cv_path_NM"
630AC_MSG_RESULT([$NM])
631AC_SUBST(NM)
632])
633
0e8a8468
MV
634# AC_CHECK_LIBM - check for math library
635AC_DEFUN(AC_CHECK_LIBM,
1630ea6c 636[AC_REQUIRE([AC_CANONICAL_HOST])dnl
0e8a8468
MV
637LIBM=
638case "$host" in
639*-*-beos* | *-*-cygwin*)
640 # These system don't have libm
1630ea6c 641 ;;
0e8a8468
MV
642*-ncr-sysv4.3*)
643 AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
644 AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
1630ea6c 645 ;;
0e8a8468
MV
646*)
647 AC_CHECK_LIB(m, main, LIBM="-lm")
1630ea6c
JB
648 ;;
649esac
1630ea6c
JB
650])
651
652# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
653# the libltdl convenience library, adds --enable-ltdl-convenience to
654# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor
655# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed
656# to be `${top_builddir}/libltdl'. Make sure you start DIR with
657# '${top_builddir}/' (note the single quotes!) if your package is not
658# flat, and, if you're not using automake, define top_builddir as
659# appropriate in the Makefiles.
0e8a8468 660AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
1630ea6c
JB
661 case "$enable_ltdl_convenience" in
662 no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
663 "") enable_ltdl_convenience=yes
664 ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
665 esac
666 LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la
667])
668
669# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
670# the libltdl installable library, and adds --enable-ltdl-install to
671# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor
672# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed
673# to be `${top_builddir}/libltdl'. Make sure you start DIR with
674# '${top_builddir}/' (note the single quotes!) if your package is not
675# flat, and, if you're not using automake, define top_builddir as
676# appropriate in the Makefiles.
677# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
0e8a8468
MV
678AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
679 AC_CHECK_LIB(ltdl, main,
680 [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
681 [if test x"$enable_ltdl_install" = xno; then
682 AC_MSG_WARN([libltdl not installed, but installation disabled])
683 else
684 enable_ltdl_install=yes
685 fi
1630ea6c 686 ])
0e8a8468
MV
687 if test x"$enable_ltdl_install" = x"yes"; then
688 ac_configure_args="$ac_configure_args --enable-ltdl-install"
1630ea6c 689 LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la
0e8a8468
MV
690 else
691 ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
692 LIBLTDL="-lltdl"
1630ea6c
JB
693 fi
694])
695
696dnl old names
697AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
698AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
699AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
700AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
701AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
702AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
703AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
0e8a8468
MV
704
705dnl This is just to quiet aclocal about the macro not being used
706if(a,b,[AC_DISABLE_FAST_INSTALL])dnl
1630ea6c 707
e40ffcb6
JB
708
709# serial 1
710
711# @defmac AC_PROG_CC_STDC
712# @maindex PROG_CC_STDC
713# @ovindex CC
714# If the C compiler in not in ANSI C mode by default, try to add an option
715# to output variable @code{CC} to make it so. This macro tries various
716# options that select ANSI C on some system or another. It considers the
717# compiler to be in ANSI C mode if it handles function prototypes correctly.
718#
719# If you use this macro, you should check after calling it whether the C
720# compiler has been set to accept ANSI C; if not, the shell variable
721# @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source
722# code in ANSI C, you can make an un-ANSIfied copy of it by using the
723# program @code{ansi2knr}, which comes with Ghostscript.
724# @end defmac
725
726AC_DEFUN(AM_PROG_CC_STDC,
727[AC_REQUIRE([AC_PROG_CC])
728AC_BEFORE([$0], [AC_C_INLINE])
729AC_BEFORE([$0], [AC_C_CONST])
730dnl Force this before AC_PROG_CPP. Some cpp's, eg on HPUX, require
731dnl a magic option to avoid problems with ANSI preprocessor commands
732dnl like #elif.
733dnl FIXME: can't do this because then AC_AIX won't work due to a
734dnl circular dependency.
735dnl AC_BEFORE([$0], [AC_PROG_CPP])
736AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
737AC_CACHE_VAL(am_cv_prog_cc_stdc,
738[am_cv_prog_cc_stdc=no
739ac_save_CC="$CC"
740# Don't try gcc -ansi; that turns off useful extensions and
741# breaks some systems' header files.
742# AIX -qlanglvl=ansi
743# Ultrix and OSF/1 -std1
744# HP-UX -Aa -D_HPUX_SOURCE
745# SVR4 -Xc -D__EXTENSIONS__
746for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
747do
748 CC="$ac_save_CC $ac_arg"
749 AC_TRY_COMPILE(
750[#include <stdarg.h>
751#include <stdio.h>
752#include <sys/types.h>
753#include <sys/stat.h>
754/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
755struct buf { int x; };
756FILE * (*rcsopen) (struct buf *, struct stat *, int);
757static char *e (p, i)
758 char **p;
759 int i;
760{
761 return p[i];
762}
763static char *f (char * (*g) (char **, int), char **p, ...)
764{
765 char *s;
766 va_list v;
767 va_start (v,p);
768 s = g (p, va_arg (v,int));
769 va_end (v);
770 return s;
771}
772int test (int i, double x);
773struct s1 {int (*f) (int a);};
774struct s2 {int (*f) (double a);};
775int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
776int argc;
777char **argv;
778], [
779return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
780],
781[am_cv_prog_cc_stdc="$ac_arg"; break])
782done
783CC="$ac_save_CC"
784])
785if test -z "$am_cv_prog_cc_stdc"; then
786 AC_MSG_RESULT([none needed])
787else
788 AC_MSG_RESULT($am_cv_prog_cc_stdc)
789fi
790case "x$am_cv_prog_cc_stdc" in
791 x|xno) ;;
792 *) CC="$CC $am_cv_prog_cc_stdc" ;;
793esac
794])
795
539c89a1 796dnl Autoconf macros for configuring the QuickThreads package
3668b8c7
MD
797dnl Jim Blandy <jimb@red-bean.com> --- July 1998
798dnl
1630ea6c 799dnl Copyright (C) 1998, 1999 Free Software Foundation, Inc.
3668b8c7
MD
800dnl
801dnl This file is part of GUILE.
802dnl
803dnl GUILE is free software; you can redistribute it and/or modify
804dnl it under the terms of the GNU General Public License as
805dnl published by the Free Software Foundation; either version 2, or
806dnl (at your option) any later version.
807dnl
808dnl GUILE is distributed in the hope that it will be useful, but
809dnl WITHOUT ANY WARRANTY; without even the implied warranty of
810dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
811dnl GNU General Public License for more details.
812dnl
813dnl You should have received a copy of the GNU General Public
814dnl License along with GUILE; see the file COPYING. If not, write
815dnl to the Free Software Foundation, Inc., 59 Temple Place, Suite
816dnl 330, Boston, MA 02111-1307 USA
817
818
539c89a1
JB
819
820dnl QTHREADS_CONFIGURE configures the QuickThreads package. The QT
821dnl sources should be in $srcdir/qt. If configuration succeeds, this
822dnl macro creates the appropriate symlinks in the qt object directory,
823dnl and sets the following variables, used in building libqthreads.a:
824dnl QTHREAD_LTLIBS --- set to libqthreads.la if configuration
825dnl succeeds, or the empty string if configuration fails.
47521807
JB
826dnl qtmd_h, qtmds_s, qtmdc_c, qtdmdb_s --- the names of the machine-
827dnl dependent source files.
828dnl qthread_asflags --- flags to pass to the compiler when processing
829dnl assembly-language files.
3a629497 830dnl
539c89a1
JB
831dnl It also sets the following variables, which describe how clients
832dnl can link against libqthreads.a:
833dnl THREAD_PACKAGE --- set to "QT" if configuration succeeds, or
834dnl the empty string if configuration fails.
835dnl THREAD_CPPFLAGS --- set to `-I' flags for thread header files
836dnl THREAD_LIBS_LOCAL --- linker options for use in this source tree
837dnl THREAD_LIBS_INSTALLED --- linker options for use after this package
838dnl is installed
839dnl It would be nice if all thread configuration packages for Guile
840dnl followed the same conventions.
3a629497 841dnl
539c89a1
JB
842dnl All of the above variables will be substituted into Makefiles in
843dnl the usual autoconf fashion.
3a629497 844dnl
539c89a1
JB
845dnl We distinguish between THREAD_LIBS_LOCAL and
846dnl THREAD_LIBS_INSTALLED because the thread library might be in
847dnl this tree, and be built using libtool. This means that:
848dnl 1) when building other executables in this tree, one must
849dnl pass the relative path to the ../libfoo.la file, but
850dnl 2) once the whole package has been installed, users should
851dnl link using -lfoo.
852dnl Normally, we only care about the first case, but since the
bcc695e3 853dnl guile-config script needs to give users all the flags they need
539c89a1
JB
854dnl to link programs against guile, the GUILE_WITH_THREADS macro
855dnl needs to supply the second piece of information as well.
3a629497 856dnl
539c89a1
JB
857dnl This whole thing is a little confused about what ought to be
858dnl done in the top-level configure script, and what ought to be
47521807 859dnl taken care of in the subdirectory. For example, qtmds_s and
539c89a1
JB
860dnl friends really ought not to be even mentioned in the top-level
861dnl configure script, but here they are.
862
863AC_DEFUN([QTHREADS_CONFIGURE],[
7bc24529 864 AC_REQUIRE([AC_PROG_LN_S])
539c89a1 865
b8f08e26 866 AC_MSG_CHECKING(QuickThreads configuration)
539c89a1
JB
867 # How can we refer to the qt source directory from within the qt build
868 # directory? For headers, we can rely on the fact that the qt src
869 # directory appears in the #include path.
870 qtsrcdir="`(cd $srcdir; pwd)`/qt"
871
872 changequote(,)dnl We use [ and ] in a regexp in the case
873
874 THREAD_PACKAGE=QT
47521807 875 qthread_asflags=''
539c89a1
JB
876 case "$host" in
877 i[3456]86-*-*)
b8f08e26 878 port_name=i386
539c89a1
JB
879 qtmd_h=md/i386.h
880 qtmds_s=md/i386.s
881 qtmdc_c=md/null.c
882 qtdmdb_s=
47521807
JB
883 case "$host" in
884 *-*-netbsd* )
885 ## NetBSD needs to be told to pass the assembly code through
886 ## the C preprocessor. Other GCC installations seem to do
887 ## this by default, but NetBSD's doesn't. We could get the
888 ## same effect by giving the file a name ending with .S
889 ## instead of .s, but I don't see how to tell automake to do
890 ## that.
891 qthread_asflags='-x assembler-with-cpp'
892 ;;
893 esac
539c89a1
JB
894 ;;
895 mips-sgi-irix[56]*)
b8f08e26 896 port_name=irix
539c89a1
JB
897 qtmd_h=md/mips.h
898 qtmds_s=md/mips-irix5.s
899 qtmdc_c=md/null.c
900 qtdmdb_s=md/mips_b.s
901 ;;
902 mips-*-*)
b8f08e26 903 port_name=mips
539c89a1
JB
904 qtmd_h=md/mips.h
905 qtmds_s=md/mips.s
906 qtmdc_c=md/null.c
907 qtdmdb_s=md/mips_b.s
908 ;;
909 sparc-*-sunos*)
b8f08e26 910 port_name=sparc-sunos
539c89a1
JB
911 qtmd_h=md/sparc.h
912 qtmds_s=md/_sparc.s
913 qtmdc_c=md/null.c
914 qtdmdb_s=md/_sparc_b.s
915 ;;
916 sparc-*-*)
b8f08e26 917 port_name=sparc
539c89a1
JB
918 qtmd_h=md/sparc.h
919 qtmds_s=md/sparc.s
920 qtmdc_c=md/null.c
921 qtdmdb_s=md/sparc_b.s
922 ;;
1630ea6c 923 alpha*-*-*)
b8f08e26 924 port_name=alpha
539c89a1
JB
925 qtmd_h=md/axp.h
926 qtmds_s=md/axp.s
927 qtmdc_c=md/null.c
928 qtdmdb_s=md/axp_b.s
929 ;;
930 *)
931 echo "Unknown configuration; threads package disabled"
932 THREAD_PACKAGE=""
933 ;;
934 esac
935 changequote([, ])
936
937 # Did configuration succeed?
938 if test -n "$THREAD_PACKAGE"; then
b8f08e26 939 AC_MSG_RESULT($port_name)
539c89a1
JB
940 QTHREAD_LTLIBS=libqthreads.la
941 THREAD_CPPFLAGS="-I$qtsrcdir -I../qt"
942 THREAD_LIBS_LOCAL="../qt/libqthreads.la"
943 THREAD_LIBS_INSTALLED="-lqthreads"
b8f08e26
MD
944 else
945 AC_MSG_RESULT(none; disabled)
3a629497 946 fi
539c89a1
JB
947
948 AC_SUBST(QTHREAD_LTLIBS)
949 AC_SUBST(qtmd_h)
950 AC_SUBST(qtmds_s)
951 AC_SUBST(qtmdc_c)
952 AC_SUBST(qtdmdb_s)
47521807 953 AC_SUBST(qthread_asflags)
539c89a1
JB
954 AC_SUBST(THREAD_PACKAGE)
955 AC_SUBST(THREAD_CPPFLAGS)
956 AC_SUBST(THREAD_LIBS_LOCAL)
957 AC_SUBST(THREAD_LIBS_INSTALLED)
3a629497
JB
958])
959