Craig A. Berry wrote:
The attached provides the special handling needed for C compiler defines
in ExtUtils::CBuilder. This is against blead but I'm hoping the right
number after -p supplied to patch will apply cleanly to the CPAN version
(which is separately maintained, right?).

This patch against [EMAIL PROTECTED] is an update Craig's patch to handle the cases where there are no defines at all, or only defines from config.

This gets it to pass the tests below in addition to the Module Build test.

lib/ExtUtils/CBuilder/t/01-basic
lib/ExtUtils/CBuilder/t/02-link

The case were there are one or more defines in %args, but not in config is probably still broken, as it will end up with /define(,xxx="a.b") which is an illegal syntax.

I did not realize that until after I started typing this, so hopefully this will be a start to a complete fix.

-John
[EMAIL PROTECTED]
Personal Opinion Only
--- /rsync_root/perl/lib/ExtUtils/CBuilder/Platform/VMS.pm      Wed Sep 28 
20:54:07 2005
+++ lib/Extutils/CBuilder/Platform/VMS.pm       Tue Mar 14 22:21:02 2006
@@ -9,6 +9,28 @@
 
 sub need_prelink { 0 }
 
+sub arg_defines {
+  my ($self, %args) = @_;
+
+  s/"/""/g foreach values %args;
+
+  my $config_defines = '';
+
+  # VMS can only have one define qualifier; add the one from config, if any.
+  if ($self->{config}{ccflags} =~ s{/def[^=]+(?:=)+(?:\()?([^\/\)]*)} {}i) {
+    $config_defines = "$1,";
+  }
+
+  my $new_defines = join(',', map "\"$_=$args{$_}\"", keys %args);
+  $new_defines = '' if $new_defines eq ',';
+
+  if (($new_defines ne '') && ($config_defines ne '')) {
+      return ('/define=(' . $config_defines . $new_defines . ')');
+  } else {
+     return ('');
+  }
+}
+
 sub arg_include_dirs {
   my ($self, @dirs) = @_;
 

Reply via email to