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

# Usage: configure [--srcdir=DIR] [--host=HOST] [--gas] [--nfp] [--no-create]
#        [--prefix=PREFIX] [--exec-prefix=PREFIX] [--with-PACKAGE] [TARGET]
# Ignores all args except --srcdir, --prefix, --exec-prefix, --no-create, and
# --with-PACKAGE unless this script has special code to handle it.


for arg
do
  # Handle --exec-prefix with a space before the argument.
  if test x$next_exec_prefix = xyes; then exec_prefix=$arg; next_exec_prefix=
  # Handle --host with a space before the argument.
  elif test x$next_host = xyes; then next_host=
  # Handle --prefix with a space before the argument.
  elif test x$next_prefix = xyes; then prefix=$arg; next_prefix=
  # Handle --srcdir with a space before the argument.
  elif test x$next_srcdir = xyes; then srcdir=$arg; next_srcdir=
  else
    case $arg in
     # For backward compatibility, also recognize exact --exec_prefix.
     -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* | --exec=* | --exe=* | --ex=* | --e=*)
	exec_prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
     -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- | --exec | --exe | --ex | --e)
	next_exec_prefix=yes ;;

     -gas | --gas | --ga | --g) ;;

     -host=* | --host=* | --hos=* | --ho=* | --h=*) ;;
     -host | --host | --hos | --ho | --h)
	next_host=yes ;;

     -nfp | --nfp | --nf) ;;

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

     -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
	prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
     -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
	next_prefix=yes ;;

     -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=* | --s=*)
	srcdir=`echo $arg | sed 's/[-a-z_]*=//'` ;;
     -srcdir | --srcdir | --srcdi | --srcd | --src | --sr | --s)
	next_srcdir=yes ;;

     -with-* | --with-*)
       package=`echo $arg|sed 's/-*with-//'`
       # Delete all the valid chars; see if any are left.
       if test -n "`echo $package|sed 's/[-a-zA-Z0-9_]*//g'`"; then
         echo "configure: $package: invalid package name" >&2; exit 1
       fi
       eval "with_`echo $package|sed s/-/_/g`=1" ;;

     *) ;;
    esac
  fi
done

trap 'rm -f conftest* core; exit 1' 1 3 15

rm -f conftest*
compile='${CC-cc} $DEFS conftest.c -o conftest $LIBS >/dev/null 2>&1'

# 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.
unique_file=nctest

# Find the source files, if location was not specified.
if test -z "$srcdir"; then
  srcdirdefaulted=yes
  # Try the directory containing this script, then `..'.
  prog=$0
  confdir=`echo $prog|sed 's%/[^/][^/]*$%%'`
  test "X$confdir" = "X$prog" && confdir=.
  srcdir=$confdir
  if test ! -r $srcdir/$unique_file; then
    srcdir=..
  fi
fi
if test ! -r $srcdir/$unique_file; then
  if test x$srcdirdefaulted = xyes; then
    echo "configure: Can not find sources in \`${confdir}' or \`..'." 1>&2
  else
    echo "configure: Can not find sources in \`${srcdir}'." 1>&2
  fi
  exit 1
fi
# Preserve a srcdir of `.' to avoid automounter screwups with pwd.
# But we can't avoid them for `..', to make subdirectories work.
case $srcdir in
  .|/*|~*) ;;
  *) srcdir=`cd $srcdir; pwd` ;; # Make relative path absolute.
esac
 if [ -r CUSTOMIZE ]; then
  echo reading configuration customizations
  . ./CUSTOMIZE
fi
 TRANSFORMEES='port/Makefile port/master.mk'
POST_PROCESSEES='port/Makefile'
CPPFLAGS=${CPPFLAGS-"-DNDEBUG"}

 CFLAGS=${CFLAGS-"-O"}

 
if test -z "$OS"; then
echo checking for type of operating system
cat << \CAT_EOF > conftest.c
#ifdef __osf__
OS_osf
#endif
#ifdef _AIX
OS_aix
#endif
#ifdef __DGUX__
OS_dgux
#endif
#ifdef hpux
OS_hpux
#endif
#ifdef NeXT
OS_nextos
#endif
#ifdef sgi
OS_irix
#endif
#ifdef sun
OS_sunos
#endif
#ifdef __FreeBSD__
OS_freebsd
#endif
#ifdef ultrix
OS_ultrix
#endif
#ifdef _UNICOS
OS_unicos
#endif
#ifdef __convex__
OS_convex
#endif
#ifdef masscomp
OS_rtu
#endif
CAT_EOF
OS=`cc -E conftest.c | sed -n '/^OS_/ {
  s///p
  q
}'`
rm conftest.c
if test -z "$OS"; then
  echo "OS:operating system:sunos" >> conf.missing
fi
fi
 case "${OS}" in
  aix*)    for arg in -D_ALL_SOURCE; do
    case "$CPPFLAGS" in
      *$arg*) ;;
      *)      CPPFLAGS="${CPPFLAGS-} $arg";;
    esac
  done
;;
  hpux*)   for arg in -D_HPUX_SOURCE; do
    case "$CPPFLAGS" in
      *$arg*) ;;
      *)      CPPFLAGS="${CPPFLAGS-} $arg";;
    esac
  done
;;
esac
LIBOBJS=${LIBOBJS-""}

 PORT_HEADERS=${PORT_HEADERS-""}

 PORT_MANIFEST=${PORT_MANIFEST-""}


PORT_SUBDIRS=${PORT_SUBDIRS-""}



if test -z "$CC"; then
  echo checking for cc
  saveifs="$IFS"; IFS="${IFS}:"
  for dir in $PATH; do
    test -z "$dir" && dir=.
    if test -f $dir/cc; then
      CC="cc"
      break
    fi
  done
  IFS="$saveifs"
fi
test -z "$CC" && CC=""
if test -z "$CC"; then
  echo "CC:C compiler:/bin/cc" >> conf.missing
fi
# Find out if we are using GNU C, under whatever name.
cat <<EOF > conftest.c
#ifdef __GNUC__
  yes
#endif
EOF
${CC-cc} -E conftest.c > conftest.out 2>&1
if egrep yes conftest.out >/dev/null 2>&1; then
  GCC=1 # For later tests.
  CC="$CC -O"
fi
rm -f conftest*
 if test -z "$AR"; then
  echo checking for ar
  saveifs="$IFS"; IFS="${IFS}:"
  for dir in $PATH; do
    test -z "$dir" && dir=.
    if test -f $dir/ar; then
      AR="ar"
      break
    fi
  done
  IFS="$saveifs"
fi
test -z "$AR" && AR=""
if test -z "$AR"; then
  echo "AR:library utility:/bin/ar" >> conf.missing
fi
 if test -z "$RANLIB"; then
  echo checking for ranlib
  saveifs="$IFS"; IFS="${IFS}:"
  for dir in $PATH; do
    test -z "$dir" && dir=.
    if test -f $dir/ranlib; then
      RANLIB="ranlib"
      break
    fi
  done
  IFS="$saveifs"
fi
test -z "$RANLIB" && RANLIB="@:"
  

echo checking for fill value usage
if test "${OLD_FILLVALUES-}" = yes; then
    OLD_FILLVALUES=1
    DEFS="$DEFS -DOLD_FILLVALUES=1"
else
    OLD_FILLVALUES=0
fi
  for arg in libsrc/netcdf.h; do
    case "$TRANSFORMEES" in
      *$arg*) ;;
      *)      TRANSFORMEES="${TRANSFORMEES-} $arg";;
    esac
  done


CFLAGS=${CFLAGS-"-O"}


CPPFLAGS=${CPPFLAGS-"-DNDEBUG"}


  for arg in -DHDF; do
    case "$CPPFLAGS" in
      *$arg*) ;;
      *)      CPPFLAGS="${CPPFLAGS-} $arg";;
    esac
  done

HDF_INC=${HDF_INC-"-I/hdf/home/chouck/hdf/33/include"}


HDF_LIB=${HDF_LIB-"/hdf/home/chouck/hdf/33/lib/libdf.a"}

JPEG_LIB=${JPEG_LIB-"/hdf/home/chouck/hdf/33/jpeg/libjpeg.a"}


FFLAGS=${FFLAGS-""}


LEX=${LEX-"lex"}


YACC=${YACC-"yacc"}


XDRFILE=${XDRFILE-"xdrposix"}


echo setting the installation prefix
prefix=`case "${prefix-..}" in 
  /*) echo ${prefix-..}; exit;;
   *) echo '/usr/local';
#
# Made the default prefix '/usr/local/' - GV
#   *) path=\`pwd\`/${prefix-..}
#        tail=
#        while test -n "$path"; do
#          (cd $path && echo \`pwd\`$rest) 2> /dev/null && exit
#          base=/\`basename "$path"\`
#          tail=/$base$tail
#          path=\`echo "$path" | sed "s/\/$base//"\`
#        done;;
esac
`
test -z "$exec_prefix" && exec_prefix=$prefix/bin




if test -z "$MACHINE"; then
echo checking for type of machine
MACHINE=`uname -m | tr A-Z a-z`
if test -z "$MACHINE"; then
  echo "MACHINE:machine hardware type:sun4c" >> conf.missing
fi
fi


  for arg in which; do
    case "$PORT_MANIFEST" in
      *$arg*) ;;
      *)      PORT_MANIFEST="${PORT_MANIFEST-} $arg";;
    esac
  done
if test -z "$WHICH"; then
  echo checking for which
  saveifs="$IFS"; IFS="${IFS}:"
  for dir in $PATH; do
    test -z "$dir" && dir=.
    if test -f $dir/which; then
      WHICH="which"
      break
    fi
  done
  IFS="$saveifs"
fi
test -z "$WHICH" && WHICH="`case "port" in 
  /*) echo port; exit;;
   *) path=\`pwd\`/port
        tail=
        while test -n "$path"; do
          (cd $path && echo \`pwd\`$rest) 2> /dev/null && exit
          base=/\`basename "$path"\`
          tail=/$base$tail
          path=\`echo "$path" | sed "s/\/$base//"\`
        done;;
esac
`/which"

if test "$OS" = ultrix && test "$MACHINE" = vax \
    && test `$WHICH "$CC"` = /bin/cc; then
  echo "changing C compiler to \`vcc' because \`cc' floating-point is broken"
  CC=vcc
fi

echo checking how to run the C preprocessor
if test -z "$CPP"; then
  CPP='${CC-cc} -E'
  cat > conftest.c <<EOF
#include <stdio.h>
EOF
err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
if test -z "$err"; then
  :
else
  CPP=/lib/cpp
fi
rm -f conftest*
fi
CPP=`eval echo $CPP`
echo "#include <stdlib.h>" > conftest.c
if test `$CPP conftest.c 2> /dev/null | wc -l` = 0; then
  if test "$CPP" = cpp; then
    echo 1>&2 "$0: C preprocessor, \`$CPP', doesn't work"
    echo "CPP:C preprocessor:/lib/cpp" >> conf.missing
  else
    echo 1>&2 "$0: C preprocessor, \`$CPP', doesn't work; setting to \`cpp'"
    CPP=cpp
    if test `${WHICH} ${CPP} 2>&1 | wc -w` != 1; then
      echo 1>&2 "$0: C preprocessor, \`$CPP', doesn't work; setting to \`cpp'"
      CPP=/usr/ccs/lib/cpp
      if test `${WHICH} ${CPP} 2>&1 | wc -w` != 1; then
        echo 1>&2 "$0: C preprocessor, \`$CPP', doesn't exist"
        echo "CPP:C preprocessor:/lib/cpp" >> conf.missing
      fi
    fi
  fi
fi
rm -f conftest.c

 case "$OS" in
  hpux*) for p in fort77 fortc f77
do
if test -z "$FC"; then
  echo checking for $p
  saveifs="$IFS"; IFS="${IFS}:"
  for dir in $PATH; do
    test -z "$dir" && dir=.
    if test -f $dir/$p; then
      FC="$p"
      break
    fi
  done
  IFS="$saveifs"
fi
test -z "$FC" && FC=""

test -n "$FC" && break
done
;;
  dgux*) for p in ghf77 f77
do
if test -z "$FC"; then
  echo checking for $p
  saveifs="$IFS"; IFS="${IFS}:"
  for dir in $PATH; do
    test -z "$dir" && dir=.
    if test -f $dir/$p; then
      FC="$p"
      break
    fi
  done
  IFS="$saveifs"
fi
test -z "$FC" && FC=""

test -n "$FC" && break
done
;;
  convex*) for p in f77 fc
do
if test -z "$FC"; then
  echo checking for $p
  saveifs="$IFS"; IFS="${IFS}:"
  for dir in $PATH; do
    test -z "$dir" && dir=.
    if test -f $dir/$p; then
      FC="$p"
      break
    fi
  done
  IFS="$saveifs"
fi
test -z "$FC" && FC=""

test -n "$FC" && break
done
;;
  *)     for p in f77 cf77 #fc
do
if test -z "$FC"; then
  echo checking for $p
  saveifs="$IFS"; IFS="${IFS}:"
  for dir in $PATH; do
    test -z "$dir" && dir=.
    if test -f $dir/$p; then
      FC="$p"
      break
    fi
  done
  IFS="$saveifs"
fi
test -z "$FC" && FC=""

test -n "$FC" && break
done
;;
esac
if test -z "$FC"; then
    for arg in NONE; do
    case "$FC" in
      *$arg*) ;;
      *)      FC="${FC-} $arg";;
    esac
  done

  echo "Was unable to find a Fortran compiler on this machine."
fi

if test -z "$NEQN"; then
  echo checking for neqn
  saveifs="$IFS"; IFS="${IFS}:"
  for dir in $PATH; do
    test -z "$dir" && dir=.
    if test -f $dir/neqn; then
      NEQN="neqn"
      break
    fi
  done
  IFS="$saveifs"
fi
test -z "$NEQN" && NEQN="cat"
test "$NEQN" = cat && 
  echo 1>&2 "$0: Can't find program \`neqn'; setting to \`cat'"

if test -z "$TBL"; then
  echo checking for tbl
  saveifs="$IFS"; IFS="${IFS}:"
  for dir in $PATH; do
    test -z "$dir" && dir=.
    if test -f $dir/tbl; then
      TBL="tbl"
      break
    fi
  done
  IFS="$saveifs"
fi
test -z "$TBL" && TBL="cat"
test "$TBL" = cat && 
  echo 1>&2 "$0: Can't find program \`tbl'; setting to \`cat'"

# Make sure to not get the incompatible SysV /etc/install and
# /usr/sbin/install, which might be in PATH before a BSD-like install,
# or the SunOS /usr/etc/install directory, or the AIX /bin/install,
# or the AFS install, which mishandles nonexistent args.  (Sigh.)
if test -z "$INSTALL"; then
  echo checking for install
  saveifs="$IFS"; IFS="${IFS}:"
  for dir in $PATH; do
    test -z "$dir" && dir=.
    case $dir in
    /etc|/usr/sbin|/usr/etc|/usr/afsws/bin) ;;
    *)
      if test -f $dir/install; then
	if grep dspmsg $dir/install >/dev/null 2>&1; then
	  : # AIX
	else
	  INSTALL="$dir/install -c"
	  INSTALL_PROGRAM='$(INSTALL)'
	  INSTALL_DATA='$(INSTALL) -m 644'
	  break
	fi
      fi
      ;;
    esac
  done
  IFS="$saveifs"
fi
INSTALL=${INSTALL-cp}
INSTALL_PROGRAM=${INSTALL_PROGRAM-'$(INSTALL)'}
INSTALL_DATA=${INSTALL_DATA-'$(INSTALL)'}
INSTALL_DATA="`echo "${INSTALL_DATA}" | sed 's/644/664/'`"

if test -z "$AR"; then
  echo checking for ar
  saveifs="$IFS"; IFS="${IFS}:"
  for dir in $PATH; do
    test -z "$dir" && dir=.
    if test -f $dir/ar; then
      AR="ar"
      break
    fi
  done
  IFS="$saveifs"
fi
test -z "$AR" && AR=""
if test -z "$AR"; then
  echo "AR:library utility:/bin/ar" >> conf.missing
fi

if test -z "$MAKEINFO"; then
  echo checking for makeinfo
  saveifs="$IFS"; IFS="${IFS}:"
  for dir in $PATH; do
    test -z "$dir" && dir=.
    if test -f $dir/makeinfo; then
      MAKEINFO="makeinfo"
      break
    fi
  done
  IFS="$saveifs"
fi
test -z "$MAKEINFO" && MAKEINFO=""


echo checking endianess
SWAP=
cat > conftest.c <<EOF
main() {
    long i = 0;
    char *ip = (char*)&i;
    *ip       = 'a';
    exit(i != 'a'); /* false if little endian or sizeof(long) == sizeof(char) */
}
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  SWAP=-DSWAP
fi
rm -f conftest*
if test "$OS" = unicos; then
NETLONG=
else
echo checking type of netlong
cat > conftest.c <<EOF
main() {exit(sizeof(long) == 4);}
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  NETLONG='-DNETLONG=int'
else
  NETLONG=
fi
rm -f conftest*
fi

echo checking for XDR header-file
  if test -z "$CPP_XDR"; then
    for dir in /usr/include/rpc /usr/local/include/rpc \
    $prefix/include `case "xdr" in 
  /*) echo xdr; exit;;
   *) path=\`pwd\`/xdr
        tail=
        while test -n "$path"; do
          (cd $path && echo \`pwd\`$rest) 2> /dev/null && exit
          base=/\`basename "$path"\`
          tail=/$base$tail
          path=\`echo "$path" | sed "s/\/$base//"\`
        done;;
esac
`; do
      if test -r $dir/xdr.h; then
        CPP_XDR=$dir
        break;
      fi
    done
    if test -z "$CPP_XDR"; then
      echo "CPP_XDR:XDR include-directory:-I/usr/include/rpc" >> conf.missing
    fi
  fi
if test -n "${CPP_XDR-}"; then
  CPP_XDR=-I${CPP_XDR}
fi

echo checking XDR library
case "${OS}" in
  irix*)	LD_XDR=
#                 for arg in -DIRIS4; do
#   case "$HDF_INC" in
#     *$arg*) ;;
#     *)      HDF_INC="${HDF_INC-} $arg";;
#   esac
# done

#                 for arg in -cckr; do
#   case "$HDF_INC" in
#     *$arg*) ;;
#     *)      HDF_INC="${HDF_INC-} $arg";;
#   esac
# done
;;
  ultrix*)	LD_XDR=
#                 for arg in -DMIPSEL; do
#   case "$HDF_INC" in
#     *$arg*) ;;
#     *)      HDF_INC="${HDF_INC-} $arg";;
#   esac
# done
;;
  unicos*)	LD_XDR=
		  for arg in -DBIG_SHORTS -DBIG_LONGS; do
    case "$CPPFLAGS" in
      *$arg*) ;;
      *)      CPPFLAGS="${CPPFLAGS-} $arg";;
    esac
  done

#                 for arg in -DUNICOS; do
#   case "$HDF_INC" in
#     *$arg*) ;;
#     *)      HDF_INC="${HDF_INC-} $arg";;
#   esac
# done
;;
  aix*)           
#                   for arg in -DIBM6000; do
#   case "$HDF_INC" in
#     *$arg*) ;;
#     *)      HDF_INC="${HDF_INC-} $arg";;
#   esac
# done

                LD_XDR=;;
  sunos*)         
#                   for arg in -DSUN; do
#   case "$HDF_INC" in
#     *$arg*) ;;
#     *)      HDF_INC="${HDF_INC-} $arg";;
#   esac
# done

                LD_XDR=;;
  freebsd*)         
#                   for arg in -DUNIX386; do
#   case "$HDF_INC" in
#     *$arg*) ;;
#     *)      HDF_INC="${HDF_INC-} $arg";;
#   esac
# done

                # QAK: If FreeBSD has float support (xdr_float & xdr_double)
                # in it's libc.a someday, change the following line to LD_XDR=;;
                LD_XDR=../xdr/xdrfloat.o;;
  hpux*)          
#               for arg in -DHP9000; do
#   case "$HDF_INC" in
#     *$arg*) ;;
#     *)      HDF_INC="${HDF_INC-} $arg";;
#   esac
# done

                if test -z "$GCC"; then
                          for arg in -Aa; do
    case "$CPPFLAGS" in
      *$arg*) ;;
      *)      CPPFLAGS="${CPPFLAGS-} $arg";;
    esac
  done

                fi
                LD_XDR=;;
  osf*)           
#               for arg in -DDEC_ALPHA; do
#   case "$HDF_INC" in
#     *$arg*) ;;
#     *)      HDF_INC="${HDF_INC-} $arg";;
#   esac
# done

		  for arg in -DBIG_LONGS; do
    case "$CPPFLAGS" in
      *$arg*) ;;
      *)      CPPFLAGS="${CPPFLAGS-} $arg";;
    esac
  done

		  for arg in -std1; do
    case "$CPPFLAGS" in
      *$arg*) ;;
      *)      CPPFLAGS="${CPPFLAGS-} $arg";;
    esac
  done

                LD_XDR=;;
  convex*)        
#               for arg in -DCONVEX; do
#   case "$HDF_INC" in
#     *$arg*) ;;
#     *)      HDF_INC="${HDF_INC-} $arg";;
#   esac
# done

                LD_XDR=;;
  *)		LD_XDR=;;
esac
  for arg in ${CPP_XDR-}; do
    case "$DEFS" in
      *$arg*) ;;
      *)      DEFS="${DEFS-} $arg";;
    esac
  done
  for arg in ${CPPFLAGS-}; do
    case "$DEFS" in
      *$arg*) ;;
      *)      DEFS="${DEFS-} $arg";;
    esac
  done
  for arg in ${LD_XDR-}; do
    case "$LIBS" in
      *$arg*) ;;
      *)      LIBS="${LIBS-} $arg";;
    esac
  done
cat > conftest.c <<EOF

#undef NDEBUG

#ifdef _AIX
#   ifndef _ALL_SOURCE
#     define _ALL_SOURCE
#   endif
#endif

#include <assert.h>
#include <stdio.h>
#include <types.h>
#include <xdr.h>

#define TESTFILE	"conftest.xdr"
#define EPSILON		.0005
#ifndef FLT_MIN
#   define    FLT_MIN 1e-37           /* Standard C maximum */
#endif
#ifndef FLT_EPSILON
#   define FLT_EPSILON        1e-5            /* Standard C maximum */
#endif

main(ac,av)
    int			ac ;
    char		*av[] ;
{
    int			ii, jj	= 0 ;
    char		*fname	= ac > 1 ? av[1] : TESTFILE;
    FILE		*F	= fopen(fname,"w");
    XDR			xdrs[1] ;
    unsigned int	count ;
    unsigned int	szof ;

    /*
     * The last value below should be a subnormal number on a DECstation,
     * RS6000, and SPARCstation.  Hopefully, it will catch bad xdr(3)
     * implementations (such as a VAXstation's) which don't correctly handle
     * such values.  Such a value should be the last one in the list.
     */
    static float	floats[]	= { 100.125, 100.25, 100.375, 
					    100.5, 100.625, FLT_MIN/32 } ;
    float *fp , got_af[sizeof(floats)/sizeof(floats[0])] ;

/* create */

    if( F == NULL)
    {
	    perror("fopen failed") ;
	    exit(-1) ;
    }
    xdrstdio_create(xdrs, F, XDR_ENCODE) ;

/* populate */

    szof = sizeof(float) ;
    count = sizeof(floats)/sizeof(float) ;
    assert( xdr_vector(xdrs, (char *)floats, count, szof, xdr_float)) ;

/* flush, rewind  and reopen */

    assert(fflush((FILE *)xdrs->x_private) != EOF) ; /* xdr_destroy(xdrs) */

    assert(fclose(F) != EOF) ;
    F = fopen(fname,"r") ;
    if( F == NULL)
    {
	    perror("fopen failed") ;
	    exit(-1) ;
    }
    xdrstdio_create(xdrs, F, XDR_DECODE) ;

/* check */

    szof = sizeof(float) ;
    count = sizeof(floats)/sizeof(float) ;
    assert( xdr_vector(xdrs, (char *)got_af, count, szof, xdr_float)) ;
    for(ii = 0, fp = got_af;
	ii < count - 1;
	ii++, fp++) 
    {
	assert(*fp <= floats[ii]*(1+FLT_EPSILON) && *fp >= floats[ii]*(1-FLT_EPSILON)) ;
    }
    assert(*fp == 0 || (*fp <= floats[ii]*(1+FLT_EPSILON) && *fp >= floats[ii]*(1-FLT_EPSILON))) ;

    exit(0) ;
}

EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  XDR_LIBOBJS=
XDR_INSTALL_DEPS=
else
  XDR_LIBOBJS="xdr.o xdrfloat.o xdrstdio.o xdrarray.o"
XDR_INSTALL_DEPS=installed_headers
LD_XDR=
fi
rm -f conftest*

echo checking for function prototypes
# If you can get the FreeBSD stuff working, more power to you -QAK
if test "$OS" = freebsd; then   # for some reason this is not working on FreeBSD
    :
else
cat > conftest.c <<EOF

main() { exit(0); } 
t() { extern int foo(int bar);
 }
EOF
if eval $compile; then
  :
else
    for arg in -DNO_HAVE_PROTOTYPES; do
    case "$CPPFLAGS" in
      *$arg*) ;;
      *)      CPPFLAGS="${CPPFLAGS-} $arg";;
    esac
  done

fi
rm -f conftest*
fi

echo checking for working const
# If you can get the FreeBSD stuff working, more power to you -QAK
if test "$OS" = freebsd; then   # for some reason this is not working on FreeBSD
    :
else
cat > conftest.c <<EOF

main() { exit(0); } 
t() { /* Ultrix mips cc rejects this.  */
typedef int charset[2]; const charset x;
 }
EOF
if eval $compile; then
  :
else
    for arg in -Dconst=; do
    case "$CPPFLAGS" in
      *$arg*) ;;
      *)      CPPFLAGS="${CPPFLAGS-} $arg";;
    esac
  done

fi
rm -f conftest*
fi

echo checking for variadic function support
# If you can get the FreeBSD stuff working, more power to you -QAK
if test "$OS" = freebsd; then   # for some reason this is not working on FreeBSD
    :
else
cat > conftest.c <<EOF

main() { exit(0); } 
t() { } 
#include <stdarg.h>
int foo(int bar, ...) {
    va_list     alist;
    va_start(alist, bar);
    bar = (int)va_arg(alist, int);
    va_end(alist);
    return bar;
 }
EOF
if eval $compile; then
  :
else
    for arg in -DNO_STDARG; do
    case "$CPPFLAGS" in
      *$arg*) ;;
      *)      CPPFLAGS="${CPPFLAGS-} $arg";;
    esac
  done

fi
rm -f conftest*
fi

# If you can get the Convex or Solaris stuff working, more power to you -QAK
if test "$OS" = solaris || test "$OS" = convex; then   # for some reason this is not working on Convex and Solaris
    :
else
if test `$WHICH "${FC-}" | wc -w` != 1; then
echo checking for strerror
cat > conftest.c <<EOF
#include <stdio.h>
#include <string.h>
main() { exit(0); } 
t() { 
#ifdef __stub_strerror
choke me
#else
/* Override any gcc2 internal prototype to avoid an error.  */
extern char strerror(); strerror();
#endif
 }
EOF
if eval $compile; then
  :
else
    for arg in -DNO_STRERROR; do
    case "$CPPFLAGS" in
      *$arg*) ;;
      *)      CPPFLAGS="${CPPFLAGS-} $arg";;
    esac
  done

fi
rm -f conftest*
#endif
else
  echo checking for strerror
  echo '       CALL STRERROR' > conftest.f
  if eval "$FC conftest.f > /dev/null 2>&1"; then
    : true
  else
      for arg in -DNO_STRERROR; do
    case "$CPPFLAGS" in
      *$arg*) ;;
      *)      CPPFLAGS="${CPPFLAGS-} $arg";;
    esac
  done
  fi
  rm -rf a.out conftest.f
fi
fi	# end Convex/Solaris hack


FTPDIR=${FTPDIR-/home/ftp}/pub/sdm

echo checking for package version
if test -z "$VERSION"; then
  if test -r VERSION; then \
    VERSION="`cat VERSION`"
  else
    VERSION=
  fi
fi
if test -z "$MAJOR_NO"; then
  if test -n "$VERSION"; then \
    MAJOR_NO=`echo $VERSION |
      sed -n '/^\([0-9][0-9]*\)\.[0-9][0-9]*.*/s//\1/p;q'`
  else
    MAJOR_NO=
  fi
fi
if test -z "$MINOR_NO"; then
  if test -n "$VERSION"; then \
    MINOR_NO=`echo $VERSION |
      sed -n '/^[0-9][0-9]*\.\([0-9][0-9]*\).*/s//\1/p;q'`
  else
    MINOR_NO=
  fi
fi


if test -s conf.missing; then
  cat << CAT_EOF

$0: The following variables need values.  They may be set in
the environment or in the file CUSTOMIZE.  Variables referring to
executable programs needn't be set if the relevant directory is added to
PATH.  In any case, ./configure should probably be rerun.  See file INSTALL
for details.

CAT_EOF
  awk -F: 'BEGIN {printf "%-13s%-27s%s\n", "VARIABLE", "MEANING", "EXAMPLE";
	          printf "%-13s%-27s%s\n", "--------", "-------", "-------"}
	         {printf "%-13s%-27s%s\n", $1, $2, $3}' conf.missing
  rm conf.missing
  exit 1
fi
rm -f conf.missing


if test -n "$prefix"; then
  test -z "$exec_prefix" && exec_prefix='${prefix}'
  prsub="s%^prefix\\([ 	]*\\)=\\([ 	]*\\).*$%prefix\\1=\\2$prefix%"
fi
if test -n "$exec_prefix"; then
  prsub="$prsub
s%^exec_prefix\\([ 	]*\\)=\\([ 	]*\\).*$%\
exec_prefix\\1=\\2$exec_prefix%"
fi

trap 'rm -f config.status; exit 1' 1 3 15
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`:
#
# $0 $*

for arg
do
  case "\$arg" in
    -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
    exec /bin/sh $0 $* ;;
    *) echo "Usage: config.status --recheck" 2>&1; exit 1 ;;
  esac
done

trap 'rm -f \
    Makefile \
    xdr/Makefile \
    libsrc/Makefile \
    fortran/Makefile \
    ncgen/Makefile \
    ncdump/Makefile \
    dumper/Makefile \
    nctest/Makefile \
    doc/Makefile \
     ${TRANSFORMEES-}; exit 1' 1 3 15
CPPFLAGS='$CPPFLAGS'
CFLAGS='$CFLAGS'
OS='$OS'
LIBOBJS='$LIBOBJS'
PORT_HEADERS='$PORT_HEADERS'
PORT_MANIFEST='$PORT_MANIFEST'
PORT_SUBDIRS='$PORT_SUBDIRS'
CC='$CC'
AR='$AR'
RANLIB='$RANLIB'
OLD_FILLVALUES='$OLD_FILLVALUES'
TRANSFORMEES='$TRANSFORMEES'
HDF_INC='$HDF_INC'
HDF_LIB='$HDF_LIB'
JPEG_LIB='$JPEG_LIB'
FFLAGS='$FFLAGS'
LEX='$LEX'
YACC='$YACC'
XDRFILE='$XDRFILE'
MACHINE='$MACHINE'
WHICH='$WHICH'
CPP='$CPP'
FC='$FC'
NEQN='$NEQN'
TBL='$TBL'
INSTALL='$INSTALL'
INSTALL_PROGRAM='$INSTALL_PROGRAM'
INSTALL_DATA='$INSTALL_DATA'
MAKEINFO='$MAKEINFO'
SWAP='$SWAP'
NETLONG='$NETLONG'
CPP_XDR='$CPP_XDR'
DEFS='$DEFS'
LIBS='$LIBS'
XDR_LIBOBJS='$XDR_LIBOBJS'
XDR_INSTALL_DEPS='$XDR_INSTALL_DEPS'
LD_XDR='$LD_XDR'
FTPDIR='$FTPDIR'
VERSION='$VERSION'
MAJOR_NO='$MAJOR_NO'
MINOR_NO='$MINOR_NO'
srcdir='$srcdir'
DEFS='$DEFS'
prefix='$prefix'
exec_prefix='$exec_prefix'
prsub='$prsub'
EOF
cat >> config.status <<\EOF

top_srcdir=$srcdir
for file in .. \
    Makefile \
    xdr/Makefile \
    libsrc/Makefile \
    fortran/Makefile \
    ncgen/Makefile \
    ncdump/Makefile \
    dumper/Makefile \
    nctest/Makefile \
    doc/Makefile \
     ${TRANSFORMEES-}; do if [ "x$file" != "x.." ]; then
  srcdir=$top_srcdir
  # Remove last slash and all that follows it.  Not all systems have dirname.
  dir=`echo $file|sed 's%/[^/][^/]*$%%'`
  if test "$dir" != "$file"; then
    test "$top_srcdir" != . && srcdir=$top_srcdir/$dir
    test ! -d $dir && mkdir $dir
  fi
  echo creating $file
  rm -f $file
  case $file in
    *.c|*.h) echo "/* Generated automatically from `echo $file|sed 's|.*/||'`.in by configure. */" > $file;;
    *) echo "# Generated automatically from `echo $file|sed 's|.*/||'`.in by configure." > $file;;
  esac
  sed -e "
$prsub
s%@CPPFLAGS@%$CPPFLAGS%g
s%@CFLAGS@%$CFLAGS%g
s%@OS@%$OS%g
s%@LIBOBJS@%$LIBOBJS%g
s%@PORT_HEADERS@%$PORT_HEADERS%g
s%@PORT_MANIFEST@%$PORT_MANIFEST%g
s%@PORT_SUBDIRS@%$PORT_SUBDIRS%g
s%@CC@%$CC%g
s%@AR@%$AR%g
s%@RANLIB@%$RANLIB%g
s%@OLD_FILLVALUES@%$OLD_FILLVALUES%g
s%@TRANSFORMEES@%$TRANSFORMEES%g
s%@HDF_INC@%$HDF_INC%g
s%@HDF_LIB@%$HDF_LIB%g
s%@JPEG_LIB@%$JPEG_LIB%g
s%@FFLAGS@%$FFLAGS%g
s%@LEX@%$LEX%g
s%@YACC@%$YACC%g
s%@XDRFILE@%$XDRFILE%g
s%@MACHINE@%$MACHINE%g
s%@WHICH@%$WHICH%g
s%@CPP@%$CPP%g
s%@FC@%$FC%g
s%@NEQN@%$NEQN%g
s%@TBL@%$TBL%g
s%@INSTALL@%$INSTALL%g
s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
s%@INSTALL_DATA@%$INSTALL_DATA%g
s%@MAKEINFO@%$MAKEINFO%g
s%@SWAP@%$SWAP%g
s%@NETLONG@%$NETLONG%g
s%@CPP_XDR@%$CPP_XDR%g
s%@DEFS@%$DEFS%g
s%@LIBS@%$LIBS%g
s%@XDR_LIBOBJS@%$XDR_LIBOBJS%g
s%@XDR_INSTALL_DEPS@%$XDR_INSTALL_DEPS%g
s%@LD_XDR@%$LD_XDR%g
s%@FTPDIR@%$FTPDIR%g
s%@VERSION@%$VERSION%g
s%@MAJOR_NO@%$MAJOR_NO%g
s%@MINOR_NO@%$MINOR_NO%g
s%@srcdir@%$srcdir%g
s%@DEFS@%$DEFS%
" $top_srcdir/${file}.in >> $file
fi; done

EOF
chmod +x config.status
test -n "$no_create" || ./config.status
if test -s conf.missing; then
  cat << CAT_EOF

$0: The following variables need values.  They may be set in
the environment or in the file CUSTOMIZE.  Variables referring to
executable programs needn't be set if the relevant directory is added to
PATH.  In any case, ./configure should probably be rerun.  See file INSTALL
for details.

CAT_EOF
  awk -F: 'BEGIN {printf "%-13s%-27s%s\n", "VARIABLE", "MEANING", "EXAMPLE";
	          printf "%-13s%-27s%s\n", "--------", "-------", "-------"}
	         {printf "%-13s%-27s%s\n", $1, $2, $3}' conf.missing
  rm conf.missing
  exit 1
fi
rm -f conf.missing
 # Post process any makefiles.
#
# Create a script to accomplish the post processing.
#
cat << EOF_CONFTEST_SH > conftest.sh
cat << EOF_CONFTEST_C > conftest.c
#include <stdio.h>
main()
{
    return readsub((char*)NULL) ? 0 : 1;
}
readsub(inpath)
    char	*inpath;
{
    char	buf[2048], path[1024];
    FILE	*fp	= inpath == NULL
				? stdin
				: fopen(inpath, "r");
    if (fp == NULL) {
	(void) perror(inpath);
	return 0;
    }
    buf[sizeof(buf)-1]	= 0;
    while (fgets(buf, sizeof(buf), fp) != NULL) {
      if (sscanf(buf, "include%*[] \\t[]%s", path) == 1) {
          if (!readsub(path))
		return 0;
	} else {
	    (void) fputs(buf, stdout);
	}
    }
    return 1;
}
EOF_CONFTEST_C
if $CC -o conftest conftest.c; then
    conftest=\`pwd\`/conftest
    set \
    Makefile \
    xdr/Makefile \
    libsrc/Makefile \
    fortran/Makefile \
    ncgen/Makefile \
    ncdump/Makefile \
    dumper/Makefile \
    nctest/Makefile \
    doc/Makefile \
     ${POST_PROCESSEES-}
    for file do
      echo post processing makefile \\\`\$file\\'
      sd=\`pwd\`/\`echo \$file | sed 's,[^/]*\$,,'\`
      base=\`basename \$file\`
      (cd \$sd; \$conftest < \$base > conftest.mk && mv conftest.mk \$base)
    done
fi
rm conftest conftest.c
EOF_CONFTEST_SH
#
# Append the above script to the output-script file, config.status, so that 
# invoking that file will also do the post processing.  Note that the 
# output-script file will be invoked by ./configure before the post-
# processing code is appended.
#
cat conftest.sh >> config.status
#
# If appropriate, do the postprocessing now because the previous step 
# couldn't.
#
test -n "$no_create" || sh conftest.sh
rm conftest.sh
 
