* Try to execute a simple application with a compiler (in non-cross-compile
situations) before going on to tests that run executables with the compiler. Print a friendly error message if it fails. Hopefully, this will help people with borked compilers. This commit was SVN r8898.
Этот коммит содержится в:
родитель
84cf4e6112
Коммит
d751d3bacf
@ -55,6 +55,7 @@ m4_include(config/ompi_config_asm.m4)
|
|||||||
|
|
||||||
m4_include(config/ompi_case_sensitive_fs_setup.m4)
|
m4_include(config/ompi_case_sensitive_fs_setup.m4)
|
||||||
m4_include(config/ompi_check_broken_qsort.m4)
|
m4_include(config/ompi_check_broken_qsort.m4)
|
||||||
|
m4_include(config/ompi_check_compiler_works.m4)
|
||||||
m4_include(config/ompi_check_func_lib.m4)
|
m4_include(config/ompi_check_func_lib.m4)
|
||||||
m4_include(config/ompi_check_optflags.m4)
|
m4_include(config/ompi_check_optflags.m4)
|
||||||
m4_include(config/ompi_check_icc.m4)
|
m4_include(config/ompi_check_icc.m4)
|
||||||
|
50
config/ompi_check_compiler_works.m4
Обычный файл
50
config/ompi_check_compiler_works.m4
Обычный файл
@ -0,0 +1,50 @@
|
|||||||
|
dnl -*- shell-script -*-
|
||||||
|
dnl
|
||||||
|
dnl Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
|
||||||
|
dnl University Research and Technology
|
||||||
|
dnl Corporation. All rights reserved.
|
||||||
|
dnl $COPYRIGHT$
|
||||||
|
dnl
|
||||||
|
dnl Additional copyrights may follow
|
||||||
|
dnl
|
||||||
|
dnl $HEADER$
|
||||||
|
dnl
|
||||||
|
|
||||||
|
# OMPI_CHECK_COMPILER_WORKS(language, language_exit,
|
||||||
|
# [action-if-found], [action-if-not-found])
|
||||||
|
# ----------------------------------------------------
|
||||||
|
# Try to compile and run a simple "exit(0)" application in
|
||||||
|
# 'language'. A warning is always printed if the application
|
||||||
|
# fails to run. Action-if-found is evaluated if the application
|
||||||
|
# runs successfully (or compiles if cross-compiling), and
|
||||||
|
# action-if-not-found is evaluated if the application fails to
|
||||||
|
# run.
|
||||||
|
#
|
||||||
|
# language-exit should be how to exit cleanly in 'language'.
|
||||||
|
# You probably want exit(0) for C/C++ and empty for Fortran.
|
||||||
|
AC_DEFUN([OMPI_CHECK_COMPILER_WORKS],
|
||||||
|
[ AS_VAR_PUSHDEF([lang_var], [ompi_cv_$1_works])
|
||||||
|
|
||||||
|
AC_CACHE_CHECK([if $1 compiler works], lang_var,
|
||||||
|
[AC_LANG_PUSH($1)
|
||||||
|
AC_RUN_IFELSE([AC_LANG_PROGRAM([], [$2])],
|
||||||
|
[AS_VAR_SET(lang_var, ["yes"])],
|
||||||
|
[AS_VAR_SET(lang_var, ["no"])],
|
||||||
|
[AS_VAR_SET(lang_var, ["cross compiling"])])
|
||||||
|
AC_LANG_POP($1)])
|
||||||
|
AS_IF([test "AS_VAR_GET(lang_var)" = "no"],
|
||||||
|
[cat <<EOF >&2
|
||||||
|
**********************************************************************
|
||||||
|
* It appears that your $1 compiler is unable to produce working
|
||||||
|
* executables. A simple test application failed to properly
|
||||||
|
* execute. Note that this is likely not a problem with Open MPI,
|
||||||
|
* but a problem with the local compiler installation. More
|
||||||
|
* information (including exactly what command was given to the
|
||||||
|
* compiler and what error resulted when the command was executed) is
|
||||||
|
* available in the config.log file in this directory.
|
||||||
|
**********************************************************************
|
||||||
|
EOF
|
||||||
|
$4], [$3])
|
||||||
|
|
||||||
|
AS_VAR_POPDEF([lang_var])dnl
|
||||||
|
])
|
@ -175,4 +175,10 @@ AC_DEFUN([_OMPI_PROG_CXX],[
|
|||||||
AC_DEFINE_UNQUOTED(OMPI_CXX, "$CXX", [OMPI underlying C++ compiler])
|
AC_DEFINE_UNQUOTED(OMPI_CXX, "$CXX", [OMPI underlying C++ compiler])
|
||||||
OMPI_CXX_ABSOLUTE="`which $CXX`"
|
OMPI_CXX_ABSOLUTE="`which $CXX`"
|
||||||
AC_SUBST(OMPI_CXX_ABSOLUTE)
|
AC_SUBST(OMPI_CXX_ABSOLUTE)
|
||||||
|
|
||||||
|
# make sure the compiler actually works, if not cross-compiling.
|
||||||
|
# Don't just use the AC macro so that we can have a pretty
|
||||||
|
# message.
|
||||||
|
OMPI_CHECK_COMPILER_WORKS([C++], [exit(0)], [],
|
||||||
|
[AC_MSG_ERROR([Could not run a simple C++ program. Aborting.])])
|
||||||
])
|
])
|
||||||
|
@ -69,6 +69,13 @@ else
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# make sure the compiler actually works, if not cross-compiling
|
||||||
|
# Don't just use the AC macro so that we can have a pretty
|
||||||
|
# message.
|
||||||
|
AS_IF([test $OMPI_WANT_F77_BINDINGS -eq 1],
|
||||||
|
[OMPI_CHECK_COMPILER_WORKS([Fortran 77], [], [],
|
||||||
|
[AC_MSG_ERROR([Could not run a simple Fortran 77 program. Aborting.])])])
|
||||||
|
|
||||||
AC_DEFINE_UNQUOTED(OMPI_WANT_F77_BINDINGS, $OMPI_WANT_F77_BINDINGS,
|
AC_DEFINE_UNQUOTED(OMPI_WANT_F77_BINDINGS, $OMPI_WANT_F77_BINDINGS,
|
||||||
[Whether we want the MPI f77 bindings or not])
|
[Whether we want the MPI f77 bindings or not])
|
||||||
AC_DEFINE_UNQUOTED(OMPI_F77, "$OMPI_F77", [OMPI underlying F77 compiler])
|
AC_DEFINE_UNQUOTED(OMPI_F77, "$OMPI_F77", [OMPI underlying F77 compiler])
|
||||||
|
@ -108,6 +108,12 @@ else
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
# make sure the compiler actually works, if not cross-compiling
|
||||||
|
# Don't just use the AC macro so that we can have a pretty
|
||||||
|
# message.
|
||||||
|
AS_IF([test $OMPI_WANT_F90_BINDINGS -eq 1],
|
||||||
|
[OMPI_CHECK_COMPILER_WORKS([Fortran], [], [],
|
||||||
|
[AC_MSG_ERROR([Could not run a simple Fortran program. Aborting.])])])
|
||||||
|
|
||||||
AC_DEFINE_UNQUOTED(OMPI_WANT_F90_BINDINGS, $OMPI_WANT_F90_BINDINGS,
|
AC_DEFINE_UNQUOTED(OMPI_WANT_F90_BINDINGS, $OMPI_WANT_F90_BINDINGS,
|
||||||
[Whether we want the MPI f90 bindings or not])
|
[Whether we want the MPI f90 bindings or not])
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user