Blame configure.ac

Packit Service c5cf8c
AC_PREREQ(2.63)
Packit Service c5cf8c
# 
Packit Service c5cf8c
# (C) 2006 by Argonne National Laboratory.
Packit Service c5cf8c
#     See COPYRIGHT in top-level directory.
Packit Service c5cf8c
#
Packit Service c5cf8c
dnl Process this file with autoconf to produce a configure script.
Packit Service c5cf8c
dnl
Packit Service c5cf8c
dnl aclocal_cache.m4, included by sowing/confdb/aclocal.m4, fixes 
Packit Service c5cf8c
dnl bugs in autoconf caching.
Packit Service c5cf8c
dnl
Packit Service c5cf8c
dnl This is a large configure script and it is important to keep it
Packit Service c5cf8c
dnl clearly organized.  In addition, this script must coordinate with 
Packit Service c5cf8c
dnl the other modules that can be used to construct MPICH, such as
Packit Service c5cf8c
dnl the communication device and the process manager.  Each of these
Packit Service c5cf8c
dnl may have special features or limitations that other modules or
Packit Service c5cf8c
dnl this configure may need to take into account.  To handle this, there
Packit Service c5cf8c
dnl are xx major steps in this configure script:
Packit Service c5cf8c
dnl
Packit Service c5cf8c
dnl 1. Identify major modules and source any prerequisite scripts
Packit Service c5cf8c
dnl 2. Determine compiler characteristics 
Packit Service c5cf8c
dnl 3. Setup and configure the other modules
Packit Service c5cf8c
dnl 4. Determine MPI features and characteristics (such as datatype values)
Packit Service c5cf8c
dnl
Packit Service c5cf8c
dnl Each of these is described in more detail below.
Packit Service c5cf8c
dnl
Packit Service c5cf8c
dnl 1. Identify the modules (most are specified by 
Packit Service c5cf8c
dnl --with-<modulename>=instance,
Packit Service c5cf8c
dnl for example, --with-pm=hydra or --with-device=ch3:nemesis).
Packit Service c5cf8c
dnl For each module, source the file mpichprereq if present (in the
Packit Service c5cf8c
dnl module's top-level directory).  This
Packit Service c5cf8c
dnl must be a bourne (sh) shell script; it can access any of the variables
Packit Service c5cf8c
dnl in the configure script.  In addition, there are a few variables that
Packit Service c5cf8c
dnl are defined and provided to allow the modules to communicate their 
Packit Service c5cf8c
dnl needs or limitations to the other modules.  These are:
Packit Service c5cf8c
dnl    MPID_MAX_THREAD_LEVEL - thread level supported by device.
Packit Service c5cf8c
dnl                            if unset, is MPI_THREAD_FUNNELED
Packit Service c5cf8c
dnl    MPID_NO_LONG_LONG     - if yes, the device does not support the 
Packit Service c5cf8c
dnl                            long long integer type
Packit Service c5cf8c
dnl    MPID_NO_LONG_DOUBLE   - if yes, the device does not support the
Packit Service c5cf8c
dnl                            long double type
Packit Service c5cf8c
dnl    MPID_PM_NAMESERVER    - if set, provides the name of the nameserver
Packit Service c5cf8c
dnl                            that the process manager supports.
Packit Service c5cf8c
dnl                            This name server will be used if the
Packit Service c5cf8c
dnl                            default name server is selected.
Packit Service c5cf8c
dnl    MPID_NO_PM            - If yes, the device does not require any
Packit Service c5cf8c
dnl                            PM implementation.  
Packit Service c5cf8c
dnl    MPID_MAX_PROCESSOR_NAME - The maximum number of character in a processor
Packit Service c5cf8c
dnl                            name.  If not set, 128 will be used.
Packit Service c5cf8c
dnl    MPID_MAX_ERROR_STRING - The maximum number of character in an error
Packit Service c5cf8c
dnl                            string.  If not set, 1024 will be used.
Packit Service c5cf8c
dnl    PM_REQUIRES_PMI       - if set, provides the name of the PMI 
Packit Service c5cf8c
dnl                            interface implementation.  If not set,
Packit Service c5cf8c
dnl                            the "simple" PMI implementation is used.
Packit Service c5cf8c
dnl                            A process manager that needs a particular
Packit Service c5cf8c
dnl                            process manager should check that this is
Packit Service c5cf8c
dnl                            not set to an incompatible value.
Packit Service c5cf8c
dnl    MPID_NO_SPAWN         - if yes, the device does not support the
Packit Service c5cf8c
dnl                            dynamic process routines (spawn, connect
Packit Service c5cf8c
dnl                            attach, join, plus port and publish 
Packit Service c5cf8c
dnl                            routines).  The major effect of this
Packit Service c5cf8c
dnl                            is to let the test codes know that
Packit Service c5cf8c
dnl                            spawn is not implemented.
Packit Service c5cf8c
dnl    MPID_NO_RMA           - if yes, the device does not support the
Packit Service c5cf8c
dnl                            MPI RMA routines (MPI_Win_create and 
Packit Service c5cf8c
dnl                            MPI_Put etc.).  The major effect of this
Packit Service c5cf8c
dnl                            is to let the test codes know that 
Packit Service c5cf8c
dnl                            RMA is not implemented.
Packit Service c5cf8c
dnl
Packit Service c5cf8c
dnl Note that the meanings of these variables are defined so that an 
Packit Service c5cf8c
dnl undefined value gives the default.  This makes it easy to expand
Packit Service c5cf8c
dnl the set of such variables, since only modules that need the new
Packit Service c5cf8c
dnl variable will need to be changed.
Packit Service c5cf8c
dnl
Packit Service c5cf8c
dnl 2. Determine compiler characteristics
Packit Service c5cf8c
dnl Here is where features of the compilers are determined, including
Packit Service c5cf8c
dnl support for shared libraries and sizes of the basic datatype types.
Packit Service c5cf8c
dnl
Packit Service c5cf8c
dnl 3. Setup and configure the other modules
Packit Service c5cf8c
dnl Before each module configure is executed, the script setup_<module>
Packit Service c5cf8c
dnl is run if present.  This is a bourne (sh) shell script and may
Packit Service c5cf8c
dnl access configure variables.  It should not make any changes to the
Packit Service c5cf8c
dnl compiler name or flags (e.g., do not add -D_XOPEN_SOURCE to CFLAGS here,
Packit Service c5cf8c
dnl because that may invalidate the determination of the compiler 
Packit Service c5cf8c
dnl characteristics in the prior step).
Packit Service c5cf8c
dnl
Packit Service c5cf8c
dnl 4. Determine MPI features
Packit Service c5cf8c
dnl    
Packit Service c5cf8c
dnl
Packit Service c5cf8c
dnl Special environment variables
Packit Service c5cf8c
dnl To let other scripts and in particular the configure in test/mpi
Packit Service c5cf8c
dnl know that they are being invoked from within the MPICH configure,
Packit Service c5cf8c
dnl the following environment variables are set and exported:
Packit Service c5cf8c
dnl    FROM_MPICH
Packit Service c5cf8c
dnl    MPICH_ENABLE_F77
Packit Service c5cf8c
dnl    MPICH_ENABLE_FC
Packit Service c5cf8c
dnl    MPICH_ENABLE_CXX
Packit Service c5cf8c
dnl
Packit Service c5cf8c
dnl Note that no executable statements are allowed (and any are silently 
Packit Service c5cf8c
dnl dropped) before AC_INIT.
Packit Service c5cf8c
Packit Service c5cf8c
m4_include([maint/version.m4])
Packit Service c5cf8c
dnl 2nd arg is intentionally underquoted
Packit Service c5cf8c
AC_INIT([MPICH],
Packit Service c5cf8c
        MPICH_VERSION_m4,
Packit Service c5cf8c
        [discuss@mpich.org],
Packit Service c5cf8c
        [mpich],
Packit Service c5cf8c
        [http://www.mpich.org/])
Packit Service c5cf8c
Packit Service c5cf8c
if test "x$prefix" != "xNONE" && test -d "$prefix"; then 
Packit Service c5cf8c
    if test "x`(cd \"$prefix\"; echo \"$PWD\")`" = "x`(cd \"$srcdir\"; echo \"$PWD\")`" ||\
Packit Service c5cf8c
       test "x`(cd \"$prefix\"; echo \"$PWD\")`" = "x$PWD"  ; then
Packit Service c5cf8c
        AC_MSG_ERROR([The install directory (--prefix=) cannot be the same as the build or src directory.])
Packit Service c5cf8c
    fi
Packit Service c5cf8c
fi         
Packit Service c5cf8c
Packit Service c5cf8c
CONFIGURE_ARGS_CLEAN=`echo $* | tr '"' ' '`
Packit Service c5cf8c
AC_SUBST(CONFIGURE_ARGS_CLEAN)
Packit Service c5cf8c
Packit Service c5cf8c
# these values come from the m4_include above
Packit Service c5cf8c
MPICH_VERSION=MPICH_VERSION_m4
Packit Service c5cf8c
AC_SUBST([MPICH_VERSION])
Packit Service c5cf8c
MPICH_RELEASE_DATE="MPICH_RELEASE_DATE_m4"
Packit Service c5cf8c
AC_SUBST([MPICH_RELEASE_DATE])
Packit Service c5cf8c
libmpi_so_version="libmpi_so_version_m4"
Packit Service c5cf8c
AC_SUBST([libmpi_so_version])
Packit Service c5cf8c
Packit Service c5cf8c
Packit Service c5cf8c
if test -z "$MPICH_VERSION" ; then
Packit Service c5cf8c
    AC_MSG_ERROR([MPICH_VERSION is empty, check maint/version.m4 for errors])
Packit Service c5cf8c
fi
Packit Service c5cf8c
# Produce a numeric version assuming the following format:
Packit Service c5cf8c
# Version: [MAJ].[MIN].[REV][EXT][EXT_NUMBER]
Packit Service c5cf8c
# Example: 1.0.7rc1 has
Packit Service c5cf8c
#          MAJ = 1
Packit Service c5cf8c
#          MIN = 0
Packit Service c5cf8c
#          REV = 7
Packit Service c5cf8c
#          EXT = rc
Packit Service c5cf8c
#          EXT_NUMBER = 1
Packit Service c5cf8c
#
Packit Service c5cf8c
# Converting to numeric version will convert EXT to a format number:
Packit Service c5cf8c
#          ALPHA (a) = 0
Packit Service c5cf8c
#          BETA (b)  = 1
Packit Service c5cf8c
#          RC (rc)   = 2
Packit Service c5cf8c
#          PATCH (p) = 3
Packit Service c5cf8c
# Regular releases are treated as patch 0
Packit Service c5cf8c
#
Packit Service c5cf8c
# Numeric version will have 1 digit for MAJ, 2 digits for MIN,
Packit Service c5cf8c
# 2 digits for REV, 1 digit for EXT and 2 digits for EXT_NUMBER.
Packit Service c5cf8c
changequote(<<,>>)
Packit Service c5cf8c
V1=`expr $MPICH_VERSION : '\([0-9]*\)\.[0-9]*\.*[0-9]*[a-zA-Z]*[0-9]*'`
Packit Service c5cf8c
V2=`expr $MPICH_VERSION : '[0-9]*\.\([0-9]*\)\.*[0-9]*[a-zA-Z]*[0-9]*'`
Packit Service c5cf8c
V3=`expr $MPICH_VERSION : '[0-9]*\.[0-9]*\.*\([0-9]*\)[a-zA-Z]*[0-9]*'`
Packit Service c5cf8c
V4=`expr $MPICH_VERSION : '[0-9]*\.[0-9]*\.*[0-9]*\([a-zA-Z]*\)[0-9]*'`
Packit Service c5cf8c
V5=`expr $MPICH_VERSION : '[0-9]*\.[0-9]*\.*[0-9]*[a-zA-Z]*\([0-9]*\)'`
Packit Service c5cf8c
changequote([,])
Packit Service c5cf8c
Packit Service c5cf8c
if test "$V2" -le 9 ; then V2=0$V2 ; fi
Packit Service c5cf8c
if test "$V3" = "" ; then V3=0; fi
Packit Service c5cf8c
if test "$V3" -le 9 ; then V3=0$V3 ; fi
Packit Service c5cf8c
if test "$V4" = "a" ; then
Packit Service c5cf8c
    V4=0
Packit Service c5cf8c
elif test "$V4" = "b" ; then
Packit Service c5cf8c
    V4=1
Packit Service c5cf8c
elif test "$V4" = "rc" ; then
Packit Service c5cf8c
    V4=2
Packit Service c5cf8c
elif test "$V4" = "" ; then
Packit Service c5cf8c
    V4=3
Packit Service c5cf8c
    V5=0
Packit Service c5cf8c
elif test "$V4" = "p" ; then
Packit Service c5cf8c
    V4=3
Packit Service c5cf8c
fi
Packit Service c5cf8c
if test "$V5" -le 9 ; then V5=0$V5 ; fi
Packit Service c5cf8c
Packit Service c5cf8c
MPICH_NUMVERSION=`expr $V1$V2$V3$V4$V5 + 0`
Packit Service c5cf8c
AC_SUBST(MPICH_NUMVERSION)
Packit Service c5cf8c
Packit Service c5cf8c
AC_ARG_WITH(custom-version-string,
Packit Service c5cf8c
            AC_HELP_STRING([--with-custom-version-string], [Adds a user-specified value to the output of the mpichversion executable]),,with_custom_version_string="")
Packit Service c5cf8c
MPICH_CUSTOM_STRING=$with_custom_version_string
Packit Service c5cf8c
AC_SUBST(MPICH_CUSTOM_STRING)
Packit Service c5cf8c
Packit Service c5cf8c
# ABIVERSION is the name used by simplemake, so we reassign the
Packit Service c5cf8c
# libmpi_so_version number to it
Packit Service c5cf8c
ABIVERSION=${libmpi_so_version}
Packit Service c5cf8c
export ABIVERSION
Packit Service c5cf8c
export libmpi_so_version
Packit Service c5cf8c
AC_SUBST(ABIVERSION)
Packit Service c5cf8c
Packit Service c5cf8c
# Print out the configure options
Packit Service c5cf8c
CONFIGURE_ARGUMENTS="$ac_configure_args"
Packit Service c5cf8c
AC_SUBST(CONFIGURE_ARGUMENTS)
Packit Service c5cf8c
if test -n "$ac_configure_args" ; then
Packit Service c5cf8c
    echo "Configuring MPICH version $MPICH_VERSION with $ac_configure_args"
Packit Service c5cf8c
else 
Packit Service c5cf8c
    echo "Configuring MPICH version $MPICH_VERSION"
Packit Service c5cf8c
fi
Packit Service c5cf8c
Packit Service c5cf8c
# Add the information on the system:
Packit Service c5cf8c
echo "Running on system: `uname -a`"
Packit Service c5cf8c
Packit Service c5cf8c
dnl Definitions will be placed in this file rather than in the DEFS variable
Packit Service c5cf8c
AC_CONFIG_HEADER(src/include/mpichconf.h)
Packit Service c5cf8c
AH_TOP([/* -*- Mode: C; c-basic-offset:4 ; -*- */
Packit Service c5cf8c
/*
Packit Service c5cf8c
 *  (C) 2001 by Argonne National Laboratory.
Packit Service c5cf8c
 *      See COPYRIGHT in top-level directory.
Packit Service c5cf8c
 */
Packit Service c5cf8c
#ifndef MPICHCONF_H_INCLUDED
Packit Service c5cf8c
#define MPICHCONF_H_INCLUDED
Packit Service c5cf8c
])
Packit Service c5cf8c
Packit Service c5cf8c
# We use an #include strategy here because all of the alternative strategies for
Packit Service c5cf8c
# quashing these variables have various drawbacks.  The alternatives are listed
Packit Service c5cf8c
# here to avoid rediscovery of these problems by someone else in the future:
Packit Service c5cf8c
#
Packit Service c5cf8c
# 1) Strategy: Rewrite mpichconf.h.in with sed at autogen.sh time.
Packit Service c5cf8c
#    Problem: Automatic remaking of config.status and friends will re-run
Packit Service c5cf8c
#             autoheader and blow away our sed changes without an opportunity to
Packit Service c5cf8c
#             patch the resulting file again.
Packit Service c5cf8c
# 2) Strategy: Add literal "#undef PACKAGE" lines to the AH_BOTTOM text.
Packit Service c5cf8c
#    Problem: These lines get rewritten by config.status to be "#define" lines,
Packit Service c5cf8c
#             so the intended quashing never actually occurs.
Packit Service c5cf8c
# 3) Strategy: Use AC_CONFIG_COMMANDS to run a sed rewrite command on
Packit Service c5cf8c
#              mpichconf.h at config.status time.
Packit Service c5cf8c
#    Problem: Causes mpichconf.h to always be rewritten, first by the normal
Packit Service c5cf8c
#             config.status commands and then by sed.  This can cause
Packit Service c5cf8c
#             unnecessary remaking of object files since nearly every C source
Packit Service c5cf8c
#             file includes this header (see the Autoconf Manual, "Automatic
Packit Service c5cf8c
#             Remaking")
Packit Service c5cf8c
#
Packit Service c5cf8c
# The only other plausible strategy would seem to be rewriting config.status
Packit Service c5cf8c
# itself via AC_CONFIG_COMMANDS_POST, but that seems error prone.  The best
Packit Service c5cf8c
# solution would be to stop all subconfigures from including config.h headers
Packit Service c5cf8c
# from other packages.  Then all of this nonsense can be eliminated.
Packit Service c5cf8c
# [goodell@ 2011-08-26]
Packit Service c5cf8c
AH_BOTTOM([
Packit Service c5cf8c
/* Include nopackage.h to undef autoconf-defined macros that cause conflicts in
Packit Service c5cf8c
 * subpackages.  This should not be necessary, but some packages are too
Packit Service c5cf8c
 * tightly intertwined right now (such as ROMIO and the MPICH core) */
Packit Service c5cf8c
#include "nopackage.h"
Packit Service c5cf8c
Packit Service c5cf8c
#endif /* !defined(MPICHCONF_H_INCLUDED) */
Packit Service c5cf8c
])
Packit Service c5cf8c
Packit Service c5cf8c
dnl Set the directory that contains support scripts such as install-sh and
Packit Service c5cf8c
dnl config.guess
Packit Service c5cf8c
AC_CONFIG_AUX_DIR(confdb)
Packit Service c5cf8c
dnl our macro dir is the same as our aux dir
Packit Service c5cf8c
AC_CONFIG_MACRO_DIR([confdb])
Packit Service c5cf8c
Packit Service c5cf8c
# Set the FROM_MPICH variable to tell subconfigures that they are
Packit Service c5cf8c
# built from within MPICH
Packit Service c5cf8c
FROM_MPICH=yes
Packit Service c5cf8c
export FROM_MPICH
Packit Service c5cf8c
Packit Service c5cf8c
# Save a copy of precious flags as USER_* before any of these flags
Packit Service c5cf8c
# are being modified by configure tests.
Packit Service c5cf8c
PAC_PREFIX_ALL_FLAGS(USER)
Packit Service c5cf8c
Packit Service c5cf8c
# WRAPPER_xFLAGS are used by mpicc and friends.
Packit Service c5cf8c
#
Packit Service c5cf8c
# WRAPPER_CFLAGS and other compile flags are used for compile options
Packit Service c5cf8c
# that are added by MPICH, but should be used by applications (such
Packit Service c5cf8c
# as include paths).
Packit Service c5cf8c
#
Packit Service c5cf8c
# All libraries that are detected by MPICH as needed for some of its
Packit Service c5cf8c
# functionality (such as -lpthread) should be added to WRAPPER_LIBS
Packit Service c5cf8c
# so executables built within MPICH use them.  If inter-library
Packit Service c5cf8c
# dependencies are not supported on the platform, these libraries are
Packit Service c5cf8c
# added to the MPICH wrappers (mpicc and friends) as well.
Packit Service c5cf8c
PAC_PREFIX_ALL_FLAGS(WRAPPER)
Packit Service c5cf8c
Packit Service c5cf8c
# MPICH_MPIx_FLAGS are used by mpicc and friends.  They are like
Packit Service c5cf8c
# WRAPPER flags, but these are provided by the user.
Packit Service c5cf8c
AC_SUBST(MPICH_MPICC_CPPFLAGS)
Packit Service c5cf8c
AC_SUBST(MPICH_MPICC_CFLAGS)
Packit Service c5cf8c
AC_SUBST(MPICH_MPICC_LDFLAGS)
Packit Service c5cf8c
AC_SUBST(MPICH_MPICC_LIBS)
Packit Service c5cf8c
Packit Service c5cf8c
AC_SUBST(MPICH_MPICXX_CPPFLAGS)
Packit Service c5cf8c
AC_SUBST(MPICH_MPICXX_CXXFLAGS)
Packit Service c5cf8c
AC_SUBST(MPICH_MPICXX_LDFLAGS)
Packit Service c5cf8c
AC_SUBST(MPICH_MPICXX_LIBS)
Packit Service c5cf8c
Packit Service c5cf8c
AC_SUBST(MPICH_MPIF77_CPPFLAGS)
Packit Service c5cf8c
AC_SUBST(MPICH_MPIF77_FFLAGS)
Packit Service c5cf8c
AC_SUBST(MPICH_MPIF77_LDFLAGS)
Packit Service c5cf8c
AC_SUBST(MPICH_MPIF77_LIBS)
Packit Service c5cf8c
Packit Service c5cf8c
AC_SUBST(MPICH_MPIFORT_CPPFLAGS)
Packit Service c5cf8c
AC_SUBST(MPICH_MPIFORT_FCFLAGS)
Packit Service c5cf8c
AC_SUBST(MPICH_MPIFORT_LDFLAGS)
Packit Service c5cf8c
AC_SUBST(MPICH_MPIFORT_LIBS)
Packit Service c5cf8c
Packit Service c5cf8c
# Add MPICHLIB_* to the appropriate flags
Packit Service c5cf8c
AC_ARG_VAR(MPICHLIB_CFLAGS,
Packit Service c5cf8c
	[extra CFLAGS used in building MPICH libraries])
Packit Service c5cf8c
AC_ARG_VAR(MPICHLIB_CPPFLAGS,
Packit Service c5cf8c
	[extra CPPFLAGS used in building MPICH libraries])
Packit Service c5cf8c
AC_ARG_VAR(MPICHLIB_CXXFLAGS,
Packit Service c5cf8c
	[extra CXXFLAGS used in building MPICH libraries])
Packit Service c5cf8c
AC_ARG_VAR(MPICHLIB_FFLAGS,
Packit Service c5cf8c
	[extra FFLAGS used in building MPICH libraries])
Packit Service c5cf8c
AC_ARG_VAR(MPICHLIB_FCFLAGS,
Packit Service c5cf8c
	[extra FCFLAGS used in building MPICH libraries])
Packit Service c5cf8c
CFLAGS="$CFLAGS $MPICHLIB_CFLAGS"
Packit Service c5cf8c
CPPFLAGS="$CPPFLAGS $MPICHLIB_CPPFLAGS"
Packit Service c5cf8c
CXXFLAGS="$CXXFLAGS $MPICHLIB_CXXFLAGS"
Packit Service c5cf8c
FFLAGS="$FFLAGS $MPICHLIB_FFLAGS"
Packit Service c5cf8c
FCFLAGS="$FCFLAGS $MPICHLIB_FCFLAGS"
Packit Service c5cf8c
Packit Service c5cf8c
dnl include all subsystem m4 fragments now that the core autoconf functionality
Packit Service c5cf8c
dnl has been setup.  No fragment should do anything except define
Packit Service c5cf8c
dnl PAC_SUBCFG_{PREREQ,BODY} macros which will be expanded later as
Packit Service c5cf8c
dnl appropriate
Packit Service c5cf8c
# begin subsys includes
Packit Service c5cf8c
m4_include([subsys_include.m4])
Packit Service c5cf8c
# end subsys includes
Packit Service c5cf8c
Packit Service c5cf8c
dnl ----------------------------------------------------------------------------
Packit Service c5cf8c
dnl setup top-level argument handling
Packit Service c5cf8c
AC_ARG_ENABLE(echo, 
Packit Service c5cf8c
	AC_HELP_STRING([--enable-echo], [Turn on strong echoing. The default is enable=no.]),
Packit Service c5cf8c
	set -x)
Packit Service c5cf8c
Packit Service c5cf8c
AC_ARG_ENABLE(error-checking,
Packit Service c5cf8c
[  --enable-error-checking=level
Packit Service c5cf8c
      Control the amount of error checking.  
Packit Service c5cf8c
        no        - no error checking
Packit Service c5cf8c
        runtime   - error checking controllable at runtime through environment 
Packit Service c5cf8c
                    variables
Packit Service c5cf8c
        all       - error checking always enabled (default)
Packit Service c5cf8c
],,enable_error_checking=all)
Packit Service c5cf8c
Packit Service c5cf8c
AC_ARG_ENABLE(error-messages,
Packit Service c5cf8c
[  --enable-error-messages=level - Control the amount of detail in error messages.
Packit Service c5cf8c
        all       - Maximum amount of information
Packit Service c5cf8c
        generic   - Only generic messages (no information about the specific
Packit Service c5cf8c
                    instance)
Packit Service c5cf8c
        class     - One message per MPI error class
Packit Service c5cf8c
        none      - No messages
Packit Service c5cf8c
],,enable_error_messages=all)
Packit Service c5cf8c
Packit Service c5cf8c
AC_ARG_ENABLE(tag-error-bits,
Packit Service c5cf8c
[  --enable-tag-error-bits=yes|no - Control whether bits are taken from the user tag for error handling.
Packit Service c5cf8c
        yes       - Two bits are taken from the user tag to support error propagation.
Packit Service c5cf8c
        no        - No bits are taken from the user tag (this could cause deadlock if an error is detected during a collective).
Packit Service c5cf8c
],,enable_tag_error_bits=yes)
Packit Service c5cf8c
Packit Service c5cf8c
AC_ARG_ENABLE(timing,
Packit Service c5cf8c
[  --enable-timing=level - Control the amount of timing information
Packit Service c5cf8c
                           collected by the MPICH implementation.
Packit Service c5cf8c
        none    - Collect no data (default)
Packit Service c5cf8c
        all     - Collect lots of data
Packit Service c5cf8c
        runtime - Runtime control of data collected
Packit Service c5cf8c
],,enable_timing=default)
Packit Service c5cf8c
Packit Service c5cf8c
AC_ARG_ENABLE(g,
Packit Service c5cf8c
[  --enable-g=option - Control the level of debugging support in the
Packit Service c5cf8c
                       MPICH implementation.  "option" is a list of comma
Packit Service c5cf8c
                       separated names including.  Default is "most".
Packit Service c5cf8c
        none     - No debugging
Packit Service c5cf8c
        handle   - Trace handle operations
Packit Service c5cf8c
        handlealloc - Trace handle allocations
Packit Service c5cf8c
        dbg      - Add compiler flag, -g, to all internal
Packit Service c5cf8c
                   compiler flags, i.e. MPICHLIB_CFLAGS, MPICHLIB_CXXFLAGS,
Packit Service c5cf8c
                   MPICHLIB_FFLAGS, and MPICHLIB_FCFLAGS.
Packit Service c5cf8c
        debug    - Synonym for dbg
Packit Service c5cf8c
        mem      - Memory usage tracing
Packit Service c5cf8c
        meminit  - Preinitialize memory associated structures and unions to
Packit Service c5cf8c
                   eliminate access warnings from programs like valgrind
Packit Service c5cf8c
        memarena - Check for overwrite errors in memory allocation arena
Packit Service c5cf8c
        mutex    - Enable error checking on pthread mutexes
Packit Service c5cf8c
        mutexnesting - Check for non-nesting of mutexes
Packit Service c5cf8c
        most     - Most of the above options, excluding some with severe
Packit Service c5cf8c
                   performance impacts.  Recommended for typical development.
Packit Service c5cf8c
        yes      - synonym for "most" (*not* "all")
Packit Service c5cf8c
        all      - All of the above choices
Packit Service c5cf8c
],,enable_g=none)
Packit Service c5cf8c
Packit Service c5cf8c
AC_ARG_ENABLE([mpit-pvars],
Packit Service c5cf8c
[  --enable-mpit-pvars=list - Selectively enable MPI_T performance variables in
Packit Service c5cf8c
                      modules. list is a comma-separated module names,
Packit Service c5cf8c
                      including (Default is "none"):
Packit Service c5cf8c
        none     - No performance info recorded
Packit Service c5cf8c
        recvq    - All message queue-related
Packit Service c5cf8c
        nem      - All nemesis-related
Packit Service c5cf8c
        rma      - All rma-related
Packit Service c5cf8c
        all      - All variables above
Packit Service c5cf8c
],[],[enable_mpit_pvars=none])
Packit Service c5cf8c
Packit Service c5cf8c
dnl We may want to force MPI_Aint to be the same size as MPI_Offset, 
Packit Service c5cf8c
dnl particularly on 32 bit systems with large (64 bit) file systems.
Packit Service c5cf8c
AC_ARG_WITH(aint-size,
Packit Service c5cf8c
	AC_HELP_STRING([--with-aint-size], [Override the size of MPI_AINT (in bytes)]),,
Packit Service c5cf8c
	with_aint_size=0)
Packit Service c5cf8c
Packit Service c5cf8c
AC_ARG_ENABLE(fast,
Packit Service c5cf8c
[  --enable-fast=option - Control the level of fast execution in the
Packit Service c5cf8c
                         MPICH implementation.  option is a list of
Packit Service c5cf8c
                         comma separated names including
Packit Service c5cf8c
        O<n>     - Appends default optimization flags, -O<n>, to all internal
Packit Service c5cf8c
                   compiler flags, i.e. MPICHLIB_CFLAGS, MPICHLIB_CXXFLAGS,
Packit Service c5cf8c
                   MPICHLIB_FFLAGS, and MPICHLIB_FCFLAGS. (default is -O2)
Packit Service c5cf8c
        ndebug   - Appends -DNDEBUG to MPICHLIB_CFLAGS.
Packit Service c5cf8c
        all|yes  - "O2" and "ndebug" are enabled
Packit Service c5cf8c
        none     - None of above options, i.e. --disable-fast
Packit Service c5cf8c
],,enable_fast=O2)
Packit Service c5cf8c
Packit Service c5cf8c
AC_ARG_ENABLE(interlib-deps,
Packit Service c5cf8c
	[AC_HELP_STRING([--enable-interlib-deps - Enable interlibrary dependencies])],,enable_interlib_deps=yes)
Packit Service c5cf8c
Packit Service c5cf8c
AC_ARG_ENABLE(check-compiler-flags,
Packit Service c5cf8c
	AC_HELP_STRING([--enable-check-compiler-flags], [enable the checks for all compiler
Packit Service c5cf8c
                       options, xxxFLAGS, MPICH_xxxFLAGS. Default is on.]),,
Packit Service c5cf8c
		       enable_check_compiler_flags=yes)
Packit Service c5cf8c
Packit Service c5cf8c
dnl We enable f77 and fc if we can find compilers for them.
Packit Service c5cf8c
dnl In addition, we check whether f77 and fc can work together.
Packit Service c5cf8c
AC_ARG_ENABLE(fortran,
Packit Service c5cf8c
[  --enable-fortran=option - Control the level of Fortran support in the MPICH implementation.
Packit Service c5cf8c
	yes|all   - Enable all available Fortran implementations (F77, F90+)
Packit Service c5cf8c
	f77       - Enable Fortran 77 support
Packit Service c5cf8c
	fc        - Enable Fortran 90 and 2008 support
Packit Service c5cf8c
	no|none   - No Fortran support
Packit Service c5cf8c
],,[enable_fortran=all])
Packit Service c5cf8c
Packit Service c5cf8c
AC_ARG_ENABLE(f77,
Packit Service c5cf8c
	AC_HELP_STRING([--enable-f77],
Packit Service c5cf8c
		[DEPRECATED: Use --enable-fortran or --disable-fortran instead]),,[enable_f77=yes])
Packit Service c5cf8c
Packit Service c5cf8c
AC_ARG_ENABLE(fc,
Packit Service c5cf8c
	AC_HELP_STRING([--enable-fc],
Packit Service c5cf8c
		[DEPRECATED: Use --enable-fortran or --disable-fortran instead]),,[enable_fc=yes])
Packit Service c5cf8c
Packit Service c5cf8c
AC_ARG_ENABLE(cxx,
Packit Service c5cf8c
	AC_HELP_STRING([--enable-cxx], [Enable C++ bindings]),,enable_cxx=yes)
Packit Service c5cf8c
Packit Service c5cf8c
AC_ARG_ENABLE(romio,
Packit Service c5cf8c
	AC_HELP_STRING([--enable-romio], [Enable ROMIO MPI I/O implementation]),,
Packit Service c5cf8c
	enable_romio=yes)
Packit Service c5cf8c
Packit Service c5cf8c
AC_ARG_ENABLE(debuginfo,
Packit Service c5cf8c
	AC_HELP_STRING([--enable-debuginfo], [Enable support for debuggers]),,
Packit Service c5cf8c
	enable_debuginfo=no)
Packit Service c5cf8c
Packit Service c5cf8c
Packit Service c5cf8c
## Enable creation of libtool-style versioning or no versioning
Packit Service c5cf8c
AC_ARG_ENABLE(versioning,
Packit Service c5cf8c
        [AC_HELP_STRING([--enable-versioning],[Enable library versioning])],,
Packit Service c5cf8c
        [enable_versioning=yes])
Packit Service c5cf8c
Packit Service c5cf8c
if test "$enable_versioning" = "yes" ; then
Packit Service c5cf8c
   ABIVERSIONFLAGS="-version-info \$(ABIVERSION)"
Packit Service c5cf8c
else
Packit Service c5cf8c
   ABIVERSIONFLAGS="-avoid-version"
Packit Service c5cf8c
fi
Packit Service c5cf8c
export ABIVERSIONFLAGS
Packit Service c5cf8c
AC_SUBST(ABIVERSIONFLAGS)
Packit Service c5cf8c
Packit Service c5cf8c
Packit Service c5cf8c
dnl The environment variable MPICH_DEBUGLIBNAME may be used to
Packit Service c5cf8c
dnl override the default name of the library that the debugger will
Packit Service c5cf8c
dnl load to access the MPICH internal data structures.
Packit Service c5cf8c
Packit Service c5cf8c
dnl "default" is a special device that allows MPICH to choose one
Packit Service c5cf8c
dnl based on the environment.
Packit Service c5cf8c
AC_ARG_WITH(device,
Packit Service c5cf8c
	AC_HELP_STRING([--with-device=name], [Specify the communication device for MPICH]),,
Packit Service c5cf8c
	with_device=default)
Packit Service c5cf8c
Packit Service c5cf8c
AC_ARG_WITH(pmi,
Packit Service c5cf8c
	AC_HELP_STRING([--with-pmi=name], [Specify the pmi interface for MPICH]),,
Packit Service c5cf8c
	with_pmi=default)
Packit Service c5cf8c
Packit Service c5cf8c
AC_ARG_WITH(pm, 
Packit Service c5cf8c
	AC_HELP_STRING([--with-pm=name],
Packit Service c5cf8c
		[Specify the process manager for MPICH.  "no" or "none" are
Packit Service c5cf8c
                 valid values.  Multiple process managers may be specified as
Packit Service c5cf8c
                 long as they all use the same pmi interface by separating them
Packit Service c5cf8c
                 with colons.  The mpiexec for the first named process manager
Packit Service c5cf8c
                 will be installed.  Example: "--with-pm=hydra:gforker"
Packit Service c5cf8c
                 builds the two process managers hydra, and gforker;
Packit Service c5cf8c
                 only the mpiexec from hydra is installed into the bin
Packit Service c5cf8c
                 directory.]),,with_pm=default)
Packit Service c5cf8c
Packit Service c5cf8c
AC_ARG_WITH(logging,
Packit Service c5cf8c
	AC_HELP_STRING([--with-logging=name], [Specify the logging library for MPICH]),
Packit Service c5cf8c
	[if test -z "$withval" ; then with_logging=rlog ; fi],with_logging=none)
Packit Service c5cf8c
Packit Service c5cf8c
AC_ARG_ENABLE(threads,
Packit Service c5cf8c
[  --enable-threads=level - Control the level of thread support in the 
Packit Service c5cf8c
                           MPICH implementation.  The following levels
Packit Service c5cf8c
                           are supported.
Packit Service c5cf8c
        single          - No threads (MPI_THREAD_SINGLE)
Packit Service c5cf8c
        funneled        - Only the main thread calls MPI (MPI_THREAD_FUNNELED)
Packit Service c5cf8c
        serialized      - User serializes calls to MPI (MPI_THREAD_SERIALIZED)
Packit Service c5cf8c
        multiple        - Fully multi-threaded (MPI_THREAD_MULTIPLE)
Packit Service c5cf8c
        runtime         - Alias to "multiple"
Packit Service c5cf8c
Packit Service c5cf8c
        See also the --enable-thread-cs option for controlling the granularity of
Packit Service c5cf8c
        the concurrency inside of the library
Packit Service c5cf8c
],,enable_threads=default)
Packit Service c5cf8c
Packit Service c5cf8c
AC_ARG_ENABLE(thread-cs,
Packit Service c5cf8c
	AC_HELP_STRING([--enable-thread-cs=type],
Packit Service c5cf8c
			[Choose the method used for critical sections
Packit Service c5cf8c
                         and other atomic updates when multiple
Packit Service c5cf8c
                         threads are present.  Values may be global
Packit Service c5cf8c
                         (default), per-object, per-vni, lock-free]),,enable_thread_cs=global)
Packit Service c5cf8c
Packit Service c5cf8c
AC_ARG_ENABLE(mdta,
Packit Service c5cf8c
    AC_HELP_STRING([--enable-mdta],
Packit Service c5cf8c
            [Optimize global granularity using message-driven thread activation.
Packit Service c5cf8c
                         Only available for ch4 device with --enable-thread-cs=global]),
Packit Service c5cf8c
    AC_DEFINE(MPICH_THREAD_USE_MDTA,1,[Define to enable message-driven thread activation]))
Packit Service c5cf8c
Packit Service c5cf8c
AC_ARG_ENABLE(refcount,
Packit Service c5cf8c
	AC_HELP_STRING([--enable-refcount=type],
Packit Service c5cf8c
			[Choose the method for ensuring atomic updates
Packit Service c5cf8c
                         to the reference counts for MPI objects.
Packit Service c5cf8c
                         Values may be lock-free or none.  The
Packit Service c5cf8c
                         default depends on the thread-cs choice; for
Packit Service c5cf8c
                         global it is none (because none is required),
Packit Service c5cf8c
                         for per-object, per-vni, and lock-free, lock-free]),,
Packit Service c5cf8c
                         enable_refcount=default)
Packit Service c5cf8c
Packit Service c5cf8c
AC_ARG_ENABLE(mutex-timing,
Packit Service c5cf8c
	AC_HELP_STRING([--enable-mutex-timing], [calculate the time spent waiting on mutexes]),
Packit Service c5cf8c
	AC_DEFINE(MPIU_MUTEX_WAIT_TIME,1,[Define to enable timing mutexes]))
Packit Service c5cf8c
Packit Service c5cf8c
AC_ARG_ENABLE([predefined-refcount],
Packit Service c5cf8c
	AS_HELP_STRING([--enable-predefined-refcount],
Packit Service c5cf8c
                       [control whether predefined objects like
Packit Service c5cf8c
		       MPI_COMM_WORLD are reference counted (default
Packit Service c5cf8c
		       depends on --enable-thread-cs choice)]),[],
Packit Service c5cf8c
              [enable_predefined_refcount=default])
Packit Service c5cf8c
Packit Service c5cf8c
AC_ARG_ENABLE(weak-symbols,
Packit Service c5cf8c
	AC_HELP_STRING([--enable-weak-symbols],
Packit Service c5cf8c
			[Use weak symbols to implement PMPI routines (default)]),,
Packit Service c5cf8c
		enable_weak_symbols=yes)
Packit Service c5cf8c
Packit Service c5cf8c
AC_ARG_ENABLE([two-level-namespace],
Packit Service c5cf8c
              [AS_HELP_STRING([--enable-two-level-namespace],
Packit Service c5cf8c
                              [(Darwin only) Build shared libraries and programs
Packit Service c5cf8c
                               built with the mpicc/mpifort/etc. compiler
Packit Service c5cf8c
                               wrappers with '-Wl,-commons,use_dylibs' and
Packit Service c5cf8c
                               without '-Wl,-flat_namespace'.  This may make the
Packit Service c5cf8c
                               MPICH installation and MPI programs more
Packit Service c5cf8c
                               compatible with other libraries.  Only enable
Packit Service c5cf8c
                               this option if you really know what these linker
Packit Service c5cf8c
                               options imply.])],
Packit Service c5cf8c
              [],
Packit Service c5cf8c
              [enable_two_level_namespace=no])
Packit Service c5cf8c
Packit Service c5cf8c
AC_ARG_ENABLE(multi-aliases,
Packit Service c5cf8c
	AC_HELP_STRING([--enable-multi-aliases],
Packit Service c5cf8c
		[Multiple aliasing to support multiple fortran compilers (default)]),,
Packit Service c5cf8c
		enable_multi_aliases=yes)
Packit Service c5cf8c
Packit Service c5cf8c
AC_ARG_ENABLE([wrapper-rpath],
Packit Service c5cf8c
              [AC_HELP_STRING([--enable-wrapper-rpath],
Packit Service c5cf8c
                              [Determine whether the rpath is set when programs
Packit Service c5cf8c
                               are linked by mpicc compiler wrappers.  This only
Packit Service c5cf8c
                               applies when shared libraries are built.  The
Packit Service c5cf8c
                               default is yes; use --disable-wrapper-rpath to
Packit Service c5cf8c
                               turn this feature off.  In that case, shared
Packit Service c5cf8c
                               libraries will be found according to the rules
Packit Service c5cf8c
                               for your system (e.g., in LD_LIBRARY_PATH)])],
Packit Service c5cf8c
              [],[enable_wrapper_rpath=yes])
Packit Service c5cf8c
AC_SUBST([enable_wrapper_rpath])
Packit Service c5cf8c
Packit Service c5cf8c
AC_ARG_ENABLE([long-double],
Packit Service c5cf8c
              [AC_HELP_STRING([--disable-long-double],
Packit Service c5cf8c
                              [Pass --disable-long-double to prevent the MPI
Packit Service c5cf8c
                               library from supporting the C "long double" type,
Packit Service c5cf8c
                               even if the C compiler supports it.  "long
Packit Service c5cf8c
                               double" support is enabled by default, provided
Packit Service c5cf8c
                               the compiler supports it.])],
Packit Service c5cf8c
              [],
Packit Service c5cf8c
              [enable_long_double=yes])
Packit Service c5cf8c
Packit Service c5cf8c
AC_ARG_WITH(cross,
Packit Service c5cf8c
	AC_HELP_STRING([--with-cross=file],
Packit Service c5cf8c
		[Specify the values of variables that configure cannot
Packit Service c5cf8c
                 determine in a cross-compilation environment]),,
Packit Service c5cf8c
		 with_cross=$MPID_DEFAULT_CROSS_FILE)
Packit Service c5cf8c
Packit Service c5cf8c
AC_ARG_WITH(namepublisher,
Packit Service c5cf8c
[  --with-namepublisher=name   Choose the system that will support 
Packit Service c5cf8c
                              MPI_PUBLISH_NAME and MPI_LOOKUP_NAME.  Options
Packit Service c5cf8c
                              include
Packit Service c5cf8c
                                   pmi (default)
Packit Service c5cf8c
			           file[:directory] (optional directory)
Packit Service c5cf8c
                                   no (no service available)],,with_namepublisher=default)
Packit Service c5cf8c
AC_ARG_WITH(name-publisher,
Packit Service c5cf8c
    [],
Packit Service c5cf8c
    with_namepublisher=$with_name_publisher,)
Packit Service c5cf8c
Packit Service c5cf8c
AC_ARG_ENABLE(dbg-nolocal, AC_HELP_STRING([--enable-dbg-nolocal], [enables debugging mode where shared-memory communication is disabled]),
Packit Service c5cf8c
    AC_DEFINE(ENABLED_NO_LOCAL, 1, [Define to disable shared-memory communication for debugging]))
Packit Service c5cf8c
Packit Service c5cf8c
AC_ARG_ENABLE(dbg-localoddeven, AC_HELP_STRING([--enable-dbg-localoddeven], [enables debugging mode where shared-memory communication is enabled only between even processes or odd processes on a node]),
Packit Service c5cf8c
    AC_DEFINE(ENABLED_ODD_EVEN_CLIQUES, 1, [Define to enable debugging mode where shared-memory communication is done only between even procs or odd procs]))
Packit Service c5cf8c
Packit Service c5cf8c
AC_CANONICAL_TARGET
Packit Service c5cf8c
Packit Service c5cf8c
# Find a C compiler.
Packit Service c5cf8c
# We also need to do this before the F77 and FC test to ensure that we
Packit Service c5cf8c
# find the C preprocessor reliably.
Packit Service c5cf8c
PAC_PROG_CC
Packit Service c5cf8c
AM_PROG_CC_C_O dnl needed for automake "silent-rules"
Packit Service c5cf8c
PAC_PUSH_FLAG([CFLAGS])
Packit Service c5cf8c
AC_PROG_CPP
Packit Service c5cf8c
# Bug in autoconf.  Restore cross settings
Packit Service c5cf8c
if test "$pac_cross_compiling" = "yes" -a "$ac_cv_prog_cc_cross" = "no" ; then
Packit Service c5cf8c
    AC_MSG_RESULT([Resetting cross compilation to yes])
Packit Service c5cf8c
    cross_compiling=yes
Packit Service c5cf8c
    ac_cv_prog_cc_cross=yes
Packit Service c5cf8c
    ac_cv_prog_f77_cross=yes
Packit Service c5cf8c
    ac_cv_prog_fc_cross=yes
Packit Service c5cf8c
    ac_cv_prog_cxx_cross=yes
Packit Service c5cf8c
fi
Packit Service c5cf8c
PAC_POP_FLAG([CFLAGS])
Packit Service c5cf8c
Packit Service c5cf8c
# also needed by hwloc in embedded mode, must also come early for expansion
Packit Service c5cf8c
# ordering reasons
Packit Service c5cf8c
AC_USE_SYSTEM_EXTENSIONS
Packit Service c5cf8c
Packit Service c5cf8c
dnl now that autoconf and core compilers are setup, init automake and libtool
Packit Service c5cf8c
dnl
Packit Service c5cf8c
dnl We would like to pass -Werror, but we are cheating in the "examples/"
Packit Service c5cf8c
dnl directory and overriding the user-flags like CFLAGS, which automake-1.12
Packit Service c5cf8c
dnl warns about.  Long-term we may need to use a hand-written Makefile.in or
Packit Service c5cf8c
dnl something else in this special dir.
Packit Service c5cf8c
AM_INIT_AUTOMAKE([-Wall -Wno-portability-recursive foreign 1.12.3 silent-rules subdir-objects])
Packit Service c5cf8c
AM_MAINTAINER_MODE([enable])
Packit Service c5cf8c
Packit Service c5cf8c
AM_PROG_AR
Packit Service c5cf8c
Packit Service c5cf8c
LT_INIT()
Packit Service c5cf8c
# Non-verbose make by default
Packit Service c5cf8c
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
Packit Service c5cf8c
Packit Service c5cf8c
# Disable rpath in the compiler wrappers if shared libraries are disabled, since
Packit Service c5cf8c
# rpath makes no sense in the context of static libraries.
Packit Service c5cf8c
if test "X$enable_shared" = "Xno" ; then
Packit Service c5cf8c
    enable_wrapper_rpath=no
Packit Service c5cf8c
fi
Packit Service c5cf8c
Packit Service c5cf8c
INTERLIB_DEPS=yes
Packit Service c5cf8c
# We conservatively disable interlibrary dependencies if the libtool
Packit Service c5cf8c
# support model is anything different from "pass_all"
Packit Service c5cf8c
if test "X$enable_shared" = "Xno" -o "$deplibs_check_method" != "pass_all" -o "$enable_interlib_deps" = "no" ; then
Packit Service c5cf8c
    INTERLIB_DEPS=no
Packit Service c5cf8c
fi
Packit Service c5cf8c
export INTERLIB_DEPS
Packit Service c5cf8c
AC_SUBST(INTERLIB_DEPS)
Packit Service c5cf8c
Packit Service c5cf8c
dnl AC_PROG_{CXX,F77,FC} must come early in configure.ac in order to avoid some
Packit Service c5cf8c
dnl esoteric autoconf macro expansion errors
Packit Service c5cf8c
dnl
Packit Service c5cf8c
dnl Also, DO NOT attempt to place shell conditionals (either manually or via
Packit Service c5cf8c
dnl AS_IF) around these macros in an effort to save configure time.  It will
Packit Service c5cf8c
dnl lead to weird AM_CONDITIONAL errors and potentially other problems.
Packit Service c5cf8c
Packit Service c5cf8c
# Before attempting to find valid compilers, set the corresponding precious
Packit Service c5cf8c
# shell variable to "no" for any languages that have been disabled by the user
Packit Service c5cf8c
# with "--disable-LANG".  Libtool understands this as a request to disable
Packit Service c5cf8c
# support for this language. This should save a bit of configure time and also
Packit Service c5cf8c
# prevent user complaints like ticket #1570.
Packit Service c5cf8c
AS_IF([test "x$enable_f77" = "xno"],[F77=no])
Packit Service c5cf8c
AS_IF([test "x$enable_fc"  = "xno"],[FC=no])
Packit Service c5cf8c
AS_IF([test "x$enable_cxx" = "xno"],[CXX=no])
Packit Service c5cf8c
Packit Service c5cf8c
# suppress default "-g -O2" from AC_PROG_CXX
Packit Service c5cf8c
: ${CXXFLAGS=""}
Packit Service c5cf8c
AC_PROG_CXX([PAC_CXX_SEARCH_LIST])
Packit Service c5cf8c
Packit Service c5cf8c
# suppress default "-g -O2" from AC_PROG_FC
Packit Service c5cf8c
: ${FCFLAGS=""}
Packit Service c5cf8c
AC_PROG_FC([PAC_FC_SEARCH_LIST])
Packit Service c5cf8c
Packit Service c5cf8c
save_IFS="$IFS"
Packit Service c5cf8c
IFS=","
Packit Service c5cf8c
enable_f77=no
Packit Service c5cf8c
enable_fc=no
Packit Service c5cf8c
for option in $enable_fortran ; do
Packit Service c5cf8c
    case "$option" in
Packit Service c5cf8c
        yes|all)
Packit Service c5cf8c
		enable_f77=yes
Packit Service c5cf8c
		enable_fc=yes
Packit Service c5cf8c
		;;
Packit Service c5cf8c
        no|none)
Packit Service c5cf8c
		;;
Packit Service c5cf8c
        f77)
Packit Service c5cf8c
		enable_f77=yes
Packit Service c5cf8c
		;;
Packit Service c5cf8c
        fc)
Packit Service c5cf8c
		enable_fc=yes
Packit Service c5cf8c
		;;
Packit Service c5cf8c
        *)
Packit Service c5cf8c
		IFS="$save_IFS"
Packit Service c5cf8c
		AC_MSG_WARN([Unknown value $option for --enable-fortran])
Packit Service c5cf8c
		IFS=","
Packit Service c5cf8c
		;;
Packit Service c5cf8c
    esac
Packit Service c5cf8c
done
Packit Service c5cf8c
IFS="$save_IFS"
Packit Service c5cf8c
Packit Service c5cf8c
if test "$enable_f77" = "no" ; then
Packit Service c5cf8c
   if test "$enable_fc" = "yes" ; then
Packit Service c5cf8c
      AC_MSG_ERROR([Fortran 90 support requires enabling Fortran 77])
Packit Service c5cf8c
   fi
Packit Service c5cf8c
fi
Packit Service c5cf8c
Packit Service c5cf8c
if test ! -z "$FC" -a -z "$F77" ; then
Packit Service c5cf8c
   F77=$FC
Packit Service c5cf8c
   if test ! -z "$FCFLAGS" -a -z "$FFLAGS" ; then
Packit Service c5cf8c
      FFLAGS=$FCFLAGS
Packit Service c5cf8c
   fi
Packit Service c5cf8c
fi
Packit Service c5cf8c
Packit Service c5cf8c
AM_CONDITIONAL([INSTALL_MPIF77],[test "$F77" != "$FC" -a "$FFLAGS" != "$FCFLAGS"])
Packit Service c5cf8c
Packit Service c5cf8c
# This needs to come after we've potentially set F77=$FC. Otherwise, we could
Packit Service c5cf8c
# override the user's Fortran compiler selection when only specifying FC at configure
Packit Service c5cf8c
# time, as is allowed.
Packit Service c5cf8c
# suppress default "-g -O2" from AC_PROG_F77
Packit Service c5cf8c
: ${FFLAGS=""}
Packit Service c5cf8c
AC_PROG_F77([PAC_F77_SEARCH_LIST])
Packit Service c5cf8c
Packit Service c5cf8c
# compute canonical system types
Packit Service c5cf8c
AC_CANONICAL_BUILD
Packit Service c5cf8c
AC_CANONICAL_HOST
Packit Service c5cf8c
# TARGET not needed, MPICH isn't a compiler
Packit Service c5cf8c
Packit Service c5cf8c
# Enable better caching control
Packit Service c5cf8c
PAC_ARG_CACHING
Packit Service c5cf8c
Packit Service c5cf8c
# Set CFLAGS for enable strict if necessary.  Do this *first* because
Packit Service c5cf8c
# it may influence the output of the other tests
Packit Service c5cf8c
PAC_ARG_STRICT
Packit Service c5cf8c
Packit Service c5cf8c
# -----------------------------------------------------------------------------
Packit Service c5cf8c
# First check that we have a clean build if we are doing a VPATH build
Packit Service c5cf8c
PAC_VPATH_CHECK(src/include/mpi.h src/env/mpicc,lib)
Packit Service c5cf8c
Packit Service c5cf8c
# ----------------------------------------------------------------------------
Packit Service c5cf8c
# This test is complicated by the fact that top_srcdir is not set until
Packit Service c5cf8c
# the very end of configure.  Instead, we get it ourselves
Packit Service c5cf8c
if test -z "$top_srcdir" ; then
Packit Service c5cf8c
   use_top_srcdir=$srcdir   
Packit Service c5cf8c
else
Packit Service c5cf8c
   use_top_srcdir=$top_srcdir
Packit Service c5cf8c
fi
Packit Service c5cf8c
if test -z "$master_top_srcdir" ; then 
Packit Service c5cf8c
    # This needs to be an absolute pathname
Packit Service c5cf8c
    case "$use_top_srcdir" in
Packit Service c5cf8c
    /*) ;;
Packit Service c5cf8c
    *)
Packit Service c5cf8c
        use_top_srcdir=`(cd $use_top_srcdir && pwd)`
Packit Service c5cf8c
	;;	
Packit Service c5cf8c
    esac
Packit Service c5cf8c
    master_top_srcdir=$use_top_srcdir
Packit Service c5cf8c
fi
Packit Service c5cf8c
# Get the directory that we're running in...
Packit Service c5cf8c
if test -z "$master_top_builddir" ; then
Packit Service c5cf8c
   master_top_builddir="`pwd`"
Packit Service c5cf8c
fi
Packit Service c5cf8c
AC_SUBST(master_top_builddir)
Packit Service c5cf8c
AC_SUBST(master_top_srcdir)
Packit Service c5cf8c
export master_top_builddir
Packit Service c5cf8c
export master_top_srcdir
Packit Service c5cf8c
Packit Service c5cf8c
if test -z "$with_cross"; then
Packit Service c5cf8c
  if test -f "$master_top_srcdir/src/cross/$host_alias"; then
Packit Service c5cf8c
    with_cross="$master_top_srcdir/src/cross/$host_alias"
Packit Service c5cf8c
  else
Packit Service c5cf8c
    with_cross=no
Packit Service c5cf8c
  fi
Packit Service c5cf8c
fi
Packit Service c5cf8c
if test "$with_cross" != "no"; then
Packit Service c5cf8c
  AC_MSG_NOTICE([Using cross file: $with_cross])
Packit Service c5cf8c
fi
Packit Service c5cf8c
Packit Service c5cf8c
# ----------------------------------------------------------------------------
Packit Service c5cf8c
dnl Export important "precious" variables so that any directories configured via
Packit Service c5cf8c
dnl PAC_CONFIG_SUBDIR will agree with the top-level configure about these
Packit Service c5cf8c
dnl critical variables (esp. compiler selection).  These exports should come
Packit Service c5cf8c
dnl before any subconfigures in this script.
Packit Service c5cf8c
dnl
Packit Service c5cf8c
dnl This list is arguably incomplete, and should possibly be automatically
Packit Service c5cf8c
dnl generated from "$ac_precious_vars" using code similar to the implementation
Packit Service c5cf8c
dnl of PAC_CONFIG_SUBDIR.
Packit Service c5cf8c
dnl
Packit Service c5cf8c
dnl To be clear, without these exports any variable values determined by this
Packit Service c5cf8c
dnl configure script will not be seen by child scripts.  Instead they will dnl
Packit Service c5cf8c
dnl receive the only the original inherited environment and configure args used
Packit Service c5cf8c
dnl when this configure script was invoked.
Packit Service c5cf8c
export AR
Packit Service c5cf8c
export AR_FLAGS
Packit Service c5cf8c
export CC
Packit Service c5cf8c
export CFLAGS
Packit Service c5cf8c
export CPPFLAGS
Packit Service c5cf8c
export CXX
Packit Service c5cf8c
export CXXFLAGS
Packit Service c5cf8c
export F77
Packit Service c5cf8c
export FC
Packit Service c5cf8c
export FCFLAGS
Packit Service c5cf8c
export FFLAGS
Packit Service c5cf8c
export LDFLAGS
Packit Service c5cf8c
export LIBS
Packit Service c5cf8c
export MPILIBNAME
Packit Service c5cf8c
export PMPILIBNAME
Packit Service c5cf8c
export RANLIB
Packit Service c5cf8c
export OPALIBNAME
Packit Service c5cf8c
export MPLLIBNAME
Packit Service c5cf8c
# ----------------------------------------------------------------------------
Packit Service c5cf8c
# with-device
Packit Service c5cf8c
if test "$with_device" = "default" ; then
Packit Service c5cf8c
    # Pick the device.  For now, always choose ch3
Packit Service c5cf8c
    with_device=ch3
Packit Service c5cf8c
fi
Packit Service c5cf8c
# Extract the device name from any options
Packit Service c5cf8c
# Allow the device to specify a directory; if no directory, use the
Packit Service c5cf8c
# included directories
Packit Service c5cf8c
# 
Packit Service c5cf8c
DEVICE=$with_device
Packit Service c5cf8c
AC_SUBST(DEVICE)
Packit Service c5cf8c
Packit Service c5cf8c
device_name=`echo $with_device | sed -e 's/:.*$//'`
Packit Service c5cf8c
changequote(<<,>>)
Packit Service c5cf8c
device_args=`echo $with_device | sed -e 's/^[^:]*//' -e 's/^://'`
Packit Service c5cf8c
changequote([,])
Packit Service c5cf8c
Packit Service c5cf8c
devicedir=$use_top_srcdir/src/mpid/$device_name
Packit Service c5cf8c
devicereldir=src/mpid/$device_name
Packit Service c5cf8c
case "$device_name" in
Packit Service c5cf8c
     /*) 
Packit Service c5cf8c
     devicedir=$DEVICE
Packit Service c5cf8c
     # Get the name from the leaf
Packit Service c5cf8c
     device_name=`echo $device_name ~ sed -e 's%.*/%%'`
Packit Service c5cf8c
     # FIXME: should the devicereldir be different (perhaps not -
Packit Service c5cf8c
     # this allows use to build within our tree, even when other data
Packit Service c5cf8c
     # is outside of the tree)
Packit Service c5cf8c
     ;;
Packit Service c5cf8c
     *) 
Packit Service c5cf8c
     ;;
Packit Service c5cf8c
esac
Packit Service c5cf8c
export device_name
Packit Service c5cf8c
export device_args
Packit Service c5cf8c
export devicedir
Packit Service c5cf8c
Packit Service c5cf8c
# See if the device wants to say something about the compilers
Packit Service c5cf8c
if test -f $devicedir/mpichprereq ; then
Packit Service c5cf8c
    . $devicedir/mpichprereq
Packit Service c5cf8c
fi
Packit Service c5cf8c
Packit Service c5cf8c
# expand all of the prereq macros in the correct order
Packit Service c5cf8c
m4_map([PAC_SUBCFG_DO_PREREQ], [PAC_SUBCFG_MODULE_LIST])
Packit Service c5cf8c
Packit Service c5cf8c
# ----------------------------------------------------------------------------
Packit Service c5cf8c
# Set default library names if names haven't already been provided
Packit Service c5cf8c
AC_ARG_VAR([MPILIBNAME],[can be used to override the name of the MPI library (default: "mpi")])
Packit Service c5cf8c
AC_ARG_VAR([PMPILIBNAME],[can be used to override the name of the MPI profiling library (default: "p$MPILIBNAME")])
Packit Service c5cf8c
AC_ARG_VAR([MPICXXLIBNAME],[can be used to override the name of the MPI C++ library (default: "${MPILIBNAME}cxx")])
Packit Service c5cf8c
AC_ARG_VAR([MPIFCLIBNAME],[can be used to override the name of the MPI fortran library (default: "${MPILIBNAME}fort")])
Packit Service c5cf8c
MPILIBNAME=${MPILIBNAME:-"mpi"}
Packit Service c5cf8c
PMPILIBNAME_set=no
Packit Service c5cf8c
if test -n "$PMPILIBNAME" ; then 
Packit Service c5cf8c
   PMPILIBNAME_set=yes
Packit Service c5cf8c
fi
Packit Service c5cf8c
PMPILIBNAME=${PMPILIBNAME:-"p$MPILIBNAME"}
Packit Service c5cf8c
# Note that the name for this library may be updated after we check for 
Packit Service c5cf8c
# enable_shmem
Packit Service c5cf8c
# Fortran names are set later.
Packit Service c5cf8c
# We use a different library for the C++ wrappers to avoid problems when
Packit Service c5cf8c
# creating shared libraries
Packit Service c5cf8c
if test -z "$MPICXXLIBNAME" ; then MPICXXLIBNAME="${MPILIBNAME}cxx" ; fi
Packit Service c5cf8c
if test -z "$MPIFCLIBNAME" ; then MPIFCLIBNAME="${MPILIBNAME}fort" ; fi
Packit Service c5cf8c
export MPICXXLIBNAME
Packit Service c5cf8c
export MPIFCLIBNAME
Packit Service c5cf8c
AC_SUBST(MPICXXLIBNAME)
Packit Service c5cf8c
AC_SUBST(MPIFCLIBNAME)
Packit Service c5cf8c
Packit Service c5cf8c
# We'll set FORTRAN_BINDING to 1 if we support Fortran 
Packit Service c5cf8c
FORTRAN_BINDING=0
Packit Service c5cf8c
Packit Service c5cf8c
# enable-fast
Packit Service c5cf8c
# strip off multiple options, separated by commas
Packit Service c5cf8c
save_IFS="$IFS"
Packit Service c5cf8c
IFS=","
Packit Service c5cf8c
for option in $enable_fast ; do
Packit Service c5cf8c
    case "$option" in
Packit Service c5cf8c
        O*)
Packit Service c5cf8c
        enable_fast_opts=$option
Packit Service c5cf8c
        ;;
Packit Service c5cf8c
        ndebug)
Packit Service c5cf8c
        enable_fast_ndebug=yes
Packit Service c5cf8c
        ;;
Packit Service c5cf8c
        all|yes)
Packit Service c5cf8c
        enable_fast_ndebug=yes
Packit Service c5cf8c
        enable_fast_opts=O2
Packit Service c5cf8c
        ;;
Packit Service c5cf8c
        none|no)
Packit Service c5cf8c
        enable_fast_ndebug=no
Packit Service c5cf8c
        enable_fast_opts=O0
Packit Service c5cf8c
        ;;
Packit Service c5cf8c
        *)
Packit Service c5cf8c
	IFS="$save_IFS"
Packit Service c5cf8c
        AC_MSG_WARN([Unknown value $option for --enable-fast])
Packit Service c5cf8c
	IFS=","
Packit Service c5cf8c
        ;;
Packit Service c5cf8c
    esac
Packit Service c5cf8c
done
Packit Service c5cf8c
IFS="$save_IFS"
Packit Service c5cf8c
Packit Service c5cf8c
if test -n "$enable_fast_opts" ; then
Packit Service c5cf8c
   # Allows O<n> where <n> can be [0-9] or ' '.
Packit Service c5cf8c
   opt_flags=`echo $enable_fast_opts | sed -e 's%\(O[0-9] \)%\1%g'`
Packit Service c5cf8c
   if test -n "$opt_flags" ; then
Packit Service c5cf8c
      MPI_DEFAULT_COPTS="-$enable_fast_opts"
Packit Service c5cf8c
      MPI_DEFAULT_CXXOPTS="-$enable_fast_opts"
Packit Service c5cf8c
      MPI_DEFAULT_FOPTS="-$enable_fast_opts"
Packit Service c5cf8c
      MPI_DEFAULT_FCOPTS="-$enable_fast_opts"
Packit Service c5cf8c
   else
Packit Service c5cf8c
      AC_MSG_WARN([Unknown value $enable_fast_opts for --enable-fast])
Packit Service c5cf8c
   fi
Packit Service c5cf8c
fi
Packit Service c5cf8c
Packit Service c5cf8c
if test "$enable_fast_ndebug" = "yes" ; then
Packit Service c5cf8c
    CFLAGS="$CFLAGS -DNDEBUG -DNVALGRIND"
Packit Service c5cf8c
    CXXFLAGS="$CXXFLAGS -DNDEBUG -DNVALGRIND"
Packit Service c5cf8c
    # MPICH does NOT assume any preprocessing support from the Fortran compiler,
Packit Service c5cf8c
    # so no Fortran files contain any preprocessing statements.
Packit Service c5cf8c
    # Don't set FFLAGS or FCFLAGS with any -D.
Packit Service c5cf8c
fi
Packit Service c5cf8c
Packit Service c5cf8c
# error-checking
Packit Service c5cf8c
# Change default into the specific value of the default
Packit Service c5cf8c
if test "$enable_error_checking" = "yes" ; then
Packit Service c5cf8c
   enable_error_checking=all
Packit Service c5cf8c
fi
Packit Service c5cf8c
# mpir_ext.h needs the variable HAVE_ERROR_CHECKING to have the value 0 or 1
Packit Service c5cf8c
HAVE_ERROR_CHECKING=0
Packit Service c5cf8c
case "$enable_error_checking" in 
Packit Service c5cf8c
    no)
Packit Service c5cf8c
    # if error checking has been disabled, then automatically disable the error
Packit Service c5cf8c
    # checking tests in the test suite
Packit Service c5cf8c
    ac_configure_args="${ac_configure_args} --disable-checkerrors"
Packit Service c5cf8c
    ;;
Packit Service c5cf8c
    all|runtime)
Packit Service c5cf8c
    error_checking_kind=`echo $enable_error_checking | \
Packit Service c5cf8c
    tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
Packit Service c5cf8c
    error_checking_kind=MPID_ERROR_LEVEL_$error_checking_kind
Packit Service c5cf8c
    AC_DEFINE_UNQUOTED(HAVE_ERROR_CHECKING,$error_checking_kind,[Define to enable error checking])
Packit Service c5cf8c
    HAVE_ERROR_CHECKING=1
Packit Service c5cf8c
    ;;
Packit Service c5cf8c
    *)
Packit Service c5cf8c
    AC_MSG_WARN([Unknown value $enable_error_checking for enable-error-checking])
Packit Service c5cf8c
    ;;
Packit Service c5cf8c
esac
Packit Service c5cf8c
# permit @HAVE_ERROR_CHECKING@ substitution in mpir_ext.h
Packit Service c5cf8c
AC_SUBST([HAVE_ERROR_CHECKING])
Packit Service c5cf8c
Packit Service c5cf8c
# error-messages
Packit Service c5cf8c
case "$enable_error_messages" in 
Packit Service c5cf8c
    no|none)
Packit Service c5cf8c
        error_message_kind="MPICH_ERROR_MSG__NONE"
Packit Service c5cf8c
    ;;
Packit Service c5cf8c
    all|yes)
Packit Service c5cf8c
	error_message_kind="MPICH_ERROR_MSG__ALL"
Packit Service c5cf8c
    ;;
Packit Service c5cf8c
    generic)
Packit Service c5cf8c
	error_message_kind="MPICH_ERROR_MSG__GENERIC"
Packit Service c5cf8c
    ;;
Packit Service c5cf8c
    class)
Packit Service c5cf8c
	error_message_kind="MPICH_ERROR_MSG__CLASS"
Packit Service c5cf8c
    ;;
Packit Service c5cf8c
    *)
Packit Service c5cf8c
    AC_MSG_WARN([Unknown value $enable_error_messages for enable-error-messages])
Packit Service c5cf8c
    ;;
Packit Service c5cf8c
esac
Packit Service c5cf8c
AC_DEFINE_UNQUOTED(MPICH_ERROR_MSG_LEVEL,$error_message_kind,[define to enable error messages])
Packit Service c5cf8c
Packit Service c5cf8c
#error-tags
Packit Service c5cf8c
if test "$enable_tag_error_bits" = "yes" ; then
Packit Service c5cf8c
    AC_DEFINE([HAVE_TAG_ERROR_BITS],[1],[Define to enable tag error bits])
Packit Service c5cf8c
fi
Packit Service c5cf8c
Packit Service c5cf8c
# ----------------------------------------------------------------------------
Packit Service c5cf8c
#
Packit Service c5cf8c
# enable-timing and with-logging
Packit Service c5cf8c
#
Packit Service c5cf8c
# Still to do: add subsets: e.g., class=pt2pt,class=coll.  See mpich doc
Packit Service c5cf8c
#
Packit Service c5cf8c
# Logging and timing are intertwined.  If you select logging, you
Packit Service c5cf8c
# may also need to select a timing level.  If no timing is selected 
Packit Service c5cf8c
# but logging with rlog is selected, make "all" the default timing level.
Packit Service c5cf8c
#
Packit Service c5cf8c
# FIXME: make timing and logging options work more cleanly together,
Packit Service c5cf8c
# particularly when other logging options are selected (e.g., logging is not
Packit Service c5cf8c
# rlog).
Packit Service c5cf8c
# ----------------------------------------------------------------------------
Packit Service c5cf8c
AM_CONDITIONAL([BUILD_LOGGING_RLOG],[test "X$with_logging" = "Xrlog"])
Packit Service c5cf8c
collect_stats=false
Packit Service c5cf8c
logging_required=false
Packit Service c5cf8c
if test "$enable_timing" = "default" ; then
Packit Service c5cf8c
    if test "$with_logging" = "rlog" ; then
Packit Service c5cf8c
        enable_timing=all
Packit Service c5cf8c
    fi
Packit Service c5cf8c
fi
Packit Service c5cf8c
timing_name=$enable_timing
Packit Service c5cf8c
case "$enable_timing" in
Packit Service c5cf8c
    no)
Packit Service c5cf8c
    timing_name=none
Packit Service c5cf8c
    ;;
Packit Service c5cf8c
    time)
Packit Service c5cf8c
    collect_stats=true
Packit Service c5cf8c
    ;;
Packit Service c5cf8c
    log|log_detailed)
Packit Service c5cf8c
    logging_required=true
Packit Service c5cf8c
    ;;
Packit Service c5cf8c
    yes)
Packit Service c5cf8c
    timing_name=all
Packit Service c5cf8c
    collect_stats=true
Packit Service c5cf8c
    logging_required=true
Packit Service c5cf8c
    ;;
Packit Service c5cf8c
    all|runtime)
Packit Service c5cf8c
    collect_stats=true
Packit Service c5cf8c
    logging_required=true
Packit Service c5cf8c
    ;;
Packit Service c5cf8c
    none|default)
Packit Service c5cf8c
    timing_name=none
Packit Service c5cf8c
    ;;
Packit Service c5cf8c
    *)
Packit Service c5cf8c
    AC_MSG_WARN([Unknown value $enable_timing for enable-timing])
Packit Service c5cf8c
    enable_timing=no
Packit Service c5cf8c
    timing_name=none
Packit Service c5cf8c
    ;; 
Packit Service c5cf8c
esac
Packit Service c5cf8c
#
Packit Service c5cf8c
# The default logging package is rlog; you can get it by 
Packit Service c5cf8c
# specifying --with-logging or --with-logging=rlog
Packit Service c5cf8c
#
Packit Service c5cf8c
case $with_logging in 
Packit Service c5cf8c
    yes)
Packit Service c5cf8c
    logging_name=rlog
Packit Service c5cf8c
    ;;
Packit Service c5cf8c
    no|none)
Packit Service c5cf8c
    logging_name=none
Packit Service c5cf8c
    ;;
Packit Service c5cf8c
    default)
Packit Service c5cf8c
    if test "$logging_required" = "true" ; then
Packit Service c5cf8c
        logging_name=rlog
Packit Service c5cf8c
    else
Packit Service c5cf8c
        logging_name=none
Packit Service c5cf8c
    fi
Packit Service c5cf8c
    ;;
Packit Service c5cf8c
    *)
Packit Service c5cf8c
    logging_name=$with_logging
Packit Service c5cf8c
    ;;
Packit Service c5cf8c
esac
Packit Service c5cf8c
# 
Packit Service c5cf8c
# Include the selected logging subsystem
Packit Service c5cf8c
#
Packit Service c5cf8c
# Choices:
Packit Service c5cf8c
# 1) A subdir of src/util/logging
Packit Service c5cf8c
#     This directory must contain a configure which will be executed
Packit Service c5cf8c
#     to build the 
Packit Service c5cf8c
# 2) An external directory
Packit Service c5cf8c
#     This directory must contain 
Packit Service c5cf8c
#          a mpilogging.h file
Packit Service c5cf8c
#     It may contain 
Packit Service c5cf8c
#          a setup_logging script
Packit Service c5cf8c
#          a configure
Packit Service c5cf8c
#     
Packit Service c5cf8c
#   
Packit Service c5cf8c
logging_subsystems=
Packit Service c5cf8c
if test "$logging_name" != "none" ; then
Packit Service c5cf8c
    # Check for an external name (directory containing a /)
Packit Service c5cf8c
    hasSlash=`echo A$logging_name | sed -e 's%[[^/]]%%g'`
Packit Service c5cf8c
    if test -n "$hasSlash" ; then
Packit Service c5cf8c
        # Check that the external logging system is complete.
Packit Service c5cf8c
	# Any failure will cause configure to abort
Packit Service c5cf8c
        if test ! -d $logging_name ; then
Packit Service c5cf8c
	    AC_MSG_ERROR([External logging directory $logging_name not found.  Configure aborted])
Packit Service c5cf8c
	    logging_name=none
Packit Service c5cf8c
        elif test ! -s $logging_name/mpilogging.h ; then
Packit Service c5cf8c
	    AC_MSG_ERROR([External logging header $logging_name/mpilogging.h not found.  Configure aborted])
Packit Service c5cf8c
	    logging_name=none
Packit Service c5cf8c
        fi
Packit Service c5cf8c
Packit Service c5cf8c
        logdir=$logging_name
Packit Service c5cf8c
	# Force the logdir to be absolute
Packit Service c5cf8c
	logdir=`cd $logdir && pwd`
Packit Service c5cf8c
	# Switch name to "external" because that is how the MPICH
Packit Service c5cf8c
	# code will know it
Packit Service c5cf8c
	logging_name=external
Packit Service c5cf8c
	# Add the dir to the include paths
Packit Service c5cf8c
	#CPPFLAGS="$CPPFLAGS -I$logdir"
Packit Service c5cf8c
	CPPFLAGS="$CPPFLAGS -I$logdir"
Packit Service c5cf8c
	# Add to the list of external modules to setup
Packit Service c5cf8c
	if test -x $logdir/setup_logging ; then
Packit Service c5cf8c
	     EXTERNAL_SETUPS="$EXTERNAL_SETUPS $logdir/setup_logging"
Packit Service c5cf8c
	fi
Packit Service c5cf8c
    else
Packit Service c5cf8c
        logdir=$srcdir/src/util/logging
Packit Service c5cf8c
        logreldir=src/util/logging/$logging_name
Packit Service c5cf8c
        logging_subsystems="$logging_subsystems $logreldir"
Packit Service c5cf8c
        for dir in $logging_name ; do
Packit Service c5cf8c
            if test ! -d $logdir/$dir ; then
Packit Service c5cf8c
	        AC_MSG_ERROR([$logdir/$dir does not exist.  Configure aborted])
Packit Service c5cf8c
	        logging_name=none
Packit Service c5cf8c
            fi
Packit Service c5cf8c
        done
Packit Service c5cf8c
        for dir in $logging_subsystems ; do
Packit Service c5cf8c
            if test ! -x $srcdir/$dir/configure ; then
Packit Service c5cf8c
	        AC_MSG_ERROR([$srcdir/$dir has no configure (required).  Configure aborted])
Packit Service c5cf8c
	        logging_name=none
Packit Service c5cf8c
            fi
Packit Service c5cf8c
        done
Packit Service c5cf8c
    fi
Packit Service c5cf8c
fi
Packit Service c5cf8c
#
Packit Service c5cf8c
# FIXME: Logging doesn't necessarily require timing (e.g., simply logging the 
Packit Service c5cf8c
# sequence of routines).  
Packit Service c5cf8c
if test "$logging_name" != "none" ; then
Packit Service c5cf8c
    if test "$enable_timing" != "no" ; then
Packit Service c5cf8c
	if test "$enable_timing" = "default" -o "$enable_timing" = "none" ; then
Packit Service c5cf8c
	    enable_timing=log
Packit Service c5cf8c
	    timing_name=log
Packit Service c5cf8c
    	fi
Packit Service c5cf8c
	subsystems="$subsystems $logging_subsystems"
Packit Service c5cf8c
    else
Packit Service c5cf8c
	AC_MSG_WARN([Timing was disabled.  Logging has been disabled as well.])
Packit Service c5cf8c
	with_logging=no
Packit Service c5cf8c
	logging_name=none
Packit Service c5cf8c
    fi
Packit Service c5cf8c
else
Packit Service c5cf8c
    if test "$logging_required" = "true" ; then
Packit Service c5cf8c
	AC_MSG_WARN([Timing was enabled with log option but no logging library is available.  Timing has been disabled.])
Packit Service c5cf8c
	enable_timing=no
Packit Service c5cf8c
	timing_name=none
Packit Service c5cf8c
    fi
Packit Service c5cf8c
fi
Packit Service c5cf8c
if test "$timing_name" != "none" ; then
Packit Service c5cf8c
    timing_kind=`echo $timing_name | \
Packit Service c5cf8c
       tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
Packit Service c5cf8c
    timing_kind=MPICH_TIMING_KIND__$timing_kind
Packit Service c5cf8c
    AC_DEFINE_UNQUOTED(HAVE_TIMING,$timing_kind,[define to enable timing collection])
Packit Service c5cf8c
    if test "$collect_stats" = "true" ; then
Packit Service c5cf8c
        AC_DEFINE(COLLECT_STATS,1,[define to enable collection of statistics])
Packit Service c5cf8c
    fi
Packit Service c5cf8c
fi
Packit Service c5cf8c
Packit Service c5cf8c
use_logging_variable="MPICH_LOGGING__`echo $logging_name | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`"
Packit Service c5cf8c
AC_DEFINE_UNQUOTED(USE_LOGGING,$use_logging_variable,[define to choose logging library])
Packit Service c5cf8c
# ----------------------------------------------------------------------------
Packit Service c5cf8c
# End of logging tests
Packit Service c5cf8c
# ----------------------------------------------------------------------------
Packit Service c5cf8c
Packit Service c5cf8c
# ----------------------------------------------------------------------------
Packit Service c5cf8c
# Check to see if the device does not support spawn.  
Packit Service c5cf8c
# FIXME: This should provide the option of not building the dynamic
Packit Service c5cf8c
# process routines.  It could also allow us to specialize support
Packit Service c5cf8c
# for all processes are members of MPI_COMM_WORLD (only one comm_world).
Packit Service c5cf8c
# ----------------------------------------------------------------------------
Packit Service c5cf8c
if test "$MPID_NO_SPAWN" = yes ; then
Packit Service c5cf8c
    AC_MSG_WARN([The device $with_device does not support MPI dynamic process routines])   
Packit Service c5cf8c
fi
Packit Service c5cf8c
Packit Service c5cf8c
# MPL
Packit Service c5cf8c
AC_ARG_VAR([MPLLIBNAME],[can be used to override the name of the MPL library (default: "mpl")])
Packit Service c5cf8c
MPLLIBNAME=${MPLLIBNAME:-"mpl"}
Packit Service c5cf8c
export MPLLIBNAME
Packit Service c5cf8c
AC_SUBST(MPLLIBNAME)
Packit Service c5cf8c
AC_ARG_WITH([mpl-prefix],
Packit Service c5cf8c
            [AS_HELP_STRING([[--with-mpl-prefix[=DIR]]],
Packit Service c5cf8c
                            [use the MPL library installed in DIR,
Packit Service c5cf8c
                             rather than the one included in src/mpl.  Pass
Packit Service c5cf8c
                             "embedded" to force usage of the MPL source
Packit Service c5cf8c
                             distributed with MPICH.])],
Packit Service c5cf8c
            [],dnl action-if-given
Packit Service c5cf8c
            [with_mpl_prefix=embedded]) dnl action-if-not-given
Packit Service c5cf8c
mplsrcdir=""
Packit Service c5cf8c
AC_SUBST([mplsrcdir])
Packit Service c5cf8c
mpllibdir=""
Packit Service c5cf8c
AC_SUBST([mpllibdir])
Packit Service c5cf8c
mpllib=""
Packit Service c5cf8c
AC_SUBST([mpllib])
Packit Service c5cf8c
if test "$with_mpl_prefix" = "embedded" ; then
Packit Service c5cf8c
    # no need for libtool versioning when embedding MPL
Packit Service c5cf8c
    mpl_subdir_args="--disable-versioning --enable-embedded"
Packit Service c5cf8c
    PAC_CONFIG_SUBDIR_ARGS([src/mpl],[$mpl_subdir_args],[],[AC_MSG_ERROR(MPL configure failed)])
Packit Service c5cf8c
    PAC_APPEND_FLAG([-I${master_top_builddir}/src/mpl/include], [CPPFLAGS])
Packit Service c5cf8c
    PAC_APPEND_FLAG([-I${use_top_srcdir}/src/mpl/include], [CPPFLAGS])
Packit Service c5cf8c
Packit Service c5cf8c
    mplsrcdir="src/mpl"
Packit Service c5cf8c
    mpllib="src/mpl/lib${MPLLIBNAME}.la"
Packit Service c5cf8c
else
Packit Service c5cf8c
    # The user specified an already-installed MPL; just sanity check, don't
Packit Service c5cf8c
    # subconfigure it
Packit Service c5cf8c
    AS_IF([test -s "${with_mpl_prefix}/include/mplconfig.h"],
Packit Service c5cf8c
          [:],[AC_MSG_ERROR([the MPL installation in "${with_mpl_prefix}" appears broken])])
Packit Service c5cf8c
    PAC_APPEND_FLAG([-I${with_mpl_prefix}/include],[CPPFLAGS])
Packit Service c5cf8c
    PAC_PREPEND_FLAG([-l${MPLLIBNAME}],[WRAPPER_LIBS])
Packit Service c5cf8c
    PAC_APPEND_FLAG([-L${with_mpl_prefix}/lib],[WRAPPER_LDFLAGS])
Packit Service c5cf8c
    mpllibdir="-L${with_mpl_prefix}/lib"
Packit Service c5cf8c
fi
Packit Service c5cf8c
Packit Service c5cf8c
# OpenPA
Packit Service c5cf8c
AC_ARG_VAR([OPALIBNAME],[can be used to override the name of the OpenPA library (default: "opa")])
Packit Service c5cf8c
OPALIBNAME=${OPALIBNAME:-"opa"}
Packit Service c5cf8c
export OPALIBNAME
Packit Service c5cf8c
AC_SUBST(OPALIBNAME)
Packit Service c5cf8c
AC_ARG_WITH([openpa-prefix],
Packit Service c5cf8c
            [AS_HELP_STRING([[--with-openpa-prefix[=DIR]]],
Packit Service c5cf8c
                            [use the OpenPA atomics library installed in DIR,
Packit Service c5cf8c
                             rather than the one included in src/openpa.  Pass
Packit Service c5cf8c
                             "embedded" to force usage of the OpenPA source
Packit Service c5cf8c
                             distributed with MPICH.])],
Packit Service c5cf8c
            [],
Packit Service c5cf8c
            [# see if OPA is already installed on the system
Packit Service c5cf8c
             PAC_PUSH_FLAG([LIBS])
Packit Service c5cf8c
             PAC_PREPEND_FLAG([-l${OPALIBNAME}],[LIBS])
Packit Service c5cf8c
             AC_LINK_IFELSE([AC_LANG_PROGRAM([dnl
Packit Service c5cf8c
#include "opa_primitives.h"
Packit Service c5cf8c
],[
Packit Service c5cf8c
OPA_int_t i;
Packit Service c5cf8c
OPA_store_int(i,10);
Packit Service c5cf8c
OPA_fetch_and_incr_int(&i,5);
Packit Service c5cf8c
])dnl
Packit Service c5cf8c
                             ],
Packit Service c5cf8c
                            [with_openpa_prefix=system],[with_openpa_prefix=embedded])
Packit Service c5cf8c
             PAC_POP_FLAG([LIBS])
Packit Service c5cf8c
             ])
Packit Service c5cf8c
Packit Service c5cf8c
opasrcdir=""
Packit Service c5cf8c
AC_SUBST([opasrcdir])
Packit Service c5cf8c
opalibdir=""
Packit Service c5cf8c
AC_SUBST([opalibdir])
Packit Service c5cf8c
opalib=""
Packit Service c5cf8c
AC_SUBST([opalib])
Packit Service c5cf8c
Packit Service c5cf8c
if test "$with_openpa_prefix" = "embedded" ; then
Packit Service c5cf8c
    if test -e "${use_top_srcdir}/src/openpa" ; then
Packit Service c5cf8c
        opasrcdir="src/openpa"
Packit Service c5cf8c
        opalib="src/openpa/src/lib${OPALIBNAME}.la"
Packit Service c5cf8c
        PAC_APPEND_FLAG([-I${use_top_srcdir}/src/openpa/src],[CPPFLAGS])
Packit Service c5cf8c
        PAC_APPEND_FLAG([-I${master_top_builddir}/src/openpa/src],[CPPFLAGS])
Packit Service c5cf8c
Packit Service c5cf8c
        # OPA defaults to "auto", but in MPICH we want "auto_allow_emulation" to
Packit Service c5cf8c
        # easily permit using channels like ch3:sock that don't care about atomics
Packit Service c5cf8c
        AC_ARG_WITH([atomic-primitives],
Packit Service c5cf8c
                    [AS_HELP_STRING([--with-atomic-primitives],
Packit Service c5cf8c
                                    [Force OPA to use a specific atomic primitives
Packit Service c5cf8c
                                     implementation.  See the src/openpa directory
Packit Service c5cf8c
                                     for more info.])],
Packit Service c5cf8c
                    [],[with_atomic_primitives=not_specified])
Packit Service c5cf8c
        # no need for libtool versioning when embedding OPA
Packit Service c5cf8c
        opa_subdir_args="--disable-versioning --enable-embedded"
Packit Service c5cf8c
        if test "$with_atomic_primitives" = "not_specified" ; then
Packit Service c5cf8c
            PAC_APPEND_FLAG([--with-atomic-primitives=auto_allow_emulation], [opa_subdir_args])
Packit Service c5cf8c
        fi
Packit Service c5cf8c
        PAC_CONFIG_SUBDIR_ARGS([src/openpa],[$opa_subdir_args],[],[AC_MSG_ERROR([OpenPA configure failed])])
Packit Service c5cf8c
    else
Packit Service c5cf8c
        AC_MSG_WARN([Attempted to use the embedded OpenPA source tree in "src/openpa", but it is missing.  Configuration or compilation may fail later.])
Packit Service c5cf8c
    fi
Packit Service c5cf8c
elif test "$with_openpa_prefix" = "system" ; then
Packit Service c5cf8c
    PAC_PREPEND_FLAG([-l${OPALIBNAME}],[WRAPPER_LIBS])
Packit Service c5cf8c
elif test "$with_openpa_prefix" = "no" ; then
Packit Service c5cf8c
    # The user doesn't want to use OPA.  This may or may not cause MPICH to
Packit Service c5cf8c
    # fail to configure/build, depending on many other factors.
Packit Service c5cf8c
    :
Packit Service c5cf8c
else
Packit Service c5cf8c
    # The user specified an already-installed OPA; just sanity check, don't
Packit Service c5cf8c
    # subconfigure it
Packit Service c5cf8c
    AS_IF([test -s "${with_openpa_prefix}/include/opa_primitives.h" -a -s "${with_openpa_prefix}/include/opa_config.h"],
Packit Service c5cf8c
          [:],[AC_MSG_ERROR([the OpenPA installation in "${with_openpa_prefix}" appears broken])])
Packit Service c5cf8c
    PAC_APPEND_FLAG([-I${with_openpa_prefix}/include],[CPPFLAGS])
Packit Service c5cf8c
    PAC_PREPEND_FLAG([-l${OPALIBNAME}],[WRAPPER_LIBS])
Packit Service c5cf8c
    if test -d ${with_openpa_prefix}/lib64 ; then
Packit Service c5cf8c
        PAC_APPEND_FLAG([-L${with_openpa_prefix}/lib64],[WRAPPER_LDFLAGS])
Packit Service c5cf8c
        opalibdir="-L${with_openpa_prefix}/lib64"
Packit Service c5cf8c
    else
Packit Service c5cf8c
        opalibdir="-L${with_openpa_prefix}/lib"
Packit Service c5cf8c
    fi
Packit Service c5cf8c
    PAC_APPEND_FLAG([-L${with_openpa_prefix}/lib],[WRAPPER_LDFLAGS])
Packit Service c5cf8c
fi
Packit Service c5cf8c
Packit Service c5cf8c
# Izem
Packit Service c5cf8c
Packit Service c5cf8c
AC_ARG_ENABLE([izem],
Packit Service c5cf8c
[  --enable-izem@<:@=ARGS@:>@   Enable features from the Izem library.
Packit Service c5cf8c
                          "ARGS" is a list of comma separated features.
Packit Service c5cf8c
                          Accepted arguments are:
Packit Service c5cf8c
			  sync     - use the Izem interface for sychronization objects
Packit Service c5cf8c
                                     (locks and condition variables) instead of the MPL interface
Packit Service c5cf8c
                          queue    - use the Izem interface for atomic queue objects
Packit Service c5cf8c
                          atomic   - use the Izem interface for CPU atomics
Packit Service c5cf8c
                          yes/all  - all of the above features are enabled
Packit Service c5cf8c
                          no/none  - none of the above features are enabled],,
Packit Service c5cf8c
[enable_izem=no])
Packit Service c5cf8c
Packit Service c5cf8c
# strip off multiple options, separated by commas
Packit Service c5cf8c
save_IFS="$IFS"
Packit Service c5cf8c
IFS=","
Packit Service c5cf8c
for option in $enable_izem ; do
Packit Service c5cf8c
    case "$option" in
Packit Service c5cf8c
        sync)
Packit Service c5cf8c
            izem_sync=yes
Packit Service c5cf8c
        ;;
Packit Service c5cf8c
        queue)
Packit Service c5cf8c
            izem_queue=yes
Packit Service c5cf8c
        ;;
Packit Service c5cf8c
        atomic)
Packit Service c5cf8c
            izem_atomic=yes
Packit Service c5cf8c
        ;;
Packit Service c5cf8c
        yes|all)
Packit Service c5cf8c
            izem_sync=yes
Packit Service c5cf8c
            izem_queue=yes
Packit Service c5cf8c
            izem_atomic=yes
Packit Service c5cf8c
        ;;
Packit Service c5cf8c
        no|none)
Packit Service c5cf8c
        ;;
Packit Service c5cf8c
        *)
Packit Service c5cf8c
            AC_MSG_ERROR([Unknown value $option for enable-izem])
Packit Service c5cf8c
        ;;
Packit Service c5cf8c
    esac
Packit Service c5cf8c
done
Packit Service c5cf8c
IFS="$save_IFS"
Packit Service c5cf8c
Packit Service c5cf8c
if test "$izem_sync" = "yes" ; then
Packit Service c5cf8c
    AC_DEFINE(ENABLE_IZEM_SYNC,1,[Define to enable using Izem locks and condition variables])
Packit Service c5cf8c
fi
Packit Service c5cf8c
Packit Service c5cf8c
if test "$izem_queue" = "yes" ; then
Packit Service c5cf8c
    AC_DEFINE(ENABLE_IZEM_QUEUE,1,[Define to enable using Izem queues])
Packit Service c5cf8c
fi
Packit Service c5cf8c
Packit Service c5cf8c
if test "$izem_atomic" = "yes" ; then
Packit Service c5cf8c
    AC_DEFINE(ENABLE_IZEM_ATOMIC,1,[Define to enable using Izem CPU atomics])
Packit Service c5cf8c
fi
Packit Service c5cf8c
Packit Service c5cf8c
AC_ARG_VAR([ZMLIBNAME],[can be used to override the name of the Izem library (default: "zm")])
Packit Service c5cf8c
ZMLIBNAME=${ZMLIBNAME:-"zm"}
Packit Service c5cf8c
export ZMLIBNAME
Packit Service c5cf8c
AC_SUBST(ZMLIBNAME)
Packit Service c5cf8c
AC_ARG_WITH([zm-prefix],
Packit Service c5cf8c
[  --with-zm-prefix@<:@=ARG@:>@
Packit Service c5cf8c
                          specify the Izem library to use. No argument implies "yes".
Packit Service c5cf8c
                          Accepted values for ARG are:
Packit Service c5cf8c
                          yes|embedded - use the embedded Izem
Packit Service c5cf8c
                          system       - search system paths for an Izem installation
Packit Service c5cf8c
                          no           - disable Izem
Packit Service c5cf8c
                          <PATH>       - use the Izem at PATH],,
Packit Service c5cf8c
[with_zm_prefix=no])
Packit Service c5cf8c
Packit Service c5cf8c
zmsrcdir=""
Packit Service c5cf8c
AC_SUBST([zmsrcdir])
Packit Service c5cf8c
zmlibdir=""
Packit Service c5cf8c
AC_SUBST([zmlibdir])
Packit Service c5cf8c
zmlib=""
Packit Service c5cf8c
AC_SUBST([zmlib])
Packit Service c5cf8c
Packit Service c5cf8c
if test "$enable_izem" != "no" && test "$enable_izem" != "none"; then
Packit Service c5cf8c
    if test "$with_zm_prefix" = "yes" || test "$with_zm_prefix" = "embedded"; then
Packit Service c5cf8c
        if test -e "${use_top_srcdir}/src/izem" ; then
Packit Service c5cf8c
            zm_subdir_args="--enable-embedded"
Packit Service c5cf8c
            PAC_CONFIG_SUBDIR_ARGS([src/izem],[$zm_subdir_args],[],[AC_MSG_ERROR(Izem configure failed)])
Packit Service c5cf8c
            zmsrcdir="${master_top_builddir}/src/izem"
Packit Service c5cf8c
            zmlib="${master_top_builddir}/src/izem/src/lib${ZMLIBNAME}.la"
Packit Service c5cf8c
            PAC_APPEND_FLAG([-I${use_top_srcdir}/src/izem/src/include],[CPPFLAGS])
Packit Service c5cf8c
            PAC_APPEND_FLAG([-I${master_top_builddir}/src/izem/src/include],[CPPFLAGS])
Packit Service c5cf8c
        else
Packit Service c5cf8c
            AC_MSG_WARN([Attempted to use the embedded Izem source tree in "src/izem", but it is missing.  Configuration or compilation may fail later.])
Packit Service c5cf8c
        fi
Packit Service c5cf8c
    elif test "$with_zm_prefix" = "system"; then
Packit Service c5cf8c
        # check if an Izem installation exists on this system
Packit Service c5cf8c
        PAC_PUSH_FLAG([LIBS])
Packit Service c5cf8c
        PAC_PREPEND_FLAG([-l${ZMLIBNAME}],[LIBS])
Packit Service c5cf8c
        AC_LINK_IFELSE([AC_LANG_PROGRAM([#include "lock/zm_ticket.h"
Packit Service c5cf8c
                                        ],
Packit Service c5cf8c
                                        [zm_ticket_t lock;
Packit Service c5cf8c
                                         zm_ticket_init(&lock);
Packit Service c5cf8c
                                         zm_ticket_acquire(&lock);
Packit Service c5cf8c
                                         zm_ticket_release(&lock);])],
Packit Service c5cf8c
                       [AC_MSG_ERROR([No usable Izem installation was found on this system])],
Packit Service c5cf8c
                       [PAC_PREPEND_FLAG([-l${ZMLIBNAME}],[WRAPPER_LIBS])])
Packit Service c5cf8c
        PAC_POP_FLAG([LIBS])
Packit Service c5cf8c
    elif test "$with_zm_prefix" = "no"; then
Packit Service c5cf8c
        AC_MSG_ERROR([Izem features were requested with --enable-izem but Izem was disabled.])
Packit Service c5cf8c
    else
Packit Service c5cf8c
        # The user specified an already-installed Izem; just sanity check, don't
Packit Service c5cf8c
        # subconfigure it
Packit Service c5cf8c
Packit Service c5cf8c
        AS_IF([test -s "${with_zm_prefix}/include/lock/zm_lock.h" -a -s "${with_zm_prefix}/include/cond/zm_cond.h"],
Packit Service c5cf8c
              [:],[AC_MSG_ERROR([Izem headers at "${with_zm_prefix}/include" are missing])])
Packit Service c5cf8c
        PAC_APPEND_FLAG([-I${with_zm_prefix}/include],[CPPFLAGS])
Packit Service c5cf8c
Packit Service c5cf8c
        PAC_PUSH_FLAG([LIBS])
Packit Service c5cf8c
        PAC_PUSH_FLAG([LDFLAGS])
Packit Service c5cf8c
        PAC_PREPEND_FLAG([-l${ZMLIBNAME}],[LIBS])
Packit Service c5cf8c
        PAC_APPEND_FLAG([-L${with_zm_prefix}/lib],[LDFLAGS])
Packit Service c5cf8c
        AC_LINK_IFELSE([AC_LANG_PROGRAM([#include "lock/zm_ticket.h"
Packit Service c5cf8c
                                        ],
Packit Service c5cf8c
                                        [zm_ticket_t lock;
Packit Service c5cf8c
                                         zm_ticket_init(&lock);
Packit Service c5cf8c
                                         zm_ticket_acquire(&lock);
Packit Service c5cf8c
                                         zm_ticket_release(&lock);])],
Packit Service c5cf8c
                       [],[AC_MSG_ERROR([The Izem installation at "${with_zm_prefix}" seems broken])])
Packit Service c5cf8c
        PAC_POP_FLAG([LIBS])
Packit Service c5cf8c
        PAC_POP_FLAG([LDFLAGS])
Packit Service c5cf8c
        PAC_APPEND_FLAG([-L${with_zm_prefix}/lib],[WRAPPER_LDFLAGS])
Packit Service c5cf8c
        PAC_PREPEND_FLAG([-l${ZMLIBNAME}],[WRAPPER_LIBS])
Packit Service c5cf8c
        zmlibdir="-L${with_zm_prefix}/lib"
Packit Service c5cf8c
    fi
Packit Service c5cf8c
fi
Packit Service c5cf8c
Packit Service c5cf8c
Packit Service c5cf8c
# Set NEEDSPLIB to yes if link commands need both -l$MPILIBNAME
Packit Service c5cf8c
# and -lp$MPILIBNAME.
Packit Service c5cf8c
NEEDSPLIB=yes
Packit Service c5cf8c
if test $enable_weak_symbols = yes ; then
Packit Service c5cf8c
    # Turn off weak symbols if they aren't available
Packit Service c5cf8c
    PAC_PROG_C_WEAK_SYMBOLS(,enable_weak_symbols=no)
Packit Service c5cf8c
fi
Packit Service c5cf8c
if test $enable_weak_symbols = "yes" ; then
Packit Service c5cf8c
    AC_DEFINE(USE_WEAK_SYMBOLS,1,[Define if weak symbols should be used])
Packit Service c5cf8c
    NEEDSPLIB=no
Packit Service c5cf8c
    # Check for the ability to support multiple weak symbols
Packit Service c5cf8c
    if test "$pac_cv_prog_c_weak_symbols" = "pragma weak" ; then
Packit Service c5cf8c
       PAC_PROG_C_MULTIPLE_WEAK_SYMBOLS(AC_DEFINE(HAVE_MULTIPLE_PRAGMA_WEAK,1,[Define if multiple weak symbols may be defined]))
Packit Service c5cf8c
    fi
Packit Service c5cf8c
fi
Packit Service c5cf8c
export NEEDSPLIB
Packit Service c5cf8c
Packit Service c5cf8c
AM_CONDITIONAL([BUILD_PROFILING_LIB],[test "$NEEDSPLIB" = "yes"])
Packit Service c5cf8c
PAC_CHECK_VISIBILITY
Packit Service c5cf8c
AC_SUBST(VISIBILITY_CFLAGS)
Packit Service c5cf8c
# disable visibility if building profiling library
Packit Service c5cf8c
if test "$NEEDSPLIB" = "yes" ; then
Packit Service c5cf8c
    VISIBILITY_CFLAGS=""
Packit Service c5cf8c
fi
Packit Service c5cf8c
Packit Service c5cf8c
Packit Service c5cf8c
# ----------------------------------------------------------------------------
Packit Service c5cf8c
# HWLOC
Packit Service c5cf8c
# ----------------------------------------------------------------------------
Packit Service c5cf8c
# Allow the user to override the hwloc location (from embedded to user
Packit Service c5cf8c
# path)
Packit Service c5cf8c
# HWLOC
Packit Service c5cf8c
AC_ARG_WITH([hwloc-prefix],
Packit Service c5cf8c
            [AS_HELP_STRING([[--with-hwloc-prefix[=DIR]]],
Packit Service c5cf8c
                            [use the HWLOC library installed in DIR,
Packit Service c5cf8c
                             rather than the one included in src/hwloc.  Pass
Packit Service c5cf8c
                             "embedded" to force usage of the HWLOC source
Packit Service c5cf8c
                             distributed with MPICH.])],
Packit Service c5cf8c
            [],dnl action-if-given
Packit Service c5cf8c
            [with_hwloc_prefix=embedded]) dnl action-if-not-given
Packit Service c5cf8c
hwlocsrcdir=""
Packit Service c5cf8c
AC_SUBST([hwlocsrcdir])
Packit Service c5cf8c
hwloclibdir=""
Packit Service c5cf8c
AC_SUBST([hwloclibdir])
Packit Service c5cf8c
hwloclib=""
Packit Service c5cf8c
AC_SUBST([hwloclib])
Packit Service c5cf8c
Packit Service c5cf8c
if test "$with_hwloc_prefix" = "no" ; then
Packit Service c5cf8c
   have_hwloc=no
Packit Service c5cf8c
elif test "$with_hwloc_prefix" = "embedded" ; then
Packit Service c5cf8c
   # Disable visibility when setting up hwloc
Packit Service c5cf8c
   PAC_PUSH_FLAG([enable_visibility])
Packit Service c5cf8c
   enable_visibility=no;
Packit Service c5cf8c
   HWLOC_SETUP_CORE([src/hwloc],[have_hwloc=yes],[have_hwloc=no],[1])
Packit Service c5cf8c
   # Only build hwloc in embedded mode
Packit Service c5cf8c
   if test "$have_hwloc" = "yes" ; then
Packit Service c5cf8c
      use_embedded_hwloc=yes
Packit Service c5cf8c
      hwlocsrcdir="src/hwloc"
Packit Service c5cf8c
      hwloclib="$HWLOC_EMBEDDED_LDADD"
Packit Service c5cf8c
      PAC_PREPEND_FLAG([$HWLOC_EMBEDDED_LIBS], [WRAPPER_LIBS])
Packit Service c5cf8c
      # if possible, do not expose hwloc symbols in libmpi.so
Packit Service c5cf8c
      PAC_PREPEND_FLAG([$VISIBILITY_CFLAGS], [HWLOC_CFLAGS])
Packit Service c5cf8c
   fi
Packit Service c5cf8c
   PAC_POP_FLAG([enable_visibility])
Packit Service c5cf8c
else
Packit Service c5cf8c
   AC_CHECK_HEADERS([hwloc.h])
Packit Service c5cf8c
   # hwloc_topology_set_pid was added in hwloc-1.0.0, which is our
Packit Service c5cf8c
   # minimum required version
Packit Service c5cf8c
   AC_CHECK_LIB([hwloc],[hwloc_topology_set_pid])
Packit Service c5cf8c
   AC_MSG_CHECKING([if non-embedded hwloc works])
Packit Service c5cf8c
   if test "$ac_cv_header_hwloc_h" = "yes" -a "$ac_cv_lib_hwloc_hwloc_topology_set_pid" = "yes" ; then
Packit Service c5cf8c
      have_hwloc=yes
Packit Service c5cf8c
   else
Packit Service c5cf8c
      have_hwloc=no
Packit Service c5cf8c
   fi
Packit Service c5cf8c
   AC_MSG_RESULT([$have_hwloc])
Packit Service c5cf8c
Packit Service c5cf8c
   # FIXME: Disable hwloc on Cygwin for now. The hwloc package,
Packit Service c5cf8c
   # atleast as of 1.0.2, does not install correctly on Cygwin
Packit Service c5cf8c
   AS_CASE([$host], [*-*-cygwin], [have_hwloc=no])
Packit Service c5cf8c
Packit Service c5cf8c
   if test "$have_hwloc" = "yes" ; then
Packit Service c5cf8c
      hwloclib="-lhwloc"
Packit Service c5cf8c
      if test -d ${with_hwloc_prefix}/lib64 ; then
Packit Service c5cf8c
         PAC_APPEND_FLAG([-L${with_hwloc_prefix}/lib64],[WRAPPER_LDFLAGS])
Packit Service c5cf8c
         hwloclibdir="-L${with_hwloc_prefix}/lib64"
Packit Service c5cf8c
      else
Packit Service c5cf8c
	 hwloclibdir="-L${with_hwloc_prefix}/lib"
Packit Service c5cf8c
      fi
Packit Service c5cf8c
   fi
Packit Service c5cf8c
fi
Packit Service c5cf8c
Packit Service c5cf8c
if test "$have_hwloc" = "yes" ; then
Packit Service c5cf8c
   AC_DEFINE(HAVE_HWLOC,1,[Define if hwloc is available])
Packit Service c5cf8c
fi
Packit Service c5cf8c
Packit Service c5cf8c
HWLOC_DO_AM_CONDITIONALS
Packit Service c5cf8c
AM_CONDITIONAL([have_hwloc], [test "${have_hwloc}" = "yes"])
Packit Service c5cf8c
AM_CONDITIONAL([use_embedded_hwloc], [test "${use_embedded_hwloc}" = "yes"])
Packit Service c5cf8c
Packit Service c5cf8c
# ----------------------------------------------------------------------------
Packit Service c5cf8c
# NETLOC
Packit Service c5cf8c
# ----------------------------------------------------------------------------
Packit Service c5cf8c
AC_ARG_WITH([netloc-prefix],
Packit Service c5cf8c
            [AS_HELP_STRING([[--with-netloc-prefix[=DIR]]],
Packit Service c5cf8c
                            [use the NETLOC library installed in DIR]) or system to use the system library], [],
Packit Service c5cf8c
                            [with_netloc_prefix=no])
Packit Service c5cf8c
Packit Service c5cf8c
netloclibdir=""
Packit Service c5cf8c
AC_SUBST([netloclibdir])
Packit Service c5cf8c
Packit Service c5cf8c
if test "$have_hwloc" = "yes" ; then
Packit Service c5cf8c
    if test "${with_netloc_prefix}" != "no" ; then
Packit Service c5cf8c
        if test "${with_netloc_prefix}" != "system"; then
Packit Service c5cf8c
            # The user specified an already-installed Netloc; just sanity check,
Packit Service c5cf8c
            # don't subconfigure it
Packit Service c5cf8c
            AS_IF([test -s "${with_netloc_prefix}/include/netloc.h"],
Packit Service c5cf8c
              [:],[AC_MSG_ERROR([the Netloc installation in "${with_netloc_prefix}" appears broken])])
Packit Service c5cf8c
            PAC_APPEND_FLAG([-I${with_netloc_prefix}/include],[CPPFLAGS])
Packit Service c5cf8c
            PAC_APPEND_FLAG([-I${with_netloc_prefix}/include],[CFLAGS])
Packit Service c5cf8c
            PAC_PREPEND_FLAG([-lnetloc],[WRAPPER_LIBS])
Packit Service c5cf8c
            if test -d ${with_netloc_prefix}/lib64 ; then
Packit Service c5cf8c
                PAC_APPEND_FLAG([-L${with_netloc_prefix}/lib64],[WRAPPER_LDFLAGS])
Packit Service c5cf8c
                netloclibdir="-L${with_netloc_prefix}/lib64"
Packit Service c5cf8c
            else
Packit Service c5cf8c
                PAC_APPEND_FLAG([-L${with_netloc_prefix}/lib],[WRAPPER_LDFLAGS])
Packit Service c5cf8c
                netloclibdir="-L${with_netloc_prefix}/lib"
Packit Service c5cf8c
            fi
Packit Service c5cf8c
       else
Packit Service c5cf8c
           AC_LINK_IFELSE([AC_LANG_PROGRAM([#include "netloc.h"
Packit Service c5cf8c
                                   ],
Packit Service c5cf8c
                                   [])],
Packit Service c5cf8c
                          [AC_MSG_ERROR([the Netloc installation seems to be added from system path])], [])
Packit Service c5cf8c
       fi
Packit Service c5cf8c
       AC_DEFINE(HAVE_NETLOC,1,[Define if netloc is available in either user specified path or in system path])
Packit Service c5cf8c
    fi
Packit Service c5cf8c
fi
Packit Service c5cf8c
Packit Service c5cf8c
# ----------------------------------------------------------------------------
Packit Service c5cf8c
# Threads
Packit Service c5cf8c
# ----------------------------------------------------------------------------
Packit Service c5cf8c
#
Packit Service c5cf8c
# Threads must be supported by the device.  First, set the default to
Packit Service c5cf8c
# be the highest supported by the device
Packit Service c5cf8c
# "runtime" was an old (now deprecated) option; just map it to multiple
Packit Service c5cf8c
if test "$enable_threads" = "runtime" ; then enable_threads=multiple ; fi
Packit Service c5cf8c
if test "$enable_threads" = "yes" ; then enable_threads=default ; fi
Packit Service c5cf8c
if test "$enable_threads" = "no" ; then enable_threads=single ; fi
Packit Service c5cf8c
if test "$enable_threads" = default ; then
Packit Service c5cf8c
    # XXX DJG bug is here, PREREQ is not being used right now
Packit Service c5cf8c
    if test -n "$MPID_MAX_THREAD_LEVEL" ; then
Packit Service c5cf8c
        case $MPID_MAX_THREAD_LEVEL in
Packit Service c5cf8c
            MPI_THREAD_SINGLE)     enable_threads=single ;;
Packit Service c5cf8c
            MPI_THREAD_FUNNELED)   enable_threads=funneled ;;
Packit Service c5cf8c
            MPI_THREAD_SERIALIZED) enable_threads=serialized ;;
Packit Service c5cf8c
            MPI_THREAD_MULTIPLE)   enable_threads=multiple ;;
Packit Service c5cf8c
            *) AC_MSG_ERROR([Unrecognized thread level from device $MPID_MAX_THREAD_LEVEL])
Packit Service c5cf8c
    	    ;;
Packit Service c5cf8c
        esac
Packit Service c5cf8c
    else
Packit Service c5cf8c
        enable_threads=single
Packit Service c5cf8c
    fi
Packit Service c5cf8c
fi
Packit Service c5cf8c
Packit Service c5cf8c
MPICH_THREAD_LEVEL=MPI_THREAD_FUNNELED
Packit Service c5cf8c
case "$enable_threads" in 
Packit Service c5cf8c
    single)
Packit Service c5cf8c
    thread_pkg_required=no
Packit Service c5cf8c
    MPICH_THREAD_LEVEL=MPI_THREAD_SINGLE
Packit Service c5cf8c
    ;;
Packit Service c5cf8c
    funneled)
Packit Service c5cf8c
    thread_pkg_required=no
Packit Service c5cf8c
    MPICH_THREAD_LEVEL=MPI_THREAD_FUNNELED
Packit Service c5cf8c
    ;;
Packit Service c5cf8c
    serialized)
Packit Service c5cf8c
    thread_pkg_required=no
Packit Service c5cf8c
    MPICH_THREAD_LEVEL=MPI_THREAD_SERIALIZED
Packit Service c5cf8c
    ;;
Packit Service c5cf8c
    multiple)
Packit Service c5cf8c
    thread_pkg_required=yes
Packit Service c5cf8c
    MPICH_THREAD_LEVEL=MPI_THREAD_MULTIPLE
Packit Service c5cf8c
    ;;
Packit Service c5cf8c
    *)
Packit Service c5cf8c
    AC_MSG_ERROR(["$enable_threads" is not a valid value for --enable-threads])     
Packit Service c5cf8c
    ;;
Packit Service c5cf8c
esac
Packit Service c5cf8c
# Check that the requested thread level is available.
Packit Service c5cf8c
threadLevelOK=yes
Packit Service c5cf8c
if test ! -z "$MPID_MAX_THREAD_LEVEL" ; then
Packit Service c5cf8c
    # Check that MPID_MAX_THREAD_LEVEL is at least as large as the
Packit Service c5cf8c
    # selected MPICH_THREAD_LEVEL
Packit Service c5cf8c
    case $MPICH_THREAD_LEVEL in 
Packit Service c5cf8c
        MPI_THREAD_MULTIPLE)
Packit Service c5cf8c
	if test "$MPID_MAX_THREAD_LEVEL" != "MPI_THREAD_MULTIPLE" ; then
Packit Service c5cf8c
	    threadLevelOK=no
Packit Service c5cf8c
        fi
Packit Service c5cf8c
	;;
Packit Service c5cf8c
	MPI_THREAD_SERIALIZED)
Packit Service c5cf8c
	if test "$MPID_MAX_THREAD_LEVEL" != "MPI_THREAD_MULTIPLE" -a \
Packit Service c5cf8c
	        "$MPID_MAX_THREAD_LEVEL" != "MPI_THREAD_SERIALIZED" ; then
Packit Service c5cf8c
            threadLevelOK=no
Packit Service c5cf8c
        fi
Packit Service c5cf8c
	;;
Packit Service c5cf8c
	MPI_THREAD_FUNNELED)
Packit Service c5cf8c
        if test "$MPID_MAX_THREAD_LEVEL" = "MPI_THREAD_SINGLE" ; then
Packit Service c5cf8c
            threadLevelOK=no
Packit Service c5cf8c
        fi
Packit Service c5cf8c
	;;
Packit Service c5cf8c
	MPI_THREAD_SINGLE)
Packit Service c5cf8c
	;;
Packit Service c5cf8c
    esac
Packit Service c5cf8c
fi
Packit Service c5cf8c
if test "$threadLevelOK" != yes ; then
Packit Service c5cf8c
   AC_MSG_ERROR([The device $with_device does not support $MPICH_THREAD_LEVEL])
Packit Service c5cf8c
fi
Packit Service c5cf8c
Packit Service c5cf8c
export MPICH_THREAD_LEVEL
Packit Service c5cf8c
AC_DEFINE_UNQUOTED(MPICH_THREAD_LEVEL,$MPICH_THREAD_LEVEL,[Level of thread support selected at compile time])
Packit Service c5cf8c
Packit Service c5cf8c
if test "$MPICH_THREAD_LEVEL" = "MPI_THREAD_MULTIPLE" ; then
Packit Service c5cf8c
   AC_DEFINE([MPICH_IS_THREADED],[1],[MPICH is configured to require thread safety])
Packit Service c5cf8c
fi
Packit Service c5cf8c
Packit Service c5cf8c
# If not in MPI_THREAD_SINGLE, we need -D_REENTRANT to get thread-safe "errno".
Packit Service c5cf8c
# Most POSIX systems provide this by default when using -lpthread, but we only use it in MPI_THREAD_MULTIPLE.
Packit Service c5cf8c
# Some systems (Solaris) still require an explicit define in any case.
Packit Service c5cf8c
if test "$MPICH_THREAD_LEVEL" != "MPI_THREAD_SINGLE"; then
Packit Service c5cf8c
    PAC_APPEND_FLAG([-D_REENTRANT], [CPPFLAGS])
Packit Service c5cf8c
fi
Packit Service c5cf8c
Packit Service c5cf8c
# Check for value thread_cs choice; set the refcount default if necessary
Packit Service c5cf8c
thread_granularity=MPICH_THREAD_GRANULARITY__SINGLE
Packit Service c5cf8c
thread_refcount=MPICH_REFCOUNT__NONE
Packit Service c5cf8c
if test "$enable_threads" = "multiple" ; then
Packit Service c5cf8c
    case $enable_thread_cs in 
Packit Service c5cf8c
    global)
Packit Service c5cf8c
    thread_granularity=MPICH_THREAD_GRANULARITY__GLOBAL
Packit Service c5cf8c
    if test "$enable_refcount" = "default" ; then enable_refcount=none ; fi
Packit Service c5cf8c
    ;;
Packit Service c5cf8c
    per-object|per_object)
Packit Service c5cf8c
    thread_granularity=MPICH_THREAD_GRANULARITY__POBJ
Packit Service c5cf8c
    if test "$enable_refcount" = "default" ; then enable_refcount=lock-free ; fi
Packit Service c5cf8c
    ;;
Packit Service c5cf8c
    per-vni|per_vni)
Packit Service c5cf8c
    thread_granularity=MPICH_THREAD_GRANULARITY__VNI
Packit Service c5cf8c
    if test "$enable_refcount" = "default" ; then enable_refcount=lock-free ; fi
Packit Service c5cf8c
    ;;
Packit Service c5cf8c
    lock-free|lock_free|lockfree)
Packit Service c5cf8c
    thread_granularity=MPICH_THREAD_GRANULARITY__LOCKFREE
Packit Service c5cf8c
    if test "$enable_refcount" = "default" ; then enable_refcount=lock-free ; fi
Packit Service c5cf8c
    if test "$enable_predefined_refcount" = "default" ; then enable_predefined_refcount=no ; fi
Packit Service c5cf8c
    AC_MSG_ERROR([--enable-thread-cs=lock-free is not supported yet, please select a different granularity])
Packit Service c5cf8c
    ;;
Packit Service c5cf8c
    *)
Packit Service c5cf8c
    AC_MSG_ERROR([Unrecognized value $enable_thread_cs for --enable-thread-cs])
Packit Service c5cf8c
    ;;
Packit Service c5cf8c
    esac
Packit Service c5cf8c
Packit Service c5cf8c
    case $enable_refcount in
Packit Service c5cf8c
    lock-free|lock_free|lockfree)
Packit Service c5cf8c
    thread_refcount=MPICH_REFCOUNT__LOCKFREE
Packit Service c5cf8c
    ;;
Packit Service c5cf8c
    none)
Packit Service c5cf8c
    thread_refcount=MPICH_REFCOUNT__NONE
Packit Service c5cf8c
    ;;
Packit Service c5cf8c
    *)
Packit Service c5cf8c
    AC_MSG_ERROR([Unrecognized value $enable_refcount for --enable-refcount])
Packit Service c5cf8c
    ;;
Packit Service c5cf8c
    esac
Packit Service c5cf8c
fi
Packit Service c5cf8c
AC_DEFINE_UNQUOTED([MPICH_THREAD_GRANULARITY],$thread_granularity,[Method used to implement atomic updates and access])
Packit Service c5cf8c
Packit Service c5cf8c
if test "$thread_granularity" = "MPICH_THREAD_GRANULARITY__VNI" -a "$device_name" != "ch4" ; then
Packit Service c5cf8c
    AC_MSG_ERROR([per-vni critical section granularity is only supported for the ch4 device])
Packit Service c5cf8c
fi
Packit Service c5cf8c
Packit Service c5cf8c
if test "$enable_mdta" = "yes" ; then
Packit Service c5cf8c
    if test "$enable_threads" != "multiple" -o "$device_name" != "ch4" -o "$enable_thread_cs" != "global" ; then
Packit Service c5cf8c
        AC_MSG_ERROR([--enable-mdta is not supported for this setting])
Packit Service c5cf8c
    fi
Packit Service c5cf8c
fi
Packit Service c5cf8c
Packit Service c5cf8c
if test "$enable_predefined_refcount" = "no" ; then
Packit Service c5cf8c
    AC_DEFINE([MPICH_THREAD_SUPPRESS_PREDEFINED_REFCOUNTS],[1],[define to disable reference counting predefined objects like MPI_COMM_WORLD])
Packit Service c5cf8c
fi
Packit Service c5cf8c
Packit Service c5cf8c
AC_DEFINE_UNQUOTED([MPICH_THREAD_REFCOUNT],$thread_refcount,[Method used to implement refcount updates])
Packit Service c5cf8c
Packit Service c5cf8c
# enable-g
Packit Service c5cf8c
# strip off multiple options, separated by commas
Packit Service c5cf8c
save_IFS="$IFS"
Packit Service c5cf8c
IFS=","
Packit Service c5cf8c
for option in $enable_g ; do
Packit Service c5cf8c
    case "$option" in 
Packit Service c5cf8c
        debug|dbg)
Packit Service c5cf8c
        enable_append_g=yes
Packit Service c5cf8c
	;;
Packit Service c5cf8c
        no|none)
Packit Service c5cf8c
	;;
Packit Service c5cf8c
	handlealloc)
Packit Service c5cf8c
	perform_handlealloc=yes
Packit Service c5cf8c
	;;
Packit Service c5cf8c
	handle)
Packit Service c5cf8c
        perform_handle=yes
Packit Service c5cf8c
	;;
Packit Service c5cf8c
	meminit)
Packit Service c5cf8c
	perform_meminit=yes
Packit Service c5cf8c
	;;
Packit Service c5cf8c
	memarena)
Packit Service c5cf8c
	perform_memarena=yes
Packit Service c5cf8c
	perform_memtracing=yes
Packit Service c5cf8c
	;;
Packit Service c5cf8c
	mem)
Packit Service c5cf8c
	perform_memtracing=yes
Packit Service c5cf8c
	;;
Packit Service c5cf8c
	mutex)
Packit Service c5cf8c
	perform_dbgmutex=yes
Packit Service c5cf8c
	;;
Packit Service c5cf8c
	mutexnesting)
Packit Service c5cf8c
	perform_mutexnesting=yes
Packit Service c5cf8c
	;;
Packit Service c5cf8c
        most|yes)
Packit Service c5cf8c
        perform_memtracing=yes
Packit Service c5cf8c
        enable_append_g=yes
Packit Service c5cf8c
        perform_meminit=yes
Packit Service c5cf8c
        perform_dbgmutex=yes
Packit Service c5cf8c
        perform_mutexnesting=yes
Packit Service c5cf8c
        perform_handlealloc=yes
Packit Service c5cf8c
        perform_handle=yes
Packit Service c5cf8c
        ;;
Packit Service c5cf8c
	all)
Packit Service c5cf8c
        perform_memarena=yes
Packit Service c5cf8c
	perform_memtracing=yes
Packit Service c5cf8c
	enable_append_g=yes
Packit Service c5cf8c
	perform_meminit=yes
Packit Service c5cf8c
	perform_dbgmutex=yes
Packit Service c5cf8c
	perform_mutexnesting=yes
Packit Service c5cf8c
	perform_handlealloc=yes
Packit Service c5cf8c
        perform_handle=yes
Packit Service c5cf8c
	;;
Packit Service c5cf8c
	*)
Packit Service c5cf8c
	IFS=$save_IFS
Packit Service c5cf8c
	AC_MSG_WARN([Unknown value $option for enable-g])
Packit Service c5cf8c
	IFS=","
Packit Service c5cf8c
	;;
Packit Service c5cf8c
    esac
Packit Service c5cf8c
done
Packit Service c5cf8c
IFS="$save_IFS"
Packit Service c5cf8c
Packit Service c5cf8c
if test "$enable_append_g" = "yes" ; then
Packit Service c5cf8c
    PAC_APPEND_FLAG([-g],[CFLAGS])
Packit Service c5cf8c
    PAC_APPEND_FLAG([-g],[CXXFLAGS])
Packit Service c5cf8c
    PAC_APPEND_FLAG([-g],[FFLAGS])
Packit Service c5cf8c
    PAC_APPEND_FLAG([-g],[FCFLAGS])
Packit Service c5cf8c
    PAC_APPEND_FLAG([-g],[WRAPPER_CFLAGS])
Packit Service c5cf8c
    PAC_APPEND_FLAG([-g],[WRAPPER_CXXFLAGS])
Packit Service c5cf8c
    PAC_APPEND_FLAG([-g],[WRAPPER_FFLAGS])
Packit Service c5cf8c
    PAC_APPEND_FLAG([-g],[WRAPPER_FCFLAGS])
Packit Service c5cf8c
fi
Packit Service c5cf8c
if test -n "$perform_meminit" ; then
Packit Service c5cf8c
    AC_DEFINE(MPICH_DEBUG_MEMINIT,1,[Define to enable preinitialization of memory used by structures and unions])
Packit Service c5cf8c
fi
Packit Service c5cf8c
if test "$perform_handlealloc" = yes ; then
Packit Service c5cf8c
    AC_DEFINE(MPICH_DEBUG_HANDLEALLOC,1,[Define to enable checking of handles still allocated at MPI_Finalize])
Packit Service c5cf8c
fi
Packit Service c5cf8c
AS_IF([test "X$perform_handle" = "Xyes"],
Packit Service c5cf8c
      [AC_DEFINE(MPICH_DEBUG_HANDLES,1,[Define to enable handle checking])])
Packit Service c5cf8c
Packit Service c5cf8c
if test -n "$perform_memtracing" ; then
Packit Service c5cf8c
    enable_g_mem=yes
Packit Service c5cf8c
    AC_DEFINE(USE_MEMORY_TRACING,1,[Define to enable memory tracing])
Packit Service c5cf8c
    if test -n "$perform_memarena" ; then
Packit Service c5cf8c
        AC_DEFINE(MPICH_DEBUG_MEMARENA,1,[Define if each function exit should confirm memory arena correctness])
Packit Service c5cf8c
    fi
Packit Service c5cf8c
fi
Packit Service c5cf8c
Packit Service c5cf8c
if test -n "$perform_dbgmutex" ; then 
Packit Service c5cf8c
   AC_DEFINE(MPICH_DEBUG_MUTEX,1,[Define to enable mutex debugging])
Packit Service c5cf8c
fi
Packit Service c5cf8c
Packit Service c5cf8c
pac_cross_compiling=no
Packit Service c5cf8c
if test "$with_cross" != "no" ; then
Packit Service c5cf8c
    if test -s "$with_cross" ; then
Packit Service c5cf8c
        AC_MSG_RESULT([Reading values from cross-compilation file $with_cross])
Packit Service c5cf8c
        . $with_cross
Packit Service c5cf8c
	# Autoconf 2.52 no longer sets cross_compiling except with the
Packit Service c5cf8c
	# awkward "targethost" options.
Packit Service c5cf8c
	pac_cross_compiling=yes
Packit Service c5cf8c
	cross_compiling=yes
Packit Service c5cf8c
	ac_cv_prog_cc_cross=yes
Packit Service c5cf8c
	ac_cv_prog_f77_cross=yes
Packit Service c5cf8c
 	ac_cv_prog_fc_cross=yes
Packit Service c5cf8c
        ac_cv_prog_cxx_cross=yes
Packit Service c5cf8c
        export cross_compiling
Packit Service c5cf8c
	# Export all cross variables.  Any subsidiary configure should also
Packit Service c5cf8c
        # export CROSS_xxx
Packit Service c5cf8c
	rm -f confcross
Packit Service c5cf8c
	(set) 2>&1 | grep CROSS_ | \
Packit Service c5cf8c
	      sed -e 's/^/export /g' -e 's/=.*//g' > confcross
Packit Service c5cf8c
	. ./confcross
Packit Service c5cf8c
	rm -f confcross      
Packit Service c5cf8c
    fi
Packit Service c5cf8c
fi
Packit Service c5cf8c
Packit Service c5cf8c
# This goes here because we need the top_srcdir
Packit Service c5cf8c
if test "$enable_romio" = "yes" ; then
Packit Service c5cf8c
   if test -d $use_top_srcdir/src/mpi/romio ; then
Packit Service c5cf8c
       subsystems="$subsystems src/mpi/romio"
Packit Service c5cf8c
       AC_DEFINE(HAVE_ROMIO,1,[Define if ROMIO is enabled])
Packit Service c5cf8c
Packit Service c5cf8c
       # make it possible to "#include" mpio.h at build time
Packit Service c5cf8c
       #
Packit Service c5cf8c
       # This ought to be sufficient, but there is also a symlink setup in
Packit Service c5cf8c
       # src/include to accomodate current mpicc limitations.  See
Packit Service c5cf8c
       # src/mpi/Makefile.mk for more info.
Packit Service c5cf8c
       PAC_APPEND_FLAG([-I${master_top_builddir}/src/mpi/romio/include],[CPPFLAGS])
Packit Service c5cf8c
Packit Service c5cf8c
       # Set environment variables that the romio configure expects
Packit Service c5cf8c
       export use_top_srcdir
Packit Service c5cf8c
       top_build_dir=`pwd`
Packit Service c5cf8c
       export top_build_dir
Packit Service c5cf8c
       # if there is no $top_build_dir/lib, romio puts lib in wrong place
Packit Service c5cf8c
       # This test used -e under Linux, but not all test programs understand
Packit Service c5cf8c
       # -e
Packit Service c5cf8c
       if test ! -d lib ; then mkdir lib ; fi
Packit Service c5cf8c
       # tell mpi.h to include mpio.h
Packit Service c5cf8c
       PAC_HAVE_ROMIO
Packit Service c5cf8c
   else
Packit Service c5cf8c
       AC_MSG_WARN([ROMIO src directory is not available])
Packit Service c5cf8c
   fi
Packit Service c5cf8c
fi
Packit Service c5cf8c
Packit Service c5cf8c
AM_CONDITIONAL([BUILD_ROMIO], [test x$enable_romio = xyes])
Packit Service c5cf8c
Packit Service c5cf8c
#
Packit Service c5cf8c
# FIXME: If an external device, don't necessarily complain (e.g.,
Packit Service c5cf8c
# if the device is already built)
Packit Service c5cf8c
if test ! -d $devicedir ; then
Packit Service c5cf8c
    AC_MSG_ERROR([Device $device_name is unknown])
Packit Service c5cf8c
elif test -f $devicedir/subconfigure.m4 ; then
Packit Service c5cf8c
    # this is a new-style subconfigure device, don't add it as a subsystem
Packit Service c5cf8c
    :
Packit Service c5cf8c
elif test ! -x $devicedir/configure ; then
Packit Service c5cf8c
    if test -s $devicedir/configure ; then
Packit Service c5cf8c
        AC_MSG_WARN([The configure in $devicedir exists but is not executable])
Packit Service c5cf8c
    else
Packit Service c5cf8c
        AC_MSG_WARN([Device $device_name has no configure])
Packit Service c5cf8c
    fi
Packit Service c5cf8c
    device_name=""
Packit Service c5cf8c
else 
Packit Service c5cf8c
    # Add the device to the configure list
Packit Service c5cf8c
    devsubsystems="$devsubsystems $devicereldir"
Packit Service c5cf8c
    # Make device_name available to subdirs
Packit Service c5cf8c
fi
Packit Service c5cf8c
Packit Service c5cf8c
PAC_SET_HEADER_LIB_PATH(pmix)
Packit Service c5cf8c
if test -n "${with_pmix}" -a "${with_pmix}" != "no" ; then
Packit Service c5cf8c
    # disable built-in PMI and process managers
Packit Service c5cf8c
    with_pmi="no"
Packit Service c5cf8c
    with_pm="no"
Packit Service c5cf8c
    if test "${device_name}" != "ch4" ; then
Packit Service c5cf8c
        AC_MSG_ERROR([$device_name does not support PMIx])
Packit Service c5cf8c
    fi
Packit Service c5cf8c
    PAC_PUSH_FLAG([LIBS])
Packit Service c5cf8c
    PAC_CHECK_HEADER_LIB_FATAL(pmix, pmix.h, pmix, PMIx_Init)
Packit Service c5cf8c
    PAC_APPEND_FLAG([-lpmix],[WRAPPER_LIBS])
Packit Service c5cf8c
    PAC_POP_FLAG([LIBS])
Packit Service c5cf8c
    AC_DEFINE(USE_PMIX_API, 1, [Define if PMIx API must be used])
Packit Service c5cf8c
fi
Packit Service c5cf8c
Packit Service c5cf8c
# with-pm
Packit Service c5cf8c
if test "$with_pm" = "none" ; then
Packit Service c5cf8c
    # add "none" as synonym for "no" to agree with older erroneous docs
Packit Service c5cf8c
    with_pm="no"
Packit Service c5cf8c
fi
Packit Service c5cf8c
if test "$MPID_NO_PM" = yes ; then
Packit Service c5cf8c
    if test "$with_pm" != "default" -a "$with_pm" != no ; then
Packit Service c5cf8c
        AC_MSG_ERROR([The PM chosen ($with_pm) is is not valid for the selected device ($with_device)])
Packit Service c5cf8c
    fi
Packit Service c5cf8c
    # This is used to change with_pm=default to with_pm=no in the case
Packit Service c5cf8c
    # where the device does not want a PM
Packit Service c5cf8c
    with_pm=no
Packit Service c5cf8c
fi
Packit Service c5cf8c
if test -z "$with_pm" ; then
Packit Service c5cf8c
    with_pm="no"
Packit Service c5cf8c
fi
Packit Service c5cf8c
if test "$with_pmi" = "uni" -a "$with_pm" = "default" ; then
Packit Service c5cf8c
    with_pm="no"
Packit Service c5cf8c
fi
Packit Service c5cf8c
if test "$with_pm" = "default" -o "$with_pm" = "yes" ; then
Packit Service c5cf8c
   if test ! -z "$MPID_DEFAULT_PM" ; then
Packit Service c5cf8c
      with_pm=${MPID_DEFAULT_PM}
Packit Service c5cf8c
   else
Packit Service c5cf8c
      with_pm=hydra
Packit Service c5cf8c
   fi
Packit Service c5cf8c
fi
Packit Service c5cf8c
Packit Service c5cf8c
# We allow multiple pm names, separated by : or ,
Packit Service c5cf8c
if test "$with_pm" != "no" ; then
Packit Service c5cf8c
    pm_names="`echo $with_pm | sed -e 's/:/ /g' -e 's/,/ /g'`"
Packit Service c5cf8c
else
Packit Service c5cf8c
    pm_names=""
Packit Service c5cf8c
fi
Packit Service c5cf8c
#
Packit Service c5cf8c
hasError=no
Packit Service c5cf8c
# We need to be careful about PM's that have either conflicting 
Packit Service c5cf8c
# requirements (e.g., different PMI implementations) or different
Packit Service c5cf8c
# optional features (e.g., MPID_PM_NAMESERVER).
Packit Service c5cf8c
# In addition, we need to interleave the setup of the PMI and PM
Packit Service c5cf8c
# modules.  The order is as follows:
Packit Service c5cf8c
#
Packit Service c5cf8c
# For each PM, execute the mpichprereq script for that pm (if present).  
Packit Service c5cf8c
# This script provides information about the PM, including which PMI
Packit Service c5cf8c
# implementations are supported.
Packit Service c5cf8c
# 
Packit Service c5cf8c
# Then, for the selected PMI, the setup script (if any) is run.  This is
Packit Service c5cf8c
# necessary because the setup of the PM may require information discovered
Packit Service c5cf8c
# or provided duing the PMI setup step.
Packit Service c5cf8c
#
Packit Service c5cf8c
# Finally, for each PM, the setup script is executed.
Packit Service c5cf8c
# 
Packit Service c5cf8c
# Step 1: invoke the mpichprereq for each PM
Packit Service c5cf8c
for pm_name in $pm_names ; do
Packit Service c5cf8c
    if test -z "$first_pm_name" ; then
Packit Service c5cf8c
       first_pm_name=$pm_name
Packit Service c5cf8c
       export first_pm_name
Packit Service c5cf8c
    fi
Packit Service c5cf8c
    if test ! -d $use_top_srcdir/src/pm/$pm_name ; then
Packit Service c5cf8c
        AC_MSG_WARN([$use_top_srcdir/src/pm/$pm_name does not exist. PM is unknown])
Packit Service c5cf8c
	hasError=yes
Packit Service c5cf8c
    elif test ! -x $use_top_srcdir/src/pm/$pm_name/configure -a \
Packit Service c5cf8c
              ! -f $use_top_srcdir/src/pm/$pm_name/subconfigure.m4 ; then
Packit Service c5cf8c
        if test -s $use_top_srcdir/src/pm/$pm_name/configure ; then
Packit Service c5cf8c
	    AC_MSG_WARN([The configure in $use_top_srcdir/src/pm/$pm_name exists but is not executable])
Packit Service c5cf8c
        else
Packit Service c5cf8c
            AC_MSG_WARN([pm $pm_name has no configure or subconfigure.m4])
Packit Service c5cf8c
        fi
Packit Service c5cf8c
        pm_name=""
Packit Service c5cf8c
	hasError=yes
Packit Service c5cf8c
    else
Packit Service c5cf8c
	nameserver=$MPID_PM_NAMESERVER
Packit Service c5cf8c
        if test -f $use_top_srcdir/src/pm/$pm_name/mpichprereq ; then 
Packit Service c5cf8c
	    echo sourcing $use_top_srcdir/src/pm/$pm_name/mpichprereq
Packit Service c5cf8c
	    . $use_top_srcdir/src/pm/$pm_name/mpichprereq
Packit Service c5cf8c
	fi
Packit Service c5cf8c
	# Check for a change; if found, we'll take the default
Packit Service c5cf8c
	if test "$MPID_PM_NAMESERVER" != "$nameserver" ; then
Packit Service c5cf8c
            if test "$first_pm_name" != "$pm_name" ; then
Packit Service c5cf8c
	        # Reject suggestion (use the default, common mode)
Packit Service c5cf8c
		MPID_PM_NAMESERVER=""
Packit Service c5cf8c
	    fi
Packit Service c5cf8c
	fi
Packit Service c5cf8c
    fi
Packit Service c5cf8c
done
Packit Service c5cf8c
if test "$hasError" != no ; then
Packit Service c5cf8c
    AC_MSG_ERROR([Aborting configure because an error was seen in the selection of process managers])
Packit Service c5cf8c
fi
Packit Service c5cf8c
#
Packit Service c5cf8c
# pm_name is the *primary* pm
Packit Service c5cf8c
pm_name=$first_pm_name
Packit Service c5cf8c
AC_SUBST(pm_name)
Packit Service c5cf8c
Packit Service c5cf8c
# Step 2:
Packit Service c5cf8c
# Once we've selected the process manager (or managers), we can
Packit Service c5cf8c
# check that we have a compatible PMI implemenatation.
Packit Service c5cf8c
# with-pmi
Packit Service c5cf8c
if test "$with_pmi" != "no" ; then
Packit Service c5cf8c
    if test "$with_pmi" = "default" -o "$with_pmi" = "yes" ; then
Packit Service c5cf8c
        if test -n "$PM_REQUIRES_PMI" ; then
Packit Service c5cf8c
	    with_pmi=$PM_REQUIRES_PMI
Packit Service c5cf8c
        else
Packit Service c5cf8c
            with_pmi=simple
Packit Service c5cf8c
        fi
Packit Service c5cf8c
    elif test -n "$PM_REQUIRES_PMI" ; then
Packit Service c5cf8c
        # Test for compatibility between pm and pmi choices
Packit Service c5cf8c
        if test "$PM_REQUIRES_PMI" != "$with_pmi" ; then
Packit Service c5cf8c
	    AC_MSG_ERROR([The PM chosen ($with_pm) requires the PMI implementation $PM_REQUIRES_PMI but $with_pmi was selected as the PMI implementation.])
Packit Service c5cf8c
        fi
Packit Service c5cf8c
    fi
Packit Service c5cf8c
    pmi_name=$with_pmi
Packit Service c5cf8c
    
Packit Service c5cf8c
    if test ! -d $use_top_srcdir/src/pmi/$pmi_name ; then
Packit Service c5cf8c
        AC_MSG_WARN([$use_top_srcdir/src/pmi/$pmi_name does not exist. PMI is unknown])
Packit Service c5cf8c
    elif test ! -x $use_top_srcdir/src/pmi/$pmi_name/configure ; then
Packit Service c5cf8c
        if test ! -f $use_top_srcdir/src/pmi/$pmi_name/subconfigure.m4 ; then
Packit Service c5cf8c
            AC_MSG_WARN([pmi $pmi_name has no configure or subconfigure.m4])
Packit Service c5cf8c
            pmi_name=""
Packit Service c5cf8c
        fi
Packit Service c5cf8c
    else
Packit Service c5cf8c
        # only add to subsystems if a full configure is present
Packit Service c5cf8c
        subsystems="$subsystems src/pmi/$pmi_name"
Packit Service c5cf8c
    fi
Packit Service c5cf8c
fi
Packit Service c5cf8c
Packit Service c5cf8c
# Step 3: complete pm setup.
Packit Service c5cf8c
# Note that checks for errors have already been performed, so this
Packit Service c5cf8c
# loop does not need to perform any extra error checks.
Packit Service c5cf8c
# Note that this uses this_pm_name because pm_name must be the *first*
Packit Service c5cf8c
# of the PM names
Packit Service c5cf8c
for this_pm_name in $pm_names ; do
Packit Service c5cf8c
    # only add the PM to the subsystems if it has a full configure to be
Packit Service c5cf8c
    # executed
Packit Service c5cf8c
    if test -f $use_top_srcdir/src/pm/$this_pm_name/configure ; then
Packit Service c5cf8c
        subsystems="$subsystems src/pm/$this_pm_name"
Packit Service c5cf8c
    fi
Packit Service c5cf8c
    if test -f $use_top_srcdir/src/pm/$this_pm_name/setup_pm ; then 
Packit Service c5cf8c
	echo sourcing $use_top_srcdir/src/pm/$this_pm_name/setup_pm
Packit Service c5cf8c
	. $use_top_srcdir/src/pm/$this_pm_name/setup_pm
Packit Service c5cf8c
    fi
Packit Service c5cf8c
done
Packit Service c5cf8c
Packit Service c5cf8c
# Check for whether the compiler defines a symbol that contains the 
Packit Service c5cf8c
# function name.  The MPICH code, for greater portability, defines
Packit Service c5cf8c
# its own symbols, FCNAME (a string) and FUNCNAME (a token that is not a 
Packit Service c5cf8c
# string).  Code should use these symbols where possible.  However, 
Packit Service c5cf8c
# some debugging macros may want to use a compiler-provided symbol
Packit Service c5cf8c
# for the function name, and this check makes it possible to 
Packit Service c5cf8c
# define such macros in a way that is always correct.
Packit Service c5cf8c
PAC_CC_FUNCTION_NAME_SYMBOL
Packit Service c5cf8c
Packit Service c5cf8c
# Check if $MPI_DEFAULT_COPTS is valid with $CC
Packit Service c5cf8c
if test -n "$MPI_DEFAULT_COPTS" ; then
Packit Service c5cf8c
    if test "$enable_check_compiler_flags" = "yes" ; then
Packit Service c5cf8c
        PAC_C_CHECK_COMPILER_OPTION( [$MPI_DEFAULT_COPTS], [
Packit Service c5cf8c
        CFLAGS="$CFLAGS $MPI_DEFAULT_COPTS"
Packit Service c5cf8c
                                   ] )
Packit Service c5cf8c
    else
Packit Service c5cf8c
        CFLAGS="$CFLAGS $MPI_DEFAULT_COPTS"
Packit Service c5cf8c
    fi
Packit Service c5cf8c
fi
Packit Service c5cf8c
Packit Service c5cf8c
# ---------------------------------------------------------------------------
Packit Service c5cf8c
# determine rpath and other shared library flags for CC
Packit Service c5cf8c
# src/env may not exist yet in a vpath build
Packit Service c5cf8c
$MKDIR_P src/env
Packit Service c5cf8c
cc_shlib_conf=src/env/cc_shlib.conf
Packit Service c5cf8c
PAC_COMPILER_SHLIB_FLAGS([CC],[$cc_shlib_conf])
Packit Service c5cf8c
AC_SUBST_FILE([cc_shlib_conf])
Packit Service c5cf8c
Packit Service c5cf8c
# output rpath flags in a usable format for mpich.pc (pkg-config)
Packit Service c5cf8c
if test "X$enable_wrapper_rpath" = "Xyes"; then
Packit Service c5cf8c
    eval WRAPPER_RPATH_LDFLAGS=\"$hardcode_libdir_flag_spec\"
Packit Service c5cf8c
fi
Packit Service c5cf8c
AC_SUBST(WRAPPER_RPATH_LDFLAGS)
Packit Service c5cf8c
Packit Service c5cf8c
# ---------------------------------------------------------------------------
Packit Service c5cf8c
# Support for MPI_T performance variables
Packit Service c5cf8c
Packit Service c5cf8c
# enable-mpit-pvars
Packit Service c5cf8c
# strip off multiple options, separated by commas
Packit Service c5cf8c
save_IFS="$IFS"
Packit Service c5cf8c
IFS=","
Packit Service c5cf8c
for var in $enable_mpit_pvars ; do
Packit Service c5cf8c
    AS_CASE(["$var"],
Packit Service c5cf8c
            [nem],[enable_pvar_nem=yes],
Packit Service c5cf8c
            [recvq],[enable_pvar_recvq=yes],
Packit Service c5cf8c
            [rma],[enable_pvar_rma=yes],
Packit Service c5cf8c
	    [dims],[enable_pvar_dims=yes],
Packit Service c5cf8c
            [all|yes],
Packit Service c5cf8c
            [enable_pvar_nem=yes
Packit Service c5cf8c
             enable_pvar_recvq=yes
Packit Service c5cf8c
             enable_pvar_rma=yes
Packit Service c5cf8c
	     enable_pvar_dims=yes
Packit Service c5cf8c
	     ],
Packit Service c5cf8c
            [no|none],[],
Packit Service c5cf8c
            [IFS=$save_IFS
Packit Service c5cf8c
             AC_MSG_WARN([Unknown value ($option) for enable-mpit-pvars])
Packit Service c5cf8c
             IFS=","])
Packit Service c5cf8c
done
Packit Service c5cf8c
IFS="$save_IFS"
Packit Service c5cf8c
Packit Service c5cf8c
if test -n "$enable_pvar_nem" ; then
Packit Service c5cf8c
    status_nem_pvars=1
Packit Service c5cf8c
else
Packit Service c5cf8c
    status_nem_pvars=0
Packit Service c5cf8c
fi
Packit Service c5cf8c
AC_DEFINE_UNQUOTED(ENABLE_PVAR_NEM,$status_nem_pvars,
Packit Service c5cf8c
          [Define to 1 to enable nemesis-related MPI_T performance variables])
Packit Service c5cf8c
Packit Service c5cf8c
if test -n "$enable_pvar_recvq" ; then
Packit Service c5cf8c
    status_recvq_pvars=1
Packit Service c5cf8c
else
Packit Service c5cf8c
    status_recvq_pvars=0
Packit Service c5cf8c
fi
Packit Service c5cf8c
AC_DEFINE_UNQUOTED(ENABLE_PVAR_RECVQ,$status_recvq_pvars,
Packit Service c5cf8c
          [Define to 1 to enable message receive queue-related MPI_T performance variables])
Packit Service c5cf8c
Packit Service c5cf8c
if test -n "$enable_pvar_rma" ; then
Packit Service c5cf8c
    status_rma_pvars=1
Packit Service c5cf8c
else
Packit Service c5cf8c
    status_rma_pvars=0
Packit Service c5cf8c
fi
Packit Service c5cf8c
AC_DEFINE_UNQUOTED(ENABLE_PVAR_RMA,$status_rma_pvars,
Packit Service c5cf8c
          [Define to 1 to enable rma-related MPI_T performance variables])
Packit Service c5cf8c
Packit Service c5cf8c
if test -n "$enable_pvar_dims" ; then
Packit Service c5cf8c
    status_dims_pvars=1
Packit Service c5cf8c
else
Packit Service c5cf8c
    status_dims_pvars=0
Packit Service c5cf8c
fi
Packit Service c5cf8c
AC_DEFINE_UNQUOTED(ENABLE_PVAR_DIMS,$status_dims_pvars,
Packit Service c5cf8c
          [Define to 1 to enable getdims-related MPI_T performance variables])
Packit Service c5cf8c
# ---------------------------------------------------------------------------
Packit Service c5cf8c
# Support for the language bindings: Fortran 77, Fortran 90, and C++
Packit Service c5cf8c
#
Packit Service c5cf8c
# First, we handle the case of no explicit enable/disable option.  In that
Packit Service c5cf8c
# case, we look for a usable compiler.  We cannot use the ac macros for this
Packit Service c5cf8c
# because they abort the configure step if they fail to find a compiler 
Packit Service c5cf8c
# (earlier versions of autoconf did not have this behavior!).
Packit Service c5cf8c
#
Packit Service c5cf8c
# Second, we perform the langugage-specific tests, if necessary.  This may
Packit Service c5cf8c
# be relatively simple (C++) or complex (Fortran 77, including formation of 
Packit Service c5cf8c
# the encoded MPI handles).
Packit Service c5cf8c
#
Packit Service c5cf8c
# Note that the bindings support needs to know some of the properties of
Packit Service c5cf8c
# the C compiler, so those tests (particularly for weak symbols)
Packit Service c5cf8c
# must come first.
Packit Service c5cf8c
# ----------------------------------------------------------------------------
Packit Service c5cf8c
Packit Service c5cf8c
#
Packit Service c5cf8c
# First, determine whether we are/can support the language bindings
Packit Service c5cf8c
#
Packit Service c5cf8c
# Since F90/F90FLAGS are replaced by FC/FCFLAGS, rather than silently
Packit Service c5cf8c
# substituting them, i.e. FC=$F90 and FCFLAGS=$F90FLAGS, we choose to emit
Packit Service c5cf8c
# an error message and abort to avoid any ambiguous/hidden bug in choosing
Packit Service c5cf8c
# Fortran90 compilers.
Packit Service c5cf8c
if test -n "$F90" -o -n "$F90FLAGS" ; then
Packit Service c5cf8c
    AC_MSG_ERROR([F90 and F90FLAGS are replaced by FC and FCFLAGS respectively in this configure, please unset F90/F90FLAGS and set FC/FCFLAGS instead and rerun configure again.])
Packit Service c5cf8c
fi
Packit Service c5cf8c
# ----------------------------------------------------------------------------
Packit Service c5cf8c
# Handle default choices for the Fortran compilers
Packit Service c5cf8c
# Note that these have already been set above
Packit Service c5cf8c
Packit Service c5cf8c
if test "$enable_f77" = "yes"; then
Packit Service c5cf8c
    if test "$F77" = "" -o "$F77" = "no"; then
Packit Service c5cf8c
        # No Fortran 77 compiler found; abort
Packit Service c5cf8c
        AC_MSG_ERROR([No Fortran 77 compiler found. If you don't need to
Packit Service c5cf8c
        build any Fortran programs, you can disable Fortran support using
Packit Service c5cf8c
        --disable-fortran. If you do want to build Fortran
Packit Service c5cf8c
        programs, you need to install a Fortran compiler such as gfortran
Packit Service c5cf8c
        or ifort before you can proceed.])
Packit Service c5cf8c
    fi
Packit Service c5cf8c
fi
Packit Service c5cf8c
Packit Service c5cf8c
if test "$enable_f77" = yes ; then
Packit Service c5cf8c
    # Check if $MPI_DEFAULT_FOPTS is valid with $F77
Packit Service c5cf8c
    if test -n "$MPI_DEFAULT_FOPTS" ; then
Packit Service c5cf8c
        if test "$enable_check_compiler_flags" = "yes" ; then
Packit Service c5cf8c
            PAC_F77_CHECK_COMPILER_OPTION( [$MPI_DEFAULT_FOPTS], [
Packit Service c5cf8c
            FFLAGS="$FFLAGS $MPI_DEFAULT_FOPTS"
Packit Service c5cf8c
                                         ] )
Packit Service c5cf8c
        else
Packit Service c5cf8c
            FFLAGS="$FFLAGS $MPI_DEFAULT_FOPTS"
Packit Service c5cf8c
        fi
Packit Service c5cf8c
    fi
Packit Service c5cf8c
fi
Packit Service c5cf8c
Packit Service c5cf8c
#
Packit Service c5cf8c
# We need to know the name mangling for Fortran before testing for FC
Packit Service c5cf8c
# compatibility (we need this because of the way we decide to generate
Packit Service c5cf8c
# the Fortran 77 bindings)
Packit Service c5cf8c
if test "$enable_f77" = yes ; then
Packit Service c5cf8c
    FLIBS_save="$FLIBS"
Packit Service c5cf8c
    FLIBS=""
Packit Service c5cf8c
    AC_F77_LIBRARY_LDFLAGS
Packit Service c5cf8c
    # The autoconf macro for finding FLIBS sometimes makes mistakes
Packit Service c5cf8c
    # (particularly with the Fujitsu frt compiler).  This next step
Packit Service c5cf8c
    # first sees if the FLIBS is valid with the Fortran compiler
Packit Service c5cf8c
    PAC_PROG_F77_FLIBS_VALID
Packit Service c5cf8c
    # Now see if FLIBS works with the C compiler
Packit Service c5cf8c
    PAC_PROG_F77_CHECK_FLIBS
Packit Service c5cf8c
Packit Service c5cf8c
    # Check F77+FLAGS is compatible with CC+CFLAGS before using F77+CC.
Packit Service c5cf8c
    PAC_PROG_F77_OBJ_LINKS_WITH_C
Packit Service c5cf8c
Packit Service c5cf8c
    PAC_PROG_F77_LINKER_WITH_C
Packit Service c5cf8c
    # For name mangle, we need the library flags
Packit Service c5cf8c
    PAC_PROG_F77_NAME_MANGLE
Packit Service c5cf8c
    # Check whether additional libraries are needed when linking with C
Packit Service c5cf8c
    PAC_PROG_F77_AND_C_STDIO_LIBS
Packit Service c5cf8c
    AC_SUBST(F77_OTHER_LIBS)
Packit Service c5cf8c
Packit Service c5cf8c
    # Warn about mixed name mangling, since many of the tests will fail
Packit Service c5cf8c
    if test "$pac_cv_prog_f77_name_mangle" = "mixed" ; then
Packit Service c5cf8c
        AC_MSG_WARN([The compiler $F77 uses mixed case names.  Fortran is monocase
Packit Service c5cf8c
and many Fortran programs may use either upper or lower case names for MPI
Packit Service c5cf8c
calls.  Consider specifying a particular parameter to your Fortran compiler
Packit Service c5cf8c
to select either upper or lower case names.  For the Absoft compiler, 
Packit Service c5cf8c
-f selects lower case and -N109 selects upper case (if you use -f, also use 
Packit Service c5cf8c
-B108 to enable the iargc and getarg routines, which are needed for some
Packit Service c5cf8c
tests and by many user programs).  Specify new command
Packit Service c5cf8c
line options by setting the environment variable FFLAGS to include
Packit Service c5cf8c
the options (e.g., setenv FFLAGS "-f -B108").  In addition, make sure that your
Packit Service c5cf8c
Fortran 90 compiler uses a compatible naming choice.  For the 
Packit Service c5cf8c
Absoft Fortran 90, -YALL_NAMES=LCS selects lower case names and -B108 
Packit Service c5cf8c
adds underscores to names, as required for iargc and getarg.  Pass this
Packit Service c5cf8c
information to configure with the FCFLAGS environment variable.])
Packit Service c5cf8c
        # If Fortran implicitly enabled, disable it now.  Otherwise,
Packit Service c5cf8c
	# abort the configure since warning messages are often lost in
Packit Service c5cf8c
	# the output.
Packit Service c5cf8c
	AC_MSG_ERROR([Aborting configure because of mixed case names in Fortran.  Either select --disable-fortran or set FCFLAGS to force the compiler to select monocase names])
Packit Service c5cf8c
    fi
Packit Service c5cf8c
Packit Service c5cf8c
    # The MPI standard requires that MPI_Init in any language initialize
Packit Service c5cf8c
    # MPI in all languages.  This can be a problem when objects produced 
Packit Service c5cf8c
    # by the Fortran compiler require symbols from the Fortran runtime
Packit Service c5cf8c
    # (making linking C-only programs unnecessarily difficult).  What we test 
Packit Service c5cf8c
    # here is whether the much more restricted needs of the Fortran 
Packit Service c5cf8c
    # initialize can be met with no special use of the Fortran runtime
Packit Service c5cf8c
   PAC_F77_INIT_WORKS_WITH_C
Packit Service c5cf8c
   if test "$pac_f_init_works_with_c" = "yes" ; then
Packit Service c5cf8c
       AC_DEFINE(HAVE_MPI_F_INIT_WORKS_WITH_C,1,[Define if the Fortran init code for MPI works from C programs without special libraries])
Packit Service c5cf8c
   fi
Packit Service c5cf8c
Packit Service c5cf8c
   #
Packit Service c5cf8c
   # Some Fortran compilers now pass CHARACTER length as a size_t instead
Packit Service c5cf8c
   # of as an int.  This is hard to test for, since the data is passed by
Packit Service c5cf8c
   # value and for characters less than about 2GB long, the correct
Packit Service c5cf8c
   # value will be used.  In this case, we must use an approach similar to
Packit Service c5cf8c
   # the one used by libtool for shared library options - look at the
Packit Service c5cf8c
   # compiler name or vendor.
Packit Service c5cf8c
   # Known compilers that use size_t instead of int:
Packit Service c5cf8c
   #    Intel Fortran
Packit Service c5cf8c
   #    gfortran
Packit Service c5cf8c
   # Add others as they become known
Packit Service c5cf8c
   AC_ARG_ENABLE(f77characterlen,
Packit Service c5cf8c
       AC_HELP_STRING([--enable-f77characterlen],
Packit Service c5cf8c
           [Select between int and size_t for the length of a Fortran CHARACTER, depending on the F77 compiler.  If --enable-f77characterlen=size_t is given, force the use of size_t.  This is used for passing Fortran CHARACTER data between C and Fortran, and is provided for experts.  Note that the documentation provided by compiler vendors on the calling convention may not be accurate.]),,enable_f77characterlen=no)
Packit Service c5cf8c
Packit Service c5cf8c
   # Set the default
Packit Service c5cf8c
   f77_uses_int_for_str=default
Packit Service c5cf8c
Packit Service c5cf8c
   case "$enable_f77characterlen" in
Packit Service c5cf8c
      yes|no)
Packit Service c5cf8c
      ;;
Packit Service c5cf8c
      size_t)
Packit Service c5cf8c
         f77_uses_int_for_str=no
Packit Service c5cf8c
	 enable_f77characterlen=yes
Packit Service c5cf8c
      ;;
Packit Service c5cf8c
      int)
Packit Service c5cf8c
         f77_uses_int_for_str=yes
Packit Service c5cf8c
	 enable_f77characterlen=yes
Packit Service c5cf8c
      ;;
Packit Service c5cf8c
      *)
Packit Service c5cf8c
      AC_MSG_ERROR([Invalid value provided for --enable-f77characterlen])
Packit Service c5cf8c
      ;;
Packit Service c5cf8c
   esac
Packit Service c5cf8c
Packit Service c5cf8c
   # If we might change the size (enable) and we haven't set the choice,
Packit Service c5cf8c
   # attempt to determine it from the compiler name.  Risky, but we haven't
Packit Service c5cf8c
   # found a reliable way to do this with test codes.
Packit Service c5cf8c
   if test "$enable_f77characterlen" = "yes" -a \
Packit Service c5cf8c
           "$f77_uses_int_for_str" = "default" ; then
Packit Service c5cf8c
       f77_uses_int_for_str=yes
Packit Service c5cf8c
       f77Basename=`basename $F77`
Packit Service c5cf8c
       case $f77Basename in
Packit Service c5cf8c
       ifort*)
Packit Service c5cf8c
       f77_uses_int_for_str=no
Packit Service c5cf8c
       ;;
Packit Service c5cf8c
       gfortran*)
Packit Service c5cf8c
       f77_uses_int_for_str=no
Packit Service c5cf8c
       ;;
Packit Service c5cf8c
       esac
Packit Service c5cf8c
   fi
Packit Service c5cf8c
   # This test is disabled for now.  Despite information in documentation
Packit Service c5cf8c
   # on gfortran, it appears to pass lengths as int, at least in some
Packit Service c5cf8c
   # builds (it used movl when tested in 2/2013).  Tests that failed
Packit Service c5cf8c
   # included infotestf.f, in a call to mpi_info_get.
Packit Service c5cf8c
   # Leave this as a place holder until a proper test can be determined.
Packit Service c5cf8c
   if test  "$enable_f77characterlen" = "yes" -a \
Packit Service c5cf8c
            "$f77_uses_int_for_str" = "no" ; then
Packit Service c5cf8c
       AC_DEFINE(USE_FORT_STR_LEN_SIZET,1,[Define if the length of a CHARACTER*(*) string in Fortran should be passed as size_t instead of int] )
Packit Service c5cf8c
   fi
Packit Service c5cf8c
Packit Service c5cf8c
fi
Packit Service c5cf8c
Packit Service c5cf8c
# FC requires F77 as well.  If the user disabled f77, do not run the
Packit Service c5cf8c
# next test; instead, drop into the warning message
Packit Service c5cf8c
# Set a default value for fc works with f77.  This value is
Packit Service c5cf8c
# set to no *only* if fc was selected but was not compatible with f77
Packit Service c5cf8c
fc_with_f77=yes
Packit Service c5cf8c
if test "$enable_fc" = "yes" -a "$enable_f77" = yes ; then
Packit Service c5cf8c
    enable_fc=no
Packit Service c5cf8c
    if test "$FC" != "no" ; then
Packit Service c5cf8c
	# If we allow multiple weak symbols, we should test a name
Packit Service c5cf8c
	# that does not contain an underscore.  The Fortran binding uses
Packit Service c5cf8c
	# this rule for enabling multiple weak symbols:
Packit Service c5cf8c
	# if defined(USE_WEAK_SYMBOLS) && !defined(USE_ONLY_MPI_NAMES) &&
Packit Service c5cf8c
	#    defined(HAVE_MULTIPLE_PRAGMA_WEAK) && 
Packit Service c5cf8c
	#    defined(F77_NAME_LOWER_2USCORE)
Packit Service c5cf8c
	# 
Packit Service c5cf8c
	testRoutine="t1_2"
Packit Service c5cf8c
	if test "$pac_cv_prog_c_multiple_weak_symbols" = "yes" -a \
Packit Service c5cf8c
               "$enable_weak_symbols" = "yes" -a \
Packit Service c5cf8c
	       "$pac_cv_prog_f77_name_mangle" = "lower doubleunderscore" ; then
Packit Service c5cf8c
	    testRoutine="t12"
Packit Service c5cf8c
        fi
Packit Service c5cf8c
        PAC_FC_AND_F77_COMPATIBLE(fc_with_f77=yes,fc_with_f77=no,$testRoutine)
Packit Service c5cf8c
        if test "$fc_with_f77" != yes ; then
Packit Service c5cf8c
	    enable_fc=no
Packit Service c5cf8c
	    AC_MSG_ERROR([The selected Fortran 90 compiler $FC does not work with the selected Fortran 77 compiler $F77.  Use the environment variables FC and F77 respectively to select compatible Fortran compilers.  The check here tests to see if a main program compiled with the Fortran 90 compiler can link with a subroutine compiled with the Fortran 77 compiler.])
Packit Service c5cf8c
        elif test "$fc_with_f77" = "yes" ; then
Packit Service c5cf8c
            # If we got here, there is a Fortran 90 compiler that we can use
Packit Service c5cf8c
            enable_fc=yes
Packit Service c5cf8c
        fi
Packit Service c5cf8c
    elif test "$pac_cv_prog_fc_works" = no; then
Packit Service c5cf8c
        AC_MSG_WARN([Use --disable-fc to keep configure from searching for a Fortran 90 compiler])
Packit Service c5cf8c
    fi
Packit Service c5cf8c
Packit Service c5cf8c
    if test "$enable_fc" = "yes"; then
Packit Service c5cf8c
        if test "$FC" = "no" -o "$FC" = ""; then
Packit Service c5cf8c
            # No Fortran 90 compiler found; abort
Packit Service c5cf8c
            AC_MSG_ERROR([No Fortran 90 compiler found. If you don't need
Packit Service c5cf8c
            to build any Fortran 90 programs, you can disable Fortran 90
Packit Service c5cf8c
            support using --disable-fc. If you do want to build Fortran 90
Packit Service c5cf8c
            programs, you need to install a Fortran 90 compiler such as
Packit Service c5cf8c
            gfortran or ifort before you can proceed.])
Packit Service c5cf8c
        fi
Packit Service c5cf8c
    fi
Packit Service c5cf8c
fi
Packit Service c5cf8c
Packit Service c5cf8c
if test "$enable_fc" = "yes" -a "$enable_f77" != "yes" ; then
Packit Service c5cf8c
   # Fortran 90 support requires compatible Fortran 77 support
Packit Service c5cf8c
   AC_MSG_ERROR([
Packit Service c5cf8c
Fortran 90 support requires compatible Fortran 77 support.
Packit Service c5cf8c
To force the use of the Fortran 90 compiler for Fortran 77,
Packit Service c5cf8c
do not use configure option --disable-fortran, and set the environment
Packit Service c5cf8c
variable F77 to the name of the Fortran 90 compiler, or \$FC.
Packit Service c5cf8c
If you do not want any Fortran support, use configure options
Packit Service c5cf8c
--disable-fortran.])
Packit Service c5cf8c
   # We should probably do the compatibility test as well
Packit Service c5cf8c
   enable_f77=yes
Packit Service c5cf8c
fi
Packit Service c5cf8c
Packit Service c5cf8c
# ----------------------------------------------------------------------------
Packit Service c5cf8c
# Now test for Fortran compiler characteristics
Packit Service c5cf8c
# ----------------------------------------------------------------------------
Packit Service c5cf8c
if test "$enable_f77" = "yes" ; then
Packit Service c5cf8c
    # determine rpath and other shared library flags for F77
Packit Service c5cf8c
    f77_shlib_conf=src/env/f77_shlib.conf
Packit Service c5cf8c
    PAC_COMPILER_SHLIB_FLAGS([F77],[$f77_shlib_conf])
Packit Service c5cf8c
    AC_SUBST_FILE([f77_shlib_conf])
Packit Service c5cf8c
Packit Service c5cf8c
    AC_LANG_FORTRAN77
Packit Service c5cf8c
    PAC_PROG_F77_EXCLAIM_COMMENTS(has_exclaim="yes",has_exclaim="no")
Packit Service c5cf8c
    PAC_PROG_F77_HAS_INCDIR(src)
Packit Service c5cf8c
    PAC_PROG_F77_LIBRARY_DIR_FLAG
Packit Service c5cf8c
Packit Service c5cf8c
    AC_SUBST(MPIFPMPI)
Packit Service c5cf8c
    if test "$MPI_WITH_PMPI" = "no" ; then
Packit Service c5cf8c
        # If the PMPI routines are not in the same library with the MPI
Packit Service c5cf8c
        # routines, we may need to remove the pmpi declarations
Packit Service c5cf8c
        PAC_PROG_F77_ALLOWS_UNUSED_EXTERNALS([MPIFPMPI=",PMPI_WTIME,PMPI_WTICK"],[
Packit Service c5cf8c
        MPIFPMPI=""; 
Packit Service c5cf8c
        AC_MSG_WARN([Removed PMPI_WTIME and PMPI_WTICK from mpif.h])])
Packit Service c5cf8c
    else
Packit Service c5cf8c
        MPIFPMPI=",PMPI_WTIME,PMPI_WTICK"
Packit Service c5cf8c
    fi
Packit Service c5cf8c
Packit Service c5cf8c
    # Once we have name mangle, we can try to limit the number of needed libs
Packit Service c5cf8c
    dnl F77_IN_C_LIBS is not needed currently because mpirinitf_() in setbotf.f
Packit Service c5cf8c
    dnl is called in initthread.c only when FLIBS is not needed to initialize
Packit Service c5cf8c
    dnl Fortran constants from a C main, See PAC_F77_INIT_WORKS_WITH_C.
Packit Service c5cf8c
    dnl PAC_PROG_F77_IN_C_LIBS
Packit Service c5cf8c
    dnl AC_SUBST(F77_IN_C_LIBS)
Packit Service c5cf8c
Packit Service c5cf8c
    # Most systems allow the Fortran compiler to process .F and .F90 files
Packit Service c5cf8c
    # using the C preprocessor.  However, some systems either do not
Packit Service c5cf8c
    # allow this or have serious bugs (OSF Fortran compilers have a bug
Packit Service c5cf8c
    # that generates an error message from cpp).  The following test
Packit Service c5cf8c
    # checks to see if .F works, and if not, whether "cpp -P -C" can be used
Packit Service c5cf8c
    # This is needed for Mac OSX 10.5
Packit Service c5cf8c
    PAC_F77_WORKS_WITH_CPP([F77CPP])
Packit Service c5cf8c
    AC_SUBST(F77CPP)
Packit Service c5cf8c
Packit Service c5cf8c
    # Check that the Fortran compiler will allow us to pass arguments
Packit Service c5cf8c
    # of different types (e.g., for MPI_Send)
Packit Service c5cf8c
    PAC_PROG_F77_MISMATCHED_ARGS(addarg,yes)
Packit Service c5cf8c
    if test "X$addarg" != "X" ; then
Packit Service c5cf8c
        # We could add the names of all of the MPI routines that 
Packit Service c5cf8c
        # accept different types.  Instead, we fail cleanly.  
Packit Service c5cf8c
        # Some Fortran compilers allow you to turn off checking for 
Packit Service c5cf8c
        # mismatched arguments for *all* routines.  Adding an argument
Packit Service c5cf8c
	# that turns off checking for *everything* is not something that 
Packit Service c5cf8c
	# configure should do - if the user wants this, they can follow
Packit Service c5cf8c
	# the instructions in the following error message.
Packit Service c5cf8c
	AC_MSG_ERROR([The Fortran compiler $F77 does not accept programs that call the same routine with arguments of different types without the option $addarg.  Rerun configure with FFLAGS=$addarg])
Packit Service c5cf8c
    fi
Packit Service c5cf8c
Packit Service c5cf8c
    bindings="$bindings f77"
Packit Service c5cf8c
    AC_DEFINE(HAVE_FORTRAN_BINDING,1,[Define if Fortran is supported])
Packit Service c5cf8c
    # Also define the name FORTRAN_BINDING for use in #if @FORTRAN_BINDING@..
Packit Service c5cf8c
    FORTRAN_BINDING=1
Packit Service c5cf8c
Packit Service c5cf8c
fi
Packit Service c5cf8c
Packit Service c5cf8c
dnl By modifying mpif.h to use ! for comments, it can work with many f90 
Packit Service c5cf8c
dnl compilers without creating a separate version.  
Packit Service c5cf8c
dnl Note that this is run AFTER the AC_OUTPUT actions
Packit Service c5cf8c
AC_OUTPUT_COMMANDS([if test "$enable_f77" = yes ; then 
Packit Service c5cf8c
if test "$has_exclaim" = "yes" ; then
Packit Service c5cf8c
    sed -e 's/^C/\!/g' src/binding/fortran/mpif_h/mpif.h > src/include/mpif.h
Packit Service c5cf8c
	cp src/include/mpif.h src/binding/fortran/mpif_h/mpif.h
Packit Service c5cf8c
else
Packit Service c5cf8c
    cp src/binding/fortran/mpif_h/mpif.h src/include
Packit Service c5cf8c
fi
Packit Service c5cf8c
if test "$has_fort_real8" = "yes" ; then
Packit Service c5cf8c
    sed -e 's/DOUBLE PRECISION/REAL*8/g' src/include/mpif.h > src/include/mpif.h.new
Packit Service c5cf8c
    mv src/include/mpif.h.new src/include/mpif.h
Packit Service c5cf8c
    cp src/include/mpif.h src/binding/fortran/mpif_h/mpif.h
Packit Service c5cf8c
fi
Packit Service c5cf8c
fi],
Packit Service c5cf8c
master_top_srcdir=$master_top_srcdir
Packit Service c5cf8c
enable_f77=$enable_f77
Packit Service c5cf8c
enable_fc=$enable_fc
Packit Service c5cf8c
has_exclaim=$has_exclaim
Packit Service c5cf8c
has_fort_real8=$pac_cv_fort_real8
Packit Service c5cf8c
includebuild_dir=$includebuild_dir
Packit Service c5cf8c
libbuild_dir=$libbuild_dir
Packit Service c5cf8c
bashWorks=$bashWorks)
Packit Service c5cf8c
Packit Service c5cf8c
if test "$enable_fc" = "yes" ; then
Packit Service c5cf8c
    if test "$enable_f77" != "yes" ; then
Packit Service c5cf8c
        AC_MSG_WARN([Fortran 90 requires Fortran 77])
Packit Service c5cf8c
        enable_fc=no
Packit Service c5cf8c
    else 
Packit Service c5cf8c
        bindingsubsystems="$bindingsubsystems src/binding/fortran/use_mpi"
Packit Service c5cf8c
        bindings="$bindings f90"
Packit Service c5cf8c
    fi
Packit Service c5cf8c
fi
Packit Service c5cf8c
Packit Service c5cf8c
f08_works=no
Packit Service c5cf8c
if test "$enable_fc" = "yes" ; then
Packit Service c5cf8c
    PAC_FC_2008_SUPPORT([f08_works=yes],[f08_works=no])
Packit Service c5cf8c
fi
Packit Service c5cf8c
AM_CONDITIONAL([BUILD_F08_BINDING], [test "$f08_works" = "yes"])
Packit Service c5cf8c
Packit Service c5cf8c
if test "$f08_works" = "yes" ; then
Packit Service c5cf8c
    status_f08_works=1
Packit Service c5cf8c
    bindings="$bindings f08"
Packit Service c5cf8c
else
Packit Service c5cf8c
    status_f08_works=0
Packit Service c5cf8c
fi
Packit Service c5cf8c
AC_DEFINE_UNQUOTED(HAVE_F08_BINDING, $status_f08_works, [Define to 1 to enable Fortran 2008 binding])
Packit Service c5cf8c
Packit Service c5cf8c
# Set defaults for these values so that the Makefile in src/bindings/f90
Packit Service c5cf8c
# is valid even if fc is not enabled (this is necessary for the 
Packit Service c5cf8c
# distclean target)
Packit Service c5cf8c
MPIMODNAME=mpi
Packit Service c5cf8c
MPICONSTMODNAME=mpi_constants
Packit Service c5cf8c
MPISIZEOFMODNAME=mpi_sizeofs
Packit Service c5cf8c
MPIBASEMODNAME=mpi_base
Packit Service c5cf8c
Packit Service c5cf8c
# F08 binding stuff
Packit Service c5cf8c
MPI_F08_LINK_CONSTANTS_NAME=mpi_f08_link_constants
Packit Service c5cf8c
PMPI_F08_NAME=pmpi_f08
Packit Service c5cf8c
MPI_F08_CALLBACKS_NAME=mpi_f08_callbacks
Packit Service c5cf8c
MPI_C_INTERFACE_NAME=mpi_c_interface
Packit Service c5cf8c
MPI_C_INTERFACE_GLUE_NAME=mpi_c_interface_glue
Packit Service c5cf8c
MPI_F08_TYPES_NAME=mpi_f08_types
Packit Service c5cf8c
MPI_C_INTERFACE_NOBUF_NAME=mpi_c_interface_nobuf
Packit Service c5cf8c
MPI_F08_COMPILE_CONSTANTS_NAME=mpi_f08_compile_constants
Packit Service c5cf8c
MPI_F08_NAME=mpi_f08
Packit Service c5cf8c
MPI_C_INTERFACE_TYPES_NAME=mpi_c_interface_types
Packit Service c5cf8c
MPI_C_INTERFACE_CDESC_NAME=mpi_c_interface_cdesc
Packit Service c5cf8c
Packit Service c5cf8c
if test "$enable_fc" = "yes" ; then
Packit Service c5cf8c
    # determine rpath and other shared library flags for FC
Packit Service c5cf8c
    fc_shlib_conf=src/env/fc_shlib.conf
Packit Service c5cf8c
    PAC_COMPILER_SHLIB_FLAGS([FC],[$fc_shlib_conf])
Packit Service c5cf8c
    AC_SUBST_FILE([fc_shlib_conf])
Packit Service c5cf8c
Packit Service c5cf8c
    # Determine characteristics of the Fortran 90 compiler
Packit Service c5cf8c
    # Find a Fortran 90 compiler.  Sets FC
Packit Service c5cf8c
    # Work around bug in autoconf that adds -g to FCFLAGS
Packit Service c5cf8c
    saveFCFLAGS="$FCFLAGS"
Packit Service c5cf8c
    dnl FIXME XXX DJG this needs to be reconciled with our separate use of
Packit Service c5cf8c
    dnl AC_PROG_FC earlier
Packit Service c5cf8c
    dnl PAC_PROG_FC
Packit Service c5cf8c
    PAC_PROG_FC_WORKS
Packit Service c5cf8c
    FCFLAGS=$saveFCFLAGS
Packit Service c5cf8c
    if test "$pac_cv_prog_fc_works" = no ; then 
Packit Service c5cf8c
        # Reject this compiler
Packit Service c5cf8c
        if test "$FC" != "no" ; then
Packit Service c5cf8c
            fc_rejected=yes
Packit Service c5cf8c
            oldFC="$FC"
Packit Service c5cf8c
            FC="no"
Packit Service c5cf8c
        fi
Packit Service c5cf8c
    fi
Packit Service c5cf8c
Packit Service c5cf8c
    # Determine the extension for Fortran 90 files (it isn't always .f90)
Packit Service c5cf8c
    FCEXT=$ac_fc_srcext
Packit Service c5cf8c
    AC_SUBST(FCEXT)
Packit Service c5cf8c
Packit Service c5cf8c
    if test "$FC" = "no" ; then
Packit Service c5cf8c
        if test "$fc_rejected" = "yes" ; then
Packit Service c5cf8c
            AC_MSG_ERROR([Could not find a usable Fortran 90 compiler.  The compiler $oldFC may be incompatible with the Fortran 77 compiler $F77; check the output of configure and consult the installation manuals])
Packit Service c5cf8c
        else
Packit Service c5cf8c
            AC_MSG_ERROR([Could not find a usable Fortran 90 compiler.])
Packit Service c5cf8c
        fi
Packit Service c5cf8c
    fi
Packit Service c5cf8c
Packit Service c5cf8c
    # Find the extension that this compiler uses for modules.
Packit Service c5cf8c
    # Sets FCMODEXT (and adds it to the list substed)
Packit Service c5cf8c
    # Sets FCMODINCFLAG (and adds it to the list substed)
Packit Service c5cf8c
    PAC_FC_MODULE
Packit Service c5cf8c
    AC_SUBST(FCMODINCSPEC)
Packit Service c5cf8c
    if test -z "$FCMODOUTFLAG" ; then
Packit Service c5cf8c
        AC_MSG_ERROR([FCMODOUTFLAG could not be determined but is critical for the current Fortran build system])
Packit Service c5cf8c
    fi
Packit Service c5cf8c
Packit Service c5cf8c
    if test "$pac_cv_fc_module_case" = "upper" ; then
Packit Service c5cf8c
        MPIMODNAME=MPI
Packit Service c5cf8c
        MPICONSTMODNAME=MPI_CONSTANTS
Packit Service c5cf8c
	MPISIZEOFMODNAME=MPI_SIZEOFS
Packit Service c5cf8c
	MPIBASEMODNAME=MPI_BASE
Packit Service c5cf8c
        MPI_F08_NAME=MPI_F08
Packit Service c5cf8c
        MPI_F08_LINK_CONSTANTS_NAME=MPI_F08_LINK_CONSTANTS
Packit Service c5cf8c
        MPI_F08_CALLBACKS_NAME=MPI_F08_CALLBACKS
Packit Service c5cf8c
        MPI_F08_TYPES_NAME=MPI_F08_TYPES
Packit Service c5cf8c
        MPI_F08_COMPILE_CONSTANTS_NAME=MPI_F08_COMPILE_CONSTANTS
Packit Service c5cf8c
        PMPI_F08_NAME=PMPI_F08
Packit Service c5cf8c
        MPI_C_INTERFACE_NAME=MPI_C_INTERFACE
Packit Service c5cf8c
        MPI_C_INTERFACE_NOBUF_NAME=MPI_C_INTERFACE_NOBUF
Packit Service c5cf8c
        MPI_C_INTERFACE_GLUE_NAME=MPI_C_INTERFACE_GLUE
Packit Service c5cf8c
        MPI_C_INTERFACE_TYPES_NAME=MPI_C_INTERFACE_TYPES
Packit Service c5cf8c
        MPI_C_INTERFACE_CDESC_NAME=MPI_C_INTERFACE_CDESC
Packit Service c5cf8c
    else
Packit Service c5cf8c
        MPIMODNAME=mpi
Packit Service c5cf8c
        MPICONSTMODNAME=mpi_constants
Packit Service c5cf8c
	MPISIZEOFMODNAME=mpi_sizeofs
Packit Service c5cf8c
	MPIBASEMODNAME=mpi_base
Packit Service c5cf8c
        MPI_F08_NAME=mpi_f08
Packit Service c5cf8c
        MPI_F08_LINK_CONSTANTS_NAME=mpi_f08_link_constants
Packit Service c5cf8c
        MPI_F08_CALLBACKS_NAME=mpi_f08_callbacks
Packit Service c5cf8c
        MPI_F08_TYPES_NAME=mpi_f08_types
Packit Service c5cf8c
        MPI_F08_COMPILE_CONSTANTS_NAME=mpi_f08_compile_constants
Packit Service c5cf8c
        PMPI_F08_NAME=pmpi_f08
Packit Service c5cf8c
        MPI_C_INTERFACE_NAME=mpi_c_interface
Packit Service c5cf8c
        MPI_C_INTERFACE_NOBUF_NAME=mpi_c_interface_nobuf
Packit Service c5cf8c
        MPI_C_INTERFACE_GLUE_NAME=mpi_c_interface_glue
Packit Service c5cf8c
        MPI_C_INTERFACE_TYPES_NAME=mpi_c_interface_types
Packit Service c5cf8c
        MPI_C_INTERFACE_CDESC_NAME=mpi_c_interface_cdesc
Packit Service c5cf8c
    fi
Packit Service c5cf8c
    AC_SUBST(MPIMODNAME)
Packit Service c5cf8c
    AC_SUBST(MPICONSTMODNAME)
Packit Service c5cf8c
    AC_SUBST(MPISIZEOFMODNAME)
Packit Service c5cf8c
    AC_SUBST(MPIBASEMODNAME)
Packit Service c5cf8c
Packit Service c5cf8c
    AC_SUBST(MPI_F08_NAME)
Packit Service c5cf8c
    AC_SUBST(MPI_F08_LINK_CONSTANTS_NAME)
Packit Service c5cf8c
    AC_SUBST(MPI_F08_CALLBACKS_NAME)
Packit Service c5cf8c
    AC_SUBST(MPI_F08_TYPES_NAME)
Packit Service c5cf8c
    AC_SUBST(MPI_F08_COMPILE_CONSTANTS_NAME)
Packit Service c5cf8c
    AC_SUBST(PMPI_F08_NAME)
Packit Service c5cf8c
    AC_SUBST(MPI_C_INTERFACE_NAME)
Packit Service c5cf8c
    AC_SUBST(MPI_C_INTERFACE_NOBUF_NAME)
Packit Service c5cf8c
    AC_SUBST(MPI_C_INTERFACE_GLUE_NAME)
Packit Service c5cf8c
    AC_SUBST(MPI_C_INTERFACE_TYPES_NAME)
Packit Service c5cf8c
    AC_SUBST(MPI_C_INTERFACE_CDESC_NAME)
Packit Service c5cf8c
Packit Service c5cf8c
    # Assume that all Fortran 90 compilers accept -I for include directories
Packit Service c5cf8c
    FCINC=-I
Packit Service c5cf8c
    AC_SUBST(FCINC)
Packit Service c5cf8c
    FCINCFLAG=-I
Packit Service c5cf8c
    AC_SUBST(FCINCFLAG)
Packit Service c5cf8c
Packit Service c5cf8c
    # Check if $MPI_DEFAULT_FCOPTS is valid with $F90
Packit Service c5cf8c
    if test -n "$MPI_DEFAULT_FCOPTS" ; then
Packit Service c5cf8c
        if test "$enable_check_compiler_flags" = "yes" ; then
Packit Service c5cf8c
            PAC_FC_CHECK_COMPILER_OPTION( [$MPI_DEFAULT_FCOPTS], [
Packit Service c5cf8c
            FCFLAGS="$FCFLAGS $MPI_DEFAULT_FCOPTS"
Packit Service c5cf8c
                                     ] )
Packit Service c5cf8c
        else
Packit Service c5cf8c
            FCFLAGS="$FCFLAGS $MPI_DEFAULT_FCOPTS"
Packit Service c5cf8c
        fi
Packit Service c5cf8c
    fi
Packit Service c5cf8c
Packit Service c5cf8c
    # Most systems allow the Fortran compiler to process .F and .F90 files
Packit Service c5cf8c
    # using the C preprocessor.  However, some systems either do not
Packit Service c5cf8c
    # allow this or have serious bugs (OSF Fortran compilers have a bug
Packit Service c5cf8c
    # that generates an error message from cpp).  The following test
Packit Service c5cf8c
    # checks to see if .F works, and if not, whether "cpp -P -C" can be used
Packit Service c5cf8c
    PAC_FC_WORKS_WITH_CPP([FCCPP])
Packit Service c5cf8c
    AC_SUBST(FCCPP)
Packit Service c5cf8c
Packit Service c5cf8c
    # Check whether additional libraries are needed when linking with C
Packit Service c5cf8c
    PAC_PROG_FC_AND_C_STDIO_LIBS
Packit Service c5cf8c
    AC_SUBST(FC_OTHER_LIBS)
Packit Service c5cf8c
    # ------------------------------------------------
Packit Service c5cf8c
fi
Packit Service c5cf8c
Packit Service c5cf8c
if test "X$modincdir" = "X" ; then
Packit Service c5cf8c
  modincdir=$includedir
Packit Service c5cf8c
fi
Packit Service c5cf8c
export modincdir
Packit Service c5cf8c
AC_SUBST(modincdir)
Packit Service c5cf8c
Packit Service c5cf8c
AC_LANG_PUSH([C])
Packit Service c5cf8c
AC_MSG_CHECKING([whether TRUE has been defined])
Packit Service c5cf8c
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[return TRUE;])],
Packit Service c5cf8c
                  [has_true_upper_case=yes],
Packit Service c5cf8c
	          [has_true_upper_case=no])
Packit Service c5cf8c
AC_MSG_RESULT($has_true_upper_case)
Packit Service c5cf8c
if test "$has_true_upper_case" = "no" ; then
Packit Service c5cf8c
   AC_DEFINE(TRUE,1,[Define TRUE])
Packit Service c5cf8c
   AC_DEFINE(FALSE,0,[Define FALSE])
Packit Service c5cf8c
fi
Packit Service c5cf8c
AC_LANG_POP([C])
Packit Service c5cf8c
Packit Service c5cf8c
# ----------------------------------------------------------------------------
Packit Service c5cf8c
# We previously allowed "default" as a valid value for $enable_cxx.  Now we
Packit Service c5cf8c
# assume its available by default and error out if it doesn't work (just like
Packit Service c5cf8c
# F77 & FC).  The user must pass "--disable-cxx" in order to successfully
Packit Service c5cf8c
# complete configure in this case.
Packit Service c5cf8c
if test "$enable_cxx" = "default" ; then
Packit Service c5cf8c
    AC_MSG_ERROR([aborting because "--enable-cxx=default" is no longer a supported value])
Packit Service c5cf8c
fi
Packit Service c5cf8c
Packit Service c5cf8c
if test "$enable_cxx" = "yes" ; then
Packit Service c5cf8c
    # Another bug in autoconf.  The checks for the C++ compiler do not
Packit Service c5cf8c
    # ensure that you can link a program that is built with the C++ 
Packit Service c5cf8c
    # compiler.  We've seen this error with gcc and icc, particularly
Packit Service c5cf8c
    # when those compilers accept C++ language elements but are unable
Packit Service c5cf8c
    # to link programs that are really C++.  For that reason,
Packit Service c5cf8c
    # we've added a test to see if the C++ compiler can produce
Packit Service c5cf8c
    # an executable.
Packit Service c5cf8c
    AC_CACHE_CHECK([whether the C++ compiler $CXX can build an executable],
Packit Service c5cf8c
    pac_cv_cxx_builds_exe,[
Packit Service c5cf8c
 AC_LANG_PUSH([C++])
Packit Service c5cf8c
 AC_TRY_LINK([
Packit Service c5cf8c
class mytest { 
Packit Service c5cf8c
  int a;
Packit Service c5cf8c
public:
Packit Service c5cf8c
  mytest(void) : a(1) {}
Packit Service c5cf8c
  ~mytest(void) {}
Packit Service c5cf8c
};],[mytest a;],
Packit Service c5cf8c
 pac_cv_cxx_builds_exe=yes, pac_cv_cxx_builds_exe=no)
Packit Service c5cf8c
 AC_LANG_POP([C++])
Packit Service c5cf8c
])
Packit Service c5cf8c
    if test "$pac_cv_cxx_builds_exe" != yes ; then
Packit Service c5cf8c
        AC_MSG_ERROR([Aborting because C++ compiler does not work.  If you do not need a C++ compiler, configure with --disable-cxx])
Packit Service c5cf8c
    fi
Packit Service c5cf8c
    # Recent failures have come when a standard header is loaded
Packit Service c5cf8c
    # The Intel icpc 10.x compiler fails with <string> if gcc 4.2 is installed. 
Packit Service c5cf8c
    AC_CACHE_CHECK([whether C++ compiler works with string],pac_cv_cxx_compiles_string,[
Packit Service c5cf8c
    AC_LANG_PUSH([C++])
Packit Service c5cf8c
    AC_TRY_COMPILE([#include <string>],[return 0;],pac_cv_cxx_compiles_string=yes,pac_cv_cxx_compiles_string=no)
Packit Service c5cf8c
    AC_LANG_POP([C++])
Packit Service c5cf8c
])
Packit Service c5cf8c
    if test "$pac_cv_cxx_compiles_string" != yes ; then 
Packit Service c5cf8c
        AC_MSG_WARN([The C++ compiler $CXX cannot compile a program containing the <string> header - this may indicate a problem with the C++ installation.  Consider configuing with --disable-cxx])
Packit Service c5cf8c
    fi
Packit Service c5cf8c
Packit Service c5cf8c
    AC_LANG_CPLUSPLUS
Packit Service c5cf8c
    AX_CXX_EXCEPTIONS
Packit Service c5cf8c
    AX_CXX_BOOL
Packit Service c5cf8c
    AX_CXX_NAMESPACES
Packit Service c5cf8c
    if test "$ac_cv_cxx_namespaces" != "yes" ; then
Packit Service c5cf8c
        AC_MSG_ERROR([Namespaces are required for the MPI C++ interface])
Packit Service c5cf8c
    fi
Packit Service c5cf8c
    HAVE_CXX_EXCEPTIONS=0
Packit Service c5cf8c
    AC_SUBST(HAVE_CXX_EXCEPTIONS)
Packit Service c5cf8c
    if test "$ac_cv_cxx_exceptions" = "yes" ; then
Packit Service c5cf8c
        HAVE_CXX_EXCEPTIONS=1
Packit Service c5cf8c
    fi
Packit Service c5cf8c
    # iostream and math are needed for examples/cxx/cxxpi.cxx
Packit Service c5cf8c
    AC_CACHE_CHECK([whether <iostream> available],pac_cv_cxx_has_iostream,[
Packit Service c5cf8c
    AC_TRY_COMPILE([
Packit Service c5cf8c
#include <iostream>
Packit Service c5cf8c
],[using namespace std;],pac_cv_cxx_has_iostream=yes,pac_cv_cxx_has_iostream=no)])
Packit Service c5cf8c
    AX_CXX_NAMESPACE_STD
Packit Service c5cf8c
   
Packit Service c5cf8c
    AC_CACHE_CHECK([whether <math> available],pac_cv_cxx_has_math,[
Packit Service c5cf8c
    AC_TRY_COMPILE([
Packit Service c5cf8c
#include <math>
Packit Service c5cf8c
],[using namespace std;],pac_cv_cxx_has_math=yes,pac_cv_cxx_has_math=no)])
Packit Service c5cf8c
Packit Service c5cf8c
    # GNU changed the calling conventions between minor releases (!!!)
Packit Service c5cf8c
    # This is too hard to detect, but we should be able to detect
Packit Service c5cf8c
    # the version mismatch.  By default, we set the GNU version to 0.
Packit Service c5cf8c
    # In a cross-compiling environment, these can be set with environment
Packit Service c5cf8c
    # variables, either directly or through the standard "CROSS" variable.
Packit Service c5cf8c
    if test -z "$GNUCXX_VERSION" ; then
Packit Service c5cf8c
        if test -n "$CROSS_GNUCXX_VERSION" ; then 
Packit Service c5cf8c
	     GNUCXX_VERSION=$CROSS_GNUCXX_VERSION
Packit Service c5cf8c
        else
Packit Service c5cf8c
             GNUCXX_VERSION=0
Packit Service c5cf8c
        fi
Packit Service c5cf8c
    fi
Packit Service c5cf8c
    if test -z "$GNUCXX_MINORVERSION" ; then 
Packit Service c5cf8c
	if test -n "$CROSS_GNUCXX_MINORVERSION" ; then
Packit Service c5cf8c
	     GNUCXX_MINORVERSION=$CROSS_GNUCXX_MINORVERSION
Packit Service c5cf8c
       	else
Packit Service c5cf8c
             GNUCXX_MINORVERSION=0
Packit Service c5cf8c
        fi
Packit Service c5cf8c
    fi
Packit Service c5cf8c
    if test "$cross_compiling" = "no" -a "$ac_compiler_gnu" = "yes" -a \
Packit Service c5cf8c
       "$GNUCXX_VERSION" = 0 -a "$GNUCXX_MINORVERSION" = 0 ; then
Packit Service c5cf8c
         ac_vals=""
Packit Service c5cf8c
	 AC_MSG_CHECKING([for GNU g++ version])
Packit Service c5cf8c
         AC_TRY_RUN([#include <stdio.h>
Packit Service c5cf8c
int main() {
Packit Service c5cf8c
    int v = -1, m = -1;
Packit Service c5cf8c
    FILE *fp = fopen("conftest.out","w");
Packit Service c5cf8c
#ifdef __GNUC_MINOR__
Packit Service c5cf8c
    m = __GNUC_MINOR__;
Packit Service c5cf8c
#endif
Packit Service c5cf8c
#ifdef __GNUC__
Packit Service c5cf8c
    v = __GNUC__;
Packit Service c5cf8c
#endif
Packit Service c5cf8c
    fprintf( fp, "v=%d, m=%d\n", v, m );
Packit Service c5cf8c
    fclose( fp );
Packit Service c5cf8c
    return 0;
Packit Service c5cf8c
}],ac_vals=`cat conftest.out`)
Packit Service c5cf8c
         if test -n "$ac_vals" ; then
Packit Service c5cf8c
             v=`echo "$ac_vals" | sed -e 's/v=\(.*\),.*/\1/'`
Packit Service c5cf8c
             m=`echo "$ac_vals" | sed -e 's/.*m=\(.*\)/\1/'`
Packit Service c5cf8c
             AC_MSG_RESULT([$v . $m])
Packit Service c5cf8c
             GNUCXX_VERSION=$v
Packit Service c5cf8c
             GNUCXX_MINORVERSION=$m
Packit Service c5cf8c
         else
Packit Service c5cf8c
             AC_MSG_RESULT([unknown])
Packit Service c5cf8c
         fi 
Packit Service c5cf8c
    fi    
Packit Service c5cf8c
    AC_SUBST(GNUCXX_VERSION)
Packit Service c5cf8c
    AC_SUBST(GNUCXX_MINORVERSION)
Packit Service c5cf8c
Packit Service c5cf8c
    bindings="$bindings cxx"
Packit Service c5cf8c
    AC_DEFINE(HAVE_CXX_BINDING,1,[Define if C++ is supported])
Packit Service c5cf8c
    INCLUDE_MPICXX_H='#include "mpicxx.h"'
Packit Service c5cf8c
    AC_SUBST(INCLUDE_MPICXX_H)
Packit Service c5cf8c
Packit Service c5cf8c
    # In order to support the Fortran datatypes within C++, 
Packit Service c5cf8c
    # 
Packit Service c5cf8c
    # FORTRAN_BINDING always has a CPP-time value of either 0 or 1,
Packit Service c5cf8c
    # so that it may be used in #if statements without adding to 
Packit Service c5cf8c
    # the CPP name space
Packit Service c5cf8c
    AC_SUBST(FORTRAN_BINDING)
Packit Service c5cf8c
Packit Service c5cf8c
    # Special C++ datatypes.  Set to DATATYPE NULL first; we'll 
Packit Service c5cf8c
    # replace the ones that we have later, after we have determined
Packit Service c5cf8c
    # the C datatypes
Packit Service c5cf8c
    MPIR_CXX_BOOL=0x0c000000
Packit Service c5cf8c
    MPIR_CXX_COMPLEX=0x0c000000
Packit Service c5cf8c
    MPIR_CXX_DOUBLE_COMPLEX=0x0c000000
Packit Service c5cf8c
    MPIR_CXX_LONG_DOUBLE_COMPLEX=0x0c000000
Packit Service c5cf8c
    AC_SUBST(MPIR_CXX_BOOL)
Packit Service c5cf8c
    AC_SUBST(MPIR_CXX_COMPLEX)
Packit Service c5cf8c
    AC_SUBST(MPIR_CXX_DOUBLE_COMPLEX)
Packit Service c5cf8c
    AC_SUBST(MPIR_CXX_LONG_DOUBLE_COMPLEX)
Packit Service c5cf8c
Packit Service c5cf8c
    # determine rpath and other shared library flags for CXX
Packit Service c5cf8c
    cxx_shlib_conf=src/env/cxx_shlib.conf
Packit Service c5cf8c
    PAC_COMPILER_SHLIB_FLAGS([CXX],[$cxx_shlib_conf])
Packit Service c5cf8c
    AC_SUBST_FILE([cxx_shlib_conf])
Packit Service c5cf8c
fi
Packit Service c5cf8c
Packit Service c5cf8c
if test "$enable_cxx" = yes; then
Packit Service c5cf8c
    # Check if $MPI_DEFAULT_CXXOPTS is valid with $CXX
Packit Service c5cf8c
    if test -n "$MPI_DEFAULT_CXXOPTS" ; then
Packit Service c5cf8c
        if test "$enable_check_compiler_flags" = "yes" ; then
Packit Service c5cf8c
            PAC_CXX_CHECK_COMPILER_OPTION( [$MPI_DEFAULT_CXXOPTS], [
Packit Service c5cf8c
            CXXFLAGS="$CXXFLAGS $MPI_DEFAULT_CXXOPTS"
Packit Service c5cf8c
                                     ] )
Packit Service c5cf8c
        else
Packit Service c5cf8c
            CXXFLAGS="$CXXFLAGS $MPI_DEFAULT_CXXOPTS"
Packit Service c5cf8c
        fi
Packit Service c5cf8c
    fi
Packit Service c5cf8c
fi
Packit Service c5cf8c
Packit Service c5cf8c
AC_SUBST(bindings)
Packit Service c5cf8c
Packit Service c5cf8c
# ----------------------------------------------------------------------------
Packit Service c5cf8c
# End of the bindings support
Packit Service c5cf8c
# ----------------------------------------------------------------------------
Packit Service c5cf8c
Packit Service c5cf8c
AC_LANG_C
Packit Service c5cf8c
#
Packit Service c5cf8c
# ----------------------------------------------------------------------------
Packit Service c5cf8c
# Done with the basic argument processing and decisions about which 
Packit Service c5cf8c
# subsystems to build
Packit Service c5cf8c
# ----------------------------------------------------------------------------
Packit Service c5cf8c
Packit Service c5cf8c
# Look for perl.  Perl is used *only* in the tests of the commands such as
Packit Service c5cf8c
# mpiexec, mpicc, etc, in test/commands, and in some of the utility
Packit Service c5cf8c
# programs for processing log files .  If perl is not found,
Packit Service c5cf8c
# MPICH may still be built and used.
Packit Service c5cf8c
# We need the full path to perl since we'll use it as the interpreter for
Packit Service c5cf8c
# a shell script.
Packit Service c5cf8c
AC_PATH_PROG(PERL,perl)
Packit Service c5cf8c
# Look for ar.  If we fail, abort
Packit Service c5cf8c
AC_CHECK_PROGS(AR,ar)
Packit Service c5cf8c
if test -z "$AR" ; then
Packit Service c5cf8c
    AC_MSG_ERROR([The program ar is required for building MPICH.  Make sure that your path includes ar])
Packit Service c5cf8c
fi
Packit Service c5cf8c
Packit Service c5cf8c
# FIXME: this is probably unnecessary now that we only do one "ar" at the end
Packit Service c5cf8c
# (via libtool).  If anything, it's likely to cause problems instead.
Packit Service c5cf8c
# AR_FLAGS provides a way to potentially improve build performance on Mac OSX
Packit Service c5cf8c
AR_FLAGS=cr
Packit Service c5cf8c
# this logic is lame, should really write a real test at some point
Packit Service c5cf8c
AS_CASE([$host],
Packit Service c5cf8c
    # Barry proposes AR_FLAGS="Scq" in trac#754, but that won't work correctly for re-builds
Packit Service c5cf8c
    [*-*-darwin*], [AR_FLAGS=Scr]
Packit Service c5cf8c
)
Packit Service c5cf8c
AC_ARG_VAR(AR_FLAGS,[AR command flags]) # causes AC_SUBST too
Packit Service c5cf8c
Packit Service c5cf8c
# Note that we set RANLIB to true if we don't find it (some systems neither
Packit Service c5cf8c
# need it nor provide it)
Packit Service c5cf8c
AC_CHECK_PROGS(RANLIB,ranlib,true)
Packit Service c5cf8c
Packit Service c5cf8c
# Check for the killall program; this can be used in some of the tests
Packit Service c5cf8c
# in test/commands
Packit Service c5cf8c
AC_CHECK_PROGS(KILLALL,killall,true)
Packit Service c5cf8c
Packit Service c5cf8c
# Does xargs need the -r option to handle the case where the input 
Packit Service c5cf8c
# is empty (gnu utils do, Mac OSX does not accept -r)
Packit Service c5cf8c
xargs_out=`echo "" | xargs ls | wc -l | sed -e 's/ //g'`
Packit Service c5cf8c
if test "$xargs_out" != "0" ; then
Packit Service c5cf8c
    XARGS_NODATA_OPT=-r
Packit Service c5cf8c
fi
Packit Service c5cf8c
AC_SUBST(XARGS_NODATA_OPT)
Packit Service c5cf8c
Packit Service c5cf8c
AC_PROG_INSTALL
Packit Service c5cf8c
PAC_PROG_CHECK_INSTALL_WORKS
Packit Service c5cf8c
#
Packit Service c5cf8c
# On Mac OS/X, install breaks libraries unless used with the -p switch
Packit Service c5cf8c
dnl FIXME not necessary now that we are using libtool
Packit Service c5cf8c
dnl PAC_PROG_INSTALL_BREAKS_LIBS
Packit Service c5cf8c
# We also need mkdir -p.
Packit Service c5cf8c
PAC_PROG_MKDIR_P
Packit Service c5cf8c
PAC_PROG_MAKE
Packit Service c5cf8c
Packit Service c5cf8c
#
Packit Service c5cf8c
# Check for bash to allow more robust shell scripts
Packit Service c5cf8c
AC_PATH_PROG(BASH_SHELL,bash)
Packit Service c5cf8c
#
Packit Service c5cf8c
# Confirm that bash has working arrays.  We can use this to 
Packit Service c5cf8c
# build more robust versions of the scripts (particularly the 
Packit Service c5cf8c
# compliation scripts) by taking advantage of the array features in 
Packit Service c5cf8c
# bash.
Packit Service c5cf8c
bashWorks=no
Packit Service c5cf8c
if test -x "$BASH_SHELL" ; then
Packit Service c5cf8c
changequote(%%,::)dnl
Packit Service c5cf8c
    cat >>conftest <
Packit Service c5cf8c
#! $BASH_SHELL
Packit Service c5cf8c
A[0]="b"
Packit Service c5cf8c
A[1]="c"
Packit Service c5cf8c
rc=1
Packit Service c5cf8c
if test \${A[1]} != "c" ; then rc=2 ; else rc=0 ; fi
Packit Service c5cf8c
exit \$rc
Packit Service c5cf8c
EOF
Packit Service c5cf8c
changequote([,])dnl
Packit Service c5cf8c
    AC_MSG_CHECKING([whether $BASH_SHELL supports arrays])
Packit Service c5cf8c
    chmod +x conftest
Packit Service c5cf8c
    if ./conftest 2>&1 >/dev/null ; then
Packit Service c5cf8c
        bashWorks=yes
Packit Service c5cf8c
    else
Packit Service c5cf8c
        bashWorks=no
Packit Service c5cf8c
    fi
Packit Service c5cf8c
    rm -f conftest*
Packit Service c5cf8c
    AC_MSG_RESULT($bashWorks)
Packit Service c5cf8c
fi
Packit Service c5cf8c
dnl BUILD_BASH_SCRIPTS used to be an AC_SUBST
Packit Service c5cf8c
AM_CONDITIONAL([BUILD_BASH_SCRIPTS], [test "x$bashWorks" = xyes])
Packit Service c5cf8c
Packit Service c5cf8c
# ----------------------------------------------------------------------------
Packit Service c5cf8c
# At this point, we've finally settled on the value of PMPILIBNAME.  We
Packit Service c5cf8c
# can now set NEEDSPLIB.
Packit Service c5cf8c
if test "$NEEDSPLIB" = yes -a "$PMPILIBNAME" = "$MPILIBNAME" ; then
Packit Service c5cf8c
    NEEDSPLIB=no
Packit Service c5cf8c
fi
Packit Service c5cf8c
Packit Service c5cf8c
# We are cheating a bit here and reaching inside of the libtool macros to
Packit Service c5cf8c
# extract the correct shared library extension.  It would be nice if this
Packit Service c5cf8c
# were publicly available in at least the same way that $libext is.
Packit Service c5cf8c
eval SHLIB_EXT='"'$shrext_cmds'"'
Packit Service c5cf8c
export SHLIB_EXT
Packit Service c5cf8c
AC_SUBST(SHLIB_EXT)
Packit Service c5cf8c
Packit Service c5cf8c
# ----------------------------------------------------------------------------
Packit Service c5cf8c
# 
Packit Service c5cf8c
# Add the steps for debugger support
Packit Service c5cf8c
BUILD_TVDLL=no
Packit Service c5cf8c
if test "$enable_debuginfo" = "yes" ; then
Packit Service c5cf8c
   # We can build the Totalview interface DLL only if we know how to build
Packit Service c5cf8c
   # shared libraries.
Packit Service c5cf8c
   
Packit Service c5cf8c
   # FIXME is this really the right test?
Packit Service c5cf8c
   # No.  Before MPICH 1.5, there was the capability to build the debugger
Packit Service c5cf8c
   # libraries without forcing the build of shared libraries for everything.
Packit Service c5cf8c
   # There may be some way to restore this capability, but until then, we
Packit Service c5cf8c
   # at least cause the configure to cleanly fail with a clear error message 
Packit Service c5cf8c
   if test "X$enable_shared" = "Xyes" ; then
Packit Service c5cf8c
       BUILD_TVDLL=yes
Packit Service c5cf8c
   else
Packit Service c5cf8c
       AC_MSG_ERROR([Building with --enable-debuginfo now requires building with shared library support.  Add --enable-shared and reconfigure])
Packit Service c5cf8c
   fi
Packit Service c5cf8c
Packit Service c5cf8c
   # One more nasty problem.  Totalview relies on debugger symbols 
Packit Service c5cf8c
   # being present in the executable.  Some experimental versions of
Packit Service c5cf8c
   # gcc (3.2 20020329 for ia64) do *not* include the object symbols
Packit Service c5cf8c
   # when debugging.  For HPUX, the necessary linking options are
Packit Service c5cf8c
   #    +noobjdebug
Packit Service c5cf8c
   # for C, Fortran, and C++.  We don't have a good test for this yet,
Packit Service c5cf8c
   # so we add a warning
Packit Service c5cf8c
   if test "$ac_cv_prog_gcc" = "yes" ; then
Packit Service c5cf8c
       AC_MSG_WARN([Some versions of gcc do not include debugging information
Packit Service c5cf8c
within the executable.  Totalview requires this information to detect
Packit Service c5cf8c
an MPICH code.  If you have trouble, try linking with the additional
Packit Service c5cf8c
option 
Packit Service c5cf8c
    +noobjdebug
Packit Service c5cf8c
on all link lines (consider adding it to LDFLAGS)])
Packit Service c5cf8c
   fi
Packit Service c5cf8c
Packit Service c5cf8c
    # The debugger library name cannot be set until we know the extension
Packit Service c5cf8c
    # of shared libraries - the name is so on most Unix system, dylib on OS X.
Packit Service c5cf8c
    AC_DEFINE(HAVE_DEBUGGER_SUPPORT,1,[Define if debugger support is included])
Packit Service c5cf8c
    # The debugger support requires a shared library.  This is handled 
Packit Service c5cf8c
    # below, after we check for compiler support for shared libraries
Packit Service c5cf8c
    # Note: if libdir contains exec_prefix, handle the fact that the
Packit Service c5cf8c
    # default exec_prefix is NONE, which (much later in configure)
Packit Service c5cf8c
    # gets turned into the value of prefix
Packit Service c5cf8c
    ##ENVVAR: MPICH_DEBUGLIBNAME - Set this environment variable to 
Packit Service c5cf8c
    ## override the default name of the debugger support library.
Packit Service c5cf8c
    ## The default name is libtvmpich.$SHLIB_EXT (e.g., libtvmpich.so for
Packit Service c5cf8c
    ## most Unix versions, libtvmpich.dylib for Mac OSX).
Packit Service c5cf8c
    ##ENVVAR END:
Packit Service c5cf8c
Packit Service c5cf8c
    if test -z "$MPICH_DEBUGLIBNAME" ; then
Packit Service c5cf8c
        DEBUGLIBNAME=libtvmpich$SHLIB_EXT
Packit Service c5cf8c
    else
Packit Service c5cf8c
        # FIXME DJG I don't think this can be supported arbitrarily by the new
Packit Service c5cf8c
        # build system (I'm not sure it was supported correctly by the old
Packit Service c5cf8c
        # system either)
Packit Service c5cf8c
        AC_MSG_WARN([overriding MPICH_DEBUGLIBNAME is currently untested and probably does not work])
Packit Service c5cf8c
        DEBUGLIBNAME=$MPICH_DEBUGLIBNAME
Packit Service c5cf8c
    fi
Packit Service c5cf8c
    if test "x$exec_prefix" = xNONE ; then
Packit Service c5cf8c
        saveExecPrefix=$exec_prefix
Packit Service c5cf8c
	exec_prefix=$prefix
Packit Service c5cf8c
        eval dlldir=$libdir/$DEBUGLIBNAME
Packit Service c5cf8c
	exec_prefix=$saveExecPrefix
Packit Service c5cf8c
    else
Packit Service c5cf8c
        eval dlldir=$libdir/$DEBUGLIBNAME
Packit Service c5cf8c
    fi
Packit Service c5cf8c
    dlldir='"'$dlldir'"'
Packit Service c5cf8c
    AC_DEFINE_UNQUOTED(MPICH_INFODLL_LOC,$dlldir,[Define as the name of the debugger support library])
Packit Service c5cf8c
fi
Packit Service c5cf8c
Packit Service c5cf8c
# used by automakefiles to conditionally build the DLL
Packit Service c5cf8c
AM_CONDITIONAL([BUILD_DEBUGGER_DLL], [test x$BUILD_TVDLL = xyes])
Packit Service c5cf8c
Packit Service c5cf8c
# ----------------------------------------------------------------------------
Packit Service c5cf8c
Packit Service c5cf8c
nameserv_name=""
Packit Service c5cf8c
# Get the default nameserver, if no nameserver was selected.  A process
Packit Service c5cf8c
# manager may advertise a nameserver name by setting the variable
Packit Service c5cf8c
# MPID_PM_NAMESERVER.
Packit Service c5cf8c
if test "$with_namepublisher" = "default" ; then
Packit Service c5cf8c
   if test -n "$MPID_PM_NAMESERVER" ; then
Packit Service c5cf8c
       with_namepublisher=$MPID_PM_NAMESERVER
Packit Service c5cf8c
   else
Packit Service c5cf8c
       # The default is to use pmi to communicate published names
Packit Service c5cf8c
       with_namepublisher=pmi
Packit Service c5cf8c
   fi
Packit Service c5cf8c
fi
Packit Service c5cf8c
Packit Service c5cf8c
if test "$with_namepublisher" != no -a "$with_namepublisher" != "none" ; then
Packit Service c5cf8c
    case "$with_namepublisher" in 
Packit Service c5cf8c
    none|no) ;;
Packit Service c5cf8c
    # Removed ldap namepublisher hook - we no longer support or distribute
Packit Service c5cf8c
    # the ldap-based name server
Packit Service c5cf8c
    file*)
Packit Service c5cf8c
    # Note that we always build the Makefile for the file version because
Packit Service c5cf8c
    # this name publisher is really too simple to require a 
Packit Service c5cf8c
    # separate configure, and we might as well include a basic
Packit Service c5cf8c
    # name publisher with any MPICH distribution
Packit Service c5cf8c
    # We DO need to extract the directory name that is used for writing 
Packit Service c5cf8c
    # the files, with the User's home directory as the default
Packit Service c5cf8c
    nameserv_name="file"
Packit Service c5cf8c
    basedir=`echo $with_namepublisher | sed -e 's/file://'`
Packit Service c5cf8c
    if test "$basedir" = "$with_namepublisher" ; then
Packit Service c5cf8c
        # Reset since no directory was set.
Packit Service c5cf8c
	basedir='"."';
Packit Service c5cf8c
    fi
Packit Service c5cf8c
    AC_DEFINE_UNQUOTED(FILE_NAMEPUB_BASEDIR,$basedir,[Directory to use in namepub])
Packit Service c5cf8c
    AC_DEFINE(USE_FILE_FOR_NAMEPUB,1,[Define if file should be used for name publisher])
Packit Service c5cf8c
    ;;
Packit Service c5cf8c
Packit Service c5cf8c
    *)
Packit Service c5cf8c
    # Check for a new namepublisher
Packit Service c5cf8c
    dir=$with_namepublisher
Packit Service c5cf8c
    # If we later need args, here is where we can strip them off of the
Packit Service c5cf8c
    # with argument
Packit Service c5cf8c
    if test -d "$use_top_srcdir/src/nameserv/$dir" ; then
Packit Service c5cf8c
        if test -x "$use_top_srcdir/src/nameserv/$dir/configure" ; then
Packit Service c5cf8c
	    # Run the configure in this directory if necessary
Packit Service c5cf8c
            subsystems="$subsystems src/nameserv/$dir"
Packit Service c5cf8c
        fi
Packit Service c5cf8c
	nameserv_name=$dir
Packit Service c5cf8c
    else
Packit Service c5cf8c
        AC_MSG_WARN([Unknown name publisher $with_namepublisher])
Packit Service c5cf8c
    fi
Packit Service c5cf8c
    ;;
Packit Service c5cf8c
    esac    
Packit Service c5cf8c
fi
Packit Service c5cf8c
if test -n "$nameserv_name" ; then
Packit Service c5cf8c
   AC_DEFINE(HAVE_NAMEPUB_SERVICE,1,[Define if a name publishing service is available])
Packit Service c5cf8c
fi
Packit Service c5cf8c
export nameserv_name
Packit Service c5cf8c
AM_CONDITIONAL([BUILD_NAMEPUB_FILE],[test "X$nameserv_name" = "Xfile"])
Packit Service c5cf8c
AM_CONDITIONAL([BUILD_NAMEPUB_PMI],[test "X$nameserv_name" = "Xpmi"])
Packit Service c5cf8c
Packit Service c5cf8c
# In case the documentation targets are used, find doctext and attempt to 
Packit Service c5cf8c
# find the source for the doctext LaTeX style files.  Use "false" if
Packit Service c5cf8c
# doctext is not found
Packit Service c5cf8c
AC_PATH_PROG(DOCTEXT,doctext,false)
Packit Service c5cf8c
export DOCTEXT
Packit Service c5cf8c
AC_SUBST(DOCTEXT)
Packit Service c5cf8c
Packit Service c5cf8c
# ----------------------------------------------------------------------------
Packit Service c5cf8c
# Check for C compiler characteristics
Packit Service c5cf8c
AC_C_CONST
Packit Service c5cf8c
AC_C_VOLATILE
Packit Service c5cf8c
AC_C_RESTRICT
Packit Service c5cf8c
AC_C_INLINE
Packit Service c5cf8c
Packit Service c5cf8c
PAC_C_GNU_ATTRIBUTE
Packit Service c5cf8c
PAC_C_BUILTIN_EXPECT
Packit Service c5cf8c
Packit Service c5cf8c
# We need to check for the endianess in order to implement the
Packit Service c5cf8c
# "external32" representations.  This defines "WORDS_BIGENDIAN when
Packit Service c5cf8c
# the system is bigendian.
Packit Service c5cf8c
# As of autoconf 2.62, this macro takes an additional argument for systems
Packit Service c5cf8c
# that can produce object files for either endianess.  
Packit Service c5cf8c
# With the as-always-incompatible-with-every-version autoconf, the 
Packit Service c5cf8c
# arguments for this macro *changed* in 2.62 to
Packit Service c5cf8c
# (if-bigendian,if-littleendian,unknown,universal)
Packit Service c5cf8c
# The fourth argument is new.
Packit Service c5cf8c
# Also note that the definition emitted by autoheader requires that gcc
Packit Service c5cf8c
# be used to compile the programs - other compilers may not define the 
Packit Service c5cf8c
# non-standard __BIG_ENDIAN__ or __LITTLE_ENDIAN__ CPP names on which 
Packit Service c5cf8c
# autoconf 2.62 now depends.
Packit Service c5cf8c
byteOrdering=unknown
Packit Service c5cf8c
AC_C_BIGENDIAN(byteOrdering=big,byteOrdering=little,,byteOrdering=universal)
Packit Service c5cf8c
case $byteOrdering in
Packit Service c5cf8c
    big)
Packit Service c5cf8c
    # Nothing to do - the c_bigendian macro takes care of it
Packit Service c5cf8c
    :
Packit Service c5cf8c
    ;;
Packit Service c5cf8c
    little)
Packit Service c5cf8c
    AC_DEFINE(WORDS_LITTLEENDIAN,1,[Define if words are little endian])
Packit Service c5cf8c
    ;;
Packit Service c5cf8c
    universal)
Packit Service c5cf8c
    AC_DEFINE(WORDS_UNIVERSAL_ENDIAN,1,[Define if configure will not tell us, for universal binaries])
Packit Service c5cf8c
    ;;
Packit Service c5cf8c
    unknown)
Packit Service c5cf8c
    AC_MSG_ERROR([Unable to determine endianess])
Packit Service c5cf8c
    ;;
Packit Service c5cf8c
esac
Packit Service c5cf8c
Packit Service c5cf8c
# We only need this test if we are using Fortran
Packit Service c5cf8c
if test "$enable_f77" ; then
Packit Service c5cf8c
    PAC_PROG_C_UNALIGNED_DOUBLES(,
Packit Service c5cf8c
[AC_MSG_WARN(Your C compiler $CC does not support unaligned accesses
Packit Service c5cf8c
to doubles.  This is required for interoperation with 
Packit Service c5cf8c
Fortran (the Fortran standard requires it).
Packit Service c5cf8c
You may need to specify an additional argument to your C compiler to 
Packit Service c5cf8c
force it to allow unaligned accesses.)])
Packit Service c5cf8c
fi
Packit Service c5cf8c
# Check for __func__ (defined in C99) or __FUNCTION__ (defined in older GCC)
Packit Service c5cf8c
AC_CACHE_CHECK([whether $CC supports __func__],pac_cv_cc_has___func__,
Packit Service c5cf8c
[AC_TRY_COMPILE([],
Packit Service c5cf8c
 [const char *cp = __func__; ],pac_cv_cc_has___func__=yes,
Packit Service c5cf8c
pac_cv_cc_has___func__=no)])
Packit Service c5cf8c
if test "$pac_cv_cc_has___func__" != "yes" ; then
Packit Service c5cf8c
    AC_CACHE_CHECK([whether $CC supports __FUNCTION__],pac_cv_cc_has___FUNCTION__,
Packit Service c5cf8c
[AC_TRY_COMPILE([],
Packit Service c5cf8c
 [const char *cp = __FUNCTION__;],pac_cv_cc_has___FUNCTION__=yes,
Packit Service c5cf8c
pac_cv_cc_has___FUNCTION__=no)])
Packit Service c5cf8c
fi
Packit Service c5cf8c
Packit Service c5cf8c
# ----------------------------------------------------------------------------
Packit Service c5cf8c
# Check on support for long double and long long types.  Do this before the
Packit Service c5cf8c
# structure alignment test because it will test for including those
Packit Service c5cf8c
# types as well.  In addition, allow the device to suppress support for these
Packit Service c5cf8c
# optional C types by setting MPID_NO_LONG_DOUBLE and/or MPID_NO_LONG_LONG
Packit Service c5cf8c
# to yes.
Packit Service c5cf8c
if test "$MPID_NO_LONG_DOUBLE" != "yes" && test "X$enable_long_double" != "Xno" ; then
Packit Service c5cf8c
    AC_CACHE_CHECK([whether long double is supported],
Packit Service c5cf8c
    pac_cv_have_long_double,[
Packit Service c5cf8c
    AC_TRY_COMPILE(,[long double a;],
Packit Service c5cf8c
    pac_cv_have_long_double=yes,pac_cv_have_long_double=no)])
Packit Service c5cf8c
    if test "$pac_cv_have_long_double" = "yes" ; then
Packit Service c5cf8c
        AC_DEFINE(HAVE_LONG_DOUBLE,1,[Define if long double is supported])
Packit Service c5cf8c
    fi
Packit Service c5cf8c
fi
Packit Service c5cf8c
if test "$MPID_NO_LONG_LONG" != "yes" ; then
Packit Service c5cf8c
    AC_CACHE_CHECK([whether long long is supported],
Packit Service c5cf8c
    pac_cv_have_long_long,[
Packit Service c5cf8c
    AC_TRY_COMPILE(,[long long a;],
Packit Service c5cf8c
    pac_cv_have_long_long=yes,pac_cv_have_long_long=no)])
Packit Service c5cf8c
    if test "$pac_cv_have_long_long" = "yes" ; then
Packit Service c5cf8c
        AC_DEFINE(HAVE_LONG_LONG_INT,1,[Define if long long is supported])
Packit Service c5cf8c
    fi
Packit Service c5cf8c
fi
Packit Service c5cf8c
# ----------------------------------------------------------------------------
Packit Service c5cf8c
# Get default structure alignment for integers
Packit Service c5cf8c
dnl PAC_C_MAX_INTEGER_ALIGN places the default alignment into
Packit Service c5cf8c
dnl pac_cv_c_max_integer_align, with possible values including
Packit Service c5cf8c
dnl packed (byte), largest, two, four, eight (or other failure message).
Packit Service c5cf8c
PAC_C_MAX_INTEGER_ALIGN
Packit Service c5cf8c
Packit Service c5cf8c
if test "$pac_cv_c_max_integer_align" = "packed" ; then
Packit Service c5cf8c
    pac_cv_c_struct_align_nr=1
Packit Service c5cf8c
elif test "$pac_cv_c_max_integer_align" = "two" ; then
Packit Service c5cf8c
    pac_cv_c_struct_align_nr=2
Packit Service c5cf8c
elif test "$pac_cv_c_max_integer_align" = "four" ; then
Packit Service c5cf8c
    pac_cv_c_struct_align_nr=4
Packit Service c5cf8c
elif test "$pac_cv_c_max_integer_align" = "eight" ; then
Packit Service c5cf8c
    pac_cv_c_struct_align_nr=8
Packit Service c5cf8c
fi
Packit Service c5cf8c
Packit Service c5cf8c
if test -n "$pac_cv_c_struct_align_nr" ; then
Packit Service c5cf8c
    AC_DEFINE_UNQUOTED(HAVE_MAX_INTEGER_ALIGNMENT,$pac_cv_c_struct_align_nr,[Controls byte alignment of integer structures (for MPI structs)])
Packit Service c5cf8c
    AC_DEFINE_UNQUOTED(HAVE_MAX_STRUCT_ALIGNMENT,$pac_cv_c_struct_align_nr,[Controls byte alignment of structures (for aligning allocated structures)])
Packit Service c5cf8c
fi
Packit Service c5cf8c
# Get default structure alignment for floating point types
Packit Service c5cf8c
dnl PAC_C_MAX_FP_ALIGN places the default alignment into
Packit Service c5cf8c
dnl pac_cv_c_max_fp_align, with possible values including
Packit Service c5cf8c
dnl packed (byte), largest, two, four, eight (or other failure message).
Packit Service c5cf8c
PAC_C_MAX_FP_ALIGN
Packit Service c5cf8c
Packit Service c5cf8c
if test "$pac_cv_c_max_fp_align" = "packed" ; then
Packit Service c5cf8c
    pac_cv_c_fp_align_nr=1
Packit Service c5cf8c
elif test "$pac_cv_c_max_fp_align" = "two" ; then
Packit Service c5cf8c
    pac_cv_c_fp_align_nr=2
Packit Service c5cf8c
elif test "$pac_cv_c_max_fp_align" = "four" ; then
Packit Service c5cf8c
    pac_cv_c_fp_align_nr=4
Packit Service c5cf8c
elif test "$pac_cv_c_max_fp_align" = "eight" ; then
Packit Service c5cf8c
    pac_cv_c_fp_align_nr=8
Packit Service c5cf8c
elif test "$pac_cv_c_max_fp_align" = "sixteen" ; then
Packit Service c5cf8c
    pac_cv_c_fp_align_nr=16
Packit Service c5cf8c
elif test "$pac_cv_c_max_fp_align" = "largest" ; then
Packit Service c5cf8c
    AC_MSG_ERROR([Configure detected unsupported structure alignment rules.])
Packit Service c5cf8c
fi
Packit Service c5cf8c
Packit Service c5cf8c
if test -n "$pac_cv_c_fp_align_nr" ; then
Packit Service c5cf8c
    AC_DEFINE_UNQUOTED(HAVE_MAX_FP_ALIGNMENT,$pac_cv_c_fp_align_nr,[Controls byte alignment of structures with floats, doubles, and long doubles (for MPI structs)])
Packit Service c5cf8c
fi
Packit Service c5cf8c
Packit Service c5cf8c
# Test for the alignment of structs containing only long doubles.
Packit Service c5cf8c
if test "$pac_cv_have_long_double" = yes ; then
Packit Service c5cf8c
    # Check for alignment of just float and double (no long doubles)
Packit Service c5cf8c
    PAC_C_MAX_DOUBLE_FP_ALIGN
Packit Service c5cf8c
    PAC_C_MAX_LONGDOUBLE_FP_ALIGN
Packit Service c5cf8c
    # FIXME: If this alignment is not the same as that for all float types,
Packit Service c5cf8c
    # we need to do something else in the alignment rule code.
Packit Service c5cf8c
    if test "$pac_cv_c_max_fp_align" != "$pac_cv_c_max_longdouble_fp_align" -o \
Packit Service c5cf8c
            "$pac_cv_c_max_fp_align" != "$pac_cv_c_max_double_fp_align" ; then
Packit Service c5cf8c
        AC_MSG_WARN([Structures containing long doubles may be aligned differently from structures with floats or longs.  MPICH does not handle this case automatically and you should avoid assumed extents for structures containing float types.])
Packit Service c5cf8c
Packit Service c5cf8c
	double_align=-1
Packit Service c5cf8c
	case $pac_cv_c_max_double_fp_align in 
Packit Service c5cf8c
	packed) double_align=1 ;;
Packit Service c5cf8c
	two)    double_align=2 ;;
Packit Service c5cf8c
	four)   double_align=4 ;;
Packit Service c5cf8c
	eight)  double_align=8 ;;
Packit Service c5cf8c
	esac
Packit Service c5cf8c
	longdouble_align=-1
Packit Service c5cf8c
	case $pac_cv_c_max_longdouble_fp_align in 
Packit Service c5cf8c
	packed) longdouble_align=1 ;;
Packit Service c5cf8c
	two)    longdouble_align=2 ;;
Packit Service c5cf8c
	four)   longdouble_align=4 ;;
Packit Service