#MIN_CONFIG

AM_INIT_AUTOMAKE(kotest, 0.1)

AC_CHECK_HEADERS(unistd.h sys/param.h floatingpoint.h paths.h)
KDE_CHECK_KIMGIO
AC_C_BIGENDIAN
AC_CHECK_KDEMAXPATHLEN

dnl AC_DEFINE(USE_QFD, 1, [Define if you prefer the Qt provided file dialog])
KWMF_INCLUDES='-I$(KDEDIR)/lib/kwmf -I$(KDEDIR)/lib/kwmf'
AC_SUBST(KWMF_INCLUDES)

KSTORE_INCLUDES='-I$(KDEDIR)/include/kde'
AC_SUBST(KSTORE_INCLUDES)

KOFFICECORE_INCLUDES='-I$(KDEDIR)/include/kde'
AC_SUBST(KOFFICECORE_INCLUDES)

KOFFICEUI_INCLUDES='-I$(KDEDIR)/include/kde'
AC_SUBST(KOFFICEUI_INCLUDES)

LIB_KOFFICEUI='$(KDEDIR)/lib/libkofficeui.la'
LIB_KOFFICECORE='$(KDEDIR)/lib/libkofficecore.la'
LIB_KSTORE='$(KDEDIR)/lib/libkstore.la'
LIB_KWMF='$(KDEDIR)/lib/libkwmf.la'
AC_SUBST(LIB_KOFFICEUI)
AC_SUBST(LIB_KOFFICECORE)
AC_SUBST(LIB_KSTORE)
AC_SUBST(LIB_KWMF)

KOFFICE_LIBS='$(LIB_KOFFICEUI) $(LIB_KOFFICECORE) $(LIB_KSTORE)'
AC_SUBST(KOFFICE_LIBS)

KOFFICE_INCLUDES='$(KOFFICEUI_INCLUDES) $(KOFFICECORE_INCLUDES) $(KSTORE_INCLUDES) $(KWMF_INCLUDES)'
AC_SUBST(KOFFICE_INCLUDES)

AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_CHECK_HEADERS(streambuf streambuf.h)
AC_LANG_RESTORE

dnl only use kdeprint if kprinter.h was found (recent kdelibs)
AC_MSG_CHECKING([for kprinter.h (kdelibs>2.1)])
AC_FIND_FILE(kprinter.h, $kde_includes, ac_kprinter_includes)

if test -n "$ac_kprinter_includes" && test -r "$ac_kprinter_includes/kprinter.h"; then
  AC_DEFINE(HAVE_KDEPRINT, 1, [Define if you have kprinter.h])
  LIB_KDEPRINT=-lkdeprint
  AC_MSG_RESULT([found in $ac_kprinter_includes])
else
  LIB_KDEPRINT=
  AC_MSG_RESULT([not found -- QPrinter will be used instead])
fi
AC_SUBST(LIB_KDEPRINT)
AC_DEFINE(HAVE_KDEPRINT_TESTED, 1, [Define if kdeprint was tested])
