-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
/
autogen.sh
executable file
·120 lines (104 loc) · 2.8 KB
/
autogen.sh
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#! /bin/sh
args=$(getopt bfos "$@")
if [ $? -ne 0 ]; then
echo "Usage: autogen.sh [-b] [-f] [-o] [-s] [--]"
echo
echo "> -b: do not update the system detection scripts"
echo "> -f: force the recreation of all autoconf scripts"
echo "> -o: overwrite/downgrade system detection scripts"
echo "> -s: setup an environment for developers"
exit 2
fi
force=false
update_config=true
overwrite_config=false
dev_setup=false
eval set -- "$args"
while [ $# -ne 0 ]; do
case $1 in
-b)
update_config=false
;;
-f)
force=true
;;
-o)
overwrite_config=true
;;
-s)
dev_setup=true
;;
--)
shift
break
;;
esac
shift
done
if [ -s configure ]; then
if [ "$force" != true ]; then
echo "autoconf scripts already exist." >&2
exit 0
fi
elif [ "$dev_setup" != true ]; then
echo "If you are looking to install a stable version of libsodium,"
echo "please do not run arbitrary, undocumented commands."
echo
echo "Installation instructions are available at https://libsodium.org"
exit 0
fi
if glibtoolize --version >/dev/null 2>&1; then
LIBTOOLIZE='glibtoolize'
else
LIBTOOLIZE='libtoolize'
fi
command -v command >/dev/null 2>&1 || {
echo "command is required, but wasn't found on this system"
exit 1
}
command -v $LIBTOOLIZE >/dev/null 2>&1 || {
echo "libtool is required, but wasn't found on this system"
exit 1
}
command -v autoconf >/dev/null 2>&1 || {
echo "autoconf is required, but wasn't found on this system"
exit 1
}
command -v automake >/dev/null 2>&1 || {
echo "automake is required, but wasn't found on this system"
exit 1
}
if [ "$overwrite_config" = false ]; then
if [ -f build-aux/config.guess ]; then
mv build-aux/config.guess build-aux/config.guess.stable
fi
if [ -f build-aux/config.sub ]; then
mv build-aux/config.sub build-aux/config.sub.stable
fi
fi
$LIBTOOLIZE --copy --install &&
aclocal &&
automake --add-missing --copy --force-missing --include-deps &&
autoconf && echo Done.
if [ "$overwrite_config" = false ]; then
if [ -f build-aux/config.guess.stable ]; then
mv build-aux/config.guess.stable build-aux/config.guess
fi
if [ -f build-aux/config.sub.stable ]; then
mv build-aux/config.sub.stable build-aux/config.sub
fi
fi
[ "$update_config" = true ] &&
command -v curl >/dev/null 2>&1 && {
echo "Downloading config.guess and config.sub..."
curl -sSL --fail -o config.guess \
'https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD' &&
chmod +x config.guess &&
chmod +x build-aux/config.guess
curl -sSL --fail -o config.sub \
'https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD' &&
chmod +x build-aux/config.sub &&
mv -f config.sub build-aux/config.sub
echo "Done."
}
rm -f config.guess config.sub