#!/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=getship.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="$*"


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" -a -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 <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"


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

EOF
eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
if egrep "yes" conftest.out >/dev/null 2>&1; then
  
{
test -n "$verbose" && \
echo "	defining _ALL_SOURCE"
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*


echo checking for unistd.h
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"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_UNISTD_H\${SEDdB}HAVE_UNISTD_H\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_UNISTD_H\${SEDuB}HAVE_UNISTD_H\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_UNISTD_H\${SEDeB}HAVE_UNISTD_H\${SEDeC}1\${SEDeD}
"
}

fi
rm -f conftest*

echo checking whether string.h declares mem functions
echo '#include <string.h>' > conftest.c
eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
if egrep "memchr" conftest.out >/dev/null 2>&1; then
  :
else
  echo checking for memory.h
cat > conftest.c <<EOF
#include <memory.h>
EOF
err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
if test -z "$err"; then
  
{
test -n "$verbose" && \
echo "	defining NEED_MEMORY_H"
DEFS="$DEFS -DNEED_MEMORY_H=1"
SEDDEFS="${SEDDEFS}\${SEDdA}NEED_MEMORY_H\${SEDdB}NEED_MEMORY_H\${SEDdC}1\${SEDdD}
\${SEDuA}NEED_MEMORY_H\${SEDuB}NEED_MEMORY_H\${SEDuC}1\${SEDuD}
\${SEDeA}NEED_MEMORY_H\${SEDeB}NEED_MEMORY_H\${SEDeC}1\${SEDeD}
"
}

fi
rm -f conftest*

fi
rm -f conftest*



#--------------------------------------------------------------------
#	Include sys/select.h if it exists and if it supplies things
#	that appear to be useful.  This appears to be true only on
#	the RS/6000 under AIX.  Some systems like OSF/1 have a
#	sys/select.h that's of no use, and other systems like SCO
#	UNIX have a sys/select.h that's pernicious.  If there isn't
#	a sys/select.h, then make sure that "fd_set" is defined in
#	sys/types.h.
#--------------------------------------------------------------------

echo checking for sys/select.h
echo '#include <sys/select.h>' > conftest.c
eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
if egrep "fd_mask" conftest.out >/dev/null 2>&1; then
  
{
test -n "$verbose" && \
echo "	defining HAVE_SYS_SELECT_H"
DEFS="$DEFS -DHAVE_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}
"
}

else
  echo checking for fd_set
cat > conftest.c <<EOF
#include <sys/types.h>
int main() { exit(0); }
int t() { fd_set readMask, writeMask; }
EOF
if eval $compile; then
  :
else
  
{
test -n "$verbose" && \
echo "	defining NO_FD_SET"
DEFS="$DEFS -DNO_FD_SET=1"
SEDDEFS="${SEDDEFS}\${SEDdA}NO_FD_SET\${SEDdB}NO_FD_SET\${SEDdC}1\${SEDdD}
\${SEDuA}NO_FD_SET\${SEDuB}NO_FD_SET\${SEDuC}1\${SEDuD}
\${SEDeA}NO_FD_SET\${SEDeB}NO_FD_SET\${SEDeC}1\${SEDeD}
"
}

fi
rm -f conftest*

fi
rm -f conftest*


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

echo checking for ANSI C header files
cat > conftest.c <<EOF
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <float.h>
EOF
err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
if test -z "$err"; then
  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
echo '#include <string.h>' > conftest.c
eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
if egrep "memchr" conftest.out >/dev/null 2>&1; then
  # SGI's /bin/cc from Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
cat > conftest.c <<EOF
#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"
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 -f conftest*
fi
rm -f conftest*

fi
rm -f conftest*

for hdr in sys/timeb.h sys/ptyio.h sys/fcntl.h fcntl.h
do
trhdr=HAVE_`echo $hdr | tr '[a-z]./' '[A-Z]__'`
echo checking for ${hdr}
cat > conftest.c <<EOF
#include <${hdr}>
EOF
err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
if test -z "$err"; then
  
{
test -n "$verbose" && \
echo "	defining ${trhdr}"
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 ctype.h machine/endian.h sys/resource.h
do
trhdr=HAVE_`echo $hdr | tr '[a-z]./' '[A-Z]__'`
echo checking for ${hdr}
cat > conftest.c <<EOF
#include <${hdr}>
EOF
err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
if test -z "$err"; then
  
{
test -n "$verbose" && \
echo "	defining ${trhdr}"
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 sys/wait.h netinet/in.h
do
trhdr=HAVE_`echo $hdr | tr '[a-z]./' '[A-Z]__'`
echo checking for ${hdr}
cat > conftest.c <<EOF
#include <${hdr}>
EOF
err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
if test -z "$err"; then
  
{
test -n "$verbose" && \
echo "	defining ${trhdr}"
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 wait3 that fills in rusage
cat > conftest.c <<EOF
#include <sys/types.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <stdio.h>
/* HP-UX has wait3 but does not fill in rusage.  */
main() {
  struct rusage r;
  int i;
  r.ru_nvcsw = 0;
  switch (fork()) {
  case 0: /* Child.  */
    sleep(1); /* Give up the CPU.  */
    _exit(0);
  case -1: _exit(0); /* What can we do?  */
  default: /* Parent.  */
    wait3(&i, 0, &r);
    exit(r.ru_nvcsw == 0);
  }
}
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  
{
test -n "$verbose" && \
echo "	defining HAVE_WAIT3"
DEFS="$DEFS -DHAVE_WAIT3=1"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_WAIT3\${SEDdB}HAVE_WAIT3\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_WAIT3\${SEDuB}HAVE_WAIT3\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_WAIT3\${SEDeB}HAVE_WAIT3\${SEDeC}1\${SEDeD}
"
}

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"
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
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"
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"
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*

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"
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 vfork.h
cat > conftest.c <<EOF
#include <vfork.h>
EOF
err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
if test -z "$err"; then
  
{
test -n "$verbose" && \
echo "	defining HAVE_VFORK_H"
DEFS="$DEFS -DHAVE_VFORK_H=1"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_VFORK_H\${SEDdB}HAVE_VFORK_H\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_VFORK_H\${SEDuB}HAVE_VFORK_H\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_VFORK_H\${SEDeB}HAVE_VFORK_H\${SEDeC}1\${SEDeD}
"
}

fi
rm -f conftest*

echo checking for working vfork
cat > conftest.c <<EOF
/* Thanks to Paul Eggert for this test.  */
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_VFORK_H
#include <vfork.h>
#endif
main() {
  pid_t parent = getpid();
  pid_t child = vfork();

  if (child == 0) {
    /* On sparc systems, changes by the child to local and incoming
       argument registers are propagated back to the parent.
       The compiler is told about this with #include <vfork.h>,
       but some compilers (e.g. gcc -O) don't grok <vfork.h>.
       Test for this by using lots of local variables, at least
       as many local variables as main has allocated so far
       including compiler temporaries.  4 locals are enough for
       gcc 1.40.3 on a sparc, but we use 8 to be safe.
       A buggy compiler should reuse the register of parent
       for one of the local variables, since it will think that
       parent can't possibly be used any more in this routine.
       Assigning to the local variable will thus munge parent
       in the parent process.  */
    pid_t
      p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(),
      p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid();
    /* Convince the compiler that p..p7 are live; otherwise, it might
       use the same hardware register for all 8 local variables.  */
    if (p != p1 || p != p2 || p != p3 || p != p4
	|| p != p5 || p != p6 || p != p7)
      _exit(1);

    /* On some systems (e.g. IRIX 3.3),
       vfork doesn't separate parent from child file descriptors.
       If the child closes a descriptor before it execs or exits,
       this munges the parent's descriptor as well.
       Test for this by closing stdout in the child.  */
    _exit(close(fileno(stdout)) != 0);
  } else {
    int status;
    struct stat st;

    while (wait(&status) != child)
      ;
    exit(
	 /* Was there some problem with vforking?  */
	 child < 0

	 /* Did the child fail?  (This shouldn't happen.)  */
	 || status

	 /* Did the vfork/compiler bug occur?  */
	 || parent != getpid()

	 /* Did the file descriptor bug occur?  */
	 || fstat(fileno(stdout), &st) != 0
	 );
  }
}
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  :
else
  
{
test -n "$verbose" && \
echo "	defining vfork to be fork"
DEFS="$DEFS -Dvfork=fork"
SEDDEFS="${SEDDEFS}\${SEDdA}vfork\${SEDdB}vfork\${SEDdC}fork\${SEDdD}
\${SEDuA}vfork\${SEDuB}vfork\${SEDuC}fork\${SEDuD}
\${SEDeA}vfork\${SEDeB}vfork\${SEDeC}fork\${SEDeD}
"
}

fi
rm -f conftest*

echo checking for struct tm in time.h
cat > conftest.c <<EOF
#include <sys/types.h>
#include <time.h>
int main() { exit(0); }
int t() { struct tm *tp; }
EOF
if eval $compile; then
  :
else
  
{
test -n "$verbose" && \
echo "	defining TM_IN_SYS_TIME"
DEFS="$DEFS -DTM_IN_SYS_TIME=1"
SEDDEFS="${SEDDEFS}\${SEDdA}TM_IN_SYS_TIME\${SEDdB}TM_IN_SYS_TIME\${SEDdC}1\${SEDdD}
\${SEDuA}TM_IN_SYS_TIME\${SEDuB}TM_IN_SYS_TIME\${SEDuC}1\${SEDuD}
\${SEDeA}TM_IN_SYS_TIME\${SEDeB}TM_IN_SYS_TIME\${SEDeC}1\${SEDeD}
"
}

fi
rm -f conftest*


echo checking for itimer in time.h
echo '#include <time.h>' > conftest.c
eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
if egrep "itimerval" conftest.out >/dev/null 2>&1; then
  :
else
  
{
test -n "$verbose" && \
echo "	defining NEED_SYS_TIME_H"
DEFS="$DEFS -DNEED_SYS_TIME_H=1"
SEDDEFS="${SEDDEFS}\${SEDdA}NEED_SYS_TIME_H\${SEDdB}NEED_SYS_TIME_H\${SEDdC}1\${SEDdD}
\${SEDuA}NEED_SYS_TIME_H\${SEDuB}NEED_SYS_TIME_H\${SEDuC}1\${SEDuD}
\${SEDeA}NEED_SYS_TIME_H\${SEDeB}NEED_SYS_TIME_H\${SEDeC}1\${SEDeD}
"
}

fi
rm -f conftest*


# Actually we check if int (32 bit) < long (64 bit)
echo checking integer size
cat > conftest.c <<EOF
main() { exit(!(sizeof(long) > sizeof(int))); }
EOF
eval $compile
if test -s conftest && (./conftest; exit) 2>/dev/null; then
  
{
test -n "$verbose" && \
echo "	defining INT_16_BITS"
DEFS="$DEFS -DINT_16_BITS=1"
SEDDEFS="${SEDDEFS}\${SEDdA}INT_16_BITS\${SEDdB}INT_16_BITS\${SEDdC}1\${SEDdD}
\${SEDuA}INT_16_BITS\${SEDuB}INT_16_BITS\${SEDuC}1\${SEDuD}
\${SEDeA}INT_16_BITS\${SEDeB}INT_16_BITS\${SEDeC}1\${SEDeD}
"
}

fi
rm -f conftest*


echo checking for u_int in sys/types.h
echo '#include <sys/types.h>' > conftest.c
eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
if egrep "u_int" conftest.out >/dev/null 2>&1; then
  :
else
  
{
test -n "$verbose" && \
echo "	defining NO_U_INT"
DEFS="$DEFS -DNO_U_INT=1"
SEDDEFS="${SEDDEFS}\${SEDdA}NO_U_INT\${SEDdB}NO_U_INT\${SEDdC}1\${SEDdD}
\${SEDuA}NO_U_INT\${SEDuB}NO_U_INT\${SEDuC}1\${SEDuD}
\${SEDeA}NO_U_INT\${SEDeB}NO_U_INT\${SEDeC}1\${SEDeD}
"
}

fi
rm -f conftest*


echo checking for PATH_MAX in limits.h
cat > conftest.c <<EOF

#include <limits.h> 
PATH_MAX

EOF
eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
if egrep "PATH_MAX" conftest.out >/dev/null 2>&1; then
  
{
test -n "$verbose" && \
echo "	defining NO_PATH_MAX"
DEFS="$DEFS -DNO_PATH_MAX=1"
SEDDEFS="${SEDDEFS}\${SEDdA}NO_PATH_MAX\${SEDdB}NO_PATH_MAX\${SEDdC}1\${SEDdD}
\${SEDuA}NO_PATH_MAX\${SEDuB}NO_PATH_MAX\${SEDuC}1\${SEDuD}
\${SEDeA}NO_PATH_MAX\${SEDeB}NO_PATH_MAX\${SEDeC}1\${SEDeD}
"
}

fi
rm -f conftest*



#--------------------------------------------------------------------
#	Check for gmp and mp
#--------------------------------------------------------------------

echo Searching for mp or gmp
cat > conftest.c <<EOF
 
#include <mp.h> 
__GNU_MP__

EOF
eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
if egrep "GNU_MP" conftest.out >/dev/null 2>&1; then
  MPINC=nope search=true
else
  MPINC="" search=false 
fi
rm -f conftest*

if test "$MPINC" = nope; then
   dirs="../gmp-1.3.2 /usr/unsupported/include /usr/local/include \
      /usr/gnu/include /usr/gnu/include/mp /usr/local/gnu/include \
      /usr/local/gnu/include/mp /usr/include/gnu /usr/local/lib/gmp-1.3.2"
   for i in $dirs; do
      if test -r $i/gmp.h; then
	MPINC="-I$i"
      fi
   done
fi
if test "$MPINC" = nope; then
   cat > conftest.c <<EOF
#include <mp.h>
EOF
err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
if test -z "$err"; then
  MPINC="" 
else
  MPINC=nope
fi
rm -f conftest*
   if test "$MPINC" = nope; then
      MPINC="# -I."
      NORSA="#"
   fi
fi


if test "$search" = true; then
  MPLIB=nope
else
  LIBS_save="${LIBS}"
LIBS="${LIBS} -lgmp"
have_lib=""
echo checking for -lgmp
cat > conftest.c <<EOF

int main() { exit(0); }
int t() { main(); }
EOF
if eval $compile; then
  have_lib="1"
fi
rm -f conftest*
LIBS="${LIBS_save}"
if test -n "${have_lib}"; then
   :; MPLIB="-lmp -lgmp"
else
   :; MPLIB=nope
fi

fi
if test "$MPLIB" = nope; then
   dirs="../gmp-1.3.2 /usr/unsupported/lib /usr/local/lib /usr/gnu/lib \
      /usr/local/gnu/lib /usr/lib/gnu /usr/local/lib/gmp-1.3.2" 
   for i in $dirs; do
      if test -r $i/libgmp.a; then
	MPLIB="-L$i -lmp -lgmp"
      fi
   done
fi
if test "$MPLIB" = nope; then
   LIBS_save="${LIBS}"
LIBS="${LIBS} -lmp"
have_lib=""
echo checking for -lmp
cat > conftest.c <<EOF

int main() { exit(0); }
int t() { main(); }
EOF
if eval $compile; then
  have_lib="1"
fi
rm -f conftest*
LIBS="${LIBS_save}"
if test -n "${have_lib}"; then
   :; MPLIB="-lmp"
else
   :; MPLIB=nope
fi

   if test "$MPLIB" = nope; then
      echo Warning mp or gmp library not found, turning RSA off.
      MPLIB="# -L. -lmp -lgmp"
      NORSA="#"
   fi
fi


   
#--------------------------------------------------------------------
#	Locate the X11 header files and the X11 library archive.
#--------------------------------------------------------------------

# If we find X, set shell vars x_includes and x_libraries to the paths.
echo checking for X include and library files with xmkmf
rm -fr conftestdir
if mkdir conftestdir; then
  cd conftestdir
  cat > Imakefile <<EOF
acfindx:
	@echo "x_includes=$(INCROOT); x_libraries=$(USRLIBDIR)"
EOF
  if xmkmf >/dev/null 2>/dev/null && test -f Makefile; then
    eval `make acfindx`
  fi
  cd ..
  rm -fr conftestdir
fi


if test -z "$x_libraries" ; then
echo checking for X11 header files
XINCLUDES=""
cat > conftest.c <<EOF
#include <X11/Intrinsic.h>
EOF
err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
if test -z "$err"; then
  :
else
  XINCLUDES="nope"
fi
rm -f conftest*
if test "$XINCLUDES" = nope; then
    dirs="/usr/unsupported/include /usr/local/include /usr/X386/include \
      /usr/include/X11R4 /usr/X11R5/include /usr/include/X11R5 \
      /usr/openwin/include /usr/X11/include /pub/X11R5/include \
      /usr/local/X11R5/include"
    for i in $dirs ; do
	if test -r $i/X11/Intrinsic.h; then
	    XINCLUDES=" -I$i"
	fi
    done
fi
if test "$XINCLUDES" = nope; then
  echo "Warning:  couldn't find any X11 include files."
  XINCLUDES=""
fi

echo "checking for X11 library archive"
LIBS_save="${LIBS}"
LIBS="${LIBS} -lX11"
have_lib=""
echo checking for -lX11
cat > conftest.c <<EOF

int main() { exit(0); }
int t() { main(); }
EOF
if eval $compile; then
  have_lib="1"
fi
rm -f conftest*
LIBS="${LIBS_save}"
if test -n "${have_lib}"; then
   :; XLIBSW="-lX11"
else
   :; XLIBSW=nope
fi

if test "$XLIBSW" = nope; then
    dirs="/usr/unsupported/lib /usr/local/lib /usr/X386/lib \
      /usr/lib/X11R4 /usr/X11R5/lib /usr/lib/X11R5 /usr/openwin/lib \
      /usr/X11/lib /pub/X11R5/lib /usr/local/X11R5/lib"
    for i in $dirs ; do
	if test -r $i/libX11.a; then
	    XLIBSW="-L$i -lX11"
	fi
    done
fi
if test "$XLIBSW" = nope ; then
    LIBS_save="${LIBS}"
LIBS="${LIBS} -lXwindow"
have_lib=""
echo checking for -lXwindow
cat > conftest.c <<EOF

int main() { exit(0); }
int t() { main(); }
EOF
if eval $compile; then
  have_lib="1"
fi
rm -f conftest*
LIBS="${LIBS_save}"
if test -n "${have_lib}"; then
   :; XLIBSW=-lXwindow
else
   :; 
fi

fi
if test "$XLIBSW" = nope ; then
    echo "Warning:  couldn't find the X11 library archive.  Using -lX11."
    XLIBSW=-lX11
fi
else
XINCLUDES="-I$x_includes"
XLIBSW="-L$x_libraries -lX11"
fi

INCS="$INCS $XINCLUDES"


LIBS="$LIBS $XLIBSW"
  
#--------------------------------------------------------------------
#	Check for the existence of various libraries.  The order here
#	is important, so that then end up in the right order in the
#	command line generated by Make.
#--------------------------------------------------------------------

LIBS_save="${LIBS}"
LIBS="${LIBS} -lXbsd"
have_lib=""
echo checking for -lXbsd
cat > conftest.c <<EOF

int main() { exit(0); }
int t() { main(); }
EOF
if eval $compile; then
  have_lib="1"
fi
rm -f conftest*
LIBS="${LIBS_save}"
if test -n "${have_lib}"; then
   :; LIBS="$LIBS -lXbsd"
else
   :; 
fi

LIBS_save="${LIBS}"
LIBS="${LIBS} -lV3"
have_lib=""
echo checking for -lV3
cat > conftest.c <<EOF

int main() { exit(0); }
int t() { main(); }
EOF
if eval $compile; then
  have_lib="1"
fi
rm -f conftest*
LIBS="${LIBS_save}"
if test -n "${have_lib}"; then
   :; LIBS="$LIBS -lV3"
else
   :; 
fi

LIBS_save="${LIBS}"
LIBS="${LIBS} -lPW"
have_lib=""
echo checking for -lPW
cat > conftest.c <<EOF

int main() { exit(0); }
int t() { main(); }
EOF
if eval $compile; then
  have_lib="1"
fi
rm -f conftest*
LIBS="${LIBS_save}"
if test -n "${have_lib}"; then
   :; LIBS="$LIBS -lPW"
else
   :; 
fi

LIBS_save="${LIBS}"
LIBS="${LIBS} -lsocket"
have_lib=""
echo checking for -lsocket
cat > conftest.c <<EOF

int main() { exit(0); }
int t() { main(); }
EOF
if eval $compile; then
  have_lib="1"
fi
rm -f conftest*
LIBS="${LIBS_save}"
if test -n "${have_lib}"; then
   :; LIBS="$LIBS -lsocket"
else
   :; 
fi

LIBS_save="${LIBS}"
LIBS="${LIBS} -linet"
have_lib=""
echo checking for -linet
cat > conftest.c <<EOF

int main() { exit(0); }
int t() { main(); }
EOF
if eval $compile; then
  have_lib="1"
fi
rm -f conftest*
LIBS="${LIBS_save}"
if test -n "${have_lib}"; then
   :; LIBS="$LIBS -linet"
else
   :; 
fi

LIBS_save="${LIBS}"
LIBS="${LIBS} -lnsl"
have_lib=""
echo checking for -lnsl
cat > conftest.c <<EOF

int main() { exit(0); }
int t() { main(); }
EOF
if eval $compile; then
  have_lib="1"
fi
rm -f conftest*
LIBS="${LIBS_save}"
if test -n "${have_lib}"; then
   :; LIBS="$LIBS -lnsl"
else
   :; 
fi

echo checking for DYNIX/ptx libseq
cat > conftest.c <<EOF
#if defined(_SEQUENT_)
  yes
#endif

EOF
eval "$CPP \$DEFS 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


#--------------------------------------------------------------------
#    	Check for type of signals
#--------------------------------------------------------------------

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 ()) ();
int main() { exit(0); }
int t() { int i; }
EOF
if eval $compile; then
  
{
test -n "$verbose" && \
echo "	defining RETSIGTYPE to be void"
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
  
{
test -n "$verbose" && \
echo "	defining RETSIGTYPE to be int"
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 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
  
{
test -n "$verbose" && \
echo "	defining HAVE_RESTARTABLE_SYSCALLS"
DEFS="$DEFS -DHAVE_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 BSD style signals
cat > conftest.c <<EOF

#include <signal.h>
#include <sys/time.h>
test(){ }
int main(){
int c;
static struct itimerval udt;
signal(SIGALRM,test);
udt.it_interval.tv_sec = 0;
udt.it_interval.tv_usec = 10;
udt.it_value.tv_sec = 0;
udt.it_value.tv_usec = 10;
(void) setitimer(ITIMER_REAL, &udt, (struct itimerval *) 0);
for (c=0; c<10; c++)
pause();
exit(0);}

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

else
  echo checking for sigset
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_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
  {
test -n "$verbose" && \
echo "	defining SYSV_SIGNALS"
DEFS="$DEFS -DSYSV_SIGNALS=1"
SEDDEFS="${SEDDEFS}\${SEDdA}SYSV_SIGNALS\${SEDdB}SYSV_SIGNALS\${SEDdC}1\${SEDdD}
\${SEDuA}SYSV_SIGNALS\${SEDuB}SYSV_SIGNALS\${SEDuC}1\${SEDuD}
\${SEDeA}SYSV_SIGNALS\${SEDeB}SYSV_SIGNALS\${SEDeC}1\${SEDeD}
"
}

else
  {
test -n "$verbose" && \
echo "	defining POSIX_SIGNALS"
DEFS="$DEFS -DPOSIX_SIGNALS=1"
SEDDEFS="${SEDDEFS}\${SEDdA}POSIX_SIGNALS\${SEDdB}POSIX_SIGNALS\${SEDdC}1\${SEDdD}
\${SEDuA}POSIX_SIGNALS\${SEDuB}POSIX_SIGNALS\${SEDuC}1\${SEDuD}
\${SEDeA}POSIX_SIGNALS\${SEDeB}POSIX_SIGNALS\${SEDeC}1\${SEDeD}
"
}

fi
rm -f conftest*


fi
rm -f conftest*

LIBS_save="${LIBS}"
LIBS="${LIBS} -lBSD"
have_lib=""
echo checking for -lBSD
cat > conftest.c <<EOF

int main() { exit(0); }
int t() { main(); }
EOF
if eval $compile; then
  have_lib="1"
fi
rm -f conftest*
LIBS="${LIBS_save}"
if test -n "${have_lib}"; then
   :; LIBS="$LIBS -lBSD"
else
   :; 
fi

LIBS_save="${LIBS}"
LIBS="${LIBS} -lbsd"
have_lib=""
echo checking for -lbsd
cat > conftest.c <<EOF

int main() { exit(0); }
int t() { main(); }
EOF
if eval $compile; then
  have_lib="1"
fi
rm -f conftest*
LIBS="${LIBS_save}"
if test -n "${have_lib}"; then
   :; LIBS="$LIBS -lbsd"
else
   :; 
fi


echo checking for usleep
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_usleep) || defined (__stub___usleep)
choke me
#else
/* Override any gcc2 internal prototype to avoid an error.  */
extern char usleep(); usleep();
#endif
 }
EOF
if eval $compile; then
  {
test -n "$verbose" && \
echo "	defining HAVE_USLEEP"
DEFS="$DEFS -DHAVE_USLEEP=1"
SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_USLEEP\${SEDdB}HAVE_USLEEP\${SEDdC}1\${SEDdD}
\${SEDuA}HAVE_USLEEP\${SEDuB}HAVE_USLEEP\${SEDuC}1\${SEDuD}
\${SEDeA}HAVE_USLEEP\${SEDeB}HAVE_USLEEP\${SEDeC}1\${SEDeD}
"
}

fi
rm -f conftest*


for func in random strdup
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



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 -fr system.mk config.h conftest*; exit 1' 1 3 15
CC='$CC'
CPP='$CPP'
MPINC='$MPINC'
MPLIB='$MPLIB'
NORSA='$NORSA'
INCS='$INCS'
LIBOBJS='$LIBOBJS'
LIBS='$LIBS'
srcdir='$srcdir'
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="system.mk"

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%@CC@%$CC%g
s%@CPP@%$CPP%g
s%@MPINC@%$MPINC%g
s%@MPLIB@%$MPLIB%g
s%@NORSA@%$NORSA%g
s%@INCS@%$INCS%g
s%@LIBOBJS@%$LIBOBJS%g
s%@LIBS@%$LIBS%g
s%@srcdir@%$srcdir%g
s%@DEFS@%-DHAVE_CONFIG_H%" $top_srcdir/${file}.in >> $file
fi; done
test -n "$gen_config" || gen_config=config.h
echo creating $gen_config
# 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

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

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

while :
do
  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
# config.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/$gen_config.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 "/* $gen_config.  Generated automatically by configure.  */" > conftest.h
cat conftest.h1 >> conftest.h
rm -f conftest.h1
if cmp -s $gen_config conftest.h 2>/dev/null; then
  # The file exists and we would not be changing it.
  rm -f conftest.h
else
  rm -f $gen_config
  mv conftest.h $gen_config
fi


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

