aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xam-wrapper.pl30
1 files changed, 20 insertions, 10 deletions
diff --git a/am-wrapper.pl b/am-wrapper.pl
index 33e30da..06df188 100755
--- a/am-wrapper.pl
+++ b/am-wrapper.pl
@@ -51,10 +51,10 @@
# - configure.ac is present
# -or-
# - `configure.in' contains AC_PREREQ and the value's 3 first letters
-# are stringwise greater than '2.1'
+# are stringwise greater than '2.13'
# -or-
# - `configure' is already present and was generated by autoconf greater than
-# '2.1'
+# '2.13'
# -or-
# - `Makefile.in' was generated by automake-1.5 or superior, which
# specifically needs automake-1.5
@@ -62,6 +62,16 @@
#use MDK::Common;
sub cat_ { local *F; open F, $_[0] or return; my @l = <F>; wantarray ? @l : join '', @l }
+sub am_version {
+ my $file = cat_(shift);
+ return (@versions = $file =~ /^\s*\[?AM_AUTOMAKE_VERSION\(\[?([^\)]{3}[0-9]?)[^\)]*\]?\)/mg) ? ((sort @versions)[-1]) : '';
+}
+sub ac_version {
+ my $file = cat_(shift);
+ return (@versions = $file =~ /^\s*\[?AC_PREREQ\(\[?([^\)]{3}[0-9]?)[^\)]*\]?\)/mg) ? ((sort @versions)[-1]) : '';
+}
+
+
my $binary = "$0-1.4";
my $binary_1_5 = "$0-1.5x";
@@ -91,26 +101,26 @@ if ($ENV{WANT_AUTOMAKE} ne '1.4') {
&& (($ENV{WANT_AUTOMAKE} eq '1.8')
|| (cat_('Makefile.in') =~ /^# Makefile\.in generated by automake (\S+)/ ? $1 : '') ge '1.8'
|| (cat_('aclocal.m4') =~ /^# aclocal.m4 generated automatically by aclocal (\S+)/ ? $1 : '') ge '1.8'
- || (cat_('aclocal.m4') =~ /^\s*\[?AM_AUTOMAKE_VERSION\(\[?([^\)]{3})[^\)]*\]?\)/m ? $1 : '') ge '1.8')) {
+ || am_version('aclocal.m4') ge '1.8')) {
$ENV{WANT_AUTOMAKE} = '1.8'; # to prevent further "cats" and to enhance consistency (possible cwd etc)
$binary = $binary_1_8;
} elsif (-x $binary_1_7 # user may not have 1.7 ...
&& (($ENV{WANT_AUTOMAKE} eq '1.7')
|| (cat_('Makefile.in') =~ /^# Makefile\.in generated by automake (\S+)/ ? $1 : '') ge '1.7'
|| (cat_('aclocal.m4') =~ /^# aclocal.m4 generated automatically by aclocal (\S+)/ ? $1 : '') ge '1.7'
- || (cat_('aclocal.m4') =~ /^\s*\[?AM_AUTOMAKE_VERSION\(\[?([^\)]{3})[^\)]*\]?\)/m ? $1 : '') ge '1.7')) {
+ || am_version('aclocal.m4') ge '1.7')) {
$ENV{WANT_AUTOMAKE} = '1.7'; # to prevent further "cats" and to enhance consistency (possible cwd etc)
$binary = $binary_1_7;
} elsif (-x $binary_1_6 # user may not have 1.6 ...
&& (($ENV{WANT_AUTOMAKE} eq '1.6')
|| (cat_('Makefile.in') =~ /^# Makefile\.in generated by automake (\S+)/ ? $1 : '') ge '1.6'
|| (cat_('aclocal.m4') =~ /^# aclocal.m4 generated automatically by aclocal (\S+)/ ? $1 : '') ge '1.6'
- || (cat_('aclocal.m4') =~ /^\s*\[?AM_AUTOMAKE_VERSION\(\[?([^\)]{3})[^\)]*\]?\)/m ? $1 : '') ge '1.6'
+ || am_version('aclocal.m4') ge '1.6'
# Autoconf 2.53d and later need automake-1.6c, so enable 1.6 for 2.53
# and up .....
- || (cat_('configure.in') =~ /^\s*\[?AC_PREREQ\(\[?([^\)]{4})[^\)]*\]?\)/m ? $1 : '') gt '2.52'
+ || ac_version('configure.in') gt '2.52'
|| (cat_('configure') =~ /^# Generated by Autoconf (\S+)/m ? $1 : '') gt '2.52'
- || (cat_('aclocal.m4') =~ /^\s*\[?AC_PREREQ\(\[?([^\)]{4})[^\)]*\]?\)/m ? $1 : '') gt '2.52')) {
+ || ac_version('aclocal.m4') gt '2.52')) {
$ENV{WANT_AUTOMAKE} = '1.6'; # to prevent further "cats" and to enhance consistency (possible cwd etc)
$binary = $binary_1_6;
} elsif (-x $binary_1_5 # user may have only 1.4 ...
@@ -118,9 +128,9 @@ if ($ENV{WANT_AUTOMAKE} ne '1.4') {
|| -r 'configure.ac'
|| (cat_('Makefile.in') =~ /^# Makefile\.in generated by automake (\S+)/ ? $1 : '') ge '1.5'
|| (cat_('aclocal.m4') =~ /^# aclocal.m4 generated automatically by aclocal (\S+)/ ? $1 : '') ge '1.5'
- || (cat_('configure.in') =~ /^\s*\[?AC_PREREQ\(\[?([^\)]{3})[^\)]*\]?\)/m ? $1 : '') gt '2.1'
- || (cat_('configure') =~ /^# Generated by Autoconf (\S+)/m ? $1 : '') gt '2.1'
- || (cat_('aclocal.m4') =~ /^\s*\[?AC_PREREQ\(\[?([^\)]{3})[^\)]*\]?\)/m ? $1 : '') gt '2.1')) {
+ || ac_version('configure.in') gt '2.13'
+ || (cat_('configure') =~ /^# Generated by Autoconf (\S+)/m ? $1 : '') gt '2.13'
+ || ac_version('aclocal.m4') gt '2.13')) {
$ENV{WANT_AUTOMAKE} = '1.5'; # to prevent further "cats" and to enhance consistency (possible cwd etc)
$binary = $binary_1_5;
} else {