Skip to content

Commit

Permalink
Merge branch 'rc/configure-use-libs-when-checking-a-lib'
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Jeff King committed Nov 25, 2015
2 parents 718a9e6 + bac2c5b commit a3824e7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand All @@ -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],
Expand Down

0 comments on commit a3824e7

Please sign in to comment.