2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-22 01:49:48 +00:00

[#3729] Added check for environ vs shlib

This commit is contained in:
Francis Dupont 2025-02-05 16:16:17 +01:00 committed by Andrei Pavel
parent 8f9ac9da55
commit 922c51596f
No known key found for this signature in database
GPG Key ID: D4E804481939CB21
3 changed files with 18 additions and 2 deletions

View File

@ -0,0 +1,5 @@
extern char **environ;
char** fn() {
return environ;
}

View File

@ -269,6 +269,18 @@ result = cpp.run(
) )
conf_data.set('HAVE_STREAM_TRUNCATED_ERROR', result.returncode() == 0) conf_data.set('HAVE_STREAM_TRUNCATED_ERROR', result.returncode() == 0)
ENVIRON_SHLIB_FLAGS = []
if cpp.has_link_argument('-Wl,--no-undefined')
result = cpp.links(
fs.read('compiler-checks/environ-in-shlib.cc'),
name: 'ENVIRON_SHLIB_FLAGS',
args: ['--shared', '-fPIC', '-Wl,--no-undefined'],
)
if not result
ENVIRON_SHLIB_FLAGS += ['b_lundef=false']
endif
endif
#### System-specific Variables #### System-specific Variables
SYSTEM = build_machine.system() SYSTEM = build_machine.system()

View File

@ -19,8 +19,7 @@ kea_asiolink_lib = library(
install: true, install: true,
install_dir: 'lib', install_dir: 'lib',
link_with: LIBS_BUILT_SO_FAR, link_with: LIBS_BUILT_SO_FAR,
# The only way to avoid on FreeBSD: ld: error: undefined symbol: environ override_options: ENVIRON_SHLIB_FLAGS,
override_options: ['b_lundef=false'],
) )
LIBS_BUILT_SO_FAR = [kea_asiolink_lib] + LIBS_BUILT_SO_FAR LIBS_BUILT_SO_FAR = [kea_asiolink_lib] + LIBS_BUILT_SO_FAR
subdir('testutils') subdir('testutils')