#!/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]
#        [--prefix=PREFIX] [--exec-prefix=PREFIX] [--with-PACKAGE[=VALUE]]
# Ignores all args except --srcdir, --prefix, --exec-prefix, and
# --with-PACKAGE[=VALUE] 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, recognize -exec-prefix and --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) ;;

     -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 -e 's/-*with-//' -e 's/=.*//'`
       # Reject names that aren't valid shell variable names.
       if test -n "`echo $package| sed 's/[-a-zA-Z0-9_]//g'`"; then
         echo "configure: $package: invalid package name" >&2; exit 1
       fi
       package=`echo $package| sed 's/-/_/g'`
       case "$arg" in
         *=*) val="`echo $arg|sed 's/[^=]*=//'`" ;;
         *) val=1 ;;
       esac
       eval "with_$package='$val'" ;;

     -v | -verbose | --verbose | --verbos | --verbo | --verb | --ver | --ve | --v)
       verbose=yes ;;

     *) ;;
    esac
  fi
done

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

# NLS nuisances.
# These must not be set unconditionally because not all systems understand
# e.g. LANG=C (notably SCO).
if test "${LC_ALL+set}" = 'set' ; then LC_ALL=C; export LC_ALL; fi
if test "${LANG+set}"   = 'set' ; then LANG=C;   export LANG;   fi

if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
  if (echo -n testing; echo 1,2,3) | grep -e -n > /dev/null; then
    ac_n= ac_c='
' ac_t='	' ac_tt=
  else
    ac_n=-n ac_c= ac_t= ac_tt='
	 '
  fi
else
  ac_n= ac_c='\c' ac_t= ac_tt='
	 '
fi

rm -fr conftest* confdefs.h core
# AIX cpp loses on an empty file, so make sure it contains at least a newline.
echo > confdefs.h
compile='${CC-cc} $CFLAGS 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=lispbibl.d

# 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

# Save the original args to write them into config.status later.
configure_args="$*"


if test -z "$CC"; then
  # Extract the first word of `gcc', so it can be a program name with args.
  set dummy gcc; word=$2
  echo $ac_n "checking for $word""... $ac_c"
  IFS="${IFS= 	}"; saveifs="$IFS"; IFS="${IFS}:"
  for dir in $PATH; do
    test -z "$dir" && dir=.
    if test -f $dir/$word; then
      CC="gcc"
      break
    fi
  done
  IFS="$saveifs"
  test -z "$CC" && CC="cc"
  echo "${ac_t}using $CC"
fi

# Find out if we are using GNU C, under whatever name.
cat > conftest.c <<EOF
#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*

                      echo $ac_n "checking how to run the C preprocessor""... $ac_c"
if test -z "$CPP"; then
  # This must be in double quotes, not single quotes, because CPP may get
  # substituted into the Makefile and ``${CC-cc}'' will simply confuse
  # make.  It must be expanded now.
  CPP="${CC-cc} -E"
  if test -n "$GCC"; then
    # Suppress warning messages.
                    CPP="$CPP -w"
  fi
  if test -f /coherent; then
            COHERENT=' || echo coherent'
  fi
  cat > conftest.c <<EOF
#include "confdefs.h"
#include <stdio.h>
Syntax Error
EOF
err=`eval "($CPP conftest.c >/dev/null) 2>&1""$COHERENT"`
if test -z "$err"; then
  have_cpp=1
fi
rm -f conftest*
  if test -z "$have_cpp"; then
    CPP="${CC-cc} -E -traditional-cpp"
    cat > conftest.c <<EOF
#include "confdefs.h"
#include <stdio.h>
Syntax Error
EOF
err=`eval "($CPP conftest.c >/dev/null) 2>&1""$COHERENT"`
if test -z "$err"; then
  CC="${CC-cc} -traditional-cpp"
else
  CPP=/lib/cpp
fi
rm -f conftest*
  fi
fi
echo "${ac_t}$CPP"

                      if test -n "$GCC"; then
  echo $ac_n "checking whether -traditional is needed""... $ac_c"
  pattern="Autoconf.*'x'"
  prog='#include <sgtty.h>
Autoconf TIOCGETP'
  cat > conftest.c <<EOF
#include "confdefs.h"
$prog
EOF
eval "$CPP conftest.c > conftest.out 2>&1"
if egrep "$pattern" conftest.out >/dev/null 2>&1; then
  need_trad=1
fi
rm -f conftest*
  if test -z "$need_trad"; then
    prog='#include <termio.h>
Autoconf TCGETA'
    cat > conftest.c <<EOF
#include "confdefs.h"
$prog
EOF
eval "$CPP conftest.c > conftest.out 2>&1"
if egrep "$pattern" conftest.out >/dev/null 2>&1; then
  need_trad=1
fi
rm -f conftest*
  fi
  if test -z "$need_trad"; then
    # On some USL SVR4 systems, gcc's fixinc.svr4 modifies <signal.h> and
    # <sys/signal.h> in such a way that "#include <signal.h>" results in a
    # syntax error because of `sigset_t' if gcc is called with __STDC__=1
    # but __STRICT_ANSI__ undefined. Remedy: use -traditional.
    prog='
#include <sys/types.h>
#include <signal.h>
int main() { exit(0); }'
    echo "$prog" > conftest.c
    if eval $compile; then
      :
    else
      prog='
#undef __STDC__
#include <sys/types.h>
#include <signal.h>
int main() { exit(0); }'
      echo "$prog" > conftest.c
      if eval $compile; then
        need_trad=1
      fi
    fi
    rm -f conftest*
  fi
  if test -n "$need_trad"; then
    echo "${ac_t}yes"
    CC="$CC -traditional"
  else
    echo "${ac_t}no"
  fi
fi

                      echo $ac_n "checking whether using GNU C""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#ifdef __GNUC__
  yes
#endif

EOF
eval "$CPP conftest.c > conftest.out 2>&1"
if egrep "yes" conftest.out >/dev/null 2>&1; then
  echo "${ac_t}yes"
CC_GCC=true
else
  echo "${ac_t}no"
CC_GCC=false
fi
rm -f conftest*

                      echo $ac_n "checking whether using ANSI C""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#ifdef __STDC__
  yes
#endif

EOF
eval "$CPP conftest.c > conftest.out 2>&1"
if egrep "yes" conftest.out >/dev/null 2>&1; then
  echo "${ac_t}yes"
CC_ANSI=true
else
  echo "${ac_t}no"
CC_ANSI=false
fi
rm -f conftest*

                      echo $ac_n "checking whether CPP likes indented directives""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
 #define foo
EOF
eval "$CPP conftest.c > conftest.out 2>&1"
if egrep "#.*foo" conftest.out >/dev/null 2>&1; then
  echo "${ac_t}no"
CC_NEED_CCPAUX=true
else
  echo "${ac_t}yes"
CC_NEED_CCPAUX=false
fi
rm -f conftest*

                      echo $ac_n "checking whether CPP understands #elif""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#if 0
#elif 1
#else
#endif
EOF
err=`eval "($CPP conftest.c >/dev/null) 2>&1""$COHERENT"`
if test -z "$err"; then
  echo "${ac_t}yes"
CC_NEED_DEELIF=false
else
  echo "${ac_t}no"
CC_NEED_DEELIF=true
fi
rm -f conftest*
                      echo $ac_n "checking whether CPP understands #error""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#if 0
#error "bla"
#endif
EOF
err=`eval "($CPP conftest.c >/dev/null) 2>&1""$COHERENT"`
if test -z "$err"; then
  echo "${ac_t}yes"
CC_NEED_DEERROR=false
else
  echo "${ac_t}no"
CC_NEED_DEERROR=true
fi
rm -f conftest*
                      echo $ac_n "checking whether CPP likes empty macro arguments""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#define divide(x,y,q_zuw,r_zuw) (r_zuw(x)-(q_zuw(x)/(y))*(y))
foo(x,y) int x,y; { int q; divide(x,y,q=,); return q; }
EOF
err=`eval "($CPP conftest.c >/dev/null) 2>&1""$COHERENT"`
if test -z "$err"; then
  echo "${ac_t}yes"
CC_NEED_DEEMA=false
else
  echo "${ac_t}no"
CC_NEED_DEEMA=true
fi
rm -f conftest*
                      echo $ac_n "checking whether CC merges adjacent strings""... $ac_c"
echo "char foo [] = \"abc\" \"def\"; main() { exit(0); }" > conftest.c
if eval $compile; then
  echo "${ac_t}yes"
  CC_NEED_MERGESTRINGS=false
else
  echo "${ac_t}no"
  CC_NEED_MERGESTRINGS=true
fi
rm -f conftest*

                      echo $ac_n "checking for underscore in external names""... $ac_c"
cat > conftest.c <<EOF
int foo() { return 0; }
EOF
${CC-cc} -c conftest.c >/dev/null 2>&1
# check whether nm exists
if (nm conftest.o) >/dev/null 2>&1 ; then
  # use nm to see the assembly language name
  if nm conftest.o | grep _foo >/dev/null 2>&1 ; then
    AS_UNDERSCORE=true
  else
    AS_UNDERSCORE=false
  fi
else
  # look for the assembly language name in the .s file
  ${CC-cc} -S conftest.c >/dev/null 2>&1
  if grep _foo conftest.s >/dev/null ; then
    AS_UNDERSCORE=true
  else
    AS_UNDERSCORE=false
  fi
fi
if test $AS_UNDERSCORE = true; then
  echo "${ac_t}yes"
else
  echo "${ac_t}no"
fi
rm -f conftest*

                      if test -z "$RANLIB"; then
  # Extract the first word of `ranlib', so it can be a program name with args.
  set dummy ranlib; word=$2
  echo $ac_n "checking for $word""... $ac_c"
  IFS="${IFS= 	}"; saveifs="$IFS"; IFS="${IFS}:"
  for dir in $PATH; do
    test -z "$dir" && dir=.
    if test -f $dir/$word; then
      RANLIB="ranlib"
      break
    fi
  done
  IFS="$saveifs"
  test -z "$RANLIB" && RANLIB="echo not executing ranlib"
  echo "${ac_t}using $RANLIB"
fi

                      # 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, or
# /usr/ucb/install on SVR4, which tries to use the nonexistent group
# `staff'.  On most BSDish systems install is in /usr/bin, not /usr/ucb
# anyway.  Sigh.
if test "z${INSTALL}" = "z" ; then
  echo $ac_n "checking for install""... $ac_c"
  IFS="${IFS= 	}"; saveifs="$IFS"; IFS="${IFS}:"
  for dir in $PATH; do
    test -z "$dir" && dir=.
    case $dir in
    /etc|/usr/sbin|/usr/etc|/usr/afsws/bin|/usr/ucb) ;;
    *)
      if test -f $dir/installbsd; then
	INSTALL="$dir/installbsd -c" # OSF1
	INSTALL_PROGRAM='$(INSTALL)'
	INSTALL_DATA='$(INSTALL) -m 644'
	break
      fi
      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"
  echo "${ac_t}${INSTALL-cp}"
fi
INSTALL=${INSTALL-cp}
INSTALL_PROGRAM=${INSTALL_PROGRAM-'$(INSTALL)'}
INSTALL_DATA=${INSTALL_DATA-'$(INSTALL)'}

                      echo $ac_n "checking how to copy files""... $ac_c"
echo "blabla" > conftest.x
err=`/bin/sh -c "cp -p conftest.x conftest.y 2>&1"`
if test -z "$err"; then
  CP='cp -p'
else
  CP='cp'
fi
rm -f conftest*
echo "${ac_t}$CP"

                      echo $ac_n "checking for ln -s""... $ac_c"
rm -f conftestdata
if ln -s X conftestdata 2>/dev/null
then
  rm -f conftestdata
  echo "${ac_t}yes"
  LN_S="ln -s"
else
  echo "${ac_t}no"
  LN_S=ln
fi


                      echo $ac_n "checking for AIX""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#ifdef _AIX
  yes
#endif

EOF
eval "$CPP conftest.c > conftest.out 2>&1"
if egrep "yes" conftest.out >/dev/null 2>&1; then
  echo "${ac_t}yes"
echo "#define" _ALL_SOURCE "1" >> confdefs.h
DEFS="$DEFS -D_ALL_SOURCE=1"
SEDDEFS="${SEDDEFS}\${SEDdA}_ALL_SOURCE\${SEDdB}_ALL_SOURCE\${SEDdC}1\${SEDdD}
\${SEDuA}_ALL_SOURCE\${SEDuB}_ALL_SOURCE\${SEDuC}1\${SEDuD}
\${SEDeA}_ALL_SOURCE\${SEDeB}_ALL_SOURCE\${SEDeC}1\${SEDeD}
\${SEDfA}_ALL_SOURCE\${SEDfB}_ALL_SOURCE\${SEDfC}1\${SEDfD}
"
else
  echo "${ac_t}no"
fi
rm -f conftest*

                      echo $ac_n "checking for POSIXized ISC""... $ac_c"
if test -d /etc/conf/kconfig.d &&
  grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
then
  echo "${ac_t}yes"
  ISC=1 # If later tests want to check for ISC.
  echo "#define" _POSIX_SOURCE "1" >> confdefs.h
DEFS="$DEFS -D_POSIX_SOURCE=1"
SEDDEFS="${SEDDEFS}\${SEDdA}_POSIX_SOURCE\${SEDdB}_POSIX_SOURCE\${SEDdC}1\${SEDdD}
\${SEDuA}_POSIX_SOURCE\${SEDuB}_POSIX_SOURCE\${SEDuC}1\${SEDuD}
\${SEDeA}_POSIX_SOURCE\${SEDeB}_POSIX_SOURCE\${SEDeC}1\${SEDeD}
\${SEDfA}_POSIX_SOURCE\${SEDfB}_POSIX_SOURCE\${SEDfC}1\${SEDfD}
"
  if test -n "$GCC"; then
    CC="$CC -posix"
  else
    CC="$CC -Xp"
  fi
else
  echo "${ac_t}no"
fi

                      echo $ac_n "checking for minix/config.h""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <minix/config.h>
EOF
err=`eval "($CPP conftest.c >/dev/null) 2>&1""$COHERENT"`
if test -z "$err"; then
  echo "${ac_t}yes"
MINIX=1
else
  echo "${ac_t}no"

fi
rm -f conftest*
# The Minix shell can't assign to the same variable on the same line!
if test -n "$MINIX"; then
  echo "#define" _POSIX_SOURCE "1" >> confdefs.h
DEFS="$DEFS -D_POSIX_SOURCE=1"
SEDDEFS="${SEDDEFS}\${SEDdA}_POSIX_SOURCE\${SEDdB}_POSIX_SOURCE\${SEDdC}1\${SEDdD}
\${SEDuA}_POSIX_SOURCE\${SEDuB}_POSIX_SOURCE\${SEDuC}1\${SEDuD}
\${SEDeA}_POSIX_SOURCE\${SEDeB}_POSIX_SOURCE\${SEDeC}1\${SEDeD}
\${SEDfA}_POSIX_SOURCE\${SEDfB}_POSIX_SOURCE\${SEDfC}1\${SEDfD}
"
  echo "#define" _POSIX_1_SOURCE "2" >> confdefs.h
DEFS="$DEFS -D_POSIX_1_SOURCE=2"
SEDDEFS="${SEDDEFS}\${SEDdA}_POSIX_1_SOURCE\${SEDdB}_POSIX_1_SOURCE\${SEDdC}2\${SEDdD}
\${SEDuA}_POSIX_1_SOURCE\${SEDuB}_POSIX_1_SOURCE\${SEDuC}2\${SEDuD}
\${SEDeA}_POSIX_1_SOURCE\${SEDeB}_POSIX_1_SOURCE\${SEDeC}2\${SEDeD}
\${SEDfA}_POSIX_1_SOURCE\${SEDfB}_POSIX_1_SOURCE\${SEDfC}2\${SEDfD}
"
  echo "#define" _MINIX "1" >> confdefs.h
DEFS="$DEFS -D_MINIX=1"
SEDDEFS="${SEDDEFS}\${SEDdA}_MINIX\${SEDdB}_MINIX\${SEDdC}1\${SEDdD}
\${SEDuA}_MINIX\${SEDuB}_MINIX\${SEDuC}1\${SEDuD}
\${SEDeA}_MINIX\${SEDeB}_MINIX\${SEDeC}1\${SEDeD}
\${SEDfA}_MINIX\${SEDfB}_MINIX\${SEDfC}1\${SEDfD}
"
fi

                      echo $ac_n "checking for IRIX libsun""... $ac_c"
if test -f /usr/lib/libsun.a; then
  echo "${ac_t}yes"
  LIBS="$LIBS -lsun"
else
  echo "${ac_t}no"
fi

                      echo $ac_n "checking for SCO UNIX libintl""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#if defined(M_UNIX)
  yes
#endif

EOF
eval "$CPP conftest.c > conftest.out 2>&1"
if egrep "yes" conftest.out >/dev/null 2>&1; then
  SCO_UNIX=1
fi
rm -f conftest*
if test -n "$SCO_UNIX" && test -f /lib/libintl.a; then
  echo "${ac_t}yes"
  LIBS="$LIBS -lintl" # For strftime.
else
  echo "${ac_t}no"
fi

                      echo $ac_n "checking for DYNIX/ptx libseq or libsocket""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#if defined(_SEQUENT_)
  yes
#endif

EOF
eval "$CPP conftest.c > conftest.out 2>&1"
if egrep "yes" conftest.out >/dev/null 2>&1; then
  SEQUENT=1
fi
rm -f conftest*
if test -n "$SEQUENT"; then
test -f /usr/lib/libseq.a &&
  LIBS="$LIBS -lseq"
test -f /usr/lib/libsocket.a &&
  LIBS="$LIBS -lsocket"
echo "${ac_t}yes"
else
echo "${ac_t}no"
fi

                      echo $ac_n "checking whether gethostbyname requires -lsocket""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
extern char gethostbyname();
int main() { exit(0); }
int t() { gethostbyname(); }
EOF
if eval $compile; then
  have_gethostbyname=1
else
  :
fi
rm -f conftest*
if test -z "$have_gethostbyname"; then
LIBS_old="$LIBS"
LIBS="$LIBS -lsocket"
cat > conftest.c <<EOF
#include "confdefs.h"
extern char gethostbyname();
int main() { exit(0); }
int t() { gethostbyname(); }
EOF
if eval $compile; then
  echo "${ac_t}yes"
else
  echo "${ac_t}no"
LIBS="$LIBS_old"
fi
rm -f conftest*
else
echo "${ac_t}no"
fi

                      echo $ac_n "checking whether CC works at all""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
main() { exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  echo "${ac_t}yes"

else
  echo "${ac_t}no"
echo "Installation or configuration problem: C compiler cannot create executables."; exit 1
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*

                      echo $ac_n "checking for broken HP/UX, A/UX and OSF/1 shell""... $ac_c"
# A program that outputs its argument count:
cat > conftest.c <<EOF
#include "confdefs.h"
#include <stdio.h>
#ifdef __STDC__
main (int argc, char** argv)
#else
main (argc,argv) int argc; char** argv;
#endif
{ printf("%d\n",argc); exit(0); }
EOF
eval $compile
# How can a shell script forward its arguments to another program?
#                                    $ * "$ *" "$ @"
# conftest.sh                         1    2     1 (*)
# conftest.sh foo                     2    2     2
# conftest.sh foo bar                 3    2     3
# conftest.sh "foo bar"               3    2     2
# (*): 2 with HP-UX /bin/sh. We must use /bin/ksh instead.
#      2 as well with NeXTstep /bin/sh. No /bin/ksh. Examine 0 first.
psubs='"$''@"'
cat > conftest.sh <<EOF
#!/bin/sh
exec ./conftest $psubs
EOF
chmod a+x conftest.sh
if test `./conftest.sh` = "1"; then
  echo "${ac_t}no"
  GOOD_SH='/bin/sh'
else
  echo "${ac_t}yes"
  if test -x /bin/ksh; then
    GOOD_SH='/bin/ksh'
    echo "#define" UNIX_USE_KSH "1" >> confdefs.h
DEFS="$DEFS -DUNIX_USE_KSH=1"
SEDDEFS="${SEDDEFS}\${SEDdA}UNIX_USE_KSH\${SEDdB}UNIX_USE_KSH\${SEDdC}1\${SEDdD}
\${SEDuA}UNIX_USE_KSH\${SEDuB}UNIX_USE_KSH\${SEDuC}1\${SEDuD}
\${SEDeA}UNIX_USE_KSH\${SEDeB}UNIX_USE_KSH\${SEDeC}1\${SEDeD}
\${SEDfA}UNIX_USE_KSH\${SEDfB}UNIX_USE_KSH\${SEDfC}1\${SEDfD}
"
  else
    GOOD_SH=''
    echo "#define" UNIX_BROKEN_SH "1" >> confdefs.h
DEFS="$DEFS -DUNIX_BROKEN_SH=1"
SEDDEFS="${SEDDEFS}\${SEDdA}UNIX_BROKEN_SH\${SEDdB}UNIX_BROKEN_SH\${SEDdC}1\${SEDdD}
\${SEDuA}UNIX_BROKEN_SH\${SEDuB}UNIX_BROKEN_SH\${SEDuC}1\${SEDuD}
\${SEDeA}UNIX_BROKEN_SH\${SEDeB}UNIX_BROKEN_SH\${SEDeC}1\${SEDeD}
\${SEDfA}UNIX_BROKEN_SH\${SEDfB}UNIX_BROKEN_SH\${SEDfC}1\${SEDfD}
"
  fi
fi
rm -f conftest*

                      prog='/* 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;
/* 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;
}'
echo $ac_n "checking for working const""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"

int main() { exit(0); }
int t() { $prog }
EOF
if eval $compile; then
  echo "${ac_t}yes"
  :
else
  echo "${ac_t}no"
  echo "#define" const "" >> confdefs.h
DEFS="$DEFS -Dconst="
SEDDEFS="${SEDDEFS}\${SEDdA}const\${SEDdB}const\${SEDdC}\${SEDdD}
\${SEDuA}const\${SEDuB}const\${SEDuC}\${SEDuD}
\${SEDeA}const\${SEDeB}const\${SEDeC}\${SEDeD}
\${SEDfA}const\${SEDfB}const\${SEDfC}\${SEDfD}
"
fi
rm -f conftest*

                      if test -n "$GCC"; then
echo $ac_n "checking for inline""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"

int main() { exit(0); }
int t() { } inline foo() { }
EOF
if eval $compile; then
  echo "${ac_t}yes"
  :
else
  echo "${ac_t}no"
  echo "#define" inline "__inline" >> confdefs.h
DEFS="$DEFS -Dinline=__inline"
SEDDEFS="${SEDDEFS}\${SEDdA}inline\${SEDdB}inline\${SEDdC}__inline\${SEDdD}
\${SEDuA}inline\${SEDuB}inline\${SEDuC}__inline\${SEDuD}
\${SEDeA}inline\${SEDeB}inline\${SEDeC}__inline\${SEDeD}
\${SEDfA}inline\${SEDfB}inline\${SEDfC}__inline\${SEDfD}
"
fi
rm -f conftest*
fi

                      if test -n "$GCC"; then
echo $ac_n "checking for __nowarn__""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
int x;
int main() { exit(0); }
int t() { __nowarn__ x; }
EOF
if eval $compile; then
  echo "${ac_t}yes"
  have_nowarn=1
else
  echo "${ac_t}no"
  :
fi
rm -f conftest*
fi
if test -z "$have_nowarn"; then
echo "#define" __nowarn__ "" >> confdefs.h
DEFS="$DEFS -D__nowarn__="
SEDDEFS="${SEDDEFS}\${SEDdA}__nowarn__\${SEDdB}__nowarn__\${SEDdC}\${SEDdD}
\${SEDuA}__nowarn__\${SEDuB}__nowarn__\${SEDuC}\${SEDuD}
\${SEDeA}__nowarn__\${SEDeB}__nowarn__\${SEDeC}\${SEDeD}
\${SEDfA}__nowarn__\${SEDfB}__nowarn__\${SEDfC}\${SEDfD}
"
fi

                      echo $ac_n "checking for working void""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"

int main() { exit(0); }
int t() { void f();
typedef void x; x g();
typedef void* y; y a;
 }
EOF
if eval $compile; then
  echo "${ac_t}yes"
  have_void=1
else
  echo "${ac_t}no"
  echo "#define" void "char" >> confdefs.h
DEFS="$DEFS -Dvoid=char"
SEDDEFS="${SEDDEFS}\${SEDdA}void\${SEDdB}void\${SEDdC}char\${SEDdD}
\${SEDuA}void\${SEDuB}void\${SEDuC}char\${SEDuD}
\${SEDeA}void\${SEDeB}void\${SEDeC}char\${SEDeD}
\${SEDfA}void\${SEDfB}void\${SEDfC}char\${SEDfD}
"
fi
rm -f conftest*
if test -n "$have_void"; then
echo $ac_n "checking for working \"return void\"""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
void f() {} typedef void x; x g() { return f(); }
int main() { exit(0); }
int t() { ; }
EOF
if eval $compile; then
  echo "${ac_t}yes"
  echo "#define" return_void "return" >> confdefs.h
DEFS="$DEFS -Dreturn_void=return"
SEDDEFS="${SEDDEFS}\${SEDdA}return_void\${SEDdB}return_void\${SEDdC}return\${SEDdD}
\${SEDuA}return_void\${SEDuB}return_void\${SEDuC}return\${SEDuD}
\${SEDeA}return_void\${SEDeB}return_void\${SEDeC}return\${SEDeD}
\${SEDfA}return_void\${SEDfB}return_void\${SEDfC}return\${SEDfD}
"
else
  echo "${ac_t}no"
  :
fi
rm -f conftest*
fi

                      echo $ac_n "checking for long long type""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
main()
{ long x = 944938507; long y = 737962842; long z = 162359677;
  exit(!(((long long) x)*((long long) y)>>32 == z)); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  echo "${ac_t}yes"
echo "#define" HAVE_LONGLONG "1" >> confdefs.h
DEFS="$DEFS -DHAVE_LONGLONG=1"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_LONGLONG\${SEDdB}HAVE_LONGLONG\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_LONGLONG\${SEDuB}HAVE_LONGLONG\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_LONGLONG\${SEDeB}HAVE_LONGLONG\${SEDeC}1\${SEDeD}
\${SEDfA}HAVE_LONGLONG\${SEDfB}HAVE_LONGLONG\${SEDfC}1\${SEDfD}
"
else
  echo "${ac_t}no"
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*

                      echo $ac_n "checking for ANSI C header files""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <float.h>
#include <limits.h>
EOF
err=`eval "($CPP conftest.c >/dev/null) 2>&1""$COHERENT"`
if test -z "$err"; then
  echo "${ac_t}yes"
echo "#define" STDC_HEADERS "1" >> confdefs.h
DEFS="$DEFS -DSTDC_HEADERS=1"
SEDDEFS="${SEDDEFS}\${SEDdA}STDC_HEADERS\${SEDdB}STDC_HEADERS\${SEDdC}1\${SEDdD}
\${SEDuA}STDC_HEADERS\${SEDuB}STDC_HEADERS\${SEDuC}1\${SEDuD}
\${SEDeA}STDC_HEADERS\${SEDeB}STDC_HEADERS\${SEDeC}1\${SEDeD}
\${SEDfA}STDC_HEADERS\${SEDfB}STDC_HEADERS\${SEDfC}1\${SEDfD}
"
else
  echo "${ac_t}no"
fi
rm -f conftest*

                      for hdr in stdlib.h
do
trhdr=HAVE_`echo $hdr | tr '[a-z]./' '[A-Z]__'`
echo $ac_n "checking for ${hdr}""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <${hdr}>
EOF
err=`eval "($CPP conftest.c >/dev/null) 2>&1""$COHERENT"`
if test -z "$err"; then
  echo "${ac_t}yes"
echo "#define" ${trhdr} "1" >> confdefs.h
DEFS="$DEFS -D${trhdr}=1"
SEDDEFS="${SEDDEFS}\${SEDdA}${trhdr}\${SEDdB}${trhdr}\${SEDdC}1\${SEDdD}
\${SEDuA}${trhdr}\${SEDuB}${trhdr}\${SEDuC}1\${SEDuD}
\${SEDeA}${trhdr}\${SEDeB}${trhdr}\${SEDeC}1\${SEDeD}
\${SEDfA}${trhdr}\${SEDfB}${trhdr}\${SEDfC}1\${SEDfD}
"
else
  echo "${ac_t}no"

fi
rm -f conftest*
done


                      for hdr in unistd.h
do
trhdr=HAVE_`echo $hdr | tr '[a-z]./' '[A-Z]__'`
echo $ac_n "checking for ${hdr}""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <${hdr}>
EOF
err=`eval "($CPP conftest.c >/dev/null) 2>&1""$COHERENT"`
if test -z "$err"; then
  echo "${ac_t}yes"
echo "#define" ${trhdr} "1" >> confdefs.h
DEFS="$DEFS -D${trhdr}=1"
SEDDEFS="${SEDDEFS}\${SEDdA}${trhdr}\${SEDdB}${trhdr}\${SEDdC}1\${SEDdD}
\${SEDuA}${trhdr}\${SEDuB}${trhdr}\${SEDuC}1\${SEDuD}
\${SEDeA}${trhdr}\${SEDeB}${trhdr}\${SEDeC}1\${SEDeD}
\${SEDfA}${trhdr}\${SEDfB}${trhdr}\${SEDfC}1\${SEDfD}
"
else
  echo "${ac_t}no"

fi
rm -f conftest*
done


                      echo $ac_n "checking for sys/file.h""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <sys/file.h>
EOF
err=`eval "($CPP conftest.c >/dev/null) 2>&1""$COHERENT"`
if test -z "$err"; then
  echo "${ac_t}yes"
have_sysfile=1
else
  echo "${ac_t}no"

fi
rm -f conftest*
if test -n "$have_sysfile"; then
openflags_decl='#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <sys/types.h>
#include <unistd.h>
#endif
#include <fcntl.h>
'
openflags_prog='int x = O_RDWR | O_RDONLY | O_WRONLY | O_CREAT | O_TRUNC;'
echo $ac_n "checking for O_RDWR in fcntl.h""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
$openflags_decl
int main() { exit(0); }
int t() { $openflags_prog }
EOF
if eval $compile; then
  echo "${ac_t}yes"
  openflags_ok=1
else
  echo "${ac_t}no"
  :
fi
rm -f conftest*
if test -z "$openflags_ok"; then
echo "#define" NEED_SYS_FILE_H "1" >> confdefs.h
DEFS="$DEFS -DNEED_SYS_FILE_H=1"
SEDDEFS="${SEDDEFS}\${SEDdA}NEED_SYS_FILE_H\${SEDdB}NEED_SYS_FILE_H\${SEDdC}1\${SEDdD}
\${SEDuA}NEED_SYS_FILE_H\${SEDuB}NEED_SYS_FILE_H\${SEDuC}1\${SEDuD}
\${SEDeA}NEED_SYS_FILE_H\${SEDeB}NEED_SYS_FILE_H\${SEDeC}1\${SEDeD}
\${SEDfA}NEED_SYS_FILE_H\${SEDfB}NEED_SYS_FILE_H\${SEDfC}1\${SEDfD}
"
fi
fi

                      echo checking for directory library header
dirheader=
if test -z "$dirheader"; then
  echo $ac_n "checking for dirent.h""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <sys/types.h>
#include <dirent.h>
int main() { exit(0); }
int t() { DIR *dirp = 0; }
EOF
if eval $compile; then
  echo "${ac_t}yes"
  echo "#define" DIRENT "1" >> confdefs.h
DEFS="$DEFS -DDIRENT=1"
SEDDEFS="${SEDDEFS}\${SEDdA}DIRENT\${SEDdB}DIRENT\${SEDdC}1\${SEDdD}
\${SEDuA}DIRENT\${SEDuB}DIRENT\${SEDuC}1\${SEDuD}
\${SEDeA}DIRENT\${SEDeB}DIRENT\${SEDeC}1\${SEDeD}
\${SEDfA}DIRENT\${SEDfB}DIRENT\${SEDfC}1\${SEDfD}
"
dirheader=dirent.h
else
  echo "${ac_t}no"
  :
fi
rm -f conftest*
fi
if test -z "$dirheader"; then
  echo $ac_n "checking for sys/ndir.h""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <sys/types.h>
#include <sys/ndir.h>
int main() { exit(0); }
int t() { DIR *dirp = 0; }
EOF
if eval $compile; then
  echo "${ac_t}yes"
  echo "#define" SYSNDIR "1" >> confdefs.h
DEFS="$DEFS -DSYSNDIR=1"
SEDDEFS="${SEDDEFS}\${SEDdA}SYSNDIR\${SEDdB}SYSNDIR\${SEDdC}1\${SEDdD}
\${SEDuA}SYSNDIR\${SEDuB}SYSNDIR\${SEDuC}1\${SEDuD}
\${SEDeA}SYSNDIR\${SEDeB}SYSNDIR\${SEDeC}1\${SEDeD}
\${SEDfA}SYSNDIR\${SEDfB}SYSNDIR\${SEDfC}1\${SEDfD}
"
dirheader=sys/ndir.h
else
  echo "${ac_t}no"
  :
fi
rm -f conftest*
fi
if test -z "$dirheader"; then
  echo $ac_n "checking for sys/dir.h""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <sys/types.h>
#include <sys/dir.h>
int main() { exit(0); }
int t() { DIR *dirp = 0; }
EOF
if eval $compile; then
  echo "${ac_t}yes"
  echo "#define" SYSDIR "1" >> confdefs.h
DEFS="$DEFS -DSYSDIR=1"
SEDDEFS="${SEDDEFS}\${SEDdA}SYSDIR\${SEDdB}SYSDIR\${SEDdC}1\${SEDdD}
\${SEDuA}SYSDIR\${SEDuB}SYSDIR\${SEDuC}1\${SEDuD}
\${SEDeA}SYSDIR\${SEDeB}SYSDIR\${SEDeC}1\${SEDeD}
\${SEDfA}SYSDIR\${SEDfB}SYSDIR\${SEDfC}1\${SEDfD}
"
dirheader=sys/dir.h
else
  echo "${ac_t}no"
  :
fi
rm -f conftest*
fi
if test -z "$dirheader"; then
  echo $ac_n "checking for ndir.h""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <sys/types.h>
#include <ndir.h>
int main() { exit(0); }
int t() { DIR *dirp = 0; }
EOF
if eval $compile; then
  echo "${ac_t}yes"
  echo "#define" NDIR "1" >> confdefs.h
DEFS="$DEFS -DNDIR=1"
SEDDEFS="${SEDDEFS}\${SEDdA}NDIR\${SEDdB}NDIR\${SEDdC}1\${SEDdD}
\${SEDuA}NDIR\${SEDuB}NDIR\${SEDuC}1\${SEDuD}
\${SEDeA}NDIR\${SEDeB}NDIR\${SEDeC}1\${SEDeD}
\${SEDfA}NDIR\${SEDfB}NDIR\${SEDfC}1\${SEDfD}
"
dirheader=ndir.h
else
  echo "${ac_t}no"
  :
fi
rm -f conftest*
fi

echo $ac_n "checking for closedir return value""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <sys/types.h>
#include <$dirheader>
extern
#ifdef __cplusplus
"C"
#endif
#ifdef __STDC__
int closedir (DIR* dirp);
#else
int closedir();
#endif
main() { exit(closedir(opendir(".")) != 0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  echo "${ac_t}int"
else
  echo "${ac_t}void"
echo "#define" VOID_CLOSEDIR "1" >> confdefs.h
DEFS="$DEFS -DVOID_CLOSEDIR=1"
SEDDEFS="${SEDDEFS}\${SEDdA}VOID_CLOSEDIR\${SEDdB}VOID_CLOSEDIR\${SEDdC}1\${SEDdD}
\${SEDuA}VOID_CLOSEDIR\${SEDuB}VOID_CLOSEDIR\${SEDuC}1\${SEDuD}
\${SEDeA}VOID_CLOSEDIR\${SEDeB}VOID_CLOSEDIR\${SEDeC}1\${SEDeD}
\${SEDfA}VOID_CLOSEDIR\${SEDfB}VOID_CLOSEDIR\${SEDfC}1\${SEDfD}
"
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
echo $ac_n "checking for Xenix""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#if defined(M_XENIX) && !defined(M_UNIX)
  yes
#endif

EOF
eval "$CPP conftest.c > conftest.out 2>&1"
if egrep "yes" conftest.out >/dev/null 2>&1; then
  XENIX=1
fi
rm -f conftest*
if test -n "$XENIX"; then
  echo "${ac_t}yes"
  LIBS="$LIBS -lx"
  case "$DEFS" in
  *SYSNDIR*) ;;
  *) LIBS="-ldir $LIBS" ;; # Make sure -ldir precedes any -lx.
  esac
else
  echo "${ac_t}no"
fi

                      echo $ac_n "checking for sys/utsname.h and struct utsname""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <sys/utsname.h>
int main() { exit(0); }
int t() { struct utsname u; }
EOF
if eval $compile; then
  echo "${ac_t}yes"
  echo "#define" HAVE_SYS_UTSNAME_H "1" >> confdefs.h
DEFS="$DEFS -DHAVE_SYS_UTSNAME_H=1"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_SYS_UTSNAME_H\${SEDdB}HAVE_SYS_UTSNAME_H\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_SYS_UTSNAME_H\${SEDuB}HAVE_SYS_UTSNAME_H\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_SYS_UTSNAME_H\${SEDeB}HAVE_SYS_UTSNAME_H\${SEDeC}1\${SEDeD}
\${SEDfA}HAVE_SYS_UTSNAME_H\${SEDfB}HAVE_SYS_UTSNAME_H\${SEDfC}1\${SEDfD}
"
else
  echo "${ac_t}no"
  :
fi
rm -f conftest*

                      for hdr in netdb.h
do
trhdr=HAVE_`echo $hdr | tr '[a-z]./' '[A-Z]__'`
echo $ac_n "checking for ${hdr}""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <${hdr}>
EOF
err=`eval "($CPP conftest.c >/dev/null) 2>&1""$COHERENT"`
if test -z "$err"; then
  echo "${ac_t}yes"
echo "#define" ${trhdr} "1" >> confdefs.h
DEFS="$DEFS -D${trhdr}=1"
SEDDEFS="${SEDDEFS}\${SEDdA}${trhdr}\${SEDdB}${trhdr}\${SEDdC}1\${SEDdD}
\${SEDuA}${trhdr}\${SEDuB}${trhdr}\${SEDuC}1\${SEDuD}
\${SEDeA}${trhdr}\${SEDeB}${trhdr}\${SEDeC}1\${SEDeD}
\${SEDfA}${trhdr}\${SEDfB}${trhdr}\${SEDfC}1\${SEDfD}
"
else
  echo "${ac_t}no"

fi
rm -f conftest*
done


                      echo $ac_n "checking for sys/shm.h""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <sys/shm.h>
EOF
err=`eval "($CPP conftest.c >/dev/null) 2>&1""$COHERENT"`
if test -z "$err"; then
  echo "${ac_t}yes"

else
  echo "${ac_t}no"
no_shm=1
fi
rm -f conftest*
if test -z "$no_shm"; then
echo $ac_n "checking for sys/ipc.h""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <sys/ipc.h>
EOF
err=`eval "($CPP conftest.c >/dev/null) 2>&1""$COHERENT"`
if test -z "$err"; then
  echo "${ac_t}yes"

else
  echo "${ac_t}no"
no_shm=1
fi
rm -f conftest*
fi
if test -z "$no_shm"; then
echo $ac_n "checking for working shared memory""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
/* try attaching a single segment to multiple addresses */
#define segsize 0x10000
#define attaches 128
#define base_addr 0x01000000
main ()
{ int shmid, i; char* addr; char* result;
  if ((shmid = shmget(IPC_PRIVATE,segsize,0400)) < 0) exit(1);
  for (i=0, addr = (char*)0x01000000; i<attaches; i++, addr += segsize)
    { if ((result = shmat(shmid,addr,SHM_RDONLY)) == (char*)(-1)) break; }
  for (i=0, addr = (char*)0x01000000; i<attaches; i++, addr += segsize)
    shmdt(addr);
  shmctl(shmid,IPC_RMID,0);
  exit(result == (char*)(-1));
}
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  :
else
  no_shm=1
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
fi
if test -z "$no_shm"; then
echo "${ac_t}yes"
echo "#define" HAVE_SHM "1" >> confdefs.h
DEFS="$DEFS -DHAVE_SHM=1"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_SHM\${SEDdB}HAVE_SHM\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_SHM\${SEDuB}HAVE_SHM\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_SHM\${SEDeB}HAVE_SHM\${SEDeC}1\${SEDeD}
\${SEDfA}HAVE_SHM\${SEDfB}HAVE_SHM\${SEDfC}1\${SEDfD}
"
for hdr in sys/sysmacros.h
do
trhdr=HAVE_`echo $hdr | tr '[a-z]./' '[A-Z]__'`
echo $ac_n "checking for ${hdr}""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <${hdr}>
EOF
err=`eval "($CPP conftest.c >/dev/null) 2>&1""$COHERENT"`
if test -z "$err"; then
  echo "${ac_t}yes"
echo "#define" ${trhdr} "1" >> confdefs.h
DEFS="$DEFS -D${trhdr}=1"
SEDDEFS="${SEDDEFS}\${SEDdA}${trhdr}\${SEDdB}${trhdr}\${SEDdC}1\${SEDdD}
\${SEDuA}${trhdr}\${SEDuB}${trhdr}\${SEDuC}1\${SEDuD}
\${SEDeA}${trhdr}\${SEDeB}${trhdr}\${SEDeC}1\${SEDeD}
\${SEDfA}${trhdr}\${SEDfB}${trhdr}\${SEDfC}1\${SEDfD}
"
else
  echo "${ac_t}no"

fi
rm -f conftest*
done
else
echo "${ac_t}no"
fi

                      for hdr in termios.h termio.h sys/termio.h sgtty.h
do
trhdr=HAVE_`echo $hdr | tr '[a-z]./' '[A-Z]__'`
echo $ac_n "checking for ${hdr}""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <${hdr}>
EOF
err=`eval "($CPP conftest.c >/dev/null) 2>&1""$COHERENT"`
if test -z "$err"; then
  echo "${ac_t}yes"
echo "#define" ${trhdr} "1" >> confdefs.h
DEFS="$DEFS -D${trhdr}=1"
SEDDEFS="${SEDDEFS}\${SEDdA}${trhdr}\${SEDdB}${trhdr}\${SEDdC}1\${SEDdD}
\${SEDuA}${trhdr}\${SEDuB}${trhdr}\${SEDuC}1\${SEDuD}
\${SEDeA}${trhdr}\${SEDeB}${trhdr}\${SEDeC}1\${SEDeD}
\${SEDfA}${trhdr}\${SEDfB}${trhdr}\${SEDfC}1\${SEDfD}
"
else
  echo "${ac_t}no"

fi
rm -f conftest*
done
case "$DEFS" in
  *HAVE_TERMIOS_H*)
echo $ac_n "checking for tcgetattr""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <termios.h>
int main() { exit(0); }
int t() { struct termios t; tcgetattr(0,&t); }
EOF
if eval $compile; then
  echo "${ac_t}yes"
  echo "#define" HAVE_TCGETATTR "1" >> confdefs.h
DEFS="$DEFS -DHAVE_TCGETATTR=1"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_TCGETATTR\${SEDdB}HAVE_TCGETATTR\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_TCGETATTR\${SEDuB}HAVE_TCGETATTR\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_TCGETATTR\${SEDeB}HAVE_TCGETATTR\${SEDeC}1\${SEDeD}
\${SEDfA}HAVE_TCGETATTR\${SEDfB}HAVE_TCGETATTR\${SEDfC}1\${SEDfD}
"
else
  echo "${ac_t}no"
  :
fi
rm -f conftest*
echo $ac_n "checking for TCSAFLUSH in termios.h""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <termios.h>
int main() { exit(0); }
int t() { int x = TCSAFLUSH; }
EOF
if eval $compile; then
  echo "${ac_t}yes"
  echo "#define" HAVE_TCSAFLUSH "1" >> confdefs.h
DEFS="$DEFS -DHAVE_TCSAFLUSH=1"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_TCSAFLUSH\${SEDdB}HAVE_TCSAFLUSH\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_TCSAFLUSH\${SEDuB}HAVE_TCSAFLUSH\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_TCSAFLUSH\${SEDeB}HAVE_TCSAFLUSH\${SEDeC}1\${SEDeD}
\${SEDfA}HAVE_TCSAFLUSH\${SEDfB}HAVE_TCSAFLUSH\${SEDfC}1\${SEDfD}
"
else
  echo "${ac_t}no"
  :
fi
rm -f conftest*
  ;;
  *) ;;
esac

                      echo checking for X11
X_INCLUDES=''
X_LIBS=''
if test -z "$HAVE_XMKMF"; then
  # Extract the first word of `xmkmf', so it can be a program name with args.
  set dummy xmkmf; word=$2
  echo $ac_n "checking for $word""... $ac_c"
  IFS="${IFS= 	}"; saveifs="$IFS"; IFS="${IFS}:"
  for dir in $PATH; do
    test -z "$dir" && dir=.
    if test -f $dir/$word; then
      HAVE_XMKMF="yes"
      break
    fi
  done
  IFS="$saveifs"
  echo "${ac_t}using $HAVE_XMKMF"
fi
if test "$HAVE_XMKMF" = yes; then
  echo "#define" HAVE_X11 "1" >> confdefs.h
DEFS="$DEFS -DHAVE_X11=1"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_X11\${SEDdB}HAVE_X11\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_X11\${SEDuB}HAVE_X11\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_X11\${SEDeB}HAVE_X11\${SEDeC}1\${SEDeD}
\${SEDfA}HAVE_X11\${SEDfB}HAVE_X11\${SEDfC}1\${SEDfD}
"
  X_LIBS='-lX11'
  # If we find X, set shell vars x_includes and x_libraries to the paths.
echo $ac_n "checking for X include and library files with xmkmf""... $ac_c"
rm -fr conftestdir
if mkdir conftestdir; then
  cd conftestdir
  cat > Imakefile <<EOF
acfindx:
	@echo "x_includes=\$(INCROOT); x_libraries=\$(USRLIBDIR)"
EOF
  if xmkmf >/dev/null 2>/dev/null && test -f Makefile; then
    eval `make acfindx`
  fi
  cd ..
  rm -fr conftestdir
fi
if test -n "$x_includes" && test -n "$x_libraries"; then
  echo "${ac_t}yes"
else
  echo "${ac_t}no"
fi
  if test -n "$x_includes"; then
    # Adding -I/usr/include may override gcc's private include hierarchy.
    if test "$x_includes" != "/usr/include"; then
      X_INCLUDES="-I$x_includes"
    fi
  fi
  if test -n "$x_libraries"; then
    X_LIBS="-L$x_libraries "$X_LIBS
  fi
else
      echo $ac_n "checking for X11 header files""... $ac_c"
  cat > conftest.c <<EOF
#include "confdefs.h"
#include <X11/Intrinsic.h>
EOF
err=`eval "($CPP conftest.c >/dev/null) 2>&1""$COHERENT"`
if test -z "$err"; then
  have_x_includes=1
fi
rm -f conftest*
  if test -z "$have_x_includes"; then
    for dir in /usr/X11/include /usr/openwin/include /usr/include/X11R5 /usr/X11R5/include /usr/include/X11R4 /usr/X386/include /usr/x386/include /usr/local/include /usr/unsupported/include; do
      if test -z "$have_x_includes"; then
        if test -r $dir/X11/Intrinsic.h; then
          x_includes="$dir"
          have_x_includes=1
        fi
      fi
    done
  fi
  if test -n "$x_includes"; then
    X_INCLUDES="-I$x_includes"
  fi
  echo "${ac_t}$X_INCLUDES"
  echo $ac_n "checking for X11 library""... $ac_c"
  LIBS_save="${LIBS}"
LIBS="${LIBS} -lX11"
have_lib=""
echo $ac_n "checking for -lX11""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"

int main() { exit(0); }
int t() { main(); }
EOF
if eval $compile; then
  echo "${ac_t}yes"
  have_lib="1"
else
  echo "${ac_t}no"
  :
fi
rm -f conftest*
LIBS="${LIBS_save}"
if test -n "${have_lib}"; then
   :; have_x_libraries=1
else
   :; 
fi
  if test -z "$have_x_libraries"; then
    for dir in /usr/X11/lib /usr/openwin/lib /usr/lib/X11R5 /usr/X11R5/lib /usr/lib/X11R4 /usr/X386/lib /usr/x386/lib /usr/local/lib /usr/unsupported/lib; do
      if test -z "$have_x_libraries"; then
        if test -r $dir/libX11.a; then
          x_libraries="$dir"
          have_x_libraries=1
        fi
      fi
    done
  fi
  if test -n "$have_x_libraries"; then
    X_LIBS='-lX11'
    if test -n "$x_libraries"; then
      X_LIBS="-L$x_libraries "$X_LIBS
    fi
  else
    LIBS_save="${LIBS}"
LIBS="${LIBS} -lXwindow"
have_lib=""
echo $ac_n "checking for -lXwindow""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"

int main() { exit(0); }
int t() { main(); }
EOF
if eval $compile; then
  echo "${ac_t}yes"
  have_lib="1"
else
  echo "${ac_t}no"
  :
fi
rm -f conftest*
LIBS="${LIBS_save}"
if test -n "${have_lib}"; then
   :; X_LIBS='-lXwindow' have_x_libraries=1
else
   :; 
fi
  fi
  echo "${ac_t}$X_LIBS"
    if test -n "$have_x_includes" -a -n "$have_x_libraries"; then
    echo "#define" HAVE_X11 "1" >> confdefs.h
DEFS="$DEFS -DHAVE_X11=1"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_X11\${SEDdB}HAVE_X11\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_X11\${SEDuB}HAVE_X11\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_X11\${SEDeB}HAVE_X11\${SEDeC}1\${SEDeD}
\${SEDfA}HAVE_X11\${SEDfB}HAVE_X11\${SEDfC}1\${SEDfD}
"
  else
    X_INCLUDES=''
    X_LIBS=''
  fi
fi

                      echo $ac_n "checking for size_t in sys/types.h""... $ac_c"
echo '#include "confdefs.h"
#include <sys/types.h>' > conftest.c
eval "$CPP conftest.c > conftest.out 2>&1"
if egrep "size_t" conftest.out >/dev/null 2>&1; then
  echo "${ac_t}yes"
else
  echo "${ac_t}no"
echo "#define" size_t "unsigned" >> confdefs.h
DEFS="$DEFS -Dsize_t=unsigned"
SEDDEFS="${SEDDEFS}\${SEDdA}size_t\${SEDdB}size_t\${SEDdC}unsigned\${SEDdD}
\${SEDuA}size_t\${SEDuB}size_t\${SEDuC}unsigned\${SEDuD}
\${SEDeA}size_t\${SEDeB}size_t\${SEDeC}unsigned\${SEDeD}
\${SEDfA}size_t\${SEDfB}size_t\${SEDfC}unsigned\${SEDfD}
"
fi
rm -f conftest*

                      echo $ac_n "checking for pid_t in sys/types.h""... $ac_c"
echo '#include "confdefs.h"
#include <sys/types.h>' > conftest.c
eval "$CPP conftest.c > conftest.out 2>&1"
if egrep "pid_t" conftest.out >/dev/null 2>&1; then
  echo "${ac_t}yes"
else
  echo "${ac_t}no"
echo "#define" pid_t "int" >> confdefs.h
DEFS="$DEFS -Dpid_t=int"
SEDDEFS="${SEDDEFS}\${SEDdA}pid_t\${SEDdB}pid_t\${SEDdC}int\${SEDdD}
\${SEDuA}pid_t\${SEDuB}pid_t\${SEDuC}int\${SEDuD}
\${SEDeA}pid_t\${SEDeB}pid_t\${SEDeC}int\${SEDeD}
\${SEDfA}pid_t\${SEDfB}pid_t\${SEDfC}int\${SEDfD}
"
fi
rm -f conftest*

                      echo $ac_n "checking for uid_t in sys/types.h""... $ac_c"
echo '#include "confdefs.h"
#include <sys/types.h>' > conftest.c
eval "$CPP conftest.c > conftest.out 2>&1"
if egrep "uid_t" conftest.out >/dev/null 2>&1; then
  echo "${ac_t}yes"
else
  echo "${ac_t}no"
echo "#define" uid_t "int" >> confdefs.h
DEFS="$DEFS -Duid_t=int"
SEDDEFS="${SEDDEFS}\${SEDdA}uid_t\${SEDdB}uid_t\${SEDdC}int\${SEDdD}
\${SEDuA}uid_t\${SEDuB}uid_t\${SEDuC}int\${SEDuD}
\${SEDeA}uid_t\${SEDeB}uid_t\${SEDeC}int\${SEDeD}
\${SEDfA}uid_t\${SEDfB}uid_t\${SEDfC}int\${SEDfD}
"
echo "#define" gid_t "int" >> confdefs.h
DEFS="$DEFS -Dgid_t=int"
SEDDEFS="${SEDDEFS}\${SEDdA}gid_t\${SEDdB}gid_t\${SEDdC}int\${SEDdD}
\${SEDuA}gid_t\${SEDuB}gid_t\${SEDuC}int\${SEDuD}
\${SEDeA}gid_t\${SEDeB}gid_t\${SEDeC}int\${SEDeD}
\${SEDfA}gid_t\${SEDfB}gid_t\${SEDfC}int\${SEDfD}
"
fi
rm -f conftest*

                      echo $ac_n "checking for off_t in sys/types.h""... $ac_c"
echo '#include "confdefs.h"
#include <sys/types.h>' > conftest.c
eval "$CPP conftest.c > conftest.out 2>&1"
if egrep "off_t" conftest.out >/dev/null 2>&1; then
  echo "${ac_t}yes"
else
  echo "${ac_t}no"
echo "#define" off_t "long" >> confdefs.h
DEFS="$DEFS -Doff_t=long"
SEDDEFS="${SEDDEFS}\${SEDdA}off_t\${SEDdB}off_t\${SEDdC}long\${SEDdD}
\${SEDuA}off_t\${SEDuB}off_t\${SEDuC}long\${SEDuD}
\${SEDeA}off_t\${SEDeB}off_t\${SEDeC}long\${SEDeD}
\${SEDfA}off_t\${SEDfB}off_t\${SEDfC}long\${SEDfD}
"
fi
rm -f conftest*

                      echo $ac_n "checking for caddr_t in sys/types.h""... $ac_c"
echo '#include "confdefs.h"
#include <sys/types.h>' > conftest.c
eval "$CPP conftest.c > conftest.out 2>&1"
if egrep "caddr_t" conftest.out >/dev/null 2>&1; then
  echo "${ac_t}yes"
echo "#define" CADDR_T "caddr_t" >> confdefs.h
DEFS="$DEFS -DCADDR_T=caddr_t"
SEDDEFS="${SEDDEFS}\${SEDdA}CADDR_T\${SEDdB}CADDR_T\${SEDdC}caddr_t\${SEDdD}
\${SEDuA}CADDR_T\${SEDuB}CADDR_T\${SEDuC}caddr_t\${SEDuD}
\${SEDeA}CADDR_T\${SEDeB}CADDR_T\${SEDeC}caddr_t\${SEDeD}
\${SEDfA}CADDR_T\${SEDfB}CADDR_T\${SEDfC}caddr_t\${SEDfD}
"
else
  echo "${ac_t}no"
echo "#define" CADDR_T "void*" >> confdefs.h
DEFS="$DEFS -DCADDR_T=void*"
SEDDEFS="${SEDDEFS}\${SEDdA}CADDR_T\${SEDdB}CADDR_T\${SEDdC}void*\${SEDdD}
\${SEDuA}CADDR_T\${SEDuB}CADDR_T\${SEDuC}void*\${SEDuD}
\${SEDeA}CADDR_T\${SEDeB}CADDR_T\${SEDeC}void*\${SEDeD}
\${SEDfA}CADDR_T\${SEDfB}CADDR_T\${SEDfC}void*\${SEDfD}
"
fi
rm -f conftest*


                      echo $ac_n "checking for clock_t in sys/types.h etc.""... $ac_c"
echo '#include "confdefs.h"
#include <sys/types.h>' > conftest.c
eval "$CPP conftest.c > conftest.out 2>&1"
if egrep "clock_t" conftest.out >/dev/null 2>&1; then
  have_clock=1
fi
rm -f conftest*
if test -z "$have_clock"; then
echo '#include "confdefs.h"
#include <sys/times.h>' > conftest.c
eval "$CPP conftest.c > conftest.out 2>&1"
if egrep "clock_t" conftest.out >/dev/null 2>&1; then
  have_clock=1
fi
rm -f conftest*
fi
if test -z "$have_clock"; then
echo '#include "confdefs.h"
#include <time.h>' > conftest.c
eval "$CPP conftest.c > conftest.out 2>&1"
if egrep "clock_t" conftest.out >/dev/null 2>&1; then
  have_clock=1
fi
rm -f conftest*
fi
if test -z "$have_clock"; then
echo "${ac_t}no"
echo "#define" CLOCK_T "int" >> confdefs.h
DEFS="$DEFS -DCLOCK_T=int"
SEDDEFS="${SEDDEFS}\${SEDdA}CLOCK_T\${SEDdB}CLOCK_T\${SEDdC}int\${SEDdD}
\${SEDuA}CLOCK_T\${SEDuB}CLOCK_T\${SEDuC}int\${SEDuD}
\${SEDeA}CLOCK_T\${SEDeB}CLOCK_T\${SEDeC}int\${SEDeD}
\${SEDfA}CLOCK_T\${SEDfB}CLOCK_T\${SEDfC}int\${SEDfD}
"
else
echo "${ac_t}yes"
echo "#define" CLOCK_T "clock_t" >> confdefs.h
DEFS="$DEFS -DCLOCK_T=clock_t"
SEDDEFS="${SEDDEFS}\${SEDdA}CLOCK_T\${SEDdB}CLOCK_T\${SEDdC}clock_t\${SEDdD}
\${SEDuA}CLOCK_T\${SEDuB}CLOCK_T\${SEDuC}clock_t\${SEDuD}
\${SEDeA}CLOCK_T\${SEDeB}CLOCK_T\${SEDeC}clock_t\${SEDeD}
\${SEDfA}CLOCK_T\${SEDfB}CLOCK_T\${SEDfC}clock_t\${SEDfD}
"
fi

                      echo $ac_n "checking for d_namlen in struct dirent""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <dirent.h>
int main() { exit(0); }
int t() { struct dirent d; d.d_namlen; }
EOF
if eval $compile; then
  echo "${ac_t}yes"
  :
else
  echo "${ac_t}no"
  echo "#define" DIRENT_WITHOUT_NAMLEN "1" >> confdefs.h
DEFS="$DEFS -DDIRENT_WITHOUT_NAMLEN=1"
SEDDEFS="${SEDDEFS}\${SEDdA}DIRENT_WITHOUT_NAMLEN\${SEDdB}DIRENT_WITHOUT_NAMLEN\${SEDdC}1\${SEDdD}
\${SEDuA}DIRENT_WITHOUT_NAMLEN\${SEDuB}DIRENT_WITHOUT_NAMLEN\${SEDuC}1\${SEDuD}
\${SEDeA}DIRENT_WITHOUT_NAMLEN\${SEDeB}DIRENT_WITHOUT_NAMLEN\${SEDeC}1\${SEDeD}
\${SEDfA}DIRENT_WITHOUT_NAMLEN\${SEDfB}DIRENT_WITHOUT_NAMLEN\${SEDfC}1\${SEDfD}
"
fi
rm -f conftest*


                      echo $ac_n "checking for struct tm in sys/time.h""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <sys/types.h>
#include <sys/time.h>
int main() { exit(0); }
int t() { struct tm *tp; tp->tm_sec; }
EOF
if eval $compile; then
  echo "${ac_t}yes"
  echo "#define" TM_IN_SYS_TIME "1" >> confdefs.h
DEFS="$DEFS -DTM_IN_SYS_TIME=1"
SEDDEFS="${SEDDEFS}\${SEDdA}TM_IN_SYS_TIME\${SEDdB}TM_IN_SYS_TIME\${SEDdC}1\${SEDdD}
\${SEDuA}TM_IN_SYS_TIME\${SEDuB}TM_IN_SYS_TIME\${SEDuC}1\${SEDuD}
\${SEDeA}TM_IN_SYS_TIME\${SEDeB}TM_IN_SYS_TIME\${SEDeC}1\${SEDeD}
\${SEDfA}TM_IN_SYS_TIME\${SEDfB}TM_IN_SYS_TIME\${SEDfC}1\${SEDfD}
"
else
  echo "${ac_t}no"
  :
fi
rm -f conftest*

                      echo $ac_n "checking for strlen declaration""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <string.h>
#ifdef strlen
is a macro
#endif

EOF
eval "$CPP conftest.c > conftest.out 2>&1"
if egrep "is a macro" conftest.out >/dev/null 2>&1; then
  strlen_macro=1
fi
rm -f conftest*
if test -n "$strlen_macro"; then
echo "${ac_t}macro"
else
cat > conftest.c <<EOF
#include "confdefs.h"
#define strlen foo
#include <string.h>
extern
#ifdef __cplusplus
"C"
#endif
int strlen();
main() { exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  x="int"
else
  x="size_t"
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
echo "#define" RETSTRLENTYPE "$x" >> confdefs.h
DEFS="$DEFS -DRETSTRLENTYPE=$x"
SEDDEFS="${SEDDEFS}\${SEDdA}RETSTRLENTYPE\${SEDdB}RETSTRLENTYPE\${SEDdC}$x\${SEDdD}
\${SEDuA}RETSTRLENTYPE\${SEDuB}RETSTRLENTYPE\${SEDuC}$x\${SEDuD}
\${SEDeA}RETSTRLENTYPE\${SEDeB}RETSTRLENTYPE\${SEDeC}$x\${SEDeD}
\${SEDfA}RETSTRLENTYPE\${SEDfB}RETSTRLENTYPE\${SEDfC}$x\${SEDfD}
"
cat > conftest.c <<EOF
#include "confdefs.h"
#define strlen foo
#include <string.h>
extern
#ifdef __cplusplus
"C"
#endif
#ifdef __STDC__
RETSTRLENTYPE strlen (char* s);
#else
RETSTRLENTYPE strlen();
#endif
main() { exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  y=""
else
  y="const"
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
echo "#define" STRLEN_CONST "$y" >> confdefs.h
DEFS="$DEFS -DSTRLEN_CONST=$y"
SEDDEFS="${SEDDEFS}\${SEDdA}STRLEN_CONST\${SEDdB}STRLEN_CONST\${SEDdC}$y\${SEDdD}
\${SEDuA}STRLEN_CONST\${SEDuB}STRLEN_CONST\${SEDuC}$y\${SEDuD}
\${SEDeA}STRLEN_CONST\${SEDeB}STRLEN_CONST\${SEDeC}$y\${SEDeD}
\${SEDfA}STRLEN_CONST\${SEDfB}STRLEN_CONST\${SEDfC}$y\${SEDfD}
"
ac_proto=`echo "extern $x strlen ($y char*);" | tr -s ' ' | sed -e 's/( /(/g'`
echo "${ac_t}${ac_tt}${ac_proto}"
fi

                      for func in memset
do
trfunc=HAVE_`echo $func | tr '[a-z]' '[A-Z]'`
echo $ac_n "checking for ${func}""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <ctype.h>
#ifdef __cplusplus
extern "C" char ${func}();
#endif
int main() { exit(0); }
int t() { 
/* The GNU C library defines this for functions which it implements
    to always fail with ENOSYS.  Some functions are actually named
    something starting with __ and the normal name is an alias.  */
#if defined (__stub_${func}) || defined (__stub___${func})
choke me
#else
#ifndef __cplusplus
/* Override any gcc2 internal prototype to avoid an error.  */
extern char ${func}();
#endif
${func}();
#endif
 }
EOF
if eval $compile; then
  echo "${ac_t}yes"
  echo "#define" ${trfunc} "1" >> confdefs.h
DEFS="$DEFS -D${trfunc}=1"
SEDDEFS="${SEDDEFS}\${SEDdA}${trfunc}\${SEDdB}${trfunc}\${SEDdC}1\${SEDdD}
\${SEDuA}${trfunc}\${SEDuB}${trfunc}\${SEDuC}1\${SEDuD}
\${SEDeA}${trfunc}\${SEDeB}${trfunc}\${SEDeC}1\${SEDeD}
\${SEDfA}${trfunc}\${SEDfB}${trfunc}\${SEDfC}1\${SEDfD}
"
else
  echo "${ac_t}no"
  :
fi
rm -f conftest*
done

                      echo $ac_n "checking for broken HP/UX and SunOS malloc""... $ac_c"
# Note that HP-UX has two different malloc() implementations.
# Both are broken. When used with CLISP, the one in the default libc.a
# leads to a SIGSEGV, the one in libmalloc.a leads to a SIGBUS.
# The SunOS 4.1.1 malloc() breaks when used by CLISP's generational GC.
os_name=`(uname -s) 2> /dev/null`
if test "$os_name" = HP-UX -o "$os_name" = SunOS ; then
echo "${ac_t}yes"
# Remedy: Use GNU malloc.
GMALLOC=gmalloc
else
echo "${ac_t}no"
GMALLOC=''
fi


                      echo $ac_n "checking for malloc declaration""... $ac_c"
echo '#include "confdefs.h"
#include <stdlib.h>' > conftest.c
eval "$CPP conftest.c > conftest.out 2>&1"
if egrep "void.*\*.*malloc" conftest.out >/dev/null 2>&1; then
  malloc_void=1
fi
rm -f conftest*
if test -z "$malloc_void"; then
cat > conftest.c <<EOF
#include "confdefs.h"

#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
extern
#ifdef __cplusplus
"C"
#endif
void* malloc();
main() { exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  malloc_void=1
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
fi
if test -n "$malloc_void"; then
retmalloctype="void*"
else
retmalloctype="char*"
fi
echo "#define" RETMALLOCTYPE "$retmalloctype" >> confdefs.h
DEFS="$DEFS -DRETMALLOCTYPE=$retmalloctype"
SEDDEFS="${SEDDEFS}\${SEDdA}RETMALLOCTYPE\${SEDdB}RETMALLOCTYPE\${SEDdC}$retmalloctype\${SEDdD}
\${SEDuA}RETMALLOCTYPE\${SEDuB}RETMALLOCTYPE\${SEDuC}$retmalloctype\${SEDuD}
\${SEDeA}RETMALLOCTYPE\${SEDeB}RETMALLOCTYPE\${SEDeC}$retmalloctype\${SEDeD}
\${SEDfA}RETMALLOCTYPE\${SEDfB}RETMALLOCTYPE\${SEDfC}$retmalloctype\${SEDfD}
"
cat > conftest.c <<EOF
#include "confdefs.h"

#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
extern
#ifdef __cplusplus
"C"
#endif
#ifdef __STDC__
RETMALLOCTYPE malloc (unsigned int size);
#else
RETMALLOCTYPE malloc();
#endif
main() { exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  y="unsigned int"
else
  y="size_t"
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
echo "#define" MALLOC_SIZE_T "$y" >> confdefs.h
DEFS="$DEFS -DMALLOC_SIZE_T=$y"
SEDDEFS="${SEDDEFS}\${SEDdA}MALLOC_SIZE_T\${SEDdB}MALLOC_SIZE_T\${SEDdC}$y\${SEDdD}
\${SEDuA}MALLOC_SIZE_T\${SEDuB}MALLOC_SIZE_T\${SEDuC}$y\${SEDuD}
\${SEDeA}MALLOC_SIZE_T\${SEDeB}MALLOC_SIZE_T\${SEDeC}$y\${SEDeD}
\${SEDfA}MALLOC_SIZE_T\${SEDfB}MALLOC_SIZE_T\${SEDfC}$y\${SEDfD}
"
ac_proto=`echo "extern $retmalloctype malloc ($y);" | tr -s ' ' | sed -e 's/( /(/g'`
echo "${ac_t}${ac_tt}${ac_proto}"

                      echo $ac_n "checking for free declaration""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"

#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
extern
#ifdef __cplusplus
"C"
#endif
int free();
main() { exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  x="int"
else
  x="void"
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
echo "#define" RETFREETYPE "$x" >> confdefs.h
DEFS="$DEFS -DRETFREETYPE=$x"
SEDDEFS="${SEDDEFS}\${SEDdA}RETFREETYPE\${SEDdB}RETFREETYPE\${SEDdC}$x\${SEDdD}
\${SEDuA}RETFREETYPE\${SEDuB}RETFREETYPE\${SEDuC}$x\${SEDuD}
\${SEDeA}RETFREETYPE\${SEDeB}RETFREETYPE\${SEDeC}$x\${SEDeD}
\${SEDfA}RETFREETYPE\${SEDfB}RETFREETYPE\${SEDfC}$x\${SEDfD}
"
ac_proto=`echo "extern $x free ($retmalloctype);" | tr -s ' ' | sed -e 's/( /(/g'`
echo "${ac_t}${ac_tt}${ac_proto}"

                      # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
# for constant arguments.  Useless!
echo $ac_n "checking for working alloca.h""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <alloca.h>
int main() { exit(0); }
int t() { char *p = alloca(2 * sizeof(int)); }
EOF
if eval $compile; then
  echo "${ac_t}yes"
  echo "#define" HAVE_ALLOCA_H "1" >> confdefs.h
DEFS="$DEFS -DHAVE_ALLOCA_H=1"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_ALLOCA_H\${SEDdB}HAVE_ALLOCA_H\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_ALLOCA_H\${SEDuB}HAVE_ALLOCA_H\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_ALLOCA_H\${SEDeB}HAVE_ALLOCA_H\${SEDeC}1\${SEDeD}
\${SEDfA}HAVE_ALLOCA_H\${SEDfB}HAVE_ALLOCA_H\${SEDfC}1\${SEDfD}
"
else
  echo "${ac_t}no"
  :
fi
rm -f conftest*
decl="#ifdef __GNUC__
#define alloca __builtin_alloca
#else
#ifdef HAVE_ALLOCA_H
#include <alloca.h>
#else
#ifdef _AIX
 #pragma alloca
#else
char *alloca ();
#endif
#endif
#endif
"
echo $ac_n "checking for alloca""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
$decl
int main() { exit(0); }
int t() { char *p = (char *) alloca(1); }
EOF
if eval $compile; then
  echo "${ac_t}yes"
  :
else
  echo "${ac_t}no"
  alloca_missing=1
fi
rm -f conftest*
if test -n "$alloca_missing"; then
  # The SVR3 libPW and SVR4 libucb both contain incompatible functions
  # that cause trouble.  Some versions do not even contain alloca or
  # contain a buggy version.  If you still want to use their alloca,
  # use ar to extract alloca.o from them instead of compiling alloca.c.
  ALLOCA=alloca.o
  echo "#define" NO_ALLOCA "1" >> confdefs.h
DEFS="$DEFS -DNO_ALLOCA=1"
SEDDEFS="${SEDDEFS}\${SEDdA}NO_ALLOCA\${SEDdB}NO_ALLOCA\${SEDdC}1\${SEDdD}
\${SEDuA}NO_ALLOCA\${SEDuB}NO_ALLOCA\${SEDuC}1\${SEDuD}
\${SEDeA}NO_ALLOCA\${SEDeB}NO_ALLOCA\${SEDeC}1\${SEDeD}
\${SEDfA}NO_ALLOCA\${SEDfB}NO_ALLOCA\${SEDfC}1\${SEDfD}
"
fi

                      echo $ac_n "checking for _setjmp""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <ctype.h>
#ifdef __cplusplus
extern "C" char _setjmp();
#endif
int main() { exit(0); }
int t() { 
/* The GNU C library defines this for functions which it implements
    to always fail with ENOSYS.  Some functions are actually named
    something starting with __ and the normal name is an alias.  */
#if defined (__stub__setjmp) || defined (__stub____setjmp)
choke me
#else
#ifndef __cplusplus
/* Override any gcc2 internal prototype to avoid an error.  */
extern char _setjmp();
#endif
_setjmp();
#endif
 }
EOF
if eval $compile; then
  echo "${ac_t}yes"
  :
else
  echo "${ac_t}no"
  no__jmp=1
fi
rm -f conftest*
if test -z "$no__jmp"; then
echo $ac_n "checking for _longjmp""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <ctype.h>
#ifdef __cplusplus
extern "C" char _longjmp();
#endif
int main() { exit(0); }
int t() { 
/* The GNU C library defines this for functions which it implements
    to always fail with ENOSYS.  Some functions are actually named
    something starting with __ and the normal name is an alias.  */
#if defined (__stub__longjmp) || defined (__stub____longjmp)
choke me
#else
#ifndef __cplusplus
/* Override any gcc2 internal prototype to avoid an error.  */
extern char _longjmp();
#endif
_longjmp();
#endif
 }
EOF
if eval $compile; then
  echo "${ac_t}yes"
  :
else
  echo "${ac_t}no"
  no__jmp=1
fi
rm -f conftest*
fi
if test -z "$no__jmp"; then
echo "#define" HAVE__JMP "1" >> confdefs.h
DEFS="$DEFS -DHAVE__JMP=1"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE__JMP\${SEDdB}HAVE__JMP\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE__JMP\${SEDuB}HAVE__JMP\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE__JMP\${SEDeB}HAVE__JMP\${SEDeC}1\${SEDeD}
\${SEDfA}HAVE__JMP\${SEDfB}HAVE__JMP\${SEDfC}1\${SEDfD}
"
fi
echo '#include "confdefs.h"
#include <setjmp.h>' > conftest.c
eval "$CPP conftest.c > conftest.out 2>&1"
if egrep "void.* longjmp" conftest.out >/dev/null 2>&1; then
  :
else
  echo "#define" LONGJMP_RETURNS "1" >> confdefs.h
DEFS="$DEFS -DLONGJMP_RETURNS=1"
SEDDEFS="${SEDDEFS}\${SEDdA}LONGJMP_RETURNS\${SEDdB}LONGJMP_RETURNS\${SEDdC}1\${SEDdD}
\${SEDuA}LONGJMP_RETURNS\${SEDuB}LONGJMP_RETURNS\${SEDuC}1\${SEDuD}
\${SEDeA}LONGJMP_RETURNS\${SEDeB}LONGJMP_RETURNS\${SEDeC}1\${SEDeD}
\${SEDfA}LONGJMP_RETURNS\${SEDfB}LONGJMP_RETURNS\${SEDfC}1\${SEDfD}
"
fi
rm -f conftest*


                      echo $ac_n "checking return type of signal handlers""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <sys/types.h>
#include <signal.h>
#ifdef signal
#undef signal
#endif
extern
#ifdef __cplusplus
"C"
#endif
void (*signal ()) ();
int main() { exit(0); }
int t() { int i; }
EOF
if eval $compile; then
  retsigtype=void
else
  retsigtype=int
fi
rm -f conftest*

echo "${ac_t}$retsigtype"
echo "#define" RETSIGTYPE "$retsigtype" >> confdefs.h
DEFS="$DEFS -DRETSIGTYPE=$retsigtype"
SEDDEFS="${SEDDEFS}\${SEDdA}RETSIGTYPE\${SEDdB}RETSIGTYPE\${SEDdC}$retsigtype\${SEDdD}
\${SEDuA}RETSIGTYPE\${SEDuB}RETSIGTYPE\${SEDuC}$retsigtype\${SEDuD}
\${SEDeA}RETSIGTYPE\${SEDeB}RETSIGTYPE\${SEDeC}$retsigtype\${SEDeD}
\${SEDfA}RETSIGTYPE\${SEDfB}RETSIGTYPE\${SEDfC}$retsigtype\${SEDfD}
"

                      echo $ac_n "checking whether signal handlers need to be reinstalled""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"

#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <signal.h>
/* volatile */ int gotsig=0;
RETSIGTYPE sigalrm_handler() { gotsig=1; }
int got_sig () { return gotsig; }
typedef RETSIGTYPE (*signal_handler) ();
main() { /* returns 0 if they need not to be reinstalled */
  signal(SIGALRM,(signal_handler)sigalrm_handler); alarm(1); while (!got_sig());
  exit(!( (signal_handler)signal(SIGALRM,(signal_handler)sigalrm_handler)
          == (signal_handler)sigalrm_handler
      ) );
}
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  echo "${ac_t}no"
else
  echo "${ac_t}yes"
echo "#define" SIGNAL_NEED_REINSTALL "1" >> confdefs.h
DEFS="$DEFS -DSIGNAL_NEED_REINSTALL=1"
SEDDEFS="${SEDDEFS}\${SEDdA}SIGNAL_NEED_REINSTALL\${SEDdB}SIGNAL_NEED_REINSTALL\${SEDdC}1\${SEDdD}
\${SEDuA}SIGNAL_NEED_REINSTALL\${SEDuB}SIGNAL_NEED_REINSTALL\${SEDuC}1\${SEDuD}
\${SEDeA}SIGNAL_NEED_REINSTALL\${SEDeB}SIGNAL_NEED_REINSTALL\${SEDeC}1\${SEDeD}
\${SEDfA}SIGNAL_NEED_REINSTALL\${SEDfB}SIGNAL_NEED_REINSTALL\${SEDfC}1\${SEDfD}
"
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*

                      echo $ac_n "checking for sighold""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <ctype.h>
#ifdef __cplusplus
extern "C" char sighold();
#endif
int main() { exit(0); }
int t() { 
/* The GNU C library defines this for functions which it implements
    to always fail with ENOSYS.  Some functions are actually named
    something starting with __ and the normal name is an alias.  */
#if defined (__stub_sighold) || defined (__stub___sighold)
choke me
#else
#ifndef __cplusplus
/* Override any gcc2 internal prototype to avoid an error.  */
extern char sighold();
#endif
sighold();
#endif
 }
EOF
if eval $compile; then
  echo "${ac_t}yes"
  echo "#define" SIGNALBLOCK_SYSV "1" >> confdefs.h
DEFS="$DEFS -DSIGNALBLOCK_SYSV=1"
SEDDEFS="${SEDDEFS}\${SEDdA}SIGNALBLOCK_SYSV\${SEDdB}SIGNALBLOCK_SYSV\${SEDdC}1\${SEDdD}
\${SEDuA}SIGNALBLOCK_SYSV\${SEDuB}SIGNALBLOCK_SYSV\${SEDuC}1\${SEDuD}
\${SEDeA}SIGNALBLOCK_SYSV\${SEDeB}SIGNALBLOCK_SYSV\${SEDeC}1\${SEDeD}
\${SEDfA}SIGNALBLOCK_SYSV\${SEDfB}SIGNALBLOCK_SYSV\${SEDfC}1\${SEDfD}
"
else
  echo "${ac_t}no"
  :
fi
rm -f conftest*
echo '#include "confdefs.h"
#include <signal.h>' > conftest.c
eval "$CPP conftest.c > conftest.out 2>&1"
if egrep "sigset_t" conftest.out >/dev/null 2>&1; then
  :
else
  signals_not_posix=1
fi
rm -f conftest*
if test -z "$signals_not_posix"; then
echo $ac_n "checking for sigprocmask""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <ctype.h>
#ifdef __cplusplus
extern "C" char sigprocmask();
#endif
int main() { exit(0); }
int t() { 
/* The GNU C library defines this for functions which it implements
    to always fail with ENOSYS.  Some functions are actually named
    something starting with __ and the normal name is an alias.  */
#if defined (__stub_sigprocmask) || defined (__stub___sigprocmask)
choke me
#else
#ifndef __cplusplus
/* Override any gcc2 internal prototype to avoid an error.  */
extern char sigprocmask();
#endif
sigprocmask();
#endif
 }
EOF
if eval $compile; then
  echo "${ac_t}yes"
  echo "#define" SIGNALBLOCK_POSIX "1" >> confdefs.h
DEFS="$DEFS -DSIGNALBLOCK_POSIX=1"
SEDDEFS="${SEDDEFS}\${SEDdA}SIGNALBLOCK_POSIX\${SEDdB}SIGNALBLOCK_POSIX\${SEDdC}1\${SEDdD}
\${SEDuA}SIGNALBLOCK_POSIX\${SEDuB}SIGNALBLOCK_POSIX\${SEDuC}1\${SEDuD}
\${SEDeA}SIGNALBLOCK_POSIX\${SEDeB}SIGNALBLOCK_POSIX\${SEDeC}1\${SEDeD}
\${SEDfA}SIGNALBLOCK_POSIX\${SEDfB}SIGNALBLOCK_POSIX\${SEDfC}1\${SEDfD}
"
else
  echo "${ac_t}no"
  :
fi
rm -f conftest*
fi
echo $ac_n "checking for sigblock""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <ctype.h>
#ifdef __cplusplus
extern "C" char sigblock();
#endif
int main() { exit(0); }
int t() { 
/* The GNU C library defines this for functions which it implements
    to always fail with ENOSYS.  Some functions are actually named
    something starting with __ and the normal name is an alias.  */
#if defined (__stub_sigblock) || defined (__stub___sigblock)
choke me
#else
#ifndef __cplusplus
/* Override any gcc2 internal prototype to avoid an error.  */
extern char sigblock();
#endif
sigblock();
#endif
 }
EOF
if eval $compile; then
  echo "${ac_t}yes"
  echo "#define" SIGNALBLOCK_BSD "1" >> confdefs.h
DEFS="$DEFS -DSIGNALBLOCK_BSD=1"
SEDDEFS="${SEDDEFS}\${SEDdA}SIGNALBLOCK_BSD\${SEDdB}SIGNALBLOCK_BSD\${SEDdC}1\${SEDdD}
\${SEDuA}SIGNALBLOCK_BSD\${SEDuB}SIGNALBLOCK_BSD\${SEDuC}1\${SEDuD}
\${SEDeA}SIGNALBLOCK_BSD\${SEDeB}SIGNALBLOCK_BSD\${SEDeC}1\${SEDeD}
\${SEDfA}SIGNALBLOCK_BSD\${SEDfB}SIGNALBLOCK_BSD\${SEDfC}1\${SEDfD}
"
else
  echo "${ac_t}no"
  :
fi
rm -f conftest*

                      case "$DEFS" in
  *SIGNALBLOCK_BSD*)
echo $ac_n "checking whether signals are blocked when signal handlers are entered""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"

#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <signal.h>
int gotsig=0;
int wasblocked=0;
typedef RETSIGTYPE (*signal_handler) ();
RETSIGTYPE sigalrm_handler()
{ gotsig=1;
#ifdef SIGNAL_NEED_REINSTALL
  signal(SIGALRM,(signal_handler)sigalrm_handler);
#endif
#ifdef SIGNALBLOCK_POSIX
  { sigset_t blocked;
    sigprocmask(SIG_BLOCK, (sigset_t *) 0, &blocked);
    wasblocked = sigismember(&blocked,SIGALRM) ? 1 : 0;
  }
#else
  wasblocked = ((sigblock(0) & sigmask(SIGALRM)) != 0);
#endif
}
int got_sig () { return gotsig; }
main() { /* returns 0 if they need not to be unblocked */
  signal(SIGALRM,(signal_handler)sigalrm_handler); alarm(1); while (!got_sig());
  exit(wasblocked);
}
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  echo "${ac_t}no"
else
  echo "${ac_t}yes"
echo "#define" SIGNAL_NEED_UNBLOCK "1" >> confdefs.h
DEFS="$DEFS -DSIGNAL_NEED_UNBLOCK=1"
SEDDEFS="${SEDDEFS}\${SEDdA}SIGNAL_NEED_UNBLOCK\${SEDdB}SIGNAL_NEED_UNBLOCK\${SEDdC}1\${SEDdD}
\${SEDuA}SIGNAL_NEED_UNBLOCK\${SEDuB}SIGNAL_NEED_UNBLOCK\${SEDuC}1\${SEDuD}
\${SEDeA}SIGNAL_NEED_UNBLOCK\${SEDeB}SIGNAL_NEED_UNBLOCK\${SEDeC}1\${SEDeD}
\${SEDfA}SIGNAL_NEED_UNBLOCK\${SEDfB}SIGNAL_NEED_UNBLOCK\${SEDfC}1\${SEDfD}
"
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
  ;;
  *) ;;
esac

                      case "$DEFS" in
  *SIGNALBLOCK_POSIX*)
echo $ac_n "checking for sigprocmask declaration""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"

#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <signal.h>
extern
#ifdef __cplusplus
"C"
#endif
#ifdef __STDC__
int sigprocmask (int how, sigset_t* set, sigset_t* oset);
#else
int sigprocmask();
#endif
main() { exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  x=""
else
  x="const"
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
echo "#define" SIGPROCMASK_CONST "$x" >> confdefs.h
DEFS="$DEFS -DSIGPROCMASK_CONST=$x"
SEDDEFS="${SEDDEFS}\${SEDdA}SIGPROCMASK_CONST\${SEDdB}SIGPROCMASK_CONST\${SEDdC}$x\${SEDdD}
\${SEDuA}SIGPROCMASK_CONST\${SEDuB}SIGPROCMASK_CONST\${SEDuC}$x\${SEDuD}
\${SEDeA}SIGPROCMASK_CONST\${SEDeB}SIGPROCMASK_CONST\${SEDeC}$x\${SEDeD}
\${SEDfA}SIGPROCMASK_CONST\${SEDfB}SIGPROCMASK_CONST\${SEDfC}$x\${SEDfD}
"
ac_proto=`echo "extern int sigprocmask (int, $x sigset_t*, sigset_t*);" | tr -s ' ' | sed -e 's/( /(/g'`
echo "${ac_t}${ac_tt}${ac_proto}"
  ;;
  *) ;;
esac

                      echo $ac_n "checking for sigaction""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <ctype.h>
#ifdef __cplusplus
extern "C" char sigaction();
#endif
int main() { exit(0); }
int t() { 
/* The GNU C library defines this for functions which it implements
    to always fail with ENOSYS.  Some functions are actually named
    something starting with __ and the normal name is an alias.  */
#if defined (__stub_sigaction) || defined (__stub___sigaction)
choke me
#else
#ifndef __cplusplus
/* Override any gcc2 internal prototype to avoid an error.  */
extern char sigaction();
#endif
sigaction();
#endif
 }
EOF
if eval $compile; then
  echo "${ac_t}yes"
  echo "#define" HAVE_SIGACTION "1" >> confdefs.h
DEFS="$DEFS -DHAVE_SIGACTION=1"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_SIGACTION\${SEDdB}HAVE_SIGACTION\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_SIGACTION\${SEDuB}HAVE_SIGACTION\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_SIGACTION\${SEDeB}HAVE_SIGACTION\${SEDeC}1\${SEDeD}
\${SEDfA}HAVE_SIGACTION\${SEDfB}HAVE_SIGACTION\${SEDfC}1\${SEDfD}
"
have_sigaction=1
else
  echo "${ac_t}no"
  :
fi
rm -f conftest*

                      echo $ac_n "checking for siginterrupt""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <ctype.h>
#ifdef __cplusplus
extern "C" char siginterrupt();
#endif
int main() { exit(0); }
int t() { 
/* The GNU C library defines this for functions which it implements
    to always fail with ENOSYS.  Some functions are actually named
    something starting with __ and the normal name is an alias.  */
#if defined (__stub_siginterrupt) || defined (__stub___siginterrupt)
choke me
#else
#ifndef __cplusplus
/* Override any gcc2 internal prototype to avoid an error.  */
extern char siginterrupt();
#endif
siginterrupt();
#endif
 }
EOF
if eval $compile; then
  echo "${ac_t}yes"
  echo "#define" HAVE_SIGINTERRUPT "1" >> confdefs.h
DEFS="$DEFS -DHAVE_SIGINTERRUPT=1"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_SIGINTERRUPT\${SEDdB}HAVE_SIGINTERRUPT\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_SIGINTERRUPT\${SEDuB}HAVE_SIGINTERRUPT\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_SIGINTERRUPT\${SEDeB}HAVE_SIGINTERRUPT\${SEDeC}1\${SEDeD}
\${SEDfA}HAVE_SIGINTERRUPT\${SEDfB}HAVE_SIGINTERRUPT\${SEDfC}1\${SEDfD}
"
have_siginterrupt=1
else
  echo "${ac_t}no"
  :
fi
rm -f conftest*
if test -z "$have_siginterrupt" -a -z "$have_sigaction"; then
for func in sigvec
do
trfunc=HAVE_`echo $func | tr '[a-z]' '[A-Z]'`
echo $ac_n "checking for ${func}""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <ctype.h>
#ifdef __cplusplus
extern "C" char ${func}();
#endif
int main() { exit(0); }
int t() { 
/* The GNU C library defines this for functions which it implements
    to always fail with ENOSYS.  Some functions are actually named
    something starting with __ and the normal name is an alias.  */
#if defined (__stub_${func}) || defined (__stub___${func})
choke me
#else
#ifndef __cplusplus
/* Override any gcc2 internal prototype to avoid an error.  */
extern char ${func}();
#endif
${func}();
#endif
 }
EOF
if eval $compile; then
  echo "${ac_t}yes"
  echo "#define" ${trfunc} "1" >> confdefs.h
DEFS="$DEFS -D${trfunc}=1"
SEDDEFS="${SEDDEFS}\${SEDdA}${trfunc}\${SEDdB}${trfunc}\${SEDdC}1\${SEDdD}
\${SEDuA}${trfunc}\${SEDuB}${trfunc}\${SEDuC}1\${SEDuD}
\${SEDeA}${trfunc}\${SEDeB}${trfunc}\${SEDeC}1\${SEDeD}
\${SEDfA}${trfunc}\${SEDfB}${trfunc}\${SEDfC}1\${SEDfD}
"
else
  echo "${ac_t}no"
  :
fi
rm -f conftest*
done
fi

                      echo $ac_n "checking for abort declaration""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"

#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
extern
#ifdef __cplusplus
"C"
#endif
int abort();
main() { exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  x="int"
else
  x="void"
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
echo "#define" RETABORTTYPE "$x" >> confdefs.h
DEFS="$DEFS -DRETABORTTYPE=$x"
SEDDEFS="${SEDDEFS}\${SEDdA}RETABORTTYPE\${SEDdB}RETABORTTYPE\${SEDdC}$x\${SEDdD}
\${SEDuA}RETABORTTYPE\${SEDuB}RETABORTTYPE\${SEDuC}$x\${SEDuD}
\${SEDeA}RETABORTTYPE\${SEDeB}RETABORTTYPE\${SEDeC}$x\${SEDeD}
\${SEDfA}RETABORTTYPE\${SEDfB}RETABORTTYPE\${SEDfC}$x\${SEDfD}
"
cat > conftest.c <<EOF
#include "confdefs.h"

#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
extern
#ifdef __cplusplus
"C"
#endif
RETABORTTYPE abort();
main() { exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  y=""
else
  y="__volatile__"
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
echo "#define" ABORT_VOLATILE "$y" >> confdefs.h
DEFS="$DEFS -DABORT_VOLATILE=$y"
SEDDEFS="${SEDDEFS}\${SEDdA}ABORT_VOLATILE\${SEDdB}ABORT_VOLATILE\${SEDdC}$y\${SEDdD}
\${SEDuA}ABORT_VOLATILE\${SEDuB}ABORT_VOLATILE\${SEDuC}$y\${SEDuD}
\${SEDeA}ABORT_VOLATILE\${SEDeB}ABORT_VOLATILE\${SEDeC}$y\${SEDeD}
\${SEDfA}ABORT_VOLATILE\${SEDfB}ABORT_VOLATILE\${SEDfC}$y\${SEDfD}
"
ac_proto=`echo "extern $y $x abort (void);" | tr -s ' ' | sed -e 's/( /(/g'`
echo "${ac_t}${ac_tt}${ac_proto}"

                      echo $ac_n "checking for sys_errlist declaration""... $ac_c"
brackets='[]'
cat > conftest.c <<EOF
#include "confdefs.h"

/* Most systems declare sys_errlist in <errno.h>, NetBSD 1.0 in <stdio.h>. */
#include <stdio.h>
#include <errno.h>
extern char* sys_errlist $brackets ;
main() { exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  x=""
else
  x="const"
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
echo "#define" SYS_ERRLIST_CONST "$x" >> confdefs.h
DEFS="$DEFS -DSYS_ERRLIST_CONST=$x"
SEDDEFS="${SEDDEFS}\${SEDdA}SYS_ERRLIST_CONST\${SEDdB}SYS_ERRLIST_CONST\${SEDdC}$x\${SEDdD}
\${SEDuA}SYS_ERRLIST_CONST\${SEDuB}SYS_ERRLIST_CONST\${SEDuC}$x\${SEDuD}
\${SEDeA}SYS_ERRLIST_CONST\${SEDeB}SYS_ERRLIST_CONST\${SEDeC}$x\${SEDeD}
\${SEDfA}SYS_ERRLIST_CONST\${SEDfB}SYS_ERRLIST_CONST\${SEDfC}$x\${SEDfD}
"
ac_proto=`echo "extern $x char* $x sys_errlist$brackets;" | tr -s ' ' | sed -e 's/( /(/g'`
echo "${ac_t}${ac_tt}${ac_proto}"

                      echo $ac_n "checking for getenv declaration""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"

#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
extern
#ifdef __cplusplus
"C"
#endif
#ifdef __STDC__
char* getenv (char* name);
#else
char* getenv();
#endif
main() { exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  x=""
else
  x="const"
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
echo "#define" GETENV_CONST "$x" >> confdefs.h
DEFS="$DEFS -DGETENV_CONST=$x"
SEDDEFS="${SEDDEFS}\${SEDdA}GETENV_CONST\${SEDdB}GETENV_CONST\${SEDdC}$x\${SEDdD}
\${SEDuA}GETENV_CONST\${SEDuB}GETENV_CONST\${SEDuC}$x\${SEDuD}
\${SEDeA}GETENV_CONST\${SEDeB}GETENV_CONST\${SEDeC}$x\${SEDeD}
\${SEDfA}GETENV_CONST\${SEDfB}GETENV_CONST\${SEDfC}$x\${SEDfD}
"
ac_proto=`echo "extern char* getenv ($x char*);" | tr -s ' ' | sed -e 's/( /(/g'`
echo "${ac_t}${ac_tt}${ac_proto}"

                      echo $ac_n "checking for vfork.h""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <vfork.h>
EOF
err=`eval "($CPP conftest.c >/dev/null) 2>&1""$COHERENT"`
if test -z "$err"; then
  echo "${ac_t}yes"
echo "#define" HAVE_VFORK_H "1" >> confdefs.h
DEFS="$DEFS -DHAVE_VFORK_H=1"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_VFORK_H\${SEDdB}HAVE_VFORK_H\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_VFORK_H\${SEDuB}HAVE_VFORK_H\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_VFORK_H\${SEDeB}HAVE_VFORK_H\${SEDeC}1\${SEDeD}
\${SEDfA}HAVE_VFORK_H\${SEDfB}HAVE_VFORK_H\${SEDfC}1\${SEDfD}
"
else
  echo "${ac_t}no"

fi
rm -f conftest*
echo $ac_n "checking for working vfork""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
/* Thanks to Paul Eggert for this test.  */
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <signal.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_VFORK_H
#include <vfork.h>
#endif
static int signalled;
static RETSIGTYPE
#ifdef __STDC__
catch (int s)
#else
catch (s) int s;
#endif
{ signalled = 1; }
main() {
  pid_t parent = getpid();
  pid_t child;
  signal (SIGINT, catch);
  child = vfork ();
  if (child == 0) {
    /* On sparc systems, changes by the child to local and incoming
       argument registers are propagated back to the parent.
       The compiler is told about this with #include <vfork.h>,
       but some compilers (e.g. gcc -O) don't grok <vfork.h>.
       Test for this by using lots of local variables, at least
       as many local variables as main has allocated so far
       including compiler temporaries.  4 locals are enough for
       gcc 1.40.3 on a sparc, but we use 8 to be safe.
       A buggy compiler should reuse the register of parent
       for one of the local variables, since it will think that
       parent can't possibly be used any more in this routine.
       Assigning to the local variable will thus munge parent
       in the parent process.  */
    pid_t
      p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(),
      p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid();
    /* Convince the compiler that p..p7 are live; otherwise, it might
       use the same hardware register for all 8 local variables.  */
    if (p != p1 || p != p2 || p != p3 || p != p4
	|| p != p5 || p != p6 || p != p7)
      _exit(1);
    /* On some systems (e.g. SunOS 5.2), if the parent is catching
       a signal, the child ignores the signal before execing,
       and the parent later receives that signal, the parent dumps core.
       Test for this by ignoring SIGINT in the child.  */
    signal (SIGINT, SIG_IGN);
    /* On some systems (e.g. IRIX 3.3),
       vfork doesn't separate parent from child file descriptors.
       If the child closes a descriptor before it execs or exits,
       this munges the parent's descriptor as well.
       Test for this by closing stdout in the child.  */
    _exit(close(fileno(stdout)) != 0);
  } else {
    int status;
    struct stat st;
    while (wait(&status) != child) ;
    exit(
	 /* Was there some problem with vforking?  */
	 child < 0
	 /* Did the child fail?  (This shouldn't happen.)  */
	 || status
	 /* Did the vfork/compiler bug occur?  */
	 || parent != getpid()
	 /* Did the signal handling bug occur?  */
	 || kill(parent, SIGINT) != 0
	 || signalled != 1
	 /* Did the file descriptor bug occur?  */
	 || fstat(fileno(stdout), &st) != 0
	 );
  }
}
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  echo "${ac_t}yes"
else
  rm -f core
echo "${ac_t}no"
echo "#define" vfork "fork" >> confdefs.h
DEFS="$DEFS -Dvfork=fork"
SEDDEFS="${SEDDEFS}\${SEDdA}vfork\${SEDdB}vfork\${SEDdC}fork\${SEDdD}
\${SEDuA}vfork\${SEDuB}vfork\${SEDuC}fork\${SEDuD}
\${SEDeA}vfork\${SEDeB}vfork\${SEDeC}fork\${SEDeD}
\${SEDfA}vfork\${SEDfB}vfork\${SEDfC}fork\${SEDfD}
"
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*

                      echo $ac_n "checking for vfork declaration""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"

#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_VFORK_H
#include <vfork.h>
#endif
extern
#ifdef __cplusplus
"C"
#endif
#ifdef __STDC__
pid_t vfork (void);
#else
pid_t vfork();
#endif
main() { exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  x="pid_t"
else
  x="int"
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
echo "#define" RETVFORKTYPE "$x" >> confdefs.h
DEFS="$DEFS -DRETVFORKTYPE=$x"
SEDDEFS="${SEDDEFS}\${SEDdA}RETVFORKTYPE\${SEDdB}RETVFORKTYPE\${SEDdC}$x\${SEDdD}
\${SEDuA}RETVFORKTYPE\${SEDuB}RETVFORKTYPE\${SEDuC}$x\${SEDuD}
\${SEDeA}RETVFORKTYPE\${SEDeB}RETVFORKTYPE\${SEDeC}$x\${SEDeD}
\${SEDfA}RETVFORKTYPE\${SEDfB}RETVFORKTYPE\${SEDfC}$x\${SEDfD}
"
ac_proto=`echo "extern $x vfork (void);" | tr -s ' ' | sed -e 's/( /(/g'`
echo "${ac_t}${ac_tt}${ac_proto}"

                      for func in setsid setpgid
do
trfunc=HAVE_`echo $func | tr '[a-z]' '[A-Z]'`
echo $ac_n "checking for ${func}""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <ctype.h>
#ifdef __cplusplus
extern "C" char ${func}();
#endif
int main() { exit(0); }
int t() { 
/* The GNU C library defines this for functions which it implements
    to always fail with ENOSYS.  Some functions are actually named
    something starting with __ and the normal name is an alias.  */
#if defined (__stub_${func}) || defined (__stub___${func})
choke me
#else
#ifndef __cplusplus
/* Override any gcc2 internal prototype to avoid an error.  */
extern char ${func}();
#endif
${func}();
#endif
 }
EOF
if eval $compile; then
  echo "${ac_t}yes"
  echo "#define" ${trfunc} "1" >> confdefs.h
DEFS="$DEFS -D${trfunc}=1"
SEDDEFS="${SEDDEFS}\${SEDdA}${trfunc}\${SEDdB}${trfunc}\${SEDdC}1\${SEDdD}
\${SEDuA}${trfunc}\${SEDuB}${trfunc}\${SEDuC}1\${SEDuD}
\${SEDeA}${trfunc}\${SEDeB}${trfunc}\${SEDeC}1\${SEDeD}
\${SEDfA}${trfunc}\${SEDfB}${trfunc}\${SEDfC}1\${SEDfD}
"
else
  echo "${ac_t}no"
  :
fi
rm -f conftest*
done

                      echo $ac_n "checking for execv declaration""... $ac_c"
brackets='[]'
for z in '' 'const'; do
for y in '' 'const'; do
for x in '' 'const'; do
if test -z "$have_execv"; then
cat > conftest.c <<EOF
#include "confdefs.h"

#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
extern
#ifdef __cplusplus
"C"
#endif
#ifdef __STDC__
int execv ($x char* path, $y char* $z argv[]);
#else
int execv();
#endif
main() { exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  echo "#define" EXECV_CONST "$x" >> confdefs.h
DEFS="$DEFS -DEXECV_CONST=$x"
SEDDEFS="${SEDDEFS}\${SEDdA}EXECV_CONST\${SEDdB}EXECV_CONST\${SEDdC}$x\${SEDdD}
\${SEDuA}EXECV_CONST\${SEDuB}EXECV_CONST\${SEDuC}$x\${SEDuD}
\${SEDeA}EXECV_CONST\${SEDeB}EXECV_CONST\${SEDeC}$x\${SEDeD}
\${SEDfA}EXECV_CONST\${SEDfB}EXECV_CONST\${SEDfC}$x\${SEDfD}
"
echo "#define" EXECV1_CONST "$y" >> confdefs.h
DEFS="$DEFS -DEXECV1_CONST=$y"
SEDDEFS="${SEDDEFS}\${SEDdA}EXECV1_CONST\${SEDdB}EXECV1_CONST\${SEDdC}$y\${SEDdD}
\${SEDuA}EXECV1_CONST\${SEDuB}EXECV1_CONST\${SEDuC}$y\${SEDuD}
\${SEDeA}EXECV1_CONST\${SEDeB}EXECV1_CONST\${SEDeC}$y\${SEDeD}
\${SEDfA}EXECV1_CONST\${SEDfB}EXECV1_CONST\${SEDfC}$y\${SEDfD}
"
echo "#define" EXECV2_CONST "$z" >> confdefs.h
DEFS="$DEFS -DEXECV2_CONST=$z"
SEDDEFS="${SEDDEFS}\${SEDdA}EXECV2_CONST\${SEDdB}EXECV2_CONST\${SEDdC}$z\${SEDdD}
\${SEDuA}EXECV2_CONST\${SEDuB}EXECV2_CONST\${SEDuC}$z\${SEDuD}
\${SEDeA}EXECV2_CONST\${SEDeB}EXECV2_CONST\${SEDeC}$z\${SEDeD}
\${SEDfA}EXECV2_CONST\${SEDfB}EXECV2_CONST\${SEDfC}$z\${SEDfD}
"
ac_proto=`echo "extern int execv ($x char*, $y char* $z$brackets);" | tr -s ' ' | sed -e 's/( /(/g'`
echo "${ac_t}${ac_tt}${ac_proto}"
execv_const="$x"
have_execv=1
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
fi
done
done
done

                      echo $ac_n "checking for execl declaration""... $ac_c"
for x in '' 'const'; do
if test -z "$have_execl"; then
cat > conftest.c <<EOF
#include "confdefs.h"

#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
extern
#ifdef __cplusplus
"C"
#endif
#ifdef __STDC__
int execl (EXECV_CONST char* path, $x char* arg, ...);
#else
int execl();
#endif
main() { exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  echo "#define" EXECL_CONST "$x" >> confdefs.h
DEFS="$DEFS -DEXECL_CONST=$x"
SEDDEFS="${SEDDEFS}\${SEDdA}EXECL_CONST\${SEDdB}EXECL_CONST\${SEDdC}$x\${SEDdD}
\${SEDuA}EXECL_CONST\${SEDuB}EXECL_CONST\${SEDuC}$x\${SEDuD}
\${SEDeA}EXECL_CONST\${SEDeB}EXECL_CONST\${SEDeC}$x\${SEDeD}
\${SEDfA}EXECL_CONST\${SEDfB}EXECL_CONST\${SEDfC}$x\${SEDfD}
"
echo "#define" EXECL_DOTS "1" >> confdefs.h
DEFS="$DEFS -DEXECL_DOTS=1"
SEDDEFS="${SEDDEFS}\${SEDdA}EXECL_DOTS\${SEDdB}EXECL_DOTS\${SEDdC}1\${SEDdD}
\${SEDuA}EXECL_DOTS\${SEDuB}EXECL_DOTS\${SEDuC}1\${SEDuD}
\${SEDeA}EXECL_DOTS\${SEDeB}EXECL_DOTS\${SEDeC}1\${SEDeD}
\${SEDfA}EXECL_DOTS\${SEDfB}EXECL_DOTS\${SEDfC}1\${SEDfD}
"
ac_proto=`echo "extern int execl ($execv_const char*, $x char*, ...);" | tr -s ' ' | sed -e 's/( /(/g'`
echo "${ac_t}${ac_tt}${ac_proto}"
have_execl=1
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
fi
done
for x in '' 'const'; do
if test -z "$have_execl"; then
cat > conftest.c <<EOF
#include "confdefs.h"

#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
extern
#ifdef __cplusplus
"C"
#endif
#ifdef __STDC__
int execl (EXECV_CONST char* path, $x char* arg0, $x char* arg1, $x char* arg2, $x char* arg3);
#else
int execl();
#endif
main() { exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  echo "#define" EXECL_CONST "$x" >> confdefs.h
DEFS="$DEFS -DEXECL_CONST=$x"
SEDDEFS="${SEDDEFS}\${SEDdA}EXECL_CONST\${SEDdB}EXECL_CONST\${SEDdC}$x\${SEDdD}
\${SEDuA}EXECL_CONST\${SEDuB}EXECL_CONST\${SEDuC}$x\${SEDuD}
\${SEDeA}EXECL_CONST\${SEDeB}EXECL_CONST\${SEDeC}$x\${SEDeD}
\${SEDfA}EXECL_CONST\${SEDfB}EXECL_CONST\${SEDfC}$x\${SEDfD}
"
ac_proto=`echo "extern int execl ($execv_const char*, $x char*, $x char*, $x char*, $x char*);" | tr -s ' ' | sed -e 's/( /(/g'`
echo "${ac_t}${ac_tt}${ac_proto}"
have_execl=1
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
fi
done

                      echo $ac_n "checking for waitpid""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <ctype.h>
#ifdef __cplusplus
extern "C" char waitpid();
#endif
int main() { exit(0); }
int t() { 
/* The GNU C library defines this for functions which it implements
    to always fail with ENOSYS.  Some functions are actually named
    something starting with __ and the normal name is an alias.  */
#if defined (__stub_waitpid) || defined (__stub___waitpid)
choke me
#else
#ifndef __cplusplus
/* Override any gcc2 internal prototype to avoid an error.  */
extern char waitpid();
#endif
waitpid();
#endif
 }
EOF
if eval $compile; then
  echo "${ac_t}yes"
  echo "#define" HAVE_WAITPID "1" >> confdefs.h
DEFS="$DEFS -DHAVE_WAITPID=1"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_WAITPID\${SEDdB}HAVE_WAITPID\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_WAITPID\${SEDuB}HAVE_WAITPID\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_WAITPID\${SEDeB}HAVE_WAITPID\${SEDeC}1\${SEDeD}
\${SEDfA}HAVE_WAITPID\${SEDfB}HAVE_WAITPID\${SEDfC}1\${SEDfD}
"
have_waitpid=1
else
  echo "${ac_t}no"
  :
fi
rm -f conftest*
if test -n "$have_waitpid"; then
echo $ac_n "checking for waitpid declaration""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"

#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
extern
#ifdef __cplusplus
"C"
#endif
#ifdef __STDC__
pid_t waitpid (pid_t pid, int* statusp, int options);
#else
pid_t waitpid();
#endif
main() { exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  x="pid_t"
else
  x="int"
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
echo "#define" PID_T "$x" >> confdefs.h
DEFS="$DEFS -DPID_T=$x"
SEDDEFS="${SEDDEFS}\${SEDdA}PID_T\${SEDdB}PID_T\${SEDdC}$x\${SEDdD}
\${SEDuA}PID_T\${SEDuB}PID_T\${SEDuC}$x\${SEDuD}
\${SEDeA}PID_T\${SEDeB}PID_T\${SEDeC}$x\${SEDeD}
\${SEDfA}PID_T\${SEDfB}PID_T\${SEDfC}$x\${SEDfD}
"
ac_proto=`echo "extern pid_t waitpid ($x, int*, int);" | tr -s ' ' | sed -e 's/( /(/g'`
echo "${ac_t}${ac_tt}${ac_proto}"
else
for hdr in sys/wait.h
do
trhdr=HAVE_`echo $hdr | tr '[a-z]./' '[A-Z]__'`
echo $ac_n "checking for ${hdr}""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <${hdr}>
EOF
err=`eval "($CPP conftest.c >/dev/null) 2>&1""$COHERENT"`
if test -z "$err"; then
  echo "${ac_t}yes"
echo "#define" ${trhdr} "1" >> confdefs.h
DEFS="$DEFS -D${trhdr}=1"
SEDDEFS="${SEDDEFS}\${SEDdA}${trhdr}\${SEDdB}${trhdr}\${SEDdC}1\${SEDdD}
\${SEDuA}${trhdr}\${SEDuB}${trhdr}\${SEDuC}1\${SEDuD}
\${SEDeA}${trhdr}\${SEDeB}${trhdr}\${SEDeC}1\${SEDeD}
\${SEDfA}${trhdr}\${SEDfB}${trhdr}\${SEDfC}1\${SEDfD}
"
else
  echo "${ac_t}no"

fi
rm -f conftest*
done
fi

                      for hdr in sys/resource.h sys/times.h
do
trhdr=HAVE_`echo $hdr | tr '[a-z]./' '[A-Z]__'`
echo $ac_n "checking for ${hdr}""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <${hdr}>
EOF
err=`eval "($CPP conftest.c >/dev/null) 2>&1""$COHERENT"`
if test -z "$err"; then
  echo "${ac_t}yes"
echo "#define" ${trhdr} "1" >> confdefs.h
DEFS="$DEFS -D${trhdr}=1"
SEDDEFS="${SEDDEFS}\${SEDdA}${trhdr}\${SEDdB}${trhdr}\${SEDdC}1\${SEDdD}
\${SEDuA}${trhdr}\${SEDuB}${trhdr}\${SEDuC}1\${SEDuD}
\${SEDeA}${trhdr}\${SEDeB}${trhdr}\${SEDeC}1\${SEDeD}
\${SEDfA}${trhdr}\${SEDfB}${trhdr}\${SEDfC}1\${SEDfD}
"
else
  echo "${ac_t}no"

fi
rm -f conftest*
done
case "$DEFS" in
  *HAVE_SYS_RESOURCE_H*)
    echo $ac_n "checking for getrusage""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <sys/types.h> /* NetBSD 1.0 needs this */
#include <sys/time.h>
#include <sys/resource.h>
int main() { exit(0); }
int t() { struct rusage x; int y = RUSAGE_SELF; getrusage(y,&x); x.ru_utime.tv_sec; }
EOF
if eval $compile; then
  echo "${ac_t}yes"
  echo "#define" HAVE_GETRUSAGE "1" >> confdefs.h
DEFS="$DEFS -DHAVE_GETRUSAGE=1"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_GETRUSAGE\${SEDdB}HAVE_GETRUSAGE\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_GETRUSAGE\${SEDuB}HAVE_GETRUSAGE\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_GETRUSAGE\${SEDeB}HAVE_GETRUSAGE\${SEDeC}1\${SEDeD}
\${SEDfA}HAVE_GETRUSAGE\${SEDfB}HAVE_GETRUSAGE\${SEDfC}1\${SEDfD}
"
else
  echo "${ac_t}no"
  :
fi
rm -f conftest*
    ;;
  *) ;;
esac

                      echo $ac_n "checking for getwd""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"

int main() { exit(0); }
int t() { getwd(); }
EOF
if eval $compile; then
  echo "${ac_t}yes"
  echo "#define" HAVE_GETWD "1" >> confdefs.h
DEFS="$DEFS -DHAVE_GETWD=1"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_GETWD\${SEDdB}HAVE_GETWD\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_GETWD\${SEDuB}HAVE_GETWD\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_GETWD\${SEDeB}HAVE_GETWD\${SEDeC}1\${SEDeD}
\${SEDfA}HAVE_GETWD\${SEDfB}HAVE_GETWD\${SEDfC}1\${SEDfD}
"
else
  echo "${ac_t}no"
  :
fi
rm -f conftest*


                      case "$DEFS" in
  *HAVE_GETWD*) ;;
  *)
echo $ac_n "checking for getcwd declaration""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"

#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
extern
#ifdef __cplusplus
"C"
#endif
#ifdef __STDC__
char* getcwd (char* buf, int bufsize);
#else
char* getcwd();
#endif
main() { exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  x="int"
else
  x="size_t"
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
echo "#define" GETCWD_SIZE_T "$x" >> confdefs.h
DEFS="$DEFS -DGETCWD_SIZE_T=$x"
SEDDEFS="${SEDDEFS}\${SEDdA}GETCWD_SIZE_T\${SEDdB}GETCWD_SIZE_T\${SEDdC}$x\${SEDdD}
\${SEDuA}GETCWD_SIZE_T\${SEDuB}GETCWD_SIZE_T\${SEDuC}$x\${SEDuD}
\${SEDeA}GETCWD_SIZE_T\${SEDeB}GETCWD_SIZE_T\${SEDeC}$x\${SEDeD}
\${SEDfA}GETCWD_SIZE_T\${SEDfB}GETCWD_SIZE_T\${SEDfC}$x\${SEDfD}
"
ac_proto=`echo "extern char* getcwd (char*, $x);" | tr -s ' ' | sed -e 's/( /(/g'`
echo "${ac_t}${ac_tt}${ac_proto}"
  ;;
esac

                      echo $ac_n "checking for chdir declaration""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"

#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
extern
#ifdef __cplusplus
"C"
#endif
#ifdef __STDC__
int chdir (char* path);
#else
int chdir();
#endif
main() { exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  x=""
else
  x="const"
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
echo "#define" CHDIR_CONST "$x" >> confdefs.h
DEFS="$DEFS -DCHDIR_CONST=$x"
SEDDEFS="${SEDDEFS}\${SEDdA}CHDIR_CONST\${SEDdB}CHDIR_CONST\${SEDdC}$x\${SEDdD}
\${SEDuA}CHDIR_CONST\${SEDuB}CHDIR_CONST\${SEDuC}$x\${SEDuD}
\${SEDeA}CHDIR_CONST\${SEDeB}CHDIR_CONST\${SEDeC}$x\${SEDeD}
\${SEDfA}CHDIR_CONST\${SEDfB}CHDIR_CONST\${SEDfC}$x\${SEDfD}
"
ac_proto=`echo "extern int chdir ($x char*);" | tr -s ' ' | sed -e 's/( /(/g'`
echo "${ac_t}${ac_tt}${ac_proto}"

                      echo $ac_n "checking for mkdir declaration""... $ac_c"
echo '#include "confdefs.h"
#include <sys/types.h>' > conftest.c
eval "$CPP conftest.c > conftest.out 2>&1"
if egrep "mode_t" conftest.out >/dev/null 2>&1; then
  cat > conftest.c <<EOF
#include "confdefs.h"

#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
extern
#ifdef __cplusplus
"C"
#endif
#ifdef __STDC__
int mkdir (char* path, mode_t mode);
#else
int mkdir();
#endif
main() { exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  mode_t_unneeded=1
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
if test -z "$mode_t_unneeded"; then
cat > conftest.c <<EOF
#include "confdefs.h"

#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
extern
#ifdef __cplusplus
"C"
#endif
#ifdef __STDC__
int mkdir (const char* path, mode_t mode);
#else
int mkdir();
#endif
main() { exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  mode_t_unneeded=1
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
fi
fi
rm -f conftest*
if test -n "$mode_t_unneeded"; then
mode_t="mode_t"
else
mode_t="int"
fi
echo "#define" MODE_T "$mode_t" >> confdefs.h
DEFS="$DEFS -DMODE_T=$mode_t"
SEDDEFS="${SEDDEFS}\${SEDdA}MODE_T\${SEDdB}MODE_T\${SEDdC}$mode_t\${SEDdD}
\${SEDuA}MODE_T\${SEDuB}MODE_T\${SEDuC}$mode_t\${SEDuD}
\${SEDeA}MODE_T\${SEDeB}MODE_T\${SEDeC}$mode_t\${SEDeD}
\${SEDfA}MODE_T\${SEDfB}MODE_T\${SEDfC}$mode_t\${SEDfD}
"
cat > conftest.c <<EOF
#include "confdefs.h"

#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
extern
#ifdef __cplusplus
"C"
#endif
#ifdef __STDC__
int mkdir (char* path, MODE_T mode);
#else
int mkdir();
#endif
main() { exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  x=""
else
  x="const"
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
echo "#define" MKDIR_CONST "$x" >> confdefs.h
DEFS="$DEFS -DMKDIR_CONST=$x"
SEDDEFS="${SEDDEFS}\${SEDdA}MKDIR_CONST\${SEDdB}MKDIR_CONST\${SEDdC}$x\${SEDdD}
\${SEDuA}MKDIR_CONST\${SEDuB}MKDIR_CONST\${SEDuC}$x\${SEDuD}
\${SEDeA}MKDIR_CONST\${SEDeB}MKDIR_CONST\${SEDeC}$x\${SEDeD}
\${SEDfA}MKDIR_CONST\${SEDfB}MKDIR_CONST\${SEDfC}$x\${SEDfD}
"
ac_proto=`echo "extern int mkdir ($x char*, $mode_t);" | tr -s ' ' | sed -e 's/( /(/g'`
echo "${ac_t}${ac_tt}${ac_proto}"

                      echo $ac_n "checking for rmdir declaration""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"

#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
extern
#ifdef __cplusplus
"C"
#endif
#ifdef __STDC__
int rmdir (char* path);
#else
int rmdir();
#endif
main() { exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  x=""
else
  x="const"
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
echo "#define" RMDIR_CONST "$x" >> confdefs.h
DEFS="$DEFS -DRMDIR_CONST=$x"
SEDDEFS="${SEDDEFS}\${SEDdA}RMDIR_CONST\${SEDdB}RMDIR_CONST\${SEDdC}$x\${SEDdD}
\${SEDuA}RMDIR_CONST\${SEDuB}RMDIR_CONST\${SEDuC}$x\${SEDuD}
\${SEDeA}RMDIR_CONST\${SEDeB}RMDIR_CONST\${SEDeC}$x\${SEDeD}
\${SEDfA}RMDIR_CONST\${SEDfB}RMDIR_CONST\${SEDfC}$x\${SEDfD}
"
ac_proto=`echo "extern int rmdir ($x char*);" | tr -s ' ' | sed -e 's/( /(/g'`
echo "${ac_t}${ac_tt}${ac_proto}"

                      echo $ac_n "checking for working stat file mode macros""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <sys/types.h>
#include <sys/stat.h>
#ifdef S_ISBLK
#if S_ISBLK (S_IFDIR)
You lose.
#endif
#ifdef S_IFCHR
#if S_ISBLK (S_IFCHR)
You lose.
#endif
#endif /* S_IFCHR */
#endif /* S_ISBLK */
#ifdef S_ISLNK
#if S_ISLNK (S_IFREG)
You lose.
#endif
#endif /* S_ISLNK */
#ifdef S_ISSOCK
#if S_ISSOCK (S_IFREG)
You lose.
#endif
#endif /* S_ISSOCK */

EOF
eval "$CPP conftest.c > conftest.out 2>&1"
if egrep "You lose" conftest.out >/dev/null 2>&1; then
  echo "${ac_t}no"
echo "#define" STAT_MACROS_BROKEN "1" >> confdefs.h
DEFS="$DEFS -DSTAT_MACROS_BROKEN=1"
SEDDEFS="${SEDDEFS}\${SEDdA}STAT_MACROS_BROKEN\${SEDdB}STAT_MACROS_BROKEN\${SEDdC}1\${SEDdD}
\${SEDuA}STAT_MACROS_BROKEN\${SEDuB}STAT_MACROS_BROKEN\${SEDuC}1\${SEDuD}
\${SEDeA}STAT_MACROS_BROKEN\${SEDeB}STAT_MACROS_BROKEN\${SEDeC}1\${SEDeD}
\${SEDfA}STAT_MACROS_BROKEN\${SEDfB}STAT_MACROS_BROKEN\${SEDfC}1\${SEDfD}
"
else
  echo "${ac_t}yes"
fi
rm -f conftest*

                      echo $ac_n "checking for stat declaration""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"

#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
extern
#ifdef __cplusplus
"C"
#endif
#ifdef __STDC__
int stat (char* path, struct stat * buf);
#else
int stat();
#endif
main() { exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  x=""
else
  x="const"
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
echo "#define" STAT_CONST "$x" >> confdefs.h
DEFS="$DEFS -DSTAT_CONST=$x"
SEDDEFS="${SEDDEFS}\${SEDdA}STAT_CONST\${SEDdB}STAT_CONST\${SEDdC}$x\${SEDdD}
\${SEDuA}STAT_CONST\${SEDuB}STAT_CONST\${SEDuC}$x\${SEDuD}
\${SEDeA}STAT_CONST\${SEDeB}STAT_CONST\${SEDeC}$x\${SEDeD}
\${SEDfA}STAT_CONST\${SEDfB}STAT_CONST\${SEDfC}$x\${SEDfD}
"
ac_proto=`echo "extern int stat ($x char*, struct stat *);" | tr -s ' ' | sed -e 's/( /(/g'`
echo "${ac_t}${ac_tt}${ac_proto}"

                      echo $ac_n "checking for lstat""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <ctype.h>
#ifdef __cplusplus
extern "C" char lstat();
#endif
int main() { exit(0); }
int t() { 
/* The GNU C library defines this for functions which it implements
    to always fail with ENOSYS.  Some functions are actually named
    something starting with __ and the normal name is an alias.  */
#if defined (__stub_lstat) || defined (__stub___lstat)
choke me
#else
#ifndef __cplusplus
/* Override any gcc2 internal prototype to avoid an error.  */
extern char lstat();
#endif
lstat();
#endif
 }
EOF
if eval $compile; then
  echo "${ac_t}yes"
  echo "#define" HAVE_LSTAT "1" >> confdefs.h
DEFS="$DEFS -DHAVE_LSTAT=1"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_LSTAT\${SEDdB}HAVE_LSTAT\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_LSTAT\${SEDuB}HAVE_LSTAT\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_LSTAT\${SEDeB}HAVE_LSTAT\${SEDeC}1\${SEDeD}
\${SEDfA}HAVE_LSTAT\${SEDfB}HAVE_LSTAT\${SEDfC}1\${SEDfD}
"
have_lstat=1
else
  echo "${ac_t}no"
  :
fi
rm -f conftest*
if test -n "$have_lstat"; then
echo $ac_n "checking for lstat declaration""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"

#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
extern
#ifdef __cplusplus
"C"
#endif
#ifdef __STDC__
int lstat (char* path, struct stat * buf);
#else
int lstat();
#endif
main() { exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  x=""
else
  x="const"
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
echo "#define" LSTAT_CONST "$x" >> confdefs.h
DEFS="$DEFS -DLSTAT_CONST=$x"
SEDDEFS="${SEDDEFS}\${SEDdA}LSTAT_CONST\${SEDdB}LSTAT_CONST\${SEDdC}$x\${SEDdD}
\${SEDuA}LSTAT_CONST\${SEDuB}LSTAT_CONST\${SEDuC}$x\${SEDuD}
\${SEDeA}LSTAT_CONST\${SEDeB}LSTAT_CONST\${SEDeC}$x\${SEDeD}
\${SEDfA}LSTAT_CONST\${SEDfB}LSTAT_CONST\${SEDfC}$x\${SEDfD}
"
ac_proto=`echo "extern int lstat ($x char*, struct stat *);" | tr -s ' ' | sed -e 's/( /(/g'`
echo "${ac_t}${ac_tt}${ac_proto}"
fi

                      echo $ac_n "checking for readlink""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <ctype.h>
#ifdef __cplusplus
extern "C" char readlink();
#endif
int main() { exit(0); }
int t() { 
/* The GNU C library defines this for functions which it implements
    to always fail with ENOSYS.  Some functions are actually named
    something starting with __ and the normal name is an alias.  */
#if defined (__stub_readlink) || defined (__stub___readlink)
choke me
#else
#ifndef __cplusplus
/* Override any gcc2 internal prototype to avoid an error.  */
extern char readlink();
#endif
readlink();
#endif
 }
EOF
if eval $compile; then
  echo "${ac_t}yes"
  echo "#define" HAVE_READLINK "1" >> confdefs.h
DEFS="$DEFS -DHAVE_READLINK=1"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_READLINK\${SEDdB}HAVE_READLINK\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_READLINK\${SEDuB}HAVE_READLINK\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_READLINK\${SEDeB}HAVE_READLINK\${SEDeC}1\${SEDeD}
\${SEDfA}HAVE_READLINK\${SEDfB}HAVE_READLINK\${SEDfC}1\${SEDfD}
"
have_readlink=1
else
  echo "${ac_t}no"
  :
fi
rm -f conftest*
if test -n "$have_readlink"; then
echo $ac_n "checking for readlink declaration""... $ac_c"
for z in 'int' 'size_t'; do
for y in 'char*' 'void*'; do
for x in '' 'const'; do
if test -z "$have_rl"; then
cat > conftest.c <<EOF
#include "confdefs.h"

#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
extern
#ifdef __cplusplus
"C"
#endif
#ifdef __STDC__
int readlink ($x char* path, $y buf, $z bufsiz);
#else
int readlink();
#endif
main() { exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  echo "#define" READLINK_CONST "$x" >> confdefs.h
DEFS="$DEFS -DREADLINK_CONST=$x"
SEDDEFS="${SEDDEFS}\${SEDdA}READLINK_CONST\${SEDdB}READLINK_CONST\${SEDdC}$x\${SEDdD}
\${SEDuA}READLINK_CONST\${SEDuB}READLINK_CONST\${SEDuC}$x\${SEDuD}
\${SEDeA}READLINK_CONST\${SEDeB}READLINK_CONST\${SEDeC}$x\${SEDeD}
\${SEDfA}READLINK_CONST\${SEDfB}READLINK_CONST\${SEDfC}$x\${SEDfD}
"
echo "#define" READLINK_BUF_T "$y" >> confdefs.h
DEFS="$DEFS -DREADLINK_BUF_T=$y"
SEDDEFS="${SEDDEFS}\${SEDdA}READLINK_BUF_T\${SEDdB}READLINK_BUF_T\${SEDdC}$y\${SEDdD}
\${SEDuA}READLINK_BUF_T\${SEDuB}READLINK_BUF_T\${SEDuC}$y\${SEDuD}
\${SEDeA}READLINK_BUF_T\${SEDeB}READLINK_BUF_T\${SEDeC}$y\${SEDeD}
\${SEDfA}READLINK_BUF_T\${SEDfB}READLINK_BUF_T\${SEDfC}$y\${SEDfD}
"
echo "#define" READLINK_SIZE_T "$z" >> confdefs.h
DEFS="$DEFS -DREADLINK_SIZE_T=$z"
SEDDEFS="${SEDDEFS}\${SEDdA}READLINK_SIZE_T\${SEDdB}READLINK_SIZE_T\${SEDdC}$z\${SEDdD}
\${SEDuA}READLINK_SIZE_T\${SEDuB}READLINK_SIZE_T\${SEDuC}$z\${SEDuD}
\${SEDeA}READLINK_SIZE_T\${SEDeB}READLINK_SIZE_T\${SEDeC}$z\${SEDeD}
\${SEDfA}READLINK_SIZE_T\${SEDfB}READLINK_SIZE_T\${SEDfC}$z\${SEDfD}
"
ac_proto=`echo "extern int readlink ($x char*, $y, $z);" | tr -s ' ' | sed -e 's/( /(/g'`
echo "${ac_t}${ac_tt}${ac_proto}"
have_rl=1
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
fi
done
done
done
fi

                      echo $ac_n "checking for ELOOP""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <errno.h>
#include <stdio.h>
#ifdef ELOOP
main () { printf("ELOOP\n"); exit(0); }
#else
extern int errno;
#define foo "conflink"
#define foobar "conflink/somefile"
main()
{ /* If a system goes into an endless loop on this, it must be really broken. */
  if (symlink(foo,foo)<0) exit(1);
  if (unlink(foobar)>=0) { unlink(foo); exit(1); }
  printf("%d\n",errno); unlink(foo); exit(0);
}
#endif
EOF
eval $compile
eloop=`./conftest`
echo "#define" ELOOP_VALUE "$eloop" >> confdefs.h
DEFS="$DEFS -DELOOP_VALUE=$eloop"
SEDDEFS="${SEDDEFS}\${SEDdA}ELOOP_VALUE\${SEDdB}ELOOP_VALUE\${SEDdC}$eloop\${SEDdD}
\${SEDuA}ELOOP_VALUE\${SEDuB}ELOOP_VALUE\${SEDuC}$eloop\${SEDuD}
\${SEDeA}ELOOP_VALUE\${SEDeB}ELOOP_VALUE\${SEDeC}$eloop\${SEDeD}
\${SEDfA}ELOOP_VALUE\${SEDfB}ELOOP_VALUE\${SEDfC}$eloop\${SEDfD}
"
if test "$eloop" = "ELOOP"; then
  echo "${ac_t}yes"
else
  echo "${ac_t}$eloop"
fi
rm -f conftest*

                      case "$DEFS" in
  *DIRENT*)
echo $ac_n "checking for opendir declaration""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"

#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <dirent.h>
extern
#ifdef __cplusplus
"C"
#endif
#ifdef __STDC__
DIR* opendir (char* dirname);
#else
DIR* opendir();
#endif
main() { exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  x=""
else
  x="const"
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
echo "#define" OPENDIR_CONST "$x" >> confdefs.h
DEFS="$DEFS -DOPENDIR_CONST=$x"
SEDDEFS="${SEDDEFS}\${SEDdA}OPENDIR_CONST\${SEDdB}OPENDIR_CONST\${SEDdC}$x\${SEDdD}
\${SEDuA}OPENDIR_CONST\${SEDuB}OPENDIR_CONST\${SEDuC}$x\${SEDuD}
\${SEDeA}OPENDIR_CONST\${SEDeB}OPENDIR_CONST\${SEDeC}$x\${SEDeD}
\${SEDfA}OPENDIR_CONST\${SEDfB}OPENDIR_CONST\${SEDfC}$x\${SEDfD}
"
ac_proto=`echo "extern DIR* opendir ($x char*);" | tr -s ' ' | sed -e 's/( /(/g'`
echo "${ac_t}${ac_tt}${ac_proto}"
  ;;
  *) ;;
esac

                      echo $ac_n "checking for open declaration""... $ac_c"
for y in 'MODE_T mode' '...'; do
for x in '' 'const'; do
if test -z "$have_open"; then
cat > conftest.c <<EOF
#include "confdefs.h"

#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <fcntl.h>
extern
#ifdef __cplusplus
"C"
#endif
#ifdef __STDC__
int open ($x char* path, int flags, $y);
#else
int open();
#endif
main() { exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  echo "#define" OPEN_CONST "$x" >> confdefs.h
DEFS="$DEFS -DOPEN_CONST=$x"
SEDDEFS="${SEDDEFS}\${SEDdA}OPEN_CONST\${SEDdB}OPEN_CONST\${SEDdC}$x\${SEDdD}
\${SEDuA}OPEN_CONST\${SEDuB}OPEN_CONST\${SEDuC}$x\${SEDuD}
\${SEDeA}OPEN_CONST\${SEDeB}OPEN_CONST\${SEDeC}$x\${SEDeD}
\${SEDfA}OPEN_CONST\${SEDfB}OPEN_CONST\${SEDfC}$x\${SEDfD}
"
if test "$y" = "..."; then
echo "#define" OPEN_DOTS "1" >> confdefs.h
DEFS="$DEFS -DOPEN_DOTS=1"
SEDDEFS="${SEDDEFS}\${SEDdA}OPEN_DOTS\${SEDdB}OPEN_DOTS\${SEDdC}1\${SEDdD}
\${SEDuA}OPEN_DOTS\${SEDuB}OPEN_DOTS\${SEDuC}1\${SEDuD}
\${SEDeA}OPEN_DOTS\${SEDeB}OPEN_DOTS\${SEDeC}1\${SEDeD}
\${SEDfA}OPEN_DOTS\${SEDfB}OPEN_DOTS\${SEDfC}1\${SEDfD}
"
ac_proto=`echo "extern int open ($x char*, int, ...);" | tr -s ' ' | sed -e 's/( /(/g'`
echo "${ac_t}${ac_tt}${ac_proto}"
else
ac_proto=`echo "extern int open ($x char*, int, $mode_t);" | tr -s ' ' | sed -e 's/( /(/g'`
echo "${ac_t}${ac_tt}${ac_proto}"
fi
have_open=1
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
fi
done
done

                      echo $ac_n "checking for read declaration""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"

#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
extern
#ifdef __cplusplus
"C"
#endif
int read();
main() { exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  retrwtype="int"
else
  retrwtype="long"
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
echo "#define" RETRWTYPE "$retrwtype" >> confdefs.h
DEFS="$DEFS -DRETRWTYPE=$retrwtype"
SEDDEFS="${SEDDEFS}\${SEDdA}RETRWTYPE\${SEDdB}RETRWTYPE\${SEDdC}$retrwtype\${SEDdD}
\${SEDuA}RETRWTYPE\${SEDuB}RETRWTYPE\${SEDuC}$retrwtype\${SEDuD}
\${SEDeA}RETRWTYPE\${SEDeB}RETRWTYPE\${SEDeC}$retrwtype\${SEDeD}
\${SEDfA}RETRWTYPE\${SEDfB}RETRWTYPE\${SEDfC}$retrwtype\${SEDfD}
"
for y in 'int' 'size_t' 'unsigned RETRWTYPE' 'off_t'; do
for x in 'char*' 'void*'; do
if test -z "$have_rw"; then
cat > conftest.c <<EOF
#include "confdefs.h"

#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
extern
#ifdef __cplusplus
"C"
#endif
#ifdef __STDC__
RETRWTYPE read (int fd, $x buf, $y count);
#else
RETRWTYPE read();
#endif
main() { exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  echo "#define" RW_BUF_T "$x" >> confdefs.h
DEFS="$DEFS -DRW_BUF_T=$x"
SEDDEFS="${SEDDEFS}\${SEDdA}RW_BUF_T\${SEDdB}RW_BUF_T\${SEDdC}$x\${SEDdD}
\${SEDuA}RW_BUF_T\${SEDuB}RW_BUF_T\${SEDuC}$x\${SEDuD}
\${SEDeA}RW_BUF_T\${SEDeB}RW_BUF_T\${SEDeC}$x\${SEDeD}
\${SEDfA}RW_BUF_T\${SEDfB}RW_BUF_T\${SEDfC}$x\${SEDfD}
"
echo "#define" RW_SIZE_T "$y" >> confdefs.h
DEFS="$DEFS -DRW_SIZE_T=$y"
SEDDEFS="${SEDDEFS}\${SEDdA}RW_SIZE_T\${SEDdB}RW_SIZE_T\${SEDdC}$y\${SEDdD}
\${SEDuA}RW_SIZE_T\${SEDuB}RW_SIZE_T\${SEDuC}$y\${SEDuD}
\${SEDeA}RW_SIZE_T\${SEDeB}RW_SIZE_T\${SEDeC}$y\${SEDeD}
\${SEDfA}RW_SIZE_T\${SEDfB}RW_SIZE_T\${SEDfC}$y\${SEDfD}
"
rw_buf_t="$x"
rw_size_t="$y"
ac_proto=`echo "extern $retrwtype read (int, $rw_buf_t, $rw_size_t);" | tr -s ' ' | sed -e 's/( /(/g'`
echo "${ac_t}${ac_tt}${ac_proto}"
have_rw=1
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
fi
done
done

                      echo $ac_n "checking for write declaration""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"

#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
extern
#ifdef __cplusplus
"C"
#endif
#ifdef __STDC__
RETRWTYPE write (int fd, RW_BUF_T buf, RW_SIZE_T count);
#else
RETRWTYPE write();
#endif
main() { exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  x=""
else
  x="const"
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
echo "#define" WRITE_CONST "$x" >> confdefs.h
DEFS="$DEFS -DWRITE_CONST=$x"
SEDDEFS="${SEDDEFS}\${SEDdA}WRITE_CONST\${SEDdB}WRITE_CONST\${SEDdC}$x\${SEDdD}
\${SEDuA}WRITE_CONST\${SEDuB}WRITE_CONST\${SEDuC}$x\${SEDuD}
\${SEDeA}WRITE_CONST\${SEDeB}WRITE_CONST\${SEDeC}$x\${SEDeD}
\${SEDfA}WRITE_CONST\${SEDfB}WRITE_CONST\${SEDfC}$x\${SEDfD}
"
ac_proto=`echo "extern $retrwtype write (int, $x $rw_buf_t, $rw_size_t);" | tr -s ' ' | sed -e 's/( /(/g'`
echo "${ac_t}${ac_tt}${ac_proto}"

                      echo $ac_n "checking for rename""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <ctype.h>
#ifdef __cplusplus
extern "C" char rename();
#endif
int main() { exit(0); }
int t() { 
/* The GNU C library defines this for functions which it implements
    to always fail with ENOSYS.  Some functions are actually named
    something starting with __ and the normal name is an alias.  */
#if defined (__stub_rename) || defined (__stub___rename)
choke me
#else
#ifndef __cplusplus
/* Override any gcc2 internal prototype to avoid an error.  */
extern char rename();
#endif
rename();
#endif
 }
EOF
if eval $compile; then
  echo "${ac_t}yes"
  echo "#define" HAVE_RENAME "1" >> confdefs.h
DEFS="$DEFS -DHAVE_RENAME=1"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_RENAME\${SEDdB}HAVE_RENAME\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_RENAME\${SEDuB}HAVE_RENAME\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_RENAME\${SEDeB}HAVE_RENAME\${SEDeC}1\${SEDeD}
\${SEDfA}HAVE_RENAME\${SEDfB}HAVE_RENAME\${SEDfC}1\${SEDfD}
"
have_rename=1
else
  echo "${ac_t}no"
  :
fi
rm -f conftest*
if test -n "$have_rename"; then
echo $ac_n "checking for rename declaration""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"

#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <stdio.h>
extern
#ifdef __cplusplus
"C"
#endif
#ifdef __STDC__
int rename (char* oldpath, char* newpath);
#else
int rename();
#endif
main() { exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  x=""
else
  x="const"
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
echo "#define" RENAME_CONST "$x" >> confdefs.h
DEFS="$DEFS -DRENAME_CONST=$x"
SEDDEFS="${SEDDEFS}\${SEDdA}RENAME_CONST\${SEDdB}RENAME_CONST\${SEDdC}$x\${SEDdD}
\${SEDuA}RENAME_CONST\${SEDuB}RENAME_CONST\${SEDuC}$x\${SEDuD}
\${SEDeA}RENAME_CONST\${SEDeB}RENAME_CONST\${SEDeC}$x\${SEDeD}
\${SEDfA}RENAME_CONST\${SEDfB}RENAME_CONST\${SEDfC}$x\${SEDfD}
"
ac_proto=`echo "extern int rename ($x char*, $x char*);" | tr -s ' ' | sed -e 's/( /(/g'`
echo "${ac_t}${ac_tt}${ac_proto}"
fi

                      echo $ac_n "checking for unlink declaration""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"

#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
extern
#ifdef __cplusplus
"C"
#endif
#ifdef __STDC__
int unlink (char* path);
#else
int unlink();
#endif
main() { exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  x=""
else
  x="const"
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
echo "#define" UNLINK_CONST "$x" >> confdefs.h
DEFS="$DEFS -DUNLINK_CONST=$x"
SEDDEFS="${SEDDEFS}\${SEDdA}UNLINK_CONST\${SEDdB}UNLINK_CONST\${SEDdC}$x\${SEDdD}
\${SEDuA}UNLINK_CONST\${SEDuB}UNLINK_CONST\${SEDuC}$x\${SEDuD}
\${SEDeA}UNLINK_CONST\${SEDeB}UNLINK_CONST\${SEDeC}$x\${SEDeD}
\${SEDfA}UNLINK_CONST\${SEDfB}UNLINK_CONST\${SEDfC}$x\${SEDfD}
"
ac_proto=`echo "extern int unlink ($x char*);" | tr -s ' ' | sed -e 's/( /(/g'`
echo "${ac_t}${ac_tt}${ac_proto}"

                      echo $ac_n "checking for fsync""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <ctype.h>
#ifdef __cplusplus
extern "C" char fsync();
#endif
int main() { exit(0); }
int t() { 
/* The GNU C library defines this for functions which it implements
    to always fail with ENOSYS.  Some functions are actually named
    something starting with __ and the normal name is an alias.  */
#if defined (__stub_fsync) || defined (__stub___fsync)
choke me
#else
#ifndef __cplusplus
/* Override any gcc2 internal prototype to avoid an error.  */
extern char fsync();
#endif
fsync();
#endif
 }
EOF
if eval $compile; then
  echo "${ac_t}yes"
  echo "#define" HAVE_FSYNC "1" >> confdefs.h
DEFS="$DEFS -DHAVE_FSYNC=1"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_FSYNC\${SEDdB}HAVE_FSYNC\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_FSYNC\${SEDuB}HAVE_FSYNC\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_FSYNC\${SEDeB}HAVE_FSYNC\${SEDeC}1\${SEDeD}
\${SEDfA}HAVE_FSYNC\${SEDfB}HAVE_FSYNC\${SEDfC}1\${SEDfD}
"
else
  echo "${ac_t}no"
  :
fi
rm -f conftest*


                      echo $ac_n "checking for ioctl declaration""... $ac_c"
ioctl_decl1='#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <sys/types.h>
#include <unistd.h>
#endif
#ifndef HAVE_TCSAFLUSH
#undef HAVE_TERMIOS_H
#endif
#ifdef HAVE_TERMIOS_H
#include <termios.h>
#else
#ifdef HAVE_SYS_TERMIO_H
#include <sys/termio.h>
#else
#ifdef HAVE_TERMIO_H
#include <termio.h>
#else
#ifdef HAVE_SGTTY_H
#include <sgtty.h>
#include <sys/ioctl.h>
#endif
#endif
#endif
#endif
'
cat > conftest.c <<EOF
#include "confdefs.h"
$ioctl_decl1
extern
#ifdef __cplusplus
"C"
#endif
char* ioctl();
main() { exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  try_sys_ioctl=1
else
  ioctl_decl="$ioctl_decl1"
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
if test -n "try_sys_ioctl"; then
ioctl_decl2='#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <sys/types.h>
#include <unistd.h>
#endif
#include <sys/ioctl.h>
'
cat > conftest.c <<EOF
#include "confdefs.h"
$ioctl_decl2
extern
#ifdef __cplusplus
"C"
#endif
char* ioctl();
main() { exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  ioctl_decl="$ioctl_decl1"
else
  ioctl_decl="$ioctl_decl2"
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
fi
for y in 'caddr_t arg' '...'; do
for x in 'int' 'unsigned long' 'long'; do
if test -z "$have_ioctl"; then
cat > conftest.c <<EOF
#include "confdefs.h"
$ioctl_decl
#ifdef INCLUDE_SYS_IOCTL_H
#include <sys/ioctl.h>
#endif
extern
#ifdef __cplusplus
"C"
#endif
#ifdef __STDC__
int ioctl (int fd, $x request, $y);
#else
int ioctl();
#endif
main() { exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  echo "#define" IOCTL_REQUEST_T "$x" >> confdefs.h
DEFS="$DEFS -DIOCTL_REQUEST_T=$x"
SEDDEFS="${SEDDEFS}\${SEDdA}IOCTL_REQUEST_T\${SEDdB}IOCTL_REQUEST_T\${SEDdC}$x\${SEDdD}
\${SEDuA}IOCTL_REQUEST_T\${SEDuB}IOCTL_REQUEST_T\${SEDuC}$x\${SEDuD}
\${SEDeA}IOCTL_REQUEST_T\${SEDeB}IOCTL_REQUEST_T\${SEDeC}$x\${SEDeD}
\${SEDfA}IOCTL_REQUEST_T\${SEDfB}IOCTL_REQUEST_T\${SEDfC}$x\${SEDfD}
"
if test "$y" = "..."; then
echo "#define" IOCTL_DOTS "1" >> confdefs.h
DEFS="$DEFS -DIOCTL_DOTS=1"
SEDDEFS="${SEDDEFS}\${SEDdA}IOCTL_DOTS\${SEDdB}IOCTL_DOTS\${SEDdC}1\${SEDdD}
\${SEDuA}IOCTL_DOTS\${SEDuB}IOCTL_DOTS\${SEDuC}1\${SEDuD}
\${SEDeA}IOCTL_DOTS\${SEDeB}IOCTL_DOTS\${SEDeC}1\${SEDeD}
\${SEDfA}IOCTL_DOTS\${SEDfB}IOCTL_DOTS\${SEDfC}1\${SEDfD}
"
ac_proto=`echo "extern int ioctl (int, $x, ...);" | tr -s ' ' | sed -e 's/( /(/g'`
echo "${ac_t}${ac_tt}${ac_proto}"
else
ac_proto=`echo "extern int ioctl (int, $x, caddr_t);" | tr -s ' ' | sed -e 's/( /(/g'`
echo "${ac_t}${ac_tt}${ac_proto}"
fi
have_ioctl=1
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
fi
done
done
ioctl_decl="$ioctl_decl1"
ioctl_prog='int x = FIONREAD;'
echo $ac_n "checking for FIONREAD""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
$ioctl_decl
int main() { exit(0); }
int t() { $ioctl_prog }
EOF
if eval $compile; then
  echo "${ac_t}yes"
  ioctl_ok=1
else
  echo "${ac_t}no"
  :
fi
rm -f conftest*
if test -z "$ioctl_ok"; then
echo $ac_n "checking for FIONREAD in sys/filio.h""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
$ioctl_decl#include <sys/filio.h>
int main() { exit(0); }
int t() { $ioctl_prog }
EOF
if eval $compile; then
  echo "${ac_t}yes"
  echo "#define" NEED_SYS_FILIO_H "1" >> confdefs.h
DEFS="$DEFS -DNEED_SYS_FILIO_H=1"
SEDDEFS="${SEDDEFS}\${SEDdA}NEED_SYS_FILIO_H\${SEDdB}NEED_SYS_FILIO_H\${SEDdC}1\${SEDdD}
\${SEDuA}NEED_SYS_FILIO_H\${SEDuB}NEED_SYS_FILIO_H\${SEDuC}1\${SEDuD}
\${SEDeA}NEED_SYS_FILIO_H\${SEDeB}NEED_SYS_FILIO_H\${SEDeC}1\${SEDeD}
\${SEDfA}NEED_SYS_FILIO_H\${SEDfB}NEED_SYS_FILIO_H\${SEDfC}1\${SEDfD}
"
ioctl_ok=1
else
  echo "${ac_t}no"
  :
fi
rm -f conftest*
fi
if test -z "$ioctl_ok"; then
echo $ac_n "checking for FIONREAD in sys/ioctl.h""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
$ioctl_decl#include <sys/ioctl.h>
int main() { exit(0); }
int t() { $ioctl_prog }
EOF
if eval $compile; then
  echo "${ac_t}yes"
  echo "#define" NEED_SYS_IOCTL_H "1" >> confdefs.h
DEFS="$DEFS -DNEED_SYS_IOCTL_H=1"
SEDDEFS="${SEDDEFS}\${SEDdA}NEED_SYS_IOCTL_H\${SEDdB}NEED_SYS_IOCTL_H\${SEDdC}1\${SEDdD}
\${SEDuA}NEED_SYS_IOCTL_H\${SEDuB}NEED_SYS_IOCTL_H\${SEDuC}1\${SEDuD}
\${SEDeA}NEED_SYS_IOCTL_H\${SEDeB}NEED_SYS_IOCTL_H\${SEDeC}1\${SEDeD}
\${SEDfA}NEED_SYS_IOCTL_H\${SEDfB}NEED_SYS_IOCTL_H\${SEDfC}1\${SEDfD}
"
ioctl_ok=1
else
  echo "${ac_t}no"
  :
fi
rm -f conftest*
fi
if test -n "$ioctl_ok"; then
echo "#define" HAVE_FIONREAD "1" >> confdefs.h
DEFS="$DEFS -DHAVE_FIONREAD=1"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_FIONREAD\${SEDdB}HAVE_FIONREAD\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_FIONREAD\${SEDuB}HAVE_FIONREAD\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_FIONREAD\${SEDeB}HAVE_FIONREAD\${SEDeC}1\${SEDeD}
\${SEDfA}HAVE_FIONREAD\${SEDfB}HAVE_FIONREAD\${SEDfC}1\${SEDfD}
"
fi

                      echo $ac_n "checking for fcntl declaration""... $ac_c"
for x in 'int arg' '...'; do
if test -z "$have_fcntl"; then
cat > conftest.c <<EOF
#include "confdefs.h"

#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <fcntl.h>
extern
#ifdef __cplusplus
"C"
#endif
#ifdef __STDC__
int fcntl (int fd, int cmd, $x);
#else
int fcntl();
#endif
main() { exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  if test "$x" = "..."; then
echo "#define" FCNTL_DOTS "1" >> confdefs.h
DEFS="$DEFS -DFCNTL_DOTS=1"
SEDDEFS="${SEDDEFS}\${SEDdA}FCNTL_DOTS\${SEDdB}FCNTL_DOTS\${SEDdC}1\${SEDdD}
\${SEDuA}FCNTL_DOTS\${SEDuB}FCNTL_DOTS\${SEDuC}1\${SEDuD}
\${SEDeA}FCNTL_DOTS\${SEDeB}FCNTL_DOTS\${SEDeC}1\${SEDeD}
\${SEDfA}FCNTL_DOTS\${SEDfB}FCNTL_DOTS\${SEDfC}1\${SEDfD}
"
ac_proto=`echo "extern int fcntl (int, int, ...);" | tr -s ' ' | sed -e 's/( /(/g'`
echo "${ac_t}${ac_tt}${ac_proto}"
else
ac_proto=`echo "extern int fcntl (int, int, int);" | tr -s ' ' | sed -e 's/( /(/g'`
echo "${ac_t}${ac_tt}${ac_proto}"
fi
have_fcntl=1
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
fi
done

                      echo $ac_n "checking for select""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <ctype.h>
#ifdef __cplusplus
extern "C" char select();
#endif
int main() { exit(0); }
int t() { 
/* The GNU C library defines this for functions which it implements
    to always fail with ENOSYS.  Some functions are actually named
    something starting with __ and the normal name is an alias.  */
#if defined (__stub_select) || defined (__stub___select)
choke me
#else
#ifndef __cplusplus
/* Override any gcc2 internal prototype to avoid an error.  */
extern char select();
#endif
select();
#endif
 }
EOF
if eval $compile; then
  echo "${ac_t}yes"
  echo "#define" HAVE_SELECT "1" >> confdefs.h
DEFS="$DEFS -DHAVE_SELECT=1"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_SELECT\${SEDdB}HAVE_SELECT\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_SELECT\${SEDuB}HAVE_SELECT\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_SELECT\${SEDeB}HAVE_SELECT\${SEDeC}1\${SEDeD}
\${SEDfA}HAVE_SELECT\${SEDfB}HAVE_SELECT\${SEDfC}1\${SEDfD}
"
else
  echo "${ac_t}no"
  have_select=1
fi
rm -f conftest*
if test -z "$have_select"; then
for hdr in sys/select.h
do
trhdr=HAVE_`echo $hdr | tr '[a-z]./' '[A-Z]__'`
echo $ac_n "checking for ${hdr}""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <${hdr}>
EOF
err=`eval "($CPP conftest.c >/dev/null) 2>&1""$COHERENT"`
if test -z "$err"; then
  echo "${ac_t}yes"
echo "#define" ${trhdr} "1" >> confdefs.h
DEFS="$DEFS -D${trhdr}=1"
SEDDEFS="${SEDDEFS}\${SEDdA}${trhdr}\${SEDdB}${trhdr}\${SEDdC}1\${SEDdD}
\${SEDuA}${trhdr}\${SEDuB}${trhdr}\${SEDuC}1\${SEDuD}
\${SEDeA}${trhdr}\${SEDeB}${trhdr}\${SEDeC}1\${SEDeD}
\${SEDfA}${trhdr}\${SEDfB}${trhdr}\${SEDfC}1\${SEDfD}
"
else
  echo "${ac_t}no"

fi
rm -f conftest*
done
echo $ac_n "checking for select declaration""... $ac_c"
for z in '' 'const'; do
for y in 'fd_set' 'int' 'void'; do
for x in 'int' 'size_t'; do
if test -z "$have_select"; then
cat > conftest.c <<EOF
#include "confdefs.h"

#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/time.h>
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
extern
#ifdef __cplusplus
"C"
#endif
#ifdef __STDC__
int select ($x width, $y * readfds, $y * writefds, $y * exceptfds, $z struct timeval * timeout);
#else
int select();
#endif
main() { exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  echo "#define" SELECT_WIDTH_T "$x" >> confdefs.h
DEFS="$DEFS -DSELECT_WIDTH_T=$x"
SEDDEFS="${SEDDEFS}\${SEDdA}SELECT_WIDTH_T\${SEDdB}SELECT_WIDTH_T\${SEDdC}$x\${SEDdD}
\${SEDuA}SELECT_WIDTH_T\${SEDuB}SELECT_WIDTH_T\${SEDuC}$x\${SEDuD}
\${SEDeA}SELECT_WIDTH_T\${SEDeB}SELECT_WIDTH_T\${SEDeC}$x\${SEDeD}
\${SEDfA}SELECT_WIDTH_T\${SEDfB}SELECT_WIDTH_T\${SEDfC}$x\${SEDfD}
"
echo "#define" SELECT_SET_T "$y" >> confdefs.h
DEFS="$DEFS -DSELECT_SET_T=$y"
SEDDEFS="${SEDDEFS}\${SEDdA}SELECT_SET_T\${SEDdB}SELECT_SET_T\${SEDdC}$y\${SEDdD}
\${SEDuA}SELECT_SET_T\${SEDuB}SELECT_SET_T\${SEDuC}$y\${SEDuD}
\${SEDeA}SELECT_SET_T\${SEDeB}SELECT_SET_T\${SEDeC}$y\${SEDeD}
\${SEDfA}SELECT_SET_T\${SEDfB}SELECT_SET_T\${SEDfC}$y\${SEDfD}
"
echo "#define" SELECT_CONST "$z" >> confdefs.h
DEFS="$DEFS -DSELECT_CONST=$z"
SEDDEFS="${SEDDEFS}\${SEDdA}SELECT_CONST\${SEDdB}SELECT_CONST\${SEDdC}$z\${SEDdD}
\${SEDuA}SELECT_CONST\${SEDuB}SELECT_CONST\${SEDuC}$z\${SEDuD}
\${SEDeA}SELECT_CONST\${SEDeB}SELECT_CONST\${SEDeC}$z\${SEDeD}
\${SEDfA}SELECT_CONST\${SEDfB}SELECT_CONST\${SEDfC}$z\${SEDfD}
"
ac_proto=`echo "extern int select ($x, $y *, $y *, $y *, $z struct timeval *);" | tr -s ' ' | sed -e 's/( /(/g'`
echo "${ac_t}${ac_tt}${ac_proto}"
have_select=1
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
fi
done
done
done
else
for func in poll
do
trfunc=HAVE_`echo $func | tr '[a-z]' '[A-Z]'`
echo $ac_n "checking for ${func}""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <ctype.h>
#ifdef __cplusplus
extern "C" char ${func}();
#endif
int main() { exit(0); }
int t() { 
/* The GNU C library defines this for functions which it implements
    to always fail with ENOSYS.  Some functions are actually named
    something starting with __ and the normal name is an alias.  */
#if defined (__stub_${func}) || defined (__stub___${func})
choke me
#else
#ifndef __cplusplus
/* Override any gcc2 internal prototype to avoid an error.  */
extern char ${func}();
#endif
${func}();
#endif
 }
EOF
if eval $compile; then
  echo "${ac_t}yes"
  echo "#define" ${trfunc} "1" >> confdefs.h
DEFS="$DEFS -D${trfunc}=1"
SEDDEFS="${SEDDEFS}\${SEDdA}${trfunc}\${SEDdB}${trfunc}\${SEDdC}1\${SEDdD}
\${SEDuA}${trfunc}\${SEDuB}${trfunc}\${SEDuC}1\${SEDuD}
\${SEDeA}${trfunc}\${SEDeB}${trfunc}\${SEDeC}1\${SEDeD}
\${SEDfA}${trfunc}\${SEDfB}${trfunc}\${SEDfC}1\${SEDfD}
"
else
  echo "${ac_t}no"
  :
fi
rm -f conftest*
done
fi

                      echo $ac_n "checking for ualarm""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <ctype.h>
#ifdef __cplusplus
extern "C" char ualarm();
#endif
int main() { exit(0); }
int t() { 
/* The GNU C library defines this for functions which it implements
    to always fail with ENOSYS.  Some functions are actually named
    something starting with __ and the normal name is an alias.  */
#if defined (__stub_ualarm) || defined (__stub___ualarm)
choke me
#else
#ifndef __cplusplus
/* Override any gcc2 internal prototype to avoid an error.  */
extern char ualarm();
#endif
ualarm();
#endif
 }
EOF
if eval $compile; then
  echo "${ac_t}yes"
  echo "#define" HAVE_UALARM "1" >> confdefs.h
DEFS="$DEFS -DHAVE_UALARM=1"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_UALARM\${SEDdB}HAVE_UALARM\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_UALARM\${SEDuB}HAVE_UALARM\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_UALARM\${SEDeB}HAVE_UALARM\${SEDeC}1\${SEDeD}
\${SEDfA}HAVE_UALARM\${SEDfB}HAVE_UALARM\${SEDfC}1\${SEDfD}
"
else
  echo "${ac_t}no"
  :
fi
rm -f conftest*


                      echo $ac_n "checking for setitimer""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <ctype.h>
#ifdef __cplusplus
extern "C" char setitimer();
#endif
int main() { exit(0); }
int t() { 
/* The GNU C library defines this for functions which it implements
    to always fail with ENOSYS.  Some functions are actually named
    something starting with __ and the normal name is an alias.  */
#if defined (__stub_setitimer) || defined (__stub___setitimer)
choke me
#else
#ifndef __cplusplus
/* Override any gcc2 internal prototype to avoid an error.  */
extern char setitimer();
#endif
setitimer();
#endif
 }
EOF
if eval $compile; then
  echo "${ac_t}yes"
  echo "#define" HAVE_SETITIMER "1" >> confdefs.h
DEFS="$DEFS -DHAVE_SETITIMER=1"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_SETITIMER\${SEDdB}HAVE_SETITIMER\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_SETITIMER\${SEDuB}HAVE_SETITIMER\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_SETITIMER\${SEDeB}HAVE_SETITIMER\${SEDeC}1\${SEDeD}
\${SEDfA}HAVE_SETITIMER\${SEDfB}HAVE_SETITIMER\${SEDfC}1\${SEDfD}
"
have_setitimer=1
else
  echo "${ac_t}no"
  :
fi
rm -f conftest*
if test -n "$have_setitimer"; then
echo $ac_n "checking for setitimer declaration""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"

#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/time.h>
extern
#ifdef __cplusplus
"C"
#endif
#ifdef __STDC__
int setitimer (int which, struct itimerval * ivalue, struct itimerval * ovalue);
#else
int setitimer();
#endif
main() { exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  x=""
else
  x="const"
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
echo "#define" SETITIMER_CONST "$x" >> confdefs.h
DEFS="$DEFS -DSETITIMER_CONST=$x"
SEDDEFS="${SEDDEFS}\${SEDdA}SETITIMER_CONST\${SEDdB}SETITIMER_CONST\${SEDdC}$x\${SEDdD}
\${SEDuA}SETITIMER_CONST\${SEDuB}SETITIMER_CONST\${SEDuC}$x\${SEDuD}
\${SEDeA}SETITIMER_CONST\${SEDeB}SETITIMER_CONST\${SEDeC}$x\${SEDeD}
\${SEDfA}SETITIMER_CONST\${SEDfB}SETITIMER_CONST\${SEDfC}$x\${SEDfD}
"
ac_proto=`echo "extern int setitimer (int, $x struct itimerval *, struct itimerval *);" | tr -s ' ' | sed -e 's/( /(/g'`
echo "${ac_t}${ac_tt}${ac_proto}"
fi

                      echo $ac_n "checking for usleep""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <ctype.h>
#ifdef __cplusplus
extern "C" char usleep();
#endif
int main() { exit(0); }
int t() { 
/* The GNU C library defines this for functions which it implements
    to always fail with ENOSYS.  Some functions are actually named
    something starting with __ and the normal name is an alias.  */
#if defined (__stub_usleep) || defined (__stub___usleep)
choke me
#else
#ifndef __cplusplus
/* Override any gcc2 internal prototype to avoid an error.  */
extern char usleep();
#endif
usleep();
#endif
 }
EOF
if eval $compile; then
  echo "${ac_t}yes"
  echo "#define" HAVE_USLEEP "1" >> confdefs.h
DEFS="$DEFS -DHAVE_USLEEP=1"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_USLEEP\${SEDdB}HAVE_USLEEP\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_USLEEP\${SEDuB}HAVE_USLEEP\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_USLEEP\${SEDeB}HAVE_USLEEP\${SEDeC}1\${SEDeD}
\${SEDfA}HAVE_USLEEP\${SEDfB}HAVE_USLEEP\${SEDfC}1\${SEDfD}
"
else
  echo "${ac_t}no"
  :
fi
rm -f conftest*


                      echo $ac_n "checking for localtime declaration""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"

#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef TM_IN_SYS_TIME
#include <sys/time.h>
#else
#include <time.h>
#endif
extern
#ifdef __cplusplus
"C"
#endif
#ifdef __STDC__
struct tm * localtime (time_t* clock);
#else
struct tm * localtime();
#endif
main() { exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  x=""
else
  x="const"
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
echo "#define" LOCALTIME_CONST "$x" >> confdefs.h
DEFS="$DEFS -DLOCALTIME_CONST=$x"
SEDDEFS="${SEDDEFS}\${SEDdA}LOCALTIME_CONST\${SEDdB}LOCALTIME_CONST\${SEDdC}$x\${SEDdD}
\${SEDuA}LOCALTIME_CONST\${SEDuB}LOCALTIME_CONST\${SEDuC}$x\${SEDuD}
\${SEDeA}LOCALTIME_CONST\${SEDeB}LOCALTIME_CONST\${SEDeC}$x\${SEDeD}
\${SEDfA}LOCALTIME_CONST\${SEDfB}LOCALTIME_CONST\${SEDfC}$x\${SEDfD}
"
ac_proto=`echo "extern struct tm * localtime ($x time_t*);" | tr -s ' ' | sed -e 's/( /(/g'`
echo "${ac_t}${ac_tt}${ac_proto}"

                      for func in gettimeofday
do
trfunc=HAVE_`echo $func | tr '[a-z]' '[A-Z]'`
echo $ac_n "checking for ${func}""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <ctype.h>
#ifdef __cplusplus
extern "C" char ${func}();
#endif
int main() { exit(0); }
int t() { 
/* The GNU C library defines this for functions which it implements
    to always fail with ENOSYS.  Some functions are actually named
    something starting with __ and the normal name is an alias.  */
#if defined (__stub_${func}) || defined (__stub___${func})
choke me
#else
#ifndef __cplusplus
/* Override any gcc2 internal prototype to avoid an error.  */
extern char ${func}();
#endif
${func}();
#endif
 }
EOF
if eval $compile; then
  echo "${ac_t}yes"
  echo "#define" ${trfunc} "1" >> confdefs.h
DEFS="$DEFS -D${trfunc}=1"
SEDDEFS="${SEDDEFS}\${SEDdA}${trfunc}\${SEDdB}${trfunc}\${SEDdC}1\${SEDdD}
\${SEDuA}${trfunc}\${SEDuB}${trfunc}\${SEDuC}1\${SEDuD}
\${SEDeA}${trfunc}\${SEDeB}${trfunc}\${SEDeC}1\${SEDeD}
\${SEDfA}${trfunc}\${SEDfB}${trfunc}\${SEDfC}1\${SEDfD}
"
else
  echo "${ac_t}no"
  :
fi
rm -f conftest*
done
case "$DEFS" in
  *HAVE_GETTIMEOFDAY*)
echo $ac_n "checking for gettimeofday declaration""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"

#include <sys/types.h>
#include <sys/time.h>
extern
#ifdef __cplusplus
"C"
#endif
#ifdef __STDC__
int gettimeofday (struct timeval * tp, struct timezone * tzp);
#else
int gettimeofday();
#endif
main() { exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  ac_proto=`echo "extern int gettimeofday (struct timeval *, struct timezone *);" | tr -s ' ' | sed -e 's/( /(/g'`
echo "${ac_t}${ac_tt}${ac_proto}"
else
  ac_proto=`echo "extern int gettimeofday (struct timeval *, ...);" | tr -s ' ' | sed -e 's/( /(/g'`
echo "${ac_t}${ac_tt}${ac_proto}"
echo "#define" GETTIMEOFDAY_DOTS "1" >> confdefs.h
DEFS="$DEFS -DGETTIMEOFDAY_DOTS=1"
SEDDEFS="${SEDDEFS}\${SEDdA}GETTIMEOFDAY_DOTS\${SEDdB}GETTIMEOFDAY_DOTS\${SEDdC}1\${SEDdD}
\${SEDuA}GETTIMEOFDAY_DOTS\${SEDuB}GETTIMEOFDAY_DOTS\${SEDuC}1\${SEDuD}
\${SEDeA}GETTIMEOFDAY_DOTS\${SEDeB}GETTIMEOFDAY_DOTS\${SEDeC}1\${SEDeD}
\${SEDfA}GETTIMEOFDAY_DOTS\${SEDfB}GETTIMEOFDAY_DOTS\${SEDfC}1\${SEDfD}
"
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
  ;;
  *) ;;
esac

                      for func in ftime
do
trfunc=HAVE_`echo $func | tr '[a-z]' '[A-Z]'`
echo $ac_n "checking for ${func}""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <ctype.h>
#ifdef __cplusplus
extern "C" char ${func}();
#endif
int main() { exit(0); }
int t() { 
/* The GNU C library defines this for functions which it implements
    to always fail with ENOSYS.  Some functions are actually named
    something starting with __ and the normal name is an alias.  */
#if defined (__stub_${func}) || defined (__stub___${func})
choke me
#else
#ifndef __cplusplus
/* Override any gcc2 internal prototype to avoid an error.  */
extern char ${func}();
#endif
${func}();
#endif
 }
EOF
if eval $compile; then
  echo "${ac_t}yes"
  echo "#define" ${trfunc} "1" >> confdefs.h
DEFS="$DEFS -D${trfunc}=1"
SEDDEFS="${SEDDEFS}\${SEDdA}${trfunc}\${SEDdB}${trfunc}\${SEDdC}1\${SEDdD}
\${SEDuA}${trfunc}\${SEDuB}${trfunc}\${SEDuC}1\${SEDuD}
\${SEDeA}${trfunc}\${SEDeB}${trfunc}\${SEDeC}1\${SEDeD}
\${SEDfA}${trfunc}\${SEDfB}${trfunc}\${SEDfC}1\${SEDfD}
"
else
  echo "${ac_t}no"
  :
fi
rm -f conftest*
done

                      case "$DEFS" in
  *HAVE_GETTIMEOFDAY*) ;;
  *HAVE_FTIME*) ;;
  *)
echo $ac_n "checking for times""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <ctype.h>
#ifdef __cplusplus
extern "C" char times();
#endif
int main() { exit(0); }
int t() { 
/* The GNU C library defines this for functions which it implements
    to always fail with ENOSYS.  Some functions are actually named
    something starting with __ and the normal name is an alias.  */
#if defined (__stub_times) || defined (__stub___times)
choke me
#else
#ifndef __cplusplus
/* Override any gcc2 internal prototype to avoid an error.  */
extern char times();
#endif
times();
#endif
 }
EOF
if eval $compile; then
  echo "${ac_t}yes"
  :
else
  echo "${ac_t}no"
  no_times=1
fi
rm -f conftest*
if test -z "$no_times"; then
echo $ac_n "checking for times return value""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"

#include <sys/types.h>
#include <time.h> /* needed for CLK_TCK */
#ifndef CLK_TCK
#include <sys/time.h> /* needed for CLK_TCK on SYSV PTX */
#endif
#include <sys/times.h>
main ()
{ struct tms buffer;
  clock_t result1;
  clock_t result2;
  int ticks;
  result1 = times(&buffer);
  if ((result1 == (clock_t)0) || (result1 == (clock_t)(-1))) exit(1);
  sleep(1);
  result2 = times(&buffer);
  if ((result2 == (clock_t)0) || (result2 == (clock_t)(-1))) exit(1);
  ticks = result2 - result1;
  exit(!((ticks >= CLK_TCK/2) && (ticks <= 3*CLK_TCK/2)));
}
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  echo "${ac_t}yes"
echo "#define" HAVE_TIMES_CLOCK "1" >> confdefs.h
DEFS="$DEFS -DHAVE_TIMES_CLOCK=1"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_TIMES_CLOCK\${SEDdB}HAVE_TIMES_CLOCK\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_TIMES_CLOCK\${SEDuB}HAVE_TIMES_CLOCK\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_TIMES_CLOCK\${SEDeB}HAVE_TIMES_CLOCK\${SEDeC}1\${SEDeD}
\${SEDfA}HAVE_TIMES_CLOCK\${SEDfB}HAVE_TIMES_CLOCK\${SEDfC}1\${SEDfD}
"
else
  echo "${ac_t}no"
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
fi
  ;;
esac

                      echo $ac_n "checking for getpwnam declaration""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"

#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <pwd.h>
extern
#ifdef __cplusplus
"C"
#endif
#ifdef __STDC__
struct passwd * getpwnam (char* name);
#else
struct passwd * getpwnam();
#endif
main() { exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  x=""
else
  x="const"
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
echo "#define" GETPWNAM_CONST "$x" >> confdefs.h
DEFS="$DEFS -DGETPWNAM_CONST=$x"
SEDDEFS="${SEDDEFS}\${SEDdA}GETPWNAM_CONST\${SEDdB}GETPWNAM_CONST\${SEDdC}$x\${SEDdD}
\${SEDuA}GETPWNAM_CONST\${SEDuB}GETPWNAM_CONST\${SEDuC}$x\${SEDuD}
\${SEDeA}GETPWNAM_CONST\${SEDeB}GETPWNAM_CONST\${SEDeC}$x\${SEDeD}
\${SEDfA}GETPWNAM_CONST\${SEDfB}GETPWNAM_CONST\${SEDfC}$x\${SEDfD}
"
ac_proto=`echo "extern struct passwd * getpwnam ($x char*);" | tr -s ' ' | sed -e 's/( /(/g'`
echo "${ac_t}${ac_tt}${ac_proto}"

                      echo $ac_n "checking for getpwuid declaration""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"

#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <pwd.h>
extern
#ifdef __cplusplus
"C"
#endif
#ifdef __STDC__
struct passwd * getpwuid (uid_t uid);
#else
struct passwd * getpwuid();
#endif
main() { exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  x="uid_t"
else
  x="int"
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
echo "#define" GETPWUID_UID_T "$x" >> confdefs.h
DEFS="$DEFS -DGETPWUID_UID_T=$x"
SEDDEFS="${SEDDEFS}\${SEDdA}GETPWUID_UID_T\${SEDdB}GETPWUID_UID_T\${SEDdC}$x\${SEDdD}
\${SEDuA}GETPWUID_UID_T\${SEDuB}GETPWUID_UID_T\${SEDuC}$x\${SEDuD}
\${SEDeA}GETPWUID_UID_T\${SEDeB}GETPWUID_UID_T\${SEDeC}$x\${SEDeD}
\${SEDfA}GETPWUID_UID_T\${SEDfB}GETPWUID_UID_T\${SEDfC}$x\${SEDfD}
"
ac_proto=`echo "extern struct passwd * getpwuid ($x);" | tr -s ' ' | sed -e 's/( /(/g'`
echo "${ac_t}${ac_tt}${ac_proto}"

                      echo $ac_n "checking for gethostname""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <ctype.h>
#ifdef __cplusplus
extern "C" char gethostname();
#endif
int main() { exit(0); }
int t() { 
/* The GNU C library defines this for functions which it implements
    to always fail with ENOSYS.  Some functions are actually named
    something starting with __ and the normal name is an alias.  */
#if defined (__stub_gethostname) || defined (__stub___gethostname)
choke me
#else
#ifndef __cplusplus
/* Override any gcc2 internal prototype to avoid an error.  */
extern char gethostname();
#endif
gethostname();
#endif
 }
EOF
if eval $compile; then
  echo "${ac_t}yes"
  echo "#define" HAVE_GETHOSTNAME "1" >> confdefs.h
DEFS="$DEFS -DHAVE_GETHOSTNAME=1"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_GETHOSTNAME\${SEDdB}HAVE_GETHOSTNAME\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_GETHOSTNAME\${SEDuB}HAVE_GETHOSTNAME\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_GETHOSTNAME\${SEDeB}HAVE_GETHOSTNAME\${SEDeC}1\${SEDeD}
\${SEDfA}HAVE_GETHOSTNAME\${SEDfB}HAVE_GETHOSTNAME\${SEDfC}1\${SEDfD}
"
have_gethostname=1
else
  echo "${ac_t}no"
  :
fi
rm -f conftest*
if test -n "$have_gethostname"; then
echo $ac_n "checking for gethostname declaration""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"

#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
extern
#ifdef __cplusplus
"C"
#endif
#ifdef __STDC__
int gethostname (char* name, int namelen);
#else
int gethostname();
#endif
main() { exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  x="int"
else
  x="size_t"
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
echo "#define" GETHOSTNAME_SIZE_T "$x" >> confdefs.h
DEFS="$DEFS -DGETHOSTNAME_SIZE_T=$x"
SEDDEFS="${SEDDEFS}\${SEDdA}GETHOSTNAME_SIZE_T\${SEDdB}GETHOSTNAME_SIZE_T\${SEDdC}$x\${SEDdD}
\${SEDuA}GETHOSTNAME_SIZE_T\${SEDuB}GETHOSTNAME_SIZE_T\${SEDuC}$x\${SEDuD}
\${SEDeA}GETHOSTNAME_SIZE_T\${SEDeB}GETHOSTNAME_SIZE_T\${SEDeC}$x\${SEDeD}
\${SEDfA}GETHOSTNAME_SIZE_T\${SEDfB}GETHOSTNAME_SIZE_T\${SEDfC}$x\${SEDfD}
"
ac_proto=`echo "extern int gethostname (char*, $x);" | tr -s ' ' | sed -e 's/( /(/g'`
echo "${ac_t}${ac_tt}${ac_proto}"
fi

                      case "$DEFS" in
  *HAVE_NETDB_H*) have_netdb=1 ;;
  *) echo $ac_n "checking for sun/netdb.h""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <sun/netdb.h>
EOF
err=`eval "($CPP conftest.c >/dev/null) 2>&1""$COHERENT"`
if test -z "$err"; then
  echo "${ac_t}yes"
have_netdb=1
else
  echo "${ac_t}no"

fi
rm -f conftest*
 ;;
esac
if test -n "$have_netdb"; then
echo "#define" HAVE_GETHOSTBYNAME "1" >> confdefs.h
DEFS="$DEFS -DHAVE_GETHOSTBYNAME=1"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_GETHOSTBYNAME\${SEDdB}HAVE_GETHOSTBYNAME\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_GETHOSTBYNAME\${SEDuB}HAVE_GETHOSTBYNAME\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_GETHOSTBYNAME\${SEDeB}HAVE_GETHOSTBYNAME\${SEDeC}1\${SEDeD}
\${SEDfA}HAVE_GETHOSTBYNAME\${SEDfB}HAVE_GETHOSTBYNAME\${SEDfC}1\${SEDfD}
"
echo $ac_n "checking for gethostbyname declaration""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"

#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/types.h>
#ifdef HAVE_NETDB_H
#include <sys/socket.h>
#include <netdb.h>
#else
#include <sun/netdb.h>
#endif
extern
#ifdef __cplusplus
"C"
#endif
#ifdef __STDC__
struct hostent * gethostbyname (char* name);
#else
struct hostent * gethostbyname();
#endif
main() { exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  x=""
else
  x="const"
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
echo "#define" GETHOSTBYNAME_CONST "$x" >> confdefs.h
DEFS="$DEFS -DGETHOSTBYNAME_CONST=$x"
SEDDEFS="${SEDDEFS}\${SEDdA}GETHOSTBYNAME_CONST\${SEDdB}GETHOSTBYNAME_CONST\${SEDdC}$x\${SEDdD}
\${SEDuA}GETHOSTBYNAME_CONST\${SEDuB}GETHOSTBYNAME_CONST\${SEDuC}$x\${SEDuD}
\${SEDeA}GETHOSTBYNAME_CONST\${SEDeB}GETHOSTBYNAME_CONST\${SEDeC}$x\${SEDeD}
\${SEDfA}GETHOSTBYNAME_CONST\${SEDfB}GETHOSTBYNAME_CONST\${SEDfC}$x\${SEDfD}
"
ac_proto=`echo "extern struct hostent * gethostbyname ($x char*);" | tr -s ' ' | sed -e 's/( /(/g'`
echo "${ac_t}${ac_tt}${ac_proto}"
fi

                      echo $ac_n "checking for connect declaration""... $ac_c"
for x in '' 'const'; do
for y in 'struct sockaddr *' 'void*'; do
if test -z "$have_connect"; then
cat > conftest.c <<EOF
#include "confdefs.h"

#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/types.h>
#include <sys/socket.h>
extern
#ifdef __cplusplus
"C"
#endif
#ifdef __STDC__
int connect (int fd, $x $y name, int namelen);
#else
int connect();
#endif
main() { exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  echo "#define" CONNECT_CONST "$x" >> confdefs.h
DEFS="$DEFS -DCONNECT_CONST=$x"
SEDDEFS="${SEDDEFS}\${SEDdA}CONNECT_CONST\${SEDdB}CONNECT_CONST\${SEDdC}$x\${SEDdD}
\${SEDuA}CONNECT_CONST\${SEDuB}CONNECT_CONST\${SEDuC}$x\${SEDuD}
\${SEDeA}CONNECT_CONST\${SEDeB}CONNECT_CONST\${SEDeC}$x\${SEDeD}
\${SEDfA}CONNECT_CONST\${SEDfB}CONNECT_CONST\${SEDfC}$x\${SEDfD}
"
echo "#define" CONNECT_NAME_T "$y" >> confdefs.h
DEFS="$DEFS -DCONNECT_NAME_T=$y"
SEDDEFS="${SEDDEFS}\${SEDdA}CONNECT_NAME_T\${SEDdB}CONNECT_NAME_T\${SEDdC}$y\${SEDdD}
\${SEDuA}CONNECT_NAME_T\${SEDuB}CONNECT_NAME_T\${SEDuC}$y\${SEDuD}
\${SEDeA}CONNECT_NAME_T\${SEDeB}CONNECT_NAME_T\${SEDeC}$y\${SEDeD}
\${SEDfA}CONNECT_NAME_T\${SEDfB}CONNECT_NAME_T\${SEDfC}$y\${SEDfD}
"
ac_proto=`echo "extern int connect (int, $x $y, int);" | tr -s ' ' | sed -e 's/( /(/g'`
echo "${ac_t}${ac_tt}${ac_proto}"
have_connect=1
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
fi
done
done

                      for hdr in sys/un.h
do
trhdr=HAVE_`echo $hdr | tr '[a-z]./' '[A-Z]__'`
echo $ac_n "checking for ${hdr}""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <${hdr}>
EOF
err=`eval "($CPP conftest.c >/dev/null) 2>&1""$COHERENT"`
if test -z "$err"; then
  echo "${ac_t}yes"
echo "#define" ${trhdr} "1" >> confdefs.h
DEFS="$DEFS -D${trhdr}=1"
SEDDEFS="${SEDDEFS}\${SEDdA}${trhdr}\${SEDdB}${trhdr}\${SEDdC}1\${SEDdD}
\${SEDuA}${trhdr}\${SEDuB}${trhdr}\${SEDuC}1\${SEDuD}
\${SEDeA}${trhdr}\${SEDeB}${trhdr}\${SEDeC}1\${SEDeD}
\${SEDfA}${trhdr}\${SEDfB}${trhdr}\${SEDfC}1\${SEDfD}
"
else
  echo "${ac_t}no"

fi
rm -f conftest*
done
case "$DEFS" in
  *HAVE_SYS_UN_H*)
echo $ac_n "checking for sun_len in struct sockaddr_un""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <sys/types.h> /* NetBSD 1.0 needs this */
#include <sys/un.h>
int main() { exit(0); }
int t() { struct sockaddr_un unaddr; unaddr.sun_len; }
EOF
if eval $compile; then
  echo "${ac_t}yes"
  echo "#define" HAVE_SOCKADDR_UN_LEN "1" >> confdefs.h
DEFS="$DEFS -DHAVE_SOCKADDR_UN_LEN=1"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_SOCKADDR_UN_LEN\${SEDdB}HAVE_SOCKADDR_UN_LEN\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_SOCKADDR_UN_LEN\${SEDuB}HAVE_SOCKADDR_UN_LEN\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_SOCKADDR_UN_LEN\${SEDeB}HAVE_SOCKADDR_UN_LEN\${SEDeC}1\${SEDeD}
\${SEDfA}HAVE_SOCKADDR_UN_LEN\${SEDfB}HAVE_SOCKADDR_UN_LEN\${SEDfC}1\${SEDfD}
"
else
  echo "${ac_t}no"
  :
fi
rm -f conftest*
  ;;
  *) ;;
esac

                      for hdr in netinet/in.h arpa/inet.h
do
trhdr=HAVE_`echo $hdr | tr '[a-z]./' '[A-Z]__'`
echo $ac_n "checking for ${hdr}""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <${hdr}>
EOF
err=`eval "($CPP conftest.c >/dev/null) 2>&1""$COHERENT"`
if test -z "$err"; then
  echo "${ac_t}yes"
echo "#define" ${trhdr} "1" >> confdefs.h
DEFS="$DEFS -D${trhdr}=1"
SEDDEFS="${SEDDEFS}\${SEDdA}${trhdr}\${SEDdB}${trhdr}\${SEDdC}1\${SEDdD}
\${SEDuA}${trhdr}\${SEDuB}${trhdr}\${SEDuC}1\${SEDuD}
\${SEDeA}${trhdr}\${SEDeB}${trhdr}\${SEDeC}1\${SEDeD}
\${SEDfA}${trhdr}\${SEDfB}${trhdr}\${SEDfC}1\${SEDfD}
"
else
  echo "${ac_t}no"

fi
rm -f conftest*
done
echo $ac_n "checking for inet_addr declaration""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"

#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/types.h>
#include <netinet/in.h>
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
extern
#ifdef __cplusplus
"C"
#endif
struct in_addr inet_addr();
main() { exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  ret_inet_addr_type="struct in_addr"
echo "#define" INET_ADDR_SUFFIX ".s_addr" >> confdefs.h
DEFS="$DEFS -DINET_ADDR_SUFFIX=.s_addr"
SEDDEFS="${SEDDEFS}\${SEDdA}INET_ADDR_SUFFIX\${SEDdB}INET_ADDR_SUFFIX\${SEDdC}.s_addr\${SEDdD}
\${SEDuA}INET_ADDR_SUFFIX\${SEDuB}INET_ADDR_SUFFIX\${SEDuC}.s_addr\${SEDuD}
\${SEDeA}INET_ADDR_SUFFIX\${SEDeB}INET_ADDR_SUFFIX\${SEDeC}.s_addr\${SEDeD}
\${SEDfA}INET_ADDR_SUFFIX\${SEDfB}INET_ADDR_SUFFIX\${SEDfC}.s_addr\${SEDfD}
"
have_inet_addr=1
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
if test -z "$have_inet_addr"; then
cat > conftest.c <<EOF
#include "confdefs.h"

#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/types.h>
#include <netinet/in.h>
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
extern
#ifdef __cplusplus
"C"
#endif
unsigned long inet_addr();
main() { exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  ret_inet_addr_type="unsigned long"
else
  ret_inet_addr_type="unsigned int"
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
echo "#define" INET_ADDR_SUFFIX "" >> confdefs.h
DEFS="$DEFS -DINET_ADDR_SUFFIX="
SEDDEFS="${SEDDEFS}\${SEDdA}INET_ADDR_SUFFIX\${SEDdB}INET_ADDR_SUFFIX\${SEDdC}\${SEDdD}
\${SEDuA}INET_ADDR_SUFFIX\${SEDuB}INET_ADDR_SUFFIX\${SEDuC}\${SEDuD}
\${SEDeA}INET_ADDR_SUFFIX\${SEDeB}INET_ADDR_SUFFIX\${SEDeC}\${SEDeD}
\${SEDfA}INET_ADDR_SUFFIX\${SEDfB}INET_ADDR_SUFFIX\${SEDfC}\${SEDfD}
"
fi
echo "#define" RET_INET_ADDR_TYPE "$ret_inet_addr_type" >> confdefs.h
DEFS="$DEFS -DRET_INET_ADDR_TYPE=$ret_inet_addr_type"
SEDDEFS="${SEDDEFS}\${SEDdA}RET_INET_ADDR_TYPE\${SEDdB}RET_INET_ADDR_TYPE\${SEDdC}$ret_inet_addr_type\${SEDdD}
\${SEDuA}RET_INET_ADDR_TYPE\${SEDuB}RET_INET_ADDR_TYPE\${SEDuC}$ret_inet_addr_type\${SEDuD}
\${SEDeA}RET_INET_ADDR_TYPE\${SEDeB}RET_INET_ADDR_TYPE\${SEDeC}$ret_inet_addr_type\${SEDeD}
\${SEDfA}RET_INET_ADDR_TYPE\${SEDfB}RET_INET_ADDR_TYPE\${SEDfC}$ret_inet_addr_type\${SEDfD}
"
cat > conftest.c <<EOF
#include "confdefs.h"

#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/types.h>
#include <netinet/in.h>
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
extern
#ifdef __cplusplus
"C"
#endif
#ifdef __STDC__
RET_INET_ADDR_TYPE inet_addr (char* cp);
#else
RET_INET_ADDR_TYPE inet_addr();
#endif
main() { exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  x=""
else
  x="const"
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
echo "#define" INET_ADDR_CONST "$x" >> confdefs.h
DEFS="$DEFS -DINET_ADDR_CONST=$x"
SEDDEFS="${SEDDEFS}\${SEDdA}INET_ADDR_CONST\${SEDdB}INET_ADDR_CONST\${SEDdC}$x\${SEDdD}
\${SEDuA}INET_ADDR_CONST\${SEDuB}INET_ADDR_CONST\${SEDuC}$x\${SEDuD}
\${SEDeA}INET_ADDR_CONST\${SEDeB}INET_ADDR_CONST\${SEDeC}$x\${SEDeD}
\${SEDfA}INET_ADDR_CONST\${SEDfB}INET_ADDR_CONST\${SEDfC}$x\${SEDfD}
"
ac_proto=`echo "extern $ret_inet_addr_type inet_addr ($x char*);" | tr -s ' ' | sed -e 's/( /(/g'`
echo "${ac_t}${ac_tt}${ac_proto}"
for hdr in netinet/tcp.h
do
trhdr=HAVE_`echo $hdr | tr '[a-z]./' '[A-Z]__'`
echo $ac_n "checking for ${hdr}""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <${hdr}>
EOF
err=`eval "($CPP conftest.c >/dev/null) 2>&1""$COHERENT"`
if test -z "$err"; then
  echo "${ac_t}yes"
echo "#define" ${trhdr} "1" >> confdefs.h
DEFS="$DEFS -D${trhdr}=1"
SEDDEFS="${SEDDEFS}\${SEDdA}${trhdr}\${SEDdB}${trhdr}\${SEDdC}1\${SEDdD}
\${SEDuA}${trhdr}\${SEDuB}${trhdr}\${SEDuC}1\${SEDuD}
\${SEDeA}${trhdr}\${SEDeB}${trhdr}\${SEDeC}1\${SEDeD}
\${SEDfA}${trhdr}\${SEDfB}${trhdr}\${SEDfC}1\${SEDfD}
"
else
  echo "${ac_t}no"

fi
rm -f conftest*
done

                      echo $ac_n "checking for getpagesize""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"

int main() { exit(0); }
int t() { getpagesize(); }
EOF
if eval $compile; then
  echo "${ac_t}yes"
  echo "#define" HAVE_GETPAGESIZE "1" >> confdefs.h
DEFS="$DEFS -DHAVE_GETPAGESIZE=1"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_GETPAGESIZE\${SEDdB}HAVE_GETPAGESIZE\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_GETPAGESIZE\${SEDuB}HAVE_GETPAGESIZE\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_GETPAGESIZE\${SEDeB}HAVE_GETPAGESIZE\${SEDeC}1\${SEDeD}
\${SEDfA}HAVE_GETPAGESIZE\${SEDfB}HAVE_GETPAGESIZE\${SEDfC}1\${SEDfD}
"
have_getpagesize=1
else
  echo "${ac_t}no"
  :
fi
rm -f conftest*
if test -n "$have_getpagesize"; then
echo $ac_n "checking for getpagesize declaration""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"

#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
extern
#ifdef __cplusplus
"C"
#endif
int getpagesize();
main() { exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  x="int"
else
  x="size_t"
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
echo "#define" RETGETPAGESIZETYPE "$x" >> confdefs.h
DEFS="$DEFS -DRETGETPAGESIZETYPE=$x"
SEDDEFS="${SEDDEFS}\${SEDdA}RETGETPAGESIZETYPE\${SEDdB}RETGETPAGESIZETYPE\${SEDdC}$x\${SEDdD}
\${SEDuA}RETGETPAGESIZETYPE\${SEDuB}RETGETPAGESIZETYPE\${SEDuC}$x\${SEDuD}
\${SEDeA}RETGETPAGESIZETYPE\${SEDeB}RETGETPAGESIZETYPE\${SEDeC}$x\${SEDeD}
\${SEDfA}RETGETPAGESIZETYPE\${SEDfB}RETGETPAGESIZETYPE\${SEDfC}$x\${SEDfD}
"
ac_proto=`echo "extern $x getpagesize (void);" | tr -s ' ' | sed -e 's/( /(/g'`
echo "${ac_t}${ac_tt}${ac_proto}"
fi

                      echo $ac_n "checking for vadvise""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <sys/vadvise.h>
int main() { exit(0); }
int t() { vadvise(0); }
EOF
if eval $compile; then
  echo "${ac_t}yes"
  echo "#define" HAVE_VADVISE "1" >> confdefs.h
DEFS="$DEFS -DHAVE_VADVISE=1"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_VADVISE\${SEDdB}HAVE_VADVISE\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_VADVISE\${SEDuB}HAVE_VADVISE\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_VADVISE\${SEDeB}HAVE_VADVISE\${SEDeC}1\${SEDeD}
\${SEDfA}HAVE_VADVISE\${SEDfB}HAVE_VADVISE\${SEDfC}1\${SEDfD}
"
else
  echo "${ac_t}no"
  :
fi
rm -f conftest*

                      echo $ac_n "checking for vm_allocate""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"

int main() { exit(0); }
int t() { vm_allocate(); task_self(); }
EOF
if eval $compile; then
  echo "${ac_t}yes"
  echo "#define" HAVE_MACH_VM "1" >> confdefs.h
DEFS="$DEFS -DHAVE_MACH_VM=1"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_MACH_VM\${SEDdB}HAVE_MACH_VM\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_MACH_VM\${SEDuB}HAVE_MACH_VM\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_MACH_VM\${SEDeB}HAVE_MACH_VM\${SEDeC}1\${SEDeD}
\${SEDfA}HAVE_MACH_VM\${SEDfB}HAVE_MACH_VM\${SEDfC}1\${SEDfD}
"
else
  echo "${ac_t}no"
  :
fi
rm -f conftest*

                      echo $ac_n "checking for sys/mman.h""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <sys/mman.h>
EOF
err=`eval "($CPP conftest.c >/dev/null) 2>&1""$COHERENT"`
if test -z "$err"; then
  echo "${ac_t}yes"

else
  echo "${ac_t}no"
no_mmap=1
fi
rm -f conftest*
if test -z "$no_mmap"; then
echo $ac_n "checking for mmap""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <ctype.h>
#ifdef __cplusplus
extern "C" char mmap();
#endif
int main() { exit(0); }
int t() { 
/* The GNU C library defines this for functions which it implements
    to always fail with ENOSYS.  Some functions are actually named
    something starting with __ and the normal name is an alias.  */
#if defined (__stub_mmap) || defined (__stub___mmap)
choke me
#else
#ifndef __cplusplus
/* Override any gcc2 internal prototype to avoid an error.  */
extern char mmap();
#endif
mmap();
#endif
 }
EOF
if eval $compile; then
  echo "${ac_t}yes"
  :
else
  echo "${ac_t}no"
  no_mmap=1
fi
rm -f conftest*
if test -z "$no_mmap"; then
echo "#define" HAVE_MMAP "1" >> confdefs.h
DEFS="$DEFS -DHAVE_MMAP=1"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_MMAP\${SEDdB}HAVE_MMAP\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_MMAP\${SEDuB}HAVE_MMAP\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_MMAP\${SEDeB}HAVE_MMAP\${SEDeC}1\${SEDeD}
\${SEDfA}HAVE_MMAP\${SEDfB}HAVE_MMAP\${SEDfC}1\${SEDfD}
"
echo $ac_n "checking for mmap declaration""... $ac_c"
# Note: gcc2 does not consider
#   void* mmap (void*, size_t, int, int, int, off_t);
#   char* mmap();
# to be an error, if the first declaration comes from a system include file.
cat > conftest.c <<EOF
#include "confdefs.h"

#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/types.h>
#include <sys/mman.h>
extern
#ifdef __cplusplus
"C"
#endif
void* mmap();
main() { exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  retmmaptype="void*"
else
  retmmaptype="caddr_t"
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
echo "#define" RETMMAPTYPE "$retmmaptype" >> confdefs.h
DEFS="$DEFS -DRETMMAPTYPE=$retmmaptype"
SEDDEFS="${SEDDEFS}\${SEDdA}RETMMAPTYPE\${SEDdB}RETMMAPTYPE\${SEDdC}$retmmaptype\${SEDdD}
\${SEDuA}RETMMAPTYPE\${SEDuB}RETMMAPTYPE\${SEDuC}$retmmaptype\${SEDuD}
\${SEDeA}RETMMAPTYPE\${SEDeB}RETMMAPTYPE\${SEDeC}$retmmaptype\${SEDeD}
\${SEDfA}RETMMAPTYPE\${SEDfB}RETMMAPTYPE\${SEDfC}$retmmaptype\${SEDfD}
"
for y in 'int' 'size_t'; do
for x in 'void*' 'caddr_t'; do
if test -z "$have_mmap_decl"; then
cat > conftest.c <<EOF
#include "confdefs.h"

#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/types.h>
#include <sys/mman.h>
extern
#ifdef __cplusplus
"C"
#endif
#ifdef __STDC__
RETMMAPTYPE mmap ($x addr, $y length, int prot, int flags, int fd, off_t off);
#else
RETMMAPTYPE mmap();
#endif
main() { exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  echo "#define" MMAP_ADDR_T "$x" >> confdefs.h
DEFS="$DEFS -DMMAP_ADDR_T=$x"
SEDDEFS="${SEDDEFS}\${SEDdA}MMAP_ADDR_T\${SEDdB}MMAP_ADDR_T\${SEDdC}$x\${SEDdD}
\${SEDuA}MMAP_ADDR_T\${SEDuB}MMAP_ADDR_T\${SEDuC}$x\${SEDuD}
\${SEDeA}MMAP_ADDR_T\${SEDeB}MMAP_ADDR_T\${SEDeC}$x\${SEDeD}
\${SEDfA}MMAP_ADDR_T\${SEDfB}MMAP_ADDR_T\${SEDfC}$x\${SEDfD}
"
echo "#define" MMAP_SIZE_T "$y" >> confdefs.h
DEFS="$DEFS -DMMAP_SIZE_T=$y"
SEDDEFS="${SEDDEFS}\${SEDdA}MMAP_SIZE_T\${SEDdB}MMAP_SIZE_T\${SEDdC}$y\${SEDdD}
\${SEDuA}MMAP_SIZE_T\${SEDuB}MMAP_SIZE_T\${SEDuC}$y\${SEDuD}
\${SEDeA}MMAP_SIZE_T\${SEDeB}MMAP_SIZE_T\${SEDeC}$y\${SEDeD}
\${SEDfA}MMAP_SIZE_T\${SEDfB}MMAP_SIZE_T\${SEDfC}$y\${SEDfD}
"
ac_proto=`echo "extern $retmmaptype mmap ($x, $y, int, int, int, off_t);" | tr -s ' ' | sed -e 's/( /(/g'`
echo "${ac_t}${ac_tt}${ac_proto}"
mmap_addr_type="$x"
mmap_size_type="$y"
have_mmap_decl=1
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
fi
done
done
echo $ac_n "checking for working mmap""... $ac_c"
mmap_prog_1='
#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <fcntl.h>
#ifdef NEED_SYS_FILE_H
#include <sys/file.h>
#endif
#include <sys/types.h>
#include <sys/mman.h>
extern
#ifdef __cplusplus
"C"
#endif
#ifdef __STDC__
RETMMAPTYPE mmap (MMAP_ADDR_T addr, MMAP_SIZE_T length, int prot, int flags, int fd, off_t off);
#else
RETMMAPTYPE mmap();
#endif
main () {
'
mmap_prog_2='
#define my_shift 24
#define my_low   1
#ifdef FOR_SUN4_29
#define my_high  31
#define my_size  32768 /* hope that 32768 is a multiple of the page size */
/* i*32 KB for i=1..31 gives a total of 15.5 MB, which is close to what we need */
#else
#define my_high  64
#define my_size  8192 /* hope that 8192 is a multiple of the page size */
/* i*8 KB for i=1..64 gives a total of 16.25 MB, which is close to what we need */
#endif
 {long i;
  for (i=my_low; i<=my_high; i++)
    { caddr_t addr = (caddr_t)(i << my_shift);
#if 0 /* Check for 16 MB. */
      long size = i*my_size;
#else /* Check for 8 MB. This is more likely to work on Solaris 2. */
      long size = ((i+1)/2)*my_size;
#endif
      if (mmap(addr,size,PROT_READ|PROT_WRITE,flags|MAP_FIXED,fd,0) == (RETMMAPTYPE)-1) exit(1);
    }
#define x(i)  *(unsigned char *) ((i<<my_shift) + (i*i))
#define y(i)  (unsigned char)((3*i-4)*(7*i+3))
  for (i=my_low; i<=my_high; i++) { x(i) = y(i); }
  for (i=my_high; i>=my_low; i--) { if (x(i) != y(i)) exit(1); }
  exit(0);
}}
'
cat > conftest.c <<EOF
#include "confdefs.h"
$mmap_prog_1
  int flags = MAP_ANON | MAP_PRIVATE;
  int fd = -1;
$mmap_prog_2

EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  echo "#define" HAVE_MMAP_ANON "1" >> confdefs.h
DEFS="$DEFS -DHAVE_MMAP_ANON=1"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_MMAP_ANON\${SEDdB}HAVE_MMAP_ANON\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_MMAP_ANON\${SEDuB}HAVE_MMAP_ANON\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_MMAP_ANON\${SEDeB}HAVE_MMAP_ANON\${SEDeC}1\${SEDeD}
\${SEDfA}HAVE_MMAP_ANON\${SEDfB}HAVE_MMAP_ANON\${SEDfC}1\${SEDfD}
"
else
  rm -f core
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
cat > conftest.c <<EOF
#include "confdefs.h"
$mmap_prog_1
  int flags = MAP_ANONYMOUS | MAP_PRIVATE;
  int fd = -1;
$mmap_prog_2

EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  echo "#define" HAVE_MMAP_ANONYMOUS "1" >> confdefs.h
DEFS="$DEFS -DHAVE_MMAP_ANONYMOUS=1"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_MMAP_ANONYMOUS\${SEDdB}HAVE_MMAP_ANONYMOUS\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_MMAP_ANONYMOUS\${SEDuB}HAVE_MMAP_ANONYMOUS\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_MMAP_ANONYMOUS\${SEDeB}HAVE_MMAP_ANONYMOUS\${SEDeC}1\${SEDeD}
\${SEDfA}HAVE_MMAP_ANONYMOUS\${SEDfB}HAVE_MMAP_ANONYMOUS\${SEDfC}1\${SEDfD}
"
else
  rm -f core
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
cat > conftest.c <<EOF
#include "confdefs.h"
$mmap_prog_1
#ifndef MAP_FILE
#define MAP_FILE 0
#endif
  int flags = MAP_FILE | MAP_PRIVATE;
  int fd = open("/dev/zero",O_RDONLY,0666);
  if (fd<0) exit(1);
$mmap_prog_2

EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  echo "#define" HAVE_MMAP_DEVZERO "1" >> confdefs.h
DEFS="$DEFS -DHAVE_MMAP_DEVZERO=1"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_MMAP_DEVZERO\${SEDdB}HAVE_MMAP_DEVZERO\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_MMAP_DEVZERO\${SEDuB}HAVE_MMAP_DEVZERO\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_MMAP_DEVZERO\${SEDeB}HAVE_MMAP_DEVZERO\${SEDeC}1\${SEDeD}
\${SEDfA}HAVE_MMAP_DEVZERO\${SEDfB}HAVE_MMAP_DEVZERO\${SEDfC}1\${SEDfD}
"
else
  rm -f core
retry_mmap=1
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
if test -n "$retry_mmap"; then
cat > conftest.c <<EOF
#include "confdefs.h"
#define FOR_SUN4_29
$mmap_prog_1
#ifndef MAP_FILE
#define MAP_FILE 0
#endif
  int flags = MAP_FILE | MAP_PRIVATE;
  int fd = open("/dev/zero",O_RDONLY,0666);
  if (fd<0) exit(1);
$mmap_prog_2

EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  echo "#define" HAVE_MMAP_DEVZERO_SUN4_29 "1" >> confdefs.h
DEFS="$DEFS -DHAVE_MMAP_DEVZERO_SUN4_29=1"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_MMAP_DEVZERO_SUN4_29\${SEDdB}HAVE_MMAP_DEVZERO_SUN4_29\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_MMAP_DEVZERO_SUN4_29\${SEDuB}HAVE_MMAP_DEVZERO_SUN4_29\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_MMAP_DEVZERO_SUN4_29\${SEDeB}HAVE_MMAP_DEVZERO_SUN4_29\${SEDeC}1\${SEDeD}
\${SEDfA}HAVE_MMAP_DEVZERO_SUN4_29\${SEDfB}HAVE_MMAP_DEVZERO_SUN4_29\${SEDfC}1\${SEDfD}
"
else
  rm -f core
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
fi
case "$DEFS" in
  *HAVE_MMAP_ANON* | *HAVE_MMAP_DEVZERO*) echo "${ac_t}yes"
  ;;
  *)                                      echo "${ac_t}no"
  ;;
esac
fi
fi

                      if test -z "$no_mmap"; then
echo $ac_n "checking for munmap""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <ctype.h>
#ifdef __cplusplus
extern "C" char munmap();
#endif
int main() { exit(0); }
int t() { 
/* The GNU C library defines this for functions which it implements
    to always fail with ENOSYS.  Some functions are actually named
    something starting with __ and the normal name is an alias.  */
#if defined (__stub_munmap) || defined (__stub___munmap)
choke me
#else
#ifndef __cplusplus
/* Override any gcc2 internal prototype to avoid an error.  */
extern char munmap();
#endif
munmap();
#endif
 }
EOF
if eval $compile; then
  echo "${ac_t}yes"
  echo "#define" HAVE_MUNMAP "1" >> confdefs.h
DEFS="$DEFS -DHAVE_MUNMAP=1"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_MUNMAP\${SEDdB}HAVE_MUNMAP\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_MUNMAP\${SEDuB}HAVE_MUNMAP\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_MUNMAP\${SEDeB}HAVE_MUNMAP\${SEDeC}1\${SEDeD}
\${SEDfA}HAVE_MUNMAP\${SEDfB}HAVE_MUNMAP\${SEDfC}1\${SEDfD}
"
else
  echo "${ac_t}no"
  :
fi
rm -f conftest*
fi

                      echo $ac_n "checking for mprotect""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
#include <ctype.h>
#ifdef __cplusplus
extern "C" char mprotect();
#endif
int main() { exit(0); }
int t() { 
/* The GNU C library defines this for functions which it implements
    to always fail with ENOSYS.  Some functions are actually named
    something starting with __ and the normal name is an alias.  */
#if defined (__stub_mprotect) || defined (__stub___mprotect)
choke me
#else
#ifndef __cplusplus
/* Override any gcc2 internal prototype to avoid an error.  */
extern char mprotect();
#endif
mprotect();
#endif
 }
EOF
if eval $compile; then
  echo "${ac_t}yes"
  echo "#define" HAVE_MPROTECT "1" >> confdefs.h
DEFS="$DEFS -DHAVE_MPROTECT=1"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_MPROTECT\${SEDdB}HAVE_MPROTECT\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_MPROTECT\${SEDuB}HAVE_MPROTECT\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_MPROTECT\${SEDeB}HAVE_MPROTECT\${SEDeC}1\${SEDeD}
\${SEDfA}HAVE_MPROTECT\${SEDfB}HAVE_MPROTECT\${SEDfC}1\${SEDfD}
"
else
  echo "${ac_t}no"
  :
fi
rm -f conftest*
echo $ac_n "checking for mprotect declaration""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"

#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/types.h>
#include <sys/mman.h>
extern
#ifdef __cplusplus
"C"
#endif
#ifdef __STDC__
int mprotect (MMAP_ADDR_T addr, MMAP_SIZE_T len, int prot);
#else
int mprotect();
#endif
main() { exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  x=""
else
  x="const"
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
echo "#define" MPROTECT_CONST "$x" >> confdefs.h
DEFS="$DEFS -DMPROTECT_CONST=$x"
SEDDEFS="${SEDDEFS}\${SEDdA}MPROTECT_CONST\${SEDdB}MPROTECT_CONST\${SEDdC}$x\${SEDdD}
\${SEDuA}MPROTECT_CONST\${SEDuB}MPROTECT_CONST\${SEDuC}$x\${SEDuD}
\${SEDeA}MPROTECT_CONST\${SEDeB}MPROTECT_CONST\${SEDeC}$x\${SEDeD}
\${SEDfA}MPROTECT_CONST\${SEDfB}MPROTECT_CONST\${SEDfC}$x\${SEDfD}
"
ac_proto=`echo "extern int mprotect ($x $mmap_addr_type, $mmap_size_type, int);" | tr -s ' ' | sed -e 's/( /(/g'`
echo "${ac_t}${ac_tt}${ac_proto}"
mprotect_prog='
#include <sys/types.h>
/* declare malloc() */
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifndef malloc
extern
#ifdef __cplusplus
"C"
#endif
#ifdef __STDC__
RETMALLOCTYPE malloc (MALLOC_SIZE_T size);
#else
RETMALLOCTYPE malloc();
#endif
#endif
/* declare getpagesize() and mprotect() */
#include <sys/mman.h>
#ifndef HAVE_GETPAGESIZE
#include <sys/param.h>
#define getpagesize() PAGESIZE
#else
extern
#ifdef __cplusplus
"C"
#endif
#ifdef __STDC__
RETGETPAGESIZETYPE getpagesize (void);
#else
RETGETPAGESIZETYPE getpagesize();
#endif
#endif
extern
#ifdef __cplusplus
"C"
#endif
#ifdef __STDC__
int mprotect (MPROTECT_CONST MMAP_ADDR_T addr, MMAP_SIZE_T len, int prot);
#else
int mprotect();
#endif
char foo;
main () {
  unsigned long pagesize = getpagesize();
#define page_align(address)  (char*)((unsigned long)(address) & -pagesize)
'
cat > conftest.c <<EOF
#include "confdefs.h"
$mprotect_prog
  if ((pagesize-1) & pagesize) exit(1);
  exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  :
else
  no_mprotect=1
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
mprotect_prog="$mprotect_prog"'
  char* area = malloc(6*pagesize);
  char* fault_address = area + pagesize*7/2;
'
if test -z "$no_mprotect"; then
cat > conftest.c <<EOF
#include "confdefs.h"
$mprotect_prog
  if (mprotect(page_align(fault_address),pagesize,PROT_NONE) < 0) exit(0);
  foo = *fault_address; /* this should cause a core dump */
  exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  no_mprotect=1
else
  rm -f core
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
fi
if test -z "$no_mprotect"; then
cat > conftest.c <<EOF
#include "confdefs.h"
$mprotect_prog
  if (mprotect(page_align(fault_address),pagesize,PROT_NONE) < 0) exit(0);
  *fault_address = 'z'; /* this should cause a core dump */
  exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  no_mprotect=1
else
  rm -f core
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
fi
if test -z "$no_mprotect"; then
cat > conftest.c <<EOF
#include "confdefs.h"
$mprotect_prog
  if (mprotect(page_align(fault_address),pagesize,PROT_READ) < 0) exit(0);
  *fault_address = 'z'; /* this should cause a core dump */
  exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  no_mprotect=1
else
  rm -f core
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
fi
if test -z "$no_mprotect"; then
cat > conftest.c <<EOF
#include "confdefs.h"
$mprotect_prog
  if (mprotect(page_align(fault_address),pagesize,PROT_READ) < 0) exit(1);
  if (mprotect(page_align(fault_address),pagesize,PROT_READ|PROT_WRITE) < 0) exit(1);
  *fault_address = 'z'; /* this should not cause a core dump */
  exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  :
else
  no_mprotect=1
rm -f core
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
fi
if test -z "$no_mprotect"; then
  echo "#define" HAVE_WORKING_MPROTECT "1" >> confdefs.h
DEFS="$DEFS -DHAVE_WORKING_MPROTECT=1"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_WORKING_MPROTECT\${SEDdB}HAVE_WORKING_MPROTECT\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_WORKING_MPROTECT\${SEDuB}HAVE_WORKING_MPROTECT\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_WORKING_MPROTECT\${SEDeB}HAVE_WORKING_MPROTECT\${SEDeC}1\${SEDeD}
\${SEDfA}HAVE_WORKING_MPROTECT\${SEDfB}HAVE_WORKING_MPROTECT\${SEDfC}1\${SEDfD}
"
fi

                      case "$DEFS" in
  *HAVE_SHM*)
echo $ac_n "checking for shmget declaration""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"

#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
extern
#ifdef __cplusplus
"C"
#endif
#ifdef __STDC__
int shmget (key_t key, int size, int shmflg);
#else
int shmget();
#endif
main() { exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  x="int"
else
  x="size_t"
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
echo "#define" SHMGET_SIZE_T "$x" >> confdefs.h
DEFS="$DEFS -DSHMGET_SIZE_T=$x"
SEDDEFS="${SEDDEFS}\${SEDdA}SHMGET_SIZE_T\${SEDdB}SHMGET_SIZE_T\${SEDdC}$x\${SEDdD}
\${SEDuA}SHMGET_SIZE_T\${SEDuB}SHMGET_SIZE_T\${SEDuC}$x\${SEDuD}
\${SEDeA}SHMGET_SIZE_T\${SEDeB}SHMGET_SIZE_T\${SEDeC}$x\${SEDeD}
\${SEDfA}SHMGET_SIZE_T\${SEDfB}SHMGET_SIZE_T\${SEDfC}$x\${SEDfD}
"
ac_proto=`echo "extern int shmget (key_t, $x, int);" | tr -s ' ' | sed -e 's/( /(/g'`
echo "${ac_t}${ac_tt}${ac_proto}"
  ;;
  *) ;;
esac

                      case "$DEFS" in
  *HAVE_SHM*)
echo $ac_n "checking for shmat declaration""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"

#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
extern
#ifdef __cplusplus
"C"
#endif
void* shmat();
main() { exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  x="void*"
else
  x="char*"
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
echo "#define" RETSHMATTYPE "$x" >> confdefs.h
DEFS="$DEFS -DRETSHMATTYPE=$x"
SEDDEFS="${SEDDEFS}\${SEDdA}RETSHMATTYPE\${SEDdB}RETSHMATTYPE\${SEDdC}$x\${SEDdD}
\${SEDuA}RETSHMATTYPE\${SEDuB}RETSHMATTYPE\${SEDuC}$x\${SEDuD}
\${SEDeA}RETSHMATTYPE\${SEDeB}RETSHMATTYPE\${SEDeC}$x\${SEDeD}
\${SEDfA}RETSHMATTYPE\${SEDfB}RETSHMATTYPE\${SEDfC}$x\${SEDfD}
"
cat > conftest.c <<EOF
#include "confdefs.h"

#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
extern
#ifdef __cplusplus
"C"
#endif
#ifdef __STDC__
RETSHMATTYPE shmat (int shmid, RETSHMATTYPE shmaddr, int shmflg);
#else
RETSHMATTYPE shmat();
#endif
main() { exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  y=""
else
  y="const"
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
echo "#define" SHMAT_CONST "$y" >> confdefs.h
DEFS="$DEFS -DSHMAT_CONST=$y"
SEDDEFS="${SEDDEFS}\${SEDdA}SHMAT_CONST\${SEDdB}SHMAT_CONST\${SEDdC}$y\${SEDdD}
\${SEDuA}SHMAT_CONST\${SEDuB}SHMAT_CONST\${SEDuC}$y\${SEDuD}
\${SEDeA}SHMAT_CONST\${SEDeB}SHMAT_CONST\${SEDeC}$y\${SEDeD}
\${SEDfA}SHMAT_CONST\${SEDfB}SHMAT_CONST\${SEDfC}$y\${SEDfD}
"
ac_proto=`echo "extern $retshmattype shmat (int, $y $x, int);" | tr -s ' ' | sed -e 's/( /(/g'`
echo "${ac_t}${ac_tt}${ac_proto}"
  ;;
  *) ;;
esac

                      case "$DEFS" in
  *HAVE_SHM*)
echo $ac_n "checking for shmctl declaration""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"

#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
extern
#ifdef __cplusplus
"C"
#endif
#ifdef __STDC__
int shmctl (int shmid, int cmd, struct shmid_ds * buf);
#else
int shmctl();
#endif
main() { exit(0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  ac_proto=`echo "extern int shmctl (int, int, struct shmid_ds *);" | tr -s ' ' | sed -e 's/( /(/g'`
echo "${ac_t}${ac_tt}${ac_proto}"
else
  ac_proto=`echo "extern int shmctl (int, int, ...);" | tr -s ' ' | sed -e 's/( /(/g'`
echo "${ac_t}${ac_tt}${ac_proto}"
echo "#define" SHMCTL_DOTS "1" >> confdefs.h
DEFS="$DEFS -DSHMCTL_DOTS=1"
SEDDEFS="${SEDDEFS}\${SEDdA}SHMCTL_DOTS\${SEDdB}SHMCTL_DOTS\${SEDdC}1\${SEDdD}
\${SEDuA}SHMCTL_DOTS\${SEDuB}SHMCTL_DOTS\${SEDuC}1\${SEDuD}
\${SEDeA}SHMCTL_DOTS\${SEDeB}SHMCTL_DOTS\${SEDeC}1\${SEDeD}
\${SEDfA}SHMCTL_DOTS\${SEDfB}SHMCTL_DOTS\${SEDfC}1\${SEDfD}
"
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
  ;;
  *) ;;
esac

                      case "$DEFS" in
  *HAVE_SHM*)
echo $ac_n "checking for attachability of removed shared memory""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"

#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#ifdef HAVE_SYS_SYSMACROS_H
#include <sys/sysmacros.h>
#endif
#ifdef __STDC__
extern
#ifdef __cplusplus
"C"
#endif
int shmget (key_t key, SHMGET_SIZE_T size, int shmflg);
extern
#ifdef __cplusplus
"C"
#endif
RETSHMATTYPE shmat (int shmid, SHMAT_CONST RETSHMATTYPE shmaddr, int shmflg);
extern
#ifdef __cplusplus
"C"
#endif
#ifdef SHMCTL_DOTS
int shmctl (int shmid, int cmd, ...);
#else
int shmctl (int shmid, int cmd, struct shmid_ds * buf);
#endif
#else
extern int shmget();
extern RETSHMATTYPE shmat();
extern int shmctl();
#endif
main ()
{ unsigned int pagesize = 8192; /* should be a multiple of SHMLBA */
  unsigned long addr = (unsigned long) malloc(2*pagesize);
  addr += pagesize-1; addr = (addr/pagesize)*pagesize;
 {unsigned long addr1 = addr + 0x10000;
  unsigned long addr2 = addr + 0x20000;
  int id = shmget(IPC_PRIVATE,pagesize,IPC_CREAT|0600);
  if (id<0)
    { exit(1); }
  if (shmat(id,(RETSHMATTYPE)addr1,0) == (RETSHMATTYPE)(-1))
    { shmctl(id,IPC_RMID,NULL); exit(1); }
  if (shmctl(id,IPC_RMID,NULL) < 0)
    { exit(1); }
  if (shmat(id,(RETSHMATTYPE)addr2,0) == (RETSHMATTYPE)(-1))
    { shmctl(id,IPC_RMID,NULL); exit(1); }
  shmctl(id,IPC_RMID,NULL);
  exit(0);
}}

EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  echo "${ac_t}yes"
echo "#define" SHM_RMID_VALID "1" >> confdefs.h
DEFS="$DEFS -DSHM_RMID_VALID=1"
SEDDEFS="${SEDDEFS}\${SEDdA}SHM_RMID_VALID\${SEDdB}SHM_RMID_VALID\${SEDdC}1\${SEDdD}
\${SEDuA}SHM_RMID_VALID\${SEDuB}SHM_RMID_VALID\${SEDuC}1\${SEDuD}
\${SEDeA}SHM_RMID_VALID\${SEDeB}SHM_RMID_VALID\${SEDeC}1\${SEDeD}
\${SEDfA}SHM_RMID_VALID\${SEDfB}SHM_RMID_VALID\${SEDfC}1\${SEDfD}
"
else
  echo "${ac_t}no"
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*
  ;;
  *) ;;
esac

                      echo $ac_n "checking whether characters are unsigned""... $ac_c"
cat > conftest.c <<EOF
#include "confdefs.h"
/* volatile prevents gcc2 from optimizing the test away on sparcs.  */
#if !__STDC__
#define volatile
#endif
main() { volatile char c = 255; exit(c < 0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  echo "${ac_t}yes"
echo "#define" __CHAR_UNSIGNED__ "1" >> confdefs.h
DEFS="$DEFS -D__CHAR_UNSIGNED__=1"
SEDDEFS="${SEDDEFS}\${SEDdA}__CHAR_UNSIGNED__\${SEDdB}__CHAR_UNSIGNED__\${SEDdC}1\${SEDdD}
\${SEDuA}__CHAR_UNSIGNED__\${SEDuB}__CHAR_UNSIGNED__\${SEDuC}1\${SEDuD}
\${SEDeA}__CHAR_UNSIGNED__\${SEDeB}__CHAR_UNSIGNED__\${SEDeC}1\${SEDeD}
\${SEDfA}__CHAR_UNSIGNED__\${SEDfB}__CHAR_UNSIGNED__\${SEDfC}1\${SEDfD}
"
else
  echo "${ac_t}no"
fi
if test -f core; then
  coredir=core`/bin/sh -c 'echo $$'`
  mkdir $coredir
  cp confdefs.h $coredir/confdefs.h
  mv conftest.c $coredir/conftest.c
  mv conftest $coredir/conftest
  mv core $coredir/core
  echo "warning: test program dumped core -- see subdirectory $coredir"
fi
rm -f conftest*

                      echo checking for integer types and behaviour
cat > conftest.c <<EOF
#include "confdefs.h"
EOF
cat ${srcdir}/machine.c >> conftest.c
ORIGCC="$CC"
if test -n "$GCC"; then
# gcc -O (gcc version <= 2.3.2) crashes when compiling long long shifts for
# target 80386. Strip "-O".
CC=`echo "$CC " | sed -e 's/-O //g'`
fi
eval $compile
CC="$ORIGCC"
if test -s conftest; then
  echo creating machine.h
  ./conftest > conftest.h
  if cmp -s machine.h conftest.h 2>/dev/null; then
    # The file exists and we would not be changing it
    rm -f conftest.h
  else
    rm -f machine.h
    mv conftest.h machine.h
  fi
else
  echo creation of machine.h failed
fi
rm -f conftest*

                      # Set default prefixes.
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
# Quote sed substitution magic chars in DEFS.
cat >conftest.def <<EOF
$DEFS
EOF
escape_ampersand_and_backslash='s%[&\\]%\\&%g'
DEFS=`sed "$escape_ampersand_and_backslash" <conftest.def`
rm -f conftest.def
# Substitute for predefined variables.

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 | sed 1q`:
#
# $0 $configure_args

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

trap 'rm -fr makemake unixconf.h conftest*; exit 1' 1 3 15
CC='$CC'
CPP='$CPP'
CC_GCC='$CC_GCC'
CC_ANSI='$CC_ANSI'
CC_NEED_CCPAUX='$CC_NEED_CCPAUX'
CC_NEED_DEELIF='$CC_NEED_DEELIF'
CC_NEED_DEERROR='$CC_NEED_DEERROR'
CC_NEED_DEEMA='$CC_NEED_DEEMA'
CC_NEED_MERGESTRINGS='$CC_NEED_MERGESTRINGS'
AS_UNDERSCORE='$AS_UNDERSCORE'
RANLIB='$RANLIB'
INSTALL='$INSTALL'
INSTALL_PROGRAM='$INSTALL_PROGRAM'
INSTALL_DATA='$INSTALL_DATA'
CP='$CP'
LN_S='$LN_S'
GOOD_SH='$GOOD_SH'
HAVE_XMKMF='$HAVE_XMKMF'
X_INCLUDES='$X_INCLUDES'
X_LIBS='$X_LIBS'
GMALLOC='$GMALLOC'
ALLOCA='$ALLOCA'
LIBS='$LIBS'
srcdir='$srcdir'
prefix='$prefix'
exec_prefix='$exec_prefix'
prsub='$prsub'
extrasub='$extrasub'
EOF
cat >> config.status <<\EOF

top_srcdir=$srcdir

CONFIG_FILES=${CONFIG_FILES-"makemake"}
for file in .. ${CONFIG_FILES}; do if test "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
  touch $file
  if test `echo $file|sed 's|.*/||'` = makemake; then
    echo "#! /bin/sh" >> $file
  fi
  echo "# Generated automatically from `echo $file|sed 's|.*/||'`.in by configure." >> $file
  sed -e "
$prsub
$extrasub
s%@CC@%$CC%g
s%@CPP@%$CPP%g
s%@CC_GCC@%$CC_GCC%g
s%@CC_ANSI@%$CC_ANSI%g
s%@CC_NEED_CCPAUX@%$CC_NEED_CCPAUX%g
s%@CC_NEED_DEELIF@%$CC_NEED_DEELIF%g
s%@CC_NEED_DEERROR@%$CC_NEED_DEERROR%g
s%@CC_NEED_DEEMA@%$CC_NEED_DEEMA%g
s%@CC_NEED_MERGESTRINGS@%$CC_NEED_MERGESTRINGS%g
s%@AS_UNDERSCORE@%$AS_UNDERSCORE%g
s%@RANLIB@%$RANLIB%g
s%@INSTALL@%$INSTALL%g
s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
s%@INSTALL_DATA@%$INSTALL_DATA%g
s%@CP@%$CP%g
s%@LN_S@%$LN_S%g
s%@GOOD_SH@%$GOOD_SH%g
s%@HAVE_XMKMF@%$HAVE_XMKMF%g
s%@X_INCLUDES@%$X_INCLUDES%g
s%@X_LIBS@%$X_LIBS%g
s%@GMALLOC@%$GMALLOC%g
s%@ALLOCA@%$ALLOCA%g
s%@LIBS@%$LIBS%g
s%@srcdir@%$srcdir%g
s%@DEFS@%-DHAVE_CONFIG_H%" $top_srcdir/${file}.in >> $file
  if test `echo $file|sed 's|.*/||'` = makemake; then
    chmod a+x $file
  fi
fi; done

CONFIG_HEADERS=${CONFIG_HEADERS-"unixconf.h"}
for file in .. ${CONFIG_HEADERS}; do if test "x$file" != x..; then
echo creating $file

# These sed commands are put into SEDDEFS when defining a macro.
# They are broken into pieces to make the sed script easier to manage.
# They 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.
# Each defining turns into a single global substitution command.
#
# SEDd sets the value in "#define NAME VALUE" lines.
SEDdA='s@^\([ 	]*\)#\([ 	]*define[ 	][ 	]*\)'
SEDdB='\([ 	][ 	]*\)[^ 	]*@\1#\2'
SEDdC='\3'
SEDdD='@g'
# SEDu turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
SEDuA='s@^\([ 	]*\)#\([ 	]*\)undef\([ 	][ 	]*\)'
SEDuB='\([ 	]\)@\1#\2define\3'
SEDuC=' '
SEDuD='\4@g'
# SEDe turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
SEDeA='s@^\([ 	]*\)#\([ 	]*\)undef\([ 	][ 	]*\)'
SEDeB='$@\1#\2define\3'
SEDeC=' '
SEDeD='@g'
# SEDf turns "#define NAME" without trailing blanks into "#define NAME VALUE".
SEDfA='s@^\([ 	]*\)#\([ 	]*\)define\([ 	][ 	]*\)'
SEDfB='$@\1#\2define\3'
SEDfC=' '
SEDfD='@g'
rm -f conftest.sed
EOF
# Turn off quoting long enough to insert the sed commands.
rm -f conftest.sh
cat > conftest.sh <<EOF
$SEDDEFS
EOF

# Break up $SEDDEFS (now in conftest.sh) because some shells have a limit
# on the size of here documents.

# Maximum number of lines to put in a single here document.
maxshlines=9

while :
do
  # wc gives bogus results for an empty file on some systems.
  lines=`grep -c . conftest.sh`
  if test -z "$lines" || test "$lines" -eq 0; then break; fi
  rm -f conftest.s1 conftest.s2
  sed ${maxshlines}q conftest.sh > conftest.s1 # Like head -20.
  sed 1,${maxshlines}d conftest.sh > conftest.s2 # Like tail +21.
  # Write a limited-size here document to append to conftest.sed.
  echo 'cat >> conftest.sed <<CONFEOF' >> config.status
  cat conftest.s1 >> config.status
  echo 'CONFEOF' >> config.status
  rm -f conftest.s1 conftest.sh
  mv conftest.s2 conftest.sh
done
rm -f conftest.sh

# Now back to your regularly scheduled config.status.
cat >> config.status <<\EOF
rm -f conftest.h
# Break up the sed commands because old seds have small limits.
maxsedlines=20
cp $top_srcdir/$file.in conftest.h1
while :
do
  lines=`grep -c . conftest.sed`
  if test -z "$lines" || test "$lines" -eq 0; then break; fi
  rm -f conftest.s1 conftest.s2 conftest.h2
  sed ${maxsedlines}q conftest.sed > conftest.s1 # Like head -20.
  sed 1,${maxsedlines}d conftest.sed > conftest.s2 # Like tail +21.
  sed -f conftest.s1 < conftest.h1 > conftest.h2
  rm -f conftest.s1 conftest.h1 conftest.sed
  mv conftest.h2 conftest.h1
  mv conftest.s2 conftest.sed
done
rm -f conftest.sed conftest.h
echo "/* $file.  Generated automatically by configure.  */" > conftest.h
cat conftest.h1 >> conftest.h
rm -f conftest.h1
if cmp -s $file conftest.h 2>/dev/null; then
  # The file exists and we would not be changing it.
  echo "$file is unchanged"
  rm -f conftest.h
else
  rm -f $file
  mv conftest.h $file
fi
fi; done



exit 0
EOF
chmod +x config.status
${CONFIG_SHELL-/bin/sh} config.status


