lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 1 | #!/usr/bin/env perl |
| 2 | # Determine if curl-config --protocols/--features matches the |
| 3 | # curl --version protocols/features |
| 4 | if ( $#ARGV != 2 ) |
| 5 | { |
| 6 | print "Usage: $0 curl-config-script curl-version-output-file features|protocols\n"; |
| 7 | exit 3; |
| 8 | } |
| 9 | |
| 10 | my $what=$ARGV[2]; |
| 11 | |
| 12 | # Read the output of curl --version |
| 13 | my $curl_protocols=""; |
| 14 | open(CURL, "$ARGV[1]") || die "Can't get curl $what list\n"; |
| 15 | while( <CURL> ) |
| 16 | { |
| 17 | $curl_protocols = lc($_) if ( /$what:/i ); |
| 18 | } |
| 19 | close CURL; |
| 20 | |
| 21 | $curl_protocols =~ s/\r//; |
| 22 | $curl_protocols =~ /\w+: (.*)$/; |
| 23 | @curl = split / /,$1; |
| 24 | |
| 25 | # These features are not supported by curl-config |
| 26 | @curl = grep(!/^(Debug|TrackMemory|Metalink|Largefile|CharConv)$/i, @curl); |
| 27 | @curl = sort @curl; |
| 28 | |
| 29 | # Read the output of curl-config |
| 30 | my @curl_config; |
| 31 | open(CURLCONFIG, "sh $ARGV[0] --$what|") || die "Can't get curl-config $what list\n"; |
| 32 | while( <CURLCONFIG> ) |
| 33 | { |
| 34 | chomp; |
| 35 | # ignore curl-config --features not in curl's feature list |
| 36 | push @curl_config, lc($_); |
| 37 | } |
| 38 | close CURLCONFIG; |
| 39 | |
| 40 | @curl_config = sort @curl_config; |
| 41 | |
| 42 | my $curlproto = join ' ', @curl; |
| 43 | my $curlconfigproto = join ' ', @curl_config; |
| 44 | |
| 45 | my $different = $curlproto ne $curlconfigproto; |
| 46 | if ($different) { |
| 47 | print "Mismatch in $what lists:\n"; |
| 48 | print "curl: $curlproto\n"; |
| 49 | print "curl-config: $curlconfigproto\n"; |
| 50 | } |
| 51 | exit $different; |