#! /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
  --enable-echo           echo configure script commands"
ac_help="$ac_help
  --with-cc=CC            use C compiler CC"
ac_help="$ac_help
  --with-cflags=CFLAGS    use C compiler flags CFLAGS"
ac_help="$ac_help
  --enable-shared[=PKGS]  build shared libraries [default=no]"
ac_help="$ac_help
  --without-romio         disable ROMIO support in LAM/MPI"
ac_help="$ac_help
  --with-romio-flags=FLAGS pass FLAGS to ROMIO's configure script"
ac_help="$ac_help
  --without-mpi2cpp       build LAM without MPI 2 C++ bindings support"
ac_help="$ac_help
  --with-cxx=CXX          use C++ compiler CXX"
ac_help="$ac_help
  --with-cxxflags=CXXFLAGS use C++ compiler flags CXXFLAGS"
ac_help="$ac_help
  --with-exceptions       enable support for C++ exceptions"
ac_help="$ac_help
  --with-impi             compile with IMPI support (6.4.x only)"
ac_help="$ac_help
  --with-exflags          Specify flags necessary to enable exceptions"
ac_help="$ac_help
  --without-profiling     disable the MPI profiling interface"
ac_help="$ac_help
  --with-trillium         enable installation of Trillium header/man/binary
                          files (not required for MPI)"
ac_help="$ac_help
  --with-ldflags=LDFLAGS  use LD linker flags LDFLAGS"
ac_help="$ac_help
  --with-cxxldflags=CXXLDFLAGS  use C++ LD linker flags CXXLDFLAGS"
ac_help="$ac_help
  --with-fc=FC            use Fortran compiler FC,
                          specify no to disable Fortran support"
ac_help="$ac_help
  --with-fflags=FFLAGS    use Fortran compiler flags FFLAGS"
ac_help="$ac_help
  --with-rpi=RPI          build with RPI comm layer RPI
                          (where RPI=tcp|sysv|usysv|myri|via -- default is tcp)"
ac_help="$ac_help
  --without-shortcircuit  do not short circuit send/receives"
ac_help="$ac_help
  --with-gm=DIR           directory where the gm myrinet was installed"
ac_help="$ac_help
  --with-vialib=LIB       name of the VIPL library to use"
ac_help="$ac_help
  --with-vialibdir=DIR    directory of the VIPL library"
ac_help="$ac_help
  --with-viahdir=DIR      directory of the vipl.h headerfile"
ac_help="$ac_help
  --with-viadev=DEV       device for VIA to use (eg: /dev/clanvi0)"
ac_help="$ac_help
  --with-select-yield     use select to yield"
ac_help="$ac_help
  --with-signal=SIGNAL    use internal signal SIGNAL"
ac_help="$ac_help
  --with-thread           enable thread support in LAM (still experimental)"
ac_help="$ac_help
  --with-pthread-lock     use pthread mutex lock for shared memory pool"
ac_help="$ac_help
  --with-rsh=RSH          use RSH for the remote shell command"
ac_help="$ac_help
  --with-purify           ensure to zero memory before using (see docs)"
ac_help="$ac_help
  --with-tcp-short=BYTES  use BYTES as the size of the longest TCP short 
                          message"
ac_help="$ac_help
  --with-shm-short=BYTES  use BYTES as the size of the longest shared 
                          memory short message"
ac_help="$ac_help
  --with-shm-poolsize=BYTES  make the shared memory pool BYTES in size"
ac_help="$ac_help
  --with-shm-maxalloc=BYTES  make BYTES the maximum allocation from the 
                             shared pool"
ac_help="$ac_help
  --with-lamd-boot=SEC    timeout (seconds) for booted node"
ac_help="$ac_help
  --with-lamd-ack=SEC     seconds until a packet is resent"
ac_help="$ac_help
  --with-lamd-hb=SEC      seconds until heartbeat send to remote lamd"
ac_help="$ac_help
  --enable-static[=PKGS]  build static libraries [default=yes]"
ac_help="$ac_help
  --enable-fast-install[=PKGS]  optimize for fast installation [default=yes]"
ac_help="$ac_help
  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]"
ac_help="$ac_help
  --disable-libtool-lock  avoid locking (might break parallel builds)"

# 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=./share/mpi/init.c

# 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


ac_aux_dir=
for ac_dir in ./config $srcdir/./config; 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 ./config $srcdir/./config" 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.


# Init automake
# Get the version of LAM that we are installing
get_version="sh $srcdir/config/get_lam_version $srcdir"
LAM_VERSION="`eval $get_version --full`"
LAM_MAJOR_VERSION="`eval $get_version --major`"
LAM_MINOR_VERSION="`eval $get_version --minor`"
LAM_RELEASE_VERSION="`eval $get_version --release`"
LAM_ALPHA_VERSION="`eval $get_version --alpha`"
LAM_BETA_VERSION="`eval $get_version --beta`"
cat >> confdefs.h <<EOF
#define LAM_MAJOR_VERSION $LAM_MAJOR_VERSION
EOF

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

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

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

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

cat >> confdefs.h <<EOF
#define LAM_VERSION "$LAM_VERSION"
EOF

# Need to also AC_SUBST these for share/include/patchlevel.h and
# share/include/mpif.h







echo "Configuring LAM version $LAM_VERSION"

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

# 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:687: 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:740: 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:797: 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=lam

VERSION=$LAM_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:836: 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:849: 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:862: 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:875: 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:888: 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






# Make automake clean emacs ~ files for "make clean"

CLEANFILES="*~"


# For debugging

# Check whether --enable-echo or --disable-echo was given.
if test "${enable_echo+set}" = set; then
  enableval="$enable_echo"
  set -x
fi


# This is useful later


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

cat >> confdefs.h <<EOF
#define LAM_ARCH "$host"
EOF


# See if we can find an old installation of LAM to overwrite

if test "x$prefix" = xNONE; then
echo $ac_n "checking for prefix by $ac_c" 1>&6
# Extract the first word of "lamclean", so it can be a program name with args.
set dummy lamclean; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:960: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_LAMCLEAN'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  case "$LAMCLEAN" in
  /*)
  ac_cv_path_LAMCLEAN="$LAMCLEAN" # Let the user override the test with a path.
  ;;
  ?:/*)			 
  ac_cv_path_LAMCLEAN="$LAMCLEAN" # 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_LAMCLEAN="$ac_dir/$ac_word"
      break
    fi
  done
  IFS="$ac_save_ifs"
  ;;
esac
fi
LAMCLEAN="$ac_cv_path_LAMCLEAN"
if test -n "$LAMCLEAN"; then
  echo "$ac_t""$LAMCLEAN" 1>&6
else
  echo "$ac_t""no" 1>&6
fi

  if test -n "$ac_cv_path_LAMCLEAN"; then
    prefix=`echo $ac_cv_path_LAMCLEAN|sed 's%/[^/][^/]*//*[^/][^/]*$%%'`
  fi
fi


# Basic sanity checking; we can't install to a relative path

case "$prefix" in
  /*/bin)
    prefix="`dirname $prefix`"
    echo installing to directory \"$prefix\" 
    ;;
  /*) 
    echo installing to directory \"$prefix\" 
    ;;
  NONE)
    echo installing to directory \"$ac_default_prefix\" 
    ;;
  *) 
    { echo "configure: error: prefix \"$prefix\" must be an absolute directory path" 1>&2; exit 1; } 
    ;;
esac

# check for specification of C compiler
# Check whether --with-cc or --without-cc was given.
if test "${with_cc+set}" = set; then
  withval="$with_cc"
  :
fi


if test -n "$with_cc"; then
    if test $with_cc = yes; then
	{ echo "configure: error: the --with-cc option requires the compiler name" 1>&2; exit 1; }
    fi
    CC=$with_cc;
fi

# check for specification of C compiler flags
# Check whether --with-cflags or --without-cflags was given.
if test "${with_cflags+set}" = set; then
  withval="$with_cflags"
  :
fi


if test -n "$with_cflags"; then
    CFLAGS=$with_cflags;
fi
lam_cflags_save="$CFLAGS"

#
# Part one of libtool magic
# Check all the way up here so that we can complain if shared was
# selected with mpi2c++ or ROMIO
#

# Check whether --enable-shared or --disable-shared was given.
if test "${enable_shared+set}" = set; then
  enableval="$enable_shared"
  p=${PACKAGE-default}
case "$enableval" in
yes) enable_shared=yes ;;
no) enable_shared=no ;;
*)
  enable_shared=no
  # Look at the argument we got.  We use all the common list separators.
  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
  for pkg in $enableval; do
    if test "X$pkg" = "X$p"; then
      enable_shared=yes
    fi
  done
  IFS="$ac_save_ifs"
  ;;
esac
else
  enable_shared=no
fi


#
# ROMIO is now enabled by default
#

echo $ac_n "checking if want ROMIO support""... $ac_c" 1>&6
echo "configure:1079: checking if want ROMIO support" >&5
ROMIO_BUILD_TARGET=
ROMIO_INSTALL_TARGET=
ROMIO_EXAMPLES=
ROMIO_EXTRALIBS=
WANT_ROMIO=yes
# Check whether --with-romio or --without-romio was given.
if test "${with_romio+set}" = set; then
  withval="$with_romio"
  WANT_ROMIO=$withval
fi

echo "$ac_t""$WANT_ROMIO" 1>&6
if test "$WANT_ROMIO" = "yes"; then
    ROMIO_BUILD_TARGET=romio-all
    ROMIO_INSTALL_TARGET=romio-install
    ROMIO_EXAMPLES=romio
    cat >> confdefs.h <<\EOF
#define LAM_WANT_ROMIO 1
EOF

    libs_SAVE="$LIBS"
    echo $ac_n "checking for main in -laio""... $ac_c" 1>&6
echo "configure:1102: checking for main in -laio" >&5
ac_lib_var=`echo aio'_'main | 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="-laio  $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1110 "configure"
#include "confdefs.h"

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

    LIBS="$libs_SAVE"
else
    cat >> confdefs.h <<\EOF
#define LAM_WANT_ROMIO 0
EOF

    cat >> confdefs.h <<\EOF
#define HAVE_LIBAIO 0
EOF

fi




# If we want ROMIO, see if there are any flags to pass through to its
# configure script

ROMIO_USER_FLAGS=
# Check whether --with-romio-flags or --without-romio-flags was given.
if test "${with_romio_flags+set}" = set; then
  withval="$with_romio_flags"
  ROMIO_USER_FLAGS=$withval
fi

# Stoopid emacs mode: '
if test "$WANT_ROMIO" = "yes"; then
    echo $ac_n "checking for user ROMIO flags""... $ac_c" 1>&6
echo "configure:1165: checking for user ROMIO flags" >&5
    if test "$ROMIO_USER_FLAGS" = ""; then
	echo "$ac_t""none" 1>&6
    else
	echo "$ac_t""$ROMIO_USER_FLAGS" 1>&6
    fi
fi


# See if we want the C++ bindings
# If we do not want the C++ bindings, skip all other C++ tests
# (compiler, flags, etc.)
echo $ac_n "checking if want MPI 2 C++ support""... $ac_c" 1>&6
echo "configure:1178: checking if want MPI 2 C++ support" >&5
MPI2CPP_BUILD_TARGET=
MPI2CPP_INSTALL_TARGET=
MPI2CPP_EXAMPLES=
WANT_MPI2CPP=yes
WANT_CPP_EXCEPTIONS=no
MPI2CPP_CONFIGURE_EXFLAGS="--without-exflags"
# Check whether --with-mpi2cpp or --without-mpi2cpp was given.
if test "${with_mpi2cpp+set}" = set; then
  withval="$with_mpi2cpp"
  WANT_MPI2CPP=$withval
fi

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

# check for specification of C++ compiler and C++ compiler flags
# Have to do things a little out of order here; may seem a little strange
# Check whether --with-cxx or --without-cxx was given.
if test "${with_cxx+set}" = set; then
  withval="$with_cxx"
  :
fi

# Check whether --with-cxxflags or --without-cxxflags was given.
if test "${with_cxxflags+set}" = set; then
  withval="$with_cxxflags"
  :
fi

# Check whether --with-exceptions or --without-exceptions was given.
if test "${with_exceptions+set}" = set; then
  withval="$with_exceptions"
  :
fi


if test "$with_mpi2cpp" = "" -o "$with_mpi2cpp" = "yes"; then
    cat >> confdefs.h <<\EOF
#define LAM_WANT_MPI2CPP 1
EOF

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

fi

#
# Now that we know if we want MPI2C++ and/or ROMIO, check if the user
# asked for shared libraries.
#

if test "$WANT_ROMIO" = "yes" -o "$WANT_MPI2CPP" = "yes"; then
    # Ick -- we had to dive into AC_DISABLE_SHARED to figure this out :-(
    if test "$enable_shared" = "yes"; then
	echo "configure: warning: *** Unfortunately, the MPI 2 C++ bindings and ROMIO cannot" 1>&2
	echo "configure: warning: *** cannot be built with shared memory support.  :-(" 1>&2
	echo "configure: warning: *** You must select to only build static libraries," 1>&2
	echo "configure: warning: *** or disable ROMIO and the MPI 2 C++ bindings." 1>&2
	echo "configure: warning: *** See the INSTALL file for details." 1>&2
	{ echo "configure: error: *** Cannot continue." 1>&2; exit 1; }
    fi
fi

# Check if we want IMPI support
# Default: no

WANT_IMPI=no
echo $ac_n "checking if want IMPI support""... $ac_c" 1>&6
echo "configure:1248: checking if want IMPI support" >&5
# Check whether --with-impi or --without-impi was given.
if test "${with_impi+set}" = set; then
  withval="$with_impi"
  WANT_IMPI=$withval
fi



if test "$WANT_IMPI" = "yes"; then
  WANT_IMPI_BUILD_TRUE=
  WANT_IMPI_BUILD_FALSE='#'
else
  WANT_IMPI_BUILD_TRUE='#'
  WANT_IMPI_BUILD_FALSE=
fi
if test "$WANT_IMPI" = "yes"; then
    IMPI_LIB="impi/liblamimpi.la"
    IMPI_DIR="impi"
    IMPID_DIR="impid"
    cat >> confdefs.h <<\EOF
#define LAM_WANT_IMPI 1
EOF

else
    IMPI_LIB=""
    IMPI_DIR=""
    IMPID_DIR=""
    cat >> confdefs.h <<\EOF
#define LAM_WANT_IMPI 0
EOF

fi




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


# Now that we have established whether we want IMPI and/or MPI 2
# C++, we can decide if we want to check for the C++ compiler or not

if test "$WANT_MPI2CPP" = "yes" -o "$WANT_IMPI" = "yes"; then
    if test -n "$with_cxx"; then
	if test $with_cxx = yes; then
	    { echo "configure: error: the --with-cxx option requires the compiler name" 1>&2; exit 1; }
	fi
	CXX="$with_cxx"
    fi

    if test -n "$with_cxxflags"; then
	CXXFLAGS="$with_cxxflags"
    fi
fi
lam_cxxflags_save="$CXXFLAGS"


# Check for compilers
# #$%@#%@# autoconf!!!
lam_cflags_save="$CFLAGS"
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1312: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  if test -n "$CC"; then
  ac_cv_prog_CC="$CC" # 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_CC="gcc"
      break
    fi
  done
  IFS="$ac_save_ifs"
fi
fi
CC="$ac_cv_prog_CC"
if test -n "$CC"; then
  echo "$ac_t""$CC" 1>&6
else
  echo "$ac_t""no" 1>&6
fi

if test -z "$CC"; then
  # Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1342: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  if test -n "$CC"; then
  ac_cv_prog_CC="$CC" # Let the user override the test.
else
  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
  ac_prog_rejected=no
  ac_dummy="$PATH"
  for ac_dir in $ac_dummy; do
    test -z "$ac_dir" && ac_dir=.
    if test -f $ac_dir/$ac_word; then
      if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
        ac_prog_rejected=yes
	continue
      fi
      ac_cv_prog_CC="cc"
      break
    fi
  done
  IFS="$ac_save_ifs"
if test $ac_prog_rejected = yes; then
  # We found a bogon in the path, so make sure we never use it.
  set dummy $ac_cv_prog_CC
  shift
  if test $# -gt 0; then
    # We chose a different compiler from the bogus one.
    # However, it has the same basename, so the bogon will be chosen
    # first if we set CC to just the basename; use the full file name.
    shift
    set dummy "$ac_dir/$ac_word" "$@"
    shift
    ac_cv_prog_CC="$@"
  fi
fi
fi
fi
CC="$ac_cv_prog_CC"
if test -n "$CC"; then
  echo "$ac_t""$CC" 1>&6
else
  echo "$ac_t""no" 1>&6
fi

  if test -z "$CC"; then
    case "`uname -s`" in
    *win32* | *WIN32*)
      # Extract the first word of "cl", so it can be a program name with args.
set dummy cl; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1393: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  if test -n "$CC"; then
  ac_cv_prog_CC="$CC" # 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_CC="cl"
      break
    fi
  done
  IFS="$ac_save_ifs"
fi
fi
CC="$ac_cv_prog_CC"
if test -n "$CC"; then
  echo "$ac_t""$CC" 1>&6
else
  echo "$ac_t""no" 1>&6
fi
 ;;
    esac
  fi
  test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
fi

echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
echo "configure:1425: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5

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

cat > conftest.$ac_ext << EOF

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

main(){return(0);}
EOF
if { (eval echo configure:1441: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  ac_cv_prog_cc_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_cc_cross=no
  else
    ac_cv_prog_cc_cross=yes
  fi
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  ac_cv_prog_cc_works=no
fi
rm -fr conftest*
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

echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
if test $ac_cv_prog_cc_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 ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
echo "configure:1467: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
cross_compiling=$ac_cv_prog_cc_cross

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

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

if test $ac_cv_prog_gcc = yes; then
  GCC=yes
else
  GCC=
fi

ac_test_CFLAGS="${CFLAGS+set}"
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
echo "configure:1500: checking whether ${CC-cc} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  echo 'void f(){}' > conftest.c
if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
  ac_cv_prog_cc_g=yes
else
  ac_cv_prog_cc_g=no
fi
rm -f conftest*

fi

echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
if test "$ac_test_CFLAGS" = set; then
  CFLAGS="$ac_save_CFLAGS"
elif test $ac_cv_prog_cc_g = yes; then
  if test "$GCC" = yes; then
    CFLAGS="-g -O2"
  else
    CFLAGS="-g"
  fi
else
  if test "$GCC" = yes; then
    CFLAGS="-O2"
  else
    CFLAGS=
  fi
fi

BASECC="`basename $CC`"
# Still check for a C++ compiler even if we aren't building the C++
# bindings or IMPI, 'cause we want something to put in hcp.
if test "$CXX" = no; then
    WANT_MPI2CPP=no
    WANT_IMPI=no
    echo "configure: warning: *** C++ compiler is disabled.  Automatically disabling" 1>&2
    echo "configure: warning: *** IMPI and the MPI 2 C++ bindings." 1>&2
else
    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:1545: 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:1577: 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 1588 "configure"
#include "confdefs.h"

int main(){return(0);}
EOF
if { (eval echo configure:1593: \"$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
# 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

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:1619: 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:1624: 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:1633: \"$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:1652: 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

fi
BASECXX="`basename $CXX`"
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
echo "configure:1686: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
  CPP=
fi
if test -z "$CPP"; then
if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
    # This must be in double quotes, not single quotes, because CPP may get
  # substituted into the Makefile and "${CC-cc}" will confuse make.
  CPP="${CC-cc} -E"
  # On the NeXT, cc -E runs the code through the compiler's parser,
  # not just through cpp.
  cat > conftest.$ac_ext <<EOF
#line 1701 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1707: \"$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*
  CPP="${CC-cc} -E -traditional-cpp"
  cat > conftest.$ac_ext <<EOF
#line 1718 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1724: \"$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*
  CPP="${CC-cc} -nologo -E"
  cat > conftest.$ac_ext <<EOF
#line 1735 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1741: \"$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*
  CPP=/lib/cpp
fi
rm -f conftest*
fi
rm -f conftest*
fi
rm -f conftest*
  ac_cv_prog_CPP="$CPP"
fi
  CPP="$ac_cv_prog_CPP"
else
  ac_cv_prog_CPP="$CPP"
fi
echo "$ac_t""$CPP" 1>&6

if test $ac_cv_prog_gcc = yes; then
    echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
echo "configure:1767: checking whether ${CC-cc} needs -traditional" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
    ac_pattern="Autoconf.*'x'"
  cat > conftest.$ac_ext <<EOF
#line 1773 "configure"
#include "confdefs.h"
#include <sgtty.h>
Autoconf TIOCGETP
EOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
  egrep "$ac_pattern" >/dev/null 2>&1; then
  rm -rf conftest*
  ac_cv_prog_gcc_traditional=yes
else
  rm -rf conftest*
  ac_cv_prog_gcc_traditional=no
fi
rm -f conftest*


  if test $ac_cv_prog_gcc_traditional = no; then
    cat > conftest.$ac_ext <<EOF
#line 1791 "configure"
#include "confdefs.h"
#include <termio.h>
Autoconf TCGETA
EOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
  egrep "$ac_pattern" >/dev/null 2>&1; then
  rm -rf conftest*
  ac_cv_prog_gcc_traditional=yes
fi
rm -f conftest*

  fi
fi

echo "$ac_t""$ac_cv_prog_gcc_traditional" 1>&6
  if test $ac_cv_prog_gcc_traditional = yes; then
    CC="$CC -traditional"
  fi
fi

CFLAGS="$lam_cflags_save"
CXXFLAGS="$lam_cxxflags_save"

# Check for C++ things
EXTRA_MPICC_FLAGS=
EXTRA_MPIF77_FLAGS=
EXTRA_MPICPP_FLAGS=
if test "$WANT_MPI2CPP" = "yes" -o "$WANT_IMPI" = "yes"; then
    if test "$CXX" = "no"; then
	{ echo "configure: error: Cannot install MPI 2 C++ bindings without a C++ compiler" 1>&2; exit 1; }
    else
	if test "$WANT_MPI2CPP" = "yes"; then
	    MPI2CPP_BUILD_TARGET=mpi2c++-all
	    MPI2CPP_INSTALL_TARGET=mpi2c++-install
	    MPI2CPP_EXAMPLES=mpi2c++
	fi
    fi

    if test "$WANT_IMPI" = "yes"; then
	
#
# Arguments: prefix (optional)
#
# Depdendencies: None
#
# Check to see if the C++ compiler has std::nothrow support for new
# and new[]
#
# Defines prefix_CXX_NOTHROW_NEW_ARG to be either "(std::nothrow)" or ""
# Defines prefix_CXX_NOTHROW_NEW to be either 1 or 0
# Sets prefix_CXX_NOTHROW_NEW to be 1 or 0
#

# Figure out what prefix to use
lsc_prefix="LAM"
if test "$lsc_prefix" = ""; then
    lsc_prefix="LSC"
fi

# Do the rest
if test "$?CXXFLAGS" = 0; then
    CXXFLAGS=""
fi
echo $ac_n "checking whether $CXX has new(std::nothrow)""... $ac_c" 1>&6
echo "configure:1856: checking whether $CXX has new(std::nothrow)" >&5
rm -f conftest.cc conftest.o
cat > conftest.cc <<EOF
#include <new>

int main(int argc, char* argv) {
  int *baz;
  unsigned int foo = 3;
  baz = new(std::nothrow) int;
  baz = new(std::nothrow) int[foo - 1];
}
EOF
echo configure:1868: $CXX $CXXFLAGS conftest.cc -o conftest >&5 
$CXX $CXXFLAGS conftest.cc -o conftest >&5 2>&5
if test -f conftest; then
    lsc_result=1
    lsc_define="(std::nothrow)"
    echo "$ac_t""yes" 1>&6
else
    echo configure:1875: here is the program that failed: >&5
    cat conftest.cc >&5
    lsc_result=0
    lsc_define=""
    echo "$ac_t""no" 1>&6
fi

# Set the result
lsc_name="${lsc_prefix}_CXX_NOTHROW_NEW"
lsc_str="${lsc_name}=$lsc_result"
eval $lsc_str
cat >> confdefs.h <<EOF
#define $lsc_name $lsc_result
EOF

lsc_name="${lsc_prefix}_CXX_NOTHROW_NEW_ARG"
cat >> confdefs.h <<EOF
#define $lsc_name $lsc_define
EOF


# Clean up
rm -f conftest*
unset lsc_prefix lsc_result lsc_define lsc_name lsc_str
    fi

    # Both IMPI and the C++ bindings require proper exception handling
    if test "$with_exceptions" = "yes"; then
	WANT_CPPEXCEPTIONS=1
    else
	WANT_CPPEXCEPTIONS=0
    fi

    if test "$WANT_CPPEXCEPTIONS" = "1"; then
	
#
# Arguments: prefix (optional)
#
# Depdencies: None
#
# Check to see if the C++ compiler can handle exceptions 
#
# Sets prefix_CXX_EXCEPTIONS to 1 if compiler has exceptions, 0 if not
#

# Figure out what prefix to use
lsc_prefix="LAM"
if test "$lsc_prefix" = ""; then
    lsc_prefix="LSC"
fi

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

int main() {
int i=1; throw(i);
; return 0; }
EOF
if { (eval echo configure:1944: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  rm -rf conftest*
  lsc_result=1
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  lsc_result=1
fi
rm -f conftest*
if test "$lsc_result" = "1"; then
    echo "$ac_t""yes" 1>&6
else
    echo "$ac_t""no" 1>&6
fi

# Set the result
lsc_name="${lsc_prefix}_CXX_EXCEPTIONS"
lsc_str="${lsc_name}=$lsc_result"
eval $lsc_str

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

unset lsc_prefix lsc_result lsc_name lsc_str
	if test "$LAM_CXX_HAS_EXCEPTIONS" = "1"; then
	    
#
# Arguments: prefix (optional)
#
# Dependencies: none
#
# Get the exception handling flags for the C++ compiler.  Leaves
# CXXFLAGS undisturbed.
# Provides --with-exflags command line argument for configure as well.
#
# Sets prefix_CXX_EXCEPTION_CXXFLAGS and prefix_CXX_EXCEPTION_LDFLAGS as
# appropriate.
# Must call AC_SUBST manually
#

# Figure out what prefix to use
lsc_mpi_prefix="LAM"
if test "$lsc_mpi_prefix" = ""; then
    lsc_mpi_prefix="LSC"
fi

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


lsc_CXXFLAGS_SAVE="$CXXFLAGS"
echo $ac_n "checking for compiler exception flags""... $ac_c" 1>&6
echo "configure:2006: checking for compiler exception flags" >&5
if test "$lsc_force_exflags" != ""; then
    lsc_exflags="$lsc_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 2021 "configure"
#include "confdefs.h"

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

    if test "$lsc_happy" = "1"; then
	lsc_exflags="-fexceptions";
    else
	CXXFLAGS="$CXXFLAGS_SAVE -fhandle-exceptions"
	cat > conftest.$ac_ext <<EOF
#line 2044 "configure"
#include "confdefs.h"

int main() {
try { int i = 0; } catch(...) { int j = 2; }
; return 0; }
EOF
if { (eval echo configure:2051: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  rm -rf conftest*
  lsc_happy=1
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  lsc_happy=0
fi
rm -f conftest*
	if test "$lsc_happy" = "1"; then
	    lsc_exflags="-fhandle-exceptions";
	fi
    fi
    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

elif test "`basename $CXX`" = "KCC" -o "`basename $LAMHCP`" = "KCC"; then
    lsc_exflags="--exceptions"
fi
CXXFLAGS="$lsc_CXXFLAGS_SAVE"

# Save the result
lsc_name="${lsc_prefix}_CXX_EXCEPTION_CXXFLAGS"
lsc_str=${lsc_name}=\"$lsc_exflags\""
eval $lsc_str
lsc_name="${lsc_prefix}_CXX_EXCEPTION_LDFLAGS"
lsc_str=${lsc_name}=\"$lsc_exflags\""
eval $lsc_str
if test "$lsc_exflags" = ""; then
    echo "$ac_t""none necessary" 1>&6
else
    echo "$ac_t""$lsc_exflags" 1>&6
fi

# Clean up
unset lsc_prefix lsc_force_exflags lsc_CXXFLAGS_SAVE lsc_exflags lsc_happy \
    lsc_name lsc_str
	    CFLAGS="$CFLAGS $LAM_CXX_EXCEPTION_CXXFLAGS"
	    FFLAGS="$FFLAGS $LAM_CXX_EXCEPTION_CFLAGS"
	    CXXFLAGS="$CXXFLAGS $LAM_CXX_EXCEPTION_CXXFLAGS"
	    MPI2CPP_CONFIGURE_EXFLAGS="--with-exflags=\"$LAM_CXX_EXCEPTION_CXXFLAGS\""
	    LDFLAGS="$LDFLAGS $LAM_CXX_EXCEPTION_LDFLAGS"

	    EXTRA_MPICC_FLAGS="$LAM_CXX_EXCEPTION_CXXFLAGS"
	    EXTRA_MPIF77_FLAGS="$LAM_CXX_EXCEPTION_CXXFLAGS"
	    EXTRA_MPICPP_FLAGS="$LAM_CXX_EXCEPTION_CXXFLAGS"
	fi
    fi
    echo $ac_n "checking how to run the C++ preprocessor""... $ac_c" 1>&6
echo "configure:2105: 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 2118 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:2123: \"$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
# 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
fi
fi
CXXCPP="$ac_cv_prog_CXXCPP"
echo "$ac_t""$CXXCPP" 1>&6

    if test "$WANT_IMPI" = "yes"; then
	
#
# Arguments: prefix (optional)
#
# Dependencies: None
#
# See if the C++ compiler has STL
#
# Set prefix_CXX_STL and LSC_CXX_STL to 1 if so, 0 if not
# AC_DEFINE prefix_CXX_STL to 1 if so, 0 if not
#

# Figure out what prefix to use
lsc_prefix="LAM"
if test "$lsc_prefix" = ""; then
    lsc_prefix="LSC"
fi

# Do the test

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:2177: 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 2182 "configure"
#include "confdefs.h"
#include <map>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:2187: \"$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


# Set the result
lsc_name="${lsc_prefix}_CXX_STL"
lsc_str="${lsc_name}=$LSC_CXX_STL"
eval $lsc_str
cat >> confdefs.h <<EOF
#define $lsc_name $LSC_CXX_STL
EOF


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

unset lsc_prefix lsc_str lsc_name
	if test "$LAM_CXX_STL" = "0"; then
	    echo "configure: warning: *** Your C++ compiler does not seem to support the STL." 1>&2
	    echo "configure: warning: *** STL support is necessary to compile the IMPI extensions" 1>&2
	    echo "configure: warning: *** to LAM/MPI.  Either choose a C++ compiler that supports" 1>&2
	    echo "configure: warning: *** STL, or configure --without-impi." 1>&2
	    { echo "configure: error: cannot continue" 1>&2; exit 1; }
	fi
	
#
# Arguments: prefix (optional)
#
# Dependencies: None
#
# See if the compiler makes template repository directories
# Warning: this is a really screwy example! -JMS
#
# Sets prefix_CXX_TEMPLATE_REPOSITORY and LSC_CXX_TEMPLATE_REPOSITORY
# to the template repository, or blank.
# Must call AC_SUBST manually
#

# Figure out what prefix to use
lsc_prefix="LAM"
if test "$lsc_prefix" = ""; then
    lsc_prefix="LSC"
fi

# Find the repository
echo $ac_n "checking for C++ template repository directory""... $ac_c" 1>&6
echo "configure:2257: checking for C++ 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

lsc_template_failed=
echo configure:2315: $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:2319: here is the program that failed: >&5
    cat conftest1.C >&5
    echo configure:2321: here is conftest.h: >&5
    cat conftest.h >&5
    lsc_template_failed=1
else
    echo configure:2325: $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:2329: here is the program that failed: >&5
	cat conftest2.C >&5
	echo configure:2331: here is conftest.h: >&5
	cat conftest.h >&5
    else
	rm -rf conftest*

	for lsc_file in `ls`
	do
	    if test "$lsc_file" != "." -a "$lsc_file" != ".."; then
		# Is it a directory?
		if test -d "$lsc_file"; then
		    lsc_template_dir="$lsc_file $lsc_template_dir"
		    
		# Or is it a file?
		else
		    name="`echo $lsc_file | cut -d. -f1`"
		    
		    temp_mask=
		    if test "$name" = "main" -o "$name" = "other"; then
			temp_mask="`echo $lsc_file | cut -d. -f2`"
			if test "$lsc_template_filemask" = ""; then
			lsc_template_filemask="$temp_mask";
			elif test "`echo $lsc_template_filemask | grep $temp_mask`" = ""; then
			lsc_template_filemask="$lsc_template_filemask $temp_mask"
			fi
		    fi
		fi
	    fi
	done
	if test "$lsc_template_filemask" != ""; then
	    temp_mask=
	    for mask in $lsc_template_filemask
	    do
		temp_mask="*.$mask $temp_mask"
	    done
	    lsc_template_filemask=$temp_mask
	fi
    fi
fi
LSC_CXX_TEMPLATE_REPOSITORY="$lsc_template_dir $lsc_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_$$

# Set the result
lsc_name="${lsc_prefix}_CXX_TEMPLATE_REPOSITORY"
lsc_str="${lsc_name}=\"$LSC_CXX_TEMPLATE_REPOSITORY\""
eval $lsc_str

# Clean up
unset lsc_prefix lsc_file lsc_template_failed lsc_template_dir \
    lsc_name lsc_str
	
#
# Arguments: prefix (optional)
#
# Dependencies: None
#
# Check to see if the C++ compiler has the bool type.  <sigh>
#
# Defines prefix_CXX_BOOL to be 1 or 0
# Sets prefix_CXX_BOOL to be 1 or 0
#

# Figure out what prefix to use
lsc_prefix="LAM"
if test "$lsc_prefix" = ""; then
    lsc_prefix="LSC"
fi

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

int main(int argc, char* argv) {
  bool foo = (bool) 0;
  printf("so foo is used and the compiler wont complain: %d", (int) foo);
  return 0;
}
EOF
echo configure:2422: $CXX $CXXFLAGS conftest.cc -o conftest >&5 
$CXX $CXXFLAGS conftest.cc -o conftest >&5 2>&5
if test -f conftest; then
    lsc_result=1
    echo "$ac_t""yes" 1>&6
else
    echo configure:2428: here is the program that failed: >&5
    cat conftest.cc >&5
    lsc_result_CXX_BOOL=0
    echo "$ac_t""no" 1>&6
fi

# Set the results
lsc_name="${lsc_prefix}_CXX_BOOL"
lsc_str="${lsc_name}=$lsc_result"
eval $lsc_str
cat >> confdefs.h <<EOF
#define $lsc_name $lsc_result
EOF


# Clean up
rm -f conftest*
unset lsc_prefix lsc_name lsc_str lsc_result
	
#
# Arguments: prefix (optional)
#
# Dependencies: None
#
# Check to see if the C++ compiler has "true" and "false" defined.  <sigh>
#
# Defines LSC_CXX_TRUE_FALSE to be 1 or 0
#

# Figure out what prefix to use
lsc_prefix="LAM"
if test "$lsc_prefix" = ""; then
    lsc_prefix="LSC"
fi

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

int main(int argc, char* argv) {
  int foo;
  foo = (int) true;
  foo = (int) false;
  printf("so foo is used and the compiler wont complain: %d", (int) foo);
  return 0;
}
EOF
echo configure:2482: $CXX $CXXFLAGS conftest.cc -o conftest >&5 
$CXX $CXXFLAGS conftest.cc -o conftest >&5 2>&5
if test -f conftest; then
    lsc_result=1
    echo "$ac_t""yes" 1>&6
else
    lsc_result=0
    echo configure:2489: here is the program that failed: >&5
    cat conftest.cc >&5
    echo "$ac_t""no" 1>&6
fi

# Set the result
lsc_name="${lsc_prefix}_CXX_TRUE_FALSE"
cat >> confdefs.h <<EOF
#define $lsc_name $lsc_result
EOF


# Clean up
rm -f conftest*
unset lsc_prefix lsc_name lsc_str lsc_result
    fi

    case "$host" in
    *hpux*)
	if test "$BASECXX" = "CC"; then
	    echo "configure: warning: *** You will probably have problems compiling the MPI 2" 1>&2
	    echo "configure: warning: *** C++ bindings with the CC compiler.  You should probably" 1>&2
	    echo "configure: warning: *** be using the aCC compiler.  Set the CXX environment" 1>&2
	    echo "configure: warning: *** variable to "aCC" and run ./configure again." 1>&2
	fi
	;;
    esac
fi










cat >> confdefs.h <<EOF
#define LAM_CC "$CC"
EOF


#
# If we are building IMPI, look for "impi-server" in the path so that
# we can build it into mpirun
#

if test "$WANT_IMPI" = "yes"; then
    # Extract the first word of "impi-server", so it can be a program name with args.
set dummy impi-server; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:2541: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_IMPI_SERVER'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  if test -n "$IMPI_SERVER"; then
  ac_cv_prog_IMPI_SERVER="$IMPI_SERVER" # 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_IMPI_SERVER="impi-server"
      break
    fi
  done
  IFS="$ac_save_ifs"
  test -z "$ac_cv_prog_IMPI_SERVER" && ac_cv_prog_IMPI_SERVER="not found"
fi
fi
IMPI_SERVER="$ac_cv_prog_IMPI_SERVER"
if test -n "$IMPI_SERVER"; then
  echo "$ac_t""$IMPI_SERVER" 1>&6
else
  echo "$ac_t""no" 1>&6
fi

    if test "$IMPI_SERVER" = "not found"; then
	echo "configure: warning: *** Not able to find the executable 'impi-server' in" 1>&2
	echo "configure: warning: *** your path.  The '-server' option will be disabled" 1>&2
	echo "configure: warning: *** in mpirun.  To run IMPI jobs, you will need to run" 1>&2
	echo "configure: warning: *** the IMPI server independantly of LAM's mpirun." 1>&2
	# Stoopid emacs mode: '
	cat >> confdefs.h <<\EOF
#define LAM_WANT_IMPI_SERVER 0
EOF

	cat >> confdefs.h <<\EOF
#define LAM_IMPI_SERVER ""
EOF

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

	cat >> confdefs.h <<EOF
#define LAM_IMPI_SERVER "$IMPI_SERVER"
EOF

    fi
fi

#
# Do we want the profiling interface?  The default is now yes.  Woof!
#

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

if test -n "$with_profiling"; then
    WANT_PROFILE="$with_profiling"
fi
echo $ac_n "checking if want profiling interface""... $ac_c" 1>&6
echo "configure:2609: checking if want profiling interface" >&5


if test "$WANT_PROFILE" = "yes"; then
  WANT_PROFILE_BUILD_TRUE=
  WANT_PROFILE_BUILD_FALSE='#'
else
  WANT_PROFILE_BUILD_TRUE='#'
  WANT_PROFILE_BUILD_FALSE=
fi
echo "$ac_t""$WANT_PROFILE" 1>&6
if test "$WANT_ROMIO" = "yes" -a "$WANT_PROFILE" = "no"; then
    echo "configure: warning: *** You have selected to build ROMIO and not use the" 1>&2
    echo "configure: warning: *** MPI profiling interface.  This is not currently" 1>&2
    echo "configure: warning: *** supported.  You can either select --without-romio," 1>&2
    echo "configure: warning: *** or build the profiling interface.  Sorry." 1>&2
    { echo "configure: error: Cannot continue" 1>&2; exit 1; }
fi
if test "$WANT_PROFILE" = "yes"; then
    cat >> confdefs.h <<\EOF
#define LAM_WANT_PROFILE 1
EOF

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

fi

# check if we want all the trillium header files and man pages installed
WANT_TRILLIUM=no
# Check whether --with-trillium or --without-trillium was given.
if test "${with_trillium+set}" = set; then
  withval="$with_trillium"
  :
fi

if test -n "$with_trillium"; then
    WANT_TRILLIUM="$with_trillium"
fi
echo $ac_n "checking if want full installation of Trillium files""... $ac_c" 1>&6
echo "configure:2651: checking if want full installation of Trillium files" >&5


if test "$WANT_TRILLIUM" = "yes"; then
  WANT_TRILLIUM_INSTALL_TRUE=
  WANT_TRILLIUM_INSTALL_FALSE='#'
else
  WANT_TRILLIUM_INSTALL_TRUE='#'
  WANT_TRILLIUM_INSTALL_FALSE=
fi
echo "$ac_t""$WANT_TRILLIUM" 1>&6

# check for specification of LD linker flags
# Check whether --with-ldflags or --without-ldflags was given.
if test "${with_ldflags+set}" = set; then
  withval="$with_ldflags"
  :
fi


if test -n "$with_ldflags"; then
    USER_LDFLAGS="$with_ldflags"
else
    USER_LDFLAGS="$CFLAGS"
fi

# check for specification of C++ LD linker flags
# Check whether --with-ldflags or --without-ldflags was given.
if test "${with_ldflags+set}" = set; then
  withval="$with_ldflags"
  :
fi


if test -n "$with_cxxldflags"; then
    USER_CXXLDFLAGS="$with_cxxldflags"
else
    USER_CXXLDFLAGS="$CXXFLAGS"
fi

# check for specification of fortran compiler
# Check whether --with-fc or --without-fc was given.
if test "${with_fc+set}" = set; then
  withval="$with_fc"
  :
fi


if test -n "$with_fc"; then
    if test "$with_fc" != no; then
	FC="$with_fc"
    fi
fi

# check for specification of Fortran compiler flags
# Check whether --with-fflags or --without-fflags was given.
if test "${with_fflags+set}" = set; then
  withval="$with_fflags"
  :
fi


if test -n "$with_fflags"; then
    FFLAGS="$with_fflags"
fi

#
# Check for "makedepend".  Not everyone has this.
#

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:2726: 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"


#
# If they have makedepend, find some additional dependency directories
#

LAM_DEPDIRS=
if test "$MAKEDEPEND" != "no"; then
    if test "$WANT_IMPI" = "yes"; then
	
#
# Arguments: prefix (optional)
#
# Dependencies: os_find_depdirs.m4
#               cxx_have_stl.m4
#
# 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 already.
#
# Sets prefix_CXX_DEPDIRS to "-Idir1 -Idir2..." or blank
# Must call AC_SUBST manually.
#

# Figure out what prefix to use
lsc_cxx_prefix="LAM"
if test "$lsc_cxx_prefix" = ""; then
    lsc_cxx_prefix="LSC"
fi

# First we need to see if we need to check for STL
if test "$LSC_CXX_STL" = ""; then
    
#
# Arguments: prefix (optional)
#
# Dependencies: None
#
# See if the C++ compiler has STL
#
# Set prefix_CXX_STL and LSC_CXX_STL to 1 if so, 0 if not
# AC_DEFINE prefix_CXX_STL to 1 if so, 0 if not
#

# Figure out what prefix to use
lsc_prefix=""
if test "$lsc_prefix" = ""; then
    lsc_prefix="LSC"
fi

# Do the test

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:2816: 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 2821 "configure"
#include "confdefs.h"
#include <map>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:2826: \"$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


# Set the result
lsc_name="${lsc_prefix}_CXX_STL"
lsc_str="${lsc_name}=$LSC_CXX_STL"
eval $lsc_str
cat >> confdefs.h <<EOF
#define $lsc_name $LSC_CXX_STL
EOF


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

unset lsc_prefix lsc_str lsc_name
fi

# No go look

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

lsc_temp="iostream.h new stdarg.h"
if test "$LSC_CXX_STL" = "1"; then
    lsc_temp="$lsc_temp map"
fi

echo $ac_n "checking for C++ include directories""... $ac_c" 1>&6
echo "configure:2884: checking for C++ include directories" >&5

#
# Arguments: list of .h files to include
#            prefix (optional)
#
# Dependencies: None
#
# Looks for the include directories necessary for a compiler
#
# Will call AC_PROG_CPP or AC_PROG_CXXCPP if it has not been 
# called already (depending on autoconf's current language)
#
# Sets prefix_OS_DEPDIRS to "-Idir1 -Idir2..." or blank
# Need to call AC_SUBST manually
#

# Get list of #include's
lsc_includes="$lsc_temp"

# Figure out what prefix to use
lsc_prefix="lsc_internal"
if test "$lsc_prefix" = ""; then
    lsc_prefix="LSC"
fi

# Get what language autoconf is currently set for; get the right
# preprocessor and flags
if test "$ac_ext" = "c"; then
    if test "$?CPP" = "0" -o "`echo $CPP`" = ""; then
	echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
echo "configure:2915: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
  CPP=
fi
if test -z "$CPP"; then
if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
    # This must be in double quotes, not single quotes, because CPP may get
  # substituted into the Makefile and "${CC-cc}" will confuse make.
  CPP="${CC-cc} -E"
  # On the NeXT, cc -E runs the code through the compiler's parser,
  # not just through cpp.
  cat > conftest.$ac_ext <<EOF
#line 2930 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:2936: \"$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*
  CPP="${CC-cc} -E -traditional-cpp"
  cat > conftest.$ac_ext <<EOF
#line 2947 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:2953: \"$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*
  CPP="${CC-cc} -nologo -E"
  cat > conftest.$ac_ext <<EOF
#line 2964 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:2970: \"$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*
  CPP=/lib/cpp
fi
rm -f conftest*
fi
rm -f conftest*
fi
rm -f conftest*
  ac_cv_prog_CPP="$CPP"
fi
  CPP="$ac_cv_prog_CPP"
else
  ac_cv_prog_CPP="$CPP"
fi
echo "$ac_t""$CPP" 1>&6

    fi
    lsc_cpp="$CPP"
elif test "$ac_ext" = "C"; then
    if test "$?CXXCPP" = "0" -o "`echo $CXXCPP`" = ""; then
	echo $ac_n "checking how to run the C++ preprocessor""... $ac_c" 1>&6
echo "configure:2999: 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 3012 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:3017: \"$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
    lsc_cpp="$CXXCPP"
else
    echo "configure: warning: autoconf is set for a language that OS_FIND_DEPDIRS" 1>&2
    echo "configure: warning: does not understand." 1>&2
    { echo "configure: error: cannot continue." 1>&2; exit 1; }
fi

# Look for the include dependencies
for lsc_file in $lsc_includes ; do
    echo '#include <'$lsc_file'>' >> conftest.$ac_ext
done
cat >> conftest.$ac_ext <<EOF

int main(int argc, char* argv) { return 0; }
EOF

# Preprocess and parse
echo 'configure:3059: '$lsc_cpp conftest.$ac_ext' | lots of ugly grepping' >&5
$lsc_cpp conftest.$ac_ext | grep '^#.*\"' | grep -v '^#pragma' | \
    grep -v '^#ident' | sed -e 's/#.*\"\(.*\)\".*$/\1/' | \
    sort -u - | grep -v conftest.$ac_ext > conftest.out 2>&5
lsc_temp=
rm -f conftest2.out
touch conftest2.out

# Strip the directory names
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

# Build up the -I list
lsc_depdirs=
for lsc_dir in `sort -u conftest2.out | uniq`; do
    lsc_pwd="`pwd`"
    cd "$lsc_dir"
    lsc_real_dir="`pwd`"
    cd "$lsc_pwd"

    for lsc_file in $lsc_includes; do
	if test -f $lsc_real_dir/$lsc_file -a \
	    "`echo $lsc_depdirs | grep $lsc_real_dir`" = ""; then
	    lsc_depdirs="-I$lsc_real_dir $lsc_depdirs"
	fi
    done
done
lsc_name="${lsc_prefix}_OS_DEPDIRS"
lsc_str="${lsc_name}=\"$lsc_depdirs\""
eval $lsc_str

# Clean up
rm -f conftest*
unset lsc_cpp lsc_temp lsc_temp2 lsc_prefix lsc_str lsc_dir lsc_name \
    lsc_file lsc_depdirs lsc_includes lsc_pwd lsc_real_dir
echo "$ac_t""$lsc_internal_OS_DEPDIRS" 1>&6
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


# Save results
lsc_name="${lsc_cxx_prefix}_CXX_DEPDIRS"
lsc_str="${lsc_name}=\"$lsc_internal_OS_DEPDIRS\""
eval $lsc_str

# Clean up
unset lsc_cxx_prefix lsc_name lsc_internal_OS_DEPDIRS lsc_str
    fi

    # Because linux tends to put stddef.h in weird places
    STDDEF=
    for ac_hdr in stddef.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:3123: checking for $ac_hdr" >&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 3128 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:3133: \"$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
    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
  cat >> confdefs.h <<EOF
#define $ac_tr_hdr 1
EOF
 STDDEF=stddef.h
else
  echo "$ac_t""no" 1>&6
fi
done

    echo $ac_n "checking for non-standard include directories""... $ac_c" 1>&6
echo "configure:3160: checking for non-standard include directories" >&5

    # Ensure that we have what we need for the normals, just in case...
    
#
# Arguments: list of .h files to include
#            prefix (optional)
#
# Dependencies: None
#
# Looks for the include directories necessary for a compiler
#
# Will call AC_PROG_CPP or AC_PROG_CXXCPP if it has not been 
# called already (depending on autoconf's current language)
#
# Sets prefix_OS_DEPDIRS to "-Idir1 -Idir2..." or blank
# Need to call AC_SUBST manually
#

# Get list of #include's
lsc_includes="stdio.h stdlib.h $STDDEF"

# Figure out what prefix to use
lsc_prefix="LAM"
if test "$lsc_prefix" = ""; then
    lsc_prefix="LSC"
fi

# Get what language autoconf is currently set for; get the right
# preprocessor and flags
if test "$ac_ext" = "c"; then
    if test "$?CPP" = "0" -o "`echo $CPP`" = ""; then
	echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
echo "configure:3193: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
  CPP=
fi
if test -z "$CPP"; then
if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
    # This must be in double quotes, not single quotes, because CPP may get
  # substituted into the Makefile and "${CC-cc}" will confuse make.
  CPP="${CC-cc} -E"
  # On the NeXT, cc -E runs the code through the compiler's parser,
  # not just through cpp.
  cat > conftest.$ac_ext <<EOF
#line 3208 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:3214: \"$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*
  CPP="${CC-cc} -E -traditional-cpp"
  cat > conftest.$ac_ext <<EOF
#line 3225 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:3231: \"$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*
  CPP="${CC-cc} -nologo -E"
  cat > conftest.$ac_ext <<EOF
#line 3242 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:3248: \"$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*
  CPP=/lib/cpp
fi
rm -f conftest*
fi
rm -f conftest*
fi
rm -f conftest*
  ac_cv_prog_CPP="$CPP"
fi
  CPP="$ac_cv_prog_CPP"
else
  ac_cv_prog_CPP="$CPP"
fi
echo "$ac_t""$CPP" 1>&6

    fi
    lsc_cpp="$CPP"
elif test "$ac_ext" = "C"; then
    if test "$?CXXCPP" = "0" -o "`echo $CXXCPP`" = ""; then
	echo $ac_n "checking how to run the C++ preprocessor""... $ac_c" 1>&6
echo "configure:3277: 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 3290 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:3295: \"$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
# 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
fi
fi
CXXCPP="$ac_cv_prog_CXXCPP"
echo "$ac_t""$CXXCPP" 1>&6

    fi
    lsc_cpp="$CXXCPP"
else
    echo "configure: warning: autoconf is set for a language that OS_FIND_DEPDIRS" 1>&2
    echo "configure: warning: does not understand." 1>&2
    { echo "configure: error: cannot continue." 1>&2; exit 1; }
fi

# Look for the include dependencies
for lsc_file in $lsc_includes ; do
    echo '#include <'$lsc_file'>' >> conftest.$ac_ext
done
cat >> conftest.$ac_ext <<EOF

int main(int argc, char* argv) { return 0; }
EOF

# Preprocess and parse
echo 'configure:3337: '$lsc_cpp conftest.$ac_ext' | lots of ugly grepping' >&5
$lsc_cpp conftest.$ac_ext | grep '^#.*\"' | grep -v '^#pragma' | \
    grep -v '^#ident' | sed -e 's/#.*\"\(.*\)\".*$/\1/' | \
    sort -u - | grep -v conftest.$ac_ext > conftest.out 2>&5
lsc_temp=
rm -f conftest2.out
touch conftest2.out

# Strip the directory names
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

# Build up the -I list
lsc_depdirs=
for lsc_dir in `sort -u conftest2.out | uniq`; do
    lsc_pwd="`pwd`"
    cd "$lsc_dir"
    lsc_real_dir="`pwd`"
    cd "$lsc_pwd"

    for lsc_file in $lsc_includes; do
	if test -f $lsc_real_dir/$lsc_file -a \
	    "`echo $lsc_depdirs | grep $lsc_real_dir`" = ""; then
	    lsc_depdirs="-I$lsc_real_dir $lsc_depdirs"
	fi
    done
done
lsc_name="${lsc_prefix}_OS_DEPDIRS"
lsc_str="${lsc_name}=\"$lsc_depdirs\""
eval $lsc_str

# Clean up
rm -f conftest*
unset lsc_cpp lsc_temp lsc_temp2 lsc_prefix lsc_str lsc_dir lsc_name \
    lsc_file lsc_depdirs lsc_includes lsc_pwd lsc_real_dir
    echo "$ac_t""$LAM_OS_DEPDIRS" 1>&6
    LAM_DEPDIRS="$LAM_CXX_DEPDIRS $LAM_OS_DEPDIRS"
fi


# determine RPI to use
# Check whether --with-rpi or --without-rpi was given.
if test "${with_rpi+set}" = set; then
  withval="$with_rpi"
  :
fi


SYSLIBS="$ROMIO_EXTRALIBS"

# Check for -lsocket -lnsl

libs_SAVE="$LIBS"
echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6
echo "configure:3396: checking for socket in -lsocket" >&5
ac_lib_var=`echo socket'_'socket | 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 3404 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error.  */
/* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
char socket();

int main() {
socket()
; return 0; }
EOF
if { (eval echo configure:3415: \"$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
  SYSLIBS="$SYSLIBS -lsocket"
else
  echo "$ac_t""no" 1>&6
fi

echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
echo "configure:3436: checking for gethostbyname in -lnsl" >&5
ac_lib_var=`echo nsl'_'gethostbyname | 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 3444 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error.  */
/* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
char gethostbyname();

int main() {
gethostbyname()
; return 0; }
EOF
if { (eval echo configure:3455: \"$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
  SYSLIBS="$SYSLIBS -lnsl"
else
  echo "$ac_t""no" 1>&6
fi

LIBS="$libs_SAVE"

# OS particular things

case $host in
*irix*) 
    if test "$ac_cv_prog_gcc" = no; then
	LIBBIND="$USER_LDFLAGS -Wl,-woff,84"
	HBIND="$USER_LDFLAGS -Wl,-woff,84"
    fi	
    ;;
*sco-sysv*)
    # This seems to be necessary on SCO unix to get sendmsg and others
    # to compile/link/run properly.  There's a note in
    # /usr/include/socket.h on SCO about this.  Weird.
    CFLAGS="-DSVR4 $CFLAGS"
esac

#
# See if we have SysV semaphores (not all Unixes do *cough* MacOS X
# *cough*).  This must be before the RPI selection logic, as we need to
# abort if the user chooses rpi=SYSV and we don't have SysV semaphores.
#

LAM_HAVE_SYSV_SEMAPHORES=0
for ac_hdr in sys/sem.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:3504: checking for $ac_hdr" >&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 3509 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:3514: \"$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
    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
  cat >> confdefs.h <<EOF
#define $ac_tr_hdr 1
EOF
 LAM_HAVE_SYSV_SEMAPHORES=1
else
  echo "$ac_t""no" 1>&6
LAM_HAVE_SYSV_SEMAPHORES=0
fi
done

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


# Determine the RPI to use
LAM_RPI_REAL_CFLAGS="\"\""
LAM_RPI_REAL_LDFLAGS="\"\""
LAM_RPI_FAKE_CFLAGS=
LAM_RPI_FAKE_LDFLAGS=
echo $ac_n "checking which RPI to use""... $ac_c" 1>&6
echo "configure:3552: checking which RPI to use" >&5
if test -z "$with_rpi"; then
  echo "$ac_t""tcp (default)" 1>&6
  rpi=tcp
else
  if test "$with_rpi" = yes; then
    echo "$ac_t""tcp (default)" 1>&6
    rpi=tcp
  else
    rpi=$with_rpi

    if test "$LAM_HAVE_SYSV_SEMAPHORES" = "0"; then
	if test "rpi" = "sysv" -o "rpi" = "usysv"; then
	    echo "configure: warning: *** SYSV or USYSV rpi selected on a machine without" 1>&2
	    echo "configure: warning: *** SysV semaphores.  Please select another RPI." 1>&2
	    { echo "configure: error: *** Cannot continue." 1>&2; exit 1; }
	fi
    fi

    if test "$rpi" = "sysv" -o "$rpi" = "usysv" -o "$rpi" = "tcp"; then
      echo "$ac_t""$rpi" 1>&6

    # Put some cleverness here so that we can work on the myri and VIA
    # RPIs in the development tree, but make it unavailable in the
    # distribution 'till we're ready.

    # BE SURE TO UPDATE THE distscript.csh WHEN THESE RPI's ARE READY!!

    elif test "$rpi" = "myri"; then
      if test -f $srcdir/share/rpi/myri/myri.c; then
        echo "$ac_t""$rpi" 1>&6
      else
	echo "$ac_t""Doh!" 1>&6
        { echo "configure: error: Sorry, the $rpi RPI is Not Yet Ready for Prime Time." 1>&2; exit 1; }
      fi
    elif test "$rpi" = "via"; then
      if test -f $srcdir/share/rpi/via/Makefile.am; then
        echo "$ac_t""$rpi" 1>&6
      else
	echo "$ac_t""Doh!" 1>&6
        { echo "configure: error: Sorry, the $rpi RPI is Not Yet Ready for Prime Time." 1>&2; exit 1; }
      fi
    else
      echo "$ac_t""RPI $rpi does not exist." 1>&6
      { echo "configure: error: See the INSTALL and RELEASE_NOTES files for details." 1>&2; exit 1; }
    fi
  fi
fi


# Check that the RPI is valid and set RPI type definition.
RPI_HAS_MPI_MALLOC=no
WANT_MYRINET=
WANT_VIA=
case $rpi in
  tcp)
    RPI_SUBDIRS="tcp"
    RPI_LIBS="tcp/liblamrpitcp.la"

    RPILIB="liblamrpitcp.la"
    RPILIBMASK="liblamrpitcp.*"
    cat >> confdefs.h <<\EOF
#define LAM_RPI_TCP 1
EOF

  ;;
  sysv) 
    RPI_SUBDIRS="shmem sysv tcp"
    # Note: the rpitcp.la lib will have the same RPI API in it as the
    # rpisysv.la -- so it is important to list the sysv library
    # *first* to take advantage of unix linker semantics
    RPI_LIBS="shmem/liblamrpishmem.la sysv/liblamrpisysv.la tcp/liblamrpitcp.la"

    RPILIB="liblamrpisysv.la"
    RPILIBMASK="liblamrpisysv.*"
    cat >> confdefs.h <<\EOF
#define LAM_RPI_SHM_SYSV 1
EOF

    ;;
  usysv) 
    RPI_SUBDIRS="shmem usysv tcp"
    # Note: the rpitcp.la lib will have the same RPI API in it as the
    # rpiusysv.la -- so it is important to list the usysv library
    # *first* to take advantage of unix linker semantics
    RPI_LIBS="shmem/liblamrpishmem.la usysv/liblamrpiusysv.la tcp/liblamrpitcp.la"

    RPILIB="liblamrpiusysv.la"
    RPILIBMASK="liblamrpiusysv.*"
    cat >> confdefs.h <<\EOF
#define LAM_RPI_SHM_USYSV 1
EOF

    ;;
  myri)
    RPI_SUBDIRS="myri"
    RPI_LIBS="myri/liblamrpimyri.la"

    RPILIB="liblamrpimyri.la libfakegm.la"
    RPILIBMASK="liblamrpimyri.* libfakegm.*"
    RPI_HAS_MPI_MALLOC=yes
    WANT_MYRINET=yes
    cat >> confdefs.h <<\EOF
#define LAM_RPI_MYRI 1
EOF

    ;;
  via)
    RPI_SUBDIRS="via"
    RPI_LIBS="via/liblamrpivia.la"

    RPILIB="liblamrpivia.la"
    RPILIBMASK="liblamrpivia.*"
    RPI_HAS_MPI_MALLOC=yes
    WANT_VIA=yes
    cat >> confdefs.h <<\EOF
#define LAM_RPI_VIA 1
EOF

    ;;
  *) 
    { echo "configure: error: unknown RPI \"$rpi\"" 1>&2; exit 1; }
    ;;
esac
cat >> confdefs.h <<EOF
#define LAM_RPI "$rpi"
EOF



if test "$RPI_HAS_MPI_MALLOC" = "no"; then
  WANT_DEFAULT_MPI_MALLOC_TRUE=
  WANT_DEFAULT_MPI_MALLOC_FALSE='#'
else
  WANT_DEFAULT_MPI_MALLOC_TRUE='#'
  WANT_DEFAULT_MPI_MALLOC_FALSE=
fi






RPIFLAGS=
# check if not shortcircuiting
# Check whether --with-shortcircuit or --without-shortcircuit was given.
if test "${with_shortcircuit+set}" = set; then
  withval="$with_shortcircuit"
  :
else
  
case "$rpi" in
    tcp|sysv|usysv) cat >> confdefs.h <<\EOF
#define SHORTCIRCUIT 1
EOF

    ;; 
    myri|via) cat >> confdefs.h <<\EOF
#define SHORTCIRCUIT 1
EOF

    ;;
    *) cat >> confdefs.h <<\EOF
#define SHORTCIRCUIT 0
EOF

    ;; 
esac
fi




#AFR: add myrinet flags and such
# Check whether --with-gm or --without-gm was given.
if test "${with_gm+set}" = set; then
  withval="$with_gm"
  :
fi

if test -n "$with_gm"; then
    GMDIR=$with_gm;
fi

#AFR:  and VIA flags as well
# Check whether --with-vialib or --without-vialib was given.
if test "${with_vialib+set}" = set; then
  withval="$with_vialib"
  :
fi

if test -n "$with_vialib"; then
    VIALIB=$with_vialib;
fi

# Check whether --with-vialibdir or --without-vialibdir was given.
if test "${with_vialibdir+set}" = set; then
  withval="$with_vialibdir"
  :
fi

if test -n "$with_vialibdir"; then
    VIALIBDIR=$with_vialibdir;
fi

# Check whether --with-viahdir or --without-viahdir was given.
if test "${with_viahdir+set}" = set; then
  withval="$with_viahdir"
  :
fi

if test -n "$with_viahdir"; then
    VIAHDIR=$with_viahdir;
fi

# Check whether --with-viadev or --without-viadev was given.
if test "${with_viadev+set}" = set; then
  withval="$with_viadev"
  :
fi

if test -n "$with_viadev"; then
    VIA_DEVICE=$with_viadev;
    
fi

#test Myrinet libraries and such
if test -n "$WANT_MYRINET"; then
    if test -n "$GMDIR"; then
	OLDLDFLAGS="$LDFLAGS"
	OLDLIBS="$LIBS"
	LDFLAGS="$LDFLAGS -L$GMDIR/binary/lib"
	CPPFLAGS="$CPPFLAGS -I$GMDIR/include"
	CFLAGS="$CFLAGS -I$GMDIR/include"
	found=no
	echo $ac_n "checking for main in -lgm""... $ac_c" 1>&6
echo "configure:3788: checking for main in -lgm" >&5
ac_lib_var=`echo gm'_'main | 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="-lgm  $LIBS"
cat > conftest.$ac_ext <<EOF
#line 3796 "configure"
#include "confdefs.h"

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

	if test "$found" = "no"; then
	    LDFLAGS="$OLDLDFLAGS -L$GMDIR/lib"
	    # Force it to look again
	    unset ac_cv_lib_gm_main
	    echo $ac_n "checking for main in -lgm""... $ac_c" 1>&6
echo "configure:3828: checking for main in -lgm" >&5
ac_lib_var=`echo gm'_'main | 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="-lgm  $LIBS"
cat > conftest.$ac_ext <<EOF
#line 3836 "configure"
#include "confdefs.h"

int main() {
main()
; return 0; }
EOF
if { (eval echo configure:3843: \"$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
    ac_tr_lib=HAVE_LIB`echo gm | sed -e 's/[^a-zA-Z0-9_]/_/g' \
    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
  cat >> confdefs.h <<EOF
#define $ac_tr_lib 1
EOF

  LIBS="-lgm $LIBS"

else
  echo "$ac_t""no" 1>&6
{ echo "configure: error: *** Cannot find working libgm." 1>&2; exit 1; }
fi

	    LAM_RPI_REAL_LDFLAGS="\"-L$GMDIR/lib -lgm\""
	else
	    LAM_RPI_REAL_LDFLAGS="\"-L$GMDIR/binary/lib -lgm\""
	fi
	for ac_hdr in gm.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:3879: checking for $ac_hdr" >&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 3884 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:3889: \"$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
    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
  cat >> confdefs.h <<EOF
#define $ac_tr_hdr 1
EOF
 
else
  echo "$ac_t""no" 1>&6
{ echo "configure: error: *** Cannot find working gm.h." 1>&2; exit 1; }
fi
done

	
	LAM_RPI_REAL_CFLAGS="\"-I$GMDIR/include\""
	LAM_RPI_FAKE_CFLAGS="-I$GMDIR/include"
	LAM_RPI_FAKE_LDFLAGS="-L\$(top_srcdir)/share/rpi/myri/fakegm/.libs -lfakegm"

	LDFLAGS="$OLDLDFLAGS"
	LIBS="$OLDLIBS"
    else	
	echo $ac_n "checking for main in -lgm""... $ac_c" 1>&6
echo "configure:3925: checking for main in -lgm" >&5
ac_lib_var=`echo gm'_'main | 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="-lgm  $LIBS"
cat > conftest.$ac_ext <<EOF
#line 3933 "configure"
#include "confdefs.h"

int main() {
main()
; return 0; }
EOF
if { (eval echo configure:3940: \"$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
    ac_tr_lib=HAVE_LIB`echo gm | sed -e 's/[^a-zA-Z0-9_]/_/g' \
    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
  cat >> confdefs.h <<EOF
#define $ac_tr_lib 1
EOF

  LIBS="-lgm $LIBS"

else
  echo "$ac_t""no" 1>&6
{ echo "configure: error: *** Cannot find working libgm." 1>&2; exit 1; }
fi

	for ac_hdr in gm.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:3972: checking for $ac_hdr" >&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 3977 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:3982: \"$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
    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
  cat >> confdefs.h <<EOF
#define $ac_tr_hdr 1
EOF
 
else
  echo "$ac_t""no" 1>&6
{ echo "configure: error: *** Cannot find working gm.h" 1>&2; exit 1; }
fi
done


	LAM_RPI_REAL_CFLAGS="\"\""
	LAM_RPI_REAL_LDFLAGS="\"-lgm\""
	LAM_RPI_FAKE_CFLAGS=
	LAM_RPI_FAKE_LDFLAGS="-lfakegm"
    fi

    # Check for which API constant to use:
    # GM_API_VERSION_1_2
    # GM_API_VERSION_1_1
    # GM_API_VERSION_1_0

check_gm_api_version() {
    gmver="$1"
    cat > conftest.$ac_ext <<EOF
#line 4024 "configure"
#include "confdefs.h"
#include <gm.h>

int main() {
int foo = GM_API_VERSION_1_$gmver;
; return 0; }
EOF
if { (eval echo configure:4032: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  rm -rf conftest*
  GM_API_VER="$gmver"
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  GM_API_VER=""
fi
rm -f conftest*
    unset gmver
}

    echo $ac_n "checking GM API version""... $ac_c" 1>&6
echo "configure:4046: checking GM API version" >&5
    check_gm_api_version 2
    if test "$GM_API_VER" = ""; then
	check_gm_api_version 1
	if test "$GM_API_VER" = ""; then
	    check_gm_api_version 0
	    if test "$GM_API_VER" = ""; then
		echo "$ac_t""not found!" 1>&6
		echo "configure: warning: *** Could not determine the version of your GM library." 1>&2
		{ echo "configure: error: *** Cannot continue" 1>&2; exit 1; }
	    fi
	fi
    fi
    GM_API_VERSION="-DLAM_GM_API_VERSION=GM_API_VERSION_1_$GM_API_VER"
    
    echo "$ac_t""GM_API_VERSION_1_$GM_API_VER" 1>&6

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

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

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

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

fi

#
# Test VIA libraries
#

if test -n "$WANT_VIA"; then
    echo $ac_n "checking for main in -lpthread""... $ac_c" 1>&6
echo "configure:4087: checking for main in -lpthread" >&5
ac_lib_var=`echo pthread'_'main | 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="-lpthread  $LIBS"
cat > conftest.$ac_ext <<EOF
#line 4095 "configure"
#include "confdefs.h"

int main() {
main()
; return 0; }
EOF
if { (eval echo configure:4102: \"$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
    ac_tr_lib=HAVE_LIB`echo pthread | sed -e 's/[^a-zA-Z0-9_]/_/g' \
    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
  cat >> confdefs.h <<EOF
#define $ac_tr_lib 1
EOF

  LIBS="-lpthread $LIBS"

else
  echo "$ac_t""no" 1>&6
{ echo "configure: error: *** pthread library which is needed for vipl not found." 1>&2; exit 1; }
fi

    CFLAGS="$CFLAGS -D_REENTRANT "
    CPPFLAGS="$CPPFLAGS -D_REENTRANT "

    #check headers (vipl.h)
    if test -n "$VIAHDIR"; then  #if special header dir
	CPPFLAGS="$CPPFLAGS -I$VIAHDIR"
	CFLAGS="$CFLAGS -I$VIAHDIR/include"
	LAM_RPI_REAL_CFLAGS="\"-I$VIAHDIR\""
    fi

    for ac_hdr in vipl.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:4144: checking for $ac_hdr" >&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 4149 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:4154: \"$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
    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
  cat >> confdefs.h <<EOF
#define $ac_tr_hdr 1
EOF
 
else
  echo "$ac_t""no" 1>&6
{ echo "configure: error: *** Cannot find working vipl.h." 1>&2; exit 1; }
fi
done


    if test -n "$VIALIB"; then #special libname (not libvipl)
	if test -n "$VIALIBDIR"; then #special directory
	    OLDLDFLAGS="$LDFLAGS"
	    OLDLIBS="$LIBS"
	    LDFLAGS="$LDFLAGS -L$VIALIBDIR"
	    echo $ac_n "checking for main in -l$VIALIB""... $ac_c" 1>&6
echo "configure:4188: checking for main in -l$VIALIB" >&5
ac_lib_var=`echo $VIALIB'_'main | 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="-l$VIALIB  $LIBS"
cat > conftest.$ac_ext <<EOF
#line 4196 "configure"
#include "confdefs.h"

int main() {
main()
; return 0; }
EOF
if { (eval echo configure:4203: \"$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
    ac_tr_lib=HAVE_LIB`echo $VIALIB | sed -e 's/[^a-zA-Z0-9_]/_/g' \
    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
  cat >> confdefs.h <<EOF
#define $ac_tr_lib 1
EOF

  LIBS="-l$VIALIB $LIBS"

else
  echo "$ac_t""no" 1>&6
{ echo "configure: error: *** Cannot find working vipl library." 1>&2; exit 1; }
fi

	
	    LAM_RPI_REAL_LDFLAGS="\"-L$VIALIBDIR -lvipl\""

	    LDFLAGS="$OLDLDFLAGS"
	    LIBS="$OLDLIBS"
	else #special libname, standard direcories
	    OLDLDFLAGS="$LDFLAGS"
	    OLDLIBS="$LIBS"
	    echo $ac_n "checking for main in -l$VIALIB""... $ac_c" 1>&6
echo "configure:4240: checking for main in -l$VIALIB" >&5
ac_lib_var=`echo $VIALIB'_'main | 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="-l$VIALIB  $LIBS"
cat > conftest.$ac_ext <<EOF
#line 4248 "configure"
#include "confdefs.h"

int main() {
main()
; return 0; }
EOF
if { (eval echo configure:4255: \"$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
    ac_tr_lib=HAVE_LIB`echo $VIALIB | sed -e 's/[^a-zA-Z0-9_]/_/g' \
    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
  cat >> confdefs.h <<EOF
#define $ac_tr_lib 1
EOF

  LIBS="-l$VIALIB $LIBS"

else
  echo "$ac_t""no" 1>&6
{ echo "configure: error: *** Cannot find working vipl library." 1>&2; exit 1; }
fi

	    LAM_RPI_REAL_LDFLAGS="\"-l$VIALIB\""
	    LDFLAGS="$OLDLDFLAGS"
	    LIBS="$OLDLIBS"
	fi
    else #standard name (libvipl)
	if test -n "$VIALIBDIR"; then #special directory
	    OLDLDFLAGS="$LDFLAGS"
	    OLDLIBS="$LIBS"
	    LDFLAGS="$LDFLAGS -L$VIALIBDIR"
	    echo $ac_n "checking for main in -lvipl""... $ac_c" 1>&6
echo "configure:4293: checking for main in -lvipl" >&5
ac_lib_var=`echo vipl'_'main | 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="-lvipl  $LIBS"
cat > conftest.$ac_ext <<EOF
#line 4301 "configure"
#include "confdefs.h"

int main() {
main()
; return 0; }
EOF
if { (eval echo configure:4308: \"$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
    ac_tr_lib=HAVE_LIB`echo vipl | sed -e 's/[^a-zA-Z0-9_]/_/g' \
    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
  cat >> confdefs.h <<EOF
#define $ac_tr_lib 1
EOF

  LIBS="-lvipl $LIBS"

else
  echo "$ac_t""no" 1>&6
{ echo "configure: error: *** Cannot find working libvipl." 1>&2; exit 1; }
fi

	    LAM_RPI_REAL_LDFLAGS="\"-L$VIALIBDIR -lvipl\""
	    LDFLAGS="$OLDLDFLAGS"
	    LIBS="$OLDLIBS"
	else #std name, std dir
	    OLDLDFLAGS="$LDFLAGS"
	    OLDLIBS="$LIBS"
	    echo $ac_n "checking for main in -lvipl""... $ac_c" 1>&6
echo "configure:4343: checking for main in -lvipl" >&5
ac_lib_var=`echo vipl'_'main | 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="-lvipl  $LIBS"
cat > conftest.$ac_ext <<EOF
#line 4351 "configure"
#include "confdefs.h"

int main() {
main()
; return 0; }
EOF
if { (eval echo configure:4358: \"$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
    ac_tr_lib=HAVE_LIB`echo vipl | sed -e 's/[^a-zA-Z0-9_]/_/g' \
    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
  cat >> confdefs.h <<EOF
#define $ac_tr_lib 1
EOF

  LIBS="-lvipl $LIBS"

else
  echo "$ac_t""no" 1>&6
{ echo "configure: error: *** Cannot find working libvipl." 1>&2; exit 1; }
fi

	    LAM_RPI_REAL_LDFLAGS="\"-lvipl\""
	    LDFLAGS="$OLDLDFLAGS"
	    LIBS="$OLDLIBS"
	fi
    fi

    
    
    cat >> confdefs.h <<EOF
#define LAM_RPI_REAL_CFLAGS "$LAM_RPI_REAL_CFLAGS"
EOF

    cat >> confdefs.h <<EOF
#define LAM_RPI_REAL_LDFLAGS "$LAM_RPI_REAL_LDFLAGS"
EOF

fi

# use select to deschedule even when yield is available
# Check whether --with-select_yield or --without-select_yield was given.
if test "${with_select_yield+set}" = set; then
  withval="$with_select_yield"
  :
fi

if test "$with_select_yield" = yes; then
    cat >> confdefs.h <<\EOF
#define LAM_USE_SELECT_YIELD 1
EOF

fi

# change internal signal
# Check whether --with-signal or --without-signal was given.
if test "${with_signal+set}" = set; then
  withval="$with_signal"
  :
fi

if test -n "$with_signal"; then
    case "$with_signal" in
	SIG*) cat >> confdefs.h <<EOF
#define LAM_SIGUSR $with_signal
EOF
;;
	yes) ;;
	*) { echo "configure: error: invalid signal $with_signal" 1>&2; exit 1; };;
    esac
fi

# See where we can plug the opt flags in
check_opt() {
    arg="$1"
    bad=0
    for word in $arg; do
	case $word in
	-g)    bad=1 ;;
	+K0)   bad=1 ;;
	+K1)   bad=1 ;;
	+K2)   bad=1 ;;
	+K3)   bad=1 ;;
	+K4)   bad=1 ;;
	+K5)   bad=1 ;;
	-O)    bad=1 ;;
	-O0)   bad=1 ;;
	-O1)   bad=1 ;;
	-O2)   bad=1 ;;
	-O3)   bad=1 ;;
	-O4)   bad=1 ;;
	-O5)   bad=1 ;; 
	-O6)   bad=1 ;;
	-O7)   bad=1 ;;
	-O8)   bad=1 ;;
	-O9)   bad=1 ;;
	-xO)   bad=1 ;;
	-xO0)  bad=1 ;;
	-xO1)  bad=1 ;;
	-xO2)  bad=1 ;;
	-xO3)  bad=1 ;;
	-xO4)  bad=1 ;;
	-xO5)  bad=1 ;; 
	-xO6)  bad=1 ;;
	-xO7)  bad=1 ;;
	-xO8)  bad=1 ;;
	-xO9)  bad=1 ;;
	-fast) bad=1 ;;
	esac
    done
    if test "$bad" = "0"; then
	result="$OPTFLAGS $arg"
    else
	result="$arg"
    fi
}

OPTFLAGS="-O"
check_opt "$CFLAGS"
CFLAGS="$result"
check_opt "$CXXFLAGS"
CXXFLAGS="$result"
check_opt "$FFLAGS"
FFLAGS="$result"
# Since we're not doing -fast for Solaris anymore, we don't need to
# add -O to the LDFLAGS (checked the man pages on a couple of
# architectures, and this seems to be true).  So we'll just leave
# those alone.
#check_opt "$USER_LDFLAGS"
#USER_LDFLAGS=$result
#check_opt "$USER_CXXLDFLAGS"
#USER_CXXLDFLAGS=$result

# Take care of some specific compiler options. 
# Force use of ANSI C under HP-UX.
ROMIO_FLAGS=
if test "$ac_cv_prog_gcc" = no; then
    us=`(uname -s) 2>/dev/null` || us=unknown
    case "$us" in
        HP-UX)	CPPFLAGS="$CPPFLAGS -Ae"
		ROMIO_FLAGS="+U77"
		if test "$lam_cflags_save" = set; then
			CFLAGS="-Ae"
		else
			CFLAGS="$CFLAGS -Ae"
		fi ;;
	*)	;;
    esac
fi

# Delay the substitution of CFLAGS and CXXFLAGS until later, mainly
# for aesthetic reasons (so that the ugly '-I$(top_srcdir)' doesn't
# show up in the configure tests.







# Determine if compiler and options accepts ANSI prototypes.
echo $ac_n "checking whether the C compiler ($CC $CFLAGS) accepts ANSI prototypes""... $ac_c" 1>&6
echo "configure:4526: checking whether the C compiler ($CC $CFLAGS) accepts ANSI prototypes" >&5
cat > conftest.c <<EOF
static double foo(double bar) { return(2.0*bar); }
int main(int argc, char **argv)
{ double x; x = foo(2.0); return(0); }
EOF
$CC $CFLAGS -o conftest conftest.c 1>&5 2>&1
if test -s conftest && (./conftest; exit) 2>/dev/null; then
    lam_ac_ansi_protos=yes
else
    lam_ac_ansi_protos=no
fi
echo "$ac_t""$lam_ac_ansi_protos" 1>&6
/bin/rm -f conftest*
if test "$lam_ac_ansi_protos" = no; then
    { echo "configure: error: LAM requires a compiler which understands ANSI C prototypes" 1>&2; exit 1; }
fi

# Is this even used anymore?
# How to specify a directory for the library archive search path.
us=`(uname -s) 2>/dev/null` || us=unknown
case "$us" in
    HP-UX) FLIBPATH="\"-Wl,-L\"" ;;
	*) FLIBPATH="\"-L\"" ;;
esac
cat >> confdefs.h <<EOF
#define LAM_FLIBPATH $FLIBPATH
EOF


# check for specification of FORTRAN compiler
# define WAVE1D_EXAMPLE (a FORTRAN example) to be "wave1d" if were
# building FORTRAN support, or empty if not
F77=
F77_BUILD_DIR=
F77_LTPLIB=
ROMIO_NOF77=
FPI_EXAMPLE=
WAVE1D_EXAMPLE=
TRIVIALF_EXAMPLE=
echo $ac_n "checking if want FORTRAN support""... $ac_c" 1>&6
echo "configure:4567: checking if want FORTRAN support" >&5
if test "$with_fc" = no; then
  F77=false
  LAM_F77="false"
  ROMIO_NOF77="-nof77"
  echo "$ac_t""no" 1>&6
  cat >> confdefs.h <<\EOF
#define LAM_WANT_FORTRAN 0
EOF

else
  echo "$ac_t""yes" 1>&6
  if test -n "$FC"; then
# AC_CHECK_PROG* only checks for the user specified compiler in the
# users $PATH.  Arrgh!
# It does not address the case where the user specifies an absolute
# filename that is *not* in their $PATH.
    FC0="`echo $FC | awk '{ print $1 }'`"
    ISABS=`echo $FC0 | cut -c1`
    if test "$ISABS" = "/" -a -x "$FC0"; then
      F77="$FC"
      echo $ac_n "checking for FORTRAN compiler $FC0""... $ac_c" 1>&6
echo "configure:4589: checking for FORTRAN compiler $FC0" >&5
      echo "$ac_t""found" 1>&6
    else
      for ac_prog in $FC0
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:4597: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_F77'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  if test -n "$F77"; then
  ac_cv_prog_F77="$F77" # 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_F77="$ac_prog"
      break
    fi
  done
  IFS="$ac_save_ifs"
fi
fi
F77="$ac_cv_prog_F77"
if test -n "$F77"; then
  echo "$ac_t""$F77" 1>&6
else
  echo "$ac_t""no" 1>&6
fi

test -n "$F77" && break
done

    fi
    if test -z "$F77"; then
      cat >> confdefs.h <<\EOF
#define LAM_WANT_FORTRAN 0
EOF

      { echo "configure: error: could not find FORTRAN compiler $FC0" 1>&2; exit 1; }
    else
      cat >> confdefs.h <<\EOF
#define LAM_WANT_FORTRAN 1
EOF

    fi
  else
# If the user did not specify one, look for all the common names
    for ac_prog in f77 fort77 g77 f90
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:4646: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_F77'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  if test -n "$F77"; then
  ac_cv_prog_F77="$F77" # 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_F77="$ac_prog"
      break
    fi
  done
  IFS="$ac_save_ifs"
fi
fi
F77="$ac_cv_prog_F77"
if test -n "$F77"; then
  echo "$ac_t""$F77" 1>&6
else
  echo "$ac_t""no" 1>&6
fi

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

    if test -z "$F77" -o "$F77" = "no"; then
      cat >> confdefs.h <<\EOF
#define LAM_WANT_FORTRAN 0
EOF

      echo "configure: warning: *** Could not find FORTRAN compiler.  Either use" 1>&2
      echo "configure: warning: *** --with-fc to specify the FORTRAN compiler, or" 1>&2
      echo "configure: warning: *** --without-fc to specify no FORTRAN support" 1>&2
      { echo "configure: error: cannot continue current configuration without FORTRAN compiler" 1>&2; exit 1; }
    else
      cat >> confdefs.h <<\EOF
#define LAM_WANT_FORTRAN 1
EOF

    fi
  fi
  LAM_F77="$F77"
  F77_BUILD_DIR=f77
  F77_LTPLIB=f77/liblamf77pmpi.la
  FPI_EXAMPLE=fpi
  WAVE1D_EXAMPLE=wave1d
  TRIVIALF_EXAMPLE=trivialf
fi
cat >> confdefs.h <<EOF
#define LAM_F77 "$LAM_F77"
EOF








# check for threads
THREADCFLAGS=
THREADLDFLAGS=
THREADCXXFLAGS=
THREADCXXLDFLAGS=
WANT_MT=no
echo $ac_n "checking if want multithreaded support""... $ac_c" 1>&6
echo "configure:4717: checking if want multithreaded support" >&5;
# Check whether --with-threads or --without-threads was given.
if test "${with_threads+set}" = set; then
  withval="$with_threads"
  WANT_MT=$withval
fi

echo "$ac_t""$WANT_MT" 1>&6
if test "$WANT_MT" = "yes"; then
    # If were in solaris, check for Solaris threads
    case "$host" in
	*solaris*)
	    libs_SAVE="$LIBS"
	    echo $ac_n "checking for thr_create in -lthread""... $ac_c" 1>&6
echo "configure:4731: checking for thr_create in -lthread" >&5
ac_lib_var=`echo thread'_'thr_create | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  ac_save_LIBS="$LIBS"
LIBS="-lthread  $LIBS"
cat > conftest.$ac_ext <<EOF
#line 4739 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error.  */
/* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
char thr_create();

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

	    LIBS="$libs_SAVE"
	    ;;
    esac
    if test "$HAVE_SOL_THREADS" = "1"; then
	if test "$BASECC" = "cc"; then
	    THREADCFLAGS="-mt"
	    THREADCXXFLAGS="$THREADCFLAGS"
	    THREADLDFLAGS="-mt"
	    THREADCXXLDFLAGS="$THREADLDFLAGS"
	else
	    THREADCFLAGS="-D_REENTRANT"
	    THREADCXXFLAGS="$THREADCFLAGS"
	    THREADLDFLAGS="-lthread"
	    THREADCXXLDFLAGS="$THREADLDFLAGS"
	fi

	if test "$BASECXX" = "CC"; then
	    THREADCFLAGS="-mt"
	    THREADCXXFLAGS="$THREADCFLAGS"
	    THREADLDFLAGS="-mt"
	    THREADCXXLDFLAGS="$THREADLDFLAGS"
	elif test "$BASECXX" = "KCC"; then
	    THREADCFLAGS="--backend -mt"
	    THREADCXXFLAGS="$THREADCFLAGS"
	    THREADLDFLAGS="--backend -mt"
	    THREADCXXLDFLAGS="$THREADLDFLAGS"
	else
	    THREADCFLAGS="-D_REENTRANT"
	    THREADCXXFLAGS="$THREADCFLAGS"
	    THREADLDFLAGS="-lthread"
	    THREADCXXLDFLAGS="$THREADLDFLAGS"
	fi
	cat >> confdefs.h <<\EOF
#define LAM_HAVE_SOL_THREADS 1
EOF

	cat >> confdefs.h <<\EOF
#define LAM_HAVE_PTHREADS 0
EOF

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

	libs_SAVE="$LIBS"
	echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6
echo "configure:4818: checking for pthread_create in -lpthread" >&5
ac_lib_var=`echo pthread'_'pthread_create | 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="-lpthread  $LIBS"
cat > conftest.$ac_ext <<EOF
#line 4826 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error.  */
/* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
char pthread_create();

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

	LIBS="$libs_SAVE"
	if test "$HAVE_PTHREADS" = "1"; then
	    cat >> confdefs.h <<\EOF
#define LAM_HAVE_PTHREADS 1
EOF

	    THREADCFLAGS="-D_REENTRANT"
	    THREADLDFLAGS="-lpthread"
	    THREADCXXCFLAGS="$THREADCFLAGS"
	    THREADCXXLDFLAGS="$THREADCXXLDFLAGS"
	else
	    cat >> confdefs.h <<\EOF
#define LAM_HAVE_PTHREADS 0
EOF

	fi
    fi
else
    # No thread support
    cat >> confdefs.h <<\EOF
#define LAM_HAVE_PTHREADS 0
EOF

    cat >> confdefs.h <<\EOF
#define LAM_HAVE_SOL_THREADS 0
EOF

fi





# we have waited until all the compiler checking is done before checking this
RPISYSLIBS=
# check if using pthread lock
# Check whether --with-pthread_lock or --without-pthread_lock was given.
if test "${with_pthread_lock+set}" = set; then
  withval="$with_pthread_lock"
  :
fi

if test "$with_pthread_lock" = yes; then
    case "$rpi" in
	usysv) 
echo $ac_n "checking for process shared pthread mutex""... $ac_c" 1>&6
echo "configure:4904: checking for process shared pthread mutex" >&5
if test "$cross_compiling" = yes; then
  lam_ac_mutex_pshared=no
else
  cat > conftest.$ac_ext <<EOF
#line 4909 "configure"
#include "confdefs.h"
#include <pthread.h>
int main(int argc, char* argv[]) {
  pthread_mutex_t m; pthread_mutexattr_t mattr;
  if (pthread_mutexattr_init(&mattr)) return(1);
  if (pthread_mutexattr_setpshared(&mattr, PTHREAD_PROCESS_SHARED)) return(1);
  if (pthread_mutex_init(&m, &mattr)) return(-1);
  return(0);
}
EOF
if { (eval echo configure:4920: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
  lam_ac_mutex_pshared=yes
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -fr conftest*
  lam_ac_mutex_pshared=no
fi
rm -fr conftest*
fi

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

	       if test "$lam_ac_mutex_pshared" = no; then
		    echo 'ignoring --with-pthread-lock'
		else
		    RPIFLAGS="$RPIFLAGS -DPTHREAD_FREELOCK"
		    RPISYSLIBS="$RPISYSLIBS -lpthread"
		fi ;;
	*) echo "configure: warning: use of pthread mutex lock not supported in RPI $rpi" 1>&2 ;;
     esac
fi



#
# This is in share/boot/inetexec.c -- looks like a remnant of some old
# flavors of rsh, but we'll keep the code anyway, just in case...
#

cat >> confdefs.h <<\EOF
#define LAM_RSH_NEED_MINUSMINUS 0
EOF


# Check for programs.
# Abort if we cannot find one of them

echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
echo "configure:4960: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
  CPP=
fi
if test -z "$CPP"; then
if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
    # This must be in double quotes, not single quotes, because CPP may get
  # substituted into the Makefile and "${CC-cc}" will confuse make.
  CPP="${CC-cc} -E"
  # On the NeXT, cc -E runs the code through the compiler's parser,
  # not just through cpp.
  cat > conftest.$ac_ext <<EOF
#line 4975 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:4981: \"$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*
  CPP="${CC-cc} -E -traditional-cpp"
  cat > conftest.$ac_ext <<EOF
#line 4992 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:4998: \"$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*
  CPP="${CC-cc} -nologo -E"
  cat > conftest.$ac_ext <<EOF
#line 5009 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:5015: \"$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*
  CPP=/lib/cpp
fi
rm -f conftest*
fi
rm -f conftest*
fi
rm -f conftest*
  ac_cv_prog_CPP="$CPP"
fi
  CPP="$ac_cv_prog_CPP"
else
  ac_cv_prog_CPP="$CPP"
fi
echo "$ac_t""$CPP" 1>&6

if test "$CPP" = ""; then
    { echo "configure: error: Could not find C preprocessor.  Cannot continue." 1>&2; exit 1; }
fi

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

if test "$LN_S" = ""; then
    { echo "configure: error: Could not find command for symbolic links (ln).  Cannot continue." 1>&2; exit 1; }
fi

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

if test "$CP" = ""; then
    { echo "configure: error: Could not find cp.  Cannot continue." 1>&2; exit 1; }
fi

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

if test "$RM" = ""; then
    { echo "configure: error: Could not find rm.  Cannot continue." 1>&2; exit 1; }
fi
cat >> confdefs.h <<EOF
#define LAM_RM "$RM -f"
EOF


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

if test "$SED" = ""; then
    { echo "configure: error: Could not find sed.  Cannot continue." 1>&2; exit 1; }
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:5192: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_SHELL_CMD'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  case "$SHELL_CMD" in
  /*)
  ac_cv_path_SHELL_CMD="$SHELL_CMD" # Let the user override the test with a path.
  ;;
  ?:/*)			 
  ac_cv_path_SHELL_CMD="$SHELL_CMD" # 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_SHELL_CMD="$ac_dir/$ac_word"
      break
    fi
  done
  IFS="$ac_save_ifs"
  ;;
esac
fi
SHELL_CMD="$ac_cv_path_SHELL_CMD"
if test -n "$SHELL_CMD"; then
  echo "$ac_t""$SHELL_CMD" 1>&6
else
  echo "$ac_t""no" 1>&6
fi

if test "$SHELL_CMD" = ""; then
    { echo "configure: error: Could not find Bourne shell.  Cannot continue." 1>&2; exit 1; }
fi

# figure out the remote shell command
# if not explicitly specified by the user then
# remsh as remote shell on HP-UX and rsh on all others
RSH0=
RSH=
# Check whether --with-rsh or --without-rsh was given.
if test "${with_rsh+set}" = set; then
  withval="$with_rsh"
  
case "$withval" in
    /*) RSH0=$withval
	;;
# We can do this set stuff here because we're long past command line
# parsing
    *)  set $withval
	RSH0="$1"
	shift
	RSH="$*"
        # Extract the first word of "$withval", so it can be a program name with args.
set dummy $withval; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:5249: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_RSH0'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  case "$RSH0" in
  /*)
  ac_cv_path_RSH0="$RSH0" # Let the user override the test with a path.
  ;;
  ?:/*)			 
  ac_cv_path_RSH0="$RSH0" # 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_RSH0="$ac_dir/$ac_word"
      break
    fi
  done
  IFS="$ac_save_ifs"
  ;;
esac
fi
RSH0="$ac_cv_path_RSH0"
if test -n "$RSH0"; then
  echo "$ac_t""$RSH0" 1>&6
else
  echo "$ac_t""no" 1>&6
fi

	;;
esac
else
  
us=`(uname -s) 2>/dev/null` || us=unknown
case "$us" in
    HP-UX) # Extract the first word of "remsh", so it can be a program name with args.
set dummy remsh; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:5290: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_RSH0'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  case "$RSH0" in
  /*)
  ac_cv_path_RSH0="$RSH0" # Let the user override the test with a path.
  ;;
  ?:/*)			 
  ac_cv_path_RSH0="$RSH0" # 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_RSH0="$ac_dir/$ac_word"
      break
    fi
  done
  IFS="$ac_save_ifs"
  ;;
esac
fi
RSH0="$ac_cv_path_RSH0"
if test -n "$RSH0"; then
  echo "$ac_t""$RSH0" 1>&6
else
  echo "$ac_t""no" 1>&6
fi
 
	;;
    *) # Extract the first word of "rsh", so it can be a program name with args.
set dummy rsh; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:5326: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_RSH0'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  case "$RSH0" in
  /*)
  ac_cv_path_RSH0="$RSH0" # Let the user override the test with a path.
  ;;
  ?:/*)			 
  ac_cv_path_RSH0="$RSH0" # 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_RSH0="$ac_dir/$ac_word"
      break
    fi
  done
  IFS="$ac_save_ifs"
  ;;
esac
fi
RSH0="$ac_cv_path_RSH0"
if test -n "$RSH0"; then
  echo "$ac_t""$RSH0" 1>&6
else
  echo "$ac_t""no" 1>&6
fi
 
	;;
esac
fi


# make sure we have a remote shell command
echo $ac_n "checking for remote shell command""... $ac_c" 1>&6
echo "configure:5365: checking for remote shell command" >&5
if test -z "$RSH0"; then
    { echo "configure: error: could not find remote shell command" 1>&2; exit 1; }
fi
echo "$ac_t""$RSH0 $RSH" 1>&6
RSH="\"$RSH0 $RSH\""
cat >> confdefs.h <<EOF
#define LAM_RSH $RSH
EOF



# do we have a broken compiler that does not defined __STDC__ even
# though it really is?  Hard coded for the moment for Solaris cc.  
# can extend the hard coding or make a real test
# Does not hurt here to AC_DEFINE LAM_CONFIG_FORCE_PROTOS to 0, because 
# LAM_CONFIG_FORCE_PROTOS is only one of multiple constants checked to see if
# we want prototypes.
if test "`echo $host | grep solaris2`" != "" -a "$BASECC" = "cc"; then
    cat >> confdefs.h <<\EOF
#define LAM_CONFIG_FORCE_PROTOS 1
EOF

elif test "$ac_cv_prog_gcc" = "yes"; then
    cat >> confdefs.h <<\EOF
#define LAM_CONFIG_FORCE_PROTOS 1
EOF

else
    # At least some compilers don't want to be forced -- e.g., HP-UX 10.20
    # which is not ANSI by default
    cat >> confdefs.h <<\EOF
#define LAM_CONFIG_FORCE_PROTOS 0
EOF

    
# Check to see if compiler sets __STDC__ to 1 or not
echo $ac_n "checking for __STDC__""... $ac_c" 1>&6
echo "configure:5403: checking for __STDC__" >&5
cat > conftest.c <<EOF
#include <stdio.h>
#ifdef __cplusplus
extern "C" {
void exit(int);
#endif
#ifndef __STDC__
#define __STDC__ -1
#endif
int main(int argc, char* argv)
{
    FILE *f=fopen("conftestval", "w");
    if (!f) exit(1);
    fprintf(f, "%d\n", __STDC__);
    return 0;
}
EOF
$CC $CFLAGS -o conftest conftest.c 1>&5 2>&1
if test -s conftest && (./conftest; exit) 2>/dev/null; then
    lam_ac_stdc=`cat conftestval`
    echo "$ac_t""$lam_ac_stdc" 1>&6
    if test "$lam_ac_stdc" = "0"; then
	echo "configure: warning: *** Compiler did not set __STDC__ to 1!" 1>&2
	echo "configure: warning: *** Be warned -- this will cause user MPI programs to" 1>&2
	echo "configure: warning: *** not get proper prototypes of MPI functions!" 1>&2
    elif test "$lam_ac_stdc" = "-1"; then
	echo "configure: warning: *** Compiler did not set __STDC__!" 1>&2
	echo "configure: warning: *** Be warned -- this will cause user MPI programs to" 1>&2
	echo "configure: warning: *** not get proper prototypes of MPI functions!" 1>&2
    fi
else
    echo "configure: warning: error compiling/running conftest" 1>&2
fi
/bin/rm -f conftest*
fi

# If we want things to be purify/bcheck/general-memory-checking-debugger
# clean, set this flag so that LAM will always zero memory in known
# trouble spots.  May cause slight overhead in sending/receiving, since
# buffers are zeroed before using, hence, it is an option
echo $ac_n "checking if want purify clean""... $ac_c" 1>&6
echo "configure:5445: checking if want purify clean" >&5
WANT_PURIFY=no
# Check whether --with-purify or --without-purify was given.
if test "${with_purify+set}" = set; then
  withval="$with_purify"
  WANT_PURIFY=$withval
fi

if test "$WANT_PURIFY" = "yes"; then
    cat >> confdefs.h <<\EOF
#define LAM_DISINFECT 1
EOF

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

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

# transport tunable defaults
TCPSHORT=65536
SHMSHORT=8192
SHMPOOL=0
SHMALLOC=0

# transport 
# Check whether --with-tcpshort or --without-tcpshort was given.
if test "${with_tcpshort+set}" = set; then
  withval="$with_tcpshort"
  :
fi

if test -n "$with_tcp_short"; then
    TCPSHORT=$with_tcp_short
fi
echo $ac_n "checking for TCP short message length""... $ac_c" 1>&6
echo "configure:5483: checking for TCP short message length" >&5
echo "$ac_t""$TCPSHORT bytes" 1>&6

case "$rpi" in 
  *sysv)
    # Check whether --with-shmshort or --without-shmshort was given.
if test "${with_shmshort+set}" = set; then
  withval="$with_shmshort"
  :
fi

    if test -n "$with_shm_short"; then
	SHMSHORT=$with_shm_short
    fi

    echo using shared memory short message length of $SHMSHORT bytes

    # Check whether --with-shm-poolsize or --without-shm-poolsize was given.
if test "${with_shm_poolsize+set}" = set; then
  withval="$with_shm_poolsize"
  :
fi

    if test -n "$with_shm_poolsize"; then
	SHMPOOL=$with_shm_poolsize
        echo using shared memory pool of $SHMPOOL bytes
    fi

    # Check whether --with-shm-maxalloc or --without-shm-maxalloc was given.
if test "${with_shm_maxalloc+set}" = set; then
  withval="$with_shm_maxalloc"
  :
fi

    if test -n "$with_shm_maxalloc"; then
	SHMALLOC=$with_shm_maxalloc
        echo using maximum shared memory allocation of $SHMALLOC bytes
    fi

    if test -z "$with_shm_poolsize"; then
	if test -z "$with_shm_maxalloc"; then
	    echo $ac_n "checking "shared memory poolsize"""... $ac_c" 1>&6
echo "configure:5525: checking "shared memory poolsize"" >&5
	    
# Determine maximum shared segment size.
cat > conftest.c <<EOF
#include <stddef.h>
#include <stdio.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#define LAM_SHMSHORT $SHMSHORT
#define LAM_SHMPOOL $SHMPOOL
#define MB (1024*1024)
int
test_alloc(int size)
{
    char		*base;
    int			shmid;
    shmid = shmget(IPC_PRIVATE, size, 0600 | IPC_CREAT);
    if (shmid < 0) return(0);
    base = (char *) shmat(shmid, (char *) 0, 0);
    if (base == (char *) -1) {
	shmctl(shmid, IPC_RMID, (struct shmid_ds *) 0);
	return(0);
    }
    shmdt(base);
    shmctl(shmid, IPC_RMID, (struct shmid_ds *) 0);
    return(1);
}
int
main(int argc, char* argv)
{
    int	poolsize, maxalloc;
    FILE *f=fopen("conftestval", "w");
    if (!f) return 1;
    if (LAM_SHMPOOL > 0) {
	if (LAM_SHMPOOL >= 2 * MB) maxalloc = MB;
	else maxalloc = LAM_SHMPOOL;
        fprintf(f, "%d\t%d\t%d\n", 0, LAM_SHMPOOL, maxalloc);
	fclose(f);
	return(0);    
    }
    if (test_alloc(32*MB)) { poolsize = 16*MB; maxalloc = MB; }
    else if (test_alloc(16*MB)) { poolsize = 14*MB; maxalloc = MB; }
    else if (test_alloc(8*MB)) { poolsize = 6*MB; maxalloc = MB; }
    else if (test_alloc(4*MB)) { poolsize = 2*MB; maxalloc = MB; }
    else if (test_alloc(2*MB)) { poolsize = MB; maxalloc = MB/2; }
    else if (test_alloc(MB)) { 
	poolsize = MB - (8*7 * (LAM_SHMSHORT+128)) - 256; 
	if (poolsize < 0) poolsize =  MB - (4*3 * (LAM_SHMSHORT+128)) - 256;
	if (poolsize < 0) poolsize = 0; 
        maxalloc = poolsize; }
    else { poolsize = 0; maxalloc = 0; }
    fprintf(f, "%d\t%d\n", poolsize, maxalloc);
    fclose(f);
    return(0);
}
EOF
$CC $CFLAGS -o conftest conftest.c 1>&5 2>&1
if test -s conftest && (./conftest; exit) 2>/dev/null; then
    if test $SHMPOOL -eq 0; then
	SHMPOOL=`cat conftestval | cut -f1`
    fi
    if test $SHMALLOC -eq 0; then
	SHMALLOC=`cat conftestval | cut -f2`
    fi
else
    echo
    echo "configure: warning: error compiling/running conftest" 1>&2
    lam_echo "using default of"
    if test $SHMPOOL -eq 0; then
	SHMPOOL=524288
    fi
    if test $SHMALLOC -eq 0; then
	SHMALLOC=524288
    fi
fi
/bin/rm -f conftest*
	    echo "$ac_t""$SHMPOOL bytes" 1>&6
	    echo $ac_n "checking "shared memory maxalloc"""... $ac_c" 1>&6
echo "configure:5603: checking "shared memory maxalloc"" >&5
	    echo "$ac_t""$SHMALLOC bytes" 1>&6
	else
	    echo $ac_n "checking "shared memory poolsize"""... $ac_c" 1>&6
echo "configure:5607: checking "shared memory poolsize"" >&5
	    
# Determine maximum shared segment size.
cat > conftest.c <<EOF
#include <stddef.h>
#include <stdio.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#define LAM_SHMSHORT $SHMSHORT
#define LAM_SHMPOOL $SHMPOOL
#define MB (1024*1024)
int
test_alloc(int size)
{
    char		*base;
    int			shmid;
    shmid = shmget(IPC_PRIVATE, size, 0600 | IPC_CREAT);
    if (shmid < 0) return(0);
    base = (char *) shmat(shmid, (char *) 0, 0);
    if (base == (char *) -1) {
	shmctl(shmid, IPC_RMID, (struct shmid_ds *) 0);
	return(0);
    }
    shmdt(base);
    shmctl(shmid, IPC_RMID, (struct shmid_ds *) 0);
    return(1);
}
int
main(int argc, char* argv)
{
    int	poolsize, maxalloc;
    FILE *f=fopen("conftestval", "w");
    if (!f) return 1;
    if (LAM_SHMPOOL > 0) {
	if (LAM_SHMPOOL >= 2 * MB) maxalloc = MB;
	else maxalloc = LAM_SHMPOOL;
        fprintf(f, "%d\t%d\t%d\n", 0, LAM_SHMPOOL, maxalloc);
	fclose(f);
	return(0);    
    }
    if (test_alloc(32*MB)) { poolsize = 16*MB; maxalloc = MB; }
    else if (test_alloc(16*MB)) { poolsize = 14*MB; maxalloc = MB; }
    else if (test_alloc(8*MB)) { poolsize = 6*MB; maxalloc = MB; }
    else if (test_alloc(4*MB)) { poolsize = 2*MB; maxalloc = MB; }
    else if (test_alloc(2*MB)) { poolsize = MB; maxalloc = MB/2; }
    else if (test_alloc(MB)) { 
	poolsize = MB - (8*7 * (LAM_SHMSHORT+128)) - 256; 
	if (poolsize < 0) poolsize =  MB - (4*3 * (LAM_SHMSHORT+128)) - 256;
	if (poolsize < 0) poolsize = 0; 
        maxalloc = poolsize; }
    else { poolsize = 0; maxalloc = 0; }
    fprintf(f, "%d\t%d\n", poolsize, maxalloc);
    fclose(f);
    return(0);
}
EOF
$CC $CFLAGS -o conftest conftest.c 1>&5 2>&1
if test -s conftest && (./conftest; exit) 2>/dev/null; then
    if test $SHMPOOL -eq 0; then
	SHMPOOL=`cat conftestval | cut -f1`
    fi
    if test $SHMALLOC -eq 0; then
	SHMALLOC=`cat conftestval | cut -f2`
    fi
else
    echo
    echo "configure: warning: error compiling/running conftest" 1>&2
    lam_echo "using default of"
    if test $SHMPOOL -eq 0; then
	SHMPOOL=524288
    fi
    if test $SHMALLOC -eq 0; then
	SHMALLOC=524288
    fi
fi
/bin/rm -f conftest*
	    echo "$ac_t""$SHMPOOL bytes" 1>&6
	fi
    else
	if test -z "$with_shm_maxalloc"; then
	    echo $ac_n "checking "shared memory maxalloc"""... $ac_c" 1>&6
echo "configure:5688: checking "shared memory maxalloc"" >&5
	    
# Determine maximum shared segment size.
cat > conftest.c <<EOF
#include <stddef.h>
#include <stdio.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#define LAM_SHMSHORT $SHMSHORT
#define LAM_SHMPOOL $SHMPOOL
#define MB (1024*1024)
int
test_alloc(int size)
{
    char		*base;
    int			shmid;
    shmid = shmget(IPC_PRIVATE, size, 0600 | IPC_CREAT);
    if (shmid < 0) return(0);
    base = (char *) shmat(shmid, (char *) 0, 0);
    if (base == (char *) -1) {
	shmctl(shmid, IPC_RMID, (struct shmid_ds *) 0);
	return(0);
    }
    shmdt(base);
    shmctl(shmid, IPC_RMID, (struct shmid_ds *) 0);
    return(1);
}
int
main(int argc, char* argv)
{
    int	poolsize, maxalloc;
    FILE *f=fopen("conftestval", "w");
    if (!f) return 1;
    if (LAM_SHMPOOL > 0) {
	if (LAM_SHMPOOL >= 2 * MB) maxalloc = MB;
	else maxalloc = LAM_SHMPOOL;
        fprintf(f, "%d\t%d\t%d\n", 0, LAM_SHMPOOL, maxalloc);
	fclose(f);
	return(0);    
    }
    if (test_alloc(32*MB)) { poolsize = 16*MB; maxalloc = MB; }
    else if (test_alloc(16*MB)) { poolsize = 14*MB; maxalloc = MB; }
    else if (test_alloc(8*MB)) { poolsize = 6*MB; maxalloc = MB; }
    else if (test_alloc(4*MB)) { poolsize = 2*MB; maxalloc = MB; }
    else if (test_alloc(2*MB)) { poolsize = MB; maxalloc = MB/2; }
    else if (test_alloc(MB)) { 
	poolsize = MB - (8*7 * (LAM_SHMSHORT+128)) - 256; 
	if (poolsize < 0) poolsize =  MB - (4*3 * (LAM_SHMSHORT+128)) - 256;
	if (poolsize < 0) poolsize = 0; 
        maxalloc = poolsize; }
    else { poolsize = 0; maxalloc = 0; }
    fprintf(f, "%d\t%d\n", poolsize, maxalloc);
    fclose(f);
    return(0);
}
EOF
$CC $CFLAGS -o conftest conftest.c 1>&5 2>&1
if test -s conftest && (./conftest; exit) 2>/dev/null; then
    if test $SHMPOOL -eq 0; then
	SHMPOOL=`cat conftestval | cut -f1`
    fi
    if test $SHMALLOC -eq 0; then
	SHMALLOC=`cat conftestval | cut -f2`
    fi
else
    echo
    echo "configure: warning: error compiling/running conftest" 1>&2
    lam_echo "using default of"
    if test $SHMPOOL -eq 0; then
	SHMPOOL=524288
    fi
    if test $SHMALLOC -eq 0; then
	SHMALLOC=524288
    fi
fi
/bin/rm -f conftest*
	    echo "$ac_t""$SHMALLOC bytes" 1>&6
	fi
    fi

    if test \( $SHMPOOL -eq 0 \) -o \( $SHMALLOC -eq 0 \); then
	{ echo "configure: error: determining shared memory parameters
Please check that your system supports SYSV shared 
memory segments of 1MB or more.
You can also try explicitly setting both the poolsize and 
maxalloc parameters." 1>&2; exit 1; }
    fi ;;
esac

cat >> confdefs.h <<EOF
#define LAM_TCPSHORTMSGLEN $TCPSHORT
EOF

cat >> confdefs.h <<EOF
#define LAM_SHMSHORTMSGLEN $SHMSHORT
EOF

cat >> confdefs.h <<EOF
#define LAM_MPI_SHMPOOLSIZE $SHMPOOL
EOF

cat >> confdefs.h <<EOF
#define LAM_MPI_SHMMAXALLOC $SHMALLOC
EOF


# lamd defaults
# used to be in config.mk (Makefile include), but now have to be here
# since we switched to automake

TO_BOOT=60
TO_DLO_ACK=1
TO_DLO_IDLE=120
# Check whether --with-lamd-boot or --without-lamd-boot was given.
if test "${with_lamd_boot+set}" = set; then
  withval="$with_lamd_boot"
  TO_BOOT=$withval
fi

# Check whether --with-lamd-ack or --without-lamd-ack was given.
if test "${with_lamd_ack+set}" = set; then
  withval="$with_lamd_ack"
  TO_DLO_ACK=$withval
fi

# Check whether --with-lamd-hb or --without-lamd-hb was given.
if test "${with_lamd_hb+set}" = set; then
  withval="$with_lamd_hb"
  TO_DLO_IDLE=$withval
fi


# Just for cosmetics
echo $ac_n "checking "for desired boot timeout"""... $ac_c" 1>&6
echo "configure:5822: checking "for desired boot timeout"" >&5
echo "$ac_t"""$TO_BOOT seconds"" 1>&6
echo $ac_n "checking "for desired lamd packet resend time"""... $ac_c" 1>&6
echo "configure:5825: checking "for desired lamd packet resend time"" >&5
echo "$ac_t"""$TO_DLO_ACK seconds"" 1>&6
echo $ac_n "checking "for desired lamd heartbeat time"""... $ac_c" 1>&6
echo "configure:5828: checking "for desired lamd heartbeat time"" >&5
echo "$ac_t"""$TO_DLO_IDLE seconds"" 1>&6
cat >> confdefs.h <<EOF
#define LAM_TO_BOOT $TO_BOOT
EOF

cat >> confdefs.h <<EOF
#define LAM_TO_DLO_ACK $TO_DLO_ACK
EOF

cat >> confdefs.h <<EOF
#define LAM_TO_DLO_IDLE $TO_DLO_IDLE
EOF


# Checks for typedefs, structures, and compiler characteristics.
echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
echo "configure:5845: checking whether byte ordering is bigendian" >&5
if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  ac_cv_c_bigendian=unknown
# See if sys/param.h defines the BYTE_ORDER macro.
cat > conftest.$ac_ext <<EOF
#line 5852 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/param.h>
int main() {

#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
 bogus endian macros
#endif
; return 0; }
EOF
if { (eval echo configure:5863: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  rm -rf conftest*
  # It does; now see whether it defined to BIG_ENDIAN or not.
cat > conftest.$ac_ext <<EOF
#line 5867 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/param.h>
int main() {

#if BYTE_ORDER != BIG_ENDIAN
 not big endian
#endif
; return 0; }
EOF
if { (eval echo configure:5878: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  rm -rf conftest*
  ac_cv_c_bigendian=yes
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  ac_cv_c_bigendian=no
fi
rm -f conftest*
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
fi
rm -f conftest*
if test $ac_cv_c_bigendian = unknown; then
if test "$cross_compiling" = yes; then
    { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
  cat > conftest.$ac_ext <<EOF
#line 5898 "configure"
#include "confdefs.h"
main () {
  /* Are we little or big endian?  From Harbison&Steele.  */
  union
  {
    long l;
    char c[sizeof (long)];
  } u;
  u.l = 1;
  exit (u.c[sizeof (long) - 1] == 1);
}
EOF
if { (eval echo configure:5911: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
  ac_cv_c_bigendian=no
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -fr conftest*
  ac_cv_c_bigendian=yes
fi
rm -fr conftest*
fi

fi
fi

echo "$ac_t""$ac_cv_c_bigendian" 1>&6
if test $ac_cv_c_bigendian = yes; then
  cat >> confdefs.h <<\EOF
#define WORDS_BIGENDIAN 1
EOF

fi

# AC_C_CHAR_UNSIGNED
# AC_C_CONST
# AC_C_LONG_DOUBLE
# AC_TYPE_OFF_T
# AC_TYPE_PID_T
# AC_TYPE_SIZE_T
# AC_HEADER_TIME

# Check for library functions.
for ac_func in atexit getcwd yield snprintf atoll strtoll
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:5946: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  cat > conftest.$ac_ext <<EOF
#line 5951 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
    which can conflict with char $ac_func(); below.  */
#include <assert.h>
/* Override any gcc2 internal prototype to avoid an error.  */
/* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
char $ac_func();

int main() {

/* The GNU C library defines this for functions which it implements
    to always fail with ENOSYS.  Some functions are actually named
    something starting with __ and the normal name is an alias.  */
#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
choke me
#else
$ac_func();
#endif

; return 0; }
EOF
if { (eval echo configure:5974: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  rm -rf conftest*
  eval "ac_cv_func_$ac_func=yes"
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  eval "ac_cv_func_$ac_func=no"
fi
rm -f conftest*
fi

if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
  echo "$ac_t""yes" 1>&6
    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
  cat >> confdefs.h <<EOF
#define $ac_tr_func 1
EOF
 
else
  echo "$ac_t""no" 1>&6
fi
done


# Really crude checks for prototypes

echo $ac_n "checking for prototype of snprintf""... $ac_c" 1>&6
echo "configure:6002: checking for prototype of snprintf" >&5
func=snprintf
rm -f conftest.c
cat > conftest.c <<EOF
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <string.h>
#include <strings.h>
#include <netdb.h>
#include <unistd.h>

int main(int argc, char **argv)
{ return 0; }
EOF
echo configure:6017: $CPP $CFLAGS conftest.c >&5
$CPP $CPPFLAGS conftest.c > conftest.out 2>&5
e1="egrep '[^A-Za-z0-9_]$func[	 ]*\(' conftest.out"
e2="egrep '^$func[	 ]*\(' conftest.out"
if test "`eval $e1`" != "" -o "`eval $e2`" != ""; then
    cat >> confdefs.h <<EOF
#define LAM_HAVE_${func}_PROTO 1
EOF

    echo "$ac_t""yes" 1>&6
else
    echo configure:6028: here is the program that failed: >&5
    cat conftest.c >&5
    cat >> confdefs.h <<EOF
#define LAM_HAVE_${func}_PROTO 0
EOF

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


echo $ac_n "checking for prototype of gethostname""... $ac_c" 1>&6
echo "configure:6040: checking for prototype of gethostname" >&5
func=gethostname
rm -f conftest.c
cat > conftest.c <<EOF
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <string.h>
#include <strings.h>
#include <netdb.h>
#include <unistd.h>

int main(int argc, char **argv)
{ return 0; }
EOF
echo configure:6055: $CPP $CFLAGS conftest.c >&5
$CPP $CPPFLAGS conftest.c > conftest.out 2>&5
e1="egrep '[^A-Za-z0-9_]$func[	 ]*\(' conftest.out"
e2="egrep '^$func[	 ]*\(' conftest.out"
if test "`eval $e1`" != "" -o "`eval $e2`" != ""; then
    cat >> confdefs.h <<EOF
#define LAM_HAVE_${func}_PROTO 1
EOF

    echo "$ac_t""yes" 1>&6
else
    echo configure:6066: here is the program that failed: >&5
    cat conftest.c >&5
    cat >> confdefs.h <<EOF
#define LAM_HAVE_${func}_PROTO 0
EOF

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


# JMS Take out the solaris one right now in favor of normal "yield"
# (checked for above), because until minutes ago, this test was broken
# and sched_yield was not found on Solaris.  However, I don't want to
# investigate the possibility of including -lposix4 on Solaris right
# now -- the next release of LAM is immanent.  Perhaps later...
case $host in
#    *solaris*) LAM_CHECK_FUNC(sched_yield, HAVE_SCHED_YIELD, -lposix4)
#	;;
    *) for ac_func in sched_yield
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:6088: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  cat > conftest.$ac_ext <<EOF
#line 6093 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
    which can conflict with char $ac_func(); below.  */
#include <assert.h>
/* Override any gcc2 internal prototype to avoid an error.  */
/* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
char $ac_func();

int main() {

/* The GNU C library defines this for functions which it implements
    to always fail with ENOSYS.  Some functions are actually named
    something starting with __ and the normal name is an alias.  */
#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
choke me
#else
$ac_func();
#endif

; return 0; }
EOF
if { (eval echo configure:6116: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  rm -rf conftest*
  eval "ac_cv_func_$ac_func=yes"
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  eval "ac_cv_func_$ac_func=no"
fi
rm -f conftest*
fi

if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
  echo "$ac_t""yes" 1>&6
    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
  cat >> confdefs.h <<EOF
#define $ac_tr_func 1
EOF
 
else
  echo "$ac_t""no" 1>&6
fi
done

	;;
esac

# #$%^#$%^$#%^ IRIX 7.3 MIPSpro compilers...
have_sys_types=1
if test "`grep sys/types.h confdefs.h`" = ""; then
    echo "#include <sys/types.h>" >> confdefs.h
    have_sys_types=0
fi
for ac_hdr in stropts.h grp.h netinet/tcp.h rpc/types.h rpc/xdr.h pty.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:6153: checking for $ac_hdr" >&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 6158 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:6163: \"$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
    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
  cat >> confdefs.h <<EOF
#define $ac_tr_hdr 1
EOF
 
else
  echo "$ac_t""no" 1>&6
fi
done

if test "$have_sys_types" = "0"; then
    rm -f confdefs.h.new
    grep -v sys/types.h confdefs.h > confdefs.h.new
    mv confdefs.h.new confdefs.h
fi
echo $ac_n "checking if SA_RESTART defined in signal.h""... $ac_c" 1>&6
echo "configure:6195: checking if SA_RESTART defined in signal.h" >&5
if eval "test \"`echo '$''{'lam_cv_def_sa_restart'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  cat > conftest.$ac_ext <<EOF
#line 6200 "configure"
#include "confdefs.h"

#include <signal.h>
#ifdef SA_RESTART
    yes
#endif 
EOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
  egrep "yes" >/dev/null 2>&1; then
  rm -rf conftest*
  lam_cv_def_sa_restart=yes
else
  rm -rf conftest*
  lam_cv_def_sa_restart=no
fi
rm -f conftest*


fi

echo "$ac_t""$lam_cv_def_sa_restart" 1>&6
if test $lam_cv_def_sa_restart = yes; then
    cat >> confdefs.h <<\EOF
#define LAM_HAVE_SA_RESTART 1
EOF

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

fi

echo $ac_n "checking for sa_len in struct sockaddr""... $ac_c" 1>&6
echo "configure:6235: checking for sa_len in struct sockaddr" >&5
if eval "test \"`echo '$''{'lam_cv_struct_sa_len'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  cat > conftest.$ac_ext <<EOF
#line 6240 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/socket.h>
int main() {
struct sockaddr s; s.sa_len;
; return 0; }
EOF
if { (eval echo configure:6248: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  rm -rf conftest*
  lam_cv_struct_sa_len=yes
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  lam_cv_struct_sa_len=no
fi
rm -f conftest*
fi

echo "$ac_t""$lam_cv_struct_sa_len" 1>&6
if test $lam_cv_struct_sa_len = yes; then
  cat >> confdefs.h <<\EOF
#define LAM_HAVE_SA_LEN 1
EOF

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

fi

echo $ac_n "checking for union semun in sys/sem.h""... $ac_c" 1>&6
echo "configure:6274: checking for union semun in sys/sem.h" >&5
if eval "test \"`echo '$''{'lam_cv_union_semun'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  cat > conftest.$ac_ext <<EOF
#line 6279 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/sem.h>
int main() {
union semun s; s.val;
; return 0; }
EOF
if { (eval echo configure:6287: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  rm -rf conftest*
  lam_cv_union_semun=yes
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  lam_cv_union_semun=no
fi
rm -f conftest*
fi

echo "$ac_t""$lam_cv_union_semun" 1>&6
if test $lam_cv_union_semun = yes; then
  cat >> confdefs.h <<\EOF
#define LAM_HAVE_UNION_SEMUN 1
EOF

fi

# This is complicated enough to warrant a long explanation.
#
# So apparently, in 64 bit mode on AIX 4.3.3, fcntl(F_SETFL,
# O_NONBLOCK) (you get the idea) is broken.  Sometimes.  i.e.,
# sometimes, setting a socket to go into blocking mode just doesn't
# work.  When it doesn't work, read() will return -1 and set errno to
# EAGAIN, which is nonblocking behavior.  But when the socket is
# supposed to be in blocking mode, LAM doesn't look at errno -- it
# just sees the -1 and decides that "a process in the local group is
# dead".  
#
# So we originally put in a test to check for FIONBIO and to use
# ioctl(FIONBIO) instead of fcntl() wherever FIONBIO exists.  However,
# at least on one system (HP-UX 10.20), FIONBIO is broken, and fcntl()
# works.  The argument was made that we *know* that fcntl() works
# everywhere except AIX 4.3.3 (since LAM has always only had fcntl(),
# not ioctl()).  Plus, Stevens (the networking book) says that POSIX
# says use fcntl().  
#
# Hence, we are now special-casing AIX 4.3.3 -- if we are on AIX, look
# for FIONBIO.  If it's there, use ioctl.  Otherwise, always use
# fcntl().  Yet another reason that AIX absolutely sucks.

case "$host" in
*aix*)
    echo $ac_n "checking if FIONBIO defined in sys/ioctl.h""... $ac_c" 1>&6
echo "configure:6333: checking if FIONBIO defined in sys/ioctl.h" >&5
if eval "test \"`echo '$''{'lam_cv_def_fionbio'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  cat > conftest.$ac_ext <<EOF
#line 6338 "configure"
#include "confdefs.h"

#include <sys/ioctl.h>
#ifdef FIONBIO
    yes
#endif 
EOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
  egrep "yes" >/dev/null 2>&1; then
  rm -rf conftest*
  lam_cv_def_fionbio=yes
else
  rm -rf conftest*
  lam_cv_def_fionbio=no
fi
rm -f conftest*

fi

echo "$ac_t""$lam_cv_def_fionbio" 1>&6
    if test $lam_cv_def_fionbio = yes; then
	cat >> confdefs.h <<\EOF
#define LAM_HAVE_FIONBIO 1
EOF

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

    fi
    ;;
*)
    # If we're not on AIX, just use fcntl
    echo $ac_n "checking if FIONBIO defined in sys/ioctl.h""... $ac_c" 1>&6
echo "configure:6374: checking if FIONBIO defined in sys/ioctl.h" >&5
    cat >> confdefs.h <<\EOF
#define LAM_HAVE_FIONBIO 0
EOF

    echo "$ac_t""not on AIX 4.3.3, so who cares?" 1>&6
    ;;
esac

echo $ac_n "checking if need to include sys/select.h""... $ac_c" 1>&6
echo "configure:6384: checking if need to include sys/select.h" >&5
if eval "test \"`echo '$''{'lam_cv_need_sys_select_h'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  cat > conftest.$ac_ext <<EOF
#line 6389 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/socket.h>
int main() {
fd_set s; FD_ZERO(&s);
; return 0; }
EOF
if { (eval echo configure:6397: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  rm -rf conftest*
  lam_cv_need_sys_select_h=no
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  lam_cv_need_sys_select_h=yes
fi
rm -f conftest*
fi

echo "$ac_t""$lam_cv_need_sys_select_h" 1>&6
if test $lam_cv_need_sys_select_h = yes; then
  cat >> confdefs.h <<\EOF
#define LAM_NEED_SYS_SELECT_H 1
EOF

fi

echo $ac_n "checking for BSD43 style file descriptor passing""... $ac_c" 1>&6
echo "configure:6418: checking for BSD43 style file descriptor passing" >&5
if eval "test \"`echo '$''{'lam_cv_have_bsd43_fd_passing'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  cat > conftest.$ac_ext <<EOF
#line 6423 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/socket.h>
int main() {
struct msghdr m; m.msg_accrights = 0;
; return 0; }
EOF
if { (eval echo configure:6431: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  rm -rf conftest*
  lam_cv_have_bsd43_fd_passing=yes
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  lam_cv_have_bsd43_fd_passing=no
fi
rm -f conftest*
fi

echo "$ac_t""$lam_cv_have_bsd43_fd_passing" 1>&6
if test $lam_cv_have_bsd43_fd_passing = yes; then
  cat >> confdefs.h <<\EOF
#define LAM_HAVE_BSD43_FD_PASSING 1
EOF

fi

echo $ac_n "checking for BSD44 style file descriptor passing""... $ac_c" 1>&6
echo "configure:6452: checking for BSD44 style file descriptor passing" >&5
if eval "test \"`echo '$''{'lam_cv_have_bsd44_fd_passing'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  cat > conftest.$ac_ext <<EOF
#line 6457 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
int main() {
struct cmsghdr c; 
struct msghdr m; 
c.cmsg_type = 0;
m.msg_control = 0;
; return 0; }
EOF
if { (eval echo configure:6469: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  rm -rf conftest*
  lam_cv_have_bsd44_fd_passing=yes
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  lam_cv_have_bsd44_fd_passing=no
fi
rm -f conftest*
fi

echo "$ac_t""$lam_cv_have_bsd44_fd_passing" 1>&6
if test $lam_cv_have_bsd44_fd_passing = yes; then
  cat >> confdefs.h <<\EOF
#define LAM_HAVE_BSD44_FD_PASSING 1
EOF

fi

if test "$lam_cv_have_bsd44_fd_passing" = "yes"; then
    

# The reason for this test is complicated.  It's mainly because some
# OS's (cough cough RH 7.1 cough cough) have an incorrect underlying
# socket.h file.  More to the point, the STREAMS macro for assinging
# data to a control message header (CMSG_DATA) is incorrect when using
# anything other than gcc.  #@#%0@$%#!!!!!!  This causes Much
# Badness when using things like pgcc, KCC, IA64 compilers, etc.  But,
# of course, it always works like a champ with gcc.  @%0@%#%$

# We have mailed in a patch to both RH (to fix their
# /usr/include/bits/socket.h) and to the Portland Group (so that they
# can override the system socket.h with their own [corrected]
# version).  It will take time to propogate these fixes out into the
# Real World, so we're providing a workaround for all broken
# instances.

# Save the current language (just in case)

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


echo $ac_n "checking if BSD44 CMSD_DATA macro is broken""... $ac_c" 1>&6
echo "configure:6518: checking if BSD44 CMSD_DATA macro is broken" >&5

# Use a short test program
if test "$cross_compiling" = yes; then
  CMSG_BROKEN=0 MSG="no"
else
  cat > conftest.$ac_ext <<EOF
#line 6525 "configure"
#include "confdefs.h"
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/uio.h>
#include <errno.h>
#include <stddef.h>
#include <sys/un.h>

typedef struct cmsgfd
{
  struct cmsghdr ctl;		/* control message header */
  int dummy;			/* space for file descriptor */
} cmsgfd_t;

/*
 * Global so that we can kill the child if the parent barfs
 */
pid_t child_pid = 0;


int sfh_send_fd(int stream, int fd);
int sfh_recv_fd(int stream);


int
main(int argc, char **argv)
{
  int fd[2];

  if (socketpair(AF_UNIX, SOCK_STREAM, 0, fd)) {
    perror("pipe");
    exit(-1);
  }

  if ((child_pid = fork()) < 0) {
    perror("fork");
  } else if (child_pid > 0) {
    /* I am the parent... */
    if (sfh_send_fd(fd[0], 0)) {
      exit(-1);
    }
  } else {
    /* I am the child... */
    if (sfh_recv_fd(fd[1]) == -1) {
      exit(-1);
    }
  }

  return 0;
}


/*
 * Send a file descriptor using STREAMS.  Does it work?
 */
int
sfh_send_fd(int stream, int fd)
{
  struct iovec iov[1];
  struct msghdr msg;
  char buf[1];
  cmsgfd_t ctlfd;
  int r;
  int status;

  iov[0].iov_base = buf;
  iov[0].iov_len = 1;
  msg.msg_iov = iov;
  msg.msg_iovlen = 1;
  msg.msg_name = NULL;
  msg.msg_namelen = 0;
  msg.msg_control = (caddr_t) & ctlfd;
  msg.msg_controllen = (sizeof(cmsgfd_t));

  ctlfd.ctl.cmsg_level = SOL_SOCKET;
  ctlfd.ctl.cmsg_type = SCM_RIGHTS;
  ctlfd.ctl.cmsg_len = (sizeof(cmsgfd_t));
  *(int *) CMSG_DATA(&ctlfd.ctl) = fd;

  do {
    r = sendmsg(stream, &msg, 0);
    if (r == 1)
      break;
    else if (r < 0 && errno == EINTR)
      continue;
    else {
      /* Renice?  You must mean kill -9. */
      kill(child_pid, 9);
      waitpid(child_pid, &status, 0);
      return (-1);
    }
  } while (1);

  return (0);
}


/*
 * Receive a file descriptor using STREAMS.
 */
int
sfh_recv_fd(int stream)
{
  struct msghdr msg;
  struct iovec iov[1];
  char buf[1];
  cmsgfd_t ctlfd;
  int r;

  iov[0].iov_base = buf;
  iov[0].iov_len = 1;
  msg.msg_iov = iov;
  msg.msg_iovlen = 1;
  msg.msg_name = (caddr_t) 0;
  msg.msg_namelen = 0;
  msg.msg_control = (caddr_t) & ctlfd.ctl;
  msg.msg_controllen = (sizeof(cmsgfd_t));

  do {
    r = recvmsg(stream, &msg, 0);
    if (r == 1)
      break;
    else if (r < 0 && errno == EINTR)
      continue;
    else
      return (-1);
  } while (1);

  return (*(int *) CMSG_DATA(&ctlfd.ctl));
}
EOF
if { (eval echo configure:6658: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
  CMSG_BROKEN=0 MSG="no"
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -fr conftest*
  CMSG_BROKEN=1 MSG="yes"
fi
rm -fr conftest*
fi


# Save the results
echo "$ac_t""$MSG" 1>&6
cat >> confdefs.h <<EOF
#define LAM_CMSG_DATA_BROKEN $CMSG_BROKEN
EOF


# Restore
unset MSG CMSG_BROKEN
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

fi

echo $ac_n "checking for SYSV style file descriptor passing""... $ac_c" 1>&6
echo "configure:6690: checking for SYSV style file descriptor passing" >&5
if eval "test \"`echo '$''{'lam_cv_have_sysv_fd_passing'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  cat > conftest.$ac_ext <<EOF
#line 6695 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/stropts.h>
int main() {
struct strrecvfd c; c.fd = 0;
; return 0; }
EOF
if { (eval echo configure:6704: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  rm -rf conftest*
  lam_cv_have_sysv_fd_passing=yes
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  lam_cv_have_sysv_fd_passing=no
fi
rm -f conftest*
fi

echo "$ac_t""$lam_cv_have_sysv_fd_passing" 1>&6
if test $lam_cv_have_sysv_fd_passing = yes; then
  cat >> confdefs.h <<\EOF
#define LAM_HAVE_SVR4_FD_PASSING 1
EOF

fi

#
# Do we have openpty()?
# In Linux, openpty is in -lutil -- it is VERY IMPORTANT TO ADD -lutil
# TO LIBS SO THAT LAM_CHECK_FUNC WORKS PROPERLY!
#
configure_libs_SAVE="$LIBS"
echo $ac_n "checking for login in -lutil""... $ac_c" 1>&6
echo "configure:6731: checking for login in -lutil" >&5
ac_lib_var=`echo util'_'login | 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="-lutil  $LIBS"
cat > conftest.$ac_ext <<EOF
#line 6739 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error.  */
/* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
char login();

int main() {
login()
; return 0; }
EOF
if { (eval echo configure:6750: \"$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
  SYSLIBS="$SYSLIBS -lutil" LIBS="$LIBS -lutil"
else
  echo "$ac_t""no" 1>&6
fi


# Determine if function taking void args is available. 
# First arg is function, 2nd arg is config var to define, 3rd arg is options
# to add to link line.
LIBS_save="$LIBS"
LIBS="$LIBS "
echo $ac_n "checking for openpty""... $ac_c" 1>&6
echo "configure:6777: checking for openpty" >&5
if eval "test \"`echo '$''{'ac_cv_func_openpty'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  cat > conftest.$ac_ext <<EOF
#line 6782 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
    which can conflict with char openpty(); below.  */
#include <assert.h>
/* Override any gcc2 internal prototype to avoid an error.  */
/* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
char openpty();

int main() {

/* The GNU C library defines this for functions which it implements
    to always fail with ENOSYS.  Some functions are actually named
    something starting with __ and the normal name is an alias.  */
#if defined (__stub_openpty) || defined (__stub___openpty)
choke me
#else
openpty();
#endif

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

if eval "test \"`echo '$ac_cv_func_'openpty`\" = yes"; then
  echo "$ac_t""yes" 1>&6
  FOUND_FUNC=1
else
  echo "$ac_t""no" 1>&6
FOUND_FUNC=0
fi

LIBS="$LIBS_save"
if test "$FOUND_FUNC" = "1"; then
    cat >> confdefs.h <<EOF
#define LAM_HAVE_OPENPTY 1
EOF

else
    cat >> confdefs.h <<EOF
#define LAM_HAVE_OPENPTY 0
EOF

fi
unset LIBS_save FOUND_FUNC
LIBS="$configure_libs_SAVE"

#
# How about other PTY things?
#
echo $ac_n "checking for BSD ptys""... $ac_c" 1>&6
echo "configure:6844: checking for BSD ptys" >&5
if eval "test \"`echo '$''{'lam_cv_have_bsd_ptys'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  if test -r /dev/ptyp0 -a -w /dev/ptyp0; then
lam_cv_have_bsd_ptys=yes
else
lam_cv_have_bsd_ptys=no
fi
fi

echo "$ac_t""$lam_cv_have_bsd_ptys" 1>&6
if test $lam_cv_have_bsd_ptys = yes; then
  cat >> confdefs.h <<\EOF
#define LAM_HAVE_BSD_PTYS 1
EOF

fi

echo $ac_n "checking for SYSV ptys""... $ac_c" 1>&6
echo "configure:6864: checking for SYSV ptys" >&5
if eval "test \"`echo '$''{'lam_cv_have_sysv_ptys'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  if test -r /dev/ptmx -a -w /dev/ptmx; then
lam_cv_have_sysv_ptys=yes
else
lam_cv_have_sysv_ptys=no
fi
fi

echo "$ac_t""$lam_cv_have_sysv_ptys" 1>&6
if test $lam_cv_have_sysv_ptys = yes; then
  cat >> confdefs.h <<\EOF
#define LAM_HAVE_SYSV_PTYS 1
EOF

fi

if test $lam_cv_have_sysv_ptys = no -a $lam_cv_have_bsd_ptys = no; then
   echo "configure: warning: neither BSD or SYSV ptys are available" 1>&2
fi

# 
# We delayed substituting in SYSLIBS and HBIND until now because the
# pty tests may change those values.
#


cat >> confdefs.h <<EOF
#define LAM_SYSLIBS "$SYSLIBS"
EOF

cat >> confdefs.h <<EOF
#define LAM_HBIND "$HBIND"
EOF


# check for <sched.h>
for ac_hdr in sched.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:6907: checking for $ac_hdr" >&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 6912 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:6917: \"$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
    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
  cat >> confdefs.h <<EOF
#define $ac_tr_hdr 1
EOF
 
else
  echo "$ac_t""no" 1>&6
fi
done

# check for <strings.h>
for ac_hdr in strings.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:6948: checking for $ac_hdr" >&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 6953 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:6958: \"$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
    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
  cat >> confdefs.h <<EOF
#define $ac_tr_hdr 1
EOF
 
else
  echo "$ac_t""no" 1>&6
fi
done


if test ! -d romio; then
    mkdir romio
    mkdir romio/lib
fi

# At least AIX 4.3 has things like int8 already defined

# Autoconfs AC_CHECK_TYPE is not sufficient
# This, too, is not foolproof, but will have to do...
echo $ac_n "checking for type int2""... $ac_c" 1>&6
echo "configure:6995: checking for type int2" >&5
cat > conftest.$ac_ext <<EOF
#line 3411 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
#include <stdlib.h>
#include <stddef.h>
#endif
EOF
touch conftest.out >&5 2>&5
rm -f conftest.out >&5 2>&5
eval "$ac_cpp conftest.$ac_ext" 2>&5 > conftest.out
egrep "int2[^a-zA-Z_0-9]" conftest.out > conftest.out2 2>&5
cat conftest.out2 >&5
out="`cat conftest.out2`"
if test "$out" != ""; then
  cat >> confdefs.h <<\EOF
#define LAM_HAVE_int2 1
EOF

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

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


# Autoconfs AC_CHECK_TYPE is not sufficient
# This, too, is not foolproof, but will have to do...
echo $ac_n "checking for type uint2""... $ac_c" 1>&6
echo "configure:7030: checking for type uint2" >&5
cat > conftest.$ac_ext <<EOF
#line 3411 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
#include <stdlib.h>
#include <stddef.h>
#endif
EOF
touch conftest.out >&5 2>&5
rm -f conftest.out >&5 2>&5
eval "$ac_cpp conftest.$ac_ext" 2>&5 > conftest.out
egrep "uint2[^a-zA-Z_0-9]" conftest.out > conftest.out2 2>&5
cat conftest.out2 >&5
out="`cat conftest.out2`"
if test "$out" != ""; then
  cat >> confdefs.h <<\EOF
#define LAM_HAVE_uint2 1
EOF

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

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


# Autoconfs AC_CHECK_TYPE is not sufficient
# This, too, is not foolproof, but will have to do...
echo $ac_n "checking for type int4""... $ac_c" 1>&6
echo "configure:7065: checking for type int4" >&5
cat > conftest.$ac_ext <<EOF
#line 3411 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
#include <stdlib.h>
#include <stddef.h>
#endif
EOF
touch conftest.out >&5 2>&5
rm -f conftest.out >&5 2>&5
eval "$ac_cpp conftest.$ac_ext" 2>&5 > conftest.out
egrep "int4[^a-zA-Z_0-9]" conftest.out > conftest.out2 2>&5
cat conftest.out2 >&5
out="`cat conftest.out2`"
if test "$out" != ""; then
  cat >> confdefs.h <<\EOF
#define LAM_HAVE_int4 1
EOF

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

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


# Autoconfs AC_CHECK_TYPE is not sufficient
# This, too, is not foolproof, but will have to do...
echo $ac_n "checking for type uint4""... $ac_c" 1>&6
echo "configure:7100: checking for type uint4" >&5
cat > conftest.$ac_ext <<EOF
#line 3411 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
#include <stdlib.h>
#include <stddef.h>
#endif
EOF
touch conftest.out >&5 2>&5
rm -f conftest.out >&5 2>&5
eval "$ac_cpp conftest.$ac_ext" 2>&5 > conftest.out
egrep "uint4[^a-zA-Z_0-9]" conftest.out > conftest.out2 2>&5
cat conftest.out2 >&5
out="`cat conftest.out2`"
if test "$out" != ""; then
  cat >> confdefs.h <<\EOF
#define LAM_HAVE_uint4 1
EOF

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

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


# Autoconfs AC_CHECK_TYPE is not sufficient
# This, too, is not foolproof, but will have to do...
echo $ac_n "checking for type int8""... $ac_c" 1>&6
echo "configure:7135: checking for type int8" >&5
cat > conftest.$ac_ext <<EOF
#line 3411 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
#include <stdlib.h>
#include <stddef.h>
#endif
EOF
touch conftest.out >&5 2>&5
rm -f conftest.out >&5 2>&5
eval "$ac_cpp conftest.$ac_ext" 2>&5 > conftest.out
egrep "int8[^a-zA-Z_0-9]" conftest.out > conftest.out2 2>&5
cat conftest.out2 >&5
out="`cat conftest.out2`"
if test "$out" != ""; then
  cat >> confdefs.h <<\EOF
#define LAM_HAVE_int8 1
EOF

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

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


# Autoconfs AC_CHECK_TYPE is not sufficient
# This, too, is not foolproof, but will have to do...
echo $ac_n "checking for type uint8""... $ac_c" 1>&6
echo "configure:7170: checking for type uint8" >&5
cat > conftest.$ac_ext <<EOF
#line 3411 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
#include <stdlib.h>
#include <stddef.h>
#endif
EOF
touch conftest.out >&5 2>&5
rm -f conftest.out >&5 2>&5
eval "$ac_cpp conftest.$ac_ext" 2>&5 > conftest.out
egrep "uint8[^a-zA-Z_0-9]" conftest.out > conftest.out2 2>&5
cat conftest.out2 >&5
out="`cat conftest.out2`"
if test "$out" != ""; then
  cat >> confdefs.h <<\EOF
#define LAM_HAVE_uint8 1
EOF

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

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


# Autoconfs AC_CHECK_TYPE is not sufficient
# This, too, is not foolproof, but will have to do...
echo $ac_n "checking for type float4""... $ac_c" 1>&6
echo "configure:7205: checking for type float4" >&5
cat > conftest.$ac_ext <<EOF
#line 3411 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
#include <stdlib.h>
#include <stddef.h>
#endif
EOF
touch conftest.out >&5 2>&5
rm -f conftest.out >&5 2>&5
eval "$ac_cpp conftest.$ac_ext" 2>&5 > conftest.out
egrep "float4[^a-zA-Z_0-9]" conftest.out > conftest.out2 2>&5
cat conftest.out2 >&5
out="`cat conftest.out2`"
if test "$out" != ""; then
  cat >> confdefs.h <<\EOF
#define LAM_HAVE_float4 1
EOF

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

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


# Autoconfs AC_CHECK_TYPE is not sufficient
# This, too, is not foolproof, but will have to do...
echo $ac_n "checking for type float8""... $ac_c" 1>&6
echo "configure:7240: checking for type float8" >&5
cat > conftest.$ac_ext <<EOF
#line 3411 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
#include <stdlib.h>
#include <stddef.h>
#endif
EOF
touch conftest.out >&5 2>&5
rm -f conftest.out >&5 2>&5
eval "$ac_cpp conftest.$ac_ext" 2>&5 > conftest.out
egrep "float8[^a-zA-Z_0-9]" conftest.out > conftest.out2 2>&5
cat conftest.out2 >&5
out="`cat conftest.out2`"
if test "$out" != ""; then
  cat >> confdefs.h <<\EOF
#define LAM_HAVE_float8 1
EOF

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

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


# Type sizes

# Determine datatype size. 
# First arg is type, 2nd (optional) arg is config var to define.
echo $ac_n "checking size of short""... $ac_c" 1>&6
echo "configure:7277: checking size of short" >&5
cat > conftest.c <<EOF
#include <stddef.h>
#include <stdio.h>
int main(int argc, char** argv)
{
    FILE *f=fopen("conftestval", "w");
    if (!f) return 1;
    fprintf(f, "%d\n", sizeof(short));
    return 0;
}
EOF
$CC $CFLAGS -o conftest conftest.c 1>&5 2>&1
if test -s conftest && (./conftest; exit) 2>/dev/null; then
    lam_ac_size=`cat conftestval`
else
    lam_ac_size=0
fi
echo "$ac_t""$lam_ac_size" 1>&6
if test -n "LAM_SIZEOF_SHORT"; then
    cat >> confdefs.h <<EOF
#define LAM_SIZEOF_SHORT $lam_ac_size
EOF

fi
/bin/rm -f conftest*

# Determine datatype size. 
# First arg is type, 2nd (optional) arg is config var to define.
echo $ac_n "checking size of wchar_t""... $ac_c" 1>&6
echo "configure:7307: checking size of wchar_t" >&5
cat > conftest.c <<EOF
#include <stddef.h>
#include <stdio.h>
int main(int argc, char** argv)
{
    FILE *f=fopen("conftestval", "w");
    if (!f) return 1;
    fprintf(f, "%d\n", sizeof(wchar_t));
    return 0;
}
EOF
$CC $CFLAGS -o conftest conftest.c 1>&5 2>&1
if test -s conftest && (./conftest; exit) 2>/dev/null; then
    lam_ac_size=`cat conftestval`
else
    lam_ac_size=0
fi
echo "$ac_t""$lam_ac_size" 1>&6
if test -n "LAM_SIZEOF_WCHAR"; then
    cat >> confdefs.h <<EOF
#define LAM_SIZEOF_WCHAR $lam_ac_size
EOF

fi
/bin/rm -f conftest*

# Determine datatype size. 
# First arg is type, 2nd (optional) arg is config var to define.
echo $ac_n "checking size of int""... $ac_c" 1>&6
echo "configure:7337: checking size of int" >&5
cat > conftest.c <<EOF
#include <stddef.h>
#include <stdio.h>
int main(int argc, char** argv)
{
    FILE *f=fopen("conftestval", "w");
    if (!f) return 1;
    fprintf(f, "%d\n", sizeof(int));
    return 0;
}
EOF
$CC $CFLAGS -o conftest conftest.c 1>&5 2>&1
if test -s conftest && (./conftest; exit) 2>/dev/null; then
    lam_ac_size=`cat conftestval`
else
    lam_ac_size=0
fi
echo "$ac_t""$lam_ac_size" 1>&6
if test -n "LAM_SIZEOF_INT"; then
    cat >> confdefs.h <<EOF
#define LAM_SIZEOF_INT $lam_ac_size
EOF

fi
/bin/rm -f conftest*

# Determine datatype size. 
# First arg is type, 2nd (optional) arg is config var to define.
echo $ac_n "checking size of long""... $ac_c" 1>&6
echo "configure:7367: checking size of long" >&5
cat > conftest.c <<EOF
#include <stddef.h>
#include <stdio.h>
int main(int argc, char** argv)
{
    FILE *f=fopen("conftestval", "w");
    if (!f) return 1;
    fprintf(f, "%d\n", sizeof(long));
    return 0;
}
EOF
$CC $CFLAGS -o conftest conftest.c 1>&5 2>&1
if test -s conftest && (./conftest; exit) 2>/dev/null; then
    lam_ac_size=`cat conftestval`
else
    lam_ac_size=0
fi
echo "$ac_t""$lam_ac_size" 1>&6
if test -n "LAM_SIZEOF_LONG"; then
    cat >> confdefs.h <<EOF
#define LAM_SIZEOF_LONG $lam_ac_size
EOF

fi
/bin/rm -f conftest*

# Determine datatype size. 
# First arg is type, 2nd (optional) arg is config var to define.
echo $ac_n "checking size of long long""... $ac_c" 1>&6
echo "configure:7397: checking size of long long" >&5
cat > conftest.c <<EOF
#include <stddef.h>
#include <stdio.h>
int main(int argc, char** argv)
{
    FILE *f=fopen("conftestval", "w");
    if (!f) return 1;
    fprintf(f, "%d\n", sizeof(long long));
    return 0;
}
EOF
$CC $CFLAGS -o conftest conftest.c 1>&5 2>&1
if test -s conftest && (./conftest; exit) 2>/dev/null; then
    lam_ac_size=`cat conftestval`
else
    lam_ac_size=0
fi
echo "$ac_t""$lam_ac_size" 1>&6
if test -n "LAM_SIZEOF_LONG_LONG"; then
    cat >> confdefs.h <<EOF
#define LAM_SIZEOF_LONG_LONG $lam_ac_size
EOF

fi
/bin/rm -f conftest*

# Determine datatype size. 
# First arg is type, 2nd (optional) arg is config var to define.
echo $ac_n "checking size of float""... $ac_c" 1>&6
echo "configure:7427: checking size of float" >&5
cat > conftest.c <<EOF
#include <stddef.h>
#include <stdio.h>
int main(int argc, char** argv)
{
    FILE *f=fopen("conftestval", "w");
    if (!f) return 1;
    fprintf(f, "%d\n", sizeof(float));
    return 0;
}
EOF
$CC $CFLAGS -o conftest conftest.c 1>&5 2>&1
if test -s conftest && (./conftest; exit) 2>/dev/null; then
    lam_ac_size=`cat conftestval`
else
    lam_ac_size=0
fi
echo "$ac_t""$lam_ac_size" 1>&6
if test -n "LAM_SIZEOF_FLOAT"; then
    cat >> confdefs.h <<EOF
#define LAM_SIZEOF_FLOAT $lam_ac_size
EOF

fi
/bin/rm -f conftest*

# Determine datatype size. 
# First arg is type, 2nd (optional) arg is config var to define.
echo $ac_n "checking size of double""... $ac_c" 1>&6
echo "configure:7457: checking size of double" >&5
cat > conftest.c <<EOF
#include <stddef.h>
#include <stdio.h>
int main(int argc, char** argv)
{
    FILE *f=fopen("conftestval", "w");
    if (!f) return 1;
    fprintf(f, "%d\n", sizeof(double));
    return 0;
}
EOF
$CC $CFLAGS -o conftest conftest.c 1>&5 2>&1
if test -s conftest && (./conftest; exit) 2>/dev/null; then
    lam_ac_size=`cat conftestval`
else
    lam_ac_size=0
fi
echo "$ac_t""$lam_ac_size" 1>&6
if test -n "LAM_SIZEOF_DOUBLE"; then
    cat >> confdefs.h <<EOF
#define LAM_SIZEOF_DOUBLE $lam_ac_size
EOF

fi
/bin/rm -f conftest*

# Determine datatype size. 
# First arg is type, 2nd (optional) arg is config var to define.
echo $ac_n "checking size of long double""... $ac_c" 1>&6
echo "configure:7487: checking size of long double" >&5
cat > conftest.c <<EOF
#include <stddef.h>
#include <stdio.h>
int main(int argc, char** argv)
{
    FILE *f=fopen("conftestval", "w");
    if (!f) return 1;
    fprintf(f, "%d\n", sizeof(long double));
    return 0;
}
EOF
$CC $CFLAGS -o conftest conftest.c 1>&5 2>&1
if test -s conftest && (./conftest; exit) 2>/dev/null; then
    lam_ac_size=`cat conftestval`
else
    lam_ac_size=0
fi
echo "$ac_t""$lam_ac_size" 1>&6
if test -n "LAM_SIZEOF_LONG_DOUBLE"; then
    cat >> confdefs.h <<EOF
#define LAM_SIZEOF_LONG_DOUBLE $lam_ac_size
EOF

fi
/bin/rm -f conftest*

# Determine datatype size. 
# First arg is type, 2nd (optional) arg is config var to define.
echo $ac_n "checking size of void *""... $ac_c" 1>&6
echo "configure:7517: checking size of void *" >&5
cat > conftest.c <<EOF
#include <stddef.h>
#include <stdio.h>
int main(int argc, char** argv)
{
    FILE *f=fopen("conftestval", "w");
    if (!f) return 1;
    fprintf(f, "%d\n", sizeof(void *));
    return 0;
}
EOF
$CC $CFLAGS -o conftest conftest.c 1>&5 2>&1
if test -s conftest && (./conftest; exit) 2>/dev/null; then
    lam_ac_size=`cat conftestval`
else
    lam_ac_size=0
fi
echo "$ac_t""$lam_ac_size" 1>&6
if test -n "LAM_SIZEOF_VOID_P"; then
    cat >> confdefs.h <<EOF
#define LAM_SIZEOF_VOID_P $lam_ac_size
EOF

fi
/bin/rm -f conftest*

# Determine size of members of struct stat
echo $ac_n "checking size of struct stat members""... $ac_c" 1>&6
echo "configure:7546: checking size of struct stat members" >&5
cat > conftest.c <<EOF
#include <sys/stat.h>
#include <stdio.h>
main()
{
    struct stat foo;
    FILE *f=fopen("conftestval", "w");
    if (!f) exit(1);
    fprintf(f, "%d\n", sizeof(foo.st_dev));
    exit(0);
}
EOF
$CC $CFLAGS -o conftest conftest.c 1>&5 2>&1
if test -s conftest && (./conftest; exit) 2>/dev/null; then
    lam_stat_size=`cat conftestval`
else
    lam_stat_size=0
fi
echo "$ac_t""$lam_stat_size" 1>&6
if test "$lam_stat_size" = "4"; then
    cat >> confdefs.h <<\EOF
#define LAM_STAT_MEMBERS_INT4 1
EOF

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

fi
/bin/rm -f conftest*

# Determine type of optlen parameter of getsockopt()
echo $ac_n "checking type of getsockopt optlen parameter""... $ac_c" 1>&6
echo "configure:7581: checking type of getsockopt optlen parameter" >&5

try_getsockopt_optlen() {
    cat > conftest.c <<EOF
#include <sys/types.h>  
#include <sys/socket.h> 
int foobar(void *optval)
{
    $type optlen=0;
    return getsockopt(0, SOL_SOCKET, SO_SNDBUF, optval, &optlen);
}
EOF
    cat conftest.c >&5
    $CC $CFLAGS -c conftest.c 1> conftest.out 2>&1
    cat conftest.out >&5
    foo="wc conftest.out | awk '{ print $"
    foo="${foo}1 }'"
    ret=`eval $foo`
    rm -f conftest.*
}

types="socklen_t int size_t unsigned-int long unsigned-long"
for type in $types; do
    type=`echo $type | sed 's/-/ /g'`
    try_getsockopt_optlen
    if test "$ret" = "0"; then
        break
    fi
done
cat >> confdefs.h <<EOF
#define LAM_SOCK_OPTLEN_T $type
EOF

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

# Determine type of optlen parameter of getsockopt()
echo $ac_n "checking type of recvfrom length parameter""... $ac_c" 1>&6
echo "configure:7618: checking type of recvfrom length parameter" >&5

try_getsockopt_optlen() {
    cat > conftest.c <<EOF
#include <sys/types.h>  
#include <sys/socket.h> 
int foobar(void *buffer)
{
    $type optlen=0;
    return recvfrom(0, buffer, 0, 0, (struct sockaddr*) 0, &optlen);
}
EOF
    cat conftest.c >&5
    $CC $CFLAGS -c conftest.c 1> conftest.out 2>&1
    cat conftest.out >&5
    foo="wc conftest.out | awk '{ print $"
    foo="${foo}1 }'"
    ret=`eval $foo`
    rm -f conftest.*
}

types="socklen_t int size_t unsigned-int long unsigned-long"
for type in $types; do
    type=`echo $type | sed 's/-/ /g'`
    try_getsockopt_optlen
    if test "$ret" = "0"; then
        break
    fi
done
cat >> confdefs.h <<EOF
#define LAM_RECVFROM_LEN_T $type
EOF

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


# Determine datatype alignment. 
# First arg is type, 2nd arg is cache var, 3rd arg is config var to define.
echo $ac_n "checking alignment of short""... $ac_c" 1>&6
echo "configure:7657: checking alignment of short" >&5
if eval "test \"`echo '$''{'lam_cv_align_short'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  
cat > conftest.c <<EOF
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
struct foo { char c; short x; };
int main(int argc, char* argv)
{
    struct foo *p = (struct foo *) malloc(sizeof(struct foo));
    int diff;
    FILE *f=fopen("conftestval", "w");
    if (!f) return 1;
    diff = ((char *)&p->x) - ((char *)&p->c);
    fprintf(f, "%d\n", (diff >= 0) ? diff : -diff);
    return 0;
}
EOF
$CC $CFLAGS -o conftest conftest.c 1>&5 2>&1
if test -s conftest && (./conftest; exit) 2>/dev/null; then
    lam_cv_align_short=`cat conftestval`
else
    echo "configure: warning: error compiling/running conftest" 1>&2
fi
/bin/rm -f conftest*
fi

echo "$ac_t""$lam_cv_align_short" 1>&6
cat >> confdefs.h <<EOF
#define LAM_ALIGNMENT_SHORT $lam_cv_align_short
EOF


# Determine datatype alignment. 
# First arg is type, 2nd arg is cache var, 3rd arg is config var to define.
echo $ac_n "checking alignment of wchar_t""... $ac_c" 1>&6
echo "configure:7696: checking alignment of wchar_t" >&5
if eval "test \"`echo '$''{'lam_cv_align_wchar'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  
cat > conftest.c <<EOF
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
struct foo { char c; wchar_t x; };
int main(int argc, char* argv)
{
    struct foo *p = (struct foo *) malloc(sizeof(struct foo));
    int diff;
    FILE *f=fopen("conftestval", "w");
    if (!f) return 1;
    diff = ((char *)&p->x) - ((char *)&p->c);
    fprintf(f, "%d\n", (diff >= 0) ? diff : -diff);
    return 0;
}
EOF
$CC $CFLAGS -o conftest conftest.c 1>&5 2>&1
if test -s conftest && (./conftest; exit) 2>/dev/null; then
    lam_cv_align_wchar=`cat conftestval`
else
    echo "configure: warning: error compiling/running conftest" 1>&2
fi
/bin/rm -f conftest*
fi

echo "$ac_t""$lam_cv_align_wchar" 1>&6
cat >> confdefs.h <<EOF
#define LAM_ALIGNMENT_WCHAR $lam_cv_align_wchar
EOF


# Determine datatype alignment. 
# First arg is type, 2nd arg is cache var, 3rd arg is config var to define.
echo $ac_n "checking alignment of int""... $ac_c" 1>&6
echo "configure:7735: checking alignment of int" >&5
if eval "test \"`echo '$''{'lam_cv_align_int'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  
cat > conftest.c <<EOF
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
struct foo { char c; int x; };
int main(int argc, char* argv)
{
    struct foo *p = (struct foo *) malloc(sizeof(struct foo));
    int diff;
    FILE *f=fopen("conftestval", "w");
    if (!f) return 1;
    diff = ((char *)&p->x) - ((char *)&p->c);
    fprintf(f, "%d\n", (diff >= 0) ? diff : -diff);
    return 0;
}
EOF
$CC $CFLAGS -o conftest conftest.c 1>&5 2>&1
if test -s conftest && (./conftest; exit) 2>/dev/null; then
    lam_cv_align_int=`cat conftestval`
else
    echo "configure: warning: error compiling/running conftest" 1>&2
fi
/bin/rm -f conftest*
fi

echo "$ac_t""$lam_cv_align_int" 1>&6
cat >> confdefs.h <<EOF
#define LAM_ALIGNMENT_INT $lam_cv_align_int
EOF


# Determine datatype alignment. 
# First arg is type, 2nd arg is cache var, 3rd arg is config var to define.
echo $ac_n "checking alignment of long""... $ac_c" 1>&6
echo "configure:7774: checking alignment of long" >&5
if eval "test \"`echo '$''{'lam_cv_align_long'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  
cat > conftest.c <<EOF
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
struct foo { char c; long x; };
int main(int argc, char* argv)
{
    struct foo *p = (struct foo *) malloc(sizeof(struct foo));
    int diff;
    FILE *f=fopen("conftestval", "w");
    if (!f) return 1;
    diff = ((char *)&p->x) - ((char *)&p->c);
    fprintf(f, "%d\n", (diff >= 0) ? diff : -diff);
    return 0;
}
EOF
$CC $CFLAGS -o conftest conftest.c 1>&5 2>&1
if test -s conftest && (./conftest; exit) 2>/dev/null; then
    lam_cv_align_long=`cat conftestval`
else
    echo "configure: warning: error compiling/running conftest" 1>&2
fi
/bin/rm -f conftest*
fi

echo "$ac_t""$lam_cv_align_long" 1>&6
cat >> confdefs.h <<EOF
#define LAM_ALIGNMENT_LONG $lam_cv_align_long
EOF


# Determine datatype alignment. 
# First arg is type, 2nd arg is cache var, 3rd arg is config var to define.
echo $ac_n "checking alignment of long long""... $ac_c" 1>&6
echo "configure:7813: checking alignment of long long" >&5
if eval "test \"`echo '$''{'lam_cv_align_longlong'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  
cat > conftest.c <<EOF
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
struct foo { char c; long long x; };
int main(int argc, char* argv)
{
    struct foo *p = (struct foo *) malloc(sizeof(struct foo));
    int diff;
    FILE *f=fopen("conftestval", "w");
    if (!f) return 1;
    diff = ((char *)&p->x) - ((char *)&p->c);
    fprintf(f, "%d\n", (diff >= 0) ? diff : -diff);
    return 0;
}
EOF
$CC $CFLAGS -o conftest conftest.c 1>&5 2>&1
if test -s conftest && (./conftest; exit) 2>/dev/null; then
    lam_cv_align_longlong=`cat conftestval`
else
    echo "configure: warning: error compiling/running conftest" 1>&2
fi
/bin/rm -f conftest*
fi

echo "$ac_t""$lam_cv_align_longlong" 1>&6
cat >> confdefs.h <<EOF
#define LAM_ALIGNMENT_LONG_LONG $lam_cv_align_longlong
EOF


# Determine datatype alignment. 
# First arg is type, 2nd arg is cache var, 3rd arg is config var to define.
echo $ac_n "checking alignment of float""... $ac_c" 1>&6
echo "configure:7852: checking alignment of float" >&5
if eval "test \"`echo '$''{'lam_cv_align_float'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  
cat > conftest.c <<EOF
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
struct foo { char c; float x; };
int main(int argc, char* argv)
{
    struct foo *p = (struct foo *) malloc(sizeof(struct foo));
    int diff;
    FILE *f=fopen("conftestval", "w");
    if (!f) return 1;
    diff = ((char *)&p->x) - ((char *)&p->c);
    fprintf(f, "%d\n", (diff >= 0) ? diff : -diff);
    return 0;
}
EOF
$CC $CFLAGS -o conftest conftest.c 1>&5 2>&1
if test -s conftest && (./conftest; exit) 2>/dev/null; then
    lam_cv_align_float=`cat conftestval`
else
    echo "configure: warning: error compiling/running conftest" 1>&2
fi
/bin/rm -f conftest*
fi

echo "$ac_t""$lam_cv_align_float" 1>&6
cat >> confdefs.h <<EOF
#define LAM_ALIGNMENT_FLOAT $lam_cv_align_float
EOF


# Determine datatype alignment. 
# First arg is type, 2nd arg is cache var, 3rd arg is config var to define.
echo $ac_n "checking alignment of double""... $ac_c" 1>&6
echo "configure:7891: checking alignment of double" >&5
if eval "test \"`echo '$''{'lam_cv_align_double'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  
cat > conftest.c <<EOF
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
struct foo { char c; double x; };
int main(int argc, char* argv)
{
    struct foo *p = (struct foo *) malloc(sizeof(struct foo));
    int diff;
    FILE *f=fopen("conftestval", "w");
    if (!f) return 1;
    diff = ((char *)&p->x) - ((char *)&p->c);
    fprintf(f, "%d\n", (diff >= 0) ? diff : -diff);
    return 0;
}
EOF
$CC $CFLAGS -o conftest conftest.c 1>&5 2>&1
if test -s conftest && (./conftest; exit) 2>/dev/null; then
    lam_cv_align_double=`cat conftestval`
else
    echo "configure: warning: error compiling/running conftest" 1>&2
fi
/bin/rm -f conftest*
fi

echo "$ac_t""$lam_cv_align_double" 1>&6
cat >> confdefs.h <<EOF
#define LAM_ALIGNMENT_DOUBLE $lam_cv_align_double
EOF


# Determine datatype alignment. 
# First arg is type, 2nd arg is cache var, 3rd arg is config var to define.
echo $ac_n "checking alignment of long double""... $ac_c" 1>&6
echo "configure:7930: checking alignment of long double" >&5
if eval "test \"`echo '$''{'lam_cv_align_longdbl'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  
cat > conftest.c <<EOF
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
struct foo { char c; long double x; };
int main(int argc, char* argv)
{
    struct foo *p = (struct foo *) malloc(sizeof(struct foo));
    int diff;
    FILE *f=fopen("conftestval", "w");
    if (!f) return 1;
    diff = ((char *)&p->x) - ((char *)&p->c);
    fprintf(f, "%d\n", (diff >= 0) ? diff : -diff);
    return 0;
}
EOF
$CC $CFLAGS -o conftest conftest.c 1>&5 2>&1
if test -s conftest && (./conftest; exit) 2>/dev/null; then
    lam_cv_align_longdbl=`cat conftestval`
else
    echo "configure: warning: error compiling/running conftest" 1>&2
fi
/bin/rm -f conftest*
fi

echo "$ac_t""$lam_cv_align_longdbl" 1>&6
cat >> confdefs.h <<EOF
#define LAM_ALIGNMENT_LONG_DOUBLE $lam_cv_align_longdbl
EOF


# Determine datatype alignment. 
# First arg is type, 2nd arg is cache var, 3rd arg is config var to define.
echo $ac_n "checking alignment of void *""... $ac_c" 1>&6
echo "configure:7969: checking alignment of void *" >&5
if eval "test \"`echo '$''{'lam_cv_align_voidp'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  
cat > conftest.c <<EOF
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
struct foo { char c; void * x; };
int main(int argc, char* argv)
{
    struct foo *p = (struct foo *) malloc(sizeof(struct foo));
    int diff;
    FILE *f=fopen("conftestval", "w");
    if (!f) return 1;
    diff = ((char *)&p->x) - ((char *)&p->c);
    fprintf(f, "%d\n", (diff >= 0) ? diff : -diff);
    return 0;
}
EOF
$CC $CFLAGS -o conftest conftest.c 1>&5 2>&1
if test -s conftest && (./conftest; exit) 2>/dev/null; then
    lam_cv_align_voidp=`cat conftestval`
else
    echo "configure: warning: error compiling/running conftest" 1>&2
fi
/bin/rm -f conftest*
fi

echo "$ac_t""$lam_cv_align_voidp" 1>&6
cat >> confdefs.h <<EOF
#define LAM_ALIGNMENT_VOID_P $lam_cv_align_voidp
EOF


if test "$with_fc" != no; then
    
# Determine underscore generation for external names.
# arg is FORTRAN compiler name
echo $ac_n "checking $F77 external naming convention""... $ac_c" 1>&6
echo "configure:8010: checking $F77 external naming convention" >&5
cat > conftestf.f <<EOF
       subroutine FOO_bar(a)
       integer a
       a = 1
       return
       end
EOF
$F77 $FFLAGS -c conftestf.f 1>&5 2>&1
if test ! -s conftestf.o; then
    echo "configure: warning: unable to produce an object file testing FORTRAN compiler" 1>&2
else
    nm conftestf.o | grep foo_bar__ > /dev/null 2>&1
    if test $? = "0"; then 
	echo "$ac_t""FORTRANDOUBLEUNDERSCORE" 1>&6
	cat >> confdefs.h <<\EOF
#define LAM_FORTRANDOUBLEUNDERSCORE 1
EOF

	lam_ac_doubleunder=y
    else
	nm conftestf.o | grep foo_bar_ > /dev/null 2>&1
	if test $? = "0"; then 
	    echo "$ac_t""FORTRANUNDERSCORE" 1>&6
	    cat >> confdefs.h <<\EOF
#define LAM_FORTRANUNDERSCORE 1
EOF

	    lam_ac_singleunder=y
	else
	    # We may get into trouble here if we start accepting mixed
	    # case compilers -- we may need to have caps underscore,
	    # or caps double underscore, for example.  But we haven't
	    # found any that require that yet.  :-)
	    nm conftestf.o | grep FOO_bar > /dev/null 2>&1
	    if test $? = "0"; then 
		echo "$ac_t""mixed case, so FORTRANCAPS" 1>&6
		cat >> confdefs.h <<\EOF
#define LAM_FORTRANCAPS 1
EOF

		lam_ac_caps=y
	    else
		nm conftestf.o | grep foo_bar > /dev/null 2>&1
		if test $? = "0"; then 
		    echo "$ac_t""FORTRANNOUNDERSCORE" 1>&6
		    cat >> confdefs.h <<\EOF
#define LAM_FORTRANNOUNDERSCORE 1
EOF

		    lam_ac_nounder=y
		else
		    nm conftestf.o | grep FOO_BAR > /dev/null 2>&1
		    if test $? = "0"; then 
			echo "$ac_t""FORTRANCAPS" 1>&6
			cat >> confdefs.h <<\EOF
#define LAM_FORTRANCAPS 1
EOF

			lam_ac_caps=y
		    else
			echo "configure: warning: couldn't find name of subroutine foo_bar" 1>&2
		    fi
		fi
	    fi
	fi
    fi
fi
/bin/rm -f conftestf.f conftestf.o

    
# Determine FORTRAN datatype size.
# First arg is type, 2nd arg is cache var, 3rd arg is config var to define.
echo $ac_n "checking size of FORTRAN INTEGER""... $ac_c" 1>&6
echo "configure:8084: checking size of FORTRAN INTEGER" >&5
if eval "test \"`echo '$''{'lam_cv_size_fint'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  
lam_ac_size_fn=
if test "x$lam_ac_doubleunder" = xy || test "x$lam_ac_singleunder" = xy; then
    lam_ac_size_fn=size_
else
    if test "x$lam_ac_nounder" = xy; then
	lam_ac_size_fn=size
    else
	if test "x$lam_ac_caps" = xy; then
	    lam_ac_size_fn=SIZE
	else 
	    { echo "configure: error: FORTRAN external naming convention undefined" 1>&2; exit 1; }
	fi
    fi
fi
if test -n "$lam_ac_size_fn"; then
cat > conftestf.f <<EOF
       program fsize
       external SIZE
       INTEGER x(2)
       call SIZE(x(1),x(2))
       end
EOF
cat > conftest.c <<EOF
#include <stdio.h>
#ifdef __cplusplus
extern "C" {
#endif
void $lam_ac_size_fn(char *a, char *b)
{
    int diff = (int) (b - a);
    FILE *f=fopen("conftestval", "w");
    if (!f) return;
    fprintf(f, "%d\n", diff);
}
#ifdef __cplusplus
}
#endif
EOF
$CC $CFLAGS -c conftest.c 1>&5 2>&1
if test ! -s conftest.o; then
    echo "configure: warning: error compiling/running conftest" 1>&2
else
    $F77 $FFLAGS conftestf.f conftest.o -o conftest  1>&5 2>&1
    if test -s conftest && (./conftest; exit) 2>/dev/null; then
	lam_cv_size_fint=`cat conftestval`
    else
	echo "configure: warning: Error compiling/running conftest" 1>&2
    fi
fi
fi
/bin/rm -f conftest*
fi

echo "$ac_t""$lam_cv_size_fint" 1>&6
cat >> confdefs.h <<EOF
#define LAM_SIZEOF_FORTRAN_INT $lam_cv_size_fint
EOF

    
# Determine FORTRAN datatype size.
# First arg is type, 2nd arg is cache var, 3rd arg is config var to define.
echo $ac_n "checking size of FORTRAN REAL""... $ac_c" 1>&6
echo "configure:8151: checking size of FORTRAN REAL" >&5
if eval "test \"`echo '$''{'lam_cv_size_freal'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  
lam_ac_size_fn=
if test "x$lam_ac_doubleunder" = xy || test "x$lam_ac_singleunder" = xy; then
    lam_ac_size_fn=size_
else
    if test "x$lam_ac_nounder" = xy; then
	lam_ac_size_fn=size
    else
	if test "x$lam_ac_caps" = xy; then
	    lam_ac_size_fn=SIZE
	else 
	    { echo "configure: error: FORTRAN external naming convention undefined" 1>&2; exit 1; }
	fi
    fi
fi
if test -n "$lam_ac_size_fn"; then
cat > conftestf.f <<EOF
       program fsize
       external SIZE
       REAL x(2)
       call SIZE(x(1),x(2))
       end
EOF
cat > conftest.c <<EOF
#include <stdio.h>
#ifdef __cplusplus
extern "C" {
#endif
void $lam_ac_size_fn(char *a, char *b)
{
    int diff = (int) (b - a);
    FILE *f=fopen("conftestval", "w");
    if (!f) return;
    fprintf(f, "%d\n", diff);
}
#ifdef __cplusplus
}
#endif
EOF
$CC $CFLAGS -c conftest.c 1>&5 2>&1
if test ! -s conftest.o; then
    echo "configure: warning: error compiling/running conftest" 1>&2
else
    $F77 $FFLAGS conftestf.f conftest.o -o conftest  1>&5 2>&1
    if test -s conftest && (./conftest; exit) 2>/dev/null; then
	lam_cv_size_freal=`cat conftestval`
    else
	echo "configure: warning: Error compiling/running conftest" 1>&2
    fi
fi
fi
/bin/rm -f conftest*
fi

echo "$ac_t""$lam_cv_size_freal" 1>&6
cat >> confdefs.h <<EOF
#define LAM_SIZEOF_FORTRAN_REAL $lam_cv_size_freal
EOF

    
# Determine FORTRAN datatype size.
# First arg is type, 2nd arg is cache var, 3rd arg is config var to define.
echo $ac_n "checking size of FORTRAN DOUBLE PRECISION""... $ac_c" 1>&6
echo "configure:8218: checking size of FORTRAN DOUBLE PRECISION" >&5
if eval "test \"`echo '$''{'lam_cv_size_fdprec'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  
lam_ac_size_fn=
if test "x$lam_ac_doubleunder" = xy || test "x$lam_ac_singleunder" = xy; then
    lam_ac_size_fn=size_
else
    if test "x$lam_ac_nounder" = xy; then
	lam_ac_size_fn=size
    else
	if test "x$lam_ac_caps" = xy; then
	    lam_ac_size_fn=SIZE
	else 
	    { echo "configure: error: FORTRAN external naming convention undefined" 1>&2; exit 1; }
	fi
    fi
fi
if test -n "$lam_ac_size_fn"; then
cat > conftestf.f <<EOF
       program fsize
       external SIZE
       DOUBLE PRECISION x(2)
       call SIZE(x(1),x(2))
       end
EOF
cat > conftest.c <<EOF
#include <stdio.h>
#ifdef __cplusplus
extern "C" {
#endif
void $lam_ac_size_fn(char *a, char *b)
{
    int diff = (int) (b - a);
    FILE *f=fopen("conftestval", "w");
    if (!f) return;
    fprintf(f, "%d\n", diff);
}
#ifdef __cplusplus
}
#endif
EOF
$CC $CFLAGS -c conftest.c 1>&5 2>&1
if test ! -s conftest.o; then
    echo "configure: warning: error compiling/running conftest" 1>&2
else
    $F77 $FFLAGS conftestf.f conftest.o -o conftest  1>&5 2>&1
    if test -s conftest && (./conftest; exit) 2>/dev/null; then
	lam_cv_size_fdprec=`cat conftestval`
    else
	echo "configure: warning: Error compiling/running conftest" 1>&2
    fi
fi
fi
/bin/rm -f conftest*
fi

echo "$ac_t""$lam_cv_size_fdprec" 1>&6
cat >> confdefs.h <<EOF
#define LAM_SIZEOF_FORTRAN_DBLPREC $lam_cv_size_fdprec
EOF

    
# Determine FORTRAN datatype size.
# First arg is type, 2nd arg is cache var, 3rd arg is config var to define.
echo $ac_n "checking size of FORTRAN COMPLEX""... $ac_c" 1>&6
echo "configure:8285: checking size of FORTRAN COMPLEX" >&5
if eval "test \"`echo '$''{'lam_cv_size_fcomplex'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  
lam_ac_size_fn=
if test "x$lam_ac_doubleunder" = xy || test "x$lam_ac_singleunder" = xy; then
    lam_ac_size_fn=size_
else
    if test "x$lam_ac_nounder" = xy; then
	lam_ac_size_fn=size
    else
	if test "x$lam_ac_caps" = xy; then
	    lam_ac_size_fn=SIZE
	else 
	    { echo "configure: error: FORTRAN external naming convention undefined" 1>&2; exit 1; }
	fi
    fi
fi
if test -n "$lam_ac_size_fn"; then
cat > conftestf.f <<EOF
       program fsize
       external SIZE
       COMPLEX x(2)
       call SIZE(x(1),x(2))
       end
EOF
cat > conftest.c <<EOF
#include <stdio.h>
#ifdef __cplusplus
extern "C" {
#endif
void $lam_ac_size_fn(char *a, char *b)
{
    int diff = (int) (b - a);
    FILE *f=fopen("conftestval", "w");
    if (!f) return;
    fprintf(f, "%d\n", diff);
}
#ifdef __cplusplus
}
#endif
EOF
$CC $CFLAGS -c conftest.c 1>&5 2>&1
if test ! -s conftest.o; then
    echo "configure: warning: error compiling/running conftest" 1>&2
else
    $F77 $FFLAGS conftestf.f conftest.o -o conftest  1>&5 2>&1
    if test -s conftest && (./conftest; exit) 2>/dev/null; then
	lam_cv_size_fcomplex=`cat conftestval`
    else
	echo "configure: warning: Error compiling/running conftest" 1>&2
    fi
fi
fi
/bin/rm -f conftest*
fi

echo "$ac_t""$lam_cv_size_fcomplex" 1>&6
cat >> confdefs.h <<EOF
#define LAM_SIZEOF_FORTRAN_COMPLEX $lam_cv_size_fcomplex
EOF

    
# Determine FORTRAN datatype size.
# First arg is type, 2nd arg is cache var, 3rd arg is config var to define.
echo $ac_n "checking size of FORTRAN DOUBLE COMPLEX""... $ac_c" 1>&6
echo "configure:8352: checking size of FORTRAN DOUBLE COMPLEX" >&5
if eval "test \"`echo '$''{'lam_cv_size_fdcomplex'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  
lam_ac_size_fn=
if test "x$lam_ac_doubleunder" = xy || test "x$lam_ac_singleunder" = xy; then
    lam_ac_size_fn=size_
else
    if test "x$lam_ac_nounder" = xy; then
	lam_ac_size_fn=size
    else
	if test "x$lam_ac_caps" = xy; then
	    lam_ac_size_fn=SIZE
	else 
	    { echo "configure: error: FORTRAN external naming convention undefined" 1>&2; exit 1; }
	fi
    fi
fi
if test -n "$lam_ac_size_fn"; then
cat > conftestf.f <<EOF
       program fsize
       external SIZE
       DOUBLE COMPLEX x(2)
       call SIZE(x(1),x(2))
       end
EOF
cat > conftest.c <<EOF
#include <stdio.h>
#ifdef __cplusplus
extern "C" {
#endif
void $lam_ac_size_fn(char *a, char *b)
{
    int diff = (int) (b - a);
    FILE *f=fopen("conftestval", "w");
    if (!f) return;
    fprintf(f, "%d\n", diff);
}
#ifdef __cplusplus
}
#endif
EOF
$CC $CFLAGS -c conftest.c 1>&5 2>&1
if test ! -s conftest.o; then
    echo "configure: warning: error compiling/running conftest" 1>&2
else
    $F77 $FFLAGS conftestf.f conftest.o -o conftest  1>&5 2>&1
    if test -s conftest && (./conftest; exit) 2>/dev/null; then
	lam_cv_size_fdcomplex=`cat conftestval`
    else
	echo "configure: warning: Error compiling/running conftest" 1>&2
    fi
fi
fi
/bin/rm -f conftest*
fi

echo "$ac_t""$lam_cv_size_fdcomplex" 1>&6
cat >> confdefs.h <<EOF
#define LAM_SIZEOF_FORTRAN_DBLCOMPLEX $lam_cv_size_fdcomplex
EOF


    
# Determine FORTRAN datatype alignment. 
# First arg is type, 2nd arg is cache var, 3rd arg is config var to define.
echo $ac_n "checking alignment of FORTRAN INTEGER""... $ac_c" 1>&6
echo "configure:8420: checking alignment of FORTRAN INTEGER" >&5
if eval "test \"`echo '$''{'lam_cv_align_fint'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  
lam_ac_align_fn=
if test "x$lam_ac_doubleunder" = xy || test "x$lam_ac_singleunder" = xy; then
    lam_ac_align_fn=align_
else
    if test "x$lam_ac_nounder" = xy; then
	    lam_ac_align_fn=align
    else
	if test "x$lam_ac_caps" = xy; then
	    lam_ac_align_fn=ALIGN
	else
	    { echo "configure: error: FORTRAN external naming convention undefined" 1>&2; exit 1; }
	fi
    fi
fi
if test -n "$lam_ac_align_fn"; then
cat > conftestf.f <<EOF
      program falign
      external ALIGN
      INTEGER  w,x,y,z
      CHARACTER a,b,c
      common /foo/a,w,b,x,y,c,z
      call ALIGN(w,x,y,z)
      end
EOF
if test -f conftest.h; then
    conftest="#include \"conftest.h\""
else
    conftest=""
fi
cat > conftest.c <<EOF
#include <stdio.h>
$conftest
#ifdef __cplusplus
extern "C" {
void exit(int);
#endif
void $lam_ac_align_fn(char *w, char *x, char *y, char *z)
{   unsigned long aw, ax, ay, az;
    FILE *f=fopen("conftestval", "w");
    if (!f) exit(1);
    aw = (unsigned long) w;
    ax = (unsigned long) x;
    ay = (unsigned long) y;
    az = (unsigned long) z;
    if (! ((aw%16)||(ax%16)||(ay%16)||(az%16))) fprintf(f, "%d\n", 16);
    else if (! ((aw%12)||(ax%12)||(ay%12)||(az%12))) fprintf(f, "%d\n", 12);
    else if (! ((aw%8)||(ax%8)||(ay%8)||(az%8))) fprintf(f, "%d\n", 8);
    else if (! ((aw%4)||(ax%4)||(ay%4)||(az%4))) fprintf(f, "%d\n", 4);
    else if (! ((aw%2)||(ax%2)||(ay%2)||(az%2))) fprintf(f, "%d\n", 2);
    else fprintf(f, "%d\n", 1); 
    fclose(f);
}
#ifdef __cplusplus
}
#endif
EOF
echo configure:8481: $CC $CFLAGS -I. -c conftest.c >&5
$CC $CFLAGS -I. -c conftest.c 1>&5 2>&1
if test ! -s conftest.o; then
    echo "configure: warning: error compiling/running conftest" 1>&2
    echo configure:8485: here is the program that failed: >&5
    cat conftest1.c >&5
    echo configure:8487: here is conftest.h: >&5
    cat conftest.h >&5
else
    echo configure:8490: $F77 $FFLAGS conftestf.f conftest.o -o conftest  >&5
    $F77 $FFLAGS conftestf.f conftest.o -o conftest  1>&5 2>&1
    if test -s conftest && (./conftest; exit) 2>/dev/null; then
	lam_cv_align_fint=`cat conftestval`
    else
	echo "configure: warning: error compiling/running conftest" 1>&2
	echo configure:8496: here is the program that failed: >&5
	cat conftest1.f >&5
    fi
fi
fi
/bin/rm -f conftest*
fi

echo "$ac_t""$lam_cv_align_fint" 1>&6
cat >> confdefs.h <<EOF
#define LAM_ALIGNMENT_FORTRAN_INT $lam_cv_align_fint
EOF

    
# Determine FORTRAN datatype alignment. 
# First arg is type, 2nd arg is cache var, 3rd arg is config var to define.
echo $ac_n "checking alignment of FORTRAN REAL""... $ac_c" 1>&6
echo "configure:8513: checking alignment of FORTRAN REAL" >&5
if eval "test \"`echo '$''{'lam_cv_align_freal'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  
lam_ac_align_fn=
if test "x$lam_ac_doubleunder" = xy || test "x$lam_ac_singleunder" = xy; then
    lam_ac_align_fn=align_
else
    if test "x$lam_ac_nounder" = xy; then
	    lam_ac_align_fn=align
    else
	if test "x$lam_ac_caps" = xy; then
	    lam_ac_align_fn=ALIGN
	else
	    { echo "configure: error: FORTRAN external naming convention undefined" 1>&2; exit 1; }
	fi
    fi
fi
if test -n "$lam_ac_align_fn"; then
cat > conftestf.f <<EOF
      program falign
      external ALIGN
      REAL  w,x,y,z
      CHARACTER a,b,c
      common /foo/a,w,b,x,y,c,z
      call ALIGN(w,x,y,z)
      end
EOF
if test -f conftest.h; then
    conftest="#include \"conftest.h\""
else
    conftest=""
fi
cat > conftest.c <<EOF
#include <stdio.h>
$conftest
#ifdef __cplusplus
extern "C" {
void exit(int);
#endif
void $lam_ac_align_fn(char *w, char *x, char *y, char *z)
{   unsigned long aw, ax, ay, az;
    FILE *f=fopen("conftestval", "w");
    if (!f) exit(1);
    aw = (unsigned long) w;
    ax = (unsigned long) x;
    ay = (unsigned long) y;
    az = (unsigned long) z;
    if (! ((aw%16)||(ax%16)||(ay%16)||(az%16))) fprintf(f, "%d\n", 16);
    else if (! ((aw%12)||(ax%12)||(ay%12)||(az%12))) fprintf(f, "%d\n", 12);
    else if (! ((aw%8)||(ax%8)||(ay%8)||(az%8))) fprintf(f, "%d\n", 8);
    else if (! ((aw%4)||(ax%4)||(ay%4)||(az%4))) fprintf(f, "%d\n", 4);
    else if (! ((aw%2)||(ax%2)||(ay%2)||(az%2))) fprintf(f, "%d\n", 2);
    else fprintf(f, "%d\n", 1); 
    fclose(f);
}
#ifdef __cplusplus
}
#endif
EOF
echo configure:8574: $CC $CFLAGS -I. -c conftest.c >&5
$CC $CFLAGS -I. -c conftest.c 1>&5 2>&1
if test ! -s conftest.o; then
    echo "configure: warning: error compiling/running conftest" 1>&2
    echo configure:8578: here is the program that failed: >&5
    cat conftest1.c >&5
    echo configure:8580: here is conftest.h: >&5
    cat conftest.h >&5
else
    echo configure:8583: $F77 $FFLAGS conftestf.f conftest.o -o conftest  >&5
    $F77 $FFLAGS conftestf.f conftest.o -o conftest  1>&5 2>&1
    if test -s conftest && (./conftest; exit) 2>/dev/null; then
	lam_cv_align_freal=`cat conftestval`
    else
	echo "configure: warning: error compiling/running conftest" 1>&2
	echo configure:8589: here is the program that failed: >&5
	cat conftest1.f >&5
    fi
fi
fi
/bin/rm -f conftest*
fi

echo "$ac_t""$lam_cv_align_freal" 1>&6
cat >> confdefs.h <<EOF
#define LAM_ALIGNMENT_FORTRAN_REAL $lam_cv_align_freal
EOF

    
# Determine FORTRAN datatype alignment. 
# First arg is type, 2nd arg is cache var, 3rd arg is config var to define.
echo $ac_n "checking alignment of FORTRAN DOUBLE PRECISION""... $ac_c" 1>&6
echo "configure:8606: checking alignment of FORTRAN DOUBLE PRECISION" >&5
if eval "test \"`echo '$''{'lam_cv_align_fdprec'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  
lam_ac_align_fn=
if test "x$lam_ac_doubleunder" = xy || test "x$lam_ac_singleunder" = xy; then
    lam_ac_align_fn=align_
else
    if test "x$lam_ac_nounder" = xy; then
	    lam_ac_align_fn=align
    else
	if test "x$lam_ac_caps" = xy; then
	    lam_ac_align_fn=ALIGN
	else
	    { echo "configure: error: FORTRAN external naming convention undefined" 1>&2; exit 1; }
	fi
    fi
fi
if test -n "$lam_ac_align_fn"; then
cat > conftestf.f <<EOF
      program falign
      external ALIGN
      DOUBLE PRECISION  w,x,y,z
      CHARACTER a,b,c
      common /foo/a,w,b,x,y,c,z
      call ALIGN(w,x,y,z)
      end
EOF
if test -f conftest.h; then
    conftest="#include \"conftest.h\""
else
    conftest=""
fi
cat > conftest.c <<EOF
#include <stdio.h>
$conftest
#ifdef __cplusplus
extern "C" {
void exit(int);
#endif
void $lam_ac_align_fn(char *w, char *x, char *y, char *z)
{   unsigned long aw, ax, ay, az;
    FILE *f=fopen("conftestval", "w");
    if (!f) exit(1);
    aw = (unsigned long) w;
    ax = (unsigned long) x;
    ay = (unsigned long) y;
    az = (unsigned long) z;
    if (! ((aw%16)||(ax%16)||(ay%16)||(az%16))) fprintf(f, "%d\n", 16);
    else if (! ((aw%12)||(ax%12)||(ay%12)||(az%12))) fprintf(f, "%d\n", 12);
    else if (! ((aw%8)||(ax%8)||(ay%8)||(az%8))) fprintf(f, "%d\n", 8);
    else if (! ((aw%4)||(ax%4)||(ay%4)||(az%4))) fprintf(f, "%d\n", 4);
    else if (! ((aw%2)||(ax%2)||(ay%2)||(az%2))) fprintf(f, "%d\n", 2);
    else fprintf(f, "%d\n", 1); 
    fclose(f);
}
#ifdef __cplusplus
}
#endif
EOF
echo configure:8667: $CC $CFLAGS -I. -c conftest.c >&5
$CC $CFLAGS -I. -c conftest.c 1>&5 2>&1
if test ! -s conftest.o; then
    echo "configure: warning: error compiling/running conftest" 1>&2
    echo configure:8671: here is the program that failed: >&5
    cat conftest1.c >&5
    echo configure:8673: here is conftest.h: >&5
    cat conftest.h >&5
else
    echo configure:8676: $F77 $FFLAGS conftestf.f conftest.o -o conftest  >&5
    $F77 $FFLAGS conftestf.f conftest.o -o conftest  1>&5 2>&1
    if test -s conftest && (./conftest; exit) 2>/dev/null; then
	lam_cv_align_fdprec=`cat conftestval`
    else
	echo "configure: warning: error compiling/running conftest" 1>&2
	echo configure:8682: here is the program that failed: >&5
	cat conftest1.f >&5
    fi
fi
fi
/bin/rm -f conftest*
fi

echo "$ac_t""$lam_cv_align_fdprec" 1>&6
cat >> confdefs.h <<EOF
#define LAM_ALIGNMENT_FORTRAN_COMPLEX $lam_cv_align_fdprec
EOF

    
# Determine FORTRAN datatype alignment. 
# First arg is type, 2nd arg is cache var, 3rd arg is config var to define.
echo $ac_n "checking alignment of FORTRAN COMPLEX""... $ac_c" 1>&6
echo "configure:8699: checking alignment of FORTRAN COMPLEX" >&5
if eval "test \"`echo '$''{'lam_cv_align_fcomplex'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  
lam_ac_align_fn=
if test "x$lam_ac_doubleunder" = xy || test "x$lam_ac_singleunder" = xy; then
    lam_ac_align_fn=align_
else
    if test "x$lam_ac_nounder" = xy; then
	    lam_ac_align_fn=align
    else
	if test "x$lam_ac_caps" = xy; then
	    lam_ac_align_fn=ALIGN
	else
	    { echo "configure: error: FORTRAN external naming convention undefined" 1>&2; exit 1; }
	fi
    fi
fi
if test -n "$lam_ac_align_fn"; then
cat > conftestf.f <<EOF
      program falign
      external ALIGN
      COMPLEX  w,x,y,z
      CHARACTER a,b,c
      common /foo/a,w,b,x,y,c,z
      call ALIGN(w,x,y,z)
      end
EOF
if test -f conftest.h; then
    conftest="#include \"conftest.h\""
else
    conftest=""
fi
cat > conftest.c <<EOF
#include <stdio.h>
$conftest
#ifdef __cplusplus
extern "C" {
void exit(int);
#endif
void $lam_ac_align_fn(char *w, char *x, char *y, char *z)
{   unsigned long aw, ax, ay, az;
    FILE *f=fopen("conftestval", "w");
    if (!f) exit(1);
    aw = (unsigned long) w;
    ax = (unsigned long) x;
    ay = (unsigned long) y;
    az = (unsigned long) z;
    if (! ((aw%16)||(ax%16)||(ay%16)||(az%16))) fprintf(f, "%d\n", 16);
    else if (! ((aw%12)||(ax%12)||(ay%12)||(az%12))) fprintf(f, "%d\n", 12);
    else if (! ((aw%8)||(ax%8)||(ay%8)||(az%8))) fprintf(f, "%d\n", 8);
    else if (! ((aw%4)||(ax%4)||(ay%4)||(az%4))) fprintf(f, "%d\n", 4);
    else if (! ((aw%2)||(ax%2)||(ay%2)||(az%2))) fprintf(f, "%d\n", 2);
    else fprintf(f, "%d\n", 1); 
    fclose(f);
}
#ifdef __cplusplus
}
#endif
EOF
echo configure:8760: $CC $CFLAGS -I. -c conftest.c >&5
$CC $CFLAGS -I. -c conftest.c 1>&5 2>&1
if test ! -s conftest.o; then
    echo "configure: warning: error compiling/running conftest" 1>&2
    echo configure:8764: here is the program that failed: >&5
    cat conftest1.c >&5
    echo configure:8766: here is conftest.h: >&5
    cat conftest.h >&5
else
    echo configure:8769: $F77 $FFLAGS conftestf.f conftest.o -o conftest  >&5
    $F77 $FFLAGS conftestf.f conftest.o -o conftest  1>&5 2>&1
    if test -s conftest && (./conftest; exit) 2>/dev/null; then
	lam_cv_align_fcomplex=`cat conftestval`
    else
	echo "configure: warning: error compiling/running conftest" 1>&2
	echo configure:8775: here is the program that failed: >&5
	cat conftest1.f >&5
    fi
fi
fi
/bin/rm -f conftest*
fi

echo "$ac_t""$lam_cv_align_fcomplex" 1>&6
cat >> confdefs.h <<EOF
#define LAM_ALIGNMENT_FORTRAN_DBLPREC $lam_cv_align_fcomplex
EOF

    
# Determine FORTRAN datatype alignment. 
# First arg is type, 2nd arg is cache var, 3rd arg is config var to define.
echo $ac_n "checking alignment of FORTRAN DOUBLE COMPLEX""... $ac_c" 1>&6
echo "configure:8792: checking alignment of FORTRAN DOUBLE COMPLEX" >&5
if eval "test \"`echo '$''{'lam_cv_align_fdcomplex'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  
lam_ac_align_fn=
if test "x$lam_ac_doubleunder" = xy || test "x$lam_ac_singleunder" = xy; then
    lam_ac_align_fn=align_
else
    if test "x$lam_ac_nounder" = xy; then
	    lam_ac_align_fn=align
    else
	if test "x$lam_ac_caps" = xy; then
	    lam_ac_align_fn=ALIGN
	else
	    { echo "configure: error: FORTRAN external naming convention undefined" 1>&2; exit 1; }
	fi
    fi
fi
if test -n "$lam_ac_align_fn"; then
cat > conftestf.f <<EOF
      program falign
      external ALIGN
      DOUBLE COMPLEX  w,x,y,z
      CHARACTER a,b,c
      common /foo/a,w,b,x,y,c,z
      call ALIGN(w,x,y,z)
      end
EOF
if test -f conftest.h; then
    conftest="#include \"conftest.h\""
else
    conftest=""
fi
cat > conftest.c <<EOF
#include <stdio.h>
$conftest
#ifdef __cplusplus
extern "C" {
void exit(int);
#endif
void $lam_ac_align_fn(char *w, char *x, char *y, char *z)
{   unsigned long aw, ax, ay, az;
    FILE *f=fopen("conftestval", "w");
    if (!f) exit(1);
    aw = (unsigned long) w;
    ax = (unsigned long) x;
    ay = (unsigned long) y;
    az = (unsigned long) z;
    if (! ((aw%16)||(ax%16)||(ay%16)||(az%16))) fprintf(f, "%d\n", 16);
    else if (! ((aw%12)||(ax%12)||(ay%12)||(az%12))) fprintf(f, "%d\n", 12);
    else if (! ((aw%8)||(ax%8)||(ay%8)||(az%8))) fprintf(f, "%d\n", 8);
    else if (! ((aw%4)||(ax%4)||(ay%4)||(az%4))) fprintf(f, "%d\n", 4);
    else if (! ((aw%2)||(ax%2)||(ay%2)||(az%2))) fprintf(f, "%d\n", 2);
    else fprintf(f, "%d\n", 1); 
    fclose(f);
}
#ifdef __cplusplus
}
#endif
EOF
echo configure:8853: $CC $CFLAGS -I. -c conftest.c >&5
$CC $CFLAGS -I. -c conftest.c 1>&5 2>&1
if test ! -s conftest.o; then
    echo "configure: warning: error compiling/running conftest" 1>&2
    echo configure:8857: here is the program that failed: >&5
    cat conftest1.c >&5
    echo configure:8859: here is conftest.h: >&5
    cat conftest.h >&5
else
    echo configure:8862: $F77 $FFLAGS conftestf.f conftest.o -o conftest  >&5
    $F77 $FFLAGS conftestf.f conftest.o -o conftest  1>&5 2>&1
    if test -s conftest && (./conftest; exit) 2>/dev/null; then
	lam_cv_align_fdcomplex=`cat conftestval`
    else
	echo "configure: warning: error compiling/running conftest" 1>&2
	echo configure:8868: here is the program that failed: >&5
	cat conftest1.f >&5
    fi
fi
fi
/bin/rm -f conftest*
fi

echo "$ac_t""$lam_cv_align_fdcomplex" 1>&6
cat >> confdefs.h <<EOF
#define LAM_ALIGNMENT_FORTRAN_DBLCOMPLEX $lam_cv_align_fdcomplex
EOF


# check that alignment of double precsion and corresponding C type are same
    if test "$lam_cv_size_fdprec" = "$ac_cv_sizeof_double"; then
       if test "$lam_cv_align_fdprec" != "$lam_cv_align_double"; then
	  echo "configure: warning: alignment of Fortran double precsion and C double
    are not the same" 1>&2
       fi
    elif test "$lam_cv_size_fdprec" = "$ac_cv_sizeof_long_double"; then
       if test "$lam_cv_align_fdprec" != "$lam_cv_align_longdbl"; then
	  echo "configure: warning: alignment of Fortran double precsion and C long double
    are not the same" 1>&2
       fi
    fi
fi

# Finally, make an "INSTALL_HOME" available for the example proc schemas
INSTALL_HOME=`pwd`


# This is needed for VPATH builds, so that it will -I the appropriate
# include directory (don't know why automake doesn't do this
# automatically).  We delayed doing it until now just so that
# '-I$(top_srcdir)' doesn't show up in any of the configure output --
# purely aesthetic.

dir="$srcdir";
if test "$srcdir" = "."; then
    dir="`pwd`"
fi
CFLAGS='-I$(top_srcdir)/share/include'" $CFLAGS"
CXXFLAGS='-I$(top_srcdir)/share/include'" $CXXFLAGS"




#
# libtool magic
#

# Check whether --enable-static or --disable-static was given.
if test "${enable_static+set}" = set; then
  enableval="$enable_static"
  p=${PACKAGE-default}
case "$enableval" in
yes) enable_static=yes ;;
no) enable_static=no ;;
*)
  enable_static=no
  # Look at the argument we got.  We use all the common list separators.
  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
  for pkg in $enableval; do
    if test "X$pkg" = "X$p"; then
      enable_static=yes
    fi
  done
  IFS="$ac_save_ifs"
  ;;
esac
else
  enable_static=yes
fi

# Check whether --enable-fast-install or --disable-fast-install was given.
if test "${enable_fast_install+set}" = set; then
  enableval="$enable_fast_install"
  p=${PACKAGE-default}
case "$enableval" in
yes) enable_fast_install=yes ;;
no) enable_fast_install=no ;;
*)
  enable_fast_install=no
  # Look at the argument we got.  We use all the common list separators.
  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
  for pkg in $enableval; do
    if test "X$pkg" = "X$p"; then
      enable_fast_install=yes
    fi
  done
  IFS="$ac_save_ifs"
  ;;
esac
else
  enable_fast_install=yes
fi

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

build_alias=$build
case "$build_alias" in
NONE)
  case $nonopt in
  NONE) build_alias=$host_alias ;;
  *) build_alias=$nonopt ;;
  esac ;;
esac

build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias`
build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
echo "$ac_t""$build" 1>&6

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

# Check whether --with-gnu-ld or --without-gnu-ld was given.
if test "${with_gnu_ld+set}" = set; then
  withval="$with_gnu_ld"
  test "$withval" = no || with_gnu_ld=yes
else
  with_gnu_ld=no
fi

ac_prog=ld
if test "$ac_cv_prog_gcc" = yes; then
  # Check if gcc -print-prog-name=ld gives a path.
  echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6
echo "configure:9026: checking for ld used by GCC" >&5
  ac_prog=`($CC -print-prog-name=ld) 2>&5`
  case "$ac_prog" in
    # Accept absolute paths.
    [\\/]* | [A-Za-z]:[\\/]*)
      re_direlt='/[^/][^/]*/\.\./'
      # Canonicalize the path of ld
      ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
	ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
      done
      test -z "$LD" && LD="$ac_prog"
      ;;
  "")
    # If it fails, then pretend we aren't using GCC.
    ac_prog=ld
    ;;
  *)
    # If it is relative, then search for the first ld in PATH.
    with_gnu_ld=unknown
    ;;
  esac
elif test "$with_gnu_ld" = yes; then
  echo $ac_n "checking for GNU ld""... $ac_c" 1>&6
echo "configure:9050: checking for GNU ld" >&5
else
  echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
echo "configure:9053: checking for non-GNU ld" >&5
fi
if eval "test \"`echo '$''{'ac_cv_path_LD'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  if test -z "$LD"; then
  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
  for ac_dir in $PATH; do
    test -z "$ac_dir" && ac_dir=.
    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
      ac_cv_path_LD="$ac_dir/$ac_prog"
      # Check to see if the program is GNU ld.  I'd rather use --version,
      # but apparently some GNU ld's only accept -v.
      # Break only if it was the GNU/non-GNU ld that we prefer.
      if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
	test "$with_gnu_ld" != no && break
      else
	test "$with_gnu_ld" != yes && break
      fi
    fi
  done
  IFS="$ac_save_ifs"
else
  ac_cv_path_LD="$LD" # Let the user override the test with a path.
fi
fi

LD="$ac_cv_path_LD"
if test -n "$LD"; then
  echo "$ac_t""$LD" 1>&6
else
  echo "$ac_t""no" 1>&6
fi
test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; }
echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6
echo "configure:9088: checking if the linker ($LD) is GNU ld" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gnu_ld'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  # I'd rather use --version here, but apparently some GNU ld's only accept -v.
if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
  ac_cv_prog_gnu_ld=yes
else
  ac_cv_prog_gnu_ld=no
fi
fi

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


echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6
echo "configure:9104: checking for BSD-compatible nm" >&5
if eval "test \"`echo '$''{'ac_cv_path_NM'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  if test -n "$NM"; then
  # Let the user override the test.
  ac_cv_path_NM="$NM"
else
  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
  for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
    test -z "$ac_dir" && ac_dir=.
    if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then
      # Check to see if the nm accepts a BSD-compat flag.
      # Adding the `sed 1q' prevents false positives on HP-UX, which says:
      #   nm: unknown option "B" ignored
      if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
	ac_cv_path_NM="$ac_dir/nm -B"
	break
      elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
	ac_cv_path_NM="$ac_dir/nm -p"
	break
      else
	ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
	continue # so that we can try to find one that supports BSD flags
      fi
    fi
  done
  IFS="$ac_save_ifs"
  test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
fi
fi

NM="$ac_cv_path_NM"
echo "$ac_t""$NM" 1>&6


case "$target" in
NONE) lt_target="$host" ;;
*) lt_target="$target" ;;
esac

# Check for any special flags to pass to ltconfig.
libtool_flags="--cache-file=$cache_file"
test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"


# Check whether --enable-libtool-lock or --disable-libtool-lock was given.
if test "${enable_libtool_lock+set}" = set; then
  enableval="$enable_libtool_lock"
  :
fi

test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"

# Some flags need to be propagated to the compiler or linker for good
# libtool support.
case "$lt_target" in
*-*-irix6*)
  # Find out which ABI we are using.
  echo '#line 9168 "configure"' > conftest.$ac_ext
  if { (eval echo configure:9169: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    case "`/usr/bin/file conftest.o`" in
    *32-bit*)
      LD="${LD-ld} -32"
      ;;
    *N32*)
      LD="${LD-ld} -n32"
      ;;
    *64-bit*)
      LD="${LD-ld} -64"
      ;;
    esac
  fi
  rm -rf conftest*
  ;;

*-*-sco3.2v5*)
  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
  SAVE_CFLAGS="$CFLAGS"
  CFLAGS="$CFLAGS -belf"
  echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6
echo "configure:9190: checking whether the C compiler needs -belf" >&5
if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  cat > conftest.$ac_ext <<EOF
#line 9195 "configure"
#include "confdefs.h"

int main() {

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

echo "$ac_t""$lt_cv_cc_needs_belf" 1>&6
  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
    CFLAGS="$SAVE_CFLAGS"
  fi
  ;;


esac


# Save cache, so that ltconfig can load it


# Actually configure libtool.  ac_aux_dir is where install-sh is found.
CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \
|| { echo "configure: error: libtool configure failed" 1>&2; exit 1; }

# Reload cache, that may have been modified by ltconfig


# This can be used to rebuild libtool when needed
LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"

# Always use our own libtool.
LIBTOOL='$(SHELL) $(top_builddir)/libtool'

# Redirect the config.log output again, so that the ltconfig log is not
# clobbered by the next message.
exec 5>>./config.log



#
# If we're doing a vpath build, mkdir romio because AC_OUTPUT puts out
# a file in romio/util.  Also make the lib directories, because ROMIO
# isn't smart enough to make them during its build process.  :-(
#

if test ! -d romio; then
    mkdir romio
    mkdir romio/lib
fi

#
# 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
    config/Makefile
    etc/Makefile
    examples/Makefile
    examples/alltoall/Makefile
    examples/fault/Makefile
    examples/mandelbrot/Makefile
    examples/mandelbrot/myapp
    examples/mpi2c++/Makefile
    examples/pi/Makefile
    examples/ring/Makefile
    examples/romio/Makefile
    examples/trivial/Makefile
    examples/trivial/myapp
    examples/wave1d/Makefile
    examples/wave1d/myapp
    man/Makefile
    man/man1/Makefile
    man/man2/Makefile
    man/man3/Makefile
    man/man5/Makefile
    man/man7/Makefile
    man/mans/Makefile
    otb/Makefile
    otb/bfctl/Makefile
    otb/bfstate/Makefile
    otb/doom/Makefile
    otb/fctl/Makefile
    otb/filedr/Makefile
    otb/fstate/Makefile
    otb/ipcdr/Makefile
    otb/kdump/Makefile
    otb/lamclean/Makefile
    otb/lamexec/Makefile
    otb/lamgrow/Makefile
    otb/lamshrink/Makefile
    otb/lamtrace/Makefile
    otb/loadgo/Makefile
    otb/mpimsg/Makefile
    otb/mpirun/Makefile
    otb/mpitask/Makefile
    otb/state/Makefile
    otb/sys/Makefile
    otb/sys/bforward/Makefile
    otb/sys/bufferd/Makefile
    otb/sys/dli_inet/Makefile
    otb/sys/dlo_inet/Makefile
    otb/sys/echod/Makefile
    otb/sys/filed/Makefile
    otb/sys/flatd/Makefile
    otb/sys/iod/Makefile
    otb/sys/haltd/Makefile
    otb/sys/kenyad/Makefile
    otb/sys/kernel/Makefile
    otb/sys/loadd/Makefile
    otb/sys/router/Makefile
    otb/sys/traced/Makefile
    otb/sys/lamd/Makefile
    otb/sys/impid/Makefile
    otb/tping/Makefile
    share/Makefile
    share/args/Makefile
    share/boot/Makefile
    share/etc/Makefile
    share/freq/Makefile
    share/impi/Makefile
    share/kreq/Makefile
    share/include/Makefile
    share/include/mpif.h
    share/include/patchlevel.h
    share/mpi/Makefile
    share/mpi/f77/Makefile
    share/nreq/Makefile
    share/pmpi/Makefile
    share/pmpi/f77/Makefile
    share/rpi/Makefile
    share/rpi/c2c/Makefile
    share/rpi/lamd/Makefile
    share/rpi/myri/Makefile
    share/rpi/via/Makefile
    share/rpi/shmem/Makefile
    share/rpi/sysv/Makefile
    share/rpi/tcp/Makefile
    share/rpi/usysv/Makefile
    share/rreq/Makefile
    share/trillium/Makefile
    share/tstdio/Makefile
    tools/Makefile
    tools/hboot/Makefile
    tools/hcc/Makefile
    tools/hcc/hcp
    tools/hf77/Makefile
    tools/lamboot/Makefile
    tools/lamhalt/Makefile
    tools/lamnodes/Makefile
    tools/recon/Makefile
    tools/tkill/Makefile
    tools/wipe/Makefile
    romio/util/lam-configure-values
 share/include/lam_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%@LAM_MAJOR_VERSION@%$LAM_MAJOR_VERSION%g
s%@LAM_MINOR_VERSION@%$LAM_MINOR_VERSION%g
s%@LAM_RELEASE_VERSION@%$LAM_RELEASE_VERSION%g
s%@LAM_ALPHA_VERSION@%$LAM_ALPHA_VERSION%g
s%@LAM_BETA_VERSION@%$LAM_BETA_VERSION%g
s%@LAM_VERSION@%$LAM_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%@CLEANFILES@%$CLEANFILES%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%@LAMCLEAN@%$LAMCLEAN%g
s%@ROMIO_BUILD_TARGET@%$ROMIO_BUILD_TARGET%g
s%@ROMIO_INSTALL_TARGET@%$ROMIO_INSTALL_TARGET%g
s%@ROMIO_EXAMPLES@%$ROMIO_EXAMPLES%g
s%@ROMIO_USER_FLAGS@%$ROMIO_USER_FLAGS%g
s%@WANT_IMPI_BUILD_TRUE@%$WANT_IMPI_BUILD_TRUE%g
s%@WANT_IMPI_BUILD_FALSE@%$WANT_IMPI_BUILD_FALSE%g
s%@IMPI_LIB@%$IMPI_LIB%g
s%@IMPI_DIR@%$IMPI_DIR%g
s%@IMPID_DIR@%$IMPID_DIR%g
s%@IMPI_OBJS@%$IMPI_OBJS%g
s%@CC@%$CC%g
s%@CXX@%$CXX%g
s%@CPP@%$CPP%g
s%@CXXCPP@%$CXXCPP%g
s%@MPI2CPP_BUILD_TARGET@%$MPI2CPP_BUILD_TARGET%g
s%@MPI2CPP_INSTALL_TARGET@%$MPI2CPP_INSTALL_TARGET%g
s%@MPI2CPP_EXAMPLES@%$MPI2CPP_EXAMPLES%g
s%@MPI2CPP_CONFIGURE_EXFLAGS@%$MPI2CPP_CONFIGURE_EXFLAGS%g
s%@EXTRA_MPICC_FLAGS@%$EXTRA_MPICC_FLAGS%g
s%@EXTRA_MPIF77_FLAGS@%$EXTRA_MPIF77_FLAGS%g
s%@EXTRA_MPICPP_FLAGS@%$EXTRA_MPICPP_FLAGS%g
s%@LAM_CXX_TEMPLATE_REPOSITORY@%$LAM_CXX_TEMPLATE_REPOSITORY%g
s%@IMPI_SERVER@%$IMPI_SERVER%g
s%@WANT_PROFILE_BUILD_TRUE@%$WANT_PROFILE_BUILD_TRUE%g
s%@WANT_PROFILE_BUILD_FALSE@%$WANT_PROFILE_BUILD_FALSE%g
s%@WANT_TRILLIUM_INSTALL_TRUE@%$WANT_TRILLIUM_INSTALL_TRUE%g
s%@WANT_TRILLIUM_INSTALL_FALSE@%$WANT_TRILLIUM_INSTALL_FALSE%g
s%@MAKEDEPEND@%$MAKEDEPEND%g
s%@LAM_DEPDIRS@%$LAM_DEPDIRS%g
s%@rpi@%$rpi%g
s%@WANT_DEFAULT_MPI_MALLOC_TRUE@%$WANT_DEFAULT_MPI_MALLOC_TRUE%g
s%@WANT_DEFAULT_MPI_MALLOC_FALSE@%$WANT_DEFAULT_MPI_MALLOC_FALSE%g
s%@RPI_SUBDIRS@%$RPI_SUBDIRS%g
s%@RPI_LIBS@%$RPI_LIBS%g
s%@RPILIB@%$RPILIB%g
s%@RPILIBMASK@%$RPILIBMASK%g
s%@RPIFLAGS@%$RPIFLAGS%g
s%@VIA_DEVICE@%$VIA_DEVICE%g
s%@GM_API_VERSION@%$GM_API_VERSION%g
s%@LAM_RPI_REAL_CFLAGS@%$LAM_RPI_REAL_CFLAGS%g
s%@LAM_RPI_REAL_LDFLAGS@%$LAM_RPI_REAL_LDFLAGS%g
s%@ROMIO_FLAGS@%$ROMIO_FLAGS%g
s%@USER_LDFLAGS@%$USER_LDFLAGS%g
s%@USER_CXXLDFLAGS@%$USER_CXXLDFLAGS%g
s%@F77@%$F77%g
s%@F77_BUILD_DIR@%$F77_BUILD_DIR%g
s%@F77_LTPLIB@%$F77_LTPLIB%g
s%@ROMIO_NOF77@%$ROMIO_NOF77%g
s%@FPI_EXAMPLE@%$FPI_EXAMPLE%g
s%@WAVE1D_EXAMPLE@%$WAVE1D_EXAMPLE%g
s%@TRIVIALF_EXAMPLE@%$TRIVIALF_EXAMPLE%g
s%@THREADCFLAGS@%$THREADCFLAGS%g
s%@THREADLDFLAGS@%$THREADLDFLAGS%g
s%@THREADCXXFLAGS@%$THREADCXXFLAGS%g
s%@THREADCXXLDFLAGS@%$THREADCXXLDFLAGS%g
s%@RPISYSLIBS@%$RPISYSLIBS%g
s%@LN_S@%$LN_S%g
s%@CP@%$CP%g
s%@RM@%$RM%g
s%@SED@%$SED%g
s%@SHELL_CMD@%$SHELL_CMD%g
s%@RSH0@%$RSH0%g
s%@SYSLIBS@%$SYSLIBS%g
s%@INSTALL_HOME@%$INSTALL_HOME%g
s%@build@%$build%g
s%@build_alias@%$build_alias%g
s%@build_cpu@%$build_cpu%g
s%@build_vendor@%$build_vendor%g
s%@build_os@%$build_os%g
s%@RANLIB@%$RANLIB%g
s%@LIBTOOL@%$LIBTOOL%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
    config/Makefile
    etc/Makefile
    examples/Makefile
    examples/alltoall/Makefile
    examples/fault/Makefile
    examples/mandelbrot/Makefile
    examples/mandelbrot/myapp
    examples/mpi2c++/Makefile
    examples/pi/Makefile
    examples/ring/Makefile
    examples/romio/Makefile
    examples/trivial/Makefile
    examples/trivial/myapp
    examples/wave1d/Makefile
    examples/wave1d/myapp
    man/Makefile
    man/man1/Makefile
    man/man2/Makefile
    man/man3/Makefile
    man/man5/Makefile
    man/man7/Makefile
    man/mans/Makefile
    otb/Makefile
    otb/bfctl/Makefile
    otb/bfstate/Makefile
    otb/doom/Makefile
    otb/fctl/Makefile
    otb/filedr/Makefile
    otb/fstate/Makefile
    otb/ipcdr/Makefile
    otb/kdump/Makefile
    otb/lamclean/Makefile
    otb/lamexec/Makefile
    otb/lamgrow/Makefile
    otb/lamshrink/Makefile
    otb/lamtrace/Makefile
    otb/loadgo/Makefile
    otb/mpimsg/Makefile
    otb/mpirun/Makefile
    otb/mpitask/Makefile
    otb/state/Makefile
    otb/sys/Makefile
    otb/sys/bforward/Makefile
    otb/sys/bufferd/Makefile
    otb/sys/dli_inet/Makefile
    otb/sys/dlo_inet/Makefile
    otb/sys/echod/Makefile
    otb/sys/filed/Makefile
    otb/sys/flatd/Makefile
    otb/sys/iod/Makefile
    otb/sys/haltd/Makefile
    otb/sys/kenyad/Makefile
    otb/sys/kernel/Makefile
    otb/sys/loadd/Makefile
    otb/sys/router/Makefile
    otb/sys/traced/Makefile
    otb/sys/lamd/Makefile
    otb/sys/impid/Makefile
    otb/tping/Makefile
    share/Makefile
    share/args/Makefile
    share/boot/Makefile
    share/etc/Makefile
    share/freq/Makefile
    share/impi/Makefile
    share/kreq/Makefile
    share/include/Makefile
    share/include/mpif.h
    share/include/patchlevel.h
    share/mpi/Makefile
    share/mpi/f77/Makefile
    share/nreq/Makefile
    share/pmpi/Makefile
    share/pmpi/f77/Makefile
    share/rpi/Makefile
    share/rpi/c2c/Makefile
    share/rpi/lamd/Makefile
    share/rpi/myri/Makefile
    share/rpi/via/Makefile
    share/rpi/shmem/Makefile
    share/rpi/sysv/Makefile
    share/rpi/tcp/Makefile
    share/rpi/usysv/Makefile
    share/rreq/Makefile
    share/trillium/Makefile
    share/tstdio/Makefile
    tools/Makefile
    tools/hboot/Makefile
    tools/hcc/Makefile
    tools/hcc/hcp
    tools/hf77/Makefile
    tools/lamboot/Makefile
    tools/lamhalt/Makefile
    tools/lamnodes/Makefile
    tools/recon/Makefile
    tools/tkill/Makefile
    tools/wipe/Makefile
    romio/util/lam-configure-values
"}
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="share/include/lam_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 > share/include/stamp-h
chmod a+x tools/hcc/hcp romio/util/lam-configure-values
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


# ARRGGGHHH!!!  #$%@#$%@#$% IRIX.  It seems that their "make" either
# has date analysis precision of less than 1 second, or it rules that
# files of the same timestamp (according to ls -l, anyway) are out of
# date w.r.t. each other.  

# For an example of what I mean, go to share/include and do "make".
# Then do "make" again.  Try it on some other operating system (e.g.,
# Solaris, Linux).  Why does IRIX fire the same rule twice in a row?  

# The result of this is that config.status is run for *every*
# invocation of "make" on IRIX systems, which, if the "rm" statement
# below was included in the AC_OUTPUT macro (as it really should be),
# would remove the sentinel files in ROMIO and the C++ bindings,
# resulting in ROMIO and the C++ bindings being built *every* time.
# ARRGHHH!!!

# The only real solution that we can come up with (without being
# overly complicated; this just isn't worth it) is to move this rm
# statement out of the AC_OUTPUT macro.  Hence, they'll only be
# deleted via respective "*clean" targets and when configure is run.
# This *shouldn't* be too much of a problem, because the "rebuilt
# share/include/lam_config.h" mechanism built in to config.status will
# really only be effective for those who run "make depend", which is
# generally only the developers.  Ugh!!!

rm -f .lam_built romio/.lam_built mpi2c++/.lam_built
