-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfigure.sh
executable file
·61 lines (56 loc) · 1.21 KB
/
configure.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
#!/bin/sh
usage () {
cat << EOF
usage: configure.sh [-h][-g][--no-mems][--no-double]
-h print this command line option summary
-g compile with debugging, checking and logging support
(compiles in '-c' and '-l' run time options for checking and logging)
--no-mems disable computation of memory accesses
(to measure the slow-down incurred by this feature)
--no-stats disable computation of increment/decrement stats
-O disables '-g' and enables '--no-mems --no-stats' and
EOF
}
die () {
echo "*** configure.sh: $*" 1>&2
exit 1
}
opt=no
mems=yes
stats=yes
debug=no
while [ $# -gt 0 ]
do
case $1 in
-h) usage; exit 0;;
--no-mems) mems=no;;
--no-stats) stats=no;;
-O) opt=yes;;
-g) debug=yes;;
*) die "invalid command line option '$1'";;
esac
shift
done
if [ $opt = yes ]
then
debug=no
mems=no
stats=no
fi
CC=gcc
if [ $debug = yes ]
then
CFLAGS="-Wall -Wextra -g3"
else
CFLAGS="-Wall -Wextra -DNDEBUG -O3"
fi
[ $mems = no ] && CFLAGS="$CFLAGS -DNYALSMEMS"
[ $stats = no ] && CFLAGS="$CFLAGS -DNYALSTATS"
LIBS="-lm"
echo "$CC $CFLAGS $LIBS"
rm -f makefile
sed \
-e "s,@CC@,$CC," \
-e "s,@CFLAGS@,$CFLAGS," \
-e "s,@LIBS@,$LIBS," \
makefile.in > makefile