]> git.sur5r.net Git - openldap/blob - aclocal.m4
Update ctime_r() argument macro to cache results and to produce
[openldap] / aclocal.m4
1 dnl aclocal.m4 generated automatically by aclocal 1.3
2
3 dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
4 dnl This Makefile.in 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([AM_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")
41 AC_DEFINE_UNQUOTED(VERSION, "$VERSION"))
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 # serial 1
55
56 AC_DEFUN(AM_PROG_INSTALL,
57 [AC_REQUIRE([AC_PROG_INSTALL])
58 test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
59 AC_SUBST(INSTALL_SCRIPT)dnl
60 ])
61
62 #
63 # Check to make sure that the build environment is sane.
64 #
65
66 AC_DEFUN(AM_SANITY_CHECK,
67 [AC_MSG_CHECKING([whether build environment is sane])
68 # Just in case
69 sleep 1
70 echo timestamp > conftestfile
71 # Do `set' in a subshell so we don't clobber the current shell's
72 # arguments.  Must try -L first in case configure is actually a
73 # symlink; some systems play weird games with the mod time of symlinks
74 # (eg FreeBSD returns the mod time of the symlink's containing
75 # directory).
76 if (
77    set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
78    if test "[$]*" = "X"; then
79       # -L didn't work.
80       set X `ls -t $srcdir/configure conftestfile`
81    fi
82    if test "[$]*" != "X $srcdir/configure conftestfile" \
83       && test "[$]*" != "X conftestfile $srcdir/configure"; then
84
85       # If neither matched, then we have a broken ls.  This can happen
86       # if, for instance, CONFIG_SHELL is bash and it inherits a
87       # broken ls alias from the environment.  This has actually
88       # happened.  Such a system could not be considered "sane".
89       AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
90 alias in your environment])
91    fi
92
93    test "[$]2" = conftestfile
94    )
95 then
96    # Ok.
97    :
98 else
99    AC_MSG_ERROR([newly created file is older than distributed files!
100 Check your system clock])
101 fi
102 rm -f conftest*
103 AC_MSG_RESULT(yes)])
104
105 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
106 dnl The program must properly implement --version.
107 AC_DEFUN(AM_MISSING_PROG,
108 [AC_MSG_CHECKING(for working $2)
109 # Run test in a subshell; some versions of sh will print an error if
110 # an executable is not found, even if stderr is redirected.
111 # Redirect stdin to placate older versions of autoconf.  Sigh.
112 if ($2 --version) < /dev/null > /dev/null 2>&1; then
113    $1=$2
114    AC_MSG_RESULT(found)
115 else
116    $1="$3/missing $2"
117    AC_MSG_RESULT(missing)
118 fi
119 AC_SUBST($1)])
120
121
122 # serial 24 AM_PROG_LIBTOOL
123 AC_DEFUN(AM_PROG_LIBTOOL,
124 [AC_REQUIRE([AM_ENABLE_SHARED])dnl
125 AC_REQUIRE([AM_ENABLE_STATIC])dnl
126 AC_REQUIRE([AC_CANONICAL_HOST])dnl
127 AC_REQUIRE([AC_PROG_RANLIB])dnl
128 AC_REQUIRE([AC_PROG_CC])dnl
129 AC_REQUIRE([AM_PROG_LD])dnl
130 AC_REQUIRE([AM_PROG_NM])dnl
131 AC_REQUIRE([AC_PROG_LN_S])dnl
132 dnl
133 # Always use our own libtool.
134 LIBTOOL='$(SHELL) $(top_builddir)/libtool'
135 AC_SUBST(LIBTOOL)dnl
136
137 # Check for any special flags to pass to ltconfig.
138 libtool_flags=
139 test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
140 test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
141 test "$silent" = yes && libtool_flags="$libtool_flags --silent"
142 test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
143 test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
144
145 # Some flags need to be propagated to the compiler or linker for good
146 # libtool support.
147 case "$host" in
148 *-*-irix6*)
149   # Find out which ABI we are using.
150   echo '[#]line __oline__ "configure"' > conftest.$ac_ext
151   if AC_TRY_EVAL(ac_compile); then
152     case "`/usr/bin/file conftest.o`" in
153     *32-bit*)
154       LD="${LD-ld} -32"
155       ;;
156     *N32*)
157       LD="${LD-ld} -n32"
158       ;;
159     *64-bit*)
160       LD="${LD-ld} -64"
161       ;;
162     esac
163   fi
164   rm -rf conftest*
165   ;;
166
167 *-*-sco3.2v5*)
168   # On SCO OpenServer 5, we need -belf to get full-featured binaries.
169   CFLAGS="$CFLAGS -belf"
170   ;;
171 esac
172
173 # Actually configure libtool.  ac_aux_dir is where install-sh is found.
174 CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
175 LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \
176 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig \
177 $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
178 || AC_MSG_ERROR([libtool configure failed])
179 ])
180
181 # AM_ENABLE_SHARED - implement the --enable-shared flag
182 # Usage: AM_ENABLE_SHARED[(DEFAULT)]
183 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
184 #   `yes'.
185 AC_DEFUN(AM_ENABLE_SHARED,
186 [define([AM_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
187 AC_ARG_ENABLE(shared,
188 changequote(<<, >>)dnl
189 <<  --enable-shared         build shared libraries [default=>>AM_ENABLE_SHARED_DEFAULT]
190 changequote([, ])dnl
191 [  --enable-shared=PKGS    only build shared libraries if the current package
192                           appears as an element in the PKGS list],
193 [p=${PACKAGE-default}
194 case "$enableval" in
195 yes) enable_shared=yes ;;
196 no) enable_shared=no ;;
197 *)
198   enable_shared=no
199   # Look at the argument we got.  We use all the common list separators.
200   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
201   for pkg in $enableval; do
202     if test "X$pkg" = "X$p"; then
203       enable_shared=yes
204     fi
205   done
206   IFS="$ac_save_ifs"
207   ;;
208 esac],
209 enable_shared=AM_ENABLE_SHARED_DEFAULT)dnl
210 ])
211
212 # AM_DISABLE_SHARED - set the default shared flag to --disable-shared
213 AC_DEFUN(AM_DISABLE_SHARED,
214 [AM_ENABLE_SHARED(no)])
215
216 # AM_DISABLE_STATIC - set the default static flag to --disable-static
217 AC_DEFUN(AM_DISABLE_STATIC,
218 [AM_ENABLE_STATIC(no)])
219
220 # AM_ENABLE_STATIC - implement the --enable-static flag
221 # Usage: AM_ENABLE_STATIC[(DEFAULT)]
222 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
223 #   `yes'.
224 AC_DEFUN(AM_ENABLE_STATIC,
225 [define([AM_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
226 AC_ARG_ENABLE(static,
227 changequote(<<, >>)dnl
228 <<  --enable-static         build static libraries [default=>>AM_ENABLE_STATIC_DEFAULT]
229 changequote([, ])dnl
230 [  --enable-static=PKGS    only build shared libraries if the current package
231                           appears as an element in the PKGS list],
232 [p=${PACKAGE-default}
233 case "$enableval" in
234 yes) enable_static=yes ;;
235 no) enable_static=no ;;
236 *)
237   enable_static=no
238   # Look at the argument we got.  We use all the common list separators.
239   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
240   for pkg in $enableval; do
241     if test "X$pkg" = "X$p"; then
242       enable_static=yes
243     fi
244   done
245   IFS="$ac_save_ifs"
246   ;;
247 esac],
248 enable_static=AM_ENABLE_STATIC_DEFAULT)dnl
249 ])
250
251
252 # AM_PROG_LD - find the path to the GNU or non-GNU linker
253 AC_DEFUN(AM_PROG_LD,
254 [AC_ARG_WITH(gnu-ld,
255 [  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
256 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
257 AC_REQUIRE([AC_PROG_CC])
258 ac_prog=ld
259 if test "$ac_cv_prog_gcc" = yes; then
260   # Check if gcc -print-prog-name=ld gives a path.
261   AC_MSG_CHECKING([for ld used by GCC])
262   ac_prog=`($CC -print-prog-name=ld) 2>&5`
263   case "$ac_prog" in
264   # Accept absolute paths.
265   /* | [A-Za-z]:\\*)
266     test -z "$LD" && LD="$ac_prog"
267     ;;
268   "")
269     # If it fails, then pretend we aren't using GCC.
270     ac_prog=ld
271     ;;
272   *)
273     # If it is relative, then search for the first ld in PATH.
274     with_gnu_ld=unknown
275     ;;
276   esac
277 elif test "$with_gnu_ld" = yes; then
278   AC_MSG_CHECKING([for GNU ld])
279 else
280   AC_MSG_CHECKING([for non-GNU ld])
281 fi
282 AC_CACHE_VAL(ac_cv_path_LD,
283 [if test -z "$LD"; then
284   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
285   for ac_dir in $PATH; do
286     test -z "$ac_dir" && ac_dir=.
287     if test -f "$ac_dir/$ac_prog"; then
288       ac_cv_path_LD="$ac_dir/$ac_prog"
289       # Check to see if the program is GNU ld.  I'd rather use --version,
290       # but apparently some GNU ld's only accept -v.
291       # Break only if it was the GNU/non-GNU ld that we prefer.
292       if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
293         test "$with_gnu_ld" != no && break
294       else
295         test "$with_gnu_ld" != yes && break
296       fi
297     fi
298   done
299   IFS="$ac_save_ifs"
300 else
301   ac_cv_path_LD="$LD" # Let the user override the test with a path.
302 fi])
303 LD="$ac_cv_path_LD"
304 if test -n "$LD"; then
305   AC_MSG_RESULT($LD)
306 else
307   AC_MSG_RESULT(no)
308 fi
309 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
310 AC_SUBST(LD)
311 AM_PROG_LD_GNU
312 ])
313
314 AC_DEFUN(AM_PROG_LD_GNU,
315 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
316 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
317 if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
318   ac_cv_prog_gnu_ld=yes
319 else
320   ac_cv_prog_gnu_ld=no
321 fi])
322 ])
323
324 # AM_PROG_NM - find the path to a BSD-compatible name lister
325 AC_DEFUN(AM_PROG_NM,
326 [AC_MSG_CHECKING([for BSD-compatible nm])
327 AC_CACHE_VAL(ac_cv_path_NM,
328 [case "$NM" in
329 /* | [A-Za-z]:\\*)
330   ac_cv_path_NM="$NM" # Let the user override the test with a path.
331   ;;
332 *)
333   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
334   for ac_dir in /usr/ucb /usr/ccs/bin $PATH /bin; do
335     test -z "$ac_dir" && ac_dir=.
336     if test -f $ac_dir/nm; then
337       # Check to see if the nm accepts a BSD-compat flag.
338       # Adding the `sed 1q' prevents false positives on HP-UX, which says:
339       #   nm: unknown option "B" ignored
340       if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
341         ac_cv_path_NM="$ac_dir/nm -B"
342       elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
343         ac_cv_path_NM="$ac_dir/nm -p"
344       else
345         ac_cv_path_NM="$ac_dir/nm"
346       fi
347       break
348     fi
349   done
350   IFS="$ac_save_ifs"
351   test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
352   ;;
353 esac])
354 NM="$ac_cv_path_NM"
355 AC_MSG_RESULT([$NM])
356 AC_SUBST(NM)
357 ])
358
359
360 # serial 1
361
362 # @defmac AC_PROG_CC_STDC
363 # @maindex PROG_CC_STDC
364 # @ovindex CC
365 # If the C compiler in not in ANSI C mode by default, try to add an option
366 # to output variable @code{CC} to make it so.  This macro tries various
367 # options that select ANSI C on some system or another.  It considers the
368 # compiler to be in ANSI C mode if it handles function prototypes correctly.
369 #
370 # If you use this macro, you should check after calling it whether the C
371 # compiler has been set to accept ANSI C; if not, the shell variable
372 # @code{am_cv_prog_cc_stdc} is set to @samp{no}.  If you wrote your source
373 # code in ANSI C, you can make an un-ANSIfied copy of it by using the
374 # program @code{ansi2knr}, which comes with Ghostscript.
375 # @end defmac
376
377 AC_DEFUN(AM_PROG_CC_STDC,
378 [AC_REQUIRE([AC_PROG_CC])
379 AC_BEFORE([$0], [AC_C_INLINE])
380 AC_BEFORE([$0], [AC_C_CONST])
381 dnl Force this before AC_PROG_CPP.  Some cpp's, eg on HPUX, require
382 dnl a magic option to avoid problems with ANSI preprocessor commands
383 dnl like #elif.
384 dnl FIXME: can't do this because then AC_AIX won't work due to a
385 dnl circular dependency.
386 dnl AC_BEFORE([$0], [AC_PROG_CPP])
387 AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
388 AC_CACHE_VAL(am_cv_prog_cc_stdc,
389 [am_cv_prog_cc_stdc=no
390 ac_save_CC="$CC"
391 # Don't try gcc -ansi; that turns off useful extensions and
392 # breaks some systems' header files.
393 # AIX                   -qlanglvl=ansi
394 # Ultrix and OSF/1      -std1
395 # HP-UX                 -Aa -D_HPUX_SOURCE
396 # SVR4                  -Xc -D__EXTENSIONS__
397 for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
398 do
399   CC="$ac_save_CC $ac_arg"
400   AC_TRY_COMPILE(
401 [#include <stdarg.h>
402 #include <stdio.h>
403 #include <sys/types.h>
404 #include <sys/stat.h>
405 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
406 struct buf { int x; };
407 FILE * (*rcsopen) (struct buf *, struct stat *, int);
408 static char *e (p, i)
409      char **p;
410      int i;
411 {
412   return p[i];
413 }
414 static char *f (char * (*g) (char **, int), char **p, ...)
415 {
416   char *s;
417   va_list v;
418   va_start (v,p);
419   s = g (p, va_arg (v,int));
420   va_end (v);
421   return s;
422 }
423 int test (int i, double x);
424 struct s1 {int (*f) (int a);};
425 struct s2 {int (*f) (double a);};
426 int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
427 int argc;
428 char **argv;
429 ], [
430 return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
431 ],
432 [am_cv_prog_cc_stdc="$ac_arg"; break])
433 done
434 CC="$ac_save_CC"
435 ])
436 if test -z "$am_cv_prog_cc_stdc"; then
437   AC_MSG_RESULT([none needed])
438 else
439   AC_MSG_RESULT($am_cv_prog_cc_stdc)
440 fi
441 case "x$am_cv_prog_cc_stdc" in
442   x|xno) ;;
443   *) CC="$CC $am_cv_prog_cc_stdc" ;;
444 esac
445 ])
446
447 dnl From Jim Meyering.
448
449 # serial 1
450
451 AC_DEFUN(AM_HEADER_TIOCGWINSZ_NEEDS_SYS_IOCTL,
452 [AC_REQUIRE([AM_SYS_POSIX_TERMIOS])
453  AC_CACHE_CHECK([whether use of TIOCGWINSZ requires sys/ioctl.h],
454                 am_cv_sys_tiocgwinsz_needs_sys_ioctl_h,
455   [am_cv_sys_tiocgwinsz_needs_sys_ioctl_h=no
456
457   gwinsz_in_termios_h=no
458   if test $am_cv_sys_posix_termios = yes; then
459     AC_EGREP_CPP([yes],
460     [#include <sys/types.h>
461 #     include <termios.h>
462 #     ifdef TIOCGWINSZ
463         yes
464 #     endif
465     ], gwinsz_in_termios_h=yes)
466   fi
467
468   if test $gwinsz_in_termios_h = no; then
469     AC_EGREP_CPP([yes],
470     [#include <sys/types.h>
471 #     include <sys/ioctl.h>
472 #     ifdef TIOCGWINSZ
473         yes
474 #     endif
475     ], am_cv_sys_tiocgwinsz_needs_sys_ioctl_h=yes)
476   fi
477   ])
478   if test $am_cv_sys_tiocgwinsz_needs_sys_ioctl_h = yes; then
479     AC_DEFINE(GWINSZ_IN_SYS_IOCTL)
480   fi
481 ])
482
483 dnl From Jim Meyering.
484
485 # serial 1
486
487 AC_DEFUN(AM_SYS_POSIX_TERMIOS,
488 [AC_CACHE_CHECK([POSIX termios], am_cv_sys_posix_termios,
489   [AC_TRY_LINK([#include <sys/types.h>
490 #include <unistd.h>
491 #include <termios.h>],
492   [/* SunOS 4.0.3 has termios.h but not the library calls.  */
493    tcgetattr(0, 0);],
494   am_cv_sys_posix_termios=yes,
495   am_cv_sys_posix_termios=no)])
496 ])
497
498 # From Ulrich Drepper.
499
500 # serial 1
501
502 AC_DEFUN(AM_TYPE_PTRDIFF_T,
503   [AC_CACHE_CHECK([for ptrdiff_t], am_cv_type_ptrdiff_t,
504      [AC_TRY_COMPILE([#include <stddef.h>], [ptrdiff_t p],
505                      am_cv_type_ptrdiff_t=yes, am_cv_type_ptrdiff_t=no)])
506    if test $am_cv_type_ptrdiff_t = yes; then
507      AC_DEFINE(HAVE_PTRDIFF_T)
508    fi
509 ])
510