diff mbox

configure: Handle having no c++ compiler in FORTIFY_SOURCE check

Message ID 1498490724-20674-1-git-send-email-peter.maydell@linaro.org
State Accepted
Commit e189091fba4481fa4c9d760f0bf9037620a51989
Headers show

Commit Message

Peter Maydell June 26, 2017, 3:25 p.m. UTC
Our FORTIFY_SOURCE check assumes that $cxx refers to a working C++
compiler, with the result that if you don't happen to have one
then configure will spuriously print
  configure: line 4685: c++: command not found

Fix this by adding a 'has $cxx' check.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.7.4

Comments

Philippe Mathieu-Daudé June 26, 2017, 3:51 p.m. UTC | #1
On 06/26/2017 12:25 PM, Peter Maydell wrote:
> Our FORTIFY_SOURCE check assumes that $cxx refers to a working C++

> compiler, with the result that if you don't happen to have one

> then configure will spuriously print

>    configure: line 4685: c++: command not found

> 

> Fix this by adding a 'has $cxx' check.

> 

> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>


> ---

>   configure | 2 +-

>   1 file changed, 1 insertion(+), 1 deletion(-)

> 

> diff --git a/configure b/configure

> index c571ad1..a435908 100755

> --- a/configure

> +++ b/configure

> @@ -4681,7 +4681,7 @@ fi

>   if test "$fortify_source" != "no"; then

>     if echo | $cc -dM -E - | grep __clang__ > /dev/null 2>&1 ; then

>       fortify_source="no";

> -  elif test -n "$cxx" &&

> +  elif test -n "$cxx" && has $cxx &&

>          echo | $cxx -dM -E - | grep __clang__ >/dev/null 2>&1 ; then

>       fortify_source="no";

>     else

>
Michael Tokarev June 27, 2017, 1:26 p.m. UTC | #2
Applied to trivial, thanks!

/mjt
diff mbox

Patch

diff --git a/configure b/configure
index c571ad1..a435908 100755
--- a/configure
+++ b/configure
@@ -4681,7 +4681,7 @@  fi
 if test "$fortify_source" != "no"; then
   if echo | $cc -dM -E - | grep __clang__ > /dev/null 2>&1 ; then
     fortify_source="no";
-  elif test -n "$cxx" &&
+  elif test -n "$cxx" && has $cxx &&
        echo | $cxx -dM -E - | grep __clang__ >/dev/null 2>&1 ; then
     fortify_source="no";
   else