mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: streamline handling of static/dynamic libs in detection scripts
This commit is contained in:
committed by
Andrew Heather
parent
beefee48d4
commit
897528da1a
@ -61,7 +61,7 @@ echo_scotch()
|
||||
# -> HAVE_SCOTCH, SCOTCH_ARCH_PATH, SCOTCH_INC_DIR, SCOTCH_LIB_DIR
|
||||
have_scotch()
|
||||
{
|
||||
local prefix header library static settings warn
|
||||
local prefix header library incName libName settings warn
|
||||
warn="==> skip scotch"
|
||||
|
||||
# Setup
|
||||
@ -73,13 +73,10 @@ have_scotch()
|
||||
return 2
|
||||
fi
|
||||
|
||||
# Location
|
||||
# Expected location, include/library names
|
||||
prefix="$SCOTCH_ARCH_PATH"
|
||||
|
||||
# Header/library names
|
||||
header="scotch.h"
|
||||
library="libscotch$extLibso"
|
||||
static="libscotch$extLiba"
|
||||
incName="scotch.h"
|
||||
libName="libscotch"
|
||||
|
||||
# ----------------------------------
|
||||
if isNone "$prefix"
|
||||
@ -88,50 +85,39 @@ have_scotch()
|
||||
return 1
|
||||
elif hasAbsdir "$prefix"
|
||||
then
|
||||
header=$(findFirstFile "$prefix/include/$header")
|
||||
|
||||
library=$(findFirstFile \
|
||||
"$(thirdExtLib $library)" \
|
||||
"$prefix/lib/$static" \
|
||||
"$prefix/lib/$library" \
|
||||
"$prefix/lib$WM_COMPILER_LIB_ARCH/$static" \
|
||||
"$prefix/lib$WM_COMPILER_LIB_ARCH/$library" \
|
||||
)
|
||||
|
||||
header=$(findFirstFile "$prefix/include/$incName")
|
||||
library="$(findExtLib $libName)"
|
||||
elif isSystem "$prefix"
|
||||
then
|
||||
prefix=/usr
|
||||
|
||||
header=$(findFirstFile \
|
||||
"/usr/local/include/scotch/$header" \
|
||||
"/usr/local/include/$header" \
|
||||
"/usr/include/scotch/$header" \
|
||||
"/usr/include/$header" \
|
||||
)
|
||||
|
||||
case "$header" in (/usr/local/*) prefix=/usr/local ;; esac
|
||||
|
||||
library=$(findFirstFile \
|
||||
"$prefix/lib/$library" \
|
||||
"$prefix/lib$WM_COMPILER_LIB_ARCH/$library" \
|
||||
"/usr/local/include/scotch/$incName" \
|
||||
"/usr/local/include/$incName" \
|
||||
"/usr/include/scotch/$incName" \
|
||||
"/usr/include/$incName" \
|
||||
)
|
||||
prefix=$(sysPrefix "$header")
|
||||
else
|
||||
unset prefix header library
|
||||
unset prefix
|
||||
fi
|
||||
# ----------------------------------
|
||||
|
||||
# Header found?
|
||||
# Header
|
||||
[ -n "$header" ] || {
|
||||
[ -n "$warn" ] && echo "$warn (no header)"
|
||||
return 2
|
||||
}
|
||||
|
||||
# Library found?
|
||||
[ -n "$library" ] || {
|
||||
# Library
|
||||
[ -n "$library" ] || library=$(findLibrary \
|
||||
"$prefix/lib/$libName" \
|
||||
"$prefix/lib$WM_COMPILER_LIB_ARCH/$libName" \
|
||||
) || {
|
||||
[ -n "$warn" ] && echo "$warn (no library)"
|
||||
return 2
|
||||
}
|
||||
|
||||
# ----------------------------------
|
||||
|
||||
local good label
|
||||
|
||||
# Ensure consistent sizes between OpenFOAM and scotch header
|
||||
@ -189,7 +175,7 @@ have_scotch()
|
||||
# -> HAVE_PTSCOTCH, PTSCOTCH_ARCH_PATH, PTSCOTCH_INC_DIR, PTSCOTCH_LIB_DIR
|
||||
have_ptscotch()
|
||||
{
|
||||
local prefix header library static settings warn
|
||||
local prefix header library incName libName settings warn
|
||||
warn="==> skip ptscotch"
|
||||
|
||||
if [ "$HAVE_SCOTCH" != true ]
|
||||
@ -201,13 +187,10 @@ have_ptscotch()
|
||||
# Reuse old settings
|
||||
[ -n "$PTSCOTCH_ARCH_PATH" ] || PTSCOTCH_ARCH_PATH="$SCOTCH_ARCH_PATH"
|
||||
|
||||
# Location
|
||||
# Expected location, include/library names
|
||||
prefix="$PTSCOTCH_ARCH_PATH"
|
||||
|
||||
# Header/library names
|
||||
header="ptscotch.h"
|
||||
library="libptscotch$extLibso"
|
||||
static="libptscotch$extLiba"
|
||||
incName="ptscotch.h"
|
||||
libName="libptscotch"
|
||||
|
||||
# ----------------------------------
|
||||
if isNone "$prefix"
|
||||
@ -217,55 +200,44 @@ have_ptscotch()
|
||||
elif hasAbsdir "$prefix"
|
||||
then
|
||||
header=$(findFirstFile \
|
||||
"$prefix/include/$FOAM_MPI/$header" \
|
||||
"$prefix/include/$header"
|
||||
"$prefix/include/$FOAM_MPI/$incName" \
|
||||
"$prefix/include/$incName"
|
||||
)
|
||||
|
||||
library=$(findFirstFile \
|
||||
"$(thirdExtLib $FOAM_MPI/$library)" \
|
||||
"$(thirdExtLib $library)" \
|
||||
"$prefix/lib/$static" \
|
||||
"$prefix/lib/$library" \
|
||||
"$prefix/lib$WM_COMPILER_LIB_ARCH/$static" \
|
||||
"$prefix/lib$WM_COMPILER_LIB_ARCH/$library" \
|
||||
)
|
||||
|
||||
library="$(findExtLib $FOAM_MPI/$libName $libName)"
|
||||
elif isSystem "$prefix"
|
||||
then
|
||||
prefix=/usr
|
||||
|
||||
header=$(findFirstFile \
|
||||
"/usr/local/include/ptscotch/$header" \
|
||||
"/usr/local/include/scotch/$header" \
|
||||
"/usr/local/include/$header" \
|
||||
"/usr/include/ptscotch/$header" \
|
||||
"/usr/include/scotch/$header" \
|
||||
"/usr/include/$header" \
|
||||
"/usr/local/include/ptscotch/$incName" \
|
||||
"/usr/local/include/scotch/$incName" \
|
||||
"/usr/local/include/$incName" \
|
||||
"/usr/include/ptscotch/$incName" \
|
||||
"/usr/include/scotch/$incName" \
|
||||
"/usr/include/$incName" \
|
||||
)
|
||||
|
||||
case "$header" in (/usr/local/*) prefix=/usr/local ;; esac
|
||||
|
||||
library=$(findFirstFile \
|
||||
"$prefix/lib/$library" \
|
||||
"$prefix/lib$WM_COMPILER_LIB_ARCH/$library" \
|
||||
)
|
||||
else
|
||||
unset prefix header library
|
||||
unset prefix
|
||||
fi
|
||||
# ----------------------------------
|
||||
|
||||
# Header found?
|
||||
# Header
|
||||
[ -n "$header" ] || {
|
||||
[ -n "$warn" ] && echo "$warn (no header)"
|
||||
return 2
|
||||
}
|
||||
|
||||
# Library found?
|
||||
[ -n "$library" ] || {
|
||||
# Library
|
||||
[ -n "$library" ] || library=$(findLibrary \
|
||||
"$prefix/lib/$libName" \
|
||||
"$prefix/lib$WM_COMPILER_LIB_ARCH/$libName" \
|
||||
) || {
|
||||
[ -n "$warn" ] && echo "$warn (no library)"
|
||||
return 2
|
||||
}
|
||||
|
||||
# ----------------------------------
|
||||
|
||||
# OK
|
||||
echo "ptscotch - $prefix"
|
||||
export HAVE_PTSCOTCH=true
|
||||
|
||||
Reference in New Issue
Block a user