-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure
executable file
·58 lines (52 loc) · 1.17 KB
/
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
56
57
58
#!/bin/sh
# configure script for retail
help() {
echo "\`configure\` configures retail to your system"
echo
echo "Usage: ./configure [OPTION]"
echo
echo Options:
echo " -h, --help display help"
echo " --prefix=PREFIX install files in PREFIX [~/.local]"
exit 0
}
V_PREFIX="$HOME/.local"
S_NEXT=
for opt in "$@"
do
if [ "$S_NEXT" ]
then
eval V_${S_NEXT}=\$opt
S_NEXT=
else
case "$opt" in
--prefix)
S_NEXT=PREFIX ;;
--prefix=*)
V_PREFIX=`expr "$opt" : '[^=]*=\(.*\)'` ;;
--help|-h)
help ;;
*)
echo "Unknown option $opt."
esac
fi
done
# Check for getline support
NEED_GETLINE=
mkdir .configure-$$
cd .configure-$$
cat > test.c <<EOT
#include <stdio.h>
int main(int argc, char **argv) {
char *buf;
size_t size = 0;
getline(&buf, &size, stdin);
}
EOT
cc test.c || NEED_GETLINE="-DNEED_GETLINE=1"
cd ..
rm -rf .configure-$$
echo "# Generated by configure" > Makefile.conf
echo "PREFIX = $V_PREFIX" >> Makefile.conf
echo "DEFINES = $NEED_GETLINE" >> Makefile.conf
cat Makefile.conf