Swap-Aggregator-Subgraph/node_modules/secp256k1/utils/has_lib.sh
2022-07-03 07:27:35 +05:30

24 lines
562 B
Bash
Executable File

#!/usr/bin/env sh
has_lib() {
local regex="lib$1.+(so|dylib)"
# Add /sbin to path as ldconfig is located there on some systems - e.g. Debian
# (and it still can be used by unprivileged users):
PATH="$PATH:/sbin"
export PATH
# Try just checking common library locations
for dir in /lib /usr/lib /usr/local/lib /opt/local/lib /usr/lib/x86_64-linux-gnu /usr/lib/i386-linux-gnu; do
test -d $dir && echo "$(ls $dir)" | grep -E $regex && return 0
done
return 1
}
has_lib $1 > /dev/null
if test $? -eq 0; then
echo true
else
echo false
fi