cvsuser     05/03/08 07:43:44

  Modified:    config/auto gcc.pl
               config/init/hints solaris.pl
  Log:
  [perl #34366] [PATCH] Sun's compiler needs -xlibmieee for atan2
  
  t/op/trans.t tests the atan2() function for some "exceptional" cases
  involving negative 0.0.  By default, Sun's compiler doesn't handle those
  cases, but with the -xlibmieee flag, it does.
  
  This patch adds code to config/auto/hints/solaris.pl to set the flag if
  you're using the Sun compiler.  This also uncovered a problem with the
  config/auto/gcc.pl script where it wasn't setting gccversion in some
  cases.  This had the side effect that Configure 'triggers' based on
  gccversion would only get called if gccversion was defined.  This patch
  also patches gcc.pl to work around that problem.
  
  Courtesy of Andy Dougherty <[EMAIL PROTECTED]>
  
  Revision  Changes    Path
  1.22      +9 -1      parrot/config/auto/gcc.pl
  
  Index: gcc.pl
  ===================================================================
  RCS file: /cvs/public/parrot/config/auto/gcc.pl,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- gcc.pl    14 Nov 2004 21:14:32 -0000      1.21
  +++ gcc.pl    8 Mar 2005 15:43:43 -0000       1.22
  @@ -1,6 +1,6 @@
   #! perl -w
   # Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
  -# $Id: gcc.pl,v 1.21 2004/11/14 21:14:32 brentdax Exp $
  +# $Id: gcc.pl,v 1.22 2005/03/08 15:43:43 leo Exp $
   
   =head1 NAME
   
  @@ -35,14 +35,22 @@
     my($gccversion, $warns, $ccwarn);
     $ccwarn=Configure::Data->get('ccwarn');
   
  +  # Set gccversion to undef.  This will also trigger any hints-file
  +  # callbacks that depend on knowing whether or not we're using gcc.
  +
  +  # This key should always exist unless the program couldn't be run,
  +  # which should have been caught by the 'die' above.
     unless (exists $gnuc{__GNUC__}) {
  +    Configure::Data->set(gccversion => undef);
       return;
     }
  +  
     my $major = $gnuc{__GNUC__};
     my $minor = $gnuc{__GNUC_MINOR__};
     unless (defined $major) {
       print " (no) " if $_[1];
       $Configure::Step::result = 'no';
  +    Configure::Data->set(gccversion => undef);
       return;
     }
     if ($major =~ tr/0-9//c) {
  
  
  
  1.6       +33 -7     parrot/config/init/hints/solaris.pl
  
  Index: solaris.pl
  ===================================================================
  RCS file: /cvs/public/parrot/config/init/hints/solaris.pl,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- solaris.pl        2 Feb 2005 12:23:29 -0000       1.5
  +++ solaris.pl        8 Mar 2005 15:43:44 -0000       1.6
  @@ -1,17 +1,18 @@
   # Copyright: 2005 The Perl Foundation.  All Rights Reserved.
  -# $Id: solaris.pl,v 1.5 2005/02/02 12:23:29 leo Exp $
  +# $Id: solaris.pl,v 1.6 2005/03/08 15:43:44 leo Exp $
   
   my $libs = Configure::Data->get('libs');
   if ( $libs !~ /-lpthread/ ) {
       $libs .= ' -lpthread';
   }
   if ( $libs !~ /-lrt\b/ ) {
  -    $libs .= ' -lrt';
  +    $libs .= ' -lrt';      # Needed for sched_yield.
   }
   Configure::Data->set(
       libs => $libs,
   );
   
  +################################################################
   my $link = Configure::Data->get('link');
   # Going to assume Sun's compiler
   # In which case we need to link with the C++ compiler (CC) rather than the
  @@ -20,14 +21,39 @@
   Configure::Data->set('link', $link);
   
   # if it turns out we're using gcc, then we need to make sure we're linking
  -# with g++, not gcc.  We can't make this decision until later, because the
  -# gcc test hasn't been run yet.
  -my $solaris_cb = sub {
  +# with g++, not gcc.  We can't make this decision until the gccversion test
  +# has been run.
  +my $solaris_link_cb = sub {
     my ($key, $gccversion) = @_;
     if ($gccversion) {
       Configure::Data->set('link', 'g++');
  -    Configure::Data->deltrigger("gccversion", "solaris_hints");
  +    Configure::Data->deltrigger("gccversion", "solaris_link");
     }
   };
  +Configure::Data->settrigger("gccversion", "solaris_link", $solaris_link_cb);
   
  -Configure::Data->settrigger("gccversion", "solaris_hints", $solaris_cb);
  +################################################################
  +# Parrot usually aims for IEEE-754 compliance.
  +# For Solaris 8/Sun Workshop Pro 4, both
  +#    atan2( 0.0, -0.0) and atan2(-0.0, -0.0)
  +# return 0, when they should return +PI and -PI respectively.
  +# For Sun's compilers, fix this with the -xlibmieee flag.
  +# I don't know of an equivalent flag for gcc.
  +# (Alternatively, and more generally, perhahs we should run an
  +# ieee-conformance test and then call back into a hints-file trigger
  +# to set platform-specific flags.
  +#    A. Dougherty  7 March 2005
  +# We don't know which compiler we're using till after the gccversion test.
  +my $solaris_ieee_cb = sub {
  +    my ($key, $gccversion) = @_;
  +    if ($gccversion) {
  +     # Don't know how to do this for gcc.
  +    }
  +    else {
  +     my $linkflags = Configure::Data->get('linkflags');
  +     Configure::Data->add(' ', 'linkflags', '-xlibmieee')
  +             unless $linkflags =~ /-xlibmieee/;
  +    }
  +    Configure::Data->deltrigger("gccversion", "solaris_ieee");
  +};
  +Configure::Data->settrigger("gccversion", "solaris_ieee", $solaris_ieee_cb);
  
  
  

Reply via email to