From ffcacf3509f491b402d0602ae99902d91f3bf5c1 Mon Sep 17 00:00:00 2001 From: artemp Date: Thu, 30 Jul 2015 13:14:37 +0200 Subject: [PATCH] make libxml2 optional dependency (XMLPARSER=libxml2) --- SConstruct | 25 +++++++++++++------------ src/build.py | 2 +- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/SConstruct b/SConstruct index 9f3c0f4a9..a09b63aa6 100644 --- a/SConstruct +++ b/SConstruct @@ -1266,18 +1266,19 @@ if not preconfigured: # libxml2 should be optional but is currently not # https://github.com/mapnik/mapnik/issues/913 - if env.get('XML2_LIBS') or env.get('XML2_INCLUDES'): - REQUIRED_LIBSHEADERS.insert(0,['libxml2','libxml/parser.h',True,'C']) - if env.get('XML2_INCLUDES'): - inc_path = env['XML2_INCLUDES'] - env.AppendUnique(CPPPATH = fix_path(inc_path)) - if env.get('XML2_LIBS'): - lib_path = env['XML2_LIBS'] - env.AppendUnique(LIBPATH = fix_path(lib_path)) - elif conf.parse_config('XML2_CONFIG',checks='--cflags'): - env['HAS_LIBXML2'] = True - else: - env['MISSING_DEPS'].append('libxml2') + if env.get('XMLPARSER') and env['XMLPARSER'] == 'libxml2': + if env.get('XML2_LIBS') or env.get('XML2_INCLUDES'): + OPTIONAL_LIBSHEADERS.insert(0,['libxml2','libxml/parser.h',True,'C']) + if env.get('XML2_INCLUDES'): + inc_path = env['XML2_INCLUDES'] + env.AppendUnique(CPPPATH = fix_path(inc_path)) + if env.get('XML2_LIBS'): + lib_path = env['XML2_LIBS'] + env.AppendUnique(LIBPATH = fix_path(lib_path)) + elif conf.parse_config('XML2_CONFIG',checks='--cflags'): + env['HAS_LIBXML2'] = True + else: + env['MISSING_DEPS'].append('libxml2') if not env['HOST']: if conf.CheckHasDlfcn(): diff --git a/src/build.py b/src/build.py index 520a34710..3d9e3c4c9 100644 --- a/src/build.py +++ b/src/build.py @@ -84,7 +84,7 @@ if '-DHAVE_WEBP' in env['CPPDEFINES']: lib_env['LIBS'].append('webp') enabled_imaging_libraries.append('webp_reader.cpp') -lib_env['LIBS'].append('xml2') +if '-DHAVE_LIBXML2' in env['CPPDEFINES'] : lib_env['LIBS'].append('xml2') if '-DBOOST_REGEX_HAS_ICU' in env['CPPDEFINES']: lib_env['LIBS'].append('icui18n')