1with "config";
2@WITH_XML_ADA@
3
4library project Util is
5   Version := "@UTIL_VERSION@";
6   Library_Dir := "@UTIL_LIBDIR@";
7
8   type Xml_Version_Type is ("none", "3", "4");
9
10   type Os_Version_Type is ("os-none", "os-linux", "os-win32");
11
12   Xml_Version : Xml_Version_Type := "@UTIL_XML_VERSION@";
13   Xml_Src_Dir := "@UTIL_XML_DIR@";
14   Asm_Src_Dir := "@UTIL_ASM_DIR@";
15   Os_Version  : Os_Version_Type := "@UTIL_OS_VERSION@";
16   Os_Src_Dir  := "src/@UTIL_OS_VERSION@";
17
18   --  Enable the compilation of Util.Serialize.Mappers.Vector_Mappers.
19   Has_Vector_Mappers : Config.Yes_No := "@UTIL_HAVE_VECTOR_MAPPERS@";
20
21   --  Enable the use of GNAT symbolic traceback.
22   Has_Gnat_Traceback : Config.Yes_No := "@UTIL_GNAT_TRACEBACK@";
23
24   Library_Type : Config.Library_Type_Type := external ("UTIL_LIBRARY_TYPE", "static");
25
26   package Naming is
27      case Xml_Version is
28         when "4" =>
29            for Implementation ("Util.Serialize.IO.XML.Get_Location")
30               use "util-serialize-io-xml-get_location-xmlada-4.adb";
31
32         when "3" =>
33            for Implementation ("Util.Serialize.IO.XML.Get_Location")
34               use "util-serialize-io-xml-get_location-xmlada-3.adb";
35
36         when "none" =>
37
38      end case;
39      case Has_Gnat_Traceback is
40         when "yes" =>
41            for Implementation ("Util.Log.Loggers.Traceback")
42               use "util-log-loggers-traceback-gnat.adb";
43
44         when "no" =>
45            for Implementation ("Util.Log.Loggers.Traceback")
46               use "util-log-loggers-traceback-none.adb";
47
48      end case;
49
50      --  The GNAT traceback is not available for shared libraries.
51      case Library_Type is
52         when "relocatable" =>
53            for Implementation ("Util.Log.Loggers.Traceback")
54               use "util-log-loggers-traceback-none.adb";
55
56         when others =>
57            null;
58
59      end case;
60   end Naming;
61
62   for Source_Dirs use ("src", "src/http", Asm_Src_Dir, Xml_Src_Dir, Os_Src_Dir);
63
64   --  GCC 4.7 fails to build the Vector_Mapper generic package.
65   case Has_Vector_Mappers is
66      when "no" =>
67         for Excluded_Source_Files use ("util-serialize-mappers-vector_mapper.ads",
68                     "util-serialize-mappers-vector_mapper.adb",
69                     "util-http-rest-rest_get_vector.ads",
70                     "util-http-rest-rest_get_vector.adb");
71
72      when "yes" =>
73         null;
74
75   end case;
76
77   for Library_Name use "ada_util";
78   for Library_Kind use Library_Type;
79   for Library_Version use "lib" & Project'Library_Name & ".so." & Version;
80   for Library_Options use (@UTIL_LIBRARY_OPTIONS@);
81
82   for Library_Dir use "lib/util/" & Project'Library_Kind;
83   for Object_Dir use "obj/util/" & Project'Library_Kind;
84
85   package Builder  renames Config.Builder;
86   package Compiler renames Config.Compiler;
87   package Ide      renames Config.Ide;
88
89   package Binder is
90       for Default_Switches ("Ada") use Config.Binder'Default_Switches ("Ada") & ("-a");
91   end Binder;
92
93end Util;
94