Fix two valgrind finds.
[m6w6/libmemcached] / m4 / ax_prog_sphinx_build.m4
index cbbf17239738e22278f14a3a039159de0ffa0d30..3a89a3316b631cb655c55f381795eabd3c0b5699 100644 (file)
@@ -4,42 +4,41 @@
 #
 # SYNOPSIS
 #
-#   AX_PROG_SPHINX_BUILD()
+#   AX_PROG_SPHINX_BUILD([ACTION-IF-FOUND], [ACTION-IF-NOT_FOUND])
 #
 # DESCRIPTION
 #
-#   Look for sphinx-build
+#   Look for sphinx-build and make sure it is a recent version of it.
 #
 # LICENSE
 #
-#   Copyright (c) 2012 Brian Aker <brian@tangent.org>
+#   Copyright (c) 2012-2013 Brian Aker <brian@tangent.org>
 #
 #   Copying and distribution of this file, with or without modification, are
 #   permitted in any medium without royalty provided the copyright notice
 #   and this notice are preserved. This file is offered as-is, without any
 #   warranty.
 
-#serial 2
+#serial 3
 
 AC_DEFUN([AX_PROG_SPHINX_BUILD],
-    [AC_PREREQ([2.63])dnl
-    AC_CHECK_PROGS([PERL], [perl])
-    AC_CHECK_PROGS([DPKG_GENSYMBOLS], [dpkg-gensymbols], [:])
-    AC_CHECK_PROGS([LCOV], [lcov], [echo lcov not found])
-    AC_CHECK_PROGS([LCOV_GENHTML], [genhtml], [echo genhtml not found])
-
-    AC_CHECK_PROGS([SPHINXBUILD], [sphinx-build], [:])
-    AS_IF([test "x${SPHINXBUILD}" != "x:"],[
-      AC_CACHE_CHECK([if sphinx is new enough],[ac_cv_recent_sphinx],[
-
-        ${SPHINXBUILD} -Q -C -b man -d conftest.d . . >/dev/null 2>&1
-        AS_IF([test $? -eq 0],[ac_cv_recent_sphinx=yes],
-          [ac_cv_recent_sphinx=no])
+    [AX_WITH_PROG([SPHINXBUILD],[sphinx-build],[:])
+    AS_IF([test x"SPHINXBUILD" = x":"],
+      [SPHINXBUILD=],
+      [AS_IF([test -x "$SPHINXBUILD"],
+        [AC_MSG_CHECKING([Checking to see if $SPHINXBUILD is recent])
+        junk=`$SPHINXBUILD &> version_file`
+        ax_sphinx_build_version=`head -1 version_file`
+        rm version_file
+        AC_MSG_RESULT([$SPHINXBUILD is version "$ax_sphinx_build_version"])
+        $SPHINXBUILD -Q -C -b man -d conftest.d . . >/dev/null 2>&1
+        AS_IF([test $? -eq 0], ,[SPHINXBUILD=])
         rm -rf conftest.d
         ])
       ])
 
-    AM_CONDITIONAL([HAVE_DPKG_GENSYMBOLS],[test "x${DPKG_GENSYMBOLS}" != "x:"])
-    AM_CONDITIONAL([HAVE_SPHINX],[test "x${SPHINXBUILD}" != "x:"])
-    AM_CONDITIONAL([HAVE_RECENT_SPHINX],[test "x${ac_cv_recent_sphinx}" = "xyes"])
-])
+    AS_IF([test -n "${SPHINXBUILD}"],
+      [AC_SUBST([SPHINXBUILD])
+      ifelse([$1], , :, [$1])],
+      [ifelse([$2], , :, [$2])])
+    ])