AC_INIT(thai.alias)
AM_INIT_AUTOMAKE(thaixfonts, 1.2.5)

AC_PROG_INSTALL
AC_PROG_LN_S
AC_CHECK_PROGS(RMDIR,rmdir,no)

AC_CHECK_PROGS(SED,sed,no)
if test "x$SED" = "xno" ; then
  AC_MSG_ERROR([You need sed (from sed distribution)])
fi
AC_CHECK_PROGS(BDFTOPCF,bdftopcf,no)
if test "x$BDFTOPCF" = "xno" ; then
  AC_MSG_ERROR([You need bdftopcf (from X Window System)])
fi
AC_CHECK_PROGS(MKFONTDIR,mkfontdir,no)
if test "x$MKFONTDIR" = "xno" ; then
  AC_MSG_ERROR([You need mkfontdir (from X Window System)])
fi
AC_CHECK_PROGS(GZIP,gzip,no)
if test "x$GZIP" = "xno" ; then
  AC_MSG_ERROR([You need gzip (from gzip distribution)])
fi

AC_ARG_WITH(fontdir,
  [AC_HELP_STRING([--with-fontdir=DIR],
                  [font directory in DIR [PREFIX/share/fonts/X11/misc]])],
  [fontdir="$withval"], [fontdir=\$\{prefix\}/share/fonts/X11/misc])
AC_MSG_CHECKING(--with-fontdir)
AC_MSG_RESULT("$fontdir")                                                                                                           
AC_SUBST(fontdir)

MRULE=$srcdir/Make.rule
AC_SUBST_FILE(MRULE)

AC_OUTPUT(
  Makefile
  etlthai/Makefile
  manop/Makefile
  nectec/Makefile
  poonlap/Makefile
  yenbut/Makefile
  thaixfonts.spec
)

