head     1.1;
branch   ;
access   ;
symbols  ;
locks    bin:1.1;
comment  @# @;


1.1
date     93.07.30.07.52.47;  author bin;  state Exp;
branches ;
next     ;


desc
@@



1.1
log
@Initial revision
@
text
@#!/bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated automatically using autoconf.
# Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.

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

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

# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

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


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

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

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

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

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

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

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

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

     *) ;;
    esac
  fi
done

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

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

# A filename unique to this package, relative to the directory that
# configure is in, which we can look for to find out if srcdir is correct.
unique_file=policy.h

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


compile='rm -f conftest.t;
  mv conftest.c conftest.t;
  echo "$DEFS" > conftest.c;
  cat conftest.t >> conftest.c;
  rm -f conftest.t;
  ${CC-cc} conftest.c -o conftest $LIBS >/dev/null 2>&1'

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

# 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.
fi
rm -f conftest*

echo checking how to run the C preprocessor
if test -z "$CPP"; then
  CPP='${CC-cc} -E'
  cat > conftest.c <<EOF
$DEFS
#include <stdio.h>
EOF
err=`eval "$CPP conftest.c 2>&1 >/dev/null"`
if test -z "$err"; then
  :
else
  CPP=/lib/cpp
fi
rm -f conftest*
fi

if test -n "$GCC"; then
  echo checking whether -traditional is needed
  pattern="Autoconf.*'x'"
  prog='#include <sgtty.h>
Autoconf TIOCGETP'
  cat > conftest.c <<EOF
$DEFS
$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
$DEFS
$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
  test -n "$need_trad" && CC="$CC -traditional"
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.  (Sigh.)
if test -z "$INSTALL"; then
  echo checking for install
  saveifs="$IFS"; IFS="${IFS}:"
  for dir in $PATH; do
    test -z "$dir" && dir=.
    case $dir in
    /etc|/usr/sbin|/usr/etc|/usr/afsws/bin) ;;
    *)
      if test -f $dir/install; then
	if grep dspmsg $dir/install >/dev/null 2>&1; then
	  : # AIX
	else
	  INSTALL="$dir/install -c"
	  INSTALL_PROGRAM='$(INSTALL)'
	  INSTALL_DATA='$(INSTALL) -m 644'
	  break
	fi
      fi
      ;;
    esac
  done
  IFS="$saveifs"
fi
INSTALL=${INSTALL-cp}
INSTALL_PROGRAM=${INSTALL_PROGRAM-'$(INSTALL)'}
INSTALL_DATA=${INSTALL_DATA-'$(INSTALL)'}

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

echo checking for POSIXized ISC
if test -d /etc/conf/kconfig.d &&
  grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
then
  ISC=1 # If later tests want to check for ISC.
  DEFS="${DEFS}#define _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}
"
  if test -n "$GCC"; then
    CC="$CC -posix"
  else
    CC="$CC -Xp"
  fi
fi

echo checking for minix/config.h
cat > conftest.c <<EOF
$DEFS
#include <minix/config.h>
EOF
err=`eval "$CPP conftest.c 2>&1 >/dev/null"`
if test -z "$err"; then
  MINIX=1
fi
rm -f conftest*

# The Minix shell can't assign to the same variable on the same line!
if test -n "$MINIX"; then
  DEFS="${DEFS}#define _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}
"
  DEFS="${DEFS}#define _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}
"
  DEFS="${DEFS}#define _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}
"
fi

echo checking for AIX
cat > conftest.c <<EOF
$DEFS
#ifdef _AIX
  yes
#endif

EOF
eval "$CPP conftest.c > conftest.out 2>&1"
if egrep "yes" conftest.out >/dev/null 2>&1; then
  DEFS="${DEFS}#define _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}
"
fi
rm -f conftest*


echo checking for DYNIX/ptx libseq
cat > conftest.c <<EOF
$DEFS
#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*

test -n "$SEQUENT" && test -f /usr/lib/libseq.a &&
  LIBS="$LIBS -lseq"

echo checking for IRIX libsun
if test -f /usr/lib/libsun.a; then
  LIBS="$LIBS -lsun"
fi

echo checking whether cross-compiling
# If we cannot run a trivial program, we must be cross compiling.
cat > conftest.c <<EOF
main(){exit(0);}
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  :
else
  cross_compiling=1
fi
rm -f conftest*

CFLAGS=${CFLAGS--g}
echo checking for mail program
if test -s /usr/ucb/mail; then
 DEFS="${DEFS}#define MAIL_PROGRAM `echo '"/usr/ucb/mail"'`
"
SEDDEFS="${SEDDEFS}\${SEDdA}MAIL_PROGRAM\${SEDdB}MAIL_PROGRAM\${SEDdC}`echo '"/usr/ucb/mail"'`\${SEDdD}
\${SEDuA}MAIL_PROGRAM\${SEDuB}MAIL_PROGRAM\${SEDuC}`echo '"/usr/ucb/mail"'`\${SEDuD}
\${SEDeA}MAIL_PROGRAM\${SEDeB}MAIL_PROGRAM\${SEDeC}`echo '"/usr/ucb/mail"'`\${SEDeD}
"
elif test -s /bin/mail; then
 DEFS="${DEFS}#define MAIL_PROGRAM `echo '"/bin/mail"'`
"
SEDDEFS="${SEDDEFS}\${SEDdA}MAIL_PROGRAM\${SEDdB}MAIL_PROGRAM\${SEDdC}`echo '"/bin/mail"'`\${SEDdD}
\${SEDuA}MAIL_PROGRAM\${SEDuB}MAIL_PROGRAM\${SEDuC}`echo '"/bin/mail"'`\${SEDuD}
\${SEDeA}MAIL_PROGRAM\${SEDeB}MAIL_PROGRAM\${SEDeC}`echo '"/bin/mail"'`\${SEDeD}
"
elif test -s /usr/bin/mail; then
 DEFS="${DEFS}#define MAIL_PROGRAM `echo '"/usr/bin/mail"'`
"
SEDDEFS="${SEDDEFS}\${SEDdA}MAIL_PROGRAM\${SEDdB}MAIL_PROGRAM\${SEDdC}`echo '"/usr/bin/mail"'`\${SEDdD}
\${SEDuA}MAIL_PROGRAM\${SEDuB}MAIL_PROGRAM\${SEDuC}`echo '"/usr/bin/mail"'`\${SEDuD}
\${SEDeA}MAIL_PROGRAM\${SEDeB}MAIL_PROGRAM\${SEDeC}`echo '"/usr/bin/mail"'`\${SEDeD}
"
elif test -s /usr/bin/mailx; then
 DEFS="${DEFS}#define MAIL_PROGRAM `echo '"/usr/bin/mailx"'`
"
SEDDEFS="${SEDDEFS}\${SEDdA}MAIL_PROGRAM\${SEDdB}MAIL_PROGRAM\${SEDdC}`echo '"/usr/bin/mailx"'`\${SEDdD}
\${SEDuA}MAIL_PROGRAM\${SEDuB}MAIL_PROGRAM\${SEDuC}`echo '"/usr/bin/mailx"'`\${SEDuD}
\${SEDeA}MAIL_PROGRAM\${SEDeB}MAIL_PROGRAM\${SEDeC}`echo '"/usr/bin/mailx"'`\${SEDeD}
"
fi
echo checking for echo program
if (PATH= echo test) 2>/dev/null | grep test >/dev/null 2>&1; then
 DEFS="${DEFS}#define ECHO_PROGRAM `echo '"echo"'`
"
SEDDEFS="${SEDDEFS}\${SEDdA}ECHO_PROGRAM\${SEDdB}ECHO_PROGRAM\${SEDdC}`echo '"echo"'`\${SEDdD}
\${SEDuA}ECHO_PROGRAM\${SEDuB}ECHO_PROGRAM\${SEDuC}`echo '"echo"'`\${SEDuD}
\${SEDeA}ECHO_PROGRAM\${SEDeB}ECHO_PROGRAM\${SEDeC}`echo '"echo"'`\${SEDeD}
"
elif test -s /bin/echo; then
 DEFS="${DEFS}#define ECHO_PROGRAM `echo '"/bin/echo"'`
"
SEDDEFS="${SEDDEFS}\${SEDdA}ECHO_PROGRAM\${SEDdB}ECHO_PROGRAM\${SEDdC}`echo '"/bin/echo"'`\${SEDdD}
\${SEDuA}ECHO_PROGRAM\${SEDuB}ECHO_PROGRAM\${SEDuC}`echo '"/bin/echo"'`\${SEDuD}
\${SEDeA}ECHO_PROGRAM\${SEDeB}ECHO_PROGRAM\${SEDeC}`echo '"/bin/echo"'`\${SEDeD}
"
fi
echo checking for ln -s
rm -f conftestdata
if ln -s X conftestdata 2>/dev/null
then
  rm -f conftestdata
  LN_S="ln -s"
else
  LN_S=ln
fi


for hdr in stddef.h string.h strings.h unistd.h stdlib.h limits.h
do
trhdr=HAVE_`echo $hdr | tr '[a-z]./' '[A-Z]__'`
echo checking for ${hdr}
cat > conftest.c <<EOF
$DEFS
#include <${hdr}>
EOF
err=`eval "$CPP conftest.c 2>&1 >/dev/null"`
if test -z "$err"; then
  DEFS="${DEFS}#define ${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}
"
fi
rm -f conftest*
done

for hdr in time.h sys/wait.h sys/ioctl.h dirent.h memory.h sys/param.h
do
trhdr=HAVE_`echo $hdr | tr '[a-z]./' '[A-Z]__'`
echo checking for ${hdr}
cat > conftest.c <<EOF
$DEFS
#include <${hdr}>
EOF
err=`eval "$CPP conftest.c 2>&1 >/dev/null"`
if test -z "$err"; then
  DEFS="${DEFS}#define ${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}
"
fi
rm -f conftest*
done

for hdr in utime.h fcntl.h sys/file.h sys/times.h libc.h sysexits.h
do
trhdr=HAVE_`echo $hdr | tr '[a-z]./' '[A-Z]__'`
echo checking for ${hdr}
cat > conftest.c <<EOF
$DEFS
#include <${hdr}>
EOF
err=`eval "$CPP conftest.c 2>&1 >/dev/null"`
if test -z "$err"; then
  DEFS="${DEFS}#define ${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}
"
fi
rm -f conftest*
done

for hdr in poll.h tiuser.h xti.h sys/tli.h stropts.h ftw.h glob.h
do
trhdr=HAVE_`echo $hdr | tr '[a-z]./' '[A-Z]__'`
echo checking for ${hdr}
cat > conftest.c <<EOF
$DEFS
#include <${hdr}>
EOF
err=`eval "$CPP conftest.c 2>&1 >/dev/null"`
if test -z "$err"; then
  DEFS="${DEFS}#define ${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}
"
fi
rm -f conftest*
done

for hdr in sys/types.tcp.h
do
trhdr=HAVE_`echo $hdr | tr '[a-z]./' '[A-Z]__'`
echo checking for ${hdr}
cat > conftest.c <<EOF
$DEFS
#include <${hdr}>
EOF
err=`eval "$CPP conftest.c 2>&1 >/dev/null"`
if test -z "$err"; then
  DEFS="${DEFS}#define ${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}
"
fi
rm -f conftest*
done

echo checking for sys/select.h
cat > conftest.c <<EOF
#include <sys/select.h>
#include <sys/time.h>
main() { exit(0); } 
t() { int i; }
EOF
if eval $compile; then
  DEFS="${DEFS}#define HAVE_SYS_SELECT_H 1
"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_SYS_SELECT_H\${SEDdB}HAVE_SYS_SELECT_H\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_SYS_SELECT_H\${SEDuB}HAVE_SYS_SELECT_H\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_SYS_SELECT_H\${SEDeB}HAVE_SYS_SELECT_H\${SEDeC}1\${SEDeD}
"
fi
rm -f conftest*

echo checking for major, minor and makedev header
cat > conftest.c <<EOF
#include <sys/types.h>
main() { exit(0); } 
t() { return makedev(0, 0); }
EOF
if eval $compile; then
  makedev=1
fi
rm -f conftest*

if test -z "$makedev"; then
echo checking for sys/mkdev.h
cat > conftest.c <<EOF
$DEFS
#include <sys/mkdev.h>
EOF
err=`eval "$CPP conftest.c 2>&1 >/dev/null"`
if test -z "$err"; then
  DEFS="${DEFS}#define MAJOR_IN_MKDEV 1
"
SEDDEFS="${SEDDEFS}\${SEDdA}MAJOR_IN_MKDEV\${SEDdB}MAJOR_IN_MKDEV\${SEDdC}1\${SEDdD}
\${SEDuA}MAJOR_IN_MKDEV\${SEDuB}MAJOR_IN_MKDEV\${SEDuC}1\${SEDuD}
\${SEDeA}MAJOR_IN_MKDEV\${SEDeB}MAJOR_IN_MKDEV\${SEDeC}1\${SEDeD}
" makedev=1
fi
rm -f conftest*

fi
if test -z "$makedev"; then
echo checking for sys/sysmacros.h
cat > conftest.c <<EOF
$DEFS
#include <sys/sysmacros.h>
EOF
err=`eval "$CPP conftest.c 2>&1 >/dev/null"`
if test -z "$err"; then
  DEFS="${DEFS}#define MAJOR_IN_SYSMACROS 1
"
SEDDEFS="${SEDDEFS}\${SEDdA}MAJOR_IN_SYSMACROS\${SEDdB}MAJOR_IN_SYSMACROS\${SEDdC}1\${SEDdD}
\${SEDuA}MAJOR_IN_SYSMACROS\${SEDuB}MAJOR_IN_SYSMACROS\${SEDuC}1\${SEDuD}
\${SEDeA}MAJOR_IN_SYSMACROS\${SEDeB}MAJOR_IN_SYSMACROS\${SEDeC}1\${SEDeD}
"
fi
rm -f conftest*

fi

echo checking for return type of signal handlers
cat > conftest.c <<EOF
#include <sys/types.h>
#include <signal.h>
#ifdef signal
#undef signal
#endif
extern void (*signal ()) ();
main() { exit(0); } 
t() { int i; }
EOF
if eval $compile; then
  DEFS="${DEFS}#define RETSIGTYPE void
"
SEDDEFS="${SEDDEFS}\${SEDdA}RETSIGTYPE\${SEDdB}RETSIGTYPE\${SEDdC}void\${SEDdD}
\${SEDuA}RETSIGTYPE\${SEDuB}RETSIGTYPE\${SEDuC}void\${SEDuD}
\${SEDeA}RETSIGTYPE\${SEDeB}RETSIGTYPE\${SEDeC}void\${SEDeD}
"
else
  DEFS="${DEFS}#define RETSIGTYPE int
"
SEDDEFS="${SEDDEFS}\${SEDdA}RETSIGTYPE\${SEDdB}RETSIGTYPE\${SEDdC}int\${SEDdD}
\${SEDuA}RETSIGTYPE\${SEDuB}RETSIGTYPE\${SEDuC}int\${SEDuD}
\${SEDeA}RETSIGTYPE\${SEDeB}RETSIGTYPE\${SEDeC}int\${SEDeD}
"
fi
rm -f conftest*


echo checking for time.h and sys/time.h being included together
cat > conftest.c <<EOF
#include <sys/time.h>
#include <time.h>
main() { exit(0); } 
t() { int i; }
EOF
if eval $compile; then
  DEFS="${DEFS}#define HAVE_SYS_TIME_AND_TIME_H 1
"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_SYS_TIME_AND_TIME_H\${SEDdB}HAVE_SYS_TIME_AND_TIME_H\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_SYS_TIME_AND_TIME_H\${SEDuB}HAVE_SYS_TIME_AND_TIME_H\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_SYS_TIME_AND_TIME_H\${SEDeB}HAVE_SYS_TIME_AND_TIME_H\${SEDeC}1\${SEDeD}
"
fi
rm -f conftest*

echo checking for termios.h and sys/ioctl.h being included together
cat > conftest.c <<EOF
#include <termios.h>
#include <sys/ioctl.h>
main() { exit(0); } 
t() { int i; }
EOF
if eval $compile; then
  DEFS="${DEFS}#define HAVE_TERMIOS_AND_SYS_IOCTL_H 1
"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_TERMIOS_AND_SYS_IOCTL_H\${SEDdB}HAVE_TERMIOS_AND_SYS_IOCTL_H\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_TERMIOS_AND_SYS_IOCTL_H\${SEDuB}HAVE_TERMIOS_AND_SYS_IOCTL_H\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_TERMIOS_AND_SYS_IOCTL_H\${SEDeB}HAVE_TERMIOS_AND_SYS_IOCTL_H\${SEDeC}1\${SEDeD}
"
fi
rm -f conftest*

echo checking for CBREAK
cat > conftest.c <<EOF
#include <sgtty.h>
main() { exit(0); } 
t() { int i = CBREAK; }
EOF
if eval $compile; then
  DEFS="${DEFS}#define HAVE_CBREAK 1
"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_CBREAK\${SEDdB}HAVE_CBREAK\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_CBREAK\${SEDuB}HAVE_CBREAK\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_CBREAK\${SEDeB}HAVE_CBREAK\${SEDeC}1\${SEDeD}
"
fi
rm -f conftest*

echo checking for pid_t in sys/types.h
cat > conftest.c <<EOF
#include <sys/types.h>
main() { exit(0); } 
t() { pid_t x; }
EOF
if eval $compile; then
  :
else
  DEFS="${DEFS}#define PID_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}
"
fi
rm -f conftest*

echo checking for uid_t in sys/types.h
cat > conftest.c <<EOF
#include <sys/types.h>
main() { exit(0); } 
t() { uid_t x; }
EOF
if eval $compile; then
  :
else
  DEFS="${DEFS}#define UID_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}
"
fi
rm -f conftest*

echo checking for gid_t in sys/types.h
cat > conftest.c <<EOF
#include <sys/types.h>
main() { exit(0); } 
t() { gid_t x; }
EOF
if eval $compile; then
  :
else
  DEFS="${DEFS}#define GID_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}
"
fi
rm -f conftest*

echo checking for off_t in sys/types.h
cat > conftest.c <<EOF
#include <sys/types.h>
main() { exit(0); } 
t() { off_t x; }
EOF
if eval $compile; then
  :
else
  DEFS="${DEFS}#define OFF_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}
"
fi
rm -f conftest*

echo checking for sig_atomic_t in signal.h
cat > conftest.c <<EOF
#include <signal.h>
main() { exit(0); } 
t() { sig_atomic_t x; }
EOF
if eval $compile; then
  DEFS="${DEFS}#define HAVE_SIG_ATOMIC_T_IN_SIGNAL_H 1
"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_SIG_ATOMIC_T_IN_SIGNAL_H\${SEDdB}HAVE_SIG_ATOMIC_T_IN_SIGNAL_H\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_SIG_ATOMIC_T_IN_SIGNAL_H\${SEDuB}HAVE_SIG_ATOMIC_T_IN_SIGNAL_H\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_SIG_ATOMIC_T_IN_SIGNAL_H\${SEDeB}HAVE_SIG_ATOMIC_T_IN_SIGNAL_H\${SEDeC}1\${SEDeD}
"
fi
rm -f conftest*

echo checking for sig_atomic_t in sys/types.h
cat > conftest.c <<EOF
#include <sys/types.h>
main() { exit(0); } 
t() { sig_atomic_t x; }
EOF
if eval $compile; then
  DEFS="${DEFS}#define HAVE_SIG_ATOMIC_T_IN_TYPES_H 1
"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_SIG_ATOMIC_T_IN_TYPES_H\${SEDdB}HAVE_SIG_ATOMIC_T_IN_TYPES_H\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_SIG_ATOMIC_T_IN_TYPES_H\${SEDuB}HAVE_SIG_ATOMIC_T_IN_TYPES_H\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_SIG_ATOMIC_T_IN_TYPES_H\${SEDeB}HAVE_SIG_ATOMIC_T_IN_TYPES_H\${SEDeC}1\${SEDeD}
"
fi
rm -f conftest*

case $DEFS in
*HAVE_STDDEF_H*)
  echo checking for size_t in stddef.h
cat > conftest.c <<EOF
#include <stddef.h>
main() { exit(0); } 
t() { size_t x; }
EOF
if eval $compile; then
  DEFS="${DEFS}#define HAVE_SIZE_T_IN_STDDEF_H 1
"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_SIZE_T_IN_STDDEF_H\${SEDdB}HAVE_SIZE_T_IN_STDDEF_H\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_SIZE_T_IN_STDDEF_H\${SEDuB}HAVE_SIZE_T_IN_STDDEF_H\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_SIZE_T_IN_STDDEF_H\${SEDeB}HAVE_SIZE_T_IN_STDDEF_H\${SEDeC}1\${SEDeD}
"
fi
rm -f conftest*
 ;;
esac
echo checking for size_t in sys/types.h
cat > conftest.c <<EOF
#include <sys/types.h>
main() { exit(0); } 
t() { size_t x; }
EOF
if eval $compile; then
  DEFS="${DEFS}#define HAVE_SIZE_T_IN_TYPES_H 1
"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_SIZE_T_IN_TYPES_H\${SEDdB}HAVE_SIZE_T_IN_TYPES_H\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_SIZE_T_IN_TYPES_H\${SEDuB}HAVE_SIZE_T_IN_TYPES_H\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_SIZE_T_IN_TYPES_H\${SEDeB}HAVE_SIZE_T_IN_TYPES_H\${SEDeC}1\${SEDeD}
"
fi
rm -f conftest*

echo checking for time_t in time.h
cat > conftest.c <<EOF
#include <time.h>
main() { exit(0); } 
t() { time_t i; }
EOF
if eval $compile; then
  DEFS="${DEFS}#define HAVE_TIME_T_IN_TIME_H 1
"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_TIME_T_IN_TIME_H\${SEDdB}HAVE_TIME_T_IN_TIME_H\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_TIME_T_IN_TIME_H\${SEDuB}HAVE_TIME_T_IN_TIME_H\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_TIME_T_IN_TIME_H\${SEDeB}HAVE_TIME_T_IN_TIME_H\${SEDeC}1\${SEDeD}
"
fi
rm -f conftest*

echo checking for time_t in sys/types.h
cat > conftest.c <<EOF
#include <sys/types.h>
main() { exit(0); } 
t() { time_t i; }
EOF
if eval $compile; then
  DEFS="${DEFS}#define HAVE_TIME_T_IN_TYPES_H 1
"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_TIME_T_IN_TYPES_H\${SEDdB}HAVE_TIME_T_IN_TYPES_H\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_TIME_T_IN_TYPES_H\${SEDuB}HAVE_TIME_T_IN_TYPES_H\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_TIME_T_IN_TYPES_H\${SEDeB}HAVE_TIME_T_IN_TYPES_H\${SEDeC}1\${SEDeD}
"
fi
rm -f conftest*

echo checking how to get filesystem space usage
# SVR4
cat > conftest.c <<EOF
$DEFS
#include <sys/statvfs.h>
EOF
err=`eval "$CPP conftest.c 2>&1 >/dev/null"`
if test -z "$err"; then
  DEFS="${DEFS}#define STAT_STATVFS 1
"
SEDDEFS="${SEDDEFS}\${SEDdA}STAT_STATVFS\${SEDdB}STAT_STATVFS\${SEDdC}1\${SEDdD}
\${SEDuA}STAT_STATVFS\${SEDuB}STAT_STATVFS\${SEDuC}1\${SEDuD}
\${SEDeA}STAT_STATVFS\${SEDeB}STAT_STATVFS\${SEDeC}1\${SEDeD}
" space=1
fi
rm -f conftest*
if test -z "$space"; then
# AIX
echo "${DEFS}#include <sys/statfs.h>" > conftest.c
eval "$CPP conftest.c > conftest.out 2>&1"
if egrep "f_nlsdirtype" conftest.out >/dev/null 2>&1; then
  DEFS="${DEFS}#define STAT_STATFS2_BSIZE 1
"
SEDDEFS="${SEDDEFS}\${SEDdA}STAT_STATFS2_BSIZE\${SEDdB}STAT_STATFS2_BSIZE\${SEDdC}1\${SEDdD}
\${SEDuA}STAT_STATFS2_BSIZE\${SEDuB}STAT_STATFS2_BSIZE\${SEDuC}1\${SEDuD}
\${SEDeA}STAT_STATFS2_BSIZE\${SEDeB}STAT_STATFS2_BSIZE\${SEDeC}1\${SEDeD}
" space=1
fi
rm -f conftest*

fi
if test -z "$space"; then
# SVR3
cat > conftest.c <<EOF
$DEFS
#include <sys/statfs.h>
EOF
err=`eval "$CPP conftest.c 2>&1 >/dev/null"`
if test -z "$err"; then
  DEFS="${DEFS}#define STAT_STATFS4 1
"
SEDDEFS="${SEDDEFS}\${SEDdA}STAT_STATFS4\${SEDdB}STAT_STATFS4\${SEDdC}1\${SEDdD}
\${SEDuA}STAT_STATFS4\${SEDuB}STAT_STATFS4\${SEDuC}1\${SEDuD}
\${SEDeA}STAT_STATFS4\${SEDeB}STAT_STATFS4\${SEDeC}1\${SEDeD}
" space=1
fi
rm -f conftest*
fi
if test -z "$space"; then
# 4.3BSD
cat > conftest.c <<EOF
$DEFS
#include <sys/vfs.h>
EOF
err=`eval "$CPP conftest.c 2>&1 >/dev/null"`
if test -z "$err"; then
  DEFS="${DEFS}#define STAT_STATFS2_BSIZE 1
"
SEDDEFS="${SEDDEFS}\${SEDdA}STAT_STATFS2_BSIZE\${SEDdB}STAT_STATFS2_BSIZE\${SEDdC}1\${SEDdD}
\${SEDuA}STAT_STATFS2_BSIZE\${SEDuB}STAT_STATFS2_BSIZE\${SEDuC}1\${SEDuD}
\${SEDeA}STAT_STATFS2_BSIZE\${SEDeB}STAT_STATFS2_BSIZE\${SEDeC}1\${SEDeD}
" space=1
fi
rm -f conftest*
fi
if test -z "$space"; then
# 4.4BSD
echo "${DEFS}#include <sys/mount.h>" > conftest.c
eval "$CPP conftest.c > conftest.out 2>&1"
if egrep "MOUNT_UFS" conftest.out >/dev/null 2>&1; then
  DEFS="${DEFS}#define STAT_STATFS2_FSIZE 1
"
SEDDEFS="${SEDDEFS}\${SEDdA}STAT_STATFS2_FSIZE\${SEDdB}STAT_STATFS2_FSIZE\${SEDdC}1\${SEDdD}
\${SEDuA}STAT_STATFS2_FSIZE\${SEDuB}STAT_STATFS2_FSIZE\${SEDuC}1\${SEDuD}
\${SEDeA}STAT_STATFS2_FSIZE\${SEDeB}STAT_STATFS2_FSIZE\${SEDeC}1\${SEDeD}
" space=1
fi
rm -f conftest*

fi
if test -z "$space"; then
# Ultrix
cat > conftest.c <<EOF
$DEFS
#include <sys/mount.h>
EOF
err=`eval "$CPP conftest.c 2>&1 >/dev/null"`
if test -z "$err"; then
  DEFS="${DEFS}#define STAT_STATFS2_FS_DATA 1
"
SEDDEFS="${SEDDEFS}\${SEDdA}STAT_STATFS2_FS_DATA\${SEDdB}STAT_STATFS2_FS_DATA\${SEDdC}1\${SEDdD}
\${SEDuA}STAT_STATFS2_FS_DATA\${SEDuB}STAT_STATFS2_FS_DATA\${SEDuC}1\${SEDuD}
\${SEDeA}STAT_STATFS2_FS_DATA\${SEDeB}STAT_STATFS2_FS_DATA\${SEDeC}1\${SEDeD}
" space=1
fi
rm -f conftest*
fi
if test -z "$space"; then
echo checking for ustat
cat > conftest.c <<EOF
#include <stdio.h>
main() { exit(0); } 
t() { 
#ifdef __stub_ustat
choke me
#else
/* Override any gcc2 internal prototype to avoid an error.  */
extern char ustat(); ustat();
#endif
 }
EOF
if eval $compile; then
  DEFS="${DEFS}#define STAT_USTAT 1
"
SEDDEFS="${SEDDEFS}\${SEDdA}STAT_USTAT\${SEDdB}STAT_USTAT\${SEDdC}1\${SEDdD}
\${SEDuA}STAT_USTAT\${SEDuB}STAT_USTAT\${SEDuC}1\${SEDuD}
\${SEDeA}STAT_USTAT\${SEDeB}STAT_USTAT\${SEDeC}1\${SEDeD}
"
fi
rm -f conftest*
#endif

fi
echo checking for void
cat > conftest.c <<EOF

main() { exit(0); } 
t() { extern void foo (); (void) exit (0); }
EOF
if eval $compile; then
  DEFS="${DEFS}#define HAVE_VOID 1
"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_VOID\${SEDdB}HAVE_VOID\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_VOID\${SEDuB}HAVE_VOID\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_VOID\${SEDeB}HAVE_VOID\${SEDeC}1\${SEDeD}
"
fi
rm -f conftest*

echo checking for unsigned char
cat > conftest.c <<EOF

main() { exit(0); } 
t() { unsigned char i = (unsigned char) -1; }
EOF
if eval $compile; then
  DEFS="${DEFS}#define HAVE_UNSIGNED_CHAR 1
"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_UNSIGNED_CHAR\${SEDdB}HAVE_UNSIGNED_CHAR\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_UNSIGNED_CHAR\${SEDuB}HAVE_UNSIGNED_CHAR\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_UNSIGNED_CHAR\${SEDeB}HAVE_UNSIGNED_CHAR\${SEDeC}1\${SEDeD}
"
fi
rm -f conftest*

echo checking for errno
cat > conftest.c <<EOF
#include <errno.h>
main() { exit(0); } 
t() { int i = errno; errno = 1; }
EOF
if eval $compile; then
  DEFS="${DEFS}#define HAVE_ERRNO_DECLARATION 1
"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_ERRNO_DECLARATION\${SEDdB}HAVE_ERRNO_DECLARATION\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_ERRNO_DECLARATION\${SEDuB}HAVE_ERRNO_DECLARATION\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_ERRNO_DECLARATION\${SEDeB}HAVE_ERRNO_DECLARATION\${SEDeC}1\${SEDeD}
"
fi
rm -f conftest*


for func in memset memcmp memchr memcpy bcopy bcmp bzero
do
trfunc=HAVE_`echo $func | tr '[a-z]' '[A-Z]'`
echo checking for ${func}
cat > conftest.c <<EOF
#include <stdio.h>
main() { exit(0); } 
t() { 
#ifdef __stub_${func}
choke me
#else
/* Override any gcc2 internal prototype to avoid an error.  */
extern char ${func}(); ${func}();
#endif
 }
EOF
if eval $compile; then
  DEFS="${DEFS}#define ${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}
"
fi
rm -f conftest*
#endif
done

for func in strchr strrchr index rindex strerror strtol strstr
do
trfunc=HAVE_`echo $func | tr '[a-z]' '[A-Z]'`
echo checking for ${func}
cat > conftest.c <<EOF
#include <stdio.h>
main() { exit(0); } 
t() { 
#ifdef __stub_${func}
choke me
#else
/* Override any gcc2 internal prototype to avoid an error.  */
extern char ${func}(); ${func}();
#endif
 }
EOF
if eval $compile; then
  DEFS="${DEFS}#define ${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}
"
fi
rm -f conftest*
#endif
done

for func in strdup strcasecmp strncasecmp stricmp strnicmp
do
trfunc=HAVE_`echo $func | tr '[a-z]' '[A-Z]'`
echo checking for ${func}
cat > conftest.c <<EOF
#include <stdio.h>
main() { exit(0); } 
t() { 
#ifdef __stub_${func}
choke me
#else
/* Override any gcc2 internal prototype to avoid an error.  */
extern char ${func}(); ${func}();
#endif
 }
EOF
if eval $compile; then
  DEFS="${DEFS}#define ${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}
"
fi
rm -f conftest*
#endif
done

for func in bsearch vfprintf
do
trfunc=HAVE_`echo $func | tr '[a-z]' '[A-Z]'`
echo checking for ${func}
cat > conftest.c <<EOF
#include <stdio.h>
main() { exit(0); } 
t() { 
#ifdef __stub_${func}
choke me
#else
/* Override any gcc2 internal prototype to avoid an error.  */
extern char ${func}(); ${func}();
#endif
 }
EOF
if eval $compile; then
  DEFS="${DEFS}#define ${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}
"
fi
rm -f conftest*
#endif
done

for func in remove ftruncate ltrunc rename opendir dup2 waitpid wait4
do
trfunc=HAVE_`echo $func | tr '[a-z]' '[A-Z]'`
echo checking for ${func}
cat > conftest.c <<EOF
#include <stdio.h>
main() { exit(0); } 
t() { 
#ifdef __stub_${func}
choke me
#else
/* Override any gcc2 internal prototype to avoid an error.  */
extern char ${func}(); ${func}();
#endif
 }
EOF
if eval $compile; then
  DEFS="${DEFS}#define ${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}
"
fi
rm -f conftest*
#endif
done

for func in sigsetjmp setret sigaction sigvec sigset
do
trfunc=HAVE_`echo $func | tr '[a-z]' '[A-Z]'`
echo checking for ${func}
cat > conftest.c <<EOF
#include <stdio.h>
main() { exit(0); } 
t() { 
#ifdef __stub_${func}
choke me
#else
/* Override any gcc2 internal prototype to avoid an error.  */
extern char ${func}(); ${func}();
#endif
 }
EOF
if eval $compile; then
  DEFS="${DEFS}#define ${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}
"
fi
rm -f conftest*
#endif
done

for func in sigprocmask sigblock sighold getdtablesize sysconf
do
trfunc=HAVE_`echo $func | tr '[a-z]' '[A-Z]'`
echo checking for ${func}
cat > conftest.c <<EOF
#include <stdio.h>
main() { exit(0); } 
t() { 
#ifdef __stub_${func}
choke me
#else
/* Override any gcc2 internal prototype to avoid an error.  */
extern char ${func}(); ${func}();
#endif
 }
EOF
if eval $compile; then
  DEFS="${DEFS}#define ${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}
"
fi
rm -f conftest*
#endif
done

for func in setpgrp setsid setreuid gethostname uname
do
trfunc=HAVE_`echo $func | tr '[a-z]' '[A-Z]'`
echo checking for ${func}
cat > conftest.c <<EOF
#include <stdio.h>
main() { exit(0); } 
t() { 
#ifdef __stub_${func}
choke me
#else
/* Override any gcc2 internal prototype to avoid an error.  */
extern char ${func}(); ${func}();
#endif
 }
EOF
if eval $compile; then
  DEFS="${DEFS}#define ${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}
"
fi
rm -f conftest*
#endif
done

for func in gettimeofday ftw glob
do
trfunc=HAVE_`echo $func | tr '[a-z]' '[A-Z]'`
echo checking for ${func}
cat > conftest.c <<EOF
#include <stdio.h>
main() { exit(0); } 
t() { 
#ifdef __stub_${func}
choke me
#else
/* Override any gcc2 internal prototype to avoid an error.  */
extern char ${func}(); ${func}();
#endif
 }
EOF
if eval $compile; then
  DEFS="${DEFS}#define ${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}
"
fi
rm -f conftest*
#endif
done

SAVELIBS="$LIBS"
LIBS=`echo $LIBS | sed 's/-linet//'`
for func in getline
do
trfunc=HAVE_`echo $func | tr '[a-z]' '[A-Z]'`
echo checking for ${func}
cat > conftest.c <<EOF
#include <stdio.h>
main() { exit(0); } 
t() { 
#ifdef __stub_${func}
choke me
#else
/* Override any gcc2 internal prototype to avoid an error.  */
extern char ${func}(); ${func}();
#endif
 }
EOF
if eval $compile; then
  DEFS="${DEFS}#define ${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}
"
fi
rm -f conftest*
#endif
done

LIBS="$SAVELIBS"
echo checking for ftime
cat > conftest.c <<EOF
#include <stdio.h>
main() { exit(0); } 
t() { 
#ifdef __stub_ftime
choke me
#else
/* Override any gcc2 internal prototype to avoid an error.  */
extern char ftime(); ftime();
#endif
 }
EOF
if eval $compile; then
  if test -n "$cross_compiling"
then
  DEFS="${DEFS}#define HAVE_FTIME 1
"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_FTIME\${SEDdB}HAVE_FTIME\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_FTIME\${SEDuB}HAVE_FTIME\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_FTIME\${SEDeB}HAVE_FTIME\${SEDeC}1\${SEDeD}
"
else
cat > conftest.c <<EOF

#include <sys/types.h>
#include <sys/timeb.h>
main ()
{
  struct timeb s, slast;
  int c = 0;
  ftime (&slast);
  while (c < 10)
    {
      ftime (&s);
      if (s.time < slast.time
	  || (s.time == slast.time && s.millitm < slast.millitm))
	exit (1);
      if (s.time != slast.time)
	++c;
      slast.time = s.time;
      slast.millitm = s.millitm;
    }
  exit (0);
}

EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  DEFS="${DEFS}#define HAVE_FTIME 1
"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_FTIME\${SEDdB}HAVE_FTIME\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_FTIME\${SEDuB}HAVE_FTIME\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_FTIME\${SEDeB}HAVE_FTIME\${SEDeC}1\${SEDeD}
"
else
  echo 1>&2 "Your ftime seems to be buggy"
fi
fi
rm -f conftest*
fi
rm -f conftest*
#endif

for func in times
do
trfunc=HAVE_`echo $func | tr '[a-z]' '[A-Z]'`
echo checking for ${func}
cat > conftest.c <<EOF
#include <stdio.h>
main() { exit(0); } 
t() { 
#ifdef __stub_${func}
choke me
#else
/* Override any gcc2 internal prototype to avoid an error.  */
extern char ${func}(); ${func}();
#endif
 }
EOF
if eval $compile; then
  DEFS="${DEFS}#define ${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}
"
fi
rm -f conftest*
#endif
done

for func in napms nap usleep poll select
do
trfunc=HAVE_`echo $func | tr '[a-z]' '[A-Z]'`
echo checking for ${func}
cat > conftest.c <<EOF
#include <stdio.h>
main() { exit(0); } 
t() { 
#ifdef __stub_${func}
choke me
#else
/* Override any gcc2 internal prototype to avoid an error.  */
extern char ${func}(); ${func}();
#endif
 }
EOF
if eval $compile; then
  DEFS="${DEFS}#define ${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}
"
fi
rm -f conftest*
#endif
done

case $DEFS in
*HAVE_NAPMS*) ;;
*HAVE_NAP*)  ;;
*HAVE_USLEEP*) ;;
*HAVE_POLL*) ;;
*HAVE_SELECT*) ;;
*) echo 1>&2 'WARNING: No way to sleep for less than one second'
   echo 1>&2 '         \p in chat scripts will sleep for a full second'
   ;;
esac
for func in getgrent
do
trfunc=HAVE_`echo $func | tr '[a-z]' '[A-Z]'`
echo checking for ${func}
cat > conftest.c <<EOF
#include <stdio.h>
main() { exit(0); } 
t() { 
#ifdef __stub_${func}
choke me
#else
/* Override any gcc2 internal prototype to avoid an error.  */
extern char ${func}(); ${func}();
#endif
 }
EOF
if eval $compile; then
  DEFS="${DEFS}#define ${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}
"
fi
rm -f conftest*
#endif
done

trfrom='[a-z]' trto='[A-Z]'
for i in socket t_open; do
  def=HAVE_`echo $i|tr "$trfrom" "$trto"`
  echo checking for $i
cat > conftest.c <<EOF
#include <stdio.h>
main() { exit(0); } 
t() { 
#ifdef __stub_$i
choke me
#else
/* Override any gcc2 internal prototype to avoid an error.  */
extern char $i(); $i();
#endif
 }
EOF
if eval $compile; then
  DEFS="${DEFS}#define $def 1
"
SEDDEFS="${SEDDEFS}\${SEDdA}$def\${SEDdB}$def\${SEDdC}1\${SEDdD}
\${SEDuA}$def\${SEDuB}$def\${SEDuC}1\${SEDuD}
\${SEDeA}$def\${SEDeB}$def\${SEDeC}1\${SEDeD}
"
else
  missing=1
fi
rm -f conftest*
#endif
  for lib in "-lsocket" "-lsocket -lnsl" "-lnsl" "-lxti"; do
    if test -n "$missing"; then
      case $LIBS in
      *${lib}*) ;;
      *)
	SAVELIBS="$LIBS"
	LIBS="$LIBS $lib"
	missing=
	echo checking for $i with $lib
cat > conftest.c <<EOF

main() { exit(0); } 
t() { extern char $i(); $i(); }
EOF
if eval $compile; then
  DEFS="${DEFS}#define $def 1
"
SEDDEFS="${SEDDEFS}\${SEDdA}$def\${SEDdB}$def\${SEDdC}1\${SEDdD}
\${SEDuA}$def\${SEDuB}$def\${SEDuC}1\${SEDuD}
\${SEDeA}$def\${SEDeB}$def\${SEDeC}1\${SEDeD}
"
else
  missing=1; LIBS="$SAVELIBS"
fi
rm -f conftest*
	;;
      esac
    fi
  done
done
for func in getcwd getwd
do
trfunc=HAVE_`echo $func | tr '[a-z]' '[A-Z]'`
echo checking for ${func}
cat > conftest.c <<EOF
#include <stdio.h>
main() { exit(0); } 
t() { 
#ifdef __stub_${func}
choke me
#else
/* Override any gcc2 internal prototype to avoid an error.  */
extern char ${func}(); ${func}();
#endif
 }
EOF
if eval $compile; then
  DEFS="${DEFS}#define ${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}
"
fi
rm -f conftest*
#endif
done

case $DEFS in
*HAVE_GETCWD*) ;;
*HAVE_GETCD*) ;;
*) UNIXOBJS="$UNIXOBJS getcwd.o"
   if test -s /bin/pwd; then
     DEFS="${DEFS}#define PWD_PROGRAM `echo '"/bin/pwd"'`
"
SEDDEFS="${SEDDEFS}\${SEDdA}PWD_PROGRAM\${SEDdB}PWD_PROGRAM\${SEDdC}`echo '"/bin/pwd"'`\${SEDdD}
\${SEDuA}PWD_PROGRAM\${SEDuB}PWD_PROGRAM\${SEDuC}`echo '"/bin/pwd"'`\${SEDuD}
\${SEDeA}PWD_PROGRAM\${SEDeB}PWD_PROGRAM\${SEDeC}`echo '"/bin/pwd"'`\${SEDeD}
"
   fi ;;
esac
for func in mkdir
do
trfunc=HAVE_`echo $func | tr '[a-z]' '[A-Z]'`
echo checking for ${func}
cat > conftest.c <<EOF
#include <stdio.h>
main() { exit(0); } 
t() { 
#ifdef __stub_${func}
choke me
#else
/* Override any gcc2 internal prototype to avoid an error.  */
extern char ${func}(); ${func}();
#endif
 }
EOF
if eval $compile; then
  DEFS="${DEFS}#define ${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}
"
fi
rm -f conftest*
#endif
done

case $DEFS in
*HAVE_MKDIR*) UUDIR='# ' ;;
*) UUDIR=
   UNIXOBJS="$UNIXOBJS mkdir.o"
   if test -s /bin/mkdir; then
     DEFS="${DEFS}#define MKDIR_PROGRAM `echo '"/bin/mkdir"'`
"
SEDDEFS="${SEDDEFS}\${SEDdA}MKDIR_PROGRAM\${SEDdB}MKDIR_PROGRAM\${SEDdC}`echo '"/bin/mkdir"'`\${SEDdD}
\${SEDuA}MKDIR_PROGRAM\${SEDuB}MKDIR_PROGRAM\${SEDuC}`echo '"/bin/mkdir"'`\${SEDuD}
\${SEDeA}MKDIR_PROGRAM\${SEDeB}MKDIR_PROGRAM\${SEDeC}`echo '"/bin/mkdir"'`\${SEDeD}
"
   fi ;;
esac
for func in rmdir
do
trfunc=HAVE_`echo $func | tr '[a-z]' '[A-Z]'`
echo checking for ${func}
cat > conftest.c <<EOF
#include <stdio.h>
main() { exit(0); } 
t() { 
#ifdef __stub_${func}
choke me
#else
/* Override any gcc2 internal prototype to avoid an error.  */
extern char ${func}(); ${func}();
#endif
 }
EOF
if eval $compile; then
  DEFS="${DEFS}#define ${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}
"
fi
rm -f conftest*
#endif
done

case $DEFS in
*HAVE_RMDIR*) ;;
*) UNIXOBJS="$UNIXOBJS rmdir.o"
   if test -s /bin/rmdir; then
     DEFS="${DEFS}#define RMDIR_PROGRAM `echo '"/bin/rmdir"'`
"
SEDDEFS="${SEDDEFS}\${SEDdA}RMDIR_PROGRAM\${SEDdB}RMDIR_PROGRAM\${SEDdC}`echo '"/bin/rmdir"'`\${SEDdD}
\${SEDuA}RMDIR_PROGRAM\${SEDuB}RMDIR_PROGRAM\${SEDuC}`echo '"/bin/rmdir"'`\${SEDuD}
\${SEDeA}RMDIR_PROGRAM\${SEDeB}RMDIR_PROGRAM\${SEDeC}`echo '"/bin/rmdir"'`\${SEDeD}
"
   fi ;;
esac
case $DEFS in
*HAVE_BSEARCH*) ;;
*) LIBOBJS="$LIBOBJS bsrch.o" ;;
esac
case $DEFS in
*HAVE_BZERO*) ;;
*HAVE_MEMSET*) ;;
*) LIBOBJS="$LIBOBJS bzero.o" ;;
esac
case $DEFS in
*HAVE_GETLINE*) ;;
*) LIBOBJS="$LIBOBJS getlin.o" ;;
esac
case $DEFS in
*HAVE_MEMCHR*) ;;
*) LIBOBJS="$LIBOBJS memchr.o" ;;
esac
case $DEFS in
*HAVE_MEMCMP*) ;;
*HAVE_BCMP*) ;;
*) LIBOBJS="$LIBOBJS memcmp.o" ;;
esac
case $DEFS in
*HAVE_MEMCPY*) ;;
*HAVE_BCOPY*) ;;
*) LIBOBJS="$LIBOBJS memcpy.o" ;;
esac
case $DEFS in
*HAVE_STRCASECMP*) ;;
*HAVE_STRICMP*) ;;
*) LIBOBJS="$LIBOBJS strcas.o" ;;
esac
case $DEFS in
*HAVE_STRCHR*) ;;
*HAVE_INDEX*) ;;
*) LIBOBJS="$LIBOBJS strchr.o" ;;
esac
case $DEFS in
*HAVE_STRDUP*) ;;
*) LIBOBJS="$LIBOBJS strdup.o" ;;
esac
case $DEFS in
*HAVE_STRNCASECMP*) ;;
*HAVE_STRNICMP*) ;;
*) LIBOBJS="$LIBOBJS strncs.o" ;;
esac
case $DEFS in
*HAVE_STRRCHR*) ;;
*HAVE_RINDEX*) ;;
*) LIBOBJS="$LIBOBJS strrch.o" ;;
esac
case $DEFS in
*HAVE_STRSTR*) ;;
*) LIBOBJS="$LIBOBJS strstr.o" ;;
esac
case $DEFS in
*HAVE_STRTOL*) ;;
*) LIBOBJS="$LIBOBJS strtol.o" ;;
esac
case $DEFS in
*HAVE_OPENDIR*) ;;
*) UNIXOBJS="$UNIXOBJS dirent.o" ;;
esac
case $DEFS in
*HAVE_DUP2*) ;;
*) UNIXOBJS="$UNIXOBJS dup2.o" ;;
esac
case $DEFS in
*HAVE_FTW*) ;;
*) UNIXOBJS="$UNIXOBJS ftw.o" ;;
esac
case $DEFS in
*HAVE_REMOVE*) ;;
*) UNIXOBJS="$UNIXOBJS remove.o" ;;
esac
case $DEFS in
*HAVE_RENAME*) ;;
*) UNIXOBJS="$UNIXOBJS rename.o" ;;
esac
case $DEFS in
*HAVE_STRERROR*) ;;
*) UNIXOBJS="$UNIXOBJS strerr.o" ;;
esac

case $DEFS in
*HAVE_SIGVEC*)
  echo checking for sv_flags
cat > conftest.c <<EOF
#include <signal.h>
main() { exit(0); } 
t() { struct sigvec s; s.sv_flags = 0; }
EOF
if eval $compile; then
  DEFS="${DEFS}#define HAVE_SIGVEC_SV_FLAGS 1
"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_SIGVEC_SV_FLAGS\${SEDdB}HAVE_SIGVEC_SV_FLAGS\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_SIGVEC_SV_FLAGS\${SEDuB}HAVE_SIGVEC_SV_FLAGS\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_SIGVEC_SV_FLAGS\${SEDeB}HAVE_SIGVEC_SV_FLAGS\${SEDeC}1\${SEDeD}
"
fi
rm -f conftest*
 ;;
esac

trfrom='[a-z]' trto='[A-Z]'
echo checking for times declared as "long"
cat > conftest.c <<EOF
#include <sys/types.h>
#include <pwd.h>
#include <grp.h>
#ifdef HAVE_LIBC_H
#include <libc.h>
#endif
#ifdef HAVE_SYS_TIMES_H
#include <sys/times.h>
#endif
extern long times ();
main() { exit(0); } 
t() {  }
EOF
if eval $compile; then
  DEFS="${DEFS}#define `echo times | tr "$trfrom" "$trto"`_DECLARATION_OK 1
"
SEDDEFS="${SEDDEFS}\${SEDdA}`echo times | tr "$trfrom" "$trto"`_DECLARATION_OK\${SEDdB}`echo times | tr "$trfrom" "$trto"`_DECLARATION_OK\${SEDdC}1\${SEDdD}
\${SEDuA}`echo times | tr "$trfrom" "$trto"`_DECLARATION_OK\${SEDuB}`echo times | tr "$trfrom" "$trto"`_DECLARATION_OK\${SEDuC}1\${SEDuD}
\${SEDeA}`echo times | tr "$trfrom" "$trto"`_DECLARATION_OK\${SEDeB}`echo times | tr "$trfrom" "$trto"`_DECLARATION_OK\${SEDeC}1\${SEDeD}
"
fi
rm -f conftest*

trfrom='[a-z]' trto='[A-Z]'
echo checking for getpwnam declared as "struct passwd *"
cat > conftest.c <<EOF
#include <sys/types.h>
#include <pwd.h>
#include <grp.h>
#ifdef HAVE_LIBC_H
#include <libc.h>
#endif
#ifdef HAVE_SYS_TIMES_H
#include <sys/times.h>
#endif
extern struct passwd * getpwnam ();
main() { exit(0); } 
t() {  }
EOF
if eval $compile; then
  DEFS="${DEFS}#define `echo getpwnam | tr "$trfrom" "$trto"`_DECLARATION_OK 1
"
SEDDEFS="${SEDDEFS}\${SEDdA}`echo getpwnam | tr "$trfrom" "$trto"`_DECLARATION_OK\${SEDdB}`echo getpwnam | tr "$trfrom" "$trto"`_DECLARATION_OK\${SEDdC}1\${SEDdD}
\${SEDuA}`echo getpwnam | tr "$trfrom" "$trto"`_DECLARATION_OK\${SEDuB}`echo getpwnam | tr "$trfrom" "$trto"`_DECLARATION_OK\${SEDuC}1\${SEDuD}
\${SEDeA}`echo getpwnam | tr "$trfrom" "$trto"`_DECLARATION_OK\${SEDeB}`echo getpwnam | tr "$trfrom" "$trto"`_DECLARATION_OK\${SEDeC}1\${SEDeD}
"
fi
rm -f conftest*

trfrom='[a-z]' trto='[A-Z]'
echo checking for getpwuid declared as "struct passwd *"
cat > conftest.c <<EOF
#include <sys/types.h>
#include <pwd.h>
#include <grp.h>
#ifdef HAVE_LIBC_H
#include <libc.h>
#endif
#ifdef HAVE_SYS_TIMES_H
#include <sys/times.h>
#endif
extern struct passwd * getpwuid ();
main() { exit(0); } 
t() {  }
EOF
if eval $compile; then
  DEFS="${DEFS}#define `echo getpwuid | tr "$trfrom" "$trto"`_DECLARATION_OK 1
"
SEDDEFS="${SEDDEFS}\${SEDdA}`echo getpwuid | tr "$trfrom" "$trto"`_DECLARATION_OK\${SEDdB}`echo getpwuid | tr "$trfrom" "$trto"`_DECLARATION_OK\${SEDdC}1\${SEDdD}
\${SEDuA}`echo getpwuid | tr "$trfrom" "$trto"`_DECLARATION_OK\${SEDuB}`echo getpwuid | tr "$trfrom" "$trto"`_DECLARATION_OK\${SEDuC}1\${SEDuD}
\${SEDeA}`echo getpwuid | tr "$trfrom" "$trto"`_DECLARATION_OK\${SEDeB}`echo getpwuid | tr "$trfrom" "$trto"`_DECLARATION_OK\${SEDeC}1\${SEDeD}
"
fi
rm -f conftest*

trfrom='[a-z]' trto='[A-Z]'
echo checking for getgrent declared as "struct group *"
cat > conftest.c <<EOF
#include <sys/types.h>
#include <pwd.h>
#include <grp.h>
#ifdef HAVE_LIBC_H
#include <libc.h>
#endif
#ifdef HAVE_SYS_TIMES_H
#include <sys/times.h>
#endif
extern struct group * getgrent ();
main() { exit(0); } 
t() {  }
EOF
if eval $compile; then
  DEFS="${DEFS}#define `echo getgrent | tr "$trfrom" "$trto"`_DECLARATION_OK 1
"
SEDDEFS="${SEDDEFS}\${SEDdA}`echo getgrent | tr "$trfrom" "$trto"`_DECLARATION_OK\${SEDdB}`echo getgrent | tr "$trfrom" "$trto"`_DECLARATION_OK\${SEDdC}1\${SEDdD}
\${SEDuA}`echo getgrent | tr "$trfrom" "$trto"`_DECLARATION_OK\${SEDuB}`echo getgrent | tr "$trfrom" "$trto"`_DECLARATION_OK\${SEDuC}1\${SEDuD}
\${SEDeA}`echo getgrent | tr "$trfrom" "$trto"`_DECLARATION_OK\${SEDeB}`echo getgrent | tr "$trfrom" "$trto"`_DECLARATION_OK\${SEDeC}1\${SEDeD}
"
fi
rm -f conftest*

echo checking for BSD setpgrp
cat > conftest.c <<EOF
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
main() { exit(0); } 
t() { getpgrp (0); setpgrp (0, 0); }
EOF
if eval $compile; then
  DEFS="${DEFS}#define HAVE_BSD_PGRP 1
"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_BSD_PGRP\${SEDdB}HAVE_BSD_PGRP\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_BSD_PGRP\${SEDuB}HAVE_BSD_PGRP\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_BSD_PGRP\${SEDeB}HAVE_BSD_PGRP\${SEDeC}1\${SEDeD}
"
fi
rm -f conftest*

echo checking for union wait
cat > conftest.c <<EOF
#include <sys/wait.h>
#ifndef WIFEXITED
#define WIFEXITED(u) ((u).w_termsig == 0)
#endif
main() { exit(0); } 
t() { union wait u; if (WIFEXITED (u)) wait (&u); }
EOF
if eval $compile; then
  DEFS="${DEFS}#define HAVE_UNION_WAIT 1
"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_UNION_WAIT\${SEDdB}HAVE_UNION_WAIT\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_UNION_WAIT\${SEDuB}HAVE_UNION_WAIT\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_UNION_WAIT\${SEDeB}HAVE_UNION_WAIT\${SEDeC}1\${SEDeD}
"
fi
rm -f conftest*

if test -n "$cross_compiling"; then
 DEFS="${DEFS}#define HAVE_LONG_FILE_NAMES 0
"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_LONG_FILE_NAMES\${SEDdB}HAVE_LONG_FILE_NAMES\${SEDdC}0\${SEDdD}
\${SEDuA}HAVE_LONG_FILE_NAMES\${SEDuB}HAVE_LONG_FILE_NAMES\${SEDuC}0\${SEDuD}
\${SEDeA}HAVE_LONG_FILE_NAMES\${SEDeB}HAVE_LONG_FILE_NAMES\${SEDeC}0\${SEDeD}
"
 DEFS="${DEFS}#define HAVE_RESTARTABLE_SYSCALLS -1
"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_RESTARTABLE_SYSCALLS\${SEDdB}HAVE_RESTARTABLE_SYSCALLS\${SEDdC}-1\${SEDdD}
\${SEDuA}HAVE_RESTARTABLE_SYSCALLS\${SEDuB}HAVE_RESTARTABLE_SYSCALLS\${SEDuC}-1\${SEDuD}
\${SEDeA}HAVE_RESTARTABLE_SYSCALLS\${SEDeB}HAVE_RESTARTABLE_SYSCALLS\${SEDeC}-1\${SEDeD}
"
else
 echo checking for restartable system calls
cat > conftest.c <<EOF
/* Exit 0 (true) if wait returns something other than -1,
   i.e. the pid of the child, which means that wait was restarted
   after getting the signal.  */
#include <sys/types.h>
#include <signal.h>
ucatch (isig) { }
main () {
  int i = fork (), status;
  if (i == 0) { sleep (3); kill (getppid (), SIGINT); sleep (3); exit (0); }
  signal (SIGINT, ucatch);
  status = wait(&i);
  if (status == -1) wait(&i);
  exit (status == -1);
}

EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  DEFS="${DEFS}#define HAVE_RESTARTABLE_SYSCALLS 1
"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_RESTARTABLE_SYSCALLS\${SEDdB}HAVE_RESTARTABLE_SYSCALLS\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_RESTARTABLE_SYSCALLS\${SEDuB}HAVE_RESTARTABLE_SYSCALLS\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_RESTARTABLE_SYSCALLS\${SEDeB}HAVE_RESTARTABLE_SYSCALLS\${SEDeC}1\${SEDeD}
"
fi
rm -f conftest*

 echo checking for long file names
(echo 1 > conftest9012345) 2>/dev/null
(echo 2 > conftest9012346) 2>/dev/null
val=`cat conftest9012345 2>/dev/null`
test -f conftest9012345 && test "$val" = 1 && DEFS="${DEFS}#define HAVE_LONG_FILE_NAMES 1
"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_LONG_FILE_NAMES\${SEDdB}HAVE_LONG_FILE_NAMES\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_LONG_FILE_NAMES\${SEDuB}HAVE_LONG_FILE_NAMES\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_LONG_FILE_NAMES\${SEDeB}HAVE_LONG_FILE_NAMES\${SEDeC}1\${SEDeD}
"
rm -f conftest9012345 conftest9012346

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

trap 'rm -f config.status; exit 1' 1 3 15
echo creating config.status
rm -f config.status
cat > config.status <<EOF
#!/bin/sh
# Generated automatically by configure.
# Run this file to recreate the current configuration.
# This directory was configured as follows,
# on host `(hostname || uname -n) 2>/dev/null`:
#
# $0 $*

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

trap 'rm -f Makefile uuconf/Makefile lib/Makefile unix/Makefile conf.h conftest*; exit 1' 1 3 15
CC='$CC'
CPP='$CPP'
INSTALL='$INSTALL'
INSTALL_PROGRAM='$INSTALL_PROGRAM'
INSTALL_DATA='$INSTALL_DATA'
RANLIB='$RANLIB'
CFLAGS='$CFLAGS'
LDFLAGS='$LDFLAGS'
LN_S='$LN_S'
UUDIR='$UUDIR'
LIBOBJS='$LIBOBJS'
UNIXOBJS='$UNIXOBJS'
LIBS='$LIBS'
srcdir='$srcdir'
prefix='$prefix'
exec_prefix='$exec_prefix'
prsub='$prsub'
EOF
cat >> config.status <<\EOF

top_srcdir=$srcdir
for file in .. Makefile uuconf/Makefile lib/Makefile unix/Makefile; do if [ "x$file" != "x.." ]; then
  srcdir=$top_srcdir
  # Remove last slash and all that follows it.  Not all systems have dirname.
  dir=`echo $file|sed 's%/[^/][^/]*$%%'`
  if test "$dir" != "$file"; then
    test "$top_srcdir" != . && srcdir=$top_srcdir/$dir
    test ! -d $dir && mkdir $dir
  fi
  echo creating $file
  rm -f $file
  echo "# Generated automatically from `echo $file|sed 's|.*/||'`.in by configure." > $file
  sed -e "
$prsub
s%@@CC@@%$CC%g
s%@@CPP@@%$CPP%g
s%@@INSTALL@@%$INSTALL%g
s%@@INSTALL_PROGRAM@@%$INSTALL_PROGRAM%g
s%@@INSTALL_DATA@@%$INSTALL_DATA%g
s%@@RANLIB@@%$RANLIB%g
s%@@CFLAGS@@%$CFLAGS%g
s%@@LDFLAGS@@%$LDFLAGS%g
s%@@LN_S@@%$LN_S%g
s%@@UUDIR@@%$UUDIR%g
s%@@LIBOBJS@@%$LIBOBJS%g
s%@@UNIXOBJS@@%$UNIXOBJS%g
s%@@LIBS@@%$LIBS%g
s%@@srcdir@@%$srcdir%g
s%@@DEFS@@%-DHAVE_CONFIG_H%" $top_srcdir/${file}.in >> $file
fi; done

echo creating conf.h
# 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'
rm -f conftest.sed
cat > conftest.sed <<CONFEOF
EOF
# Turn off quoting long enough to insert the sed commands.
cat >> config.status <<EOF
$SEDDEFS
EOF
cat >> config.status <<\EOF
CONFEOF
rm -f conftest.h
# Break up the sed commands because old seds have small limits.
cp $top_srcdir/conf.h.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 40q conftest.sed > conftest.s1 # Like head -40.
  sed 1,40d conftest.sed > conftest.s2 # Like tail +41.
  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 "/* conf.h.  Generated automatically by configure.  */" > conftest.h
cat conftest.h1 >> conftest.h
rm -f conftest.h1
if cmp -s conf.h conftest.h 2>/dev/null; then
  # The file exists and we would not be changing it.
  rm -f conftest.h
else
  rm -f conf.h
  mv conftest.h conf.h
fi

EOF
chmod +x config.status
test -n "$no_create" || ./config.status

@
