dnl
dnl  Configuration input file for Harvest uses autoconf 1.11.
dnl
dnl  Darren Hardy, hardy@cs.colorado.edu, July 1994
dnl
dnl  configure.in,v 1.6 1995/10/24 21:59:43 duane Exp
dnl
AC_INIT(Makefile.in)
AC_REVISION(1.6)dnl
AC_PREFIX_DEFAULT(/usr/local/harvest)

dnl Build a copy of prefix

if test -n "$prefix"; then
  myprefix="$prefix";
else
  myprefix='/usr/local/harvest';
fi

INSTALL_TOPDIR="$myprefix";
INSTALL_LIBDIR="$myprefix/lib";
INSTALL_BINDIR="$myprefix/bin";
INSTALL_MANDIR="$myprefix/man";

THIS_HOST="`hostname`"
XTRA_LIBS=''

dnl Subsitutions
AC_SUBST(INSTALL_TOPDIR)
AC_SUBST(INSTALL_LIBDIR)
AC_SUBST(INSTALL_BINDIR)
AC_SUBST(INSTALL_MANDIR)
AC_SUBST(THIS_HOST)

dnl Check for GNU cc
AC_PROG_CC

dnl Check for programs
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_RANLIB
AC_PROG_YACC
AC_PROG_LEX
AC_PROG_LN_S
AC_PATH_PROG(CMD_GZIP, gzip, /bin/false)
AC_PATH_PROG(CMD_GUNZIP, gunzip, /bin/false)
AC_PATH_PROG(CMD_PERL, perl, /bin/false)

dnl Set PERL too
PERL="$CMD_PERL"
AC_SUBST(PERL)

dnl Decide if we should really use -lmalloc.  It is known to have
dnl problems on SunOS 5.4 at least.
dnl
if test -x "/bin/uname"; then
        if /bin/uname -sr | grep ['SunOS 5.[0-4]'] >/dev/null 2>&1; then
                NO_LIBMALLOC=x
        fi
fi

dnl Check for needed libraries
AC_CHECK_LIB(resolv, main, [XTRA_LIBS="$XTRA_LIBS -lresolv"])
AC_CHECK_LIB(socket, main, [XTRA_LIBS="$XTRA_LIBS -lsocket"])
if test x$NO_LIBMALLOC = x ; then
	AC_CHECK_LIB(malloc, main, [XTRA_LIBS="$XTRA_LIBS -lmalloc"])
fi
AC_CHECK_LIB(nsl, main, [XTRA_LIBS="$XTRA_LIBS -lnsl"])

dnl Override XTRA_LIBS
if test -n "$XTRA_LIBS_OVERRIDE"; then
  XTRA_LIBS="$XTRA_LIBS_OVERRIDE";
fi
AC_SUBST(XTRA_LIBS)

dnl Set DEBUG_TOP
if test -z "$DEBUG_TOP"; then
    DEBUG_TOP='#-O #-g #-DDEBUG'
fi
AC_SUBST(DEBUG_TOP)

dnl Clean up after OSF/1 core dump bug
rm -f core 

AC_OUTPUT(\
	Makefile \
	SGML/Makefile \
	SGML/sgmls/Makefile \
	dvi2tty/Makefile \
	ps2txt/Makefile \
	pstext/libs/Makefile \
	pstext/libs/src/sio/Makefile \
	pstext/libs/src/Makefile \
	pstext/libs/src/str/Makefile \
	pstext/Makefile \
	pstext/pstext/Makefile \
	skim/Makefile \
	summarizers/Makefile \
	support/Makefile \
	unbinhex/Makefile \
        unbinhex/crc/Makefile \
        unbinhex/fileio/Makefile \
        unbinhex/util/Makefile \
        unbinhex/hexbin/Makefile \
)
