@runonce
@conf
def CHECK_BUNDLED_SYSTEM(conf, libname, minversion='0.0.0',
- checkfunctions=None, headers=None):
+ checkfunctions=None, headers=None, onlyif=None):
'''check if a library is available as a system library.
this first tries via pkg-config, then if that fails
tries by testing for a specified function in the specified lib
found = 'FOUND_SYSTEMLIB_%s' % libname
if found in conf.env:
return conf.env[found]
+
+ # see if the library should only use a system version if another dependent
+ # system version is found. That prevents possible use of mixed library
+ # versions
+ if onlyif:
+ for syslib in TO_LIST(onlyif):
+ f = 'FOUND_SYSTEM_%s' % syslib
+ if not f in conf.env:
+ if 'NONE' in conf.env.BUNDLED_LIBS or '!'+libname in conf.env.BUNDLED_LIBS:
+ print('ERROR: Use of system library %s depends on missing system library %s' % (libname, syslib))
+ sys.exit(1)
+ conf.env[found] = False
+ return False
+
# try pkgconfig first
if conf.check_cfg(package=libname,
args='"%s >= %s" --cflags --libs' % (libname, minversion),
conf.sub_config(LIBREPLACE_DIR)
conf.sub_config(LIBTALLOC_DIR)
- if conf.CHECK_BUNDLED_SYSTEM('tevent', minversion=VERSION):
+ if conf.CHECK_BUNDLED_SYSTEM('tevent', minversion=VERSION, onlyif='talloc'):
conf.define('USING_SYSTEM_TEVENT', 1)
if conf.CHECK_FUNCS('epoll_create', headers='sys/epoll.h'):
if not s4_build:
- if conf.CHECK_BUNDLED_SYSTEM('ldb', minversion=VERSION):
+ if conf.CHECK_BUNDLED_SYSTEM('ldb', minversion=VERSION,
+ onlyif='talloc tdb tevent'):
conf.define('USING_SYSTEM_LDB', 1)
# we need this for the ldap backend
conf.CHECK_FUNCS_IN('ber_flush ldap_open', 'lber ldap', headers='lber.h ldap.h', mandatory=True)