ENH: wmake have_* script changes

- use local 'prefix' variable for easier override and more consistency
This commit is contained in:
Mark Olesen
2019-01-10 20:14:46 +01:00
parent abf6d57ae8
commit fcf4c5fb22
15 changed files with 458 additions and 481 deletions

View File

@ -2,7 +2,7 @@
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
# \\ / A nd | Copyright (C) 2018-2019 OpenCFD Ltd.
# \\/ M anipulation |
#------------------------------------------------------------------------------
# License
@ -52,32 +52,43 @@ echo_readline()
# -> HAVE_LIBREADLINE, READLINE_INC_DIR, READLINE_LIB_DIR
have_readline()
{
local header library static settings warn
local prefix header library static settings warn
# warn="==> skip readline"
# Location
prefix=system
# Header/library names
header="readline/readline.h"
library="libreadline$extLibso"
# System only?
header=$(findFirstFile /usr/local/include/$header /usr/include/$header)
# ----------------------------------
if isNone "$prefix"
then
[ -n "$warn" ] && echo "$warn (disabled)"
return 1
elif hasAbsdir "$prefix"
then
header=$(findFirstFile "$prefix/include/$header")
case "$header" in
/usr/local/*)
library=$(findFirstFile \
/usr/local/lib/$library \
/usr/local/lib$WM_COMPILER_LIB_ARCH/$library \
"$prefix/lib/$library" \
"$prefix/lib$WM_COMPILER_LIB_ARCH/$library" \
)
;;
elif isSystem "$prefix"
then
prefix=/usr
header=$(findFirstFile "/usr/local/include/$header" "/usr/include/$header")
case "$header" in (/usr/local/*) prefix=/usr/local ;; esac
*)
library=$(findFirstFile \
/usr/lib/$library \
/usr/lib$WM_COMPILER_LIB_ARCH/$library \
"$prefix/lib/$library" \
"$prefix/lib$WM_COMPILER_LIB_ARCH/$library" \
)
;;
esac
else
unset prefix header library
fi
# ----------------------------------
# Header found?
[ -n "$header" ] || {
@ -87,12 +98,13 @@ have_readline()
# Library found?
[ -n "$library" ] || {
[ -n "$warn" ] && echo "$warn (missing library)"
[ -n "$warn" ] && echo "$warn (no library)"
return 2
}
header="${header%/*}" # Strip one-level (include/readline/...)
header="${header%/*}" # Strip one-level (include/readline/...)
# OK
export HAVE_LIBREADLINE=true
export READLINE_INC_DIR="${header%/*}" # Basename
export READLINE_LIB_DIR="${library%/*}" # Basename