blob: a091bb2e1d29e51e95c18fd275d82995c99997af [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001--- a/gnulib-tool
2+++ b/gnulib-tool
3@@ -346,6 +346,34 @@ Options for --import, --add/remove-impor
4 Report bugs to <bug-gnulib@gnu.org>."
5 }
6
7+get_version_sed='
8+# Move version to start of line.
9+s/.*[v ]\([0-9]\)/\1/
10+
11+# Skip lines that do not start with version.
12+/^[0-9]/!d
13+
14+# Remove characters after the version.
15+s/[^.a-z0-9-].*//
16+
17+# The first component must be digits only.
18+s/^\([0-9]*\)[a-z-].*/\1/
19+
20+# The following essentially does s/5.005/5.5/
21+s/\.0*\([1-9]\)/.\1/g
22+p
23+q'
24+
25+# get_version
26+# copied from build-aux/bootstrap
27+get_version () {
28+ app=$1
29+
30+ $app --version >/dev/null 2>&1 || { $app --version; return 1; }
31+
32+ $app --version 2>&1 | sed -n "$get_version_sed"
33+}
34+
35 # func_version
36 # outputs to stdout the --version message.
37 func_version ()
38@@ -1620,6 +1648,9 @@ func_determine_path_separator
39 fi
40 case "$autoconf_minversion" in
41 1.* | 2.[0-5]* | 2.6[0-3]*)
42+ # if the version of autoconf in use is high enough, do not error
43+ case "$(get_version autoconf)" in 1.* | 2.[0-5]* | 2.6[0-3]*) false ;; esac && \
44+ func_warning "gnulib requires a newer version of autoconf than configure.ac ( $DEFAULT_AUTOCONF_MINVERSION > AC_PREREQ([$autoconf_minversion]) )" || \
45 func_fatal_error "minimum supported autoconf version is 2.64. Try adding AC_PREREQ([$DEFAULT_AUTOCONF_MINVERSION]) to your configure.ac." ;;
46 esac
47