Skip to content

Commit bac2c5b

Browse files
Rainer M. Canavangitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 282616c commit bac2c5b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

configure.ac

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1013,7 +1013,12 @@ elif test -z "$PTHREAD_CFLAGS"; then
10131013
# would then trigger compiler warnings on every single file we compile.
10141014
for opt in "" -mt -pthread -lpthread; do
10151015
old_CFLAGS="$CFLAGS"
1016-
CFLAGS="$opt $CFLAGS"
1016+
old_LIBS="$LIBS"
1017+
case "$opt" in
1018+
-l*) LIBS="$opt $LIBS" ;;
1019+
*) CFLAGS="$opt $CFLAGS" ;;
1020+
esac
1021+
10171022
AC_MSG_CHECKING([for POSIX Threads with '$opt'])
10181023
AC_LINK_IFELSE([PTHREADTEST_SRC],
10191024
[AC_MSG_RESULT([yes])
@@ -1025,6 +1030,7 @@ elif test -z "$PTHREAD_CFLAGS"; then
10251030
],
10261031
[AC_MSG_RESULT([no])])
10271032
CFLAGS="$old_CFLAGS"
1033+
LIBS="$old_LIBS"
10281034
done
10291035
if test $threads_found != yes; then
10301036
AC_CHECK_LIB([pthread], [pthread_create],

0 commit comments

Comments
 (0)