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