summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Withnall <withnall@endlessm.com>2019-01-16 14:24:31 +0000
committerRay Strode <halfline@gmail.com>2019-05-07 15:07:28 +0000
commit152b845bbd3ca2a64516691493a160825f1a2046 (patch)
tree6087961d7d206ce4a1c220496da770fa25aa5c59
parentd8b779513474ece1f5ec2fc9b7c32afb73e32181 (diff)
build: Expose chosen path_wtmp value as a variable
This will be used in a following commit. Signed-off-by: Philip Withnall <withnall@endlessm.com>
-rw-r--r--meson.build24
1 files changed, 22 insertions, 2 deletions
diff --git a/meson.build b/meson.build
index 4465a26..050a2fc 100644
--- a/meson.build
+++ b/meson.build
@@ -78,12 +78,32 @@ foreach func: check_functions
endforeach
if cc.has_header_symbol('utmpx.h', 'WTMPX_FILENAME', prefix: '#define _GNU_SOURCE')
+ code = '''#define _GNU_SOURCE
+ #include <utmpx.h>
+ int main (int argc, char **argv) {
+ printf ("%s\n", WTMPX_FILENAME);
+ return 0;
+ }
+ '''
+ result = cc.run(code, name : 'value of WTMPX_FILENAME')
+ path_wtmp = result.stdout().strip()
+
config_h.set('PATH_WTMP', 'WTMPX_FILENAME')
elif cc.has_header_symbol('paths.h', '_PATH_WTMPX')
+ code = '''#include <paths.h>
+ int main (int argc, char **argv) {
+ printf ("%s\n", _PATH_WTMPX);
+ return 0;
+ }
+ '''
+ result = cc.run(code, name : 'value of _PATH_WTMPX')
+ path_wtmp = result.stdout().strip()
+
config_h.set('PATH_WTMP', '_PATH_WTMPX')
else
- assert(run_command('test', '-e', '/var/log/utx.log').returncode() == 0, 'Do not know which filename to watch for wtmp changes')
- config_h.set_quoted('PATH_WTMP', '/var/log/utx.log')
+ path_wtmp = '/var/log/utx.log'
+ assert(run_command('test', '-e', path_wtmp).returncode() == 0, 'Do not know which filename to watch for wtmp changes')
+ config_h.set_quoted('PATH_WTMP', path_wtmp)
endif
# compiler flags