/
configure
executable file
·224 lines (197 loc) · 6.57 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
#!/bin/bash
PROGNAME=${0##*/}
#-------------------------------------------------------
# Definitions of variables
#-------------------------------------------------------
CURDIR=`pwd`
HOSTNAME=`hostname`
CODEGEN="LAMINAR"
# Set MACHINE to the CPU architecture that the framework
# will run on. Following is the list of values supported
# by this distribution:
# VIRTUALBOX
# SANDY_BRIDGE
# IVY_BRIDGE
# HASWELL
# OPTERON
# LINARO
# XEON_PHI
# UNKNOWN
#
# NOTE: In case you want to run on a machine that is not
# shown in the list above, put ``UNKNOWN'' for execution
# time only measurements.
MACHINE="UNKNOWN"
#-------------------------------------------------------
# Helper function
#-------------------------------------------------------
usage()
{
cat<<EOF
Usage: $PROGNAME [options]
Options:
-h|--help & show this output
-l|--laminar & configure setting for laminar
-s|--streamit & configure setting for streamit
EOF
}
#-------------------------------------------------------
# Parse Command-line arguments
#-------------------------------------------------------
SHORTOPTS="hls"
LONGOPTS="help,laminar,streamit"
ARGS=$(getopt -s bash --options $SHORTOPTS \
--longoptions $LONGOPTS --name $PROGNAME -- "$@" )
eval set -- "$ARGS"
while true; do
case $1 in
-h|--help)
usage
exit 1
;;
-l|--laminar)
CODEGEN=LAMINAR
;;
-s|--streamit)
CODEGEN=STREAMIT
;;
--)
shift
break
;;
?)
usage
exit 1
;;
esac
shift
done
getPath()
{
p=`which $1`
if [[ -z ${p} ]]; then
echo "$1 not found. Exiting..."
exit 1
fi
echo "${p}" | sed -e 's/\/bin.*//g'
}
#-------------------------------------------------------
# Remove existing output file if there is
#-------------------------------------------------------
rm -f Defines.make
#-------------------------------------------------------
# Check availability of prerequisites
#-------------------------------------------------------
if [ -n "$(python -c "import pygraph.classes.digraph" 2>&1 > /dev/null)" ]; then
echo >&2 "ERROR: pygraph package not found. Visit
https://code.google.com/p/python-graph/
for more information. Exiting..."
exit 1
fi
command -v strc >/dev/null 2>&1 || { echo >&2 "ERROR: strc not found. Visit
http://groups.csail.mit.edu/cag/streamit/
for more information. Exiting..."; exit 1; }
command -v likwid-pin >/dev/null 2>&1 || { echo >&2 "ERROR: LIKWID not found. Visit
https://code.google.com/p/likwid/
for more information. Exiting..."; exit 1; }
command -v papi_version >/dev/null 2>&1 || { echo >&2 "ERROR: PAPI not found. Visit
http://icl.cs.utk.edu/papi/
for more information. Exiting..."; exit 1; }
pPAPI=`getPath papi_version`
pLIKWID=`getPath likwid-pin`
#-------------------------------------------------------
# Generate Defines.make
#-------------------------------------------------------
echo "Generating Defines.make ..."
echo "* TARGET MACHINE: ${MACHINE}"
echo "* HOST NAME : ${HOSTNAME}"
echo "* CODE GENERATOR: ${CODEGEN}"
echo "######################################################################"\
>Defines.make
echo "# This file is a generated file, changes will be lost with the next #"\
>>Defines.make
echo "# run of ./configure. #"\
>>Defines.make
echo "# Edit Defines.make.in and run ./configure for permanent changes. #"\
>>Defines.make
echo "# Do *not* add this file to the repository. #"\
>>Defines.make
echo "######################################################################"\
>>Defines.make
echo ""\
>>Defines.make
echo "# TARGET MACHINE: ${MACHINE}"\
>>Defines.make
echo "# HOST NAME : ${HOSTNAME}"\
>>Defines.make
echo "# CODE GENERATOR: ${CODEGEN}"\
>>Defines.make
echo ""\
>>Defines.make
echo "PAPI_DIR=${pPAPI}"\
>>Defines.make
echo "LIKWID_DIR=${pLIKWID}"\
>>Defines.make
comp_flag=''
libs=''
while read line
do
if [[ $line == ${CODEGEN}_CC=* ]] ; then
if [[ ${MACHINE} == "XEON_PHI" ]] ; then
continue
fi
echo $line | sed -e "s,^\(${CODEGEN}_CC\),CC,g" >>Defines.make
elif [[ $line == PAPI* ]] ; then
echo $line >> Defines.make
elif [[ $line == AR* ]] ; then
echo $line >> Defines.make
elif [[ $line == GCC* ]] ; then
echo $line >> Defines.make
elif [[ $line == LIBS* ]] ; then
echo $line >> Defines.make
elif [[ $line == ${MACHINE}_${CODEGEN}_CC* ]] ; then
echo $line | sed -e "s,^\(${MACHINE}_${CODEGEN}_CC\),CC,g" >>Defines.make
elif [[ $line == ${CODEGEN}_CCFLAGS* ]] ; then
echo $line | sed -e "s,^\(STREAMIT_CCFLAGS=\),CCFLAGS=,g" >>Defines.make
elif [[ $line == ${CODEGEN}_CFLAGS* ]] ; then
echo $line | sed -e "s,^\(LAMINAR_CFLAGS=\),CFLAGS=,g" >>Defines.make
elif [[ $line == ${MACHINE}_CFLAGS* ]] ; then
echo $line | sed -e "s,^\(${MACHINE}_CFLAGS=\),CFLAGS+=,g" >>Defines.make
elif [[ $line == STREAMIT_LIB_CLUSTER* ]] ; then
if [[ ${CODEGEN} == STREAMIT ]] ; then
echo $line >>Defines.make
fi
elif [[ $line == ${MACHINE}_RUN_OPT* ]] ; then
echo $line | sed -e "s,^\(${MACHINE}_RUN_OPT\),RUN_OPT,g" >>Defines.make
elif [[ $line == ${MACHINE}_RUN_OPT* ]] ; then
echo $line | sed -e "s,^\(${MACHINE}_RUN_OPT\),RUN_OPT,g" >>Defines.make
elif [[ $line == ${MACHINE}_LLC_OPT* ]] ; then
echo $line | sed -e "s,^\(${MACHINE}_LLC_OPT\),LLC_OPT,g" >>Defines.make
elif [[ $line == '' ]] ; then
echo -e $line >> Defines.make
fi
done < Defines.make.in
#-------------------------------------------------------
# Check availability of C compiler
#-------------------------------------------------------
CC=`make print-CC`
command -v ${CC} >/dev/null 2>&1 || {
echo >&2 "ERROR: ${CC} not found. Exiting..."; exit 1;
}
#-------------------------------------------------------
# Check availability of ANTLR
#-------------------------------------------------------
pANTLRJAR=`make print-ANTLR_JAR`
if [ ! -f ${pANTLRJAR} ]; then
echo >&2 "ERROR: ${pANTLRJAR} is not found. Please download ANTLR v3.1 and
put it as ${pANTLRJAR}."; exit 1;
fi
#-------------------------------------------------------
# Prepare the system accordingly
#-------------------------------------------------------
# clean dir
echo "Clean current working copy..."
make clean
# compile
echo "Compile current working copy..."
make