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

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

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

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

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


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

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

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

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

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

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

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

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

     *) ;;
    esac
  fi
done

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

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

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

# 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
 if [ -r CUSTOMIZE.$BUILDTYPE ]; then
  echo reading configuration customizations from file CUSTOMIZE.$BUILDTYPE
  . ./CUSTOMIZE.$BUILDTYPE
fi
    for arg in udposix.h.in; do
    case "$PORT_MANIFEST" in
      *$arg*) ;;
      *)      PORT_MANIFEST="$PORT_MANIFEST $arg";;
    esac
  done
CPPFLAGS=${CPPFLAGS-"-DNDEBUG"}
CFLAGS=${CFLAGS-"-O"}
FFLAGS=${FFLAGS-"-O"}

 
if test -z "$OS"; then
echo checking for type of operating system
cat << \CAT_EOF > conftest.c
#ifdef linux
OS_linux
#endif
#ifdef __osf__
OS_osf
#endif
#ifdef _AIX
OS_aix
#endif
#ifdef hpux
OS_hpux
#endif
#ifdef sgi
OS_irix
#endif
#ifdef sun
OS_sunos
#endif
#ifdef ultrix
OS_ultrix
#endif
#ifdef _UNICOS
OS_unicos
#endif
CAT_EOF
OS=`cc -E conftest.c | sed -n '/^OS_/ {
  s///p
  q
}'`
rm conftest.c
if test -z "$OS"; then
  echo "OS:operating system:sunos" >> conf.missing
fi
fi
 case "${OS}" in
  aix*)    for arg in -D_ALL_SOURCE; do
    case "$CPPFLAGS" in
      *$arg*) ;;
      *)      CPPFLAGS="$CPPFLAGS $arg";;
    esac
  done
;;
  hpux*)   for arg in -D_HPUX_SOURCE; do
    case "$CPPFLAGS" in
      *$arg*) ;;
      *)      CPPFLAGS="$CPPFLAGS $arg";;
    esac
  done
;;
esac
LIBOBJS=${LIBOBJS-""}

 PORT_HEADERS=${PORT_HEADERS-""}

 PORT_MANIFEST=${PORT_MANIFEST-""}


PORT_SUBDIRS=${PORT_SUBDIRS-""}



if test -z "$CC"; then
  echo checking for cc
  saveifs="$IFS"; IFS="${IFS}:"
  for dir in $PATH; do
    test -z "$dir" && dir=.
    if test -f $dir/cc; then
      CC="cc"
      break
    fi
  done
  IFS="$saveifs"
fi
test -z "$CC" && CC=""
if test -z "$CC"; then
  echo "CC:C compiler:/bin/cc" >> conf.missing
fi
# Find out if we are using GNU C, under whatever name.
cat <<EOF > conftest.c
#ifdef __GNUC__
  yes
#endif
EOF
${CC-cc} -E conftest.c > conftest.out 2>&1
if egrep yes conftest.out >/dev/null 2>&1; then
  GCC=1 # For later tests.
  CC="$CC -O"
fi
rm -f conftest*
 if test -z "$AR"; then
  echo checking for ar
  saveifs="$IFS"; IFS="${IFS}:"
  for dir in $PATH; do
    test -z "$dir" && dir=.
    if test -f $dir/ar; then
      AR="ar"
      break
    fi
  done
  IFS="$saveifs"
fi
test -z "$AR" && AR=""
if test -z "$AR"; then
  echo "AR:library utility:/bin/ar" >> conf.missing
fi
 if test -z "$RANLIB"; then
  echo checking for ranlib
  saveifs="$IFS"; IFS="${IFS}:"
  for dir in $PATH; do
    test -z "$dir" && dir=.
    if test -f $dir/ranlib; then
      RANLIB="ranlib"
      break
    fi
  done
  IFS="$saveifs"
fi
test -z "$RANLIB" && RANLIB="@:"
  

echo setting the installation prefix
prefix=`case "${prefix-..}" in 
  /*) echo ${prefix-..}; exit;;
   *) path=\`pwd\`/${prefix-..}
        tail=
        while test -n "$path"; do
          (cd $path && echo \`pwd\`$rest) 2> /dev/null && exit
          base=/\`basename "$path"\`
          tail=/$base$tail
          path=\`echo "$path" | sed "s/\/$base//"\`
        done;;
esac
`
test -z "$exec_prefix" && exec_prefix=$prefix/bin


if test -z "$AR"; then
  echo checking for ar
  saveifs="$IFS"; IFS="${IFS}:"
  for dir in $PATH; do
    test -z "$dir" && dir=.
    if test -f $dir/ar; then
      AR="ar"
      break
    fi
  done
  IFS="$saveifs"
fi
test -z "$AR" && AR=""
if test -z "$AR"; then
  echo "AR:library utility:/bin/ar" >> conf.missing
fi

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


 case "$OS" in
  hpux*) for p in fort77 fortc f77
do
if test -z "$FC"; then
  echo checking for $p
  saveifs="$IFS"; IFS="${IFS}:"
  for dir in $PATH; do
    test -z "$dir" && dir=.
    if test -f $dir/$p; then
      FC="$p"
      break
    fi
  done
  IFS="$saveifs"
fi
test -z "$FC" && FC=""

test -n "$FC" && break
done
;;
  *)     for p in f77 cf77
do
if test -z "$FC"; then
  echo checking for $p
  saveifs="$IFS"; IFS="${IFS}:"
  for dir in $PATH; do
    test -z "$dir" && dir=.
    if test -f $dir/$p; then
      FC="$p"
      break
    fi
  done
  IFS="$saveifs"
fi
test -z "$FC" && FC=""

test -n "$FC" && break
done
;;
esac
if test -z "$FC"; then
  echo "FC:FORTRAN compiler:/bin/f77" >> conf.missing
fi


echo checking how to run the C preprocessor
if test -z "$CPP"; then
  CPP='${CC-cc} -E'
  cat > conftest.c <<EOF
#include <stdio.h>
EOF
err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
if test -z "$err"; then
  :
else
  CPP=/lib/cpp
fi
rm -f conftest*
fi
CPP=`eval echo $CPP`
echo "#include <stdlib.h>" > conftest.c
if test `$CPP conftest.c 2> /dev/null | wc -l` = 0; then
  if test "$CPP" = cpp; then
    echo 1>&2 "$0: C preprocessor, \`$CPP', doesn't work"
    echo "CPP:C preprocessor:/lib/cpp" >> conf.missing
  else
    echo 1>&2 "$0: C preprocessor, \`$CPP', doesn't work; setting to \`cpp'"
    CPP=cpp
    if test `which ${CPP} 2>&1 | wc -w` != 1; then
      echo 1>&2 "$0: C preprocessor, \`$CPP', doesn't exist"
      echo "CPP:C preprocessor:/lib/cpp" >> conf.missing
    fi
  fi
fi
rm -f conftest.c

if test -z "$NEQN"; then
  echo checking for neqn
  saveifs="$IFS"; IFS="${IFS}:"
  for dir in $PATH; do
    test -z "$dir" && dir=.
    if test -f $dir/neqn; then
      NEQN="neqn"
      break
    fi
  done
  IFS="$saveifs"
fi
test -z "$NEQN" && NEQN="cat"
test "$NEQN" = cat && 
  echo 1>&2 "$0: Can't find program \`neqn'; setting to \`cat'"

if test -z "$TBL"; then
  echo checking for tbl
  saveifs="$IFS"; IFS="${IFS}:"
  for dir in $PATH; do
    test -z "$dir" && dir=.
    if test -f $dir/tbl; then
      TBL="tbl"
      break
    fi
  done
  IFS="$saveifs"
fi
test -z "$TBL" && TBL="cat"
test "$TBL" = cat && 
  echo 1>&2 "$0: Can't find \`tbl'; setting to \`cat'"

if test -z "$TROFF"; then
  echo checking for troff
  saveifs="$IFS"; IFS="${IFS}:"
  for dir in $PATH; do
    test -z "$dir" && dir=.
    if test -f $dir/troff; then
      TROFF="ptroff"
      break
    fi
  done
  IFS="$saveifs"
fi
test -z "$TROFF" && TROFF="troff"
if test -z "$TROFF"; then
  echo "TROFF:troff(1)-like utility:/bin/troff" >> conf.missing
fi

# Make sure to not get the incompatible SysV /etc/install and
# /usr/sbin/install, which might be in PATH before a BSD-like install,
# or the SunOS /usr/etc/install directory, or the AIX /bin/install,
# or the AFS install, which mishandles nonexistent args.  (Sigh.)
if test -z "$INSTALL"; then
  echo checking for install
  saveifs="$IFS"; IFS="${IFS}:"
  for dir in $PATH; do
    test -z "$dir" && dir=.
    case $dir in
    /etc|/usr/sbin|/usr/etc|/usr/afsws/bin) ;;
    *)
      if test -f $dir/install; then
	if grep dspmsg $dir/install >/dev/null 2>&1; then
	  : # AIX
	else
	  INSTALL="$dir/install -c"
	  INSTALL_PROGRAM='$(INSTALL)'
	  INSTALL_DATA='$(INSTALL) -m 644'
	  break
	fi
      fi
      ;;
    esac
  done
  IFS="$saveifs"
fi
INSTALL=${INSTALL-cp}
INSTALL_PROGRAM=${INSTALL_PROGRAM-'$(INSTALL)'}
INSTALL_DATA=${INSTALL_DATA-'$(INSTALL)'}
INSTALL_DATA="`echo "${INSTALL_DATA}" | sed 's/644/664/'`"


echo checking for working const
cat > conftest.c <<EOF

main() { exit(0); } 
t() { /* Ultrix mips cc rejects this.  */
typedef int charset[2]; const charset x;
 }
EOF
if eval $compile; then
  :
else
  DEFS="$DEFS -DUD_NO_CONST=1"
SEDDEFS="${SEDDEFS}\${SEDdA}UD_NO_CONST\${SEDdB}UD_NO_CONST\${SEDdC}1\${SEDdD}
\${SEDuA}UD_NO_CONST\${SEDuB}UD_NO_CONST\${SEDuC}1\${SEDuD}
\${SEDeA}UD_NO_CONST\${SEDeB}UD_NO_CONST\${SEDeC}1\${SEDeD}
"
fi
rm -f conftest*

echo checking for working signed
cat > conftest.c <<EOF

main() { exit(0); } 
t() { signed char x;
 }
EOF
if eval $compile; then
  :
else
  DEFS="$DEFS -DUD_NO_SIGNED=1"
SEDDEFS="${SEDDEFS}\${SEDdA}UD_NO_SIGNED\${SEDdB}UD_NO_SIGNED\${SEDdC}1\${SEDdD}
\${SEDuA}UD_NO_SIGNED\${SEDuB}UD_NO_SIGNED\${SEDuC}1\${SEDuD}
\${SEDeA}UD_NO_SIGNED\${SEDeB}UD_NO_SIGNED\${SEDeC}1\${SEDeD}
"
fi
rm -f conftest*

echo checking for function prototypes
cat > conftest.c <<EOF

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

  for arg in stdarg.h.in; do
    case "$PORT_MANIFEST" in
      *$arg*) ;;
      *)      PORT_MANIFEST="$PORT_MANIFEST $arg";;
    esac
  done
echo checking for variadic function support
cat > conftest.c <<EOF
#include <stdarg.h>
main() { exit(0); } 
t() { ;}
int foo(int bar, ...) {
    va_list     alist;
    va_start(alist, bar);
    bar = (int)va_arg(alist, int);
    va_end(alist);
    return bar;
 }
EOF
if eval $compile; then
  echo "#include <stdarg.h>" > conftestpath.c
path=//`$CPP conftestpath.c 2> /dev/null |
    sed -n 's/^#.* 1 "\(.*stdarg\.h\)".*/\1/p' | 
    head -1`
rm -f conftestpath.c
DEFS="$DEFS -DUD_SYSTEM_STDARG_H=\"$path\""
SEDDEFS="${SEDDEFS}\${SEDdA}UD_SYSTEM_STDARG_H\${SEDdB}UD_SYSTEM_STDARG_H\${SEDdC}\"$path\"\${SEDdD}
\${SEDuA}UD_SYSTEM_STDARG_H\${SEDuB}UD_SYSTEM_STDARG_H\${SEDuC}\"$path\"\${SEDuD}
\${SEDeA}UD_SYSTEM_STDARG_H\${SEDeB}UD_SYSTEM_STDARG_H\${SEDeC}\"$path\"\${SEDeD}
"

else
  DEFS="$DEFS -DUD_NO_STDARG=1"
SEDDEFS="${SEDDEFS}\${SEDdA}UD_NO_STDARG\${SEDdB}UD_NO_STDARG\${SEDdC}1\${SEDdD}
\${SEDuA}UD_NO_STDARG\${SEDuB}UD_NO_STDARG\${SEDuC}1\${SEDuD}
\${SEDeA}UD_NO_STDARG\${SEDeB}UD_NO_STDARG\${SEDeC}1\${SEDeD}
"
echo "#include <varargs.h>" > conftestpath.c
path=//`$CPP conftestpath.c 2> /dev/null |
    sed -n 's/^#.* 1 "\(.*varargs\.h\)".*/\1/p' | 
    head -1`
rm -f conftestpath.c
DEFS="$DEFS -DUD_SYSTEM_STDARG_H=\"$path\""
SEDDEFS="${SEDDEFS}\${SEDdA}UD_SYSTEM_STDARG_H\${SEDdB}UD_SYSTEM_STDARG_H\${SEDdC}\"$path\"\${SEDdD}
\${SEDuA}UD_SYSTEM_STDARG_H\${SEDuB}UD_SYSTEM_STDARG_H\${SEDuC}\"$path\"\${SEDuD}
\${SEDeA}UD_SYSTEM_STDARG_H\${SEDeB}UD_SYSTEM_STDARG_H\${SEDeC}\"$path\"\${SEDeD}
"

fi
rm -f conftest*
  for arg in stdarg.h; do
    case "$PORT_HEADERS" in
      *$arg*) ;;
      *)      PORT_HEADERS="$PORT_HEADERS $arg";;
    esac
  done

echo checking for stringization
cat > conftest.c <<EOF
# define MAKESTRING(x)	#x
main() { exit(0); } 
t() { char *cp = MAKESTRING(foo);
 }
EOF
if eval $compile; then
  :
else
  DEFS="$DEFS -DUD_NO_STRINGIZATION=1"
SEDDEFS="${SEDDEFS}\${SEDdA}UD_NO_STRINGIZATION\${SEDdB}UD_NO_STRINGIZATION\${SEDdC}1\${SEDdD}
\${SEDuA}UD_NO_STRINGIZATION\${SEDuB}UD_NO_STRINGIZATION\${SEDuC}1\${SEDuD}
\${SEDeA}UD_NO_STRINGIZATION\${SEDeB}UD_NO_STRINGIZATION\${SEDeC}1\${SEDeD}
"
fi
rm -f conftest*


echo checking for token pasting
cat > conftest.c <<EOF
#define GLUE(a,b) a ## b
main() { exit(0); } 
t() { char *GLUE(c,p) = "foo";
 }
EOF
if eval $compile; then
  :
else
  DEFS="$DEFS -DUD_NO_TOKEN_PASTING=1"
SEDDEFS="${SEDDEFS}\${SEDdA}UD_NO_TOKEN_PASTING\${SEDdB}UD_NO_TOKEN_PASTING\${SEDdC}1\${SEDdD}
\${SEDuA}UD_NO_TOKEN_PASTING\${SEDuB}UD_NO_TOKEN_PASTING\${SEDuC}1\${SEDuD}
\${SEDeA}UD_NO_TOKEN_PASTING\${SEDeB}UD_NO_TOKEN_PASTING\${SEDeC}1\${SEDeD}
"
fi
rm -f conftest*


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

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

  for arg in udposix.h.in; do
    case "$PORT_MANIFEST" in
      *$arg*) ;;
      *)      PORT_MANIFEST="$PORT_MANIFEST $arg";;
    esac
  done

  for arg in stddef.h.in; do
    case "$PORT_MANIFEST" in
      *$arg*) ;;
      *)      PORT_MANIFEST="$PORT_MANIFEST $arg";;
    esac
  done
  for arg in stddef.h; do
    case "$PORT_HEADERS" in
      *$arg*) ;;
      *)      PORT_HEADERS="$PORT_HEADERS $arg";;
    esac
  done
echo "#include <stddef.h>" > conftestpath.c
path=//`$CPP conftestpath.c 2> /dev/null |
    sed -n 's/^#.* 1 "\(.*stddef\.h\)".*/\1/p' | 
    head -1`
rm -f conftestpath.c
DEFS="$DEFS -DUD_SYSTEM_STDDEF_H=\"$path\""
SEDDEFS="${SEDDEFS}\${SEDdA}UD_SYSTEM_STDDEF_H\${SEDdB}UD_SYSTEM_STDDEF_H\${SEDdC}\"$path\"\${SEDdD}
\${SEDuA}UD_SYSTEM_STDDEF_H\${SEDuB}UD_SYSTEM_STDDEF_H\${SEDuC}\"$path\"\${SEDuD}
\${SEDeA}UD_SYSTEM_STDDEF_H\${SEDeB}UD_SYSTEM_STDDEF_H\${SEDeC}\"$path\"\${SEDeD}
"
echo checking for macro offsetof
cat > conftest.c <<EOF
#include <stddef.h>
#ifdef offsetof
  error
#endif
main() { exit(0); } 
t() {  }
EOF
if eval $compile; then
  DEFS="$DEFS -DUD_NO_OFFSETOF_MACRO=1"
SEDDEFS="${SEDDEFS}\${SEDdA}UD_NO_OFFSETOF_MACRO\${SEDdB}UD_NO_OFFSETOF_MACRO\${SEDdC}1\${SEDdD}
\${SEDuA}UD_NO_OFFSETOF_MACRO\${SEDuB}UD_NO_OFFSETOF_MACRO\${SEDuC}1\${SEDuD}
\${SEDeA}UD_NO_OFFSETOF_MACRO\${SEDeB}UD_NO_OFFSETOF_MACRO\${SEDeC}1\${SEDeD}
"
fi
rm -f conftest*

  for arg in fortc; do
    case "$PORT_SUBDIRS" in
      *$arg*) ;;
      *)      PORT_SUBDIRS="$PORT_SUBDIRS $arg";;
    esac
  done
  for arg in fortc.h fortc.fc udalloc.h; do
    case "$PORT_MANIFEST" in
      *$arg*) ;;
      *)      PORT_MANIFEST="$PORT_MANIFEST $arg";;
    esac
  done
dir=`pwd`/port/fortc
FORTC="$dir/fortc"
NEED_FORTC=yes




  for arg in config.c; do
    case "$PORT_MANIFEST" in
      *$arg*) ;;
      *)      PORT_MANIFEST="$PORT_MANIFEST $arg";;
    esac
  done
echo checking for limits.h
cat > conftest.c <<EOF
#include <limits.h>
EOF
err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
if test -z "$err"; then
  echo "#include <limits.h>" > conftestpath.c
path=//`$CPP conftestpath.c 2> /dev/null |
    sed -n 's/^#.* 1 "\(.*limits\.h\)".*/\1/p' | 
    head -1`
rm -f conftestpath.c
DEFS="$DEFS -DUD_SYSTEM_LIMITS_H=\"$path\""
SEDDEFS="${SEDDEFS}\${SEDdA}UD_SYSTEM_LIMITS_H\${SEDdB}UD_SYSTEM_LIMITS_H\${SEDdC}\"$path\"\${SEDdD}
\${SEDuA}UD_SYSTEM_LIMITS_H\${SEDuB}UD_SYSTEM_LIMITS_H\${SEDuC}\"$path\"\${SEDuD}
\${SEDeA}UD_SYSTEM_LIMITS_H\${SEDeB}UD_SYSTEM_LIMITS_H\${SEDeC}\"$path\"\${SEDeD}
"

else
    for arg in limits.h; do
    case "$PORT_HEADERS" in
      *$arg*) ;;
      *)      PORT_HEADERS="$PORT_HEADERS $arg";;
    esac
  done

fi
rm -f conftest*

  for arg in signal.h.in sigaddset.c \
    sigdelset.c sigemptyset.c sigprocmask.c sigsuspend.c; do
    case "$PORT_MANIFEST" in
      *$arg*) ;;
      *)      PORT_MANIFEST="$PORT_MANIFEST $arg";;
    esac
  done
  for arg in signal.h; do
    case "$PORT_HEADERS" in
      *$arg*) ;;
      *)      PORT_HEADERS="$PORT_HEADERS $arg";;
    esac
  done
echo "#include <signal.h>" > conftestpath.c
path=//`$CPP conftestpath.c 2> /dev/null |
    sed -n 's/^#.* 1 "\(.*signal\.h\)".*/\1/p' | 
    head -1`
rm -f conftestpath.c
DEFS="$DEFS -DUD_SYSTEM_SIGNAL_H=\"$path\""
SEDDEFS="${SEDDEFS}\${SEDdA}UD_SYSTEM_SIGNAL_H\${SEDdB}UD_SYSTEM_SIGNAL_H\${SEDdC}\"$path\"\${SEDdD}
\${SEDuA}UD_SYSTEM_SIGNAL_H\${SEDuB}UD_SYSTEM_SIGNAL_H\${SEDuC}\"$path\"\${SEDuD}
\${SEDeA}UD_SYSTEM_SIGNAL_H\${SEDeB}UD_SYSTEM_SIGNAL_H\${SEDeC}\"$path\"\${SEDeD}
"
echo checking for typedef sigset_t
cat > conftest.c <<EOF
#include <signal.h>
typedef void sigset_t;
main() { exit(0); } 
t() {  }
EOF
if eval $compile; then
  DEFS="$DEFS -DUD_NO_SIGSET_T=1"
SEDDEFS="${SEDDEFS}\${SEDdA}UD_NO_SIGSET_T\${SEDdB}UD_NO_SIGSET_T\${SEDdC}1\${SEDdD}
\${SEDuA}UD_NO_SIGSET_T\${SEDuB}UD_NO_SIGSET_T\${SEDuC}1\${SEDuD}
\${SEDeA}UD_NO_SIGSET_T\${SEDeB}UD_NO_SIGSET_T\${SEDeC}1\${SEDeD}
"
fi
rm -f conftest*
echo checking for typedef sig_atomic_t
cat > conftest.c <<EOF
#include <signal.h>
typedef void sig_atomic_t;
main() { exit(0); } 
t() {  }
EOF
if eval $compile; then
  DEFS="$DEFS -DUD_NO_SIG_ATOMIC_T=1"
SEDDEFS="${SEDDEFS}\${SEDdA}UD_NO_SIG_ATOMIC_T\${SEDdB}UD_NO_SIG_ATOMIC_T\${SEDdC}1\${SEDdD}
\${SEDuA}UD_NO_SIG_ATOMIC_T\${SEDuB}UD_NO_SIG_ATOMIC_T\${SEDuC}1\${SEDuD}
\${SEDeA}UD_NO_SIG_ATOMIC_T\${SEDeB}UD_NO_SIG_ATOMIC_T\${SEDeC}1\${SEDeD}
"
fi
rm -f conftest*
echo checking for structure sigaction
cat > conftest.c <<EOF
#include <signal.h>
struct sigaction {char *foo;};
main() { exit(0); } 
t() {  }
EOF
if eval $compile; then
  DEFS="$DEFS -DUD_NO_SIGACTION_STRUCT=1"
SEDDEFS="${SEDDEFS}\${SEDdA}UD_NO_SIGACTION_STRUCT\${SEDdB}UD_NO_SIGACTION_STRUCT\${SEDdC}1\${SEDdD}
\${SEDuA}UD_NO_SIGACTION_STRUCT\${SEDuB}UD_NO_SIGACTION_STRUCT\${SEDuC}1\${SEDuD}
\${SEDeA}UD_NO_SIGACTION_STRUCT\${SEDeB}UD_NO_SIGACTION_STRUCT\${SEDeC}1\${SEDeD}
"
fi
rm -f conftest*
echo checking for function sigaction declaration
cat > conftest.c <<EOF
#include <signal.h>
main() { exit(0); } 
t() { extern struct {int foo;} *sigaction();
 }
EOF
if eval $compile; then
  DEFS="$DEFS -DUD_NO_SIGACTION_DECL=1"
SEDDEFS="${SEDDEFS}\${SEDdA}UD_NO_SIGACTION_DECL\${SEDdB}UD_NO_SIGACTION_DECL\${SEDdC}1\${SEDdD}
\${SEDuA}UD_NO_SIGACTION_DECL\${SEDuB}UD_NO_SIGACTION_DECL\${SEDuC}1\${SEDuD}
\${SEDeA}UD_NO_SIGACTION_DECL\${SEDeB}UD_NO_SIGACTION_DECL\${SEDeC}1\${SEDeD}
"
for func in sigaction
do
echo checking for ${func}
cat > conftest.c <<EOF

main() { exit(0); } 
t() { 
/* Override any gcc2 internal prototype to avoid an error.  */
extern char ${func}(); ${func}(); }
EOF
if eval $compile; then
  :
else
  LIBOBJS="$LIBOBJS ${func}.o"
fi
rm -f conftest*

done

fi
rm -f conftest*
echo checking for function sigemptyset declaration
cat > conftest.c <<EOF
#include <signal.h>
main() { exit(0); } 
t() { extern struct {int foo;} *sigemptyset();
 }
EOF
if eval $compile; then
  DEFS="$DEFS -DUD_NO_SIGEMPTYSET_DECL=1"
SEDDEFS="${SEDDEFS}\${SEDdA}UD_NO_SIGEMPTYSET_DECL\${SEDdB}UD_NO_SIGEMPTYSET_DECL\${SEDdC}1\${SEDdD}
\${SEDuA}UD_NO_SIGEMPTYSET_DECL\${SEDuB}UD_NO_SIGEMPTYSET_DECL\${SEDuC}1\${SEDuD}
\${SEDeA}UD_NO_SIGEMPTYSET_DECL\${SEDeB}UD_NO_SIGEMPTYSET_DECL\${SEDeC}1\${SEDeD}
"
for func in sigemptyset
do
echo checking for ${func}
cat > conftest.c <<EOF

main() { exit(0); } 
t() { 
/* Override any gcc2 internal prototype to avoid an error.  */
extern char ${func}(); ${func}(); }
EOF
if eval $compile; then
  :
else
  LIBOBJS="$LIBOBJS ${func}.o"
fi
rm -f conftest*

done

fi
rm -f conftest*
echo checking for function sigfillset declaration
cat > conftest.c <<EOF
#include <signal.h>
main() { exit(0); } 
t() { extern struct {int foo;} *sigfillset();
 }
EOF
if eval $compile; then
  DEFS="$DEFS -DUD_NO_SIGFILLSET_DECL=1"
SEDDEFS="${SEDDEFS}\${SEDdA}UD_NO_SIGFILLSET_DECL\${SEDdB}UD_NO_SIGFILLSET_DECL\${SEDdC}1\${SEDdD}
\${SEDuA}UD_NO_SIGFILLSET_DECL\${SEDuB}UD_NO_SIGFILLSET_DECL\${SEDuC}1\${SEDuD}
\${SEDeA}UD_NO_SIGFILLSET_DECL\${SEDeB}UD_NO_SIGFILLSET_DECL\${SEDeC}1\${SEDeD}
"
for func in sigfillset
do
echo checking for ${func}
cat > conftest.c <<EOF

main() { exit(0); } 
t() { 
/* Override any gcc2 internal prototype to avoid an error.  */
extern char ${func}(); ${func}(); }
EOF
if eval $compile; then
  :
else
  LIBOBJS="$LIBOBJS ${func}.o"
fi
rm -f conftest*

done

fi
rm -f conftest*
echo checking for function sigaddset declaration
cat > conftest.c <<EOF
#include <signal.h>
main() { exit(0); } 
t() { extern struct {int foo;} *sigaddset();
 }
EOF
if eval $compile; then
  DEFS="$DEFS -DUD_NO_SIGADDSET_DECL=1"
SEDDEFS="${SEDDEFS}\${SEDdA}UD_NO_SIGADDSET_DECL\${SEDdB}UD_NO_SIGADDSET_DECL\${SEDdC}1\${SEDdD}
\${SEDuA}UD_NO_SIGADDSET_DECL\${SEDuB}UD_NO_SIGADDSET_DECL\${SEDuC}1\${SEDuD}
\${SEDeA}UD_NO_SIGADDSET_DECL\${SEDeB}UD_NO_SIGADDSET_DECL\${SEDeC}1\${SEDeD}
"
for func in sigaddset
do
echo checking for ${func}
cat > conftest.c <<EOF

main() { exit(0); } 
t() { 
/* Override any gcc2 internal prototype to avoid an error.  */
extern char ${func}(); ${func}(); }
EOF
if eval $compile; then
  :
else
  LIBOBJS="$LIBOBJS ${func}.o"
fi
rm -f conftest*

done

fi
rm -f conftest*
echo checking for function sigdelset declaration
cat > conftest.c <<EOF
#include <signal.h>
main() { exit(0); } 
t() { extern struct {int foo;} *sigdelset();
 }
EOF
if eval $compile; then
  DEFS="$DEFS -DUD_NO_SIGDELSET_DECL=1"
SEDDEFS="${SEDDEFS}\${SEDdA}UD_NO_SIGDELSET_DECL\${SEDdB}UD_NO_SIGDELSET_DECL\${SEDdC}1\${SEDdD}
\${SEDuA}UD_NO_SIGDELSET_DECL\${SEDuB}UD_NO_SIGDELSET_DECL\${SEDuC}1\${SEDuD}
\${SEDeA}UD_NO_SIGDELSET_DECL\${SEDeB}UD_NO_SIGDELSET_DECL\${SEDeC}1\${SEDeD}
"
for func in sigdelset
do
echo checking for ${func}
cat > conftest.c <<EOF

main() { exit(0); } 
t() { 
/* Override any gcc2 internal prototype to avoid an error.  */
extern char ${func}(); ${func}(); }
EOF
if eval $compile; then
  :
else
  LIBOBJS="$LIBOBJS ${func}.o"
fi
rm -f conftest*

done

fi
rm -f conftest*
echo checking for function sigismember declaration
cat > conftest.c <<EOF
#include <signal.h>
main() { exit(0); } 
t() { extern struct {int foo;} *sigismember();
 }
EOF
if eval $compile; then
  DEFS="$DEFS -DUD_NO_SIGISMEMBER_DECL=1"
SEDDEFS="${SEDDEFS}\${SEDdA}UD_NO_SIGISMEMBER_DECL\${SEDdB}UD_NO_SIGISMEMBER_DECL\${SEDdC}1\${SEDdD}
\${SEDuA}UD_NO_SIGISMEMBER_DECL\${SEDuB}UD_NO_SIGISMEMBER_DECL\${SEDuC}1\${SEDuD}
\${SEDeA}UD_NO_SIGISMEMBER_DECL\${SEDeB}UD_NO_SIGISMEMBER_DECL\${SEDeC}1\${SEDeD}
"
for func in sigismember
do
echo checking for ${func}
cat > conftest.c <<EOF

main() { exit(0); } 
t() { 
/* Override any gcc2 internal prototype to avoid an error.  */
extern char ${func}(); ${func}(); }
EOF
if eval $compile; then
  :
else
  LIBOBJS="$LIBOBJS ${func}.o"
fi
rm -f conftest*

done

fi
rm -f conftest*
echo checking for function sigaction declaration
cat > conftest.c <<EOF
#include <signal.h>
main() { exit(0); } 
t() { extern struct {int foo;} *sigaction();
 }
EOF
if eval $compile; then
  DEFS="$DEFS -DUD_NO_SIGACTION_DECL=1"
SEDDEFS="${SEDDEFS}\${SEDdA}UD_NO_SIGACTION_DECL\${SEDdB}UD_NO_SIGACTION_DECL\${SEDdC}1\${SEDdD}
\${SEDuA}UD_NO_SIGACTION_DECL\${SEDuB}UD_NO_SIGACTION_DECL\${SEDuC}1\${SEDuD}
\${SEDeA}UD_NO_SIGACTION_DECL\${SEDeB}UD_NO_SIGACTION_DECL\${SEDeC}1\${SEDeD}
"
for func in sigaction
do
echo checking for ${func}
cat > conftest.c <<EOF

main() { exit(0); } 
t() { 
/* Override any gcc2 internal prototype to avoid an error.  */
extern char ${func}(); ${func}(); }
EOF
if eval $compile; then
  :
else
  LIBOBJS="$LIBOBJS ${func}.o"
fi
rm -f conftest*

done

fi
rm -f conftest*
echo checking for function sigprocmask declaration
cat > conftest.c <<EOF
#include <signal.h>
main() { exit(0); } 
t() { extern struct {int foo;} *sigprocmask();
 }
EOF
if eval $compile; then
  DEFS="$DEFS -DUD_NO_SIGPROCMASK_DECL=1"
SEDDEFS="${SEDDEFS}\${SEDdA}UD_NO_SIGPROCMASK_DECL\${SEDdB}UD_NO_SIGPROCMASK_DECL\${SEDdC}1\${SEDdD}
\${SEDuA}UD_NO_SIGPROCMASK_DECL\${SEDuB}UD_NO_SIGPROCMASK_DECL\${SEDuC}1\${SEDuD}
\${SEDeA}UD_NO_SIGPROCMASK_DECL\${SEDeB}UD_NO_SIGPROCMASK_DECL\${SEDeC}1\${SEDeD}
"
for func in sigprocmask
do
echo checking for ${func}
cat > conftest.c <<EOF

main() { exit(0); } 
t() { 
/* Override any gcc2 internal prototype to avoid an error.  */
extern char ${func}(); ${func}(); }
EOF
if eval $compile; then
  :
else
  LIBOBJS="$LIBOBJS ${func}.o"
fi
rm -f conftest*

done

fi
rm -f conftest*
echo checking for function sigpending declaration
cat > conftest.c <<EOF
#include <signal.h>
main() { exit(0); } 
t() { extern struct {int foo;} *sigpending();
 }
EOF
if eval $compile; then
  DEFS="$DEFS -DUD_NO_SIGPENDING_DECL=1"
SEDDEFS="${SEDDEFS}\${SEDdA}UD_NO_SIGPENDING_DECL\${SEDdB}UD_NO_SIGPENDING_DECL\${SEDdC}1\${SEDdD}
\${SEDuA}UD_NO_SIGPENDING_DECL\${SEDuB}UD_NO_SIGPENDING_DECL\${SEDuC}1\${SEDuD}
\${SEDeA}UD_NO_SIGPENDING_DECL\${SEDeB}UD_NO_SIGPENDING_DECL\${SEDeC}1\${SEDeD}
"
for func in sigpending
do
echo checking for ${func}
cat > conftest.c <<EOF

main() { exit(0); } 
t() { 
/* Override any gcc2 internal prototype to avoid an error.  */
extern char ${func}(); ${func}(); }
EOF
if eval $compile; then
  :
else
  LIBOBJS="$LIBOBJS ${func}.o"
fi
rm -f conftest*

done

fi
rm -f conftest*
echo checking for function sigsuspend declaration
cat > conftest.c <<EOF
#include <signal.h>
main() { exit(0); } 
t() { extern struct {int foo;} *sigsuspend();
 }
EOF
if eval $compile; then
  DEFS="$DEFS -DUD_NO_SIGSUSPEND_DECL=1"
SEDDEFS="${SEDDEFS}\${SEDdA}UD_NO_SIGSUSPEND_DECL\${SEDdB}UD_NO_SIGSUSPEND_DECL\${SEDdC}1\${SEDdD}
\${SEDuA}UD_NO_SIGSUSPEND_DECL\${SEDuB}UD_NO_SIGSUSPEND_DECL\${SEDuC}1\${SEDuD}
\${SEDeA}UD_NO_SIGSUSPEND_DECL\${SEDeB}UD_NO_SIGSUSPEND_DECL\${SEDeC}1\${SEDeD}
"
for func in sigsuspend
do
echo checking for ${func}
cat > conftest.c <<EOF

main() { exit(0); } 
t() { 
/* Override any gcc2 internal prototype to avoid an error.  */
extern char ${func}(); ${func}(); }
EOF
if eval $compile; then
  :
else
  LIBOBJS="$LIBOBJS ${func}.o"
fi
rm -f conftest*

done

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

  for arg in stdlib.h.in atexit.c; do
    case "$PORT_MANIFEST" in
      *$arg*) ;;
      *)      PORT_MANIFEST="$PORT_MANIFEST $arg";;
    esac
  done
  for arg in stdlib.h; do
    case "$PORT_HEADERS" in
      *$arg*) ;;
      *)      PORT_HEADERS="$PORT_HEADERS $arg";;
    esac
  done
echo "#include <stdlib.h>" > conftestpath.c
path=//`$CPP conftestpath.c 2> /dev/null |
    sed -n 's/^#.* 1 "\(.*stdlib\.h\)".*/\1/p' | 
    head -1`
rm -f conftestpath.c
DEFS="$DEFS -DUD_SYSTEM_STDLIB_H=\"$path\""
SEDDEFS="${SEDDEFS}\${SEDdA}UD_SYSTEM_STDLIB_H\${SEDdB}UD_SYSTEM_STDLIB_H\${SEDdC}\"$path\"\${SEDdD}
\${SEDuA}UD_SYSTEM_STDLIB_H\${SEDuB}UD_SYSTEM_STDLIB_H\${SEDuC}\"$path\"\${SEDuD}
\${SEDeA}UD_SYSTEM_STDLIB_H\${SEDeB}UD_SYSTEM_STDLIB_H\${SEDeC}\"$path\"\${SEDeD}
"
echo checking for function atexit declaration
cat > conftest.c <<EOF
#include <stdlib.h>
main() { exit(0); } 
t() { extern struct {int foo;} *atexit();
 }
EOF
if eval $compile; then
  DEFS="$DEFS -DUD_NO_ATEXIT_DECL=1"
SEDDEFS="${SEDDEFS}\${SEDdA}UD_NO_ATEXIT_DECL\${SEDdB}UD_NO_ATEXIT_DECL\${SEDdC}1\${SEDdD}
\${SEDuA}UD_NO_ATEXIT_DECL\${SEDuB}UD_NO_ATEXIT_DECL\${SEDuC}1\${SEDuD}
\${SEDeA}UD_NO_ATEXIT_DECL\${SEDeB}UD_NO_ATEXIT_DECL\${SEDeC}1\${SEDeD}
"
for func in atexit
do
echo checking for ${func}
cat > conftest.c <<EOF

main() { exit(0); } 
t() { 
/* Override any gcc2 internal prototype to avoid an error.  */
extern char ${func}(); ${func}(); }
EOF
if eval $compile; then
  :
else
  LIBOBJS="$LIBOBJS ${func}.o"
fi
rm -f conftest*

done

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

  for arg in strerror.c string.h strstr.c string.h.in; do
    case "$PORT_MANIFEST" in
      *$arg*) ;;
      *)      PORT_MANIFEST="$PORT_MANIFEST $arg";;
    esac
  done
  for arg in string.h; do
    case "$PORT_HEADERS" in
      *$arg*) ;;
      *)      PORT_HEADERS="$PORT_HEADERS $arg";;
    esac
  done
echo "#include <string.h>" > conftestpath.c
path=//`$CPP conftestpath.c 2> /dev/null |
    sed -n 's/^#.* 1 "\(.*string\.h\)".*/\1/p' | 
    head -1`
rm -f conftestpath.c
DEFS="$DEFS -DUD_SYSTEM_STRING_H=\"$path\""
SEDDEFS="${SEDDEFS}\${SEDdA}UD_SYSTEM_STRING_H\${SEDdB}UD_SYSTEM_STRING_H\${SEDdC}\"$path\"\${SEDdD}
\${SEDuA}UD_SYSTEM_STRING_H\${SEDuB}UD_SYSTEM_STRING_H\${SEDuC}\"$path\"\${SEDuD}
\${SEDeA}UD_SYSTEM_STRING_H\${SEDeB}UD_SYSTEM_STRING_H\${SEDeC}\"$path\"\${SEDeD}
"
echo checking for function strerror declaration
cat > conftest.c <<EOF
#include <string.h>
main() { exit(0); } 
t() { extern struct {int foo;} *strerror();
 }
EOF
if eval $compile; then
  DEFS="$DEFS -DUD_NO_STRERROR_DECL=1"
SEDDEFS="${SEDDEFS}\${SEDdA}UD_NO_STRERROR_DECL\${SEDdB}UD_NO_STRERROR_DECL\${SEDdC}1\${SEDdD}
\${SEDuA}UD_NO_STRERROR_DECL\${SEDuB}UD_NO_STRERROR_DECL\${SEDuC}1\${SEDuD}
\${SEDeA}UD_NO_STRERROR_DECL\${SEDeB}UD_NO_STRERROR_DECL\${SEDeC}1\${SEDeD}
"
for func in strerror
do
echo checking for ${func}
cat > conftest.c <<EOF

main() { exit(0); } 
t() { 
/* Override any gcc2 internal prototype to avoid an error.  */
extern char ${func}(); ${func}(); }
EOF
if eval $compile; then
  :
else
  LIBOBJS="$LIBOBJS ${func}.o"
fi
rm -f conftest*

done

fi
rm -f conftest*
echo checking for function strstr declaration
cat > conftest.c <<EOF
#include <string.h>
main() { exit(0); } 
t() { extern struct {int foo;} *strstr();
 }
EOF
if eval $compile; then
  DEFS="$DEFS -DUD_NO_STRSTR_DECL=1"
SEDDEFS="${SEDDEFS}\${SEDdA}UD_NO_STRSTR_DECL\${SEDdB}UD_NO_STRSTR_DECL\${SEDdC}1\${SEDdD}
\${SEDuA}UD_NO_STRSTR_DECL\${SEDuB}UD_NO_STRSTR_DECL\${SEDuC}1\${SEDuD}
\${SEDeA}UD_NO_STRSTR_DECL\${SEDeB}UD_NO_STRSTR_DECL\${SEDeC}1\${SEDeD}
"
for func in strstr
do
echo checking for ${func}
cat > conftest.c <<EOF

main() { exit(0); } 
t() { 
/* Override any gcc2 internal prototype to avoid an error.  */
extern char ${func}(); ${func}(); }
EOF
if eval $compile; then
  :
else
  LIBOBJS="$LIBOBJS ${func}.o"
fi
rm -f conftest*

done

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


echo checking for X11 header-files
  if test -z "$CPP_X11"; then
    for dir in /usr/include ${OPENWINHOME-/usr/openwin}/include \
    /usr/local/include; do
      if test -r $dir/X11/Xlib.h; then
        CPP_X11=$dir
        break;
      fi
    done
    if test -z "$CPP_X11"; then
      echo "CPP_X11:X Window System include-directory:-I/usr/openwin/include" >> conf.missing
    fi
  fi
if test -n "${CPP_X11}"; then
  CPP_X11=-I${CPP_X11}
fi

echo checking for X11 library
if test -z "$LD_X11"; then
  for dir in /usr/lib/X11 ${OPENWINHOME-/usr/openwin}/lib /usr/lib  /usr/local/lib /usr/local/lib/X11; do
    if test -r $dir/libX11.a; then
      LD_X11="-L$dir -lX11"
      break
    fi
  done
  if test -z "$LD_X11"; then
      echo "LD_X11:X Window System library:-L/usr/lib/X11 -lX11" >> conf.missing
  fi
fi


FTPDIR=${FTPDIR-/home/ftp}/pub

echo checking for package version
if test -z "$VERSION"; then
  if test -r VERSION; then \
    VERSION="`cat VERSION`"
  else
    VERSION=
  fi
fi
if test -z "$MAJOR_NO"; then
  if test -n "$VERSION"; then \
    MAJOR_NO=`echo $VERSION |
      sed -n '/^\([0-9][0-9]*\)\.[0-9][0-9]*.*/s//\1/p;q'`
  else
    MAJOR_NO=
  fi
fi
if test -z "$MINOR_NO"; then
  if test -n "$VERSION"; then \
    MINOR_NO=`echo $VERSON |
      sed -n '/^[0-9][0-9]*\.\([0-9][0-9]*\).*/s//\1/p;q'`
  else
    MINOR_NO=
  fi
fi


if test -s conf.missing; then
  cat << CAT_EOF

$0: The following variables need values.  They may be set in
the environment or in the file CUSTOMIZE.  Variables referring to
executable programs needn't be set if the relevant directory is added to
PATH.  In any case, ./configure should probably be rerun.  See file INSTALL
for details.

CAT_EOF
  awk -F: 'BEGIN {printf "%-13s%-27s%s\n", "VARIABLE", "MEANING", "EXAMPLE";
	          printf "%-13s%-27s%s\n", "--------", "-------", "-------"}
	         {printf "%-13s%-27s%s\n", $1, $2, $3}' conf.missing
  rm conf.missing
  exit 1
fi
rm -f conf.missing


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

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

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

trap 'rm -f \
    Makefile \
    port/Makefile \
    port/master.mk \
    port/fortc/Makefile \
    src/Makefile \
    src/lib/Makefile \
    src/lib/cgm/Makefile \
    src/lib/gksm/Makefile \
    src/lib/x/Makefile \
    src/fortran/Makefile \
    fontdb/Makefile \
    doc/binding/Makefile \
    doc/userdoc/Makefile \
    doc/Makefile \
    progs/Makefile \
 port/udposix.h conftest*; exit 1' 1 3 15
PORT_MANIFEST='$PORT_MANIFEST'
CPPFLAGS='$CPPFLAGS'
CFLAGS='$CFLAGS'
FFLAGS='$FFLAGS'
OS='$OS'
LIBOBJS='$LIBOBJS'
PORT_HEADERS='$PORT_HEADERS'
PORT_SUBDIRS='$PORT_SUBDIRS'
CC='$CC'
AR='$AR'
RANLIB='$RANLIB'
prefix='$prefix'
exec_prefix='$exec_prefix'
FC='$FC'
CPP='$CPP'
NEQN='$NEQN'
TBL='$TBL'
TROFF='$TROFF'
INSTALL='$INSTALL'
INSTALL_PROGRAM='$INSTALL_PROGRAM'
INSTALL_DATA='$INSTALL_DATA'
FORTC='$FORTC'
NEED_FORTC='$NEED_FORTC'
CPP_X11='$CPP_X11'
LD_X11='$LD_X11'
FTPDIR='$FTPDIR'
VERSION='$VERSION'
MAJOR_NO='$MAJOR_NO'
MINOR_NO='$MINOR_NO'
LIBS='$LIBS'
srcdir='$srcdir'
prefix='$prefix'
exec_prefix='$exec_prefix'
prsub='$prsub'
EOF
cat >> config.status <<\EOF

top_srcdir=$srcdir
for file in .. \
    Makefile \
    port/Makefile \
    port/master.mk \
    port/fortc/Makefile \
    src/Makefile \
    src/lib/Makefile \
    src/lib/cgm/Makefile \
    src/lib/gksm/Makefile \
    src/lib/x/Makefile \
    src/fortran/Makefile \
    fontdb/Makefile \
    doc/binding/Makefile \
    doc/userdoc/Makefile \
    doc/Makefile \
    progs/Makefile \
; do if [ "x$file" != "x.." ]; then
  srcdir=$top_srcdir
  # Remove last slash and all that follows it.  Not all systems have dirname.
  dir=`echo $file|sed 's%/[^/][^/]*$%%'`
  if test "$dir" != "$file"; then
    test "$top_srcdir" != . && srcdir=$top_srcdir/$dir
    test ! -d $dir && mkdir $dir
  fi
  echo creating $file
  rm -f $file
  echo "# Generated automatically from `echo $file|sed 's|.*/||'`.in by configure." > $file
  sed -e "
$prsub
s%@PORT_MANIFEST@%$PORT_MANIFEST%g
s%@CPPFLAGS@%$CPPFLAGS%g
s%@CFLAGS@%$CFLAGS%g
s%@FFLAGS@%$FFLAGS%g
s%@OS@%$OS%g
s%@LIBOBJS@%$LIBOBJS%g
s%@PORT_HEADERS@%$PORT_HEADERS%g
s%@PORT_SUBDIRS@%$PORT_SUBDIRS%g
s%@CC@%$CC%g
s%@AR@%$AR%g
s%@RANLIB@%$RANLIB%g
s%@prefix@%$prefix%g
s%@exec_prefix@%$exec_prefix%g
s%@FC@%$FC%g
s%@CPP@%$CPP%g
s%@NEQN@%$NEQN%g
s%@TBL@%$TBL%g
s%@TROFF@%$TROFF%g
s%@INSTALL@%$INSTALL%g
s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
s%@INSTALL_DATA@%$INSTALL_DATA%g
s%@FORTC@%$FORTC%g
s%@NEED_FORTC@%$NEED_FORTC%g
s%@CPP_X11@%$CPP_X11%g
s%@LD_X11@%$LD_X11%g
s%@FTPDIR@%$FTPDIR%g
s%@VERSION@%$VERSION%g
s%@MAJOR_NO@%$MAJOR_NO%g
s%@MINOR_NO@%$MINOR_NO%g
s%@LIBS@%$LIBS%g
s%@srcdir@%$srcdir%g
s%@DEFS@%-DHAVE_CONFIG_H%" $top_srcdir/${file}.in >> $file
fi; done

echo creating port/udposix.h
# These sed commands are put into SEDDEFS when defining a macro.
# They are broken into pieces to make the sed script easier to manage.
# They are passed to sed as "A NAME B NAME C VALUE D", where NAME
# is the cpp macro being defined and VALUE is the value it is being given.
# Each defining turns into a single global substitution command.
#
# SEDd sets the value in "#define NAME VALUE" lines.
SEDdA='s@^\([ 	]*\)#\([ 	]*define[ 	][ 	]*\)'
SEDdB='\([ 	][ 	]*\)[^ 	]*@\1#\2'
SEDdC='\3'
SEDdD='@g'
# SEDu turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
SEDuA='s@^\([ 	]*\)#\([ 	]*\)undef\([ 	][ 	]*\)'
SEDuB='\([ 	]\)@\1#\2define\3'
SEDuC=' '
SEDuD='\4@g'
# SEDe turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
SEDeA='s@^\([ 	]*\)#\([ 	]*\)undef\([ 	][ 	]*\)'
SEDeB='$@\1#\2define\3'
SEDeC=' '
SEDeD='@g'
rm -f conftest.sed
cat > conftest.sed <<CONFEOF
EOF
# Turn off quoting long enough to insert the sed commands.
cat >> config.status <<EOF
$SEDDEFS
EOF
cat >> config.status <<\EOF
CONFEOF
rm -f conftest.h
# Break up the sed commands because old seds have small limits.
cp $top_srcdir/port/udposix.h.in conftest.h1
while :
do
  lines=`grep -c . conftest.sed`
  if test -z "$lines" || test "$lines" -eq 0; then break; fi
  rm -f conftest.s1 conftest.s2 conftest.h2
  sed 40q conftest.sed > conftest.s1 # Like head -40.
  sed 1,40d conftest.sed > conftest.s2 # Like tail +41.
  sed -f conftest.s1 < conftest.h1 > conftest.h2
  rm -f conftest.s1 conftest.h1 conftest.sed
  mv conftest.h2 conftest.h1
  mv conftest.s2 conftest.sed
done
rm -f conftest.sed conftest.h
echo "/* port/udposix.h.  Generated automatically by configure.  */" > conftest.h
cat conftest.h1 >> conftest.h
rm -f conftest.h1
if cmp -s port/udposix.h conftest.h 2>/dev/null; then
  # The file exists and we would not be changing it.
  rm -f conftest.h
else
  rm -f port/udposix.h
  mv conftest.h port/udposix.h
fi

EOF

#
# Under CYGWIN B.20, gcc -E incorrectly spits out //C:/ instead of //C/
#
if test "$OS" = "cygwin"; then
    mv config.status config.status.$$
    sed '1,$s,\(//[A-Z]\):,\1,g' config.status.$$ > config.status
    rm -f config.status.$$
fi    

chmod +x config.status
test -n "$no_create" || ./config.status
if test -s conf.missing; then
  cat << CAT_EOF

$0: The following variables need values.  They may be set in
the environment or in the file CUSTOMIZE.  Variables referring to
executable programs needn't be set if the relevant directory is added to
PATH.  In any case, ./configure should probably be rerun.  See file INSTALL
for details.

CAT_EOF
  awk -F: 'BEGIN {printf "%-13s%-27s%s\n", "VARIABLE", "MEANING", "EXAMPLE";
	          printf "%-13s%-27s%s\n", "--------", "-------", "-------"}
	         {printf "%-13s%-27s%s\n", $1, $2, $3}' conf.missing
  rm conf.missing
  exit 1
fi
rm -f conf.missing
 # Post process any makefiles.
#
# Create a script to accomplish the post processing.
#
cat << \EOF_CONFTEST_SH > conftest.sh
cat << \EOF_CONFTEST_C > conftest.c
#include <stdio.h>
main()
{
    return readsub((char*)NULL) ? 0 : 1;
}
readsub(inpath)
    char	*inpath;
{
    char	buf[2048], path[1024];
    FILE	*fp	= inpath == NULL
				? stdin
				: fopen(inpath, "r");
    if (fp == NULL) {
	(void) perror(inpath);
	return 0;
    }
    buf[sizeof(buf)-1]	= 0;
    while (fgets(buf, sizeof(buf), fp) != NULL) {
	if (sscanf(buf, "include%*[] \t[]%s", path) == 1) {
	    if (!readsub(path))
		return 0;
	} else {
	    (void) fputs(buf, stdout);
	}
    }
    return 1;
}
EOF_CONFTEST_C
if $CC -o conftest conftest.c; then
    conftest=`pwd`/conftest
    set \
    Makefile \
    port/Makefile \
    port/master.mk \
    port/fortc/Makefile \
    src/Makefile \
    src/lib/Makefile \
    src/lib/cgm/Makefile \
    src/lib/gksm/Makefile \
    src/lib/x/Makefile \
    src/fortran/Makefile \
    fontdb/Makefile \
    doc/binding/Makefile \
    doc/userdoc/Makefile \
    doc/Makefile \
    progs/Makefile \

    for file do
      echo post processing makefile \`$file\'
      sd=`pwd`/`echo $file | sed 's,[^/]*$,,'`
      base=`basename $file`
      (cd $sd; $conftest < $base > conftest.mk && mv conftest.mk $base)
    done
fi
rm conftest conftest.c
EOF_CONFTEST_SH
#
# Append the above script to the output-script file, config.status, so that 
# invoking that file will also do the post processing.  Note that the 
# output-script file will be invoked by ./configure before the post-
# processing code is appended.
#
cat conftest.sh >> config.status
#
# If appropriate, do the postprocessing now because the previous step 
# couldn't.
#
test -n "$no_create" || CC=$CC sh conftest.sh
rm conftest.sh
 
