Unbound linking bug with pthreads

Hi,

Fedora 13 will no longer implicitely link in certain libraries. For
a full description see:

This is happening with unbound and the pthreads library. So we need to
pass it a -lpthreads when we are compiling with --with-pthreads.

I'm not a "configure" expert, so while I do see some tests in configure,
I don't understand where it remembers the additional -lpthread argument
which needs to be added to the Makefile's LIBS=

Currently, on my Linux machine which ran with --with-phtreads, I see in
Makefile:

   LIBS=$(strip -lldns -levent -lrt -lcrypto)

This is missing -lpthread

Paul

Hi Paul,

Unbound uses http://www.nongnu.org/autoconf-archive/acx_pthread.html
in acx_pthread.m4. It uses configure-style compilation tests to see
what works, and tries -pthread (CFLAGS) and later -lpthread (LIBS). It
does not try both at once.

For me, I end up with -pthread in the CFLAGS. This is included on the
commandline when linking. Perhaps -pthread is enough when linking, or
does it have to be -lpthread ? If so, the configure test to link with
- -pthread should be failing and perhaps a test added to the macro and
submitted upstream.

If the new system has pthread-config you can set both cflags and libs
with that, no patch required.

Best regards,
   Wouter

* W. C. A. Wijngaards:

For me, I end up with -pthread in the CFLAGS. This is included on the
commandline when linking. Perhaps -pthread is enough when linking, or
does it have to be -lpthread ?

-pthread should cause -lpthread to be passed during linking:

*lib:
%{pthread:-lpthread} %{shared:-lc} %{!shared:%{mieee-fp:-lieee} %{profile:-lc_p}%{!profile:-lc}}

What should "cause" this? Because it is not happening.

Paul

checking whether pthreads work with -pthread... yes

It then ends up in PTHREAD_CFLAGS and is included in CFLAGS (used for
compiling and linking).

Best regards,
   Wouter

But that's not the case, because linking happens without -lpthread. That's
the original problem we started with.

Paul

* Paul Wouters:

Yes it is included while linking. This happens on my machine, for
example. However in the test linking for Fedora13 apparently it detects
- -pthread, but this is not included in the CFLAGS somehow. This is a
bug, and I do not understand how it can happen. config.log may help or
otherwise echo $CFLAGS inside the configure script to see how it changes
maybe.

Best regards,
   Wouter