]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Add and use a configure test to determine if this is an NPTL based
authorJulian Seward <jseward@acm.org>
Mon, 7 Apr 2003 19:36:41 +0000 (19:36 +0000)
committerJulian Seward <jseward@acm.org>
Mon, 7 Apr 2003 19:36:41 +0000 (19:36 +0000)
system.  Hopefully this will allow it to build out of the box and
(sort-of) work on RH9.

MERGE TO STABLE (if it works)

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1511

configure.in
coregrind/valgrind.in

index 435b00dded9778de974796977be58bfa35ed5bf4..1a4b81baa44e4e38ecadb496a4c1fa93af86b3a6 100644 (file)
@@ -278,6 +278,51 @@ EOF
    rm -f conftest conftest.c
 fi
 
+
+
+
+
+AC_MSG_CHECKING([if this is an NPTL-based system])
+
+cat<<EOG > nptltest.c
+#include <pthread.h>
+#include <stdio.h>
+int main (int argc, char * argv [])
+{
+   int ret;
+   pthread_mutexattr_t mutexattr;
+   ret = pthread_mutexattr_init (&mutexattr);
+   if (ret == 0) {
+      ret = pthread_mutexattr_setpshared(&mutexattr, PTHREAD_PROCESS_SHARED);
+     if (ret == 0) /* nptl */
+         printf("yes");
+     else          /* not nptl */
+         printf("no");
+         return 0;
+   }
+   return 1;
+}
+EOG
+
+${CC} -o nptltest nptltest.c -lpthread >&5 2>&1
+have_nptl=`./nptltest`
+
+if test "$?" != 0 ; then
+  AC_MSG_RESULT([couldn't run test program])
+  NPTL_THREADING="no"
+else
+  if test "${have_nptl}" == 'yes' ; then
+     NPTL_THREADING="yes"
+     AC_MSG_RESULT([yes])
+  else
+     NPTL_THREADING="no"
+     AC_MSG_RESULT([no])
+  fi
+fi
+
+AC_SUBST(NPTL_THREADING)
+
+
 # does this compiler support -mpreferred-stack-boundary=2 ?
 AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary])
 
index cc25f2b707cb77632987963434e9c69cde2e1ecc..ca1bdfde0a7e31c26230f950ccc08e5773cb0ea8 100755 (executable)
@@ -31,6 +31,7 @@
 prefix="@prefix@"
 exec_prefix="@exec_prefix@"
 VALGRIND="@libdir@/valgrind"
+nptl_threading="@NPTL_THREADING@"
 
 # Other stuff ...
 version="@VERSION@"
@@ -88,10 +89,10 @@ export VG_ARGS
 # tell the dynamic loader to disable this interface using
 # an environment variable.
 
-###this needs to be conditionalised so it only happens on
-###NPTL-based platforms.  Commented out 2002-Apr-06.  JRS
-###LD_ASSUME_KERNEL=2.2.5
-###export LD_ASSUME_KERNEL 
+if [ z"$nptl_threading" = zyes ]; then
+   LD_ASSUME_KERNEL=2.2.5
+   export LD_ASSUME_KERNEL 
+fi
 
 # A bit subtle.  The LD_PRELOAD added entry must be absolute
 # and not depend on LD_LIBRARY_PATH.  This is so that we can