annotate src/fftw-3.3.3/m4/acx_mpi.m4 @ 140:59a8758c56b1

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