2 # Determine if curl-config --version matches the curl --version
5 print "Usage: $0 curl-config-script curl-version-output-file version|vernum\n";
11 # Read the output of curl --version
12 open(CURL, "$ARGV[1]") || die "Can't open curl --version list in $ARGV[1]\n";
15 /libcurl\/([\.\d]+((-DEV)|(-\d+))?)/;
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";
26 if ( $what eq "version" ) {
27 if($filever =~ /^libcurl ([\.\d]+((-DEV)|(-\d+))?)$/) {
28 $curlconfigversion = $1;
31 $curlconfigversion = "illegal value";
34 else { # "vernum" case
35 # Convert hex version to decimal for comparison's sake
36 if($filever =~ /^(..)(..)(..)$/) {
37 $curlconfigversion = hex($1) . "." . hex($2) . "." . hex($3);
40 $curlconfigversion = "illegal value";
43 # Strip off the -DEV from the curl version if it's there
44 $version =~ s/-\w*$//;
48 my $different = $version ne $curlconfigversion;
49 if ($different || !$version) {
50 print "Mismatch in --version:\n";
51 print "curl: $version\n";
52 print "curl-config: $curlconfigversion\n";