home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / apac_139.zip / configure < prev    next >
Text File  |  1999-08-14  |  53KB  |  1,497 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. ##  avoid brain dead shells on Ultrix and friends
  70. ##
  71. test -f /bin/sh5 && exec /bin/sh5 $0 "$@"
  72.  
  73. ##
  74. ##  the paths to the Apache source tree
  75. ##
  76. top=.
  77. mkf=Makefile
  78. src=src
  79. aux=src/helpers
  80. sedsubst=src/.apaci.sedsubst
  81. addconf=src/.apaci.addconf
  82. tplconf=src/.apaci.tplconf
  83. pldconf=src/.apaci.pldconf
  84. configlayout=config.layout
  85. configstatus=config.status
  86. shadow=''
  87.  
  88. ##
  89. ##  pre-determine runtime modes
  90. ##
  91. help=no
  92. quiet=no
  93. verbose=no
  94. case "$*" in
  95.     --help|*--help|*--help* ) 
  96.         help=yes; quiet=yes
  97.         echo "[hang on a moment, generating help]"
  98.         echo ""
  99.         ;;
  100.     --quiet|*--quiet|*--quiet* ) 
  101.         quiet=yes
  102.         ;;
  103.     --verbose|*--verbose|*--verbose*|-v|*-v|*-v* ) 
  104.         verbose=yes
  105.         ;;
  106.     * ) 
  107.         ;;
  108. esac
  109.  
  110. ##
  111. ##  determine platform id
  112. ##
  113. PLATFORM="`$aux/GuessOS`"
  114.  
  115. ##
  116. ##  display version information
  117. ##
  118. if [ "x$quiet" = "xno" ]; then
  119.     APV=`cat $src/include/httpd.h |\
  120.          grep "#define SERVER_BASEVERSION" |\
  121.          sed -e 's/^[^"]*"//' -e 's/".*$//' -e 's/^Apache\///'`
  122.     echo "Configuring for Apache, Version $APV"
  123. fi
  124.  
  125. ##
  126. ##  important hint for the first-time users
  127. ##
  128. if [ $# -eq 0 ]; then
  129.     echo " + Warning: Configuring Apache with default settings."
  130.     echo " + This is probably not what you really want."
  131.     echo " + Please read the README.configure and INSTALL files"
  132.     echo " + first or at least run '$0 --help' for"
  133.     echo " + a compact summary of available options."
  134. fi
  135.  
  136. ##
  137. ##  determine path to (optional) Perl interpreter
  138. ##
  139. PERL=no-perl-on-this-system
  140. perlpath="`$aux/PrintPath perl5 perl miniperl`"
  141. if [ "x$perlpath" != "x" ]; then
  142.     PERL="$perlpath"
  143. fi
  144.  
  145. ##
  146. ##  look for deadly broken echo commands which interpret escape
  147. ##  sequences `\XX' *per default*. For those we first try the -E option
  148. ##  and if it then is still broken we give a warning message.
  149. ##  If it works set the `Safe Echo Option' (SEO) variable.
  150. ##
  151. SEO='' # CHANGE THIS VARIABLE HERE IF YOU HAVE PROBLEMS WITH ECHO!
  152. bytes=`echo $SEO '\1' | wc -c | awk '{ printf("%s", $1); }'`
  153. if [ "x$bytes" != "x3" ]; then
  154.     bytes=`echo -E '\1' | wc -c | awk '{ printf("%s", $1); }'`
  155.     if [ "x$bytes" != "x3" ]; then
  156.         echo " + Warning: Your 'echo' command is slightly broken."
  157.         echo " + It interprets escape sequences per default. We already"
  158.         echo " + tried 'echo -E' but had no real success. If errors occur"
  159.         echo " + please set the SEO variable in 'configure' manually to"
  160.         echo " + the required 'echo' options, i.e. those which force your"
  161.         echo " + 'echo' to not interpret escape sequences per default."
  162.     else
  163.         SEO='-E'
  164.     fi
  165. fi
  166.  
  167. ##
  168. ##  look for the best Awk we can find because some
  169. ##  standard Awks are really braindead and cause 
  170. ##  problems for our scripts under some platforms.
  171. ##
  172. AWK=awk
  173. awkpath="`$aux/PrintPath nawk gawk awk`"
  174. if [ "x$awkpath" != "x" ]; then
  175.     AWK="$awkpath"
  176. fi
  177.  
  178. ##
  179. ## Look for a good Tar. If we don't find 'GNU tar' then make
  180. ## sure ours can handle the '-h' (don't copy symlink, copy
  181. ## the actual data) option.
  182. ##
  183. TAR=tar
  184. tarpath="`$aux/PrintPath gtar gnutar tar`"
  185. if [ "x$tarpath" != "x" ]; then
  186.     TAR="$tarpath"
  187. fi
  188. case "`$TAR --version 2>/dev/null`" in
  189.     *GNU*) TAROPT="-hcf" ;;
  190.     *) if $TAR -hcf - Makefile.tmpl > /dev/null 2>&1
  191.        then
  192.            TAROPT="-hcf"
  193.        else
  194.            TAROPT="-cf"
  195.        fi
  196.        ;;
  197. esac
  198.  
  199. ##
  200. ##  determine path to sh, it's not /bin/sh on ALL systems
  201. ##
  202. SHELL=/bin/sh
  203. if [ ! -f "$SHELL" ]; then
  204.     SHELL="`$aux/PrintPath sh`"
  205.     if [ "x$SHELL" = "x" ]; then
  206.         echo "configure:Error: Cannot determine path to Bourne-Shell" 1>&2
  207.         exit 1
  208.     fi
  209. fi
  210.  
  211. ##
  212. ##  determine default parameters
  213. ##
  214.  
  215. #   default paths
  216. prefix=UNSET
  217.  
  218. #   layout configuration
  219. with_layout=0
  220. show_layout=0
  221.  
  222. #   suexec defaults
  223. suexec=0
  224. suexec_ok=0
  225. suexec_docroot='$datadir/htdocs'
  226. suexec_logexec='$logfiledir/suexec_log'
  227. suexec_caller=www
  228. suexec_userdir=public_html
  229. suexec_uidmin=100
  230. suexec_gidmin=100
  231. suexec_safepath="/usr/local/bin:/usr/bin:/bin"
  232.  
  233. #   the installation flags
  234. iflags_program="-m 755 -s"
  235. iflags_core="-m 755"
  236. iflags_dso="-m 755"
  237. iflags_script="-m 755"
  238. iflags_data="-m 644"
  239. case $PLATFORM in
  240.     *OS/2* ) 
  241.         iflags_program="$iflags_program -e .exe" 
  242.         iflags_core="$iflags_core -e .exe" 
  243.         ;;
  244. esac
  245.  
  246. #   various other flags
  247. support=1
  248. confadjust=1
  249. permute=''
  250.  
  251. #   determine rules
  252. rules=''
  253. rulelist=''
  254. OIFS="$IFS"
  255. IFS='
  256. '
  257. for rule in `grep '^Rule' $src/Configuration.tmpl`; do
  258.     rule=`echo "$rule" | sed -e 's/^Rule[     ]*//'`
  259.     name=`echo "$rule" | sed -e 's/=.*$//'`
  260.     namelow=`echo "$name" | tr 'A-Z' 'a-z'`
  261.     arg=`echo "$rule" | sed -e 's/^.*=//'`
  262.     eval "rule_$namelow=$arg"
  263.     rules="$rules:$namelow"
  264.     rulelist="$rulelist:$name=$arg"
  265. done
  266. IFS="$OIFS"
  267. rules=`echo $rules | sed -e 's/^://'`
  268.  
  269. #   determine modules
  270. modules=''
  271. modulelist=''
  272. OIFS="$IFS"
  273. IFS='
  274. '
  275. for module in `egrep '^[#     ]*(Add|Shared)Module' $src/Configuration.tmpl`; do
  276.     add=yes
  277.     share=no
  278.     if [ "x`echo $module | grep '^#'`" != "x" ]; then
  279.         add=no
  280.     fi
  281.     if [ "x`echo $module | grep 'SharedModule'`" != "x" ]; then
  282.         share=yes
  283.     fi
  284.     module=`echo "$module" |\
  285.             sed -e 's%^.*/\(.*\)$%\1%' \
  286.                 -e 's/\.[oa]$//' \
  287.                 -e 's/\.module$//' \
  288.                 -e 's/^mod_//' \
  289.                 -e 's/^lib//'`
  290.     eval "module_$module=$add"
  291.     eval "shared_$module=$share"
  292.     modules="${modules}:$module"
  293.     modulelist="${modulelist}:$module=$add"
  294.     if [ "x$share" = "xyes" ]; then
  295.         modulelist="${modulelist}*"
  296.     fi
  297. done
  298. IFS="$OIFS"
  299. modules=`echo $modules | sed -e 's/^://'`
  300.  
  301. #   backward compatibility for old src/Configuration.tmpl
  302. #   parameter names to the canonical Autoconf-style shell
  303. #   variable names.
  304. OIFS="$IFS"
  305. IFS="$DIFS"
  306. for var in CFLAGS LDFLAGS LIBS INCLUDES DEPS; do
  307.     eval "val=\$EXTRA_$var"
  308.     if [ "x$val" != "x" ]; then
  309.         eval "$var=\$val"
  310.         eval "EXTRA_$var=\"\"; export EXTRA_$var"
  311.         echo " + Hint: please use $var instead of EXTRA_$var next time"
  312.     fi
  313. done
  314. IFS="$OIFS"
  315.  
  316. ##
  317. ## Platform-specific defaults
  318. ##
  319. case $PLATFORM in
  320.     *-apple-rhapsody*)
  321.     default_layout="Mac OS X Server"
  322.     iflags_core="${iflags_core} -S \"-S\""
  323.     iflags_dso="${iflags_dso} -S \"-S\""
  324.     ;;
  325.     *-apple-macos*)
  326.     default_layout="Mac OS X Server"
  327.     iflags_core="${iflags_core} -S \"-S\"" 
  328.     iflags_dso="${iflags_dso} -S \"-S\""
  329.     ;;
  330.    *)
  331.     default_layout="Apache"
  332.     ;;
  333. esac
  334.  
  335. ##
  336. ##  support for the default layout
  337. ##
  338. case "$*" in
  339.     *--with-layout=* ) 
  340.         ;;
  341.     * ) 
  342.         if [ "x$*" = "x" ]; then
  343.             set -- --with-layout="$default_layout"
  344.         else
  345.             set -- --with-layout="$default_layout" "$@"
  346.         fi
  347.         ;;
  348. esac
  349.  
  350. ##
  351. ##  Iterate over the command line options the first time.
  352. ##
  353. ##  This time we pre-process options which need high priority 
  354. ##  on the command line independent of their position, so they 
  355. ##  can be overridden by others.
  356. ##
  357. apc_prev=''
  358. OIFS1="$IFS"
  359. IFS="$DIFS"
  360. for apc_option
  361. do
  362.     #   if previous option needs an argument, assign it.
  363.     if [ "x$apc_prev" != "x" ]; then
  364.         eval "$apc_prev=\$apc_option"
  365.         apc_prev=""
  366.         continue
  367.     fi
  368.     #   split out arguments
  369.     case "$apc_option" in
  370.         -*=*) apc_optarg=`echo "$apc_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
  371.            *) apc_optarg= ;;
  372.     esac
  373.     #  pre-process only a few options now
  374.     case "$apc_option" in
  375.         --help | -h | -help )
  376.             echo "Usage: configure [options]"
  377.             echo "Options: [defaults in brackets after descriptions]"
  378.             echo "General options:"
  379.             echo " --quiet, --silent      do not print messages"
  380.             echo " --verbose, -v          print even more messages"
  381.             echo " --shadow[=DIR]         switch to a shadow tree (under DIR) for building"
  382.             echo ""
  383.             echo "Stand-alone options:"
  384.             echo " --help, -h             print this message"
  385.             echo " --show-layout          print installation path layout (check and debug)"
  386.             echo ""
  387.             echo "Installation layout options:"
  388.             echo " --with-layout=[F:]ID   use installation path layout ID (from file F)"
  389.             echo " --target=TARGET        install name-associated files using basename TARGET"
  390.             echo " --prefix=PREFIX        install architecture-independent files in PREFIX"
  391.             echo " --exec-prefix=EPREFIX  install architecture-dependent files in EPREFIX"
  392.             echo " --bindir=DIR           install user     executables in DIR"
  393.             echo " --sbindir=DIR          install sysadmin executables in DIR"
  394.             echo " --libexecdir=DIR       install program  executables in DIR"
  395.             echo " --mandir=DIR           install manual pages in DIR"
  396.             echo " --sysconfdir=DIR       install configuration files in DIR"
  397.             echo " --datadir=DIR          install read-only  data files in DIR"
  398.             echo " --includedir=DIR       install includes files in DIR"
  399.             echo " --localstatedir=DIR    install modifiable data files in DIR"
  400.             echo " --runtimedir=DIR       install runtime data in DIR"
  401.             echo " --logfiledir=DIR       install logfile data in DIR"
  402.             echo " --proxycachedir=DIR    install proxy cache data in DIR"
  403.             echo ""
  404.             echo "Configuration options:"
  405.             echo " --enable-rule=NAME     enable  a particular Rule named 'NAME'"
  406.             echo " --disable-rule=NAME    disable a particular Rule named 'NAME'"
  407.             $aux/ppl.sh $rulelist
  408.             echo " --add-module=FILE      on-the-fly copy & activate a 3rd-party Module"
  409.             echo " --activate-module=FILE on-the-fly activate existing 3rd-party Module"
  410.             echo " --permute-module=N1:N2 on-the-fly permute module 'N1' with module 'N2'"
  411.             echo " --enable-module=NAME   enable  a particular Module named 'NAME'"
  412.             echo " --disable-module=NAME  disable a particular Module named 'NAME'"
  413.             $aux/ppl.sh $modulelist
  414.             echo " --enable-shared=NAME   enable  build of Module named 'NAME' as a DSO"
  415.             echo " --disable-shared=NAME  disable build of Module named 'NAME' as a DSO"
  416.             echo " --with-perl=FILE       path to the optional Perl interpreter"
  417.             echo " --without-support      disable the build and installation of support tools"
  418.             echo " --without-confadjust   disable the user/situation adjustments in config"
  419.             echo " --without-execstrip    disable the stripping of executables on installation"
  420.             echo ""
  421.             echo "suEXEC options:"
  422.             echo " --enable-suexec        enable the suEXEC feature"
  423.             echo " --suexec-caller=NAME   set the suEXEC username of the allowed caller [$suexec_caller]"
  424.             echo " --suexec-docroot=DIR   set the suEXEC root directory [PREFIX/share/htdocs]"
  425.             echo " --suexec-logfile=FILE  set the suEXEC logfile [PREFIX/var/log/suexec_log]"
  426.             echo " --suexec-userdir=DIR   set the suEXEC user subdirectory [$suexec_userdir]"
  427.             echo " --suexec-uidmin=UID    set the suEXEC minimal allowed UID [$suexec_uidmin]"
  428.             echo " --suexec-gidmin=GID    set the suEXEC minimal allowed GID [$suexec_gidmin]"
  429.             echo " --suexec-safepath=PATH set the suEXEC safe PATH [$suexec_safepath]"
  430.             echo ""
  431.             echo "Deprecated options:"
  432.             echo " --layout               backward compat only: use --show-layout"
  433.             echo " --compat               backward compat only: use --with-layout=Apache"
  434.             exit 0
  435.             ;;
  436.         --with-layout=*|--compat)
  437.             if [ "x$apc_option" = "x--compat" ]; then
  438.                 apc_optarg="Apache"
  439.             fi
  440.             case $apc_optarg in
  441.                 *:* ) 
  442.                     file=`echo $apc_optarg | sed -e 's/:.*//'`
  443.                     name=`echo $apc_optarg | sed -e 's/.*://'`
  444.                     ;;
  445.                 * ) 
  446.                     name=$apc_optarg
  447.                     file=$configlayout
  448.                     ;;
  449.             esac
  450.             if [ ! -f "$file" ]; then
  451.                 echo "configure:Error: Path layout definition file $file not found" 1>&2
  452.                 exit 1
  453.             fi
  454.             sed -e "1,/[     ]*<[Ll]ayout[     ]*$name[     ]*>[     ]*/d" \
  455.                 -e '/[     ]*<\/Layout>[     ]*/,$d' \
  456.                 -e "s/^[     ]*//g" \
  457.                 -e "s/:[     ]*/=\'/g" \
  458.                 -e "s/[     ]*$/'/g" \
  459.                 $file >$pldconf
  460.             . $pldconf
  461.             OOIFS="$IFS"  # most likely not needed: jmj
  462.             IFS="$DIFS"   # ditto
  463.             for var in prefix exec_prefix bindir sbindir libexecdir mandir \
  464.                        sysconfdir datadir iconsdir htdocsdir cgidir includedir \
  465.                        localstatedir runtimedir logfiledir proxycachedir; do
  466.                 eval "val=\"\$$var\""
  467.                 case $val in
  468.                     *+ )
  469.                         val=`echo $val | sed -e 's;\+$;;'`
  470.                         eval "$var=\"\$val\""
  471.                         eval "autosuffix_$var=yes"
  472.                         ;;
  473.                     * )
  474.                         eval "autosuffix_$var=no"
  475.                         ;;
  476.                 esac
  477.             done
  478.             IFS="$OOIFS"
  479.             rm -f $pldconf 2>/dev/null
  480.             if [ "x$prefix" = "xUNSET" ]; then
  481.                 echo "configure:Error: Path layout definition not found or incorrect" 1>&2
  482.                 exit 1
  483.             fi
  484.             if [ "x$quiet" = "xno" ]; then
  485.                 echo " + using installation path layout: $name ($file)"
  486.             fi
  487.             name_layout=$name
  488.             with_layout=1
  489.             ;;
  490.         *)
  491.             ;;
  492.     esac
  493. done
  494.  
  495. ##
  496. ##  Iterate over the command line options the second time.
  497. ##
  498. ##  This time we parse the standard options.
  499. ##
  500. addconf_created=0
  501. apc_prev=''
  502. for apc_option
  503. do
  504.     #   if previous option needs an argument, assign it.
  505.     if [ "x$apc_prev" != "x" ]; then
  506.         eval "$apc_prev=\$apc_option"
  507.         apc_prev=""
  508.         continue
  509.     fi
  510.     #   split out arguments
  511.     case "$apc_option" in
  512.         -*=*) apc_optarg=`echo "$apc_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
  513.            *) apc_optarg= ;;
  514.     esac
  515.     #  accept only the most important GNU Autoconf-style options
  516.     case "$apc_option" in
  517.         --help|-h|-help|--with-layout=*|-compat)
  518.             #   just ignore already parsed options
  519.             ;;
  520.         --quiet | --silent) 
  521.             quiet=yes
  522.             ;;
  523.         --verbose | -v)
  524.             verbose=yes
  525.             ;;
  526.         --shadow*)
  527.             #   if we use an external shadow tree, first shadow all of ourself
  528.             #   to this tree and switch over to to it for internal (=platform)
  529.             #   shadowing...
  530.             case "$apc_option" in
  531.                 --shadow=*)
  532.                     shadow="$apc_optarg"
  533.                     if [ "x$quiet" = "xno" ]; then
  534.                         echo " + creating external package shadow tree ($shadow)"
  535.                     fi
  536.                     rm -rf $shadow 2>/dev/null
  537.                     $aux/mkshadow.sh . $shadow
  538.                     for file in $mkf $sedsubst $addconf $tplconf $pldconf $configstatus; do
  539.                         rm -f $shadow/$file 2>/dev/null
  540.                     done
  541.                     if [ "x$quiet" = "xno" ]; then
  542.                         echo " + switching to external package shadow tree ($shadow)"
  543.                     fi
  544.                     cd $shadow
  545.                     ;;
  546.             esac
  547.             #   determine GNU platform triple
  548.             #   (the use of `awk' and not `$AWK' here is correct, because this
  549.             #   Makefile is for platform bootstrapping, so don't hardcode paths)
  550.             gnutriple=`$aux/GuessOS | sed -e 's:/:-:g' | awk '{ printf("%s",$1); }'`
  551.             #   create Makefile wrapper (the first time only)
  552.             if [ "x`ls $top/src.* 2>/dev/null`" = "x" ]; then
  553.                 if [ "x$quiet" = "xno" ]; then
  554.                     echo " + creating Makefile (shadow wrapper)"
  555.                 fi
  556.                 echo "##" > Makefile
  557.                 echo "##  Apache Makefile (shadow wrapper)" >> Makefile
  558.                 echo "##" >> Makefile
  559.                 echo "" >> Makefile
  560.                 if [ "x$shadow" != "x" ]; then
  561.                     echo "SHADOW=$shadow" >> Makefile
  562.                 else
  563.                     echo "SHADOW=." >> Makefile
  564.                 fi
  565.                 echo "GNUTRIPLE=\`$aux/GuessOS | sed -e 's:/:-:g' | $AWK '{ printf(\"%s\",\$\$1); }'\`" >> Makefile
  566.                 echo "" >> Makefile
  567.                 echo "all build install install-quiet clean distclean:" >> Makefile
  568.                 echo "    @cd \$(SHADOW); \$(MAKE) -f Makefile.\$(GNUTRIPLE) \$(MFLAGS) \$@" >> Makefile
  569.                 echo "" >> Makefile
  570.             fi
  571.             #   set shadow paths
  572.             shadowmkf="Makefile.$gnutriple"
  573.             shadowsrc="src.$gnutriple"
  574.             shadowaux="src.$gnutriple/helpers"
  575.             shadowsedsubst="src.$gnutriple/.apaci.sedsubst"
  576.             shadowaddconf="src.$gnutriple/.apaci.addconf"
  577.             shadowtplconf="src.$gnutriple/.apaci.tplconf"
  578.             #   (re)create shadow tree
  579.             if [ "x$quiet" = "xno" ]; then
  580.                 echo " + creating internal platform shadow tree ($shadowsrc)"
  581.             fi
  582.             rm -rf $shadowsrc
  583.             $aux/mkshadow.sh $src $shadowsrc
  584.             #   delegate us to the shadow paths
  585.             mkf=$shadowmkf
  586.             src=$shadowsrc
  587.             aux=$shadowaux
  588.             sedsubst=$shadowsedsubst
  589.             addconf=$shadowaddconf
  590.             tplconf=$shadowtplconf
  591.             ;;
  592.         --show-layout|--layout)
  593.             show_layout=1
  594.             ;;
  595.         --target=*)
  596.             TARGET="$apc_optarg"
  597.             ;;
  598.         --prefix=*)
  599.             prefix="$apc_optarg"
  600.             autosuffix_prefix=no
  601.             ;;
  602.         --exec-prefix=*)
  603.             exec_prefix="$apc_optarg"
  604.             autosuffix_exec_prefix=no
  605.             ;;
  606.         --bindir=*)       
  607.             bindir="$apc_optarg"
  608.             autosuffix_bindir=no
  609.             ;;
  610.         --sbindir=*)       
  611.             sbindir="$apc_optarg"
  612.             autosuffix_sbindir=no
  613.             ;;
  614.         --libexecdir=*)
  615.             libexecdir="$apc_optarg"    
  616.             autosuffix_libexecdir=no
  617.             ;;
  618.         --mandir=*)        
  619.             mandir="$apc_optarg"        
  620.             autosuffix_mandir=no
  621.             ;;
  622.         --sysconfdir=*)    
  623.             sysconfdir="$apc_optarg"    
  624.             autosuffix_sysconfdir=no
  625.             ;;
  626.         --datadir=*)       
  627.             datadir="$apc_optarg"       
  628.             autosuffix_datadir=no
  629.             ;;
  630.         --includedir=*)       
  631.             includedir="$apc_optarg"       
  632.             autosuffix_includedir=no
  633.             ;;
  634.         --localstatedir=*) 
  635.             localstatedir="$apc_optarg" 
  636.             autosuffix_localstatedir=no
  637.             ;;
  638.         --runtimedir=*) 
  639.             runtimedir="$apc_optarg" 
  640.             autosuffix_runtimedir=no
  641.             ;;
  642.         --logfiledir=*) 
  643.             logfiledir="$apc_optarg" 
  644.             autosuffix_logfiledir=no
  645.             ;;
  646.         --proxycachedir=*) 
  647.             proxycachedir="$apc_optarg" 
  648.             autosuffix_proxycachedir=no
  649.             ;;
  650.         --add-module=*) 
  651.             file="$apc_optarg"
  652.             if [ "x`echo $file | egrep '/?mod_[a-zA-Z0-9][a-zA-Z0-9_]*\.c$'`" = "x" ]; then
  653.                 echo "configure:Error: Module filename doesn't match '/?mod_[a-zA-Z0-9][a-zA-Z0-9_]*\.c'" 1>&2
  654.                 exit 1
  655.             fi
  656.             if [ ! -f $file ]; then
  657.                 echo "configure:Error: Module source $file not found" 1>&2
  658.                 exit 1
  659.             fi
  660.             modfilec=`echo $file | sed -e 's;^.*/;;'`
  661.             modfileo=`echo $file | sed -e 's;^.*/;;' -e 's;\.c$;.o;'`
  662.             if [ "x$file" != "x$src/modules/extra/$modfilec" ]; then
  663.                 cp $file $src/modules/extra/$modfilec
  664.             fi
  665.             if [ "x$addconf_created" = "x0" ]; then
  666.                 addconf_created=1
  667.                 rm -f $addconf 2>/dev/null
  668.                 touch $addconf 2>/dev/null
  669.             fi
  670.             echo "" >>$addconf
  671.             echo "## On-the-fly added module" >>$addconf
  672.             echo "## (configure --add-module=$file)" >>$addconf
  673.             echo "AddModule modules/extra/$modfileo" >>$addconf
  674.             module=`echo "$modfileo" |\
  675.                     sed -e 's%^.*/\(.*\)$%\1%' \
  676.                         -e 's/\.[^.]*$//' \
  677.                         -e 's/^mod_//' \
  678.                         -e 's/^lib//'`
  679.             eval "module_$module=yes"
  680.             eval "shared_$module=no"
  681.             modules="${modules}:$module"
  682.             modulelist="${modulelist}:$module=yes"
  683.             if [ "x$quiet" = "xno" ]; then
  684.                 echo " + on-the-fly added and activated $module module (modules/extra/$modfileo)"
  685.             fi
  686.             ;;
  687.         --activate-module=*) 
  688.             file="$apc_optarg"
  689.             case $file in
  690.                 src/modules/* ) ;;
  691.                 *)  echo "configure:Error: Module source already has to be below src/modules/ to be activated" 1>&2
  692.                     exit 1
  693.                     ;;
  694.             esac
  695.             modfile=`echo $file | sed -e 's;^src/;;'`
  696.             if [ "x$addconf_created" = "x0" ]; then
  697.                 addconf_created=1
  698.                 rm -f $addconf 2>/dev/null
  699.                 touch $addconf 2>/dev/null
  700.             fi
  701.             echo "" >>$addconf
  702.             echo "## On-the-fly activated module" >>$addconf
  703.             echo "## (configure --activate-module=$file)" >>$addconf
  704.             echo "AddModule $modfile" >>$addconf
  705.             module=`echo "$modfile" |\
  706.                     sed -e 's%^.*/\(.*\)$%\1%' \
  707.                         -e 's/\.[^.]*$//' \
  708.                         -e 's/^mod_//' \
  709.                         -e 's/^lib//'`
  710.             eval "module_$module=yes"
  711.             eval "shared_$module=no"
  712.             modules="${modules}:$module"
  713.             modulelist="${modulelist}:$module=yes"
  714.             if [ "x$quiet" = "xno" ]; then
  715.                 echo " + activated $module module ($modfile)"
  716.             fi
  717.             ;;
  718.         --enable-*)
  719.             apc_feature=`echo $apc_option | sed -e 's/-*enable-//' -e 's/=.*//'`
  720.             apc_feature=`echo $apc_feature | sed 's/-/_/g'`
  721.             case "$apc_option" in
  722.                 *=*) ;;
  723.                   *) apc_optarg=yes ;;
  724.             esac
  725.             case "$apc_feature" in
  726.                 rule   )
  727.                     apc_optarg=`echo "$apc_optarg" | tr '[A-Z]' '[a-z]'`
  728.                     apc_optarg_real=`echo "$apc_optarg" | tr '[a-z]' '[A-Z]'`
  729.                     eval "exists=\$rule_${apc_optarg}" 
  730.                     if [ "x$exists" = "x" ]; then
  731.                         echo "configure:Error: No such rule named '${apc_optarg_real}'" 1>&2
  732.                         exit 1
  733.                     fi
  734.                     eval "rule_${apc_optarg}=yes"
  735.                     ;;
  736.                 module ) 
  737.                     case $apc_optarg in
  738.                        all ) 
  739.                            OOIFS="$IFS"
  740.                            IFS=':'
  741.                            for module in $modules; do
  742.                                eval "module_${module}=yes" 
  743.                            done
  744.                            IFS="$OOIFS"
  745.                            module_auth_digest=no # conflict with mod_digest
  746.                            ;;
  747.                        most ) 
  748.                            OOIFS="$IFS"
  749.                            IFS=':'
  750.                            for module in $modules; do
  751.                                eval "module_${module}=yes" 
  752.                            done
  753.                            IFS="$OOIFS"
  754.                            module_auth_db=no     # not all platforms have -ldb
  755.                            module_mmap_static=no # not all platforms have mmap()
  756.                            module_so=no          # not all platforms have dlopen()
  757.                            module_example=no     # only for developers
  758.                            module_auth_digest=no # conflict with mod_digest
  759.                            module_log_agent=no   # deprecated
  760.                            module_log_referer=no # deprecated
  761.                            ;;
  762.                        * ) 
  763.                            eval "exists=\$module_${apc_optarg}" 
  764.                            if [ "x$exists" = "x" ]; then
  765.                                echo "configure:Error: No such module named '${apc_optarg}'" 1>&2
  766.                                exit 1
  767.                            fi
  768.                            eval "module_${apc_optarg}=yes" 
  769.                            ;;
  770.                     esac
  771.                     ;;
  772.                 shared ) 
  773.                     case $apc_optarg in
  774.                        max ) 
  775.                            OOIFS="$IFS"
  776.                            IFS=':'
  777.                            for module in $modules; do
  778.                                eval "shared_${module}=yes" 
  779.                            done
  780.                            IFS="$OOIFS"
  781.                            shared_so=no        # because of bootstrapping
  782.                            ;;
  783.                        remain ) 
  784.                            OOIFS="$IFS"
  785.                            IFS=':'
  786.                            for module in $modules; do
  787.                                eval "add=\$module_${module}" 
  788.                                if [ "x$add" = "xno" ]; then
  789.                                    eval "module_${module}=yes" 
  790.                                    eval "shared_${module}=yes" 
  791.                                fi
  792.                            done
  793.                            IFS="$OOIFS"
  794.                            shared_so=no
  795.                            ;;
  796.                        * ) 
  797.                            eval "exists=\$module_${apc_optarg}" 
  798.                            if [ "x$exists" = "x" ]; then
  799.                                echo "configure:Error: No such module named '${apc_optarg}'" 1>&2
  800.                                exit 1
  801.                            fi
  802.                            eval "shared_${apc_optarg}=yes" 
  803.                            ;;
  804.                     esac
  805.                     ;;
  806.                 suexec ) 
  807.                     suexec=1
  808.                     ;;
  809.                 * ) 
  810.                     echo "configure:Error: invalid option '$apc_option'" 1>&2
  811.                     exit 1
  812.                     ;;
  813.             esac
  814.             ;;
  815.         --disable-*)
  816.             apc_feature=`echo $apc_option | sed -e 's/-*disable-//' -e 's/=.*//'`
  817.             apc_feature=`echo $apc_feature| sed 's/-/_/g'`
  818.             case "$apc_option" in
  819.                 *=*) ;;
  820.                   *) apc_optarg=yes ;;
  821.             esac
  822.             case "$apc_feature" in
  823.                 rule   ) 
  824.                     apc_optarg=`echo "$apc_optarg" | tr '[A-Z]' '[a-z]'`
  825.                     apc_optarg_real=`echo "$apc_optarg" | tr '[a-z]' '[A-Z]'`
  826.                     eval "exists=\$rule_${apc_optarg}" 
  827.                     if [ "x$exists" = "x" ]; then
  828.                         echo "configure:Error: No such rule named '${apc_optarg_real}'" 1>&2
  829.                         exit 1
  830.                     fi
  831.                     eval "rule_${apc_optarg}=no"
  832.                     ;;
  833.                 module )
  834.                     case $apc_optarg in
  835.                        all ) 
  836.                            OOIFS="$IFS"
  837.                            IFS=':'
  838.                            for module in $modules; do
  839.                                eval "module_${module}=no" 
  840.                            done
  841.                            IFS="$OOIFS"
  842.                            ;;
  843.                        * ) 
  844.                            eval "exists=\$module_${apc_optarg}" 
  845.                            if [ "x$exists" = "x" ]; then
  846.                                echo "configure:Error: No such module named '${apc_optarg}'" 1>&2
  847.                                exit 1
  848.                            fi
  849.                            eval "module_${apc_optarg}=no" 
  850.                            ;;
  851.                     esac
  852.                     ;;
  853.                 shared )
  854.                     case $apc_optarg in
  855.                        all ) 
  856.                            OOIFS="$IFS"
  857.                            IFS=':'
  858.                            for module in $modules; do
  859.                                eval "shared_${module}=no" 
  860.                            done
  861.                            IFS="$OOIFS"
  862.                            ;;
  863.                        * ) 
  864.                            eval "exists=\$module_${apc_optarg}" 
  865.                            if [ "x$exists" = "x" ]; then
  866.                                echo "configure:Error: No such module named '${apc_optarg}'" 1>&2
  867.                                exit 1
  868.                            fi
  869.                            eval "shared_${apc_optarg}=no" 
  870.                            ;;
  871.                     esac
  872.                     ;;
  873.                 * ) 
  874.                     echo "configure:Error: invalid option '$apc_option'" 1>&2
  875.                     exit 1
  876.                     ;;
  877.             esac
  878.             ;;
  879.         --permute-module=*:*)
  880.             mod1=`echo $apc_optarg | sed -e 's/:.*//'`
  881.             mod2=`echo $apc_optarg | sed -e 's/.*://'`
  882.             for mod in $mod1 $mod2; do
  883.                 case $mod in
  884.                     BEGIN|END)
  885.                         ;;
  886.                     *)  eval "exists=\$module_${mod}" 
  887.                         if [ "x$exists" = "x" ]; then
  888.                             echo "configure:Error: No such module named '${mod}'" 1>&2
  889.                             exit 1
  890.                         fi
  891.                         ;;
  892.                 esac
  893.             done
  894.             case $mod1:$mod2 in
  895.                 BEGIN:END|*:BEGIN|END:*)
  896.                     echo "configure:Error: Invalid combination of pseudo module identifiers" 1>&2
  897.                     exit 1
  898.                     ;;
  899.             esac
  900.             permute="${permute},${mod1}:${mod2}"
  901.             ;;
  902.         --with-perl=*)
  903.             PERL="$apc_optarg"
  904.             ;;
  905.         --without-support)
  906.             support=0
  907.             ;;
  908.         --without-confadjust)
  909.             confadjust=0
  910.             ;;
  911.         --without-execstrip)
  912.             iflags_program=`echo "$iflags_program" | sed -e 's/-s//'`
  913.             ;;
  914.         --suexec-caller=*)
  915.             suexec_caller="$apc_optarg"
  916.             suexec_ok=1
  917.             ;;
  918.         --suexec-docroot=*)
  919.             suexec_docroot="$apc_optarg"
  920.             suexec_ok=1
  921.             ;;
  922.         --suexec-logfile=*)
  923.             suexec_logexec="$apc_optarg"
  924.             suexec_ok=1
  925.             ;;
  926.         --suexec-userdir=*)
  927.             suexec_userdir="$apc_optarg"
  928.             suexec_ok=1
  929.             ;;
  930.         --suexec-uidmin=*)
  931.             suexec_uidmin="$apc_optarg"
  932.             suexec_ok=1
  933.             ;;
  934.         --suexec-gidmin=*)
  935.             suexec_gidmin="$apc_optarg"
  936.             suexec_ok=1
  937.             ;;
  938.         --suexec-safepath=*)
  939.             suexec_safepath="$apc_optarg"
  940.             suexec_ok=1
  941.             ;;
  942.         * )
  943.             echo "configure:Error: invalid option '$apc_option'" 1>&2
  944.             exit 1
  945.             ;;
  946.     esac
  947. done
  948. IFS="$OIFS1"
  949. if [ "x$apc_prev" != "x" ]; then
  950.     echo "configure:Error: missing argument to --`echo $apc_prev | sed 's/_/-/g'`" 1>&2
  951.     exit 1
  952. fi
  953. if [ "x$addconf_created" = "x0" ]; then
  954.     rm -f $addconf 2>/dev/null
  955.     touch $addconf 2>/dev/null
  956. fi
  957.  
  958. ##
  959. ##   create a config status script for restoring
  960. ##   the configuration via a simple shell script
  961. ##
  962. rm -f $configstatus 2>/dev/null
  963. echo "#!/bin/sh" >$configstatus
  964. echo "##" >>$configstatus
  965. echo "##  $configstatus -- APACI auto-generated configuration restore script" >>$configstatus
  966. echo "##" >>$configstatus
  967. echo "##  Use this shell script to re-run the APACI configure script for" >>$configstatus
  968. echo "##  restoring your configuration. Additional parameters can be supplied." >>$configstatus
  969. echo "##" >>$configstatus
  970. echo "" >>$configstatus
  971. for var in CC CPP OPTIM CFLAGS CFLAGS_SHLIB LDFLAGS LD_SHLIB LDFLAGS_SHLIB \
  972.            LDFLAGS_SHLIB_EXPORT LIBS INCLUDES RANLIB DEPS TARGET; do
  973.     eval "val=\"\$$var\""
  974.     if [ "x$val" != "x" ]; then
  975.         echo "$var=$val" |\
  976.         sed -e 's:\(["$\\]\):\\\1:g' \
  977.             -e 's:\([A-Z]*=\):\1":' \
  978.             -e 's:$:" \\:' >>$configstatus
  979.     fi
  980. done
  981. echo $SEO "./configure \\" >>$configstatus
  982. for arg
  983. do
  984.     echo "$arg" |\
  985.     sed -e 's:\(["$\\]\):\\\1:g' \
  986.         -e 's:^:":' \
  987.         -e 's:$:" \\:' >>$configstatus
  988. done
  989. echo '"$@"' >>$configstatus
  990. echo '' >>$configstatus
  991. chmod a+x $configstatus
  992.  
  993. ##
  994. ##  a few errors and warnings
  995. ##
  996. if [ "x$suexec" = "x1" ]; then
  997.     if [ "x$suexec_ok" = "x0" ]; then
  998.         echo "configure:Error: You enabled the suEXEC feature via --enable-suexec but"
  999.         echo "                 without explicitly configuring it via at least one"
  1000.         echo "                 --suexec-xxxxx option. Seems like you are still not"
  1001.         echo "                 familiar with the suEXEC risks. Please read the INSTALL"
  1002.         echo "                 and htdocs/manual/suexec.html documents first."
  1003.         exit 1
  1004.     fi
  1005.     if [ "x`$aux/getuid.sh`" != "x0" ]; then
  1006.         echo " + Warning: You have enabled the suEXEC feature. Be aware that you need" 1>&2
  1007.         echo " + root privileges to complete the final installation step." 1>&2
  1008.     fi
  1009. fi
  1010. if [ "x$PERL" = "xno-perl-on-this-system" ]; then
  1011.     if [ "x$quiet" = "xno" ]; then
  1012.         echo " + Warning: no Perl interpreter detected for support scripts."
  1013.         echo " + Perhaps you need to specify one with --with-perl=FILE."
  1014.     fi
  1015. fi
  1016.  
  1017. ##
  1018. ##  target name
  1019. ##
  1020. if [ "x$TARGET" != "x" ]; then
  1021.     thetarget="$TARGET"
  1022. else
  1023.     thetarget=httpd
  1024. fi
  1025.  
  1026. ##
  1027. ##  expand path variables and make sure
  1028. ##  they do not end with a backslash
  1029. ##
  1030. OIFS="$IFS"
  1031. IFS="$DIFS"
  1032. for var in prefix exec_prefix bindir sbindir libexecdir mandir \
  1033.            sysconfdir datadir iconsdir htdocsdir cgidir includedir \
  1034.            localstatedir runtimedir logfiledir proxycachedir \
  1035.            suexec_docroot suexec_logexec; do
  1036.     eval "val=\"\$$var\"";
  1037.     val=`echo $val | sed -e 's:/*$::'`
  1038.     eval "$var=\"$val\""
  1039.     #   expand value
  1040.     eval "val=\$$var"
  1041.     #   automatically add target suffix to path when it's
  1042.     #   requested (path has a trailing plus in config.layout) and
  1043.     #   looks reasonable (i.e. when "apache" or target-name
  1044.     #   still not part of path)
  1045.     eval "autosuffix=\$autosuffix_$var"
  1046.     if [ "x$autosuffix" = "xyes" ]; then
  1047.         addtarget=no
  1048.         if [ "x`echo $val | grep apache`" = "x" ]; then
  1049.             if [ "x`echo $val | grep $thetarget`" = "x" ]; then
  1050.                 addtarget=yes
  1051.             fi
  1052.         fi
  1053.         if [ "x$addtarget" = "xyes" ]; then
  1054.             eval "$var=\"\$$var/$thetarget\""
  1055.         fi
  1056.     fi
  1057. done
  1058. IFS="$OIFS"
  1059.  
  1060. ##
  1061. ##  determine special configurable Makefile targets
  1062. ##
  1063. if [ "x$support" = "x1" ]; then
  1064.     build_support='build-support'
  1065.     if [ "x$name_layout" = "xBinaryDistribution" ]; then
  1066.         install_support='install-binsupport'
  1067.     else
  1068.         install_support='install-support'
  1069.     fi
  1070.     clean_support='clean-support'
  1071.     distclean_support='distclean-support'
  1072. else
  1073.     build_support=''
  1074.     install_support=''
  1075.     clean_support=''
  1076.     distclean_support=''
  1077. fi
  1078.  
  1079. ##
  1080. ##  determine special configuration parameters
  1081. ## 
  1082. ##  The checks via /etc/passwd and /etc/group will obviously fail
  1083. ##  on platforms using NIS. But then you propably do not want a
  1084. ##  UID/GID as production oriented as a web server in NIS anyway.
  1085. ##
  1086. conf_user="nobody"
  1087. conf_group="#-1"
  1088. conf_port="80"
  1089. conf_serveradmin="you@your.address"
  1090. conf_servername="new.host.name"
  1091. if [ "x$confadjust" = "x1" ]; then
  1092.     if [ -f /etc/passwd ]; then
  1093.         for uid in nobody www daemon demon http httpd; do 
  1094.             if [ "x`egrep \^${uid}: /etc/passwd`" != "x" ]; then
  1095.                 conf_user="$uid"
  1096.                 break
  1097.             fi
  1098.         done
  1099.         for gid in nobody nogroup www daemon demon http httpd; do 
  1100.             if [ "x`egrep \^${gid}: /etc/group`" != "x" ]; then
  1101.                 conf_group="$gid"
  1102.                 break
  1103.             fi
  1104.         done
  1105.     fi
  1106.     if [ "x`$aux/getuid.sh`" != "x0" ]; then
  1107.         conf_port="8080"
  1108.     fi
  1109.     conf_serveradmin="`$aux/buildinfo.sh -n %u@%h%d`"
  1110.     conf_servername="`$aux/buildinfo.sh -n %h%d`"
  1111. fi
  1112.  
  1113. ##
  1114. ##  determine prefix-relative paths for directories
  1115. ##  because Apache supports them for the -d and -f 
  1116. ##  options, the LoadModule directive, etc.
  1117. ##
  1118. ##  [we have to make sure that it ends with a slash
  1119. ##   or we cannot support the case where the relative
  1120. ##   path is just the emtpy one, i.e. ""]
  1121. ##
  1122. runtimedir_relative=`echo $runtimedir | sed -e "s:^$prefix/*::" -e 's:\(.\)$:\1/:'`
  1123. logfiledir_relative=`echo $logfiledir | sed -e "s:^$prefix/*::" -e 's:\(.\)$:\1/:'`
  1124. sysconfdir_relative=`echo $sysconfdir | sed -e "s:^$prefix/*::" -e 's:\(.\)$:\1/:'`
  1125. libexecdir_relative=`echo $libexecdir | sed -e "s:^$prefix/*::" -e 's:\(.\)$:\1/:'`
  1126.  
  1127. ##
  1128. ##  check and debug
  1129. ##
  1130. if [ "x$show_layout" = "x1" ]; then
  1131.     echo ""
  1132.     echo "Installation paths:"
  1133.     echo "               prefix: $prefix"
  1134.     echo "          exec_prefix: $exec_prefix" 
  1135.     echo "               bindir: $bindir" 
  1136.     echo "              sbindir: $sbindir" 
  1137.     echo "           libexecdir: $libexecdir" 
  1138.     echo "               mandir: $mandir" 
  1139.     echo "           sysconfdir: $sysconfdir" 
  1140.     echo "              datadir: $datadir" 
  1141.     echo "             iconsdir: $iconsdir" 
  1142.     echo "            htdocsdir: $htdocsdir" 
  1143.     echo "               cgidir: $cgidir" 
  1144.     echo "           includedir: $includedir" 
  1145.     echo "        localstatedir: $localstatedir" 
  1146.     echo "           runtimedir: $runtimedir" 
  1147.     echo "           logfiledir: $logfiledir" 
  1148.     echo "        proxycachedir: $proxycachedir" 
  1149.     echo ""
  1150.     echo "Compilation paths:"
  1151.     echo "           HTTPD_ROOT: $prefix"
  1152.     echo "      SHARED_CORE_DIR: $libexecdir"
  1153.     echo "       DEFAULT_PIDLOG: ${runtimedir_relative}${thetarget}.pid"
  1154.     echo "   DEFAULT_SCOREBOARD: ${runtimedir_relative}${thetarget}.scoreboard"
  1155.     echo "     DEFAULT_LOCKFILE: ${runtimedir_relative}${thetarget}.lock"
  1156.     echo "      DEFAULT_XFERLOG: ${logfiledir_relative}access_log"
  1157.     echo "     DEFAULT_ERRORLOG: ${logfiledir_relative}error_log"
  1158.     echo "    TYPES_CONFIG_FILE: ${sysconfdir_relative}mime.types"
  1159.     echo "   SERVER_CONFIG_FILE: ${sysconfdir_relative}${thetarget}.conf"
  1160.     echo "   ACCESS_CONFIG_FILE: ${sysconfdir_relative}access.conf"
  1161.     echo " RESOURCE_CONFIG_FILE: ${sysconfdir_relative}srm.conf"
  1162.     echo ""
  1163.     if [ "x$suexec" = "x1" ]; then
  1164.         echo "suEXEC setup:"
  1165.         echo "        suexec binary: $sbindir/suexec"
  1166.         echo "        document root: $suexec_docroot"
  1167.         echo "       userdir suffix: $suexec_userdir"
  1168.         echo "              logfile: $suexec_logexec"
  1169.         echo "            safe path: $suexec_safepath"
  1170.         echo "            caller ID: $suexec_caller"
  1171.         echo "      minimum user ID: $suexec_uidmin"
  1172.         echo "     minimum group ID: $suexec_gidmin"
  1173.         echo ""
  1174.     fi
  1175.     exit 0
  1176. fi
  1177.  
  1178. ##
  1179. ##  create Makefile from Makefile.tmpl
  1180. ##
  1181. if [ "x$quiet" = "xno" ]; then
  1182.     echo "Creating $mkf"
  1183. fi
  1184. sed <Makefile.tmpl >$mkf \
  1185. -e "s%@PERL@%$PERL%g" \
  1186. -e "s%@TAR@%$TAR%g" \
  1187. -e "s%@TAROPT@%$TAROPT%g" \
  1188. -e "s%@SRC@%$src%g" \
  1189. -e "s%@MKF@%$mkf%g" \
  1190. -e "s%@AUX@%$aux%g" \
  1191. -e "s%@TARGET@%$thetarget%g" \
  1192. -e "s%@IFLAGS_PROGRAM@%$iflags_program%g" \
  1193. -e "s%@IFLAGS_CORE@%$iflags_core%g" \
  1194. -e "s%@IFLAGS_DSO@%$iflags_dso%g" \
  1195. -e "s%@IFLAGS_SCRIPT@%$iflags_script%g" \
  1196. -e "s%@IFLAGS_DATA@%$iflags_data%g" \
  1197. -e "s%@prefix@%$prefix%g" \
  1198. -e "s%@exec_prefix@%$exec_prefix%g" \
  1199. -e "s%@bindir@%$bindir%g" \
  1200. -e "s%@sbindir@%$sbindir%g" \
  1201. -e "s%@libexecdir@%$libexecdir%g" \
  1202. -e "s%@libexecdir_relative@%$libexecdir_relative%g" \
  1203. -e "s%@mandir@%$mandir%g" \
  1204. -e "s%@sysconfdir@%$sysconfdir%g" \
  1205. -e "s%@datadir@%$datadir%g" \
  1206. -e "s%@iconsdir@%$iconsdir%g" \
  1207. -e "s%@htdocsdir@%$htdocsdir%g" \
  1208. -e "s%@cgidir@%$cgidir%g" \
  1209. -e "s%@localstatedir@%$localstatedir%g" \
  1210. -e "s%@includedir@%$includedir%g" \
  1211. -e "s%@runtimedir@%$runtimedir%g" \
  1212. -e "s%@logfiledir@%$logfiledir%g" \
  1213. -e "s%@proxycachedir@%$proxycachedir%g" \
  1214. -e "s%@suexec@%$suexec%g" \
  1215. -e "s%@suexec_caller@%$suexec_caller%g" \
  1216. -e "s%@suexec_docroot@%$suexec_docroot%g" \
  1217. -e "s%@suexec_logexec@%$suexec_logexec%g" \
  1218. -e "s%@suexec_userdir@%$suexec_userdir%g" \
  1219. -e "s%@suexec_uidmin@%$suexec_uidmin%g" \
  1220. -e "s%@suexec_gidmin@%$suexec_gidmin%g" \
  1221. -e "s%@suexec_safepath@%$suexec_safepath%g" \
  1222. -e "s%@conf_user@%$conf_user%g" \
  1223. -e "s%@conf_group@%$conf_group%g" \
  1224. -e "s%@conf_port@%$conf_port%g" \
  1225. -e "s%@conf_serveradmin@%$conf_serveradmin%g" \
  1226. -e "s%@conf_servername@%$conf_servername%g" \
  1227. -e "s%@build_support@%$build_support%g" \
  1228. -e "s%@install_support@%$install_support%g" \
  1229. -e "s%@clean_support@%$clean_support%g" \
  1230. -e "s%@distclean_support@%$distclean_support%g" \
  1231. -e "s%@SHELL@%$SHELL%g"
  1232.  
  1233. ##
  1234. ##  override default paths in $src/include/httpd.h
  1235. ##  via command line arguments for the compiler
  1236. ##  supplied by a little shell script named $src/apaci
  1237. ##
  1238. echo "#!/bin/sh" >$src/apaci
  1239. echo "## USED AS A COMMAND LINE EXPANDER TO OVERRIDE PATHS" >>$src/apaci
  1240. echo "## WITHOUT DISTURBING THE KNOWN MAKE BUILD PROCESS DISPLAY" >>$src/apaci
  1241. echo "echo '-DHTTPD_ROOT=\"$prefix\"'" >>$src/apaci
  1242. echo "echo '-DSUEXEC_BIN=\"$sbindir/suexec\"'" >>$src/apaci
  1243. echo "echo '-DSHARED_CORE_DIR=\"$libexecdir\"'" >>$src/apaci
  1244. echo "echo '-DDEFAULT_PIDLOG=\"${runtimedir_relative}${thetarget}.pid\"'" >>$src/apaci
  1245. echo "echo '-DDEFAULT_SCOREBOARD=\"${runtimedir_relative}${thetarget}.scoreboard\"'" >>$src/apaci
  1246. echo "echo '-DDEFAULT_LOCKFILE=\"${runtimedir_relative}${thetarget}.lock\"'" >>$src/apaci
  1247. echo "echo '-DDEFAULT_XFERLOG=\"${logfiledir_relative}access_log\"'" >>$src/apaci
  1248. echo "echo '-DDEFAULT_ERRORLOG=\"${logfiledir_relative}error_log\"'" >>$src/apaci
  1249. echo "echo '-DTYPES_CONFIG_FILE=\"${sysconfdir_relative}mime.types\"'" >>$src/apaci
  1250. echo "echo '-DSERVER_CONFIG_FILE=\"${sysconfdir_relative}${thetarget}.conf\"'" >>$src/apaci
  1251. echo "echo '-DACCESS_CONFIG_FILE=\"${sysconfdir_relative}access.conf\"'" >>$src/apaci
  1252. echo "echo '-DRESOURCE_CONFIG_FILE=\"${sysconfdir_relative}srm.conf\"'" >>$src/apaci
  1253. chmod a+x $src/apaci
  1254. CFLAGS="$CFLAGS \\\`\$(SRCDIR)/apaci\\\`"
  1255.  
  1256. ##
  1257. ##  create $src/Configuration.apaci file
  1258. ##
  1259. if [ "x$quiet" = "xno" ]; then
  1260.     echo "Creating Configuration.apaci in $src"
  1261. fi
  1262. rm -f $sedsubst 2>/dev/null
  1263. touch $sedsubst
  1264.  
  1265. #   generate settings from imported environment variables
  1266. OIFS="$IFS"
  1267. IFS="$DIFS"
  1268. for var in CC CPP OPTIM CFLAGS CFLAGS_SHLIB LDFLAGS LD_SHLIB LDFLAGS_SHLIB \
  1269.            LDFLAGS_SHLIB_EXPORT LIBS INCLUDES RANLIB DEPS TARGET; do
  1270.     eval "val=\"\$$var\"";
  1271.     if [ "x$val" != "x" ]; then
  1272.         case $var in 
  1273.             CFLAGS|LDFLAGS|LIBS|INCLUDES|DEPS) 
  1274.                 echo $SEO "s%^#*\\(EXTRA_$var=\\).*%\\1$val%g" >>$sedsubst
  1275.                 ;;
  1276.             *)
  1277.                 echo $SEO "s%^#*\\($var=\\).*%\\1$val%g" >>$sedsubst
  1278.                 ;;
  1279.         esac
  1280.         eval "$var=\"\"; export $var"
  1281.     fi
  1282. done
  1283. IFS="$OIFS"
  1284.  
  1285. #   generate rule directives 
  1286. OIFS="$IFS"
  1287. IFS=':'
  1288. for rule in $rules; do
  1289.     name="`echo $rule | tr '[a-z]' '[A-Z]'`"
  1290.     eval "val=\$rule_$rule"
  1291.     echo $SEO "s%^\\(Rule $name=\\).*%\\1$val%g" >>$sedsubst
  1292.     if [ "x$verbose" = "xyes" ]; then
  1293.         echo " + Rule $name=$val"
  1294.     fi
  1295. done
  1296. IFS="$OIFS"
  1297.  
  1298. #   consistency checks for shared object support
  1299. some_shares=0
  1300. OIFS="$IFS"
  1301. IFS=':'
  1302. for module in $modules; do
  1303.     eval "share=\$shared_$module"
  1304.     if [ "x$share" = "xyes" ]; then
  1305.         some_shares=1
  1306.     fi
  1307. done
  1308. IFS="$OIFS"
  1309. if [ "x$some_shares" = "x1" ]; then
  1310.     if [ "x$module_so" = "xno" ]; then
  1311.         module_so=yes
  1312.         if [ "x$quiet" = "xno" ]; then
  1313.             echo " + enabling mod_so for DSO support"
  1314.         fi
  1315.     fi
  1316. fi
  1317. if [ "x$shared_so" = "xyes" ]; then
  1318.     shared_so=no
  1319.     echo "configure:Error: Module mod_so cannot be made a DSO itself" 1>&2
  1320.     exit 1
  1321. fi
  1322.  
  1323. #   module permutation support
  1324. if [ "x$permute" != "x" ]; then
  1325.     sed -e '/## mod_mmap_static/,$d' <src/Configuration.tmpl >$tplconf
  1326.     OIFS="$IFS"
  1327.     IFS='
  1328. '
  1329.     for line in `cat src/Configuration.tmpl $addconf | egrep '^[# ]*(Add|Shared)Module'`; do
  1330.         name=`echo "$line" |\
  1331.               sed -e 's%^.*/\(.*\)$%\1%' \
  1332.                   -e 's/\.[oa]$//' \
  1333.                   -e 's/\.module$//' \
  1334.                   -e 's/^mod_//' \
  1335.                   -e 's/^lib//'`
  1336.         echo "${name}:${line}"
  1337.     done |\
  1338.     $AWK -F: '
  1339.         BEGIN { 
  1340.             n = 0; 
  1341.         }
  1342.         { 
  1343.             module_pos[$1]  = n; 
  1344.             module_list[n]  = $1; 
  1345.             module_line[$1] = $2;
  1346.             n++; 
  1347.         }
  1348.         END {
  1349.             pn = split(permute, perm, ",");
  1350.             for (p = 1; p <= pn; p++) {
  1351.                 split(perm[p], m, ":")
  1352.                 m1 = m[1];
  1353.                 m2 = m[2];
  1354.                 if (m1 == "BEGIN") {
  1355.                     for (i = module_pos[m2]-1; i >= 0; i--) {
  1356.                         n1 = module_list[i];
  1357.                         n2 = module_list[i+1];
  1358.                         module_list[i]   = n2;
  1359.                         module_list[i+1] = n1;
  1360.                         module_pos[n1]   = i+1;
  1361.                         module_pos[n2]   = i;
  1362.                     }
  1363.                 }
  1364.                 else if (m2 == "END") {
  1365.                     for (i = module_pos[m1]; i < n-1; i++) {
  1366.                         n1 = module_list[i];
  1367.                         n2 = module_list[i+1];
  1368.                         module_list[i]   = n2;
  1369.                         module_list[i+1] = n1;
  1370.                         module_pos[n1]   = i+1;
  1371.                         module_pos[n2]   = i;
  1372.                     }
  1373.                 }
  1374.                 else {
  1375.                     p1 = module_pos[m1];
  1376.                     p2 = module_pos[m2];
  1377.                     n1 = module_list[p1];
  1378.                     n2 = module_list[p2];
  1379.                     module_list[p1] = n2;
  1380.                     module_list[p2] = n1;
  1381.                     module_pos[m1] = p2;
  1382.                     module_pos[m2] = p1;
  1383.                 }
  1384.             }
  1385.             for (i = 0; i < n; i++) {
  1386.                 name = module_list[i];
  1387.                 printf("%s\n", module_line[name]);
  1388.             }
  1389.         }
  1390.     ' "permute=$permute" >>$tplconf
  1391.     IFS="$OIFS"
  1392. else
  1393.     cat $src/Configuration.tmpl $addconf >$tplconf
  1394. fi
  1395.  
  1396. #   generate module directives
  1397. #   (paths are modules/foo/mod_bar.ext and modules/foo/libbar.ext)
  1398. OIFS="$IFS"
  1399. IFS=':'
  1400. for module in $modules; do
  1401.     eval "add=\$module_$module"
  1402.     if [ "x$add" = "xyes" ]; then
  1403.         echo $SEO "s%^.*\\(AddModule.*mod_$module\\..*\\)%\\1%g" >>$sedsubst
  1404.         echo $SEO "s%^.*\\(AddModule.*lib$module\\..*\\)%\\1%g" >>$sedsubst
  1405.         echo $SEO "s%^.*\\(SharedModule.*mod_$module\\..*\\)%\\1%g" >>$sedsubst
  1406.         echo $SEO "s%^.*\\(SharedModule.*lib$module\\..*\\)%\\1%g" >>$sedsubst
  1407.         m="yes"
  1408.     else
  1409.         echo $SEO "s%^.*\\(AddModule.*mod_$module\\..*\\)%# \\1%g" >>$sedsubst
  1410.         echo $SEO "s%^.*\\(AddModule.*lib$module\\..*\\)%# \\1%g" >>$sedsubst
  1411.         echo $SEO "s%^.*\\(SharedModule.*mod_$module\\..*\\)%# \\1%g" >>$sedsubst
  1412.         echo $SEO "s%^.*\\(SharedModule.*lib$module\\..*\\)%# \\1%g" >>$sedsubst
  1413.         m=no
  1414.     fi
  1415.     eval "share=\$shared_$module"
  1416.     if [ "x$share" = "xyes" ]; then
  1417.         echo $SEO "s%^\\(.*\\)AddModule\\(.*mod_$module\\.\\)[oam].*\\(.*\\)%\\1SharedModule\\2so\\3%g" >>$sedsubst
  1418.         echo $SEO "s%^\\(.*\\)AddModule\\(.*lib$module\\.\\)[oam].*\\(.*\\)%\\1SharedModule\\2so\\3%g" >>$sedsubst
  1419.         m="$m [shared]"
  1420.     fi
  1421.     if [ "x$verbose" = "xyes" ]; then
  1422.         echo " + Module $module: $m"
  1423.     fi
  1424. done
  1425. IFS="$OIFS"
  1426.  
  1427. # translate module names to dll names for OS/2 so that they are no more
  1428. # than 8 characters long and have an extension of "dll" instead of "so"
  1429. case $PLATFORM in
  1430.     *OS/2* ) 
  1431.         echo $SEO "s%/mod_\\(.\\{1,8\\}\\).*\\.so%/\\1\\.dll%" >>$sedsubst
  1432.         echo $SEO "s%/\\(lib.*\\)\\.so$%/\\1.dll%" >>$sedsubst
  1433.         ;;
  1434. esac
  1435.  
  1436. #   split sedsubst into chunks of 50 commands
  1437. #   to workaround limits in braindead seds
  1438. files=`$AWK <$sedsubst '
  1439.     BEGIN { line=0; cnt=0; }
  1440.     {
  1441.         if (line % 50 == 0) {
  1442.             file = sedsubst "." cnt;
  1443.             printf("%s\n", file);
  1444.             cnt++;
  1445.         }
  1446.         line++;
  1447.         print $0 >file;
  1448.     }
  1449. ' "sedsubst=$sedsubst"`
  1450. OIFS="$IFS"
  1451. IFS="$DIFS"
  1452. substcmd=""
  1453. for file in $files; do
  1454.     substcmd="${substcmd} sed -f $file |"
  1455. done
  1456. substcmd="${substcmd} cat"
  1457. IFS="$OIFS"
  1458.  
  1459. #   and finally translate the config template 
  1460. #   according to our defined configuration
  1461. eval "cat $tplconf | $substcmd >$src/Configuration.apaci"
  1462.  
  1463. #   cleanup
  1464. rm -f $sedsubst $sedsubst.[0-9] 2>/dev/null
  1465. rm -f $addconf 2>/dev/null
  1466. rm -f $tplconf 2>/dev/null
  1467.  
  1468. ##
  1469. ##  create all other Makefiles by running the proprietary 
  1470. ##  $src/Configure script with our custom Configuration.apaci file
  1471. ##
  1472. if [ "x$quiet" = "xyes" ]; then
  1473.     (cd $src; ./Configure -file Configuration.apaci >/dev/null);
  1474. else
  1475.     (cd $src; ./Configure -file Configuration.apaci |\
  1476.      sed -e '/^Using config file:.*/d' \
  1477.          -e "s:Makefile in :Makefile in $src\\/:" \
  1478.          -e "s:Makefile\$:Makefile in $src:")
  1479. fi
  1480.  
  1481. ##
  1482. ##  final hints
  1483. ##
  1484. if [ "x$quiet" = "xno" ]; then
  1485.     if [ "x$shadow" != "x" ]; then
  1486.         echo "Hint: You now have to build inside $shadow."
  1487.         echo "This can be done either by running the canonical commands"
  1488.         echo "  \$ cd $shadow"
  1489.         echo "  \$ make"
  1490.         echo "  \$ make install"
  1491.         echo "or by running this alternative commands"
  1492.         echo "  \$ make -f $shadow/Makefile"
  1493.         echo "  \$ make -f $shadow/Makefile install"
  1494.     fi
  1495. fi
  1496.  
  1497.