------------------------------------------------------------------------------
--                              Ada Web Server                              --
--                                                                          --
--                         Copyright (C) 2003-2007                          --
--                                 AdaCore                                  --
--                                                                          --
--  This library is free software; you can redistribute it and/or modify    --
--  it under the terms of the GNU General Public License as published by    --
--  the Free Software Foundation; either version 2 of the License, or (at   --
--  your option) any later version.                                         --
--                                                                          --
--  This library is distributed in the hope that it will be useful, but     --
--  WITHOUT ANY WARRANTY; without even the implied warranty of              --
--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU       --
--  General Public License for more details.                                --
--                                                                          --
--  You should have received a copy of the GNU General Public License       --
--  along with this library; if not, write to the Free Software Foundation, --
--  Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.          --
--                                                                          --
------------------------------------------------------------------------------

with "aws_xmlada";

with "../shared";
with "../include/include";
with "../ssl/ssl";
with "../win32/win32";

project Src is

   for Languages use ("Ada", "Project file", "makefile");

   for Source_Dirs
     use (".", "../templates_parser/src", "../config");

   --  XMLAda Installed, add xsrc and soap directories

   case Shared.XMLAda is
      when "Installed" =>
         for Source_Dirs use project'Source_Dirs &
           ("../xsrc", "../templates_parser/xsrc", "../soap");
      when "Disabled" =>
         null;
   end case;

   -- For Windows OS add the Win32 directory

   case Shared.OS is
      when "Windows_NT" =>
         for Source_Dirs use project'Source_Dirs & ("../win32");
      when others =>
         null;
   end case;

   for Object_Dir use "../" & Shared'Object_Dir & "/src";
   for Library_Dir use "../" & Shared'Library_Dir & "/src";

   case Shared.Library_Type is
      when "static" =>
         null;

      when "relocatable" =>
         case Shared.OS is
            when "Windows_NT" =>
               for Library_Options use
                 ("-laws_win32", "-lwsock32", "-lws2_32");
            when others =>
               null;
         end case;

         case Shared.LDAP is
            when "Installed" =>
               for Library_Options use Project'Library_Options & ("-lldap");
            when "Disabled" =>
               null;
         end case;
   end case;

   case Shared.LDAP is
      when "Disabled" =>
         for Locally_Removed_Files use
           ("aws-ldap.ads", "aws-ldap-thin.ads", "aws-ldap-thin.adb",
            "aws-ldap-client.ads", "aws-ldap-client.adb");
      when others =>
           null;
   end case;

   for Library_Name use "aws";
   for Library_Kind use Shared.Library_Type;

   ---------
   -- Ide --
   ---------

   package Ide renames Shared.IDE;

   --------------
   -- Compiler --
   --------------

   package Compiler renames Shared.Compiler;

   -------------
   -- Builder --
   -------------

   package Builder renames Shared.Builder;

   ------------
   -- Naming --
   ------------

   package Naming is

      -- Templates Parser

      for Specification ("Templates_Parser.Configuration")
        use "templates_parser-configuration__aws.ads";

      for Implementation ("Templates_Parser.Input")
        use "templates_parser-input__aws.adb";

      for Implementation ("Templates_Parser.Tasking")
        use "templates_parser-tasking__standard_tasking.adb";

      --  SOCKLIB

      case Shared.SOCKLIB is
         when "GNAT" =>
            for Implementation ("AWS.Net.Std")
              use "aws-net-std__gnat.adb";
         when "IPv6" =>
            for Implementation ("AWS.Net.Std")
              use "aws-net-std__ipv6.adb";
      end case;

      --  SSL Lib

      case Shared.Socket is
         when "std" =>
            for Implementation ("AWS.Net.SSL")
              use "aws-net-ssl__dummy.adb";
            for Implementation ("AWS.Net.SSL.Certificate")
              use "aws-net-ssl-certificate__dummy.adb";
         when "ssl"| "openssl" =>
            for Implementation ("AWS.Net.SSL")
              use "aws-net-ssl__openssl.adb";
            for Implementation ("AWS.Net.SSL.Certificate")
              use "aws-net-ssl-certificate__openssl.adb";
         when "gnutls" =>
            for Implementation ("AWS.Net.SSL")
              use "aws-net-ssl__gnutls.adb";
            for Implementation ("AWS.Net.SSL.Certificate")
              use "aws-net-ssl-certificate__gnutls.adb";
      end case;

   end Naming;

end Src;
