1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
5 -- M L I B . T G T . S P E C I F I C --
6 -- (Solaris Version) --
10 -- Copyright (C) 2002-2007, Free Software Foundation, Inc. --
12 -- GNAT is free software; you can redistribute it and/or modify it under --
13 -- terms of the GNU General Public License as published by the Free Soft- --
14 -- ware Foundation; either version 2, or (at your option) any later ver- --
15 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
16 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
17 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
18 -- for more details. You should have received a copy of the GNU General --
19 -- Public License distributed with GNAT; see file COPYING. If not, write --
20 -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
21 -- Boston, MA 02110-1301, USA. --
23 -- GNAT was originally developed by the GNAT team at New York University. --
24 -- Extensive contributions were provided by Ada Core Technologies Inc. --
26 ------------------------------------------------------------------------------
28 -- This is the Solaris version of the body
33 with Output; use Output;
35 package body MLib.Tgt.Specific is
37 -- Non default subprograms
39 procedure Build_Dynamic_Library
40 (Ofiles : Argument_List;
41 Options : Argument_List;
42 Interfaces : Argument_List;
43 Lib_Filename : String;
45 Symbol_Data : Symbol_Record;
46 Driver_Name : Name_Id := No_Name;
47 Lib_Version : String := "";
48 Auto_Init : Boolean := False);
50 function Is_Archive_Ext (Ext : String) return Boolean;
52 ---------------------------
53 -- Build_Dynamic_Library --
54 ---------------------------
56 procedure Build_Dynamic_Library
57 (Ofiles : Argument_List;
58 Options : Argument_List;
59 Interfaces : Argument_List;
60 Lib_Filename : String;
62 Symbol_Data : Symbol_Record;
63 Driver_Name : Name_Id := No_Name;
64 Lib_Version : String := "";
65 Auto_Init : Boolean := False)
67 pragma Unreferenced (Interfaces);
68 pragma Unreferenced (Symbol_Data);
69 pragma Unreferenced (Auto_Init);
71 Lib_File : constant String :=
72 "lib" & Fil.Append_To (Lib_Filename, DLL_Ext);
74 Lib_Path : constant String :=
75 Lib_Dir & Directory_Separator & Lib_File;
77 Version_Arg : String_Access;
78 Symbolic_Link_Needed : Boolean := False;
81 if Opt.Verbose_Mode then
82 Write_Str ("building relocatable shared library ");
83 Write_Line (Lib_Path);
86 if Lib_Version = "" then
88 (Output_File => Lib_Path,
91 Options_2 => No_Argument_List,
92 Driver_Name => Driver_Name);
96 Maj_Version : constant String :=
97 Major_Id_Name (Lib_File, Lib_Version);
99 if Maj_Version'Length /= 0 then
100 Version_Arg := new String'("-Wl,-h," & Maj_Version);
103 Version_Arg := new String'("-Wl,-h," & Lib_Version);
106 if Is_Absolute_Path (Lib_Version) then
108 (Output_File => Lib_Version,
110 Options => Options & Version_Arg,
111 Options_2 => No_Argument_List,
112 Driver_Name => Driver_Name);
113 Symbolic_Link_Needed := Lib_Version /= Lib_Path;
117 (Output_File => Lib_Dir & Directory_Separator & Lib_Version,
119 Options => Options & Version_Arg,
120 Options_2 => No_Argument_List,
121 Driver_Name => Driver_Name);
122 Symbolic_Link_Needed :=
123 Lib_Dir & Directory_Separator & Lib_Version /= Lib_Path;
126 if Symbolic_Link_Needed then
128 (Lib_Path, Lib_Version, Lib_Dir, Maj_Version);
132 end Build_Dynamic_Library;
138 function Is_Archive_Ext (Ext : String) return Boolean is
140 return Ext = ".a" or else Ext = ".so";
144 Build_Dynamic_Library_Ptr := Build_Dynamic_Library'Access;
145 Is_Archive_Ext_Ptr := Is_Archive_Ext'Access;
146 end MLib.Tgt.Specific;