openwrtv3/tools/autoconf/patches/000-relocatable.patch
Jo-Philipp Wich e0c8e20f8c autoconf: portability fixes
The rework of the host tools discovery caused autoconf to embed
absolute paths to staging_dir/host/bin/perl into the shebang
of the generated autoconfig executables.

Switch to the portable "/usr/bin/env perl" and enable global
warnings through "$^W" instead of the "-w" interpreter argument.

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>

SVN-Revision: 44971
2015-03-24 13:12:52 +00:00

229 lines
7.3 KiB
Diff

--- a/bin/autoheader.in
+++ b/bin/autoheader.in
@@ -28,7 +28,8 @@ eval 'case $# in 0) exec @PERL@ -S "$0";
BEGIN
{
- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@';
+ my $pkgdatadir = $ENV{'autom4te_perllibdir'} ||
+ ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/share/autoconf' : '@pkgdatadir@');
unshift @INC, "$pkgdatadir";
# Override SHELL. On DJGPP SHELL may not be set to a shell
@@ -50,7 +51,7 @@ use strict;
use vars qw ($config_h %verbatim %symbol);
# Lib files.
-my $autom4te = $ENV{'AUTOM4TE'} || '@bindir@/@autom4te-name@';
+my $autom4te = $ENV{'AUTOM4TE'} || ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/bin/@autom4te-name@' : '@bindir@/@autom4te-name@');
local $config_h;
my $config_h_in;
my @prepend_include;
--- a/bin/autom4te.in
+++ b/bin/autom4te.in
@@ -1,10 +1,12 @@
-#! @PERL@ -w
+#! @PERL@
# -*- perl -*-
# @configure_input@
eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac'
if 0;
+$^W = 1;
+
# autom4te - Wrapper around M4 libraries.
# Copyright (C) 2001-2003, 2005-2012 Free Software Foundation, Inc.
@@ -24,7 +26,8 @@ eval 'case $# in 0) exec @PERL@ -S "$0";
BEGIN
{
- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@';
+ my $pkgdatadir = $ENV{'autom4te_perllibdir'} ||
+ ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/share/autoconf' : '@pkgdatadir@');
unshift @INC, $pkgdatadir;
# Override SHELL. On DJGPP SHELL may not be set to a shell
@@ -44,7 +47,8 @@ use File::Basename;
use strict;
# Data directory.
-my $pkgdatadir = $ENV{'AC_MACRODIR'} || '@pkgdatadir@';
+my $pkgdatadir = $ENV{'AC_MACRODIR'} ||
+ ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/share/autoconf' : '@pkgdatadir@');
# $LANGUAGE{LANGUAGE} -- Automatic options for LANGUAGE.
my %language;
@@ -87,7 +91,7 @@ my @include;
my $freeze = 0;
# $M4.
-my $m4 = $ENV{"M4"} || '@M4@';
+my $m4 = $ENV{"M4"} || ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/bin/m4' : '@M4@');
# Some non-GNU m4's don't reject the --help option, so give them /dev/null.
fatal "need GNU m4 1.4 or later: $m4"
if system "$m4 --help </dev/null 2>&1 | grep reload-state >/dev/null";
@@ -269,6 +273,12 @@ sub load_configuration ($)
my @words = shellwords ($_);
my $type = shift @words;
+
+ if ($ENV{'STAGING_DIR'})
+ {
+ @words = map { s!^@pkgdatadir@!$ENV{'STAGING_DIR'}/../host/share/autoconf!; $_ } @words;
+ }
+
if ($type eq 'begin-language:')
{
fatal "$file:$.: end-language missing for: $lang"
--- a/bin/autoreconf.in
+++ b/bin/autoreconf.in
@@ -1,10 +1,12 @@
-#! @PERL@ -w
+#! @PERL@
# -*- perl -*-
# @configure_input@
eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac'
if 0;
+$^W = 1;
+
# autoreconf - install the GNU Build System in a directory tree
# Copyright (C) 1994, 1999-2012 Free Software Foundation, Inc.
@@ -26,7 +28,8 @@ eval 'case $# in 0) exec @PERL@ -S "$0";
BEGIN
{
- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@';
+ my $pkgdatadir = $ENV{'autom4te_perllibdir'} ||
+ ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/share/autoconf' : '@pkgdatadir@');
unshift @INC, $pkgdatadir;
# Override SHELL. On DJGPP SHELL may not be set to a shell
@@ -106,9 +109,9 @@ Written by David J. MacKenzie and Akim D
";
# Lib files.
-my $autoconf = $ENV{'AUTOCONF'} || '@bindir@/@autoconf-name@';
-my $autoheader = $ENV{'AUTOHEADER'} || '@bindir@/@autoheader-name@';
-my $autom4te = $ENV{'AUTOM4TE'} || '@bindir@/@autom4te-name@';
+my $autoconf = $ENV{'AUTOCONF'} || ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/bin/@autoconf-name@' : '@bindir@/@autoconf-name@');
+my $autoheader = $ENV{'AUTOHEADER'} || ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/bin/@autoheader-name@' : '@bindir@/@autoheader-name@');
+my $autom4te = $ENV{'AUTOM4TE'} || ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/bin/@autom4te-name@' : '@bindir@/@autom4te-name@');
my $automake = $ENV{'AUTOMAKE'} || 'automake';
my $aclocal = $ENV{'ACLOCAL'} || 'aclocal';
my $libtoolize = $ENV{'LIBTOOLIZE'} || 'libtoolize';
--- a/bin/autoscan.in
+++ b/bin/autoscan.in
@@ -1,4 +1,4 @@
-#! @PERL@ -w
+#! @PERL@
# -*- perl -*-
# @configure_input@
@@ -23,9 +23,12 @@
eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac'
if 0;
+$^W = 1;
+
BEGIN
{
- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@';
+ my $pkgdatadir = $ENV{'autom4te_perllibdir'} ||
+ ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/share/autoconf' : '@pkgdatadir@');
unshift @INC, $pkgdatadir;
# Override SHELL. On DJGPP SHELL may not be set to a shell
@@ -91,10 +94,10 @@ my $configure_scan = 'configure.scan';
my $log;
# Autoconf and lib files.
-my $autom4te = $ENV{'AUTOM4TE'} || '@bindir@/@autom4te-name@';
+my $autom4te = $ENV{'AUTOM4TE'} || ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/bin/@autom4te-name@' : '@bindir@/@autom4te-name@');
my $autoconf = "$autom4te --language=autoconf";
my @prepend_include;
-my @include = ('@pkgdatadir@');
+my @include = ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/share/autoconf' : '@pkgdatadir@');
# $help
# -----
--- a/bin/autoupdate.in
+++ b/bin/autoupdate.in
@@ -1,4 +1,4 @@
-#! @PERL@ -w
+#! @PERL@
# -*- perl -*-
# @configure_input@
@@ -24,9 +24,12 @@
eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac'
if 0;
+$^W = 1;
+
BEGIN
{
- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@';
+ my $pkgdatadir = $ENV{'autom4te_perllibdir'} ||
+ ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/share/autoconf' : '@pkgdatadir@');
unshift @INC, $pkgdatadir;
# Override SHELL. On DJGPP SHELL may not be set to a shell
@@ -50,10 +53,10 @@ my $autom4te = $ENV{'AUTOM4TE'} || '@bin
my $autoconf = "$autom4te --language=autoconf";
# We need to find m4sugar.
my @prepend_include;
-my @include = ('@pkgdatadir@');
+my @include = ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/share/autoconf' : '@pkgdatadir@');
my $force = 0;
# m4.
-my $m4 = $ENV{"M4"} || '@M4@';
+my $m4 = $ENV{"M4"} || ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/bin/m4' : '@M4@');
# $HELP
--- a/bin/ifnames.in
+++ b/bin/ifnames.in
@@ -1,10 +1,12 @@
-#! @PERL@ -w
+#! @PERL@
# -*- perl -*-
# @configure_input@
eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac'
if 0;
+$^W = 1;
+
# ifnames - print the identifiers used in C preprocessor conditionals
# Copyright (C) 1994-1995, 1999-2003, 2005-2012 Free Software
@@ -31,7 +33,8 @@ eval 'case $# in 0) exec @PERL@ -S "$0";
BEGIN
{
- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@';
+ my $pkgdatadir = $ENV{'autom4te_perllibdir'} ||
+ ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/share/autoconf' : '@pkgdatadir@');
unshift @INC, $pkgdatadir;
# Override SHELL. On DJGPP SHELL may not be set to a shell
--- a/bin/autoconf.as
+++ b/bin/autoconf.as
@@ -84,7 +84,11 @@ exit_missing_arg='
# restore font-lock: '
# Variables.
-: ${AUTOM4TE='@bindir@/@autom4te-name@'}
+if test -n "$STAGING_DIR"; then
+ : ${AUTOM4TE="$STAGING_DIR/../host/bin/@autom4te-name@"}
+else
+ : ${AUTOM4TE='@bindir@/@autom4te-name@'}
+fi
autom4te_options=
outfile=
verbose=false