]> git.sur5r.net Git - openldap/blob - aclocal.m4
Add libtool support based upon patch by Bart Hartgers <Hartgers@kfm1.phys.tue.nl>
[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
14 dnl OpenLDAP Autoconf Macros
15 dnl
16 builtin(include, build/openldap.m4)dnl
17
18 # Do all the work for Automake.  This macro actually does too much --
19 # some checks are only needed if your package does certain things.
20 # But this isn't really a big deal.
21
22 # serial 1
23
24 dnl Usage:
25 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
26
27 AC_DEFUN(AM_INIT_AUTOMAKE,
28 [AC_REQUIRE([AM_PROG_INSTALL])
29 PACKAGE=[$1]
30 AC_SUBST(PACKAGE)
31 VERSION=[$2]
32 AC_SUBST(VERSION)
33 dnl test to see if srcdir already configured
34 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
35   AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
36 fi
37 ifelse([$3],,
38 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
39 AC_DEFINE_UNQUOTED(VERSION, "$VERSION"))
40 AC_REQUIRE([AM_SANITY_CHECK])
41 AC_REQUIRE([AC_ARG_PROGRAM])
42 dnl FIXME This is truly gross.
43 missing_dir=`cd $ac_aux_dir && pwd`
44 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
45 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
46 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
47 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
48 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
49 AC_REQUIRE([AC_PROG_MAKE_SET])])
50
51
52 # serial 1
53
54 AC_DEFUN(AM_PROG_INSTALL,
55 [AC_REQUIRE([AC_PROG_INSTALL])
56 test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
57 AC_SUBST(INSTALL_SCRIPT)dnl
58 ])
59
60 #
61 # Check to make sure that the build environment is sane.
62 #
63
64 AC_DEFUN(AM_SANITY_CHECK,
65 [AC_MSG_CHECKING([whether build environment is sane])
66 # Just in case
67 sleep 1
68 echo timestamp > conftestfile
69 # Do `set' in a subshell so we don't clobber the current shell's
70 # arguments.  Must try -L first in case configure is actually a
71 # symlink; some systems play weird games with the mod time of symlinks
72 # (eg FreeBSD returns the mod time of the symlink's containing
73 # directory).
74 if (
75    set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
76    if test "[$]*" = "X"; then
77       # -L didn't work.
78       set X `ls -t $srcdir/configure conftestfile`
79    fi
80    if test "[$]*" != "X $srcdir/configure conftestfile" \
81       && test "[$]*" != "X conftestfile $srcdir/configure"; then
82
83       # If neither matched, then we have a broken ls.  This can happen
84       # if, for instance, CONFIG_SHELL is bash and it inherits a
85       # broken ls alias from the environment.  This has actually
86       # happened.  Such a system could not be considered "sane".
87       AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
88 alias in your environment])
89    fi
90
91    test "[$]2" = conftestfile
92    )
93 then
94    # Ok.
95    :
96 else
97    AC_MSG_ERROR([newly created file is older than distributed files!
98 Check your system clock])
99 fi
100 rm -f conftest*
101 AC_MSG_RESULT(yes)])
102
103 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
104 dnl The program must properly implement --version.
105 AC_DEFUN(AM_MISSING_PROG,
106 [AC_MSG_CHECKING(for working $2)
107 # Run test in a subshell; some versions of sh will print an error if
108 # an executable is not found, even if stderr is redirected.
109 # Redirect stdin to placate older versions of autoconf.  Sigh.
110 if ($2 --version) < /dev/null > /dev/null 2>&1; then
111    $1=$2
112    AC_MSG_RESULT(found)
113 else
114    $1="$3/missing $2"
115    AC_MSG_RESULT(missing)
116 fi
117 AC_SUBST($1)])
118
119
120 # serial 24 AM_PROG_LIBTOOL
121 AC_DEFUN(AM_PROG_LIBTOOL,
122 [AC_REQUIRE([AM_ENABLE_SHARED])dnl
123 AC_REQUIRE([AM_ENABLE_STATIC])dnl
124 AC_REQUIRE([AC_CANONICAL_HOST])dnl
125 AC_REQUIRE([AC_PROG_RANLIB])dnl
126 AC_REQUIRE([AC_PROG_CC])dnl
127 AC_REQUIRE([AM_PROG_LD])dnl
128 AC_REQUIRE([AM_PROG_NM])dnl
129 AC_REQUIRE([AC_PROG_LN_S])dnl
130 dnl
131 # Always use our own libtool.
132 LIBTOOL='$(SHELL) $(top_builddir)/libtool'
133 AC_SUBST(LIBTOOL)dnl
134
135 # Check for any special flags to pass to ltconfig.
136 libtool_flags=
137 test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
138 test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
139 test "$silent" = yes && libtool_flags="$libtool_flags --silent"
140 test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
141 test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
142
143 # Some flags need to be propagated to the compiler or linker for good
144 # libtool support.
145 case "$host" in
146 *-*-irix6*)
147   # Find out which ABI we are using.
148   echo '[#]line __oline__ "configure"' > conftest.$ac_ext
149   if AC_TRY_EVAL(ac_compile); then
150     case "`/usr/bin/file conftest.o`" in
151     *32-bit*)
152       LD="${LD-ld} -32"
153       ;;
154     *N32*)
155       LD="${LD-ld} -n32"
156       ;;
157     *64-bit*)
158       LD="${LD-ld} -64"
159       ;;
160     esac
161   fi
162   rm -rf conftest*
163   ;;
164
165 *-*-sco3.2v5*)
166   # On SCO OpenServer 5, we need -belf to get full-featured binaries.
167   CFLAGS="$CFLAGS -belf"
168   ;;
169 esac
170
171 # Actually configure libtool.  ac_aux_dir is where install-sh is found.
172 CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
173 LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \
174 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig \
175 $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
176 || AC_MSG_ERROR([libtool configure failed])
177 ])
178
179 # AM_ENABLE_SHARED - implement the --enable-shared flag
180 # Usage: AM_ENABLE_SHARED[(DEFAULT)]
181 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
182 #   `yes'.
183 AC_DEFUN(AM_ENABLE_SHARED,
184 [define([AM_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
185 AC_ARG_ENABLE(shared,
186 changequote(<<, >>)dnl
187 <<  --enable-shared         build shared libraries [default=>>AM_ENABLE_SHARED_DEFAULT]
188 changequote([, ])dnl
189 [  --enable-shared=PKGS    only build shared libraries if the current package
190                           appears as an element in the PKGS list],
191 [p=${PACKAGE-default}
192 case "$enableval" in
193 yes) enable_shared=yes ;;
194 no) enable_shared=no ;;
195 *)
196   enable_shared=no
197   # Look at the argument we got.  We use all the common list separators.
198   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
199   for pkg in $enableval; do
200     if test "X$pkg" = "X$p"; then
201       enable_shared=yes
202     fi
203   done
204   IFS="$ac_save_ifs"
205   ;;
206 esac],
207 enable_shared=AM_ENABLE_SHARED_DEFAULT)dnl
208 ])
209
210 # AM_DISABLE_SHARED - set the default shared flag to --disable-shared
211 AC_DEFUN(AM_DISABLE_SHARED,
212 [AM_ENABLE_SHARED(no)])
213
214 # AM_DISABLE_STATIC - set the default static flag to --disable-static
215 AC_DEFUN(AM_DISABLE_STATIC,
216 [AM_ENABLE_STATIC(no)])
217
218 # AM_ENABLE_STATIC - implement the --enable-static flag
219 # Usage: AM_ENABLE_STATIC[(DEFAULT)]
220 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
221 #   `yes'.
222 AC_DEFUN(AM_ENABLE_STATIC,
223 [define([AM_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
224 AC_ARG_ENABLE(static,
225 changequote(<<, >>)dnl
226 <<  --enable-static         build static libraries [default=>>AM_ENABLE_STATIC_DEFAULT]
227 changequote([, ])dnl
228 [  --enable-static=PKGS    only build shared libraries if the current package
229                           appears as an element in the PKGS list],
230 [p=${PACKAGE-default}
231 case "$enableval" in
232 yes) enable_static=yes ;;
233 no) enable_static=no ;;
234 *)
235   enable_static=no
236   # Look at the argument we got.  We use all the common list separators.
237   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
238   for pkg in $enableval; do
239     if test "X$pkg" = "X$p"; then
240       enable_static=yes
241     fi
242   done
243   IFS="$ac_save_ifs"
244   ;;
245 esac],
246 enable_static=AM_ENABLE_STATIC_DEFAULT)dnl
247 ])
248
249
250 # AM_PROG_LD - find the path to the GNU or non-GNU linker
251 AC_DEFUN(AM_PROG_LD,
252 [AC_ARG_WITH(gnu-ld,
253 [  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
254 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
255 AC_REQUIRE([AC_PROG_CC])
256 ac_prog=ld
257 if test "$ac_cv_prog_gcc" = yes; then
258   # Check if gcc -print-prog-name=ld gives a path.
259   AC_MSG_CHECKING([for ld used by GCC])
260   ac_prog=`($CC -print-prog-name=ld) 2>&5`
261   case "$ac_prog" in
262   # Accept absolute paths.
263   /* | [A-Za-z]:\\*)
264     test -z "$LD" && LD="$ac_prog"
265     ;;
266   "")
267     # If it fails, then pretend we aren't using GCC.
268     ac_prog=ld
269     ;;
270   *)
271     # If it is relative, then search for the first ld in PATH.
272     with_gnu_ld=unknown
273     ;;
274   esac
275 elif test "$with_gnu_ld" = yes; then
276   AC_MSG_CHECKING([for GNU ld])
277 else
278   AC_MSG_CHECKING([for non-GNU ld])
279 fi
280 AC_CACHE_VAL(ac_cv_path_LD,
281 [if test -z "$LD"; then
282   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
283   for ac_dir in $PATH; do
284     test -z "$ac_dir" && ac_dir=.
285     if test -f "$ac_dir/$ac_prog"; then
286       ac_cv_path_LD="$ac_dir/$ac_prog"
287       # Check to see if the program is GNU ld.  I'd rather use --version,
288       # but apparently some GNU ld's only accept -v.
289       # Break only if it was the GNU/non-GNU ld that we prefer.
290       if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
291         test "$with_gnu_ld" != no && break
292       else
293         test "$with_gnu_ld" != yes && break
294       fi
295     fi
296   done
297   IFS="$ac_save_ifs"
298 else
299   ac_cv_path_LD="$LD" # Let the user override the test with a path.
300 fi])
301 LD="$ac_cv_path_LD"
302 if test -n "$LD"; then
303   AC_MSG_RESULT($LD)
304 else
305   AC_MSG_RESULT(no)
306 fi
307 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
308 AC_SUBST(LD)
309 AM_PROG_LD_GNU
310 ])
311
312 AC_DEFUN(AM_PROG_LD_GNU,
313 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
314 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
315 if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
316   ac_cv_prog_gnu_ld=yes
317 else
318   ac_cv_prog_gnu_ld=no
319 fi])
320 ])
321
322 # AM_PROG_NM - find the path to a BSD-compatible name lister
323 AC_DEFUN(AM_PROG_NM,
324 [AC_MSG_CHECKING([for BSD-compatible nm])
325 AC_CACHE_VAL(ac_cv_path_NM,
326 [case "$NM" in
327 /* | [A-Za-z]:\\*)
328   ac_cv_path_NM="$NM" # Let the user override the test with a path.
329   ;;
330 *)
331   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
332   for ac_dir in /usr/ucb /usr/ccs/bin $PATH /bin; do
333     test -z "$ac_dir" && ac_dir=.
334     if test -f $ac_dir/nm; then
335       # Check to see if the nm accepts a BSD-compat flag.
336       # Adding the `sed 1q' prevents false positives on HP-UX, which says:
337       #   nm: unknown option "B" ignored
338       if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
339         ac_cv_path_NM="$ac_dir/nm -B"
340       elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
341         ac_cv_path_NM="$ac_dir/nm -p"
342       else
343         ac_cv_path_NM="$ac_dir/nm"
344       fi
345       break
346     fi
347   done
348   IFS="$ac_save_ifs"
349   test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
350   ;;
351 esac])
352 NM="$ac_cv_path_NM"
353 AC_MSG_RESULT([$NM])
354 AC_SUBST(NM)
355 ])
356
357
358 # serial 1
359
360 # @defmac AC_PROG_CC_STDC
361 # @maindex PROG_CC_STDC
362 # @ovindex CC
363 # If the C compiler in not in ANSI C mode by default, try to add an option
364 # to output variable @code{CC} to make it so.  This macro tries various
365 # options that select ANSI C on some system or another.  It considers the
366 # compiler to be in ANSI C mode if it handles function prototypes correctly.
367 #
368 # If you use this macro, you should check after calling it whether the C
369 # compiler has been set to accept ANSI C; if not, the shell variable
370 # @code{am_cv_prog_cc_stdc} is set to @samp{no}.  If you wrote your source
371 # code in ANSI C, you can make an un-ANSIfied copy of it by using the
372 # program @code{ansi2knr}, which comes with Ghostscript.
373 # @end defmac
374
375 AC_DEFUN(AM_PROG_CC_STDC,
376 [AC_REQUIRE([AC_PROG_CC])
377 AC_BEFORE([$0], [AC_C_INLINE])
378 AC_BEFORE([$0], [AC_C_CONST])
379 dnl Force this before AC_PROG_CPP.  Some cpp's, eg on HPUX, require
380 dnl a magic option to avoid problems with ANSI preprocessor commands
381 dnl like #elif.
382 dnl FIXME: can't do this because then AC_AIX won't work due to a
383 dnl circular dependency.
384 dnl AC_BEFORE([$0], [AC_PROG_CPP])
385 AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
386 AC_CACHE_VAL(am_cv_prog_cc_stdc,
387 [am_cv_prog_cc_stdc=no
388 ac_save_CC="$CC"
389 # Don't try gcc -ansi; that turns off useful extensions and
390 # breaks some systems' header files.
391 # AIX                   -qlanglvl=ansi
392 # Ultrix and OSF/1      -std1
393 # HP-UX                 -Aa -D_HPUX_SOURCE
394 # SVR4                  -Xc -D__EXTENSIONS__
395 for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
396 do
397   CC="$ac_save_CC $ac_arg"
398   AC_TRY_COMPILE(
399 [#include <stdarg.h>
400 #include <stdio.h>
401 #include <sys/types.h>
402 #include <sys/stat.h>
403 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
404 struct buf { int x; };
405 FILE * (*rcsopen) (struct buf *, struct stat *, int);
406 static char *e (p, i)
407      char **p;
408      int i;
409 {
410   return p[i];
411 }
412 static char *f (char * (*g) (char **, int), char **p, ...)
413 {
414   char *s;
415   va_list v;
416   va_start (v,p);
417   s = g (p, va_arg (v,int));
418   va_end (v);
419   return s;
420 }
421 int test (int i, double x);
422 struct s1 {int (*f) (int a);};
423 struct s2 {int (*f) (double a);};
424 int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
425 int argc;
426 char **argv;
427 ], [
428 return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
429 ],
430 [am_cv_prog_cc_stdc="$ac_arg"; break])
431 done
432 CC="$ac_save_CC"
433 ])
434 if test -z "$am_cv_prog_cc_stdc"; then
435   AC_MSG_RESULT([none needed])
436 else
437   AC_MSG_RESULT($am_cv_prog_cc_stdc)
438 fi
439 case "x$am_cv_prog_cc_stdc" in
440   x|xno) ;;
441   *) CC="$CC $am_cv_prog_cc_stdc" ;;
442 esac
443 ])
444
445 dnl From Jim Meyering.
446
447 # serial 1
448
449 AC_DEFUN(AM_HEADER_TIOCGWINSZ_NEEDS_SYS_IOCTL,
450 [AC_REQUIRE([AM_SYS_POSIX_TERMIOS])
451  AC_CACHE_CHECK([whether use of TIOCGWINSZ requires sys/ioctl.h],
452                 am_cv_sys_tiocgwinsz_needs_sys_ioctl_h,
453   [am_cv_sys_tiocgwinsz_needs_sys_ioctl_h=no
454
455   gwinsz_in_termios_h=no
456   if test $am_cv_sys_posix_termios = yes; then
457     AC_EGREP_CPP([yes],
458     [#include <sys/types.h>
459 #     include <termios.h>
460 #     ifdef TIOCGWINSZ
461         yes
462 #     endif
463     ], gwinsz_in_termios_h=yes)
464   fi
465
466   if test $gwinsz_in_termios_h = no; then
467     AC_EGREP_CPP([yes],
468     [#include <sys/types.h>
469 #     include <sys/ioctl.h>
470 #     ifdef TIOCGWINSZ
471         yes
472 #     endif
473     ], am_cv_sys_tiocgwinsz_needs_sys_ioctl_h=yes)
474   fi
475   ])
476   if test $am_cv_sys_tiocgwinsz_needs_sys_ioctl_h = yes; then
477     AC_DEFINE(GWINSZ_IN_SYS_IOCTL)
478   fi
479 ])
480
481 dnl From Jim Meyering.
482
483 # serial 1
484
485 AC_DEFUN(AM_SYS_POSIX_TERMIOS,
486 [AC_CACHE_CHECK([POSIX termios], am_cv_sys_posix_termios,
487   [AC_TRY_LINK([#include <sys/types.h>
488 #include <unistd.h>
489 #include <termios.h>],
490   [/* SunOS 4.0.3 has termios.h but not the library calls.  */
491    tcgetattr(0, 0);],
492   am_cv_sys_posix_termios=yes,
493   am_cv_sys_posix_termios=no)])
494 ])
495
496 # From Ulrich Drepper.
497
498 # serial 1
499
500 AC_DEFUN(AM_TYPE_PTRDIFF_T,
501   [AC_CACHE_CHECK([for ptrdiff_t], am_cv_type_ptrdiff_t,
502      [AC_TRY_COMPILE([#include <stddef.h>], [ptrdiff_t p],
503                      am_cv_type_ptrdiff_t=yes, am_cv_type_ptrdiff_t=no)])
504    if test $am_cv_type_ptrdiff_t = yes; then
505      AC_DEFINE(HAVE_PTRDIFF_T)
506    fi
507 ])
508
509 #serial 4
510
511 dnl From Jim Meyering.
512 dnl FIXME: this should migrate into libit.
513
514 AC_DEFUN(AM_FUNC_MKTIME,
515 [AC_REQUIRE([AC_HEADER_TIME])dnl
516  AC_CHECK_HEADERS(sys/time.h unistd.h)
517  AC_CHECK_FUNCS(alarm)
518  AC_CACHE_CHECK([for working mktime], am_cv_func_working_mktime,
519   [AC_TRY_RUN(
520 changequote(<<, >>)dnl
521 <</* Test program from Paul Eggert (eggert@twinsun.com)
522    and Tony Leneis (tony@plaza.ds.adp.com).  */
523 #if TIME_WITH_SYS_TIME
524 # include <sys/time.h>
525 # include <time.h>
526 #else
527 # if HAVE_SYS_TIME_H
528 #  include <sys/time.h>
529 # else
530 #  include <time.h>
531 # endif
532 #endif
533
534 #if HAVE_UNISTD_H
535 # include <unistd.h>
536 #endif
537
538 #if !HAVE_ALARM
539 # define alarm(X) /* empty */
540 #endif
541
542 /* Work around redefinition to rpl_putenv by other config tests.  */
543 #undef putenv
544
545 static time_t time_t_max;
546
547 /* Values we'll use to set the TZ environment variable.  */
548 static const char *const tz_strings[] = {
549   (const char *) 0, "GMT0", "JST-9",
550   "EST+3EDT+2,M10.1.0/00:00:00,M2.3.0/00:00:00"
551 };
552 #define N_STRINGS (sizeof (tz_strings) / sizeof (tz_strings[0]))
553
554 static void
555 mktime_test (now)
556      time_t now;
557 {
558   struct tm *lt;
559   if ((lt = localtime (&now)) && mktime (lt) != now)
560     exit (1);
561   now = time_t_max - now;
562   if ((lt = localtime (&now)) && mktime (lt) != now)
563     exit (1);
564 }
565
566 static void
567 irix_6_4_bug ()
568 {
569   /* Based on code from Ariel Faigon.  */
570   struct tm tm;
571   tm.tm_year = 96;
572   tm.tm_mon = 3;
573   tm.tm_mday = 0;
574   tm.tm_hour = 0;
575   tm.tm_min = 0;
576   tm.tm_sec = 0;
577   tm.tm_isdst = -1;
578   mktime (&tm);
579   if (tm.tm_mon != 2 || tm.tm_mday != 31)
580     exit (1);
581 }
582
583 static void
584 bigtime_test (j)
585      int j;
586 {
587   struct tm tm;
588   time_t now;
589   tm.tm_year = tm.tm_mon = tm.tm_mday = tm.tm_hour = tm.tm_min = tm.tm_sec = j;
590   /* This test makes some buggy mktime implementations loop.
591      Give up after 10 seconds.  */
592   alarm (10);
593   now = mktime (&tm);
594   alarm (0);
595   if (now != (time_t) -1)
596     {
597       struct tm *lt = localtime (&now);
598       if (! (lt
599              && lt->tm_year == tm.tm_year
600              && lt->tm_mon == tm.tm_mon
601              && lt->tm_mday == tm.tm_mday
602              && lt->tm_hour == tm.tm_hour
603              && lt->tm_min == tm.tm_min
604              && lt->tm_sec == tm.tm_sec
605              && lt->tm_yday == tm.tm_yday
606              && lt->tm_wday == tm.tm_wday
607              && ((lt->tm_isdst < 0 ? -1 : 0 < lt->tm_isdst)
608                   == (tm.tm_isdst < 0 ? -1 : 0 < tm.tm_isdst))))
609         exit (1);
610     }
611 }
612
613 int
614 main ()
615 {
616   time_t t, delta;
617   int i, j;
618
619   for (time_t_max = 1; 0 < time_t_max; time_t_max *= 2)
620     continue;
621   time_t_max--;
622   delta = time_t_max / 997; /* a suitable prime number */
623   for (i = 0; i < N_STRINGS; i++)
624     {
625       if (tz_strings[i])
626         putenv (tz_strings[i]);
627
628       for (t = 0; t <= time_t_max - delta; t += delta)
629         mktime_test (t);
630       mktime_test ((time_t) 60 * 60);
631       mktime_test ((time_t) 60 * 60 * 24);
632
633       for (j = 1; 0 < j; j *= 2)
634         bigtime_test (j);
635       bigtime_test (j - 1);
636     }
637   irix_6_4_bug ();
638   exit (0);
639 }
640               >>,
641 changequote([, ])dnl
642              am_cv_func_working_mktime=yes, am_cv_func_working_mktime=no,
643              dnl When crosscompiling, assume mktime is missing or broken.
644              am_cv_func_working_mktime=no)
645   ])
646   if test $am_cv_func_working_mktime = no; then
647     LIBOBJS="$LIBOBJS mktime.o"
648   fi
649 ])
650
651
652
653
654
655
656
657
658 AC_DEFUN(AM_FUNC_STRTOD,
659 [AC_CACHE_CHECK(for working strtod, am_cv_func_strtod,
660 [AC_TRY_RUN([
661 double strtod ();
662 int
663 main()
664 {
665   {
666     /* Some versions of Linux strtod mis-parse strings with leading '+'.  */
667     char *string = " +69";
668     char *term;
669     double value;
670     value = strtod (string, &term);
671     if (value != 69 || term != (string + 4))
672       exit (1);
673   }
674
675   {
676     /* Under Solaris 2.4, strtod returns the wrong value for the
677        terminating character under some conditions.  */
678     char *string = "NaN";
679     char *term;
680     strtod (string, &term);
681     if (term != string && *(term - 1) == 0)
682       exit (1);
683   }
684   exit (0);
685 }
686 ], am_cv_func_strtod=yes, am_cv_func_strtod=no, am_cv_func_strtod=no)])
687 test $am_cv_func_strtod = no && LIBOBJS="$LIBOBJS strtod.o"
688 AC_SUBST(LIBOBJS)dnl
689 am_cv_func_strtod_needs_libm=no
690 if test $am_cv_func_strtod = no; then
691   AC_CHECK_FUNCS(pow)
692   if test $ac_cv_func_pow = no; then
693     AC_CHECK_LIB(m, pow, [am_cv_func_strtod_needs_libm=yes],
694                  [AC_MSG_WARN(can't find library containing definition of pow)])
695   fi
696 fi
697 ])
698