disp_open: do not crash on error
[glsdk/omapdrmtest.git] / configure.ac
index cf426df46c82054860f0c9de0a29ac450e223e63..4432cb4fcddc3a560bca2766a5f62160343bff07 100644 (file)
@@ -36,13 +36,19 @@ PKG_CHECK_MODULES(DRM, libdrm libdrm_omap)
 
 # Check for kernel headers
 kversion=`uname -r`
-if test -r "/usr/src/linux-headers-$kversion/include/linux/videodev2.h"; then
-    headers_cflags="$headers_cflags -I/usr/src/linux-headers-$kversion/include"
+AC_ARG_WITH([kernel-source],
+            [AS_HELP_STRING([--with-kernel-source],
+              [specify path to linux kernel source])],
+           [kernel_source="$with_kernel_source"],
+           [kernel_source="/usr/src/linux-headers-$kversion"])
 
-    AC_SUBST(CFLAGS, [$headers_cflags])
+if test -r "$kernel_source/include/linux/videodev2.h"; then
+    headers_cflags="$headers_cflags -I$kernel_source/include"
+
+    AC_SUBST(LIN_CFLAGS, [$headers_cflags])
     AC_MSG_NOTICE([$kversion provides videodev2.h])
 else
-    AC_MSG_NOTICE([Could not find /usr/src/linux-headers-$kversion/include/linux/videodev2.h])
+    AC_MSG_NOTICE([Could not find $kernel_source/include/linux/videodev2.h])
 fi
 
 # Check for v4l2 dmabuf support:
@@ -59,7 +65,8 @@ fi
 AM_CONDITIONAL(ENABLE_V4L2_DMABUF, [test "x$HAVE_V4L2_DMABUF" = xyes])
 
 # Check optional X11:
-PKG_CHECK_MODULES(X11, x11 dri2, [HAVE_X11=yes], [HAVE_X11=no])
+AC_ARG_ENABLE([x11], AS_HELP_STRING([--disable-x11], [disable x11/dri2video support]))
+AS_IF([test "x$enable_x11" != "xno"], [PKG_CHECK_MODULES(X11, x11 dri2, [HAVE_X11=yes])])
 if test "x$HAVE_X11" = "xyes"; then
        AC_DEFINE(HAVE_X11, 1, [Have X11 support])
 else