113498266Sopenharmony_ci#!/usr/bin/env perl 213498266Sopenharmony_ci#*************************************************************************** 313498266Sopenharmony_ci# _ _ ____ _ 413498266Sopenharmony_ci# Project ___| | | | _ \| | 513498266Sopenharmony_ci# / __| | | | |_) | | 613498266Sopenharmony_ci# | (__| |_| | _ <| |___ 713498266Sopenharmony_ci# \___|\___/|_| \_\_____| 813498266Sopenharmony_ci# 913498266Sopenharmony_ci# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 1013498266Sopenharmony_ci# 1113498266Sopenharmony_ci# This software is licensed as described in the file COPYING, which 1213498266Sopenharmony_ci# you should have received as part of this distribution. The terms 1313498266Sopenharmony_ci# are also available at https://curl.se/docs/copyright.html. 1413498266Sopenharmony_ci# 1513498266Sopenharmony_ci# You may opt to use, copy, modify, merge, publish, distribute and/or sell 1613498266Sopenharmony_ci# copies of the Software, and permit persons to whom the Software is 1713498266Sopenharmony_ci# furnished to do so, under the terms of the COPYING file. 1813498266Sopenharmony_ci# 1913498266Sopenharmony_ci# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 2013498266Sopenharmony_ci# KIND, either express or implied. 2113498266Sopenharmony_ci# 2213498266Sopenharmony_ci# SPDX-License-Identifier: curl 2313498266Sopenharmony_ci# 2413498266Sopenharmony_ci########################################################################### 2513498266Sopenharmony_ci# Determine if curl-config --protocols/--features matches the 2613498266Sopenharmony_ci# curl --version protocols/features 2713498266Sopenharmony_ciif ( $#ARGV != 2 ) 2813498266Sopenharmony_ci{ 2913498266Sopenharmony_ci print "Usage: $0 curl-config-script curl-version-output-file features|protocols\n"; 3013498266Sopenharmony_ci exit 3; 3113498266Sopenharmony_ci} 3213498266Sopenharmony_ci 3313498266Sopenharmony_cimy $what=$ARGV[2]; 3413498266Sopenharmony_ci 3513498266Sopenharmony_ci# Read the output of curl --version 3613498266Sopenharmony_cimy $curl_protocols=""; 3713498266Sopenharmony_ciopen(CURL, "$ARGV[1]") || die "Can't get curl $what list\n"; 3813498266Sopenharmony_ciwhile( <CURL> ) 3913498266Sopenharmony_ci{ 4013498266Sopenharmony_ci $curl_protocols = lc($_) if ( /$what:/i ); 4113498266Sopenharmony_ci} 4213498266Sopenharmony_ciclose CURL; 4313498266Sopenharmony_ci 4413498266Sopenharmony_ci$curl_protocols =~ s/\r//; 4513498266Sopenharmony_ci$curl_protocols =~ /\w+: (.*)$/; 4613498266Sopenharmony_ci@curl = split / /,$1; 4713498266Sopenharmony_ci 4813498266Sopenharmony_ci# These features are not supported by curl-config 4913498266Sopenharmony_ci@curl = grep(!/^(Debug|TrackMemory|CharConv)$/i, @curl); 5013498266Sopenharmony_ci@curl = sort @curl; 5113498266Sopenharmony_ci 5213498266Sopenharmony_ci# Read the output of curl-config 5313498266Sopenharmony_cimy @curl_config; 5413498266Sopenharmony_ciopen(CURLCONFIG, "sh $ARGV[0] --$what|") || die "Can't get curl-config $what list\n"; 5513498266Sopenharmony_ciwhile( <CURLCONFIG> ) 5613498266Sopenharmony_ci{ 5713498266Sopenharmony_ci chomp; 5813498266Sopenharmony_ci # ignore curl-config --features not in curl's feature list 5913498266Sopenharmony_ci push @curl_config, lc($_); 6013498266Sopenharmony_ci} 6113498266Sopenharmony_ciclose CURLCONFIG; 6213498266Sopenharmony_ci 6313498266Sopenharmony_ci@curl_config = sort @curl_config; 6413498266Sopenharmony_ci 6513498266Sopenharmony_cimy $curlproto = join ' ', @curl; 6613498266Sopenharmony_cimy $curlconfigproto = join ' ', @curl_config; 6713498266Sopenharmony_ci 6813498266Sopenharmony_cimy $different = $curlproto ne $curlconfigproto; 6913498266Sopenharmony_ciif ($different) { 7013498266Sopenharmony_ci print "Mismatch in $what lists:\n"; 7113498266Sopenharmony_ci print "curl: $curlproto\n"; 7213498266Sopenharmony_ci print "curl-config: $curlconfigproto\n"; 7313498266Sopenharmony_ci} 7413498266Sopenharmony_ciexit $different; 75