dnl This is an autoconf script. To rebuild the "configure" script 
dnl from this, execute the command "autoconf" in the directory containing 
dnl this script.  You must have autoconf version 1.4 or later, 
dnl but NOT version 2.0 or later
[#!/bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated automatically using autoconf.
# Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
progname="`echo $0 | sed 's:^\./\./:\./:'`"
print_error() {
    echo "*# $*" 2>&1 ;
    }
usage_msg="
Usage: ${progname} [-file_system=FILE_SYSTEM] [-arch=ARCH_TYPE] [-mpi=MPI_IMPL]
                [-mpiincdir=MPI_INCLUDE_DIR] [-mpilib=MPI_LIBRARY]
		[-mpibindir=MPI_BIN_DIR]
                [-cc=C_COMPILER] [-fc=FORTRAN_COMPILER] [-nof77] 
                [-cflags=CFLAGS] [-fflags=FFLAGS] [-f90=F90_COMPILER] [-debug] 
                [-make=MAKEPGM] [-mpiolib=MPIO_LIBRARY] [-ar_nolocal] 
                [-noranlib] [-ar=AR_COMMAND] [-prefix=INSTALL_DIR]  
                [-intsize=INTSIZE] [-ptrsize=PTRSIZE] [-longsize=LONGSIZE]
                [-longlongsize=LONGLONGSIZE] [-f90nag] [-disable-weak-symbols]

where
   FILE_SYSTEM  = the file system(s) for which ROMIO is to be configured.
                  Valid values are pfs, piofs, hfs, xfs, sfs, pvfs, ufs,
                  and nfs (case-sensitive). They correspond to Intel's PFS, 
                  IBM's PIOFS, HP/Convex's HFS, SGI's XFS, NEC's SFS, 
                  Clemson University's PVFS (for Linux clusters), any Unix 
                  file system, and NFS. 
                  To configure for multiple file systems, use "+" as a 
                  separator; e.g., ufs+nfs
   ARCH_TYPE    = the type of machine for which ROMIO is to be configured.
                  Not needed on most machines, because ROMIO can usually
                  find the arch_type on its own. Needed if you are 
                  cross-compiling for a different architecture.
                  Valid values are sun4, solaris, solaris86, rs6000,
                  paragon, hpux, sppux, IRIX, IRIX32, IRIXN32, IRIX64, SX4, 
                  alpha, freebsd, LINUX, and LINUX_ALPHA.  (case-sensitive)
   MPI_IMPL     = the MPI implementation with which ROMIO will be used
                  Valid values are mpich, sgi, hp. (case-sensitive)
                  Valid implementations are MPICH 1.1.1 or higher,
                  SGI's MPI 3.1 or higher, HP MPI 1.3 or higher, LAM, 
                  and Cray MPI.
   MPI_INCLUDE_DIR = the full path of the directory where mpi.h is located.
                  Not needed if the directory is in the compiler's 
                  default include path
   MPI_LIBRARY  = name of the file containing the MPI library (full path).
                  Not needed if the library is in the compiler's default
                  list of libraries
   MPI_BIN_DIR  = the full path of the directory that contains the MPI
                  versions of the compilers, such as mpicc and mpif77.
                  Use only if the ROMIO configure cannot find the
                  necessary commands
   C_COMPILER   = the C compiler to use. If not specified, ROMIO uses a 
                  default compiler depending on the machine.
   FORTRAN_COMPILER = the Fortran compiler to use. If not specified, ROMIO 
                  uses a default compiler depending on the machine.
   CFLAGS       = flags to give to the C compiler
   FFLAGS       = flags to give to the Fortran compiler
   F90_COMPILER = the Fortran 90 compiler to use. If not specified, 
                  ROMIO uses f90.
   MPIO_LIBRARY = name of the MPI-IO library to be built (full path).
                  Default is "this_directory"/lib/ARCH_TYPE/libmpio.a.
   MAKEPGM      = name of the make program to use
   AR_COMMAND   = an alternate archiver (ar) command to use.
   INSTALL_DIR  = directory where ROMIO is to be installed
   INTSIZE      = size of int in bytes.
   PTRSIZE      = size of pointers in bytes.
   LONGSIZE     = size of long in bytes.
   LONGLONGSIZE = size of long long in bytes.
 
The options '-mpiincdir' and '-mpilib' may be needed if the MPI include file
and MPI library are not in the compiler's default path.

The option '-nof77' prevents the compilation of routines that require a
Fortran compiler.  If you select this option, you cannot use the
Fortran interface of MPI-IO.

The option '-f90nag' allows you to use the NAG Fortran 90 compiler 
instead of Fortran 77.

The option '-make' may be used to select an alternate make program. ROMIO
uses "make" by default.

If '-debug' is used, ROMIO will be configured with the '-g' compiler option
for debugging.

The option '-ar_nolocal' prevents the library archive command from
attempting to use the local directory for temporary space.  This option
should be used when (a) there isn't much space (less than 10 MB)
available in the partition where ROMIO resides and (b) there is enough
space in /tmp (or wherever ar places temporary files by default).

The option '-noranlib' causes the 'ranlib' step (needed on some systems
to build an object library) to be skipped.  This is particularly useful
on systems where 'ranlib' is optional (allowed but not needed; because it
is allowed, configure chooses to use it just in case) but can fail (some
'ranlib's are implemented as scripts using 'ar'; if they don't use the
local directory, they can fail (destroying the library in the process) if
the temporary directory (usually '/tmp') does not have enough space.

The option -disable-weak-symbols disables the use of weak symbols, even if 
available, for building the profiling interface.
"
#
echo " "
echo "Configuring ROMIO Version 1.0.3"
echo " "
CONFIGURE_ARGS="$*"
if test -n "$CONFIGURE_ARGS" ; then
    echo "Configuring with args $CONFIGURE_ARGS"
fi
#
# rm -f include/*.h
#
NOF77=0
ARCH=""
arch_IRIX=""
MPI=""
MPI_INCLUDE_DIR=""
ROMIO_INCLUDE=""
MPI_LIB=""
LIBNAME=""
TEST_LIBNAME=""
FILE_SYSTEM=""
PREFIX=""
DEBUG=0
MIPS=0
BITS=0
FROM_MPICH=0
CFLAGS=""
LL="\%lld"
AR_LOCAL=l
HAVE_MPI_INFO=""
BUILD_MPI_INFO=""
MPI_FINFO1=""
MPI_FINFO2=""
MPI_FINFO3=""
MPI_FINFO4=""
MPI_FARRAY1=""
MPI_FARRAY2=""
MPI_FARRAY3=""
MPI_FARRAY4=""
MPI_FARRAY5=""
MPI_FARRAY6=""
MPI_FARRAY7=""
DEFS=""
ROMIO_LFLAGS=""
ROMIO_LIBLIST=""
ROMIO_TCFLAGS=""
ROMIO_TCPPFLAGS=""
ROMIO_TFFLAGS=""
NOPROFILE=0
MPIRUN=""
FORTRAN_TEST=""
MAKE=${MAKE:-"make"}
# foll. needed for f77 test programs
F77GETARG="call getarg(i,str)"
F77IARGC="iargc()"
FTESTDEFINE=""
FORTRAN_MPI_OFFSET=""
MPIOF_H_INCLUDED=0
MPI_OFFSET_KIND1="!"
MPI_OFFSET_KIND2="!"
F90=""
TEST_CC=""
TEST_F77=""
TRY_WEAK_SYMBOLS=1
#
for arg
do
case $arg in
  -arch=* | --arch=*)
     ARCH=`echo $arg|sed 's/-*arch=//'`
     eval "arch_`echo $ARCH`=1"
     ;;
  -file_system=* | --file_system=*)
     FILE_SYSTEM=`echo $arg|sed 's/-*file_system=//' | sed -e 's/\+/ /g'`
     for x in $FILE_SYSTEM
     do
        eval "file_system_`echo $x`=1"
     done
     ;;
  -mpi=* | --mpi=*)
     MPI=`echo $arg|sed 's/-*mpi=//'`
     eval "mpi_`echo $MPI`=1"
     ;;
  -mpiincdir=* | --mpiincdir=*)  
     MPI_INCLUDE_DIR=`echo $arg|sed 's/-*mpiincdir=//'`
     ;;
  -mpibindir=* | --mpibindir=*)  
     MPI_BIN_DIR=`echo $arg|sed 's/-*mpibindir=//'`
     ;;
  -mpilib=* | --mpilib=*)  
     MPI_LIB=`echo $arg|sed 's/-*mpilib=//'`
     ;;
  -mpiolib=* | --mpiolib=*)  
     LIBNAME=`echo $arg|sed 's/-*mpiolib=//'`
     ;;
  -cc=* | --cc=*)
     CC=`echo $arg|sed 's/-*cc=//'`
     ;;
  -fc=* | --fc=*)
     FC=`echo $arg|sed 's/-*fc=//'`
     ;;
  -cflags=* | --cflags=*)
     package="`echo $arg|sed 's/-*cflags=//'`"
     USER_CFLAGS="$package"
     CFLAGS="$CFLAGS $package" 
     ;;
  -fflags=* | --fflags=*)
     package="`echo $arg|sed 's/-*fflags=//'`"
     FFLAGS="$FFLAGS $package"
     ;;
  -make=* | --make=*)
     package=`echo $arg|sed 's/-*make=//'`
     MAKE="$package"
     ;;
  -nof77 | --nof77)
     echo "Fortran interface will not be built"
     NOF77=1
     ;;
  -debug | --debug)
     echo "Configuring for a debugging version"
     DEBUG=1
     ;;
  -ar_nolocal | --ar_nolocal)
     AR_LOCAL=''
     ;;
  -noranlib | --noranlib)
     RANLIB=':'
     ;;
  -prefix=* | --prefix=*)
     PREFIX=`echo $arg|sed 's/-*prefix=//'`
     ;;
  -f90nag | --f90nag)
     FC=f90
     F77GETARG="call f90_unix_MP_getarg(i,str)"
     F77IARGC="f90_unix_MP_iargc()"
     ;;
  -from_mpich | --from_mpich)
     FROM_MPICH=1
     ;;
   -ar=* | --ar=*)
     package=`echo $arg|sed 's/-*ar=//'`
     AR="$package"
     ;;
  -intsize=* | --intsize=*)
     package=`echo $arg|sed 's/-*intsize=//'`
     intsize="$package"
     ;;
  -ptrsize=* | --ptrsize=*)
     package=`echo $arg|sed 's/-*ptrsize=//'`
     pointersize="$package"
     ;;
  -longsize=* | --longsize=*)
     package=`echo $arg|sed 's/-*longsize=//'`
     longsize="$package"
     ;;
  -longlongsize=* | --longlongsize=*)
     package=`echo $arg|sed 's/-*longlongsize=//'`
     longlongsize="$package"
     ;;
  -noprofile | --noprofile)
     echo "profiling interface will not be built"
     NOPROFILE=1
     ;;
  -f90=* | --f90=*)
     F90=`echo A$arg|sed 's/A-*f90=//'`
     ;;
  -echo)
     set -x
     ;;
  -disable-weak-symbols|--disable-weak-symbols)
     TRY_WEAK_SYMBOLS=0
     ;;
  -h | -help | --h | --help | -u | --u)
    (echo "${usage_msg}") >& 2
    exit 1 ;;
  *)
  if test -n "$arg" ; then
     echo "Error: Invalid configure option $arg"
     exit 1;
  fi
  ;;
esac
done
]
#
rm -f config.log
AC_PREPARE()
#
PAC_FIXUP_SRCDIR
#
PAC_MAKE_VPATH
#
# Check that an arch was set
# If it wasn't set, try to guess using "util/tarch"
#
if test -z "$ARCH" -a -x $srcdir/util/tarch ; then
    AC_MSG_CHECKING(for architecture)
    ARCH=`$srcdir/util/tarch | sed s/-/_/g`
    if test -z "$ARCH" ; then
       AC_MSG_RESULT(Unknown!)
       print_error "Error: Couldn't guess target architecture, you must"
       print_error "       set an architecture type with -arch=<value>"
       exit 1
    fi
    eval "arch_$ARCH=1"
    AC_MSG_RESULT($ARCH)
fi
#
# check for valid architecture
grep _"$ARCH"_ $srcdir/.config_params > /dev/null 2>&1
if test $? != 0 ; then
   echo "Unknown architecture $arch... proceeding anyway"
fi
#
# check for valid file system
if test -n "$FILE_SYSTEM" ; then
   for x in $FILE_SYSTEM
   do
      grep _"$x"_ $srcdir/.config_params > /dev/null 2>&1
      if test $? != 0 ; then
         echo "Unknown file system $x... proceeding anyway"
      fi
   done
fi
#
# check for valid MPI implementation
if test -n "$MPI" ; then
   grep _"$MPI"_mpi $srcdir/.config_params > /dev/null 2>&1
   if test $? != 0 ; then
      echo "Unknown MPI implementation $MPI... proceeding anyway"
   fi
fi
#
# check for valid MPI include directory if specified
if test $FROM_MPICH = 0 ; then
   if test -n "$MPI_INCLUDE_DIR"; then
      if test ! -f "$MPI_INCLUDE_DIR/mpi.h" ; then
         echo "Error: Include file $MPI_INCLUDE_DIR/mpi.h not found"
         exit 1
      fi
   else
#     assume that mpi.h is in the default path
#     set MPI_INCLUDE_DIR to ".", so that it translates to -I. in the
#     compile command. Some compilers complain if it's only -I
      MPI_INCLUDE_DIR=.
   fi
fi
#
# check for valid MPI library if specified
if test $FROM_MPICH = 0 ; then
   if test -n "$MPI_LIB" ; then
      if test ! -f "$MPI_LIB" ; then
         echo "Error: MPI library $MPI_LIB not found"
         exit 1
      fi
   fi
fi
#
#
AR="${AR:-ar} cr$AR_LOCAL"
if test -z "$RANLIB" ; then
    AC_PROG_RANLIB
fi
MAKE=${MAKE:-make}
#
if test $DEBUG = 1; then
    USER_CFLAGS="$CFLAGS -g"
    USER_FFLAGS="$FFLAGS -g"
else
    USER_CFLAGS="$CFLAGS -O"
    USER_FFLAGS="$FFLAGS -O"
fi
#
if test -n "$arch_sun4" ; then 
    CC=${CC:-gcc}
    F77=${FC:-f77}
    if test $DEBUG = 1; then
	if test "$CC" = "gcc"; then
           CFLAGS="$CFLAGS -g -O -Wall -Wstrict-prototypes -Wmissing-prototypes -DAIO_SUN"
	else
           CFLAGS="$CFLAGS -g -DAIO_SUN"
        fi
    else 
        CFLAGS="$CFLAGS -O -DAIO_SUN"
    fi
    if test -z "$MPI" ; then
        MPI=mpich
        mpi_mpich=1
    fi
    if test -z "$FILE_SYSTEM" ; then
        file_system_ufs=1
        file_system_nfs=1
        FILE_SYSTEM="ufs nfs"
        echo "configuring for file systems ufs and nfs"
    fi
fi
#
if test -n "$arch_solaris" || test -n "$arch_solaris86" ; then
    CC=${CC:-cc}
    F77=${FC:-f77}
    if test $DEBUG = 1; then
        if test "$CC" = "gcc" ; then
            CFLAGS="$CFLAGS -g -O -Wall -Wstrict-prototypes -Wmissing-prototypes -DAIO_SUN"
        else 
            CFLAGS="$CFLAGS -g -v -DAIO_SUN"
        fi
    else 
        CFLAGS="$CFLAGS -O -DAIO_SUN"
    fi
    if test -z "$MPI" ; then
        MPI=mpich
        mpi_mpich=1
    fi
    if test -z "$FILE_SYSTEM" ; then
        file_system_ufs=1
        file_system_nfs=1
        FILE_SYSTEM="ufs nfs"
        echo "configuring for file systems ufs and nfs"
    fi
    CFLAGS="$CFLAGS -DSOLARIS"
    if test $MPI = "mpich" ; then
        TEST_CC=mpicc
        TEST_F77=mpif77
        MPI_LIB="-laio"
    else
        TEST_CC="$CC"
        TEST_F77="$F77"
        MPI_LIB="$MPI_LIB -laio"
    fi
    AR="ar cr"
    ROMIO_LIBLIST="-laio"
# solaris does not have l option to ar
# solaris f90 does not have 8-byte integer type
fi
#
if test -n "$arch_rs6000"; then
    F77=$FC
    if test -z "$CC"; then
       AC_PROGRAMS_CHECK(CC, mpcc, cc)
       echo "Using $CC"
    fi
    if test $NOF77 = 0 && test -z "$FC"; then 
       AC_PROGRAMS_CHECK(F77, mpxlf, f77)
       echo "Using $F77"
    fi
    if test $DEBUG = 1; then
        CFLAGS="$CFLAGS -g -DNO_FD_IN_AIOCB -DAIO_HANDLE_IN_AIOCB"
    else 
        CFLAGS="$CFLAGS -O -DNO_FD_IN_AIOCB -DAIO_HANDLE_IN_AIOCB"
    fi
    if test -z "$MPI" ; then
        MPI=mpich
        mpi_mpich=1
    fi
    if test -z "$FILE_SYSTEM" ; then
        if test "$CC" = "mpcc" || test "$CC" = "mpCC" ; then
            file_system_piofs=1
            FILE_SYSTEM="piofs"
            echo "configuring for file systems piofs, ufs, and nfs"
        else 
            echo "configuring for file systems ufs and nfs"
        fi
        file_system_ufs=1
        file_system_nfs=1
        FILE_SYSTEM="$FILE_SYSTEM ufs nfs"
    fi
    CFLAGS="$CFLAGS -DAIX"
# assume long long exists.
    longlongsize=${longlongsize:-8} 
    MPI_OFFSET_KIND1="      INTEGER MPI_OFFSET_KIND"
    MPI_OFFSET_KIND2="      PARAMETER (MPI_OFFSET_KIND=8)"
fi    
#
if test -n "$arch_paragon"; then
    CC=${CC:-icc}
    F77=${FC:-if77}
    if test $DEBUG = 1; then
        CFLAGS="$CFLAGS -g"
    else 
	if test "$CC" = "icc"; then
           CFLAGS="$CFLAGS -Knoieee -Mvect -O3"
	else
           CFLAGS="$CFLAGS -O"
        fi
    fi
    AR="ar860 cr$AR_LOCAL"
    MPI_LIB="$MPI_LIB -nx"
    if test -z "$MPI" ; then
        MPI=mpich
        mpi_mpich=1
    fi
    if test -z "$FILE_SYSTEM" ; then
        file_system_pfs=1
        file_system_ufs=1
        file_system_nfs=1
        FILE_SYSTEM="pfs ufs nfs"
        echo "configuring for file systems pfs, ufs, and nfs"
    fi
    CFLAGS="$CFLAGS -DPARAGON -DNO_AIO"
# NO_AIO is if configuring for NFS/UFS. It doesn't affect PFS asynch. I/O.
# long long does not exist
    longlongsize=${longlongsize:-0} 
fi    
#
if test -n "$arch_tflop" || test -n "$arch_tflops"; then
    CC=${CC:-pgcc}
    F77=${FC:-pgf77}
    TFLOP_FLAGS="-cougar -D__PUMA -DNO_AIO"
    if test $DEBUG = 1; then
        CFLAGS="$CFLAGS -g $TFLOP_FLAGS"
    else
       if test "$CC" = "pgcc"; then
           CFLAGS="$CFLAGS -Knoieee -Mvect -O3 $TFLOP_FLAGS"
       else
           CFLAGS="$CFLAGS -O $TFLOP_FLAGS"
       fi
    fi
    AR="xar cr$AR_LOCAL"
        RANLIB="xranlib"
    MPI_LIB="$MPI_LIB"
    if test -z "$MPI" ; then
        MPI=mpich
        mpi_mpich=1
    fi
    if test -z "$FILE_SYSTEM" ; then
        file_system_ufs=1
        FILE_SYSTEM="ufs"
        echo "configuring for file system ufs"
    fi
fi
#
if test -n "$arch_freebsd" || test -n "$arch_LINUX" || test -n "$arch_LINUX_ALPHA" || test -n "$arch_netbsd" ; then
    CC=${CC:-gcc}
    if test -n "$arch_freebsd" || test -n "$arch_netbsd" ; then
       F77=${FC:-f77}
       CFLAGS="$CFLAGS -DFREEBSD"
       PAC_HAVE_MOUNT_NFS
       longlongsize=${longlongsize:-0}
# printf doesn't work properly and no integer*8 as far as I can tell
    else 
       F77=${FC:-g77}
       CFLAGS="$CFLAGS -DLINUX"
    fi
    if test $DEBUG = 1 ; then
	if test "$CC" = "gcc" ; then
            CFLAGS="$CFLAGS -g -O -Wall -Wstrict-prototypes -Wmissing-prototypes -DNO_AIO"
        else
	    CFLAGS="$CFLAGS -g -DNO_AIO"
        fi
    else 
        CFLAGS="$CFLAGS -O -DNO_AIO"
    fi
    if test -z "$MPI" ; then
        MPI=mpich
        mpi_mpich=1
    fi
    if test -z "$FILE_SYSTEM" ; then
        file_system_ufs=1
        file_system_nfs=1
        FILE_SYSTEM="ufs nfs"
        echo "configuring for file systems ufs and nfs"
    fi
fi    
#
if test -n "$arch_SX4" ; then
    CC=${CC:-mpicc}
    F77=${FC:-mpif90}
    if test $DEBUG = 1; then
        CFLAGS="$CFLAGS -g -DNO_AIO -DSX4"
        FFLAGS="$FFLAGS -g"
    else
        USER_FFLAGS="$FFLAGS -Chopt"
        CFLAGS="$CFLAGS -O -DNO_AIO -DSX4"
        FFLAGS="$FFLAGS -Chopt"
    fi
    if test -z "$MPI" ; then
        MPI=mpich
        mpi_mpich=1
    fi
    if test -z "$FILE_SYSTEM" ; then
        file_system_sfs=1
        file_system_nfs=1
        FILE_SYSTEM="sfs nfs"
        echo "configuring for file systems sfs and nfs"
    fi
    MPI_OFFSET_KIND1="      INTEGER MPI_OFFSET_KIND"
    MPI_OFFSET_KIND2="      PARAMETER (MPI_OFFSET_KIND=8)"
fi
#
if test -n "$arch_hpux" || test -n "$arch_sppux" ; then
    if test $DEBUG = 1; then
        CFLAGS="$CFLAGS -g +w1 -DNO_AIO"
    else 
        CFLAGS="$CFLAGS -O -DNO_AIO"
    fi
    RANLIB=":"
    if test -z "$MPI"; then
        if test -f "/opt/mpi/include/mpi.h" ; then
            echo "assuming that you want to use ROMIO with HP MPI"
            MPI=hp
        else 
            echo "assuming that you want to use ROMIO with MPICH"
            MPI=mpich
        fi            
    fi
    if test $MPI = "mpich" ; then
        mpi_mpich=1
        MPI_LIB="$MPI_LIB -lV3"
        CC=${CC:-cc -Ae}
        F77=${FC:-f77 +U77}
    fi
    if test $MPI = "hp" ; then
        mpi_hp=1
        CC=${CC:-mpicc -Ae}
        F77=${FC:-mpif77 +U77}
    fi
    if test $MPI = "lam" && test "$FC" != ""; then
        FC="$FC +U77"
    fi
    FTESTDEFINE="external iargc, getarg"
    if test -n "$arch_hpux" ; then
        CFLAGS="$CFLAGS -DHPUX -D_LARGEFILE64_SOURCE"
        if test $MPI = "hp" ; then
           F77=${FC:-mpif90 +U77}
        else
           F77=${FC:-f90 +U77}
        fi
    else
        CFLAGS="$CFLAGS -DSPPUX"
    fi
    if test -z "$FILE_SYSTEM" ; then
        if test -n "$arch_hpux" ; then
           AC_COMPILE_CHECK(struct flock64,[#include <fcntl.h>],[
struct flock64 fl; int i=F_SETLKW64;],flock64_ok="yes",flock64_ok="no")
        else
            flock64_ok="yes"
        fi
        if test $flock64_ok = "yes" ; then
            file_system_hfs=1
            file_system_nfs=1
            FILE_SYSTEM="hfs nfs"
            echo "configuring for file systems hfs and nfs"
        else
            file_system_ufs=1
            file_system_nfs=1
            FILE_SYSTEM="ufs nfs"
            echo "no flock64; configuring for file systems ufs and nfs"
        fi
    fi
    MPI_OFFSET_KIND1="      INTEGER MPI_OFFSET_KIND"
    MPI_OFFSET_KIND2="      PARAMETER (MPI_OFFSET_KIND=8)"
    if test "$CC" != "gcc" ; then
        ROMIO_TCFLAGS="-Ae"
    fi
    if test "$F77" != "g77" ; then
        ROMIO_TFFLAGS="+U77"
    fi
fi
#
if test -n "$arch_alpha" ; then
    CC=${CC:-cc}
    F77=${FC:-f77}
    if test $DEBUG = 1; then
        CFLAGS="$CFLAGS -g -std1 -warnprotos -verbose -DAIO_PRIORITY_DEFAULT"
    else 
        CFLAGS="$CFLAGS -O -DAIO_PRIORITY_DEFAULT"
    fi
    MPI_LIB="$MPI_LIB -laio"
    if test -z "$MPI" ; then
        MPI=mpich
        mpi_mpich=1
    fi
    if test -z "$FILE_SYSTEM" ; then
        file_system_ufs=1
        file_system_nfs=1
        FILE_SYSTEM="ufs nfs"
        echo "configuring for file systems ufs and nfs"
    fi
    CFLAGS="$CFLAGS -DDEC"
    MPI_OFFSET_KIND1="      INTEGER MPI_OFFSET_KIND"
    MPI_OFFSET_KIND2="      PARAMETER (MPI_OFFSET_KIND=8)"
    ROMIO_LIBLIST="-laio"
fi    
#
if test -n "$arch_CRAY" ; then
    CC=${CC:-cc}
    F77=${FC:-f90}
    NOF77=1
    FTESTDEFINE="integer ilen"
    F77GETARG="call pxfgetarg(i, str, ilen, ierr)"
    if test $DEBUG = 1; then
        CFLAGS="$CFLAGS -g -DNO_AIO"
    else 
        CFLAGS="$CFLAGS -O -DNO_AIO"
    fi
    RANLIB=":"
    CFLAGS="$CFLAGS -DCRAY -D_UNICOS"
    if test -z "$MPI" || test -n "$mpi_sgi" ; then
        MPI=cray
        mpi_cray=1
        mpi_sgi=""
# above is to disable configure tests specific to SGI MPI
        CFLAGS="$CFLAGS -DMPISGI -DHAVE_MPI_COMBINERS -DNO_MPI_SGI_type_is_contig"
    fi
#       MPISGI needed because of error in Cray's and SGI's 
#       MPI_Type_get_contents (does not increment reference count).
#       Others needed because MPISGI needed.
    if test -z "$FILE_SYSTEM" ; then
        file_system_ufs=1
        file_system_nfs=1
        FILE_SYSTEM="ufs nfs"
        echo "configuring for file systems ufs and nfs"
    fi
    MPI_OFFSET_KIND1="      INTEGER MPI_OFFSET_KIND"
    MPI_OFFSET_KIND2="      PARAMETER (MPI_OFFSET_KIND=8)"
fi
#
if test -n "$arch_sgi" ; then
    arch_IRIX=1
    ARCH=IRIX
fi
if test -n "$arch_IRIX64" ; then
    arch_IRIX=1
fi
if test -n "$arch_IRIX32" ; then
    arch_IRIX=1
fi
if test -n "$arch_IRIXN32" ; then
    arch_IRIX=1
fi
if test -n "$arch_sgi5" ; then
    arch_IRIX5=1
    ARCH=IRIX
fi
#
PAC_GET_SPECIAL_SYSTEM_INFO
#
# special case 'sgi5' for use on MESHINE which is much like an SGI running
# irix 5 with r4400 chips, but does not have 'hinv', so above code doesn't
# work
if test -n "$arch_sgi5"; then
   osversion=5
   cputype=4400
   IRIXARCH="$ARCH_$osversion"
   IRIXARCH="$IRIXARCH_$cputype"
# now set arch_IRIX to 1
   arch_IRIX=1
   echo "IRIX-specific architecture is $IRIXARCH"
   CFLAGS="$CFLAGS -DIRIX"
fi
#
if test -n "$arch_IRIX"; then
    CC=${CC:-cc}
    F77=${FC:-f77}
    if test $DEBUG = 1; then
        CFLAGS="$CFLAGS -g -fullwarn"
    else 
        CFLAGS="$CFLAGS -O"
    fi
   if test $osversion = 4 ; then
	RANLIB="ar ts"
        if test -n "$mpi_sgi"; then
            echo "Error: SGI's MPI doesn't work with IRIX 4.x"
            exit 1
        fi
   elif test $osversion = 5 ; then
        if test -n "$mpi_sgi"; then
            echo "Error: SGI's MPI doesn't work with IRIX 5.x"
            exit 1
        fi
   elif test $osversion = 6 ; then
	if test -z "$MPI"; then
            if test -f "/usr/include/mpi.h" ; then
                echo "assuming that you want to use ROMIO with SGI's MPI"
                MPI=sgi
                mpi_sgi=1
            else 
                echo "assuming that you want to use ROMIO with MPICH"
                MPI=mpich
                mpi_mpich=1
            fi            
	fi
        RANLIB=":"
        CFLAGS="$CFLAGS -DAIO_SIGNOTIFY_NONE"
	if test $cputype -ge 5000 ; then
            MIPS=4
        else 
            MIPS=3
        fi
   fi
   if test -n "$mpi_sgi" && test -z "$MPI_LIB" ; then
       MPI_LIB="-lmpi"
   fi
#  check if pread64 is defined
   PAC_HAVE_PREAD64
#
   if test -z "$FILE_SYSTEM" ; then
       file_system_nfs=1
       FILE_SYSTEM="nfs"
       AC_MSG_CHECKING(for xfs)
       AC_COMPILE_CHECK(,[
#include <aio.h>],
[aiocb64_t *t1;],file_system_xfs=1;FILE_SYSTEM="xfs $FILE_SYSTEM";)
       if test "$file_system_xfs" = 1 ; then 
          AC_MSG_RESULT(yes)
       else
          AC_MSG_RESULT(no)
          file_system_ufs=1
          FILE_SYSTEM="ufs $FILE_SYSTEM"
       fi
       echo "configuring for file systems $FILE_SYSTEM"
   fi
   CFLAGS="$CFLAGS -DIRIX"
   MPI_OFFSET_KIND1="      INTEGER MPI_OFFSET_KIND"
   MPI_OFFSET_KIND2="      PARAMETER (MPI_OFFSET_KIND=8)"
fi
dnl
dnl
if test $NOF77 = 0 ; then
    echo "checking Fortran external names"
    PAC_GET_FORTNAMES
    if test -n "$WDEF" ; then
        CFLAGS="$CFLAGS $WDEF"
    fi
    rm -f test/mpif.h
    if test "$MPI_INCLUDE_DIR" != "." && test $FROM_MPICH = 0 ; then
        if test ! -d test ; then mkdir test ; fi
        ln -s $MPI_INCLUDE_DIR/mpif.h test
    fi
else 
    F77=":"
fi
#
PAC_INT_LT_POINTER()
#
PAC_LONG_LONG_64()
#
dnl PAC_LONG_64()
#
if test -n "$longlongsize"; then
   if test $FROM_MPICH = 0 ; then
       PAC_MPI_LONG_LONG_INT()
   else
       AC_DEFINE(HAVE_MPI_LONG_LONG_INT)
   fi
fi
#
if test "$FORTRAN_MPI_OFFSET" = "integer*8" && test "A$MPI_OFFSET_KIND2" = "A!" && test $NOF77 = 0 ; then
   PAC_MPI_OFFSET_KIND()
fi
#
if test "$FORTRAN_MPI_OFFSET" = "integer" && test "A$MPI_OFFSET_KIND2" = "A!" && test $NOF77 = 0 ; then
   PAC_MPI_OFFSET_KIND_4BYTE()
fi
#
# check if MPI_Info functions are defined in the MPI implementation
if test $FROM_MPICH = 0 ; then
   PAC_MPI_INFO()
else
   AC_DEFINE(HAVE_MPI_INFO)
   HAVE_MPI_INFO="#define HAVE_MPI_INFO"
   MPI_FINFO1="!"
   MPI_FINFO2="!"
   MPI_FINFO3="!"
   MPI_FINFO4="!"
fi   
#
if test -n "$mpi_sgi"; then
   if test -z "$HAVE_MPI_INFO" ; then
      PAC_CHECK_MPI_SGI_INFO_NULL  # is MPI_INFO_NULL defined in mpi.h?
   fi
   PAC_TEST_MPI_SGI_type_is_contig
   PAC_TEST_MPI_COMBINERS
   PAC_TEST_MPI_HAVE_OFFSET_KIND
fi
#
# check if darray and subarray constructors are defined in the MPI implementation
if test $FROM_MPICH = 0 ; then
   PAC_MPI_DARRAY_SUBARRAY()
else
   AC_DEFINE(HAVE_MPI_DARRAY_SUBARRAY)
   HAVE_MPI_DARRAY_SUBARRAY="#define HAVE_MPI_DARRAY_SUBARRAY"
   MPI_FARRAY1="!"
   MPI_FARRAY2="!"
   MPI_FARRAY3="!"
   MPI_FARRAY4="!"
   MPI_FARRAY5="!"
   MPI_FARRAY6="!"
   MPI_FARRAY7="!"
fi   
#
# Check to see if the compiler accepts prototypes
dnl PAC_CHECK_CC_PROTOTYPES(AC_DEFINE(HAVE_PROTOTYPES))
#
#
# Test for weak symbol support...
# We can't put # in the message because it causes autoconf to generate
# incorrect code
HAVE_WEAK_SYMBOLS=0
if test -n "$arch_hpux" || test -n "$arch_sppux" ; then
# multiple secondary definitions not allowed by HP compilers
# Fortran interface for HP already uses one secondary defn. 
# therefore, do not use this method for profiling interface.
# build profiling interface explicitly.
   TRY_WEAK_SYMBOLS=0
fi
if test $TRY_WEAK_SYMBOLS = 1 ; then
  AC_MSG_CHECKING(for weak symbol support)
  AC_TRY_LINK([
#pragma weak PFoo = Foo
int Foo(a) { return a; }
],[return PFoo(1);],has_pragma_weak=1)
  if test "$has_pragma_weak" = 1 ; then
    AC_MSG_RESULT([pragma weak])
    HAVE_WEAK_SYMBOLS=1
    AC_DEFINE(HAVE_WEAK_SYMBOLS)
    AC_DEFINE(HAVE_PRAGMA_WEAK)
  else
    AC_TRY_LINK([
#pragma _HP_SECONDARY_DEF Foo PFoo
int Foo(a) { return a; }
],[return PFoo(1);],has_pragma_hp_secondary=1)
    if test "$has_pragma_hp_secondary" = 1 ; then 
        AC_MSG_RESULT([pragma _HP_SECONDARY_DEF])
        HAVE_WEAK_SYMBOLS=1
        AC_DEFINE(HAVE_WEAK_SYMBOLS)
        AC_DEFINE(HAVE_PRAGMA_HP_SEC_DEF)
    else
        AC_TRY_LINK([
#pragma _CRI duplicate PFoo as Foo
int Foo(a) { return a; }
],[return PFoo(1);],has_pragma_cri_duplicate=1)
        if test "$has_pragma_cri_duplicate" = 1 ; then
	    AC_MSG_RESULT([pragma _CRI duplicate x as y])
	    HAVE_WEAK_SYMBOLS=1
	    AC_DEFINE(HAVE_WEAK_SYMBOLS)
	    AC_DEFINE(HAVE_PRAGMA_CRI_DUP)
        else    
            AC_MSG_RESULT(no)
        fi
    fi
  fi
fi
AC_SUBST(HAVE_WEAK_SYMBOLS)
#
# if FILE_SYSTEM is not set above, use ufs and nfs as default
#
if test -z "$FILE_SYSTEM" ; then
    file_system_ufs=1
    file_system_nfs=1
    FILE_SYSTEM="ufs nfs"
    echo "configuring for file systems ufs and nfs"
fi
#
if test -n "$file_system_nfs"; then
    CFLAGS="$CFLAGS -DNFS"
fi
if test -n "$file_system_ufs"; then
    CFLAGS="$CFLAGS -DUFS"
fi
if test -n "$file_system_hfs"; then
    CFLAGS="$CFLAGS -DHFS"
fi
if test -n "$file_system_sfs"; then
    CFLAGS="$CFLAGS -DSFS"
fi
if test -n "$file_system_xfs"; then
    CFLAGS="$CFLAGS -DXFS"
    PAC_GET_XFS_MEMALIGN
fi
if test -n "$file_system_pvfs"; then
    CFLAGS="$CFLAGS -DPVFS"
fi
if test -n "$file_system_pfs"; then
    CFLAGS="$CFLAGS -DPFS"
fi
if test -n "$file_system_piofs"; then
    CFLAGS="$CFLAGS -DPIOFS"
    USER_CFLAGS="$USER_CFLAGS -bI:/usr/include/piofs/piofs.exp"
    ROMIO_LFLAGS="$USER_FFLAGS -bI:/usr/include/piofs/piofs.exp"
    USER_FFLAGS="$USER_FFLAGS -bI:/usr/include/piofs/piofs.exp"
fi
if test -n "$mpi_mpich"; then
   CFLAGS="$CFLAGS -DNEEDS_MPI_TEST -DMPICH"
   if test -z "$arch_SX4" ; then
      MPIOF_H_INCLUDED=1
   fi
fi
if test -n "$mpi_sgi"; then
   CFLAGS="$CFLAGS -DMPISGI"
fi
if test -n "$mpi_lam"; then
   CFLAGS="$CFLAGS -DMPILAM"
fi
if test -n "$mpi_hp"; then
   CFLAGS="$CFLAGS -DMPIHP"
   if test "$NOF77" = 0; then
      PAC_CHECK_MPIOF_H
   fi
fi
#
PAC_FUNC_STRERROR
#
# Find the home directory if not specified
if test "X$srcdir" != "X." -a -s $srcdir/mpi-io/Makefile.in ; then 
    ROMIO_HOME_TRIAL=$srcdir
else
    PAC_GETWD(ROMIO_HOME_TRIAL,mpi-io/Makefile.in)
fi
echo "ROMIO home directory is $ROMIO_HOME_TRIAL"
ROMIO_HOME=$ROMIO_HOME_TRIAL
if test -z "$srcdir" -o "$srcdir" = "." ; then srcdir="$ROMIO_HOME" ; fi
AC_SUBST(srcdir)
if test -z "$LIBNAME"; then
LIBNAME="$ROMIO_HOME/lib/$ARCH/libmpio.a"
fi
#
if test ! -d $ROMIO_HOME/lib ; then 
   mkdir $ROMIO_HOME/lib
fi
if test ! -d $ROMIO_HOME/lib/$ARCH ; then 
   mkdir $ROMIO_HOME/lib/$ARCH
fi
#
if test $NOF77 = 1 ; then
   F77=":"
else
   FORTRAN_TEST="fperf fcoll_test fmisc pfcoll_test" 
fi
#
if test $FROM_MPICH = 0 ; then
   PAC_TEST_MPI
   PAC_NEEDS_FINT
else
   NEEDS_MPI_FINT=""
fi
#
if test "$MPI_INCLUDE_DIR" = "." ; then
   ROMIO_INCLUDE="-I../include"
else 
   ROMIO_INCLUDE="-I../include -I$MPI_INCLUDE_DIR"
fi
#
TEST_LIBNAME=$LIBNAME
MPIRUN=mpirun
#
# if MPICH, use mpicc in test programs
#
if test $FROM_MPICH = 1 ; then
   MPICH_HOME=`dirname $ROMIO_HOME`
   if test -z "$MPI_BIN_DIR" ; then MPI_BIN_DIR=$MPICH_HOME/bin ; fi
   TEST_CC=$MPI_BIN_DIR/mpicc
   MPI_LIB=""
   ROMIO_INCLUDE=""
   USER_CFLAGS=""
   USER_FFLAGS=""
   TEST_LIBNAME=""
   MPIRUN=$MPI_BIN_DIR/mpirun
   if test -n "$arch_SX4" || test -n "$arch_hpux" ; then
      TEST_F77=$MPI_BIN_DIR/mpif90
   else
      TEST_F77=$MPI_BIN_DIR/mpif77
   fi
   CC=$MPI_BIN_DIR/mpicc
   CFLAGS="$CFLAGS -DHAVE_STATUS_SET_BYTES"
fi
#
if test $MPI != "mpich" ; then
   CFLAGS="$CFLAGS -DPRINT_ERR_MSG"
fi
#
if test -z "$TEST_CC" ; then
   TEST_CC="$CC"
fi
if test -z "$TEST_F77" ; then
   TEST_F77="$F77"
fi
#
CFLAGS="$CFLAGS $DEFS"
#
echo "setting CC to $CC"
echo "setting F77 to $F77"
echo "setting TEST_CC to $TEST_CC"
echo "setting TEST_F77 to $TEST_F77"
echo "setting CFLAGS to $CFLAGS"
echo "setting USER_CFLAGS to $USER_CFLAGS"
echo "setting USER_FFLAGS to $USER_FFLAGS"
#
AC_SUBST(ARCH)
AC_SUBST(FILE_SYSTEM)
AC_SUBST(CC)
AC_SUBST(CFLAGS)
AC_SUBST(USER_CFLAGS)
AC_SUBST(USER_FFLAGS)
AC_SUBST(MIPS)
AC_SUBST(BITS)
AC_SUBST(MPI)
AC_SUBST(AR)
AC_SUBST(RANLIB)
AC_SUBST(MPI_INCLUDE_DIR)
AC_SUBST(MPI_LIB)
AC_SUBST(F77)
AC_SUBST(NOF77)
AC_SUBST(NOPROFILE)
AC_SUBST(MAKE)
AC_SUBST(PREFIX)
AC_SUBST(arch_IRIX)
AC_SUBST(ROMIO_HOME)
AC_SUBST(LIBNAME)
AC_SUBST(TEST_LIBNAME)
AC_SUBST(LL)
AC_SUBST(F77GETARG)
AC_SUBST(F77IARGC)
AC_SUBST(FTESTDEFINE)
AC_SUBST(FORTRAN_MPI_OFFSET)
AC_SUBST(FROM_MPICH)
AC_SUBST(NEEDS_MPI_FINT)
AC_SUBST(HAVE_MPI_INFO)
AC_SUBST(BUILD_MPI_INFO)
AC_SUBST(HAVE_MPI_DARRAY_SUBARRAY)
AC_SUBST(BUILD_MPI_ARRAY)
AC_SUBST(DEFINE_MPI_OFFSET)
AC_SUBST(MPI_FINFO1)
AC_SUBST(MPI_FINFO2)
AC_SUBST(MPI_FINFO3)
AC_SUBST(MPI_FINFO4)
AC_SUBST(MPI_FARRAY1)
AC_SUBST(MPI_FARRAY2)
AC_SUBST(MPI_FARRAY3)
AC_SUBST(MPI_FARRAY4)
AC_SUBST(MPI_FARRAY5)
AC_SUBST(MPI_FARRAY6)
AC_SUBST(MPI_FARRAY7)
AC_SUBST(MPI_OFFSET_KIND1)
AC_SUBST(MPI_OFFSET_KIND2)
AC_SUBST(TEST_CC)
AC_SUBST(TEST_F77)
AC_SUBST(ROMIO_INCLUDE)
AC_SUBST(ROMIO_LFLAGS)
AC_SUBST(ROMIO_LIBLIST)
AC_SUBST(ROMIO_TCFLAGS)
AC_SUBST(ROMIO_TCPPFLAGS)
AC_SUBST(ROMIO_TFFLAGS)
AC_SUBST(MPIRUN)
AC_SUBST(FORTRAN_TEST)
if test ! -d adio ; then mkdir adio ; fi
if test ! -d mpi2-other ; then mkdir mpi2-other ; fi
AC_OUTPUT(Makefile mpi-io/Makefile mpi2-other/info/Makefile mpi2-other/array/Makefile adio/common/Makefile test/Makefile test/misc.c test/large_file.c test/runtests util/romioinstall include/mpio.h include/mpiof.h)
if test "$NOF77" = 0; then
    CONFIG_FILES="$CONFIG_FILES mpi-io/fortran/Makefile mpi2-other/info/fortran/Makefile mpi2-other/array/fortran/Makefile test/fmisc.f test/fcoll_test.f test/pfcoll_test.f test/fperf.f"
fi
if test -n "$file_system_nfs"; then
    CONFIG_FILES="$CONFIG_FILES adio/ad_nfs/Makefile"
fi
if test -n "$file_system_ufs"; then
    CONFIG_FILES="$CONFIG_FILES adio/ad_ufs/Makefile"
fi
if test -n "$file_system_xfs"; then
    CONFIG_FILES="$CONFIG_FILES adio/ad_xfs/Makefile"
fi
if test -n "$file_system_hfs"; then
    CONFIG_FILES="$CONFIG_FILES adio/ad_hfs/Makefile"
fi
if test -n "$file_system_sfs"; then
    CONFIG_FILES="$CONFIG_FILES adio/ad_sfs/Makefile"
fi
if test -n "$file_system_pfs"; then
    CONFIG_FILES="$CONFIG_FILES adio/ad_pfs/Makefile"
fi
if test -n "$file_system_pvfs"; then
    CONFIG_FILES="$CONFIG_FILES adio/ad_pvfs/Makefile"
fi
if test -n "$file_system_piofs"; then
    CONFIG_FILES="$CONFIG_FILES adio/ad_piofs/Makefile"
fi
export CONFIG_FILES
./config.status
CONFIG_FILES=""
# delete the first line created by configure in some files
sed 1d util/romioinstall > util/tmp
mv util/tmp util/romioinstall
chmod 755 util/romioinstall
if test "$NOF77" = 0; then
   sed 1d test/fcoll_test.f > test/tmp
   mv test/tmp test/fcoll_test.f
   if test "$MPIOF_H_INCLUDED" = 1; then
      sed 5d test/fcoll_test.f > test/tmp
      mv test/tmp test/fcoll_test.f
   fi
   sed 1d test/pfcoll_test.f > test/tmp
   mv test/tmp test/pfcoll_test.f
   if test "$MPIOF_H_INCLUDED" = 1; then
      sed 5d test/pfcoll_test.f > test/tmp
      mv test/tmp test/pfcoll_test.f
   fi
   sed 1d test/fperf.f > test/tmp
   mv test/tmp test/fperf.f
   if test "$MPIOF_H_INCLUDED" = 1; then
      sed 5d test/fperf.f > test/tmp
      mv test/tmp test/fperf.f
   fi
   sed 1d test/fmisc.f > test/tmp
   mv test/tmp test/fmisc.f
   if test "$MPIOF_H_INCLUDED" = 1; then
      sed 5d test/fmisc.f > test/tmp
      mv test/tmp test/fmisc.f
   fi
fi
sed 1d test/misc.c > test/tmp
mv test/tmp test/misc.c
sed 1d test/large_file.c > test/tmp
mv test/tmp test/large_file.c
sed 1d include/mpio.h > include/tmp
mv include/tmp include/mpio.h
sed 1d include/mpiof.h > include/tmp
mv include/tmp include/mpiof.h
sed 1d test/runtests > test/tmp
mv test/tmp test/runtests
#
chmod 755 test/runtests
#
rm -f *.o
if test "$ROMIO_NO_BANNER" != "yes" -a "$FROM_MPICH" = 0 ; then
print_error " "
print_error Please register your copy of ROMIO with us by sending email
print_error to majordomo@mcs.anl.gov with the message
print_error subscribe romio-users
print_error This will enable us to notify you of new releases of ROMIO
print_error as well as bug fixes.
print_error " "
fi
if test $FROM_MPICH = 0 ; then
   print_error Configure done. Now type make
   print_error " "
fi
exit 0
