scm_array_map & co
[bpt/guile.git] / aclocal.m4
CommitLineData
c7b6463e 1dnl aclocal.m4 generated automatically by aclocal 1.1p
ebf50833 2
3a629497
JB
3dnl On the NeXT, #including <utime.h> doesn't give you a definition for
4dnl struct utime, unless you #define _POSIX_SOURCE.
5
6AC_DEFUN(GUILE_STRUCT_UTIMBUF, [
7 AC_CACHE_CHECK([whether we need POSIX to get struct utimbuf],
8 guile_cv_struct_utimbuf_needs_posix,
9 [AC_TRY_CPP([
10#ifdef __EMX__
11#include <sys/utime.h>
12#else
13#include <utime.h>
14#endif
15struct utime blah;
16],
17 guile_cv_struct_utimbuf_needs_posix=no,
18 guile_cv_struct_utimbuf_needs_posix=yes)])
19 if test "$guile_cv_struct_utimbuf_needs_posix" = yes; then
20 AC_DEFINE(UTIMBUF_NEEDS_POSIX)
21 fi])
22
23
24
25
26dnl
27dnl Apparently, at CMU they have a weird version of libc.h that is
28dnl installed in /usr/local/include and conflicts with unistd.h.
29dnl In these situations, we should not #include libc.h.
30dnl This test arranges to #define LIBC_H_WITH_UNISTD_H iff libc.h is
31dnl present on the system, and is safe to #include.
32dnl
33AC_DEFUN([GUILE_HEADER_LIBC_WITH_UNISTD],
34 [
35 AC_CHECK_HEADERS(libc.h unistd.h)
36 AC_CACHE_CHECK(
37 "whether libc.h and unistd.h can be included together",
38 guile_cv_header_libc_with_unistd,
39 [
40 if test "$ac_cv_header_libc_h" = "no"; then
41 guile_cv_header_libc_with_unistd="no"
42 elif test "$ac_cv_header_unistd.h" = "no"; then
43 guile_cv_header_libc_with_unistd="yes"
44 else
45 AC_TRY_COMPILE(
46 [
47# include <libc.h>
48# include <unistd.h>
49 ],
50 [],
51 [guile_cv_header_libc_with_unistd=yes],
52 [guile_cv_header_libc_with_unistd=no]
53 )
54 fi
55 ]
56 )
57 if test "$guile_cv_header_libc_with_unistd" = yes; then
58 AC_DEFINE(LIBC_H_WITH_UNISTD_H)
59 fi
60 ]
61)
62
0b89e78e
MD
63
64
65dnl This is needed when we want to check for the same function repeatedly
66dnl with other parameters, such as libraries, varying.
67dnl
68dnl GUILE_NAMED_CHECK_FUNC(FUNCTION, TESTNAME,
69dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
70AC_DEFUN(GUILE_NAMED_CHECK_FUNC,
71[AC_MSG_CHECKING([for $1])
72AC_CACHE_VAL(ac_cv_func_$1_$2,
73[AC_TRY_LINK(
74dnl Don't include <ctype.h> because on OSF/1 3.0 it includes <sys/types.h>
75dnl which includes <sys/select.h> which contains a prototype for
76dnl select. Similarly for bzero.
77[/* System header to define __stub macros and hopefully few prototypes,
78 which can conflict with char $1(); below. */
79#include <assert.h>
80/* Override any gcc2 internal prototype to avoid an error. */
81]ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplus
82extern "C"
83#endif
84])dnl
85[/* We use char because int might match the return type of a gcc2
86 builtin and then its argument prototype would still apply. */
87char $1();
88], [
89/* The GNU C library defines this for functions which it implements
90 to always fail with ENOSYS. Some functions are actually named
91 something starting with __ and the normal name is an alias. */
92#if defined (__stub_$1) || defined (__stub___$1)
93choke me
94#else
95$1();
96#endif
97], eval "ac_cv_func_$1_$2=yes", eval "ac_cv_func_$1_$2=no")])
98if eval "test \"`echo '$ac_cv_func_'$1'_'$2`\" = yes"; then
99 AC_MSG_RESULT(yes)
100 ifelse([$3], , :, [$3])
101else
102 AC_MSG_RESULT(no)
103ifelse([$4], , , [$4
104])dnl
105fi
106])
107
733943b9
TT
108# Do all the work for Automake. This macro actually does too much --
109# some checks are only needed if your package does certain things.
110# But this isn't really a big deal.
111
112# serial 1
113
114dnl Usage:
1dc9c5b0 115dnl AM_INIT_AUTOMAKE(package,version, [no-define])
733943b9
TT
116
117AC_DEFUN(AM_INIT_AUTOMAKE,
118[AC_REQUIRE([AM_PROG_INSTALL])
119PACKAGE=[$1]
120AC_SUBST(PACKAGE)
733943b9
TT
121VERSION=[$2]
122AC_SUBST(VERSION)
c7b6463e
JB
123dnl test to see if srcdir already configured
124if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
125 AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
126fi
1dc9c5b0
JB
127ifelse([$3],,
128AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
129AC_DEFINE_UNQUOTED(VERSION, "$VERSION"))
733943b9
TT
130AM_SANITY_CHECK
131AC_ARG_PROGRAM
1dc9c5b0
JB
132dnl FIXME This is truly gross.
133missing_dir=`cd $ac_aux_dir && pwd`
134AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
135AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
136AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
137AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
138AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
733943b9
TT
139AC_PROG_MAKE_SET])
140
141
142# serial 1
143
144AC_DEFUN(AM_PROG_INSTALL,
145[AC_REQUIRE([AC_PROG_INSTALL])
146test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
147AC_SUBST(INSTALL_SCRIPT)dnl
ebf50833 148])
733943b9
TT
149
150#
151# Check to make sure that the build environment is sane.
152#
153
154AC_DEFUN(AM_SANITY_CHECK,
155[AC_MSG_CHECKING([whether build environment is sane])
1dc9c5b0
JB
156# Just in case
157sleep 1
733943b9 158echo timestamp > conftestfile
1dc9c5b0
JB
159# Do `set' in a subshell so we don't clobber the current shell's
160# arguments. Must try -L first in case configure is actually a
161# symlink; some systems play weird games with the mod time of symlinks
162# (eg FreeBSD returns the mod time of the symlink's containing
163# directory).
164if (
165 set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
166 if test "$@" = "X"; then
167 # -L didn't work.
168 set X `ls -t $srcdir/configure conftestfile`
169 fi
170 test "[$]2" = conftestfile
171 )
733943b9
TT
172then
173 # Ok.
174 :
175else
176 AC_MSG_ERROR([newly created file is older than distributed files!
177Check your system clock])
178fi
179rm -f conftest*
180AC_MSG_RESULT(yes)])
181
1dc9c5b0
JB
182dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
183dnl The program must properly implement --version.
184AC_DEFUN(AM_MISSING_PROG,
185[AC_MSG_CHECKING(for working $2)
186# Run test in a subshell; some versions of sh will print an error if
187# an executable is not found, even if stderr is redirected.
c7b6463e
JB
188# Redirect stdin to placate older versions of autoconf. Sigh.
189if ($2 --version) < /dev/null > /dev/null 2>&1; then
1dc9c5b0
JB
190 $1=$2
191 AC_MSG_RESULT(found)
192else
193 $1="$3/missing $2"
194 AC_MSG_RESULT(missing)
195fi
196AC_SUBST($1)])
197
15ae1bee
MD
198# Add --enable-maintainer-mode option to configure.
199# From Jim Meyering
200
201# serial 1
202
203AC_DEFUN(AM_MAINTAINER_MODE,
204[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
205 dnl maintainer-mode is disabled by default
206 AC_ARG_ENABLE(maintainer-mode,
207[ --enable-maintainer-mode enable make rules and dependencies not useful
208 (and sometimes confusing) to the casual installer],
209 USE_MAINTAINER_MODE=$enableval,
210 USE_MAINTAINER_MODE=no)
211 AC_MSG_RESULT($USE_MAINTAINER_MODE)
212 if test $USE_MAINTAINER_MODE = yes; then
213 MAINT=
214 else
215 MAINT='#M#'
216 fi
217 AC_SUBST(MAINT)dnl
218]
219)
220
3a629497
JB
221# Like AC_CONFIG_HEADER, but automatically create stamp file.
222
223AC_DEFUN(AM_CONFIG_HEADER,
224[AC_PREREQ([2.12])
225AC_CONFIG_HEADER([$1])
226dnl When config.status generates a header, we must update the stamp-h file.
227dnl This file resides in the same directory as the config header
228dnl that is generated. We must strip everything past the first ":",
229dnl and everything past the last "/".
230AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
c7b6463e
JB
231ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
232<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
233<<am_indx=1
234for am_file in <<$1>>; do
235 case " <<$>>CONFIG_HEADERS " in
236 *" <<$>>am_file "*<<)>>
237 echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
238 ;;
239 esac
240 am_indx=`expr "<<$>>am_indx" + 1`
241done<<>>dnl>>)
3a629497
JB
242changequote([,]))])
243
244
553f653a 245# serial 11 AM_PROG_LIBTOOL
3a629497
JB
246AC_DEFUN(AM_PROG_LIBTOOL,
247[AC_REQUIRE([AC_CANONICAL_HOST])
3a629497 248AC_REQUIRE([AC_PROG_RANLIB])
553f653a 249AC_REQUIRE([AC_PROG_CC])
02fbff5e 250AC_REQUIRE([AM_PROG_LD])
553f653a 251AC_REQUIRE([AM_PROG_NM])
02fbff5e 252AC_REQUIRE([AC_PROG_LN_S])
3a629497
JB
253
254# Always use our own libtool.
255LIBTOOL='$(top_builddir)/libtool'
256AC_SUBST(LIBTOOL)
257
258dnl Allow the --disable-shared flag to stop us from building shared libs.
259AC_ARG_ENABLE(shared,
260[ --enable-shared build shared libraries [default=yes]],
553f653a
JB
261[if test "$enableval" = no; then
262 enable_shared=no
263else
264 enable_shared=yes
265fi])
266libtool_shared=
267test "$enable_shared" = no && libtool_shared=" --disable-shared"
3a629497 268
7228e897
JB
269dnl Allow the --disable-static flag to stop us from building static libs.
270AC_ARG_ENABLE(static,
271[ --enable-static build static libraries [default=yes]],
553f653a
JB
272[if test "$enableval" = no; then
273 enable_static=no
274else
275 enable_static=yes
276fi])
277libtool_static=
278test "$enable_static" = no && libtool_static=" --disable-static"
7228e897
JB
279
280libtool_flags="$libtool_shared$libtool_static"
3a629497
JB
281test "$silent" = yes && libtool_flags="$libtool_flags --silent"
282test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
02fbff5e 283test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
3a629497 284
7228e897
JB
285# Some flags need to be propagated to the compiler or linker for good
286# libtool support.
3a629497
JB
287[case "$host" in
288*-*-irix6*)
553f653a
JB
289 ac_save_CFLAGS="$CFLAGS"
290 # -n32 always needs to be added to the linker when using GCC.
291 test "$ac_cv_prog_gcc" = yes && CFLAGS="$CFLAGS -n32"
7228e897
JB
292 for f in '-32' '-64' '-cckr' '-n32' '-mips1' '-mips2' '-mips3' '-mips4'; do
293 if echo " $CC $CFLAGS " | egrep -e "[ ]$f[ ]" > /dev/null; then
294 LD="${LD-ld} $f"
295 fi
296 done
553f653a 297 CFLAGS="$ac_save_CFLAGS"
3a629497
JB
298 ;;
299
300*-*-sco3.2v5*)
301 # On SCO OpenServer 5, we need -belf to get full-featured binaries.
302 CFLAGS="$CFLAGS -belf"
303 ;;
304esac]
305
306# Actually configure libtool. ac_aux_dir is where install-sh is found.
02fbff5e 307CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
553f653a 308LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \
3a629497
JB
309${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig \
310$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
311|| AC_MSG_ERROR([libtool configure failed])
312])
313
02fbff5e
MD
314# AM_PROG_LD - find the path to the GNU or non-GNU linker
315AC_DEFUN(AM_PROG_LD,
316[AC_ARG_WITH(gnu-ld,
317[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
318test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
553f653a
JB
319AC_REQUIRE([AC_PROG_CC])
320ac_prog=ld
321if test "$ac_cv_prog_gcc" = yes; then
322 # Check if gcc -print-prog-name=ld gives a path.
323 AC_MSG_CHECKING([for ld used by GCC])
324 ac_prog=`($CC -print-prog-name=ld) 2>&5`
325 case "$ac_prog" in
326 # Accept absolute paths.
327 /*) ;;
328 "")
329 # If it fails, then pretend we aren't using GCC.
330 ac_prog=ld
331 ;;
332 *)
333 # If it is relative, then search for the first ld in PATH.
334 with_gnu_ld=unknown
335 ;;
336 esac
337elif test "$with_gnu_ld" = yes; then
02fbff5e
MD
338 AC_MSG_CHECKING([for GNU ld])
339else
340 AC_MSG_CHECKING([for non-GNU ld])
341fi
342AC_CACHE_VAL(ac_cv_path_LD,
553f653a
JB
343[LD=${LD-$ac_prog}
344case "$LD" in
7228e897 345 /*)
365d0782 346 ac_cv_path_LD="$LD" # Let the user override the test with a path.
7228e897
JB
347 ;;
348 *)
349 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
350 for ac_dir in $PATH; do
351 test -z "$ac_dir" && ac_dir=.
553f653a
JB
352 if test -f "$ac_dir/$ac_prog"; then
353 ac_cv_path_LD="$ac_dir/$ac_prog"
7228e897
JB
354 # Check to see if the program is GNU ld. I'd rather use --version,
355 # but apparently some GNU ld's only accept -v.
02fbff5e 356 # Break only if it was the GNU/non-GNU ld that we prefer.
553f653a
JB
357 if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
358 test "$with_gnu_ld" != no && break
7228e897 359 else
02fbff5e 360 test "$with_gnu_ld" != yes && break
7228e897
JB
361 fi
362 fi
363 done
364 IFS="$ac_save_ifs"
365 ;;
366esac])
02fbff5e 367LD="$ac_cv_path_LD"
7228e897
JB
368if test -n "$LD"; then
369 AC_MSG_RESULT($LD)
370else
371 AC_MSG_RESULT(no)
372fi
373test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
374AC_SUBST(LD)
02fbff5e
MD
375AM_PROG_LD_GNU
376])
377
378AC_DEFUN(AM_PROG_LD_GNU,
379[AC_CACHE_CHECK([whether we are using GNU ld], ac_cv_prog_gnu_ld,
380[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
553f653a 381if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' > /dev/null; then
02fbff5e
MD
382 ac_cv_prog_gnu_ld=yes
383else
384 ac_cv_prog_gnu_ld=no
385fi])
7228e897
JB
386])
387
553f653a
JB
388# AM_PROG_NM - find the path to a BSD-compatible name lister
389AC_DEFUN(AM_PROG_NM,
390[AC_MSG_CHECKING([for BSD-compatible nm])
391AC_CACHE_VAL(ac_cv_path_NM,
392[case "$NM" in
393/*)
394 ac_cv_path_NM="$NM" # Let the user override the test with a path.
395 ;;
396*)
397 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
398 for ac_dir in /usr/ucb:$PATH:/bin; do
399 test -z "$ac_dir" && dir=.
400 if test -f $ac_dir/nm; then
401 # Check to see if the nm accepts a BSD-compat flag.
402 if ($ac_dir/nm -B /dev/null 2>&1; exit 0) | grep /dev/null >/dev/null; then
403 ac_cv_path_NM="$ac_dir/nm -B"
404 elif ($ac_dir/nm -p /dev/null 2>&1; exit 0) | grep /dev/null >/dev/null; then
405 ac_cv_path_NM="$ac_dir/nm -p"
406 else
407 ac_cv_path_NM="$ac_dir/nm"
408 fi
409 break
410 fi
411 done
412 IFS="$ac_save_ifs"
413 test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
414 ;;
415esac])
416NM="$ac_cv_path_NM"
417AC_MSG_RESULT([$NM])
418AC_SUBST(NM)
419])
420
3a629497
JB
421dnl
422dnl CY_AC_WITH_THREADS determines which thread library the user intends
423dnl to put underneath guile. Pass it the path to find the guile top-level
424dnl source directory. Eg CY_AC_WITH_THREADS(../..) for tcl/unix.
425dnl
426
427AC_DEFUN([CY_AC_WITH_THREADS],[
428AC_CACHE_CHECK("threads package type",cy_cv_threads_package,[
429AC_CACHE_VAL(cy_cv_threads_cflags,[
430AC_CACHE_VAL(cy_cv_threads_libs,[
431use_threads=no;
432AC_ARG_WITH(threads,[ --with-threads thread interface],
433 use_threads=$withval, use_threads=no)
434test -n "$use_threads" || use_threads=qt
435threads_package=unknown
436if test "$use_threads" != no; then
437dnl
438dnl Test for the qt threads package - used for cooperative threads
439dnl This may not necessarily be built yet - so just check for the
440dnl header files.
441dnl
442 if test "$use_threads" = yes || test "$use_threads" = qt; then
ec06dd30
AG
443 # Look for qt in source directory.
444 if test -f $srcdir/qt/qt.c; then
445 qtsrcdir="`(cd $srcdir; pwd)`/qt"
3a629497 446 threads_package=COOP
ec06dd30 447 cy_cv_threads_cflags="-I$qtsrcdir -I../qt"
42d5fe64 448 cy_cv_threads_libs="../qt/libqt.a"
3a629497
JB
449 fi
450 else
451 if test -f $use_threads/qt.c; then
452 # FIXME seems as though we should try to use an installed qt here.
453 threads_package=COOP
454 cy_cv_threads_cflags="-I$use_threads -I../qt"
42d5fe64 455 cy_cv_threads_libs="../qt/libqt.a"
3a629497
JB
456 fi
457 fi
458 if test "$use_threads" = pthreads; then
459 # Look for pthreads in srcdir. See above to understand why
460 # we always set threads_package.
461 if test -f $srcdir/../../pthreads/pthreads/queue.c \
462 || test -f $srcdir/../pthreads/pthreads/queue.c; then
463 threads_package=MIT
464 cy_cv_threads_cflags="-I$srcdir/../../pthreads/include"
465 cy_cv_threads_libs="-L../../pthreads/lib -lpthread"
466 fi
467 fi
468 saved_CPP="$CPPFLAGS"
469 saved_LD="$LDFLAGS"
470 saved_LIBS="$LIBS"
471 if test "$threads_package" = unknown; then
472dnl
473dnl Test for the FSU threads package
474dnl
475 CPPFLAGS="-I$use_threads/include"
476 LDFLAGS="-L$use_threads/lib"
477 LIBS="-lgthreads -lmalloc"
478 AC_TRY_LINK([#include <pthread.h>],[
479pthread_equal(NULL,NULL);
480], threads_package=FSU)
481 fi
482 if test "$threads_package" = unknown; then
483dnl
484dnl Test for the MIT threads package
485dnl
486 LIBS="-lpthread"
487 AC_TRY_LINK([#include <pthread.h>],[
488pthread_equal(NULL,NULL);
489], threads_package=MIT)
490 fi
491 if test "$threads_package" = unknown; then
492dnl
493dnl Test for the PCthreads package
494dnl
495 LIBS="-lpthreads"
496 AC_TRY_LINK([#include <pthread.h>],[
497pthread_equal(NULL,NULL);
498], threads_package=PCthreads)
499 fi
500dnl
501dnl Set the appropriate flags!
502dnl
503 cy_cv_threads_cflags="$CPPFLAGS $cy_cv_threads_cflags"
504 cy_cv_threads_libs="$LDFLAGS $LIBS $cy_cv_threads_libs"
505 cy_cv_threads_package=$threads_package
506 CPPFLAGS="$saved_CPP"
507 LDFLAGS="$saved_LD"
508 LIBS="$saved_LIBS"
509 if test "$threads_package" = unknown; then
510 AC_MSG_ERROR("cannot find thread library installation")
511 fi
512fi
513])
514])
515],
516dnl
517dnl Set flags according to what is cached.
518dnl
519CPPFLAGS="$cy_cv_threads_cflags"
520LIBS="$cy_cv_threads_libs"
521)
522])
523