blob: 58032155cd672c899e57939672db44e623744cfc [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001dnl configure fragment for new libpthread implementation.
2GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
3
4if test "x$libc_cv_gcc___thread" != xyes; then
5 AC_MSG_ERROR(compiler support for __thread is required)
6fi
7
8if 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)
11fi
12
13dnl Iff <unwind.h> is available, make sure it is the right one and it
14dnl contains struct _Unwind_Exception.
15AC_CACHE_CHECK(dnl
16for forced unwind support, libc_cv_forced_unwind, [dnl
17old_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.
21CPPFLAGS="$CPPFLAGS -Dinhibit_libc=1"
22AC_TRY_COMPILE([#include <unwind.h>], [
23struct _Unwind_Exception exc;
24struct _Unwind_Context *context;
25_Unwind_GetCFA (context)],
26libc_cv_forced_unwind=yes, libc_cv_forced_unwind=no)
27CPPFLAGS="$old_CPPFLAGS"])
28if test $libc_cv_forced_unwind = yes; then
29 AC_DEFINE(HAVE_FORCED_UNWIND)
30dnl 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([
35extern void some_function (void);
36void cl (void *a) { }], [
37 int a __attribute__ ((cleanup (cl)));
38 some_function ()],
39libc_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
44else
45 AC_MSG_ERROR(forced unwind support is required)
46fi