configure: move cocoa option to Meson
While detection of the framework was already there, moving
the option allows for better error reporting.
Reported-by: Christophe de Dinechin <dinechin@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
diff --git a/meson.build b/meson.build
index afe53d8..34d4ff9 100644
--- a/meson.build
+++ b/meson.build
@@ -101,7 +101,7 @@
version_res = []
coref = []
iokit = []
-cocoa = []
+cocoa = not_found
hvf = []
if targetos == 'windows'
socket = cc.find_library('ws2_32')
@@ -114,7 +114,7 @@
elif targetos == 'darwin'
coref = dependency('appleframeworks', modules: 'CoreFoundation')
iokit = dependency('appleframeworks', modules: 'IOKit')
- cocoa = dependency('appleframeworks', modules: 'Cocoa')
+ cocoa = dependency('appleframeworks', modules: 'Cocoa', required: get_option('cocoa'))
hvf = dependency('appleframeworks', modules: 'Hypervisor')
elif targetos == 'sunos'
socket = [cc.find_library('socket'),
@@ -126,6 +126,10 @@
cc.find_library('bsd')]
endif
+if not cocoa.found() and get_option('cocoa').enabled()
+ error('Cocoa not available on this platform')
+endif
+
################
# Dependencies #
################
@@ -536,6 +540,7 @@
# Create config-host.h
+config_host_data.set('CONFIG_COCOA', cocoa.found())
config_host_data.set('CONFIG_LIBUDEV', libudev.found())
config_host_data.set('CONFIG_MPATH', mpathpersist.found())
config_host_data.set('CONFIG_MPATH_NEW_API', mpathpersist_new_api)