#! /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-cache  - Turn on configure caching"
ac_help="$ac_help
--enable-strict  - Turn on strict compilation testing when using gcc"
ac_help="$ac_help
--enable-echo    - Turn on echoing from within the configure script"
ac_help="$ac_help
--enable-weak-symbols - Use weak symbols to provide the profiling interface
    (default)"
ac_help="$ac_help
--enable-f90 - Find and use a Fortran 90 compiler (default:enable)"
ac_help="$ac_help
--enable-f90modules - Build an MPI module for use with Fortran 90"
ac_help="$ac_help
--enable-use-pointer - Use the common pointer extension for MPI_BOTTOM and
    related special values"
ac_help="$ac_help
--enable-runtimevalues - Determine various parameters of the Fortran 
                         environment at run time, such as the values for
                         .TRUE. and .FALSE. .  This allows a single MPICH
                         library to be used with multiple Fortran compilers"
ac_help="$ac_help
--with-flibname=name  - Specify name of library containing Fortran interface
routines"
ac_help="$ac_help
--with-fwrapname=name  - Specify name of library containing Fortran interface
routines"
ac_help="$ac_help
--with-cross=file - Specify the values of variables that configure cannot
determine in a cross-compilation environment"
ac_help="$ac_help
--with-mpichconfig=file - Use file for the MPICH configuration.
              Normally, this file is mpichlib.conf, but other files
              may be used."
ac_help="$ac_help
--with-subname=name - Use this name for forming the names of the 
              directories to install the mpif.h include file and 
              libraries, as well as the mpif77-name.conf file.  This
              should be used to support multiple Fortran compilers with
              a single MPICH build.  It must be used in conjunction with
              --with-mpichconfig"

# 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=Makefile.in

# 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

if test "X$cache_system" = "X" ; then
    # A default file name, just in case
    cache_system="config.system"
    if test "$cache_file" != "/dev/null" ; then
        # Get the directory for the cache file, if any
	
        cache_system=`echo $cache_file | sed -e 's%^\(.*/\)[^/]*%\1/config.system%'`
	
        test "x$cache_system" = "x$cache_file" && cache_system="config.system"
#    else
#        We must *not* set enable_cache to no because we need to know if
#        enable_cache was not set.  
#        enable_cache=no
    fi
fi
if test -z "$real_enable_cache" ; then
    real_enable_cache=$enable_cache
    if test -z "$real_enable_cache" ; then real_enable_cache="notgiven" ; fi
fi
if test "X$real_enable_cache" = "Xnotgiven" ; then
    # check for valid cache file
    if test -z "$cache_system" ; then cache_system="config.system" ; fi
    if uname -srm >/dev/null 2>&1 ; then
		cleanargs=`echo "$CC $F77 $CXX $F90" | tr '"' ' '`
        testval="`uname -srm` $cleanargs"
        if test -f "$cache_system" -a -n "$testval" ; then
	    if test "$testval" = "`cat $cache_system`" ; then
	        real_enable_cache="yes"
	    fi
        elif test ! -f "$cache_system" -a -n "$testval" ; then
	    echo "$testval" > $cache_system
	    # remove the cache file because it may not correspond to our
	    # system
	    rm -f $cache_file
	    real_enable_cache="yes"
        fi
    fi
fi
if test "X$real_enable_cache" = "Xyes" -a "$cache_file" = "/dev/null" ; then
    real_enable_cache=no
fi
if test "X$real_enable_cache" = "Xyes" ; then
  if test -r "$cache_file" ; then
    echo "loading cache $cache_file"
    if test -w "$cache_file" ; then
        # Clean the cache file (ergh)
	
    rm -f confcache
    sed -e "s/'\\\\''//g" -e "s/'\\\\/'/" -e "s/\\\\'/'/" \
		-e "s/'\\\\''//g" $cache_file > confcache
    if cmp -s $cache_file confcache ; then
        :
    else
        if test -w $cache_file ; then
	    echo "updating cache $cache_file"
            cat confcache > $cache_file
        else
            echo "not updating unwritable cache $cache_file"
        fi
    fi	
    rm -f confcache
    if test "$DEBUG_AUTOCONF_CACHE" = "yes" ; then
        echo "Results of cleaned cache file:"
	echo "--------------------------------------------------------"
	cat $cache_file
	echo "--------------------------------------------------------"
    fi

    fi
    . $cache_file
  else
    echo "creating cache $cache_file"
    > $cache_file
    rm -f $cache_system
    cleanargs=`echo "$CC $F77 $CXX" | tr '"' ' '`
    testval="`uname -srm` $cleanargs"
    echo "$testval" > $cache_system
  fi
else
  cache_file="/dev/null"
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

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


rm -f ${srcdir}/mpi_fortconf.h mpi_fortconf.h

if test -f $CONFIG_AUX_DIR/install-sh ; then ac_aux_dir=$CONFIG_AUX_DIR 
else
ac_aux_dir=
for ac_dir in ../../../confdb $srcdir/../../../confdb; 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
fi
if test -z "$ac_aux_dir"; then
  { echo "configure: error: can not find install-sh or install.sh in ../../../confdb $srcdir/../../../confdb" 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.

if test -z "$HAVE_MPID_FORTDEFS_H" ; then
    HAVE_MPID_FORTDEFS_H=0
fi



# Check whether --enable-cache or --disable-cache was given.
if test "${enable_cache+set}" = set; then
  enableval="$enable_cache"
  enable_cache="$enableval"
else
  enable_cache="notgiven"
fi



# Check whether --enable-strict or --disable-strict was given.
if test "${enable_strict+set}" = set; then
  enableval="$enable_strict"
  COPTIONS="${COPTIONS} -Wall -O -Wstrict-prototypes -Wmissing-prototypes -DGCC_WALL"
fi


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


# Check whether --enable-weak-symbols or --disable-weak-symbols was given.
if test "${enable_weak_symbols+set}" = set; then
  enableval="$enable_weak_symbols"
  enable_weak=$enableval
else
  enable_weak="yes"
fi


# Check whether --enable-f90 or --disable-f90 was given.
if test "${enable_f90+set}" = set; then
  enableval="$enable_f90"
  enable_f90=$enableval
else
  enable_f90="yes"
fi


# Check whether --enable-f90modules or --disable-f90modules was given.
if test "${enable_f90modules+set}" = set; then
  enableval="$enable_f90modules"
  do_f90_modules=$enableval
else
  do_f90_modules="yes"
fi


# Check whether --enable-use-pointer or --disable-use-pointer was given.
if test "${enable_use_pointer+set}" = set; then
  enableval="$enable_use_pointer"
  use_pointer_in_f77=$enableval
else
  use_pointer_in_f77="no"
fi


# Check whether --enable-runtimevalues or --disable-runtimevalues was given.
if test "${enable_runtimevalues+set}" = set; then
  enableval="$enable_runtimevalues"
  use_runtimevalues=$enableval
else
  use_rutimevalues=false
fi

# Check whether --with-flibname or --without-flibname was given.
if test "${with_flibname+set}" = set; then
  withval="$with_flibname"
  FLIBNAME=$withval;set_FLIBNAME="yes"
else
  FLIBNAME=mpich
fi



# Check whether --with-fwrapname or --without-fwrapname was given.
if test "${with_fwrapname+set}" = set; then
  withval="$with_fwrapname"
  FWRAPNAME=$withval;set_FWRAPNAME="yes"
else
  FWRAPNAME=fmpich
fi



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


# Check whether --with-mpichconfig or --without-mpichconfig was given.
if test "${with_mpichconfig+set}" = set; then
  withval="$with_mpichconfig"
  if test -z "$withval" -o "X$withval" = "Xyes" ; then 
    mpichconfig_file=../../util/mpichlib.conf
else 
    mpichconfig_file=$withval
fi

else
  mpichconfig_file=""
fi


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


if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status ; then
    { echo "configure: error: You cannot do a VPATH build if the source directory has been
    configured.  Run "make distclean" in $srcdir first." 1>&2; exit 1; }
fi

if test -z "$top_srcdir" ; then
   use_top_srcdir=$srcdir   
else
   use_top_srcdir=$top_srcdir
fi
if test -z "$master_top_srcdir" ; then 
    master_top_srcdir=$use_top_srcdir
fi

export master_top_srcdir

if test "$with_cross" != "no" ; then
    if test -s "$with_cross" ; then
        echo "$ac_t""Reading values from cross-compilation file $with_cross" 1>&6
        . $with_cross
    fi
    # with_cross may have been passed down from above (in a calling configure)
    # so set the cross-compilation options independent of whether the
    # file exists.
    # Autoconf 2.52 no longer sets cross_compiling except with the
    # awkward "targethost" options.
    pac_cross_compiling=yes
    cross_compiling=yes
    ac_cv_prog_cc_cross=yes
    ac_cv_prog_f77_cross=yes
    ac_cv_prog_cxx_cross=yes
    export cross_compiling
fi

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

fi

if test -n "$subname" -a -z "$mpichconfig_file" ; then
    { echo "configure: error: Must specify --with-mpichconfig with --with-subname" 1>&2; exit 1; }
fi

# Read any cross-compilation variable values
if test "$cross_file" != "/dev/null" -a -s "$cross_file" ; then
    . $cross_file
fi

if test -n "$mpichconfig_file" -a -s "$mpichconfig_file" ; then
    . $mpichconfig_file
    pac_lib_mpi_is_building="yes"
fi


#
# Define the installation directory names (defaults)
if test -n "$subname" ; then
    # add the leading hyphen
    subname="-$subname"
    f77includedir='${includedir}'"/${subname}"
    f77libdir='${libdir}'
    f77bindir='${bindir}'
    if test "$set_FLIBNAME" != "yes" ; then
	FLIBNAME="mpich$subname"
    fi
    if test "$set_FWRAPNAME" != "yes" ; then
	FWRAPNAME="fmpich$subname"
    fi
else
    subname="-`echo $F77 | sed 's/ /-/g'`"
    # Don't include the (sub)name in the defaults
    f77includedir='${includedir}'
    f77libdir='${libdir}'
    f77bindir='${bindir}'
fi






    # We should replace mpicc with the values used in the MPICH build.
    # This is best done with an environment variable (? what about 
    # config.status re-execution?)
    INCLUDES="$mpich_includes"
    if test "$hasMPE" = "unknown" ; then
	hasMPE="yes"
    fi
    



for ac_prog in cc xlC xlc pgcc icc gcc 
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:889: 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="$ac_prog"
      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

test -n "$CC" && break
done

test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
echo "configure:920: 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 931 "configure"
#include "confdefs.h"

main(){return(0);}
EOF
if { (eval echo configure:936: \"$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:962: 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 the C compiler sets its return status correctly""... $ac_c" 1>&6
echo "configure:967: checking whether the C compiler sets its return status correctly" >&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 977 "configure"
#include "confdefs.h"

int main() {
int a = bzzzt;
; return 0; }
EOF
if { (eval echo configure:984: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  rm -rf conftest*
  notbroken=no
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  notbroken=yes
fi
rm -f conftest*
echo "$ac_t""$notbroken" 1>&6
if test "$notbroken" = "no" ; then
    { echo "configure: error: installation or configuration problem: C compiler does not
correctly set error code when a fatal error occurs" 1>&2; exit 1; }
fi

echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
echo "configure:1001: 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:1010: \"$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

echo $ac_n "checking for working const""... $ac_c" 1>&6
echo "configure:1025: checking for working const" >&5
if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  cat > conftest.$ac_ext <<EOF
#line 1030 "configure"
#include "confdefs.h"

int main() {

/* Ultrix mips cc rejects this.  */
typedef int charset[2]; const charset x;
/* SunOS 4.1.1 cc rejects this.  */
char const *const *ccp;
char **p;
/* NEC SVR4.0.2 mips cc rejects this.  */
struct point {int x, y;};
static struct point const zero = {0,0};
/* AIX XL C 1.02.0.0 rejects this.
   It does not let you subtract one const X* pointer from another in an arm
   of an if-expression whose if-part is not a constant expression */
const char *g = "string";
ccp = &g + (g ? g-g : 0);
/* HPUX 7.0 cc rejects these. */
++ccp;
p = (char**) ccp;
ccp = (char const *const *) p;
{ /* SCO 3.2v4 cc rejects this.  */
  char *t;
  char const *s = 0 ? (char *) 0 : (char const *) 0;

  *t++ = 0;
}
{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */
  int x[] = {25, 17};
  const int *foo = &x[0];
  ++foo;
}
{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
  typedef const int *iptr;
  iptr p = 0;
  ++p;
}
{ /* AIX XL C 1.02.0.0 rejects this saying
     "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
  struct s { int j; const int *ap[3]; };
  struct s *b; b->j = 5;
}
{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
  const int foo = 10;
}

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

echo "$ac_t""$ac_cv_c_const" 1>&6
if test $ac_cv_c_const = no; then
  cat >> confdefs.h <<\EOF
#define const 
EOF

fi

# Check on support for long double and long long types.
echo $ac_n "checking whether long double is supported""... $ac_c" 1>&6
echo "configure:1101: checking whether long double is supported" >&5
if eval "test \"`echo '$''{'pac_cv_have_long_double'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  
cat > conftest.$ac_ext <<EOF
#line 1107 "configure"
#include "confdefs.h"

int main() {
long double a;
; return 0; }
EOF
if { (eval echo configure:1114: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  rm -rf conftest*
  pac_cv_have_long_double=yes
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  pac_cv_have_long_double=no
fi
rm -f conftest*
fi

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

fi
echo $ac_n "checking whether long long is supported""... $ac_c" 1>&6
echo "configure:1134: checking whether long long is supported" >&5
if eval "test \"`echo '$''{'pac_cv_have_long_long'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  
cat > conftest.$ac_ext <<EOF
#line 1140 "configure"
#include "confdefs.h"

int main() {
long double a;
; return 0; }
EOF
if { (eval echo configure:1147: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  rm -rf conftest*
  pac_cv_have_long_long=yes
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  pac_cv_have_long_long=no
fi
rm -f conftest*
fi

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

fi
# Allow FC as a synonym for F77, but only if F77 is not set.
if test -n "$FC" -a -z "$F77" ; then 
    F77="$FC"
fi
save_FFLAGS="$FFLAGS"
if test -z "$F77"; then
  for ac_prog in g77 f77 f2c
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:1177: 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 -z "$F77" && { echo "configure: error: no acceptable Fortran 77 compiler found in \$PATH" 1>&2; exit 1; }
fi

echo $ac_n "checking whether the Fortran 77 compiler ($F77 $FFLAGS $LDFLAGS) works""... $ac_c" 1>&6
echo "configure:1210: checking whether the Fortran 77 compiler ($F77 $FFLAGS $LDFLAGS) works" >&5

ac_ext=f
ac_compile='${F77-f77} -c $FFLAGS conftest.$ac_ext 1>&5'
ac_link='${F77-f77} -o conftest${ac_exeext} $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_f77_cross

cat > conftest.$ac_ext << EOF

      program conftest
      end

EOF
if { (eval echo configure:1223: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  ac_cv_prog_f77_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_f77_cross=no
  else
    ac_cv_prog_f77_cross=yes
  fi
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  ac_cv_prog_f77_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_f77_works" 1>&6
if test $ac_cv_prog_f77_works = no; then
  { echo "configure: error: installation or configuration problem: Fortran 77 compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the Fortran 77 compiler ($F77 $FFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
echo "configure:1249: checking whether the Fortran 77 compiler ($F77 $FFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_f77_cross" 1>&6
cross_compiling=$ac_cv_prog_f77_cross

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

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

if test $ac_cv_prog_g77 = yes; then
  G77=yes
  ac_test_FFLAGS="${FFLAGS+set}"
  ac_save_FFLAGS="$FFLAGS"
  FFLAGS=
  echo $ac_n "checking whether $F77 accepts -g""... $ac_c" 1>&6
echo "configure:1278: checking whether $F77 accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_f77_g'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  cat > conftest.f << EOF
       program conftest
       end
EOF
if test -z "`$F77 -g -c conftest.f 2>&1`"; then
  ac_cv_prog_f77_g=yes
else
  ac_cv_prog_f77_g=no
fi
rm -f conftest*

fi

echo "$ac_t""$ac_cv_prog_f77_g" 1>&6
  if test "$ac_test_FFLAGS" = set; then
    FFLAGS="$ac_save_FFLAGS"
  elif test $ac_cv_prog_f77_g = yes; then
    FFLAGS="-g -O2"
  else
    FFLAGS="-O2"
  fi
else
  G77=
  test "${FFLAGS+set}" = set || FFLAGS="-g"
fi

FFLAGS="$save_FFLAGS"
# Bug in autoconf.  Restore cross settings
if test "$pac_cross_compiling" = "yes" -a "$ac_cv_prog_f77_cross" = "no" ; then
    echo "$ac_t""Resetting cross compilation to yes" 1>&6
    cross_compiling=yes
    ac_cv_prog_cc_cross=yes
    ac_cv_prog_f77_cross=yes
    ac_cv_prog_f90_cross=yes
    ac_cv_prog_cxx_cross=yes
fi


if test -z "$FLINKER" ; then
   FLINKER="$F77"
fi

# We need F90 to get the OFFSET_KIND and ADDRESS_KIND values.
if test "$enable_f90" != "no" ; then
    
if test -z "$F90" ; then
    for ac_prog in f95 f90 xlf90 pgf90 efc
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:1333: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_F90'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  if test -n "$F90"; then
  ac_cv_prog_F90="$F90" # 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_F90="$ac_prog"
      break
    fi
  done
  IFS="$ac_save_ifs"
fi
fi
F90="$ac_cv_prog_F90"
if test -n "$F90"; then
  echo "$ac_t""$F90" 1>&6
else
  echo "$ac_t""no" 1>&6
fi

test -n "$F90" && break
done

    test -z "$F90" && echo "configure: warning: no acceptable Fortran 90 compiler found in \$PATH" 1>&2
fi
if test -n "$F90" ; then
     echo $ac_n "checking for extension for Fortran 90 programs""... $ac_c" 1>&6
echo "configure:1366: checking for extension for Fortran 90 programs" >&5
pac_cv_f90_ext="f90"
cat > conftest.$pac_cv_f90_ext <<EOF
      program conftest
      end
EOF
ac_compile='${F90-f90} -c $F90FLAGS conftest.$pac_cv_f90_ext 1>&5'
if { (eval echo configure:1373: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } ; then
    echo "$ac_t""f90" 1>&6
else
    rm -f conftest*
    pac_cv_f90_ext="f"
    cat > conftest.$pac_cv_f90_ext <<EOF
      program conftest
      end
EOF
    if { (eval echo configure:1382: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } ; then
	echo "$ac_t""f" 1>&6
    else
        echo "$ac_t""unknown!" 1>&6
    fi
fi
echo $ac_n "checking whether the Fortran 90 compiler ($F90 $F90FLAGS $LDFLAGS) works""... $ac_c" 1>&6
echo "configure:1389: checking whether the Fortran 90 compiler ($F90 $F90FLAGS $LDFLAGS) works" >&5

# We cannot use _LANG_FORTRAN90 here because we will usually be executing this
# test in the context of _PROG_F90, which is a require on _LANG_FORTRAN90.
# Instead, we insert the necessary code from _LANG_FORTRAN90 here
ac_ext=$pac_cv_f90_ext
ac_compile='${F90-f90} -c $F90FLAGS conftest.$ac_ext 1>&5'
ac_link='${F90-f90} -o conftest${ac_exeext} $F90FLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$pac_cv_prog_f90_cross
cat >conftest.$ac_ext <<EOF
      program conftest
      end
EOF
if { (eval echo configure:1402: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeect} ; then
    pac_cv_prog_f90_works="yes"
    if (./conftest; exit) 2>/dev/null ; then
        pac_cv_prog_f90_cross="no"
    else
        pac_cv_prog_f90_cross="yes"
    fi
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  pac_cv_prog_f90_works="no"
fi
rm -f 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""$pac_cv_prog_f90_works" 1>&6
if test $pac_cv_prog_f90_works = no; then
  echo "configure: warning: installation or configuration problem: Fortran 90 compiler cannot create executables." 1>&2
fi
echo $ac_n "checking whether the Fortran 90 compiler ($F90 $F90FLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
echo "configure:1427: checking whether the Fortran 90 compiler ($F90 $F90FLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$pac_cv_prog_f90_cross" 1>&6
cross_compiling=$pac_cv_prog_f90_cross

fi
ac_f90ext=$pac_cv_f90_ext
ac_f90compile='${F90-f90} -c $F90FLAGS conftest.$ac_f90ext 1>&5'
ac_f90link='${F90-f90} -o conftest${ac_exeext} $F90FLAGS $LDFLAGS conftest.$ac_f90ext $LIBS 1>&5'
# Check for problems with Intel efc compiler, if the compiler works
if test "$pac_cv_prog_f90_works" = yes ; then
    cat > conftest.$ac_f90ext <<EOF
        program main
        end
EOF
    pac_msg=`$F90 -o conftest $F90FLAGS $LDFLAGS conftest.$ac_f90ext $LIBS 2>&1 | grep 'bfd assertion fail'`
    if test -n "$pac_msg" ; then
        pac_msg=`$F90 -o conftest $F90FLAGS $LDFLAGS conftest.$ac_f90ext -i_dynamic $LIBS 2>&1 | grep 'bfd assertion fail'`
        if test -z "$pac_msg" ; then LDFLAGS="-i_dynamic" ; fi
        # There should really be f90linker flags rather than generic ldflags.
    fi
fi

    if test -z "$F90" ; then
        enable_f90=no
    else
        if test -z "$F90LINKER" ; then
            F90LINKER="$F90"
        fi
    fi
    
fi

true
if test "X$MAKE" = "X" ; then
   for ac_prog in make gnumake nmake pmake smake
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:1466: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_MAKE'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  if test -n "$MAKE"; then
  ac_cv_prog_MAKE="$MAKE" # 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_MAKE="$ac_prog"
      break
    fi
  done
  IFS="$ac_save_ifs"
fi
fi
MAKE="$ac_cv_prog_MAKE"
if test -n "$MAKE"; then
  echo "$ac_t""$MAKE" 1>&6
else
  echo "$ac_t""no" 1>&6
fi

test -n "$MAKE" && break
done

fi


echo $ac_n "checking whether clock skew breaks make""... $ac_c" 1>&6
echo "configure:1499: checking whether clock skew breaks make" >&5
if eval "test \"`echo '$''{'pac_cv_prog_make_found_clock_skew'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  

rm -f conftest*
cat > conftest <<EOF
ALL:
	@-echo "success"
EOF
$MAKE -f conftest > conftest.out 2>&1
if grep -i skew conftest >/dev/null 2>&1 ; then
    pac_cv_prog_make_found_clock_skew=yes
else
    pac_cv_prog_make_found_clock_skew=no
fi
rm -f conftest*

fi

echo "$ac_t""$pac_cv_prog_make_found_clock_skew" 1>&6
if test "$pac_cv_prog_make_found_clock_skew" = "yes" ; then
    echo "configure: warning: Clock skew found by make.  The configure and build may fail.
Consider building in a local instead of NFS filesystem." 1>&2
fi


echo $ac_n "checking whether make echos directory changes""... $ac_c" 1>&6
echo "configure:1528: checking whether make echos directory changes" >&5
if eval "test \"`echo '$''{'pac_cv_prog_make_echos_dir'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  

/bin/rm -f conftest
cat > conftest <<.
SHELL=/bin/sh
ALL:
	@(dir="`pwd`" ; cd .. ; \$(MAKE) -f "\$\$dir/conftest" SUB)
SUB:
	@echo "success"
.
str="`$MAKE -f conftest 2>&1`"
if test "$str" != "success" ; then
    str="`$MAKE --no-print-directory -f conftest 2>&1`"
    if test "$str" = "success" ; then
	pac_cv_prog_make_echos_dir="yes using --no-print-directory"
    else
	pac_cv_prog_make_echos_dir="no"
	echo "Unexpected output from make with program" >>config.log
	cat conftest >>config.log
	echo "str" >> config.log
    fi
else
    pac_cv_prog_make_echos_dir="no"
fi
/bin/rm -f conftest
str=""

fi

echo "$ac_t""$pac_cv_prog_make_echos_dir" 1>&6
if test "$pac_cv_prog_make_echos_dir" = "yes using --no-print-directory" ; then
    MAKE="$MAKE --no-print-directory"
fi


echo $ac_n "checking whether make supports include""... $ac_c" 1>&6
echo "configure:1568: checking whether make supports include" >&5
if eval "test \"`echo '$''{'pac_cv_prog_make_include'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  

/bin/rm -f conftest
cat > conftest <<.
ALL:
	@echo "success"
.
cat > conftest1 <<.
include conftest
.
pac_str=`$MAKE -f conftest1 2>&1`
/bin/rm -f conftest conftest1
if test "$pac_str" != "success" ; then
    pac_cv_prog_make_include="no"
else
    pac_cv_prog_make_include="yes"
fi

fi

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


echo $ac_n "checking whether make allows comments in actions""... $ac_c" 1>&6
echo "configure:1601: checking whether make allows comments in actions" >&5
if eval "test \"`echo '$''{'pac_cv_prog_make_allows_comments'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  

/bin/rm -f conftest
cat > conftest <<.
SHELL=/bin/sh
ALL:
	@# This is a valid comment!
	@echo "success"
.
pac_str=`$MAKE -f conftest 2>&1`
/bin/rm -f conftest 
if test "$pac_str" != "success" ; then
    pac_cv_prog_make_allows_comments="no"
else
    pac_cv_prog_make_allows_comments="yes"
fi

fi

echo "$ac_t""$pac_cv_prog_make_allows_comments" 1>&6
if test "$pac_cv_prog_make_allows_comments" = "no" ; then
    echo "configure: warning: Your make does not allow comments in target code.
Using this make may cause problems when building programs.
You should consider using gnumake instead." 1>&2
    
fi



echo $ac_n "checking for virtual path format""... $ac_c" 1>&6
echo "configure:1635: checking for virtual path format" >&5
if eval "test \"`echo '$''{'pac_cv_prog_make_vpath'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  

rm -rf conftest*
mkdir conftestdir
cat >conftestdir/a.c <<EOF
A sample file
EOF
cat > conftest <<EOF
all: a.o
VPATH=.:conftestdir
.c.o:
	@echo \$<
EOF
ac_out=`$MAKE -f conftest 2>&1 | grep 'conftestdir/a.c'`
if test -n "$ac_out" ; then 
    pac_cv_prog_make_vpath="VPATH"
else
    rm -f conftest
    cat > conftest <<EOF
all: a.o
.PATH: . conftestdir
.c.o:
	@echo \$<
EOF
    ac_out=`$MAKE -f conftest 2>&1 | grep 'conftestdir/a.c'`
    if test -n "$ac_out" ; then 
        pac_cv_prog_make_vpath=".PATH"
    else
	pac_cv_prog_make_vpath="neither VPATH nor .PATH works"
    fi
fi
rm -rf conftest*

fi

echo "$ac_t""$pac_cv_prog_make_vpath" 1>&6
if test "$pac_cv_prog_make_vpath" = "VPATH" ; then
    VPATH='VPATH=.:${srcdir}'
elif test "$pac_cv_prog_make_vpath" = ".PATH" ; then
    VPATH='.PATH: . ${srcdir}'
fi



echo $ac_n "checking whether make sets CFLAGS""... $ac_c" 1>&6
echo "configure:1684: checking whether make sets CFLAGS" >&5
if eval "test \"`echo '$''{'pac_cv_prog_make_set_cflags'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  

/bin/rm -f conftest
cat > conftest <<EOF
SHELL=/bin/sh
ALL:
	@echo X\${CFLAGS}X
EOF
pac_str=`$MAKE -f conftest 2>&1`
/bin/rm -f conftest 
if test "$pac_str" = "XX" ; then
    pac_cv_prog_make_set_cflags="no"
else
    pac_cv_prog_make_set_cflags="yes"
fi

fi

echo "$ac_t""$pac_cv_prog_make_set_cflags" 1>&6
if test "$pac_cv_prog_make_set_cflags" = "no" ; then
    :
else
    SET_CFLAGS='CFLAGS='
fi

if test "$pac_cv_prog_make_echos_dir" = "no" ; then
    echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
echo "configure:1715: 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

else
    SET_MAKE="MAKE=${MAKE-make}"
fi

# archive program
# In some cases, the AR definition in the MPICH configure is exported.
# Define our own AR here, just in case
if test -n "$ARCMD" ; then
    AR="$ARCMD"
else
    AR=ar
fi

# 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:1766: 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 mkdir -p works""... $ac_c" 1>&6
echo "configure:1820: checking whether mkdir -p works" >&5
if eval "test \"`echo '$''{'pac_cv_mkdir_p'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  
pac_cv_mkdir_p=no
rm -rf .tmp
if mkdir -p .tmp/.foo 1>/dev/null 2>&1 ; then 
    if test -d .tmp/.foo ; then 
        pac_cv_mkdir_p=yes
    fi
fi
rm -rf .tmp

fi

echo "$ac_t""$pac_cv_mkdir_p" 1>&6
if test "$pac_cv_mkdir_p" = "yes" ; then
   MKDIR_P="mkdir -p"
   export MKDIR_P
else
   echo "configure: warning: mkdir -p does not work; the install step may fail" 1>&2
fi


# Note that we set RANLIB to true if we don't find it (some systems neither
# need it nor provide it)
for ac_prog in ranlib
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:1852: 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="$ac_prog"
      break
    fi
  done
  IFS="$ac_save_ifs"
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

test -n "$RANLIB" && break
done
test -n "$RANLIB" || RANLIB="true"


# allow for a different linker for Fortran programs

if test -z "$F77LINKER" ; then
    F77LINKER="$F77"
fi


#
# The following variables are used in mpif77.in and reflect the MPI
# implementation that is in use.
# 
# Here are the commands to substitute the compilers to be used to create
# shared libraries.  The choices for the first two come down from the
# top-level configure.  FC_SHL must be determined in this configure



if test "$ENABLE_SHLIB" = "gcc" ; then
   # Assume that the compiler is g77 if gcc style shared libraries chosen
   FC_SHL="$FC -shared -fpic"
fi

if test "$pac_lib_mpi_is_building" = "yes" ; then
    # These values are EXPORTED by the MPICH configure
    # Alternately, if we are building a *new* Fortran library for a
    # pre-existing MPICH build, we need to get these variables from
    # the MPICH library configuration file.
    
    
    
    F77_LDFLAGS="$ROMIO_LFLAGS"
    
    BASE_FFLAGS="$ROMIO_TFFLAGS"
    
    
    
    # Shared library support (replace with libtool?)
    
    
    
    
    
    MPI2_OBJECTS='${MPI2_OBJECTS}'
    
fi
if test "$DEBUG_DUMP" = "yes" ; then
    rm -f config.env
    echo "Environment before push" >>config.env
    set >>config.env
    echo "End of env" >> config.env
fi

if test "X$pac_save_level" = "X" ; then
    pac_save_CC="$CC"
    pac_save_CXX="$CXX"
    pac_save_F77="$F77"
    pac_save_F90="$F90"
    pac_save_prog_cc_cross="$ac_cv_prog_cc_cross"
    pac_save_prog_f77_cross="$ac_cv_prog_f77_cross"
    pac_save_prog_cxx_cross="$ac_cv_prog_cxx_cross"
    pac_save_prog_f90_cross="$pac_cv_prog_f90_cross"
    if test "X$CPP" = "X" ; then
	echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
echo "configure:1946: 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 1961 "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:1967: \"$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 1978 "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:1984: \"$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 1995 "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:2001: \"$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
    pac_save_CPP="$CPP"
    CC="${TESTCC:=$CC}"
    CXX="${TESTCXX:=$CXX}"
    F77="${TESTF77:=$F77}"
    F90="${TESTF90:=$F90}"
    if test -z "$TESTCPP" ; then
        
if test -z "$TESTCPP"; then
  if eval "test \"`echo '$''{'pac_cv_prog_TESTCPP'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  
  rm -f conftest.*
  cat > conftest.c <<EOF
  #include <assert.h>
  Syntax Error
EOF
  # On the NeXT, cc -E runs the code through the compiler's parser,
  # not just through cpp.
  TESTCPP="${TESTCC-cc} -E"
  ac_try="$TESTCPP conftest.c >/dev/null 2>conftest.out"
  if { (eval echo configure:2047: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ; then
      pac_cv_prog_TESTCPP="$TESTCPP"
  fi
  if test "X$pac_cv_prog_TESTCPP" = "X" ; then
      TESTCPP="${TESTCC-cc} -E -traditional-cpp"
      ac_try="$TESTCPP conftest.c >/dev/null 2>conftest.out"
      if { (eval echo configure:2053: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ; then
          pac_cv_prog_TESTCPP="$TESTCPP"
      fi
  fi
  if test "X$pac_cv_prog_TESTCPP" = "X" ; then
      TESTCPP="${TESTCC-cc} -nologo -E"
      ac_try="$TESTCPP conftest.c >/dev/null 2>conftest.out"
      if { (eval echo configure:2060: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ; then
          pac_cv_prog_TESTCPP="$TESTCPP"
      fi
  fi
  if test "X$pac_cv_prog_TESTCPP" = "X" ; then
      # Extract the first word of "cpp", so it can be a program name with args.
set dummy cpp; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:2068: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_TESTCPP'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  case "$TESTCPP" in
  /*)
  ac_cv_path_TESTCPP="$TESTCPP" # Let the user override the test with a path.
  ;;
  ?:/*)			 
  ac_cv_path_TESTCPP="$TESTCPP" # 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_TESTCPP="$ac_dir/$ac_word"
      break
    fi
  done
  IFS="$ac_save_ifs"
  ;;
esac
fi
TESTCPP="$ac_cv_path_TESTCPP"
if test -n "$TESTCPP"; then
  echo "$ac_t""$TESTCPP" 1>&6
else
  echo "$ac_t""no" 1>&6
fi

  fi
  rm -f conftest.*
  
fi

else
  pac_cv_prog_TESTCPP="$TESTCPP"
fi

    fi
    CPP="${TESTCPP:=$CPP}"
    pac_save_level="0"
    # Recompute cross_compiling values and set for the current language
    # This is just:
    
    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

    if test "$pac_cross_compiling" = "yes" ; then
        ac_cv_prog_cc_cross=yes
	ac_cv_prog_cc_works=yes
    else
        cat > conftest.$ac_ext << EOF

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

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

    # Ignore Fortran if we aren't using it.
    if test -n "$F77" ; then
        
        ac_ext=f
ac_compile='${F77-f77} -c $FFLAGS conftest.$ac_ext 1>&5'
ac_link='${F77-f77} -o conftest${ac_exeext} $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_f77_cross

	if test "$pac_cross_compiling" = "yes" ; then
	    ac_cv_prog_f77_cross=yes
	    ac_cv_prog_f77_works=yes
	else
            cat > conftest.$ac_ext << EOF

      program conftest
      end

EOF
if { (eval echo configure:2173: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  ac_cv_prog_f77_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_f77_cross=no
  else
    ac_cv_prog_f77_cross=yes
  fi
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  ac_cv_prog_f77_works=no
fi
rm -fr conftest*
	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

    fi
    # Ignore C++ if we aren't using it.
    if test -n "$CXX" ; then
        
        ac_ext=C
# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_cxx_cross

        cat > conftest.$ac_ext << EOF

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

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

    fi
    # Ignore Fortran 90 if we aren't using it.
    if test -n "$F90" ; then
        
        
ac_ext=$pac_cv_f90_ext
ac_compile='${F90-f90} -c $F90FLAGS conftest.$ac_ext 1>&5'
ac_link='${F90-f90} -o conftest${ac_exeext} $F90FLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$pac_cv_prog_f90_cross

	        	if test "$pac_cross_compiling" = "yes" ; then
	    ac_cv_prog_f90_cross=yes
	    ac_cv_prog_f90_works=yes
	else
            cat > conftest.$ac_ext << EOF
      program conftest
      end
EOF
            if { (eval echo configure:2324: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
              ac_cv_prog_f90_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_f90_cross=no
              else
                  ac_cv_prog_f90_cross=yes
              fi
            else
              echo "configure: failed program was:" >&5
              cat conftest.$ac_ext >&5
              ac_cv_prog_f90_works=no
            fi
	fi
	pac_cv_prog_f90_cross="$ac_cv_prog_f90_cross"
	pac_cv_prog_f90_works="$ac_cv_prog_f90_works"
        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

    fi
fi
pac_save_level=`expr $pac_save_level + 1`

if test "$DEBUG_DUMP" = "yes" ; then
    echo "Environment after push" >>config.env
    set >>config.env
    echo "End of env" >> config.env
fi
if test "$f90nag" = "1" -o "$f95nag" = "1" ; then 
    NOG2C=yes 
else 
    NOG2C=no
fi
#
# Tru64 Unix (at least V5.0) implements neither the RANDOM variable nor the
# mktemp function.  This will cause config.guess to fail.  To workaround this,
# we define RANDOM using date if it is not defined
# Grr.  This doesn't work because configure execute config.guess in 
# a separate shell, using sh .  The only fix is to specify a -host 
# when running configure.  Sigh.
#if test -z "$RANDOM" ; then
#    RANDOM=`date '+%H%M%S'`
#    export RANDOM
#fi
FLIBS_save="$FLIBS"
FLIBS=""

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

echo $ac_n "checking for Fortran 77 libraries""... $ac_c" 1>&6
echo "configure:2331: checking for Fortran 77 libraries" >&5


if eval "test \"`echo '$''{'ac_cv_flibs'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  echo "      END" > conftest.f
foutput=`${F77} -v -o conftest conftest.f 2>&1`
xlf_p=`echo $foutput | grep xlfentry`
if test -n "$xlf_p"; then
  foutput=`echo $foutput | sed 's/,/ /g'`
fi
ld_run_path=`echo $foutput | \
  sed -n -e 's/^.*LD_RUN_PATH *= *\([^ ]*\).*/\1/p'`
case "$ld_run_path" in
  /*)
    if test "$ac_cv_prog_gcc" = yes; then
      ld_run_path="-Xlinker -R -Xlinker $ld_run_path"
    else
      ld_run_path="-R $ld_run_path"
    fi
  ;;
  *)
    ld_run_path=
  ;;
esac
flibs=
lflags=
want_arg=
for arg in $foutput; do
  old_want_arg=$want_arg
  want_arg=
  if test -n "$old_want_arg"; then
    case "$arg" in
      -*)
        old_want_arg=
      ;;
    esac
  fi
  case "$old_want_arg" in
    '')
      case $arg in
        /*.a)
          exists=false
          for f in $lflags; do
            if test x$arg = x$f; then
              exists=true
            fi
          done
          if $exists; then
            arg=
          else
            lflags="$lflags $arg"
          fi
        ;;
        -bI:*)
          exists=false
          for f in $lflags; do
            if test x$arg = x$f; then
              exists=true
            fi
          done
          if $exists; then
            arg=
          else
            if test "$ac_cv_prog_gcc" = yes; then
              lflags="$lflags -Xlinker $arg"
            else
              lflags="$lflags $arg"
            fi
          fi
        ;;
        -lang* | -lcrt0.o | -lc | -lgcc)
          arg=
        ;;
        -[lLR])
          want_arg=$arg
          arg=
        ;;
        -[lLR]*)
          exists=false
          for f in $lflags; do
            if test x$arg = x$f; then
              exists=true
            fi
          done
          if $exists; then
            arg=
          else
            case "$arg" in
              -lkernel32)
                case "$canonical_host_type" in
                  *-*-cygwin*)
                    arg=
                  ;;
                  *)
                    lflags="$lflags $arg"
                  ;;
                esac
              ;;
              -lm)
              ;;
              *)
                lflags="$lflags $arg"
              ;;
            esac
          fi
        ;;
        -u)
          want_arg=$arg
          arg=
        ;;
        -Y)
          want_arg=$arg
          arg=
        ;;
        *)
          arg=
        ;;
      esac
    ;;
    -[lLR])
      arg="$old_want_arg $arg"
    ;;
    -u)
      arg="-u $arg"
    ;;
    -Y)
      arg=`echo $arg | sed -e 's%^P,%%'`
      SAVE_IFS=$IFS
      IFS=:
      list=
      for elt in $arg; do
        list="$list -L$elt"
      done
      IFS=$SAVE_IFS
      arg="$list"
    ;;
  esac
  if test -n "$arg"; then
    flibs="$flibs $arg"
  fi
done
if test -n "$ld_run_path"; then
  flibs_result="$ld_run_path $flibs"
else
  flibs_result="$flibs"
fi
ac_cv_flibs="$flibs_result"
fi

FLIBS="$ac_cv_flibs"
echo "$ac_t""$FLIBS" 1>&6

echo $ac_n "checking whether C can link with $FLIBS""... $ac_c" 1>&6
echo "configure:2486: checking whether C can link with $FLIBS" >&5
# Try to link a C program with all of these libraries
save_LIBS="$LIBS"
LIBS="$LIBS $FLIBS"
cat > conftest.$ac_ext <<EOF
#line 2491 "configure"
#include "confdefs.h"

int main() {
int a;
; return 0; }
EOF
if { (eval echo configure:2498: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  rm -rf conftest*
  runs=yes
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  runs=no
fi
rm -f conftest*
LIBS="$save_LIBS"
echo "$ac_t""$runs" 1>&6
if test "$runs" = "no" ; then
    echo $ac_n "checking which libraries can be used""... $ac_c" 1>&6
echo "configure:2512: checking which libraries can be used" >&5
    pac_ldirs=""
    pac_libs=""
    pac_other=""
    for name in $FLIBS ; do
        case $name in 
        -l*) pac_libs="$pac_libs $name" ;;
        -L*) pac_ldirs="$pac_ldirs $name" ;;
        *)   pac_other="$pac_other $name" ;;
        esac
    done
    save_LIBS="$LIBS"
    keep_libs=""
    for name in $pac_libs ; do 
        LIBS="$save_LIBS $pac_ldirs $pac_other $name"
        cat > conftest.$ac_ext <<EOF
#line 2528 "configure"
#include "confdefs.h"

int main() {
int a;
; return 0; }
EOF
if { (eval echo configure:2535: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  rm -rf conftest*
  runs=yes
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  runs=no
fi
rm -f conftest*
        if test $runs = "yes" ; then keep_libs="$keep_libs $name" ; fi
    done
    echo "$ac_t""$keep_libs" 1>&6
    LIBS="$save_LIBS"
    FLIBS="$pac_ldirs $pac_other $keep_libs"
fi


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

int main() {
long long a;
; return 0; }
EOF
if { (eval echo configure:2561: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  rm -rf conftest*
  cat >> confdefs.h <<\EOF
#define HAVE_LONG_LONG 1
EOF

else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
fi
rm -f conftest*
echo $ac_n "checking for linker for Fortran main programs""... $ac_c" 1>&6
echo "configure:2573: checking for linker for Fortran main programs" >&5
cat > conftest.c <<EOF
#include "confdefs.h"
#ifdef HAVE_LONG_LONG
int f(int a, long long b) { int c; c = a * ( b / 3 ) / (b-1); return c ; }
#else
int f(int a, long b) { int c; c = a * b / (b-1); return c ; }
#endif
EOF

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

if { (eval echo configure:2590: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    mv conftest.o conftest1.o
else
    { echo "configure: error: Could not compile C test program" 1>&2; exit 1; }
fi
ac_ext=f
ac_compile='${F77-f77} -c $FFLAGS conftest.$ac_ext 1>&5'
ac_link='${F77-f77} -o conftest${ac_exeext} $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_f77_cross

cat > conftest.f <<EOF
        program main
        double precision d
        print *, "hi"
        end
EOF
if { (eval echo configure:2606: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    if ${F77} -o conftest conftest.o conftest1.o $LDFLAGS 2>&5 ; then
	echo "$ac_t""Use Fortran to link programs" 1>&6
    elif ${CC} -o conftest conftest.o conftest1.o $LDFLAGS $FLIBS 2>&5 ; then
	echo "$ac_t""Use C with FLIBS to link programs" 1>&6
	F77LINKER="$CC"
        F77_LDFLAGS="$F77_LDFLAGS $FLIBS"
    else
	echo "$ac_t""Unable to determine how to link Fortran programs with C" 1>&6
    fi
else
    { echo "configure: error: Could not compile Fortran test program" 1>&2; exit 1; }
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



echo $ac_n "checking for Fortran 77 name mangling""... $ac_c" 1>&6
echo "configure:2629: checking for Fortran 77 name mangling" >&5
if eval "test \"`echo '$''{'pac_cv_prog_f77_name_mangle'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  
   # Check for strange behavior of Fortran.  For example, some FreeBSD
   # systems use f2c to implement f77, and the version of f2c that they 
   # use generates TWO (!!!) trailing underscores
   # Currently, WDEF is not used but could be...
   #
   # Eventually, we want to be able to override the choices here and
   # force a particular form.  This is particularly useful in systems
   # where a Fortran compiler option is used to force a particular
   # external name format (rs6000 xlf, for example).
   rm -f conftest*
   cat > conftest.f <<EOF
       subroutine MY_name( a )
       return
       end
EOF
   # This is the ac_compile line used if LANG_FORTRAN77 is selected
   if test "X$ac_fcompile" = "X" ; then
       ac_fcompile='${F77-f77} -c $FFLAGS conftest.f 1>&5'
   fi
   if { (eval echo configure:2653: \"$ac_fcompile\") 1>&5; (eval $ac_fcompile) 2>&5; } && test -s conftest.o ; then
	mv conftest.o fconftestf.o
   else 
	echo "configure: failed program was:" >&5
        cat conftest.f >&5
   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
   
   save_LIBS="$LIBS"
      LIBS="fconftestf.o $FLIBS $LIBS"
   cat > conftest.$ac_ext <<EOF
#line 2671 "configure"
#include "confdefs.h"

int main() {
my_name();
; return 0; }
EOF
if { (eval echo configure:2678: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  rm -rf conftest*
  pac_cv_prog_f77_name_mangle="lower"
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
fi
rm -f conftest*
   if test  "X$pac_cv_prog_f77_name_mangle" = "X" ; then
     cat > conftest.$ac_ext <<EOF
#line 2688 "configure"
#include "confdefs.h"

int main() {
my_name_();
; return 0; }
EOF
if { (eval echo configure:2695: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  rm -rf conftest*
  pac_cv_prog_f77_name_mangle="lower underscore"
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
fi
rm -f conftest*
   fi
   if test  "X$pac_cv_prog_f77_name_mangle" = "X" ; then
     cat > conftest.$ac_ext <<EOF
#line 2706 "configure"
#include "confdefs.h"

int main() {
MY_NAME();
; return 0; }
EOF
if { (eval echo configure:2713: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  rm -rf conftest*
  pac_cv_prog_f77_name_mangle="upper"
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
fi
rm -f conftest*
   fi
   if test  "X$pac_cv_prog_f77_name_mangle" = "X" ; then
     cat > conftest.$ac_ext <<EOF
#line 2724 "configure"
#include "confdefs.h"

int main() {
my_name__();
; return 0; }
EOF
if { (eval echo configure:2731: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  rm -rf conftest*
  pac_cv_prog_f77_name_mangle="lower doubleunderscore"
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
fi
rm -f conftest*
   fi
   if test  "X$pac_cv_prog_f77_name_mangle" = "X" ; then
     cat > conftest.$ac_ext <<EOF
#line 2742 "configure"
#include "confdefs.h"

int main() {
MY_name();
; return 0; }
EOF
if { (eval echo configure:2749: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  rm -rf conftest*
  pac_cv_prog_f77_name_mangle="mixed"
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
fi
rm -f conftest*
   fi
   if test  "X$pac_cv_prog_f77_name_mangle" = "X" ; then
     cat > conftest.$ac_ext <<EOF
#line 2760 "configure"
#include "confdefs.h"

int main() {
MY_name_();
; return 0; }
EOF
if { (eval echo configure:2767: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  rm -rf conftest*
  pac_cv_prog_f77_name_mangle="mixed underscore"
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
fi
rm -f conftest*
   fi
   LIBS="$save_LIBS"
   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

   rm -f fconftest*

fi

echo "$ac_t""$pac_cv_prog_f77_name_mangle" 1>&6
# Make the actual definition
pac_namecheck=`echo X$pac_cv_prog_f77_name_mangle | sed 's/ /-/g'`

case $pac_namecheck in
    X) echo "configure: warning: Cannot determine Fortran naming scheme" 1>&2 ;;
    Xlower) cat >> confdefs.h <<\EOF
#define F77_NAME_LOWER 1
EOF
 
	F77_NAME_MANGLE="F77_NAME_LOWER"
	;;
    Xlower-underscore) cat >> confdefs.h <<\EOF
#define F77_NAME_LOWER_USCORE 1
EOF

	F77_NAME_MANGLE="F77_NAME_LOWER_USCORE"
	 ;;
    Xlower-doubleunderscore) cat >> confdefs.h <<\EOF
#define F77_NAME_LOWER_2USCORE 1
EOF

	F77_NAME_MANGLE="F77_NAME_LOWER_2USCORE"
	 ;;
    Xupper) cat >> confdefs.h <<\EOF
#define F77_NAME_UPPER 1
EOF
 
	F77_NAME_MANGLE="F77_NAME_UPPER"
	;;
    Xmixed) cat >> confdefs.h <<\EOF
#define F77_NAME_MIXED 1
EOF
 
	F77_NAME_MANGLE="F77_NAME_MIXED"
	;;
    Xmixed-underscore) cat >> confdefs.h <<\EOF
#define F77_NAME_MIXED_USCORE 1
EOF
 
	F77_NAME_MANGLE="F77_NAME_MIXED_USCORE"
	;;
    *) echo "configure: warning: Unknown Fortran naming scheme" 1>&2 ;;
esac



# Warn about mixed name mangling, since many of the tests will fail
if test "$pac_cv_prog_f77_name_mangle" = "mixed" ; then
    echo "configure: warning: The compiler $F77 uses mixed case names.  Fortran is monocase
and many Fortran programs may use either upper or lower case names for MPI
calls.  Consider specifying a particular parameter to your Fortran compiler
to select either upper or lower case names.  For the Absoft compiler, 
-f selects lower case and -N109 selects upper case.  Specify new command
line options by setting the environment variable F77 to include
the options (e.g., setenv F77 \"f77 -f\")" 1>&2
fi


echo $ac_n "checking what Fortran libraries are needed to link C with Fortran""... $ac_c" 1>&6
echo "configure:2848: checking what Fortran libraries are needed to link C with Fortran" >&5
F77_IN_C_LIBS="$FLIBS"
/bin/rm -f conftest*
cat <<EOF > conftest.f
        subroutine ftest
        end
EOF
if test "X$ac_fcompile" = "X" ; then
    ac_fcompile='${F77-f77} -c $FFLAGS conftest.f 1>&5'
fi
if { (eval echo configure:2858: \"$ac_fcompile\") 1>&5; (eval $ac_fcompile) 2>&5; } && test -s conftest.o ; then
    mv conftest.o mconftestf.o
    
    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_LIBS="$LIBS"
        LIBS="mconftestf.o $save_LIBS"
    cat > conftest.$ac_ext <<EOF
#line 2871 "configure"
#include "confdefs.h"
#include <stdio.h>
int main() {

#ifdef F77_NAME_UPPER
#define ftest_ FTEST
#elif defined(F77_NAME_LOWER) || defined(F77_NAME_MIXED)
#define ftest_ ftest
#endif
ftest_();

; return 0; }
EOF
if { (eval echo configure:2885: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  rm -rf conftest*
  link_worked=yes
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  link_worked=no 
fi
rm -f conftest*
    if test "$link_worked" = "no" ; then
        flibdirs=`echo $FLIBS | tr ' ' '\012' | grep '\-L' | tr '\012' ' '`
        fliblibs=`echo $FLIBS | tr ' ' '\012' | grep -v '\-L' | tr '\012' ' '`
        for flibs in $fliblibs ; do
            LIBS="mconftestf.o $flibdirs $flibs $save_LIBS"
            cat > conftest.$ac_ext <<EOF
#line 2901 "configure"
#include "confdefs.h"
#include <stdio.h>
int main() {

#ifdef F77_NAME_UPPER
#define ftest_ FTEST
#elif defined(F77_NAME_LOWER) || defined(F77_NAME_MIXED)
#define ftest_ ftest
#endif
ftest_();

; return 0; }
EOF
if { (eval echo configure:2915: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  rm -rf conftest*
  link_worked=yes
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  link_worked=no 
fi
rm -f conftest*
            if test "$link_worked" = "yes" ; then 
	        F77_IN_C_LIBS="$flibdirs $flibs"
                break
            fi
        done
    if test "$link_worked" = "no" ; then
	# try to add libraries until it works...
        flibscat=""
        for flibs in $fliblibs ; do
	    flibscat="$flibscat $flibs"
            LIBS="mconftestf.o $flibdirs $flibscat $save_LIBS"
            cat > conftest.$ac_ext <<EOF
#line 2937 "configure"
#include "confdefs.h"
#include <stdio.h>
int main() {

#ifdef F77_NAME_UPPER
#define ftest_ FTEST
#elif defined(F77_NAME_LOWER) || defined(F77_NAME_MIXED)
#define ftest_ ftest
#endif
ftest_();

; return 0; }
EOF
if { (eval echo configure:2951: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  rm -rf conftest*
  link_worked=yes
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  link_worked=no 
fi
rm -f conftest*
            if test "$link_worked" = "yes" ; then 
	        F77_IN_C_LIBS="$flibdirs $flibscat"
                break
            fi
        done
    fi
    else
	# No libraries needed
	F77_IN_C_LIBS=""
    fi
    LIBS="$save_LIBS"
    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

else 
    echo "configure: failed program was:" >&5
    cat conftest.f >&5
fi
rm -f conftest* mconftest*
if test -z "$F77_IN_C_LIBS" ; then
    echo "$ac_t""none" 1>&6
else
    echo "$ac_t""$F77_IN_C_LIBS" 1>&6
fi



#
# Eventually, we should include a test for proper handling of characters.
# The Absoft compiler may require -N90 

ac_ext=f
ac_compile='${F77-f77} -c $FFLAGS conftest.$ac_ext 1>&5'
ac_link='${F77-f77} -o conftest${ac_exeext} $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_f77_cross


echo $ac_n "checking whether Fortran accepts ! for comments""... $ac_c" 1>&6
echo "configure:3003: checking whether Fortran accepts ! for comments" >&5
if eval "test \"`echo '$''{'pac_cv_prog_f77_exclaim_comments'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  

ac_ext=f
ac_compile='${F77-f77} -c $FFLAGS conftest.$ac_ext 1>&5'
ac_link='${F77-f77} -o conftest${ac_exeext} $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_f77_cross

cat > conftest.$ac_ext <<EOF
      program main

!      This is a comment

      end
EOF
if { (eval echo configure:3020: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  rm -rf conftest*
  pac_cv_prog_f77_exclaim_comments="yes"
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  pac_cv_prog_f77_exclaim_comments="no"
fi
rm -f conftest*
ac_ext=f
ac_compile='${F77-f77} -c $FFLAGS conftest.$ac_ext 1>&5'
ac_link='${F77-f77} -o conftest${ac_exeext} $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_f77_cross


fi

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


echo $ac_n "checking whether Fortran supports new-style character declarations""... $ac_c" 1>&6
echo "configure:3047: checking whether Fortran supports new-style character declarations" >&5
if eval "test \"`echo '$''{'pac_cv_prog_f77_new_char_decl'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  

ac_ext=f
ac_compile='${F77-f77} -c $FFLAGS conftest.$ac_ext 1>&5'
ac_link='${F77-f77} -o conftest${ac_exeext} $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_f77_cross

cat > conftest.$ac_ext <<EOF
      program main

        character (len=10) s

      end
EOF
if { (eval echo configure:3064: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  rm -rf conftest*
  pac_cv_prog_f77_new_char_decl="yes"
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  pac_cv_prog_f77_new_char_decl="no"
fi
rm -f conftest*
ac_ext=f
ac_compile='${F77-f77} -c $FFLAGS conftest.$ac_ext 1>&5'
ac_link='${F77-f77} -o conftest${ac_exeext} $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_f77_cross


fi

echo "$ac_t""$pac_cv_prog_f77_new_char_decl" 1>&6
if test "$pac_cv_prog_f77_new_char_decl" = "yes" ; then
    CHARDECL="(LEN=*)"
else
    CHARDECL="*(*)"
fi



checkdir=include
echo $ac_n "checking for include directory flag for Fortran""... $ac_c" 1>&6
echo "configure:3093: checking for include directory flag for Fortran" >&5
if eval "test \"`echo '$''{'pac_cv_prog_f77_has_incdir'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  
if test ! -d $checkdir ; then mkdir $checkdir ; fi
cat >$checkdir/conftestf.h <<EOF
       call sub()
EOF
cat >conftest.f <<EOF
       program main
       include 'conftestf.h'
       end
EOF

ac_fcompiletest='${F77-f77} -c $FFLAGS ${idir}$checkdir conftest.f 1>&5'
pac_cv_prog_f77_has_incdir="none"
# SGI wants -Wf,-I
for idir in "-I" "-Wf,-I" ; do
    if { (eval echo configure:3112: \"$ac_fcompiletest\") 1>&5; (eval $ac_fcompiletest) 2>&5; } && test -s conftest.o ; then
        pac_cv_prog_f77_has_incdir="$idir"
	break
    fi
done
rm -f conftest*
rm -f $checkdir/conftestf.h

fi

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

if test "X$pac_cv_prog_f77_has_incdir" != "Xnone" ; then
    F77_INCDIR="$pac_cv_prog_f77_has_incdir"
fi

if test -n "$F77_INCDIR" ; then
    # For building the Fortran files, add the directory where we are building 
    # the object to the include list.  This is needed for g77, which makes
    # includes relative to the source directory of the file, not the 
    # directory that the command is executed in
    FINCLUDES="$F77_INCDIR`pwd`/src"
fi

#

if test "X$F77_LIBDIR_LEADER" = "X" ; then
echo $ac_n "checking for Fortran 77 flag for library directories""... $ac_c" 1>&6
echo "configure:3140: checking for Fortran 77 flag for library directories" >&5
if eval "test \"`echo '$''{'pac_cv_prog_f77_library_dir_flag'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  
    
    rm -f conftest.* conftest1.* 
    cat > conftest.f <<EOF
        program main
        call f1conf
        end
EOF
    cat > conftest1.f <<EOF
        subroutine f1conf
        end
EOF
    ac_fcompileforlib='${F77-f77} -c $FFLAGS conftest1.f 1>&5'
    if { (eval echo configure:3157: \"$ac_fcompileforlib\") 1>&5; (eval $ac_fcompileforlib) 2>&5; } && test -s conftest1.o ; then
        if test ! -d conftest ; then mkdir conftest2 ; fi
	        { ac_try='${ARCMD-"ar"} cr conftest2/libconftest.a conftest1.o'; { (eval echo configure:3159: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }
        { ac_try='${RANLIB-ranlib} conftest2/libconftest.a'; { (eval echo configure:3160: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }
        ac_fcompileldtest='${F77-f77} -o conftest $FFLAGS ${ldir}conftest2 conftest.f -lconftest $LDFLAGS 1>&5'
        for ldir in "-L" "-Wl,-L," ; do
            if { (eval echo configure:3163: \"$ac_fcompileldtest\") 1>&5; (eval $ac_fcompileldtest) 2>&5; } && test -s conftest ; then
	        pac_cv_prog_f77_library_dir_flag="$ldir"
	        break
            fi
        done
        rm -rf ./conftest2
    else
        echo "configure: failed program was:" >&5
        cat conftest1.f >&5
    fi
    rm -f conftest*

fi

echo "$ac_t""$pac_cv_prog_f77_library_dir_flag" 1>&6
    
    if test "X$pac_cv_prog_f77_library_dir_flag" != "X" ; then
        F77_LIBDIR_LEADER="$pac_cv_prog_f77_library_dir_flag"
    fi
fi



if test "$MPI_WITH_PMPI" = "no" ; then
    # If the PMPI routines are not in the same library with the MPI
    # routines, we may need to remove the pmpi declarations
    
echo $ac_n "checking whether Fortran allows unused externals""... $ac_c" 1>&6
echo "configure:3191: checking whether Fortran allows unused externals" >&5
if eval "test \"`echo '$''{'pac_cv_prog_f77_allows_unused_externals'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  

ac_ext=f
ac_compile='${F77-f77} -c $FFLAGS conftest.$ac_ext 1>&5'
ac_link='${F77-f77} -o conftest${ac_exeext} $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_f77_cross

cat > conftest.$ac_ext <<EOF
       program main
       external bar
       end
EOF
if { (eval echo configure:3207: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  rm -rf conftest*
  pac_cv_prog_f77_allows_unused_externals="yes"
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  pac_cv_prog_f77_allows_unused_externals="no"
  
fi
rm -f conftest*
#
ac_ext=f
ac_compile='${F77-f77} -c $FFLAGS conftest.$ac_ext 1>&5'
ac_link='${F77-f77} -o conftest${ac_exeext} $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_f77_cross


fi

echo "$ac_t""$pac_cv_prog_f77_allows_unused_externals" 1>&6
if test "X$pac_cv_prog_f77_allows_unused_externals" = "Xyes" ; then
   MPIFPMPI=",PMPI_WTIME,PMPI_WTICK"
else
   
    MPIFPMPI=""; 
    echo "configure: warning: Removed PMPI_WTIME and PMPI_WTICK from mpif.h" 1>&2
fi

else
    MPIFPMPI=",PMPI_WTIME,PMPI_WTICK"
fi

echo $ac_n "checking whether Fortran has pointer declaration""... $ac_c" 1>&6
echo "configure:3241: checking whether Fortran has pointer declaration" >&5
if eval "test \"`echo '$''{'pac_cv_prog_f77_has_pointer'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  

ac_ext=f
ac_compile='${F77-f77} -c $FFLAGS conftest.$ac_ext 1>&5'
ac_link='${F77-f77} -o conftest${ac_exeext} $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_f77_cross

cat > conftest.$ac_ext <<EOF
      program main

        integer M
        pointer (MPTR,M)
        data MPTR/0/

      end
EOF
if { (eval echo configure:3260: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  rm -rf conftest*
  pac_cv_prog_f77_has_pointer="yes"
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  pac_cv_prog_f77_has_pointer="no"
fi
rm -f conftest*
ac_ext=f
ac_compile='${F77-f77} -c $FFLAGS conftest.$ac_ext 1>&5'
ac_link='${F77-f77} -o conftest${ac_exeext} $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_f77_cross


fi

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

rm -f mpif_bottom.h
if test "$f77_has_pointer" = "yes" -a "$use_pointer_in_f77" = "yes" ; then
    cat >>mpif_bottom.h <<EOF
C
C     (C) 2001 by Argonne National Laboratory.\n";
C     See COPYRIGHT in top-level directory.\n";
C
C     DO NOT EDIT";
C     This file created by buildiface $arg_string\n";
C
        pointer (MPI_BOTTOM_PTR,MPI_BOTTOM)
	pointer (MPI_STATUS_IG_PTR,MPI_STATUS_IGNORE)
	pointer (MPI_STATUSES_IG_PTR,MPI_STATUSES_IGNORE)
        data MPI_BOTTOM_PTR/0/, MPI_STATUS_IG_PTR/0/
	data MPI_STATUSES_IG_PTR/0/
EOF
    cat >> confdefs.h <<\EOF
#define USE_POINTER_FOR_BOTTOM 1
EOF

        else
    cat >>mpif_bottom.h <<EOF
C
C     (C) 2001 by Argonne National Laboratory.\n";
C     See COPYRIGHT in top-level directory.\n";
C
C     DO NOT EDIT";
C     This file created by buildiface $arg_string\n";
C
      COMMON /MPIPRIV/ MPI_BOTTOM,MPI_STATUS_IGNORE,MPI_STATUSES_IGNORE      
C
C     Without this save, some Fortran implementations may make the common
C     dynamic!
C    
C     For a Fortran90 module, we might replace /MPIPRIV/ with a simple
C     SAVE MPI_BOTTOM
C
      SAVE /MPIPRIV/
EOF
fi

CROSS_F77_SIZEOF_INTEGER=${CROSS_F77_SIZEOF_INTEGER:-0}
CROSS_F77_SIZEOF_REAL=${CROSS_F77_SIZEOF_REAL:-0}
CROSS_F77_SIZEOF_DOUBLE_PRECISION=${CROSS_F77_SIZEOF_DOUBLE_PRECISION:-0}

echo $ac_n "checking for size of Fortran type integer""... $ac_c" 1>&6
echo "configure:3331: checking for size of Fortran type integer" >&5
if eval "test \"`echo '$''{'pac_cv_f77_sizeof_integer'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  

/bin/rm -f conftest*
cat <<EOF > conftest.f
      subroutine isize( )
      integer i(2)
      call cisize( i(1), i(2) )
      end
EOF
if test "X$ac_fcompile" = "X" ; then
    ac_fcompile='${F77-f77} -c $FFLAGS conftest.f 1>&5'
fi
if { (eval echo configure:3347: \"$ac_fcompile\") 1>&5; (eval $ac_fcompile) 2>&5; } && test -s conftest.o ; then
    mv conftest.o conftestf.o
    
    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_LIBS="$LIBS"
        LIBS="conftestf.o $FLIBS $LIBS"
    if test "$cross_compiling" = yes; then
  eval pac_cv_f77_sizeof_integer=$CROSS_F77_SIZEOF_INTEGER
else
  cat > conftest.$ac_ext <<EOF
#line 3363 "configure"
#include "confdefs.h"
#include <stdio.h>
#ifdef F77_NAME_UPPER
#define cisize_ CISIZE
#define isize_ ISIZE
#elif defined(F77_NAME_LOWER) || defined(F77_NAME_MIXED)
#define cisize_ cisize
#define isize_ isize
#endif
static int isize_val;
void cisize_(char *i1p, char *i2p)
{ 
   isize_val = (int)(i2p - i1p);
}
main()
{
    FILE *f = fopen("conftestval", "w");
    if (!f) exit(1);
    isize_();
    fprintf(f,"%d\n", isize_val );
    exit(0);
}
EOF
if { (eval echo configure:3387: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
  eval pac_cv_f77_sizeof_integer=`cat conftestval`
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -fr conftest*
  eval pac_cv_f77_sizeof_integer=0
fi
rm -fr conftest*
fi

    LIBS="$save_LIBS"
    ac_ext=f
ac_compile='${F77-f77} -c $FFLAGS conftest.$ac_ext 1>&5'
ac_link='${F77-f77} -o conftest${ac_exeext} $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_f77_cross

else 
    echo "configure: failed program was:" >&5
    cat conftest.f >&5
    eval pac_cv_f77_sizeof_integer=$CROSS_F77_SIZEOF_INTEGER
fi

fi

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





echo $ac_n "checking for size of Fortran type real""... $ac_c" 1>&6
echo "configure:3423: checking for size of Fortran type real" >&5
if eval "test \"`echo '$''{'pac_cv_f77_sizeof_real'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  

/bin/rm -f conftest*
cat <<EOF > conftest.f
      subroutine isize( )
      real i(2)
      call cisize( i(1), i(2) )
      end
EOF
if test "X$ac_fcompile" = "X" ; then
    ac_fcompile='${F77-f77} -c $FFLAGS conftest.f 1>&5'
fi
if { (eval echo configure:3439: \"$ac_fcompile\") 1>&5; (eval $ac_fcompile) 2>&5; } && test -s conftest.o ; then
    mv conftest.o conftestf.o
    
    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_LIBS="$LIBS"
        LIBS="conftestf.o $FLIBS $LIBS"
    if test "$cross_compiling" = yes; then
  eval pac_cv_f77_sizeof_real=$CROSS_F77_SIZEOF_REAL
else
  cat > conftest.$ac_ext <<EOF
#line 3455 "configure"
#include "confdefs.h"
#include <stdio.h>
#ifdef F77_NAME_UPPER
#define cisize_ CISIZE
#define isize_ ISIZE
#elif defined(F77_NAME_LOWER) || defined(F77_NAME_MIXED)
#define cisize_ cisize
#define isize_ isize
#endif
static int isize_val;
void cisize_(char *i1p, char *i2p)
{ 
   isize_val = (int)(i2p - i1p);
}
main()
{
    FILE *f = fopen("conftestval", "w");
    if (!f) exit(1);
    isize_();
    fprintf(f,"%d\n", isize_val );
    exit(0);
}
EOF
if { (eval echo configure:3479: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
  eval pac_cv_f77_sizeof_real=`cat conftestval`
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -fr conftest*
  eval pac_cv_f77_sizeof_real=0
fi
rm -fr conftest*
fi

    LIBS="$save_LIBS"
    ac_ext=f
ac_compile='${F77-f77} -c $FFLAGS conftest.$ac_ext 1>&5'
ac_link='${F77-f77} -o conftest${ac_exeext} $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_f77_cross

else 
    echo "configure: failed program was:" >&5
    cat conftest.f >&5
    eval pac_cv_f77_sizeof_real=$CROSS_F77_SIZEOF_REAL
fi

fi

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





echo $ac_n "checking for size of Fortran type double precision""... $ac_c" 1>&6
echo "configure:3515: checking for size of Fortran type double precision" >&5
if eval "test \"`echo '$''{'pac_cv_f77_sizeof_double_precision'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  

/bin/rm -f conftest*
cat <<EOF > conftest.f
      subroutine isize( )
      double precision i(2)
      call cisize( i(1), i(2) )
      end
EOF
if test "X$ac_fcompile" = "X" ; then
    ac_fcompile='${F77-f77} -c $FFLAGS conftest.f 1>&5'
fi
if { (eval echo configure:3531: \"$ac_fcompile\") 1>&5; (eval $ac_fcompile) 2>&5; } && test -s conftest.o ; then
    mv conftest.o conftestf.o
    
    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_LIBS="$LIBS"
        LIBS="conftestf.o $FLIBS $LIBS"
    if test "$cross_compiling" = yes; then
  eval pac_cv_f77_sizeof_double_precision=$CROSS_F77_SIZEOF_DOUBLE_PRECISION
else
  cat > conftest.$ac_ext <<EOF
#line 3547 "configure"
#include "confdefs.h"
#include <stdio.h>
#ifdef F77_NAME_UPPER
#define cisize_ CISIZE
#define isize_ ISIZE
#elif defined(F77_NAME_LOWER) || defined(F77_NAME_MIXED)
#define cisize_ cisize
#define isize_ isize
#endif
static int isize_val;
void cisize_(char *i1p, char *i2p)
{ 
   isize_val = (int)(i2p - i1p);
}
main()
{
    FILE *f = fopen("conftestval", "w");
    if (!f) exit(1);
    isize_();
    fprintf(f,"%d\n", isize_val );
    exit(0);
}
EOF
if { (eval echo configure:3571: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
  eval pac_cv_f77_sizeof_double_precision=`cat conftestval`
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -fr conftest*
  eval pac_cv_f77_sizeof_double_precision=0
fi
rm -fr conftest*
fi

    LIBS="$save_LIBS"
    ac_ext=f
ac_compile='${F77-f77} -c $FFLAGS conftest.$ac_ext 1>&5'
ac_link='${F77-f77} -o conftest${ac_exeext} $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_f77_cross

else 
    echo "configure: failed program was:" >&5
    cat conftest.f >&5
    eval pac_cv_f77_sizeof_double_precision=$CROSS_F77_SIZEOF_DOUBLE_PRECISION
fi

fi

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




# If we have sizes for real and double, we do not need to call mpir_get_fsize
# at run time.
#
cat > conftest.$ac_ext <<EOF
      program main
      integer*1 i
      end
EOF
if { (eval echo configure:3612: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  rm -rf conftest*
  has_integer_1=1
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  has_integer_1=0
fi
rm -f conftest*
cat > conftest.$ac_ext <<EOF
      program main
      integer*2 i
      end
EOF
if { (eval echo configure:3626: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  rm -rf conftest*
  has_integer_2=2
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  has_integer_2=0
fi
rm -f conftest*
cat > conftest.$ac_ext <<EOF
      program main
      integer*4 i
      end
EOF
if { (eval echo configure:3640: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  rm -rf conftest*
  has_integer_4=4
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  has_integer_4=0
fi
rm -f conftest*
cat > conftest.$ac_ext <<EOF
      program main
      integer*8 i
      end
EOF
if { (eval echo configure:3654: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  rm -rf conftest*
  has_integer_8=8
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  has_integer_8=0
fi
rm -f conftest*
cat > conftest.$ac_ext <<EOF
      program main
      integer*16 i
      end
EOF
if { (eval echo configure:3668: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  rm -rf conftest*
  has_integer_16=16
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  has_integer_16=0
fi
rm -f conftest*
cat > conftest.$ac_ext <<EOF
      program main
      real*4 a
      end
EOF
if { (eval echo configure:3682: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  rm -rf conftest*
  has_real_4=4
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  has_real_4=0
fi
rm -f conftest*
cat > conftest.$ac_ext <<EOF
      program main
      real*8 a
      end
EOF
if { (eval echo configure:3696: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  rm -rf conftest*
  has_real_8=8
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  has_real_8=0
fi
rm -f conftest*
cat > conftest.$ac_ext <<EOF
      program main
      real*16 a
      end
EOF
if { (eval echo configure:3710: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  rm -rf conftest*
  has_real_16=16
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  has_real_16=0
fi
rm -f conftest*

# Create the default datatype names for the standard MPI Fortran types
MPI_CHARACTER=0x4c000118


len_integer=$pac_cv_f77_sizeof_integer
# Convert to two digit hex
if test $len_integer -le 0 ; then 
     len_integer=00
elif test $len_integer -le 9 ; then
     len_integer=0$len_integer 
elif test $len_integer -le 15 ; then
     case $len_integer in 
         10) char=a ;;
	 11) char=b ;;
	 12) char=c ;;
	 13) char=d ;;
	 14) char=e ;;
	 15) char=f ;;
         esac
    len_integer="0$char"
else
    { echo "configure: error: Integer type sizes greater than 15 are not supported" 1>&2; exit 1; }
fi

MPI_INTEGER=0x4c00${len_integer}19
MPI_REAL=0x4c00${len_integer}1a
MPI_LOGICAL=0x4c00${len_integer}1b




len_double=$pac_cv_f77_sizeof_double_precision
# Convert to two digit hex
if test $len_double -le 0 ; then 
     len_double=00
elif test $len_double -le 9 ; then
     len_double=0$len_double 
elif test $len_double -le 15 ; then
     case $len_double in 
         10) char=a ;;
	 11) char=b ;;
	 12) char=c ;;
	 13) char=d ;;
	 14) char=e ;;
	 15) char=f ;;
         esac
    len_double="0$char"
elif test $len_double -le 31 ; then
    len_double=`expr $len_double - 16`
    len_double="1$len_double"
else
    { echo "configure: error: Double Precision type sizes greater than 31 are not supported" 1>&2; exit 1; }
fi

MPI_COMPLEX=0x4c00${len_double}1c
MPI_DOUBLE_PRECISION=0x4c00${len_double}1d
MPI_2INTEGER=0x4c00${len_double}1e
MPI_2REAL=0x4c00${len_double}1f





len_doublecplx=`expr $pac_cv_f77_sizeof_double_precision \* 2`
# Convert to two digit hex
if test $len_doublecplx -le 0 ; then 
     len_doublecplx=00
elif test $len_doublecplx -le 9 ; then
     len_doublecplx=0$len_doublecplx 
elif test $len_doublecplx -le 15 ; then
     case $len_doublecplx in 
         10) char=a ;;
	 11) char=b ;;
	 12) char=c ;;
	 13) char=d ;;
	 14) char=e ;;
	 15) char=f ;;
         esac
    len_doublecplx="0$char"
elif test $len_doublecplx -le 31 ; then
    len_doublecplx=`expr $len_doublecplx - 16`
    if test "$len_doubldcplx" = 0 ; then
        len_doublecplx="10";
    else
        len_doublecplx="1$len_doublecplx";
    fi        
else
    { echo "configure: error: Double Complex type sizes greater than 31 are not supported" 1>&2; exit 1; }
fi

MPI_DOUBLE_COMPLEX=0x4c00${len_doublecplx}20
MPI_2DOUBLE_PRECISION=0x4c00${len_doublecplx}21
MPI_2COMPLEX=0x4c00${len_doublecplx}22




#
# Temporary for the vast majority of systems that use 4 byte reals and
# 8 byte doubles
# Lengths at this point are in hex, hench "10" = 10 base 16 = 16 base 10.
if test "$len_double" = "08" ; then
    F77_COMPLEX8=$MPI_COMPLEX
fi
if test "$len_doublecplx" = "10" ; then
    F77_COMPLEX16=$MPI_DOUBLE_COMPLEX
fi
if test "$len_long_double" = "10" ; then
    F77_COMPLEX32="0x4c002023"
fi

len_2dc=`expr $pac_cv_f77_sizeof_double_precision \* 4`
firstdigit=0
seconddigit=0
while test $len_2dc -ge 16 ; do
    firstdigit=`expr $firstdigit + 1`
    len_2dc=`expr $len_2dc - 16`    
done
case $len_2dc in
    10) seconddigit=a ;;
    11) seconddigit=b ;;
    12) seconddigit=c ;;
    13) seconddigit=d ;;
    14) seconddigit=e ;;
    15) seconddigit=f ;;
     *) seconddigit=$len_2dc ;;
esac
len_2dc="$firstdigit$seconddigit"
#echo "2double complex = $len_2dc"
MPI_2DOUBLE_COMPLEX=0x4c00${len_2dc}23

#
# Predefined values for LB, UB, and PACKED
MPI_PACKED="0x4c00010f"
MPI_LB="0x4c000010"
MPI_UB="0x4c000011"




# We must convert all hex values to decimal (!)
# It would be nice to use expr to extract the next character rather than
# the heavier-weight sed, but expr under Tru64 Unix discards leading zeros,
# even when used only with the match (:) command.  Rather than have configure
# figure out if expr works, we just use sed.  Sigh.
for var in CHARACTER INTEGER REAL LOGICAL DOUBLE_PRECISION COMPLEX \
    DOUBLE_COMPLEX 2INTEGER 2REAL 2COMPLEX 2DOUBLE_PRECISION 2DOUBLE_COMPLEX \
    PACKED UB LB ; do  
    fullvar="MPI_$var"
    eval fullvarvalue=\$$fullvar
    #echo "$fullvar = $fullvarvalue"
    value=0
    fullvarvalue=`echo $fullvarvalue | sed -e 's/..\(.*\)/\1/'`
    for pos in 3 4 5 6 7 8 9 10 ; do
        # This works, even for Tru64, because only a single character
	# is extracted
        char=`expr $fullvarvalue : '\(.\)'`
	# FIXME: Tru64 Unix eliminates leading zeros (!)
	# How do we fix something that broken?
	fullvarvalue=`echo $fullvarvalue | sed -e 's/.\(.*\)/\1/'`
        case $char in 
            a) char=10 ;;
	    b) char=11 ;;
	    c) char=12 ;;
	    d) char=13 ;;
	    e) char=14 ;;
	    f) char=15 ;;
        esac
        value=`expr $value \* 16 + $char`
    done
    #echo "$fullvar = $value"
    eval $fullvar=$value
done

# Compare the sizes of these types to the C types

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 for ANSI C header files""... $ac_c" 1>&6
echo "configure:3906: checking for ANSI C header files" >&5
if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  cat > conftest.$ac_ext <<EOF
#line 3911 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:3919: \"$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*
  ac_cv_header_stdc=yes
else
  echo "$ac_err" >&5
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  ac_cv_header_stdc=no
fi
rm -f conftest*

if test $ac_cv_header_stdc = yes; then
  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
#line 3936 "configure"
#include "confdefs.h"
#include <string.h>
EOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
  egrep "memchr" >/dev/null 2>&1; then
  :
else
  rm -rf conftest*
  ac_cv_header_stdc=no
fi
rm -f conftest*

fi

if test $ac_cv_header_stdc = yes; then
  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
#line 3954 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
  egrep "free" >/dev/null 2>&1; then
  :
else
  rm -rf conftest*
  ac_cv_header_stdc=no
fi
rm -f conftest*

fi

if test $ac_cv_header_stdc = yes; then
  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
if test "$cross_compiling" = yes; then
  :
else
  cat > conftest.$ac_ext <<EOF
#line 3975 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
int main () { int i; for (i = 0; i < 256; i++)
if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
exit (0); }

EOF
if { (eval echo configure:3986: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
  :
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -fr conftest*
  ac_cv_header_stdc=no
fi
rm -fr conftest*
fi

fi
fi

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

fi

for ac_hdr in stdlib.h string.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:4013: 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.c<<EOF
#line 4018 "configure"
#include "confdefs.h"
#include <$ac_hdr>
int conftest() {return 0;}
EOF
ac_compile_for_cpp='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.c 1>&5'
if { (eval echo configure:4024: \"$ac_compile_for_cpp\") 1>&5; (eval $ac_compile_for_cpp) 2>&5; }; then
    eval "ac_cv_header_$ac_safe=yes"
else
    eval "ac_cv_header_$ac_safe=no"
    echo "configure: failed program was:" >&5
    cat conftest.c >&5
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


# Get defaults for cross compilation case
CROSS_SIZEOF_CHAR=${CROSS_SIZEOF_CHAR:-0}
CROSS_SIZEOF_SHORT=${CROSS_SIZEOF_SHORT:-0}
CROSS_SIZEOF_INT=${CROSS_SIZEOF_INT:-0}
CROSS_SIZEOF_LONG=${CROSS_SIZEOF_LONG:-0}
CROSS_SIZEOF_LONG_LONG=${CROSS_SIZEOF_LONG_LONG:-0}
CROSS_SIZEOF_FLOAT=${CROSS_SIZEOF_FLOAT:-0}
CROSS_SIZEOF_DOUBLE=${CROSS_SIZEOF_DOUBLE:-0}
CROSS_SIZEOF_LONG_DOUBLE=${CROSS_SIZEOF_LONG_DOUBLE:-0}
CROSS_SIZEOF_VOID_P=${CROSS_SIZEOF_VOID_P:-0}
CROSS_OFFSET_KIND=${CROSS_OFFSET_KIND:-0}
CROSS_ADDRESS_KIND=${CROSS_ADDRESS_KIND:-0}

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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


# sizeof(void*) is needed for ADDRESS_KIND below
echo $ac_n "checking size of void*""... $ac_c" 1>&6
echo "configure:4374: checking size of void*" >&5
if eval "test \"`echo '$''{'ac_cv_sizeof_voidp'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  if test "$cross_compiling" = yes; then
  ac_cv_sizeof_voidp=$CROSS_SIZEOF_VOID_P
else
  cat > conftest.$ac_ext <<EOF
#line 4382 "configure"
#include "confdefs.h"
#include <stdio.h>
main()
{
  FILE *f=fopen("conftestval", "w");
  if (!f) exit(1);
  fprintf(f, "%d\n", sizeof(void*));
  exit(0);
}
EOF
if { (eval echo configure:4393: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
  ac_cv_sizeof_voidp=`cat conftestval`
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -fr conftest*
  ac_cv_sizeof_voidp=0
fi
rm -fr conftest*
fi

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



#
# Preload the C mpi types
# THESE MUST MATCH THE DEFINITIONS IN MPI.H and MPIF.H
# We use these to match the optional Fortran types
char_mpi=${MPI_CHAR:-0}
short_mpi=${MPI_SHORT:-0}
int_mpi=${MPI_INT:-0}
long_mpi=${MPI_LONG:-0}
long_long_mpi=${MPI_LONG_LONG:-0}
float_mpi=${MPI_FLOAT:-0}
double_mpi=${MPI_DOUBLE:-0}
long_double_mpi=${MPI_LONG_DOUBLE:-0}

for len in 1 2 4 8 16 ; do
    eval F77_INTEGER$len=0
    #eval testval=\$"pac_cv_f77_sizeof_integer_$len"
    eval testval=\$"has_integer_$len"
    if test "$testval" = 0 ; then continue ; fi
    noval="yes"
    echo $ac_n "checking for C type matching Fortran integer*$len""... $ac_c" 1>&6
echo "configure:4433: checking for C type matching Fortran integer*$len" >&5
    for c_type in char short int long "long_long" ; do
	eval ctypelen=\$"ac_cv_sizeof_$c_type"
	if test "$testval" = "$ctypelen" -a "$ctypelen" -gt 0 ; then
	    echo "$ac_t""$c_type" 1>&6
	    eval F77_INTEGER$len=\$"${c_type}_mpi"
	    noval="no"
	    break
        fi
    done
    if test "$noval" = "yes" ; then
        echo "$ac_t""unavailable" 1>&6
    fi
done

# Complex is set separately above
for len in 4 8 16 ; do
    len2=`expr $len + $len`
    eval F77_REAL$len=0
    #eval F77_COMPLEX$len2=0
    #eval testval=\$"pac_cv_f77_sizeof_real_$len"
    eval testval=\$"has_real_$len"
    if test "$testval" = 0 ; then continue ; fi
    noval="yes"
    echo $ac_n "checking for C type matching Fortran real*$len""... $ac_c" 1>&6
echo "configure:4458: checking for C type matching Fortran real*$len" >&5
    for c_type in float double "long_double" ; do
	eval ctypelen=\$"ac_cv_sizeof_$c_type"
	if test "$testval" = "$ctypelen" -a "$ctypelen" -gt 0 ; then
	    echo "$ac_t""$c_type" 1>&6
	    eval F77_REAL$len=\$"${c_type}_mpi"
	    #eval F77_COMPLEX$len2=\$"${c_type}_cplx_mpi"
            noval="no"
	    break
        fi
    done
    if test "$noval" = "yes" ; then
        echo "$ac_t""unavailable" 1>&6
    fi
done
# We must convert all hex values to decimal (!)
for var in INTEGER1 INTEGER2 INTEGER4 INTEGER8 INTEGER16 \
    REAL4 REAL8 REAL16 COMPLEX8 COMPLEX16 COMPLEX32 ; do  
    fullvar="F77_$var"
    eval fullvarvalue=\$$fullvar
    if test "$fullvarvalue" = 0 -o -z "$fullvarvalue" ; then 
        eval $fullvar=MPI_DATATYPE_NULL
        continue
    fi
    #echo "$fullvar = $fullvarvalue"
    value=0
    # See the comments above on why expr with : cannot be used here
    fullvarvalue=`echo $fullvarvalue | sed -e 's/..\(.*\)/\1/'`
    for pos in 3 4 5 6 7 8 9 10 ; do
        #char=`expr substr $fullvarvalue $pos 1`
        char=`expr $fullvarvalue : '\(.\)'`
	fullvarvalue=`echo $fullvarvalue | sed -e 's/.\(.*\)/\1/'`
        case $char in 
            a) char=10 ;;
	    b) char=11 ;;
	    c) char=12 ;;
	    d) char=13 ;;
	    e) char=14 ;;
	    f) char=15 ;;
        esac
        value=`expr $value \* 16 + $char`
    done
    #echo "$fullvar = $value"
    eval $fullvar=$value
done












noval="yes"
echo $ac_n "checking for C type matching Fortran integer""... $ac_c" 1>&6
echo "configure:4517: checking for C type matching Fortran integer" >&5
for c_type in char short int long "long_long" ; do
    eval ctypelen=\$"ac_cv_sizeof_$c_type"
    if test "$pac_cv_f77_sizeof_integer" = "$ctypelen" -a \
       "$ctypelen" -gt 0 ; then
	c_type=`echo $c_type | sed -e 's/_/ /g'`
	echo "$ac_t""$c_type" 1>&6
	MPI_FINT=$c_type
	noval="no"
	break
    fi
done
if test "$noval" = "yes" ; then
    # Set a default
    MPI_FINT="int"
    echo "$ac_t""unavailable" 1>&6
fi

if test "$ac_cv_sizeof_voidp" != "0" -a \
        "$ac_cv_sizeof_voidp" -gt "$pac_cv_f77_sizeof_integer" ; then
    cat >> confdefs.h <<\EOF
#define HAVE_AINT_LARGER_THAN_FINT 1
EOF

fi
if test "$MPI_FINT" = "int" ; then
    cat >> confdefs.h <<\EOF
#define HAVE_FINT_IS_INT 1
EOF

fi
if test "$SIZEOF_F77_INTEGER" != "$SIZEOF_INT" ; then
   echo "configure: warning: Fortran integers and C ints are not the same size.  The current Fortran binding does not support this case" 1>&2
fi

#
# Set size of MPI_Status.  We may need sizeof_int here as well
#
if test -z "$MPI_STATUS_SIZE" ; then
    if test -n "$SIZEOF_MPI_STATUS" ; then
        # compute from the C sizeof
	MPI_STATUS_SIZE=`expr $SIZEOF_MPI_STATUS / $ac_cv_sizeof_int`
	if test "$MPI_STATUS_SIZE" = "0" ; then
	    echo "configure: warning: Could not compute the size of MPI_Status" 1>&2
	    MPI_STATUS_SIZE=5
        fi
    else
        echo "configure: warning: MPI_STATUS_SIZE was not defined!" 1>&2
        # The default size is 5.  See mpi.h.in
        MPI_STATUS_SIZE=5
    fi
fi



echo $ac_n "checking whether C compiler allows unaligned doubles""... $ac_c" 1>&6
echo "configure:4573: checking whether C compiler allows unaligned doubles" >&5
if eval "test \"`echo '$''{'pac_cv_prog_c_unaligned_doubles'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  
if test "$cross_compiling" = yes; then
  pac_cv_prog_c_unaligned_doubles="unknown"
else
  cat > conftest.$ac_ext <<EOF
#line 4582 "configure"
#include "confdefs.h"

void fetch_double( v )
double *v;
{
*v = 1.0;
}
int main( argc, argv )
int argc;
char **argv;
{
int p[4];
double *p_val;
fetch_double( (double *)&(p[0]) );
p_val = (double *)&(p[0]);
if (*p_val != 1.0) return 1;
fetch_double( (double *)&(p[1]) );
p_val = (double *)&(p[1]);
if (*p_val != 1.0) return 1;
return 0;
}

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

fi

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

if test "X$pac_cv_prog_c_unaligned_doubles" = "no" ; then 
echo "configure: warning: Your C compiler $CC does not support unaligned accesses
to doubles.  This is required for interoperation with 
Fortran (the Fortran standard requires it).
You may need to specify an additional argument to your C compiler to 
force it to allow unaligned accesses." 1>&2
fi



#
# Bsend overhead is sent down from the top level configure.
# Set a conservative default if it isn't provided.
BSEND_OVERHEAD=${BSEND_OVERHEAD:-128}


MPI_MAX_PROCESSOR_NAME="${MPI_MAX_PROCESSOR_NAME:-128}"

#
# Try for weak symbols for the profiling interface.
if test "$enable_weak" = "yes" ; then
    
pragma_extra_message=""
echo $ac_n "checking for type of weak symbol support""... $ac_c" 1>&6
echo "configure:4646: checking for type of weak symbol support" >&5
if eval "test \"`echo '$''{'pac_cv_prog_c_weak_symbols'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  
# Test for weak symbol support...
# We can't put # in the message because it causes autoconf to generate
# incorrect code
cat > conftest.$ac_ext <<EOF
#line 4655 "configure"
#include "confdefs.h"

extern int PFoo(int);
#pragma weak PFoo = Foo
int Foo(a) { return a; }

int main() {
return PFoo(1);
; return 0; }
EOF
if { (eval echo configure:4666: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  rm -rf conftest*
  has_pragma_weak=yes
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
fi
rm -f conftest*
#
# Some systems (Linux ia64 and ecc, for example), support weak symbols
# only within a single object file!  This tests that case.
# Note that there is an extern int PFoo declaration before the
# pragma.  Some compilers require this in order to make the weak symbol
# extenally visible.  
if test "$has_pragma_weak" = yes ; then
    rm -f conftest*
    cat >>conftest1.c <<EOF
extern int PFoo(int);
#pragma weak PFoo = Foo
int Foo(int);
int Foo(a) { return a; }
EOF
    cat >>conftest2.c <<EOF
extern int PFoo(int);
int main() {
return PFoo(0);}
EOF
    ac_link2='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest1.c conftest2.c $LIBS >conftest.out 2>&1'
    if eval $ac_link2 ; then
        pac_cv_prog_c_weak_symbols="pragma weak"
    else
      echo "$ac_link2" >>config.log
      echo "Failed program was" >>config.log
      cat conftest1.c >>config.log
      cat conftest2.c >>config.log
      if test -s conftest.out ; then cat conftest.out >> config.log ; fi
      has_pragma_weak=0
      pragma_extra_message="pragma weak does not work outside of a file"
    fi
    rm -f conftest*
fi
if test -z "$pac_cv_prog_c_weak_symbols" ; then 
    cat > conftest.$ac_ext <<EOF
#line 4709 "configure"
#include "confdefs.h"

extern int PFoo(int);
#pragma _HP_SECONDARY_DEF Foo  PFoo
int Foo(a) { return a; }

int main() {
return PFoo(1);
; return 0; }
EOF
if { (eval echo configure:4720: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  rm -rf conftest*
  pac_cv_prog_c_weak_symbols="pragma _HP_SECONDARY_DEF"
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
fi
rm -f conftest*
fi
if test -z "$pac_cv_prog_c_weak_symbols" ; then
    cat > conftest.$ac_ext <<EOF
#line 4731 "configure"
#include "confdefs.h"

extern int PFoo(int);
#pragma _CRI duplicate PFoo as Foo
int Foo(a) { return a; }

int main() {
return PFoo(1);
; return 0; }
EOF
if { (eval echo configure:4742: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  rm -rf conftest*
  pac_cv_prog_c_weak_symbols="pragma _CRI duplicate x as y"
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
fi
rm -f conftest*
fi
if test -z "$pac_cv_prog_c_weak_symbols" ; then
    pac_cv_prog_c_weak_symbols="no"
fi
if test -n "$pragma_extra_message" ; then
    echo $pragma_extra_message
fi

fi

echo "$ac_t""$pac_cv_prog_c_weak_symbols" 1>&6
if test "$pac_cv_prog_c_weak_symbols" = "no" ; then
    :
else
    case "$pac_cv_prog_c_weak_symbols" in
	"pragma weak") cat >> confdefs.h <<\EOF
#define HAVE_PRAGMA_WEAK 1
EOF
 
	;;
	"pragma _HP")  cat >> confdefs.h <<\EOF
#define HAVE_PRAGMA_HP_SEC_DEF 1
EOF

	;;
	"pragma _CRI") cat >> confdefs.h <<\EOF
#define HAVE_PRAGMA_CRI_DUP 1
EOF

	;;
    esac
    cat >> confdefs.h <<\EOF
#define HAVE_WEAK_SYMBOLS 1
EOF

fi
echo $ac_n "checking whether __attribute__ ((weak)) allowed""... $ac_c" 1>&6
echo "configure:4787: checking whether __attribute__ ((weak)) allowed" >&5
if eval "test \"`echo '$''{'pac_cv_attr_weak'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  
cat > conftest.$ac_ext <<EOF
#line 4793 "configure"
#include "confdefs.h"
int foo(int) __attribute__ ((weak));
int main() {
int a;
; return 0; }
EOF
if { (eval echo configure:4800: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  rm -rf conftest*
  pac_cv_attr_weak=yes
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  pac_cv_attr_weak=no
fi
rm -f conftest*
fi

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

fi
# These values are exported from the upper-layer configure.



#
# If weak symbols are *not* supported, we may want to be careful
# about including 
# external pmpi_wtime, pmpi_wtick
# in the mpif.h file .  For now, we'll just declare them as 
# double precision without including an external declaration for them.
#
# Try to get values for Fortran logical variables.
if test "$cross_compiling" = "no" ; then
    echo $ac_n "checking for values of Fortran logicals""... $ac_c" 1>&6
echo "configure:4829: checking for values of Fortran logicals" >&5
    if eval "test \"`echo '$''{'pac_cv_prog_f77_true_false_value'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  
    
/bin/rm -f conftest*
cat <<EOF > conftest.f

        subroutine ftest( itrue, ifalse )
        logical itrue, ifalse
        itrue  = .TRUE.
        ifalse = .FALSE.
        return
        end

EOF
if test "X$ac_fcompile" = "X" ; then
    ac_fcompile='${F77-f77} -c $FFLAGS conftest.f 1>&5'
fi
if { (eval echo configure:4849: \"$ac_fcompile\") 1>&5; (eval $ac_fcompile) 2>&5; } && test -s conftest.o ; then
    mv conftest.o conftestf.o
    
    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_LIBS="$LIBS"
    LIBS="conftestf.o $FLIBS $LIBS"
    if test "$cross_compiling" = yes; then
  : 
else
  cat > conftest.$ac_ext <<EOF
#line 4865 "configure"
#include "confdefs.h"
#include <stdio.h>
#ifdef F77_NAME_UPPER
#define ftest_ FTEST
#elif defined(F77_NAME_LOWER) || defined(F77_NAME_MIXED)
#define ftest_ ftest
#endif

#include <stdio.h>
int main()
{
    $MPI_FINT itrue, ifalse;
    FILE *f = fopen("conftestval", "w" );
    if (!f) exit(1);
    ftest_( &itrue, &ifalse );
    fprintf( f, "%d %d\n", itrue, ifalse );
    exit(0);
}


EOF
if { (eval echo configure:4887: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
  
    pac_cv_prog_f77_true_false_value=`cat conftestval`

else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
fi
rm -fr conftest*
fi

    LIBS="$save_LIBS"
    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

else 
    echo "configure: failed program was:" >&5
    cat conftest.f >&5
fi
rm -f conftest*

fi

    true_val="`echo $pac_cv_prog_f77_true_false_value | sed -e 's/ .*//g'`"
    false_val="`echo $pac_cv_prog_f77_true_false_value | sed -e 's/.*  *//g'`"
    if test -n "$true_val" -a -n "$false_val" ; then
        cat >> confdefs.h <<\EOF
#define F77_TRUE_VALUE_SET 1
EOF

        cat >> confdefs.h <<EOF
#define F77_TRUE_VALUE $true_val
EOF

        cat >> confdefs.h <<EOF
#define F77_FALSE_VALUE $false_val
EOF

	echo "$ac_t""True is $true_val and False is $false_val" 1>&6
    else
	echo "$ac_t""could not determine" 1>&6
    fi
fi


pac_save_level=`expr $pac_save_level - 1`
if test "X$pac_save_level" = "X0" ; then
    CC="$pac_save_CC"
    CXX="$pac_save_CXX"
    F77="$pac_save_F77"
    F90="$pac_save_F90"
    CPP="$pac_save_CPP"
    ac_cv_prog_cc_cross="$pac_save_prog_cc_cross"
    ac_cv_prog_f77_cross="$pac_save_prog_f77_cross"
    ac_cv_prog_cxx_cross="$pac_save_prog_cxx_cross"
    pac_cv_prog_f90_cross="$pac_save_prog_f90_cross"
    pac_save_level=""
fi


# If the system is Cray or Cray-like, then we need to handle character
# data in a special way.  This code does that.
if test "$target_os" = "CRAY" ; then
    # If tested code does NOT compile, then define _TWO_WORD_FCD
    echo $ac_n "checking whether TWO_WORD_FCDs are used""... $ac_c" 1>&6
echo "configure:4957: checking whether TWO_WORD_FCDs are used" >&5
    cat > conftest.$ac_ext <<EOF
#line 4959 "configure"
#include "confdefs.h"
#include <fortran.h>
int main() {
void  *buf;_fcd temp;temp = _fcdtocp(buf);
; return 0; }
EOF
if { (eval echo configure:4966: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  rm -rf conftest*
  compile_check=yes
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  compile_check=no
fi
rm -f conftest*
    echo "$ac_t""$compile_check" 1>&6
    if test "$compile_check" = "no" ; then
        TEMP_CFLAGS=$CFLAGS
        CFLAGS="-D_TWO_WORD_FCD $CFLAGS"
        echo $ac_n "checking whether program compiles if _TWO_WORD_FCD is defined ""... $ac_c" 1>&6
echo "configure:4981: checking whether program compiles if _TWO_WORD_FCD is defined " >&5
        cat > conftest.$ac_ext <<EOF
#line 4983 "configure"
#include "confdefs.h"
#include <fortran.h>
int main() {
void  *buf;_fcd temp;temp = _fcdtocp(buf);
; return 0; }
EOF
if { (eval echo configure:4990: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  rm -rf conftest*
  compile_check=yes
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  compile_check=no
fi
rm -f conftest*
        echo "$ac_t""$compile_check" 1>&6
        if test "$compile_check" = "no" ; then
	    echo "configure: warning: You may have problems compiling the Fortran interface
specifically calls to  _fcdtocp" 1>&2
        elif test "$compile_check" = "yes" ; then
            cat >> confdefs.h <<\EOF
#define _TWO_WORD_FCD 1
EOF

        fi
        CFLAGS=$TEMP_CFLAGS
    fi
fi

if test -n "$arch_UXPM" -o -n "$arch_uxpv" ; then
    # This asserts that Fortran passes functions by passing the address of the
    # pointer to the function.
    # We really need a TEST for this
    cat >> confdefs.h <<\EOF
#define FORTRAN_SPECIAL_FUNCTION_PTR 1
EOF

    # Suggested values for these are
                fi

#
# Most systems allow the Fortran compiler to process .F and .F90 files
# using the C preprocessor.  However, some systems either do not
# allow this or have serious bugs (OSF Fortran compilers have a bug
# that generates an error message from cpp).  The following test
# checks to see if .F works, and if not, whether "cpp -P -C" can be used
rm -f conftest*
echo $ac_n "checking whether Fortran compiler processes .F files with C preprocessor""... $ac_c" 1>&6
echo "configure:5033: checking whether Fortran compiler processes .F files with C preprocessor" >&5
cat >conftest.F <<EOF
        program main
#define SIZE 10
        integer a(SIZE)
        end
EOF
pac_cv_fort_accepts_F=no
pac_Fcompile='${F77} -c $FFLAGS $CPPFLAGS conftest.F 1>&5'

if { (eval echo configure:5043: \"$pac_Fcompile\") 1>&5; (eval $pac_Fcompile) 2>&5; } && test -s conftest.o ; then
   pac_cv_fort_accepts_F=yes
else
    # Can we use cpp?
    pac_Fcpp='${CPP} -C -P $CPPFLAGS conftest.F >conftest.f 2>&5'
    if { (eval echo configure:5048: \"$pac_Fcpp\") 1>&5; (eval $pac_Fcpp) 2>&5; } && test -s conftest.f ; then
        pac_fFcompile='${F77} -c $FFLAGS $CPPFLAGS conftest.f 1>&5'
	if { (eval echo configure:5050: \"$pac_fFcompile\") 1>&5; (eval $pac_fFcompile) 2>&5; } && test -s conftest.o ; then
	    pac_cv_fort_accepts_F="no, use cpp"
	fi
    fi
fi
rm -f conftest.*
echo "$ac_t""$pac_cv_fort_accepts_F" 1>&6
case "$pac_cv_fort_accepts_F" in 
    yes)
    F77CPP=""
    ;;
    "no, use cpp")
    F77CPP="$CPP -C -P"
    ;;
    no) 
    F77CPP="false"
    ;;
esac

#
# For Fortran 90, we'll also need MPI_ADDRESS_KIND and MPI_OFFSET_KIND
# Since our compiler might BE a Fortran 90 compiler, try and determine the
# values.  
F90="${F90-$F77}"

if test "X$pac_save_level" = "X" ; then
    pac_save_CC="$CC"
    pac_save_CXX="$CXX"
    pac_save_F77="$F77"
    pac_save_F90="$F90"
    pac_save_prog_cc_cross="$ac_cv_prog_cc_cross"
    pac_save_prog_f77_cross="$ac_cv_prog_f77_cross"
    pac_save_prog_cxx_cross="$ac_cv_prog_cxx_cross"
    pac_save_prog_f90_cross="$pac_cv_prog_f90_cross"
    if test "X$CPP" = "X" ; then
	echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
echo "configure:5086: 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 5101 "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:5107: \"$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 5118 "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:5124: \"$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 5135 "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:5141: \"$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
    pac_save_CPP="$CPP"
    CC="${TESTCC:=$CC}"
    CXX="${TESTCXX:=$CXX}"
    F77="${TESTF77:=$F77}"
    F90="${TESTF90:=$F90}"
    if test -z "$TESTCPP" ; then
        
if test -z "$TESTCPP"; then
  if eval "test \"`echo '$''{'pac_cv_prog_TESTCPP'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  
  rm -f conftest.*
  cat > conftest.c <<EOF
  #include <assert.h>
  Syntax Error
EOF
  # On the NeXT, cc -E runs the code through the compiler's parser,
  # not just through cpp.
  TESTCPP="${TESTCC-cc} -E"
  ac_try="$TESTCPP conftest.c >/dev/null 2>conftest.out"
  if { (eval echo configure:5187: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ; then
      pac_cv_prog_TESTCPP="$TESTCPP"
  fi
  if test "X$pac_cv_prog_TESTCPP" = "X" ; then
      TESTCPP="${TESTCC-cc} -E -traditional-cpp"
      ac_try="$TESTCPP conftest.c >/dev/null 2>conftest.out"
      if { (eval echo configure:5193: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ; then
          pac_cv_prog_TESTCPP="$TESTCPP"
      fi
  fi
  if test "X$pac_cv_prog_TESTCPP" = "X" ; then
      TESTCPP="${TESTCC-cc} -nologo -E"
      ac_try="$TESTCPP conftest.c >/dev/null 2>conftest.out"
      if { (eval echo configure:5200: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ; then
          pac_cv_prog_TESTCPP="$TESTCPP"
      fi
  fi
  if test "X$pac_cv_prog_TESTCPP" = "X" ; then
      # Extract the first word of "cpp", so it can be a program name with args.
set dummy cpp; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:5208: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_TESTCPP'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  case "$TESTCPP" in
  /*)
  ac_cv_path_TESTCPP="$TESTCPP" # Let the user override the test with a path.
  ;;
  ?:/*)			 
  ac_cv_path_TESTCPP="$TESTCPP" # 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_TESTCPP="$ac_dir/$ac_word"
      break
    fi
  done
  IFS="$ac_save_ifs"
  ;;
esac
fi
TESTCPP="$ac_cv_path_TESTCPP"
if test -n "$TESTCPP"; then
  echo "$ac_t""$TESTCPP" 1>&6
else
  echo "$ac_t""no" 1>&6
fi

  fi
  rm -f conftest.*
  
fi

else
  pac_cv_prog_TESTCPP="$TESTCPP"
fi

    fi
    CPP="${TESTCPP:=$CPP}"
    pac_save_level="0"
    # Recompute cross_compiling values and set for the current language
    # This is just:
    
    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

    if test "$pac_cross_compiling" = "yes" ; then
        ac_cv_prog_cc_cross=yes
	ac_cv_prog_cc_works=yes
    else
        cat > conftest.$ac_ext << EOF

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

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

    # Ignore Fortran if we aren't using it.
    if test -n "$F77" ; then
        
        ac_ext=f
ac_compile='${F77-f77} -c $FFLAGS conftest.$ac_ext 1>&5'
ac_link='${F77-f77} -o conftest${ac_exeext} $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_f77_cross

	if test "$pac_cross_compiling" = "yes" ; then
	    ac_cv_prog_f77_cross=yes
	    ac_cv_prog_f77_works=yes
	else
            cat > conftest.$ac_ext << EOF

      program conftest
      end

EOF
if { (eval echo configure:5313: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  ac_cv_prog_f77_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_f77_cross=no
  else
    ac_cv_prog_f77_cross=yes
  fi
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  ac_cv_prog_f77_works=no
fi
rm -fr conftest*
	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

    fi
    # Ignore C++ if we aren't using it.
    if test -n "$CXX" ; then
        
        ac_ext=C
# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_cxx_cross

        cat > conftest.$ac_ext << EOF

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

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

    fi
    # Ignore Fortran 90 if we aren't using it.
    if test -n "$F90" ; then
        
        
ac_ext=$pac_cv_f90_ext
ac_compile='${F90-f90} -c $F90FLAGS conftest.$ac_ext 1>&5'
ac_link='${F90-f90} -o conftest${ac_exeext} $F90FLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$pac_cv_prog_f90_cross

	        	if test "$pac_cross_compiling" = "yes" ; then
	    ac_cv_prog_f90_cross=yes
	    ac_cv_prog_f90_works=yes
	else
            cat > conftest.$ac_ext << EOF
      program conftest
      end
EOF
            if { (eval echo configure:2324: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
              ac_cv_prog_f90_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_f90_cross=no
              else
                  ac_cv_prog_f90_cross=yes
              fi
            else
              echo "configure: failed program was:" >&5
              cat conftest.$ac_ext >&5
              ac_cv_prog_f90_works=no
            fi
	fi
	pac_cv_prog_f90_cross="$ac_cv_prog_f90_cross"
	pac_cv_prog_f90_works="$ac_cv_prog_f90_works"
        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

    fi
fi
pac_save_level=`expr $pac_save_level + 1`


ac_ext=$pac_cv_f90_ext
ac_compile='${F90-f90} -c $F90FLAGS conftest.$ac_ext 1>&5'
ac_link='${F90-f90} -o conftest${ac_exeext} $F90FLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$pac_cv_prog_f90_cross

# Offset kind should be for 8 bytes if possible (Romio prefers that)
# address should be sizeof void *
testsize=$ac_cv_sizeof_voidp
if test "$testsize" = 0 ; then
    # Set a default
    testsize=4
fi

# Set the default
ADDRESS_KIND=-1
if test "$pac_cv_prog_f90_cross" = "yes" ; then
    ADDRESS_KIND="$CROSS_F90_ADDRESS_KIND"
else
if test -n "$ac_f90compile" ; then
    echo $ac_n "checking for Fortran 90 integer kind for ${testsize}-byte integers""... $ac_c" 1>&6
echo "configure:5441: checking for Fortran 90 integer kind for ${testsize}-byte integers" >&5
    # Convert bytes to digits
    case ${testsize} in 
	1) sellen=2 ;;
	2) sellen=4 ;;
	4) sellen=8 ;;
	8) sellen=16 ;;
       16) sellen=30 ;;
	*) sellen=8 ;;
    esac
    # Check for cached value
    eval testval=\$"pac_cv_prog_f90_int_kind_$sellen"
    if test -n "$testval" ; then 
        echo "$ac_t""$testval (cached)" 1>&6
	ADDRESS_KIND=$testval
    else
        # must compute
        rm -f conftest*
        cat <<EOF > conftest.$ac_f90ext
      program main
      integer i
      i = selected_int_kind($sellen)
      open(8, file="conftest1.out", form="formatted")
      write (8,*) i
      close(8)
      stop
      end
EOF
        KINDVAL="unavailable"
        eval "pac_cv_prog_f90_int_kind_$sellen"=-1
        if { (eval echo configure:5471: \"$ac_f90link\") 1>&5; (eval $ac_f90link) 2>&5; } && test -s conftest ; then
            ./conftest 1>&5 2>&1
            if test -s conftest1.out ; then
	        # Because of write, there may be a leading blank.
                KINDVAL=`cat conftest1.out | sed 's/ //g'`
 	        eval "pac_cv_prog_f90_int_kind_$sellen"=$KINDVAL
	        ADDRESS_KIND=$KINDVAL
            fi
        fi
        rm -f conftest*
	echo "$ac_t""$KINDVAL" 1>&6
    fi # not cached
fi # Has Fortran 90
fi # is not cross compiling

if test "$ac_cv_sizeof_void_p" = 8 ; then
    OFFSET_KIND=$ADDRESS_KIND
else
    
# Set the default
OFFSET_KIND=-1
if test "$pac_cv_prog_f90_cross" = "yes" ; then
    OFFSET_KIND="$CROSS_F90_OFFSET_KIND"
else
if test -n "$ac_f90compile" ; then
    echo $ac_n "checking for Fortran 90 integer kind for 8-byte integers""... $ac_c" 1>&6
echo "configure:5497: checking for Fortran 90 integer kind for 8-byte integers" >&5
    # Convert bytes to digits
    case 8 in 
	1) sellen=2 ;;
	2) sellen=4 ;;
	4) sellen=8 ;;
	8) sellen=16 ;;
       16) sellen=30 ;;
	*) sellen=8 ;;
    esac
    # Check for cached value
    eval testval=\$"pac_cv_prog_f90_int_kind_$sellen"
    if test -n "$testval" ; then 
        echo "$ac_t""$testval (cached)" 1>&6
	OFFSET_KIND=$testval
    else
        # must compute
        rm -f conftest*
        cat <<EOF > conftest.$ac_f90ext
      program main
      integer i
      i = selected_int_kind($sellen)
      open(8, file="conftest1.out", form="formatted")
      write (8,*) i
      close(8)
      stop
      end
EOF
        KINDVAL="unavailable"
        eval "pac_cv_prog_f90_int_kind_$sellen"=-1
        if { (eval echo configure:5527: \"$ac_f90link\") 1>&5; (eval $ac_f90link) 2>&5; } && test -s conftest ; then
            ./conftest 1>&5 2>&1
            if test -s conftest1.out ; then
	        # Because of write, there may be a leading blank.
                KINDVAL=`cat conftest1.out | sed 's/ //g'`
 	        eval "pac_cv_prog_f90_int_kind_$sellen"=$KINDVAL
	        OFFSET_KIND=$KINDVAL
            fi
        fi
        rm -f conftest*
	echo "$ac_t""$KINDVAL" 1>&6
    fi # not cached
fi # Has Fortran 90
fi # is not cross compiling

fi
#
# Some compilers won't allow a -1 kind (e.g., absoft).  In this case, 
# use a fallback (sizeof(int) kind)
if test "$ADDRESS_KIND" = "-1" -o "$OFFSET_KIND" = "-1" ; then
    
# Set the default
simpleintkind=-1
if test "$pac_cv_prog_f90_cross" = "yes" ; then
    simpleintkind=""
else
if test -n "$ac_f90compile" ; then
    echo $ac_n "checking for Fortran 90 integer kind for ${pac_cv_f77_sizeof_integer}-byte integers""... $ac_c" 1>&6
echo "configure:5555: checking for Fortran 90 integer kind for ${pac_cv_f77_sizeof_integer}-byte integers" >&5
    # Convert bytes to digits
    case ${pac_cv_f77_sizeof_integer} in 
	1) sellen=2 ;;
	2) sellen=4 ;;
	4) sellen=8 ;;
	8) sellen=16 ;;
       16) sellen=30 ;;
	*) sellen=8 ;;
    esac
    # Check for cached value
    eval testval=\$"pac_cv_prog_f90_int_kind_$sellen"
    if test -n "$testval" ; then 
        echo "$ac_t""$testval (cached)" 1>&6
	simpleintkind=$testval
    else
        # must compute
        rm -f conftest*
        cat <<EOF > conftest.$ac_f90ext
      program main
      integer i
      i = selected_int_kind($sellen)
      open(8, file="conftest1.out", form="formatted")
      write (8,*) i
      close(8)
      stop
      end
EOF
        KINDVAL="unavailable"
        eval "pac_cv_prog_f90_int_kind_$sellen"=-1
        if { (eval echo configure:5585: \"$ac_f90link\") 1>&5; (eval $ac_f90link) 2>&5; } && test -s conftest ; then
            ./conftest 1>&5 2>&1
            if test -s conftest1.out ; then
	        # Because of write, there may be a leading blank.
                KINDVAL=`cat conftest1.out | sed 's/ //g'`
 	        eval "pac_cv_prog_f90_int_kind_$sellen"=$KINDVAL
	        simpleintkind=$KINDVAL
            fi
        fi
        rm -f conftest*
	echo "$ac_t""$KINDVAL" 1>&6
    fi # not cached
fi # Has Fortran 90
fi # is not cross compiling

    if test "$simpleintkind" = "-1" ; then
	# Wild guess; probably means that Fortran 90 is not available
	simpleintkind=4
    fi
    if test "$ADDRESS_KIND" = "-1" ; then
	ADDRESS_KIND=$simpleintkind
    fi
    if test "$OFFSET_KIND" = "-1" ; then
	OFFSET_KIND=$simpleintkind
    fi
fi

pac_save_level=`expr $pac_save_level - 1`
if test "X$pac_save_level" = "X0" ; then
    CC="$pac_save_CC"
    CXX="$pac_save_CXX"
    F77="$pac_save_F77"
    F90="$pac_save_F90"
    CPP="$pac_save_CPP"
    ac_cv_prog_cc_cross="$pac_save_prog_cc_cross"
    ac_cv_prog_f77_cross="$pac_save_prog_f77_cross"
    ac_cv_prog_cxx_cross="$pac_save_prog_cxx_cross"
    pac_cv_prog_f90_cross="$pac_save_prog_f90_cross"
    pac_save_level=""
fi





if test -n "$F90" -a "$enable_f90" != "no" ; then
    F90_SUFFIX="$ac_f90ext"
    # For now, top_srcdir_val is MPIR_HOME; 
    # The build dir is relative at ../..
    top_srcdir_val="$MPIR_HOME"
    if test "$do_f90_modules" = "yes" -a -n "$top_srcdir_val" ; then
        echo "Setting up F90 Module support"
	if test ! -d ../../f90modules ; then mkdir ../../f90modules ; fi
	# if we're the developers, we may need to create the
	# initial configure files.
	if test ! -x $top_srcdir_val/f90modules/configure -a \
	          -s $top_srcdir_val/f90modules/configure.in -a \
		  -x $top_srcdir_val/f90modules/makeconfigure ; then
	    (cd $top_srcdir_val/f90modules ; ./makeconfigure)
	fi
	# Should F90LINKER be F90TESTLINKER?
        (cd ../../f90modules ; \
	            export F90 ; export MPIR_HOME ; export VPATH ; \
	   	    export libbuild_dir ; export includebuild_dir ; \
		    export MAKE ; F90LINKER="$F90LINKER" ; \
		    export F90LINKER ; export F77 ; \
 	   	    $top_srcdir_val/f90modules/configure --with-mpich)
        if test ! -s ../../f90modules/Makefile ; then 
	    # turn off f90
	    F90=""
	else		    
 	    F90_MODINCFLAG="`$MAKE -f ../../f90modules/Makefile f90modflag`"
  	    F90MODINCSPEC="`$MAKE -f ../../f90modules/Makefile f90modspec`"
            if test -z "$USER_SET_F90INC" -a -z "$F90INC" ; then 
	        # This should use a test or try to get it from the f90module.
	        F90INC=`$MAKE -f ../../f90modules/Makefile f90incflag`
            fi
        fi
    fi
else 
     # Remove the f90modules/Makefile since this is the only way
     # to tell the top-level makefile not to build the f90 modules.
     # (We need a better way)
     rm -f ../../f90modules/Makefile
fi

f90includedir='${includedir}'
f90libdir='${libdir}'









if test -z "$F90_LIBDIR_LEADER" ; then 
    F90_LIBDIR_LEADER="-L"
fi


echo $ac_n "checking whether using gcc and g77 together""... $ac_c" 1>&6
echo "configure:5688: checking whether using gcc and g77 together" >&5
if test "$ac_cv_prog_gcc" = "yes" -a "$ac_cv_prog_g77" = "yes" ; then
    cat >> confdefs.h <<\EOF
#define USE_GCC_G77_DECLS 1
EOF

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



FC="$F77"

 # some autoconf versions need this explicitly
# These last 2 sets of flags are used to pass flags needed only to compile
# and use MPI programs, not to build the MPI library itself.


if test -z "$top_build_dir" ; then
    top_build_dir=`cd ../../.. ; pwd`
fi
if test -z "$includebuild_dir" ; then
    includebuild_dir=$top_build_dir/src/include
fi
if test -z "$libbuild_dir" ; then
    libbuild_dir=$top_build_dir/lib
fi
export includebuild_dir
export libbuild_dir






trap '' 1 2 15
cat > confcache <<\EOF
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
# scripts and configure runs.  It is not useful on other systems.
# If it contains results you don't want to keep, you may remove or edit it.
#
# By default, configure uses ./config.cache as the cache file,
# creating it if it does not exist already.  You can give configure
# the --cache-file=FILE option to use a different cache file; that is
# what configure does when it calls configure scripts in
# subdirectories, so they share the cache.
# Giving --cache-file=/dev/null disables caching, for debugging configure.
# config.status only pays attention to the cache file if you give it the
# --recheck option to rerun configure.
#
EOF
# The following way of writing the cache mishandles newlines in values,
# but we know of no workaround that is simple, portable, and efficient.
# So, don't put newlines in cache variables' values.
# Ultrix sh set writes to stderr and can't be redirected directly,
# and sets the high bit in the cache file unless we assign to the vars.
(set) 2>&1 |
  case `(ac_space=' '; set | grep ac_space) 2>&1` in
  *ac_space=\ *)
    # `set' does not quote correctly, so add quotes (double-quote substitution
    # turns \\\\ into \\, and sed turns \\ into \).
    sed -n \
      -e "s/'/'\\\\''/g" \
      -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
    ;;
  *)
    # `set' quotes correctly as required by POSIX, so do not add quotes.
    sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
    ;;
  esac >> confcache
if cmp -s $cache_file confcache; then
  :
else
  if test -w $cache_file; then
    echo "updating cache $cache_file"
    cat confcache > $cache_file
  else
    echo "not updating unwritable cache $cache_file"
  fi
fi
rm -f confcache

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 mpif.h mpif77.conf mpif77 setbotf.f mpi_fortconf.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%@HAVE_MPID_FORTDEFS_H@%$HAVE_MPID_FORTDEFS_H%g
s%@FLIBNAME@%$FLIBNAME%g
s%@FWRAPNAME@%$FWRAPNAME%g
s%@master_top_srcdir@%$master_top_srcdir%g
s%@f77includedir@%$f77includedir%g
s%@f77libdir@%$f77libdir%g
s%@f77bindir@%$f77bindir%g
s%@subname@%$subname%g
s%@INCLUDES@%$INCLUDES%g
s%@MPIVERSION@%$MPIVERSION%g
s%@CC@%$CC%g
s%@F77@%$F77%g
s%@FOPTIONS@%$FOPTIONS%g
s%@FLINKER@%$FLINKER%g
s%@F90@%$F90%g
s%@F90LINKER@%$F90LINKER%g
s%@MAKE@%$MAKE%g
s%@VPATH@%$VPATH%g
s%@SET_CFLAGS@%$SET_CFLAGS%g
s%@SET_MAKE@%$SET_MAKE%g
s%@AR@%$AR%g
s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
s%@INSTALL_DATA@%$INSTALL_DATA%g
s%@MKDIR_P@%$MKDIR_P%g
s%@RANLIB@%$RANLIB%g
s%@F77LINKER@%$F77LINKER%g
s%@MPILIBNAME@%$MPILIBNAME%g
s%@CC_SHL@%$CC_SHL%g
s%@ENABLE_SHLIB@%$ENABLE_SHLIB%g
s%@FC_SHL@%$FC_SHL%g
s%@LIB_PATH@%$LIB_PATH%g
s%@BASE_LIB_LIST@%$BASE_LIB_LIST%g
s%@HASMPE@%$HASMPE%g
s%@F77_LDFLAGS@%$F77_LDFLAGS%g
s%@BASE_FFLAGS@%$BASE_FFLAGS%g
s%@includebuild_dir@%$includebuild_dir%g
s%@MPI_WITH_PMPI@%$MPI_WITH_PMPI%g
s%@SHAREDKIND@%$SHAREDKIND%g
s%@SHARED_LIB_SEARCH_PATH_LEADER@%$SHARED_LIB_SEARCH_PATH_LEADER%g
s%@SHARED_LIB_LOCALDIR@%$SHARED_LIB_LOCALDIR%g
s%@sharedlibbuild_dir@%$sharedlibbuild_dir%g
s%@sharedlib_dir@%$sharedlib_dir%g
s%@MPI2_OBJECTS@%$MPI2_OBJECTS%g
s%@CPP@%$CPP%g
s%@TESTCPP@%$TESTCPP%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%@FLIBS@%$FLIBS%g
s%@F77_NAME_MANGLE@%$F77_NAME_MANGLE%g
s%@F77_IN_C_LIBS@%$F77_IN_C_LIBS%g
s%@CHARDECL@%$CHARDECL%g
s%@F77_INCDIR@%$F77_INCDIR%g
s%@FINCLUDES@%$FINCLUDES%g
s%@F77_LIBDIR_LEADER@%$F77_LIBDIR_LEADER%g
s%@MPIFPMPI@%$MPIFPMPI%g
s%@MPI_CHARACTER@%$MPI_CHARACTER%g
s%@MPI_INTEGER@%$MPI_INTEGER%g
s%@MPI_REAL@%$MPI_REAL%g
s%@MPI_LOGICAL@%$MPI_LOGICAL%g
s%@MPI_COMPLEX@%$MPI_COMPLEX%g
s%@MPI_DOUBLE_PRECISION@%$MPI_DOUBLE_PRECISION%g
s%@MPI_2INTEGER@%$MPI_2INTEGER%g
s%@MPI_2REAL@%$MPI_2REAL%g
s%@MPI_DOUBLE_COMPLEX@%$MPI_DOUBLE_COMPLEX%g
s%@MPI_2DOUBLE_PRECISION@%$MPI_2DOUBLE_PRECISION%g
s%@MPI_2COMPLEX@%$MPI_2COMPLEX%g
s%@MPI_2DOUBLE_COMPLEX@%$MPI_2DOUBLE_COMPLEX%g
s%@MPI_PACKED@%$MPI_PACKED%g
s%@MPI_LB@%$MPI_LB%g
s%@MPI_UB@%$MPI_UB%g
s%@F77_INTEGER1@%$F77_INTEGER1%g
s%@F77_INTEGER2@%$F77_INTEGER2%g
s%@F77_INTEGER4@%$F77_INTEGER4%g
s%@F77_INTEGER8@%$F77_INTEGER8%g
s%@F77_INTEGER16@%$F77_INTEGER16%g
s%@F77_REAL4@%$F77_REAL4%g
s%@F77_REAL8@%$F77_REAL8%g
s%@F77_REAL16@%$F77_REAL16%g
s%@F77_COMPLEX8@%$F77_COMPLEX8%g
s%@F77_COMPLEX16@%$F77_COMPLEX16%g
s%@F77_COMPLEX32@%$F77_COMPLEX32%g
s%@MPI_FINT@%$MPI_FINT%g
s%@MPI_STATUS_SIZE@%$MPI_STATUS_SIZE%g
s%@BSEND_OVERHEAD@%$BSEND_OVERHEAD%g
s%@MPI_MAX_PROCESSOR_NAME@%$MPI_MAX_PROCESSOR_NAME%g
s%@PROFILE_DEF_MPI@%$PROFILE_DEF_MPI%g
s%@NO_WEAK_SYM@%$NO_WEAK_SYM%g
s%@NO_WEAK_SYM_TARGET@%$NO_WEAK_SYM_TARGET%g
s%@F77CPP@%$F77CPP%g
s%@ADDRESS_KIND@%$ADDRESS_KIND%g
s%@OFFSET_KIND@%$OFFSET_KIND%g
s%@F90_SUFFIX@%$F90_SUFFIX%g
s%@f90includedir@%$f90includedir%g
s%@f90libdir@%$f90libdir%g
s%@F90_LDFLAGS@%$F90_LDFLAGS%g
s%@F90INC@%$F90INC%g
s%@F90_MODINCFLAG@%$F90_MODINCFLAG%g
s%@F90MODINCSPEC@%$F90MODINCSPEC%g
s%@F90FLAGS@%$F90FLAGS%g
s%@F90LIB_PATH@%$F90LIB_PATH%g
s%@F90_LIBDIR_LEADER@%$F90_LIBDIR_LEADER%g
s%@FC@%$FC%g
s%@MPI_FFLAGS@%$MPI_FFLAGS%g
s%@MPI_LDFLAGS@%$MPI_LDFLAGS%g
s%@MAKE_DEPEND_C@%$MAKE_DEPEND_C%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 mpif.h mpif77.conf mpif77 setbotf.f"}
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="mpi_fortconf.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


has_exclaim=$has_exclaim



EOF
cat >> $CONFIG_STATUS <<\EOF
if test "$enable_echo" ; then set -x ; fi 

if grep MPIPRIV mpif.h 2>&1 1>/dev/null ; then 
    :
else 
    rm -rf .tmp ; 
    cat mpif.h mpif_bottom.h > .tmp ;
    rm -f mpif.h ; mv .tmp mpif.h
fi

if test "$has_exclaim" = "yes" ; then 
    rm -rf .tmp
    cp mpif.h .tmp
    sed -e 's/^C/\!/g' .tmp > mpif.h
    rm -rf .tmp
fi

chmod a+x mpif77 ;
   if test ! -d ../../../bin  ; then mkdir ../../../bin ; fi 
   sed -e 's%includedir=.*%includedir='$includebuild_dir% \
       -e 's%libdir=.*%libdir='$libbuild_dir% mpif77 > ../../../bin/mpif77 ;
   chmod a+x ../../../bin/mpif77 
cp mpif.h ../../../src/include

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

exit 0

if test -n "$F90" ; then
    # Remove all comments from mpif.h
    /bin/rm -f $includebuild_dir/mpif.h.copy
    cp $includebuild_dir/mpif.h $includebuild_dir/mpif.h.copy
    if test "$fixupmpif" = "no" ; then
	# Regular Fortran doesn't have ! for comments, so we just delete them
        sed -e '/^C/d' -e 's/\!.*$//g' $includebuild_dir/mpif.h.copy > $includebuild_dir/mpif.h
    else
        sed -e 's/^C/\!/g' $includebuild_dir/mpif.h.copy > $includebuild_dir/mpif.h
    fi
    /bin/rm -f $includebuild_dir/mpif.h.copy
else
    # ROMIO might have added ! comments to mpif.h
    if test -z "$fixupmpif" -o "$fixupmpif" = "no" ; then
        /bin/rm -f $includebuild_dir/mpif.h.copy
        cp $includebuild_dir/mpif.h $includebuild_dir/mpif.h.copy
	# Regular Fortran doesn't have ! for comments, so we just delete them
        sed -e '/^C/d' -e 's/\!.*$//g' $includebuild_dir/mpif.h.copy > $includebuild_dir/mpif.h
        /bin/rm -f $includebuild_dir/mpif.h.copy
    fi
fi
