AX_PROG_CC_MPI([MPI-WANTED-TEST[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]])
This macro tries to find out how to compile C programs that use MPI (Message Passing Interface), a standard API for parallel process communication (see http://www-unix.mcs.anl.gov/mpi/). The macro has to be used instead of the standard macro AC_PROG_CC and will replace the standard variable CC with the found compiler.
MPI-WANTED-TEST is used to test whether MPI is actually wanted by the user. If MPI-WANTED_TEST is omitted or if it succeeds, the macro will try to find out how to use MPI, if it fails, the macro will call AC_PROG_CC to find a standard C compiler instead.
When MPI is found, ACTION-IF-FOUND will be executed, if MPI is not found (or MPI-WANTED-TEST fails) ACTION-IF-NOT-FOUND is executed. If ACTION-IF-FOUND is not set, the macro will define HAVE_MPI.
The following example demonstrates usage of the macro:
# If --with-mpi=auto is used, try to find MPI, but use standard C compiler if it is not found. # If --with-mpi=yes is used, try to find MPI and fail if it isn't found. # If --with-mpi=no is used, use a standard C compiler instead. AC_ARG_WITH(mpi, [AS_HELP_STRING([--with-mpi], [compile with MPI (parallelization) support. If none is found, MPI is not used. Default: auto]) ],,[with_mpi=auto]) # AX_PROG_CC_MPI([test x"$with_mpi" != xno],[use_mpi=yes],[ use_mpi=no if test x"$with_mpi" = xyes; then AC_MSG_FAILURE([MPI compiler requested, but couldn't use MPI.]) else AC_MSG_WARN([No MPI compiler found, won't use MPI.]) fi ])
Download the latest version of ax_prog_cc_mpi.m4 or browse the macro’s revision history.
Copyright © 2010,2011 Olaf Lenz firstname.lastname@example.org
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
As a special exception, the respective Autoconf Macro’s copyright owner gives unlimited permission to copy, distribute and modify the configure scripts that are the output of Autoconf when processing the Macro. You need not follow the terms of the GNU General Public License when using or distributing such scripts, even though portions of the text of the Macro appear in them. The GNU General Public License (GPL) does govern all other use of the material that constitutes the Autoconf Macro.
This special exception to the GPL applies to versions of the Autoconf Macro released by the Autoconf Archive. When you make and distribute a modified version of the Autoconf Macro, you may extend this special exception to the GPL to apply to your modified version as well.