[svn:parrot] r49729 - branches/gcc_defines/config/auto

jkeenan at svn.parrot.org jkeenan at svn.parrot.org
Sat Oct 30 00:02:26 UTC 2010


Author: jkeenan
Date: Sat Oct 30 00:02:26 2010
New Revision: 49729
URL: https://trac.parrot.org/parrot/changeset/49729

Log:
If C compiler is gcc, capture the 'defines' and make them available to Parrot
as 'gccdefines*' in %PConfig.

Modified:
   branches/gcc_defines/config/auto/gcc.pm

Modified: branches/gcc_defines/config/auto/gcc.pm
==============================================================================
--- branches/gcc_defines/config/auto/gcc.pm	Fri Oct 29 23:38:03 2010	(r49728)
+++ branches/gcc_defines/config/auto/gcc.pm	Sat Oct 30 00:02:26 2010	(r49729)
@@ -7,7 +7,8 @@
 
 =head1 DESCRIPTION
 
-Determines whether the C compiler is actually C<gcc>.
+Determines whether the C compiler is actually C<gcc>.  If so, sets
+C<gccdefines*> attributes.
 
 =cut
 
@@ -33,6 +34,16 @@
     my ( $self, $conf ) = @_;
     my $gnucref = _probe_for_gcc($conf);
     my $rv = $self->_evaluate_gcc($conf, $gnucref);
+
+    if (defined( $conf->data->get('gccversion') ) ) {
+        my @gccdefines = `gcc -x c -E -dM /dev/null`;
+        chomp @gccdefines;
+        foreach my $def (@gccdefines) {
+            my @data = split /\s+/, $def, 3;
+            $conf->data->set("gccdefines$data[1]" => $data[2]);
+        }
+    }
+
     return $rv;
 }
 


More information about the parrot-commits mailing list