Fix bashism in Makefile for better portability

Syntax `[[ "foo" != /* ]]` is not defined by POSIX Shell Command
Language. It's supported only by ksh, Bash and ZSH. Other POSIX
shells, such as ash or dash, does not support it.

This patch replaces this problematic syntax with simple case statement
that is supported by all POSIX-sh compatible shells, including (but not
limited to) ash, bash, dash, ZSH.
This commit is contained in:
Jakub Jirutka 2018-03-15 01:24:49 +01:00 committed by Matthew Flatt
parent 67a982ad6a
commit f23b27e393

View File

@ -109,11 +109,10 @@ plain-install:
$(MAKE) plain-install-@MAIN_VARIANT@ $(MAKE) plain-install-@MAIN_VARIANT@
install-common-first: install-common-first:
if [ "$(DESTDIR)" != "" ]; then \ case "$(DESTDIR)" in \
if [[ "$(DESTDIR)" != /* ]]; then \ "" | /*) ;; \
echo "expected an absolute path for DESTDIR; given: $(DESTDIR)"; exit 1; \ *) echo "expected an absolute path for DESTDIR; given: $(DESTDIR)"; exit 1;; \
fi; \ esac
fi
mkdir -p $(ALLDIRINFO) mkdir -p $(ALLDIRINFO)
install-common-middle: install-common-middle: