blob: 37f798fb60ba069f89bc011466db4c350dcc2c84 [file] [log] [blame]
xf.li6c8fc1e2023-08-12 00:11:09 -07001#!/usr/bin/env perl
2#***************************************************************************
3# _ _ ____ _
4# Project ___| | | | _ \| |
5# / __| | | | |_) | |
6# | (__| |_| | _ <| |___
7# \___|\___/|_| \_\_____|
8#
9# Copyright (C) 1998 - 2022, 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
27if ( $#ARGV != 2 )
28{
29 print "Usage: $0 curl-config-script curl-version-output-file features|protocols\n";
30 exit 3;
31}
32
33my $what=$ARGV[2];
34
35# Read the output of curl --version
36my $curl_protocols="";
37open(CURL, "$ARGV[1]") || die "Can't get curl $what list\n";
38while( <CURL> )
39{
40 $curl_protocols = lc($_) if ( /$what:/i );
41}
42close CURL;
43
44$curl_protocols =~ s/\r//;
45$curl_protocols =~ /\w+: (.*)$/;
46@curl = split / /,$1;
47
48# These features are not supported by curl-config
49@curl = grep(!/^(Debug|TrackMemory|CharConv)$/i, @curl);
50@curl = sort @curl;
51
52# Read the output of curl-config
53my @curl_config;
54open(CURLCONFIG, "sh $ARGV[0] --$what|") || die "Can't get curl-config $what list\n";
55while( <CURLCONFIG> )
56{
57 chomp;
58 # ignore curl-config --features not in curl's feature list
59 push @curl_config, lc($_);
60}
61close CURLCONFIG;
62
63@curl_config = sort @curl_config;
64
65my $curlproto = join ' ', @curl;
66my $curlconfigproto = join ' ', @curl_config;
67
68my $different = $curlproto ne $curlconfigproto;
69if ($different) {
70 print "Mismatch in $what lists:\n";
71 print "curl: $curlproto\n";
72 print "curl-config: $curlconfigproto\n";
73}
74exit $different;