-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathconfigure
executable file
·420 lines (353 loc) · 10.4 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
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
#! /bin/bash
#Package-specific:>
GENERATOR=EvtGen
#VERSION=11
# === Default values of input parameters ====
PATH_TO_EXTERNAL=
CLHEP_VERSION=
PREFIX=.
PYTHIADIR=${PYTHIADIR}
PHOTOSDIR=${PHOTOSDIR}
TAUOLADIR=${TAUOLADIR}
HEPMCDIR=${HEPMCDIR}
COMPMODE=OPT # Default: compiler optimization mode
EVTGEN_PHOTOS=
EVTGEN_PYTHIA=
EVTGEN_TAUOLA=
EVTGEN_EXTERNAL=
#<
#--------------------------------------------------------------
check_arguments () {
for arg in $* ; do
if [ "x$arg" = "x--enable-debug" ] ; then
COMPMODE=DBG
elif [ "x$arg" = "x--help" ] ; then
echo -e \
"\nUsage: ./configure [options] , where options are:\n\n"\
"--help : prints this help\n"\
"--prefix=[installation path] : specifies installation path\n"\
"--hepmcdir=[full directory path] : specifies location of HepMC base directory (required)\n"\
"--pythiadir=[full directory path] : specifies location of Pythia 8 base directory (optional)\n"\
"--photosdir=[full directory path] : specifies location of PHOTOS base directory (optional)\n"\
"--tauoladir=[full directory path] : specifies location of TAUOLA base directory (optional)\n"\
"--enable-debug : turns on debugging flags (optional)\n"
exit
else
if [ "x${arg}" = "x${arg/=/}" ] ; then
echo "${arg}: wrong option. Ignored." >&2
else
option=${arg/=*/}
value=${arg/*=/}
if [ "x${option}" = "x--prefix" ] ; then
PREFIX=${value}
elif [ "x${option}" = "x--pythiadir" ] ; then
PYTHIADIR=${value}
elif [ "x${option}" = "x--hepmcdir" ] ; then
HEPMCDIR=${value}
elif [ "x${option}" = "x--photosdir" ] ; then
PHOTOSDIR=${value}
elif [ "x${option}" = "x--tauoladir" ] ; then
TAUOLADIR=${value}
else
echo "${arg}: wrong option. Ignored." >&2
fi
fi
fi
done
return
}
#---------------------------------------
# Check that we can see (some of) the header files for the external generators.
# If not, print a warning message and ask the user to re-run configure
# specifying the base directory correct location(s).
check_dirs() {
echo "PREFIX = $PREFIX"
hepmcFile=${HEPMCDIR}/include/HepMC/GenParticle.h
pythiaFile=${PYTHIADIR}/include/Pythia8/Pythia.h
photosFile=${PHOTOSDIR}/include/Photos/Photos.h
tauolaFile=${TAUOLADIR}/include/Tauola/Tauola.h
stop=0
if [ -f $hepmcFile ]; then
echo "HEPMCDIR set to $HEPMCDIR";
else
echo "Mandatory: please specify the location of the HepMC base directory"\
"using the configure option --hepmcdir=[full directory path]"\
"or set the HEPMCDIR environment variable"
stop=1
fi
if [ -f $pythiaFile ]; then
echo "PYTHIADIR set to $PYTHIADIR";
EVTGEN_PYTHIA=1
EVTGEN_EXTERNAL=1
else
echo "To use PYTHIA: --pythiadir=[full directory path] or set the PYTHIADIR"\
"environment variable"
fi
if [ -f $photosFile ]; then
echo "PHOTOSDIR set to $PHOTOSDIR";
EVTGEN_PHOTOS=1
EVTGEN_EXTERNAL=1
else
echo "To use PHOTOS: --photosdir=[full directory path] or set the PHOTOSDIR"\
" environment variable"
fi
if [ -f $tauolaFile ]; then
echo "TAUOLADIR set to $TAUOLADIR";
EVTGEN_TAUOLA=1
EVTGEN_EXTERNAL=1
else
echo "To use TAUOLA: --tauoladir=[full directory path] or set the TAUOLADIR"\
" environment variable"
fi
if [ $stop = 1 ] ; then
exit 1
fi
}
#--------------------------------------------------------------
check_extlibs () {
# Set default shared libary lists for external packages
HEPMCLIBLIST="-lHepMC"
# For PHOTOS version 3.61 and above: default setting.
# Aside: avoid 3.60 since this does not work properly for EvtGen!
PHOTOSLIBLIST="-lPhotospp -lPhotosppHepMC"
# For PHOTOS version 3.56 and below: check to see
# if we need to modify this library list
if [ -f ${PHOTOSDIR}/lib/libPhotosFortran.so ]; then
PHOTOSLIBLIST="-lPhotosCxxInterface -lPhotosFortran"
fi
TAUOLALIBLIST="-lTauolaCxxInterface -lTauolaFortran"
PYTHIALIBLIST="-lpythia8"
# For PYTHIA 8.1x and below, check to see if we need lhapdfdummy
if [ -f ${PYTHIADIR}/lib/liblhapdfdummy.so ]; then
PYTHIALIBLIST="-lpythia8 -llhapdfdummy"
fi
}
#-------------------------------------------------------------
check_arguments $*
check_dirs
check_extlibs
echo "Compilation mode is ${COMPMODE}"
#Package-specific:>
#
# User-changeable part, experts -----------------------------
#
CXX=g++
CXXFLAGS_OPT="-O2 -Wall"
CXXFLAGS_DBG="-g -Wall"
CFLAGS_OPT=-O2
CFLAGS_DBG=-g
FC=gfortran
FFLAGS_OPT="-O2 -Wuninitialized"
FFLAGS_DBG=-g
FFLAGSSHARED=-fPIC
CFLAGSSHARED=-fPIC
CXXFLAGSSHARED=-fPIC
LDFLAGSSHARED="${CXXFLAGS_OPT} -pthread -fPIC"
#
# Find platform.
#
ARCH=`uname`
theGcc=`g++ --version | grep '[0-9]\.[0-9]\.[0-9]' -o | head -1 | awk -F . '{print $1}'`
if [ ${theGcc} = 4 ]; then
ARCH=${ARCH}-gcc4
fi
if [ ${theGcc} = 5 ]; then
ARCH=${ARCH}-gcc5
fi
if [ ${theGcc} = 6 ]; then
ARCH=${ARCH}-gcc6
fi
echo "Platform is $ARCH"
#default platform settings:
FFLAGS="${FFLAGS_OPT}"
CFLAGS="${CFLAGS_OPT}"
CXXFLAGS="${CXXFLAGS_OPT}"
FLIBS="-lfrtbegin -lg2c"
SOFLAGS="-soname"
if [ ${COMPMODE} = OPT ]; then
FFLAGS="${FFLAGS_OPT}"
CFLAGS="${CFLAGS_OPT}"
CXXFLAGS="${CXXFLAGS_OPT}"
fi
if [ ${COMPMODE} = DBG ]; then
FFLAGS="${FFLAGS_DBG}"
CFLAGS="${CFLAGS_DBG}"
CXXFLAGS="${CXXFLAGS_DBG}"
fi
if [ $ARCH = Linux ]; then
FFLAGS="${FFLAGS_OPT} -Wno-globals"
CFLAGS="${CFLAGS_OPT}"
CXXFLAGS="${CXXFLAGS_OPT}"
FLIBS="-lfrtbegin -lg2c"
if [ ${COMPMODE} = OPT ]; then
FFLAGS="${FFLAGS_OPT}"
CFLAGS="${CFLAGS_OPT}"
CXXFLAGS="${CXXFLAGS_OPT}"
fi
if [ ${COMPMODE} = DBG ]; then
FFLAGS="${FFLAGS_DBG} -Wno-globals"
CFLAGS="${CFLAGS_DBG}"
CXXFLAGS="${CXXFLAGS_DBG}"
fi
fi
# Linux platform with gcc4: new Fortran90 compiler.
if [ $ARCH = Linux-gcc4 ]; then
FFLAGS="${FFLAGS_OPT}"
CFLAGS="${CFLAGS_OPT}"
CXXFLAGS="${CXXFLAGS_OPT}"
FLIBS="-lgfortran"
if [ ${COMPMODE} = OPT ]; then
FFLAGS="${FFLAGS_OPT}"
CFLAGS="${CFLAGS_OPT}"
CXXFLAGS="${CXXFLAGS_OPT}"
fi
if [ ${COMPMODE} = DBG ]; then
FFLAGS="${FFLAGS_DBG}"
CFLAGS="${CFLAGS_DBG}"
CXXFLAGS="${CXXFLAGS_DBG}"
fi
fi
if [ $ARCH = Linux-gcc5 ]; then
FFLAGS="${FFLAGS_OPT}"
CFLAGS="${CFLAGS_OPT}"
CXXFLAGS="${CXXFLAGS_OPT}"
FLIBS="-lgfortran"
if [ ${COMPMODE} = OPT ]; then
FFLAGS="${FFLAGS_OPT}"
CFLAGS="${CFLAGS_OPT}"
CXXFLAGS="${CXXFLAGS_OPT}"
fi
if [ ${COMPMODE} = DBG ]; then
FFLAGS="${FFLAGS_DBG}"
CFLAGS="${CFLAGS_DBG}"
CXXFLAGS="${CXXFLAGS_DBG}"
fi
fi
if [ $ARCH = Linux-gcc6 ]; then
FFLAGS="${FFLAGS_OPT}"
CFLAGS="${CFLAGS_OPT}"
CXXFLAGS="${CXXFLAGS_OPT}"
FLIBS="-lgfortran"
if [ ${COMPMODE} = OPT ]; then
FFLAGS="${FFLAGS_OPT}"
CFLAGS="${CFLAGS_OPT}"
CXXFLAGS="${CXXFLAGS_OPT}"
fi
if [ ${COMPMODE} = DBG ]; then
FFLAGS="${FFLAGS_DBG}"
CFLAGS="${CFLAGS_DBG}"
CXXFLAGS="${CXXFLAGS_DBG}"
fi
fi
# Add C++11 options if required
theGcc2=`g++ --version | grep '[0-9]\.[0-9]\.[0-9]' -o | head -1 | awk -F . '{print $2}'`
gccVar=`echo $theGcc`
gccVar2=`echo $theGcc2`
# Flag to make sure c++11 is enabled for compiling certain classes, e.g. MT random engine.
CPP11=1
# Check that we have gcc version 4.7 and above
if [ $gccVar -le 4 ]; then
if [ $gccVar2 -le 6 ]; then
echo "Not enabling c++11 features"
CPP11=0
fi
fi
if [ $CPP11 = 1 ]; then
echo "c++11 is enabled"
fi
# Mac OS platform with gcc4
if [[ $ARCH == Darwin* ]]; then
tt=`gfortran -print-search-dirs|grep libraries|cut -d'=' -f2|sed 's/:/ /g'`
LIBGFORTRANLOCATION=''
for i in $tt
do
if [ -e $i/libgfortran.so ]
then
LIBGFORTRANLOCATION=$i
break
elif [ -e $i/libgfortran.dylib ]
then
LIBGFORTRANLOCATION=$i
break
fi
done
FLIBS="-L${LIBGFORTRANLOCATION} -lgfortran"
SOFLAGS="-install_name"
fi
#Platform & opt/dbg - independent flags and variables:
echo -n "Creating config.mk ... "
rm -f config.mk
cat > config.mk << EOF
GENERATOR = ${GENERATOR}
VERSION = ${VERSION}
PREFIX = ${PREFIX}
SHELL = /bin/bash
ARCH = ${ARCH}
LCGPLATFORM = ${LCGPLATFORM}
FC = ${FC}
FFLAGS = ${FFLAGS}
CFLAGS = ${CFLAGS}
CXX = ${CXX}
CXXFLAGS = ${CXXFLAGS}
SOFLAGS = ${SOFLAGS}
EVTGENDIR = $(pwd)
TMPDIR = \$(EVTGENDIR)/tmp
INCLUDEDIR = \$(EVTGENDIR)
HEPMCDIR = ${HEPMCDIR}
HEPMCINCDIR = ${HEPMCDIR}/include
HEPMCLIBDIR = ${HEPMCDIR}/lib
HEPMCLIBLIST = ${HEPMCLIBLIST}
SRCDIR = \$(EVTGENDIR)/src
LIBDIR_SHARED = \$(EVTGENDIR)/lib
LIBDIR_ARCHIVE = \$(EVTGENDIR)/lib/archive
LIBDIRLIST = -lEvtGen
LIB_SHARED = \$(LIBDIR_SHARED)/lib\$(GENERATOR).so
LIB_ARCHIVE = \$(LIBDIR_ARCHIVE)/lib\$(GENERATOR).a
LIBEXT_SHARED = \$(LIBDIR_SHARED)/lib\$(GENERATOR)External.so
LIBEXT_ARCHIVE = \$(LIBDIR_ARCHIVE)/lib\$(GENERATOR)External.a
# Flags:
#
FFLAGSSHARED = ${FFLAGSSHARED}
CFLAGSSHARED = ${CFLAGSSHARED}
CXXFLAGSSHARED = ${CXXFLAGSSHARED}
LDFLAGSSHARED = ${LDFLAGSSHARED}
FLIBS = ${FLIBS}
# External generators:
EVTGEN_EXTERNAL = ${EVTGEN_EXTERNAL}
EOF
if [ "${EVTGEN_PYTHIA}" == "1" ] ; then
echo "EVTGEN_PYTHIA = 1" >> config.mk
echo "EXTRAFLAGS += -D EVTGEN_PYTHIA" >> config.mk
echo "PYTHIADIR = ${PYTHIADIR}" >> config.mk
echo "PYTHIAINCDIR = ${PYTHIADIR}/include" >> config.mk
echo "PYTHIALIBDIR = ${PYTHIADIR}/lib" >> config.mk
echo "PYTHIALIBLIST = ${PYTHIALIBLIST}" >> config.mk
fi
if [ "${EVTGEN_PHOTOS}" == "1" ] ; then
echo "EVTGEN_PHOTOS = 1" >> config.mk
echo "EXTRAFLAGS += -D EVTGEN_PHOTOS" >> config.mk
echo "PHOTOSDIR = ${PHOTOSDIR}" >> config.mk
echo "PHOTOSINCDIR = ${PHOTOSDIR}/include" >> config.mk
echo "PHOTOSLIBDIR = ${PHOTOSDIR}/lib" >> config.mk
echo "PHOTOSLIBLIST = ${PHOTOSLIBLIST}" >> config.mk
fi
if [ "${EVTGEN_TAUOLA}" == "1" ] ; then
echo "EVTGEN_TAUOLA = 1" >> config.mk
echo "EXTRAFLAGS += -D EVTGEN_TAUOLA" >> config.mk
echo "TAUOLADIR = ${TAUOLADIR}" >> config.mk
echo "TAUOLAINCDIR = ${TAUOLADIR}/include" >> config.mk
echo "TAUOLALIBDIR = ${TAUOLADIR}/lib" >> config.mk
echo "TAUOLALIBLIST = ${TAUOLALIBLIST}" >> config.mk
fi
if [ ${CPP11} == "1" ] ; then
echo "" >> config.mk
echo "# c++11 features:" >> config.mk
echo "EVTGEN_CPP11 = 1" >> config.mk
echo "CXXFLAGS += -std=c++11 -D EVTGEN_CPP11" >> config.mk
fi
echo " done"
set -v
mkdir -p tmp/ tmp/EvtGenBase tmp/EvtGenModels tmp_ext/EvtGenExternal lib/ lib/archive
set +v
echo -e "\n\nType 'make' to build everything or 'make help' to list build targets.\n\n"
exit