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)
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