summary refs log tree commit diff
path: root/nptl/sysdeps/pthread/configure.in
diff options
context:
space:
mode:
Diffstat (limited to 'nptl/sysdeps/pthread/configure.in')
-rw-r--r--nptl/sysdeps/pthread/configure.in15
1 files changed, 15 insertions, 0 deletions
diff --git a/nptl/sysdeps/pthread/configure.in b/nptl/sysdeps/pthread/configure.in
index e4ea6830d6..922741e723 100644
--- a/nptl/sysdeps/pthread/configure.in
+++ b/nptl/sysdeps/pthread/configure.in
@@ -16,4 +16,19 @@ _Unwind_GetCFA (context)],
 libc_cv_forced_unwind=yes, libc_cv_forced_unwind=no)])
 if test $libc_cv_forced_unwind = yes; then
   AC_DEFINE(HAVE_FORCED_UNWIND)
+dnl Check for C cleanup handling.
+  old_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -Werror -fexceptions"
+  AC_CACHE_CHECK([for C cleanup handling], libc_cv_c_cleanup, [dnl
+  AC_TRY_LINK([
+#include <stdio.h>
+void cl (void *a) { }
+extern c (void);], [
+  int a __attribute__ ((cleanup (cl)));
+  puts ("test")],
+libc_cv_c_cleanup=yes, libc_cv_c_cleanup=no)])
+  CFLAGS="$old_CFLAGS"
+  if test $libc_cv_c_cleanup = no; then
+    AC_MSG_ERROR([the compiler must support C cleanup handling])
+  fi
 fi