autoconf: 1999-10-05 Akim Demaille <akim@epita.fr>

https://github.com/libsdl-org/autoconf/commit/34a0a9b275680d322bce2fe7677ff7d8c5274c44

From 34a0a9b275680d322bce2fe7677ff7d8c5274c44 Mon Sep 17 00:00:00 2001
From: Akim Demaille <[EMAIL REDACTED]>
Date: Tue, 5 Oct 1999 08:10:15 +0000
Subject: [PATCH] 1999-10-05  Akim Demaille  <akim@epita.fr>

	Handle arbitrary version numbers.
	Reported by H.J. Lu.

	* acgeneral.m4 (m4_split): Support a second optional argument: a
 	regexp to specify where to split.
	(m4_compare): New macro, compares arbitrary long m4 lists of
 	integers.
	(AC_PREREQ_SPLIT, AC_PREREQ_CANON, AC_PREREQ_COMPARE): Removed,
	replaced by more generic macros.
	(AC_PREREQ): Reimplemented, using m4_compare and m4_split.
---
 ChangeLog                | 13 +++++++
 TODO                     | 30 +++++++++-------
 acgeneral.m4             | 76 +++++++++++++++++++++++++---------------
 acspecific.m4            | 52 +++++++++++++++------------
 lib/autoconf/general.m4  | 76 +++++++++++++++++++++++++---------------
 lib/autoconf/specific.m4 | 52 +++++++++++++++------------
 6 files changed, 185 insertions(+), 114 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e799c483..2a723118 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+1999-10-05  Akim Demaille  <akim@epita.fr>
+
+	Handle arbitrary version numbers.
+	Reported by H.J. Lu.
+
+	* acgeneral.m4 (m4_split): Support a second optional argument: a
+ 	regexp to specify where to split.
+	(m4_compare): New macro, compares arbitrary long m4 lists of
+ 	integers.
+	(AC_PREREQ_SPLIT, AC_PREREQ_CANON, AC_PREREQ_COMPARE): Removed,
+	replaced by more generic macros.
+	(AC_PREREQ): Reimplemented, using m4_compare and m4_split.
+
 1999-10-04  Akim Demaille  <akim@epita.fr>
 
 	Beware of  the expansions of $n in comments.
diff --git a/TODO b/TODO
index d2fd9989..ed0d44f9 100644
--- a/TODO
+++ b/TODO
@@ -13,9 +13,27 @@ These are things mandatory to fulfill before releasing 2.15.  There
 are also suggestions we should either satisfy right now (they're
 easy), or remove (obsoleted since then).
 
+
 ** AC_CHECK_HEADER should not template config.h entries.
 Its entry in autoheader.m4 should be removed.
 
+** Allow tags for AC_OUTPUT_COMMANDS
+so that we  can run ./config.status name-of-the command.
+
+** Allow --recursive to config.status
+
+** Allow --header, --command, --file to config.status.
+
+** Fix the two sed quoting snippets for config.status.
+That of #defines has in addition a problem of sed portability on Irix.
+That of the AC_SUBST is broken since when went from s%%%g to s%%%;t t.
+
+** Move AM_PROG_CC_STDC into Autoconf.
+Autoconf should provide the means to determine the ANSIsm of the
+compiler, not Automake.
+
+** Provide means to provides commands to run before AC_OUTPUT.
+This is what is needed for LTLIBOBJS and others.
 
 ** Document GNATS?
 
@@ -79,18 +97,6 @@ of ASCII in the C locale, it works.
 
 Tanmoy Bhattacharya (tanmoy@qcd.lanl.gov>
 
-** CONFIG_LINKS= (I think we should fix this one --akim)
-When using CONFIG_FILES= and CONFIG_HEADERS= for controlling partial
-configuration, any AC_LINK_FILES is repeated in each case (that is,
-usually, once for config.h and once per subdirectory).  This is not
-elegant.
-
-Maybe Autoconf could use some kind of CONFIG_LINKS=<file-list>, having
-all such AC_LINK(ed)_FILES by default, but usable by each Makefile.in
-in rules for updating the particular links they need.
-
-From: pinard@iro.umontreal.ca
-
 ** More C compilers (How come this has never been handled?  --akim)
 Question: at least one common UNIX variant has a "cc" that is old K&R
 and "c89" for ANSI C.  Is there any reason why AC_PROG_CC couldn't
diff --git a/acgeneral.m4 b/acgeneral.m4
index 9f207caa..c5d2a04f 100644
--- a/acgeneral.m4
+++ b/acgeneral.m4
@@ -89,12 +89,14 @@ dnl `exp'.
 define([m4_quote], [[$@]])
 
 
-dnl m4_split(STRING)
-dnl ----------------
+dnl m4_split(STRING, [REGEXP])
+dnl --------------------------
 dnl Split STRING into an m4 list of quoted elements.  The elements are
 dnl quoted with [ and ].  Beginning spaces and end spaces *are kept*.
 dnl Use m4_strip to remove them.
 dnl
+dnl REGEXP specifies where to split.  Default is [\t ]+.
+dnl
 dnl Pay attention to the changequotes.  Inner changequotes exist for
 dnl obvious reasons (we want to insert square brackets).  Outer
 dnl changequotes are needed because otherwise the m4 parser, when it
@@ -112,7 +114,11 @@ dnl   => [active], [active], []end
 changequote(<<, >>)
 define(<<m4_split>>,
 <<changequote(``, '')dnl
-[patsubst(````$1'''', ``[ 	]+'', ``], ['')]dnl
+[dnl Can't use m4_default here instead of ifelse, because m4_default uses
+dnl [ and ] as quotes.
+patsubst(````$1'''',
+         ifelse(``$2'',, ``[ 	]+'', ``$2''),
+         ``], ['')]dnl
 changequote([, ])>>)
 changequote([, ])
 
@@ -1477,30 +1483,34 @@ AC_DIVERT_POP()dnl to KILL
 
 dnl Subroutines of AC_PREREQ.
 
-dnl Change the dots in NUMBER into commas.
-dnl AC_PREREQ_SPLIT(NUMBER)
-define(AC_PREREQ_SPLIT,
-[translit($1, ., [, ])])
-
-dnl Default the ternary version number to 0 (e.g., 1, 7 -> 1, 7, 0).
-dnl AC_PREREQ_CANON(MAJOR, MINOR [,TERNARY])
-define(AC_PREREQ_CANON,
-[$1, $2, ifelse([$3], , 0, [$3])])
-
-dnl Complain and exit if version number 1 is less than version number 2.
-dnl PRINTABLE2 is the printable version of version number 2.
-dnl AC_PREREQ_COMPARE(MAJOR1, MINOR1, TERNARY1, MAJOR2, MINOR2, TERNARY2,
-dnl                   PRINTABLE2)
-define(AC_PREREQ_COMPARE,
-[ifelse(
-  m4_eval([$3 + $2 * 1000 + $1 * 1000000 < $6 + $5 * 1000 + $4 * 1000000]),
-  1, [AC_FATAL(Autoconf version $7 or higher is required for this script)])])
+dnl m4_compare(VERSION-1, VERSION-2)
+dnl --------------------------------
+dnl Compare the two version numbers and expand into
+dnl  -1 if VERSION-1 < VERSION-2
+dnl   0 if           =
+dnl   1 if           >
+dnl The handling of the special values [[]] is a pain, but seems necessary.
+dnl This macro is a excellent tutorial on the order of evaluation of ifelse.
+define(m4_compare,
+[ifelse([$1],,      [ifelse([$2],,      0,
+                            [$2], [[]], 0,
+                            1)],
+        [$1], [[]], [ifelse([$2],, 0,
+                            [$2], [[]], 0,
+                            1)],
+        [$2],,      -1,
+        [$2], [[]], -1,
+        [ifelse(m4_eval(m4_car($1) < m4_car($2)), 1, 1,
+                [ifelse(m4_eval(m4_car($1) > m4_car($2)), 1, -1,
+                        [m4_compare(m4_quote(m4_shift($1)),
+                                    m4_quote(m4_shift($2)))])])])])
 
 dnl Complain and exit if the Autoconf version is less than VERSION.
 dnl AC_PREREQ(VERSION)
 define(AC_PREREQ,
-[AC_PREREQ_COMPARE(AC_PREREQ_CANON(AC_PREREQ_SPLIT(AC_ACVERSION)),
-AC_PREREQ_CANON(AC_PREREQ_SPLIT([$1])), [$1])])
+[ifelse(m4_compare(m4_split([$1],         [\.]),
+                   m4_split(AC_ACVERSION, [\.])), -1,
+       [AC_FATAL(Autoconf version $1 or higher is required for this script)])])
 
 
 dnl ### Getting the canonical system type
@@ -2268,8 +2278,10 @@ char $1();
 [$3]))
 
 
-dnl AC_SEARCH_LIBS(FUNCTION, SEARCH-LIBS [, ACTION-IF-FOUND
-dnl            [, ACTION-IF-NOT-FOUND [, OTHER-LIBRARIES]]])
+dnl AC_SEARCH_LIBS(FUNCTION, SEARCH-LIBS
+dnl                [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND
+dnl                [, OTHER-LIBRARIES]]])
+dnl --------------------------------------------------------
 dnl Search for a library defining FUNC, if it's not already available.
 
 AC_DEFUN(AC_SEARCH_LIBS,
@@ -2295,6 +2307,7 @@ fi])
 
 dnl AC_CHECK_LIB(LIBRARY, FUNCTION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND
 dnl              [, OTHER-LIBRARIES]]])
+dnl ------------------------------------------------------------------------
 dnl Use a cache variable name containing both the library and function name,
 dnl because the test really is for library $1 defining function $2, not
 dnl just for library $1.  Separate tests with the same $1 and different $2s
@@ -2791,25 +2804,32 @@ AC_DEFUN(AC_CONFIG_LINKS,
 ifelse(regexp([$1], [ .:]), -1,,
         [AC_FATAL([$0: invalid destination: `.'])])
 define([AC_LIST_LINKS],
-       ifdef([AC_LIST_LINKS], [AC_LIST_LINKS ],)[$1])])
+       ifdef([AC_LIST_LINKS], [AC_LIST_LINKS ],)[$1])
+])
 
 
 dnl AC_LINK_FILES(SOURCE..., DEST...)
 dnl ---------------------------------
 dnl Link each of the existing files SOURCE... to the corresponding
 dnl link name in DEST...
+dnl This macro, as AC_CONFIG_FILES, produces no sh code, so we don't
+dnl dnl.
 AC_DEFUN(AC_LINK_FILES,
-[AC_OBSOLETE([$0], [; instead use AC_CONFIG_FILES(DEST:SOURCE...)])dnl
+[AC_OBSOLETE([$0], [; instead use AC_CONFIG_FILES(DEST:SOURCE...)])
 ifelse($#, 2, ,
   [AC_FATAL([$0: incorrect number of arguments])])
+
 pushdef([AC_Sources], m4_split(m4_strip(m4_join([$1]))))
 pushdef([AC_Dests], m4_split(m4_strip(m4_join([$2]))))
+
 m4_foreach([AC_Dummy], (AC_Sources),
   [AC_CONFIG_LINKS(m4_car(AC_Dests):m4_car(AC_Sources))
    define([AC_Sources], m4_quote(m4_shift(AC_Sources)))
    define([AC_Dests], m4_quote(m4_shift(AC_Dests)))])
+
 popdef([AC_Sources])
-popdef([AC_Dests])])
+popdef([AC_Dests])
+])
 
 define([AC_LIST_LINKS],
        ifdef([AC_LIST_LINKS], [AC_LIST_LINKS ],)[$2:$1])])
diff --git a/acspecific.m4 b/acspecific.m4
index 0ff1b083..d945a850 100644
--- a/acspecific.m4
+++ b/acspecific.m4
@@ -827,22 +827,10 @@ AC_CHECK_HEADER(sys/mkdev.h,
 fi
 ])
 
-AC_DEFUN(AC_HEADER_DIRENT,
-[ac_header_dirent=no
-AC_CHECK_HEADERS_DIRENT(dirent.h sys/ndir.h sys/dir.h ndir.h,
-  [ac_header_dirent=$ac_hdr; break])
-# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
-if test $ac_header_dirent = dirent.h; then
-  AC_CHECK_LIB(dir, opendir, LIBS="$LIBS -ldir")
-else
-  AC_CHECK_LIB(x, opendir, LIBS="$LIBS -lx")
-fi
-])
-
+dnl AC_CHECK_HEADER_DIRENT(HEADER-FILE, ACTION-IF-FOUND)
+dnl ----------------------------------------------------
 dnl Like AC_CHECK_HEADER, except also make sure that HEADER-FILE
 dnl defines the type `DIR'.  dirent.h on NextStep 3.2 doesn't.
-dnl AC_CHECK_HEADER_DIRENT(HEADER-FILE, ACTION-IF-FOUND)
-AC_DEFUN(AC_CHECK_HEADER_DIRENT,
 [ac_safe=`echo "$1" | sed 'y%./+-%__p_%'`
 AC_MSG_CHECKING([for $1 that defines DIR])
 AC_CACHE_VAL(ac_cv_header_dirent_$ac_safe,
@@ -858,9 +846,10 @@ else
 fi
 ])
 
+dnl AC_CHECK_HEADERS_DIRENT(HEADER-FILE... [, ACTION])
+dnl --------------------------------------------------
 dnl Like AC_CHECK_HEADERS, except succeed only for a HEADER-FILE that
 dnl defines `DIR'.
-dnl AC_CHECK_HEADERS_DIRENT(HEADER-FILE... [, ACTION])
 define(AC_CHECK_HEADERS_DIRENT,
 [for ac_hdr in $1
 do
@@ -871,10 +860,22 @@ changequote([, ])dnl
   AC_DEFINE_UNQUOTED($ac_tr_hdr) $2])dnl
 done])
 
+AC_DEFUN(AC_HEADER_DIRENT,
+[ac_header_dirent=no
+AC_CHECK_HEADERS_DIRENT(dirent.h sys/ndir.h sys/dir.h ndir.h,
+  [ac_header_dirent=$ac_hdr; break])
+# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
+if test $ac_header_dirent = dirent.h; then
+  AC_CHECK_LIB(dir, opendir, LIBS="$LIBS -ldir")
+else
+  AC_CHECK_LIB(x, opendir, LIBS="$LIBS -lx")
+fi
+])
+
+
 AC_DEFUN(AC_DIR_HEADER,
 [AC_HASBEEN([$0], [; instead use AC_HEADER_DIRENT])])
 
-
 AC_DEFUN(AC_HEADER_STAT,
 [AC_CACHE_CHECK(whether stat file-mode macros are broken,
   ac_cv_header_stat_broken,
@@ -912,6 +913,8 @@ if test $ac_cv_header_stat_broken = yes; then
 fi
 ])
 
+dnl AC_DECL_SYS_SIGLIST
+dnl -------------------
 AC_DEFUN(AC_DECL_SYS_SIGLIST,
 [AC_CACHE_CHECK([for sys_siglist declaration in signal.h or unistd.h],
   ac_cv_decl_sys_siglist,
@@ -920,13 +923,14 @@ AC_DEFUN(AC_DECL_SYS_SIGLIST,
 /* NetBSD declares sys_siglist in unistd.h.  */
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif], [char *msg = *(sys_siglist + 1);],
+#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>.])
+            [Define if `sys_siglist' is declared by <signal.h> or <unistd.h>.])
 fi
-])
+])dnl AC_DECL_SYS_SIGLIST
 
 AC_DEFUN(AC_HEADER_SYS_WAIT,
 [AC_CACHE_CHECK([for sys/wait.h that is POSIX.1 compatible],
@@ -992,7 +996,7 @@ fi])
 AC_DEFINE_UNQUOTED(GETGROUPS_T, $ac_cv_type_getgroups,
                    [Define to the type of elements in the array set by
                     `getgroups'. Usually this is either `int' or `gid_t'.])
-])
+])dnl AC_TYPE_GETGROUPS
 
 AC_DEFUN(AC_TYPE_UID_T,
 [AC_CACHE_CHECK(for uid_t in sys/types.h, ac_cv_type_uid_t,
@@ -1040,8 +1044,10 @@ AC_DEFINE_UNQUOTED(RETSIGTYPE, $ac_cv_type_signal,
 dnl ### Checks for functions
 
 
-dnl FIXME: What is going on here?  There are both CLOSEDIR_VOID
-dnl *and* VOID_CLOSEDIR.
+dnl AC_FUNC_CLOSEDIR_VOID
+dnl ---------------------
+dnl Check whether closedir returns void, and #define CLOSEDIR_VOID in
+dnl 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,
@@ -1462,7 +1468,7 @@ if test $ac_cv_func_wait3_rusage = yes; then
   AC_DEFINE(HAVE_WAIT3, 1,
             [Define if you have the `wait3' system call.])
 fi
-])
+])dnl AC_FUNC_WAIT3
 
 AC_DEFUN(AC_FUNC_ALLOCA,
 [AC_REQUIRE_CPP()dnl Set CPP; we run AC_EGREP_CPP conditionally.
diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4
index 9f207caa..c5d2a04f 100644
--- a/lib/autoconf/general.m4
+++ b/lib/autoconf/general.m4
@@ -89,12 +89,14 @@ dnl `exp'.
 define([m4_quote], [[$@]])
 
 
-dnl m4_split(STRING)
-dnl ----------------
+dnl m4_split(STRING, [REGEXP])
+dnl --------------------------
 dnl Split STRING into an m4 list of quoted elements.  The elements are
 dnl quoted with [ and ].  Beginning spaces and end spaces *are kept*.
 dnl Use m4_strip to remove them.
 dnl
+dnl REGEXP specifies where to split.  Default is [\t ]+.
+dnl
 dnl Pay attention to the changequotes.  Inner changequotes exist for
 dnl obvious reasons (we want to insert square brackets).  Outer
 dnl changequotes are needed because otherwise the m4 parser, when it
@@ -112,7 +114,11 @@ dnl   => [active], [active], []end
 changequote(<<, >>)
 define(<<m4_split>>,
 <<changequote(``, '')dnl
-[patsubst(````$1'''', ``[ 	]+'', ``], ['')]dnl
+[dnl Can't use m4_default here instead of ifelse, because m4_default uses
+dnl [ and ] as quotes.
+patsubst(````$1'''',
+         ifelse(``$2'',, ``[ 	]+'', ``$2''),
+         ``], ['')]dnl
 changequote([, ])>>)
 changequote([, ])
 
@@ -1477,30 +1483,34 @@ AC_DIVERT_POP()dnl to KILL
 
 dnl Subroutines of AC_PREREQ.
 
-dnl Change the dots in NUMBER into commas.
-dnl AC_PREREQ_SPLIT(NUMBER)
-define(AC_PREREQ_SPLIT,
-[translit($1, ., [, ])])
-
-dnl Default the ternary version number to 0 (e.g., 1, 7 -> 1, 7, 0).
-dnl AC_PREREQ_CANON(MAJOR, MINOR [,TERNARY])
-define(AC_PREREQ_CANON,
-[$1, $2, ifelse([$3], , 0, [$3])])
-
-dnl Complain and exit if version number 1 is less than version number 2.
-dnl PRINTABLE2 is the printable version of version number 2.
-dnl AC_PREREQ_COMPARE(MAJOR1, MINOR1, TERNARY1, MAJOR2, MINOR2, TERNARY2,
-dnl                   PRINTABLE2)
-define(AC_PREREQ_COMPARE,
-[ifelse(
-  m4_eval([$3 + $2 * 1000 + $1 * 1000000 < $6 + $5 * 1000 + $4 * 1000000]),
-  1, [AC_FATAL(Autoconf version $7 or higher is required for this script)])])
+dnl m4_compare(VERSION-1, VERSION-2)
+dnl --------------------------------
+dnl Compare the two version numbers and expand into
+dnl  -1 if VERSION-1 < VERSION-2
+dnl   0 if           =
+dnl   1 if           >
+dnl The handling of the special values [[]] is a pain, but seems necessary.
+dnl This macro is a excellent tutorial on the order of evaluation of ifelse.
+define(m4_compare,
+[ifelse([$1],,      [ifelse([$2],,      0,
+                            [$2], [[]], 0,
+                            1)],
+        [$1], [[]], [ifelse([$2],, 0,
+                            [$2], [[]], 0,
+                            1)],
+        [$2],,      -1,
+        [$2], [[]], -1,
+        [ifelse(m4_eval(m4_car($1) < m4_car($2)), 1, 1,
+                [ifelse(m4_eval(m4_car($1) > m4_car($2)), 1, -1,
+                        [m4_compare(m4_quote(m4_shift($1)),
+                                    m4_quote(m4_shift($2)))])])])])
 
 dnl Complain and exit if the Autoconf version is less than VERSION.
 dnl AC_PREREQ(VERSION)
 define(AC_PREREQ,
-[AC_PREREQ_COMPARE(AC_PREREQ_CANON(AC_PREREQ_SPLIT(AC_ACVERSION)),
-AC_PREREQ_CANON(AC_PREREQ_SPLIT([$1])), [$1])])
+[ifelse(m4_compare(m4_split([$1],         [\.]),
+                   m4_split(AC_ACVERSION, [\.])), -1,
+       [AC_FATAL(Autoconf version $1 or higher is required for this script)])])
 
 
 dnl ### Getting the canonical system type
@@ -2268,8 +2278,10 @@ char $1();
 [$3]))
 
 
-dnl AC_SEARCH_LIBS(FUNCTION, SEARCH-LIBS [, ACTION-IF-FOUND
-dnl            [, ACTION-IF-NOT-FOUND [, OTHER-LIBRARIES]]])
+dnl AC_SEARCH_LIBS(FUNCTION, SEARCH-LIBS
+dnl                [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND
+dnl                [, OTHER-LIBRARIES]]])
+dnl --------------------------------------------------------
 dnl Search for a library defining FUNC, if it's not already available.
 
 AC_DEFUN(AC_SEARCH_LIBS,
@@ -2295,6 +2307,7 @@ fi])
 
 dnl AC_CHECK_LIB(LIBRARY, FUNCTION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND
 dnl              [, OTHER-LIBRARIES]]])
+dnl ------------------------------------------------------------------------
 dnl Use a cache variable name containing both the library and function name,
 dnl because the test really is for library $1 defining function $2, not
 dnl just for library $1.  Separate tests with the same $1 and different $2s
@@ -2791,25 +2804,32 @@ AC_DEFUN(AC_CONFIG_LINKS,
 ifelse(regexp([$1], [ .:]), -1,,
         [AC_FATAL([$0: invalid destination: `.'])])
 define([AC_LIST_LINKS],
-       ifdef([AC_LIST_LINKS], [AC_LIST_LINKS ],)[$1])])
+       ifdef([AC_LIST_LINKS], [AC_LIST_LINKS ],)[$1])
+])
 
 
 dnl AC_LINK_FILES(SOURCE..., DEST...)
 dnl ---------------------------------
 dnl Link each of the existing files SOURCE... to the corresponding
 dnl link name in DEST...
+dnl This macro, as AC_CONFIG_FILES, produces no sh code, so we don't
+dnl dnl.
 AC_DEFUN(AC_LINK_FILES,
-[AC_OBSOLETE([$0], [; instead use AC_CONFIG_FILES(DEST:SOURCE...)])dnl
+[AC_OBSOLETE([$0], [; instead use AC_CONFIG_FILES(DEST:SOURCE...)])
 ifelse($#, 2, ,
   [AC_FATAL([$0: incorrect number of arguments])])
+
 pushdef([AC_Sources], m4_split(m4_strip(m4_join([$1]))))
 pushdef([AC_Dests], m4_split(m4_strip(m4_join([$2]))))
+
 m4_foreach([AC_Dummy], (AC_Sources),
   [AC_CONFIG_LINKS(m4_car(AC_Dests):m4_car(AC_Sources))
    define([AC_Sources], m4_quote(m4_shift(AC_Sources)))
    define([AC_Dests], m4_quote(m4_shift(AC_Dests)))])
+
 popdef([AC_Sources])
-popdef([AC_Dests])])
+popdef([AC_Dests])
+])
 
 define([AC_LIST_LINKS],
        ifdef([AC_LIST_LINKS], [AC_LIST_LINKS ],)[$2:$1])])
diff --git a/lib/autoconf/specific.m4 b/lib/autoconf/specific.m4
index 0ff1b083..d945a850 100644
--- a/lib/autoconf/specific.m4
+++ b/lib/autoconf/specific.m4
@@ -827,22 +827,10 @@ AC_CHECK_HEADER(sys/mkdev.h,
 fi
 ])
 
-AC_DEFUN(AC_HEADER_DIRENT,
-[ac_header_dirent=no
-AC_CHECK_HEADERS_DIRENT(dirent.h sys/ndir.h sys/dir.h ndir.h,
-  [ac_header_dirent=$ac_hdr; break])
-# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
-if test $ac_header_dirent = dirent.h; then
-  AC_CHECK_LIB(dir, opendir, LIBS="$LIBS -ldir")
-else
-  AC_CHECK_LIB(x, opendir, LIBS="$LIBS -lx")
-fi
-])
-
+dnl AC_CHECK_HEADER_DIRENT(HEADER-FILE, ACTION-IF-FOUND)
+dnl ----------------------------------------------------
 dnl Like AC_CHECK_HEADER, except also make sure that HEADER-FILE
 dnl defines the type `DIR'.  dirent.h on NextStep 3.2 doesn't.
-dnl AC_CHECK_HEADER_DIRENT(HEADER-FILE, ACTION-IF-FOUND)
-AC_DEFUN(AC_CHECK_HEADER_DIRENT,
 [ac_safe=`echo "$1" | sed 'y%./+-%__p_%'`
 AC_MSG_CHECKING([for $1 that defines DIR])
 AC_CACHE_VAL(ac_cv_header_dirent_$ac_safe,
@@ -858,9 +846,10 @@ else
 fi
 ])
 
+dnl AC_CHECK_HEADERS_DIRENT(HEADER-FILE... [, ACTION])
+dnl --------------------------------------------------
 dnl Like AC_CHECK_HEADERS, except succeed only for a HEADER-FILE that
 dnl defines `DIR'.
-dnl AC_CHECK_HEADERS_DIRENT(HEADER-FILE... [, ACTION])
 define(AC_CHECK_HEADERS_DIRENT,
 [for ac_hdr in $1
 do
@@ -871,10 +860,22 @@ changequote([, ])dnl
   AC_DEFINE_UNQUOTED($ac_tr_hdr) $2])dnl
 done])
 
+AC_DEFUN(AC_HEADER_DIRENT,
+[ac_header_dirent=no
+AC_CHECK_HEADERS_DIRENT(dirent.h sys/ndir.h sys/dir.h ndir.h,
+  [ac_header_dirent=$ac_hdr; break])
+# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
+if test $ac_header_dirent = dirent.h; then
+  AC_CHECK_LIB(dir, opendir, LIBS="$LIBS -ldir")
+else
+  AC_CHECK_LIB(x, opendir, LIBS="$LIBS -lx")
+fi
+])
+
+
 AC_DEFUN(AC_DIR_HEADER,
 [AC_HASBEEN([$0], [; instead use AC_HEADER_DIRENT])])
 
-
 AC_DEFUN(AC_HEADER_STAT,
 [AC_CACHE_CHECK(whether stat file-mode macros are broken,
   ac_cv_header_stat_broken,
@@ -912,6 +913,8 @@ if test $ac_cv_header_stat_broken = yes; then
 fi
 ])
 
+dnl AC_DECL_SYS_SIGLIST
+dnl -------------------
 AC_DEFUN(AC_DECL_SYS_SIGLIST,
 [AC_CACHE_CHECK([for sys_siglist declaration in signal.h or unistd.h],
   ac_cv_decl_sys_siglist,
@@ -920,13 +923,14 @@ AC_DEFUN(AC_DECL_SYS_SIGLIST,
 /* NetBSD declares sys_siglist in unistd.h.  */
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif], [char *msg = *(sys_siglist + 1);],
+#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>.])
+            [Define if `sys_siglist' is declared by <signal.h> or <unistd.h>.])
 fi
-])
+])dnl AC_DECL_SYS_SIGLIST
 
 AC_DEFUN(AC_HEADER_SYS_WAIT,
 [AC_CACHE_CHECK([for sys/wait.h that is POSIX.1 compatible],
@@ -992,7 +996,7 @@ fi])
 AC_DEFINE_UNQUOTED(GETGROUPS_T, $ac_cv_type_getgroups,
                    [Define to the type of elements in the array set by
                     `getgroups'. Usually this is either `int' or `gid_t'.])
-])
+])dnl AC_TYPE_GETGROUPS
 
 AC_DEFUN(AC_TYPE_UID_T,
 [AC_CACHE_CHECK(for uid_t in sys/types.h, ac_cv_type_uid_t,
@@ -1040,8 +1044,10 @@ AC_DEFINE_UNQUOTED(RETSIGTYPE, $ac_cv_type_signal,
 dnl ### Checks for functions
 
 
-dnl FIXME: What is going on here?  There are both CLOSEDIR_VOID
-dnl *and* VOID_CLOSEDIR.
+dnl AC_FUNC_CLOSEDIR_VOID
+dnl ---------------------
+dnl Check whether closedir returns void, and #define CLOSEDIR_VOID in
+dnl 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,
@@ -1462,7 +1468,7 @@ if test $ac_cv_func_wait3_rusage = yes; then
   AC_DEFINE(HAVE_WAIT3, 1,
             [Define if you have the `wait3' system call.])
 fi
-])
+])dnl AC_FUNC_WAIT3
 
 AC_DEFUN(AC_FUNC_ALLOCA,
 [AC_REQUIRE_CPP()dnl Set CPP; we run AC_EGREP_CPP conditionally.