Skip to content

Instantly share code, notes, and snippets.

@pgbarletta
Created August 20, 2020 23:59
Show Gist options
  • Save pgbarletta/81cc016d1bcc903b6c963eb78e64651e to your computer and use it in GitHub Desktop.
Save pgbarletta/81cc016d1bcc903b6c963eb78e64651e to your computer and use it in GitHub Desktop.
configure
# Compatibility config.h generated by the CMake build system
###############################################################################
# (1) Location of the installation
BASEDIR=/usr/local/amber20_src/build
AMBER_PREFIX=/usr/local/amber20//
BINDIR=$(AMBER_PREFIX)/bin
LIBDIR=$(AMBER_PREFIX)/lib
INCDIR=$(AMBER_PREFIX)/include
DATDIR=$(AMBER_PREFIX)/dat
LOGDIR=$(AMBER_PREFIX)/logs
AMBER_SOURCE=$(AMBERHOME)
###############################################################################
FLIBS=-L/usr/lib/x86_64-linux-gnu -lsff -lpbsa -lrism -lfftw3 -lblas -llapack -larpack -lm -lnetcdf
FLIBSF=-L/usr/lib/x86_64-linux-gnu -lblas -llapack -larpack -lm -l/usr/local/amber20_src/build/AmberTools/src/xblas/build/libxblas-amb.a
FLIBS_MPI=
###############################################################################
BUILDAMBER=
SHELL=/bin/bash
CC=/usr/bin/gcc
CFLAGS= -Wall -Wno-unused-function -Wno-unknown-pragmas -Wno-unused-variable -Wno-unused-but-set-variable
CNOOPTFLAGS=
COPTFLAGS=-O3 -mtune=native
CXX=/usr/bin/g++
CXXFLAGS= -Wall -Wno-unused-function -Wno-unknown-pragmas -Wno-unused-local-typedefs -Wno-unused-variable -Wno-unused-but-set-variable
CXXNOOPTFLAGS=
CXXOPTFLAGS=-O3 -mtune=native
MV=mv
RM=rm
CP=cp
FC=/usr/bin/gfortran
FFLAGS= -Wall -Wno-tabs -Wno-unused-function -ffree-line-length-none -Wno-unused-dummy-argument -Wno-unused-variable
FNOOPTFLAGS=
FOPTFLAGS=-O3 -mtune=native
# pmemd.gem is always enabled in NetCDF builds
PMEMD_GEM=yes
LDFLAGS=
# NetCDF is always enabled in CMake builds
NETCDF=yes
EMIL=EMIL
FEP_MODE=gti
COMPILER=GNU
MKL=
PYTHON=/usr/local/amber20//miniconda/bin/python
SKIP_PYTHON=no
# OS-specific rules for making shared objects
SHARED_SUFFIX=.so
# used by tests
INSTALLTYPE=serial
TESTRISMSFF=testrism
FEP_MODE=gti
#!/bin/sh
error() {
echo "Configure failed due to the errors above!"
exit 1
}
check_amberhome() {
if [ -z "$AMBERHOME" ]; then
echo ""
echo "Your AMBERHOME environment variable is not set! Auto set it to: "
echo "$1"
export AMBERHOME=$1
elif [ ! -d $AMBERHOME ]; then
echo ""
echo "Your AMBERHOME environment variable is set to $AMBERHOME -- this does"
echo "not appear to be a directory. It should be set to $1"
echo "NOT doing so may cause errors when you compile"
exit 1
elif [ ! "$AMBERHOME" = "$1" -a ! "$AMBERHOME" = "${1}/" ]; then
if [ "`uname -s|awk '{print $1}'`" = 'Darwin' ] ; then
statcmd='stat -f'
else
statcmd='stat -c'
fi
#try checking the inode incase there is a problem with symlinks
if [ `$statcmd "%i" $AMBERHOME` != `$statcmd "%i" ${1}` ]; then
echo ""
echo "Error: AMBERHOME is expected to be $amberhome but it is currently"
echo " $AMBERHOME This will cause problems!"
exit 1
fi
fi
}
amberhome="`pwd`"
check_amberhome "$amberhome"
# Check for --no-updates in any position
updates="yes"
requested_help="no"
for var in "$@"; do
case "$var" in
--no-updates)
echo "Skipping check for Amber updates"; updates="no";;
-h|-H|--h|--he|--hel|--help|-help)
updates="no"; requested_help="yes";;
-fullhelp|--full|--fullhelp|--full-h|--full-he|--full-hel|--full-help)
updates="no"; requested_help="yes";;
esac
done
# No arguments means we ask for help
if [ $# -eq 0 ]; then
requested_help="yes"
updates="no"
fi
python=`which python 2>/dev/null`
if [ -z "$python" ]; then
python=`which python3 2>/dev/null`
if [ -z "$python" ]; then
echo "There is no python or python3 in your PATH; skipping test for updates"
updates="no"
fi
fi
if [ "$updates" = "yes" ]; then
# Tell people we're checking for updates, since this could take a
# couple seconds, especially if ambermd.org is down
echo "Checking for updates..."
# Check to see if there are any updates available. This will print a message
# giving how many patches are available for Amber and AmberTools
"$python" ./update_amber --check-updates
# The return code of the above command tells us what happened. Return 1 for
# an error, and return 2 if there are patches available
ret_code=$?
if [ $ret_code -eq 2 ]; then
printf "There are patches available. Do you want to apply them now? [y/N]"
echo " (Recommended Y) "
read answer
ans=`echo $answer | awk '{print substr($1,1,1)}'`
if [ "$ans" = "y" -o "$ans" = "Y" ]; then
# Since patch_amber may patch itself and quit before applying all patches,
# continue to check for updates and update the tree until they have all
# been applied.
while [ $ret_code -eq 2 ]
do
"$python" ./update_amber --update
if [ $? -ne 0 ]; then
echo "Automatic patching failed! Check the errors before re-configuring"
exit 1
fi
"$python" ./update_amber --check-updates 2>&1 > /dev/null
ret_code=$?
done
else
echo "NOT updating your tree and continuing anyway."
fi
elif [ $ret_code -eq 1 ]; then
echo "Check for updates failed."
fi
fi
# Simple redirection to carry out the configure script inside AmberTools/src
echo ""
(cd AmberTools/src && ./configure2 $@) || error
# Bail out if we just got the usage statement
if [ "$requested_help" = "yes" ]; then
exit 0
fi
ln -sf AmberTools/src/config.h .
# Make clean here
echo "Cleaning the src directories. This may take a few moments."
make clean > /dev/null 2>&1
echo "Configure complete."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment