Skip to content

Commit

Permalink
Follow-up to r1919413: CMake: Use configure_file() instead of file(wr…
Browse files Browse the repository at this point in the history
…ite)

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
  • Loading branch information
Ivan Zhakov committed Jul 30, 2024
1 parent a288cd3 commit 0fd65db
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 61 deletions.
66 changes: 5 additions & 61 deletions build/build-modules-c.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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 <IfModule> 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()
41 changes: 41 additions & 0 deletions build/modules.c.in
Original file line number Diff line number Diff line change
@@ -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 <IfModule> 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
};

0 comments on commit 0fd65db

Please sign in to comment.