Only link libm with things that need libm.
authorMonty Taylor <mordred@inaugust.com>
Wed, 20 May 2009 18:34:42 +0000 (11:34 -0700)
committerMonty Taylor <mordred@inaugust.com>
Wed, 20 May 2009 18:34:42 +0000 (11:34 -0700)
configure.ac
libmemcached/Makefile.am

index 7c541b242dfbb94f30326c7734b18e81c00f9af5..103c334668b60086d6658bca29623b8cc1f6f868 100644 (file)
@@ -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 <stdlib.h>
+    ]],[[
+      float f= floorf((float) 1.0);
+    ]],
+    [LIBM="-lm"],[LIBM=""])])
+    
+AC_SUBST(LIBM)
+LIBS="$save_LIBS"
 AC_SEARCH_LIBS(floorf, m)
 
 
index ebb31be57790ad1974af46d183f5aa20fe152346..be314700e3e333ba0f2685cdc34051e2bc57c320 100644 (file)
@@ -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