dnl +-------------------------------+
dnl |   Checks for LIBWORKMAN       |
dnl +-------------------------------+
AC_MSG_CHECKING(for CDDA)

AC_ARG_WITH(kscd-cdda, [  --with-kscd-cdda             build CDDA support in kscd [default=yes]],
[
  if test $withval = yes; then
    libwm_with_cdda=yes
  else
    libwm_with_cdda=no
  fi
],libwm_with_cdda=yes)

if test "$libwm_with_cdda" = "yes"; then
case $host in
  *-*-linux*)
  AC_CHECK_HEADERS(pthread.h)
  AC_TRY_COMPILE(
  [
#ifndef __GNUC__
#define __GNUC__ 1
#endif
/* needed for vanilla kernel headers, which do provide __u64 only
   for ansi */
#undef __STRICT_ANSI__
/* needed for non-ansi kernel headers */
#define asm __asm__
#define inline __inline__
#include <linux/types.h>
#include <linux/cdrom.h>
#undef asm
#undef inline
  ],[
#if defined(__linux__)
ioctl(1, CDROMREADAUDIO, 0);
#else
  #error platform?
#endif
  ],, libwm_with_cdda=no)
  ;;
  *-*-sunos*)
  AC_CHECK_HEADERS(pthread.h)
  AC_TRY_COMPILE(
  [
#include <sys/types.h>
#include <sys/cdio.h>
  ],[
#if defined(__sun) || defined(sun)
ioctl(1, CDROMCDDA, 0);
#else
  #error platform?
#endif
  ],, libwm_with_cdda=no)
  ;;
  *)
      libwm_with_cdda=no
  ;;
esac
fi

if test "$libwm_with_cdda" = "yes"; then
    AC_DEFINE(BUILD_CDDA, 1, [Define if you will CDDA support in kscd])
fi
AM_CONDITIONAL(libwm_with_cdda, test "$libwm_with_cdda" = "yes")

AC_MSG_RESULT($libwm_with_cdda)


dnl +-------------------------------+
dnl | End LIBWORKMAN checks         |
dnl +-------------------------------+
