source: HiSusy/trunk/Pythia8/pythia8170/configure @ 1

Last change on this file since 1 was 1, checked in by zerwas, 11 years ago

first import of structure, PYTHIA8 and DELPHES

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