AGILe is hosted by Hepforge, IPPP Durham

GenserBuildProblems: configure

File configure, 5.3 KB (added by jmonk, 10 years ago)

Genser configure for OS X

Line 
1#!/bin/sh
2#
3# Configuration script, to be run before compilation
4#
5# Author: M. Kirsanov, dependency on MCGENERATORS removed on 17.07.2007 (ozenin@cern.ch)
6
7#
8# User-changeable part -------------------------------
9#
10
11#if [ x$MCGENERATORS = x ]; then
12#  echo MCGENERATORS variable is not defined !
13#  echo You should define it or start ./lcg_configure instead of ./configure.
14#  exit 1
15#fi
16 
17export SHAREDLIBS=no
18
19# check arguments
20
21for arg in $* ; do
22  if [ "x$arg" = "x--enable-debug" ] ; then
23    COMPMODE=DBG
24  elif [ "x$arg" = "x--enable-optimize" ] ; then
25    COMPMODE=OPT
26  elif [ "x$arg" = "x--enable-shared" ] ; then
27    SHAREDLIBS=yes
28  elif [ "x$arg" = "x--help" ] ; then
29    echo -e \
30    "\nUsage: ./configure [options] , where options are:\n\n"\
31    "--help            : prints this help\n"\
32    "--enable-optimize : turns on compiler optimizations (default)\n"\
33    "--enable-debug    : turns on debugging flags\n"\
34    "--enable-shared   : turns on shared library creation (default no)\n"\
35    "--lcgplatform=lcgplatformname : platform, default is slc3_ia32_gcc323\n"
36    exit
37  elif [ "x${arg}" != "x${arg/=/}" ] ; then
38    option=${arg/=*/}
39    value=${arg/*=/}
40    if [ "x${option}" = "x--lcgplatform" ] ; then
41      LCGPLATFORM=${value}
42    else
43      echo "${arg}: wrong option. Ignored." >&2
44    fi
45  fi
46done
47
48#LCG platform. Can be needed if external libraries are specified
49
50#. ${MCGENERATORS}/scripts/platform_functions
51. .scripts/platform_functions
52lcgplatform=$(check_platform)
53
54if [ x$LCGPLATFORM != x ]; then
55  if [ $LCGPLATFORM != ${lcgplatform} ]; then
56    echo
57    echo Definition of LCGPLATFORM is wrong!
58    exit 1
59  fi
60  LCGPLATFORM=${LCGPLATFORM}
61else 
62  LCGPLATFORM=${lcgplatform}
63fi
64 
65echo LCGPLATFORM is ${LCGPLATFORM}
66
67
68#Compilation mode. Is not changed if specified outside
69if [ x$COMPMODE = x ]; then
70  export COMPMODE=OPT
71fi
72#if [ x$COMPMODE = x ]; then
73#  export COMPMODE=DBG
74#fi
75
76echo compilation mode is $COMPMODE
77echo sharedlibs = $SHAREDLIBS
78
79#
80# User-changeable part, experts  -----------------------------
81#
82
83# export FFLAGS_OPT="-O2 -Wuninitialized"
84# -Wuninitialized outputs many irrelevant warnings and therefore obscurs
85export FFLAGS_OPT="-O2"
86export FFLAGS_DBG="-g"
87export CFLAGS_OPT="-O2"
88export CFLAGS_DBG="-g"
89export CXXFLAGS_OPT="-O2 -ansi -pedantic -W -Wall"
90export CXXFLAGS_DBG="-g -ansi -pedantic -W -Wall"
91export FFLAGSSHARED="-fPIC"
92export CFLAGSSHARED="-fPIC"
93export LDLAGSSHARED="-O2 -Wall -pthread -fPIC"
94export SHAREDFLAGS="-shared -Wl,-soname,\$(notdir \$@)"
95#
96# Find platform.
97#
98export ARCH="`uname`"
99export theGcc1=`g++ --version | awk '{print$3}'`
100export theGcc=`echo ${theGcc1} | awk -F . '{print $1}'`
101if [ ${theGcc} = 4 ]; then
102  export ARCH=${ARCH}-gcc4
103fi
104echo Platform is $ARCH
105
106#default platform settings:
107export FC=g77
108export CC=gcc
109export FFLAGS="${FFLAGS_OPT}"
110export CFLAGS="${CFLAGS_OPT}"
111export CXXFLAGS="${CXXFLAGS_OPT}"
112export FLIBS="-lfrtbegin -lg2c"
113if [ ${COMPMODE} = OPT ]; then
114  export FFLAGS="${FFLAGS_OPT}"
115  export CFLAGS="${CFLAGS_OPT}"
116  export CXXFLAGS="${CXXFLAGS_OPT}"
117fi
118if [ ${COMPMODE} = DBG ]; then
119  export FFLAGS="${FFLAGS_DBG}"
120  export CFLAGS="${CFLAGS_DBG}"
121  export CXXFLAGS="${CXXFLAGS_DBG}"
122fi
123
124if [ ${ARCH:0:6} = Darwin ]; then
125    echo found Darwin
126    export SHLIB=dylib
127    export SHAREDFLAGS="-dynamiclib -undefined dynamic_lookup"
128    g77=`which g77`
129    gfortran=`which gfortran`
130    if [ ! x$g77 = x ]; then 
131        export FC=g77
132        export FFLAGS="-O2 -Wall -undefined dynamic_lookup"
133        export FLIBS="-lg2c"
134    fi
135    if [ ! x$gfortran = x ]; then
136        export FC=gfortran
137        export FFLAGS="-O2 -Wall -undefined dynamic_lookup"
138        export FLIBS="-lgfortran"
139    fi
140fi
141
142if [ $ARCH = Linux ]; then
143  export FC=g77
144  export FFLAGS="${FFLAGS_OPT} -Wno-globals"
145  export CFLAGS="${CFLAGS_OPT}"
146  export CXXFLAGS="${CXXFLAGS_OPT}"
147  export FLIBS="-lfrtbegin -lg2c"
148  if [ ${COMPMODE} = OPT ]; then
149    export FFLAGS="${FFLAGS_OPT}"
150    export CFLAGS="${CFLAGS_OPT}"
151    export CXXFLAGS="${CXXFLAGS_OPT}"
152  fi
153  if [ ${COMPMODE} = DBG ]; then
154    export FFLAGS="${FFLAGS_DBG} -Wno-globals"
155    export CFLAGS="${CFLAGS_DBG}"
156    export CXXFLAGS="${CXXFLAGS_DBG}"
157  fi
158fi
159# Linux platform with gcc4: new Fortran90 compiler.
160if [ $ARCH = Linux-gcc4 ]; then
161  export FC=gfortran
162  export FFLAGS="${FFLAGS_OPT}"
163  export CFLAGS="${CFLAGS_OPT}"
164  export CXXFLAGS="${CXXFLAGS_OPT}"
165  export FLIBS="-lgfortran -lgfortranbegin"
166  if [ ${COMPMODE} = OPT ]; then
167    export FFLAGS="${FFLAGS_OPT}"
168    export CFLAGS="${CFLAGS_OPT}"
169    export CXXFLAGS="${CXXFLAGS_OPT}"
170  fi
171  if [ ${COMPMODE} = DBG ]; then
172    export FFLAGS="${FFLAGS_DBG}"
173    export CFLAGS="${CFLAGS_DBG}"
174    export CXXFLAGS="${CXXFLAGS_DBG}"
175  fi
176fi
177
178# Upon ATLAS request:
179
180export FFLAGS="${FFLAGS} -fno-automatic"
181
182#Platform & opt/dbg - independent flags and variables:
183
184rm -f config.mk
185
186echo SHELL = /bin/sh > config.mk
187echo ARCH = ${ARCH} >> config.mk
188echo LCGPLATFORM = ${LCGPLATFORM} >> config.mk
189echo SHAREDLIBS = ${SHAREDLIBS} >> config.mk
190echo SHLIB = ${SHLIB} >> config.mk
191echo SHAREDFLAGS = ${SHAREDFLAGS} >> config.mk
192echo FC = ${FC} >> config.mk
193echo CC = ${CC} >> config.mk
194echo FFLAGS = ${FFLAGS} >> config.mk
195echo CFLAGS = ${CFLAGS} >> config.mk
196echo CXXFLAGS = ${CXXFLAGS} >> config.mk
197echo FLIBS = ${FLIBS} >> config.mk
198echo FFLAGSSHARED = ${FFLAGSSHARED} >> config.mk
199echo CFLAGSSHARED = ${CFLAGSSHARED} >> config.mk
200echo LDLAGSSHARED = ${LDLAGSSHARED} >> config.mk
201