test1013.pl 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. my $what=$ARGV[2];
  31. # Read the output of curl --version
  32. my $curl_protocols="";
  33. open(CURL, "$ARGV[1]") || die "Can't get curl $what list\n";
  34. while( <CURL> )
  35. {
  36. $curl_protocols = lc($_) if ( /$what:/i );
  37. }
  38. close CURL;
  39. $curl_protocols =~ s/\r//;
  40. $curl_protocols =~ /\w+: (.*)$/;
  41. @curl = split / /,$1;
  42. # These features are not supported by curl-config
  43. @curl = grep(!/^(Debug|TrackMemory|Metalink|Largefile|CharConv)$/i, @curl);
  44. @curl = sort @curl;
  45. # Read the output of curl-config
  46. my @curl_config;
  47. open(CURLCONFIG, "sh $ARGV[0] --$what|") || die "Can't get curl-config $what list\n";
  48. while( <CURLCONFIG> )
  49. {
  50. chomp;
  51. # ignore curl-config --features not in curl's feature list
  52. push @curl_config, lc($_);
  53. }
  54. close CURLCONFIG;
  55. @curl_config = sort @curl_config;
  56. my $curlproto = join ' ', @curl;
  57. my $curlconfigproto = join ' ', @curl_config;
  58. my $different = $curlproto ne $curlconfigproto;
  59. if ($different) {
  60. print "Mismatch in $what lists:\n";
  61. print "curl: $curlproto\n";
  62. print "curl-config: $curlconfigproto\n";
  63. }
  64. exit $different;