From 0fd65dba2f2960bffcaaef788ceab762cfea6d89 Mon Sep 17 00:00:00 2001 From: Ivan Zhakov Date: Tue, 30 Jul 2024 00:15:32 +0000 Subject: [PATCH] Follow-up to r1919413: CMake: Use configure_file() instead of file(write) to generate modules.c file because configure_file() doesn't change timestamp of file if contents is the the same. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1919587 13f79535-47bb-0310-9956-ffa450edef68 --- build/build-modules-c.cmake | 66 +++---------------------------------- build/modules.c.in | 41 +++++++++++++++++++++++ 2 files changed, 46 insertions(+), 61 deletions(-) create mode 100644 build/modules.c.in diff --git a/build/build-modules-c.cmake b/build/build-modules-c.cmake index 9d4ac6cc2da..1d005bd9b1e 100644 --- a/build/build-modules-c.cmake +++ b/build/build-modules-c.cmake @@ -16,68 +16,12 @@ function(generate_builtin_modules_c output_filename module_list) list(PREPEND module_list "core") - set(content "") - - string(APPEND content "/*\n") - string(APPEND content " * modules.c --- automatically generated by Apache\n") - string(APPEND content " * configuration script. DO NOT HAND EDIT!!!!!\n") - string(APPEND content " */\n") - string(APPEND content "\n") - string(APPEND content "#include \"ap_config.h\"\n") - string(APPEND content "#include \"httpd.h\"\n") - string(APPEND content "#include \"http_config.h\"\n") - string(APPEND content "\n") - - foreach(module ${module_list}) - string(APPEND content "extern module ${module}_module\;\n") - endforeach() - - string(APPEND content "\n") - string(APPEND content "/*\n") - string(APPEND content " * Modules which implicitly form the\n") - string(APPEND content " * list of activated modules on startup,\n") - string(APPEND content " * i.e. these are the modules which are\n") - string(APPEND content " * initially linked into the Apache processing\n") - string(APPEND content " * [extendable under run-time via AddModule]\n") - string(APPEND content " */\n") - - string(APPEND content "AP_DECLARE_DATA module *ap_prelinked_modules[] = {\n") foreach(module ${module_list}) - string(APPEND content " &${module}_module,\n") + string(APPEND MODULES_EXTERN "extern module ${module}_module;\n") + string(APPEND MODULES_PRELINK " &${module}_module,\n") + string(APPEND MODULES_SYNMBOLS " {\"${module}_module\", &${module}_module},\n") + string(APPEND MODULES_PRELOAD " &${module}_module,\n") endforeach() - string(APPEND content " NULL\n") - string(APPEND content "}\;\n") - - string(APPEND content "\n") - string(APPEND content "/*\n") - string(APPEND content " * We need the symbols as strings for containers\n") - string(APPEND content " */\n") - string(APPEND content "\n") - string(APPEND content "ap_module_symbol_t ap_prelinked_module_symbols[] = {\n") - - foreach(module ${module_list}) - string(APPEND content " {\"${module}_module\", &${module}_module},\n") - endforeach() - - string(APPEND content " {NULL, NULL}\n") - string(APPEND content "}\;\n") - string(APPEND content "\n") - string(APPEND content "/*\n") - string(APPEND content " * Modules which initially form the\n") - string(APPEND content " * list of available modules on startup,\n") - string(APPEND content " * i.e. these are the modules which are\n") - string(APPEND content " * initially loaded into the Apache process\n") - string(APPEND content " * [extendable under run-time via LoadModule]\n") - string(APPEND content " */\n") - string(APPEND content "module *ap_preloaded_modules[] = {\n") - - foreach(module ${module_list}) - string(APPEND content " &${module}_module,\n") - endforeach() - - string(APPEND content " NULL\n") - string(APPEND content "}\;\n") - string(APPEND content "\n") - file(WRITE ${output_filename} ${content}) + configure_file("build/modules.c.in" ${output_filename}) endfunction() diff --git a/build/modules.c.in b/build/modules.c.in new file mode 100644 index 00000000000..c811d0d4440 --- /dev/null +++ b/build/modules.c.in @@ -0,0 +1,41 @@ +/* + * modules.c --- automatically generated by Apache + * configuration script. DO NOT HAND EDIT!!!!! + */ + +#include "ap_config.h" +#include "httpd.h" +#include "http_config.h" + +@MODULES_EXTERN@ +/* + * Modules which implicitly form the + * list of activated modules on startup, + * i.e. these are the modules which are + * initially linked into the Apache processing + * [extendable under run-time via AddModule] + */ +AP_DECLARE_DATA module *ap_prelinked_modules[] = { +@MODULES_PRELINK@ + NULL +}; + +/* + * We need the symbols as strings for containers + */ +ap_module_symbol_t ap_prelinked_module_symbols[] = { +@MODULES_SYNMBOLS@ + {NULL, NULL} +}; + +/* + * Modules which initially form the + * list of available modules on startup, + * i.e. these are the modules which are + * initially loaded into the Apache process + * [extendable under run-time via LoadModule] + */ +module *ap_preloaded_modules[] = { +@MODULES_PRELOAD@ + NULL +};