home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / NEXTSTEP / UNIX / Web / Servers / apache-1.2.4-MIHS / original-source / src / Configure < prev    next >
Encoding:
Text File  |  1997-08-21  |  16.2 KB  |  687 lines

  1. #!/bin/sh
  2. trap 'rm -f $tmpfile; exit' 0 1 2 3 15
  3.  
  4. # Apache configuration script, first cut --- rst.
  5. # Dont like it?  Inspired to do something better?  Go for it.
  6.  
  7. # second cut --- jmj
  8. # At this point we change what Configuration contains. It maintain
  9. # contains comments, specific compiler flags, a list of included
  10. # modules and "rules". These rules are used to allow Configure to
  11. # be totally configured from Configuration
  12. #
  13. # Uses 3 supplemental scripts located in ./helpers: CutRule,
  14. # GuessOS and PrintPath
  15. #
  16.  
  17. file=Configuration
  18. tmpfile=htconf.$$
  19. makefile_tmpl=Makefile.tmpl
  20.  
  21. while [ "x$1" != "x" ]; do
  22.   if [ "x$1" = "x-file" ] ; then
  23.     shift 1; file=$1; shift 1
  24.     if [ ! -r $file ]; then
  25.       echo "$file does not exist or is not readable."
  26.       exit 1
  27.     fi
  28.   elif [ "x$1" = "x-make" ] ; then
  29.     shift 1; makefile_tmpl=$1; shift 1
  30.     if [ ! -r $makefile_tmpl ]; then
  31.       echo "$makefile_tmpl does not exist or is not readable."
  32.       exit 1
  33.     fi
  34.   else
  35.     echo "Ignoring command line option '$1'"
  36.     shift 1
  37.   fi
  38. done
  39. echo "Using config file: $file"
  40. echo "Using Makefile template file: $makefile_tmpl"
  41.  
  42. if [ ! -r $file ]; then
  43.   echo "Can't see or read \"$file\""
  44.   exit 1
  45. fi
  46.  
  47. # First, strip comments and blank lines and then change Rules to comments
  48. # and then remove whitespace before Module declarations
  49.  
  50. sed 's/#.*//' $file | \
  51.  sed '/^[     ]*$/d' | \
  52.  sed 's/[     ]*$//' | \
  53.  sed 's/^Rule[     ]*/##Rule:/' | \
  54.  sed 's/^[     ]*Module/Module/' | \
  55.  sed 's/^[        ]*%Module/%Module/' > $tmpfile
  56.  
  57. # Check for syntax errors...
  58.  
  59. if egrep -v '^%?Module[     ]+[A-Za-z0-9_]+[     ]+[^     ]+$' $tmpfile \
  60.    | grep -v = > /dev/null
  61. then
  62.    echo "Syntax error --- The configuration file is used only to"
  63.    echo "define the list of included modules or to set Makefile"
  64.    echo "options or Configure rules, and I don't see that at all:"
  65.    egrep -v '^Module[     ]+[A-Za-z0-9_]+[     ]+[^     ]+$' $tmpfile | \
  66.      grep -v =
  67.    exit 1
  68. fi
  69.  
  70. # File is OK --- make backup copies of things and then get the new ones:
  71.  
  72. if [ -f Makefile ] ; then mv Makefile Makefile.bak; fi
  73. if [ -f modules.c ] ; then mv modules.c modules.c.bak; fi
  74.  
  75. sed -e 's/_module//' $tmpfile | awk >modules.c '\
  76.    BEGIN { modules[n++] = "core" ; pmodules[pn++] = "core"} \
  77.    /^Module/ { modules[n++] = $2 ; pmodules[pn++] = $2 } \
  78.    /^%Module/ { pmodules[pn++] = $2 } \
  79.    END { print "/* modules.c --- automatically generated by Apache"; \
  80.      print " * configuration script.  DO NOT HAND EDIT!!!!!"; \
  81.      print " */"; \
  82.      print ""; \
  83.      print "#include \"httpd.h\""; \
  84.      print "#include \"http_config.h\""; \
  85.      print ""; \
  86.      for (i = 0; i < pn; ++i) { \
  87.          printf ("extern module %s_module;\n", pmodules[i]); \
  88.      } \
  89.      print ""; \
  90.      print "module *prelinked_modules[] = {"; \
  91.      for (i = 0; i < n; ++i) { \
  92.          printf "  &%s_module,\n", modules[i]; \
  93.      } \
  94.      print "  NULL"; \
  95.      print "};"; \
  96.      print "module *preloaded_modules[] = {"; \
  97.      for (i = 0; i < pn; ++i) { \
  98.          printf "  &%s_module,\n", pmodules[i]; \
  99.      } \
  100.      print "  NULL"; \
  101.      print "};"; \
  102.    }'
  103.  
  104. #
  105. # Add module set only
  106. #
  107. echo "#" > Makefile
  108. echo "# Makefile automatically generated from $makefile_tmpl" >> Makefile
  109. echo "# and configuration file by Apache config script." >> Makefile
  110. echo "# Hand-edited changes will be lost if the config script" >> Makefile
  111. echo "# is re-run" >> Makefile
  112. echo "#" >> Makefile
  113.  
  114. awk >>Makefile <$tmpfile '\
  115.    /^Module/ { modules[n++] = $3 } \
  116.    /^%Module/ { modules[n++] = $3 } \
  117.    END { print "MODULES=\\"; \
  118.      for (i = 0; i < n; ++i) { \
  119.          if (i < n-1) printf ("  %s \\\n", modules[i]); \
  120.          else printf ("  %s\n", modules[i]); \
  121.      } \
  122.      print "" \
  123.        }'
  124. #
  125. # Now add Makefile additions and Rules
  126. #
  127. awk >>Makefile <$tmpfile '\
  128.     BEGIN { print "# Makefile options inherited from Configure"; \
  129.         print "###############"; \
  130.       } \
  131.     /\=/ { print } \
  132.     END { print "###############"; }'
  133.  
  134. #
  135. # Extract the rules.
  136. #
  137. RULE_WANTHSREGEX=`./helpers/CutRule WANTHSREGEX $file`
  138. RULE_STATUS=`./helpers/CutRule STATUS $file`
  139. RULE_SOCKS4=`./helpers/CutRule SOCKS4 $file`
  140. RULE_IRIXNIS=`./helpers/CutRule IRIXNIS $file`
  141.  
  142. #
  143. # Now we determine the OS/Platform automagically, thanks to
  144. # GuessOS, a home-brewed OS-determiner ala config.guess
  145. #
  146. # We adjust CFLAGS, LIBS, LFLAGS and INCLUDES (and other Makefile
  147. # options) as required. Setting CC and OPTIM here has no effect
  148. # if they were set in Configure.
  149. #
  150. # Also, we set DEF_WANTHSREGEX and to the appropriate
  151. # value for each platform.
  152. #
  153. # As more PLATFORMs are added to Configuration.tmpl, be sure to
  154. # add the required lines below.
  155. #
  156.  
  157. PLAT=`./helpers/GuessOS`
  158.  
  159. # Preset DBM_LIB. Can be overridden on a per-platform basis.
  160.  
  161. DBM_LIB="-ldbm"
  162.  
  163. #
  164. # Look for ranlib. Do it early in case we want to override it below
  165. #
  166. if ./helpers/PrintPath -s ranlib; then
  167.     RANLIB="ranlib"
  168. else
  169.     RANLIB="true"
  170. fi
  171.  
  172. #
  173. # We now look for popular compilers. As with ranlib, we
  174. # do this early because some options may depend
  175. # on which compiler we use/find
  176. #
  177. for compilers in "gcc" "cc" "acc" "c89"
  178. do
  179.     lookedfor="$lookedfor $compilers"
  180.     if ./helpers/PrintPath -s $compilers; then
  181.     COMPILER="$compilers"
  182.         break
  183.     fi
  184. done
  185.  
  186. #
  187. SHELL="/bin/sh"
  188.  
  189. case "$PLAT" in
  190.     *MPE/iX*)
  191.         OS='MPE/iX'
  192.     CFLAGS="$CFLAGS -DMPE -D_POSIX_SOURCE -D_SOCKET_SOURCE"
  193.     LIBS="$LIBS -lsocket"
  194.     LFLAGS="$LFLAGS -Xlinker \"-WL,cap=ia,ba,ph,pm;nmstack=1024000\""
  195.     ;;
  196.     *-apple-aux3*)
  197.     OS='A/UX 3.1.x'
  198.     CFLAGS="$CFLAGS -DAUX -D_POSIX_SOURCE"
  199.     LIBS="$LIBS -lposix -lbsd"
  200.     LFLAGS="$LFLAGS -s"
  201.     DEF_WANTHSREGEX=no
  202.     ;;
  203.     i386-ibm-aix*)
  204.         OS='IBM AIX PS/2'
  205.     CFLAGS="$CFLAGS -DAIX -U__STR__ -DUSEBCOPY"
  206.     DEF_WANTHSREGEX=no
  207.     ;;
  208.     *-ibm-aix[1-3].*|*-ibm-aix4.[0-1])
  209.         OS='IBM AIX < v4.2'
  210.         CFLAGS="$CFLAGS -DAIX -DNEED_RLIM_T -U__STR__"
  211.         ;;
  212.     *-ibm-aix*)
  213.         OS='IBM AIX >= 4.2'
  214.         CFLAGS="$CFLAGS -DAIX -U__STR__"
  215.     LFLAGS="$LFLAGS -lm"
  216.         ;;
  217.     *-apollo-*)
  218.     OS='Apollo Domain'
  219.     CFLAGS="$CFLAGS -DAPOLLO"
  220.     ;;
  221.     *-dg-dgux*)
  222.     OS='DG/UX 5.4'
  223.     CFLAGS="$CFLAGS -DDGUX"
  224.     DEF_WANTHSREGEX=yes
  225.     ;;
  226.     *OS/2*)
  227.     DEF_WANTHSREGEX=yes
  228.     OS='EMX OS/2'
  229.     CFLAGS="$CFLAGS -Zbsd-signals -Zbin-files -DTCPIPV4 -g"
  230.     LIBS="$LIBS -lsocket -llibufc -lbsd"
  231.     DBM_LIB="-lgdbm"
  232.     ;;
  233.     *-hi-hiux)
  234.     OS='HI-UX'
  235.     CFLAGS="$CFLAGS -DHIUX"
  236.     # if we're using the HIUX compiler, add a few flags.
  237.     if [ "$CC" = "cc" ] || [ "$COMPILER" = "cc" ]; then
  238.         CFLAGS="$CFLAGS -Aa -D_HIUX_SOURCE"
  239.         OPTIM=" "
  240.     fi
  241.     ;;
  242.     *-hp-hpux10.*)
  243.     OS='HP-UX 10'
  244.     CFLAGS="$CFLAGS -DHPUX10"
  245.     # if we're using the HPUX compiler, add a few flags.
  246.     if [ "$CC" = "cc" ] || [ "$COMPILER" = "cc" ]; then
  247.         CFLAGS="$CFLAGS -Aa -D_HPUX_SOURCE"
  248.         OPTIM=" "
  249.     fi
  250.     ;;
  251.     *-hp-hpux*)
  252.     OS='HP-UX'
  253.     CFLAGS="$CFLAGS -DHPUX"
  254.     if [ "$CC" = "cc" ] || [ "$COMPILER" = "cc" ]; then
  255.         CFLAGS="$CFLAGS -Aa -D_HPUX_SOURCE"
  256.         OPTIM=" "
  257.     fi
  258.     ;;
  259.     *-sgi-irix64)
  260. # Note: We'd like to see patches to compile 64-bit, but for now...
  261.     echo "You are running 64-bit Irix. For now, we will compile 32-bit"
  262.     echo "but if you would care to port to 64-bit, send us the patches."
  263.     CFLAGS="$CFLAGS -n32"
  264.     LFLAGS="$LFLAGS -n32"
  265.     DEF_WANTHSREGEX=yes
  266.     DBM_LIB=""
  267.     if [ "$RULE_IRIXNIS" = "yes" ]; then
  268.         OS='SGI IRIX w/NIS'
  269.         CFLAGS="$CFLAGS -DIRIX"
  270.         LIBS="$LIBS -lsun"
  271.     else
  272.         OS='SGI IRIX'
  273.         CFLAGS="$CFLAGS -DIRIX"
  274.     fi
  275.     ;;
  276.     *-sgi-irix)
  277.     DEF_WANTHSREGEX=yes
  278.     DBM_LIB=""
  279.     if [ "$RULE_IRIXNIS" = "yes" ]; then
  280.         OS='SGI IRIX w/NIS'
  281.         CFLAGS="$CFLAGS -DIRIX"
  282.         LIBS="$LIBS -lsun"
  283.     else
  284.         OS='SGI IRIX'
  285.         CFLAGS="$CFLAGS -DIRIX"
  286.     fi
  287.     ;;
  288.     alpha-*-linux2)
  289.     DEF_WANTHSREGEX=yes
  290.     OS='Linux'
  291.     CFLAGS="$CFLAGS -DLINUX=2"
  292.     LIBS="$LIBS -lcrypt"
  293.     ;;
  294.     sparc-*-linux2)
  295.     DEF_WANTHSREGEX=yes
  296.     OS='Linux'
  297.     CFLAGS="$CFLAGS -DLINUX=2"
  298.     LIBS="$LIBS -lm"
  299.     ;;
  300.     *-linux2)
  301.     DEF_WANTHSREGEX=yes
  302.     OS='Linux'
  303.     CFLAGS="$CFLAGS -DLINUX=2"
  304.     ;;
  305.     *-linux1)
  306.     DEF_WANTHSREGEX=yes
  307.     OS='Linux'
  308.     CFLAGS="$CFLAGS -DLINUX=1"
  309.     ;;
  310.     *-lynx-lynxos*)
  311.     OS='LynxOS'
  312.     CFLAGS="$CFLAGS -DLYNXOS"
  313.     LIBS="$LIBS -lbsd -ldes -lc_p"
  314.     ;;
  315.     *486-*-bsdi*)
  316.     OS='BSDI w/486'
  317.     CFLAGS="$CFLAGS -m486"
  318.     DBM_LIB=""
  319.     ;;
  320.     *-bsdi*)
  321.     OS='BSDI'
  322.     DBM_LIB=""
  323.     ;;
  324.     *486-*-freebsd*|*486-*-netbsd*)
  325.     OS='FreeBSD/NETBSD on 486'
  326.     LIBS="$LIBS -lcrypt"
  327.     DBM_LIB=""
  328.     ;;
  329.     *-freebsd*|*-netbsd*)
  330.     OS='FreeBSD/NetBSD'
  331.     LIBS="$LIBS -lcrypt"
  332.     DBM_LIB=""
  333.     ;;
  334.     *-openbsd*)
  335.     OS='OpenBSD'
  336.     ;;
  337.     *-next-nextstep*)
  338.     OS='NeXT'
  339.     CFLAGS="$CFLAGS -DNEXT"
  340.     DEF_WANTHSREGEX=yes
  341.     RANLIB="sleep 5; /bin/ranlib"
  342.     # ranlib on most NeXTs sets the time wrong. 5 secs wait does much good
  343.     ;;
  344.     *-dec-osf*)
  345.     OS='DEC OSF/1'
  346.     CFLAGS="$CFLAGS -DOSF1"
  347.     LIBS="$LIBS -lm"
  348.     ;;
  349.     *-qnx)
  350.     OS='QNX'
  351.     CFLAGS="$CFLAGS -DQNX"
  352.     LIBS="$LIBS -N128k -lsocket"
  353.     DEF_WANTHSREGEX=yes
  354.     ;;
  355.     *-qnx32)
  356.     OS='QNX32'
  357.     CFLAGS="$CFLAGS -DQNX -mf -3"
  358.     LIBS="$LIBS -N128k -lsocket"
  359.     DEF_WANTHSREGEX=yes
  360.     ;;
  361.     *-isc4*)
  362.     OS='ISC 4'
  363.     CC='gcc'
  364.     CFLAGS="$CFLAGS -posix -DISC"
  365.     LFLAGS="$LFLAGS -posix"
  366.     LIBS="$LIBS -linet"
  367.     DEF_WANTHSREGEX=yes
  368.     ;;
  369.     *-sco3*)
  370.     OS='SCO 3'
  371.     CFLAGS="$CFLAGS -DSCO -Oacgiltz"
  372.     LIBS="$LIBS -lPW -lsocket -lmalloc -lcrypt_i"
  373.     DEF_WANTHSREGEX=yes
  374.     ;;
  375.     *-sco5*)
  376.     OS='SCO 5'
  377.     CFLAGS="$CFLAGS -DSCO5"
  378.     LIBS="$LIBS -lsocket -lmalloc -lprot"
  379.     if [ "$CC" = "cc" ] || [ "$COMPILER" = "cc" ]; then
  380.         OSBPRINTF="-K noinline"
  381.     fi
  382.     DEF_WANTHSREGEX=no
  383.     ;;
  384.     *-solaris2*)
  385.     OS='Solaris 2'
  386.     CFLAGS="$CFLAGS -DSOLARIS2"
  387.     LIBS="$LIBS -lsocket -lnsl"
  388.     DBM_LIB=""
  389.     DEF_WANTHSREGEX=yes
  390.     ;;
  391.     *-sunos4*)
  392.     OS='SunOS 4'
  393.     CFLAGS="$CFLAGS -DSUNOS4 -DUSEBCOPY"
  394.     DEF_WANTHSREGEX=yes
  395.     ;;
  396.     *-unixware1)
  397.     DEF_WANTHSREGEX=yes
  398.     OS='Unixware'
  399.     CFLAGS="$CFLAGS -DSVR4 -DNO_LINGCLOSE"
  400.     LIBS="$LIBS -lsocket -lnsl -lcrypt"
  401.     ;;
  402.     *-unixware2)
  403.     DEF_WANTHSREGEX=yes
  404.     OS='Unixware'
  405.     CFLAGS="$CFLAGS -DSVR4 -DNO_LINGCLOSE"
  406.     LIBS="$LIBS -lsocket -lnsl -lcrypt"
  407.     ;;
  408.     *-unixware211)
  409.     OS='Unixware 2.1.1'
  410.     CFLAGS="$CFLAGS -DUW"
  411.     LIBS="$LIBS -lsocket -lnsl -lcrypt"
  412.     ;;
  413.     *-unixware212)
  414.     OS='Unixware 2.1.2'
  415.     CFLAGS="$CFLAGS -DUW"
  416.     LIBS="$LIBS -lsocket -lnsl -lcrypt"
  417.     DBM_LIB=""
  418.     ;;
  419.     maxion-*-sysv4*)
  420.         OS='SVR4'
  421.     CFLAGS="$CFLAGS -DSVR4"
  422.     DEF_WANTHSREGEX=yes
  423.     LIBS="$LIBS -lsocket -lnsl -lc -lgen"
  424.     ;;
  425.     *-sni-sysv4*)
  426.     OS='SVR4'
  427.     CFLAGS="$CFLAGS -DSVR4"
  428.     DEF_WANTHSREGEX=yes
  429.     LIBS="$LIBS -lsocket -lnsl -lc"
  430.     ;;
  431.     DS/90\ 7000-*-sysv4*)
  432.     OS='UXP/DS'
  433.     CFLAGS="$CFLAGS -DUXPDS"
  434.     LIBS="$LIBS -lsocket -lnsl"
  435.     DEF_WANTHSREGEX=yes
  436.     ;;
  437.     *-tandem-sysv4*)
  438.     OS='SVR4'
  439.     CFLAGS="$CFLAGS -DSVR4"
  440.     LIBS="$LIBS -lsocket -lnsl"
  441.     DEF_WANTHSREGEX=yes
  442.     ;;
  443.     *-sysv4*)
  444.     OS='SVR4'
  445.     CFLAGS="$CFLAGS -DSVR4"
  446.     LIBS="$LIBS -lsocket -lnsl -lc"
  447.     ;;
  448.     *-uts*)
  449.     OS='Amdahl UTS'
  450.     CFLAGS="$CFLAGS -Xa -eft -DUTS21"
  451.     LIBS="$LIBS -lsocket -lbsd -la"
  452.     ;;
  453.     *-ultrix)
  454.     OS='ULTRIX'
  455.     CFLAGS="-DULTRIX"
  456.     DEF_WANTHSREGEX=yes
  457.     SHELL="/bin/sh5"
  458.     if [ "$CC" = "cc" ] || [ "$COMPILER" = "cc" ]; then
  459.         CFLAGS="$CFLAGS -std"
  460.     fi
  461.     ;;
  462.     *powerpc-tenon-machten*)
  463.     OS='MachTen PPC'
  464.     LFLAGS="$LFLAGS -Xlstack=0x14000 -Xldelcsect"
  465.     ;;
  466.     *-machten*)
  467.     OS='MachTen 68K'
  468.     LFLAGS="$LFLAGS -stack 0x14000"
  469.     DEF_WANTHSREGEX=yes
  470.     ;;
  471.     *convex-v11*)
  472.     OS='CONVEXOS11'
  473.     CFLAGS="$CFLAGS -ext -DCONVEXOS11"
  474.     OPTIM="-O1" # scalar optimization only
  475.     CC='cc'
  476.     DEF_WANTHSREGEX=yes
  477.     ;;
  478.     i860-intel-osf1)
  479.     DEF_WANTHSREGEX=yes
  480.     OS='Paragon OSF/1'
  481.     CFLAGS="$CFLAGS -DPARAGON"
  482.     ;;
  483.     *) # default: Catch systems we don't know about
  484.         echo Sorry, but we cannot grok \"$PLAT\"
  485.     echo uname -m
  486.     uname -m
  487.     echo uname -r
  488.     uname -r
  489.     echo uname -s
  490.     uname -s
  491.     echo uname -v
  492.     uname -v
  493.     echo uname -X
  494.     uname -X
  495.     echo Ideally, read the file PORTING, do what it says, and send the
  496.     echo resulting patches to The Apache Group by filling out a report
  497.     echo form at http://www.apache.org/bugdb.cgi - or, if your browser
  498.     echo isn\'t forms-capable, you can send them via email to 
  499.     echo apache-bugs@apache.org.  If you don\'t wish to do the port
  500.     echo yourself, please submit this output rather than the patches.
  501.     echo Thank you
  502.     exit 1
  503.     ;;
  504. esac
  505.  
  506. #
  507. # See if we need to override WANTHSREGEX
  508. #
  509. if [ "$RULE_WANTHSREGEX" = "default" ]; then
  510.     if [ "x$DEF_WANTHSREGEX" = "x" ]; then
  511.         RULE_WANTHSREGEX=no
  512.     else
  513.         RULE_WANTHSREGEX=$DEF_WANTHSREGEX
  514.     fi
  515. fi
  516.  
  517. # Show the final values of the rules
  518.  
  519. echo "###############" > Makefile.config
  520. echo "# Platform: $OS" >> Makefile.config
  521. echo "# Final Rules:" >> Makefile.config
  522. echo "#  Rule WANTHSREGEX=$RULE_WANTHSREGEX" >> Makefile.config
  523. echo "###############" >> Makefile.config
  524.  
  525. #
  526. # Now that _that's_ done, get on with it
  527. #
  528.  
  529. echo " + configured for $OS platform"
  530.  
  531. #
  532. # Now we determine the C-compiler and optimization level
  533. # to use. Settings of CC and OPTIM in Configuration have
  534. # the highest precedence; next comes any settings from
  535. # the above "OS-specific" section. If still unset,
  536. # then we use the "found" location of COMPILERS above
  537. # and set a "safe" optimization level
  538. #
  539.  
  540. if egrep "^CC[     ]*=" Makefile > /dev/null; then
  541.     CC=""    # clear it just in case
  542. else
  543.     if [ "x$CC" = "x" ]; then
  544.         if [ "x$COMPILER" = "x" ]; then
  545.         echo "Error: could not find any of these C compilers"
  546.         echo " anywhere in your PATH: $lookedfor"
  547.         echo "Configure terminated"
  548.         exit 1
  549.     fi
  550.     CC=$COMPILER
  551.     fi
  552.     echo " + setting C compiler to $CC"
  553. fi
  554.  
  555. #
  556. # Ditto for optimization
  557. #
  558. if  egrep "^OPTIM[     ]*=" Makefile > /dev/null; then
  559.     OPTIM=""    # ditto
  560. else
  561.     if [ "x$OPTIM" = "x" ]; then
  562.     OPTIM="-O2"
  563.     fi
  564.     echo " + setting C compiler optimization-level to $OPTIM"
  565. fi
  566.  
  567. #
  568. # Are they using the status monitor module? If so, check
  569. # for STATUS rule...
  570. #
  571. STAT_MOD="mod_status"
  572. if grep "$STAT_MOD" Makefile > /dev/null; then
  573.     if [ "$RULE_STATUS" = "yes" ]; then
  574.     CFLAGS="$CFLAGS -DSTATUS"
  575.     fi
  576. fi
  577.  
  578. #
  579. # Are they using dbm auth? If so, add DBM library.
  580. #
  581. if grep mod_auth_dbm Makefile > /dev/null; then
  582.     LIBS="$LIBS $DBM_LIB"
  583. fi
  584.  
  585. #
  586. # Now HS's POSIX regex implementation if needed/wanted
  587. #
  588. if [ "$RULE_WANTHSREGEX" = "yes" ]; then
  589.     REGLIB="regex/libregex.a"
  590.     INCLUDES="$INCLUDES -Iregex"
  591. fi
  592.  
  593. #
  594. # Now SOCKS4.
  595. #  NOTE: We assume that if they are using SOCKS4, then they've
  596. #   adjusted EXTRA_LIBS and/or EXTRA_LFLAGS as required,
  597. #   otherwise we assume "-L/usr/local/lib -lsocks"
  598. #
  599. if [ "$RULE_SOCKS4" = "yes" ]; then
  600.     # Set flag and check Makefile for -lsocks line
  601.     CFLAGS="$CFLAGS -Dconnect=Rconnect -Dselect=Rselect"
  602.     CFLAGS="$CFLAGS -Dgethostbyname=Rgethostbyname"
  603.     if [ "$OS" = "Solaris 2" ]; then
  604.     LIBS="$LIBS -lresolv"
  605.     fi
  606.     if grep "EXTRA_" Makefile | grep "\-lsocks" > /dev/null; then : ;
  607.     else
  608.     LIBS="$LIBS -L/usr/local/lib -lsocks"
  609.     fi
  610. fi
  611.  
  612. #
  613. # Good enough
  614. #
  615. echo  >> Makefile
  616. if [ "x$CC" != "x" ]; then
  617.     echo "CC=$CC" >> Makefile.config
  618. fi
  619. if [ "x$OPTIM" != "x" ]; then
  620.     echo "OPTIM=$OPTIM" >> Makefile.config
  621. fi
  622. echo "CFLAGS1=$CFLAGS">> Makefile.config
  623. echo "INCLUDES1=$INCLUDES">> Makefile.config
  624. echo "LIBS1=$LIBS">> Makefile.config
  625. echo "LFLAGS1=$LFLAGS">> Makefile.config
  626. echo "BROKEN_BPRINTF_FLAGS=$OSBPRINTF">> Makefile.config
  627. echo "REGLIB=$REGLIB">> Makefile.config
  628. echo "RANLIB=$RANLIB">> Makefile.config
  629. echo "SHELL=$SHELL">> Makefile.config
  630. echo >> Makefile.config
  631. echo "#### End of Configure created section ####">> Makefile.config
  632.  
  633.  
  634. # Now (finish) creating the makefiles
  635. cat Makefile.config >> Makefile
  636. sed -e "s#@@Configuration@@#$file#" "$makefile_tmpl" >>Makefile
  637. awk >>Makefile <$tmpfile \
  638.    '($1 == "Module" && $3 ~ /modules\//) { printf "%s: modules/last-built ; @cat /dev/null\n\n", $3, $3}'
  639. cat Makefile.config ../support/Makefile.tmpl > ../support/Makefile
  640.  
  641. cat << EOF > modules/Makefile
  642. # Simple Makefile for modules in src/modules.
  643. # Generated by src/Configure according to rules in src/Configuration;
  644. # hand-edit at your own risk!
  645.  
  646. SHELL=$SHELL
  647. EOF
  648.  
  649. if [ "$RULE_WANTHSREGEX" = "yes" ]; then
  650.     INCLUDES2="-I../../regex"
  651. fi
  652.  
  653. echo "INCLUDES2=$INCLUDES2">> modules/Makefile
  654. echo "MOD_CFLAGS=\$(INCLUDES2) \$(AUX_CFLAGS)">> modules/Makefile
  655.  
  656. awk >> modules/Makefile < $tmpfile '\
  657.    BEGIN {printf "MODULES="} \
  658.    ($1 == "Module" && $3 ~ /modules\//) {split ($3, pp, "/"); printf "%s ", pp[2]} \
  659.    END {printf "\n"}'
  660.  
  661. awk >> modules/Makefile < $tmpfile '\
  662.    BEGIN {printf "CLEANERS="} \
  663.    ($1 == "Module" && $3 ~ /modules\//) {split ($3, pp, "/"); printf "%s_clean ", pp[2]} \
  664.    END {printf "\n"}'
  665.  
  666. cat << EOF >> modules/Makefile
  667.  
  668. default: \$(MODULES)
  669.     @echo "Done building module subdirectories"
  670.  
  671. clean: \$(CLEANERS)
  672.     @echo "Done cleaning module subdirectories"
  673.  
  674. placeholder \$(MODULES): ForceMe
  675.     (cd \$@; \$(MAKE) CC=\$(CC) AUX_CFLAGS='\$(MOD_CFLAGS)' RANLIB='\$(RANLIB)')
  676.  
  677. ForceMe:
  678.  
  679. EOF
  680.  
  681. awk >>modules/Makefile <$tmpfile \
  682.    '($1 == "Module" && $3 ~ /modules\//) { split ($3, pp, "/"); \
  683.    printf "%s_clean:\n\t(cd %s; $(MAKE) clean)\n\n", pp[2], pp[2]}'
  684.  
  685.