From 1b8d0cf146d7dab4e2f7db56160f27d62fedc0e4 Mon Sep 17 00:00:00 2001 From: Rainer Keller Date: Thu, 4 Jun 2009 13:00:16 +0000 Subject: [PATCH] - AC_TRY_RUN does not work in case of cross-compilation environments. Tests based on preprocessor CPP output, won't help either, as they don't spit out nice computed numerical values, but rather the #define itselve. This commit was SVN r21364. --- config/opal_check_compiler_version.m4 | 44 ++++++++++++++++----------- 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/config/opal_check_compiler_version.m4 b/config/opal_check_compiler_version.m4 index f914af53c9..a31dec8078 100644 --- a/config/opal_check_compiler_version.m4 +++ b/config/opal_check_compiler_version.m4 @@ -29,9 +29,10 @@ AC_DEFUN([OPAL_CHECK_COMPILER], [ 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([ + if test "$cross_compiling" != "yes" ; then + CPPFLAGS_orig=$CPPFLAGS + CPPFLAGS="-I${top_ompi_srcdir}/ompi/include $CPPFLAGS" + AC_TRY_RUN([ #include #include #include "mpi_portable_platform.h.in" /* Yes, it is supposed to be a .in-file */ @@ -44,12 +45,15 @@ int main (int argc, char * argv[]) fprintf (f, "%d", PLATFORM_COMPILER_$1); return 0; } - ], [ - eval opal_cv_compiler_$1=`cat conftestval`; - ], [ - eval opal_cv_compiler_$1=0 - ]) - CPPFLAGS=$CPPFLAGS_orig + ], [ + eval opal_cv_compiler_$1=`cat conftestval`; + ], [ + eval opal_cv_compiler_$1=0 + ]) + CPPFLAGS=$CPPFLAGS_orig + else + opal_cv_compiler_$1=0 + fi ]) AC_DEFINE_UNQUOTED([OPAL_BUILD_PLATFORM_COMPILER_$1], $opal_cv_compiler_[$1], [The compiler $lower which OMPI was built with]) @@ -60,9 +64,10 @@ AC_DEFUN([OPAL_CHECK_COMPILER_STRINGIFY], [ 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([ + if test "$cross_compiling" != "yes" ; then + CPPFLAGS_orig=$CPPFLAGS + CPPFLAGS="-I${top_ompi_srcdir}/ompi/include $CPPFLAGS" + AC_TRY_RUN([ #include #include #include "mpi_portable_platform.h.in" /* Yes, it is supposed to be a .in-file */ @@ -75,12 +80,15 @@ int main (int argc, char * argv[]) fprintf (f, "%s", _STRINGIFY(PLATFORM_COMPILER_$1)); return 0; } - ], [ - eval opal_cv_compiler_$1=`cat conftestval`; - ], [ - eval opal_cv_compiler_$1=UNKNOWN - ]) - CPPFLAGS=$CPPFLAGS_orig + ], [ + eval opal_cv_compiler_$1=`cat conftestval`; + ], [ + eval opal_cv_compiler_$1=UNKNOWN + ]) + CPPFLAGS=$CPPFLAGS_orig + else + opal_cv_compiler_$1=UNKNOWN + fi ]) AC_DEFINE_UNQUOTED([OPAL_BUILD_PLATFORM_COMPILER_$1], $opal_cv_compiler_[$1], [The compiler $lower which OMPI was built with])