httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ryan Bloom <...@raleigh.ibm.com>
Subject Re: cvs commit: apache-2.0/src/modules/standard mod_include.c mod_log_config.c mod_negotiation.c
Date Tue, 21 Dec 1999 22:54:10 GMT

> Where that stands right now is that we know that #ifdef will work on
> all compilers when something is undefed, but we don't know this for
> #if. And since autoheader generates #undef/#define, I have no
> inclination to change the definition of those macros. If all compilers
> will not barf horribly on #if BLAH if BLAH isn't defined, then I have
> no qualms about switching to #if (though I'm too lazy to bother with
> it myself).
> 
> The positives and negatives of the two approaches should be the same
> for Apache and APR. Ideally, the solution should be as well.

The positives and negatives for APR are quite simple, and I have already
specified them once, I will do so again now.

In APR, we were forced to create an APR.H file, which defines all of the
exposed feature macros that APR has.  In this new file, I needed to define
macros like:

#define APR_HAS_THREADS
#define APR_HAS_MMAP

I had two possibilities for doing this.

Option 1)

In apr.h.in:

@THREADS@

In configure.in: (In psuedo-code)

if {check for threading support}
    THREADS="#define APR_HAS_THREADS
else
    THREADS="#undef APR_HAS_THREADS
fi

AC_SUBST(THREADS)
Option 2)

In apr.h:

#define APR_HAS_THREADS @THREADS@

In configure.in

if {check for threading support}
    THREADS="1"
else
    THREADS="0"
fi

AC_SUBST(THREADS)

I initially opted for the first method, because it stuck with the #if rule
that Apache had adopted.  I happened to have made this change a few days
before leaving work for a few days for personal reasons.  While I was
gone, I had three different people contact me to find out what those
@THREADS@ things were there for.  One of these people was trying to get
autoconf working on his system again, the other two were trying to port
APR to a platform without autoconf.

I consider all three of these people very intelligent and very good
programmers, but all three are also very busy and new to autoconf.  If
they couldn't figure out what the @THREADS@ type macros were, then how
could I reasonably expect a person, who is trying to port Apache 2.0 and
APR to a new platform, to be able to figure them out?  The only answer I
could come to was I couldn't expect it.

Option 2 is much clearer in this respect.  It is obvious what we are
trying to figure out.  Plus, #if is much more powerful that #ifdef.  There
are times that we don't want to check if something is defined, but we want
to check what the value of a definition is.  Case in point, What version
of AIX are we on?  In Apache 1.3.10, we modified the dlopen code on AIX,
so that if we are on 4.3 or later, we use AIX's provided dlopen, because
it has been fixed and it works for 64-bit programs.  If, however, we are
on AIX 4.2 or earlier, we use Apache's dlopen, because AIX's is broken.

I don't know how to make that check with #ifdef.  I do know how to check
if HAVE_MALLOC_H is defined or not with #if, just use #if
defined(HAVE_MALLOC_H).  If we are going to come right out and limit
ourselves to either #if or #ifdef, them we had better choose wisely,
because this issue will bite us when we want the added functionality of
#if, but we can't use it because Apache 2.0 only uses #ifdef.

But, we made our decision already.  :-)

Ryan




_______________________________________________________________________
Ryan Bloom		rbb@raleigh.ibm.com
4205 S Miami Blvd	
RTP, NC 27709		

Come to the first official Apache Software Foundation
Conference!  <http://ApacheCon.Com/>



Mime
View raw message