dnl AC_SEARCH_LIBS(pgm2asc,Pgm2asc)
dnl AC_CHECK_LIB(Pgm2asc,pgm2asc)
dnl should define HAVE_LIBPGM2ASC if available

AC_ARG_WITH([kadmos],
  [AC_HELP_STRING([--with-kadmos],
    [Enable the kadmos OCR engine @<:@default=check@:>@])],
  [], with_kadmos=check)

AC_ARG_WITH([kadmos-dir],
  AC_HELP_STRING([--with-kadmos-dir],
    [sets the path to the kadmos engine @<:@default=/usr/local@:>@]),
  [ac_kadmos_value=$withval], [ac_kadmos_value=/usr/local])

KADMOS_INC=
KADMOS_LIB=

if test "x$with_kadmos" != xno; then
	if test -r "$ac_kadmos_value/kadmos.h"; then
		KADMOS_INC="-I$ac_kadmos_value"
		KADMOS_LIB="$ac_kadmos_value/librep.a"
		AC_DEFINE_UNQUOTED(HAVE_KADMOS, 1, [Defines if your system has the kadmos libraries])
	else
		AC_MSG_WARN([couldn't find kadmos engine header file under $ac_kadmos_value/kadmos.h])
	fi

	if test "x$with_kadmos" != xcheck && test -z "$KADMOS_LIB"; then
		AC_MSG_ERROR([--with-kadmos was given, but test for kadmos failed])
	fi
fi

AC_SUBST(KADMOS_LIB)
AC_SUBST(KADMOS_INC)
