forked from zunit-zsh/zunit
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfigure
executable file
·71 lines (53 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
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/zsh
# vim: ft=zsh sw=4 ts=4 noet!
target=Makefile
arguments="$@"
typeset -A opts;
opts=(prefix /usr/local)
if [[ $1 == "--help" || $1 == "-h" ]]; then
cat >&1 <<EOH
Usage:
./configure --prefix[=[PATH]]
Available options:
- prefix - Set install prefix
All options are enabled by default.
Example:
# Disable lock, parallel, cache and defer
./configure --disable-extensions
# Disable completion
./configure --disable-completion
# Enable debug
./configure --with-debug
EOH
exit 0
fi
while [[ $# -gt 0 ]]; do
argkey="${1%\=*}"
key="${argkey//--/}"
if [[ $1 = *=* ]]; then
value="${1#*=}"
else
value=$opts[$key]
fi
if [[ $opts[$key] != "" ]]; then
opts[$key]=$value
else
printf "Invalid argument: %s (%s)\n" $key $1 >&2
exit 1
fi
shift
done
BANNER_SEP=$(printf '%*s' 70 | tr ' ' '\#')
cat > $target <<EOM
${BANNER_SEP}
# This file was autogenerated by 'configure'. Do not edit it directly!
# Invocation was: $0 $arguments
${BANNER_SEP}
EOM
{
for config in ${(k)opts}; do
echo "${${config:u}//-/_}=${opts[$config]}"
done
echo ${BANNER_SEP}
cat Makefile.in
} >> $target