* gcc.c (getenv_spec_function): New function.
[official-gcc.git] / gcc / ada / mlib-tgt.ads
blob5bc175e94a762868795eb0fe05f0795e96fe50b2
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- M L I B . T G T --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 2001-2005, AdaCore --
10 -- --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 2, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
17 -- for more details. You should have received a copy of the GNU General --
18 -- Public License distributed with GNAT; see file COPYING. If not, write --
19 -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
20 -- Boston, MA 02110-1301, USA. --
21 -- --
22 -- GNAT was originally developed by the GNAT team at New York University. --
23 -- Extensive contributions were provided by Ada Core Technologies Inc. --
24 -- --
25 ------------------------------------------------------------------------------
27 -- This package provides a set of target dependent routines to build
28 -- static, dynamic and shared libraries.
30 -- There are several versions for the body of this package
32 -- In the default version, libraries are not supported, so function
33 -- Support_For_Libraries return None.
35 with Prj; use Prj;
37 package MLib.Tgt is
39 type Library_Support is (None, Static_Only, Full);
40 -- Support for Library Project File.
41 -- - None: Library Project Files are not supported at all
42 -- - Static_Only: Library Project Files are only supported for static
43 -- libraries.
44 -- - Full: Library Project Files are supported for static and dynamic
45 -- (shared) libraries.
47 function Support_For_Libraries return Library_Support;
48 -- Indicates how building libraries by gnatmake is supported by the GNAT
49 -- implementation for the platform.
51 function Standalone_Library_Auto_Init_Is_Supported return Boolean;
52 -- Indicates if when building a dynamic Standalone Library,
53 -- automatic initialization is supported. If it is, then it is the default,
54 -- unless attribute Library_Auto_Init has the value "false".
56 function Archive_Builder return String;
57 -- Returns the name of the archive builder program, usually "ar"
59 function Archive_Builder_Options return String_List_Access;
60 -- A list of options to invoke the Archive_Builder, usually "cr" for "ar"
62 function Archive_Indexer return String;
63 -- Returns the name of the program, if any, that generates an index to the
64 -- contents of an archive, usually "ranlib". If there is no archive indexer
65 -- to be used, returns an empty string.
67 function Archive_Indexer_Options return String_List_Access;
68 -- A list of options to invoke the Archive_Indexer, usually empty
70 function Dynamic_Option return String;
71 -- gcc option to create a dynamic library.
72 -- For Unix, returns "-shared", for Windows returns "-mdll".
74 function Libgnat return String;
75 -- System dependent static GNAT library
77 function Archive_Ext return String;
78 -- System dependent static library extension, without leading dot.
79 -- For Unix and Windows, return "a".
81 function Object_Ext return String;
82 -- System dependent object extension, without leadien dot.
83 -- On Unix, returns "o".
85 function DLL_Prefix return String;
86 -- System dependent dynamic library prefix.
87 -- On Windows, returns "". On other platforms, returns "lib".
89 function DLL_Ext return String;
90 -- System dependent dynamic library extension, without leading dot.
91 -- On Windows, returns "dll". On Unix, usually returns "so", but not
92 -- always, e.g. on HP-UX the extension for shared libraries is "sl".
94 function PIC_Option return String;
95 -- Position independent code option
97 function Is_Object_Ext (Ext : String) return Boolean;
98 -- Returns True iff Ext is an object file extension
100 function Is_C_Ext (Ext : String) return Boolean;
101 -- Returns True iff Ext is a C file extension
103 function Is_Archive_Ext (Ext : String) return Boolean;
104 -- Returns True iff Ext is an extension for a library
106 procedure Build_Dynamic_Library
107 (Ofiles : Argument_List;
108 Foreign : Argument_List;
109 Afiles : Argument_List;
110 Options : Argument_List;
111 Options_2 : Argument_List;
112 Interfaces : Argument_List;
113 Lib_Filename : String;
114 Lib_Dir : String;
115 Symbol_Data : Symbol_Record;
116 Driver_Name : Name_Id := No_Name;
117 Lib_Version : String := "";
118 Auto_Init : Boolean := False);
119 -- Build a dynamic/relocatable library
121 -- Ofiles is the list of all object files in the library
123 -- Foreign is the list of non Ada object files (also included in Ofiles)
125 -- Afiles is the list of ALI files for the Ada object files
127 -- Options and Options_2 are lists of options to be passed to the tool
128 -- (gcc or other) that effectively builds the dynamic library. Options
129 -- are passed before the object files, Options_2 are passed after the
130 -- object files.
132 -- Interfaces is the list of ALI files for the interfaces of a SAL.
133 -- It is empty if the library is not a SAL.
135 -- Lib_Filename is the name of the library, without any prefix or
136 -- extension. For example, on Unix, if Lib_Filename is "toto", the
137 -- name of the library file will be "libtoto.so".
139 -- Lib_Dir is the directory path where the library will be located
141 -- For OSes that support symbolic links, Lib_Version, if non null,
142 -- is the actual file name of the library. For example on Unix, if
143 -- Lib_Filename is "toto" and Lib_Version is "libtoto.so.2.1",
144 -- "libtoto.so" will be a symbolic link to "libtoto.so.2.1" which
145 -- will be the actual library file.
147 -- Symbol_Data is used for some patforms, including VMS, to generate
148 -- the symbols to be exported by the library.
150 -- Note: Depending on the OS, some of the parameters may not be taken
151 -- into account. For example, on Linux, Foreign, Afiles Lib_Address and
152 -- Relocatable are ignored.
154 function Library_Exists_For
155 (Project : Project_Id; In_Tree : Project_Tree_Ref) return Boolean;
156 -- Return True if the library file for a library project already exists.
157 -- This function can only be called for library projects.
159 function Library_File_Name_For
160 (Project : Project_Id;
161 In_Tree : Project_Tree_Ref) return Name_Id;
162 -- Returns the file name of the library file of a library project.
163 -- This function can only be called for library projects.
165 end MLib.Tgt;