summaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
authorJason Evans <jasone@canonware.com>2016-10-28 04:23:48 (GMT)
committerJason Evans <jasone@canonware.com>2016-10-28 04:23:48 (GMT)
commitd76cfec319760c71bf3d30b9960c9e666785c461 (patch)
tree579ae577d4b0344a8361ebaac3d658b4163c20f8 /configure.ac
parentc44fa92db5cccf557d1ced431da6aa5ded58ed16 (diff)
downloadjemalloc-d76cfec319760c71bf3d30b9960c9e666785c461.zip
jemalloc-d76cfec319760c71bf3d30b9960c9e666785c461.tar.gz
jemalloc-d76cfec319760c71bf3d30b9960c9e666785c461.tar.bz2
Only link with libm (-lm) if necessary.
This fixes warnings when building with MSVC.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac15
1 files changed, 12 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac
index f27c61f..a9d7511 100644
--- a/configure.ac
+++ b/configure.ac
@@ -494,6 +494,15 @@ AC_SUBST([ARFLAGS])
AC_SUBST([AROUT])
AC_SUBST([CC_MM])
+dnl Determine whether libm must be linked to use e.g. log(3).
+AC_SEARCH_LIBS([log], [m], , [AC_MSG_ERROR([Missing math functions])])
+if test "x$ac_cv_search_log" != "xnone required" ; then
+ LM="$ac_cv_search_log"
+else
+ LM=
+fi
+AC_SUBST(LM)
+
JE_COMPILABLE([__attribute__ syntax],
[static __attribute__((unused)) void foo(void){}],
[],
@@ -940,9 +949,9 @@ fi
AC_MSG_CHECKING([configured backtracing method])
AC_MSG_RESULT([$backtrace_method])
if test "x$enable_prof" = "x1" ; then
- if test "x$abi" != "xpecoff"; then
- dnl Heap profiling uses the log(3) function.
- LIBS="$LIBS -lm"
+ dnl Heap profiling uses the log(3) function.
+ if test "x$LM" != "x" ; then
+ LIBS="$LIBS $LM"
fi
AC_DEFINE([JEMALLOC_PROF], [ ])