On Wed, 9 Jan 2008, Jarkko Hietaniemi wrote:

> --- config/init/hints/dec_osf.pm.dist 2008-01-09 04:57:50.000000000 +0200
> +++ config/init/hints/dec_osf.pm      2008-01-09 05:23:23.000000000 +0200

> @@ -43,8 +45,9 @@
>          $conf->data->set( linkflags => $linkflags );
>      }
>  
> -    # Required because of ICU using c++.
> -    $conf->data->set( link => "cxx" );
> +    unless ( $conf->data->get("gccversion") ) {
> +     $conf->data->set( link => "cxx" );
> +    }
>  

But in the normal flow of things, I thought gccversion wasn't set at the 
time when the hints are called.  For solaris, I handled that with a 
callback trigger, something like the patch below.  (But then, I also set 
--link=gcc on the command line, so I haven't tested this lately.)  
Obviously, every platform shouldn't duplicate this code.  (A separate 
patch noting that fact is coming up next.)

diff -r -u parrot-current/config/init/hints/dec_osf.pm 
parrot-andy/config/init/hints/dec_osf.pm
--- parrot-current/config/init/hints/dec_osf.pm 2008-01-09 08:45:11.000000000 
-0500
+++ parrot-andy/config/init/hints/dec_osf.pm    2008-01-09 08:45:37.000000000 
-0500
@@ -39,16 +39,42 @@
         }
     }
 
+    # Callback to be run as soon as the user selects a compiler.
+    # If we're going to be using ICU (or any other C++-compiled library) we
+    # need to use the c++ compiler as a linker.  As soon as the user
+    # selects a compiler, we will run the gccversion test.  (If we were to
+    # wait till it's normally run, the linker question would have already
+    # been asked.)
+    my $dec_osf_link_cb = sub {
+        use Carp;
+        my ( $key, $cc ) = @_;
+        my %gnuc;
+        my $link = $conf->data->get('link');
+        $conf->cc_gen("config/auto/gcc/test_c.in");
+
+        # Can't call cc_build since we haven't set all the flags yet.
+        # This should suffice for this test.
+        my $cc_inc = $conf->data->get('cc_inc');
+        Parrot::Configure::Utils::_run_command( "$cc -o test test.c $cc_inc",
+            'test.cco', 'test.cco' )
+            and confess "C compiler failed (see test.cco)";
+        %gnuc = eval $conf->cc_run() or die "Can't run the test program: $!";
+        if ( defined $gnuc{__GNUC__} ) {
+            $conf->data->set( link => "gcc" );  # Or is it g++ ?
+        }
+        else {
+            $conf->data->set( link => "cxx" );
+        }
+        $conf->data->deltrigger( "cc", "dec_osf_link" );
+    };
+    $conf->data->settrigger( "cc", "dec_osf_link", $dec_osf_link_cb );
+
     my $linkflags = $conf->data->get('linkflags');
     if ( $linkflags !~ /-expect_unresolved/ ) {
         $linkflags = "-expect_unresolved '*' -O4 -msym -std $linkflags";
         $conf->data->set( linkflags => $linkflags );
     }
 
-    unless ( $conf->data->get("gccversion") ) {
-       $conf->data->set( link => "cxx" );
-    }
-
     # Perl 5 hasn't been compiled with this visible.
     $conf->data->set( has_socklen_t => 1 );
 }



-- 
    Andy Dougherty              [EMAIL PROTECTED]


Reply via email to