2007-11-01 08:36:55 +08:00
|
|
|
#!/usr/bin/env perl
|
2020-03-23 21:44:29 +08:00
|
|
|
#***************************************************************************
|
|
|
|
# _ _ ____ _
|
|
|
|
# Project ___| | | | _ \| |
|
|
|
|
# / __| | | | |_) | |
|
|
|
|
# | (__| |_| | _ <| |___
|
|
|
|
# \___|\___/|_| \_\_____|
|
|
|
|
#
|
2021-03-10 07:38:21 +08:00
|
|
|
# Copyright (C) 1998 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
|
2020-03-23 21:44:29 +08:00
|
|
|
#
|
|
|
|
# This software is licensed as described in the file COPYING, which
|
|
|
|
# you should have received as part of this distribution. The terms
|
2020-11-04 21:02:01 +08:00
|
|
|
# are also available at https://curl.se/docs/copyright.html.
|
2020-03-23 21:44:29 +08:00
|
|
|
#
|
|
|
|
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
|
|
|
# copies of the Software, and permit persons to whom the Software is
|
|
|
|
# furnished to do so, under the terms of the COPYING file.
|
|
|
|
#
|
|
|
|
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
# KIND, either express or implied.
|
|
|
|
#
|
|
|
|
###########################################################################
|
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> )
|
|
|
|
{
|
2012-07-20 23:22:10 +08:00
|
|
|
$curl_protocols = lc($_) if ( /$what:/i );
|
2007-11-01 08:36:55 +08:00
|
|
|
}
|
|
|
|
close CURL;
|
|
|
|
|
2012-07-20 23:22:10 +08:00
|
|
|
$curl_protocols =~ s/\r//;
|
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
|
2021-03-10 07:38:21 +08:00
|
|
|
@curl = grep(!/^(Debug|TrackMemory|Metalink|CharConv)$/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;
|
2014-05-18 23:07:29 +08:00
|
|
|
# ignore curl-config --features not in curl's feature list
|
2014-07-22 17:01:04 +08:00
|
|
|
push @curl_config, lc($_);
|
2007-11-01 08:36:55 +08:00
|
|
|
}
|
|
|
|
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;
|