1 dnl aclocal.m4 generated automatically by aclocal 1.4
3 dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
8 dnl This program is distributed in the hope that it will be useful,
9 dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10 dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 dnl PARTICULAR PURPOSE.
13 dnl Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
14 dnl COPYING RESTRICTIONS APPLY, See COPYRIGHT file
16 dnl OpenLDAP Autoconf Macros
18 builtin(include, build/openldap.m4)dnl
20 # Do all the work for Automake. This macro actually does too much --
21 # some checks are only needed if your package does certain things.
22 # But this isn't really a big deal.
27 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
29 AC_DEFUN(AM_INIT_AUTOMAKE,
30 [AC_REQUIRE([AC_PROG_INSTALL])
35 dnl test to see if srcdir already configured
36 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
37 AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
40 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
41 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
42 AC_REQUIRE([AM_SANITY_CHECK])
43 AC_REQUIRE([AC_ARG_PROGRAM])
44 dnl FIXME This is truly gross.
45 missing_dir=`cd $ac_aux_dir && pwd`
46 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
47 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
48 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
49 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
50 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
51 AC_REQUIRE([AC_PROG_MAKE_SET])])
54 # Check to make sure that the build environment is sane.
57 AC_DEFUN(AM_SANITY_CHECK,
58 [AC_MSG_CHECKING([whether build environment is sane])
61 echo timestamp > conftestfile
62 # Do `set' in a subshell so we don't clobber the current shell's
63 # arguments. Must try -L first in case configure is actually a
64 # symlink; some systems play weird games with the mod time of symlinks
65 # (eg FreeBSD returns the mod time of the symlink's containing
68 set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
69 if test "[$]*" = "X"; then
71 set X `ls -t $srcdir/configure conftestfile`
73 if test "[$]*" != "X $srcdir/configure conftestfile" \
74 && test "[$]*" != "X conftestfile $srcdir/configure"; then
76 # If neither matched, then we have a broken ls. This can happen
77 # if, for instance, CONFIG_SHELL is bash and it inherits a
78 # broken ls alias from the environment. This has actually
79 # happened. Such a system could not be considered "sane".
80 AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
81 alias in your environment])
84 test "[$]2" = conftestfile
90 AC_MSG_ERROR([newly created file is older than distributed files!
91 Check your system clock])
96 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
97 dnl The program must properly implement --version.
98 AC_DEFUN(AM_MISSING_PROG,
99 [AC_MSG_CHECKING(for working $2)
100 # Run test in a subshell; some versions of sh will print an error if
101 # an executable is not found, even if stderr is redirected.
102 # Redirect stdin to placate older versions of autoconf. Sigh.
103 if ($2 --version) < /dev/null > /dev/null 2>&1; then
108 AC_MSG_RESULT(missing)
113 # serial 24 AM_PROG_LIBTOOL
114 AC_DEFUN(AM_PROG_LIBTOOL,
115 [AC_REQUIRE([AM_ENABLE_SHARED])dnl
116 AC_REQUIRE([AM_ENABLE_STATIC])dnl
117 AC_REQUIRE([AC_CANONICAL_HOST])dnl
118 AC_REQUIRE([AC_PROG_RANLIB])dnl
119 AC_REQUIRE([AC_PROG_CC])dnl
120 AC_REQUIRE([AM_PROG_LD])dnl
121 AC_REQUIRE([AM_PROG_NM])dnl
122 AC_REQUIRE([AC_PROG_LN_S])dnl
124 # Always use our own libtool.
125 LIBTOOL='$(SHELL) $(top_builddir)/libtool'
128 # Check for any special flags to pass to ltconfig.
130 test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
131 test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
132 test "$silent" = yes && libtool_flags="$libtool_flags --silent"
133 test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
134 test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
136 # Some flags need to be propagated to the compiler or linker for good
140 # Find out which ABI we are using.
141 echo '[#]line __oline__ "configure"' > conftest.$ac_ext
142 if AC_TRY_EVAL(ac_compile); then
143 case "`/usr/bin/file conftest.o`" in
159 # On SCO OpenServer 5, we need -belf to get full-featured binaries.
160 CFLAGS="$CFLAGS -belf"
164 # Actually configure libtool. ac_aux_dir is where install-sh is found.
165 CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
166 LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \
167 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig \
168 $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
169 || AC_MSG_ERROR([libtool configure failed])
172 # AM_ENABLE_SHARED - implement the --enable-shared flag
173 # Usage: AM_ENABLE_SHARED[(DEFAULT)]
174 # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
176 AC_DEFUN(AM_ENABLE_SHARED,
177 [define([AM_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
178 AC_ARG_ENABLE(shared,
179 changequote(<<, >>)dnl
180 << --enable-shared build shared libraries [default=>>AM_ENABLE_SHARED_DEFAULT]
182 [ --enable-shared=PKGS only build shared libraries if the current package
183 appears as an element in the PKGS list],
184 [p=${PACKAGE-default}
186 yes) enable_shared=yes ;;
187 no) enable_shared=no ;;
190 # Look at the argument we got. We use all the common list separators.
191 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
192 for pkg in $enableval; do
193 if test "X$pkg" = "X$p"; then
200 enable_shared=AM_ENABLE_SHARED_DEFAULT)dnl
203 # AM_DISABLE_SHARED - set the default shared flag to --disable-shared
204 AC_DEFUN(AM_DISABLE_SHARED,
205 [AM_ENABLE_SHARED(no)])
207 # AM_DISABLE_STATIC - set the default static flag to --disable-static
208 AC_DEFUN(AM_DISABLE_STATIC,
209 [AM_ENABLE_STATIC(no)])
211 # AM_ENABLE_STATIC - implement the --enable-static flag
212 # Usage: AM_ENABLE_STATIC[(DEFAULT)]
213 # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
215 AC_DEFUN(AM_ENABLE_STATIC,
216 [define([AM_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
217 AC_ARG_ENABLE(static,
218 changequote(<<, >>)dnl
219 << --enable-static build static libraries [default=>>AM_ENABLE_STATIC_DEFAULT]
221 [ --enable-static=PKGS only build shared libraries if the current package
222 appears as an element in the PKGS list],
223 [p=${PACKAGE-default}
225 yes) enable_static=yes ;;
226 no) enable_static=no ;;
229 # Look at the argument we got. We use all the common list separators.
230 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
231 for pkg in $enableval; do
232 if test "X$pkg" = "X$p"; then
239 enable_static=AM_ENABLE_STATIC_DEFAULT)dnl
243 # AM_PROG_LD - find the path to the GNU or non-GNU linker
246 [ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
247 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
248 AC_REQUIRE([AC_PROG_CC])
250 if test "$ac_cv_prog_gcc" = yes; then
251 # Check if gcc -print-prog-name=ld gives a path.
252 AC_MSG_CHECKING([for ld used by GCC])
253 ac_prog=`($CC -print-prog-name=ld) 2>&5`
255 # Accept absolute paths.
257 test -z "$LD" && LD="$ac_prog"
260 # If it fails, then pretend we aren't using GCC.
264 # If it is relative, then search for the first ld in PATH.
268 elif test "$with_gnu_ld" = yes; then
269 AC_MSG_CHECKING([for GNU ld])
271 AC_MSG_CHECKING([for non-GNU ld])
273 AC_CACHE_VAL(ac_cv_path_LD,
274 [if test -z "$LD"; then
275 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
276 for ac_dir in $PATH; do
277 test -z "$ac_dir" && ac_dir=.
278 if test -f "$ac_dir/$ac_prog"; then
279 ac_cv_path_LD="$ac_dir/$ac_prog"
280 # Check to see if the program is GNU ld. I'd rather use --version,
281 # but apparently some GNU ld's only accept -v.
282 # Break only if it was the GNU/non-GNU ld that we prefer.
283 if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
284 test "$with_gnu_ld" != no && break
286 test "$with_gnu_ld" != yes && break
292 ac_cv_path_LD="$LD" # Let the user override the test with a path.
295 if test -n "$LD"; then
300 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
305 AC_DEFUN(AM_PROG_LD_GNU,
306 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
307 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
308 if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
309 ac_cv_prog_gnu_ld=yes
315 # AM_PROG_NM - find the path to a BSD-compatible name lister
317 [AC_MSG_CHECKING([for BSD-compatible nm])
318 AC_CACHE_VAL(ac_cv_path_NM,
321 ac_cv_path_NM="$NM" # Let the user override the test with a path.
324 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
325 for ac_dir in /usr/ucb /usr/ccs/bin $PATH /bin; do
326 test -z "$ac_dir" && ac_dir=.
327 if test -f $ac_dir/nm; then
328 # Check to see if the nm accepts a BSD-compat flag.
329 # Adding the `sed 1q' prevents false positives on HP-UX, which says:
330 # nm: unknown option "B" ignored
331 if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
332 ac_cv_path_NM="$ac_dir/nm -B"
333 elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
334 ac_cv_path_NM="$ac_dir/nm -p"
336 ac_cv_path_NM="$ac_dir/nm"
342 test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
353 # @defmac AC_PROG_CC_STDC
354 # @maindex PROG_CC_STDC
356 # If the C compiler in not in ANSI C mode by default, try to add an option
357 # to output variable @code{CC} to make it so. This macro tries various
358 # options that select ANSI C on some system or another. It considers the
359 # compiler to be in ANSI C mode if it handles function prototypes correctly.
361 # If you use this macro, you should check after calling it whether the C
362 # compiler has been set to accept ANSI C; if not, the shell variable
363 # @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source
364 # code in ANSI C, you can make an un-ANSIfied copy of it by using the
365 # program @code{ansi2knr}, which comes with Ghostscript.
368 AC_DEFUN(AM_PROG_CC_STDC,
369 [AC_REQUIRE([AC_PROG_CC])
370 AC_BEFORE([$0], [AC_C_INLINE])
371 AC_BEFORE([$0], [AC_C_CONST])
372 dnl Force this before AC_PROG_CPP. Some cpp's, eg on HPUX, require
373 dnl a magic option to avoid problems with ANSI preprocessor commands
375 dnl FIXME: can't do this because then AC_AIX won't work due to a
376 dnl circular dependency.
377 dnl AC_BEFORE([$0], [AC_PROG_CPP])
378 AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
379 AC_CACHE_VAL(am_cv_prog_cc_stdc,
380 [am_cv_prog_cc_stdc=no
382 # Don't try gcc -ansi; that turns off useful extensions and
383 # breaks some systems' header files.
385 # Ultrix and OSF/1 -std1
386 # HP-UX -Aa -D_HPUX_SOURCE
387 # SVR4 -Xc -D__EXTENSIONS__
388 for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
390 CC="$ac_save_CC $ac_arg"
394 #include <sys/types.h>
395 #include <sys/stat.h>
396 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
397 struct buf { int x; };
398 FILE * (*rcsopen) (struct buf *, struct stat *, int);
399 static char *e (p, i)
405 static char *f (char * (*g) (char **, int), char **p, ...)
410 s = g (p, va_arg (v,int));
414 int test (int i, double x);
415 struct s1 {int (*f) (int a);};
416 struct s2 {int (*f) (double a);};
417 int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
421 return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
423 [am_cv_prog_cc_stdc="$ac_arg"; break])
427 if test -z "$am_cv_prog_cc_stdc"; then
428 AC_MSG_RESULT([none needed])
430 AC_MSG_RESULT($am_cv_prog_cc_stdc)
432 case "x$am_cv_prog_cc_stdc" in
434 *) CC="$CC $am_cv_prog_cc_stdc" ;;
438 dnl From Jim Meyering.
442 AC_DEFUN(AM_HEADER_TIOCGWINSZ_NEEDS_SYS_IOCTL,
443 [AC_REQUIRE([AM_SYS_POSIX_TERMIOS])
444 AC_CACHE_CHECK([whether use of TIOCGWINSZ requires sys/ioctl.h],
445 am_cv_sys_tiocgwinsz_needs_sys_ioctl_h,
446 [am_cv_sys_tiocgwinsz_needs_sys_ioctl_h=no
448 gwinsz_in_termios_h=no
449 if test $am_cv_sys_posix_termios = yes; then
451 [#include <sys/types.h>
452 # include <termios.h>
456 ], gwinsz_in_termios_h=yes)
459 if test $gwinsz_in_termios_h = no; then
461 [#include <sys/types.h>
462 # include <sys/ioctl.h>
466 ], am_cv_sys_tiocgwinsz_needs_sys_ioctl_h=yes)
469 if test $am_cv_sys_tiocgwinsz_needs_sys_ioctl_h = yes; then
470 AC_DEFINE(GWINSZ_IN_SYS_IOCTL,1,
471 [Define if TIOCGWINSZ requires sys/ioctl.h])
475 dnl From Jim Meyering.
479 AC_DEFUN(AM_SYS_POSIX_TERMIOS,
480 [AC_CACHE_CHECK([POSIX termios], am_cv_sys_posix_termios,
481 [AC_TRY_LINK([#include <sys/types.h>
483 #include <termios.h>],
484 [/* SunOS 4.0.3 has termios.h but not the library calls. */
486 am_cv_sys_posix_termios=yes,
487 am_cv_sys_posix_termios=no)])
490 # From Ulrich Drepper.
494 AC_DEFUN(AM_TYPE_PTRDIFF_T,
495 [AC_CACHE_CHECK([for ptrdiff_t], am_cv_type_ptrdiff_t,
496 [AC_TRY_COMPILE([#include <stddef.h>], [ptrdiff_t p],
497 am_cv_type_ptrdiff_t=yes, am_cv_type_ptrdiff_t=no)])
498 if test $am_cv_type_ptrdiff_t = yes; then
499 AC_DEFINE(HAVE_PTRDIFF_T,1,[Define if system has ptrdiff_t type])