aclocal_mpi.m4

来自「MPICH是MPI的重要研究,提供了一系列的接口函数,为并行计算的实现提供了编程」· M4 代码 · 共 271 行

M4
271
字号
dnldnl/*D dnl PAC_LIB_MPI - Check for MPI librarydnldnl Synopsis:dnl PAC_LIB_MPI([action if found],[action if not found])dnldnl Output Effect:dnldnl Notes:dnl Currently, only checks for lib mpi and mpi.h.  Later, we will adddnl MPI_Pcontrol prototype (const int or not?).  dnldnl If PAC_ARG_MPICH_BUILDING is included, this will work correctly dnl when MPICH is being built.dnldnl Prerequisites:dnl autoconf version 2.13 (for AC_SEARCH_LIBS)dnlD*/dnl Other tests to add:dnl Version of MPIdnl MPI-2 I/O?dnl MPI-2 Spawn?dnl MPI-2 RMA?dnl PAC_LIB_MPI([found text],[not found text])AC_DEFUN(PAC_LIB_MPI,[AC_PREREQ(2.13)if test "X$pac_lib_mpi_is_building" != "Xyes" ; then  # Use CC if TESTCC is defined  if test "X$pac_save_level" != "X" ; then     pac_save_TESTCC="${TESTCC}"     pac_save_TESTCPP="${TESTCPP}"     CC="$pac_save_CC"     if test "X$pac_save_CPP" != "X" ; then         CPP="$pac_save_CPP"     fi  fi  # Look for MPILIB first if it is defined  AC_SEARCH_LIBS(MPI_Init,$MPILIB mpi mpich)  if test "$ac_cv_search_MPI_Init" = "no" ; then    ifelse($2,,    AC_MSG_ERROR([Could not find MPI library]),[$2])  fi  AC_CHECK_HEADER(mpi.h,pac_have_mpi_h="yes",pac_have_mpi_h="no")  if test $pac_have_mpi_h = "no" ; then    ifelse($2,,    AC_MSG_ERROR([Could not find mpi.h include file]),[$2])  fi  if test "X$pac_save_level" != "X" ; then     CC="$pac_save_TESTCC"     CPP="$pac_save_TESTCPP"  fifiifelse($1,,,[$1])])dnldnldnl/*Ddnl PAC_ARG_MPICH_BUILDING - Add configure command-line argument to indicateddnl that MPICH is being builtdnldnl Output Effect:dnl Adds the command-line switch '--with-mpichbuilding' that may be used todnl indicate that MPICH is building.  This allows a configure to work-arounddnl the fact that during a build of MPICH, certain commands, particularly thednl compilation commands such as 'mpicc', are not yet functional.  Thednl variable 'pac_lib_mpi_is_building' is set to 'yes' if in an MPICH build,dnl 'no' otherwise.dnldnl See Also:dnl PAC_LIB_MPIdnlD*/AC_DEFUN(PAC_ARG_MPICH_BUILDING,[AC_ARG_WITH(mpichbuilding,[--with-mpichbuilding - Assume that MPICH is being built],pac_lib_mpi_is_building=$withval,pac_lib_mpi_is_building="no")])dnldnldnl This should also set MPIRUN.dnldnl/*Ddnl PAC_ARG_MPI_TYPES - Add command-line switches for different MPI dnl environmentsdnldnl Synopsis:dnl PAC_ARG_MPI_TYPES([default])dnldnl Output Effects:dnl Adds the following command line options to configurednl+ \-\-with\-mpich[=path] - MPICH.  'path' is the location of MPICH commandsdnl. \-\-with\-ibmmpi - IBM MPIdnl. \-\-with\-lammpi[=path] - LAM/MPIdnl- \-\-with\-sgimpi - SGI MPIdnl If no type is selected, and a default ("mpich", "ibmmpi", or "sgimpi")dnl is given, that type is used as if '--with-<default>' was given.dnldnl Sets 'CC', 'F77', 'TESTCC', 'TESTF77', and 'MPILIBNAME'.  Does `not`dnl perform an AC_SUBST for these values.dnl Also sets 'MPIBOOT' and 'MPIUNBOOT'.  These are used to specify dnl programs that may need to be run before and after running MPI programs.dnl For example, 'MPIBOOT' may start demons necessary to run MPI programs anddnl 'MPIUNBOOT' will stop those demons.dnldnl See also:dnl PAC_LANG_PUSH_COMPILERS, PAC_LIB_MPIdnlD*/AC_DEFUN(PAC_ARG_MPI_TYPES,[AC_PROVIDE([AC_PROG_CC])AC_SUBST(CC)AC_SUBST(CXX)AC_SUBST(F77)AC_SUBST(F90)AC_ARG_WITH(mpich,[--with-mpich=path  - Assume that we are building with MPICH],ac_mpi_type=mpich)AC_ARG_WITH(lammpi,[--with-lammpi=path  - Assume that we are building with LAM/MPI],ac_mpi_type=lammpi)AC_ARG_WITH(ibmmpi,[--with-ibmmpi    - Use the IBM SP implementation of MPI],ac_mpi_type=ibmmpi)AC_ARG_WITH(sgimpi,[--with-sgimpi    - Use the SGI implementation of MPI],ac_mpi_type=sgimpi)if test "X$ac_mpi_type" = "X" ; then    if test "X$1" != "X" ; then        ac_mpi_type=$1    else        ac_mpi_type=unknown    fifiif test "$ac_mpi_type" = "unknown" -a "$pac_lib_mpi_is_building" = "yes" ; then    ac_mpi_type="mpich"ficase $ac_mpi_type in	mpich)        dnl         dnl This isn't correct.  It should try to get the underlying compiler        dnl from the mpicc and mpif77 scripts or mpireconfig        if test "X$pac_lib_mpi_is_building" != "Xyes" ; then            save_PATH="$PATH"            if test "$with_mpich" != "yes" -a "$with_mpich" != "no" ; then 		# Look for commands; if not found, try adding bin to the		# path		if test ! -x $with_mpich/mpicc -a -x $with_mpich/bin/mpicc ; then			with_mpich="$with_mpich/bin"		fi                PATH=$with_mpich:${PATH}            fi            AC_PATH_PROG(MPICC,mpicc)            TESTCC=${CC-cc}            CC="$MPICC"            AC_PATH_PROG(MPIF77,mpif77)            TESTF77=${F77-f77}            F77="$MPIF77"            AC_PATH_PROG(MPIF90,mpif90)            TESTF90=${F90-f90}            F90="$MPIF90"            AC_PATH_PROG(MPICXX,mpiCC)            TESTCXX=${CXX-CC}            CXX="$MPICXX"	    # We may want to restrict this to the path containing mpirun	    AC_PATH_PROG(MPIRUN,mpirun)	    AC_PATH_PROG(MPIBOOT,mpichboot)	    AC_PATH_PROG(MPIUNBOOT,mpichstop)	    PATH="$save_PATH"  	    MPILIBNAME="mpich"        else 	    # All of the above should have been passed in the environment!	    :        fi	;;	lammpi)	dnl        dnl This isn't correct.  It should try to get the underlying compiler        dnl from the mpicc and mpif77 scripts or mpireconfig        save_PATH="$PATH"        if test "$with_mpich" != "yes" -a "$with_mpich" != "no" ; then 	    # Look for commands; if not found, try adding bin to the path		if test ! -x $with_lammpi/mpicc -a -x $with_lammpi/bin/mpicc ; then			with_lammpi="$with_lammpi/bin"		fi                PATH=$with_lammpi:${PATH}        fi        AC_PATH_PROG(MPICC,mpicc)        TESTCC=${CC-cc}        CC="$MPICC"        AC_PATH_PROG(MPIF77,mpif77)        TESTF77=${F77-f77}        F77="$MPIF77"        AC_PATH_PROG(MPIF90,mpif90)        TESTF90=${F90-f90}        F90="$MPIF90"        AC_PATH_PROG(MPICXX,mpiCC)        TESTCXX=${CXX-CC}        CXX="$MPICXX"	PATH="$save_PATH"  	MPILIBNAME="lammpi"	MPIBOOT="lamboot"	MPIUNBOOT="wipe"	MPIRUN="mpirun"	;;	ibmmpi)	TESTCC=${CC-xlC}; TESTF77=${F77-xlf}; CC=mpcc; F77=mpxlf	# There is no mpxlf90, but the options langlvl and free can	# select the F90 version of xlf	TESTF90=${F90-xlf90}; F90="mpxlf -qlanglvl=90ext -qfree=f90"	MPILIBNAME=""	;;	sgimpi)	TESTCC=${CC:=cc}; TESTF77=${F77:=f77}; 	TESTCXX=${CXX:=CC}; TESTF90=${F90:=f90}	AC_CHECK_LIB(mpi,MPI_Init)	if test "$ac_cv_lib_mpi_MPI_Init" = "yes" ; then	    MPILIBNAME="mpi"	fi		MPIRUN=mpirun	MPIBOOT=""	MPIUNBOOT=""	;;	*)	# Find the compilers	PAC_PROG_CC	AC_PROG_F77	AC_PROG_CXX	PAC_PROG_F90	# Set defaults for the TEST versions if not already set	if test -z "$TESTCC" ; then 	    TESTCC=${CC:=cc}        fi	if test -z "$TESTF77" ; then   	    TESTF77=${F77:=f77}        fi	if test -z "$TESTCXX" ; then	    TESTCXX=${CXX:=CC}        fi	if test -z "$TESTF90" ; then       	    TESTF90=${F90:=f90}	fi	;;esac])dnldnl/*Ddnl PAC_MPI_F2C - Determine if MPI has the MPI-2 functions MPI_xxx_f2c anddnl   MPI_xxx_c2fdnldnl Output Effect:dnl Define 'HAVE_MPI_F2C' if the routines are found.dnldnl Notes:dnl Looks only for 'MPI_Request_c2f'.dnlD*/AC_DEFUN(PAC_MPI_F2C,[AC_CACHE_CHECK([for MPI F2C and C2F routines],pac_cv_mpi_f2c,[AC_TRY_LINK([#include "mpi.h"],[MPI_Request request;MPI_Fint a;a = MPI_Request_c2f(request);],pac_cv_mpi_f2c="yes",pac_cv_mpi_f2c="no")])if test "$pac_cv_mpi_f2c" = "yes" ; then     AC_DEFINE(HAVE_MPI_F2C) fi])

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?