
##################################################################
## 
##    kdetv configure script
##    George Staikos <staikos@kde.org>
##
##################################################################

AC_HAVE_GL

dnl ---------------------------------------------------------------------
dnl XVideo extension
    KDE_CHECK_LIB(Xv, XvQueryExtension, 
        KDETV_LIBS="-lXv $KDETV_LIBS",, 
        -L/usr/X11R6/lib $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)

dnl ---------------------------------------------------------------------
dnl XVideo Motion Compensation extension
    KDE_CHECK_LIB(XvMC, XvMCQueryExtension, 
        KDETV_LIBS="-lXvMC $KDETV_LIBS",, 
        -L/usr/X11R6/lib $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)


dnl ---------------------------------------------------------------------
dnl Other X extensions

    KDE_CHECK_LIB(Xxf86dga, XF86DGAQueryExtension, 
        KDETV_LIBS="-lXxf86dga $KDETV_LIBS",,
        -L/usr/X11R6/lib $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)
    KDE_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension,
        KDETV_LIBS="-lXxf86vm $KDETV_LIBS",,
        -L/usr/X11R6/lib $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)
dnl Check for dpms - we check for the existence of the header, because in XFree 4.x
dnl DPMSQueryExtension is included in Xlib
    have_xdpms=no
    AC_CHECK_HEADER(X11/extensions/dpms.h,
		     AC_DEFINE(HAVE_XDPMS, 1, [If we have xdpms])
		     have_xdpms=yes
		     ,,[#include <X11/Xlib.h>])
    have_xshm=no
    AC_CHECK_HEADER(X11/extensions/XShm.h,
		     AC_DEFINE(HAVE_XSHM, 1, [If we have xshm])
		     have_xshm=yes
		     ,,[#include <X11/Xlib.h>])
    KDE_CHECK_LIB(Xdpms, DPMSQueryExtension,
        KDETV_LIBS="-lXdpms $KDETV_LIBS",,
        -L/usr/X11R6/lib $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)

    KDE_CHECK_LIB(Xinerama, XineramaQueryExtension,
        KDETV_LIBS="-lXinerama $KDETV_LIBS",,
        -L/usr/X11R6/lib $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)

AC_SUBST(KDETV_LIBS)

if test $ac_cv_lib_Xxf86dga_XF86DGAQueryExtension = yes; then
  AC_DEFINE(HAVE_XDGA, 1, [If we have the X11 DGA extension])
fi

if test $ac_cv_lib_Xv_XvQueryExtension = yes; then
  AC_DEFINE(HAVE_LIBXV, 1, [If we have the XVideo extension])
fi

if test $ac_cv_lib_XvMC_XvMCQueryExtension = yes; then
  AC_DEFINE(HAVE_LIBXVMC, 1, [If we have the XVideo Motion Compensation extension])
fi

dnl ---------------------------------------------------------------------
dnl Check for Linux
AC_CHECK_HEADER(linux/vt.h,,DO_NOT_COMPILE="kdetv $DO_NOT_COMPILE")

dnl ---------------------------------------------------------------------
dnl Check for LIRC client support

LIB_LIRC_KDETV=
AC_ARG_ENABLE(kdetv-lirc, AC_HELP_STRING([--enable-kdetv-lirc],
	      [enable use of lirc in kdetv (disabled)]),
[
 if test "$enableval" = yes ; then
   have_lirc=yes
   KDE_CHECK_LIB(lirc_client,lirc_init,,have_lirc=no)
   if test "$have_lirc" = "yes"; then
     KDE_CHECK_HEADER(lirc/lirc_client.h,,have_lirc=no)
   fi

   if test "$have_lirc" = "yes"; then
     AC_DEFINE(HAVE_LIRC_KDETV, 1,
	       [Define this if lirc client library is available and should be used])
     LIB_LIRC_KDETV="-llirc_client"
   fi
 fi
])
AC_SUBST(LIB_LIRC_KDETV)

CXXFLAGS="$CXXFLAGS $KDE_DEFAULT_CXXFLAGS"
