1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-03 01:18:10 +03:00

Improve CHECK_LIB interaction with CHECK_PKG

When checking for shared libraries, only name the target library
if it was not previously discoverd by pkg-config --libs and now
available from uselib_store. This avoids using both sources of
information which results in the library being named twice on
the command line.

Once the library is confirmed by CHECK_LIB, append the library if
not already present, to avoid dropping libraries that were
previously discovered by CHECK_PKG.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15623

Signed-off-by: Earl Chew <earl_chew@yahoo.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
This commit is contained in:
Earl Chew 2023-12-16 17:47:09 -08:00 committed by Andrew Bartlett
parent 363c331857
commit 0c983bd009

View File

@ -623,7 +623,12 @@ int foo()
(ccflags, ldflags, cpppath, libs) = library_flags(conf, lib)
if shlib:
res = conf.check(features='c cshlib', fragment=fragment, lib=lib, uselib_store=lib, cflags=ccflags, ldflags=ldflags, uselib=lib.upper(), mandatory=False)
# Avoid repeating the library if it is already named by
# pkg-config --libs.
kw = {}
if lib not in libs:
kw['lib'] = lib
res = conf.check(features='c cshlib', fragment=fragment, uselib_store=lib, cflags=ccflags, ldflags=ldflags, uselib=lib.upper(), mandatory=False, **kw)
else:
res = conf.check(lib=lib, uselib_store=lib, cflags=ccflags, ldflags=ldflags, uselib=lib.upper(), mandatory=False)
@ -637,7 +642,10 @@ int foo()
SET_TARGET_TYPE(conf, lib, 'EMPTY')
else:
conf.define('HAVE_LIB%s' % lib.upper().replace('-','_').replace('.','_'), 1)
conf.env['LIB_' + lib.upper()] = lib
# To avoid losing information from pkg-config, append the library
# only it is not already present.
if lib not in libs:
conf.env.append_value('LIB_' + lib.upper(), lib)
if set_target:
conf.SET_TARGET_TYPE(lib, 'SYSLIB')
ret.append(lib)