Compiling Apache 1.3.x on modern Linux distributions

Frederic Cambus November 10, 2011 [Linux]

For a lot of reasons, some people still want to be able to run Apache 1.3 on modern Linux distributions, and unfortunately for them, it doesn't compile out of the box anymore. The encountered errors are, however, easy to fix and you will learn how to do so in this tutorial.

We start by downloading and unpacking sources of the latest 1.3.x version, which happens to be 1.3.42:

tar xvfz apache_1.3.42.tar.gz

We then run the configure script:

cd apache_1.3.42

Most likely, this will fail and this error message will get displayed:

+ Warning: Your 'echo' command is slightly broken.
+ It interprets escape sequences per default. We already
+ tried 'echo -E' but had no real success. If errors occur
+ please set the SEO variable in 'configure' manually to
+ the required 'echo' options, i.e. those which force your
+ 'echo' to not interpret escape sequences per default.

+ NOTE: You may also need to edit the shell invoked by
+       'configure'. Some shells (e.g. dash) have a
+       faulty echo builtin.
+ using installation path layout: Apache (config.layout)

This happens because in most modern distributions, sh is just an alias to dash, and dash interprets escape sequences which are therefore not echoed as they should.

The workaround is to simply use bash instead of sh to run the script:

bash ./configure

Now, let's compile everything:


After compiling a few files, the process will halt with this error:

gcc -c  -I../os/unix -I../include   -DLINUX=22 -DHAVE_SET_DUMPABLE -DUSE_HSREGEX -DNO_DL_NEEDED `../apaci` htpasswd.c
htpasswd.c:101:12: error: conflicting types for ‘getline’
/usr/include/stdio.h:671:20: note: previous declaration of ‘getline’ was here
make[2]: *** [htpasswd.o] Error 1

The internal Apache getline function is conflicting with the getline function from the standard I/O library. We can simply fix this by renaming the getline function, which is defined and called in htdigest.c, htpasswd.c, and logresolve.c:

sed -i 's/getline/apache_getline/' src/support/htdigest.c
sed -i 's/getline/apache_getline/' src/support/htpasswd.c
sed -i 's/getline/apache_getline/' src/support/logresolve.c

Let's run make again, and everything should finally compile without problem:


Please note, however, that Apache 1.3 branch reached end of life and is therefore deprecated and not supported anymore. It means you will not be getting any bugfixes or security updates and should anything happen, you will have to patch the source files yourself.