-
Notifications
You must be signed in to change notification settings - Fork 3
/
configure
executable file
·87 lines (77 loc) · 2.4 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/bin/sh
usage () {
cat<<EOF
usage: configure [ <option> ... ]
where '<option>' is one of the following:
-c | --check enable assertion checking even without '-g'
-g | --debugging debugging compile (implies '-c', '-l' and '-s')
-h | --help print this command line option summary
-l | --logging include logging code even without '-g'
-m | --metrics include code for additional statistics
-p | --pedantic pedantic compilation for C11
-q | --quiet disable messages and profiling
-s | --symbols add symbol table even without '-g'
--coverage include line coverage code (to be used with 'gcov')
--profile include profiling code (to be used with 'gprof')
-f... passed to compiler, e.g., '-fsanitize=address,undefined'
--no-fast-path no lock-less fast path for synchronization
EOF
exit 1
}
check=no
compact=yes
coverage=no
debug=no
fastpath=yes
logging=no
metrics=no
options=""
pedantic=no
profile=no
quiet=no
symbols=no
die () {
echo "configure: error: $*" 1>&2
exit 1
}
while [ $# -gt 0 ]
do
case "$1" in
-c|--check) check=yes;;
-g|--debugging) debug=yes;;
-h|--help) usage; exit 0;;
-l|--logging) logging=yes;;
-m|--metrics) metrics=yes;;
-p|--pedantic) pedantic=yes;;
-q|--quiet) quiet=yes;;
-s|--symbols) symbols=yes;;
--coverage) coverage=yes;;
--profile) profile=yes;;
-fsanitize=*thread*) options="$options $1"; fastpath=no;;
-f*) options="$options $1";;
--no-fast-path) fastpath=no;;
*) die "invalid option '$1' (try '-h')";;
esac
shift
done
[ $quiet = yes ] && metrics=no
[ "$CC" = "" ] && CC=gcc
CFLAGS="-Wall$options"
[ $pedantic = yes ] && CFLAGS="$CFLAGS -Werror -std=c11 --pedantic"
[ $debug = yes ] && check=yes
[ $debug = yes ] && symbols=yes
[ $debug = yes ] && logging=yes
[ $quiet = yes ] && logging=no
[ $debug = no ] && CFLAGS="$CFLAGS -O3"
[ $symbols = yes ] && CFLAGS="$CFLAGS -ggdb3"
[ $coverage = yes ] && CFLAGS="$CFLAGS -ftest-coverage -fprofile-arcs"
[ $profile = yes ] && CFLAGS="$CFLAGS -pg"
[ $logging = yes ] && CFLAGS="$CFLAGS -DLOGGING"
[ $check = no ] && CFLAGS="$CFLAGS -DNDEBUG"
[ $fastpath = no ] && CFLAGS="$CFLAGS -DNFASTPATH"
[ $metrics = yes ] && CFLAGS="$CFLAGS -DMETRICS"
[ $quiet = yes ] && CFLAGS="$CFLAGS -DQUIET"
echo "configure: $CC $CFLAGS"
rm -f makefile
sed -e "s#@CC@#$CC#;s#@CFLAGS@#$CFLAGS#" makefile.in > makefile
echo "configure: generated 'makefile'"