<?xml version="1.0" ?>
<gprconfig>
   <!--  This package provides adjustments for cross compilers -->

   <!-- Windows executables have extension .exe -->
   <configuration>
     <targets>
       <target name="dotnet" />
       <target name="mingw" />
       <!-- LLVM version of the "mingw" triplet -->
       <target name="windows" />
     </targets>
     <config>
   package Builder is
      for Executable_Suffix use ".exe";
   end Builder;
     </config>
   </configuration>

   <!-- on some targets, executables do not have any extension -->
   <configuration>
     <targets>
       <target name="^x86_64-elf$" />
       <target name="^i686-elf$" />
       <target name="^visium-elf$" />
       <target name="^r7-elf$" />
       <target name="^riscv(32|64)(c)?(-none|-unknown)?-elf$" />
       <target name="^m68020-elf$" />
       <target name="^morello(-unknown-unknown)?-elf$" />
       <target name="^powerpc-elf$" />
       <target name="^powerpc-elf-lynxos5$" />
       <target name="^.*lynxos178.*$" />
       <target name="^powerpc-eabispe$" />
       <target name="^avr$" />
       <target name="^leon-elf$" />
       <target name="^leon3-elf$" />
       <target name="^aarch64(-unknown-unknown)?-elf$" />
       <target name="^arm(-none)?-eabi$" />
       <target name="^.*-elinos-linux$" />
       <target name="^.*-fastos.*$" />
       <target name="^.*-freebsd.*$" />
       <target name="^.*-generic-linux-gnu$" />
       <target name="^.*-pikeos.*$" />
       <target name="^.*-qnx[0-9]*$" />
       <target name="^.*-rtems.*$" />
       <target name="^arm-linux-androideabi" />
       <target name="^arm-linux-gnueabi" />
       <target name="^arm-linux-gnueabihf" />
       <target name="^aarch64-linux-android" />
       <target name="^aarch64-.*linux-gnu" />
       <target name="^e500v2-gnu-linux" />
       <target name="^.*-netbsd.*$" />
       <target name="^.*-dragonfly.*$" />
     </targets>
     <config>
   package Builder is
      for Executable_Suffix use "";
   end Builder;
     </config>
   </configuration>

   <!-- Import PIKEOS_TARGET_FILES on PikeOS targets.  -->
   <configuration>
     <targets>
       <target name="^.*-sysgo-pikeos.*$" />
     </targets>
     <config>
   Pikeos_Target_Files := external ("PIKEOS_TARGET_FILES");
     </config>
   </configuration>

   <!-- Forbid mixing restricted rts with full rts.  -->
   <!-- Watch out: "ravenscar-cert-rtp" matches both "rtp" and "cert" -->
   <configuration>
     <compilers><compiler runtime="rtp" /></compilers>
     <compilers><compiler runtime="kernel" /></compilers>
     <config></config>
   </configuration>

   <configuration>
     <compilers><compiler runtime="cert" /></compilers>
     <compilers><compiler runtime="kernel" /></compilers>
     <config></config>
   </configuration>

   <configuration>
     <compilers><compiler runtime="light" /></compilers>
     <compilers><compiler runtime="kernel" /></compilers>
     <config></config>
   </configuration>

   <configuration>
     <compilers><compiler runtime="cert" /></compilers>
     <compilers><compiler runtime="^rtp$" /></compilers>
     <config></config>
   </configuration>

   <configuration>
     <compilers><compiler runtime="light" /></compilers>
     <compilers><compiler runtime="^rtp$" /></compilers>
     <config></config>
   </configuration>

   <configuration>
     <compilers><compiler runtime="rtp" /></compilers>
     <compilers><compiler runtime="^ravenscar-cert$" /></compilers>
     <config></config>
   </configuration>

   <configuration>
     <compilers><compiler runtime="rtp" /></compilers>
     <compilers><compiler runtime="^light-tasking$" /></compilers>
     <config></config>
   </configuration>

   <!-- mlongcall is passed by default in the case of GNAT.
        Do the same thing for WRS compilers for consistency.  -->

   <configuration>
     <compilers>
       <compiler name="^GCC-WRS5$" />
     </compilers>
     <targets>
       <target name="^powerpc-wrs-vxworks.*$" />
       <target name="^e500v2-wrs-vxworks.*$" />
     </targets>
     <config>
   package Compiler is
      for Leading_Required_Switches ("C") use
        Compiler'Leading_Required_Switches ("C")
        &amp; ("-mlongcall");
   end Compiler;
     </config>
   </configuration>

   <configuration>
     <compilers>
       <compiler name="^G\+\+-WRS5$" />
     </compilers>
     <targets>
       <target name="^powerpc-wrs-vxworks.*$" />
       <target name="^e500v2-wrs-vxworks.*$" />
     </targets>
     <config>
   package Compiler is
      for Leading_Required_Switches ("C++") use
        Compiler'Leading_Required_Switches ("C++")
        &amp; ("-mlongcall");
   end Compiler;
     </config>
   </configuration>

   <configuration>
     <compilers>
       <compiler name="^GNAT$"/>
       <compiler name="^GCC$"/>
       <compiler name="^GCC-SYSGO-X86$"/>
       <compiler name="^GCC-SYSGO-PPC$"/>
       <compiler name="^G\+\+$"/>
     </compilers>
     <targets>
       <target name="^.*-sysgo-pikeos.*$" />
     </targets>
     <config>
   package Compiler is
      for Leading_Required_Switches ("C") use
        Compiler'Leading_Required_Switches ("C")
        &amp; ("-fno-builtin");
   end Compiler;

   package Linker is
      for Required_Switches use
        Linker'Required_Switches
        &amp; ("-L" &amp; Pikeos_Target_Files &amp; "/scripts",
               "-L" &amp; Pikeos_Target_Files &amp; "/lib");
   end Linker;
     </config>
   </configuration>

   <!-- require specification of run-time for VxWorks 5 using GNAT for C -->
   <configuration>
     <compilers>
       <compiler name="^GCC$" runtime="^soft-float$" />
       <compiler name="^GCC-WRS5$" runtime="^soft-float$" />
     </compilers>
     <targets>
       <target name="^.*-wrs-vxworks$" />
     </targets>
     <config>
   package Compiler is
      for Leading_Required_Switches ("C") use
        Compiler'Leading_Required_Switches ("C")
        &amp; ("-I" &amp; Wind_Base &amp; "/target/h",
               "-msoft-float");
   end Compiler;
     </config>
   </configuration>

   <!-- require specification of run-time for VxWorks 5 using GNAT for C -->
   <configuration>
     <compilers>
       <compiler name="^GCC$" runtime="^default$" />
       <compiler name="^GCC-WRS5$" />
       <compiler name="^GCC-WRS5$" runtime="^default$" />
      </compilers>
     <targets>
       <target name="^.*-wrs-vxworks$" />
     </targets>
     <config>
   package Compiler is
      for Leading_Required_Switches ("C") use
        Compiler'Leading_Required_Switches ("C")
        &amp; ("-I" &amp; Wind_Base &amp; "/target/h");
   end Compiler;
     </config>
   </configuration>

   <!--  Set prefix of gnatbind -->
   <configuration>
     <compilers>
       <compiler name="^GNAT$" />
       <compiler name="^GNAT_DOTNET$" />
       <compiler name="^JGNAT$" />
       <compiler name="^GNAT_C$" />
       <compiler name="^GNAT_CODEPEER$" />
       <compiler name="^GNAT_LLVM$" />
       <compiler name="^GNAT_LLVM_VXWORKS$" />
       <compiler name="^GNAT_LLVM-.*$" />
       <compiler name="^GNAT_LLVM_NATIVE$" />
       <compiler name="^GNAT_CCG$" />
     </compilers>
     <config>
   package Binder is
      for Required_Switches ("Ada") use
          Binder'Required_Switches ("Ada") &amp;
          ("gnatbind_prefix=${PREFIX(ada)}");
   end Binder;
     </config>
   </configuration>

   <!--  Set prefix of gnatbind for CUDA -->
   <configuration>
     <compilers>
       <compiler name="^GNAT_CUDA$" />
     </compilers>
     <config>
   package Binder is
      for Required_Switches ("Ada") use
          Binder'Required_Switches ("Ada") &amp;
          ("gnatbind_prefix=llvm-");
   end Binder;
     </config>
   </configuration>

  <!--  Set mcmodel large for x86_64-vx7r2 for kernel-large rts -->
  <configuration>
     <compilers>
         <compiler runtime="kernel-large" />
     </compilers>
     <targets>
       <target name="^x86_64-wrs-vxworks7r2.*$" />
     </targets>
     <config>
        package Compiler is
           for Required_Switches ("Ada")  use
               Compiler'Required_Switches  ("Ada") &amp;
               ("-mcmodel=large");
           for Required_Switches ("C")  use
               Compiler'Required_Switches  ("C") &amp;
               ("-mcmodel=large");
           for Required_Switches ("C++")  use
               Compiler'Required_Switches  ("C++") &amp;
               ("-mcmodel=large");
           for Required_Switches ("Asm")  use
               Compiler'Required_Switches  ("Asm") &amp;
               ("-mcmodel=large");
           for Required_Switches ("Asm2")  use
               Compiler'Required_Switches  ("Asm2") &amp;
               ("-mcmodel=large");
           for Required_Switches ("Asm_Cpp")  use
               Compiler'Required_Switches  ("Asm_Cpp") &amp;
               ("-mcmodel=large");
        end Compiler;
        package Linker is
           for Required_Switches use
               Linker'Required_Switches &amp;
               ("-mcmodel=large");
        end Linker;
     </config>
  </configuration>

  <!--  Forward the sysroot from ENV_PREFIX to Clang  -->
  <configuration>
    <compilers>
      <compiler name="^CLANG-.*$" />
      <compiler name="^GNAT_LLVM$" />
      <compiler name="^GNAT_LLVM-.*$" />
    </compilers>
    <targets>
      <target name="^aarch64-unknown-linux-gnu$" />
      <target name="^powerpc-unknown-lynxos178-xcoff$" />
    </targets>
    <hosts negate="true">
      <host name="^aarch64-linux-gnu$" />
    </hosts>
    <config>
   Env_Prefix := External ("ENV_PREFIX", "");

   package Compiler is
      case Env_Prefix is
         when "" =>
            null;
         when others =>
            for Required_Switches ("C") use
              Compiler'Required_Switches ("C") &amp;
              ("--sysroot=" &amp; Env_Prefix);
            for Required_Switches ("C++") use
              Compiler'Required_Switches ("C++") &amp;
              ("--sysroot=" &amp; Env_Prefix);
            for Required_Switches ("Asm") use
              Compiler'Required_Switches ("Asm") &amp;
              ("--sysroot=" &amp; Env_Prefix);
            for Required_Switches ("Asm2") use
              Compiler'Required_Switches ("Asm2") &amp;
              ("--sysroot=" &amp; Env_Prefix);
            for Required_Switches ("Asm_Cpp") use
              Compiler'Required_Switches ("Asm_Cpp") &amp;
              ("--sysroot=" &amp; Env_Prefix);
      end case;
   end Compiler;
   package Linker is
      for Required_Switches use Linker'Required_Switches &amp;
        ("--sysroot=" &amp; Env_Prefix);
   end Linker;
    </config>
  </configuration>

</gprconfig>
