configure.ac: pass kernel source path
[glsdk/omapdrmtest.git] / configure.ac
index 06a930f36f04f5620e03a2e8e94ee38b68f9bf2b..217126bb9cdb9cae02c3df6caab938685985b246 100644 (file)
@@ -34,8 +34,38 @@ AC_PROG_LIBTOOL
 # Obtain compiler/linker options for depedencies
 PKG_CHECK_MODULES(DRM, libdrm libdrm_omap)
 
+# Check for kernel headers
+kversion=`uname -r`
+AC_ARG_WITH([kernel-source],
+            [AS_HELP_STRING([--with-kernel-source],
+              [specify pavth to linux kernel source])],
+           [kernel_source="$with_kernel_source"],
+           [kernel_source="/usr/src/linux-headers-$kversion"])
+
+if test -r "$kernel_source/include/linux/videodev2.h"; then
+    headers_cflags="$headers_cflags -I$kernel_source/include"
+
+    AC_SUBST(CFLAGS, [$headers_cflags])
+    AC_MSG_NOTICE([$kversion provides videodev2.h])
+else
+    AC_MSG_NOTICE([Could not find $kernel_source/include/linux/videodev2.h])
+fi
+
+# Check for v4l2 dmabuf support:
+AC_CHECK_MEMBER([struct v4l2_buffer.m.fd],
+       [HAVE_V4L2_DMABUF=yes],
+       [HAVE_V4L2_DMABUF=no],
+       [[#include <linux/videodev2.h>]])
+if test "x$HAVE_V4L2_DMABUF" = "xyes"; then
+       AC_DEFINE(HAVE_V4L2_DMABUF, 1, [Have V4L2 DMABUF support])
+       AC_MSG_NOTICE([V4L2 DMABUF support detected])
+else
+       AC_MSG_WARN([No V4L2 DMABUF support detected, disabling V4L2 DMABUF tests])
+fi
+AM_CONDITIONAL(ENABLE_V4L2_DMABUF, [test "x$HAVE_V4L2_DMABUF" = xyes])
+
 # Check optional X11:
-PKG_CHECK_MODULES(X11, x11 libdri2, [HAVE_X11=yes], [HAVE_X11=no])
+PKG_CHECK_MODULES(X11, x11 dri2, [HAVE_X11=yes], [HAVE_X11=no])
 if test "x$HAVE_X11" = "xyes"; then
        AC_DEFINE(HAVE_X11, 1, [Have X11 support])
 else