[svn:parrot] r49769 - in branches/gcc_defines/config/auto: . arch

jkeenan at svn.parrot.org jkeenan at svn.parrot.org
Tue Nov 2 03:04:22 UTC 2010


Author: jkeenan
Date: Tue Nov  2 03:04:22 2010
New Revision: 49769
URL: https://trac.parrot.org/parrot/changeset/49769

Log:
Implement attempt at probe for rtems based on suggestion by doughera++.

Added:
   branches/gcc_defines/config/auto/arch/
   branches/gcc_defines/config/auto/arch/test_rtems.in   (contents, props changed)
      - copied, changed from r49764, branches/gcc_defines/config/auto/gcc/test_c.in
Modified:
   branches/gcc_defines/config/auto/arch.pm

Modified: branches/gcc_defines/config/auto/arch.pm
==============================================================================
--- branches/gcc_defines/config/auto/arch.pm	Tue Nov  2 01:45:23 2010	(r49768)
+++ branches/gcc_defines/config/auto/arch.pm	Tue Nov  2 03:04:22 2010	(r49769)
@@ -95,6 +95,13 @@
     $cpuarch =~ s/i[456]86/i386/i;
     $cpuarch =~ s/x86_64/amd64/i;
 
+    # At this point, we check for __rtems__.  If the probe returns
+    # successfully, we'll set osname => 'rtems' regardless of what we have
+    # determined so far.  We will let our setting for cpuarch stand.  This
+    # will mean that _get_platform() will be set to 'generic'.
+    my $rtems_result = _probe_for_rtems($conf);
+    $osname = 'rtems' if $rtems_result;
+
     $conf->data->set(
         cpuarch  => $cpuarch,
         osname   => $osname
@@ -134,6 +141,20 @@
     return 1;
 }
 
+sub _probe_for_rtems {
+    my $conf = shift;
+    $conf->cc_gen("config/auto/arch/test_rtems.in");
+    eval { $conf->cc_build(); };
+    my $result = 0;
+    if (!$@) {
+        if ($conf->cc_run_capture() =~ /rtems/) {
+           $result++;
+       }
+    } 
+    $conf->cc_clean();
+    return $result;
+}
+
 1;
 
 # Local Variables:

Copied and modified: branches/gcc_defines/config/auto/arch/test_rtems.in (from r49764, branches/gcc_defines/config/auto/gcc/test_c.in)
==============================================================================
--- branches/gcc_defines/config/auto/gcc/test_c.in	Mon Nov  1 11:26:04 2010	(r49764, copy source)
+++ branches/gcc_defines/config/auto/arch/test_rtems.in	Tue Nov  2 03:04:22 2010	(r49769)
@@ -2,26 +2,22 @@
 Copyright (C) 2002-2009, Parrot Foundation.
 $Id$
 
-figure out if the compiler is gcc.
+Determine whether we're on RTEMS (Real-Time Executive for Multiprocessor
+Systems).  See: http://www.rtems.com/.
+
 */
 
-#include <stdio.h>
 #include <stdlib.h>
 
 int
 main(int argc, char **argv)
 {
-    puts("(");
-#if defined(__GNUC__) && ! defined(__INTEL_COMPILER)
-    printf("__GNUC__ => %d,\n", __GNUC__);
-#  ifdef __GNUC_MINOR__
-    printf("__GNUC_MINOR__ =>%d,\n", __GNUC_MINOR__);
-#  endif
+#ifdef __rtems__
+    printf("__rtems__ => %s,\n", __rtems__);
+    return EXIT_SUCCESS;
 #else
-    puts("__GNUC__ => undef,");
+    return EXIT_FAILURE;
 #endif
-    puts(");");
-    return EXIT_SUCCESS;
 }
 
 /*


More information about the parrot-commits mailing list