test1013.pl (2315B)
1 #!/usr/bin/env perl 2 #*************************************************************************** 3 # _ _ ____ _ 4 # Project ___| | | | _ \| | 5 # / __| | | | |_) | | 6 # | (__| |_| | _ <| |___ 7 # \___|\___/|_| \_\_____| 8 # 9 # Copyright (C) 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.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 # SPDX-License-Identifier: curl 23 # 24 ########################################################################### 25 # Determine if curl-config --protocols/--features matches the 26 # curl --version protocols/features 27 if($#ARGV != 2) { 28 print "Usage: $0 curl-config-script curl-version-output-file features|protocols\n"; 29 exit 3; 30 } 31 32 my $what=$ARGV[2]; 33 34 # Read the output of curl --version 35 my $curl_protocols=""; 36 open(CURL, "$ARGV[1]") || die "Can't get curl $what list\n"; 37 while(<CURL>) { 38 $curl_protocols = $_ if(/$what:/i); 39 } 40 close CURL; 41 42 $curl_protocols =~ s/\r//; 43 $curl_protocols =~ /\w+: (.*)$/; 44 @curl = split / /,$1; 45 46 # Read the output of curl-config 47 my @curl_config; 48 open(CURLCONFIG, "sh $ARGV[0] --$what|") || die "Can't get curl-config $what list\n"; 49 while(<CURLCONFIG>) { 50 chomp; 51 $_ = lc($_) if($what eq "protocols"); # accept uppercase protocols in curl-config 52 push @curl_config, $_; 53 } 54 close CURLCONFIG; 55 56 # allow order mismatch to handle autotools builds with no 'sort -f' available 57 if($what eq "features") { 58 @curl = sort @curl; 59 @curl_config = sort @curl_config; 60 } 61 62 my $curlproto = join ' ', @curl; 63 my $curlconfigproto = join ' ', @curl_config; 64 65 my $different = $curlproto ne $curlconfigproto; 66 if($different) { 67 print "Mismatch in $what lists:\n"; 68 print "curl: $curlproto\n"; 69 print "curl-config: $curlconfigproto\n"; 70 } 71 exit $different;