summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pjm@nac.net>2013-06-20 17:18:32 (EDT)
committer P. J. McDermott <pjm@nac.net>2013-06-20 17:21:55 (EDT)
commit90dcdf53a77b20fdae72b4a2a057d1e19c630691 (patch)
treefe7e0b83c1d649649a022f16c6fa174ffde00468
parent7472da5ca328fac9435e227d1e24cdeb4b47e508 (diff)
Fix $as_me clobbering in patch.
-rw-r--r--patches/02_fix-preconfigure-on-busybox-ash.patch63
1 files changed, 47 insertions, 16 deletions
diff --git a/patches/02_fix-preconfigure-on-busybox-ash.patch b/patches/02_fix-preconfigure-on-busybox-ash.patch
index 9c2aacd..7bc8edc 100644
--- a/patches/02_fix-preconfigure-on-busybox-ash.patch
+++ b/patches/02_fix-preconfigure-on-busybox-ash.patch
@@ -4,29 +4,57 @@ Description: Fix sysdeps preconfigure fragments on BusyBox ash
AS_LINENO_PREPARE macro (executed by AC_INIT) preprocesses the script
$as_myself into $as_me.lineno.
.
- Unfortunately, when loading sysdeps preconfigure fragements, these as_*
- parameters refer to the configure script rather than the fragments.
+ Unfortunately, when loading (with the "." utility) sysdeps preconfigure
+ fragements, these as_* parameters refer to the configure script rather than
+ the fragments.
.
- As a result, the configure script is executed by a preconfigure fragment in an
- infinitely recursive loop.
+ As a result, the configure script is in turn loaded by a preconfigure fragment
+ in an infinitely recursive loop.
.
- This patch temporarily changes the parameters to refer to the fragments,
- allowing the fragments to be properly preprocessed and breaking the loop.
+ $as_myself and (especially) $as_me need to be changed to refer to the fragment
+ to make it stop loading the configure script.
+ .
+ $as_myself can simply be set in configure to the path to the fragment. (Of
+ course, it should be changed back to the path to configure after the fragment
+ is loaded.)
+ .
+ However, changing $as_me from configure doesn't help; AS_LINENO_PREPARE in the
+ fragment just clobbers the change and reverts $as_me back to "configure" (the
+ script name it gets from $0). So the fragment will end up writing itself over
+ the configure script! We need to change the value of $as_me some other way.
+ .
+ So we create a new directory in the build area and load the fragment from
+ there. With this trick, $as_me refers to a file named configure in a
+ subdirectory of the build area. It's not perfect, but it's minimally invasive
+ (touching only a glibc M4 macro and no Autoconf macros).
+ .
+ The fragment needs to find confdefs.h, so we also link or copy this file into
+ the new directory.
+ .
+ In summary, this patch temporarily changes $as_myself to refer to the
+ fragments, enters a new directory in the build area (since the preconfigure
+ fragment will write a modified copy of itself to configure.lineno in its
+ current working directory), and makes a copy of confdefs.h in the new
+ directory. All this allows the fragments to be properly preprocessed and
+ breaking the loop.
diff -Naur src.orig/libc/aclocal.m4 src/libc/aclocal.m4
--- src.orig/libc/aclocal.m4 2012-12-02 16:11:45.000000000 -0500
+++ src/libc/aclocal.m4 2013-06-20 12:19:51.818414209 -0400
-@@ -161,7 +161,14 @@
+@@ -161,7 +161,17 @@
for frag in $frags; do
name=`echo "$frag" | sed 's@/[[^/]]*[$]@@;s@^.*/@@'`
echo $ECHO_N "$name $ECHO_C" >&AS_MESSAGE_FD
-+ orig_as_me=$as_me
+ orig_as_myself=$as_myself
-+ as_me=${frag##*/sysdeps/}
-+ as_me=${as_me%/preconfigure}-preconfigure
+ as_myself=$frag
++ as_dir=sysdeps/${frag##*/sysdeps/}
++ as_dir=${as_dir%/preconfigure}
++ as_fn_mkdir_p
++ rm -f $ac_pwd/$as_dir/confdefs.h
++ $as_ln_s $ac_pwd/confdefs.h $ac_pwd/$as_dir/confdefs.h
++ cd $as_dir
. "$frag"
-+ as_me=$orig_as_me
++ cd $ac_pwd
+ as_myself=$orig_as_myself
done
AC_MSG_RESULT()
@@ -34,17 +62,20 @@ diff -Naur src.orig/libc/aclocal.m4 src/libc/aclocal.m4
diff -Naur src.orig/libc/configure src/libc/configure
--- src.orig/libc/configure 2012-12-02 16:11:45.000000000 -0500
+++ src/libc/configure 2013-06-20 12:24:26.226678382 -0400
-@@ -4000,7 +4000,14 @@
+@@ -4000,7 +4000,17 @@
for frag in $frags; do
name=`echo "$frag" | sed 's@/[^/]*$@@;s@^.*/@@'`
echo $ECHO_N "$name $ECHO_C" >&6
-+ orig_as_me=$as_me
+ orig_as_myself=$as_myself
-+ as_me=${frag##*/sysdeps/}
-+ as_me=${as_me%/preconfigure}-preconfigure
+ as_myself=$frag
++ as_dir=sysdeps/${frag##*/sysdeps/}
++ as_dir=${as_dir%/preconfigure}
++ as_fn_mkdir_p
++ rm -f $ac_pwd/$as_dir/confdefs.h
++ $as_ln_s $ac_pwd/confdefs.h $ac_pwd/$as_dir/confdefs.h
++ cd $as_dir
. "$frag"
-+ as_me=$orig_as_me
++ cd $ac_pwd
+ as_myself=$orig_as_myself
done
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5