__________________________________________________________________________

  This is the Info-ZIP file INSTALL (for UnZip), last updated 20 Oct 97.
__________________________________________________________________________

  Yes, this is a rather long file, but don't be intimidated:  much of its
  length is due to coverage of multiple operating systems and of optional
  customization features, large portions of which may be skipped.
__________________________________________________________________________



To compile UnZip, UnZipSFX and/or fUnZip (quick-start instructions):
========================================

(1) Unpack everything into a work directory somewhere, and make sure you're
    in the main UnZip directory (the one with this file in it).

(2) Copy the appropriate makefile into the current directory, except under
    OS/2.

(3) Run your "make" utility on the makefile (e.g., "nmake -f makefile.msc").

(4) Try out your new UnZip the way you would any new utility:  read the
    docs first.

    Ah ha ha ha!!  Oh, that kills me.  But seriously...for VMS, UnZip must
    be installed as a "foreign symbol"; see the Install section below or
    [.vms]readme.vms for details.  (It basically involves adding a line
    sort of like this to login.com:    $ unzip == "$disk:[dir]unzip.exe")
    For DOS and other OSes without explicit timezone support (i.e., everybody
    but Unix, Windows 95 and NT), make sure the "TZ" environment variable is
    set to a valid and reasonable value; see your compiler docs for details.



To compile UnZip, UnZipSFX and/or fUnZip (detailed instructions):
========================================

(1) Unpack *.c and *.h (the actual source files), preserving the directory
    structure (e.g., ./unix/unix.c).  The sole exception is TOPS-20, where
    tops20/* should be unpacked into the current directory, but TOPS-20
    is no longer fully supported anyway.

    If you wish to compile with decryption enabled, you must get the zcrypt
    package (see the "WHERE" file).  Unpack crypt.c and crypt.h from the
    zcrypt archive, overwriting the dummy versions supplied with UnZip.  If
    you don't have any sort of unzipper available, you'll have to compile the
    non-crypt version first and use that to unpack the full crypt sources,
    then recompile.


(2) Choose the appropriate makefile based on the description in the Con-
    tents file for your OS (that is, there's only one for Unix or OS/2, but
    MS-DOS and several other OSes have several, depending on the compiler).
    Copy it into the current directory and rename if necessary or desired.
    (Some makefiles can be invoked in place; see (5) below.)

    Don't be afraid to read the makefile!  Many options will be explained only
    in the comments contained therein.  The defaults may not quite suit your
    system.  When making changes, remember that some "make" utilities expect
    tabs as part of the makefile syntax.  Failure with cryptic error messages
    will result if your editor quietly replaces those tabs with spaces.

    Special point of confusion:  some non-MSDOS makefiles contain MS-DOS
    targets (useful for cross-compilations). An example is the OS/2 makefile
    os2/makefile.os2 that contains the gccdos target for DOS emx+gcc and
    some more DOS related targets for Watcom C and MSC. But since version 5.3,
    the msdos subdirectory contains makefiles for all supported DOS compilers.
    [The old djgpp, djgpp1 and gcc_dos targets in unix/Makefile have been
    removed in 5.3; use msdos/makefile.dj* instead.]

    Extra-special point of confusion:  makefile.os2 expects to remain in
    the os2 subdirectory.  Invoke it via "nmake -f os2/makefile.os2 gcc",
    for example.


(3) If you want a non-standard version of UnZip, define one or more of the
    following optional macros, either by adding them to the LOCAL_UNZIP
    environment variable or by editing your makefile as appropriate.  The
    syntax differs from compiler to compiler, but macros are often defined
    via "-DMACRO_NAME" or similar (for one called MACRO_NAME).  Note that
    some of these may not be fully supported in future releases (or even
    in the current release).  Note also that very short command lines in
    MS-DOS (128 characters) may place severe limits on how many of these
    can be used; if need be, the definitions can be placed at the top of
    unzip.h instead (it is included in all source files)--for example,
    "#define MACRO_NAME", one macro per line.

      DOSWILD   (MS-DOS only)
        Treat trailing "*.*" like Unix "*" (i.e., matches anything); treat
        trailing "*." as match for files without a dot (i.e., matches any-
        thing, as long as no dots in name).  Special treatment only occurs
        if patterns are at end of arguments; i.e., "a*.*" matches all files
        starting with "a", but "*.*c" matches all files ending in "c" *only*
        if they have a dot somewhere before the "c".  Thus "*.*.*" could be
        used (albeit awkwardly) to specify all filenames with at least one
        dot in them, and "*." matches all filenames with no dots in them.
        [The default method of specifying these would be "*.*" and "* -x *.*",
        respectively, where the second example makes use of UnZip's exclude-
        files option.]  All other regular expressions (including "?" and
        "[range_of_chars]") retain their Unix-like behavior.

      VMSWILD   (VMS only)
        Use parentheses rather than brackets to delimit sets (ranges), and
        use '%' instead of '?' as the single-character wildcard for internal
        filename matching.  (External matching of zipfile names always uses
        the standard VMS wildcard facilities; character sets are disallowed.)

      VMSCLI   (VMS only)
        Use VMS-style "slash options" (/FOOBAR) instead of the default Unix-
        style hyphenated options (-f).  This capability does not affect options
        stored in environment variables (UNZIP_OPTS or ZIPINFO_OPTS); those use
        the Unix style regardless. Beginning with UnZip 5.32, the supplied
        VMS Makefiles and make procedures generate both VMS-style and default
        "UNIX style" executables; you should NOT add VMSCLI to the custom
        options.

      CHECK_VERSIONS   (VMS only)
        UnZip "extra fields" are used to store VMS (RMS) filesystem info,
        and the format of this information may differ in various versions
        of VMS.  Defining this option will enable UnZip warnings when the
        stored extra-field VMS version(s) do(es) not match the version of
        VMS currently being used.  This is a common occurrence in zipfiles
        received from other sites, but since the format of the filesystem
        does not seem to have changed in years (including on Alpha and Open-
        VMS systems), the warnings are not enabled by default.

      RETURN_CODES   (VMS only)
        VMS interprets return codes according to a rigid set of guidelines,
        which means it misinterprets normal UnZip return codes as all sorts
        of really nasty errors.  Therefore VMS UnZip returns an alternate set
        of return codes; since these may be difficult to interpret, define
        RETURN_CODES for human-readable explanations.

      VMS_TEXT_CONV   (everybody except VMS)
        VMS text files archived with the "-V" option are only semi-readable at
        best when extracted on other systems.  Defining this option enables
        UnZip's -aa option to attempt to convert such files to native text
        format.  Non-VMS UnZips don't actually detect the precise VMS format
        of the files, however, but instead rely on some reasonably good
        heuristics (i.e., guesses).  Therefore this option is not enabled by
        default, but it can be extremely useful on those rare occasions when
        a VMS text file must be extracted as normal text.

      USE_VFAT   (MS-DOS only, for using same executable under DOS and Win95/NT)
        djgpp 2.x and emx/gcc+RSX 5.1 can detect when they are running under a
        Win32 DOS box and will accordingly enable long-filename support.  For
        now only djgpp 2.x and emx/gcc with RSX 5.1 or later have this feature
        (and it is defined by default in msdos/makefile.dj2 and makefile.emx),
        but if/when other compilers build in similar support, define this
        macro to enable its use.  See also msdos/doscfg.h.  [Note that djgpp
        2.0's LFN support is flaky; users should upgrade to 2.01 or later.]

      NOTIMESTAMP
        This option disables the -T option, which basically does exactly what
        Zip's -go options do (i.e., set the timestamp of the zipfile to that of
        the newest file in the archive without rewriting the archive).  Unlike
        Zip, however, UnZip supports wildcard specifications for the archive
        name; for example, "unzip -T *.zip" will set the dates of all zipfiles
        in the current directory.  (UnZip's option is also much faster.)

      DATE_FORMAT=DF_DMY or DF_MDY or DF_YMD
        This option controls the order in which date components are printed
        in listings:  day-month-year or month-day-year or year-month-day.
        For DOS derivatives the format is automatically obtained from the
        operating system; most others default to DF_MDY.

      UNIXBACKUP   (Unix only)
        This option enables a -B option that instructs UnZip to rename files
        that would normally be overwritten.  The renamed files are given a
        tilde suffix (`~').  Note that previously renamed files may be over-
        written without notice, even if the -n option is given.

      OS2_EAS
        List the sizes of OS/2 EAs and ACLs for each file as two extra columns
        in "unzip -l" output.  This is primarily useful for OS/2 systems, but
        because zipfiles are portable, OS2_EAS can be defined for any system.
        (May be extended someday to show sizes of Mac resource forks, RISCOS
        and VMS file info, etc.)

      DELETE_IF_FULL  (anybody with unlink() function)
        If a write error is encountered (most likely due to a full disk),
        enabling this option will cause the incomplete file to be deleted
        instead of closed normally.  This is particularly useful for the
        Windows CE port, which must generally contend with extremely limited
        resources.

      ASM_CRC   (Amiga/Aztec C; many x86 systems:  DOS, OS/2, Win32, Unix)
        Use an assembler routine to calculate the CRC for each file (speed).

      ASM_INFLATECODES   (Amiga/Aztec C only, for now)
        Use an assembler version of inflate_codes() for speed.

      OLD_EXDIR
        No longer supported.

      SFX_EXDIR
        Enable the "-d <extract_dir>" option for UnZipSFX.  By default it is
        disabled so as to generate the smallest possible executable stub, but
        for use with automated installation scripts and the like it may be
        useful to enable -d.

      NO_ZIPINFO
        Compile without ZipInfo mode (-Z) enabled; makes a smaller executable
        because many text strings are left out.  Automatically enabled for
        some small-model compiles under MS-DOS and OS/2, so ordinarily there
        is no need to specify this explicitly.  (Note that even with this
        defined, the resulting executable may still be too big to extract
        some zipfiles correctly, if compiled with the small memory model.)

      LZW_CLEAN   (now default)
      USE_UNSHRINK
        The "shrinking" algorithm from PKZIP 1.0 is an LZW variant.  Unisys
        patented the Lempel-Ziv-Welch algorithm in 1985 and has publicly
        claimed that decompression is covered by it.  (IBM also patented the
        same thing in a filing 3 weeks prior to Unisys's.)  Therefore un-
        shrinking is disabled by default, but those with LZW licenses can
        enable it by defining USE_UNSHRINK.  (Unshrinking was used by PKZIP
        1.0 and 1.1, and Zip 1.0 and 1.1.  All newer archives use only the
        deflation method.)

      COPYRIGHT_CLEAN   (now default)
      USE_SMITH_CODE
        The last chunk of code in UnZip that was blatantly derived from Sam
        Smith's unzip 2.0 (as in, "substantially similar") is in unreduce.c.
        Since reducing was only used by very early PKZIP beta versions (0.9x),
        support for it is now omitted by default (COPYRIGHT_CLEAN).  To in-
        clude unreducing capability, define USE_SMITH_CODE.  Note that this
        subjects UnZip to any and all restrictions in Smith's copyright; see
        the UnZip COPYING file for details.

      PASSWD_FROM_STDIN   (with full crypt sources only; Unix, VMS only)
        Used to allow the password on encrypted files to be read from stdin
        rather than the default stderr.  This was useful for those who wished
        to automate the testing or decoding of encrypted archives (say, in a
        shell script via ``echo "password" | unzip -tq archive''), but as of
        version 5.3, UnZip has a -P option for passing a password directly to
        the program.  PASSWD_FROM_STDIN will therefore probably be phased out
        in future versions.  Note that the same security warnings given in the
        description of the -P option apply here as well.

      DEBUG
        Used for debugging purposes; enables Trace() statements.  Generally
        it's best to compile only one or two modules this way.

      DEBUG_TIME
        Used for debugging the timezone code in fileio.c; enables TTrace()
        statements.  This code is only used for the freshen/update options
        (-f and -u), and non-Unix compilers often get it wrong.


(4) If you regularly compile new versions of UnZip and always want the same
    non-standard option(s), you may wish to add it (them) to the LOCAL_UNZIP
    environment variable (assuming it's supported in your makefile).  Under
    MS-DOS, for example, add this to AUTOEXEC.BAT:

        set LOCAL_UNZIP=-DDOSWILD -DDATE_FORMAT=DF_DMY

    You can also use the variable to hold special compiler options (e.g.,
    -FPi87 for Microsoft C, if the x87 libraries are the only ones on your
    disk and they follow Microsoft's default naming conventions; MSC also
    supports the CL environment variable, however).


(5) Run the make utility on your chosen makefile:

      Unix
        For most systems it's possible to invoke the makefile in place, at
        the possible cost of an ignorable warning; do "make -f unix/Makefile
        list" to get a list of possible system targets, and then "make -f
        unix/Makefile target" for your chosen target.  The "generic" target
        works for most systems, but if it fails with a message about ftime()
        unresolved or timezone redefined, do "make clean", "make help", and
        then either "make generic2" or "make generic3" as instructed.  If all
        else fails, read the makefile itself; it contains numerous comments.
        (One of these days we'll make a configure script that automates this
        procedure better.)

      VMS
        For a one-time build of the default UnZip, simply run the supplied
        command file MAKE_UNZ.COM.  To use either DEC C on an Alpha or the
        default compiler (DEC C if available, else VAX C) on a VAX, type
        "@make_unz" (after copying make_unz.com into the current directory;
        otherwise do "@[.vms]make_unz" to invoke it in place).
        If you want to force the use of VAX C when both VAX C and DEC C are
        available, do "@make_unz vaxc" (or "@[.vms]make_unz vaxc").
        To use GNU C (gcc) on either platform, do "@make_unz gnuc".
        (NOTE: Currently, gcc for VMS(AXP) is not yet available!)
        The command procedure MAKE_UNZ.COM now recognizes custom feature
        options supplied in the logical name LOCAL_UNZIP; details are
        explained in the comments at the top of MAKE_UNZ.COM.

        For repeated makes or other hacker-like tinkering with the sources,
        or to create a custom version of UnZip, you may use the included "MMS"
        makefile, DESCRIP.MMS.  Copy it into the current directory, read the
        comments at the top of it and run MadGoat's free MMS clone "MMK" on it.
        Newer versions of DEC's MMS should work, too, but older ones apparently
        choke on some MMK-specific extensions in DESCRIP.MMS.  (If somebody
        has an "older" version that works, let us know and we'll remove this
        caveat.)

      MS-DOS
        See the msdos\Contents file for notes regarding which makefile(s) to
        use with which compiler.  In summary:  pick one of msdos\makefile.*
        as appropriate, or (as noted above) use the OS/2 gccdos target for
        emx+gcc.  There is also an mscdos cross-compilation target in
        os2\makefile.os2 and a sco_dos cross-compilation target in the Unix
        makefile.  For Watcom 16-bit or 32-bit versions, see the comments in
        the OS/2 section below.

        After choosing the appropriate makefile and editing as necessary or
        desired, invoke the corresponding make utility.  Microsoft's NMAKE
        and the free dmake and GNU make utilities are generally the most
        versatile.  The makefiles in the msdos directory can be invoked in
        place ("nmake -f msdos\makefile.msc", for example).

      OS/2
        Either GNU make, nmake or dmake may be used with the OS/2 makefile;
        all are freely available on the net.  Do "nmake -f os2\makefile.os2",
        for example, to get a list of supported targets.  More generally,
        read the comments at the top of the makefile for an explanation of
        the differences between some of the same-compiler targets.

      Win32 (WinNT or Win95)
        You will need Microsoft Visual C++ 2.x for Win95 or NT (Intel, MIPS,
        Alpha, PowerPC?), or Watcom C++ for Win95 or NT (Intel only). As an
        alternative for Intel platforms, GNU C (the emx/rsxnt port) is now
        supported as well. DEC C/C++ for NT/Alpha may or may not still work.
        For the Watcom compiler, use WMAKE and win32\makefile.wat; for the
        others, use NMAKE and win32\Makefile. With emx+gcc, a good choice is
        GNUMake 3.75 from the djgpp V2.01 distribution.

      WinCE (WinCE or WinNT)
        Only Microsoft Visual C++ 5.0 or later is supported.  Use the included
        project file and check wince\README for details.

      AmigaDOS
        SAS/Lattice C and Manx Aztec C are supported.  For SAS C 6.x do "smake
        -f amiga/smakefile all"; for Aztec C do "make -f amiga/makefile.azt
        all".  The Aztec C version supports assembly-language versions of two
        routines; these are enabled by default.

      Atari TOS
        Turbo C is no longer supported; use gcc and the MiNT libraries, and
        do "make".  Note that all versions of gcc prior to 2.5.8 have a bug
        affecting 68000-based machines (optimizer adds 68020 instructions).
        See atari\README for comments on using other compilers.

      Macintosh
        Think C is the only currently supported compiler, although the Mac
        Programmer's Workbench (MPW) was supported at one time and still has
        hooks in unzip.h.  For Think C, un-BinHex the Think C project file and
        UnZip resource file (using Stuffit Expander or BinHex 4.0 or later),
        then open the project and click on the compile button.

      Acorn (RISC OS)
        Extract the files from the archive and place in standard 'Acorn' C
        form (i.e., *.c, *.h and *.s become c.*, h.* and s.*, respectively),
        either using the UNZIP$EXTS environment variable and a pre-built UnZip
        binary, or using Spark[FS] and doing it manually.  Then copy the
        Acorn.Makefile to the main UnZip directory and either type 'amu' or
        use the desktop make utility.

      VM/CMS
        Unpack all the files and transfer them with ASCII -> EBCDIC conver-
        sion to an appropriate directory/minidisk/whatever, then execute
        UNZVMC to compile and link all the sources.  This may require C/370
        version 2.1 or later and certain `nucleus extensions,' although
        UnZip 5.3 has been reported to compile fine with the `ADCYCLE C/370
        v1.2 compiler.'  Note that it will abend without access to the C/370
        runtime library.  See the README.CMS file for more details.

      MVS
        Unpack all the files and transfer them to an appropriate PDS with
        ASCII -> EBCDIC conversion enabled, then edit UNZMVSC.JOB as required,
        and execute it to compile and link all the sources.  C/370 2.1 or
        later is required.  See README.MVS for further details.  [This is a
        new port and may need a little more work even to compile.]

      Human68K
        [This is a Japanese machine and OS.]  It appears that GNU make and
        gcc are required; presumably just do "gmake -f human68k/Makefile.gcc"
        to build everything.  This port has not been tested since the 5.12
        release.

      TOPS-20
        [No longer fully supported due to new, unported features, although
        patches are always accepted.]  Unpack all files into the current
        directory only (including those in the zipfile's tops20 directory),
        then use make.mic and "do make".

      BeOS
        You can run the BeOS makefile in place by typing "make -f
        beos/Makefile".  In fact, this is how the author tests it.

    Running the appropriate make utility should produce three executables on
    most systems, one for UnZip/ZipInfo, one for UnZipSFX, and one for fUnZip.
    (VMS is one prominent exception:  fUnZip makes no sense on it.  The Amiga
    produces a fourth executable called MakeSFX, which is necessary because
    Amiga self-extracting archives cannot be created by simple concatenation.
    If necessary the source amiga/makesfx.c can be compiled on other systems.)
    Read any OS-specific README files for notes on setting things up for
    normal use (especially for VMS) and for warnings about known quirks and
    bugs in various compilers (especially for MS-DOS).

    Also note that many OSes require a timezone variable to be set correctly
    (often "TZ"); Unix and VMS generally do so by default, Win95/NT do if set
    up properly, but other OSes generally do not.  See the discussion of the
    -f and -u options in the UnZip man page (or unzip.doc).  BeOS doesn't
    currently support timezone information at all, but this will probably be
    added soon.

    Then test your new UnZip on a few archives and let us know if there are
    problems (but *please* first make certain that the archives aren't actu-
    ally corrupted and that you didn't make one of the silly mistakes dis-
    cussed in the documentation).  If possible, double-check any problems
    with PKUNZIP or with a previous version of UnZip prior to reporting a
    "bug."  The zipfile itself may be damaged.



To install:
===========

Unix
  The default prefix for the installation location is /usr/local (things
  go into the bin and man/man1 subdirectories beneath the prefix), and
  the default man-page extension is "1" (corresponding to man/man1, above).
  To install as per the defaults, do "make install"; otherwise do "make
  prefix=/your/path manext=your_extension install".  (For Intel Unix flavors
  where the assembler CRC routines were used [ASM_CRC], use the install_asm
  target instead of the regular install target.)  For example, to install
  in your home directory with "l" as the man-page extension (for "local"),
  do "make prefix=$HOME manext=l install".  Permissions will be 755 for the
  executables and 644 for the man pages.  In general root must perform in-
  stallation into a public directory.  Do "rehash" if your shell requires
  it in order to find the new executables.

VMS
  Install UnZip as foreign symbol by adding this to login.com:

       $ unzip == "$disk:[dir]unzip.exe"
       $ zipinfo == "$disk:[dir]unzip.exe ""-Z"""

  where "disk" and "dir" are the location of the UnZip executable; the "$"
  before the disk name is important, as are the double-double-quotes around
  the -Z.  Some people, including the author, prefer a short alias such as
  "ii" instead of "zipinfo"; edit to taste.  Optionally also install unzipsfx
  for use with the MAKESFX.COM command file.  See vms/README (or [.VMS]README.)
  for details on this and for notes/warnings about zipfiles and UnZip under
  VMS.

OS/2, MS-DOS, NT, Atari, Amiga
  Move or copy unzip.exe (or unzip.ttp, or UnZip, or whatever) to a direc-
  tory in your path; also possibly copy the UnZip executable to zipinfo.exe
  (or ii.exe), or else create an alias or a batch/command file for ZipInfo
  ("@unzip -Z %1 %2 %3 %4 %5 %6 %7 %8 %9" under MS-DOS).  The latter is only
  relevant if NO_ZIPINFO was *not* defined, obviously...  Under djgpp 2.x,
  zipinfo.exe is a 2K stub symbolically linked to unzip.exe.

Acorn RISC OS
  Copy the executables unzip, funzip and zipinfo to somewhere in your
  Run$Path.  See your Welcome manual if you don't know about Run$Path.

BeOS
  The default prefix for the installation location is /boot/usr/local
  (things go into the bin and man/man1 subdirectories beneath the prefix),
  and the default man-page extension is "1" (corresponding to the man/man1,
  above).  Of course, these Unix man-pages aren't useful until someone ports
  something that can format them... plain text versions are also installed
  with an extension of ".doc".  To install, do a "make install", or to
  change the prefix, do "make prefix=/your/path install".  For example, to
  install in /boot/bin, do "make prefix=/boot/bin install".

Macintosh
  Move the executable(s) somewhere--for example, drag it (or them) to your
  Applications folder.  For easy access, make an alias in the Launcher Control
  Panel or directly on your desktop.

Human68K, TOPS-20, AOS/VS, MVS, VM/CMS, etc.
  Dunno, sorry...
