You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by jo...@apache.org on 2003/10/29 22:11:46 UTC
cvs commit: apr/build apr_threads.m4
jorton 2003/10/29 13:11:46
Modified: build apr_threads.m4
Log:
* build/apr_threads.m4: If -pthread is used to enable
pthread support, also add -lpthread to LIBS to ensure
that libapr depends on libpthread regardless of libtool
and gcc versions.
Revision Changes Path
1.9 +9 -0 apr/build/apr_threads.m4
Index: apr_threads.m4
===================================================================
RCS file: /home/cvs/apr/build/apr_threads.m4,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -u -r1.8 -r1.9
--- apr_threads.m4 1 Apr 2003 00:15:04 -0000 1.8
+++ apr_threads.m4 29 Oct 2003 21:11:46 -0000 1.9
@@ -130,6 +130,15 @@
fi
])
+# Some versions of libtool do not pass -pthread through
+# to the compiler when given in a --mode=link line. Some
+# versions of gcc ignore -pthread when linking a shared
+# object. Hence, if using -pthread, always add -lpthread on
+# the link line, to ensure that libapr depends on libpthread.
+if test "x$ac_cv_pthreads_cflags" = "x-pthread"; then
+ APR_ADDTO(LIBS,[-lpthread])
+fi
+
AC_CACHE_CHECK(for pthreads_lib, ac_cv_pthreads_lib,[
ac_cv_pthreads_lib=""
if test "$pthreads_working" != "yes"; then
Re: cvs commit: apr/build apr_threads.m4
Posted by Jeff Trawick <tr...@attglobal.net>.
Joe Orton wrote:
> On Thu, Oct 30, 2003 at 06:49:20AM -0500, Jeff Trawick wrote:
>
>>jorton@apache.org wrote:
>>
>>>jorton 2003/10/29 13:11:46
>>>
>>> Modified: build apr_threads.m4
> That change broke the OpenBSD build which uses -pthread with -lc_r not
> -lpthread. The change I just committed fixes cases like that too, but
> it could do with some testing with the vendor cc on Solaris/AIX/... it
> seems to now do the right thing with gcc on the platforms I've tested.
>
> Is it OK on Solaris to link against libpthread *and* libthread? I can't
> remember.
yes, it is OK/normal... it is a showstopper to get libthread without libpthread
though
if there is something messed up on AIX, I'll find out pretty soon; with the
vendor compiler I've only used it via the "_r" flavor of the front-end (e.g.,
"CC=cc_r" or "CC=xlc_r") if I want a thread-capable build... no telling what
happens if plain CC=cc is used...
Re: cvs commit: apr/build apr_threads.m4
Posted by Joe Orton <jo...@manyfish.co.uk>.
On Thu, Oct 30, 2003 at 06:49:20AM -0500, Jeff Trawick wrote:
> jorton@apache.org wrote:
> >jorton 2003/10/29 13:11:46
> >
> > Modified: build apr_threads.m4
> > Log:
> > * build/apr_threads.m4: If -pthread is used to enable
> > pthread support, also add -lpthread to LIBS to ensure
> > that libapr depends on libpthread regardless of libtool
> > and gcc versions.
>
> $ apxs -c -p -o pgm pgm.c
>
> Ahh, relief from all those unresolved libpthread symbols.
>
> Cool!
That change broke the OpenBSD build which uses -pthread with -lc_r not
-lpthread. The change I just committed fixes cases like that too, but
it could do with some testing with the vendor cc on Solaris/AIX/... it
seems to now do the right thing with gcc on the platforms I've tested.
Is it OK on Solaris to link against libpthread *and* libthread? I can't
remember.
bash-2.02$ gcc -shared -pthreads -fpic foo.c -lpthread
bash-2.02$ ldd a.out
libpthread.so.1 => /usr/lib/libpthread.so.1
libthread.so.1 => /usr/lib/libthread.so.1
libdl.so.1 => /usr/lib/libdl.so.1
libc.so.1 => /usr/lib/libc.so.1
Re: cvs commit: apr/build apr_threads.m4
Posted by Jeff Trawick <tr...@attglobal.net>.
jorton@apache.org wrote:
> jorton 2003/10/29 13:11:46
>
> Modified: build apr_threads.m4
> Log:
> * build/apr_threads.m4: If -pthread is used to enable
> pthread support, also add -lpthread to LIBS to ensure
> that libapr depends on libpthread regardless of libtool
> and gcc versions.
$ apxs -c -p -o pgm pgm.c
Ahh, relief from all those unresolved libpthread symbols.
Cool!