Check if libpthread is required or not.
authorTobias Brunner <tobias@strongswan.org>
Thu, 10 Dec 2009 10:08:01 +0000 (11:08 +0100)
committerTobias Brunner <tobias@strongswan.org>
Wed, 23 Dec 2009 16:02:26 +0000 (17:02 +0100)
configure.in
src/charon/Makefile.am
src/libfast/Makefile.am
src/libstrongswan/Makefile.am
src/pluto/Makefile.am

index e02fedb..a80a81b 100644 (file)
@@ -267,6 +267,11 @@ AC_SEARCH_LIBS(clock_gettime, rt, [RTLIB=$LIBS])
 AC_CHECK_FUNCS(clock_gettime)
 AC_SUBST(RTLIB)
 
+dnl Android has pthread_* functions in bionic (libc), others need libpthread
+LIBS=""
+AC_SEARCH_LIBS(pthread_create, pthread, [PTHREADLIB=$LIBS])
+AC_SUBST(PTHREADLIB)
+
 LIBS=$saved_LIBS
 dnl ======================
 
@@ -282,7 +287,7 @@ AC_TRY_COMPILE(
 
 dnl check if pthread_condattr_setclock(CLOCK_MONOTONE) is supported
 saved_LIBS=$LIBS
-LIBS="-lpthread"
+LIBS=$PTHREADLIB
 AC_MSG_CHECKING([for pthread_condattr_setclock(CLOCK_MONOTONE)])
 AC_TRY_RUN(
        [#include <pthread.h>
index 1d6fa6d..2a82b4b 100644 (file)
@@ -102,7 +102,7 @@ INCLUDES = -I${linux_headers} -I$(top_srcdir)/src/libstrongswan -I$(top_srcdir)/
 AM_CFLAGS = -rdynamic \
   -DIPSEC_DIR=\"${ipsecdir}\" \
   -DIPSEC_PIDDIR=\"${piddir}\"
-charon_LDADD = $(top_builddir)/src/libstrongswan/libstrongswan.la -lpthread -lm $(DLLIB) $(SOCKLIB)
+charon_LDADD = $(top_builddir)/src/libstrongswan/libstrongswan.la -lm $(PTHREADLIB) $(DLLIB) $(SOCKLIB)
 
 # compile options
 #################
index 6104f33..870dcd6 100644 (file)
@@ -3,6 +3,6 @@ lib_LTLIBRARIES = libfast.la
 libfast_la_SOURCES = context.h dispatcher.c request.h session.h \
   controller.h dispatcher.h request.c session.c filter.h
 libfast_la_LIBADD = $(top_builddir)/src/libstrongswan/libstrongswan.la \
-  -lfcgi -lpthread -lneo_cgi -lneo_cs -lneo_utl -lz
+  -lfcgi -lneo_cgi -lneo_cs -lneo_utl -lz $(PTHREADLIB)
 INCLUDES = -I$(top_srcdir)/src/libstrongswan -I/usr/include/ClearSilver
 AM_CFLAGS = -rdynamic
index 3015050..fd297a0 100644 (file)
@@ -58,7 +58,7 @@ utils/optionsfrom.c utils/optionsfrom.h \
 utils/backtrace.c utils/backtrace.h \
 plugins/plugin_loader.c plugins/plugin_loader.h plugins/plugin.h
 
-libstrongswan_la_LIBADD = -lpthread $(DLLIB) $(BTLIB) $(SOCKLIB) $(RTLIB)
+libstrongswan_la_LIBADD = $(PTHREADLIB) $(DLLIB) $(BTLIB) $(SOCKLIB) $(RTLIB)
 
 INCLUDES = -I$(top_srcdir)/src/libstrongswan
 AM_CFLAGS = \
index 14a13a5..b83e4be 100644 (file)
@@ -75,7 +75,7 @@ AM_CFLAGS = \
 pluto_LDADD = \
 $(LIBSTRONGSWANDIR)/libstrongswan.la \
 $(LIBFREESWANDIR)/libfreeswan.a \
--lresolv -lpthread $(DLLIB)
+-lresolv $(PTHREADLIB) $(DLLIB)
 
 _pluto_adns_LDADD = \
 $(LIBFREESWANDIR)/libfreeswan.a \