summaryrefslogtreecommitdiff
path: root/automake.in
diff options
context:
space:
mode:
authorStefano Lattarini <stefano.lattarini@gmail.com>2012-01-18 18:42:46 +0100
committerStefano Lattarini <stefano.lattarini@gmail.com>2012-01-18 18:42:46 +0100
commit3a7b60b1ca8a2f2b86acf494d649bff66beb445b (patch)
tree879bf39e27829b1c249aee94a472acdf69be9c8f /automake.in
parentc45e3c37a9a0e9df08484ba3a6100af9761a2d97 (diff)
parent52246cc7355cedbc9cb992095870572beb767ca1 (diff)
downloadautomake-3a7b60b1ca8a2f2b86acf494d649bff66beb445b.tar.gz
Merge branch 'maint'
* maint: cmdline parsing: move into a dedicated perl module
Diffstat (limited to 'automake.in')
-rw-r--r--automake.in56
1 files changed, 4 insertions, 52 deletions
diff --git a/automake.in b/automake.in
index bf9f0c064..df502386c 100644
--- a/automake.in
+++ b/automake.in
@@ -8331,6 +8331,8 @@ sub parse_arguments ()
my %cli_options =
(
+ 'version' => \&version,
+ 'help' => \&usage,
'libdir=s' => \$libdir,
'gnu' => sub { $strict = 'gnu'; },
'gnits' => sub { $strict = 'gnits'; },
@@ -8345,32 +8347,9 @@ sub parse_arguments ()
'v|verbose' => sub { setup_channel 'verb', silent => 0; },
'W|warnings=s' => \@warnings,
);
- use Getopt::Long;
- Getopt::Long::config ("bundling", "pass_through");
-
- # See if --version or --help is used. We want to process these before
- # anything else because the GNU Coding Standards require us to
- # `exit 0' after processing these options, and we can't guarantee this
- # if we treat other options first. (Handling other options first
- # could produce error diagnostics, and in this condition it is
- # confusing if Automake does `exit 0'.)
- my %cli_options_1st_pass =
- (
- 'version' => \&version,
- 'help' => \&usage,
- # Recognize all other options (and their arguments) but do nothing.
- map { $_ => sub {} } (keys %cli_options)
- );
- my @ARGV_backup = @ARGV;
- Getopt::Long::GetOptions %cli_options_1st_pass
- or exit 1;
- @ARGV = @ARGV_backup;
- # Now *really* process the options. This time we know that --help
- # and --version are not present, but we specify them nonetheless so
- # that ambiguous abbreviation are diagnosed.
- Getopt::Long::GetOptions %cli_options, 'version' => sub {}, 'help' => sub {}
- or exit 1;
+ use Automake::Getopt ();
+ Automake::Getopt::parse_options %cli_options;
set_strictness ($strict);
my $cli_where = new Automake::Location;
@@ -8383,33 +8362,6 @@ sub parse_arguments ()
return unless @ARGV;
- if ($ARGV[0] =~ /^-./)
- {
- my %argopts;
- for my $k (keys %cli_options)
- {
- if ($k =~ /(.*)=s$/)
- {
- map { $argopts{(length ($_) == 1)
- ? "-$_" : "--$_" } = 1; } (split (/\|/, $1));
- }
- }
- if ($ARGV[0] eq '--')
- {
- shift @ARGV;
- }
- elsif (exists $argopts{$ARGV[0]})
- {
- fatal ("option `$ARGV[0]' requires an argument.\n"
- . "Try `$0 --help' for more information");
- }
- else
- {
- fatal ("unrecognized option `$ARGV[0]'.\n"
- . "Try `$0 --help' for more information");
- }
- }
-
my $errspec = 0;
foreach my $arg (@ARGV)
{