#! /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-mpich=MPI_DIR	Top-level install directory for MPICH/MPI"
ac_help="$ac_help
--with-sp		Use IBM's SP/MPI"
ac_help="$ac_help
--with-sgi=MPI_DIR		Use SGI's IRIX/64 MPI"
ac_help="$ac_help
--with-sgi64=MPI_DIR		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-sun		Use SUN's HPC 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-extralibs=libs	Extra libraries necessary for MPI executables"
ac_help="$ac_help
--with-exflags          Specify flags necessary to enable exceptions"
ac_help="$ac_help
--with-opt=FLAGS	Compile with specific optimization flags"
ac_help="$ac_help
--with-libopt		Opt flags for use when compiling liboompi.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"

# 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/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



# Get the version of OOMPI that we are installing
if test "$srcdir" != ""; then
    PFILE=$srcdir/VERSION
else
    PFILE=VERSION
fi
OOMPI_VERSION=`cat $PFILE | cut -f3 -d\ `

echo "Configuring OOMPI version $OOMPI_VERSION"

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

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:597: 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:650: 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:707: 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=oompi

VERSION=$OOMPI_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:746: 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:759: 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:772: 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:785: 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:798: 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







#
# Directories for other packages
#

MPI_IMP=other_vendor
MPI_DIR=$prefix
MPI_INCDIR=

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

MPI_CONSTANTS_BAD=0

OSCAR_CXX=
OSCAR_CXXFLAGS=
OSCAR_LIBS=
OSCAR_LDFLAGS=


#
# Compiler flags
#

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

#
# Miscellaneous flags
#

MPICH_DEV=
EXTRA_CXXFLAGS=
WANT_SOCKET_LIBS=
WANT_THREAD_LIBS=
WANT_MATH_LIB=1
ARCH=
EXFLAGS=
FORCE_EXFLAGS=


#
# 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:878: 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
#
# Also use this info to setup to check later if we have the specific vendor
# implementation for this machine (if no implementation was specified on the
# ./configure command line)
#


# 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:930: 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


# Test for KCC, and put "--backend" into backendmaybe if it is in use.
if test "$CC" = "KCC"; then
	backendmaybe="--backend"
else
	backendmaybe=""
fi

case "$host" in
    *-hp-hpux*)
        EXTRA_CXXFLAGS="$backendmaybe +eh $backendmaybe -Wl,+vnocompatwarnings"
	case "$host" in 
	    *-hp-hpux10*)
		EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS $backendmaybe +a1"
		;;
	esac
        CXXFLAGS="$CXXFLAGS $EXTRA_CXXFLAGS"
        EXFLAGS="$backendmaybe +eh"

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


        OPTFLAGS="$backendmaybe +O1"
        EXAM_OPTFLAGS=$OPTFLAGS
        TEST_OPTFLAGS=$OPTFLAGS

	MPI_CXX_SAVE=$MPI_CXX

	ARCH=HPUX
        ;;

    mips-sgi-irix*)
       	WANT_MATH_LIB=0
	ARCH=IRIX

	ccver=`cc -version 2>&1`
	if test "`echo $ccver | grep 7.20`" != "" -o "`echo $ccver | grep 7.2.1`" != "" -o "`echo $ccver | grep 7.30`" != ""; then
        	OPTFLAGS="-O2"   # Had to remove Ofast because it implies -IPA (involving a special link step), and Olimit because it caused out-of-memory conditions
        	TEST_OPTFLAGS="$backendmaybe $OPTFLAGS"
        	EXAM_OPTFLAGS="$OPTFLAGS"
	elif test "`echo $ccver | grep 'unknown option'`"; then
        	OPTFLAGS="-O2"
        	TEST_OPTFLAGS="$backendmaybe $OPTFLAGS"
        	EXAM_OPTFLAGS="$OPTFLAGS"
		# $#%^$%^#$!!! Don't ask...
		SIGNAL_FLAGS="-n32"
	fi
	;;

    *-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
	;;

    sparc-sun-solaris*)
	# Sun workshop CC compiler does really really icky things with -fast 
	# in the test suite -- the compiler runs out of memory in the 
	# optimizer, and we don't get much performance improvements anyway
	OPTFLAGS="-fast"
	if test "$CC" = "KCC"; then
	    TEST_OPTFLAGS="$OPTFLAGS -O3"
	fi
	EXAM_OPTFLAGS=$OPTFLAGS
	ARCH=SUN
	;;

    rs6000-ibm-aix*)
	ARCH=IBM
	;;

esac

#
# Now we can clear MPI_CXX
#

MPI_CXX=


#
# 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:1047: 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 "expr", so it can be a program name with args.
set dummy expr; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1082: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_EXPR'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  case "$EXPR" in
  /*)
  ac_cv_path_EXPR="$EXPR" # Let the user override the test with a path.
  ;;
  ?:/*)			 
  ac_cv_path_EXPR="$EXPR" # 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_EXPR="$ac_dir/$ac_word"
      break
    fi
  done
  IFS="$ac_save_ifs"
  ;;
esac
fi
EXPR="$ac_cv_path_EXPR"
if test -n "$EXPR"; then
  echo "$ac_t""$EXPR" 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:1117: 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



#
# 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


#
# 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



#
# 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 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:1211: checking for hcp" >&5
	MPI_CXX=$WITHDIR/bin/hcp
	LAMBOOT=$WITHDIR/bin/lamboot
	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:1217: checking for hcp" >&5
	MPI_CXX=$WITHDIR/hcp
	LAMBOOT=$WITHDIR/lamboot
	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:1225: 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
    fi
    CXX=$MPI_CXX

    MPI_LIBS=""

    echo $ac_n "checking for LAM/MPI version""... $ac_c" 1>&6
echo "configure:1270: 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
	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
	LAMVER=6.3.2
	echo "$ac_t""$LAMVER (good)" 1>&6
	WANT_UPGRADE=0

    elif test "`echo $VER | $GREP 6.3.3`" != ""; then
	LAMVER=6.3.3
	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
	echo "$ac_t""$LAMVER (good)" 1>&6
	WANT_UPGRADE=0
    else
	LAMVER=no
	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:1323: checking for LAM's underlying C++ compiler" >&5
    full="`$MPI_CXX -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
fi

#
# MPICH 1.2.0/1.2.1 (or higher)
#

# 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


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

    USING_MPICH=1
    MPI_CXX=no
    if test "$WITHDIR" != "" -a -x "$WITHDIR/bin/mpiCC"; then
	echo $ac_n "checking for mpiCC""... $ac_c" 1>&6
echo "configure:1364: checking for mpiCC" >&5
	MPI_CXX=$WITHDIR/bin/mpiCC
	echo "$ac_t""$MPI_CXX" 1>&6
    elif test "$WITHDIR" != "" -a -x "$WITHDIR/mpiCC"; then
	echo $ac_n "checking for mpiCC""... $ac_c" 1>&6
echo "configure:1369: checking for mpiCC" >&5
	MPI_CXX=$WITHDIR/mpiCC
	echo "$ac_t""$MPI_CXX" 1>&6
    else
	# Extract the first word of "mpiCC", so it can be a program name with args.
set dummy mpiCC; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1376: 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

	if test "$MPI_CXX" != "no"; then
	    WITHDIR="basename $MPI_CXX"
	fi
    fi

    if test "$MPI_CXX" = "no"; then
        { echo "configure: error: cannot continue -- put MPICH's mpiCC in your path" 1>&2; exit 1; }
    fi
    CXX=$MPI_CXX

    MPI_LIBS=""

    # We can't check for the version of MPICH anymore, since they
    # don't provide the version number in the installed directory
    # anywhere.  Arf!

    # 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:1429: 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
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

if test "$MPI_IMP" = "ibm-sp" -o "$MPI_IMP" = "other_vendor" -a "$ARCH" = "IBM"; 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:1479: 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:1514: 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 "Configuring for use with IBM/MPI"

    echo $ac_n "checking POE version""... $ac_c" 1>&6
echo "configure:1535: 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 OOMPI_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 OOMPI_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 OOMPI_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 OOMPI_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 OOMPI_IBM21018 1
EOF

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

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

        echo "$ac_t""Unknown version -- $POE_VERSION (good luck)" 1>&6
    fi
    cat >> confdefs.h <<\EOF
#define OOMPI_IBM 1
EOF

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 WITHDIR=$withval
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 WITHDIR=$withval
fi


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

    # If they just said "--with-sgi", go find the libmpi.so
    if test "$WITHDIR" = "yes"; then
	WITHDIR=""
    fi
# If WITHDIR is empty, just use / (which was the default in OOMPI in the past).

    if test "$MPI_IMP" = "sgi"; then
        if test -f $WITHDIR/usr/lib32/libmpi.so; then
            LIBDIR=$WITHDIR/usr/lib32
            SGIFLAGS="-n32"
            SGIBIT="n32"
        elif test -f $WITHDIR/usr/lib64/libmpi.so; then
            LIBDIR=$WITHDIR/usr/lib64
            SGIFLAGS="-64"
            SGIBIT="64"
        else
            { echo "configure: error: cannot find libmpi.so in $WITHDIR/usr/lib32 or $WITHDIR/usr/lib64" 1>&2; exit 1; }
        fi
    elif test "$MPI_IMP" = "sgi64"; then
        if test -f $WITHDIR/usr/lib64/libmpi.so; then
            LIBDIR=$WITHDIR/usr/lib64
            SGIFLAGS="-64"
            SGIBIT="64"
        else
            { echo "configure: error: cannot find libmpi.so in $WITHDIR/usr/lib64" 1>&2; exit 1; }
        fi
    fi

    echo $ac_n "checking SGI MPI version""... $ac_c" 1>&6
echo "configure:1636: checking SGI MPI version" >&5
    IS20=`strings $LIBDIR/libmpi.so | $GREP "SGI MPI 2.0"`
    if test "$IS20" != ""; then    
        cat >> confdefs.h <<\EOF
#define OOMPI_SGI20 1
EOF

        echo "$ac_t""2.0 ($SGIBIT) (you should upgrade)" 1>&6
        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
    else

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

        echo "$ac_t""2.0 ($SGIBIT) (you should upgrade)" 1>&6
        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
      else

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

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

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

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

              echo "$ac_t""3.1 ($SGIBIT -- you should upgrade)" 1>&6
          else
            IS32=`strings $LIBDIR/libmpi.so | $GREP "SGI MPI 3.2"`
            if test "$IS32" != ""; then
                cat >> confdefs.h <<\EOF
#define OOMPI_SGI30 1
EOF

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

                echo "$ac_t""3.2 ($SGIBIT -- good)" 1>&6
            else
              VER=`strings $LIBDIR/libmpi.so | $GREP "SGI MPI"`
              cat >> confdefs.h <<\EOF
#define OOMPI_SGIUNKNOWN 1
EOF

              
              echo "$ac_t""Unknown version ($SGIBIT) -- $VER (good luck)" 1>&6
	    fi
          fi
        fi
      fi
    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" -o "$MPI_IMP" = "other_vendor" -a "$ARCH" = "cray"; then
    MPI_LIBS="-lmpi"
    CXX=CC
    MPI_CXX=CC

    echo "Configuring for use with Cray/MPI"

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

    echo $ac_n "checking Cray MPI version""... $ac_c" 1>&6
echo "configure:1732: checking Cray MPI version" >&5
    if test ! -f /opt/ctl/mpt/mpt/include/mpi.h; then
	echo "$ac_t""not found" 1>&6
	{ echo "configure: error: Could not find MPI installed.  Cannot continue." 1>&2; exit 1; }
    fi

    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 OOMPI_CRAY1104 1
EOF

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

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

    MPI_CXXFLAGS="-hnomessage=427"
    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" -o "$MPI_IMP" = "other_vendor" -a "$ARCH" = "HPUX"; 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 an appropriate compiler." 1>&2
                echo "configure: warning: Defaulting to aCC." 1>&2
        fi

	echo "Configuring for use with HP-UX/MPI"

        echo $ac_n "checking HP-UX MPI version""... $ac_c" 1>&6
echo "configure:1785: 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
        HPVER=`what $MPI_ROOT/lib/pa1.1/libmpi.a | grep "HP MPI" | cut -d. -f2-3`

        if test "$HPVER" = "01.02"; then
                cat >> confdefs.h <<\EOF
#define OOMPI_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 OOMPI_HPUX0103 1
EOF

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

                        echo "$ac_t""1.5 (good)" 1>&6
		else
                	cat >> confdefs.h <<\EOF
#define OOMPI_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:1822: checking for mpiCC compiler" >&5
        if 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


#
# Sun
#

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


if test "$MPI_IMP" = "sun" -o "$MPI_IMP" = "other_vendor" -a "$ARCH" = "SUN"; then
    echo "Configuring for use with Sun HPC/MPI"

    if test "$SUN_DIR" = ""; then
	SUN_DIR=/opt/SUNWhpc
    fi

    # Extract the first word of "tmCC", so it can be a program name with args.
set dummy tmCC; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1854: 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

    if test "$MPI_CXX" = "no"; then
        echo $ac_n "checking for tmCC (elsewhere)""... $ac_c" 1>&6
echo "configure:1889: checking for tmCC (elsewhere)" >&5
        for comp in $SUN_DIR/bin/tmCC /bin/tmCC /usr/bin/tmCC;  do
	    echo Checking: $comp
            if test "$MPI_CXX" = "" -a -x $comp -o -h $comp; then 
                echo "$ac_t""$comp" 1>&6 
                MPI_CXX=$comp 
            fi 
	done
        if test "$MPI_CXX" = "no"; then
            echo "$ac_t""no" 1>&6
            { echo "configure: error: cannot continue -- put tmCC in your path" 1>&2; exit 1; }
        fi
    fi
    CXX=$MPI_CXX

    # "-fast" will not work here; linker problems with Sun ld
    OPTFLAGS="-O3"
    TEST_OPTFLAGS=$OPTFLAGS
    EXAM_OPTFLAGS=$OPTFLAGS

    MPI_LIBS="-lmpi"
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$MPIDIR/lib"
    MPI_LIBS="-lmpi"
    WANT_SOCKET_LIBS=1
fi


#
# Non-listed 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" NOTLISTED_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" NOTLISTED_LIBDIR=$withval
fi


if test "$MPI_IMP" = "supplied-indiv"; then
    if test "$NOTLISTED_INCDIR" = ""; then
        { echo "configure: error: no include directory specified (--with-mpiinc)" 1>&2; exit 1; }
    elif test "$NOTLISTED_LIBDIR" = ""; then
        { echo "configure: error: no library directory specified (--with-mpilib)" 1>&2; exit 1; }
    elif test ! -d "$NOTLISTED_INCDIR"; then
        { echo "configure: error: $NOTLISTED_INCDIR does not exist" 1>&2; exit 1; }
    elif test ! -d "$NOTLISTED_LIBDIR"; then
        { echo "configure: error: $NOTLISTED_LIBDIR does not exist" 1>&2; exit 1; }
    fi
    MPI_CXXFLAGS="-I$NOTLISTED_INCDIR"
    MPI_LDFLAGS="-L$NOTLISTED_LIBDIR"
    MPI_LIBS="-lmpi"
    WANT_SOCKET_LIBS=1
fi


#
# Does our MPI need any extra libraries that we weren't able to discover?
#

# Check whether --with-extralibs or --without-extralibs was given.
if test "${with_extralibs+set}" = set; then
  withval="$with_extralibs"
  EXTRA_LIBS=$withval
fi



#
# Setup C++ compiler
#

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

#
# $%#@%#@ autoconf macros...
#

OOMPI_CXXFLAGS_SAVE="$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:2003: 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:2035: 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 2046 "configure"
#include "confdefs.h"

int main(){return(0);}
EOF
if { (eval echo configure:2051: \"$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:2077: 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:2082: 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:2091: \"$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:2110: 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

CXXSAVE="$CXX"
if test "$UNDERLYING_CXX" = g++ -o "$UNDERLYING_CXX" = aCC ; then
	CXX="$CXX -c"; #Workaround for broken hcc and mpiCC (MPICH) that try to pass -l options when -E is used on the command line, and g++ and HP aCC will not accept this.
fi
echo $ac_n "checking how to run the C++ preprocessor""... $ac_c" 1>&6
echo "configure:2146: 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 2159 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:2164: \"$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

CXX="$CXXSAVE"
CXXFLAGS="$OOMPI_CXXFLAGS_SAVE"
echo $ac_n "checking for AIX""... $ac_c" 1>&6
echo "configure:2191: checking for AIX" >&5
cat > conftest.$ac_ext <<EOF
#line 2193 "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*



OSCAR_CXX=$CXX

#
# If we're using g++, reset the opt flags
#

if test "$GXX" = "yes"; then
    OPTFLAGS="-O"
    TEST_OPTFLAGS="$OPTFLAGS"
    EXAM_OPTFLAGS="$OPTFLAGS"
fi


#
# Do we need to -lm, or is it automatic?
#

if test "$WANT_MATH_LIB" = "1"; then
    
    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_n "checking for fabs in -lm""... $ac_c" 1>&6
echo "configure:2242: checking for fabs in -lm" >&5
ac_lib_var=`echo m'_'fabs | 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="-lm  $LIBS"
cat > conftest.$ac_ext <<EOF
#line 2250 "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 fabs();

int main() {
fabs()
; return 0; }
EOF
if { (eval echo configure:2264: \"$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
  MATH_LIB="-lm"
else
  echo "$ac_t""no" 1>&6
MATH_LIB=""
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

fi

#
# Exception handling flags
#


#
# Get the exception handling flags for the C++ compiler
#
# Sets LSC_CXX_EXCEPTION_CXXFLAGS and LSC_CXX_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


CXXFLAGS_SAVE="$CXXFLAGS"
echo $ac_n "checking for compiler exception flags""... $ac_c" 1>&6
echo "configure:2317: 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 2332 "configure"
#include "confdefs.h"

int main() {
try { int i = 0; } catch(...) { int j = 2; }
; return 0; }
EOF
if { (eval echo configure:2339: \"$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="$CXXFLAGS_SAVE -fhandle-exceptions"
	cat > conftest.$ac_ext <<EOF
#line 2355 "configure"
#include "confdefs.h"

int main() {
try { int i = 0; } catch(...) { int j = 2; }
; return 0; }
EOF
if { (eval echo configure:2362: \"$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" -o "`basename $LAMHCP`" = "KCC"; then
    EXFLAGS="--exceptions"
fi
CXXFLAGS="$CXXFLAGS_SAVE"

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


CXXFLAGS="$LSC_CXX_EXCEPTION_CXXFLAGS $CXXFLAGS"

#
# Check to see if the C++ compiler can handle exceptions 
#
# Sets LSC_CXX_HAVE_EXCEPTIONS to 1 if compiler has exceptions, 0 if not
#

echo $ac_n "checking for throw/catch""... $ac_c" 1>&6
echo "configure:2406: checking for throw/catch" >&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 2416 "configure"
#include "confdefs.h"

int main() {
int i=1; throw(i);
; return 0; }
EOF
if { (eval echo configure:2423: \"$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 "$have_excep" = "yes"; then
    LSC_CXX_EXCEPTIONS=1
    echo "$ac_t""yes" 1>&6
else
    LSC_CXX_EXCEPTIONS=0
    echo "$ac_t""no" 1>&6
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

cat >> confdefs.h <<EOF
#define OOMPI_HAVE_EXCEPTIONS $LSC_CXX_EXCEPTIONS
EOF



#
# Set final compiler flags
# Ick!
#

OSCAR_CXXFLAGS="$LSC_CXX_EXCEPTION_CXXFLAGS $EXTRA_CXXFLAGS $MPI_CXXFLAGS -I$includedir/oompi"
CXXFLAGS="$CXXFLAGS $MPI_CXXFLAGS"



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


#
# Aborts if we cannot #include<mpi.h>
#

echo $ac_n "checking for mpi.h""... $ac_c" 1>&6
echo "configure:2473: 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:2482: $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:2489: here is the program that failed: >&5
    cat conftest.C >&5
    echo "$ac_t""no" 1>&6
fi
rm -f conftest*
if test "$HAVE_MPI_H" = "no"; then
    { echo "configure: error: cannot continue -- cannot find <mpi.h>" 1>&2; exit 1; }
fi
# Because "bool" might very well be defined in <mpi.h>
echo "#include<mpi.h>" >> confdefs.h


#
# Check for pthreads
#
# For the moment, let's not use pthreads, because it may be doing
# something bad in Solaris 2.6/7 / Workshop 5.0 compilers.
#

#AC_CHECK_LIB(pthread,pthread_mutex_init,use_pthreads=yes, use_pthreads=no)
#if test "$use_pthreads" = "yes"; then
#    AC_DEFINE(OOMPI_HAVE_PTHREADS,1)
#    pthread_lib="-lpthread"
#else
#    AC_CHECK_LIB(posix4,pthread_mutex_init,use_pthreads2=yes, use_pthreads2=no,-lpthread)
#    if test "$use_pthreads2" = "yes"; then
#	AC_DEFINE(OOMPI_HAVE_PTHREADS,1)
#	pthread_lib="-lpthread -lposix4"
#    else
#	AC_DEFINE(OOMPI_HAVE_PTHREADS,0)
#	pthread_lib=""
#    fi
#fi

pthread_lib=""
cat >> confdefs.h <<\EOF
#define OOMPI_HAVE_PTHREADS 0
EOF



#
# 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:2536: 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 2544 "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:2558: \"$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:2580: 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 2588 "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:2602: \"$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
# This is no longer used -- it *used* to be used by MPICH
#if test "$WANT_THREAD_LIBS" = "1"; then
#    AC_CHECK_LIB(thread, sigwait, thread_lib="-lthread", thread_lib="")
#fi
EXTRA_LIBS="$EXTRA_LIBS $socket_lib $nsl_lib $thread_lib $pthread_lib"




#
# Set final linker flags
#

OSCAR_LDFLAGS="$LSC_CXX_EXCEPTION_LDFLAGS $EXTRA_LDFLAGS $MPI_LDFLAGS -L$libdir -loompi $MPI_LIBS $EXTRA_LIBS"


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


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

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

echo $ac_n "checking for MPI_Initialized in -lmpi""... $ac_c" 1>&6
echo "configure:2658: checking for MPI_Initialized in -lmpi" >&5
cat > conftest.$ac_ext <<EOF
#line 2660 "configure"
#include "confdefs.h"
#include <mpi.h>

int main() {
int i; MPI_Initialized(&i);
; return 0; }
EOF
if { (eval echo configure:2668: \"$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 -lmpi" 1>&2; exit 1; }
fi
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"
  OPTFLAGS=$withval TEST_OPTFLAGS=$withval EXAM_OPTFLAGS=$withval
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

if test "$OPTFLAGS" = "no"; then
    OPTFLAGS="$NOOPT"
fi
if test "$TEST_OPTFLAGS" = "no"; then
    TEST_OPTFLAGS="$NOOPT"
fi
if test "$EXAM_OPTFLAGS" = "no"; then
    EXAM_OPTFLAGS="$NOOPT"
fi


#
# Get peculiarities about our MPI
# Can our MPI use its constants as initializers before MPI_Init() is called?
#

cat >> confdefs.h <<EOF
#define OOMPI_MPI_CONSTANTS_BAD $MPI_CONSTANTS_BAD
EOF



#
# Find out what kind of MPI handles we have
#


#
# Check whether MPI constants are actual MPI handles or integer constants
#

echo $ac_n "checking for type of MPI constants""... $ac_c" 1>&6
echo "configure:2747: checking for type of MPI constants" >&5
cat > conftest.$ac_ext <<EOF
#line 2749 "configure"
#include "confdefs.h"
#include <mpi.h>
int main() {
MPI_Comm *foo = &MPI_COMM_NULL;
; return 0; }
EOF
if { (eval echo configure:2756: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  rm -rf conftest*
  LSC_MPI_CONSTANTS_ARE_HANDLES="1"
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  LSC_MPI_CONSTANTS_ARE_HANDLES="0"
fi
rm -f conftest*
if test "$LSC_MPI_CONSTANTS_ARE_HANLDES" = "1"; then
    echo "$ac_t""handles" 1>&6
else
    echo "$ac_t""constants" 1>&6
fi
cat >> confdefs.h <<EOF
#define OOMPI_MPI_CONSTANTS_ARE_HANDLES $LSC_MPI_CONSTANTS_ARE_HANDLES
EOF



#
# At least one MPI implementation [used to] have MPI_PENDING instead
# of MPI_ERR_PENDING.  Also check for if we need 'extern "C"' for some
# prototypes.
#


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

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

int main() {
int yow=MPI_PENDING;
; return 0; }
EOF
if { (eval echo configure:2803: \"$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_MPI_ERR_PENDING=1
    echo "$ac_t""MPI_PENDING" 1>&6
else
    LSC_MPI_ERR_PENDING=0
    echo "$ac_t""MPI_ERR_PENDING" 1>&6
fi
cat >> confdefs.h <<EOF
#define LSC_MPI_ERR_PENDING $LSC_MPI_ERR_PENDING
EOF


echo $ac_n "checking for extern "C" MPI types""... $ac_c" 1>&6
echo "configure:2826: checking for extern "C" MPI types" >&5

touch conftest.o
rm -f conftest.o
cat > conftest.C <<EOF
#include <mpi.h>

extern "C" {
  void op_foo(void *invec, void *inoutvec, int *len, 
	      MPI_Datatype *type);
}

int
main(int argc, char* argv)
{ 
  MPI_User_function *f = op_foo;
  return 0; 
}
EOF
echo configure:2845: $CXX $CXXFLAGS -c conftest.C >&5
$CXX $CXXFLAGS -c conftest.C > conftest.out 2>&1
if test "$_"; then
    # If it didn't compile, automatically set it bad
    badness=1
else
    # If it did compile, check for warnings in the output
    badness="`grep -i warn conftest.out`"
fi
# Double check for if it didn't compile
if test ! -f conftest.o -a ! -f conftest.lo; then
    badness=1
fi
# Send the output to config.log as well so that we have a record of
# what happened
cat conftest.out >&5
# Now take action
if test "$badness" = ""; then
    cat >> confdefs.h <<\EOF
#define OOMPI_MPI_EXTERN_C 1
EOF

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

    echo "$ac_t""not needed" 1>&6
fi
rm -f conftest.*


#
# 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:2894: 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
        ;;
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:2969: 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:2999: 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

echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
echo "configure:3027: 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

# 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:3050: 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
#

echo $ac_n "checking for bool type""... $ac_c" 1>&6
echo "configure:3092: checking for bool type" >&5
cat > conftest.$ac_ext <<EOF
#line 3094 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <stdlib.h>
#include <mpi.h>

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

    BOOL_TYPE="bool"
    echo "$ac_t""bool" 1>&6
else
    cat >> confdefs.h <<\EOF
#define OOMPI_HAVE_BOOL 0
EOF

    BOOL_TYPE="unsigned int"
    echo "$ac_t""none defined" 1>&6
fi
cat >> confdefs.h <<EOF
#define OOMPI_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.
#
# JJW: For SGI native MPI, -lmpi needs to be included so the test program
# will build.

#SAVE_LDFLAGS="$LDFLAGS"
#SAVE_LIBS="$LIBS"
#LDFLAGS=
#LIBS=

echo $ac_n "checking size of int""... $ac_c" 1>&6
echo "configure:3153: checking size of int" >&5
if eval "test \"`echo '$''{'ac_cv_sizeof_int'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  if test "$cross_compiling" = yes; then
  ac_cv_sizeof_int=4
else
  cat > conftest.$ac_ext <<EOF
#line 3161 "configure"
#include "confdefs.h"
#ifdef __cplusplus
extern "C" void exit(int);
#endif
#include <stdio.h>
main()
{
  FILE *f=fopen("conftestval", "w");
  if (!f) exit(1);
  fprintf(f, "%d\n", sizeof(int));
  exit(0);
}
EOF
if { (eval echo configure:3175: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
  ac_cv_sizeof_int=`cat conftestval`
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -fr conftest*
  ac_cv_sizeof_int=0
fi
rm -fr conftest*
fi

fi
echo "$ac_t""$ac_cv_sizeof_int" 1>&6
cat >> confdefs.h <<EOF
#define SIZEOF_INT $ac_cv_sizeof_int
EOF


echo $ac_n "checking size of OOMPI_BOOL_T""... $ac_c" 1>&6
echo "configure:3195: checking size of OOMPI_BOOL_T" >&5
if eval "test \"`echo '$''{'ac_cv_sizeof_OOMPI_BOOL_T'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  if test "$cross_compiling" = yes; then
  ac_cv_sizeof_OOMPI_BOOL_T=4
else
  cat > conftest.$ac_ext <<EOF
#line 3203 "configure"
#include "confdefs.h"
#ifdef __cplusplus
extern "C" void exit(int);
#endif
#include <stdio.h>
main()
{
  FILE *f=fopen("conftestval", "w");
  if (!f) exit(1);
  fprintf(f, "%d\n", sizeof(OOMPI_BOOL_T));
  exit(0);
}
EOF
if { (eval echo configure:3217: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
  ac_cv_sizeof_OOMPI_BOOL_T=`cat conftestval`
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -fr conftest*
  ac_cv_sizeof_OOMPI_BOOL_T=0
fi
rm -fr conftest*
fi

fi
echo "$ac_t""$ac_cv_sizeof_OOMPI_BOOL_T" 1>&6
cat >> confdefs.h <<EOF
#define SIZEOF_OOMPI_BOOL_T $ac_cv_sizeof_OOMPI_BOOL_T
EOF



#LDFLAGS="$SAVE_LDFLAGS"
#LIBS="$SAVE_LIBS"


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


#
# Do we have BSD or SYSV style signals?
# (or something that we haven't thought of yet?)
#
# Sets LSC_OS_SIGNAL_TYPE to BSD, SYSV, or aborts if it can't figure it out
#

SAVE_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$SIGNAL_FLAGS $CXXFLAGS"


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_n "checking for signal declaration""... $ac_c" 1>&6
echo "configure:3267: checking for signal declaration" >&5
cat > conftest.$ac_ext <<EOF
#line 3269 "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);
; return 0; }
EOF
if { (eval echo configure:3278: \"$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
    LSC_OS_SIGNAL_TYPE="BSD"
    echo "$ac_t""BSD" 1>&6
else

#
# Sanity check.  Make sure that it is SYSV
#

    cat > conftest.$ac_ext <<EOF
#line 3298 "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:3307: \"$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
	LSC_OS_SIGNAL_TYPE="SYSV"
        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
CXXFLAGS="$SAVE_CXXFLAGS"
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

if test "$LSC_OS_SIGNAL_TYPE" = "BSD"; then
    cat >> confdefs.h <<\EOF
#define OOMPI_BSD_SIGNAL 1
EOF

else
    cat >> confdefs.h <<\EOF
#define OOMPI_SYSV_SIGNAL 1
EOF

fi


#
# 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 LSC_CXX_TEMPLATE_REPOSITORY to the directory name, or blank
# Does AC_SUBST on LSC_CXX_TEMPLATE_REPOSITORY
#

echo $ac_n "checking for template repository directory""... $ac_c" 1>&6
echo "configure:3361: 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

template_failed=
echo configure:3419: $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:3423: here is the program that failed: >&5
    cat conftest1.C >&5
    echo configure:3425: here is conftest.h: >&5
    cat conftest.h >&5
    template_failed=1
else
    echo configure:3429: $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:3433: here is the program that failed: >&5
	cat conftest2.C >&5
	echo configure:3435: 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
LSC_CXX_TEMPLATE_REPOSITORY="$TEMPLATE_DIR $TEMPLATE_FILEMASK"

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

CLEANFILES="-r $LSC_CXX_TEMPLATE_REPOSITORY *~"


#
# Find some happy things
#


#
# Looks for the include directories of the C++ compiler
# Will call AC_PROG_CXXCPP if it has not been 
# called alreay.
#
# Sets LSC_MPI_DEPDIRS to "-Idir1 -Idir2..." or blank
# Calls AC_SUBST on LSC_MPI_DEPDIRS
#

# Now see if we've figured out what the C++ preprocessor is
if test "$?CXXCPP" = "0"; then
    echo $ac_n "checking how to run the C++ preprocessor""... $ac_c" 1>&6
echo "configure:3503: 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 3516 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:3521: \"$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

fi
echo $ac_n "checking for MPI include directories""... $ac_c" 1>&6
echo "configure:3547: checking for MPI include directories" >&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.cc <<EOF
#include "mpi.h"

int main(int argc, char* argv) { return 0; }
EOF
$CXXCPP conftest.cc 2>&5 | grep '^#.*\"' | grep -v '^#pragma' | \
grep -v '^#ident' | sed -e 's/#.*\"\(.*\)\".*$/\1/' | \
sort -u - | grep -v conftest.cc > conftest.out
LSC_TEMP=
rm -f conftest2.out
touch conftest2.out
for LSC_FILE in `cat conftest.out`; do
    LSC_TEMP2="`dirname $LSC_FILE`"
    if test "$LSC_TEMP" != "$LSC_TEMP2"; then
	echo "$LSC_TEMP2" >> conftest2.out
	LSC_TEMP="$LSC_TEMP2"
    fi
done
LSC_MPI_DEPDIRS=
for LSC_DIR in `sort -u conftest2.out | uniq`; do
	if test -f $LSC_DIR/mpi.h ; then
    	LSC_MPI_DEPDIRS="-I$LSC_DIR $LSC_MPI_DEPDIRS"
	fi
done
rm -f conftest*
echo "$ac_t""$LSC_MPI_DEPDIRS" 1>&6

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


#
# Looks for the include directories of the C++ compiler
# Will call LSC_CXX_HAVE_STL and AC_PROG_CXXCPP if they haven't been 
# called alreay.
#
# Sets LSC_CXX_DEPDIRS to "-Idir1 -Idir2..." or blank
# Calls AC_SUBST on LSC_CXX_DEPDIRS
#

# First we need to see if we need to check for STL
if test "$LSC_CXX_STL" = ""; then
    
#
# See if the compiler has STL
#
# Set LSC_CXX_STL to 1 if so, 0 if not
# AC_DEFINE LSC_CXX_STL to 1 if so, 0 if not
#


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

ac_safe=`echo "map" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for map""... $ac_c" 1>&6
echo "configure:3620: checking for map" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  cat > conftest.$ac_ext <<EOF
#line 3625 "configure"
#include "confdefs.h"
#include <map>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:3630: \"$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
  rm -rf conftest*
  eval "ac_cv_header_$ac_safe=yes"
else
  echo "$ac_err" >&5
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  eval "ac_cv_header_$ac_safe=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
  echo "$ac_t""yes" 1>&6
  LSC_CXX_STL=1
else
  echo "$ac_t""no" 1>&6
LSC_CXX_STL=0
fi

cat >> confdefs.h <<EOF
#define LSC_CXX_STL $LSC_CXX_STL
EOF

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
# Now see if we've figured out what the C++ preprocessor is
if test "$?CXXCPP" = "0"; then
    echo $ac_n "checking how to run the C++ preprocessor""... $ac_c" 1>&6
echo "configure:3667: 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 3680 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:3685: \"$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

fi
echo $ac_n "checking for C++ include directories""... $ac_c" 1>&6
echo "configure:3711: checking for C++ include directories" >&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

if test "$LSC_CXX_STL" = "1"; then
    LSC_TEMP="#include <map>"
else
    LSC_TEMP=""
fi
cat > conftest.cc <<EOF
#include <iostream.h>
$LSC_TEMP

int main(int argc, char* argv) { return 0; }
EOF
$CXXCPP conftest.cc 2>&5 | grep '^#.*\"' | grep -v '^#pragma' | \
grep -v '^#ident' | sed -e 's/#.*\"\(.*\)\".*$/\1/' | \
sort -u - | grep -v conftest.cc > conftest.out
LSC_TEMP=
rm -f conftest2.out
touch conftest2.out
for LSC_FILE in `cat conftest.out`; do
    LSC_TEMP2="`dirname $LSC_FILE`"
    if test "$LSC_TEMP" != "$LSC_TEMP2"; then
	echo "$LSC_TEMP2" >> conftest2.out
	LSC_TEMP="$LSC_TEMP2"
    fi
done
LSC_CXX_DEPDIRS=
for LSC_DIR in `sort -u conftest2.out | uniq`; do
	if test -f $LSC_DIR/iostream.h -o \
			-f $LSC_DIR/map -o \
			-f $LSC_DIR/map.h -o \
			-f $LSC_DIR/new -o \
			-f $LSC_DIR/new.h -o \
			-f $LSC_DIR/stdarg.h ; then
    	LSC_CXX_DEPDIRS="-I$LSC_DIR $LSC_CXX_DEPDIRS"
	fi
done
rm -f conftest*
echo "$ac_t""$LSC_CXX_DEPDIRS" 1>&6

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

ORIG_DEPFLAGS="$LSC_MPI_DEPDIRS $LSC_CXX_DEPDIRS"

for ac_prog in makedepend
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:3772: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_MAKEDEPEND'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  if test -n "$MAKEDEPEND"; then
  ac_cv_prog_MAKEDEPEND="$MAKEDEPEND" # 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_MAKEDEPEND="$ac_prog"
      break
    fi
  done
  IFS="$ac_save_ifs"
fi
fi
MAKEDEPEND="$ac_cv_prog_MAKEDEPEND"
if test -n "$MAKEDEPEND"; then
  echo "$ac_t""$MAKEDEPEND" 1>&6
else
  echo "$ac_t""no" 1>&6
fi

test -n "$MAKEDEPEND" && break
done
test -n "$MAKEDEPEND" || MAKEDEPEND="no"


#
# Substitute everything 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
    contrib/Makefile
    contrib/test_suite/Makefile
    contrib/examples/Makefile
    oscar/Makefile
    oscar/oscar src/oompi-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%@OOMPI_VERSION@%$OOMPI_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%@VERSION@%$VERSION%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%@EXPR@%$EXPR%g
s%@WC@%$WC%g
s%@MPI_CXX@%$MPI_CXX%g
s%@CXX@%$CXX%g
s%@CXXCPP@%$CXXCPP%g
s%@MATH_LIB@%$MATH_LIB%g
s%@LSC_CXX_EXCEPTION_CXXFLAGS@%$LSC_CXX_EXCEPTION_CXXFLAGS%g
s%@LSC_CXX_EXCEPTION_LDFLAGS@%$LSC_CXX_EXCEPTION_LDFLAGS%g
s%@OSCAR_CXXFLAGS@%$OSCAR_CXXFLAGS%g
s%@OSCAR_LDFLAGS@%$OSCAR_LDFLAGS%g
s%@RANLIB@%$RANLIB%g
s%@AR@%$AR%g
s%@LN_S@%$LN_S%g
s%@BINSH@%$BINSH%g
s%@LSC_CXX_TEMPLATE_REPOSITORY@%$LSC_CXX_TEMPLATE_REPOSITORY%g
s%@CLEANFILES@%$CLEANFILES%g
s%@LSC_MPI_DEPDIRS@%$LSC_MPI_DEPDIRS%g
s%@LSC_CXX_DEPDIRS@%$LSC_CXX_DEPDIRS%g
s%@ORIG_DEPFLAGS@%$ORIG_DEPFLAGS%g
s%@MAKEDEPEND@%$MAKEDEPEND%g
s%@OSCAR_CXX@%$OSCAR_CXX%g
s%@MPI_INCDIR@%$MPI_INCDIR%g
s%@OOMPI_INCDIR@%$OOMPI_INCDIR%g
s%@OPTFLAGS@%$OPTFLAGS%g
s%@TEST_OPTFLAGS@%$TEST_OPTFLAGS%g
s%@EXAM_OPTFLAGS@%$EXAM_OPTFLAGS%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
    contrib/Makefile
    contrib/test_suite/Makefile
    contrib/examples/Makefile
    oscar/Makefile
    oscar/oscar"}
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/oompi-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/stamp-h
chmod +x oscar/oscar
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

