ENH: split up internals of wmake/scripts/have_XXX functions

- adds some more flexibility
This commit is contained in:
Mark Olesen 2020-05-15 13:58:16 +02:00 committed by Andrew Heather
parent c156125669
commit f8ef85b72f
14 changed files with 679 additions and 480 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
@ -66,43 +67,18 @@ 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 prefix="${1:-system}"
local header library
# ----------------------------------
@ -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

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
@ -51,47 +51,18 @@ echo_boost()
}
# 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
}
# 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
@ -50,44 +50,19 @@ echo_ccmio()
}
# 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
}
# 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

@ -34,7 +34,7 @@
#------------------------------------------------------------------------------
# Reset variables
# Reset
no_cgal()
{
unset HAVE_CGAL CGAL_INC_DIR CGAL_LIB_DIR
@ -51,47 +51,18 @@ echo_cgal()
}
# 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
}
# Search
# $1 : prefix (*_ARCH_PATH, system, ...)
#
# On success, return 0 and export variables
# -> HAVE_CGAL, CGAL_INC_DIR, CGAL_LIB_DIR
have_cgal()
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 prefix="${1:-system}"
local header library
# ----------------------------------
@ -132,13 +103,56 @@ 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
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,14 +47,15 @@ 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
#
have_cmake()
search_cmake()
{
# Treat previous queries as "sticky"
if [ -n "$CMAKE_EXE" ]
@ -63,31 +64,18 @@ have_cmake()
return $?
fi
local config="config.sh/cmake"
unset CMAKE_ARCH_PATH
local settings candidate foundExe
local prefix="$1"
local candidate foundExe
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config" 2>/dev/null)"
candidate="$prefix"/bin/cmake
if [ -d "$prefix" ] && [ -f "$candidate" ] && [ -x "$candidate" ]
then
. "$settings"
if [ -d "$CMAKE_ARCH_PATH" ]
then
candidate="$CMAKE_ARCH_PATH"/bin/cmake
if [ -f "$candidate" ] && [ -x "$candidate" ]
then
foundExe="$candidate"
fi
fi
fi
if [ -z "$foundExe" ]
foundExe="$candidate"
elif candidate="$(command -v cmake 2>/dev/null)"
then
# Default: resolve from PATH
if candidate="$(command -v cmake 2>/dev/null)"
then
foundExe="$candidate"
fi
# Resolved from PATH
foundExe="$candidate"
fi
if [ -n "$foundExe" ]
@ -103,9 +91,33 @@ have_cmake()
}
# Reset variables
no_cmake
# Output as per search_* function
have_cmake()
{
# Treat previous queries as "sticky"
if [ -n "$CMAKE_EXE" ]
then
test "$CMAKE_EXE" != "false"
return $?
fi
local config="config.sh/cmake"
local file
unset CMAKE_ARCH_PATH
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config" 2>/dev/null)"
then
. "$file"
fi
search_cmake "$CMAKE_ARCH_PATH"
}
#------------------------------------------------------------------------------
# Reset
no_cmake
# Test/query
case "$1" in
@ -118,5 +130,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
@ -51,47 +51,19 @@ echo_fftw()
}
# 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,7 @@
# or config.sh/hypre
#
# Functions provided
# have_hypre, no_hypre, echo_hypre, query_hypre
# have_hypre, no_hypre, echo_hypre, query_hypre, search_hypre
#
# Variables set on success
# HAVE_HYPRE
@ -34,7 +34,7 @@
#------------------------------------------------------------------------------
# Reset variables
# Reset
no_hypre()
{
unset HAVE_HYPRE HYPRE_INC_DIR HYPRE_LIB_DIR
@ -51,47 +51,18 @@ echo_hypre()
}
# Query settings
query_hypre()
{
local config="config.sh/hypre"
local settings
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
}
# 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 +107,49 @@ 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? (TDB)
if [ ! -d "$HYPRE_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_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

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
@ -51,43 +51,18 @@ echo_kahip()
}
# 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
}
# 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
@ -51,43 +51,18 @@ echo_metis()
}
# 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
}
# 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
@ -51,44 +51,19 @@ echo_mgridgen()
}
# 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
}
# 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

@ -21,7 +21,8 @@
# 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 +35,7 @@
#------------------------------------------------------------------------------
# Reset variables
# Reset
no_petsc()
{
unset HAVE_PETSC PETSC_INC_DIR PETSC_LIB_DIR
@ -67,48 +68,18 @@ 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_ARCH_PATH)
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 prefix="${1:-system}"
local header library
# ----------------------------------
@ -168,7 +139,50 @@ have_petsc()
}
# 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? (TDB)
if [ ! -d "$PETSC_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_petsc "$PETSC_ARCH_PATH"
}
# 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

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
@ -48,17 +48,18 @@ echo_readline()
}
# 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,21 @@
# 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
#
#------------------------------------------------------------------------------
. ${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
@ -57,44 +66,19 @@ echo_scotch()
}
# 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
}
# 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
# ----------------------------------
@ -192,28 +176,19 @@ 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
# ----------------------------------
@ -272,7 +247,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
@ -50,43 +50,18 @@ echo_zoltan()
}
# 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
}
# 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