autoreconf: don’t fail if gtkdocize is unavailable (#110503)

Since 2.70, autoreconf has run gtkdocize when it detects a use of the
macro GTK_DOC_CHECK in the configure.ac.  Some projects (e.g. per the
bug report, gnutls and harfbuzz) were using a clever hack with
m4_ifdef to allow people to build the project without having gtkdocize
installed, if they didn’t care about building the documentation; the
change to autoreconf broke this hack.

Attempt to make the hack work again, by only running gtkdocize if that
command is actually installed; autoreconf will not error out if the
macro is detected but the command is unavailable, similar to the
existing treatment of autopoint.

Problem reported by Marvin Scholz.

* bin/autoreconf.in (autoreconf_current_directory): Do not error out
  if gtkdocize is wanted but unavailable.
diff --git a/bin/autoreconf.in b/bin/autoreconf.in
index 4d08e53..6289d55 100644
--- a/bin/autoreconf.in
+++ b/bin/autoreconf.in
@@ -812,14 +812,27 @@
     {
       verb "$configure_ac: not using Gtkdoc";
     }
-  elsif ($install)
+  elsif (!$install)
     {
-      xsystem_hint ("gtkdocize is needed because this package uses Gtkdoc",
-		    $gtkdocize);
+      verb "$configure_ac: not running gtkdocize: --install not given";
     }
   else
     {
-      verb "$configure_ac: not running gtkdocize: --install not given";
+      my $gtkdoc_available = eval
+	{
+	  no warnings 'exec';
+	  my $output = qx/gtkdocize --version/;
+	  !$! && $? == 0;
+	};
+      if (!$gtkdoc_available)
+	{
+	  verb "$configure_ac: not running gtkdocize because it is unavailable";
+	}
+      else
+	{
+	  xsystem_hint ("gtkdocize is needed because this package uses Gtkdoc",
+			$gtkdocize);
+	}
     }