#!/bin/csh -f
#
#   Configuration script to set up GAMESS' compile/link
#
#   This script asks questions about FORTRAN, math libraries, and
#   message passing libraries.  The answers to these questions are
#   used by 'compall' and 'comp' and 'compddi' and 'lked', so those
#   scripts should not require additional customizations.
#
#######################################################################
#
#   Last updated by Sarom S. Leang - September 30, 2021
#
#   Like Python? Compile GAMESS a lot? Tired of these config questions?
#   Then have a look at $GMS_PATH/bin/create-install-info.py
#
#   Please send your issues to the GAMESS public
#   issue tracker on GitHub:
#   https://github.com/gms-bbg/gamess-issues/issues
#
#            the following will always be set by this script.
set GMS_VERSION=''
set GMS_BUILD_DIR=''
set GMS_TARGET=''
set GMS_HPC_SYSTEM_TARGET='generic'
set GMS_PATH=''
set GMS_FORTRAN=''
set GMS_MATHLIB=''
set GMS_DDI_COMM=''
#            the following may optionally be set to non-blank below,
#            but will be left uninitialized in many cases.
set GMS_MATHLIB_PATH=''
set GMS_GFORTRAN_VERNO=''
set GMS_IFORT_VERNO=''
set GMS_MKL_VERNO=''
set GMS_DRAGONEGG_PATH=''
set GMS_AMD_LIBM_PATH=''
set GMS_AMD_BLAS_PATH=''
set GMS_MAC_OSX_VERNO=''
#            MSU Coupled Cluster option
set GMS_MSUCC='false'
#            LIBCCHEM options
set GMS_LIBCCHEM='false'
set GMS_LIBCCHEM_GPU=''
set GMS_CCHEM_HF='false'
set GMS_CCHEM_MP2='false'
set GMS_CCHEM_RI='false'
set GMS_CCHEM_CC='false'
set GMS_LIBCCHEM_LIBS='-ldl'
set GMS_CUDA_BOARD=''
set GMS_CUDA_PATH=''
set GMS_HDF5_PATH=''
set GMS_EIGEN_PATH=''
set GMS_BOOST_PATH=''
set GMS_GA_PATH=''
#           LibXC option
set GMS_LIBXC='false'
#           MDI option
set GMS_MDI='false'
#           message passing options
set GMS_BG_MODEL=''
set GMS_ARMCI_PATH=''
set GMS_MPI_LIB=''
set GMS_MPI_PATH=''
set GMS_OFED_PATH=''
set GMS_MVAPICH2_VERNO=''
#
# PGI/Intel compiler flags:
# - Linux 64
set GMS_L64_OPT=''
set GMS_LIN_FLAGS=''
# - LIN/WIN
set GMS_INT_OPT=''
set GMS_IPO_OPT=''
set GMS_PGI_OPT=''
set GMS_IPA_OPT=''
# - Windows
set GMS_WIN_OPT=''
set GMS_WIN_FLAGS=''
set GMS_WIN_TP=''
# end of PGI/Intel flags.
#
# Intel Phi build option:
set GMS_PHI='none'
#
# Shared memory type:
set GMS_SHMTYPE='sysv'
#
# OpenMP support:
set GMS_OPENMP='false'
#
# Singularity support:
set GMS_CONTAINER=''
set GMS_CONTAINER_PATH=''
#
# Capture floating-point execptions
set GMS_FPE_FLAGS=''
#
# VeraChem integration
# VM2
set GMS_VM2=''
#
set TINKER='false'
set VB2000='false'
set XMVB='false'
set NEO='false'
set NBO='false'
#
#    ----- Step 1: get GMS_TARGET and GMS_PATH values -----
#
echo "This script asks a few questions, depending on your computer system,"
echo "to set up compiler names, libraries, message passing libraries,"
echo "and so forth."
echo " "
echo "You can quit at any time by pressing control-C, and then <ENTER>."
echo " "
echo "Please open a second window by logging into your target machine,"
echo "in case this script asks you to 'type' a command to learn something"
echo "about your system software situation.  All such extra questions will"
echo "use the word 'type' to indicate it is a command for the other window."
echo " "
echo -n "After the new window is open, please hit <ENTER> to go on."
set reply=$<
tput clear
#
echo "   GAMESS can compile on the following 32 bit or 64 bit machines:"
echo "hpe-cray-ex  - HPE Cray's EX architecture (e.g., narwhal, spock)"
echo "hpe-cray-cs  - HPE Cray's CS architecture (e.g., tulip)"
echo "cray-xt      - Cray's XT massively parallel system, running CNL"
echo "cray-xc      - Cray's XC massively parallel system (e.g., DoE Theta, DoD Onyx)"
echo "fj-a64fx     - Fujitsu PRIMEHPC with A64FX cpus and Fujitsu Compilers (e.g., FX1000, FX700)"
echo "ibm64        - IBM, Power8 chip or newer, running AIX or Linux (e.g., DoE Summit, DoD Hokulea)"
echo "linux32      - Linux (any 32 bit distribution), for x86"
echo "linux64      - Linux (any 64 bit distribution), for x86_64, ia64, or arm64 chips,"
echo "               using gfortran, ifort, or perhaps PGI compilers."
echo "mac64        - Apple Mac, any chip, running OS X 10.5 or newer"
echo "win64        - Windows 64-bit (Windows 10)"
echo "singularity  - GAMESS Singularity container image"
echo " "
echo "    type 'uname -a' to partially clarify your computer's flavor."
echo " "
echo -n "please enter your target machine name: "
set GMS_TARGET=$<
tput clear
badgmspath:
echo "Where is the GAMESS software on your system?"
echo "A typical response might be /u1/mike/gamess,"
echo "most probably the correct answer is `pwd`"
echo " "
echo -n "GAMESS directory? [`pwd`] "
set GMS_PATH=$<
if (null$GMS_PATH == null) set GMS_PATH=`pwd`
#
if (-d $GMS_PATH) then
   tput clear
else
   echo "That directory name doesn't seem to exist, please try again."
   goto badgmspath
endif

echo "Setting up GAMESS compile and link for GMS_TARGET=$GMS_TARGET"
echo "GAMESS software is located at GMS_PATH=$GMS_PATH"
echo " "
#
badbuilddir:
echo "Please provide the name of the build location."
echo "This may be the same location as the GAMESS directory."
echo " "
echo -n "GAMESS build directory? [`pwd`] "
set GMS_BUILD_DIR=$<
if (null$GMS_BUILD_DIR == null) set GMS_BUILD_DIR=`pwd`
if (! -d $GMS_BUILD_DIR) then
   mkdir $GMS_BUILD_DIR
endif
if (! -d $GMS_BUILD_DIR/object) then
   mkdir $GMS_BUILD_DIR/object
endif
if (! -d $GMS_BUILD_DIR/tools) then
   mkdir $GMS_BUILD_DIR/tools
endif
if (! -d $GMS_BUILD_DIR/ddi) then
   mkdir $GMS_BUILD_DIR/ddi
endif
if (! -d $GMS_BUILD_DIR/tests) then
   mkdir $GMS_BUILD_DIR/tests
endif
echo " "

echo "Please provide a version number for the GAMESS executable."
echo "This will be used as the middle part of the binary's name,"
echo "for example: gamess.00.x"
echo ""
echo -n "Version? [00] "
set GMS_VERSION=$<
if(null$GMS_VERSION == null) set GMS_VERSION=00

tput clear

#
#    ----- Step 2: get compiler and math library values -----
#
#    We must set GMS_FORTRAN and GMS_MATHLIB for each target.
#    For vendor Unix, these may not need to be very precise.  As an
#    example, IBM sets the math library to simply "essl" as 'lked'
#    knows how to spell the correct incantation such as  '-lessl'.
#    For Linux, we ask enough questions to get very precise values,
#    as 'comp' and 'lked' don't otherwise know what to do.
#
#    Depending on the situation, we may set a few other values as well.
#
switch ($GMS_TARGET)

   case hpe-cray-ex:
   case hpe-cray-cs:
      tput clear
      echo "Are you building for a specific HPC system? (press RETURN for none):"
      echo " "
      echo "Options:"
      if ($GMS_TARGET == hpe-cray-cs) then
         echo "    tulip    - DoE HPE Cray test development system at ORNL"
      endif
      if ($GMS_TARGET == hpe-cray-ex) then
         echo "    narwhal  - DoD HPE Cray system at Navy DSCR w/ AMD EPYC (Rome), NVIDIA V100 GPGPUs, and Slingshot"
         echo "    spock    - DoE HPE Cray EX system at ORNL w/ AMD EPYC (Rome), AMD MI100 GPGPUs, and Slingshot"
      endif
      echo "    <ENTER> - none"
      echo " "
      echo -n "HPC system target for HPE Cray system: "
      set GMS_HPC_SYSTEM_TARGET=$<
      if(null$GMS_HPC_SYSTEM_TARGET == null) set GMS_HPC_SYSTEM_TARGET="generic"

      echo " "
      echo "The 'ftn' compiler is selected based on your module settings."
      if ($GMS_HPC_SYSTEM_TARGET == tulip) then
         echo "This is best tested if your modules pick Portland Group compilers."
         echo "The math library will be ACML.  DDI will run over Cray's MPI."
         echo "You can type      'module list'	 to see if your software"
         echo "environment includes the 'PrgEnv-cray' and 'acml' modules, if not,"
         echo "you may need to uncomment two lines in the 'comp' script."
         echo " "
         echo "You probably should review the machine dimensions in 'compddi' script"
         echo "to match your number of nodes (MAXNODES), and cores/node (MAXCPUS)."
      endif
      echo " "
      echo -n "hit <return> after you have read this message."
      set reply=$<
      set GMS_FORTRAN=ftn
      set GMS_MATHLIB=LibSci
      set GMS_MATHLIB_PATH=$CRAY_LIBSCI_PREFIX_DIR
      set GMS_MPI_LIB=CrayCS
      set GMS_MPI_PATH=""
      breaksw

   case cray-xt:
      tput clear
      echo "Compilation on the Cray-XT has no further questions."
      echo " "
      echo "The 'ftn' compiler is selected based on your module settings."
      echo "This is best tested if your modules pick Portland Group compilers."
      echo "The math library will be ACML.  DDI will run over Cray's MPI."
      echo "You can type      'module list'      to see if your software"
      echo "environment includes the 'PrgEnv-pgi' and 'acml' modules, if not,"
      echo "you may need to uncomment two lines in the 'comp' script."
      echo " "
      echo "You probably should review the machine dimensions in 'compddi' script"
      echo "to match your number of nodes (MAXNODES), and cores/node (MAXCPUS)."
      echo " "
      echo -n "Hit <ENTER> after you have read this message."
      set reply=$<
      set GMS_FORTRAN=ftn
      set GMS_MATHLIB=acml
      set GMS_MPI_LIB=CrayXT
      breaksw

   case cray-xc:
      tput clear
      echo "Are you building for a specific HPC system? (press RETURN for none):"
      echo " "
      echo "Options:"
      echo "    theta    - DoE Cray XC KNL system at Argonne National Laboratory"
      echo "    onyx     - DoD Cray XC unclassified system at ERDC DSRC"
      echo "    <ENTER> - none"
      echo " "
      echo -n "HPC system target for cray-xc: "
      set GMS_HPC_SYSTEM_TARGET=$<
      if(null$GMS_HPC_SYSTEM_TARGET == null) set GMS_HPC_SYSTEM_TARGET="generic"

      tput clear
      echo "Compilation on the Cray-XC has no further questions."
      echo " "
      echo "The 'ftn' compiler is selected based on your module settings."
      echo " "
      echo -n "Hit <ENTER> after you have read this message."
      set reply=$<
      set GMS_FORTRAN=ftn
      set GMS_MATHLIB=mkl
      set GMS_MPI_LIB=Cray-XC-MPI
      if ($GMS_HPC_SYSTEM_TARGET == theta) set GMS_PHI=knl
      breaksw

   case fj-a64fx
      tput clear
      echo "You selected FUJITSU PRIMEHPC with FUJITSU A64FX cpus and FUJITSU compilers"
      echo "to be used in either direct or cross-compiler mode."
      echo ""
      set ARCH = `uname -m`
      if ($ARCH == aarch64 ) then
         set GMS_FORTRAN=frt
         echo "The script is running on $ARCH architecture. Fujitsu compilers are selected"
      else
         set GMS_FORTRAN=frtpx
         echo "The script is running on non-aarch64 architecture (possibly, $ARCH login node"
         echo "of your FUJITSU PRIMEHPC). Fujitsu cross-compilers are selected."
      endif
      echo ""
      echo "You can always change the compilers selection by updating values of GMS_FORTRAN in install.info."
      echo ""

      echo -n "Hit <ENTER> to continue to the math library setup."
      set reply=$<
      tput clear

      badfj-a64fxmathlib:
      echo "Fujitsu Compiler Suite may or may not include SSL2 math library. Use of an"
      echo "optimized math. library, such us SSL2, is highly advised. Yet, it is possible"
      echo "to build GAMESS binary without external math. library."
      echo " "
      echo -n "Enter your choice of 'ssl2' or 'none': "
      set GMS_MATHLIB=$<

      switch ($GMS_MATHLIB)
         case none:
            set GMS_MATHLIB_PATH=''
            breaksw
         case ssl2
            echo 'We assume the FUJITSU PRIMEHPC case with predefined $FJSV_HOME env. variable'
            echo "giving path to Fujitsu Compilers Suite with SSL2 and MPI libraries."
            badssl2:
            set SSL2LOC =''
            if ( ! ($?FJSV_HOME) ) then
               echo ""
            else
               # Looking for SSL2 location doing search of libfjlapack.so
               set SSL2LOC = `find $FJSV_HOME -name 'libfjlapack.so'`
               set SSL2LOC = $SSL2LOC:h
               echo "Math. libraries found in $SSL2LOC"
            endif
            echo " "
            echo "Please enter the full path to the directory with SSL2 libraries"
            echo -n "SSL2 path [$SSL2LOC]:"
            set SSL2HEAD=$<
            if (null$SSL2HEAD == null) then
                if (null$SSL2LOC == null) goto badssl2
                set SSL2HEAD=$SSL2LOC
            endif
            if (!(-d $SSL2HEAD)) then
               echo " "
               echo "The directory $SSL2HEAD does not exist."
               echo " "
               goto badssl2
            endif
            set GMS_MATHLIB_PATH=$SSL2HEAD
            breaksw
        default:
            echo "You didn't provide a valid math library name, try again."
            echo " "
            goto badfj-a64fxmathlib
            breaksw
     endsw
   breaksw

   case ibm64:
badibmfortran:
      tput clear
      echo "Are you building for a specific HPC system? (press RETURN for none):"
      echo " "
      echo "Options:"
      echo "    summit   - DoE IBM Power9 system at Oak Ridge National Laboratory"
      echo "    hokulea  - DoD Hokule'a at Maui High Performance Computing Center"
      echo "    <ENTER> - none"
      echo " "
      echo -n "HPC system target for ibm64: "
      set GMS_HPC_SYSTEM_TARGET=$<
      if(null$GMS_HPC_SYSTEM_TARGET == null) set GMS_HPC_SYSTEM_TARGET="generic"

      if ($GMS_HPC_SYSTEM_TARGET == summit) then

         if ($OLCF_FAMILY_COMPILER == xl) then
            set GMS_FORTRAN=xlf
         else if ($OLCF_FAMILY_COMPILER == pgi) then
            set GMS_FORTRAN=pgfortran
         else if ($OLCF_FAMILY_COMPILER == gcc) then
            set GMS_FORTRAN=gfortran
         endif

      else

         #       for IBM, we have to get a FORTRAN choice
         echo "IBM offers three choices for FORTRAN compilers, - the GNU"
         echo "compiler suite's free compiler 'gfortran', IBM's 'xlf' compiler"
         echo "from the IBM compiler suite, and the Portland Group's 'pgfortran'"
         echo "compiler."
         echo
         echo "type 'which gfortran'  to look for GNU's gfortran"
         echo "type 'which xlf'       to look for IBM's compiler"
         echo "type 'which pgfortran' to look for PGI's compiler"
         echo -n "Please enter your choice of FORTRAN: "
         set GMS_FORTRAN=$<

      endif

      switch ($GMS_FORTRAN)
         case xlf:
            echo "This compiler is not commonly used with GAMESS, so"
            echo "please be careful verifying the test examples all work."
            breaksw
         case gfortran:
            echo "gfortran is very robust, so this is a wise choice."
            echo " "
            echo "Please type 'gfortran -dumpversion' or else 'gfortran -v' to"
            echo "detect the version number of your gfortran."
            echo "This reply should be a string with at least two decimal points,"
            echo "such as 4.1.2 or 4.6.1, or maybe even hyphens like 4.4.2-12."
            echo "The reply may be labeled as a 'gcc' version,"
            echo "but it is really your gfortran version."
            echo " "
            echo -n "Please enter only the first decimal place, such as 4.6 or 4.8: "
            set GMS_GFORTRAN_VERNO=$<
            switch ($GMS_GFORTRAN_VERNO)
               case 4.1:
               case 4.2:
               case 4.3:
               case 4.4:
               case 4.5:
               case 4.6:
               case 4.7:
               case 4.8:
               case 4.9:
                  echo "   Might be time to upgrade."
                  breaksw
               case 5.1:
               case 5.2:
               case 5.3:
               case 5.4:
               case 5.5:
               case 6.1:
               case 6.2:
               case 6.3:
               case 6.4:
               case 6.5:
               case 7.1:
               case 7.2:
               case 7.3:
               case 7.4:
               case 7.5:
               case 8.1:
               case 8.2:
               case 8.3:
               case 8.4:
               case 8.5:
               case 9.1:
               case 9.2:
               case 9.3:
               case 9.4:
               case 9.5:
               case 10.0:
               case 10.1:
               case 10.2:
               case 10.3:
               case 10.4:
               case 11.0:
               case 11.1:
               case 11.2:
               case 11.3:
               case 12.0:
               case 12.1:
                  echo "   Good, the newest gfortrans can compile REAL*16 data type."
                  echo "   Please report any numerical issues you encounter."
                  breaksw
               default:
                  echo "The gfortran version number is not recognized." >> /dev/stderr
                  echo "It should only have one decimal place, such as 5.x" >> /dev/stderr
                  exit 4
                  breaksw
            endsw
            breaksw
         case pgfortran:
         case pgf77:
            echo "pgfortran does not support quadruple precision,"
            echo "      so heavy element DK3 resolution of the identity will fail"
            echo "but everything else should work."
            echo " "
            echo "This compiler is not commonly used with GAMESS, so"
            echo "please be careful verifying the test examples all work."
            echo "pgfortran will use target=linux64."
            echo " "
            set GMS_LIN_FLAGS="'-V '"
            echo " "
            echo "Compiler Optimization Level"
            echo "---------------------------"
            echo "'default'     - default optimization settings -fastsse -Mipa=fast,safe "
            echo "'testing'     - for testing and development"
            echo -n "Compiler Optimization Level?: "
            set GMS_L64_OPT=$<
            if ($GMS_L64_OPT == testing) then
               echo "Testing"
               echo "-------"
               echo " "
               echo " "
               echo "'testing'  - modify variables GMS_PGI_OPT, GMS_IPA_OPT in install.info to"
               echo "             your needs."
               echo " "
               set GMS_PGI_OPT="'-O3            '    #default optimization flag, add/change if desired"
               set GMS_IPA_OPT="'-Mipa=fast,safe'    #default optimization flag, add/change if desired"
               echo " "
            else
               set GMS_L64_OPT='default'
               echo " "
            endif
            breaksw
         default:
            echo "You didn't provide a valid FORTRAN compiler name, try again."
            echo " "
            goto badibmfortran
            breaksw
      endsw

      tput clear
      echo " "
      echo "The operating system may be AIX or Linux, either one will work."
      echo "This target will use the ESSL math library, if that is installed,"
      echo "or a slow FORTRAN substitute otherwise. This target will also"
      echo "use the IBM Specturm MPI library. However, some extra information"
      echo "is needed to perform compilation on IBM machines."
      echo ""
      echo "First, where is the location of the ESSL root directory?"
      echo ""
      if ( ! ($?OLCF_ESSL_ROOT) ) then
         echo "Found:       Nothing. ESSL module not loaded."
      else
         echo "Found:       $OLCF_ESSL_ROOT"
      endif
      echo ""
      set GMS_MATHLIB=essl
      echo -n "ESSL root directory path: "
      set GMS_MATHLIB_PATH=$<
      if(null$GMS_MATHLIB_PATH == null) set GMS_MATHLIB_PATH=$OLCF_ESSL_ROOT
      echo ""
      echo "Second, where is the location of the Spectrum MPI directory?"
      echo ""
      if ( ! ($?OLCF_SPECTRUM_MPI_ROOT) ) then
         echo "Found:       Nothing."
      else
         echo "Found:       $OLCF_SPECTRUM_MPI_ROOT"
      endif
      echo ""
      echo -n "Spectrum MPI root directory path: "
      set GMS_MPI_PATH=$<
      if(null$GMS_MPI_PATH == null) set GMS_MPI_PATH=$OLCF_SPECTRUM_MPI_ROOT
      echo ""
      echo "Third, where is the location of the XL compiler suite?"
      echo "This is required even when using gfortran as the compiler,"
      echo "as some xl libraries are required to perform compilation."
      echo ""
      if ( ! ($?OLCF_XL_ROOT) ) then
         echo "Found:       Nothing."
      else
         echo "Found:       $OLCF_XL_ROOT"
      endif
      unset XL_PATH
      echo ""
      echo -n "IBM XL compiler root directory path: "
      set GMS_XL_PATH=$<
      if(null$GMS_XL_PATH == null) set GMS_XL_PATH=$OLCF_XL_ROOT
      breaksw

   case linux32:
   case linux64:

      #
      #    for Linux, we have to get a FORTRAN choice, and a math library choice.
      #        The lack of a single compiler or library choice in Linux is in
      #        fact the major motivation for this configuration script.
badlinuxfortran:
      echo "Linux FORTRAN compiler selection"
      echo "================================"
      echo ""
      echo "aocc          - AMD Fortran compiler"
      echo "armflag       - ARM Fortran compiler"
      echo "gfortran      - GNU Fortran compiler                  (minimum support v. GCC-5)"
      echo "ifort         - Intel Fortran compiler                (minimum support v. 2018.3)"
      echo "oneapi-ifort  - Intel OneAPI Classic Fortran compiler (minimum support v. 2021.3.0)"
      echo "oneapi-ifx    - Intel OneAPI Beta Fortran compiler    (minimum support v. 2021.3.0)"
      echo "pgfortran     - NVIDIA PGI Fortran compiler           (minimum support v. 19.10 Community)"
      echo "nvfortran     - NVIDIA HPC SDK Fortran compiler       (minimum support v. 21.7-0)"
      echo ""
      echo -n "Please enter your choice of FORTRAN: "
      set GMS_FORTRAN=$<
      echo " "

      switch ($GMS_FORTRAN)
         case armflang:
            breaksw
         case gfortran:
            set GMS_FPE_FLAGS="-ffpe-trap=invalid,zero,overflow -finit-real=snan -finit-integer=-9223372036854775808"
            echo "gfortran is very robust, so this is a wise choice."
            echo " "
            echo "Please type 'gfortran -dumpversion' or else 'gfortran -v' to"
            echo "detect the version number of your gfortran."
            echo "This reply should be a string with at least two decimal points,"
            echo "such as 4.9.4 or 6.3.0."
            echo "The reply may be labeled as a 'gcc' version,"
            echo "but it is really your gfortran version."
            echo " "
            echo -n "Please enter only the first decimal place, such as 4.9: "
            set GMS_GFORTRAN_VERNO=$<
            #
            switch ($GMS_GFORTRAN_VERNO)
               case 4.1:
               case 4.2:
               case 4.3:
               case 4.4:
               case 4.5:
               case 4.6:
               case 4.7:
               case 4.8:
               case 4.9:
                  echo "   GAMESS is old but your GNU compiler shouldn't be."
                  echo "   Might be time to upgrade."
                  breaksw
               case 5.1:
               case 5.2:
               case 5.3:
               case 5.4:
               case 5.5:
               case 6.1:
               case 6.2:
               case 6.3:
               case 6.4:
               case 6.5:
               case 7.1:
               case 7.2:
               case 7.3:
               case 7.4:
               case 7.5:
               case 8.1:
               case 8.2:
               case 8.3:
               case 8.4:
               case 8.5:
               case 9.1:
               case 9.2:
               case 9.3:
               case 9.4:
               case 9.5:
               case 10.0:
               case 10.1:
               case 10.2:
               case 10.3:
               case 10.4:
               case 11.0:
               case 11.1:
               case 11.2:
               case 11.3:
               case 12.0:
               case 12.1:
                  echo "   Good, the newest gfortrans can compile REAL*16 data type."
                  echo "   Please report any numerical issues you encounter."
                  breaksw
               default:
                  echo "The gfortran version number is not recognized." >> /dev/stderr
                  echo "It should only have one decimal place, such as 4.x" >> /dev/stderr
                  exit 4
                  breaksw
            endsw
            breaksw
         case ifort:
            set GMS_FPE_FLAGS="-fpe0"
            echo "Use of 'ifort' requires additional information since library"
            echo "names, and compiler flags, are very version number specific."
            echo " "
            echo "Type 'ifort --version' and note the version number."
            echo " "
            echo "Enter only the main version number, such as 18, 19, 20, 21."
            echo -n "Version? "
            set GMS_IFORT_VERNO=$<
            if ($GMS_IFORT_VERNO == 12) then
               echo -n "Hit <ENTER> to continue after digesting this message."
               set reply=$<
               echo " "
            endif
            breaksw
         case oneapi-ifort:
         case oneapi-ifx:
            set GMS_FPE_FLAGS="-fpe0"
            set GMS_IFORT_VERNO=20
            echo "You have selected $GMS_FORTRAN".
            echo ""
            echo "No additional compiler information is needed."
            breaksw
         case nvfortran:
         case pgfortran:
         case pgf77:
            set GMS_FPE_FLAGS="-Ktrap=fp"
            echo "pgfortran does not support quadruple precision,"
            echo "      so heavy element DK3 resolution of the identity will fail"
            echo "but everything else should work."
            echo " "
            echo "This compiler is not commonly used with GAMESS, so"
            echo "please be careful verifying the test examples all work."
            echo "pgfortran will use target=linux64."
            echo " "
            set GMS_LIN_FLAGS=""
            echo " "
            echo "Compiler Optimization Level"
            echo "---------------------------"
            echo "'default'     - default optimization settings -fastsse -Mipa=fast,safe "
            echo "'testing'     - for testing and development"
            echo -n "Compiler Optimization Level?: "
            set GMS_L64_OPT=$<
            if ($GMS_L64_OPT == testing) then
               echo "Testing"
               echo "-------"
               echo " "
               echo " "
               echo "'testing'  - modify variables GMS_PGI_OPT, GMS_IPA_OPT in install.info to"
               echo "             your needs."
               echo " "
               set GMS_PGI_OPT="'-O3            '    #default optimization flag, add/change if desired"
               set GMS_IPA_OPT="'-Mipa=fast,safe'    #default optimization flag, add/change if desired"
               echo " "
            else
               set GMS_L64_OPT='default'
               echo " "
            endif
            breaksw
         case aocc:
            echo "AOCC is based on modifications to gfortran 4.8 and clang, so some"
            echo "extra information will be necessary."
            echo " "
            set GMS_GFORTRAN_VERNO="4.8"
            echo " "
            echo "First, AOCC uses a plugin named Dragonegg.so as part of"
            echo "its modifications to gfortran. This plugin, as well as"
            echo "any prerequisites (and the compiler itself) can all be"
            echo "downloaded at https://developer.amd.com/amd-aocc/"
            echo ""
            echo -n "Location for the Dragonegg.so gfortran plugin:"
            set GMS_DRAGONEGG_PATH=$<
            echo " "
            echo "Second, AMD provides its own implementation of the LibM math library that"
            echo "can optionally be used here. If desired, AMD's LibM library can be downloaded"
            echo "at https://developer.amd.com/amd-cpu-libraries/amd-math-library-libm/."
            echo "Leaving this option blank will use the default quadmath and math libraries."
            echo ""
            echo -n "Location of AMD LibM shared library:"
            set GMS_AMD_LIBM_PATH=$<
            echo ""
            echo "Finally, note that this compiler is not commonly used with GAMESS, so"
            echo "please be careful verifying the test examples all work."
            breaksw
         default:
            echo "You didn't provide a valid FORTRAN compiler name, try again."
            echo " "
            goto badlinuxfortran
            breaksw
      endsw
      echo -n "Hit <ENTER> to continue to the math library setup."
      set reply=$<
      #
      #         we are still doing linux32/linux64, now choosing math library
      tput clear
badlinuxmathlib:
      echo "Linux distributions do not include a standard math library."
      echo " "
      echo "There are several reasonable add-on library choices,"
      echo "       MKL from Intel           for 32 or 64 bit Linux (very fast)"
      echo "      ACML from AMD             for 32 or 64 bit Linux (free)"
      echo "     LibFLAME from AMD          for 64 bit Linux (free)"
      echo "     ATLAS from www.rpmfind.net for 32 or 64 bit Linux (free)"
      echo "  PGI BLAS from Portland Group  for 32 or 64 bit Linux"
      echo "     ArmPL from ARM             for 64 bit Linux"
      echo "and one very unreasonable option, namely 'none', which will use"
      echo "some slow FORTRAN routines supplied with GAMESS.  Choosing 'none'"
      echo "will run MP2 jobs 2x slower, or CCSD(T) jobs 5x slower."
      echo " "
      echo "Some typical places (but not the only ones) to find math libraries are"
      echo "Type 'echo" '$MKLROOT'"'                     to look for MKL"
      echo "Type 'ls -d /opt/acml*'                  to look for ACML"
      echo "Type 'ls -d /usr/local/acml*'            to look for ACML"
      if ($GMS_TARGET == linux32) then
         echo "Type 'ls /usr/lib/atlas'                 to look for Atlas"
         echo "Type 'ls /opt/pgi/linux86/*/lib/*        to look for libblas.a from PGI"
         echo "Type 'ls /opt/pgi/osx86/*/lib/*          to look for libblas.a from PGI"
      else
         echo "Type 'ls /usr/lib64/atlas'               to look for Atlas"
         echo "Type 'ls /opt/pgi/linux86-64/*/lib/*     to look for libblas.a from PGI"
         echo "Type 'ls /opt/pgi/osx86-64/*/lib/*       to look for libblas.a from PGI"
         echo "Type 'echo" '$ARMPL_DIR'"'                   to look for ArmPL"
      endif
      echo " "
      echo "Enter your math library choice from one of the options below:"
      echo " "
      echo "'acml', 'atlas', 'libflame', 'mkl', 'openblas', 'pgiblas', 'armpl', 'none'"
      echo " "
      echo -n ": "
      set GMS_MATHLIB=$<
      #
      switch ($GMS_MATHLIB)
         case none:
            echo "--------------------------------------------------------------"
            echo '        Warning\!  Warning\!  Warning\!  Warning\!'
            echo "No mathematical library containing the BLAS will be used."
            echo "Use of a DGEMM from a good library will speed up computations"
            echo "at the MP2, CCSD, or similar correlated levels, perhaps a lot."
            echo "In the meantime, mthlib.src and all other calls to DGEMM will"
            echo "rely on the slower blas.src provided with GAMESS."
            echo "--------------------------------------------------------------"
            echo ""
            echo "Hit <ENTER> after you have read this message."
            set GMS_MATHLIB_PATH=''
            set reply=$<
            tput clear
            breaksw
         case armpl:
            echo " "
            echo " If environment modules are being used, then ARMPL_DIR should be set for you."
            echo " You can check with 'echo" '$ARMPL_DIR'"'"
            echo " If this has a value, then enter it next. Otherwise, find the correct path."
            echo -n "ARMPL pathname? "
            set armplhead=$<
            if (!(-d $armplhead)) then
               echo " " >> /dev/stderr
               echo "The directory $armplhead does not exist." >> /dev/stderr
               echo " Find the right spot and try again. Exiting..." >> /dev/stderr
               exit
            else
               set GMS_MATHLIB_PATH=$armplhead/lib/
            endif

            breaksw
         case mkl:
            echo " "
badmkl:
            echo "The exact MKL libraries needed depend on its version number."
            echo "First, where is your MKL software installed?  For example"
            echo "             /opt/intel/mkl                           -or-"
            echo "             /opt/intel/Compiler/mkl                  -or-"
            echo "             /opt/intel/composerxe/mkl                -or-"
            echo "             /your/sites/nonstandard/path/mkl"
            echo " "
            if ( ! ($?MKLROOT) ) then
               echo "Found:       Nothing."
            else
               echo "Found:       $MKLROOT"
            endif
            echo " "
            echo "Don't enter anything past the mkl subdirectory pathname."
            echo -n "MKL pathname? "
            set mklhead=$<
            if(null$mklhead == null) then
               set mklhead=$MKLROOT
            endif
            if (!(-d $mklhead)) then
               echo " "
               echo "The directory $mklhead does not exist."
               echo " "
               goto badmkl
            endif
            if ( $GMS_FORTRAN =~ oneapi-* ) goto oneapimkl
badmklver:
            echo " "
            echo "Second, it is possible to have multiple version of MKL"
            echo "installed, but often there is only one version installed."
            echo "Your system seems to have the following version(s):"
            echo " "
            ls $mklhead
            echo " "
            echo "a) If the above output contains one or more version number,"
            echo "enter the specific version you prefer, giving all decimals."
            echo "b) If the above output contains paths like 'bin' and 'lib',"
            echo "enter the word 'proceed' next."
            echo -n "MKL version (or 'proceed')? "
            set version=$<
            if (null$version == null) goto badmklver
            #           Older MKL releases went as high as version '9'.
            #           The 'composerxe' releases since 2011 all link the same,
            #           so we can just tell 'lked' that MKL is a fictitious value '12'.
            if ($version == proceed) then
               set mklroot=$mklhead/lib
               set version=12
            else
               set mklroot=undefined
               if ($mklhead == /opt/intel/Compiler) then
                  # when MKL is installed with the compilers.
                  # I haven't seen one of these yet, it could be that the
                  # number below /opt/intel/Compiler is the compiler version,
                  # and the next number is the MKL version itself???
                  echo "New MKL libraries include a minor version as well,"
                  echo "which is/are the following on your machine:"
                  ls $mklhead/$version
                  echo -n "Enter one of the minor versions listed above: "
                  set minor=$<
                  set mklroot=$mklhead/$version/$minor/mkl/lib
               else
                  # when MKL is installed as a separate product.
                  set mklroot=$mklhead/$version/lib
               endif
            endif
            #            either way, we have now found the spot, be certain!
            if (!(-d $mklroot)) then
               echo "Your choices say MKL software should exist at"
               echo "      $mklroot"
               echo "but this does not seem to exist on your system."
               echo " "
               echo "Please try again..."
               goto badmkl
            endif
            #    The library files needed depend only on the major version number.
            #    get major version number, as many as three decimal places may exist
            set GMS_MKL_VERNO=$version:r
            set GMS_MKL_VERNO=$GMS_MKL_VERNO:r
            set GMS_MKL_VERNO=$GMS_MKL_VERNO:r
            #
            #    lib path for MKL also has chip-specific parts
            #    Ubuntu uses the non-standard -m flag, its -p replies "unknown"
            set chip=`uname -p`
            if ($chip == unknown) set chip=`uname -m`
            switch ($chip)
               case i386:
               case i686:
                  set GMS_MATHLIB_PATH=$mklroot/32
                  breaksw
               case x86_64:
                  set GMS_MATHLIB_PATH=$mklroot/em64t
                  if ($GMS_MKL_VERNO >= 12) set GMS_MATHLIB_PATH=$mklroot/intel64
                  breaksw
               case ia64:
                  set GMS_MATHLIB_PATH=$mklroot/64
                  breaksw
               default:
                  echo "Something went wrong with automatic chip type detection" >> /dev/stderr
                  exit
                  breaksw
            endsw
            #
            #    as of MKL version 10, we can explicitly link serial-only libraries.
            if($GMS_MKL_VERNO <= 9) then
               echo " "
               echo "MKL, up to and including version 9, requires the following"
               echo "setting at run time:   setenv MKL_SERIAL yes   (in 'rungms')"
               echo "in order to defeat openMP thread usage by the MKL library."
               echo " "
               echo -n "Hit <ENTER> after you have digested this warning. "
               set reply=$<
            endif

oneapimkl:
            if ( $GMS_FORTRAN =~ oneapi-* ) then
               set GMS_MATHLIB_PATH=$mklhead/lib/intel64
               set GMS_MKL_VERNO=oneapi
            endif
            breaksw

         case atlas:
            #    suggest the install dir for Fedora RPMs as likely spots...

badatlas:
            echo "Where is your Atlas math library installed?  A likely place is"
            if ($GMS_TARGET == linux32) echo "   /usr/lib/atlas"
            if ($GMS_TARGET == linux64) echo "   /usr/lib64/atlas"
            echo " "
            echo -n "Please enter the Atlas subdirectory on your system: "
            set GMS_MATHLIB_PATH=$<
            if (-d $GMS_MATHLIB_PATH) then
            else
               echo " "
               echo "The directory $GMS_MATHLIB_PATH does not exist."
               echo " "
               goto badatlas
            endif
            #
            if (-e $GMS_MATHLIB_PATH/libatlas.so) then
            else
               echo " "
               echo "The linking step in GAMESS assumes that a softlink exists"
               echo "within the system's $GMS_MATHLIB_PATH"
               echo "   from libatlas.so   to a specific file like libatlas.so.3.0"
               echo "   from libf77blas.so to a specific file like libf77blas.so.3.0"
               echo "config can carry on for the moment, but the 'root' user should"
               echo "   chdir $GMS_MATHLIB_PATH"
               echo "   ln -s libf77blas.so.3.0 libf77blas.so"
               echo "   ln -s libatlas.so.3.0   libatlas.so"
               echo "prior to the linking of GAMESS to a binary executable."
               echo " "
            endif
            breaksw

            #         note: acml5.0.0 requires gfortran 4.6
            #               acml4.4.0 can work with gfortran 4.4
            #      this compiler/library compatibility requirement is not tested for here!
            #
         case acml:

badacml:
            echo "Type 'ls -d /opt/acml*' or 'ls -d /usr/local/acml*'"
            echo "and note the the full path, which includes a version number."
            echo -n "enter this full pathname: "
            set acmlpath=$<
            if (!(-d $acmlpath)) then
               echo " "
               echo "The directory $acmlpath does not exist."
               echo " "
               goto badacml
            endif
            #     ACML pathnames involve the compiler and the bits, for example:
            #       /opt/acml4.4.0/gfortran32/lib         for 32 bits
            #       /opt/acml4.4.0/gfortran64_int64/lib   for 64 bits
            switch ($GMS_FORTRAN)
               case gfortran:
                  set GMS_MATHLIB_PATH=$acmlpath/gfortran
                  breaksw
               case ifort:
                  set GMS_MATHLIB_PATH=$acmlpath/ifort
                  breaksw
               case pgfortran:
               case pgf77:
                  set GMS_MATHLIB_PATH=$acmlpath/pgi
                  breaksw
               default:
                  echo "unknown FORTRAN compiler at ACML setup" >> /dev/stderr
                  exit
                  breaksw
            endsw
            #         32 bits is simple, but for 64 bits we require
            #         both 64 bit address space and 64 bit args.
            if ($GMS_TARGET == linux32) then
               set GMS_MATHLIB_PATH=${GMS_MATHLIB_PATH}32
            else
               set GMS_MATHLIB_PATH=${GMS_MATHLIB_PATH}64_int64
            endif
            #         and then the final component of the path name is just 'lib'.
            set GMS_MATHLIB_PATH=$GMS_MATHLIB_PATH/lib
            if (!(-d $GMS_MATHLIB_PATH)) then
               echo "The target=$GMS_TARGET and FORTRAN compiler=$GMS_FORTRAN" >> /dev/stderr
               echo "requires ACML libraries in directory $GMS_MATHLIB_PATH," >> /dev/stderr
               echo "but this does not seem to exist." >> /dev/stderr
               echo "Please download this from www.amd.com/acml, then try again." >> /dev/stderr
               exit 33
            endif
            breaksw
         case libflame:

badlibflame:
            echo -n "Please enter the location of the LibFLAME subdirectory on your system: "
            set GMS_MATHLIB_PATH=$<
            if (-d $GMS_MATHLIB_PATH) then
            else
               echo " "
               echo "The directory $GMS_MATHLIB_PATH does not exist. Please try again..."
               echo " "
               goto badlibflame
            endif
            if (-f $GMS_MATHLIB_PATH/lib/libflame.a) then
               echo ""
            else
               echo ""
               echo "The file $GMS_MATHLIB_PATH/lib/libflame.a does not seem to exist."
               echo "Please download and install LibFLAME from https://github.com/amd/libflame, and try again..."
               echo "Note that LibFLAME must be compiled using the --enable-lapack2flame tag to be used with GAMESS."
               goto badlibflame
            endif

            echo "Usage of LibFLAME also requires the use of an accompanying BLAS library. There are two options for this:"
            echo "-The BLIS library, provided by AMD, can be downloaded and installed from https://github.com/amd/blis"
            echo "-LibFLAME's BLAS routines can be accessed by compiling LibFLAME with the --enable-builtin-blas tag."
            echo ""
            echo "WARNING: GAMESS+LibFLAME+BLIS seems to have significant numerical errors if"
            echo "BLIS is compiled with a version of GCC higher than 6.4. If you use BLIS,"
            echo "ensure that the selected BLIS library is compiled with GCC 6.4 or below."

badamdblas:
            echo ""
            echo "Please enter the location of the BLIS subdirectory on your system, or type 'none' to use LibFLAME BLAS routines:"
            set GMS_AMD_BLAS_PATH=$<
            switch ($GMS_AMD_BLAS_PATH)
               case none:
                  set GMS_AMD_BLAS_PATH=$GMS_MATHLIB_PATH
                  echo ""
                  echo "LibFLAME's built-in BLAS routines will be used for the BLAS library."
                  breaksw
               default:
                  if (-f $GMS_AMD_BLAS_PATH/lib/libblis.a) then
                     echo ""
                     echo "AMD's BLIS library, located at $GMS_AMD_BLAS_PATH, will be used."
                  else
                     echo "The file $GMS_AMD_BLAS_PATH/lib/libblis.a does not seem to exist. Please try again..."
                     goto badamdblas
                  endif
                  breaksw
            endsw
            breaksw
         case openblas:

badopenblas:
            if ($GMS_TARGET == linux64) then
               echo "Where is your libopenblas64.a or libopenblas.a file located?"
               echo " "
               echo -n "enter this full pathname: "
               set openblaspath=$<
               if (-e $openblaspath/libopenblas64.a) then
                  set openblaslib=$openblaspath/libopenblas64.a
               else if (-e $openblaspath/libopenblas.a) then
                  set openblaslib=$openblaspath/libopenblas.a
               else
                  echo " "
                  echo "The directory $openblaspath does not contain either libopenblas64.a or libopenblas.a"
                  echo " "
                  goto badopenblas
               endif
               echo " "
               echo "Found $openblaslib"
               echo " "
               set GMS_MATHLIB_PATH=$openblaspath
               switch ($GMS_FORTRAN)
                  case gfortran:
                     echo "Checking whether $openblaslib uses 64-bit integers."

                     set echo
                     $GMS_FORTRAN -fdefault-integer-8 -finit-integer=-9223372036854775808 -fopenmp $GMS_PATH/tools/test_dgesv.f90 $openblaslib -o $GMS_BUILD_DIR/test_dgesv
                     $GMS_BUILD_DIR/test_dgesv
                     set rc=$status
                     unset echo

                     if ($rc != 0) then
                        echo "Could not verify that $openblaslib uses 64-bit integers."
                        echo " "
                        goto badopenblas
                     endif

                     rm $GMS_BUILD_DIR/test_dgesv
                     unset rc
                     breaksw
                  default:
                     breaksw
               endsw
               unset openblaslib
            else
               echo "Where is your libopenblas.a file located?"
               echo " "
               echo -n "enter this full pathname: "
               set openblaspath=$<
               if (!(-e $openblaspath/libopenblas.a)) then
                  echo " "
                  echo "The file libopenblas.a does not exist in the directory $openblaspath"
                  echo " "
                  goto badopenblas
               endif
               set GMS_MATHLIB_PATH=$openblaspath
            endif
            breaksw
         case pgiblas:

badpgi:
            echo "Where is your libblas.a file located?  A likely place is:"
            echo " "
            echo "On Linux 32 /opt/pgi/linux86/*/lib"
            echo "On Linux 64 /opt/pgi/linux86-64/*/lib"
            echo "On OSX 10.9 /opt/pgi/osx86-64/*/lib"
            echo ""
            echo -n "enter this full pathname: "
            set pgipath=$<
            if (!(-e $pgipath/libblas.a)) then
               echo " "
               echo "The file libblas.a does not exist in the directory $pgipath"
               echo " "
               goto badpgi
            endif
            set GMS_MATHLIB_PATH=$pgipath
            breaksw
         default:
            echo "You didn't provide a valid math library name, try again."
            echo " "
            goto badlinuxmathlib
            breaksw
            #
      endsw
      if($GMS_MATHLIB != none) then
         echo "Math library '$GMS_MATHLIB' will be taken from $GMS_MATHLIB_PATH"
      endif
      breaksw
      #       just above has finally ended the very long linux32/linux64 section


      #       Apple 32/64 bit, using Gnu compiler and Apple's Framework math lib.
      #       the GMS_MATHLIB string is set only generically for Apple.
   case mac64:

      tput clear

      echo "Compiling on Apple equipment is straightforward."
      echo " "
      echo "This target assumes the use of the GNU compilers, gfortran/gcc."
      echo "Information about first installing Xcode from Apple, to get gcc,"
      echo "and then obtaining a precompiled gfortran for your Apple OS X version"
      echo "can be found in the 'comp' script."
      echo " "

      set GMS_FORTRAN=gfortran
      set GMS_MATHLIB=vecLib
      #
      echo "Please type 'gfortran -dumpversion' or else 'gfortran -v' to"
      echo "detect the version number of your gfortran."
      echo "This reply should be a string with at least two decimal points,"
      echo "such as 4.1.2 or 4.6.1, or maybe even 4.4.2-12."
      echo "The reply may be labeled as a 'gcc' version,"
      echo "but it is really your gfortran version."
      echo " "
      echo -n "Please enter only the first decimal place, such as 4.6 or 4.8: "
      set GMS_GFORTRAN_VERNO=$<
      #
      switch ($GMS_GFORTRAN_VERNO)
         case 4.1:
         case 4.2:
         case 4.3:
         case 4.4:
         case 4.5:
         case 4.6:
         case 4.7:
         case 4.8:
         case 4.9:
            echo "   Might be time to upgrade."
            breaksw
         case 5.1:
         case 5.2:
         case 5.3:
         case 5.4:
         case 5.5:
         case 6.1:
         case 6.2:
         case 6.3:
         case 6.4:
         case 6.5:
         case 7.1:
         case 7.2:
         case 7.3:
         case 7.4:
         case 7.5:
         case 8.1:
         case 8.2:
         case 8.3:
         case 8.4:
         case 8.5:
         case 9.1:
         case 9.2:
         case 9.3:
         case 9.4:
         case 9.5:
         case 10.0:
         case 10.1:
         case 10.2:
         case 10.3:
         case 10.4:
         case 11.0:
         case 11.1:
         case 11.2:
         case 11.3:
         case 12.0:
         case 12.1:
            #     echo "   Good, the newest gfortrans can compile REAL*16 data type."
            echo "   Please report any numerical issues you encounter."
            breaksw
         case 11.0:
         case 11.1:
            breaksw
         default:
            echo "The gfortran version number is not recognized." >> /dev/stderr
            echo "It should only have one decimal place, such as 4.x" >> /dev/stderr
            exit 4
            breaksw
      endsw
      #
      #   truncate the usual three level OS X version to just two levels.
      #   note that an initial release, such as 10.9 may say just that, not 10.9.0
      set osxver=`/usr/bin/sw_vers -productVersion`
      if ($osxver:r == 10) then
      else
         set osxver=$osxver:r
      endif
      #
      switch ($osxver)
         case 10.8:
         case 10.9:
         case 10.10:
         case 10.11:
         case 10.12:
         case 10.13:
         case 10.14:
         case 10.15:
            echo " "
            echo "This target will use the Accelerate framework math library,"
            echo "which is standard in OS X."
            set GMS_MATHLIB=Accelerate
            breaksw
         case 11:
         case 11.0:
         case 11.1:
         case 11.2:
         case 11.3:
         case 11.4:
            echo " "
            echo "This target will use the VecLib math library"
            set GMS_MATHLIB=vecLib
            set osxver='11'
            breaksw
         default:
            echo " "
            echo "OS X version number is unrecognized: $osxver"
            echo "You may experience problems, will attempt to build for El Capitan."
            set osxver='10.11'
            breaksw
      endsw
      set GMS_MAC_OSX_VERNO=$osxver
      #
      breaksw
      #  thus ends a passage common to both mac64.

      #
      #  Currently, Windows only supports the Portland Group compilers (PGI)
      #
   case win64:
      #      GMS_WIN_OPT   will be set below, to user's optimization level
      #      GMS_WIN_FLAGS adds extra flags for purposes of testing,
      #                    but will be set to a null string,
      #                    unless a user hand-edits install.info to add something.
      #      GMS_WIN_TP    will be a processor type compiler flag,
      #                    and will be set to a null string, unless
      #                    user's environment has one specified as TP.
      setenv GMS_WIN_FLAGS "''"

      if ($?TP) then
         setenv GMS_WIN_TP "-tp $TP"
      else
         setenv GMS_WIN_TP "''"
      endif

badwinfortran:
      tput clear
      echo "Windows Fortran Compiler"
      echo "------------------------"
      echo " "
      echo "'pgfortran'      - Portland Group Fortran 95 compiler (PGI)"
      echo "                   Last version tested:"
      echo "                     Community Edition 19.10"
      echo " "
      echo "'ifort'          - Intel Fortran compiler"
      echo "                   Last version tested: "
      echo "                     Parallel Studio XE 2011 SP1 for Windows* Update 2 consisting of:"
      echo "                     - C++ Composer XE 2011 Update 9"
      echo "                     - Visual Fortran Composer XE 2011 Update 9"
      echo " "
      echo "'oneapi-ifort'   - Intel OneAPI Fortran Classic Compiler"
      echo "                   Last version tested: "
      echo "                     OneAPI 2021.2.1"
      echo "                     - ifort  Version 2021.2.0 Build 20210228_000000"
      echo " "
      echo "'oneapi-ifx'     - Intel OneAPI Fortran Compiler (Beta)"
      echo "                   Last version tested: "
      echo "                     OneAPI 2021.2.1"
      echo "                     - ifx Version 2021.2.0 Beta Build 20210317"
      echo " "
      echo -n "Enter your Fortran compiler choice: "
      set GMS_FORTRAN=$<

      switch ($GMS_FORTRAN)
         case ifort:
            echo " "
            echo "Use of 'ifort' requires additional information since library"
            echo "names, and compiler flags, are version number specific."
            echo "note: ifort is typically installed at"
            echo "      C:\Program Files (x86)\Intel\ComposerXE-2011\ "
            echo " "
            echo "Type 'ifort' and note the version number in the reply."
            echo "Please enter only the main version number, such as 14, 15, 16 ..."
            echo -n "Version? "
            set GMS_IFORT_VERNO=$<
            breaksw
         case oneapi-ifort:
            echo " "
            echo "Using Intel OneAPI Fortran Compiler Classic"
            set GMS_IFORT_VERNO=21
            echo " "
            breaksw
         case oneapi-ifx:
            echo " "
            echo "Using Intel OneAPI Fortran Compiler (Beta)"
            set GMS_IFORT_VERNO=21
            echo " "
            breaksw
         case pgfortran:
            echo " "
            echo "'pgfortran' - does not support quadruple precision, so heavy "
            echo "              element DK3 resolution of the identity will fail"
            echo "              but everything else should work."
            echo " "
            set GMS_WIN_FLAGS="' '"
            echo " "
            echo "This compiler is not commonly used with GAMESS, so"
            echo "please be careful verifying the test examples all work."
            echo "pgfortran will use target=$GMS_TARGET."
            echo " "
            breaksw
         default:
            echo "You didn't provide a valid FORTRAN compiler name."
            echo -n "Hit <ENTER> to try again."
            set reply=$<
            goto badwinfortran
            breaksw
      endsw

      echo -n "Hit <ENTER> to set up the compiler optimization level."
      set reply=$<

badwinoptimizationlevel:
      tput clear
      echo "Compiler Optimization Level"
      echo "---------------------------"
      echo " "
      echo "'baseline'    - Do not apply compiler optimization '-O0' flag (slow)"
      echo "'linux'       - Apply compiler optimizations using '-O2' flag (safe)"
      echo "'samara'      - Apply compiler optimizations using '-O3' flag (un-tested for accuracy)"
      echo "'fast'        - Apply compiler optimizations using: "
      echo "                                             PGI  :'-fastsse'"
      echo "                                             INTEL:'-fast'"
      echo " "
      echo -n "Enter your compiler optimization level choice: "
      set GMS_WIN_OPT=$<
      switch ($GMS_WIN_OPT)
         case baseline:
            echo " "
            echo "'baseline' - will result in a quick build process for GAMESS but at the cost "
            echo "             of a slow running GAMESS binary."
            echo " "
            breaksw
         case linux:
            echo " "
            echo "'linux'    - will result in a safe build process for GAMESS using settings that "
            echo "             have been verified to work on Linux systems."
            echo " "
            echo "The linking step will take a while."
            echo " "
            breaksw
         case samara:
            echo " "
            echo "'samara'   - will result in a GAMESS build that has not be tested for accuracy."
            echo " "
            echo "The linking step will take a while."
            echo " "
            breaksw
         case fast:
            echo " "
            echo "'fast'     - will result in a GAMESS build that has not be tested for accuracy."
            echo " ifort     - applies: -fast"
            echo " pgfortran - applies: -fastsse"
            echo " pgf77     - applies: -fastsse"
            echo " "
            echo "The linking step will take a while."
            echo " "
            breaksw
         case testing:
            echo " "
            if ($GMS_FORTRAN == ifort || $GMS_FORTRAN == oneapi-ifort || $GMS_FORTRAN == oneapi-ifx) then
               echo "'testing'  - modify variables GMS_INT_OPT, GMS_IPO_OPT, GMS_WIN_FLAGS in"
               echo "             install.info to your needs."
               echo " "
               set GMS_INT_OPT="'-O3              '  #default optimization flag, add/change if desired"
               set GMS_IPO_OPT="'-Qipo -Qprec-div-'  #default optimization flag, add/change if desired"
            else
               echo "'testing'  - modify variables GMS_PGI_OPT, GMS_IPA_OPT, GMS_WIN_FLAGS in"
               echo "             install.info to your needs."
               echo " "
               set GMS_PGI_OPT="'-O3              '  #default optimization flag, add/change if desired"
               set GMS_IPA_OPT="'                 '  #default optimization flag, add/change if desired"
            endif
            breaksw
         default:
            echo " "
            echo "You did not provide a valid compiler optimization level."
            echo -n "Hit <ENTER> try again."
            set reply=$<
            goto badwinoptimizationlevel
            breaksw
      endsw

      echo -n "Hit <ENTER> to continue to the math library setup."
      set reply=$<
      #
      #  Currently, Windows math library selection limited to what is offered
      #  by the PGI compilers.
      #
badwinmathlib:
      tput clear
      echo "Windows Math Library Selection"
      echo "-------------------------------"
      echo " "
      echo "'blas' to use PGI Compiler's BLAS library"
      echo "'acml' to use AMD's ACML BLAS library"
      echo "'mkl'  to Intel's math library"
      echo "'none' to use GAMESS's BLAS routine (much slower)"
      echo " "
      echo -n "Enter your math library choice: "
      set GMS_MATHLIB=$<
      #
      switch ($GMS_MATHLIB)
         case blas:
            echo "$GMS_FORTRAN compiler's BLAS and LAPACK library will be used"
            echo " "
            breaksw
         case acml:
            echo "ACML math library will be used. $GMS_FORTRAN will use the"
            echo "'-Bdynamic -Macml' flags during linking."
            echo " "
            breaksw
         case mkl:
            if ( ! ($?MKLROOT) ) then
               echo "Found:     Nothing. Intel environment not loaded."
               echo " "
               echo "Normally the Intel compiler is automatically able to find the MKL library."
               echo " "
               echo "If you have the library installed in a different or non-standard location,"
               echo -n "enter the directory DOS path with no spaces (e.g., cygpath -d 'Windows PATH')."
            else
               set GMS_MATHLIB_PATH=`cygpath -d "$MKLROOT"`
               echo "Found:     $GMS_MATHLIB_PATH"
            endif
            echo " "
            echo -n "Enter your MKL Root Path: "
            set reply="$<"
            if ("$reply" != "") then
               set GMS_MATHLIB_PATH="$reply"
               echo " "
            else
               if ("$GMS_MATHLIB_PATH" == "") goto badwinmathlib
            endif
            echo -n "Enter $GMS_MATHLIB library main version (12 for example): "
            set GMS_MKL_VERNO=$<
            if ("$GMS_MKL_VERNO" == "") set GMS_MKL_VERNO=12
            echo " "
            echo "MKL version $GMS_MKL_VERNO will be used from the directory:"
            echo "$GMS_MATHLIB_PATH"
            echo " "
            breaksw
         case blas:
            echo "$GMS_FORTRAN compiler's BLAS library will be used"
            echo " "
            breaksw
         case none:
            echo "--------------------------------------------------------------"
            echo '        Warning\!  Warning\!  Warning\!  Warning\!'
            echo "No mathematical library containing the BLAS will be used."
            echo "Use of a DGEMM from a good library will speed up computations"
            echo "at the MP2, CCSD, or similar correlated levels, perhaps a lot."
            echo "In the meantime, mthlib.src and all other calls to DGEMM will"
            echo "rely on the slower blas.src provided with GAMESS."
            echo "--------------------------------------------------------------"
            echo " "
            breaksw
         case acml:
            echo "ACML math library will be used. $GMS_FORTRAN will use the"
            echo "'-Bstatic -lacml' flags during linking."
            echo " "
            breaksw
         default:
            echo "You didn't provide a valid math library name."
            echo -n "Hit <ENTER> try again."
            set reply=$<
            goto badwinmathlib
            breaksw
      endsw

      echo -n "Hit <ENTER> to continue."
      set reply=$<

      if ($GMS_FORTRAN == pgfortran) then
         echo -n "Hit <ENTER> to continue to the target platform setup."
         set reply=$<
         tput clear
         echo "PGI Target Platform"
         echo "-------------------"
         echo " "
         echo "See: http://www.pgroup.com/doc/pgiref.pdf"
         echo " "
         echo "Select a target platform for your system below:"
         echo " "
         echo "Unified Binary options"
         echo "======================"
         echo "'px-64'          : generate 64-bit unified binary code for both AMD and Intel x64 processors."
         echo " "
         echo "If you wish to leave this option up to the compiler then just hit <enter>."
         echo -n "Enter your target platform choice CAREFULLY (no checks will follow): "
         set TP=$<
         echo " "
         if (null$TP != null) then
            set GMS_WIN_TP="'-tp $TP'"
            echo "Target Platform:" $TP
         else
            set GMS_WIN_TP=""
            echo "Target Platform:" $TP
         endif
      endif
      #
      #  End of win64 section
      #
      breaksw

   case singularity:
      echo    "Using a GAMESS Singularity container image."
      echo    " "
      echo    "Enter the name of the Singularity container image"
      echo    "or hit <enter> to accept the default (gamess.simg)"
      echo -n "Singularity container image name: "
      set CONTAINER_NAME=$<
      echo " "
      if (null$CONTAINER_NAME != null) then
         set GMS_CONTAINER="$CONTAINER_NAME"
         echo "Singularity container image name:" $CONTAINER_NAME
      endif
      echo    " "
      echo -n "Hit <ENTER> to select DDI communication options "
      set reply=$<
      tput clear
      goto top_of_comm_choice
      breaksw

   default:
      echo "There is no support for compiling on $GMS_TARGET," >> /dev/stderr
      echo "probably you typed the target name incorrectly." >> /dev/stderr
      exit 12
      breaksw
endsw
#
#    ----- Step 3: acquire data necessary to use MPI instead of sockets -----
#                             Note:
#    a) We try asking about MPI choices only for linux64 clusters.
#    b) For now, vendor workstations fall back to TCP/IP sockets.
#    c) High end machines using MPI or other sophisticated libraries force
#       their usage inside 'compddi', but it looks good if we generate the
#       right name for the config file for what is going to be hardwired.
#
tput clear
set GMS_DDI_COMM='sockets'
if ($GMS_TARGET =~ hpe-cray-*) set GMS_DDI_COMM='mpi'
if ($GMS_TARGET == cray-xt)    set GMS_DDI_COMM='mpi'
if ($GMS_TARGET == cray-xc)    set GMS_DDI_COMM='mpi'
if ($GMS_TARGET == ibm64)      set GMS_DDI_COMM='mpi'
#
if ($GMS_TARGET == fj-a64fx) then
   echo "This script assumes that you use MPI for DDI communications. If for some reason"
   echo "you intension is to use GAMESS on a single node only, you can try TCP/IP sockets as well."
   echo "For that you need to change GMS_DDI_COMM value in file 'install.info' to 'sockets' after"
   echo "completing this script."
   echo ""
   set GMS_DDI_COMM='mpi'
   set GMS_MPI_LIB=fj-mpi
   if ( ! ($?FJSV_HOME) ) then
      echo ""
      echo "MPI libraries were not found."
      set MPILOC=''
   else
       # Looking for MPI libraries doing search of libfjlapack.so
       set MPILOC = `find $FJSV_HOME -name 'libmpi.so'`
       set MPILOC = $MPILOC:h:h
       echo "MPI libraries found in $MPILOC"
   endif
   fj_mpi_lib_choice:
   echo -n "Please enter the MPI root location [$MPILOC]:"
   set GMS_MPI_PATH=$<
   if (null$GMS_MPI_PATH == null) then
      if (null$MPILOC == null) goto fj_mpi_lib_choice
      set GMS_MPI_PATH=$MPILOC
   endif
   if (!(-d $GMS_MPI_PATH)) then
      echo " "
      echo "The directory $GMS_MPI_PATH does not exist."
      echo " "
      goto fj_mpi_lib_choice
   endif
endif
#
if ($GMS_TARGET == ibm64) then
   set GMS_MPI_LIB=spectrum
endif
if ($GMS_TARGET == linux64) then
   echo " "
   echo -n "Hit <ENTER> to set up your network for Linux clusters."
   set reply=$<
   tput clear
top_of_comm_choice:
   echo " "
   echo "If you have a slow network, like Gigabit Ethernet (GE), or"
   echo "if you have so few nodes you won't run extensively in parallel, or"
   echo "if you have no MPI library installed, or"
   echo "if you want a fail-safe compile/link and easy execution,"
   echo "     choose 'sockets'"
   echo "to use good old reliable standard TCP/IP networking."
   echo " "
   echo "If you have an expensive but fast network like Infiniband (IB), and"
   echo "if you have an MPI library correctly installed,"
   echo "     choose 'mpi'."
   echo " "
   echo "If you wish to use a combination of TCP/IP networking for small"
   echo "messages and MPI for large messages in a 'mixed' fashion,"
   echo "     choose 'mixed'."
   echo " "
   echo -n "communication library ('serial','sockets' or 'mpi' or 'mixed')? "
   set GMS_DDI_COMM=$<
   switch ($GMS_DDI_COMM)
      case serial:
      case serial-debug:
      case sockets:
         breaksw
      case mixed:
      case mpi:
         #               Although not listed below, other choices can be made:
         #                   openmpi, mpich2
         #               See readme.ddi for their status, which can be summarized as
         #                 mpich2 has not been able to be tested on IB,
         #                        but has been found to be usable on 10GE.
         #                 openMPI does aggressive polling in data servers,
         #                         so it runs only very slowly.
         tput clear
         echo "The MPI libraries which work well on linux64/Infiniband are"
         echo "      Intel's MPI (impi)"
         echo "      MPICH/MPICH2"
         echo "      MVAPICH2"
         echo "Other libraries may work, please see 'readme.ddi' for info."
         echo "The choices listed above will compile and link easily,"
         echo "and are known to run correctly and efficiently."
         echo ""
         echo "Enter 'sockets' if you just changed your mind about trying MPI."
         echo ""
         echo -n "Enter MPI library (impi, mpich, mpich2, mvapich2, mpt, openmpi, sockets): "
         set GMS_MPI_LIB=$<
         if ($GMS_MPI_LIB == sockets) then
            set GMS_DDI_COMM=sockets
            set GMS_MPI_LIB=''
         endif
         breaksw
      default:
         echo "the only two choices are 'sockets' and 'mpi', try again..."
         goto top_of_comm_choice
         breaksw
   endsw

   if ($GMS_DDI_COMM == sockets) goto done_with_comm_choice
   if ($GMS_DDI_COMM =~ serial*) goto done_with_comm_choice

   #      make sure everything after this works with lower case names
   if ($GMS_MPI_LIB == iMPI)     set GMS_MPI_LIB=impi
   if ($GMS_MPI_LIB == MVAPICH2) set GMS_MPI_LIB=mvapich2
   if ($GMS_MPI_LIB == openMPI)  set GMS_MPI_LIB=openmpi
   if ($GMS_MPI_LIB == MPICH2)   set GMS_MPI_LIB=mpich2
   if ($GMS_MPI_LIB == MPICH)    set GMS_MPI_LIB=mpich
   if ($GMS_MPI_LIB == MPT)      set GMS_MPI_LIB=mpt
   #
   #      Your sys/op might have put the MPI library almost anywhere!
   #      Both /opt and /usr/local are very reasonable places to hunt.
   #      We show some known locations of MPI libraries below, as hints.
   tput clear
top_enter_mpi_path:
   echo " "
   echo "MPI can be installed in many places, so let's find $GMS_MPI_LIB."
   echo "The person who installed your MPI can tell you where it really is."
   echo " "
   switch ($GMS_MPI_LIB)
      case impi:
         echo "impi     is probably located at a directory like"
         echo "              /opt/intel/impi/impi_latest "
         echo " "
         if ( ! ($?I_MPI_ROOT) ) then
            echo "Found:        Nothing."
         else
            echo "Found:        $I_MPI_ROOT"
         endif
         echo " "
         breaksw
      case mpt:
         echo "mpt      is probably located at a directory like"
         echo "              /opt/sgi/mpt/mpt-1.26"
         breaksw
      case mpich:
      case mpich2:
         echo "mpich/mpich2 could be almost anywhere, perhaps some directory like:"
         echo "              /usr/local/mpich2"
         echo "              /u1/root/mpich2-install"
         echo "              /usr/local/Cellar/mpich2/3.1.1"
         echo "              /usr/local/Cellar/mpich2/3.1.3"
         breaksw
      case mvapich2:
         echo "mvapich2 could be almost anywhere, perhaps some directory like"
         echo "              /usr/mpi/gcc/mvapich2-1.6"
         breaksw
      case openmpi:
         echo "openmpi  could be almost anywhere, perhaps some directory like"
         breaksw
      default:
         echo "Missing path instructions for $GMS_MPI_LIB" >> /dev/stderr
         echo "please repair the config script..." >> /dev/stderr
         exit 4
         breaksw
   endsw
   #
   echo -n "Please enter your ${GMS_MPI_LIB}'s location: "
   set GMS_MPI_PATH=$<
   if ((null$GMS_MPI_PATH == null) && ($GMS_MPI_LIB == impi)) then
      if ((null$I_MPI_ROOT != null) && (-d $I_MPI_ROOT)) then
         set GMS_MPI_PATH=$I_MPI_ROOT
      endif
   endif
   if (!(-d $GMS_MPI_PATH)) then
      echo "pathname $GMS_MPI_PATH does not exist.  please try again"
      goto top_enter_mpi_path
   endif
   #
   #     in principle, MPI libraries using Infiniband or iWarp need
   #     a lower level library "Open Fabrics Enterprise Distribution"
   #     to handle communications on the device.
   #                    This is a bit murky!
   #     On our system, we needed to explicitly link OFED for MVAPICH2,
   #     but iMPI and openMPI either don't need OFED, or found it w/o
   #     needing to specify the libraries.  New MVAPICH2 also seems
   #     to link to OFED without explicit assistance.
   #
   #     So, we'll ask about OFED only for old versions of MVAPICH2...
   #
   set ofedlibs=false
   #
   if ($GMS_MPI_LIB == mvapich2) then
      echo "Linking against MVAPICH2 is a function of its version number"
      echo "Please type"
      echo "   mpiname -v     (or mpiname -a)"
      echo "to reveal the version number to be 1.9a or 2.1a or similar".
      echo "Please enter only a number, with one decimal point, such as 2.0"
      echo -n "MVAPICH2 version? "
      set GMS_MVAPICH2_VERNO=$<
      switch ($GMS_MVAPICH2_VERNO)
         case 1.4:
         case 1.5:
         case 1.6:
         case 1.7:
         case 1.8:
         case 1.9:
            set ofedlibs=true
            breaksw
         case 2.0:
         case 2.1:
         default:
            breaksw
      endsw
      if ("$ofedlibs" == "true") then
         echo " "
         echo "$GMS_MPI_LIB requires a lower level library named OFED to handle"
         echo "the network device.  The 'Open Fabrics Enterprise Distribution'"
         echo "handles Infiniband and other fast network connections."
         echo "   See www.openfabrics.org for more information."
         echo "Typical places to find OFED's libraries might include"
         echo "        /usr/lib64"
         echo "        /opt/ofed/lib64"
         echo "One of the OFED libraries you are looking for is libibverbs.so"
         echo " "
         echo -n "Please enter your OFED's location: "
         set GMS_OFED_PATH=$<
         if (!(-d $GMS_OFED_PATH)) then
            echo "The pathname $GMS_OFED_PATH does not exist." >> /dev/stderr
            echo "Please install OFED, and then try 'config' again." >> /dev/stderr
            exit 44
         endif
      endif
   endif
endif

if ($GMS_TARGET == win64) then
   echo " "
   echo -n "Hit <ENTER> to to set up your network."
   set reply=$<
badwinmpiselection:
   tput clear
   echo "Options"
   echo "-----------"
   echo " "
   echo "'impi'   - use Intel Message Passing Interface (Intel MPI)."
   echo "'msmpi'  - use Microsoft Message Passing Interface (MS-MPI)."
   echo "'serial' - no communication."
   echo " "
   echo -n "Please enter your communication choice: "
   set GMS_MPI_LIB=$<
   set GMS_DDI_COMM='mpi'
   switch ($GMS_MPI_LIB)
      case impi:
         echo " "
         echo "Intel MPI"
         if ( ! ($?I_MPI_ROOT) ) then
            echo "Found:     Nothing. Intel environment not loaded."
            echo " "
            echo "Normally the Intel compiler is automatically able to find the Intel MPI library."
            echo " "
            echo "If you have the library installed in a different or non-standard location,"
            echo -n "enter the directory DOS path with no spaces (e.g., cygpath -d 'Windows PATH')."
         else
            set GMS_MPI_PATH=`cygpath -d "$I_MPI_ROOT"`
            echo "Found:     $GMS_MPI_PATH"
         endif
         echo " "
         echo -n "Enter your Intel MPI Root Path: "
         set reply="$<"
         if ("$reply" != "") then
            set GMS_MPI_PATH="$reply"
            echo " "
         else
            if ("$GMS_MPI_PATH" == "") goto badwinmpiselection
         endif
         echo " "
         echo "Intel MPI will be used from the directory:"
         echo "$GMS_MPI_PATH"
         echo " "
         breaksw
      case msmpi:
         echo " "
         echo "MS-MPI."
         if ($GMS_FORTRAN == pgfortran) echo "The following PGI flag will be used: '-Mmpi=msmpi'"
         if ($GMS_FORTRAN == ifort || $GMS_FORTRAN == oneapi-ifort || $GMS_FORTRAN == oneapi-ifx) then
            echo "MS-MPI variables, MSMPI_INC and MSMPI_LIB64, will be used."
            echo "Make sure they are set before proceeding further."
            echo " "
            if ($?MSMPI_INC) echo "MPI header path: $MSMPI_INC"
            if (($GMS_TARGET == win64) && $?MSMPI_LIB64) echo "64-bit MPI lib path: $MSMPI_LIB64"
         endif
         breaksw
      case serial:
         echo " "
         echo "serial.src will be compiled"
         set GMS_MPI_LIB='none'
         set GMS_DDI_COMM='serial'
         breaksw
      default:
         echo "$GMS_MPI_PATH is not a valid option."
         echo -n "Hit <ENTER> to try again."
         set reply=$<
         goto badwinmpiselection
         breaksw
   endsw

echo -n "Hit <ENTER> to continue."
set reply=$<

endif
#
done_with_comm_choice:
if ($GMS_TARGET == singularity) goto final_comment
#
#      Step 4: Collect information for LIBCCHEM
#              Only 64 bit Linux is supported.
#
tput clear
echo "LibXC Option"
echo "============"
echo ""
echo "GAMESS-US now supports LibXC."
echo "LibXC is a library of exchange-correlation functionals for density-functional"
echo "theory (DFT). It adds many new DFT functionals that are enabled with the"
echo '$'"LIBXC input group. This feature requires modern Fortran 2003 but not all"
echo "compilers support it. For gfortran, the minimal tested version is gfortran 5.5."
echo "If your gfortran is older than this, you can try to use the LibXC interface"
echo "but it may not work. The IBM XL Fortran compiler is not fully supported!"

echo ""
echo "This option can be manually changed later by modifying install.info"
echo ""

echo -n "Optional: Build LibXC interface?  (yes/no): "
set reply=$<
if(null$reply == null) set reply=no
if ($reply == no) then
   set GMS_LIBXC=false
else
   set GMS_LIBXC=true
   echo ""
   echo "Do not forget to run './tools/libxc/download-libxc.csh' for downloading libxc,"
   echo "And do not forget to run 'make libxc -j"`echo '$'`"(nproc)' before 'make modules' for compiling of LibXC..."
   echo ""
   echo -n "Hit <ENTER>."
   set reply=$<
endif
tput clear
echo "The Molecular Science Software Institute (MolSSI) Driver Interface (MDI)"
echo "========================================================================"
echo "GAMESS-US now supports the MolSSI Driver Interface (MDI)."
echo "MDI enables GAMESS to interoperate with other codes via a standardized"
echo "interface. More information about MDI can be found here:"
echo ""
echo "https://molssi-mdi.github.io/MDI_Library/html/index.html"
echo ""
echo "This feature requires modern Fortran 2003 but not all compilers support it"

echo ""
echo "This option can be manually changed later by modifying install.info"
echo ""

echo -n "Optional: Build MDI support?  (yes/no): "
set reply=$<
if(null$reply == null) set reply=no
if ($reply == no) then
   set GMS_MDI=false
else
   set GMS_MDI=true
   echo ""
   echo "Do not forget to run './tools/mdi/download-mdi.csh' for downloading the MDI Library,"
   echo "And do not forget to run 'make libmdi -j"`echo '$'`"(nproc)' before 'make modules' for compiling of MDI..."
   echo ""
   echo -n "Hit <ENTER>."
   set reply=$<
endif
tput clear
echo "Michigan State University active-space CCSDt and CC(t;3) Option"
echo "================================================================"
echo ""
echo "Users have the option of compiling the beta version of the"
echo "active-space CCSDt and CC(t;3) codes developed at Michigan"
echo "State University (CCTYP = CCSD3A and CCT3, respectively)."
echo ""
echo "These builds take a considerable amount of time and memory for"
echo "compilation due to the amount of machine generated source code."
echo "We recommend that users interested in installing these codes"
echo "compile GAMESS in parallel using the Makefile generated during"
echo "the initial configuration ('make -j [number of cores]')."

echo ""
echo "This option can be manually changed later by modifying install.info"
echo ""
#
echo -n "Optional: Build Michigan State University CCT3 & CCSD3A methods?  (yes/no): "
set reply=$<
if(null$reply == null) set reply=no
if ($reply == no) then
   set GMS_MSUCC=false
else
   set GMS_MSUCC=true
endif
tput clear
if (($GMS_TARGET == linux64) || ($GMS_TARGET == ibm64)) then
   #
   echo "LIBCCHEM Option"
   echo "==============="
   echo ""
   echo "64 bit Linux and IBM builds can attach a special LIBCCHEM code for fast"
   echo "MP2 and CCSD(T) runs.  The LIBCCHEM code can utilize nVIDIA GPUs,"
   echo "through the CUDA libraries, if GPUs are available."
   echo "Usage of LIBCCHEM requires installation of HDF5 I/O software as well."
   echo "GAMESS+LIBCCHEM binaries are unable to run most of GAMESS computations,"
   echo "and are a bit harder to create due to the additional CUDA/HDF5 software".
   echo "Therefore, the first time you run 'config', the best answer is 'no'!"
   echo "If you decide to try LIBCCHEM later, just run this 'config' again."
   echo " "

   echo -n "Do you want to try LIBCCHEM?  (yes/no): "
   set reply=$<
   if(null$reply == null) set reply=no
   if ($reply == no) then
      set GMS_LIBCCHEM=false
      goto skip_libcchem_config
   else
      set GMS_LIBCCHEM=true
      echo -n "Do you want LIBCCHEM with gpu support?  (yes/no): "
      set reply=$<
      if(null$reply == null) set reply=no
      if ($reply == no) then
         set GMS_LIBCCHEM_GPU=false
      else
         set GMS_LIBCCHEM_GPU=true
      endif
   endif
   #
   tput clear
bad_cchem_module:
   echo "LibCChem comes with multiple modules that can be installed and used:"
   echo "-RHF Energy"
   echo "-Density-Fitted HF Energy"
   echo "-MP2 Energy"
   echo "-RI-MP2 Energy + Gradients"
   echo "-CCSD(T) Perturbative Triples"
   echo " "
   echo "Would you like to install all modules?"
   echo " "
   echo "Type yes to install all modules."
   echo "Type no to select individual models to install."
   set reply=$<
   if(null$reply == null) set reply=no
   if ($reply == yes) then
      set GMS_CCHEM_HF=true
      set GMS_CCHEM_DF=true
      set GMS_CCHEM_MP2=true
      set GMS_CCHEM_RI=true
      set GMS_CCHEM_CC=true
   else
      echo " "
      echo "Select the modules that you would like to install:"
      echo -n "RHF Energy (yes/no) :"
      set reply=$<
      if(null$reply == null) set reply=no
      if ($reply == yes) set GMS_CCHEM_HF=true
      echo -n "MP2 Energy (yes/no) :"
      set reply=$<
      if(null$reply == null) set reply=no
      if ($reply == yes) set GMS_CCHEM_MP2=true
      echo -n "RI-MP2 Energy + Gradients (yes/no) :"
      set reply=$<
      if(null$reply == null) set reply=no
      if ($reply == yes) set GMS_CCHEM_RI=true
      echo -n "CCSD(T) Energy (yes/no) :"
      set reply=$<
      if(null$reply == null) set reply=no
      if ($reply == yes) set GMS_CCHEM_CC=true
   endif
   tput clear
bad_HDF5_path:
   echo " "
   echo "Where is the HDF5 I/O library software installed?"
   echo "   If installed from an RPM, HDF5 is probably in   /usr"
   echo "   If built from source code, it might be under    /usr/local"
   echo "the path name should have 'include' and 'lib64' directories below it."
   echo "Its lib64   subdirectory will have many libraries named libhdf5_xxx."
   echo "Its include subdirectory will have several headers named H5xxx."
   echo " "
   echo " "
   if ($GMS_HPC_SYSTEM_TARGET == summit) then
      if ( ! ($?OLCF_HDF5_ROOT) ) then
         echo "Found:       Nothing. HDF5 module not loaded."
      else
         echo "Found:       $OLCF_HDF5_ROOT"
      endif
      echo ""
   else if ( ! ($?HDF5_ROOT) ) then
      echo "Found:       Nothing. HDF5_ROOT variable not defined or module not loaded."
   else
      echo "Found:       $HDF5_ROOT"
   endif
   echo -n "HDF5 path: "
   set GMS_HDF5_PATH=$<
   #
   if ($GMS_HDF5_PATH == exit) then
      set GMS_LIBCCHEM=false
      goto dump_install_info
   endif
   #
   #         one of our clusters has custom built HDF5, placed at /usr/local/lib,
   #         but an RPM installation will put its libraries to /usr/lib64
   if ((-e $GMS_HDF5_PATH/lib64/libhdf5.a) || \
      (-e $GMS_HDF5_PATH/lib/libhdf5.a)) then
   else
      echo "That does not appear to be a correct path."
      echo "I don't see the $GMS_HDF5_PATH/lib64/libhdf5.a library."
      echo "Please try again (type 'exit' if you need to quit)."
      goto bad_HDF5_path
   endif
   #
   tput clear
bad_boost:
   echo " "
   echo "Where is Boost installed? "
   echo "Please point to the top-level directory containing the boost library"
   echo " "
   echo " "
   if ($GMS_HPC_SYSTEM_TARGET == summit) then
      if ( ! ($?OLCF_BOOST_ROOT) ) then
         echo "Found:       Nothing. Boost module not loaded."
      else
         echo "Found:       $OLCF_BOOST_ROOT"
      endif # if olcf boost root
   else if ( ! ($?BOOST_ROOT) ) then
      echo "Found:       Nothing. BOOST_ROOT variable not set or boost module not loaded."
   else
      echo "Found:       $BOOST_ROOT"
   endif # summit
   echo ""
   echo -n " Boost path: "
   set GMS_BOOST_PATH=$<
   if (null$GMS_BOOST_PATH == null) then
      set GMS_BOOST_PATH=$GMS_PATH/libcchem/externals/boost
      echo "Boost path: " $GMS_BOOST_PATH
   else
      set GMS_BOOST_PATH="$GMS_BOOST_PATH"
      echo "Boost path: " $GMS_BOOST_PATH
   endif
   #
   tput clear
bad_ga:
   echo " "
   echo "Where is Global Arrays (GA) installed? "
   echo "Please point to the top-level directory containing the GA library"
   echo " "
   if ( ! ($?GA_ROOT) ) then
      echo "Found:       Nothing. GA_ROOT variable not set or GA module not loaded."
   else
      echo "Found:       $GA_ROOT"
   endif
   echo " "
   echo -n "GA path: "
   set GMS_GA_PATH=$<
   if (null$GMS_GA_PATH == null) then
      set GMS_GA_PATH=$GMS_PATH/libcchem/externals/ga
   else
      set GMS_GA_PATH="$GMS_GA_PATH"
      echo "GA path: " $GMS_GA_PATH
   endif
   #
   tput clear
bad_eigen:
   echo " "
   echo "Where is EIGEN installed?"
   echo "  Please point to the top-level folder containing the Eigen source code."
   echo " "
   echo "  You can visit bit.ly/EigenHome to install Eigen."
   echo " "
   if ( ! ($?EIGEN_ROOT) ) then
      echo "Found:       Nothing. EIGEN_ROOT variable not set or boost module not loaded."
   else
      echo "Found:       $EIGEN_ROOT"
   endif
   echo " "
   echo -n "EIGEN path: "
   set GMS_EIGEN_PATH=$<
   #
   tput clear
   #
   if ("$GMS_LIBCCHEM_GPU" == "false") goto dump_install_info
   #
   tput clear
bad_GPU_board:
   #
   echo "What is your GPU board type?"
   echo "Note, contrary to NVidia terminology, here tesla means only old boards."
   echo "Type the following command to learn your board type:"
   echo "       /usr/bin/nvidia-smi --query | grep 'Product Name'"
   echo "Some typical answers may be"
   echo "       C1060, T10, ...    means an original  'tesla' board, 1.3"
   echo "       C2070, M2090, ...  means a            'fermi' board, 2.0"
   echo "       K20, ...           means a           'kepler' board, 3.5"
   echo "       P100, ...          means a           'pascal' board, 6.0"
   echo "The 'compute capability' column for your board from below:"
   echo "       http://en.wikipedia.org/wiki/NVIDIA_Tesla"
   echo "can be matched against the numbers shown above."
   echo -n "board (tesla,fermi,kepler,pascal,volta): "
   set GMS_CUDA_BOARD=$<
   switch ($GMS_CUDA_BOARD)
      case fermi:
      case tesla:
      case kepler:
      case pascal:
      case volta:
         breaksw
      default:
         echo Unrecognized GPU board, try again.
         goto bad_GPU_board
         breaksw
   endsw
   #
   tput clear
bad_CUDA_path:
   echo " "
   echo "Where is the CUDA software for nVIDIA GPUs installed?"
   echo " "
   echo "The path name will have 'include' and 'lib64' directories below it."
   echo "Typing 'which nvcc' may help locate the right path on your machine."
   echo " "
   if ($GMS_HPC_SYSTEM_TARGET == summit) then
      if ( ! ($?OLCF_CUDA_ROOT) ) then
         echo "Found:       Nothing. CUDA module not loaded."
      else
         echo "Found:       $OLCF_CUDA_ROOT"
      endif #if olcf root
   else if ( ! ($?CUDA_ROOT) ) then
      echo "Found:       Nothing. CUDA module not loaded."
   else
      echo "Found:       $CUDA_ROOT"
   endif #if summit
   echo ""
   echo -n "CUDA path: "
   set GMS_CUDA_PATH=$<
   #
   if ($GMS_CUDA_PATH == exit) then
      set GMS_LIBCCHEM=false
      goto dump_install_info
   endif
   #
   if (-d $GMS_CUDA_PATH/include) then
   else
      echo "That does not appear to be a correct path."
      echo "I don't see the $GMS_CUDA_PATH/include directory."
      echo "Please try again (type 'exit' if you need to quit)."
      goto bad_CUDA_path
   endif
   #
final_comment:
   echo " "
   echo "                Please make a note:"
   echo "   Step-by-step directions for compiling LIBCCHEM can be found in"
   echo "         $GMS_PATH/libcchem/aaa.readme.1st"
   echo -n "Hit <ENTER> once you have jotted down this important file name."
   set reply=$<
   #
endif
#
#     ----- Ask user if they want to build threaded GAMESS -----
#
skip_libcchem_config:
if (($GMS_LIBCCHEM == false) && ($GMS_DDI_COMM != sockets)) then
   tput clear
   echo "OpenMP threading Option"
   echo "======================="
   echo ""
   echo "Users have the option of compiling the OpenMP threaded"
   echo "version of GAMESS."
   echo ""
   echo "The following methods are threaded:"
   echo '* HF (see INTOMP in $INTGRL)'
   echo '* DFT (see BFCTYP in $DFT)'
   echo '* RI-MP2 (see CODE=OMPRIMP2 in $MP2)'
   echo '* RI-CC (see CCERI=RI in $CCINP)'
   echo ""
   echo "This option can be manually changed later by modifying"
   echo "install.info and setting GMS_OPENMP = [true|false]"
   echo ""
   #
   echo -n "Build GAMESS with OpenMP thread support?  (yes/no): "
   set reply=$<
   if(null$reply == null) set reply=no
   if ($reply == no) then
      set GMS_OPENMP=false
   else
      set GMS_OPENMP=true
   endif
endif
#
#    ----- Ask users if they want to build the VeraChem VM2 library
#
tput clear
echo "VeraChem VM2 Option"
echo "======================="
echo ""
echo "Users have the option of linking in the VeraChem VM2 statistical"
echo "mechanics package binary when building GAMESS. The resulting"
echo "GAMESS-VM2 package provides a mining minima free energy calculation"
echo "capability. Dual energy potential (MM and QM) based molecular"
echo "conformational searching and subsequent processing of these conformers"
echo "for temperature effects, e.g. entropic terms, result in a Boltzmann"
echo "weighted conformer ensemble and an associated free energy."
echo "Note that linking VM2 package requires using intel compilers (ifort) "
echo "DATA SERVER will be turned off automatically and  "
echo "dynamic linking of math libray is required, so  change  GMS_MKL_VERNO to 12-so"
echo ""
echo "The VeraChem binary package can be licensed for commercial use,"
echo "and free licensing is also available for purely academic use."
echo "Send requests for the package binary by email to vc@verachem.com or"
echo "through the VeraChem website www.verachem.com."
echo ""
echo -n "Optional: Build GAMESS with VeraChem's VM2 library? (yes/no): "
set reply=$<
if(null$reply == null) set reply=no
if ($reply == no) then
   set GMS_VM2=false
else
   set GMS_VM2=true
echo -n "Please enter the full path for the VM2 executable (VC_CompChemPackage_mpi.a): "
set reply=$<
set VM2LIB="$reply"
endif
#
#    ----- Ask users if they want to build the optional plug-ins
#
tput clear
echo "Tinker Option"
echo "============="
echo ""
echo -n "Optional: Build GAMESS with TINKER plug-in? (yes/no): "
set reply=$<
if(null$reply == null) set reply=no
if ($reply == no) then
   set TINKER=false
else
   set TINKER=true
endif
tput clear
echo "VB2000 Option"
echo "============="
echo ""
echo -n "Optional: Build GAMESS with VB2000 plug-in? (yes/no): "
set reply=$<
if(null$reply == null) set reply=no
if ($reply == no) then
   set VB2000=false
else
   set VB2000=true
endif
tput clear
echo "XMVB Option"
echo "==========="
echo ""
echo -n "Optional: Build GAMESS with XMVB plug-in? (yes/no): "
set reply=$<
if(null$reply == null) set reply=no
if ($reply == no) then
   set XMVB=false
else
   set XMVB=true
endif
tput clear
echo "NEO Option"
echo "=========="
echo ""
echo -n "Optional: Build GAMESS with NEO plug-in? (yes/no): "
set reply=$<
if(null$reply == null) set reply=no
if ($reply == no) then
   set NEO=false
else
   set NEO=true
endif
tput clear
echo "NBO Option"
echo "=========="
echo ""
echo -n "Optional: Build GAMESS with NBO plug-in? (yes/no): "
set reply=$<
if(null$reply == null) set reply=no
if ($reply == no) then
   set NBO=false
else
   set NBO=true
endif
#
#    ----- Step 5: output what we learned into a 'configuration file' -----
#
dump_install_info:
#
#    development vs. production environment
#
if (! -d $GMS_PATH/.git ) then
    set GMS_FPE_FLAGS=""
endif
#
set cf=$GMS_BUILD_DIR/install.info
#
echo '#\!/bin/csh -f' > $cf
echo " "                                                   >> $cf
echo "#   Compilation configuration for GAMESS"            >> $cf
echo "#   Generated on `hostname`"                         >> $cf
echo "#   Generated at `date`"                             >> $cf
echo " "                                                   >> $cf
echo "#                 GAMESS Paths                     #">> $cf
echo "setenv GMS_PATH              $GMS_PATH"              >> $cf
echo "setenv GMS_BUILD_DIR         $GMS_BUILD_DIR"         >> $cf
echo " "                                                   >> $cf
echo "#                  Machine Type                    #">> $cf
echo "setenv GMS_TARGET            $GMS_TARGET"            >> $cf
echo "setenv GMS_HPC_SYSTEM_TARGET $GMS_HPC_SYSTEM_TARGET" >> $cf
   if (null$GMS_BG_MODEL != null) \
echo "setenv GMS_BG_MODEL          $GMS_BG_MODEL"          >> $cf
   if (null$GMS_MAC_OSX_VERNO != null) \
echo "setenv GMS_MAC_OSX_VERNO     $GMS_MAC_OSX_VERNO"     >> $cf
echo " "                                                   >> $cf
echo "#              FORTRAN Compiler Setup              #">> $cf
echo "setenv GMS_FORTRAN           $GMS_FORTRAN"           >> $cf
   if (null$GMS_GFORTRAN_VERNO != null) \
echo "setenv GMS_GFORTRAN_VERNO    $GMS_GFORTRAN_VERNO"    >> $cf
   if ($GMS_TARGET == ibm64) then
echo "setenv GMS_XL_PATH           $GMS_XL_PATH"           >> $cf
   endif
   if (null$GMS_IFORT_VERNO != null) \
echo "setenv GMS_IFORT_VERNO       $GMS_IFORT_VERNO"       >> $cf
   if ($GMS_FORTRAN == aocc) then
echo "setenv GMS_DRAGONEGG_PATH    $GMS_DRAGONEGG_PATH"    >> $cf
echo "setenv GMS_AMD_LIBM_PATH     $GMS_AMD_LIBM_PATH"     >> $cf
   endif
   if (null$GMS_L64_OPT != null)  then
echo "#         PGI/Linux 64 optimization level          #">> $cf
echo "setenv GMS_L64_OPT           $GMS_L64_OPT"           >> $cf
echo "#         PGI/Linux 64 compiler flags              #">> $cf
echo "setenv GMS_LIN_FLAGS         $GMS_LIN_FLAGS"         >> $cf
   endif
   if ($GMS_L64_OPT == testing)  then
echo "#         PGI specific compiler flags              #">> $cf
echo "setenv GMS_PGI_OPT           $GMS_PGI_OPT"           >> $cf
echo "setenv GMS_IPA_OPT           $GMS_IPA_OPT"           >> $cf
   endif
   if ($GMS_TARGET == win64) then
echo "#         Windows optimization level               #">> $cf
echo "setenv GMS_WIN_OPT           $GMS_WIN_OPT"           >> $cf
echo "#         Windows compiler flags                   #">> $cf
echo "setenv GMS_WIN_FLAGS         $GMS_WIN_FLAGS"         >> $cf
echo "setenv GMS_WIN_TP            $GMS_WIN_TP"            >> $cf
      if ($GMS_FORTRAN == ifort || $GMS_FORTRAN == oneapi-ifort || $GMS_FORTRAN == oneapi-ifx) then
echo "#         INTEL specific compiler flags            #">> $cf
echo "setenv GMS_INT_OPT           $GMS_INT_OPT"           >> $cf
echo "setenv GMS_IPO_OPT           $GMS_IPO_OPT"           >> $cf
      else if ($GMS_FORTRAN == aocc) then
echo "setenv GMS_DRAGONEGG_PATH    $GMS_DRAGONEGG_PATH"    >> $cf
echo "setenv GMS_AMD_LIBM_PATH     $GMS_AMD_LIBM_PATH"     >> $cf
      else
echo "#         PGI specific compiler flags"               >> $cf
echo "setenv GMS_PGI_OPT           $GMS_PGI_OPT"           >> $cf
echo "setenv GMS_IPA_OPT           $GMS_IPA_OPT"           >> $cf
      endif
   endif
echo " "                                                   >> $cf
echo "#         Mathematical Library Setup               #">> $cf
echo "setenv GMS_MATHLIB           $GMS_MATHLIB"           >> $cf
   if (($GMS_TARGET  == win64) && ($GMS_MATHLIB == mkl)) then
      if (null"$GMS_MATHLIB_PATH" != null) \
echo 'setenv GMS_MATHLIB_PATH    "'"$GMS_MATHLIB_PATH"'"'  >> $cf
   else
      if (null$GMS_MATHLIB_PATH != null) \
echo "setenv GMS_MATHLIB_PATH      $GMS_MATHLIB_PATH"      >> $cf
   endif
   if (null$GMS_MKL_VERNO != null) \
echo "setenv GMS_MKL_VERNO         $GMS_MKL_VERNO"         >> $cf
   if ($GMS_MATHLIB == libflame) \
echo "setenv GMS_AMD_BLAS_PATH     $GMS_AMD_BLAS_PATH"     >> $cf
echo "#         parallel message passing model setup"      >> $cf
echo "setenv GMS_DDI_COMM          $GMS_DDI_COMM"          >> $cf
   if (null$GMS_MPI_LIB != null) \
echo "setenv GMS_MPI_LIB           $GMS_MPI_LIB"           >> $cf
   if (($GMS_TARGET  == win64) && ($GMS_MPI_LIB == impi)) then
      if (null"$GMS_MPI_PATH" != null) \
echo 'setenv GMS_MPI_PATH        "'"$GMS_MPI_PATH"'"'      >> $cf
   else
      if (null$GMS_MPI_PATH != null) \
echo "setenv GMS_MPI_PATH          $GMS_MPI_PATH"          >> $cf
   endif
   if ($GMS_MPI_LIB == mvapich2) \
echo "setenv GMS_MVAPICH2_VERNO    $GMS_MVAPICH2_VERNO"    >> $cf
   if (null$GMS_OFED_PATH != null) \
echo "setenv GMS_OFED_PATH         $GMS_OFED_PATH"         >> $cf
   if (null$GMS_ARMCI_PATH != null) \
echo "setenv GMS_ARMCI_PATH        $GMS_ARMCI_PATH"        >> $cf
echo " "                                                   >> $cf
echo "#     Michigan State University Coupled Cluster    #">> $cf
echo "setenv GMS_MSUCC             $GMS_MSUCC"             >> $cf
echo " "                                                   >> $cf
echo "#         LIBCCHEM CPU/GPU Code Interface          #">> $cf
echo "setenv GMS_LIBCCHEM          $GMS_LIBCCHEM"          >> $cf
   if ("$GMS_LIBCCHEM" == "true") then
echo "setenv GMS_LIBCCHEM_GPU_SUPPORT $GMS_LIBCCHEM_GPU"   >> $cf
echo "setenv GMS_CCHEM_HF          $GMS_CCHEM_HF"          >> $cf
echo "setenv GMS_CCHEM_MP2         $GMS_CCHEM_MP2"         >> $cf
echo "setenv GMS_CCHEM_RI          $GMS_CCHEM_RI"          >> $cf
echo "setenv GMS_CCHEM_CC          $GMS_CCHEM_CC"          >> $cf
echo "setenv GMS_HDF5_PATH         $GMS_HDF5_PATH"         >> $cf
      if ("$GMS_LIBCCHEM_GPU" == "true") then
echo "setenv GMS_CUDA_BOARD        $GMS_CUDA_BOARD"        >> $cf
echo "setenv GMS_CUDA_PATH         $GMS_CUDA_PATH"         >> $cf
      endif
echo "setenv GMS_LIBCCHEM_LIBS     $GMS_LIBCCHEM_LIBS"     >>$cf
echo "setenv GMS_EIGEN_PATH        $GMS_EIGEN_PATH"        >>$cf
echo "setenv GMS_BOOST_PATH        $GMS_BOOST_PATH"        >>$cf
echo "setenv GMS_GA_PATH           $GMS_GA_PATH"           >>$cf
   endif
   if ($GMS_TARGET == singularity) then
echo "#             Singularity Setup                    #">> $cf
echo "setenv GMS_CONTAINER         $GMS_CONTAINER"         >> $cf
echo "setenv GMS_CONTAINER_PATH    $GMS_PATH"              >> $cf
   endif
echo " "                                                   >> $cf
echo "#      Intel Xeon Phi Build: none/knc/knl          #">> $cf
echo "setenv GMS_PHI               $GMS_PHI"               >> $cf
echo " "                                                   >> $cf
echo "#         Shared Memory Type: sysv/posix           #">> $cf
echo "setenv GMS_SHMTYPE           $GMS_SHMTYPE"           >> $cf
echo " "                                                   >> $cf
echo "#      GAMESS OpenMP support: true/false           #">> $cf
echo "setenv GMS_OPENMP            $GMS_OPENMP"            >> $cf
echo " "                                                   >> $cf
echo "#      GAMESS LibXC library: true/false            #">> $cf
echo "setenv GMS_LIBXC             $GMS_LIBXC"             >> $cf
echo " "                                                   >> $cf
echo "#      GAMESS MDI library: true/false              #">> $cf
echo "setenv GMS_MDI               $GMS_MDI"               >> $cf
echo " "                                                   >> $cf
echo "#       VM2 library: true/false                    #">> $cf
echo "setenv  GMS_VM2              $GMS_VM2"               >> $cf
   if ($GMS_VM2 == true) then
echo "setenv  VM2LIB               $VM2LIB"                >> $cf
   endif
echo " "                                                   >> $cf
echo "#       Tinker: true/false                         #">> $cf
echo "setenv  TINKER               $TINKER"                >> $cf
echo " "                                                   >> $cf
echo "#       VB2000: true/false                         #">> $cf
echo "setenv  VB2000               $VB2000"                >> $cf
echo " "                                                   >> $cf
echo "#       XMVB: true/false                           #">> $cf
echo "setenv  XMVB                 $XMVB"                  >> $cf
echo " "                                                   >> $cf
echo "#       NEO: true/false                            #">> $cf
echo "setenv  NEO                  $NEO"                   >> $cf
echo " "                                                   >> $cf
echo "#       NBO: true/false                            #">> $cf
echo "setenv  NBO                  $NBO"                   >> $cf
echo " "                                                   >> $cf
echo "####################################################">> $cf
echo "# Added any additional environmental variables or  #">> $cf
echo "# module loads below if needed.                    #">> $cf
echo "####################################################">> $cf
echo "# Capture floating-point exceptions                #">> $cf
echo "setenv GMS_FPE_FLAGS        '$GMS_FPE_FLAGS'        ">> $cf
echo " "                                                   >> $cf
   if ($GMS_OPENMP == true) then
echo "# You will want to adjust OMP_NUM_THREADS to       #">> $cf
echo "# reflect your desired run settings.               #">> $cf
echo "# Note that a conditional is in place to           #">> $cf
echo "# prevent this value from overriding your          #">> $cf
echo "# current environment if the variable exist.       #">> $cf
echo " "                                                   >> $cf
echo 'if (! $?OMP_NUM_THREADS ) setenv OMP_NUM_THREADS 8'  >> $cf
echo " "                                                   >> $cf
echo "# Increase OMP_STACKSIZE if you are SEGFAULTing#"    >> $cf
echo 'if (! $?OMP_STACKSIZE ) setenv OMP_STACKSIZE   1G'   >> $cf
   endif
if ($GMS_MATHLIB == pgiblas) then
  if ($GMS_OPENMP == false) then
    echo " "                                                   >> $cf
    echo "# Need to set OMP_NUM_THREADS if using PGI BLAS    #">> $cf
    echo "# For parallel runs set number of threads to 1     #">> $cf
    echo "# Serial runs may benefit larger thread values     #">> $cf
    echo 'if (! $?OMP_NUM_THREADS ) setenv OMP_NUM_THREADS 1'  >> $cf
  endif
endif
tput clear
echo "Your configuration for GAMESS compilation is now in"
echo "     $cf"
echo "Now, please follow the directions in"
echo "     $GMS_PATH/machines/readme.unix"
#
#   Generate a Makefile in $GMS_BUILD_DIR
#
set makef=$GMS_BUILD_DIR/Makefile
echo "GMS_PATH = $GMS_PATH" > $makef
echo "GMS_VERSION = $GMS_VERSION" >> $makef
echo 'include $(GMS_PATH)/Makefile.in' >> $makef
