diff options
-rw-r--r-- | usr.bin/libtool/LT/Getopt.pm | 19 | ||||
-rw-r--r-- | usr.bin/libtool/LT/Mode/Compile.pm | 8 |
2 files changed, 19 insertions, 8 deletions
diff --git a/usr.bin/libtool/LT/Getopt.pm b/usr.bin/libtool/LT/Getopt.pm index aba27228741..62565707965 100644 --- a/usr.bin/libtool/LT/Getopt.pm +++ b/usr.bin/libtool/LT/Getopt.pm @@ -1,4 +1,4 @@ -# $OpenBSD: Getopt.pm,v 1.8 2012/07/09 21:38:38 espie Exp $ +# $OpenBSD: Getopt.pm,v 1.9 2012/07/09 21:59:18 espie Exp $ # Copyright (c) 2012 Marc Espie <espie@openbsd.org> # @@ -28,6 +28,8 @@ sub factory return Option::ShortArg->new($1); } elsif (m/^(\-?.*)\=$/) { return Option::LongArg->new($1); + } elsif (m/^(\-?.*)\:$/) { + return Option::LongArg0->new($1); } elsif (m/^(\-?.*)$/) { return Option::Long->new($1); } @@ -94,9 +96,8 @@ sub match return 0; } -package Option::LongArg; +package Option::LongArg0; our @ISA = qw(Option::Long); - sub match { my ($self, $_, $opts, $canonical, $code) = @_; @@ -108,6 +109,18 @@ sub match die "Missing argument for option -$$self\n"; } } + return 0; +} + +package Option::LongArg; +our @ISA = qw(Option::LongArg0); + +sub match +{ + my ($self, $_, $opts, $canonical, $code) = @_; + if ($self->SUPER::match($_, $opts, $canonical, $code)) { + return 1; + } if (m/^-\Q$$self\E\=(.*)$/) { &$code($opts, $canonical, $1); return 1; diff --git a/usr.bin/libtool/LT/Mode/Compile.pm b/usr.bin/libtool/LT/Mode/Compile.pm index c2c97508c32..c68bde54330 100644 --- a/usr.bin/libtool/LT/Mode/Compile.pm +++ b/usr.bin/libtool/LT/Mode/Compile.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Compile.pm,v 1.8 2012/07/09 21:38:38 espie Exp $ +# $OpenBSD: Compile.pm,v 1.9 2012/07/09 21:59:18 espie Exp $ # # Copyright (c) 2007-2010 Steven Mestdagh <steven@openbsd.org> # Copyright (c) 2012 Marc Espie <espie@openbsd.org> @@ -48,11 +48,9 @@ sub run sub { $gp->keep_for_later(split(/\,/, shift)); }, - 'Xcompiler', + 'Xcompiler:', sub { - die "-Xcompiler wants an argument" if @main::ARGV == 0; - my $arg = shift @main::ARGV; - $gp->keep_for_later($arg); + $gp->keep_for_later($_[2]); }, # recognize, don't do shit 'no-suppress', |