@@ -18,6 +18,10 @@ library project Langkit_Support is
1818 Library_Standalone : Library_Standalone_Type := external
1919 ("LANGKIT_SUPPORT_STANDALONE", external ("STANDALONE", "standard"));
2020
21+ SO_Name := External ("LANGKIT_SUPPORT_SONAME", "");
22+ Ada_Flags := External_As_List ("ADAFLAGS", " ");
23+ Ld_Flags := External_As_List ("LDFLAGS", " ");
24+
2125 for Languages use ("Ada");
2226 for Source_Dirs use (".");
2327 for Object_Dir use "obj/" & Build_Mode;
@@ -82,25 +86,39 @@ library project Langkit_Support is
8286 for Library_Kind use Library_Kind_Param;
8387 for Library_Dir use "lib/" & Library_Kind_Param & "/" & Build_Mode;
8488
89+ case Library_Kind_Param is
90+ when "relocatable" =>
91+ case SO_Name is
92+ when "" =>
93+ null;
94+ when others =>
95+ for Library_Version use SO_Name;
96+ end case;
97+ for Leading_Library_Options use Ld_Flags;
98+ when "static" | "static-pic" =>
99+ null;
100+ end case;
101+
85102 Common_Ada_Cargs := ("-gnatwa", "-gnatyg", "-fPIC");
86103
87104 package Compiler is
88105 case Build_Mode is
89106 when "dev" =>
90107 for Default_Switches ("Ada") use
91- Common_Ada_Cargs & ("-g", "-O0", "-gnatwe", "-gnata");
108+ Common_Ada_Cargs & ("-g", "-O0", "-gnatwe", "-gnata")
109+ & Ada_Flags;
92110
93111 when "prod" =>
94112 -- Debug information is useful even with optimization for
95113 -- profiling, for instance.
96114 for Default_Switches ("Ada") use
97- Common_Ada_Cargs & ("-g", "-Ofast");
115+ Common_Ada_Cargs & ("-g", "-Ofast") & Ada_Flags ;
98116
99117 when "prof" =>
100118 -- Ensure that we have a relatively fast build but with all
101119 -- possible stack info & debug info, for profiling.
102120 for Default_Switches ("Ada") use
103- ("-Og", "-ggdb", "-g3", "-fno-omit-frame-pointer");
121+ ("-Og", "-ggdb", "-g3", "-fno-omit-frame-pointer") & Adaflags ;
104122 end case;
105123 end Compiler;
106124
0 commit comments