From: Davin McCall Date: Fri, 3 May 2019 10:22:44 +0000 (+1000) Subject: Add support for specifying USE_UTMPX in mconfig. X-Git-Tag: v0.5.1~37 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=e5e6da11434e2e52af6c69b0d7ada281371cad94;p=oweals%2Fdinit.git Add support for specifying USE_UTMPX in mconfig. --- diff --git a/src/Makefile b/src/Makefile index 2242128..f45eb98 100644 --- a/src/Makefile +++ b/src/Makefile @@ -22,7 +22,8 @@ all: dinit dinitctl $(SHUTDOWN) fi includes/mconfig.h: mconfig-gen - ./mconfig-gen SBINDIR=$(SBINDIR) SYSCONTROLSOCKET=$(SYSCONTROLSOCKET) > includes/mconfig.h + ./mconfig-gen SBINDIR=$(SBINDIR) SYSCONTROLSOCKET=$(SYSCONTROLSOCKET) \ + $(if $(USE_UTMPX),USE_UTMPX=$(USE_UTMPX),) > includes/mconfig.h mconfig-gen: mconfig-gen.cc ../mconfig $(CXX) $(CXXOPTS) -o mconfig-gen mconfig-gen.cc $(LDFLAGS) diff --git a/src/mconfig-gen.cc b/src/mconfig-gen.cc index 1472e2e..5864bdd 100644 --- a/src/mconfig-gen.cc +++ b/src/mconfig-gen.cc @@ -60,7 +60,12 @@ int main(int argc, char **argv) using namespace std; cout << "// This file is auto-generated by mconfig-gen.cc." << endl; - cout << "constexpr static char SYSCONTROLSOCKET[] = " << stringify(vars["SYSCONTROLSOCKET"]) << ";" << endl; - cout << "constexpr static char SBINDIR[] = " << stringify(vars["SBINDIR"]) << ";" << endl; + cout << "\n// Defines\n"; + if (vars.find("USE_UTMPX") != vars.end()) { + cout << "#define USE_UTMPX " << vars["USE_UTMPX"] << "\n"; + } + cout << "\n// Constants\n"; + cout << "constexpr static char SYSCONTROLSOCKET[] = " << stringify(vars["SYSCONTROLSOCKET"]) << ";\n"; + cout << "constexpr static char SBINDIR[] = " << stringify(vars["SBINDIR"]) << ";\n"; return 0; }