diff mbox

[COMMITTED] Fix unwind.h configure check for bare environment.

Message ID 20140704044959.3B2902C3988@topped-with-meat.com
State Committed
Headers show

Commit Message

Roland McGrath July 4, 2014, 4:49 a.m. UTC
With this, Fedora's ia64-linux-gnu-gcc is sufficient to build libc with
nothing but kernel headers in the sysroot.


Thanks,
Roland

	* sysdeps/nptl/configure.ac (libc_cv_forced_unwind):
	Use -Dinhibit_libc=1 for unwind.h check to prevent false failure
	in a bare environment with no <stdlib.h> installed.
	* sysdeps/nptl/configure: Regenerated.
diff mbox

Patch

--- a/sysdeps/nptl/configure
+++ b/sysdeps/nptl/configure
@@ -15,7 +15,12 @@  $as_echo_n "checking for forced unwind support... " >&6; }
 if ${libc_cv_forced_unwind+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+  old_CPPFLAGS="$CPPFLAGS"
+# Without inhibit_libc #define'd, GCC's unwind.h (at least for ia64)
+# will try to include <stdlib.h>, which doesn't exist yet if we're
+# building libc in a bare environment.
+CPPFLAGS="$CPPFLAGS -Dinhibit_libc=1"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <unwind.h>
 int
@@ -35,6 +40,7 @@  else
   libc_cv_forced_unwind=no
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+CPPFLAGS="$old_CPPFLAGS"
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_forced_unwind" >&5
 $as_echo "$libc_cv_forced_unwind" >&6; }
--- a/sysdeps/nptl/configure.ac
+++ b/sysdeps/nptl/configure.ac
@@ -14,11 +14,17 @@  dnl Iff <unwind.h> is available, make sure it is the right one and it
 dnl contains struct _Unwind_Exception.
 AC_CACHE_CHECK(dnl
 for forced unwind support, libc_cv_forced_unwind, [dnl
+old_CPPFLAGS="$CPPFLAGS"
+# Without inhibit_libc #define'd, GCC's unwind.h (at least for ia64)
+# will try to include <stdlib.h>, which doesn't exist yet if we're
+# building libc in a bare environment.
+CPPFLAGS="$CPPFLAGS -Dinhibit_libc=1"
 AC_TRY_COMPILE([#include <unwind.h>], [
 struct _Unwind_Exception exc;
 struct _Unwind_Context *context;
 _Unwind_GetCFA (context)],
-libc_cv_forced_unwind=yes, libc_cv_forced_unwind=no)])
+libc_cv_forced_unwind=yes, libc_cv_forced_unwind=no)
+CPPFLAGS="$old_CPPFLAGS"])
 if test $libc_cv_forced_unwind = yes; then
   AC_DEFINE(HAVE_FORCED_UNWIND)
 dnl Check for C cleanup handling.