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 # Like AC_CONFIG_HEADER, but automatically create stamp file.
15 AC_DEFUN(AM_CONFIG_HEADER,
17 AC_CONFIG_HEADER([$1])
18 dnl When config.status generates a header, we must update the stamp-h file.
19 dnl This file resides in the same directory as the config header
20 dnl that is generated. We must strip everything past the first ":",
21 dnl and everything past the last "/".
22 AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
23 ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
24 <<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
26 for am_file in <<$1>>; do
27 case " <<$>>CONFIG_HEADERS " in
28 *" <<$>>am_file "*<<)>>
29 echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
32 am_indx=`expr "<<$>>am_indx" + 1`
36 # Do all the work for Automake. This macro actually does too much --
37 # some checks are only needed if your package does certain things.
38 # But this isn't really a big deal.
43 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
45 AC_DEFUN(AM_INIT_AUTOMAKE,
46 [AC_REQUIRE([AC_PROG_INSTALL])
51 dnl test to see if srcdir already configured
52 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
53 AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
56 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
57 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
58 AC_REQUIRE([AM_SANITY_CHECK])
59 AC_REQUIRE([AC_ARG_PROGRAM])
60 dnl FIXME This is truly gross.
61 missing_dir=`cd $ac_aux_dir && pwd`
62 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
63 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
64 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
65 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
66 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
67 AC_REQUIRE([AC_PROG_MAKE_SET])])
70 # Check to make sure that the build environment is sane.
73 AC_DEFUN(AM_SANITY_CHECK,
74 [AC_MSG_CHECKING([whether build environment is sane])
77 echo timestamp > conftestfile
78 # Do `set' in a subshell so we don't clobber the current shell's
79 # arguments. Must try -L first in case configure is actually a
80 # symlink; some systems play weird games with the mod time of symlinks
81 # (eg FreeBSD returns the mod time of the symlink's containing
84 set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
85 if test "[$]*" = "X"; then
87 set X `ls -t $srcdir/configure conftestfile`
89 if test "[$]*" != "X $srcdir/configure conftestfile" \
90 && test "[$]*" != "X conftestfile $srcdir/configure"; then
92 # If neither matched, then we have a broken ls. This can happen
93 # if, for instance, CONFIG_SHELL is bash and it inherits a
94 # broken ls alias from the environment. This has actually
95 # happened. Such a system could not be considered "sane".
96 AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
97 alias in your environment])
100 test "[$]2" = conftestfile
106 AC_MSG_ERROR([newly created file is older than distributed files!
107 Check your system clock])
112 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
113 dnl The program must properly implement --version.
114 AC_DEFUN(AM_MISSING_PROG,
115 [AC_MSG_CHECKING(for working $2)
116 # Run test in a subshell; some versions of sh will print an error if
117 # an executable is not found, even if stderr is redirected.
118 # Redirect stdin to placate older versions of autoconf. Sigh.
119 if ($2 --version) < /dev/null > /dev/null 2>&1; then
124 AC_MSG_RESULT(missing)
129 dnl This test replaces the one in autoconf.
130 dnl Currently this macro should have the same name as the autoconf macro
131 dnl because gettext's gettext.m4 (distributed in the automake package)
132 dnl still uses it. Otherwise, the use in gettext.m4 makes autoheader
133 dnl give these diagnostics:
134 dnl configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
135 dnl configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
137 undefine([AC_ISC_POSIX])
138 AC_DEFUN(AC_ISC_POSIX,
140 dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
141 AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
148 AC_DEFUN(AM_C_PROTOTYPES,
149 [AC_REQUIRE([AM_PROG_CC_STDC])
150 AC_REQUIRE([AC_PROG_CPP])
151 AC_MSG_CHECKING([for function prototypes])
152 if test "$am_cv_prog_cc_stdc" != no; then
154 AC_DEFINE(PROTOTYPES,1,[Define if compiler has function prototypes])
158 U=_ ANSI2KNR=./ansi2knr
159 # Ensure some checks needed by ansi2knr itself.
161 AC_CHECK_HEADERS(string.h)
164 AC_SUBST(ANSI2KNR)dnl
170 # @defmac AC_PROG_CC_STDC
171 # @maindex PROG_CC_STDC
173 # If the C compiler in not in ANSI C mode by default, try to add an option
174 # to output variable @code{CC} to make it so. This macro tries various
175 # options that select ANSI C on some system or another. It considers the
176 # compiler to be in ANSI C mode if it handles function prototypes correctly.
178 # If you use this macro, you should check after calling it whether the C
179 # compiler has been set to accept ANSI C; if not, the shell variable
180 # @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source
181 # code in ANSI C, you can make an un-ANSIfied copy of it by using the
182 # program @code{ansi2knr}, which comes with Ghostscript.
185 AC_DEFUN(AM_PROG_CC_STDC,
186 [AC_REQUIRE([AC_PROG_CC])
187 AC_BEFORE([$0], [AC_C_INLINE])
188 AC_BEFORE([$0], [AC_C_CONST])
189 dnl Force this before AC_PROG_CPP. Some cpp's, eg on HPUX, require
190 dnl a magic option to avoid problems with ANSI preprocessor commands
192 dnl FIXME: can't do this because then AC_AIX won't work due to a
193 dnl circular dependency.
194 dnl AC_BEFORE([$0], [AC_PROG_CPP])
195 AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
196 AC_CACHE_VAL(am_cv_prog_cc_stdc,
197 [am_cv_prog_cc_stdc=no
199 # Don't try gcc -ansi; that turns off useful extensions and
200 # breaks some systems' header files.
202 # Ultrix and OSF/1 -std1
203 # HP-UX -Aa -D_HPUX_SOURCE
204 # SVR4 -Xc -D__EXTENSIONS__
205 for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
207 CC="$ac_save_CC $ac_arg"
211 #include <sys/types.h>
212 #include <sys/stat.h>
213 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
214 struct buf { int x; };
215 FILE * (*rcsopen) (struct buf *, struct stat *, int);
216 static char *e (p, i)
222 static char *f (char * (*g) (char **, int), char **p, ...)
227 s = g (p, va_arg (v,int));
231 int test (int i, double x);
232 struct s1 {int (*f) (int a);};
233 struct s2 {int (*f) (double a);};
234 int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
238 return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
240 [am_cv_prog_cc_stdc="$ac_arg"; break])
244 if test -z "$am_cv_prog_cc_stdc"; then
245 AC_MSG_RESULT([none needed])
247 AC_MSG_RESULT($am_cv_prog_cc_stdc)
249 case "x$am_cv_prog_cc_stdc" in
251 *) CC="$CC $am_cv_prog_cc_stdc" ;;
257 dnl Just like AC_C_CONST from autoconf-2.12, but with an initializer
258 dnl for `charset x' and with
259 dnl AC_DEFINE(const, )
261 dnl AC_DEFINE_UNQUOTED(const, [/* empty */])
262 dnl to avoid this warning:
263 dnl [...]/m4: Warning: Excess arguments to built-in `define' ignored
265 undefine([AC_C_CONST])
267 [dnl This message is consistent in form with the other checking messages,
268 dnl and with the result message.
269 AC_CACHE_CHECK([for working const], ac_cv_c_const,
271 changequote(<<, >>)dnl
273 /* Ultrix mips cc rejects this. */
274 typedef int charset[2]; const charset x = {0, 0};
275 /* SunOS 4.1.1 cc rejects this. */
276 char const *const *ccp;
278 /* NEC SVR4.0.2 mips cc rejects this. */
279 struct point {int x, y;};
280 static struct point const zero = {0,0};
281 /* AIX XL C 1.02.0.0 rejects this.
282 It does not let you subtract one const X* pointer from another in an arm
283 of an if-expression whose if-part is not a constant expression */
284 const char *g = "string";
285 ccp = &g + (g ? g-g : 0);
286 /* HPUX 7.0 cc rejects these. */
289 ccp = (char const *const *) p;
290 { /* SCO 3.2v4 cc rejects this. */
292 char const *s = 0 ? (char *) 0 : (char const *) 0;
296 { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
298 const int *foo = &x[0];
301 { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
302 typedef const int *iptr;
306 { /* AIX XL C 1.02.0.0 rejects this saying
307 "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
308 struct s { int j; const int *ap[3]; };
309 struct s *b; b->j = 5;
311 { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
316 ac_cv_c_const=yes, ac_cv_c_const=no)])
317 if test $ac_cv_c_const = no; then
318 AC_DEFINE_UNQUOTED(const, [/* empty */])
324 dnl Just like AC_CHECK_TYPE from autoconf-2.12, but also checks in unistd.h
325 dnl on systems that have it. Fujitsu UXP/V needs this for ssize_t.
327 undefine([AC_CHECK_TYPE])
328 dnl AC_CHECK_TYPE(TYPE, DEFAULT)
329 AC_DEFUN(AC_CHECK_TYPE,
330 [AC_REQUIRE([AC_HEADER_STDC])dnl
331 AC_CHECK_HEADERS(unistd.h)
332 AC_MSG_CHECKING(for $1)
333 AC_CACHE_VAL(ac_cv_type_$1,
335 changequote(<<,>>)dnl
336 <<$1[^a-zA-Z_0-9]>>dnl
337 changequote([,]), [#include <sys/types.h>
344 #endif], ac_cv_type_$1=yes, ac_cv_type_$1=no)])dnl
345 AC_MSG_RESULT($ac_cv_type_$1)
346 if test $ac_cv_type_$1 = no; then
353 dnl Misc type-related macros for fileutils, sh-utils, textutils.
357 dnl This macro actually runs replacement code. See isc-posix.m4.
358 AC_REQUIRE([AC_ISC_POSIX])dnl
360 AC_REQUIRE([jm_WITH_REGEX])
361 AC_REQUIRE([jm_ASSERT])
362 AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
363 AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
364 AC_CHECK_TYPE(ssize_t, int)
365 AC_REQUIRE([jm_STRUCT_UTIMBUF])
366 AC_REQUIRE([jm_CHECK_DECLS])
368 AC_REQUIRE([jm_PREREQ])
370 AC_REQUIRE([jm_FUNC_MKTIME])
371 AC_REQUIRE([jm_FUNC_LSTAT])
372 AC_REQUIRE([jm_FUNC_STAT])
373 AC_REQUIRE([jm_FUNC_REALLOC])
374 AC_REQUIRE([jm_FUNC_MALLOC])
375 AC_REQUIRE([jm_FUNC_READDIR])
376 AC_REQUIRE([jm_FUNC_MEMCMP])
377 AC_REQUIRE([jm_FUNC_GLIBC_UNLOCKED_IO])
378 AC_REQUIRE([jm_FUNC_FNMATCH])
383 dnl Derived from code in GNU grep.
385 AC_DEFUN(jm_WITH_REGEX,
387 dnl Even packages that don't use regex.c can use this macro.
388 dnl Of course, for them it doesn't do anything.
390 syscmd([test -f lib/regex.c])
393 AC_ARG_WITH(included-regex,
394 [ --without-included-regex don't compile regex (use with caution)],
395 jm_with_regex=$withval,
397 if test "$jm_with_regex" = yes; then
398 LIBOBJS="$LIBOBJS regex.o"
406 dnl based on code from Eleftherios Gkioulekas
410 AC_MSG_CHECKING(whether to enable assertions)
411 AC_ARG_ENABLE(assert,
412 [ --disable-assert turn off assertions],
415 [ AC_MSG_RESULT(yes) ]
421 dnl From Paul Eggert.
423 # Define HAVE_INTTYPES_H if <inttypes.h> exists,
424 # doesn't clash with <sys/types.h>, and declares uintmax_t.
426 AC_DEFUN(jm_AC_HEADER_INTTYPES_H,
429 dnl This code is deliberately never run via ./configure.
430 dnl FIXME: this is a gross hack to make autoheader put an entry
431 dnl for `HAVE_INTTYPES_H' in config.h.in.
432 AC_CHECK_FUNCS(INTTYPES_H)
434 AC_CACHE_CHECK([for inttypes.h], jm_ac_cv_header_inttypes_h,
436 [#include <sys/types.h>
437 #include <inttypes.h>],
438 [uintmax_t i = (uintmax_t) -1;],
439 jm_ac_cv_header_inttypes_h=yes,
440 jm_ac_cv_header_inttypes_h=no)])
441 if test $jm_ac_cv_header_inttypes_h = yes; then
442 ac_kludge=HAVE_INTTYPES_H
443 AC_DEFINE_UNQUOTED($ac_kludge)
449 dnl From Paul Eggert.
451 # Define uintmax_t to `unsigned long' or `unsigned long long'
452 # if <inttypes.h> does not exist.
454 AC_DEFUN(jm_AC_TYPE_UINTMAX_T,
456 AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
457 if test $jm_ac_cv_header_inttypes_h = no; then
458 AC_CACHE_CHECK([for unsigned long long], ac_cv_type_unsigned_long_long,
460 [unsigned long long i = (unsigned long long) -1;],
461 ac_cv_type_unsigned_long_long=yes,
462 ac_cv_type_unsigned_long_long=no)])
463 if test $ac_cv_type_unsigned_long_long = yes; then
464 AC_DEFINE(uintmax_t, unsigned long long)
466 AC_DEFINE(uintmax_t, unsigned long)
473 dnl From Jim Meyering
475 dnl Define HAVE_STRUCT_UTIMBUF if `struct utimbuf' is declared --
476 dnl usually in <utime.h>.
477 dnl Some systems have utime.h but don't declare the struct anywhere.
479 AC_DEFUN(jm_STRUCT_UTIMBUF,
481 AC_CHECK_HEADERS(utime.h)
482 AC_REQUIRE([AC_HEADER_TIME])
483 AC_CACHE_CHECK([for struct utimbuf], fu_cv_sys_struct_utimbuf,
486 #ifdef TIME_WITH_SYS_TIME
487 # include <sys/time.h>
490 # ifdef HAVE_SYS_TIME_H
491 # include <sys/time.h>
500 [static struct utimbuf x; x.actime = x.modtime;],
501 fu_cv_sys_struct_utimbuf=yes,
502 fu_cv_sys_struct_utimbuf=no)
505 if test $fu_cv_sys_struct_utimbuf = yes; then
507 # This code is deliberately never run via ./configure.
508 # FIXME: this is a hack to make autoheader put the corresponding
509 # HAVE_* undef for this symbol in config.h.in. This saves me the
510 # trouble of having to maintain the #undef in acconfig.h manually.
511 AC_CHECK_FUNCS(STRUCT_UTIMBUF)
513 # Defining it this way (rather than via AC_DEFINE) short-circuits the
514 # autoheader check -- autoheader doesn't know it's already been taken
515 # care of by the hack above.
516 ac_kludge=HAVE_STRUCT_UTIMBUF
517 AC_DEFINE_UNQUOTED($ac_kludge)
523 dnl This is just a wrapper function to encapsulate this kludge.
524 dnl Putting it in a separate file like this helps share it between
525 dnl different packages.
526 AC_DEFUN(jm_CHECK_DECLS,
531 # if !STDC_HEADERS && HAVE_MEMORY_H
536 # ifdef HAVE_STRINGS_H
537 # include <strings.h>
548 dnl This code is deliberately never run via ./configure.
549 dnl FIXME: this is a gross hack to make autoheader put entries
550 dnl for each of these symbols in the config.h.in.
551 dnl Otherwise, I'd have to update acconfig.h every time I change
552 dnl this list of functions.
553 AC_CHECK_FUNCS(DECL_FREE DECL_LSEEK DECL_MALLOC DECL_MEMCHR DECL_REALLOC \
554 DECL_STPCPY DECL_STRSTR)
556 jm_CHECK_DECLARATIONS($headers, free lseek malloc \
557 memchr realloc stpcpy strstr)
562 AC_DEFUN(jm_CHECK_DECLARATION,
564 AC_REQUIRE([AC_HEADER_STDC])dnl
565 test -z "$ac_cv_header_memory_h" && AC_CHECK_HEADERS(memory.h)
566 test -z "$ac_cv_header_string_h" && AC_CHECK_HEADERS(string.h)
567 test -z "$ac_cv_header_strings_h" && AC_CHECK_HEADERS(strings.h)
568 test -z "$ac_cv_header_stdlib_h" && AC_CHECK_HEADERS(stdlib.h)
569 test -z "$ac_cv_header_unistd_h" && AC_CHECK_HEADERS(unistd.h)
570 AC_MSG_CHECKING([whether $1 is declared])
571 AC_CACHE_VAL(jm_cv_func_decl_$1,
575 char *(*pfn) = (char *(*)) $1
578 eval "jm_cv_func_decl_$1=yes",
579 eval "jm_cv_func_decl_$1=no")])
581 if eval "test \"`echo '$jm_cv_func_decl_'$1`\" = yes"; then
583 ifelse([$3], , :, [$3])
591 dnl jm_CHECK_DECLARATIONS(INCLUDES, FUNCTION... [, ACTION-IF-DECLARED
592 dnl [, ACTION-IF-NOT-DECLARED]])
593 AC_DEFUN(jm_CHECK_DECLARATIONS,
597 jm_CHECK_DECLARATION($jm_func, $1,
599 jm_tr_func=HAVE_DECL_`echo $jm_func | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`
600 AC_DEFINE_UNQUOTED($jm_tr_func) $3], $4)dnl
606 dnl These are the prerequisite macros for files in the lib/
607 dnl directories of the fileutils, sh-utils, and textutils packages.
615 dnl FIXME: maybe put this in a separate file
616 AC_DEFUN(jm_PREREQ_REGEX,
618 dnl FIXME: Maybe provide a btowc replacement someday: solaris-2.5.1 lacks it.
619 dnl FIXME: Check for wctype and iswctype, and and add -lw if necessary
621 AC_CHECK_FUNCS(bzero bcopy isascii btowc)
622 AC_CHECK_HEADERS(alloca.h libintl.h wctype.h wchar.h)
629 dnl FIXME: put these prerequisite-only *.m4 files in a separate
630 dnl directory -- otherwise, they'll conflict with existing files.
632 dnl These are the prerequisite macros for GNU's error.c file.
633 AC_DEFUN(jm_PREREQ_ERROR,
635 AC_CHECK_FUNCS(strerror strerror_r vprintf doprnt)
641 dnl From Jim Meyering.
642 dnl If you use this macro in a package, you should
643 dnl add the following two lines to acconfig.h:
644 dnl /* Define to rpl_mktime if the replacement function should be used. */
647 AC_DEFUN(jm_FUNC_MKTIME,
648 [AC_REQUIRE([jm_AM_FUNC_MKTIME])dnl
650 dnl mktime.c uses localtime_r if it exists. Check for it.
651 AC_CHECK_FUNCS(localtime_r)
653 if test $jm_am_cv_func_working_mktime = no; then
654 AC_DEFINE_UNQUOTED(mktime, rpl_mktime)
660 dnl Just like mktime.m4 from automake-1.3b, but with an additional test.
661 dnl Renamed to have jm_ prefix and to use jm_ prefix on cache variable names.
663 AC_DEFUN(jm_AM_FUNC_MKTIME,
664 [AC_REQUIRE([AC_HEADER_TIME])dnl
665 AC_CHECK_HEADERS(sys/time.h unistd.h)
666 AC_CHECK_FUNCS(alarm)
667 AC_CACHE_CHECK([for working mktime], jm_am_cv_func_working_mktime,
669 changequote(<<, >>)dnl
670 <</* Test program from Paul Eggert (eggert@twinsun.com)
671 and Tony Leneis (tony@plaza.ds.adp.com). */
672 #if TIME_WITH_SYS_TIME
673 # include <sys/time.h>
677 # include <sys/time.h>
688 # define alarm(X) /* empty */
691 /* Work around redefinition to rpl_putenv by other config tests. */
694 static time_t time_t_max;
696 /* Values we'll use to set the TZ environment variable. */
697 static const char *const tz_strings[] = {
698 (const char *) 0, "TZ=GMT0", "TZ=JST-9",
699 "TZ=EST+3EDT+2,M10.1.0/00:00:00,M2.3.0/00:00:00"
701 #define N_STRINGS (sizeof (tz_strings) / sizeof (tz_strings[0]))
703 /* Fail if mktime fails to convert a date in the spring-forward gap.
704 Based on a problem report from Andreas Jaeger. */
706 spring_forward_gap ()
708 /* glibc (up to about 1998-10-07) failed this test) */
711 /* Use the portable POSIX.1 specification "TZ=PST8PDT,M4.1.0,M10.5.0"
712 instead of "TZ=America/Vancouver" in order to detect the bug even
713 on systems that don't support the Olson extension, or don't have the
714 full zoneinfo tables installed. */
715 putenv ("TZ=PST8PDT,M4.1.0,M10.5.0");
723 if (mktime (&tm) == (time_t)-1)
732 if ((lt = localtime (&now)) && mktime (lt) != now)
734 now = time_t_max - now;
735 if ((lt = localtime (&now)) && mktime (lt) != now)
742 /* Based on code from Ariel Faigon. */
752 if (tm.tm_mon != 2 || tm.tm_mday != 31)
762 tm.tm_year = tm.tm_mon = tm.tm_mday = tm.tm_hour = tm.tm_min = tm.tm_sec = j;
763 /* This test makes some buggy mktime implementations loop.
764 Give up after 10 seconds. */
768 if (now != (time_t) -1)
770 struct tm *lt = localtime (&now);
772 && lt->tm_year == tm.tm_year
773 && lt->tm_mon == tm.tm_mon
774 && lt->tm_mday == tm.tm_mday
775 && lt->tm_hour == tm.tm_hour
776 && lt->tm_min == tm.tm_min
777 && lt->tm_sec == tm.tm_sec
778 && lt->tm_yday == tm.tm_yday
779 && lt->tm_wday == tm.tm_wday
780 && ((lt->tm_isdst < 0 ? -1 : 0 < lt->tm_isdst)
781 == (tm.tm_isdst < 0 ? -1 : 0 < tm.tm_isdst))))
792 spring_forward_gap ();
793 for (time_t_max = 1; 0 < time_t_max; time_t_max *= 2)
796 delta = time_t_max / 997; /* a suitable prime number */
797 for (i = 0; i < N_STRINGS; i++)
800 putenv (tz_strings[i]);
802 for (t = 0; t <= time_t_max - delta; t += delta)
804 mktime_test ((time_t) 60 * 60);
805 mktime_test ((time_t) 60 * 60 * 24);
807 for (j = 1; 0 < j; j *= 2)
809 bigtime_test (j - 1);
816 jm_am_cv_func_working_mktime=yes, jm_am_cv_func_working_mktime=no,
817 dnl When crosscompiling, assume mktime is missing or broken.
818 jm_am_cv_func_working_mktime=no)
820 if test $jm_am_cv_func_working_mktime = no; then
821 LIBOBJS="$LIBOBJS mktime.o"
827 dnl From Jim Meyering.
828 dnl Determine whether lstat has the bug that it succeeds when given the
829 dnl zero-length file name argument. The lstat from SunOS4.1.4 and the Hurd
830 dnl (as of 1998-11-01) do this.
832 dnl If it does, then define HAVE_LSTAT_EMPTY_STRING_BUG and arrange to
833 dnl compile the wrapper function.
836 AC_DEFUN(jm_FUNC_LSTAT,
838 AC_CACHE_CHECK([whether lstat accepts an empty string],
839 jm_cv_func_lstat_empty_string_bug,
841 # include <sys/types.h>
842 # include <sys/stat.h>
848 exit (lstat ("", &sbuf) ? 1 : 0);
851 jm_cv_func_lstat_empty_string_bug=yes,
852 jm_cv_func_lstat_empty_string_bug=no,
853 dnl When crosscompiling, assume lstat is broken.
854 jm_cv_func_lstat_empty_string_bug=yes)
856 if test $jm_cv_func_lstat_empty_string_bug = yes; then
858 LIBOBJS="$LIBOBJS lstat.o"
860 if test $jm_cv_func_lstat_empty_string_bug = yes; then
862 # This code is deliberately never run via ./configure.
863 # FIXME: this is a hack to make autoheader put the corresponding
864 # HAVE_* undef for this symbol in config.h.in. This saves me the
865 # trouble of having to maintain the #undef in acconfig.h manually.
866 AC_CHECK_FUNCS(LSTAT_EMPTY_STRING_BUG)
868 # Defining it this way (rather than via AC_DEFINE) short-circuits the
869 # autoheader check -- autoheader doesn't know it's already been taken
870 # care of by the hack above.
871 ac_kludge=HAVE_LSTAT_EMPTY_STRING_BUG
872 AC_DEFINE_UNQUOTED($ac_kludge)
879 dnl From Jim Meyering.
880 dnl Determine whether stat has the bug that it succeeds when given the
881 dnl zero-length file name argument. The stat from SunOS4.1.4 and the Hurd
882 dnl (as of 1998-11-01) do this.
884 dnl If it does, then define HAVE_STAT_EMPTY_STRING_BUG and arrange to
885 dnl compile the wrapper function.
888 AC_DEFUN(jm_FUNC_STAT,
890 AC_CACHE_CHECK([whether stat accepts an empty string],
891 jm_cv_func_stat_empty_string_bug,
893 # include <sys/types.h>
894 # include <sys/stat.h>
900 exit (stat ("", &sbuf) ? 1 : 0);
903 jm_cv_func_stat_empty_string_bug=yes,
904 jm_cv_func_stat_empty_string_bug=no,
905 dnl When crosscompiling, assume stat is broken.
906 jm_cv_func_stat_empty_string_bug=yes)
908 if test $jm_cv_func_stat_empty_string_bug = yes; then
910 LIBOBJS="$LIBOBJS stat.o"
912 if test $jm_cv_func_stat_empty_string_bug = yes; then
914 # This code is deliberately never run via ./configure.
915 # FIXME: this is a hack to make autoheader put the corresponding
916 # HAVE_* undef for this symbol in config.h.in. This saves me the
917 # trouble of having to maintain the #undef in acconfig.h manually.
918 AC_CHECK_FUNCS(STAT_EMPTY_STRING_BUG)
920 # Defining it this way (rather than via AC_DEFINE) short-circuits the
921 # autoheader check -- autoheader doesn't know it's already been taken
922 # care of by the hack above.
923 ac_kludge=HAVE_STAT_EMPTY_STRING_BUG
924 AC_DEFINE_UNQUOTED($ac_kludge)
931 dnl From Jim Meyering.
932 dnl Determine whether realloc works when both arguments are 0.
933 dnl If it doesn't, arrange to use the replacement function.
935 dnl If you use this macro in a package, you should
936 dnl add the following two lines to acconfig.h:
937 dnl /* Define to rpl_realloc if the replacement function should be used. */
941 AC_DEFUN(jm_FUNC_REALLOC,
944 dnl This code is deliberately never run via ./configure.
945 dnl FIXME: this is a gross hack to make autoheader put an entry
946 dnl for this symbol in config.h.in.
947 AC_CHECK_FUNCS(DONE_WORKING_REALLOC_CHECK)
949 dnl xmalloc.c requires that this symbol be defined so it doesn't
950 dnl mistakenly use a broken realloc -- as it might if this test were omitted.
951 ac_kludge=HAVE_DONE_WORKING_REALLOC_CHECK
952 AC_DEFINE_UNQUOTED($ac_kludge)
954 AC_CACHE_CHECK([for working realloc], jm_cv_func_working_realloc,
960 exit (realloc (0, 0) ? 0 : 1);
963 jm_cv_func_working_realloc=yes,
964 jm_cv_func_working_realloc=no,
965 dnl When crosscompiling, assume realloc is broken.
966 jm_cv_func_working_realloc=no)
968 if test $jm_cv_func_working_realloc = no; then
969 LIBOBJS="$LIBOBJS realloc.o"
970 AC_DEFINE_UNQUOTED(realloc, rpl_realloc)
976 dnl From Jim Meyering.
977 dnl Determine whether malloc accepts 0 as its argument.
978 dnl If it doesn't, arrange to use the replacement function.
980 dnl If you use this macro in a package, you should
981 dnl add the following two lines to acconfig.h:
982 dnl /* Define to rpl_malloc if the replacement function should be used. */
986 AC_DEFUN(jm_FUNC_MALLOC,
989 dnl This code is deliberately never run via ./configure.
990 dnl FIXME: this is a gross hack to make autoheader put an entry
991 dnl for this symbol in config.h.in.
992 AC_CHECK_FUNCS(DONE_WORKING_MALLOC_CHECK)
994 dnl xmalloc.c requires that this symbol be defined so it doesn't
995 dnl mistakenly use a broken malloc -- as it might if this test were omitted.
996 ac_kludge=HAVE_DONE_WORKING_MALLOC_CHECK
997 AC_DEFINE_UNQUOTED($ac_kludge)
999 AC_CACHE_CHECK([for working malloc], jm_cv_func_working_malloc,
1005 exit (malloc (0) ? 0 : 1);
1008 jm_cv_func_working_malloc=yes,
1009 jm_cv_func_working_malloc=no,
1010 dnl When crosscompiling, assume malloc is broken.
1011 jm_cv_func_working_malloc=no)
1013 if test $jm_cv_func_working_malloc = no; then
1014 LIBOBJS="$LIBOBJS malloc.o"
1015 AC_DEFINE_UNQUOTED(malloc, rpl_malloc)
1021 dnl SunOS's readdir is broken in such a way that rm.c has to add extra code
1022 dnl to test whether a NULL return value really means there are no more files
1023 dnl in the directory.
1025 dnl Detect the problem by creating a directory containing 300 files (254 not
1026 dnl counting . and .. is the minimum) and see if a loop doing `readdir; unlink'
1027 dnl removes all of them.
1029 dnl Define HAVE_WORKING_READDIR if readdir does *not* have this problem.
1031 dnl Written by Jim Meyering.
1033 AC_DEFUN(jm_FUNC_READDIR,
1035 AC_REQUIRE([AC_HEADER_DIRENT])
1036 AC_CHECK_HEADERS(string.h)
1037 AC_CACHE_CHECK([for working readdir], jm_cv_func_working_readdir,
1039 # Arrange for deletion of the temporary directory this test creates, in
1040 # case the test itself fails to delete everything -- as happens on Sunos.
1041 ac_clean_files="$ac_clean_files conf-dir"
1044 changequote(<<, >>)dnl
1047 # include <sys/types.h>
1049 # include <string.h>
1052 # ifdef HAVE_DIRENT_H
1053 # include <dirent.h>
1054 # define NLENGTH(direct) (strlen((direct)->d_name))
1055 # else /* not HAVE_DIRENT_H */
1056 # define dirent direct
1057 # define NLENGTH(direct) ((direct)->d_namlen)
1058 # ifdef HAVE_SYS_NDIR_H
1059 # include <sys/ndir.h>
1060 # endif /* HAVE_SYS_NDIR_H */
1061 # ifdef HAVE_SYS_DIR_H
1062 # include <sys/dir.h>
1063 # endif /* HAVE_SYS_DIR_H */
1066 # endif /* HAVE_NDIR_H */
1067 # endif /* HAVE_DIRENT_H */
1069 # define DOT_OR_DOTDOT(Basename) \
1070 (Basename[0] == '.' && (Basename[1] == '\0' \
1071 || (Basename[1] == '.' && Basename[2] == '\0')))
1074 create_300_file_dir (const char *dir)
1078 if (mkdir (dir, 0700))
1083 for (i = 0; i < 300; i++)
1088 sprintf (file_name, "%03d", i);
1089 out = fopen (file_name, "w");
1092 if (fclose (out) == EOF)
1101 remove_dir (const char *dir)
1108 dirp = opendir (".");
1114 struct dirent *dp = readdir (dirp);
1118 if (DOT_OR_DOTDOT (dp->d_name))
1121 if (unlink (dp->d_name))
1136 const char *dir = "conf-dir";
1137 create_300_file_dir (dir);
1142 changequote([, ])dnl
1143 jm_cv_func_working_readdir=yes,
1144 jm_cv_func_working_readdir=no,
1145 jm_cv_func_working_readdir=no)])
1148 dnl This code is deliberately never run via ./configure.
1149 dnl FIXME: this is a gross hack to make autoheader put an entry
1150 dnl for this HAVE_-prefixed symbol in config.h.in.
1151 AC_CHECK_FUNCS(WORKING_READDIR)
1155 if test $jm_cv_func_working_readdir = yes; then
1156 ac_kludge=HAVE_WORKING_READDIR
1157 AC_DEFINE_UNQUOTED($ac_kludge)
1163 dnl A replacement for autoconf's AC_FUNC_MEMCMP that detects
1164 dnl the losing memcmp on some x86 Next systems.
1165 AC_DEFUN(jm_AC_FUNC_MEMCMP,
1166 [AC_CACHE_CHECK([for working memcmp], jm_cv_func_memcmp_working,
1168 changequote(<<, >>)dnl
1172 /* Some versions of memcmp are not 8-bit clean. */
1173 char c0 = 0x40, c1 = 0x80, c2 = 0x81;
1174 if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0)
1177 /* The Next x86 OpenStep bug shows up only when comparing 16 bytes
1178 or more and with at least one buffer not starting on a 4-byte boundary.
1179 William Lewis provided this test program. */
1184 for (i = 0; i < 4; i++)
1188 strcpy (a, "--------01111111");
1189 strcpy (b, "--------10000000");
1190 if (memcmp (a, b, 16) >= 0)
1197 changequote([, ])dnl
1198 jm_cv_func_memcmp_working=yes,
1199 jm_cv_func_memcmp_working=no,
1200 jm_cv_func_memcmp_working=no)])
1201 test $jm_cv_func_memcmp_working = no && LIBOBJS="$LIBOBJS memcmp.o"
1202 AC_SUBST(LIBOBJS)dnl
1205 dnl If you use this macro in a package, you should
1206 dnl add the following two lines to acconfig.h:
1207 dnl /* Define to rpl_memcmp if the replacement function should be used. */
1210 AC_DEFUN(jm_FUNC_MEMCMP,
1211 [AC_REQUIRE([jm_AC_FUNC_MEMCMP])dnl
1212 if test $jm_cv_func_memcmp_working = no; then
1213 AC_DEFINE_UNQUOTED(memcmp, rpl_memcmp)
1219 dnl From Jim Meyering.
1221 dnl See if the glibc *_unlocked I/O macros are available.
1224 AC_DEFUN(jm_FUNC_GLIBC_UNLOCKED_IO,
1243 dnl Determine whether to add fnmatch.o to LIBOBJS and to
1244 dnl define fnmatch to rpl_fnmatch.
1246 dnl If you use this macro in a package, you should
1247 dnl add the following two lines to acconfig.h:
1248 dnl /* Define to rpl_fnmatch if the replacement function should be used. */
1252 AC_DEFUN(jm_FUNC_FNMATCH,
1254 AC_REQUIRE([AM_GLIBC])
1256 if test $ac_cv_func_fnmatch_works = no \
1257 && test $ac_cv_gnu_library = no; then
1258 LIBOBJS="$LIBOBJS fnmatch.o"
1259 AC_DEFINE_UNQUOTED(fnmatch, rpl_fnmatch)
1265 dnl From Gordon Matzigkeit.
1266 dnl Test for the GNU C Library.
1267 dnl FIXME: this should migrate into libit.
1271 AC_CACHE_CHECK(whether we are using the GNU C Library,
1273 [AC_EGREP_CPP([Thanks for using GNU],
1275 #include <features.h>
1276 #ifdef __GNU_LIBRARY__
1277 Thanks for using GNU
1280 ac_cv_gnu_library=yes,
1281 ac_cv_gnu_library=no)
1284 AC_CACHE_CHECK(for version 2 of the GNU C Library,
1286 [AC_EGREP_CPP([Thanks for using GNU too],
1288 #include <features.h>
1290 Thanks for using GNU too
1293 ac_cv_glibc=yes, ac_cv_glibc=no)