ciconfig.pl 4.3 KB

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