ZAP! Z39.50 Apache Module,
   Copyright (C) 1997-2006, Index Data ApS
   See the file ZAP_LICENSE for details.

README for ZAP Module.  $Date: 2006/09/04 12:51:22 $

What is it?
-----------

ZAP! is an Apache module which allows you to build simple WWW
interfaces to Z39.50 servers, requiring only a minimum of knowledge
about the Z39.50 standard. ZAP! hides most of the complexity of
session management, parallel searching, etc.  ZAP may be compiled as
an Apache module or as a standalone CGI program.

Get more information about ZAP! on the web site:
 http://www.indexdata.dk/zap/

Installation
------------

If you're using other plugin-modules for Apache such as mod_perl, mod_php,
etc. we strongly recommend installing ZAP as a DSO (Dynamic Shared Object)
Secondly if you have installed Apache as a Package (Redhat, Debian,
whatever) it is a must.

Note, we had difficulty making DSO work with Apache version 1.3.4
on Linux but it seems to work well on versions 1.3.6 and higher.

This version works with Apache 2 as well. We've tested version 2.0.46.

We present 4 different procedures, I-IV to install ZAP.
Procedure I is easiest if you're using Apache. Procedure IV is
for CGI.

I: Apache version 1.3.X / version 2 - APXS / DSO / configure

1)  Get Apache if you don't have it already. http://www.apache.org/.
    Configure Apache and make sure DSO is enabled:
      ./configure --enable-module=so
      make
      make install

    Note: For Apache 2, use
      ./configure --enable-so

2)  Get YAZ and compile it. http://www.indexdata.dk/yaz/
      ./configure
      make

    Run make install if you want to install YAZ in system directories.

2a) If you wish to enable Tcl scripting for ZAP, install Tcl now.

3)  Compile ZAP for your system and install it as an Apache
    extension:
      ./configure --with-apxs=/usr/local/apache/bin/apxs
      make install
      make install-html

    Substitute with the right path to apxs above.

    The configure script above accepts options
       --with-apxs, --with-yaz, --with-tclconfig
    to locate Apache APXS, YAZ and Tcl respectively. Example:
       ./configure --with-apxs=/usr/local/apache/bin/apxs      [continued]
            --with-yaz=/home/programs/yaz-1.7

   Note: if you are using a packaged Apache you need the development
   version of that (such as apache-dev, apache2-dev, httpd-devel).

4)  Add the following to file httpd.conf in /usr/local/apache/conf (or
    where it's installed in step 1)):
      AddHandler zap-script .zap
  
    or you can use AddType, like this:
      AddType application/x-httpd-zap .zap

    As an option you may specify where to put the ZAP log file by using 
      ZapLog <name>

    If not specified the log file will be stored in 
      <apacheroot>/logs/zap_log
    This is there the other Apache log files, access_log and error_log,
    are stored. To disable logging completely, use
      ZapLog none

5)  Start Apache:
      /usr/local/apache/bin/apachectl start

6)  Try it out:
      http://localhost/zap/try.html
      http://localhost/zap/simple.html

II: Apache 1.3.X - manual DSO

1)  Get Apache, http://www.apache.org. Configure Apache and make
    sure DSO is enabled, for example by using
      ./configure --enable-module=so
      make
      make install

2)  Get YAZ and compile it. http://www.indexdata.dk/yaz/
      ./configure
      make

3)  Edit src/makefile.dso in the src directory in the ZAP distribution.
    Change the line APXS to point to the apxs script that should be
    installed in step 1) above. Change YAZLIB and YAZINC as needed.

3a) To enable Tcl change USE_TCL=0 to USE_TCL=1 in
    the DEFS=..-line in makefile.dso and specify location of include
    files and libraries for Tcl in TCLINC and TCLLIB.

4)  Compile ZAP as a shared object:
      cd src
      make -f makefile.dso
      make -f makefile.dso install

5)  Add the following to file httpd.conf in /usr/local/apache/conf (or
    where it's installed in step 1)):
      AddHandler zap-script .zap
    
    As an option you may specify where to put the ZAP log file by using 
      ZapLog <name>

    If not specified the log file will be stored in 
      <apacheroot>/logs/zap_log
    This is there the other Apache log files, access_log and error_log,
    are stored. To disable logging completely, use
      ZapLog none

6)  Copy ZAP example files (in htdocs/zap) to the HTML area of Apache. Use
    something like this depending on where you install Apache:
    cp -r <zapdir>/htdocs/zap /usr/local/apache/htdocs

7)  Start Apache. 
      /usr/local/apache/bin/apachectl start

8)  Try it out: http://localhost/zap/try.html
            or  http://localhost/zap/simple.html

III: ZAP for Apache 1.3.X - static linking

1)  Get YAZ and compile it. http://www.indexdata.dk/yaz/
      ./configure
      make

2)  Configure Apache. Use the following options (all on one line):
      CFLAGS="-I<yazdir>/include -DUSE_TCL=0" LIBS="<yazdir>/lib/libyaz.a"
      ./configure --add-module=<zapdir>/src/mod_zap.c 

    In the command above substitute <yazdir> with the root of YAZ;
    substitute <zapdir> with the root of ZAP.

    You may have additional modules and/or options to add - please
    consult the Apache documentation.

2a) Tcl - Optional.
    If you wish to enable Tcl for ZAP set USE_TCL to 1 in the configure
    line in 2) and add Tcl libraries and, if necessary, the path for Tcl's
    include files.

    For example, if Tcl is located in /usr/local/{include,lib} use
    something like:
      CFLAGS="-I<yazdir>/include -I/usr/local/include -DUSE_TCL=1"
      LIBS="<yazdir>/lib/libyaz.a -L/usr/local/lib -ltcl8.0"
      ./configure --add-module=<zapdir>/src/mod_zap.c 

3)  Compile and install apache.
      make
      make install

4)  Edit httpd.conf in /usr/local/apache/conf or wherever it's installed and
    add the following to enable mod_zap on extension .zap:
      AddHandler zap-script .zap

    As an option you may specify where to put the ZAP log file by using 
      ZapLog <name>

    If not specified the log file will be stored in 
      <apacheroot>/logs/zap_log
    This is there the other Apache log files, access_log and error_log,
    are stored.

5)  Copy ZAP example files (in htdocs/zap) to the HTML area of Apache. Use
    something like this depending on where you install Apache:
    cp -r <zapdir>/htdocs/zap /usr/local/apache/htdocs

6)  Start Apache. 
    /usr/local/apache/bin/apachectl start

7)  Try it out: http://localhost/zap/try.html
            or  http://localhost/zap/simple.html

IV: CGI

1) Get YAZ and compile it.  http://www.indexdata.dk/yaz/

2) Unpack ZAP.
    $ gunzip -c zap-<version>.tar.gz|tar xvf -

   Structure now:
      +-- yaz ---- include
      |    |
      |    + ----- libs
      |    |
      |   ...
      |
      +-- zap ---- src               (mod_zap.c, makefile.cgi)
           |
           +------ htdocs
                     +
                     +------- zap    (cgi.html, default.zap, ..)

3) Goto the 'src' sub directory and edit the lines in the makefile.cgi
   beginning with YAZLIB and YAZINC to point to the YAZ libs/source.
   Also specify location of the ZAP files (ZAP_CONF) and name of log
   file for ZAP (ZAP_LOG).
    $ cd zap/src
    $ vi makefile.cgi

4) Compile the ZAP source.
    $ make -f makefile.cgi
    
5) Copy the resulting binary 'zap' to your Web server's CGI bin
   directory.
    $ cp zap /usr/local/etc/httpd/cgi-bin  (or whereever it's located)

6) Create a zap directory in your Web server's HTML docs directory. 
   Copy the ZAP configurations as well as the HTML sample forms to
   the new directory.
    $ mkdir /usr/local/etc/httpd/htdocs/zap  (or whereever it's located)
    $ cp htdocs/zap/* /usr/local/etc/httpd/htdocs/zap

7) Try it out: http://localhost/zap/cgi.html 

