forked from StanfordPL/stoke
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.sh
executable file
·96 lines (80 loc) · 1.71 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
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
88
89
90
91
92
93
94
95
96
#!/bin/bash
function show_help {
echo "$0 [--debug-default-target] [--debug-ddec] [--debug-ceg] [--no-cvc4]"
echo ""
}
function error {
echo "Configure failed! Fix errors and run again."
echo ""
rm -f .stoke_config
show_help
exit
}
## START
## All options are off by default
MISC_OPTIONS=""
## Detect platform
$(grep avx2 /proc/cpuinfo >/dev/null)
AVX2=$?
$(grep avx /proc/cpuinfo >/dev/null)
AVX=$?
$(grep mmx /proc/cpuinfo >/dev/null)
MMX=$?
if [ $AVX2 -eq 0 ]; then
PLATFORM="haswell"
elif [ $AVX -eq 0 ]; then
PLATFORM="sandybridge"
elif [ $MMX -eq 0 ]; then
PLATFORM="nehalem"
else
echo "ERROR: STOKE is currently only supported on sandybridge or haswell machines. You appear to have an older CPU."
exit 1
fi
## Now do some parsing, look for options
BUILD_TYPE="release"
while :; do
case $1 in
-h|--help)
show_help
exit
;;
--debug-ddec)
MISC_OPTIONS="$MISC_OPTIONS -DSTOKE_DEBUG_DDEC"
shift
;;
--debug-ceg)
MISC_OPTIONS="$MISC_OPTIONS -DSTOKE_DEBUG_CEG"
shift
;;
-d|--debug-default-target)
BUILD_TYPE="debug"
shift
;;
--no-cvc4)
NOCVC4=1
shift
;;
-?*)
echo "WARNING: unknown option $1"
error
exit
;;
*)
break
esac
done
echo ""
echo "The default build type is '$BUILD_TYPE'."
echo "Configuring STOKE for $PLATFORM"
rm -f .stoke_config
## Write options to config file
echo "STOKE_PLATFORM=\"$PLATFORM\"" >> .stoke_config
echo "BUILD_TYPE=$BUILD_TYPE" >> .stoke_config
echo "MISC_OPTIONS=$MISC_OPTIONS" >> .stoke_config
if [ ! -z $NOCVC4 ]; then
echo "NOCVC4=$NOCVC4" >> .stoke_config
fi
## All done!
echo ""
echo "You're all set to run make!"
echo ""