-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfigure
More file actions
55 lines (49 loc) · 1.43 KB
/
Copy pathconfigure
File metadata and controls
55 lines (49 loc) · 1.43 KB
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
usage () {
echo "usage: configure [-h|--help|-d|--debug]"
echo "usage: configure [-h|--help|-d|--debug]"
cat <<EOF
usage: configure [ <option> ... ]
where '<option>' is one of the following:
-c | --check include assertion checking (default for '--debug')
-d | --debug | -g enable debugging (implies '-d', '-l', and '-s')
-h | --help print this command line option summary
-l | --logging include logging code (default for '--debug')
-s | --symbols include symbol table (default for '--debug')
--sanitize use '-fsanitize=address,undefined' sanitizers
EOF
exit 1
}
die () {
echo "configure: error: $*" 1>&2
exit 1
}
check=no
debug=no
logging=no
symbols=no
sanitize=no
while [ $# -gt 0 ]
do
case $1 in
-c|--check) debug=yes;;
-g | -d|--debug) debug=yes;;
-h|--help) usage;;
-l|--logging) logging=yes;;
-s|--symbols) symbols=yes;;
--sanitize) sanitize=yes;;
*) die "invalid option '$1' (try '-h')";;
esac
shift
done
COMPILE="g++ -Wall"
[ $debug = yes ] && check=yes
[ $debug = yes ] && logging=yes
[ $debug = yes ] && symbols=yes
[ $symbols = yes ] && COMPILE="$COMPILE -g"
[ $debug = no ] && COMPILE="$COMPILE -O3"
[ $sanitize = yes ] && COMPILE="$COMPILE -fsanitize=address,undefined"
[ $logging = yes ] && COMPILE="$COMPILE -DLOGGING"
[ $check = no ] && COMPILE="$COMPILE -DNDEBUG"
echo "configure: using '$COMPILE'"
sed -e "s#@COMPILE@#$COMPILE#" makefile.in > makefile