View | Details | Raw Unified
Collapse All | Expand All

(-) am-wrapper.pl-1.8-v2.orig (-80 / +43 lines)
 Lines 16-83    Link Here 
#
#
# Executes the correct autoconf version.
# Executes the correct autoconf version.
#
#
# - defaults to automake-1.4
# - defaults to automake-1.8
# - runs automake-1.8 if it exists and...
#   - envvar WANT_AUTOMAKE is set to `1.8'
#     -or-
#   - `Makefile.in' was generated by automake-1.8 or superior, which
#     specifically needs automake-1.8
#     -or_
#   - 'aclocal.m4' contain AM_AUTOMAKE_VERSION, specifying the use of 1.8
# - runs automake-1.7 if it exists and...
# - runs automake-1.7 if it exists and...
#   - envvar WANT_AUTOMAKE is set to `1.7'
#   - envvar WANT_AUTOMAKE is set to `1.7'
#     -or-
#     -or-
#   - `Makefile.in' was generated by automake-1.7 or superior, which
#   - `Makefile.in' was generated by automake-1.7, which
#     specifically needs automake-1.7
#     specifically needs automake-1.7
#     -or-
#     -or-
#   - 'aclocal.m4' contain AM_AUTOMAKE_VERSION, specifyint the use of 1.7
#   - 'aclocal.m4' contain AM_AUTOMAKE_VERSION, specifying the use of 1.7
#     -or-
# - runs automake-1.6 if it exists and...
# - runs automake-1.6 if it exists and...
#   - envvar WANT_AUTOMAKE is set to `1.6'
#   - envvar WANT_AUTOMAKE is set to `1.6'
#     -or-
#     -or-
#   - `Makefile.in' was generated by automake-1.6 or superior, which
#   - `Makefile.in' was generated by automake-1.6, which
#     specifically needs automake-1.6
#     specifically needs automake-1.6
#     -or-
#     -or-
#   - 'aclocal.m4' contain AM_AUTOMAKE_VERSION, specifyint the use of 1.6
#   - 'aclocal.m4' contain AM_AUTOMAKE_VERSION, specifying 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...
# - runs automake-1.5 if it exists and...
#   - envvar WANT_AUTOMAKE is set to `1.5'
#   - envvar WANT_AUTOMAKE is set to `1.5'
#     -or-
#     -or-
#   - configure.ac is present
#   - `Makefile.in' was generated by automake-1.5, which
#     specifically needs automake-1.5
#     -or-
#     -or-
#   - `configure.in' contains AC_PREREQ and the value's 3 first letters
#   - 'aclocal.m4' contain AM_AUTOMAKE_VERSION, specifying the use of 1.5
#      are stringwise greater than '2.13'
# - runs automake-1.4 if it exists and...
#   - envvar WANT_AUTOMAKE is set to `1.4'
#     -or-
#     -or-
#   - `configure' is already present and was generated by autoconf greater than
#   - `Makefile.in' was generated by automake-1.4, which
#     '2.13'
#     specifically needs automake-1.4
#     -or-
#     -or-
#   - `Makefile.in' was generated by automake-1.5 or superior, which
#   - 'aclocal.m4' contain AM_AUTOMAKE_VERSION, specifying the use of 1.4
#     specifically needs automake-1.5
#
#
#use MDK::Common;
#use MDK::Common;
sub cat_ { local *F; open F, $_[0] or return; my @l = <F>; wantarray ? @l : join '', @l }
sub cat_ { local *F; open F, $_[0] or return; my @l = <F>; wantarray ? @l : join '', @l }
sub am_version {
sub am_version {
	my $file = cat_(shift);
	return (@versions = cat_(shift) =~ /^\s*\[?AM_AUTOMAKE_VERSION\(\[?([^\)]{2}[0-9]?)[^\)]*\]?\)/mg) ? ((sort @versions)[-1]) : '';
	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_1_4  = "$0-1.4";
my $binary      = "$0-1.4";
my $binary_1_5  = "$0-1.5x";
my $binary_1_5  = "$0-1.5x";
my $binary_1_6  = "$0-1.6x";
my $binary_1_6  = "$0-1.6x";
my $binary_1_7  = "$0-1.7x";
my $binary_1_7  = "$0-1.7x";
my $binary_1_8  = "$0-1.8x";
my $binary      = "$0-1.8x";
# Automake is really getting out of hand, so rather start supporting
# Automake is really getting out of hand, so rather start supporting
# WANT_AUTOMAKE = "1.7" the like.  Unfortunately it override the old
# WANT_AUTOMAKE = "1.7" the like.  Unfortunately it override the old
 Lines 85-146    Link Here 
if ($ENV{WANT_AUTOMAKE} eq "") {
if ($ENV{WANT_AUTOMAKE} eq "") {
	if ($ENV{WANT_AUTOMAKE_1_4}) {
	if ($ENV{WANT_AUTOMAKE_1_4}) {
		$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}) {
	} elsif ($ENV{WANT_AUTOMAKE_1_5}) {
		$ENV{WANT_AUTOMAKE} = '1.5';
		$ENV{WANT_AUTOMAKE} = '1.5';
	} elsif ($ENV{WANT_AUTOMAKE_1_6}) {
		$ENV{WANT_AUTOMAKE} = '1.6';
	}
	}
}
}
# question here is do we really want 1.5 or 1.6?  Out of a KDE outlook, it
if ($ENV{WANT_AUTOMAKE} ne '1.8') {
# should rather be 1.5, and since most people would rather have migrated to
	if (-x $binary_1_7              # user may not have 1.7 ...
# 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} ne '1.4') {
	if (-x $binary_1_8              # user may not have _1_8 ...
	&& (($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'
	    || 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')
	&& (($ENV{WANT_AUTOMAKE} eq '1.7')
	    || (cat_('Makefile.in') =~ /^# Makefile\.in generated by automake (\S+)/ ? $1 : '') ge '1.7'
	    || (cat_('Makefile.in') =~ /^# Makefile\.in generated by automake (\S{3})/ ? $1 : '') eq '1.7'
	    || (cat_('aclocal.m4') =~ /^# aclocal.m4 generated automatically by aclocal (\S+)/ ? $1 : '') ge '1.7'
	    || (cat_('aclocal.m4') =~ /generated automatically by aclocal (\S{3})/ ? $1 : '') eq '1.7'
	    || am_version('aclocal.m4') ge '1.7')) {
	    || am_version('aclocal.m4') eq '1.7')) {
	$ENV{WANT_AUTOMAKE} = '1.7';    # to prevent further "cats" and to enhance consistency (possible cwd etc)
		$ENV{WANT_AUTOMAKE} = '1.7';    # to prevent further "cats" and to enhance consistency (possible cwd etc)
	$binary         = $binary_1_7;
		$binary         = $binary_1_7;
	} elsif (-x $binary_1_6         # user may not have 1.6 ...
	} elsif (-x $binary_1_6         # user may not have 1.6 ...
	&& (($ENV{WANT_AUTOMAKE} eq '1.6')
	&& (($ENV{WANT_AUTOMAKE} eq '1.6')
	    || (cat_('Makefile.in') =~ /^# Makefile\.in generated by automake (\S+)/ ? $1 : '') ge '1.6'
	    || (cat_('Makefile.in') =~ /^# Makefile\.in generated by automake (\S{3})/ ? $1 : '') eq '1.6'
	    || (cat_('aclocal.m4') =~ /^# aclocal.m4 generated automatically by aclocal (\S+)/ ? $1 : '') ge '1.6'
	    || (cat_('aclocal.m4') =~ /generated automatically by aclocal (\S{3})/ ? $1 : '') eq '1.6'
	    || am_version('aclocal.m4') ge '1.6'
	    || am_version('aclocal.m4') eq '1.6')) {
		# Autoconf 2.53d and later need automake-1.6c, so enable 1.6 for 2.53
		$ENV{WANT_AUTOMAKE} = '1.6';    # to prevent further "cats" and to enhance consistency (possible cwd etc)
		# and up .....
		$binary         = $binary_1_6;
	    || ac_version('configure.in') gt '2.52'
	} elsif (-x $binary_1_5         # user may not have 1.5 ...
	    || (cat_('configure') =~ /^# Generated by Autoconf (\S+)/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 ...
	&& (($ENV{WANT_AUTOMAKE} eq '1.5')
	&& (($ENV{WANT_AUTOMAKE} eq '1.5')
	    || -r 'configure.ac'
	    || (cat_('Makefile.in') =~ /^# Makefile\.in generated automatically by automake (\S{3})/ ? $1 : '') eq '1.5'
	    || (cat_('Makefile.in') =~ /^# Makefile\.in generated by automake (\S+)/ ? $1 : '') ge '1.5'
	    || (cat_('aclocal.m4') =~ /generated automatically by aclocal (\S{3})/ ? $1 : '') eq '1.5'
	    || (cat_('aclocal.m4') =~ /^# aclocal.m4 generated automatically by aclocal (\S+)/ ? $1 : '') ge '1.5'
	    || am_version('aclocal.m4') eq '1.5')) {
	    || ac_version('configure.in') gt '2.13'
		$ENV{WANT_AUTOMAKE} = '1.5';    # to prevent further "cats" and to enhance consistency (possible cwd etc)
	    || (cat_('configure') =~ /^# Generated by Autoconf (\S+)/m ? $1 : '') gt '2.13'
		$binary 	= $binary_1_5;
	    || ac_version('aclocal.m4') gt '2.13')) {
	} elsif (-x $binary_1_4             # user may not have 1.4 ...
	$ENV{WANT_AUTOMAKE} = '1.5';    # to prevent further "cats" and to enhance consistency (possible cwd etc)
	&& (($ENV{WANT_AUTOMAKE} eq '1.4')
	$binary 		= $binary_1_5;
	    || (cat_('Makefile.in') =~ /^# Makefile\.in generated automatically by automake (\S{3})/ ? $1 : '') eq '1.4'
    } else {
	    || (cat_('aclocal.m4') =~ /generated automatically by aclocal (\S{3})/ ? $1 : '') eq '1.4'
	if (-r 'configure.in' || -r 'configure.ac') {
	    || am_version('aclocal.m4') eq '1.4')) {
		$ENV{WANT_AUTOMAKE} = '1.4';    # for further consistency
		$ENV{WANT_AUTOMAKE} = '1.4';    # to prevent further "cats" and to enhance consistency (possible cwd etc)
		$binary		= $binary_1_4;
	} else {
	} else {
		$ENV{WANT_AUTOMAKE} = '1.8';
		$ENV{WANT_AUTOMAKE} = '1.8';
		$binary         = $binary_1_8;
	}
	}
    }
}
}
$ENV{WANT_AMWRAPPER_DEBUG} and print STDERR "am-wrapper: will execute <$binary>\n";
$ENV{WANT_AMWRAPPER_DEBUG} and print STDERR "am-wrapper: will execute <$binary>\n";