Source: libqb
Version: 1.0.1-1
Tags: patch upstream
User: [email protected]
Usertags: rebootstrap

libqb fails to cross build from source, because it uses an uncached
AC_RUN_IFELSE for determining whether CLOCK_MONOTONIC works. That check
is flawed in that availability of CLOCK_MONOTONIC is a runtime property
and may change from system to system.

The attached patch makes it check whether CLOCK_MONOTONIC is declared
and only then try whether it works. In case of cross compilation,
CLOCK_MONOTONIC is assumed to work if available, which seems like a
reasonable guess to me.

After applying the patch, libqb cross builds successfully. Can you take
it?

Helmut
Index: libqb-1.0.1/configure.ac
===================================================================
--- libqb-1.0.1.orig/configure.ac
+++ libqb-1.0.1/configure.ac
@@ -185,6 +185,8 @@
                     ]
                  )
 
+AC_CHECK_DECL([CLOCK_MONOTONIC],[],[],[#include <time.h>])
+AS_IF([test "x$ac_cv_have_decl_CLOCK_MONOTONIC" = "xyes"],[
 AC_MSG_CHECKING(for a working clock_getres(CLOCK_MONOTONIC, &ts))
 AC_RUN_IFELSE([AC_LANG_PROGRAM(
 [[#include <time.h>]],
@@ -195,8 +197,13 @@
                     ],
                     [
                       AC_MSG_RESULT([no])
-                    ]
+                    ],
+		    [
+		      AC_MSG_RESULT([guessing yes])
+                      AC_DEFINE_UNQUOTED([HAVE_CLOCK_GETRES_MONOTONIC], 1, [Define to 1 if clock_getres(CLOCK_MONOTONIC, &ts) works])
+		    ]
                  )
+])
 
 
 # Checks for library functions

Reply via email to