Return-Path: Delivered-To: new-httpd-archive@hyperreal.org Received: (qmail 19143 invoked by uid 6000); 21 Dec 1999 21:56:52 -0000 Received: (qmail 18916 invoked from network); 21 Dec 1999 21:56:46 -0000 Received: from fwns2d.raleigh.ibm.com (HELO fwns2.raleigh.ibm.com) (204.146.167.236) by taz.hyperreal.org with SMTP; 21 Dec 1999 21:56:46 -0000 Received: from rtpmail02.raleigh.ibm.com (rtpmail02.raleigh.ibm.com [9.37.172.48]) by fwns2.raleigh.ibm.com (8.9.0/8.9.0/RTP-FW-1.2) with ESMTP id QAA21996 for ; Tue, 21 Dec 1999 16:56:44 -0500 Received: from hapkido.raleigh.ibm.com (rbb@hapkido.raleigh.ibm.com [9.37.65.84]) by rtpmail02.raleigh.ibm.com (8.8.5/8.8.5/RTP-ral-1.1) with ESMTP id QAA31682 for ; Tue, 21 Dec 1999 16:56:36 -0500 Date: Tue, 21 Dec 1999 17:54:10 -0500 (EST) From: Ryan Bloom To: new-httpd@apache.org Subject: Re: cvs commit: apache-2.0/src/modules/standard mod_include.c mod_log_config.c mod_negotiation.c In-Reply-To: <19991221153140.A23417@io.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: new-httpd-owner@apache.org Precedence: bulk Reply-To: new-httpd@apache.org Status: O > 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!