aboutsummaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-01-03 10:28:33 -0800
committerJunio C Hamano <gitster@pobox.com>2013-01-03 10:28:33 -0800
commit5f0793732957b0f41212c6db296f5c9753da29e0 (patch)
tree54f2c96ffa0b125b989c6f839ca66221fbacc7d1 /configure.ac
parent8cabd200d2499954e47d8ec79ac7f4f45d9deb2e (diff)
parente0a52279304a67d6e13c5a5b4165dd09f6ba61aa (diff)
downloadgit-5f0793732957b0f41212c6db296f5c9753da29e0.tar.gz
git-5f0793732957b0f41212c6db296f5c9753da29e0.tar.xz
Merge branch 'mh/pthreads-autoconf'
* mh/pthreads-autoconf: configure.ac: fix pthreads detection on Mac OS X
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac12
1 files changed, 11 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index dc6925f11..1991258ae 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1035,7 +1035,17 @@ if test -n "$USER_NOPTHREAD"; then
# -D_REENTRANT' or some such.
elif test -z "$PTHREAD_CFLAGS"; then
threads_found=no
- for opt in -mt -pthread -lpthread; do
+ # Attempt to compile and link some code using pthreads to determine
+ # required linker flags. The order is somewhat important here: We
+ # first try it without any extra flags, to catch systems where
+ # pthreads are part of the C library, then go on testing various other
+ # flags. We do so to avoid false positives. For example, on Mac OS X
+ # pthreads are part of the C library; moreover, the compiler allows us
+ # to add "-mt" to the CFLAGS (although it will do nothing except
+ # trigger a warning about an unused flag). Hence if we checked for
+ # "-mt" before "" we would end up picking it. But unfortunately this
+ # would then trigger compiler warnings on every single file we compile.
+ for opt in "" -mt -pthread -lpthread; do
old_CFLAGS="$CFLAGS"
CFLAGS="$opt $CFLAGS"
AC_MSG_CHECKING([for POSIX Threads with '$opt'])