Cleanup: Check for pthread in Libc
authorCharles Briere <charlesbriere.flatzo@gmail.com>
Mon, 2 Dec 2013 02:00:50 +0000 (18:00 -0800)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 2 Dec 2013 05:53:17 +0000 (06:53 +0100)
Some libc like Googles's Bionic for Android include pThread. Instead of
checking for Android as in commit
58a052effb2305655ff1b7233c78ab24fc25257e this patch checks for pthread
in libc as proposed by Thomas Petazzoni.

Reported-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Charles Briere <charlesbriere.flatzo@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Makefile.am
configure.ac
tests/benchmark/Makefile.am
tests/regression/Makefile.am
tests/unit/Makefile.am

index 938027c0c6ec20a36f9ebdad85783cc0c3bd2293..2f81bce9b6a4196505225b5e26606ae25e7e8772 100644 (file)
@@ -5,7 +5,7 @@ INCLUDES = -I$(top_builddir)/urcu
 #Add the -version-info directly here since we are only building
 # library that use the version-info
 AM_LDFLAGS=-version-info $(URCU_LIBRARY_VERSION)
-if !TARGET_IS_ANDROID
+if !LIBC_INCLUDES_PTHREAD
 AM_LDFLAGS+=-lpthread
 endif
 AM_CFLAGS=-Wall
index 38e39e1115a0c71983d4f57c529ae8eec1325583..774094e0ba4b935f5f2b59a3dfb432434b62633a 100644 (file)
@@ -165,6 +165,15 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
        compat_futex_test=1
 ])
 
+# Check for pthread
+AC_CHECK_LIB([pthread], [pthread_create],
+       [AM_CONDITIONAL(LIBC_INCLUDES_PTHREAD, false)],
+       [AC_CHECK_LIB([c], [pthread_create],
+               [AM_CONDITIONAL(LIBC_INCLUDES_PTHREAD, true)],
+               [AC_MSG_ERROR([Cannot find libpthread. Use [LDFLAGS]=-Ldir to specify its location.])]
+       )]
+)
+
 AM_CONDITIONAL([COMPAT_FUTEX], [test "x$compat_futex_test" = "x1"])
 AM_CONDITIONAL([COMPAT_ARCH], [test "x$SUBARCHTYPE" = "xx86compat"])
 AM_CONDITIONAL([NO_SHARED], [test "x$enable_shared" = "xno"])
index bf021898a319bd511a5c2ae0235c43607ffbf007..e889f8875669b539c4d3ecaef9810d1695c61377 100644 (file)
@@ -1,4 +1,4 @@
-if !TARGET_IS_ANDROID
+if !LIBC_INCLUDES_PTHREAD
 AM_LDFLAGS=-lpthread
 endif
 AM_CFLAGS=-I$(top_srcdir) -I$(top_builddir) -I$(top_srcdir)/tests/common -g
index eb1569949d53a5ab29eb1b9491c4264141dba230..80cb1bc3ab04b1b3617e64f8f5583fb3bf912770 100644 (file)
@@ -1,4 +1,4 @@
-if !TARGET_IS_ANDROID
+if !LIBC_INCLUDES_PTHREAD
 AM_LDFLAGS=-lpthread
 endif
 AM_CFLAGS=-I$(top_srcdir) -I$(top_builddir) -I$(top_srcdir)/tests/common -g
index 2c89ca6d11c33a263081f7ed803c59eeb04bcbb5..9efd74ed76a881a6a7ab8423ee52a565ef143565 100644 (file)
@@ -1,4 +1,4 @@
-if !TARGET_IS_ANDROID
+if !LIBC_INCLUDES_PTHREAD
 AM_LDFLAGS=-lpthread
 endif
 AM_CFLAGS=-I$(top_srcdir) -I$(top_builddir) -I$(top_srcdir)/tests/common -g
This page took 0.042227 seconds and 4 git commands to generate.