jim         97/07/17 10:12:42

  Modified:    src       Configure
               src/helpers  TestLib
  Log:
  Configure: Clean up comments and let them stand out, almost module-like
  TestLib: Instead of creating a.out, use dummy
  
  Revision  Changes    Path
  1.112     +59 -43    apache/src/Configure
  
  Index: Configure
  ===================================================================
  RCS file: /export/home/cvs/apache/src/Configure,v
  retrieving revision 1.111
  retrieving revision 1.112
  diff -C3 -r1.111 -r1.112
  *** Configure 1997/07/17 03:03:20     1.111
  --- Configure 1997/07/17 17:12:40     1.112
  ***************
  *** 10,29 ****
    # modules and "rules". These rules are used to allow Configure to
    # be totally configured from Configuration
    #
  ! # Uses 3 supplemental scripts located in ./helpers: CutRule,
  ! # GuessOS and PrintPath
  ! #
  ! #
  ! # Setup some defaults
  ! #
    file=Configuration
    tmpfile=htconf.$$
    makefile_tmpl=Makefile.tmpl
    
  ! #
  ! # Now handle any arguments, which, for now, are -file and -make
  ! # to select alternate Configuration and Makefile.tmpl files
  ! #
    while [ "x$1" != "x" ]; do
      if [ "x$1" = "x-file" ] ; then
        shift 1; file=$1; shift 1
  --- 10,32 ----
    # modules and "rules". These rules are used to allow Configure to
    # be totally configured from Configuration
    #
  ! # Uses 4 supplemental scripts located in ./helpers:
  ! #   CutRule: Determines the value for a specified Rule
  ! #   GuessOS: Uses uname to determine OS/platform
  ! #   PrintPath: generic "type" or "whence" replacement
  ! #   TestLib: See if a specified library is available
  ! #
  ! ####################################################################
  ! ## Setup some defaults
  ! ##
    file=Configuration
    tmpfile=htconf.$$
    makefile_tmpl=Makefile.tmpl
    
  ! ####################################################################
  ! ## Now handle any arguments, which, for now, are -file and -make
  ! ## to select alternate Configuration and Makefile.tmpl files
  ! ##
    while [ "x$1" != "x" ]; do
      if [ "x$1" = "x-file" ] ; then
        shift 1; file=$1; shift 1
  ***************
  *** 50,57 ****
      exit 1
    fi
    
    #
  ! # First, strip comments and blank lines, remove whitespace around
    # "=" assignments, change Rules to comments and then remove whitespace
    # before Module declarations
    #
  --- 53,64 ----
      exit 1
    fi
    
  + ####################################################################
  + ## From the Configuration file, create a "cleaned-up" version
  + ## that's easy to scan
  + ##
    #
  ! # Strip comments and blank lines, remove whitespace around
    # "=" assignments, change Rules to comments and then remove whitespace
    # before Module declarations
    #
  ***************
  *** 64,80 ****
     sed 's/^[        ]*%Module/%Module/' > $tmpfile
    
    #
  ! # Check for syntax errors...
    #
    if egrep -v '^%?Module[     ]+[A-Za-z0-9_]+[        ]+[^    ]+$' $tmpfile \
  !    | grep -v = > /dev/null
    then
  !    echo "Syntax error --- The configuration file is used only to"
  !    echo "define the list of included modules or to set Makefile"
  !    echo "options or Configure rules, and I don't see that at all:"
  !    egrep -v '^Module[       ]+[A-Za-z0-9_]+[        ]+[^    ]+$' $tmpfile | 
\
  !      grep -v =
  !    exit 1
    fi
    
    #
  --- 71,89 ----
     sed 's/^[        ]*%Module/%Module/' > $tmpfile
    
    #
  ! # Only "assignment" ("=") statements and Module lines
  ! # should be left at this point. If there is other stuff
  ! # we bail out
    #
    if egrep -v '^%?Module[     ]+[A-Za-z0-9_]+[        ]+[^    ]+$' $tmpfile \
  !  | grep -v = > /dev/null
    then
  !   echo "Syntax error --- The configuration file is used only to"
  !   echo "define the list of included modules or to set Makefile"
  !   echo "options or Configure rules, and I don't see that at all:"
  !   egrep -v '^Module[        ]+[A-Za-z0-9_]+[        ]+[^    ]+$' $tmpfile | 
\
  !    grep -v =
  !   exit 1
    fi
    
    #
  ***************
  *** 83,92 ****
    if [ -f Makefile ] ; then mv Makefile Makefile.bak; fi
    if [ -f modules.c ] ; then mv modules.c modules.c.bak; fi
    
  ! #
    # Start building the modules.c file from what was included
    # in Configuration
  ! #
    sed -e 's/_module//' $tmpfile | awk >modules.c '\
       BEGIN { modules[n++] = "core" ; pmodules[pn++] = "core"} \
       /^Module/ { modules[n++] = $2 ; pmodules[pn++] = $2 } \
  --- 92,101 ----
    if [ -f Makefile ] ; then mv Makefile Makefile.bak; fi
    if [ -f modules.c ] ; then mv modules.c modules.c.bak; fi
    
  ! ####################################################################
    # Start building the modules.c file from what was included
    # in Configuration
  ! ####
    sed -e 's/_module//' $tmpfile | awk >modules.c '\
       BEGIN { modules[n++] = "core" ; pmodules[pn++] = "core"} \
       /^Module/ { modules[n++] = $2 ; pmodules[pn++] = $2 } \
  ***************
  *** 116,124 ****
         print "};"; \
       }'
    
  ! #
    # Start creating the Makefile. We add some comments and
  ! # then fold in the modules
    #
    echo "#" > Makefile
    echo "# Makefile automatically generated from $makefile_tmpl" >> Makefile
  --- 125,133 ----
         print "};"; \
       }'
    
  ! ####################################################################
    # Start creating the Makefile. We add some comments and
  ! # then fold in the modules that were included in Configuration
    #
    echo "#" > Makefile
    echo "# Makefile automatically generated from $makefile_tmpl" >> Makefile
  ***************
  *** 137,143 ****
         } \
         print "" \
           }'
  ! #
    # Now we create a stub file, called Makefile.config, which
    # just includes those assignments (eg: CC=gcc) in Configuration
    #
  --- 146,153 ----
         } \
         print "" \
           }'
  ! 
  ! ####################################################################
    # Now we create a stub file, called Makefile.config, which
    # just includes those assignments (eg: CC=gcc) in Configuration
    #
  ***************
  *** 148,154 ****
        /\=/ { print } \
        END { print "###############"; }'
    
  ! #
    # Extract the rules.
    #
    RULE_WANTHSREGEX=`./helpers/CutRule WANTHSREGEX $file`
  --- 158,164 ----
        /\=/ { print } \
        END { print "###############"; }'
    
  ! ####################################################################
    # Extract the rules.
    #
    RULE_WANTHSREGEX=`./helpers/CutRule WANTHSREGEX $file`
  ***************
  *** 156,162 ****
    RULE_SOCKS4=`./helpers/CutRule SOCKS4 $file`
    RULE_IRIXNIS=`./helpers/CutRule IRIXNIS $file`
    
  ! #
    # Preset some "constants"; can be overridden on a per-platform basis below.
    #
    DBM_LIB="-ldbm"
  --- 166,172 ----
    RULE_SOCKS4=`./helpers/CutRule SOCKS4 $file`
    RULE_IRIXNIS=`./helpers/CutRule IRIXNIS $file`
    
  ! ####################################################################
    # Preset some "constants"; can be overridden on a per-platform basis below.
    #
    DBM_LIB="-ldbm"
  ***************
  *** 168,175 ****
        RANLIB="true"
    fi
    
  ! #
  ! #
    # Now we determine the OS/Platform automagically, thanks to
    # GuessOS, a home-brewed OS-determiner ala config.guess
    #
  --- 178,184 ----
        RANLIB="true"
    fi
    
  ! ####################################################################
    # Now we determine the OS/Platform automagically, thanks to
    # GuessOS, a home-brewed OS-determiner ala config.guess
    #
  ***************
  *** 492,498 ****
    esac
    
    #
  ! # See if we need to override WANTHSREGEX
    #
    if [ "$RULE_WANTHSREGEX" = "default" ]; then
        if [ "x$DEF_WANTHSREGEX" = "x" ]; then
  --- 501,507 ----
    esac
    
    #
  ! # And adjust/override WANTHSREGEX as needed
    #
    if [ "$RULE_WANTHSREGEX" = "default" ]; then
        if [ "x$DEF_WANTHSREGEX" = "x" ]; then
  ***************
  *** 502,514 ****
        fi
    fi
    
  ! #
  ! # Now that _that's_ done, get on with it
    #
    echo " + configured for $OS platform"
    
  ! #
  ! # Show the final values of the rules
    #
    echo "###############" >> Makefile.config
    echo "# Platform: $OS" >> Makefile.config
  --- 511,523 ----
        fi
    fi
    
  ! ####################################################################
  ! # Show user what OS we came up with
    #
    echo " + configured for $OS platform"
    
  ! ####################################################################
  ! # And update Makefile.config with what we came up with
    #
    echo "###############" >> Makefile.config
    echo "# Platform: $OS" >> Makefile.config
  ***************
  *** 516,522 ****
    echo "#  Rule WANTHSREGEX=$RULE_WANTHSREGEX" >> Makefile.config
    echo "###############" >> Makefile.config
    
  ! #
    # Now we determine the C-compiler and optimization level
    # to use. Settings of CC and OPTIM in Configuration have
    # the highest precedence; next comes any settings from
  --- 525,531 ----
    echo "#  Rule WANTHSREGEX=$RULE_WANTHSREGEX" >> Makefile.config
    echo "###############" >> Makefile.config
    
  ! ####################################################################
    # Now we determine the C-compiler and optimization level
    # to use. Settings of CC and OPTIM in Configuration have
    # the highest precedence; next comes any settings from
  ***************
  *** 564,577 ****
        echo " + setting C compiler optimization-level to $OPTIM"
    fi
    
  ! #
    # Set the value of CC if need be; don't worry about OPTIM yet
    #
    if [ "x$TCC" = "x" ]; then
        echo "CC=$CC" >> Makefile.config
    fi
    
  ! #
    # Now we do some OS specific adjustments... for some OSs, we need
    # to adjust CFLAGS and/or OPTIM depending on which compiler we
    # are going to use. This is easy, since this can be gleamed from
  --- 573,586 ----
        echo " + setting C compiler optimization-level to $OPTIM"
    fi
    
  ! ####################################################################
    # Set the value of CC if need be; don't worry about OPTIM yet
    #
    if [ "x$TCC" = "x" ]; then
        echo "CC=$CC" >> Makefile.config
    fi
    
  ! ####################################################################
    # Now we do some OS specific adjustments... for some OSs, we need
    # to adjust CFLAGS and/or OPTIM depending on which compiler we
    # are going to use. This is easy, since this can be gleamed from
  ***************
  *** 605,618 ****
        ;;
    esac
    
  ! #
    # OK, now we can write OPTIM
    #
    if [ "x$TOPTIM" = "x" ]; then
        echo "OPTIM=$OPTIM" >> Makefile.config
    fi
    
  ! #
    # Now we do some general checks and some intelligent Configuration
    # control.
    #
  --- 614,627 ----
        ;;
    esac
    
  ! ####################################################################
    # OK, now we can write OPTIM
    #
    if [ "x$TOPTIM" = "x" ]; then
        echo "OPTIM=$OPTIM" >> Makefile.config
    fi
    
  ! ####################################################################
    # Now we do some general checks and some intelligent Configuration
    # control.
    #
  ***************
  *** 658,665 ****
        fi
    fi
    
  ! #
  ! # FINALLY, finish (with the exception of LIBS) building Makefile.config
    #
    echo "CFLAGS1=$CFLAGS">> Makefile.config
    echo "INCLUDES1=$INCLUDES">> Makefile.config
  --- 667,675 ----
        fi
    fi
    
  ! ####################################################################
  ! # Continue building Makefile.config. We can add all flags with
  ! # the exception of LIBS at this point
    #
    echo "CFLAGS1=$CFLAGS">> Makefile.config
    echo "INCLUDES1=$INCLUDES">> Makefile.config
  ***************
  *** 669,675 ****
    echo "RANLIB=$RANLIB">> Makefile.config
    echo "SHELL=$SHELL">> Makefile.config
    
  ! #
    # This would be the area to do any ./helpers/TestLib tests,
    # before we actually write LIBS to Makefile.config.
    # Punt for now...
  --- 679,685 ----
    echo "RANLIB=$RANLIB">> Makefile.config
    echo "SHELL=$SHELL">> Makefile.config
    
  ! ####################################################################
    # This would be the area to do any ./helpers/TestLib tests,
    # before we actually write LIBS to Makefile.config.
    # Punt for now...
  ***************
  *** 684,704 ****
        LIBS="$LIBS $DB_LIB"
    fi
    
  ! #
    # NOW we finish Makefile.config
    #
    echo "LIBS1=$LIBS">> Makefile.config
    echo >> Makefile.config
    echo "#### End of Configure created section ####">> Makefile.config
    
  ! 
    # Now (finish) creating the makefiles
    cat Makefile.config >> Makefile
    sed -e "s#@@Configuration@@#$file#" "$makefile_tmpl" >>Makefile
    awk >>Makefile <$tmpfile \
       '($1 == "Module" && $3 ~ /modules\//) { printf "%s: modules/last-built ; 
@cat /dev/null\n\n", $3, $3}'
    cat Makefile.config ../support/Makefile.tmpl > ../support/Makefile
    
    cat << EOF > modules/Makefile
    # 
    # Simple Makefile for modules in src/modules.
  --- 694,720 ----
        LIBS="$LIBS $DB_LIB"
    fi
    
  ! ####################################################################
    # NOW we finish Makefile.config
    #
    echo "LIBS1=$LIBS">> Makefile.config
    echo >> Makefile.config
    echo "#### End of Configure created section ####">> Makefile.config
    
  ! ####################################################################
    # Now (finish) creating the makefiles
  + #
  + # ./Makefile
  + #
    cat Makefile.config >> Makefile
    sed -e "s#@@Configuration@@#$file#" "$makefile_tmpl" >>Makefile
    awk >>Makefile <$tmpfile \
       '($1 == "Module" && $3 ~ /modules\//) { printf "%s: modules/last-built ; 
@cat /dev/null\n\n", $3, $3}'
    cat Makefile.config ../support/Makefile.tmpl > ../support/Makefile
    
  + #
  + # ./modules/Makefile
  + #
    cat << EOF > modules/Makefile
    # 
    # Simple Makefile for modules in src/modules.
  
  
  
  1.4       +13 -8     apache/src/helpers/TestLib
  
  Index: TestLib
  ===================================================================
  RCS file: /export/home/cvs/apache/src/helpers/TestLib,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -C3 -r1.3 -r1.4
  *** TestLib   1997/07/17 03:22:45     1.3
  --- TestLib   1997/07/17 17:12:42     1.4
  ***************
  *** 1,5 ****
    #!/bin/sh
  ! trap 'rm -rf Makefile a.out; exit' 0 1 2 3 15
    #
    # Yet another Apache Configure helper script.
    # This one exists simply to test for the existance of
  --- 1,5 ----
    #!/bin/sh
  ! trap 'rm -rf Makefile dummy; exit' 0 1 2 3 15
    #
    # Yet another Apache Configure helper script.
    # This one exists simply to test for the existance of
  ***************
  *** 17,45 ****
    #
    
    #
    # Get makefile settings and build a basic Makefile
    #
    cd ./helpers
  ! rm -rf a.out
    cat ../Makefile.config > Makefile
    cat <<EOF >> Makefile
  - TLIB=-l$1
    CFLAGS=$(OPTIM) $(CFLAGS1) $(EXTRA_CFLAGS)
    LIBS=$(EXTRA_LIBS) $(LIBS1)
    INCLUDES=$(INCLUDES1) $(EXTRA_INCLUDES)
    LDFLAGS=$(LDFLAGS1) $(EXTRA_LDFLAGS)
    
    all:
    EOF
  - cat <<\EOFF >> Makefile
  -     $(CC) $(CFLAGS) $(INCLUDES) $(LDFLAGS) dummy.c $(TLIB) 
  - EOFF
    
    # Now run that Makefile
    `make > /dev/null 2<&1`
    
  ! # And see if a.out exists
  ! if [ -f a.out ]; then
        echo "yes"
    else
        echo "no"
  --- 17,50 ----
    #
    
    #
  + # Make sure we have an argument
  + #
  + if [ "x$1" = "x" ]; then
  +   exit 1
  + fi
  + 
  + #
    # Get makefile settings and build a basic Makefile
    #
    cd ./helpers
  ! rm -rf dummy
    cat ../Makefile.config > Makefile
    cat <<EOF >> Makefile
    CFLAGS=$(OPTIM) $(CFLAGS1) $(EXTRA_CFLAGS)
    LIBS=$(EXTRA_LIBS) $(LIBS1)
    INCLUDES=$(INCLUDES1) $(EXTRA_INCLUDES)
    LDFLAGS=$(LDFLAGS1) $(EXTRA_LDFLAGS)
    
    all:
  +     \$(CC) \$(CFLAGS) \$(INCLUDES) \$(LDFLAGS) dummy.c -o dummy -l$1
  + 
    EOF
    
    # Now run that Makefile
    `make > /dev/null 2<&1`
    
  ! # And see if dummy exists
  ! if [ -f dummy ]; then
        echo "yes"
    else
        echo "no"
  
  
  

Reply via email to