summaryrefslogtreecommitdiffstats
path: root/configure
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2014-09-07 17:24:07 +0000
committerRoy Marples <roy@marples.name>2014-09-07 17:24:07 +0000
commit01890c79df552fe5ed717fb97d9dd5bfb622980d (patch)
tree87e34612a2035f828f6cfd7d96756356044ffb98 /configure
parentb9ab902d8a65a29caa8ea4d8885c33c10e923333 (diff)
downloaddhcpcd-01890c79df552fe5ed717fb97d9dd5bfb622980d.tar.xz
Split arc4random_uniform into it's own compat function and add
it's proper copyright. Add a new test for it to configure so that we can use the uclibc arc4random function and our compat arc4random_uniform function.
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure22
1 files changed, 22 insertions, 0 deletions
diff --git a/configure b/configure
index 9c322223..fccfb470 100755
--- a/configure
+++ b/configure
@@ -509,6 +509,28 @@ if [ "$ARC4RANDOM" = no ]; then
echo "#include \"compat/arc4random.h\"" >>$CONFIG_H
fi
+if [ -z "$ARC4RANDOM_UNIFORM" ]; then
+ printf "Testing for arc4random_uniform ... "
+ cat <<EOF >_arc4random_uniform.c
+#include <stdlib.h>
+int main(void) {
+ arc4random_uniform(100);
+ return 0;
+}
+EOF
+ if $XCC _arc4random_uniform.c -o _arc4random_uniform 2>/dev/null; then
+ ARC4RANDOM_UNIFORM=yes
+ else
+ ARC4RANDOM_UNIFORM=no
+ fi
+ echo "$ARC4RANDOM"
+ rm -f _arc4random.c _arc4random
+fi
+if [ "$ARC4RANDOM_UNIFORM" = no ]; then
+ echo "COMPAT_SRCS+= compat/arc4random_uniform.c" >>$CONFIG_MK
+ echo "#include \"compat/arc4random_uniform.h\"" >>$CONFIG_H
+fi
+
if [ -z "$CLOSEFROM" ]; then
printf "Testing for closefrom ... "
cat <<EOF >_closefrom.c