summaryrefslogtreecommitdiff
path: root/aclocal.m4
diff options
context:
space:
mode:
authorIan Lynagh <ian@well-typed.com>2012-11-13 23:13:13 +0000
committerIan Lynagh <ian@well-typed.com>2012-11-13 23:19:59 +0000
commitc0017bd23db0255bc401867abac16725de18bdaa (patch)
tree72c52433086e1b433cd624aaac5ed3080e539f0a /aclocal.m4
parentda3b7cca9b8997d5072476f96164db717c716c51 (diff)
downloadhaskell-c0017bd23db0255bc401867abac16725de18bdaa.tar.gz
Fix FP_CHECK_TIMER_CREATE when cross-compiling
If we are cross-compiling, we assume that if timer_create exists then it works.
Diffstat (limited to 'aclocal.m4')
-rw-r--r--aclocal.m416
1 files changed, 13 insertions, 3 deletions
diff --git a/aclocal.m4 b/aclocal.m4
index 9de541bca1..d014b3a5cc 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1452,9 +1452,18 @@ AC_SUBST([ProjectPatchLevel])
# here, because there exist partially-working implementations of
# timer_create() in certain versions of Linux (see bug #1933).
#
-AC_DEFUN([FP_CHECK_TIMER_CREATE],
-if test "$cross_compiling" = "no" ; then
- [AC_CACHE_CHECK([for a working timer_create(CLOCK_REALTIME)],
+AC_DEFUN([FP_CHECK_TIMER_CREATE],[
+AC_CHECK_FUNC([timer_create],[HAVE_timer_create=yes],[HAVE_timer_create=no])
+
+if test "$HAVE_timer_create" = "yes"
+then
+ if test "$cross_compiling" = "yes"
+ then
+ # We can't test timer_create when we're cross-compiling, so we
+ # optimistiaclly assume that it actually works properly.
+ AC_DEFINE([USE_TIMER_CREATE], 1, [Define to 1 if we can use timer_create(CLOCK_PROCESS_CPUTIME_ID,...)])
+ else
+ AC_CACHE_CHECK([for a working timer_create(CLOCK_REALTIME)],
[fptools_cv_timer_create_works],
[AC_TRY_RUN([
#include <stdio.h>
@@ -1577,6 +1586,7 @@ case $fptools_cv_timer_create_works in
yes) AC_DEFINE([USE_TIMER_CREATE], 1,
[Define to 1 if we can use timer_create(CLOCK_PROCESS_CPUTIME_ID,...)]);;
esac
+ fi
fi
])