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