]> mj.ucw.cz Git - libucw.git/blobdiff - ucw/perl/UCW/Configure/Doc.pm
Configure: Moved interaction with pkg-config to a separate module (continued).
[libucw.git] / ucw / perl / UCW / Configure / Doc.pm
index e15e4eddf8181843c92559de3fbe67a70bca5e02..b1a701b4c69fb61c76d29161044de43a921be50e 100644 (file)
@@ -7,19 +7,25 @@ use UCW::Configure;
 use strict;
 use warnings;
 
-Test("ASCII_DOC", "Checking for AsciiDoc", sub {
-       my $version = `asciidoc --version`;
-       return "none" if !defined $version || $version eq "";
-       my( $vnum ) = $version =~ / (\d+)\.\S*$/;
-       return "old" if $vnum < 7;
-       return "yes";
-});
+if (!IsGiven("CONFIG_DOC") || IsSet("CONFIG_DOC")) {
+       Test("HAVE_ASCII_DOC", "Checking for AsciiDoc", sub {
+               my $version = `asciidoc --version 2>&1`;
+               return "none" if !defined $version || $version eq "";
+               my( $vnum ) = $version =~ / (\d+\.\S*)$/;
+               return $vnum;
+       });
 
-if(Get("ASCII_DOC") eq "yes") {
-       Set("CONFIG_DOC");
-} else {
-       Warn("Need asciidoc >= 7 to build documentation");
-       UnSet("CONFIG_DOC");
+       my( $major ) = Get("HAVE_ASCII_DOC") =~ /^(\d+)/;
+       if (defined $major && $major >= 7) {
+               Set("CONFIG_DOC");
+       } else {
+               if (IsGiven("CONFIG_DOC")) {
+                       Fail("Need asciidoc >= 7");
+               } else {
+                       Warn("Need asciidoc >= 7 to build documentation");
+                       UnSet("CONFIG_DOC");
+               }
+       }
 }
 
 # We succeeded