blob: af479e82c7d8dbddc0ff67797b145f84865840ae [file] [log] [blame]
<?xml version="1.0" standalone="no"?>
<!--
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
-->
<!DOCTYPE s1 SYSTEM "sbk:/style/dtd/document.dtd">
<s1 title="Build Instructions">
<s2 title="Build Instructions">
<p>Build instructions are provided for the following platforms and
compilers:</p>
<ul>
<li><link anchor="UNIX">UNIX/Linux/Mac OS X/Cygwin/MinGW</link></li>
<li><link anchor="Windows">Windows using Microsoft Visual C++</link></li>
<li><link anchor="BorlandCC">Windows using Borland C++</link></li>
<li><link anchor="BorlandBuilder">Windows using Borland C++ Builder</link></li>
</ul>
<anchor name="UNIX"/>
<s3 title="Building on UNIX/Linux/Mac OS X/Cygwin/MinGW platforms">
<p>For building on UNIX and UNIX-like (GNU/Linux, Max OS X,
Cygwin, MinGW-MSYS) platforms &XercesCName; uses the
GNU automake-based build systems and requires that you
have <jump href="http://www.gnu.org/software/make/make.html">GNU
make</jump> installed. On some platforms GNU make is called gmake
instead of make.</p>
<p>As with all automake-based projects the build process is divided
into two parts: configuration and building. The configuration
part is performed using the <code>configure</code> script that
can be found in the <code>&XercesC3SrcInstallDir;</code> directory.
The build part is performed by invoking <code>make</code>.</p>
<p>Besides the standard <code>configure</code> options which
you can view by running <code>configure --help</code>,
&XercesCName; provides a number of project-specific options
that are worth mentioning. You can specify one option for
each category outlined below. If you do not specify anything
for a particular category then <code>configure</code> will
select the most appropriate default. At the end of its
execution <code>configure</code> prints the selected
values for each category.</p>
<p>Net Accessor (used to access network resources):</p>
<table>
<tr>
<th>Option</th>
<th>Description</th>
</tr>
<tr>
<td><code>--enable-netaccessor-curl</code></td>
<td>use the libcurl library</td>
</tr>
<tr>
<td><code>--enable-netaccessor-socket</code></td>
<td>use plain sockets</td>
</tr>
<tr>
<td><code>--enable-netaccessor-cfurl</code></td>
<td>use the CFURL API (only on Mac OS X)</td>
</tr>
<tr>
<td><code>--enable-netaccessor-winsock</code></td>
<td>use WinSock (only on Windows, Cygwin, MinGW)</td>
</tr>
<tr>
<td><code>--disable-network</code></td>
<td>disable network support</td>
</tr>
</table>
<p>Transcoder (used to convert between internal UTF-16 and other encodings):</p>
<table>
<tr>
<th>Option</th>
<th>Description</th>
</tr>
<tr>
<td><code>--enable-transcoder-gnuiconv</code></td>
<td>use the GNU iconv library</td>
</tr>
<tr>
<td><code>--enable-transcoder-iconv</code></td>
<td>use the iconv library</td>
</tr>
<tr>
<td><code>--enable-transcoder-icu</code></td>
<td>use the ICU library</td>
</tr>
<tr>
<td><code>--enable-transcoder-macosunicodeconverter</code></td>
<td>use Mac OS X APIs (only on Mac OS X)</td>
</tr>
<tr>
<td><code>--enable-transcoder-windows</code></td>
<td>use Windows APIs (only on Windows, Cygwin, MinGW)</td>
</tr>
</table>
<p>Message Loader (used to access diagnostics messages):</p>
<table>
<tr>
<th>Option</th>
<th>Description</th>
</tr>
<tr>
<td><code>--enable-msgloader-inmemory</code></td>
<td>store the messages in memory</td>
</tr>
<tr>
<td><code>--enable-msgloader-icu</code></td>
<td>store the messages using the ICU resource bundles</td>
</tr>
<tr>
<td><code>--enable-msgloader-iconv</code></td>
<td>store the messages in the iconv message catalog</td>
</tr>
</table>
<p>Thread support is enabled by default and can be disabled with the
<code>--disable-threads</code> option.</p>
<p>By default <code>configure</code> selects both shared and static
libraries. You can use the <code>--disable-shared</code> and
<code>--disable-static</code> options to avoid building the
version you don't need.</p>
<p>Finally, to make the build process cleaner the &XercesCName;
build system hides actual compiler commands being executed
by <code>make</code>. If you would like to see those then you
can specify the <code>--disable-pretty-make</code> option.</p>
<p>If you need to specify compiler executables that should be
used to build &XercesCName;, you can set the CC and CXX
variables when invoking <code>configure</code>. Similarly,
if you need to specify additional compiler or linker options,
you can set the CFLAGS, CXXFLAGS, and LDFLAGS variables.
For example:</p>
<source>./configure --disable-static CC=gcc-4.3 CXX=g++-4.3 CFLAGS=-O3 CXXFLAGS=-O3</source>
<p>Once the configuration part is complete you can run
<code>make</code> (or <code>gmake</code>). Running
<code>make</code> from the <code>&XercesC3SrcInstallDir;</code>
directory builds &XercesCName; library and examples. If
you like to build only the library, you can run make from
<code>&XercesC3SrcInstallDir;/src</code>.</p>
<p>If you would like to build the tests and run the
automated test suite, run <code>make check</code>
from the <code>&XercesC3SrcInstallDir;</code>
directory. The automated test suite required
Perl and the <code>diff</code> command.</p>
<p>Some platforms and configurations require extra
<code>configure</code> and <code>make</code> options
which are shown in the following table.</p>
<table>
<tr>
<th>Platform</th>
<th>Compiler</th>
<th>Options</th>
</tr>
<tr>
<td>Solaris x86</td>
<td>Sun CC</td>
<td><code>./configure CXX=CC CC=cc</code></td>
</tr>
<tr>
<td>Solaris x86-64</td>
<td>Sun CC</td>
<td><code>./configure CXX=CC CC=cc CFLAGS=-xarch=amd64 CXXFLAGS=-xarch=amd64</code></td>
</tr>
<tr>
<td>Solaris SPARC</td>
<td>Sun CC</td>
<td><code>/configure CXX=CC CC=cc</code></td>
</tr>
<tr>
<td>Solaris SPARCv9</td>
<td>Sun CC</td>
<td><code>./configure CXX=CC CC=cc CFLAGS=-xarch=v9 CXXFLAGS=-xarch=v9</code></td>
</tr>
<tr>
<td>AIX PowerPC</td>
<td>IBM XL C++</td>
<td><code>./configure CXX=xlC_r CC=xlc_r</code><br/>
<code>gmake libxerces_c_la_LDFLAGS=-qmkshrobj</code></td>
</tr>
<tr>
<td>AIX PowerPC-64</td>
<td>IBM XL C++</td>
<td><code>export OBJECT_MODE=64</code><br/>
<code>./configure CXX=xlC_r CC=xlc_r CXXFLAGS=-q64 CFLAGS=-q64</code><br/>
<code>gmake libxerces_c_la_LDFLAGS=-qmkshrobj</code></td>
</tr>
<tr>
<td>HP-UX IA-64-32</td>
<td>HP aCC</td>
<td><code>./configure CXX=aCC CC=aCC CFLAGS=-mt CXXFLAGS=-mt LDFLAGS=-mt</code></td>
</tr>
<tr>
<td>HP-UX IA-64</td>
<td>HP aCC</td>
<td><code>./configure CXX=aCC CC=aCC CFLAGS="-mt +DD64" CXXFLAGS="-mt +DD64" LDFLAGS="-mt +DD64"</code></td>
</tr>
<tr>
<td>Mac OS X x86-64</td>
<td>GCC</td>
<td><code>/configure CFLAGS="-arch x86_64" CXXFLAGS="-arch x86_64" </code></td>
</tr>
<tr>
<td>Mac OS X PowerPC-64</td>
<td>GCC</td>
<td><code>./configure CFLAGS="-arch ppc64" CXXFLAGS="-arch ppc64"</code></td>
</tr>
<tr>
<td>Mac OS X x86/PowerPC</td>
<td>GCC</td>
<td><code>./configure --disable-dependency-tracking CFLAGS="-arch i386 -arch ppc" CXXFLAGS="-arch i386 -arch ppc"</code></td>
</tr>
<tr>
<td>Mingw x86</td>
<td>GCC</td>
<td><code>./configure LDFLAGS=-no-undefined</code></td>
</tr>
<tr>
<td>Cygwin x86</td>
<td>GCC</td>
<td><code>./configure LDFLAGS=-no-undefined</code></td>
</tr>
</table>
<p/>
<note>
Note that different UNIX platforms use different system
environment variable for finding libraries. On Linux
and Solaris, the environment variable name is
<code>LD_LIBRARY_PATH</code>, on AIX it is
<code>LIBPATH</code>, on Mac OS X it is
<code>DYLD_LIBRARY_PATH</code>, and on HP-UX
it is <code>SHLIB_PATH</code>.
</note>
<note>
Note that Cygwin and MinGW are different from the UNIX platforms
in the way they find libraries at run time. While UNIX platforms
may use the <code>LD_LIBRARY_PATH</code> environment variable,
Cygwin and MinGW use the <code>PATH</code> environment variable.
</note>
</s3>
<anchor name="Windows"/>
<s3 title="Building on Windows using Microsoft Visual C++">
<p>&XercesCName; source distribution comes with Microsoft Visual C++ projects and solutions.
The following describes the steps you need to build with this compiler.</p>
<p>To build &XercesCName; from the source distribution you will
need to open the solution containing the project. The solutions
containing the &XercesCName; project files are in the following
sub-directories in the <code>&XercesC3SrcInstallDir;</code>
directory:</p>
<source>
(For VC6) projects\Win32\VC6\xerces-all\xerces-all.dsw
(For VC7.1) projects\Win32\VC7.1\xerces-all\xerces-all.sln
(For VC8) projects\Win32\VC8\xerces-all\xerces-all.sln
(For VC9) projects\Win32\VC9\xerces-all\xerces-all.sln
</source>
<p>Once you have the solution open, you need to build the
project named <code>XercesLib</code>. You can select
Debug/Release, Static/DLL, and, for VC8 and VC9, 32/64 bit
builds using the Configuration Manager dialog. You
can also select whether the &XercesCName; library
should use ICU for transcoding.</p>
<p>When building your own applications you need to make sure
that you are linking your application with the
&XercesC3WindowsLib;.lib library (or Debug/Static version of it)
and also that the associated DLL is somewhere in the
executable/DLL search path (<code>PATH</code>).</p>
<note>If you are linking your application to the static
&XercesCName; library,
then you will need to compile your application with the
XERCES_STATIC_LIBRARY preprocessor macro defined in order
to turn off the DLL import/export mechanism.</note>
<p>If you would also like to build tests and/or samples, inside
the solution files mentioned above (<code>xerces-all.dsw</code>
or <code>xerces-all.sln</code>), you'll find several other
projects which are for the tests and samples. Select all
the tests/samples that you would like to build and then
right click on the selection. Choose "Build (selection
only)" to build all the selected projects in one shot.</p>
</s3>
<anchor name="BorlandBuilder"/>
<s3 title="Building on Windows using Borland C++ Builder">
<p>&XercesCName; source distribution comes with the
Borland C++ Builder 6 projects. The following describes the steps you
need to build with this compiler.</p>
<p>The library and example projects are all contained in the
Xerces-all project group:
<code>&XercesC3SrcInstallDir;\projects\Win32\BCB6\Xerces-all\Xerces-all.bpg</code>.
Each project in the group refers a directory below <code>Xerces-all\</code>.
For example, the XercesLib project files are contained in the directory
<code>&XercesC3SrcInstallDir;\projects\Win32\BCB6\Xerces-all\XercesLib</code>.</p>
<p>To build a project, open the project manager, double click on the project
name, and select "Project -> Build" from the menu. For example, double click
on XercesLib.dll in the manager then select "Project -> Build XercesLib" from
the menu.
</p>
</s3>
<anchor name="BorlandCC"/>
<s3 title="Building on Windows using Borland C++">
<p>&XercesCName; source distribution comes with the Borland C++ makefiles. The
following describes the steps you need to build &XercesCName; with this compiler.</p>
<ol>
<li>Change to the <code>&XercesC3SrcInstallDir;\projects\Win32\BCC.551\Xerces-all</code> directory</li>
<li>Run <code>MakeBuildDirs.bat</code></li>
<li><code>make -f Xerces-all.mak</code> to build the library, examples, and tests.</li>
</ol>
</s3>
</s2>
</s1>