[PATCH] buildsys: Only display Objective-C information when Objective-C is used

Philippe Mathieu-Daudé posted 1 patch 7 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20231009091356.48713-1-philmd@linaro.org
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, "Daniel P. Berrangé" <berrange@redhat.com>, Thomas Huth <thuth@redhat.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>
There is a newer version of this series
meson.build | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] buildsys: Only display Objective-C information when Objective-C is used
Posted by Philippe Mathieu-Daudé 7 months ago
When configuring with '--disable-cocoa --disable-coreaudio'
on Darwin, we get:

 meson.build:4081:58: ERROR: Tried to access compiler for language "objc", not specified for host machine.
 meson.build:4097:47: ERROR: Tried to access unknown option 'objc_args'.

Instead of unconditionally display Objective-C informations
on Darwin, display them when Objective-C is discovered.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 meson.build | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/meson.build b/meson.build
index 3bb64b536c..da1a9a7228 100644
--- a/meson.build
+++ b/meson.build
@@ -4074,7 +4074,7 @@ if 'cpp' in all_languages
 else
   summary_info += {'C++ compiler':      false}
 endif
-if targetos == 'darwin'
+if 'objc' in all_languages
   summary_info += {'Objective-C compiler': ' '.join(meson.get_compiler('objc').cmd_array())}
 endif
 option_cflags = (get_option('debug') ? ['-g'] : [])
@@ -4085,7 +4085,7 @@ summary_info += {'CFLAGS':            ' '.join(get_option('c_args') + option_cfl
 if 'cpp' in all_languages
   summary_info += {'CXXFLAGS':        ' '.join(get_option('cpp_args') + option_cflags)}
 endif
-if targetos == 'darwin'
+if 'objc' in all_languages
   summary_info += {'OBJCFLAGS':       ' '.join(get_option('objc_args') + option_cflags)}
 endif
 link_args = get_option('c_link_args')
-- 
2.41.0


Re: [PATCH] buildsys: Only display Objective-C information when Objective-C is used
Posted by Akihiko Odaki 7 months ago
On 2023/10/09 18:13, Philippe Mathieu-Daudé wrote:
> When configuring with '--disable-cocoa --disable-coreaudio'
> on Darwin, we get:
> 
>   meson.build:4081:58: ERROR: Tried to access compiler for language "objc", not specified for host machine.
>   meson.build:4097:47: ERROR: Tried to access unknown option 'objc_args'.
> 
> Instead of unconditionally display Objective-C informations
> on Darwin, display them when Objective-C is discovered.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   meson.build | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/meson.build b/meson.build
> index 3bb64b536c..da1a9a7228 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -4074,7 +4074,7 @@ if 'cpp' in all_languages
>   else
>     summary_info += {'C++ compiler':      false}
>   endif
> -if targetos == 'darwin'
> +if 'objc' in all_languages
>     summary_info += {'Objective-C compiler': ' '.join(meson.get_compiler('objc').cmd_array())}
>   endif

Probably it's more kind if it emits "Objective-C compiler: false" as it 
does for C++ when the compiler is not available.