apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Trawick <trawi...@bellsouth.net>
Subject Re: CFLAGS vs. THREAD_CPPFLAGS
Date Thu, 22 Feb 2001 12:21:18 GMT
"Roy T. Fielding" <fielding@ebuilt.com> writes:

> On Wed, Feb 21, 2001 at 01:05:41PM -0500, Jeff Trawick wrote:
> > Solaris is failing to build right now because the sigwait()
> > num-argument check is failing.
> > 
> > When we run the test, -D_POSIX_PTHREAD_SEMANTICS is not passed to the
> > compiler so we get the one-argument version and SIGWAIT_TAKES_ONE_ARG
> > is defined.
> > 
> > When we compile apr/threadprox/unix/signals.c,
> > -D_POSIX_PTHREAD_SEMANTICS is passed to the compiler because
> > apr_hints.m4 puts it in THREAD_CPPFLAGS.  Thus we get the prototype
> > for the two-argument version and we fail to compile.
> > 
> > Does anybody know exactly why this worked before?
> 
> The behavior probably changed with my move of REENTRANCY_FLAGS
> from a separate macro to apr_hints.m4.  Formerly, the values were
> always set in httpd and only set when threads were tested for APR,
> but even that was questionable given how flags were erratically
> exported.  I put a comment to that effect in the configure.in.

Ryan mentioned that they weren't used at all before, so it makes sense
why it just started failing.

> I was waiting to ask which behavior is right -- should we always
> define these flags, or only when threads is enabled?  

The answer may be system-specific.

I think they need to be in CFLAGS during the autoconf tests.  For
Solaris, I suspect that replacing

  APR_ADDTO(THREAD_CPPFLAGS, [-D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT])

with

  if test "$enable_threads" != "no"; then
    APR_ADDTO(CFLAGS, [-D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT])
  fi

is the right idea.

Or maybe in common code after the system-specific part of
apr_hints.m4...

  if test "$enable_threads != "no"; then
    if test "x$THREAD_CPPFLAGS" != "x"; then # avoid adding blank :)
      CFLAGS="$CFLAGS $THREAD_CPPFLAGS"
    fi
  fi

This assumes that we only hard-code THREAD_CPPFLAGS for platforms
which actually have threads.

>                                                       Or is there
> a way to test them using an AC_TRY_COMPILE instead of apr_hints.m4?

I don't understand what commonality there is between systems in these
aspects, so I'm happy to keep this hard-coded for now.  Also, some of
the issues are hard to autodetect.  Some of the features associated
with these thread flags are rather esoteric, like "POSIX semantics for
fork()" instead of "Solaris semantics."  Even if I did find out the
difference I'm not sure I would be able to construct a reliable
autoconf AC_TRY_RUN autoconf test...

> Basically, all of the flag setting will be rewritten this week.

Cool...  I may commit something to get Solaris building in the short
term.

-- 
Jeff Trawick | trawickj@bellsouth.net | PGP public key at web site:
       http://www.geocities.com/SiliconValley/Park/9289/
             Born in Roswell... married an alien...

Mime
View raw message