From 13891b2cf4d67567eb4a2d961f8d816c9310d1c5 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Mon, 7 Jun 2021 18:49:25 +0300 Subject: [PATCH 52/52] Meson: Respect cross_inc_path when detecting headers See osdn #42484 Signed-off-by: Marko Lindqvist --- meson.build | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/meson.build b/meson.build index 39e67f73ff..64930193f1 100644 --- a/meson.build +++ b/meson.build @@ -64,6 +64,14 @@ endif c_compiler = meson.get_compiler('c') +if meson.is_cross_build() + cross_inc_path = meson.get_cross_property('cross_inc_path') + cross_lib_path = meson.get_cross_property('cross_lib_path') +else + cross_inc_path = [] + cross_lib_path = [] +endif + pub_headers = [ 'locale.h', 'libintl.h', @@ -113,15 +121,20 @@ priv_headers = [ 'vfork.h' ] +if cross_inc_path == [] + header_arg = [] +else + header_arg = '-I' + cross_inc_path +endif foreach hdr : pub_headers - if c_compiler.has_header(hdr) + if c_compiler.has_header(hdr, args: header_arg) pub_conf_data.set('FREECIV_HAVE_' + hdr.underscorify().to_upper(), 1) priv_conf_data.set('HAVE_' + hdr.underscorify().to_upper(), 1) endif endforeach foreach hdr : priv_headers - if c_compiler.has_header(hdr) + if c_compiler.has_header(hdr, args: header_arg) priv_conf_data.set('HAVE_' + hdr.underscorify().to_upper(), 1) endif endforeach @@ -305,14 +318,6 @@ if get_option('cacert-path') != '' '"' + get_option('cacert-path') + '"') endif -if meson.is_cross_build() - cross_inc_path = meson.get_cross_property('cross_inc_path') - cross_lib_path = meson.get_cross_property('cross_lib_path') -else - cross_inc_path = [] - cross_lib_path = [] -endif - if get_option('audio') priv_conf_data.set('AUDIO_SDL', 1) -- 2.30.2