AC_INIT(texk/klibtool)

AC_CONFIG_AUX_DIR(texk)
AC_SET_MAKE
AC_PROG_CC
AC_CANONICAL_SYSTEM

dnl Various compiler directives
case "$target" in
    alpha*-dec*)
        if test "$CC" = "cc"; then
          CFLAGS="$CFLAGS -Olimit 1000 -std1"; export CFLAGS
          AC_MSG_WARN(Adding extra compiler directives for Digital Unix)
        fi
        ;;
    hp*)
        if test "$CC" = "cc"; then
          CFLAGS="$CFLAGS -Aa +e -D_HPUX_SOURCE +u -Dunix"; export CFLAGS
          AC_MSG_WARN(Adding extra compiler directives for HP-UX)
        fi
        ;;
esac

AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_PROG_LN_S
AC_FUNC_ALLOCA

sinclude(withenable.ac)
sinclude(dialog/withenable.ac)
sinclude(texk/withenable.ac)
sinclude(texk/kpathsea/withenable.ac)
sinclude(texk/kpathsea/xt.ac)
sinclude(texk/web2c/withenable.ac)
sinclude(texk/xdvik/withenable.ac)
sinclude(texk/libwww/withenable.ac)

if test "${enable_multiplatform+set}" != set \
  && test "x$bindir" = 'x${exec_prefix}/bin'
then
  enable_multiplatform=yes; export enable_multiplatform
  bindir="$bindir/$host";
fi
test "${enable_nls+set}" = set || { enable_nls=no; export enable_nls; }

AC_PREFIX_DEFAULT(/usr/local/teTeX)
test "x$prefix" = xNONE \
  && ac_configure_args="$ac_configure_args --prefix=$ac_default_prefix"

case "$target" in
  *nextstep3*|*NEXTSTEP*)
     with_xdvik=no; with_oxdvik=no; enable_ipc=yes
     with_nextwin=yes; with_ps=dps
     export with_xdvik with_oxdvik enable_ipc with_nextwin with_ps;;
esac

ESUBDIRS=
DSUBDIRS=
for pkg in texinfo dialog; do
  if eval "test \"`echo '$with_'${pkg}`\" != no"; then
    ESUBDIRS="$ESUBDIRS $pkg"
  else
    DSUBDIRS="$DSUBDIRS $pkg"
  fi
done

AC_SUBST(ESUBDIRS)
AC_SUBST(DSUBDIRS)

AC_CONFIG_SUBDIRS(dialog texinfo texk)

AC_OUTPUT(Makefile)
