diff options
author | 2022-01-30 03:25:54 -0500 | |
---|---|---|
committer | 2022-01-30 03:25:54 -0500 | |
commit | 26310da15dd46776faf1c8e892896f443aa9c419 (patch) | |
tree | c73997b8d345da94fb3ca2169d1cd5478f66fb60 | |
parent | autoconf-wrapper: rework WANT_AUTOCONF parsing to match WANT_AUTOMAKE (diff) | |
download | autotools-wrappers-26310da15dd46776faf1c8e892896f443aa9c419.tar.gz autotools-wrappers-26310da15dd46776faf1c8e892896f443aa9c419.tar.bz2 autotools-wrappers-26310da15dd46776faf1c8e892896f443aa9c419.zip |
autoconf-wrapper: handle autodetection better
If WANT_AUTOCONF isn't set, don't just default to the latest version.
If the current directory has configure or aclocal.m4 files previously
generated with a specific autoconf version, then use that if available.
This matches how the automake wrapper behaves.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
-rwxr-xr-x | ac-wrapper.sh | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/ac-wrapper.sh b/ac-wrapper.sh index e37f5f3..d85b71b 100755 --- a/ac-wrapper.sh +++ b/ac-wrapper.sh @@ -146,10 +146,32 @@ generated_version() { sed -n -E "/${re}/{s:${re}:\3:;p;q}" "$@" } +recorded_aclocal_version() { + local re='.*m4_warning.*this file was generated for autoconf ([0-9].+)\..*' + sed -n -E "/${re}/{s:${re}:\1:;p;q}" "$@" +} + # # autodetect routine # -if [ "${WANT_AUTOCONF}" = "2.1" ] && [ -f "configure.ac" ] ; then +if [ -z "${WANT_AUTOCONF}" ] ; then + auto_vers= + if [ -r "configure" ] ; then + auto_vers="${auto_vers} $(generated_version configure)" + fi + if [ -r "aclocal.m4" ] ; then + auto_vers="${auto_vers} $(recorded_aclocal_version aclocal.m4)" + fi + # We don't need to set $binary here as it has already been setup for us + # earlier to the latest available version. + if [ -n "${auto_vers}" ] ; then + if ! find_binary ${auto_vers} ; then + warn "auto-detected versions not found (${auto_vers}); falling back to latest available" + fi + fi +fi + +if [ "${WANT_AUTOCONF}" = "2.1" -o "${WANT_AUTOCONF}" = "2.13" ] && [ -f "configure.ac" ] ; then err \ "Since configure.ac is present, aclocal will always use autoconf 2.59+\n" \ "\twhich conflicts with your choice and causes errors. You have two options:\n" \ |