From 6c5a7edbfb5b833d42f0b9c4c4844ca366f32025 Mon Sep 17 00:00:00 2001 From: short <> Date: Sat, 16 Aug 2003 07:46:44 +0000 Subject: [PATCH] +&checkcommandversion --- AutoGen.pm | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/AutoGen.pm b/AutoGen.pm index 796733e..cad8cbf 100644 --- a/AutoGen.pm +++ b/AutoGen.pm @@ -63,6 +63,23 @@ Supported parameters: '.($Options{"help"} || ""); } +sub checkcommandversion +{ +my($class,$command,$version)=@_; + + local *F; + do { open F,$_ or confess "Open $_: $!"; } for ("$command --version|"); + local $/; + undef $/; + my $command_out=; + close F; + my $command_version=($command_out=~m#([\d.]+)#)[0]; + confess "$command(1) version not found in its output" if !$command_version; + confess "'$command' version $version or higher required" + # Do not take 3rd+ numbers as it would not be a number + if ($command_version=~/^(\d+[.]\d+)/)[0]<$version; +} + sub _readfile { my($filename)=@_; -- 1.8.3.1