]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
fix: restore missing --help in Configure
authorBMDan <881372+BMDan@users.noreply.github.com>
Fri, 3 Nov 2023 22:25:50 +0000 (15:25 -0700)
committerTomas Mraz <tomas@openssl.org>
Mon, 11 Aug 2025 14:52:01 +0000 (16:52 +0200)
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/22621)

Configure

index 6db98231dfed7327ec3a48ee26ce59741babd901..26e1d0dc946a7ac5e632854bbf9a09fd10d79108 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -27,7 +27,7 @@ use OpenSSL::config;
 my $orig_death_handler = $SIG{__DIE__};
 $SIG{__DIE__} = \&death_handler;
 
-my $usage="Usage: Configure [no-<feature> ...] [enable-<feature> ...] [-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-Kxxx] [no-hw-xxx|no-hw] [[no-]threads] [[no-]thread-pool] [[no-]default-thread-pool] [[no-]shared] [[no-]zlib|zlib-dynamic] [no-asm] [no-egd] [sctp] [386] [--prefix=DIR] [--openssldir=OPENSSLDIR] [--with-xxx[=vvv]] [--config=FILE] os/compiler[:flags]\n";
+my $usage="Usage: Configure [no-<feature> ...] [enable-<feature> ...] [-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-Kxxx] [no-hw-xxx|no-hw] [[no-]threads] [[no-]thread-pool] [[no-]default-thread-pool] [[no-]shared] [[no-]zlib|zlib-dynamic] [no-asm] [no-egd] [sctp] [386] [--prefix=DIR] [--openssldir=OPENSSLDIR] [--with-xxx[=vvv]] [--config=FILE] [--help] os/compiler[:flags]\n";
 
 my $banner = <<"EOF";
 
@@ -1161,6 +1161,10 @@ while (@argvcopy)
                         {
                         push @{$useradd{CPPFLAGS}}, $1;
                         }
+                elsif (/^--help$/)
+                        {
+                        &usage;
+                        }
                 else    # common if (/^[-+]/), just pass down...
                         {
                         # Treat %xx as an ASCII code (e.g. replace %20 by a space character).
@@ -1169,6 +1173,15 @@ while (@argvcopy)
                         $_ =~ s/%([0-9a-f]{1,2})/chr(hex($1))/gei;
                         push @{$useradd{CFLAGS}}, $_;
                         push @{$useradd{CXXFLAGS}}, $_;
+                        if (/^--(no|with|without|enable|disable)-(\S+)/)
+                                {
+                                # Ideally this would also cover cascades, but I lack Perl-fu.
+                                if (grep ($_ eq $2, @disablables) or exists $deprecated_disablables{$2})
+                                        {
+                                        print STDERR "NOTE: Flag --$1-$2 will be passed to the compiler.  It looks similar to a Configure\n";
+                                        print STDERR "      option, though.  If the latter is what you meant to do, drop the leading '--'.\n";
+                                        }
+                                }
                         }
                 }
         elsif (m|^/|)
@@ -3365,33 +3378,72 @@ sub usage
         {
         print STDERR $usage;
         print STDERR "\npick os/compiler from:\n";
-        my $j=0;
         my $i;
         my $k=0;
+        print STDERR "  ";
         foreach $i (sort keys %table)
                 {
                 next if $table{$i}->{template};
                 next if $i =~ /^debug/;
-                $k += length($i) + 1;
+                $k += length($i);
                 if ($k > 78)
                         {
-                        print STDERR "\n";
-                        $k=length($i);
+                        print STDERR "\n  ";
+                        $k=length($i) + 2;
                         }
+                $k += 1;
                 print STDERR $i . " ";
                 }
         foreach $i (sort keys %table)
                 {
                 next if $table{$i}->{template};
                 next if $i !~ /^debug/;
-                $k += length($i) + 1;
+                $k += length($i);
                 if ($k > 78)
                         {
-                        print STDERR "\n";
-                        $k=length($i);
+                        print STDERR "\n  ";
+                        $k=length($i) + 2;
                         }
+                $k += 1;
                 print STDERR $i . " ";
                 }
+        print STDERR "\n";
+
+        # Do some color wizardry.  Ideally, this would be done by a library and
+        # would use proper termcap/terminfo, but we would rather avoid external
+        # dependencies.  It's disabled by default unless you define CLICOLOR in
+        # your env.  (We approximate ls(1)'s behavior in BSD in this regard.)
+        my $en_color="";
+        my $dis_color="";
+        my $reset_color="";
+        my $this_color;
+        if ( defined $ENV{'CLICOLOR'} and (defined $ENV{'CLICOLOR_FORCE'} or -t 2) )
+                {
+                $en_color="\e[1;32m";  # bold green
+                $dis_color="\e[3;2m";  # dim italic
+                $reset_color="\e[0;0m";
+                }
+
+        print STDERR "The following ${en_color}ENABLED${reset_color} and ${dis_color}disabled${reset_color} flags are available:\n  ";
+        $k = 2;
+        foreach $i (sort @disablables)
+                {
+                $this_color=$dis_color;
+                $k += length($i);
+                if (not exists $disabled{$i})
+                        {
+                        $this_color=$en_color;
+                        $i = uc $i;
+                        }
+                if ($k > 78)
+                        {
+                        print STDERR "\n  ";
+                        $k=length($i) + 2;
+                        }
+                $k += 1;
+                print STDERR "${this_color}${i}${reset_color} ";
+                }
+        print STDERR "\n";
         exit(1);
         }