elogind: fix build with glibc >= 2.28 and meson >= 0.48.0

This commit is contained in:
maxice8 2018-09-30 17:35:43 -03:00
parent a896cfc96e
commit 3a45e791bc
No known key found for this signature in database
GPG Key ID: 543B9D4F4299F06B
2 changed files with 106 additions and 0 deletions

View File

@ -0,0 +1,77 @@
Fix glibc >= 2.28 statx
diff --git a/meson.build b/meson.build
index 98a73a1..bd1b249 100644
--- meson.build
+++ meson.build
@@ -534,8 +534,7 @@ decl_headers = '''
#include <uchar.h>
#include <linux/ethtool.h>
#include <linux/fib_rules.h>
-//#include <linux/stat.h>
-//#include <sys/stat.h>
+#include <sys/stat.h>
'''
# FIXME: key_serial_t is only defined in keyutils.h, this is bound to fail
@@ -549,9 +548,24 @@ foreach decl : ['char16_t',
# We get -1 if the size cannot be determined
have = cc.sizeof(decl, prefix : decl_headers) > 0
+ have = cc.sizeof(decl, prefix : decl_headers, args : '-D_GNU_SOURCE') > 0
+
+ if decl == 'struct statx'
+ if have
+ want_linux_stat_h = false
+ else
+ have = cc.sizeof(decl,
+ prefix : decl_headers + '#include <linux/stat.h>',
+ args : '-D_GNU_SOURCE') > 0
+ want_linux_stat_h = have
+ endif
+ endif
+
conf.set10('HAVE_' + decl.underscorify().to_upper(), have)
endforeach
+conf.set10('WANT_LINUX_STAT_H', want_linux_stat_h)
+
foreach decl : [['IFLA_INET6_ADDR_GEN_MODE', 'linux/if_link.h'],
['IN6_ADDR_GEN_MODE_STABLE_PRIVACY', 'linux/if_link.h'],
['IFLA_VRF_TABLE', 'linux/if_link.h'],
diff --git a/src/basic/missing.h b/src/basic/missing.h
index 3708742..e909973 100644
--- src/basic/missing.h
+++ src/basic/missing.h
@@ -34,7 +34,6 @@
#include <linux/neighbour.h>
#include <linux/oom.h>
#include <linux/rtnetlink.h>
-//#include <linux/stat.h>
#include <net/ethernet.h>
#include <stdlib.h>
#include <sys/resource.h>
@@ -44,6 +43,10 @@
#include <uchar.h>
#include <unistd.h>
+#if WANT_LINUX_STAT_H
+#include <linux/stat.h>
+#endif
+
/// Additional includes needed by elogind
#include "musl_missing.h"
diff --git a/src/basic/xattr-util.c b/src/basic/xattr-util.c
index dc4e802..29e3152 100644
--- src/basic/xattr-util.c
+++ src/basic/xattr-util.c
@@ -20,7 +20,6 @@
#include <errno.h>
#include <fcntl.h>
-//#include <linux/stat.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>

View File

@ -0,0 +1,29 @@
debug is now a keyword taken by meson >= 0.48.0 and will error out if used as an option
diff --git a/meson.build b/meson.build
index 7b0739f..98a73a1 100644
--- meson.build
+++ meson.build
@@ -929,7 +929,7 @@ conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
# substs.set('DEBUGTTY', get_option('debug-tty'))
#endif // 0
-debug = get_option('debug')
+debug = get_option('debug-extra')
enable_debug_hashmap = false
enable_debug_mmap_cache = false
#if 1 /// additional elogind debug mode
diff --git a/meson_options.txt b/meson_options.txt
index 84100b6..f13f904 100644
--- meson_options.txt
+++ meson_options.txt
@@ -82,7 +82,7 @@ option('kexec-path', type : 'string', description : 'path to kexec')
# option('memory-accounting-default', type : 'boolean',
# description : 'enable MemoryAccounting= by default')
#else
-option('debug', type : 'string',
+option('debug-extra', type : 'string',
description : 'enable extra debugging (elogind,hashmap,mmap-cache)')
#endif // 0