diff --git a/ole/variant.c b/ole/variant.c
index 7eaf58d27ac876aa37dc96f7b463344903dc09b7..5ea1b7d4f980b184d15602a0386a7cf2e8fc5c28 100644
--- a/ole/variant.c
+++ b/ole/variant.c
@@ -31,6 +31,17 @@
 #include <math.h>
 #include <time.h>
 
+#ifdef HAVE_FLOAT_H
+# include <float.h>
+#endif
+
+#ifndef FLT_MAX
+# ifdef MAXFLOAT
+#  define FLT_MAX MAXFLOAT
+# else
+#  error "Can't find #define for MAXFLOAT/FLT_MAX"
+# endif
+#endif
 
 static const char CHAR_MAX = 127;
 static const char CHAR_MIN = -128;