2013-01-09 20:43:37 +01:00
|
|
|
#!/bin/sh
|
2013-01-17 13:41:28 +01:00
|
|
|
set -e
|
2013-01-09 20:43:37 +01:00
|
|
|
# SoX Resampler Library Copyright (c) 2007-13 robs@users.sourceforge.net
|
|
|
|
# Licence for this file: LGPL v2.1 See LICENCE for details.
|
|
|
|
|
|
|
|
# Sanity-check of library installed on unix-like system
|
|
|
|
|
|
|
|
dir="$(dirname $(readlink -f $0))"
|
|
|
|
|
|
|
|
# Find the examples:
|
|
|
|
src="$1"
|
|
|
|
test x"$src" = x && src="$dir/examples"
|
|
|
|
cd $src
|
|
|
|
|
|
|
|
# Somewhere to put the binaries:
|
|
|
|
tmp=`mktemp -d`
|
|
|
|
|
2013-01-17 13:41:28 +01:00
|
|
|
# Determine library:
|
2013-01-09 20:43:37 +01:00
|
|
|
if [ `basename $0` = inst-check-soxr ]; then
|
2013-01-17 13:41:28 +01:00
|
|
|
libs=$(pkg-config --libs soxr)
|
2013-01-09 20:43:37 +01:00
|
|
|
else
|
2013-01-17 13:41:28 +01:00
|
|
|
libs=$(pkg-config --libs soxr-lsr)
|
|
|
|
a=a # Files for soxr-lsr have 'a' suffix on example number.
|
2013-01-09 20:43:37 +01:00
|
|
|
fi
|
|
|
|
|
2013-01-17 13:41:28 +01:00
|
|
|
# Build the examples for this lib, C then C++ (if any):
|
|
|
|
stat -t ?$a-*.c >/dev/null 2>&1 && for f in ?$a-*.c; do
|
|
|
|
echo "cc -I\"$src\" $f $libs -o $tmp/$f.out"
|
|
|
|
cc -I"$src" $f $libs -o $tmp/$f.out
|
|
|
|
done
|
|
|
|
stat -t ?$a-*.C >/dev/null 2>&1 && for f in ?$a-*.C; do
|
|
|
|
echo "c++ -I\"$src\" $f $libs -o $tmp/$f.out"
|
|
|
|
c++ -I"$src" $f $libs -o $tmp/$f.out
|
|
|
|
done
|
|
|
|
|
2013-01-09 20:43:37 +01:00
|
|
|
# Run one example:
|
2013-01-17 13:41:28 +01:00
|
|
|
for f in $tmp/1*.out; do
|
|
|
|
echo $f
|
|
|
|
$f
|
|
|
|
done
|
2013-01-09 20:43:37 +01:00
|
|
|
|
|
|
|
# Tidy up:
|
|
|
|
rm -rf $tmp
|