CC="$PTHREAD_CC"
# Check if floor is in the math library, and if so add -lm to LIBS
-AC_CHECK_LIB([m], [floor])
+HAVE__FLOOR=0
+AC_SEARCH_LIBS([floor], [m], [HAVE_FLOOR=1], [HAVE_FLOOR=0])
+if test "x$HAVE_FLOOR" = "x0"; then
+ # floor() is not available in libm (e.g. using AIX platform's compiler).
+ # Maybe __floor() is defined instead
+ AC_CHECK_FUNCS(__floor)
+fi
+AC_DEFINE([HAVE_FLOOR], [$HAVE_FLOOR], [Does the system have floor()?])
+AC_DEFINE([HAVE___FLOOR], [$HAVE___FLOOR], [Does the system have __floor()?])
# Check if clock_gettime, timer_create, timer_settime, and timer_delete are available in lib rt, and if so,
# add -lrt to LIBS
#endif /* !HAVE_DECL_STRSIGNAL */
/*
+ * On the AIX platform, floor() is not in libm, but
+ * __floor() is an internal function in the compiler,
+ * and a header defines floor() to __floor().
+ * For whatever reason, the headers included in Check
+ * do not pull that in. If floor() is missing but __floor()
+ * is available, make the definition.
+ */
+#if !HAVE_FLOOR && HAVE___FLOOR
+#define floor __floor
+#endif /* !HAVE_FLOOR && HAVE___FLOOR */
+
+/*
* On systems where clock_gettime() is not available, or
* on systems where some clocks may not be supported, the
* definition for CLOCK_MONOTONIC and CLOCK_REALTIME may not