#!/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, 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). -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. 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" ;; -*) 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' # Auxiliary programs: ar='ar rv ' ranlib=ranlib par_error () { cat <&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 #------------------------------------------------------------------------------ # Other stuff: #------------------------------------------------------------------------------ .SUFFIXES: .f90 SYSDIR=$sysdir AR=$ar M4=$m4 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