2007-11-01 08:36:55 +08:00
|
|
|
#!/usr/bin/env perl
|
2008-02-08 09:21:03 +08:00
|
|
|
# Determine if curl-config --protocols/--features matches the
|
|
|
|
# curl --version protocols/features
|
2010-02-15 03:40:18 +08:00
|
|
|
if ( $#ARGV != 2 )
|
2007-11-01 08:36:55 +08:00
|
|
|
{
|
2010-02-16 21:32:45 +08:00
|
|
|
print "Usage: $0 curl-config-script curl-version-output-file features|protocols\n";
|
|
|
|
exit 3;
|
2007-11-01 08:36:55 +08:00
|
|
|
}
|
|
|
|
|
2007-11-01 11:09:27 +08:00
|
|
|
my $what=$ARGV[2];
|
|
|
|
|
2007-11-02 05:20:24 +08:00
|
|
|
# Read the output of curl --version
|
2007-11-01 08:36:55 +08:00
|
|
|
my $curl_protocols="";
|
2007-11-02 05:20:24 +08:00
|
|
|
open(CURL, "$ARGV[1]") || die "Can't get curl $what list\n";
|
2007-11-01 08:36:55 +08:00
|
|
|
while( <CURL> )
|
|
|
|
{
|
2007-11-01 11:09:27 +08:00
|
|
|
$curl_protocols = lc($_) if ( /$what:/i );
|
2007-11-01 08:36:55 +08:00
|
|
|
}
|
|
|
|
close CURL;
|
|
|
|
|
2007-11-01 11:09:27 +08:00
|
|
|
$curl_protocols =~ /\w+: (.*)$/;
|
2007-11-01 08:36:55 +08:00
|
|
|
@curl = split / /,$1;
|
2007-11-02 05:20:24 +08:00
|
|
|
|
|
|
|
# These features are not supported by curl-config
|
2009-06-10 12:06:06 +08:00
|
|
|
@curl = grep(!/^(Debug|TrackMemory|Largefile|CharConv|GSS-Negotiate|SPNEGO)$/i, @curl);
|
2007-11-01 08:36:55 +08:00
|
|
|
@curl = sort @curl;
|
|
|
|
|
2007-11-02 05:20:24 +08:00
|
|
|
# Read the output of curl-config
|
2007-11-01 08:36:55 +08:00
|
|
|
my @curl_config;
|
2007-11-02 05:20:24 +08:00
|
|
|
open(CURLCONFIG, "sh $ARGV[0] --$what|") || die "Can't get curl-config $what list\n";
|
2007-11-01 08:36:55 +08:00
|
|
|
while( <CURLCONFIG> )
|
|
|
|
{
|
|
|
|
chomp;
|
|
|
|
push @curl_config, lc($_);
|
|
|
|
}
|
|
|
|
close CURLCONFIG;
|
|
|
|
|
|
|
|
@curl_config = sort @curl_config;
|
|
|
|
|
|
|
|
my $curlproto = join ' ', @curl;
|
|
|
|
my $curlconfigproto = join ' ', @curl_config;
|
|
|
|
|
|
|
|
my $different = $curlproto ne $curlconfigproto;
|
|
|
|
if ($different) {
|
2010-02-16 21:32:45 +08:00
|
|
|
print "Mismatch in $what lists:\n";
|
|
|
|
print "curl: $curlproto\n";
|
|
|
|
print "curl-config: $curlconfigproto\n";
|
2007-11-01 08:36:55 +08:00
|
|
|
}
|
|
|
|
exit $different;
|