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"
25 dnl based on Automake's maintainer mode
26 AC_DEFUN(SAMBA_MAINTAINER_MODE,[
27 AC_ARG_ENABLE(maintainer-mode,
28 [ --enable-maintainer-mode enable some make rules for maintainers],
29 maint_mode=$enableval, maint_mode=no)
30 if test x"$maint_mode" = x"yes"; then MAINT=; else MAINT='#'; fi
32 AC_PATH_PROG(AUTOCONF, autoconf, autoconf)
34 AC_PATH_PROG(AUTOHEADER, autoheader, autoheader)
39 dnl test whether dirent has a d_off member
40 AC_DEFUN(AC_DIRENT_D_OFF,
41 [AC_CACHE_CHECK([for d_off in dirent], ac_cv_dirent_d_off,
44 #include <sys/types.h>
45 #include <dirent.h>], [struct dirent d; d.d_off;],
46 ac_cv_dirent_d_off=yes, ac_cv_dirent_d_off=no)])
47 if test $ac_cv_dirent_d_off = yes; then
48 AC_DEFINE(HAVE_DIRENT_D_OFF)
53 dnl AC_PROG_CC_FLAG(flag)
54 AC_DEFUN(AC_PROG_CC_FLAG,
55 [AC_CACHE_CHECK(whether ${CC-cc} accepts -$1, ac_cv_prog_cc_$1,
56 [echo 'void f(){}' > conftest.c
57 if test -z "`${CC-cc} -$1 -c conftest.c 2>&1`"; then
65 dnl check for a function in a library, but don't
66 dnl keep adding the same library to the LIBS variable.
67 dnl AC_LIBTESTFUNC(lib,func)
68 AC_DEFUN(AC_LIBTESTFUNC,
70 *-l$1*) AC_CHECK_FUNCS($2) ;;
71 *) AC_CHECK_LIB($1, $2)
77 ## libtool.m4 - Configure libtool for the target system. -*-Shell-script-*-
78 ## Copyright (C) 1996-1999 Free Software Foundation, Inc.
79 ## Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
81 ## This program is free software; you can redistribute it and/or modify
82 ## it under the terms of the GNU General Public License as published by
83 ## the Free Software Foundation; either version 2 of the License, or
84 ## (at your option) any later version.
86 ## This program is distributed in the hope that it will be useful, but
87 ## WITHOUT ANY WARRANTY; without even the implied warranty of
88 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
89 ## General Public License for more details.
91 ## You should have received a copy of the GNU General Public License
92 ## along with this program; if not, write to the Free Software
93 ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
95 ## As a special exception to the GNU General Public License, if you
96 ## distribute this file as part of a program that contains a
97 ## configuration script generated by Autoconf, you may include it under
98 ## the same distribution terms that you use for the rest of that program.
100 # serial 40 AC_PROG_LIBTOOL
101 AC_DEFUN(AC_PROG_LIBTOOL,
102 [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
104 # Save cache, so that ltconfig can load it
107 # Actually configure libtool. ac_aux_dir is where install-sh is found.
108 CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
109 LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
110 LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
111 DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
112 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
113 $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \
114 || AC_MSG_ERROR([libtool configure failed])
116 # Reload cache, that may have been modified by ltconfig
119 # This can be used to rebuild libtool when needed
120 LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
122 # Always use our own libtool.
123 LIBTOOL='$(SHELL) $(top_builddir)/libtool'
126 # Redirect the config.log output again, so that the ltconfig log is not
127 # clobbered by the next message.
131 AC_DEFUN(AC_LIBTOOL_SETUP,
133 AC_REQUIRE([AC_ENABLE_SHARED])dnl
134 AC_REQUIRE([AC_ENABLE_STATIC])dnl
135 AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
136 AC_REQUIRE([AC_CANONICAL_HOST])dnl
137 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
138 AC_REQUIRE([AC_PROG_RANLIB])dnl
139 AC_REQUIRE([AC_PROG_CC])dnl
140 AC_REQUIRE([AC_PROG_LD])dnl
141 AC_REQUIRE([AC_PROG_NM])dnl
142 AC_REQUIRE([AC_PROG_LN_S])dnl
146 NONE) lt_target="$host" ;;
147 *) lt_target="$target" ;;
150 # Check for any special flags to pass to ltconfig.
151 libtool_flags="--cache-file=$cache_file"
152 test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
153 test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
154 test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
155 test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
156 test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
157 ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
158 [libtool_flags="$libtool_flags --enable-dlopen"])
159 ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
160 [libtool_flags="$libtool_flags --enable-win32-dll"])
161 AC_ARG_ENABLE(libtool-lock,
162 [ --disable-libtool-lock avoid locking (might break parallel builds)])
163 test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
164 test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
166 # Some flags need to be propagated to the compiler or linker for good
170 # Find out which ABI we are using.
171 echo '[#]line __oline__ "configure"' > conftest.$ac_ext
172 if AC_TRY_EVAL(ac_compile); then
173 case "`/usr/bin/file conftest.o`" in
189 # On SCO OpenServer 5, we need -belf to get full-featured binaries.
190 SAVE_CFLAGS="$CFLAGS"
191 CFLAGS="$CFLAGS -belf"
192 AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
193 [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])])
194 if test x"$lt_cv_cc_needs_belf" != x"yes"; then
195 # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
196 CFLAGS="$SAVE_CFLAGS"
200 ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
201 [*-*-cygwin* | *-*-mingw*)
202 AC_CHECK_TOOL(DLLTOOL, dlltool, false)
203 AC_CHECK_TOOL(AS, as, false)
204 AC_CHECK_TOOL(OBJDUMP, objdump, false)
210 # AC_LIBTOOL_DLOPEN - enable checks for dlopen support
211 AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
213 # AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
214 AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
216 # AC_ENABLE_SHARED - implement the --enable-shared flag
217 # Usage: AC_ENABLE_SHARED[(DEFAULT)]
218 # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
220 AC_DEFUN(AC_ENABLE_SHARED, [dnl
221 define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
222 AC_ARG_ENABLE(shared,
223 changequote(<<, >>)dnl
224 << --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
226 [p=${PACKAGE-default}
228 yes) enable_shared=yes ;;
229 no) enable_shared=no ;;
232 # Look at the argument we got. We use all the common list separators.
233 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
234 for pkg in $enableval; do
235 if test "X$pkg" = "X$p"; then
242 enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
245 # AC_DISABLE_SHARED - set the default shared flag to --disable-shared
246 AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
247 AC_ENABLE_SHARED(no)])
249 # AC_ENABLE_STATIC - implement the --enable-static flag
250 # Usage: AC_ENABLE_STATIC[(DEFAULT)]
251 # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
253 AC_DEFUN(AC_ENABLE_STATIC, [dnl
254 define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
255 AC_ARG_ENABLE(static,
256 changequote(<<, >>)dnl
257 << --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
259 [p=${PACKAGE-default}
261 yes) enable_static=yes ;;
262 no) enable_static=no ;;
265 # Look at the argument we got. We use all the common list separators.
266 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
267 for pkg in $enableval; do
268 if test "X$pkg" = "X$p"; then
275 enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
278 # AC_DISABLE_STATIC - set the default static flag to --disable-static
279 AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
280 AC_ENABLE_STATIC(no)])
283 # AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
284 # Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
285 # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
287 AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl
288 define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
289 AC_ARG_ENABLE(fast-install,
290 changequote(<<, >>)dnl
291 << --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
293 [p=${PACKAGE-default}
295 yes) enable_fast_install=yes ;;
296 no) enable_fast_install=no ;;
298 enable_fast_install=no
299 # Look at the argument we got. We use all the common list separators.
300 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
301 for pkg in $enableval; do
302 if test "X$pkg" = "X$p"; then
303 enable_fast_install=yes
309 enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
312 # AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
313 AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
314 AC_ENABLE_FAST_INSTALL(no)])
316 # AC_PROG_LD - find the path to the GNU or non-GNU linker
319 [ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
320 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
321 AC_REQUIRE([AC_PROG_CC])dnl
322 AC_REQUIRE([AC_CANONICAL_HOST])dnl
323 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
325 if test "$ac_cv_prog_gcc" = yes; then
326 # Check if gcc -print-prog-name=ld gives a path.
327 AC_MSG_CHECKING([for ld used by GCC])
328 ac_prog=`($CC -print-prog-name=ld) 2>&5`
330 # Accept absolute paths.
332 [\\/]* | [A-Za-z]:[\\/]*)
333 re_direlt='/[^/][^/]*/\.\./'
335 # Canonicalize the path of ld
336 ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
337 while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
338 ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
340 test -z "$LD" && LD="$ac_prog"
343 # If it fails, then pretend we aren't using GCC.
347 # If it is relative, then search for the first ld in PATH.
351 elif test "$with_gnu_ld" = yes; then
352 AC_MSG_CHECKING([for GNU ld])
354 AC_MSG_CHECKING([for non-GNU ld])
356 AC_CACHE_VAL(ac_cv_path_LD,
357 [if test -z "$LD"; then
358 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
359 for ac_dir in $PATH; do
360 test -z "$ac_dir" && ac_dir=.
361 if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
362 ac_cv_path_LD="$ac_dir/$ac_prog"
363 # Check to see if the program is GNU ld. I'd rather use --version,
364 # but apparently some GNU ld's only accept -v.
365 # Break only if it was the GNU/non-GNU ld that we prefer.
366 if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
367 test "$with_gnu_ld" != no && break
369 test "$with_gnu_ld" != yes && break
375 ac_cv_path_LD="$LD" # Let the user override the test with a path.
378 if test -n "$LD"; then
383 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
387 AC_DEFUN(AC_PROG_LD_GNU,
388 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
389 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
390 if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
391 ac_cv_prog_gnu_ld=yes
397 # AC_PROG_NM - find the path to a BSD-compatible name lister
399 [AC_MSG_CHECKING([for BSD-compatible nm])
400 AC_CACHE_VAL(ac_cv_path_NM,
401 [if test -n "$NM"; then
402 # Let the user override the test.
405 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
406 for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
407 test -z "$ac_dir" && ac_dir=.
408 if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then
409 # Check to see if the nm accepts a BSD-compat flag.
410 # Adding the `sed 1q' prevents false positives on HP-UX, which says:
411 # nm: unknown option "B" ignored
412 if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
413 ac_cv_path_NM="$ac_dir/nm -B"
415 elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
416 ac_cv_path_NM="$ac_dir/nm -p"
419 ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
420 continue # so that we can try to find one that supports BSD flags
425 test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
431 # AC_CHECK_LIBM - check for math library
432 AC_DEFUN(AC_CHECK_LIBM,
433 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
436 *-*-beos* | *-*-cygwin*)
437 # These system don't have libm
440 AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
441 AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
444 AC_CHECK_LIB(m, main, LIBM="-lm")
449 # AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
450 # the libltdl convenience library, adds --enable-ltdl-convenience to
451 # the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor
452 # is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed
453 # to be `${top_builddir}/libltdl'. Make sure you start DIR with
454 # '${top_builddir}/' (note the single quotes!) if your package is not
455 # flat, and, if you're not using automake, define top_builddir as
456 # appropriate in the Makefiles.
457 AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
458 case "$enable_ltdl_convenience" in
459 no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
460 "") enable_ltdl_convenience=yes
461 ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
463 LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la
464 INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
467 # AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
468 # the libltdl installable library, and adds --enable-ltdl-install to
469 # the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor
470 # is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed
471 # to be `${top_builddir}/libltdl'. Make sure you start DIR with
472 # '${top_builddir}/' (note the single quotes!) if your package is not
473 # flat, and, if you're not using automake, define top_builddir as
474 # appropriate in the Makefiles.
475 # In the future, this macro may have to be called after AC_PROG_LIBTOOL.
476 AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
477 AC_CHECK_LIB(ltdl, main,
478 [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
479 [if test x"$enable_ltdl_install" = xno; then
480 AC_MSG_WARN([libltdl not installed, but installation disabled])
482 enable_ltdl_install=yes
485 if test x"$enable_ltdl_install" = x"yes"; then
486 ac_configure_args="$ac_configure_args --enable-ltdl-install"
487 LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la
488 INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
490 ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
497 AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
498 AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
499 AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
500 AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
501 AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
502 AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
503 AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
505 dnl This is just to silence aclocal about the macro not being used
506 ifelse([AC_DISABLE_FAST_INSTALL])dnl