make gdal lib check more robust

This commit is contained in:
Dane Springmeyer 2013-07-29 20:32:03 -04:00
parent 64efd5fdf2
commit 187ab3fe73

View file

@ -615,6 +615,10 @@ def get_pkg_lib(context, config, lib):
if ret: if ret:
try: try:
value = call(cmd,silent=True) value = call(cmd,silent=True)
if ' ' in value:
parts = value.split(' ')
if len(parts) > 1:
value = parts[1]
libnames = re.findall(libpattern,value) libnames = re.findall(libpattern,value)
if libnames: if libnames:
libname = libnames[0] libname = libnames[0]
@ -1364,7 +1368,12 @@ if not preconfigured:
conf.parse_config('GDAL_CONFIG',checks='--cflags') conf.parse_config('GDAL_CONFIG',checks='--cflags')
libname = conf.get_pkg_lib('GDAL_CONFIG','gdal') libname = conf.get_pkg_lib('GDAL_CONFIG','gdal')
if libname: if libname:
details['lib'] = libname if not conf.CheckLibWithHeader(libname, details['inc'], details['lang']):
env['SKIPPED_DEPS'].append('gdal')
if libname in env['LIBS']:
env['LIBS'].remove(libname)
else:
details['lib'] = libname
elif plugin == 'postgis': elif plugin == 'postgis':
conf.parse_pg_config('PG_CONFIG') conf.parse_pg_config('PG_CONFIG')
elif plugin == 'ogr': elif plugin == 'ogr':
@ -1374,7 +1383,13 @@ if not preconfigured:
conf.parse_config('GDAL_CONFIG',checks='--cflags') conf.parse_config('GDAL_CONFIG',checks='--cflags')
libname = conf.get_pkg_lib('GDAL_CONFIG','ogr') libname = conf.get_pkg_lib('GDAL_CONFIG','ogr')
if libname: if libname:
details['lib'] = libname if not conf.CheckLibWithHeader(libname, details['inc'], details['lang']):
if 'gdal' not in env['SKIPPED_DEPS']:
env['SKIPPED_DEPS'].append('gdal')
if libname in env['LIBS']:
env['LIBS'].remove(libname)
else:
details['lib'] = libname
elif details['path'] and details['lib'] and details['inc']: elif details['path'] and details['lib'] and details['inc']:
backup = env.Clone().Dictionary() backup = env.Clone().Dictionary()
# Note, the 'delete_existing' keyword makes sure that these paths are prepended # Note, the 'delete_existing' keyword makes sure that these paths are prepended