xref: /curl/scripts/ciconfig.pl (revision f0d8db15)
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
26# these options are enabled by default in the sense that they will attempt to
27# check for and use this feature without the configure flag
28my %defaulton = (
29    # --enable-
30    'shared' => 1,
31    'static' => 1,
32    'fast-install' => 1,
33    'silent-rules' => 1,
34    'optimize' => 1,
35    'http' => 1,
36    'ftp' => 1,
37    'file' => 1,
38    'ldap' => 1,
39    'ldaps' => 1,
40    'rtsp' => 1,
41    'proxy' => 1,
42    'dict' => 1,
43    'telnet' => 1,
44    'tftp' => 1,
45    'pop3' => 1,
46    'imap' => 1,
47    'smb' => 1,
48    'smtp' => 1,
49    'gopher' => 1,
50    'mqtt' => 1,
51    'manual' => 1,
52    'libcurl-option' => 1,
53    'libgcc' => 1,
54    'ipv6' => 1,
55    'openssl-auto-load-config' => 1,
56    'versioned-symbols' => 1,
57    'symbol-hiding' => 1,
58    'threaded-resolver' => 1,
59    'pthreads' => 1,
60    'verbose' => 1,
61    'basic-auth' => 1,
62    'bearer-auth' => 1,
63    'digest-auth' => 1,
64    'kerberos-auth' => 1,
65    'negotiate-auth' => 1,
66    'aws' => 1,
67    'ntlm' => 1,
68    'ntlm-wb' => 1,
69    'tls-srp' => 1,
70    'unix-sockets' => 1,
71    'cookies' => 1,
72    'socketpair' => 1,
73    'http-auth' => 1,
74    'doh' => 1,
75    'mime' => 1,
76    'dateparse' => 1,
77    'netrc' => 1,
78    'progress-meter' => 1,
79    'dnsshuffle' => 1,
80    'get-easy-options' => 1,
81    'alt-svc' => 1,
82    'hsts' => 1,
83
84    # --with-
85    'aix-soname' => 1,
86    'pic' => 1,
87    'zlib' => 1,
88    'zstd' => 1,
89    'brotli' => 1,
90    'random' => 1,
91    'ca-bundle' => 1,
92    'ca-path' => 1,
93    'libssh2' => 1,
94    'nghttp2' => 1,
95    'librtmp' => 1,
96    'libidn2' => 1,
97    'sysroot' => 1,
98    'lber-lib' => 1,
99    'ldap-lib' => 1,
100
101    );
102
103
104sub configureopts {
105    my ($opts)=@_;
106    my %thisin;
107    my %thisout;
108
109    while($opts =~ s/--with-([^ =]*)//) {
110        $with{$1}++;
111        $used{$1}++;
112        $thisin{$1}++;
113    }
114    while($opts =~ s/--enable-([^ =]*)//) {
115        $with{$1}++;
116        $used{$1}++;
117        $thisin{$1}++;
118    }
119
120    while($opts =~ s/--without-([^ =]*)//) {
121        $without{$1}++;
122        $used{$1}++;
123        $thisout{$1}++;
124    }
125    while($opts =~ s/--disable-([^ =]*)//) {
126        $without{$1}++;
127        $used{$1}++;
128        $thisout{$1}++;
129    }
130    return join(" ", sort(keys %thisin), "/", sort(keys %thisout));
131}
132
133# run configure --help and check what available WITH/ENABLE options that exist
134sub configurehelp {
135    open(C, "./configure --help|");
136    while(<C>) {
137        if($_ =~ /^  --(with|enable)-([a-z0-9-]+)/) {
138            $avail{$2}++;
139        }
140    }
141    close(C);
142}
143
144sub scanjobs {
145
146    my $jobs;
147    open(CI, "./scripts/cijobs.pl|");
148    while(<CI>) {
149        if($_ =~ /^\#\#\#/) {
150            $jobs++;
151        }
152        if($_ =~ /^configure: (.*)/) {
153            my $c= configureopts($1);
154            #print "C: $c\n";
155        }
156    }
157    close(CI);
158}
159
160configurehelp();
161scanjobs();
162
163print "Used configure options (with / without)\n";
164for my $w (sort keys %used) {
165    printf "  %s: %d %d%s\n", $w, $with{$w}, $without{$w},
166        $defaulton{$w} ? " (auto)":"";
167}
168
169print "Never used configure options\n";
170for my $w (sort keys %avail) {
171    if(!$used{$w}) {
172        printf "  %s%s\n", $w,
173            $defaulton{$w} ? " (auto)":"";
174    }
175}
176
177print "Never ENABLED configure options that aren't on by default\n";
178for my $w (sort keys %avail) {
179    if(!$with{$w} && !$defaulton{$w}) {
180        printf "  %s\n", $w;
181    }
182}
183
184
185print "ENABLED configure options that aren't available\n";
186for my $w (sort keys %with) {
187    if(!$avail{$w}) {
188        printf "  %s\n", $w;
189    }
190}
191