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

36
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,15 +4869,34 @@ 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
$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 if test "x${CXX}" = "xclang++"; then
$as_echo "#define HAVE_CLANG 1" >>confdefs.h $as_echo "#define HAVE_CLANG 1" >>confdefs.h
@ -4923,6 +4942,9 @@ $as_echo "#define HAVE_HP_ACC 1" >>confdefs.h
fi fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts -Wall" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts -Wall" >&5
$as_echo_n "checking whether C++ compiler accepts -Wall... " >&6; } $as_echo_n "checking whether C++ compiler accepts -Wall... " >&6; }

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,14 +46,30 @@ 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
AC_DEFINE(HAVE_GNUC, 1, [Compiler supports GNU C++ dialect & args])
case "${CXX}" in
*clang++*)
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
else
dnl in case Clang stops defining __GNUC__ or user undefines it
if test "x${CXX}" = "xclang++"; then if test "x${CXX}" = "xclang++"; then
AC_DEFINE(HAVE_CLANG, 1, [Uses the Clang compiler]) AC_DEFINE(HAVE_CLANG, 1, [Uses the Clang compiler])
@ -91,6 +107,9 @@ if test "x${CXX}" = "xaCC"; then
AC_DEFINE(HAVE_HP_ACC, 1, [Uses the aCC compiler]) AC_DEFINE(HAVE_HP_ACC, 1, [Uses the aCC compiler])
fi fi
fi
dnl ###################### dnl ######################
dnl Enable various warnings dnl Enable various warnings
dnl ##################### dnl #####################