test1013.pl 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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 =~ s/\r//;
  19. $curl_protocols =~ /\w+: (.*)$/;
  20. @curl = split / /,$1;
  21. # These features are not supported by curl-config
  22. @curl = grep(!/^(Debug|TrackMemory|Metalink|Largefile|CharConv)$/i, @curl);
  23. @curl = sort @curl;
  24. # Read the output of curl-config
  25. my @curl_config;
  26. open(CURLCONFIG, "sh $ARGV[0] --$what|") || die "Can't get curl-config $what list\n";
  27. while( <CURLCONFIG> )
  28. {
  29. chomp;
  30. # ignore curl-config --features not in curl's feature list
  31. push @curl_config, lc($_);
  32. }
  33. close CURLCONFIG;
  34. @curl_config = sort @curl_config;
  35. my $curlproto = join ' ', @curl;
  36. my $curlconfigproto = join ' ', @curl_config;
  37. my $different = $curlproto ne $curlconfigproto;
  38. if ($different) {
  39. print "Mismatch in $what lists:\n";
  40. print "curl: $curlproto\n";
  41. print "curl-config: $curlconfigproto\n";
  42. }
  43. exit $different;