#!/bin/sh
#
# This file is part of the Yices SMT Solver.
# Copyright (C) 2017 SRI International.
#
# Yices is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Yices is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Yices. If not, see .
#
#
# Script to get the name of the dynamic Yices library
#
# Usage:
# ./lib_name
#
# - the argument must be the path to the binary or static dist
# - there should be a lib/libyices.xxx in there
# - this script returns the name of this file
#
usage="Usage: $0
For example
$0 ./build/x86_64-unknown-linux-gnu-release/dist
"
if test $# -ne 1 ; then
echo "$usage"
exit 2
fi
dist=$1
libdir=$1/lib
if test ! -d $libdir ; then
echo "Error: $libdir not found"
exit 2
fi
alllibs=`ls $libdir`
libname="none"
for lib in $alllibs; do
case $lib in
libyices.so.* | libyices.*.dylib )
if test $libname = "none" ; then
libname=$lib
else
echo "Error: found two dymanic libraries: $libname and $lib"
exit 2
fi
;;
esac
done
echo $libname