From 1dc2bb2266d14dfc082706a947a5f8668ed51a0c Mon Sep 17 00:00:00 2001 From: 1138-4EB <1138-4EB@users.noreply.github.com> Date: Wed, 23 Oct 2019 17:39:58 +0100 Subject: fix(configure): use '/dev/null' to check 'cmp', use 'sed' to compare versions (#986) --- configure | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configure b/configure index 7335523fa..ac84f61a3 100755 --- a/configure +++ b/configure @@ -164,7 +164,7 @@ if ! grep $pat $srcdir/configure > /dev/null 2>&1; then exit 1 fi -if ! `cmp --help > /dev/null 2>&1`; then +if ! `cmp /dev/null /dev/null > /dev/null 2>&1`; then echo "Sorry, you need 'cmp' to configure GHDL."; exit 1 fi @@ -191,8 +191,8 @@ fi # Check the version of libghdl is correct. if [ "$enable_libghdl" = true ]; then libghdl_version="$srcdir/python/libghdl/version.py" - # Compare a fixed number of bytes (-n), to avoid false positives due to LF/CRLF mismatch. - if ! echo "__version__ = '${ghdl_version}'" | cmp -n "${#ghdl_version}" "$libghdl_version" ; then + # Extract content between sinlge quotes in version.py, to avoid false positives due to LF/CRLF mismatch. + if [ "$ghdl_version" != "`sed "s/.*'\(.*\)'.*/\1/g" $libghdl_version`" ]; then echo "Sorry, the version of $libghdl_version is not correct" echo "update the version to: $ghdl_version" echo "or use --disable-libghdl" -- cgit v1.2.3