1#/usr/bin/env sh
2set -e
3
4
5make="make -C $lz4_root"
6unamestr=$(uname)
7if [ "$unamestr" = 'Linux' ]; then
8  make="make -C $lz4_root"
9elif [ "$unamestr" = 'FreeBSD' -o "$unamestr" = 'OpenBSD' ]; then
10  make="gmake -C $lz4_root"
11fi
12
13for cmd in install uninstall; do
14  for upper in DUMMY PREFIX EXEC_PREFIX LIBDIR INCLUDEDIR PKGCONFIGDIR BINDIR MANDIR MAN1DIR ; do
15    lower=$(echo $upper | tr '[:upper:]' '[:lower:]')
16    tmp_lower="$(pwd)/tmp-lower-$lower/"
17    tmp_upper="$(pwd)/tmp-upper-$lower/"
18    echo $make $cmd DESTDIR="$tmp_upper" $upper="test"
19    $make $cmd DESTDIR="$tmp_upper" $upper="test" >/dev/null
20    echo $make $cmd DESTDIR="$tmp_lower" $lower="test"
21    $make $cmd DESTDIR="$tmp_lower" $lower="test" >/dev/null
22    command diff -r "$tmp_lower" "$tmp_upper" && echo "SAME!" || false
23    if [ "x$cmd" = "xuninstall" ]; then
24      test -z "$(find "$tmp_lower" -type f)" && echo "EMPTY!" || false
25      rm -rf "$tmp_upper" "$tmp_lower"
26    fi
27  done
28done
29