summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2020-05-14 17:59:12 +0200
committerGravatar Nikias Bassen2020-05-14 17:59:12 +0200
commitce1092a5fc83e1b5590128b5f642200c382451a6 (patch)
tree4b23f5de7f0486c162508282ab89b778df35995b
parent1b9bf8b08beaf2aa2cd90f6e580ae8f73cec2f9a (diff)
downloadlibplist-ce1092a5fc83e1b5590128b5f642200c382451a6.tar.gz
libplist-ce1092a5fc83e1b5590128b5f642200c382451a6.tar.bz2
Links with -lm if fmin doesn't seem to be a builtin
-rw-r--r--configure.ac12
1 files changed, 12 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 663aaef..65d3671 100644
--- a/configure.ac
+++ b/configure.ac
@@ -79,6 +79,14 @@ case ${host_os} in
esac
AM_CONDITIONAL(WIN32, test x$win32 = xtrue)
+# Check if we need libm for fmin
+AC_CACHE_CHECK(if fmin is a builtin function, ac_cv_fmin_builtin,
+ AC_TRY_COMPILE([
+ #include <math.h>
+ ], [
+ fmin(0.1f, 0.2f);
+ ], ac_cv_fmin_builtin=yes, ac_cv_fmin_builtin=no))
+
# Check if struct tm has a tm_gmtoff member
AC_CACHE_CHECK(for tm_gmtoff in struct tm, ac_cv_struct_tm_gmtoff,
AC_TRY_COMPILE([
@@ -139,6 +147,10 @@ AM_CONDITIONAL([HAVE_CYTHON],[test "x$cython_python_bindings" = "xyes"])
AS_COMPILER_FLAGS(GLOBAL_CFLAGS, "-Wall -Wextra -Wredundant-decls -Wshadow -Wpointer-arith -Wwrite-strings -Wswitch-default -Wno-unused-parameter -Wno-strict-aliasing -fvisibility=hidden $PTHREAD_CFLAGS")
GLOBAL_LDFLAGS="$PTHREAD_LIBS"
+if test "x$ac_cv_fmin_builtin" != "xyes"; then
+ GLOBAL_LDFLAGS+=" -lm"
+fi
+
AC_ARG_ENABLE(debug,
AS_HELP_STRING([--enable-debug],
[enable debugging, default: no]),