Subject: share/gprconfig/*.xml fixes for Debian
 .
 Patch all files in share/gprconfig/
 .
 Use gcc-4.6 explicitly, so gprbuild does not depend on which top-level
 gcc is installed.
 .
 We put gprbind and gprlib in /lib, not /libexec/gprbuild. We don't
 put them in /usr/lib/${DEB_HOST_MULTIARCH}, because the multiarch
 conventions do not yet address executables.
 .
 Patch the regular expressions that must match the version string
 output by 'gcc' to allow "Debian" in the string.
 .
 We don't change linker.xml and gnat.xml to find gprlib and gprbind in
 /usr/lib/${DEB_HOST_MULTIARCH}, because the multiarch conventions do
 not yet address executables.
 .
 Remove support for GCC 2.8 which is no longer available in Debian.
Author: Stephen Leake <stephen_leake@stephe-leake.org>
Forwarded: not-needed

Index: b/share/gprconfig/asm.xml
===================================================================
--- a/share/gprconfig/asm.xml
+++ b/share/gprconfig/asm.xml
@@ -13,7 +13,7 @@
    end Naming;
 
    package Compiler is
-      for Driver            ("Asm_Cpp") use "${PATH(asm_cpp)}${PREFIX(asm_cpp)}gcc";
+      for Driver            ("Asm_Cpp") use "${PATH(asm_cpp)}${PREFIX(asm_cpp)}gcc-4.6";
       for Leading_Required_Switches ("Asm_Cpp") use
          Compiler'Leading_Required_Switches ("Asm_Cpp") &amp;
          ("-c", "-x", "assembler-with-cpp");
@@ -33,7 +33,7 @@
    end Naming;
 
    package Compiler is
-      for Driver            ("Asm") use "${PATH(asm)}${PREFIX(asm)}gcc";
+      for Driver            ("Asm") use "${PATH(asm)}${PREFIX(asm)}gcc-4.6";
       for Leading_Required_Switches ("Asm") use
         Compiler'Leading_Required_Switches ("Asm") &amp;
         ("-c", "-x", "assembler");
@@ -53,7 +53,7 @@
    end Naming;
 
    package Compiler is
-      for Driver            ("Asm2") use "${PATH(asm2)}${PREFIX(asm2)}gcc";
+      for Driver            ("Asm2") use "${PATH(asm2)}${PREFIX(asm2)}gcc-4.6";
       for Leading_Required_Switches ("Asm2") use
         Compiler'Leading_Required_Switches ("Asm2") &amp;
         ("-c", "-x", "assembler");
Index: b/share/gprconfig/c.xml
===================================================================
--- a/share/gprconfig/c.xml
+++ b/share/gprconfig/c.xml
@@ -23,7 +23,7 @@
      </compilers>
      <config>
    package Compiler is
-      for Driver              ("C") use "${PATH(c)}${PREFIX(c)}gcc";
+      for Driver              ("C") use "${PATH(c)}${PREFIX(c)}gcc-4.6";
    end Compiler;
      </config>
    </configuration>
Index: b/share/gprconfig/compilers.xml
===================================================================
--- a/share/gprconfig/compilers.xml
+++ b/share/gprconfig/compilers.xml
@@ -9,14 +9,14 @@
   <!--    GCC 3.x & 4.x -->
   <compiler_description>
     <name>GCC</name>
-    <executable prefix="1">(.*(-wrs-|-elf-|-eabispe-|avr-|-elinos-linux|-pc).*)?gcc</executable>
+    <executable prefix="1">(.*(-wrs-|-elf-|-eabispe-|avr-|-elinos-linux|-pc).*)?gcc-4.6</executable>
     <version>
-      <external>${PREFIX}gcc -v</external>
-      <grep regexp="^gcc \S+ (\S+)" group="1"></grep>
+      <external>${PREFIX}gcc-4.6 -dumpversion</external>
+      <grep regexp=".+"></grep>
     </version>
     <languages>C</languages>
     <target>
-      <external>${PREFIX}gcc -dumpmachine</external>
+      <external>${PREFIX}gcc-4.6 -dumpmachine</external>
       <grep regexp="[^\r\n]+"></grep>
     </target>
   </compiler_description>
@@ -135,26 +135,6 @@
     <target name="^.*-wrs-vxworksmils$" />
   </compiler_description>
 
-  <!--     GCC 2.8.1
-    There is no switch, in such versions, to find out the list of languages,
-    so we just assume there is only C.
-    C++ could be found by looking for the "g++" executable
-  -->
-  <compiler_description>
-    <name>GCC-28</name>
-    <executable>gcc</executable>
-    <version>
-      <external>gcc -v</external>
-      <grep regexp="^gcc \S+ (\S+)" group="1"></grep>
-      <must_match>2\.8\.</must_match>
-    </version>
-    <languages>C</languages>
-    <target>
-      <external>gcc -dumpmachine</external>
-      <grep regexp="[^\r\n]+"></grep>
-    </target>
-  </compiler_description>
-
   <!--    GNAAMP -->
   <compiler_description>
     <name>GNAAMP</name>
@@ -170,14 +150,14 @@
   <!--  G++ compilers, including recent CodeSourcery compilers  -->
   <compiler_description>
     <name>G++</name>
-    <executable>g\+\+</executable>
+    <executable>g\+\+-4\.6</executable>
     <version>
-      <external>g++ -v</external>
-      <grep regexp="^gcc \S+ (\S+)" group="1"></grep>
+      <external>g++-4.6 -dumpversion</external>
+      <grep regexp=".+"></grep>
     </version>
     <languages>C++</languages>
     <target>
-      <external>g++ -dumpmachine</external>
+      <external>g++-4.6 -dumpmachine</external>
       <grep regexp="[^\r\n]+"></grep>
     </target>
   </compiler_description>
@@ -296,23 +276,21 @@
   <!--  Assembler -->
   <compiler_description>
     <name>GCC-ASM</name>
-    <executable prefix="1">(.*(-wrs-|-elf-|-eabispe-|avr-|elinos-linux).*)?gcc</executable>
+    <executable prefix="1">(.*(-wrs-|-elf-|-eabispe-|avr-|elinos-linux).*)?gcc-4.6</executable>
     <version>
-      <external>${PREFIX}gcc -v</external>
-      <grep regexp="^gcc \S+ (\S+)" group="1"></grep>
+      <external>${PREFIX}gcc-4.6 -dumpversion</external>
+      <grep regexp=".+"></grep>
     </version>
     <languages>Asm,Asm_Cpp,Asm2</languages>
     <target>
-      <external>${PREFIX}gcc -dumpmachine</external>
+      <external>${PREFIX}gcc-4.6 -dumpmachine</external>
       <grep regexp="[^\r\n]+"></grep>
     </target>
   </compiler_description>
 
    <!--   GNAT
     To find the list of supported runtimes, we check the contents of
-    the directory. To be compatible with older versions of GNAT (3.16
-    for instance), we also accept lib/gcc-lib as the directory that
-    contains the runtime files.
+    the directory.
 
     Implementation note: we put two spaces after -adainclude $... in
     the external_tool, because on windows the path will end with a
@@ -326,17 +304,17 @@
       <grep regexp="^GNATLS.+?(\d+(\.\d+)?)" group="1"></grep>
     </version>
     <variable name="gcc_version">
-      <external>${PREFIX}gcc -v</external>
-      <grep regexp="^.*gcc \S+ (\S+)" group="1"></grep>
+      <external>${PREFIX}gcc-4.6 -dumpversion</external>
+      <grep regexp=".+"></grep>
     </variable>
     <languages>Ada</languages>
     <runtimes default="default,kernel">
-       <directory group="default" >\.\./lib/gcc(-lib)?/$TARGET/$gcc_version/adalib/</directory>
-       <directory group="default" >\.\./lib/gcc(-lib)?/$TARGET/$gcc_version/ada_source_path</directory>
-       <directory group="2" >\.\./lib/gcc(-lib)?/$TARGET/$gcc_version/rts-(.*)/adalib/</directory>
+       <directory group="default" >\.\./lib/gcc/$TARGET/$gcc_version/adalib/</directory>
+       <directory group="default" >\.\./lib/gcc/$TARGET/$gcc_version/ada_source_path</directory>
+       <directory group="2" >\.\./lib/gcc/$TARGET/$gcc_version/rts-(.*)/adalib/</directory>
     </runtimes>
     <target>
-      <external>${PREFIX}gcc -dumpmachine</external>
+      <external>${PREFIX}gcc-4.6 -dumpmachine</external>
       <grep regexp="[^\r\n]+"></grep>
     </target>
   </compiler_description>
@@ -391,14 +369,14 @@
   <!--    mingw-cygwin compiler  -->
   <compiler_description>
     <name>GCC-CYGMING</name>
-    <executable>gcc</executable>
+    <executable prefix="1">(.*mingw32-)g\+\+</executable>
     <version>
-      <external>gcc --version</external>
+      <external>${PREFIX}gcc --version</external>
       <grep regexp="\(GCC\) (\S+).*\(cygming special\)" group="1"></grep>
     </version>
     <languages>C,C++,Fortran</languages>
     <target>
-      <external>gcc -mno-cygwin -dumpmachine</external>
+      <external>${PREFIX}gcc -mno-cygwin -dumpmachine</external>
       <grep regexp="[^\r\n]+"></grep>
     </target>
   </compiler_description>
Index: b/share/gprconfig/cpp.xml
===================================================================
--- a/share/gprconfig/cpp.xml
+++ b/share/gprconfig/cpp.xml
@@ -24,7 +24,7 @@
      </compilers>
      <config>
    package Compiler is
-      for Driver              ("C++") use "${PATH(c++)}g++${PREFIX(c++)}";
+      for Driver              ("C++") use "${PATH(c++)}g++-4.6${PREFIX(c++)}";
    end Compiler;
      </config>
    </configuration>
Index: b/share/gprconfig/fortran.xml
===================================================================
--- a/share/gprconfig/fortran.xml
+++ b/share/gprconfig/fortran.xml
@@ -50,7 +50,7 @@
    end Naming;
 
    package Compiler is
-      for Driver            ("Fortran") use "${PATH(fortran)}gfortran${PREFIX(fortran)}";
+      for Driver            ("Fortran") use "${PATH(fortran)}gfortran-4.6${PREFIX(fortran)}";
       for Leading_Required_Switches ("Fortran") use
          Compiler'Leading_Required_Switches ("Fortran") &amp;
          ("-c", "-fno-underscoring");
Index: b/share/gprconfig/gnat.xml
===================================================================
--- a/share/gprconfig/gnat.xml
+++ b/share/gprconfig/gnat.xml
@@ -52,7 +52,7 @@
           Binder'Required_Switches ("Ada")  &amp;
           ("-I-", "ada_binder=gnaampbind");
       for Driver         ("Ada") use
-          "${GPRCONFIG_PREFIX}/libexec/gprbuild/gprbind";
+          "${GPRCONFIG_PREFIX}/lib/gprbind";
    end Binder;
 
    for Toolchain_Version     ("Ada") use "GNAT ${VERSION(ada)}";
@@ -73,7 +73,7 @@
    end Naming;
 
    package Compiler is
-      for Driver                   ("Ada") use "${PATH(ada)}${PREFIX(ada)}gcc";
+      for Driver                   ("Ada") use "${PATH(ada)}${PREFIX(ada)}gcc-4.6";
       for Leading_Required_Switches        ("Ada") use
           Compiler'Leading_Required_Switches ("Ada")
 	     &amp; ("-c", "-x", "ada", "-gnatA");
@@ -89,7 +89,7 @@
       for Required_Switches     ("Ada") use
           Binder'Required_Switches ("Ada")  &amp; ("-I-");
       for Driver         ("Ada") use
-          "${GPRCONFIG_PREFIX}libexec/gprbuild/gprbind";
+          "${GPRCONFIG_PREFIX}lib/gprbind";
    end Binder;
 
    for Toolchain_Version     ("Ada") use "GNAT ${VERSION(ada)}";
Index: b/share/gprconfig/linker.xml
===================================================================
--- a/share/gprconfig/linker.xml
+++ b/share/gprconfig/linker.xml
@@ -242,7 +242,7 @@
     </targets>
     <config>
    for Library_Support  use "static_only";
-   for Library_Builder  use "${GPRCONFIG_PREFIX}libexec/gprbuild/gprlib";
+   for Library_Builder  use "${GPRCONFIG_PREFIX}lib/gprlib";
     </config>
   </configuration>
 
@@ -280,13 +280,13 @@
        <target name="^.*darwin.*$" />
     </targets>
     <config>
-   for Library_Builder use "${GPRCONFIG_PREFIX}libexec/gprbuild/gprlib";
+   for Library_Builder use "${GPRCONFIG_PREFIX}lib/gprlib";
    for Library_Support use "full";
    for Shared_Library_Prefix use "lib";
    for Symbolic_Link_Supported use "true";
    for Library_Major_Minor_Id_Supported use "true";
 
-   for Run_Path_Option  use ("-Wl,-rpath,");
+   for Run_Path_Option  use ();
    for Separate_Run_Path_Options use "true";
    for Run_Path_Origin use "@executable_path";
    for Library_Install_Name_Option use "-Wl,-install_name,@rpath";
@@ -309,7 +309,7 @@
        <target name="^.*hpux.*$" />
     </targets>
     <config>
-   for Library_Builder  use "${GPRCONFIG_PREFIX}libexec/gprbuild/gprlib";
+   for Library_Builder  use "${GPRCONFIG_PREFIX}lib/gprlib";
    for Library_Support  use "full";
    for Shared_Library_Prefix use "lib";
    for Symbolic_Link_Supported use "true";
@@ -348,7 +348,7 @@
        <target name="^.*irix.*$" />
     </targets>
     <config>
-   for Library_Builder  use "${GPRCONFIG_PREFIX}libexec/gprbuild/gprlib";
+   for Library_Builder  use "${GPRCONFIG_PREFIX}lib/gprlib";
    for Library_Support  use "full";
    for Shared_Library_Prefix use "lib";
    for Symbolic_Link_Supported use "true";
@@ -411,7 +411,7 @@
        <target name="^.*solaris.*$"/>
     </targets>
     <config>
-   for Library_Builder  use "${GPRCONFIG_PREFIX}libexec/gprbuild/gprlib";
+   for Library_Builder  use "${GPRCONFIG_PREFIX}lib/gprlib";
    for Library_Support  use "full";
    for Shared_Library_Prefix use "lib";
    for Symbolic_Link_Supported use "true";
@@ -434,7 +434,7 @@
       <target name="^.*mingw.*$" />
     </targets>
     <config>
-   for Library_Builder  use "${GPRCONFIG_PREFIX}libexec/gprbuild/gprlib";
+   for Library_Builder  use "${GPRCONFIG_PREFIX}lib/gprlib";
    for Library_Support  use "full";
    for Shared_Library_Prefix use "lib";
    for Symbolic_Link_Supported use "false";
@@ -457,7 +457,7 @@
        <target name="^.*osf.*$" />
     </targets>
     <config>
-   for Library_Builder  use "${GPRCONFIG_PREFIX}libexec/gprbuild/gprlib";
+   for Library_Builder  use "${GPRCONFIG_PREFIX}lib/gprlib";
    for Library_Support  use "full";
    for Shared_Library_Prefix use "lib";
    for Symbolic_Link_Supported use "true";
@@ -485,7 +485,7 @@
     </targets>
     <compilers><compiler name="GNAT" /></compilers>
     <config>
-   for Library_Builder  use "${GPRCONFIG_PREFIX}libexec/gprbuild/gprlib";
+   for Library_Builder  use "${GPRCONFIG_PREFIX}lib/gprlib";
    for Library_Support  use "full";
    for Shared_Library_Prefix use "lib";
    for Shared_Library_Suffix use ".exe";
