File: configure

package info (click to toggle)
pythia8 8.1.65-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 22,660 kB
  • sloc: cpp: 59,593; xml: 30,509; php: 6,649; sh: 796; makefile: 353; ansic: 33
file content (388 lines) | stat: -rwxr-xr-x 13,180 bytes parent folder | download
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
#!/bin/sh
#
# Configuration script, to be run before compilation
#
# Author: M. Kirsanov

if [ x$BASH_VERSION = x ]; then
  echo warning: you are not using bash shell on which this script is tested
fi

#
# User-changeable part -------------------------------
#

#LCG platform. Can be needed if external libraries are specified
if [ x$MYLCGPLATFORM = x ]; then
  export MYLCGPLATFORM=slc4_ia32_gcc34
fi

# Defaults
export COMPMODE=OPT
export SHAREDLIBS=no
export ENABLEGZIP=no

for arg in $* ; do
  if [ "x$arg" = "x--enable-debug" ] ; then
    COMPMODE=DBG
  elif [ "x$arg" = "x--enable-shared" ] ; then
    SHAREDLIBS=yes
  elif [ "x$arg" = "x--enable-64bits" ] ; then
    ENABLE64=-m64
  elif [ "x$arg" = "x--enable-gzip" ] ; then
    ENABLEGZIP=yes
  elif [ "x$arg" = "x--help" ] ; then
    echo "Usage: ./configure [options] , where options are:"
    echo "--help                : prints this help"
    echo "--enable-debug        : turns on debugging flags and turns off optimization"
    echo "--enable-shared       : turns on shared library creation (default no)"
    echo "--enable-64bits       : turns on 64 bits compilation flags"
    echo "--lcgplatform=name    : LCG platform name, default is slc4_ia32_gcc34"
    echo "--with-hepmc=path     : path to HepMC library to build interface (default is not build)"
    echo "--with-hepmcversion=v : HepMC version (simplified alternative when using CERN AFS LCG external, e.g. =2.04.00)"
    echo "--enable-gzip         : turns on support for reading in gzipped files (default no)"
    echo "                        (experimental feature, see README for more details)"
    echo "--with-boost=path     : path to boost installation (default /usr) (required for gzip support)"
    echo "--with-zlib=path      : path to zlib (default /usr/lib) (required for gzip support)"
    echo
    echo "Use the following environment variables to force the configuration process or add flags:"
    echo "USRCXXFLAGS - to add flags. Use this variable to add -fPIC to the compilation flags for the static libraries"
    echo "USRLDFLAGSSHARED - to add flags to the shared library build command"
    echo "USRSHAREDSUFFIX - to force shared libraries suffix to be like this (default on MacOSX is dylib)"
    echo
    exit
  elif [ x`echo x${arg} | grep "="` != x ] ; then
    option=`echo ${arg} | awk -F = '{print $1}'`
    value=`echo ${arg} | awk -F = '{print $2}'`
    if [ "x${option}" = "x--lcgplatform" ] ; then
      MYLCGPLATFORM=${value}
    elif [ "x${option}" = "x--with-hepmcversion" ] ; then
      HEPMCVERSION=${value}
    elif [ "x${option}" = "x--with-hepmc" ] ; then
      HEPMCLOCATION=${value}
    elif [ "x${option}" = "x--with-boost" ] ; then
      BOOSTLOCATION=${value}
    elif [ "x${option}" = "x--with-zlib" ] ; then
      ZLIBLOCATION=${value}
    else
      echo "${arg}: wrong option. Ignored." >&2
    fi
  fi
done

echo compilation mode is $COMPMODE
echo sharedlibs = $SHAREDLIBS

# Environment variables for building HepMC interface library. Note that
# the HepMC interface library is used by the examples main31, main32.
# Attention: if you have already run these examples and you change HepMC
# version you should reset your LD_LIBRARY_PATH
# The default values here correspond to CERN AFS lcg external
#
if [ "x${HEPMCVERSION}" != "x" ] ; then
  if [ "x${HEPMCLOCATION}" = "x" ] ; then
    export HEPMCLOCATION=/afs/cern.ch/sw/lcg/external/HepMC/${HEPMCVERSION}/${MYLCGPLATFORM}
  fi
fi
#   If you want to assign these variables by hand:
#
#export HEPMCVERSION=2.04.00
#export HEPMCLOCATION=/afs/cern.ch/sw/lcg/external/HepMC/${HEPMCVERSION}/${MYLCGPLATFORM}


if [ "x${HEPMCVERSION}" = "x" ] ; then
  if [ "x${HEPMCLOCATION}" != "x" ] ; then
#                                            try to find out which HepMC version
    export HEPMCVERSION=`grep 'define HEPMC_VERSION' ${HEPMCLOCATION}/include/HepMC/HepMCDefs.h | awk '{print $3}' | tr -d '"'`
  fi
fi
if [ "x${HEPMCVERSION}" != "x" ] ; then
  export HEPMCMAINVERSION=`echo ${HEPMCVERSION} | awk -F . '{print$1}'`
  if [ ${HEPMCMAINVERSION} = 1 ] ; then
    echo "Warning: HepMC 1 cannot be used anymore; Please use HepMC 2"
    echo "         The interface will not be built"
    export HEPMCLOCATION=
  fi
fi
if [ "x${HEPMCLOCATION}" != "x" ] ; then
  if [ "x${HEPMCVERSION}" = "x" ] ; then
    echo "Warning: hepmc specified, but cannot find out which HepMC version"
    echo "Warning: if you specify HepMC 1 the compilation of interface will fail"
  fi
fi


#
# User-changeable part, experts  -----------------------------
#

# Switch off -Wshadow when gzip support is enabled
WSHADOW="-Wshadow"
if [ "x${ENABLEGZIP}" = "xyes" ]; then
  WSHADOW=""
fi

# export FFLAGS_OPT="-O2 -Wuninitialized"
# -Wuninitialized outputs many irrelevant warnings and therefore obscurs 
export FFLAGS_OPT="-O2"
export FFLAGS_DBG=-g
export CFLAGS_OPT="-O2"
export CFLAGS_DBG=-g
export CXXFLAGS_OPT="-O2 -ansi -pedantic -W -Wall ${WSHADOW} ${ENABLE64}"
export CXXFLAGS_DBG="-g -ansi -pedantic -W -Wall ${WSHADOW} ${ENABLE64}"
#
# Find platform.
#
export ARCH0="`uname`"
export ARCH=${ARCH0}
export theGcc=`gcc -dumpversion | awk -F . '{print $1}'`
if [ ${theGcc} = 4 ]; then
  export ARCH=${ARCH}-gcc4
fi
echo Platform is $ARCH

#default platform settings:
export FC=g77
export CC=gcc
export FFLAGS="${FFLAGS_OPT}"
export CFLAGS="${CFLAGS_OPT}"
export CXXFLAGS="${CXXFLAGS_OPT}"
export FLIBS="-lfrtbegin -lg2c"
if [ ${COMPMODE} = OPT ]; then
  export FFLAGS="${FFLAGS_OPT}"
  export CFLAGS="${CFLAGS_OPT}"
  export CXXFLAGS="${CXXFLAGS_OPT}"
fi
if [ ${COMPMODE} = DBG ]; then
  export FFLAGS="${FFLAGS_DBG}"
  export CFLAGS="${CFLAGS_DBG}"
  export CXXFLAGS="${CXXFLAGS_DBG}"
fi
LDFLAGSSHARED="${CXXFLAGS} -fPIC -shared"
LDFLAGLIBNAME="-Wl,-soname"
SHAREDSUFFIX=so
if [ $ARCH = Linux ]; then
  export FC=g77
  export FFLAGS="${FFLAGS_OPT} -Wno-globals"
  export CFLAGS="${CFLAGS_OPT}"
  export CXXFLAGS="${CXXFLAGS_OPT}"
  export FLIBS="-lfrtbegin -lg2c"
  if [ ${COMPMODE} = OPT ]; then
    export FFLAGS="${FFLAGS_OPT}"
    export CFLAGS="${CFLAGS_OPT}"
    export CXXFLAGS="${CXXFLAGS_OPT}"
  fi
  if [ ${COMPMODE} = DBG ]; then
    export FFLAGS="${FFLAGS_DBG} -Wno-globals"
    export CFLAGS="${CFLAGS_DBG}"
    export CXXFLAGS="${CXXFLAGS_DBG}"
  fi
  LDFLAGSSHARED="${CXXFLAGS} -fPIC -shared"
  LDFLAGLIBNAME="-Wl,-soname"
  SHAREDSUFFIX=so
fi
# Linux platform with gcc4: new Fortran90 compiler.
if [ $ARCH = Linux-gcc4 ]; then
  export FC=gfortran
  export FFLAGS="${FFLAGS_OPT}"
  export CFLAGS="${CFLAGS_OPT}"
  export CXXFLAGS="${CXXFLAGS_OPT}"
  export FLIBS="-lgfortran -lgfortranbegin"
  if [ ${COMPMODE} = OPT ]; then
    export FFLAGS="${FFLAGS_OPT}"
    export CFLAGS="${CFLAGS_OPT}"
    export CXXFLAGS="${CXXFLAGS_OPT}"
  fi
  if [ ${COMPMODE} = DBG ]; then
    export FFLAGS="${FFLAGS_DBG}"
    export CFLAGS="${CFLAGS_DBG}"
    export CXXFLAGS="${CXXFLAGS_DBG}"
  fi
  LDFLAGSSHARED="${CXXFLAGS} -fPIC -shared"
  LDFLAGLIBNAME="-Wl,-soname"
  SHAREDSUFFIX=so
fi
# Mac-OSX with gcc4
if [ $ARCH = Darwin-gcc4 ]; then
  export FC=gfortran
  export FFLAGS="${FFLAGS_OPT}"
  export CFLAGS="${CFLAGS_OPT}"
  export CXXFLAGS="${CXXFLAGS_OPT}"
  export FLIBS="-lgfortran"
  if [ ${COMPMODE} = OPT ]; then
    export FFLAGS="${FFLAGS_OPT}"
    export CFLAGS="${CFLAGS_OPT}"
    export CXXFLAGS="${CXXFLAGS_OPT}"
  fi
  if [ ${COMPMODE} = DBG ]; then
    export FFLAGS="${FFLAGS_DBG}"
    export CFLAGS="${CFLAGS_DBG}"
    export CXXFLAGS="${CXXFLAGS_DBG}"
  fi
  LDFLAGSSHARED="${CXXFLAGS} -dynamiclib -single_module -flat_namespace -undefined suppress"
  LDFLAGLIBNAME="-Wl,-dylib_install_name"
  SHAREDSUFFIX=dylib
fi
# Mac-OSX with gcc3; is not tested
if [ $ARCH = Darwin ]; then
  export FC=g77
  export FFLAGS="${FFLAGS_OPT}"
  export CFLAGS="${CFLAGS_OPT}"
  export CXXFLAGS="${CXXFLAGS_OPT}"
  export FLIBS="-lfrtbegin -lg2c"
  if [ ${COMPMODE} = OPT ]; then
    export FFLAGS="${FFLAGS_OPT}"
    export CFLAGS="${CFLAGS_OPT}"
    export CXXFLAGS="${CXXFLAGS_OPT}"
  fi
  if [ ${COMPMODE} = DBG ]; then
    export FFLAGS="${FFLAGS_DBG}"
    export CFLAGS="${CFLAGS_DBG}"
    export CXXFLAGS="${CXXFLAGS_DBG}"
  fi
  LDFLAGSSHARED="${CXXFLAGS} -dynamiclib -single_module -flat_namespace -undefined suppress"
  LDFLAGLIBNAME="-Wl,-dylib_install_name"
  SHAREDSUFFIX=dylib
fi


CXXFLAGS="${CXXFLAGS} $USRCXXFLAGS"
LDFLAGSSHARED="${LDFLAGSSHARED} $USRLDFLAGSSHARED"
if [ "x${USRSHAREDSUFFIX}" != "x" ] ; then
  SHAREDSUFFIX="${USRSHAREDSUFFIX}"
fi


#Platform & opt/dbg - independent flags and variables:


#
# End of the user-changeable part ---------------------------
#
# Checks
#
if [ $?HEPMCLOCATION ]; then
  if [ x${HEPMCLOCATION} != x ]; then
    if [ ! -d ${HEPMCLOCATION}/include ]; then
      echo "Warning: bad HEPMCLOCATION: directory ${HEPMCLOCATION}/include does not exist"
      echo "         The interface will not be built"
      export HEPMCLOCATION=
    fi
    if [ ! -d ${HEPMCLOCATION}/lib ]; then
      echo "Warning: bad HEPMCLOCATION: directory ${HEPMCLOCATION}/lib does not exist"
      echo "         The interface will not be built"
      export HEPMCLOCATION=
    fi
  fi
fi

# gzip support - do after SHAREDSUFFIX is set
if [ "x${ENABLEGZIP}" = "xyes" ]; then

  # Default locations if none given
  if [ "x${BOOSTLOCATION}" = "x" ]; then
    BOOSTLOCATION=/usr
  fi
  if [ "x${ZLIBLOCATION}" = "x" ]; then
    ZLIBLOCATION=/usr/lib
  fi

  # Check for Boost and zlib
  if [ "x${ENABLEGZIP}" = "xyes" ] ; then
    if [ ! -d "${BOOSTLOCATION}/include/boost/iostreams" ]; then
      echo "Error: cannot find required Boost include files; gzip support disabled"
      ENABLEGZIP=no
    fi

    # Some systems have Boost only under lib64?
    for i in lib lib64; do 
      if [ -f "${BOOSTLOCATION}/$i/libboost_iostreams.${SHAREDSUFFIX}" ]; then
        BOOSTLIBLOCATION=${BOOSTLOCATION}/$i
        break
      fi
    done

    if [ "x${ENABLEGZIP}" = "xyes" -a x"${BOOSTLIBLOCATION}" = x ]; then
      echo "Error: cannot find required Boost library files; gzip support disabled"
      ENABLEGZIP=no
    fi

    if [ "x${ENABLEGZIP}" = "xyes" -a ! -f "${ZLIBLOCATION}/libz.${SHAREDSUFFIX}" ]; then
      echo "Error: cannot find zlib; gzip support disabled"
      ENABLEGZIP=no
    fi
  fi

  # Add flags
  if [ "x${ENABLEGZIP}" = "xyes" ] ; then
    echo gzip support is enabled
    CXXFLAGS="${CXXFLAGS} -DGZIPSUPPORT -I${BOOSTLOCATION}/include"
  fi
fi

rm -f config.mk

echo SHELL = /bin/sh > config.mk
echo ARCH = ${ARCH} >> config.mk
echo MYLCGPLATFORM = ${MYLCGPLATFORM} >> config.mk
echo SHAREDLIBS = ${SHAREDLIBS} >> config.mk
echo FC = ${FC} >> config.mk
echo CC = ${CC} >> config.mk
echo FFLAGS = ${FFLAGS} >> config.mk
echo CFLAGS = ${CFLAGS} >> config.mk
echo CXXFLAGS = ${CXXFLAGS} >> config.mk
echo FLIBS = ${FLIBS} >> config.mk
echo LDFLAGSSHARED = ${LDFLAGSSHARED} >> config.mk
echo LDFLAGLIBNAME = ${LDFLAGLIBNAME} >> config.mk
echo SHAREDSUFFIX = ${SHAREDSUFFIX} >> config.mk
#
if [ x${HEPMCLOCATION} != x ]; then
  if [ x${HEPMCVERSION} != x ]; then
    echo HEPMCVERSION = ${HEPMCVERSION} >> config.mk
  fi
  echo HEPMCLOCATION = ${HEPMCLOCATION} >> config.mk
fi
#
#
#
rm -f examples/config.sh
rm -f examples/config.csh
if [ x${HEPMCLOCATION} != x ]; then
  if [ $ARCH0 != Darwin ]; then
    echo "#!/bin/csh" > examples/config.csh
    echo 'if( ! $?LD_LIBRARY_PATH ) then' >> examples/config.csh
    echo "  setenv LD_LIBRARY_PATH ${HEPMCLOCATION}/lib" >> examples/config.csh
    echo "else" >> examples/config.csh
    echo "  setenv LD_LIBRARY_PATH" '${LD_LIBRARY_PATH}'":${HEPMCLOCATION}/lib" >> examples/config.csh
    echo "endif" >> examples/config.csh
    echo "#!/bin/sh" > examples/config.sh
    echo 'if [ ! $?LD_LIBRARY_PATH ]; then' >> examples/config.sh
    echo "  export LD_LIBRARY_PATH=${HEPMCLOCATION}/lib" >> examples/config.sh
    echo fi >> examples/config.sh
    echo 'if [ $?LD_LIBRARY_PATH ]; then' >> examples/config.sh
    echo "  export LD_LIBRARY_PATH="'${LD_LIBRARY_PATH}'":${HEPMCLOCATION}/lib" >> examples/config.sh
    echo fi >> examples/config.sh
  else
    echo "#!/bin/csh" > examples/config.csh
    echo 'if( ! $?DYLD_LIBRARY_PATH ) then' >> examples/config.csh
    echo "  setenv DYLD_LIBRARY_PATH ${HEPMCLOCATION}/lib" >> examples/config.csh
    echo "else" >> examples/config.csh
    echo "  setenv DYLD_LIBRARY_PATH" '${DYLD_LIBRARY_PATH}'":${HEPMCLOCATION}/lib" >> examples/config.csh
    echo "endif" >> examples/config.csh
    echo "#!/bin/sh" > examples/config.sh
    echo 'if [ ! $?DYLD_LIBRARY_PATH ]; then' >> examples/config.sh
    echo "  export DYLD_LIBRARY_PATH=${HEPMCLOCATION}/lib" >> examples/config.sh
    echo fi >> examples/config.sh
    echo 'if [ $?DYLD_LIBRARY_PATH ]; then' >> examples/config.sh
    echo "  export DYLD_LIBRARY_PATH="'${DYLD_LIBRARY_PATH}'":${HEPMCLOCATION}/lib" >> examples/config.sh
    echo fi >> examples/config.sh
  fi
fi

# gzip support - write locations into config.mk
if [ "x${ENABLEGZIP}" = "xyes" ] ; then
  echo "ENABLEGZIP = yes" >> config.mk
  echo "BOOSTLOCATION = ${BOOSTLOCATION}" >> config.mk
  echo "BOOSTLIBLOCATION = ${BOOSTLIBLOCATION}" >> config.mk
  echo "ZLIBLOCATION = ${ZLIBLOCATION}" >> config.mk
fi