AM_CONDITIONAL([ENABLE_DOCS], [test x$enable_docs = xyes])
have_valadoc=no
-AS_IF([test "x$enable_docs" != xno],
- [AC_PATH_PROG([VALADOC], [valadoc], [:])
- AS_IF([test "$VALADOC" != :], have_valadoc=yes)])
+if test x$enable_docs = xyes; then
+ # make sure the library is new enough and the program exists
+ PKG_CHECK_MODULES([VALADOC], [valadoc-1.0 >= $VALADOC_REQUIRED])
+ AC_PATH_PROG([VALADOC], [valadoc], [:])
+ AS_IF([test "$VALADOC" != :], have_valadoc=yes)
+fi
AM_CONDITIONAL([HAVE_VALADOC], [test x$have_valadoc = xyes])
if test "x$enable_docs" = "xyes" -a "x$have_valadoc" != "xyes"; then