Skip to content

Commit

Permalink
Merge branch 'mh/pthreads-autoconf'
Browse files Browse the repository at this point in the history
* mh/pthreads-autoconf:
  configure.ac: fix pthreads detection on Mac OS X
  • Loading branch information
gitster committed Jan 3, 2013
2 parents 8cabd20 + e0a5227 commit 5f07937
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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'])
Expand Down

0 comments on commit 5f07937

Please sign in to comment.