1 <!-- $Id: installation.xml,v 1.31 2006-05-03 13:38:12 adam Exp $ -->
2 <chapter id="installation"><title>Compilation and Installation</title>
4 <sect1><title>Introduction</title>
6 The latest version of the software will generally be found at:
9 <ulink url="&url.yaz.download;"/>
12 We have tried our best to keep the software portable, and on many
13 platforms, you should be able to compile everything with little or
18 The software is regularly tested on
19 <ulink url="&url.debian;">Debian GNU/Linux</ulink>,
20 <ulink url="&url.redhat;">Redhat Linux</ulink>,
21 <ulink url="&url.gentoo;">Gentoo Linux</ulink>,
22 <ulink url="&url.freebsd;">FreeBSD (i386)</ulink>,
23 <ulink url="&url.macosx;">MAC OSX</ulink>,
24 <ulink url="&url.solaris;">SunOS 5.8 (sparc)</ulink>,
25 <ulink url="&url.windows2000;">Windows 2000</ulink>,
26 <ulink url="&url.windows2003server;">Windows 2003 server</ulink>.
30 Some versions have be known to work on HP/UX,
31 DEC Unix, <ulink url="&url.netbsd;">NetBSD</ulink>,
32 <ulink url="&url.openbsd;">OpenBSD</ulink>,
34 Data General DG/UX (with some CFLAGS tinkering),
35 SGI/IRIX, DDE Supermax, Apple Macintosh (using the Codewarrior programming
36 environment and the GUSI socket libraries),
41 If you move the software to other platforms, we'd be grateful if you'd
42 let us know about it. If you run into difficulties, we will try to help
43 if we can, and if you solve the problems, we would be happy to include
44 your fixes in the next release. So far, we have mostly avoided
45 <literal>#ifdefs</literal> for individual platforms, and we'd
46 like to keep it that way as far as it makes sense.
50 We maintain a mailing-list for the purpose of announcing new releases and
51 bug-fixes, as well as general discussion. Subscribe by
53 <ulink url="&url.yaz.mailinglist;">here</ulink>.
54 General questions and problems can be directed at
55 <ulink url="&url.yaz.mail;"/>, or the address given at the top of
60 <sect1 id="installation.unix"><title>UNIX</title>
64 <ulink url="&url.debian;">Debian GNU/Linux</ulink>
66 <ulink url="&url.redhat;">Redhat</ulink> packages for &yaz;.
67 Only i386 binary packages are available. You should be able to
68 create packages for other CPUs by building them from the source
72 <sect2 id="installation.source.unix">
73 <title>Compiling from source on Unix</title>
76 Note that if your system doesn't have a native ANSI C compiler, you may
77 have to acquire one separately. We recommend
78 <ulink url="&url.gcc;">GCC</ulink>.
82 If you wish to use character set conversion facilities in &yaz; or if you
83 are compiling &yaz; for use with Zebra it is a good idea to ensure that
84 the iconv library is installed. Some Unixes today already have it
86 <ulink url="&url.libiconv;">GNU libiconv</ulink>.
90 The <ulink url="&url.libxslt;">libxslt</ulink>,
91 <ulink url="&url.libxml2;">libxml2</ulink> librararies are required
92 if &yaz; is to support SRU.
93 These libraries are very portable and should compile out-of-the
94 box on virtually all Unix platforms. It is available in binary
95 forms for Linux and others.
100 <ulink url="&url.autoconf;">Autoconf</ulink>,
101 <ulink url="&url.automake;">Automake</ulink> and
102 <ulink url="&url.libtool;">Libtool</ulink>
103 are used to generate Makefiles and configure &yaz; for the system.
104 You do <emphasis>not</emphasis> these tools unless you're using the
105 CVS version of &yaz;.
109 The CQL parser for &yaz; is built using
110 GNU <ulink url="&url.bison;">Bison</ulink>.
111 This tool is only needed if you're using the CVS version of &yaz;.
115 &yaz; includes a tiny ASN.1 compiler. This compiler is
116 written in <ulink url="&url.tcl;">Tcl</ulink>.
117 But as for Bison you do not need it unless you're using CVS
118 version of &yaz; or you're using the compiler to built own codecs
123 Generally it should be sufficient to run configure without options,
132 The configure script attempts to use use the C compiler specified by
133 the <literal>CC</literal> environment variable. If not set, GNU C will be
134 used if it is available. The <literal>CFLAGS</literal> environment
135 variable holds options to be passed to the C compiler. If you're using
136 Bourne-compatible shell you may pass something like this to use a
137 particular C compiler with optimization enabled:
141 CC=/opt/ccs/bin/cc CFLAGS=-O ./configure
145 To customize &yaz;, the configure script also accepts a set of options.
146 The most important are:
150 <literal>--prefix</literal>=<replaceable>prefix</replaceable></term>
151 <listitem><para>Specifies installation prefix for &yaz;. This is
152 only needed if you run <literal>make install</literal> later to
153 perform a "system" installation. The prefix is
154 <literal>/usr/local</literal> if not specified.
157 <varlistentry><term><literal>--enable-tcpd</literal></term>
158 <listitem><para>The front end server will be built using Wietse's
159 <ulink url="&url.tcpwrapper;">TCP wrapper library</ulink>.
160 It allows you to allow/deny clients depending on IP number.
161 The TCP wrapper library is often used in GNU/Linux and
165 <refentrytitle>hosts_access</refentrytitle>
166 <manvolnum>5</manvolnum>
170 <refentrytitle>tcpd</refentrytitle>
171 <manvolnum>8</manvolnum>
176 <varlistentry><term><literal>--enable-threads</literal></term>
177 <listitem><para>&yaz; will be built using POSIX threads.
178 Specifically, <constant>_REENTRANT</constant> will be defined during
183 <varlistentry><term><literal>--enable-shared</literal></term>
184 <listitem><para>The make process will create shared
185 libraries (also known as shared objects <filename>.so</filename>).
186 By default, no shared libraries are created -
187 equivalent to <literal>--disable-shared</literal>.
191 <varlistentry><term><literal>--disable-shared</literal></term>
192 <listitem><para>The make process will not create
193 static libraries (<filename>.a</filename>).
194 By default, static libraries are created -
195 equivalent to <literal>--enable-static</literal>.
200 <literal>--with-iconv</literal>[=<replaceable>prefix</replaceable>]
202 <listitem><para>Compile &yaz; with iconv library in directory
203 <replaceable>prefix</replaceable>. By default configure will
204 search for iconv on the system. Use this option if it
205 doesn't find iconv. Alternatively,
206 <literal>--without-iconv</literal>, can be uset to force &yaz;
212 <literal>--with-xslt</literal>[=<replaceable>prefix</replaceable>]
214 <listitem><para>Compile &yaz; with
215 <ulink url="&url.libxslt;">libxslt</ulink> in directory
216 <replaceable>prefix</replaceable>.
217 Use this option if you want SRU support.
218 By default, configure will
219 search for libxslt on the system. Use this option if it
220 libxslt is not found automatically. Alternatively,
221 <literal>--without-xslt</literal>, can be used to force &yaz;
227 <literal>--with-openssl</literal>[=<replaceable>prefix</replaceable>]
229 <listitem><para>&yaz; will be linked with the OpenSSL libraries and
230 an SSL COMSTACK will be provided. Note that SSL support is still
239 When configured, build the software by typing:
246 The following files are generated by the make process:
248 <varlistentry><term><filename>src/libyaz.la</filename></term>
250 Main &yaz; library. This is no ordinary library. It's
252 By default, &yaz; creates a static library in
253 <filename>lib/.libs/libyaz.a</filename>.
257 <varlistentry><term><filename>src/libyazthread.la</filename></term>
259 When threading is supported/enabled by configure this Libtool
260 library is created. It includes functions that allows &yaz;
265 <varlistentry><term><filename>ztest/yaz-ztest</filename></term>
266 <listitem><para>Test Z39.50 server.
270 <varlistentry><term><filename>client/yaz-client</filename></term>
271 <listitem><para>Z39.50 client for testing the protocol.
272 See chapter <link linkend="client">
273 YAZ client</link> for more information.
277 <varlistentry><term><filename>util/yaz-config</filename></term>
278 <listitem><para>A Bourne-shell script, generated by configure, that
279 specifies how external applications should compile - and link with
284 <varlistentry><term><filename>util/yaz-asncomp</filename></term>
285 <listitem><para>The ASN.1 compiler for &yaz;. Requires the
286 Tcl Shell, <application>tclsh</application>, in
287 <literal>PATH</literal> to operate.
291 <varlistentry><term><filename>util/yaz-iconv</filename></term>
292 <listitem><para>This program converts data in one character set to
293 another. This command exercises the YAZ character set
298 <varlistentry><term><filename>util/yaz-marcdump</filename></term>
299 <listitem><para>This program parses ISO2709 encoded MARC records
300 and prints them in line-format or XML.
304 <varlistentry><term><filename>zoom/zoomsh</filename></term>
306 A simple shell implemented on top of the
307 <link linkend="zoom">ZOOM</link> functions.
308 The shell is a command line application that allows you to enter
309 simple commands to perform ZOOM operations.
313 <varlistentry><term><filename>zoom/zoomtst1</filename>,
314 <filename>zoom/zoomtst2</filename>, ..</term>
316 Several small applications that demonstrates the ZOOM API.
324 If you wish to install &yaz; in system directories
325 <filename>/usr/local/bin</filename>,
326 <filename>/usr/local/lib</filename> .. etc, you can type:
334 You probably need to have root access in order to perform this.
335 You must specify the <literal>--prefix</literal> option for configure if
336 you wish to install &yaz; in other directories than the default
337 <filename>/usr/local/</filename>.
341 If you wish to perform an un-installation of &yaz;, use:
349 This will only work if you haven't reconfigured &yaz; (and therefore
350 changed installation prefix). Note that uninstall will not
351 remove directories created by make install, e.g.
352 <filename>/usr/local/include/yaz</filename>.
356 <sect2><title>How to make apps using YAZ on UNIX</title>
358 This section describes how to compile - and link your own
359 applications using the &yaz; toolkit.
360 If you're used to Makefiles this shouldn't be hard. As for
361 other libraries you have used before, you have to set a proper include
362 path for your C/C++ compiler and specify the location of
363 &yaz; libraries. You can do it by hand, but generally we suggest
364 you use the <filename>yaz-config</filename> that is generated
365 by <filename>configure</filename>. This is especially
366 important if you're using the threaded version of &yaz; which
367 require you to pass more options to your linker/compiler.
370 The <filename>yaz-config</filename> script accepts command line
371 options that makes the <filename>yaz-config</filename> script print
372 options that you should use in your make process.
373 The most important ones are:
374 <literal>--cflags</literal>, <literal>--libs</literal>
375 which prints C compiler flags, and linker flags respectively.
378 A small and complete <literal>Makefile</literal> for a C
379 application consisting of one source file,
380 <filename>myprog.c</filename>, may look like this:
382 YAZCONFIG=/usr/local/bin/yaz-config
383 CFLAGS=`$(YAZCONFIG) --cflags`
384 LIBS=`$(YAZCONFIG) --libs`
386 $(CC) $(CFLAGS) -o myprog myprog.o $(LIBS)
390 The CFLAGS variable consists of a C compiler directive that will set
391 the include path to the <emphasis>parent</emphasis> directory
392 of <filename>yaz</filename>. That is, if &yaz; header files were
393 installed in <filename>/usr/local/include/yaz</filename>,
394 then include path is set to <filename>/usr/local/include</filename>.
395 Therefore, in your applications you should use
397 #include <yaz/proto.h>
399 and <emphasis>not</emphasis>
401 #include <proto.h>
405 For Libtool users, the <filename>yaz-config</filename> script provides
406 a different variant of option <literal>--libs</literal>, called
407 <literal>--lalibs</literal> that returns the name of the
408 Libtool acrhive(s) for &yaz; rather than the ordinary ones.
411 For applications using the threaded version of &yaz;,
412 specify <literal>threads</literal> after the
413 other options. When <literal>threads</literal> is given,
414 more flags and linker flags will be printed by
415 <filename>yaz-config</filename>. If our previous example was
416 using threads, you'd have to modify the lines that set
417 <literal>CFLAGS</literal> and <literal>LIBS</literal> as
420 CFLAGS=`$(YAZCONFIG) --cflags threads`
421 LIBS=`$(YAZCONFIG) --libs threads`
423 There is no need specify POSIX thread libraries in your Makefile.
424 The <literal>LIBS</literal> variable includes that as well.
428 <sect1 id="installation.win32"><title>WIN32</title>
430 <para>The easiest way to install YAZ on Windows is by downloading
432 <ulink url="&url.yaz.download.win32;">here</ulink>.
433 The installer comes with source too - in case you wish to
434 compile YAZ with different Compiler options etc.
437 <sect2 id="installation.win32.source">
438 <title>Compiling from Source on WIN32</title>
440 &yaz; is shipped with "makefiles" for the NMAKE tool that comes
441 with <ulink url="&url.vstudio;">
442 Microsoft Visual Studio</ulink>.
443 Version 6 and .NET has been tested. We expect that &yaz; compiles
444 with version 5 as well.
447 Start a command prompt and switch the sub directory
448 <filename>WIN</filename> where the file <filename>makefile</filename>
449 is located. Customize the installation by editing the
450 <filename>makefile</filename> file (for example by using notepad).
452 The following summarizes the most important settings in that file:
455 <varlistentry><term><literal>DEBUG</literal></term>
457 If set to 1, the software is
458 compiled with debugging libraries (code generation is
459 multi-threaded debug DLL).
460 If set to 0, the software is compiled with release libraries
461 (code generation is multi-threaded DLL).
465 <term><literal>HAVE_TCL</literal>, <literal>TCL</literal></term>
467 If <literal>HAVE_TCL</literal> is set to 1, nmake will
468 use the ASN.1 compiler (Tcl based). You must set
469 <literal>TCL</literal> to the full path of the Tcl
473 If you do not have Tcl installed, set
474 <literal>HAVE_TCL</literal> to 0.
479 <term><literal>HAVE_BISON</literal>,
480 <literal>BISON</literal></term>
482 If GNU Bison is present, you might set <literal>HAVE_ICONV</literal>
483 to 1 and specify the Bison executable in <literal>BISON</literal>.
484 Bison is only required if you use the CVS version of
485 YAZ or if you modify the grammar for CQL
486 (<filename>cql.y</filename>).
489 A Windows version of GNU Bison is part of
490 <ulink url="&url.unxutils;">unxutils</ulink>.
495 <term><literal>HAVE_ICONV</literal>,
496 <literal>ICONV_DIR</literal></term>
498 If <literal>HAVE_ICONV</literal> is set to 1, YAZ is compiled
499 with iconv support. In this configuration, set
500 <literal>ICONV_DIR</literal> to the iconv source directory.
505 <term><literal>HAVE_LIBXML2</literal>,
506 <literal>LIBXML2_DIR</literal></term>
509 If <literal>HAVE_LIBXML2</literal> is set to 1, YAZ is compiled
510 with SRU support. In this configuration, set
511 <literal>LIBXML2_DIR</literal> to the
512 <ulink url="&url.libxml2;">libxml2</ulink> source directory
514 <literal>ZLIB_DIR</literal> to the zlib directory.
518 Windows versions of libxslt, libxml2, zlib and iconv can be found
519 <ulink url="&url.libxml2.download.win32;">
520 Igor Zlatković' site</ulink>.
525 YAZ is not using zlib but libxml2 is depending on it.
532 <term><literal>HAVE_LIBXSLT</literal>,
533 <literal>LIBXSLT_DIR</literal></term>
536 If <literal>HAVE_LIBXSLT</literal> is set to 1, YAZ is compiled
537 with XSLT support. In this configuration, set
538 <literal>LIBXSLT_DIR</literal> to the
539 <ulink url="&url.libxslt;">libxslt</ulink> source directory.
544 libxslt depends libxml2.
554 When satisfied with the settings in the makefile, type
561 If the <filename>nmake</filename> command is not found on your system
562 you probably haven't defined the environment variables required to
563 use that tool. To fix that, find and run the batch file
564 <filename>vcvars32.bat</filename>. You need to run it from within
565 the command prompt or set the environment variables "globally";
566 otherwise it doesn't work.
570 If you wish to recompile &yaz; - for example if you modify
571 settings in the <filename>makefile</filename> you can delete
572 object files, etc by running.
578 The following files are generated upon successful compilation:
581 <varlistentry><term><filename>bin/yaz.dll</filename></term>
583 &yaz; release mode multi-threaded Dynamic Link Library.
584 </para></listitem></varlistentry>
586 <varlistentry><term><filename>lib/yaz.lib</filename></term>
588 Import library for <filename>yaz.dll</filename>.
589 </para></listitem></varlistentry>
591 <varlistentry><term><filename>bin/yazd.dll</filename></term>
593 &yaz; debug mode multi-threaded Dynamic Link Library.
594 </para></listitem></varlistentry>
596 <varlistentry><term><filename>lib/yazd.lib</filename></term>
598 Import library for <filename>yazd.dll</filename>.
599 </para></listitem></varlistentry>
601 <varlistentry><term><filename>bin/yaz-client.exe</filename></term>
603 &yaz; Z39.50 client application. It's a WIN32 console application.
604 See chapter <link linkend="client">YAZ client</link> for more
606 </para></listitem></varlistentry>
608 <varlistentry><term><filename>bin/yaz-ztest.exe</filename></term>
610 Z39.50 multi-threaded test/example server. It's a WIN32
612 </para></listitem></varlistentry>
614 <varlistentry><term><filename>bin/zoomsh.exe</filename></term>
616 Simple console application implemented on top of the
617 <link linkend="zoom">ZOOM</link> functions.
618 The application is a command line shell that allows you to enter
619 simple commands to perform ZOOM operations.
620 </para></listitem></varlistentry>
622 <varlistentry><term><filename>bin/zoomtst1.exe</filename>,
623 <filename>bin/zoomtst2.exe</filename>, ..</term>
625 Several small applications that demonstrates the ZOOM API.
626 </para></listitem></varlistentry>
633 <sect2><title>How to make apps using YAZ on WIN32</title>
635 This section will go though the process of linking your WIN32
636 applications with &yaz;.
639 Some people are confused by the fact that we use the nmake
640 tool to build &yaz;. They think they have to do that too - in order
641 to make their WIN32 applications work with &yaz;. The good news is that
642 you don't have to. You can use the integrated environment of
643 Visual Studio if desired for your own application.
646 When setting up a project or Makefile you have to set the following:
648 <varlistentry><term>include path</term><listitem><para>
649 Set it to the <filename>include</filename> directory of &yaz;.
650 </para></listitem></varlistentry>
651 <varlistentry><term>import library <filename>yaz.lib</filename>
652 </term><listitem><para>
653 You must link with this library. It's located in the
654 sub directory <filename>lib</filename> of &yaz;.
655 If you want to link with the debug version of &yaz;, you must
656 link with <filename>yazd.dll</filename> instead.
657 </para></listitem></varlistentry>
658 <varlistentry><term>dynamic link library <filename>yaz.dll</filename>
659 </term><listitem><para>
660 This DLL must be in your execution path when you invoke
661 your application. Specifically, you should distribute this
662 DLL with your application.
663 </para></listitem></varlistentry>
670 <!-- Keep this comment at the end of the file
675 sgml-minimize-attributes:nil
676 sgml-always-quote-attributes:t
679 sgml-parent-document: "yaz.xml"
680 sgml-local-catalogs: nil
681 sgml-namecase-general:t