An independent .m4 file for each module.
authorBruno Haible <bruno@clisp.org>
Tue, 31 Dec 2002 13:43:06 +0000 (13:43 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 31 Dec 2002 13:43:06 +0000 (13:43 +0000)
46 files changed:
m4/ChangeLog
m4/README
m4/acl.m4
m4/c-stack.m4
m4/chown.m4
m4/d-ino.m4
m4/d-type.m4
m4/dirfd.m4
m4/error.m4
m4/fnmatch.m4
m4/fsusage.m4
m4/ftruncate.m4
m4/getcwd.m4
m4/getgroups.m4
m4/getline.m4
m4/getloadavg.m4
m4/gettimeofday.m4
m4/group-member.m4
m4/jm-macros.m4
m4/lchown.m4
m4/longlong.m4
m4/ls-mntd-fs.m4
m4/lstat.m4
m4/malloc.m4
m4/mbrtowc.m4
m4/mbswidth.m4
m4/memcmp.m4
m4/mkdir-slash.m4
m4/mkstemp.m4
m4/nanosleep.m4
m4/prereq.m4
m4/putenv.m4
m4/readdir.m4
m4/realloc.m4
m4/regex.m4
m4/rename.m4
m4/setenv.m4
m4/st_mtim.m4
m4/stat.m4
m4/stdbool.m4
m4/strftime.m4
m4/timespec.m4
m4/utimbuf.m4
m4/utime.m4
m4/xstrtoimax.m4
m4/xstrtoumax.m4

index 2d28236..61fb612 100644 (file)
@@ -1,3 +1,492 @@
+2002-12-24  Bruno Haible  <bruno@clisp.org>
+
+       General infrasructure.
+       * README: Rewritten.
+       * onceonly.m4: New file.
+       * onceonly_2_57.m4: New file.
+
+       Module atexit.
+       * atexit.m4: New file.
+
+       Module strtod.
+       * strtod.m4: New file.
+
+       Module strtol.
+       * strtol.m4: New file.
+
+       Module strtoul.
+       * strtoul.m4: New file.
+
+       Module memchr.
+       * memchr.m4: New file.
+
+       Module memcmp.
+       * memcmp.m4 (gl_PREREQ_MEMCMP): New macro.
+       (jm_FUNC_MEMCMP): Invoke it.
+
+       Module memcpy.
+       * memcpy.m4: New file.
+
+       Module memmove.
+       * memmove.m4: New file.
+
+       Module memset.
+       * memset.m4: New file.
+
+       Module strcspn.
+       * strcspn.m4: New file.
+
+       Module strpbrk.
+       * strpbrk.m4: New file.
+
+       Module strstr.
+       * strstr.m4: New file.
+
+       Module strerror.
+       * strerror.m4: New file.
+
+       Module mktime.
+       * mktime.m4: Renamed from jm-mktime.m4.
+       (gl_PREREQ_MKTIME): New macro.
+       (gl_FUNC_MKTIME): Renamed from jm_FUNC_MKTIME. Invoke gl_PREREQ_MKTIME.
+
+       Module malloc.
+       * malloc.m4 (gl_PREREQ_MALLOC): New macro.
+       (jm_FUNC_MALLOC): Use AC_FUNC_MALLOC. Invoke gl_PREREQ_MALLOC.
+       Don't define HAVE_DONE_WORKING_MALLOC_CHECK, since nothing uses it.
+
+       Module realloc.
+       * realloc.m4 (gl_PREREQ_REALLOC): New macro.
+       (jm_FUNC_REALLOC): Use AC_FUNC_REALLOC. Invoke gl_PREREQ_REALLOC.
+       Don't define HAVE_DONE_WORKING_REALLOC_CHECK, since nothing uses it.
+
+       Module strftime.
+       * tm_gmtoff.m4: New file, extracted from strftime.m4.
+       * strftime.m4 (_jm_STRFTIME_PREREQS): Use AC_FUNC_STRFTIME.
+       Don't test for bcopy (we are not emacs). Invoke AC_TYPE_MBSTATE_T and
+       gl_TM_GMTOFF.
+       (_jm_STRFTIME_PREREQS, jm_FUNC_GNU_STRFTIME): Use onceonly macros.
+
+       Module xalloc.
+       * xalloc.m4: New file.
+
+       Module alloca.
+       * alloca.m4: New file.
+
+       Module putenv.
+       * putenv.m4 (gl_PREREQ_PUTENV): New macro.
+       (jm_FUNC_PUTENV): Invoke it.
+
+       Module setenv.
+       * setenv.m4 (gt_FUNC_SETENV): New macro.
+       (gt_CHECK_VAR_DECL): Fix quoting error that led to infinite loop in m4
+       when invoked twice.
+       (gt_PREREQ_SETENV, gt_PREREQ_UNSETENV): New macros, replacing old
+       gt_FUNC_SETENV.
+
+       Module memrchr.
+       * memrchr.m4: New file.
+
+       Module stpcpy.
+       * stpcpy.m4: New file.
+
+       Module strcase.
+       * strcase.m4: New file.
+
+       Module strdup.
+       * strdup.m4: New file.
+
+       Module strnlen.
+       * strnlen.m4: New file.
+
+       Module strndup.
+       * strndup.m4: New file.
+
+       Module xstrtod.
+       * xstrtod.m4: New file.
+
+       Module xstrtol.
+       * xstrtol.m4: New file.
+
+       Module getdate.
+       * getdate.m4: New file.
+
+       Module unlocked-io.
+       * unlocked-io.m4: Renamed from jm-glibc-io.m4.
+       (jm_FUNC_GLIBC_UNLOCKED_IO): Invoke AC_GNU_SOURCE. Use onceonly macros.
+       * jm-glibc-io.m4n: Remove file.
+
+       Module long-options.
+       * long-options.m4: New file.
+
+       Module md5.
+       * md5.m4: New file.
+
+       Module sha.
+       * sha.m4: New file.
+
+       Module getstr.
+       * getstr.m4: New file.
+
+       Module getline.
+       * getline.m4 (gl_PREREQ_GETLINE): New macro.
+       (AM_FUNC_GETLINE): Invoke AC_GNU_SOURCE. Use <stdlib.h>, not
+       <sys/types.h>, for size_t. Use the function name gnu_getline, not
+       simply getline. Infoke gl_PREREQ_GETLINE.
+
+       Module obstack.
+       * obstack.m4: New file.
+
+       Module hash.
+       * hash.m4: New file.
+
+       Module readtokens.
+       * readtokens.m4: New file.
+
+       Module strverscmp.
+       * strverscmp.m4: New file.
+
+       Module stdbool.
+       * stdbool.m4 (AC_HEADER_STDBOOL): Add test for _Bool. Needed for OSF/1.
+
+       Module strtoll.
+       * strtoll.m4: New file.
+
+       Module strtoull.
+       * strtoull.m4: New file.
+
+       Module strtoimax.
+       * strtoimax.m4: New file.
+
+       Module strtoumax.
+       * strtoumax.m4: New file.
+
+       Module xstrtoimax.
+       * xstrtoimax.m4 (jm_XSTRTOIMAX): Renamed from jm_AC_PREREQ_XSTRTOIMAX.
+       Moved the strtol prerequisites to strtol.m4.
+       Moved the strtoll prerequisites to strtoll.m4.
+       Moved the strtoimax prerequisites to strtoimax.m4.
+
+       Module xstrtoumax.
+       * xstrtoumax.m4 (jm_XSTRTOUMAX): Renamed from jm_AC_PREREQ_XSTRTOUMAX.
+       Moved the strtoul prerequisites to strtoul.m4.
+       Moved the strtoull prerequisites to strtoull.m4.
+       Moved the strtoumax prerequisites to strtoumax.m4.
+
+       Module chown.
+       * chown.m4 (gl_PREREQ_CHOWN): New macro.
+       (jm_FUNC_CHOWN): Use AC_FUNC_CHOWN. Invoke gl_PREREQ_CHOWN.
+
+       Module dup2.
+       * dup2.m4: New file.
+
+       Module ftruncate.
+       * ftruncate.m4 (gl_PREREQ_FTRUNCATE): New macro.
+       (jm_FUNC_FTRUNCATE): Use AC_REPLACE_FUNCS. Invoke gl_PREREQ_FTRUNCATE.
+
+       Module getgroups.
+       * getgroups.m4 (gl_PREREQ_GETGROUPS): New macro.
+       (jm_FUNC_GETGROUPS): Use AC_FUNC_GETGROUPS. Invoke gl_PREREQ_GETGROUPS.
+
+       Module gettimeofday.
+       * gettimeofday.m4 (gl_PREREQ_GETTIMEOFDAY): New macro.
+       (AC_FUNC_GETTIMEOFDAY_CLOBBER): Use onceonly macros. Invoke
+       gl_PREREQ_GETTIMEOFDAY.
+
+       Module mkdir.
+       * mkdir-slash.m4 (gl_PREREQ_MKDIR): New macro.
+       (UTILS_FUNC_MKDIR_TRAILING_SLASH): Invoke gl_PREREQ_MKDIR.
+
+       Module mkstemp.
+       * mkstemp.m4 (gl_PREREQ_MKSTEMP): New macro.
+       (jm_PREREQ_TEMPNAME): New macro, from prereq.m4. Also invoke
+       jm_AC_TYPE_UINTMAX_T.
+       (UTILS_FUNC_MKSTEMP): Invoke gl_PREREQ_MKSTEMP and jm_PREREQ_TEMPNAME.
+
+       Module stat.
+       * stat.m4 (gl_PREREQ_STAT): New macro.
+       (jm_FUNC_STAT): Use AC_FUNC_STAT. Invoke gl_PREREQ_STAT.
+
+       Module lstat.
+       * lstat.m4 (gl_PREREQ_LSTAT): New macro.
+       (jm_FUNC_LSTAT): Use AC_FUNC_LSTAT. Invoke gl_PREREQ_LSTAT.
+
+       Module timespec.
+       * timespec.m4 (gl_TIMESPEC): New macro.
+       (jm_CHECK_TYPE_STRUCT_TIMESPEC): Add check for <sys/time.h>.
+       * st_mtim.m4: Indentation.
+
+       Module nanosleep.
+       * nanosleep.m4 (gl_PREREQ_NANOSLEEP): New macro.
+       (jm_FUNC_NANOSLEEP): Add check for <sys/time.h>. Invoke
+       gl_PREREQ_NANOSLEEP.
+
+       Module regex.
+       * regex.m4 (jm_PREREQ_REGEX): New macro.
+       (jm_INCLUDED_REGEX): Invoke jm_PREREQ_REGEX.
+       (gl_REGEX): New macro.
+
+       Module rename.
+       * rename.m4 (gl_PREREQ_RENAME): New macro.
+       (vb_FUNC_RENAME): Invoke gl_PREREQ_RENAME.
+
+       Module rmdir.
+       * rmdir.m4: New file.
+
+       Module utime.
+       * utimbuf.m4 (jm_CHECK_TYPE_STRUCT_UTIMBUF): Use onceonly macros.
+       * utime.m4 (gl_PREREQ_UTIME): New macro.
+       (jm_FUNC_UTIME): Invoke gl_PREREQ_UTIME.
+
+       Module dirname.
+       * dirname.m4: New file.
+
+       Module getopt.
+       * getopt.m4: New file.
+
+       Module unistd-safer.
+       * unistd-safer.m4: New file.
+
+       Module fnmatch.
+       * fnmatch.m4 (_AC_FUNC_FNMATCH_IF): Include <stdlib.h>, for exit()
+       declaration.
+       (gl_PREREQ_FNMATCH_EXTRA): New macro.
+       (gl_FUNC_FNMATCH_POSIX): New macro.
+       (gl_FUNC_FNMATCH_GNU): Renamed from AC_FUNC_FNMATCH_GNU. Invoke
+       gl_PREREQ_FNMATCH_EXTRA. Use the function name gnu_fnmatch, not
+       simply fnmatch.
+
+       Module exclude.
+       * exclude.m4: New file.
+
+       Module human.
+       * human.m4: New file.
+
+       Module acl.
+       * acl.m4: Nop.
+
+       Module backupfile.
+       * backupfile.m4: New file.
+       * d-ino.m4: Indentation.
+
+       Module fsusage.
+       * fsusage.m4 (gl_FSUSAGE): New macro.
+       (jm_STATFS_TRUNCATES): New macro, from coreutils-4.5.4/configure.ac.
+       (gl_PREREQ_FSUSAGE_EXTRA): New macro.
+
+       Module dirfd.
+       * dirfd.m4 (UTILS_FUNC_DIRFD): Invoke some AC_EGREP_CPP requirements.
+
+       Module euidaccess.
+       * euidaccess.m4: New file.
+
+       Module file-type.
+       * file-type.m4: New file.
+
+       Module fileblocks.
+       * fileblocks.m4: New file.
+
+       Module filemode.
+       * filemode.m4: New file.
+
+       Module isdir.
+       * isdir.m4: New file.
+
+       Module lchown.
+       * lchown.m4 (gl_PREREQ_LCHOWN): New macro.
+       (jm_FUNC_LCHOWN): Invoke gl_PREREQ_LCHOWN.
+
+       Module makepath.
+       * makepath.m4: New file.
+
+       Module modechange.
+       * modechange.m4: New file.
+
+       Module mountlist.
+       * mountlist.m4: New file.
+       * ls-mntd-fs.m4 (jm_LIST_MOUNTED_FILESYSTEMS): Use onceonly macros.
+       Indentation.
+
+       Module path-concat.
+       * path-concat.m4: New file.
+
+       Module pathmax.
+       * pathmax.m4: New file.
+
+       Module same.
+       * same.m4: New file.
+
+       Module save-cwd.
+       * save-cwd.m4: New file.
+
+       Module savedir.
+       * savedir.m4: New file.
+
+       Module xgetcwd.
+       * xgetcwd.m4: New file.
+       * getcwd.m4 (AC_FUNC_GETCWD_NULL): Use onceonly macros.
+
+       Module xreadlink.
+       * xreadlink.m4: New file.
+
+       Module safe-read.
+       * safe-read.m4: New file.
+
+       Module safe-write.
+       * safe-write.m4: New file.
+
+       Module closeout.
+       * closeout.m4: New file.
+
+       Module stdio-safer.
+       * stdio-safer.m4: New file.
+
+       Module getpass.
+       * getpass.m4: New file.
+
+       Module getugroups.
+       * getugroups.m4: New file.
+
+       Module group-member.
+       * group-member.m4 (gl_PREREQ_GROUP_MEMBER): New macro.
+       (jm_FUNC_GROUP_MEMBER): Invoke AC_GNU_SOURCE, gl_PREREQ_GROUP_MEMBER.
+
+       Module idcache.
+       * idcache.m4: New file.
+
+       Module userspec.
+       * userspec.m4: New file.
+
+       Module gettime.
+       * clock_time.m4: New file.
+       * gettime.m4: New file.
+
+       Module settime.
+       * settime.m4: New file.
+
+       Module posixtm.
+       * posixtm.m4: New file.
+
+       Module gethostname.
+       * gethostname.m4: New file.
+
+       Module canon-host.
+       * canon-host.m4: New file.
+
+       Module gettext.
+       * codeset.m4: New file, from gettext-0.11.5.
+       * gettext.m4: New file, from gettext-0.11.5.
+       * glibc21.m4: New file, from gettext-0.11.5.
+       * iconv.m4: New file, from gettext-0.11.5.
+       * intdiv0.m4: New file, from gettext-0.11.5.
+       * inttypes-pri.m4: New file, from gettext-0.11.5.
+       * inttypes.m4: New file, from gettext-0.11.5.
+       * inttypes_h.m4: New file, from gettext-0.11.5 with modifications.
+       * isc-posix.m4: New file, from gettext-0.11.5.
+       * lcmessage.m4: New file, from gettext-0.11.5.
+       * lib-ld.m4: New file, from gettext-0.11.5.
+       * lib-link.m4: New file, from gettext-0.11.5.
+       * lib-prefix.m4: New file, from gettext-0.11.5.
+       * progtest.m4: New file, from gettext-0.11.5.
+       * stdint_h.m4: New file, from gettext-0.11.5 with modifications.
+       * uintmax_t.m4: New file, from gettext-0.11.5 with modifications.
+       * ulonglong.m4: New file, from gettext-0.11.5 with modifications.
+
+       Module localcharset.
+       * localcharset.m4: New file.
+
+       Module hard-locale.
+       * hard-locale.m4: New file.
+
+       Module mbswidth.
+       * mbswidth.m4 (gl_MBSWIDTH): Renamed from jm_PREREQ_MBSWIDTH. Use
+       onceonly macros.
+       * mbrtowc.m4: Add comment.
+
+       Module memcasecmp.
+       * memcasecmp.m4: New file.
+
+       Module memcoll.
+       * memcoll.m4: New file.
+
+       Module unicodeio.
+       * unicodeio.m4: New file.
+
+       Module rpmatch.
+       * rpmatch.m4: New file.
+
+       Module yesno.
+       * yesno.m4: New file.
+
+       Module exitfail.
+       * exitfail.m4: New file.
+
+       Module c-stack.
+       * c-stack.m4 (gl_C_STACK): New macro.
+       (jm_PREREQ_C_STACK): Check for <sys/time.h>. Use onceonly macros.
+
+       Module error.
+       * error.m4 (gl_ERROR): New macro.
+       (jm_PREREQ_ERROR): Use onceonly macros.
+
+       Module fatal.
+       * fatal.m4: New file.
+
+       Module getloadavg.
+       * getloadavg.m4 (AC_FUNC_GETLOADAVG): Use onceonly macros.
+       (gl_FUNC_GETLOADAVG, gl_PREREQ_GETLOADAVG): New macros.
+
+       Module getpagesize.
+       * getpagesize.m4: New file.
+
+       Module getusershell.
+       * getusershell.m4: New file.
+
+       Module physmem.
+       * physmem.m4: New file.
+
+       Module posixver.
+       * posixver.m4: New file.
+
+       Module quotearg.
+       * quotearg.m4: New file.
+
+       Module quote.
+       * quote.m4: New file.
+
+       Module readutmp.
+       * readutmp.m4: New file, based on jm_PREREQ_READUTMP from prereq.m4.
+
+       Module sig2str.
+       * sig2str.m4: New file.
+
+       Other.
+       * longlong.m4 (jm_AC_TYPE_UNSIGNED_LONG_LONG): Remove, moved to
+       ulonglong.m4.
+       * intmax_t.m4: New file.
+       * d-type.m4: Indentation.
+       * jm-macros.m4: Update.
+       * prereq.m4 (jm_PREREQ): Update.
+       (jm_PREREQ_ADDEXT): Remove, obsoleted by backupfile.m4.
+       (jm_PREREQ_CANON_HOST): Remove, obsoleted by canon-host.m4.
+       (jm_PREREQ_DIRNAME): Remove, obsoleted by dirname.m4.
+       (jm_PREREQ_EXCLUDE): Remove, obsoleted by exclude.m4.
+       (jm_PREREQ_GETPAGESIZE): Remove, obsoleted by getpagesize.m4.
+       (jm_PREREQ_HARD_LOCALE): Remove, obsoleted by hard-locale.m4.
+       (jm_PREREQ_HASH): Remove, obsoleted by hash.m4.
+       (jm_PREREQ_HUMAN): Remove, obsoleted by human.m4.
+       (jm_PREREQ_MEMCHR): Remove, obsoleted by memchr.m4.
+       (jm_PREREQ_PHYSMEM): Remove, obsoleted by physmem.m4.
+       (jm_PREREQ_POSIXVER): Remove, obsoleted by posixver.m4.
+       (jm_PREREQ_QUOTEARG): Remove, obsoleted by quotearg.m4.
+       (jm_PREREQ_READUTMP): Remove, obsoleted by readutmp.m4.
+       (jm_PREREQ_REGEX): Remove, obsoleted by regex.m4.
+       (jm_PREREQ_STRNLEN): Remove, obsoleted by strnlen.m4.
+       (jm_PREREQ_TEMPNAME): Remove, obsoleted by mkstemp.m4.
+       (jm_PREREQ_XGETCWD): Remove, obsoleted by xgetcwd.m4.
+       (jm_PREREQ_XREADLINK): Remove, obsoleted by xreadlink.m4.
+       * readdir.m4 (jm_FUNC_READDIR): Use onceonly macros.
+
 2002-12-18  Bruno Haible  <bruno@clisp.org>
 
        * strftime.m4 (_jm_STRFTIME_PREREQS): Don't test for localtime_r.
index a101922..964c598 100644 (file)
--- a/m4/README
+++ b/m4/README
@@ -1,18 +1,85 @@
-Many of the files in this directory are shared between the diffutils,
-fileutils, sh-utils, and textutils packages -- and others, so if you
+Many of the files in this directory are shared between the coreutils,
+diffutils, tar and gettext packages -- and others, so if you
 change them, try to ensure that you don't break those packages.
-Unfortunately, that's hard.
-
-One way to do that is to put the modified .m4 file in each of the packages,
-run `make dist' to create a .tar.gz file, then build that package on as
-many different types of systems as possible.  Then repeat, but using the
-original version of the .m4 file.  Run configure like this each time
-`./configure --cache=config.cache' and be sure to save the following files
-from each run: config.cache config.status config.out config.h*.
-Then compare the two versions of each of those files and be prepared to
-explain any differences.
-
-These files are used by a program called aclocal (part of the GNU automake
-package).  aclocal uses these files to create aclocal.m4 which is in turn
-used by autoconf to create the configure script at the top level in
-this distribution.
+That's hard without a systematic approach, but here is a set of conventions
+that makes it easy.
+
+- The lib/ sources are split into modules.  Usually the module of a
+  lib/foo.h and lib/foo.c is called "foo" - not unexpected, hey! -, but
+  in more ambiguous cases you can look up the module a file belongs to
+  by doing "grep lib/foo.c modules/*".
+
+- For every module there is an autoconf macro file, usually called
+  m4/foo.m4 according to the module name.  When you modify lib/foo.h or
+  lib/foo.c, remember to modify m4/foo.m4 as well!
+  What if you don't find m4/foo.m4? This probably means that the module
+  doesn't need autoconf support up to now (again, take a look in modules/*).
+  So you might need to create one.
+
+- A module which defines a replacement function (i.e. a function which is
+  compiled only on systems which lack it or where it exists but doesn't
+  work satisfactorily) has a .m4 file with typically the following structure:
+
+  AC_DEFUN([gl_FUNC_FOO],
+  [
+    AC_REPLACE_FUNCS(foo)
+    if test $ac_cv_func_foo = no; then
+      gl_PREREQ_FOO
+    fi
+  ])
+
+  # Prerequisites of lib/foo.c.
+  AC_DEFUN([gl_PREREQ_FOO], [
+    dnl Many AC_CHECK_* invocations.
+  ])
+
+- A module which is compiled on all platforms can define multiple functions
+  and be spread across multiple source files (although each time you do
+  this you should consider splitting the module, if the source files could
+  be independent). The .m4 file has typically the following structure:
+
+  AC_DEFUN([gl_FOO],
+  [
+    dnl Prerequisites of lib/foo.c.
+    dnl Many AC_CHECK_* invocations.
+
+    dnl Prerequisites of lib/foobar.c.
+    dnl Many AC_CHECK_* invocations.
+  ])
+
+- When a module FOO depends on a module BAR, you do *not* generally need
+  to write
+
+  AC_DEFUN([gl_FOO],
+  [
+    AC_REQUIRE([gl_BAR])
+    ...
+  ])
+
+  because the maintainers might want to use locally modified / renamed copies
+  of the module BAR.
+
+- If the autoconf tests for the modules FOO and BAR have some checks in
+  common, still list them separately. Autoconf has two mechanisms for
+  avoiding that a configure file runs the same test twice: AC_REQUIRE
+  and AC_CACHE_CHECK. Trying to omit the checks leads to maintenance
+  problems: If FOO depends on BAR, and you omit a check from FOO's .m4 file,
+  later on, when someone modifies bar.c and removes the check from bar.m4,
+  he will not remember that foo.c needs the check as well.
+
+- Now, how can you find the prerequisites of lib/foo.c? Try this:
+    "grep '#.*if' lib/foo.c | grep -v endif"
+  and for each HAVE_* macro search in the autoconf documentation what could
+  be the autoconf macro that provides it. This is only an approximation; in
+  general you should look at all preprocessor directives in lib/foo.c.
+
+- After ANY modifications of an m4 file, you should increment its serial
+  number (in the first line). Also, if this first line features a particular
+  release, _remove_ this release stamp. Example: Change
+
+    # setenv.m4 serial 2 (gettext-0.11.1)
+
+  into
+
+    # setenv.m4 serial 3
+
index f5ffa3d..9c7d446 100644 (file)
--- a/m4/acl.m4
+++ b/m4/acl.m4
@@ -19,5 +19,8 @@
 # Written by Paul Eggert.
 
 AC_DEFUN([AC_FUNC_ACL],
-  [AC_CHECK_HEADERS(sys/acl.h)
-   AC_CHECK_FUNCS(acl)])
+[
+  dnl Prerequisites of lib/acl.c.
+  AC_CHECK_HEADERS(sys/acl.h)
+  AC_CHECK_FUNCS(acl)
+])
index 01c9a88..81c873b 100644 (file)
@@ -131,6 +131,13 @@ AC_DEFUN([jm_PREREQ_C_STACK],
    AC_CHECK_DECLS([getcontext], , , [#include <ucontext.h>])
    AC_CHECK_DECLS([sigaltstack], , , [#include <signal.h>])
 
-   AC_CHECK_HEADERS(sys/resource.h ucontext.h unistd.h)
+   AC_CHECK_HEADERS_ONCE(sys/time.h unistd.h)
+   AC_CHECK_HEADERS(sys/resource.h ucontext.h)
 
    AC_CHECK_TYPES([stack_t], , , [#include <signal.h>])])
+
+AC_DEFUN([gl_C_STACK],
+[
+  dnl Prerequisites of lib/c-stack.c.
+  jm_PREREQ_C_STACK
+])
index 1f3f51b..86c5fc7 100644 (file)
@@ -1,4 +1,4 @@
-#serial 7
+#serial 8
 
 dnl From Jim Meyering.
 dnl Determine whether chown accepts arguments of -1 for uid and gid.
@@ -6,44 +6,19 @@ dnl If it doesn't, arrange to use the replacement function.
 dnl
 
 AC_DEFUN([jm_FUNC_CHOWN],
-[AC_REQUIRE([AC_TYPE_UID_T])dnl
- test -z "$ac_cv_header_unistd_h" \
-   && AC_CHECK_HEADERS(unistd.h)
- AC_CACHE_CHECK([for working chown], jm_cv_func_working_chown,
-  [AC_TRY_RUN([
-#   include <sys/types.h>
-#   include <sys/stat.h>
-#   include <fcntl.h>
-#   ifdef HAVE_UNISTD_H
-#    include <unistd.h>
-#   endif
-
-    int
-    main ()
-    {
-      char *f = "conftest.chown";
-      struct stat before, after;
-
-      if (creat (f, 0600) < 0)
-        exit (1);
-      if (stat (f, &before) < 0)
-        exit (1);
-      if (chown (f, (uid_t) -1, (gid_t) -1) == -1)
-        exit (1);
-      if (stat (f, &after) < 0)
-        exit (1);
-      exit ((before.st_uid == after.st_uid
-            && before.st_gid == after.st_gid) ? 0 : 1);
-    }
-             ],
-            jm_cv_func_working_chown=yes,
-            jm_cv_func_working_chown=no,
-            dnl When crosscompiling, assume chown is broken.
-            jm_cv_func_working_chown=no)
-  ])
-  if test $jm_cv_func_working_chown = no; then
+[
+  AC_REQUIRE([AC_TYPE_UID_T])dnl
+  AC_REQUIRE([AC_FUNC_CHOWN])
+  if test $ac_cv_func_chown_works = no; then
     AC_LIBOBJ(chown)
     AC_DEFINE(chown, rpl_chown,
       [Define to rpl_chown if the replacement function should be used.])
+    gl_PREREQ_CHOWN
   fi
 ])
+
+# Prerequisites of lib/chown.c.
+AC_DEFUN([gl_PREREQ_CHOWN],
+[
+  AC_CHECK_HEADERS_ONCE(unistd.h)
+])
index 6ca60dc..d2555e9 100644 (file)
@@ -1,4 +1,4 @@
-#serial 4
+#serial 5
 
 dnl From Jim Meyering.
 dnl
@@ -35,8 +35,8 @@ AC_DEFUN([jm_CHECK_TYPE_STRUCT_DIRENT_D_INO],
    )
    if test $jm_cv_struct_dirent_d_ino = yes; then
      AC_DEFINE(D_INO_IN_DIRENT, 1,
-  [Define if there is a member named d_ino in the struct describing
-   directory headers.])
+       [Define if there is a member named d_ino in the struct describing
+        directory headers.])
    fi
   ]
 )
index ae0ba57..c69436d 100644 (file)
@@ -1,4 +1,4 @@
-#serial 5
+#serial 6
 
 dnl From Jim Meyering.
 dnl
@@ -35,8 +35,8 @@ AC_DEFUN([jm_CHECK_TYPE_STRUCT_DIRENT_D_TYPE],
    )
    if test $jm_cv_struct_dirent_d_type = yes; then
      AC_DEFINE(HAVE_STRUCT_DIRENT_D_TYPE, 1,
-  [Define if there is a member named d_type in the struct describing
-   directory headers.])
+       [Define if there is a member named d_type in the struct describing
+        directory headers.])
    fi
   ]
 )
index efdd067..27914de 100644 (file)
@@ -1,10 +1,14 @@
-#serial 2
+#serial 3
 
 dnl Find out how to get the file descriptor associated with an open DIR*.
 dnl From Jim Meyering
 
 AC_DEFUN([UTILS_FUNC_DIRFD],
 [
+  dnl Work around a bug of AC_EGREP_CPP in autoconf-2.57.
+  AC_REQUIRE([AC_PROG_CPP])
+  AC_REQUIRE([AC_PROG_EGREP])
+
   AC_HEADER_DIRENT
   dirfd_headers='
 #if HAVE_DIRENT_H
index 3fddb5c..99e9cf0 100644 (file)
@@ -1,13 +1,20 @@
-#serial 4
+#serial 5
 
-dnl FIXME: put these prerequisite-only *.m4 files in a separate
-dnl directory -- otherwise, they'll conflict with existing files.
+AC_DEFUN([gl_ERROR],
+[
+  AC_FUNC_ERROR_AT_LINE
+  dnl Note: AC_FUNC_ERROR_AT_LINE does AC_LIBSOURCES([error.h, error.c]).
+  if test $ac_cv_lib_error_at_line = no; then
+    jm_PREREQ_ERROR
+  fi
+])
 
-dnl These are the prerequisite macros for GNU's error.c file.
+# Prerequisites of lib/error.c.
 AC_DEFUN([jm_PREREQ_ERROR],
 [
-  AC_CHECK_FUNCS(strerror vprintf doprnt)
+  AC_REQUIRE([AC_HEADER_STDC])
+  AC_CHECK_FUNCS_ONCE(doprnt vprintf)
+  AC_CHECK_FUNCS(strerror)
   AC_CHECK_DECLS([strerror])
   AC_FUNC_STRERROR_R
-  AC_HEADER_STDC
 ])
index 708f9e6..ec66a17 100644 (file)
@@ -1,7 +1,7 @@
 # Check for fnmatch.
 
 # This is a modified version of autoconf's AC_FUNC_FNMATCH.
-# This file should be removed after Autoconf 2.54 is required.
+# This file should be simplified after Autoconf 2.57 is required.
 
 # Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
 
@@ -34,7 +34,9 @@ AC_DEFUN([_AC_FUNC_FNMATCH_IF],
    # Thanks to John Oleynick, Franc,ois Pinard, and Paul Eggert for this test.
    AC_RUN_IFELSE(
       [AC_LANG_PROGRAM(
-        [#include <fnmatch.h>
+        [
+#         include <stdlib.h>
+#         include <fnmatch.h>
 #         define y(a, b, c) (fnmatch (a, b, c) == 0)
 #         define n(a, b, c) (fnmatch (a, b, c) == FNM_NOMATCH)
          ],
@@ -77,11 +79,44 @@ AC_DEFINE(fnmatch, rpl_fnmatch,
 ])# _AC_LIBOBJ_FNMATCH
 
 
-# AC_FUNC_FNMATCH_GNU
-# -------------------
-AC_DEFUN([AC_FUNC_FNMATCH_GNU],
-[AC_REQUIRE([AC_GNU_SOURCE])
-_AC_FUNC_FNMATCH_IF([GNU], [ac_cv_func_fnmatch_gnu],
-                    [rm -f lib/fnmatch.h],
-                    [_AC_LIBOBJ_FNMATCH])
-])# AC_FUNC_FNMATCH_GNU
+# Additional prerequisites of lib/fnmatch.c, not part of _AC_LIBOBJ_FNMATCH.
+AC_DEFUN([gl_PREREQ_FNMATCH_EXTRA],
+[
+  AC_REQUIRE([AC_HEADER_STDC])
+  AC_CHECK_HEADERS_ONCE(string.h strings.h)
+])
+
+
+AC_DEFUN([gl_FUNC_FNMATCH_POSIX],
+[
+  _AC_FUNC_FNMATCH_IF([POSIX], [ac_cv_func_fnmatch_posix],
+                      [rm -f lib/fnmatch.h],
+                      [_AC_LIBOBJ_FNMATCH])
+  if test $ac_cv_func_fnmatch_posix != yes; then
+    gl_PREREQ_FNMATCH_EXTRA
+    dnl We must choose a different name for our function, since on ELF systems
+    dnl a broken fnmatch() in libc.so would override our fnmatch() if it is
+    dnl compiled into a shared library.
+    AC_DEFINE([fnmatch], [posix_fnmatch],
+      [Define to a replacement function name for fnmatch().])
+  fi
+])
+
+
+AC_DEFUN([gl_FUNC_FNMATCH_GNU],
+[
+  dnl Persuade glibc <fnmatch.h> to declare FNM_CASEFOLD etc.
+  AC_REQUIRE([AC_GNU_SOURCE])
+
+  _AC_FUNC_FNMATCH_IF([GNU], [ac_cv_func_fnmatch_gnu],
+                      [rm -f lib/fnmatch.h],
+                      [_AC_LIBOBJ_FNMATCH])
+  if test $ac_cv_func_fnmatch_gnu != yes; then
+    gl_PREREQ_FNMATCH_EXTRA
+    dnl We must choose a different name for our function, since on ELF systems
+    dnl a broken fnmatch() in libc.so would override our fnmatch() if it is
+    dnl compiled into a shared library.
+    AC_DEFINE([fnmatch], [gnu_fnmatch],
+      [Define to a replacement function name for fnmatch().])
+  fi
+])
index 451a5cc..13ed7c6 100644 (file)
@@ -1,7 +1,18 @@
-#serial 8
+#serial 9
 
 # From fileutils/configure.in
 
+AC_DEFUN([gl_FSUSAGE],
+[
+  AC_CHECK_HEADERS_ONCE(sys/param.h)
+  AC_CHECK_HEADERS(sys/mount.h sys/vfs.h sys/fs_types.h)
+  jm_FILE_SYSTEM_USAGE([gl_cv_fs_space=yes], [gl_cv_fs_space=no])
+  if test $gl_cv_fs_space = yes; then
+    AC_LIBOBJ(fsusage)
+    gl_PREREQ_FSUSAGE_EXTRA
+  fi
+])
+
 # Try to determine how a program can obtain filesystem usage information.
 # If successful, define the appropriate symbol (see fsusage.c) and
 # execute ACTION-IF-FOUND.  Otherwise, execute ACTION-IF-NOT-FOUND.
@@ -191,3 +202,40 @@ fi
 AS_IF([test $ac_fsusage_space = yes], [$1], [$2])
 
 ])
+
+
+# Check for SunOS statfs brokenness wrt partitions 2GB and larger.
+# If <sys/vfs.h> exists and struct statfs has a member named f_spare,
+# enable the work-around code in fsusage.c.
+AC_DEFUN([jm_STATFS_TRUNCATES],
+[
+  AC_MSG_CHECKING([for statfs that truncates block counts])
+  AC_CACHE_VAL(fu_cv_sys_truncating_statfs,
+  [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#if !defined(sun) && !defined(__sun)
+choke -- this is a workaround for a Sun-specific problem
+#endif
+#include <sys/types.h>
+#include <sys/vfs.h>]],
+    [[struct statfs t; long c = *(t.f_spare);]])],
+    [fu_cv_sys_truncating_statfs=yes],
+    [fu_cv_sys_truncating_statfs=no])])
+  if test $fu_cv_sys_truncating_statfs = yes; then
+    AC_DEFINE(STATFS_TRUNCATES_BLOCK_COUNTS, 1,
+      [Define if the block counts reported by statfs may be truncated to 2GB
+       and the correct values may be stored in the f_spare array.
+       (SunOS 4.1.2, 4.1.3, and 4.1.3_U1 are reported to have this problem.
+       SunOS 4.1.1 seems not to be affected.)])
+  fi
+  AC_MSG_RESULT($fu_cv_sys_truncating_statfs)
+])
+
+
+# Prerequisites of lib/fsusage.c not done by jm_FILE_SYSTEM_USAGE.
+AC_DEFUN([gl_PREREQ_FSUSAGE_EXTRA],
+[
+  AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
+  AC_CHECK_HEADERS_ONCE(fcntl.h limits.h)
+  AC_CHECK_HEADERS(dustat.h sys/fs/s5param.h sys/filsys.h sys/statfs.h sys/statvfs.h)
+  jm_STATFS_TRUNCATES
+])
index 0397a00..ec593a9 100644 (file)
@@ -1,14 +1,18 @@
-#serial 4
+#serial 5
 
 # See if we need to emulate a missing ftruncate function using fcntl or chsize.
 
 AC_DEFUN([jm_FUNC_FTRUNCATE],
 [
-  AC_CHECK_FUNCS(ftruncate, , [ftruncate_missing=yes])
-
-  if test "$ftruncate_missing" = yes; then
-    AC_CHECK_HEADERS([unistd.h])
-    AC_CHECK_FUNCS([chsize])
-    AC_LIBOBJ(ftruncate)
+  AC_REPLACE_FUNCS(ftruncate)
+  if test $ac_cv_func_ftruncate = no; then
+    gl_PREREQ_FTRUNCATE
   fi
 ])
+
+# Prerequisites of lib/ftruncate.c.
+AC_DEFUN([gl_PREREQ_FTRUNCATE],
+[
+  AC_CHECK_HEADERS_ONCE(unistd.h)
+  AC_CHECK_FUNCS(chsize)
+])
index 1e1b80e..7790dde 100644 (file)
@@ -19,7 +19,8 @@
 # Written by Paul Eggert.
 
 AC_DEFUN([AC_FUNC_GETCWD_NULL],
-  [AC_CHECK_HEADERS(stdlib.h unistd.h)
+  [
+   AC_CHECK_HEADERS_ONCE(stdlib.h unistd.h)
    AC_CACHE_CHECK([whether getcwd (NULL, 0) allocates memory for result],
      [ac_cv_func_getcwd_null],
      [AC_TRY_RUN(
index e0f3359..094cfd2 100644 (file)
@@ -1,4 +1,4 @@
-#serial 5
+#serial 6
 
 dnl From Jim Meyering.
 dnl
@@ -8,39 +8,19 @@ dnl  test -n "$GETGROUPS_LIB" && LIBS="$GETGROUPS_LIB $LIBS"
 dnl
 
 AC_DEFUN([jm_FUNC_GETGROUPS],
-[AC_REQUIRE([AC_TYPE_GETGROUPS])dnl
- AC_REQUIRE([AC_TYPE_SIZE_T])dnl
- AC_CHECK_FUNCS(getgroups)
-
- # If we don't yet have getgroups, see if it's in -lbsd.
- # This is reported to be necessary on an ITOS 3000WS running SEIUX 3.1.
- if test $ac_cv_func_getgroups = no; then
-   jm_cv_sys_getgroups_saved_lib="$LIBS"
-   AC_CHECK_LIB(bsd, getgroups, [GETGROUPS_LIB=-lbsd])
-   LIBS="$jm_cv_sys_getgroups_saved_lib"
- fi
-
- # Run the program to test the functionality of the system-supplied
- # getgroups function only if there is such a function.
- if test $ac_cv_func_getgroups = yes; then
-   AC_CACHE_CHECK([for working getgroups], jm_cv_func_working_getgroups,
-    [AC_TRY_RUN([
-      int
-      main ()
-      {
-       /* On Ultrix 4.3, getgroups (0, 0) always fails.  */
-       exit (getgroups (0, 0) == -1 ? 1 : 0);
-      }
-               ],
-              jm_cv_func_working_getgroups=yes,
-              jm_cv_func_working_getgroups=no,
-              dnl When crosscompiling, assume getgroups is broken.
-              jm_cv_func_working_getgroups=no)
-    ])
-    if test $jm_cv_func_working_getgroups = no; then
-      AC_LIBOBJ(getgroups)
-      AC_DEFINE(getgroups, rpl_getgroups,
-       [Define as rpl_getgroups if getgroups doesn't work right.])
-    fi
+[
+  AC_REQUIRE([AC_FUNC_GETGROUPS])
+  AC_SUBST([GETGROUPS_LIB])
+  if test $ac_cv_func_getgroups_works = no; then
+    AC_LIBOBJ(getgroups)
+    AC_DEFINE(getgroups, rpl_getgroups,
+      [Define as rpl_getgroups if getgroups doesn't work right.])
+    gl_PREREQ_GETGROUPS
   fi
 ])
+
+# Prerequisites of lib/getgroups.c.
+AC_DEFUN([gl_PREREQ_GETGROUPS],
+[
+  AC_REQUIRE([AC_TYPE_GETGROUPS])
+])
index d19e563..d3e1114 100644 (file)
@@ -1,11 +1,22 @@
-#serial 5
+# getline.m4 serial 7
+dnl Copyright (C) 1998-2002 Free Software Foundation, Inc.
+dnl This file is free software, distributed under the terms of the GNU
+dnl General Public License.  As a special exception to the GNU General
+dnl Public License, this file may be distributed as part of a program
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+
+AC_PREREQ(2.52)
 
 dnl See if there's a working, system-supplied version of the getline function.
 dnl We can't just do AC_REPLACE_FUNCS(getline) because some systems
 dnl have a function by that name in -linet that doesn't have anything
 dnl to do with the function we need.
 AC_DEFUN([AM_FUNC_GETLINE],
-[dnl
+[
+  dnl Persuade glibc <stdio.h> to declare getline() and getdelim().
+  AC_REQUIRE([AC_GNU_SOURCE])
+
   am_getline_needs_run_time_check=no
   AC_CHECK_FUNC(getline,
                dnl Found it in some library.  Verify that it works.
@@ -16,7 +27,7 @@ AC_DEFUN([AM_FUNC_GETLINE],
     [echo fooN |tr -d '\012'|tr N '\012' > conftest.data
     AC_TRY_RUN([
 #    include <stdio.h>
-#    include <sys/types.h>
+#    include <stdlib.h>
 #    include <string.h>
     int main ()
     { /* Based on a test program from Karl Heuer.  */
@@ -36,6 +47,18 @@ AC_DEFUN([AM_FUNC_GETLINE],
   fi
 
   if test $am_cv_func_working_getline = no; then
+    dnl We must choose a different name for our function, since on ELF systems
+    dnl a broken getline() in libc.so would override our getline() in
+    dnl libgettextlib.so.
+    AC_DEFINE([getline], [gnu_getline],
+      [Define to a replacement function name for getline().])
     AC_LIBOBJ(getline)
+    gl_PREREQ_GETLINE
   fi
 ])
+
+# Prerequisites of lib/getline.c.
+AC_DEFUN([gl_PREREQ_GETLINE],
+[
+  AC_CHECK_FUNCS(getdelim)
+])
index ff8cf30..08ec014 100644 (file)
@@ -1,4 +1,4 @@
-#serial 9
+#serial 10
 
 # A replacement for autoconf's macro by the same name.  This version
 # accepts an optional argument specifying the name of the $srcdir-relative
@@ -12,7 +12,8 @@ undefine([AC_FUNC_GETLOADAVG])
 AC_DEFUN([AC_FUNC_GETLOADAVG],
 [ac_have_func=no # yes means we've found a way to get the load average.
 
-AC_CHECK_HEADERS(locale.h unistd.h mach/mach.h fcntl.h)
+AC_CHECK_HEADERS_ONCE(fcntl.h locale.h unistd.h)
+AC_CHECK_HEADERS(mach/mach.h)
 AC_CHECK_FUNCS(setlocale)
 
 # By default, expect to find getloadavg.c in $srcdir/.
@@ -106,3 +107,19 @@ LIBS=$ac_save_LIBS
 
 AC_SUBST(GETLOADAVG_LIBS)dnl
 ])# AC_FUNC_GETLOADAVG
+
+
+AC_DEFUN([gl_FUNC_GETLOADAVG],
+[
+  AC_FUNC_GETLOADAVG([lib])
+  dnl Note AC_FUNC_GETLOADAVG does AC_LIBOBJ(getloadavg).
+  if test $ac_cv_func_getloadavg = no; then
+    gl_PREREQ_GETLOADAVG
+  fi
+])
+
+# Prerequisites of lib/getloadavg.c not done by autoconf's AC_FUNC_GETLOADAVG.
+AC_DEFUN([gl_PREREQ_GETLOADAVG],
+[
+  AC_CHECK_HEADERS_ONCE(fcntl.h unistd.h)
+])
index 19ed0bf..836a4b9 100644 (file)
@@ -1,4 +1,4 @@
-#serial 2
+#serial 3
 
 dnl From Jim Meyering.
 dnl
@@ -12,7 +12,7 @@ dnl the wrapper functions that work around the problem.
 AC_DEFUN([AC_FUNC_GETTIMEOFDAY_CLOBBER],
 [
  AC_REQUIRE([AC_HEADER_TIME])
- AC_CHECK_HEADERS(string.h stdlib.h)
+ AC_CHECK_HEADERS_ONCE(stdlib.h string.h)
  AC_CACHE_CHECK([whether gettimeofday clobbers localtime buffer],
   jm_cv_func_gettimeofday_clobber,
   [AC_TRY_RUN([
@@ -65,5 +65,11 @@ main ()
       [Define to rpl_gettimeofday if the replacement function should be used.])
     AC_DEFINE(GETTIMEOFDAY_CLOBBERS_LOCALTIME_BUFFER, 1,
       [Define if gettimeofday clobbers localtime's static buffer.])
+    gl_PREREQ_GETTIMEOFDAY
   fi
 ])
+
+# Prerequisites of lib/gettimeofday.c.
+AC_DEFUN([gl_PREREQ_GETTIMEOFDAY], [
+  AC_REQUIRE([AC_HEADER_TIME])
+])
index 2a8f042..36fda49 100644 (file)
@@ -1,11 +1,24 @@
-#serial 3
+#serial 4
 
 dnl Written by Jim Meyering
 
 AC_DEFUN([jm_FUNC_GROUP_MEMBER],
-  [
-    dnl Do this replacement check manually because I want the hyphen
-    dnl (not the underscore) in the filename.
-    AC_CHECK_FUNC(group_member, , [AC_LIBOBJ(group-member)])
-  ]
-)
+[
+  dnl Persuade glibc <unistd.h> to declare group_member().
+  AC_REQUIRE([AC_GNU_SOURCE])
+
+  dnl Do this replacement check manually because I want the hyphen
+  dnl (not the underscore) in the filename.
+  AC_CHECK_FUNC(group_member, , [
+    AC_LIBOBJ(group-member)
+    gl_PREREQ_GROUP_MEMBER
+  ])
+])
+
+# Prerequisites of lib/group-member.c.
+AC_DEFUN([gl_PREREQ_GROUP_MEMBER],
+[
+  AC_REQUIRE([AC_HEADER_STDC])
+  AC_CHECK_HEADERS_ONCE(unistd.h)
+  AC_REQUIRE([AC_FUNC_GETGROUPS])
+])
index 788a16f..b2d55d0 100644 (file)
@@ -1,4 +1,4 @@
-#serial 48   -*- autoconf -*-
+#serial 49   -*- autoconf -*-
 
 dnl Misc type-related macros for fileutils, sh-utils, textutils.
 
@@ -21,7 +21,7 @@ AC_DEFUN([jm_MACROS],
   AC_REQUIRE([AC_ISC_POSIX])dnl
 
   jm_CHECK_ALL_TYPES
-  jm_INCLUDED_REGEX([lib/regex.c])
+  gl_REGEX
 
   AC_REQUIRE([UTILS_HOST_OS])
   AC_REQUIRE([UTILS_FUNC_MKDIR_TRAILING_SLASH])
@@ -39,7 +39,7 @@ AC_DEFUN([jm_MACROS],
   AC_REQUIRE([jm_FUNC_LCHOWN])
   AC_REQUIRE([fetish_FUNC_RMDIR_NOTEMPTY])
   AC_REQUIRE([jm_FUNC_CHOWN])
-  AC_REQUIRE([jm_FUNC_MKTIME])
+  AC_REQUIRE([gl_FUNC_MKTIME])
   AC_REQUIRE([jm_FUNC_LSTAT])
   AC_REQUIRE([AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])
   AC_REQUIRE([jm_FUNC_STAT])
@@ -59,7 +59,6 @@ AC_DEFUN([jm_MACROS],
   AC_REQUIRE([jm_AC_FUNC_LINK_FOLLOWS_SYMLINK])
   AC_REQUIRE([AC_FUNC_ERROR_AT_LINE])
   AC_REQUIRE([jm_FUNC_GNU_STRFTIME])
-  AC_REQUIRE([jm_FUNC_MKTIME])
   AC_REQUIRE([jm_FUNC_FPENDING])
 
   AC_REQUIRE([jm_FUNC_GETGROUPS])
index 9e4fb6f..e0875fc 100644 (file)
@@ -1,4 +1,4 @@
-#serial 2
+#serial 3
 
 dnl From Jim Meyering.
 dnl Provide lchown on systems that lack it.
@@ -7,4 +7,14 @@ AC_DEFUN([jm_FUNC_LCHOWN],
 [
   AC_REQUIRE([AC_TYPE_UID_T])
   AC_REPLACE_FUNCS(lchown)
+  if test $ac_cv_func_lchown = no; then
+    gl_PREREQ_LCHOWN
+  fi
+])
+
+# Prerequisites of lib/lchown.c.
+AC_DEFUN([gl_PREREQ_LCHOWN],
+[
+  AC_REQUIRE([AC_HEADER_STAT])
+  :
 ])
index daa95c0..c5d44f3 100644 (file)
@@ -1,4 +1,4 @@
-#serial 2
+#serial 3
 
 dnl From Paul Eggert.
 
@@ -17,19 +17,3 @@ AC_DEFUN([jm_AC_TYPE_LONG_LONG],
       [Define if you have the long long type.])
   fi
 ])
-
-# Define HAVE_UNSIGNED_LONG_LONG if 'unsigned long long' works.
-
-AC_DEFUN([jm_AC_TYPE_UNSIGNED_LONG_LONG],
-[
-  AC_CACHE_CHECK([for unsigned long long], ac_cv_type_unsigned_long_long,
-  [AC_TRY_LINK([unsigned long long ull = 1; int i = 63;],
-    [unsigned long long ullmax = (unsigned long long) -1;
-     return ull << i | ull >> i | ullmax / ull | ullmax % ull;],
-    ac_cv_type_unsigned_long_long=yes,
-    ac_cv_type_unsigned_long_long=no)])
-  if test $ac_cv_type_unsigned_long_long = yes; then
-    AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1,
-      [Define if you have the unsigned long long type.])
-  fi
-])
index 54ae7d9..e8a5656 100644 (file)
@@ -1,4 +1,4 @@
-#serial 11
+#serial 12
 
 dnl From Jim Meyering.
 dnl
@@ -10,7 +10,8 @@ dnl
 AC_DEFUN([jm_LIST_MOUNTED_FILESYSTEMS],
   [
 AC_CHECK_FUNCS(listmntent getmntinfo)
-AC_CHECK_HEADERS(mntent.h sys/param.h sys/ucred.h sys/mount.h sys/fs_types.h)
+AC_CHECK_HEADERS_ONCE(sys/param.h)
+AC_CHECK_HEADERS(mntent.h sys/ucred.h sys/mount.h sys/fs_types.h)
     getfsstat_includes="\
 $ac_includes_default
 #if HAVE_SYS_PARAM_H
@@ -63,7 +64,7 @@ yes
     ac_list_mounted_fs=found
     AC_DEFINE(MOUNTED_LISTMNTENT, 1,
       [Define if there is a function named listmntent that can be used to
-   list all mounted filesystems. (UNICOS)])
+       list all mounted filesystems. (UNICOS)])
   fi
 fi
 
@@ -100,9 +101,9 @@ if test $ac_cv_func_getmntent = yes; then
     if test $fu_cv_sys_mounted_getmntent1 = yes; then
       ac_list_mounted_fs=found
       AC_DEFINE(MOUNTED_GETMNTENT1, 1,
-  [Define if there is a function named getmntent for reading the list
-   of mounted filesystems, and that function takes a single argument.
-   (4.3BSD, SunOS, HP-UX, Dynix, Irix)])
+        [Define if there is a function named getmntent for reading the list
+         of mounted filesystems, and that function takes a single argument.
+         (4.3BSD, SunOS, HP-UX, Dynix, Irix)])
     fi
   fi
 
@@ -117,8 +118,8 @@ if test $ac_cv_func_getmntent = yes; then
     if test $fu_cv_sys_mounted_getmntent2 = yes; then
       ac_list_mounted_fs=found
       AC_DEFINE(MOUNTED_GETMNTENT2, 1,
-  [Define if there is a function named getmntent for reading the list of
-   mounted filesystems, and that function takes two arguments.  (SVR4)])
+        [Define if there is a function named getmntent for reading the list of
+         mounted filesystems, and that function takes two arguments.  (SVR4)])
     fi
   fi
 
@@ -149,7 +150,7 @@ if test -z "$ac_list_mounted_fs"; then
     ac_list_mounted_fs=found
     AC_DEFINE(MOUNTED_GETFSSTAT, 1,
              [Define if there is a function named getfsstat for reading the
-   list of mounted filesystems.  (DEC Alpha running OSF/1)])
+               list of mounted filesystems.  (DEC Alpha running OSF/1)])
   fi
 fi
 
@@ -165,8 +166,8 @@ if test -z "$ac_list_mounted_fs"; then
     ac_list_mounted_fs=found
     AC_DEFINE(MOUNTED_VMOUNT, 1,
        [Define if there is a function named mntctl that can be used to read
-   the list of mounted filesystems, and there is a system header file
-   that declares `struct vmount.'  (AIX)])
+         the list of mounted filesystems, and there is a system header file
+         that declares `struct vmount.'  (AIX)])
   fi
 fi
 
@@ -184,9 +185,9 @@ if test -z "$ac_list_mounted_fs"; then
   if test $fu_cv_sys_mounted_fread_fstyp = yes; then
     ac_list_mounted_fs=found
     AC_DEFINE(MOUNTED_FREAD_FSTYP, 1,
-[Define if (like SVR2) there is no specific function for reading the
-   list of mounted filesystems, and your system has these header files:
-   <sys/fstyp.h> and <sys/statfs.h>.  (SVR3)])
+      [Define if (like SVR2) there is no specific function for reading the
+       list of mounted filesystems, and your system has these header files:
+       <sys/fstyp.h> and <sys/statfs.h>.  (SVR3)])
   fi
 fi
 
@@ -204,7 +205,7 @@ if test -z "$ac_list_mounted_fs"; then
     ac_list_mounted_fs=found
     AC_DEFINE(MOUNTED_GETMNTINFO, 1,
              [Define if there is a function named getmntinfo for reading the
-   list of mounted filesystems.  (4.4BSD, Darwin)])
+               list of mounted filesystems.  (4.4BSD, Darwin)])
   fi
 fi
 
@@ -222,7 +223,7 @@ if test -z "$ac_list_mounted_fs"; then
     ac_list_mounted_fs=found
     AC_DEFINE(MOUNTED_GETMNT, 1,
       [Define if there is a function named getmnt for reading the list of
-   mounted filesystems.  (Ultrix)])
+       mounted filesystems.  (Ultrix)])
   fi
 fi
 
@@ -243,7 +244,7 @@ if test -z "$ac_list_mounted_fs"; then
     ac_list_mounted_fs=found
     AC_DEFINE(MOUNTED_FS_STAT_DEV, 1,
       [Define if there are functions named next_dev and fs_stat_dev for
-   reading the list of mounted filesystems.  (BeOS)])
+       reading the list of mounted filesystems.  (BeOS)])
   fi
 fi
 
@@ -259,7 +260,8 @@ if test -z "$ac_list_mounted_fs"; then
     ac_list_mounted_fs=found
     AC_DEFINE(MOUNTED_FREAD, 1,
              [Define if there is no specific function for reading the list of
-   mounted filesystems.  fread will be used to read /etc/mnttab.  (SVR2) ])
+               mounted filesystems.  fread will be used to read /etc/mnttab.
+               (SVR2) ])
   fi
 fi
 
index 8ef73b3..1544027 100644 (file)
@@ -1,4 +1,4 @@
-#serial 7
+#serial 8
 
 dnl From Jim Meyering.
 dnl Determine whether lstat has the bug that it succeeds when given the
@@ -11,30 +11,17 @@ dnl
 
 AC_DEFUN([jm_FUNC_LSTAT],
 [
- AC_REQUIRE([AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])
- AC_CACHE_CHECK([whether lstat accepts an empty string],
-  jm_cv_func_lstat_empty_string_bug,
-  [AC_TRY_RUN([
-#   include <sys/types.h>
-#   include <sys/stat.h>
-
-    int
-    main ()
-    {
-      struct stat sbuf;
-      exit (lstat ("", &sbuf) ? 1 : 0);
-    }
-         ],
-        jm_cv_func_lstat_empty_string_bug=yes,
-        jm_cv_func_lstat_empty_string_bug=no,
-        dnl When crosscompiling, assume lstat is broken.
-        jm_cv_func_lstat_empty_string_bug=yes)
-  ])
-  if test $jm_cv_func_lstat_empty_string_bug = yes; then
-    AC_LIBOBJ(lstat)
-    AC_DEFINE(HAVE_LSTAT_EMPTY_STRING_BUG, 1,
-[Define if lstat has the bug that it succeeds when given the zero-length
-   file name argument.  The lstat from SunOS4.1.4 and the Hurd as of 1998-11-01)
-   do this. ])
+  AC_FUNC_LSTAT
+  dnl Note: AC_FUNC_LSTAT does AC_LIBOBJ(lstat).
+  if test $ac_cv_func_lstat_empty_string_bug = yes; then
+    gl_PREREQ_LSTAT
   fi
 ])
+
+# Prerequisites of lib/lstat.c.
+AC_DEFUN([gl_PREREQ_LSTAT],
+[
+  AC_REQUIRE([AC_HEADER_STAT])
+  AC_CHECK_HEADERS_ONCE(stdlib.h)
+  AC_CHECK_DECLS_ONCE(free)
+])
index cb5cff3..2452acf 100644 (file)
@@ -1,35 +1,25 @@
-#serial 6
+# malloc.m4 serial 7
+dnl Copyright (C) 2002 Free Software Foundation, Inc.
+dnl This file is free software, distributed under the terms of the GNU
+dnl General Public License.  As a special exception to the GNU General
+dnl Public License, this file may be distributed as part of a program
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
 
 dnl From Jim Meyering.
 dnl Determine whether malloc accepts 0 as its argument.
 dnl If it doesn't, arrange to use the replacement function.
-dnl
 
 AC_DEFUN([jm_FUNC_MALLOC],
 [
- dnl xmalloc.c requires that this symbol be defined so it doesn't
- dnl mistakenly use a broken malloc -- as it might if this test were omitted.
- AC_DEFINE(HAVE_DONE_WORKING_MALLOC_CHECK, 1,
-           [Define if the malloc check has been performed. ])
-
- AC_CACHE_CHECK([whether malloc(0) returns a non-NULL pointer],
-                jm_cv_func_working_malloc,
-  [AC_TRY_RUN([
-    char *malloc ();
-    int
-    main ()
-    {
-      exit (malloc (0) ? 0 : 1);
-    }
-         ],
-        jm_cv_func_working_malloc=yes,
-        jm_cv_func_working_malloc=no,
-        dnl When crosscompiling, assume malloc(0) returns NULL.
-        jm_cv_func_working_malloc=no)
-  ])
-  if test $jm_cv_func_working_malloc = no; then
-    AC_LIBOBJ(malloc)
-    AC_DEFINE(malloc, rpl_malloc,
-      [Define to rpl_malloc if the replacement function should be used.])
+  AC_REQUIRE([AC_FUNC_MALLOC])
+  dnl autoconf < 2.57 used the symbol ac_cv_func_malloc_works.
+  if test X"$ac_cv_func_malloc_0_nonnull" = Xno || test X"$ac_cv_func_malloc_works" = Xno; then
+    gl_PREREQ_MALLOC
   fi
 ])
+
+# Prerequisites of lib/malloc.c.
+AC_DEFUN([gl_PREREQ_MALLOC], [
+  :
+])
index 0379847..21e9daa 100644 (file)
@@ -1,4 +1,4 @@
-# mbrtowc.m4 serial 4 (fileutils-4.1.3)
+# mbrtowc.m4 serial 5
 dnl Copyright (C) 2001-2002 Free Software Foundation, Inc.
 dnl This file is free software, distributed under the terms of the GNU
 dnl General Public License.  As a special exception to the GNU General
@@ -8,6 +8,9 @@ dnl the same distribution terms as the rest of that program.
 
 dnl From Paul Eggert
 
+dnl This file can be removed, and jm_FUNC_MBRTOWC replaced with
+dnl AC_FUNC_MBRTOWC, when autoconf 2.57 can be assumed everywhere.
+
 AC_DEFUN([jm_FUNC_MBRTOWC],
 [
   AC_CACHE_CHECK([whether mbrtowc and mbstate_t are properly declared],
index 158653c..d7981ca 100644 (file)
@@ -1,12 +1,13 @@
-#serial 8
+#serial 9
 
 dnl autoconf tests required for use of mbswidth.c
 dnl From Bruno Haible.
 
-AC_DEFUN([jm_PREREQ_MBSWIDTH],
+AC_DEFUN([gl_MBSWIDTH],
 [
-  AC_CHECK_HEADERS(wchar.h wctype.h)
-  AC_CHECK_FUNCS(isascii iswcntrl iswprint mbsinit wcwidth)
+  AC_CHECK_HEADERS_ONCE(wchar.h wctype.h)
+  AC_CHECK_FUNCS_ONCE(isascii iswprint mbsinit)
+  AC_CHECK_FUNCS(iswcntrl wcwidth)
   jm_FUNC_MBRTOWC
 
   AC_CACHE_CHECK([whether wcwidth is declared], ac_cv_have_decl_wcwidth,
index 1de3409..4442e47 100644 (file)
@@ -1,9 +1,22 @@
-#serial 7
+# memcmp.m4 serial 8
+dnl Copyright (C) 2002 Free Software Foundation, Inc.
+dnl This file is free software, distributed under the terms of the GNU
+dnl General Public License.  As a special exception to the GNU General
+dnl Public License, this file may be distributed as part of a program
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
 
 AC_DEFUN([jm_FUNC_MEMCMP],
-[AC_REQUIRE([AC_FUNC_MEMCMP])dnl
- if test $ac_cv_func_memcmp_working = no; then
-   AC_DEFINE(memcmp, rpl_memcmp,
-     [Define to rpl_memcmp if the replacement function should be used.])
- fi
+[
+  AC_REQUIRE([AC_FUNC_MEMCMP])
+  if test $ac_cv_func_memcmp_working = no; then
+    AC_DEFINE(memcmp, rpl_memcmp,
+      [Define to rpl_memcmp if the replacement function should be used.])
+    gl_PREREQ_MEMCMP
+  fi
+])
+
+# Prerequisites of lib/memcmp.c.
+AC_DEFUN([gl_PREREQ_MEMCMP], [
+  AC_CHECK_HEADERS_ONCE(string.h)
 ])
index 18f835a..3ca909e 100644 (file)
@@ -1,4 +1,4 @@
-#serial 1
+#serial 2
 
 # On some systems, mkdir ("foo/", 0700) fails because of the trailing slash.
 # On such systems, arrange to use a wrapper function that removes any
@@ -31,5 +31,13 @@ AC_DEFUN([UTILS_FUNC_MKDIR_TRAILING_SLASH],
     AC_LIBOBJ(mkdir)
     AC_DEFINE(mkdir, rpl_mkdir,
       [Define to rpl_mkdir if the replacement function should be used.])
+    gl_PREREQ_MKDIR
   fi
 ])
+
+# Prerequisites of lib/mkdir.c.
+AC_DEFUN([gl_PREREQ_MKDIR],
+[
+  AC_CHECK_HEADERS_ONCE(stdlib.h string.h)
+  AC_CHECK_DECLS_ONCE(free)
+])
index a5efede..d36daa0 100644 (file)
@@ -1,4 +1,4 @@
-#serial 1
+#serial 2
 
 # On some systems (e.g., HPUX-10.20, SunOS4.1.4, solaris2.5.1), mkstemp has the
 # silly limit that it can create no more than 26 files from a given template.
@@ -42,5 +42,24 @@ AC_DEFUN([UTILS_FUNC_MKSTEMP],
     AC_LIBOBJ(tempname)
     AC_DEFINE(mkstemp, rpl_mkstemp,
       [Define to rpl_mkstemp if the replacement function should be used.])
+    gl_PREREQ_MKSTEMP
+    jm_PREREQ_TEMPNAME
   fi
 ])
+
+# Prerequisites of lib/mkstemp.c.
+AC_DEFUN([gl_PREREQ_MKSTEMP],
+[
+])
+
+# Prerequisites of lib/tempname.c.
+AC_DEFUN([jm_PREREQ_TEMPNAME],
+[
+  AC_REQUIRE([AC_HEADER_STDC])
+  AC_REQUIRE([AC_HEADER_STAT])
+  AC_CHECK_HEADERS_ONCE(fcntl.h sys/time.h unistd.h)
+  AC_CHECK_HEADERS(stdint.h)
+  AC_CHECK_FUNCS(__secure_getenv gettimeofday)
+  AC_CHECK_DECLS_ONCE(getenv)
+  AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
+])
index b431456..bfe8d57 100644 (file)
@@ -1,4 +1,4 @@
-#serial 8
+#serial 9
 
 dnl From Jim Meyering.
 dnl Check for the nanosleep function.
@@ -18,6 +18,7 @@ AC_DEFUN([jm_FUNC_NANOSLEEP],
   jm_cv_func_nanosleep_works,
   [
    AC_REQUIRE([AC_HEADER_TIME])
+   AC_CHECK_HEADERS_ONCE(sys/time.h)
    AC_TRY_RUN([
 #   if TIME_WITH_SYS_TIME
 #    include <sys/time.h>
@@ -48,7 +49,14 @@ AC_DEFUN([jm_FUNC_NANOSLEEP],
     AC_LIBOBJ(nanosleep)
     AC_DEFINE(nanosleep, rpl_nanosleep,
       [Define to rpl_nanosleep if the replacement function should be used.])
+    gl_PREREQ_NANOSLEEP
   fi
 
  LIBS=$nanosleep_save_libs
 ])
+
+# Prerequisites of lib/nanosleep.c.
+AC_DEFUN([gl_PREREQ_NANOSLEEP],
+[
+  AC_CHECK_HEADERS_ONCE(unistd.h)
+])
index 6b26058..3c5d16a 100644 (file)
-#serial 26
+#serial 27
 
 dnl These are the prerequisite macros for files in the lib/
 dnl directories of the fileutils, sh-utils, and textutils packages.
 
 AC_DEFUN([jm_PREREQ],
 [
-  jm_PREREQ_ADDEXT
+  gl_BACKUPFILE
   jm_PREREQ_C_STACK
-  jm_PREREQ_CANON_HOST
-  jm_PREREQ_DIRNAME
+  gl_CANON_HOST
+  gl_DIRNAME
   jm_PREREQ_ERROR
-  jm_PREREQ_EXCLUDE
-  jm_PREREQ_GETPAGESIZE
-  jm_PREREQ_HARD_LOCALE
-  jm_PREREQ_HASH
-  jm_PREREQ_HUMAN
-  jm_PREREQ_MBSWIDTH
-  jm_PREREQ_MEMCHR
-  jm_PREREQ_PHYSMEM
-  jm_PREREQ_POSIXVER
-  jm_PREREQ_QUOTEARG
-  jm_PREREQ_READUTMP
-  jm_PREREQ_REGEX
+  gl_EXCLUDE
+  gl_GETPAGESIZE
+  gl_HARD_LOCALE
+  gl_HASH
+  gl_HUMAN
+  gl_MBSWIDTH
+  gl_FUNC_MEMCHR
+  gl_PHYSMEM
+  gl_POSIXVER
+  gl_QUOTEARG
+  gl_READUTMP
+  gl_REGEX
   jm_PREREQ_STAT
-  jm_PREREQ_STRNLEN
-  jm_PREREQ_TEMPNAME # called by mkstemp
-  jm_PREREQ_XGETCWD
-  jm_PREREQ_XREADLINK
-])
-
-AC_DEFUN([jm_PREREQ_ADDEXT],
-[
-  dnl For addext.c.
-  AC_SYS_LONG_FILE_NAMES
-  AC_CHECK_FUNCS(pathconf)
-  AC_CHECK_HEADERS(limits.h string.h unistd.h)
-])
-
-AC_DEFUN([jm_PREREQ_CANON_HOST],
-[
-  dnl Add any libraries as early as possible.
-  dnl In particular, inet_ntoa needs -lnsl at least on Solaris5.5.1,
-  dnl so we have to add -lnsl to LIBS before checking for that function.
-  AC_SEARCH_LIBS(gethostbyname, [inet nsl])
-
-  dnl These come from -lnsl on Solaris5.5.1.
-  AC_CHECK_FUNCS(gethostbyname gethostbyaddr inet_ntoa)
-
-  AC_CHECK_FUNCS(gethostbyname gethostbyaddr inet_ntoa)
-  AC_CHECK_HEADERS(unistd.h string.h netdb.h sys/socket.h \
-                   netinet/in.h arpa/inet.h)
-])
-
-AC_DEFUN([jm_PREREQ_DIRNAME],
-[
-  AC_HEADER_STDC
-  AC_CHECK_HEADERS(string.h)
-])
-
-AC_DEFUN([jm_PREREQ_EXCLUDE],
-[
-  AC_FUNC_FNMATCH_GNU
-  AC_HEADER_STDBOOL
-])
-
-AC_DEFUN([jm_PREREQ_GETPAGESIZE],
-[
-  AC_CHECK_FUNCS(getpagesize)
-  AC_CHECK_HEADERS(OS.h unistd.h)
-])
-
-AC_DEFUN([jm_PREREQ_HARD_LOCALE],
-[
-  AC_CHECK_HEADERS(locale.h stdlib.h string.h)
-  AC_CHECK_FUNCS(setlocale)
-  AM_C_PROTOTYPES
-])
-
-AC_DEFUN([jm_PREREQ_HASH],
-[
-  AC_CHECK_HEADERS(stdlib.h)
-  AC_HEADER_STDBOOL
-  AC_REQUIRE([jm_CHECK_DECLS])
-])
-
-# If you use human.c, you need the following files:
-# inttypes.m4 ulonglong.m4
-AC_DEFUN([jm_PREREQ_HUMAN],
-[
-  AC_CHECK_HEADERS(limits.h stdlib.h string.h)
-  AC_CHECK_DECLS([getenv])
-  AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
-])
-
-AC_DEFUN([jm_PREREQ_MEMCHR],
-[
-  AC_CHECK_HEADERS(limits.h stdlib.h bp-sym.h)
-])
-
-AC_DEFUN([jm_PREREQ_PHYSMEM],
-[
-  AC_CHECK_HEADERS(sys/pstat.h unistd.h)
-  AC_CHECK_FUNCS(pstat_getstatic pstat_getdynamic)
-])
-
-AC_DEFUN([jm_PREREQ_POSIXVER],
-[
-  AC_CHECK_HEADERS(unistd.h)
-  AC_CHECK_DECLS([getenv])
-])
-
-AC_DEFUN([jm_PREREQ_QUOTEARG],
-[
-  AC_CHECK_FUNCS(isascii iswprint)
-  jm_FUNC_MBRTOWC
-  AC_CHECK_HEADERS(limits.h stddef.h stdlib.h string.h wchar.h wctype.h)
-  AC_HEADER_STDC
-  AC_C_BACKSLASH_A
-  AC_TYPE_MBSTATE_T
-  AM_C_PROTOTYPES
-])
-
-AC_DEFUN([jm_PREREQ_READUTMP],
-[
-  AC_HEADER_STDC
-  AC_CHECK_HEADERS(string.h utmp.h utmpx.h sys/param.h)
-  AC_CHECK_FUNCS(utmpname)
-  AC_CHECK_FUNCS(utmpxname)
-  AM_C_PROTOTYPES
-
-  if test $ac_cv_header_utmp_h = yes || test $ac_cv_header_utmpx_h = yes; then
-    utmp_includes="\
-$ac_includes_default
-#ifdef HAVE_UTMPX_H
-# include <utmpx.h>
-#endif
-#ifdef HAVE_UTMP_H
-# include <utmp.h>
-#endif
-"
-    AC_CHECK_MEMBERS([struct utmpx.ut_user],,,[$utmp_includes])
-    AC_CHECK_MEMBERS([struct utmp.ut_user],,,[$utmp_includes])
-    AC_CHECK_MEMBERS([struct utmpx.ut_name],,,[$utmp_includes])
-    AC_CHECK_MEMBERS([struct utmp.ut_name],,,[$utmp_includes])
-    AC_CHECK_MEMBERS([struct utmpx.ut_type],,,[$utmp_includes])
-    AC_CHECK_MEMBERS([struct utmp.ut_type],,,[$utmp_includes])
-    AC_CHECK_MEMBERS([struct utmpx.ut_pid],,,[$utmp_includes])
-    AC_CHECK_MEMBERS([struct utmp.ut_pid],,,[$utmp_includes])
-    AC_CHECK_MEMBERS([struct utmpx.ut_id],,,[$utmp_includes])
-    AC_CHECK_MEMBERS([struct utmp.ut_id],,,[$utmp_includes])
-    AC_CHECK_MEMBERS([struct utmpx.ut_exit],,,[$utmp_includes])
-    AC_CHECK_MEMBERS([struct utmp.ut_exit],,,[$utmp_includes])
-    AC_LIBOBJ(readutmp)
-  fi
-])
-
-AC_DEFUN([jm_PREREQ_REGEX],
-[
-  dnl FIXME: Maybe provide a btowc replacement someday: solaris-2.5.1 lacks it.
-  dnl FIXME: Check for wctype and iswctype, and and add -lw if necessary
-  dnl to get them.
-  AC_CHECK_FUNCS(bzero bcopy isascii btowc)
-  AC_CHECK_HEADERS(alloca.h libintl.h wctype.h wchar.h)
-  AC_HEADER_STDC
-  AC_FUNC_ALLOCA
+  gl_FUNC_STRNLEN
+  gl_XGETCWD
+  gl_XREADLINK
 ])
 
 AC_DEFUN([jm_PREREQ_STAT],
@@ -199,40 +61,3 @@ $ac_includes_default
   AC_CHECK_MEMBERS([struct statfs.f_namelen],,,[$statxfs_includes])
   AC_CHECK_MEMBERS([struct statvfs.f_namelen],,,[$statxfs_includes])
 ])
-
-AC_DEFUN([jm_PREREQ_STRNLEN],
-[
-  AC_FUNC_STRNLEN
-  AC_HEADER_STDC
-  AC_CHECK_HEADERS(memory.h)
-  AC_CHECK_DECLS([memchr])
-
-  # This is necessary because automake-1.6.1 doens't understand
-  # that the above use of AC_FUNC_STRNLEN means we may have to use
-  # lib/strnlen.c.
-  test $ac_cv_func_strnlen_working = yes \
-    && AC_LIBOBJ(strnlen)
-])
-
-AC_DEFUN([jm_PREREQ_TEMPNAME],
-[
-  AC_HEADER_STDC
-  AC_HEADER_STAT
-  AC_CHECK_HEADERS(fcntl.h sys/time.h stdint.h unistd.h)
-  AC_CHECK_FUNCS(__secure_getenv gettimeofday)
-  AC_CHECK_DECLS([getenv])
-])
-
-AC_DEFUN([jm_PREREQ_XGETCWD],
-[
-  AC_C_PROTOTYPES
-  AC_CHECK_HEADERS(limits.h stdlib.h sys/param.h unistd.h)
-  AC_CHECK_FUNCS(getcwd)
-  AC_FUNC_GETCWD_NULL
-])
-
-AC_DEFUN([jm_PREREQ_XREADLINK],
-[
-  AC_C_PROTOTYPES
-  AC_CHECK_HEADERS(limits.h stdlib.h sys/types.h unistd.h)
-])
index 39a6e75..5a7aa4c 100644 (file)
@@ -1,10 +1,15 @@
-#serial 5
+# putenv.m4 serial 6
+dnl Copyright (C) 2002 Free Software Foundation, Inc.
+dnl This file is free software, distributed under the terms of the GNU
+dnl General Public License.  As a special exception to the GNU General
+dnl Public License, this file may be distributed as part of a program
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
 
 dnl From Jim Meyering.
 dnl
 dnl Check whether putenv ("FOO") removes FOO from the environment.
 dnl The putenv in libc on at least SunOS 4.1.4 does *not* do that.
-dnl
 
 AC_DEFUN([jm_FUNC_PUTENV],
 [AC_CACHE_CHECK([for SVID conformant putenv], jm_cv_func_svid_putenv,
@@ -36,5 +41,13 @@ AC_DEFUN([jm_FUNC_PUTENV],
     AC_LIBOBJ(putenv)
     AC_DEFINE(putenv, rpl_putenv,
       [Define to rpl_putenv if the replacement function should be used.])
+    gl_PREREQ_PUTENV
   fi
 ])
+
+# Prerequisites of lib/putenv.c.
+AC_DEFUN([gl_PREREQ_PUTENV], [
+  AC_CHECK_HEADERS_ONCE(string.h unistd.h)
+  AC_CHECK_FUNCS_ONCE(memcpy)
+  AC_CHECK_FUNCS(strchr)
+])
index 03ac331..2c4bbab 100644 (file)
@@ -1,4 +1,4 @@
-#serial 4
+#serial 5
 
 dnl SunOS's readdir is broken in such a way that rm.c has to add extra code
 dnl to test whether a NULL return value really means there are no more files
@@ -15,7 +15,7 @@ dnl Written by Jim Meyering.
 AC_DEFUN([jm_FUNC_READDIR],
 [dnl
 AC_REQUIRE([AC_HEADER_DIRENT])
-AC_CHECK_HEADERS(string.h)
+AC_CHECK_HEADERS_ONCE(string.h)
 AC_CACHE_CHECK([for working readdir], jm_cv_func_working_readdir,
   [dnl
   # Arrange for deletion of the temporary directory this test creates, in
@@ -127,6 +127,6 @@ AC_CACHE_CHECK([for working readdir], jm_cv_func_working_readdir,
 
   if test $jm_cv_func_working_readdir = yes; then
     AC_DEFINE(HAVE_WORKING_READDIR, 1,
-[Define if readdir is found to work properly in some unusual cases. ])
+      [Define if readdir is found to work properly in some unusual cases. ])
   fi
 ])
index 7695e89..9f746f1 100644 (file)
@@ -1,35 +1,25 @@
-#serial 6
+# realloc.m4 serial 7
+dnl Copyright (C) 2002 Free Software Foundation, Inc.
+dnl This file is free software, distributed under the terms of the GNU
+dnl General Public License.  As a special exception to the GNU General
+dnl Public License, this file may be distributed as part of a program
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
 
 dnl From Jim Meyering.
 dnl Determine whether realloc works when both arguments are 0.
 dnl If it doesn't, arrange to use the replacement function.
-dnl
 
 AC_DEFUN([jm_FUNC_REALLOC],
 [
- dnl xmalloc.c requires that this symbol be defined so it doesn't
- dnl mistakenly use a broken realloc -- as it might if this test were omitted.
- AC_DEFINE(HAVE_DONE_WORKING_REALLOC_CHECK, 1,
-           [Define if the realloc check has been performed. ])
-
- AC_CACHE_CHECK([whether realloc(0,0) returns a non-NULL pointer],
-                jm_cv_func_working_realloc,
-  [AC_TRY_RUN([
-    char *realloc ();
-    int
-    main ()
-    {
-      exit (realloc (0, 0) ? 0 : 1);
-    }
-         ],
-        jm_cv_func_working_realloc=yes,
-        jm_cv_func_working_realloc=no,
-        dnl When crosscompiling, assume realloc(0,0) returns NULL.
-        jm_cv_func_working_realloc=no)
-  ])
-  if test $jm_cv_func_working_realloc = no; then
-    AC_LIBOBJ(realloc)
-    AC_DEFINE(realloc, rpl_realloc,
-      [Define to rpl_realloc if the replacement function should be used.])
+  AC_REQUIRE([AC_FUNC_REALLOC])
+  dnl autoconf < 2.57 used the symbol ac_cv_func_realloc_works.
+  if test X"$ac_cv_func_realloc_0_nonnull" = Xno || test X"$ac_cv_func_realloc_works" = Xno; then
+    gl_PREREQ_REALLOC
   fi
 ])
+
+# Prerequisites of lib/realloc.c.
+AC_DEFUN([gl_PREREQ_REALLOC], [
+  :
+])
index 0017507..d80eafb 100644 (file)
@@ -1,8 +1,13 @@
-#serial 12
+#serial 13
 
 dnl Initially derived from code in GNU grep.
 dnl Mostly written by Jim Meyering.
 
+AC_DEFUN([gl_REGEX],
+[
+  jm_INCLUDED_REGEX([lib/regex.c])
+])
+
 dnl Usage: jm_INCLUDED_REGEX([lib/regex.c])
 dnl
 AC_DEFUN([jm_INCLUDED_REGEX],
@@ -74,8 +79,26 @@ AC_DEFUN([jm_INCLUDED_REGEX],
                    jm_with_regex=$ac_use_included_regex)
        if test "$jm_with_regex" = yes; then
          AC_LIBOBJ(regex)
+         jm_PREREQ_REGEX
        fi
       ],
     )
   ]
 )
+
+# Prerequisites of lib/regex.c.
+AC_DEFUN([jm_PREREQ_REGEX],
+[
+  dnl FIXME: Maybe provide a btowc replacement someday: solaris-2.5.1 lacks it.
+  dnl FIXME: Check for wctype and iswctype, and and add -lw if necessary
+  dnl to get them.
+
+  dnl Persuade glibc <string.h> to declare mempcpy().
+  AC_REQUIRE([AC_GNU_SOURCE])
+
+  AC_REQUIRE([AC_FUNC_ALLOCA])
+  AC_REQUIRE([AC_HEADER_STDC])
+  AC_CHECK_HEADERS_ONCE(limits.h string.h wchar.h wctype.h)
+  AC_CHECK_FUNCS_ONCE(isascii mempcpy)
+  AC_CHECK_FUNCS(btowc)
+])
index 4ce7f47..5c1e1ce 100644 (file)
@@ -1,4 +1,4 @@
-#serial 3
+#serial 4
 
 dnl From Volker Borchert.
 dnl Determine whether rename works for source paths with a trailing slash.
@@ -34,7 +34,15 @@ AC_DEFUN([vb_FUNC_RENAME],
   if test $vb_cv_func_rename_trailing_slash_bug = yes; then
     AC_LIBOBJ(rename)
     AC_DEFINE(RENAME_TRAILING_SLASH_BUG, 1,
-[Define if rename does not work for source paths with a trailing slash,
-   like the one from SunOS 4.1.1_U1.])
+      [Define if rename does not work for source paths with a trailing slash,
+       like the one from SunOS 4.1.1_U1.])
+    gl_PREREQ_RENAME
   fi
 ])
+
+# Prerequisites of lib/rename.c.
+AC_DEFUN([gl_PREREQ_RENAME],
+[
+  AC_CHECK_HEADERS_ONCE(stdlib.h string.h)
+  AC_CHECK_DECLS_ONCE(free)
+])
index 832193b..af621ec 100644 (file)
@@ -1,4 +1,4 @@
-# setenv.m4 serial 2 (gettext-0.11.1)
+# setenv.m4 serial 3
 dnl Copyright (C) 2001-2002 Free Software Foundation, Inc.
 dnl This file is free software, distributed under the terms of the GNU
 dnl General Public License.  As a special exception to the GNU General
@@ -6,11 +6,22 @@ dnl Public License, this file may be distributed as part of a program
 dnl that contains a configuration script generated by Autoconf, under
 dnl the same distribution terms as the rest of that program.
 
+AC_DEFUN([gt_FUNC_SETENV],
+[
+  AC_REPLACE_FUNCS(setenv unsetenv)
+  if test $ac_cv_func_setenv = no; then
+    gl_PREREQ_SETENV
+  fi
+  if test $ac_cv_func_unsetenv = no; then
+    gl_PREREQ_UNSETENV
+  fi
+])
+
 # Check if a variable is properly declared.
 # gt_CHECK_VAR_DECL(includes,variable)
 AC_DEFUN([gt_CHECK_VAR_DECL],
 [
-  define(gt_cv_var, [gt_cv_var_]$2[_declaration])
+  define([gt_cv_var], [gt_cv_var_]$2[_declaration])
   AC_MSG_CHECKING([if $2 is properly declared])
   AC_CACHE_VAL(gt_cv_var, [
     AC_TRY_COMPILE([$1
@@ -25,13 +36,21 @@ AC_DEFUN([gt_CHECK_VAR_DECL],
   fi
 ])
 
-# Prerequisites of lib/setenv.c
-
-AC_DEFUN([gt_FUNC_SETENV],
+# Prerequisites of lib/setenv.c.
+AC_DEFUN([gl_PREREQ_SETENV],
 [
-  AC_REPLACE_FUNCS(setenv unsetenv)
-  AC_CHECK_HEADERS(search.h stdlib.h string.h unistd.h)
+  AC_REQUIRE([AC_FUNC_ALLOCA])
+  AC_CHECK_HEADERS_ONCE(stdlib.h string.h unistd.h)
+  AC_CHECK_HEADERS(search.h)
   AC_CHECK_FUNCS(tsearch)
   gt_CHECK_VAR_DECL([#include <errno.h>], errno)
   gt_CHECK_VAR_DECL([#include <unistd.h>], environ)
 ])
+
+# Prerequisites of lib/unsetenv.c.
+AC_DEFUN([gl_PREREQ_UNSETENV],
+[
+  AC_CHECK_HEADERS_ONCE(stdlib.h string.h unistd.h)
+  gt_CHECK_VAR_DECL([#include <errno.h>], errno)
+  gt_CHECK_VAR_DECL([#include <unistd.h>], environ)
+])
index e9342cf..4d03c8e 100644 (file)
@@ -1,4 +1,4 @@
-#serial 5
+#serial 6
 
 dnl From Paul Eggert.
 
@@ -26,7 +26,7 @@ AC_DEFUN([AC_STRUCT_ST_MTIM_NSEC],
   if test $ac_cv_struct_st_mtim_nsec != no; then
     AC_DEFINE_UNQUOTED(ST_MTIM_NSEC, $ac_cv_struct_st_mtim_nsec,
       [Define to be the nanoseconds member of struct stat's st_mtim,
-   if it exists.])
+       if it exists.])
   fi
  ]
 )
index 1469ecf..fa59a55 100644 (file)
@@ -1,4 +1,4 @@
-#serial 7
+#serial 8
 
 dnl From Jim Meyering.
 dnl Determine whether stat has the bug that it succeeds when given the
@@ -11,30 +11,15 @@ dnl
 
 AC_DEFUN([jm_FUNC_STAT],
 [
- AC_REQUIRE([AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])
- AC_CACHE_CHECK([whether stat accepts an empty string],
-  jm_cv_func_stat_empty_string_bug,
-  [AC_TRY_RUN([
-#   include <sys/types.h>
-#   include <sys/stat.h>
-
-    int
-    main ()
-    {
-      struct stat sbuf;
-      exit (stat ("", &sbuf) ? 1 : 0);
-    }
-         ],
-        jm_cv_func_stat_empty_string_bug=yes,
-        jm_cv_func_stat_empty_string_bug=no,
-        dnl When crosscompiling, assume stat is broken.
-        jm_cv_func_stat_empty_string_bug=yes)
-  ])
-  if test $jm_cv_func_stat_empty_string_bug = yes; then
-    AC_LIBOBJ(stat)
-    AC_DEFINE(HAVE_STAT_EMPTY_STRING_BUG, 1,
-[Define if stat has the bug that it succeeds when given the zero-length
-   file name argument.  The stat from SunOS4.1.4 and the Hurd as of 1998-11-01)
-   do this. ])
+  AC_FUNC_STAT
+  dnl Note: AC_FUNC_STAT does AC_LIBOBJ(stat).
+  if test $ac_cv_func_stat_empty_string_bug = yes; then
+    gl_PREREQ_STAT
   fi
 ])
+
+# Prerequisites of lib/stat.c.
+AC_DEFUN([gl_PREREQ_STAT],
+[
+  :
+])
index 14e5902..def6e14 100644 (file)
@@ -17,6 +17,9 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 # 02111-1307, USA.
 
+# This file is only needed in autoconf <= 2.54.  Newer versions of autoconf
+# have this macro built-in.
+
 AC_DEFUN([AC_HEADER_STDBOOL],
   [AC_CACHE_CHECK([for stdbool.h that conforms to C99],
      [ac_cv_header_stdbool_h],
@@ -57,6 +60,7 @@ AC_DEFUN([AC_HEADER_STDBOOL],
        [ return !a + !b + !c + !d + !e + !f + !g + !h + !i; ],
        [ac_cv_header_stdbool_h=yes],
        [ac_cv_header_stdbool_h=no])])
+   AC_CHECK_TYPES([_Bool])
    if test $ac_cv_header_stdbool_h = yes; then
      AC_DEFINE(HAVE_STDBOOL_H, 1, [Define to 1 if stdbool.h conforms to C99.])
    fi])
index 684a6a2..d1f0a33 100644 (file)
@@ -1,25 +1,23 @@
-#serial 18
+#serial 19
 
 dnl This macro is intended to be used solely in this file.
 dnl These are the prerequisite macros for GNU's strftime.c replacement.
 AC_DEFUN([_jm_STRFTIME_PREREQS],
 [
  dnl strftime.c uses the underyling system strftime if it exists.
- AC_CHECK_FUNCS(strftime)
+ AC_FUNC_STRFTIME
 
- AC_CHECK_HEADERS(limits.h)
- AC_CHECK_FUNCS(bcopy tzset mempcpy memcpy memset)
+ AC_CHECK_HEADERS_ONCE(limits.h)
+ AC_CHECK_FUNCS_ONCE(memcpy mempcpy)
+ AC_CHECK_FUNCS(tzset memset)
 
  # This defines (or not) HAVE_TZNAME and HAVE_TM_ZONE.
  AC_STRUCT_TIMEZONE
 
  AC_CHECK_FUNCS(mblen mbrlen)
+ AC_TYPE_MBSTATE_T
 
- AC_CHECK_MEMBER([struct tm.tm_gmtoff],
-                 [AC_DEFINE(HAVE_TM_GMTOFF, 1,
-                            [Define if struct tm has the tm_gmtoff member.])],
-                 ,
-                 [#include <time.h>])
+ AC_REQUIRE([gl_TM_GMTOFF])
 ])
 
 dnl From Jim Meyering.
@@ -31,7 +29,7 @@ AC_DEFUN([jm_FUNC_GNU_STRFTIME],
 
  AC_REQUIRE([AC_C_CONST])dnl
  AC_REQUIRE([AC_HEADER_STDC])dnl
- AC_CHECK_HEADERS(sys/time.h)
+ AC_CHECK_HEADERS_ONCE(sys/time.h)
  AC_DEFINE([my_strftime], [nstrftime],
    [Define to the name of the strftime replacement function.])
 ])
index 5edb554..5df984f 100644 (file)
@@ -1,13 +1,28 @@
-#serial 5
+#serial 6
 
 dnl From Jim Meyering
 
+AC_DEFUN([gl_TIMESPEC],
+[
+  dnl Prerequisites of lib/timespec.h.
+  AC_REQUIRE([AC_HEADER_TIME])
+  AC_CHECK_HEADERS_ONCE(sys/time.h)
+  jm_CHECK_TYPE_STRUCT_TIMESPEC
+  AC_STRUCT_ST_MTIM_NSEC
+
+  dnl Persuade glibc <time.h> to declare nanosleep().
+  AC_REQUIRE([AC_GNU_SOURCE])
+
+  AC_CHECK_DECLS(nanosleep, , , [#include <time.h>])
+])
+
 dnl Define HAVE_STRUCT_TIMESPEC if `struct timespec' is declared
 dnl in time.h or sys/time.h.
 
 AC_DEFUN([jm_CHECK_TYPE_STRUCT_TIMESPEC],
 [
   AC_REQUIRE([AC_HEADER_TIME])
+  AC_CHECK_HEADERS_ONCE(sys/time.h)
   AC_CACHE_CHECK([for struct timespec], fu_cv_sys_struct_timespec,
     [AC_TRY_COMPILE(
       [
index 4ea4952..21724aa 100644 (file)
@@ -1,4 +1,4 @@
-#serial 4
+#serial 5
 
 dnl From Jim Meyering
 
@@ -8,7 +8,7 @@ dnl Some systems have utime.h but don't declare the struct anywhere.
 
 AC_DEFUN([jm_CHECK_TYPE_STRUCT_UTIMBUF],
 [
-  AC_CHECK_HEADERS(utime.h)
+  AC_CHECK_HEADERS_ONCE(sys/time.h utime.h)
   AC_REQUIRE([AC_HEADER_TIME])
   AC_CACHE_CHECK([for struct utimbuf], fu_cv_sys_struct_utimbuf,
     [AC_TRY_COMPILE(
@@ -34,7 +34,7 @@ AC_DEFUN([jm_CHECK_TYPE_STRUCT_UTIMBUF],
 
   if test $fu_cv_sys_struct_utimbuf = yes; then
     AC_DEFINE(HAVE_STRUCT_UTIMBUF, 1,
-[Define if struct utimbuf is declared -- usually in <utime.h>.
-   Some systems have utime.h but don't declare the struct anywhere. ])
+      [Define if struct utimbuf is declared -- usually in <utime.h>.
+       Some systems have utime.h but don't declare the struct anywhere. ])
   fi
 ])
index 34a0d1a..9767f94 100644 (file)
@@ -1,4 +1,4 @@
-#serial 3
+#serial 4
 
 dnl From Jim Meyering
 dnl Replace the utime function on systems that need it.
@@ -7,12 +7,17 @@ dnl FIXME
 
 AC_DEFUN([jm_FUNC_UTIME],
 [
-  AC_CHECK_HEADERS(utime.h)
-  AC_REQUIRE([jm_CHECK_TYPE_STRUCT_UTIMBUF])
   AC_REQUIRE([AC_FUNC_UTIME_NULL])
-
   if test $ac_cv_func_utime_null = no; then
-    jm_FUNC_UTIMES_NULL
-    AC_REPLACE_FUNCS(utime)
+    AC_LIBOBJ(utime)
+    gl_PREREQ_UTIME
   fi
 ])
+
+# Prerequisites of lib/utime.c.
+AC_DEFUN([gl_PREREQ_UTIME],
+[
+  AC_CHECK_HEADERS_ONCE(utime.h)
+  AC_REQUIRE([jm_CHECK_TYPE_STRUCT_UTIMBUF])
+  jm_FUNC_UTIMES_NULL
+])
index 438e852..38b4c56 100644 (file)
@@ -1,41 +1,9 @@
-#serial 2
+#serial 3
 dnl Cloned from xstrtoumax.m4.  Keep these files in sync.
 
-# autoconf tests required for use of xstrtoimax.c
-
-AC_DEFUN([jm_AC_PREREQ_XSTRTOIMAX],
+AC_DEFUN([jm_XSTRTOIMAX],
 [
+  dnl Prerequisites of lib/xstrtoimax.c.
   AC_REQUIRE([jm_AC_TYPE_INTMAX_T])
-  AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
-  AC_REQUIRE([jm_AC_TYPE_LONG_LONG])
-  AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
-  AC_CHECK_DECLS([strtol, strtoul, strtoll, strtoimax, strtoumax])
-  AC_CHECK_HEADERS(limits.h stdlib.h inttypes.h)
-
-  AC_CACHE_CHECK([whether <inttypes.h> defines strtoimax as a macro],
-    jm_cv_func_strtoimax_macro,
-    AC_EGREP_CPP([inttypes_h_defines_strtoimax], [#include <inttypes.h>
-#ifdef strtoimax
- inttypes_h_defines_strtoimax
-#endif],
-      jm_cv_func_strtoimax_macro=yes,
-      jm_cv_func_strtoimax_macro=no))
-
-  if test "$jm_cv_func_strtoimax_macro" != yes; then
-    AC_REPLACE_FUNCS(strtoimax)
-  fi
-
-  dnl Only the replacement strtoimax invokes strtol and strtoll,
-  dnl so we need the replacements only if strtoimax does not exist.
-  case "$jm_cv_func_strtoimax_macro,$ac_cv_func_strtoimax" in
-    no,no)
-      AC_REPLACE_FUNCS(strtol)
-
-      dnl We don't need (and can't compile) the replacement strtoll
-      dnl unless the type `long long' exists.
-      if test "$ac_cv_type_long_long" = yes; then
-       AC_REPLACE_FUNCS(strtoll)
-      fi
-      ;;
-  esac
+  AC_REQUIRE([gl_PREREQ_XSTRTOL])
 ])
index 9ab71ec..4f41061 100644 (file)
@@ -1,40 +1,9 @@
-#serial 4
+#serial 5
+dnl Cloned from xstrtoimax.m4.  Keep these files in sync.
 
-# autoconf tests required for use of xstrtoumax.c
-
-AC_DEFUN([jm_AC_PREREQ_XSTRTOUMAX],
+AC_DEFUN([jm_XSTRTOUMAX],
 [
-  AC_REQUIRE([jm_AC_TYPE_INTMAX_T])
+  dnl Prerequisites of lib/xstrtoumax.c.
   AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
-  AC_REQUIRE([jm_AC_TYPE_LONG_LONG])
-  AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
-  AC_CHECK_DECLS([strtol, strtoul, strtoull, strtoimax, strtoumax])
-  AC_CHECK_HEADERS(limits.h stdlib.h inttypes.h)
-
-  AC_CACHE_CHECK([whether <inttypes.h> defines strtoumax as a macro],
-    jm_cv_func_strtoumax_macro,
-    AC_EGREP_CPP([inttypes_h_defines_strtoumax], [#include <inttypes.h>
-#ifdef strtoumax
- inttypes_h_defines_strtoumax
-#endif],
-      jm_cv_func_strtoumax_macro=yes,
-      jm_cv_func_strtoumax_macro=no))
-
-  if test "$jm_cv_func_strtoumax_macro" != yes; then
-    AC_REPLACE_FUNCS(strtoumax)
-  fi
-
-  dnl Only the replacement strtoumax invokes strtoul and strtoull,
-  dnl so we need the replacements only if strtoumax does not exist.
-  case "$jm_cv_func_strtoumax_macro,$ac_cv_func_strtoumax" in
-    no,no)
-      AC_REPLACE_FUNCS(strtoul)
-
-      dnl We don't need (and can't compile) the replacement strtoull
-      dnl unless the type `unsigned long long' exists.
-      if test "$ac_cv_type_unsigned_long_long" = yes; then
-       AC_REPLACE_FUNCS(strtoull)
-      fi
-      ;;
-  esac
+  AC_REQUIRE([gl_PREREQ_XSTRTOL])
 ])