From 90d27aff47a3e3dc4c1d2450cbb8588e0b9546d2 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Wed, 20 May 2009 11:34:42 -0700 Subject: [PATCH] Only link libm with things that need libm. --- configure.ac | 14 ++++++++++++++ libmemcached/Makefile.am | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 7c541b24..103c3346 100644 --- a/configure.ac +++ b/configure.ac @@ -57,6 +57,20 @@ AC_TYPE_SIZE_T AC_SEARCH_LIBS(getopt_long, gnugetopt) AC_SEARCH_LIBS(socket, socket) AC_SEARCH_LIBS(gethostbyname, nsl) + +save_LIBS="$LIBS" +LIBS="$LIBS -lm" +AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[ +#include + ]],[[ + float f= floorf((float) 1.0); + ]], + [LIBM="-lm"],[LIBM=""])]) + +AC_SUBST(LIBM) +LIBS="$save_LIBS" AC_SEARCH_LIBS(floorf, m) diff --git a/libmemcached/Makefile.am b/libmemcached/Makefile.am index ebb31be5..be314700 100644 --- a/libmemcached/Makefile.am +++ b/libmemcached/Makefile.am @@ -73,7 +73,7 @@ endif DEFS += -DMEMCACHED_INTERNAL libmemcached_la_DEPENDENCIES = @DTRACE_OBJ@ -libmemcached_la_LIBADD = @DTRACE_OBJ@ +libmemcached_la_LIBADD = @DTRACE_OBJ@ $(LIBM) libmemcached_la_LDFLAGS = -version-info $(MEMCACHED_LIBRARY_VERSION) $(LD_VERSION_SCRIPT) $(LIBM) dtrace_probes.h: libmemcached_probes.d -- 2.30.2