scons: handle a gdal-config --libs that reports -framework GDAL on osx

This commit is contained in:
Dane Springmeyer 2011-02-03 20:21:35 +00:00
parent ca8e241006
commit f1e1900480

View file

@ -521,7 +521,16 @@ def parse_config(context, config, checks='--libs --cflags'):
parsed = False parsed = False
if ret: if ret:
try: try:
env.ParseConfig(cmd) # hack for potential -framework GDAL syntax
# which will not end up being added to env['LIBS']
# and thus breaks knowledge below that gdal worked
if 'gdal-config' in cmd:
num_libs = len(env['LIBS'])
env.ParseConfig(cmd)
if not num_libs > env['LIBS']:
env['LIBS'].append('gdal')
else:
env.ParseConfig(cmd)
parsed = True parsed = True
except OSError, e: except OSError, e:
ret = False ret = False
@ -546,9 +555,13 @@ def get_pkg_lib(context, config, lib):
parsed = False parsed = False
if ret: if ret:
try: try:
libnames = re.findall(libpattern,call(cmd,silent=True)) value = call(cmd,silent=True)
libnames = re.findall(libpattern,value)
if libnames: if libnames:
libname = libnames[0] libname = libnames[0]
else:
# osx 1.8 install gives '-framework GDAL'
libname = 'gdal'
except Exception, e: except Exception, e:
ret = False ret = False
print ' unable to determine library name:'# %s' % str(e) print ' unable to determine library name:'# %s' % str(e)