summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOneric <oneric@oneric.stub>2020-11-13 23:49:11 +0100
committerOleg Oshmyan <chortos@inbox.lv>2020-11-14 01:34:54 +0200
commit5285a1342586311dae932de6285be81e6d00afb5 (patch)
tree58a52467d6b35c6412de3fa68c5ae492ccf4149d
parent3667eea1db904a274c72eec775a6d923c9ce9f0b (diff)
downloadlibass-5285a1342586311dae932de6285be81e6d00afb5.tar.bz2
libass-5285a1342586311dae932de6285be81e6d00afb5.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"