Add a configure option to enable/disable building the ztv driver

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@videotron.ca>
This commit is contained in:
Gaetan Nadon
2011-11-16 14:07:10 -05:00
committed by Martin-Éric Racine
parent 23b85b3fcd
commit fc19e7d2bd

View File

@@ -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])