diff --git a/meson.build b/meson.build
index fce95952b9a87114e1fa9b4d57d454c05d261f69..4b96853988d1edabe7dd6c4f80e903980008a3f0 100644
--- a/meson.build
+++ b/meson.build
@@ -559,6 +559,16 @@ if compiler.has_header('malloc.h',
     cflags += '-D__HAVE_MALLOC_H__'
 endif
 
+############
+# malloc.h #
+#
+if compiler.has_header('ieee754.h',
+                       args: cflags,
+                       include_directories: include_directories(incdirs))
+    cflags += '-D__HAVE_IEEE754_H__'
+endif
+
+
 ############ 
 # setitimer 
 #
diff --git a/src/binary_c_code_options.h b/src/binary_c_code_options.h
index 98a66eb3dbef26df72c1743cd56a213906f581d1..7e0569410b79b2ca23c5e4866d4c799aece7aef8 100644
--- a/src/binary_c_code_options.h
+++ b/src/binary_c_code_options.h
@@ -919,8 +919,10 @@ void Print_trace(void);
  * use snprintf in place of strlcpy 
  */
 #ifndef __HAVE_LIBBSD__
+#undef strlcpy
 #define strlcpy(d,s,n) snprintf((d),(n),"%s",(s))
 #define __STRLCPY_IS_MACRO__
+#undef strlcat
 #define strlcat(dest,source,size) __local_bsd_strlcat((dest),(source),(size))
 #define __STRLCAT_IS_BSD_COPY__
 #endif // __HAVE_LIBBSD__
diff --git a/src/maths/binary_c_drandr.c b/src/maths/binary_c_drandr.c
index b683f03c35e6c866bcb9e74fe95d32aa3dd7f472..21307db03949f1ad614516928da6e337e2a7f570 100644
--- a/src/maths/binary_c_drandr.c
+++ b/src/maths/binary_c_drandr.c
@@ -35,7 +35,9 @@
 #include <stdlib.h>
 #include "binary_c_drandr_types.h"
 #include "binary_c_drandr_prototypes.h"
+#ifdef __HAVE_IEEE754_H__
 #include <ieee754.h>
+#endif // ___HAVE_IEEE754_H__
 #include <limits.h>
 #include <stdint.h>
 #include <sys/types.h>
@@ -64,7 +66,11 @@ int binary_c_erand48_r (unsigned short int xsubi[3],
        its fractional part so the resulting FP number is [0.0,1.0).  */
 
     temp.ieee.negative = 0;
+#ifdef __HAVE_IEEE754_H__
     temp.ieee.exponent = IEEE754_DOUBLE_BIAS;
+#else
+    temp.ieee.exponent = 0x3ff; /* hard coded! */
+#endif
     temp.ieee.mantissa0 = (xsubi[2] << 4) | (xsubi[1] >> 12);
     temp.ieee.mantissa1 = ((xsubi[1] & 0xfff) << 20) | (xsubi[0] << 4);