diff --git a/configure b/configure index 86574dc8..f5f4d234 100755 --- a/configure +++ b/configure @@ -230,6 +230,12 @@ tmpc="$(mktemp).c" cat > "$tmpc" </dev/null; then if $cccmd "$tmpc" $CFLAGS -o "${tmpc}.out"; then rm -f "$tmpc" diff --git a/tests/config.make.ok b/tests/config.make.ok new file mode 100644 index 00000000..38c27e26 --- /dev/null +++ b/tests/config.make.ok @@ -0,0 +1,3 @@ +# GENERATED BY configure +PLATFORM ?= linux +PREFIX ?= /foo/bar diff --git a/tests/test-configure.sh b/tests/test-configure.sh new file mode 100755 index 00000000..7a05b166 --- /dev/null +++ b/tests/test-configure.sh @@ -0,0 +1,37 @@ +#! /bin/sh + +set -e + +configure=../configure + +# Prevent clobbering/removing config.make files which are not in the +# tests directory +[ -e runtests.sh ] || { + echo "This script is to be executed from the tests directory." >&2 + exit 1 +} + +trap "[ -e runtests.sh ] && rm -f config.make" EXIT + +check_shell() { + if command -v "$@" >/dev/null; then + echo "Checking $*" + "$@" "$configure" --prefix /foo/bar >/dev/null + diff config.make config.make.ok + else + echo "Skipping $* (not found)" + fi +} + +check_shell bash +check_shell busybox sh +check_shell dash +check_shell sh + +command -v shellcheck >/dev/null && { + echo "Checking $configure with shellcheck" + shellcheck "$configure" + + echo "Checking $0 with shellcheck" + shellcheck "$0" +}