summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rwxr-xr-xconfigure2
-rw-r--r--configure.in2
-rw-r--r--manual/install.texi7
-rw-r--r--scripts/sysd-rules.awk24
5 files changed, 32 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index e5520504a8..f5292c5d2e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2013-06-17 Roland McGrath <roland@hack.frob.com>
+ * scripts/sysd-rules.awk: Sort sysd_rules_patterns by descending
+ length of target pattern, then descending length of dependency pattern.
+ * configure.in (AWK): Require gawk 3.1.2 or newer.
+ * manual/install.texi (Tools for Compilation): Say that we do.
+ * configure: Regenerated.
+
* Makerules [inhibit-sysdep-asm] (check-inhibit-asm): Variable removed.
($(common-objpfx)sysd-rules): Replace shell logic with running ...
* scripts/sysd-rules.awk: ... this new script.
diff --git a/configure b/configure
index 8c538f5094..09d8336f10 100755
--- a/configure
+++ b/configure
@@ -4993,7 +4993,7 @@ $as_echo_n "checking version of $AWK... " >&6; }
ac_prog_version=`$AWK --version 2>&1 | sed -n 's/^.*GNU Awk[^0-9]*\([0-9][0-9.]*\).*$/\1/p'`
case $ac_prog_version in
'') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
- [3-9].*)
+ 3.1.[2-9]*|3.[2-9]*|[4-9]*)
ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
*) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
diff --git a/configure.in b/configure.in
index bd90bac91e..8b110817bc 100644
--- a/configure.in
+++ b/configure.in
@@ -986,7 +986,7 @@ AC_CHECK_PROG_VER(SED, sed, --version,
SED=: aux_missing="$aux_missing sed")
AC_CHECK_PROG_VER(AWK, gawk, --version,
[GNU Awk[^0-9]*\([0-9][0-9.]*\)],
- [[3-9].*], critic_missing="$critic_missing gawk")
+ [3.1.[2-9]*|3.[2-9]*|[4-9]*], critic_missing="$critic_missing gawk")
AC_CHECK_TOOL(NM, nm, false)
diff --git a/manual/install.texi b/manual/install.texi
index e6c1bafe67..3608a114f5 100644
--- a/manual/install.texi
+++ b/manual/install.texi
@@ -379,10 +379,11 @@ understand all the tags used in the document, and the installation
mechanism for the info files is not present or works differently.
@item
-GNU @code{awk} 3.0, or higher
+GNU @code{awk} 3.1.2, or higher
-@code{Awk} is used in several places to generate files.
-@code{gawk} 3.0 is known to work.
+@code{awk} is used in several places to generate files.
+Some @code{gawk} extensions are used, including the @code{asorti}
+function, which was introduced in version 3.1.2 of @code{gawk}.
@item
Perl 5
diff --git a/scripts/sysd-rules.awk b/scripts/sysd-rules.awk
index 2fb044eacb..cc143345c6 100644
--- a/scripts/sysd-rules.awk
+++ b/scripts/sysd-rules.awk
@@ -14,6 +14,25 @@ BEGIN {
nsysdirs = split(config_sysdirs, sysdirs);
npatterns = split(sysd_rules_patterns, patterns);
+ # Each element of $(sysd-rules-patterns) is a pair TARGET:DEP.
+ # They are no in particular order. We need to sort them so that
+ # the longest TARGET is first, and, among elements with the same
+ # TARGET, the longest DEP is first.
+ for (i = 1; i <= npatterns; ++i) {
+ if (split(patterns[i], td, ":") != 2) {
+ msg = "bad sysd-rules-patterns element '" patterns[i] "'";
+ print msg > "/dev/stderr";
+ exit 2;
+ }
+ target_order = sprintf("%09d", npatterns + 1 - length(td[1]));
+ dep_order = sprintf("%09d", npatterns - length(td[2]));
+ sort_patterns[target_order SUBSEP dep_order] = patterns[i];
+ }
+ asorti(sort_patterns, map_patterns);
+ for (i in map_patterns) {
+ patterns[i] = sort_patterns[map_patterns[i]];
+ }
+
for (sysdir_idx = 1; sysdir_idx <= nsysdirs; ++sysdir_idx) {
dir = sysdirs[sysdir_idx];
if (dir !~ /^\//) dir = "$(..)" dir;
@@ -28,10 +47,7 @@ BEGIN {
o = suffixes[suffix_idx];
for (pattern_idx = 1; pattern_idx <= npatterns; ++pattern_idx) {
pattern = patterns[pattern_idx];
- if (split(pattern, td, ":") != 2) {
- print "bad sysd-rules-patterns element '" pattern "'" > "/dev/stderr";
- exit 2;
- }
+ split(pattern, td, ":");
target_pattern = td[1];
dep_pattern = td[2];
if (target_pattern == "%") {