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])