better test for test_link if check if binary actually linked successfully.
[charm.git] / src / scripts / configure.in
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