From: Earl Chew Date: Sun, 17 Dec 2023 01:47:09 +0000 (-0800) Subject: Improve CHECK_LIB interaction with CHECK_PKG X-Git-Tag: tdb-1.4.11~802 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0c983bd0095d4fb20ef8b42f5efb740393073862;p=thirdparty%2Fsamba.git 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 Reviewed-by: Andrew Bartlett Reviewed-by: Douglas Bagnall --- diff --git a/buildtools/wafsamba/samba_autoconf.py b/buildtools/wafsamba/samba_autoconf.py index d2e44e83f78..802cbaced52 100644 --- a/buildtools/wafsamba/samba_autoconf.py +++ b/buildtools/wafsamba/samba_autoconf.py @@ -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)