test1013.pl 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. @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;