Add a BeConservative setting to the make system
authorIan Lynagh <igloo@earth.li>
Mon, 10 Sep 2007 13:35:28 +0000 (13:35 +0000)
committerIan Lynagh <igloo@earth.li>
Mon, 10 Sep 2007 13:35:28 +0000 (13:35 +0000)
If it is set, we don't try to use clock_gettime

mk/config.mk.in
rts/Makefile
rts/posix/GetTime.c

index 383011d..9bfd642 100644 (file)
@@ -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).
index c310ee0..e3bc692 100644 (file)
@@ -35,6 +35,10 @@ GhcRtsHcOpts=
 GhcRtsCcOpts=-g -O0
 endif
 
+ifeq "$(BeConservative)" "YES"
+GhcRtsCcOpts += -DBE_CONSERVATIVE
+endif
+
 # -----------------------------------------------------------------------------
 
 # There's nothing for Haddock here...
index 626882b..34fcd5c 100644 (file)
@@ -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.