1
1

Extend test for compiler vendor to include many, many more compilers, and

unify the C / C++ tests, as they are often the same defines to check...

This commit was SVN r8450.
Этот коммит содержится в:
Brian Barrett 2005-12-12 00:41:01 +00:00
родитель 32cecc5798
Коммит 73f4f407c1
4 изменённых файлов: 537 добавлений и 437 удалений

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

@ -67,6 +67,7 @@ m4_include(config/ompi_check_package.m4)
m4_include(config/ompi_check_slurm.m4) m4_include(config/ompi_check_slurm.m4)
m4_include(config/ompi_check_tm.m4) m4_include(config/ompi_check_tm.m4)
m4_include(config/ompi_check_xgrid.m4) m4_include(config/ompi_check_xgrid.m4)
m4_include(config/ompi_check_vendor.m4)
m4_include(config/ompi_config_subdir.m4) m4_include(config/ompi_config_subdir.m4)
m4_include(config/ompi_config_subdir_args.m4) m4_include(config/ompi_config_subdir_args.m4)
m4_include(config/ompi_configure_options.m4) m4_include(config/ompi_configure_options.m4)

247
config/ompi_check_vendor.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,247 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
dnl of Tennessee Research Foundation. All rights
dnl reserved.
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
# OMPI_C_COMPILER_VENDOR(VENDOR_VARIABLE)
# ---------------------------------------
# Set shell variable VENDOR_VARIABLE to the name of the compiler
# vendor for the current C compiler.
#
# See comment for _OMPI_CHECK_COMPILER_VENDOR for a complete
# list of currently detected compilers.
AC_DEFUN([OMPI_C_COMPILER_VENDOR], [
AC_REQUIRE([AC_PROG_CC])
AC_CACHE_CHECK([for the C compiler vendor],
[ompi_cv_c_compiler_vendor],
[AC_LANG_PUSH(C)
_OMPI_CHECK_COMPILER_VENDOR([ompi_cv_c_compiler_vendor])
AC_LANG_POP(C)])
$1="$ompi_cv_c_compiler_vendor"
])
# OMPI_CXX_COMPILER_VENDOR(VENDOR_VARIABLE)
# ---------------------------------------
# Set shell variable VENDOR_VARIABLE to the name of the compiler
# vendor for the current C++ compiler.
#
# See comment for _OMPI_CHECK_COMPILER_VENDOR for a complete
# list of currently detected compilers.
AC_DEFUN([OMPI_CXX_COMPILER_VENDOR], [
AC_REQUIRE([AC_PROG_CXX])
AC_CACHE_CHECK([for the C++ compiler vendor],
[ompi_cv_cxx_compiler_vendor],
[AC_LANG_PUSH(C++)
_OMPI_CHECK_COMPILER_VENDOR([ompi_cv_cxx_compiler_vendor])
AC_LANG_POP(C++)])
$1="$ompi_cv_c_compiler_vendor"
])
# OMPI_IFDEF_IFELSE(symbol, [action-if-defined],
# [action-if-not-defined])
# ----------------------------------------------
# Run compiler to determine if preprocessor symbol "symbol" is
# defined by the compiler.
AC_DEFUN([OMPI_IFDEF_IFELSE], [
AC_COMPILE_IFELSE([#ifndef $1
#error "symbol $1 not defined"
choke me
#endif], [$2], [$3])])
# OMPI_IF_IFELSE(symbol, [action-if-defined],
# [action-if-not-defined])
# ----------------------------------------------
# Run compiler to determine if preprocessor symbol "symbol" is
# defined by the compiler.
AC_DEFUN([OMPI_IF_IFELSE], [
AC_COMPILE_IFELSE([#if !( $1 )
#error "condition $1 not met"
choke me
#endif], [$2], [$3])])
# _OMPI_CHECK_COMPILER_VENDOR(VENDOR_VARIABLE)
# --------------------------------------------
# Set shell variable VENDOR_VARIABLE to the name of the compiler
# vendor for the compiler for the current language. Language must be
# one of C, OBJC, or C++.
#
# thanks to http://predef.sourceforge.net/precomp.html for the list
# of defines to check.
AC_DEFUN([_OMPI_CHECK_COMPILER_VENDOR], [
ompi_check_compiler_vendor_result="unknown"
# GNU is probably the most common, so check that one as soon as
# possible. Intel pretends to be GNU, so need to check Intel
# before checking for GNU.
# Intel
AS_IF([test "$ompi_check_compiler_vendor_result" = "unknown"],
[OMPI_IF_IFELSE([defined(__INTEL_COMPILER) || defined(__ICC)],
[ompi_check_compiler_vendor_result="intel"])])
# GNU
AS_IF([test "$ompi_check_compiler_vendor_result" = "unknown"],
[OMPI_IFDEF_IFELSE([__GNUC__],
[ompi_check_compiler_vendor_result="gnu"])])
# Borland Turbo C
AS_IF([test "$ompi_check_compiler_vendor_result" = "unknown"],
[OMPI_IFDEF_IFELSE([__TURBOC__],
[ompi_check_compiler_vendor_result="borland"])])
# Borland C++
AS_IF([test "$ompi_check_compiler_vendor_result" = "unknown"],
[OMPI_IFDEF_IFELSE([__BORLANDC__],
[ompi_check_compiler_vendor_result="borland"])])
# Comeau C++
AS_IF([test "$ompi_check_compiler_vendor_result" = "unknown"],
[OMPI_IFDEF_IFELSE([__COMO__],
[ompi_check_compiler_vendor_result="comeau"])])
# Compaq C/C++
AS_IF([test "$ompi_check_compiler_vendor_result" = "unknown"],
[OMPI_IF_IFELSE([defined(__DECC) || defined(VAXC) || defined(__VAXC)],
[ompi_check_compiler_vendor_result="compaq"],
[OMPI_IF_IFELSE([defined(__osf__) && defined(__LANGUAGE_C__)],
[ompi_check_compiler_vendor_result="compaq"],
[OMPI_IFDEF_IFELSE([__DECCXX],
[ompi_check_compiler_vendor_result="compaq"])])])])
# Cray C/C++
AS_IF([test "$ompi_check_compiler_vendor_result" = "unknown"],
[OMPI_IFDEF_IFELSE([_CRAY_C],
[ompi_check_compiler_vendor_result="cray"])])
# Diab C/C++
AS_IF([test "$ompi_check_compiler_vendor_result" = "unknown"],
[OMPI_IFDEF_IFELSE([__DCC__],
[ompi_check_compiler_vendor_result="diab"])])
# Digital Mars
AS_IF([test "$ompi_check_compiler_vendor_result" = "unknown"],
[OMPI_IF_IFELSE([defined(__DMC__) || defined(__SC__) || defined(__ZTC__)],
[ompi_check_compiler_vendor_result="digital mars"])])
# HP ANSI C / aC++
AS_IF([test "$ompi_check_compiler_vendor_result" = "unknown"],
[OMPI_IF_IFELSE([defined(__HP_cc) || defined(__HP_aCC)],
[ompi_check_compiler_vendor_result="hp"])])
# IBM XL C/C++
AS_IF([test "$ompi_check_compiler_vendor_result" = "unknown"],
[OMPI_IF_IFELSE([defined(__xlC__) || defined(__IBMC__) || defined(__IBMCPP__)],
[ompi_check_compiler_vendor_result="ibm"],
[OMPI_IF_IFELSE([defined(_AIX) && !defined(__GNUC__)],
[ompi_check_compiler_vendor_result="ibm"])])])
# KAI C++ (rest in peace)
AS_IF([test "$ompi_check_compiler_vendor_result" = "unknown"],
[OMPI_IFDEF_IFELSE([__KCC],
[ompi_check_compiler_vendor_result="kai"])])
# LCC
AS_IF([test "$ompi_check_compiler_vendor_result" = "unknown"],
[OMPI_IFDEF_IFELSE([__LCC__],
[ompi_check_compiler_vendor_result="lcc"])])
# MetaWare High C/C++
AS_IF([test "$ompi_check_compiler_vendor_result" = "unknown"],
[OMPI_IFDEF_IFELSE([__HIGHC__],
[ompi_check_compiler_vendor_result="metaware high"])])
# Metrowerks Codewarrior
AS_IF([test "$ompi_check_compiler_vendor_result" = "unknown"],
[OMPI_IFDEF_IFELSE([__MWERKS__],
[ompi_check_compiler_vendor_result="metrowerks"])])
# MIPSpro (SGI)
AS_IF([test "$ompi_check_compiler_vendor_result" = "unknown"],
[OMPI_IF_IFELSE([defined(sgi) || defined(__sgi)],
[ompi_check_compiler_vendor_result="sgi"])])
# MPW C++
AS_IF([test "$ompi_check_compiler_vendor_result" = "unknown"],
[OMPI_IF_IFELSE([defined(__MRC__) || defined(MPW_C) || defined(MPW_CPLUS)],
[ompi_check_compiler_vendor_result="mpw"])])
# Microsoft
AS_IF([test "$ompi_check_compiler_vendor_result" = "unknown"],
[# Always use C compiler when checking for Microsoft, as
# Visual C++ doesn't recognize .cc as a C++ file.
AC_LANG_PUSH(C)
OMPI_IF_IFELSE([defined(_MSC_VER) || defined(__MSC_VER)],
[ompi_check_compiler_vendor_result="microsoft"])
AC_LANG_POP(C)])
# Norcroft C
AS_IF([test "$ompi_check_compiler_vendor_result" = "unknown"],
[OMPI_IFDEF_IFELSE([__CC_NORCROFT],
[ompi_check_compiler_vendor_result="norcroft"])])
# Pelles C
AS_IF([test "$ompi_check_compiler_vendor_result" = "unknown"],
[OMPI_IFDEF_IFELSE([__POCC__],
[ompi_check_compiler_vendor_result="pelles"])])
# Portland Group
AS_IF([test "$ompi_check_compiler_vendor_result" = "unknown"],
[OMPI_IFDEF_IFELSE([__PGI],
[ompi_check_compiler_vendor_result="portland group"])])
# SAS/C
AS_IF([test "$ompi_check_compiler_vendor_result" = "unknown"],
[OMPI_IF_IFELSE([defined(SASC) || defined(__SASC) || defined(__SASC__)],
[ompi_check_compiler_vendor_result="sas"])])
# Sun Workshop C/C++
AS_IF([test "$ompi_check_compiler_vendor_result" = "unknown"],
[OMPI_IF_IFELSE([defined(__SUNPRO_C) || defined(__SUNPRO_CC)],
[ompi_check_compiler_vendor_result="sun"])])
# TenDRA C/C++
AS_IF([test "$ompi_check_compiler_vendor_result" = "unknown"],
[OMPI_IFDEF_IFELSE([__TenDRA__],
[ompi_check_compiler_vendor_result="tendra"])])
# Tiny C
AS_IF([test "$ompi_check_compiler_vendor_result" = "unknown"],
[OMPI_IFDEF_IFELSE([__TINYC__],
[ompi_check_compiler_vendor_result="tiny"])])
# USL C
AS_IF([test "$ompi_check_compiler_vendor_result" = "unknown"],
[OMPI_IFDEF_IFELSE([__USLC__],
[ompi_check_compiler_vendor_result="usl"])])
# Watcom C++
AS_IF([test "$ompi_check_compiler_vendor_result" = "unknown"],
[OMPI_IFDEF_IFELSE([__WATCOMC__],
[ompi_check_compiler_vendor_result="watcom"])])
$1="$ompi_check_compiler_vendor_result"
unset ompi_check_compiler_vendor_result
])

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

@ -17,6 +17,161 @@ dnl
dnl $HEADER$ dnl $HEADER$
dnl dnl
# OMPI_SETUP_CC()
# ---------------
# Do everything required to setup the C compiler. Safe to AC_REQUIRE
# this macro.
AC_DEFUN([OMPI_SETUP_CC],[
# AM_PROG_CC_C_O AC_REQUIREs AC_PROG_CC, so we have to be a little
# careful about ordering here, and AC_REQUIRE these things so that
# they get stamped out in the right order.
AC_REQUIRE([_OMPI_START_SETUP_CC])
AC_REQUIRE([_OMPI_PROG_CC])
AC_REQUIRE([AM_PROG_CC_C_O])
OMPI_C_COMPILER_VENDOR([ompi_c_vendor])
# Do we want code coverage
if test "$WANT_COVERAGE" = "1"; then
if test "$ompi_c_vendor" = "gnu" ; then
CLEANFILES="*.bb *.bbg *.da *.*.gcov ${CLEANFILES}"
AC_MSG_WARN([-fprofile-arcs -ftest-coverage has been added to CFLAGS (--enable-coverage)])
WANT_DEBUG=1
CFLAGS="-ftest-coverage -fprofile-arcs ${CFLAGS}"
WRAPPER_EXTRA_CFLAGS="-ftest-coverage -fprofile-arcs ${WRAPPER_EXTRA_CFLAGS}"
else
AC_MSG_WARN([Code coverage functionality is currently available only with GCC])
AC_MSG_ERROR([Configure: Cannot continue])
fi
fi
# Do we want debugging?
if test "$WANT_DEBUG" = "1"; then
CFLAGS="$CFLAGS -g"
OMPI_UNIQ(CFLAGS)
AC_MSG_WARN([-g has been added to CFLAGS (--enable-debug)])
fi
# These flags are generally gcc-specific; even the
# gcc-impersonating compilers won't accept them.
OMPI_CFLAGS_BEFORE_PICKY="$CFLAGS"
if test "$WANT_PICKY_COMPILER" = 1 -a "$ompi_c_vendor" = "gnu" ; then
add="-Wall -Wundef -Wno-long-long -Wsign-compare"
add="$add -Wmissing-prototypes -Wstrict-prototypes"
add="$add -Wcomment -pedantic"
# see if -Wno-long-double works...
CFLAGS_orig="$CFLAGS"
CFLAGS="$CFLAGS -Wno-long-double"
AC_CACHE_CHECK([if $CC supports -Wno-long-double],
[ompi_cv_cc_wno_long_double],
[AC_TRY_COMPILE([], [],
[ompi_cv_cc_wno_long_double="yes"],
[ompi_cv_cc_wno_long_double="no"])])
CFLAGS="$CFLAGS_orig"
if test "$ompi_cv_cc_wno_long_double" = "yes" ; then
add="$add -Wno-long-double"
fi
add="$add -Werror-implicit-function-declaration "
CFLAGS="$CFLAGS $add"
OMPI_UNIQ(CFLAGS)
AC_MSG_WARN([$add has been added to CFLAGS (--enable-picky)])
unset add
fi
# See if this version of gcc allows -finline-functions and/or
# -fno-strict-aliasing. Even check the gcc-impersonating compilers.
if test "$GCC" = "yes"; then
CFLAGS_orig="$CFLAGS"
CFLAGS="$CFLAGS_orig -finline-functions"
add=
AC_CACHE_CHECK([if $CC supports -finline-functions],
[ompi_cv_cc_finline_functions],
[AC_TRY_COMPILE([], [],
[ompi_cv_cc_finline_functions="yes"],
[ompi_cv_cc_finline_functions="no"])])
if test "$ompi_cv_cc_finline_functions" = "yes" ; then
add=" -finline-functions"
fi
CFLAGS="$CFLAGS_orig$add"
CFLAGS="$CFLAGS_orig -fno-strict-aliasing"
add=
AC_CACHE_CHECK([if $CC supports -fno-strict-aliasing],
[ompi_cv_cc_fno_strict_aliasing],
[AC_TRY_COMPILE([], [],
[ompi_cv_cc_fno_strict_aliasing="yes"],
[ompi_cv_cc_fno_strict_aliasing="no"])])
if test "$ompi_cv_cc_fno_strict_aliasing" = "yes" ; then
add=" -fno-strict-aliasing"
fi
CFLAGS="$CFLAGS_orig$add"
OMPI_UNIQ(CFLAGS)
AC_MSG_WARN([$add has been added to CFLAGS])
unset add
fi
# Try to enable restrict keyword
RESTRICT_CFLAGS=
case "$ompi_c_vendor" in
intel)
RESTRICT_CFLAGS="-restrict"
;;
sgi)
RESTRICT_CFLAGS="-LANG:restrict=ON"
;;
esac
if test ! -z "$RESTRICT_CFLAGS" ; then
CFLAGS_orig="$CFLAGS"
CFLAGS="$CFLAGS_orig $RESTRICT_CFLAGS"
add=
AC_CACHE_CHECK([if $CC supports $RESTRICT_CFLAGS],
[ompi_cv_cc_restrict_cflags],
[AC_TRY_COMPILE([], [],
[ompi_cv_cc_restrict_cflags="yes"],
[ompi_cv_cc_restrict_cflags="no"])])
if test "ompi_cv_cc_restruct_cflags" = "yes" ; then
add="$RESTRUCT_CFLAGS"
fi
CFLAGS="${CFLAGS_orig}${add}"
OMPI_UNIQ([CFLAGS])
if test "$add" != "" ; then
AC_MSG_WARN([$add has been added to CFLAGS])
fi
unset add
fi
# Preload the optflags for the case where the user didn't specify
# any. If we're using GNU compilers, use -O3 (since it GNU
# doesn't require all compilation units to be compiled with the
# same level of optimization -- selecting a high level of
# optimization is not prohibitive). If we're using anything else,
# be conservative and just use -O.
#
# Note: gcc-imperonating compilers accept -O3
if test "$GCC" = yes; then
OPTFLAGS="-O3"
else
OPTFLAGS="-O"
fi
OMPI_CHECK_OPTFLAGS("$OMPI_CFLAGS_BEFORE_PICKY")
OMPI_CFLAGS_BEFORE_PICKY="$co_result"
AC_MSG_CHECKING([for C optimization flags])
OMPI_CHECK_OPTFLAGS(["$CFLAGS"])
AC_MSG_RESULT([$co_result])
CFLAGS="$co_result"
])
AC_DEFUN([_OMPI_START_SETUP_CC],[ AC_DEFUN([_OMPI_START_SETUP_CC],[
ompi_show_subtitle "C compiler and preprocessor" ompi_show_subtitle "C compiler and preprocessor"
@ -39,235 +194,3 @@ AC_DEFUN([_OMPI_PROG_CC],[
AC_SUBST(OMPI_CC_ABSOLUTE) AC_SUBST(OMPI_CC_ABSOLUTE)
]) ])
AC_DEFUN([_OMPI_PROG_CC_IMPERSONATE_GCC],[
# Check for compilers that impersonate gcc
AC_CACHE_CHECK([if compiler impersonates gcc],
[ompi_cv_prog_cc_impersonate_gcc],
[ompi_cv_prog_cc_impersonate_gcc="no"
if test "$GCC" = "yes" ; then
AC_TRY_COMPILE([], [
int i = 3;
#if __INTEL_COMPILER
#error Yes, I am lying about being gcc.
#endif
], [], [ompi_cv_prog_cc_impersonate_gcc="yes"])
fi])
if test "$GCC" = "yes" -a "$ompi_cv_prog_cc_impersonate_gcc" = "no" ; then
TRULY_GCC="yes"
else
TRULY_GCC="no"
fi
])
AC_DEFUN([_OMPI_C_IFDEF],
[AC_COMPILE_IFELSE([#ifndef $1
# error "Macro $1 is undefined!"
/* For some compilers (eg. SGI's CC), #error is not
enough... */
please, do fail
#endif],
[$2], [$3])])
AC_DEFUN([_OMPI_C_COMPILER_VENDOR],
#
# Arguments:
# optional 1 and 2 for the compiler vendor and the compiler nickname
#
# Depdencies: None
#
# Check to see if the C++ compiler can handle exceptions
#
# Sets OMPI_CXX_EXCEPTIONS to 1 if compiler has exceptions, 0 if not
#
[AC_CACHE_CHECK([the C compiler vendor],
[ac_cv_c_compiler_vendor],
[_OMPI_C_IFDEF([__GNUC__],
[ac_cv_c_compiler_vendor=gnu],
[dnl SGI CC
_OMPI_C_IFDEF([__sgi],
[ac_cv_c_compiler_vendor=sgi],
[_OMPI_C_IFDEF([_MSC_VER],
[ac_cv_c_compiler_vendor=microsoft],
[ac_cv_c_compiler_vendor=unknown]
)
]
)
]
)
]
)
ifelse([$1], , [], [$1="$ac_cv_c_compiler_vendor"])
dnl The compiler nickname
ifelse([$2], , [],
[case "$ac_cv_c_compiler_vendor" in
gnu) $2=gcc;;
microsoft) $2=cl;;
*) $2=unknown;;
esac])
])
AC_DEFUN([OMPI_SETUP_CC],[
# Modularize this setup so that sub-configure.in scripts can use this
# same setup code.
# Order is important!
AC_REQUIRE([_OMPI_START_SETUP_CC])
AC_REQUIRE([_OMPI_PROG_CC])
AC_REQUIRE([AM_PROG_CC_C_O])
AC_REQUIRE([_OMPI_PROG_CC_IMPERSONATE_GCC])
AC_REQUIRE([_OMPI_C_COMPILER_VENDOR])
# Do we want code coverage
if test "$WANT_COVERAGE" = "1"; then
if test "$TRULY_GCC" = "yes"; then
CLEANFILES="*.bb *.bbg *.da *.*.gcov ${CLEANFILES}"
AC_MSG_WARN([-fprofile-arcs -ftest-coverage has been added to CFLAGS (--enable-coverage)])
WANT_DEBUG=1
CFLAGS="-ftest-coverage -fprofile-arcs ${CFLAGS}"
WRAPPER_EXTRA_CFLAGS="-ftest-coverage -fprofile-arcs ${WRAPPER_EXTRA_CFLAGS}"
else
AC_MSG_WARN([Code coverage functionality is currently available only with GCC])
AC_MSG_ERROR([Configure: Cannot continue])
fi
fi
# Do we want debugging?
if test "$WANT_DEBUG" = "1"; then
CFLAGS="$CFLAGS -g"
OMPI_UNIQ(CFLAGS)
AC_MSG_WARN([-g has been added to CFLAGS (--enable-debug)])
fi
# These flags are generally gcc-specific; even the gcc-impersonating
# compilers won't accept them.
OMPI_CFLAGS_BEFORE_PICKY="$CFLAGS"
if test "$TRULY_GCC" = "yes" -a "$WANT_PICKY_COMPILER" = 1; then
add="-Wall -Wundef -Wno-long-long -Wsign-compare"
add="$add -Wmissing-prototypes -Wstrict-prototypes"
add="$add -Wcomment -pedantic"
# see if -Wno-long-double works...
CFLAGS_orig="$CFLAGS"
CFLAGS="$CFLAGS -Wno-long-double"
AC_CACHE_CHECK([if $CC supports -Wno-long-double],
[ompi_cv_cc_wno_long_double],
[AC_TRY_COMPILE([], [],
[ompi_cv_cc_wno_long_double="yes"],
[ompi_cv_cc_wno_long_double="no"])])
CFLAGS="$CFLAGS_orig"
if test "$ompi_cv_cc_wno_long_double" = "yes" ; then
add="$add -Wno-long-double"
fi
add="$add -Werror-implicit-function-declaration "
CFLAGS="$CFLAGS $add"
OMPI_UNIQ(CFLAGS)
AC_MSG_WARN([$add has been added to CFLAGS (--enable-picky)])
unset add
fi
# See if this version of gcc allows -finline-functions and/or
# -fno-strict-aliasing. Even check the gcc-impersonating compilers.
if test "$GCC" = "yes"; then
CFLAGS_orig="$CFLAGS"
CFLAGS="$CFLAGS_orig -finline-functions"
add=
AC_CACHE_CHECK([if $CC supports -finline-functions],
[ompi_cv_cc_finline_functions],
[AC_TRY_COMPILE([], [],
[ompi_cv_cc_finline_functions="yes"],
[ompi_cv_cc_finline_functions="no"])])
if test "$ompi_cv_cc_finline_functions" = "yes" ; then
add=" -finline-functions"
fi
CFLAGS="$CFLAGS_orig$add"
CFLAGS="$CFLAGS_orig -fno-strict-aliasing"
add=
AC_CACHE_CHECK([if $CC supports -fno-strict-aliasing],
[ompi_cv_cc_fno_strict_aliasing],
[AC_TRY_COMPILE([], [],
[ompi_cv_cc_fno_strict_aliasing="yes"],
[ompi_cv_cc_fno_strict_aliasing="no"])])
if test "$ompi_cv_cc_fno_strict_aliasing" = "yes" ; then
add=" -fno-strict-aliasing"
fi
CFLAGS="$CFLAGS_orig$add"
OMPI_UNIQ(CFLAGS)
AC_MSG_WARN([$add has been added to CFLAGS])
unset add
fi
# Try to enable restrict keyword
RESTRICT_CFLAGS=
case "${host}" in
ia64-unknown-linux*)
if test "$CC" = "ecc" ; then
RESTRICT_CFLAGS="-restrict"
fi
;;
mips-sgi-irix*)
if test "$CC" = "cc" ; then
RESTRICT_CFLAGS="-LANG:restrict=ON"
fi
;;
i?86-pc-linux*)
if test "$CC" = "icc" ; then
RESTRICT_CFLAGS="-restrict"
fi
;;
esac
if test ! -z "$RESTRICT_CFLAGS" ; then
CFLAGS_orig="$CFLAGS"
CFLAGS="$CFLAGS_orig $RESTRICT_CFLAGS"
add=
AC_CACHE_CHECK([if $CC supports $RESTRICT_CFLAGS],
[ompi_cv_cc_restrict_cflags],
[AC_TRY_COMPILE([], [],
[ompi_cv_cc_restrict_cflags="yes"],
[ompi_cv_cc_restrict_cflags="no"])])
if test "ompi_cv_cc_restruct_cflags" = "yes" ; then
add="$RESTRUCT_CFLAGS"
fi
CFLAGS="${CFLAGS_orig}${add}"
OMPI_UNIQ(CFLAGS)
if test "$add" != "" ; then
AC_MSG_WARN([$add has been added to CFLAGS])
fi
unset add
fi
# Preload the optflags for the case where the user didn't specify any.
# If we're using GNU compilers, use -O3 (since it GNU doesn't require
# all compilation units to be compiled with the same level of
# optimization -- selecting a high level of optimization is not
# prohibitive). If we're using anything else, be conservative and
# just use -O.
# Note: gcc-imperonating compilers accept -O3, so there's no need for
# $TRULY_GCC here.
if test "$GCC" = yes; then
OPTFLAGS="-O3"
else
OPTFLAGS="-O"
fi
OMPI_CHECK_OPTFLAGS("$OMPI_CFLAGS_BEFORE_PICKY")
OMPI_CFLAGS_BEFORE_PICKY="$co_result"
AC_MSG_CHECKING([for C optimization flags])
OMPI_CHECK_OPTFLAGS("$CFLAGS")
AC_MSG_RESULT([$co_result])
CFLAGS="$co_result"])

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

@ -17,233 +17,162 @@ dnl
dnl $HEADER$ dnl $HEADER$
dnl dnl
# _OMPI_PROG_CXX_IMPERSONATE_GCC() # OMPI_SETUP_CXX()
# -------------------------------- # ----------------
# Check for compilers that impersonate g++ # Do everything required to setup the C++ compiler. Safe to AC_REQUIRE
AC_DEFUN([_OMPI_PROG_CXX_IMPERSONATE_GCC],[ # this macro.
AC_CACHE_CHECK([if compiler impersonates g++],
[ompi_cv_prog_cxx_impersonate_gcc],
[ompi_cv_prog_cxx_impersonate_gcc="no"
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
], [], [ompi_cv_prog_cxx_impersonate_gcc="yes"])
fi])
if test "$GXX" = "yes" -a "$ompi_cv_prog_cxx_impersonate_gcc" = "no" ; then
TRULY_GXX=yes
else
TRULY_GXX=no
fi
])
AC_DEFUN([_OMPI_CXX_COMPILER_VENDOR],
#
# Arguments:
# Optional 1 and 2 : compiler vendor and compiler nickname.
#
# Depdencies: _OMPI_C_IFDEF
#
#
[AC_CACHE_CHECK([the C++ compiler vendor],
[ac_cv_cxx_compiler_vendor],
[AC_LANG_PUSH([C++])
dnl GNU C++
_OMPI_C_IFDEF([__GNUG__],
[ac_cv_cxx_compiler_vendor=gnu],
[_OMPI_C_IFDEF([__DECCXX],
[ac_cv_cxx_compiler_vendor=compaq],
[dnl HP's aCC
_OMPI_C_IFDEF([__HP_aCC],
[ac_cv_cxx_compiler_vendor=hp],
[dnl SGI CC
_OMPI_C_IFDEF([__sgi],
[ac_cv_cxx_compiler_vendor=sgi],
[dnl Note: We are using the C compiler because VC++ doesn't
dnl recognize `.cc'(which is used by `configure') as a C++ file
dnl extension and requires `/TP' to be passed.
AC_LANG_PUSH([C])
_OMPI_C_IFDEF([_MSC_VER],
[ac_cv_cxx_compiler_vendor=microsoft],
[ac_cv_cxx_compiler_vendor=unknown])
AC_LANG_POP()])])])])
AC_LANG_POP()])
ifelse([$1], , [], [$1="$ac_cv_cxx_compiler_vendor"])
dnl The compiler nickname
ifelse([$2], , [],
[case "$ac_cv_cxx_compiler_vendor" in
gnu) $2=g++;;
compaq) $2=cxx;;
hp) $2=aCC;;
sgi) $2=CC;;
microsoft) $2=cl;;
*) $2=unknown;;
esac])
])
AC_DEFUN([OMPI_SETUP_CXX],[ AC_DEFUN([OMPI_SETUP_CXX],[
# Modularize this setup so that sub-configure.in scripts can use this AC_REQUIRE([_OMPI_START_SETUP_CXX])
# same setup code. AC_REQUIRE([_OMPI_PROG_CXX])
ompi_show_subtitle "C++ compiler and preprocessor" OMPI_CXX_COMPILER_VENDOR([ompi_cxx_vendor])
ompi_cxxflags_save="$CXXFLAGS" # Do we want code coverage
AC_PROG_CXX if test "$WANT_COVERAGE" = "1"; then
AC_PROG_CXXCPP if test "$ompi_cxx_vendor" = "gnu" ; then
BASECXX="`basename $CXX`" AC_MSG_WARN([-fprofile-arcs -ftest-coverage has been added to CFLAGS (--enable-coverage)])
CXXFLAGS="$ompi_cxxflags_save" WANT_DEBUG=1
AC_DEFINE_UNQUOTED(OMPI_CXX, "$CXX", [OMPI underlying C++ compiler]) CXXFLAGS="-ftest-coverage -fprofile-arcs ${CXXFLAGS}"
OMPI_CXX_ABSOLUTE="`which $CXX`" WRAPPER_EXTRA_CXXFLAGS="-ftest-coverage -fprofile-arcs ${WRAPPER_EXTRA_CXXFLAGS}"
AC_SUBST(OMPI_CXX_ABSOLUTE) else
AC_MSG_WARN([Code coverage functionality is currently available only with GCC suite])
AC_MSG_ERROR([Configure: cannot continue])
fi
fi
_OMPI_PROG_CXX_IMPERSONATE_GCC # Do we want debugging?
_OMPI_CXX_COMPILER_VENDOR if test "$WANT_DEBUG" = "1"; then
CXXFLAGS="$CXXFLAGS -g"
OMPI_UNIQ(CXXFLAGS)
AC_MSG_WARN([-g has been added to CXXFLAGS (--enable-debug)])
fi
# Do we want code coverage # These flags are generally g++-specific; even the g++-impersonating
if test "$WANT_COVERAGE" = "1"; then # compilers won't accept them.
if test "$TRULY_GXX" = "yes"; then OMPI_CXXFLAGS_BEFORE_PICKY="$CXXFLAGS"
AC_MSG_WARN([-fprofile-arcs -ftest-coverage has been added to CFLAGS (--enable-coverage)]) if test "$WANT_PICKY_COMPILER" = 1 -a "$ompi_cxx_vendor" = "gnu"; then
WANT_DEBUG=1 add="-Wall -Wundef -Wno-long-long"
CXXFLAGS="-ftest-coverage -fprofile-arcs ${CXXFLAGS}"
WRAPPER_EXTRA_CXXFLAGS="-ftest-coverage -fprofile-arcs ${WRAPPER_EXTRA_CXXFLAGS}"
else
AC_MSG_WARN([Code coverage functionality is currently available only with GCC suite])
AC_MSG_ERROR([Configure: cannot continue])
fi
fi
# Do we want debugging? # see if -Wno-long-double works...
AC_LANG_PUSH(C++)
if test "$WANT_DEBUG" = "1"; then CXXFLAGS_orig="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS -g" CXXFLAGS="$CXXFLAGS -Wno-long-double"
OMPI_UNIQ(CXXFLAGS) AC_CACHE_CHECK([if $CXX supports -Wno-long-double],
AC_MSG_WARN([-g has been added to CXXFLAGS (--enable-debug)])
fi
# These flags are generally g++-specific; even the g++-impersonating
# compilers won't accept them.
OMPI_CXXFLAGS_BEFORE_PICKY="$CXXFLAGS"
if test "$TRULY_GXX" = "yes" -a "$WANT_PICKY_COMPILER" = 1; then
add="-Wall -Wundef -Wno-long-long"
# see if -Wno-long-double works...
AC_LANG_PUSH(C++)
CXXFLAGS_orig="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS -Wno-long-double"
AC_CACHE_CHECK([if $CXX supports -Wno-long-double],
[ompi_cv_cxx_wno_long_double], [ompi_cv_cxx_wno_long_double],
[AC_TRY_COMPILE([], [], [AC_TRY_COMPILE([], [],
[ompi_cv_cxx_wno_long_double="yes"], [ompi_cv_cxx_wno_long_double="yes"],
[ompi_cv_cxx_wno_long_double="no"])]) [ompi_cv_cxx_wno_long_double="no"])])
CXXFLAGS="$CXXFLAGS_orig" CXXFLAGS="$CXXFLAGS_orig"
AC_LANG_POP(C++) AC_LANG_POP(C++)
if test "$ompi_cv_cxx_wno_long_double" = "yes" ; then if test "$ompi_cv_cxx_wno_long_double" = "yes" ; then
add="$add -Wno-long-double" add="$add -Wno-long-double"
fi
CXXFLAGS="$CXXFLAGS $add"
OMPI_UNIQ(CXXFLAGS)
if test "$add" != "" ; then
AC_MSG_WARN([$add has been added to CXXFLAGS (--enable-picky)])
fi
unset add
fi fi
CXXFLAGS="$CXXFLAGS $add" # See if this version of g++ allows -finline-functions
OMPI_UNIQ(CXXFLAGS) if test "$GXX" = "yes"; then
if test "$add" != "" ; then CXXFLAGS_orig="$CXXFLAGS"
AC_MSG_WARN([$add has been added to CXXFLAGS (--enable-picky)]) CXXFLAGS="$CXXFLAGS -finline-functions"
fi add=
unset add AC_CACHE_CHECK([if $CXX supports -finline-functions],
fi
# See if this version of g++ allows -finline-functions
if test "$GXX" = "yes"; then
CXXFLAGS_orig="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS -finline-functions"
add=
AC_CACHE_CHECK([if $CXX supports -finline-functions],
[ompi_cv_cxx_finline_functions], [ompi_cv_cxx_finline_functions],
[AC_TRY_COMPILE([], [], [AC_TRY_COMPILE([], [],
[ompi_cv_cxx_finline_functions="yes"], [ompi_cv_cxx_finline_functions="yes"],
[ompi_cv_cxx_finline_functions="no"])]) [ompi_cv_cxx_finline_functions="no"])])
if test "$ompi_cv_cxx_finline_functions" = "yes" ; then if test "$ompi_cv_cxx_finline_functions" = "yes" ; then
add=" -finline-functions" add=" -finline-functions"
fi
CXXFLAGS="$CXXFLAGS_orig$add"
OMPI_UNIQ(CXXFLAGS)
if test "$add" != "" ; then
AC_MSG_WARN([$add has been added to CXXFLAGS])
fi
unset add
fi fi
CXXFLAGS="$CXXFLAGS_orig$add"
OMPI_UNIQ(CXXFLAGS) # Check for special things due to C++ exceptions
if test "$add" != "" ; then ENABLE_CXX_EXCEPTIONS=no
AC_MSG_WARN([$add has been added to CXXFLAGS]) HAVE_CXX_EXCEPTIONS=0
AC_ARG_ENABLE([cxx-exceptions],
[AC_HELP_STRING([--enable-cxx-exceptions],
[enable support for C++ exceptions])],
[ENABLE_CXX_EXCEPTIONS="$enableval"])
AC_MSG_CHECKING([if want C++ exception handling])
AC_MSG_RESULT([$ENABLE_CXX_EXCEPTIONS])
if test "$ENABLE_CXX_EXCEPTIONS" = "yes"; then
# config/cxx_have_exceptions.m4
OMPI_CXX_HAVE_EXCEPTIONS
# config/cxx_find_exception_flags.m4
OMPI_CXX_FIND_EXCEPTION_FLAGS
if test "$OMPI_CXX_EXCEPTIONS" = "1"; then
HAVE_CXX_EXCEPTIONS=1
CFLAGS="$CFLAGS $OMPI_CXX_EXCEPTIONS_CFLAGS"
FFLAGS="$FFLAGS $OMPI_CXX_EXCEPTIONS_FFLAGS"
CXXFLAGS="$CXXFLAGS $OMPI_CXX_EXCEPTIONS_CXXFLAGS"
LDFLAGS="$LDFLAGS $OMPI_CXX_EXCEPTIONS_LDFLAGS"
WRAPPER_EXTRA_CFLAGS="$OMPI_CXX_EXCEPTIONS_CFLAGS ${WRAPPER_EXTRA_CFLAGS}"
WRAPPER_EXTRA_FFLAGS="$OMPI_CXX_EXCEPTIONS_FFLAGS ${WRAPPER_EXTRA_FFLAGS}"
WRAPPER_EXTRA_CXXFLAGS="$OMPI_CXX_EXCEPTIONS_CXXFLAGS ${WRAPPER_EXTRA_CXXFLAGS}"
fi
fi fi
unset add AC_DEFINE_UNQUOTED(OMPI_HAVE_CXX_EXCEPTION_SUPPORT, $HAVE_CXX_EXCEPTIONS,
fi [Whether or not we have compiled with C++ exceptions support])
# Check for special things due to C++ exceptions # Find some more characteristics of the C++ compiler
ENABLE_CXX_EXCEPTIONS=no # config/cxx_find_template_repository.m4
HAVE_CXX_EXCEPTIONS=0 OMPI_CXX_FIND_TEMPLATE_REPOSITORY
AC_ARG_ENABLE(cxx-exceptions, # config/cxx_find_template_parameters.m4
AC_HELP_STRING([--enable-cxx-exceptions], OMPI_CXX_FIND_TEMPLATE_PARAMETERS
[enable support for C++ exceptions]),
[ENABLE_CXX_EXCEPTIONS="$enableval"])
AC_MSG_CHECKING([if want C++ exception handling]) # If we are on HP-UX, ensure that we're using aCC
AC_MSG_RESULT([$ENABLE_CXX_EXCEPTIONS]) case "$host" in
if test "$ENABLE_CXX_EXCEPTIONS" = "yes"; then *hpux*)
# config/cxx_have_exceptions.m4 if test "$BASECXX" = "CC"; then
OMPI_CXX_HAVE_EXCEPTIONS AC_MSG_WARN([*** You will probably have problems compiling the MPI 2])
# config/cxx_find_exception_flags.m4 AC_MSG_WARN([*** C++ bindings with the HP-UX CC compiler. You should])
OMPI_CXX_FIND_EXCEPTION_FLAGS AC_MSG_WARN([*** probably be using the aCC compiler. Re-run configure])
if test "$OMPI_CXX_EXCEPTIONS" = "1"; then AC_MSG_WARN([*** with the environment variable "CXX=aCC".])
HAVE_CXX_EXCEPTIONS=1 fi
CFLAGS="$CFLAGS $OMPI_CXX_EXCEPTIONS_CFLAGS" ;;
FFLAGS="$FFLAGS $OMPI_CXX_EXCEPTIONS_FFLAGS" esac
CXXFLAGS="$CXXFLAGS $OMPI_CXX_EXCEPTIONS_CXXFLAGS"
LDFLAGS="$LDFLAGS $OMPI_CXX_EXCEPTIONS_LDFLAGS"
WRAPPER_EXTRA_CFLAGS="$OMPI_CXX_EXCEPTIONS_CFLAGS ${WRAPPER_EXTRA_CFLAGS}" # Note: gcc-imperonating compilers accept -O3
WRAPPER_EXTRA_FFLAGS="$OMPI_CXX_EXCEPTIONS_FFLAGS ${WRAPPER_EXTRA_FFLAGS}" if test "$GXX" = yes; then
WRAPPER_EXTRA_CXXFLAGS="$OMPI_CXX_EXCEPTIONS_CXXFLAGS ${WRAPPER_EXTRA_CXXFLAGS}" OPTFLAGS="-O3"
else
OPTFLAGS="-O"
fi fi
fi # config/ompi_check_optflags.m4
AC_DEFINE_UNQUOTED(OMPI_HAVE_CXX_EXCEPTION_SUPPORT, $HAVE_CXX_EXCEPTIONS, OMPI_CHECK_OPTFLAGS(["$CXXFLAGS"])
[Whether or not we have compiled with C++ exceptions support]) AC_MSG_CHECKING([for C++ optimization flags])
AC_MSG_RESULT([$co_result])
# Find some more characteristics of the C++ compiler CXXFLAGS="$co_result"
])
# config/cxx_find_template_repository.m4
OMPI_CXX_FIND_TEMPLATE_REPOSITORY
# config/cxx_find_template_parameters.m4 AC_DEFUN([_OMPI_START_SETUP_CXX],[
OMPI_CXX_FIND_TEMPLATE_PARAMETERS ompi_show_subtitle "C++ compiler and preprocessor"
])
# If we are on HP-UX, ensure that we're using aCC
case "$host" in
*hpux*) AC_DEFUN([_OMPI_PROG_CXX],[
if test "$BASECXX" = "CC"; then ompi_cxxflags_save="$CXXFLAGS"
AC_MSG_WARN([*** You will probably have problems compiling the MPI 2]) AC_PROG_CXX
AC_MSG_WARN([*** C++ bindings with the HP-UX CC compiler. You should]) AC_PROG_CXXCPP
AC_MSG_WARN([*** probably be using the aCC compiler. Re-run configure]) BASECXX="`basename $CXX`"
AC_MSG_WARN([*** with the environment variable "CXX=aCC".]) CXXFLAGS="$ompi_cxxflags_save"
fi AC_DEFINE_UNQUOTED(OMPI_CXX, "$CXX", [OMPI underlying C++ compiler])
;; OMPI_CXX_ABSOLUTE="`which $CXX`"
esac AC_SUBST(OMPI_CXX_ABSOLUTE)
# 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
OPTFLAGS="-O3"
else
OPTFLAGS="-O"
fi
# config/ompi_check_optflags.m4
OMPI_CHECK_OPTFLAGS("$CXXFLAGS")
AC_MSG_CHECKING([for C++ optimization flags])
AC_MSG_RESULT([$co_result])
CXXFLAGS="$co_result"
]) ])