Le Tue, 12 Nov 2013 21:56:48 +0100,
Sebastian Ramacher <sramac...@debian.org> a écrit :

> Hi
> 
> On 2013-11-11 18:49:01, Laurent Bigonville wrote:
> > > > OK for what I understood, the A(C)X_PTHREAD is setting the
> > > > -pthread flag (not the absence of "l") in PTHREAD_CFLAGS and
> > > > relies on gcc to do the correct thing(tm) when this flag is
> > > > set, this works the cases where the CFLAGS are also passed at
> > > > the linking time (autofoo are doing that).
> > > > 
> > > > If a pkg that link against check FTBFS this need to be checked.
> > > > 
> > > > I feel that this bug should be fixed now and could be closed,
> > > > all rdeps seems to compile now
> > > 
> > > I don't think this bug can be closed. pkg-config check --libs
> > > still doesn't include -pthread which it should. -pthread needs to
> > > in both Cflags and Libs in check's pkgconfig file.
> > 
> > The ax_pthread macro upstream thinks otherwise, see:
> > https://savannah.gnu.org/patch/?8081
> >
> > But I can admit, I've not seen a lot of projects doing it that way.
> > 
> > If I understood correctly, -pthread should automatically make gcc
> > link against libpthread. So as said the CFLAGS should also be
> > passed to gcc at linking time, in that case explicit -lpthread flag
> > seems redundant.
> 
> Of course, passing -pthread to gcc during link time does the right
> thing. I would still expect to get -pthread (not -lpthread) from
> `pkg-config check --libs`. My understanding of --libs is that it's
> supposed to give the required linking flags. In the case of check,
> -pthread is required while linking, but is not included in the output
> of --libs.

Well -pthread is a compiler flag, not the libpthread library, so IMHO
it makes sense to assign it to the CFLAGS and not to the LIBS

Like I said, automake also seems to add the CFLAGS at the linking time
(in addition to the LDFLAGS and LIBS),

The description of the a(c)x_pthread macro is clear about this:

#   NOTE: You are assumed to not only compile your program with these
flags, #   but also link it with them as well. e.g. you should link with
#   $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
#
#   If you are only building threads programs, you may wish to use these
#   variables in your default LIBS, CFLAGS, and CC:
#
#          LIBS="$PTHREAD_LIBS $LIBS"
#          CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
#          CC="$PTHREAD_CC"


--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to