Resync
[CMakeLuaTailorHgBridge.git] / CMakeLua / Utilities / cmcurl-7.19.0 / tests / libtest / test1022.pl
blob5b16de3e0209bb310788cfbe01706f6549907423
1 #!/usr/bin/env perl
2 # Determine if curl-config --version matches the curl --version
3 if ( $#ARGV != 2 )
5 print "Usage: $0 curl-config-script curl-version-output-file version|vernum\n";
6 exit 3;
9 my $what=$ARGV[2];
11 # Read the output of curl --version
12 open(CURL, "$ARGV[1]") || die "Can't open curl --version list in $ARGV[1]\n";
13 $_ = <CURL>;
14 chomp;
15 /libcurl\/([\.\d]+(-CVS)?)/;
16 my $version = $1;
17 close CURL;
19 my $curlconfigversion;
21 # Read the output of curl-config --version/--vernum
22 open(CURLCONFIG, "sh $ARGV[0] --$what|") || die "Can't get curl-config --$what list\n";
23 $_ = <CURLCONFIG>;
24 chomp;
25 if ( $what eq "version" ) {
26 /^libcurl ([\.\d]+(-CVS)?)$/ ;
27 $curlconfigversion = $1;
29 else {
30 # Convert hex version to decimal for comparison's sake
31 /^(..)(..)(..)$/ ;
32 $curlconfigversion = hex($1) . "." . hex($2) . "." . hex($3);
34 # Strip off the -CVS from the curl version if it's there
35 $version =~ s/-CVS$//;
37 close CURLCONFIG;
39 my $different = $version ne $curlconfigversion;
40 if ($different || !$version) {
41 print "Mismatch in --version:\n";
42 print "curl: $version\n";
43 print "curl-config: $curlconfigversion\n";
44 exit 1;