1: #!/usr/bin/env perl
2: #***************************************************************************
3: # _ _ ____ _
4: # Project ___| | | | _ \| |
5: # / __| | | | |_) | |
6: # | (__| |_| | _ <| |___
7: # \___|\___/|_| \_\_____|
8: #
9: # Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
10: #
11: # This software is licensed as described in the file COPYING, which
12: # you should have received as part of this distribution. The terms
13: # are also available at https://curl.haxx.se/docs/copyright.html.
14: #
15: # You may opt to use, copy, modify, merge, publish, distribute and/or sell
16: # copies of the Software, and permit persons to whom the Software is
17: # furnished to do so, under the terms of the COPYING file.
18: #
19: # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20: # KIND, either express or implied.
21: #
22: ###########################################################################
23: # Determine if curl-config --protocols/--features matches the
24: # curl --version protocols/features
25: if ( $#ARGV != 2 )
26: {
27: print "Usage: $0 curl-config-script curl-version-output-file features|protocols\n";
28: exit 3;
29: }
30:
31: my $what=$ARGV[2];
32:
33: # Read the output of curl --version
34: my $curl_protocols="";
35: open(CURL, "$ARGV[1]") || die "Can't get curl $what list\n";
36: while( <CURL> )
37: {
38: $curl_protocols = lc($_) if ( /$what:/i );
39: }
40: close CURL;
41:
42: $curl_protocols =~ s/\r//;
43: $curl_protocols =~ /\w+: (.*)$/;
44: @curl = split / /,$1;
45:
46: # These features are not supported by curl-config
47: @curl = grep(!/^(Debug|TrackMemory|Metalink|Largefile|CharConv)$/i, @curl);
48: @curl = sort @curl;
49:
50: # Read the output of curl-config
51: my @curl_config;
52: open(CURLCONFIG, "sh $ARGV[0] --$what|") || die "Can't get curl-config $what list\n";
53: while( <CURLCONFIG> )
54: {
55: chomp;
56: # ignore curl-config --features not in curl's feature list
57: push @curl_config, lc($_);
58: }
59: close CURLCONFIG;
60:
61: @curl_config = sort @curl_config;
62:
63: my $curlproto = join ' ', @curl;
64: my $curlconfigproto = join ' ', @curl_config;
65:
66: my $different = $curlproto ne $curlconfigproto;
67: if ($different) {
68: print "Mismatch in $what lists:\n";
69: print "curl: $curlproto\n";
70: print "curl-config: $curlconfigproto\n";
71: }
72: exit $different;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>