diff --git a/meson.build b/meson.build
index 4b96853988d1edabe7dd6c4f80e903980008a3f0..086c3118852c8e3aca4925c8854252cd7d156258 100644
--- a/meson.build
+++ b/meson.build
@@ -538,16 +538,35 @@ _i = ' '.join(my_incdirs)
 # features which are converted into preprocessor flags (-D)
 #
 
+############
+# ieee754.h #
+#
+if compiler.has_header('ieee754.h',
+                       args: cflags,
+                       include_directories: include_directories(incdirs))
+    cflags += '-D__HAVE_IEEE754_H__'
+    have_ieee754 = true
+else
+    have_ieee754 = false
+endif
+
 ###########
 # drand48 #
 #
-if compiler.has_header('stdlib.h',
+if have_ieee754 and \
+   compiler.has_header('stdlib.h',
                        args: cflags,
                        include_directories: include_directories(incdirs)\
                       ) and \
    compiler.sizeof('drand48_r',
-                   prefix : '#include <stdlib.h>') > 0
+                   prefix : '#include <stdlib.h>') > 0 and \
+   compiler.has_header('ieee754.h',
+                       args: cflags,
+                       include_directories: include_directories(incdirs))
     cflags += '-D__HAVE_DRAND48__'
+    message('drand48 enabled')
+else
+    message('drand48 disabled')
 endif
 
 ############
@@ -559,14 +578,6 @@ 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
 
 
 ############ 
diff --git a/src/evolution/evolution_difflog.c b/src/evolution/evolution_difflog.c
index 951a6d04c4c8e531f0d9e8a4d0b9b8a6324ffda4..f8cd565fd1fed746f661f6bf925336c8b1c9303b 100644
--- a/src/evolution/evolution_difflog.c
+++ b/src/evolution/evolution_difflog.c
@@ -182,11 +182,11 @@ void evolution_difflog(struct stardata_t * RESTRICT const stardata)
      * Sort local log stack
      */
     void * arg = NULL;
-    qsort_r(logstack->items,
-            logstack->n,
-            sizeof(struct difflogitem_t *),
+    qsort_r((void*)logstack->items,
+            (size_t)logstack->n,
+            (size_t)sizeof(struct difflogitem_t *),
             (comparison_fn_r)compare_logitems,
-            &arg);
+            (void*)&arg);
     Safe_free(arg);
 
     /*