\chapter{SWI-Prolog License Conditions and Tools} \label{sec:license} As of version 7.4.0\footnote{Actually pre-release 7.3.33}, the SWI-Prolog source code is distributed under the \href{https://opensource.org/licenses/BSD-2-Clause}{Simplified BSD} license: \begin{verbatim} Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \end{verbatim} \noindent This, unfortunately, \textbf{does not mean you can any version of SWI-Prolog under the above license}. The SWI-Prolog core may be linked to libraries that are more restrictive and in addition your code may have loaded extension packages that have more restrictive conditions. In particular, the core is by default linked to \href{https://gmplib.org/}{libgmp}, distributed under the Lesser GNU Public license. The above implies you need to configure and recompile the system without these components. For this we provide options to the \program{configure} script: \begin{code} ./configure --without-gpl ./configure --without-lgpl \end{code} \noindent The GNU MP Bignum Library provides unbounded integers, rational numbers and some cryptographical functionality. As libgmp is provided under the Lesser GNU Public license it may legally be combined with proprietary software as long as libgmp is \jargon{dynamically linked} (default) and the end user can replace the libgmp shared object and use your application with their (possibly modified) version of libgmp. In practice this leads to problems if the application is not accessible (e.g., embedded in closed hardware) or you want to avoid customers to peek around in the process memory as they can easily do so by adding a backdoor to the modified LGPL component. Note that such a protection is in general not possible anyway if the customer has unrestricted access to the machine on which the application runs. \section{Contributing to the SWI-Prolog project} \label{sec:contrib} To reach maximal coherence we will, as a rule of thumb, only accept new code that has the Simplified BSD license and existing code with a \jargon{permissive} license such as MIT, Apache, BSD-3, etc. In exceptional cases we may accept code with GPL or LGPL conditions. Such code must be tagged using a \index{license/1}\predref{license}{1} directive (Prolog) or a call to \cfuncref{PL_license}{} for foreign code and, if they are part of the core, the code must be excluded using the \verb$--without-gpl$ or \verb$--without-lgpl$ option. \section{Software support to keep track of license conditions} \label{sec:softlicense} Given the above, it is possible that SWI-Prolog packages and extensions rely on the GPL, LGPL or other licenses. The predicates below allow for registering license requirements for Prolog files and foreign modules. The predicate \index{license/0}\predref{license}{0} reports which components from the currently configured system are distributed under non-permissive open source licenses and therefore may need to be replaced to suit your requirements. \begin{description} \predicate{license}{0}{} Evaluate the license conditions of all loaded components. If the system contains one or more components that are licenced under GPL-like restrictions the system indicates this program may only be distributed under the \const{GPL} license as well as which components prohibit the use of other license conditions. Likewise for for LGPL components. \predicate{license}{2}{+LicenseId, +Component} Register the fact that \arg{Component} is distributed under a license identified by \arg{LicenseId}. Known license identifiers can be listed using \index{known_licenses/0}\predref{known_licenses}{0}. A new license can be registered as a known language using a declaration like below. The second argument defines the \jargon{category} if the license, which is one of \const{gpl}, \const{lgpl}, \const{permissive} or \const{proprietary}. \begin{code} :- multifile license:license/3. license:license(mylicense, permissive, [ comment('My personal license'), url('http://www.mine.org/license.html') ]). :- license(mylicense). \end{code} \noindent \predicate{license}{1}{+LicenseId} Intended as a directive in Prolog source files. It takes the current filename and calls \index{license/2}\predref{license}{2}. \cfunction{void}{PL_license}{const char *LicenseId, const char *Component} Intended for the install() procedure of foreign libraries. This call can be made \emph{before} \cfuncref{PL_initialise}{}. \predicate{known_licenses}{0}{} List all licenses \emph{known} to the system. This does not imply the system contains code covered by the listed licenses. See \index{license/2}\predref{license}{2}. \end{description} \section{License conditions inherited from used code} \label{sec:otherlicenses} \subsection{Cryptographic routines} \label{sec:cryptlicense} Cryptographic routines are used in \index{variant_sha1/2}\predref{variant_sha1}{2} and \pllib{crypt}. These routines are provided under the following conditions: \begin{verbatim} Copyright (c) 2002, Dr Brian Gladman, Worcester, UK. All rights reserved. LICENSE TERMS The free distribution and use of this software in both source and binary form is allowed (with or without changes) provided that: 1. distributions of this source code include the above copyright notice, this list of conditions and the following disclaimer; 2. distributions in binary form include the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other associated materials; 3. the copyright holder's name is not used to endorse products built using this software without specific written permission. ALTERNATIVELY, provided that this notice is retained in full, this product may be distributed under the terms of the GNU General Public License (GPL), in which case the provisions of the GPL apply INSTEAD OF those given above. DISCLAIMER This software is provided 'as is' with no explicit or implied warranties in respect of its properties, including, but not limited to, correctness and/or fitness for purpose. \end{verbatim} \noindent % do not remove