tweak compiler identification: check GNU compatibility first & then do ID checks.

This commit is contained in:
Brian Cox 2019-09-29 21:48:20 -07:00
parent 6455c3966c
commit a4e53b9e64
3 changed files with 106 additions and 59 deletions

View File

@ -88,7 +88,7 @@
/* Define to 1 if you have the `fstatat' function. */ /* Define to 1 if you have the `fstatat' function. */
#undef HAVE_FSTATAT #undef HAVE_FSTATAT
/* Uses the GNU gcc compiler */ /* Uses the GNU g++ compiler */
#undef HAVE_GCC #undef HAVE_GCC
/* Define to 1 if you have the `getaddrinfo' function. */ /* Define to 1 if you have the `getaddrinfo' function. */
@ -109,6 +109,9 @@
/* Define to 1 if you have the `getuid' function. */ /* Define to 1 if you have the `getuid' function. */
#undef HAVE_GETUID #undef HAVE_GETUID
/* Compiler supports GNU C++ dialect & args */
#undef HAVE_GNUC
/* Define to 1 if you have the <grp.h> header file. */ /* Define to 1 if you have the <grp.h> header file. */
#undef HAVE_GRP_H #undef HAVE_GRP_H
@ -124,6 +127,9 @@
/* Define to 1 if you have the <iconv.h> header file. */ /* Define to 1 if you have the <iconv.h> header file. */
#undef HAVE_ICONV_H #undef HAVE_ICONV_H
/* Uses the Intel ICC compiler */
#undef HAVE_INTEL_ICC
/* Define to 1 if you have the <inttypes.h> header file. */ /* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H #undef HAVE_INTTYPES_H

74
configure vendored
View File

@ -4143,7 +4143,7 @@ if test -z "$CXX"; then
CXX=$CCC CXX=$CCC
else else
if test -n "$ac_tool_prefix"; then if test -n "$ac_tool_prefix"; then
for ac_prog in g++ clang++ sunCC aCC xlc++_r gxlc++ ixlc icc owcc cl KCC cfront c++ for ac_prog in g++ clang++ sunCC aCC xlc++_r gxlc++ ixlc icpc owcc cl KCC cfront c++
do do
# Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
set dummy $ac_tool_prefix$ac_prog; ac_word=$2 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
@ -4187,7 +4187,7 @@ fi
fi fi
if test -z "$CXX"; then if test -z "$CXX"; then
ac_ct_CXX=$CXX ac_ct_CXX=$CXX
for ac_prog in g++ clang++ sunCC aCC xlc++_r gxlc++ ixlc icc owcc cl KCC cfront c++ for ac_prog in g++ clang++ sunCC aCC xlc++_r gxlc++ ixlc icpc owcc cl KCC cfront c++
do do
# Extract the first word of "$ac_prog", so it can be a program name with args. # Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2 set dummy $ac_prog; ac_word=$2
@ -4869,57 +4869,79 @@ fi
if test "x${CXX}" = "xg++"; then if test "x${GXX}" != "x"; then
$as_echo "#define HAVE_GCC 1" >>confdefs.h
CFLAGS=${CFLAGS:-"-O -pipe"} CFLAGS=${CFLAGS:-"-O -pipe"}
CXXFLAGS=${CXXFLAGS:-"-O -pipe"} CXXFLAGS=${CXXFLAGS:-"-O -pipe"}
fi
if test "x${CXX}" = "xclang++"; then
$as_echo "#define HAVE_GNUC 1" >>confdefs.h
case "${CXX}" in
*clang++*)
$as_echo "#define HAVE_CLANG 1" >>confdefs.h
;;
icpc)
$as_echo "#define HAVE_INTEL_ICC 1" >>confdefs.h
;;
*)
$as_echo "#define HAVE_GCC 1" >>confdefs.h
;;
esac
else
if test "x${CXX}" = "xclang++"; then
$as_echo "#define HAVE_CLANG 1" >>confdefs.h $as_echo "#define HAVE_CLANG 1" >>confdefs.h
CFLAGS=${CFLAGS:-"-O -pipe"} CFLAGS=${CFLAGS:-"-O -pipe"}
CXXFLAGS=${CXXFLAGS:-"-O -pipe"} CXXFLAGS=${CXXFLAGS:-"-O -pipe"}
fi fi
if test "x${CXX}" = "xgxlc++"; then if test "x${CXX}" = "xgxlc++"; then
$as_echo "#define HAVE_IBM_GXLC 1" >>confdefs.h $as_echo "#define HAVE_IBM_GXLC 1" >>confdefs.h
export OBJECT_MODE=64 export OBJECT_MODE=64
CFLAGS=${CFLAGS:-"-O -maix64 -Wx,-qinfo=all" } CFLAGS=${CFLAGS:-"-O -maix64 -Wx,-qinfo=all" }
CXXFLAGS=${CXXFLAGS:-"-O -maix64 -Wx,-qinfo=all"} CXXFLAGS=${CXXFLAGS:-"-O -maix64 -Wx,-qinfo=all"}
ARFLAGS=${ARFLAGS:-"-X 64"} ARFLAGS=${ARFLAGS:-"-X 64"}
fi fi
if test "x${CXX}" = "xxlc++_r"; then if test "x${CXX}" = "xxlc++_r"; then
$as_echo "#define HAVE_IBM_XLC 1" >>confdefs.h $as_echo "#define HAVE_IBM_XLC 1" >>confdefs.h
export OBJECT_MODE=64 export OBJECT_MODE=64
CFLAGS=${CFLAGS:-"-O -q64 -qinfo=all -qsuppress=1540-5311:1540-5337:1540-5341"} CFLAGS=${CFLAGS:-"-O -q64 -qinfo=all -qsuppress=1540-5311:1540-5337:1540-5341"}
CXXFLAGS=${CXXFLAGS:-"-O -q64 -qinfo=all -qsuppress=1540-5311:1540-5337:1540-5341"} CXXFLAGS=${CXXFLAGS:-"-O -q64 -qinfo=all -qsuppress=1540-5311:1540-5337:1540-5341"}
ARFLAGS=${ARFLAGS:-"-X 64"} ARFLAGS=${ARFLAGS:-"-X 64"}
fi fi
if test "x${CXX}" = "xsunCC"; then if test "x${CXX}" = "xsunCC"; then
$as_echo "#define HAVE_ORACLE_SUNCC 1" >>confdefs.h $as_echo "#define HAVE_ORACLE_SUNCC 1" >>confdefs.h
fi fi
if test "x${CXX}" = "xaCC"; then if test "x${CXX}" = "xaCC"; then
$as_echo "#define HAVE_HP_ACC 1" >>confdefs.h $as_echo "#define HAVE_HP_ACC 1" >>confdefs.h
fi
fi fi

View File

@ -29,7 +29,7 @@ dnl ###################
dnl Checks for programs dnl Checks for programs
dnl ################### dnl ###################
AC_PROG_CC([gcc clang suncc aCC xlc_r gxlc cl]) AC_PROG_CC([gcc clang suncc aCC xlc_r gxlc cl])
AC_PROG_CXX([g++ clang++ sunCC aCC xlc++_r gxlc++ ixlc icc owcc cl KCC cfront c++]) AC_PROG_CXX([g++ clang++ sunCC aCC xlc++_r gxlc++ ixlc icpc owcc cl KCC cfront c++])
AC_PROG_RANLIB AC_PROG_RANLIB
AC_PROG_YACC AC_PROG_YACC
AC_PROG_LN_S AC_PROG_LN_S
@ -46,49 +46,68 @@ dnl #########################################
dnl Set up per-compiler constants & base args dnl Set up per-compiler constants & base args
dnl ######################################### dnl #########################################
dnl if test "x${GXX}" != "x"; then dnl first look at compilers that define __GNUC__
if test "x${CXX}" = "xg++"; then dnl since automake is good at that.
AC_DEFINE(HAVE_GCC, 1, [Uses the GNU gcc compiler]) dnl
if test "x${GXX}" != "x"; then
CFLAGS=${CFLAGS:-"-O -pipe"} CFLAGS=${CFLAGS:-"-O -pipe"}
CXXFLAGS=${CXXFLAGS:-"-O -pipe"} CXXFLAGS=${CXXFLAGS:-"-O -pipe"}
fi
if test "x${CXX}" = "xclang++"; then AC_DEFINE(HAVE_GNUC, 1, [Compiler supports GNU C++ dialect & args])
AC_DEFINE(HAVE_CLANG, 1, [Uses the Clang compiler])
CFLAGS=${CFLAGS:-"-O -pipe"} case "${CXX}" in
CXXFLAGS=${CXXFLAGS:-"-O -pipe"} *clang++*)
fi AC_DEFINE(HAVE_CLANG, 1, [Uses the Clang++ compiler])
;;
icpc)
AC_DEFINE(HAVE_INTEL_ICC, 1, [Uses the Intel ICC compiler])
;;
*)
AC_DEFINE(HAVE_GCC, 1, [Uses the GNU g++ compiler])
;;
esac
if test "x${CXX}" = "xgxlc++"; then else
AC_DEFINE(HAVE_IBM_GXLC, 1, [Uses the gxlc++ compiler]) dnl in case Clang stops defining __GNUC__ or user undefines it
if test "x${CXX}" = "xclang++"; then
AC_DEFINE(HAVE_CLANG, 1, [Uses the Clang compiler])
dnl OBJECT_MODE needs to be set while compiling CFLAGS=${CFLAGS:-"-O -pipe"}
export OBJECT_MODE=64 CXXFLAGS=${CXXFLAGS:-"-O -pipe"}
CFLAGS=${CFLAGS:-"-O -maix64 -Wx,-qinfo=all" } fi
CXXFLAGS=${CXXFLAGS:-"-O -maix64 -Wx,-qinfo=all"}
ARFLAGS=${ARFLAGS:-"-X 64"}
fi
if test "x${CXX}" = "xxlc++_r"; then if test "x${CXX}" = "xgxlc++"; then
AC_DEFINE(HAVE_IBM_XLC, 1, [Uses the IBM XL C++ compiler]) AC_DEFINE(HAVE_IBM_GXLC, 1, [Uses the gxlc++ compiler])
dnl OBJECT_MODE needs to be set while compiling dnl OBJECT_MODE needs to be set while compiling
export OBJECT_MODE=64 export OBJECT_MODE=64
CFLAGS=${CFLAGS:-"-O -q64 -qinfo=all -qsuppress=1540-5311:1540-5337:1540-5341"} CFLAGS=${CFLAGS:-"-O -maix64 -Wx,-qinfo=all" }
CXXFLAGS=${CXXFLAGS:-"-O -q64 -qinfo=all -qsuppress=1540-5311:1540-5337:1540-5341"} CXXFLAGS=${CXXFLAGS:-"-O -maix64 -Wx,-qinfo=all"}
ARFLAGS=${ARFLAGS:-"-X 64"} ARFLAGS=${ARFLAGS:-"-X 64"}
fi fi
dnl *** TODO these compilers need work on default args **** if test "x${CXX}" = "xxlc++_r"; then
AC_DEFINE(HAVE_IBM_XLC, 1, [Uses the IBM XL C++ compiler])
dnl OBJECT_MODE needs to be set while compiling
export OBJECT_MODE=64
CFLAGS=${CFLAGS:-"-O -q64 -qinfo=all -qsuppress=1540-5311:1540-5337:1540-5341"}
CXXFLAGS=${CXXFLAGS:-"-O -q64 -qinfo=all -qsuppress=1540-5311:1540-5337:1540-5341"}
ARFLAGS=${ARFLAGS:-"-X 64"}
fi
dnl *** TODO these compilers need work on default args ****
if test "x${CXX}" = "xsunCC"; then
AC_DEFINE(HAVE_ORACLE_SUNCC, 1, [Uses the sunCC compiler])
fi
if test "x${CXX}" = "xaCC"; then
AC_DEFINE(HAVE_HP_ACC, 1, [Uses the aCC compiler])
fi
if test "x${CXX}" = "xsunCC"; then
AC_DEFINE(HAVE_ORACLE_SUNCC, 1, [Uses the sunCC compiler])
fi
if test "x${CXX}" = "xaCC"; then
AC_DEFINE(HAVE_HP_ACC, 1, [Uses the aCC compiler])
fi fi
dnl ###################### dnl ######################