You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Aaron Bannert <aa...@clove.org> on 2002/01/22 20:02:39 UTC

[PATCH] only enable _THREAD_SAFE on AIX when we want/have threads

This patch is verified to work on AIX 4.2.1, but it was suggested
to me by the reporter (Elrond <el...@samba-tng.org>) that we do
the same for other platforms for things like _REENTRANT and I
agree. Does anyone see a reason not to do this?

Currently, without this patch, AIX 4.2.1 breaks with --disable-threads.

The only problem I see with this approach in general is something that
has popped up on this list often -- and that is dealing with standalone
installations of APR in threaded and non-threaded modes. Will we
eventually go to the libapr.so and libapr_r.so modes?

-aaron


Index: configure.in
===================================================================
RCS file: /home/cvs/apr/configure.in,v
retrieving revision 1.398
diff -u -u -r1.398 configure.in
--- configure.in	13 Jan 2002 04:20:10 -0000	1.398
+++ configure.in	22 Jan 2002 18:22:38 -0000
@@ -409,6 +409,12 @@
         AC_DEFINE(GETHOSTBYADDR_IS_THREAD_SAFE)
     fi
     AC_CHECK_FUNCS(gethostbyname_r gethostbyaddr_r)
+
+    case "$host" in
+    *-ibm-aix*)
+        APR_ADDTO(CPPFLAGS, [-D_THREAD_SAFE])
+        ;;
+    esac
 else
     echo "APR will be non-threaded"
 fi
Index: build/apr_hints.m4
===================================================================
RCS file: /home/cvs/apr/build/apr_hints.m4,v
retrieving revision 1.32
diff -u -u -r1.32 apr_hints.m4
--- build/apr_hints.m4	12 Dec 2001 19:35:06 -0000	1.32
+++ build/apr_hints.m4	22 Jan 2002 18:22:39 -0000
@@ -63,7 +63,6 @@
           APR_ADDTO(CFLAGS, [-qHALT=E])
         fi
 	APR_SETIFNULL(apr_iconv_inbuf_const, [1])
-	APR_ADDTO(CPPFLAGS, [-D_THREAD_SAFE])
 	APR_ADDTO(LDFLAGS, [-Wl,-brtl])
         ;;
     *-apollo-*)

Re: [PATCH] only enable _THREAD_SAFE on AIX when we want/have threads

Posted by Aaron Bannert <aa...@clove.org>.
On Tue, Jan 22, 2002 at 03:36:01PM -0800, Justin Erenkrantz wrote:
> On Tue, Jan 22, 2002 at 11:02:39AM -0800, Aaron Bannert wrote:
> > This patch is verified to work on AIX 4.2.1, but it was suggested
> > to me by the reporter (Elrond <el...@samba-tng.org>) that we do
> > the same for other platforms for things like _REENTRANT and I
> > agree. Does anyone see a reason not to do this?
> 
> I think there are some platforms that will do bad things when
> _REENTRANT is defined for some libraries and not for others.
> I think it's best to always define that wherever possible.
> (AIX brain damage excluded.)

That would be a valid concern, but I don't think we need to worry
about system libraries (since they've already been compiled and
_REENTRANT is a preprocessor directive). The worry is with _REENTRANT
apps that link against a non-_REENTRANT APR and vice-versa.

To be fair, this isn't a braindead AIX, this is simply an AIX that does
not have thread support AFAIK. The main point here is that if APR is
configured with --disable-threads, we shouldn't be enabling threaded or
reentrant versions of libs unless we intend to use that feature of the
library. APR is currently broken on that particular version of AIX.

> > installations of APR in threaded and non-threaded modes. Will we
> > eventually go to the libapr.so and libapr_r.so modes?
> 
> I don't like this approach.  The reason you would do it for libc
> and libc_r is that the codebase is completely separate.  Our code
> is unified and we'd require a two-pass compilation system.  I'm
> not sure I'd like that.  We'd need to think long and hard before
> splitting it out like that.  -- justin

I wasn't proposing this as a solution, since I don't like it either, but
for the moment I don't know where the group stands on this issue. We don't
really have a reentrant and a non-reentrant version of APR, per the
definition. What we have is a mismatch between APR-supported platforms
that have threads and those that don't.

-aaron

Re: [PATCH] only enable _THREAD_SAFE on AIX when we want/have threads

Posted by Justin Erenkrantz <je...@ebuilt.com>.
On Tue, Jan 22, 2002 at 11:02:39AM -0800, Aaron Bannert wrote:
> This patch is verified to work on AIX 4.2.1, but it was suggested
> to me by the reporter (Elrond <el...@samba-tng.org>) that we do
> the same for other platforms for things like _REENTRANT and I
> agree. Does anyone see a reason not to do this?

I think there are some platforms that will do bad things when
_REENTRANT is defined for some libraries and not for others.
I think it's best to always define that wherever possible.
(AIX brain damage excluded.)

> installations of APR in threaded and non-threaded modes. Will we
> eventually go to the libapr.so and libapr_r.so modes?

I don't like this approach.  The reason you would do it for libc
and libc_r is that the codebase is completely separate.  Our code
is unified and we'd require a two-pass compilation system.  I'm
not sure I'd like that.  We'd need to think long and hard before
splitting it out like that.  -- justin