-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure
executable file
·55 lines (47 loc) · 974 Bytes
/
configure
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/sh
add_inc()
{
echo "#define $1" >> config.h
}
note()
{
echo -n "Looking for $@... "
echo "Looking for $@... " >&3
}
case $1 in
-*)
echo "No help nor options available. Just run ./configure"
exit 0;
;;
esac
exec 3> config.log
note 'internal arc4random'
cat << EOF > testfile.c
#include <stdlib.h>
int main(void)
{arc4random();return 0;}
EOF
if gcc testfile.c -o /dev/null 2>&3; then
echo Found.
extraflags="$extraflags -DHAVE_ARC4RANDOM"
else
echo Not Found.
note 'external arc4random'
cat << EOF > testfile.c
#include <bsd/stdlib.h>
int main(void)
{uint32_t arc4random(void);return 0;}
EOF
if gcc -lbsd testfile.c -o /dev/null 2>&3; then
echo Found.
extraflags="$extraflags -DHAVE_ARC4RANDOM_EXT"
extralibs="$extralibs -lbsd"
else
echo Not Found.
fi
fi
rm testfile.c
sed -e "s|@extraflags@|$extraflags|" \
-e "s|@extralibs@|$extralibs|" \
Makefile.in > Makefile
echo "OK, now run \`make'."