test1013.pl 2.2 KB

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