#!/bin/sh

date
perl -V

cd /usr/local/src

/bin/rm -rf apache.tar.gz  apache_1.3.23 mod_perl-1.26.tar.gz mod_perl-1.26 httpd-apreq apreq.tar.gz /usr/local/src/apache

/bin/rm -rf apache.tar.gz  apache_1.3.23 mod_perl-1.26.tar.gz mod_perl-1.26 httpd-apreq apreq.tar.gz /usr/local/src/apache

wget -q ftp://ftp-mirror.internap.com/pub/CPAN/authors/id/D/DO/DOUGM/mod_perl-1.26.tar.gz
wget -q http://www.apache.org/~joes/apreq.tar.gz
wget -q http://www.apache.org/~joes/apache.tar.gz

tar -xzf mod_perl-1.26.tar.gz 
tar -xzf apreq.tar.gz
tar -xzf apache.tar.gz

cd mod_perl-1.26
perl Makefile.PL APACHE_PREFIX=/usr/local/apache DO_HTTP=1 PREP_HTTP=1 USE_APACI=1 EVERYTHING=1
# I answered these prompts this way:
# Configure mod_perl with ../apache_1.3.23/src ? [y] 
# Shall I build httpd in ../apache_1.3.23/src for you? [y] n
make
make install


cd ../httpd-apreq
perl Makefile.PL
make
make install

cd ../apache_1.3.23
./configure \
  --prefix=/usr/local/apache  \
  --with-layout=Apache \
  --disable-rule=EXPAT \
  --activate-module=src/modules/perl/libperl.a

make
make install

cd /usr/local/apache
echo 'PerlRequire "conf/startup.pl"' >> conf/httpd.conf
echo 'use Apache::Request;' > conf/startup.pl
echo 'use Apache::Cookie;' >> conf/startup.pl

bin/httpd -d /usr/local/apache -f conf/httpd.conf
