summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2017-12-21 11:48:15 +0100
committerAdam Jackson <ajax@redhat.com>2018-01-08 14:59:30 -0500
commitc601c8faf54ff9e3bcbc653421828d71042deef7 (patch)
tree083968f964eaa9f55f0e880ffa68617c6923ed9b /configure.ac
parenta309323328d9d6e0bf5d9ea1d75920e53b9beef3 (diff)
build: guess availability of monotonic clock for cross compilation
When cross compiling, the value of MONOTONIC_CLOCK would be "cross compiling", because AC_RUN_IFELSE doesn't work. However when enabling wayland, a monotonic clock is required and configure aborts. We change detection of CLOCK_MONOTONIC to degrade it gracefully from a run check to a declaration check in case of cross compilation based on the assumption that most systems will have a monotonic clock and those that don't won't be able to run Xwayland anyway. The trade-off essentially is either "always fail cross compilation" or "produce an unusable Xwayland for unusual platform" and this commit switches to the latter. Signed-off-by: Helmut Grohne <helmut@subdivi.de> Bug-Debian: https://bugs.debian.org/882531 Reviewed-by: Adam Jackson <ajax@redhat.com>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac7
1 files changed, 7 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 456a9e0a9..30b4b383d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -997,6 +997,10 @@ int main(int argc, char *argv[[]]) {
])], [MONOTONIC_CLOCK=yes], [MONOTONIC_CLOCK=no],
[MONOTONIC_CLOCK="cross compiling"])
+ if test "$MONOTONIC_CLOCK" = "cross compiling"; then
+ AC_CHECK_DECL([CLOCK_MONOTONIC],[MONOTONIC_CLOCK="guessing yes"],[MONOTONIC_CLOCK=no],[#include <time.h>])
+ fi
+
LIBS="$LIBS_SAVE"
CPPFLAGS="$CPPFLAGS_SAVE"
else
@@ -1004,6 +1008,9 @@ else
fi
AC_MSG_RESULT([$MONOTONIC_CLOCK])
+if test "$MONOTONIC_CLOCK" = "guessing yes"; then
+ MONOTONIC_CLOCK=yes
+fi
if test "x$MONOTONIC_CLOCK" = xyes; then
AC_DEFINE(MONOTONIC_CLOCK, 1, [Have monotonic clock from clock_gettime()])