#! /bin/sh

# Guess values for system-dependent variables and create Makefiles.
# Generated automatically using autoconf version 2.13 
# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
#
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.

# Defaults:
ac_help=
ac_default_prefix=/usr/local
# Any additions from configure.in:
ac_help="$ac_help
--with-lam=MPI_DIR	Top-level install directory for LAM/MPI"
ac_help="$ac_help
--with-lam-building   Only used internally to LAM/MPI"
ac_help="$ac_help
--with-mpich=MPI_DIR    Top-level install directory for MPICH/MPI"
ac_help="$ac_help
--with-mpichdev=LIBDIR  Library subdirectory for MPICH/MPI"
ac_help="$ac_help
--with-mpichbin=BINDIR  bin subdirectory for MPICH/MPI"
ac_help="$ac_help
--with-mpichsrc=SRCDIR  source home for MPICH/MPI"
ac_help="$ac_help
--with-mpichlib=LIBDIR  Library directory for MPICH/MPI"
ac_help="$ac_help
--with-mpichlibname=NAME Alternate name for MPICH library"
ac_help="$ac_help
--with-sp		Use IBM's SP/MPI"
ac_help="$ac_help
--with-sgi		Use SGI's IRIX/64 MPI"
ac_help="$ac_help
--with-sgi64		Use SGI's IRIX/64 MPI (force 64 bit mode)"
ac_help="$ac_help
--with-cray             Use Cray's native MPI"
ac_help="$ac_help
--with-hp		Use HP's HP-UX 10.x MPI"
ac_help="$ac_help
--with-mpidir=MPI_DIR	Top-level MPI directory (if not listed above)"
ac_help="$ac_help
--with-mpiinc=MPI_INC	Directory where mpi.h exists"
ac_help="$ac_help
--with-mpilib=MPI_INC	Directory where libmpi.a exists"
ac_help="$ac_help
--with-profiling	Make the profilable C++ bindings"
ac_help="$ac_help
--with-exflags          Specify flags necessary to enable exceptions"
ac_help="$ac_help
--without-opt		Compile with no optimization (for debugging)"
ac_help="$ac_help
--with-libopt		Opt flags for use when compiling libmpi++.a"
ac_help="$ac_help
--with-testopt		Opt flags for use when compiling test suite"
ac_help="$ac_help
--with-examopt		Opt flags for use when compiling examples"
ac_help="$ac_help
--with-namespace        Force the use of C++ namespaces"

# Initialize some variables set by options.
# The variables have the same names as the options, with
# dashes changed to underlines.
build=NONE
cache_file=./config.cache
exec_prefix=NONE
host=NONE
no_create=
nonopt=NONE
no_recursion=
prefix=NONE
program_prefix=NONE
program_suffix=NONE
program_transform_name=s,x,x,
silent=
site=
srcdir=
target=NONE
verbose=
x_includes=NONE
x_libraries=NONE
bindir='${exec_prefix}/bin'
sbindir='${exec_prefix}/sbin'
libexecdir='${exec_prefix}/libexec'
datadir='${prefix}/share'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
libdir='${exec_prefix}/lib'
includedir='${prefix}/include'
oldincludedir='/usr/include'
infodir='${prefix}/info'
mandir='${prefix}/man'

# Initialize some other variables.
subdirs=
MFLAGS= MAKEFLAGS=
SHELL=${CONFIG_SHELL-/bin/sh}
# Maximum number of lines to put in a shell here document.
ac_max_here_lines=12

ac_prev=
for ac_option
do

  # If the previous option needs an argument, assign it.
  if test -n "$ac_prev"; then
    eval "$ac_prev=\$ac_option"
    ac_prev=
    continue
  fi

  case "$ac_option" in
  -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
  *) ac_optarg= ;;
  esac

  # Accept the important Cygnus configure options, so we can diagnose typos.

  case "$ac_option" in

  -bindir | --bindir | --bindi | --bind | --bin | --bi)
    ac_prev=bindir ;;
  -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
    bindir="$ac_optarg" ;;

  -build | --build | --buil | --bui | --bu)
    ac_prev=build ;;
  -build=* | --build=* | --buil=* | --bui=* | --bu=*)
    build="$ac_optarg" ;;

  -cache-file | --cache-file | --cache-fil | --cache-fi \
  | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
    ac_prev=cache_file ;;
  -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
  | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
    cache_file="$ac_optarg" ;;

  -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
    ac_prev=datadir ;;
  -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
  | --da=*)
    datadir="$ac_optarg" ;;

  -disable-* | --disable-*)
    ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
    # Reject names that are not valid shell variable names.
    if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
      { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
    fi
    ac_feature=`echo $ac_feature| sed 's/-/_/g'`
    eval "enable_${ac_feature}=no" ;;

  -enable-* | --enable-*)
    ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
    # Reject names that are not valid shell variable names.
    if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
      { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
    fi
    ac_feature=`echo $ac_feature| sed 's/-/_/g'`
    case "$ac_option" in
      *=*) ;;
      *) ac_optarg=yes ;;
    esac
    eval "enable_${ac_feature}='$ac_optarg'" ;;

  -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
  | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
  | --exec | --exe | --ex)
    ac_prev=exec_prefix ;;
  -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
  | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
  | --exec=* | --exe=* | --ex=*)
    exec_prefix="$ac_optarg" ;;

  -gas | --gas | --ga | --g)
    # Obsolete; use --with-gas.
    with_gas=yes ;;

  -help | --help | --hel | --he)
    # Omit some internal or obsolete options to make the list less imposing.
    # This message is too long to be a string in the A/UX 3.1 sh.
    cat << EOF
Usage: configure [options] [host]
Options: [defaults in brackets after descriptions]
Configuration:
  --cache-file=FILE       cache test results in FILE
  --help                  print this message
  --no-create             do not create output files
  --quiet, --silent       do not print \`checking...' messages
  --version               print the version of autoconf that created configure
Directory and file names:
  --prefix=PREFIX         install architecture-independent files in PREFIX
                          [$ac_default_prefix]
  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
                          [same as prefix]
  --bindir=DIR            user executables in DIR [EPREFIX/bin]
  --sbindir=DIR           system admin executables in DIR [EPREFIX/sbin]
  --libexecdir=DIR        program executables in DIR [EPREFIX/libexec]
  --datadir=DIR           read-only architecture-independent data in DIR
                          [PREFIX/share]
  --sysconfdir=DIR        read-only single-machine data in DIR [PREFIX/etc]
  --sharedstatedir=DIR    modifiable architecture-independent data in DIR
                          [PREFIX/com]
  --localstatedir=DIR     modifiable single-machine data in DIR [PREFIX/var]
  --libdir=DIR            object code libraries in DIR [EPREFIX/lib]
  --includedir=DIR        C header files in DIR [PREFIX/include]
  --oldincludedir=DIR     C header files for non-gcc in DIR [/usr/include]
  --infodir=DIR           info documentation in DIR [PREFIX/info]
  --mandir=DIR            man documentation in DIR [PREFIX/man]
  --srcdir=DIR            find the sources in DIR [configure dir or ..]
  --program-prefix=PREFIX prepend PREFIX to installed program names
  --program-suffix=SUFFIX append SUFFIX to installed program names
  --program-transform-name=PROGRAM
                          run sed PROGRAM on installed program names
EOF
    cat << EOF
Host type:
  --build=BUILD           configure for building on BUILD [BUILD=HOST]
  --host=HOST             configure for HOST [guessed]
  --target=TARGET         configure for TARGET [TARGET=HOST]
Features and packages:
  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
  --x-includes=DIR        X include files are in DIR
  --x-libraries=DIR       X library files are in DIR
EOF
    if test -n "$ac_help"; then
      echo "--enable and --with options recognized:$ac_help"
    fi
    exit 0 ;;

  -host | --host | --hos | --ho)
    ac_prev=host ;;
  -host=* | --host=* | --hos=* | --ho=*)
    host="$ac_optarg" ;;

  -includedir | --includedir | --includedi | --included | --include \
  | --includ | --inclu | --incl | --inc)
    ac_prev=includedir ;;
  -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
  | --includ=* | --inclu=* | --incl=* | --inc=*)
    includedir="$ac_optarg" ;;

  -infodir | --infodir | --infodi | --infod | --info | --inf)
    ac_prev=infodir ;;
  -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
    infodir="$ac_optarg" ;;

  -libdir | --libdir | --libdi | --libd)
    ac_prev=libdir ;;
  -libdir=* | --libdir=* | --libdi=* | --libd=*)
    libdir="$ac_optarg" ;;

  -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
  | --libexe | --libex | --libe)
    ac_prev=libexecdir ;;
  -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
  | --libexe=* | --libex=* | --libe=*)
    libexecdir="$ac_optarg" ;;

  -localstatedir | --localstatedir | --localstatedi | --localstated \
  | --localstate | --localstat | --localsta | --localst \
  | --locals | --local | --loca | --loc | --lo)
    ac_prev=localstatedir ;;
  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
  | --localstate=* | --localstat=* | --localsta=* | --localst=* \
  | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
    localstatedir="$ac_optarg" ;;

  -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
    ac_prev=mandir ;;
  -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
    mandir="$ac_optarg" ;;

  -nfp | --nfp | --nf)
    # Obsolete; use --without-fp.
    with_fp=no ;;

  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
  | --no-cr | --no-c)
    no_create=yes ;;

  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
    no_recursion=yes ;;

  -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
  | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
  | --oldin | --oldi | --old | --ol | --o)
    ac_prev=oldincludedir ;;
  -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
  | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
  | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
    oldincludedir="$ac_optarg" ;;

  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
    ac_prev=prefix ;;
  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
    prefix="$ac_optarg" ;;

  -program-prefix | --program-prefix | --program-prefi | --program-pref \
  | --program-pre | --program-pr | --program-p)
    ac_prev=program_prefix ;;
  -program-prefix=* | --program-prefix=* | --program-prefi=* \
  | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
    program_prefix="$ac_optarg" ;;

  -program-suffix | --program-suffix | --program-suffi | --program-suff \
  | --program-suf | --program-su | --program-s)
    ac_prev=program_suffix ;;
  -program-suffix=* | --program-suffix=* | --program-suffi=* \
  | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
    program_suffix="$ac_optarg" ;;

  -program-transform-name | --program-transform-name \
  | --program-transform-nam | --program-transform-na \
  | --program-transform-n | --program-transform- \
  | --program-transform | --program-transfor \
  | --program-transfo | --program-transf \
  | --program-trans | --program-tran \
  | --progr-tra | --program-tr | --program-t)
    ac_prev=program_transform_name ;;
  -program-transform-name=* | --program-transform-name=* \
  | --program-transform-nam=* | --program-transform-na=* \
  | --program-transform-n=* | --program-transform-=* \
  | --program-transform=* | --program-transfor=* \
  | --program-transfo=* | --program-transf=* \
  | --program-trans=* | --program-tran=* \
  | --progr-tra=* | --program-tr=* | --program-t=*)
    program_transform_name="$ac_optarg" ;;

  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
  | -silent | --silent | --silen | --sile | --sil)
    silent=yes ;;

  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
    ac_prev=sbindir ;;
  -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
  | --sbi=* | --sb=*)
    sbindir="$ac_optarg" ;;

  -sharedstatedir | --sharedstatedir | --sharedstatedi \
  | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
  | --sharedst | --shareds | --shared | --share | --shar \
  | --sha | --sh)
    ac_prev=sharedstatedir ;;
  -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
  | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
  | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
  | --sha=* | --sh=*)
    sharedstatedir="$ac_optarg" ;;

  -site | --site | --sit)
    ac_prev=site ;;
  -site=* | --site=* | --sit=*)
    site="$ac_optarg" ;;

  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
    ac_prev=srcdir ;;
  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
    srcdir="$ac_optarg" ;;

  -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
  | --syscon | --sysco | --sysc | --sys | --sy)
    ac_prev=sysconfdir ;;
  -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
  | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
    sysconfdir="$ac_optarg" ;;

  -target | --target | --targe | --targ | --tar | --ta | --t)
    ac_prev=target ;;
  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
    target="$ac_optarg" ;;

  -v | -verbose | --verbose | --verbos | --verbo | --verb)
    verbose=yes ;;

  -version | --version | --versio | --versi | --vers)
    echo "configure generated by autoconf version 2.13"
    exit 0 ;;

  -with-* | --with-*)
    ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
    # Reject names that are not valid shell variable names.
    if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
      { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
    fi
    ac_package=`echo $ac_package| sed 's/-/_/g'`
    case "$ac_option" in
      *=*) ;;
      *) ac_optarg=yes ;;
    esac
    eval "with_${ac_package}='$ac_optarg'" ;;

  -without-* | --without-*)
    ac_package=`echo $ac_option|sed -e 's/-*without-//'`
    # Reject names that are not valid shell variable names.
    if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
      { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
    fi
    ac_package=`echo $ac_package| sed 's/-/_/g'`
    eval "with_${ac_package}=no" ;;

  --x)
    # Obsolete; use --with-x.
    with_x=yes ;;

  -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
  | --x-incl | --x-inc | --x-in | --x-i)
    ac_prev=x_includes ;;
  -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
  | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
    x_includes="$ac_optarg" ;;

  -x-libraries | --x-libraries | --x-librarie | --x-librari \
  | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
    ac_prev=x_libraries ;;
  -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
  | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
    x_libraries="$ac_optarg" ;;

  -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
    ;;

  *)
    if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
      echo "configure: warning: $ac_option: invalid host type" 1>&2
    fi
    if test "x$nonopt" != xNONE; then
      { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
    fi
    nonopt="$ac_option"
    ;;

  esac
done

if test -n "$ac_prev"; then
  { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
fi

trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15

# File descriptor usage:
# 0 standard input
# 1 file creation
# 2 errors and warnings
# 3 some systems may open it to /dev/tty
# 4 used on the Kubota Titan
# 6 checking for... messages and results
# 5 compiler messages saved in config.log
if test "$silent" = yes; then
  exec 6>/dev/null
else
  exec 6>&1
fi
exec 5>./config.log

echo "\
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
" 1>&5

# Strip out --no-create and --no-recursion so they do not pile up.
# Also quote any args containing shell metacharacters.
ac_configure_args=
for ac_arg
do
  case "$ac_arg" in
  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
  | --no-cr | --no-c) ;;
  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
  *" "*|*"	"*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
  ac_configure_args="$ac_configure_args '$ac_arg'" ;;
  *) ac_configure_args="$ac_configure_args $ac_arg" ;;
  esac
done

# NLS nuisances.
# Only set these to C if already set.  These must not be set unconditionally
# because not all systems understand e.g. LANG=C (notably SCO).
# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
# Non-C LC_CTYPE values break the ctype check.
if test "${LANG+set}"   = set; then LANG=C;   export LANG;   fi
if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
if test "${LC_CTYPE+set}"    = set; then LC_CTYPE=C;    export LC_CTYPE;    fi

# confdefs.h avoids OS command line length limits that DEFS can exceed.
rm -rf conftest* confdefs.h
# AIX cpp loses on an empty file, so make sure it contains at least a newline.
echo > confdefs.h

# A filename unique to this package, relative to the directory that
# configure is in, which we can look for to find out if srcdir is correct.
ac_unique_file=src/mpi2c++/comm.h

# Find the source files, if location was not specified.
if test -z "$srcdir"; then
  ac_srcdir_defaulted=yes
  # Try the directory containing this script, then its parent.
  ac_prog=$0
  ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
  test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
  srcdir=$ac_confdir
  if test ! -r $srcdir/$ac_unique_file; then
    srcdir=..
  fi
else
  ac_srcdir_defaulted=no
fi
if test ! -r $srcdir/$ac_unique_file; then
  if test "$ac_srcdir_defaulted" = yes; then
    { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
  else
    { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
  fi
fi
srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`

# Prefer explicitly selected file to automatically selected ones.
if test -z "$CONFIG_SITE"; then
  if test "x$prefix" != xNONE; then
    CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
  else
    CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
  fi
fi
for ac_site_file in $CONFIG_SITE; do
  if test -r "$ac_site_file"; then
    echo "loading site script $ac_site_file"
    . "$ac_site_file"
  fi
done


ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
ac_cpp='$CPP $CPPFLAGS'
ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_cc_cross

ac_exeext=
ac_objext=o
if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
  # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
  if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
    ac_n= ac_c='
' ac_t='	'
  else
    ac_n=-n ac_c= ac_t=
  fi
else
  ac_n= ac_c='\c' ac_t=
fi



VERSION=`cat $srcdir/VERSION | cut -f5 -d\ `
echo "Configuring MPI-2 C++ bindings, version $VERSION"



# The third argument to AM_INIT_AUTOMAKE surpresses the PACKAGE and
# VERSION macors

ac_aux_dir=
for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
  if test -f $ac_dir/install-sh; then
    ac_aux_dir=$ac_dir
    ac_install_sh="$ac_aux_dir/install-sh -c"
    break
  elif test -f $ac_dir/install.sh; then
    ac_aux_dir=$ac_dir
    ac_install_sh="$ac_aux_dir/install.sh -c"
    break
  fi
done
if test -z "$ac_aux_dir"; then
  { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
fi
ac_config_guess=$ac_aux_dir/config.guess
ac_config_sub=$ac_aux_dir/config.sub
ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.

# Find a good install program.  We prefer a C program (faster),
# so one script is as good as another.  But avoid the broken or
# incompatible versions:
# SysV /etc/install, /usr/sbin/install
# SunOS /usr/etc/install
# IRIX /sbin/install
# AIX /bin/install
# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
# AFS /usr/afsws/bin/install, which mishandles nonexistent args
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
echo "configure:604: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
    IFS="${IFS= 	}"; ac_save_IFS="$IFS"; IFS=":"
  for ac_dir in $PATH; do
    # Account for people who put trailing slashes in PATH elements.
    case "$ac_dir/" in
    /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
    *)
      # OSF1 and SCO ODT 3.0 have their own names for install.
      # Don't use installbsd from OSF since it installs stuff as root
      # by default.
      for ac_prog in ginstall scoinst install; do
        if test -f $ac_dir/$ac_prog; then
	  if test $ac_prog = install &&
            grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
	    # AIX install.  It has an incompatible calling convention.
	    :
	  else
	    ac_cv_path_install="$ac_dir/$ac_prog -c"
	    break 2
	  fi
	fi
      done
      ;;
    esac
  done
  IFS="$ac_save_IFS"

fi
  if test "${ac_cv_path_install+set}" = set; then
    INSTALL="$ac_cv_path_install"
  else
    # As a last resort, use the slow shell script.  We don't cache a
    # path for INSTALL within a source directory, because that will
    # break other packages using the cache if that directory is
    # removed, or if the path is relative.
    INSTALL="$ac_install_sh"
  fi
fi
echo "$ac_t""$INSTALL" 1>&6

# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
# It thinks the first close brace ends the variable substitution.
test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'

test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'

test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'

echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
echo "configure:657: checking whether build environment is sane" >&5
# Just in case
sleep 1
echo timestamp > conftestfile
# Do `set' in a subshell so we don't clobber the current shell's
# arguments.  Must try -L first in case configure is actually a
# symlink; some systems play weird games with the mod time of symlinks
# (eg FreeBSD returns the mod time of the symlink's containing
# directory).
if (
   set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
   if test "$*" = "X"; then
      # -L didn't work.
      set X `ls -t $srcdir/configure conftestfile`
   fi
   if test "$*" != "X $srcdir/configure conftestfile" \
      && test "$*" != "X conftestfile $srcdir/configure"; then

      # If neither matched, then we have a broken ls.  This can happen
      # if, for instance, CONFIG_SHELL is bash and it inherits a
      # broken ls alias from the environment.  This has actually
      # happened.  Such a system could not be considered "sane".
      { echo "configure: error: ls -t appears to fail.  Make sure there is not a broken
alias in your environment" 1>&2; exit 1; }
   fi

   test "$2" = conftestfile
   )
then
   # Ok.
   :
else
   { echo "configure: error: newly created file is older than distributed files!
Check your system clock" 1>&2; exit 1; }
fi
rm -f conftest*
echo "$ac_t""yes" 1>&6
if test "$program_transform_name" = s,x,x,; then
  program_transform_name=
else
  # Double any \ or $.  echo might interpret backslashes.
  cat <<\EOF_SED > conftestsed
s,\\,\\\\,g; s,\$,$$,g
EOF_SED
  program_transform_name="`echo $program_transform_name|sed -f conftestsed`"
  rm -f conftestsed
fi
test "$program_prefix" != NONE &&
  program_transform_name="s,^,${program_prefix},; $program_transform_name"
# Use a double $ so make ignores it.
test "$program_suffix" != NONE &&
  program_transform_name="s,\$\$,${program_suffix},; $program_transform_name"

# sed with no file args requires a program.
test "$program_transform_name" = "" && program_transform_name="s,x,x,"

echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
echo "configure:714: checking whether ${MAKE-make} sets \${MAKE}" >&5
set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  cat > conftestmake <<\EOF
all:
	@echo 'ac_maketemp="${MAKE}"'
EOF
# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
if test -n "$ac_maketemp"; then
  eval ac_cv_prog_make_${ac_make}_set=yes
else
  eval ac_cv_prog_make_${ac_make}_set=no
fi
rm -f conftestmake
fi
if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
  echo "$ac_t""yes" 1>&6
  SET_MAKE=
else
  echo "$ac_t""no" 1>&6
  SET_MAKE="MAKE=${MAKE-make}"
fi


PACKAGE=mpi2c++

VERSION=$VERSION

if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
  { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; }
fi



missing_dir=`cd $ac_aux_dir && pwd`
echo $ac_n "checking for working aclocal""... $ac_c" 1>&6
echo "configure:753: checking for working aclocal" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf.  Sigh.
if (aclocal --version) < /dev/null > /dev/null 2>&1; then
   ACLOCAL=aclocal
   echo "$ac_t""found" 1>&6
else
   ACLOCAL="$missing_dir/missing aclocal"
   echo "$ac_t""missing" 1>&6
fi

echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
echo "configure:766: checking for working autoconf" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf.  Sigh.
if (autoconf --version) < /dev/null > /dev/null 2>&1; then
   AUTOCONF=autoconf
   echo "$ac_t""found" 1>&6
else
   AUTOCONF="$missing_dir/missing autoconf"
   echo "$ac_t""missing" 1>&6
fi

echo $ac_n "checking for working automake""... $ac_c" 1>&6
echo "configure:779: checking for working automake" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf.  Sigh.
if (automake --version) < /dev/null > /dev/null 2>&1; then
   AUTOMAKE=automake
   echo "$ac_t""found" 1>&6
else
   AUTOMAKE="$missing_dir/missing automake"
   echo "$ac_t""missing" 1>&6
fi

echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
echo "configure:792: checking for working autoheader" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf.  Sigh.
if (autoheader --version) < /dev/null > /dev/null 2>&1; then
   AUTOHEADER=autoheader
   echo "$ac_t""found" 1>&6
else
   AUTOHEADER="$missing_dir/missing autoheader"
   echo "$ac_t""missing" 1>&6
fi

echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
echo "configure:805: checking for working makeinfo" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf.  Sigh.
if (makeinfo --version) < /dev/null > /dev/null 2>&1; then
   MAKEINFO=makeinfo
   echo "$ac_t""found" 1>&6
else
   MAKEINFO="$missing_dir/missing makeinfo"
   echo "$ac_t""missing" 1>&6
fi






#
# Configure script for MPI C++ Bindings.
# Set some directories and some defaults.
#

TOPDIR=`pwd`
DISTDIR=`dirname $TOPDIR`


#
# Directories for other packages
#

if test "$prefix" != "NONE"; then
    INSTALLDIR=$prefix
else
    INSTALLDIR="/usr/local"
fi

MPI_IMP=other_vendor
MPI_DIR=$prefix
MPI_INCDIR=

#MPI_CXX=
# Do this later -- #$%^#$ HP-UX!!
MPI_CXXFLAGS=
MPI_LDFLAGS=
MPI_LIBS=


#
# Balky flags
#

BALKY_CXX=
BALKY_CXXFLAGS=
BALKY_LIBS=
BALKY_LDFLAGS=


#
# Compiler flags
#

NOOPT=
OPTFLAGS="-O"
EXAM_OPTFLAGS=$OPTFLAGS
TEST_OPTFLAGS=$OPTFLAGS


#
# Miscellaneous flags
#

MPICH_DEV=
LAM_CXXFLAGS=
EXTRA_CXXFLAGS=
EXCPTN_CXXFLAGS=
EXCPTN_LDFLAGS=
WANT_SOCKET_LIBS=
WANT_THREAD_LIBS=
ARCH=
EXFLAGS=
FORCE_EXFLAGS=

#
HAVE_BROKEN_NAMESPACES=0
UNDERLYING_CXX=
USING_MPICH=0
MPI_MIDDLE_NAME=
MINI_BALKY_CXXFLAGS=
BALKY_CXXFLAGS=


#
# Ensure not to get a user aliased grep
#

if test -x /bin/grep; then
    GREP=/bin/grep
elif test -x /usr/bin/grep; then
    GREP=/usr/bin/grep
elif test -x /sbin/grep; then
    GREP=/sbin/grep
elif test -x /usr/sbin/grep; then
    GREP=/usr/sbin/grep
else
    # Extract the first word of "grep", so it can be a program name with args.
set dummy grep; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:912: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_GREP'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  case "$GREP" in
  /*)
  ac_cv_path_GREP="$GREP" # Let the user override the test with a path.
  ;;
  ?:/*)			 
  ac_cv_path_GREP="$GREP" # Let the user override the test with a dos path.
  ;;
  *)
  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
  ac_dummy="$PATH"
  for ac_dir in $ac_dummy; do 
    test -z "$ac_dir" && ac_dir=.
    if test -f $ac_dir/$ac_word; then
      ac_cv_path_GREP="$ac_dir/$ac_word"
      break
    fi
  done
  IFS="$ac_save_ifs"
  test -z "$ac_cv_path_GREP" && ac_cv_path_GREP="grep"
  ;;
esac
fi
GREP="$ac_cv_path_GREP"
if test -n "$GREP"; then
  echo "$ac_t""$GREP" 1>&6
else
  echo "$ac_t""no" 1>&6
fi

fi

#
# Get our system type
# Set up for some screwy machines
#


# Make sure we can run config.sub.
if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
fi

echo $ac_n "checking host system type""... $ac_c" 1>&6
echo "configure:959: checking host system type" >&5

host_alias=$host
case "$host_alias" in
NONE)
  case $nonopt in
  NONE)
    if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
    else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
    fi ;;
  *) host_alias=$nonopt ;;
  esac ;;
esac

host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
echo "$ac_t""$host" 1>&6


# 
# WDG: It is *wrong* to set these options before we know what compiler
# we are using.  After all, we may be using g++!
#
# (case on host moved to later)
case "$host" in
    *-hp-hpux*)
        # WDG, 11/9/99:
	# It is *NOT* correct to chose compiler flags based on the system
        # For example, what if g++ is being used?
        # The following flags for are the aCC compiler.  
        # Unfortunately, the compiler isn't available yet, so I can't
	# add the appropriate tests.  Errg.  
	if test "$GXX" = ""; then
	    EXTRA_CXXFLAGS="+W829,736"
	    CXXFLAGS="$CXXFLAGS $EXTRA_CXXFLAGS"
	    EXFLAGS="+eh"

	    NOOPT="-Wl,+vnocompatwarnings"
	    OPTFLAGS="+O1 -Wl,+vnocompatwarnings"
	    EXAM_OPTFLAGS=$OPTFLAGS
	    TEST_OPTFLAGS=$OPTFLAGS
	    
	    MPI_CXX_SAVE=$MPI_CXX
	    
	    ARCH=HPUX
	fi
        ;;

    mips-sgi-irix*)
        OPTFLAGS="-O3"
        TEST_OPTFLAGS=$OPTFLAGS
        EXAM_OPTFLAGS=$OPTFLAGS
	ARCH=IRIX
        ;;

    *-cray-unicos*)
	# Yuk!  We have to turn off all optimization in the test suite because
	# Cray's CC version 3.0.0.0 runs out of memory when compiling modules
	# like port_test.cc and request_array_test.cc.  Doh!!

	NOOPT="-O0"
	OPTFLAGS="-O3"
	TEST_OPTFLAGS=$NOOPT
	EXAM_OPTFLAGS=$OPTFLAGS

	EXFLAGS="-h exceptions"
	ARCH=CRAY
	;;
esac

#
# Now we can clear MPI_CXX
#

MPI_CXX=


#
# Set autoconf for C++
#

ac_ext=C
# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_cxx_cross



#
# Figure out which brand of echo we have and define
# prompt and print shell functions accordingly.
#
# Blatently stolen from the TIFF configure file.
#

if test `echo foo\\\c`@ = "foo@"; then
    prompt()
    {
        echo "$* \\c"
    }
elif test "`echo -n foo`@" = "foo@"; then
    prompt()
    {
        echo -n "$* "
    }
else
    prompt()
    {
        echo "$*"
    }
fi


#
# Find some extra programs
#

# Extract the first word of "awk", so it can be a program name with args.
set dummy awk; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1083: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_AWK'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  case "$AWK" in
  /*)
  ac_cv_path_AWK="$AWK" # Let the user override the test with a path.
  ;;
  ?:/*)			 
  ac_cv_path_AWK="$AWK" # Let the user override the test with a dos path.
  ;;
  *)
  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
  ac_dummy="$PATH"
  for ac_dir in $ac_dummy; do 
    test -z "$ac_dir" && ac_dir=.
    if test -f $ac_dir/$ac_word; then
      ac_cv_path_AWK="$ac_dir/$ac_word"
      break
    fi
  done
  IFS="$ac_save_ifs"
  ;;
esac
fi
AWK="$ac_cv_path_AWK"
if test -n "$AWK"; then
  echo "$ac_t""$AWK" 1>&6
else
  echo "$ac_t""no" 1>&6
fi

# Extract the first word of "wc", so it can be a program name with args.
set dummy wc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1118: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_WC'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  case "$WC" in
  /*)
  ac_cv_path_WC="$WC" # Let the user override the test with a path.
  ;;
  ?:/*)			 
  ac_cv_path_WC="$WC" # Let the user override the test with a dos path.
  ;;
  *)
  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
  ac_dummy="$PATH"
  for ac_dir in $ac_dummy; do 
    test -z "$ac_dir" && ac_dir=.
    if test -f $ac_dir/$ac_word; then
      ac_cv_path_WC="$ac_dir/$ac_word"
      break
    fi
  done
  IFS="$ac_save_ifs"
  ;;
esac
fi
WC="$ac_cv_path_WC"
if test -n "$WC"; then
  echo "$ac_t""$WC" 1>&6
else
  echo "$ac_t""no" 1>&6
fi



#
# Check --with values for specific MPI implementations.  Check for:
#  - wrapper compilers that come with some implementations
#  - specific options necessary for some MPI implementations
#
# LAM 6.3/6.4
#

# Check whether --with-lam or --without-lam was given.
if test "${with_lam+set}" = set; then
  withval="$with_lam"
  MPI_IMP="lam" WITHDIR=$withval
fi


if test "$MPI_IMP" = "lam"; then

    # Run lamboot with a dummy hostfile to find out what version it is

    MPI_CXX=no
    if test "$WITHDIR" != "" -a -x "$WITHDIR/bin/hcp"; then
	echo $ac_n "checking for hcp""... $ac_c" 1>&6
echo "configure:1174: checking for hcp" >&5
	MPI_CXX=$WITHDIR/bin/hcp
	LAMBOOT=$WITHDIR/bin/lamboot
	LAMWIPE=$WITHDIR/bin/wipe
	echo "$ac_t""$MPI_CXX" 1>&6
    elif test "$WITHDIR" != "" -a -x "$WITHDIR/hcp"; then
	echo $ac_n "checking for hcp""... $ac_c" 1>&6
echo "configure:1181: checking for hcp" >&5
	MPI_CXX=$WITHDIR/hcp
	LAMBOOT=$WITHDIR/lamboot
	LAMWIPE=$WITHDIR/wipe
	echo "$ac_t""$MPI_CXX" 1>&6
    else
	# Extract the first word of "hcp", so it can be a program name with args.
set dummy hcp; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1190: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_MPI_CXX'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  case "$MPI_CXX" in
  /*)
  ac_cv_path_MPI_CXX="$MPI_CXX" # Let the user override the test with a path.
  ;;
  ?:/*)			 
  ac_cv_path_MPI_CXX="$MPI_CXX" # Let the user override the test with a dos path.
  ;;
  *)
  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
  ac_dummy="$PATH"
  for ac_dir in $ac_dummy; do 
    test -z "$ac_dir" && ac_dir=.
    if test -f $ac_dir/$ac_word; then
      ac_cv_path_MPI_CXX="$ac_dir/$ac_word"
      break
    fi
  done
  IFS="$ac_save_ifs"
  test -z "$ac_cv_path_MPI_CXX" && ac_cv_path_MPI_CXX="no"
  ;;
esac
fi
MPI_CXX="$ac_cv_path_MPI_CXX"
if test -n "$MPI_CXX"; then
  echo "$ac_t""$MPI_CXX" 1>&6
else
  echo "$ac_t""no" 1>&6
fi

    fi

    if test "$MPI_CXX" = "no"; then
        { echo "configure: error: cannot continue -- put hcp in your path" 1>&2; exit 1; }
    else
	LAMBOOT=`dirname $MPI_CXX`/lamboot
	LAMWIPE=`dirname $MPI_CXX`/wipe
    fi
    CXX=$MPI_CXX

    MPI_LIBS=" "

    echo $ac_n "checking for LAM/MPI version""... $ac_c" 1>&6
echo "configure:1236: checking for LAM/MPI version" >&5
    VER=`$LAMBOOT -V | $GREP LAM`
    if test "`echo $VER | $GREP 6.1`" != ""; then
	echo "$ac_t""$LAMVER (you should upgrade)" 1>&6
	echo "configure: warning: *** LAM/MPI 6.1 is no longer supported." 1>&2
	WANT_UPGRADE=1

    elif test "`echo $VER | $GREP 6.2`" != ""; then
	echo "$ac_t""$LAMVER (you should upgrade)" 1>&6
	echo "configure: warning: *** LAM/MPI 6.2 is no longer supported." 1>&2
	WANT_UPGRADE=1

    elif test "`echo $VER | $GREP 6.3.1`" != ""; then
	cat >> confdefs.h <<\EOF
#define MPI2CPP_LAM631 1
EOF

	echo "$ac_t""$LAMVER (you should upgrade)" 1>&6
	echo "configure: warning: *** LAM/MPI 6.3.1 is no longer supported." 1>&2
	WANT_UPGRADE=1

    elif test "`echo $VER | $GREP 6.3.2`" != ""; then
	cat >> confdefs.h <<\EOF
#define MPI2CPP_LAM632 1
EOF

	echo "$ac_t""$LAMVER (you should upgrade)" 1>&6
	echo "configure: warning: *** LAM/MPI 6.3.2 is no longer supported." 1>&2
	WANT_UPGRADE=1

    elif test "`echo $VER | $GREP 6.3.3`" != ""; then
	LAMVER=6.3.3
	LAMCXXFLAGS="-DLAM_BUILDING=1"
	cat >> confdefs.h <<\EOF
#define MPI2CPP_LAM633 1
EOF

	echo "$ac_t""$LAMVER (good)" 1>&6
	WANT_UPGRADE=0

    elif test "`echo $VER | $GREP 6.3`" != ""; then
	LAMVER=6.3
	echo "$ac_t""$LAMVER (you should upgrade)" 1>&6
	echo "configure: warning: *** LAM/MPI 6.3 is no longer supported." 1>&2
	WANT_UPGRADE=1

    elif test "`echo $VER | $GREP 6.4`" != ""; then
	LAMVER=6.4
	cat >> confdefs.h <<\EOF
#define MPI2CPP_LAM64 1
EOF

	echo "$ac_t""$LAMVER (good)" 1>&6
	WANT_UPGRADE=0
    else
	LAMVER=no
	cat >> confdefs.h <<\EOF
#define MPI2CPP_LAMUNKNOWN 1
EOF

	echo "$ac_t""cannot determine LAM version -- good luck" 1>&6
    fi
    if test "$WANT_UPGRADE" = "1"; then
	echo "configure: warning: *** WARNING: You are using an old version of LAM/MPI." 1>&2
	echo "configure: warning: *** You should upgrade to the latest version." 1>&2
	echo "configure: warning: *** See http://www.mpi.nd.edu/lam/" 1>&2
	{ echo "configure: error: *** Cannot continue" 1>&2; exit 1; }
    fi
    MPI_MIDDLE_NAME="lam"

    # Get the underlying compiler name so that we can check for
    # exception flags properly

    echo $ac_n "checking for LAM's underlying C++ compiler""... $ac_c" 1>&6
echo "configure:1310: checking for LAM's underlying C++ compiler" >&5
    full="`hcp -showme`"
    first="`echo $full | awk '{ print $1 }'`"
    UNDERLYING_CXX="`basename $first`"
    if test "$UNDERLYING_CXX" = "libtool"; then
	first=1
	done=0
	for word in $full ; do
	    if test "$done" = "0"; then
		name="`basename $word`"
		if test "$first" != "1" -a \
			"`echo $word | cut -c1-2`" != "--"; then
		    UNDERLYING_CXX="$word"
		    done=1
		fi
		first=0
	    fi
	done
	echo "$ac_t""$UNDERLYING_CXX (via libtool)" 1>&6
    else
	echo "$ac_t""$UNDERLYING_CXX" 1>&6
    fi

    # If we're building LAM (and we should be -- we shouldn't be
    # compiling this from outside of LAM anymore!), set some flags

    # Check whether --with-lam-building or --without-lam-building was given.
if test "${with_lam_building+set}" = set; then
  withval="$with_lam_building"
  MINI_BALKY_CXXFLAGS="-lam-building"
fi

fi

#
# MPICH 1.2.0 (or higher)
#

MPICH_BIN=
MPICH_SRC=
MPILIB_DIR=

# Check whether --with-mpich or --without-mpich was given.
if test "${with_mpich+set}" = set; then
  withval="$with_mpich"
  MPI_IMP="mpich" WITHDIR=$withval
fi

# Check whether --with-mpichdev or --without-mpichdev was given.
if test "${with_mpichdev+set}" = set; then
  withval="$with_mpichdev"
  MPI_IMP="mpich" MPICH_DEV=$withval
fi

# Check whether --with-mpichbin or --without-mpichbin was given.
if test "${with_mpichbin+set}" = set; then
  withval="$with_mpichbin"
  MPI_IMP="mpich" MPICH_BIN=$withval
fi

# Check whether --with-mpichsrc or --without-mpichsrc was given.
if test "${with_mpichsrc+set}" = set; then
  withval="$with_mpichsrc"
  MPI_IMP="mpich" MPICH_SRC=$withval
fi

# Check whether --with-mpichlib or --without-mpichlib was given.
if test "${with_mpichlib+set}" = set; then
  withval="$with_mpichlib"
  MPI_IMP="mpich" MPILIB_DIR=$withval
fi

# Check whether --with-mpichlibname or --without-mpichlibname was given.
if test "${with_mpichlibname+set}" = set; then
  withval="$with_mpichlibname"
  MPI_IMP="mpich" MPICH_LIBNAME=$withval
else
  MPICH_LIBNAME="mpich"
fi

if test "$MPI_IMP" = "mpich"; then

    if test "$WITHDIR" = "yes"; then
        { echo "configure: error: supplied --with-mpich without a directory" 1>&2; exit 1; }
    fi
    USING_MPICH=1

    echo $ac_n "checking MPICH version""... $ac_c" 1>&6
echo "configure:1398: checking MPICH version" >&5
    patchfile=$WITHDIR/include/patchlevel.h
    if test ! -s $patchfile -a -n "$MPICH_SRC" ; then
	# look for it in the source location
        if test -s $MPICH_SRC/include/patchlevel.h ; then
	    patchfile=$MPICH_SRC/include/patchlevel.h
	fi
    fi

    if test ! -s $patchfile; then
	echo "configure: warning: Cannot find the patchfile.  Hence, cannot determine" 1>&2
	echo "configure: warning: MPICH's version.  Perhaps you need to" 1>&2
	echo "configure: warning: specify where the MPICH source tree is with the" 1>&2
	echo "configure: warning: --with-mpich-srcdir flag...?" 1>&2
	echo "configure: warning: Going to make a best guess... (good luck!)" 1>&2
	# Stoopid emacs mode: '
	cat >> confdefs.h <<\EOF
#define MPI2CPP_MPICHUNKNOWN 1
EOF

    else
	MPICH_VERSION=`cat $patchfile | awk '{print $3}' | sed -e 's/\.0-9//' | tr '\012' '.'`
	if test "$MPICH_VERSION" = "1.0.0.13."; then
	    echo "$ac_t""1.0.13 (you should upgrade)" 1>&6
	    WANT_UPGRADE=1
	elif test "$MPICH_VERSION" = "1.1.0."; then
	    echo "$ac_t""1.1.0 (you should upgrade)" 1>&6
	    WANT_UPGRADE=1
	else
	
	    #
	    # Argh!  MPICH changed the format of their patchlevel file
	    # as of version 1.1.1.
	    #

	    MPICH_VERSION=`grep 'PATCHLEVEL ' $patchfile | awk '{print $3}'`
	    mv1=`grep 'PATCHLEVEL_SUBMINOR' $patchfile | awk '{print $3}'`
	    MPICH_VERSION="$MPICH_VERSION.$mv1."
	    
	    if test -z "$MPILIB_DIR" ; then
		MPILIB_DIR=$WITHDIR/$MPICH_DEV
	    fi
	    if test "$MPICH_VERSION" = "1.1.1."; then
		echo "$ac_t""1.1.1 (you should upgrade)" 1>&6
		WANT_UPGRADE=1
	    elif test "$MPICH_VERSION" = "1.1.2."; then
		echo "$ac_t""1.1.2 (you should upgrade)" 1>&6
		WANT_UPGRADE=1
	    elif test "$MPICH_VERSION" = "1.1.3."; then
		# Need to make this MPICH113 eventually
		echo "$ac_t""1.1.3 (you should upgrade)" 1>&6
		WANT_UPGRADE=1
	    elif test "$MPICH_VERSION" = "1.2.0."; then
		cat >> confdefs.h <<\EOF
#define MPI2CPP_MPICH120 1
EOF

		echo "$ac_t""1.2.0 (good)" 1>&6
		WANT_UPGRADE=0
		if test -z "$MPICH_BIN"; then
		    { echo "configure: error: when configuring for 1.2.0, --with-mpichbin must be specified" 1>&2; exit 1; }
		fi
	    elif test "$MPICH_VERSION" = "1.2.1."; then
		cat >> confdefs.h <<\EOF
#define MPI2CPP_MPICH121 1
EOF

		echo "$ac_t""1.2.1 (good)" 1>&6
		WANT_UPGRADE=0
		if test -z "$MPICH_BIN"; then
		    { echo "configure: error: when configuring for 1.2.1, --with-mpichbin must be specified" 1>&2; exit 1; }
		fi
	    elif test "$MPICH_VERSION" = "1.2.2."; then
		cat >> confdefs.h <<\EOF
#define MPI2CPP_MPICH121 1
EOF

		echo "$ac_t""1.2.2 (good)" 1>&6
		WANT_UPGRADE=0
		if test -z "$MPICH_BIN"; then
		    { echo "configure: error: when configuring for 1.2.2, --with-mpichbin must be specified" 1>&2; exit 1; }
		fi
	    elif test "$MPICH_VERSION" = "1.2.3."; then
		cat >> confdefs.h <<\EOF
#define MPI2CPP_MPICH121 1
EOF

		echo "$ac_t""1.2.3 (good)" 1>&6
		WANT_UPGRADE=0
		if test -z "$MPICH_BIN"; then
		    { echo "configure: error: when configuring for 1.2.3, --with-mpichbin must be specified" 1>&2; exit 1; }
		fi
	    elif test "$MPICH_VERSION" = "1.2.4."; then
		cat >> confdefs.h <<\EOF
#define MPI2CPP_MPICH121 1
EOF

		echo "$ac_t""1.2.4 (good)" 1>&6
		WANT_UPGRADE=0
		if test -z "$MPICH_BIN"; then
		    { echo "configure: error: when configuring for 1.2.4, --with-mpichbin must be specified" 1>&2; exit 1; }
		fi
	    elif test "$MPICH_VERSION" = "1.2.5."; then
		cat >> confdefs.h <<\EOF
#define MPI2CPP_MPICH121 1
EOF

		echo "$ac_t""1.2.5 (good)" 1>&6
		WANT_UPGRADE=0
		if test -z "$MPICH_BIN"; then
		    { echo "configure: error: when configuring for 1.2.5, --with-mpichbin must be specified" 1>&2; exit 1; }
		fi
	    elif test "$MPICH_VERSION" = "1.2.6."; then
		cat >> confdefs.h <<\EOF
#define MPI2CPP_MPICH121 1
EOF

		echo "$ac_t""1.2.6 (good)" 1>&6
		WANT_UPGRADE=0
		if test -z "$MPICH_BIN"; then
		    { echo "configure: error: when configuring for 1.2.6, --with-mpichbin must be specified" 1>&2; exit 1; }
		fi
	    else
		cat >> confdefs.h <<\EOF
#define MPI2CPP_MPICHUNKNOWN 1
EOF

		echo "$ac_t""unrecognized MPICH level -- good luck!" 1>&6
	    fi
	    
	fi
    fi
    
    if test "$WANT_UPGRADE" = "1"; then
	echo "configure: warning: *** WARNING: It looks like you are using an old" 1>&2
	echo "configure: warning: *** version of MPICH." 1>&2
	echo "configure: warning: *** You need to upgrade to the latest version." 1>&2
	echo "configure: warning: *** See http://www.mcs.anl.gov/mpi/mpich/" 1>&2
	{ echo "configure: error: *** Cannot continue." 1>&2; exit 1; }
    fi

    if test -z "$MPILIB_DIR" ; then
        MPILIB_DIR=$WITHDIR/$MPICH_DEV
    fi

    OLD_ARCH=$ARCH
    if test -x $WITHDIR/util/tarch; then 
	ARCH=`$WITHDIR/util/tarch | sed s/-/_/g`
    elif test -x $WITHDIR/bin/tarch; then
	ARCH=`$WITHDIR/bin/tarch | sed s/-/_/g`
    fi

    if test -d "$WITHDIR/lib"; then
      MPICHLIBDIR=$WITHDIR/lib/$ARCH
    elif test -d "$WITHDIR/build"; then
      MPICHLIBDIR=$WITHDIR/build/$ARCH
    elif test ! -z "$MPILIB_DIR"; then
      MPICHLIBDIR="$MPILIB_DIR"
    else
	{ echo "configure: error: could not find MPICH support for $ARCH" 1>&2; exit 1; }
    fi

    if test ! "$MPICH_DEV" = ""; then
	DEVICE=$MPICH_DEV
    elif test -d "$MPICHLIBDIR"; then
	echo "no MPICH device specified"
	echo $ac_n "checking for existing MPICH devices""... $ac_c" 1>&6
echo "configure:1525: checking for existing MPICH devices" >&5
	devices=""
	for device in `/bin/ls $MPICHLIBDIR`; do
	    if test -d $MPICHLIBDIR/$device; then
		devices="$device $devices"
	    fi
	done
	devices=`echo "$devices" | sed -e 's/^ 	*//' -e 's/ 	*$//'`
	
	device_count=`echo $devices | $WC | $AWK '{ print $2 }'`

	#
	# How many did we find?
	#

	if test "$device_count" = "0"; then
	    echo "$ac_t""none found" 1>&6
	    { echo "configure: error: cannot continue" 1>&2; exit 1; }
	elif test "$device_count" = "1"; then
	    DEVICE=$devices
	    echo "$ac_t""found $DEVICE MPICH device" 1>&6
	else
	    echo "$ac_t""found multiple MPICH devices" 1>&6
	    DEVICE=0
	    while test "$DEVICE" = "0"; do
		prompt "Please select an MPICH device ($devices):"
		read DEVICE
		DEVICE=`echo "$DEVICE" | sed -e 's/^	*//' -e 's/	*$//'`

		if test ! -d "$MPICHLIBDIR/$DEVICE"; then
		    echo "$DEVICE MPICH device not found"
		    DEVICE=0
		fi
	    done
	fi
	MPICH_DEV=$MPICHLIBDIR/$DEVICE

	# #$%^$#%^$@%@#%@#$!!!!!!!
	# Don't ask.  Trust us.
	# (the directory structure for MPICH changed between 1.1.1 and 1.1.2
	if test "$MPICH_VERSION" = "1.1.2."; then
	    MPICH_DEV=$MPICH_DEV/lib
	fi
    else
	{ echo "configure: error: could not find MPICH support for $ARCH" 1>&2; exit 1; }
    fi
    
    ARCH=$OLD_ARCH

    # Look for the actual PROGRAMS; don't use the versions!
    if test -x $MPICH_BIN/mpicxx ; then
        # MPICH 1.2.5 and later; MPICH2
        MPI_CXX=$MPICH_BIN/mpicxx
    elif test -x $MPICH_BIN/mpiCC ; then
        # MPICH 1.2.0 to 1.2.4
        MPI_CXX=$MPICH_BIN/mpiCC
    else
	MPI_CXX=mpiCC
    fi
    CXX=$MPI_CXX
    # Tell mpiCC to not load mpi++.h when reading mpi.h
    CXXFLAGS="$CXXFLAGS -DMPICH_SKIP_MPICXX"
    MPI_LIBS="-l$MPICH_LIBNAME"

    # JGS not sure were these should go
    MPI_CXXFLAGS="-I$WITHDIR/include -I$WITHDIR"
    MPI_LDFLAGS="-L$WITHDIR/$MPICH_DEV"

    # Get the underlying compiler name so that we can check for
    # exception flags properly

    echo $ac_n "checking for MPICH's underlying C++ compiler""... $ac_c" 1>&6
echo "configure:1594: checking for MPICH's underlying C++ compiler" >&5
    full="`$MPI_CXX -show`"
    first="`echo $full | awk '{ print $1 }'`"
    UNDERLYING_CXX="`basename $first`"
    if test "$UNDERLYING_CXX" = "libtool"; then
	first=1
	done=0
	for word in $full ; do
	    if test "$done" = "0"; then
		name="`basename $word`"
		if test "$first" != "1" -a \
			"`echo $word | cut -c1-2`" != "--"; then
		    UNDERLYING_CXX="$word"
		    done=1
		fi
		first=0
	    fi
	done
	echo "$ac_t""$UNDERLYING_CXX (via libtool)" 1>&6
    else
	echo "$ac_t""$UNDERLYING_CXX" 1>&6
    fi


    if test "$ARCH" != "IRIX"; then
	WANT_SOCKET_LIBS=1
    else
	#MPI_CXXFLAGS="$MPI_CXXFLAGS -64"
	#MPI_LDFLAGS="$MPI_LDFLAGS -64"

	#CXXFLAGS="$CXXFLAGS -64"
	#LDFLAGS="$LDFLAGS -64"
        :
    fi
    WANT_THREAD_LIBS=1
fi


#
# IBM SP
#

# Check whether --with-sp or --without-sp was given.
if test "${with_sp+set}" = set; then
  withval="$with_sp"
  MPI_IMP="ibm-sp" CXX=mpCC
fi


# Stoopid emacs mode: '

if test "$MPI_IMP" = "ibm-sp"; then
    # Extract the first word of "mpCC", so it can be a program name with args.
set dummy mpCC; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1649: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_MPI_CXX'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  case "$MPI_CXX" in
  /*)
  ac_cv_path_MPI_CXX="$MPI_CXX" # Let the user override the test with a path.
  ;;
  ?:/*)			 
  ac_cv_path_MPI_CXX="$MPI_CXX" # Let the user override the test with a dos path.
  ;;
  *)
  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
  ac_dummy="$PATH"
  for ac_dir in $ac_dummy; do 
    test -z "$ac_dir" && ac_dir=.
    if test -f $ac_dir/$ac_word; then
      ac_cv_path_MPI_CXX="$ac_dir/$ac_word"
      break
    fi
  done
  IFS="$ac_save_ifs"
  test -z "$ac_cv_path_MPI_CXX" && ac_cv_path_MPI_CXX="doh"
  ;;
esac
fi
MPI_CXX="$ac_cv_path_MPI_CXX"
if test -n "$MPI_CXX"; then
  echo "$ac_t""$MPI_CXX" 1>&6
else
  echo "$ac_t""no" 1>&6
fi

    if test "$MPI_CXX" = "doh"; then
        echo $ac_n "checking for mpCC (elsewhere)""... $ac_c" 1>&6
echo "configure:1684: checking for mpCC (elsewhere)" >&5
        foreach comp /bin/mpCC /usr/bin/mpCC
            if test "$MPI_CXX" = "" -a -x $comp; then
                echo "$ac_t""yes" 1>&6
                MPI_CXX=$comp
            fi
        end
        if test "$MPI_CXX" = ""; then
            echo "$ac_t""no" 1>&6
            { echo "configure: error: cannot continue -- put mpCC in your path" 1>&2; exit 1; }
        fi
    fi
    CXX=$MPI_CXX
   
    OPTFLAGS="-O3 -qstrict -qarch=pwr2 -qtune=pwr2s -Q"
    TEST_OPTFLAGS=$OPTFLAGS
    EXAM_OPTFLAGS=$OPTFLAGS

    echo $ac_n "checking POE version""... $ac_c" 1>&6
echo "configure:1703: checking POE version" >&5
    POE_VERSION=`lslpp -L ppe.poe | $GREP poe | awk '{ print $2 }'`
    if test "$POE_VERSION" = "2.1.0.14"; then
        cat >> confdefs.h <<\EOF
#define MPI2CPP_IBM21014 1
EOF

        echo "$ac_t""2.1.0.14 (you should upgrade)" 1>&6
    elif test "$POE_VERSION" = "2.1.0.15"; then
        cat >> confdefs.h <<\EOF
#define MPI2CPP_IBM21015 1
EOF

        echo "$ac_t""2.1.0.15 (you should upgrade)" 1>&6
    elif test "$POE_VERSION" = "2.1.0.16"; then
        cat >> confdefs.h <<\EOF
#define MPI2CPP_IBM21016 1
EOF

        echo "$ac_t""2.1.0.16 (you should upgrade)" 1>&6
    elif test "$POE_VERSION" = "2.1.0.17"; then
        cat >> confdefs.h <<\EOF
#define MPI2CPP_IBM21017 1
EOF

        echo "$ac_t""2.1.0.17 (you should upgrade)" 1>&6
    elif test "$POE_VERSION" = "2.1.0.18"; then
        cat >> confdefs.h <<\EOF
#define MPI2CPP_IBM21018 1
EOF

        echo "$ac_t""2.1.0.18 (you should upgrade)" 1>&6
    elif test "$POE_VERSION" = "2.3.0.0"; then
        cat >> confdefs.h <<\EOF
#define MPI2CPP_IBM2_3_0_0 1
EOF

        echo "$ac_t""2.3.0.0 (you should upgrade)" 1>&6
    elif test "$POE_VERSION" = "2.4.0.0"; then
        cat >> confdefs.h <<\EOF
#define MPI2CPP_IBM2_4_0_0 1
EOF

        echo "$ac_t""2.4.0.0 (good)" 1>&6
    else
        cat >> confdefs.h <<\EOF
#define MPI2CPP_IBMUNKNOWN 1
EOF

        echo "$ac_t""Unknown version -- $POE_VERSION (good luck)" 1>&6
    fi
fi


#
# SGI IRIX 6.4
#

# Check whether --with-sgi or --without-sgi was given.
if test "${with_sgi+set}" = set; then
  withval="$with_sgi"
  MPI_IMP="sgi" CXX=CC
fi

# Check whether --with-sgi64 or --without-sgi64 was given.
if test "${with_sgi64+set}" = set; then
  withval="$with_sgi64"
  MPI_IMP="sgi64" CXX=CC
fi


if test "$MPI_IMP" = "sgi" -o "$MPI_IMP" = "sgi64"; then
    MPI_LIBS="-lmpi"

    # Strategy: build up a list of all the libdirs.  Then search for
    # the appropriate libmpi.so or libmpi.a.  

    libpaths=/tmp
    if test "?$LD_LIBRARY64_PATH" != "0"; then
	libpaths="$LD_LIBRARY64_PATH"
    fi
    if test "?$LD_LIBRARYN32_PATH" != "0"; then
	libpaths="$LD_LIBRARYN32_PATH:$libpaths"
    fi
    if test "?$LD_LIBRARY_PATH" != "0"; then
	libpaths="$LD_LIBRARY_PATH:$libpaths"
    fi

    # If they just said "--with-sgi", go find the libmpi.so

    LIBDIR=
    if test "$MPI_IMP" = "sgi"; then
	num=1
	dir="`echo $libpaths | cut -d: -f$num`"

	# Iterate through the dirs, look for a libmpi.a or libmpi.so

	while test "$dir" != ""; do
	    if test -f $dir/libmpi.so -o -f $dir/libmpi.a; then
		LIBDIR="$dir"
		dir=""
	    else
		num="`expr $num + 1`"
		dir="`echo $libpaths | cut -d: -f$num`"
	    fi
	done
	if test "$LIBDIR" = ""; then
	    echo "configure: warning: Cannot find libmpi.(a|so)" 1>&2
	    { echo "configure: error: Cannot continue" 1>&2; exit 1; }
	fi
	isn32="`echo $LIBDIR | $GREP /libn32/`"
	is64="`echo $LIBDIR | $GREP /lib64/`"
        if test "$isn32" != ""; then
            SGIFLAGS="-n32"
            SGIBIT="n32"
        elif test "$is64" != ""; then
            SGIFLAGS="-64"
            SGIBIT="64"
	else
	    SGIFLAGS=""
	    SGIBIT="32"
        fi
    elif test "$MPI_IMP" = "sgi64"; then
	num=1
	dir="`echo $libpaths | cut -d: -f$num`"

	# Iterate through the dirs, look for libmpi.a or libmpi.so,
	# but it must have /lib64/ in the directory name.

	while test "$dir" != ""; do
	    if test \( -f $dir/libmpi.so -o -f $dir/libmpi.a \) -a \
	      "`echo $dir | $GREP /lib64/`" != ""; then
		LIBDIR="$dir"
		dir=""
	    else
		num="`expr $num + 1`"
		dir="`echo $libpaths | cut -d: -f$num`"
	    fi
	done
	if test "$LIBDIR" = ""; then
	    echo "configure: warning: Cannot find 64 bit libmpi.(a|so)" 1>&2
	    { echo "configure: error: Cannot continue" 1>&2; exit 1; }
	fi
        SGIFLAGS="-64"
        SGIBIT="64"
    fi

    # Now that we found it, find the version number

    echo $ac_n "checking SGI MPI version""... $ac_c" 1>&6
echo "configure:1853: checking SGI MPI version" >&5
    WANT_UPGRADE=
    IS20=`strings $LIBDIR/libmpi.so | $GREP "SGI MPI 2.0"`
    if test "$IS20" != ""; then    
        echo "$ac_t""2.0 ($SGIBIT) -- you should upgrade" 1>&6
	WANT_UPGRADE=1
    else

      IS20=`strings $LIBDIR/libmpi.so | $GREP "SGI MPI 2.0"`
      if test "$IS20" != ""; then    
        echo "$ac_t""2.0 ($SGIBIT) -- you should upgrade" 1>&6
	WANT_UPGRADE=1
      else

        IS30=`strings $LIBDIR/libmpi.so | $GREP "SGI MPI 3.0"`
        if test "$IS30" != ""; then
            cat >> confdefs.h <<\EOF
#define MPI2CPP_SGI30 1
EOF

            echo "$ac_t""3.0 ($SGIBIT) -- you should upgrade" 1>&6
	    WANT_UPGRADE=1
        else

          IS31=`strings $LIBDIR/libmpi.so | $GREP "SGI MPI 3.1"`
          if test "$IS31" != ""; then
              cat >> confdefs.h <<\EOF
#define MPI2CPP_SGI31 1
EOF

              echo "$ac_t""3.1 ($SGIBIT) -- you should upgrade" 1>&6
	      WANT_UPGRADE=1
          else

	    IS32=`strings $LIBDIR/libmpi.so | $GREP "SGI MPI 3.2.0.0"`
	    if test "$IS32" != ""; then
		cat >> confdefs.h <<\EOF
#define MPI2CPP_SGI32 1
EOF

		echo "$ac_t""3.2 ($SGIBIT) -- you should upgrade" 1>&6

		# We'll let this one go, 'cause it's the last one that
		# real users can use this package with -- SGI already
		# includes this package in every version after this.

	    else
              VER=`strings $LIBDIR/libmpi.so | $GREP "SGI MPI"`
              cat >> confdefs.h <<\EOF
#define MPI2CPP_SGIUNKNOWN 1
EOF

              
              echo "$ac_t""Unknown version ($SGIBIT) -- $VER (good luck)" 1>&6
	      echo "configure: warning: *** WARNING: It is likely that you are using a version" 1>&2
	      echo "configure: warning: *** later than SGI MPI 3.2.0.0 (or later than the" 1>&2
	      echo "configure: warning: *** Message Passing Toolkit 1.3).  SGI started including" 1>&2
	      echo "configure: warning: *** this package in their MPI starting with MPT 1.4." 1>&2
	      echo "configure: warning: *** As such, you probably do not need this package, and" 1>&2
	      echo "configure: warning: *** it is likely that this compilation will fail." 1>&2
	    fi
          fi
        fi
      fi
    fi

    if test "$WANT_UPGRADE" = "1"; then
        echo "configure: warning: *** You are advised to get the latest version of SGI's MPI" 1>&2
        echo "configure: warning: *** See http://www.sgi.com/Products/Evaluation/evaluation.html" 1>&2
	{ echo "configure: error: *** Cannot continue." 1>&2; exit 1; }
    fi

    MPI_CXXFLAGS="$SGIFLAGS"
    MPI_LDFLAGS="$SGIFLAGS"
fi


#
# Cray
#

# Check whether --with-cray or --without-cray was given.
if test "${with_cray+set}" = set; then
  withval="$with_cray"
  MPI_IMP="cray"
fi


if test "$MPI_IMP" = "cray"; then
    MPI_LIBS="-lmpi"
# Per jitterbug PR#59, assuming the native compiler is not necessarily
# a good thing
    if test "$?CXX" = "0"; then
	CXX=CC
    fi
    MPI_CXX="$CXX"

    cat >> confdefs.h <<\EOF
#define MPI2CPP_CRAY 1
EOF

    echo $ac_n "checking Cray MPI version""... $ac_c" 1>&6
echo "configure:1955: checking Cray MPI version" >&5
    CRAYVER=`ls -ld /opt/ctl/mpt/mpt | awk '{ print $11 }' | cut -d/ -f5`
    if test "$CRAYVER" = "1.1.0.4"; then
        cat >> confdefs.h <<\EOF
#define MPI2CPP_CRAY1104 1
EOF

	echo "$ac_t""1.1.0.4 (good)" 1>&6
    else
	cat >> confdefs.h <<\EOF
#define MPI2CPP_CRAYUNKNOWN 1
EOF

	echo "$ac_t""unknown Cray MPI version -- good luck!" 1>&6
    fi

# It seems that this flag is way outdated (per C++ jitterbut PR#59)
#    MPI_CXXFLAGS="-hnomessage=427"
    MPI_CXXFLAGS=
    MPI_LDFLAGS=""
fi


#
# HP-UX
#

# Check whether --with-hp or --without-hp was given.
if test "${with_hp+set}" = set; then
  withval="$with_hp"
  MPI_IMP="hp"
fi


if test "$MPI_IMP" = "hp"; then
        if test "$MPI_ROOT" = ""; then
                MPI_ROOT="/opt/mpi"
                echo "configure: warning: \$MPI_ROOT is defaulting to /opt/mpi." 1>&2
                echo "configure: warning: Override it by setting it manually and re-running configure." 1>&2
        fi

	MPI_CXX=$MPI_CXX_SAVE
        if test "$MPI_CXX" = ""; then
                MPI_CXX=aCC
                echo "configure: warning: You need to set \$MPI_CXX to the appropriate compiler." 1>&2
                echo "configure: warning: Defaulting to aCC." 1>&2
        fi

        echo $ac_n "checking HP-UX MPI version""... $ac_c" 1>&6
echo "configure:2004: checking HP-UX MPI version" >&5
        if ! test -r $MPI_ROOT/lib/pa1.1/libmpi.a; then
                echo "$ac_t""cannot find libmpi.a!" 1>&6
                { echo "configure: error: Is \$MPI_ROOT set properly?" 1>&2; exit 1; }
        fi

        HPSTR=`what $MPI_ROOT/lib/pa1.1/libmpi.a | $GREP "HP MPI"`
	HPVER=`echo $HPSTR | cut -d. -f2-3`
        if test "$HPVER" = "01.02"; then
                cat >> confdefs.h <<\EOF
#define MPI2CPP_HPUX0102 1
EOF

                echo "$ac_t""1.2 (you should upgrade)" 1>&6
	else
		HPVER=`echo "$HPSTR" | sed -e "s/[^0-9\.]*//" | cut -c1-5`
               	if test "$HPVER" = "01.03"; then
			cat >> confdefs.h <<\EOF
#define MPI2CPP_HPUX0103 1
EOF

			echo "$ac_t""1.3 (good )" 1>&6
                elif test "$HPVER" = "01.05"; then
                        cat >> confdefs.h <<\EOF
#define MPI2CPP_HPUX0105 1
EOF

                        echo "$ac_t""1.5 (good)" 1>&6
		else
                	cat >> confdefs.h <<\EOF
#define MPI2CPP_HPUXUNKNOWN 1
EOF

                	echo "$ac_t""Unknown version -- $HPVER (good luck)" 1>&6
        	fi
	fi

        echo $ac_n "checking for mpiCC compiler""... $ac_c" 1>&6
echo "configure:2042: checking for mpiCC compiler" >&5
        if test -x $MPI_ROOT/bin/mpicxx; then
                CXX="$MPI_ROOT/bin/mpicxx"
                echo "$ac_t""$CXX" 1>&6
        elif test -x $MPI_ROOT/bin/mpiCC; then
                CXX="$MPI_ROOT/bin/mpiCC"
                echo "$ac_t""$CXX" 1>&6
        else
                echo "$ac_t""not found!" 1>&6
                { echo "configure: error: ensure that mpiCC is in \$MPI_ROOT/bin" 1>&2; exit 1; }
        fi
fi


#
# Generic MPI: Top-level dir
#

# Check whether --with-mpidir or --without-mpidir was given.
if test "${with_mpidir+set}" = set; then
  withval="$with_mpidir"
  MPI_IMP="supplied-topdir" MPI_DIR=$withval
fi


if test "$MPI_IMP" = "supplied-topdir"; then
    if test ! -d $WITHDIR; then
        { echo "configure: error: $WITHDIR does not exist" 1>&2; exit 1; }
    elif test ! -d $WITHDIR/include; then
        { echo "configure: error: $WITHDIR/include does not exist" 1>&2; exit 1; }
    elif test ! -d $WITHDIR/lib; then
        { echo "configure: error: $WITHDIR/lib does not exist" 1>&2; exit 1; }
    fi

    MPI_CXXFLAGS="-I$MPIDIR/include"
    MPI_LDFLAGS="-L$WITHDIR/$MPICHLIBDIR"
    MPI_LIBS="-lmpi"
    WANT_SOCKET_LIBS=1
fi


#
# Generic MPI: Include directory / library directory
#

# Check whether --with-mpiinc or --without-mpiinc was given.
if test "${with_mpiinc+set}" = set; then
  withval="$with_mpiinc"
  MPI_IMP="supplied-indiv" INCDIR=$withval
fi

# Check whether --with-mpilib or --without-mpilib was given.
if test "${with_mpilib+set}" = set; then
  withval="$with_mpilib"
  MPI_IMP="supplied-indiv" LIBDIR=$withval
fi


if test "$MPI_IMP" = "supplied-indiv"; then
    if test "$INCDIR" = ""; then
        { echo "configure: error: no include directory specified (--with-mpiinc)" 1>&2; exit 1; }
    elif test "$LIBDIR" = ""; then
        { echo "configure: error: no library directory specified (--with-mpilib)" 1>&2; exit 1; }
    elif test ! -d "$INCDIR"; then
        { echo "configure: error: $INCDIR does not exist" 1>&2; exit 1; }
    elif test ! -d "$LIBDIR"; then
        { echo "configure: error: $LIBDIR does not exist" 1>&2; exit 1; }
    fi

    MPI_CXXFLAGS="-I$INCDIR/include"
    MPI_LDFLAGS="-L$LIBDIR/lib"
    MPI_LIBS="-lmpi"
    WANT_SOCKET_LIBS=1
fi

#
# Profilable option for MPI C++ Bindings
#

# Check whether --with-profiling or --without-profiling was given.
if test "${with_profiling+set}" = set; then
  withval="$with_profiling"
  WANT_PROFILE=$withval
else
  WANT_PROFILE="no"
fi

echo $ac_n "checking if want profiling support""... $ac_c" 1>&6
echo "configure:2127: checking if want profiling support" >&5
if test "$WANT_PROFILE" = "yes"; then 
    cat >> confdefs.h <<\EOF
#define _MPIPP_PROFILING_ 1
EOF
 
    MPI2CPP_LIBRARY="libpmpi++.a"
    MPI2CPP_LIB="-lpmpi++"
    MPI2CPP_INSTALLED_LIB="-l${MPI_MIDDLE_NAME}pmpi++"
else
    cat >> confdefs.h <<\EOF
#define _MPIPP_PROFILING_ 0
EOF
 
    MPI2CPP_LIBRARY="libmpi++.a"
    MPI2CPP_LIB="-lmpi++"
    MPI2CPP_INSTALLED_LIB="-l${MPI_MIDDLE_NAME}mpi++"
fi




if test "$WANT_PROFILE" = "yes"; then
  WANT_PROFILING_TRUE=
  WANT_PROFILING_FALSE='#'
else
  WANT_PROFILING_TRUE='#'
  WANT_PROFILING_FALSE=
fi
echo "$ac_t""$WANT_PROFILE" 1>&6

#
# We need to do a bunch of tests with <mpi.h> and "-lmpi", so
# temporarily change the CXXFLGAS.  Restore them later before they get
# substituted into various Makefiles.
#

CXXFLAGS_SAVE="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS $MINI_BALKY_CXXFLAGS"

#
# Setup C++ compiler
#

if test "$CXX" = "" -a "$MPI_CXX" != ""; then
    CXX=$MPI_CXX
fi

#
# $%@#!@#% AC_PROG_CXX changes CXXFLAGS...
#

LOCAL_CXXFLAGS_SAVE=$CXXFLAGS
CXXFLAGS="$CXXFLAGS"
for ac_prog in $CCC c++ g++ gcc CC cxx cc++ cl
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:2186: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  if test -n "$CXX"; then
  ac_cv_prog_CXX="$CXX" # Let the user override the test.
else
  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
  ac_dummy="$PATH"
  for ac_dir in $ac_dummy; do
    test -z "$ac_dir" && ac_dir=.
    if test -f $ac_dir/$ac_word; then
      ac_cv_prog_CXX="$ac_prog"
      break
    fi
  done
  IFS="$ac_save_ifs"
fi
fi
CXX="$ac_cv_prog_CXX"
if test -n "$CXX"; then
  echo "$ac_t""$CXX" 1>&6
else
  echo "$ac_t""no" 1>&6
fi

test -n "$CXX" && break
done
test -n "$CXX" || CXX="gcc"


echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6
echo "configure:2218: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5

ac_ext=C
# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_cxx_cross

cat > conftest.$ac_ext << EOF

#line 2229 "configure"
#include "confdefs.h"

int main(){return(0);}
EOF
if { (eval echo configure:2234: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  ac_cv_prog_cxx_works=yes
  # If we can't run a trivial program, we are probably using a cross compiler.
  if (./conftest; exit) 2>/dev/null; then
    ac_cv_prog_cxx_cross=no
  else
    ac_cv_prog_cxx_cross=yes
  fi
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  ac_cv_prog_cxx_works=no
fi
rm -fr conftest*
ac_ext=C
# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_cxx_cross

echo "$ac_t""$ac_cv_prog_cxx_works" 1>&6
if test $ac_cv_prog_cxx_works = no; then
  { echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
echo "configure:2260: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6
cross_compiling=$ac_cv_prog_cxx_cross

echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6
echo "configure:2265: checking whether we are using GNU C++" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  cat > conftest.C <<EOF
#ifdef __GNUC__
  yes;
#endif
EOF
if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:2274: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
  ac_cv_prog_gxx=yes
else
  ac_cv_prog_gxx=no
fi
fi

echo "$ac_t""$ac_cv_prog_gxx" 1>&6

if test $ac_cv_prog_gxx = yes; then
  GXX=yes
else
  GXX=
fi

ac_test_CXXFLAGS="${CXXFLAGS+set}"
ac_save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS=
echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6
echo "configure:2293: checking whether ${CXX-g++} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  echo 'void f(){}' > conftest.cc
if test -z "`${CXX-g++} -g -c conftest.cc 2>&1`"; then
  ac_cv_prog_cxx_g=yes
else
  ac_cv_prog_cxx_g=no
fi
rm -f conftest*

fi

echo "$ac_t""$ac_cv_prog_cxx_g" 1>&6
if test "$ac_test_CXXFLAGS" = set; then
  CXXFLAGS="$ac_save_CXXFLAGS"
elif test $ac_cv_prog_cxx_g = yes; then
  if test "$GXX" = yes; then
    CXXFLAGS="-g -O2"
  else
    CXXFLAGS="-g"
  fi
else
  if test "$GXX" = yes; then
    CXXFLAGS="-O2"
  else
    CXXFLAGS=
  fi
fi

echo $ac_n "checking how to run the C++ preprocessor""... $ac_c" 1>&6
echo "configure:2325: checking how to run the C++ preprocessor" >&5
if test -z "$CXXCPP"; then
if eval "test \"`echo '$''{'ac_cv_prog_CXXCPP'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  ac_ext=C
# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_cxx_cross
  CXXCPP="${CXX-g++} -E"
  cat > conftest.$ac_ext <<EOF
#line 2338 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:2343: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
  :
else
  echo "$ac_err" >&5
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  CXXCPP=/lib/cpp
fi
rm -f conftest*
  ac_cv_prog_CXXCPP="$CXXCPP"
ac_ext=C
# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_cxx_cross
fi
fi
CXXCPP="$ac_cv_prog_CXXCPP"
echo "$ac_t""$CXXCPP" 1>&6

CXXFLAGS="$LOCAL_CXXFLAGS_SAVE"
echo $ac_n "checking for AIX""... $ac_c" 1>&6
echo "configure:2369: checking for AIX" >&5
cat > conftest.$ac_ext <<EOF
#line 2371 "configure"
#include "confdefs.h"
#ifdef _AIX
  yes
#endif

EOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
  egrep "yes" >/dev/null 2>&1; then
  rm -rf conftest*
  echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF
#define _ALL_SOURCE 1
EOF

else
  rm -rf conftest*
  echo "$ac_t""no" 1>&6
fi
rm -f conftest*


echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
echo "configure:2393: checking whether ln -s works" >&5
if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  rm -f conftestdata
if ln -s X conftestdata 2>/dev/null
then
  rm -f conftestdata
  ac_cv_prog_LN_S="ln -s"
else
  ac_cv_prog_LN_S=ln
fi
fi
LN_S="$ac_cv_prog_LN_S"
if test "$ac_cv_prog_LN_S" = "ln -s"; then
  echo "$ac_t""yes" 1>&6
else
  echo "$ac_t""no" 1>&6
fi


BALKY_CXX=$CXX



#
# See if the compiler makes template repository directories
#


#
# See if the compiler makes template repository directories
# Warning: this is a really screwy example! -JMS
#
# Sets TEMPLATE_REP to the directory name, or blank
# Does AC_SUBST on TEMPLATE_REP
#

echo $ac_n "checking for template repository directory""... $ac_c" 1>&6
echo "configure:2432: checking for template repository directory" >&5
mkdir conf_tmp_$$
cd conf_tmp_$$
cat > conftest.h <<EOF
template <class T>
class foo {
public:
  foo(T yow) : data(yow) { yow.member(3); };
  void member(int i);
private:
  T data;
};

class bar {
public:
  bar(int i) { data = i; };
  void member(int j) { data = data * j; };

private:
  int data;
};
EOF

cat > conftest2.C <<EOF
#include "conftest.h"

void
some_other_function(void)
{
  foo<bar> var1(6);
  foo< foo<bar> > var2(var1);
}
EOF

cat > conftest1.C <<EOF
#include "conftest.h"

void some_other_function(void);

template <class T>
void
foo<T>::member(int i)
{
  i += 2;
}

int
main(int argc, char *argv[])
{
  foo<bar> var1(6);
  foo< foo<bar> > var2(var1);

  some_other_function();
  return 0;
}
EOF

echo configure:2489: $CXX $CXXFLAGS -c conftest1.C >&5
$CXX $CXXFLAGS -c conftest1.C >&5 2>&5
if test ! -f conftest1.o ; then
    echo "$ac_t""templates not supported?" 1>&6
    echo configure:2493: here is the program that failed: >&5
    cat conftest1.C >&5
    echo configure:2495: here is conftest.h: >&5
    cat conftest.h >&5
else
    echo configure:2498: $CXX $CXXFLAGS -c conftest2.C >&5
    $CXX $CXXFLAGS -c conftest2.C >&5 2>&5
    if test ! -f conftest2.o ; then
	echo "$ac_t""unknown error" 1>&6
	echo configure:2502: here is the program that failed: >&5
	cat conftest2.C >&5
	echo configure:2504: here is conftest.h: >&5
	cat conftest.h >&5
    else
	rm -rf conftest*

	for file in `ls`
	do
	    if test "$file" != "." -a "$file" != ".."; then
		# Is it a directory?
		if test -d "$file"; then
		    TEMPLATE_DIR="$file $TEMPLATE_DIR"
		    
		# Or is it a file?
		else
		    name="`echo $file | cut -d. -f1`"
		    
		    temp_mask=
		    if test "$name" = "main" -o "$name" = "other"; then
			temp_mask="`echo $file | cut -d. -f2`"
			if test "$TEMPLATE_FILEMASK" = ""; then
			TEMPLATE_FILEMASK="$temp_mask";
			elif test "`echo $TEMPLATE_FILEMASK | grep $temp_mask`" = ""; then
			TEMPLATE_FILEMASK="$TEMPLATE_FILEMASK $temp_mask"
			fi
		    fi
		fi
	    fi
	done
	if test "$TEMPLATE_FILEMASK" != ""; then
	    temp_mask=
	    for mask in $TEMPLATE_FILEMASK
	    do
		temp_mask="*.$mask $temp_mask"
	    done
	    TEMPLATE_FILEMASK=$temp_mask
	fi
    fi
fi
TEMPLATE_REP="$TEMPLATE_DIR $TEMPLATE_FILEMASK"

if test "$TEMPLATE_REP" != "" -a "$TEMPLATE_REP" != " "; then
    echo "$ac_t""$TEMPLATE_REP" 1>&6
else
    echo "$ac_t""not used" 1>&6
fi
cd ..
rm -rf conf_tmp_$$



#
# Force automake to delete emacs ~ files at "make clean"
#

CLEANFILES='-r *~ $(TEMPLATE_REP)'



#
# Exception handling flags
#

if test "$UNDERLYING_CXX" != ""; then
    CXX_save="$CXX"
    CXX="$UNDERLYING_CXX";
fi

#
# Get the exception handling flags for the C++ compiler
#
# Sets LSC_EXCEPTION_CXXFLAGS and LSC_EXCEPTION_LDFLAGS as appropriate
# Calls AC_SUBST on both
#

# Check whether --with-exflags or --without-exflags was given.
if test "${with_exflags+set}" = set; then
  withval="$with_exflags"
  FORCE_EXFLAGS=$withval
fi


LOCAL_CXXFLAGS_SAVE=$CXXFLAGS
echo $ac_n "checking for compiler exception flags""... $ac_c" 1>&6
echo "configure:2587: checking for compiler exception flags" >&5
if test "$FORCE_EXFLAGS" != ""; then
    EXFLAGS=$FORCE_EXFLAGS
elif test "$GXX" = "yes"; then
    CXXFLAGS="$CXXFLAGS -fexceptions"

    
    ac_ext=C
# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_cxx_cross

    cat > conftest.$ac_ext <<EOF
#line 2602 "configure"
#include "confdefs.h"

int main() {
try { int i = 0; } catch(...) { int j = 2; }
; return 0; }
EOF
if { (eval echo configure:2609: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  rm -rf conftest*
  HAPPY=1
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  HAPPY=0
fi
rm -f conftest*

    if test "$HAPPY" = "1"; then
	EXFLAGS="-fexceptions";
    else
	CXXFLAGS="$LOCAL_CXXFLAGS_SAVE -fhandle-exceptions"
	cat > conftest.$ac_ext <<EOF
#line 2625 "configure"
#include "confdefs.h"

int main() {
try { int i = 0; } catch(...) { int j = 2; }
; return 0; }
EOF
if { (eval echo configure:2632: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  rm -rf conftest*
  HAPPY=1
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  HAPPY=0
fi
rm -f conftest*
	if test "$HAPPY" = "1"; then
	    EXFLAGS="-fhandle-exceptions";
	fi
    fi
    ac_ext=C
# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_cxx_cross

elif test "`basename $CXX`" = "KCC"; then
    EXFLAGS="-x"
elif test "$LAMHCP" = "1"; then
    if test "`basename $LAMHCP`" = "KCC"; then
	EXFLAGS="-x"
    fi
fi
CXXFLAGS="$LOCAL_CXXFLAGS_SAVE"

LSC_EXCEPTION_CXXFLAGS=$EXFLAGS
LSC_EXCEPTION_LDFLAGS="$EXFLAGS"
if test "$EXFLAGS" = ""; then
    echo "$ac_t""none necessary" 1>&6
else
    echo "$ac_t""$EXFLAGS" 1>&6
fi


if test "$UNDERLYING_CXX" != ""; then
    CXX="$CXX_save";
fi


EXCPTN_CXXFLAGS=$LSC_EXCEPTION_CXXFLAGS
CXXFLAGS="$EXCPTN_CXXFLAGS $CXXFLAGS"
EXCPTN_LDFLAGS="$LSC_EXCEPTION_LDFLAGS"


#
# Check to see if this compiler can handle exceptions 
#

# Since our errhandling test in the testsuite fails
# when compiling with g++ (both 2.8 and with egcs)
# we'll specify no exceptions for g++
#
# This needs to test for the problem, so that when g++/egcs is fixed, this
# will still work! - WDG
#
# I Agree! - PWR

echo $ac_n "checking for throw/catch""... $ac_c" 1>&6
echo "configure:2695: checking for throw/catch" >&5
cat > conftest.$ac_ext <<EOF
#line 2697 "configure"
#include "confdefs.h"

int main() {
int i=1; throw(i);
; return 0; }
EOF
if { (eval echo configure:2704: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  rm -rf conftest*
  have_excep=yes
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  have_excep=no
fi
rm -f conftest*
if test "$GXX" = "yes"; then
    cat >> confdefs.h <<\EOF
#define _MPIPP_USEEXCEPTIONS_ 0
EOF

    echo "$ac_t""no (g++ exceptions broken)" 1>&6
elif test "$have_excep" = "yes"; then
    cat >> confdefs.h <<\EOF
#define _MPIPP_USEEXCEPTIONS_ 1
EOF

    echo "$ac_t""yes" 1>&6
else
    cat >> confdefs.h <<\EOF
#define _MPIPP_USEEXCEPTIONS_ 0
EOF

    echo "$ac_t""no" 1>&6
fi


#
# Set final compiler flags
#

MINI_BALKY_CXXFLAGS="$EXCPTN_CXXFLAGS $EXTRA_CXXFLAGS $MPI_CXXFLAGS -I`pwd`/src $MINI_BALKY_CXXFLAGS"
BALKY_CXXFLAGS="$EXCPTN_CXXFLAGS $EXTRA_CXXFLAGS $MPI_CXXFLAGS -I$INSTALLDIR/include $CXXFLAGS_SAVE $BALKY_CXXFLAGS"

CXXFLAGS_SAVE="$CXXFLAGS_SAVE $MPI_CXXFLAGS"
CXXFLAGS="$CXXFLAGS $MPI_CXXFLAGS"
DEPFLAGS="$CXXFLAGS_SAVE"






#
# Try to compile with the Balky flags, see if we can find <mpi.h>
#


if test "$TEMPLATE_REP" = ""; then
    
#
# See if the compiler makes template repository directories
# Warning: this is a really screwy example! -JMS
#
# Sets TEMPLATE_REP to the directory name, or blank
# Does AC_SUBST on TEMPLATE_REP
#

echo $ac_n "checking for template repository directory""... $ac_c" 1>&6
echo "configure:2767: checking for template repository directory" >&5
mkdir conf_tmp_$$
cd conf_tmp_$$
cat > conftest.h <<EOF
template <class T>
class foo {
public:
  foo(T yow) : data(yow) { yow.member(3); };
  void member(int i);
private:
  T data;
};

class bar {
public:
  bar(int i) { data = i; };
  void member(int j) { data = data * j; };

private:
  int data;
};
EOF

cat > conftest2.C <<EOF
#include "conftest.h"

void
some_other_function(void)
{
  foo<bar> var1(6);
  foo< foo<bar> > var2(var1);
}
EOF

cat > conftest1.C <<EOF
#include "conftest.h"

void some_other_function(void);

template <class T>
void
foo<T>::member(int i)
{
  i += 2;
}

int
main(int argc, char *argv[])
{
  foo<bar> var1(6);
  foo< foo<bar> > var2(var1);

  some_other_function();
  return 0;
}
EOF

echo configure:2824: $CXX $CXXFLAGS -c conftest1.C >&5
$CXX $CXXFLAGS -c conftest1.C >&5 2>&5
if test ! -f conftest1.o ; then
    echo "$ac_t""templates not supported?" 1>&6
    echo configure:2828: here is the program that failed: >&5
    cat conftest1.C >&5
    echo configure:2830: here is conftest.h: >&5
    cat conftest.h >&5
else
    echo configure:2833: $CXX $CXXFLAGS -c conftest2.C >&5
    $CXX $CXXFLAGS -c conftest2.C >&5 2>&5
    if test ! -f conftest2.o ; then
	echo "$ac_t""unknown error" 1>&6
	echo configure:2837: here is the program that failed: >&5
	cat conftest2.C >&5
	echo configure:2839: here is conftest.h: >&5
	cat conftest.h >&5
    else
	rm -rf conftest*

	for file in `ls`
	do
	    if test "$file" != "." -a "$file" != ".."; then
		# Is it a directory?
		if test -d "$file"; then
		    TEMPLATE_DIR="$file $TEMPLATE_DIR"
		    
		# Or is it a file?
		else
		    name="`echo $file | cut -d. -f1`"
		    
		    temp_mask=
		    if test "$name" = "main" -o "$name" = "other"; then
			temp_mask="`echo $file | cut -d. -f2`"
			if test "$TEMPLATE_FILEMASK" = ""; then
			TEMPLATE_FILEMASK="$temp_mask";
			elif test "`echo $TEMPLATE_FILEMASK | grep $temp_mask`" = ""; then
			TEMPLATE_FILEMASK="$TEMPLATE_FILEMASK $temp_mask"
			fi
		    fi
		fi
	    fi
	done
	if test "$TEMPLATE_FILEMASK" != ""; then
	    temp_mask=
	    for mask in $TEMPLATE_FILEMASK
	    do
		temp_mask="*.$mask $temp_mask"
	    done
	    TEMPLATE_FILEMASK=$temp_mask
	fi
    fi
fi
TEMPLATE_REP="$TEMPLATE_DIR $TEMPLATE_FILEMASK"

if test "$TEMPLATE_REP" != "" -a "$TEMPLATE_REP" != " "; then
    echo "$ac_t""$TEMPLATE_REP" 1>&6
else
    echo "$ac_t""not used" 1>&6
fi
cd ..
rm -rf conf_tmp_$$

fi
echo $ac_n "checking for mpi.h""... $ac_c" 1>&6
echo "configure:2889: checking for mpi.h" >&5
touch conftest.o
rm -f conftest.o
cat > conftest.C <<EOF
#include <mpi.h>
int 
main(int argc, char* argv[])
{ return 0; }
EOF
echo configure:2898: $CXX $CXXFLAGS -c conftest.C >&5
$CXX $CXXFLAGS -c conftest.C >&2 2>&5
if test -f conftest.o ; then
    HAVE_MPI_H=yes
    echo "$ac_t""yes" 1>&6
else
    HAVE_MPI_H=no
    echo configure:2905: here is the program that failed: >&5
    cat conftest.C >&5
    echo "$ac_t""no" 1>&6
fi
rm -rf conftest* $TEMPLATE_REP
if test "$HAVE_MPI_H" = "no"; then
    { echo "configure: error: cannot continue -- cannot find <mpi.h>" 1>&2; exit 1; }
fi


#
# Look for extra libraries
#

if test "$WANT_SOCKET_LIBS" = "1"; then
    echo $ac_n "checking for getservbyname in -lsocket""... $ac_c" 1>&6
echo "configure:2921: checking for getservbyname in -lsocket" >&5
ac_lib_var=`echo socket'_'getservbyname | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  ac_save_LIBS="$LIBS"
LIBS="-lsocket  $LIBS"
cat > conftest.$ac_ext <<EOF
#line 2929 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error.  */
#ifdef __cplusplus
extern "C"
#endif
/* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
char getservbyname();

int main() {
getservbyname()
; return 0; }
EOF
if { (eval echo configure:2943: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  rm -rf conftest*
  eval "ac_cv_lib_$ac_lib_var=yes"
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  eval "ac_cv_lib_$ac_lib_var=no"
fi
rm -f conftest*
LIBS="$ac_save_LIBS"

fi
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
  echo "$ac_t""yes" 1>&6
  socket_lib="-lsocket"
else
  echo "$ac_t""no" 1>&6
socket_lib=""
fi

    echo $ac_n "checking for gethostbyaddr in -lnsl""... $ac_c" 1>&6
echo "configure:2965: checking for gethostbyaddr in -lnsl" >&5
ac_lib_var=`echo nsl'_'gethostbyaddr | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  ac_save_LIBS="$LIBS"
LIBS="-lnsl  $LIBS"
cat > conftest.$ac_ext <<EOF
#line 2973 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error.  */
#ifdef __cplusplus
extern "C"
#endif
/* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
char gethostbyaddr();

int main() {
gethostbyaddr()
; return 0; }
EOF
if { (eval echo configure:2987: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  rm -rf conftest*
  eval "ac_cv_lib_$ac_lib_var=yes"
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  eval "ac_cv_lib_$ac_lib_var=no"
fi
rm -f conftest*
LIBS="$ac_save_LIBS"

fi
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
  echo "$ac_t""yes" 1>&6
  nsl_lib="-lnsl"
else
  echo "$ac_t""no" 1>&6
nsl_lib=""
fi

fi
if test "$WANT_THREAD_LIBS" = "1"; then
    echo $ac_n "checking for sigwait in -lthread""... $ac_c" 1>&6
echo "configure:3011: checking for sigwait in -lthread" >&5
ac_lib_var=`echo thread'_'sigwait | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  ac_save_LIBS="$LIBS"
LIBS="-lthread  $LIBS"
cat > conftest.$ac_ext <<EOF
#line 3019 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error.  */
#ifdef __cplusplus
extern "C"
#endif
/* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
char sigwait();

int main() {
sigwait()
; return 0; }
EOF
if { (eval echo configure:3033: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  rm -rf conftest*
  eval "ac_cv_lib_$ac_lib_var=yes"
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  eval "ac_cv_lib_$ac_lib_var=no"
fi
rm -f conftest*
LIBS="$ac_save_LIBS"

fi
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
  echo "$ac_t""yes" 1>&6
  thread_lib="-lthread"
else
  echo "$ac_t""no" 1>&6
thread_lib=""
fi

fi
EXTRA_LIBS="$socket_lib $nsl_lib $thread_lib"


#
# Set final linker flags
#

LDFLAGS="$LDFLAGS $MPI_LDFLAGS"
LIBS="$MPI_LIBS $EXTRA_LIBS"

MINI_BALKY_LDFLAGS="$EXCPTN_LDFLAGS $EXTRA_LDFLAGS $MPI_LDFLAGS -L`pwd`/src $MPI2CPP_LIB $MPI_LIBS $EXTRA_LIBS $LDFLAGS"
BALKY_LDFLAGS="$EXCPTN_LDFLAGS $EXTRA_LDFLAGS $MPI_LDFLAGS -L$INSTALLDIR/lib $MPI2CPP_INSTALLED_LIB $MPI_LIBS $EXTRA_LIBS $LDFLAGS"




#
# Try to link with the Balky flags, see if we can find libmpi.*
# (if necessary)
#

if test "$MPI_LIBS" != "" -a "$USING_MPICH" != 1 ; then
    
#
# Try to link a simple program, see if we can find libmpi.*
# 
# Aborts if we cannot -lmpi
#

if test "$TEMPLATE_REP" = ""; then
    
#
# See if the compiler makes template repository directories
# Warning: this is a really screwy example! -JMS
#
# Sets TEMPLATE_REP to the directory name, or blank
# Does AC_SUBST on TEMPLATE_REP
#

echo $ac_n "checking for template repository directory""... $ac_c" 1>&6
echo "configure:3095: checking for template repository directory" >&5
mkdir conf_tmp_$$
cd conf_tmp_$$
cat > conftest.h <<EOF
template <class T>
class foo {
public:
  foo(T yow) : data(yow) { yow.member(3); };
  void member(int i);
private:
  T data;
};

class bar {
public:
  bar(int i) { data = i; };
  void member(int j) { data = data * j; };

private:
  int data;
};
EOF

cat > conftest2.C <<EOF
#include "conftest.h"

void
some_other_function(void)
{
  foo<bar> var1(6);
  foo< foo<bar> > var2(var1);
}
EOF

cat > conftest1.C <<EOF
#include "conftest.h"

void some_other_function(void);

template <class T>
void
foo<T>::member(int i)
{
  i += 2;
}

int
main(int argc, char *argv[])
{
  foo<bar> var1(6);
  foo< foo<bar> > var2(var1);

  some_other_function();
  return 0;
}
EOF

echo configure:3152: $CXX $CXXFLAGS -c conftest1.C >&5
$CXX $CXXFLAGS -c conftest1.C >&5 2>&5
if test ! -f conftest1.o ; then
    echo "$ac_t""templates not supported?" 1>&6
    echo configure:3156: here is the program that failed: >&5
    cat conftest1.C >&5
    echo configure:3158: here is conftest.h: >&5
    cat conftest.h >&5
else
    echo configure:3161: $CXX $CXXFLAGS -c conftest2.C >&5
    $CXX $CXXFLAGS -c conftest2.C >&5 2>&5
    if test ! -f conftest2.o ; then
	echo "$ac_t""unknown error" 1>&6
	echo configure:3165: here is the program that failed: >&5
	cat conftest2.C >&5
	echo configure:3167: here is conftest.h: >&5
	cat conftest.h >&5
    else
	rm -rf conftest*

	for file in `ls`
	do
	    if test "$file" != "." -a "$file" != ".."; then
		# Is it a directory?
		if test -d "$file"; then
		    TEMPLATE_DIR="$file $TEMPLATE_DIR"
		    
		# Or is it a file?
		else
		    name="`echo $file | cut -d. -f1`"
		    
		    temp_mask=
		    if test "$name" = "main" -o "$name" = "other"; then
			temp_mask="`echo $file | cut -d. -f2`"
			if test "$TEMPLATE_FILEMASK" = ""; then
			TEMPLATE_FILEMASK="$temp_mask";
			elif test "`echo $TEMPLATE_FILEMASK | grep $temp_mask`" = ""; then
			TEMPLATE_FILEMASK="$TEMPLATE_FILEMASK $temp_mask"
			fi
		    fi
		fi
	    fi
	done
	if test "$TEMPLATE_FILEMASK" != ""; then
	    temp_mask=
	    for mask in $TEMPLATE_FILEMASK
	    do
		temp_mask="*.$mask $temp_mask"
	    done
	    TEMPLATE_FILEMASK=$temp_mask
	fi
    fi
fi
TEMPLATE_REP="$TEMPLATE_DIR $TEMPLATE_FILEMASK"

if test "$TEMPLATE_REP" != "" -a "$TEMPLATE_REP" != " "; then
    echo "$ac_t""$TEMPLATE_REP" 1>&6
else
    echo "$ac_t""not used" 1>&6
fi
cd ..
rm -rf conf_tmp_$$

fi
if test "`echo $MPI_LIBS`" != ""; then
    echo $ac_n "checking for MPI_Initialized in "$MPI_LIBS"""... $ac_c" 1>&6
echo "configure:3218: checking for MPI_Initialized in "$MPI_LIBS"" >&5
else
    echo $ac_n "checking for MPI_Initialized""... $ac_c" 1>&6
echo "configure:3221: checking for MPI_Initialized" >&5
fi
cat > conftest.$ac_ext <<EOF
#line 3224 "configure"
#include "confdefs.h"
#include <mpi.h>

int main() {
int i; MPI_Initialized(&i);
; return 0; }
EOF
if { (eval echo configure:3232: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  rm -rf conftest*
  libmpi_found=yes
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  libmpi_found=no
fi
rm -f conftest*
if test "$libmpi_found" = "yes"; then
    echo "$ac_t""yes" 1>&6
else
    echo "$ac_t""no" 1>&6
    { echo "configure: error: cannot continue -- cannot link to "$MPI_LIBS"" 1>&2; exit 1; }
fi
rm -rf $TEMPLATE_REP
fi


#
# Override optimization flags, if supplied
#

# Check whether --with-opt or --without-opt was given.
if test "${with_opt+set}" = set; then
  withval="$with_opt"
  withoutopt=$withval
else
  withoutopt=$withval
fi

if test "$withoutopt" = "no"; then
    OPTFLAGS="$NOOPT" 
    TEST_OPTFLAGS="$NOOPT" 
    EXAM_OPTFLAGS="$NOOPT"
fi
# Check whether --with-libopt or --without-libopt was given.
if test "${with_libopt+set}" = set; then
  withval="$with_libopt"
  OPTFLAGS=$withval
fi

# Check whether --with-testopt or --without-testopt was given.
if test "${with_testopt+set}" = set; then
  withval="$with_testopt"
  TEST_OPTFLAGS=$withval
fi

# Check whether --with-examopt or --without-examopt was given.
if test "${with_examopt+set}" = set; then
  withval="$with_examopt"
  EXAM_OPTFLAGS=$withval
fi






#
# At least one implementation has this problem
# (no names mentioned...)
#


#
# At least one MPI implementation has(had) this problem
# (no names mentioned...)
#
# Sets LSC_HAVE_PENDING to 1 if MPI_PENDING, 0 if MPI_ERR_PENDING
#

if test "$TEMPLATE_REP" = ""; then
    
#
# See if the compiler makes template repository directories
# Warning: this is a really screwy example! -JMS
#
# Sets TEMPLATE_REP to the directory name, or blank
# Does AC_SUBST on TEMPLATE_REP
#

echo $ac_n "checking for template repository directory""... $ac_c" 1>&6
echo "configure:3316: checking for template repository directory" >&5
mkdir conf_tmp_$$
cd conf_tmp_$$
cat > conftest.h <<EOF
template <class T>
class foo {
public:
  foo(T yow) : data(yow) { yow.member(3); };
  void member(int i);
private:
  T data;
};

class bar {
public:
  bar(int i) { data = i; };
  void member(int j) { data = data * j; };

private:
  int data;
};
EOF

cat > conftest2.C <<EOF
#include "conftest.h"

void
some_other_function(void)
{
  foo<bar> var1(6);
  foo< foo<bar> > var2(var1);
}
EOF

cat > conftest1.C <<EOF
#include "conftest.h"

void some_other_function(void);

template <class T>
void
foo<T>::member(int i)
{
  i += 2;
}

int
main(int argc, char *argv[])
{
  foo<bar> var1(6);
  foo< foo<bar> > var2(var1);

  some_other_function();
  return 0;
}
EOF

echo configure:3373: $CXX $CXXFLAGS -c conftest1.C >&5
$CXX $CXXFLAGS -c conftest1.C >&5 2>&5
if test ! -f conftest1.o ; then
    echo "$ac_t""templates not supported?" 1>&6
    echo configure:3377: here is the program that failed: >&5
    cat conftest1.C >&5
    echo configure:3379: here is conftest.h: >&5
    cat conftest.h >&5
else
    echo configure:3382: $CXX $CXXFLAGS -c conftest2.C >&5
    $CXX $CXXFLAGS -c conftest2.C >&5 2>&5
    if test ! -f conftest2.o ; then
	echo "$ac_t""unknown error" 1>&6
	echo configure:3386: here is the program that failed: >&5
	cat conftest2.C >&5
	echo configure:3388: here is conftest.h: >&5
	cat conftest.h >&5
    else
	rm -rf conftest*

	for file in `ls`
	do
	    if test "$file" != "." -a "$file" != ".."; then
		# Is it a directory?
		if test -d "$file"; then
		    TEMPLATE_DIR="$file $TEMPLATE_DIR"
		    
		# Or is it a file?
		else
		    name="`echo $file | cut -d. -f1`"
		    
		    temp_mask=
		    if test "$name" = "main" -o "$name" = "other"; then
			temp_mask="`echo $file | cut -d. -f2`"
			if test "$TEMPLATE_FILEMASK" = ""; then
			TEMPLATE_FILEMASK="$temp_mask";
			elif test "`echo $TEMPLATE_FILEMASK | grep $temp_mask`" = ""; then
			TEMPLATE_FILEMASK="$TEMPLATE_FILEMASK $temp_mask"
			fi
		    fi
		fi
	    fi
	done
	if test "$TEMPLATE_FILEMASK" != ""; then
	    temp_mask=
	    for mask in $TEMPLATE_FILEMASK
	    do
		temp_mask="*.$mask $temp_mask"
	    done
	    TEMPLATE_FILEMASK=$temp_mask
	fi
    fi
fi
TEMPLATE_REP="$TEMPLATE_DIR $TEMPLATE_FILEMASK"

if test "$TEMPLATE_REP" != "" -a "$TEMPLATE_REP" != " "; then
    echo "$ac_t""$TEMPLATE_REP" 1>&6
else
    echo "$ac_t""not used" 1>&6
fi
cd ..
rm -rf conf_tmp_$$

fi
echo $ac_n "checking whether to use MPI(_ERR)_PENDING""... $ac_c" 1>&6
echo "configure:3438: checking whether to use MPI(_ERR)_PENDING" >&5
cat > conftest.$ac_ext <<EOF
#line 3440 "configure"
#include "confdefs.h"
#include <mpi.h>

int main() {
int yow=MPI_PENDING;
; return 0; }
EOF
if { (eval echo configure:3448: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  rm -rf conftest*
  use_pending=yes
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  use_pending=no
fi
rm -f conftest*
if test "$use_pending" = "yes"; then
    LSC_HAVE_PENDING=1
    echo "$ac_t""MPI_PENDING" 1>&6
else
    LSC_HAVE_PENDING=0
    echo "$ac_t""MPI_ERR_PENDING" 1>&6
fi
rm -rf $TEMPLATE_REP
if test "$LSC_HAVE_PENDING" = "1"; then
    cat >> confdefs.h <<\EOF
#define MPI2CPP_HAVE_PENDING 1
EOF

else
    cat >> confdefs.h <<\EOF
#define MPI2CPP_HAVE_PENDING 0
EOF

fi


#
# Check for MPI_GET_VERSION
#

echo $ac_n "checking for MPI_GET_VERSION""... $ac_c" 1>&6
echo "configure:3484: checking for MPI_GET_VERSION" >&5
cat > conftest.$ac_ext <<EOF
#line 3486 "configure"
#include "confdefs.h"
#include<mpi.h>
int main() {
int v, s; MPI_Get_version(&v, &s);
; return 0; }
EOF
if { (eval echo configure:3493: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  rm -rf conftest*
  HAVE_GET_VERSION=1
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  HAVE_GET_VERSION=1
fi
rm -f conftest*
cat >> confdefs.h <<EOF
#define MPI2CPP_HAVE_MPI_GET_VERSION $HAVE_GET_VERSION
EOF

if test "$HAVE_GET_VERSION" = "1"; then
    echo "$ac_t""yes" 1>&6
else
    echo "$ac_t""no" 1>&6
fi


#
# See if we have MPI_STATUS_IGNORE / MPI_STATUSES_IGNORE
#
# Unfortunately, the implementation of STATUS_IGNORE in MPICH is
# broken.  Can't really figure out a good way how to have a generic
# test to see if the underlying MPI has a broken STATUS_IGNORE because
# there are so many different ways to run a different MPI program (and
# it depends on several variables in the users' setup).  So we just
# have to put in a hardwired "if MPICH, don't use MPI_STATUS_IGNORE"
# switch.  This will probably have to be removed in the future.  Ick.
#

if test "$USING_MPICH" = "1"; then
    echo $ac_n "checking for MPI_STATUS_IGNORE""... $ac_c" 1>&6
echo "configure:3528: checking for MPI_STATUS_IGNORE" >&5
    cat >> confdefs.h <<\EOF
#define MPI2CPP_HAVE_STATUS_IGNORE 0
EOF

    echo "$ac_t""yes, but broken" 1>&6
    
    echo $ac_n "checking for MPI_STATUSES_IGNORE""... $ac_c" 1>&6
echo "configure:3536: checking for MPI_STATUSES_IGNORE" >&5
    cat >> confdefs.h <<\EOF
#define MPI2CPP_HAVE_STATUSES_IGNORE 0
EOF

    echo "$ac_t""yes, but broken" 1>&6
else
    echo $ac_n "checking for MPI_STATUS_IGNORE""... $ac_c" 1>&6
echo "configure:3544: checking for MPI_STATUS_IGNORE" >&5
    cat > conftest.$ac_ext <<EOF
#line 3546 "configure"
#include "confdefs.h"
#include <mpi.h>
int main() {
MPI_Status *foo = MPI_STATUS_IGNORE;
; return 0; }
EOF
if { (eval echo configure:3553: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  rm -rf conftest*
  HAVE_STATUS_IGNORE=1
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  HAVE_STATUS_IGNORE=0
fi
rm -f conftest*
    cat >> confdefs.h <<EOF
#define MPI2CPP_HAVE_STATUS_IGNORE $HAVE_STATUS_IGNORE
EOF

    if test "$HAVE_STATUS_IGNORE" = "1"; then
	echo "$ac_t""yes" 1>&6
    else
	echo "$ac_t""no" 1>&6
    fi
    echo $ac_n "checking for MPI_STATUSES_IGNORE""... $ac_c" 1>&6
echo "configure:3573: checking for MPI_STATUSES_IGNORE" >&5
    cat > conftest.$ac_ext <<EOF
#line 3575 "configure"
#include "confdefs.h"
#include <mpi.h>
int main() {
MPI_Status *foo = MPI_STATUSES_IGNORE;
; return 0; }
EOF
if { (eval echo configure:3582: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  rm -rf conftest*
  HAVE_STATUSES_IGNORE=1
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  HAVE_STATUSES_IGNORE=0
fi
rm -f conftest*
    cat >> confdefs.h <<EOF
#define MPI2CPP_HAVE_STATUSES_IGNORE $HAVE_STATUSES_IGNORE
EOF

    if test "$HAVE_STATUSES_IGNORE" = "1"; then
	echo "$ac_t""yes" 1>&6
    else
	echo "$ac_t""no" 1>&6
    fi
fi

#
# Find out how to make libraries
#

# Find a good install program.  We prefer a C program (faster),
# so one script is as good as another.  But avoid the broken or
# incompatible versions:
# SysV /etc/install, /usr/sbin/install
# SunOS /usr/etc/install
# IRIX /sbin/install
# AIX /bin/install
# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
# AFS /usr/afsws/bin/install, which mishandles nonexistent args
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
echo "configure:3619: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
    IFS="${IFS= 	}"; ac_save_IFS="$IFS"; IFS=":"
  for ac_dir in $PATH; do
    # Account for people who put trailing slashes in PATH elements.
    case "$ac_dir/" in
    /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
    *)
      # OSF1 and SCO ODT 3.0 have their own names for install.
      # Don't use installbsd from OSF since it installs stuff as root
      # by default.
      for ac_prog in ginstall scoinst install; do
        if test -f $ac_dir/$ac_prog; then
	  if test $ac_prog = install &&
            grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
	    # AIX install.  It has an incompatible calling convention.
	    :
	  else
	    ac_cv_path_install="$ac_dir/$ac_prog -c"
	    break 2
	  fi
	fi
      done
      ;;
    esac
  done
  IFS="$ac_save_IFS"

fi
  if test "${ac_cv_path_install+set}" = set; then
    INSTALL="$ac_cv_path_install"
  else
    # As a last resort, use the slow shell script.  We don't cache a
    # path for INSTALL within a source directory, because that will
    # break other packages using the cache if that directory is
    # removed, or if the path is relative.
    INSTALL="$ac_install_sh"
  fi
fi
echo "$ac_t""$INSTALL" 1>&6

# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
# It thinks the first close brace ends the variable substitution.
test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'

test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'

test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'

# Override the buggy /bin/installbsd in AIX
case "$host" in
    rs6000-ibm-aix*)
        if test "$INSTALL" = "/bin/installbsd" -o \
            "$INSTALL" = "/bin/installbsd -c" -o \
            "$INSTALL" = "/usr/bin/installbsd" -o \
            "$INSTALL" = "/usr/bin/installbsd -c" -o \
            "$INSTALL" = "/bin/install" -o \
            "$INSTALL" = "/bin/install -c" -o \
            "$INSTALL" = "/etc/install" -o \
            "$INSTALL" = "/etc/install -c" -o \
            "$INSTALL" = "/usr/bin/install" -o \
            "$INSTALL" = "/usr/bin/install -c" -o \
            "$INSTALL" = "/usr/ucb/install" -o \
            "$INSTALL" = "/usr/ucb/install -c"; then
            echo "configure: warning: overriding buggy AIX $INSTALL... ./install-sh -c" 1>&2
            INSTALL="./install-sh -c"
        fi

	cat >> confdefs.h <<\EOF
#define MPI2CPP_AIX 1
EOF

        ;;

    *aix*)
	cat >> confdefs.h <<\EOF
#define MPI2CPP_AIX 1
EOF

	;;
esac
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:3706: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  if test -n "$RANLIB"; then
  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
else
  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
  ac_dummy="$PATH"
  for ac_dir in $ac_dummy; do
    test -z "$ac_dir" && ac_dir=.
    if test -f $ac_dir/$ac_word; then
      ac_cv_prog_RANLIB="ranlib"
      break
    fi
  done
  IFS="$ac_save_ifs"
  test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
fi
fi
RANLIB="$ac_cv_prog_RANLIB"
if test -n "$RANLIB"; then
  echo "$ac_t""$RANLIB" 1>&6
else
  echo "$ac_t""no" 1>&6
fi

# Extract the first word of "ar", so it can be a program name with args.
set dummy ar; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:3736: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  if test -n "$AR"; then
  ac_cv_prog_AR="$AR" # Let the user override the test.
else
  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
  ac_dummy="$PATH"
  for ac_dir in $ac_dummy; do
    test -z "$ac_dir" && ac_dir=.
    if test -f $ac_dir/$ac_word; then
      ac_cv_prog_AR="ar"
      break
    fi
  done
  IFS="$ac_save_ifs"
  test -z "$ac_cv_prog_AR" && ac_cv_prog_AR=";"
fi
fi
AR="$ac_cv_prog_AR"
if test -n "$AR"; then
  echo "$ac_t""$AR" 1>&6
else
  echo "$ac_t""no" 1>&6
fi

# Extract the first word of "sh", so it can be a program name with args.
set dummy sh; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:3766: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_BINSH'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  case "$BINSH" in
  /*)
  ac_cv_path_BINSH="$BINSH" # Let the user override the test with a path.
  ;;
  ?:/*)			 
  ac_cv_path_BINSH="$BINSH" # Let the user override the test with a dos path.
  ;;
  *)
  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
  ac_dummy="$PATH"
  for ac_dir in $ac_dummy; do 
    test -z "$ac_dir" && ac_dir=.
    if test -f $ac_dir/$ac_word; then
      ac_cv_path_BINSH="$ac_dir/$ac_word"
      break
    fi
  done
  IFS="$ac_save_ifs"
  ;;
esac
fi
BINSH="$ac_cv_path_BINSH"
if test -n "$BINSH"; then
  echo "$ac_t""$BINSH" 1>&6
else
  echo "$ac_t""no" 1>&6
fi



#
# Various compiler checks
#
# Check for the "bool" type, and for the items "true" and "false"
# Autoconf 2.9 AC-CHECK-TYPE is buggy, hence this workaround
#


#
# Check to see if the C++ compiler has the bool type.  <sigh>
#
# Defines LSC_HAVE_BOOL to be 1 or 0
# Sets LSC_HAVE_BOOL to be 1 or 0
#

if test "$?CXXFLAGS" = 0; then
    CXXFLAGS=""
fi
echo $ac_n "checking for type bool""... $ac_c" 1>&6
echo "configure:3819: checking for type bool" >&5
rm -f conftest.cc conftest.o
cat > conftest.cc <<EOF
#include <stdio.h>
#include <sys/types.h>

int main(int argc, char* argv[]) {
  bool foo = (bool) 0;
  printf("so foo is used and the compiler wont complain: %d", (int) foo);
  return 0;
}
EOF
echo configure:3831: $CXX $CXXFLAGS conftest.cc -o conftest >&5 
$CXX $CXXFLAGS conftest.cc -o conftest >&5 2>&5
if test -f conftest; then
    LSC_HAVE_BOOL=1
    cat >> confdefs.h <<\EOF
#define LSC_HAVE_BOOL 1
EOF

    echo "$ac_t""yes" 1>&6
else
    echo configure:3841: here is the program that failed: >&5
    cat conftest.cc >&5
    LSC_HAVE_BOOL=0
    cat >> confdefs.h <<\EOF
#define LSC_HAVE_BOOL 0
EOF

    echo "$ac_t""no" 1>&6
fi
rm -rf conftest*
if test "$LSC_HAVE_BOOL" = "1"; then
    cat >> confdefs.h <<\EOF
#define MPI2CPP_HAVE_BOOL 1
EOF

    BOOL_TYPE="bool"
else
    cat >> confdefs.h <<\EOF
#define MPI2CPP_HAVE_BOOL 0
EOF

    BOOL_TYPE="unsigned int"
fi
cat >> confdefs.h <<EOF
#define MPI2CPP_BOOL_T $BOOL_TYPE
EOF



#
# Check to see if the resulting bool type is the same size as an int
# Just to make it easy (and uniform), always check, even if this compiler
# does not have a native "bool" type.
#
# I don't know why autoconf is forcing me to put in cross compiling sizes!
# Reset the LDFLAGS and LIBS arguments so that we don't get -lmpi or
# other extraneous libraries in the test executables.
#

SAVE_LDFLAGS=$LDFLAGS
SAVE_LIBS=$LIBS
LDFLAGS=
LIBS=


# Don't ask.  It's an AIX thing.  <sob>
if test "$?host" = "0"; then
    
# Make sure we can run config.sub.
if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
fi

echo $ac_n "checking host system type""... $ac_c" 1>&6
echo "configure:3895: checking host system type" >&5

host_alias=$host
case "$host_alias" in
NONE)
  case $nonopt in
  NONE)
    if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
    else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
    fi ;;
  *) host_alias=$nonopt ;;
  esac ;;
esac

host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
echo "$ac_t""$host" 1>&6

fi
# Determine datatype size. 
# First arg is type, 2nd (optional) arg is config var to define.
echo $ac_n "checking size of of int""... $ac_c" 1>&6
echo "configure:3919: checking size of of int" >&5
cat > conftest.C <<EOF
#include <stdio.h>
#ifdef _ALL_SOURCE
#undef _ALL_SOURCE
#endif
#include "confdefs.h"

int main(int argc, char* argv[])
{
    FILE *f=fopen("conftestval", "w");
    if (!f) return 1;
    fprintf(f, "%d\n", sizeof(int));
    return 0;
}
EOF
# AIX really, really sucks.  If you use the mpCC compiler (wrapper to
# the underlying C++ compiler), it expects that your program is
# parallel, so trying to run it with "./foo" won't work.  Hence, we
# have to switch compilers here.
REALCXX="$CXX"
if test "`basename $CXX`" = "mpCC"; then
    case "$host" in
    *aix*)
	REALCXX="xlC"
	;;
    esac
fi
$REALCXX $CXXFLAGS -o conftest conftest.C 1>&5 2>&1
if test -s conftest && (./conftest; exit) 2>/dev/null; then
    mpi2cpp_ac_size=`cat conftestval`
else
    mpi2cpp_ac_size=0
fi
echo "$ac_t""$mpi2cpp_ac_size" 1>&6
if test -n "MPI2CPP_SIZEOF_INT"; then
    cat >> confdefs.h <<EOF
#define MPI2CPP_SIZEOF_INT $mpi2cpp_ac_size
EOF

fi
/bin/rm -f conftest*

# Don't ask.  It's an AIX thing.  <sob>
if test "$?host" = "0"; then
    
# Make sure we can run config.sub.
if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
fi

echo $ac_n "checking host system type""... $ac_c" 1>&6
echo "configure:3971: checking host system type" >&5

host_alias=$host
case "$host_alias" in
NONE)
  case $nonopt in
  NONE)
    if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
    else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
    fi ;;
  *) host_alias=$nonopt ;;
  esac ;;
esac

host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
echo "$ac_t""$host" 1>&6

fi
# Determine datatype size. 
# First arg is type, 2nd (optional) arg is config var to define.
echo $ac_n "checking size of of MPI2CPP_BOOL_T""... $ac_c" 1>&6
echo "configure:3995: checking size of of MPI2CPP_BOOL_T" >&5
cat > conftest.C <<EOF
#include <stdio.h>
#ifdef _ALL_SOURCE
#undef _ALL_SOURCE
#endif
#include "confdefs.h"

int main(int argc, char* argv[])
{
    FILE *f=fopen("conftestval", "w");
    if (!f) return 1;
    fprintf(f, "%d\n", sizeof(MPI2CPP_BOOL_T));
    return 0;
}
EOF
# AIX really, really sucks.  If you use the mpCC compiler (wrapper to
# the underlying C++ compiler), it expects that your program is
# parallel, so trying to run it with "./foo" won't work.  Hence, we
# have to switch compilers here.
REALCXX="$CXX"
if test "`basename $CXX`" = "mpCC"; then
    case "$host" in
    *aix*)
	REALCXX="xlC"
	;;
    esac
fi
$REALCXX $CXXFLAGS -o conftest conftest.C 1>&5 2>&1
if test -s conftest && (./conftest; exit) 2>/dev/null; then
    mpi2cpp_ac_size=`cat conftestval`
else
    mpi2cpp_ac_size=0
fi
echo "$ac_t""$mpi2cpp_ac_size" 1>&6
if test -n "SIZEOF_MPI2CPP_BOOL_T"; then
    cat >> confdefs.h <<EOF
#define SIZEOF_MPI2CPP_BOOL_T $mpi2cpp_ac_size
EOF

fi
/bin/rm -f conftest*

LDFLAGS=$SAVE_LDFLAGS
LIBS=$SAVE_LIBS


#
# MPI says that attributes will be at least as large as pointers.
# If we're on a 64 bit system, the pointers may be 8 bytes, not 4.
# Attributes must be typed/sized appropriately.
#

echo $ac_n "checking type of MPI attributes""... $ac_c" 1>&6
echo "configure:4049: checking type of MPI attributes" >&5
if test "$cross_compiling" = yes; then
  sizeof_same=no
else
  cat > conftest.$ac_ext <<EOF
#line 4054 "configure"
#include "confdefs.h"
#ifdef __cplusplus
extern "C" void exit(int);
#endif
int main() 
{
  if (sizeof(int) != sizeof(int *))
    return -1;
  return 0;
}
EOF
if { (eval echo configure:4066: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
  sizeof_same=yes
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -fr conftest*
  sizeof_same=no
fi
rm -fr conftest*
fi

if test "$sizeof_same" = "yes"; then
    ATTR_TYPE="int"
    cat >> confdefs.h <<\EOF
#define MPI2CPP_ATTR int
EOF
     
else
    ATTR_TYPE="long"
    cat >> confdefs.h <<\EOF
#define MPI2CPP_ATTR long
EOF

fi
echo "$ac_t""$ATTR_TYPE" 1>&6


#
# Do we have BSD or SYSV style signals?
# (or something that we haven't thought of yet?)
#

echo $ac_n "checking for signal declaration""... $ac_c" 1>&6
echo "configure:4100: checking for signal declaration" >&5
cat > conftest.$ac_ext <<EOF
#line 4102 "configure"
#include "confdefs.h"
#include<signal.h>
extern "C" void bsd_handler(int sig, int code, struct sigcontext *scp, char *addr);

int main() {
signal(1, bsd_handler);
  struct sigaction n;
  n.sa_handler= bsd_handler;

; return 0; }
EOF
if { (eval echo configure:4114: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  rm -rf conftest*
  bsd_signal="yes"
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  bsd_signal="no"
fi
rm -f conftest*
if test "$bsd_signal" = "yes"; then
    cat >> confdefs.h <<\EOF
#define MPI2CPP_BSD_SIGNAL 1
EOF

    echo "$ac_t""BSD" 1>&6
else
#
# Sanity check.  Make sure that it is SYSV
#

cat > conftest.$ac_ext <<EOF
#line 4136 "configure"
#include "confdefs.h"
#include<signal.h>
extern "C" void sysv_handler(int sig) {};

int main() {
signal(1, sysv_handler);

; return 0; }
EOF
if { (eval echo configure:4146: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  rm -rf conftest*
  sysv_signal="yes"
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  sysv_signal="no"
fi
rm -f conftest*
    if test "$sysv_signal" = "yes"; then
        cat >> confdefs.h <<\EOF
#define MPI2CPP_SYSV_SIGNAL 1
EOF

        echo "$ac_t""SYSV" 1>&6
    else
        echo "$ac_t""not found" 1>&6
        { echo "configure: error: cannot determine if signals are bsd/sysv" 1>&2; exit 1; }
        exit
    fi
fi

#
#  Check for namespaces
#  @#%$@#^ g++!  It has namespaces, but is VERY broken
#

FORCE_NAMESPACE=
# Check whether --with-namespace or --without-namespace was given.
if test "${with_namespace+set}" = set; then
  withval="$with_namespace"
  FORCE_NAMESPACE=$withval
fi


echo $ac_n "checking for namespace support""... $ac_c" 1>&6
echo "configure:4183: checking for namespace support" >&5
if test "$FORCE_NAMESPACE" = "yes"; then
    cat >> confdefs.h <<\EOF
#define _MPIPP_USENAMESPACE_ 1
EOF

    echo "$ac_t""yes (forced)" 1>&6
elif test "$FORCE_NAMESPACE" = "no"; then 
    cat >> confdefs.h <<\EOF
#define _MPIPP_USENAMESPACE_ 0
EOF

    echo "$ac_t""no (forced)" 1>&6
else
    cat > conftest.$ac_ext <<EOF
#line 4198 "configure"
#include "confdefs.h"
void blah();
namespace N {
  extern const int global;
  class foo {
    //g++ does not like :: operator for global scope
    // but I think I can work around this
    //    friend void ::blah();
  public:
    static int foobar();
  };
  // Sun CC 5.0 has problem with overloaded static namespace functions
  static inline int foofoo();
  static inline int foofoo(int yow, double baz);
}

//aCC con't handle the following line confuses namespaces and classes
const int N::global = 0;

//g++ does not like namespace'd return types
N::foo blahblah() { N::foo f; return f; }
//g++ does not like functions of classes in namespaces
int N::foo::foobar() { return 1; }
inline int N::foofoo() { return 0; }
inline int N::foofoo(int, double) { return 0; }
void blah() { }

int main() {

; return 0; }
EOF
if { (eval echo configure:4230: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  rm -rf conftest*
  namespace_found=yes
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  namespace_found=no
fi
rm -f conftest*
    if test "$namespace_found" = "yes"; then
	cat >> confdefs.h <<\EOF
#define _MPIPP_USENAMESPACE_ 1
EOF

	echo "$ac_t""yes" 1>&6
    else
	cat >> confdefs.h <<\EOF
#define _MPIPP_USENAMESPACE_ 0
EOF

	echo "$ac_t""no" 1>&6
    fi
fi

#
# Test to see if the no namespace workaround will work.  If not (broken g++
# version 2.7.2 and others), exit so that the user won't waste time
if test "$namespace_found" = "no" ; then
    echo $ac_n "checking that workaround for missing namespace works""... $ac_c" 1>&6
echo "configure:4260: checking that workaround for missing namespace works" >&5
    cat > conftest.$ac_ext <<EOF
#line 4262 "configure"
#include "confdefs.h"

class PMPI {
    public:
    class Comm;
   class Comm {
       public:
       typedef void Efn( Comm& );
   };
};
class MPI { 
    public:
    class Comm;
    class Comm {
       public:
       typedef void Efn( Comm& );
    };
};
int main() {
int a=0;
; return 0; }
EOF
if { (eval echo configure:4285: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  rm -rf conftest*
  echo "$ac_t""yes" 1>&6
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  echo "$ac_t""no" 1>&6
{ echo "configure: error: C++ interface requires working namespace or nested classes" 1>&2; exit 1; }

fi
rm -f conftest*
fi

#
# Check to see if the FORTRAN constants are there, 
# and then check for the optional FORTRAN constants.
#

echo $ac_n "checking for FORTRAN constants""... $ac_c" 1>&6
echo "configure:4305: checking for FORTRAN constants" >&5
cat > conftest.$ac_ext <<EOF
#line 4307 "configure"
#include "confdefs.h"
#include <mpi.h>

int main() {
MPI_Datatype a = MPI_INTEGER;
; return 0; }
EOF
if { (eval echo configure:4315: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  rm -rf conftest*
  fortran_found=yes
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  fortran_found=no
fi
rm -f conftest*
if test "$fortran_found" = "yes"; then
    cat >> confdefs.h <<\EOF
#define MPI2CPP_FORTRAN 1
EOF

    echo "$ac_t""yes" 1>&6
    echo $ac_n "checking for optional FORTRAN constants""... $ac_c" 1>&6
echo "configure:4332: checking for optional FORTRAN constants" >&5
    cat > conftest.$ac_ext <<EOF
#line 4334 "configure"
#include "confdefs.h"
#include <mpi.h>
    
int main() {
MPI_Datatype b = MPI_8REAL;
; return 0; }
EOF
if { (eval echo configure:4342: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  rm -rf conftest*
  all_found=yes
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  all_found=no
fi
rm -f conftest*
    if test "$all_found" = "yes"; then
	cat >> confdefs.h <<\EOF
#define MPI2CPP_ALL_OPTIONAL_FORTRAN 1
EOF

	echo "$ac_t""all" 1>&6
    else
	cat >> confdefs.h <<\EOF
#define MPI2CPP_ALL_OPTIONAL_FORTRAN 0
EOF

	cat > conftest.$ac_ext <<EOF
#line 4364 "configure"
#include "confdefs.h"
#include <mpi.h>
	
int main() {
MPI_Datatype c = MPI_2REAL;
; return 0; }
EOF
if { (eval echo configure:4372: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  rm -rf conftest*
  some_found=yes
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  some_found=no
fi
rm -f conftest*
	if test "$some_found" = "yes"; then
	    cat >> confdefs.h <<\EOF
#define MPI2CPP_SOME_OPTIONAL_FORTRAN 1
EOF

	    echo "$ac_t""some" 1>&6
	else
	    cat >> confdefs.h <<\EOF
#define MPI2CPP_SOME_OPTIONAL_FORTRAN 0
EOF

	    echo "$ac_t""none" 1>&6
	fi
    fi
else
    cat >> confdefs.h <<\EOF
#define MPI2CPP_FORTRAN 0
EOF

    echo "$ac_t""no" 1>&6
fi

#
# Check for optional C stuff.
#

echo $ac_n "checking for optional C constants""... $ac_c" 1>&6
echo "configure:4409: checking for optional C constants" >&5
cat > conftest.$ac_ext <<EOF
#line 4411 "configure"
#include "confdefs.h"
#include <mpi.h>

int main() {
MPI_Datatype d = MPI_UNSIGNED_LONG_LONG; MPI_Datatype e = MPI_LONG_LONG;
; return 0; }
EOF
if { (eval echo configure:4419: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  rm -rf conftest*
  c_found=yes
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  c_found=no
fi
rm -f conftest*
if test "$c_found" = "yes"; then
    cat >> confdefs.h <<\EOF
#define MPI2CPP_OPTIONAL_C 1
EOF

    echo "$ac_t""yes" 1>&6
else
    cat >> confdefs.h <<\EOF
#define MPI2CPP_OPTIONAL_C 0
EOF

    echo "$ac_t""no" 1>&6
fi
CXXFLAGS=$CXXFLAGS_SAVE

#
# Substitute them in...
#
















#
# Party on
#

trap '' 1 2 15

trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15

test "x$prefix" = xNONE && prefix=$ac_default_prefix
# Let make expand exec_prefix.
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'

# Any assignment to VPATH causes Sun make to only execute
# the first set of double-colon rules, so remove it if not needed.
# If there is a colon in the path, we need to keep it.
if test "x$srcdir" = x.; then
  ac_vpsub='/^[ 	]*VPATH[ 	]*=[^:]*$/d'
fi

trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15

DEFS=-DHAVE_CONFIG_H

# Without the "./", some shells look in PATH for config.status.
: ${CONFIG_STATUS=./config.status}

echo creating $CONFIG_STATUS
rm -f $CONFIG_STATUS
cat > $CONFIG_STATUS <<EOF
#! /bin/sh
# Generated automatically by configure.
# Run this file to recreate the current configuration.
# This directory was configured as follows,
# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
#
# $0 $ac_configure_args
#
# Compiler output produced by configure, useful for debugging
# configure, is in ./config.log if it exists.

ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
for ac_option
do
  case "\$ac_option" in
  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
    echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
    exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
  -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
    echo "$CONFIG_STATUS generated by autoconf version 2.13"
    exit 0 ;;
  -help | --help | --hel | --he | --h)
    echo "\$ac_cs_usage"; exit 0 ;;
  *) echo "\$ac_cs_usage"; exit 1 ;;
  esac
done

ac_given_srcdir=$srcdir
ac_given_INSTALL="$INSTALL"

trap 'rm -fr `echo "Makefile
    src/Makefile
    src/mpi2c++/Makefile
    contrib/Makefile
    contrib/test_suite/Makefile
    contrib/examples/Makefile
    balky/Makefile
    balky/balky
    balky/mini-balky src/mpi2c++/mpi2c++_config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
EOF
cat >> $CONFIG_STATUS <<EOF

# Protect against being on the right side of a sed subst in config.status.
sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
 s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
$ac_vpsub
$extrasub
s%@SHELL@%$SHELL%g
s%@CFLAGS@%$CFLAGS%g
s%@CPPFLAGS@%$CPPFLAGS%g
s%@CXXFLAGS@%$CXXFLAGS%g
s%@FFLAGS@%$FFLAGS%g
s%@DEFS@%$DEFS%g
s%@LDFLAGS@%$LDFLAGS%g
s%@LIBS@%$LIBS%g
s%@exec_prefix@%$exec_prefix%g
s%@prefix@%$prefix%g
s%@program_transform_name@%$program_transform_name%g
s%@bindir@%$bindir%g
s%@sbindir@%$sbindir%g
s%@libexecdir@%$libexecdir%g
s%@datadir@%$datadir%g
s%@sysconfdir@%$sysconfdir%g
s%@sharedstatedir@%$sharedstatedir%g
s%@localstatedir@%$localstatedir%g
s%@libdir@%$libdir%g
s%@includedir@%$includedir%g
s%@oldincludedir@%$oldincludedir%g
s%@infodir@%$infodir%g
s%@mandir@%$mandir%g
s%@VERSION@%$VERSION%g
s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
s%@INSTALL_DATA@%$INSTALL_DATA%g
s%@PACKAGE@%$PACKAGE%g
s%@ACLOCAL@%$ACLOCAL%g
s%@AUTOCONF@%$AUTOCONF%g
s%@AUTOMAKE@%$AUTOMAKE%g
s%@AUTOHEADER@%$AUTOHEADER%g
s%@MAKEINFO@%$MAKEINFO%g
s%@SET_MAKE@%$SET_MAKE%g
s%@GREP@%$GREP%g
s%@host@%$host%g
s%@host_alias@%$host_alias%g
s%@host_cpu@%$host_cpu%g
s%@host_vendor@%$host_vendor%g
s%@host_os@%$host_os%g
s%@AWK@%$AWK%g
s%@WC@%$WC%g
s%@MPI_CXX@%$MPI_CXX%g
s%@WANT_PROFILE@%$WANT_PROFILE%g
s%@MPI2CPP_LIBRARY@%$MPI2CPP_LIBRARY%g
s%@WANT_PROFILING_TRUE@%$WANT_PROFILING_TRUE%g
s%@WANT_PROFILING_FALSE@%$WANT_PROFILING_FALSE%g
s%@CXX@%$CXX%g
s%@CXXCPP@%$CXXCPP%g
s%@LN_S@%$LN_S%g
s%@BALKY_CXX@%$BALKY_CXX%g
s%@TEMPLATE_REP@%$TEMPLATE_REP%g
s%@CLEANFILES@%$CLEANFILES%g
s%@LSC_EXCEPTION_CXXFLAGS@%$LSC_EXCEPTION_CXXFLAGS%g
s%@LSC_EXCEPTION_LDFLAGS@%$LSC_EXCEPTION_LDFLAGS%g
s%@MINI_BALKY_CXXFLAGS@%$MINI_BALKY_CXXFLAGS%g
s%@BALKY_CXXFLAGS@%$BALKY_CXXFLAGS%g
s%@DEPFLAGS@%$DEPFLAGS%g
s%@MINI_BALKY_LDFLAGS@%$MINI_BALKY_LDFLAGS%g
s%@BALKY_LDFLAGS@%$BALKY_LDFLAGS%g
s%@OPTFLAGS@%$OPTFLAGS%g
s%@TEST_OPTFLAGS@%$TEST_OPTFLAGS%g
s%@EXAM_OPTFLAGS@%$EXAM_OPTFLAGS%g
s%@RANLIB@%$RANLIB%g
s%@AR@%$AR%g
s%@BINSH@%$BINSH%g
s%@MPILIB_DIR@%$MPILIB_DIR%g
s%@INSTALL@%$INSTALL%g
s%@TOPDIR@%$TOPDIR%g
s%@INSTALLDIR@%$INSTALLDIR%g
s%@IV_DESTRUCTORS@%$IV_DESTRUCTORS%g

CEOF
EOF

cat >> $CONFIG_STATUS <<\EOF

# Split the substitutions into bite-sized pieces for seds with
# small command number limits, like on Digital OSF/1 and HP-UX.
ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
ac_file=1 # Number of current file.
ac_beg=1 # First line for current file.
ac_end=$ac_max_sed_cmds # Line after last line for current file.
ac_more_lines=:
ac_sed_cmds=""
while $ac_more_lines; do
  if test $ac_beg -gt 1; then
    sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
  else
    sed "${ac_end}q" conftest.subs > conftest.s$ac_file
  fi
  if test ! -s conftest.s$ac_file; then
    ac_more_lines=false
    rm -f conftest.s$ac_file
  else
    if test -z "$ac_sed_cmds"; then
      ac_sed_cmds="sed -f conftest.s$ac_file"
    else
      ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
    fi
    ac_file=`expr $ac_file + 1`
    ac_beg=$ac_end
    ac_end=`expr $ac_end + $ac_max_sed_cmds`
  fi
done
if test -z "$ac_sed_cmds"; then
  ac_sed_cmds=cat
fi
EOF

cat >> $CONFIG_STATUS <<EOF

CONFIG_FILES=\${CONFIG_FILES-"Makefile
    src/Makefile
    src/mpi2c++/Makefile
    contrib/Makefile
    contrib/test_suite/Makefile
    contrib/examples/Makefile
    balky/Makefile
    balky/balky
    balky/mini-balky"}
EOF
cat >> $CONFIG_STATUS <<\EOF
for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
  case "$ac_file" in
  *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
       ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
  *) ac_file_in="${ac_file}.in" ;;
  esac

  # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.

  # Remove last slash and all that follows it.  Not all systems have dirname.
  ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
  if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
    # The file is in a subdirectory.
    test ! -d "$ac_dir" && mkdir "$ac_dir"
    ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
    # A "../" for each directory in $ac_dir_suffix.
    ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
  else
    ac_dir_suffix= ac_dots=
  fi

  case "$ac_given_srcdir" in
  .)  srcdir=.
      if test -z "$ac_dots"; then top_srcdir=.
      else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
  /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
  *) # Relative path.
    srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
    top_srcdir="$ac_dots$ac_given_srcdir" ;;
  esac

  case "$ac_given_INSTALL" in
  [/$]*) INSTALL="$ac_given_INSTALL" ;;
  *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
  esac

  echo creating "$ac_file"
  rm -f "$ac_file"
  configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
  case "$ac_file" in
  *Makefile*) ac_comsub="1i\\
# $configure_input" ;;
  *) ac_comsub= ;;
  esac

  ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
  sed -e "$ac_comsub
s%@configure_input@%$configure_input%g
s%@srcdir@%$srcdir%g
s%@top_srcdir@%$top_srcdir%g
s%@INSTALL@%$INSTALL%g
" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
fi; done
rm -f conftest.s*

# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
# NAME is the cpp macro being defined and VALUE is the value it is being given.
#
# ac_d sets the value in "#define NAME VALUE" lines.
ac_dA='s%^\([ 	]*\)#\([ 	]*define[ 	][ 	]*\)'
ac_dB='\([ 	][ 	]*\)[^ 	]*%\1#\2'
ac_dC='\3'
ac_dD='%g'
# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
ac_uA='s%^\([ 	]*\)#\([ 	]*\)undef\([ 	][ 	]*\)'
ac_uB='\([ 	]\)%\1#\2define\3'
ac_uC=' '
ac_uD='\4%g'
# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
ac_eA='s%^\([ 	]*\)#\([ 	]*\)undef\([ 	][ 	]*\)'
ac_eB='$%\1#\2define\3'
ac_eC=' '
ac_eD='%g'

if test "${CONFIG_HEADERS+set}" != set; then
EOF
cat >> $CONFIG_STATUS <<EOF
  CONFIG_HEADERS="src/mpi2c++/mpi2c++_config.h"
EOF
cat >> $CONFIG_STATUS <<\EOF
fi
for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then
  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
  case "$ac_file" in
  *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
       ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
  *) ac_file_in="${ac_file}.in" ;;
  esac

  echo creating $ac_file

  rm -f conftest.frag conftest.in conftest.out
  ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
  cat $ac_file_inputs > conftest.in

EOF

# Transform confdefs.h into a sed script conftest.vals that substitutes
# the proper values into config.h.in to produce config.h.  And first:
# Protect against being on the right side of a sed subst in config.status.
# Protect against being in an unquoted here document in config.status.
rm -f conftest.vals
cat > conftest.hdr <<\EOF
s/[\\&%]/\\&/g
s%[\\$`]%\\&%g
s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
s%ac_d%ac_u%gp
s%ac_u%ac_e%gp
EOF
sed -n -f conftest.hdr confdefs.h > conftest.vals
rm -f conftest.hdr

# This sed command replaces #undef with comments.  This is necessary, for
# example, in the case of _POSIX_SOURCE, which is predefined and required
# on some systems where configure will not decide to define it.
cat >> conftest.vals <<\EOF
s%^[ 	]*#[ 	]*undef[ 	][ 	]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */%
EOF

# Break up conftest.vals because some shells have a limit on
# the size of here documents, and old seds have small limits too.

rm -f conftest.tail
while :
do
  ac_lines=`grep -c . conftest.vals`
  # grep -c gives empty output for an empty file on some AIX systems.
  if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi
  # Write a limited-size here document to conftest.frag.
  echo '  cat > conftest.frag <<CEOF' >> $CONFIG_STATUS
  sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS
  echo 'CEOF
  sed -f conftest.frag conftest.in > conftest.out
  rm -f conftest.in
  mv conftest.out conftest.in
' >> $CONFIG_STATUS
  sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail
  rm -f conftest.vals
  mv conftest.tail conftest.vals
done
rm -f conftest.vals

cat >> $CONFIG_STATUS <<\EOF
  rm -f conftest.frag conftest.h
  echo "/* $ac_file.  Generated automatically by configure.  */" > conftest.h
  cat conftest.in >> conftest.h
  rm -f conftest.in
  if cmp -s $ac_file conftest.h 2>/dev/null; then
    echo "$ac_file is unchanged"
    rm -f conftest.h
  else
    # Remove last slash and all that follows it.  Not all systems have dirname.
      ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
      if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
      # The file is in a subdirectory.
      test ! -d "$ac_dir" && mkdir "$ac_dir"
    fi
    rm -f $ac_file
    mv conftest.h $ac_file
  fi
fi; done

EOF
cat >> $CONFIG_STATUS <<EOF


EOF
cat >> $CONFIG_STATUS <<\EOF
test -z "$CONFIG_HEADERS" || echo timestamp > src/mpi2c++/stamp-h
chmod +x balky/balky balky/mini-balky
exit 0
EOF
chmod +x $CONFIG_STATUS
rm -fr confdefs* $ac_clean_files
test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1

