1 dnl AC_VALIDATE_CACHE_SYSTEM_TYPE[(cmd)]
2 dnl if the cache file is inconsistent with the current host,
3 dnl target and build system types, execute CMD or print a default
5 AC_DEFUN(AC_VALIDATE_CACHE_SYSTEM_TYPE, [
6 AC_REQUIRE([AC_CANONICAL_SYSTEM])
7 AC_MSG_CHECKING([config.cache system type])
8 if { test x"${ac_cv_host_system_type+set}" = x"set" &&
9 test x"$ac_cv_host_system_type" != x"$host"; } ||
10 { test x"${ac_cv_build_system_type+set}" = x"set" &&
11 test x"$ac_cv_build_system_type" != x"$build"; } ||
12 { test x"${ac_cv_target_system_type+set}" = x"set" &&
13 test x"$ac_cv_target_system_type" != x"$target"; }; then
14 AC_MSG_RESULT([different])
16 [AC_MSG_ERROR(["you must remove config.cache and restart configure"])])
20 ac_cv_host_system_type="$host"
21 ac_cv_build_system_type="$build"
22 ac_cv_target_system_type="$target"
26 dnl test whether dirent has a d_off member
27 AC_DEFUN(AC_DIRENT_D_OFF,
28 [AC_CACHE_CHECK([for d_off in dirent], ac_cv_dirent_d_off,
31 #include <sys/types.h>
32 #include <dirent.h>], [struct dirent d; d.d_off;],
33 ac_cv_dirent_d_off=yes, ac_cv_dirent_d_off=no)])
34 if test $ac_cv_dirent_d_off = yes; then
35 AC_DEFINE(HAVE_DIRENT_D_OFF)
40 dnl AC_PROG_CC_FLAG(flag)
41 AC_DEFUN(AC_PROG_CC_FLAG,
42 [AC_CACHE_CHECK(whether ${CC-cc} accepts -$1, ac_cv_prog_cc_$1,
43 [echo 'void f(){}' > conftest.c
44 if test -z "`${CC-cc} -$1 -c conftest.c 2>&1`"; then
52 dnl see if a declaration exists for a function or variable
53 dnl defines HAVE_function_DECL if it exists
54 dnl AC_HAVE_DECL(var, includes)
55 AC_DEFUN(AC_HAVE_DECL,
57 AC_CACHE_CHECK([for $1 declaration],ac_cv_have_$1_decl,[
58 AC_TRY_COMPILE([$2],[int i = (int)$1],
59 ac_cv_have_$1_decl=yes,ac_cv_have_$1_decl=no)])
60 if test x"$ac_cv_have_$1_decl" = x"yes"; then
61 AC_DEFINE([HAVE_]translit([$1], [a-z], [A-Z])[_DECL])
66 dnl check for a function in a library, but don't
67 dnl keep adding the same library to the LIBS variable.
68 dnl AC_LIBTESTFUNC(lib,func)
69 AC_DEFUN(AC_LIBTESTFUNC,
71 *-l$1*) AC_CHECK_FUNCS($2) ;;
72 *) AC_CHECK_LIB($1, $2)
78 dnl Define an AC_DEFINE with ifndef guard.
79 dnl AC_N_DEFINE(VARIABLE [, VALUE])
81 [cat >> confdefs.h <<\EOF
83 [#define] $1 ifelse($#, 2, [$2], $#, 3, [$2], 1)
89 dnl AC_ADD_INCLUDE(VARIABLE)
90 define(AC_ADD_INCLUDE,
91 [cat >> confdefs.h <<\EOF
96 ## libtool.m4 - Configure libtool for the target system. -*-Shell-script-*-
97 ## Copyright (C) 1996-1999 Free Software Foundation, Inc.
98 ## Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
100 ## This program is free software; you can redistribute it and/or modify
101 ## it under the terms of the GNU General Public License as published by
102 ## the Free Software Foundation; either version 2 of the License, or
103 ## (at your option) any later version.
105 ## This program is distributed in the hope that it will be useful, but
106 ## WITHOUT ANY WARRANTY; without even the implied warranty of
107 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
108 ## General Public License for more details.
110 ## You should have received a copy of the GNU General Public License
111 ## along with this program; if not, write to the Free Software
112 ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
114 ## As a special exception to the GNU General Public License, if you
115 ## distribute this file as part of a program that contains a
116 ## configuration script generated by Autoconf, you may include it under
117 ## the same distribution terms that you use for the rest of that program.
119 # serial 40 AC_PROG_LIBTOOL
120 AC_DEFUN(AC_PROG_LIBTOOL,
121 [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
123 # Save cache, so that ltconfig can load it
126 # Actually configure libtool. ac_aux_dir is where install-sh is found.
127 CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
128 LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
129 LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
130 DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
131 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
132 $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \
133 || AC_MSG_ERROR([libtool configure failed])
135 # Reload cache, that may have been modified by ltconfig
138 # This can be used to rebuild libtool when needed
139 LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
141 # Always use our own libtool.
142 LIBTOOL='$(SHELL) $(top_builddir)/libtool'
145 # Redirect the config.log output again, so that the ltconfig log is not
146 # clobbered by the next message.
150 AC_DEFUN(AC_LIBTOOL_SETUP,
152 AC_REQUIRE([AC_ENABLE_SHARED])dnl
153 AC_REQUIRE([AC_ENABLE_STATIC])dnl
154 AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
155 AC_REQUIRE([AC_CANONICAL_HOST])dnl
156 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
157 AC_REQUIRE([AC_PROG_RANLIB])dnl
158 AC_REQUIRE([AC_PROG_CC])dnl
159 AC_REQUIRE([AC_PROG_LD])dnl
160 AC_REQUIRE([AC_PROG_NM])dnl
161 AC_REQUIRE([AC_PROG_LN_S])dnl
165 NONE) lt_target="$host" ;;
166 *) lt_target="$target" ;;
169 # Check for any special flags to pass to ltconfig.
170 libtool_flags="--cache-file=$cache_file"
171 test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
172 test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
173 test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
174 test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
175 test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
176 ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
177 [libtool_flags="$libtool_flags --enable-dlopen"])
178 ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
179 [libtool_flags="$libtool_flags --enable-win32-dll"])
180 AC_ARG_ENABLE(libtool-lock,
181 [ --disable-libtool-lock avoid locking (might break parallel builds)])
182 test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
183 test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
185 # Some flags need to be propagated to the compiler or linker for good
189 # Find out which ABI we are using.
190 echo '[#]line __oline__ "configure"' > conftest.$ac_ext
191 if AC_TRY_EVAL(ac_compile); then
192 case "`/usr/bin/file conftest.o`" in
208 # On SCO OpenServer 5, we need -belf to get full-featured binaries.
209 SAVE_CFLAGS="$CFLAGS"
210 CFLAGS="$CFLAGS -belf"
211 AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
212 [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])])
213 if test x"$lt_cv_cc_needs_belf" != x"yes"; then
214 # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
215 CFLAGS="$SAVE_CFLAGS"
219 ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
220 [*-*-cygwin* | *-*-mingw*)
221 AC_CHECK_TOOL(DLLTOOL, dlltool, false)
222 AC_CHECK_TOOL(AS, as, false)
223 AC_CHECK_TOOL(OBJDUMP, objdump, false)
229 # AC_LIBTOOL_DLOPEN - enable checks for dlopen support
230 AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
232 # AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
233 AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
235 # AC_ENABLE_SHARED - implement the --enable-shared flag
236 # Usage: AC_ENABLE_SHARED[(DEFAULT)]
237 # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
239 AC_DEFUN(AC_ENABLE_SHARED, [dnl
240 define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
241 AC_ARG_ENABLE(shared,
242 changequote(<<, >>)dnl
243 << --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
245 [p=${PACKAGE-default}
247 yes) enable_shared=yes ;;
248 no) enable_shared=no ;;
251 # Look at the argument we got. We use all the common list separators.
252 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
253 for pkg in $enableval; do
254 if test "X$pkg" = "X$p"; then
261 enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
264 # AC_DISABLE_SHARED - set the default shared flag to --disable-shared
265 AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
266 AC_ENABLE_SHARED(no)])
268 # AC_ENABLE_STATIC - implement the --enable-static flag
269 # Usage: AC_ENABLE_STATIC[(DEFAULT)]
270 # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
272 AC_DEFUN(AC_ENABLE_STATIC, [dnl
273 define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
274 AC_ARG_ENABLE(static,
275 changequote(<<, >>)dnl
276 << --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
278 [p=${PACKAGE-default}
280 yes) enable_static=yes ;;
281 no) enable_static=no ;;
284 # Look at the argument we got. We use all the common list separators.
285 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
286 for pkg in $enableval; do
287 if test "X$pkg" = "X$p"; then
294 enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
297 # AC_DISABLE_STATIC - set the default static flag to --disable-static
298 AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
299 AC_ENABLE_STATIC(no)])
302 # AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
303 # Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
304 # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
306 AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl
307 define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
308 AC_ARG_ENABLE(fast-install,
309 changequote(<<, >>)dnl
310 << --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
312 [p=${PACKAGE-default}
314 yes) enable_fast_install=yes ;;
315 no) enable_fast_install=no ;;
317 enable_fast_install=no
318 # Look at the argument we got. We use all the common list separators.
319 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
320 for pkg in $enableval; do
321 if test "X$pkg" = "X$p"; then
322 enable_fast_install=yes
328 enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
331 # AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
332 AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
333 AC_ENABLE_FAST_INSTALL(no)])
335 # AC_PROG_LD - find the path to the GNU or non-GNU linker
338 [ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
339 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
340 AC_REQUIRE([AC_PROG_CC])dnl
341 AC_REQUIRE([AC_CANONICAL_HOST])dnl
342 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
344 if test "$ac_cv_prog_gcc" = yes; then
345 # Check if gcc -print-prog-name=ld gives a path.
346 AC_MSG_CHECKING([for ld used by GCC])
347 ac_prog=`($CC -print-prog-name=ld) 2>&5`
349 # Accept absolute paths.
351 [\\/]* | [A-Za-z]:[\\/]*)
352 re_direlt='/[^/][^/]*/\.\./'
354 # Canonicalize the path of ld
355 ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
356 while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
357 ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
359 test -z "$LD" && LD="$ac_prog"
362 # If it fails, then pretend we aren't using GCC.
366 # If it is relative, then search for the first ld in PATH.
370 elif test "$with_gnu_ld" = yes; then
371 AC_MSG_CHECKING([for GNU ld])
373 AC_MSG_CHECKING([for non-GNU ld])
375 AC_CACHE_VAL(ac_cv_path_LD,
376 [if test -z "$LD"; then
377 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
378 for ac_dir in $PATH; do
379 test -z "$ac_dir" && ac_dir=.
380 if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
381 ac_cv_path_LD="$ac_dir/$ac_prog"
382 # Check to see if the program is GNU ld. I'd rather use --version,
383 # but apparently some GNU ld's only accept -v.
384 # Break only if it was the GNU/non-GNU ld that we prefer.
385 if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
386 test "$with_gnu_ld" != no && break
388 test "$with_gnu_ld" != yes && break
394 ac_cv_path_LD="$LD" # Let the user override the test with a path.
397 if test -n "$LD"; then
402 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
406 AC_DEFUN(AC_PROG_LD_GNU,
407 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
408 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
409 if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
410 ac_cv_prog_gnu_ld=yes
416 # AC_PROG_NM - find the path to a BSD-compatible name lister
418 [AC_MSG_CHECKING([for BSD-compatible nm])
419 AC_CACHE_VAL(ac_cv_path_NM,
420 [if test -n "$NM"; then
421 # Let the user override the test.
424 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
425 for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
426 test -z "$ac_dir" && ac_dir=.
427 if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then
428 # Check to see if the nm accepts a BSD-compat flag.
429 # Adding the `sed 1q' prevents false positives on HP-UX, which says:
430 # nm: unknown option "B" ignored
431 if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
432 ac_cv_path_NM="$ac_dir/nm -B"
434 elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
435 ac_cv_path_NM="$ac_dir/nm -p"
438 ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
439 continue # so that we can try to find one that supports BSD flags
444 test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
450 # AC_CHECK_LIBM - check for math library
451 AC_DEFUN(AC_CHECK_LIBM,
452 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
455 *-*-beos* | *-*-cygwin*)
456 # These system don't have libm
459 AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
460 AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
463 AC_CHECK_LIB(m, main, LIBM="-lm")
468 # AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
469 # the libltdl convenience library, adds --enable-ltdl-convenience to
470 # the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor
471 # is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed
472 # to be `${top_builddir}/libltdl'. Make sure you start DIR with
473 # '${top_builddir}/' (note the single quotes!) if your package is not
474 # flat, and, if you're not using automake, define top_builddir as
475 # appropriate in the Makefiles.
476 AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
477 case "$enable_ltdl_convenience" in
478 no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
479 "") enable_ltdl_convenience=yes
480 ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
482 LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la
483 INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
486 # AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
487 # the libltdl installable library, and adds --enable-ltdl-install to
488 # the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor
489 # is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed
490 # to be `${top_builddir}/libltdl'. Make sure you start DIR with
491 # '${top_builddir}/' (note the single quotes!) if your package is not
492 # flat, and, if you're not using automake, define top_builddir as
493 # appropriate in the Makefiles.
494 # In the future, this macro may have to be called after AC_PROG_LIBTOOL.
495 AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
496 AC_CHECK_LIB(ltdl, main,
497 [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
498 [if test x"$enable_ltdl_install" = xno; then
499 AC_MSG_WARN([libltdl not installed, but installation disabled])
501 enable_ltdl_install=yes
504 if test x"$enable_ltdl_install" = x"yes"; then
505 ac_configure_args="$ac_configure_args --enable-ltdl-install"
506 LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la
507 INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
509 ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
516 AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
517 AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
518 AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
519 AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
520 AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
521 AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
522 AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
524 dnl This is just to silence aclocal about the macro not being used
525 ifelse([AC_DISABLE_FAST_INSTALL])dnl