1 package ExtUtils::CBuilder::Platform::VMS;
4 use ExtUtils::CBuilder::Base;
6 use vars qw($VERSION @ISA);
8 @ISA = qw(ExtUtils::CBuilder::Base);
10 sub need_prelink { 0 }
13 my ($self, %args) = @_;
15 s/"/""/g foreach values %args;
19 # VMS can only have one define qualifier; add the one from config, if any.
20 if ($self->{config}{ccflags} =~ s{/ def[^=]+ =+ \(? ([^\/\)]*) } {}ix) {
21 push @config_defines, $1;
24 return '' unless keys(%args) || @config_defines;
29 map "\"$_" . ( length($args{$_}) ? "=$args{$_}" : '') . "\"",
34 sub arg_include_dirs {
35 my ($self, @dirs) = @_;
37 # VMS can only have one include list, add the one from config.
38 if ($self->{config}{ccflags} =~ s{/inc[^=]+(?:=)+(?:\()?([^\/\)]*)} {}i) {
43 return ('/include=(' . join(',', @dirs) . ')');
47 my ($self, $type, %args) = @_;
49 my $objects = delete $args{objects};
50 $objects = [$objects] unless ref $objects;
52 # VMS has two option files, the external symbol, and to pull in PerlShr
55 $self->prelink(%args, dl_name => $args{module_name});
57 $objects->[-1] .= ',';
59 # If creating a loadable library, the link option file is needed.
60 push @$objects, 'sys$disk:[]' . $temp_files[0] . '/opt,';
62 # VMS always needs the option file for the Perl shared image.
63 push @$objects, $self->perl_inc() . 'PerlShr.Opt/opt';
66 return $self->SUPER::_do_link($type, %args, objects => $objects);
69 sub arg_nolink { return; }
72 my ($self, $file) = @_;
77 my ($self, $file) = @_;
78 return ("/exe=$file");
81 sub arg_share_object_file {
82 my ($self, $file) = @_;
83 return ("$self->{config}{lddlflags}=$file");
88 my ($self, $dl_file) = @_;
89 $dl_file =~ s/\.[^.]+$//;
91 $dl_file = $dl_file .= '.' . $self->{config}{dlext};
93 # Need to create with the same name as DynaLoader will load with.
94 if (defined &DynaLoader::mod2fname) {
95 my ($dev,$dir,$file) = File::Spec->splitpath($dl_file);
96 $file = DynaLoader::mod2fname([$file]);
97 $dl_file = File::Spec->catpath($dev,$dir,$file);