From: Michael Cree <mcree@orcon.net.nz>
Date: Wed, 20 Jun 2018 21:56:18 +1200
Subject: Don't misdetect compiler on Alpha as not supporting NaN

Closes: #901920

plplot FTBFS on Alpha [1] with missing libcsirocsa.so files at the
install stage.  One can trace this back to the cmake configure at
the start which misdetects the compiler as not supporting NaNs
(from the build log):

-- Check for NaN awareness in C compiler
-- Check for NaN awareness in C compiler - not found
-- WARNING: Setting PL_HAVE_QHULL and WITH_CSA to OFF.

In cmake/modules/csiro.cmake is:

  if(CMAKE_SYSTEM_PROCESSOR MATCHES "alpha.*")
    if(CMAKE_C_COMPILER MATCHES "gcc")
      set(NAN_CFLAGS "${NAN_CFLAGS} -mieee")
    else(CMAKE_C_COMPILER MATCHES "gcc")
      set(NAN_CFLAGS "${NAN_CFLAGS} -ieee")
    endif(CMAKE_C_COMPILER MATCHES "gcc")

In the build CMAKE_C_COMPILER gets set to /usr/bin/cc which is gcc
on Debian Linux but does not match "gcc" in the test and thus the
test proceeds with the compiler option "-ieee" intended for the
Compaq C compiler, not for gcc.

A simple fix for Debian Linux would be to eliminate the test for
gcc (as the Compaq C Compiler for Alpha Linux has not been runnable
under Linux for quite a few years so there is no point in testing
for it) and just use the -mieee command line argument, i.e.,

  if(CMAKE_SYSTEM_PROCESSOR MATCHES "alpha.*")
     set(NAN_CFLAGS "${NAN_CFLAGS} -mieee")
  endif(CMAKE_SYSTEM_PROCESSOR MATCHES "alpha.*")

I suspect this fix might not be acceptable to upstream as it
potentially breaks the build on Tru64 Unix with the Compaq C
compiler.

Cheers,
Michael.
---
 cmake/modules/csiro.cmake | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/cmake/modules/csiro.cmake b/cmake/modules/csiro.cmake
index 81d663f..1aa5de7 100644
--- a/cmake/modules/csiro.cmake
+++ b/cmake/modules/csiro.cmake
@@ -28,11 +28,7 @@ option(WITH_CSA "Enable use of the csa library" ON)
 set(NAN_CFLAGS ${CMAKE_C_FLAGS})
 if(PL_HAVE_QHULL OR WITH_CSA)
   if(CMAKE_SYSTEM_PROCESSOR MATCHES "alpha.*")
-    if(CMAKE_C_COMPILER MATCHES "gcc")
-      set(NAN_CFLAGS "${NAN_CFLAGS} -mieee")
-    else(CMAKE_C_COMPILER MATCHES "gcc")
-      set(NAN_CFLAGS "${NAN_CFLAGS} -ieee")
-    endif(CMAKE_C_COMPILER MATCHES "gcc")
+    set(NAN_CFLAGS "${NAN_CFLAGS} -mieee")
   endif(CMAKE_SYSTEM_PROCESSOR MATCHES "alpha.*")
   if(NOT DEFINED NaNAwareCCompiler)
     message(STATUS "Check for NaN awareness in C compiler")
