better test for test_link if check if binary actually linked successfully.
authorGengbin Zheng <gzheng@illinois.edu>
Thu, 6 Dec 2007 23:07:21 +0000 (23:07 +0000)
committerGengbin Zheng <gzheng@illinois.edu>
Thu, 6 Dec 2007 23:07:21 +0000 (23:07 +0000)
src/scripts/configure
src/scripts/configure.in
src/scripts/conv-autoconfig.h.in

index d0da2d09ebae274c71a7bcd6cd850ea9ba6dcc30..eb53b1a76477ce3029fb13a5f8535c71605a4b1c 100755 (executable)
@@ -1737,7 +1737,9 @@ echo $ECHO_N "checking \"$1\"... $ECHO_C" >&6; }
         else
           echo $CMK_LDXX -o testlink test.o $CMK_LIBDIR $OPTS_LD $4 >> $charmout
           $CMK_LDXX -o testlink test.o $CMK_LIBDIR $OPTS_LD $4 > out 2>&1
-          test_result $? "$1" "$2" "$3"
+          ret=$?
+         test ! -d testlink && ret=1
+          test_result $ret "$1" "$2" "$3"
         fi
        strictpass=$pass
        strictfail=$fail
@@ -2289,6 +2291,31 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 
+### test pthread_setaffinity_np ####
+cat > $tc <<EOT
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <pthread.h>
+
+int main()
+{
+  unsigned long mask = 0xffffffff;
+  unsigned int len = sizeof(mask);
+
+  if (pthread_setaffinity_np(pthread_self(), len, &mask) < 0) {
+    return -1;
+  }
+  return 0;
+}
+EOT
+test_linkc "whether pthread_setaffinity_np call exists" "yes" "no" "-lpthread"
+
+cat >>confdefs.h <<_ACEOF
+#define CMK_HAS_PTHREAD_SETAFFINITY $pass
+_ACEOF
+
+
 #### check if dlopen works ####
 skip_dl=0
 # for bproc, ignore -ldl
index a4e6f20b23ab495d2eaf2a1bb1031c03f454258b..ca1f4cb41711e6c7523b201fb0a4867f38f56d26 100644 (file)
@@ -111,7 +111,9 @@ test_link() {
         else
           echo $CMK_LDXX -o testlink test.o $CMK_LIBDIR $OPTS_LD $4 >> $charmout
           $CMK_LDXX -o testlink test.o $CMK_LIBDIR $OPTS_LD $4 > out 2>&1
-          test_result $? "$1" "$2" "$3"
+          ret=$?
+         test ! -d testlink && ret=1
+          test_result $ret "$1" "$2" "$3"
         fi
        strictpass=$pass
        strictfail=$fail
@@ -553,6 +555,27 @@ EOT
 test_linkc "whether sched_setaffinity call exists" "yes" "no" ""
 AC_DEFINE_UNQUOTED(CMK_HAS_SETAFFINITY, $pass, [whether the sched_setaffinity() exists])
 
+### test pthread_setaffinity_np ####
+cat > $tc <<EOT
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <pthread.h>
+
+int main()
+{
+  unsigned long mask = 0xffffffff;
+  unsigned int len = sizeof(mask);
+
+  if (pthread_setaffinity_np(pthread_self(), len, &mask) < 0) {
+    return -1;
+  }
+  return 0;
+}
+EOT
+test_linkc "whether pthread_setaffinity_np call exists" "yes" "no" "-lpthread"
+AC_DEFINE_UNQUOTED(CMK_HAS_PTHREAD_SETAFFINITY, $pass, [whether the pthread_setaffinity_np() exists])
+
 #### check if dlopen works ####
 skip_dl=0
 # for bproc, ignore -ldl
index 29735c16d19f74e74c21615b3750cb3b3e6fb6c6..fda51cc80583efaa47318086892f1f8f621a212b 100644 (file)
@@ -75,6 +75,9 @@
 /* whether mmap() accepts MAP_ANON */
 #undef CMK_HAS_MMAP_ANON
 
+/* whether the pthread_setaffinity_np() exists */
+#undef CMK_HAS_PTHREAD_SETAFFINITY
+
 /* whether Python is installed */
 #undef CMK_HAS_PYTHON