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.redhat;">Redhat Linux</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;">SunOS 5.8 (sparc)</ulink>,
24 <ulink url="&url.windows2000;">Windows 2000</ulink>,
25 <ulink url="&url.windows2003server;">Windows 2003 server</ulink>.
29 Some versions have be known to work on HP/UX,
30 DEC Unix, <ulink url="&url.netbsd;">NetBSD</ulink>,
31 <ulink url="&url.openbsd;">OpenBSD</ulink>,
33 Data General DG/UX (with some CFLAGS tinkering),
34 SGI/IRIX, DDE Supermax, Apple Macintosh (using the Codewarrior programming
35 environment and the GUSI socket libraries),
40 If you move the software to other platforms, we'd be grateful if you'd
41 let us know about it. If you run into difficulties, we will try to help
42 if we can, and if you solve the problems, we would be happy to include
43 your fixes in the next release. So far, we have mostly avoided
44 <literal>#ifdefs</literal> for individual platforms, and we'd
45 like to keep it that way as far as it makes sense.
49 We maintain a mailing-list for the purpose of announcing new releases and
50 bug-fixes, as well as general discussion. Subscribe by
52 <ulink url="&url.yaz.mailinglist;">here</ulink>.
53 General questions and problems can be directed at
54 <ulink url="&url.yaz.mail;"/>, or the address given at the top of
59 <sect1 id="installation.unix"><title>UNIX</title>
63 <ulink url="&url.debian;">Debian GNU/Linux</ulink>
65 <ulink url="&url.redhat;">Redhat</ulink> packages for &yaz;.
66 Only i386 binary packages are available. You should be able to
67 create packages for other CPUs by building them from the source
71 <sect2 id="installation.source.unix">
72 <title>Compiling from source on Unix</title>
75 Note that if your system doesn't have a native ANSI C compiler, you may
76 have to acquire one separately. We recommend
77 <ulink url="&url.gcc;">GCC</ulink>.
81 If you wish to use character set conversion facilities in &yaz; or if you
82 are compiling &yaz; for use with Zebra it is a good idea to ensure that
83 the iconv library is installed. Some Unixes today already have it
85 <ulink url="&url.libiconv;">GNU libiconv</ulink>.
89 YAZ 3.0.16 and later includes a wrapper for the
90 <ulink url="%url.icu;">ICU</ulink>
91 (International Components for Unicode).
92 In order to use this, the developer version of the ICU library
97 The <ulink url="&url.libxslt;">libxslt</ulink>,
98 <ulink url="&url.libxml2;">libxml2</ulink> librararies are required
99 if &yaz; is to support SRU.
100 These libraries are very portable and should compile out-of-the
101 box on virtually all Unix platforms. It is available in binary
102 forms for Linux and others.
107 <ulink url="&url.autoconf;">Autoconf</ulink>,
108 <ulink url="&url.automake;">Automake</ulink> and
109 <ulink url="&url.libtool;">Libtool</ulink>
110 are used to generate Makefiles and configure &yaz; for the system.
111 You do <emphasis>not</emphasis> these tools unless you're using the
112 CVS version of &yaz;.
116 The CQL parser for &yaz; is built using
117 GNU <ulink url="&url.bison;">Bison</ulink>.
118 This tool is only needed if you're using the CVS version of &yaz;.
122 &yaz; includes a tiny ASN.1 compiler. This compiler is
123 written in <ulink url="&url.tcl;">Tcl</ulink>.
124 But as for Bison you do not need it unless you're using CVS
125 version of &yaz; or you're using the compiler to built own codecs
130 Generally it should be sufficient to run configure without options,
139 The configure script attempts to use use the C compiler specified by
140 the <literal>CC</literal> environment variable. If not set, GNU C will be
141 used if it is available. The <literal>CFLAGS</literal> environment
142 variable holds options to be passed to the C compiler. If you're using
143 Bourne-compatible shell you may pass something like this to use a
144 particular C compiler with optimization enabled:
148 CC=/opt/ccs/bin/cc CFLAGS=-O ./configure
152 To customize &yaz;, the configure script also accepts a set of options.
153 The most important are:
157 <literal>--prefix</literal>=<replaceable>prefix</replaceable></term>
158 <listitem><para>Specifies installation prefix for &yaz;. This is
159 only needed if you run <literal>make install</literal> later to
160 perform a "system" installation. The prefix is
161 <literal>/usr/local</literal> if not specified.
164 <varlistentry><term><literal>--enable-tcpd</literal></term>
165 <listitem><para>The front end server will be built using Wietse's
166 <ulink url="&url.tcpwrapper;">TCP wrapper library</ulink>.
167 It allows you to allow/deny clients depending on IP number.
168 The TCP wrapper library is often used in GNU/Linux and
172 <refentrytitle>hosts_access</refentrytitle>
173 <manvolnum>5</manvolnum>
177 <refentrytitle>tcpd</refentrytitle>
178 <manvolnum>8</manvolnum>
183 <varlistentry><term><literal>--enable-threads</literal></term>
184 <listitem><para>&yaz; will be built using POSIX threads.
185 Specifically, <constant>_REENTRANT</constant> will be defined during
190 <varlistentry><term><literal>--disable-shared</literal></term>
191 <listitem><para>The make process will not create shared
192 libraries (also known as shared objects <filename>.so</filename>).
193 By default, shared libraries are created -
194 equivalent to <literal>--enable-shared</literal>.
198 <varlistentry><term><literal>--disable-shared</literal></term>
199 <listitem><para>The make process will not create
200 static libraries (<filename>.a</filename>).
201 By default, static libraries are created -
202 equivalent to <literal>--enable-static</literal>.
207 <literal>--with-iconv</literal>[=<replaceable>prefix</replaceable>]
209 <listitem><para>Compile &yaz; with iconv library in directory
210 <replaceable>prefix</replaceable>. By default configure will
211 search for iconv on the system. Use this option if it
212 doesn't find iconv. Alternatively,
213 <literal>--without-iconv</literal>, can be uset to force &yaz;
219 <literal>--with-xslt</literal>[=<replaceable>prefix</replaceable>]
221 <listitem><para>Compile &yaz; with
222 <ulink url="&url.libxslt;">libxslt</ulink> in directory
223 <replaceable>prefix</replaceable>.
224 Use this option if you want XSLT and XML support.
225 By default, configure will
226 search for libxslt on the system. Use this option if it
227 libxslt is not found automatically. Alternatively,
228 <literal>--without-xslt</literal>, can be used to force &yaz;
235 <literal>--with-xml2</literal>[=<replaceable>prefix</replaceable>]
237 <listitem><para>Compile &yaz; with
238 <ulink url="&url.libxml2;">libxml2</ulink> in directory
239 <replaceable>prefix</replaceable>.
240 Use this option if you want &yaz; to use XML and support SRU.
241 By default, configure will
242 search for libxml2 on the system. Use this option if it
243 libxml2 is not found automatically. Alternatively,
244 <literal>--without-xml2</literal>, can be used to force &yaz;
248 Note that option <literal>--with-xslt</literal>
249 also enables libxml2.
255 <literal>--with-gnutls</literal>[=<replaceable>prefix</replaceable>]
257 <listitem><para>&yaz; will be linked with the GNU TLS libraries and
258 an SSL COMSTACK will be provided. By default configure enables
259 SSL support for YAZ if the GNU TLS development libraries are found
265 <literal>--with-openssl</literal>[=<replaceable>prefix</replaceable>]
267 <listitem><para>&yaz; will be linked with the OpenSSL libraries and
268 an SSL COMSTACK will be provided. If OpenSSL is enabled, GNU TLS
269 is automatically disabled.
274 <literal>--with-icu</literal>[=<replaceable>prefix</replaceable>]
276 <listitem><para>&yaz; will be linked the
277 <ulink url="&url.icu;">ICU</ulink> library in the prefix if given.
278 If prefix is not given, the libraries exposed by the script
279 <application>icu-config</application> will be used if found.
287 When configured, build the software by typing:
294 The following files are generated by the make process:
296 <varlistentry><term><filename>src/libyaz.la</filename></term>
298 Main &yaz; library. This is no ordinary library. It's
300 By default, &yaz; creates a static library in
301 <filename>lib/.libs/libyaz.a</filename>.
305 <varlistentry><term><filename>src/libyaz_server.la</filename></term>
307 Generic Frontend server. This is an add-on for libyaz.la.
308 Code in this library uses POSIX threads functions - if they
309 available on the platform.
313 <varlistentry><term><filename>ztest/yaz-ztest</filename></term>
314 <listitem><para>Test Z39.50 server.
318 <varlistentry><term><filename>client/yaz-client</filename></term>
319 <listitem><para>Z39.50 client for testing the protocol.
320 See chapter <link linkend="yaz-client">
321 YAZ client</link> for more information.
325 <varlistentry><term><filename>util/yaz-config</filename></term>
326 <listitem><para>A Bourne-shell script, generated by configure, that
327 specifies how external applications should compile - and link with
332 <varlistentry><term><filename>util/yaz-asncomp</filename></term>
333 <listitem><para>The ASN.1 compiler for &yaz;. Requires the
334 Tcl Shell, <application>tclsh</application>, in
335 <literal>PATH</literal> to operate.
339 <varlistentry><term><filename>util/yaz-iconv</filename></term>
340 <listitem><para>This program converts data in one character set to
341 another. This command exercises the YAZ character set
346 <varlistentry><term><filename>util/yaz-marcdump</filename></term>
347 <listitem><para>This program parses ISO2709 encoded MARC records
348 and prints them in line-format or XML.
352 <varlistentry><term><filename>util/yaz-icu</filename></term>
353 <listitem><para>This program exposes the ICU wrapper library if that
354 is enabled for YAZ. Only if ICU is available this program is
359 <varlistentry><term><filename>zoom/zoomsh</filename></term>
361 A simple shell implemented on top of the
362 <link linkend="zoom">ZOOM</link> functions.
363 The shell is a command line application that allows you to enter
364 simple commands to perform ZOOM operations.
368 <varlistentry><term><filename>zoom/zoomtst1</filename>,
369 <filename>zoom/zoomtst2</filename>, ..</term>
371 Several small applications that demonstrates the ZOOM API.
379 If you wish to install &yaz; in system directories
380 <filename>/usr/local/bin</filename>,
381 <filename>/usr/local/lib</filename> .. etc, you can type:
389 You probably need to have root access in order to perform this.
390 You must specify the <literal>--prefix</literal> option for configure if
391 you wish to install &yaz; in other directories than the default
392 <filename>/usr/local/</filename>.
396 If you wish to perform an un-installation of &yaz;, use:
404 This will only work if you haven't reconfigured &yaz; (and therefore
405 changed installation prefix). Note that uninstall will not
406 remove directories created by make install, e.g.
407 <filename>/usr/local/include/yaz</filename>.
411 <sect2 id="installation-linking-yaz-unix">
412 <title>How to make apps using YAZ on UNIX</title>
414 This section describes how to compile - and link your own
415 applications using the &yaz; toolkit.
416 If you're used to Makefiles this shouldn't be hard. As for
417 other libraries you have used before, you have to set a proper include
418 path for your C/C++ compiler and specify the location of
419 &yaz; libraries. You can do it by hand, but generally we suggest
420 you use the <filename>yaz-config</filename> that is generated
421 by <filename>configure</filename>. This is especially
422 important if you're using the threaded version of &yaz; which
423 require you to pass more options to your linker/compiler.
426 The <filename>yaz-config</filename> script accepts command line
427 options that makes the <filename>yaz-config</filename> script print
428 options that you should use in your make process.
429 The most important ones are:
430 <literal>--cflags</literal>, <literal>--libs</literal>
431 which prints C compiler flags, and linker flags respectively.
434 A small and complete <literal>Makefile</literal> for a C
435 application consisting of one source file,
436 <filename>myprog.c</filename>, may look like this:
438 YAZCONFIG=/usr/local/bin/yaz-config
439 CFLAGS=`$(YAZCONFIG) --cflags`
440 LIBS=`$(YAZCONFIG) --libs`
442 $(CC) $(CFLAGS) -o myprog myprog.o $(LIBS)
446 The CFLAGS variable consists of a C compiler directive that will set
447 the include path to the <emphasis>parent</emphasis> directory
448 of <filename>yaz</filename>. That is, if &yaz; header files were
449 installed in <filename>/usr/local/include/yaz</filename>,
450 then include path is set to <filename>/usr/local/include</filename>.
451 Therefore, in your applications you should use
453 #include <yaz/proto.h>
455 and <emphasis>not</emphasis>
457 #include <proto.h>
461 For Libtool users, the <filename>yaz-config</filename> script provides
462 a different variant of option <literal>--libs</literal>, called
463 <literal>--lalibs</literal> that returns the name of the
464 Libtool archive(s) for &yaz; rather than the ordinary ones.
467 For applications using the threaded version of &yaz;,
468 specify <literal>threads</literal> after the
469 other options. When <literal>threads</literal> is given,
470 more flags and linker flags will be printed by
471 <filename>yaz-config</filename>. If our previous example was
472 using threads, you'd have to modify the lines that set
473 <literal>CFLAGS</literal> and <literal>LIBS</literal> as
476 CFLAGS=`$(YAZCONFIG) --cflags threads`
477 LIBS=`$(YAZCONFIG) --libs threads`
479 There is no need specify POSIX thread libraries in your Makefile.
480 The <literal>LIBS</literal> variable includes that as well.
484 <sect1 id="installation.win32"><title>WIN32</title>
486 <para>The easiest way to install YAZ on Windows is by downloading
488 <ulink url="&url.yaz.download.win32;">here</ulink>.
489 The installer comes with source too - in case you wish to
490 compile YAZ with different Compiler options etc.
493 <sect2 id="installation.win32.source">
494 <title>Compiling from Source on WIN32</title>
496 &yaz; is shipped with "makefiles" for the NMAKE tool that comes
497 with <ulink url="&url.vstudio;">
498 Microsoft Visual Studio</ulink>.
499 Version 6 and .NET has been tested. We expect that &yaz; compiles
500 with version 5 as well.
503 Start a command prompt and switch the sub directory
504 <filename>WIN</filename> where the file <filename>makefile</filename>
505 is located. Customize the installation by editing the
506 <filename>makefile</filename> file (for example by using notepad).
508 The following summarizes the most important settings in that file:
511 <varlistentry><term><literal>DEBUG</literal></term>
513 If set to 1, the software is
514 compiled with debugging libraries (code generation is
515 multi-threaded debug DLL).
516 If set to 0, the software is compiled with release libraries
517 (code generation is multi-threaded DLL).
521 <term><literal>HAVE_TCL</literal>, <literal>TCL</literal></term>
523 If <literal>HAVE_TCL</literal> is set to 1, nmake will
524 use the ASN.1 compiler (Tcl based). You must set
525 <literal>TCL</literal> to the full path of the Tcl
529 If you do not have Tcl installed, set
530 <literal>HAVE_TCL</literal> to 0.
535 <term><literal>HAVE_BISON</literal>,
536 <literal>BISON</literal></term>
538 If GNU Bison is present, you might set <literal>HAVE_ICONV</literal>
539 to 1 and specify the Bison executable in <literal>BISON</literal>.
540 Bison is only required if you use the CVS version of
541 YAZ or if you modify the grammar for CQL
542 (<filename>cql.y</filename>).
545 A Windows version of GNU Bison is part of
546 <ulink url="&url.unxutils;">unxutils</ulink>.
551 <term><literal>HAVE_ICONV</literal>,
552 <literal>ICONV_DIR</literal></term>
554 If <literal>HAVE_ICONV</literal> is set to 1, YAZ is compiled
555 with iconv support. In this configuration, set
556 <literal>ICONV_DIR</literal> to the iconv source directory.
561 <term><literal>HAVE_LIBXML2</literal>,
562 <literal>LIBXML2_DIR</literal></term>
565 If <literal>HAVE_LIBXML2</literal> is set to 1, YAZ is compiled
566 with SRU support. In this configuration, set
567 <literal>LIBXML2_DIR</literal> to the
568 <ulink url="&url.libxml2;">libxml2</ulink> source directory
570 <literal>ZLIB_DIR</literal> to the zlib directory.
574 Windows versions of libxslt, libxml2, zlib and iconv can be found
575 <ulink url="&url.libxml2.download.win32;">
576 Igor Zlatković' site</ulink>.
581 YAZ is not using zlib but libxml2 is depending on it.
588 <term><literal>HAVE_LIBXSLT</literal>,
589 <literal>LIBXSLT_DIR</literal></term>
592 If <literal>HAVE_LIBXSLT</literal> is set to 1, YAZ is compiled
593 with XSLT support. In this configuration, set
594 <literal>LIBXSLT_DIR</literal> to the
595 <ulink url="&url.libxslt;">libxslt</ulink> source directory.
600 libxslt depends libxml2.
607 <term><literal>HAVE_ICU</literal>,
608 <literal>ICU_DIR</literal></term>
611 If <literal>HAVE_ICU</literal> is set to 1, YAZ is compiled
612 with <ulink url="&url.icu;">ICU</ulink> support.
613 In this configuration, set
614 <literal>ICU_DIR</literal> to the
615 <ulink url="&url.icu;">ICU</ulink> source directory.
624 When satisfied with the settings in the makefile, type
631 If the <filename>nmake</filename> command is not found on your system
632 you probably haven't defined the environment variables required to
633 use that tool. To fix that, find and run the batch file
634 <filename>vcvars32.bat</filename>. You need to run it from within
635 the command prompt or set the environment variables "globally";
636 otherwise it doesn't work.
640 If you wish to recompile &yaz; - for example if you modify
641 settings in the <filename>makefile</filename> you can delete
642 object files, etc by running.
648 The following files are generated upon successful compilation:
651 <varlistentry><term><filename>bin/yaz3.dll</filename> /
652 <filename>bin/yaz3d.dll</filename></term>
654 &yaz; Release/Debug DLL.
655 </para></listitem></varlistentry>
657 <varlistentry><term><filename>lib/yaz3.lib</filename> /
658 <filename>lib/yaz3d.lib</filename></term>
660 Import library for <filename>yaz3.dll</filename> /
661 <filename>yaz3d.dll</filename>.
662 </para></listitem></varlistentry>
664 <varlistentry><term><filename>bin/yaz_icu3.dll</filename> /
665 <filename>bin/yaz_icu3d.dll</filename></term>
667 Release/Debug DLL for the ICU wrapper utility.
668 Only build if HAVE_ICU is 1.
669 </para></listitem></varlistentry>
671 <varlistentry><term><filename>lib/yaz_icu3.lib</filename> /
672 <filename>lib/yaz_icu3d.lib</filename></term>
674 Import library for <filename>yaz_icu3.dll</filename> /
675 <filename>yaz_icu3d.dll</filename>.
676 </para></listitem></varlistentry>
678 <varlistentry><term><filename>bin/yaz-ztest.exe</filename></term>
680 Z39.50 multi-threaded test/example server. It's a WIN32
682 </para></listitem></varlistentry>
684 <varlistentry><term><filename>bin/yaz-client.exe</filename></term>
686 &yaz; Z39.50 client application. It's a WIN32 console application.
687 See chapter <link linkend="yaz-client">YAZ client</link> for more
689 </para></listitem></varlistentry>
691 <varlistentry><term><filename>bin/yaz-icu.exe</filename></term>
692 <listitem><para>This program exposes the ICU wrapper library if that
693 is enabled for YAZ. Only if ICU is available this program is
695 </para></listitem></varlistentry>
697 <varlistentry><term><filename>bin/zoomsh.exe</filename></term>
699 Simple console application implemented on top of the
700 <link linkend="zoom">ZOOM</link> functions.
701 The application is a command line shell that allows you to enter
702 simple commands to perform ZOOM operations.
703 </para></listitem></varlistentry>
705 <varlistentry><term><filename>bin/zoomtst1.exe</filename>,
706 <filename>bin/zoomtst2.exe</filename>, ..</term>
708 Several small applications that demonstrates the ZOOM API.
709 </para></listitem></varlistentry>
716 <sect2 id="installation-linking-yaz-win32">
717 <title>How to make apps using YAZ on WIN32</title>
719 This section will go though the process of linking your WIN32
720 applications with &yaz;.
723 Some people are confused by the fact that we use the nmake
724 tool to build &yaz;. They think they have to do that too - in order
725 to make their WIN32 applications work with &yaz;. The good news is that
726 you don't have to. You can use the integrated environment of
727 Visual Studio if desired for your own application.
730 When setting up a project or Makefile you have to set the following:
732 <varlistentry><term>include path</term><listitem><para>
733 Set it to the <filename>include</filename> directory of &yaz;.
734 </para></listitem></varlistentry>
735 <varlistentry><term>import library <filename>yaz3.lib</filename>
736 </term><listitem><para>
737 You must link with this library. It's located in the
738 sub directory <filename>lib</filename> of &yaz;.
739 If you want to link with the debug version of &yaz;, you must
740 link against <filename>yaz3d.lib</filename> instead.
741 </para></listitem></varlistentry>
742 <varlistentry><term>dynamic link library <filename>yaz3.dll</filename>
743 </term><listitem><para>
744 This DLL must be in your execution path when you invoke
745 your application. Specifically, you should distribute this
746 DLL with your application.
747 </para></listitem></varlistentry>
754 <!-- Keep this comment at the end of the file
759 sgml-minimize-attributes:nil
760 sgml-always-quote-attributes:t
763 sgml-parent-document: "yaz.xml"
764 sgml-local-catalogs: nil
765 sgml-namecase-general:t