diff options
author | Roland McGrath <roland@hack.frob.com> | 2013-06-17 09:54:51 -0700 |
---|---|---|
committer | Roland McGrath <roland@hack.frob.com> | 2013-06-17 09:55:49 -0700 |
commit | 12086fb4835639d1762622d80980a7500799b63e (patch) | |
tree | 65052b7d36b27b4fa95213dba2e6e0fb4be5e587 | |
parent | 346d65b33a3958c72faab6f675314cbef7963ace (diff) | |
download | glibc-12086fb4835639d1762622d80980a7500799b63e.tar glibc-12086fb4835639d1762622d80980a7500799b63e.tar.gz glibc-12086fb4835639d1762622d80980a7500799b63e.tar.bz2 glibc-12086fb4835639d1762622d80980a7500799b63e.zip |
Sort sysd-rules-patterns by descending pattern length.
-rw-r--r-- | ChangeLog | 6 | ||||
-rwxr-xr-x | configure | 2 | ||||
-rw-r--r-- | configure.in | 2 | ||||
-rw-r--r-- | manual/install.texi | 7 | ||||
-rw-r--r-- | scripts/sysd-rules.awk | 24 |
5 files changed, 32 insertions, 9 deletions
@@ -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. @@ -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 == "%") { |