+AC_ARG_ENABLE([python],
+ AS_HELP_STRING([--enable-python], [enable Python libkmod bindings @<:@default=disabled@:>@]),
+ [], [enable_python=no])
+AS_IF([test "x$enable_python" = "xyes"], [
+ AM_PATH_PYTHON(,,[:])
+ AC_PATH_PROG([CYTHON], [cython], [:])
+
+ PKG_CHECK_MODULES([PYTHON], [python-${PYTHON_VERSION}],
+ [have_python=yes],
+ [PKG_CHECK_MODULES([PYTHON], [python],
+ [have_python=yes],
+ [have_python=no])])
+
+ AS_IF([test "x$have_python" = xno],
+ [AC_MSG_ERROR([*** python support requested but libraries not found])])
+])
+AM_CONDITIONAL([BUILD_PYTHON], [test "x$enable_python" = "xyes"])
+
+AC_ARG_ENABLE([coverage],
+ AS_HELP_STRING([--enable-coverage], [enable test coverage @<:@default=disabled@:>@]),
+ [], [enable_coverage=no])
+AS_IF([test "x$enable_coverage" = "xyes"], [
+ AC_CHECK_PROG(have_coverage, [lcov], [yes], [no])
+ AS_IF([test "x$have_coverage" = xno],[
+ AC_MSG_ERROR([*** lcov support requested but the program was not found])
+ ], [
+ lcov_version_major="`lcov --version | cut -d ' ' -f 4 | cut -d '.' -f 1`"
+ lcov_version_minor="`lcov --version | cut -d ' ' -f 4 | cut -d '.' -f 2`"
+ AS_IF([test "$lcov_version_major" -lt 1 -o "$lcov_version_minor" -lt 10], [
+ AC_MSG_ERROR([*** lcov version is too old. 1.10 required])
+ ], [
+ have_coverage=yes
+ CC_CHECK_FLAGS_APPEND([with_coverage_cflags], [CFLAGS], [\
+ -fprofile-arcs \
+ -ftest-coverage])
+ ])
+ ])
+])
+AM_CONDITIONAL([ENABLE_COVERAGE], [test "x$enable_coverage" = "xyes"])
+