Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 66478 | Differences between
and this patch

Collapse All | Expand All

(-)ac-wrapper-4.pl.orig (-28 / +20 lines)
Lines 15-45 Link Here
15
#
15
#
16
# Executes the correct autoconf version.
16
# Executes the correct autoconf version.
17
#
17
#
18
# - defaults to autoconf-2.13
18
# - defaults to autoconf-2.5x
19
# - runs autoconf-2.5x if it exists and...
19
# - runs autoconf-2.13 if it exists and...
20
#   - envvar WANT_AUTOCONF is set to `2.5'
20
#   - envvar WANT_AUTOCONF is set to `2.1'
21
#     -or-
21
#     -or-
22
#   - configure.ac is present
22
#   - `configure.in' contains AC_PREREQ and the value's 2 first letters
23
#     are stringwise equal to '2.1'
23
#     -or-
24
#     -or-
24
#   - `configure.in' contains AC_PREREQ and the value's 3 first letters
25
#   - `configure' is already present and was generated by autoconf equal to
25
#     are stringwise greater than '2.13'
26
#     -or-
27
#   - `configure' is already present and was generated by autoconf greater than
28
#     '2.13'
26
#     '2.13'
29
#     -or-
30
#   - `Makefile.in' was generated by automake-1.6 or superior, which
31
#     specifically needs autoconf-2.5x
32
#
27
#
33
28
34
#use MDK::Common;
29
#use MDK::Common;
35
30
36
sub cat_ { local *F; open F, $_[0] or return; my @l = <F>; wantarray ? @l : join '', @l }
31
sub cat_ { local *F; open F, $_[0] or return; my @l = <F>; wantarray ? @l : join '', @l }
37
sub ac_version {
32
sub ac_version {
38
	return ((@versions = cat_(shift) =~ /^\s*\[?AC_PREREQ\(\[?([^\)]{3}[0-9]?)[^\)]*\]?\)/mg) ? ((sort @versions)[-1]) : '');
33
	return ((@versions = cat_(shift) =~ /^\s*\[?AC_PREREQ\(\[?([^\)]{2}[0-9]?)[^\)]*\]?\)/mg) ? ((sort @versions)[-1]) : '');
39
}
34
}
40
35
41
my $binary     = "$0-2.13";
36
my $binary_old = "$0-2.13";
42
my $binary_new = "$0-2.5x";
37
my $binary     = "$0-2.5x";
43
38
44
# Autoconf is really getting out of hand, so rather start supporting
39
# Autoconf is really getting out of hand, so rather start supporting
45
# WANT_AUTOCONF = "2.5" the like.  Unfortunately it override the old
40
# WANT_AUTOCONF = "2.5" the like.  Unfortunately it override the old
Lines 52-71 Link Here
52
	}
47
	}
53
}
48
}
54
49
55
if ($ENV{WANT_AUTOCONF} ne '2.1') {
50
if ($ENV{WANT_AUTOCONF} ne '2.5') {
56
    if ((! -x $binary)                  # handle stuff like autom4te, where only 2.5x have the binary
51
	if ((-x $binary_old
57
	|| (-x $binary_new              # user may have only 2.13
52
	&& (($ENV{WANT_AUTOCONF} eq '2.1')
58
	    && (($ENV{WANT_AUTOCONF} eq '2.5')
53
	    || ac_version('configure.in') eq '2.1'
59
	        || -r 'configure.ac'
54
	    || (cat_('configure') =~ /^# Generated automatically using autoconf version (\S+)/m ? $1 : '') eq '2.13'
60
		|| ac_version('configure.in') gt '2.13'
55
	    || ac_version('aclocal.m4') eq '2.1'))) {
61
	        || (cat_('configure') =~ /^# Generated by Autoconf (\S+)/m ? $1 : '') gt '2.13'
56
		$ENV{WANT_AUTOCONF} = '2.1';    # to prevent further "cats" and to enhance consistency (possible cwd etc)
62
	        || (cat_('Makefile.in') =~ /^# Makefile\.in generated by automake (\S+)/ ? $1 : '') ge '1.6'
57
		$binary 	    = $binary_old;
63
		|| ac_version('aclocal.m4') gt '2.13'))) {
58
	} else {
64
	$ENV{WANT_AUTOCONF} = '2.5';    # to prevent further "cats" and to enhance consistency (possible cwd etc)
59
		$ENV{WANT_AUTOCONF} = '2.5';    # for further consistency
65
	$binary 	    = $binary_new;
60
	}
66
    } else {
67
	$ENV{WANT_AUTOCONF} = '2.1';    # for further consistency
68
    }
69
}
61
}
70
62
71
# Set AUTOM4TE to the proper version (bug #40983).
63
# Set AUTOM4TE to the proper version (bug #40983).

Return to bug 66478