-
Notifications
You must be signed in to change notification settings - Fork 5
/
configure
executable file
·360 lines (346 loc) · 13.2 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
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
#!/bin/bash
function showhelp {
echo "usage: ./configure [flags]"
echo ""
echo "Possible flags are as follows:"
echo ""
echo "Package extensions:"
echo " --without-root Do not compile features depending on ROOT."
echo " --with-rootana Compile ROOTANA online analysis extensions, requires ROOTANA installed on your system."
echo " --with-rootbeer Compile ROOTBEER executable, requires ROOTBEER to be installed on your system."
echo " --with-midas Compile using a locally installed version of MIDAS. This allows online analysis"
echo " to be performed from your computer, but it it not necessary to analyze offline MIDAS files."
echo ""
echo "Conditional compilations:"
echo " --without-display-modules Do not export vme::XXX classes into ROOT trees."
echo " --without-dsssd Omit all DSSSD code."
echo " --without-ic Omit all Ion Chamber code."
echo " --without-nai Omit all sodium-iodide code."
echo " --without-hpge Omit all HPGe code."
echo ""
echo "Optional things to set:"
echo " --rb-home=<rootbeer home directory> (Default: ~/packages/rootbeer)"
echo " --cxx=<C++ compiler command> (default c++)"
echo " --cc=<C compiler commane> (default cc)"
echo ""
echo "Other:"
echo " --use-cxx11-abi Set -D_GLIBCXX_USE_CXX11_ABI = 1 (default 0)"
echo " --help Show this help message."
echo ""
}
if [ $HOSTNAME == 'smaug.triumf.ca' ] || [ $HOSTNAME == 'daenerys.triumf.ca' ]; then
USE_ROOT=YES
USE_ROOTANA=NO
USE_ROOTBEER=YES
USE_MIDAS=YES
CC=clang
CXX=clang++
else
USE_ROOT=YES
USE_ROOTANA=NO
USE_ROOTBEER=NO
USE_MIDAS=NO
CC=gcc
CXX=g++
fi
UNAME=`uname -a | awk '{print $1}'`
echo "Platform...$UNAME"
AMEPP_DEFAULT_FILE=$PWD/src/utils/mass16.txt
DISPLAY_MODULES=1
OMIT_DSSSD=0
OMIT_IC=0
OMIT_NAI=0
OMIT_GE=0
SRC=$PWD/src
UTILS=$SRC/utils
OBJ=$PWD/obj
CINT=$PWD/cint
DRLIB=$PWD/lib
TEST=$PWD/test
# check platform and architecture
if [ $UNAME == Linux ]; then
DIST=`lsb_release -si | awk '{print $1}'`
echo "Distribution...$DIST"
if [ "$DIST" == Ubuntu ]; then
echo "__WARNING__: Ubuntu doesn't play nice with C++11!"
echo "If this build fails, try reconfiguring with the flag --use-cxx11-abi"
CC=clang
CXX=clang++
fi
elif [ $UNAME == Darwin ]; then
echo `sw_vers | awk '/ProductName/ {print $2, $3, $4}'` `sw_vers | awk '/ProductVersion/ {print $2}'`
CC=clang
CXX=clang++
else
echo "__ERROR__: Operating system not supported!"
exit 1
fi
for var in "$@"
do
if [ $var == "--help" ]; then
showhelp
exit
fi
done
for var in "$@"
do
if [ $var == "--without-root" ]; then
USE_ROOT=NO
elif [ $var == "--with-rootana" ]; then
if [ $USE_ROOT == "NO" ]; then
echo "Note: USE_ROOTANA = YES but USE_ROOT = NO; switching on USE_ROOT!"
USE_ROOT=YES
fi
USE_ROOTANA=YES
ROOTANA=$HOME/packages/rootana
mkdir ./lib/rootana
elif [ $var == "--with-rootbeer" ]; then
if [ $USE_ROOT == "NO" ]; then
echo "Note: USE_ROOTBEER = YES but USE_ROOT = NO; switching on USE_ROOT!"
USE_ROOT=YES
fi
USE_ROOTBEER=YES
RB_HOME=$HOME/packages/rootbeer
elif [ $var == "--with-midas" ]; then
USE_MIDAS=YES
if [ -z $MIDASSYS ]; then
echo "error: USE_MIDAS set to true but MIDASSYS environment variable not set; switching off"
USE_MIDAS=NO
fi
elif [ $var == "--without-modules" ]; then
DISPLAY_MODULES=0
elif [ $var == "--without-dsssd" ]; then
OMIT_DSSSD=1
elif [ $var == "--without-ic" ]; then
OMIT_IC=1
elif [ $var == "--without-nai" ]; then
OMIT_NAI=1
elif [ $var == "--without-hpge" ]; then
OMIT_GE=1
elif [[ $var == --cxx=* ]]; then
CXX=`echo $var | cut -d'=' -f 2`
elif [[ $var == --cc=* ]]; then
CC=`echo $var | cut -d'=' -f 2`
elif [[ $var == --rb-home=* ]]; then
RB_HOME=`echo $var | cut -d'=' -f 2`
elif [[ $var == "--use-cxx11-abi" ]]; then
CX11_ABI=YES
fi
done
DATE=`date`
echo "### config.mk ###" > config.mk
echo "### Makefile created by ./configure script on $DATE ###" >> config.mk
echo "" >> config.mk
echo "DEFINITIONS = -DAMEPP_DEFAULT_FILE=\\\"\$(PWD)/src/utils/mass16.txt\\\"" >> config.mk
echo "" >> config.mk
echo "### Variable definitions ###" >> config.mk
echo "SRC = \$(PWD)/src" >> config.mk
echo "UTILS = \$(SRC)/utils" >> config.mk
echo "OBJ = \$(PWD)/obj" >> config.mk
echo "CINT = \$(PWD)/cint" >> config.mk
echo "DRLIB = \$(PWD)/lib" >> config.mk
echo "BIN = \$(PWD)/bin" >> config.mk
echo "TEST = $PWD/test" >> config.mk
echo "INCLUDE += -I$SRC -I$CINT" >> config.mk
echo "" >> config.mk
echo "### Uncomment (Comment) to (not) export \"raw\" modules for viewing in ROOT tree" >> config.mk
if [ $DISPLAY_MODULES != 0 ]; then
echo "DEFINITIONS += -DDISPLAY_MODULES" >> config.mk
else
echo "#DEFINITIONS += -DDISPLAY_MODULES" >> config.mk
fi
echo "" >> config.mk
echo "### (Un)comment to (not) ignore corresponding heavy-ion detectors" >> config.mk
if [ $OMIT_DSSSD != 0 ]; then
echo "DEFINITIONS += -DDRAGON_OMIT_DSSSD" >> config.mk
else >> config.mk
echo "#DEFINITIONS += -DDRAGON_OMIT_DSSSD" >> config.mk
fi >> config.mk
if [ $OMIT_IC != 0 ]; then
echo "DEFINITIONS += -DDRAGON_OMIT_IC" >> config.mk
else >> config.mk
echo "#DEFINITIONS += -DDRAGON_OMIT_IC" >> config.mk
fi >> config.mk
if [ $OMIT_NAI != 0 ]; then
echo "DEFINITIONS += -DDRAGON_OMIT_NAI" >> config.mk
else >> config.mk
echo "#DEFINITIONS += -DDRAGON_OMIT_NAI" >> config.mk
fi >> config.mk
if [ $OMIT_GE != 0 ]; then
echo "DEFINITIONS += -DDRAGON_OMIT_GE" >> config.mk
else >> config.mk
echo "#DEFINITIONS += -DDRAGON_OMIT_GE" >> config.mk
fi >> config.mk
echo "" >> config.mk
echo "### Set to YES (NO) to turn on (off) root [or rootbeer, or rootana, or ...] usage ###" >> config.mk
echo "USE_ROOT = $USE_ROOT" >> config.mk
echo "USE_ROOTANA = $USE_ROOTANA" >> config.mk
echo "USE_ROOTBEER = $USE_ROOTBEER" >> config.mk
echo "USE_MIDAS = $USE_MIDAS" >> config.mk
echo "" >> config.mk
echo "### MID2ROOT LIBRARY ###" >> config.mk
echo "MID2ROOT_LIBS = -lDragon \$(MIDASLIBS)" >> config.mk
echo "" >> config.mk
if [ $USE_ROOT == "YES" ]; then
echo "### USE_ROOT ###" >> config.mk
echo "DEFINITIONS += -DUSE_ROOT" >> config.mk
RC=root-config
# configure installation for ROOT
# check root build dependencies
ROOTSYS=`$RC --prefix`
ROOTVERSION=`$RC --version`
ROOTMAJORVERSION=`$RC --version | awk -F. '{print $1}'`
echo "USE_ROOT...YES"
echo "ROOT Version...$ROOTVERSION"
echo -n "ROOT has required build dependencies..."
if [ `$RC --has-xml` != "yes" ]; then
echo "__ERROR__: DRAGON Analyzer requires ROOT to be built with xml"
rm -rf config.mk
exit 1
fi
if [ `$RC --has-minuit2` != "yes" ]; then
echo "__ERROR__: DRAGON Analyzer requires ROOT to be built with minuit2"
rm -rf config.mk
exit 1
fi
echo "YES"
if [ $ROOTMAJORVERSION == 6 ];then
ROOTCINT=rootcling
USE_ROOTBEER=NO
echo "ROOTBEER is not yet compatible with ROOT6, switching off."
else
ROOTCINT=rootcint
fi
if [ -z ${ROOTSYS} ]; then
echo "error: USE_ROOT set to true but ROOTSYS environment variable is not set."
rm -rf config.mk
exit 1
else
echo "ROOTSYS = $ROOTSYS" >> config.mk
echo "ROOTVERSION = $ROOTVERSION" >> config.mk
echo "ROOTMAJORVERSION = $ROOTMAJORVERSION" >> config.mk
echo "ROOTCINT = $ROOTCINT" >> config.mk
echo "MAKE_ALL += \$(SHLIBFILE) \$(PWD)/bin/mid2root" >> config.mk
echo "" >> config.mk
echo "### include ROOT Makefile ###" >> config.mk
if [ `which $RC 2>&1 | sed -ne "s@.*/$RC@$RC@p"` == "$RC" ]; then
MKARCH=`$RC --etcdir`/Makefile.arch
fi
if [ -z ${MKARCH+x} ]; then
ROOTSYS=`$RC --prefix`
echo "include $ROOTSYS/etc/Makefile.arch" >> config.mk
else
echo "include $MKARCH" >> config.mk
fi
fi
else
echo "USE_ROOT...NO"
fi
echo "" >> config.mk
echo "### $UNAME ###" >> config.mk
if [ $UNAME == "Darwin" ]; then
echo "UNAME = $UNAME" >> config.mk
echo "CXXFLAGS += -DOS_LINUX -DOS_DARWIN" >> config.mk
echo "DYLIB = -m64 -dynamiclib -single_module -undefined dynamic_lookup" >> config.mk
echo "INCLUDE += -I/opt/local/include -I/usr/local/include" >> config.mk
elif [ $UNAME == "Linux" ]; then
echo "### $DIST ###" >> config.mk
echo "UNAME = $UNAME" >> config.mk
echo "DIST = $DIST" >> config.mk
echo "DYLIB = -shared" >> config.mk
echo "CXXFLAGS += -DOS_LINUX" >> config.mk
if [ $DIST == "Ubuntu" ]; then
if [ $CXX11_ABI == "YES" ]; then
echo "DEFINITIONS += -D_GLIBCXX_USE_CXX11_ABI=1" >> config.mk
else
echo "DEFINITIONS += -D_GLIBCXX_USE_CXX11_ABI=0" >> config.mk
fi
fi
if [ $DIST == Ubuntu ] && [ $ROOTMAJORVERSION == 5 ]; then
echo "### The following var is necessary when installing on Ubuntu with ROOT v5 because Ubuntu is very picky ###" >> config.mk
echo "NAME = Ubuntu5" >> config.mk
fi
fi
echo "" >> config.mk
if [ $USE_MIDAS == "YES" ]; then
echo "### USE_MIDAS ###" >> config.mk
if [ $UNAME == "Linux" ]; then
MIDAS_LIB_DIR=$MIDASSYS/linux/lib
echo "MIDAS_LIB_DIR = $MIDASSYS/linux/lib" >> config.mk
echo "MIDASLIBS += -lm -lz -lutil -lnsl -lrt" >> config.mk
elif [ $UNAME == "Darwin" ]; then
MIDAS_LIB_DIR=$MIDASSYS/darwin/lib
echo "MIDAS_LIB_DIR = $MIDAS_LIB_DIR" >> config.mk
fi
echo "DEFINITIONS += -DMIDASSYS" >> config.mk
echo "MIDASLIBS = -L$MIDAS_LIB_DIR -lmidas" >> config.mk
echo "INCLUDE += -I$MIDASSYS/include" >> config.mk
echo "USE_MIDAS...YES"
else
echo "USE_MIDAS...NO"
fi
echo "" >> config.mk
if [ $USE_ROOTBEER == YES ]; then
RB_HOME=$HOME/packages/rootbeer
echo "### USE_ROOTBEER ###" >> config.mk echo
echo "DEFINITIONS += -DUSE_ROOTBEER" >> config.mk
echo "RB_HOME = $RB_HOME" >> config.mk
echo "RBINC = -I$RB_HOME/src" >> config.mk
echo "RB_LIBS = -L$RB_HOME/lib -lRootbeer -lrbMidas" >> config.mk
echo "RB_HEADERS = \$(SRC)/rootbeer/rbdragon.hxx \$(SRC)/rootbeer/rbsonik.hxx" >> config.mk
echo "RB_DEFS = -DRB_DRAGON_HOMEDIR=$PWD" >> config.mk
echo "MID2ROOT_LIBS += -L$RB_HOME/lib -lRootbeer" >> config.mk
echo "MID2ROOT_INC += -I$RB_HOME/src" >> config.mk
echo "RB_DRAGON_OBJECTS = \$(OBJ)/rootbeer/rbdragon.o \$(OBJ)/rootbeer/rbdragon_impl.o" >> config.mk
echo "RB_SONIK_OBJECTS = \$(OBJ)/rootbeer/rbdragon.o \$(OBJ)/rootbeer/rbsonik.o \$(OBJ)/rootbeer/rbsonik_impl.o" >> config.mk
echo "RB_DICT = \$(DRLIB)/rootbeerDict.cxx" >> config.mk
echo "MAKE_ALL += \$(PWD)/bin/rbdragon \$(PWD)/bin/rbsonik" >> config.mk
echo "CLEAN_ALL += rootbeer_clean" >> config.mk
echo "USE_ROOTBEER...YES"
echo "RB_HOME...$RB_HOME"
else
echo "USE_ROOTBEER...NO"
fi
echo "" >> config.mk
if [ $USE_ROOTANA == "YES" ]; then
ROOTANA=$HOME/packages/rootana
echo "### USE_ROOTANA ###" >> config.mk
echo "DEFINITIONS += -DUSE_ROOTANA" >> config.mk
echo "ROOTANA = $ROOTANA" >> config.mk
echo "ROOTANA_FLAGS = -ansi -Df2cFortran -I$ROOTANA" >> config.mk
echo "ROOTANA_DEFS = -DROOTANA_DEFAULT_HISTOS=$HOME/usr/packages/dragon/analyzer/histos.dat" >> config.mk
echo "MAKE_ALL += \$(PWD)/bin/anaDragon" >> config.mk
echo "ROOTANA_REMOTE_OBJS = \\" >> config.mk
echo " \$(ROOTANA)/libNetDirectory/netDirectoryServer.o" >> config.mk
echo "" >>config.mk
echo "ROOTANA_OBJS = \\" >> config.mk
echo " \$(OBJ)/rootana/Application.o \\" >> config.mk
echo " \$(OBJ)/rootana/Callbacks.o \\" >> config.mk
echo " \$(OBJ)/rootana/HistParser.o \\" >> config.mk
echo " \$(OBJ)/rootana/Directory.o" >> config.mk
echo "" >> config.mk
echo "ROOTANA_HEADERS = \$(SRC)/rootana/Globals.h \$(SRC)/rootana/*.hxx" >> config.mk
echo "ANA_DRAGON_DICT = \$(DRLIB)/anaDragonDict.cxx" >> config.mk
echo "ROOTANA_LIBS = -L$HOME/usr/packages/rootana/libNetDirectory/ -L$HOME/usr/packages/rootana/lib -lrootana -lNetDirectory" >> config.mk
echo "CLEAN_ALL += rootana_clean" >> config.mk
echo "USE_ROOTANA...YES"
echo "ROOTANA...$ROOTANA"
else
echo "USE_ROOTANA...NO"
fi
echo "### CHOOSE YOUR COMPILER IF YOU WANT ###" >> config.mk
echo "CXX = $CXX" >> config.mk
echo "CC = $CC" >> config.mk
echo "" >> config.mk
echo "C compiler...$CC"
echo "C++ compiler...$CXX"
echo "config variables written to config.mk!"
if [ -z ${CORES+x} ]; then
echo "type \"make\" to install"
else
echo "# of available cores...$CORES"
echo "type \"make\" (or \"make -j$CORES\") to install"
fi
# Local Variables:
# mode: sh
# End: