0b83a2b44c39c74d5358dcb1aa93ba0669352ac3
[openwrt/openwrt.git] / tools / autoconf / patches / 000-relocatable.patch
1 --- a/bin/autoheader.in
2 +++ b/bin/autoheader.in
3 @@ -29,7 +29,8 @@ eval 'case $# in 0) exec @PERL@ -S "$0";
4
5 BEGIN
6 {
7 - my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@';
8 + my $pkgdatadir = $ENV{'autom4te_perllibdir'} ||
9 + ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/share/autoconf' : '@pkgdatadir@');
10 unshift @INC, "$pkgdatadir";
11
12 # Override SHELL. On DJGPP SHELL may not be set to a shell
13 @@ -51,7 +52,7 @@ use strict;
14 use vars qw ($config_h %verbatim %symbol);
15
16 # Lib files.
17 -my $autom4te = $ENV{'AUTOM4TE'} || '@bindir@/@autom4te-name@';
18 +my $autom4te = $ENV{'AUTOM4TE'} || ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/bin/@autom4te-name@' : '@bindir@/@autom4te-name@');
19 local $config_h;
20 my $config_h_in;
21 my @prepend_include;
22 --- a/bin/autom4te.in
23 +++ b/bin/autom4te.in
24 @@ -25,7 +25,8 @@ eval 'case $# in 0) exec @PERL@ -S "$0";
25
26 BEGIN
27 {
28 - my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@';
29 + my $pkgdatadir = $ENV{'autom4te_perllibdir'} ||
30 + ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/share/autoconf' : '@pkgdatadir@');
31 unshift @INC, $pkgdatadir;
32
33 # Override SHELL. On DJGPP SHELL may not be set to a shell
34 @@ -45,7 +46,8 @@ use File::Basename;
35 use strict;
36
37 # Data directory.
38 -my $pkgdatadir = $ENV{'AC_MACRODIR'} || '@pkgdatadir@';
39 +my $pkgdatadir = $ENV{'AC_MACRODIR'} ||
40 + ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/share/autoconf' : '@pkgdatadir@');
41
42 # $LANGUAGE{LANGUAGE} -- Automatic options for LANGUAGE.
43 my %language;
44 @@ -88,7 +90,7 @@ my @include;
45 my $freeze = 0;
46
47 # $M4.
48 -my $m4 = $ENV{"M4"} || '@M4@';
49 +my $m4 = $ENV{"M4"} || ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/bin/m4' : '@M4@');
50 # Some non-GNU m4's don't reject the --help option, so give them /dev/null.
51 fatal "need GNU m4 1.4 or later: $m4"
52 if system "$m4 --help </dev/null 2>&1 | grep reload-state >/dev/null";
53 @@ -270,6 +272,12 @@ sub load_configuration ($)
54
55 my @words = shellwords ($_);
56 my $type = shift @words;
57 +
58 + if ($ENV{'STAGING_DIR'})
59 + {
60 + @words = map { s!^@pkgdatadir@!$ENV{'STAGING_DIR'}/../host/share/autoconf!; $_ } @words;
61 + }
62 +
63 if ($type eq 'begin-language:')
64 {
65 fatal "$file:$.: end-language missing for: $lang"
66 --- a/bin/autoreconf.in
67 +++ b/bin/autoreconf.in
68 @@ -27,7 +27,8 @@ eval 'case $# in 0) exec @PERL@ -S "$0";
69
70 BEGIN
71 {
72 - my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@';
73 + my $pkgdatadir = $ENV{'autom4te_perllibdir'} ||
74 + ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/share/autoconf' : '@pkgdatadir@');
75 unshift @INC, $pkgdatadir;
76
77 # Override SHELL. On DJGPP SHELL may not be set to a shell
78 @@ -107,9 +108,9 @@ Written by David J. MacKenzie and Akim D
79 ";
80
81 # Lib files.
82 -my $autoconf = $ENV{'AUTOCONF'} || '@bindir@/@autoconf-name@';
83 -my $autoheader = $ENV{'AUTOHEADER'} || '@bindir@/@autoheader-name@';
84 -my $autom4te = $ENV{'AUTOM4TE'} || '@bindir@/@autom4te-name@';
85 +my $autoconf = $ENV{'AUTOCONF'} || ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/bin/@autoconf-name@' : '@bindir@/@autoconf-name@');
86 +my $autoheader = $ENV{'AUTOHEADER'} || ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/bin/@autoheader-name@' : '@bindir@/@autoheader-name@');
87 +my $autom4te = $ENV{'AUTOM4TE'} || ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/bin/@autom4te-name@' : '@bindir@/@autom4te-name@');
88 my $automake = $ENV{'AUTOMAKE'} || 'automake';
89 my $aclocal = $ENV{'ACLOCAL'} || 'aclocal';
90 my $libtoolize = $ENV{'LIBTOOLIZE'} || 'libtoolize';
91 --- a/bin/autoscan.in
92 +++ b/bin/autoscan.in
93 @@ -26,7 +26,8 @@ eval 'case $# in 0) exec @PERL@ -S "$0";
94
95 BEGIN
96 {
97 - my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@';
98 + my $pkgdatadir = $ENV{'autom4te_perllibdir'} ||
99 + ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/share/autoconf' : '@pkgdatadir@');
100 unshift @INC, $pkgdatadir;
101
102 # Override SHELL. On DJGPP SHELL may not be set to a shell
103 @@ -92,10 +93,10 @@ my $configure_scan = 'configure.scan';
104 my $log;
105
106 # Autoconf and lib files.
107 -my $autom4te = $ENV{'AUTOM4TE'} || '@bindir@/@autom4te-name@';
108 +my $autom4te = $ENV{'AUTOM4TE'} || ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/bin/@autom4te-name@' : '@bindir@/@autom4te-name@');
109 my $autoconf = "$autom4te --language=autoconf";
110 my @prepend_include;
111 -my @include = ('@pkgdatadir@');
112 +my @include = ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/share/autoconf' : '@pkgdatadir@');
113
114 # $help
115 # -----
116 --- a/bin/autoupdate.in
117 +++ b/bin/autoupdate.in
118 @@ -27,7 +27,8 @@ eval 'case $# in 0) exec @PERL@ -S "$0";
119
120 BEGIN
121 {
122 - my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@';
123 + my $pkgdatadir = $ENV{'autom4te_perllibdir'} ||
124 + ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/share/autoconf' : '@pkgdatadir@');
125 unshift @INC, $pkgdatadir;
126
127 # Override SHELL. On DJGPP SHELL may not be set to a shell
128 @@ -51,10 +52,10 @@ my $autom4te = $ENV{'AUTOM4TE'} || '@bin
129 my $autoconf = "$autom4te --language=autoconf";
130 # We need to find m4sugar.
131 my @prepend_include;
132 -my @include = ('@pkgdatadir@');
133 +my @include = ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/share/autoconf' : '@pkgdatadir@');
134 my $force = 0;
135 # m4.
136 -my $m4 = $ENV{"M4"} || '@M4@';
137 +my $m4 = $ENV{"M4"} || ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/bin/m4' : '@M4@');
138
139
140 # $HELP
141 --- a/bin/ifnames.in
142 +++ b/bin/ifnames.in
143 @@ -31,7 +31,8 @@ eval 'case $# in 0) exec @PERL@ -S "$0";
144
145 BEGIN
146 {
147 - my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@';
148 + my $pkgdatadir = $ENV{'autom4te_perllibdir'} ||
149 + ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/share/autoconf' : '@pkgdatadir@');
150 unshift @INC, $pkgdatadir;
151
152 # Override SHELL. On DJGPP SHELL may not be set to a shell
153 --- a/bin/autoconf.as
154 +++ b/bin/autoconf.as
155 @@ -85,7 +85,11 @@ exit_missing_arg='
156 # restore font-lock: '
157
158 # Variables.
159 -: ${AUTOM4TE='@bindir@/@autom4te-name@'}
160 +if test -n "$STAGING_DIR"; then
161 + : ${AUTOM4TE="$STAGING_DIR/../host/bin/@autom4te-name@"}
162 +else
163 + : ${AUTOM4TE='@bindir@/@autom4te-name@'}
164 +fi
165 autom4te_options=
166 outfile=
167 verbose=false