annotate src/fftw-3.3.5/m4/acx_mpi.m4 @ 84:08ae793730bd

Add null config files
author Chris Cannam
date Mon, 02 Mar 2020 14:03:47 +0000
parents 2cd0e3b3e1fd
children
rev   line source
Chris@42 1 dnl @synopsis ACX_MPI([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
Chris@42 2 dnl @summary figure out how to compile/link code with MPI
Chris@42 3 dnl @category InstalledPackages
Chris@42 4 dnl
Chris@42 5 dnl This macro tries to find out how to compile programs that
Chris@42 6 dnl use MPI (Message Passing Interface), a standard API for
Chris@42 7 dnl parallel process communication (see http://www-unix.mcs.anl.gov/mpi/)
Chris@42 8 dnl
Chris@42 9 dnl On success, it sets the MPICC, MPICXX, or MPIF77 output variable to
Chris@42 10 dnl the name of the MPI compiler, depending upon the current language.
Chris@42 11 dnl (This may just be $CC/$CXX/$F77, but is more often something like
Chris@42 12 dnl mpicc/mpiCC/mpif77.) It also sets MPILIBS to any libraries that are
Chris@42 13 dnl needed for linking MPI (e.g. -lmpi, if a special MPICC/MPICXX/MPIF77
Chris@42 14 dnl was not found).
Chris@42 15 dnl
Chris@42 16 dnl If you want to compile everything with MPI, you should set:
Chris@42 17 dnl
Chris@42 18 dnl CC="$MPICC" #OR# CXX="$MPICXX" #OR# F77="$MPIF77"
Chris@42 19 dnl LIBS="$MPILIBS $LIBS"
Chris@42 20 dnl
Chris@42 21 dnl NOTE: The above assumes that you will use $CC (or whatever)
Chris@42 22 dnl for linking as well as for compiling. (This is the
Chris@42 23 dnl default for automake and most Makefiles.)
Chris@42 24 dnl
Chris@42 25 dnl The user can force a particular library/compiler by setting the
Chris@42 26 dnl MPICC/MPICXX/MPIF77 and/or MPILIBS environment variables.
Chris@42 27 dnl
Chris@42 28 dnl ACTION-IF-FOUND is a list of shell commands to run if an MPI
Chris@42 29 dnl library is found, and ACTION-IF-NOT-FOUND is a list of commands
Chris@42 30 dnl to run it if it is not found. If ACTION-IF-FOUND is not specified,
Chris@42 31 dnl the default action will define HAVE_MPI.
Chris@42 32 dnl
Chris@42 33 dnl @version 2005-09-02
Chris@42 34 dnl @license GPLWithACException
Chris@42 35 dnl @author Steven G. Johnson <stevenj@alum.mit.edu>
Chris@42 36
Chris@42 37 AC_DEFUN([ACX_MPI], [
Chris@42 38 AC_PREREQ(2.50) dnl for AC_LANG_CASE
Chris@42 39
Chris@42 40 AC_LANG_CASE([C], [
Chris@42 41 AC_REQUIRE([AC_PROG_CC])
Chris@42 42 AC_ARG_VAR(MPICC,[MPI C compiler command])
Chris@42 43 AC_CHECK_PROGS(MPICC, mpicc hcc mpcc mpcc_r mpxlc cmpicc, $CC)
Chris@42 44 acx_mpi_save_CC="$CC"
Chris@42 45 CC="$MPICC"
Chris@42 46 AC_SUBST(MPICC)
Chris@42 47 ],
Chris@42 48 [C++], [
Chris@42 49 AC_REQUIRE([AC_PROG_CXX])
Chris@42 50 AC_ARG_VAR(MPICXX,[MPI C++ compiler command])
Chris@42 51 AC_CHECK_PROGS(MPICXX, mpic++ mpiCC mpicxx mpCC hcp mpxlC mpxlC_r cmpic++, $CXX)
Chris@42 52 acx_mpi_save_CXX="$CXX"
Chris@42 53 CXX="$MPICXX"
Chris@42 54 AC_SUBST(MPICXX)
Chris@42 55 ],
Chris@42 56 [Fortran 77], [
Chris@42 57 AC_REQUIRE([AC_PROG_F77])
Chris@42 58 AC_ARG_VAR(MPIF77,[MPI Fortran compiler command])
Chris@42 59 AC_CHECK_PROGS(MPIF77, mpif77 hf77 mpxlf mpf77 mpif90 mpf90 mpxlf90 mpxlf95 mpxlf_r cmpifc cmpif90c, $F77)
Chris@42 60 acx_mpi_save_F77="$F77"
Chris@42 61 F77="$MPIF77"
Chris@42 62 AC_SUBST(MPIF77)
Chris@42 63 ])
Chris@42 64
Chris@42 65 if test x = x"$MPILIBS"; then
Chris@42 66 AC_LANG_CASE([C], [AC_CHECK_FUNC(MPI_Init, [MPILIBS=" "])],
Chris@42 67 [C++], [AC_CHECK_FUNC(MPI_Init, [MPILIBS=" "])],
Chris@42 68 [Fortran 77], [AC_MSG_CHECKING([for MPI_Init])
Chris@42 69 AC_TRY_LINK([],[ call MPI_Init], [MPILIBS=" "
Chris@42 70 AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)])])
Chris@42 71 fi
Chris@42 72 if test x = x"$MPILIBS"; then
Chris@42 73 AC_CHECK_LIB(mpi, MPI_Init, [MPILIBS="-lmpi"])
Chris@42 74 fi
Chris@42 75 if test x = x"$MPILIBS"; then
Chris@42 76 AC_CHECK_LIB(mpich, MPI_Init, [MPILIBS="-lmpich"])
Chris@42 77 fi
Chris@42 78
Chris@42 79 dnl We have to use AC_TRY_COMPILE and not AC_CHECK_HEADER because the
Chris@42 80 dnl latter uses $CPP, not $CC (which may be mpicc).
Chris@42 81 AC_LANG_CASE([C], [if test x != x"$MPILIBS"; then
Chris@42 82 AC_MSG_CHECKING([for mpi.h])
Chris@42 83 AC_TRY_COMPILE([#include <mpi.h>],[],[AC_MSG_RESULT(yes)], [MPILIBS=""
Chris@42 84 AC_MSG_RESULT(no)])
Chris@42 85 fi],
Chris@42 86 [C++], [if test x != x"$MPILIBS"; then
Chris@42 87 AC_MSG_CHECKING([for mpi.h])
Chris@42 88 AC_TRY_COMPILE([#include <mpi.h>],[],[AC_MSG_RESULT(yes)], [MPILIBS=""
Chris@42 89 AC_MSG_RESULT(no)])
Chris@42 90 fi])
Chris@42 91
Chris@42 92 AC_LANG_CASE([C], [CC="$acx_mpi_save_CC"],
Chris@42 93 [C++], [CXX="$acx_mpi_save_CXX"],
Chris@42 94 [Fortran 77], [F77="$acx_mpi_save_F77"])
Chris@42 95
Chris@42 96 AC_SUBST(MPILIBS)
Chris@42 97
Chris@42 98 # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
Chris@42 99 if test x = x"$MPILIBS"; then
Chris@42 100 $2
Chris@42 101 :
Chris@42 102 else
Chris@42 103 ifelse([$1],,[AC_DEFINE(HAVE_MPI,1,[Define if you have the MPI library.])],[$1])
Chris@42 104 :
Chris@42 105 fi
Chris@42 106 ])dnl ACX_MPI