diff options
author | P. J. McDermott <pjm@nac.net> | 2013-09-11 13:00:13 (EDT) |
---|---|---|
committer | P. J. McDermott <pjm@nac.net> | 2013-09-11 13:04:04 (EDT) |
commit | b777b148aafd59118bd46beee509ec610b0cf06e (patch) | |
tree | 320f3f7475f2ad509fbe57379cc1f3e8154024a6 | |
parent | b0040839b0b32bd4369bb499571fa1a8877dcbbf (diff) |
Much more sanely fix preconfigure loop issue.
-rw-r--r-- | patches/02_fix-preconfigure-on-busybox-ash.patch | 227 |
1 files changed, 133 insertions, 94 deletions
diff --git a/patches/02_fix-preconfigure-on-busybox-ash.patch b/patches/02_fix-preconfigure-on-busybox-ash.patch index 16ef4e4..7052064 100644 --- a/patches/02_fix-preconfigure-on-busybox-ash.patch +++ b/patches/02_fix-preconfigure-on-busybox-ash.patch @@ -1,99 +1,138 @@ From: "P. J. McDermott" <pjm@nac.net> -Description: Fix sysdeps preconfigure fragments on BusyBox ash - On shells that don't support the LINENO parameter (e.g. BusyBox ash), the - AS_LINENO_PREPARE macro (executed by AC_INIT) preprocesses the script - $as_myself into $as_me.lineno. - . - 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 in turn loaded by a preconfigure fragment - in an infinitely recursive 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. - . - But AS_LINENO_PREPARE causes the fragment to exit after reloading itself (to - prevent the whole script from running twice). So we change "exit" to "return" - in AS_LINENO_PREPARE in the fragment to tell the shell to stop executing the - loaded script. - . - 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), makes a copy of confdefs.h in the new directory, - and prevents fragments from killing the entire configure script. All this - allows the fragments to be properly preprocessed and the loop to be broken. +Subject: Remove manually-added Autoconf macros. + +Using _AS_LINENO_PREPARE in both the main configure script and a script that +configure loads causes (on shells with no LINENO variable, e.g. BusyBox ash) +infinite mutual recursion between the two scripts. + +These macros are removed in version 2.18 upstream: + + <https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=06d5adf> -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,17 @@ - for frag in $frags; do - name=`echo "$frag" | sed 's@/[[^/]]*[$]@@;s@^.*/@@'` - echo $ECHO_N "$name $ECHO_C" >&AS_MESSAGE_FD -+ orig_as_myself=$as_myself -+ 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" -+ cd $ac_pwd -+ as_myself=$orig_as_myself - done - AC_MSG_RESULT() - fi]) -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,17 @@ - for frag in $frags; do - name=`echo "$frag" | sed 's@/[^/]*$@@;s@^.*/@@'` - echo $ECHO_N "$name $ECHO_C" >&6 -+ orig_as_myself=$as_myself -+ 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" -+ cd $ac_pwd -+ as_myself=$orig_as_myself - done - { $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5 - $as_echo "" >&6; } diff -Naur src.orig/libc/sysdeps/x86_64/preconfigure src/libc/sysdeps/x86_64/preconfigure --- src.orig/libc/sysdeps/x86_64/preconfigure 2012-04-21 13:19:39.000000000 -0400 -+++ src/libc/sysdeps/x86_64/preconfigure 2013-06-20 17:23:38.340955965 -0400 -@@ -77,7 +77,7 @@ - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. -- exit -+ return - } - ++++ src/libc/sysdeps/x86_64/preconfigure 2013-09-11 12:00:46.855313328 -0400 +@@ -1,123 +1,3 @@ +- +-# as_fn_set_status STATUS +-# ----------------------- +-# Set $? to STATUS, without forking. +-as_fn_set_status () +-{ +- return $1 +-} # as_fn_set_status +- +-# as_fn_exit STATUS +-# ----------------- +-# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +-as_fn_exit () +-{ +- set +e +- as_fn_set_status $1 +- exit $1 +-} # as_fn_exit +-if expr a : '\(a\)' >/dev/null 2>&1 && +- test "X`expr 00001 : '.*\(...\)'`" = X001; then +- as_expr=expr +-else +- as_expr=false +-fi +- +-if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then +- as_basename=basename +-else +- as_basename=false +-fi +- +-as_me=`$as_basename -- "$0" || +-$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ +- X"$0" : 'X\(//\)$' \| \ +- X"$0" : 'X\(/\)' \| . 2>/dev/null || +-$as_echo X/"$0" | +- sed '/^.*\/\([^/][^/]*\)\/*$/{ +- s//\1/ +- q +- } +- /^X\/\(\/\/\)$/{ +- s//\1/ +- q +- } +- /^X\/\(\/\).*/{ +- s//\1/ +- q +- } +- s/.*/./; q'` +- +- +- as_lineno_1=$LINENO as_lineno_1a=$LINENO +- as_lineno_2=$LINENO as_lineno_2a=$LINENO +- eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && +- test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { +- # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) +- sed -n ' +- p +- /[$]LINENO/= +- ' <$as_myself | +- sed ' +- s/[$]LINENO.*/&-/ +- t lineno +- b +- :lineno +- N +- :loop +- s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ +- t loop +- s/-\n.*// +- ' >$as_me.lineno && +- chmod +x "$as_me.lineno" || +- { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } +- +- # Don't try to exec as it changes $[0], causing all sort of problems +- # (the dirname of $[0] is not the place where we might find the +- # original and so on. Autoconf is especially sensitive to this). +- . "./$as_me.lineno" +- # Exit status is that of the last command. +- return +-} +- +- +-# ac_fn_c_try_compile LINENO +-# -------------------------- +-# Try to compile conftest.$ac_ext, and return whether this succeeded. +-ac_fn_c_try_compile () +-{ +- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack +- rm -f conftest.$ac_objext +- if { { ac_try="$ac_compile" +-case "(($ac_try" in +- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; +- *) ac_try_echo=$ac_try;; +-esac +-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +-$as_echo "$ac_try_echo"; } >&5 +- (eval "$ac_compile") 2>conftest.err +- ac_status=$? +- if test -s conftest.err; then +- grep -v '^ *+' conftest.err >conftest.er1 +- cat conftest.er1 >&5 +- mv -f conftest.er1 conftest.err +- fi +- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 +- test $ac_status = 0; } && { +- test -z "$ac_c_werror_flag" || +- test ! -s conftest.err +- } && test -s conftest.$ac_objext; then : +- ac_retval=0 +-else +- $as_echo "$as_me: failed program was:" >&5 +-sed 's/^/| /' conftest.$ac_ext >&5 +- +- ac_retval=1 +-fi +- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno +- as_fn_set_status $ac_retval +- +-} # ac_fn_c_try_compile + # This file is generated from configure.in by Autoconf. DO NOT EDIT! + # Local preconfigure fragment for sysdeps/x86_64 |