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