… | |
… | |
64 | |
64 | |
65 | package ExtUtils::CXX; |
65 | package ExtUtils::CXX; |
66 | |
66 | |
67 | use common::sense; |
67 | use common::sense; |
68 | |
68 | |
69 | our $VERSION = 0.03; |
69 | our $VERSION = '1.0'; |
70 | |
70 | |
71 | use Exporter 'import'; |
71 | use Exporter 'import'; |
72 | |
72 | |
73 | our @EXPORT = qw(extutils_cxx); |
73 | our @EXPORT = qw(extutils_cxx); |
74 | |
74 | |
… | |
… | |
90 | xlc => "xlC", |
90 | xlc => "xlC", |
91 | cc => "g++", |
91 | cc => "g++", |
92 | c89 => "g++", |
92 | c89 => "g++", |
93 | ); |
93 | ); |
94 | |
94 | |
|
|
95 | our $PREFIX = qr{(?:\S+[\/\\])? (?:ccache|distcc)}x; |
|
|
96 | |
95 | sub _ccrepl { |
97 | sub _ccrepl { |
96 | my ($cfgvar, $env) = @_; |
98 | my ($cfgvar, $env) = @_; |
97 | |
99 | |
98 | my $tie = tied %Config; |
100 | my $tie = tied %Config; |
99 | |
101 | |
… | |
… | |
104 | if ($env) { |
106 | if ($env) { |
105 | $val =~ s/^\S+/$env/; |
107 | $val =~ s/^\S+/$env/; |
106 | } else { |
108 | } else { |
107 | keys %cc; |
109 | keys %cc; |
108 | while (my ($k, $v) = each %cc) { |
110 | while (my ($k, $v) = each %cc) { |
109 | $val =~ s/^ (\S*[\/\\])? $k (-|\s|\d|$) /$1$v$2/x |
111 | $val =~ s/^ ((?:$PREFIX\s+)? \S*[\/\\])? $k (-|\s|\d|$) /$1$v$2/x |
110 | and goto done; |
112 | and goto done; |
111 | } |
113 | } |
112 | |
114 | |
113 | $val =~ s/^\S+/g++/; |
115 | $val =~ s/^($PREFIX\s+)? \S+/$1g++/x; |
114 | |
116 | |
115 | done: ; |
117 | done: ; |
116 | } |
118 | } |
117 | |
119 | |
118 | $tie->{$cfgvar} = $val; |
120 | $tie->{$cfgvar} = $val; |