#!/bin/bash
# Build script for apache2
# Use this for configure, make and make install for the apache version 2.
# Change the version and the CFLAGS for your own system/hardware.

APACHE_VER=2.2.4
APACHE_PREFIX=/usr/local/apache2
MPM=prefork

echo "Installation tool for Apache2 $APACHE_VER"
echo "Configuring Apache2 ..."
echo " "
sleep 3

cd httpd-$APACHE_VER

./configure CFLAGS="-O3 -march=i686 -mtune=i686 -fPIC -D_LARGEFILE_SOURCE" \
	--prefix=$APACHE_PREFIX \
	--localstatedir=/var/www \
	--sysconfdir=/usr/local/etc/apache2 \
	--mandir=/usr/local/share/man \
	--with-mpm=$MPM \
	--enable-mods-shared=all \
	--with-perl \
	--enable-echo \
	--enable-so \
	--enable-cgi \
	--enable-info \
	--enable-http \
	--enable-cache \
	--enable-disk-cache \
	--enable-mem-cache \
	--enable-logio \
	--enable-case-filter \
	--enable-case-filter_in \
	--enable-mime-magic \
	--enable-usertrack \
	--enable-include \
	--enable-expires \
	--enable-headers \
	--enable-unique-id \
	--enable-rewrite \
	--enable-alias \
	--enable-ssl=shared \
	--with-ldap \
	--enable-ldap \
	--enable-auth_ldap \
	--enable-auth-anon \
	--enable-auth-dbm \
	--disable-userdir \
	--with-z=/usr/lib
echo " "
echo "done... "
sleep 3

echo " "
echo "Building Apache2 $APACHE_VER..."
echo " "
make -j4
echo " "
echo "done... "

# If you don't run as sudo/root leave the comments.

#sleep 3
#
#echo " "
#echo "Installing Apache2 $APACHE_VER..."
#make install
#echo " "
#echo "done... "
