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


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.

diff -r -u parrot-current/config/auto/gcc.pl parrot-andy/config/auto/gcc.pl
--- parrot-current/config/auto/gcc.pl   Sun Nov 14 19:00:11 2004
+++ parrot-andy/config/auto/gcc.pl      Mon Mar  7 15:52:04 2005
@@ -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) {
diff -r -u parrot-current/config/init/hints/solaris.pl 
parrot-andy/config/init/hints/solaris.pl
--- parrot-current/config/init/hints/solaris.pl Wed Feb  2 11:00:06 2005
+++ parrot-andy/config/init/hints/solaris.pl    Mon Mar  7 15:52:22 2005
@@ -6,12 +6,13 @@
        $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);

-- 
       Andy Dougherty           [EMAIL PROTECTED]

Reply via email to