dnl ==========================
dnl checks for Hadifix plug in
dnl ==========================

AC_ARG_ENABLE(kttsd-hadifix,
              AC_HELP_STRING([--enable-kttsd-hadifix],
                             [build KTTSD Hadifix Plugin [default=yes]]),
              hadifix_plugin=$enableval,
              hadifix_plugin=yes)

compile_hadifix_plugin="no"

if test "x$hadifix_plugin" = "xyes"; then
  compile_hadifix_plugin="yes"
fi

if test "x$compile_hadifix_plugin" = "xyes"; then
  dnl Check for Hadifix installation.
  dnl Note that Hadifix plugin is always built,
  dnl unless user overrides with -disable-kttsd-hadifix.
  AC_PATH_PROG(hadifix_mbrola_bin,  "mbrola",  "no", [$PATH:])
  AC_PATH_PROG(hadifix_txt2pho_bin, "txt2pho", "no", [$PATH:])

  hadifix_inst="yes"
  if test "x$hadifix_mbrola_bin" = "xno"; then
    hadifix_inst="no"
  fi
  if test "x$hadifix_txt2pho_bin" = "xno"; then
    hadifix_inst="no"
  fi

  if test "x$hadifix_inst" = "xyes"; then
    AC_CHECK_FILE(/etc/txt2pho, [hadifix_txt2pho="yes"], [hadifix_txt2pho="no"])
  fi
fi

AM_CONDITIONAL(include_kttsd_hadifix, test "x$compile_hadifix_plugin" = "xyes")
