Evas: use -pthread instead of -lpthread
authorcaro <caro@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 10 Nov 2011 18:02:43 +0000 (18:02 +0000)
committercaro <caro@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 10 Nov 2011 18:02:43 +0000 (18:02 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@65029 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

configure.ac

index ce4402d..3acb7b6 100644 (file)
@@ -1018,20 +1018,30 @@ AC_CHECK_HEADER(pthread.h,
 )
 
 # sched_getaffinity pthread_attr_setaffinity_np
-AC_CHECK_HEADERS(pthread.h sched.h,
-  [
-    AC_CHECK_LIB(pthread, pthread_attr_setaffinity_np,
-      [
-        AC_CHECK_LIB(pthread, pthread_barrier_wait,
-          [ build_pthreads="yes" ],
-          [ build_pthreads="no" ]
-        )
-      ],
-      [ build_pthreads="no" ]
-    )
+AC_CHECK_HEADERS([pthread.h sched.h],
+   [
+    CFLAGS_save="${CFLAGS}"
+    CFLAGS="${CFLAGS} -pthread"
+    LIBS_save="${LIBS}"
+    LIBS="${LIBS} -pthread"
+    AC_LINK_IFELSE(
+      [AC_LANG_PROGRAM([[
+#include <pthread.h>
+#include <sched.h>
+                       ]],
+                       [[
+pthread_attr_setaffinity_np(NULL, 0, NULL);
+pthread_barrier_wait(NULL);
+                       ]])],
+      [build_pthreads="yes"],
+      [build_pthreads="no"])
+   CFLAGS=${CFLAGS_save}
+   LIBS=${LIBS_save}
   ],
-  [ build_pthreads="no" ]
-)
+  [build_pthreads="no"])
+
+AC_MSG_CHECKING([whether pthread_attr_setaffinity_np() and pthread_barrier_wait() are supported])
+AC_MSG_RESULT([${build_pthreads}])
 
 #######################################
 ## Pthread
@@ -1167,8 +1177,8 @@ fi
 AC_MSG_CHECKING(whether we should link with pthread)
 if test "x$need_pthreads" = "xyes"; then
   AC_MSG_RESULT(yes)
-  pthread_cflags=""
-  pthread_libs="-lpthread"
+  pthread_cflags="-pthread"
+  pthread_libs="-pthread"
 else
   AC_MSG_RESULT(no)
 fi