From: Alan Coopersmith Date: Sat, 16 Aug 2025 22:32:18 +0000 (-0700) Subject: build: add -lsocket -lnsl if needed on illumos and older Solaris X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4c300d40cd1c6232294e8d7c22473de791b5a12d;p=thirdparty%2Fdbus.git build: add -lsocket -lnsl if needed on illumos and older Solaris Signed-off-by: Alan Coopersmith --- diff --git a/meson.build b/meson.build index 17167c801..7281b7ec6 100644 --- a/meson.build +++ b/meson.build @@ -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 diff --git a/tools/meson.build b/tools/meson.build index 5d78d93a0..8871e74ae 100644 --- a/tools/meson.build +++ b/tools/meson.build @@ -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, )