ruby1.8 (1.8.7.302-2squeeze1) 100730_disable_getsetcontext_on_nptl.patch

Summary

 configure.in |   20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

    
download this patch

Patch contents

Author: Lucas Nussbaum <lucas@lucas-nussbaum.net>
Description: backport upstream commits 28404 and 28595 from ruby_1_8 branch
Upstream-bug: http://redmine.ruby-lang.org/issues/show/2553
Ubuntu-bug: https://bugs.launchpad.net/ubuntu/+source/ruby1.8/+bug/307462

--- a/configure.in
+++ b/configure.in
@@ -522,7 +522,7 @@ AC_CHECK_HEADERS(stdlib.h string.h unist
 		 fcntl.h sys/fcntl.h sys/select.h sys/time.h sys/times.h sys/param.h\
 		 syscall.h pwd.h grp.h a.out.h utime.h memory.h direct.h sys/resource.h \
 		 sys/mkdev.h sys/utime.h netinet/in_systm.h float.h ieeefp.h pthread.h \
-		 ucontext.h intrinsics.h)
+		 intrinsics.h)
 
 dnl Check additional types.
 AC_CHECK_SIZEOF(rlim_t, 0, [
@@ -1097,8 +1097,22 @@ if test x"$enable_pthread" = xyes; then
        fi
     fi
 fi
-if test x"$ac_cv_header_ucontext_h" = xyes; then
-    if test x"$rb_with_pthread" = xyes; then
+
+use_context=no
+if test x"$rb_with_pthread" = xyes; then
+    AS_CASE("$target_cpu:$target_os:$cross_compiling",
+    [*:linux*:no], [
+        if test -n "`(/lib/libc.so.6 2>/dev/null | fgrep 'linuxthreads') 2> /dev/null`"; then
+	    use_context=yes
+	fi
+    ],
+    [sparc*], [
+    	use_context=yes
+    ])
+fi
+if test x"$use_context" = xyes; then
+    AC_CHECK_HEADERS(ucontext.h)
+    if test x"$ac_cv_header_ucontext_h" = xyes; then
 	AC_CHECK_FUNCS(getcontext setcontext)
     fi
 fi