lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 1 | dnl configure fragment for new libpthread implementation. |
| 2 | GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory. |
| 3 | |
| 4 | if test "x$libc_cv_gcc___thread" != xyes; then |
| 5 | AC_MSG_ERROR(compiler support for __thread is required) |
| 6 | fi |
| 7 | |
| 8 | if test "x${libc_cv_visibility_attribute}" != xyes || |
| 9 | test "x${libc_cv_broken_visibility_attribute}" != xno; then |
| 10 | AC_MSG_ERROR(working compiler support for visibility attribute is required) |
| 11 | fi |
| 12 | |
| 13 | dnl Iff <unwind.h> is available, make sure it is the right one and it |
| 14 | dnl contains struct _Unwind_Exception. |
| 15 | AC_CACHE_CHECK(dnl |
| 16 | for forced unwind support, libc_cv_forced_unwind, [dnl |
| 17 | old_CPPFLAGS="$CPPFLAGS" |
| 18 | # Without inhibit_libc #define'd, GCC's unwind.h (at least for ia64) |
| 19 | # will try to include <stdlib.h>, which doesn't exist yet if we're |
| 20 | # building libc in a bare environment. |
| 21 | CPPFLAGS="$CPPFLAGS -Dinhibit_libc=1" |
| 22 | AC_TRY_COMPILE([#include <unwind.h>], [ |
| 23 | struct _Unwind_Exception exc; |
| 24 | struct _Unwind_Context *context; |
| 25 | _Unwind_GetCFA (context)], |
| 26 | libc_cv_forced_unwind=yes, libc_cv_forced_unwind=no) |
| 27 | CPPFLAGS="$old_CPPFLAGS"]) |
| 28 | if test $libc_cv_forced_unwind = yes; then |
| 29 | AC_DEFINE(HAVE_FORCED_UNWIND) |
| 30 | dnl Check for C cleanup handling. |
| 31 | old_CFLAGS="$CFLAGS" |
| 32 | CFLAGS="$CFLAGS -Werror -fexceptions" |
| 33 | AC_CACHE_CHECK([for C cleanup handling], libc_cv_c_cleanup, [dnl |
| 34 | AC_TRY_COMPILE([ |
| 35 | extern void some_function (void); |
| 36 | void cl (void *a) { }], [ |
| 37 | int a __attribute__ ((cleanup (cl))); |
| 38 | some_function ()], |
| 39 | libc_cv_c_cleanup=yes, libc_cv_c_cleanup=no)]) |
| 40 | CFLAGS="$old_CFLAGS" |
| 41 | if test $libc_cv_c_cleanup = no; then |
| 42 | AC_MSG_ERROR([the compiler must support C cleanup handling]) |
| 43 | fi |
| 44 | else |
| 45 | AC_MSG_ERROR(forced unwind support is required) |
| 46 | fi |