test1013.pl 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #!/usr/bin/env perl
  2. # Determine if curl-config --protocols/--features matches the
  3. # curl --version protocols/features
  4. if ( $#ARGV != 2 )
  5. {
  6. print "Usage: $0 curl-config-script curl-version-output-file features|protocols\n";
  7. exit 3;
  8. }
  9. my $what=$ARGV[2];
  10. # Read the output of curl --version
  11. my $curl_protocols="";
  12. open(CURL, "$ARGV[1]") || die "Can't get curl $what list\n";
  13. while( <CURL> )
  14. {
  15. $curl_protocols = lc($_) if ( /$what:/i );
  16. }
  17. close CURL;
  18. $curl_protocols =~ /\w+: (.*)$/;
  19. @curl = split / /,$1;
  20. # These features are not supported by curl-config
  21. @curl = grep(!/^(Debug|TrackMemory|Largefile|CharConv|GSS-Negotiate|SPNEGO)$/i, @curl);
  22. @curl = sort @curl;
  23. # Read the output of curl-config
  24. my @curl_config;
  25. open(CURLCONFIG, "sh $ARGV[0] --$what|") || die "Can't get curl-config $what list\n";
  26. while( <CURLCONFIG> )
  27. {
  28. chomp;
  29. push @curl_config, lc($_);
  30. }
  31. close CURLCONFIG;
  32. @curl_config = sort @curl_config;
  33. my $curlproto = join ' ', @curl;
  34. my $curlconfigproto = join ' ', @curl_config;
  35. my $different = $curlproto ne $curlconfigproto;
  36. if ($different) {
  37. print "Mismatch in $what lists:\n";
  38. print "curl: $curlproto\n";
  39. print "curl-config: $curlconfigproto\n";
  40. }
  41. exit $different;