]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PYTHIA8/pythia8145/configure
Removing the flat makefiles
[u/mrichter/AliRoot.git] / PYTHIA8 / pythia8145 / configure
CommitLineData
9419eeef 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=slc4_ia32_gcc34
18fi
19
20# Defaults
21export COMPMODE=OPT
22export SHAREDLIBS=no
23
24for arg in $* ; do
25 if [ "x$arg" = "x--enable-debug" ] ; then
26 COMPMODE=DBG
27 elif [ "x$arg" = "x--enable-shared" ] ; then
28 SHAREDLIBS=yes
29 elif [ "x$arg" = "x--enable-64bits" ] ; then
30 ENABLE64=-m64
31 elif [ "x$arg" = "x--help" ] ; then
32 echo "Usage: ./configure [options] , where options are:"
33 echo "--help : prints this help"
34 echo "--enable-debug : turns on debugging flags and turns off optimization"
35 echo "--enable-shared : turns on shared library creation (default no)"
36 echo "--enable-64bits : turns on 64 bits compilation flags"
37 echo "--lcgplatform=name : LCG platform name, default is slc4_ia32_gcc34"
38 echo "--with-hepmc=path : path to HepMC library to build interface (default is not build)"
39 echo "--with-hepmcversion=v : HepMC version (simplified alternative when using CERN AFS LCG external, e.g. =2.04.00)"
40 echo
41 echo "Use the following environment variables to force the configuration process or add flags:"
42 echo "USRCXXFLAGS - to add flags. Use this variable to add -fPIC to the compilation flags for the static libraries"
43 echo "USRLDFLAGSSHARED - to add flags to the shared library build command"
44 echo "USRSHAREDSUFFIX - to force shared libraries suffix to be like this (default on MacOSX is dylib)"
45 exit
46 elif [ x`echo x${arg} | grep "="` != x ] ; then
47 option=`echo ${arg} | awk -F = '{print $1}'`
48 value=`echo ${arg} | awk -F = '{print $2}'`
49 if [ "x${option}" = "x--lcgplatform" ] ; then
50 MYLCGPLATFORM=${value}
51 elif [ "x${option}" = "x--with-hepmcversion" ] ; then
52 HEPMCVERSION=${value}
53 elif [ "x${option}" = "x--with-hepmc" ] ; then
54 HEPMCLOCATION=${value}
55 else
56 echo "${arg}: wrong option. Ignored." >&2
57 fi
58 fi
59done
60
61echo compilation mode is $COMPMODE
62echo sharedlibs = $SHAREDLIBS
63
64# Environment variables for building HepMC interface library. Note that
65# the HepMC interface library is used by the examples main31, main32.
66# Attention: if you have already run these examples and you change HepMC
67# version you should reset your LD_LIBRARY_PATH
68# The default values here correspond to CERN AFS lcg external
69#
70if [ "x${HEPMCVERSION}" != "x" ] ; then
71 if [ "x${HEPMCLOCATION}" = "x" ] ; then
72 export HEPMCLOCATION=/afs/cern.ch/sw/lcg/external/HepMC/${HEPMCVERSION}/${MYLCGPLATFORM}
73 fi
74fi
75# If you want to assign these variables by hand:
76#
77#export HEPMCVERSION=2.04.00
78#export HEPMCLOCATION=/afs/cern.ch/sw/lcg/external/HepMC/${HEPMCVERSION}/${MYLCGPLATFORM}
79
80
81if [ "x${HEPMCVERSION}" = "x" ] ; then
82 if [ "x${HEPMCLOCATION}" != "x" ] ; then
83# try to find out which HepMC version
84 test1=`echo $HEPMCLOCATION | grep \/1.`
85 test2=`echo $HEPMCLOCATION | grep \/2.`
86 echo $test1
87 echo $test2
88 if [ "x${test1}" != "x" ] ; then
89 echo "Warning: HepMC 1 cannot be used anymore; Please use HepMC 2"
90 echo " The interface will not be built"
91 export HEPMCLOCATION=
92 fi
93 if [ "x${test2}" != "x" ] ; then
94 export HEPMCVERSION=2.`echo $HEPMCLOCATION | awk -F \/2. '{print $2}' | awk -F \/ '{print $1}'`
95 fi
96 fi
97fi
98if [ "x${HEPMCVERSION}" != "x" ] ; then
99 export HEPMCMAINVERSION=`echo ${HEPMCVERSION} | awk -F . '{print$1}'`
100 if [ ${HEPMCMAINVERSION} = 1 ] ; then
101 echo "Warning: HepMC 1 cannot be used anymore; Please use HepMC 2"
102 echo " The interface will not be built"
103 export HEPMCLOCATION=
104 fi
105fi
106if [ "x${HEPMCLOCATION}" != "x" ] ; then
107 if [ "x${HEPMCVERSION}" = "x" ] ; then
108 echo "Warning: hepmc specifyed, but cannot find out which HepMC version"
109 echo "Warning: if you specify HepMC 1 the compilation of interface will fail"
110 fi
111fi
112
113#
114# User-changeable part, experts -----------------------------
115#
116
117# export FFLAGS_OPT="-O2 -Wuninitialized"
118# -Wuninitialized outputs many irrelevant warnings and therefore obscurs
119export FFLAGS_OPT="-O2 -fbounds-check"
120export FFLAGS_DBG=-g
121export CFLAGS_OPT="-O2 -fbounds-check"
122export CFLAGS_DBG=-g
123export CXXFLAGS_OPT="-O2 -ansi -pedantic -W -Wall -Wshadow -fbounds-check ${ENABLE64}"
124export CXXFLAGS_DBG="-g -ansi -pedantic -W -Wall -Wshadow -fbounds-check ${ENABLE64}"
125#
126# Find platform.
127#
128export ARCH0="`uname`"
129export ARCH=${ARCH0}
130export theGcc=`g++ --version | head -n 1 | awk '{print$3}' | awk -F . '{print $1}'`
131if [ ${theGcc} = 4 ]; then
132 export ARCH=${ARCH}-gcc4
133fi
134echo Platform is $ARCH
135
136#default platform settings:
137export FC=g77
138export CC=gcc
139export FFLAGS="${FFLAGS_OPT}"
140export CFLAGS="${CFLAGS_OPT}"
141export CXXFLAGS="${CXXFLAGS_OPT}"
142export FLIBS="-lfrtbegin -lg2c"
143if [ ${COMPMODE} = OPT ]; then
144 export FFLAGS="${FFLAGS_OPT}"
145 export CFLAGS="${CFLAGS_OPT}"
146 export CXXFLAGS="${CXXFLAGS_OPT}"
147fi
148if [ ${COMPMODE} = DBG ]; then
149 export FFLAGS="${FFLAGS_DBG}"
150 export CFLAGS="${CFLAGS_DBG}"
151 export CXXFLAGS="${CXXFLAGS_DBG}"
152fi
153LDFLAGSSHARED="${CXXFLAGS} -pthread -fPIC -shared"
154LDFLAGLIBNAME="-Wl,-soname"
155SHAREDSUFFIX=so
156if [ $ARCH = Linux ]; then
157 export FC=g77
158 export FFLAGS="${FFLAGS_OPT} -Wno-globals"
159 export CFLAGS="${CFLAGS_OPT}"
160 export CXXFLAGS="${CXXFLAGS_OPT}"
161 export FLIBS="-lfrtbegin -lg2c"
162 if [ ${COMPMODE} = OPT ]; then
163 export FFLAGS="${FFLAGS_OPT}"
164 export CFLAGS="${CFLAGS_OPT}"
165 export CXXFLAGS="${CXXFLAGS_OPT}"
166 fi
167 if [ ${COMPMODE} = DBG ]; then
168 export FFLAGS="${FFLAGS_DBG} -Wno-globals"
169 export CFLAGS="${CFLAGS_DBG}"
170 export CXXFLAGS="${CXXFLAGS_DBG}"
171 fi
172 LDFLAGSSHARED="${CXXFLAGS} -pthread -fPIC -shared"
173 LDFLAGLIBNAME="-Wl,-soname"
174 SHAREDSUFFIX=so
175fi
176# Linux platform with gcc4: new Fortran90 compiler.
177if [ $ARCH = Linux-gcc4 ]; then
178 export FC=gfortran
179 export FFLAGS="${FFLAGS_OPT}"
180 export CFLAGS="${CFLAGS_OPT}"
181 export CXXFLAGS="${CXXFLAGS_OPT}"
182 export FLIBS="-lgfortran -lgfortranbegin"
183 if [ ${COMPMODE} = OPT ]; then
184 export FFLAGS="${FFLAGS_OPT}"
185 export CFLAGS="${CFLAGS_OPT}"
186 export CXXFLAGS="${CXXFLAGS_OPT}"
187 fi
188 if [ ${COMPMODE} = DBG ]; then
189 export FFLAGS="${FFLAGS_DBG}"
190 export CFLAGS="${CFLAGS_DBG}"
191 export CXXFLAGS="${CXXFLAGS_DBG}"
192 fi
193 LDFLAGSSHARED="${CXXFLAGS} -pthread -fPIC -shared"
194 LDFLAGLIBNAME="-Wl,-soname"
195 SHAREDSUFFIX=so
196fi
197# Mac-OSX with gcc4
198if [ $ARCH = Darwin-gcc4 ]; then
199 export FC=gfortran
200 export FFLAGS="${FFLAGS_OPT}"
201 export CFLAGS="${CFLAGS_OPT}"
202 export CXXFLAGS="${CXXFLAGS_OPT}"
203 export FLIBS="-lgfortran"
204 if [ ${COMPMODE} = OPT ]; then
205 export FFLAGS="${FFLAGS_OPT}"
206 export CFLAGS="${CFLAGS_OPT}"
207 export CXXFLAGS="${CXXFLAGS_OPT}"
208 fi
209 if [ ${COMPMODE} = DBG ]; then
210 export FFLAGS="${FFLAGS_DBG}"
211 export CFLAGS="${CFLAGS_DBG}"
212 export CXXFLAGS="${CXXFLAGS_DBG}"
213 fi
214 LDFLAGSSHARED="${CXXFLAGS} -dynamiclib -single_module -flat_namespace -undefined suppress"
215 LDFLAGLIBNAME="-Wl,-dylib_install_name"
216 SHAREDSUFFIX=dylib
217fi
218# Mac-OSX with gcc3; is not tested
219if [ $ARCH = Darwin ]; then
220 export FC=g77
221 export FFLAGS="${FFLAGS_OPT}"
222 export CFLAGS="${CFLAGS_OPT}"
223 export CXXFLAGS="${CXXFLAGS_OPT}"
224 export FLIBS="-lfrtbegin -lg2c"
225 if [ ${COMPMODE} = OPT ]; then
226 export FFLAGS="${FFLAGS_OPT}"
227 export CFLAGS="${CFLAGS_OPT}"
228 export CXXFLAGS="${CXXFLAGS_OPT}"
229 fi
230 if [ ${COMPMODE} = DBG ]; then
231 export FFLAGS="${FFLAGS_DBG}"
232 export CFLAGS="${CFLAGS_DBG}"
233 export CXXFLAGS="${CXXFLAGS_DBG}"
234 fi
235 LDFLAGSSHARED="${CXXFLAGS} -dynamiclib -single_module -flat_namespace -undefined suppress"
236 LDFLAGLIBNAME="-Wl,-dylib_install_name"
237 SHAREDSUFFIX=dylib
238fi
239
240
241CXXFLAGS="${CXXFLAGS} $USRCXXFLAGS"
242LDFLAGSSHARED="${LDFLAGSSHARED} $USRLDFLAGSSHARED"
243if [ "x${USRSHAREDSUFFIX}" != "x" ] ; then
244 SHAREDSUFFIX="${USRSHAREDSUFFIX}"
245fi
246
247
248#Platform & opt/dbg - independent flags and variables:
249
250
251#
252# End of the user-changeable part ---------------------------
253#
254# Checks
255#
256if [ $?HEPMCLOCATION ]; then
257 if [ x${HEPMCLOCATION} != x ]; then
258 if [ ! -d ${HEPMCLOCATION}/include ]; then
259 echo "Warning: bad HEPMCLOCATION: directory ${HEPMCLOCATION}/include does not exist"
260 echo " The interface will not be built"
261 export HEPMCLOCATION=
262 fi
263 if [ ! -d ${HEPMCLOCATION}/lib ]; then
264 echo "Warning: bad HEPMCLOCATION: directory ${HEPMCLOCATION}/lib does not exist"
265 echo " The interface will not be built"
266 export HEPMCLOCATION=
267 fi
268 fi
269fi
270
271rm -f config.mk
272
273echo SHELL = /bin/sh > config.mk
274echo ARCH = ${ARCH} >> config.mk
275echo MYLCGPLATFORM = ${MYLCGPLATFORM} >> config.mk
276echo SHAREDLIBS = ${SHAREDLIBS} >> config.mk
277echo FC = ${FC} >> config.mk
278echo CC = ${CC} >> config.mk
279echo FFLAGS = ${FFLAGS} >> config.mk
280echo CFLAGS = ${CFLAGS} >> config.mk
281echo CXXFLAGS = ${CXXFLAGS} >> config.mk
282echo FLIBS = ${FLIBS} >> config.mk
283echo LDFLAGSSHARED = ${LDFLAGSSHARED} >> config.mk
284echo LDFLAGLIBNAME = ${LDFLAGLIBNAME} >> config.mk
285echo SHAREDSUFFIX = ${SHAREDSUFFIX} >> config.mk
286#
287if [ x${HEPMCLOCATION} != x ]; then
288 if [ x${HEPMCVERSION} != x ]; then
289 echo HEPMCVERSION = ${HEPMCVERSION} >> config.mk
290 fi
291 echo HEPMCLOCATION = ${HEPMCLOCATION} >> config.mk
292fi
293#
294#
295#
296rm -f examples/config.sh
297rm -f examples/config.csh
298if [ x${HEPMCLOCATION} != x ]; then
299 if [ $ARCH0 != Darwin ]; then
300 echo "#!/bin/csh" > examples/config.csh
301 echo 'if( ! $?LD_LIBRARY_PATH ) then' >> examples/config.csh
302 echo " setenv LD_LIBRARY_PATH ${HEPMCLOCATION}/lib" >> examples/config.csh
303 echo "else" >> examples/config.csh
304 echo " setenv LD_LIBRARY_PATH" '${LD_LIBRARY_PATH}'":${HEPMCLOCATION}/lib" >> examples/config.csh
305 echo "endif" >> examples/config.csh
306 echo "#!/bin/sh" > examples/config.sh
307 echo 'if [ ! $?LD_LIBRARY_PATH ]; then' >> examples/config.sh
308 echo " export LD_LIBRARY_PATH=${HEPMCLOCATION}/lib" >> examples/config.sh
309 echo fi >> examples/config.sh
310 echo 'if [ $?LD_LIBRARY_PATH ]; then' >> examples/config.sh
311 echo " export LD_LIBRARY_PATH="'${LD_LIBRARY_PATH}'":${HEPMCLOCATION}/lib" >> examples/config.sh
312 echo fi >> examples/config.sh
313 else
314 echo "#!/bin/csh" > examples/config.csh
315 echo 'if( ! $?DYLD_LIBRARY_PATH ) then' >> examples/config.csh
316 echo " setenv DYLD_LIBRARY_PATH ${HEPMCLOCATION}/lib" >> examples/config.csh
317 echo "else" >> examples/config.csh
318 echo " setenv DYLD_LIBRARY_PATH" '${DYLD_LIBRARY_PATH}'":${HEPMCLOCATION}/lib" >> examples/config.csh
319 echo "endif" >> examples/config.csh
320 echo "#!/bin/sh" > examples/config.sh
321 echo 'if [ ! $?DYLD_LIBRARY_PATH ]; then' >> examples/config.sh
322 echo " export DYLD_LIBRARY_PATH=${HEPMCLOCATION}/lib" >> examples/config.sh
323 echo fi >> examples/config.sh
324 echo 'if [ $?DYLD_LIBRARY_PATH ]; then' >> examples/config.sh
325 echo " export DYLD_LIBRARY_PATH="'${DYLD_LIBRARY_PATH}'":${HEPMCLOCATION}/lib" >> examples/config.sh
326 echo fi >> examples/config.sh
327 fi
328fi