jim         97/09/06 15:32:20

  Modified:    src      Configure
  Log:
  Cleanup 'awk' statements in Configure
  
  Revision  Changes    Path
  1.148     +97 -71    apachen/src/Configure
  
  Index: Configure
  ===================================================================
  RCS file: /export/home/cvs/apachen/src/Configure,v
  retrieving revision 1.147
  retrieving revision 1.148
  diff -u -r1.147 -r1.148
  --- Configure 1997/09/05 02:41:49     1.147
  +++ Configure 1997/09/06 22:32:19     1.148
  @@ -109,12 +109,15 @@
   # Now we create a stub file, called Makefile.config, which
   # just includes those assignments (eg: CC=gcc) in Configuration
   #
  -awk >Makefile.config <$tmpfile '\
  -    BEGIN { print "# Makefile options inherited from Configure"; \
  -         print "###############"; \
  -       } \
  -    /\=/ { print } \
  -    END { print "###############"; }'
  +awk >Makefile.config <$tmpfile '
  +    BEGIN {
  +     print "# Makefile options inherited from Configure"
  +     print "###############"
  +    } 
  +    /\=/ { print } 
  +    END {
  +     print "###############"
  +    }'
   
   ####################################################################
   # Extract the rules.
  @@ -733,16 +736,21 @@
   echo " + Adding selected modules"
   
   MODFILES=`awk <$tmpfile '$1 == "AddModule" { printf "%s ", $2 }'`
  -MODDIRS=`awk < $tmpfile '\
  -     ($1 == "Module" && $3 ~ /^modules\//) { \
  -         split ($3, pp, "/"); \
  -     if (! SEEN[pp[2]]) { printf "%s ", pp[2]; SEEN[pp[2]] = 1; } \
  -     } \
  -     ($1 == "AddModule" && $2 ~ /^modules\//) { \
  -         split ($2, pp, "/"); \
  -     if (! SEEN[pp[2]]) { printf "%s ", pp[2]; SEEN[pp[2]] = 1; } \
  -     } \
  -'`
  +MODDIRS=`awk < $tmpfile '
  +     ($1 == "Module" && $3 ~ /^modules\//) {
  +         split ($3, pp, "/")
  +         if (! SEEN[pp[2]]) {
  +             printf "%s ", pp[2]
  +             SEEN[pp[2]] = 1
  +         }
  +     }
  +     ($1 == "AddModule" && $2 ~ /^modules\//) { 
  +         split ($2, pp, "/")
  +         if (! SEEN[pp[2]]) {
  +             printf "%s ", pp[2]
  +             SEEN[pp[2]] = 1
  +         } 
  +     }'`
   
   #
   # Now autoconfigure each of the modules specified by AddModule.
  @@ -808,34 +816,38 @@
   
   # create modules.c
   
  -sed -e 's/_module//' $tmpfile | awk >modules.c '\
  -   BEGIN { modules[n++] = "core" ; pmodules[pn++] = "core"} \
  -   /^Module/ { modules[n++] = $2 ; pmodules[pn++] = $2 } \
  -   /^%Module/ { pmodules[pn++] = $2 } \
  -   END { print "/* modules.c --- automatically generated by Apache"; \
  -      print " * configuration script.  DO NOT HAND EDIT!!!!!"; \
  -      print " */"; \
  -      print ""; \
  -      print "#include \"httpd.h\""; \
  -      print "#include \"http_config.h\""; \
  -      print ""; \
  -      for (i = 0; i < pn; ++i) { \
  -          printf ("extern module %s_module;\n", pmodules[i]); \
  -      } \
  -      print ""; \
  -      print "module *prelinked_modules[] = {"; \
  -      for (i = 0; i < n; ++i) { \
  -          printf "  &%s_module,\n", modules[i]; \
  -      } \
  -      print "  NULL"; \
  -      print "};"; \
  -      print "module *preloaded_modules[] = {"; \
  -      for (i = 0; i < pn; ++i) { \
  -          printf "  &%s_module,\n", pmodules[i]; \
  -      } \
  -      print "  NULL"; \
  -      print "};"; \
  -   }'
  +sed -e 's/_module//' $tmpfile | awk >modules.c '
  +    BEGIN {
  +     modules[n++] = "core"
  +     pmodules[pn++] = "core"
  +    } 
  +    /^Module/ { modules[n++] = $2 ; pmodules[pn++] = $2 } 
  +    /^%Module/ { pmodules[pn++] = $2 } 
  +    END {
  +     print "/* modules.c --- automatically generated by Apache"
  +     print " * configuration script.  DO NOT HAND EDIT!!!!!"
  +     print " */"
  +     print ""
  +     print "#include \"httpd.h\""
  +     print "#include \"http_config.h\""
  +     print ""
  +     for (i = 0; i < pn; ++i) {
  +         printf ("extern module %s_module;\n", pmodules[i])
  +     }
  +     print ""
  +     print "module *prelinked_modules[] = {"
  +     for (i = 0; i < n; ++i) {
  +         printf "  &%s_module,\n", modules[i]
  +     }
  +     print "  NULL"
  +     print "};"
  +     print "module *preloaded_modules[] = {"
  +     for (i = 0; i < pn; ++i) {
  +         printf "  &%s_module,\n", pmodules[i]
  +     }
  +     print "  NULL"
  +     print "};"
  +    }'
   
   # figure out which module dir require use to autocreate a Makefile.
   # for these dirs we must not list the object files from the AddModule
  @@ -859,21 +871,27 @@
   # targets for auto-generated directories.
   
   cat > $awkfile <<EOF1
  -   BEGIN { split ( "$AUTODIRS", tmp, / / );
  +    BEGIN {
  +     split ("$AUTODIRS", tmp, " ")
   EOF1
   cat >> $awkfile <<'EOF2'
  -        for ( key in tmp ) { autodirs[tmp[key]] = 1; }
  -      }
  -   /^Module/ { modules[n++] = $3 }
  -   /^%Module/ { modules[n++] = $3 }
  -   END { print "MODULES= \\";
  -      for (i = 0; i < n; ++i) {
  -          split ( modules[i], pp, /\//);
  -          dir = pp[1] "/" pp[2] ;
  -          if ( dir in autodirs ) { continue; }
  -          else printf ("  %s \\\n", modules[i]);
  -      }
  -       }
  +     for ( key in tmp ) {
  +         autodirs[tmp[key]] = 1
  +     }
  +     }
  +    /^Module/ { modules[n++] = $3 }
  +    /^%Module/ { modules[n++] = $3 }
  +    END {
  +     print "MODULES= \\"
  +     for (i = 0; i < n; ++i) {
  +         split (modules[i], pp, "/")
  +         dir = pp[1] "/" pp[2] 
  +         if ( dir in autodirs )
  +             continue
  +         else
  +             printf ("  %s \\\n", modules[i]);
  +     }
  +    }
   EOF2
   awk -f $awkfile >>Makefile <$tmpfile
   
  @@ -881,18 +899,20 @@
   # don't hang a continuation on the last line.
   
   cat > $awkfile <<EOF3
  -    BEGIN { split ( "$AUTOLIBS", libs );
  +    BEGIN {
  +     split ("$AUTOLIBS", libs)
   EOF3
   cat >> $awkfile <<'EOF4'
        z = 0;
        for ( lib in libs ) {
  -         if (z != 0) { printf (" \\\n"); }
  -         z++;
  -         printf ("  %s", libs[lib]);
  +         if (z != 0)
  +             printf (" \\\n")
  +         z++
  +         printf ("  %s", libs[lib])
        }
       }
       END {
  -     printf ("\n");
  +     printf ("\n")
       }
   EOF4
   awk -f $awkfile >>Makefile </dev/null
  @@ -940,8 +960,10 @@
   #
   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}'
  +awk >>Makefile <$tmpfile '
  +    ($1 == "Module" && $3 ~ /modules\//) {
  +     printf "%s: modules/last-built ; @cat /dev/null\n\n", $3, $3
  +    }'
   
   #
   # directories to create makefiles in
  @@ -1004,13 +1026,17 @@
   
        cat Makefile.config > $moddir/Makefile
        basedir=`echo $moddir | sed 's|^[^/]*/||g'`
  -     awk >> $moddir/Makefile < $tmpfile '\
  -         BEGIN { printf "OBJS=" }\
  -         ($1 == "Module" && $3 ~ /^modules\/'$basedir'\//) { \
  -             split ($3, pp, "/"); \
  -             printf "%s ", pp[3]; \
  -             } \
  -        END {printf "\n"}'
  +     awk >> $moddir/Makefile < $tmpfile '
  +         BEGIN {
  +             printf "OBJS="
  +         }
  +         ($1 == "Module" && $3 ~ /^modules\/'$basedir'\//) { 
  +             split ($3, pp, "/")
  +             printf "%s ", pp[3] 
  +         } 
  +         END {
  +             printf "\n"
  +         }'
   
        echo "LIB=lib$basedir.a" >> $moddir/Makefile
        cat << 'EOF' >> $moddir/Makefile
  
  
  

Reply via email to