scons: use gdal-config to obtain GDAL data path

This commit is contained in:
Mickey Rose 2019-08-19 17:35:45 +02:00
parent a25f53e667
commit 65d2d9d188

View file

@ -763,7 +763,7 @@ def ogr_enabled(context):
context.Message( 'Checking if gdal is ogr enabled... ')
context.sconf.cached = False
ret, out = config_command(env['GDAL_CONFIG'], '--ogr-enabled')
if ret and out:
if ret:
ret = (out == 'yes')
if not ret:
if 'ogr' not in env['SKIPPED_DEPS']:
@ -913,29 +913,21 @@ int main() {
def CheckGdalData(context, silent=False):
env = context.env
if not silent:
context.Message('Checking for GDAL data directory... ')
ret, out = context.TryRun("""
#include "cpl_config.h"
#include <iostream>
int main() {
std::cout << GDAL_PREFIX << "/share/gdal" << std::endl;
return 0;
}
""", '.cpp')
context.sconf.cached = False
ret, out = config_command(env['GDAL_CONFIG'], '--datadir')
value = out.strip()
if silent:
context.did_show_result=1
if ret:
context.Result('GDAL_PREFIX returned %s' % value)
context.Result('%s returned %s' % (env['GDAL_CONFIG'], value))
else:
context.Result('Failed to detect (mapnik-config will have null value)')
return value
def CheckProjData(context, silent=False):
if not silent: