summary refs log tree commit diff
path: root/configure.ac
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2015-11-24 19:06:33 -0500
committerJeff King <peff@peff.net>2015-11-24 19:06:33 -0500
commita3824e7145d2f462e6b4f716baeece89868e1e38 (patch)
treed490b50cb52b62f4e121c9df045913c65c7b34e9 /configure.ac
parent718a9e67b69d80bee82952dcba5e39198d7d097d (diff)
parentbac2c5bf1a74fbdb901c6c939e6ec1bb085749f8 (diff)
Merge branch 'rc/configure-use-libs-when-checking-a-lib'
The "configure" script did not test for -lpthread correctly, which
upset some linkers.

* rc/configure-use-libs-when-checking-a-lib:
  configure.ac: use $LIBS not $CFLAGS when testing -lpthread
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 76170ad06d..89e2590bd6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1142,7 +1142,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])
@@ -1154,6 +1159,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],