# New Ticket Created by  Philip Taylor 
# Please include the string:  [perl #29315]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org:80/rt3/Ticket/Display.html?id=29315 >


  Some changes so that "perl Configure.pl --cc=icl" correctly uses 
the Intel C++ Compiler under Windows:


  config/gen/icu.pl is just updated to think that icl and icl.exe are 
MSVC; it'll do the ICU compilation with the MS compiler, but the 
resultant library is compatible with the Intel compiler.


  config/init/hints/mswin32.pl handles icl similarly to cl, but with 
a different cc ('icl') and ld ('xilink') and ar ('xilib'), and also 
adds libircmt.lib to the library list.
  Also, cc_exe_out was '-Fe' for MSVC, which is the correct flag for 
the C compiler ([i]cl.exe), except it's passed to the linker 
([xi]link.exe) instead and so needs to be '-out:'. (With -Fe it just 
ignores the option and decides on a filename by itself, which 
apparently just happens to be correct.)


icl doesn't like the emptiness of:
    const struct {
        INTVAL func_nr;
        INTVAL left, right;
        funcptr_t func_ptr;
    } _temp_mmd_init[] = {
        /* N/Y */
    };
(complaining "error: incomplete type is not allowed") in 
classes/float.c and classes/mmd_default.c. I altered 
lib/Parrot/Pmc2c.pm to avoid printing that code (and the later loop 
which initialises all 0 elements) if it had decided on using "/* N/Y 
*/".

  With those changes, it all compiles and passes the tests (and still 
works in MSVC).
  [All done with version 8.0.048 of the Intel compiler, and MSVC 7.1]
-- 
Philip Taylor
[EMAIL PROTECTED]


Index: parrot/config/gen/icu.pl
===================================================================
RCS file: /cvs/public/parrot/config/gen/icu.pl,v
retrieving revision 1.10
diff -u -b -r1.10 icu.pl
--- parrot/config/gen/icu.pl    21 Apr 2004 09:10:59 -0000      1.10
+++ parrot/config/gen/icu.pl    2 May 2004 20:42:58 -0000
@@ -74,9 +74,9 @@
 
 #  print "\n";
 
-  # MS VC++ requires special treatment.
+  # MS VC++ and Intel C++ (on Windows) require special treatment.
   my ($cc) = Configure::Data->get(qw(cc));
-  my $is_msvc = grep { $cc eq $_ } ( qw(cl cl.exe) );
+  my $is_msvc = grep { $cc eq $_ } ( qw(cl cl.exe icl icl.exe) );
   if ($is_msvc && -e 'icu\source\allinone\allinone.dsw') {
     # We build from MS VC++ Project Files. If these do not have Win32 line endings, 
it will
     # not accept them. Thus we need to ensure they do.
Index: parrot/config/init/hints/mswin32.pl
===================================================================
RCS file: /cvs/public/parrot/config/init/hints/mswin32.pl,v
retrieving revision 1.19
diff -u -b -r1.19 mswin32.pl
--- parrot/config/init/hints/mswin32.pl 27 Apr 2004 08:09:38 -0000      1.19
+++ parrot/config/init/hints/mswin32.pl 2 May 2004 20:42:59 -0000
@@ -10,6 +10,7 @@
        $cc = $args{cc} if defined $args{cc};
 
        my $is_msvc  = grep { $cc eq $_ } ( qw(cl cl.exe) );
+       my $is_intel = grep { $cc eq $_ } ( qw(icl icl.exe) );
        my $is_mingw = grep { $cc eq $_ } ( qw(gcc gcc.exe) );
        my $is_bcc   = grep { $cc eq $_ } ( qw(bcc32 bcc32.exe) );
 
@@ -36,7 +37,7 @@
                        a          => '.lib',
                        o          => '.obj',
                        cc_o_out   => '-Fo',
-                       cc_exe_out => '-Fe',
+                       cc_exe_out => '-out:',
                        cc_ldflags => '/link',
                        cc_debug   => '-Zi', #ZI messes with __LINE__
                        ld_debug   => '-debug',
@@ -63,7 +64,43 @@
                        Configure::Data->set('linkflags', $linkflags);
                }
            }
-       if( $is_bcc ) {
+       elsif( $is_intel ) {
+               Configure::Data->set(
+                       so         => '.dll',
+                       a          => '.lib',
+                       o          => '.obj',
+                       cc_o_out   => '-Fo',
+                       cc_exe_out => '-out:',
+                       cc_ldflags => '/link',
+                       cc_debug   => '-Zi', #ZI messes with __LINE__
+                       libs       => "$libs libircmt.lib",
+                       ld         => 'xilink',
+                       ld_debug   => '-debug',
+                       ld_shared  => '-dll',
+                       ld_shared_flags=> '-def:libparrot.def',
+                       ld_out     => '-out:',
+                       ldflags    => '-nologo',
+                       blib_lib_libparrot_a => 'blib/lib/libparrot_s$(A)',
+                       cp         => 'copy',
+                       ar         => 'xilib',
+                       ar_flags   => '',
+                       ar_out     => '-out:',
+                       slash      => '\\',
+                       ccflags    => $ccflags,
+                       ccwarn     => ''
+               );
+               # 'link' needs to be xilink.exe, not icl.exe.
+               # This makes 'link' and 'ld' the same.
+               Configure::Data->set('link', Configure::Data->get('ld'));
+
+               # We can't use -opt: and -debug together.
+               if (Configure::Data->get('ld_debug') =~ /-debug/) {
+                       my $linkflags = Configure::Data->get('linkflags');
+                       $linkflags =~ s/-opt:\S+//;
+                       Configure::Data->set('linkflags', $linkflags);
+               }
+       }
+       elsif( $is_bcc ) {
                Configure::Data->set(
                        o => '.obj',
                         a => '.lib',
Index: parrot/lib/Parrot/Pmc2c.pm
===================================================================
RCS file: /cvs/public/parrot/lib/Parrot/Pmc2c.pm,v
retrieving revision 1.19
diff -u -b -r1.19 Pmc2c.pm
--- parrot/lib/Parrot/Pmc2c.pm  1 May 2004 13:05:23 -0000       1.19
+++ parrot/lib/Parrot/Pmc2c.pm  2 May 2004 20:43:51 -0000
@@ -573,9 +573,10 @@
         NULL,   /* isa_str */
         NULL, /* extra data */
         $methlist
-EOC
-    $cout .= <<"EOC";
     };
+EOC
+
+    $cout .= <<"EOC" if $mmd_list ne '/* N/Y */';
 
     const struct {
         INTVAL func_nr;
@@ -584,7 +585,8 @@
     } _temp_mmd_init[] = {
         $mmd_list
     };
-
+EOC
+    $cout .= <<"EOC";
     int i;
 
     /*
@@ -605,6 +607,8 @@
        Parrot_base_vtables[entry] =
            Parrot_clone_vtable(interp, &temp_base_vtable);
     }
+EOC
+    $cout .= <<"EOC" if $mmd_list ne '/* N/Y */';
     /*
      * register mmds
      */
@@ -616,6 +620,8 @@
             _temp_mmd_init[i].right,
             _temp_mmd_init[i].func_ptr);
     }
+EOC
+    $cout .= <<"EOC";
     $class_init_code
 } /* Parrot_${classname}_class_init */
 EOC

Reply via email to