From 9f8370ad2d019ef7be5077be35330a1cb1fa7212 Mon Sep 17 00:00:00 2001 From: Michal Vaner Date: Fri, 31 Oct 2008 20:31:14 +0100 Subject: [PATCH] Doc system: Check for asciidoc only when needed --- ucw/perl/UCW/Configure/Doc.pm | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/ucw/perl/UCW/Configure/Doc.pm b/ucw/perl/UCW/Configure/Doc.pm index e15e4edd..24e771d0 100644 --- a/ucw/perl/UCW/Configure/Doc.pm +++ b/ucw/perl/UCW/Configure/Doc.pm @@ -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`; + 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 -- 2.39.5