test1013.pl 2.3 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 = $_ if ( /$what:/i );
  39. }
  40. close CURL;
  41. $curl_protocols =~ s/\r//;
  42. $curl_protocols =~ /\w+: (.*)$/;
  43. @curl = split / /,$1;
  44. # Read the output of curl-config
  45. my @curl_config;
  46. open(CURLCONFIG, "sh $ARGV[0] --$what|") || die "Can't get curl-config $what list\n";
  47. while( <CURLCONFIG> )
  48. {
  49. chomp;
  50. $_ = lc($_) if($what eq "protocols"); # accept uppercase protocols in curl-config
  51. push @curl_config, $_;
  52. }
  53. close CURLCONFIG;
  54. # allow order mismatch to handle autotools builds with no 'sort -f' available
  55. if($what eq "features") {
  56. @curl = sort @curl;
  57. @curl_config = sort @curl_config;
  58. }
  59. my $curlproto = join ' ', @curl;
  60. my $curlconfigproto = join ' ', @curl_config;
  61. my $different = $curlproto ne $curlconfigproto;
  62. if ($different) {
  63. print "Mismatch in $what lists:\n";
  64. print "curl: $curlproto\n";
  65. print "curl-config: $curlconfigproto\n";
  66. }
  67. exit $different;