X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=rts%2FRtsUtils.c;h=0123531e27ab3a8bdeed2607e852e065ae29898f;hp=7048e94cd0cf193ff12dee2b72ad3fc9f925730d;hb=842e9d6628a27cf1f420d53f6a5901935dc50c54;hpb=150cc9e2e4657cc58bd7ec4c15e5cb72f2e1c0f6 diff --git a/rts/RtsUtils.c b/rts/RtsUtils.c index 7048e94..0123531 100644 --- a/rts/RtsUtils.c +++ b/rts/RtsUtils.c @@ -18,6 +18,13 @@ #include #endif +/* HACK: On Mac OS X 10.4 (at least), time.h doesn't declare ctime_r with + * _POSIX_C_SOURCE. If this is the case, we declare it ourselves. + */ +#if HAVE_CTIME_R && !HAVE_DECL_CTIME_R +extern char *ctime_r(const time_t *, char *); +#endif + #ifdef HAVE_FCNTL_H #include #endif @@ -316,7 +323,6 @@ resetGenSymZh(void) /* it's your funeral */ Get the current time as a string. Used in profiling reports. -------------------------------------------------------------------------- */ -#if defined(PROFILING) || defined(DEBUG) || defined(PAR) || defined(GRAN) char * time_str(void) { @@ -335,7 +341,6 @@ time_str(void) } return nowstr; } -#endif /* ----------------------------------------------------------------------------- * Reset a file handle to blocking mode. We do this for the standard @@ -462,3 +467,23 @@ int genericRaise(int sig) { return raise(sig); #endif } + +static void mkRtsInfoPair(char *key, char *val) { + /* XXX should check for "s, \s etc in key and val */ + printf(" ,(\"%s\", \"%s\")\n", key, val); +} + +void printRtsInfo(void) { + /* The first entry is just a hack to make it easy to get the + * commas right */ + printf(" [(\"GHC RTS\", \"Yes\")\n"); + mkRtsInfoPair("GHC version", ProjectVersion); + mkRtsInfoPair("RTS way", RtsWay); + mkRtsInfoPair("Host platform", HostPlatform); + mkRtsInfoPair("Build platform", BuildPlatform); + mkRtsInfoPair("Target platform", TargetPlatform); + mkRtsInfoPair("Compiler unregisterised", GhcUnregisterised); + mkRtsInfoPair("Tables next to code", GhcEnableTablesNextToCode); + printf(" ]\n"); +} +