Browse Source

Bugfix: configure: Move actual roundl macro back to miner.h after math.h should be included

Otherwise systems that have roundl defined (but broken/missing) will error when the macro interferes with the definition
Luke Dashjr 12 years ago
parent
commit
0cd0a017cd
2 changed files with 5 additions and 1 deletions
  1. 1 1
      configure.ac
  2. 4 0
      miner.h

+ 1 - 1
configure.ac

@@ -568,7 +568,7 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([[
 	AC_MSG_RESULT([yes])
 ], [
 	AC_MSG_RESULT([no])
-	AC_DEFINE_UNQUOTED([roundl(x)], [(long double)((long long)((x==0)?0.0:((x)+(((x)>0)?0.5:-0.5))))], [Round to nearest integer, away from zero])
+	AC_DEFINE([NEED_ROUNDL], [1], [Defined to 1 if C99 roundl is missing])
 ])
 LIBS="${save_LIBS}"
 

+ 4 - 0
miner.h

@@ -190,6 +190,10 @@ static inline int fsync (int fd)
 #	endif
 #endif
 
+#ifdef NEED_ROUNDL
+#define roundl(x)   (long double)((long long)((x==0)?0.0:((x)+(((x)>0)?0.5:-0.5))))
+#endif
+
 enum alive {
 	LIFE_WELL,
 	LIFE_SICK,