summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOneric <oneric@oneric.stub>2020-11-13 23:49:11 +0100
committerOneric <oneric@oneric.stub>2020-11-13 23:49:11 +0100
commit5c309768cb4e55172f0609e931f0f481d7518c60 (patch)
treeff2c24350204978d2e698b205b122b66733114be
parentca747fa230f9db46ab7b4b61fb164dbc1a87e615 (diff)
downloadlibass-5c309768cb4e55172f0609e931f0f481d7518c60.tar.bz2
libass-5c309768cb4e55172f0609e931f0f481d7518c60.tar.xz
configure: use AC_SEARCH_LIBS instead of AC_CHECK_LIB
This avoids unneccessary -lm flags on some platforms integrating libm into libc and allows us to detect systems that do not provide implementations of math functions in either libc or libm. The caveat is, that some systems, like FreeBSD split their math functions between libc and libm. By checking for C99 lrint instead of C89 fabs, this check correctly includes libm in FreeBSD; let's hope this also holds for other systems splitting up their math.h implementations.
-rw-r--r--configure.ac7
1 files changed, 6 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index b5c880a..66a8fe3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -55,7 +55,12 @@ AC_SEARCH_LIBS([iconv_open], [iconv], use_libiconv=true)
AS_IF([test "x$use_libiconv" = xtrue], [
AC_DEFINE(CONFIG_ICONV, 1, [use iconv])
])
-AC_CHECK_LIB([m], [fabs])
+# Locate math functions. Most systems have it either in libc or libm, but a few
+# have some, eg C89, functions in libc and others in libm. Use C99 lrint to probe.
+AC_SEARCH_LIBS([lrint], [m],
+ [],
+ [AC_MSG_ERROR([Unable to locate math functions!])]
+)
pkg_libs="$LIBS"
LIBS="$OLDLIBS $LIBS"