                       _             _ 
   _ __ ___   ___   __| |    ___ ___| |  
  | '_ ` _ \ / _ \ / _` |   / __/ __| |  
  | | | | | | (_) | (_| |   \__ \__ \ |  mod_ssl - Apache Interface to SSLeay  
  |_| |_| |_|\___/ \__,_|___|___/___/_|  http://www.engelschall.com/sw/mod_ssl/
                       |_____|         
  _____________________________________________________________________________


  Building mod_ssl under the Win32 environment
  --------------------------------------------

  This file describes how to build mod_ssl under the 
  Win32 environment (Windows 95/98/NT). 

  *****************************************************************************
  ** WARNING: 1. THE WIN32 SUPPORT FOR APACHE IS STILL BETA STAGE!           **
  **                                                                         **
  **          2. THE WIN32 SUPPORT FOR MOD_SSL IS ALPHA STAGE!               **
  **                                                                         **
  **          3. THERE IS NO OFFICIAL MOD_SSL SUPPORT FOR THE WIN32 PLATFORM **
  **             BECAUSE THE AUTHOR OF MOD_SSL ONLY SUPPORTS UNIX PLATFORMS. **
  **             SO, WHEN YOU WANT TO RUN APACHE+MOD_SSL UNDER WIN32 DO IT   **
  **             ON YOUR OWN RISK AND YOUR OWN RESPONSIBILITY!               **
  *****************************************************************************

  Prerequisites
  -------------

  To use mod_ssl you need at least the following two packages:

   o  Package:      Apache 
      Version:      1.3.x
      Description:  Apache Group HTTP Server
      Homepage:     http://www.apache.org/
      Distribution: http://www.apache.org/dist/
      Tarball:      apache_1.3.x.tar.gz
      Location:     SF, USA
      Author(s):    The Apache Group <apache@apache.org>

   o  Package:      mod_ssl
      Version:      2.1.x
      Description:  Apache Interface to SSLeay
      Homepage:     http://www.engelschall.com/sw/mod_ssl/
      Distribution: http://www.engelschall.com/sw/mod_ssl/dist/
      Tarball:      mod_ssl-2.1.x-1.3.x.tar.gz
      Location:     Zurich, Switzerland, Europe
      Author(s):    Ralf S. Engelschall <rse@engelschall.com>

  If you have the SSLeay package not already installed on your system you
  additionally need the following:

   o  Package:      SSLeay
      Version:      0.9.x
      Description:  SSL Toolkit 
      Homepage:     http://www.ssleay.org/
      Distribution: ftp://ftp.psy.uq.oz.au/pub/Crypto/SSL/
      Tarball:      SSLeay-0.9.x.tar.gz
      Location:     Brisbane, Australia
      Author(s):    Eric A. Young <eay@cryptsoft.com>
                    Tim Hudson <tjh@cryptsoft.com>

  Finally you need the following auxiliary packages already installed
  (CygWin32 for unpacking the tarballs and Perl for building SSLeay):

   o  Package:      CygWin32
      Version:      B19
      Description:  The Unix tools for Win32
      Homepage:     http://www.cygnus.com/misc/gnu-win32/
      Distribution: ftp://ftp.cygnus.org/
      Tarball:      usertools.exe
      Location:     USA
      Author(s):    Cygnus
 
   o  Package:      Perl
      Version:      5.004 or 5.005
      Description:  The Practical Extraction and Reporting Language
      Homepage:     http://www.perl.com/
      Distribution: http://www.perl.com/CPAN/src/5.0/
      Tarball:      perl5.00402-bindist04-bc.zip
      Location:     USA
      Author(s):    Larry Wall

  And finally you need MS Visual C++ 5.0 ( sorry, not free software :-( )

   o  Package:      Visual Studio 97
      Version:      5.0
      Description:  The Microsoft C/C++ Compiler Framework
      Homepage:     http://www.microsoft.com/vstudio/
      Distribution: -
      Tarball:      -
      Location:     USA
      Author(s):    Microsoft Corp.

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

  Now follow these steps:
   
   1. Make sure CygWin32, Perl and the Visual Studio tools are already installed and 
      available through the commands `gzip', `tar', `perl', `nmake', `cl',
      `link', etc. They are needed for configuring SSLeay and mod_ssl and for
      building the packages. Additionlly a text editor should be available.
      We assume `vim', but you can use any preferred text editor.

   2. Extract the required packages
      
      $ gzip -d -c apache_1.3.x.tar.gz | tar xvf -                 
      $ gzip -d -c mod_ssl-2.1.x-1.3.x.tar.gz | tar xvf -         
      $ gzip -d -c SSLeay-0.9.x.tar.gz | tar xvf -               

   3. Configure and build the SSLeay library. This is a little bit
      more complicated than under Unix, because you have to additionally
      patch some source files.

      o Enter the SSLeay source tree

        $ cd SSLeay-0.9.0b

      o Modify $INSTALLTOP in util\mk1mf.pl to fit your preference (e.g. p:\ssleay)

        $ vim util\mk1mf.pl
        << $INSTALLTOP="/usr/local/ssl";
        >> $INSTALLTOP="p:\ssleay";

      o Comment out two lines containing "binmode" near the beginning of the
        file ms\cmp.pl. Otherwise SSLeay tests will fail below.

        $ vim ms\cmp.pl
        << binmode IN0;
        << binmode IN1;
        >> # binmode IN0;
        >> # binmode IN1;

      o Edit file crypto\bn\bn_mulw.c by changing line 174:

        $ vim crypto\bn\bn_mulw.c
        << return(ll&BN_MASK2);
        >> return(BN_ULONG)(ll&BN_MASK2);

      o Edit file include\des.h as following:
    
        $ vim include\des.h
        << char *crypt();
        >> #ifndef MOD_SSL
        >> char *crypt();
        >> #endif

      o Create the all-in-one SSLeay Makefile for building under Win32:

        $ perl util\mk1mf.pl no-asm dll VC-WIN32 > makefile.win32

        Note: When you've the Microsoft Assembler (`ml') installed on your
              platform you can leave out the `no-adm' option, of course.

      o Build the SSLeay package

        $ nmake /f makefile.win32

      o Now you can additionally test SSLeay by running

        $ cd out32dll
        $ ..\ms\test.bat
       
      o Install SSLeay into $INSTALLTOP. You have do this by hand:
        (replace p:\ssleay with the path you set $INSTALLTOP to)

        $ mkdir p:\ssleay 
        $ mkdir p:\ssleay\bin
        $ mkdir p:\ssleay\lib
        $ mkdir p:\ssleay\include
        $ copy /b inc32\*        p:\ssleay\include
        $ copy /b out32dll\*.lib p:\ssleay\lib
        $ copy /b out32dll\*.dll p:\ssleay\lib
        $ copy /b out32dll\*.exe p:\ssleay\bin

      o Leave the SSLeay source tree
    
        $ cd ..

      o Now optionally put $INSTALLTOP\bin into your %PATH%

  4. Now apply the mod_ssl source extension and source patches to 
     the Apache source tree.

     $ cd mod_ssl-2.1.x-1.3.x
     $ configure.bat 
           --with-apache=..\apache_1.3.x 
           --with-ssleay=p:\ssleay
     $ cd ..

  5. Build and install the SSL-aware Apache:

     $ cd apache_1.3.x\src
     $ nmake /f Makefile.nt
     $ nmake /f Makefile.nt installr

  6. Now you're on your own, because Win32 is not an officially 
     supported platform of mod_ssl. You have to setup the config files
     and certifcates manually. Good luck...

