forked from jegonzal/PowerGraph
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure
executable file
·306 lines (235 loc) · 8.06 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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
#!/bin/bash
## Ensure exit on error:
# set -e
## Begin logging in config.log
LOG_FILE=config.log
date | tee $LOG_FILE
## Define some defaults which are modified by the script and whatever
## is defined in configure.deps
RELEASE_DIR=release
DEBUG_DIR=debug
PROFILE_DIR=profile
INSTALL_DIR=/usr/local
EXPERIMENTAL=false
GRAPHLAB_HOME=$PWD
## Overwrite defaults if they are available
if [ -f configure.deps ]; then
source configure.deps
fi
function print_help {
echo "Usage: ./configure [--bootstrap] [--force_cmake_install]"
echo " [--force_boost_install] [--prefix=PREFIX]"
echo " [--experimental]"
echo
echo " --cleanup remove all build directories"
echo
echo " --bootstrap bootstrap will install CMake/Boost if they are not detected."
echo
echo " --yes automatically install dependencies locally if they are not met."
echo
echo " --force_cmake_install This forces a CMake installation even if CMake is detected."
echo
echo " --force_boost_install This forces a Boost installation even if Boost is detected."
echo
echo " --force_kc_install This forces a Kyoto Cabinet installation even if Kyoto Cabinet is detected."
echo
echo " --prefix=[PREFIX] GraphLab Installation target directory. Defaults to /usr/local"
echo
echo " --experimental Turns on undocumented experimental distributed capabilities. "
echo
echo " --itpp Try to automatically build itpp"
echo
echo " --itpp_include_dir=[DIR] specify manually itpp include directories (path to itpp header files)."
echo
echo " --itpp_link_dir=[DIR] specify manually itpp link dir (path to libitpp.a lib)."
echo
echo " --eigen Install Eigen linear algebra package "
echo
echo " --hadoop Install hadoop tools for HDFS support "
echo
echo " --force_hadoop_install Force install hadoop tools for HDFS support "
echo
echo " --tcmalloc Install tcmalloc parallel memory allocator"
echo
echo " --force_tcmalloc_install Force installation of tcmalloc"
echo
echo " -D something=something specify definitions to be passed on to cmake."
echo
exit 1
}
function run_cleanup {
#!/bin/bash
echo "This script completely erases all build folders including dependencies!!!"
echo "Are you sure you want to continue? (yes or no)"
read yesorno;
if [ "$yesorno" == "yes" ]; then
echo "Removing release debug and profile folders";
rm -rf release debug profile deps configure.deps
else
echo "Doing nothing!";
fi
exit 1
}
function unknown_option {
echo "Unrecognized option: $1"
echo "To get help, run ./configure --help"
exit 1
}
config_flags=""
while [ $# -gt 0 ]
do case $1 in
--help) print_help ;;
--cleanup) run_cleanup ;;
--bootstrap) bootstrap=1 ;;
--yes) always_yes=1;;
--force_cmake_install) force_cmake_install=1 ;;
--force_boost_install) force_boost_install=1 ;;
--force_kc_install) force_kc_install=1 ;;
--prefix=*) prefix=${1##--prefix=} ;;
--experimental) experimental=1 ;;
--itpp) itpp=1 ;;
--itpp_include_dir=*) itpp_include_dir=${1##--itpp_include_dir=} ;;
--itpp_link_dir=*) itpp_link_dir=${1##--itpp_link_dir=} ;;
--eigen) install_eigen=1 ;;
--hadoop) install_hadoop=1 ;;
--force_hadoop_install) force_hadoop_install=1 ;;
--tcmalloc) install_tcmalloc=1 ;;
--force_tcmalloc_install) force_tcmalloc_install=1 ;;
-D) config_flags="$config_flags -D $2"; shift ;;
*) unknown_option $1 ;;
esac
shift
done
##==========================================================
## Construct configure.deps file specifying the necessary environment
## variables
# Create a configure deps if no such file already exists
if [ ! -f configure.deps ]; then
# Initialize with default settings
echo "RELEASE_DIR=$RELEASE_DIR" >> configure.deps
echo "DEBUG_DIR=$DEBUG_DIR" >> configure.deps
echo "PROFILE_DIR=$PROFILE_DIR" >> configure.deps
fi
# Enable or disable experimental graphlab components
if [ ! -z $experimental ]; then
echo "EXPERIMENTAL=true" >> configure.deps
fi
# Run the configure deps
source configure.deps
# Run the bootstrap script which populates configure.deps
if [ ! -z $bootstrap ]; then
source ./scripts/bootstrap.sh | tee -a $LOG_FILE
fi
if [ ! -z $install_eigen ]; then
source ./scripts/eigen_install.sh | tee -a $LOG_FILE
echo "Eigen setup OK"
echo "HAS_EIGEN=true" >> configure.deps
# Try to build itpp
elif [ ! -z $itpp ]; then
source ./scripts/itpp_install.sh | tee -a $LOG_FILE
fi
if [ ! -z $install_hadoop ]; then
source ./scripts/hadoop_install.sh | tee -a $LOG_FILE
fi
if [ ! -z $install_tcmalloc ]; then
source ./scripts/tcmalloc_install.sh | tee -a $LOG_FILE
fi
#if the prefix is not specified
if [ ! -z $prefix ]; then
echo "INSTALL_DIR=$prefix" >> configure.deps
fi
# Run the configure deps
source configure.deps
#if cmake was not defined then define it
if [ -z $CMAKE ]; then
CMAKE=cmake
fi
echo -e \
"======================= BUILD CONFIGURATION ========================\n"\
"System Information: " | tee -a $LOG_FILE
uname -v | tee -a $LOG_FILE
echo "GCC Information: " | tee -a $LOG_FILE
gcc --version | tee -a $LOG_FILE
g++ --version | tee -a $LOG_FILE
echo -e \
"Release build path: $RELEASE_DIR \n"\
"Debug build path: $DEBUG_DIR \n"\
"Profile build path: $PROFILE_DIR \n"\
"Install path: $INSTALL_DIR \n"\
"BOOST_ROOT: $BOOST_ROOT \n"\
"KC_ROOT: $KC_ROOT \n"\
"TCMALLOC_ROOT: $TCMALLOC_ROOT \n"\
"Build experimental parts: $EXPERIMENTAL \n" | tee -a $LOG_FILE
# Construct config flags for cmake
if [ ! -z $INSTALL_DIR ]; then
config_flags="$config_flags -D CMAKE_INSTALL_PREFIX:STRING=$INSTALL_DIR"
fi
if [ ! -z $BOOST_ROOT ]; then
config_flags="$config_flags -D BOOST_ROOT:STRING=$BOOST_ROOT"
fi
if [ ! -z $KC_ROOT ]; then
config_flags="$config_flags -D KC_ROOT:STRING=$KC_ROOT"
fi
if [ ! -z $EXPERIMENTAL ]; then
config_flags="$config_flags -D EXPERIMENTAL:BOOL=$EXPERIMENTAL"
fi
if [ ! -z $itpp_link_dir ]; then
config_flags="$config_flags -D ITPP_LINK_DIR:STRING=$itpp_link_dir"
fi
if [ ! -z $itpp_include_dir ]; then
config_flags="$config_flags -D ITPP_INCLUDE_DIR:STRING=$itpp_include_dir"
fi
if [ ! -z $HAS_EIGEN ]; then
config_flags="$config_flags -D HAS_EIGEN:BOOL=true"
fi
if [ ! -z $HADOOP_HOME ]; then
config_flags="$config_flags -D HADOOP_HOME:STRING=$HADOOP_HOME"
fi
if [ ! -z $TCMALLOC_ROOT ]; then
config_flags="$config_flags -D TCMALLOC_ROOT:STRING=$TCMALLOC_ROOT"
fi
### CONSTRUCT THE BUILD DIRECTORIES ===========================================
set -e
echo -e "\n\n\n======================= Release ========================" \
| tee -a $LOG_FILE
if [ ! -d $RELEASE_DIR ]; then
mkdir $RELEASE_DIR
fi
cd $RELEASE_DIR
rm -f CMakeCache.txt
build_cmd="$CMAKE \
-D CMAKE_BUILD_TYPE=Release \
$config_flags \
../."
echo $build_cmd | tee -a "../$LOG_FILE"
eval $build_cmd | tee -a "../$LOG_FILE"
cd $GRAPHLAB_HOME
echo -e "\n\n\n======================= Debug =========================" \
| tee -a $LOG_FILE
if [ ! -d $DEBUG_DIR ]; then
mkdir $DEBUG_DIR
fi
cd $DEBUG_DIR
rm -f CMakeCache.txt
build_cmd="$CMAKE \
-D CMAKE_BUILD_TYPE=Debug \
$config_flags \
../."
echo $build_cmd | tee -a ../$LOG_FILE
eval $build_cmd | tee -a ../$LOG_FILE
cd $GRAPHLAB_HOME
echo -e "\n\n\n======================= Profile ========================" \
| tee -a $LOG_FILE
if [ ! -d $PROFILE_DIR ]; then
mkdir $PROFILE_DIR
fi
cd $PROFILE_DIR
rm -f CMakeCache.txt
build_cmd="$CMAKE \
-D CMAKE_BUILD_TYPE=Release \
-D COMPILE_PROFILING=1 \
$config_flags \
../."
echo $build_cmd | tee -a ../$LOG_FILE
eval $build_cmd | tee -a ../$LOG_FILE
cd $GRAPHLAB_HOME