#!/bin/sh #set -xv command="$0 $*" # configure script for NAB: creates config.h #------------------------------------------------------------------------------ # set up usage statement: #------------------------------------------------------------------------------ usage(){ cat<4.2)) -opteron options for solaris/opteron -ultra2 options for solaris/ultra2 -ultra3 options for solaris/ultra3 -ultra4 options for solaris/ultra4 -bit64 64-bit compilation for solaris -perflib Use solaris performance library in lieu of LAPACK and BLAS -cygwin add an executable suffix for cygwin/windows -p4 use optimizations specific for the Intel Pentium4 processor -altix use optimizations specific for the SGI Altix with icc -static create statically linked executables Other environment variables: NABHOME Root directory of the NAB tree. MKL_HOME If present, will link in Intel's MKL libraries (icc,gcc) =========================================================== EOD exit 1; } #------------------------------------------------------------------------------ # Process commandline configuration options: #------------------------------------------------------------------------------ mpi='no' scalapack='no' openmp='no' altix='no' ultra2='no' ultra3='no' ultra4='no' opteron='no' bit64='no' perflib='no' p4='no' gotolib='no' compiler='gcc' processor=`/usr/bin/uname -p` static='no' while [ $# -gt 0 ]; do case "$1" in -mpi) mpi="yes" ;; -scalapack) scalapack="yes" ;; -openmp) openmp="yes" ;; -altix) altix="yes" ;; -ultra2) ultra2="yes" ;; -ultra3) ultra3="yes" ;; -ultra4) ultra4="yes" ;; -ultra4) ultra4="yes" ;; -opteron) opteron="yes" ;; -bit64) bit64="yes" ;; -perflib) perflib="yes" ;; -cygwin) suffix=".exe" ;; -p4) p4="yes";; -static) static="yes";; -*) usage ;; *) if [ $# -gt 1 ]; then usage fi compiler=$1 ;; esac shift done #------------------------------------------------------------------------------ # Set up defaults that work for most machines: #------------------------------------------------------------------------------ if [ -z "$NABHOME" ]; then echo "Warning: the NABHOME environment variable is not defined !" echo " It should be an absolute path to NAB's top level directory." else echo "NABHOME is set to $NABHOME" fi if [ -z "$MKL_HOME" ]; then mkl='no' if [ -z "$GOTO" ]; then gotolib='no' else gotolib='yes' echo "Using Goto BLAS routines in $GOTO" fi else mkl='yes' echo "Using Intel MKL libraries in $MKL_HOME" fi cflags= ocflags=-O nabflags= free_format=-FR flibs_nab="\$(LIBDIR)/libsym.a \$(LIBDIR)/lapack.a \$(LIBDIR)/blas.a \$(LIBDIR)/f2c.a" omp_flag= mpi_flag= lex=flex flibs_mkl= flibs_goto= lapack=install blas=install f2c=install ucpp=install cpp="\$(NABHOME)/bin/ucpp -l" #------------------------------------------------------------------------------ # Case statement identifying the architecture/compilers: #------------------------------------------------------------------------------ case "$compiler" in #################### gcc ####### gcc) flibs_arch= cc=gcc ocflags=-O3 fc=g77 fflags= offlags=-O3 free_format=-ffree-form if [ $p4 = "yes" ]; then cflags="$cflags -march=pentium4" ocflags="$ocflags -march=pentium4" offlags="$offlags -march=pentium4" fi if [ $openmp = "yes" ]; then omp_flag="-fopenmp -DOPENMP" flibs_arch="$flibs_arch -fopenmp" fi if [ $mkl = "yes" ]; then lapack=skip blas=skip f2c=skip flibs_nab="\$(LIBDIR)/libsym.a" flibs_mkl="\$(MKL_HOME)/lib/32/libmkl_lapack.a \$(MKL_HOME)/lib/32/libmkl_ia32.a -L\$(MKL_HOME)/lib/32 -lguide -lpthread" if [ $processor = "x86_64" ]; then flibs_mkl="\$(MKL_HOME)/lib/em64t/libmkl_lapack.a \$(MKL_HOME)/lib/em64t/libmkl_em64t.a -L\$(MKL_HOME)/lib/em64t -lguide -lpthread" fi fi if [ $gotolib = "yes" ]; then lapack=install blas=skip flibs_nab="\$(LIBDIR)/libsym.a" flibs_goto="\$(LIBDIR)/lapack.a \$(GOTO) \$(LIBDIR)/f2c.a -lpthread" fi if [ $static = "yes" ]; then flibs_nab="$flibs_nab -static" fi ;; #################### irix_cc ####### irix_cc) cc="cc -woff 1116,1167,1174,1552 -Wl,-dont_warn_unused" ocflags=-O3 fc=f90 fflags= offlags=-O3 lex=lex flibs_arch=-lcomplib.sgimath lapack=skip blas=skip f2c=skip flibs_nab="\$(LIBDIR)/libsym.a" ;; #################### icc ####### icc) flibs_arch= cc="icc -wd117,177,266,880,1011" ocflags=-O2 fc=ifort fflags=" -w95 -tpp7 -mp1 -O0" offlags="-w95 -tpp7 -mp1 -ip -O3" free_format=-fR if [ $openmp = "yes" ]; then omp_flag="-openmp -DOPENMP" flibs_arch="$flibs_arch -openmp" fi if [ $mkl = "yes" ]; then lapack=skip blas=skip f2c=skip flibs_arch="" flibs_nab="\$(LIBDIR)/libsym.a" flibs_mkl="\$(MKL_HOME)/lib/32/libmkl_lapack.a \$(MKL_HOME)/lib/32/libmkl_ia32.a -L\$(MKL_HOME)/lib/32 -lguide -lpthread" if [ $processor = "x86_64" ]; then flibs_mkl="\$(MKL_HOME)/lib/em64t/libmkl_lapack.a \$(MKL_HOME)/lib/em64t/libmkl_em64t.a -L\$(MKL_HOME)/lib/em64t -lguide -lpthread" fi if [ $processor = "ia64" ]; then flibs_mkl="\$(MKL_HOME)/lib/64/libmkl_lapack.a \$(MKL_HOME)/lib/64/libmkl_ipf.a -L\$(MKL_HOME)/lib/64" fi fi if [ $gotolib = "yes" ]; then lapack=install blas=xerbla flibs_nab="\$(LIBDIR)/libsym.a" flibs_goto="\$(LIBDIR)/lapack.a \$(GOTO) \$(LIBDIR)/xerbla.o \$(LIBDIR)/f2c.a -lpthread" fi if [ $p4 = "yes" ]; then ocflags=" -O3 -ip -axN" offlags=" -w95 -tpp7 -mp1 -ip -O3 -axN" flibs_arch="$flibs_arch -lsvml" fi if [ $altix = "yes" ]; then cpp="/usr/bin/cpp -P " ucpp=skip cc="icc -wd117,177,266,880,1011" ocflags=-O3 flibs_arch="-lguide -lpthread -ldl" fflags=" -w95 -ftz -O2" offlags="-w95 -ftz -O3 -IPF_fma -ip" fi if [ $static = "yes" ]; then flibs_nab="$flibs_nab -static" fi ;; #################### solaris_cc ####### solaris_cc) lex=lex cc="cc -fnonstd" ocflags="-O -DSUN" fc="f90 -fnonstd" flibs_nab="\$(LIBDIR)/libsym.a" # solaris 5.9 required -lfsu -lfui -lfai but solaris 5.10 might not. flibs_arch="\$(LIBDIR)/blas.a \$(LIBDIR)/lapack.a \$(LIBDIR)/blas.a \$(LIBDIR)/f2c.a -lsunmath -lm" if [ $bit64 = "yes" ]; then cc="cc -xarch=v9 -fnonstd" fc="f90 -xarch=v9 -fnonstd" fi if [ $perflib = "yes" ]; then flibs_arch="-xlic_lib=sunperf" lapack=skip blas=skip f2c=skip fi if [ $openmp = "yes" ]; then omp_flag="-xopenmp=parallel -xautopar -DOPENMP" flibs_arch="$flibs_arch -lmtmalloc" fi if [ $opteron = "yes" ]; then cc="cc -xarch=amd64a -fnonstd" fc="f90 -xarch=amd64a -fnonstd" ocflags="-xO4 -xlibmil -xlibmopt -DSUN" offlags="-xO4 -xlibmil -xlibmopt" fi if [ $mpi = "yes" ]; then cc="mp$cc" fc="mp$fc" mpi_flag="-DMPI" flibs_arch="$flibs_arch -lmpi" fi if [ $scalapack = "yes" ]; then cc="mp$cc" fc="mp$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 [ $ultra2 = "yes" ]; then ocflags="-dalign -xregs=appl -xlibmil -xlibmopt -xchip=ultra2 -xsafe=mem -xO4 -xvector -DSUN" offlags="-e -dalign -xdepend -xlibmil -xlibmopt -f -pad=local -fsimple=1 -stackvar -xO4 -xregs=appl -xchip=ultra2 -xsafe=mem" fi if [ $ultra3 = "yes" ]; then ocflags="-dalign -xregs=appl -xlibmil -xlibmopt -xchip=ultra3 -xprefetch -xsafe=mem -xO4 -xvector -DSUN" offlags="-e -dalign -xdepend -xlibmil -xlibmopt -f -pad=local -fsimple=1 -stackvar -xO4 -xregs=appl -xchip=ultra3 -xprefetch -xsafe=mem" fi if [ $ultra4 = "yes" ]; then ocflags="-dalign -xregs=appl -xlibmil -xlibmopt -xchip=ultra4 -xprefetch -xsafe=mem -xO4 -xvector -DSUN" offlags="-e -dalign xdepend -xlibmil -xlibmopt -f -pad=local -fsimple=1 -stackvar -xO4 -xregs=appl -xchip=ultra4 -xprefetch -xsafe=mem" fi ;; #################### unknown choice ####### *) echo "Architecture/compiler $compiler is not supported" 1>&2 usage exit 1 ;; esac #------------------------------------------------------------------------------ # Finally, write out the config.h file: #------------------------------------------------------------------------------ cat < config.h # NAB configuration file, created with: $command ############################################################################### # (1) You need to define the symbol NABHOME in your environment # NABHOME should be an absolute path to the top-level NAB directory; # files are installed to the following directories: BINDIR=\$(NABHOME)/bin LIBDIR=\$(NABHOME)/lib INCDIR=\$(NABHOME)/include ############################################################################### # (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= $flibs_nab $flibs_mkl $flibs_goto $flibs_arch ############################################################################### # (3) Modify any of the following if you need to change, e.g. to use gcc # rather than cc, etc. SHELL=/bin/sh # 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. CC=$cc CFLAGS=$cflags $mpi_flag OCFLAGS=$ocflags $omp_flag $mpi_flag NABFLAGS=$nabflags LEX= $lex YACC= \$(NABHOME)/byacc/yacc AR= ar RANLIB= ranlib # Set the C-preprocessor. Code for a small preprocessor is in # uccp-1.3; it gets installed as \$(NABHOME)/bin/ucpp; # this can generally be used (maybe not on 64-bit machines like altix). CPP= $cpp # If you are going to link in Fortran routines, you need # to set the compiler information here. (Also, add the appropriate entries # to the FLIBS variable, above.) # # FC=$fc # FFLAGS=$fflags # FOPTFLAGS=$offlags # FREEFORMAT_FLAG=$free_format # 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 UCPP=$ucpp # For Windows/cygwin, set SFX to ".exe"; for Unix/Linux leave it empty: SFX=$suffix EOD echo " " echo "The configuration file, config.h, was successfully created." echo " " exit