]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
build: add -lsocket -lnsl if needed on illumos and older Solaris
authorAlan Coopersmith <alan.coopersmith@oracle.com>
Sat, 16 Aug 2025 22:32:18 +0000 (15:32 -0700)
committerSimon McVittie <smcv@collabora.com>
Tue, 19 Aug 2025 12:34:00 +0000 (12:34 +0000)
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
meson.build
tools/meson.build

index 17167c8016852143d0ae8a7cbeda648185a40cc7..7281b7ec6921707660b02f20840cda6162bf0542 100644 (file)
@@ -685,6 +685,25 @@ foreach function : ['socket', 'socketpair']
     endif
 endforeach
 
+# getsockname(), getpeername() might be in -lnsl, for example on older Solaris
+foreach function : ['getsockname', 'getpeername']
+    if not cc.has_function(
+        function,
+        args: compile_args_c,
+        dependencies: network_libs,
+    )
+        nsl_lib = cc.find_library('nsl', required: false)
+        if nsl_lib.found() and cc.has_function(
+            function,
+            args: compile_args_c,
+            dependencies: network_libs + [nsl_lib],
+        )
+            network_libs += [nsl_lib]
+            break
+        endif
+    endif
+endforeach
+
 if get_option('x11_autolaunch').disabled()
     use_x11_autolaunch = false
     x11 = not_found
index 5d78d93a0fd69f99535581f4c7ba8192e59c36ca..8871e74ae18adbc376b585971d182f04783a5082 100644 (file)
@@ -23,6 +23,7 @@ if not platform_windows
     dbus_cleanup_sockets = executable('dbus-cleanup-sockets',
         'dbus-cleanup-sockets.c',
         include_directories: root_include,
+        dependencies: network_libs,
         install: true,
     )
 endif
@@ -54,6 +55,7 @@ dbus_monitor = executable('dbus-monitor',
     'dbus-monitor.c',
     'tool-common.c',
     include_directories: root_include,
+    dependencies: network_libs,
     link_with: libdbus,
     install: true,
 )
@@ -73,6 +75,7 @@ dbus_send = executable('dbus-send',
     'dbus-send.c',
     'tool-common.c',
     include_directories: root_include,
+    dependencies: network_libs,
     link_with: libdbus,
     install: true,
 )