#!/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" ;;

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

     *) ;;
    esac
  fi
done

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

# 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*
compile='${CC-cc} $CFLAGS $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=tcl.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

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

# Make sure to not get the incompatible SysV /etc/install and
# /usr/sbin/install, which might be in PATH before a BSD-like install,
# or the SunOS /usr/etc/install directory, or the AIX /bin/install,
# or the AFS install, which mishandles nonexistent args, or
# /usr/ucb/install on SVR4, which tries to use the nonexistent group
# `staff'.  On most BSDish systems install is in /usr/bin, not /usr/ucb
# anyway.  Sigh.
if test "z${INSTALL}" = "z" ; then
  echo checking for install
  IFS="${IFS= 	}"; saveifs="$IFS"; IFS="${IFS}:"
  for dir in $PATH; do
    test -z "$dir" && dir=.
    case $dir in
    /etc|/usr/sbin|/usr/etc|/usr/afsws/bin|/usr/ucb) ;;
    *)
      if test -f $dir/installbsd; then
	INSTALL="$dir/installbsd -c" # OSF1
	INSTALL_PROGRAM='$(INSTALL) -s'
	INSTALL_DATA='$(INSTALL) -m 644'
	break
      fi
      if test -f $dir/install; then
	if grep dspmsg $dir/install >/dev/null 2>&1; then
	  : # AIX
	else
	  INSTALL="$dir/install -c"
	  INSTALL_PROGRAM='$(INSTALL) -s'
	  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
  # Extract the first word of `ranlib', so it can be a program name with args.
  set dummy ranlib; 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
      RANLIB="ranlib"
      break
    fi
  done
  IFS="$saveifs"
fi
test -z "$RANLIB" && RANLIB=":"
test -n "$RANLIB" -a -n "$verbose" && echo "	setting RANLIB to $RANLIB"

CC=${CC-cc}


#--------------------------------------------------------------------
#	Supply substitutes for missing POSIX library procedures, or
#	set flags so Tcl uses alternate procedures.
#--------------------------------------------------------------------

for func in getcwd opendir strerror strstr
do
echo checking for ${func}
cat > conftest.c <<EOF
#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_${func}) || defined (__stub___${func})
choke me
#else
/* Override any gcc2 internal prototype to avoid an error.  */
extern char ${func}(); ${func}();
#endif
 }
EOF
if eval $compile; then
  :
else
  LIBOBJS="$LIBOBJS ${func}.o"
test -n "$verbose" && echo "	using ${func}.o instead"
fi
rm -f conftest*

done

for func in strtol tmpnam waitpid
do
echo checking for ${func}
cat > conftest.c <<EOF
#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_${func}) || defined (__stub___${func})
choke me
#else
/* Override any gcc2 internal prototype to avoid an error.  */
extern char ${func}(); ${func}();
#endif
 }
EOF
if eval $compile; then
  :
else
  LIBOBJS="$LIBOBJS ${func}.o"
test -n "$verbose" && echo "	using ${func}.o instead"
fi
rm -f conftest*

done

echo checking for gettimeofday
cat > conftest.c <<EOF
#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_gettimeofday) || defined (__stub___gettimeofday)
choke me
#else
/* Override any gcc2 internal prototype to avoid an error.  */
extern char gettimeofday(); gettimeofday();
#endif
 }
EOF
if eval $compile; then
  :
else
  {
test -n "$verbose" && \
echo "	defining NO_GETTOD"
DEFS="$DEFS -DNO_GETTOD=1"
}

fi
rm -f conftest*

echo checking for getwd
cat > conftest.c <<EOF
#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
  {
test -n "$verbose" && \
echo "	defining NO_GETWD"
DEFS="$DEFS -DNO_GETWD=1"
}

fi
rm -f conftest*

echo checking for wait3
cat > conftest.c <<EOF
#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_wait3) || defined (__stub___wait3)
choke me
#else
/* Override any gcc2 internal prototype to avoid an error.  */
extern char wait3(); wait3();
#endif
 }
EOF
if eval $compile; then
  :
else
  {
test -n "$verbose" && \
echo "	defining NO_WAIT3"
DEFS="$DEFS -DNO_WAIT3=1"
}

fi
rm -f conftest*


#--------------------------------------------------------------------
#	Supply substitutes for missing POSIX header files.  Special
#	notes:
#	    - Sprite's dirent.h exists but is bogus.
#	    - stdlib.h doesn't define strtol, strtoul, or
#	      strtod insome versions of SunOS
#	    - some versions of string.h don't declare procedures such
#	      as strstr
#--------------------------------------------------------------------

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

cat > conftest.c <<EOF
#include <unistd.h>
EOF
err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
if test -z "$err"; then
  
{
test -n "$verbose" && \
echo "	defining HAVE_UNISTD_H"
DEFS="$DEFS -DHAVE_UNISTD_H=1"
}

fi
rm -f conftest*

echo checking for dirent.h
cat > conftest.c <<EOF
#include <sys/types.h>
#include <dirent.h>
int main() { exit(0); }
int t() { 
DIR *d;
struct dirent *entryPtr;
char *p;
d = opendir("foobar");
entryPtr = readdir(d);
p = entryPtr->d_name;
closedir(d);
 }
EOF
if eval $compile; then
  tcl_ok=1
else
  tcl_ok=0
fi
rm -f conftest*

echo '#include <tcl_ok=0>' > conftest.c
eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
if egrep "Sprite version.* NOT POSIX" conftest.out >/dev/null 2>&1; then
  :
fi
rm -f conftest*

if test $tcl_ok = 0; then
    
{
test -n "$verbose" && \
echo "	defining NO_DIRENT_H"
DEFS="$DEFS -DNO_DIRENT_H=1"
}

fi
echo checking for errno.h
cat > conftest.c <<EOF
#include <errno.h>
EOF
err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
if test -z "$err"; then
  :
else
  
{
test -n "$verbose" && \
echo "	defining NO_ERRNO_H"
DEFS="$DEFS -DNO_ERRNO_H=1"
}

fi
rm -f conftest*

echo checking for float.h
cat > conftest.c <<EOF
#include <float.h>
EOF
err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
if test -z "$err"; then
  :
else
  
{
test -n "$verbose" && \
echo "	defining NO_FLOAT_H"
DEFS="$DEFS -DNO_FLOAT_H=1"
}

fi
rm -f conftest*

echo checking for limits.h
cat > conftest.c <<EOF
#include <limits.h>
EOF
err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
if test -z "$err"; then
  :
else
  
{
test -n "$verbose" && \
echo "	defining NO_LIMITS_H"
DEFS="$DEFS -DNO_LIMITS_H=1"
}

fi
rm -f conftest*

echo checking for stdlib.h
cat > conftest.c <<EOF
#include <stdlib.h>
EOF
err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
if test -z "$err"; then
  tcl_ok=1
else
  tcl_ok=0
fi
rm -f conftest*

echo '#include <stdlib.h>' > conftest.c
eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
if egrep "strtol" conftest.out >/dev/null 2>&1; then
  :
else
  tcl_ok=0
fi
rm -f conftest*

echo '#include <stdlib.h>' > conftest.c
eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
if egrep "strtoul" conftest.out >/dev/null 2>&1; then
  :
else
  tcl_ok=0
fi
rm -f conftest*

echo '#include <stdlib.h>' > conftest.c
eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
if egrep "strtod" conftest.out >/dev/null 2>&1; then
  :
else
  tcl_ok=0
fi
rm -f conftest*

if test $tcl_ok = 0; then
    
{
test -n "$verbose" && \
echo "	defining NO_STDLIB_H"
DEFS="$DEFS -DNO_STDLIB_H=1"
}

fi
echo checking for string.h
cat > conftest.c <<EOF
#include <string.h>
EOF
err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
if test -z "$err"; then
  tcl_ok=1
else
  tcl_ok=0
fi
rm -f conftest*

echo '#include <string.h>' > conftest.c
eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
if egrep "strstr" conftest.out >/dev/null 2>&1; then
  :
else
  tcl_ok=0
fi
rm -f conftest*

echo '#include <string.h>' > conftest.c
eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
if egrep "strerror" conftest.out >/dev/null 2>&1; then
  :
else
  tcl_ok=0
fi
rm -f conftest*

if test $tcl_ok = 0; then
    
{
test -n "$verbose" && \
echo "	defining NO_STRING_H"
DEFS="$DEFS -DNO_STRING_H=1"
}

fi
echo checking for sys/time.h
cat > conftest.c <<EOF
#include <sys/time.h>
EOF
err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
if test -z "$err"; then
  :
else
  
{
test -n "$verbose" && \
echo "	defining NO_SYS_TIME_H"
DEFS="$DEFS -DNO_SYS_TIME_H=1"
}

fi
rm -f conftest*

echo checking for sys/wait.h
cat > conftest.c <<EOF
#include <sys/wait.h>
EOF
err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
if test -z "$err"; then
  :
else
  
{
test -n "$verbose" && \
echo "	defining NO_SYS_WAIT_H"
DEFS="$DEFS -DNO_SYS_WAIT_H=1"
}

fi
rm -f conftest*


#--------------------------------------------------------------------
#	On some systems strstr is broken: it returns a pointer even
#	even if the original string is empty.
#--------------------------------------------------------------------

cat > conftest.c <<EOF

extern int strstr();
int main()
{
    exit(strstr("\0test", "test") ? 1 : 0);
}

EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  :
else
  LIBOBJS="$LIBOBJS strstr.o"
fi
rm -f conftest*

#--------------------------------------------------------------------
#	Check for strtoul function.  This is tricky because under some
#	versions of AIX strtoul returns an incorrect terminator
#	pointer for the string "0".
#--------------------------------------------------------------------

echo checking for strtoul
cat > conftest.c <<EOF
#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_strtoul) || defined (__stub___strtoul)
choke me
#else
/* Override any gcc2 internal prototype to avoid an error.  */
extern char strtoul(); strtoul();
#endif
 }
EOF
if eval $compile; then
  tcl_ok=1
else
  tcl_ok=0
fi
rm -f conftest*

cat > conftest.c <<EOF

extern int strtoul();
int main()
{
    char *string = "0";
    char *term;
    int value;
    value = strtoul(string, &term, 0);
    if ((value != 0) || (term != (string+1))) {
        exit(1);
    }
    exit(0);
}
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  :
else
  tcl_ok=0
fi
rm -f conftest*
if test $tcl_ok = 0; then
    LIBOBJS="$LIBOBJS strtoul.o"
fi

#--------------------------------------------------------------------
#	Check for the strtod function.  This is tricky because under
#	some versions of Linux it mis-parses the string "+".
#--------------------------------------------------------------------

echo checking for strtod
cat > conftest.c <<EOF
#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_strtod) || defined (__stub___strtod)
choke me
#else
/* Override any gcc2 internal prototype to avoid an error.  */
extern char strtod(); strtod();
#endif
 }
EOF
if eval $compile; then
  tcl_ok=1
else
  tcl_ok=0
fi
rm -f conftest*

cat > conftest.c <<EOF

extern double strtod();
int main()
{
    char *string = "+";
    char *term;
    double value;
    value = strtod(string, &term);
    if (term != string) {
	exit(1);
    }
    exit(0);
}
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  :
else
  tcl_ok=0
fi
rm -f conftest*
if test $tcl_ok = 0; then
    LIBOBJS="$LIBOBJS strtod.o"
fi

#--------------------------------------------------------------------
#	Check for various typedefs and provide substitutes if
#	they don't exist.
#--------------------------------------------------------------------

echo checking for mode_t in sys/types.h
echo '#include <sys/types.h>' > conftest.c
eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
if egrep "mode_t" conftest.out >/dev/null 2>&1; then
  :
else
  
{
test -n "$verbose" && \
echo "	defining mode_t to be int"
DEFS="$DEFS -Dmode_t=int"
}

fi
rm -f conftest*

echo checking for pid_t in sys/types.h
echo '#include <sys/types.h>' > conftest.c
eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
if egrep "pid_t" conftest.out >/dev/null 2>&1; then
  :
else
  
{
test -n "$verbose" && \
echo "	defining pid_t to be int"
DEFS="$DEFS -Dpid_t=int"
}

fi
rm -f conftest*

echo checking for size_t in sys/types.h
echo '#include <sys/types.h>' > conftest.c
eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
if egrep "size_t" conftest.out >/dev/null 2>&1; then
  :
else
  
{
test -n "$verbose" && \
echo "	defining size_t to be unsigned"
DEFS="$DEFS -Dsize_t=unsigned"
}

fi
rm -f conftest*

echo checking for uid_t in sys/types.h
echo '#include <sys/types.h>' > conftest.c
eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
if egrep "uid_t" conftest.out >/dev/null 2>&1; then
  :
else
  
{
test -n "$verbose" && \
echo "	defining uid_t to be int"
DEFS="$DEFS -Duid_t=int"
}
 
{
test -n "$verbose" && \
echo "	defining gid_t to be int"
DEFS="$DEFS -Dgid_t=int"
}

fi
rm -f conftest*


#--------------------------------------------------------------------
#	If a system doesn't have an opendir function (man, that's old!)
#	then we have to supply a different version of dirent.h which
#	is compatible with the substitute version of opendir that's
#	provided.  This version only works with V7-style directories.
#--------------------------------------------------------------------

echo checking for opendir
cat > conftest.c <<EOF
#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_opendir) || defined (__stub___opendir)
choke me
#else
/* Override any gcc2 internal prototype to avoid an error.  */
extern char opendir(); opendir();
#endif
 }
EOF
if eval $compile; then
  :
else
  {
test -n "$verbose" && \
echo "	defining USE_DIRENT2_H"
DEFS="$DEFS -DUSE_DIRENT2_H=1"
}

fi
rm -f conftest*


#--------------------------------------------------------------------
#	Check for the existence of sys_errlist (this is only needed if
#	there's no strerror, but I don't know how to conditionalize the
#	check).
#--------------------------------------------------------------------

echo checking for sys_errlist
cat > conftest.c <<EOF

int main() { exit(0); }
int t() { 
extern char *sys_errlist[];
extern int sys_nerr;
sys_errlist[sys_nerr-1][0] = 0;
 }
EOF
if eval $compile; then
  :
else
  
{
test -n "$verbose" && \
echo "	defining NO_SYS_ERRLIST"
DEFS="$DEFS -DNO_SYS_ERRLIST=1"
}

fi
rm -f conftest*


#--------------------------------------------------------------------
#	The check below checks whether <sys/wait.h> defines the type
#	"union wait" correctly.  It's needed because of weirdness in
#	HP-UX where "union wait" is defined in both the BSD and SYS-V
#	environments.  Checking the usability of WIFEXITED seems to do
#	the trick.
#--------------------------------------------------------------------

echo checking for union wait
cat > conftest.c <<EOF
#include <sys/types.h> 
#include <sys/wait.h>
int main() { exit(0); }
int t() { 
union wait x;
WIFEXITED(x);		/* Generates compiler error if WIFEXITED
			 * uses an int. */
 }
EOF
if eval $compile; then
  :
else
  
{
test -n "$verbose" && \
echo "	defining NO_UNION_WAIT"
DEFS="$DEFS -DNO_UNION_WAIT=1"
}

fi
rm -f conftest*


#--------------------------------------------------------------------
#	Check to see whether the system supports the matherr function
#	and its associated type "struct exception".
#--------------------------------------------------------------------

echo checking for matherr support
cat > conftest.c <<EOF
#include <math.h>
int main() { exit(0); }
int t() { 
struct exception x;
x.type = DOMAIN;
x.type = SING;
 }
EOF
if eval $compile; then
  LIBOBJS="$LIBOBJS tclMtherr.o"; 
{
test -n "$verbose" && \
echo "	defining NEED_MATHERR"
DEFS="$DEFS -DNEED_MATHERR=1"
}

fi
rm -f conftest*


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
cat >conftest.def <<EOF
$DEFS
EOF
escape_ampersand_and_backslash='s%[&\\]%\\&%g'
DEFS=`sed "$escape_ampersand_and_backslash" <conftest.def`
rm -f conftest.def

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)
    exec /bin/sh $0 $configure_args ;;
    *) echo "Usage: config.status --recheck" 2>&1; exit 1 ;;
  esac
done

trap 'rm -f Makefile; exit 1' 1 3 15
INSTALL='$INSTALL'
INSTALL_PROGRAM='$INSTALL_PROGRAM'
INSTALL_DATA='$INSTALL_DATA'
RANLIB='$RANLIB'
CC='$CC'
LIBOBJS='$LIBOBJS'
CPP='$CPP'
LIBS='$LIBS'
srcdir='$srcdir'
DEFS='$DEFS'
prefix='$prefix'
exec_prefix='$exec_prefix'
prsub='$prsub'
EOF
cat >> config.status <<\EOF

top_srcdir=$srcdir

# Allow make-time overrides of the generated file list.
test -n "$gen_files" || gen_files="Makefile"

for file in .. $gen_files; 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%@INSTALL@%$INSTALL%g
s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
s%@INSTALL_DATA@%$INSTALL_DATA%g
s%@RANLIB@%$RANLIB%g
s%@CC@%$CC%g
s%@LIBOBJS@%$LIBOBJS%g
s%@CPP@%$CPP%g
s%@LIBS@%$LIBS%g
s%@srcdir@%$srcdir%g
s%@DEFS@%$DEFS%
" $top_srcdir/${file}.in >> $file
fi; done

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

