]> git.proxmox.com Git - mirror_lxc.git/blobdiff - meson.build
Merge pull request #4287 from hallyn/2023-03-10/dbus
[mirror_lxc.git] / meson.build
index 9bf3282153889dde470d0d85c6a37e1d10c0899a..cb6f17fa4c58791982df138e5d5984336868cd37 100644 (file)
@@ -10,7 +10,7 @@ project(
         'b_lto=true',
         'b_lto_mode=thin',
         'b_colorout=always',
-        'b_asneeded=true',
+        'b_asneeded=false',
         'b_pie=true',
         'b_staticpic=true',
         'c_std=gnu11',
@@ -163,7 +163,7 @@ want_oss_fuzz = get_option('oss-fuzz')
 want_seccomp = get_option('seccomp')
 want_thread_safety = get_option('thread-safety')
 want_memfd_rexec = get_option('memfd-rexec')
-want_sd_bus = get_option('sd-bus')
+want_dbus = get_option('dbus')
 
 srcconf.set_quoted('DEFAULT_CGROUP_PATTERN', cgrouppattern)
 if coverity
@@ -221,14 +221,19 @@ possible_cc_flags = [
 ]
 
 possible_link_flags = [
+    '-Wl,--no-as-needed',
     '-Wl,--gc-sections',
     '-Wl,-z,relro',
     '-Wl,-z,now',
-    '-Wl,-fuse-ld=gold',
     '-fstack-protector',
     '-fstack-protector-strong',
 ]
 
+# The gold linker fails with a bus error on sparc64
+if build_machine.cpu_family() != 'sparc64'
+    possible_link_flags += '-Wl,-fuse-ld=gold'
+endif
+
 if sanitize == 'none'
     possible_link_flags += '-Wl,--warn-common'
 endif
@@ -271,54 +276,13 @@ else
     srcconf.set10('HAVE_LIBURING', false)
 endif
 
-if not want_sd_bus.disabled()
-    has_sd_bus = true
-    sd_bus_optional = want_sd_bus.auto()
-
-    libsystemd = dependency('libsystemd', required: not sd_bus_optional)
-    if not libsystemd.found()
-        if not sd_bus_optional
-            error('missing required libsystemd dependency')
-        endif
-
-        has_sd_bus = false
-    endif
-
-    if not cc.has_header('systemd/sd-bus.h')
-        if not sd_bus_optional
-            error('libsystemd misses required systemd/sd-bus.h header')
-        endif
-
-        has_sd_bus = false
-    endif
-
-    if not cc.has_header('systemd/sd-event.h')
-        if not sd_bus_optional
-            error('libsystemd misses required systemd/sd-event.h header')
-        endif
-
-        has_sd_bus = false
-    endif
-
-    if not cc.has_function('sd_bus_call_method_async', prefix: '#include <systemd/sd-bus.h>', dependencies: libsystemd)
-        if not sd_bus_optional
-            error('libsystemd misses required sd_bus_call_method_async function')
-        endif
-
-        has_sd_bus = false
-    endif
-
-    if has_sd_bus
-        liblxc_dependencies += libsystemd
-        if want_oss_fuzz
-            oss_fuzz_dependencies += libsystemd
-        endif
-    endif
-
-    srcconf.set10('HAVE_LIBSYSTEMD', has_sd_bus)
+if want_dbus
+    libdbus = dependency('dbus-1', required: true)
+    pkgconfig_libs += libdbus
+    liblxc_dependencies += libdbus
+    srcconf.set10('HAVE_DBUS', libdbus.found())
 else
-    has_sd_bus = false
-    srcconf.set10('HAVE_LIBSYSTEMD', false)
+    srcconf.set10('HAVE_DBUS', false)
 endif
 
 ## Time EPOCH.
@@ -804,8 +768,6 @@ endforeach
 found_headers = []
 missing_headers = []
 foreach tuple: [
-    ['systemd/sd-bus.h'],
-    ['systemd/sd-event.h'],
     ['sys/resource.h'],
     ['sys/memfd.h'],
     ['sys/personality.h'],
@@ -844,7 +806,6 @@ foreach tuple: [
     ['pam'],
     ['openssl'],
     ['liburing'],
-    ['libsystemd'],
 ]
 
     if tuple.length() >= 2