| Submitter | Jack Howarth |
|---|---|
| Date | Oct. 26, 2012, 3:09 a.m. |
| Message ID | <20121026030909.GA6580@bromo.med.uc.edu> |
| Download | mbox | patch |
| Permalink | /patch/194349/ |
| State | New |
| Headers | show |
Comments
Jack Howarth <howarth@bromo.med.uc.edu> writes: > 2012-10-25 Jack Howarth <howarth@bromo.med.uc.edu> > > target/PR55061 > * configure.ac: Check for _Unwind_GetIPInfo function declaration. > * configure: Regenerate. > > Index: libbacktrace/configure.ac > =================================================================== > --- libbacktrace/configure.ac (revision 192824) > +++ libbacktrace/configure.ac (working copy) > @@ -129,8 +129,15 @@ AC_SUBST(WARN_FLAGS) > if test -n "${with_target_subdir}"; then > GCC_CHECK_UNWIND_GETIPINFO > else > - AC_CHECK_FUNC(_Unwind_GetIPInfo, [have_unwind_getipinfo=yes], > + ac_save_CFLAGS="$CFLAGS" > + CFLAGS="$CFLAGS -Werror-implicit-function-declaration" > + AC_TRY_COMPILE([#include "unwind.h"], [ > + struct _Unwind_Context *context; > + int ip_before_insn = 0; > + return _Unwind_GetIPInfo (context, &ip_before_insn); > + ], [have_unwind_getipinfo=yes], > [have_unwind_getipinfo=no]) > + CFLAGS="$ac_save_CFLAGS" > if test "$have_unwind_getipinfo" = "yes"; then > AC_DEFINE(HAVE_GETIPINFO, 1, [Define if _Unwind_GetIPInfo is available.]) > fi AC_TRY_COMPILE is considered to be obsolete. Can you rewrite in terms of the currently approved AC_COMPILE_IFELSE? When doing that, use AC_LANG_PROGRAM. As the autoconf manual says: -- Macro: AC_TRY_COMPILE (INCLUDES, FUNCTION-BODY, [ACTION-IF-TRUE], [ACTION-IF-FALSE]) Same as: AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[INCLUDES]], [[FUNCTION-BODY]])], [ACTION-IF-TRUE], [ACTION-IF-FALSE]) Ian
Patch
Index: libbacktrace/configure.ac =================================================================== --- libbacktrace/configure.ac (revision 192824) +++ libbacktrace/configure.ac (working copy) @@ -129,8 +129,15 @@ AC_SUBST(WARN_FLAGS) if test -n "${with_target_subdir}"; then GCC_CHECK_UNWIND_GETIPINFO else - AC_CHECK_FUNC(_Unwind_GetIPInfo, [have_unwind_getipinfo=yes], + ac_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror-implicit-function-declaration" + AC_TRY_COMPILE([#include "unwind.h"], [ + struct _Unwind_Context *context; + int ip_before_insn = 0; + return _Unwind_GetIPInfo (context, &ip_before_insn); + ], [have_unwind_getipinfo=yes], [have_unwind_getipinfo=no]) + CFLAGS="$ac_save_CFLAGS" if test "$have_unwind_getipinfo" = "yes"; then AC_DEFINE(HAVE_GETIPINFO, 1, [Define if _Unwind_GetIPInfo is available.]) fi
Currently gcc trunk fails to bootstrap on powerpc-apple-darwin9, using the default system compiler, in libbacktrace due to the absence of _Unwind_GetIPInfo() in the unwind.h header of Apple gcc 4.0.1 compiler. The attached patch eliminates this failure by enhancing the configure.ac test for the _Unwind_GetIPInfo() function to also test for its function declaration using -Werror-implicit-function-declaration. This change allows HAVE_GETIPINFO to remain properly undefined in stage 1 when using the gcc 4.0.1 compiler but not in later stages with the built compiler. It also properly leaves HAVE_GETIPINFO undefined when using the clang compiler from Xcode 4.2 which lacks an unwind.h header but defines it for clang from Xcode 4.5.1 which does. Also tested on x86_64 Fedora 15 without regression in detection of _Unwind_GetIPInfo(). Okay for gcc trunk? Jack libbacktrace/ 2012-10-25 Jack Howarth <howarth@bromo.med.uc.edu> target/PR55061 * configure.ac: Check for _Unwind_GetIPInfo function declaration. * configure: Regenerate.