Merge branch 'issue531' into 'master'

build: Check for socket(), socketpair() in -lsocket if necessary

Closes #531

See merge request dbus/dbus!491
This commit is contained in:
Simon McVittie 2024-11-29 16:11:18 +00:00
commit 411add93ce

View file

@ -612,6 +612,25 @@ else
network_libs = []
endif
# socket(), socketpair() might be in -lsocket, for example on older Solaris
foreach function : ['socket', 'socketpair']
if not cc.has_function(
function,
args: compile_args_c,
dependencies: network_libs,
)
socket_lib = cc.find_library('socket', required: false)
if socket_lib.found() and cc.has_function(
function,
args: compile_args_c,
dependencies: network_libs + [socket_lib],
)
network_libs += [socket_lib]
break
endif
endif
endforeach
if get_option('x11_autolaunch').disabled()
use_x11_autolaunch = false
x11 = not_found
@ -675,7 +694,14 @@ check_functions = [
foreach function : check_functions
macro = 'HAVE_' + function.underscorify().to_upper()
config.set(macro, cc.has_function(function, args: compile_args_c) ? 1 : false)
config.set(
macro,
cc.has_function(
function,
args: compile_args_c,
dependencies: network_libs,
) ? 1 : false,
)
endforeach
# keep CMakeLists.txt in sync