summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorDavid M. Syzdek <david.syzdek@acsalaska.net>2008-11-03 09:14:28 -0900
committerJunio C Hamano <gitster@pobox.com>2008-11-09 11:26:54 -0800
commit20f7a39825e30891056ab00ea620eaffda6aa451 (patch)
treef34ff579b1f9966edf53ac6a3b6bf505d6c97cf4 /configure.ac
parent158629b2c9baffd0352306bd8dfa0784c981955d (diff)
downloadgit-20f7a39825e30891056ab00ea620eaffda6aa451.tar.gz
Add autoconf tests for pthreads
Set the value of PTHREAD_LIBS to the correct flags for linking pthreads on the current environment. Signed-off-by: David M. Syzdek <david.syzdek@acsalaska.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac16
1 files changed, 16 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index a0d53f3124..3f058a087b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -479,6 +479,22 @@ AC_SUBST(NO_MKDTEMP)
#
# Define NO_SYMLINK_HEAD if you never want .git/HEAD to be a symbolic link.
# Enable it on Windows. By default, symrefs are still used.
+#
+# Define PTHREAD_LIBS to the linker flag used for Pthread support.
+AC_LANG_CONFTEST([AC_LANG_PROGRAM(
+ [[#include <pthread.h>]],
+ [[pthread_mutex_t test_mutex;]]
+)])
+${CC} -pthread conftest.c -o conftest.o > /dev/null 2>&1
+if test $? -eq 0;then
+ PTHREAD_LIBS="-pthread"
+else
+ ${CC} -lpthread conftest.c -o conftest.o > /dev/null 2>&1
+ if test $? -eq 0;then
+ PTHREAD_LIBS="-lpthread"
+ fi
+fi
+AC_SUBST(PTHREAD_LIBS)
## Site configuration (override autodetection)
## --with-PACKAGE[=ARG] and --without-PACKAGE