From: Ian Lynagh Date: Mon, 10 Sep 2007 13:35:28 +0000 (+0000) Subject: Add a BeConservative setting to the make system X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=60610640fdf2f9b037f2d323f3e1127849e76028 Add a BeConservative setting to the make system If it is set, we don't try to use clock_gettime --- diff --git a/mk/config.mk.in b/mk/config.mk.in index 383011d..9bfd642 100644 --- a/mk/config.mk.in +++ b/mk/config.mk.in @@ -291,6 +291,10 @@ else GhcEnableTablesNextToCode=YES endif +# When building bindists we set this to yes so that the binaries are as +# portable as possible. +BeConservative = NO + # # Building various ways? # (right now, empty if not). diff --git a/rts/Makefile b/rts/Makefile index c310ee0..e3bc692 100644 --- a/rts/Makefile +++ b/rts/Makefile @@ -35,6 +35,10 @@ GhcRtsHcOpts= GhcRtsCcOpts=-g -O0 endif +ifeq "$(BeConservative)" "YES" +GhcRtsCcOpts += -DBE_CONSERVATIVE +endif + # ----------------------------------------------------------------------------- # There's nothing for Haddock here... diff --git a/rts/posix/GetTime.c b/rts/posix/GetTime.c index 626882b..34fcd5c 100644 --- a/rts/posix/GetTime.c +++ b/rts/posix/GetTime.c @@ -134,7 +134,7 @@ Ticks getThreadCPUTime(void) } return ((usec * TICKS_PER_SECOND) / 1000000); -#elif defined(HAVE_CLOCK_GETTIME) && defined (_POSIX_THREAD_CPUTIME) && defined(CLOCK_THREAD_CPUTIME_ID) && defined(HAVE_SYSCONF) +#elif !defined(BE_CONSERVATIVE) && defined(HAVE_CLOCK_GETTIME) && defined (_POSIX_THREAD_CPUTIME) && defined(CLOCK_THREAD_CPUTIME_ID) && defined(HAVE_SYSCONF) if (sysconf(_POSIX_THREAD_CPUTIME) != -1) { // clock_gettime() gives us per-thread CPU time. It isn't // reliable on Linux, but it's the best we have.