* optargs.scm (lambda*): Handle empty argument lists properly.
[bpt/guile.git] / aclocal.m4
CommitLineData
5798fd97 1dnl aclocal.m4 generated automatically by aclocal 1.3
5aadf8c1 2
5798fd97 3dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
5aadf8c1
MG
4dnl This Makefile.in is free software; the Free Software Foundation
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,
167[AC_REQUIRE([AM_PROG_INSTALL])
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
JB
176ifelse([$3],,
177AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
178AC_DEFINE_UNQUOTED(VERSION, "$VERSION"))
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
TT
189
190
191# serial 1
192
193AC_DEFUN(AM_PROG_INSTALL,
194[AC_REQUIRE([AC_PROG_INSTALL])
195test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
196AC_SUBST(INSTALL_SCRIPT)dnl
ebf50833 197])
733943b9
TT
198
199#
200# Check to make sure that the build environment is sane.
201#
202
203AC_DEFUN(AM_SANITY_CHECK,
204[AC_MSG_CHECKING([whether build environment is sane])
1dc9c5b0
JB
205# Just in case
206sleep 1
733943b9 207echo timestamp > conftestfile
1dc9c5b0
JB
208# Do `set' in a subshell so we don't clobber the current shell's
209# arguments. Must try -L first in case configure is actually a
210# symlink; some systems play weird games with the mod time of symlinks
211# (eg FreeBSD returns the mod time of the symlink's containing
212# directory).
213if (
214 set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
5aadf8c1 215 if test "[$]*" = "X"; then
1dc9c5b0
JB
216 # -L didn't work.
217 set X `ls -t $srcdir/configure conftestfile`
218 fi
341eaef0
GH
219 if test "[$]*" != "X $srcdir/configure conftestfile" \
220 && test "[$]*" != "X conftestfile $srcdir/configure"; then
221
222 # If neither matched, then we have a broken ls. This can happen
223 # if, for instance, CONFIG_SHELL is bash and it inherits a
224 # broken ls alias from the environment. This has actually
225 # happened. Such a system could not be considered "sane".
226 AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
227alias in your environment])
228 fi
229
1dc9c5b0
JB
230 test "[$]2" = conftestfile
231 )
733943b9
TT
232then
233 # Ok.
234 :
235else
236 AC_MSG_ERROR([newly created file is older than distributed files!
237Check your system clock])
238fi
239rm -f conftest*
240AC_MSG_RESULT(yes)])
241
1dc9c5b0
JB
242dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
243dnl The program must properly implement --version.
244AC_DEFUN(AM_MISSING_PROG,
245[AC_MSG_CHECKING(for working $2)
246# Run test in a subshell; some versions of sh will print an error if
247# an executable is not found, even if stderr is redirected.
c7b6463e
JB
248# Redirect stdin to placate older versions of autoconf. Sigh.
249if ($2 --version) < /dev/null > /dev/null 2>&1; then
1dc9c5b0
JB
250 $1=$2
251 AC_MSG_RESULT(found)
252else
253 $1="$3/missing $2"
254 AC_MSG_RESULT(missing)
255fi
256AC_SUBST($1)])
257
15ae1bee
MD
258# Add --enable-maintainer-mode option to configure.
259# From Jim Meyering
260
261# serial 1
262
263AC_DEFUN(AM_MAINTAINER_MODE,
264[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
265 dnl maintainer-mode is disabled by default
266 AC_ARG_ENABLE(maintainer-mode,
267[ --enable-maintainer-mode enable make rules and dependencies not useful
268 (and sometimes confusing) to the casual installer],
269 USE_MAINTAINER_MODE=$enableval,
270 USE_MAINTAINER_MODE=no)
271 AC_MSG_RESULT($USE_MAINTAINER_MODE)
272 if test $USE_MAINTAINER_MODE = yes; then
273 MAINT=
274 else
275 MAINT='#M#'
276 fi
277 AC_SUBST(MAINT)dnl
278]
279)
280
3a629497
JB
281# Like AC_CONFIG_HEADER, but automatically create stamp file.
282
283AC_DEFUN(AM_CONFIG_HEADER,
284[AC_PREREQ([2.12])
285AC_CONFIG_HEADER([$1])
286dnl When config.status generates a header, we must update the stamp-h file.
287dnl This file resides in the same directory as the config header
288dnl that is generated. We must strip everything past the first ":",
289dnl and everything past the last "/".
290AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
c7b6463e
JB
291ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
292<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
293<<am_indx=1
294for am_file in <<$1>>; do
295 case " <<$>>CONFIG_HEADERS " in
296 *" <<$>>am_file "*<<)>>
297 echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
298 ;;
299 esac
300 am_indx=`expr "<<$>>am_indx" + 1`
301done<<>>dnl>>)
3a629497
JB
302changequote([,]))])
303
5aadf8c1 304
2c9a3a48 305# serial 24 AM_PROG_LIBTOOL
5aadf8c1 306AC_DEFUN(AM_PROG_LIBTOOL,
5798fd97
MD
307[AC_REQUIRE([AM_ENABLE_SHARED])dnl
308AC_REQUIRE([AM_ENABLE_STATIC])dnl
309AC_REQUIRE([AC_CANONICAL_HOST])dnl
310AC_REQUIRE([AC_PROG_RANLIB])dnl
311AC_REQUIRE([AC_PROG_CC])dnl
312AC_REQUIRE([AM_PROG_LD])dnl
313AC_REQUIRE([AM_PROG_NM])dnl
314AC_REQUIRE([AC_PROG_LN_S])dnl
315dnl
5aadf8c1
MG
316# Always use our own libtool.
317LIBTOOL='$(SHELL) $(top_builddir)/libtool'
5798fd97 318AC_SUBST(LIBTOOL)dnl
5aadf8c1 319
5798fd97
MD
320# Check for any special flags to pass to ltconfig.
321libtool_flags=
322test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
323test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
5aadf8c1
MG
324test "$silent" = yes && libtool_flags="$libtool_flags --silent"
325test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
326test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
327
328# Some flags need to be propagated to the compiler or linker for good
329# libtool support.
5798fd97 330case "$host" in
5aadf8c1 331*-*-irix6*)
5798fd97
MD
332 # Find out which ABI we are using.
333 echo '[#]line __oline__ "configure"' > conftest.$ac_ext
334 if AC_TRY_EVAL(ac_compile); then
335 case "`/usr/bin/file conftest.o`" in
336 *32-bit*)
337 LD="${LD-ld} -32"
338 ;;
339 *N32*)
340 LD="${LD-ld} -n32"
341 ;;
342 *64-bit*)
343 LD="${LD-ld} -64"
344 ;;
345 esac
346 fi
347 rm -rf conftest*
5aadf8c1
MG
348 ;;
349
350*-*-sco3.2v5*)
351 # On SCO OpenServer 5, we need -belf to get full-featured binaries.
352 CFLAGS="$CFLAGS -belf"
353 ;;
5798fd97 354esac
5aadf8c1
MG
355
356# Actually configure libtool. ac_aux_dir is where install-sh is found.
357CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
358LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \
2c9a3a48 359${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig \
5aadf8c1
MG
360$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
361|| AC_MSG_ERROR([libtool configure failed])
362])
363
5798fd97
MD
364# AM_ENABLE_SHARED - implement the --enable-shared flag
365# Usage: AM_ENABLE_SHARED[(DEFAULT)]
366# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
367# `yes'.
368AC_DEFUN(AM_ENABLE_SHARED,
369[define([AM_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
370AC_ARG_ENABLE(shared,
371changequote(<<, >>)dnl
2c9a3a48 372<< --enable-shared build shared libraries [default=>>AM_ENABLE_SHARED_DEFAULT]
5798fd97 373changequote([, ])dnl
2c9a3a48
JB
374[ --enable-shared=PKGS only build shared libraries if the current package
375 appears as an element in the PKGS list],
5798fd97
MD
376[p=${PACKAGE-default}
377case "$enableval" in
378yes) enable_shared=yes ;;
379no) enable_shared=no ;;
380*)
381 enable_shared=no
382 # Look at the argument we got. We use all the common list separators.
383 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
384 for pkg in $enableval; do
385 if test "X$pkg" = "X$p"; then
386 enable_shared=yes
387 fi
388 done
389 IFS="$ac_save_ifs"
390 ;;
391esac],
392enable_shared=AM_ENABLE_SHARED_DEFAULT)dnl
393])
394
395# AM_DISABLE_SHARED - set the default shared flag to --disable-shared
396AC_DEFUN(AM_DISABLE_SHARED,
397[AM_ENABLE_SHARED(no)])
398
399# AM_DISABLE_STATIC - set the default static flag to --disable-static
400AC_DEFUN(AM_DISABLE_STATIC,
401[AM_ENABLE_STATIC(no)])
402
403# AM_ENABLE_STATIC - implement the --enable-static flag
404# Usage: AM_ENABLE_STATIC[(DEFAULT)]
405# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
406# `yes'.
407AC_DEFUN(AM_ENABLE_STATIC,
408[define([AM_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
409AC_ARG_ENABLE(static,
410changequote(<<, >>)dnl
2c9a3a48 411<< --enable-static build static libraries [default=>>AM_ENABLE_STATIC_DEFAULT]
5798fd97 412changequote([, ])dnl
2c9a3a48
JB
413[ --enable-static=PKGS only build shared libraries if the current package
414 appears as an element in the PKGS list],
5798fd97
MD
415[p=${PACKAGE-default}
416case "$enableval" in
417yes) enable_static=yes ;;
418no) enable_static=no ;;
419*)
420 enable_static=no
421 # Look at the argument we got. We use all the common list separators.
422 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
423 for pkg in $enableval; do
424 if test "X$pkg" = "X$p"; then
425 enable_static=yes
426 fi
427 done
428 IFS="$ac_save_ifs"
429 ;;
430esac],
431enable_static=AM_ENABLE_STATIC_DEFAULT)dnl
432])
433
434
5aadf8c1
MG
435# AM_PROG_LD - find the path to the GNU or non-GNU linker
436AC_DEFUN(AM_PROG_LD,
437[AC_ARG_WITH(gnu-ld,
438[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
439test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
440AC_REQUIRE([AC_PROG_CC])
441ac_prog=ld
442if test "$ac_cv_prog_gcc" = yes; then
443 # Check if gcc -print-prog-name=ld gives a path.
444 AC_MSG_CHECKING([for ld used by GCC])
445 ac_prog=`($CC -print-prog-name=ld) 2>&5`
446 case "$ac_prog" in
447 # Accept absolute paths.
5798fd97 448 /* | [A-Za-z]:\\*)
ef0f106f
TP
449 test -z "$LD" && LD="$ac_prog"
450 ;;
5aadf8c1
MG
451 "")
452 # If it fails, then pretend we aren't using GCC.
453 ac_prog=ld
454 ;;
455 *)
456 # If it is relative, then search for the first ld in PATH.
457 with_gnu_ld=unknown
458 ;;
459 esac
460elif test "$with_gnu_ld" = yes; then
461 AC_MSG_CHECKING([for GNU ld])
462else
463 AC_MSG_CHECKING([for non-GNU ld])
464fi
465AC_CACHE_VAL(ac_cv_path_LD,
466[if test -z "$LD"; then
467 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
468 for ac_dir in $PATH; do
469 test -z "$ac_dir" && ac_dir=.
470 if test -f "$ac_dir/$ac_prog"; then
471 ac_cv_path_LD="$ac_dir/$ac_prog"
472 # Check to see if the program is GNU ld. I'd rather use --version,
473 # but apparently some GNU ld's only accept -v.
474 # Break only if it was the GNU/non-GNU ld that we prefer.
475 if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
476 test "$with_gnu_ld" != no && break
477 else
478 test "$with_gnu_ld" != yes && break
479 fi
480 fi
481 done
482 IFS="$ac_save_ifs"
483else
484 ac_cv_path_LD="$LD" # Let the user override the test with a path.
485fi])
486LD="$ac_cv_path_LD"
487if test -n "$LD"; then
488 AC_MSG_RESULT($LD)
489else
490 AC_MSG_RESULT(no)
491fi
492test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
493AC_SUBST(LD)
494AM_PROG_LD_GNU
495])
496
497AC_DEFUN(AM_PROG_LD_GNU,
498[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
499[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
500if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
501 ac_cv_prog_gnu_ld=yes
502else
503 ac_cv_prog_gnu_ld=no
504fi])
505])
506
507# AM_PROG_NM - find the path to a BSD-compatible name lister
508AC_DEFUN(AM_PROG_NM,
509[AC_MSG_CHECKING([for BSD-compatible nm])
510AC_CACHE_VAL(ac_cv_path_NM,
2c9a3a48
JB
511[case "$NM" in
512/* | [A-Za-z]:\\*)
513 ac_cv_path_NM="$NM" # Let the user override the test with a path.
514 ;;
515*)
5aadf8c1 516 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
5798fd97
MD
517 for ac_dir in /usr/ucb /usr/ccs/bin $PATH /bin; do
518 test -z "$ac_dir" && ac_dir=.
5aadf8c1
MG
519 if test -f $ac_dir/nm; then
520 # Check to see if the nm accepts a BSD-compat flag.
5798fd97
MD
521 # Adding the `sed 1q' prevents false positives on HP-UX, which says:
522 # nm: unknown option "B" ignored
523 if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
5aadf8c1 524 ac_cv_path_NM="$ac_dir/nm -B"
5798fd97 525 elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
5aadf8c1
MG
526 ac_cv_path_NM="$ac_dir/nm -p"
527 else
528 ac_cv_path_NM="$ac_dir/nm"
529 fi
530 break
531 fi
532 done
533 IFS="$ac_save_ifs"
534 test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
2c9a3a48
JB
535 ;;
536esac])
5aadf8c1
MG
537NM="$ac_cv_path_NM"
538AC_MSG_RESULT([$NM])
539AC_SUBST(NM)
540])
541
e40ffcb6
JB
542
543# serial 1
544
545# @defmac AC_PROG_CC_STDC
546# @maindex PROG_CC_STDC
547# @ovindex CC
548# If the C compiler in not in ANSI C mode by default, try to add an option
549# to output variable @code{CC} to make it so. This macro tries various
550# options that select ANSI C on some system or another. It considers the
551# compiler to be in ANSI C mode if it handles function prototypes correctly.
552#
553# If you use this macro, you should check after calling it whether the C
554# compiler has been set to accept ANSI C; if not, the shell variable
555# @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source
556# code in ANSI C, you can make an un-ANSIfied copy of it by using the
557# program @code{ansi2knr}, which comes with Ghostscript.
558# @end defmac
559
560AC_DEFUN(AM_PROG_CC_STDC,
561[AC_REQUIRE([AC_PROG_CC])
562AC_BEFORE([$0], [AC_C_INLINE])
563AC_BEFORE([$0], [AC_C_CONST])
564dnl Force this before AC_PROG_CPP. Some cpp's, eg on HPUX, require
565dnl a magic option to avoid problems with ANSI preprocessor commands
566dnl like #elif.
567dnl FIXME: can't do this because then AC_AIX won't work due to a
568dnl circular dependency.
569dnl AC_BEFORE([$0], [AC_PROG_CPP])
570AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
571AC_CACHE_VAL(am_cv_prog_cc_stdc,
572[am_cv_prog_cc_stdc=no
573ac_save_CC="$CC"
574# Don't try gcc -ansi; that turns off useful extensions and
575# breaks some systems' header files.
576# AIX -qlanglvl=ansi
577# Ultrix and OSF/1 -std1
578# HP-UX -Aa -D_HPUX_SOURCE
579# SVR4 -Xc -D__EXTENSIONS__
580for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
581do
582 CC="$ac_save_CC $ac_arg"
583 AC_TRY_COMPILE(
584[#include <stdarg.h>
585#include <stdio.h>
586#include <sys/types.h>
587#include <sys/stat.h>
588/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
589struct buf { int x; };
590FILE * (*rcsopen) (struct buf *, struct stat *, int);
591static char *e (p, i)
592 char **p;
593 int i;
594{
595 return p[i];
596}
597static char *f (char * (*g) (char **, int), char **p, ...)
598{
599 char *s;
600 va_list v;
601 va_start (v,p);
602 s = g (p, va_arg (v,int));
603 va_end (v);
604 return s;
605}
606int test (int i, double x);
607struct s1 {int (*f) (int a);};
608struct s2 {int (*f) (double a);};
609int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
610int argc;
611char **argv;
612], [
613return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
614],
615[am_cv_prog_cc_stdc="$ac_arg"; break])
616done
617CC="$ac_save_CC"
618])
619if test -z "$am_cv_prog_cc_stdc"; then
620 AC_MSG_RESULT([none needed])
621else
622 AC_MSG_RESULT($am_cv_prog_cc_stdc)
623fi
624case "x$am_cv_prog_cc_stdc" in
625 x|xno) ;;
626 *) CC="$CC $am_cv_prog_cc_stdc" ;;
627esac
628])
629
539c89a1 630dnl Autoconf macros for configuring the QuickThreads package
38616540
JB
631dnl Jim Blandy <jimb@red-bean.com> --- July 1998
632dnl
633dnl Copyright (C) 1998 Free Software Foundation, Inc.
634dnl
635dnl This file is part of GUILE.
636dnl
637dnl GUILE is free software; you can redistribute it and/or modify
638dnl it under the terms of the GNU General Public License as
639dnl published by the Free Software Foundation; either version 2, or
640dnl (at your option) any later version.
641dnl
642dnl GUILE is distributed in the hope that it will be useful, but
643dnl WITHOUT ANY WARRANTY; without even the implied warranty of
644dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645dnl GNU General Public License for more details.
646dnl
647dnl You should have received a copy of the GNU General Public
648dnl License along with GUILE; see the file COPYING. If not, write
649dnl to the Free Software Foundation, Inc., 59 Temple Place, Suite
650dnl 330, Boston, MA 02111-1307 USA
651
652
539c89a1
JB
653
654dnl QTHREADS_CONFIGURE configures the QuickThreads package. The QT
655dnl sources should be in $srcdir/qt. If configuration succeeds, this
656dnl macro creates the appropriate symlinks in the qt object directory,
657dnl and sets the following variables, used in building libqthreads.a:
658dnl QTHREAD_LTLIBS --- set to libqthreads.la if configuration
659dnl succeeds, or the empty string if configuration fails.
47521807
JB
660dnl qtmd_h, qtmds_s, qtmdc_c, qtdmdb_s --- the names of the machine-
661dnl dependent source files.
662dnl qthread_asflags --- flags to pass to the compiler when processing
663dnl assembly-language files.
3a629497 664dnl
539c89a1
JB
665dnl It also sets the following variables, which describe how clients
666dnl can link against libqthreads.a:
667dnl THREAD_PACKAGE --- set to "QT" if configuration succeeds, or
668dnl the empty string if configuration fails.
669dnl THREAD_CPPFLAGS --- set to `-I' flags for thread header files
670dnl THREAD_LIBS_LOCAL --- linker options for use in this source tree
671dnl THREAD_LIBS_INSTALLED --- linker options for use after this package
672dnl is installed
673dnl It would be nice if all thread configuration packages for Guile
674dnl followed the same conventions.
3a629497 675dnl
539c89a1
JB
676dnl All of the above variables will be substituted into Makefiles in
677dnl the usual autoconf fashion.
3a629497 678dnl
539c89a1
JB
679dnl We distinguish between THREAD_LIBS_LOCAL and
680dnl THREAD_LIBS_INSTALLED because the thread library might be in
681dnl this tree, and be built using libtool. This means that:
682dnl 1) when building other executables in this tree, one must
683dnl pass the relative path to the ../libfoo.la file, but
684dnl 2) once the whole package has been installed, users should
685dnl link using -lfoo.
686dnl Normally, we only care about the first case, but since the
bcc695e3 687dnl guile-config script needs to give users all the flags they need
539c89a1
JB
688dnl to link programs against guile, the GUILE_WITH_THREADS macro
689dnl needs to supply the second piece of information as well.
3a629497 690dnl
539c89a1
JB
691dnl This whole thing is a little confused about what ought to be
692dnl done in the top-level configure script, and what ought to be
47521807 693dnl taken care of in the subdirectory. For example, qtmds_s and
539c89a1
JB
694dnl friends really ought not to be even mentioned in the top-level
695dnl configure script, but here they are.
696
697AC_DEFUN([QTHREADS_CONFIGURE],[
7bc24529 698 AC_REQUIRE([AC_PROG_LN_S])
539c89a1 699
b8f08e26 700 AC_MSG_CHECKING(QuickThreads configuration)
539c89a1
JB
701 # How can we refer to the qt source directory from within the qt build
702 # directory? For headers, we can rely on the fact that the qt src
703 # directory appears in the #include path.
704 qtsrcdir="`(cd $srcdir; pwd)`/qt"
705
706 changequote(,)dnl We use [ and ] in a regexp in the case
707
708 THREAD_PACKAGE=QT
47521807 709 qthread_asflags=''
539c89a1
JB
710 case "$host" in
711 i[3456]86-*-*)
b8f08e26 712 port_name=i386
539c89a1
JB
713 qtmd_h=md/i386.h
714 qtmds_s=md/i386.s
715 qtmdc_c=md/null.c
716 qtdmdb_s=
47521807
JB
717 case "$host" in
718 *-*-netbsd* )
719 ## NetBSD needs to be told to pass the assembly code through
720 ## the C preprocessor. Other GCC installations seem to do
721 ## this by default, but NetBSD's doesn't. We could get the
722 ## same effect by giving the file a name ending with .S
723 ## instead of .s, but I don't see how to tell automake to do
724 ## that.
725 qthread_asflags='-x assembler-with-cpp'
726 ;;
727 esac
539c89a1
JB
728 ;;
729 mips-sgi-irix[56]*)
b8f08e26 730 port_name=irix
539c89a1
JB
731 qtmd_h=md/mips.h
732 qtmds_s=md/mips-irix5.s
733 qtmdc_c=md/null.c
734 qtdmdb_s=md/mips_b.s
735 ;;
736 mips-*-*)
b8f08e26 737 port_name=mips
539c89a1
JB
738 qtmd_h=md/mips.h
739 qtmds_s=md/mips.s
740 qtmdc_c=md/null.c
741 qtdmdb_s=md/mips_b.s
742 ;;
743 sparc-*-sunos*)
b8f08e26 744 port_name=sparc-sunos
539c89a1
JB
745 qtmd_h=md/sparc.h
746 qtmds_s=md/_sparc.s
747 qtmdc_c=md/null.c
748 qtdmdb_s=md/_sparc_b.s
749 ;;
750 sparc-*-*)
b8f08e26 751 port_name=sparc
539c89a1
JB
752 qtmd_h=md/sparc.h
753 qtmds_s=md/sparc.s
754 qtmdc_c=md/null.c
755 qtdmdb_s=md/sparc_b.s
756 ;;
757 alpha-*-*)
b8f08e26 758 port_name=alpha
539c89a1
JB
759 qtmd_h=md/axp.h
760 qtmds_s=md/axp.s
761 qtmdc_c=md/null.c
762 qtdmdb_s=md/axp_b.s
763 ;;
764 *)
765 echo "Unknown configuration; threads package disabled"
766 THREAD_PACKAGE=""
767 ;;
768 esac
769 changequote([, ])
770
771 # Did configuration succeed?
772 if test -n "$THREAD_PACKAGE"; then
b8f08e26 773 AC_MSG_RESULT($port_name)
539c89a1
JB
774 QTHREAD_LTLIBS=libqthreads.la
775 THREAD_CPPFLAGS="-I$qtsrcdir -I../qt"
776 THREAD_LIBS_LOCAL="../qt/libqthreads.la"
777 THREAD_LIBS_INSTALLED="-lqthreads"
b8f08e26
MD
778 else
779 AC_MSG_RESULT(none; disabled)
3a629497 780 fi
539c89a1
JB
781
782 AC_SUBST(QTHREAD_LTLIBS)
783 AC_SUBST(qtmd_h)
784 AC_SUBST(qtmds_s)
785 AC_SUBST(qtmdc_c)
786 AC_SUBST(qtdmdb_s)
47521807 787 AC_SUBST(qthread_asflags)
539c89a1
JB
788 AC_SUBST(THREAD_PACKAGE)
789 AC_SUBST(THREAD_CPPFLAGS)
790 AC_SUBST(THREAD_LIBS_LOCAL)
791 AC_SUBST(THREAD_LIBS_INSTALLED)
3a629497
JB
792])
793