home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1999 April / PCO0499.ISO / filesbbs / os2 / apach134.arj / APACH134.ZIP / configure < prev    next >
Encoding:
Text File  |  1999-01-02  |  46.5 KB  |  1,323 lines

  1. #!/bin/sh
  2. ## ====================================================================
  3. ## Copyright (c) 1998-1999 The Apache Group.  All rights reserved.
  4. ##
  5. ## Redistribution and use in source and binary forms, with or without
  6. ## modification, are permitted provided that the following conditions
  7. ## are met:
  8. ##
  9. ## 1. Redistributions of source code must retain the above copyright
  10. ##    notice, this list of conditions and the following disclaimer. 
  11. ##
  12. ## 2. Redistributions in binary form must reproduce the above copyright
  13. ##    notice, this list of conditions and the following disclaimer in
  14. ##    the documentation and/or other materials provided with the
  15. ##    distribution.
  16. ##
  17. ## 3. All advertising materials mentioning features or use of this
  18. ##    software must display the following acknowledgment:
  19. ##    "This product includes software developed by the Apache Group
  20. ##    for use in the Apache HTTP server project (http://www.apache.org/)."
  21. ##
  22. ## 4. The names "Apache Server" and "Apache Group" must not be used to
  23. ##    endorse or promote products derived from this software without
  24. ##    prior written permission. For written permission, please contact
  25. ##    apache@apache.org.
  26. ##
  27. ## 5. Products derived from this software may not be called "Apache"
  28. ##    nor may "Apache" appear in their names without prior written
  29. ##    permission of the Apache Group.
  30. ##
  31. ## 6. Redistributions of any form whatsoever must retain the following
  32. ##    acknowledgment:
  33. ##    "This product includes software developed by the Apache Group
  34. ##    for use in the Apache HTTP server project (http://www.apache.org/)."
  35. ##
  36. ## THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
  37. ## EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  38. ## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  39. ## PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE APACHE GROUP OR
  40. ## ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  41. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  42. ## NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  43. ## LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  44. ## HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  45. ## STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  46. ## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  47. ## OF THE POSSIBILITY OF SUCH DAMAGE.
  48. ## ====================================================================
  49. ##
  50. ## This software consists of voluntary contributions made by many
  51. ## individuals on behalf of the Apache Group and was originally based
  52. ## on public domain software written at the National Center for
  53. ## Supercomputing Applications, University of Illinois, Urbana-Champaign.
  54. ## For more information on the Apache Group and the Apache HTTP server
  55. ## project, please see <http://www.apache.org/>.
  56. ##
  57.  
  58. ##
  59. ##  configure -- Apache Autoconf-style Interface (APACI) 
  60. ##
  61. ##  Initially written by Ralf S. Engelschall <rse@apache.org>
  62. ##
  63.  
  64. #   default input separator chars: <space><tab><cr>
  65. DIFS='     
  66. '
  67.  
  68. ##
  69. ##  the paths to the Apache source tree
  70. ##
  71. top=.
  72. mkf=Makefile
  73. src=src
  74. aux=src/helpers
  75. sedsubst=src/.apaci.sedsubst
  76. addconf=src/.apaci.addconf
  77. tplconf=src/.apaci.tplconf
  78. pldconf=src/.apaci.pldconf
  79. configlayout=config.layout
  80. configstatus=config.status
  81. shadow=''
  82.  
  83. ##
  84. ##  pre-determine runtime modes
  85. ##
  86. help=no
  87. quiet=no
  88. verbose=no
  89. case "$*" in
  90.     --help|*--help|*--help* ) help=yes; quiet=yes ;;
  91.     --quiet|*--quiet|*--quiet* ) quiet=yes ;;
  92.     --verbose|*--verbose|*--verbose*|-v|*-v|*-v* ) verbose=yes ;;
  93.     * ) ;;
  94. esac
  95.  
  96. ##
  97. ##  display version information
  98. ##
  99. if [ ".$quiet" = .no ]; then
  100.     APV=`cat $src/include/httpd.h |\
  101.          grep "#define SERVER_BASEVERSION" |\
  102.          sed -e 's/^[^"]*"//' -e 's/".*$//' -e 's/^Apache\///'`
  103.     echo "Configuring for Apache, Version $APV"
  104. fi
  105.  
  106. ##
  107. ##  important hint for the first-time users
  108. ##
  109. if [ $# -eq 0 ]; then
  110.     echo " + Warning: Configuring Apache with default settings."
  111.     echo " + This is probably not what you really want."
  112.     echo " + Please read the README.configure and INSTALL files"
  113.     echo " + first or at least run '$0 --help' for"
  114.     echo " + a compact summary of available options."
  115. fi
  116.  
  117. ##
  118. ##  determine path to (optional) Perl interpreter
  119. ##
  120. PERL=no-perl-on-this-system
  121. perlpath="`$aux/PrintPath perl5 perl miniperl`"
  122. if [ ".$perlpath" != . ]; then
  123.     PERL="$perlpath"
  124. fi
  125.  
  126. ##
  127. ##  look for deadly broken echo commands which interpret escape
  128. ##  sequences `\XX' *per default*. For those we first try the -E option
  129. ##  and if it then is still broken we give a warning message.
  130. ##  If it works set the `Safe Echo Option' (SEO) variable.
  131. ##
  132. SEO='' # CHANGE THIS VARIABLE HERE IF YOU HAVE PROBLEMS WITH ECHO!
  133. bytes=`echo $SEO '\1' | wc -c | awk '{ printf("%s", $1); }'`
  134. if [ ".$bytes" != .3 ]; then
  135.     bytes=`echo -E '\1' | wc -c | awk '{ printf("%s", $1); }'`
  136.     if [ ".$bytes" != .3 ]; then
  137.         echo " + Warning: Your 'echo' command is slightly broken."
  138.         echo " + It interprets escape sequences per default. We already"
  139.         echo " + tried 'echo -E' but had no real success. If errors occur"
  140.         echo " + please set the SEO variable in 'configure' manually to"
  141.         echo " + the required 'echo' options, i.e. those which force your"
  142.         echo " + 'echo' to not interpret escape sequences per default."
  143.     else
  144.         SEO='-E'
  145.     fi
  146. fi
  147.  
  148. ##
  149. ##  look for the best Awk we can find because some
  150. ##  standard Awks are really braindead and cause 
  151. ##  problems for our scripts under some platforms.
  152. ##
  153. AWK=awk
  154. awkpath="`$aux/PrintPath nawk gawk awk`"
  155. if [ ".$awkpath" != . ]; then
  156.     AWK="$awkpath"
  157. fi
  158.  
  159. ##
  160. ##  determine default parameters
  161. ##
  162.  
  163. #   default paths
  164. prefix=UNSET
  165.  
  166. #   layout configuration
  167. with_layout=0
  168. show_layout=0
  169.  
  170. #   suexec defaults
  171. suexec=0
  172. suexec_ok=0
  173. suexec_docroot='$datadir/htdocs'
  174. suexec_logexec='$logfiledir/suexec_log'
  175. suexec_caller=www
  176. suexec_userdir=public_html
  177. suexec_uidmin=100
  178. suexec_gidmin=100
  179. suexec_safepath="/usr/local/bin:/usr/bin:/bin"
  180.  
  181. #   various other flags
  182. support=1
  183. confadjust=1
  184. permute=''
  185.  
  186. #   determine rules
  187. rules=''
  188. rulelist=''
  189. OIFS="$IFS" IFS='
  190. '
  191. for rule in `grep '^Rule' $src/Configuration.tmpl`; do
  192.     rule=`echo "$rule" | sed -e 's/^Rule[     ]*//'`
  193.     name=`echo "$rule" | sed -e 's/=.*$//'`
  194.     namelow=`echo "$name" | tr 'A-Z' 'a-z'`
  195.     arg=`echo "$rule" | sed -e 's/^.*=//'`
  196.     eval "rule_$namelow=$arg"
  197.     rules="$rules:$namelow"
  198.     rulelist="$rulelist:$name=$arg"
  199. done
  200. IFS="$OIFS"
  201. rules=`echo $rules | sed -e 's/^://'`
  202.  
  203. #   determine modules
  204. modules=''
  205. modulelist=''
  206. OIFS="$IFS" IFS='
  207. '
  208. for module in `egrep '^[#     ]*(Add|Shared)Module' $src/Configuration.tmpl`; do
  209.     add=yes
  210.     share=no
  211.     if [ ".`echo $module | grep '^#'`" != . ]; then
  212.         add=no
  213.     fi
  214.     if [ ".`echo $module | grep 'SharedModule'`" != . ]; then
  215.         share=yes
  216.     fi
  217.     module=`echo "$module" |\
  218.             sed -e 's%^.*/\(.*\)$%\1%' \
  219.                 -e 's/\.[oa]$//' \
  220.                 -e 's/\.module$//' \
  221.                 -e 's/^mod_//' \
  222.                 -e 's/^lib//'`
  223.     eval "module_$module=$add"
  224.     eval "shared_$module=$share"
  225.     modules="${modules}:$module"
  226.     modulelist="${modulelist}:$module=$add"
  227.     if [ ".$share" = .yes ]; then
  228.         modulelist="${modulelist}*"
  229.     fi
  230. done
  231. IFS="$OIFS"
  232. modules=`echo $modules | sed -e 's/^://'`
  233.  
  234. #   backward compatibility for old src/Configuration.tmpl
  235. #   parameter names to the canonical Autoconf-style shell
  236. #   variable names.
  237. OIFS="$IFS" IFS="$DIFS"
  238. for var in CFLAGS LDFLAGS LIBS INCLUDES DEPS; do
  239.     eval "val=\$EXTRA_$var"
  240.     if [ ".$val" != . ]; then
  241.         eval "$var=\$val"
  242.         eval "EXTRA_$var=\"\"; export EXTRA_$var"
  243.         echo " + Hint: please use $var instead of EXTRA_$var next time"
  244.     fi
  245. done
  246. IFS="$OIFS"
  247.  
  248. ##
  249. ##  support for the default layout
  250. ##
  251. case "$*" in
  252.     *--with-layout=* ) 
  253.         ;;
  254.     * ) 
  255.         if [ ".$*" = . ]; then
  256.             set -- '--with-layout=Apache'
  257.         else
  258.             set -- '--with-layout=Apache' "$@"
  259.         fi
  260.         ;;
  261. esac
  262.  
  263. ##
  264. ##  Iterate over the command line options the first time.
  265. ##
  266. ##  This time we pre-process options which need high priority 
  267. ##  on the command line independent of their position, so they 
  268. ##  can be overridden by others.
  269. ##
  270. apc_prev=''
  271. OIFS1="$IFS" IFS="$DIFS"
  272. for apc_option
  273. do
  274.     #   if previous option needs an argument, assign it.
  275.     if [ ".$apc_prev" != . ]; then
  276.         eval "$apc_prev=\$apc_option"
  277.         apc_prev=""
  278.         continue
  279.     fi
  280.     #   split out arguments
  281.     case "$apc_option" in
  282.         -*=*) apc_optarg=`echo "$apc_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
  283.            *) apc_optarg= ;;
  284.     esac
  285.     #  pre-process only a few options now
  286.     case "$apc_option" in
  287.         --help | -h | -help )
  288.             echo "Usage: configure [options]"
  289.             echo "Options: [defaults in brackets after descriptions]"
  290.             echo "General options:"
  291.             echo " --quiet, --silent      do not print messages"
  292.             echo " --verbose, -v          print even more messages"
  293.             echo " --shadow[=DIR]         switch to a shadow tree (under DIR) for building"
  294.             echo ""
  295.             echo "Stand-alone options:"
  296.             echo " --help, -h             print this message"
  297.             echo " --show-layout          print installation path layout (check and debug)"
  298.             echo ""
  299.             echo "Installation layout options:"
  300.             echo " --with-layout=[F:]ID   use installation path layout ID (from file F)"
  301.             echo " --target=TARGET        install name-associated files using basename TARGET"
  302.             echo " --prefix=PREFIX        install architecture-independent files in PREFIX"
  303.             echo " --exec-prefix=EPREFIX  install architecture-dependent files in EPREFIX"
  304.             echo " --bindir=DIR           install user     executables in DIR"
  305.             echo " --sbindir=DIR          install sysadmin executables in DIR"
  306.             echo " --libexecdir=DIR       install program  executables in DIR"
  307.             echo " --mandir=DIR           install manual pages in DIR"
  308.             echo " --sysconfdir=DIR       install configuration files in DIR"
  309.             echo " --datadir=DIR          install read-only  data files in DIR"
  310.             echo " --includedir=DIR       install includes files in DIR"
  311.             echo " --localstatedir=DIR    install modifiable data files in DIR"
  312.             echo " --runtimedir=DIR       install runtime data in DIR"
  313.             echo " --logfiledir=DIR       install logfile data in DIR"
  314.             echo " --proxycachedir=DIR    install proxy cache data in DIR"
  315.             echo ""
  316.             echo "Configuration options:"
  317.             echo " --enable-rule=NAME     enable  a particular Rule named 'NAME'"
  318.             echo " --disable-rule=NAME    disable a particular Rule named 'NAME'"
  319.             $aux/ppl.sh $rulelist
  320.             echo " --add-module=FILE      on-the-fly copy & activate a 3rd-party Module"
  321.             echo " --activate-module=FILE on-the-fly activate existing 3rd-party Module"
  322.             echo " --permute-module=N1:N2 on-the-fly permute module 'N1' with module 'N2'"
  323.             echo " --enable-module=NAME   enable  a particular Module named 'NAME'"
  324.             echo " --disable-module=NAME  disable a particular Module named 'NAME'"
  325.             $aux/ppl.sh $modulelist
  326.             echo " --enable-shared=NAME   enable  build of Module named 'NAME' as a DSO"
  327.             echo " --disable-shared=NAME  disable build of Module named 'NAME' as a DSO"
  328.             echo " --with-perl=FILE       path to the optional Perl interpreter"
  329.             echo " --without-support      disable the build and installation of support tools"
  330.             echo " --without-confadjust   disable the user/situation adjustments in config"
  331.             echo ""
  332.             echo "suEXEC options:"
  333.             echo " --enable-suexec        enable the suEXEC feature"
  334.             echo " --suexec-caller=NAME   set the suEXEC username of the allowed caller [$suexec_caller]"
  335.             echo " --suexec-docroot=DIR   set the suEXEC root directory [PREFIX/share/htdocs]"
  336.             echo " --suexec-logfile=FILE  set the suEXEC logfile [PREFIX/var/log/suexec_log]"
  337.             echo " --suexec-userdir=DIR   set the suEXEC user subdirectory [$suexec_userdir]"
  338.             echo " --suexec-uidmin=UID    set the suEXEC minimal allowed UID [$suexec_uidmin]"
  339.             echo " --suexec-gidmin=GID    set the suEXEC minimal allowed GID [$suexec_gidmin]"
  340.             echo " --suexec-safepath=PATH set the suEXEC safe PATH [$suexec_safepath]"
  341.             echo ""
  342.             echo "Deprecated options:"
  343.             echo " --layout               backward compat only: use --show-layout"
  344.             echo " --compat               backward compat only: use --with-layout=Apache"
  345.             exit 0
  346.             ;;
  347.         --with-layout=*|--compat)
  348.             if [ ".$apc_option" = ".--compat" ]; then
  349.                 apc_optarg="Apache"
  350.             fi
  351.             case $apc_optarg in
  352.                 *:* ) 
  353.                     file=`echo $apc_optarg | sed -e 's/:.*//'`
  354.                     name=`echo $apc_optarg | sed -e 's/.*://'`
  355.                     ;;
  356.                 * ) 
  357.                     name=$apc_optarg
  358.                     file=$configlayout
  359.                     ;;
  360.             esac
  361.             if [ ! -f "$file" ]; then
  362.                 echo "configure:Error: Path layout definition file $file not found" 1>&2
  363.                 exit 1
  364.             fi
  365.             sed -e "1,/[     ]*<[Ll]ayout[     ]*$name[     ]*>[     ]*/d" \
  366.                 -e '/[     ]*<\/Layout>[     ]*/,$d' \
  367.                 -e "s/^[     ]*//g" \
  368.                 -e "s/:[     ]*/=\'/g" \
  369.                 -e "s/[     ]*$/'/g" \
  370.                 $file >$pldconf
  371.             . $pldconf
  372.             OIFS="$IFS" IFS="$DIFS"
  373.             for var in prefix exec_prefix bindir sbindir libexecdir mandir \
  374.                        sysconfdir datadir includedir localstatedir runtimedir \
  375.                        logfiledir proxycachedir; do
  376.                 eval "val=\"\$$var\""
  377.                 case $val in
  378.                     *+ )
  379.                         val=`echo $val | sed -e 's;\+$;;'`
  380.                         eval "$var=\"\$val\""
  381.                         eval "autosuffix_$var=yes"
  382.                         ;;
  383.                     * )
  384.                         eval "autosuffix_$var=no"
  385.                         ;;
  386.                 esac
  387.             done
  388.             IFS="$OIFS"
  389.             rm -f $pldconf 2>/dev/null
  390.             if [ ".$prefix" = .UNSET ]; then
  391.                 echo "configure:Error: Path layout definition not found or incorrect" 1>&2
  392.                 exit 1
  393.             fi
  394.             if [ ".$quiet" = .no ]; then
  395.                 echo " + using installation path layout: $name ($file)"
  396.             fi
  397.             with_layout=1
  398.             ;;
  399.         *)
  400.             ;;
  401.     esac
  402. done
  403.  
  404. ##
  405. ##  Iterate over the command line options the second time.
  406. ##
  407. ##  This time we parse the standard options.
  408. ##
  409. addconf_created=0
  410. apc_prev=''
  411. OIFS1="$IFS" IFS="$DIFS"
  412. for apc_option
  413. do
  414.     #   if previous option needs an argument, assign it.
  415.     if [ ".$apc_prev" != . ]; then
  416.         eval "$apc_prev=\$apc_option"
  417.         apc_prev=""
  418.         continue
  419.     fi
  420.     #   split out arguments
  421.     case "$apc_option" in
  422.         -*=*) apc_optarg=`echo "$apc_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
  423.            *) apc_optarg= ;;
  424.     esac
  425.     #  accept only the most important GNU Autoconf-style options
  426.     case "$apc_option" in
  427.         --help|-h|-help|--with-layout=*|-compat)
  428.             #   just ignore already parsed options
  429.             ;;
  430.         --quiet | --silent) 
  431.             quiet=yes
  432.             ;;
  433.         --verbose | -v)
  434.             verbose=yes
  435.             ;;
  436.         --shadow*)
  437.             #   if we use an external shadow tree, first shadow all of ourself
  438.             #   to this tree and switch over to to it for internal (=platform)
  439.             #   shadowing...
  440.             case "$apc_option" in
  441.                 --shadow=*)
  442.                     shadow="$apc_optarg"
  443.                     if [ .$quiet = .no ]; then
  444.                         echo " + creating external package shadow tree ($shadow)"
  445.                     fi
  446.                     rm -rf $shadow 2>/dev/null
  447.                     $aux/mkshadow.sh . $shadow
  448.                     for file in $mkf $sedsubst $addconf $tplconf $pldconf $configstatus; do
  449.                         rm -f $shadow/$file 2>/dev/null
  450.                     done
  451.                     if [ .$quiet = .no ]; then
  452.                         echo " + switching to external package shadow tree ($shadow)"
  453.                     fi
  454.                     cd $shadow
  455.                     ;;
  456.             esac
  457.             #   determine GNU platform triple
  458.             gnutriple=`$aux/GuessOS | sed -e 's:/:-:g' | $AWK '{ printf("%s",$1); }'`
  459.             #   create Makefile wrapper (the first time only)
  460.             if [ ".`ls $top/src.* 2>/dev/null`" = . ]; then
  461.                 if [ .$quiet = .no ]; then
  462.                     echo " + creating Makefile (shadow wrapper)"
  463.                 fi
  464.                 echo "##" > Makefile
  465.                 echo "##  Apache Makefile (shadow wrapper)" >> Makefile
  466.                 echo "##" >> Makefile
  467.                 echo "" >> Makefile
  468.                 if [ ".$shadow" != . ]; then
  469.                     echo "SHADOW=$shadow" >> Makefile
  470.                 else
  471.                     echo "SHADOW=." >> Makefile
  472.                 fi
  473.                 echo "GNUTRIPLE=\`$aux/GuessOS | sed -e 's:/:-:g' | $AWK '{ printf(\"%s\",\$\$1); }'\`" >> Makefile
  474.                 echo "" >> Makefile
  475.                 echo "all build install install-quiet clean distclean:" >> Makefile
  476.                 echo "    @cd \$(SHADOW); \$(MAKE) -f Makefile.\$(GNUTRIPLE) \$(MFLAGS) \$@" >> Makefile
  477.                 echo "" >> Makefile
  478.             fi
  479.             #   set shadow paths
  480.             shadowmkf="Makefile.$gnutriple"
  481.             shadowsrc="src.$gnutriple"
  482.             shadowaux="src.$gnutriple/helpers"
  483.             shadowsedsubst="src.$gnutriple/.apaci.sedsubst"
  484.             shadowaddconf="src.$gnutriple/.apaci.addconf"
  485.             shadowtplconf="src.$gnutriple/.apaci.tplconf"
  486.             #   (re)create shadow tree
  487.             if [ .$quiet = .no ]; then
  488.                 echo " + creating internal platform shadow tree ($shadowsrc)"
  489.             fi
  490.             rm -rf $shadowsrc
  491.             $aux/mkshadow.sh $src $shadowsrc
  492.             #   delegate us to the shadow paths
  493.             mkf=$shadowmkf
  494.             src=$shadowsrc
  495.             aux=$shadowaux
  496.             sedsubst=$shadowsedsubst
  497.             addconf=$shadowaddconf
  498.             tplconf=$shadowtplconf
  499.             ;;
  500.         --show-layout|--layout)
  501.             show_layout=1
  502.             ;;
  503.         --target=*)
  504.             TARGET="$apc_optarg"
  505.             ;;
  506.         --prefix=*)
  507.             prefix="$apc_optarg"
  508.             autosuffix_prefix=no
  509.             ;;
  510.         --exec-prefix=*)
  511.             exec_prefix="$apc_optarg"
  512.             autosuffix_exec_prefix=no
  513.             ;;
  514.         --bindir=*)       
  515.             bindir="$apc_optarg"
  516.             autosuffix_bindir=no
  517.             ;;
  518.         --sbindir=*)       
  519.             sbindir="$apc_optarg"
  520.             autosuffix_sbindir=no
  521.             ;;
  522.         --libexecdir=*)
  523.             libexecdir="$apc_optarg"    
  524.             autosuffix_libexecdir=no
  525.             ;;
  526.         --mandir=*)        
  527.             mandir="$apc_optarg"        
  528.             autosuffix_mandir=no
  529.             ;;
  530.         --sysconfdir=*)    
  531.             sysconfdir="$apc_optarg"    
  532.             autosuffix_sysconfdir=no
  533.             ;;
  534.         --datadir=*)       
  535.             datadir="$apc_optarg"       
  536.             autosuffix_datadir=no
  537.             ;;
  538.         --includedir=*)       
  539.             includedir="$apc_optarg"       
  540.             autosuffix_includedir=no
  541.             ;;
  542.         --localstatedir=*) 
  543.             localstatedir="$apc_optarg" 
  544.             autosuffix_localstatedir=no
  545.             ;;
  546.         --runtimedir=*) 
  547.             runtimedir="$apc_optarg" 
  548.             autosuffix_runtimedir=no
  549.             ;;
  550.         --logfiledir=*) 
  551.             logfiledir="$apc_optarg" 
  552.             autosuffix_logfiledir=no
  553.             ;;
  554.         --proxycachedir=*) 
  555.             proxycachedir="$apc_optarg" 
  556.             autosuffix_proxycachedir=no
  557.             ;;
  558.         --add-module=*) 
  559.             file="$apc_optarg"
  560.             if [ ".`echo $file | egrep '/?mod_[a-zA-Z0-9][a-zA-Z0-9_]*\.c$'`" = . ]; then
  561.                 echo "configure:Error: Module filename doesn't match '/?mod_[a-zA-Z0-9][a-zA-Z0-9_]*\.c'" 1>&2
  562.                 exit 1
  563.             fi
  564.             if [ ! -f $file ]; then
  565.                 echo "configure:Error: Module source $file not found" 1>&2
  566.                 exit 1
  567.             fi
  568.             modfilec=`echo $file | sed -e 's;^.*/;;'`
  569.             modfileo=`echo $file | sed -e 's;^.*/;;' -e 's;\.c$;.o;'`
  570.             if [ ".$file" != ".$src/modules/extra/$modfilec" ]; then
  571.                 cp $file $src/modules/extra/$modfilec
  572.             fi
  573.             if [ ".$addconf_created" = .0 ]; then
  574.                 addconf_created=1
  575.                 rm -f $addconf 2>/dev/null
  576.                 touch $addconf 2>/dev/null
  577.             fi
  578.             echo "" >>$addconf
  579.             echo "## On-the-fly added module" >>$addconf
  580.             echo "## (configure --add-module=$file)" >>$addconf
  581.             echo "AddModule modules/extra/$modfileo" >>$addconf
  582.             module=`echo "$modfileo" |\
  583.                     sed -e 's%^.*/\(.*\)$%\1%' \
  584.                         -e 's/\.[^.]*$//' \
  585.                         -e 's/^mod_//' \
  586.                         -e 's/^lib//'`
  587.             eval "module_$module=yes"
  588.             eval "shared_$module=no"
  589.             modules="${modules}:$module"
  590.             modulelist="${modulelist}:$module=yes"
  591.             if [ ".$quiet" = .no ]; then
  592.                 echo " + on-the-fly added and activated $module module (modules/extra/$modfileo)"
  593.             fi
  594.             ;;
  595.         --activate-module=*) 
  596.             file="$apc_optarg"
  597.             case $file in
  598.                 src/modules/* ) ;;
  599.                 *)  echo "configure:Error: Module source already has to stay below src/modules/ to be activated" 1>&2
  600.                     exit 1
  601.                     ;;
  602.             esac
  603.             modfile=`echo $file | sed -e 's;^src/;;'`
  604.             if [ ".$addconf_created" = .0 ]; then
  605.                 addconf_created=1
  606.                 rm -f $addconf 2>/dev/null
  607.                 touch $addconf 2>/dev/null
  608.             fi
  609.             echo "" >>$addconf
  610.             echo "## On-the-fly activated module" >>$addconf
  611.             echo "## (configure --activate-module=$file)" >>$addconf
  612.             echo "AddModule $modfile" >>$addconf
  613.             module=`echo "$modfile" |\
  614.                     sed -e 's%^.*/\(.*\)$%\1%' \
  615.                         -e 's/\.[^.]*$//' \
  616.                         -e 's/^mod_//' \
  617.                         -e 's/^lib//'`
  618.             eval "module_$module=yes"
  619.             eval "shared_$module=no"
  620.             modules="${modules}:$module"
  621.             modulelist="${modulelist}:$module=yes"
  622.             if [ ".$quiet" = .no ]; then
  623.                 echo " + activated $module module ($modfile)"
  624.             fi
  625.             ;;
  626.         --enable-*)
  627.             apc_feature=`echo $apc_option | sed -e 's/-*enable-//' -e 's/=.*//'`
  628.             apc_feature=`echo $apc_feature | sed 's/-/_/g'`
  629.             case "$apc_option" in
  630.                 *=*) ;;
  631.                   *) apc_optarg=yes ;;
  632.             esac
  633.             case "$apc_feature" in
  634.                 rule   )
  635.                     apc_optarg=`echo "$apc_optarg" | tr "A-Z" "a-z"`
  636.                     apc_optarg_real=`echo "$apc_optarg" | tr "a-z" "A-Z"`
  637.                     eval "exists=\$rule_${apc_optarg}" 
  638.                     if [ ".$exists" = . ]; then
  639.                         echo "configure:Error: No such rule named '${apc_optarg_real}'" 1>&2
  640.                         exit 1
  641.                     fi
  642.                     eval "rule_${apc_optarg}=yes"
  643.                     ;;
  644.                 module ) 
  645.                     case $apc_optarg in
  646.                        all ) 
  647.                            OIFS="$IFS" IFS=':'
  648.                            for module in $modules; do
  649.                                eval "module_${module}=yes" 
  650.                            done
  651.                            IFS="$OIFS"
  652.                            ;;
  653.                        most ) 
  654.                            OIFS="$IFS" IFS=':'
  655.                            for module in $modules; do
  656.                                eval "module_${module}=yes" 
  657.                            done
  658.                            IFS="$OIFS"
  659.                            module_auth_db=no     # not all platforms have -ldb
  660.                            module_mmap_static=no # not all platforms have mmap()
  661.                            module_so=no          # not all platforms have dlopen()
  662.                            module_example=no     # only for developers
  663.                            module_log_agent=no   # deprecated
  664.                            module_log_referer=no # deprecated
  665.                            ;;
  666.                        * ) 
  667.                            eval "exists=\$module_${apc_optarg}" 
  668.                            if [ ".$exists" = . ]; then
  669.                                echo "configure:Error: No such module named '${apc_optarg}'" 1>&2
  670.                                exit 1
  671.                            fi
  672.                            eval "module_${apc_optarg}=yes" 
  673.                            ;;
  674.                     esac
  675.                     ;;
  676.                 shared ) 
  677.                     case $apc_optarg in
  678.                        max ) 
  679.                            OIFS="$IFS" IFS=':'
  680.                            for module in $modules; do
  681.                                eval "shared_${module}=yes" 
  682.                            done
  683.                            IFS="$OIFS"
  684.                            shared_so=no        # because of bootstrapping
  685.                            ;;
  686.                        remain ) 
  687.                            OIFS="$IFS" IFS=':'
  688.                            for module in $modules; do
  689.                                eval "add=\$module_${module}" 
  690.                                if [ ".$add" = .no ]; then
  691.                                    eval "module_${module}=yes" 
  692.                                    eval "shared_${module}=yes" 
  693.                                fi
  694.                            done
  695.                            IFS="$OIFS"
  696.                            shared_so=no
  697.                            ;;
  698.                        * ) 
  699.                            eval "exists=\$module_${apc_optarg}" 
  700.                            if [ ".$exists" = . ]; then
  701.                                echo "configure:Error: No such module named '${apc_optarg}'" 1>&2
  702.                                exit 1
  703.                            fi
  704.                            eval "shared_${apc_optarg}=yes" 
  705.                            ;;
  706.                     esac
  707.                     ;;
  708.                 suexec ) 
  709.                     suexec=1
  710.                     ;;
  711.             esac
  712.             ;;
  713.         --disable-*)
  714.             apc_feature=`echo $apc_option | sed -e 's/-*disable-//' -e 's/=.*//'`
  715.             apc_feature=`echo $apc_feature| sed 's/-/_/g'`
  716.             case "$apc_option" in
  717.                 *=*) ;;
  718.                   *) apc_optarg=yes ;;
  719.             esac
  720.             case "$apc_feature" in
  721.                 rule   ) 
  722.                     apc_optarg=`echo "$apc_optarg" | tr "A-Z" "a-z"`
  723.                     apc_optarg_real=`echo "$apc_optarg" | tr "a-z" "A-Z"`
  724.                     eval "exists=\$rule_${apc_optarg}" 
  725.                     if [ ".$exists" = . ]; then
  726.                         echo "configure:Error: No such rule named '${apc_optarg_real}'" 1>&2
  727.                         exit 1
  728.                     fi
  729.                     eval "rule_${apc_optarg}=no"
  730.                     ;;
  731.                 module )
  732.                     case $apc_optarg in
  733.                        all ) 
  734.                            OIFS="$IFS" IFS=':'
  735.                            for module in $modules; do
  736.                                eval "module_${module}=no" 
  737.                            done
  738.                            IFS="$OIFS"
  739.                            ;;
  740.                        * ) 
  741.                            eval "exists=\$module_${apc_optarg}" 
  742.                            if [ ".$exists" = . ]; then
  743.                                echo "configure:Error: No such module named '${apc_optarg}'" 1>&2
  744.                                exit 1
  745.                            fi
  746.                            eval "module_${apc_optarg}=no" 
  747.                            ;;
  748.                     esac
  749.                     ;;
  750.                 shared )
  751.                     case $apc_optarg in
  752.                        all ) 
  753.                            OIFS="$IFS" IFS=':'
  754.                            for module in $modules; do
  755.                                eval "shared_${module}=no" 
  756.                            done
  757.                            IFS="$OIFS"
  758.                            ;;
  759.                        * ) 
  760.                            eval "exists=\$module_${apc_optarg}" 
  761.                            if [ ".$exists" = . ]; then
  762.                                echo "configure:Error: No such module named '${apc_optarg}'" 1>&2
  763.                                exit 1
  764.                            fi
  765.                            eval "shared_${apc_optarg}=no" 
  766.                            ;;
  767.                     esac
  768.                     ;;
  769.             esac
  770.             ;;
  771.         --permute-module=*:*)
  772.             mod1=`echo $apc_optarg | sed -e 's/:.*//'`
  773.             mod2=`echo $apc_optarg | sed -e 's/.*://'`
  774.             for mod in $mod1 $mod2; do
  775.                 case $mod in
  776.                     BEGIN|END)
  777.                         ;;
  778.                     *)  eval "exists=\$module_${mod}" 
  779.                         if [ ".$exists" = . ]; then
  780.                             echo "configure:Error: No such module named '${mod}'" 1>&2
  781.                             exit 1
  782.                         fi
  783.                         ;;
  784.                 esac
  785.             done
  786.             case $mod1:$mod2 in
  787.                 BEGIN:END|*:BEGIN|END:*)
  788.                     echo "configure:Error: Invalid combination of pseudo module identifiers" 1>&2
  789.                     exit 1
  790.                     ;;
  791.             esac
  792.             permute="${permute},${mod1}:${mod2}"
  793.             ;;
  794.         --with-perl=*)
  795.             PERL="$apc_optarg"
  796.             ;;
  797.         --without-support)
  798.             support=0
  799.             ;;
  800.         --without-confadjust)
  801.             confadjust=0
  802.             ;;
  803.         --suexec-caller=*)
  804.             suexec_caller="$apc_optarg"
  805.             suexec_ok=1
  806.             ;;
  807.         --suexec-docroot=*)
  808.             suexec_docroot="$apc_optarg"
  809.             suexec_ok=1
  810.             ;;
  811.         --suexec-logfile=*)
  812.             suexec_logexec="$apc_optarg"
  813.             suexec_ok=1
  814.             ;;
  815.         --suexec-userdir=*)
  816.             suexec_userdir="$apc_optarg"
  817.             suexec_ok=1
  818.             ;;
  819.         --suexec-uidmin=*)
  820.             suexec_uidmin="$apc_optarg"
  821.             suexec_ok=1
  822.             ;;
  823.         --suexec-gidmin=*)
  824.             suexec_gidmin="$apc_optarg"
  825.             suexec_ok=1
  826.             ;;
  827.         --suexec-safepath=*)
  828.             suexec_safepath="$apc_optarg"
  829.             suexec_ok=1
  830.             ;;
  831.         * )
  832.             echo "configure:Error: invalid option '$apc_option'" 1>&2
  833.             exit 1
  834.             ;;
  835.     esac
  836. done
  837. IFS="$OIFS1"
  838. if [ ".$apc_prev" != . ]; then
  839.     echo "configure:Error: missing argument to --`echo $apc_prev | sed 's/_/-/g'`" 1>&2
  840.     exit 1
  841. fi
  842. if [ ".$addconf_created" = .0 ]; then
  843.     rm -f $addconf 2>/dev/null
  844.     touch $addconf 2>/dev/null
  845. fi
  846.  
  847. ##
  848. ##   create a config status script for restoring
  849. ##   the configuration via a simple shell script
  850. ##
  851. rm -f $configstatus 2>/dev/null
  852. echo "#!/bin/sh" >$configstatus
  853. echo "##" >>$configstatus
  854. echo "##  $configstatus -- APACI auto-generated configuration restore script" >>$configstatus
  855. echo "##" >>$configstatus
  856. echo "##  Use this shell script to re-run the APACI configure script for" >>$configstatus
  857. echo "##  restoring your configuration. Additional parameters can be supplied." >>$configstatus
  858. echo "##" >>$configstatus
  859. echo "" >>$configstatus
  860. for var in CC CPP OPTIM CFLAGS CFLAGS_SHLIB LDFLAGS LD_SHLIB LDFLAGS_SHLIB \
  861.            LDFLAGS_SHLIB_EXPORT LIBS INCLUDES RANLIB DEPS TARGET; do
  862.     eval "val=\"\$$var\""
  863.     if [ ".$val" != . ]; then
  864.         echo "$var=$val" |\
  865.         sed -e 's:\(["$\\]\):\\\1:g' \
  866.             -e 's:\([A-Z]*=\):\1":' \
  867.             -e 's:$:" \\:' >>$configstatus
  868.     fi
  869. done
  870. echo $SEO "./configure \\" >>$configstatus
  871. for arg
  872. do
  873.     echo "$arg" |\
  874.     sed -e 's:\(["$\\]\):\\\1:g' \
  875.         -e 's:^:":' \
  876.         -e 's:$:" \\:' >>$configstatus
  877. done
  878. echo '"$@"' >>$configstatus
  879. echo '' >>$configstatus
  880. chmod a+x $configstatus
  881.  
  882. ##
  883. ##  a few errors and warnings
  884. ##
  885. if [ ".$suexec" = .1 ]; then
  886.     if [ ".$suexec_ok" = .0 ]; then
  887.         echo "configure:Error: You enabled the suEXEC feature via --enable-suexec but"
  888.         echo "                 without explicitly configuring it via at least one"
  889.         echo "                 --suexec-xxxxx option. Seems like you are still not"
  890.         echo "                 familiar with the suEXEC risks. Please read the INSTALL"
  891.         echo "                 and htdocs/manual/suexec.html documents first."
  892.         exit 1
  893.     fi
  894.     if [ ".`id | grep root`" = . ]; then
  895.         echo " + Warning: You enabled the suEXEC feature. Be aware that you need" 1>&2
  896.         echo " + root privileges for this, at the latest at the installation step." 1>&2
  897.     fi
  898. fi
  899. if [ ".$PERL" = .no-perl-on-this-system ]; then
  900.     if [ .$quiet = .no ]; then
  901.         echo " + Warning: no Perl interpreter available for support scripts."
  902.         echo " + Perhaps you have to select one with --with-perl=FILE."
  903.     fi
  904. fi
  905.  
  906. ##
  907. ##  target name
  908. ##
  909. if [ ".$TARGET" != . ]; then
  910.     thetarget=$TARGET
  911. else
  912.     thetarget=httpd
  913. fi
  914.  
  915. ##
  916. ##  expand path variables and make sure
  917. ##  they do not end with a backslash
  918. ##
  919. OIFS="$IFS" IFS="$DIFS"
  920. for var in prefix exec_prefix bindir sbindir libexecdir mandir \
  921.            sysconfdir datadir includedir localstatedir runtimedir \
  922.            logfiledir proxycachedir suexec_docroot suexec_logexec; do
  923.     eval "val=\"\$$var\"";
  924.     val=`echo $val | sed -e 's:/*$::'`
  925.     eval "$var=\"$val\""
  926.     #   expand value
  927.     eval "val=\$$var"
  928.     #   add target suffix when requested
  929.     if [ ".`echo $val | grep $thetarget`" = . ]; then
  930.         eval "autosuffix=\$autosuffix_$var"
  931.         if [ ".$autosuffix" = .yes ]; then
  932.             eval "$var=\"\$$var/$thetarget\""
  933.         fi
  934.     fi
  935. done
  936. IFS="$OIFS"
  937.  
  938. ##
  939. ##  determine special configurable Makefile targets
  940. ##
  941. if [ ".$support" = .1 ]; then
  942.     build_support='build-support'
  943.     install_support='install-support'
  944.     clean_support='clean-support'
  945.     distclean_support='distclean-support'
  946. else
  947.     build_support=''
  948.     install_support=''
  949.     clean_support=''
  950.     distclean_support=''
  951. fi
  952.  
  953. ##
  954. ##  determine special configuration parameters
  955. ##
  956. conf_group="#-1"
  957. conf_port="80"
  958. conf_serveradmin="you@your.address"
  959. conf_servername="new.host.name"
  960. if [ ".$confadjust" = .1 ]; then
  961.     if [ ".`egrep '^nobody:' /etc/group`" != . ]; then
  962.         conf_group="nobody"
  963.     else
  964.         if [ ".`egrep '^nogroup:' /etc/group`" != . ]; then
  965.             conf_group="nogroup"
  966.         fi
  967.     fi
  968.     if [ ".`id | grep root`" = . ]; then
  969.         conf_port="8080"
  970.     fi
  971.     conf_serveradmin="`$aux/buildinfo.sh -n %u@%h%d`"
  972.     conf_servername="`$aux/buildinfo.sh -n %h%d`"
  973. fi
  974.  
  975. ##
  976. ##  determine prefix-relative paths for directories
  977. ##  because Apache supports them for the -d and -f 
  978. ##  options, the LoadModule directive, etc.
  979. ##
  980. ##  [we have to make sure that it ends with a slash
  981. ##   or we cannot support the case where the relative
  982. ##   path is just the emtpy one, i.e. ""]
  983. ##
  984. runtimedir_relative=`echo $runtimedir | sed -e "s:^$prefix/*::" -e 's:\(.\)$:\1/:'`
  985. logfiledir_relative=`echo $logfiledir | sed -e "s:^$prefix/*::" -e 's:\(.\)$:\1/:'`
  986. sysconfdir_relative=`echo $sysconfdir | sed -e "s:^$prefix/*::" -e 's:\(.\)$:\1/:'`
  987. libexecdir_relative=`echo $libexecdir | sed -e "s:^$prefix/*::" -e 's:\(.\)$:\1/:'`
  988.  
  989. ##
  990. ##  check and debug
  991. ##
  992. if [ ".$show_layout" = .1 ]; then
  993.     echo ""
  994.     echo "Installation paths:"
  995.     echo "               prefix: $prefix"
  996.     echo "          exec_prefix: $exec_prefix" 
  997.     echo "               bindir: $bindir" 
  998.     echo "              sbindir: $sbindir" 
  999.     echo "           libexecdir: $libexecdir" 
  1000.     echo "               mandir: $mandir" 
  1001.     echo "           sysconfdir: $sysconfdir" 
  1002.     echo "              datadir: $datadir" 
  1003.     echo "           includedir: $includedir" 
  1004.     echo "        localstatedir: $localstatedir" 
  1005.     echo "           runtimedir: $runtimedir" 
  1006.     echo "           logfiledir: $logfiledir" 
  1007.     echo "        proxycachedir: $proxycachedir" 
  1008.     echo ""
  1009.     echo "Compilation paths:"
  1010.     echo "           HTTPD_ROOT: $prefix"
  1011.     echo "      SHARED_CORE_DIR: $libexecdir"
  1012.     echo "       DEFAULT_PIDLOG: ${runtimedir_relative}${thetarget}.pid"
  1013.     echo "   DEFAULT_SCOREBOARD: ${runtimedir_relative}${thetarget}.scoreboard"
  1014.     echo "     DEFAULT_LOCKFILE: ${runtimedir_relative}${thetarget}.lock"
  1015.     echo "      DEFAULT_XFERLOG: ${logfiledir_relative}access_log"
  1016.     echo "     DEFAULT_ERRORLOG: ${logfiledir_relative}error_log"
  1017.     echo "    TYPES_CONFIG_FILE: ${sysconfdir_relative}mime.types"
  1018.     echo "   SERVER_CONFIG_FILE: ${sysconfdir_relative}${thetarget}.conf"
  1019.     echo "   ACCESS_CONFIG_FILE: ${sysconfdir_relative}access.conf"
  1020.     echo " RESOURCE_CONFIG_FILE: ${sysconfdir_relative}srm.conf"
  1021.     echo ""
  1022.     if [ ".$suexec" = .1 ]; then
  1023.         echo "suEXEC setup:"
  1024.         echo "        suexec binary: $sbindir/suexec"
  1025.         echo "        document root: $suexec_docroot"
  1026.         echo "       userdir suffix: $suexec_userdir"
  1027.         echo "              logfile: $suexec_logexec"
  1028.         echo "            safe path: $suexec_safepath"
  1029.         echo "            caller ID: $suexec_caller"
  1030.         echo "      minimum user ID: $suexec_uidmin"
  1031.         echo "     minimum group ID: $suexec_gidmin"
  1032.         echo ""
  1033.     fi
  1034.     exit 0
  1035. fi
  1036.  
  1037. ##
  1038. ##  create Makefile from Makefile.tmpl
  1039. ##
  1040. if [ .$quiet = .no ]; then
  1041.     echo "Creating $mkf"
  1042. fi
  1043. sed <Makefile.tmpl >$mkf \
  1044. -e "s%@PERL@%$PERL%g" \
  1045. -e "s%@SRC@%$src%g" \
  1046. -e "s%@MKF@%$mkf%g" \
  1047. -e "s%@AUX@%$aux%g" \
  1048. -e "s%@TARGET@%$thetarget%g" \
  1049. -e "s%@prefix@%$prefix%g" \
  1050. -e "s%@exec_prefix@%$exec_prefix%g" \
  1051. -e "s%@bindir@%$bindir%g" \
  1052. -e "s%@sbindir@%$sbindir%g" \
  1053. -e "s%@libexecdir@%$libexecdir%g" \
  1054. -e "s%@libexecdir_relative@%$libexecdir_relative%g" \
  1055. -e "s%@mandir@%$mandir%g" \
  1056. -e "s%@sysconfdir@%$sysconfdir%g" \
  1057. -e "s%@datadir@%$datadir%g" \
  1058. -e "s%@localstatedir@%$localstatedir%g" \
  1059. -e "s%@includedir@%$includedir%g" \
  1060. -e "s%@runtimedir@%$runtimedir%g" \
  1061. -e "s%@logfiledir@%$logfiledir%g" \
  1062. -e "s%@proxycachedir@%$proxycachedir%g" \
  1063. -e "s%@suexec@%$suexec%g" \
  1064. -e "s%@suexec_caller@%$suexec_caller%g" \
  1065. -e "s%@suexec_docroot@%$suexec_docroot%g" \
  1066. -e "s%@suexec_logexec@%$suexec_logexec%g" \
  1067. -e "s%@suexec_userdir@%$suexec_userdir%g" \
  1068. -e "s%@suexec_uidmin@%$suexec_uidmin%g" \
  1069. -e "s%@suexec_gidmin@%$suexec_gidmin%g" \
  1070. -e "s%@suexec_safepath@%$suexec_safepath%g" \
  1071. -e "s%@conf_group@%$conf_group%g" \
  1072. -e "s%@conf_port@%$conf_port%g" \
  1073. -e "s%@conf_serveradmin@%$conf_serveradmin%g" \
  1074. -e "s%@conf_servername@%$conf_servername%g" \
  1075. -e "s%@build_support@%$build_support%g" \
  1076. -e "s%@install_support@%$install_support%g" \
  1077. -e "s%@clean_support@%$clean_support%g" \
  1078. -e "s%@distclean_support@%$distclean_support%g"
  1079.  
  1080. ##
  1081. ##  override default paths in $src/include/httpd.h
  1082. ##  via command line arguments for the compiler
  1083. ##  supplied by a little shell script named $src/apaci
  1084. ##
  1085. echo "#!/bin/sh" >$src/apaci
  1086. echo "## USED AS A COMMAND LINE EXPANDER TO OVERRIDE PATHS" >>$src/apaci
  1087. echo "## WITHOUT DISTURBING THE KNOWN MAKE BUILD PROCESS DISPLAY" >>$src/apaci
  1088. echo "echo '-DHTTPD_ROOT=\"$prefix\"'" >>$src/apaci
  1089. echo "echo '-DSUEXEC_BIN=\"$sbindir/suexec\"'" >>$src/apaci
  1090. echo "echo '-DSHARED_CORE_DIR=\"$libexecdir\"'" >>$src/apaci
  1091. echo "echo '-DDEFAULT_PIDLOG=\"${runtimedir_relative}${thetarget}.pid\"'" >>$src/apaci
  1092. echo "echo '-DDEFAULT_SCOREBOARD=\"${runtimedir_relative}${thetarget}.scoreboard\"'" >>$src/apaci
  1093. echo "echo '-DDEFAULT_LOCKFILE=\"${runtimedir_relative}${thetarget}.lock\"'" >>$src/apaci
  1094. echo "echo '-DDEFAULT_XFERLOG=\"${logfiledir_relative}access_log\"'" >>$src/apaci
  1095. echo "echo '-DDEFAULT_ERRORLOG=\"${logfiledir_relative}error_log\"'" >>$src/apaci
  1096. echo "echo '-DTYPES_CONFIG_FILE=\"${sysconfdir_relative}mime.types\"'" >>$src/apaci
  1097. echo "echo '-DSERVER_CONFIG_FILE=\"${sysconfdir_relative}${thetarget}.conf\"'" >>$src/apaci
  1098. echo "echo '-DACCESS_CONFIG_FILE=\"${sysconfdir_relative}access.conf\"'" >>$src/apaci
  1099. echo "echo '-DRESOURCE_CONFIG_FILE=\"${sysconfdir_relative}srm.conf\"'" >>$src/apaci
  1100. chmod a+x $src/apaci
  1101. CFLAGS="$CFLAGS \\\`\$(SRCDIR)/apaci\\\`"
  1102.  
  1103. ##
  1104. ##  create $src/Configuration.apaci file
  1105. ##
  1106. if [ .$quiet = .no ]; then
  1107.     echo "Creating Configuration.apaci in $src"
  1108. fi
  1109. rm -f $sedsubst 2>/dev/null
  1110. touch $sedsubst
  1111.  
  1112. #   generate settings from imported environment variables
  1113. OIFS="$IFS" IFS="$DIFS"
  1114. for var in CC CPP OPTIM CFLAGS CFLAGS_SHLIB LDFLAGS LD_SHLIB LDFLAGS_SHLIB \
  1115.            LDFLAGS_SHLIB_EXPORT LIBS INCLUDES RANLIB DEPS TARGET; do
  1116.     eval "val=\"\$$var\"";
  1117.     if [ ".$val" != . ]; then
  1118.         case $var in 
  1119.             CFLAGS|LDFLAGS|LIBS|INCLUDES|DEPS) 
  1120.                 echo $SEO "s%^#*\\(EXTRA_$var=\\).*%\\1$val%g" >>$sedsubst
  1121.                 ;;
  1122.             *)
  1123.                 echo $SEO "s%^#*\\($var=\\).*%\\1$val%g" >>$sedsubst
  1124.                 ;;
  1125.         esac
  1126.         eval "$var=\"\"; export $var"
  1127.     fi
  1128. done
  1129. IFS="$OIFS"
  1130.  
  1131. #   generate rule directives 
  1132. OIFS="$IFS" IFS=':'
  1133. for rule in $rules; do
  1134.     name="`echo $rule | tr "a-z" "A-Z"`"
  1135.     eval "val=\$rule_$rule"
  1136.     echo $SEO "s%^\\(Rule $name=\\).*%\\1$val%g" >>$sedsubst
  1137.     if [ $verbose = yes ]; then
  1138.         echo " + Rule $name=$val"
  1139.     fi
  1140. done
  1141. IFS="$OIFS"
  1142.  
  1143. #   consistency checks for shared object support
  1144. some_shares=0
  1145. OIFS="$IFS" IFS=':'
  1146. for module in $modules; do
  1147.     eval "share=\$shared_$module"
  1148.     if [ $share = yes ]; then
  1149.         some_shares=1
  1150.     fi
  1151. done
  1152. IFS="$OIFS"
  1153. if [ $some_shares = 1 ]; then
  1154.     if [ $module_so = no ]; then
  1155.         module_so=yes
  1156.         if [ .$quiet = .no ]; then
  1157.             echo " + enabling mod_so for DSO support"
  1158.         fi
  1159.     fi
  1160. fi
  1161. if [ ".$shared_so" = .yes ]; then
  1162.     shared_so=no
  1163.     echo "configure:Error: Module mod_so cannot be made a DSO itself" 1>&2
  1164.     exit 1
  1165. fi
  1166.  
  1167. #   module permutation support
  1168. if [ ".$permute" != . ]; then
  1169.     sed -e '/## mod_mmap_static/,$d' <src/Configuration.tmpl >$tplconf
  1170.     OIFS="$IFS" IFS='
  1171. '
  1172.     for line in `cat src/Configuration.tmpl $addconf | egrep '^[# ]*(Add|Shared)Module'`; do
  1173.         name=`echo "$line" |\
  1174.               sed -e 's%^.*/\(.*\)$%\1%' \
  1175.                   -e 's/\.[oa]$//' \
  1176.                   -e 's/\.module$//' \
  1177.                   -e 's/^mod_//' \
  1178.                   -e 's/^lib//'`
  1179.         echo "${name}:${line}"
  1180.     done |\
  1181.     $AWK -F: '
  1182.         BEGIN { 
  1183.             n = 0; 
  1184.         }
  1185.         { 
  1186.             module_pos[$1]  = n; 
  1187.             module_list[n]  = $1; 
  1188.             module_line[$1] = $2;
  1189.             n++; 
  1190.         }
  1191.         END {
  1192.             pn = split(permute, perm, ",");
  1193.             for (p = 1; p <= pn; p++) {
  1194.                 split(perm[p], m, ":")
  1195.                 m1 = m[1];
  1196.                 m2 = m[2];
  1197.                 if (m1 == "BEGIN") {
  1198.                     for (i = module_pos[m2]-1; i >= 0; i--) {
  1199.                         n1 = module_list[i];
  1200.                         n2 = module_list[i+1];
  1201.                         module_list[i]   = n2;
  1202.                         module_list[i+1] = n1;
  1203.                         module_pos[n1]   = i+1;
  1204.                         module_pos[n2]   = i;
  1205.                     }
  1206.                 }
  1207.                 else if (m2 == "END") {
  1208.                     for (i = module_pos[m1]; i < n-1; i++) {
  1209.                         n1 = module_list[i];
  1210.                         n2 = module_list[i+1];
  1211.                         module_list[i]   = n2;
  1212.                         module_list[i+1] = n1;
  1213.                         module_pos[n1]   = i+1;
  1214.                         module_pos[n2]   = i;
  1215.                     }
  1216.                 }
  1217.                 else {
  1218.                     p1 = module_pos[m1];
  1219.                     p2 = module_pos[m2];
  1220.                     n1 = module_list[p1];
  1221.                     n2 = module_list[p2];
  1222.                     module_list[p1] = n2;
  1223.                     module_list[p2] = n1;
  1224.                     module_pos[m1] = p2;
  1225.                     module_pos[m2] = p1;
  1226.                 }
  1227.             }
  1228.             for (i = 0; i < n; i++) {
  1229.                 name = module_list[i];
  1230.                 printf("%s\n", module_line[name]);
  1231.             }
  1232.         }
  1233.     ' "permute=$permute" >>$tplconf
  1234.     IFS="$OIFS"
  1235. else
  1236.     cat $src/Configuration.tmpl $addconf >$tplconf
  1237. fi
  1238.  
  1239. #   generate module directives
  1240. OIFS="$IFS" IFS=':'
  1241. for module in $modules; do
  1242.     eval "add=\$module_$module"
  1243.     if [ $add = yes ]; then
  1244.         echo $SEO "s%^.*\\(AddModule.*[_b/]$module\\..*\\)%\\1%g" >>$sedsubst
  1245.         echo $SEO "s%^.*\\(SharedModule.*[_b/]$module\\..*\\)%\\1%g" >>$sedsubst
  1246.         m="yes [static]"
  1247.     else
  1248.         echo $SEO "s%^.*\\(AddModule.*[_b/]$module\\..*\\)%# \\1%g" >>$sedsubst
  1249.         echo $SEO "s%^.*\\(SharedModule.*[_b/]$module\\..*\\)%# \\1%g" >>$sedsubst
  1250.         m=no
  1251.     fi
  1252.     eval "share=\$shared_$module"
  1253.     if [ $share = yes ]; then
  1254.         echo $SEO "s%^\\(.*\\)AddModule\\(.*[_b/]$module\\.\\)[oam].*\\(.*\\)%\\1SharedModule\\2so\\3%g" >>$sedsubst
  1255.         m="yes [shared]"
  1256.     fi
  1257.     if [ $verbose = yes ]; then
  1258.         echo " + Module $module: $m"
  1259.     fi
  1260. done
  1261. IFS="$OIFS"
  1262.  
  1263. #   split sedsubst into chunks of 50 commands
  1264. #   to workaround limits in braindead seds
  1265. files=`$AWK <$sedsubst '
  1266.     BEGIN { line=0; cnt=0; }
  1267.     {
  1268.         if (line % 50 == 0) {
  1269.             file = sedsubst "." cnt;
  1270.             printf("%s\n", file);
  1271.             cnt++;
  1272.         }
  1273.         line++;
  1274.         print $0 >file;
  1275.     }
  1276. ' "sedsubst=$sedsubst"`
  1277. OIFS="$IFS" IFS="$DIFS"
  1278. substcmd=""
  1279. for file in $files; do
  1280.     substcmd="${substcmd} sed -f $file |"
  1281. done
  1282. substcmd="${substcmd} cat"
  1283. IFS="$OIFS"
  1284.  
  1285. #   and finally translate the config template 
  1286. #   according to our defined configuration
  1287. eval "cat $tplconf | $substcmd >$src/Configuration.apaci"
  1288.  
  1289. #   cleanup
  1290. rm -f $sedsubst $sedsubst.[0-9] 2>/dev/null
  1291. rm -f $addconf 2>/dev/null
  1292. rm -f $tplconf 2>/dev/null
  1293.  
  1294. ##
  1295. ##  create all other Makefiles by running the proprietary 
  1296. ##  $src/Configure script with our custom Configuration.apaci file
  1297. ##
  1298. if [ .$quiet = .yes ]; then
  1299.     (cd $src; ./Configure -file Configuration.apaci >/dev/null);
  1300. else
  1301.     (cd $src; ./Configure -file Configuration.apaci |\
  1302.      sed -e '/^Using config file:.*/d' \
  1303.          -e "s:Makefile in :Makefile in $src\\/:" \
  1304.          -e "s:Makefile\$:Makefile in $src:")
  1305. fi
  1306.  
  1307. ##
  1308. ##  final hints
  1309. ##
  1310. if [ .$quiet = .no ]; then
  1311.     if [ ".$shadow" != . ]; then
  1312.         echo "Hint: You now have to build inside $shadow."
  1313.         echo "This can be done either by running the canonical commands"
  1314.         echo "  \$ cd $shadow"
  1315.         echo "  \$ make"
  1316.         echo "  \$ make install"
  1317.         echo "or by running this alternative commands"
  1318.         echo "  \$ make -f $shadow/Makefile"
  1319.         echo "  \$ make -f $shadow/Makefile install"
  1320.     fi
  1321. fi
  1322.  
  1323.