Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 24 additions & 8 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ REBUILDOPT='' # Can be set to --rebuild and passed to get_library.sh
BUILDTESTOPT='silent' # Set to blank to avoid asking about building libraries
INSTALL_DAT='install_dat' # Target for installing data directory
SPECIFIED_LIB_DIR='' # Specified library directory
LIBDIR='lib' # Set by SetLibDir() to lib or lib64
#CPPTRAJSRC='' # CPPTRAJ source directory
COMPERR='cpptrajcfg.compile.err'
COMPOUT='cpptrajcfg.compile.out'
Expand Down Expand Up @@ -425,6 +426,17 @@ WrnMsg() {
>&2 echo "Warning: $*"
}

#-------------------------------------------------------------------------------
# SetLibDir <prefix> <lib>
# Search for <prefix>/lib64/<lib> and set LIBDIR to lib64 if found.
SetLibDir() {
LIBDIR='lib'
checklibfile="$1/lib64/$2"
if [ -f "$checklibfile" ] ; then
LIBDIR='lib64'
fi
}

#-------------------------------------------------------------------------------
# Check for '--with' and '-no' library keys.
CheckLibraryKeys() {
Expand Down Expand Up @@ -686,17 +698,19 @@ EOF
nc_requires_hdf5_flags=0
lhdf5_hl='-lhdf5_hl'
lhdf5='-lhdf5'
SetLibDir "${LIB_HOME[$LHDF5]}" "libhdf5_hl.a"
if [ ! -z "${LIB_HOME[$LHDF5]}" ] ; then
if [ -f "${LIB_HOME[$LHDF5]}/lib/libhdf5_hl.a" ] ; then
lhdf5_hl=${LIB_HOME[$LHDF5]}/lib/libhdf5_hl.a
if [ -f "${LIB_HOME[$LHDF5]}/$LIBDIR/libhdf5_hl.a" ] ; then
lhdf5_hl=${LIB_HOME[$LHDF5]}/$LIBDIR/libhdf5_hl.a
fi
if [ -f "${LIB_HOME[$LHDF5]}/lib/libhdf5.a" ] ; then
lhdf5=${LIB_HOME[$LHDF5]}/lib/libhdf5.a
if [ -f "${LIB_HOME[$LHDF5]}/$LIBDIR/libhdf5.a" ] ; then
lhdf5=${LIB_HOME[$LHDF5]}/$LIBDIR/libhdf5.a
fi
fi
if [ "${LIB_STAT[$LNETCDF]}" = 'specified' ] ; then
export LD_LIBRARY_PATH="${LIB_HOME[$LNETCDF]}/lib:$LD_LIBRARY_PATH"
if [ ! -f "${LIB_HOME[$LNETCDF]}/lib/libnetcdf.so" -a -f "${LIB_HOME[$LNETCDF]}/lib/libnetcdf.a" ] ; then
SetLibDir "${LIB_HOME[$LNETCDF]}" "libnetcdf.a"
if [ ! -f "${LIB_HOME[$LNETCDF]}/$LIBDIR/libnetcdf.so" -a -f "${LIB_HOME[$LNETCDF]}/$LIBDIR/libnetcdf.a" ] ; then
#echo "DEBUG: Only static NetCDF library is present."
nc_requires_hdf5_flags=1
hdf5_flags="$lhdf5_hl $lhdf5 -ldl ${LIB_FLAG[$LZIP]}"
Expand Down Expand Up @@ -738,9 +752,10 @@ EOF
if [ $? -ne 0 ] ; then
if [ "${LIB_STAT[$LHDF5]}" = 'enabled' ] ; then
# See if there is already a version of HDF5 in CPPTRAJHOME
SetLibDir "$CPPTRAJHOME" "libhdf5_hl.a"
LIB_STAT[$LHDF5]='specified'
LIB_HOME[$LHDF5]=$CPPTRAJHOME
LIB_FLAG[$LHDF5]="$CPPTRAJHOME/lib/libhdf5_hl.a $CPPTRAJHOME/lib/${LIB_STTC[$LHDF5]} -ldl ${LIB_FLAG[$LZIP]}"
LIB_FLAG[$LHDF5]="$CPPTRAJHOME/$LIBDIR/libhdf5_hl.a $CPPTRAJHOME/$LIBDIR/${LIB_STTC[$LHDF5]} -ldl ${LIB_FLAG[$LZIP]}"
LIB_INCL[$LHDF5]="-I$CPPTRAJHOME/include"
TestProgram $BUILDTESTOPT " Checking for bundled HDF5" "$CXX" "$CXXFLAGS ${LIB_INCL[$LHDF5]}" testp.cpp "${LIB_FLAG[$LHDF5]}"
if [ $? -ne 0 ] ; then
Expand Down Expand Up @@ -784,11 +799,12 @@ EOF
rebuild_netcdf='--rebuild'
fi
if [ $check_netcdf -ne 0 -o "${LIB_MAKE[$LNETCDF]}" == 'yes' ] ; then
SetLibDir "$CPPTRAJHOME" "${LIB_STTC[$LNETCDF]}"
if [ "${LIB_STAT[$LNETCDF]}" = 'enabled' ] ; then
# See if there is already a version of NetCDF in CPPTRAJHOME
LIB_STAT[$LNETCDF]='specified'
LIB_HOME[$LNETCDF]=$CPPTRAJHOME
LIB_FLAG[$LNETCDF]=$CPPTRAJHOME/lib/${LIB_STTC[$LNETCDF]}
LIB_FLAG[$LNETCDF]=$CPPTRAJHOME/$LIBDIR/${LIB_STTC[$LNETCDF]}
LIB_INCL[$LNETCDF]="-I$CPPTRAJHOME/include"
if [ "${LIB_STAT[$LHDF5]}" != 'off' ] ; then
# Netcdf needs to know where hdf5 is
Expand All @@ -809,7 +825,7 @@ EOF
echo "Overriding MAKE_COMMAND with 'make -j1' to avoid NetCDF4/HDF5 race conditions."
fi
PREFIX=$CPPTRAJHOME CC=$CC CFLAGS=$CFLAGS LIBNAME='netcdf' MAKE_COMMAND='make -j1' \
CPPFLAGS=${LIB_INCL[$LHDF5]} LDFLAGS="-L$CPPTRAJHOME/lib" \
CPPFLAGS=${LIB_INCL[$LHDF5]} LDFLAGS="-L$CPPTRAJHOME/$LIBDIR" \
SRCDIR=$NETCDF_SRCDIR SRCTAR=$NETCDF_SRCTAR URL=$NETCDF_URL ./get_library.sh $rebuild_netcdf $NETCDF4_OPTS
netcdferr=$?
else
Expand Down