util.crand: Make it possible to use arc4random on Linux (needs libbsd)
authorKim Alvefur <zash@zash.se>
Sun, 03 Dec 2017 15:21:12 +0100
changeset 8451 f516a52f19e8
parent 8450 200f4f1b7833
child 8452 b572a708fd41
util.crand: Make it possible to use arc4random on Linux (needs libbsd)
configure
util-src/crand.c
--- a/configure	Sun Dec 03 15:03:25 2017 +0100
+++ b/configure	Sun Dec 03 15:21:12 2017 +0100
@@ -528,6 +528,8 @@
 
 if [ "$PRNG" = "OPENSSL" ]; then
    PRNGLIBS=$OPENSSL_LIBS
+elif [ "$PRNG" = "ARC4RANDOM" -a "$(uname)" = "Linux" ]; then
+   PRNGLIBS="-lbsd"
 fi
 
 # Write config
--- a/util-src/crand.c	Sun Dec 03 15:03:25 2017 +0100
+++ b/util-src/crand.c	Sun Dec 03 15:21:12 2017 +0100
@@ -54,7 +54,11 @@
 
 #elif defined(WITH_OPENSSL)
 #include <openssl/rand.h>
-#elif ! defined(WITH_ARC4RANDOM)
+#elif defined(WITH_ARC4RANDOM)
+#ifdef __linux__
+#include <bsd/stdlib.h>
+#endif
+#else
 #error util.crand compiled without a random source
 #endif