Commit 11e3723f authored by Mark Olesen's avatar Mark Olesen
Browse files

ENH: improve test for existing libraries (fixes #56)

- check lib as well as lib64

- support -force option in a few more places
parent 9a8a4852
......@@ -27,15 +27,23 @@ if [ "$1" = "-test" ]
then
[ "$#" -eq 2 ] || { echo "${0##*/} -test : needs 1 argument"; exit 1; }
dir="${2%/}" # <- *_ARCH_PATH
if [ -d "$dir/include" ] \
&& [ -r "$dir/lib$WM_COMPILER_LIB_ARCH/libadios2$EXT_SO" ]
then
echo " adios2 include: $dir/include"
echo " adios2 library: $dir/lib$WM_COMPILER_LIB_ARCH"
exit 0
else
exit 2
fi
[ -d "$dir/include" ] || exit 2
package="adios2"
libName="libadios2"
for lib in \
"$dir/lib/$libName$EXT_SO" \
"$dir/lib$WM_COMPILER_LIB_ARCH/$libName$EXT_SO" \
;
do
if [ -r "$lib" ]
then
echo " $package include: $dir/include"
echo " $package library: ${lib%/*}"
exit 0
fi
done
exit 2
fi
#------------------------------------------------------------------------------
# Run from third-party directory only
......@@ -135,10 +143,12 @@ echo
# - for mpi-specific library locations
if [ -z "$optForce" ] \
&& [ -f "$ADIOS2_ARCH_PATH/include/adios2.h" ] \
&& [ -r "$ADIOS2_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libadios2$EXT_SO" ]
&& {
[ -r "$ADIOS2_ARCH_PATH/lib/libadios2$EXT_SO" ] \
|| [ -r "$ADIOS2_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libadios2$EXT_SO" ]
}
then
echo " ADIOS2 header in $ADIOS2_ARCH_PATH/include"
echo " ADIOS2 libs in $ADIOS2_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH"
echo " ADIOS2 already built : $ADIOS2_ARCH_PATH"
else
# CMake options often lag the configure ones
echo "Starting build: $adiosPACKAGE (using cmake)"
......
......@@ -35,7 +35,10 @@ if [ "$1" = "-test" ]
then
[ "$#" -eq 3 ] || { echo "${0##*/} -test : needs 2 argument"; exit 1; }
dir="${2%/}" # <- *_ARCH_PATH
if [ -d "$dir/include" ] && [ -r "$dir/lib$WM_COMPILER_LIB_ARCH/libCGAL$EXT_SO" ]
[ -d "$dir/include" ] || exit 2
# 2020-08-10: Needs reworking for header-only installations!
if [ -r "$dir/lib$WM_COMPILER_LIB_ARCH/libCGAL$EXT_SO" ]
then
echo " CGAL include: $dir/include"
echo " CGAL library: $dir/lib$WM_COMPILER_LIB_ARCH"
......@@ -115,7 +118,7 @@ USAGE
#------------------------------------------------------------------------------
exportCompiler # Compiler info for CMake/configure
unset optHeadersOnly optToolset
unset optForce optHeadersOnly optToolset
# Parse options
while [ "$#" -gt 0 ]
......@@ -124,6 +127,7 @@ do
'') ;; # Ignore empty
-h | -help) usage ;;
-gcc) useGcc ;;
-force) optForce=true ;;
-cmake)
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
......@@ -243,16 +247,17 @@ then
fi
# Use lib/ when lib64/ does not exist
[ ! -d "$boostLib" -a -d "$libdir" ] && boostLib="$libdir"
[ -d "$libdir" -a ! -d "$boostLib" ] && boostLib="$libdir"
elif [ -f "$boostInc/boost/version.hpp" ]
elif [ -z "$optForce" ] \
&& [ -f "$boostInc/boost/version.hpp" ]
then
echo "Using $boostPACKAGE"
libdir="$BOOST_ARCH_PATH/lib"
# Use lib when lib64 does not exist
[ ! -d "$boostLib" -a -d "$libdir" ] && boostLib="$libdir"
[ -d "$libdir" -a ! -d "$boostLib" ] && boostLib="$libdir"
else
echo "Starting build: $boostPACKAGE"
......@@ -263,11 +268,7 @@ else
# Configuration options:
unset buildOpt
cd "$BOOST_SOURCE_DIR" || exit
export GIT_DIR="$PWD/.git" # Mask seeing our own git-repo
rm -rf $BOOST_ARCH_PATH
# Compiler-specific adjustments
case "$WM_COMPILER" in
(Arm*)
# Toolset for bootstrap
......@@ -306,6 +307,14 @@ else
;;
esac
# End of configuration options
# ----------------------------
cd "$BOOST_SOURCE_DIR" || exit
export GIT_DIR="$PWD/.git" # Mask seeing our own git-repo
rm -rf "$BOOST_ARCH_PATH"
./bootstrap.sh \
--prefix="$BOOST_ARCH_PATH" \
--libdir="$boostLib" \
......@@ -481,13 +490,13 @@ cgalIsCurrent()
}
if cgalIsCurrent
if [ -z "$optForce" ] \
&& cgalIsCurrent
then
echo " ${CGAL_ARCH_PATH##*/} build appears to be up-to-date - skipping"
echo
exit 0
fi
else
(
# Remove any existing build folder and recreate
if [ -d "$CGAL_BUILD_DIR" ]
......@@ -604,6 +613,7 @@ CMAKE_OPTIONS
unset cmakeDefs
# Compiler-specific adjustments
case "$WM_COMPILER" in
(Mingw*)
cmakeDefs="$cmakeDefs -DCMAKE_SYSTEM_NAME=Windows"
......@@ -658,5 +668,6 @@ CMAKE_OPTIONS
echo "Done CGAL"
)
fi
#------------------------------------------------------------------------------
......@@ -28,15 +28,23 @@ if [ "$1" = "-test" ]
then
[ "$#" -eq 2 ] || { echo "${0##*/} -test : needs 1 argument"; exit 1; }
dir="${2%/}" # <- *_ARCH_PATH
if [ -d "$dir/include" ] \
&& [ -r "$dir/lib$WM_COMPILER_LIB_ARCH/libfftw3$EXT_SO" ]
then
echo " fftw include: $dir/include"
echo " fftw library: $dir/lib$WM_COMPILER_LIB_ARCH"
exit 0
else
exit 2
fi
[ -d "$dir/include" ] || exit 2
package="fftw"
libName="libfftw3"
for lib in \
"$dir/lib/$libName$EXT_SO" \
"$dir/lib$WM_COMPILER_LIB_ARCH/$libName$EXT_SO" \
;
do
if [ -r "$lib" ]
then
echo " $package include: $dir/include"
echo " $package library: ${lib%/*}"
exit 0
fi
done
exit 2
fi
#------------------------------------------------------------------------------
# Run from third-party directory only
......@@ -127,9 +135,13 @@ FFTW_SOURCE_DIR=$sourceBASE/$fftwPACKAGE
FFTW_ARCH_PATH=$installBASE/$fftwPACKAGE
if [ -z "$optForce" ] \
&& [ -r "$FFTW_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libfftw3$EXT_SO" ]
&& {
[ -r "$FFTW_ARCH_PATH/lib/libfftw3$EXT_SO" ] \
|| [ -r "$FFTW_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libfftw3$EXT_SO" ] \
|| [ -r "$FFTW_ARCH_PATH/bin/libfftw3-3$EXT_SO" ] # Windows
}
then
echo "Already has FFTW shared library"
echo "FFTW already built : $FFTW_ARCH_PATH"
else
echo "Starting build: FFTW ($fftwPACKAGE)"
echo
......
......@@ -28,24 +28,25 @@ if [ "$1" = "-test" ]
then
[ "$#" -eq 2 ] || { echo "${0##*/} -test : needs 1 argument"; exit 1; }
dir="${2%/}" # <- *_ARCH_PATH
if [ -d "$dir/include" ]
then
for lib in \
$FOAM_EXT_LIBBIN/libkahip$EXT_SO \
$dir/lib/libkahip.a \
$dir/lib/libkahip$EXT_SO \
$dir/lib$WM_COMPILER_LIB_ARCH/libkahip.a \
$dir/lib$WM_COMPILER_LIB_ARCH/libkahip$EXT_SO \
;
do
if [ -r "$lib" ]
then
echo " kahip include: $dir/include"
echo " kahip library: ${lib%/*}"
exit 0
fi
done
fi
[ -d "$dir/include" ] || exit 2
package="kahip"
libName="libkahip"
for lib in \
"$FOAM_EXT_LIBBIN/$libName$EXT_SO" \
"$dir/lib/$libName.a" \
"$dir/lib/$libName$EXT_SO" \
"$dir/lib$WM_COMPILER_LIB_ARCH/$libName.a" \
"$dir/lib$WM_COMPILER_LIB_ARCH/$libName$EXT_SO" \
;
do
if [ -r "$lib" ]
then
echo " $package include: $dir/include"
echo " $package library: ${lib%/*}"
exit 0
fi
done
exit 2
fi
#------------------------------------------------------------------------------
......
......@@ -28,24 +28,25 @@ if [ "$1" = "-test" ]
then
[ "$#" -eq 2 ] || { echo "${0##*/} -test : needs 1 argument"; exit 1; }
dir="${2%/}" # <- *_ARCH_PATH
if [ -d "$dir/include" ]
then
for lib in \
$FOAM_EXT_LIBBIN/libmetis$EXT_SO \
$dir/lib/libmetis.a \
$dir/lib/libmetis$EXT_SO \
$dir/lib$WM_COMPILER_LIB_ARCH/libmetis.a \
$dir/lib$WM_COMPILER_LIB_ARCH/libmetis$EXT_SO \
;
do
if [ -r "$lib" ]
then
echo " metis include: $dir/include"
echo " metis library: ${lib%/*}"
exit 0
fi
done
fi
[ -d "$dir/include" ] || exit 2
package="metis"
libName="libmetis"
for lib in \
"$FOAM_EXT_LIBBIN/$libName$EXT_SO" \
"$dir/lib/$libName.a" \
"$dir/lib/$libName$EXT_SO" \
"$dir/lib$WM_COMPILER_LIB_ARCH/$libName.a" \
"$dir/lib$WM_COMPILER_LIB_ARCH/$libName$EXT_SO" \
;
do
if [ -r "$lib" ]
then
echo " $package include: $dir/include"
echo " $package library: ${lib%/*}"
exit 0
fi
done
exit 2
fi
#------------------------------------------------------------------------------
......
......@@ -138,12 +138,13 @@ install()
# - for shared library
# - for mpi-specific library locations
if [ -z "$optForce" ] \
&& [ -f "$MGRIDGEN_ARCH_PATH/include/mgridgen.h" \
&& [ -r "$MGRIDGEN_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libmgrid.a" ]
&& [ -f "$MGRIDGEN_ARCH_PATH/include/mgridgen.h" ] \
&& {
[ -r "$MGRIDGEN_ARCH_PATH/lib/libmgrid.a" ] \
|| [ -r "$MGRIDGEN_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libmgrid.a" ]
}
then
echo " MGridGen header in $MGRIDGEN_ARCH_PATH/include"
echo " MGridGen libs in $MGRIDGEN_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH" # static
echo
echo " MGridGen already built : $MGRIDGEN_ARCH_PATH"
else
(
cd "$MGRIDGEN_SOURCE_DIR" || exit
......
......@@ -28,18 +28,24 @@ if [ "$1" = "-test" ]
then
[ "$#" -eq 2 ] || { echo "${0##*/} -test : needs 1 argument"; exit 1; }
dir="${2%/}" # <- *_ARCH_PATH
if [ -r "$dir/lib$WM_COMPILER_LIB_ARCH/libmpi$EXT_SO" ]
then
echo "Have mpich shared library (${dir##*/})"
exit 0
elif [ -r "$dir/lib$WM_COMPILER_LIB_ARCH/libmpi.a" ]
then
echo "Have mpich static library (${dir##*/})"
exit 0
else
echo "No mpich libraries found: ${dir:-not-specified}"
exit 2
fi
package="mpich"
libName="libmpi"
for lib in \
"$dir/lib/$libName.a" \
"$dir/lib/$libName$EXT_SO" \
"$dir/lib$WM_COMPILER_LIB_ARCH/$libName.a" \
"$dir/lib$WM_COMPILER_LIB_ARCH/$libName$EXT_SO" \
;
do
if [ -r "$lib" ]
then
echo "Have $package shared library (${dir##*/})"
exit 0
fi
done
echo "No $package libraries found: ${dir:-not-specified}"
exit 2
fi
#------------------------------------------------------------------------------
# Run from third-party directory only
......@@ -133,13 +139,19 @@ MPI_SOURCE_DIR=$sourceBASE/$mpiPACKAGE
MPI_ARCH_PATH=$installBASE/$mpiPACKAGE
if [ -z "$optForce" ] \
&& [ -r "$MPI_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libmpi$EXT_SO" ]
&& {
[ -r "$MPI_ARCH_PATH/lib/libmpi$EXT_SO" ] \
|| [ -r "$MPI_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libmpi$EXT_SO" ]
}
then
echo "Already has shared library"
echo "Already has shared library: $MPI_ARCH_PATH"
elif [ -z "$optForce" ] \
&& [ -r "$MPI_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libmpi.a" ]
&& {
[ -r "$MPI_ARCH_PATH/lib/libmpi.a" ] \
|| [ -r "$MPI_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libmpi.a" ]
}
then
echo "Already has static library"
echo "Already has static library: $MPI_ARCH_PATH"
else
echo "Starting build: $WM_MPLIB ($mpiPACKAGE)"
echo
......
......@@ -28,18 +28,24 @@ if [ "$1" = "-test" ]
then
[ "$#" -eq 2 ] || { echo "${0##*/} -test : needs 1 argument"; exit 1; }
dir="${2%/}" # <- *_ARCH_PATH
if [ -r "$dir/lib$WM_COMPILER_LIB_ARCH/libmpi$EXT_SO" ]
then
echo "Have mpich shared library (${dir##*/})"
exit 0
elif [ -r "$dir/lib$WM_COMPILER_LIB_ARCH/libmpi.a" ]
then
echo "Have mpich static library (${dir##*/})"
exit 0
else
echo "No mpich libraries found: ${dir:-not-specified}"
exit 2
fi
package="mvapich"
libName="libmpi"
for lib in \
"$dir/lib/$libName.a" \
"$dir/lib/$libName$EXT_SO" \
"$dir/lib$WM_COMPILER_LIB_ARCH/$libName.a" \
"$dir/lib$WM_COMPILER_LIB_ARCH/$libName$EXT_SO" \
;
do
if [ -r "$lib" ]
then
echo "Have $package library (${dir##*/})"
exit 0
fi
done
echo "No $package libraries found: ${dir:-not-specified}"
exit 2
fi
#------------------------------------------------------------------------------
# Run from third-party directory only
......@@ -137,13 +143,19 @@ MPI_SOURCE_DIR=$sourceBASE/$mpiPACKAGE
MPI_ARCH_PATH=$installBASE/$mpiPACKAGE
if [ -z "$optForce" ] \
&& [ -r "$MPI_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libmpi$EXT_SO" ]
&& {
[ -r "$MPI_ARCH_PATH/lib/libmpi$EXT_SO" ] \
|| [ -r "$MPI_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libmpi$EXT_SO" ]
}
then
echo "Already has shared library"
echo "Already has shared library: $MPI_ARCH_PATH"
elif [ -z "$optForce" ] \
&& [ -r "$MPI_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libmpi.a" ]
&& {
[ -r "$MPI_ARCH_PATH/lib/libmpi.a" ] \
|| [ -r "$MPI_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libmpi.a" ]
}
then
echo "Already has static library"
echo "Already has static library: $MPI_ARCH_PATH"
else
echo "Starting build: $WM_MPLIB ($mpiPACKAGE)"
echo
......
......@@ -28,18 +28,24 @@ if [ "$1" = "-test" ]
then
[ "$#" -eq 2 ] || { echo "${0##*/} -test : needs 1 argument"; exit 1; }
dir="${2%/}" # <- *_ARCH_PATH
if [ -r "$dir/lib$WM_COMPILER_LIB_ARCH/libmpi$EXT_SO" ]
then
echo " Have openmpi shared library (${dir##*/})"
exit 0
elif [ -r "$dir/lib$WM_COMPILER_LIB_ARCH/libmpi.a" ]
then
echo " Have openmpi static library (${dir##*/})"
exit 0
else
echo "No openmpi libraries found: ${dir:-not-specified}"
exit 2
fi
package="openmpi"
libName="libmpi"
for lib in \
"$dir/lib/$libName.a" \
"$dir/lib/$libName$EXT_SO" \
"$dir/lib$WM_COMPILER_LIB_ARCH/$libName.a" \
"$dir/lib$WM_COMPILER_LIB_ARCH/$libName$EXT_SO" \
;
do
if [ -r "$lib" ]
then
echo "Have $package library (${dir##*/})"
exit 0
fi
done
echo "No $package libraries found: ${dir:-not-specified}"
exit 2
fi
#------------------------------------------------------------------------------
# Run from third-party directory only
......@@ -139,11 +145,17 @@ MPI_SOURCE_DIR=$sourceBASE/$mpiPACKAGE
MPI_ARCH_PATH=$installBASE/$mpiPACKAGE
if [ -z "$optForce" ] \
&& [ -r "$MPI_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libmpi$EXT_SO" ]
&& {
[ -r "$MPI_ARCH_PATH/lib/libmpi$EXT_SO" ] \
|| [ -r "$MPI_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libmpi$EXT_SO" ]
}
then
echo "Already has shared library: $MPI_ARCH_PATH"
elif [ -z "$optForce" ] \
&& [ -r "$MPI_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libmpi.a" ]
&& {
[ -r "$MPI_ARCH_PATH/lib/libmpi.a" ] \
|| [ -r "$MPI_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libmpi.a" ]
}
then
echo "Already has static library: $MPI_ARCH_PATH"
else
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment