diff options
author | kcgen <kcgen@users.noreply.github.com> | 2022-08-12 03:05:39 +0300 |
---|---|---|
committer | kcgen <1557255+kcgen@users.noreply.github.com> | 2022-08-12 18:10:07 +0300 |
commit | 5111f863ae89f6173f5a6daaa8106afd67d73658 (patch) | |
tree | 9b70e266b74c73c54e72db92afd007e43fce59cd /meson.build | |
parent | 201ca517db935747f012588046e688b8a6e58d01 (diff) |
Test SpeexDSP's floating-point API during Meson setup
Diffstat (limited to 'meson.build')
-rw-r--r-- | meson.build | 40 |
1 files changed, 34 insertions, 6 deletions
diff --git a/meson.build b/meson.build index 01f0c570b..b1ace2ee6 100644 --- a/meson.build +++ b/meson.build @@ -347,12 +347,40 @@ zlib_dep = dependency( static: ('zlib' in static_libs_list or prefers_static_libs), ) -speexdsp_dep = dependency( - 'speexdsp', - default_options: ['warning_level=0'], - allow_fallback: ('speexdsp' not in system_libs_list), - static: ('speexdsp' in static_libs_list or prefers_static_libs), -) +# SpeexDSP +# ~~~~~~~~ +# If the user asked to use SpeexDSP from the system then +# we need to ensure its floating-point API is reliable +# +use_speexdsp_from_system = 'speexdsp' in system_libs_list +if use_speexdsp_from_system + check_cpp = files('contrib/check-speexdsp/test_speexdsp_float_api.cpp') + check_if_msg = 'SpeexDSP system library has reliable floating-point API' + check_result = cxx.run( + check_cpp, + dependencies: dependency('speexdsp'), + name: check_if_msg, + ) + use_speexdsp_from_system = ( + check_result.compiled() + and check_result.returncode() == 0 + ) +endif +if use_speexdsp_from_system + speexdsp_dep = dependency( + 'speexdsp', + allow_fallback: false, + static: ('speexdsp' in static_libs_list or prefers_static_libs), + ) + speexdsp_summary_msg = 'system library' +else + speexdsp_dep = subproject( + 'speexdsp', + default_options: ['default_library=static', 'warning_level=0'], + ).get_variable('speexdsp_dep') + speexdsp_summary_msg = 'built-in' +endif +summary('SpeexDSP provider', speexdsp_summary_msg) # Optional libraries optional_dep = dependency('', required: false) |