Hello!

The maintainers of GCC in Fedora have split out libgnat.a and libgnarl.a to a
separate subpackage which is by default not installed together with the Gnat
tools. (Fedora has a policy to use only shared libraries as much as possible.)
This causes Gnatmake to crash when it tries to find the directory that contains
libgnat by looking for libgnat.a and the file isn't there.
This patch is one possible way of improving Gnatmake to also look for 
libgnat.so if it doesn't find libgnat.a, so that it can work with only shared 
libraries installed. I'm not going to claim that it's the best way, but it is 
what I could come up with.

Björn Persson

Changelog entry:
* mlib-tgt-specific-linux.adb (Libgnat_Ptr): Look for libgnat.so if libgnat.a 
is not installed.

--- gcc/ada/mlib-tgt-specific-linux.adb~
+++ gcc/ada/mlib-tgt-specific-linux.adb
@@ -50,6 +50,8 @@
 
    function Is_Archive_Ext (Ext : String) return Boolean;
 
+   function Libgnat return String;
+
    ---------------------------
    -- Build_Dynamic_Library --
    ---------------------------
@@ -142,7 +144,27 @@
       return Ext = ".a" or else Ext = ".so";
    end Is_Archive_Ext;
 
+   -------------
+   -- Libgnat --
+   -------------
+
+   function Libgnat return String is
+      Libgnat_A  : constant String := "libgnat.a";
+      Libgnat_So : constant String := "libgnat.so";
+
+   begin
+      Name_Len := Libgnat_A'Length;
+      Name_Buffer (1 .. Name_Len) := Libgnat_A;
+
+      if Osint.Find_File (Name_Enter, Osint.Library) /= No_File then
+         return Libgnat_A;
+      else
+         return Libgnat_So;
+      end if;
+   end Libgnat;
+
 begin
    Build_Dynamic_Library_Ptr := Build_Dynamic_Library'Access;
-   Is_Archive_Ext_Ptr := Is_Archive_Ext'Access;
+   Is_Archive_Ext_Ptr        := Is_Archive_Ext'Access;
+   Libgnat_Ptr               := Libgnat'Access;
 end MLib.Tgt.Specific;

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to