|
| 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 | + |
| 16 | +function(generate_builtin_modules_c output_filename module_list) |
| 17 | + list(PREPEND module_list "core") |
| 18 | + |
| 19 | + set(content "") |
| 20 | + |
| 21 | + string(APPEND content "/*\n") |
| 22 | + string(APPEND content " * modules.c --- automatically generated by Apache\n") |
| 23 | + string(APPEND content " * configuration script. DO NOT HAND EDIT!!!!!\n") |
| 24 | + string(APPEND content " */\n") |
| 25 | + string(APPEND content "\n") |
| 26 | + string(APPEND content "#include \"ap_config.h\"\n") |
| 27 | + string(APPEND content "#include \"httpd.h\"\n") |
| 28 | + string(APPEND content "#include \"http_config.h\"\n") |
| 29 | + string(APPEND content "\n") |
| 30 | + |
| 31 | + foreach(module ${module_list}) |
| 32 | + string(APPEND content "extern module ${module}_module\;\n") |
| 33 | + endforeach() |
| 34 | + |
| 35 | + string(APPEND content "\n") |
| 36 | + string(APPEND content "/*\n") |
| 37 | + string(APPEND content " * Modules which implicitly form the\n") |
| 38 | + string(APPEND content " * list of activated modules on startup,\n") |
| 39 | + string(APPEND content " * i.e. these are the modules which are\n") |
| 40 | + string(APPEND content " * initially linked into the Apache processing\n") |
| 41 | + string(APPEND content " * [extendable under run-time via AddModule]\n") |
| 42 | + string(APPEND content " */\n") |
| 43 | + |
| 44 | + string(APPEND content "AP_DECLARE_DATA module *ap_prelinked_modules[] = {\n") |
| 45 | + foreach(module ${module_list}) |
| 46 | + string(APPEND content " &${module}_module,\n") |
| 47 | + endforeach() |
| 48 | + string(APPEND content " NULL\n") |
| 49 | + string(APPEND content "}\;\n") |
| 50 | + |
| 51 | + string(APPEND content "\n") |
| 52 | + string(APPEND content "/*\n") |
| 53 | + string(APPEND content " * We need the symbols as strings for <IfModule> containers\n") |
| 54 | + string(APPEND content " */\n") |
| 55 | + string(APPEND content "\n") |
| 56 | + string(APPEND content "ap_module_symbol_t ap_prelinked_module_symbols[] = {\n") |
| 57 | + |
| 58 | + foreach(module ${module_list}) |
| 59 | + string(APPEND content " {\"${module}_module\", &${module}_module},\n") |
| 60 | + endforeach() |
| 61 | + |
| 62 | + string(APPEND content " {NULL, NULL}\n") |
| 63 | + string(APPEND content "}\;\n") |
| 64 | + string(APPEND content "\n") |
| 65 | + string(APPEND content "/*\n") |
| 66 | + string(APPEND content " * Modules which initially form the\n") |
| 67 | + string(APPEND content " * list of available modules on startup,\n") |
| 68 | + string(APPEND content " * i.e. these are the modules which are\n") |
| 69 | + string(APPEND content " * initially loaded into the Apache process\n") |
| 70 | + string(APPEND content " * [extendable under run-time via LoadModule]\n") |
| 71 | + string(APPEND content " */\n") |
| 72 | + string(APPEND content "module *ap_preloaded_modules[] = {\n") |
| 73 | + |
| 74 | + foreach(module ${module_list}) |
| 75 | + string(APPEND content " &${module}_module,\n") |
| 76 | + endforeach() |
| 77 | + |
| 78 | + string(APPEND content " NULL\n") |
| 79 | + string(APPEND content "}\;\n") |
| 80 | + string(APPEND content "\n") |
| 81 | + |
| 82 | + file(WRITE ${output_filename} ${content}) |
| 83 | +endfunction() |
0 commit comments