BACKPORT: align wmake have_* scripts with v2006

- simplify maintenance
This commit is contained in:
Mark Olesen 2020-11-03 20:20:40 +01:00
parent 36453aa9af
commit 56de3901e2
14 changed files with 884 additions and 560 deletions

View File

@ -20,7 +20,8 @@
# ADIOS2_ARCH_PATH
#
# Functions provided
# have_adios2, no_adios2, echo_adios2, hint_adios2, query_adios2
# have_adios2, no_adios2, echo_adios2, query_adios2, search_adios2
# hint_adios2
#
# Variables set on success
# HAVE_ADIOS2
@ -33,7 +34,7 @@
#------------------------------------------------------------------------------
# Reset variables
# Reset
no_adios2()
{
unset HAVE_ADIOS2 ADIOS2_INC_DIR ADIOS2_LIB_DIR
@ -44,9 +45,9 @@ no_adios2()
echo_adios2()
{
echo "adios2=${HAVE_ADIOS2:-false}"
echo "root=$ADIOS2_ARCH_PATH"
echo "include=$ADIOS2_INC_DIR"
echo "library=$ADIOS2_LIB_DIR"
echo "root=\"$ADIOS2_ARCH_PATH\""
echo "include=\"$ADIOS2_INC_DIR\""
echo "library=\"$ADIOS2_LIB_DIR\""
}
@ -55,9 +56,7 @@ hint_adios2()
{
/bin/cat<<INFORMATION 1>&2
==> adios2 not found?
Enable in the OpenFOAM etc/bashrc, define manually or try with the
following (POSIX shell):
Define manually, enable in OpenFOAM etc/bashrc, or try the following [POSIX]:
eval \$(foamEtcFile -sh -config adios2 -- -force)
@ -66,43 +65,19 @@ INFORMATION
}
# Query settings
query_adios2()
{
local config="config.sh/adios2"
local settings
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
then
. "$settings"
_process_query adios2 "$ADIOS2_ARCH_PATH"
else
echo "(no $config settings)" 1>&2
echo "adios2=unknown"
fi
}
# Search
# $1 : prefix (*_ARCH_PATH, system, ...)
#
# On success, return 0 and export variables
# -> HAVE_ADIOS2, ADIOS2_INC_DIR, ADIOS2_LIB_DIR
have_adios2()
search_adios2()
{
local warn # warn="==> skip adios2"
local config="config.sh/adios2"
local settings
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
then
. "$settings"
else
[ -n "$warn" ] && echo "$warn (no $config settings)"
return 2
fi
# Expected location, include/library names
local prefix="$ADIOS2_ARCH_PATH"
local incName="adios2.h"
local libName="libadios2"
local libName2="libadios2_cxx11_mpi"
local prefix="${1:-system}"
local header library
# ----------------------------------
@ -132,6 +107,7 @@ have_adios2()
# Library
[ -n "$library" ] \
|| library=$(findLibrary -prefix="$prefix" -name="$libName") \
|| library=$(findLibrary -prefix="$prefix" -name="$libName2") \
|| {
[ -n "$warn" ] && echo "$warn (no library)"
return 2
@ -147,7 +123,45 @@ have_adios2()
}
# Reset variables
# Output as per search_* function
have_adios2()
{
local warn # warn="==> skip adios2"
local config="config.sh/adios2"
local file
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
then
. "$file"
else
[ -n "$warn" ] && echo "$warn (no $config)"
return 2
fi
search_adios2 "$ADIOS2_ARCH_PATH"
}
# Query settings
query_adios2()
{
local config="config.sh/adios2"
local file
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
then
. "$file"
_process_query adios2 "$ADIOS2_ARCH_PATH"
else
echo "(no $config)" 1>&2
echo "adios2=unknown"
fi
}
#------------------------------------------------------------------------------
# Reset
no_adios2
# Test/query
@ -159,6 +173,9 @@ case "$1" in
-query)
query_adios2
;;
-hint)
hint_adios2
;;
esac
#------------------------------------------------------------------------------

View File

@ -21,7 +21,7 @@
# or config.sh/CGAL (when BOOST_ARCH_PATH is empty)
#
# Functions provided
# have_boost, no_boost, echo_boost, query_boost
# have_boost, no_boost, echo_boost, query_boost, search_boost
#
# Variables set on success
# HAVE_BOOST
@ -34,7 +34,7 @@
#------------------------------------------------------------------------------
# Reset variables
# Reset
no_boost()
{
unset HAVE_BOOST BOOST_INC_DIR BOOST_LIB_DIR
@ -45,53 +45,24 @@ no_boost()
echo_boost()
{
echo "boost=${HAVE_BOOST:-false}"
echo "root=$BOOST_ARCH_PATH"
echo "include=$BOOST_INC_DIR"
echo "library=$BOOST_LIB_DIR"
}
# Query settings (from CGAL setup)
query_boost()
{
local config="config.sh/CGAL"
local settings
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
then
. "$settings"
_process_query boost "$BOOST_ARCH_PATH"
else
echo "(no $config settings)" 1>&2
echo "boost=unknown"
fi
echo "root=\"$BOOST_ARCH_PATH\""
echo "include=\"$BOOST_INC_DIR\""
echo "library=\"$BOOST_LIB_DIR\""
}
# Search
# $1 : prefix (*_ARCH_PATH, system, ...)
#
# On success, return 0 and export variables
# -> HAVE_BOOST, BOOST_INC_DIR, BOOST_LIB_DIR
have_boost()
search_boost()
{
local warn # warn="==> skip boost"
local config="config.sh/CGAL"
local settings
# Setup - current environment if set
if [ -z "$BOOST_ARCH_PATH" ]
then
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
then
. "$settings"
else
[ -n "$warn" ] && echo "$warn (no $config settings)"
return 2
fi
fi
# Expected location, include/library names
local prefix="$BOOST_ARCH_PATH"
local incName="boost/version.hpp"
local libName="libboost_system"
local prefix="${1:-system}"
local header library
# ----------------------------------
@ -138,7 +109,49 @@ have_boost()
}
# Reset variables
# Output as per search_* function
have_boost()
{
local warn # warn="==> skip boost"
local config="config.sh/CGAL"
local file
# Setup - current environment if set
if [ -z "$BOOST_ARCH_PATH" ]
then
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
then
. "$file"
else
[ -n "$warn" ] && echo "$warn (no $config)"
return 2
fi
fi
search_boost "$BOOST_ARCH_PATH"
}
# Query settings (from CGAL setup)
query_boost()
{
local config="config.sh/CGAL"
local file
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
then
. "$file"
_process_query boost "$BOOST_ARCH_PATH"
else
echo "(no $config)" 1>&2
echo "boost=unknown"
fi
}
#------------------------------------------------------------------------------
# Reset
no_boost
# Test/query

View File

@ -20,7 +20,7 @@
# config.sh/ccmio
#
# Functions provided
# have_ccmio, no_ccmio, echo_ccmio, query_ccmio
# have_ccmio, no_ccmio, echo_ccmio, query_ccmio, search_ccmio
#
# Variables set on success
# HAVE_CCMIO
@ -33,7 +33,7 @@
#------------------------------------------------------------------------------
# Reset variables
# Reset
no_ccmio()
{
unset HAVE_CCMIO CCMIO_INC_DIR CCMIO_LIB_DIR
@ -44,50 +44,25 @@ no_ccmio()
echo_ccmio()
{
echo "ccmio=${HAVE_CCMIO:-false}"
echo "root=$CCMIO_ARCH_PATH"
echo "include=$CCMIO_INC_DIR"
echo "library=$CCMIO_LIB_DIR"
}
# Query settings
query_ccmio()
{
local config="config.sh/ccmio"
local settings
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
then
. "$settings"
_process_query ccmio "$CCMIO_ARCH_PATH"
else
echo "(no $config settings)" 1>&2
echo "ccmio=unknown"
fi
echo "root=\"$CCMIO_ARCH_PATH\""
echo "include=\"$CCMIO_INC_DIR\""
echo "library=\"$CCMIO_LIB_DIR\""
}
# Search
# $1 : prefix (*_ARCH_PATH, system, ...)
#
# On success, return 0 and export variables
# -> HAVE_CCMIO, CCMIO_INC_DIR, CCMIO_LIB_DIR
have_ccmio()
search_ccmio()
{
local warn="==> skip ccmio"
local config="config.sh/ccmio"
local settings
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
then
. "$settings"
else
[ -n "$warn" ] && echo "$warn (no $config settings)"
return 2
fi
# Expected location, include/library names
# Link with static libccmio only (fewer issues)
local prefix="$CCMIO_ARCH_PATH"
local incName="libccmio/ccmio.h"
local libName="libccmio.a"
# Link with static libccmio only (fewer issues)
local prefix="${1:-system}"
local header library
# ----------------------------------
@ -153,7 +128,45 @@ have_ccmio()
}
# Reset variables
# Output as per search_* function
have_ccmio()
{
local warn="==> skip ccmio"
local config="config.sh/ccmio"
local file
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
then
. "$file"
else
[ -n "$warn" ] && echo "$warn (no $config)"
return 2
fi
search_ccmio "$CCMIO_ARCH_PATH"
}
# Query settings
query_ccmio()
{
local config="config.sh/ccmio"
local file
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
then
. "$file"
_process_query ccmio "$CCMIO_ARCH_PATH"
else
echo "(no $config)" 1>&2
echo "ccmio=unknown"
fi
}
#------------------------------------------------------------------------------
# Reset
no_ccmio
# Test/query

View File

@ -25,19 +25,23 @@
#
# Variables set on success
# HAVE_CGAL
# CGAL_FLAVOUR (header, library, ...)
# CGAL_ARCH_PATH
# CGAL_INC_DIR
# CGAL_LIB_DIR
#
# Uses
# BOOST_ARCH_PATH and have_boost::search_boost()
#
#------------------------------------------------------------------------------
. ${WM_PROJECT_DIR:?}/wmake/scripts/sysFunctions # General system functions
. ${WM_PROJECT_DIR:?}/wmake/scripts/have_boost # boost + system functions
#------------------------------------------------------------------------------
# Reset variables
# Reset
no_cgal()
{
unset HAVE_CGAL CGAL_INC_DIR CGAL_LIB_DIR
unset HAVE_CGAL CGAL_FLAVOUR CGAL_INC_DIR CGAL_LIB_DIR
}
@ -45,54 +49,26 @@ no_cgal()
echo_cgal()
{
echo "cgal=${HAVE_CGAL:-false}"
echo "root=$CGAL_ARCH_PATH"
echo "include=$CGAL_INC_DIR"
echo "library=$CGAL_LIB_DIR"
}
# Query settings (from CGAL setup)
query_cgal()
{
local config="config.sh/CGAL"
local settings
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
then
. "$settings"
_process_query cgal "$CGAL_ARCH_PATH"
else
echo "(no $config settings)" 1>&2
echo "cgal=unknown"
fi
echo "flavour=$CGAL_FLAVOUR"
echo "root=\"$CGAL_ARCH_PATH\""
echo "include=\"$CGAL_INC_DIR\""
echo "library=\"$CGAL_LIB_DIR\""
}
# Search
# $1 : prefix (*_ARCH_PATH, system, ...)
#
# On success, return 0 and export variables
# -> HAVE_CGAL, CGAL_INC_DIR, CGAL_LIB_DIR
have_cgal()
# -> HAVE_CGAL, CGAL_INC_DIR, CGAL_LIB_DIR, CGAL_FLAVOUR
search_cgal()
{
local warn # warn="==> skip cgal"
local config="config.sh/CGAL"
local settings
# Setup - current environment if set
if [ -z "$CGAL_ARCH_PATH" ]
then
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
then
. "$settings"
else
[ -n "$warn" ] && echo "$warn (no $config settings)"
return 2
fi
fi
# Expected location, include/library names
local prefix="$CGAL_ARCH_PATH"
local incName="CGAL/version.h"
local libName="libCGAL"
local header library
local prefix="${1:-system}"
local header library flavour
# ----------------------------------
if isNone "$prefix"
@ -118,12 +94,13 @@ have_cgal()
return 2
}
# Library
# Library may be optional - eg, header-only
[ -n "$library" ] \
|| library=$(findLibrary -prefix="$prefix" -name="$libName") \
|| {
[ -n "$warn" ] && echo "$warn (no library)"
return 2
[ -n "$warn" ] && echo "==> cgal (no library)"
unset library
flavour="header" # Header only
}
# ----------------------------------
@ -132,13 +109,59 @@ have_cgal()
# OK
export HAVE_CGAL=true
export CGAL_FLAVOUR="${flavour:-library}"
export CGAL_ARCH_PATH="$prefix"
export CGAL_INC_DIR="${header%/*}" # Basename
export CGAL_LIB_DIR="${library%/*}" # Basename
}
# Reset variables
# Output as per search_* function
have_cgal()
{
local warn # warn="==> skip cgal"
local config="config.sh/CGAL"
local file
# Setup - current environment if set
if [ -z "$CGAL_ARCH_PATH" ]
then
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
then
. "$file"
else
[ -n "$warn" ] && echo "$warn (no $config)"
return 2
fi
fi
# Need boost for cgal
search_boost "$BOOST_ARCH_PATH"
search_cgal "$CGAL_ARCH_PATH"
}
# Query settings (from CGAL setup)
query_cgal()
{
local config="config.sh/CGAL"
local file
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
then
. "$file"
_process_query cgal "$CGAL_ARCH_PATH"
else
echo "(no $config)" 1>&2
echo "cgal=unknown"
fi
}
#------------------------------------------------------------------------------
# Reset
no_cgal
# Test/query

View File

@ -21,7 +21,7 @@
# CMAKE_ARCH_PATH that may specify a possible cmake/bin directory.
#
# Functions provided
# have_cmake, no_cmake, echo_cmake
# have_cmake, no_cmake, echo_cmake, search_cmake
#
# Variables set on success
# HAVE_CMAKE
@ -32,10 +32,10 @@
#
#------------------------------------------------------------------------------
# Reset variables
# Reset
no_cmake()
{
unset HAVE_CMAKE CMAKE_EXE
unset HAVE_CMAKE CMAKE_EXE CMAKE_ARCH_PATH
}
@ -47,13 +47,49 @@ echo_cmake()
}
# Search
# $1 : prefix (*_ARCH_PATH, system, ...)
#
# Try to locate cmake according to values specified in <etc/config.sh/cmake>
# Locate cmake according to values specified in <etc/config.sh/cmake>
# or just use what is found on the path.
#
# On success: return the resolved value as output.
# On failure: set executable as "false" and return with 1
#
search_cmake()
{
# Treat previous queries as "sticky"
if [ -n "$CMAKE_EXE" ]
then
test "$CMAKE_EXE" != "false"
return $?
fi
local prefix="${1:-/usr}"
local candidate="$prefix"/bin/cmake
local foundExe
if [ -f "$candidate" ] && [ -x "$candidate" ]
then
foundExe="$candidate"
elif candidate="$(command -v cmake 2>/dev/null)"
then
# Resolved from PATH
foundExe="$candidate"
fi
if [ -z "$foundExe" ]
then
export CMAKE_EXE="false" # Avoid repeated calls?
return 2
fi
# OK
export HAVE_CMAKE=true
export CMAKE_EXE="$foundExe"
}
# Output as per search_* function
have_cmake()
{
# Treat previous queries as "sticky"
@ -64,48 +100,22 @@ have_cmake()
fi
local config="config.sh/cmake"
local file
unset CMAKE_ARCH_PATH
local settings candidate foundExe
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config" 2>/dev/null)"
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config" 2>/dev/null)"
then
. "$settings"
if [ -d "$CMAKE_ARCH_PATH" ]
then
candidate="$CMAKE_ARCH_PATH"/bin/cmake
if [ -f "$candidate" ] && [ -x "$candidate" ]
then
foundExe="$candidate"
fi
fi
. "$file"
fi
if [ -z "$foundExe" ]
then
# Default: resolve from PATH
if candidate="$(command -v cmake 2>/dev/null)"
then
foundExe="$candidate"
fi
fi
if [ -n "$foundExe" ]
then
# OK
export HAVE_CMAKE=true
export CMAKE_EXE="$foundExe"
else
# Failure
export CMAKE_EXE="false" # Avoid repeated calls?
return 2
fi
search_cmake "$CMAKE_ARCH_PATH"
}
# Reset variables
no_cmake
#------------------------------------------------------------------------------
# Reset
no_cmake
# Test/query
case "$1" in
@ -118,5 +128,4 @@ case "$1" in
;;
esac
#------------------------------------------------------------------------------

View File

@ -21,7 +21,7 @@
# or config.sh/FFTW (when FFTW_ARCH_PATH is empty)
#
# Functions provided
# have_fftw, no_fftw, echo_fftw, query_fftw
# have_fftw, no_fftw, echo_fftw, query_fftw, search_fftw
#
# Variables set on success
# HAVE_FFTW
@ -34,7 +34,7 @@
#------------------------------------------------------------------------------
# Reset variables
# Reset
no_fftw()
{
unset HAVE_FFTW FFTW_INC_DIR FFTW_LIB_DIR
@ -45,53 +45,25 @@ no_fftw()
echo_fftw()
{
echo "fftw=${HAVE_FFTW:-false}"
echo "root=$FFTW_ARCH_PATH"
echo "include=$FFTW_INC_DIR"
echo "library=$FFTW_LIB_DIR"
echo "root=\"$FFTW_ARCH_PATH\""
echo "include=\"$FFTW_INC_DIR\""
echo "library=\"$FFTW_LIB_DIR\""
}
# Query settings
query_fftw()
{
local config="config.sh/FFTW"
local settings
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
then
. "$settings"
_process_query fftw "$FFTW_ARCH_PATH"
else
echo "(no $config settings)" 1>&2
echo "fftw=unknown"
fi
}
# Search
# $1 : prefix (*_ARCH_PATH, system, ...)
#
# On success, return 0 and export variables
# -> HAVE_FFTW, FFTW_INC_DIR, FFTW_LIB_DIR
have_fftw()
search_fftw()
{
local warn # warn="==> skip fftw"
local config="config.sh/FFTW"
local settings
# Setup - current environment if set
if [ -z "$FFTW_ARCH_PATH" ]
then
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
then
. "$settings"
else
[ -n "$warn" ] && echo "$warn (no $config settings)"
return 2
fi
fi
# Expected location, include/library names
local prefix="$FFTW_ARCH_PATH"
local incName="fftw3.h"
local libName="libfftw3"
local prefix="${1:-system}"
local header library
# ----------------------------------
@ -136,7 +108,49 @@ have_fftw()
}
# Reset variables
# Output as per search_* function
have_fftw()
{
local warn # warn="==> skip fftw"
local config="config.sh/FFTW"
local file
# Setup - current environment if set
if [ -z "$FFTW_ARCH_PATH" ]
then
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
then
. "$file"
else
[ -n "$warn" ] && echo "$warn (no $config)"
return 2
fi
fi
search_fftw "$FFTW_ARCH_PATH"
}
# Query settings
query_fftw()
{
local config="config.sh/FFTW"
local file
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
then
. "$file"
_process_query fftw "$FFTW_ARCH_PATH"
else
echo "(no $config)" 1>&2
echo "fftw=unknown"
fi
}
#------------------------------------------------------------------------------
# Reset
no_fftw
# Test/query

View File

@ -21,7 +21,8 @@
# or config.sh/hypre
#
# Functions provided
# have_hypre, no_hypre, echo_hypre, query_hypre
# have_hypre, no_hypre, echo_hypre, query_hypre, search_hypre
# hint_hypre
#
# Variables set on success
# HAVE_HYPRE
@ -34,7 +35,7 @@
#------------------------------------------------------------------------------
# Reset variables
# Reset
no_hypre()
{
unset HAVE_HYPRE HYPRE_INC_DIR HYPRE_LIB_DIR
@ -45,53 +46,38 @@ no_hypre()
echo_hypre()
{
echo "hypre=${HAVE_HYPRE:-false}"
echo "root=$HYPRE_ARCH_PATH"
echo "include=$HYPRE_INC_DIR"
echo "library=$HYPRE_LIB_DIR"
echo "root=\"$HYPRE_ARCH_PATH\""
echo "include=\"$HYPRE_INC_DIR\""
echo "library=\"$HYPRE_LIB_DIR\""
}
# Query settings
query_hypre()
# Hint for enabling
hint_hypre()
{
local config="config.sh/hypre"
local settings
/bin/cat<<INFORMATION 1>&2
==> hypre not found?
Define manually, enable in OpenFOAM etc/bashrc, or try the following [POSIX]:
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
then
. "$settings"
_process_query hypre "$HYPRE_ARCH_PATH"
else
echo "(no $config settings)" 1>&2
echo "hypre=unknown"
fi
eval \$(foamEtcFile -sh -config hypre -- -force)
==
INFORMATION
}
# Search
# $1 : prefix (*_ARCH_PATH, system, ...)
#
# On success, return 0 and export variables
# -> HAVE_HYPRE, HYPRE_INC_DIR, HYPRE_LIB_DIR
have_hypre()
search_hypre()
{
local warn="==> skip hypre"
local config="config.sh/hypre"
local settings
# Setup - prefer current environment value? (TDB)
if [ ! -d "$HYPRE_ARCH_PATH" ]
then
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
then
. "$settings"
else
[ -n "$warn" ] && echo "$warn (no $config settings)"
return 2
fi
fi
# Expected location, include/library names
local prefix="$HYPRE_ARCH_PATH"
local incName="HYPRE.h"
local libName="libHYPRE"
local prefix="${1:-system}"
local header library
# ----------------------------------
@ -136,7 +122,52 @@ have_hypre()
}
# Reset variables
# Output as per search_* function
have_hypre()
{
local warn="==> skip hypre"
local config="config.sh/hypre"
local file
# Setup - prefer current environment value
if [ -d "$HYPRE_ARCH_PATH" ] || [ "$HYPRE_ARCH_PATH" = system ]
then
:
else
# Use config file
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
then
. "$file"
else
[ -n "$warn" ] && echo "$warn (no $config)"
return 2
fi
fi
search_hypre "$HYPRE_ARCH_PATH"
}
# Query settings
query_hypre()
{
local config="config.sh/hypre"
local file
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
then
. "$file"
_process_query hypre "$HYPRE_ARCH_PATH"
else
echo "(no $config)" 1>&2
echo "hypre=unknown"
fi
}
#------------------------------------------------------------------------------
# Reset
no_hypre
# Test/query
@ -148,6 +179,9 @@ case "$1" in
-query)
query_hypre
;;
-hint)
hint_hypre
;;
esac
#------------------------------------------------------------------------------

View File

@ -20,7 +20,7 @@
# config.sh/kahip
#
# Functions provided
# have_kahip, no_kahip, echo_kahip, query_kahip
# have_kahip, no_kahip, echo_kahip, query_kahip, search_kahip
#
# Variables set on success
# HAVE_KAHIP
@ -33,7 +33,7 @@
#------------------------------------------------------------------------------
# Reset variables
# Reset
no_kahip()
{
unset HAVE_KAHIP KAHIP_ARCH_PATH KAHIP_INC_DIR KAHIP_LIB_DIR
@ -45,49 +45,24 @@ no_kahip()
echo_kahip()
{
echo "kahip=${HAVE_KAHIP:-false}"
echo "root=$KAHIP_ARCH_PATH"
echo "include=$KAHIP_INC_DIR"
echo "library=$KAHIP_LIB_DIR"
}
# Query settings
query_kahip()
{
local config="config.sh/kahip"
local settings
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
then
. "$settings"
_process_query kahip "$KAHIP_ARCH_PATH"
else
echo "(no $config settings)" 1>&2
echo "kahip=unknown"
fi
echo "root=\"$KAHIP_ARCH_PATH\""
echo "include=\"$KAHIP_INC_DIR\""
echo "library=\"$KAHIP_LIB_DIR\""
}
# Search
# $1 : prefix (*_ARCH_PATH, system, ...)
#
# On success, return 0 and export variables
# -> HAVE_KAHIP, KAHIP_ARCH_PATH, KAHIP_INC_DIR, KAHIP_LIB_DIR
have_kahip()
search_kahip()
{
local warn="==> skip kahip"
local config="config.sh/kahip"
local settings
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
then
. "$settings"
else
[ -n "$warn" ] && echo "$warn (no $config settings)"
return 1
fi
# Expected location, include/library names
local prefix="$KAHIP_ARCH_PATH"
local incName="kaHIP_interface.h"
local libName="libkahip"
local prefix="${1:-system}"
local header library
# ----------------------------------
@ -124,7 +99,7 @@ have_kahip()
# ----------------------------------
# kahip itself is 32-bit int, but our interface itself handles some
# kahip itself is 32-bit int, but our interface handles some
# 64-bit conversion (mesh size).
echo "kahip (label=32) - $prefix"
@ -135,7 +110,45 @@ have_kahip()
}
# Reset variables
# Output as per search_* function
have_kahip()
{
local warn="==> skip kahip"
local config="config.sh/kahip"
local file
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
then
. "$file"
else
[ -n "$warn" ] && echo "$warn (no $config)"
return 1
fi
search_kahip "$KAHIP_ARCH_PATH"
}
# Query settings
query_kahip()
{
local config="config.sh/kahip"
local file
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
then
. "$file"
_process_query kahip "$KAHIP_ARCH_PATH"
else
echo "(no $config)" 1>&2
echo "kahip=unknown"
fi
}
#------------------------------------------------------------------------------
# Reset
no_kahip
# Test/query

View File

@ -20,7 +20,7 @@
# config.sh/metis
#
# Functions provided
# have_metis, no_metis, echo_metis, query_metis
# have_metis, no_metis, echo_metis, query_metis, search_metis
#
# Variables set on success
# HAVE_METIS
@ -33,7 +33,7 @@
#------------------------------------------------------------------------------
# Reset variables
# Reset
no_metis()
{
unset HAVE_METIS METIS_ARCH_PATH METIS_INC_DIR METIS_LIB_DIR
@ -45,49 +45,24 @@ no_metis()
echo_metis()
{
echo "metis=${HAVE_METIS:-false}"
echo "root=$METIS_ARCH_PATH"
echo "include=$METIS_INC_DIR"
echo "library=$METIS_LIB_DIR"
}
# Query settings
query_metis()
{
local config="config.sh/metis"
local settings
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
then
. "$settings"
_process_query metis "$METIS_ARCH_PATH"
else
echo "(no $config settings)" 1>&2
echo "metis=unknown"
fi
echo "root=\"$METIS_ARCH_PATH\""
echo "include=\"$METIS_INC_DIR\""
echo "library=\"$METIS_LIB_DIR\""
}
# Search
# $1 : prefix (*_ARCH_PATH, system, ...)
#
# On success, return 0 and export variables
# -> HAVE_METIS, METIS_ARCH_PATH, METIS_INC_DIR, METIS_LIB_DIR
have_metis()
search_metis()
{
local warn="==> skip metis"
local config="config.sh/metis"
local settings
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
then
. "$settings"
else
[ -n "$warn" ] && echo "$warn (no $config settings)"
return 2
fi
# Expected location, include/library names
local prefix="$METIS_ARCH_PATH"
local incName="metis.h"
local libName="libmetis"
local prefix="${1:-system}"
local header library
# ----------------------------------
@ -142,6 +117,44 @@ have_metis()
}
# Output as per search_* function
have_metis()
{
local warn="==> skip metis"
local config="config.sh/metis"
local file
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
then
. "$file"
else
[ -n "$warn" ] && echo "$warn (no $config)"
return 2
fi
search_metis "$METIS_ARCH_PATH"
}
# Query settings
query_metis()
{
local config="config.sh/metis"
local file
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
then
. "$file"
_process_query metis "$METIS_ARCH_PATH"
else
echo "(no $config)" 1>&2
echo "metis=unknown"
fi
}
#------------------------------------------------------------------------------
# Reset variables
no_metis

View File

@ -20,7 +20,7 @@
# config.sh/mgridgen
#
# Functions provided
# have_mgridgen, no_mgridgen, echo_mgridgen, query_mgridgen
# have_mgridgen, no_mgridgen, echo_mgridgen, query_mgridgen, search_mgridgen
#
# Variables set on success
# HAVE_MGRIDGEN
@ -33,7 +33,7 @@
#------------------------------------------------------------------------------
# Reset variables
# Reset
no_mgridgen()
{
unset HAVE_MGRIDGEN MGRIDGEN_ARCH_PATH MGRIDGEN_INC_DIR MGRIDGEN_LIB_DIR
@ -45,50 +45,25 @@ no_mgridgen()
echo_mgridgen()
{
echo "mgridgen=${HAVE_MGRIDGEN:-false}"
echo "root=$MGRIDGEN_ARCH_PATH"
echo "include=$MGRIDGEN_INC_DIR"
echo "library=$MGRIDGEN_LIB_DIR"
}
# Query settings
query_mgridgen()
{
local config="config.sh/mgridgen"
local settings
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
then
. "$settings"
_process_query mgridgen "$MGRIDGEN_ARCH_PATH"
else
echo "(no $config settings)" 1>&2
echo "mgridgen=unknown"
fi
echo "root=\"$MGRIDGEN_ARCH_PATH\""
echo "include=\"$MGRIDGEN_INC_DIR\""
echo "library=\"$MGRIDGEN_LIB_DIR\""
}
# Search
# $1 : prefix (*_ARCH_PATH, system, ...)
#
# On success, return 0 and export variables
# -> HAVE_MGRIDGEN, MGRIDGEN_ARCH_PATH, MGRIDGEN_INC_DIR, MGRIDGEN_LIB_DIR
have_mgridgen()
search_mgridgen()
{
local warn="==> skip mgridgen"
local config="config.sh/mgridgen"
local settings
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
then
. "$settings"
else
#silent# [ -n "$warn" ] && echo "$warn (no $config settings)"
return 2
fi
# Expected location, include/library names
local prefix="$MGRIDGEN_ARCH_PATH"
local incName="mgridgen.h"
local libName="libMGridGen"
local libName2="libmgrid"
local prefix="${1:-system}"
local header library
# ----------------------------------
@ -177,7 +152,45 @@ have_mgridgen()
}
# Reset variables
# Output as per search_* function
have_mgridgen()
{
local warn="==> skip mgridgen"
local config="config.sh/mgridgen"
local file
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
then
. "$file"
else
#silent# [ -n "$warn" ] && echo "$warn (no $config)"
return 2
fi
search_mgridgen "$MGRIDGEN_ARCH_PATH"
}
# Query settings
query_mgridgen()
{
local config="config.sh/mgridgen"
local file
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
then
. "$file"
_process_query mgridgen "$MGRIDGEN_ARCH_PATH"
else
echo "(no $config)" 1>&2
echo "mgridgen=unknown"
fi
}
#------------------------------------------------------------------------------
# Reset
no_mgridgen
# Test/query

View File

@ -18,10 +18,12 @@
#
# Requires
# PETSC_ARCH_PATH
# or PETSC_DIR, PETSC_ARCH
# or config.sh/petsc
#
# Functions provided
# have_petsc, no_petsc, echo_petsc, hint_petsc, query_petsc
# have_petsc, no_petsc, echo_petsc, query_petsc, search_petsc
# hint_petsc
#
# Variables set on success
# HAVE_PETSC
@ -34,7 +36,7 @@
#------------------------------------------------------------------------------
# Reset variables
# Reset
no_petsc()
{
unset HAVE_PETSC PETSC_INC_DIR PETSC_LIB_DIR
@ -45,9 +47,9 @@ no_petsc()
echo_petsc()
{
echo "petsc=${HAVE_PETSC:-false}"
echo "root=$PETSC_ARCH_PATH"
echo "include=$PETSC_INC_DIR"
echo "library=$PETSC_LIB_DIR"
echo "root=\"$PETSC_ARCH_PATH\""
echo "include=\"$PETSC_INC_DIR\""
echo "library=\"$PETSC_LIB_DIR\""
}
@ -56,9 +58,7 @@ hint_petsc()
{
/bin/cat<<INFORMATION 1>&2
==> petsc not found?
Enable in the OpenFOAM etc/bashrc, define manually or try with the
following (POSIX shell):
Define manually, enable in OpenFOAM etc/bashrc, or try the following [POSIX]:
eval \$(foamEtcFile -sh -config petsc -- -force)
@ -67,49 +67,29 @@ INFORMATION
}
# Query settings
query_petsc()
{
local config="config.sh/petsc"
local settings
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
then
. "$settings"
_process_query petsc "$PETSC_ARCH_PATH"
else
echo "(no $config settings)" 1>&2
echo "petsc=unknown"
fi
}
# On success, return 0 and export variables
# -> HAVE_PETSC, PETSC_INC_DIR, PETSC_LIB_DIR
have_petsc()
#
# $1 = prefix (eg, PETSC_DIR, PETSC_ARCH_PATH)
# $2 = [arch] (eg, PETSC_ARCH)
#
# Gets ugly with in-source installation.
# 1) In the simple case, petsc is installed with --prefix
# we find PREFIX/{include,lib}
#
# 2) With in-source installation,
# headers in PETSC_DIR/include and PETSC_DIR/PETSC_ARCH/include
# library is PETSC_DIR/PETSC_ARCH/lib*
search_petsc()
{
local warn="==> skip petsc"
local config="config.sh/petsc"
local settings
# Setup - prefer current environment value? (TDB)
if [ ! -d "$PETSC_ARCH_PATH" ]
then
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
then
. "$settings"
else
[ -n "$warn" ] && echo "$warn (no $config settings)"
return 2
fi
fi
# Expected location, include/library names
local prefix="$PETSC_ARCH_PATH"
local incName="petsc.h"
local libName="libpetsc"
local pkgName="PETSc"
local header library
local prefix="${1:-system}"
local arch="$2"
local header library includeDirs libraryDirs
# ----------------------------------
if isNone "$prefix"
@ -128,34 +108,56 @@ have_petsc()
# No system header, attempt discovery with pkg-config
if [ -z "$header" ] && pkg-config --exists "$pkgName" 2>/dev/null
then
header=$(pkg-config --cflags-only-I "$pkgName" | sed -e 's/^-[IL]//')
library=$(pkg-config --libs-only-L "$pkgName" | sed -e 's/^-[IL]//')
includeDirs=$(pkg-config --cflags-only-I "$pkgName" | sed -e 's/^-[IL]//; s/[ ]-[IL]/ /;')
libraryDirs=$(pkg-config --libs-only-L "$pkgName" | sed -e 's/^-[IL]//; s/[ ]-[IL]/ /;')
prefix="${header%/*}" # Basename
# Artifically adjust names (for later)
[ -n "$header" ] && header="$header/$incName"
[ -n "$library" ] && library="$library/$libName"
prefix="${includeDirs% *}" # First entry (ie, split on space)
prefix="${prefix%/*}" # Basename
fi
else
unset prefix
fi
# ----------------------------------
# Header
[ -n "$header" ] || {
[ -n "$warn" ] && echo "$warn (no header)"
return 2
}
# Header -> directory
if [ -z "$includeDirs" ]
then
includeDirs="${header%/*}" # Basename
# Library
[ -n "$library" ] \
|| library=$(findLibrary -prefix="$prefix" -name="$libName") \
|| {
[ -n "$warn" ] && echo "$warn (no library)"
return 2
}
# Header
[ -n "$header" ] || {
[ -n "$warn" ] && echo "$warn (no header)"
return 2
}
fi
# Library -> directory
if [ -z "$libraryDirs" ]
then
if [ -n "$arch" ] && [ -d "$prefix/$arch" ]
then
# Prepend with petsc-arch/include
if [ -d "$prefix/$arch/include" ]
then
includeDirs="$prefix/$arch/include${includeDirs:+ }$includeDirs"
fi
# Prefer with petsc-arch/lib
if [ -z "$library" ]
then
library=$(findLibrary -prefix="$prefix/$arch" -name="$libName")
fi
fi
[ -n "$library" ] \
|| library=$(findLibrary -prefix="$prefix" -name="$libName") \
|| {
[ -n "$warn" ] && echo "$warn (no library)"
return 2
}
libraryDirs="${library%/*}" # Basename
fi
# ----------------------------------
# TODO: check size of petsc integer vs label, real vs double?
@ -163,12 +165,64 @@ have_petsc()
# OK
export HAVE_PETSC=true
export PETSC_ARCH_PATH="$prefix"
export PETSC_INC_DIR="${header%/*}" # Basename
export PETSC_LIB_DIR="${library%/*}" # Basename
export PETSC_INC_DIR="$includeDirs"
export PETSC_LIB_DIR="$libraryDirs"
}
# Reset variables
# On success, return 0 and export variables
# -> HAVE_PETSC, PETSC_INC_DIR, PETSC_LIB_DIR
have_petsc()
{
local warn="==> skip petsc"
local config="config.sh/petsc"
local file
# Setup - prefer current environment value
if [ -d "$PETSC_ARCH_PATH" ] || [ "$PETSC_ARCH_PATH" = system ]
then
# OpenFOAM prefix naming, possibly with petsc-arch
search_petsc "$PETSC_ARCH_PATH" $PETSC_ARCH
elif [ -d "$PETSC_DIR" ]
then
# petsc-dir, petsc-arch naming
search_petsc "$PETSC_DIR" $PETSC_ARCH
else
# Use config file
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
then
. "$file"
else
[ -n "$warn" ] && echo "$warn (no $config)"
return 2
fi
search_petsc "$PETSC_ARCH_PATH"
fi
}
# Query settings
query_petsc()
{
local config="config.sh/petsc"
local file
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
then
. "$file"
_process_query petsc "$PETSC_ARCH_PATH"
else
echo "(no $config)" 1>&2
echo "petsc=unknown"
fi
}
#------------------------------------------------------------------------------
# Reset
no_petsc
# Test/query
@ -180,6 +234,9 @@ case "$1" in
-query)
query_petsc
;;
-hint)
hint_petsc
;;
esac
#------------------------------------------------------------------------------

View File

@ -20,7 +20,7 @@
# None
#
# Functions provided
# have_readline, no_readline, echo_readline
# have_readline, no_readline, echo_readline, search_readline
#
# Variables set on success
# HAVE_LIBREADLINE - as per GNU autoconf
@ -32,7 +32,7 @@
#------------------------------------------------------------------------------
# Reset variables
# Reset
no_readline()
{
unset HAVE_LIBREADLINE READLINE_INC_DIR READLINE_LIB_DIR
@ -43,22 +43,23 @@ no_readline()
echo_readline()
{
echo "readline=${HAVE_LIBREADLINE:-false}"
echo "include=$READLINE_INC_DIR"
echo "library=$READLINE_LIB_DIR"
echo "include=\"$READLINE_INC_DIR\""
echo "library=\"$READLINE_LIB_DIR\""
}
# Search
# $1 : prefix (*_ARCH_PATH, system, ...)
#
# On success, return 0 and export variables
# -> HAVE_LIBREADLINE, READLINE_INC_DIR, READLINE_LIB_DIR
have_readline()
search_readline()
{
local warn # warn="==> skip readline"
local settings
# Expected location, include/library names
local prefix=system
local incName="readline/readline.h"
local libName="libreadline"
local prefix="${1:-system}"
local header library
# ----------------------------------
@ -104,7 +105,16 @@ have_readline()
}
# Reset variables
# Output as per search_* function
have_readline()
{
search_readline system
}
#------------------------------------------------------------------------------
# Reset
no_readline
# Test/query

View File

@ -20,7 +20,7 @@
# config.sh/scotch
#
# Functions provided
# have_scotch, no_scotch, echo_scotch, query_scotch
# have_ptscotch, search_ptscotch
#
# Variables set on success
# HAVE_SCOTCH
@ -28,12 +28,62 @@
# SCOTCH_INC_DIR
# SCOTCH_LIB_DIR
#
# Functions provided [Must call have_scotch first]
# have_ptscotch, search_ptscotch
#
# Variables set on success
# HAVE_PTSCOTCH
# PTSCOTCH_ARCH_PATH
# PTSCOTCH_INC_DIR
# PTSCOTCH_LIB_DIR
#
#
# System files can be hiding in a large variety of locations
#
# ArchLinux
# ---------
# scotch include=/usr/include/ptscotch
#
# ptscotch include=/usr/include/ptscotch
#
#
# Debian/Ubuntu
# -------------
# scotch include=/usr/include/scotch-int32
# scotch library=/usr/lib/x86_64-linux-gnu
#
# ptscotch include=/usr/include/scotch-int32
# ptscotch library=/usr/lib/x86_64-linux-gnu
#
#
# RedHat
# ------
# scotch include=/usr/include
# scotch library=/usr/lib64
#
# ptscotch include=/usr/include/openmpi-x86_64
# ptscotch library=/usr/lib64/openmpi/lib
#
# when MPI_ARCH_PATH=/usr/lib64/openmpi
# and mpicc --showme:compile -> -I/usr/include/openmpi-x86_64
#
#
# openSUSE
# --------
# scotch include=/usr/include
# scotch library=/usr/lib64
#
# ptscotch include=/usr/lib64/mpi/gcc/openmpi2/include
# ptscotch library=/usr/lib64/mpi/gcc/openmpi2/lib64
#
# when MPI_ARCH_PATH=/usr/lib64/mpi/gcc/openmpi2
#
#------------------------------------------------------------------------------
. ${WM_PROJECT_DIR:?}/wmake/scripts/sysFunctions # General system functions
#------------------------------------------------------------------------------
# Reset variables
# Reset
no_scotch()
{
unset HAVE_SCOTCH SCOTCH_ARCH_PATH SCOTCH_INC_DIR SCOTCH_LIB_DIR
@ -46,55 +96,30 @@ no_scotch()
echo_scotch()
{
echo "scotch=${HAVE_SCOTCH:-false}"
echo "root=$SCOTCH_ARCH_PATH"
echo "include=$SCOTCH_INC_DIR"
echo "library=$SCOTCH_LIB_DIR"
echo "root=\"$SCOTCH_ARCH_PATH\""
echo "include=\"$SCOTCH_INC_DIR\""
echo "library=\"$SCOTCH_LIB_DIR\""
echo
echo "ptscotch=${HAVE_PTSCOTCH:-false}"
echo "root=$PTSCOTCH_ARCH_PATH"
echo "include=$PTSCOTCH_INC_DIR"
echo "library=$PTSCOTCH_LIB_DIR"
}
# Query settings
query_scotch()
{
local config="config.sh/scotch"
local settings
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
then
. "$settings"
_process_query scotch "$SCOTCH_ARCH_PATH"
else
echo "(no $config settings)" 1>&2
echo "scotch=unknown"
fi
echo "root=\"$PTSCOTCH_ARCH_PATH\""
echo "include=\"$PTSCOTCH_INC_DIR\""
echo "library=\"$PTSCOTCH_LIB_DIR\""
}
# Search
# $1 : prefix (*_ARCH_PATH, system, ...)
#
# On success, return 0 and export variables
# -> HAVE_SCOTCH, SCOTCH_ARCH_PATH, SCOTCH_INC_DIR, SCOTCH_LIB_DIR
have_scotch()
search_scotch()
{
local warn="==> skip scotch"
local config="config.sh/scotch"
local settings
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
then
. "$settings"
else
[ -n "$warn" ] && echo "$warn (no $config settings)"
return 2
fi
# Expected location, include/library names
local prefix="$SCOTCH_ARCH_PATH"
local incName="scotch.h"
local libName="libscotch"
local localDir="scotch-int$WM_LABEL_SIZE"
local prefix="${1:-system}"
local header library
# ----------------------------------
@ -193,30 +218,24 @@ have_scotch()
}
# Must be called after have_scotch!
# Search
# $1 : prefix (*_ARCH_PATH, system, ...)
#
# On success, return 0 and export variables
# -> HAVE_PTSCOTCH, PTSCOTCH_ARCH_PATH, PTSCOTCH_INC_DIR, PTSCOTCH_LIB_DIR
have_ptscotch()
search_ptscotch()
{
local warn="==> skip ptscotch"
if [ "$HAVE_SCOTCH" != true ]
then
echo "$warn (no serial scotch available?)"
return 1
fi
# Reuse old settings
[ -n "$PTSCOTCH_ARCH_PATH" ] || PTSCOTCH_ARCH_PATH="$SCOTCH_ARCH_PATH"
# Expected location, include/library names
local prefix="$PTSCOTCH_ARCH_PATH"
local incName="ptscotch.h"
local libName="libptscotch"
local localDir="scotch-int$WM_LABEL_SIZE"
local prefix="${1:-system}"
local header library
local mpiPrefix="$MPI_ARCH_PATH"
local mpiName="${MPI_ARCH_PATH##*/}"
# ----------------------------------
if isNone "$prefix"
then
@ -229,7 +248,10 @@ have_ptscotch()
"$prefix/include/$localDir/$incName" \
"$prefix/include/ptscotch/$incName" \
"$prefix/include/scotch/$incName" \
"$prefix/include/$incName"
"$prefix/include/$incName" \
"$mpiPrefix/include/$incName" \
"$prefix/include/$mpiName/$incName" \
"$prefix/include/${mpiName}-$(uname -m)/$incName" \
)
library="$(findExtLib $FOAM_MPI/$libName $libName)"
elif isSystem "$prefix"
@ -243,6 +265,9 @@ have_ptscotch()
"/usr/include/ptscotch/$incName" \
"/usr/include/scotch/$incName" \
"/usr/include/$incName" \
"$mpiPrefix/include/$incName" \
"/usr/include/$mpiName/$incName" \
"$prefix/include/${mpiName}-$(uname -m)/$incName" \
)
prefix=$(sysPrefix "$header")
else
@ -260,6 +285,7 @@ have_ptscotch()
# Library
[ -n "$library" ] \
|| library=$(findLibrary -prefix="$prefix" -name="$libName" -local="$localDir") \
|| library=$(findLibrary -prefix="$mpiPrefix" -name="$libName" -local="$localDir") \
|| {
[ -n "$warn" ] && echo "$warn (no library)"
return 2
@ -276,7 +302,63 @@ have_ptscotch()
}
# Reset variables
# Output as per search_* function
have_scotch()
{
local warn="==> skip scotch"
local config="config.sh/scotch"
local file
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
then
. "$file"
else
[ -n "$warn" ] && echo "$warn (no $config)"
return 2
fi
search_scotch "$SCOTCH_ARCH_PATH"
}
# Output as per search_* function
have_ptscotch()
{
local warn="==> skip ptscotch"
if [ "$HAVE_SCOTCH" != true ]
then
echo "$warn (no serial scotch available?)"
return 1
fi
# Reuse old settings
[ -n "$PTSCOTCH_ARCH_PATH" ] || PTSCOTCH_ARCH_PATH="$SCOTCH_ARCH_PATH"
search_ptscotch "$PTSCOTCH_ARCH_PATH"
}
# Query settings
query_scotch()
{
local config="config.sh/scotch"
local file
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
then
. "$file"
_process_query scotch "$SCOTCH_ARCH_PATH"
else
echo "(no $config)" 1>&2
echo "scotch=unknown"
fi
}
#------------------------------------------------------------------------------
# Reset
no_scotch
# Test/query

View File

@ -20,7 +20,7 @@
# config.sh/zoltan
#
# Functions provided
# have_zoltan, no_zoltan, echo_zoltan, query_zoltan
# have_zoltan, no_zoltan, echo_zoltan, query_zoltan, search_zoltan
#
# Variables set on success
# HAVE_ZOLTAN
@ -33,7 +33,7 @@
#------------------------------------------------------------------------------
# Reset variables
# Reset
no_zoltan()
{
unset HAVE_ZOLTAN ZOLTAN_INC_DIR ZOLTAN_LIB_DIR
@ -44,49 +44,24 @@ no_zoltan()
echo_zoltan()
{
echo "zoltan=${HAVE_ZOLTAN:-false}"
echo "root=$ZOLTAN_ARCH_PATH"
echo "include=$ZOLTAN_INC_DIR"
echo "library=$ZOLTAN_LIB_DIR"
}
# Query settings
query_zoltan()
{
local config="config.sh/zoltan"
local settings
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
then
. "$settings"
_process_query zoltan "$ZOLTAN_ARCH_PATH"
else
echo "(no $config settings)" 1>&2
echo "zoltan=unknown"
fi
echo "root=\"$ZOLTAN_ARCH_PATH\""
echo "include=\"$ZOLTAN_INC_DIR\""
echo "library=\"$ZOLTAN_LIB_DIR\""
}
# Search
# $1 : prefix (*_ARCH_PATH, system, ...)
#
# On success, return 0 and export variables
# -> HAVE_ZOLTAN, ZOLTAN_INC_DIR, ZOLTAN_LIB_DIR
have_zoltan()
search_zoltan()
{
local warn # warn="==> skip zoltan"
local config="config.sh/zoltan"
local settings
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
then
. "$settings"
else
[ -n "$warn" ] && echo "$warn (no $config settings)"
return 2
fi
# Expected location, include/library names
local prefix="$ZOLTAN_ARCH_PATH"
local incName="zoltan.h"
local libName="libzoltan"
local prefix="${1:-system}"
local header library
# ----------------------------------
@ -131,7 +106,45 @@ have_zoltan()
}
# Reset variables
# Output as per search_* function
have_zoltan()
{
local warn # warn="==> skip zoltan"
local config="config.sh/zoltan"
local file
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
then
. "$file"
else
[ -n "$warn" ] && echo "$warn (no $config)"
return 2
fi
search_zoltan "$ZOLTAN_ARCH_PATH"
}
# Query settings
query_zoltan()
{
local config="config.sh/zoltan"
local file
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
then
. "$file"
_process_query zoltan "$ZOLTAN_ARCH_PATH"
else
echo "(no $config)" 1>&2
echo "zoltan=unknown"
fi
}
#------------------------------------------------------------------------------
# Reset
no_zoltan
# Test/query