From 4749393697360d02b2612673473163214ff99be1 Mon Sep 17 00:00:00 2001 From: Yousong Zhou Date: Tue, 27 Sep 2016 15:01:59 +0800 Subject: build: configure: fix checking CC containing -i option On CentOS 6, the configure process may hang there reading stdin if the we have CC='gcc -isystem'. This can be reproduced with bash -c 'which gcc -i' Signed-off-by: Yousong Zhou Signed-off-by: Tobias Klauser --- configure | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'configure') diff --git a/configure b/configure index 5b2afe0..572fc6d 100755 --- a/configure +++ b/configure @@ -120,6 +120,13 @@ tools_remove() TOOLS_NOBUILD=${TOOLS_NOBUILD# } } +check_command() +{ + local cmd="$1" + + [ "x$(which "$cmd" 2>> config.log)" == "x" ] +} + check_toolchain() { if [ "x$CROSS_COMPILE" != "x" ] ; then @@ -128,7 +135,7 @@ check_toolchain() fi echo -n "[*] Checking compiler $CC ... " - if [ "x$(which $CC 2>> config.log)" == "x" ] ; then + if check_command $CC ; then echo "[NO]" MISSING_TOOLCHAIN=1 else @@ -137,7 +144,7 @@ check_toolchain() fi echo -n "[*] Checking linker $LD ... " - if [ "x$(which $LD 2>> config.log)" == "x" ] ; then + if check_command $LD ; then echo "[NO]" MISSING_TOOLCHAIN=1 else @@ -146,7 +153,7 @@ check_toolchain() fi echo -n "[*] Checking $PKG_CONFIG ... " - if [ "x$(which $PKG_CONFIG 2>> config.log)" == "x" ] ; then + if check_command $PKG_CONFIG ; then echo "[NO]" MISSING_TOOLCHAIN=1 else @@ -160,7 +167,7 @@ check_flex() { echo -n "[*] Checking flex ... " - if [ "x$(which flex 2>> config.log)" == "x" ] ; then + if check_command flex ; then echo "[NO]" MISSING_DEFS=1 tools_remove "trafgen" @@ -174,7 +181,7 @@ check_bison() { echo -n "[*] Checking bison ... " - if [ "x$(which bison 2>> config.log)" == "x" ] ; then + if check_command bison ; then echo "[NO]" MISSING_DEFS=1 tools_remove "trafgen" -- cgit v1.2.3-54-g00ecf