Merge pull request #153 from gnustep/unwind_check

explicitely allow disabling unwind, test for header and function too
This commit is contained in:
rfm 2020-07-29 10:31:00 +01:00 committed by GitHub
commit 17a138f74d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 69 additions and 4 deletions

View file

@ -802,6 +802,9 @@
*/
#undef HAVE__DISPATCH_MAIN_QUEUE_CALLBACK_4CF
/* Define to 1 if you have the `_Unwind_GetIP' function. */
#undef HAVE__UNWIND_GETIP
/* Define to 1 if you have the `__builtin_extract_return_address' function. */
#undef HAVE___BUILTIN_EXTRACT_RETURN_ADDRESS
@ -911,6 +914,9 @@
/* Define if vsprintf returns the length printed */
#undef VSPRINTF_RETURNS_LENGTH
/* Have and use Unwind library */
#undef WITH_UNWIND
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */
#if defined AC_APPLE_UNIVERSAL_BUILD

View file

@ -565,7 +565,7 @@ GSListModules()
#endif /* USE_BFD */
#if defined(HAVE_UNWIND_H) && !defined(HAVE_BACKTRACE)
#if defined(WITH_UNWIND) && !defined(HAVE_BACKTRACE)
#include <unwind.h>
#if !defined(_WIN32)
@ -593,7 +593,7 @@ GSUnwindCallback(struct _Unwind_Context* context, void* arg)
return 0; //_URC_OK/_URC_NO_REASON
}
#endif /* HAVE_UNWIND_H && !HAVE_BACKTRACE */
#endif /* WITH_UNWIND && !HAVE_BACKTRACE */
#if defined(_WIN32) && !defined(USE_BFD)

44
configure vendored
View file

@ -794,6 +794,7 @@ with_installation_domain
enable_largefile
enable_nxconstantstring
enable_bfd
with_unwind
enable_procfs
enable_procfs_psinfo
enable_pass_arguments
@ -1561,6 +1562,7 @@ Optional Packages:
If this is not specified, the output of
gnustep-config --installation-domain-for=gnustep-base
(which should normally be LOCAL) is used.
--without-unwind Ignore unwind if found and disable it
--with-include-flags=FLAGS Specify all include flags at once
--with-library-flags=FLAGS Specify all library flags at once
--with-ffi-include=PATH Include path for ffi headers
@ -9064,7 +9066,16 @@ fi
done
for ac_header in unwind.h
# Enable unwind if found by default
# Check whether --with-unwind was given.
if test "${with_unwind+set}" = set; then :
withval=$with_unwind;
fi
if test "x$with_unwind" != "xno"; then :
for ac_header in unwind.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "unwind.h" "ac_cv_header_unwind_h" "$ac_includes_default"
if test "x$ac_cv_header_unwind_h" = xyes; then :
@ -9075,7 +9086,38 @@ _ACEOF
fi
done
for ac_func in _Unwind_GetIP
do :
ac_fn_c_check_func "$LINENO" "_Unwind_GetIP" "ac_cv_func__Unwind_GetIP"
if test "x$ac_cv_func__Unwind_GetIP" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE__UNWIND_GETIP 1
_ACEOF
fi
done
else
have_unwind=no
fi
if test "x$ac_cv_func__Unwind_GetIP" = "xyes"; then :
have_unwind=yes
else
have_unwind=no
fi
if test "x$have_unwind" = "xyes"; then :
$as_echo "#define WITH_UNWIND 1" >>confdefs.h
else
if test "x$with_unwind" = "xyes"; then :
as_fn_error $? "unwind requested but not found" "$LINENO" 5
fi
fi
#--------------------------------------------------------------------
# These headers/functions needed by NSLog.m

View file

@ -2309,7 +2309,24 @@ fi
AC_CHECK_FUNCS(__builtin_extract_return_address)
AC_CHECK_HEADERS(unwind.h)
# Enable unwind if found by default
AC_ARG_WITH(unwind,
AS_HELP_STRING([--without-unwind], [Ignore unwind if found and disable it]))
AS_IF([test "x$with_unwind" != "xno"],
[AC_CHECK_HEADERS(unwind.h)] [AC_CHECK_FUNCS(_Unwind_GetIP)],
[have_unwind=no])
AS_IF([test "x$ac_cv_func__Unwind_GetIP" = "xyes"],
[have_unwind=yes],
[have_unwind=no])
AS_IF([test "x$have_unwind" = "xyes"],
[AC_DEFINE([WITH_UNWIND], [1], [Have and use Unwind library])],
[AS_IF([test "x$with_unwind" = "xyes"],
[AC_MSG_ERROR([unwind requested but not found])
])
])
#--------------------------------------------------------------------
# These headers/functions needed by NSLog.m