Commit f95969ea by Vincent Celier Committed by Arnaud Charlet

mlib-tgt-lynxos.adb, [...]: Use Append_To, instead of Ext_To, when building the library file name

2006-10-31  Vincent Celier  <celier@adacore.com>
	    Eric Botcazou  <ebotcazou@adacore.com>

	* mlib-tgt-lynxos.adb, mlib-tgt-mingw.adb, mlib-tgt-tru64.adb,
	mlib-tgt-aix.adb, mlib-tgt-irix.adb, mlib-tgt-hpux.adb,
	mlib-tgt-linux.adb, mlib-tgt-solaris.adb: Use Append_To, instead of
	Ext_To, when building the library file name

	* mlib-tgt-vxworks.adb: ditto.
	(Get_Target_Suffix): Add support for x86 targets.

	* mlib-fil.ads, mlib-fil.adb: (Append_To): New function

	* mlib-tgt-darwin.adb: 
	Use Append_To, instead of Ext_To, when building the library file name
	(Flat_Namespace): New global variable.
	(No_Shared_Libgcc_Switch): Rename to No_Shared_Libgcc_Options.
	(Shared_Libgcc_Switch): Rename to With_Shared_Libgcc_Options.
	(Link_Shared_Libgcc): Delete.
	(Build_Dynamic_Library): Adjust for above changes.
	Use Opt package.
	(Build_Dynamic_Library): Pass -shared-libgcc if GCC 4 or later.

From-SVN: r118237
parent f28ded01
...@@ -35,14 +35,43 @@ package body MLib.Fil is ...@@ -35,14 +35,43 @@ package body MLib.Fil is
package Target renames MLib.Tgt; package Target renames MLib.Tgt;
---------------
-- Append_To --
---------------
function Append_To
(Filename : String;
Ext : String) return String
is
begin
if Ext'Length = 0 then
return Filename;
elsif Filename (Filename'Last) = '.' then
if Ext (Ext'First) = '.' then
return Filename & Ext (Ext'First + 1 .. Ext'Last);
else
return Filename & Ext;
end if;
else
if Ext (Ext'First) = '.' then
return Filename & Ext;
else
return Filename & '.' & Ext;
end if;
end if;
end Append_To;
------------ ------------
-- Ext_To -- -- Ext_To --
------------ ------------
function Ext_To function Ext_To
(Filename : String; (Filename : String;
New_Ext : String := "") New_Ext : String := "") return String
return String
is is
use Strings.Fixed; use Strings.Fixed;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 2001-2005, AdaCore -- -- Copyright (C) 2001-2006, AdaCore --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -30,9 +30,13 @@ package MLib.Fil is ...@@ -30,9 +30,13 @@ package MLib.Fil is
function Ext_To function Ext_To
(Filename : String; (Filename : String;
New_Ext : String := "") New_Ext : String := "") return String;
return String; -- Return Filename with the extension changed to New_Ext
-- Return Filename with the extension change to New_Ext
function Append_To
(Filename : String;
Ext : String) return String;
-- Return Filename with the extension Ext
function Get_Ext (Filename : String) return String; function Get_Ext (Filename : String) return String;
-- Return extension of filename -- Return extension of filename
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 2003-2005, AdaCore -- -- Copyright (C) 2003-2006, AdaCore --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -138,7 +138,7 @@ package body MLib.Tgt is ...@@ -138,7 +138,7 @@ package body MLib.Tgt is
Lib_File : constant String := Lib_File : constant String :=
Lib_Dir & Directory_Separator & "lib" & Lib_Dir & Directory_Separator & "lib" &
MLib.Fil.Ext_To (Lib_Filename, DLL_Ext); MLib.Fil.Append_To (Lib_Filename, DLL_Ext);
-- The file name of the library -- The file name of the library
Thread_Opts : Argument_List_Access := Empty_Argument_List; Thread_Opts : Argument_List_Access := Empty_Argument_List;
...@@ -276,7 +276,8 @@ package body MLib.Tgt is ...@@ -276,7 +276,8 @@ package body MLib.Tgt is
------------------------ ------------------------
function Library_Exists_For function Library_Exists_For
(Project : Project_Id; In_Tree : Project_Tree_Ref) return Boolean (Project : Project_Id;
In_Tree : Project_Tree_Ref) return Boolean
is is
begin begin
if not In_Tree.Projects.Table (Project).Library then if not In_Tree.Projects.Table (Project).Library then
...@@ -287,25 +288,22 @@ package body MLib.Tgt is ...@@ -287,25 +288,22 @@ package body MLib.Tgt is
else else
declare declare
Lib_Dir : constant String := Lib_Dir : constant String :=
Get_Name_String Get_Name_String
(In_Tree.Projects.Table (Project).Library_Dir); (In_Tree.Projects.Table (Project).Library_Dir);
Lib_Name : constant String := Lib_Name : constant String :=
Get_Name_String Get_Name_String
(In_Tree.Projects.Table (Project).Library_Name); (In_Tree.Projects.Table (Project).Library_Name);
begin begin
if In_Tree.Projects.Table (Project).Library_Kind = if In_Tree.Projects.Table (Project).Library_Kind = Static then
Static
then
return Is_Regular_File return Is_Regular_File
(Lib_Dir & Directory_Separator & "lib" & (Lib_Dir & Directory_Separator & "lib" &
Fil.Ext_To (Lib_Name, Archive_Ext)); Fil.Append_To (Lib_Name, Archive_Ext));
else else
return Is_Regular_File return Is_Regular_File
(Lib_Dir & Directory_Separator & "lib" & (Lib_Dir & Directory_Separator & "lib" &
Fil.Ext_To (Lib_Name, DLL_Ext)); Fil.Append_To (Lib_Name, DLL_Ext));
end if; end if;
end; end;
end if; end if;
...@@ -328,8 +326,8 @@ package body MLib.Tgt is ...@@ -328,8 +326,8 @@ package body MLib.Tgt is
else else
declare declare
Lib_Name : constant String := Lib_Name : constant String :=
Get_Name_String Get_Name_String
(In_Tree.Projects.Table (Project).Library_Name); (In_Tree.Projects.Table (Project).Library_Name);
begin begin
Name_Len := 3; Name_Len := 3;
...@@ -338,10 +336,9 @@ package body MLib.Tgt is ...@@ -338,10 +336,9 @@ package body MLib.Tgt is
if In_Tree.Projects.Table (Project).Library_Kind = if In_Tree.Projects.Table (Project).Library_Kind =
Static Static
then then
Add_Str_To_Name_Buffer (Fil.Ext_To (Lib_Name, Archive_Ext)); Add_Str_To_Name_Buffer (Fil.Append_To (Lib_Name, Archive_Ext));
else else
Add_Str_To_Name_Buffer (Fil.Ext_To (Lib_Name, DLL_Ext)); Add_Str_To_Name_Buffer (Fil.Append_To (Lib_Name, DLL_Ext));
end if; end if;
return Name_Find; return Name_Find;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 2001-2005, Free Software Foundation, Inc. -- -- Copyright (C) 2001-2006, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -30,18 +30,29 @@ ...@@ -30,18 +30,29 @@
-- This is the Darwin version of the body -- This is the Darwin version of the body
with MLib; use MLib;
with MLib.Fil; with MLib.Fil;
with MLib.Utl; with MLib.Utl;
with Namet; use Namet; with Namet; use Namet;
with Opt; with Opt; use Opt;
with Output; use Output; with Output; use Output;
with Prj.Com; with Prj.Com;
with System; with System;
package body MLib.Tgt is package body MLib.Tgt is
use GNAT; Flat_Namespace : aliased String := "-Wl,-flat_namespace";
use MLib; -- Instruct the linker to build the shared library as a flat
-- namespace image. The default is a two-level namespace image.
Shared_Libgcc : aliased String := "-shared-libgcc";
No_Shared_Libgcc_Options : aliased Argument_List :=
(1 => Flat_Namespace'Access);
With_Shared_Libgcc_Options : aliased Argument_List :=
(1 => Flat_Namespace'Access,
2 => Shared_Libgcc'Access);
--------------------- ---------------------
-- Archive_Builder -- -- Archive_Builder --
...@@ -114,9 +125,10 @@ package body MLib.Tgt is ...@@ -114,9 +125,10 @@ package body MLib.Tgt is
Lib_File : constant String := Lib_File : constant String :=
Lib_Dir & Directory_Separator & "lib" & Lib_Dir & Directory_Separator & "lib" &
Fil.Ext_To (Lib_Filename, DLL_Ext); Fil.Append_To (Lib_Filename, DLL_Ext);
Shared_Options : Argument_List_Access;
Version_Arg : String_Access;
Symbolic_Link_Needed : Boolean := False; Symbolic_Link_Needed : Boolean := False;
begin begin
...@@ -125,28 +137,31 @@ package body MLib.Tgt is ...@@ -125,28 +137,31 @@ package body MLib.Tgt is
Write_Line (Lib_File); Write_Line (Lib_File);
end if; end if;
-- Invoke gcc with -shared-libgcc, but only for GCC 4 or higher
if GCC_Version >= 4 then
Shared_Options := With_Shared_Libgcc_Options'Access;
else
Shared_Options := No_Shared_Libgcc_Options'Access;
end if;
-- If specified, add automatic elaboration/finalization -- If specified, add automatic elaboration/finalization
if Lib_Version = "" then if Lib_Version = "" then
Utl.Gcc Utl.Gcc
(Output_File => Lib_File, (Output_File => Lib_File,
Objects => Ofiles, Objects => Ofiles,
Options => Options, Options => Options & Shared_Options.all,
Driver_Name => Driver_Name, Driver_Name => Driver_Name,
Options_2 => Options_2); Options_2 => Options_2);
else else
-- Instruct the linker to build the shared library as a flat
-- namespace image, which is not the default. The default is a two
-- level namespace image.
Version_Arg := new String'("-Wl,-flat_namespace");
if Is_Absolute_Path (Lib_Version) then if Is_Absolute_Path (Lib_Version) then
Utl.Gcc Utl.Gcc
(Output_File => Lib_Version, (Output_File => Lib_Version,
Objects => Ofiles, Objects => Ofiles,
Options => Options & Version_Arg, Options => Options & Shared_Options.all,
Driver_Name => Driver_Name, Driver_Name => Driver_Name,
Options_2 => Options_2); Options_2 => Options_2);
Symbolic_Link_Needed := Lib_Version /= Lib_File; Symbolic_Link_Needed := Lib_Version /= Lib_File;
...@@ -155,7 +170,7 @@ package body MLib.Tgt is ...@@ -155,7 +170,7 @@ package body MLib.Tgt is
Utl.Gcc Utl.Gcc
(Output_File => Lib_Dir & Directory_Separator & Lib_Version, (Output_File => Lib_Dir & Directory_Separator & Lib_Version,
Objects => Ofiles, Objects => Ofiles,
Options => Options & Version_Arg, Options => Options & Shared_Options.all,
Driver_Name => Driver_Name, Driver_Name => Driver_Name,
Options_2 => Options_2); Options_2 => Options_2);
Symbolic_Link_Needed := Symbolic_Link_Needed :=
...@@ -258,7 +273,8 @@ package body MLib.Tgt is ...@@ -258,7 +273,8 @@ package body MLib.Tgt is
------------------------ ------------------------
function Library_Exists_For function Library_Exists_For
(Project : Project_Id; In_Tree : Project_Tree_Ref) return Boolean (Project : Project_Id;
In_Tree : Project_Tree_Ref) return Boolean
is is
begin begin
if not In_Tree.Projects.Table (Project).Library then if not In_Tree.Projects.Table (Project).Library then
...@@ -268,25 +284,23 @@ package body MLib.Tgt is ...@@ -268,25 +284,23 @@ package body MLib.Tgt is
else else
declare declare
Lib_Dir : constant String := Lib_Dir : constant String :=
Get_Name_String Get_Name_String
(In_Tree.Projects.Table (Project).Library_Dir); (In_Tree.Projects.Table (Project).Library_Dir);
Lib_Name : constant String := Lib_Name : constant String :=
Get_Name_String Get_Name_String
(In_Tree.Projects.Table (Project).Library_Name); (In_Tree.Projects.Table (Project).Library_Name);
begin begin
if In_Tree.Projects.Table (Project).Library_Kind = if In_Tree.Projects.Table (Project).Library_Kind = Static then
Static
then
return Is_Regular_File return Is_Regular_File
(Lib_Dir & Directory_Separator & "lib" & (Lib_Dir & Directory_Separator & "lib" &
Fil.Ext_To (Lib_Name, Archive_Ext)); Fil.Append_To (Lib_Name, Archive_Ext));
else else
return Is_Regular_File return Is_Regular_File
(Lib_Dir & Directory_Separator & "lib" & (Lib_Dir & Directory_Separator & "lib" &
Fil.Ext_To (Lib_Name, DLL_Ext)); Fil.Append_To (Lib_Name, DLL_Ext));
end if; end if;
end; end;
end if; end if;
...@@ -309,8 +323,8 @@ package body MLib.Tgt is ...@@ -309,8 +323,8 @@ package body MLib.Tgt is
else else
declare declare
Lib_Name : constant String := Lib_Name : constant String :=
Get_Name_String Get_Name_String
(In_Tree.Projects.Table (Project).Library_Name); (In_Tree.Projects.Table (Project).Library_Name);
begin begin
Name_Len := 3; Name_Len := 3;
...@@ -318,10 +332,9 @@ package body MLib.Tgt is ...@@ -318,10 +332,9 @@ package body MLib.Tgt is
if In_Tree.Projects.Table (Project).Library_Kind = if In_Tree.Projects.Table (Project).Library_Kind =
Static then Static then
Add_Str_To_Name_Buffer (Fil.Ext_To (Lib_Name, Archive_Ext)); Add_Str_To_Name_Buffer (Fil.Append_To (Lib_Name, Archive_Ext));
else else
Add_Str_To_Name_Buffer (Fil.Ext_To (Lib_Name, DLL_Ext)); Add_Str_To_Name_Buffer (Fil.Append_To (Lib_Name, DLL_Ext));
end if; end if;
return Name_Find; return Name_Find;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 2003-2005, AdaCore -- -- Copyright (C) 2003-2006, AdaCore --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -111,7 +111,7 @@ package body MLib.Tgt is ...@@ -111,7 +111,7 @@ package body MLib.Tgt is
Lib_File : constant String := Lib_File : constant String :=
Lib_Dir & Directory_Separator & "lib" & Lib_Dir & Directory_Separator & "lib" &
MLib.Fil.Ext_To (Lib_Filename, DLL_Ext); MLib.Fil.Append_To (Lib_Filename, DLL_Ext);
Version_Arg : String_Access; Version_Arg : String_Access;
Symbolic_Link_Needed : Boolean := False; Symbolic_Link_Needed : Boolean := False;
...@@ -256,7 +256,8 @@ package body MLib.Tgt is ...@@ -256,7 +256,8 @@ package body MLib.Tgt is
------------------------ ------------------------
function Library_Exists_For function Library_Exists_For
(Project : Project_Id; In_Tree : Project_Tree_Ref) return Boolean (Project : Project_Id;
In_Tree : Project_Tree_Ref) return Boolean
is is
begin begin
if not In_Tree.Projects.Table (Project).Library then if not In_Tree.Projects.Table (Project).Library then
...@@ -266,25 +267,23 @@ package body MLib.Tgt is ...@@ -266,25 +267,23 @@ package body MLib.Tgt is
else else
declare declare
Lib_Dir : constant String := Lib_Dir : constant String :=
Get_Name_String Get_Name_String
(In_Tree.Projects.Table (Project).Library_Dir); (In_Tree.Projects.Table (Project).Library_Dir);
Lib_Name : constant String := Lib_Name : constant String :=
Get_Name_String Get_Name_String
(In_Tree.Projects.Table (Project).Library_Name); (In_Tree.Projects.Table (Project).Library_Name);
begin begin
if In_Tree.Projects.Table (Project).Library_Kind = if In_Tree.Projects.Table (Project).Library_Kind = Static then
Static
then
return Is_Regular_File return Is_Regular_File
(Lib_Dir & Directory_Separator & "lib" & (Lib_Dir & Directory_Separator & "lib" &
Fil.Ext_To (Lib_Name, Archive_Ext)); Fil.Append_To (Lib_Name, Archive_Ext));
else else
return Is_Regular_File return Is_Regular_File
(Lib_Dir & Directory_Separator & "lib" & (Lib_Dir & Directory_Separator & "lib" &
Fil.Ext_To (Lib_Name, DLL_Ext)); Fil.Append_To (Lib_Name, DLL_Ext));
end if; end if;
end; end;
end if; end if;
...@@ -307,8 +306,8 @@ package body MLib.Tgt is ...@@ -307,8 +306,8 @@ package body MLib.Tgt is
else else
declare declare
Lib_Name : constant String := Lib_Name : constant String :=
Get_Name_String Get_Name_String
(In_Tree.Projects.Table (Project).Library_Name); (In_Tree.Projects.Table (Project).Library_Name);
begin begin
Name_Len := 3; Name_Len := 3;
...@@ -317,10 +316,9 @@ package body MLib.Tgt is ...@@ -317,10 +316,9 @@ package body MLib.Tgt is
if In_Tree.Projects.Table (Project).Library_Kind = if In_Tree.Projects.Table (Project).Library_Kind =
Static Static
then then
Add_Str_To_Name_Buffer (Fil.Ext_To (Lib_Name, Archive_Ext)); Add_Str_To_Name_Buffer (Fil.Append_To (Lib_Name, Archive_Ext));
else else
Add_Str_To_Name_Buffer (Fil.Ext_To (Lib_Name, DLL_Ext)); Add_Str_To_Name_Buffer (Fil.Append_To (Lib_Name, DLL_Ext));
end if; end if;
return Name_Find; return Name_Find;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 2003-2005, AdaCore -- -- Copyright (C) 2003-2006, AdaCore --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -111,7 +111,7 @@ package body MLib.Tgt is ...@@ -111,7 +111,7 @@ package body MLib.Tgt is
Lib_File : constant String := Lib_File : constant String :=
Lib_Dir & Directory_Separator & "lib" & Lib_Dir & Directory_Separator & "lib" &
MLib.Fil.Ext_To (Lib_Filename, DLL_Ext); MLib.Fil.Append_To (Lib_Filename, DLL_Ext);
Version_Arg : String_Access; Version_Arg : String_Access;
Symbolic_Link_Needed : Boolean := False; Symbolic_Link_Needed : Boolean := False;
...@@ -294,7 +294,8 @@ package body MLib.Tgt is ...@@ -294,7 +294,8 @@ package body MLib.Tgt is
------------------------ ------------------------
function Library_Exists_For function Library_Exists_For
(Project : Project_Id; In_Tree : Project_Tree_Ref) return Boolean (Project : Project_Id;
In_Tree : Project_Tree_Ref) return Boolean
is is
begin begin
if not In_Tree.Projects.Table (Project).Library then if not In_Tree.Projects.Table (Project).Library then
...@@ -304,25 +305,23 @@ package body MLib.Tgt is ...@@ -304,25 +305,23 @@ package body MLib.Tgt is
else else
declare declare
Lib_Dir : constant String := Lib_Dir : constant String :=
Get_Name_String Get_Name_String
(In_Tree.Projects.Table (Project).Library_Dir); (In_Tree.Projects.Table (Project).Library_Dir);
Lib_Name : constant String := Lib_Name : constant String :=
Get_Name_String Get_Name_String
(In_Tree.Projects.Table (Project).Library_Name); (In_Tree.Projects.Table (Project).Library_Name);
begin begin
if In_Tree.Projects.Table (Project).Library_Kind = if In_Tree.Projects.Table (Project).Library_Kind = Static then
Static
then
return Is_Regular_File return Is_Regular_File
(Lib_Dir & Directory_Separator & "lib" & (Lib_Dir & Directory_Separator & "lib" &
Fil.Ext_To (Lib_Name, Archive_Ext)); Fil.Append_To (Lib_Name, Archive_Ext));
else else
return Is_Regular_File return Is_Regular_File
(Lib_Dir & Directory_Separator & "lib" & (Lib_Dir & Directory_Separator & "lib" &
Fil.Ext_To (Lib_Name, DLL_Ext)); Fil.Append_To (Lib_Name, DLL_Ext));
end if; end if;
end; end;
end if; end if;
...@@ -345,8 +344,8 @@ package body MLib.Tgt is ...@@ -345,8 +344,8 @@ package body MLib.Tgt is
else else
declare declare
Lib_Name : constant String := Lib_Name : constant String :=
Get_Name_String Get_Name_String
(In_Tree.Projects.Table (Project).Library_Name); (In_Tree.Projects.Table (Project).Library_Name);
begin begin
Name_Len := 3; Name_Len := 3;
...@@ -355,10 +354,9 @@ package body MLib.Tgt is ...@@ -355,10 +354,9 @@ package body MLib.Tgt is
if In_Tree.Projects.Table (Project).Library_Kind = if In_Tree.Projects.Table (Project).Library_Kind =
Static Static
then then
Add_Str_To_Name_Buffer (Fil.Ext_To (Lib_Name, Archive_Ext)); Add_Str_To_Name_Buffer (Fil.Append_To (Lib_Name, Archive_Ext));
else else
Add_Str_To_Name_Buffer (Fil.Ext_To (Lib_Name, DLL_Ext)); Add_Str_To_Name_Buffer (Fil.Append_To (Lib_Name, DLL_Ext));
end if; end if;
return Name_Find; return Name_Find;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 2001-2005, Free Software Foundation, Inc. -- -- Copyright (C) 2001-2006, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -115,7 +115,7 @@ package body MLib.Tgt is ...@@ -115,7 +115,7 @@ package body MLib.Tgt is
Lib_File : constant String := Lib_File : constant String :=
Lib_Dir & Directory_Separator & "lib" & Lib_Dir & Directory_Separator & "lib" &
Fil.Ext_To (Lib_Filename, DLL_Ext); Fil.Append_To (Lib_Filename, DLL_Ext);
Version_Arg : String_Access; Version_Arg : String_Access;
Symbolic_Link_Needed : Boolean := False; Symbolic_Link_Needed : Boolean := False;
...@@ -135,53 +135,104 @@ package body MLib.Tgt is ...@@ -135,53 +135,104 @@ package body MLib.Tgt is
Options_2 => Options_2); Options_2 => Options_2);
else else
Version_Arg := new String'("-Wl,-soname," & Lib_Version); declare
Maj_Version : constant String := Lib_Version;
if Is_Absolute_Path (Lib_Version) then Last_Maj : Positive := Maj_Version'Last;
Utl.Gcc Last : Positive;
(Output_File => Lib_Version, Ok_Maj : Boolean := False;
Objects => Ofiles, begin
Options => Options & Version_Arg, while Last_Maj > Maj_Version'First loop
Driver_Name => Driver_Name, if Maj_Version (Last_Maj) in '0' .. '9' then
Options_2 => Options_2); Last_Maj := Last_Maj - 1;
Symbolic_Link_Needed := Lib_Version /= Lib_File;
else
else Ok_Maj := Last_Maj /= Maj_Version'Last and then
Utl.Gcc Maj_Version (Last_Maj) = '.';
(Output_File => Lib_Dir & Directory_Separator & Lib_Version,
Objects => Ofiles, if Ok_Maj then
Options => Options & Version_Arg, Last_Maj := Last_Maj - 1;
Driver_Name => Driver_Name, end if;
Options_2 => Options_2);
Symbolic_Link_Needed := exit;
Lib_Dir & Directory_Separator & Lib_Version /= Lib_File; end if;
end if; end loop;
if Symbolic_Link_Needed then if Ok_Maj then
declare Last := Last_Maj;
Success : Boolean;
Oldpath : String (1 .. Lib_Version'Length + 1); while Last > Maj_Version'First loop
Newpath : String (1 .. Lib_File'Length + 1); if Maj_Version (Last) in '0' .. '9' then
Last := Last - 1;
Result : Integer;
pragma Unreferenced (Result); else
Ok_Maj := Last /= Last_Maj and then
function Symlink Maj_Version (Last) = '.';
(Oldpath : System.Address;
Newpath : System.Address) return Integer; if Ok_Maj then
pragma Import (C, Symlink, "__gnat_symlink"); Last := Last - 1;
begin Ok_Maj := Maj_Version (1 .. Last) = Lib_File;
Oldpath (1 .. Lib_Version'Length) := Lib_Version; end if;
Oldpath (Oldpath'Last) := ASCII.NUL;
Newpath (1 .. Lib_File'Length) := Lib_File; exit;
Newpath (Newpath'Last) := ASCII.NUL; end if;
end loop;
Delete_File (Lib_File, Success); end if;
Result := Symlink (Oldpath'Address, Newpath'Address); if Ok_Maj then
end; Version_Arg := new String'("-Wl,-soname," &
end if; Maj_Version (1 .. Last_Maj));
else
Version_Arg := new String'("-Wl,-soname," & Lib_Version);
end if;
if Is_Absolute_Path (Lib_Version) then
Utl.Gcc
(Output_File => Lib_Version,
Objects => Ofiles,
Options => Options & Version_Arg,
Driver_Name => Driver_Name,
Options_2 => Options_2);
Symbolic_Link_Needed := Lib_Version /= Lib_File;
else
Utl.Gcc
(Output_File => Lib_Dir & Directory_Separator & Lib_Version,
Objects => Ofiles,
Options => Options & Version_Arg,
Driver_Name => Driver_Name,
Options_2 => Options_2);
Symbolic_Link_Needed :=
Lib_Dir & Directory_Separator & Lib_Version /= Lib_File;
end if;
if Symbolic_Link_Needed then
declare
Success : Boolean;
Oldpath : String (1 .. Lib_Version'Length + 1);
Newpath : String (1 .. Lib_File'Length + 1);
Result : Integer;
pragma Unreferenced (Result);
function Symlink
(Oldpath : System.Address;
Newpath : System.Address) return Integer;
pragma Import (C, Symlink, "__gnat_symlink");
begin
Oldpath (1 .. Lib_Version'Length) := Lib_Version;
Oldpath (Oldpath'Last) := ASCII.NUL;
Newpath (1 .. Lib_File'Length) := Lib_File;
Newpath (Newpath'Last) := ASCII.NUL;
Delete_File (Lib_File, Success);
Result := Symlink (Oldpath'Address, Newpath'Address);
end;
end if;
end;
end if; end if;
end Build_Dynamic_Library; end Build_Dynamic_Library;
...@@ -253,7 +304,8 @@ package body MLib.Tgt is ...@@ -253,7 +304,8 @@ package body MLib.Tgt is
------------------------ ------------------------
function Library_Exists_For function Library_Exists_For
(Project : Project_Id; In_Tree : Project_Tree_Ref) return Boolean (Project : Project_Id;
In_Tree : Project_Tree_Ref) return Boolean
is is
begin begin
if not In_Tree.Projects.Table (Project).Library then if not In_Tree.Projects.Table (Project).Library then
...@@ -263,25 +315,23 @@ package body MLib.Tgt is ...@@ -263,25 +315,23 @@ package body MLib.Tgt is
else else
declare declare
Lib_Dir : constant String := Lib_Dir : constant String :=
Get_Name_String Get_Name_String
(In_Tree.Projects.Table (Project).Library_Dir); (In_Tree.Projects.Table (Project).Library_Dir);
Lib_Name : constant String := Lib_Name : constant String :=
Get_Name_String Get_Name_String
(In_Tree.Projects.Table (Project).Library_Name); (In_Tree.Projects.Table (Project).Library_Name);
begin begin
if In_Tree.Projects.Table (Project).Library_Kind = if In_Tree.Projects.Table (Project).Library_Kind = Static then
Static
then
return Is_Regular_File return Is_Regular_File
(Lib_Dir & Directory_Separator & "lib" & (Lib_Dir & Directory_Separator & "lib" &
Fil.Ext_To (Lib_Name, Archive_Ext)); Fil.Append_To (Lib_Name, Archive_Ext));
else else
return Is_Regular_File return Is_Regular_File
(Lib_Dir & Directory_Separator & "lib" & (Lib_Dir & Directory_Separator & "lib" &
Fil.Ext_To (Lib_Name, DLL_Ext)); Fil.Append_To (Lib_Name, DLL_Ext));
end if; end if;
end; end;
end if; end if;
...@@ -304,8 +354,8 @@ package body MLib.Tgt is ...@@ -304,8 +354,8 @@ package body MLib.Tgt is
else else
declare declare
Lib_Name : constant String := Lib_Name : constant String :=
Get_Name_String Get_Name_String
(In_Tree.Projects.Table (Project).Library_Name); (In_Tree.Projects.Table (Project).Library_Name);
begin begin
Name_Len := 3; Name_Len := 3;
...@@ -314,10 +364,9 @@ package body MLib.Tgt is ...@@ -314,10 +364,9 @@ package body MLib.Tgt is
if In_Tree.Projects.Table (Project).Library_Kind = if In_Tree.Projects.Table (Project).Library_Kind =
Static Static
then then
Add_Str_To_Name_Buffer (Fil.Ext_To (Lib_Name, Archive_Ext)); Add_Str_To_Name_Buffer (Fil.Append_To (Lib_Name, Archive_Ext));
else else
Add_Str_To_Name_Buffer (Fil.Ext_To (Lib_Name, DLL_Ext)); Add_Str_To_Name_Buffer (Fil.Append_To (Lib_Name, DLL_Ext));
end if; end if;
return Name_Find; return Name_Find;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 2003-2005 Free Software Foundation, Inc. -- -- Copyright (C) 2003-2006 Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -184,7 +184,8 @@ package body MLib.Tgt is ...@@ -184,7 +184,8 @@ package body MLib.Tgt is
------------------------ ------------------------
function Library_Exists_For function Library_Exists_For
(Project : Project_Id; In_Tree : Project_Tree_Ref) return Boolean (Project : Project_Id;
In_Tree : Project_Tree_Ref) return Boolean
is is
begin begin
if not In_Tree.Projects.Table (Project).Library then if not In_Tree.Projects.Table (Project).Library then
...@@ -194,25 +195,23 @@ package body MLib.Tgt is ...@@ -194,25 +195,23 @@ package body MLib.Tgt is
else else
declare declare
Lib_Dir : constant String := Lib_Dir : constant String :=
Get_Name_String Get_Name_String
(In_Tree.Projects.Table (Project).Library_Dir); (In_Tree.Projects.Table (Project).Library_Dir);
Lib_Name : constant String := Lib_Name : constant String :=
Get_Name_String Get_Name_String
(In_Tree.Projects.Table (Project).Library_Name); (In_Tree.Projects.Table (Project).Library_Name);
begin begin
if In_Tree.Projects.Table (Project).Library_Kind = if In_Tree.Projects.Table (Project).Library_Kind = Static then
Static
then
return Is_Regular_File return Is_Regular_File
(Lib_Dir & Directory_Separator & "lib" & (Lib_Dir & Directory_Separator & "lib" &
Fil.Ext_To (Lib_Name, Archive_Ext)); Fil.Append_To (Lib_Name, Archive_Ext));
else else
return Is_Regular_File return Is_Regular_File
(Lib_Dir & Directory_Separator & "lib" & (Lib_Dir & Directory_Separator & "lib" &
Fil.Ext_To (Lib_Name, DLL_Ext)); Fil.Append_To (Lib_Name, DLL_Ext));
end if; end if;
end; end;
end if; end if;
...@@ -235,8 +234,8 @@ package body MLib.Tgt is ...@@ -235,8 +234,8 @@ package body MLib.Tgt is
else else
declare declare
Lib_Name : constant String := Lib_Name : constant String :=
Get_Name_String Get_Name_String
(In_Tree.Projects.Table (Project).Library_Name); (In_Tree.Projects.Table (Project).Library_Name);
begin begin
Name_Len := 3; Name_Len := 3;
...@@ -245,10 +244,9 @@ package body MLib.Tgt is ...@@ -245,10 +244,9 @@ package body MLib.Tgt is
if In_Tree.Projects.Table (Project).Library_Kind = if In_Tree.Projects.Table (Project).Library_Kind =
Static Static
then then
Add_Str_To_Name_Buffer (Fil.Ext_To (Lib_Name, Archive_Ext)); Add_Str_To_Name_Buffer (Fil.Append_To (Lib_Name, Archive_Ext));
else else
Add_Str_To_Name_Buffer (Fil.Ext_To (Lib_Name, DLL_Ext)); Add_Str_To_Name_Buffer (Fil.Append_To (Lib_Name, DLL_Ext));
end if; end if;
return Name_Find; return Name_Find;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 2002-2005, Free Software Foundation, Inc. -- -- Copyright (C) 2002-2006, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -119,7 +119,7 @@ package body MLib.Tgt is ...@@ -119,7 +119,7 @@ package body MLib.Tgt is
Lib_File : constant String := Lib_File : constant String :=
Lib_Dir & Directory_Separator & Lib_Dir & Directory_Separator &
Files.Ext_To (Lib_Filename, DLL_Ext); Files.Append_To (Lib_Filename, DLL_Ext);
-- Start of processing for Build_Dynamic_Library -- Start of processing for Build_Dynamic_Library
...@@ -205,7 +205,8 @@ package body MLib.Tgt is ...@@ -205,7 +205,8 @@ package body MLib.Tgt is
------------------------ ------------------------
function Library_Exists_For function Library_Exists_For
(Project : Project_Id; In_Tree : Project_Tree_Ref) return Boolean is (Project : Project_Id;
In_Tree : Project_Tree_Ref) return Boolean is
begin begin
if not In_Tree.Projects.Table (Project).Library then if not In_Tree.Projects.Table (Project).Library then
Prj.Com.Fail ("INTERNAL ERROR: Library_Exists_For called " & Prj.Com.Fail ("INTERNAL ERROR: Library_Exists_For called " &
...@@ -214,25 +215,23 @@ package body MLib.Tgt is ...@@ -214,25 +215,23 @@ package body MLib.Tgt is
else else
declare declare
Lib_Dir : constant String := Lib_Dir : constant String :=
Get_Name_String Get_Name_String
(In_Tree.Projects.Table (Project).Library_Dir); (In_Tree.Projects.Table (Project).Library_Dir);
Lib_Name : constant String := Lib_Name : constant String :=
Get_Name_String Get_Name_String
(In_Tree.Projects.Table (Project).Library_Name); (In_Tree.Projects.Table (Project).Library_Name);
begin begin
if In_Tree.Projects.Table (Project).Library_Kind = if In_Tree.Projects.Table (Project).Library_Kind = Static then
Static
then
return Is_Regular_File return Is_Regular_File
(Lib_Dir & Directory_Separator & "lib" & (Lib_Dir & Directory_Separator & "lib" &
MLib.Fil.Ext_To (Lib_Name, Archive_Ext)); MLib.Fil.Append_To (Lib_Name, Archive_Ext));
else else
return Is_Regular_File return Is_Regular_File
(Lib_Dir & Directory_Separator & (Lib_Dir & Directory_Separator &
MLib.Fil.Ext_To (Lib_Name, DLL_Ext)); MLib.Fil.Append_To (Lib_Name, DLL_Ext));
end if; end if;
end; end;
end if; end if;
...@@ -254,8 +253,8 @@ package body MLib.Tgt is ...@@ -254,8 +253,8 @@ package body MLib.Tgt is
else else
declare declare
Lib_Name : constant String := Lib_Name : constant String :=
Get_Name_String Get_Name_String
(In_Tree.Projects.Table (Project).Library_Name); (In_Tree.Projects.Table (Project).Library_Name);
begin begin
if In_Tree.Projects.Table (Project).Library_Kind = if In_Tree.Projects.Table (Project).Library_Kind =
...@@ -263,11 +262,11 @@ package body MLib.Tgt is ...@@ -263,11 +262,11 @@ package body MLib.Tgt is
then then
Name_Len := 3; Name_Len := 3;
Name_Buffer (1 .. Name_Len) := "lib"; Name_Buffer (1 .. Name_Len) := "lib";
Add_Str_To_Name_Buffer (Fil.Ext_To (Lib_Name, Archive_Ext)); Add_Str_To_Name_Buffer (Fil.Append_To (Lib_Name, Archive_Ext));
else else
Name_Len := 0; Name_Len := 0;
Add_Str_To_Name_Buffer (Fil.Ext_To (Lib_Name, DLL_Ext)); Add_Str_To_Name_Buffer (Fil.Append_To (Lib_Name, DLL_Ext));
end if; end if;
return Name_Find; return Name_Find;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 2002-2005 Free Software Foundation, Inc. -- -- Copyright (C) 2002-2006 Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -111,7 +111,7 @@ package body MLib.Tgt is ...@@ -111,7 +111,7 @@ package body MLib.Tgt is
Lib_File : constant String := Lib_File : constant String :=
Lib_Dir & Directory_Separator & "lib" & Lib_Dir & Directory_Separator & "lib" &
Fil.Ext_To (Lib_Filename, DLL_Ext); Fil.Append_To (Lib_Filename, DLL_Ext);
Version_Arg : String_Access; Version_Arg : String_Access;
Symbolic_Link_Needed : Boolean := False; Symbolic_Link_Needed : Boolean := False;
...@@ -250,7 +250,8 @@ package body MLib.Tgt is ...@@ -250,7 +250,8 @@ package body MLib.Tgt is
------------------------ ------------------------
function Library_Exists_For function Library_Exists_For
(Project : Project_Id; In_Tree : Project_Tree_Ref) return Boolean (Project : Project_Id;
In_Tree : Project_Tree_Ref) return Boolean
is is
begin begin
if not In_Tree.Projects.Table (Project).Library then if not In_Tree.Projects.Table (Project).Library then
...@@ -260,25 +261,23 @@ package body MLib.Tgt is ...@@ -260,25 +261,23 @@ package body MLib.Tgt is
else else
declare declare
Lib_Dir : constant String := Lib_Dir : constant String :=
Get_Name_String Get_Name_String
(In_Tree.Projects.Table (Project).Library_Dir); (In_Tree.Projects.Table (Project).Library_Dir);
Lib_Name : constant String := Lib_Name : constant String :=
Get_Name_String Get_Name_String
(In_Tree.Projects.Table (Project).Library_Name); (In_Tree.Projects.Table (Project).Library_Name);
begin begin
if In_Tree.Projects.Table (Project).Library_Kind = if In_Tree.Projects.Table (Project).Library_Kind = Static then
Static
then
return Is_Regular_File return Is_Regular_File
(Lib_Dir & Directory_Separator & "lib" & (Lib_Dir & Directory_Separator & "lib" &
Fil.Ext_To (Lib_Name, Archive_Ext)); Fil.Append_To (Lib_Name, Archive_Ext));
else else
return Is_Regular_File return Is_Regular_File
(Lib_Dir & Directory_Separator & "lib" & (Lib_Dir & Directory_Separator & "lib" &
Fil.Ext_To (Lib_Name, DLL_Ext)); Fil.Append_To (Lib_Name, DLL_Ext));
end if; end if;
end; end;
end if; end if;
...@@ -301,8 +300,8 @@ package body MLib.Tgt is ...@@ -301,8 +300,8 @@ package body MLib.Tgt is
else else
declare declare
Lib_Name : constant String := Lib_Name : constant String :=
Get_Name_String Get_Name_String
(In_Tree.Projects.Table (Project).Library_Name); (In_Tree.Projects.Table (Project).Library_Name);
begin begin
Name_Len := 3; Name_Len := 3;
...@@ -311,10 +310,9 @@ package body MLib.Tgt is ...@@ -311,10 +310,9 @@ package body MLib.Tgt is
if In_Tree.Projects.Table (Project).Library_Kind = if In_Tree.Projects.Table (Project).Library_Kind =
Static Static
then then
Add_Str_To_Name_Buffer (Fil.Ext_To (Lib_Name, Archive_Ext)); Add_Str_To_Name_Buffer (Fil.Append_To (Lib_Name, Archive_Ext));
else else
Add_Str_To_Name_Buffer (Fil.Ext_To (Lib_Name, DLL_Ext)); Add_Str_To_Name_Buffer (Fil.Append_To (Lib_Name, DLL_Ext));
end if; end if;
return Name_Find; return Name_Find;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 2002-2005 Free Software Foundation, Inc. -- -- Copyright (C) 2002-2006 Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -117,7 +117,7 @@ package body MLib.Tgt is ...@@ -117,7 +117,7 @@ package body MLib.Tgt is
Lib_File : constant String := Lib_File : constant String :=
Lib_Dir & Directory_Separator & "lib" & Lib_Dir & Directory_Separator & "lib" &
Fil.Ext_To (Lib_Filename, DLL_Ext); Fil.Append_To (Lib_Filename, DLL_Ext);
Version_Arg : String_Access; Version_Arg : String_Access;
Symbolic_Link_Needed : Boolean := False; Symbolic_Link_Needed : Boolean := False;
...@@ -260,7 +260,8 @@ package body MLib.Tgt is ...@@ -260,7 +260,8 @@ package body MLib.Tgt is
------------------------ ------------------------
function Library_Exists_For function Library_Exists_For
(Project : Project_Id; In_Tree : Project_Tree_Ref) return Boolean (Project : Project_Id;
In_Tree : Project_Tree_Ref) return Boolean
is is
begin begin
if not In_Tree.Projects.Table (Project).Library then if not In_Tree.Projects.Table (Project).Library then
...@@ -270,25 +271,23 @@ package body MLib.Tgt is ...@@ -270,25 +271,23 @@ package body MLib.Tgt is
else else
declare declare
Lib_Dir : constant String := Lib_Dir : constant String :=
Get_Name_String Get_Name_String
(In_Tree.Projects.Table (Project).Library_Dir); (In_Tree.Projects.Table (Project).Library_Dir);
Lib_Name : constant String := Lib_Name : constant String :=
Get_Name_String Get_Name_String
(In_Tree.Projects.Table (Project).Library_Name); (In_Tree.Projects.Table (Project).Library_Name);
begin begin
if In_Tree.Projects.Table (Project).Library_Kind = if In_Tree.Projects.Table (Project).Library_Kind = Static then
Static
then
return Is_Regular_File return Is_Regular_File
(Lib_Dir & Directory_Separator & "lib" & (Lib_Dir & Directory_Separator & "lib" &
Fil.Ext_To (Lib_Name, Archive_Ext)); Fil.Append_To (Lib_Name, Archive_Ext));
else else
return Is_Regular_File return Is_Regular_File
(Lib_Dir & Directory_Separator & "lib" & (Lib_Dir & Directory_Separator & "lib" &
Fil.Ext_To (Lib_Name, DLL_Ext)); Fil.Append_To (Lib_Name, DLL_Ext));
end if; end if;
end; end;
end if; end if;
...@@ -311,8 +310,8 @@ package body MLib.Tgt is ...@@ -311,8 +310,8 @@ package body MLib.Tgt is
else else
declare declare
Lib_Name : constant String := Lib_Name : constant String :=
Get_Name_String Get_Name_String
(In_Tree.Projects.Table (Project).Library_Name); (In_Tree.Projects.Table (Project).Library_Name);
begin begin
Name_Len := 3; Name_Len := 3;
...@@ -321,10 +320,9 @@ package body MLib.Tgt is ...@@ -321,10 +320,9 @@ package body MLib.Tgt is
if In_Tree.Projects.Table (Project).Library_Kind = if In_Tree.Projects.Table (Project).Library_Kind =
Static Static
then then
Add_Str_To_Name_Buffer (Fil.Ext_To (Lib_Name, Archive_Ext)); Add_Str_To_Name_Buffer (Fil.Append_To (Lib_Name, Archive_Ext));
else else
Add_Str_To_Name_Buffer (Fil.Ext_To (Lib_Name, DLL_Ext)); Add_Str_To_Name_Buffer (Fil.Append_To (Lib_Name, DLL_Ext));
end if; end if;
return Name_Find; return Name_Find;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 2003-2005 Free Software Foundation, Inc. -- -- Copyright (C) 2003-2006 Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -179,6 +179,8 @@ package body MLib.Tgt is ...@@ -179,6 +179,8 @@ package body MLib.Tgt is
return "sparc64"; return "sparc64";
elsif Target_Name (Target_Name'First .. Index) = "xscale" then elsif Target_Name (Target_Name'First .. Index) = "xscale" then
return "arm"; return "arm";
elsif Target_Name (Target_Name'First .. Index) = "i586" then
return "pentium";
else else
return ""; return "";
end if; end if;
...@@ -225,7 +227,8 @@ package body MLib.Tgt is ...@@ -225,7 +227,8 @@ package body MLib.Tgt is
------------------------ ------------------------
function Library_Exists_For function Library_Exists_For
(Project : Project_Id; In_Tree : Project_Tree_Ref) return Boolean (Project : Project_Id;
In_Tree : Project_Tree_Ref) return Boolean
is is
begin begin
if not In_Tree.Projects.Table (Project).Library then if not In_Tree.Projects.Table (Project).Library then
...@@ -235,25 +238,23 @@ package body MLib.Tgt is ...@@ -235,25 +238,23 @@ package body MLib.Tgt is
else else
declare declare
Lib_Dir : constant String := Lib_Dir : constant String :=
Get_Name_String Get_Name_String
(In_Tree.Projects.Table (Project).Library_Dir); (In_Tree.Projects.Table (Project).Library_Dir);
Lib_Name : constant String := Lib_Name : constant String :=
Get_Name_String Get_Name_String
(In_Tree.Projects.Table (Project).Library_Name); (In_Tree.Projects.Table (Project).Library_Name);
begin begin
if In_Tree.Projects.Table (Project).Library_Kind = if In_Tree.Projects.Table (Project).Library_Kind = Static then
Static
then
return Is_Regular_File return Is_Regular_File
(Lib_Dir & Directory_Separator & "lib" & (Lib_Dir & Directory_Separator & "lib" &
Fil.Ext_To (Lib_Name, Archive_Ext)); Fil.Append_To (Lib_Name, Archive_Ext));
else else
return Is_Regular_File return Is_Regular_File
(Lib_Dir & Directory_Separator & "lib" & (Lib_Dir & Directory_Separator & "lib" &
Fil.Ext_To (Lib_Name, DLL_Ext)); Fil.Append_To (Lib_Name, DLL_Ext));
end if; end if;
end; end;
end if; end if;
...@@ -276,8 +277,8 @@ package body MLib.Tgt is ...@@ -276,8 +277,8 @@ package body MLib.Tgt is
else else
declare declare
Lib_Name : constant String := Lib_Name : constant String :=
Get_Name_String Get_Name_String
(In_Tree.Projects.Table (Project).Library_Name); (In_Tree.Projects.Table (Project).Library_Name);
begin begin
Name_Len := 3; Name_Len := 3;
...@@ -286,10 +287,9 @@ package body MLib.Tgt is ...@@ -286,10 +287,9 @@ package body MLib.Tgt is
if In_Tree.Projects.Table (Project).Library_Kind = if In_Tree.Projects.Table (Project).Library_Kind =
Static Static
then then
Add_Str_To_Name_Buffer (Fil.Ext_To (Lib_Name, Archive_Ext)); Add_Str_To_Name_Buffer (Fil.Append_To (Lib_Name, Archive_Ext));
else else
Add_Str_To_Name_Buffer (Fil.Ext_To (Lib_Name, DLL_Ext)); Add_Str_To_Name_Buffer (Fil.Append_To (Lib_Name, DLL_Ext));
end if; end if;
return Name_Find; return Name_Find;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment