[svn:parrot] r49458 - in branches/infnan/config/auto: . infnan

plobsing at svn.parrot.org plobsing at svn.parrot.org
Tue Oct 5 23:46:16 UTC 2010


Author: plobsing
Date: Tue Oct  5 23:46:15 2010
New Revision: 49458
URL: https://trac.parrot.org/parrot/changeset/49458

Log:
forgot to add actual configure step

Added:
   branches/infnan/config/auto/infnan/
   branches/infnan/config/auto/infnan.pm
   branches/infnan/config/auto/infnan/test_c.in

Added: branches/infnan/config/auto/infnan.pm
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/infnan/config/auto/infnan.pm	Tue Oct  5 23:46:15 2010	(r49458)
@@ -0,0 +1,66 @@
+# Copyright (C) 2010, Parrot Foundation.
+# $Id$
+
+=head1 NAME
+
+config/auto/infnan.pm - detect INFINITY and NAN
+
+=head1 DESCRIPTION
+
+Determining if the system has INFINITY and NAN defined in headers.
+
+=cut
+
+package auto::infnan;
+
+use strict;
+use warnings;
+
+use base qw(Parrot::Configure::Step);
+
+use Parrot::Configure::Utils ':auto';
+
+sub _init {
+    my $self = shift;
+    my %data;
+    $data{description} = q{Are INFINITY and NAN defined};
+    $data{result}      = q{};
+    return \%data;
+}
+
+sub runstep {
+    my ( $self, $conf ) = @_;
+
+    my $infnan = 0;
+
+    $conf->cc_gen('config/auto/infnan/test_c.in');
+    eval { $conf->cc_build(); };
+    if (!$@) {
+        my $output = eval { $conf->cc_run() };
+        if (!$@ && $output =~ /OK/) {
+            $infnan = 1;
+        }
+    }
+    $conf->cc_clean();
+
+    if ($infnan) {
+        $conf->data->set( HAS_INF_NAN => 1 );
+        $self->set_result('yes');
+    }
+    else {
+        $conf->data->set( HAS_INF_NAN => 0 );
+        $self->set_result('no');
+    }
+
+    return 1;
+}
+
+1;
+
+# Local Variables:
+#   mode: cperl
+#   cperl-indent-level: 4
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:
+

Added: branches/infnan/config/auto/infnan/test_c.in
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/infnan/config/auto/infnan/test_c.in	Tue Oct  5 23:46:15 2010	(r49458)
@@ -0,0 +1,26 @@
+/*
+Copyright (C) 2010, Parrot Foundation.
+$Id$
+
+seeing if INFINITY and NAN are defined
+
+*/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <math.h>
+
+int
+main(int argc, char **argv) {
+    double inf = INFINITY;
+    double nan = NAN;
+    printf("OK: %d %d\n", inf, nan);
+    return EXIT_SUCCESS;
+}
+
+/*
+ * Local variables:
+ *   c-file-style: "parrot"
+ * End:
+ * vim: expandtab shiftwidth=4:
+ */


More information about the parrot-commits mailing list