httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sascha Schumann <>
Subject Re: cvs commit: apache-2.0/src buildconf
Date Tue, 21 Dec 1999 19:16:54 GMT
On Tue, Dec 21, 1999 at 12:38:09PM -0600, Manoj Kasichainula wrote:
> On Tue, Dec 21, 1999 at 05:25:05PM +0100, Sascha Schumann wrote:
> >     Well, it is not that easy. First, -pthread isn't relevant to
> >     the compile stage. It should be put into LDFLAGS (it causes
> >     -lc_r or -lpthread on FreeBSD or Linux, respectively).
> On Linux systems that I've checked, -pthread implies -lpthread, and it
> seems to be working for me in just the CFLAGS. In fact, it's curious
> that nothing is needed in LDFLAGS; I guess that since gcc is used as
> the linker, autoconf is also appending CFLAGS. *shrug*

    It's fairly simply. Look at automake's LINK line

    LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@

> >     Second, a number of macros are needed. On Linux, it is
> >     _REENTRANT (see <features.h>).
> -pthread also turns on -D_REENTRANT on my Linux box.

    You are probably using gcc-2.95.2. That is the first gcc
    release which also enables -D_REENTRANT on Linux when
    -pthread is used. Needless to say that this specific gcc
    version isn't widely available.

> >      On FreeBSD, no special flags are needed (AFAIK; the fact that
> >      the thread-safe PHP binary builds flawlessly supports this.
> Actually, I don't think not including -D_REENTRANT will make any
> compiles fail if you try compiling threaded code; it will just make
> your code not work :(. If FreeBSD doesn't also add an implied
> -D_REENTRANT, then yeah, we should do so.

    The code actually works. As I said before, FreeBSD doesn't
    use _REENTRANT extensively. _REENTRANT will cause four
    additional prototypes to be defined, and nothing else (this
    is -current, -stable should be similar). These are reentrant
    versions of math functions..

    I've also hunted additional macros, but there don't seem to
    be any important ones. You will get a few more prototypes, if
    you define _POSIX_C_SOURCE=199309L, but I don't know whether
    Apache needs them.

> >     Third, you should check for pthread_kill in -lpthread, if the
> >     function is not available when you use -pthread (Solaris,
> >     Tru64, probably other O/S as well). Why not check for
> >     pthread_create? Because on Tru64, -lpthread does not contain
> >     pthread_create.
> Ouch. Is it a macro or something?

    Yes, IIRC it is defined to _pthread_create. Don't ask me why. :)

    Of course, you could include <pthread.h> first and check for
    pthread_create(). In TSRM, I chose to go the way of least
    resistance and pick a function which is always available. 

> So there are two ways I can go about adding these changes. I can
> either try to cover all OSes without OS detection. (-D_REENTRANT
> -D_POSIX_PTHREAD_SEMANTICS -D...) or just bite the bullet and check
> the OS first. I guess we should do the latter.

    I couldn't verify this yet, but SCO seems to be have problems
    with _REENTRANT. So, at least on that platform _REENTRANT
    should not be defined.

> Are there any good autoconf macros that have all this stuff
> encapsulated already?
    None which perform OS-specific checks.



                            Sascha Schumann

View raw message