]> git.sur5r.net Git - openldap/blob - aclocal.m4
Rebuild configure using autoconf 1.3 (with aclocal from automake 1.4).
[openldap] / aclocal.m4
1 dnl aclocal.m4 generated automatically by aclocal 1.4
2
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.
7
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.
12
13 dnl Copyright 1998 The OpenLDAP Foundation,  All Rights Reserved.
14 dnl COPYING RESTRICTIONS APPLY, See COPYRIGHT file
15 dnl
16 dnl OpenLDAP Autoconf Macros
17 dnl
18 builtin(include, build/openldap.m4)dnl
19
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.
23
24 # serial 1
25
26 dnl Usage:
27 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
28
29 AC_DEFUN(AM_INIT_AUTOMAKE,
30 [AC_REQUIRE([AC_PROG_INSTALL])
31 PACKAGE=[$1]
32 AC_SUBST(PACKAGE)
33 VERSION=[$2]
34 AC_SUBST(VERSION)
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])
38 fi
39 ifelse([$3],,
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])])
52
53 #
54 # Check to make sure that the build environment is sane.
55 #
56
57 AC_DEFUN(AM_SANITY_CHECK,
58 [AC_MSG_CHECKING([whether build environment is sane])
59 # Just in case
60 sleep 1
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
66 # directory).
67 if (
68    set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
69    if test "[$]*" = "X"; then
70       # -L didn't work.
71       set X `ls -t $srcdir/configure conftestfile`
72    fi
73    if test "[$]*" != "X $srcdir/configure conftestfile" \
74       && test "[$]*" != "X conftestfile $srcdir/configure"; then
75
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])
82    fi
83
84    test "[$]2" = conftestfile
85    )
86 then
87    # Ok.
88    :
89 else
90    AC_MSG_ERROR([newly created file is older than distributed files!
91 Check your system clock])
92 fi
93 rm -f conftest*
94 AC_MSG_RESULT(yes)])
95
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
104    $1=$2
105    AC_MSG_RESULT(found)
106 else
107    $1="$3/missing $2"
108    AC_MSG_RESULT(missing)
109 fi
110 AC_SUBST($1)])
111
112
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
123 dnl
124 # Always use our own libtool.
125 LIBTOOL='$(SHELL) $(top_builddir)/libtool'
126 AC_SUBST(LIBTOOL)dnl
127
128 # Check for any special flags to pass to ltconfig.
129 libtool_flags=
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"
135
136 # Some flags need to be propagated to the compiler or linker for good
137 # libtool support.
138 case "$host" in
139 *-*-irix6*)
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
144     *32-bit*)
145       LD="${LD-ld} -32"
146       ;;
147     *N32*)
148       LD="${LD-ld} -n32"
149       ;;
150     *64-bit*)
151       LD="${LD-ld} -64"
152       ;;
153     esac
154   fi
155   rm -rf conftest*
156   ;;
157
158 *-*-sco3.2v5*)
159   # On SCO OpenServer 5, we need -belf to get full-featured binaries.
160   CFLAGS="$CFLAGS -belf"
161   ;;
162 esac
163
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])
170 ])
171
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
175 #   `yes'.
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]
181 changequote([, ])dnl
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}
185 case "$enableval" in
186 yes) enable_shared=yes ;;
187 no) enable_shared=no ;;
188 *)
189   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
194       enable_shared=yes
195     fi
196   done
197   IFS="$ac_save_ifs"
198   ;;
199 esac],
200 enable_shared=AM_ENABLE_SHARED_DEFAULT)dnl
201 ])
202
203 # AM_DISABLE_SHARED - set the default shared flag to --disable-shared
204 AC_DEFUN(AM_DISABLE_SHARED,
205 [AM_ENABLE_SHARED(no)])
206
207 # AM_DISABLE_STATIC - set the default static flag to --disable-static
208 AC_DEFUN(AM_DISABLE_STATIC,
209 [AM_ENABLE_STATIC(no)])
210
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
214 #   `yes'.
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]
220 changequote([, ])dnl
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}
224 case "$enableval" in
225 yes) enable_static=yes ;;
226 no) enable_static=no ;;
227 *)
228   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
233       enable_static=yes
234     fi
235   done
236   IFS="$ac_save_ifs"
237   ;;
238 esac],
239 enable_static=AM_ENABLE_STATIC_DEFAULT)dnl
240 ])
241
242
243 # AM_PROG_LD - find the path to the GNU or non-GNU linker
244 AC_DEFUN(AM_PROG_LD,
245 [AC_ARG_WITH(gnu-ld,
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])
249 ac_prog=ld
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`
254   case "$ac_prog" in
255   # Accept absolute paths.
256   /* | [A-Za-z]:\\*)
257     test -z "$LD" && LD="$ac_prog"
258     ;;
259   "")
260     # If it fails, then pretend we aren't using GCC.
261     ac_prog=ld
262     ;;
263   *)
264     # If it is relative, then search for the first ld in PATH.
265     with_gnu_ld=unknown
266     ;;
267   esac
268 elif test "$with_gnu_ld" = yes; then
269   AC_MSG_CHECKING([for GNU ld])
270 else
271   AC_MSG_CHECKING([for non-GNU ld])
272 fi
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
285       else
286         test "$with_gnu_ld" != yes && break
287       fi
288     fi
289   done
290   IFS="$ac_save_ifs"
291 else
292   ac_cv_path_LD="$LD" # Let the user override the test with a path.
293 fi])
294 LD="$ac_cv_path_LD"
295 if test -n "$LD"; then
296   AC_MSG_RESULT($LD)
297 else
298   AC_MSG_RESULT(no)
299 fi
300 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
301 AC_SUBST(LD)
302 AM_PROG_LD_GNU
303 ])
304
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
310 else
311   ac_cv_prog_gnu_ld=no
312 fi])
313 ])
314
315 # AM_PROG_NM - find the path to a BSD-compatible name lister
316 AC_DEFUN(AM_PROG_NM,
317 [AC_MSG_CHECKING([for BSD-compatible nm])
318 AC_CACHE_VAL(ac_cv_path_NM,
319 [case "$NM" in
320 /* | [A-Za-z]:\\*)
321   ac_cv_path_NM="$NM" # Let the user override the test with a path.
322   ;;
323 *)
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"
335       else
336         ac_cv_path_NM="$ac_dir/nm"
337       fi
338       break
339     fi
340   done
341   IFS="$ac_save_ifs"
342   test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
343   ;;
344 esac])
345 NM="$ac_cv_path_NM"
346 AC_MSG_RESULT([$NM])
347 AC_SUBST(NM)
348 ])
349
350
351 # serial 1
352
353 # @defmac AC_PROG_CC_STDC
354 # @maindex PROG_CC_STDC
355 # @ovindex CC
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.
360 #
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.
366 # @end defmac
367
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
374 dnl like #elif.
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
381 ac_save_CC="$CC"
382 # Don't try gcc -ansi; that turns off useful extensions and
383 # breaks some systems' header files.
384 # AIX                   -qlanglvl=ansi
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__"
389 do
390   CC="$ac_save_CC $ac_arg"
391   AC_TRY_COMPILE(
392 [#include <stdarg.h>
393 #include <stdio.h>
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)
400      char **p;
401      int i;
402 {
403   return p[i];
404 }
405 static char *f (char * (*g) (char **, int), char **p, ...)
406 {
407   char *s;
408   va_list v;
409   va_start (v,p);
410   s = g (p, va_arg (v,int));
411   va_end (v);
412   return s;
413 }
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);
418 int argc;
419 char **argv;
420 ], [
421 return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
422 ],
423 [am_cv_prog_cc_stdc="$ac_arg"; break])
424 done
425 CC="$ac_save_CC"
426 ])
427 if test -z "$am_cv_prog_cc_stdc"; then
428   AC_MSG_RESULT([none needed])
429 else
430   AC_MSG_RESULT($am_cv_prog_cc_stdc)
431 fi
432 case "x$am_cv_prog_cc_stdc" in
433   x|xno) ;;
434   *) CC="$CC $am_cv_prog_cc_stdc" ;;
435 esac
436 ])
437
438 dnl From Jim Meyering.
439
440 # serial 1
441
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
447
448   gwinsz_in_termios_h=no
449   if test $am_cv_sys_posix_termios = yes; then
450     AC_EGREP_CPP([yes],
451     [#include <sys/types.h>
452 #     include <termios.h>
453 #     ifdef TIOCGWINSZ
454         yes
455 #     endif
456     ], gwinsz_in_termios_h=yes)
457   fi
458
459   if test $gwinsz_in_termios_h = no; then
460     AC_EGREP_CPP([yes],
461     [#include <sys/types.h>
462 #     include <sys/ioctl.h>
463 #     ifdef TIOCGWINSZ
464         yes
465 #     endif
466     ], am_cv_sys_tiocgwinsz_needs_sys_ioctl_h=yes)
467   fi
468   ])
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])
472   fi
473 ])
474
475 dnl From Jim Meyering.
476
477 # serial 1
478
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>
482 #include <unistd.h>
483 #include <termios.h>],
484   [/* SunOS 4.0.3 has termios.h but not the library calls.  */
485    tcgetattr(0, 0);],
486   am_cv_sys_posix_termios=yes,
487   am_cv_sys_posix_termios=no)])
488 ])
489
490 # From Ulrich Drepper.
491
492 # serial 1
493
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])
500    fi
501 ])
502