summaryrefslogtreecommitdiff
path: root/usr.bin/libtool
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2012-07-09 21:59:19 +0000
committerMarc Espie <espie@cvs.openbsd.org>2012-07-09 21:59:19 +0000
commitf7d706ebf40ef45e49a2313a7cdb86dd044aefd6 (patch)
tree20b9d6f90179768e63bb73e8b8c509cbd8239992 /usr.bin/libtool
parenteca3ce1405e250066cfefbe3d8762284f0fec583 (diff)
longarg:
means longoption with a separate parameter, like for -Xcompiler (won't work as -Xcompiler=value)
Diffstat (limited to 'usr.bin/libtool')
-rw-r--r--usr.bin/libtool/LT/Getopt.pm19
-rw-r--r--usr.bin/libtool/LT/Mode/Compile.pm8
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',