about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-06-29 23:01:49 +0000
committerUlrich Drepper <drepper@redhat.com>2003-06-29 23:01:49 +0000
commite479cc8e4c2297c6d1f190192bd8038b1b7e99d2 (patch)
tree81d6c0a114ebbaa390559c3247bd9c1dce8a0015
parent5245d8a1fe962ee93d81e305e8fa249ee8a6b354 (diff)
downloadglibc-e479cc8e4c2297c6d1f190192bd8038b1b7e99d2.tar.gz
glibc-e479cc8e4c2297c6d1f190192bd8038b1b7e99d2.tar.xz
glibc-e479cc8e4c2297c6d1f190192bd8038b1b7e99d2.zip
Update.
2003-06-29  Ulrich Drepper  <drepper@redhat.com>

	* sysdeps/pthread/configure.in: Check for C cleanup handling in gcc.
-rw-r--r--nptl/ChangeLog4
-rwxr-xr-xnptl/sysdeps/pthread/configure57
-rw-r--r--nptl/sysdeps/pthread/configure.in15
3 files changed, 76 insertions, 0 deletions
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index 072b0094a0..02238477bd 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,7 @@
+2003-06-29  Ulrich Drepper  <drepper@redhat.com>
+
+	* sysdeps/pthread/configure.in: Check for C cleanup handling in gcc.
+
 2003-06-27  Ulrich Drepper  <drepper@redhat.com>
 
 	* tst-cancel4.c (tf_msgrcv): Use IPC_PRIVATE in msgget call.
diff --git a/nptl/sysdeps/pthread/configure b/nptl/sysdeps/pthread/configure
index 50293a4f1c..f0c3da139d 100755
--- a/nptl/sysdeps/pthread/configure
+++ b/nptl/sysdeps/pthread/configure
@@ -59,4 +59,61 @@ if test $libc_cv_forced_unwind = yes; then
 #define HAVE_FORCED_UNWIND 1
 _ACEOF
 
+  old_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -Werror -fexceptions"
+  echo "$as_me:$LINENO: checking for C cleanup handling" >&5
+echo $ECHO_N "checking for C cleanup handling... $ECHO_C" >&6
+if test "${libc_cv_c_cleanup+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+    cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+#include <stdio.h>
+void cl (void *a) { }
+extern c (void);
+int
+main ()
+{
+
+  int a __attribute__ ((cleanup (cl)));
+  puts ("test")
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  libc_cv_c_cleanup=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+libc_cv_c_cleanup=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $libc_cv_c_cleanup" >&5
+echo "${ECHO_T}$libc_cv_c_cleanup" >&6
+  CFLAGS="$old_CFLAGS"
+  if test $libc_cv_c_cleanup = no; then
+    { { echo "$as_me:$LINENO: error: the compiler must support C cleanup handling" >&5
+echo "$as_me: error: the compiler must support C cleanup handling" >&2;}
+   { (exit 1); exit 1; }; }
+  fi
 fi
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