-- --
-- B o d y --
-- --
--- Copyright (C) 2002-2007, AdaCore --
+-- Copyright (C) 2002-2008, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
package body MLib.Utl is
+ Adalib_Path : String_Access := null;
+ -- Path of the GNAT adalib directory, specified in procedure
+ -- Specify_Adalib_Dir. Used in function Lib_Directory.
+
Gcc_Name : String_Access;
-- Default value of the "gcc" executable used in procedure Gcc
begin
if Ar_Exec = null then
- Ar_Name := Osint.Program_Name (Archive_Builder);
+ Ar_Name := Osint.Program_Name (Archive_Builder, "gnatmake");
Ar_Exec := Locate_Exec_On_Path (Ar_Name.all);
if Ar_Exec = null then
end if;
if Ar_Exec = null then
- Fail (Ar_Name.all, " not found in path");
+ Fail (Ar_Name.all & " not found in path");
elsif Opt.Verbose_Mode then
Write_Str ("found ");
-- ranlib
- Ranlib_Name := Osint.Program_Name (Archive_Indexer);
+ Ranlib_Name := Osint.Program_Name (Archive_Indexer, "gnatmake");
if Ranlib_Name'Length > 0 then
Ranlib_Exec := Locate_Exec_On_Path (Ranlib_Name.all);
end if;
if not Success then
- Fail (Ar_Name.all, " execution error.");
+ Fail (Ar_Name.all & " execution error.");
end if;
-- If we have found ranlib, run it over the library
Success);
if not Success then
- Fail (Ranlib_Name.all, " execution error.");
+ Fail (Ranlib_Name.all & " execution error.");
end if;
end if;
end Ar;
-----------------
procedure Delete_File (Filename : String) is
- File : constant String := Filename & ASCII.Nul;
+ File : constant String := Filename & ASCII.NUL;
Success : Boolean;
begin
if Driver_Name = No_Name then
if Gcc_Exec = null then
if Gcc_Name = null then
- Gcc_Name := Osint.Program_Name ("gcc");
+ Gcc_Name := Osint.Program_Name ("gcc", "gnatmake");
end if;
Gcc_Exec := Locate_Exec_On_Path (Gcc_Name.all);
if Gcc_Exec = null then
- Fail (Gcc_Name.all, " not found in path");
+ Fail (Gcc_Name.all & " not found in path");
end if;
end if;
Driver := Locate_Exec_On_Path (Get_Name_String (Driver_Name));
if Driver = null then
- Fail (Get_Name_String (Driver_Name), " not found in path");
+ Fail (Get_Name_String (Driver_Name) & " not found in path");
end if;
end if;
if not Success then
if Driver_Name = No_Name then
- Fail (Gcc_Name.all, " execution error");
+ Fail (Gcc_Name.all & " execution error");
else
- Fail (Get_Name_String (Driver_Name), " execution error");
+ Fail (Get_Name_String (Driver_Name) & " execution error");
end if;
end if;
end Gcc;
Libgnat : constant String := Tgt.Libgnat;
begin
+ -- If procedure Specify_Adalib_Dir has been called, used the specified
+ -- value.
+
+ if Adalib_Path /= null then
+ return Adalib_Path.all;
+ end if;
+
Name_Len := Libgnat'Length;
Name_Buffer (1 .. Name_Len) := Libgnat;
Get_Name_String (Osint.Find_File (Name_Enter, Osint.Library));
return Name_Buffer (1 .. Name_Len - Libgnat'Length);
end Lib_Directory;
+ ------------------------
+ -- Specify_Adalib_Dir --
+ ------------------------
+
+ procedure Specify_Adalib_Dir (Path : String) is
+ begin
+ if Path'Length = 0 then
+ Adalib_Path := null;
+ else
+ Adalib_Path := new String'(Path);
+ end if;
+ end Specify_Adalib_Dir;
+
end MLib.Utl;