diff --git a/meson_options.txt b/meson_options.txt index 6f307018815b0..b8e3d73b3025c 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -555,3 +555,9 @@ option( value : 8, description : 'Minimum Windows version to support. Defaults to Windows 8.' ) +option( + 'xmlconfig', + type : 'feature', + value : 'auto', + description : 'Build custom xmlconfig (driconf) support. If disabled, the default driconf file is hardcoded into Mesa. Requires expat.' +) diff --git a/src/util/meson.build b/src/util/meson.build index 43e5e39efde72..3f1aa152152c7 100644 --- a/src/util/meson.build +++ b/src/util/meson.build @@ -286,15 +286,23 @@ idep_mesautil = declare_dependency( dependencies : deps_for_libmesa_util, ) +# We don't have expat on Android or Windows, which is a needed dep for xmlconfig +supports_xmlconfig = not (with_platform_android or with_platform_windows) + +opt_xmlconfig = get_option('xmlconfig') +if opt_xmlconfig.enabled() and not supports_xmlconfig + error('xmlconfig not available on Android or Windows') +endif +use_xmlconfig = supports_xmlconfig and not opt_xmlconfig.disabled() + xmlconfig_deps = [] -if not (with_platform_android or with_platform_windows) - c_xmlconfig_arg = '-DWITH_XMLCONFIG=1' +if use_xmlconfig xmlconfig_deps += dep_expat -else - c_xmlconfig_arg = '-DWITH_XMLCONFIG=0' endif xmlconfig_deps += dep_regex +c_xmlconfig_arg = '-DWITH_XMLCONFIG=@0@'.format(use_xmlconfig.to_int()) + _libxmlconfig = static_library( 'xmlconfig', files_xmlconfig,