home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / apac1319.zip / configure < prev    next >
Text File  |  2001-02-07  |  56KB  |  1,598 lines

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