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

(-)am-wrapper.pl-1.8-v2.orig (-80 / +43 lines)
Lines 16-83 Link Here
16
#
16
#
17
# Executes the correct autoconf version.
17
# Executes the correct autoconf version.
18
#
18
#
19
# - defaults to automake-1.4
19
# - defaults to automake-1.8
20
# - runs automake-1.8 if it exists and...
21
#   - envvar WANT_AUTOMAKE is set to `1.8'
22
#     -or-
23
#   - `Makefile.in' was generated by automake-1.8 or superior, which
24
#     specifically needs automake-1.8
25
#     -or_
26
#   - 'aclocal.m4' contain AM_AUTOMAKE_VERSION, specifying the use of 1.8
27
# - runs automake-1.7 if it exists and...
20
# - runs automake-1.7 if it exists and...
28
#   - envvar WANT_AUTOMAKE is set to `1.7'
21
#   - envvar WANT_AUTOMAKE is set to `1.7'
29
#     -or-
22
#     -or-
30
#   - `Makefile.in' was generated by automake-1.7 or superior, which
23
#   - `Makefile.in' was generated by automake-1.7, which
31
#     specifically needs automake-1.7
24
#     specifically needs automake-1.7
32
#     -or-
25
#     -or-
33
#   - 'aclocal.m4' contain AM_AUTOMAKE_VERSION, specifyint the use of 1.7
26
#   - 'aclocal.m4' contain AM_AUTOMAKE_VERSION, specifying the use of 1.7
34
#     -or-
35
# - runs automake-1.6 if it exists and...
27
# - runs automake-1.6 if it exists and...
36
#   - envvar WANT_AUTOMAKE is set to `1.6'
28
#   - envvar WANT_AUTOMAKE is set to `1.6'
37
#     -or-
29
#     -or-
38
#   - `Makefile.in' was generated by automake-1.6 or superior, which
30
#   - `Makefile.in' was generated by automake-1.6, which
39
#     specifically needs automake-1.6
31
#     specifically needs automake-1.6
40
#     -or-
32
#     -or-
41
#   - 'aclocal.m4' contain AM_AUTOMAKE_VERSION, specifyint the use of 1.6
33
#   - 'aclocal.m4' contain AM_AUTOMAKE_VERSION, specifying the use of 1.6
42
#     -or-
43
#   - `configure.in' contains AC_PREREQ and the value's 3 first letters
44
#      are stringwise greater than '2.53c'
45
#     -or-
46
#   - `configure' is already present and was generated by autoconf greater than
47
#     '2.53c'
48
# - runs automake-1.5 if it exists and...
34
# - runs automake-1.5 if it exists and...
49
#   - envvar WANT_AUTOMAKE is set to `1.5'
35
#   - envvar WANT_AUTOMAKE is set to `1.5'
50
#     -or-
36
#     -or-
51
#   - configure.ac is present
37
#   - `Makefile.in' was generated by automake-1.5, which
38
#     specifically needs automake-1.5
52
#     -or-
39
#     -or-
53
#   - `configure.in' contains AC_PREREQ and the value's 3 first letters
40
#   - 'aclocal.m4' contain AM_AUTOMAKE_VERSION, specifying the use of 1.5
54
#      are stringwise greater than '2.13'
41
# - runs automake-1.4 if it exists and...
42
#   - envvar WANT_AUTOMAKE is set to `1.4'
55
#     -or-
43
#     -or-
56
#   - `configure' is already present and was generated by autoconf greater than
44
#   - `Makefile.in' was generated by automake-1.4, which
57
#     '2.13'
45
#     specifically needs automake-1.4
58
#     -or-
46
#     -or-
59
#   - `Makefile.in' was generated by automake-1.5 or superior, which
47
#   - 'aclocal.m4' contain AM_AUTOMAKE_VERSION, specifying the use of 1.4
60
#     specifically needs automake-1.5
61
#
48
#
62
#use MDK::Common;
49
#use MDK::Common;
63
50
64
sub cat_ { local *F; open F, $_[0] or return; my @l = <F>; wantarray ? @l : join '', @l }
51
sub cat_ { local *F; open F, $_[0] or return; my @l = <F>; wantarray ? @l : join '', @l }
65
sub am_version {
52
sub am_version {
66
	my $file = cat_(shift);
53
	return (@versions = cat_(shift) =~ /^\s*\[?AM_AUTOMAKE_VERSION\(\[?([^\)]{2}[0-9]?)[^\)]*\]?\)/mg) ? ((sort @versions)[-1]) : '';
67
	return (@versions = $file =~ /^\s*\[?AM_AUTOMAKE_VERSION\(\[?([^\)]{3}[0-9]?)[^\)]*\]?\)/mg) ? ((sort @versions)[-1]) : '';
68
}
69
sub ac_version {
70
	my $file = cat_(shift);
71
	return (@versions = $file =~ /^\s*\[?AC_PREREQ\(\[?([^\)]{3}[0-9]?)[^\)]*\]?\)/mg) ? ((sort @versions)[-1]) : '';
72
}
54
}
73
55
74
56
my $binary_1_4  = "$0-1.4";
75
76
my $binary      = "$0-1.4";
77
my $binary_1_5  = "$0-1.5x";
57
my $binary_1_5  = "$0-1.5x";
78
my $binary_1_6  = "$0-1.6x";
58
my $binary_1_6  = "$0-1.6x";
79
my $binary_1_7  = "$0-1.7x";
59
my $binary_1_7  = "$0-1.7x";
80
my $binary_1_8  = "$0-1.8x";
60
my $binary      = "$0-1.8x";
81
61
82
# Automake is really getting out of hand, so rather start supporting
62
# Automake is really getting out of hand, so rather start supporting
83
# WANT_AUTOMAKE = "1.7" the like.  Unfortunately it override the old
63
# WANT_AUTOMAKE = "1.7" the like.  Unfortunately it override the old
Lines 85-146 Link Here
85
if ($ENV{WANT_AUTOMAKE} eq "") {
65
if ($ENV{WANT_AUTOMAKE} eq "") {
86
	if ($ENV{WANT_AUTOMAKE_1_4}) {
66
	if ($ENV{WANT_AUTOMAKE_1_4}) {
87
		$ENV{WANT_AUTOMAKE} = '1.4';
67
		$ENV{WANT_AUTOMAKE} = '1.4';
88
	} elsif ($ENV{WANT_AUTOMAKE_1_6}) {
89
		$ENV{WANT_AUTOMAKE} = '1.6';
90
	} elsif ($ENV{WANT_AUTOMAKE_1_5}) {
68
	} elsif ($ENV{WANT_AUTOMAKE_1_5}) {
91
		$ENV{WANT_AUTOMAKE} = '1.5';
69
		$ENV{WANT_AUTOMAKE} = '1.5';
70
	} elsif ($ENV{WANT_AUTOMAKE_1_6}) {
71
		$ENV{WANT_AUTOMAKE} = '1.6';
92
	}
72
	}
93
}
73
}
94
74
95
# question here is do we really want 1.5 or 1.6?  Out of a KDE outlook, it
75
if ($ENV{WANT_AUTOMAKE} ne '1.8') {
96
# should rather be 1.5, and since most people would rather have migrated to
76
	if (-x $binary_1_7              # user may not have 1.7 ...
97
# 1.5, and then stay with it for a bit (those 1.4 die hards ..), only have
98
# the 'configure.ac' test for 1.5 ...
99
if ($ENV{WANT_AUTOMAKE} ne '1.4') {
100
	if (-x $binary_1_8              # user may not have _1_8 ...
101
	&& (($ENV{WANT_AUTOMAKE} eq '1.8')
102
	    || (cat_('Makefile.in') =~ /^# Makefile\.in generated by automake (\S+)/ ? $1 : '') ge '1.8'
103
	    || (cat_('aclocal.m4') =~ /^# aclocal.m4 generated automatically by aclocal (\S+)/ ? $1 : '') ge '1.8'
104
	    || am_version('aclocal.m4') ge '1.8')) {
105
	$ENV{WANT_AUTOMAKE} = '1.8';    # to prevent further "cats" and to enhance consistency (possible cwd etc)
106
	$binary         = $binary_1_8;
107
        } elsif (-x $binary_1_7         # user may not have 1.7 ...
108
	&& (($ENV{WANT_AUTOMAKE} eq '1.7')
77
	&& (($ENV{WANT_AUTOMAKE} eq '1.7')
109
	    || (cat_('Makefile.in') =~ /^# Makefile\.in generated by automake (\S+)/ ? $1 : '') ge '1.7'
78
	    || (cat_('Makefile.in') =~ /^# Makefile\.in generated by automake (\S{3})/ ? $1 : '') eq '1.7'
110
	    || (cat_('aclocal.m4') =~ /^# aclocal.m4 generated automatically by aclocal (\S+)/ ? $1 : '') ge '1.7'
79
	    || (cat_('aclocal.m4') =~ /generated automatically by aclocal (\S{3})/ ? $1 : '') eq '1.7'
111
	    || am_version('aclocal.m4') ge '1.7')) {
80
	    || am_version('aclocal.m4') eq '1.7')) {
112
	$ENV{WANT_AUTOMAKE} = '1.7';    # to prevent further "cats" and to enhance consistency (possible cwd etc)
81
		$ENV{WANT_AUTOMAKE} = '1.7';    # to prevent further "cats" and to enhance consistency (possible cwd etc)
113
	$binary         = $binary_1_7;
82
		$binary         = $binary_1_7;
114
	} elsif (-x $binary_1_6         # user may not have 1.6 ...
83
	} elsif (-x $binary_1_6         # user may not have 1.6 ...
115
	&& (($ENV{WANT_AUTOMAKE} eq '1.6')
84
	&& (($ENV{WANT_AUTOMAKE} eq '1.6')
116
	    || (cat_('Makefile.in') =~ /^# Makefile\.in generated by automake (\S+)/ ? $1 : '') ge '1.6'
85
	    || (cat_('Makefile.in') =~ /^# Makefile\.in generated by automake (\S{3})/ ? $1 : '') eq '1.6'
117
	    || (cat_('aclocal.m4') =~ /^# aclocal.m4 generated automatically by aclocal (\S+)/ ? $1 : '') ge '1.6'
86
	    || (cat_('aclocal.m4') =~ /generated automatically by aclocal (\S{3})/ ? $1 : '') eq '1.6'
118
	    || am_version('aclocal.m4') ge '1.6'
87
	    || am_version('aclocal.m4') eq '1.6')) {
119
		# Autoconf 2.53d and later need automake-1.6c, so enable 1.6 for 2.53
88
		$ENV{WANT_AUTOMAKE} = '1.6';    # to prevent further "cats" and to enhance consistency (possible cwd etc)
120
		# and up .....
89
		$binary         = $binary_1_6;
121
	    || ac_version('configure.in') gt '2.52'
90
	} elsif (-x $binary_1_5         # user may not have 1.5 ...
122
	    || (cat_('configure') =~ /^# Generated by Autoconf (\S+)/m ? $1 : '') gt '2.52'
123
	    || ac_version('aclocal.m4') gt '2.52')) {
124
	$ENV{WANT_AUTOMAKE} = '1.6';    # to prevent further "cats" and to enhance consistency (possible cwd etc)
125
	$binary 		= $binary_1_6;
126
    } elsif (-x $binary_1_5         # user may have only 1.4 ...
127
	&& (($ENV{WANT_AUTOMAKE} eq '1.5')
91
	&& (($ENV{WANT_AUTOMAKE} eq '1.5')
128
	    || -r 'configure.ac'
92
	    || (cat_('Makefile.in') =~ /^# Makefile\.in generated automatically by automake (\S{3})/ ? $1 : '') eq '1.5'
129
	    || (cat_('Makefile.in') =~ /^# Makefile\.in generated by automake (\S+)/ ? $1 : '') ge '1.5'
93
	    || (cat_('aclocal.m4') =~ /generated automatically by aclocal (\S{3})/ ? $1 : '') eq '1.5'
130
	    || (cat_('aclocal.m4') =~ /^# aclocal.m4 generated automatically by aclocal (\S+)/ ? $1 : '') ge '1.5'
94
	    || am_version('aclocal.m4') eq '1.5')) {
131
	    || ac_version('configure.in') gt '2.13'
95
		$ENV{WANT_AUTOMAKE} = '1.5';    # to prevent further "cats" and to enhance consistency (possible cwd etc)
132
	    || (cat_('configure') =~ /^# Generated by Autoconf (\S+)/m ? $1 : '') gt '2.13'
96
		$binary 	= $binary_1_5;
133
	    || ac_version('aclocal.m4') gt '2.13')) {
97
	} elsif (-x $binary_1_4             # user may not have 1.4 ...
134
	$ENV{WANT_AUTOMAKE} = '1.5';    # to prevent further "cats" and to enhance consistency (possible cwd etc)
98
	&& (($ENV{WANT_AUTOMAKE} eq '1.4')
135
	$binary 		= $binary_1_5;
99
	    || (cat_('Makefile.in') =~ /^# Makefile\.in generated automatically by automake (\S{3})/ ? $1 : '') eq '1.4'
136
    } else {
100
	    || (cat_('aclocal.m4') =~ /generated automatically by aclocal (\S{3})/ ? $1 : '') eq '1.4'
137
	if (-r 'configure.in' || -r 'configure.ac') {
101
	    || am_version('aclocal.m4') eq '1.4')) {
138
		$ENV{WANT_AUTOMAKE} = '1.4';    # for further consistency
102
		$ENV{WANT_AUTOMAKE} = '1.4';    # to prevent further "cats" and to enhance consistency (possible cwd etc)
103
		$binary		= $binary_1_4;
139
	} else {
104
	} else {
140
		$ENV{WANT_AUTOMAKE} = '1.8';
105
		$ENV{WANT_AUTOMAKE} = '1.8';
141
		$binary         = $binary_1_8;
142
	}
106
	}
143
    }
144
}
107
}
145
108
146
$ENV{WANT_AMWRAPPER_DEBUG} and print STDERR "am-wrapper: will execute <$binary>\n";
109
$ENV{WANT_AMWRAPPER_DEBUG} and print STDERR "am-wrapper: will execute <$binary>\n";

Return to bug 66478