1 <chapter id="installation"><title>Compilation and Installation</title>
3 <sect1 id="installation-introduction"><title>Introduction</title>
5 The latest version of the software will generally be found at:
8 <ulink url="&url.yaz.download;"/>
11 We have tried our best to keep the software portable, and on many
12 platforms, you should be able to compile everything with little or
17 The software is regularly tested on
18 <ulink url="&url.debian;">Debian GNU/Linux</ulink>,
19 <ulink url="&url.centos;">CentOS</ulink>,
20 <ulink url="&url.ubuntu;">Ubuntu Linux</ulink>,
21 <ulink url="&url.freebsd;">FreeBSD (i386)</ulink>,
22 <ulink url="&url.macosx;">MAC OSX</ulink>,
23 <ulink url="&url.solaris;">Solaris</ulink>,
24 Windows 7, Windows Xp.
28 Some versions have be known to work on HP/UX,
29 DEC Unix, <ulink url="&url.netbsd;">NetBSD</ulink>,
30 <ulink url="&url.openbsd;">OpenBSD</ulink>,
32 Data General DG/UX (with some CFLAGS tinkering),
33 SGI/IRIX, DDE Supermax, Apple Macintosh (using the Codewarrior programming
34 environment and the GUSI socket libraries),
39 If you move the software to other platforms, we'd be grateful if you'd
40 let us know about it. If you run into difficulties, we will try to help
41 if we can, and if you solve the problems, we would be happy to include
42 your fixes in the next release. So far, we have mostly avoided
43 <literal>#ifdefs</literal> for individual platforms, and we'd
44 like to keep it that way as far as it makes sense.
48 We maintain a mailing-list for the purpose of announcing new releases and
49 bug-fixes, as well as general discussion. Subscribe by
51 <ulink url="&url.yaz.mailinglist;">here</ulink>.
52 General questions and problems can be directed at
53 <ulink url="&url.yaz.mail;"/>, or the address given at the top of
58 <sect1 id="installation.unix"><title>UNIX</title>
62 <ulink url="&url.debian;">Debian GNU/Linux</ulink> (i386 and amd64),
63 <ulink url="&url.ubuntu;">Ubuntu</ulink> (i386 and amd64)
65 <ulink url="&url.centos;">CentOS</ulink> (amd64 only) packages for &yaz;.
66 You should be able to create packages for other CPUs by building
67 them from the source package.
71 YAZ is also part of several packages repositories. Some of them are
77 Solaris CSW: <ulink url="http://www.opencsw.org/packages/yaz/"/>
82 Solaris: <ulink url="http://unixpackages.com"/>
87 FreeBSD: <ulink url="http://www.freshports.org/net/yaz"/>
92 Debian: <ulink url="http://packages.debian.org/search?keywords=yaz"/>
97 Ubuntu: <ulink url="https://launchpad.net/ubuntu/+source/yaz"/>
103 <ulink url="http://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc/net/yaz/README.html"/>
108 <sect2 id="installation.source.unix">
109 <title>Compiling from source on Unix</title>
112 Note that if your system doesn't have a native ANSI C compiler, you may
113 have to acquire one separately. We recommend
114 <ulink url="&url.gcc;">GCC</ulink>.
118 If you wish to use character set conversion facilities in &yaz; or if you
119 are compiling &yaz; for use with Zebra it is a good idea to ensure that
120 the iconv library is installed. Some Unixes today already have it
122 <ulink url="&url.libiconv;">GNU libiconv</ulink>.
126 YAZ 3.0.16 and later includes a wrapper for the
127 <ulink url="&url.icu;">ICU</ulink>
128 (International Components for Unicode).
129 In order to use this, the developer version of the ICU library
134 The <ulink url="&url.libxslt;">libxslt</ulink>,
135 <ulink url="&url.libxml2;">libxml2</ulink> librararies are required
136 if &yaz; is to support SRU.
137 These libraries are very portable and should compile out-of-the
138 box on virtually all Unix platforms. It is available in binary
139 forms for Linux and others.
144 <ulink url="&url.autoconf;">Autoconf</ulink>,
145 <ulink url="&url.automake;">Automake</ulink> and
146 <ulink url="&url.libtool;">Libtool</ulink>
147 are used to generate Makefiles and configure &yaz; for the system.
148 You do <emphasis>not</emphasis> these tools unless you're using the
149 git version of &yaz;.
153 The CQL parser for &yaz; is built using
154 GNU <ulink url="&url.bison;">Bison</ulink>.
155 This tool is only needed if you're using the git version of &yaz;.
159 &yaz; includes a tiny ASN.1 compiler. This compiler is
160 written in <ulink url="&url.tcl;">Tcl</ulink>.
161 But as for Bison you do not need it unless you're using git
162 version of &yaz; or you're using the compiler to built own codecs
167 Generally it should be sufficient to run configure without options,
176 The configure script attempts to use use the C compiler specified by
177 the <literal>CC</literal> environment variable. If not set, GNU C will be
178 used if it is available. The <literal>CFLAGS</literal> environment
179 variable holds options to be passed to the C compiler. If you're using
180 Bourne-compatible shell you may pass something like this to use a
181 particular C compiler with optimization enabled:
185 CC=/opt/ccs/bin/cc CFLAGS=-O ./configure
189 To customize &yaz;, the configure script also accepts a set of options.
190 The most important are:
194 <literal>--prefix</literal>=<replaceable>prefix</replaceable></term>
195 <listitem><para>Specifies installation prefix for &yaz;. This is
196 only needed if you run <literal>make install</literal> later to
197 perform a "system" installation. The prefix is
198 <literal>/usr/local</literal> if not specified.
201 <varlistentry><term><literal>--enable-tcpd</literal></term>
202 <listitem><para>The front end server will be built using Wietse's
203 <ulink url="&url.tcpwrapper;">TCP wrapper library</ulink>.
204 It allows you to allow/deny clients depending on IP number.
205 The TCP wrapper library is often used in GNU/Linux and
209 <refentrytitle>hosts_access</refentrytitle>
210 <manvolnum>5</manvolnum>
214 <refentrytitle>tcpd</refentrytitle>
215 <manvolnum>8</manvolnum>
220 <varlistentry><term><literal>--enable-threads</literal></term>
221 <listitem><para>&yaz; will be built using POSIX threads.
222 Specifically, <constant>_REENTRANT</constant> will be defined during
227 <varlistentry><term><literal>--disable-shared</literal></term>
228 <listitem><para>The make process will not create shared
229 libraries (also known as shared objects <filename>.so</filename>).
230 By default, shared libraries are created -
231 equivalent to <literal>--enable-shared</literal>.
235 <varlistentry><term><literal>--disable-shared</literal></term>
236 <listitem><para>The make process will not create
237 static libraries (<filename>.a</filename>).
238 By default, static libraries are created -
239 equivalent to <literal>--enable-static</literal>.
244 <literal>--with-iconv</literal>[=<replaceable>prefix</replaceable>]
246 <listitem><para>Compile &yaz; with iconv library in directory
247 <replaceable>prefix</replaceable>. By default configure will
248 search for iconv on the system. Use this option if it
249 doesn't find iconv. Alternatively,
250 <literal>--without-iconv</literal>, can be uset to force &yaz;
256 <literal>--with-xslt</literal>[=<replaceable>prefix</replaceable>]
258 <listitem><para>Compile &yaz; with
259 <ulink url="&url.libxslt;">libxslt</ulink> in directory
260 <replaceable>prefix</replaceable>.
261 Use this option if you want XSLT and XML support.
262 By default, configure will
263 search for libxslt on the system. Use this option if it
264 libxslt is not found automatically. Alternatively,
265 <literal>--without-xslt</literal>, can be used to force &yaz;
272 <literal>--with-xml2</literal>[=<replaceable>prefix</replaceable>]
274 <listitem><para>Compile &yaz; with
275 <ulink url="&url.libxml2;">libxml2</ulink> in directory
276 <replaceable>prefix</replaceable>.
277 Use this option if you want &yaz; to use XML and support SRU.
278 By default, configure will
279 search for libxml2 on the system. Use this option if it
280 libxml2 is not found automatically. Alternatively,
281 <literal>--without-xml2</literal>, can be used to force &yaz;
285 Note that option <literal>--with-xslt</literal>
286 also enables libxml2.
292 <literal>--with-gnutls</literal>[=<replaceable>prefix</replaceable>]
294 <listitem><para>&yaz; will be linked with the GNU TLS libraries and
295 an SSL COMSTACK will be provided. By default configure enables
296 SSL support for YAZ if the GNU TLS development libraries are found
302 <literal>--with-openssl</literal>[=<replaceable>prefix</replaceable>]
304 <listitem><para>&yaz; will be linked with the OpenSSL libraries and
305 an SSL COMSTACK will be provided. If OpenSSL is enabled, GNU TLS
306 is automatically disabled.
311 <literal>--with-icu</literal>[=<replaceable>prefix</replaceable>]
313 <listitem><para>&yaz; will be linked the
314 <ulink url="&url.icu;">ICU</ulink> library in the prefix if given.
315 If prefix is not given, the libraries exposed by the script
316 <application>icu-config</application> will be used if found.
324 When configured, build the software by typing:
331 The following files are generated by the make process:
333 <varlistentry><term><filename>src/libyaz.la</filename></term>
335 Main &yaz; library. This is no ordinary library. It's
337 By default, &yaz; creates a static library in
338 <filename>lib/.libs/libyaz.a</filename>.
342 <varlistentry><term><filename>src/libyaz_server.la</filename></term>
344 Generic Frontend server. This is an add-on for libyaz.la.
345 Code in this library uses POSIX threads functions - if POSIX
346 threads are available on the platform.
350 <varlistentry><term><filename>src/libyaz_icu.la</filename></term>
352 Functions that wrap the ICU library.
356 <varlistentry><term><filename>ztest/yaz-ztest</filename></term>
357 <listitem><para>Test Z39.50 server.
361 <varlistentry><term><filename>client/yaz-client</filename></term>
362 <listitem><para>Z39.50 client for testing the protocol.
363 See chapter <link linkend="yaz-client">
364 YAZ client</link> for more information.
368 <varlistentry><term><filename>util/yaz-config</filename></term>
369 <listitem><para>A Bourne-shell script, generated by configure, that
370 specifies how external applications should compile - and link with
375 <varlistentry><term><filename>util/yaz-asncomp</filename></term>
376 <listitem><para>The ASN.1 compiler for &yaz;. Requires the
377 Tcl Shell, <application>tclsh</application>, in
378 <literal>PATH</literal> to operate.
382 <varlistentry><term><filename>util/yaz-iconv</filename></term>
383 <listitem><para>This program converts data in one character set to
384 another. This command exercises the YAZ character set
389 <varlistentry><term><filename>util/yaz-marcdump</filename></term>
390 <listitem><para>This program parses ISO2709 encoded MARC records
391 and prints them in line-format or XML.
395 <varlistentry><term><filename>util/yaz-icu</filename></term>
396 <listitem><para>This program exposes the ICU wrapper library if that
397 is enabled for YAZ. Only if ICU is available this program is
402 <varlistentry><term><filename>zoom/zoomsh</filename></term>
404 A simple shell implemented on top of the
405 <link linkend="zoom">ZOOM</link> functions.
406 The shell is a command line application that allows you to enter
407 simple commands to perform ZOOM operations.
411 <varlistentry><term><filename>zoom/zoomtst1</filename>,
412 <filename>zoom/zoomtst2</filename>, ..</term>
414 Several small applications that demonstrates the ZOOM API.
422 If you wish to install &yaz; in system directories
423 <filename>/usr/local/bin</filename>,
424 <filename>/usr/local/lib</filename> .. etc, you can type:
432 You probably need to have root access in order to perform this.
433 You must specify the <literal>--prefix</literal> option for configure if
434 you wish to install &yaz; in other directories than the default
435 <filename>/usr/local/</filename>.
439 If you wish to perform an un-installation of &yaz;, use:
447 This will only work if you haven't reconfigured &yaz; (and therefore
448 changed installation prefix). Note that uninstall will not
449 remove directories created by make install, e.g.
450 <filename>/usr/local/include/yaz</filename>.
454 <sect2 id="installation-linking-yaz-unix">
455 <title>How to make apps using YAZ on UNIX</title>
457 This section describes how to compile - and link your own
458 applications using the &yaz; toolkit.
459 If you're used to Makefiles this shouldn't be hard. As for
460 other libraries you have used before, you have to set a proper include
461 path for your C/C++ compiler and specify the location of
462 &yaz; libraries. You can do it by hand, but generally we suggest
463 you use the <filename>yaz-config</filename> that is generated
464 by <filename>configure</filename>. This is especially
465 important if you're using the threaded version of &yaz; which
466 require you to pass more options to your linker/compiler.
469 The <filename>yaz-config</filename> script accepts command line
470 options that makes the <filename>yaz-config</filename> script print
471 options that you should use in your make process.
472 The most important ones are:
473 <literal>--cflags</literal>, <literal>--libs</literal>
474 which prints C compiler flags, and linker flags respectively.
477 A small and complete <literal>Makefile</literal> for a C
478 application consisting of one source file,
479 <filename>myprog.c</filename>, may look like this:
481 YAZCONFIG=/usr/local/bin/yaz-config
482 CFLAGS=`$(YAZCONFIG) --cflags`
483 LIBS=`$(YAZCONFIG) --libs`
485 $(CC) $(CFLAGS) -o myprog myprog.o $(LIBS)
489 The CFLAGS variable consists of a C compiler directive that will set
490 the include path to the <emphasis>parent</emphasis> directory
491 of <filename>yaz</filename>. That is, if &yaz; header files were
492 installed in <filename>/usr/local/include/yaz</filename>,
493 then include path is set to <filename>/usr/local/include</filename>.
494 Therefore, in your applications you should use
496 #include <yaz/proto.h>
498 and <emphasis>not</emphasis>
500 #include <proto.h>
504 For Libtool users, the <filename>yaz-config</filename> script provides
505 a different variant of option <literal>--libs</literal>, called
506 <literal>--lalibs</literal> that returns the name of the
507 Libtool archive(s) for &yaz; rather than the ordinary ones.
510 For applications using the threaded version of &yaz;,
511 specify <literal>threads</literal> after the
512 other options. When <literal>threads</literal> is given,
513 more flags and linker flags will be printed by
514 <filename>yaz-config</filename>. If our previous example was
515 using threads, you'd have to modify the lines that set
516 <literal>CFLAGS</literal> and <literal>LIBS</literal> as
519 CFLAGS=`$(YAZCONFIG) --cflags threads`
520 LIBS=`$(YAZCONFIG) --libs threads`
522 There is no need specify POSIX thread libraries in your Makefile.
523 The <literal>LIBS</literal> variable includes that as well.
527 <sect1 id="installation.win32"><title>WIN32</title>
529 <para>The easiest way to install YAZ on Windows is by downloading
531 <ulink url="&url.yaz.download.win32;">here</ulink>.
532 The installer comes with source too - in case you wish to
533 compile YAZ with different compiler options, etc.
536 <sect2 id="installation.win32.source">
537 <title>Compiling from Source on WIN32</title>
539 &yaz; is shipped with "makefiles" for the NMAKE tool that comes
540 with <ulink url="&url.vstudio;">
541 Microsoft Visual Studio</ulink>. It has been tested with
542 Microsoft Visual Studio 2003/2005/2008.
545 Start a command prompt and switch the sub directory
546 <filename>WIN</filename> where the file <filename>makefile</filename>
547 is located. Customize the installation by editing the
548 <filename>makefile</filename> file (for example by using notepad).
550 The following summarizes the most important settings in that file:
553 <varlistentry><term><literal>DEBUG</literal></term>
555 If set to 1, the software is
556 compiled with debugging libraries (code generation is
557 multi-threaded debug DLL).
558 If set to 0, the software is compiled with release libraries
559 (code generation is multi-threaded DLL).
563 <term><literal>HAVE_TCL</literal>, <literal>TCL</literal></term>
565 If <literal>HAVE_TCL</literal> is set to 1, nmake will
566 use the ASN.1 compiler (<ulink url="&url.tcl;">Tcl</ulink> based).
567 You must set <literal>TCL</literal> to the full path of the Tcl
568 interpreter. A Windows version of Tcl is part of
569 <ulink url="&url.gitwindows;">Git for Windows</ulink>.
572 If you do not have Tcl installed, set
573 <literal>HAVE_TCL</literal> to 0.
578 <term><literal>HAVE_BISON</literal>,
579 <literal>BISON</literal></term>
581 If GNU Bison is present, you might set <literal>HAVE_BISON</literal>
582 to 1 and specify the Bison executable in <literal>BISON</literal>.
583 Bison is only required if you use the git version of
584 YAZ or if you modify the grammar for CQL
585 (<filename>cql.y</filename>).
588 A Windows version of GNU Bison is part of
589 <ulink url="&url.gitwindows;">Git for Windows</ulink>.
594 <term><literal>HAVE_ICONV</literal>,
595 <literal>ICONV_DIR</literal></term>
597 If <literal>HAVE_ICONV</literal> is set to 1, YAZ is compiled
598 with iconv support. In this configuration, set
599 <literal>ICONV_DIR</literal> to the iconv source directory.
604 <term><literal>HAVE_LIBXML2</literal>,
605 <literal>LIBXML2_DIR</literal></term>
608 If <literal>HAVE_LIBXML2</literal> is set to 1, YAZ is compiled
609 with SRU support. In this configuration, set
610 <literal>LIBXML2_DIR</literal> to the
611 <ulink url="&url.libxml2;">libxml2</ulink> source directory
613 <literal>ZLIB_DIR</literal> to the zlib directory.
617 Windows versions of libxslt, libxml2, zlib and iconv can be found
618 <ulink url="&url.libxml2.download.win32;">
619 Igor Zlatković' site</ulink>.
624 YAZ is not using zlib but libxml2 is depending on it.
631 <term><literal>HAVE_LIBXSLT</literal>,
632 <literal>LIBXSLT_DIR</literal></term>
635 If <literal>HAVE_LIBXSLT</literal> is set to 1, YAZ is compiled
636 with XSLT support. In this configuration, set
637 <literal>LIBXSLT_DIR</literal> to the
638 <ulink url="&url.libxslt;">libxslt</ulink> source directory.
643 libxslt depends libxml2.
650 <term><literal>HAVE_ICU</literal>,
651 <literal>ICU_DIR</literal></term>
654 If <literal>HAVE_ICU</literal> is set to 1, YAZ is compiled
655 with <ulink url="&url.icu;">ICU</ulink> support.
656 In this configuration, set
657 <literal>ICU_DIR</literal> to the
658 <ulink url="&url.icu;">ICU</ulink> source directory.
667 When satisfied with the settings in the makefile, type
674 If the <filename>nmake</filename> command is not found on your system
675 you probably haven't defined the environment variables required to
676 use that tool. To fix that, find and run the batch file
677 <filename>vcvars32.bat</filename>. You need to run it from within
678 the command prompt or set the environment variables "globally";
679 otherwise it doesn't work.
683 If you wish to recompile &yaz; - for example if you modify
684 settings in the <filename>makefile</filename> you can delete
685 object files, etc by running.
691 The following files are generated upon successful compilation:
694 <varlistentry><term><filename>bin/yaz4.dll</filename> /
695 <filename>bin/yaz4d.dll</filename></term>
697 &yaz; Release/Debug DLL.
698 </para></listitem></varlistentry>
700 <varlistentry><term><filename>lib/yaz4.lib</filename> /
701 <filename>lib/yaz4d.lib</filename></term>
703 Import library for <filename>yaz4.dll</filename> /
704 <filename>yaz4d.dll</filename>.
705 </para></listitem></varlistentry>
707 <varlistentry><term><filename>bin/yaz_cond4.dll</filename> /
708 <filename>bin/yaz_cond4d.dll</filename></term>
710 Release/Debug DLL for condition variable utilities (condvar.c).
711 </para></listitem></varlistentry>
713 <varlistentry><term><filename>lib/yaz_cond4.lib</filename> /
714 <filename>lib/yaz_cond4d.lib</filename></term>
716 Import library for <filename>yaz_cond4.dll</filename> /
717 <filename>yaz_cond4d.dll</filename>.
718 </para></listitem></varlistentry>
720 <varlistentry><term><filename>bin/yaz_icu4.dll</filename> /
721 <filename>bin/yaz_icu4d.dll</filename></term>
723 Release/Debug DLL for the ICU wrapper utility.
724 Only build if HAVE_ICU is 1.
725 </para></listitem></varlistentry>
727 <varlistentry><term><filename>lib/yaz_icu4.lib</filename> /
728 <filename>lib/yaz_icu4d.lib</filename></term>
730 Import library for <filename>yaz_icu4.dll</filename> /
731 <filename>yaz_icu4d.dll</filename>.
732 </para></listitem></varlistentry>
734 <varlistentry><term><filename>bin/yaz-ztest.exe</filename></term>
736 Z39.50 multi-threaded test/example server. It's a WIN32
738 </para></listitem></varlistentry>
740 <varlistentry><term><filename>bin/yaz-client.exe</filename></term>
742 &yaz; Z39.50 client application. It's a WIN32 console application.
743 See chapter <link linkend="yaz-client">YAZ client</link> for more
745 </para></listitem></varlistentry>
747 <varlistentry><term><filename>bin/yaz-icu.exe</filename></term>
748 <listitem><para>This program exposes the ICU wrapper library if that
749 is enabled for YAZ. Only if ICU is available this program is
751 </para></listitem></varlistentry>
753 <varlistentry><term><filename>bin/zoomsh.exe</filename></term>
755 Simple console application implemented on top of the
756 <link linkend="zoom">ZOOM</link> functions.
757 The application is a command line shell that allows you to enter
758 simple commands to perform ZOOM operations.
759 </para></listitem></varlistentry>
761 <varlistentry><term><filename>bin/zoomtst1.exe</filename>,
762 <filename>bin/zoomtst2.exe</filename>, ..</term>
764 Several small applications that demonstrates the ZOOM API.
765 </para></listitem></varlistentry>
772 <sect2 id="installation-linking-yaz-win32">
773 <title>How to make apps using YAZ on WIN32</title>
775 This section will go though the process of linking your WIN32
776 applications with &yaz;.
779 Some people are confused by the fact that we use the nmake
780 tool to build &yaz;. They think they have to do that too - in order
781 to make their WIN32 applications work with &yaz;. The good news is that
782 you don't have to. You can use the integrated environment of
783 Visual Studio if desired for your own application.
786 When setting up a project or Makefile you have to set the following:
788 <varlistentry><term>include path</term><listitem><para>
789 Set it to the <filename>include</filename> directory of &yaz;.
790 </para></listitem></varlistentry>
791 <varlistentry><term>import library <filename>yaz4.lib</filename>
792 </term><listitem><para>
793 You must link with this library. It's located in the
794 sub directory <filename>lib</filename> of &yaz;.
795 If you want to link with the debug version of &yaz;, you must
796 link against <filename>yaz4d.lib</filename> instead.
797 </para></listitem></varlistentry>
798 <varlistentry><term>dynamic link library <filename>yaz4.dll</filename>
799 </term><listitem><para>
800 This DLL must be in your execution path when you invoke
801 your application. Specifically, you should distribute this
802 DLL with your application.
803 </para></listitem></varlistentry>
810 <!-- Keep this comment at the end of the file
815 sgml-minimize-attributes:nil
816 sgml-always-quote-attributes:t
819 sgml-parent-document: "yaz.xml"
820 sgml-local-catalogs: nil
821 sgml-namecase-general:t