]> granicus.if.org Git - check/commitdiff
autotools: change check for floor() and __floor()
authorbrarcher <brarcher@64e312b2-a51f-0410-8e61-82d0ca0eb02a>
Mon, 23 Jun 2014 04:12:55 +0000 (04:12 +0000)
committerbrarcher <brarcher@64e312b2-a51f-0410-8e61-82d0ca0eb02a>
Mon, 23 Jun 2014 04:12:55 +0000 (04:12 +0000)
The reason AIX is having difficulty with floor() is that the
   AC_CHECK_LIB([m], [floor])
finds floor() in libm, however due to some header file stuff
(maybe) floor() cannot be used directly. Instead, there is likely
a definition for __floor() -> floor().

To check for this, floor() is detected in libm as normal. After,
determine if floor() can be used directly. If not, check if __floor()
is defined (not necessarily a function). If floor() is usable, do
that. If not but __floor() is available, try using that.

git-svn-id: svn+ssh://svn.code.sf.net/p/check/code/trunk@1147 64e312b2-a51f-0410-8e61-82d0ca0eb02a

NEWS
configure.ac

diff --git a/NEWS b/NEWS
index 5b25c8eea11ffb1e6cf0047e6d3346b360a654af..31472df314dc4ba28184ba38f96c32020d301ec3 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,8 @@
 In Development:
 # Mentioning Check 0.9.13 for now, to fix distcheck target until next release
 
+* Changes to (unofficially for now) support Solaris and AIX platforms.
+
 
 Fri May 30, 2014: Released Check 0.9.13
   based on r1137 (2014-05-26 21:03:09 +0000)
index 062ec1882f94ebdf5d5af5772b91866b4783c256..a575471c8890a60773e4095106c7c20b1dc87f36 100644 (file)
@@ -189,8 +189,17 @@ ACX_PTHREAD
 CC="$PTHREAD_CC"
 
 # Check if floor is in the math library, and if so add -lm to LIBS
-AC_SEARCH_LIBS([floor], [m], [AC_DEFINE([HAVE_FLOOR], [1], [Does the system have floor()?])],
-[AC_CHECK_FUNCS(__floor, [AC_DEFINE([HAVE___FLOOR], [1], [Does the system have __floor()?])], [])])
+AC_CHECK_LIB([m], [floor])
+
+# On some versions of AIX, although floor() is found in libm,
+# it cannot be used directly. Instead __floor() must be used.
+# This checks if this is the case.
+AC_CHECK_FUNC([floor],
+  [AC_DEFINE([HAVE_FLOOR], [1], [Can the system use floor() directly?])],
+  [AC_CHECK_DECL([__floor],
+    [AC_DEFINE([HAVE___FLOOR], [1], [Does the system define __floor() instead?])],
+    [])
+  ])
 
 # Check if clock_gettime, timer_create, timer_settime, and timer_delete are available in lib rt, and if so,
 # add -lrt to LIBS