#!/bin/sh
## ====================================================================
## Copyright (c) 1998 The Apache Group. All rights reserved.
##
## Redistribution and use in source and binary forms, with or without
## modification, are permitted provided that the following conditions
## are met:
##
## 1. Redistributions of source code must retain the above copyright
## notice, this list of conditions and the following disclaimer.
##
## 2. Redistributions in binary form must reproduce the above copyright
## notice, this list of conditions and the following disclaimer in
## the documentation and/or other materials provided with the
## distribution.
##
## 3. All advertising materials mentioning features or use of this
## software must display the following acknowledgment:
## "This product includes software developed by the Apache Group
## for use in the Apache HTTP server project (http://www.apache.org/)."
##
## 4. The names "Apache Server" and "Apache Group" must not be used to
## endorse or promote products derived from this software without
## prior written permission. For written permission, please contact
## apache@apache.org.
##
## 5. Products derived from this software may not be called "Apache"
## nor may "Apache" appear in their names without prior written
## permission of the Apache Group.
##
## 6. Redistributions of any form whatsoever must retain the following
## acknowledgment:
## "This product includes software developed by the Apache Group
## for use in the Apache HTTP server project (http://www.apache.org/)."
##
## THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
## EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR
## ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
## NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
## LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
## HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
## STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
## OF THE POSSIBILITY OF SUCH DAMAGE.
## ====================================================================
##
## This software consists of voluntary contributions made by many
## individuals on behalf of the Apache Group and was originally based
## on public domain software written at the National Center for
## Supercomputing Applications, University of Illinois, Urbana-Champaign.
## For more information on the Apache Group and the Apache HTTP server
## project, please see .
##
##
## configure -- Apache Autoconf-style Interface (APACI)
##
## Written by Ralf S. Engelschall
##
##
## the paths to the Apache source tree
##
root=.
src=src
mkf=Makefile
aux=src/helpers
##
## pre-determine runtime modes
##
quiet=no
verbose=no
case "$*" in
--help|*--help|*--help* ) quiet=yes ;;
--quiet|*--quiet|*--quiet* ) quiet=yes ;;
--verbose|*--verbose|*--verbose*|-v|*-v|*-v* ) verbose=yes ;;
* ) ;;
esac
##
## display version information
##
if [ ".$quiet" = .no ]; then
APV=`cat $src/include/httpd.h |\
grep "#define SERVER_BASEVERSION" |\
sed -e 's/^[^"]*"//' -e 's/".*$//' -e 's/^Apache\///'`
echo "Configuring for Apache, Version $APV"
fi
##
## important hint for the first-time users
##
if [ $# -eq 0 ]; then
echo " + Warning: Configuring Apache with default settings."
echo " + This is probably not what you really want."
echo " + Please read the README.configure and INSTALL files"
echo " + first or at least run '$0 --help' for"
echo " + a compact summary of available options."
fi
##
## determine optional Perl interpreter
##
PERL=no-perl-on-this-system
IFS=:
for dir in $PATH; do
for exe in perl5 perl miniperl; do
if test -f "$dir/$exe"; then
if test -x "$dir/$exe"; then
PERL="$dir/$exe"
fi
fi
done
done
PERL="`echo $PERL | sed -e 's://:/:'`"
##
## determine default parameters
##
# default paths
prefix='/usr/local/apache'
exec_prefix='$prefix'
bindir='$exec_prefix/bin'
sbindir='$exec_prefix/sbin'
libexecdir='$exec_prefix/libexec'
mandir='$prefix/man'
sysconfdir='$prefix/etc'
datadir='$prefix/share'
localstatedir='$prefix/var'
localstatesubdir_run='run'
localstatesubdir_logs='logs'
includedir='$prefix/include'
# customization flags for
# automatic "apache" suffix
customized_sysconfdir=0
customized_datadir=0
customized_localstatedir=0
customized_includedir=0
# check and debug
layout=0
# suexec defaults
suexec=0
suexec_caller=www
suexec_userdir=public_html
# with support tools
support=1
# determine rules
rules=""
rulelist=""
IFS='
'
for rule in `grep '^Rule' $src/Configuration.tmpl`; do
rule=`echo "$rule" | sed -e 's/^Rule[ ]*//'`
name=`echo "$rule" | sed -e 's/=.*$//'`
namelow=`echo "$name" | tr "A-Z" "a-z"`
arg=`echo "$rule" | sed -e 's/^.*=//'`
eval "rule_$namelow=$arg"
rules="$rules:$namelow"
rulelist="$rulelist:$name=$arg"
done
# determine modules
rm -f $src/Configuration.apaci 2>/dev/null
modules=""
modulelist=""
IFS='
'
for module in `egrep '^[# ]*(Add|Shared)Module' $src/Configuration.tmpl`; do
add=yes
share=no
if [ ".`echo $module | grep '^#'`" != . ]; then
add=no
fi
if [ ".`echo $module | grep 'SharedModule'`" != . ]; then
share=yes
fi
module=`echo "$module" |\
sed -e 's%^.*/\(.*\)$%\1%' \
-e 's/\.[oa]$//' \
-e 's/^mod_//' \
-e 's/^lib//'`
eval "module_$module=$add"
eval "shared_$module=$share"
modules="${modules}:$module"
modulelist="${modulelist}:$module=$add"
if [ ".$share" = .yes ]; then
modulelist="${modulelist}*"
fi
done
##
## parse argument line options
##
apc_prev=""
IFS='
'
for apc_option
do
# if previous option needs an argument, assign it.
if [ ".$apc_prev" != . ]; then
eval "$apc_prev=\$apc_option"
apc_prev=""
continue
fi
# split out arguments
case "$apc_option" in
-*=*) apc_optarg=`echo "$apc_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
*) apc_optarg= ;;
esac
# accept only the most important GNU Autoconf-style options
case "$apc_option" in
--quiet | --silent)
quiet=yes
;;
--verbose | -v)
verbose=yes
;;
--shadow)
# determine GNU platform triple
gnutriple=`$src/helpers/GuessOS | awk '{ printf("%s",$1); }' | sed -e 's:/:-:g'`
# create Makefile wrapper
if [ .$quiet = .no ]; then
echo " + creating Makefile (shadow wrapper)"
fi
echo "##" > Makefile
echo "## Apache Makefile (shadow wrapper)" >> Makefile
echo "##" >> Makefile
echo "" >> Makefile
echo "GNUTRIPLE=\`$src/helpers/GuessOS | awk '{ printf(\"%s\",\$\$1); }' | sed -e 's:/:-:g'\`" >> Makefile
echo "" >> Makefile
echo "all build install clean distclean:" >> Makefile
echo " @\$(MAKE) -f Makefile.\$(GNUTRIPLE) \$(MFLAGS) \$@" >> Makefile
echo "" >> Makefile
# set shadow paths
shadowmkf="Makefile.$gnutriple"
shadowsrc="src.$gnutriple"
# (re)create shadow tree
if [ .$quiet = .no ]; then
echo " + create shadow tree ($shadowsrc)"
fi
rm -rf $shadowsrc
mkdir $shadowsrc
$aux/mkshadow.sh $src $shadowsrc
# delegate us to the shadow paths
mkf=$shadowmkf
src=$shadowsrc
;;
--help | -h | -help )
echo "Usage: configure [options]"
echo "Options: [defaults in brackets after descriptions]"
echo "General options:"
echo " --quiet, --silent do not print messages"
echo " --verbose, -v print even more messages"
echo " --shadow switch to a shadow tree for building"
echo ""
echo "Stand-alone options:"
echo " --help, -h print this message"
echo " --layout print installation layout (check and debug)"
echo ""
echo "Installation layout options:"
echo " --prefix=PREFIX install architecture-independent files in PREFIX"
echo " --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX"
echo " --bindir=DIR install user executables in DIR [EPREFIX/bin]"
echo " --sbindir=DIR install sysadmin executables in DIR [EPREFIX/sbin]"
echo " --libexecdir=DIR install program executables in DIR [EPREFIX/libexec]"
echo " --mandir=DIR install manual pages in DIR [PREFIX/man]"
echo " --sysconfdir=DIR install configuration files in DIR [PREFIX/etc]"
echo " --datadir=DIR install read-only data files in DIR [PREFIX/share]"
echo " --localstatedir=DIR install modifiable data files in DIR [PREFIX/var]"
echo " --includedir=DIR install includes files in DIR [PREFIX/include]"
echo " --compat install with old Apache 1.2 installation paths"
echo ""
echo "Configuration options:"
echo " --enable-rule=NAME enable a particular Rule named 'NAME'"
echo " --disable-rule=NAME disable a particular Rule named 'NAME'"
$aux/ppl.sh $rulelist
echo " --add-module=FILE on-the-fly copy & activate a third-party Module source"
echo " --activate-module=FILE on-the-fly activate existing third-party Module source"
echo " --enable-module=NAME enable a particular Module named 'NAME'"
echo " --disable-module=NAME disable a particular Module named 'NAME'"
$aux/ppl.sh $modulelist
echo " --enable-shared=NAME enable build of Module named 'NAME' as a shared object"
echo " --disable-shared=NAME disable build of Module named 'NAME' as a shared object"
echo " --with-perl=FILE set the path to the optional Perl interpreter to use"
echo " --without-support disable the build and installation of support tools"
echo ""
echo "suEXEC options:"
echo " --enable-suexec enable the suEXEC feature"
echo " --suexec-caller=NAME set the suEXEC username of the allowed caller [$suexec_caller]"
echo " --suexec-userdir=DIR set the suEXEC user subdirectory [$suexec_userdir]"
echo ""
exit 0
;;
--layout)
layout=1
;;
--prefix=*)
prefix="$apc_optarg"
;;
--exec-prefix=*)
exec_prefix="$apc_optarg"
;;
--bindir=*)
bindir="$apc_optarg"
;;
--sbindir=*)
sbindir="$apc_optarg"
;;
--libexecdir=*)
libexecdir="$apc_optarg"
;;
--mandir=*)
mandir="$apc_optarg"
;;
--sysconfdir=*)
sysconfdir="$apc_optarg"
customized_sysconfdir=1
;;
--datadir=*)
datadir="$apc_optarg"
customized_datadir=1
;;
--localstatedir=*)
localstatedir="$apc_optarg"
customized_localstatedir=1
;;
--includedir=*)
includedir="$apc_optarg"
customized_includedir=1
;;
--compat)
prefix='/usr/local/apache'
exec_prefix='$prefix'
bindir='$exec_prefix/bin'
sbindir='$exec_prefix/bin'
libexecdir='$exec_prefix/bin'
mandir='$prefix/man'
sysconfdir='$prefix/conf'
datadir='$prefix'
localstatedir='$prefix'
localstatesubdir_run='logs'
localstatesubdir_logs='logs'
includedir='$prefix/include'
;;
--add-module=*)
file="$apc_optarg"
case $file in
*.c ) ;;
* ) echo "configure:Error: Module source $file is not a C source file";
exit 1
;;
esac
if [ ! -f $file ]; then
echo "configure:Error: Module source $file not found"
exit 1
fi
modfilec=`echo $file | sed -e 's;^.*/;;'`
modfileo=`echo $file | sed -e 's;^.*/;;' -e 's;\.c$;.o;'`
if [ ".$file" != ".$src/modules/extra/$modfilec" ]; then
cp $file $src/modules/extra/$modfilec
fi
echo "" >>$src/Configuration.apaci
echo "## On-the-fly added module" >>$src/Configuration.apaci
echo "## (configure --add-module=$file)" >>$src/Configuration.apaci
echo "AddModule modules/extra/$modfileo" >>$src/Configuration.apaci
module=`echo "$modfileo" |\
sed -e 's%^.*/\(.*\)$%\1%' \
-e 's/\.[^.]*$//' \
-e 's/^mod_//' \
-e 's/^lib//'`
eval "module_$module=yes"
eval "shared_$module=no"
modules="${modules}:$module"
modulelist="${modulelist}:$module=yes"
if [ ".$quiet" = .no ]; then
echo " + on-the-fly added and activated $module module (modules/extra/$modfileo)"
fi
;;
--activate-module=*)
file="$apc_optarg"
case $file in
src/modules/* ) ;;
*) echo "configure:Error: Module source already has to stay below src/modules/ to be activated"
exit 1
;;
esac
modfile=`echo $file | sed -e 's;^src/;;'`
echo "" >>$src/Configuration.apaci
echo "## On-the-fly activated module" >>$src/Configuration.apaci
echo "## (configure --activate-module=$file)" >>$src/Configuration.apaci
echo "AddModule $modfile" >>$src/Configuration.apaci
module=`echo "$modfile" |\
sed -e 's%^.*/\(.*\)$%\1%' \
-e 's/\.[^.]*$//' \
-e 's/^mod_//' \
-e 's/^lib//'`
eval "module_$module=yes"
eval "shared_$module=no"
modules="${modules}:$module"
modulelist="${modulelist}:$module=yes"
if [ ".$quiet" = .no ]; then
echo " + activated $module module ($modfile)"
fi
;;
--enable-*)
apc_feature=`echo $apc_option | sed -e 's/-*enable-//' -e 's/=.*//'`
apc_feature=`echo $apc_feature | sed 's/-/_/g'`
case "$apc_option" in
*=*) ;;
*) apc_optarg=yes ;;
esac
case "$apc_feature" in
rule )
apc_optarg=`echo "$apc_optarg" | tr "A-Z" "a-z"`
apc_optarg_real=`echo "$apc_optarg" | tr "a-z" "A-Z"`
eval "exists=\$rule_${apc_optarg}"
if [ ".$exists" = . ]; then
echo "configure:Error: No such rule named '${apc_optarg_real}'"
exit 1
fi
eval "rule_${apc_optarg}=yes"
;;
module )
case $apc_optarg in
all )
IFS=:
for module in `echo "$modules" | sed -e 's/^://'`; do
eval "module_${module}=yes"
done
;;
most )
IFS=:
for module in `echo "$modules" | sed -e 's/^://'`; do
eval "module_${module}=yes"
done
module_auth_db=no # not all platforms have -ldb
module_mmap_static=no # not all platforms have mmap()
module_so=no # not all platforms have dlopen()
module_example=no # only for developers
module_log_agent=no # deprecated
module_log_referer=no # deprecated
;;
* )
eval "exists=\$module_${apc_optarg}"
if [ ".$exists" = . ]; then
echo "configure:Error: No such module named '${apc_optarg}'"
exit 1
fi
eval "module_${apc_optarg}=yes"
;;
esac
;;
shared )
case $apc_optarg in
max )
IFS=:
for module in `echo "$modules" | sed -e 's/^://'`; do
eval "shared_${module}=yes"
done
shared_so=no # because of bootstrapping
;;
remain )
IFS=:
for module in `echo "$modules" | sed -e 's/^://'`; do
eval "add=\$module_${module}"
if [ ".$add" = .no ]; then
eval "module_${module}=yes"
eval "shared_${module}=yes"
fi
done
shared_so=no
;;
* )
eval "exists=\$module_${apc_optarg}"
if [ ".$exists" = . ]; then
echo "configure:Error: No such module named '${apc_optarg}'"
exit 1
fi
eval "shared_${apc_optarg}=yes"
;;
esac
;;
suexec )
if [ ".`id | grep root`" = . ]; then
echo "configure:Error: suEXEC support needs root priviledges for installation"
exit 1
fi
suexec=1
;;
esac
;;
--disable-*)
apc_feature=`echo $apc_option | sed -e 's/-*disable-//' -e 's/=.*//'`
apc_feature=`echo $apc_feature| sed 's/-/_/g'`
case "$apc_option" in
*=*) ;;
*) apc_optarg=yes ;;
esac
case "$apc_feature" in
rule )
apc_optarg=`echo "$apc_optarg" | tr "A-Z" "a-z"`
apc_optarg_real=`echo "$apc_optarg" | tr "a-z" "A-Z"`
eval "exists=\$rule_${apc_optarg}"
if [ ".$exists" = . ]; then
echo "configure:Error: No such rule named '${apc_optarg_real}'"
exit 1
fi
eval "rule_${apc_optarg}=no"
;;
module )
case $apc_optarg in
all )
IFS=:
for module in `echo "$modules" | sed -e 's/^://'`; do
eval "module_${module}=no"
done
;;
* )
eval "exists=\$module_${apc_optarg}"
if [ ".$exists" = . ]; then
echo "configure:Error: No such module named '${apc_optarg}'"
exit 1
fi
eval "module_${apc_optarg}=no"
;;
esac
;;
shared )
case $apc_optarg in
all )
IFS=:
for module in `echo "$modules" | sed -e 's/^://'`; do
eval "shared_${module}=no"
done
;;
* )
eval "exists=\$module_${apc_optarg}"
if [ ".$exists" = . ]; then
echo "configure:Error: No such module named '${apc_optarg}'"
exit 1
fi
eval "shared_${apc_optarg}=no"
;;
esac
;;
esac
;;
--with-perl=*)
PERL="$apc_optarg"
;;
--without-support)
support=0
;;
--suexec-caller=*)
suexec_caller="$apc_optarg"
;;
--suexec-userdir=*)
suexec_userdir="$apc_optarg"
;;
* )
echo "configure:Error: invalid option '$apc_option'"
exit 1
;;
esac
done
if [ ".$apc_prev" != . ]; then
echo "configure:Error: missing argument to --`echo $apc_prev | sed 's/_/-/g'`" 1>&2
exit 1
fi
##
## a few warnings
##
if [ ".$PERL" = .no-perl-on-this-system ]; then
if [ .$quiet = .no ]; then
echo " + Warning: no Perl interpreter available for support scripts."
echo " + Perhaps you have to select one with --with-perl=FILE."
fi
fi
##
## expand path variables and make sure
## they do not end with a backslash
##
IFS=' '
for var in prefix exec_prefix bindir sbindir \
libexecdir mandir sysconfdir datadir \
localstatedir includedir; do
eval "val=\$$var";
val=`echo $val | sed -e 's:/*$::'`
eval "$var=\"$val\""
case $var in
sysconfdir|datadir|localstatedir|includedir )
eval "val=\$$var"
case $val in
*apache | *apache* ) ;;
* ) eval "customized=\$customized_$var"
if [ ".$customized" = .0 ]; then
eval "$var=\$$var/apache"
fi
;;
esac
;;
esac
done
##
## determine special configurable Makefile targets
##
if [ ".$support" = .1 ]; then
build_support=build-support
install_support=install-support
clean_support=clean-support
distclean_support=distclean-support
else
build_support=
install_support=
clean_support=
distclean_support=
fi
##
## determine prefix-relative paths for directories
## because Apache supports them for the -d and -f
## options, the LoadModule directive, etc.
##
## [we have to make sure that it ends with a slash
## or we cannot support the case where the relative
## path is just the emtpy one, i.e. ""]
##
localstatedir_relative=`echo $localstatedir | sed -e "s:^$prefix/*::" -e 's:\(.\)$:\1/:'`
sysconfdir_relative=`echo $sysconfdir | sed -e "s:^$prefix/*::" -e 's:\(.\)$:\1/:'`
libexecdir_relative=`echo $libexecdir | sed -e "s:^$prefix/*::" -e 's:\(.\)$:\1/:'`
##
## check and debug
##
if [ ".$layout" = .1 ]; then
echo ""
echo "Installation paths:"
echo " prefix: $prefix"
echo " exec_prefix: $exec_prefix"
echo " bindir: $bindir"
echo " sbindir: $sbindir"
echo " libexecdir: $libexecdir"
echo " mandir: $mandir"
echo " sysconfdir: $sysconfdir"
echo " datadir: $datadir"
echo " localstatedir: $localstatedir"
echo " includedir: $includedir"
echo ""
echo "Compilation paths:"
echo " HTTPD_ROOT: $prefix"
echo " SUEXEC_BIN: $sbindir/suexec"
echo " SHARED_CORE_DIR: $libexecdir"
echo " DEFAULT_PIDLOG: ${localstatedir_relative}${localstatesubdir_run}/httpd.pid"
echo " DEFAULT_SCOREBOARD: ${localstatedir_relative}${localstatesubdir_run}/httpd.scoreboard"
echo " DEFAULT_LOCKFILE: ${localstatedir_relative}${localstatesubdir_run}/httpd.lock"
echo " DEFAULT_XFERLOG: ${localstatedir_relative}${localstatesubdir_logs}/access_log"
echo " DEFAULT_ERRORLOG: ${localstatedir_relative}${localstatesubdir_logs}/error_log"
echo " TYPES_CONFIG_FILE: ${sysconfdir_relative}mime.types"
echo " SERVER_CONFIG_FILE: ${sysconfdir_relative}httpd.conf"
echo " ACCESS_CONFIG_FILE: ${sysconfdir_relative}access.conf"
echo " RESOURCE_CONFIG_FILE: ${sysconfdir_relative}srm.conf"
echo ""
exit 0
fi
##
## create Makefile from Makefile.tmpl
##
if [ .$quiet = .no ]; then
echo "Creating $mkf"
fi
sed $mkf \
-e "s%@PERL@%$PERL%g" \
-e "s%@ROOT@%$root%g" \
-e "s%@SRC@%$src%g" \
-e "s%@MKF@%$mkf%g" \
-e "s%@AUX@%$aux%g" \
-e "s%@prefix@%$prefix%g" \
-e "s%@exec_prefix@%$exec_prefix%g" \
-e "s%@bindir@%$bindir%g" \
-e "s%@sbindir@%$sbindir%g" \
-e "s%@libexecdir@%$libexecdir%g" \
-e "s%@libexecdir_relative@%$libexecdir_relative%g" \
-e "s%@mandir@%$mandir%g" \
-e "s%@sysconfdir@%$sysconfdir%g" \
-e "s%@datadir@%$datadir%g" \
-e "s%@localstatedir@%$localstatedir%g" \
-e "s%@localstatesubdir_run@%$localstatesubdir_run%g" \
-e "s%@localstatesubdir_logs@%$localstatesubdir_logs%g" \
-e "s%@includedir@%$includedir%g" \
-e "s%@suexec@%$suexec%g" \
-e "s%@suexec_caller@%$suexec_caller%g" \
-e "s%@suexec_userdir@%$suexec_userdir%g" \
-e "s%@build_support@%$build_support%g" \
-e "s%@install_support@%$install_support%g" \
-e "s%@clean_support@%$clean_support%g" \
-e "s%@distclean_support@%$distclean_support%g"
##
## override default paths in $src/include/httpd.h
## via command line arguments for the compiler
## supplied by a little shell script named $src/apaci
##
echo "#!/bin/sh" >$src/apaci
echo "## USED AS A COMMAND LINE EXPANDER TO OVERRIDE PATHS" >>$src/apaci
echo "## WITHOUT DISTURBING THE KNOWN MAKE BUILD PROCESS DISPLAY" >>$src/apaci
echo "echo '-DHTTPD_ROOT=\"$prefix\"'" >>$src/apaci
echo "echo '-DSUEXEC_BIN=\"$sbindir/suexec\"'" >>$src/apaci
echo "echo '-DSHARED_CORE_DIR=\"$libexecdir\"'" >>$src/apaci
echo "echo '-DDEFAULT_PIDLOG=\"${localstatedir_relative}${localstatesubdir_run}/httpd.pid\"'" >>$src/apaci
echo "echo '-DDEFAULT_SCOREBOARD=\"${localstatedir_relative}${localstatesubdir_run}/httpd.scoreboard\"'" >>$src/apaci
echo "echo '-DDEFAULT_LOCKFILE=\"${localstatedir_relative}${localstatesubdir_run}/httpd.lock\"'" >>$src/apaci
echo "echo '-DDEFAULT_XFERLOG=\"${localstatedir_relative}${localstatesubdir_logs}/access_log\"'" >>$src/apaci
echo "echo '-DDEFAULT_ERRORLOG=\"${localstatedir_relative}${localstatesubdir_logs}/error_log\"'" >>$src/apaci
echo "echo '-DTYPES_CONFIG_FILE=\"${sysconfdir_relative}mime.types\"'" >>$src/apaci
echo "echo '-DSERVER_CONFIG_FILE=\"${sysconfdir_relative}httpd.conf\"'" >>$src/apaci
echo "echo '-DACCESS_CONFIG_FILE=\"${sysconfdir_relative}access.conf\"'" >>$src/apaci
echo "echo '-DRESOURCE_CONFIG_FILE=\"${sysconfdir_relative}srm.conf\"'" >>$src/apaci
chmod a+x $src/apaci
CFLAGS="$CFLAGS \\\`\$(SRCDIR)/apaci\\\`"
##
## create $src/Configuration.apaci file
##
if [ .$quiet = .no ]; then
echo "Creating Configuration.apaci in $src"
fi
rm -f sedsubst 2>/dev/null
touch sedsubst
# generate settings from imported environment variables
IFS=' '
for var in CC OPTIM CFLAGS CFLAGS_SHLIB LDFLAGS LDFLAGS_SHLIB \
LDFLAGS_SHLIB_EXPORT LIBS INCLUDES RANLIB; do
eval "val=\$$var";
if [ ".$val" != . ]; then
case $var in
CFLAGS|LDFLAGS|LIBS|INCLUDES) var="EXTRA_$var" ;;
esac
echo "s%^#*\\($var=\\).*%\\1$val%g" >>sedsubst
eval "$var="
fi
done
# generate rule directives
IFS=:
for rule in `echo "$rules" | sed -e 's/^://'`; do
name="`echo $rule | tr "a-z" "A-Z"`"
eval "val=\$rule_$rule"
echo "s%^\\(Rule $name=\\).*%\\1$val%g" >>sedsubst
if [ $verbose = yes ]; then
echo " + Rule $name=$val"
fi
done
# consistency checks for shared object support
some_shares=0
IFS=:
for module in `echo "$modules" | sed -e 's/^://'`; do
eval "share=\$shared_$module"
if [ $share = yes ]; then
some_shares=1
fi
done
if [ $some_shares = 1 ]; then
if [ $module_so = no ]; then
module_so=yes
if [ .$quiet = .no ]; then
echo " + enabling mod_so for DSO support"
fi
fi
fi
if [ ".$shared_so" = yes ]; then
shared_so=no
echo "++ Module mod_so cannot be made a shared object"
exit 1
fi
# generate module directives
IFS=:
for module in `echo "$modules" | sed -e 's/^://'`; do
eval "add=\$module_$module"
if [ $add = yes ]; then
echo "s%^.*\\(AddModule.*$module\\..*\\)%\\1%g" >>sedsubst
echo "s%^.*\\(SharedModule.*$module\\..*\\)%\\1%g" >>sedsubst
m="yes [static]"
else
echo "s%^.*\\(AddModule.*$module\\..*\\)%# \\1%g" >>sedsubst
echo "s%^.*\\(SharedModule.*$module\\..*\\)%# \\1%g" >>sedsubst
m=no
fi
eval "share=\$shared_$module"
if [ $share = yes ]; then
echo "s%^\\(.*\\)AddModule\\(.*$module\\.\\)[oa]\\(.*\\)%\\1SharedModule\\2so\\3%g" >>sedsubst
m="yes [shared]"
fi
if [ $verbose = yes ]; then
echo " + Module $module: $m"
fi
done
# and finally translate the config template according to our situation
if [ -f $src/Configuration.apaci ]; then
(cat $src/Configuration.tmpl;
cat $src/Configuration.apaci ) |\
sed -f sedsubst >$src/Configuration.apaci.tmp
cp $src/Configuration.apaci.tmp $src/Configuration.apaci
rm -f $src/Configuration.apaci.tmp
else
cat $src/Configuration.tmpl | sed -f sedsubst >$src/Configuration.apaci
fi
rm -f sedsubst 2>/dev/null
##
## create all other Makefiles by running the proprietary
## $src/Configure script with our custom Configuration.apaci file
##
if [ .$quiet = .yes ]; then
(cd $src; CFLAGS= ./Configure -file Configuration.apaci >/dev/null);
else
(cd $src; CFLAGS= ./Configure -file Configuration.apaci |\
sed -e '/^Using config file:.*/d' \
-e "s:Makefile in :Makefile in $src\\/:" \
-e "s:Makefile\$:Makefile in $src:")
fi