From 9780043456e19727f37ba8f926e0f50f783a3bbf Mon Sep 17 00:00:00 2001 From: Brian Barrett Date: Tue, 5 Nov 2013 22:41:10 +0000 Subject: [PATCH] re-apply r29608 and fix the broken configure test that broke worse with the patch. See ticket #3885, comment 10 for an explination of why calling _STRINGIFY on something that's not a numerical constant is always a bad idea. This commit was SVN r29613. The following SVN revision numbers were found above: r29608 --> open-mpi/ompi@b71bd51cddcfb9758c6ffdec92ba1f28b0bcf92a --- config/opal_check_compiler_version.m4 | 34 ++++++++++++++++++++++++++- ompi/include/mpi_portable_platform.h | 10 ++++---- 2 files changed, 38 insertions(+), 6 deletions(-) diff --git a/config/opal_check_compiler_version.m4 b/config/opal_check_compiler_version.m4 index cb2f699662..846d1a1d73 100644 --- a/config/opal_check_compiler_version.m4 +++ b/config/opal_check_compiler_version.m4 @@ -21,7 +21,7 @@ AC_DEFUN([OPAL_CHECK_COMPILER_VERSION_ID], OPAL_CHECK_COMPILER(FAMILYID) OPAL_CHECK_COMPILER_STRINGIFY(FAMILYNAME) OPAL_CHECK_COMPILER(VERSION) - OPAL_CHECK_COMPILER_STRINGIFY(VERSION_STR) + OPAL_CHECK_COMPILER_STRING(VERSION_STR) ])dnl @@ -57,6 +57,38 @@ int main (int argc, char * argv[]) [The compiler $lower which OMPI was built with]) ])dnl +AC_DEFUN([OPAL_CHECK_COMPILER_STRING], [ + lower=m4_tolower($1) + AC_CACHE_CHECK([for compiler $lower], opal_cv_compiler_[$1], + [ + CPPFLAGS_orig=$CPPFLAGS + CPPFLAGS="-I${top_ompi_srcdir}/ompi/include $CPPFLAGS" + AC_TRY_RUN([ +#include +#include +#include "mpi_portable_platform.h" + +int main (int argc, char * argv[]) +{ + FILE * f; + f=fopen("conftestval", "w"); + if (!f) exit(1); + fprintf (f, "%s", PLATFORM_COMPILER_$1); + return 0; +} + ], [ + eval opal_cv_compiler_$1=`cat conftestval`; + ], [ + eval opal_cv_compiler_$1=UNKNOWN + ], [ + eval opal_cv_compiler_$1=UNKNOWN + ]) + CPPFLAGS=$CPPFLAGS_orig + ]) + AC_DEFINE_UNQUOTED([OPAL_BUILD_PLATFORM_COMPILER_$1], $opal_cv_compiler_[$1], + [The compiler $lower which OMPI was built with]) +])dnl + AC_DEFUN([OPAL_CHECK_COMPILER_STRINGIFY], [ lower=m4_tolower($1) diff --git a/ompi/include/mpi_portable_platform.h b/ompi/include/mpi_portable_platform.h index dce562bcbf..30d70805a2 100644 --- a/ompi/include/mpi_portable_platform.h +++ b/ompi/include/mpi_portable_platform.h @@ -98,7 +98,7 @@ # define PLATFORM_COMPILER_VERSION \ PLATFORM_COMPILER_VERSION_INT(__INTEL_COMPILER/10, __INTEL_COMPILER/100, _PLATFORM_INTEL_COMPILER_BUILD_DATE) # define PLATFORM_COMPILER_VERSION_STR \ - _STRINGIFY(__INTEL_COMPILER)"."_STRINGIFY(_PLATFORM_INTEL_COMPILER_BUILD_DATE) + _STRINGIFY(__INTEL_COMPILER) "." _STRINGIFY(_PLATFORM_INTEL_COMPILER_BUILD_DATE) #elif defined(__PATHSCALE__) # define PLATFORM_COMPILER_PATHSCALE 1 @@ -131,7 +131,7 @@ # define PLATFORM_COMPILER_VERSION \ PLATFORM_COMPILER_VERSION_INT(__PGIC__,__PGIC_MINOR__,__PGIC_PATCHLEVEL__) # define PLATFORM_COMPILER_VERSION_STR \ - _STRINGIFY(__PGIC__)"."_STRINGIFY(__PGIC_MINOR__)"-"_STRINGIFY(__PGIC_PATCHLEVEL__) + _STRINGIFY(__PGIC__) "." _STRINGIFY(__PGIC_MINOR__) "-" _STRINGIFY(__PGIC_PATCHLEVEL__) # else /* PGI before 6.1-4 lacks any version ID preprocessor macros - so use this filthy hack */ /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX @@ -370,13 +370,13 @@ /* gather any advertised GNU version number info, even for non-gcc compilers */ # if defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__) # define __PLATFORM_COMPILER_GNU_VERSION_STR \ - _STRINGIFY(__GNUC__)"."_STRINGIFY(__GNUC_MINOR__)"."_STRINGIFY(__GNUC_PATCHLEVEL__) + _STRINGIFY(__GNUC__) "." _STRINGIFY(__GNUC_MINOR__) "." _STRINGIFY(__GNUC_PATCHLEVEL__) # elif defined(__GNUC_MINOR__) # define __PLATFORM_COMPILER_GNU_VERSION_STR \ - _STRINGIFY(__GNUC__)"."_STRINGIFY(__GNUC_MINOR__)".?" + _STRINGIFY(__GNUC__) "." _STRINGIFY(__GNUC_MINOR__) ".?" # else # define __PLATFORM_COMPILER_GNU_VERSION_STR \ - _STRINGIFY(__GNUC__)".?.?" + _STRINGIFY(__GNUC__) ".?.?" # endif #elif defined(PLATFORM_COMPILER_UNKNOWN) /* unknown compiler */ # define PLATFORM_COMPILER_FAMILYNAME UNKNOWN