From 9f0fb0261ecdecb093ced28024a36973bf1938b9 Mon Sep 17 00:00:00 2001 From: Matthieu Patou Date: Sun, 31 Oct 2010 16:24:46 +0300 Subject: build: check that if we provide -liconv we can build shared libs On Solaris with sun studio compiling an executable with -liconv even if there is no libiconv.so or libiconv.a will work but not for a shared lib. This problem leads to build problem as the linker won't be able to find libiconv when building shared lib as liconv is wrongly specified --- buildtools/wafsamba/samba_autoconf.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'buildtools/wafsamba/samba_autoconf.py') diff --git a/buildtools/wafsamba/samba_autoconf.py b/buildtools/wafsamba/samba_autoconf.py index f987d1d41a..e84a456287 100644 --- a/buildtools/wafsamba/samba_autoconf.py +++ b/buildtools/wafsamba/samba_autoconf.py @@ -474,12 +474,19 @@ def library_flags(conf, libs): @conf -def CHECK_LIB(conf, libs, mandatory=False, empty_decl=True, set_target=True): +def CHECK_LIB(conf, libs, mandatory=False, empty_decl=True, set_target=True, shlib=False): '''check if a set of libraries exist as system libraries returns the sublist of libs that do exist as a syslib or [] ''' + fragment= ''' +int foo() +{ + int v = 2; + return v*2; +} +''' ret = [] liblist = TO_LIST(libs) for lib in liblist[:]: @@ -488,8 +495,12 @@ def CHECK_LIB(conf, libs, mandatory=False, empty_decl=True, set_target=True): continue (ccflags, ldflags) = library_flags(conf, lib) + if shlib: + res = conf.check(features='cc cshlib', fragment=fragment, lib=lib, uselib_store=lib, ccflags=ccflags, ldflags=ldflags) + else: + res = conf.check(lib=lib, uselib_store=lib, ccflags=ccflags, ldflags=ldflags) - if not conf.check(lib=lib, uselib_store=lib, ccflags=ccflags, ldflags=ldflags): + if not res: if mandatory: Logs.error("Mandatory library '%s' not found for functions '%s'" % (lib, list)) sys.exit(1) -- cgit