PR 55061 is about a case in which the compiler used to build stage 1
(Xcode 3.1.4 on PPC Darwin) is a version of GCC that does not correctly
support the -funwind-tables option. The libbacktrace configure script
was assuming that all versions of GCC support -funwind-tables. This
patch changes it to actually test whether it works, using a test case
that fails with Xcode 3.1.4. Bootstrapped and ran libbacktrace tests on
x86_64-unknown-linux-gnu. Committed to mainline.
Ian
2012-10-24 Ian Lance Taylor <[email protected]>
PR target/55061
* configure.ac: Check whether -funwind-tables option works.
* configure: Rebuild.
Index: configure.ac
===================================================================
--- configure.ac (revision 192781)
+++ configure.ac (working copy)
@@ -97,8 +97,21 @@ fi
AC_SUBST(BACKTRACE_FILE)
EXTRA_FLAGS=
-if test "x$GCC" = "xyes"; then
+if test -n "${with_target_subdir}"; then
EXTRA_FLAGS=-funwind-tables
+else
+ AC_CACHE_CHECK([for -funwind-tables option],
+ [libbacktrace_cv_c_unwind_tables],
+ [CFLAGS_hold="$CFLAGS"
+ CFLAGS="$CFLAGS -funwind-tables"
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([static int f() { return 0; }], [return f();])],
+ [libbacktrace_cv_c_unwind_tables=yes],
+ [libbacktrace_cv_c_unwind_tables=no])
+ CFLAGS="$CFLAGS_hold"])
+ if test "$libbacktrace_cv_c_unwind_tables" = "yes"; then
+ EXTRA_FLAGS=-funwind-tables
+ fi
fi
AC_SUBST(EXTRA_FLAGS)