From: "Rainer M. Canavan" <git@canavan.de>
To: git@vger.kernel.org
Cc: Matthieu.Moy@grenoble-inp.fr
Subject: [PATCH] configure.ac: try -lpthread in $LIBS instead of $CFLAGS
Date: Sun, 8 Nov 2015 16:28:42 +0100 (CET) [thread overview]
Message-ID: <201511081528.tA8FSgdc003895@tezro.nonet> (raw)
In-Reply-To: <vpqbnb7edqn.fsf@anie.imag.fr>
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. That
means that -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>
---
configure.ac | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index fd22d41..1f55009 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1149,7 +1149,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])
@@ -1161,6 +1166,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],
--
2.6.2
next prev parent reply other threads:[~2015-11-08 15:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-01 22:30 configure: -lpthread doesn't belong in CFLAGS Rainer M. Canavan
2015-11-02 8:27 ` Matthieu Moy
2015-11-06 1:11 ` [PATCH] In configure.ac, try -lpthread in $LIBS instead of $CFLAGS to make picky linkers happy Rainer M. Canavan
2015-11-06 8:25 ` Matthieu Moy
2015-11-08 15:28 ` Rainer M. Canavan [this message]
2015-11-08 16:00 ` [PATCH] configure.ac: try -lpthread in $LIBS instead of $CFLAGS Matthieu Moy
2015-11-20 11:42 ` Jeff King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201511081528.tA8FSgdc003895@tezro.nonet \
--to=git@canavan.de \
--cc=Matthieu.Moy@grenoble-inp.fr \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).