Blame confdb/aclocal_mpi.m4

Packit Service c5cf8c
dnl
Packit Service c5cf8c
dnl/*D 
Packit Service c5cf8c
dnl PAC_LIB_MPI - Check for MPI library
Packit Service c5cf8c
dnl
Packit Service c5cf8c
dnl Synopsis:
Packit Service c5cf8c
dnl PAC_LIB_MPI([action if found],[action if not found])
Packit Service c5cf8c
dnl
Packit Service c5cf8c
dnl Output Effect:
Packit Service c5cf8c
dnl
Packit Service c5cf8c
dnl Notes:
Packit Service c5cf8c
dnl Currently, only checks for lib mpi and mpi.h.  Later, we will add
Packit Service c5cf8c
dnl MPI_Pcontrol prototype (const int or not?).  
Packit Service c5cf8c
dnl
Packit Service c5cf8c
dnl Prerequisites:
Packit Service c5cf8c
dnl autoconf version 2.13 (for AC_SEARCH_LIBS)
Packit Service c5cf8c
dnl D*/
Packit Service c5cf8c
dnl Other tests to add:
Packit Service c5cf8c
dnl Version of MPI
Packit Service c5cf8c
dnl MPI-2 I/O?
Packit Service c5cf8c
dnl MPI-2 Spawn?
Packit Service c5cf8c
dnl MPI-2 RMA?
Packit Service c5cf8c
dnl PAC_LIB_MPI([found text],[not found text])
Packit Service c5cf8c
AC_DEFUN([PAC_LIB_MPI],[
Packit Service c5cf8c
dnl Set the prereq to 2.50 to avoid having 
Packit Service c5cf8c
AC_PREREQ(2.50)
Packit Service c5cf8c
if test "X$pac_lib_mpi_is_building" != "Xyes" ; then
Packit Service c5cf8c
  # Use CC if TESTCC is defined
Packit Service c5cf8c
  if test "X$pac_save_level" != "X" ; then
Packit Service c5cf8c
     pac_save_TESTCC="${TESTCC}"
Packit Service c5cf8c
     pac_save_TESTCPP="${TESTCPP}"
Packit Service c5cf8c
     CC="$pac_save_CC"
Packit Service c5cf8c
     if test "X$pac_save_CPP" != "X" ; then
Packit Service c5cf8c
         CPP="$pac_save_CPP"
Packit Service c5cf8c
     fi
Packit Service c5cf8c
  fi
Packit Service c5cf8c
  # Look for MPILIB first if it is defined
Packit Service c5cf8c
  AC_SEARCH_LIBS(MPI_Init,$MPILIB mpi mpich)
Packit Service c5cf8c
  if test "$ac_cv_search_MPI_Init" = "no" ; then
Packit Service c5cf8c
    ifelse($2,,
Packit Service c5cf8c
    AC_MSG_ERROR([Could not find MPI library]),[$2])
Packit Service c5cf8c
  fi
Packit Service c5cf8c
  AC_CHECK_HEADER(mpi.h,pac_have_mpi_h="yes",pac_have_mpi_h="no")
Packit Service c5cf8c
  if test $pac_have_mpi_h = "no" ; then
Packit Service c5cf8c
    ifelse($2,,
Packit Service c5cf8c
    AC_MSG_ERROR([Could not find mpi.h include file]),[$2])
Packit Service c5cf8c
  fi
Packit Service c5cf8c
  if test "X$pac_save_level" != "X" ; then
Packit Service c5cf8c
     CC="$pac_save_TESTCC"
Packit Service c5cf8c
     CPP="$pac_save_TESTCPP"
Packit Service c5cf8c
  fi
Packit Service c5cf8c
fi
Packit Service c5cf8c
ifelse($1,,,[$1])
Packit Service c5cf8c
])
Packit Service c5cf8c
Packit Service c5cf8c
dnl This should also set MPIRUN.
Packit Service c5cf8c
dnl
Packit Service c5cf8c
dnl/*D
Packit Service c5cf8c
dnl PAC_ARG_MPI_TYPES - Add command-line switches for different MPI 
Packit Service c5cf8c
dnl environments
Packit Service c5cf8c
dnl
Packit Service c5cf8c
dnl Synopsis:
Packit Service c5cf8c
dnl PAC_ARG_MPI_TYPES([default])
Packit Service c5cf8c
dnl
Packit Service c5cf8c
dnl Output Effects:
Packit Service c5cf8c
dnl Adds the following command line options to configure
Packit Service c5cf8c
dnl+ \-\-with\-mpich[=path] - MPICH.  'path' is the location of MPICH commands
Packit Service c5cf8c
dnl. \-\-with\-ibmmpi - IBM MPI
Packit Service c5cf8c
dnl. \-\-with\-lammpi[=path] - LAM/MPI
Packit Service c5cf8c
dnl. \-\-with\-mpichnt - MPICH NT
Packit Service c5cf8c
dnl- \-\-with\-sgimpi - SGI MPI
Packit Service c5cf8c
dnl If no type is selected, and a default ("mpich", "ibmmpi", or "sgimpi")
Packit Service c5cf8c
dnl is given, that type is used as if '--with-<default>' was given.
Packit Service c5cf8c
dnl
Packit Service c5cf8c
dnl Sets 'CC', 'F77', 'TESTCC', 'TESTF77', and 'MPILIBNAME'.  Does `not`
Packit Service c5cf8c
dnl perform an AC_SUBST for these values.
Packit Service c5cf8c
dnl Also sets 'MPIBOOT' and 'MPIUNBOOT'.  These are used to specify 
Packit Service c5cf8c
dnl programs that may need to be run before and after running MPI programs.
Packit Service c5cf8c
dnl For example, 'MPIBOOT' may start demons necessary to run MPI programs and
Packit Service c5cf8c
dnl 'MPIUNBOOT' will stop those demons.
Packit Service c5cf8c
dnl 
Packit Service c5cf8c
dnl The two forms of the compilers are to allow for tests of the compiler
Packit Service c5cf8c
dnl when the MPI version of the compiler creates executables that cannot
Packit Service c5cf8c
dnl be run on the local system (for example, the IBM SP, where executables
Packit Service c5cf8c
dnl created with mpcc will not run locally, but executables created
Packit Service c5cf8c
dnl with xlc may be used to discover properties of the compiler, such as
Packit Service c5cf8c
dnl the size of data types).
Packit Service c5cf8c
dnl
Packit Service c5cf8c
dnl Historical note:
Packit Service c5cf8c
dnl Some common autoconf tests, such as AC_CHECK_SIZEOF, used to require
Packit Service c5cf8c
dnl running a program.  But some MPI compilers (often really compilation 
Packit Service c5cf8c
dnl scripts) produced programs that could only be run with special commands,
Packit Service c5cf8c
dnl such as a batch submission system.  To allow these test programs to be
Packit Service c5cf8c
dnl run, a separate set of compiler variables, TESTCC, TESTF77, etc., 
Packit Service c5cf8c
dnl were defined.  However, in later versions of autoconf, it both became
Packit Service c5cf8c
dnl unnecessary to run programs for tests such as AC_CHECK_SIZEOF and 
Packit Service c5cf8c
dnl it became necessary to define CC etc. before invoking AC_PROG_CC (and
Packit Service c5cf8c
dnl the othe language compilers), because those commands now do much, much
Packit Service c5cf8c
dnl more than just determining the compiler.
Packit Service c5cf8c
dnl
Packit Service c5cf8c
dnl To address the change, we still define the TESTCC etc. compilers where
Packit Service c5cf8c
dnl possible to allow the use of AC_TRY_RUN when required, but we define
Packit Service c5cf8c
dnl the CC etc variables and do not define ac_cv_prog_CC etc., as these 
Packit Service c5cf8c
dnl cause autoconf to skip all of the other initialization code that 
Packit Service c5cf8c
dnl AC_PROG_CC etc. runs.  Note also that this command must occur before 
Packit Service c5cf8c
dnl AC_PROG_CC (or anything that might cause AC_PROG_CC to be invoked).
Packit Service c5cf8c
dnl
Packit Service c5cf8c
dnl See also:
Packit Service c5cf8c
dnl PAC_LANG_PUSH_COMPILERS, PAC_LIB_MPI
Packit Service c5cf8c
dnl D*/
Packit Service c5cf8c
AC_DEFUN([PAC_ARG_MPI_TYPES],[
Packit Service c5cf8c
# known types
Packit Service c5cf8c
PAC_ARG_MPI_KNOWN_TYPES
Packit Service c5cf8c
# find compilers
Packit Service c5cf8c
PAC_MPI_FIND_COMPILER_SCRIPTS
Packit Service c5cf8c
PAC_MPI_FIND_COMPILERS
Packit Service c5cf8c
# check for MPI library
Packit Service c5cf8c
PAC_MPI_CHECK_MPI_LIB
Packit Service c5cf8c
])
Packit Service c5cf8c
dnl
Packit Service c5cf8c
dnl To keep autoconf from prematurely invoking the compiler check scripts,
Packit Service c5cf8c
dnl we need a command that first sets the compilers and a separate one
Packit Service c5cf8c
dnl that makes any necessary checks for libraries
Packit Service c5cf8c
dnl
Packit Service c5cf8c
AC_DEFUN([PAC_ARG_MPI_KNOWN_TYPES],[
Packit Service c5cf8c
AC_ARG_WITH(mpich,
Packit Service c5cf8c
[--with-mpich=path  - Assume that we are building with MPICH],
Packit Service c5cf8c
ac_mpi_type=mpich)
Packit Service c5cf8c
# Allow MPICH as well as MPICH
Packit Service c5cf8c
AC_ARG_WITH(mpich,
Packit Service c5cf8c
[--with-mpich=path  - Assume that we are building with MPICH],
Packit Service c5cf8c
ac_mpi_type=mpich)
Packit Service c5cf8c
AC_ARG_WITH(lammpi,
Packit Service c5cf8c
[--with-lammpi=path  - Assume that we are building with LAM/MPI],
Packit Service c5cf8c
ac_mpi_type=lammpi)
Packit Service c5cf8c
AC_ARG_WITH(ibmmpi,
Packit Service c5cf8c
[--with-ibmmpi    - Use the IBM SP implementation of MPI],
Packit Service c5cf8c
ac_mpi_type=ibmmpi)
Packit Service c5cf8c
AC_ARG_WITH(sgimpi,
Packit Service c5cf8c
[--with-sgimpi    - Use the SGI implementation of MPI],
Packit Service c5cf8c
ac_mpi_type=sgimpi)
Packit Service c5cf8c
AC_ARG_WITH(mpichnt,
Packit Service c5cf8c
[--with-mpichnt - Use MPICH for Windows NT ],
Packit Service c5cf8c
ac_mpi_type=mpichnt)
Packit Service c5cf8c
AC_ARG_WITH(mpi,
Packit Service c5cf8c
[--with-mpi=path    - Use an MPI implementation with compile scripts mpicc
Packit Service c5cf8c
                     and mpif77 in path/bin],ac_mpi_type=generic)
Packit Service c5cf8c
Packit Service c5cf8c
if test "X$ac_mpi_type" = "X" ; then
Packit Service c5cf8c
    if test "X$1" != "X" ; then
Packit Service c5cf8c
        ac_mpi_type=$1
Packit Service c5cf8c
    else
Packit Service c5cf8c
        ac_mpi_type=unknown
Packit Service c5cf8c
    fi
Packit Service c5cf8c
fi
Packit Service c5cf8c
if test "$ac_mpi_type" = "unknown" -a "$pac_lib_mpi_is_building" = "yes" ; then
Packit Service c5cf8c
    ac_mpi_type="mpich"
Packit Service c5cf8c
fi
Packit Service c5cf8c
])
Packit Service c5cf8c
dnl
Packit Service c5cf8c
dnl Because autoconf insists on moving code to the beginning of
Packit Service c5cf8c
dnl certain definitions, it is *not possible* to define a single command
Packit Service c5cf8c
dnl that selects compilation scripts and also check for other options.
Packit Service c5cf8c
dnl Thus, this needs to be divided into 
Packit Service c5cf8c
dnl   MPI_FIND_COMPILER_SCRIPTS
Packit Service c5cf8c
dnl which can fail (i.e., not find a script), and
Packit Service c5cf8c
dnl   MPI_FIND_COMPILERS
Packit Service c5cf8c
dnl which runs the various PROC_xx for the compilers.
Packit Service c5cf8c
dnl WARNING: this function ignores --program-suffix and --program-prefix.
Packit Service c5cf8c
dnl However, this function is not currently used at all.
Packit Service c5cf8c
AC_DEFUN([PAC_MPI_FIND_COMPILER_SCRIPTS],[
Packit Service c5cf8c
# Set defaults
Packit Service c5cf8c
MPIRUN_NP="-np "
Packit Service c5cf8c
MPIEXEC_N="-n "
Packit Service c5cf8c
AC_SUBST(MPIRUN_NP)
Packit Service c5cf8c
AC_SUBST(MPIEXEC_N)
Packit Service c5cf8c
dnl
Packit Service c5cf8c
AC_ARG_VAR([MPIEXEC],[Name and path of mpiexec program])
Packit Service c5cf8c
AC_ARG_VAR([MPIRUN],[Name and path of mpirun program])
Packit Service c5cf8c
AC_ARG_VAR([MPIBOOT],[Name and path of program to run before mpirun])
Packit Service c5cf8c
AC_ARG_VAR([MPIUNBOOT],[Name and path of program to run after all mpirun])
Packit Service c5cf8c
AC_ARG_VAR([MPICC],[Name and absolute path of program used to compile MPI programs in C])
Packit Service c5cf8c
AC_ARG_VAR([MPIF77],[Name and absolute path of program used to compile MPI programs in F77])
Packit Service c5cf8c
AC_ARG_VAR([MPICXX],[Name and absolute path of program used to compile MPI programs in C++])
Packit Service c5cf8c
AC_ARG_VAR([MPIF90],[Name and absolute path of program used to compile MPI programs in F90])
Packit Service c5cf8c
#
Packit Service c5cf8c
# Check for things that will cause trouble.  For example, 
Packit Service c5cf8c
# if MPICC is defined but does not contain a / or \, then PATH_PROG will
Packit Service c5cf8c
# ignore the value
Packit Service c5cf8c
if test -n "$MPICC" ; then
Packit Service c5cf8c
   case $MPICC in
Packit Service c5cf8c
changequote(<<,>>)
Packit Service c5cf8c
    [\\/]* | ?:[\\/]*)
Packit Service c5cf8c
changequote([,])
Packit Service c5cf8c
    # Ok, PATH_PROG will figure it out
Packit Service c5cf8c
    ;;  
Packit Service c5cf8c
  *)
Packit Service c5cf8c
    AC_MSG_ERROR([MPICC must be set to an absolute path if it is set])
Packit Service c5cf8c
  esac
Packit Service c5cf8c
fi
Packit Service c5cf8c
if test -n "$MPICXX" ; then
Packit Service c5cf8c
   case $MPICXX in
Packit Service c5cf8c
changequote(<<,>>)
Packit Service c5cf8c
    [\\/]* | ?:[\\/]*)
Packit Service c5cf8c
changequote([,])
Packit Service c5cf8c
    # Ok, PATH_PROG will figure it out
Packit Service c5cf8c
    ;;  
Packit Service c5cf8c
  *)
Packit Service c5cf8c
    AC_MSG_ERROR([MPICXX must be set to an absolute path if it is set])
Packit Service c5cf8c
  esac
Packit Service c5cf8c
fi
Packit Service c5cf8c
if test -n "$MPIF77" ; then
Packit Service c5cf8c
   case $MPIF77 in
Packit Service c5cf8c
changequote(<<,>>)
Packit Service c5cf8c
    [\\/]* | ?:[\\/]*)
Packit Service c5cf8c
changequote([,])
Packit Service c5cf8c
    # Ok, PATH_PROG will figure it out
Packit Service c5cf8c
    ;;  
Packit Service c5cf8c
  *)
Packit Service c5cf8c
    AC_MSG_ERROR([MPIF77 must be set to an absolute path if it is set])
Packit Service c5cf8c
  esac
Packit Service c5cf8c
fi
Packit Service c5cf8c
if test -n "$MPIF90" ; then
Packit Service c5cf8c
   case $MPIF90 in
Packit Service c5cf8c
changequote(<<,>>)
Packit Service c5cf8c
    [\\/]* | ?:[\\/]*)
Packit Service c5cf8c
changequote([,])
Packit Service c5cf8c
    # Ok, PATH_PROG will figure it out
Packit Service c5cf8c
    ;;  
Packit Service c5cf8c
  *)
Packit Service c5cf8c
    AC_MSG_ERROR([MPIF90 must be set to an absolute path if it is set])
Packit Service c5cf8c
  esac
Packit Service c5cf8c
fi
Packit Service c5cf8c
Packit Service c5cf8c
case $ac_mpi_type in
Packit Service c5cf8c
	mpich)
Packit Service c5cf8c
        dnl 
Packit Service c5cf8c
        dnl This isn't correct.  It should try to get the underlying compiler
Packit Service c5cf8c
        dnl from the mpicc and mpif77 scripts or mpireconfig
Packit Service c5cf8c
        if test "X$pac_lib_mpi_is_building" != "Xyes" ; then
Packit Service c5cf8c
	    PAC_PUSH_FLAG([PATH])
Packit Service c5cf8c
            if test "$with_mpich" != "yes" -a "$with_mpich" != "no" ; then 
Packit Service c5cf8c
		# Look for commands; if not found, try adding bin to the
Packit Service c5cf8c
		# path
Packit Service c5cf8c
		if test ! -x $with_mpich/mpicc -a -x $with_mpich/bin/mpicc ; then
Packit Service c5cf8c
			with_mpich="$with_mpich/bin"
Packit Service c5cf8c
		fi
Packit Service c5cf8c
                PATH=$with_mpich:${PATH}
Packit Service c5cf8c
            fi
Packit Service c5cf8c
            AC_PATH_PROG(MPICC,mpicc)
Packit Service c5cf8c
	    if test -z "$TESTCC" ; then TESTCC=${CC-cc} ; fi
Packit Service c5cf8c
            CC="$MPICC"
Packit Service c5cf8c
	    # Note that autoconf may unconditionally change the value of 
Packit Service c5cf8c
	    # CC (!) in some other command. Thus, we define CCMASTER
Packit Service c5cf8c
	    CCMASTER=$CC
Packit Service c5cf8c
	    # Force autoconf to respect this choice
Packit Service c5cf8c
	    ac_ct_CC=$CC
Packit Service c5cf8c
	    # to permit configure codes to recover the correct CC.  This
Packit Service c5cf8c
	    # is an ugly not-quite-correct workaround for the fact that 
Packit Service c5cf8c
	    # does not want you to change the C compiler once you have set it
Packit Service c5cf8c
	    # (But since it does so unconditionally, it silently creates 
Packit Service c5cf8c
	    # bogus output files.)
Packit Service c5cf8c
            AC_PATH_PROG(MPIF77,mpif77)
Packit Service c5cf8c
	    if test -z "$TESTF77" ; then TESTF77=${F77-f77} ; fi
Packit Service c5cf8c
            F77="$MPIF77"
Packit Service c5cf8c
            AC_PATH_PROG(MPIFC,mpif90)
Packit Service c5cf8c
	    if test -z "$TESTFC" ; then TESTFC=${FC-f90} ; fi 
Packit Service c5cf8c
            FC="$MPIFC"
Packit Service c5cf8c
            AC_PATH_PROG(MPICXX,mpiCC)
Packit Service c5cf8c
	    if test -z "$TESTCXX" ; then TESTCXX=${CXX-CC} ; fi
Packit Service c5cf8c
            CXX="$MPICXX"
Packit Service c5cf8c
	    # We may want to restrict this to the path containing mpirun
Packit Service c5cf8c
	    AC_PATH_PROG(MPIEXEC,mpiexec)
Packit Service c5cf8c
	    AC_PATH_PROG(MPIRUN,mpirun)
Packit Service c5cf8c
	    AC_PATH_PROG(MPIBOOT,mpichboot)
Packit Service c5cf8c
	    AC_PATH_PROG(MPIUNBOOT,mpichstop)
Packit Service c5cf8c
	    PAC_POP_FLAG([PATH])
Packit Service c5cf8c
  	    MPILIBNAME="mpich"
Packit Service c5cf8c
        else 
Packit Service c5cf8c
	    # All of the above should have been passed in the environment!
Packit Service c5cf8c
	    :
Packit Service c5cf8c
        fi
Packit Service c5cf8c
	;;
Packit Service c5cf8c
Packit Service c5cf8c
        mpichnt)
Packit Service c5cf8c
        ;;
Packit Service c5cf8c
Packit Service c5cf8c
	lammpi)
Packit Service c5cf8c
	dnl
Packit Service c5cf8c
        dnl This isn't correct.  It should try to get the underlying compiler
Packit Service c5cf8c
        dnl from the mpicc and mpif77 scripts or mpireconfig
Packit Service c5cf8c
	PAC_PUSH_FLAG([PATH])
Packit Service c5cf8c
        if test "$with_mpich" != "yes" -a "$with_mpich" != "no" ; then 
Packit Service c5cf8c
	    # Look for commands; if not found, try adding bin to the path
Packit Service c5cf8c
		if test ! -x $with_lammpi/mpicc -a -x $with_lammpi/bin/mpicc ; then
Packit Service c5cf8c
			with_lammpi="$with_lammpi/bin"
Packit Service c5cf8c
		fi
Packit Service c5cf8c
                PATH=$with_lammpi:${PATH}
Packit Service c5cf8c
        fi
Packit Service c5cf8c
        AC_PATH_PROG(MPICC,mpicc)
Packit Service c5cf8c
        if test -z "$TESTCC" ; then TESTCC=${CC-cc} ; fi
Packit Service c5cf8c
        CC="$MPICC"
Packit Service c5cf8c
        AC_PATH_PROG(MPIF77,mpif77)
Packit Service c5cf8c
	if test -z "$TESTCC" ; then TESTF77=${F77-f77} ; fi
Packit Service c5cf8c
        F77="$MPIF77"
Packit Service c5cf8c
        AC_PATH_PROG(MPIFC,mpif90)
Packit Service c5cf8c
        TESTFC=${FC-f90}
Packit Service c5cf8c
	if test -z "$TESTFC" ; then TESTFC=${FC-f90} ; fi
Packit Service c5cf8c
        FC="$MPIFC"
Packit Service c5cf8c
        AC_PATH_PROG(MPICXX,mpiCC)
Packit Service c5cf8c
	if test -z "$TESTCXX" ; then TESTCXX=${CXX-CC} ; fi
Packit Service c5cf8c
        CXX="$MPICXX"
Packit Service c5cf8c
	PAC_POP_FLAG([PATH])
Packit Service c5cf8c
  	MPILIBNAME="lammpi"
Packit Service c5cf8c
	MPIBOOT="lamboot"
Packit Service c5cf8c
	MPIUNBOOT="wipe"
Packit Service c5cf8c
	MPIRUN="mpirun"
Packit Service c5cf8c
	;;
Packit Service c5cf8c
Packit Service c5cf8c
	ibmmpi)
Packit Service c5cf8c
	AC_CHECK_PROGS(MPCC,mpcc)
Packit Service c5cf8c
	AC_CHECK_PROGS(MPXLF,mpxlf mpfort)
Packit Service c5cf8c
	if test -z "$MPCC" -o -z "$MPXLF" ; then
Packit Service c5cf8c
	    AC_MSG_ERROR([Could not find IBM MPI compilation scripts.  Either mpcc or mpxlf/mpfort is missing])
Packit Service c5cf8c
	fi
Packit Service c5cf8c
	if test -z "$TESTCC" ; then TESTCC=${CC-xlC} ; fi
Packit Service c5cf8c
	if test -z "$TESTF77" ; then TESTF77=${F77-xlf}; fi
Packit Service c5cf8c
	CC=mpcc; F77=$MPXLF
Packit Service c5cf8c
	# There is no mpxlf90, but the options langlvl and free can
Packit Service c5cf8c
	# select the Fortran 90 version of xlf
Packit Service c5cf8c
	if test "$enable_f90" != no ; then
Packit Service c5cf8c
	    AC_CHECK_PROGS(MPIXLF90,mpxlf90 mpfort)
Packit Service c5cf8c
	    if test -z "$TESTFC" ; then TESTFC=${FC-xlf90}; fi
Packit Service c5cf8c
            if test "X$MPIXLF90" != "X" ; then 
Packit Service c5cf8c
	        FC="$MPIXLF90"
Packit Service c5cf8c
	    else
Packit Service c5cf8c
	    	FC="$MPXLF -qlanglvl=90ext -qfree=f90"
Packit Service c5cf8c
	    fi
Packit Service c5cf8c
	fi
Packit Service c5cf8c
	MPILIBNAME=""
Packit Service c5cf8c
	cross_compiling=yes
Packit Service c5cf8c
	# Turn off the autoconf version 3 warning message
Packit Service c5cf8c
	ac_tool_warned=yes
Packit Service c5cf8c
	;;
Packit Service c5cf8c
Packit Service c5cf8c
	sgimpi)
Packit Service c5cf8c
	if test -z "$TESTCC" ; then TESTCC=${CC:=cc} ; fi
Packit Service c5cf8c
	if test -z "$TESTF77" ; then TESTF77=${F77:=f77} ; fi
Packit Service c5cf8c
	if test -z "$TESTCXX" ; then TESTCXX=${CXX:=CC} ; fi
Packit Service c5cf8c
	if test -z "$TESTFC" ; then TESTFC=${FC:=f90} ; fi
Packit Service c5cf8c
	# Must check for the MPI library in a separate macro - adding
Packit Service c5cf8c
	# a test here will cause autoconf to prematurely define the
Packit Service c5cf8c
	# C compiler
Packit Service c5cf8c
	MPIRUN=mpirun
Packit Service c5cf8c
	MPIBOOT=""
Packit Service c5cf8c
	MPIUNBOOT=""
Packit Service c5cf8c
	;;
Packit Service c5cf8c
Packit Service c5cf8c
	generic)
Packit Service c5cf8c
	# in $with_mpi/bin or $with_mpi
Packit Service c5cf8c
        if test "X$MPICC" = "X" ; then
Packit Service c5cf8c
            if test -x "$with_mpi/bin/mpicc" ; then
Packit Service c5cf8c
                MPICC=$with_mpi/bin/mpicc
Packit Service c5cf8c
	    elif test -x "$with_mpi/mpicc" ; then
Packit Service c5cf8c
	        MPICC=$with_mpi/mpicc
Packit Service c5cf8c
            fi
Packit Service c5cf8c
        fi
Packit Service c5cf8c
        if test "X$MPICXX" = "X" ; then
Packit Service c5cf8c
            if test -x "$with_mpi/bin/mpicxx" ; then
Packit Service c5cf8c
                MPICXX=$with_mpi/bin/mpicxx
Packit Service c5cf8c
	    elif test -x "$with_mpi/mpicxx" ; then
Packit Service c5cf8c
	        MPICXX=$with_mpi/mpicxx
Packit Service c5cf8c
            fi
Packit Service c5cf8c
        fi
Packit Service c5cf8c
        if test "X$MPIF77" = "X" ; then
Packit Service c5cf8c
            if test -x "$with_mpi/bin/mpif77" ; then
Packit Service c5cf8c
                MPIF77=$with_mpi/bin/mpif77
Packit Service c5cf8c
	    elif test -x "$with_mpi/mpif77" ; then
Packit Service c5cf8c
	        MPIF77=$with_mpi/mpif77
Packit Service c5cf8c
            fi
Packit Service c5cf8c
        fi
Packit Service c5cf8c
        if test "X$MPIF90" = "X" ; then
Packit Service c5cf8c
            if test -x "$with_mpi/bin/mpif90" ; then
Packit Service c5cf8c
                MPIF90=$with_mpi/bin/mpif90
Packit Service c5cf8c
	    elif test -x "$with_mpi/mpif90" ; then
Packit Service c5cf8c
	        MPIF90=$with_mpi/mpif90
Packit Service c5cf8c
            fi
Packit Service c5cf8c
        fi
Packit Service c5cf8c
        if test "X$MPIEXEC" = "X" ; then
Packit Service c5cf8c
            if test -x "$with_mpi/bin/mpiexec" ; then
Packit Service c5cf8c
                MPIEXEC=$with_mpi/bin/mpiexec
Packit Service c5cf8c
	    elif test -x "$with_mpi/mpiexec" ; then
Packit Service c5cf8c
	        MPIEXEC=$with_mpi/mpiexec
Packit Service c5cf8c
            fi
Packit Service c5cf8c
        fi
Packit Service c5cf8c
        CC=$MPICC
Packit Service c5cf8c
        F77=$MPIF77
Packit Service c5cf8c
	if test "X$MPICXX" != "X" ; then CXX=$MPICXX ; fi
Packit Service c5cf8c
	if test "X$MPIF90" != "X" ; then F90=$MPIF90 ; fi
Packit Service c5cf8c
	;;
Packit Service c5cf8c
Packit Service c5cf8c
	*)
Packit Service c5cf8c
	# Use the default choices for the compilers
Packit Service c5cf8c
	;;
Packit Service c5cf8c
esac
Packit Service c5cf8c
])
Packit Service c5cf8c
Packit Service c5cf8c
AC_DEFUN([PAC_MPI_FIND_COMPILERS],[
Packit Service c5cf8c
# Tell autoconf to determine properties of the compilers (these are the 
Packit Service c5cf8c
# compilers for MPI programs)
Packit Service c5cf8c
PAC_PROG_CC
Packit Service c5cf8c
if test "$enable_f77" != no -a "$enable_fortran" != no ; then
Packit Service c5cf8c
    AC_PROG_F77
Packit Service c5cf8c
fi
Packit Service c5cf8c
if test "$enable_cxx" != no ; then
Packit Service c5cf8c
    AC_PROG_CXX
Packit Service c5cf8c
fi
Packit Service c5cf8c
if test "$enable_f90" != no ; then
Packit Service c5cf8c
    PAC_PROG_FC
Packit Service c5cf8c
fi
Packit Service c5cf8c
])
Packit Service c5cf8c
Packit Service c5cf8c
dnl
Packit Service c5cf8c
dnl This uses the selected CC etc to check for include paths and libraries
Packit Service c5cf8c
AC_DEFUN([PAC_MPI_CHECK_MPI_LIB],[
Packit Service c5cf8c
AC_REQUIRE([AC_PROG_CC])
Packit Service c5cf8c
case $ac_mpi_type in
Packit Service c5cf8c
    mpich)
Packit Service c5cf8c
	;;
Packit Service c5cf8c
Packit Service c5cf8c
    mpichnt)
Packit Service c5cf8c
        dnl
Packit Service c5cf8c
        dnl This isn't adequate, but it helps with using MPICH-NT/SDK.gcc
Packit Service c5cf8c
	PAC_PUSH_FLAG([CFLAGS])
Packit Service c5cf8c
        CFLAGS="$CFLAGS -I$with_mpichnt/include"
Packit Service c5cf8c
	PAC_PUSH_FLAG([CPPFLAGS])
Packit Service c5cf8c
        CPPFLAGS="$CPPFLAGS -I$with_mpichnt/include"
Packit Service c5cf8c
	PAC_PUSH_FLAG([LDFLAGS])
Packit Service c5cf8c
        LDFLAGS="$LDFLAGS -L$with_mpichnt/lib"
Packit Service c5cf8c
        AC_CHECK_LIB(mpich,MPI_Init,found="yes",found="no")
Packit Service c5cf8c
        if test "$found" = "no" ; then
Packit Service c5cf8c
          AC_CHECK_LIB(mpich,MPI_Init,found="yes",found="no")
Packit Service c5cf8c
        fi
Packit Service c5cf8c
	if test "$enable_cxx" != no ; then
Packit Service c5cf8c
	    AC_PROG_CXX
Packit Service c5cf8c
	fi
Packit Service c5cf8c
	if test "$enable_f90" != no ; then
Packit Service c5cf8c
	    PAC_PROG_FC
Packit Service c5cf8c
	fi
Packit Service c5cf8c
	# Set defaults for the TEST versions if not already set
Packit Service c5cf8c
	if test -z "$TESTCC" ; then TESTCC=${CC:=cc} ; fi
Packit Service c5cf8c
	if test -z "$TESTF77" ; then TESTF77=${F77:=f77} ; fi
Packit Service c5cf8c
	if test -z "$TESTCXX" ; then TESTCXX=${CXX:=CC} ; fi
Packit Service c5cf8c
	if test -z "$TESTFC" ; then TESTFC=${FC:=f90} ; fi
Packit Service c5cf8c
        if test "$found" = "no" ; then
Packit Service c5cf8c
	  PAC_POP_FLAG([CFLAGS])
Packit Service c5cf8c
	  PAC_POP_FLAG([CPPFLAGS])
Packit Service c5cf8c
	  PAC_POP_FLAG([LDFLAGS])
Packit Service c5cf8c
        fi
Packit Service c5cf8c
        ;;
Packit Service c5cf8c
Packit Service c5cf8c
    lammpi)
Packit Service c5cf8c
	;;
Packit Service c5cf8c
Packit Service c5cf8c
    ibmmpi)
Packit Service c5cf8c
	;;
Packit Service c5cf8c
Packit Service c5cf8c
    sgimpi)
Packit Service c5cf8c
	AC_CHECK_LIB(mpi,MPI_Init)
Packit Service c5cf8c
	if test "$ac_cv_lib_mpi_MPI_Init" = "yes" ; then
Packit Service c5cf8c
	    MPILIBNAME="mpi"
Packit Service c5cf8c
	fi	
Packit Service c5cf8c
	;;
Packit Service c5cf8c
Packit Service c5cf8c
    generic)
Packit Service c5cf8c
	AC_SEARCH_LIBS(MPI_Init,mpi mpich mpich)
Packit Service c5cf8c
	if test "$ac_cv_lib_mpi_MPI_Init" = "yes" ; then
Packit Service c5cf8c
	    MPILIBNAME="mpi"
Packit Service c5cf8c
	fi	
Packit Service c5cf8c
	;;
Packit Service c5cf8c
Packit Service c5cf8c
    *)
Packit Service c5cf8c
	;;
Packit Service c5cf8c
esac
Packit Service c5cf8c
])
Packit Service c5cf8c
Packit Service c5cf8c
dnl
Packit Service c5cf8c
dnl/*D
Packit Service c5cf8c
dnl PAC_MPI_F2C - Determine if MPI has the MPI-2 functions MPI_xxx_f2c and
Packit Service c5cf8c
dnl   MPI_xxx_c2f
Packit Service c5cf8c
dnl
Packit Service c5cf8c
dnl Output Effect:
Packit Service c5cf8c
dnl Define 'HAVE_MPI_F2C' if the routines are found.
Packit Service c5cf8c
dnl
Packit Service c5cf8c
dnl Notes:
Packit Service c5cf8c
dnl Looks only for 'MPI_Request_c2f'.
Packit Service c5cf8c
dnl D*/
Packit Service c5cf8c
AC_DEFUN([PAC_MPI_F2C],[
Packit Service c5cf8c
AC_CACHE_CHECK([for MPI F2C and C2F routines],
Packit Service c5cf8c
pac_cv_mpi_f2c,
Packit Service c5cf8c
[
Packit Service c5cf8c
AC_TRY_LINK([#include "mpi.h"],
Packit Service c5cf8c
[MPI_Request request;MPI_Fint a;a = MPI_Request_c2f(request);],
Packit Service c5cf8c
pac_cv_mpi_f2c="yes",pac_cv_mpi_f2c="no")
Packit Service c5cf8c
])
Packit Service c5cf8c
if test "$pac_cv_mpi_f2c" = "yes" ; then 
Packit Service c5cf8c
    AC_DEFINE(HAVE_MPI_F2C,1,[Define if MPI has F2C]) 
Packit Service c5cf8c
fi
Packit Service c5cf8c
])
Packit Service c5cf8c
dnl
Packit Service c5cf8c
dnl/*D
Packit Service c5cf8c
dnl PAC_HAVE_ROMIO - make mpi.h include mpio.h if romio enabled
Packit Service c5cf8c
dnl
Packit Service c5cf8c
dnl Output Effect:
Packit Service c5cf8c
dnl expands @HAVE_ROMIO@ in mpi.h into #include "mpio.h"
Packit Service c5cf8c
dnl D*/
Packit Service c5cf8c
AC_DEFUN([PAC_HAVE_ROMIO],[
Packit Service c5cf8c
if test "$enable_romio" = "yes" ; then HAVE_ROMIO='#include "mpio.h"'; fi
Packit Service c5cf8c
AC_SUBST(HAVE_ROMIO)
Packit Service c5cf8c
])