meson: Make bluez optional

I can't promise that the logic is *exactly* the same as the logic
currently in use with the autotools, but it seems correct to me.

Signed-off-by: Arnaud Rebillout <arnaud.rebillout@collabora.com>
This commit is contained in:
Arnaud Rebillout 2018-10-19 17:40:06 +07:00 committed by Arun Raghavan
parent d984da3fea
commit ab5e5fe5c6
4 changed files with 37 additions and 29 deletions

View file

@ -266,10 +266,21 @@ if avahi_dep.found()
cdata.set('HAVE_AVAHI', 1)
endif
bluez_dep = dependency('bluez', version : '>= 4.101', required : false)
# TODO fix bluez version, it seems wrong
bluez_dep = dependency('bluez', version : '>= 4.101', required : get_option('bluez5'))
sbc_dep = dependency('sbc', version : '>= 1.0', required : false)
if bluez_dep.found()
cdata.set('HAVE_BLUEZ_5_NATIVE_HEADSET', 1)
cdata.set('HAVE_BLUEZ_5_OFONO_HEADSET', 1) # TODO This should be optional
assert(dbus_dep.found(), 'BlueZ requires D-Bus support')
assert(sbc_dep.found(), 'BlueZ requires SBC support')
cdata.set('HAVE_SBC', 1)
cdata.set('HAVE_BLUEZ', 1)
cdata.set('HAVE_BLUEZ_5', 1)
if get_option('bluez5-native-headset')
cdata.set('HAVE_BLUEZ_5_NATIVE_HEADSET', 1)
endif
if get_option('bluez5-ofono-headset')
cdata.set('HAVE_BLUEZ_5_OFONO_HEADSET', 1)
endif
endif
jack_dep = dependency('jack', version : '>= 0.117.0', required : false)
@ -292,15 +303,6 @@ if openssl_dep.found()
cdata.set('HAVE_OPENSSL', 1)
endif
sbc_dep = dependency('sbc', version : '>= 1.0', required : false)
if sbc_dep.found()
cdata.set('HAVE_SBC', 1)
endif
if sbc_dep.found() and dbus_dep.found()
cdata.set('HAVE_BLUEZ', 1)
cdata.set('HAVE_BLUEZ_5', 1)
endif
speex_dep = dependency('speexdsp', version : '>= 1.2', required : false)
if speex_dep.found()
cdata.set('HAVE_SPEEX', 1)