diff --git a/core/config_process.l b/core/config_process.l
index 7f3265ae6bdcbc7d2f96c90c209a8696a16db818..42a98aee349cb0f25d658aedff21e456ce85c07f 100644
--- a/core/config_process.l
+++ b/core/config_process.l
@@ -53,6 +53,11 @@
 
 #include "../common/dbgnew.hh"
 
+#ifndef INFINITY
+#include <float.h>
+static const double INFINITY = (DBL_MAX*DBL_MAX);
+#endif
+
 #include "Profiler.hh"
 
 extern string_map_t *config_defines;
diff --git a/mctr2/cli/config_read.l b/mctr2/cli/config_read.l
index cc70a5fa6468105d25b6de4929e089728272f203..606cde048a546c7875b2187c8c7136b9e8bf39cc 100644
--- a/mctr2/cli/config_read.l
+++ b/mctr2/cli/config_read.l
@@ -51,6 +51,11 @@
 
 //#include "../../common/dbgnew.hh"
 
+#ifndef INFINITY
+#include <float.h>
+static const double INFINITY = (DBL_MAX*DBL_MAX);
+#endif
+
 extern string_map_t *config_defines;
 
 #define yylval config_read_lval