#!/bin/sh #set -xv command="$0 $*" # configure script for amber: creates config.h #------------------------------------------------------------------------------ # set up usage statement: #------------------------------------------------------------------------------ usage(){ cat< is one of: absoft, compaqf90, efc7, hpf90, ifc7, ifort, ia64_ifort, pgf90, pathscale, sgi_altix, sgi_mips, sparc, xlf90_aix, xlf90_suse. If not specified then the compiler is guessed. Parallel option flags: -lam Use LAM/MPI (LAM_HOME must be set) -mpi Use native MPI -mpich Use MPICH (MPICH_HOME must be set) -mplite Use MP_Lite (MPLITE_HOME must be set) -nopar Explicit request of no MPI, the default -scali Use SCALI (SCALI_HOME must be set) Platform option flags: -athlon Optimize for Athlon processor (intel,pgf90). -gnucompat Add a second underscore to some symbols to maintain GNU compatibility (pgf90). -opteron Optimize for Opteron processor (pgf90). -p4 Optimize for Pentium 4 processor (intel,pgf90,pathscale). -cygwin Add CygWin flags for Windows (absoft). General flags: -big Big systems support, ie, 8 byte integers and pointers. -fpp_prefix= Define the prefix for FPP preprocessing; default is "_". -lmod Request linking sander with Istvan Kolossvary's LMOD libraries. -mmtsb Request building sander for MMTSB. -static Static linking, i.e., prevent linking with shared libraries. -verbose Add verbose compiler comment and warning flags. -fflags= Explicitly set the F90 optimization flags -cflags= Explicitly set the C/C++ optimization flags Other environment variables: AMBERHOME Root directory of the Amber tree. MKL_HOME Root directory of the Intel Math Kernel Library (intel,sgi_altix); for example, /opt/intel/mkl61. The MKL is recommended for optimal performance. =========================================================== EOD exit 1; } #------------------------------------------------------------------------------ # Process commandline configuration options: #------------------------------------------------------------------------------ unrequested='no' arch='unknown' athlon=$unrequested big=$unrequested bigness='' cygwin=$unrequested fpp_prefix='_' gnucompat=$unrequested lmod=$unrequested mmtsb=$unrequested opteron=$unrequested parallel='none' p4=$unrequested sfx='' sgimips='unknown' static=$unrequested verbose=$unrequested verbosity='' while [ $# -gt 0 ]; do case "$1" in -lam) parallel="lam" ;; -mpi) parallel="mpi" ;; -mpich) parallel="mpich" ;; -mplite) parallel="mplite" ;; -nopar) parallel="none" ;; -scali) parallel="scali" ;; -athlon) athlon="yes" ;; -gnucompat) gnucompat="yes" ;; -opteron) opteron="yes" ;; -p4) p4="yes" ;; -cygwin) cygwin="yes" ; sfx=".exe" ;; -big) big="yes" ;; -fpp_prefix=*) fpp_prefix=${1#-fpp_prefix=} ;; -lmod) lmod="yes" ;; -mmtsb) mmtsb="yes" ;; -static) static="yes" ;; -verbose) verbose="yes" ;; -fflags=*) set_fflags=${1#-fflags=} ;; -cflags=*) set_cflags=${1#-cflags=} ;; -*) usage ;; *) if [ $# -gt 1 ]; then usage fi arch=$1 ;; esac shift done if [ $arch = "unknown" ]; then # Guess architecture/compiler arch=`uname -s` if [ $arch = "Linux" ]; then arch=`uname -m` if [ $arch = 'ia64' ]; then arch=ia64_ifort elif [ "$IA64ROOT" != "" ]; then arch=ia64_ifort elif [ "$IA32ROOT" != "" ]; then arch=ifort elif [ "$PGI" != "" ]; then arch=pgf90 else arch=ifc7 fi fi fi #------------------------------------------------------------------------------ # Set up defaults that work for most machines: #------------------------------------------------------------------------------ if [ -z "$AMBERHOME" ]; then echo "Warning: the AMBERHOME environment variable is not defined !" echo " It usually should be set to the path of Amber's top level directory." workdir=`pwd` AMBERHOME=`dirname $workdir` echo "Caution: Setting AMBERHOME to $AMBERHOME !" echo " " else echo "AMBERHOME is set to $AMBERHOME" fi amber_src=$AMBERHOME/src # Program specific: localflags= # The preprocessor is always cpp even for Fortran. fpp="cpp -traditional" fppflags="-P -I\$(AMBER_SRC)/include" if [ $mmtsb = "yes" ]; then fppflags="$fppflags -DMMTSB" fi # C compilation: cpp=cpp cc=cc cplusplus=CC cppflags= if [ $mmtsb = "yes" ]; then cppflags="$cppflags -DMMTSB" fi cflags= # (altcc is used for C codes linked to fortran main routines; # sometimes this is different than for C main routines....) altcc=cc altcflags= # Fortran compilation: fc=f90 fflags="-O0 -132" foptflags=-O2 freeformat_flag= # Loading: load="$fc" loadcc="$cc" loadlib= loadptraj= if [ $static = "yes" ]; then static_flag='-static' else static_flag= fi # Libraries: m4='m4' sysdir='lib' use_blas=SOURCE_COMPILED use_lapack=SOURCE_COMPILED if [ $lmod = "yes" ]; then use_lmod=LMOD_SUPPLIED else use_lmod=LMOD_UNAVAILABLE fi xhome='/usr/X11R6' xlibs="$xhome/lib" machine=`uname -m` if test "$machine" = "x86_64" &&\ test "$p4" != "yes"; then xlibs="$xhome/lib64" fi # Auxiliary programs: ar='ar rv ' ranlib=ranlib par_error () { cat <&1 exit 1 fi use_lapack=VENDOR_SUPPLIED use_blas=VENDOR_SUPPLIED loadlib="$loadlib -L$ACML_DIR -lacml" echo "Using optimized AMD Core Math Library (ACML)" fi fc="pathf90" fpp="$fc -cpp -E" if [ "$set_fflags" != "" ]; then foptflags="$set_fflags" fflags="-O1" elif [ "$p4" = "yes" ]; then foptflags="-O3 -m32 -msse2" fflags="-O1 -m32 -msse2" else foptflags="-O3 -OPT:Ofast" fflags="-O1" fi intr_flags="-intrinsic=PGI -intrinsic=fdate" fflags="$fflags $intr_flags $bigness $verbosity" foptflags="$foptflags $intr_flags $bigness $verbosity" load="$fc $foptflags $static_flag" freeformat_flag='-freeform' loadptraj="$load" cc="pathcc" altcc="pathcc" cplusplus="pathCC" cpp="$pathcc -E" if [ "$set_cflags" != "" ]; then cflags="$set_cflags" elif [ "$p4" = "yes" ]; then cflags="-O3 -m32 -msse2" else cflags="-O1" fi cflags="$cflags $verbosity" altcflags="$cflags $verbosity" loadcc="$cc $static_flag" ;; #################### Absoft Windows ##################### absoft) if [ $cygwin = "yes" ]; then # # ---note that altcflags, loadlib, and fc definitions are specific # to the Absoft version (8.2 here) and the installation location # cc=gcc altcc=acc altcflags=" -DABSOFT_WINDOWS -Ic:/Absoft82/CINCLUDE -DCLINK_CAPS" cplusplus='g++' cflags="-DCLINK_CAPS" fc="f90.exe -Z1643 -Z1644" fppflags="$fppflags -DABSOFT_WINDOWS " load=$fc loadcc=$cc loadlib=" -aliases:unicode.als c:/Absoft82/LIB/unix.lib" fflags="-O1" foptflags="-O2" if [ $verbose = "yes" ]; then echo "verbose option is not implemented yet." fi fflags="$fflags $bigness $verbosity" foptflags="$foptflags $bigness $verbosity" freeformat_flag='-f free' ar="lb.exe /out:" ranlib=/bin/true # use_lapack=VENDOR_SUPPLIED # use_blas=VENDOR_SUPPLIED else # (absoft-Linux, not yet tested!) cc=gcc altcc=acc altcflags="-DCLINK_CAPS" cplusplus='g++' cflags="-DCLINK_CAPS" fc=f90 load=$fc loadcc=$cc loadlib=" -lm" fflags="-O1" foptflags="-O2" if [ $big = "yes" ]; then echo "big option is not implemented yet." fi if [ $verbose = "yes" ]; then echo "verbose option is not implemented yet." fi fflags="$fflags $bigness $verbosity" foptflags="$foptflags $bigness $verbosity" freeformat_flag='-f free' # use_lapack=VENDOR_SUPPLIED # use_blas=VENDOR_SUPPLIED fi loadptraj="$load" ;; ##################### SGI IRIX 32-bit ############### sgi_mips|IRIX64) sgi_abi='-n32' fpp='/lib/cpp' fppflags="$fppflags -DSGI -DnoVDINVSQRT" if [ -e /usr/lib32/mips4/libscs.so ]; then use_lapack=VENDOR_SUPPLIED use_blas=VENDOR_SUPPLIED loadlib="$loadlib -lscs" fppflags="$fppflags -DSGIFFT" fi sgi_cpuarch=` hinv -t cpu | awk ' { print $3 } ' | head -1 ` sgi_Rdigit=` echo $sgi_cpuarch | sed s/R// ` if [ $sgi_Rdigit -lt 4000 ]; then # R3k machines, those less than R4000 are not supported. echo "The $sgi_cpuarch Processor is no longer supported." elif [ $sgi_Rdigit -lt 5000 ]; then # R4k machines: only ones with -mips3 sgi_mips='-mips3' else # All others are now -mips4 sgi_mips="-mips4 -r$sgi_Rdigit" fi if [ $sgi_cpuarch = R5000 ]; then # R5k machines sgi_options='-OPT:roundoff=3:IEEE_arithmetic=3 -TENV:X=1 -SWP:strict_ivdep=OFF:if_conversion=OFF -WK,-dr=ACK,-o=1,-so=1,-r=3' # -WK options should be removed in a year; SRB Apr 2003. loadlib="$loadlib -lm" elif [ $sgi_cpuarch = R8000 ]; then # R8k machines sgi_options='-OPT:cis=off:roundoff=3:IEEE_arithmetic=3 -TENV:X=3 -SWP:strict_ivdep=OFF -WK,-dr=AKC' # -WK options should be removed in a year; SRB Apr 2003. loadlib="$loadlib -lfastm" else sgi_options='-OPT:roundoff=3:IEEE_arithmetic=3 -TENV:X=1' loadlib="$loadlib -lfastm" fi cflags="$sgi_abi $sgi_mips $sgi_options -O2 -DSYSV" fflags="$sgi_abi $sgi_mips $sgi_options -O0" foptflags="$sgi_abi $sgi_mips $sgi_options -O3" if [ $big = "yes" ]; then bigness='-64 -i8' fi if [ $verbose = "yes" ]; then # include -S to get a software pipelining report, # delete the .s files later else the build will not be up to date. verbosity="-LIST:notes=ON:software_names=ON -LIST:all_options=ON:cite=ON:symbols=ON" fi cflags="$cflags $bigness" fflags="$fflags $bigness $verbosity" foptflags="$foptflags $bigness $verbosity" load="$fc $sgi_abi $sgi_mips" loadcc="$cc $sgi_abi $sgi_mips" if [ $static = "yes" ]; then echo "Warning: static linking is not supported; option ignored." fi freeformat_flag='-freeform' ar='ar rvs ' ranlib=/bin/true m4='m4 -B50000' loadptraj="$load" ;; ####################### HP ############################ hpf90|HP-UX) fpp='/lib/cpp' if [ $parallel = "mpi" ]; then fppflags="$fppflags -I/opt/mpi/include" fc='mpif90' else fc=f90 fi cplusplus=aCC use_lapack=VENDOR_SUPPLIED use_blas=VENDOR_SUPPLIED loadlib="$loadlib -lveclib -llapack -lm " if [ $static = "yes" ]; then # +noshared is preferred over -N which is ignored by ld. # But it is not clear that +noshared is working; so use archive_shared. static_flag='+noshared -Wl,-aarchive_shared' fi load="$fc $static_flag" loadcc="$cc $static_flag" fppflags="$fppflags -DHP " cppflags="-DCLINK_PLAIN" cflags="-Ae -DSYSV" # no postpending underscores (ppu) to link Fortran and C. # U77 library contains: etime, getarg, iargc. fflags='+noppu +U77 +Ofast' # +Ofaster is ~10% faster (JAC) but build is very slow # and in Sep 2003 for unknown reasons suddenly produces link errors foptflags='+noppu +U77 +Ofast' if [ $big = "yes" ]; then if [ $lmod = "yes" ]; then echo "Warning: the big flag is incompatible with LMOD." fi bigness='+DD64 +i8' fi if [ $verbose = "yes" ]; then verbosity='-v +Oinfo -Wl,-v,-m' fi cflags="$cflags $bigness" fflags="$fflags $bigness $verbosity" foptflags="$foptflags $bigness $verbosity" load="$load $foptflags" freeformat_flag='+source=free' ar='ar rvs ' ranlib=/bin/true loadptraj="$load" ;; ####################### IBM AIX ############################ xlf90_aix|AIX) libpath=/usr/lib if [ -e $libpath/libmass.a ]; then loadlib="$loadlib -L$libpath -lmass" fppflags="$fppflags -DMASSLIB" fi if [ -e $libpath/libblas.a ]; then loadlib="$loadlib -L$libpath -lblas" use_blas=VENDOR_SUPPLIED fi if [ -e $libpath/libessl.a ]; then loadlib="$loadlib -L$libpath -lessl" use_lapack=SOURCE_COMPILED fppflags="$fppflags -DESSL" fi sysdir='Machines/ibm_aix' fppflags="$fppflags -DNMLEQ -DCLINK_PLAIN -Drs6000" fpp='/lib/cpp -traditional' if [ $parallel = "mpi" ]; then fppflags="$fppflags -DPOE" fpp="$fpp -I/usr/lpp/ppe.poe/include" fc='mpxlf90_r -bmaxdata:0x80000000' else fc=xlf90 fi cc=xlc altcc=xlc cppflags="-DCLINK_PLAIN" cflags="-O2" cplusplus=xlC if [ $static = "yes" ]; then static_flag='-bstatic' fi load="$fc $static_flag " loadcc="$cc $static_flag" fflags="-qfixed -c" foptflags="-qfixed -O3 -qmaxmem=-1 -qarch=auto -qtune=auto -c" if [ $big = "yes" ]; then echo "big option is not implemented yet." fi if [ $verbose = "yes" ]; then verbosity='-qsource -qreport=hotlist' fi fflags="$fflags $bigness $verbosity" foptflags="$foptflags $bigness $verbosity" freeformat_flag='-qfree' ar='ar rvs ' ranlib=/bin/true loadptraj="$load" m4='m4 -B50000' ;; ####################### PowerPC SUSE Linux ############################ xlf90_suse) libpath=/usr/lib if [ -e $libpath/libmass.a ]; then loadlib="$loadlib -L$libpath " fppflags="$fppflags" fi if [ -e $libpath/libblas.a ]; then loadlib="$loadlib -L$libpath -lblas" use_blas=VENDOR_SUPPLIED fi if [ -e $libpath/libessl.a ]; then loadlib="$loadlib -L$libpath -lessl" use_lapack=VENDOR_SUPPLIED fi fppflags="$fppflags -DCLINK_PLAIN -Drs6000" fpp='/opt/ibmcmp/xlf/8.1/exe/cpp ' if [ $parallel = "mpich" ]; then fpp="$fpp -I$MPICH_HOME/include" fc='mpif90' else echo "ONLY HAVE MPICH for parallel" exit 1 fi cc=cc cppflags="-DCLINK_PLAIN" cflags="-O2" cplusplus=xlC if [ $static = "yes" ]; then static_flag='-bstatic' fi load="$fc $static_flag " loadcc="$cc $static_flag" fflags="-qfixed -c" foptflags="-qfixed -O3 -qmaxmem=-1 -qarch=auto -qtune=auto -c" if [ $big = "yes" ]; then echo "big option is not implemented yet." fi if [ $verbose = "yes" ]; then verbosity='-qsource -qreport=hotlist' fi fflags="$fflags $bigness $verbosity" foptflags="$foptflags $bigness $verbosity" freeformat_flag='-qfree' ar='ar rvs ' ranlib=/bin/true loadptraj="$load" ;; ####################### Compaq DEC Alpha OSF1 ########################## compaqf90|OSF1) use_lapack=VENDOR_SUPPLIED use_blas=VENDOR_SUPPLIED # -C prevents striping of C-style AND C++-style comments; # some format statements contain // fppflags="-C $fppflags" fpp='/lib/cpp -traditional' fflags="-tune host -arch host" foptflags="-fast -O3 -tune host -arch host" cplusplus=cxx cflags="-O -std1" if [ $big = "yes" ]; then # pointers are always 64 bits # but see -taso if [ $lmod = "yes" ]; then echo "Warning: the big flag is incompatible with LMOD." fi bigness='-i8' fi if [ $verbose = "yes" ]; then verbosity='-source_listing -annotations all -Wl,-v,-m,-M' fi fflags="$fflags $bigness $verbosity" foptflags="$foptflags $bigness $verbosity" if [ $static = "yes" ]; then static_flag='-non_shared' fi load="$fc $static_flag $verbosity" loadcc="$cc $static_flag" loadlib="$loadlib -ldxml -lm" freeformat_flag='-free' ranlib=/bin/true m4='m4 -B50000' # nofor_main prevents linking of the fortran main routine. loadptraj="$load -nofor_main" ;; ####################### Sun ############################ sparc|SunOS) xhome='/usr/openwin' fpp='/lib/cpp' fppflags="$fppflags" if [ -f /opt/SUNWspro/lib/libsunperf.so ]; then use_lapack=VENDOR_SUPPLIED use_blas=VENDOR_SUPPLIED loadlib="$loadlib -xlic_lib=sunperf" # Note that the Sun Performance Library has FFT routines. # Sun Performance Library User's Guide, # http://docs.sun.com/source/806-3566/index.html fi loadlib="$loadlib -lm" fflags='-O1' foptflags='-O2' if [ $big = "yes" ]; then #in fact f90 -xhelp=readme suggests that integer sizes cannot be controlled with compiler options. echo "big option is not implemented yet." fi if [ $verbose = "yes" ]; then echo "verbose option is not implemented yet." fi fflags="$fflags $bigness $verbosity" foptflags="$foptflags $bigness $verbosity" if [ $static = "yes" ]; then static_flag='-Bstatic' fi load="$fc $static_flag " loadcc="$cc $static_flag" cflags="$cflags -DSYSV " freeformat_flag='-free' loadptraj="$load" ;; *) echo "Architecture/compiler $arch is not supported (?)" 1>&2 usage ;; esac #------------------------------------------------------------------------------ # Finally, write out the config.h file: #------------------------------------------------------------------------------ cat < config.h #============================================================================== # AMBER Makefile configuration for compiler/architecture: $arch # Generated via command: $command # # Configuration script written mainly by Joe Krahn, Scott Brozell, and # Dave Case, with contributions from lots of people. #============================================================================== #------------------------------------------------------------------------------ # Main AMBER source root directory #------------------------------------------------------------------------------ AMBER_SRC=$amber_src #------------------------------------------------------------------------------ # AMBERBUILDFLAGS provides a hook into the build process for installers; # for example, to build debug versions of the amber programs # make -e AMBERBUILDFLAGS="-DDEBUG -g" #------------------------------------------------------------------------------ AMBERBUILDFLAGS= #------------------------------------------------------------------------------ # LOCALFLAGS is intended for program specific modifications to the # Fortran build process and may be modified by the program's local makefile #------------------------------------------------------------------------------ LOCALFLAGS=$localflags #------------------------------------------------------------------------------ # Availability and method of delivery of math and optional libraries #------------------------------------------------------------------------------ USE_BLASLIB=\$($use_blas) USE_LAPACKLIB=\$($use_lapack) USE_LMODLIB=\$($use_lmod) #------------------------------------------------------------------------------ # C compiler #------------------------------------------------------------------------------ CC= $cc CPLUSPLUS=$cplusplus ALTCC=$altcc CFLAGS=$cflags \$(AMBERBUILDFLAGS) ALTCFLAGS=$altcflags \$(AMBERBUILDFLAGS) CPPFLAGS=$cppflags \$(AMBERBUILDFLAGS) #------------------------------------------------------------------------------ # Fortran preprocessing and compiler. # FPPFLAGS holds the main Fortran options, such as whether MPI is used. #------------------------------------------------------------------------------ FPPFLAGS= $fppflags \$(AMBERBUILDFLAGS) FPP= $fpp \$(FPPFLAGS) FC= $fc FFLAGS= $fflags \$(LOCALFLAGS) \$(AMBERBUILDFLAGS) FOPTFLAGS= $foptflags \$(LOCALFLAGS) \$(AMBERBUILDFLAGS) FPP_PREFIX= $fpp_prefix FREEFORMAT_FLAG= $freeformat_flag #------------------------------------------------------------------------------ # Loader: #------------------------------------------------------------------------------ LOAD= $load \$(LOCALFLAGS) \$(AMBERBUILDFLAGS) LOADCC= $loadcc \$(LOCALFLAGS) \$(AMBERBUILDFLAGS) LOADLIB= $loadlib LOADPTRAJ= $loadptraj \$(LOCALFLAGS) \$(AMBERBUILDFLAGS) XHOME=$xhome XLIBS=$xlibs #------------------------------------------------------------------------------ # Other stuff: #------------------------------------------------------------------------------ .SUFFIXES: .f90 SYSDIR=$sysdir AR=$ar M4=$m4 RM=rm -f RANLIB=$ranlib SFX=$sfx MAKEDEPEND=\$(AMBER_SRC)/../bin/amber_makedepend # default rules for Fortran and C compilation: .f.o: \$< \$(FPP) \$< > \$(FPP_PREFIX)\$< \$(FC) -c \$(FFLAGS) -o \$@ \$(FPP_PREFIX)\$< .f90.o: $< \$(FPP) \$< > \$(FPP_PREFIX)\$< \$(FC) -c \$(FFLAGS) -o \$@ \$(FPP_PREFIX)\$< .c.o: \$(CC) -c \$(CFLAGS) \$(CPPFLAGS) -o \$@ \$< EOD echo " " echo "The configuration file, config.h, was successfully created." echo " " exit