diff options
-rwxr-xr-x | am-wrapper.pl | 92 |
1 files changed, 69 insertions, 23 deletions
diff --git a/am-wrapper.pl b/am-wrapper.pl index bb397c7..0bd13a3 100755 --- a/am-wrapper.pl +++ b/am-wrapper.pl @@ -1,7 +1,8 @@ #!/usr/bin/perl # # -# Guillaume Cottenceau (gc@mandrakesoft.com) +# Author: Guillaume Cottenceau (gc@mandrakesoft.com) +# Modified by: Martin Schlemmer (azarah@gentoo.org) # # Copyright 2001 MandrakeSoft # @@ -16,13 +17,28 @@ # Executes the correct autoconf version. # # - defaults to automake-1.4 -# - runs automake-1.6x if it exists and... -# - envvar WANT_AUTOMAKE_1_6 is set to `1' +# - runs automake-1.7 if it exists and... +# - envvar WANT_AUTOMAKE is set to `1.7' +# -or- +# - `Makefile.in' was generated by automake-1.7 or superior, which +# specifically needs automake-1.7 +# -or_ +# - 'aclocal.m4' contain AM_AUTOMAKE_VERSION, specifying the use of 1.7 +# - runs automake-1.6 if it exists and... +# - envvar WANT_AUTOMAKE is set to `1.6' # -or- # - `Makefile.in' was generated by automake-1.6 or superior, which -# specifically needs automake-1.6x -# - runs automake-1.5x if it exists and... -# - envvar WANT_AUTOMAKE_1_5 is set to `1' +# specifically needs automake-1.6 +# -or- +# - 'aclocal.m4' contain AM_AUTOMAKE_VERSION, specifyint the use of 1.6 +# -or- +# - `configure.in' contains AC_PREREQ and the value's 3 first letters +# are stringwise greater than '2.53c' +# -or- +# - `configure' is already present and was generated by autoconf greater than +# '2.53c' +# - runs automake-1.5 if it exists and... +# - envvar WANT_AUTOMAKE is set to `1.5' # -or- # - configure.ac is present # -or- @@ -32,37 +48,67 @@ # - `configure' is already present and was generated by autoconf greater than # '2.1' # -or- -# - `Makefile.in' was generated by automake-1.5x or superior, which -# specifically needs automake-1.5x +# - `Makefile.in' was generated by automake-1.5 or superior, which +# specifically needs automake-1.5 # #use MDK::Common; sub cat_ { local *F; open F, $_[0] or return; my @l = <F>; wantarray ? @l : join '', @l } my $binary = "$0-1.4"; -my $binary_new = "$0-1.5x"; -my $binary_vnew = "$0-1.6x"; +my $binary_1_5 = "$0-1.5x"; +my $binary_1_6 = "$0-1.6x"; +my $binary_1_7 = "$0-1.7x"; + +# Automake is really getting out of hand, so rather start supporting +# WANT_AUTOMAKE = "1.7" the like. Unfortunately it override the old +# variables, so if not set, just convert the old variables .... +if ($ENV{WANT_AUTOMAKE} eq "") { + if ($ENV{WANT_AUTOMAKE_1_4}) { + $ENV{WANT_AUTOMAKE} = '1.4'; + } elsif ($ENV{WANT_AUTOMAKE_1_6}) { + $ENV{WANT_AUTOMAKE} = '1.6'; + } elsif ($ENV{WANT_AUTOMAKE_1_5}) { + $ENV{WANT_AUTOMAKE} = '1.5'; + } +} # question here is do we really want 1.5 or 1.6? Out of a KDE outlook, it # should rather be 1.5, and since most people would rather have migrated to # 1.5, and then stay with it for a bit (those 1.4 die hards ..), only have # the 'configure.ac' test for 1.5 ... -if (!$ENV{WANT_AUTOMAKE_1_4}) { - if (-x $binary_vnew # user may not have _1_6 - && ($ENV{WANT_AUTOMAKE_1_6} - || (cat_('Makefile.in') =~ /^# Makefile\.in generated by automake (\S+)/ ? $1 : '') ge '1.6')) { - $binary = $binary_vnew; - } elsif (-x $binary_new # user may have only 2.13 - && ($ENV{WANT_AUTOMAKE_1_5} +if ($ENV{WANT_AUTOMAKE} ne '1.4') { + if (-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')) { + $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' + # 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' + || (cat_('configure') =~ /^# Generated by Autoconf (\S+)/m ? $1 : '') gt '2.52' + || (cat_('aclocal.m4') =~ /^\s*AC_PREREQ\(\[?([^\)]{4})[^\)]*\]?\)/m ? $1 : '') 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 ... + && (($ENV{WANT_AUTOMAKE} eq '1.5') || -r 'configure.ac' - || (cat_('configure.in') =~ /^\s*AC_PREREQ\(\[?([^\)]{3})[^\)]*\)/m ? $1 : '') gt '2.1' - || (cat_('configure') =~ /^# Generated by Autoconf (\S+)/m ? $1 : '') gt '2.1' || (cat_('Makefile.in') =~ /^# Makefile\.in generated by automake (\S+)/ ? $1 : '') ge '1.5' - || (cat_('aclocal.m4') =~ /^\s*AC_PREREQ\(\[?([^\)]{3})[^\)]*\)/m ? $1 : '') gt '2.1')) { - $ENV{WANT_AUTOMAKE_1_5} = 1; # to prevent further "cats" and to enhance consistency (possible cwd etc) - $binary = $binary_new; + || (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')) { + $ENV{WANT_AUTOMAKE} = '1.5'; # to prevent further "cats" and to enhance consistency (possible cwd etc) + $binary = $binary_1_5; } else { - $ENV{WANT_AUTOMAKE_1_4} = 1; # for further consistency + $ENV{WANT_AUTOMAKE} = '1.4'; # for further consistency } } |