]> granicus.if.org Git - postgresql/commitdiff
Detect out of date flex in MSVC builds.
authorAndrew Dunstan <andrew@dunslane.net>
Tue, 30 Aug 2011 16:06:32 +0000 (12:06 -0400)
committerAndrew Dunstan <andrew@dunslane.net>
Tue, 30 Aug 2011 16:06:32 +0000 (12:06 -0400)
Per recent discussion, following a report from Quan Zongliang.
The same logic is used as in pgbison.pl.

src/tools/msvc/pgflex.pl

index f48ce6b900a0b6b20b73a91bd1e4979dbef73d46..7b9021d2ba279c8320ce8b08daf138e6d58888f2 100644 (file)
@@ -12,10 +12,14 @@ use File::Basename;
 
 require 'src/tools/msvc/buildenv.pl' if -e 'src/tools/msvc/buildenv.pl';
 
-system('flex -V > NUL');
-if ($? != 0)
+my ($flexver) = `flex -V`; # grab first line
+$flexver=(split(/\s+/,$flexver))[1]; 
+$flexver =~ s/[^0-9.]//g; 
+my @verparts = split(/\./,$flexver);
+unless ($verparts[0] == 2 && $verparts[1] == 5 && $verparts[2] >= 31)
 {
-    print "WARNING! flex install not found, attempting to build without\n";
+    print "WARNING! Flex install not found, or unsupported Flex version.\n";
+    print "echo Attempting to build without.\n";
     exit 0;
 }