Compiling Apache 2 under OS X 10.3.x

Introduction

OS X client only comes with Apache 1 which, among many limitations, does not support IPv6; so I decided to install Apache 2. I originally tried the Complete Apache 2 distribution from Server Logistics, but found that version of Apache had been compiled with the wrong threading support for my needs and no IPv6 support. So I rolled my own from source.

Configuring the install location

As I wished to upgrade my 'Complete Apache' install, I chose to configure Apache to install the same way that package had done. Obviously, feel free to use one of the otherdefined install setups for Apache or modify this config to your own requirements.

After downloading and unpacking the Apache 2 source, edit the file config.layout by adding the following:

<Layout ServLog>
    prefix: /Library/Apache2 
    exec_prefix: ${prefix} 
    bindir: ${exec_prefix}/bin 
    sbindir: ${exec_prefix}/bin 
    libdir: ${exec_prefix}/lib 
    libexecdir: ${exec_prefix}/modules 
    mandir: ${prefix}/man 
    sysconfdir: ${prefix}/conf 
    datadir: ${prefix} 
    installbuilddir: ${datadir}/build 
    errordir: ${datadir}/error 
    iconsdir: ${datadir}/icons 
    htdocsdir: ${datadir}/htdocs 
    manualdir: ${datadir}/manual 
    cgidir: ${datadir}/cgi-bin 
    includedir: ${prefix}/include 
    localstatedir: ${prefix} 
    runtimedir: ${localstatedir}/logs 
    logfiledir: ${localstatedir}/logs 
    proxycachedir: ${localstatedir}/proxy 
</Layout>
            

Patching ARP

There is a bug (reported, id 29985 in the Apache bugzilla database) in the configuration scripts for Apache that cause Poll support to be activated in ARP when, in fact, OSX does not have the Poll libs any more. The cause is the detection of old poll.h header files for the Poll library that was depreciated in 10.2 and removed by Apple with 10.3. If you have upgraded, the headers are still there. I suppose deleting the headers would do the job but I figured it was less destructive to edit one of the ARP source files instead.

In the file srclib/apr/poll/unix/poll.c find the lines:

#ifdef HAVE_POLL    /* We can just use poll to do our socket polling. */

static apr_int16_t get_event(apr_int16_t event)
        
and, just before the first of these lines, add the line:
#undef HAVE_POLL
        
which will disable poll support no matter what the configuration process says.

Parameters for Configure

Finally, you need to run configure. The configure line I used reads the ServLog layout (which I added to config.layout in the first step), enables most bits of Apache, including IPv6 (which you might want to leave out) and sets threading to the old, Apache 1.3 compatible, 'prefork' style so that PHP4 will still run. If you have PHP5, you might prefer to choose the 'worker' style which is slightly less resource intensive but requires all your libraries to be thread-safe:

./configure --enable-layout=ServLog --enable-mods-shared=all --with-ssl=/usr
--with-mpm=prefork --enable-ssl --enable-dav --enable-cache --enable-proxy
--enable-shared --disable-static --disable-unique-id --enable-ipv6 
        

Having got this far, simply follow the standard instructions for making and installing / upgrading.