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 check for a function in a library, but don't
53 dnl keep adding the same library to the LIBS variable.
54 dnl AC_LIBTESTFUNC(lib,func)
55 AC_DEFUN(AC_LIBTESTFUNC,
57 *-l$1*) AC_CHECK_FUNCS($2) ;;
58 *) AC_CHECK_LIB($1, $2)
64 dnl Define an AC_DEFINE with ifndef guard.
65 dnl AC_N_DEFINE(VARIABLE [, VALUE])
67 [cat >> confdefs.h <<\EOF
69 [#define] $1 ifelse($#, 2, [$2], $#, 3, [$2], 1)
75 dnl AC_ADD_INCLUDE(VARIABLE)
76 define(AC_ADD_INCLUDE,
77 [cat >> confdefs.h <<\EOF
82 ## libtool.m4 - Configure libtool for the target system. -*-Shell-script-*-
83 ## Copyright (C) 1996-1999 Free Software Foundation, Inc.
84 ## Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
86 ## This program is free software; you can redistribute it and/or modify
87 ## it under the terms of the GNU General Public License as published by
88 ## the Free Software Foundation; either version 2 of the License, or
89 ## (at your option) any later version.
91 ## This program is distributed in the hope that it will be useful, but
92 ## WITHOUT ANY WARRANTY; without even the implied warranty of
93 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
94 ## General Public License for more details.
96 ## You should have received a copy of the GNU General Public License
97 ## along with this program; if not, write to the Free Software
98 ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
100 ## As a special exception to the GNU General Public License, if you
101 ## distribute this file as part of a program that contains a
102 ## configuration script generated by Autoconf, you may include it under
103 ## the same distribution terms that you use for the rest of that program.
105 # serial 40 AC_PROG_LIBTOOL
106 AC_DEFUN(AC_PROG_LIBTOOL,
107 [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
109 # Save cache, so that ltconfig can load it
112 # Actually configure libtool. ac_aux_dir is where install-sh is found.
113 CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
114 LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
115 LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
116 DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
117 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
118 $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \
119 || AC_MSG_ERROR([libtool configure failed])
121 # Reload cache, that may have been modified by ltconfig
124 # This can be used to rebuild libtool when needed
125 LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
127 # Always use our own libtool.
128 LIBTOOL='$(SHELL) $(top_builddir)/libtool'
131 # Redirect the config.log output again, so that the ltconfig log is not
132 # clobbered by the next message.
136 AC_DEFUN(AC_LIBTOOL_SETUP,
138 AC_REQUIRE([AC_ENABLE_SHARED])dnl
139 AC_REQUIRE([AC_ENABLE_STATIC])dnl
140 AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
141 AC_REQUIRE([AC_CANONICAL_HOST])dnl
142 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
143 AC_REQUIRE([AC_PROG_RANLIB])dnl
144 AC_REQUIRE([AC_PROG_CC])dnl
145 AC_REQUIRE([AC_PROG_LD])dnl
146 AC_REQUIRE([AC_PROG_NM])dnl
147 AC_REQUIRE([AC_PROG_LN_S])dnl
151 NONE) lt_target="$host" ;;
152 *) lt_target="$target" ;;
155 # Check for any special flags to pass to ltconfig.
156 libtool_flags="--cache-file=$cache_file"
157 test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
158 test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
159 test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
160 test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
161 test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
162 ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
163 [libtool_flags="$libtool_flags --enable-dlopen"])
164 ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
165 [libtool_flags="$libtool_flags --enable-win32-dll"])
166 AC_ARG_ENABLE(libtool-lock,
167 [ --disable-libtool-lock avoid locking (might break parallel builds)])
168 test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
169 test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
171 # Some flags need to be propagated to the compiler or linker for good
175 # Find out which ABI we are using.
176 echo '[#]line __oline__ "configure"' > conftest.$ac_ext
177 if AC_TRY_EVAL(ac_compile); then
178 case "`/usr/bin/file conftest.o`" in
194 # On SCO OpenServer 5, we need -belf to get full-featured binaries.
195 SAVE_CFLAGS="$CFLAGS"
196 CFLAGS="$CFLAGS -belf"
197 AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
198 [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])])
199 if test x"$lt_cv_cc_needs_belf" != x"yes"; then
200 # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
201 CFLAGS="$SAVE_CFLAGS"
205 ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
206 [*-*-cygwin* | *-*-mingw*)
207 AC_CHECK_TOOL(DLLTOOL, dlltool, false)
208 AC_CHECK_TOOL(AS, as, false)
209 AC_CHECK_TOOL(OBJDUMP, objdump, false)
215 # AC_LIBTOOL_DLOPEN - enable checks for dlopen support
216 AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
218 # AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
219 AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
221 # AC_ENABLE_SHARED - implement the --enable-shared flag
222 # Usage: AC_ENABLE_SHARED[(DEFAULT)]
223 # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
225 AC_DEFUN(AC_ENABLE_SHARED, [dnl
226 define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
227 AC_ARG_ENABLE(shared,
228 changequote(<<, >>)dnl
229 << --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
231 [p=${PACKAGE-default}
233 yes) enable_shared=yes ;;
234 no) enable_shared=no ;;
237 # Look at the argument we got. We use all the common list separators.
238 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
239 for pkg in $enableval; do
240 if test "X$pkg" = "X$p"; then
247 enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
250 # AC_DISABLE_SHARED - set the default shared flag to --disable-shared
251 AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
252 AC_ENABLE_SHARED(no)])
254 # AC_ENABLE_STATIC - implement the --enable-static flag
255 # Usage: AC_ENABLE_STATIC[(DEFAULT)]
256 # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
258 AC_DEFUN(AC_ENABLE_STATIC, [dnl
259 define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
260 AC_ARG_ENABLE(static,
261 changequote(<<, >>)dnl
262 << --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
264 [p=${PACKAGE-default}
266 yes) enable_static=yes ;;
267 no) enable_static=no ;;
270 # Look at the argument we got. We use all the common list separators.
271 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
272 for pkg in $enableval; do
273 if test "X$pkg" = "X$p"; then
280 enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
283 # AC_DISABLE_STATIC - set the default static flag to --disable-static
284 AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
285 AC_ENABLE_STATIC(no)])
288 # AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
289 # Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
290 # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
292 AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl
293 define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
294 AC_ARG_ENABLE(fast-install,
295 changequote(<<, >>)dnl
296 << --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
298 [p=${PACKAGE-default}
300 yes) enable_fast_install=yes ;;
301 no) enable_fast_install=no ;;
303 enable_fast_install=no
304 # Look at the argument we got. We use all the common list separators.
305 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
306 for pkg in $enableval; do
307 if test "X$pkg" = "X$p"; then
308 enable_fast_install=yes
314 enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
317 # AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
318 AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
319 AC_ENABLE_FAST_INSTALL(no)])
321 # AC_PROG_LD - find the path to the GNU or non-GNU linker
324 [ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
325 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
326 AC_REQUIRE([AC_PROG_CC])dnl
327 AC_REQUIRE([AC_CANONICAL_HOST])dnl
328 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
330 if test "$ac_cv_prog_gcc" = yes; then
331 # Check if gcc -print-prog-name=ld gives a path.
332 AC_MSG_CHECKING([for ld used by GCC])
333 ac_prog=`($CC -print-prog-name=ld) 2>&5`
335 # Accept absolute paths.
337 [\\/]* | [A-Za-z]:[\\/]*)
338 re_direlt='/[^/][^/]*/\.\./'
340 # Canonicalize the path of ld
341 ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
342 while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
343 ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
345 test -z "$LD" && LD="$ac_prog"
348 # If it fails, then pretend we aren't using GCC.
352 # If it is relative, then search for the first ld in PATH.
356 elif test "$with_gnu_ld" = yes; then
357 AC_MSG_CHECKING([for GNU ld])
359 AC_MSG_CHECKING([for non-GNU ld])
361 AC_CACHE_VAL(ac_cv_path_LD,
362 [if test -z "$LD"; then
363 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
364 for ac_dir in $PATH; do
365 test -z "$ac_dir" && ac_dir=.
366 if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
367 ac_cv_path_LD="$ac_dir/$ac_prog"
368 # Check to see if the program is GNU ld. I'd rather use --version,
369 # but apparently some GNU ld's only accept -v.
370 # Break only if it was the GNU/non-GNU ld that we prefer.
371 if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
372 test "$with_gnu_ld" != no && break
374 test "$with_gnu_ld" != yes && break
380 ac_cv_path_LD="$LD" # Let the user override the test with a path.
383 if test -n "$LD"; then
388 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
392 AC_DEFUN(AC_PROG_LD_GNU,
393 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
394 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
395 if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
396 ac_cv_prog_gnu_ld=yes
402 # AC_PROG_NM - find the path to a BSD-compatible name lister
404 [AC_MSG_CHECKING([for BSD-compatible nm])
405 AC_CACHE_VAL(ac_cv_path_NM,
406 [if test -n "$NM"; then
407 # Let the user override the test.
410 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
411 for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
412 test -z "$ac_dir" && ac_dir=.
413 if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then
414 # Check to see if the nm accepts a BSD-compat flag.
415 # Adding the `sed 1q' prevents false positives on HP-UX, which says:
416 # nm: unknown option "B" ignored
417 if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
418 ac_cv_path_NM="$ac_dir/nm -B"
420 elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
421 ac_cv_path_NM="$ac_dir/nm -p"
424 ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
425 continue # so that we can try to find one that supports BSD flags
430 test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
436 # AC_CHECK_LIBM - check for math library
437 AC_DEFUN(AC_CHECK_LIBM,
438 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
441 *-*-beos* | *-*-cygwin*)
442 # These system don't have libm
445 AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
446 AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
449 AC_CHECK_LIB(m, main, LIBM="-lm")
454 # AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
455 # the libltdl convenience library, adds --enable-ltdl-convenience to
456 # the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor
457 # is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed
458 # to be `${top_builddir}/libltdl'. Make sure you start DIR with
459 # '${top_builddir}/' (note the single quotes!) if your package is not
460 # flat, and, if you're not using automake, define top_builddir as
461 # appropriate in the Makefiles.
462 AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
463 case "$enable_ltdl_convenience" in
464 no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
465 "") enable_ltdl_convenience=yes
466 ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
468 LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la
469 INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
472 # AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
473 # the libltdl installable library, and adds --enable-ltdl-install to
474 # the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor
475 # is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed
476 # to be `${top_builddir}/libltdl'. Make sure you start DIR with
477 # '${top_builddir}/' (note the single quotes!) if your package is not
478 # flat, and, if you're not using automake, define top_builddir as
479 # appropriate in the Makefiles.
480 # In the future, this macro may have to be called after AC_PROG_LIBTOOL.
481 AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
482 AC_CHECK_LIB(ltdl, main,
483 [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
484 [if test x"$enable_ltdl_install" = xno; then
485 AC_MSG_WARN([libltdl not installed, but installation disabled])
487 enable_ltdl_install=yes
490 if test x"$enable_ltdl_install" = x"yes"; then
491 ac_configure_args="$ac_configure_args --enable-ltdl-install"
492 LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la
493 INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
495 ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
502 AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
503 AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
504 AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
505 AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
506 AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
507 AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
508 AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
510 dnl This is just to silence aclocal about the macro not being used
511 ifelse([AC_DISABLE_FAST_INSTALL])dnl