
#!/bin/sh
# From configure.in Revision: 1.28 
#!/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

rm -f conftest* confdefs.h
# 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=source/irc.c

# 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


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




VERSION=`sed -n -e 's/"$//' -e '/#define IRCII_VERSION	*"/s///p' < source/irc.c` 
echo this is ircii version $VERSION
echo



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 checking for $word
  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"
fi
test -z "$CC" && CC="cc"
test -n "$CC" && test -n "$verbose" && echo "	setting CC to $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
  # 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"
  cat > conftest.c <<EOF
#include "confdefs.h"
#include <stdio.h>
Syntax Error
EOF
err=`eval "($CPP conftest.c >/dev/null) 2>&1"`
if test -z "$err"; then
  :
else
  rm -rf conftest*
  CPP=/lib/cpp
fi
rm -f conftest*
fi
test ".${verbose}" != "." && echo "	setting CPP to $CPP"

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.
  
{
test -n "$verbose" && \
echo "	defining _POSIX_SOURCE"
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}
"
}

  if test -n "$GCC"; then
    CC="$CC -posix"
  else
    CC="$CC -Xp"
  fi
fi

echo checking for AIX
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
  rm -rf conftest*
  
{
test -n "$verbose" && \
echo "	defining _ALL_SOURCE"
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}
"
}


fi
rm -f conftest*


if test -z "$LEX"; then
  # Extract the first word of `flex', so it can be a program name with args.
  set dummy flex; word=$2
  echo checking for $word
  IFS="${IFS= 	}"; saveifs="$IFS"; IFS="${IFS}:"
  for dir in $PATH; do
    test -z "$dir" && dir=.
    if test -f $dir/$word; then
      LEX="flex"
      break
    fi
  done
  IFS="$saveifs"
fi
test -z "$LEX" && LEX="lex"
test -n "$LEX" && test -n "$verbose" && echo "	setting LEX to $LEX"

if test -z "$LEXLIB"
then
  case "$LEX" in
  flex*) LIBS_save="${LIBS}"
LIBS="${LIBS} -lfl"
have_lib=""
echo checking for -lfl
cat > conftest.c <<EOF
#include "confdefs.h"

int main() { exit(0); }
int t() { main(); }
EOF
if eval $compile; then
  rm -rf conftest*
  have_lib="1"

fi
rm -f conftest*
LIBS="${LIBS_save}"
if test -n "${have_lib}"; then
   :; LEXLIB="-lfl"
else
   :; 
fi
 ;;
  *) LEXLIB="-ll" ;;
  esac
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
#include "confdefs.h"
$prog
EOF
eval "$CPP conftest.c > conftest.out 2>&1"
if egrep "$pattern" conftest.out >/dev/null 2>&1; then
  rm -rf conftest*
  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
  rm -rf conftest*
  need_trad=1

fi
rm -f conftest*

  fi
  test -n "$need_trad" && CC="$CC -traditional"
fi

LIBS_save="${LIBS}"
LIBS="${LIBS} -lsun"
have_lib=""
echo checking for -lsun
cat > conftest.c <<EOF
#include "confdefs.h"

int main() { exit(0); }
int t() { main(); }
EOF
if eval $compile; then
  rm -rf conftest*
  have_lib="1"

fi
rm -f conftest*
LIBS="${LIBS_save}"
if test -n "${have_lib}"; then
   :; LIBS="$LIBS -lsun"
else
   :; 
fi



echo checking for solaris
if /bin/sun 2> /dev/null
then
  uname=`uname -r`
  case "$uname" in
    4.*)
      ;;
    5.*) 
{
test -n "$verbose" && \
echo "	defining __solaris__"
echo "#define" __solaris__ 1 >> confdefs.h
DEFS="$DEFS -D__solaris__=1"
SEDDEFS="${SEDDEFS}\${SEDdA}__solaris__\${SEDdB}__solaris__\${SEDdC}1\${SEDdD}
\${SEDuA}__solaris__\${SEDuB}__solaris__\${SEDuC}1\${SEDuD}
\${SEDeA}__solaris__\${SEDeB}__solaris__\${SEDeC}1\${SEDeD}
"
}

	 
{
test -n "$verbose" && \
echo "	defining SVR4"
echo "#define" SVR4 1 >> confdefs.h
DEFS="$DEFS -DSVR4=1"
SEDDEFS="${SEDDEFS}\${SEDdA}SVR4\${SEDdB}SVR4\${SEDdC}1\${SEDdD}
\${SEDuA}SVR4\${SEDuB}SVR4\${SEDuC}1\${SEDuD}
\${SEDeA}SVR4\${SEDeB}SVR4\${SEDeC}1\${SEDeD}
"
}

      ;;
  esac
fi

case "$DEFS" in
  *-DSVR4*)			   ;;
  *)

echo checking for SVR4
cat > conftest.c <<EOF
#include "confdefs.h"
#if defined(SVR4) || defined(__svr4__)
  yes
#endif

EOF
eval "$CPP conftest.c > conftest.out 2>&1"
if egrep "yes" conftest.out >/dev/null 2>&1; then
  rm -rf conftest*
  svr4=1

fi
rm -f conftest*

    ;;
esac

if test -n "$svr4"
then
  LIBS="-L/usr/ccs/lib $LIBS"
  
{
test -n "$verbose" && \
echo "	defining SVR4"
echo "#define" SVR4 1 >> confdefs.h
DEFS="$DEFS -DSVR4=1"
SEDDEFS="${SEDDEFS}\${SEDdA}SVR4\${SEDdB}SVR4\${SEDdC}1\${SEDdD}
\${SEDuA}SVR4\${SEDuB}SVR4\${SEDuC}1\${SEDuD}
\${SEDeA}SVR4\${SEDeB}SVR4\${SEDeC}1\${SEDeD}
"
}

fi


echo checking for -I/usr/netinclude
if test -d /usr/netinclude; then
  CFLAGS="$CFLAGS -I/usr/netinclude"
fi
  
for hdr in sys/un.h sys/select.h sys/fcntl.h sys/file.h sys/time.h sys/wait.h sys/twg_config.h sys/ptem.h
do
trhdr=HAVE_`echo $hdr | tr '[a-z]./' '[A-Z]__'`
echo checking for ${hdr}
cat > conftest.c <<EOF
#include "confdefs.h"
#include <${hdr}>
EOF
err=`eval "($CPP conftest.c >/dev/null) 2>&1"`
if test -z "$err"; then
  rm -rf conftest*
  
{
test -n "$verbose" && \
echo "	defining ${trhdr}"
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}
"
}


fi
rm -f conftest*
done
for hdr in unistd.h fcntl.h string.h memory.h netdb.h limits.h
do
trhdr=HAVE_`echo $hdr | tr '[a-z]./' '[A-Z]__'`
echo checking for ${hdr}
cat > conftest.c <<EOF
#include "confdefs.h"
#include <${hdr}>
EOF
err=`eval "($CPP conftest.c >/dev/null) 2>&1"`
if test -z "$err"; then
  rm -rf conftest*
  
{
test -n "$verbose" && \
echo "	defining ${trhdr}"
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}
"
}


fi
rm -f conftest*
done
echo checking for setsid
cat > conftest.c <<EOF
#include "confdefs.h"
#include <ctype.h>
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_setsid) || defined (__stub___setsid)
choke me
#else
/* Override any gcc2 internal prototype to avoid an error.  */
extern char setsid(); setsid();
#endif
 }
EOF
if eval $compile; then
  rm -rf conftest*
  {
test -n "$verbose" && \
echo "	defining HAVE_SETSID"
echo "#define" HAVE_SETSID 1 >> confdefs.h
DEFS="$DEFS -DHAVE_SETSID=1"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_SETSID\${SEDdB}HAVE_SETSID\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_SETSID\${SEDuB}HAVE_SETSID\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_SETSID\${SEDeB}HAVE_SETSID\${SEDeC}1\${SEDeD}
"
}


fi
rm -f conftest*

echo checking for getpgid
cat > conftest.c <<EOF
#include "confdefs.h"
#include <ctype.h>
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_getpgid) || defined (__stub___getpgid)
choke me
#else
/* Override any gcc2 internal prototype to avoid an error.  */
extern char getpgid(); getpgid();
#endif
 }
EOF
if eval $compile; then
  rm -rf conftest*
  {
test -n "$verbose" && \
echo "	defining HAVE_GETPGID"
echo "#define" HAVE_GETPGID 1 >> confdefs.h
DEFS="$DEFS -DHAVE_GETPGID=1"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_GETPGID\${SEDdB}HAVE_GETPGID\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_GETPGID\${SEDuB}HAVE_GETPGID\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_GETPGID\${SEDeB}HAVE_GETPGID\${SEDeC}1\${SEDeD}
"
}


fi
rm -f conftest*

echo checking for getsid
cat > conftest.c <<EOF
#include "confdefs.h"
#include <ctype.h>
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_getsid) || defined (__stub___getsid)
choke me
#else
/* Override any gcc2 internal prototype to avoid an error.  */
extern char getsid(); getsid();
#endif
 }
EOF
if eval $compile; then
  rm -rf conftest*
  {
test -n "$verbose" && \
echo "	defining HAVE_GETSID"
echo "#define" HAVE_GETSID 1 >> confdefs.h
DEFS="$DEFS -DHAVE_GETSID=1"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_GETSID\${SEDdB}HAVE_GETSID\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_GETSID\${SEDuB}HAVE_GETSID\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_GETSID\${SEDeB}HAVE_GETSID\${SEDeC}1\${SEDeD}
"
}


fi
rm -f conftest*

echo checking for scandir
cat > conftest.c <<EOF
#include "confdefs.h"
#include <ctype.h>
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_scandir) || defined (__stub___scandir)
choke me
#else
/* Override any gcc2 internal prototype to avoid an error.  */
extern char scandir(); scandir();
#endif
 }
EOF
if eval $compile; then
  rm -rf conftest*
  {
test -n "$verbose" && \
echo "	defining HAVE_SCANDIR"
echo "#define" HAVE_SCANDIR 1 >> confdefs.h
DEFS="$DEFS -DHAVE_SCANDIR=1"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_SCANDIR\${SEDdB}HAVE_SCANDIR\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_SCANDIR\${SEDuB}HAVE_SCANDIR\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_SCANDIR\${SEDeB}HAVE_SCANDIR\${SEDeC}1\${SEDeD}
"
}


fi
rm -f conftest*

echo checking for getwd
cat > conftest.c <<EOF
#include "confdefs.h"
#include <ctype.h>
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_getwd) || defined (__stub___getwd)
choke me
#else
/* Override any gcc2 internal prototype to avoid an error.  */
extern char getwd(); getwd();
#endif
 }
EOF
if eval $compile; then
  :
else
  rm -rf conftest*
  {
test -n "$verbose" && \
echo "	defining NEED_GETWD"
echo "#define" NEED_GETWD 1 >> confdefs.h
DEFS="$DEFS -DNEED_GETWD=1"
SEDDEFS="${SEDDEFS}\${SEDdA}NEED_GETWD\${SEDdB}NEED_GETWD\${SEDdC}1\${SEDdD}
\${SEDuA}NEED_GETWD\${SEDuB}NEED_GETWD\${SEDuC}1\${SEDuD}
\${SEDeA}NEED_GETWD\${SEDeB}NEED_GETWD\${SEDeC}1\${SEDeD}
"
}

fi
rm -f conftest*

echo checking for fchmod
cat > conftest.c <<EOF
#include "confdefs.h"
#include <ctype.h>
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_fchmod) || defined (__stub___fchmod)
choke me
#else
/* Override any gcc2 internal prototype to avoid an error.  */
extern char fchmod(); fchmod();
#endif
 }
EOF
if eval $compile; then
  :
else
  rm -rf conftest*
  {
test -n "$verbose" && \
echo "	defining NEED_FCHMOD"
echo "#define" NEED_FCHMOD 1 >> confdefs.h
DEFS="$DEFS -DNEED_FCHMOD=1"
SEDDEFS="${SEDDEFS}\${SEDdA}NEED_FCHMOD\${SEDdB}NEED_FCHMOD\${SEDdC}1\${SEDdD}
\${SEDuA}NEED_FCHMOD\${SEDuB}NEED_FCHMOD\${SEDuC}1\${SEDuD}
\${SEDeA}NEED_FCHMOD\${SEDeB}NEED_FCHMOD\${SEDeC}1\${SEDeD}
"
}

fi
rm -f conftest*

echo checking for ANSI C header files
cat > conftest.c <<EOF
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <float.h>
EOF
err=`eval "($CPP conftest.c >/dev/null) 2>&1"`
if test -z "$err"; then
  rm -rf conftest*
  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
echo '#include "confdefs.h"
#include <string.h>' > conftest.c
eval "$CPP conftest.c > conftest.out 2>&1"
if egrep "memchr" conftest.out >/dev/null 2>&1; then
  rm -rf conftest*
  # SGI's /bin/cc from Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
cat > conftest.c <<EOF
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
#define XOR(e,f) (((e) && !(f)) || (!(e) && (f)))
int main () { int i; for (i = 0; i < 256; i++)
if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
exit (0); }

EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  
{
test -n "$verbose" && \
echo "	defining STDC_HEADERS"
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}
"
}


fi
rm -fr conftest*

fi
rm -f conftest*


fi
rm -f conftest*

echo checking for whether time.h and sys/time.h may both be included
cat > conftest.c <<EOF
#include "confdefs.h"
#include <sys/types.h>
#include <sys/time.h>
#include <time.h>
int main() { exit(0); }
int t() { struct tm *tp; }
EOF
if eval $compile; then
  rm -rf conftest*
  
{
test -n "$verbose" && \
echo "	defining TIME_WITH_SYS_TIME"
echo "#define" TIME_WITH_SYS_TIME 1 >> confdefs.h
DEFS="$DEFS -DTIME_WITH_SYS_TIME=1"
SEDDEFS="${SEDDEFS}\${SEDdA}TIME_WITH_SYS_TIME\${SEDdB}TIME_WITH_SYS_TIME\${SEDdC}1\${SEDdD}
\${SEDuA}TIME_WITH_SYS_TIME\${SEDuB}TIME_WITH_SYS_TIME\${SEDuC}1\${SEDuD}
\${SEDeA}TIME_WITH_SYS_TIME\${SEDeB}TIME_WITH_SYS_TIME\${SEDeC}1\${SEDeD}
"
}


fi
rm -f conftest*

echo checking for directory library header
dirheader=
if test -z "$dirheader"; then
  echo checking for dirent.h
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
  rm -rf conftest*
  
{
test -n "$verbose" && \
echo "	defining DIRENT"
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}
"
}
 dirheader=dirent.h

fi
rm -f conftest*
fi
if test -z "$dirheader"; then
  echo checking for sys/ndir.h
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
  rm -rf conftest*
  
{
test -n "$verbose" && \
echo "	defining SYSNDIR"
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}
"
}
 dirheader=sys/ndir.h

fi
rm -f conftest*
fi
if test -z "$dirheader"; then
  echo checking for sys/dir.h
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
  rm -rf conftest*
  
{
test -n "$verbose" && \
echo "	defining SYSDIR"
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}
"
}
 dirheader=sys/dir.h

fi
rm -f conftest*
fi
if test -z "$dirheader"; then
  echo checking for ndir.h
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
  rm -rf conftest*
  
{
test -n "$verbose" && \
echo "	defining NDIR"
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}
"
}
 dirheader=ndir.h

fi
rm -f conftest*
fi

echo checking for closedir return value
cat > conftest.c <<EOF
#include "confdefs.h"
#include <sys/types.h>
#include <$dirheader>
int closedir(); main() { exit(closedir(opendir(".")) != 0); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  :
else
  
{
test -n "$verbose" && \
echo "	defining VOID_CLOSEDIR"
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}
"
}

fi
rm -fr conftest*

echo checking for return type of signal handlers
cat > conftest.c <<EOF
#include "confdefs.h"
#include <sys/types.h>
#include <signal.h>
#ifdef signal
#undef signal
#endif
extern void (*signal ()) ();
int main() { exit(0); }
int t() { int i; }
EOF
if eval $compile; then
  rm -rf conftest*
  
{
test -n "$verbose" && \
echo "	defining" RETSIGTYPE to be void
echo "#define" RETSIGTYPE void >> confdefs.h
DEFS="$DEFS -DRETSIGTYPE=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
  rm -rf conftest*
  
{
test -n "$verbose" && \
echo "	defining" RETSIGTYPE to be int
echo "#define" RETSIGTYPE int >> confdefs.h
DEFS="$DEFS -DRETSIGTYPE=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 mode_t in sys/types.h
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
  :
else
  rm -rf conftest*
  
{
test -n "$verbose" && \
echo "	defining" mode_t to be int
echo "#define" mode_t int >> confdefs.h
DEFS="$DEFS -Dmode_t=int"
SEDDEFS="${SEDDEFS}\${SEDdA}mode_t\${SEDdB}mode_t\${SEDdC}int\${SEDdD}
\${SEDuA}mode_t\${SEDuB}mode_t\${SEDuC}int\${SEDuD}
\${SEDeA}mode_t\${SEDeB}mode_t\${SEDeC}int\${SEDeD}
"
}

fi
rm -f conftest*

echo checking for pid_t in sys/types.h
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
  :
else
  rm -rf conftest*
  
{
test -n "$verbose" && \
echo "	defining" pid_t to be int
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}
"
}

fi
rm -f conftest*

echo checking for size_t in sys/types.h
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
  :
else
  rm -rf conftest*
  
{
test -n "$verbose" && \
echo "	defining" size_t to be unsigned
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}
"
}

fi
rm -f conftest*

echo checking for uid_t in sys/types.h
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
  :
else
  rm -rf conftest*
  
{
test -n "$verbose" && \
echo "	defining" uid_t to be int
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}
"
}
 
{
test -n "$verbose" && \
echo "	defining" gid_t to be int
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}
"
}

fi
rm -f conftest*


case $DEFS in
  *HAVE_SYS_TWG_CONFIG*)  
{
test -n "$verbose" && \
echo "	defining WINS"
echo "#define" WINS 1 >> confdefs.h
DEFS="$DEFS -DWINS=1"
SEDDEFS="${SEDDEFS}\${SEDdA}WINS\${SEDdB}WINS\${SEDdC}1\${SEDdD}
\${SEDuA}WINS\${SEDuB}WINS\${SEDuC}1\${SEDuD}
\${SEDeA}WINS\${SEDeB}WINS\${SEDeC}1\${SEDeD}
"
}

    ;;
esac


echo checking for hpux version
if test -f /hp-ux; then
  hpux=1
  uname=`uname -r` 2> /dev/null
  case $uname in
	A.09* | A.9* | a.9* | a.09* | 9* | 09*)
		;;
	A.08* | A.8* | a.8* | a.08* | 8* | 08*)
		
{
test -n "$verbose" && \
echo "	defining HPUX8"
echo "#define" HPUX8 1 >> confdefs.h
DEFS="$DEFS -DHPUX8=1"
SEDDEFS="${SEDDEFS}\${SEDdA}HPUX8\${SEDdB}HPUX8\${SEDdC}1\${SEDdD}
\${SEDuA}HPUX8\${SEDuB}HPUX8\${SEDuC}1\${SEDuD}
\${SEDeA}HPUX8\${SEDeB}HPUX8\${SEDeC}1\${SEDeD}
"
}

		;;
	A.07* | A.7* | a.7* | a.07* | 7* | 07*)
		
{
test -n "$verbose" && \
echo "	defining HPUX7"
echo "#define" HPUX7 1 >> confdefs.h
DEFS="$DEFS -DHPUX7=1"
SEDDEFS="${SEDDEFS}\${SEDdA}HPUX7\${SEDdB}HPUX7\${SEDdC}1\${SEDdD}
\${SEDuA}HPUX7\${SEDuB}HPUX7\${SEDuC}1\${SEDuD}
\${SEDeA}HPUX7\${SEDeB}HPUX7\${SEDeC}1\${SEDeD}
"
}

		;;
	*)
		
{
test -n "$verbose" && \
echo "	defining HPUXUNKNOWN"
echo "#define" HPUXUNKNOWN 1 >> confdefs.h
DEFS="$DEFS -DHPUXUNKNOWN=1"
SEDDEFS="${SEDDEFS}\${SEDdA}HPUXUNKNOWN\${SEDdB}HPUXUNKNOWN\${SEDdC}1\${SEDdD}
\${SEDuA}HPUXUNKNOWN\${SEDuB}HPUXUNKNOWN\${SEDuC}1\${SEDuD}
\${SEDeA}HPUXUNKNOWN\${SEDeB}HPUXUNKNOWN\${SEDeC}1\${SEDeD}
"
}

		;;
  esac
fi


echo checking for NeXT
cat > conftest.c <<EOF
#include "confdefs.h"
#if defined(NeXT) || defined(__NeXT) || defined(__NeXT__)
  yes
#endif

EOF
eval "$CPP conftest.c > conftest.out 2>&1"
if egrep "yes" conftest.out >/dev/null 2>&1; then
  rm -rf conftest*
  nextstep=1

fi
rm -f conftest*


if test -n "$nextstep"; then
  if test "$CC" != "gcc"; then
    CC="cc -bsd"
  fi
fi


echo checking for Ultrix
cat > conftest.c <<EOF
#include "confdefs.h"
#if defined(ultrix) || defined(__ultrix) || defined(__ultrix)
  yes
#endif

EOF
eval "$CPP conftest.c > conftest.out 2>&1"
if egrep "yes" conftest.out >/dev/null 2>&1; then
  rm -rf conftest*
  ULTRIX=1

fi
rm -f conftest*


if test -n "$ULTRIX"; then
  test -z "$GCC" && CC="$CC -YBSD"
else
  # POSIX termios is broken on Ultrix so don't look for it.
echo checking for POSIX.1
cat > conftest.c <<EOF
#include "confdefs.h"
#include <sys/types.h>
#include <unistd.h>
main () {
#ifdef _POSIX_VERSION
  yes
#endif
}

EOF
eval "$CPP conftest.c > conftest.out 2>&1"
if egrep "yes" conftest.out >/dev/null 2>&1; then
  rm -rf conftest*
  
{
test -n "$verbose" && \
echo "	defining POSIX"
echo "#define" POSIX 1 >> confdefs.h
DEFS="$DEFS -DPOSIX=1"
SEDDEFS="${SEDDEFS}\${SEDdA}POSIX\${SEDdB}POSIX\${SEDdC}1\${SEDdD}
\${SEDuA}POSIX\${SEDuB}POSIX\${SEDuC}1\${SEDuD}
\${SEDeA}POSIX\${SEDeB}POSIX\${SEDeC}1\${SEDeD}
"
}


fi
rm -f conftest*

fi


echo checking for sequent/ptx
cat > conftest.c <<EOF
#include "confdefs.h"
#ifdef _SEQUENT_
  yes
#endif

EOF
eval "$CPP conftest.c > conftest.out 2>&1"
if egrep "yes" conftest.out >/dev/null 2>&1; then
  rm -rf conftest*
  LIBS="$LIBS -lseq";seqptx=1

fi
rm -f conftest*



echo checking for struct linger
echo '#include "confdefs.h"
#include <sys/socket.h>' > conftest.c
eval "$CPP conftest.c > conftest.out 2>&1"
if egrep "struct( |	)*linger" conftest.out >/dev/null 2>&1; then
  :
else
  rm -rf conftest*
  
{
test -n "$verbose" && \
echo "	defining NO_STRUCT_LINGER"
echo "#define" NO_STRUCT_LINGER 1 >> confdefs.h
DEFS="$DEFS -DNO_STRUCT_LINGER=1"
SEDDEFS="${SEDDEFS}\${SEDdA}NO_STRUCT_LINGER\${SEDdB}NO_STRUCT_LINGER\${SEDdC}1\${SEDdD}
\${SEDuA}NO_STRUCT_LINGER\${SEDuB}NO_STRUCT_LINGER\${SEDuC}1\${SEDuD}
\${SEDeA}NO_STRUCT_LINGER\${SEDeB}NO_STRUCT_LINGER\${SEDeC}1\${SEDeD}
"
}

fi
rm -f conftest*



case "$DEFS" in
  *-DHAVE_GETSID* | *-DHAVE_GETPGID)		    ;;
  *)						    echo checking if getpgrp\(\) takes an argument
    cat > conftest.c <<EOF
#include "confdefs.h"

main()
{
  int pid;
  int pgid;

  pid = fork();

  if (0 == pid)
  {
#ifdef HAVE_SETSID
    setsid();
#else
    setpgrp(0, getpid());
#endif /* HAVE_SETSID */
    sleep(10);
  }
  else
  {
    sleep(2);
    pgid = getpgrp(pid);
    kill(pid,9);
    if (pid != pgid)
      exit(1);
  }
  exit(0);
}

EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  :
else
  echo your getpgrp\(\) is painful;
{
test -n "$verbose" && \
echo "	defining BROKEN_GETPGRP"
echo "#define" BROKEN_GETPGRP 1 >> confdefs.h
DEFS="$DEFS -DBROKEN_GETPGRP=1"
SEDDEFS="${SEDDEFS}\${SEDdA}BROKEN_GETPGRP\${SEDdB}BROKEN_GETPGRP\${SEDdC}1\${SEDdD}
\${SEDuA}BROKEN_GETPGRP\${SEDuB}BROKEN_GETPGRP\${SEDuC}1\${SEDuD}
\${SEDeA}BROKEN_GETPGRP\${SEDeB}BROKEN_GETPGRP\${SEDeC}1\${SEDeD}
"
}

fi
rm -fr conftest*
    ;;
esac


echo checking for union wait
cat > conftest.c <<EOF
#include "confdefs.h"
#include <sys/types.h>
#include <sys/wait.h>

int main() { exit(0); }
int t() { 
  union wait x;
  int y;
#ifdef WEXITSTATUS
  y = WEXITSTATUS(x);
#endif
 }
EOF
if eval $compile; then
  rm -rf conftest*
  
{
test -n "$verbose" && \
echo "	defining BSDWAIT"
echo "#define" BSDWAIT 1 >> confdefs.h
DEFS="$DEFS -DBSDWAIT=1"
SEDDEFS="${SEDDEFS}\${SEDdA}BSDWAIT\${SEDdB}BSDWAIT\${SEDdC}1\${SEDdD}
\${SEDuA}BSDWAIT\${SEDuB}BSDWAIT\${SEDuC}1\${SEDuD}
\${SEDeA}BSDWAIT\${SEDeB}BSDWAIT\${SEDeC}1\${SEDeD}
"
}


else
  rm -rf conftest*
  echo checking for waitpid
cat > conftest.c <<EOF
#include "confdefs.h"
#include <ctype.h>
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
/* Override any gcc2 internal prototype to avoid an error.  */
extern char waitpid(); waitpid();
#endif
 }
EOF
if eval $compile; then
  :
else
  rm -rf conftest*
  {
test -n "$verbose" && \
echo "	defining NEED_WAITPID"
echo "#define" NEED_WAITPID 1 >> confdefs.h
DEFS="$DEFS -DNEED_WAITPID=1"
SEDDEFS="${SEDDEFS}\${SEDdA}NEED_WAITPID\${SEDdB}NEED_WAITPID\${SEDdC}1\${SEDdD}
\${SEDuA}NEED_WAITPID\${SEDuB}NEED_WAITPID\${SEDuC}1\${SEDuD}
\${SEDeA}NEED_WAITPID\${SEDeB}NEED_WAITPID\${SEDeC}1\${SEDeD}
"
}

fi
rm -f conftest*

fi
rm -f conftest*



oldlibs="$LIBS"
echo checking for select
cat > conftest.c <<EOF
#include "confdefs.h"

int main() { exit(0); }
int t() { select(0, 0, 0, 0, 0); }
EOF
if eval $compile; then
  :
else
  rm -rf conftest*
  LIBS="$oldlibs -lsocket"
echo checking for select with $LIBS
cat > conftest.c <<EOF
#include "confdefs.h"

int main() { exit(0); }
int t() { select(0, 0, 0, 0, 0); }
EOF
if eval $compile; then
  rm -rf conftest*
  libsocket=1

else
  rm -rf conftest*
  LIBS="$oldlibs -lnsl"
echo checking for select with $LIBS
cat > conftest.c <<EOF
#include "confdefs.h"

int main() { exit(0); }
int t() { select(0, 0, 0, 0, 0); }
EOF
if eval $compile; then
  rm -rf conftest*
  libnsl=1

else
  rm -rf conftest*
  LIBS="$oldlibs -linet"
echo checking for select with $LIBS
cat > conftest.c <<EOF
#include "confdefs.h"

int main() { exit(0); }
int t() { select(0, 0, 0, 0, 0); }
EOF
if eval $compile; then
  rm -rf conftest*
  libinet=1

else
  rm -rf conftest*
  LIBS="$oldlibs -lcposix"
echo checking for select with $LIBS
cat > conftest.c <<EOF
#include "confdefs.h"

int main() { exit(0); }
int t() { select(0, 0, 0, 0, 0); }
EOF
if eval $compile; then
  rm -rf conftest*
  libcposix=1

else
  rm -rf conftest*
  LIBS="$oldlibs -lnet -lnsl_s"
echo checking for select with $LIBS
cat > conftest.c <<EOF
#include "confdefs.h"

int main() { exit(0); }
int t() { select(0, 0, 0, 0, 0); }
EOF
if eval $compile; then
  rm -rf conftest*
  libnet=1;libnsl_s=1

else
  rm -rf conftest*
  echo 'no select() - no ircii';exit
fi
rm -f conftest*


fi
rm -f conftest*

fi
rm -f conftest*

fi
rm -f conftest*

fi
rm -f conftest*

fi
rm -f conftest*


echo searching for tgetent
olibs="$LIBS"
LIBS="-ltermcap $olibs"
echo checking for libtermcap
cat > conftest.c <<EOF
#include "confdefs.h"

int main() { exit(0); }
int t() { tgetent((char *)0, (char *)0); }
EOF
if eval $compile; then
  rm -rf conftest*
  
{
test -n "$verbose" && \
echo "	defining USING_TERMCAP"
echo "#define" USING_TERMCAP 1 >> confdefs.h
DEFS="$DEFS -DUSING_TERMCAP=1"
SEDDEFS="${SEDDEFS}\${SEDdA}USING_TERMCAP\${SEDdB}USING_TERMCAP\${SEDdC}1\${SEDdD}
\${SEDuA}USING_TERMCAP\${SEDuB}USING_TERMCAP\${SEDuC}1\${SEDuD}
\${SEDeA}USING_TERMCAP\${SEDeB}USING_TERMCAP\${SEDeC}1\${SEDeD}
"
}


else
  rm -rf conftest*
  LIBS="-ltermlib $olibs"
echo checking for libtermlib
cat > conftest.c <<EOF
#include "confdefs.h"

int main() { exit(0); }
int t() { tgetent((char *)0, (char *)0); }
EOF
if eval $compile; then
  rm -rf conftest*
  
{
test -n "$verbose" && \
echo "	defining USING_TERMLIB"
echo "#define" USING_TERMLIB 1 >> confdefs.h
DEFS="$DEFS -DUSING_TERMLIB=1"
SEDDEFS="${SEDDEFS}\${SEDdA}USING_TERMLIB\${SEDdB}USING_TERMLIB\${SEDdC}1\${SEDdD}
\${SEDuA}USING_TERMLIB\${SEDuB}USING_TERMLIB\${SEDuC}1\${SEDuD}
\${SEDeA}USING_TERMLIB\${SEDeB}USING_TERMLIB\${SEDeC}1\${SEDeD}
"
}


else
  rm -rf conftest*
  LIBS="-lcurses $olibs"
echo checking for libcurses
cat > conftest.c <<EOF
#include "confdefs.h"

int main() { exit(0); }
int t() { tgetent((char *)0, (char *)0); }
EOF
if eval $compile; then
  rm -rf conftest*
  
{
test -n "$verbose" && \
echo "	defining USING_CURSES"
echo "#define" USING_CURSES 1 >> confdefs.h
DEFS="$DEFS -DUSING_CURSES=1"
SEDDEFS="${SEDDEFS}\${SEDdA}USING_CURSES\${SEDdB}USING_CURSES\${SEDdC}1\${SEDdD}
\${SEDuA}USING_CURSES\${SEDuB}USING_CURSES\${SEDuC}1\${SEDuD}
\${SEDeA}USING_CURSES\${SEDeB}USING_CURSES\${SEDeC}1\${SEDeD}
"
}


else
  rm -rf conftest*
  LIBS="-lxtermcap $olibs"
echo checking for libxtermcap
cat > conftest.c <<EOF
#include "confdefs.h"

int main() { exit(0); }
int t() { tgetent((char *)0, (char *)0); }
EOF
if eval $compile; then
  rm -rf conftest*
  
{
test -n "$verbose" && \
echo "	defining USING_XTERMCAP"
echo "#define" USING_XTERMCAP 1 >> confdefs.h
DEFS="$DEFS -DUSING_XTERMCAP=1"
SEDDEFS="${SEDDEFS}\${SEDdA}USING_XTERMCAP\${SEDdB}USING_XTERMCAP\${SEDdC}1\${SEDdD}
\${SEDuA}USING_XTERMCAP\${SEDuB}USING_XTERMCAP\${SEDuC}1\${SEDuD}
\${SEDeA}USING_XTERMCAP\${SEDeB}USING_XTERMCAP\${SEDeC}1\${SEDeD}
"
}


else
  rm -rf conftest*
  echo "no tgetent - no ircii";exit
fi
rm -f conftest*


fi
rm -f conftest*

fi
rm -f conftest*

fi
rm -f conftest*



echo checking signal implimentation
echo checking for sigaction
cat > conftest.c <<EOF
#include "confdefs.h"
#include <ctype.h>
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
/* Override any gcc2 internal prototype to avoid an error.  */
extern char sigaction(); sigaction();
#endif
 }
EOF
if eval $compile; then
  rm -rf conftest*
  {
test -n "$verbose" && \
echo "	defining USE_SIGACTION"
echo "#define" USE_SIGACTION 1 >> confdefs.h
DEFS="$DEFS -DUSE_SIGACTION=1"
SEDDEFS="${SEDDEFS}\${SEDdA}USE_SIGACTION\${SEDdB}USE_SIGACTION\${SEDdC}1\${SEDdD}
\${SEDuA}USE_SIGACTION\${SEDuB}USE_SIGACTION\${SEDuC}1\${SEDuD}
\${SEDeA}USE_SIGACTION\${SEDeB}USE_SIGACTION\${SEDeC}1\${SEDeD}
"
}


else
  rm -rf conftest*
  echo checking for sigset
cat > conftest.c <<EOF
#include "confdefs.h"
#include <ctype.h>
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_sigset) || defined (__stub___sigset)
choke me
#else
/* Override any gcc2 internal prototype to avoid an error.  */
extern char sigset(); sigset();
#endif
 }
EOF
if eval $compile; then
  rm -rf conftest*
  {
test -n "$verbose" && \
echo "	defining USE_SIGSET"
echo "#define" USE_SIGSET 1 >> confdefs.h
DEFS="$DEFS -DUSE_SIGSET=1"
SEDDEFS="${SEDDEFS}\${SEDdA}USE_SIGSET\${SEDdB}USE_SIGSET\${SEDdC}1\${SEDdD}
\${SEDuA}USE_SIGSET\${SEDuB}USE_SIGSET\${SEDuC}1\${SEDuD}
\${SEDeA}USE_SIGSET\${SEDeB}USE_SIGSET\${SEDeC}1\${SEDeD}
"
}


else
  rm -rf conftest*
  echo checking for reliable signals
cat > conftest.c <<EOF
#include "confdefs.h"

#include <sys/types.h>
#include <signal.h>

#ifndef SIGCHLD
# define SIGCHLD SIGCLD
#endif
#ifdef USE_SIGSET
# define signal sigset
#endif

int got;

#ifdef SIGVOID
void
#endif
hand()
{
  got++;
}

main()
{
  (void)signal(SIGCHLD, hand);
  kill(getpid(), SIGCHLD);
  kill(getpid(), SIGCHLD);
  if (got < 2)
    exit(1);
  exit(0);
}

EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  :
else
  
{
test -n "$verbose" && \
echo "	defining SYSVSIGNALS"
echo "#define" SYSVSIGNALS 1 >> confdefs.h
DEFS="$DEFS -DSYSVSIGNALS=1"
SEDDEFS="${SEDDEFS}\${SEDdA}SYSVSIGNALS\${SEDdB}SYSVSIGNALS\${SEDdC}1\${SEDdD}
\${SEDuA}SYSVSIGNALS\${SEDuB}SYSVSIGNALS\${SEDuC}1\${SEDuD}
\${SEDeA}SYSVSIGNALS\${SEDeB}SYSVSIGNALS\${SEDeC}1\${SEDeD}
"
}

fi
rm -fr conftest*

fi
rm -f conftest*

fi
rm -f conftest*


case "$DEFS" in
  *BSDWAIT*)
echo checking for wait3 declaration
cat > conftest.c <<EOF
#include "confdefs.h"
#include <sys/types.h>
#include <signal.h>
#include <sys/wait.h>

EOF
eval "$CPP conftest.c > conftest.out 2>&1"
if egrep "wait3( |	|\()" conftest.out >/dev/null 2>&1; then
  rm -rf conftest*
  
{
test -n "$verbose" && \
echo "	defining WAIT3_DECLARED"
echo "#define" WAIT3_DECLARED 1 >> confdefs.h
DEFS="$DEFS -DWAIT3_DECLARED=1"
SEDDEFS="${SEDDEFS}\${SEDdA}WAIT3_DECLARED\${SEDdB}WAIT3_DECLARED\${SEDdC}1\${SEDdD}
\${SEDuA}WAIT3_DECLARED\${SEDuB}WAIT3_DECLARED\${SEDuC}1\${SEDuD}
\${SEDeA}WAIT3_DECLARED\${SEDeB}WAIT3_DECLARED\${SEDeC}1\${SEDeD}
"
}


fi
rm -f conftest*

  ;;
  *)
echo checking for waitpid declaration
cat > conftest.c <<EOF
#include "confdefs.h"
#include <sys/types.h>
#include <signal.h>
#include <sys/wait.h>

EOF
eval "$CPP conftest.c > conftest.out 2>&1"
if egrep "waitpid( |	|\()" conftest.out >/dev/null 2>&1; then
  rm -rf conftest*
  
{
test -n "$verbose" && \
echo "	defining WAITPID_DECLARED"
echo "#define" WAITPID_DECLARED 1 >> confdefs.h
DEFS="$DEFS -DWAITPID_DECLARED=1"
SEDDEFS="${SEDDEFS}\${SEDdA}WAITPID_DECLARED\${SEDdB}WAITPID_DECLARED\${SEDdC}1\${SEDdD}
\${SEDuA}WAITPID_DECLARED\${SEDuB}WAITPID_DECLARED\${SEDuC}1\${SEDuD}
\${SEDeA}WAITPID_DECLARED\${SEDeB}WAITPID_DECLARED\${SEDeC}1\${SEDeD}
"
}


fi
rm -f conftest*

  ;;
esac


echo checking for sys_errlist declaration
cat > conftest.c <<EOF
#include "confdefs.h"

#include <sys/types.h>
#include <stdio.h>
#include <errno.h>

EOF
eval "$CPP conftest.c > conftest.out 2>&1"
if egrep "sys_errlist" conftest.out >/dev/null 2>&1; then
  rm -rf conftest*
  
{
test -n "$verbose" && \
echo "	defining SYS_ERRLIST_DECLARED"
echo "#define" SYS_ERRLIST_DECLARED 1 >> confdefs.h
DEFS="$DEFS -DSYS_ERRLIST_DECLARED=1"
SEDDEFS="${SEDDEFS}\${SEDdA}SYS_ERRLIST_DECLARED\${SEDdB}SYS_ERRLIST_DECLARED\${SEDdC}1\${SEDdD}
\${SEDuA}SYS_ERRLIST_DECLARED\${SEDuB}SYS_ERRLIST_DECLARED\${SEDuC}1\${SEDuD}
\${SEDeA}SYS_ERRLIST_DECLARED\${SEDeB}SYS_ERRLIST_DECLARED\${SEDeC}1\${SEDeD}
"
}


fi
rm -f conftest*



echo checking for a 32 bit integer
cat > conftest.c <<EOF
#include "confdefs.h"

main()
{
  if (4 == sizeof(unsigned long))
    exit(0);
  exit(1);
}

EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  
{
test -n "$verbose" && \
echo "	defining UNSIGNED_LONG32"
echo "#define" UNSIGNED_LONG32 1 >> confdefs.h
DEFS="$DEFS -DUNSIGNED_LONG32=1"
SEDDEFS="${SEDDEFS}\${SEDdA}UNSIGNED_LONG32\${SEDdB}UNSIGNED_LONG32\${SEDdC}1\${SEDdD}
\${SEDuA}UNSIGNED_LONG32\${SEDuB}UNSIGNED_LONG32\${SEDuC}1\${SEDuD}
\${SEDeA}UNSIGNED_LONG32\${SEDeB}UNSIGNED_LONG32\${SEDeC}1\${SEDeD}
"
}


else
  cat > conftest.c <<EOF
#include "confdefs.h"

main()
{
  if (4 == sizeof(unsigned int))
    exit(0);
  exit(1);
}

EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  
{
test -n "$verbose" && \
echo "	defining UNSIGNED_INT32"
echo "#define" UNSIGNED_INT32 1 >> confdefs.h
DEFS="$DEFS -DUNSIGNED_INT32=1"
SEDDEFS="${SEDDEFS}\${SEDdA}UNSIGNED_INT32\${SEDdB}UNSIGNED_INT32\${SEDdC}1\${SEDdD}
\${SEDuA}UNSIGNED_INT32\${SEDuB}UNSIGNED_INT32\${SEDuC}1\${SEDuD}
\${SEDeA}UNSIGNED_INT32\${SEDeB}UNSIGNED_INT32\${SEDeC}1\${SEDeD}
"
}


else
  
{
test -n "$verbose" && \
echo "	defining UNKNOWN_32INT"
echo "#define" UNKNOWN_32INT 1 >> confdefs.h
DEFS="$DEFS -DUNKNOWN_32INT=1"
SEDDEFS="${SEDDEFS}\${SEDdA}UNKNOWN_32INT\${SEDdB}UNKNOWN_32INT\${SEDdC}1\${SEDdD}
\${SEDuA}UNKNOWN_32INT\${SEDuB}UNKNOWN_32INT\${SEDuC}1\${SEDuD}
\${SEDeA}UNKNOWN_32INT\${SEDeB}UNKNOWN_32INT\${SEDeC}1\${SEDeD}
"
}

fi
rm -fr conftest*
fi
rm -fr conftest*


LIBS_save="${LIBS}"
LIBS="${LIBS} -lelf"
have_lib=""
echo checking for -lelf
cat > conftest.c <<EOF
#include "confdefs.h"

int main() { exit(0); }
int t() { main(); }
EOF
if eval $compile; then
  rm -rf conftest*
  have_lib="1"

fi
rm -f conftest*
LIBS="${LIBS_save}"
if test -n "${have_lib}"; then
   :; LIBS="$LIBS -lelf"
else
   :; 
fi

LIBS_save="${LIBS}"
LIBS="${LIBS} -lnls"
have_lib=""
echo checking for -lnls
cat > conftest.c <<EOF
#include "confdefs.h"

int main() { exit(0); }
int t() { main(); }
EOF
if eval $compile; then
  rm -rf conftest*
  have_lib="1"

fi
rm -f conftest*
LIBS="${LIBS_save}"
if test -n "${have_lib}"; then
   :; libnls=1;
{
test -n "$verbose" && \
echo "	defining HAVE_LIB_NLS"
echo "#define" HAVE_LIB_NLS 1 >> confdefs.h
DEFS="$DEFS -DHAVE_LIB_NLS=1"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_LIB_NLS\${SEDdB}HAVE_LIB_NLS\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_LIB_NLS\${SEDuB}HAVE_LIB_NLS\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_LIB_NLS\${SEDeB}HAVE_LIB_NLS\${SEDeC}1\${SEDeD}
"
}

else
   :; 
fi

if test ! -n "$libsocket"; then
	LIBS_save="${LIBS}"
LIBS="${LIBS} -lsocket"
have_lib=""
echo checking for -lsocket
cat > conftest.c <<EOF
#include "confdefs.h"

int main() { exit(0); }
int t() { main(); }
EOF
if eval $compile; then
  rm -rf conftest*
  have_lib="1"

fi
rm -f conftest*
LIBS="${LIBS_save}"
if test -n "${have_lib}"; then
   :; LIBS="$LIBS -lsocket"
else
   :; 
fi

fi
if test ! -n "$libinet"; then
	LIBS_save="${LIBS}"
LIBS="${LIBS} -linet"
have_lib=""
echo checking for -linet
cat > conftest.c <<EOF
#include "confdefs.h"

int main() { exit(0); }
int t() { main(); }
EOF
if eval $compile; then
  rm -rf conftest*
  have_lib="1"

fi
rm -f conftest*
LIBS="${LIBS_save}"
if test -n "${have_lib}"; then
   :; LIBS="$LIBS -linet"
else
   :; 
fi

fi
if test ! -n "$libnsl"; then
	LIBS_save="${LIBS}"
LIBS="${LIBS} -lnsl"
have_lib=""
echo checking for -lnsl
cat > conftest.c <<EOF
#include "confdefs.h"

int main() { exit(0); }
int t() { main(); }
EOF
if eval $compile; then
  rm -rf conftest*
  have_lib="1"

fi
rm -f conftest*
LIBS="${LIBS_save}"
if test -n "${have_lib}"; then
   :; LIBS="$LIBS -lnsl"
else
   :; 
fi

fi
LIBS_save="${LIBS}"
LIBS="${LIBS} -ldgc"
have_lib=""
echo checking for -ldgc
cat > conftest.c <<EOF
#include "confdefs.h"

int main() { exit(0); }
int t() { main(); }
EOF
if eval $compile; then
  rm -rf conftest*
  have_lib="1"

fi
rm -f conftest*
LIBS="${LIBS_save}"
if test -n "${have_lib}"; then
   :; LIBS="$LIBS -ldgc"
else
   :; 
fi

LIBS_save="${LIBS}"
LIBS="${LIBS} -lresolv"
have_lib=""
echo checking for -lresolv
cat > conftest.c <<EOF
#include "confdefs.h"

int main() { exit(0); }
int t() { main(); }
EOF
if eval $compile; then
  rm -rf conftest*
  have_lib="1"

fi
rm -f conftest*
LIBS="${LIBS_save}"
if test -n "${have_lib}"; then
   :; LIBS="$LIBS -lresolv"
else
   :; 
fi


echo "generating a list of signal names..."
set X `cat /usr/include/signal.h /usr/include/sys/signal.h 2>&1 | awk '
$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $3 ~ /^[1-9][0-9]*$/ {
  sig[$3] = substr($2,4,20)
  if (max < $3 && $3 < 60) {
	max = $3
  }
}

END {
  for (i=1; i<=max; i++) {
    if (sig[i] == "")
      printf "%d", i
    else
      printf "%s", sig[i]
    if (i < max)
      printf " "
  }
  printf "\n"
}
'`
shift
case $# in
0)
  set X `kill -l 2> /dev/null`
  shift
  case $# in
  0) set HUP INT QUIT ILL TRAP IOT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM
    ;;
  esac
  ;;
esac
sig_name="ZERO $*"
if test -f source/sig.inc; then
  /bin/rm -f source/sig.inc
fi
echo $sig_name | sed -e 's/$/"};/' -e 's/ /", "/g' -e 's/^/char *signals[] = { 0, "/' >> source/sig.inc


echo checking for unix mail directory

for foo in /var/spool/mail /usr/spool/mail /var/mail /usr/mail
do
  if test -d $foo; then
    mdir=$foo
    break
  fi
done

if test -n "$mdir"; then
  UNIX_MAIL=\"$mdir\"
else
  UNIX_MAIL=\"unknown\"
fi


{
test -n "$verbose" && \
echo "	defining" UNIX_MAIL to be \"$mdir\"
echo "#define" UNIX_MAIL \"$mdir\" >> confdefs.h
DEFS="$DEFS -DUNIX_MAIL=\"$mdir\""
SEDDEFS="${SEDDEFS}\${SEDdA}UNIX_MAIL\${SEDdB}UNIX_MAIL\${SEDdC}\"$mdir\"\${SEDdD}
\${SEDuA}UNIX_MAIL\${SEDuB}UNIX_MAIL\${SEDuC}\"$mdir\"\${SEDuD}
\${SEDeA}UNIX_MAIL\${SEDeB}UNIX_MAIL\${SEDeC}\"$mdir\"\${SEDeD}
"
}


CFLAGS=-g
LDFLAGS=
RM="rm -f"
LN="ln -s"
if test ! -n "$bindir";
then
	bindir=\${exec_prefix}/bin
fi

if test ! -n "$IRCLIB";
then
	IRCLIB=\${prefix}/lib/irc
fi







# 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 Makefile source/Makefile include/defs.h conftest*; exit 1' 1 3 15
VERSION='$VERSION'
CC='$CC'
CPP='$CPP'
LEX='$LEX'
LEXLIB='$LEXLIB'
CFLAGS='$CFLAGS'
LDFLAGS='$LDFLAGS'
RM='$RM'
LN='$LN'
IRCLIB='$IRCLIB'
bindir='$bindir'
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-"Makefile source/Makefile"}
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
  echo "# Generated automatically from `echo $file|sed 's|.*/||'`.in by configure." > $file
  sed -e "
$prsub
$extrasub
s%@VERSION@%$VERSION%g
s%@CC@%$CC%g
s%@CPP@%$CPP%g
s%@LEX@%$LEX%g
s%@LEXLIB@%$LEXLIB%g
s%@CFLAGS@%$CFLAGS%g
s%@LDFLAGS@%$LDFLAGS%g
s%@RM@%$RM%g
s%@LN@%$LN%g
s%@IRCLIB@%$IRCLIB%g
s%@bindir@%$bindir%g
s%@LIBS@%$LIBS%g
s%@srcdir@%$srcdir%g
s%@DEFS@%-DHAVE_CONFIG_H%" $top_srcdir/${file}.in >> $file
fi; done

CONFIG_HEADERS=${CONFIG_HEADERS-"include/defs.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'
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
# This sed command replaces #undef's with comments.  This is necessary, for
# example, in the case of _POSIX_SOURCE, which is predefined and required
# on some systems where configure will not decide to define it in
# include/defs.h.
cat >> conftest.sed <<\CONFEOF
s,^[ 	]*#[ 	]*undef[ 	][ 	]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */,
CONFEOF
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


echo
echo Well there we are, you now might want to look in include/config.h and see
echo if there is anything you might want to tune, as well as in the Makefile in
echo this directory to configure or disable Term and/or Voice support. When you\'re
echo finished just run a make here..  good luck!
echo

