dnl ------------------------------------------------------------------------
dnl Try to find if FAM is installed
dnl ------------------------------------------------------------------------
dnl
kde_have_fam=yes
AC_ARG_ENABLE(libfam, [  --disable-libfam        don't search for libfam and do not use it],
[ kde_have_fam=$enableval ], [])dnl

dnl Bloody libfam is C++ and certainly compiled by GNU C++.  This means,
dnl we can't use it, when compiling with another C++ compiler, as the
dnl runtime systems would conflict (e.g. in KAI C++) (matz)
test "$GXX" = yes || kde_have_fam=no

if test "$kde_have_fam" = "yes" ; then
  AC_LANG_SAVE
  AC_LANG_CPLUSPLUS
  KDE_CHECK_LIB(fam, FAMOpen, [LIBFAM="-lfam"; kde_have_fam=yes],kde_have_fam=no)
  if test $kde_have_fam = yes; then
    AC_DEFINE_UNQUOTED(HAVE_FAM, 1, [Define if your system has libfam])
  fi
  AC_LANG_RESTORE
fi
AC_SUBST(LIBFAM)
dnl ------------------------------------------------------------------------
dnl Try to find if LIBZ is installed
dnl ------------------------------------------------------------------------
dnl

AC_FIND_ZLIB

AC_CHECK_HEADERS(sys/mnttab.h mntent.h fstab.h sys/ucred.h sys/mount.h)
AC_CHECK_FUNCS(setmntent getmntinfo)

AH_VERBATIM(_GETMNTINFO, [
#ifdef __osf__
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/mount.h>
int getmntinfo(struct statfs **mntbufp, int flags);
#include <sys/fs_types.h>    /* for mnt_names[] */
#ifdef __cplusplus
}
#endif
#endif
])

dnl ------------------------------------------------------------------------
dnl Try to find if libvolmgt is installed (Solaris)
dnl ------------------------------------------------------------------------
kde_have_volmgt=yes
AC_CHECK_LIB(volmgt, volmgt_running, [LIBVOLMGT=-lvolmgt], kde_have_volmgt=no)
AC_SUBST(LIBVOLMGT)
if test "$kde_have_volmgt" = "yes"; then
  AC_DEFINE_UNQUOTED(HAVE_VOLMGT, 1, [Define, to enable volume management (Solaris 2.x), if you have -lvolmgt])
fi

dnl ------------------------------------------------------------------------
dnl Try to find if we have Linux Dir Notification
dnl ------------------------------------------------------------------------

AC_ARG_ENABLE(dnotify, [  --enable-dnotify        enable use of Linux directory notifications],
[ kde_enable_dnotify=$enableval ], [])dnl

AC_CHECK_GNU_EXTENSIONS

if test "x$kde_enable_dnotify" = "xyes"; then
  AC_MSG_CHECKING([for Linux Directory Notification])
  AC_CACHE_VAL(kde_cv_have_dnotify,
  [
  kde_cv_have_dnotify=no
  AC_LANG_SAVE
  AC_LANG_C

  AC_TRY_COMPILE(
  [
#include <fcntl.h>
#include <signal.h>
  ],
  [
#ifndef F_NOTIFY
#error no dir notification
#endif
    int fd;
    siginfo_t *t = 0;

    fcntl(fd, F_SETSIG, SIGRTMIN);
    fcntl(fd, F_NOTIFY, DN_DELETE|DN_CREATE|DN_MULTISHOT);

  ],kde_cv_have_dnotify=yes)

  AC_LANG_RESTORE
  ])

  if test "$kde_cv_have_dnotify" = "yes" ; then
    AC_DEFINE_UNQUOTED(HAVE_DNOTIFY, 1, [Define if your system has Linux Directory Notification])
    AC_MSG_RESULT(yes)
  else
    AC_MSG_RESULT(no)
  fi
fi
