From: Julian Seward Date: Mon, 7 Apr 2003 19:36:41 +0000 (+0000) Subject: Add and use a configure test to determine if this is an NPTL based X-Git-Tag: svn/VALGRIND_2_0_0~243 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3376771d47a8090e9bba25cb02fc607dc45d1c33;p=thirdparty%2Fvalgrind.git Add and use a configure test to determine if this is an NPTL based 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 --- diff --git a/configure.in b/configure.in index 435b00dded..1a4b81baa4 100644 --- a/configure.in +++ b/configure.in @@ -278,6 +278,51 @@ EOF rm -f conftest conftest.c fi + + + + +AC_MSG_CHECKING([if this is an NPTL-based system]) + +cat< nptltest.c +#include +#include +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]) diff --git a/coregrind/valgrind.in b/coregrind/valgrind.in index cc25f2b707..ca1bdfde0a 100755 --- a/coregrind/valgrind.in +++ b/coregrind/valgrind.in @@ -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