Blame build/build-modules-c.awk

Packit 90a5c9
# Licensed to the Apache Software Foundation (ASF) under one or more
Packit 90a5c9
# contributor license agreements.  See the NOTICE file distributed with
Packit 90a5c9
# this work for additional information regarding copyright ownership.
Packit 90a5c9
# The ASF licenses this file to You under the Apache License, Version 2.0
Packit 90a5c9
# (the "License"); you may not use this file except in compliance with
Packit 90a5c9
# the License.  You may obtain a copy of the License at
Packit 90a5c9
#
Packit 90a5c9
#     http://www.apache.org/licenses/LICENSE-2.0
Packit 90a5c9
#
Packit 90a5c9
# Unless required by applicable law or agreed to in writing, software
Packit 90a5c9
# distributed under the License is distributed on an "AS IS" BASIS,
Packit 90a5c9
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Packit 90a5c9
# See the License for the specific language governing permissions and
Packit 90a5c9
# limitations under the License.
Packit 90a5c9
BEGIN {
Packit 90a5c9
    RS = " "
Packit 90a5c9
    # the core module must come first
Packit 90a5c9
    modules[n++] = "core"
Packit 90a5c9
    pmodules[pn++] = "core"
Packit 90a5c9
} 
Packit 90a5c9
{
Packit 90a5c9
    modules[n] = $1;
Packit 90a5c9
    pmodules[pn] = $1;
Packit 90a5c9
    gsub("\n","",modules[n]);
Packit 90a5c9
    gsub("\n","",pmodules[pn]);
Packit 90a5c9
    ++n;
Packit 90a5c9
    ++pn;
Packit 90a5c9
} 
Packit 90a5c9
END {
Packit 90a5c9
    print "/*"
Packit 90a5c9
    print " * modules.c --- automatically generated by Apache"
Packit 90a5c9
    print " * configuration script.  DO NOT HAND EDIT!!!!!"
Packit 90a5c9
    print " */"
Packit 90a5c9
    print ""
Packit 90a5c9
    print "#include \"ap_config.h\""
Packit 90a5c9
    print "#include \"httpd.h\""
Packit 90a5c9
    print "#include \"http_config.h\""
Packit 90a5c9
    print ""
Packit 90a5c9
    for (i = 0; i < pn; ++i) {
Packit 90a5c9
        printf ("extern module %s_module;\n", pmodules[i])
Packit 90a5c9
    }
Packit 90a5c9
    print ""
Packit 90a5c9
    print "/*"
Packit 90a5c9
    print " *  Modules which implicitly form the"
Packit 90a5c9
    print " *  list of activated modules on startup,"
Packit 90a5c9
    print " *  i.e. these are the modules which are"
Packit 90a5c9
    print " *  initially linked into the Apache processing"
Packit 90a5c9
    print " *  [extendable under run-time via AddModule]"
Packit 90a5c9
    print " */"
Packit 90a5c9
    print "module *ap_prelinked_modules[] = {"
Packit 90a5c9
    for (i = 0 ; i < n; ++i) {
Packit 90a5c9
        printf "  &%s_module,\n", modules[i]
Packit 90a5c9
    }
Packit 90a5c9
    print "  NULL"
Packit 90a5c9
    print "};"
Packit 90a5c9
    print ""
Packit 90a5c9
    print "/*"
Packit 90a5c9
    print " *  We need the symbols as strings for <IfModule> containers"
Packit 90a5c9
    print " */"
Packit 90a5c9
    print ""
Packit 90a5c9
    print "ap_module_symbol_t ap_prelinked_module_symbols[] = {"
Packit 90a5c9
    for (i = 0; i < n; ++i) {
Packit 90a5c9
        printf ("  {\"%s_module\", &%s_module},\n", modules[i], modules[i])
Packit 90a5c9
    }
Packit 90a5c9
    print "  {NULL, NULL}"
Packit 90a5c9
    print "};"
Packit 90a5c9
    print ""
Packit 90a5c9
    print "/*"
Packit 90a5c9
    print " *  Modules which initially form the"
Packit 90a5c9
    print " *  list of available modules on startup,"
Packit 90a5c9
    print " *  i.e. these are the modules which are"
Packit 90a5c9
    print " *  initially loaded into the Apache process"
Packit 90a5c9
    print " *  [extendable under run-time via LoadModule]"
Packit 90a5c9
    print " */"
Packit 90a5c9
    print "module *ap_preloaded_modules[] = {"
Packit 90a5c9
    for (i = 0; i < pn; ++i) {
Packit 90a5c9
        printf "  &%s_module,\n", pmodules[i]
Packit 90a5c9
    }
Packit 90a5c9
    print "  NULL"
Packit 90a5c9
    print "};"
Packit 90a5c9
    print ""
Packit 90a5c9
}