-# `union wait' is preferrably avoided. We merely assume below
-# that if `int pid;' fails, `union wait pid;' would have worked.
-# Directly trying `union wait pid;' is seeking for trouble, as
-# some POSIX systems are offering compatibility hacks generating
-# ugly diagnostics. Also, on some systems, WEXITSTATUS exists,
-# but fails when called on `union wait' variables.
-
-AC_CACHE_CHECK(for union wait, tar_cv_header_union_wait,
- [AC_TRY_COMPILE([
-#include <sys/types.h>
-#if HAVE_SYS_WAIT_H
-# include <sys/wait.h>
-#endif],
- [int status; int pid; pid = wait (&status);],
- tar_cv_header_union_wait=no, tar_cv_header_union_wait=yes)])
-test $tar_cv_header_union_wait = yes && AC_DEFINE(HAVE_UNION_WAIT)
+AM_FUNC_GETLINE
+
+gl_BACKUPFILE
+gl_DIRNAME
+gl_ERROR
+gl_EXCLUDE
+gl_FILEBLOCKS
+gl_FUNC_ALLOCA
+gl_FUNC_FNMATCH_GNU
+gl_FUNC_MEMSET
+gl_FUNC_MKTIME
+gl_FUNC_RMDIR
+gl_FUNC_STRTOL
+gl_FUNC_STRTOUL
+gl_GETDATE
+gl_GETOPT
+gl_HASH
+gl_HUMAN
+gl_MODECHANGE
+gl_OBSTACK
+gl_PATHMAX
+gl_QUOTE
+gl_QUOTEARG
+gl_SAFE_READ
+gl_SAFE_WRITE
+gl_SAVE_CWD
+gl_SAVEDIR
+gl_STRCASE
+gl_XALLOC
+gl_XGETCWD
+gl_XSTRTOL
+
+jm_FUNC_FTRUNCATE
+jm_FUNC_GLIBC_UNLOCKED_IO
+jm_FUNC_LCHOWN
+jm_FUNC_MALLOC
+jm_FUNC_REALLOC
+jm_FUNC_UTIME
+jm_XSTRTOUMAX
+
+
+# Save and restore LIBS so e.g., -lrt, isn't added to it. Otherwise, *all*
+# programs in the package would end up linked with that potentially-shared
+# library, inducing unnecessary run-time overhead.
+
+# Solaris 2.5.1 needs -lposix4 to get the clock_gettime function.
+# Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4.
+tar_save_LIBS=$LIBS
+ LIB_CLOCK_GETTIME=
+ AC_SEARCH_LIBS(clock_gettime, [rt posix4],
+ [LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime])
+ AC_SUBST(LIB_CLOCK_GETTIME)
+ AC_CHECK_FUNCS(clock_gettime)
+LIBS=$tar_save_LIBS
+
+AC_CHECK_FUNCS(fsync lstat mkfifo readlink strerror symlink)
+AC_CHECK_DECLS([getgrgid],,, [#include <grp.h>])
+AC_CHECK_DECLS([getpwuid],,, [#include <pwd.h>])
+AC_CHECK_DECLS([valloc])
+
+# Set LIB_SETSOCKOPT to -lnsl -lsocket if necessary.
+tar_save_LIBS=$LIBS
+ LIB_SETSOCKOPT=
+ AC_SEARCH_LIBS(setsockopt, [socket], ,
+ [AC_SEARCH_LIBS(setsockopt, [socket], , , [-lnsl])])
+ AC_SEARCH_LIBS(setsockopt, [nsl])
+ if test " $LIBS" != " $tar_save_LIBS"; then
+ LIB_SETSOCKOPT=$ac_cv_search_setsockopt
+ fi
+ AC_SUBST(LIB_SETSOCKOPT)
+LIBS=$tar_save_LIBS
+
+AC_REPLACE_FUNCS(waitpid)