]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PYTHIA8/pythia8175/configure
PYTHIA8: installing headers
[u/mrichter/AliRoot.git] / PYTHIA8 / pythia8175 / configure
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
12 if [ x$MYLCGPLATFORM = x ]; then
13   export MYLCGPLATFORM=x86_64-slc5-gcc43-opt
14 fi
15
16 # Defaults
17 export COMPMODE=OPT
18 export SHAREDLIBS=no
19 export ENABLEGZIP=no
20 export INSTALLDIR=.
21 export DATADIR=
22
23 for 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
78 done
79
80 echo compilation mode is $COMPMODE
81 echo sharedlibs = $SHAREDLIBS
82
83 if [ "x${DATADIR}" = "x" ] ; then
84   DATADIR=${INSTALLDIR}
85 fi
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 #
93 if [ "x${HEPMCVERSION}" != "x" ] ; then
94   if [ "x${HEPMCLOCATION}" = "x" ] ; then
95     export HEPMCLOCATION=/afs/cern.ch/sw/lcg/external/HepMC/${HEPMCVERSION}/${MYLCGPLATFORM}
96   fi
97 fi
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
104 if [ "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
120 fi
121 if [ "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
128 fi
129 if [ "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
134 fi
135
136
137 #
138 # User-changeable part, experts  -----------------------------
139 #
140
141 # Switch off -Wshadow when gzip support is enabled
142 WSHADOW="-Wshadow"
143 if [ "x${ENABLEGZIP}" = "xyes" ]; then
144   WSHADOW=""
145 fi
146
147 # export FFLAGS_OPT="-O2 -Wuninitialized"
148 # -Wuninitialized outputs many irrelevant warnings and therefore obscurs 
149 export FFLAGS_OPT="-O2"
150 export FFLAGS_DBG=-g
151 export CFLAGS_OPT="-O2"
152 export CFLAGS_DBG=-g
153 export CXXFLAGS_OPT="-O2 -ansi -pedantic -W -Wall ${WSHADOW} ${ENABLE64}"
154 export CXXFLAGS_DBG="-g -ansi -pedantic -W -Wall ${WSHADOW} ${ENABLE64}"
155 #
156 # Find platform.
157 #
158 export ARCH0="`uname`"
159 export ARCH=${ARCH0}
160 export theGcc=`gcc -dumpversion | awk -F . '{print $1}'`
161 if [ ${theGcc} = 4 ]; then
162   export ARCH=${ARCH}-gcc4
163 fi
164 echo Platform is $ARCH
165
166 #default platform settings:
167 export FCCOPY=$FC
168 if [ x$FC = x ]; then
169   export FC=g77
170 fi
171 if [ x$CC = x ]; then
172   export CC=gcc
173 fi
174 export FFLAGS="${FFLAGS_OPT}"
175 export CFLAGS="${CFLAGS_OPT}"
176 export CXXFLAGS="${CXXFLAGS_OPT}"
177 export FLIBS="-lfrtbegin -lg2c"
178 if [ ${COMPMODE} = OPT ]; then
179   export FFLAGS="${FFLAGS_OPT}"
180   export CFLAGS="${CFLAGS_OPT}"
181   export CXXFLAGS="${CXXFLAGS_OPT}"
182 fi
183 if [ ${COMPMODE} = DBG ]; then
184   export FFLAGS="${FFLAGS_DBG}"
185   export CFLAGS="${CFLAGS_DBG}"
186   export CXXFLAGS="${CXXFLAGS_DBG}"
187 fi
188 LDFLAGSSHARED="${CXXFLAGS} -fPIC -shared"
189 LDFLAGLIBNAME="-Wl,-soname"
190 SHAREDSUFFIX=so
191 if [ $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
212 fi
213 # Linux platform with gcc4: new Fortran90 compiler.
214 if [ $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
235 fi
236 # Mac-OSX with gcc4
237 if [ $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
258 fi
259 # Mac-OSX with gcc3; is not tested
260 if [ $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
281 fi
282
283
284 CXXFLAGS="${CXXFLAGS} $USRCXXFLAGS"
285 LDFLAGSSHARED="${LDFLAGSSHARED} $USRLDFLAGSSHARED"
286 if [ "x${USRSHAREDSUFFIX}" != "x" ] ; then
287   SHAREDSUFFIX="${USRSHAREDSUFFIX}"
288 fi
289
290
291 #Platform & opt/dbg - independent flags and variables:
292
293
294 #
295 # End of the user-changeable part ---------------------------
296 #
297 # Checks
298 #
299 if [ $?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
312 fi
313
314 # gzip support - do after SHAREDSUFFIX is set
315 if [ "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
356 fi
357
358 rm -f config.mk
359
360 echo SHELL = /bin/sh > config.mk
361 echo ARCH = ${ARCH} >> config.mk
362 echo MYLCGPLATFORM = ${MYLCGPLATFORM} >> config.mk
363 echo SHAREDLIBS = ${SHAREDLIBS} >> config.mk
364 echo FC = ${FC} >> config.mk
365 echo CC = ${CC} >> config.mk
366 echo FFLAGS = ${FFLAGS} >> config.mk
367 echo CFLAGS = ${CFLAGS} >> config.mk
368 echo CXXFLAGS = ${CXXFLAGS} >> config.mk
369 echo FLIBS = ${FLIBS} >> config.mk
370 echo LDFLAGSSHARED = ${LDFLAGSSHARED} >> config.mk
371 echo LDFLAGLIBNAME = ${LDFLAGLIBNAME} >> config.mk
372 echo SHAREDSUFFIX = ${SHAREDSUFFIX} >> config.mk
373 echo INSTALLDIR = ${INSTALLDIR} >> config.mk
374 echo DATADIR = ${DATADIR} >> config.mk
375 #
376 if [ x${HEPMCLOCATION} != x ]; then
377   if [ x${HEPMCVERSION} != x ]; then
378     echo HEPMCVERSION = ${HEPMCVERSION} >> config.mk
379   fi
380   echo HEPMCLOCATION = ${HEPMCLOCATION} >> config.mk
381 fi
382 #
383 #
384 #
385 rm -f examples/config.sh
386 rm -f examples/config.csh
387 if [ 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
417 fi
418
419 # gzip support - write locations into config.mk
420 if [ "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
425 fi