#!/bin/sh #set -xv command="$0 $*" # configure script for Amber and AmberTools: creates config.h #------------------------------------------------------------------------------ # set up usage statement: #------------------------------------------------------------------------------ usage(){ cat<&1 | awk '{print $1}'` case "$ld_version" in *GNU*) gnuld='yes';; *) gnuld='no' ;; esac #------------------------------------------------------------------------------- # windows settings #------------------------------------------------------------------------------- if [ $windows = 'yes' ]; then bintraj='no' echo "" echo "Only PMEMD serial and -mpi will be built natively under windows." echo "For a complete AMBER installation you should first compiled everything" echo "using cygwin." echo "" echo "Note: At present there is no bintraj and no cuda support under windows." echo "" fi #------------------------------------------------------------------------------ # Set up defaults that work for most machines: #------------------------------------------------------------------------------ workdir=`pwd` AMBERTOOLSHOME=`dirname $workdir` AMBERHOME=`dirname $AMBERTOOLSHOME` echo "Your AMBERHOME environment variable should be set to $AMBERHOME" echo " " if [ $macAccelerate = 'no' ]; then if [ -z "$MKL_HOME" ]; then mkl='no' if [ -z "$GOTO" ]; then gotolib='no' else gotolib='yes' echo "Using GotoBLAS2 routines in $GOTO" fi else mkl='yes' fppflags="$fppflags -DMKL" fi fi # Note: ambercflags and ambercxxflags should only be passed # to code written and/or maintained by the Amber developers cc=cc cflags= cnooptflags= coptflags=-O ambercflags= cplusplus=CC cxxflags= cxxnooptflags= cxxoptflags=-O ambercxxflags= pycflags= nabflags= free_format=-FR # C versions, if compiled from source: flibs="\$(LIBDIR)/arpack.a \$(LIBDIR)/lapack.a \$(LIBDIR)/blas.a " # Fortran versions, if compiled from source: flibsf="\$(LIBDIR)/arpack.a \$(LIBDIR)/lapack.a \$(LIBDIR)/blas.a " omp_flag= mpi_flag= lex=flex flibs_mkl= lapack=install blas=install f2c=skip ucpp=install cpp="\$(BINDIR)/ucpp -l" #----------------------------------- # skip building of sleap? #----------------------------------- if [ "$nosleap" = "true" ]; then build_sleap="skip_sleap" fi #----------------------------------- # skip building of xleap? #----------------------------------- if [ "$noX11" = "true" ]; then make_xleap="skip_xleap" fi if [ -d /usr/X11R6/lib ]; then xhome='/usr/X11R6' elif [ -f /usr/lib/libX11.a -o -f /usr/lib/libX11.so \ -o -f /usr/lib64/libX11.a -o -f /usr/lib64/libX11.so ]; then xhome='/usr' else echo "Could not find the X11 libraries; you may need to edit config.h" echo " to set the XHOME and XLIBS variables." fi xlibs="-L$xhome/lib" if [ "$x86_64" = 'yes' ]; then xlibs="-L$xhome/lib64 $xlibs" fi #-------------------------------------------------------------------------- # Check if the X11 library files for XLEaP are present: #-------------------------------------------------------------------------- if [ "$noX11" = "false" ]; then if [ -r "$xhome/lib/libXt.a" -o -r "$xhome/lib/libXt.dll.a" \ -o -r /usr/lib/libXt.so \ -o -r /usr/lib64/libXt.so \ -o -r /usr/X11/lib/libXt.dylib \ -o "$x86_64" = 'yes' -a -r "$xhome/lib64/libXt.a" ] then empty_statement= else echo "Warning: the X11 libraries are not in the usual location !" echo " To search for them try the command: locate libXt" echo " On new Fedora OS's install the libXt-devel libXext-devel" echo " libX11-devel libICE-devel libSM-devel packages." echo " On old Fedora OS's install the xorg-x11-devel package." echo " On RedHat OS's install the XFree86-devel package." echo " On Ubuntu OS's install the xorg-dev package." echo " For the moment Amber will be configured not to build XLEaP." make_xleap="skip_xleap" fi fi #------------------------------------------------------------------------------ # Filter out situations in which Python should not be built #------------------------------------------------------------------------------ if [ "$mpi" = 'yes' -o "$crayxt5" = 'yes' -o "$cuda" = 'yes' ]; then pyinstall='' fi if [ -x ../../bin/python ]; then echo "Using existing python from $AMBERHOME/bin" pyinstall='' fi #------------------------------------------------------------------------------ # Determine which type of installation we're doing #------------------------------------------------------------------------------ if [ "$cuda" = 'yes' -o "$cuda_SPSP" = 'yes' -o "$cuda_DPDP" = 'yes' ]; then if [ "$mpi" = 'yes' ]; then installtype='cuda_parallel' else installtype='cuda' fi elif [ "$mpi" = 'yes' ]; then installtype='parallel' else installtype='serial' fi #------------------------------------------------------------------------------ # Validate attempted parallel configure : #------------------------------------------------------------------------------ if [ "$mpi" = 'yes' ]; then if [ ! -x ../bin/yacc ]; then echo "Warning: you must configure and install the serial version of " echo " AmberTools before installing the parallel version." echo " (You may ignore this warning if all you wish to do is to" echo " install parallel Amber11; in that case, do this:" echo " cd ../../src; make clean; make install)" fi fi #------------------------------------------------------------------------------ # Check for cuda incompatibilities or missing files: #------------------------------------------------------------------------------ if [ "$cuda" = 'yes' -o "$cuda_SPSP" = 'yes' -o "$cuda_DPDP" = 'yes' ]; then if [ -z "$CUDA_HOME" ]; then echo "Error: CUDA_HOME is not set. This must point to your NVIDIA tools installation" exit 1 fi if [ ! "$compiler" = "gnu" -a ! "$compiler" = "intel" ]; then echo "Error: NVIDIA cuda compilation works only with gnu or Intel compilers" exit 1 fi if [ ! -x "$CUDA_HOME/bin/nvcc" ]; then echo "Error: nvcc cuda compiler not found in $CUDA_HOME/bin/" exit 1 fi #Check for mixing of cuda with cuda_SPSP or cuda_DPDP debugging options. #cuda = SPDP mixed precision (default) #cuda_SPSP = SPSP single precision only - except shake (debug option!) #cuda_DPDP = DPDP double precision only (debug option!) if [ "$cuda" = 'yes' ]; then if [ "$cuda_SPSP" = 'yes' -o "$cuda_DPDP" = 'yes' ]; then echo "Error: specification of -cuda, -cuda_SPSP and -cuda_DPDP are mutually exclusive" exit 1 fi fi if [ "$cuda_SPSP" = 'yes' ]; then if [ "$cuda" = 'yes' -o "$cuda_DPDP" = 'yes' ]; then echo "Error: specification of -cuda, -cuda_SPSP and -cuda_DPDP are mutually exclusive" exit 1 fi fi if [ "$cuda_DPDP" = 'yes' ]; then if [ "$cuda" = 'yes' -o "$cuda_SPSP" = 'yes' ]; then echo "Error: specification of -cuda, -cuda_SPSP and -cuda_DPDP are mutually exclusive" exit 1 fi fi fi #------------------------------------------------------------------------------ # Case statement identifying the architecture/compilers: #------------------------------------------------------------------------------ case "$compiler" in #################### gcc ####### gnu) if [ $windows = 'yes' ]; then echo "Error: gnu compilers are not supported with native Windows compilation." echo " use -cygwin instead or the Intel compilers." exit 1 else if [ "$mpi" = 'yes' ]; then ld=' mpif90 ' else ld=' gfortran ' fi fi flibs_arch=-lgfortran flibsf_arch= cc=gcc cflags= # ambercflags="-Wall" cplusplus=g++ cxxflags= # ambercxxflags="-Wall" fc=gfortran fflags= staticflag='-static' # If -noopt has been requested, force lack of optimisation; # otherwise, use the default levels. Since cflags, cxxflags # and fflags are used everywhere, and *optflags and # *nooptflags are not (some parts of Amber and AmberTools use # neither *optflags nor *nooptflags), we'll put -O0 in cflags # and so forth instead. if [ "$optimise" = 'no' ]; then cflags="$cflags -O0" cnooptflags="" coptflags="" cxxflags="$cxxflags -O0" cxxnooptflags="" cxxoptflags="" fflags="$fflags -O0" fnooptflags="" foptflags="" else cnooptflags= coptflags="-O3" cxxnooptflags= cxxoptflags="-O3" fnooptflags="-O0" foptflags="-O3" fi # Debugging options if [ "$debug" = 'yes' ]; then cflags="$cflags -g" cxxflags="$cxxflags -g" fflags="$fflags -g" fi echo "" echo "Obtaining the gnu suite version:" echo " $cc -v" gnu_version=`$cc -v 2>&1 | grep ' version ' | cut -d' ' -f3` echo "The version is $gnu_version" gnu_majorversion=`echo $gnu_version | cut -d'.' -f1` gnu_minorversion=`echo $gnu_version | cut -d'.' -f2` # Only use -mtune=generic if gcc suite >= 4.2 if [ $gnu_majorversion -ge 4 -a $gnu_minorversion -ge 2 ]; then if [ $sse = 'yes' ]; then if [ $x86_64 = 'yes' ]; then #-mfpmath=sse is default for x86_64, no need to specific it coptflags="$coptflags -mtune=generic" foptflags="$foptflags -mtune=generic" elif [ "$processor" = "ia64" ]; then echo "Using simplified compilers flags for ia64: check config.h" else # i386 needs to be told to use sse prior to using -mfpmath=sse coptflags="$coptflags -mtune=generic -msse -mfpmath=sse" foptflags="$foptflags -mtune=generic -msse -mfpmath=sse" fi fi fi if [ "$g95" = 'yes' ]; then fc="g95" fflags="$fflags -fno-second-underscore" fi if [ "$openmp" = 'yes' ]; then omp_flag="-fopenmp -DOPENMP" flibs_arch="$flibs_arch -fopenmp" flibsf_arch="$flibsf_arch -fopenmp" fi if [ "$noreduce" = 'yes' ]; then omp_flag="$omp_flag -DNOREDUCE" fi if [ "$nopar" = 'yes' ]; then omp_flag="$omp_flag -DNOPAR" fi if [ "$cygwin" = 'yes' ]; then cflags="$cflags -DCYGWIN" fppflags="$fppflags -DCYGWIN" suffix=".exe" lm="" fi freeformat_flag=-ffree-form #PMEMD Specifics pmemd_fpp_flags='-DDIRFRC_EFS -DDIRFRC_COMTRANS -DDIRFRC_NOVEC -DFFTLOADBAL_2PROC -DPUBFFT' pmemd_foptflags="$foptflags" pmemd_coptflags="$coptflags" #CUDA Specifics if [ "$cuda" = 'yes' -o "$cuda_SPSP" = 'yes' -o "$cuda_DPDP" = 'yes' ]; then pmemd_cu_includes='-I$(CUDA_HOME)/include -IB40C -IB40C/KernelCommon' pmemd_cu_defines='-DCUDA' pmemd_cu_libs='-L$(CUDA_HOME)/lib64 -L$(CUDA_HOME)/lib -lcufft -lcudart ./cuda/cuda.a' if [ "$optimise" = 'no' ]; then nvcc='$(CUDA_HOME)/bin/nvcc -use_fast_math -O0 -gencode arch=compute_13,code=sm_13 -gencode arch=compute_20,code=sm_20' else nvcc='$(CUDA_HOME)/bin/nvcc -use_fast_math -O3 -gencode arch=compute_13,code=sm_13 -gencode arch=compute_20,code=sm_20' fi if [ "$mpi" = 'yes' ]; then pmemd_cu_includes="$pmemd_cu_includes " pmemd_cu_defines="$pmemd_cu_defines -DMPI -DMPICH_IGNORE_CXX_SEEK" pmemd_coptflags="$coptflags -DMPICH_IGNORE_CXX_SEEK" fi fi if [ "$cuda_SPSP" = 'yes' ]; then pmemd_cu_defines="$pmemd_cu_defines -Duse_SPSP" fi if [ "$cuda_DPDP" = 'yes' ]; then pmemd_cu_defines="$pmemd_cu_defines -Duse_DPDP" fi ;; #################### icc ####### intel) if [ "$windows" = 'yes' ]; then cflags="$cflags -DWINDOWS" suffix=".exe" objsuffix=".obj" lm="" pmemd_fpp_flags=' /DDIRFRC_EFS /DDIRFRC_COMTRANS /DDIRFRC_NOVEC /DFFTLOADBAL_2PROC /DPUBFFT ' if [ "$optimise" = 'no' ]; then pmemd_foptflags=' /QxT /O0 /Qprec-div- /nologo /Fe ' else pmemd_foptflags=' /QxT /O3 /Qprec-div- /nologo /Fe ' fi pmemd_coptflags=' /nologo /DWINDOWS /DNO_RLIMIT_STACK_CTRL /DCLINK_CAPS ' fpp=fpp cc=cl fc=ifort ld=' xilink ' mpi_flag= fppflags=' /free ' ldflags=' /stack:1500000000 /nologo ' # space is important ldout=' /out:' localrm='del' localmv='move' localcp='copy' FLIBS='$(LIBDIR)/arpack.a $(LIBDIR)/lapack.a $(LIBDIR)/blas.a "C:\Program Files\Microsoft HPC Pack 2008 SDK\Lib\amd64\msmpi.lib" "C:\Program Files\Microsoft HPC Pack 2008 SDK\Lib\amd64\msmpifec.lib" "C:\Program Files\Microsoft HPC Pack 2008 SDK\Lib\amd64\msmpifmc.lib"' if [ "$mpi" = 'yes' ]; then win_mpilibs='"C:\Program Files\Microsoft HPC Pack 2008 SDK\Lib\amd64\msmpi.lib" "C:\Program Files\Microsoft HPC Pack 2008 SDK\Lib\amd64\msmpifec.lib" "C:\Program Files\Microsoft HPC Pack 2008 SDK\Lib\amd64\msmpifmc.lib" ' fi else # following appears to work on Intel compilers version 9,10,11; the # "-L$fl" part is not needed for version 11, but doesn't seem to hurt fl=`which ifort | sed -e 's@\(.*\)bin@\1lib@' -e 's@ifort@@'` flibs_arch="-L$fl -lifport -lifcore" flibsf_arch= cc=icc cflags= # ambercflags="-Wall" cplusplus=icpc cxxflags= # ambercxxflags="-Wall" fc=ifort fflags= freeformat_flag='-FR' staticflag='-static' # If -noopt has been requested, force lack of optimisation; # otherwise, use the default levels. Since cflags, cxxflags # and fflags are used everywhere, and *optflags and # *nooptflags are not (some parts of Amber and AmberTools use # neither *optflags nor *nooptflags), we'll put -O0 in cflags # and so forth instead. if [ "$optimise" = 'no' ]; then cflags="$cflags -O0" cnooptflags="" coptflags="" cxxflags="$cxxflags -O0" cxxnooptflags="" cxxoptflags="" fflags="$fflags -O0" fnooptflags="" foptflags="" else cnooptflags= coptflags="-O3" cxxnooptflags= cxxoptflags="-O3" fnooptflags="-O0" foptflags="-ip -O3" fi # Debugging options if [ "$debug" = 'yes' ]; then cflags="$cflags -debug all" cxxflags="$cxxflags -debug all" fflags="$fflags -debug all" fi # Test Intel compiler versions for optimisation flags. Note that the # output of "icc -v" goes onto STDERR. # C compiler version icc_version=`$cc -v 2>&1` icc_version=`echo $icc_version | sed -e 's/\..*//g' | sed -e 's/^Version //'` # Test Intel compiler versions for optimisation flags. Note that the # output of "ifort -v" goes onto STDERR. ifort_version=`$fc -v 2>&1` ifort_version=`echo $ifort_version | sed -e 's/\..*//g' | sed -e 's/^Version //'` # DRR - Add flags necessary for correct compilation with intel version >= 11 if [ "$icc_version" -ge 11 ] ; then cxxflags="-std=c++0x $cxxflags" ambercxxflags="-std=c++0x $ambercxxflags" ldflags="-shared-intel " fi # Add optimisations for current machine type # Modified by MBJ if [ "$processor" != "ia64" ]; then if [ "$icc_version" -ge 11 ] ; then coptflags="$coptflags -xHost" fi if [ "$ifort_version" -ge 11 ] ; then foptflags="$foptflags -xHost" fi fi if [ "$openmp" = 'yes' ]; then omp_flag="-openmp -DOPENMP" if [ "$ifort_version" -lt 11 ] ; then flibs_arch="$flibs_arch -openmp" flibsf_arch="$flibsf_arch -openmp" fi fi if [ "$noreduce" = 'yes' ]; then omp_flag="$omp_flag -DNOREDUCE" fi if [ "$nopar" = 'yes' ]; then omp_flag="$omp_flag -DNOPAR" fi if [ "$sse" = 'yes' ]; then # Preface $coptflags with -ip coptflags="-ip $coptflags" # Within coptflags, use -O3, unless optimisations have been # disabled using -noopt if [ "$optimise" = 'yes' ]; then coptflags=`echo $coptflags | sed -e 's/ -O[012] / -O3 /g'` fi # For both coptflags and foptflags, use the appropriate settings # for the sse flags (compiler version dependent). if [ "$icc_version" -ge 11 ] ; then if [ -n "$SSE_TYPES" ] ; then coptflags="$coptflags -ax$SSE_TYPES" fi else coptflags="$coptflags -axSTPW" fi if [ "$ifort_version" -ge 11 ] ; then if [ -n "$SSE_TYPES" ] ; then foptflags="$foptflags -ax$SSE_TYPES" fi else foptflags="$foptflags -axSTPW" fi if [ "$processor" != "ia64" ]; then flibs_arch="$flibs_arch -lsvml" flibsf_arch="$flibsf_arch -lsvml" fi fi if [ "$altix" = 'yes' ]; then cpp="/usr/bin/cpp -P " ucpp=skip cc=icc # Use aggressive optimisation, unless optimisations have # been disabled using -noopt if [ "$optimise" = 'yes' ]; then coptflags="-O3" fi flibs_arch="$flibs_arch -lguide -lpthread -ldl" fi if [ "$mpi" = 'yes' ]; then ld=' mpif90 ' else ld=' ifort ' fi #PMEMD Specifics pmemd_fpp_flags='-DDIRFRC_EFS -DDIRFRC_COMTRANS -DDIRFRC_NOVEC -DFFTLOADBAL_2PROC -DPUBFFT' if [ "$optimise" = 'no' ]; then pmemd_coptflags='-O0' pmemd_foptflags='-O0' else # RCW Removed 10/5/2010 - Causes issues building in parallel since -fast always implies -static. #pmemd_foptflags='-fast' #pmemd_coptflags='-fast' # BPR: Note: -fast implies the use of these flags: # # Intel 11 # -------- # Mac: -ipo -O3 -mdynamic-no-pic -no-prec-div -static -xHost # IA-64 Linux: -ipo -O3 -static # IA-32/Intel-64 Linux: -ipo -O3 -no-prec-div -static -xHost # # Intel 10 # -------- # Mac: -ipo -O3 -mdynamic-no-pic -no-prec-div -static -xP (ifort), # -ipo -O3 -mdynamic-no-pic -no-prec-div (icc) # IA-64 Linux: -ipo -O3 -static # IA-32/Intel-64 Linux: -ipo -O3 -no-prec-div -static -xP if [ "$is_mac" = 'yes' ]; then if [ "$icc_version" -ge 11 ]; then pmemd_coptflags='-ipo -O3 -mdynamic-no-pic -no-prec-div -xHost' else pmemd_coptflags='-ipo -O3 -mdynamic-no-pic -no-prec-div' fi if [ "$ifort_version" -ge 11 ]; then pmemd_foptflags='-ipo -O3 -mdynamic-no-pic -no-prec-div -xHost' else pmemd_foptflags='-ipo -O3 -mdynamic-no-pic -no-prec-div -xP' fi elif [ "$processor" = "ia64" ]; then pmemd_coptflags='-ipo -O3' pmemd_foptflags='-ipo -O3' else if [ "$icc_version" -ge 11 ]; then pmemd_coptflags='-ipo -O3 -no-prec-div -xHost' else pmemd_coptflags='-ipo -O3 -no-prec-div -xP' fi if [ "$ifort_version" -ge 11 ]; then pmemd_foptflags='-ipo -O3 -no-prec-div -xHost' else pmemd_foptflags='-ipo -O3 -no-prec-div -xP' fi fi fi #CUDA Specifics if [ "$cuda" = 'yes' -o "$cuda_SPSP" = 'yes' -o "$cuda_DPDP" = 'yes' ]; then # -ipo (multi-file Interprocedural Optimizations optimizations) causes issues with # CUDA c code linking. Leave at a single-file IPO for the moment MJW pmemd_coptflags=`echo $pmemd_coptflags | sed -e 's/ipo/ip/g'` pmemd_foptflags=`echo $pmemd_foptflags | sed -e 's/ipo/ip/g'` pmemd_cu_includes='-I$(CUDA_HOME)/include -IB40C -IB40C/KernelCommon' pmemd_cu_defines='-DCUDA' pmemd_cu_libs='-L$(CUDA_HOME)/lib64 -L$(CUDA_HOME)/lib -lcufft -lcudart ./cuda/cuda.a' if [ "$optimise" = 'yes' ]; then nvcc='$(CUDA_HOME)/bin/nvcc -use_fast_math -O3 -gencode arch=compute_13,code=sm_13 -gencode arch=compute_20,code=sm_20' else nvcc='$(CUDA_HOME)/bin/nvcc -use_fast_math -O0 -gencode arch=compute_13,code=sm_13 -gencode arch=compute_20,code=sm_20' fi if [ "$mpi" = 'yes' ]; then pmemd_cu_includes="$pmemd_cu_includes " pmemd_cu_defines="$pmemd_cu_defines -DMPI -DMPICH_IGNORE_CXX_SEEK" pmemd_coptflags="$pmemd_coptflags -DMPICH_IGNORE_CXX_SEEK" fi fi if [ "$cuda_SPSP" = 'yes' ]; then pmemd_cu_defines="$pmemd_cu_defines -Duse_SPSP" fi if [ "$cuda_DPDP" = 'yes' ]; then pmemd_cu_defines="$pmemd_cu_defines -Duse_DPDP" fi fi ;; #################### Portland group ####### pgi) if [ $windows = 'yes' ]; then echo "Error: pgi compilers are not supported with native Windows compilation." echo " use -cygwin instead or the Intel compilers." exit 1 else if [ "$mpi" = 'yes' ]; then ld=' mpif90 ' else ld=' pgf90 ' fi fi flibs_arch="-pgf90libs" flibsf_arch= cc=pgcc cflags= cplusplus=pgCC cxxflags= fc=pgf90 fflags= freeformat_flag='-Mfree' staticflag='-Bstatic' # If -noopt has been requested, force lack of optimisation; # otherwise, use the default levels. Since cflags, cxxflags # and fflags are used everywhere, and *optflags and # *nooptflags are not (some parts of Amber and AmberTools use # neither *optflags nor *nooptflags), we'll put -O0 in cflags # and so forth instead. if [ $optimise = 'no' ]; then cflags="$cflags -O0" cnooptflags="" coptflags="" cxxflags="$cxxflags -O0" cxxnooptflags="" cxxoptflags="" fflags="$fflags -O0" fnooptflags="" foptflags="" else cnooptflags= coptflags="-O2" cxxnooptflags= cxxoptflags="-O2" fnooptflags="-O1" foptflags="-fast -O3" fi # Debugging options if [ "$debug" = 'yes' ]; then #cflags="$cflags -g" #cxxflags="$cxxflags -g" #fflags="$fflags -g" echo "Debug option not yet implemented for PGI compilers." fi if [ "$openmp" = 'yes' ]; then echo "Warning: OpenMP is not available for pgi." # omp_flag="-mp -DOPENMP" # flibs_arch="$flibs_arch -mp" fi if [ "$noreduce" = 'yes' ]; then echo "Warning: OpenMP is not available for pgi." # omp_flag="$omp_flag -DNOREDUCE" fi if [ "$nopar" = 'yes' ]; then echo "Warning: OpenMP is not available for pgi." # omp_flag="$omp_flag -DNOPAR" fi if [ "$sse" = 'yes' ]; then foptflags="$foptflags -fastsse" fi if [ "$cuda" = "yes" -o "$cuda_SPSP" = "yes" -o "$cuda_DPDP" = "yes" ]; then echo "Error: cuda is not available for pgi." exit 1 fi #PMEMD Specifics pmemd_fpp_flags='-DDIRFRC_EFS -DDIRFRC_COMTRANS -DDIRFRC_NOVEC -DFFTLOADBAL_2PROC -DPUBFFT' pmemd_foptflags=$foptflags pmemd_coptflags=$coptflags ;; #################### solaris ####### solaris) if [ $windows = 'yes' ]; then echo "Error: solaris compilers are not supported with native Windows compilation." echo " use -cygwin instead or the Intel compilers." exit 1 else if [ "$mpi" = 'yes' ]; then ld=' mpif90 ' else ld=' f90 ' fi fi lex=lex cc="cc" cflags="-fast -DSYSV" coptflags="-DSUN" fc="f90" fflags="-fast" # If -noopt has been requested, force lack of optimisation; # otherwise, use the default levels. Since cflags, cxxflags # and fflags are used everywhere, and *optflags and # *nooptflags are not (some parts of Amber and AmberTools use # neither *optflags nor *nooptflags), we'll put -O0 in cflags # and so forth instead. if [ $optimise = 'no' ]; then #cflags="$cflags ?" #cnooptflags=? #coptflags=? #cxxflags="$cxxflags ?" #cxxnooptflags=? #cxxoptflags=? #fflags="$fflags ?" #fnooptflags=? #foptflags=? echo "Error: don't know how to disable optimisations for Solaris compilers!" exit 1 #else #cnooptflags= #coptflags="-O2" #cxxnooptflags= #cxxoptflags="-O2" #fnooptflags="-O1" #foptflags="-fast -O3" fi # Debugging options if [ "$debug" = 'yes' ]; then #cflags="$cflags -g" #cxxflags="$cxxflags -g" #fflags="$fflags -g" echo "Debug option not yet implemented for Solaris compilers." fi # solaris 5.9 required -lfsu -lfui -lfai but solaris 5.10 does not. flibs_arch="-lsunmath -lm" # safest optimization level for x86 is -xO3 if [ "$opteron" = 'yes' ]; then cflags="$cflags -xtarget=opteron" fflags="$fflags -xtarget=opteron" fi if [ "$bit64" = 'yes' ]; then # BPR (Sep 2010): $cc is ok (if redundant), but I think # $f90 is still the empty string! #cc="$cc" #fc="$f90" cflags="$cflags -m64" fflags="$fflags -m64" fi if [ "$perflib" = 'yes' ]; then flibs_arch="-xlic_lib=sunperf" lapack=skip blas=skip fi if [ "$openmp" = 'yes' ]; then omp_flag="-xopenmp=parallel -xautopar -xreduction -DOPENMP" flibs_arch="$flibs_arch -lmtmalloc" fi if [ "$noreduce" = 'yes' ]; then omp_flag="$omp_flag -DNOREDUCE" fi if [ "$logreduce" = 'yes' ]; then omp_flag="$omp_flag -DLOGARITHMIC_REDUCTION" fi if [ "$nopar" = 'yes' ]; then omp_flag="$omp_flag -DNOPAR" fi if [ "$mpi" = 'yes' ]; then cc="mpi$cc" fc="mpi$fc" mpi_flag="-DMPI" flibs_arch="$flibs_arch -lmpi" fi if [ "$scali" = 'yes' ]; then cc="$SCALIHOME/bin/mpicc -ccl cc -fast -m64" fc="$SCALIHOME/bin/mpif90 -ccl f90 -fast -m64" flibs_arch="$flibs_arch -L/$SCALIHOME/lib/64 -lfmpi -lmpi" mpi_flag="-DMPI" fi if [ "$scalapack" = 'yes' ]; then cc="mpi$cc" fc="mpi$fc" mpi_flag="-DSCALAPACK" # The names of these archives are determined by PLAT and BLACSDBGLVL, # which are defined in Bmake.inc and SLmake.inc flibs_arch="$flibs_arch $SCALAPACKHOME/scalapack_SUN64.a $BLACSHOME/blacsF77init_MPI-SUN64-0.a $BLACSHOME/blacs_MPI-SUN64-0.a $BLACSHOME/blacsCinit_MPI-SUN64-0.a -lmpi" fi if [ "$cuda" = 'yes' -o "$cuda_SPSP" = 'yes' -o "$cuda_DPDP" = 'yes' ]; then echo "Error: cuda is not available for solaris." exit 1 fi #PMEMD Specifics pmemd_fpp_flags='-DDIRFRC_EFS -DDIRFRC_COMTRANS -DDIRFRC_NOVEC -DFFTLOADBAL_2PROC -DPUBFFT' pmemd_foptflags=$foptflags pmemd_coptflags=$coptflags ;; #################### unknown choice ####### *) echo "Error: Architecture/compiler $compiler is not supported!" echo " Type './configure -help' for options." exit 1 ;; esac # If -crayxt5 was specified, switch to cc, CC, and ftn compiler wrappersA # also disable mdgx because it does not currently play nice with crays and the PGI compilers if [ "$crayxt5" = 'yes' ]; then mdgx='no' cc="cc" cplusplus="CC" fc="ftn" ld="ftn" fi #-------------------------------------------------------------------------- # Configure the MKL and GOTO libraries: #-------------------------------------------------------------------------- if [ "$mkl" = 'yes' ]; then lapack=skip blas=skip flibs="\$(LIBDIR)/arpack.a " flibsf="\$(LIBDIR)/arpack.a " mkll="$MKL_HOME/lib/32" mkl_processor="32" mkl_procstring="ia32" mklinterfacelayer='libmkl_intel.a' if [ "$x86_64" = 'yes' ]; then mkll="$MKL_HOME/lib/em64t" mkl_processor="em64t" mkl_procstring="em64t" # lp64 is 32 bit integers on 64 bit platforms mklinterfacelayer='libmkl_intel_lp64.a' fi if [ "$processor" = "ia64" ]; then mkll="$MKL_HOME/lib/64" mkl_processor="64" mkl_procstring="ia64" mklinterfacelayer='libmkl_intel_lp64.a' fi echo "Using Intel MKL libraries in $mkll" if [ "$oldmkl" = 'yes' ]; then echo "MKL Version 9.x or earlier assumed." # Always link static version of MKL - just easier from an end # user perspective. flibs_mkl="$mkll/libmkl_lapack.a $mkll/libmkl_ia32.a -L$mkll -lguide -lpthread" elif [ "$gnuld" = 'yes' ]; then echo "MKL Version 10 or 11 assumed." # We always link to the sequential version of MKL since typically # one runs an MPI thread for each core. However, if openmp is # specified, for example to turn on SMP diagonalizers for QMMM # then we link to the threaded version of MKL and inside the code # the number of threads for vector functions etc will be set to # 1. Always link static version of MKL - just easier from an end # user perspective. # changed by MBJ if [ "$openmp" = 'yes' ]; then flibs_mkl="-Wl,--start-group $mkll/$mklinterfacelayer $mkll/libmkl_intel_thread.a $mkll/libmkl_core.a $fl/libiomp5.a -Wl,--end-group -lpthread" else flibs_mkl="-Wl,--start-group $mkll/$mklinterfacelayer $mkll/libmkl_sequential.a $mkll/libmkl_core.a -Wl,--end-group -lpthread" fi else echo "Non-GNU linker assumed." if [ "$openmp" = 'yes' ]; then flibs_mkl="-L$mkll $mkll/$mklinterfacelayer $mkll/libmkl_intel_thread.a $mkll/libmkl_core.a $fl/libiomp5.a -lpthread" else flibs_mkl="-L$mkll $mkll/$mklinterfacelayer $mkll/libmkl_sequential.a $mkll/libmkl_core.a -lpthread" fi fi fi if [ "$gotolib" = 'yes' ]; then lapack=skip blas=skip flibs="\$(LIBDIR)/arpack.a $GOTO -lpthread" flibsf="\$(LIBDIR)/arpack.a $GOTO -lpthread" elif [ "$macAccelerate" = 'yes' ] ; then lapack=skip blas=skip flibs="\$(LIBDIR)/arpack.a " flibsf="\$(LIBDIR)/arpack.a " flibs_arch="$flibs_arch -framework Accelerate" flibsf_arch="$flibsf_arch -framework Accelerate" fi #-------------------------------------------------------------------------- # Support platforms without a C by building c9x-complex. #-------------------------------------------------------------------------- if [ -r /usr/include/complex.h ]; then c9xcomplex='skip' elif [ "$cygwin" = 'yes' ]; then c9xcomplex='skip' else c9xcomplex='libmc.a' cflags="$cflags -DUSE_AMBER_C9XCOMPLEX" pmemd_coptflags="$pmemd_coptflags -DUSE_AMBER_C9XCOMPLEX" flibs_arch="$flibs_arch \$(LIBDIR)/libmc.a" fi #-------------------------------------------------------------------------- # Support platforms without but with # usually a non-Linux Unix with a non-native compiler. #-------------------------------------------------------------------------- if [ ! -r /usr/include/sys/dir.h -a -r /usr/include/dirent.h ]; then if [ "$cygwin" != 'yes' ]; then cflags="$cflags -DSYSV" pmemd_coptflags="$pmemd_coptflags -DSYSV" fi fi #-------------------------------------------------------------------------- # Check for large file support: #-------------------------------------------------------------------------- if [ "$lfs" = 'yes' ]; then cflags="$cflags -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE" pmemd_coptflags="$pmemd_coptflags -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE" fi #-------------------------------------------------------------------------- # Test various compilers, linking, MPI etc. #-------------------------------------------------------------------------- if [ $windows = 'yes' ]; then # skip test section echo "Windows: Skipping all *nix tests" else #-------------------------------------------------------------------------- # Test if the C compiler works: #-------------------------------------------------------------------------- cat <testp.c #include int main() { printf( "testing a C program\n" ); } EOF echo "" echo "Testing the $cc compiler:" echo " $cc $cflags $cnooptflags -o testp$suffix testp.c" $cc $cflags $cnooptflags -o testp$suffix testp.c ./testp | grep "testing a C program" > /dev/null status=$? if [ $status -gt 0 ]; then echo "Error: Unable to compile a C program using $cc $cflags $cnooptflags" echo " Please check your compiler settings or configure flags." exit 1 fi echo "OK" /bin/rm -f testp.c testp$objsuffix testp$suffix #-------------------------------------------------------------------------- # Check if the C++ compiler is recent enough for sleap: #-------------------------------------------------------------------------- if [ "$nosleap" = "false" ]; then if [ "$cplusplus" = 'g++' ] then echo "" echo "Validating the C++ compiler version:" echo " $cplusplus -v" version=`$cplusplus -v 2>&1 | grep ' version ' | cut -d' ' -f3` echo "The version is $version" majorversion=`echo $version | cut -d'.' -f1` minorversion=`echo $version | cut -d'.' -f2` # The oldest version known to build sleap is 3.2.3. # But leave the threshold at 3.1 since we expect that to work. if [ "$version" = "" -o \ "$majorversion" -lt 3 -o \ "$majorversion" -eq 3 -a "$minorversion" -lt 1 ]; then echo "Warning: the C++ compiler is not found or is too old!" echo "For the moment Amber will be configured not to build sleap." build_sleap="skip_sleap" else echo "OK" fi fi fi #-------------------------------------------------------------------------- # Test if the Fortran compiler works: #-------------------------------------------------------------------------- cat <testp.f program testf write(6,*) 'testing a Fortran program' end program testf EOF echo "" echo "Testing the $fc compiler:" echo " $fc $fflags $fnooptflags -o testp$suffix testp.f" $fc $fflags $fnooptflags -o testp testp.f ./testp | grep "testing a Fortran program" > /dev/null status=$? if [ $status -gt 0 ]; then echo "Error: Unable to compile a Fortran program using $fc $fflags $fnooptflags" echo " Please check your compiler settings and configure flags." exit 1 else hasfc='yes' echo "OK" fi /bin/rm -f testp.f testp$objsuffix testp$suffix #-------------------------------------------------------------------------- # Test mixed C/Fortran compilation. #-------------------------------------------------------------------------- cat > testp.c < extern void hello_(); int main(int argc, char *argv) { printf("Hello from c.\n"); hello_(); return 0; } EOF cat > testp.f < /dev/null status=$? if [ $status -gt 0 ]; then echo "Error: Unable to compile mixed C/Fortran code." echo " Please check your compiler settings and configure flags." exit 1 else echo "OK" fi /bin/rm -f testp.c testp.f testp.c$objsuffix testp.f$objsuffix testp$suffix #-------------------------------------------------------------------------- # Determine if machine is 32 bit or 64 bit # # We have the x86_64 flag which tries to detect this based on uname but # this will not catch everything. Especially if someone is using a 32 bit # compatibility compiler on a x86_64 machine. #-------------------------------------------------------------------------- cat > test_pointer_size.c < int main() { printf ("%d\n", (int )sizeof(void*)); return 0; } EOF echo "" echo "Testing pointer size:" echo " $cc $cflags $cnooptflags -o test_pointer_size$suffix test_pointer_size.c" $cc $cflags $cnooptflags -o test_pointer_size$suffix test_pointer_size.c ./test_pointer_size$suffix | grep "4" > /dev/null status=$? if [ $status = 0 ]; then #Align doubles on 32 bit machines. Needed for cuda to work on 32 bit machine. echo "Detected 32 bit operating system." pmemd_coptflags="$pmemd_coptflags -malign-double" else echo "Detected 64 bit operating system." fi /bin/rm -f test_pointer_size.c test_pointer_size$suffix #-------------------------------------------------------------------------- # Test if lex/flex is available and works #-------------------------------------------------------------------------- echo "" printf "Testing $lex:" cat <testp.l %{ %} %% ddm[=\ ][^\ \n\t,]+ { ECHO; ddm = 1;} %% EOF $lex -t testp.l | grep ddm > /dev/null status=$? if [ $status -gt 0 ]; then echo "" echo "Warning: Unable to run $lex; this is recommended for NAB" echo "Please check your PATH, or install the program" echo "" if [ "$lex" = "flex" ]; then echo "We will try to solider on with precompiled files" echo "" cd nab/lexc; cp lex.dg_options.c lex.yy.c ..; cp lex.mm_options.c ../../sff; cd ../.. else exit 1 fi else echo " OK" fi /bin/rm -f testp.l #------------------------------------------------------------------------------ # Set up the static flags: #------------------------------------------------------------------------------ if [ "$static" = 'yes' ]; then flibs="$flibs $staticflag" ldflags="$staticflag" fi #-------------------------------------------------------------------------- # Configure NetCDF #-------------------------------------------------------------------------- if [ "$bintraj" = 'yes' ]; then #Parallel NetCDF? if [ "$mpi" = 'yes' ]; then echo echo "Configuring Parallel NetCDF (may be time-consuming)..." echo cd pnetcdf netcdfflag="--prefix=$AMBERTOOLSHOME --disable-cxx --disable-fortran" if [ "$crayxt5" = 'yes' ]; then pnetcc="cc" else pnetcc="mpicc" fi case "$compiler" in pgi*) env CPPFLAGS="-DNDEBUG -DpgiFortran" \ CC="$pnetcc" CFLAGS="$cflags $cnooptflags" \ LDFLAGS="$ldflags" \ ./configure $netcdfflag > ../pnetcdf_config.log 2>&1 ;; *) env CPPFLAGS="-DNDEBUG" \ CC="$pnetcc" CFLAGS="$cflags $cnooptflags" \ LDFLAGS="$ldflags" \ ./configure $netcdfflag > ../pnetcdf_config.log 2>&1 ;; esac ncerror=$? if [ $ncerror -gt 0 ]; then echo " Error: parallel NetCDF configure returned $ncerror" echo " Parallel NetCDF configure failed! Check the pnetcdf/config.log file." echo " Continuing anyway, but parallel NetCDF will be skipped." pnetcdf='no' pnetcdflib='' else echo " Parallel NetCDF configure succeeded." pnetcdf='yes' pnetcdflib='$(LIBDIR)/libpnetcdf.a' fi cd ../ else pnetcdf='no' pnetcdflib='' fi echo echo "Configuring NetCDF (may be time-consuming)..." echo cd netcdf/src netcdfflag="--prefix=$AMBERTOOLSHOME --disable-cxx" case "$compiler" in pgi*) ./configure \ FC="$fc" F90="$fc" \ FFLAGS="$ldflags $foptflags" FCFLAGS="$ldflags $foptflags" \ F90FLAGS="$ldflags $foptflags" \ CPPFLAGS="-DNDEBUG -DpgiFortran" \ CC="$cc" CFLAGS="$cflags $cnooptflags" \ CXX="$cplusplus" CXXFLAGS="$cxxflags $cxxnooptflags" \ LDFLAGS="$ldflags" \ $netcdfflag > ../../netcdf_config.log 2>&1 ;; *) ./configure \ FC="$fc" F90="$fc" \ FFLAGS="$ldflags $foptflags" FCFLAGS="$ldflags $foptflags" \ F90FLAGS="$ldflags $foptflags" \ CPPFLAGS="-DNDEBUG" \ CC="$cc" CFLAGS="$cflags $cnooptflags" \ CXX="$cplusplus" CXXFLAGS="$cxxflags $cxxnooptflags" \ LDFLAGS="$ldflags" \ $netcdfflag > ../../netcdf_config.log 2>&1 ;; esac ncerror=$? if [ $ncerror -gt 0 ]; then echo " Error: NetCDF configure returned $ncerror" echo " NetCDF configure failed! Check the netcdf_config.log file." echo " Continuing anyway, but NetCDF will be skipped." netcdf='' netcdflib='' else echo " NetCDF configure succeeded." netcdf='netcdf.mod' netcdflib='$(LIBDIR)/libnetcdf.a' cflags="$cflags -DBINTRAJ" coptflags="$coptflags -DBINTRAJ" pmemd_coptflags="$pmemd_coptflags -DBINTRAJ" fppflags="$fppflags -DBINTRAJ" fi cd ../.. else pnetcdf='no' pnetcdflib='' netcdf='' netcdflib='' fi #-------------------------------------------------------------------------- # Check for Zlib and Bzlib (currently only cpptraj) #-------------------------------------------------------------------------- # Zlib cat >testp.c < #include "zlib.h" int main() { gzFile fp; printf( "testing a C program\n" ); } EOF echo "" # The builtin echo in Mac OS X's sh doesn't support -n, so # "-n Checking for zlib: " is printed there. # Trying printf instead. printf "Checking for zlib: " #echo " $cc $cflags -o testp$suffix testp.c" $cc $cflags -o testp$suffix testp.c ./testp | grep "testing a C program" > /dev/null status=$? if [ $status -gt 0 ]; then echo "Not found." #echo " Please check your compiler settings and configure flags." zlib='' else echo "OK" zlib='-lz' coptflags="$coptflags -DHASGZ" fi /bin/rm -f testp.c testp$objsuffix testp$suffix # Bzlib cat >testp.c < #include "bzlib.h" int main() { BZFILE *infile; printf( "testing a C program\n" ); } EOF echo "" # The builtin echo in Mac OS X's sh doesn't support -n, so # "-n Checking for libbz2: " is printed there. # Trying printf instead. printf "Checking for libbz2: " #echo " $cc $cflags -o testp$suffix testp.c" $cc $cflags -o testp$suffix testp.c ./testp | grep "testing a C program" > /dev/null status=$? if [ $status -gt 0 ]; then echo "Not found." #echo " Please check your compiler settings and configure flags." bzlib='' else echo "OK" bzlib='-lbz2' coptflags="$coptflags -DHASBZ2" fi /bin/rm -f testp.c testp$objsuffix testp$suffix #-------------------------------------------------------------------------- # Configure fftw-3.2.2: #-------------------------------------------------------------------------- if [ "$mdgx" = 'yes' ]; then mdgxflag="--prefix=$AMBERHOME --disable-fortran" echo echo "Configuring fftw-3.2.2 (may be time-consuming)..." echo cd fftw-3.2.2 && \ env CC="$cc" CFLAGS="$cflags $cnooptflags" \ ./configure $mdgxflag > ../fftw3_config.log 2>&1 ncerror=$? if [ $ncerror -gt 0 ]; then echo " Error: FFTW configure returned $ncerror" echo " FFTW configure failed! Check the fftw3_config.log file." exit 1 else echo " fftw-3.2.2 configure succeeded." fi cd .. fi #-------------------------------------------------------------------------- # Configure python #-------------------------------------------------------------------------- if [ "$pyinstall" = 'python' ]; then echo "" echo "Configuring Python-2.6.6 (may be time-consuming)..." echo "" cd etc if [ ! -f Python-2.6.6.tar.bz2 ]; then echo "Error: Could not find Python-2.6.6.tar.bz2 in etc/." exit 1 else tar -jxf Python-2.6.6.tar.bz2 fi # For apple, we have to build Python as a framework, so we have to do special things. NOT # patching the files per MacPorts' procedure seems to work on Snow Leopard, so they will # be omitted since they simply restrict functionality. However, the xcode GCC must be used, # since it doesn't appear that MP gcc supports the -framework... This isn't a big deal, # though, since only Macs need this, and every Mac should have the xcode compiler installed. # For SL, this is /usr/bin/gcc-4.2. Don't rely on /usr/bin/gcc since that's just a symlink cd Python-2.6.6 if [ "$is_mac" = "yes" ]; then # configure with the proper arguments and compilers if [ "${osx_version:0:4}" = "10.5" -o "${osx_version:0:4}" = "10.4" ]; then echo " Patching Python 2.6.6 to work with Mac OS X ${osx_version}" echo "" tar zxf ../osx_pypatch.tgz for i in *.diff; do sed -e "s|@@PREFIX@@|${AMBERHOME}|g" -e "s|@@APPLICATIONS_DIR@@|${AMBERHOME}|g" $i | patch -p0 -N > ../../python_2.6_config.log done fi ./configure CC=/usr/bin/gcc-4.2 --enable-framework=$AMBERHOME --prefix=$AMBERHOME --enable-ipv6 > ../../python2.6_config.log 2>&1 else # regular unices # set environment and configure if [ "$compiler" = "pgi" ]; then env CC="$cc" CXX="$cplusplus" CFLAGS="$pycflags" ./configure --prefix=$AMBERHOME LINKFORSHARED="-Wl,--export-dynamic" > ../../python2.6_config.log 2>&1 else env CC="$cc" CXX="$cplusplus" CFLAGS="$pycflags" ./configure --prefix=$AMBERHOME > ../../python2.6_config.log 2>&1 fi fi pyerror=$? if [ $pyerror -gt 0 ]; then echo " Error: Python configure returned $pyerror" echo " Check python2.6_config.log." exit 1 else echo " Python 2.6.6 configure succeeded." fi cd ../.. fi #-------------------------------------------------------------------------- # Set up MPI 3D-RISM in NAB and SANDER #-------------------------------------------------------------------------- if [ "$mpi" = 'yes' ]; then sander_rism_mpi='sander.RISM.MPI$(SFX)' if [ "$cygwin" = 'no' ]; then rism='yes' if [ "$rismmpi" = 'yes' ]; then if [ -z $XTRA_FLIBS ]; then echo echo "Error: Compiling 3D-RISM support in MPI NAB requires setting" echo "XTRA_FLIBS to the name of the Fortran MPI libraries for" echo "your MPI distribution. For example:" echo " OpenMPI: export XTRA_FLIBS=-lmpi_f77" echo " MPICH2 : export XTRA_FLIBS=-lfmpich" exit 1 fi rismsff="-DRISMSFF" nablibrism="-lrism_mpi" testrism="rism" else rismsff="" nablibrism="" testrism="" rism='no' fi nablibsff="-lsff_mpi" else sander_rism_mpi="" rism='no' fi else rismsff="-DRISMSFF" nablibrism="-lrism" nablibsff="-lsff" testrism="rism" rism='yes' if [ -n "$XTRA_FLIBS" ]; then echo echo "Error: please unset XTRA_FLIBS for serial compilation." echo "For example:" echo " export -n XTRA_FLIBS=" exit 1 fi fi #-------------------------------------------------------------------------- # Configure fftw-2.1.5: #-------------------------------------------------------------------------- if [ "$rism" = 'yes' ]; then # if [ "$mkl" = 'yes' -a "$mpi" = 'no' -a "$compiler" = 'intel' -a "$oldmkl" = 'no' ] ; then if [ '1' = '0' ]; then echo echo "Using MKL wrappers for fftw-2.1.5;" echo flibs_fftw2="-lfftw2xf_$compiler" else rismflag="--prefix=$AMBERHOME --enable-type-prefix --enable-static=yes" echo echo "Configuring fftw-2.1.5 (may be time-consuming)..." echo cd fftw-2.1.5 if [ "$mpi" = 'yes' ]; then ./configure $rismflag --enable-mpi \ CC="$cc" CFLAGS="$cflags $coptflags" \ F77="$fc" FFLAGS="$fflags $foptflags" \ FLIBS="$flibs_arch" > ../fftw2_config.log 2>&1 else ./configure $rismflag \ CC="$cc" CFLAGS="$cflags $coptflags" \ F77="$fc" FFLAGS="$fflags $foptflags" \ FLIBS="$flibs_arch" > ../fftw2_config.log 2>&1 fi ncerror=$? if [ $ncerror -gt 0 ]; then echo " Error: fftw configure returned $ncerror" echo " fftw configure failed! Check the fftw2_config.log file." exit 1 else echo " fftw-2.1.5 configure succeeded." fi cd .. flibs_fftw2="-ldrfftw -ldfftw" if [ "$mpi" = 'yes' ]; then flibs_fftw2="-ldrfftw_mpi -ldfftw_mpi $flibs_fftw2" fi fi fi #-------------------------------------------------------------------------- # Configure mtkpp: #-------------------------------------------------------------------------- if [ "$mtkpp" = 'yes' ]; then boostDir=$PWD/boost-1.38.0 cd mtkpp echo echo "Configuring MTK++ (may be time-consuming)..." echo if [ "$is_mac" = 'yes' ]; then ./configure CXX="$cplusplus" CC="$cc" QTDIR="" \ CFLAGS="$cflags" \ CXXFLAGS="$cxxflags" \ --prefix=$AMBERHOME \ --includedir=$AMBERHOME/include/mtkpp \ --disable-shared \ --with-boost="${boostDir}" > ../mtkpp_config.log 2>&1 else ./configure CXX="$cplusplus" CC="$cc" QTDIR="" \ CFLAGS="$cflags" \ CXXFLAGS="$cxxflags" \ --disable-shared --enable-static="yes" \ --prefix=$AMBERHOME \ --includedir=$AMBERHOME/include/mtkpp \ --with-boost="${boostDir}" > ../mtkpp_config.log 2>&1 fi mtkerror=$? if [ $mtkerror -gt 0 ]; then echo " Error: MTK++ configure returned $mtkerror" echo " MTK++ configure failed! Check the mtkpp_config.log file." exit 1 else echo " MTK++-0.2.0 configure succeeded." fi cd .. fi # Configure PUPIL support pupillibs="-lm -lc -L\${PUPIL_PATH}/lib -lPUPIL -lPUPILBlind" if [ "$is_mac" != 'yes' ]; then pupillibs="-lrt $pupillibs" fi fi #Windows #------------------------------------------------------------------------------ # Set up the mpi compilers: #------------------------------------------------------------------------------ if [ "$mpi" = 'yes' ]; then if [ "$crayxt5" = 'yes' ]; then cc="cc" fc="ftn" mpi_flag="-DMPI " else cc="mpicc" fc="mpif90" mpi_flag="-DMPI " fi fi #------------------------------------------------------------------------------ # Make some needed directories: #------------------------------------------------------------------------------ # first, at the top $AMBERHOME level: cd ../.. if [ ! -x bin ]; then mkdir bin fi if [ ! -x lib ]; then mkdir lib fi if [ ! -x include ]; then mkdir include fi if [ ! -x src ]; then mkdir src fi if [ ! -x share ]; then mkdir share fi # next, links in AmberTools to some $AMBERHOME directories cd AmberTools if [ ! -x bin ]; then ln -s ../bin . fi if [ ! -x lib ]; then ln -s ../lib . fi if [ ! -x include ]; then ln -s ../include . fi if [ ! -x share ]; then ln -s ../share . fi # next, some links needed by the main amber codes: cd ../src if [ ! -x lib ]; then ln -s ../AmberTools/src/lib . fi if [ ! -x netcdf ]; then ln -s ../AmberTools/src/netcdf . fi if [ ! -x include ]; then ln -s ../AmberTools/src/include . fi cd ../AmberTools/src #------------------------------------------------------------------------------ # Finally, write out the config.h file: #------------------------------------------------------------------------------ cat < config.h # Amber configuration file, created with: $command ############################################################################### # (1) Location of the installation BINDIR=$AMBERHOME/bin LIBDIR=$AMBERHOME/lib INCDIR=$AMBERHOME/include DATDIR=$AMBERHOME/dat ############################################################################### # (2) If you want to search additional libraries by default, add them # to the FLIBS variable here. (External libraries can also be linked into # NAB programs simply by including them on the command line; libraries # included in FLIBS are always searched.) FLIBS= -L\$(LIBDIR) $nablibsff -lpbsa $nablibrism $flibs_fftw2 $flibs $netcdflib $flibs_mkl $flibs_arch $XTRA_FLIBS FLIBS_PTRAJ= $flibs $flibs_mkl $flibs_arch FLIBSF= $flibsf $flibs_mkl $flibsf_arch FLIBS_FFTW2=-L\$(LIBDIR) $flibs_fftw2 ############################################################################### # (3) Modify any of the following if you need to change, e.g. to use gcc # rather than cc, etc. SHELL=/bin/sh INSTALLTYPE=$installtype # Set the C compiler, etc. # For GNU: CC-->gcc; LEX-->flex; YACC-->bison -y -t; # Note: If your lexer is "really" flex, you need to set # LEX=flex below. For example, on many linux distributions, # /usr/bin/lex is really just a pointer to /usr/bin/flex, # so LEX=flex is necessary. In general, gcc seems to need flex. # The compiler flags CFLAGS and CXXFLAGS should always be used. # By contrast, *OPTFLAGS and *NOOPTFLAGS will only be used with # certain files, and usually at compile-time but not link-time. # Where *OPTFLAGS and *NOOPTFLAGS are requested (in Makefiles, # makedepend and depend), they should come before CFLAGS or # CXXFLAGS; this allows the user to override *OPTFLAGS and # *NOOPTFLAGS using the BUILDFLAGS variable. CC=$cc CFLAGS=$cflags $mpi_flag \$(CUSTOMBUILDFLAGS) CNOOPTFLAGS=$cnooptflags COPTFLAGS=$coptflags $omp_flag AMBERCFLAGS=$ambercflags \$(AMBERBUILDFLAGS) CXX=$cplusplus CPLUSPLUS=$cplusplus CXXFLAGS=$cxxflags $mpi_flag \$(CUSTOMBUILDFLAGS) CXXNOOPTFLAGS=$cxxnooptflags CXXOPTFLAGS=$cxxoptflags AMBERCXXFLAGS=$ambercxxflags \$(AMBERBUILDFLAGS) NABFLAGS=$nabflags LDFLAGS=$ldflags \$(CUSTOMBUILDFLAGS) AMBERLDFLAGS=\$(AMBERBUILDFLAGS) LEX= $lex YACC= \$(BINDIR)/yacc AR= ar rv M4= $m4 RANLIB=$ranlib # Set the C-preprocessor. Code for a small preprocessor is in # ucpp-1.3; it gets installed as \$(BINDIR)/ucpp; # this can generally be used (maybe not on 64-bit machines like altix). CPP= $cpp # These variables control whether we will use compiled versions of BLAS # and LAPACK (which are generally slower), or whether those libraries are # already available (presumably in an optimized form). LAPACK=$lapack BLAS=$blas F2C=$f2c # These variables determine whether builtin versions of certain components # can be used, or whether we need to compile our own versions. UCPP=$ucpp C9XCOMPLEX=$c9xcomplex # For Windows/cygwin, set SFX to ".exe"; for Unix/Linux leave it empty: # Set OBJSFX to ".obj" instead of ".o" on Windows: SFX=$suffix OSFX=$objsuffix MV=$localmv RM=$localrm CP=$localcp # Information about Fortran compilation: FC=$fc FFLAGS= $fflags \$(LOCALFLAGS) \$(CUSTOMBUILDFLAGS) FNOOPTFLAGS= $fnooptflags FOPTFLAGS= $foptflags AMBERFFLAGS=\$(AMBERBUILDFLAGS) FREEFORMAT_FLAG= $freeformat_flag LM=$lm FPP=$fpp FPPFLAGS=$fppflags $mpi_flag \$(CUSTOMBUILDFLAGS) AMBERFPPFLAGS=\$(AMBERBUILDFLAGS) BUILD_SLEAP=$build_sleap XHOME= $xhome XLIBS= $xlibs MAKE_XLEAP=$make_xleap NETCDF=$netcdf NETCDFLIB=$netcdflib PNETCDF=$pnetcdf PNETCDFLIB=$pnetcdflib ZLIB=$zlib BZLIB=$bzlib HASFC=$hasfc MDGX=$mdgx CPPTRAJ=$cpptraj MTKPP=$mtkpp COMPILER=$compiler MKL=$MKL_HOME MKL_PROCESSOR=$mkl_processor #CUDA Specific build flags NVCC=$nvcc PMEMD_CU_INCLUDES=$pmemd_cu_includes PMEMD_CU_LIBS=$pmemd_cu_libs PMEMD_CU_DEFINES=$pmemd_cu_defines #PMEMD Specific build flags PMEMD_FPP=$fpp $mpi_flag $fppflags $pmemd_fpp_flags PMEMD_F90=$fc PMEMD_FOPTFLAGS=$pmemd_foptflags PMEMD_CC=$cc PMEMD_COPTFLAGS=$pmemd_coptflags $mpi_flag PMEMD_FLIBSF=$flibs_mkl $win_mpilibs PMEMD_LD=$ld LDOUT=$ldout #3D-RISM MPI RISMSFF=$rismsff SANDER_RISM_MPI=$sander_rism_mpi TESTRISM=$testrism #PUPIL PUPILLIBS=$pupillibs #Python PYINSTALL=$pyinstall EOD echo " " echo "The configuration file, config.h, was successfully created." echo " " if [ "$mpi" = 'yes' ]; then if [ "$windows" = 'yes' ]; then echo "The next step is to switch to a dos shell with ifort enabled." echo "Change to \$AMBERHOME/src/ and type 'make clean' followed by" echo "'make parallel_win'." elif [ "$cuda" = 'yes' -o "$cuda_SPSP" = 'yes' -o "$cuda_DPDP" = 'yes' ]; then echo "The next step is to cd to ../../src and type 'make install'" else echo "If you have amber11, the most common next step is to " echo "'cd ../../src; make clean; make install'. See the Users' Manual" echo "for information on building a parallel version of AmberTools" fi elif [ "$cuda" = 'yes' -o "$cuda_SPSP" = 'yes' -o "$cuda_DPDP" = 'yes' ]; then echo "The next step is to cd to ../../src and type 'make install'" elif [ "$windows" = 'yes' ]; then echo "The next step is to switch to a dos shell with ifort enabled." echo "Change to \$AMBERHOME/src/ and type 'make serial_win'." elif [ "$openmp" = 'yes' ]; then echo "The next step is to type 'make nabonly'" else echo "The next step is to type 'make install'" fi echo " " # make a copy of config.h in the amber11/src directory # make it a link so that changing one changes the other if we can if [ -d ../../src ]; then if [ -x /bin/ln ]; then if [ -e ../../src/config.h ]; then /bin/rm -f ../../src/config.h fi cd ../../src && /bin/ln -s ../AmberTools/src/config.h cd ../AmberTools/src else /bin/cp config.h ../../src fi fi # For AmberTools 1.5 + Amber 11, print a message about running AT15_Amber11.py if [ -d ../../src/ ]; then echo "" echo " WARNING: You must run the script AT15_Amber11.py if you want to compile" echo " Amber 11 with AmberTools 1.5!" echo "" echo "To do this, use the command:" echo " cd ../ && ./AT15_Amber11.py" echo "" fi exit