From 27b753afc831379d9561feb22128570f74d28fa0 Mon Sep 17 00:00:00 2001 From: bangerth Date: Sat, 5 Nov 2011 20:46:08 +0000 Subject: [PATCH] Use mpic++ or mpicxx before trying mpiCC. git-svn-id: https://svn.dealii.org/trunk@24724 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/configure | 59 ++++++++++++++++++++++++++++++-------- deal.II/configure.in | 23 +++++++-------- deal.II/doc/news/changes.h | 7 +++++ 3 files changed, 65 insertions(+), 24 deletions(-) diff --git a/deal.II/configure b/deal.II/configure index 8594628719..203928a9e0 100755 --- a/deal.II/configure +++ b/deal.II/configure @@ -711,7 +711,6 @@ GXX_VERSION GXX_BRAND ac_ct_CXX CXXFLAGS -CXX OBJEXT EXEEXT ac_ct_CC @@ -719,6 +718,7 @@ CPPFLAGS LDFLAGS CFLAGS CC +CXX target_os target_vendor target_cpu @@ -2592,20 +2592,55 @@ $as_echo_n "checking whether to explicitly use MPI... " >&6; } $as_echo "yes" >&6; } if test "x$CXX" = "x" ; then + for ac_prog in mpic++ mpicxx mpiCC +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CXX="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CXX=$ac_cv_prog_CXX +if test -n "$CXX"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 +$as_echo "$CXX" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CXX" && break +done + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MPI C++ compiler" >&5 $as_echo_n "checking for MPI C++ compiler... " >&6; } - if ((which mpiCC 2>&1) > /dev/null) ; then - CXX=mpiCC ; - { $as_echo "$as_me:${as_lineno-$LINENO}: result: mpiCC" >&5 -$as_echo "mpiCC" >&6; } + if test "x$CXX" = "x" ; then + as_fn_error $? "none found" "$LINENO" 5 else - if ((which mpicxx 2>&1) > /dev/null) ; then - CXX=mpicxx ; - { $as_echo "$as_me:${as_lineno-$LINENO}: result: mpicxx" >&5 -$as_echo "mpicxx" >&6; } - else - as_fn_error $? "no MPI C++ compiler found" "$LINENO" 5 - fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 +$as_echo "$CXX" >&6; } fi fi diff --git a/deal.II/configure.in b/deal.II/configure.in index 2b7bbad176..90dec2dfdb 100644 --- a/deal.II/configure.in +++ b/deal.II/configure.in @@ -85,9 +85,13 @@ AC_MSG_RESULT(---------------- configuring C/C++ compilers ----------------) dnl See if the user has specified --enable-mpi. If so, and if $CXX and $CC have -dnl not been set to a particular value, then override them with 'mpiCC' and -dnl 'mpicc'. The latter should always work, but sometimes the former is -dnl called 'mpicxx' instead :-( +dnl not been set to a particular value, then override them. +dnl +dnl While for the C compiler the issue is simple (it should be 'mpicc', the +dnl issue is not quite as trivial for the C++ compiler: 'mpiCC' should in +dnl principle work, but we've seen systems where that refers to the C +dnl compiler, so try 'mpic++' and 'mpicxx' first as these should really +dnl be unambiguous names although they may not be available on all systems. AC_ARG_ENABLE(mpi, AS_HELP_STRING([--enable-mpi], [Select MPI-enabled compilers and MPI support in deal.II.]), @@ -97,17 +101,12 @@ AC_ARG_ENABLE(mpi, AC_MSG_RESULT(yes) if test "x$CXX" = "x" ; then + AC_CHECK_PROGS(CXX,[mpic++ mpicxx mpiCC]) AC_MSG_CHECKING(for MPI C++ compiler) - if ((which mpiCC 2>&1) > /dev/null) ; then - CXX=mpiCC ; - AC_MSG_RESULT(mpiCC) + if test "x$CXX" = "x" ; then + AC_MSG_ERROR(none found) else - if ((which mpicxx 2>&1) > /dev/null) ; then - CXX=mpicxx ; - AC_MSG_RESULT(mpicxx) - else - AC_MSG_ERROR(no MPI C++ compiler found) - fi + AC_MSG_RESULT([$CXX]) fi fi diff --git a/deal.II/doc/news/changes.h b/deal.II/doc/news/changes.h index 4a9565f70a..57e437c3d1 100644 --- a/deal.II/doc/news/changes.h +++ b/deal.II/doc/news/changes.h @@ -34,6 +34,13 @@ inconvenience this causes.

General

    +
  1. Fixed: On some systems, mpiCC turns out to alias the +C compiler, not the C++ compiler as expected. Consequently, try to use +mpic++ or mpicxx before mpiCC as +these should really be unambiguous. +
    +(Wolfgang Bangerth, 2011/11/05) +
  2. Fixed: Intel's ICC compiler identifies itself as icpc version 12.1.0 (gcc version 4.2.1 compatibility) which we mistook as being GCC version 4.2. This is now fixed. -- 2.39.5