[Spice-devel] [PATCH spice-common] squash! build: Ensure we link with -lm if needed

Frediano Ziglio fziglio at redhat.com
Mon Jun 4 13:03:43 UTC 2018


---
 meson.build | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/meson.build b/meson.build
index de777db..27f70a9 100644
--- a/meson.build
+++ b/meson.build
@@ -87,6 +87,14 @@ foreach func : functions
   endif
 endforeach
 
+func = 'hypot'
+libm = compiler.find_library('m', required : false)
+if compiler.has_function(func, prefix : '#include <math.h>')
+  spice_common_config_data.set('HAVE_ at 0@'.format(func.to_upper()), '1')
+elif compiler.has_function(func, prefix : '#include <math.h>', dependencies : libm)
+  spice_common_deps += libm
+  spice_common_config_data.set('HAVE_ at 0@'.format(func.to_upper()), '1')
+endif
 
 #
 # check for mandatory dependencies
-- 
2.17.1



More information about the Spice-devel mailing list