[Xorg-driver-geode] [PATCH 3/3] Add a configure option to enable/disable building the ztv driver

Gaetan Nadon memsize at videotron.ca
Wed Nov 16 11:58:55 PST 2011


Even when V4L2 is available there are always reasons why distros
may not want to build the driver.

This patch uses a common idiom in xorg.
When no configure option is specified ztv is built iff v4l2 is detected (auto).
When user issues --disable-ztv, the ztv driver is not built (no)
When user issues --enable-ztv, the ztv driver is built (yes) if v4l2 is detected
but the configuration fails if v4l2 is missing. Distros do not want silent
failures when a feature is explicitly requested but cannot be built.

Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
---
 configure.ac |   25 +++++++++++++++++++++----
 1 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/configure.ac b/configure.ac
index 3c28bb0..efe75d5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -70,6 +70,27 @@ AC_ARG_ENABLE(visibility,
 			     [ AMD_CFLAGS="$AMD_CFLAGS -fvisibility=hidden" ],
 			     [ : ])
 
+# Define a configure option to enable/disable ztv
+AC_ARG_ENABLE(ztv,
+	AS_HELP_STRING([--enable-ztv],
+	    [Enable Video For Linux based ZTV driver (default: auto-detected)]),
+	    [ztv=$enableval],
+	    [ztv=auto])
+
+# Check for Video4Linux Version 2 (V4L2) availability
+AC_CHECK_HEADERS([linux/videodev2.h],[v4l2=yes],[v4l2=no])
+if test "x$ztv" != "xno" ; then
+    if test "x$v4l2" = "xno" ; then
+	if test "x$ztv" = "xyes" ; then
+	    # User really wants ztv but V4L2 is not found
+	    AC_MSG_ERROR([ZTV driver requested, but videodev2.h not found.])
+	fi
+    else
+	BUILD_ZTV=yes
+    fi
+fi
+AM_CONDITIONAL(BUILD_ZTV, [test "x$BUILD_ZTV" = xyes])
+
 if test "x$GCC" = "xyes"; then
        GCC_WARNINGS1="-Wall -Wpointer-arith -Wstrict-prototypes"
        GCC_WARNINGS2="-Wmissing-prototypes -Wmissing-declarations"
@@ -110,10 +131,6 @@ if test "x$XSERVER_LIBPCIACCESS" = xyes; then
     XORG_CFLAGS="$XORG_CFLAGS $PCIACCESS_CFLAGS"
 fi
 
-# Check for Video4Linux Version 2 (V4L2)
-AC_CHECK_HEADERS([linux/videodev2.h],[v4l2=yes])
-AM_CONDITIONAL(BUILD_ZTV, [test "x$v4l2" = xyes])
-
 AC_SUBST([XORG_CFLAGS])
 AC_SUBST([moduledir])
 AC_SUBST([AMD_CFLAGS])
-- 
1.7.4.1



More information about the Xorg-driver-geode mailing list