]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* acspecific.m4: Move some macros to a better place.
authorAkim Demaille <akim@epita.fr>
Thu, 2 Mar 2000 16:48:06 +0000 (16:48 +0000)
committerAkim Demaille <akim@epita.fr>
Thu, 2 Mar 2000 16:48:06 +0000 (16:48 +0000)
ChangeLog
acspecific.m4
lib/autoconf/specific.m4

index 65df4a59e308883b5a9632cb55dd57e59955fc9d..d83da8032a62e99958fbf5009b66009b6d7e1cf0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2000-03-02  Akim Demaille  <akim@epita.fr>
+
+       * acspecific.m4: Move some macros to a better place.
+
 2000-03-02  Akim Demaille  <akim@epita.fr>
 
        Internal macros are named `_AC_'.
index 6961c430e7f2ec6ca0345858cfc68933311c0d0b..4974dae8316705b6d7ba2d03f6cb55f977eeb2d7 100644 (file)
@@ -582,6 +582,7 @@ if test x"$M4" != x; then
   esac
 fi])])
 
+
 # AC_PROG_MAKE_SET
 # ----------------
 # Define SET_MAKE to set ${MAKE} if make doesn't.
@@ -609,12 +610,14 @@ else
   SET_MAKE="MAKE=${MAKE-make}"
 fi
 AC_SUBST([SET_MAKE])dnl
-])
+])# AC_PROG_MAKE_SET
+
 
 AC_DEFUN(AC_PROG_RANLIB,
 [AC_CHECK_PROG(RANLIB, ranlib, ranlib, :)])
 
-dnl Check for mawk first since it's generally faster.
+
+# Check for mawk first since it's generally faster.
 AC_DEFUN(AC_PROG_AWK,
 [AC_CHECK_PROGS(AWK, mawk gawk nawk awk, )])
 
@@ -878,91 +881,36 @@ AC_DEFUNCT(AC_RSH, [; replace it with equivalent code])
 
 
 
-
-
-
 ## ------------------------- ##
-## Checks for header files.  ##
+## Checks for declarations.  ##
 ## ------------------------- ##
 
 
-# AC_HEADER_STDC
-# --------------
-AC_DEFUN(AC_HEADER_STDC,
-[AC_REQUIRE_CPP()dnl
-AC_CACHE_CHECK(for ANSI C header files, ac_cv_header_stdc,
-[AC_TRY_CPP([#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.h>
-], ac_cv_header_stdc=yes, ac_cv_header_stdc=no)
-
-if test $ac_cv_header_stdc = yes; then
-  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
-AC_EGREP_HEADER(memchr, string.h, , ac_cv_header_stdc=no)
-fi
-
-if test $ac_cv_header_stdc = yes; then
-  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
-AC_EGREP_HEADER(free, stdlib.h, , ac_cv_header_stdc=no)
-fi
-
-if test $ac_cv_header_stdc = yes; then
-  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
-AC_TRY_RUN(
-[#include <ctype.h>
-#if ((' ' & 0x0FF) == 0x020)
-# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
-#else
-# define ISLOWER(c) (('a' <= (c) && (c) <= 'i') \
-                     || ('j' <= (c) && (c) <= 'r') \
-                     || ('s' <= (c) && (c) <= 'z'))
-# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+# AC_DECL_SYS_SIGLIST
+# -------------------
+AC_DEFUN(AC_DECL_SYS_SIGLIST,
+[AC_CACHE_CHECK([for sys_siglist declaration in signal.h or unistd.h],
+  ac_cv_decl_sys_siglist,
+[AC_TRY_COMPILE([#include <sys/types.h>
+#include <signal.h>
+/* NetBSD declares sys_siglist in unistd.h.  */
+#if HAVE_UNISTD_H
+# include <unistd.h>
 #endif
-
-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
-int
-main ()
-{
-  int i;
-  for (i = 0; i < 256; i++)
-    if (XOR (islower (i), ISLOWER (i))
-        || toupper (i) != TOUPPER (i))
-      exit(2);
-  exit (0);
-}], , ac_cv_header_stdc=no, :)
-fi])
-if test $ac_cv_header_stdc = yes; then
-  AC_DEFINE(STDC_HEADERS, 1, [Define if you have the ANSI C header files.])
+], [char *msg = *(sys_siglist + 1);],
+  ac_cv_decl_sys_siglist=yes, ac_cv_decl_sys_siglist=no)])
+if test $ac_cv_decl_sys_siglist = yes; then
+  AC_DEFINE(SYS_SIGLIST_DECLARED, 1,
+            [Define if `sys_siglist' is declared by <signal.h> or <unistd.h>.])
 fi
-])# AC_HEADER_STDC
+])# AC_DECL_SYS_SIGLIST
 
 
-# AC_HEADER_MAJOR
-# ---------------
-AC_DEFUN(AC_HEADER_MAJOR,
-[AC_CACHE_CHECK(whether sys/types.h defines makedev,
-  ac_cv_header_sys_types_h_makedev,
-[AC_TRY_LINK([#include <sys/types.h>
-], [return makedev(0, 0);],
-  ac_cv_header_sys_types_h_makedev=yes, ac_cv_header_sys_types_h_makedev=no)
-])
 
-if test $ac_cv_header_sys_types_h_makedev = no; then
-AC_CHECK_HEADER(sys/mkdev.h,
-                [AC_DEFINE(MAJOR_IN_MKDEV, 1,
-                           [Define if `major', `minor', and `makedev' are
-                            declared in <mkdev.h>.])])
 
-  if test $ac_cv_header_sys_mkdev_h = no; then
-    AC_CHECK_HEADER(sys/sysmacros.h,
-                    [AC_DEFINE(MAJOR_IN_SYSMACROS, 1,
-                               [Define if `major', `minor', and `makedev' are
-                                declared in <sysmacros.h>.])])
-  fi
-fi
-])# AC_HEADER_MAJOR
+## ------------------------- ##
+## Checks for header files.  ##
+## ------------------------- ##
 
 
 # _AC_CHECK_HEADER_DIRENT(HEADER-FILE, ACTION-IF-FOUND)
@@ -1017,6 +965,32 @@ fi
 ])# AC_HEADER_DIRENT
 
 
+# AC_HEADER_MAJOR
+# ---------------
+AC_DEFUN(AC_HEADER_MAJOR,
+[AC_CACHE_CHECK(whether sys/types.h defines makedev,
+  ac_cv_header_sys_types_h_makedev,
+[AC_TRY_LINK([#include <sys/types.h>
+], [return makedev(0, 0);],
+  ac_cv_header_sys_types_h_makedev=yes, ac_cv_header_sys_types_h_makedev=no)
+])
+
+if test $ac_cv_header_sys_types_h_makedev = no; then
+AC_CHECK_HEADER(sys/mkdev.h,
+                [AC_DEFINE(MAJOR_IN_MKDEV, 1,
+                           [Define if `major', `minor', and `makedev' are
+                            declared in <mkdev.h>.])])
+
+  if test $ac_cv_header_sys_mkdev_h = no; then
+    AC_CHECK_HEADER(sys/sysmacros.h,
+                    [AC_DEFINE(MAJOR_IN_SYSMACROS, 1,
+                               [Define if `major', `minor', and `makedev' are
+                                declared in <sysmacros.h>.])])
+  fi
+fi
+])# AC_HEADER_MAJOR
+
+
 # AC_HEADER_STAT
 # --------------
 # FIXME: Shouldn't this be named AC_HEADER_SYS_STAT?
@@ -1058,24 +1032,57 @@ fi
 ])# AC_HEADER_STAT
 
 
-# AC_DECL_SYS_SIGLIST
-# -------------------
-AC_DEFUN(AC_DECL_SYS_SIGLIST,
-[AC_CACHE_CHECK([for sys_siglist declaration in signal.h or unistd.h],
-  ac_cv_decl_sys_siglist,
-[AC_TRY_COMPILE([#include <sys/types.h>
-#include <signal.h>
-/* NetBSD declares sys_siglist in unistd.h.  */
-#if HAVE_UNISTD_H
-# include <unistd.h>
+# AC_HEADER_STDC
+# --------------
+AC_DEFUN(AC_HEADER_STDC,
+[AC_REQUIRE_CPP()dnl
+AC_CACHE_CHECK(for ANSI C header files, ac_cv_header_stdc,
+[AC_TRY_CPP([#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+], ac_cv_header_stdc=yes, ac_cv_header_stdc=no)
+
+if test $ac_cv_header_stdc = yes; then
+  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+AC_EGREP_HEADER(memchr, string.h, , ac_cv_header_stdc=no)
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+AC_EGREP_HEADER(free, stdlib.h, , ac_cv_header_stdc=no)
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+AC_TRY_RUN(
+[#include <ctype.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) (('a' <= (c) && (c) <= 'i') \
+                     || ('j' <= (c) && (c) <= 'r') \
+                     || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
 #endif
-], [char *msg = *(sys_siglist + 1);],
-  ac_cv_decl_sys_siglist=yes, ac_cv_decl_sys_siglist=no)])
-if test $ac_cv_decl_sys_siglist = yes; then
-  AC_DEFINE(SYS_SIGLIST_DECLARED, 1,
-            [Define if `sys_siglist' is declared by <signal.h> or <unistd.h>.])
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+  int i;
+  for (i = 0; i < 256; i++)
+    if (XOR (islower (i), ISLOWER (i))
+        || toupper (i) != TOUPPER (i))
+      exit(2);
+  exit (0);
+}], , ac_cv_header_stdc=no, :)
+fi])
+if test $ac_cv_header_stdc = yes; then
+  AC_DEFINE(STDC_HEADERS, 1, [Define if you have the ANSI C header files.])
 fi
-])# AC_DECL_SYS_SIGLIST
+])# AC_HEADER_STDC
 
 
 # AC_HEADER_SYS_WAIT
@@ -1103,6 +1110,25 @@ fi
 ])# AC_HEADER_SYS_WAIT
 
 
+# AC_HEADER_TIME
+# --------------
+AC_DEFUN(AC_HEADER_TIME,
+[AC_CACHE_CHECK([whether time.h and sys/time.h may both be included],
+  ac_cv_header_time,
+[AC_TRY_COMPILE([#include <sys/types.h>
+#include <sys/time.h>
+#include <time.h>
+],
+[struct tm *tp;], ac_cv_header_time=yes, ac_cv_header_time=no)])
+if test $ac_cv_header_time = yes; then
+  AC_DEFINE(TIME_WITH_SYS_TIME, 1,
+            [Define if you can safely include both <sys/time.h> and <time.h>.])
+fi
+])# AC_HEADER_TIME
+
+
+
+
 # A few hasbeen'd macros.
 
 AC_DEFUNCT(AC_UNISTD_H, [; instead use AC_CHECK_HEADERS(unistd.h)])
@@ -1232,43 +1258,142 @@ AC_DEFINE_UNQUOTED(RETSIGTYPE, $ac_cv_type_signal,
 ## ---------------------- ##
 
 
-# AC_FUNC_CLOSEDIR_VOID
-# ---------------------
-# Check whether closedir returns void, and #define CLOSEDIR_VOID in
-# that case.
-AC_DEFUN(AC_FUNC_CLOSEDIR_VOID,
-[AC_REQUIRE([AC_HEADER_DIRENT])dnl
-AC_CACHE_CHECK(whether closedir returns void, ac_cv_func_closedir_void,
-[AC_TRY_RUN(
-[#include <sys/types.h>
-#include <$ac_header_dirent>
-
-int closedir ();
-int
-main ()
-{
-  exit (closedir (opendir (".")) != 0);
-}],
-  ac_cv_func_closedir_void=no,
-  ac_cv_func_closedir_void=yes,
-  ac_cv_func_closedir_void=yes)])
-if test $ac_cv_func_closedir_void = yes; then
-  AC_DEFINE(CLOSEDIR_VOID, 1,
-            [Define if the `closedir' function returns void instead of `int'.])
+# AC_FUNC_ALLOCA
+# --------------
+AC_DEFUN(AC_FUNC_ALLOCA,
+[AC_REQUIRE_CPP()dnl Set CPP; we run AC_EGREP_CPP conditionally.
+# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
+# for constant arguments.  Useless!
+AC_CACHE_CHECK([for working alloca.h], ac_cv_working_alloca_h,
+[AC_TRY_LINK([#include <alloca.h>], [char *p = alloca(2 * sizeof(int));],
+  ac_cv_working_alloca_h=yes, ac_cv_working_alloca_h=no)])
+if test $ac_cv_working_alloca_h = yes; then
+  AC_DEFINE(HAVE_ALLOCA_H, 1,
+            [Define if you have <alloca.h> and it should be used
+             (not on Ultrix).])
 fi
-])
-
 
-# AC_FUNC_FNMATCH
-# ---------------
-# We look for fnmatch.h to avoid that the test fails in C++.
-AC_DEFUN(AC_FUNC_FNMATCH,
-[AC_CHECK_HEADERS(fnmatch.h)
-AC_CACHE_CHECK(for working fnmatch, ac_cv_func_fnmatch_works,
-# Some versions of Solaris or SCO have a broken fnmatch function.
-# So we run a test program.  If we are cross-compiling, take no chance.
-# Thanks to John Oleynick and Franc,ois Pinard for this test.
-[AC_TRY_RUN(
+AC_CACHE_CHECK([for alloca], ac_cv_func_alloca_works,
+[AC_TRY_LINK(
+[#ifdef __GNUC__
+# define alloca __builtin_alloca
+#else
+# ifdef _MSC_VER
+#  include <malloc.h>
+#  define alloca _alloca
+# else
+#  if HAVE_ALLOCA_H
+#   include <alloca.h>
+#  else
+#   ifdef _AIX
+ #pragma alloca
+#   else
+#    ifndef alloca /* predefined by HP cc +Olibcalls */
+char *alloca ();
+#    endif
+#   endif
+#  endif
+# endif
+#endif
+], [char *p = (char *) alloca(1);],
+  ac_cv_func_alloca_works=yes, ac_cv_func_alloca_works=no)])
+if test $ac_cv_func_alloca_works = yes; then
+  AC_DEFINE(HAVE_ALLOCA, 1,
+            [Define if you have `alloca', as a function or macro.])
+fi
+
+if test $ac_cv_func_alloca_works = no; then
+  # The SVR3 libPW and SVR4 libucb both contain incompatible functions
+  # that cause trouble.  Some versions do not even contain alloca or
+  # contain a buggy version.  If you still want to use their alloca,
+  # use ar to extract alloca.o from them instead of compiling alloca.c.
+  ALLOCA=alloca.${ac_objext}
+  AC_DEFINE(C_ALLOCA, 1, [Define if using `alloca.c'.])
+
+AC_CACHE_CHECK(whether alloca needs Cray hooks, ac_cv_os_cray,
+[AC_EGREP_CPP(webecray,
+[#if defined(CRAY) && ! defined(CRAY2)
+webecray
+#else
+wenotbecray
+#endif
+], ac_cv_os_cray=yes, ac_cv_os_cray=no)])
+if test $ac_cv_os_cray = yes; then
+for ac_func in _getb67 GETB67 getb67; do
+  AC_CHECK_FUNC($ac_func,
+                [AC_DEFINE_UNQUOTED(CRAY_STACKSEG_END, $ac_func,
+                                    [Define to one of _getb67, GETB67, getb67
+                                     for Cray-2 and Cray-YMP systems.
+                                     This function is required for alloca.c
+                                     support on those systems.])
+  break])
+done
+fi
+
+AC_CACHE_CHECK(stack direction for C alloca, ac_cv_c_stack_direction,
+[AC_TRY_RUN(
+[find_stack_direction ()
+{
+  static char *addr = 0;
+  auto char dummy;
+  if (addr == 0)
+    {
+      addr = &dummy;
+      return find_stack_direction ();
+    }
+  else
+    return (&dummy > addr) ? 1 : -1;
+}
+
+int
+main ()
+{
+  exit (find_stack_direction () < 0);
+}], ac_cv_c_stack_direction=1, ac_cv_c_stack_direction=-1,
+  ac_cv_c_stack_direction=0)])
+AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction)
+fi
+AC_SUBST(ALLOCA)dnl
+])# AC_FUNC_ALLOCA
+
+
+# AC_FUNC_CLOSEDIR_VOID
+# ---------------------
+# Check whether closedir returns void, and #define CLOSEDIR_VOID in
+# that case.
+AC_DEFUN(AC_FUNC_CLOSEDIR_VOID,
+[AC_REQUIRE([AC_HEADER_DIRENT])dnl
+AC_CACHE_CHECK(whether closedir returns void, ac_cv_func_closedir_void,
+[AC_TRY_RUN(
+[#include <sys/types.h>
+#include <$ac_header_dirent>
+
+int closedir ();
+int
+main ()
+{
+  exit (closedir (opendir (".")) != 0);
+}],
+  ac_cv_func_closedir_void=no,
+  ac_cv_func_closedir_void=yes,
+  ac_cv_func_closedir_void=yes)])
+if test $ac_cv_func_closedir_void = yes; then
+  AC_DEFINE(CLOSEDIR_VOID, 1,
+            [Define if the `closedir' function returns void instead of `int'.])
+fi
+])
+
+
+# AC_FUNC_FNMATCH
+# ---------------
+# We look for fnmatch.h to avoid that the test fails in C++.
+AC_DEFUN(AC_FUNC_FNMATCH,
+[AC_CHECK_HEADERS(fnmatch.h)
+AC_CACHE_CHECK(for working fnmatch, ac_cv_func_fnmatch_works,
+# Some versions of Solaris or SCO have a broken fnmatch function.
+# So we run a test program.  If we are cross-compiling, take no chance.
+# Thanks to John Oleynick and Franc,ois Pinard for this test.
+[AC_TRY_RUN(
 [#if HAVE_FNMATCH_H
 # include <fnmatch.h>
 #endif
 ])# AC_FUNC_FNMATCH
 
 
-# AC_FUNC_MMAP
-# ------------
-AC_DEFUN(AC_FUNC_MMAP,
-[AC_CHECK_HEADERS(unistd.h)
-AC_CHECK_FUNCS(getpagesize)
-AC_CACHE_CHECK(for working mmap, ac_cv_func_mmap_fixed_mapped,
-[AC_TRY_RUN(
-[/* Thanks to Mike Haertel and Jim Avera for this test.
-   Here is a matrix of mmap possibilities:
-       mmap private not fixed
-       mmap private fixed at somewhere currently unmapped
-       mmap private fixed at somewhere already mapped
-       mmap shared not fixed
-       mmap shared fixed at somewhere currently unmapped
-       mmap shared fixed at somewhere already mapped
-   For private mappings, we should verify that changes cannot be read()
-   back from the file, nor mmap's back from the file at a different
-   address.  (There have been systems where private was not correctly
-   implemented like the infamous i386 svr4.0, and systems where the
-   VM page cache was not coherent with the file system buffer cache
-   like early versions of FreeBSD and possibly contemporary NetBSD.)
-   For shared mappings, we should conversely verify that changes get
-   propogated back to all the places they're supposed to be.
-
-   Grep wants private fixed already mapped.
-   The main things grep needs to know about mmap are:
-   * does it exist and is it safe to write into the mmap'd area
-   * how to use it (BSD variants)  */
-#include <sys/types.h>
-#include <fcntl.h>
-#include <sys/mman.h>
+# AC_FUNC_GETLOADAVG
+# ------------------
+AC_DEFUN(AC_FUNC_GETLOADAVG,
+[ac_have_func=no # yes means we've found a way to get the load average.
 
-/* This mess was copied from the GNU getpagesize.h.  */
-#if !HAVE_GETPAGESIZE
-# if HAVE_UNISTD_H
-#  include <unistd.h>
-# endif
+# Some systems with -lutil have (and need) -lkvm as well, some do not.
+# On Solaris, -lkvm requires nlist from -lelf, so check that first
+# to get the right answer into the cache.
+AC_CHECK_LIB(elf, elf_begin, LIBS="-lelf $LIBS")
+AC_CHECK_LIB(kvm, kvm_open, LIBS="-lkvm $LIBS")
+AC_CHECK_LIB(kstat, kstat_open)
+# Check for the 4.4BSD definition of getloadavg.
+AC_CHECK_LIB(util, getloadavg,
+  [LIBS="-lutil $LIBS" ac_have_func=yes ac_cv_func_getloadavg_setgid=yes])
 
-/* Assume that all systems that can run configure have sys/param.h.  */
-# if !HAVE_SYS_PARAM_H
-#  define HAVE_SYS_PARAM_H 1
-# endif
+if test $ac_have_func = no; then
+  # There is a commonly available library for RS/6000 AIX.
+  # Since it is not a standard part of AIX, it might be installed locally.
+  ac_getloadavg_LIBS="$LIBS"; LIBS="-L/usr/local/lib $LIBS"
+  AC_CHECK_LIB(getloadavg, getloadavg,
+    LIBS="-lgetloadavg $LIBS", LIBS="$ac_getloadavg_LIBS")
+fi
 
-# ifdef _SC_PAGESIZE
-#  define getpagesize() sysconf(_SC_PAGESIZE)
-# else /* no _SC_PAGESIZE */
-#  if HAVE_SYS_PARAM_H
-#   include <sys/param.h>
-#   ifdef EXEC_PAGESIZE
-#    define getpagesize() EXEC_PAGESIZE
-#   else /* no EXEC_PAGESIZE */
-#    ifdef NBPG
-#     define getpagesize() NBPG * CLSIZE
-#     ifndef CLSIZE
-#      define CLSIZE 1
-#     endif /* no CLSIZE */
-#    else /* no NBPG */
-#     ifdef NBPC
-#      define getpagesize() NBPC
-#     else /* no NBPC */
-#      ifdef PAGESIZE
-#       define getpagesize() PAGESIZE
-#      endif /* PAGESIZE */
-#     endif /* no NBPC */
-#    endif /* no NBPG */
-#   endif /* no EXEC_PAGESIZE */
-#  else /* no HAVE_SYS_PARAM_H */
-#   define getpagesize() 8192  /* punt totally */
-#  endif /* no HAVE_SYS_PARAM_H */
-# endif /* no _SC_PAGESIZE */
+# Make sure it is really in the library, if we think we found it.
+AC_REPLACE_FUNCS(getloadavg)
 
-#endif /* no HAVE_GETPAGESIZE */
+if test $ac_cv_func_getloadavg = yes; then
+  AC_DEFINE(HAVE_GETLOADAVG, 1,
+            [Define if your system has its own `getloadavg' function.])
+  ac_have_func=yes
+else
+  # Figure out what our getloadavg.c needs.
+  ac_have_func=no
+  AC_CHECK_HEADER(sys/dg_sys_info.h,
+  [ac_have_func=yes;
+   AC_DEFINE(DGUX, 1, [Define for DGUX with <sys/dg_sys_info.h>.])
+   AC_CHECK_LIB(dgc, dg_sys_info)])
 
-#ifdef __cplusplus
-extern "C" { void *malloc(unsigned); }
-#else
-char *malloc();
-#endif
+  # We cannot check for <dwarf.h>, because Solaris 2 does not use dwarf (it
+  # uses stabs), but it is still SVR4.  We cannot check for <elf.h> because
+  # Irix 4.0.5F has the header but not the library.
+  if test $ac_have_func = no && test $ac_cv_lib_elf_elf_begin = yes; then
+    ac_have_func=yes;
+    AC_DEFINE(SVR4, 1,
+              [Define on System V Release 4.])
+  fi
 
-int
-main ()
-{
-  char *data, *data2, *data3;
-  int i, pagesize;
-  int fd;
+  if test $ac_have_func = no; then
+    AC_CHECK_HEADER(inq_stats/cpustats.h,
+    [ac_have_func=yes;
+     AC_DEFINE(UMAX, 1,
+               [Define for Encore UMAX.])
+     AC_DEFINE(UMAX4_3, 1,
+               [Define for Encore UMAX 4.3 that has <inq_status/cpustats.h>
+                instead of <sys/cpustats.h>.])])
+  fi
 
-  pagesize = getpagesize ();
+  if test $ac_have_func = no; then
+    AC_CHECK_HEADER(sys/cpustats.h,
+    [ac_have_func=yes; AC_DEFINE(UMAX)])
+  fi
 
-  /* First, make a file with some known garbage in it. */
-  data = malloc (pagesize);
-  if (!data)
-    exit (1);
-  for (i = 0; i < pagesize; ++i)
-    *(data + i) = rand ();
-  umask (0);
-  fd = creat ("conftestmmap", 0600);
-  if (fd < 0)
-    exit (1);
-  if (write (fd, data, pagesize) != pagesize)
-    exit (1);
-  close (fd);
+  if test $ac_have_func = no; then
+    AC_CHECK_HEADERS(mach/mach.h)
+  fi
 
-  /* Next, try to mmap the file at a fixed address which already has
-     something else allocated at it.  If we can, also make sure that
-     we see the same garbage.  */
-  fd = open ("conftestmmap", O_RDWR);
-  if (fd < 0)
-    exit (1);
-  data2 = malloc (2 * pagesize);
-  if (!data2)
-    exit (1);
-  data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1);
-  if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE,
-                     MAP_PRIVATE | MAP_FIXED, fd, 0L))
-    exit (1);
-  for (i = 0; i < pagesize; ++i)
-    if (*(data + i) != *(data2 + i))
-      exit (1);
+  AC_CHECK_HEADER(nlist.h,
+  [AC_DEFINE(NLIST_STRUCT, 1, [Define if you have <nlist.h>.])
+  AC_CACHE_CHECK([for n_un in struct nlist], ac_cv_struct_nlist_n_un,
+  [AC_TRY_COMPILE([#include <nlist.h>
+],
+                  [struct nlist n; n.n_un.n_name = 0;],
+                  ac_cv_struct_nlist_n_un=yes, ac_cv_struct_nlist_n_un=no)])
+  if test $ac_cv_struct_nlist_n_un = yes; then
+    AC_DEFINE(NLIST_NAME_UNION, 1,
+              [Define if your `struct nlist' has an `n_un' member.])
+  fi
+  ])dnl
+fi # Do not have getloadavg in system libraries.
 
-  /* Finally, make sure that changes to the mapped area do not
-     percolate back to the file as seen by read().  (This is a bug on
-     some variants of i386 svr4.0.)  */
-  for (i = 0; i < pagesize; ++i)
-    *(data2 + i) = *(data2 + i) + 1;
-  data3 = malloc (pagesize);
-  if (!data3)
-    exit (1);
-  if (read (fd, data3, pagesize) != pagesize)
-    exit (1);
-  for (i = 0; i < pagesize; ++i)
-    if (*(data + i) != *(data3 + i))
-      exit (1);
-  close (fd);
-  unlink ("conftestmmap");
-  exit (0);
-}], ac_cv_func_mmap_fixed_mapped=yes, ac_cv_func_mmap_fixed_mapped=no,
-ac_cv_func_mmap_fixed_mapped=no)])
-if test $ac_cv_func_mmap_fixed_mapped = yes; then
-  AC_DEFINE(HAVE_MMAP, 1,
-            [Define if you have a working `mmap' system call.])
+# Some definitions of getloadavg require that the program be installed setgid.
+dnl FIXME: Don't hardwire the path of getloadavg.c in the top-level directory.
+AC_CACHE_CHECK(whether getloadavg requires setgid,
+  ac_cv_func_getloadavg_setgid,
+[AC_EGREP_CPP([Yowza Am I SETGID yet],
+[#include "$srcdir/getloadavg.c"
+#ifdef LDAV_PRIVILEGED
+Yowza Am I SETGID yet
+#endif],
+  ac_cv_func_getloadavg_setgid=yes, ac_cv_func_getloadavg_setgid=no)])
+if test $ac_cv_func_getloadavg_setgid = yes; then
+  NEED_SETGID=true;
+  AC_DEFINE(GETLOADAVG_PRIVILEGED, 1,
+            [Define if the `getloadavg' function needs to be run setuid
+             or setgid.])
+else
+  NEED_SETGID=false
 fi
-])# AC_FUNC_MMAP
+AC_SUBST(NEED_SETGID)dnl
+
+if test $ac_cv_func_getloadavg_setgid = yes; then
+  AC_CACHE_CHECK(group of /dev/kmem, ac_cv_group_kmem,
+[ # On Solaris, /dev/kmem is a symlink.  Get info on the real file.
+  ac_ls_output=`ls -lgL /dev/kmem 2>/dev/null`
+  # If we got an error (system does not support symlinks), try without -L.
+  test -z "$ac_ls_output" && ac_ls_output=`ls -lg /dev/kmem`
+  ac_cv_group_kmem=`echo $ac_ls_output \
+    | sed -ne ['s/[    ][      ]*/ /g;
+              s/^.[sSrwx-]* *[0-9]* *\([^0-9]*\)  *.*/\1/;
+              / /s/.* //;p;']`
+])
+  KMEM_GROUP=$ac_cv_group_kmem
+fi
+AC_SUBST(KMEM_GROUP)dnl
+])# AC_FUNC_GETLOADAVG
+
+
+# AC_FUNC_GETMNTENT
+# -----------------
+AC_DEFUN(AC_FUNC_GETMNTENT,
+[# getmntent is in -lsun on Irix 4, -lseq on Dynix/PTX, -lgen on Unixware.
+AC_CHECK_LIB(sun, getmntent, LIBS="-lsun $LIBS",
+  [AC_CHECK_LIB(seq, getmntent, LIBS="-lseq $LIBS",
+    [AC_CHECK_LIB(gen, getmntent, LIBS="-lgen $LIBS")])])
+AC_CHECK_FUNC(getmntent,
+              [AC_DEFINE(HAVE_GETMNTENT, 1,
+                         [Define if you have the `getmntent' function.])])])
 
 
 # AC_FUNC_GETPGRP
 ])# AC_FUNC_GETPGRP
 
 
-# AC_FUNC_SETPGRP
-# ---------------
-AC_DEFUN(AC_FUNC_SETPGRP,
-[AC_CACHE_CHECK(whether setpgrp takes no argument, ac_cv_func_setpgrp_void,
-AC_TRY_RUN(
-[#if HAVE_UNISTD_H
-# include <unistd.h>
+# AC_FUNC_MKTIME
+# --------------
+AC_DEFUN(AC_FUNC_MKTIME,
+[AC_REQUIRE([AC_HEADER_TIME])dnl
+AC_CHECK_HEADERS(sys/time.h unistd.h)
+AC_CHECK_FUNCS(alarm)
+AC_CACHE_CHECK([for working mktime], ac_cv_func_working_mktime,
+[AC_TRY_RUN(
+[/* Test program from Paul Eggert and Tony Leneis.  */
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
 #endif
 
-/* If this system has a BSD-style setpgrp, which takes arguments, exit
-   successfully.  */
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
 
-int
-main ()
-{
-  if (setpgrp (1,1) == -1)
-    exit (0);
-  else
-    exit (1);
-}], ac_cv_func_setpgrp_void=no, ac_cv_func_setpgrp_void=yes,
-   AC_MSG_ERROR(cannot check setpgrp if cross compiling))
-)
-if test $ac_cv_func_setpgrp_void = yes; then
-  AC_DEFINE(SETPGRP_VOID, 1,
-            [Define if the `setpgrp' function takes no argument.])
-fi
-])# AC_FUNC_SETPGRP
+#if !HAVE_ALARM
+# define alarm(X) /* empty */
+#endif
 
+/* Work around redefinition to rpl_putenv by other config tests.  */
+#undef putenv
 
-# AC_FUNC_VPRINTF
-# ---------------
-# Why the heck is that _doprnt does not define HAVE__DOPRNT???
-# That the logical name!  In addition, why doesn't it use
-# AC_CHECK_FUNCS(vprintf)?  Because old Autoconf uses sh for loops.
-# FIXME: To be changed in Autoconf 3?
-AC_DEFUN(AC_FUNC_VPRINTF,
-[AC_CHECK_FUNC(vprintf,
-               AC_DEFINE(HAVE_VPRINTF, 1,
-               [Define if you have the `vprintf' function.]))
-if test "$ac_cv_func_vprintf" != yes; then
-AC_CHECK_FUNC(_doprnt,
-              AC_DEFINE(HAVE_DOPRNT, 1,
-                        [Define if you don't have `vprintf' but do have
-                         `_doprnt.']))
-fi
-])
+static time_t time_t_max;
 
+/* Values we'll use to set the TZ environment variable.  */
+static const char *const tz_strings[] = {
+  (const char *) 0, "TZ=GMT0", "TZ=JST-9",
+  "TZ=EST+3EDT+2,M10.1.0/00:00:00,M2.3.0/00:00:00"
+};
+#define N_STRINGS (sizeof (tz_strings) / sizeof (tz_strings[0]))
 
-# AC_FUNC_VFORK
-# -------------
-AC_DEFUN(AC_FUNC_VFORK,
-[AC_REQUIRE([AC_TYPE_PID_T])dnl
-AC_CHECK_HEADER(vfork.h,
-                AC_DEFINE(HAVE_VFORK_H, 1,
-                          [Define if you have <vfork.h>.]))
-AC_CACHE_CHECK(for working vfork, ac_cv_func_vfork_works,
-[AC_TRY_RUN([/* Thanks to Paul Eggert for this test.  */
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-#if HAVE_VFORK_H
-# include <vfork.h>
-#endif
-/* On some sparc systems, changes by the child to local and incoming
-   argument registers are propagated back to the parent.  The compiler
-   is told about this with #include <vfork.h>, but some compilers
-   (e.g. gcc -O) don't grok <vfork.h>.  Test for this by using a
-   static variable whose address is put into a register that is
-   clobbered by the vfork.  */
-static
-#ifdef __cplusplus
-sparc_address_test (int arg)
-# else
-sparc_address_test (arg) int arg;
-#endif
+/* Fail if mktime fails to convert a date in the spring-forward gap.
+   Based on a problem report from Andreas Jaeger.  */
+static void
+spring_forward_gap ()
 {
-  static pid_t child;
-  if (!child) {
-    child = vfork ();
-    if (child < 0) {
-      perror ("vfork");
-      _exit(2);
-    }
-    if (!child) {
-      arg = getpid();
-      write(-1, "", 0);
-      _exit (arg);
-    }
-  }
+  /* glibc (up to about 1998-10-07) failed this test) */
+  struct tm tm;
+
+  /* Use the portable POSIX.1 specification "TZ=PST8PDT,M4.1.0,M10.5.0"
+     instead of "TZ=America/Vancouver" in order to detect the bug even
+     on systems that don't support the Olson extension, or don't have the
+     full zoneinfo tables installed.  */
+  putenv ("TZ=PST8PDT,M4.1.0,M10.5.0");
+
+  tm.tm_year = 98;
+  tm.tm_mon = 3;
+  tm.tm_mday = 5;
+  tm.tm_hour = 2;
+  tm.tm_min = 0;
+  tm.tm_sec = 0;
+  tm.tm_isdst = -1;
+  if (mktime (&tm) == (time_t)-1)
+    exit (1);
 }
 
-int
-main ()
+static void
+mktime_test (now)
+     time_t now;
 {
-  pid_t parent = getpid ();
-  pid_t child;
-
-  sparc_address_test ();
+  struct tm *lt;
+  if ((lt = localtime (&now)) && mktime (lt) != now)
+    exit (1);
+  now = time_t_max - now;
+  if ((lt = localtime (&now)) && mktime (lt) != now)
+    exit (1);
+}
 
-  child = vfork ();
+static void
+irix_6_4_bug ()
+{
+  /* Based on code from Ariel Faigon.  */
+  struct tm tm;
+  tm.tm_year = 96;
+  tm.tm_mon = 3;
+  tm.tm_mday = 0;
+  tm.tm_hour = 0;
+  tm.tm_min = 0;
+  tm.tm_sec = 0;
+  tm.tm_isdst = -1;
+  mktime (&tm);
+  if (tm.tm_mon != 2 || tm.tm_mday != 31)
+    exit (1);
+}
 
-  if (child == 0) {
-    /* Here is another test for sparc vfork register problems.  This
-       test uses lots of local variables, at least as many local
-       variables as main has allocated so far including compiler
-       temporaries.  4 locals are enough for gcc 1.40.3 on a Solaris
-       4.1.3 sparc, but we use 8 to be safe.  A buggy compiler should
-       reuse the register of parent for one of the local variables,
-       since it will think that parent can't possibly be used any more
-       in this routine.  Assigning to the local variable will thus
-       munge parent in the parent process.  */
-    pid_t
-      p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(),
-      p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid();
-    /* Convince the compiler that p..p7 are live; otherwise, it might
-       use the same hardware register for all 8 local variables.  */
-    if (p != p1 || p != p2 || p != p3 || p != p4
-       || p != p5 || p != p6 || p != p7)
-      _exit(1);
+static void
+bigtime_test (j)
+     int j;
+{
+  struct tm tm;
+  time_t now;
+  tm.tm_year = tm.tm_mon = tm.tm_mday = tm.tm_hour = tm.tm_min = tm.tm_sec = j;
+  now = mktime (&tm);
+  if (now != (time_t) -1)
+    {
+      struct tm *lt = localtime (&now);
+      if (! (lt
+            && lt->tm_year == tm.tm_year
+            && lt->tm_mon == tm.tm_mon
+            && lt->tm_mday == tm.tm_mday
+            && lt->tm_hour == tm.tm_hour
+            && lt->tm_min == tm.tm_min
+            && lt->tm_sec == tm.tm_sec
+            && lt->tm_yday == tm.tm_yday
+            && lt->tm_wday == tm.tm_wday
+            && ((lt->tm_isdst < 0 ? -1 : 0 < lt->tm_isdst)
+                 == (tm.tm_isdst < 0 ? -1 : 0 < tm.tm_isdst))))
+       exit (1);
+    }
+}
 
-    /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent
-       from child file descriptors.  If the child closes a descriptor
-       before it execs or exits, this munges the parent's descriptor
-       as well.  Test for this by closing stdout in the child.  */
-    _exit(close(fileno(stdout)) != 0);
-  } else {
-    int status;
-    struct stat st;
+int
+main ()
+{
+  time_t t, delta;
+  int i, j;
 
-    while (wait(&status) != child)
-      ;
-    exit(
-        /* Was there some problem with vforking?  */
-        child < 0
+  /* This test makes some buggy mktime implementations loop.
+     Give up after 60 seconds; a mktime slower than that
+     isn't worth using anyway.  */
+  alarm (60);
 
-        /* Did the child fail?  (This shouldn't happen.)  */
-        || status
+  for (time_t_max = 1; 0 < time_t_max; time_t_max *= 2)
+    continue;
+  time_t_max--;
+  delta = time_t_max / 997; /* a suitable prime number */
+  for (i = 0; i < N_STRINGS; i++)
+    {
+      if (tz_strings[i])
+       putenv (tz_strings[i]);
 
-        /* Did the vfork/compiler bug occur?  */
-        || parent != getpid()
+      for (t = 0; t <= time_t_max - delta; t += delta)
+       mktime_test (t);
+      mktime_test ((time_t) 60 * 60);
+      mktime_test ((time_t) 60 * 60 * 24);
 
-        /* Did the file descriptor bug occur?  */
-        || fstat(fileno(stdout), &st) != 0
-        );
-  }
+      for (j = 1; 0 < j; j *= 2)
+        bigtime_test (j);
+      bigtime_test (j - 1);
+    }
+  irix_6_4_bug ();
+  spring_forward_gap ();
+  exit (0);
 }],
-ac_cv_func_vfork_works=yes, ac_cv_func_vfork_works=no, AC_CHECK_FUNC(vfork)
-ac_cv_func_vfork_works=$ac_cv_func_vfork)])
-if test "x$ac_cv_func_vfork_works" = xno; then
-  AC_DEFINE(vfork, fork, [Define as `fork' if `vfork' does not work.])
+ac_cv_func_working_mktime=yes, ac_cv_func_working_mktime=no,
+ac_cv_func_working_mktime=no)])
+if test $ac_cv_func_working_mktime = no; then
+  LIBOBJS="$LIBOBJS mktime.${ac_objext}"
 fi
-])# AC_FUNC_VFORK
+])# AC_FUNC_MKTIME
 
 
-# AC_FUNC_WAIT3
-# -------------
-AC_DEFUN(AC_FUNC_WAIT3,
-[AC_CACHE_CHECK(for wait3 that fills in rusage, ac_cv_func_wait3_rusage,
+# AC_FUNC_MMAP
+# ------------
+AC_DEFUN(AC_FUNC_MMAP,
+[AC_CHECK_HEADERS(unistd.h)
+AC_CHECK_FUNCS(getpagesize)
+AC_CACHE_CHECK(for working mmap, ac_cv_func_mmap_fixed_mapped,
 [AC_TRY_RUN(
-[#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/resource.h>
-#include <stdio.h>
-/* HP-UX has wait3 but does not fill in rusage at all.  */
-int
-main ()
-{
-  struct rusage r;
-  int i;
-  /* Use a field that we can force nonzero --
-     voluntary context switches.
-     For systems like NeXT and OSF/1 that don't set it,
-     also use the system CPU time.  And page faults (I/O) for Linux.  */
-  r.ru_nvcsw = 0;
-  r.ru_stime.tv_sec = 0;
-  r.ru_stime.tv_usec = 0;
-  r.ru_majflt = r.ru_minflt = 0;
-  switch (fork ())
-    {
-    case 0: /* Child.  */
-      sleep(1); /* Give up the CPU.  */
-      _exit(0);
-    case -1: /* What can we do?  */
-      _exit(0);
-    default: /* Parent.  */
-      wait3(&i, 0, &r);
-      /* Avoid "text file busy" from rm on fast HP-UX machines.  */
-      sleep(2);
-      exit (r.ru_nvcsw == 0 && r.ru_majflt == 0 && r.ru_minflt == 0
-           && r.ru_stime.tv_sec == 0 && r.ru_stime.tv_usec == 0);
-    }
-}], ac_cv_func_wait3_rusage=yes, ac_cv_func_wait3_rusage=no,
-ac_cv_func_wait3_rusage=no)])
-if test $ac_cv_func_wait3_rusage = yes; then
-  AC_DEFINE(HAVE_WAIT3, 1,
-            [Define if you have the `wait3' system call.])
-fi
-])# AC_FUNC_WAIT3
+[/* Thanks to Mike Haertel and Jim Avera for this test.
+   Here is a matrix of mmap possibilities:
+       mmap private not fixed
+       mmap private fixed at somewhere currently unmapped
+       mmap private fixed at somewhere already mapped
+       mmap shared not fixed
+       mmap shared fixed at somewhere currently unmapped
+       mmap shared fixed at somewhere already mapped
+   For private mappings, we should verify that changes cannot be read()
+   back from the file, nor mmap's back from the file at a different
+   address.  (There have been systems where private was not correctly
+   implemented like the infamous i386 svr4.0, and systems where the
+   VM page cache was not coherent with the file system buffer cache
+   like early versions of FreeBSD and possibly contemporary NetBSD.)
+   For shared mappings, we should conversely verify that changes get
+   propogated back to all the places they're supposed to be.
 
+   Grep wants private fixed already mapped.
+   The main things grep needs to know about mmap are:
+   * does it exist and is it safe to write into the mmap'd area
+   * how to use it (BSD variants)  */
+#include <sys/types.h>
+#include <fcntl.h>
+#include <sys/mman.h>
 
-# AC_FUNC_ALLOCA
-# --------------
-AC_DEFUN(AC_FUNC_ALLOCA,
-[AC_REQUIRE_CPP()dnl Set CPP; we run AC_EGREP_CPP conditionally.
-# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
-# for constant arguments.  Useless!
-AC_CACHE_CHECK([for working alloca.h], ac_cv_working_alloca_h,
-[AC_TRY_LINK([#include <alloca.h>], [char *p = alloca(2 * sizeof(int));],
-  ac_cv_working_alloca_h=yes, ac_cv_working_alloca_h=no)])
-if test $ac_cv_working_alloca_h = yes; then
-  AC_DEFINE(HAVE_ALLOCA_H, 1,
-            [Define if you have <alloca.h> and it should be used
-             (not on Ultrix).])
-fi
+/* This mess was copied from the GNU getpagesize.h.  */
+#if !HAVE_GETPAGESIZE
+# if HAVE_UNISTD_H
+#  include <unistd.h>
+# endif
 
-AC_CACHE_CHECK([for alloca], ac_cv_func_alloca_works,
-[AC_TRY_LINK(
-[#ifdef __GNUC__
-# define alloca __builtin_alloca
-#else
-# ifdef _MSC_VER
-#  include <malloc.h>
-#  define alloca _alloca
-# else
-#  if HAVE_ALLOCA_H
-#   include <alloca.h>
-#  else
-#   ifdef _AIX
- #pragma alloca
-#   else
-#    ifndef alloca /* predefined by HP cc +Olibcalls */
-char *alloca ();
-#    endif
-#   endif
-#  endif
+/* Assume that all systems that can run configure have sys/param.h.  */
+# if !HAVE_SYS_PARAM_H
+#  define HAVE_SYS_PARAM_H 1
 # endif
-#endif
-], [char *p = (char *) alloca(1);],
-  ac_cv_func_alloca_works=yes, ac_cv_func_alloca_works=no)])
-if test $ac_cv_func_alloca_works = yes; then
-  AC_DEFINE(HAVE_ALLOCA, 1,
-            [Define if you have `alloca', as a function or macro.])
-fi
 
-if test $ac_cv_func_alloca_works = no; then
-  # The SVR3 libPW and SVR4 libucb both contain incompatible functions
-  # that cause trouble.  Some versions do not even contain alloca or
-  # contain a buggy version.  If you still want to use their alloca,
-  # use ar to extract alloca.o from them instead of compiling alloca.c.
-  ALLOCA=alloca.${ac_objext}
-  AC_DEFINE(C_ALLOCA, 1, [Define if using `alloca.c'.])
+# ifdef _SC_PAGESIZE
+#  define getpagesize() sysconf(_SC_PAGESIZE)
+# else /* no _SC_PAGESIZE */
+#  if HAVE_SYS_PARAM_H
+#   include <sys/param.h>
+#   ifdef EXEC_PAGESIZE
+#    define getpagesize() EXEC_PAGESIZE
+#   else /* no EXEC_PAGESIZE */
+#    ifdef NBPG
+#     define getpagesize() NBPG * CLSIZE
+#     ifndef CLSIZE
+#      define CLSIZE 1
+#     endif /* no CLSIZE */
+#    else /* no NBPG */
+#     ifdef NBPC
+#      define getpagesize() NBPC
+#     else /* no NBPC */
+#      ifdef PAGESIZE
+#       define getpagesize() PAGESIZE
+#      endif /* PAGESIZE */
+#     endif /* no NBPC */
+#    endif /* no NBPG */
+#   endif /* no EXEC_PAGESIZE */
+#  else /* no HAVE_SYS_PARAM_H */
+#   define getpagesize() 8192  /* punt totally */
+#  endif /* no HAVE_SYS_PARAM_H */
+# endif /* no _SC_PAGESIZE */
 
-AC_CACHE_CHECK(whether alloca needs Cray hooks, ac_cv_os_cray,
-[AC_EGREP_CPP(webecray,
-[#if defined(CRAY) && ! defined(CRAY2)
-webecray
+#endif /* no HAVE_GETPAGESIZE */
+
+#ifdef __cplusplus
+extern "C" { void *malloc(unsigned); }
 #else
-wenotbecray
+char *malloc();
 #endif
-], ac_cv_os_cray=yes, ac_cv_os_cray=no)])
-if test $ac_cv_os_cray = yes; then
-for ac_func in _getb67 GETB67 getb67; do
-  AC_CHECK_FUNC($ac_func,
-                [AC_DEFINE_UNQUOTED(CRAY_STACKSEG_END, $ac_func,
-                                    [Define to one of _getb67, GETB67, getb67
-                                     for Cray-2 and Cray-YMP systems.
-                                     This function is required for alloca.c
-                                     support on those systems.])
-  break])
-done
-fi
-
-AC_CACHE_CHECK(stack direction for C alloca, ac_cv_c_stack_direction,
-[AC_TRY_RUN(
-[find_stack_direction ()
-{
-  static char *addr = 0;
-  auto char dummy;
-  if (addr == 0)
-    {
-      addr = &dummy;
-      return find_stack_direction ();
-    }
-  else
-    return (&dummy > addr) ? 1 : -1;
-}
 
 int
 main ()
 {
-  exit (find_stack_direction () < 0);
-}], ac_cv_c_stack_direction=1, ac_cv_c_stack_direction=-1,
-  ac_cv_c_stack_direction=0)])
-AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction)
-fi
-AC_SUBST(ALLOCA)dnl
-])# AC_FUNC_ALLOCA
+  char *data, *data2, *data3;
+  int i, pagesize;
+  int fd;
 
+  pagesize = getpagesize ();
 
-# AC_FUNC_GETLOADAVG
-# ------------------
-AC_DEFUN(AC_FUNC_GETLOADAVG,
-[ac_have_func=no # yes means we've found a way to get the load average.
+  /* First, make a file with some known garbage in it. */
+  data = malloc (pagesize);
+  if (!data)
+    exit (1);
+  for (i = 0; i < pagesize; ++i)
+    *(data + i) = rand ();
+  umask (0);
+  fd = creat ("conftestmmap", 0600);
+  if (fd < 0)
+    exit (1);
+  if (write (fd, data, pagesize) != pagesize)
+    exit (1);
+  close (fd);
 
-# Some systems with -lutil have (and need) -lkvm as well, some do not.
-# On Solaris, -lkvm requires nlist from -lelf, so check that first
-# to get the right answer into the cache.
-AC_CHECK_LIB(elf, elf_begin, LIBS="-lelf $LIBS")
-AC_CHECK_LIB(kvm, kvm_open, LIBS="-lkvm $LIBS")
-AC_CHECK_LIB(kstat, kstat_open)
-# Check for the 4.4BSD definition of getloadavg.
-AC_CHECK_LIB(util, getloadavg,
-  [LIBS="-lutil $LIBS" ac_have_func=yes ac_cv_func_getloadavg_setgid=yes])
+  /* Next, try to mmap the file at a fixed address which already has
+     something else allocated at it.  If we can, also make sure that
+     we see the same garbage.  */
+  fd = open ("conftestmmap", O_RDWR);
+  if (fd < 0)
+    exit (1);
+  data2 = malloc (2 * pagesize);
+  if (!data2)
+    exit (1);
+  data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1);
+  if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE,
+                     MAP_PRIVATE | MAP_FIXED, fd, 0L))
+    exit (1);
+  for (i = 0; i < pagesize; ++i)
+    if (*(data + i) != *(data2 + i))
+      exit (1);
 
-if test $ac_have_func = no; then
-  # There is a commonly available library for RS/6000 AIX.
-  # Since it is not a standard part of AIX, it might be installed locally.
-  ac_getloadavg_LIBS="$LIBS"; LIBS="-L/usr/local/lib $LIBS"
-  AC_CHECK_LIB(getloadavg, getloadavg,
-    LIBS="-lgetloadavg $LIBS", LIBS="$ac_getloadavg_LIBS")
+  /* Finally, make sure that changes to the mapped area do not
+     percolate back to the file as seen by read().  (This is a bug on
+     some variants of i386 svr4.0.)  */
+  for (i = 0; i < pagesize; ++i)
+    *(data2 + i) = *(data2 + i) + 1;
+  data3 = malloc (pagesize);
+  if (!data3)
+    exit (1);
+  if (read (fd, data3, pagesize) != pagesize)
+    exit (1);
+  for (i = 0; i < pagesize; ++i)
+    if (*(data + i) != *(data3 + i))
+      exit (1);
+  close (fd);
+  unlink ("conftestmmap");
+  exit (0);
+}], ac_cv_func_mmap_fixed_mapped=yes, ac_cv_func_mmap_fixed_mapped=no,
+ac_cv_func_mmap_fixed_mapped=no)])
+if test $ac_cv_func_mmap_fixed_mapped = yes; then
+  AC_DEFINE(HAVE_MMAP, 1,
+            [Define if you have a working `mmap' system call.])
 fi
+])# AC_FUNC_MMAP
 
-# Make sure it is really in the library, if we think we found it.
-AC_REPLACE_FUNCS(getloadavg)
-
-if test $ac_cv_func_getloadavg = yes; then
-  AC_DEFINE(HAVE_GETLOADAVG, 1,
-            [Define if your system has its own `getloadavg' function.])
-  ac_have_func=yes
-else
-  # Figure out what our getloadavg.c needs.
-  ac_have_func=no
-  AC_CHECK_HEADER(sys/dg_sys_info.h,
-  [ac_have_func=yes;
-   AC_DEFINE(DGUX, 1, [Define for DGUX with <sys/dg_sys_info.h>.])
-   AC_CHECK_LIB(dgc, dg_sys_info)])
-
-  # We cannot check for <dwarf.h>, because Solaris 2 does not use dwarf (it
-  # uses stabs), but it is still SVR4.  We cannot check for <elf.h> because
-  # Irix 4.0.5F has the header but not the library.
-  if test $ac_have_func = no && test $ac_cv_lib_elf_elf_begin = yes; then
-    ac_have_func=yes;
-    AC_DEFINE(SVR4, 1,
-              [Define on System V Release 4.])
-  fi
-
-  if test $ac_have_func = no; then
-    AC_CHECK_HEADER(inq_stats/cpustats.h,
-    [ac_have_func=yes;
-     AC_DEFINE(UMAX, 1,
-               [Define for Encore UMAX.])
-     AC_DEFINE(UMAX4_3, 1,
-               [Define for Encore UMAX 4.3 that has <inq_status/cpustats.h>
-                instead of <sys/cpustats.h>.])])
-  fi
-
-  if test $ac_have_func = no; then
-    AC_CHECK_HEADER(sys/cpustats.h,
-    [ac_have_func=yes; AC_DEFINE(UMAX)])
-  fi
-
-  if test $ac_have_func = no; then
-    AC_CHECK_HEADERS(mach/mach.h)
-  fi
 
-  AC_CHECK_HEADER(nlist.h,
-  [AC_DEFINE(NLIST_STRUCT, 1, [Define if you have <nlist.h>.])
-  AC_CACHE_CHECK([for n_un in struct nlist], ac_cv_struct_nlist_n_un,
-  [AC_TRY_COMPILE([#include <nlist.h>
-],
-                  [struct nlist n; n.n_un.n_name = 0;],
-                  ac_cv_struct_nlist_n_un=yes, ac_cv_struct_nlist_n_un=no)])
-  if test $ac_cv_struct_nlist_n_un = yes; then
-    AC_DEFINE(NLIST_NAME_UNION, 1,
-              [Define if your `struct nlist' has an `n_un' member.])
-  fi
-  ])dnl
-fi # Do not have getloadavg in system libraries.
+# AC_FUNC_MEMCMP
+# --------------
+AC_DEFUN(AC_FUNC_MEMCMP,
+[AC_CACHE_CHECK(for 8-bit clean memcmp, ac_cv_func_memcmp_clean,
+[AC_TRY_RUN(
+[int
+main()
+{
+  char c0 = 0x40, c1 = 0x80, c2 = 0x81;
+  exit (memcmp(&c0, &c2, 1) < 0
+        && memcmp(&c1, &c2, 1) < 0 ? 0 : 1);
+}], ac_cv_func_memcmp_clean=yes, ac_cv_func_memcmp_clean=no,
+ac_cv_func_memcmp_clean=no)])
+test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.${ac_objext}"
+AC_SUBST(LIBOBJS)dnl
+])# AC_FUNC_MEMCMP
 
-# Some definitions of getloadavg require that the program be installed setgid.
-dnl FIXME: Don't hardwire the path of getloadavg.c in the top-level directory.
-AC_CACHE_CHECK(whether getloadavg requires setgid,
-  ac_cv_func_getloadavg_setgid,
-[AC_EGREP_CPP([Yowza Am I SETGID yet],
-[#include "$srcdir/getloadavg.c"
-#ifdef LDAV_PRIVILEGED
-Yowza Am I SETGID yet
-#endif],
-  ac_cv_func_getloadavg_setgid=yes, ac_cv_func_getloadavg_setgid=no)])
-if test $ac_cv_func_getloadavg_setgid = yes; then
-  NEED_SETGID=true;
-  AC_DEFINE(GETLOADAVG_PRIVILEGED, 1,
-            [Define if the `getloadavg' function needs to be run setuid
-             or setgid.])
-else
-  NEED_SETGID=false
-fi
-AC_SUBST(NEED_SETGID)dnl
 
-if test $ac_cv_func_getloadavg_setgid = yes; then
-  AC_CACHE_CHECK(group of /dev/kmem, ac_cv_group_kmem,
-[ # On Solaris, /dev/kmem is a symlink.  Get info on the real file.
-  ac_ls_output=`ls -lgL /dev/kmem 2>/dev/null`
-  # If we got an error (system does not support symlinks), try without -L.
-  test -z "$ac_ls_output" && ac_ls_output=`ls -lg /dev/kmem`
-  ac_cv_group_kmem=`echo $ac_ls_output \
-    | sed -ne ['s/[    ][      ]*/ /g;
-              s/^.[sSrwx-]* *[0-9]* *\([^0-9]*\)  *.*/\1/;
-              / /s/.* //;p;']`
-])
-  KMEM_GROUP=$ac_cv_group_kmem
-fi
-AC_SUBST(KMEM_GROUP)dnl
-])# AC_FUNC_GETLOADAVG
+# AC_FUNC_SELECT_ARGTYPES
+# -----------------------
+AC_DEFUN(AC_FUNC_SELECT_ARGTYPES,
+[AC_MSG_CHECKING([types of arguments for select()])
+ AC_CACHE_VAL(ac_cv_func_select_arg234,dnl
+ [AC_CACHE_VAL(ac_cv_func_select_arg1,dnl
+  [AC_CACHE_VAL(ac_cv_func_select_arg5,dnl
+   [for ac_cv_func_select_arg234 in 'fd_set *' 'int *' 'void *'; do
+     for ac_cv_func_select_arg1 in 'int' 'size_t' 'unsigned long' 'unsigned'; do
+      for ac_cv_func_select_arg5 in 'struct timeval *' 'const struct timeval *'; do
+       AC_TRY_COMPILE(
+[#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#if HAVE_SYS_TIME_H
+# include <sys/time.h>
+#endif
+#if HAVE_SYS_SELECT_H
+# include <sys/select.h>
+#endif
+#if HAVE_SYS_SOCKET_H
+# include <sys/socket.h>
+#endif
+extern select ($ac_cv_func_select_arg1,$ac_cv_func_select_arg234,$ac_cv_func_select_arg234,$ac_cv_func_select_arg234,$ac_cv_func_select_arg5);],,dnl
+        [ac_not_found=no ; break 3],ac_not_found=yes)
+      done
+     done
+    done
+   ])dnl AC_CACHE_VAL
+  ])dnl AC_CACHE_VAL
+ ])dnl AC_CACHE_VAL
+ if test "$ac_not_found" = yes; then
+  ac_cv_func_select_arg1=int
+  ac_cv_func_select_arg234='int *'
+  ac_cv_func_select_arg5='struct timeval *'
+ fi
+ AC_MSG_RESULT([$ac_cv_func_select_arg1,$ac_cv_func_select_arg234,$ac_cv_func_select_arg5])
+ AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG1, $ac_cv_func_select_arg1,
+                    [Define to the type of arg 1 for `select'.])
+ AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG234, ($ac_cv_func_select_arg234),
+                    [Define to the type of args 2, 3 and 4 for `select'.])
+ AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG5, ($ac_cv_func_select_arg5),
+                    [Define to the type of arg 5 for `select'.])
+])# AC_FUNC_SELECT_ARGTYPES
 
 
-# AC_FUNC_UTIME_NULL
-# ------------------
-AC_DEFUN(AC_FUNC_UTIME_NULL,
-[AC_CACHE_CHECK(whether utime accepts a null argument, ac_cv_func_utime_null,
-[rm -f conftestdata; >conftestdata
-# Sequent interprets utime(file, 0) to mean use start of epoch.  Wrong.
+# AC_FUNC_SETPGRP
+# ---------------
+AC_DEFUN(AC_FUNC_SETPGRP,
+[AC_CACHE_CHECK(whether setpgrp takes no argument, ac_cv_func_setpgrp_void,
 AC_TRY_RUN(
-[#include <sys/types.h>
-#include <sys/stat.h>
-int
-main()
-{
-  struct stat s, t;
-  exit (!(stat ("conftestdata", &s) == 0
-          && utime ("conftestdata", (long *)0) == 0
-          && stat ("conftestdata", &t) == 0
-          && t.st_mtime >= s.st_mtime
-          && t.st_mtime - s.st_mtime < 120));
-}], ac_cv_func_utime_null=yes, ac_cv_func_utime_null=no,
-  ac_cv_func_utime_null=no)
-rm -f core core.* *.core])
-if test $ac_cv_func_utime_null = yes; then
-  AC_DEFINE(HAVE_UTIME_NULL, 1,
-            [Define if `utime(file, NULL)' sets file's timestamp to the
-             present.])
-fi
-])# AC_FUNC_UTIME_NULL
+[#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
 
+/* If this system has a BSD-style setpgrp, which takes arguments, exit
+   successfully.  */
 
-# AC_FUNC_STRCOLL
-# ---------------
-AC_DEFUN(AC_FUNC_STRCOLL,
-[AC_CACHE_CHECK(for working strcoll, ac_cv_func_strcoll_works,
-[AC_TRY_RUN([#include <string.h>
 int
 main ()
 {
-  exit (strcoll ("abc", "def") >= 0 ||
-       strcoll ("ABC", "DEF") >= 0 ||
-       strcoll ("123", "456") >= 0);
-}], ac_cv_func_strcoll_works=yes, ac_cv_func_strcoll_works=no,
-ac_cv_func_strcoll_works=no)])
-if test $ac_cv_func_strcoll_works = yes; then
-  AC_DEFINE(HAVE_STRCOLL, 1,
-            [Define if you have the `strcoll' function and it is properly
-             defined.])
+  if (setpgrp (1,1) == -1)
+    exit (0);
+  else
+    exit (1);
+}], ac_cv_func_setpgrp_void=no, ac_cv_func_setpgrp_void=yes,
+   AC_MSG_ERROR(cannot check setpgrp if cross compiling))
+)
+if test $ac_cv_func_setpgrp_void = yes; then
+  AC_DEFINE(SETPGRP_VOID, 1,
+            [Define if the `setpgrp' function takes no argument.])
 fi
-])# AC_FUNC_STRCOLL
+])# AC_FUNC_SETPGRP
 
 
-# AC_FUNC_SETVBUF_REVERSED
-# ------------------------
-AC_DEFUN(AC_FUNC_SETVBUF_REVERSED,
-[AC_CACHE_CHECK(whether setvbuf arguments are reversed,
-  ac_cv_func_setvbuf_reversed,
-[AC_TRY_RUN([#include <stdio.h>
-/* If setvbuf has the reversed format, exit 0. */
+# AC_FUNC_STRFTIME
+# ----------------
+AC_DEFUN(AC_FUNC_STRFTIME,
+[AC_CHECK_FUNC(strftime,
+               [AC_DEFINE(HAVE_STRFTIME, 1,
+                          [Define if you have the `strftime' function.])],
+[# strftime is in -lintl on SCO UNIX.
+AC_CHECK_LIB(intl, strftime,
+[AC_DEFINE(HAVE_STRFTIME, 1,
+           [Define if you have the `strftime' function.])
+LIBS="-lintl $LIBS"])])dnl
+])# AC_FUNC_STRFTIME
+
+
+# AC_FUNC_VFORK
+# -------------
+AC_DEFUN(AC_FUNC_VFORK,
+[AC_REQUIRE([AC_TYPE_PID_T])dnl
+AC_CHECK_HEADER(vfork.h,
+                AC_DEFINE(HAVE_VFORK_H, 1,
+                          [Define if you have <vfork.h>.]))
+AC_CACHE_CHECK(for working vfork, ac_cv_func_vfork_works,
+[AC_TRY_RUN([/* Thanks to Paul Eggert for this test.  */
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+#if HAVE_VFORK_H
+# include <vfork.h>
+#endif
+/* On some sparc systems, changes by the child to local and incoming
+   argument registers are propagated back to the parent.  The compiler
+   is told about this with #include <vfork.h>, but some compilers
+   (e.g. gcc -O) don't grok <vfork.h>.  Test for this by using a
+   static variable whose address is put into a register that is
+   clobbered by the vfork.  */
+static
+#ifdef __cplusplus
+sparc_address_test (int arg)
+# else
+sparc_address_test (arg) int arg;
+#endif
+{
+  static pid_t child;
+  if (!child) {
+    child = vfork ();
+    if (child < 0) {
+      perror ("vfork");
+      _exit(2);
+    }
+    if (!child) {
+      arg = getpid();
+      write(-1, "", 0);
+      _exit (arg);
+    }
+  }
+}
+
 int
 main ()
 {
-  /* This call has the arguments reversed.
-     A reversed system may check and see that the address of main
-     is not _IOLBF, _IONBF, or _IOFBF, and return nonzero.  */
-  if (setvbuf(stdout, _IOLBF, (char *) main, BUFSIZ) != 0)
-    exit(1);
-  putc('\r', stdout);
-  exit(0);                     /* Non-reversed systems segv here.  */
-}], ac_cv_func_setvbuf_reversed=yes, ac_cv_func_setvbuf_reversed=no)
-rm -f core core.* *.core])
-if test $ac_cv_func_setvbuf_reversed = yes; then
-  AC_DEFINE(SETVBUF_REVERSED, 1,
-            [Define if the `setvbuf' function takes the buffering type as
-             its second argument and the buffer pointer as the third, as on
-             System V before release 3.])
-fi
-])# AC_FUNC_SETVBUF_REVERSED
-
-
-# AC_FUNC_GETMNTENT
-# -----------------
-AC_DEFUN(AC_FUNC_GETMNTENT,
-[# getmntent is in -lsun on Irix 4, -lseq on Dynix/PTX, -lgen on Unixware.
-AC_CHECK_LIB(sun, getmntent, LIBS="-lsun $LIBS",
-  [AC_CHECK_LIB(seq, getmntent, LIBS="-lseq $LIBS",
-    [AC_CHECK_LIB(gen, getmntent, LIBS="-lgen $LIBS")])])
-AC_CHECK_FUNC(getmntent,
-              [AC_DEFINE(HAVE_GETMNTENT, 1,
-                         [Define if you have the `getmntent' function.])])])
-
+  pid_t parent = getpid ();
+  pid_t child;
 
-# AC_FUNC_MKTIME
-# --------------
-AC_DEFUN(AC_FUNC_MKTIME,
-[AC_REQUIRE([AC_HEADER_TIME])dnl
-AC_CHECK_HEADERS(sys/time.h unistd.h)
-AC_CHECK_FUNCS(alarm)
-AC_CACHE_CHECK([for working mktime], ac_cv_func_working_mktime,
-[AC_TRY_RUN(
-[/* Test program from Paul Eggert and Tony Leneis.  */
-#if TIME_WITH_SYS_TIME
-# include <sys/time.h>
-# include <time.h>
-#else
-# if HAVE_SYS_TIME_H
-#  include <sys/time.h>
-# else
-#  include <time.h>
-# endif
-#endif
+  sparc_address_test ();
 
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
+  child = vfork ();
 
-#if !HAVE_ALARM
-# define alarm(X) /* empty */
-#endif
+  if (child == 0) {
+    /* Here is another test for sparc vfork register problems.  This
+       test uses lots of local variables, at least as many local
+       variables as main has allocated so far including compiler
+       temporaries.  4 locals are enough for gcc 1.40.3 on a Solaris
+       4.1.3 sparc, but we use 8 to be safe.  A buggy compiler should
+       reuse the register of parent for one of the local variables,
+       since it will think that parent can't possibly be used any more
+       in this routine.  Assigning to the local variable will thus
+       munge parent in the parent process.  */
+    pid_t
+      p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(),
+      p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid();
+    /* Convince the compiler that p..p7 are live; otherwise, it might
+       use the same hardware register for all 8 local variables.  */
+    if (p != p1 || p != p2 || p != p3 || p != p4
+       || p != p5 || p != p6 || p != p7)
+      _exit(1);
 
-/* Work around redefinition to rpl_putenv by other config tests.  */
-#undef putenv
+    /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent
+       from child file descriptors.  If the child closes a descriptor
+       before it execs or exits, this munges the parent's descriptor
+       as well.  Test for this by closing stdout in the child.  */
+    _exit(close(fileno(stdout)) != 0);
+  } else {
+    int status;
+    struct stat st;
 
-static time_t time_t_max;
+    while (wait(&status) != child)
+      ;
+    exit(
+        /* Was there some problem with vforking?  */
+        child < 0
 
-/* Values we'll use to set the TZ environment variable.  */
-static const char *const tz_strings[] = {
-  (const char *) 0, "TZ=GMT0", "TZ=JST-9",
-  "TZ=EST+3EDT+2,M10.1.0/00:00:00,M2.3.0/00:00:00"
-};
-#define N_STRINGS (sizeof (tz_strings) / sizeof (tz_strings[0]))
+        /* Did the child fail?  (This shouldn't happen.)  */
+        || status
 
-/* Fail if mktime fails to convert a date in the spring-forward gap.
-   Based on a problem report from Andreas Jaeger.  */
-static void
-spring_forward_gap ()
-{
-  /* glibc (up to about 1998-10-07) failed this test) */
-  struct tm tm;
+        /* Did the vfork/compiler bug occur?  */
+        || parent != getpid()
 
-  /* Use the portable POSIX.1 specification "TZ=PST8PDT,M4.1.0,M10.5.0"
-     instead of "TZ=America/Vancouver" in order to detect the bug even
-     on systems that don't support the Olson extension, or don't have the
-     full zoneinfo tables installed.  */
-  putenv ("TZ=PST8PDT,M4.1.0,M10.5.0");
+        /* Did the file descriptor bug occur?  */
+        || fstat(fileno(stdout), &st) != 0
+        );
+  }
+}],
+ac_cv_func_vfork_works=yes, ac_cv_func_vfork_works=no, AC_CHECK_FUNC(vfork)
+ac_cv_func_vfork_works=$ac_cv_func_vfork)])
+if test "x$ac_cv_func_vfork_works" = xno; then
+  AC_DEFINE(vfork, fork, [Define as `fork' if `vfork' does not work.])
+fi
+])# AC_FUNC_VFORK
 
-  tm.tm_year = 98;
-  tm.tm_mon = 3;
-  tm.tm_mday = 5;
-  tm.tm_hour = 2;
-  tm.tm_min = 0;
-  tm.tm_sec = 0;
-  tm.tm_isdst = -1;
-  if (mktime (&tm) == (time_t)-1)
-    exit (1);
-}
 
-static void
-mktime_test (now)
-     time_t now;
-{
-  struct tm *lt;
-  if ((lt = localtime (&now)) && mktime (lt) != now)
-    exit (1);
-  now = time_t_max - now;
-  if ((lt = localtime (&now)) && mktime (lt) != now)
-    exit (1);
-}
+# AC_FUNC_VPRINTF
+# ---------------
+# Why the heck is that _doprnt does not define HAVE__DOPRNT???
+# That the logical name!  In addition, why doesn't it use
+# AC_CHECK_FUNCS(vprintf)?  Because old Autoconf uses sh for loops.
+# FIXME: To be changed in Autoconf 3?
+AC_DEFUN(AC_FUNC_VPRINTF,
+[AC_CHECK_FUNC(vprintf,
+               AC_DEFINE(HAVE_VPRINTF, 1,
+               [Define if you have the `vprintf' function.]))
+if test "$ac_cv_func_vprintf" != yes; then
+AC_CHECK_FUNC(_doprnt,
+              AC_DEFINE(HAVE_DOPRNT, 1,
+                        [Define if you don't have `vprintf' but do have
+                         `_doprnt.']))
+fi
+])
 
-static void
-irix_6_4_bug ()
-{
-  /* Based on code from Ariel Faigon.  */
-  struct tm tm;
-  tm.tm_year = 96;
-  tm.tm_mon = 3;
-  tm.tm_mday = 0;
-  tm.tm_hour = 0;
-  tm.tm_min = 0;
-  tm.tm_sec = 0;
-  tm.tm_isdst = -1;
-  mktime (&tm);
-  if (tm.tm_mon != 2 || tm.tm_mday != 31)
-    exit (1);
-}
 
-static void
-bigtime_test (j)
-     int j;
+# AC_FUNC_WAIT3
+# -------------
+AC_DEFUN(AC_FUNC_WAIT3,
+[AC_CACHE_CHECK(for wait3 that fills in rusage, ac_cv_func_wait3_rusage,
+[AC_TRY_RUN(
+[#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+#include <stdio.h>
+/* HP-UX has wait3 but does not fill in rusage at all.  */
+int
+main ()
 {
-  struct tm tm;
-  time_t now;
-  tm.tm_year = tm.tm_mon = tm.tm_mday = tm.tm_hour = tm.tm_min = tm.tm_sec = j;
-  now = mktime (&tm);
-  if (now != (time_t) -1)
+  struct rusage r;
+  int i;
+  /* Use a field that we can force nonzero --
+     voluntary context switches.
+     For systems like NeXT and OSF/1 that don't set it,
+     also use the system CPU time.  And page faults (I/O) for Linux.  */
+  r.ru_nvcsw = 0;
+  r.ru_stime.tv_sec = 0;
+  r.ru_stime.tv_usec = 0;
+  r.ru_majflt = r.ru_minflt = 0;
+  switch (fork ())
     {
-      struct tm *lt = localtime (&now);
-      if (! (lt
-            && lt->tm_year == tm.tm_year
-            && lt->tm_mon == tm.tm_mon
-            && lt->tm_mday == tm.tm_mday
-            && lt->tm_hour == tm.tm_hour
-            && lt->tm_min == tm.tm_min
-            && lt->tm_sec == tm.tm_sec
-            && lt->tm_yday == tm.tm_yday
-            && lt->tm_wday == tm.tm_wday
-            && ((lt->tm_isdst < 0 ? -1 : 0 < lt->tm_isdst)
-                 == (tm.tm_isdst < 0 ? -1 : 0 < tm.tm_isdst))))
-       exit (1);
+    case 0: /* Child.  */
+      sleep(1); /* Give up the CPU.  */
+      _exit(0);
+    case -1: /* What can we do?  */
+      _exit(0);
+    default: /* Parent.  */
+      wait3(&i, 0, &r);
+      /* Avoid "text file busy" from rm on fast HP-UX machines.  */
+      sleep(2);
+      exit (r.ru_nvcsw == 0 && r.ru_majflt == 0 && r.ru_minflt == 0
+           && r.ru_stime.tv_sec == 0 && r.ru_stime.tv_usec == 0);
     }
-}
+}], ac_cv_func_wait3_rusage=yes, ac_cv_func_wait3_rusage=no,
+ac_cv_func_wait3_rusage=no)])
+if test $ac_cv_func_wait3_rusage = yes; then
+  AC_DEFINE(HAVE_WAIT3, 1,
+            [Define if you have the `wait3' system call.])
+fi
+])# AC_FUNC_WAIT3
+
 
+# AC_FUNC_UTIME_NULL
+# ------------------
+AC_DEFUN(AC_FUNC_UTIME_NULL,
+[AC_CACHE_CHECK(whether utime accepts a null argument, ac_cv_func_utime_null,
+[rm -f conftestdata; >conftestdata
+# Sequent interprets utime(file, 0) to mean use start of epoch.  Wrong.
+AC_TRY_RUN(
+[#include <sys/types.h>
+#include <sys/stat.h>
 int
-main ()
+main()
 {
-  time_t t, delta;
-  int i, j;
-
-  /* This test makes some buggy mktime implementations loop.
-     Give up after 60 seconds; a mktime slower than that
-     isn't worth using anyway.  */
-  alarm (60);
-
-  for (time_t_max = 1; 0 < time_t_max; time_t_max *= 2)
-    continue;
-  time_t_max--;
-  delta = time_t_max / 997; /* a suitable prime number */
-  for (i = 0; i < N_STRINGS; i++)
-    {
-      if (tz_strings[i])
-       putenv (tz_strings[i]);
-
-      for (t = 0; t <= time_t_max - delta; t += delta)
-       mktime_test (t);
-      mktime_test ((time_t) 60 * 60);
-      mktime_test ((time_t) 60 * 60 * 24);
-
-      for (j = 1; 0 < j; j *= 2)
-        bigtime_test (j);
-      bigtime_test (j - 1);
-    }
-  irix_6_4_bug ();
-  spring_forward_gap ();
-  exit (0);
-}],
-ac_cv_func_working_mktime=yes, ac_cv_func_working_mktime=no,
-ac_cv_func_working_mktime=no)])
-if test $ac_cv_func_working_mktime = no; then
-  LIBOBJS="$LIBOBJS mktime.${ac_objext}"
+  struct stat s, t;
+  exit (!(stat ("conftestdata", &s) == 0
+          && utime ("conftestdata", (long *)0) == 0
+          && stat ("conftestdata", &t) == 0
+          && t.st_mtime >= s.st_mtime
+          && t.st_mtime - s.st_mtime < 120));
+}], ac_cv_func_utime_null=yes, ac_cv_func_utime_null=no,
+  ac_cv_func_utime_null=no)
+rm -f core core.* *.core])
+if test $ac_cv_func_utime_null = yes; then
+  AC_DEFINE(HAVE_UTIME_NULL, 1,
+            [Define if `utime(file, NULL)' sets file's timestamp to the
+             present.])
 fi
-])# AC_FUNC_MKTIME
+])# AC_FUNC_UTIME_NULL
 
 
-# AC_FUNC_STRFTIME
-# ----------------
-AC_DEFUN(AC_FUNC_STRFTIME,
-[AC_CHECK_FUNC(strftime,
-               [AC_DEFINE(HAVE_STRFTIME, 1,
-                          [Define if you have the `strftime' function.])],
-[# strftime is in -lintl on SCO UNIX.
-AC_CHECK_LIB(intl, strftime,
-[AC_DEFINE(HAVE_STRFTIME, 1,
-           [Define if you have the `strftime' function.])
-LIBS="-lintl $LIBS"])])dnl
-])# AC_FUNC_STRFTIME
+# AC_FUNC_STRCOLL
+# ---------------
+AC_DEFUN(AC_FUNC_STRCOLL,
+[AC_CACHE_CHECK(for working strcoll, ac_cv_func_strcoll_works,
+[AC_TRY_RUN([#include <string.h>
+int
+main ()
+{
+  exit (strcoll ("abc", "def") >= 0 ||
+       strcoll ("ABC", "DEF") >= 0 ||
+       strcoll ("123", "456") >= 0);
+}], ac_cv_func_strcoll_works=yes, ac_cv_func_strcoll_works=no,
+ac_cv_func_strcoll_works=no)])
+if test $ac_cv_func_strcoll_works = yes; then
+  AC_DEFINE(HAVE_STRCOLL, 1,
+            [Define if you have the `strcoll' function and it is properly
+             defined.])
+fi
+])# AC_FUNC_STRCOLL
 
 
-# AC_FUNC_MEMCMP
-# --------------
-AC_DEFUN(AC_FUNC_MEMCMP,
-[AC_CACHE_CHECK(for 8-bit clean memcmp, ac_cv_func_memcmp_clean,
-[AC_TRY_RUN(
-[int
-main()
+# AC_FUNC_SETVBUF_REVERSED
+# ------------------------
+AC_DEFUN(AC_FUNC_SETVBUF_REVERSED,
+[AC_CACHE_CHECK(whether setvbuf arguments are reversed,
+  ac_cv_func_setvbuf_reversed,
+[AC_TRY_RUN([#include <stdio.h>
+/* If setvbuf has the reversed format, exit 0. */
+int
+main ()
 {
-  char c0 = 0x40, c1 = 0x80, c2 = 0x81;
-  exit (memcmp(&c0, &c2, 1) < 0
-        && memcmp(&c1, &c2, 1) < 0 ? 0 : 1);
-}], ac_cv_func_memcmp_clean=yes, ac_cv_func_memcmp_clean=no,
-ac_cv_func_memcmp_clean=no)])
-test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.${ac_objext}"
-AC_SUBST(LIBOBJS)dnl
-])# AC_FUNC_MEMCMP
-
+  /* This call has the arguments reversed.
+     A reversed system may check and see that the address of main
+     is not _IOLBF, _IONBF, or _IOFBF, and return nonzero.  */
+  if (setvbuf(stdout, _IOLBF, (char *) main, BUFSIZ) != 0)
+    exit(1);
+  putc('\r', stdout);
+  exit(0);                     /* Non-reversed systems segv here.  */
+}], ac_cv_func_setvbuf_reversed=yes, ac_cv_func_setvbuf_reversed=no)
+rm -f core core.* *.core])
+if test $ac_cv_func_setvbuf_reversed = yes; then
+  AC_DEFINE(SETVBUF_REVERSED, 1,
+            [Define if the `setvbuf' function takes the buffering type as
+             its second argument and the buffer pointer as the third, as on
+             System V before release 3.])
+fi
+])# AC_FUNC_SETVBUF_REVERSED
 
-# AC_FUNC_SELECT_ARGTYPES
-# -----------------------
-AC_DEFUN(AC_FUNC_SELECT_ARGTYPES,
-[AC_MSG_CHECKING([types of arguments for select()])
- AC_CACHE_VAL(ac_cv_func_select_arg234,dnl
- [AC_CACHE_VAL(ac_cv_func_select_arg1,dnl
-  [AC_CACHE_VAL(ac_cv_func_select_arg5,dnl
-   [for ac_cv_func_select_arg234 in 'fd_set *' 'int *' 'void *'; do
-     for ac_cv_func_select_arg1 in 'int' 'size_t' 'unsigned long' 'unsigned'; do
-      for ac_cv_func_select_arg5 in 'struct timeval *' 'const struct timeval *'; do
-       AC_TRY_COMPILE(dnl
-[#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-#if HAVE_SYS_TIME_H
-# include <sys/time.h>
-#endif
-#if HAVE_SYS_SELECT_H
-# include <sys/select.h>
-#endif
-#if HAVE_SYS_SOCKET_H
-# include <sys/socket.h>
-#endif
-extern select ($ac_cv_func_select_arg1,$ac_cv_func_select_arg234,$ac_cv_func_select_arg234,$ac_cv_func_select_arg234,$ac_cv_func_select_arg5);],,dnl
-        [ac_not_found=no ; break 3],ac_not_found=yes)
-      done
-     done
-    done
-   ])dnl AC_CACHE_VAL
-  ])dnl AC_CACHE_VAL
- ])dnl AC_CACHE_VAL
- if test "$ac_not_found" = yes; then
-  ac_cv_func_select_arg1=int
-  ac_cv_func_select_arg234='int *'
-  ac_cv_func_select_arg5='struct timeval *'
- fi
- AC_MSG_RESULT([$ac_cv_func_select_arg1,$ac_cv_func_select_arg234,$ac_cv_func_select_arg5])
- AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG1, $ac_cv_func_select_arg1,
-                    [Define to the type of arg1 for `select'.])
- AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG234, ($ac_cv_func_select_arg234),
-                    [Define to the type of args 2, 3 and 4 for `select'.])
- AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG5, ($ac_cv_func_select_arg5),
-                    [Define to the type of arg5 for `select'.])
-])# AC_FUNC_SELECT_ARGTYPES
 
 
 
@@ -2249,23 +2276,6 @@ extern select ($ac_cv_func_select_arg1,$ac_cv_func_select_arg234,$ac_cv_func_sel
 ## ------------------------------ ##
 
 
-# AC_HEADER_TIME
-# --------------
-AC_DEFUN(AC_HEADER_TIME,
-[AC_CACHE_CHECK([whether time.h and sys/time.h may both be included],
-  ac_cv_header_time,
-[AC_TRY_COMPILE([#include <sys/types.h>
-#include <sys/time.h>
-#include <time.h>
-],
-[struct tm *tp;], ac_cv_header_time=yes, ac_cv_header_time=no)])
-if test $ac_cv_header_time = yes; then
-  AC_DEFINE(TIME_WITH_SYS_TIME, 1,
-            [Define if you can safely include both <sys/time.h> and <time.h>.])
-fi
-])# AC_HEADER_TIME
-
-
 # AC_STRUCT_TM
 # ------------
 # FIXME: This macro is badly named, it should be AC_CHECK_TYPE_STRUCT_TM.
@@ -2656,31 +2666,11 @@ fi
 ])# AC_C_PROTOTYPES
 
 
-# AC_OBJEXT
-# ---------
-# Check the object extension used by the compiler: typically .o or
-# .obj.  If this is called, some other behaviour will change,
-# determined by ac_objext.
-AC_DEFUN(AC_OBJEXT,
-[AC_MSG_CHECKING([for object suffix])
-AC_CACHE_VAL(ac_cv_objext,
-[rm -f conftest*
-echo 'int i = 1;' >conftest.$ac_ext
-if AC_TRY_EVAL(ac_compile); then
-  for ac_file in conftest.*; do
-    case $ac_file in
-    *.c) ;;
-    *) ac_cv_objext=`echo $ac_file | sed -e s/conftest.//` ;;
-    esac
-  done
-else
-  AC_MSG_ERROR([installation or configuration problem; compiler does not work])
-fi
-rm -f conftest*])
-AC_MSG_RESULT($ac_cv_objext)
-OBJEXT=$ac_cv_objext
-ac_objext=$ac_cv_objext
-AC_SUBST(OBJEXT)])
+
+
+## ----------------------------------------- ##
+## Checks for F77 compiler characteristics.  ##
+## ----------------------------------------- ##
 
 
 # AC_F77_LIBRARY_LDFLAGS
@@ -3546,6 +3536,33 @@ AC_SUBST(EXEEXT)dnl
 ])# AC_EXEEXT
 
 
+# AC_OBJEXT
+# ---------
+# Check the object extension used by the compiler: typically .o or
+# .obj.  If this is called, some other behaviour will change,
+# determined by ac_objext.
+AC_DEFUN(AC_OBJEXT,
+[AC_MSG_CHECKING([for object suffix])
+AC_CACHE_VAL(ac_cv_objext,
+[rm -f conftest*
+echo 'int i = 1;' >conftest.$ac_ext
+if AC_TRY_EVAL(ac_compile); then
+  for ac_file in conftest.*; do
+    case $ac_file in
+    *.c) ;;
+    *) ac_cv_objext=`echo $ac_file | sed -e s/conftest.//` ;;
+    esac
+  done
+else
+  AC_MSG_ERROR([installation or configuration problem; compiler does not work])
+fi
+rm -f conftest*])
+AC_MSG_RESULT($ac_cv_objext)
+OBJEXT=$ac_cv_objext
+ac_objext=$ac_cv_objext
+AC_SUBST(OBJEXT)])
+
+
 
 
 ## -------------------------- ##
index 6961c430e7f2ec6ca0345858cfc68933311c0d0b..4974dae8316705b6d7ba2d03f6cb55f977eeb2d7 100644 (file)
@@ -582,6 +582,7 @@ if test x"$M4" != x; then
   esac
 fi])])
 
+
 # AC_PROG_MAKE_SET
 # ----------------
 # Define SET_MAKE to set ${MAKE} if make doesn't.
@@ -609,12 +610,14 @@ else
   SET_MAKE="MAKE=${MAKE-make}"
 fi
 AC_SUBST([SET_MAKE])dnl
-])
+])# AC_PROG_MAKE_SET
+
 
 AC_DEFUN(AC_PROG_RANLIB,
 [AC_CHECK_PROG(RANLIB, ranlib, ranlib, :)])
 
-dnl Check for mawk first since it's generally faster.
+
+# Check for mawk first since it's generally faster.
 AC_DEFUN(AC_PROG_AWK,
 [AC_CHECK_PROGS(AWK, mawk gawk nawk awk, )])
 
@@ -878,91 +881,36 @@ AC_DEFUNCT(AC_RSH, [; replace it with equivalent code])
 
 
 
-
-
-
 ## ------------------------- ##
-## Checks for header files.  ##
+## Checks for declarations.  ##
 ## ------------------------- ##
 
 
-# AC_HEADER_STDC
-# --------------
-AC_DEFUN(AC_HEADER_STDC,
-[AC_REQUIRE_CPP()dnl
-AC_CACHE_CHECK(for ANSI C header files, ac_cv_header_stdc,
-[AC_TRY_CPP([#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.h>
-], ac_cv_header_stdc=yes, ac_cv_header_stdc=no)
-
-if test $ac_cv_header_stdc = yes; then
-  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
-AC_EGREP_HEADER(memchr, string.h, , ac_cv_header_stdc=no)
-fi
-
-if test $ac_cv_header_stdc = yes; then
-  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
-AC_EGREP_HEADER(free, stdlib.h, , ac_cv_header_stdc=no)
-fi
-
-if test $ac_cv_header_stdc = yes; then
-  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
-AC_TRY_RUN(
-[#include <ctype.h>
-#if ((' ' & 0x0FF) == 0x020)
-# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
-#else
-# define ISLOWER(c) (('a' <= (c) && (c) <= 'i') \
-                     || ('j' <= (c) && (c) <= 'r') \
-                     || ('s' <= (c) && (c) <= 'z'))
-# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+# AC_DECL_SYS_SIGLIST
+# -------------------
+AC_DEFUN(AC_DECL_SYS_SIGLIST,
+[AC_CACHE_CHECK([for sys_siglist declaration in signal.h or unistd.h],
+  ac_cv_decl_sys_siglist,
+[AC_TRY_COMPILE([#include <sys/types.h>
+#include <signal.h>
+/* NetBSD declares sys_siglist in unistd.h.  */
+#if HAVE_UNISTD_H
+# include <unistd.h>
 #endif
-
-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
-int
-main ()
-{
-  int i;
-  for (i = 0; i < 256; i++)
-    if (XOR (islower (i), ISLOWER (i))
-        || toupper (i) != TOUPPER (i))
-      exit(2);
-  exit (0);
-}], , ac_cv_header_stdc=no, :)
-fi])
-if test $ac_cv_header_stdc = yes; then
-  AC_DEFINE(STDC_HEADERS, 1, [Define if you have the ANSI C header files.])
+], [char *msg = *(sys_siglist + 1);],
+  ac_cv_decl_sys_siglist=yes, ac_cv_decl_sys_siglist=no)])
+if test $ac_cv_decl_sys_siglist = yes; then
+  AC_DEFINE(SYS_SIGLIST_DECLARED, 1,
+            [Define if `sys_siglist' is declared by <signal.h> or <unistd.h>.])
 fi
-])# AC_HEADER_STDC
+])# AC_DECL_SYS_SIGLIST
 
 
-# AC_HEADER_MAJOR
-# ---------------
-AC_DEFUN(AC_HEADER_MAJOR,
-[AC_CACHE_CHECK(whether sys/types.h defines makedev,
-  ac_cv_header_sys_types_h_makedev,
-[AC_TRY_LINK([#include <sys/types.h>
-], [return makedev(0, 0);],
-  ac_cv_header_sys_types_h_makedev=yes, ac_cv_header_sys_types_h_makedev=no)
-])
 
-if test $ac_cv_header_sys_types_h_makedev = no; then
-AC_CHECK_HEADER(sys/mkdev.h,
-                [AC_DEFINE(MAJOR_IN_MKDEV, 1,
-                           [Define if `major', `minor', and `makedev' are
-                            declared in <mkdev.h>.])])
 
-  if test $ac_cv_header_sys_mkdev_h = no; then
-    AC_CHECK_HEADER(sys/sysmacros.h,
-                    [AC_DEFINE(MAJOR_IN_SYSMACROS, 1,
-                               [Define if `major', `minor', and `makedev' are
-                                declared in <sysmacros.h>.])])
-  fi
-fi
-])# AC_HEADER_MAJOR
+## ------------------------- ##
+## Checks for header files.  ##
+## ------------------------- ##
 
 
 # _AC_CHECK_HEADER_DIRENT(HEADER-FILE, ACTION-IF-FOUND)
@@ -1017,6 +965,32 @@ fi
 ])# AC_HEADER_DIRENT
 
 
+# AC_HEADER_MAJOR
+# ---------------
+AC_DEFUN(AC_HEADER_MAJOR,
+[AC_CACHE_CHECK(whether sys/types.h defines makedev,
+  ac_cv_header_sys_types_h_makedev,
+[AC_TRY_LINK([#include <sys/types.h>
+], [return makedev(0, 0);],
+  ac_cv_header_sys_types_h_makedev=yes, ac_cv_header_sys_types_h_makedev=no)
+])
+
+if test $ac_cv_header_sys_types_h_makedev = no; then
+AC_CHECK_HEADER(sys/mkdev.h,
+                [AC_DEFINE(MAJOR_IN_MKDEV, 1,
+                           [Define if `major', `minor', and `makedev' are
+                            declared in <mkdev.h>.])])
+
+  if test $ac_cv_header_sys_mkdev_h = no; then
+    AC_CHECK_HEADER(sys/sysmacros.h,
+                    [AC_DEFINE(MAJOR_IN_SYSMACROS, 1,
+                               [Define if `major', `minor', and `makedev' are
+                                declared in <sysmacros.h>.])])
+  fi
+fi
+])# AC_HEADER_MAJOR
+
+
 # AC_HEADER_STAT
 # --------------
 # FIXME: Shouldn't this be named AC_HEADER_SYS_STAT?
@@ -1058,24 +1032,57 @@ fi
 ])# AC_HEADER_STAT
 
 
-# AC_DECL_SYS_SIGLIST
-# -------------------
-AC_DEFUN(AC_DECL_SYS_SIGLIST,
-[AC_CACHE_CHECK([for sys_siglist declaration in signal.h or unistd.h],
-  ac_cv_decl_sys_siglist,
-[AC_TRY_COMPILE([#include <sys/types.h>
-#include <signal.h>
-/* NetBSD declares sys_siglist in unistd.h.  */
-#if HAVE_UNISTD_H
-# include <unistd.h>
+# AC_HEADER_STDC
+# --------------
+AC_DEFUN(AC_HEADER_STDC,
+[AC_REQUIRE_CPP()dnl
+AC_CACHE_CHECK(for ANSI C header files, ac_cv_header_stdc,
+[AC_TRY_CPP([#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+], ac_cv_header_stdc=yes, ac_cv_header_stdc=no)
+
+if test $ac_cv_header_stdc = yes; then
+  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+AC_EGREP_HEADER(memchr, string.h, , ac_cv_header_stdc=no)
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+AC_EGREP_HEADER(free, stdlib.h, , ac_cv_header_stdc=no)
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+AC_TRY_RUN(
+[#include <ctype.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) (('a' <= (c) && (c) <= 'i') \
+                     || ('j' <= (c) && (c) <= 'r') \
+                     || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
 #endif
-], [char *msg = *(sys_siglist + 1);],
-  ac_cv_decl_sys_siglist=yes, ac_cv_decl_sys_siglist=no)])
-if test $ac_cv_decl_sys_siglist = yes; then
-  AC_DEFINE(SYS_SIGLIST_DECLARED, 1,
-            [Define if `sys_siglist' is declared by <signal.h> or <unistd.h>.])
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+  int i;
+  for (i = 0; i < 256; i++)
+    if (XOR (islower (i), ISLOWER (i))
+        || toupper (i) != TOUPPER (i))
+      exit(2);
+  exit (0);
+}], , ac_cv_header_stdc=no, :)
+fi])
+if test $ac_cv_header_stdc = yes; then
+  AC_DEFINE(STDC_HEADERS, 1, [Define if you have the ANSI C header files.])
 fi
-])# AC_DECL_SYS_SIGLIST
+])# AC_HEADER_STDC
 
 
 # AC_HEADER_SYS_WAIT
@@ -1103,6 +1110,25 @@ fi
 ])# AC_HEADER_SYS_WAIT
 
 
+# AC_HEADER_TIME
+# --------------
+AC_DEFUN(AC_HEADER_TIME,
+[AC_CACHE_CHECK([whether time.h and sys/time.h may both be included],
+  ac_cv_header_time,
+[AC_TRY_COMPILE([#include <sys/types.h>
+#include <sys/time.h>
+#include <time.h>
+],
+[struct tm *tp;], ac_cv_header_time=yes, ac_cv_header_time=no)])
+if test $ac_cv_header_time = yes; then
+  AC_DEFINE(TIME_WITH_SYS_TIME, 1,
+            [Define if you can safely include both <sys/time.h> and <time.h>.])
+fi
+])# AC_HEADER_TIME
+
+
+
+
 # A few hasbeen'd macros.
 
 AC_DEFUNCT(AC_UNISTD_H, [; instead use AC_CHECK_HEADERS(unistd.h)])
@@ -1232,43 +1258,142 @@ AC_DEFINE_UNQUOTED(RETSIGTYPE, $ac_cv_type_signal,
 ## ---------------------- ##
 
 
-# AC_FUNC_CLOSEDIR_VOID
-# ---------------------
-# Check whether closedir returns void, and #define CLOSEDIR_VOID in
-# that case.
-AC_DEFUN(AC_FUNC_CLOSEDIR_VOID,
-[AC_REQUIRE([AC_HEADER_DIRENT])dnl
-AC_CACHE_CHECK(whether closedir returns void, ac_cv_func_closedir_void,
-[AC_TRY_RUN(
-[#include <sys/types.h>
-#include <$ac_header_dirent>
-
-int closedir ();
-int
-main ()
-{
-  exit (closedir (opendir (".")) != 0);
-}],
-  ac_cv_func_closedir_void=no,
-  ac_cv_func_closedir_void=yes,
-  ac_cv_func_closedir_void=yes)])
-if test $ac_cv_func_closedir_void = yes; then
-  AC_DEFINE(CLOSEDIR_VOID, 1,
-            [Define if the `closedir' function returns void instead of `int'.])
+# AC_FUNC_ALLOCA
+# --------------
+AC_DEFUN(AC_FUNC_ALLOCA,
+[AC_REQUIRE_CPP()dnl Set CPP; we run AC_EGREP_CPP conditionally.
+# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
+# for constant arguments.  Useless!
+AC_CACHE_CHECK([for working alloca.h], ac_cv_working_alloca_h,
+[AC_TRY_LINK([#include <alloca.h>], [char *p = alloca(2 * sizeof(int));],
+  ac_cv_working_alloca_h=yes, ac_cv_working_alloca_h=no)])
+if test $ac_cv_working_alloca_h = yes; then
+  AC_DEFINE(HAVE_ALLOCA_H, 1,
+            [Define if you have <alloca.h> and it should be used
+             (not on Ultrix).])
 fi
-])
-
 
-# AC_FUNC_FNMATCH
-# ---------------
-# We look for fnmatch.h to avoid that the test fails in C++.
-AC_DEFUN(AC_FUNC_FNMATCH,
-[AC_CHECK_HEADERS(fnmatch.h)
-AC_CACHE_CHECK(for working fnmatch, ac_cv_func_fnmatch_works,
-# Some versions of Solaris or SCO have a broken fnmatch function.
-# So we run a test program.  If we are cross-compiling, take no chance.
-# Thanks to John Oleynick and Franc,ois Pinard for this test.
-[AC_TRY_RUN(
+AC_CACHE_CHECK([for alloca], ac_cv_func_alloca_works,
+[AC_TRY_LINK(
+[#ifdef __GNUC__
+# define alloca __builtin_alloca
+#else
+# ifdef _MSC_VER
+#  include <malloc.h>
+#  define alloca _alloca
+# else
+#  if HAVE_ALLOCA_H
+#   include <alloca.h>
+#  else
+#   ifdef _AIX
+ #pragma alloca
+#   else
+#    ifndef alloca /* predefined by HP cc +Olibcalls */
+char *alloca ();
+#    endif
+#   endif
+#  endif
+# endif
+#endif
+], [char *p = (char *) alloca(1);],
+  ac_cv_func_alloca_works=yes, ac_cv_func_alloca_works=no)])
+if test $ac_cv_func_alloca_works = yes; then
+  AC_DEFINE(HAVE_ALLOCA, 1,
+            [Define if you have `alloca', as a function or macro.])
+fi
+
+if test $ac_cv_func_alloca_works = no; then
+  # The SVR3 libPW and SVR4 libucb both contain incompatible functions
+  # that cause trouble.  Some versions do not even contain alloca or
+  # contain a buggy version.  If you still want to use their alloca,
+  # use ar to extract alloca.o from them instead of compiling alloca.c.
+  ALLOCA=alloca.${ac_objext}
+  AC_DEFINE(C_ALLOCA, 1, [Define if using `alloca.c'.])
+
+AC_CACHE_CHECK(whether alloca needs Cray hooks, ac_cv_os_cray,
+[AC_EGREP_CPP(webecray,
+[#if defined(CRAY) && ! defined(CRAY2)
+webecray
+#else
+wenotbecray
+#endif
+], ac_cv_os_cray=yes, ac_cv_os_cray=no)])
+if test $ac_cv_os_cray = yes; then
+for ac_func in _getb67 GETB67 getb67; do
+  AC_CHECK_FUNC($ac_func,
+                [AC_DEFINE_UNQUOTED(CRAY_STACKSEG_END, $ac_func,
+                                    [Define to one of _getb67, GETB67, getb67
+                                     for Cray-2 and Cray-YMP systems.
+                                     This function is required for alloca.c
+                                     support on those systems.])
+  break])
+done
+fi
+
+AC_CACHE_CHECK(stack direction for C alloca, ac_cv_c_stack_direction,
+[AC_TRY_RUN(
+[find_stack_direction ()
+{
+  static char *addr = 0;
+  auto char dummy;
+  if (addr == 0)
+    {
+      addr = &dummy;
+      return find_stack_direction ();
+    }
+  else
+    return (&dummy > addr) ? 1 : -1;
+}
+
+int
+main ()
+{
+  exit (find_stack_direction () < 0);
+}], ac_cv_c_stack_direction=1, ac_cv_c_stack_direction=-1,
+  ac_cv_c_stack_direction=0)])
+AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction)
+fi
+AC_SUBST(ALLOCA)dnl
+])# AC_FUNC_ALLOCA
+
+
+# AC_FUNC_CLOSEDIR_VOID
+# ---------------------
+# Check whether closedir returns void, and #define CLOSEDIR_VOID in
+# that case.
+AC_DEFUN(AC_FUNC_CLOSEDIR_VOID,
+[AC_REQUIRE([AC_HEADER_DIRENT])dnl
+AC_CACHE_CHECK(whether closedir returns void, ac_cv_func_closedir_void,
+[AC_TRY_RUN(
+[#include <sys/types.h>
+#include <$ac_header_dirent>
+
+int closedir ();
+int
+main ()
+{
+  exit (closedir (opendir (".")) != 0);
+}],
+  ac_cv_func_closedir_void=no,
+  ac_cv_func_closedir_void=yes,
+  ac_cv_func_closedir_void=yes)])
+if test $ac_cv_func_closedir_void = yes; then
+  AC_DEFINE(CLOSEDIR_VOID, 1,
+            [Define if the `closedir' function returns void instead of `int'.])
+fi
+])
+
+
+# AC_FUNC_FNMATCH
+# ---------------
+# We look for fnmatch.h to avoid that the test fails in C++.
+AC_DEFUN(AC_FUNC_FNMATCH,
+[AC_CHECK_HEADERS(fnmatch.h)
+AC_CACHE_CHECK(for working fnmatch, ac_cv_func_fnmatch_works,
+# Some versions of Solaris or SCO have a broken fnmatch function.
+# So we run a test program.  If we are cross-compiling, take no chance.
+# Thanks to John Oleynick and Franc,ois Pinard for this test.
+[AC_TRY_RUN(
 [#if HAVE_FNMATCH_H
 # include <fnmatch.h>
 #endif
 ])# AC_FUNC_FNMATCH
 
 
-# AC_FUNC_MMAP
-# ------------
-AC_DEFUN(AC_FUNC_MMAP,
-[AC_CHECK_HEADERS(unistd.h)
-AC_CHECK_FUNCS(getpagesize)
-AC_CACHE_CHECK(for working mmap, ac_cv_func_mmap_fixed_mapped,
-[AC_TRY_RUN(
-[/* Thanks to Mike Haertel and Jim Avera for this test.
-   Here is a matrix of mmap possibilities:
-       mmap private not fixed
-       mmap private fixed at somewhere currently unmapped
-       mmap private fixed at somewhere already mapped
-       mmap shared not fixed
-       mmap shared fixed at somewhere currently unmapped
-       mmap shared fixed at somewhere already mapped
-   For private mappings, we should verify that changes cannot be read()
-   back from the file, nor mmap's back from the file at a different
-   address.  (There have been systems where private was not correctly
-   implemented like the infamous i386 svr4.0, and systems where the
-   VM page cache was not coherent with the file system buffer cache
-   like early versions of FreeBSD and possibly contemporary NetBSD.)
-   For shared mappings, we should conversely verify that changes get
-   propogated back to all the places they're supposed to be.
-
-   Grep wants private fixed already mapped.
-   The main things grep needs to know about mmap are:
-   * does it exist and is it safe to write into the mmap'd area
-   * how to use it (BSD variants)  */
-#include <sys/types.h>
-#include <fcntl.h>
-#include <sys/mman.h>
+# AC_FUNC_GETLOADAVG
+# ------------------
+AC_DEFUN(AC_FUNC_GETLOADAVG,
+[ac_have_func=no # yes means we've found a way to get the load average.
 
-/* This mess was copied from the GNU getpagesize.h.  */
-#if !HAVE_GETPAGESIZE
-# if HAVE_UNISTD_H
-#  include <unistd.h>
-# endif
+# Some systems with -lutil have (and need) -lkvm as well, some do not.
+# On Solaris, -lkvm requires nlist from -lelf, so check that first
+# to get the right answer into the cache.
+AC_CHECK_LIB(elf, elf_begin, LIBS="-lelf $LIBS")
+AC_CHECK_LIB(kvm, kvm_open, LIBS="-lkvm $LIBS")
+AC_CHECK_LIB(kstat, kstat_open)
+# Check for the 4.4BSD definition of getloadavg.
+AC_CHECK_LIB(util, getloadavg,
+  [LIBS="-lutil $LIBS" ac_have_func=yes ac_cv_func_getloadavg_setgid=yes])
 
-/* Assume that all systems that can run configure have sys/param.h.  */
-# if !HAVE_SYS_PARAM_H
-#  define HAVE_SYS_PARAM_H 1
-# endif
+if test $ac_have_func = no; then
+  # There is a commonly available library for RS/6000 AIX.
+  # Since it is not a standard part of AIX, it might be installed locally.
+  ac_getloadavg_LIBS="$LIBS"; LIBS="-L/usr/local/lib $LIBS"
+  AC_CHECK_LIB(getloadavg, getloadavg,
+    LIBS="-lgetloadavg $LIBS", LIBS="$ac_getloadavg_LIBS")
+fi
 
-# ifdef _SC_PAGESIZE
-#  define getpagesize() sysconf(_SC_PAGESIZE)
-# else /* no _SC_PAGESIZE */
-#  if HAVE_SYS_PARAM_H
-#   include <sys/param.h>
-#   ifdef EXEC_PAGESIZE
-#    define getpagesize() EXEC_PAGESIZE
-#   else /* no EXEC_PAGESIZE */
-#    ifdef NBPG
-#     define getpagesize() NBPG * CLSIZE
-#     ifndef CLSIZE
-#      define CLSIZE 1
-#     endif /* no CLSIZE */
-#    else /* no NBPG */
-#     ifdef NBPC
-#      define getpagesize() NBPC
-#     else /* no NBPC */
-#      ifdef PAGESIZE
-#       define getpagesize() PAGESIZE
-#      endif /* PAGESIZE */
-#     endif /* no NBPC */
-#    endif /* no NBPG */
-#   endif /* no EXEC_PAGESIZE */
-#  else /* no HAVE_SYS_PARAM_H */
-#   define getpagesize() 8192  /* punt totally */
-#  endif /* no HAVE_SYS_PARAM_H */
-# endif /* no _SC_PAGESIZE */
+# Make sure it is really in the library, if we think we found it.
+AC_REPLACE_FUNCS(getloadavg)
 
-#endif /* no HAVE_GETPAGESIZE */
+if test $ac_cv_func_getloadavg = yes; then
+  AC_DEFINE(HAVE_GETLOADAVG, 1,
+            [Define if your system has its own `getloadavg' function.])
+  ac_have_func=yes
+else
+  # Figure out what our getloadavg.c needs.
+  ac_have_func=no
+  AC_CHECK_HEADER(sys/dg_sys_info.h,
+  [ac_have_func=yes;
+   AC_DEFINE(DGUX, 1, [Define for DGUX with <sys/dg_sys_info.h>.])
+   AC_CHECK_LIB(dgc, dg_sys_info)])
 
-#ifdef __cplusplus
-extern "C" { void *malloc(unsigned); }
-#else
-char *malloc();
-#endif
+  # We cannot check for <dwarf.h>, because Solaris 2 does not use dwarf (it
+  # uses stabs), but it is still SVR4.  We cannot check for <elf.h> because
+  # Irix 4.0.5F has the header but not the library.
+  if test $ac_have_func = no && test $ac_cv_lib_elf_elf_begin = yes; then
+    ac_have_func=yes;
+    AC_DEFINE(SVR4, 1,
+              [Define on System V Release 4.])
+  fi
 
-int
-main ()
-{
-  char *data, *data2, *data3;
-  int i, pagesize;
-  int fd;
+  if test $ac_have_func = no; then
+    AC_CHECK_HEADER(inq_stats/cpustats.h,
+    [ac_have_func=yes;
+     AC_DEFINE(UMAX, 1,
+               [Define for Encore UMAX.])
+     AC_DEFINE(UMAX4_3, 1,
+               [Define for Encore UMAX 4.3 that has <inq_status/cpustats.h>
+                instead of <sys/cpustats.h>.])])
+  fi
 
-  pagesize = getpagesize ();
+  if test $ac_have_func = no; then
+    AC_CHECK_HEADER(sys/cpustats.h,
+    [ac_have_func=yes; AC_DEFINE(UMAX)])
+  fi
 
-  /* First, make a file with some known garbage in it. */
-  data = malloc (pagesize);
-  if (!data)
-    exit (1);
-  for (i = 0; i < pagesize; ++i)
-    *(data + i) = rand ();
-  umask (0);
-  fd = creat ("conftestmmap", 0600);
-  if (fd < 0)
-    exit (1);
-  if (write (fd, data, pagesize) != pagesize)
-    exit (1);
-  close (fd);
+  if test $ac_have_func = no; then
+    AC_CHECK_HEADERS(mach/mach.h)
+  fi
 
-  /* Next, try to mmap the file at a fixed address which already has
-     something else allocated at it.  If we can, also make sure that
-     we see the same garbage.  */
-  fd = open ("conftestmmap", O_RDWR);
-  if (fd < 0)
-    exit (1);
-  data2 = malloc (2 * pagesize);
-  if (!data2)
-    exit (1);
-  data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1);
-  if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE,
-                     MAP_PRIVATE | MAP_FIXED, fd, 0L))
-    exit (1);
-  for (i = 0; i < pagesize; ++i)
-    if (*(data + i) != *(data2 + i))
-      exit (1);
+  AC_CHECK_HEADER(nlist.h,
+  [AC_DEFINE(NLIST_STRUCT, 1, [Define if you have <nlist.h>.])
+  AC_CACHE_CHECK([for n_un in struct nlist], ac_cv_struct_nlist_n_un,
+  [AC_TRY_COMPILE([#include <nlist.h>
+],
+                  [struct nlist n; n.n_un.n_name = 0;],
+                  ac_cv_struct_nlist_n_un=yes, ac_cv_struct_nlist_n_un=no)])
+  if test $ac_cv_struct_nlist_n_un = yes; then
+    AC_DEFINE(NLIST_NAME_UNION, 1,
+              [Define if your `struct nlist' has an `n_un' member.])
+  fi
+  ])dnl
+fi # Do not have getloadavg in system libraries.
 
-  /* Finally, make sure that changes to the mapped area do not
-     percolate back to the file as seen by read().  (This is a bug on
-     some variants of i386 svr4.0.)  */
-  for (i = 0; i < pagesize; ++i)
-    *(data2 + i) = *(data2 + i) + 1;
-  data3 = malloc (pagesize);
-  if (!data3)
-    exit (1);
-  if (read (fd, data3, pagesize) != pagesize)
-    exit (1);
-  for (i = 0; i < pagesize; ++i)
-    if (*(data + i) != *(data3 + i))
-      exit (1);
-  close (fd);
-  unlink ("conftestmmap");
-  exit (0);
-}], ac_cv_func_mmap_fixed_mapped=yes, ac_cv_func_mmap_fixed_mapped=no,
-ac_cv_func_mmap_fixed_mapped=no)])
-if test $ac_cv_func_mmap_fixed_mapped = yes; then
-  AC_DEFINE(HAVE_MMAP, 1,
-            [Define if you have a working `mmap' system call.])
+# Some definitions of getloadavg require that the program be installed setgid.
+dnl FIXME: Don't hardwire the path of getloadavg.c in the top-level directory.
+AC_CACHE_CHECK(whether getloadavg requires setgid,
+  ac_cv_func_getloadavg_setgid,
+[AC_EGREP_CPP([Yowza Am I SETGID yet],
+[#include "$srcdir/getloadavg.c"
+#ifdef LDAV_PRIVILEGED
+Yowza Am I SETGID yet
+#endif],
+  ac_cv_func_getloadavg_setgid=yes, ac_cv_func_getloadavg_setgid=no)])
+if test $ac_cv_func_getloadavg_setgid = yes; then
+  NEED_SETGID=true;
+  AC_DEFINE(GETLOADAVG_PRIVILEGED, 1,
+            [Define if the `getloadavg' function needs to be run setuid
+             or setgid.])
+else
+  NEED_SETGID=false
 fi
-])# AC_FUNC_MMAP
+AC_SUBST(NEED_SETGID)dnl
+
+if test $ac_cv_func_getloadavg_setgid = yes; then
+  AC_CACHE_CHECK(group of /dev/kmem, ac_cv_group_kmem,
+[ # On Solaris, /dev/kmem is a symlink.  Get info on the real file.
+  ac_ls_output=`ls -lgL /dev/kmem 2>/dev/null`
+  # If we got an error (system does not support symlinks), try without -L.
+  test -z "$ac_ls_output" && ac_ls_output=`ls -lg /dev/kmem`
+  ac_cv_group_kmem=`echo $ac_ls_output \
+    | sed -ne ['s/[    ][      ]*/ /g;
+              s/^.[sSrwx-]* *[0-9]* *\([^0-9]*\)  *.*/\1/;
+              / /s/.* //;p;']`
+])
+  KMEM_GROUP=$ac_cv_group_kmem
+fi
+AC_SUBST(KMEM_GROUP)dnl
+])# AC_FUNC_GETLOADAVG
+
+
+# AC_FUNC_GETMNTENT
+# -----------------
+AC_DEFUN(AC_FUNC_GETMNTENT,
+[# getmntent is in -lsun on Irix 4, -lseq on Dynix/PTX, -lgen on Unixware.
+AC_CHECK_LIB(sun, getmntent, LIBS="-lsun $LIBS",
+  [AC_CHECK_LIB(seq, getmntent, LIBS="-lseq $LIBS",
+    [AC_CHECK_LIB(gen, getmntent, LIBS="-lgen $LIBS")])])
+AC_CHECK_FUNC(getmntent,
+              [AC_DEFINE(HAVE_GETMNTENT, 1,
+                         [Define if you have the `getmntent' function.])])])
 
 
 # AC_FUNC_GETPGRP
 ])# AC_FUNC_GETPGRP
 
 
-# AC_FUNC_SETPGRP
-# ---------------
-AC_DEFUN(AC_FUNC_SETPGRP,
-[AC_CACHE_CHECK(whether setpgrp takes no argument, ac_cv_func_setpgrp_void,
-AC_TRY_RUN(
-[#if HAVE_UNISTD_H
-# include <unistd.h>
+# AC_FUNC_MKTIME
+# --------------
+AC_DEFUN(AC_FUNC_MKTIME,
+[AC_REQUIRE([AC_HEADER_TIME])dnl
+AC_CHECK_HEADERS(sys/time.h unistd.h)
+AC_CHECK_FUNCS(alarm)
+AC_CACHE_CHECK([for working mktime], ac_cv_func_working_mktime,
+[AC_TRY_RUN(
+[/* Test program from Paul Eggert and Tony Leneis.  */
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
 #endif
 
-/* If this system has a BSD-style setpgrp, which takes arguments, exit
-   successfully.  */
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
 
-int
-main ()
-{
-  if (setpgrp (1,1) == -1)
-    exit (0);
-  else
-    exit (1);
-}], ac_cv_func_setpgrp_void=no, ac_cv_func_setpgrp_void=yes,
-   AC_MSG_ERROR(cannot check setpgrp if cross compiling))
-)
-if test $ac_cv_func_setpgrp_void = yes; then
-  AC_DEFINE(SETPGRP_VOID, 1,
-            [Define if the `setpgrp' function takes no argument.])
-fi
-])# AC_FUNC_SETPGRP
+#if !HAVE_ALARM
+# define alarm(X) /* empty */
+#endif
 
+/* Work around redefinition to rpl_putenv by other config tests.  */
+#undef putenv
 
-# AC_FUNC_VPRINTF
-# ---------------
-# Why the heck is that _doprnt does not define HAVE__DOPRNT???
-# That the logical name!  In addition, why doesn't it use
-# AC_CHECK_FUNCS(vprintf)?  Because old Autoconf uses sh for loops.
-# FIXME: To be changed in Autoconf 3?
-AC_DEFUN(AC_FUNC_VPRINTF,
-[AC_CHECK_FUNC(vprintf,
-               AC_DEFINE(HAVE_VPRINTF, 1,
-               [Define if you have the `vprintf' function.]))
-if test "$ac_cv_func_vprintf" != yes; then
-AC_CHECK_FUNC(_doprnt,
-              AC_DEFINE(HAVE_DOPRNT, 1,
-                        [Define if you don't have `vprintf' but do have
-                         `_doprnt.']))
-fi
-])
+static time_t time_t_max;
 
+/* Values we'll use to set the TZ environment variable.  */
+static const char *const tz_strings[] = {
+  (const char *) 0, "TZ=GMT0", "TZ=JST-9",
+  "TZ=EST+3EDT+2,M10.1.0/00:00:00,M2.3.0/00:00:00"
+};
+#define N_STRINGS (sizeof (tz_strings) / sizeof (tz_strings[0]))
 
-# AC_FUNC_VFORK
-# -------------
-AC_DEFUN(AC_FUNC_VFORK,
-[AC_REQUIRE([AC_TYPE_PID_T])dnl
-AC_CHECK_HEADER(vfork.h,
-                AC_DEFINE(HAVE_VFORK_H, 1,
-                          [Define if you have <vfork.h>.]))
-AC_CACHE_CHECK(for working vfork, ac_cv_func_vfork_works,
-[AC_TRY_RUN([/* Thanks to Paul Eggert for this test.  */
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-#if HAVE_VFORK_H
-# include <vfork.h>
-#endif
-/* On some sparc systems, changes by the child to local and incoming
-   argument registers are propagated back to the parent.  The compiler
-   is told about this with #include <vfork.h>, but some compilers
-   (e.g. gcc -O) don't grok <vfork.h>.  Test for this by using a
-   static variable whose address is put into a register that is
-   clobbered by the vfork.  */
-static
-#ifdef __cplusplus
-sparc_address_test (int arg)
-# else
-sparc_address_test (arg) int arg;
-#endif
+/* Fail if mktime fails to convert a date in the spring-forward gap.
+   Based on a problem report from Andreas Jaeger.  */
+static void
+spring_forward_gap ()
 {
-  static pid_t child;
-  if (!child) {
-    child = vfork ();
-    if (child < 0) {
-      perror ("vfork");
-      _exit(2);
-    }
-    if (!child) {
-      arg = getpid();
-      write(-1, "", 0);
-      _exit (arg);
-    }
-  }
+  /* glibc (up to about 1998-10-07) failed this test) */
+  struct tm tm;
+
+  /* Use the portable POSIX.1 specification "TZ=PST8PDT,M4.1.0,M10.5.0"
+     instead of "TZ=America/Vancouver" in order to detect the bug even
+     on systems that don't support the Olson extension, or don't have the
+     full zoneinfo tables installed.  */
+  putenv ("TZ=PST8PDT,M4.1.0,M10.5.0");
+
+  tm.tm_year = 98;
+  tm.tm_mon = 3;
+  tm.tm_mday = 5;
+  tm.tm_hour = 2;
+  tm.tm_min = 0;
+  tm.tm_sec = 0;
+  tm.tm_isdst = -1;
+  if (mktime (&tm) == (time_t)-1)
+    exit (1);
 }
 
-int
-main ()
+static void
+mktime_test (now)
+     time_t now;
 {
-  pid_t parent = getpid ();
-  pid_t child;
-
-  sparc_address_test ();
+  struct tm *lt;
+  if ((lt = localtime (&now)) && mktime (lt) != now)
+    exit (1);
+  now = time_t_max - now;
+  if ((lt = localtime (&now)) && mktime (lt) != now)
+    exit (1);
+}
 
-  child = vfork ();
+static void
+irix_6_4_bug ()
+{
+  /* Based on code from Ariel Faigon.  */
+  struct tm tm;
+  tm.tm_year = 96;
+  tm.tm_mon = 3;
+  tm.tm_mday = 0;
+  tm.tm_hour = 0;
+  tm.tm_min = 0;
+  tm.tm_sec = 0;
+  tm.tm_isdst = -1;
+  mktime (&tm);
+  if (tm.tm_mon != 2 || tm.tm_mday != 31)
+    exit (1);
+}
 
-  if (child == 0) {
-    /* Here is another test for sparc vfork register problems.  This
-       test uses lots of local variables, at least as many local
-       variables as main has allocated so far including compiler
-       temporaries.  4 locals are enough for gcc 1.40.3 on a Solaris
-       4.1.3 sparc, but we use 8 to be safe.  A buggy compiler should
-       reuse the register of parent for one of the local variables,
-       since it will think that parent can't possibly be used any more
-       in this routine.  Assigning to the local variable will thus
-       munge parent in the parent process.  */
-    pid_t
-      p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(),
-      p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid();
-    /* Convince the compiler that p..p7 are live; otherwise, it might
-       use the same hardware register for all 8 local variables.  */
-    if (p != p1 || p != p2 || p != p3 || p != p4
-       || p != p5 || p != p6 || p != p7)
-      _exit(1);
+static void
+bigtime_test (j)
+     int j;
+{
+  struct tm tm;
+  time_t now;
+  tm.tm_year = tm.tm_mon = tm.tm_mday = tm.tm_hour = tm.tm_min = tm.tm_sec = j;
+  now = mktime (&tm);
+  if (now != (time_t) -1)
+    {
+      struct tm *lt = localtime (&now);
+      if (! (lt
+            && lt->tm_year == tm.tm_year
+            && lt->tm_mon == tm.tm_mon
+            && lt->tm_mday == tm.tm_mday
+            && lt->tm_hour == tm.tm_hour
+            && lt->tm_min == tm.tm_min
+            && lt->tm_sec == tm.tm_sec
+            && lt->tm_yday == tm.tm_yday
+            && lt->tm_wday == tm.tm_wday
+            && ((lt->tm_isdst < 0 ? -1 : 0 < lt->tm_isdst)
+                 == (tm.tm_isdst < 0 ? -1 : 0 < tm.tm_isdst))))
+       exit (1);
+    }
+}
 
-    /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent
-       from child file descriptors.  If the child closes a descriptor
-       before it execs or exits, this munges the parent's descriptor
-       as well.  Test for this by closing stdout in the child.  */
-    _exit(close(fileno(stdout)) != 0);
-  } else {
-    int status;
-    struct stat st;
+int
+main ()
+{
+  time_t t, delta;
+  int i, j;
 
-    while (wait(&status) != child)
-      ;
-    exit(
-        /* Was there some problem with vforking?  */
-        child < 0
+  /* This test makes some buggy mktime implementations loop.
+     Give up after 60 seconds; a mktime slower than that
+     isn't worth using anyway.  */
+  alarm (60);
 
-        /* Did the child fail?  (This shouldn't happen.)  */
-        || status
+  for (time_t_max = 1; 0 < time_t_max; time_t_max *= 2)
+    continue;
+  time_t_max--;
+  delta = time_t_max / 997; /* a suitable prime number */
+  for (i = 0; i < N_STRINGS; i++)
+    {
+      if (tz_strings[i])
+       putenv (tz_strings[i]);
 
-        /* Did the vfork/compiler bug occur?  */
-        || parent != getpid()
+      for (t = 0; t <= time_t_max - delta; t += delta)
+       mktime_test (t);
+      mktime_test ((time_t) 60 * 60);
+      mktime_test ((time_t) 60 * 60 * 24);
 
-        /* Did the file descriptor bug occur?  */
-        || fstat(fileno(stdout), &st) != 0
-        );
-  }
+      for (j = 1; 0 < j; j *= 2)
+        bigtime_test (j);
+      bigtime_test (j - 1);
+    }
+  irix_6_4_bug ();
+  spring_forward_gap ();
+  exit (0);
 }],
-ac_cv_func_vfork_works=yes, ac_cv_func_vfork_works=no, AC_CHECK_FUNC(vfork)
-ac_cv_func_vfork_works=$ac_cv_func_vfork)])
-if test "x$ac_cv_func_vfork_works" = xno; then
-  AC_DEFINE(vfork, fork, [Define as `fork' if `vfork' does not work.])
+ac_cv_func_working_mktime=yes, ac_cv_func_working_mktime=no,
+ac_cv_func_working_mktime=no)])
+if test $ac_cv_func_working_mktime = no; then
+  LIBOBJS="$LIBOBJS mktime.${ac_objext}"
 fi
-])# AC_FUNC_VFORK
+])# AC_FUNC_MKTIME
 
 
-# AC_FUNC_WAIT3
-# -------------
-AC_DEFUN(AC_FUNC_WAIT3,
-[AC_CACHE_CHECK(for wait3 that fills in rusage, ac_cv_func_wait3_rusage,
+# AC_FUNC_MMAP
+# ------------
+AC_DEFUN(AC_FUNC_MMAP,
+[AC_CHECK_HEADERS(unistd.h)
+AC_CHECK_FUNCS(getpagesize)
+AC_CACHE_CHECK(for working mmap, ac_cv_func_mmap_fixed_mapped,
 [AC_TRY_RUN(
-[#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/resource.h>
-#include <stdio.h>
-/* HP-UX has wait3 but does not fill in rusage at all.  */
-int
-main ()
-{
-  struct rusage r;
-  int i;
-  /* Use a field that we can force nonzero --
-     voluntary context switches.
-     For systems like NeXT and OSF/1 that don't set it,
-     also use the system CPU time.  And page faults (I/O) for Linux.  */
-  r.ru_nvcsw = 0;
-  r.ru_stime.tv_sec = 0;
-  r.ru_stime.tv_usec = 0;
-  r.ru_majflt = r.ru_minflt = 0;
-  switch (fork ())
-    {
-    case 0: /* Child.  */
-      sleep(1); /* Give up the CPU.  */
-      _exit(0);
-    case -1: /* What can we do?  */
-      _exit(0);
-    default: /* Parent.  */
-      wait3(&i, 0, &r);
-      /* Avoid "text file busy" from rm on fast HP-UX machines.  */
-      sleep(2);
-      exit (r.ru_nvcsw == 0 && r.ru_majflt == 0 && r.ru_minflt == 0
-           && r.ru_stime.tv_sec == 0 && r.ru_stime.tv_usec == 0);
-    }
-}], ac_cv_func_wait3_rusage=yes, ac_cv_func_wait3_rusage=no,
-ac_cv_func_wait3_rusage=no)])
-if test $ac_cv_func_wait3_rusage = yes; then
-  AC_DEFINE(HAVE_WAIT3, 1,
-            [Define if you have the `wait3' system call.])
-fi
-])# AC_FUNC_WAIT3
+[/* Thanks to Mike Haertel and Jim Avera for this test.
+   Here is a matrix of mmap possibilities:
+       mmap private not fixed
+       mmap private fixed at somewhere currently unmapped
+       mmap private fixed at somewhere already mapped
+       mmap shared not fixed
+       mmap shared fixed at somewhere currently unmapped
+       mmap shared fixed at somewhere already mapped
+   For private mappings, we should verify that changes cannot be read()
+   back from the file, nor mmap's back from the file at a different
+   address.  (There have been systems where private was not correctly
+   implemented like the infamous i386 svr4.0, and systems where the
+   VM page cache was not coherent with the file system buffer cache
+   like early versions of FreeBSD and possibly contemporary NetBSD.)
+   For shared mappings, we should conversely verify that changes get
+   propogated back to all the places they're supposed to be.
 
+   Grep wants private fixed already mapped.
+   The main things grep needs to know about mmap are:
+   * does it exist and is it safe to write into the mmap'd area
+   * how to use it (BSD variants)  */
+#include <sys/types.h>
+#include <fcntl.h>
+#include <sys/mman.h>
 
-# AC_FUNC_ALLOCA
-# --------------
-AC_DEFUN(AC_FUNC_ALLOCA,
-[AC_REQUIRE_CPP()dnl Set CPP; we run AC_EGREP_CPP conditionally.
-# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
-# for constant arguments.  Useless!
-AC_CACHE_CHECK([for working alloca.h], ac_cv_working_alloca_h,
-[AC_TRY_LINK([#include <alloca.h>], [char *p = alloca(2 * sizeof(int));],
-  ac_cv_working_alloca_h=yes, ac_cv_working_alloca_h=no)])
-if test $ac_cv_working_alloca_h = yes; then
-  AC_DEFINE(HAVE_ALLOCA_H, 1,
-            [Define if you have <alloca.h> and it should be used
-             (not on Ultrix).])
-fi
+/* This mess was copied from the GNU getpagesize.h.  */
+#if !HAVE_GETPAGESIZE
+# if HAVE_UNISTD_H
+#  include <unistd.h>
+# endif
 
-AC_CACHE_CHECK([for alloca], ac_cv_func_alloca_works,
-[AC_TRY_LINK(
-[#ifdef __GNUC__
-# define alloca __builtin_alloca
-#else
-# ifdef _MSC_VER
-#  include <malloc.h>
-#  define alloca _alloca
-# else
-#  if HAVE_ALLOCA_H
-#   include <alloca.h>
-#  else
-#   ifdef _AIX
- #pragma alloca
-#   else
-#    ifndef alloca /* predefined by HP cc +Olibcalls */
-char *alloca ();
-#    endif
-#   endif
-#  endif
+/* Assume that all systems that can run configure have sys/param.h.  */
+# if !HAVE_SYS_PARAM_H
+#  define HAVE_SYS_PARAM_H 1
 # endif
-#endif
-], [char *p = (char *) alloca(1);],
-  ac_cv_func_alloca_works=yes, ac_cv_func_alloca_works=no)])
-if test $ac_cv_func_alloca_works = yes; then
-  AC_DEFINE(HAVE_ALLOCA, 1,
-            [Define if you have `alloca', as a function or macro.])
-fi
 
-if test $ac_cv_func_alloca_works = no; then
-  # The SVR3 libPW and SVR4 libucb both contain incompatible functions
-  # that cause trouble.  Some versions do not even contain alloca or
-  # contain a buggy version.  If you still want to use their alloca,
-  # use ar to extract alloca.o from them instead of compiling alloca.c.
-  ALLOCA=alloca.${ac_objext}
-  AC_DEFINE(C_ALLOCA, 1, [Define if using `alloca.c'.])
+# ifdef _SC_PAGESIZE
+#  define getpagesize() sysconf(_SC_PAGESIZE)
+# else /* no _SC_PAGESIZE */
+#  if HAVE_SYS_PARAM_H
+#   include <sys/param.h>
+#   ifdef EXEC_PAGESIZE
+#    define getpagesize() EXEC_PAGESIZE
+#   else /* no EXEC_PAGESIZE */
+#    ifdef NBPG
+#     define getpagesize() NBPG * CLSIZE
+#     ifndef CLSIZE
+#      define CLSIZE 1
+#     endif /* no CLSIZE */
+#    else /* no NBPG */
+#     ifdef NBPC
+#      define getpagesize() NBPC
+#     else /* no NBPC */
+#      ifdef PAGESIZE
+#       define getpagesize() PAGESIZE
+#      endif /* PAGESIZE */
+#     endif /* no NBPC */
+#    endif /* no NBPG */
+#   endif /* no EXEC_PAGESIZE */
+#  else /* no HAVE_SYS_PARAM_H */
+#   define getpagesize() 8192  /* punt totally */
+#  endif /* no HAVE_SYS_PARAM_H */
+# endif /* no _SC_PAGESIZE */
 
-AC_CACHE_CHECK(whether alloca needs Cray hooks, ac_cv_os_cray,
-[AC_EGREP_CPP(webecray,
-[#if defined(CRAY) && ! defined(CRAY2)
-webecray
+#endif /* no HAVE_GETPAGESIZE */
+
+#ifdef __cplusplus
+extern "C" { void *malloc(unsigned); }
 #else
-wenotbecray
+char *malloc();
 #endif
-], ac_cv_os_cray=yes, ac_cv_os_cray=no)])
-if test $ac_cv_os_cray = yes; then
-for ac_func in _getb67 GETB67 getb67; do
-  AC_CHECK_FUNC($ac_func,
-                [AC_DEFINE_UNQUOTED(CRAY_STACKSEG_END, $ac_func,
-                                    [Define to one of _getb67, GETB67, getb67
-                                     for Cray-2 and Cray-YMP systems.
-                                     This function is required for alloca.c
-                                     support on those systems.])
-  break])
-done
-fi
-
-AC_CACHE_CHECK(stack direction for C alloca, ac_cv_c_stack_direction,
-[AC_TRY_RUN(
-[find_stack_direction ()
-{
-  static char *addr = 0;
-  auto char dummy;
-  if (addr == 0)
-    {
-      addr = &dummy;
-      return find_stack_direction ();
-    }
-  else
-    return (&dummy > addr) ? 1 : -1;
-}
 
 int
 main ()
 {
-  exit (find_stack_direction () < 0);
-}], ac_cv_c_stack_direction=1, ac_cv_c_stack_direction=-1,
-  ac_cv_c_stack_direction=0)])
-AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction)
-fi
-AC_SUBST(ALLOCA)dnl
-])# AC_FUNC_ALLOCA
+  char *data, *data2, *data3;
+  int i, pagesize;
+  int fd;
 
+  pagesize = getpagesize ();
 
-# AC_FUNC_GETLOADAVG
-# ------------------
-AC_DEFUN(AC_FUNC_GETLOADAVG,
-[ac_have_func=no # yes means we've found a way to get the load average.
+  /* First, make a file with some known garbage in it. */
+  data = malloc (pagesize);
+  if (!data)
+    exit (1);
+  for (i = 0; i < pagesize; ++i)
+    *(data + i) = rand ();
+  umask (0);
+  fd = creat ("conftestmmap", 0600);
+  if (fd < 0)
+    exit (1);
+  if (write (fd, data, pagesize) != pagesize)
+    exit (1);
+  close (fd);
 
-# Some systems with -lutil have (and need) -lkvm as well, some do not.
-# On Solaris, -lkvm requires nlist from -lelf, so check that first
-# to get the right answer into the cache.
-AC_CHECK_LIB(elf, elf_begin, LIBS="-lelf $LIBS")
-AC_CHECK_LIB(kvm, kvm_open, LIBS="-lkvm $LIBS")
-AC_CHECK_LIB(kstat, kstat_open)
-# Check for the 4.4BSD definition of getloadavg.
-AC_CHECK_LIB(util, getloadavg,
-  [LIBS="-lutil $LIBS" ac_have_func=yes ac_cv_func_getloadavg_setgid=yes])
+  /* Next, try to mmap the file at a fixed address which already has
+     something else allocated at it.  If we can, also make sure that
+     we see the same garbage.  */
+  fd = open ("conftestmmap", O_RDWR);
+  if (fd < 0)
+    exit (1);
+  data2 = malloc (2 * pagesize);
+  if (!data2)
+    exit (1);
+  data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1);
+  if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE,
+                     MAP_PRIVATE | MAP_FIXED, fd, 0L))
+    exit (1);
+  for (i = 0; i < pagesize; ++i)
+    if (*(data + i) != *(data2 + i))
+      exit (1);
 
-if test $ac_have_func = no; then
-  # There is a commonly available library for RS/6000 AIX.
-  # Since it is not a standard part of AIX, it might be installed locally.
-  ac_getloadavg_LIBS="$LIBS"; LIBS="-L/usr/local/lib $LIBS"
-  AC_CHECK_LIB(getloadavg, getloadavg,
-    LIBS="-lgetloadavg $LIBS", LIBS="$ac_getloadavg_LIBS")
+  /* Finally, make sure that changes to the mapped area do not
+     percolate back to the file as seen by read().  (This is a bug on
+     some variants of i386 svr4.0.)  */
+  for (i = 0; i < pagesize; ++i)
+    *(data2 + i) = *(data2 + i) + 1;
+  data3 = malloc (pagesize);
+  if (!data3)
+    exit (1);
+  if (read (fd, data3, pagesize) != pagesize)
+    exit (1);
+  for (i = 0; i < pagesize; ++i)
+    if (*(data + i) != *(data3 + i))
+      exit (1);
+  close (fd);
+  unlink ("conftestmmap");
+  exit (0);
+}], ac_cv_func_mmap_fixed_mapped=yes, ac_cv_func_mmap_fixed_mapped=no,
+ac_cv_func_mmap_fixed_mapped=no)])
+if test $ac_cv_func_mmap_fixed_mapped = yes; then
+  AC_DEFINE(HAVE_MMAP, 1,
+            [Define if you have a working `mmap' system call.])
 fi
+])# AC_FUNC_MMAP
 
-# Make sure it is really in the library, if we think we found it.
-AC_REPLACE_FUNCS(getloadavg)
-
-if test $ac_cv_func_getloadavg = yes; then
-  AC_DEFINE(HAVE_GETLOADAVG, 1,
-            [Define if your system has its own `getloadavg' function.])
-  ac_have_func=yes
-else
-  # Figure out what our getloadavg.c needs.
-  ac_have_func=no
-  AC_CHECK_HEADER(sys/dg_sys_info.h,
-  [ac_have_func=yes;
-   AC_DEFINE(DGUX, 1, [Define for DGUX with <sys/dg_sys_info.h>.])
-   AC_CHECK_LIB(dgc, dg_sys_info)])
-
-  # We cannot check for <dwarf.h>, because Solaris 2 does not use dwarf (it
-  # uses stabs), but it is still SVR4.  We cannot check for <elf.h> because
-  # Irix 4.0.5F has the header but not the library.
-  if test $ac_have_func = no && test $ac_cv_lib_elf_elf_begin = yes; then
-    ac_have_func=yes;
-    AC_DEFINE(SVR4, 1,
-              [Define on System V Release 4.])
-  fi
-
-  if test $ac_have_func = no; then
-    AC_CHECK_HEADER(inq_stats/cpustats.h,
-    [ac_have_func=yes;
-     AC_DEFINE(UMAX, 1,
-               [Define for Encore UMAX.])
-     AC_DEFINE(UMAX4_3, 1,
-               [Define for Encore UMAX 4.3 that has <inq_status/cpustats.h>
-                instead of <sys/cpustats.h>.])])
-  fi
-
-  if test $ac_have_func = no; then
-    AC_CHECK_HEADER(sys/cpustats.h,
-    [ac_have_func=yes; AC_DEFINE(UMAX)])
-  fi
-
-  if test $ac_have_func = no; then
-    AC_CHECK_HEADERS(mach/mach.h)
-  fi
 
-  AC_CHECK_HEADER(nlist.h,
-  [AC_DEFINE(NLIST_STRUCT, 1, [Define if you have <nlist.h>.])
-  AC_CACHE_CHECK([for n_un in struct nlist], ac_cv_struct_nlist_n_un,
-  [AC_TRY_COMPILE([#include <nlist.h>
-],
-                  [struct nlist n; n.n_un.n_name = 0;],
-                  ac_cv_struct_nlist_n_un=yes, ac_cv_struct_nlist_n_un=no)])
-  if test $ac_cv_struct_nlist_n_un = yes; then
-    AC_DEFINE(NLIST_NAME_UNION, 1,
-              [Define if your `struct nlist' has an `n_un' member.])
-  fi
-  ])dnl
-fi # Do not have getloadavg in system libraries.
+# AC_FUNC_MEMCMP
+# --------------
+AC_DEFUN(AC_FUNC_MEMCMP,
+[AC_CACHE_CHECK(for 8-bit clean memcmp, ac_cv_func_memcmp_clean,
+[AC_TRY_RUN(
+[int
+main()
+{
+  char c0 = 0x40, c1 = 0x80, c2 = 0x81;
+  exit (memcmp(&c0, &c2, 1) < 0
+        && memcmp(&c1, &c2, 1) < 0 ? 0 : 1);
+}], ac_cv_func_memcmp_clean=yes, ac_cv_func_memcmp_clean=no,
+ac_cv_func_memcmp_clean=no)])
+test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.${ac_objext}"
+AC_SUBST(LIBOBJS)dnl
+])# AC_FUNC_MEMCMP
 
-# Some definitions of getloadavg require that the program be installed setgid.
-dnl FIXME: Don't hardwire the path of getloadavg.c in the top-level directory.
-AC_CACHE_CHECK(whether getloadavg requires setgid,
-  ac_cv_func_getloadavg_setgid,
-[AC_EGREP_CPP([Yowza Am I SETGID yet],
-[#include "$srcdir/getloadavg.c"
-#ifdef LDAV_PRIVILEGED
-Yowza Am I SETGID yet
-#endif],
-  ac_cv_func_getloadavg_setgid=yes, ac_cv_func_getloadavg_setgid=no)])
-if test $ac_cv_func_getloadavg_setgid = yes; then
-  NEED_SETGID=true;
-  AC_DEFINE(GETLOADAVG_PRIVILEGED, 1,
-            [Define if the `getloadavg' function needs to be run setuid
-             or setgid.])
-else
-  NEED_SETGID=false
-fi
-AC_SUBST(NEED_SETGID)dnl
 
-if test $ac_cv_func_getloadavg_setgid = yes; then
-  AC_CACHE_CHECK(group of /dev/kmem, ac_cv_group_kmem,
-[ # On Solaris, /dev/kmem is a symlink.  Get info on the real file.
-  ac_ls_output=`ls -lgL /dev/kmem 2>/dev/null`
-  # If we got an error (system does not support symlinks), try without -L.
-  test -z "$ac_ls_output" && ac_ls_output=`ls -lg /dev/kmem`
-  ac_cv_group_kmem=`echo $ac_ls_output \
-    | sed -ne ['s/[    ][      ]*/ /g;
-              s/^.[sSrwx-]* *[0-9]* *\([^0-9]*\)  *.*/\1/;
-              / /s/.* //;p;']`
-])
-  KMEM_GROUP=$ac_cv_group_kmem
-fi
-AC_SUBST(KMEM_GROUP)dnl
-])# AC_FUNC_GETLOADAVG
+# AC_FUNC_SELECT_ARGTYPES
+# -----------------------
+AC_DEFUN(AC_FUNC_SELECT_ARGTYPES,
+[AC_MSG_CHECKING([types of arguments for select()])
+ AC_CACHE_VAL(ac_cv_func_select_arg234,dnl
+ [AC_CACHE_VAL(ac_cv_func_select_arg1,dnl
+  [AC_CACHE_VAL(ac_cv_func_select_arg5,dnl
+   [for ac_cv_func_select_arg234 in 'fd_set *' 'int *' 'void *'; do
+     for ac_cv_func_select_arg1 in 'int' 'size_t' 'unsigned long' 'unsigned'; do
+      for ac_cv_func_select_arg5 in 'struct timeval *' 'const struct timeval *'; do
+       AC_TRY_COMPILE(
+[#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#if HAVE_SYS_TIME_H
+# include <sys/time.h>
+#endif
+#if HAVE_SYS_SELECT_H
+# include <sys/select.h>
+#endif
+#if HAVE_SYS_SOCKET_H
+# include <sys/socket.h>
+#endif
+extern select ($ac_cv_func_select_arg1,$ac_cv_func_select_arg234,$ac_cv_func_select_arg234,$ac_cv_func_select_arg234,$ac_cv_func_select_arg5);],,dnl
+        [ac_not_found=no ; break 3],ac_not_found=yes)
+      done
+     done
+    done
+   ])dnl AC_CACHE_VAL
+  ])dnl AC_CACHE_VAL
+ ])dnl AC_CACHE_VAL
+ if test "$ac_not_found" = yes; then
+  ac_cv_func_select_arg1=int
+  ac_cv_func_select_arg234='int *'
+  ac_cv_func_select_arg5='struct timeval *'
+ fi
+ AC_MSG_RESULT([$ac_cv_func_select_arg1,$ac_cv_func_select_arg234,$ac_cv_func_select_arg5])
+ AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG1, $ac_cv_func_select_arg1,
+                    [Define to the type of arg 1 for `select'.])
+ AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG234, ($ac_cv_func_select_arg234),
+                    [Define to the type of args 2, 3 and 4 for `select'.])
+ AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG5, ($ac_cv_func_select_arg5),
+                    [Define to the type of arg 5 for `select'.])
+])# AC_FUNC_SELECT_ARGTYPES
 
 
-# AC_FUNC_UTIME_NULL
-# ------------------
-AC_DEFUN(AC_FUNC_UTIME_NULL,
-[AC_CACHE_CHECK(whether utime accepts a null argument, ac_cv_func_utime_null,
-[rm -f conftestdata; >conftestdata
-# Sequent interprets utime(file, 0) to mean use start of epoch.  Wrong.
+# AC_FUNC_SETPGRP
+# ---------------
+AC_DEFUN(AC_FUNC_SETPGRP,
+[AC_CACHE_CHECK(whether setpgrp takes no argument, ac_cv_func_setpgrp_void,
 AC_TRY_RUN(
-[#include <sys/types.h>
-#include <sys/stat.h>
-int
-main()
-{
-  struct stat s, t;
-  exit (!(stat ("conftestdata", &s) == 0
-          && utime ("conftestdata", (long *)0) == 0
-          && stat ("conftestdata", &t) == 0
-          && t.st_mtime >= s.st_mtime
-          && t.st_mtime - s.st_mtime < 120));
-}], ac_cv_func_utime_null=yes, ac_cv_func_utime_null=no,
-  ac_cv_func_utime_null=no)
-rm -f core core.* *.core])
-if test $ac_cv_func_utime_null = yes; then
-  AC_DEFINE(HAVE_UTIME_NULL, 1,
-            [Define if `utime(file, NULL)' sets file's timestamp to the
-             present.])
-fi
-])# AC_FUNC_UTIME_NULL
+[#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
 
+/* If this system has a BSD-style setpgrp, which takes arguments, exit
+   successfully.  */
 
-# AC_FUNC_STRCOLL
-# ---------------
-AC_DEFUN(AC_FUNC_STRCOLL,
-[AC_CACHE_CHECK(for working strcoll, ac_cv_func_strcoll_works,
-[AC_TRY_RUN([#include <string.h>
 int
 main ()
 {
-  exit (strcoll ("abc", "def") >= 0 ||
-       strcoll ("ABC", "DEF") >= 0 ||
-       strcoll ("123", "456") >= 0);
-}], ac_cv_func_strcoll_works=yes, ac_cv_func_strcoll_works=no,
-ac_cv_func_strcoll_works=no)])
-if test $ac_cv_func_strcoll_works = yes; then
-  AC_DEFINE(HAVE_STRCOLL, 1,
-            [Define if you have the `strcoll' function and it is properly
-             defined.])
+  if (setpgrp (1,1) == -1)
+    exit (0);
+  else
+    exit (1);
+}], ac_cv_func_setpgrp_void=no, ac_cv_func_setpgrp_void=yes,
+   AC_MSG_ERROR(cannot check setpgrp if cross compiling))
+)
+if test $ac_cv_func_setpgrp_void = yes; then
+  AC_DEFINE(SETPGRP_VOID, 1,
+            [Define if the `setpgrp' function takes no argument.])
 fi
-])# AC_FUNC_STRCOLL
+])# AC_FUNC_SETPGRP
 
 
-# AC_FUNC_SETVBUF_REVERSED
-# ------------------------
-AC_DEFUN(AC_FUNC_SETVBUF_REVERSED,
-[AC_CACHE_CHECK(whether setvbuf arguments are reversed,
-  ac_cv_func_setvbuf_reversed,
-[AC_TRY_RUN([#include <stdio.h>
-/* If setvbuf has the reversed format, exit 0. */
+# AC_FUNC_STRFTIME
+# ----------------
+AC_DEFUN(AC_FUNC_STRFTIME,
+[AC_CHECK_FUNC(strftime,
+               [AC_DEFINE(HAVE_STRFTIME, 1,
+                          [Define if you have the `strftime' function.])],
+[# strftime is in -lintl on SCO UNIX.
+AC_CHECK_LIB(intl, strftime,
+[AC_DEFINE(HAVE_STRFTIME, 1,
+           [Define if you have the `strftime' function.])
+LIBS="-lintl $LIBS"])])dnl
+])# AC_FUNC_STRFTIME
+
+
+# AC_FUNC_VFORK
+# -------------
+AC_DEFUN(AC_FUNC_VFORK,
+[AC_REQUIRE([AC_TYPE_PID_T])dnl
+AC_CHECK_HEADER(vfork.h,
+                AC_DEFINE(HAVE_VFORK_H, 1,
+                          [Define if you have <vfork.h>.]))
+AC_CACHE_CHECK(for working vfork, ac_cv_func_vfork_works,
+[AC_TRY_RUN([/* Thanks to Paul Eggert for this test.  */
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+#if HAVE_VFORK_H
+# include <vfork.h>
+#endif
+/* On some sparc systems, changes by the child to local and incoming
+   argument registers are propagated back to the parent.  The compiler
+   is told about this with #include <vfork.h>, but some compilers
+   (e.g. gcc -O) don't grok <vfork.h>.  Test for this by using a
+   static variable whose address is put into a register that is
+   clobbered by the vfork.  */
+static
+#ifdef __cplusplus
+sparc_address_test (int arg)
+# else
+sparc_address_test (arg) int arg;
+#endif
+{
+  static pid_t child;
+  if (!child) {
+    child = vfork ();
+    if (child < 0) {
+      perror ("vfork");
+      _exit(2);
+    }
+    if (!child) {
+      arg = getpid();
+      write(-1, "", 0);
+      _exit (arg);
+    }
+  }
+}
+
 int
 main ()
 {
-  /* This call has the arguments reversed.
-     A reversed system may check and see that the address of main
-     is not _IOLBF, _IONBF, or _IOFBF, and return nonzero.  */
-  if (setvbuf(stdout, _IOLBF, (char *) main, BUFSIZ) != 0)
-    exit(1);
-  putc('\r', stdout);
-  exit(0);                     /* Non-reversed systems segv here.  */
-}], ac_cv_func_setvbuf_reversed=yes, ac_cv_func_setvbuf_reversed=no)
-rm -f core core.* *.core])
-if test $ac_cv_func_setvbuf_reversed = yes; then
-  AC_DEFINE(SETVBUF_REVERSED, 1,
-            [Define if the `setvbuf' function takes the buffering type as
-             its second argument and the buffer pointer as the third, as on
-             System V before release 3.])
-fi
-])# AC_FUNC_SETVBUF_REVERSED
-
-
-# AC_FUNC_GETMNTENT
-# -----------------
-AC_DEFUN(AC_FUNC_GETMNTENT,
-[# getmntent is in -lsun on Irix 4, -lseq on Dynix/PTX, -lgen on Unixware.
-AC_CHECK_LIB(sun, getmntent, LIBS="-lsun $LIBS",
-  [AC_CHECK_LIB(seq, getmntent, LIBS="-lseq $LIBS",
-    [AC_CHECK_LIB(gen, getmntent, LIBS="-lgen $LIBS")])])
-AC_CHECK_FUNC(getmntent,
-              [AC_DEFINE(HAVE_GETMNTENT, 1,
-                         [Define if you have the `getmntent' function.])])])
-
+  pid_t parent = getpid ();
+  pid_t child;
 
-# AC_FUNC_MKTIME
-# --------------
-AC_DEFUN(AC_FUNC_MKTIME,
-[AC_REQUIRE([AC_HEADER_TIME])dnl
-AC_CHECK_HEADERS(sys/time.h unistd.h)
-AC_CHECK_FUNCS(alarm)
-AC_CACHE_CHECK([for working mktime], ac_cv_func_working_mktime,
-[AC_TRY_RUN(
-[/* Test program from Paul Eggert and Tony Leneis.  */
-#if TIME_WITH_SYS_TIME
-# include <sys/time.h>
-# include <time.h>
-#else
-# if HAVE_SYS_TIME_H
-#  include <sys/time.h>
-# else
-#  include <time.h>
-# endif
-#endif
+  sparc_address_test ();
 
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
+  child = vfork ();
 
-#if !HAVE_ALARM
-# define alarm(X) /* empty */
-#endif
+  if (child == 0) {
+    /* Here is another test for sparc vfork register problems.  This
+       test uses lots of local variables, at least as many local
+       variables as main has allocated so far including compiler
+       temporaries.  4 locals are enough for gcc 1.40.3 on a Solaris
+       4.1.3 sparc, but we use 8 to be safe.  A buggy compiler should
+       reuse the register of parent for one of the local variables,
+       since it will think that parent can't possibly be used any more
+       in this routine.  Assigning to the local variable will thus
+       munge parent in the parent process.  */
+    pid_t
+      p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(),
+      p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid();
+    /* Convince the compiler that p..p7 are live; otherwise, it might
+       use the same hardware register for all 8 local variables.  */
+    if (p != p1 || p != p2 || p != p3 || p != p4
+       || p != p5 || p != p6 || p != p7)
+      _exit(1);
 
-/* Work around redefinition to rpl_putenv by other config tests.  */
-#undef putenv
+    /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent
+       from child file descriptors.  If the child closes a descriptor
+       before it execs or exits, this munges the parent's descriptor
+       as well.  Test for this by closing stdout in the child.  */
+    _exit(close(fileno(stdout)) != 0);
+  } else {
+    int status;
+    struct stat st;
 
-static time_t time_t_max;
+    while (wait(&status) != child)
+      ;
+    exit(
+        /* Was there some problem with vforking?  */
+        child < 0
 
-/* Values we'll use to set the TZ environment variable.  */
-static const char *const tz_strings[] = {
-  (const char *) 0, "TZ=GMT0", "TZ=JST-9",
-  "TZ=EST+3EDT+2,M10.1.0/00:00:00,M2.3.0/00:00:00"
-};
-#define N_STRINGS (sizeof (tz_strings) / sizeof (tz_strings[0]))
+        /* Did the child fail?  (This shouldn't happen.)  */
+        || status
 
-/* Fail if mktime fails to convert a date in the spring-forward gap.
-   Based on a problem report from Andreas Jaeger.  */
-static void
-spring_forward_gap ()
-{
-  /* glibc (up to about 1998-10-07) failed this test) */
-  struct tm tm;
+        /* Did the vfork/compiler bug occur?  */
+        || parent != getpid()
 
-  /* Use the portable POSIX.1 specification "TZ=PST8PDT,M4.1.0,M10.5.0"
-     instead of "TZ=America/Vancouver" in order to detect the bug even
-     on systems that don't support the Olson extension, or don't have the
-     full zoneinfo tables installed.  */
-  putenv ("TZ=PST8PDT,M4.1.0,M10.5.0");
+        /* Did the file descriptor bug occur?  */
+        || fstat(fileno(stdout), &st) != 0
+        );
+  }
+}],
+ac_cv_func_vfork_works=yes, ac_cv_func_vfork_works=no, AC_CHECK_FUNC(vfork)
+ac_cv_func_vfork_works=$ac_cv_func_vfork)])
+if test "x$ac_cv_func_vfork_works" = xno; then
+  AC_DEFINE(vfork, fork, [Define as `fork' if `vfork' does not work.])
+fi
+])# AC_FUNC_VFORK
 
-  tm.tm_year = 98;
-  tm.tm_mon = 3;
-  tm.tm_mday = 5;
-  tm.tm_hour = 2;
-  tm.tm_min = 0;
-  tm.tm_sec = 0;
-  tm.tm_isdst = -1;
-  if (mktime (&tm) == (time_t)-1)
-    exit (1);
-}
 
-static void
-mktime_test (now)
-     time_t now;
-{
-  struct tm *lt;
-  if ((lt = localtime (&now)) && mktime (lt) != now)
-    exit (1);
-  now = time_t_max - now;
-  if ((lt = localtime (&now)) && mktime (lt) != now)
-    exit (1);
-}
+# AC_FUNC_VPRINTF
+# ---------------
+# Why the heck is that _doprnt does not define HAVE__DOPRNT???
+# That the logical name!  In addition, why doesn't it use
+# AC_CHECK_FUNCS(vprintf)?  Because old Autoconf uses sh for loops.
+# FIXME: To be changed in Autoconf 3?
+AC_DEFUN(AC_FUNC_VPRINTF,
+[AC_CHECK_FUNC(vprintf,
+               AC_DEFINE(HAVE_VPRINTF, 1,
+               [Define if you have the `vprintf' function.]))
+if test "$ac_cv_func_vprintf" != yes; then
+AC_CHECK_FUNC(_doprnt,
+              AC_DEFINE(HAVE_DOPRNT, 1,
+                        [Define if you don't have `vprintf' but do have
+                         `_doprnt.']))
+fi
+])
 
-static void
-irix_6_4_bug ()
-{
-  /* Based on code from Ariel Faigon.  */
-  struct tm tm;
-  tm.tm_year = 96;
-  tm.tm_mon = 3;
-  tm.tm_mday = 0;
-  tm.tm_hour = 0;
-  tm.tm_min = 0;
-  tm.tm_sec = 0;
-  tm.tm_isdst = -1;
-  mktime (&tm);
-  if (tm.tm_mon != 2 || tm.tm_mday != 31)
-    exit (1);
-}
 
-static void
-bigtime_test (j)
-     int j;
+# AC_FUNC_WAIT3
+# -------------
+AC_DEFUN(AC_FUNC_WAIT3,
+[AC_CACHE_CHECK(for wait3 that fills in rusage, ac_cv_func_wait3_rusage,
+[AC_TRY_RUN(
+[#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+#include <stdio.h>
+/* HP-UX has wait3 but does not fill in rusage at all.  */
+int
+main ()
 {
-  struct tm tm;
-  time_t now;
-  tm.tm_year = tm.tm_mon = tm.tm_mday = tm.tm_hour = tm.tm_min = tm.tm_sec = j;
-  now = mktime (&tm);
-  if (now != (time_t) -1)
+  struct rusage r;
+  int i;
+  /* Use a field that we can force nonzero --
+     voluntary context switches.
+     For systems like NeXT and OSF/1 that don't set it,
+     also use the system CPU time.  And page faults (I/O) for Linux.  */
+  r.ru_nvcsw = 0;
+  r.ru_stime.tv_sec = 0;
+  r.ru_stime.tv_usec = 0;
+  r.ru_majflt = r.ru_minflt = 0;
+  switch (fork ())
     {
-      struct tm *lt = localtime (&now);
-      if (! (lt
-            && lt->tm_year == tm.tm_year
-            && lt->tm_mon == tm.tm_mon
-            && lt->tm_mday == tm.tm_mday
-            && lt->tm_hour == tm.tm_hour
-            && lt->tm_min == tm.tm_min
-            && lt->tm_sec == tm.tm_sec
-            && lt->tm_yday == tm.tm_yday
-            && lt->tm_wday == tm.tm_wday
-            && ((lt->tm_isdst < 0 ? -1 : 0 < lt->tm_isdst)
-                 == (tm.tm_isdst < 0 ? -1 : 0 < tm.tm_isdst))))
-       exit (1);
+    case 0: /* Child.  */
+      sleep(1); /* Give up the CPU.  */
+      _exit(0);
+    case -1: /* What can we do?  */
+      _exit(0);
+    default: /* Parent.  */
+      wait3(&i, 0, &r);
+      /* Avoid "text file busy" from rm on fast HP-UX machines.  */
+      sleep(2);
+      exit (r.ru_nvcsw == 0 && r.ru_majflt == 0 && r.ru_minflt == 0
+           && r.ru_stime.tv_sec == 0 && r.ru_stime.tv_usec == 0);
     }
-}
+}], ac_cv_func_wait3_rusage=yes, ac_cv_func_wait3_rusage=no,
+ac_cv_func_wait3_rusage=no)])
+if test $ac_cv_func_wait3_rusage = yes; then
+  AC_DEFINE(HAVE_WAIT3, 1,
+            [Define if you have the `wait3' system call.])
+fi
+])# AC_FUNC_WAIT3
+
 
+# AC_FUNC_UTIME_NULL
+# ------------------
+AC_DEFUN(AC_FUNC_UTIME_NULL,
+[AC_CACHE_CHECK(whether utime accepts a null argument, ac_cv_func_utime_null,
+[rm -f conftestdata; >conftestdata
+# Sequent interprets utime(file, 0) to mean use start of epoch.  Wrong.
+AC_TRY_RUN(
+[#include <sys/types.h>
+#include <sys/stat.h>
 int
-main ()
+main()
 {
-  time_t t, delta;
-  int i, j;
-
-  /* This test makes some buggy mktime implementations loop.
-     Give up after 60 seconds; a mktime slower than that
-     isn't worth using anyway.  */
-  alarm (60);
-
-  for (time_t_max = 1; 0 < time_t_max; time_t_max *= 2)
-    continue;
-  time_t_max--;
-  delta = time_t_max / 997; /* a suitable prime number */
-  for (i = 0; i < N_STRINGS; i++)
-    {
-      if (tz_strings[i])
-       putenv (tz_strings[i]);
-
-      for (t = 0; t <= time_t_max - delta; t += delta)
-       mktime_test (t);
-      mktime_test ((time_t) 60 * 60);
-      mktime_test ((time_t) 60 * 60 * 24);
-
-      for (j = 1; 0 < j; j *= 2)
-        bigtime_test (j);
-      bigtime_test (j - 1);
-    }
-  irix_6_4_bug ();
-  spring_forward_gap ();
-  exit (0);
-}],
-ac_cv_func_working_mktime=yes, ac_cv_func_working_mktime=no,
-ac_cv_func_working_mktime=no)])
-if test $ac_cv_func_working_mktime = no; then
-  LIBOBJS="$LIBOBJS mktime.${ac_objext}"
+  struct stat s, t;
+  exit (!(stat ("conftestdata", &s) == 0
+          && utime ("conftestdata", (long *)0) == 0
+          && stat ("conftestdata", &t) == 0
+          && t.st_mtime >= s.st_mtime
+          && t.st_mtime - s.st_mtime < 120));
+}], ac_cv_func_utime_null=yes, ac_cv_func_utime_null=no,
+  ac_cv_func_utime_null=no)
+rm -f core core.* *.core])
+if test $ac_cv_func_utime_null = yes; then
+  AC_DEFINE(HAVE_UTIME_NULL, 1,
+            [Define if `utime(file, NULL)' sets file's timestamp to the
+             present.])
 fi
-])# AC_FUNC_MKTIME
+])# AC_FUNC_UTIME_NULL
 
 
-# AC_FUNC_STRFTIME
-# ----------------
-AC_DEFUN(AC_FUNC_STRFTIME,
-[AC_CHECK_FUNC(strftime,
-               [AC_DEFINE(HAVE_STRFTIME, 1,
-                          [Define if you have the `strftime' function.])],
-[# strftime is in -lintl on SCO UNIX.
-AC_CHECK_LIB(intl, strftime,
-[AC_DEFINE(HAVE_STRFTIME, 1,
-           [Define if you have the `strftime' function.])
-LIBS="-lintl $LIBS"])])dnl
-])# AC_FUNC_STRFTIME
+# AC_FUNC_STRCOLL
+# ---------------
+AC_DEFUN(AC_FUNC_STRCOLL,
+[AC_CACHE_CHECK(for working strcoll, ac_cv_func_strcoll_works,
+[AC_TRY_RUN([#include <string.h>
+int
+main ()
+{
+  exit (strcoll ("abc", "def") >= 0 ||
+       strcoll ("ABC", "DEF") >= 0 ||
+       strcoll ("123", "456") >= 0);
+}], ac_cv_func_strcoll_works=yes, ac_cv_func_strcoll_works=no,
+ac_cv_func_strcoll_works=no)])
+if test $ac_cv_func_strcoll_works = yes; then
+  AC_DEFINE(HAVE_STRCOLL, 1,
+            [Define if you have the `strcoll' function and it is properly
+             defined.])
+fi
+])# AC_FUNC_STRCOLL
 
 
-# AC_FUNC_MEMCMP
-# --------------
-AC_DEFUN(AC_FUNC_MEMCMP,
-[AC_CACHE_CHECK(for 8-bit clean memcmp, ac_cv_func_memcmp_clean,
-[AC_TRY_RUN(
-[int
-main()
+# AC_FUNC_SETVBUF_REVERSED
+# ------------------------
+AC_DEFUN(AC_FUNC_SETVBUF_REVERSED,
+[AC_CACHE_CHECK(whether setvbuf arguments are reversed,
+  ac_cv_func_setvbuf_reversed,
+[AC_TRY_RUN([#include <stdio.h>
+/* If setvbuf has the reversed format, exit 0. */
+int
+main ()
 {
-  char c0 = 0x40, c1 = 0x80, c2 = 0x81;
-  exit (memcmp(&c0, &c2, 1) < 0
-        && memcmp(&c1, &c2, 1) < 0 ? 0 : 1);
-}], ac_cv_func_memcmp_clean=yes, ac_cv_func_memcmp_clean=no,
-ac_cv_func_memcmp_clean=no)])
-test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.${ac_objext}"
-AC_SUBST(LIBOBJS)dnl
-])# AC_FUNC_MEMCMP
-
+  /* This call has the arguments reversed.
+     A reversed system may check and see that the address of main
+     is not _IOLBF, _IONBF, or _IOFBF, and return nonzero.  */
+  if (setvbuf(stdout, _IOLBF, (char *) main, BUFSIZ) != 0)
+    exit(1);
+  putc('\r', stdout);
+  exit(0);                     /* Non-reversed systems segv here.  */
+}], ac_cv_func_setvbuf_reversed=yes, ac_cv_func_setvbuf_reversed=no)
+rm -f core core.* *.core])
+if test $ac_cv_func_setvbuf_reversed = yes; then
+  AC_DEFINE(SETVBUF_REVERSED, 1,
+            [Define if the `setvbuf' function takes the buffering type as
+             its second argument and the buffer pointer as the third, as on
+             System V before release 3.])
+fi
+])# AC_FUNC_SETVBUF_REVERSED
 
-# AC_FUNC_SELECT_ARGTYPES
-# -----------------------
-AC_DEFUN(AC_FUNC_SELECT_ARGTYPES,
-[AC_MSG_CHECKING([types of arguments for select()])
- AC_CACHE_VAL(ac_cv_func_select_arg234,dnl
- [AC_CACHE_VAL(ac_cv_func_select_arg1,dnl
-  [AC_CACHE_VAL(ac_cv_func_select_arg5,dnl
-   [for ac_cv_func_select_arg234 in 'fd_set *' 'int *' 'void *'; do
-     for ac_cv_func_select_arg1 in 'int' 'size_t' 'unsigned long' 'unsigned'; do
-      for ac_cv_func_select_arg5 in 'struct timeval *' 'const struct timeval *'; do
-       AC_TRY_COMPILE(dnl
-[#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-#if HAVE_SYS_TIME_H
-# include <sys/time.h>
-#endif
-#if HAVE_SYS_SELECT_H
-# include <sys/select.h>
-#endif
-#if HAVE_SYS_SOCKET_H
-# include <sys/socket.h>
-#endif
-extern select ($ac_cv_func_select_arg1,$ac_cv_func_select_arg234,$ac_cv_func_select_arg234,$ac_cv_func_select_arg234,$ac_cv_func_select_arg5);],,dnl
-        [ac_not_found=no ; break 3],ac_not_found=yes)
-      done
-     done
-    done
-   ])dnl AC_CACHE_VAL
-  ])dnl AC_CACHE_VAL
- ])dnl AC_CACHE_VAL
- if test "$ac_not_found" = yes; then
-  ac_cv_func_select_arg1=int
-  ac_cv_func_select_arg234='int *'
-  ac_cv_func_select_arg5='struct timeval *'
- fi
- AC_MSG_RESULT([$ac_cv_func_select_arg1,$ac_cv_func_select_arg234,$ac_cv_func_select_arg5])
- AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG1, $ac_cv_func_select_arg1,
-                    [Define to the type of arg1 for `select'.])
- AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG234, ($ac_cv_func_select_arg234),
-                    [Define to the type of args 2, 3 and 4 for `select'.])
- AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG5, ($ac_cv_func_select_arg5),
-                    [Define to the type of arg5 for `select'.])
-])# AC_FUNC_SELECT_ARGTYPES
 
 
 
@@ -2249,23 +2276,6 @@ extern select ($ac_cv_func_select_arg1,$ac_cv_func_select_arg234,$ac_cv_func_sel
 ## ------------------------------ ##
 
 
-# AC_HEADER_TIME
-# --------------
-AC_DEFUN(AC_HEADER_TIME,
-[AC_CACHE_CHECK([whether time.h and sys/time.h may both be included],
-  ac_cv_header_time,
-[AC_TRY_COMPILE([#include <sys/types.h>
-#include <sys/time.h>
-#include <time.h>
-],
-[struct tm *tp;], ac_cv_header_time=yes, ac_cv_header_time=no)])
-if test $ac_cv_header_time = yes; then
-  AC_DEFINE(TIME_WITH_SYS_TIME, 1,
-            [Define if you can safely include both <sys/time.h> and <time.h>.])
-fi
-])# AC_HEADER_TIME
-
-
 # AC_STRUCT_TM
 # ------------
 # FIXME: This macro is badly named, it should be AC_CHECK_TYPE_STRUCT_TM.
@@ -2656,31 +2666,11 @@ fi
 ])# AC_C_PROTOTYPES
 
 
-# AC_OBJEXT
-# ---------
-# Check the object extension used by the compiler: typically .o or
-# .obj.  If this is called, some other behaviour will change,
-# determined by ac_objext.
-AC_DEFUN(AC_OBJEXT,
-[AC_MSG_CHECKING([for object suffix])
-AC_CACHE_VAL(ac_cv_objext,
-[rm -f conftest*
-echo 'int i = 1;' >conftest.$ac_ext
-if AC_TRY_EVAL(ac_compile); then
-  for ac_file in conftest.*; do
-    case $ac_file in
-    *.c) ;;
-    *) ac_cv_objext=`echo $ac_file | sed -e s/conftest.//` ;;
-    esac
-  done
-else
-  AC_MSG_ERROR([installation or configuration problem; compiler does not work])
-fi
-rm -f conftest*])
-AC_MSG_RESULT($ac_cv_objext)
-OBJEXT=$ac_cv_objext
-ac_objext=$ac_cv_objext
-AC_SUBST(OBJEXT)])
+
+
+## ----------------------------------------- ##
+## Checks for F77 compiler characteristics.  ##
+## ----------------------------------------- ##
 
 
 # AC_F77_LIBRARY_LDFLAGS
@@ -3546,6 +3536,33 @@ AC_SUBST(EXEEXT)dnl
 ])# AC_EXEEXT
 
 
+# AC_OBJEXT
+# ---------
+# Check the object extension used by the compiler: typically .o or
+# .obj.  If this is called, some other behaviour will change,
+# determined by ac_objext.
+AC_DEFUN(AC_OBJEXT,
+[AC_MSG_CHECKING([for object suffix])
+AC_CACHE_VAL(ac_cv_objext,
+[rm -f conftest*
+echo 'int i = 1;' >conftest.$ac_ext
+if AC_TRY_EVAL(ac_compile); then
+  for ac_file in conftest.*; do
+    case $ac_file in
+    *.c) ;;
+    *) ac_cv_objext=`echo $ac_file | sed -e s/conftest.//` ;;
+    esac
+  done
+else
+  AC_MSG_ERROR([installation or configuration problem; compiler does not work])
+fi
+rm -f conftest*])
+AC_MSG_RESULT($ac_cv_objext)
+OBJEXT=$ac_cv_objext
+ac_objext=$ac_cv_objext
+AC_SUBST(OBJEXT)])
+
+
 
 
 ## -------------------------- ##