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

Readme for the ZAP Module.  $Date: 2002/05/17 14:33:32 $

ZAP may be compiled as an Apache module or as a standalone CGI program.

For Apache, ZAP may be compiled as a dynamic shared object (DSO).
If you're using other plugin-modules for Apache mod_perl, mod_php, etc.
it makes things a lot more managable when ZAP is compiled as a DSO.

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.

------------

Installing ZAP for Apache 1.3.X - 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

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)  Now compile ZAP for your system and install it as an Apache
    extension:
      ./configure 
      make install
      make install-html

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

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

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

------------
Installing ZAP for Apache 1.3.X - 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 2)):
      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.

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:/zap/try.html
            or  http:/zap/simple.html

------------
Installing ZAP for Apache 1.3.X - (static linked)

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:/zap/try.html
            or  http:/zap/simple.html

------------
Installing ZAP as a CGI gateway:

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 

