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)
78 ## libtool.m4 - Configure libtool for the target system. -*-Shell-script-*-
79 ## Copyright (C) 1996-1999 Free Software Foundation, Inc.
80 ## Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
82 ## This program is free software; you can redistribute it and/or modify
83 ## it under the terms of the GNU General Public License as published by
84 ## the Free Software Foundation; either version 2 of the License, or
85 ## (at your option) any later version.
87 ## This program is distributed in the hope that it will be useful, but
88 ## WITHOUT ANY WARRANTY; without even the implied warranty of
89 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
90 ## General Public License for more details.
92 ## You should have received a copy of the GNU General Public License
93 ## along with this program; if not, write to the Free Software
94 ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
96 ## As a special exception to the GNU General Public License, if you
97 ## distribute this file as part of a program that contains a
98 ## configuration script generated by Autoconf, you may include it under
99 ## the same distribution terms that you use for the rest of that program.
101 # serial 40 AC_PROG_LIBTOOL
102 AC_DEFUN(AC_PROG_LIBTOOL,
103 [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
105 # Save cache, so that ltconfig can load it
108 # Actually configure libtool. ac_aux_dir is where install-sh is found.
109 CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
110 LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
111 LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
112 DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
113 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
114 $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \
115 || AC_MSG_ERROR([libtool configure failed])
117 # Reload cache, that may have been modified by ltconfig
120 # This can be used to rebuild libtool when needed
121 LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
123 # Always use our own libtool.
124 LIBTOOL='$(SHELL) $(top_builddir)/libtool'
127 # Redirect the config.log output again, so that the ltconfig log is not
128 # clobbered by the next message.
132 AC_DEFUN(AC_LIBTOOL_SETUP,
134 AC_REQUIRE([AC_ENABLE_SHARED])dnl
135 AC_REQUIRE([AC_ENABLE_STATIC])dnl
136 AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
137 AC_REQUIRE([AC_CANONICAL_HOST])dnl
138 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
139 AC_REQUIRE([AC_PROG_RANLIB])dnl
140 AC_REQUIRE([AC_PROG_CC])dnl
141 AC_REQUIRE([AC_PROG_LD])dnl
142 AC_REQUIRE([AC_PROG_NM])dnl
143 AC_REQUIRE([AC_PROG_LN_S])dnl
147 NONE) lt_target="$host" ;;
148 *) lt_target="$target" ;;
151 # Check for any special flags to pass to ltconfig.
152 libtool_flags="--cache-file=$cache_file"
153 test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
154 test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
155 test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
156 test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
157 test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
158 ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
159 [libtool_flags="$libtool_flags --enable-dlopen"])
160 ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
161 [libtool_flags="$libtool_flags --enable-win32-dll"])
162 AC_ARG_ENABLE(libtool-lock,
163 [ --disable-libtool-lock avoid locking (might break parallel builds)])
164 test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
165 test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
167 # Some flags need to be propagated to the compiler or linker for good
171 # Find out which ABI we are using.
172 echo '[#]line __oline__ "configure"' > conftest.$ac_ext
173 if AC_TRY_EVAL(ac_compile); then
174 case "`/usr/bin/file conftest.o`" in
190 # On SCO OpenServer 5, we need -belf to get full-featured binaries.
191 SAVE_CFLAGS="$CFLAGS"
192 CFLAGS="$CFLAGS -belf"
193 AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
194 [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])])
195 if test x"$lt_cv_cc_needs_belf" != x"yes"; then
196 # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
197 CFLAGS="$SAVE_CFLAGS"
201 ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
202 [*-*-cygwin* | *-*-mingw*)
203 AC_CHECK_TOOL(DLLTOOL, dlltool, false)
204 AC_CHECK_TOOL(AS, as, false)
205 AC_CHECK_TOOL(OBJDUMP, objdump, false)
211 # AC_LIBTOOL_DLOPEN - enable checks for dlopen support
212 AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
214 # AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
215 AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
217 # AC_ENABLE_SHARED - implement the --enable-shared flag
218 # Usage: AC_ENABLE_SHARED[(DEFAULT)]
219 # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
221 AC_DEFUN(AC_ENABLE_SHARED, [dnl
222 define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
223 AC_ARG_ENABLE(shared,
224 changequote(<<, >>)dnl
225 << --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
227 [p=${PACKAGE-default}
229 yes) enable_shared=yes ;;
230 no) enable_shared=no ;;
233 # Look at the argument we got. We use all the common list separators.
234 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
235 for pkg in $enableval; do
236 if test "X$pkg" = "X$p"; then
243 enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
246 # AC_DISABLE_SHARED - set the default shared flag to --disable-shared
247 AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
248 AC_ENABLE_SHARED(no)])
250 # AC_ENABLE_STATIC - implement the --enable-static flag
251 # Usage: AC_ENABLE_STATIC[(DEFAULT)]
252 # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
254 AC_DEFUN(AC_ENABLE_STATIC, [dnl
255 define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
256 AC_ARG_ENABLE(static,
257 changequote(<<, >>)dnl
258 << --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
260 [p=${PACKAGE-default}
262 yes) enable_static=yes ;;
263 no) enable_static=no ;;
266 # Look at the argument we got. We use all the common list separators.
267 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
268 for pkg in $enableval; do
269 if test "X$pkg" = "X$p"; then
276 enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
279 # AC_DISABLE_STATIC - set the default static flag to --disable-static
280 AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
281 AC_ENABLE_STATIC(no)])
284 # AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
285 # Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
286 # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
288 AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl
289 define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
290 AC_ARG_ENABLE(fast-install,
291 changequote(<<, >>)dnl
292 << --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
294 [p=${PACKAGE-default}
296 yes) enable_fast_install=yes ;;
297 no) enable_fast_install=no ;;
299 enable_fast_install=no
300 # Look at the argument we got. We use all the common list separators.
301 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
302 for pkg in $enableval; do
303 if test "X$pkg" = "X$p"; then
304 enable_fast_install=yes
310 enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
313 # AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
314 AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
315 AC_ENABLE_FAST_INSTALL(no)])
317 # AC_PROG_LD - find the path to the GNU or non-GNU linker
320 [ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
321 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
322 AC_REQUIRE([AC_PROG_CC])dnl
323 AC_REQUIRE([AC_CANONICAL_HOST])dnl
324 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
326 if test "$ac_cv_prog_gcc" = yes; then
327 # Check if gcc -print-prog-name=ld gives a path.
328 AC_MSG_CHECKING([for ld used by GCC])
329 ac_prog=`($CC -print-prog-name=ld) 2>&5`
331 # Accept absolute paths.
333 [\\/]* | [A-Za-z]:[\\/]*)
334 re_direlt='/[^/][^/]*/\.\./'
336 # Canonicalize the path of ld
337 ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
338 while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
339 ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
341 test -z "$LD" && LD="$ac_prog"
344 # If it fails, then pretend we aren't using GCC.
348 # If it is relative, then search for the first ld in PATH.
352 elif test "$with_gnu_ld" = yes; then
353 AC_MSG_CHECKING([for GNU ld])
355 AC_MSG_CHECKING([for non-GNU ld])
357 AC_CACHE_VAL(ac_cv_path_LD,
358 [if test -z "$LD"; then
359 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
360 for ac_dir in $PATH; do
361 test -z "$ac_dir" && ac_dir=.
362 if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
363 ac_cv_path_LD="$ac_dir/$ac_prog"
364 # Check to see if the program is GNU ld. I'd rather use --version,
365 # but apparently some GNU ld's only accept -v.
366 # Break only if it was the GNU/non-GNU ld that we prefer.
367 if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
368 test "$with_gnu_ld" != no && break
370 test "$with_gnu_ld" != yes && break
376 ac_cv_path_LD="$LD" # Let the user override the test with a path.
379 if test -n "$LD"; then
384 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
388 AC_DEFUN(AC_PROG_LD_GNU,
389 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
390 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
391 if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
392 ac_cv_prog_gnu_ld=yes
398 # AC_PROG_NM - find the path to a BSD-compatible name lister
400 [AC_MSG_CHECKING([for BSD-compatible nm])
401 AC_CACHE_VAL(ac_cv_path_NM,
402 [if test -n "$NM"; then
403 # Let the user override the test.
406 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
407 for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
408 test -z "$ac_dir" && ac_dir=.
409 if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then
410 # Check to see if the nm accepts a BSD-compat flag.
411 # Adding the `sed 1q' prevents false positives on HP-UX, which says:
412 # nm: unknown option "B" ignored
413 if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
414 ac_cv_path_NM="$ac_dir/nm -B"
416 elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
417 ac_cv_path_NM="$ac_dir/nm -p"
420 ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
421 continue # so that we can try to find one that supports BSD flags
426 test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
432 # AC_CHECK_LIBM - check for math library
433 AC_DEFUN(AC_CHECK_LIBM,
434 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
437 *-*-beos* | *-*-cygwin*)
438 # These system don't have libm
441 AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
442 AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
445 AC_CHECK_LIB(m, main, LIBM="-lm")
450 # AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
451 # the libltdl convenience library, adds --enable-ltdl-convenience to
452 # the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor
453 # is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed
454 # to be `${top_builddir}/libltdl'. Make sure you start DIR with
455 # '${top_builddir}/' (note the single quotes!) if your package is not
456 # flat, and, if you're not using automake, define top_builddir as
457 # appropriate in the Makefiles.
458 AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
459 case "$enable_ltdl_convenience" in
460 no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
461 "") enable_ltdl_convenience=yes
462 ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
464 LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la
465 INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
468 # AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
469 # the libltdl installable library, and adds --enable-ltdl-install 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 # In the future, this macro may have to be called after AC_PROG_LIBTOOL.
477 AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
478 AC_CHECK_LIB(ltdl, main,
479 [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
480 [if test x"$enable_ltdl_install" = xno; then
481 AC_MSG_WARN([libltdl not installed, but installation disabled])
483 enable_ltdl_install=yes
486 if test x"$enable_ltdl_install" = x"yes"; then
487 ac_configure_args="$ac_configure_args --enable-ltdl-install"
488 LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la
489 INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
491 ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
498 AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
499 AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
500 AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
501 AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
502 AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
503 AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
504 AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
506 dnl This is just to silence aclocal about the macro not being used
507 ifelse([AC_DISABLE_FAST_INSTALL])dnl