]> granicus.if.org Git - apache/blob - build/build-modules-c.awk
check: merge warning fixes from feature branch
[apache] / build / build-modules-c.awk
1 # Licensed to the Apache Software Foundation (ASF) under one or more
2 # contributor license agreements.  See the NOTICE file distributed with
3 # this work for additional information regarding copyright ownership.
4 # The ASF licenses this file to You under the Apache License, Version 2.0
5 # (the "License"); you may not use this file except in compliance with
6 # the License.  You may obtain a copy of the License at
7 #
8 #     http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 BEGIN {
16     RS = " "
17     # the core module must come first
18     modules[n++] = "core"
19     pmodules[pn++] = "core"
20
21 {
22     modules[n] = $1;
23     pmodules[pn] = $1;
24     gsub("\n","",modules[n]);
25     gsub("\n","",pmodules[pn]);
26     ++n;
27     ++pn;
28
29 END {
30     print "/*"
31     print " * modules.c --- automatically generated by Apache"
32     print " * configuration script.  DO NOT HAND EDIT!!!!!"
33     print " */"
34     print ""
35     print "#include \"ap_config.h\""
36     print "#include \"httpd.h\""
37     print "#include \"http_config.h\""
38     print ""
39     for (i = 0; i < pn; ++i) {
40         printf ("extern module %s_module;\n", pmodules[i])
41     }
42     print ""
43     print "/*"
44     print " *  Modules which implicitly form the"
45     print " *  list of activated modules on startup,"
46     print " *  i.e. these are the modules which are"
47     print " *  initially linked into the Apache processing"
48     print " *  [extendable under run-time via AddModule]"
49     print " */"
50     print "module *ap_prelinked_modules[] = {"
51     for (i = 0 ; i < n; ++i) {
52         printf "  &%s_module,\n", modules[i]
53     }
54     print "  NULL"
55     print "};"
56     print ""
57     print "/*"
58     print " *  We need the symbols as strings for <IfModule> containers"
59     print " */"
60     print ""
61     print "ap_module_symbol_t ap_prelinked_module_symbols[] = {"
62     for (i = 0; i < n; ++i) {
63         printf ("  {\"%s_module\", &%s_module},\n", modules[i], modules[i])
64     }
65     print "  {NULL, NULL}"
66     print "};"
67     print ""
68     print "/*"
69     print " *  Modules which initially form the"
70     print " *  list of available modules on startup,"
71     print " *  i.e. these are the modules which are"
72     print " *  initially loaded into the Apache process"
73     print " *  [extendable under run-time via LoadModule]"
74     print " */"
75     print "module *ap_preloaded_modules[] = {"
76     for (i = 0; i < pn; ++i) {
77         printf "  &%s_module,\n", pmodules[i]
78     }
79     print "  NULL"
80     print "};"
81     print ""
82 }