4 unshift @INC, ($::ENV{'BUILD_DIR'} || '/usr/lib/build');
11 my ($dist, $archs, $configdir, $debug);
14 if ($ARGV[0] eq '--dist') {
19 if ($ARGV[0] eq '--archpath') {
24 if ($ARGV[0] eq '--configdir') {
26 $configdir = shift @ARGV;
29 if ($ARGV[0] eq '--debug') {
37 die("Usage: getoptflags --dist <dist> --archpath <archpath> [--configdir <configdir>]\n") if @ARGV;
39 my $cf = Build::read_config_dist($dist, $archs, $configdir);
40 exit 0 unless $cf->{'optflags'};
41 my $all = $cf->{'optflags'}->{'*'};
42 $all = defined($all) && $all ne '' ? " $all" : '';
43 $all .= " -g" if $debug;
44 for (sort keys %{$cf->{'optflags'}}) {
46 print "optflags: $_ $cf->{'optflags'}->{$_}$all\n";