1
1

Ensure that compilers that pretend to be gcc don't actually get the

gcc-specific compiler flags (because they don't work -- @#$%@#$%!!!)

This commit was SVN r4092.
Этот коммит содержится в:
Jeff Squyres 2005-01-21 13:53:48 +00:00
родитель 4f0adc3ab2
Коммит 46d7f9a7ed
2 изменённых файлов: 70 добавлений и 5 удалений

Просмотреть файл

@ -39,6 +39,32 @@ AC_DEFINE_UNQUOTED(OMPI_CC, "$CC", [OMPI underlying C compiler])
CPPFLAGS="$CPPFLAGS -DOMPI_BUILDING=1" CPPFLAGS="$CPPFLAGS -DOMPI_BUILDING=1"
# Check for compilers that impersonate gcc
AC_MSG_CHECKING([for compilers that impersonate gcc])
msg=
TRULY_GCC=$GCC
if test "$GCC" = "yes"; then
AC_TRY_COMPILE([], [
int i = 3;
#if __INTEL_COMPILER
#error Yes, I am lying about being gcc.
#endif
], [], [msg=intel])
# If we made it through unscathed, then it really is gcc
if test -z "$msg"; then
TRULY_GCC=yes
else
TRULY_GCC=no
fi
else
# We never thought that this was gcc to begin with
msg=not applicable
TRULY_GCC=no
fi
AC_MSG_RESULT([$msg])
# Do we want debugging? # Do we want debugging?
if test "$WANT_DEBUG" = "1"; then if test "$WANT_DEBUG" = "1"; then
@ -47,8 +73,11 @@ if test "$WANT_DEBUG" = "1"; then
AC_MSG_WARN([-g has been added to CFLAGS (--enable-debug)]) AC_MSG_WARN([-g has been added to CFLAGS (--enable-debug)])
fi fi
# These flags are generally gcc-specific; even the gcc-impersonating
# compilers won't accept them.
OMPI_CFLAGS_BEFORE_PICKY="$CFLAGS" OMPI_CFLAGS_BEFORE_PICKY="$CFLAGS"
if test "$GCC" = "yes" -a "$WANT_PICKY_COMPILER" = 1; then if test "$TRULY_GCC" = "yes" -a "$WANT_PICKY_COMPILER" = 1; then
add="-Wall -Wundef -Wno-long-long -Wsign-compare" add="-Wall -Wundef -Wno-long-long -Wsign-compare"
add="$add -Wmissing-prototypes -Wstrict-prototypes" add="$add -Wmissing-prototypes -Wstrict-prototypes"
add="$add -Wcomment -pedantic" add="$add -Wcomment -pedantic"
@ -68,7 +97,7 @@ if test "$GCC" = "yes" -a "$WANT_PICKY_COMPILER" = 1; then
fi fi
# See if this version of gcc allows -finline-functions and/or # See if this version of gcc allows -finline-functions and/or
# -fno-strict-aliasing # -fno-strict-aliasing. Even check the gcc-impersonating compilers.
if test "$GCC" = "yes"; then if test "$GCC" = "yes"; then
CFLAGS_orig="$CFLAGS" CFLAGS_orig="$CFLAGS"
@ -124,6 +153,9 @@ fi
# prohibitive). If we're using anything else, be conservative and # prohibitive). If we're using anything else, be conservative and
# just use -O. # just use -O.
# Note: gcc-imperonating compilers accept -O3, so there's no need for
# $TRULY_GCC here.
if test "$GCC" = yes; then if test "$GCC" = yes; then
OPTFLAGS="-O3" OPTFLAGS="-O3"
else else

Просмотреть файл

@ -27,6 +27,32 @@ BASECXX="`basename $CXX`"
CXXFLAGS="$ompi_cxxflags_save" CXXFLAGS="$ompi_cxxflags_save"
AC_DEFINE_UNQUOTED(OMPI_CXX, "$CXX", [OMPI underlying C++ compiler]) AC_DEFINE_UNQUOTED(OMPI_CXX, "$CXX", [OMPI underlying C++ compiler])
# Check for compilers that impersonate g++
AC_MSG_CHECKING([for compilers that impersonate g++])
msg=
TRULY_GXX=$GXX
if test "$GXX" = "yes"; then
AC_TRY_COMPILE([], [
int i = 3;
#if __INTEL_COMPILER
#error Yes, I am lying about being g++.
#endif
], [], [msg=intel])
# If we made it through unscathed, then it really is g++
if test -z "$msg"; then
TRULY_GXX=yes
else
TRULY_GXX=no
fi
else
# We never thought that this was GXX to begin with
msg=not applicable
TRULY_GXX=no
fi
AC_MSG_RESULT([$msg])
# Do we want debugging? # Do we want debugging?
if test "$WANT_DEBUG" = "1"; then if test "$WANT_DEBUG" = "1"; then
@ -35,8 +61,11 @@ if test "$WANT_DEBUG" = "1"; then
AC_MSG_WARN([-g has been added to CXXFLAGS (--enable-debug)]) AC_MSG_WARN([-g has been added to CXXFLAGS (--enable-debug)])
fi fi
# These flags are generally g++-specific; even the g++-impersonating
# compilers won't accept them.
OMPI_CXXFLAGS_BEFORE_PICKY="$CXXFLAGS" OMPI_CXXFLAGS_BEFORE_PICKY="$CXXFLAGS"
if test "$GCC" = "yes" -a "$WANT_PICKY_COMPILER" = 1; then if test "$TRULY_GXX" = "yes" -a "$WANT_PICKY_COMPILER" = 1; then
add="-g -Wall -Wundef -Wno-long-long" add="-g -Wall -Wundef -Wno-long-long"
# see if -Wno-long-double works... # see if -Wno-long-double works...
@ -53,8 +82,9 @@ if test "$GCC" = "yes" -a "$WANT_PICKY_COMPILER" = 1; then
unset add unset add
fi fi
# See if this version of gcc allows -finline-functions # See if this version of g++ allows -finline-functions
if test "$GCC" = "yes"; then
if test "$GXX" = "yes"; then
CXXFLAGS_orig="$CXXFLAGS" CXXFLAGS_orig="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS -finline-functions" CXXFLAGS="$CXXFLAGS -finline-functions"
add= add=
@ -122,6 +152,9 @@ esac
# Same rationale for g++ as with gcc in OMPI_SETUP_CC. # Same rationale for g++ as with gcc in OMPI_SETUP_CC.
# Note: gcc-imperonating compilers accept -O3, so there's no need for
# $TRULY_GCC here.
if test "$GXX" = yes; then if test "$GXX" = yes; then
OPTFLAGS="-O3" OPTFLAGS="-O3"
else else