mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice-common
synced 2025-12-26 22:55:35 +00:00
build: Ensure we link with -lm if needed
lines.c uses hypot(), which is found in libm on some systems. This means we are currently relying on getting -lm indirectly through some other means, as otherwise linking any binary with spice-common would fail. Signed-off-by: Christophe Fergeau <cfergeau@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
This commit is contained in:
parent
349a74d7c2
commit
e98f8a430f
@ -64,6 +64,9 @@ AC_DEFUN([SPICE_CHECK_SYSDEPS], [
|
||||
AC_FUNC_ERROR_AT_LINE
|
||||
AC_FUNC_FORK
|
||||
AC_CHECK_FUNCS([dup2 floor inet_ntoa memmove memset pow sqrt])
|
||||
AC_SEARCH_LIBS([hypot], [m], [], [
|
||||
AC_MSG_ERROR([unable to find the hypot() function])
|
||||
])
|
||||
])
|
||||
|
||||
|
||||
|
||||
10
meson.build
10
meson.build
@ -87,6 +87,16 @@ foreach func : functions
|
||||
endif
|
||||
endforeach
|
||||
|
||||
# check for hypot function
|
||||
#
|
||||
# Include math.h header to avoid problems with builtins.
|
||||
# In some systems the function is in libm.
|
||||
if not compiler.has_function('hypot', prefix : '#include <math.h>')
|
||||
libm = compiler.find_library('m', required : false)
|
||||
if compiler.has_function('hypot', prefix : '#include <math.h>', dependencies : libm)
|
||||
spice_common_deps += libm
|
||||
endif
|
||||
endif
|
||||
|
||||
#
|
||||
# check for mandatory dependencies
|
||||
|
||||
Loading…
Reference in New Issue
Block a user