]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PYTHIA8/pythia8175/configure
Update to 8.175
[u/mrichter/AliRoot.git] / PYTHIA8 / pythia8175 / configure
CommitLineData
c6b60c38 1#!/bin/sh
2#
3# Configuration script, to be run before compilation
4#
5# Author: M. Kirsanov
6
7#
8# User-changeable part -------------------------------
9#
10
11#LCG platform. Can be needed if external libraries are specified
12if [ x$MYLCGPLATFORM = x ]; then
13 export MYLCGPLATFORM=x86_64-slc5-gcc43-opt
14fi
15
16# Defaults
17export COMPMODE=OPT
18export SHAREDLIBS=no
19export ENABLEGZIP=no
20export INSTALLDIR=.
21export DATADIR=
22
23for arg in $* ; do
24 if [ "x$arg" = "x--enable-debug" ] ; then
25 COMPMODE=DBG
26 elif [ "x$arg" = "x--enable-shared" ] ; then
27 SHAREDLIBS=yes
28 elif [ "x$arg" = "x--enable-64bits" ] ; then
29 ENABLE64=-m64
30 elif [ "x$arg" = "x--enable-gzip" ] ; then
31 ENABLEGZIP=yes
32 elif [ "x$arg" = "x--help" ] ; then
33 echo "Usage: ./configure [options] , where options are:"
34 echo "--help : prints this help"
35 echo "--enable-debug : turns on debugging flags and turns off optimization"
36 echo "--enable-shared : turns on shared library creation (default no)"
37 echo "--enable-64bits : turns on 64 bits compilation flags"
38 echo "--lcgplatform=name : LCG platform name, default is x86_64-slc5-gcc43-opt"
39 echo "--installdir=name : install directory, default is . "
40 echo "--prefix=name : install directory (equivalent to --installdir)"
41 echo "--datadir=name : data directory (for xmldoc), default is install directory"
42 echo "--with-hepmc=path : path to HepMC library to build interface (default is not build)"
43 echo "--with-hepmcversion=v : HepMC version (simplified alternative when using CERN AFS LCG external, e.g. =2.06.08)"
44 echo "--enable-gzip : turns on support for reading in gzipped files (default no)"
45 echo " (experimental feature, see README for more details)"
46 echo "--with-boost=path : path to boost installation (default /usr) (required for gzip support)"
47 echo "--with-zlib=path : path to zlib (default /usr/lib) (required for gzip support)"
48 echo
49 echo "Use the following environment variables to force the configuration process or add flags:"
50 echo "USRCXXFLAGS - to add flags. Use this variable to add -fPIC to the compilation flags for the static libraries"
51 echo "USRLDFLAGSSHARED - to add flags to the shared library build command"
52 echo "USRSHAREDSUFFIX - to force shared libraries suffix to be like this (default on MacOSX is dylib)"
53 echo
54 exit
55 elif [ x`echo x${arg} | grep "="` != x ] ; then
56 option=`echo ${arg} | awk -F = '{print $1}'`
57 value=`echo ${arg} | awk -F = '{print $2}'`
58 if [ "x${option}" = "x--lcgplatform" ] ; then
59 MYLCGPLATFORM=${value}
60 elif [ "x${option}" = "x--installdir" ] ; then
61 INSTALLDIR=${value}
62 elif [ "x${option}" = "x--prefix" ] ; then
63 INSTALLDIR=${value}
64 elif [ "x${option}" = "x--datadir" ] ; then
65 DATADIR=${value}
66 elif [ "x${option}" = "x--with-hepmcversion" ] ; then
67 HEPMCVERSION=${value}
68 elif [ "x${option}" = "x--with-hepmc" ] ; then
69 HEPMCLOCATION=${value}
70 elif [ "x${option}" = "x--with-boost" ] ; then
71 BOOSTLOCATION=${value}
72 elif [ "x${option}" = "x--with-zlib" ] ; then
73 ZLIBLOCATION=${value}
74 else
75 echo "${arg}: wrong option. Ignored." >&2
76 fi
77 fi
78done
79
80echo compilation mode is $COMPMODE
81echo sharedlibs = $SHAREDLIBS
82
83if [ "x${DATADIR}" = "x" ] ; then
84 DATADIR=${INSTALLDIR}
85fi
86
87# Environment variables for building HepMC interface library. Note that
88# the HepMC interface library is used by the examples main41, main42, .. .
89# Attention: if you have already run these examples and you change HepMC
90# version you should reset your LD_LIBRARY_PATH
91# The default values here correspond to CERN AFS lcg external
92#
93if [ "x${HEPMCVERSION}" != "x" ] ; then
94 if [ "x${HEPMCLOCATION}" = "x" ] ; then
95 export HEPMCLOCATION=/afs/cern.ch/sw/lcg/external/HepMC/${HEPMCVERSION}/${MYLCGPLATFORM}
96 fi
97fi
98# If you want to assign these variables by hand:
99#
100#export HEPMCVERSION=2.04.00
101#export HEPMCLOCATION=/afs/cern.ch/sw/lcg/external/HepMC/${HEPMCVERSION}/${MYLCGPLATFORM}
102
103
104if [ "x${HEPMCVERSION}" = "x" ] ; then
105 if [ "x${HEPMCLOCATION}" != "x" ] ; then
106# try to find out which HepMC version
107 test1=`echo $HEPMCLOCATION | grep \/1.`
108 test2=`echo $HEPMCLOCATION | grep \/2.`
109 echo $test1
110 echo $test2
111 if [ "x${test1}" != "x" ] ; then
112 echo "Warning: HepMC 1 cannot be used anymore; Please use HepMC 2"
113 echo " The interface will not be built"
114 export HEPMCLOCATION=
115 fi
116 if [ "x${test2}" != "x" ] ; then
117 export HEPMCVERSION=2.`echo $HEPMCLOCATION | awk -F \/2. '{print $2}' | awk -F \/ '{print $1}'`
118 fi
119 fi
120fi
121if [ "x${HEPMCVERSION}" != "x" ] ; then
122 export HEPMCMAINVERSION=`echo ${HEPMCVERSION} | awk -F . '{print$1}'`
123 if [ ${HEPMCMAINVERSION} = 1 ] ; then
124 echo "Warning: HepMC 1 cannot be used anymore; Please use HepMC 2"
125 echo " The interface will not be built"
126 export HEPMCLOCATION=
127 fi
128fi
129if [ "x${HEPMCLOCATION}" != "x" ] ; then
130 if [ "x${HEPMCVERSION}" = "x" ] ; then
131 echo "Warning: hepmc specified, but cannot find out which HepMC version"
132 echo "Warning: if you specify HepMC 1 the compilation of interface will fail"
133 fi
134fi
135
136
137#
138# User-changeable part, experts -----------------------------
139#
140
141# Switch off -Wshadow when gzip support is enabled
142WSHADOW="-Wshadow"
143if [ "x${ENABLEGZIP}" = "xyes" ]; then
144 WSHADOW=""
145fi
146
147# export FFLAGS_OPT="-O2 -Wuninitialized"
148# -Wuninitialized outputs many irrelevant warnings and therefore obscurs
149export FFLAGS_OPT="-O2"
150export FFLAGS_DBG=-g
151export CFLAGS_OPT="-O2"
152export CFLAGS_DBG=-g
153export CXXFLAGS_OPT="-O2 -ansi -pedantic -W -Wall ${WSHADOW} ${ENABLE64}"
154export CXXFLAGS_DBG="-g -ansi -pedantic -W -Wall ${WSHADOW} ${ENABLE64}"
155#
156# Find platform.
157#
158export ARCH0="`uname`"
159export ARCH=${ARCH0}
160export theGcc=`gcc -dumpversion | awk -F . '{print $1}'`
161if [ ${theGcc} = 4 ]; then
162 export ARCH=${ARCH}-gcc4
163fi
164echo Platform is $ARCH
165
166#default platform settings:
167export FCCOPY=$FC
168if [ x$FC = x ]; then
169 export FC=g77
170fi
171if [ x$CC = x ]; then
172 export CC=gcc
173fi
174export FFLAGS="${FFLAGS_OPT}"
175export CFLAGS="${CFLAGS_OPT}"
176export CXXFLAGS="${CXXFLAGS_OPT}"
177export FLIBS="-lfrtbegin -lg2c"
178if [ ${COMPMODE} = OPT ]; then
179 export FFLAGS="${FFLAGS_OPT}"
180 export CFLAGS="${CFLAGS_OPT}"
181 export CXXFLAGS="${CXXFLAGS_OPT}"
182fi
183if [ ${COMPMODE} = DBG ]; then
184 export FFLAGS="${FFLAGS_DBG}"
185 export CFLAGS="${CFLAGS_DBG}"
186 export CXXFLAGS="${CXXFLAGS_DBG}"
187fi
188LDFLAGSSHARED="${CXXFLAGS} -fPIC -shared"
189LDFLAGLIBNAME="-Wl,-soname"
190SHAREDSUFFIX=so
191if [ $ARCH = Linux ]; then
192 if [ x$FCCOPY = x ]; then
193 export FC=g77
194 fi
195 export FFLAGS="${FFLAGS_OPT} -Wno-globals"
196 export CFLAGS="${CFLAGS_OPT}"
197 export CXXFLAGS="${CXXFLAGS_OPT}"
198 export FLIBS="-lfrtbegin -lg2c"
199 if [ ${COMPMODE} = OPT ]; then
200 export FFLAGS="${FFLAGS_OPT}"
201 export CFLAGS="${CFLAGS_OPT}"
202 export CXXFLAGS="${CXXFLAGS_OPT}"
203 fi
204 if [ ${COMPMODE} = DBG ]; then
205 export FFLAGS="${FFLAGS_DBG} -Wno-globals"
206 export CFLAGS="${CFLAGS_DBG}"
207 export CXXFLAGS="${CXXFLAGS_DBG}"
208 fi
209 LDFLAGSSHARED="${CXXFLAGS} -fPIC -shared"
210 LDFLAGLIBNAME="-Wl,-soname"
211 SHAREDSUFFIX=so
212fi
213# Linux platform with gcc4: new Fortran90 compiler.
214if [ $ARCH = Linux-gcc4 ]; then
215 if [ x$FCCOPY = x ]; then
216 export FC=gfortran
217 fi
218 export FFLAGS="${FFLAGS_OPT}"
219 export CFLAGS="${CFLAGS_OPT}"
220 export CXXFLAGS="${CXXFLAGS_OPT}"
221 export FLIBS="-lgfortran -lgfortranbegin"
222 if [ ${COMPMODE} = OPT ]; then
223 export FFLAGS="${FFLAGS_OPT}"
224 export CFLAGS="${CFLAGS_OPT}"
225 export CXXFLAGS="${CXXFLAGS_OPT}"
226 fi
227 if [ ${COMPMODE} = DBG ]; then
228 export FFLAGS="${FFLAGS_DBG}"
229 export CFLAGS="${CFLAGS_DBG}"
230 export CXXFLAGS="${CXXFLAGS_DBG}"
231 fi
232 LDFLAGSSHARED="${CXXFLAGS} -fPIC -shared"
233 LDFLAGLIBNAME="-Wl,-soname"
234 SHAREDSUFFIX=so
235fi
236# Mac-OSX with gcc4
237if [ $ARCH = Darwin-gcc4 ]; then
238 if [ x$FCCOPY = x ]; then
239 export FC=gfortran
240 fi
241 export FFLAGS="${FFLAGS_OPT}"
242 export CFLAGS="${CFLAGS_OPT}"
243 export CXXFLAGS="${CXXFLAGS_OPT}"
244 export FLIBS="-lgfortran"
245 if [ ${COMPMODE} = OPT ]; then
246 export FFLAGS="${FFLAGS_OPT}"
247 export CFLAGS="${CFLAGS_OPT}"
248 export CXXFLAGS="${CXXFLAGS_OPT}"
249 fi
250 if [ ${COMPMODE} = DBG ]; then
251 export FFLAGS="${FFLAGS_DBG}"
252 export CFLAGS="${CFLAGS_DBG}"
253 export CXXFLAGS="${CXXFLAGS_DBG}"
254 fi
255 LDFLAGSSHARED="${CXXFLAGS} -dynamiclib -single_module -flat_namespace -undefined suppress"
256 LDFLAGLIBNAME="-Wl,-dylib_install_name"
257 SHAREDSUFFIX=dylib
258fi
259# Mac-OSX with gcc3; is not tested
260if [ $ARCH = Darwin ]; then
261 if [ x$FCCOPY = x ]; then
262 export FC=g77
263 fi
264 export FFLAGS="${FFLAGS_OPT}"
265 export CFLAGS="${CFLAGS_OPT}"
266 export CXXFLAGS="${CXXFLAGS_OPT}"
267 export FLIBS="-lfrtbegin -lg2c"
268 if [ ${COMPMODE} = OPT ]; then
269 export FFLAGS="${FFLAGS_OPT}"
270 export CFLAGS="${CFLAGS_OPT}"
271 export CXXFLAGS="${CXXFLAGS_OPT}"
272 fi
273 if [ ${COMPMODE} = DBG ]; then
274 export FFLAGS="${FFLAGS_DBG}"
275 export CFLAGS="${CFLAGS_DBG}"
276 export CXXFLAGS="${CXXFLAGS_DBG}"
277 fi
278 LDFLAGSSHARED="${CXXFLAGS} -dynamiclib -single_module -flat_namespace -undefined suppress"
279 LDFLAGLIBNAME="-Wl,-dylib_install_name"
280 SHAREDSUFFIX=dylib
281fi
282
283
284CXXFLAGS="${CXXFLAGS} $USRCXXFLAGS"
285LDFLAGSSHARED="${LDFLAGSSHARED} $USRLDFLAGSSHARED"
286if [ "x${USRSHAREDSUFFIX}" != "x" ] ; then
287 SHAREDSUFFIX="${USRSHAREDSUFFIX}"
288fi
289
290
291#Platform & opt/dbg - independent flags and variables:
292
293
294#
295# End of the user-changeable part ---------------------------
296#
297# Checks
298#
299if [ $?HEPMCLOCATION ]; then
300 if [ x${HEPMCLOCATION} != x ]; then
301 if [ ! -d ${HEPMCLOCATION}/include ]; then
302 echo "Warning: bad HEPMCLOCATION: directory ${HEPMCLOCATION}/include does not exist"
303 echo " The interface will not be built"
304 export HEPMCLOCATION=
305 fi
306 if [ ! -d ${HEPMCLOCATION}/lib ]; then
307 echo "Warning: bad HEPMCLOCATION: directory ${HEPMCLOCATION}/lib does not exist"
308 echo " The interface will not be built"
309 export HEPMCLOCATION=
310 fi
311 fi
312fi
313
314# gzip support - do after SHAREDSUFFIX is set
315if [ "x${ENABLEGZIP}" = "xyes" ]; then
316
317 # Default locations if none given
318 if [ "x${BOOSTLOCATION}" = "x" ]; then
319 BOOSTLOCATION=/usr
320 fi
321 if [ "x${ZLIBLOCATION}" = "x" ]; then
322 ZLIBLOCATION=/usr/lib
323 fi
324
325 # Check for Boost and zlib
326 if [ "x${ENABLEGZIP}" = "xyes" ] ; then
327 if [ ! -d "${BOOSTLOCATION}/include/boost/iostreams" ]; then
328 echo "Error: cannot find required Boost include files; gzip support disabled"
329 ENABLEGZIP=no
330 fi
331
332 # Some systems have Boost only under lib64?
333 for i in lib lib64; do
334 if [ -f "${BOOSTLOCATION}/$i/libboost_iostreams.${SHAREDSUFFIX}" ]; then
335 BOOSTLIBLOCATION=${BOOSTLOCATION}/$i
336 break
337 fi
338 done
339
340 if [ "x${ENABLEGZIP}" = "xyes" -a x"${BOOSTLIBLOCATION}" = x ]; then
341 echo "Error: cannot find required Boost library files; gzip support disabled"
342 ENABLEGZIP=no
343 fi
344
345 if [ "x${ENABLEGZIP}" = "xyes" -a ! -f "${ZLIBLOCATION}/libz.${SHAREDSUFFIX}" ]; then
346 echo "Error: cannot find zlib; gzip support disabled"
347 ENABLEGZIP=no
348 fi
349 fi
350
351 # Add flags
352 if [ "x${ENABLEGZIP}" = "xyes" ] ; then
353 echo gzip support is enabled
354 CXXFLAGS="${CXXFLAGS} -DGZIPSUPPORT -I${BOOSTLOCATION}/include"
355 fi
356fi
357
358rm -f config.mk
359
360echo SHELL = /bin/sh > config.mk
361echo ARCH = ${ARCH} >> config.mk
362echo MYLCGPLATFORM = ${MYLCGPLATFORM} >> config.mk
363echo SHAREDLIBS = ${SHAREDLIBS} >> config.mk
364echo FC = ${FC} >> config.mk
365echo CC = ${CC} >> config.mk
366echo FFLAGS = ${FFLAGS} >> config.mk
367echo CFLAGS = ${CFLAGS} >> config.mk
368echo CXXFLAGS = ${CXXFLAGS} >> config.mk
369echo FLIBS = ${FLIBS} >> config.mk
370echo LDFLAGSSHARED = ${LDFLAGSSHARED} >> config.mk
371echo LDFLAGLIBNAME = ${LDFLAGLIBNAME} >> config.mk
372echo SHAREDSUFFIX = ${SHAREDSUFFIX} >> config.mk
373echo INSTALLDIR = ${INSTALLDIR} >> config.mk
374echo DATADIR = ${DATADIR} >> config.mk
375#
376if [ x${HEPMCLOCATION} != x ]; then
377 if [ x${HEPMCVERSION} != x ]; then
378 echo HEPMCVERSION = ${HEPMCVERSION} >> config.mk
379 fi
380 echo HEPMCLOCATION = ${HEPMCLOCATION} >> config.mk
381fi
382#
383#
384#
385rm -f examples/config.sh
386rm -f examples/config.csh
387if [ x${HEPMCLOCATION} != x ]; then
388 if [ $ARCH0 != Darwin ]; then
389 echo "#!/bin/csh" > examples/config.csh
390 echo 'if( ! $?LD_LIBRARY_PATH ) then' >> examples/config.csh
391 echo " setenv LD_LIBRARY_PATH ${HEPMCLOCATION}/lib" >> examples/config.csh
392 echo "else" >> examples/config.csh
393 echo " setenv LD_LIBRARY_PATH" '${LD_LIBRARY_PATH}'":${HEPMCLOCATION}/lib" >> examples/config.csh
394 echo "endif" >> examples/config.csh
395 echo "#!/bin/sh" > examples/config.sh
396 echo 'if [ ! $?LD_LIBRARY_PATH ]; then' >> examples/config.sh
397 echo " export LD_LIBRARY_PATH=${HEPMCLOCATION}/lib" >> examples/config.sh
398 echo fi >> examples/config.sh
399 echo 'if [ $?LD_LIBRARY_PATH ]; then' >> examples/config.sh
400 echo " export LD_LIBRARY_PATH="'${LD_LIBRARY_PATH}'":${HEPMCLOCATION}/lib" >> examples/config.sh
401 echo fi >> examples/config.sh
402 else
403 echo "#!/bin/csh" > examples/config.csh
404 echo 'if( ! $?DYLD_LIBRARY_PATH ) then' >> examples/config.csh
405 echo " setenv DYLD_LIBRARY_PATH ${HEPMCLOCATION}/lib" >> examples/config.csh
406 echo "else" >> examples/config.csh
407 echo " setenv DYLD_LIBRARY_PATH" '${DYLD_LIBRARY_PATH}'":${HEPMCLOCATION}/lib" >> examples/config.csh
408 echo "endif" >> examples/config.csh
409 echo "#!/bin/sh" > examples/config.sh
410 echo 'if [ ! $?DYLD_LIBRARY_PATH ]; then' >> examples/config.sh
411 echo " export DYLD_LIBRARY_PATH=${HEPMCLOCATION}/lib" >> examples/config.sh
412 echo fi >> examples/config.sh
413 echo 'if [ $?DYLD_LIBRARY_PATH ]; then' >> examples/config.sh
414 echo " export DYLD_LIBRARY_PATH="'${DYLD_LIBRARY_PATH}'":${HEPMCLOCATION}/lib" >> examples/config.sh
415 echo fi >> examples/config.sh
416 fi
417fi
418
419# gzip support - write locations into config.mk
420if [ "x${ENABLEGZIP}" = "xyes" ] ; then
421 echo "ENABLEGZIP = yes" >> config.mk
422 echo "BOOSTLOCATION = ${BOOSTLOCATION}" >> config.mk
423 echo "BOOSTLIBLOCATION = ${BOOSTLIBLOCATION}" >> config.mk
424 echo "ZLIBLOCATION = ${ZLIBLOCATION}" >> config.mk
425fi