summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorRainer M. Canavan <git@canavan.de>2015-11-06 01:11:37 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-11-06 17:41:08 (GMT)
commitbac2c5bf1a74fbdb901c6c939e6ec1bb085749f8 (patch)
tree9d56ce2a197554de0b883aa903f9001539613c52 /configure.ac
parent282616c72d1d08a77ca4fe1186cb708c38408d87 (diff)
downloadgit-bac2c5bf1a74fbdb901c6c939e6ec1bb085749f8.zip
git-bac2c5bf1a74fbdb901c6c939e6ec1bb085749f8.tar.gz
git-bac2c5bf1a74fbdb901c6c939e6ec1bb085749f8.tar.bz2
configure.ac: use $LIBS not $CFLAGS when testing -lpthread
Some linkers, namely the one on IRIX are rather strict concerning the order or arguments for symbol resolution, i.e. no libraries listed before objects or other libraries on the command line are considered for symbol resolution. Therefore, -lpthread can't work if it's put in CFLAGS, because it will not be considered for resolving pthread_key_create in conftest.o. Use $LIBS instead. Signed-off-by: Rainer Canavan <git@canavan.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac8
1 files changed, 7 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index b711254..7b3ade9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1013,7 +1013,12 @@ elif test -z "$PTHREAD_CFLAGS"; then
# would then trigger compiler warnings on every single file we compile.
for opt in "" -mt -pthread -lpthread; do
old_CFLAGS="$CFLAGS"
- CFLAGS="$opt $CFLAGS"
+ old_LIBS="$LIBS"
+ case "$opt" in
+ -l*) LIBS="$opt $LIBS" ;;
+ *) CFLAGS="$opt $CFLAGS" ;;
+ esac
+
AC_MSG_CHECKING([for POSIX Threads with '$opt'])
AC_LINK_IFELSE([PTHREADTEST_SRC],
[AC_MSG_RESULT([yes])
@@ -1025,6 +1030,7 @@ elif test -z "$PTHREAD_CFLAGS"; then
],
[AC_MSG_RESULT([no])])
CFLAGS="$old_CFLAGS"
+ LIBS="$old_LIBS"
done
if test $threads_found != yes; then
AC_CHECK_LIB([pthread], [pthread_create],