blob: a415747e41e8c92cfe8a4492789ed4642838fc22 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<TITLE>Compiling Apache for Microsoft Windows</TITLE>
</HEAD>
<!-- Background white, links blue (unvisited), navy (visited), red (active) -->
<BODY
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#000080"
ALINK="#FF0000"
>
<!--#include virtual="header.html" -->
<H1 ALIGN="CENTER">Compiling Apache for Microsoft Windows</H1>
<P>There are many important points before you begin compiling Apache.
See <A HREF="windows.html">Using Apache with Microsoft Windows</A>
before you begin.</P>
<P>Compiling Apache requires Microsoft Visual C++ 5.0 (or later) to be
properly installed. It is easiest to compile with the command-line tools
(nmake, <EM>etc.</EM>..). Consult the VC++ manual to determine how to install
them. Be especially aware that the vcvars32.bat file from the
Program Files/DevStudio/VC/bin folder may be required to prepare the
command-line environment for command-line builds!</P>
<P>First, unpack the Apache distribution into an appropriate
directory. Open a command-line prompt, and change to the
<CODE>src</CODE> subdirectory of the Apache distribution.</P>
<P>The master Apache makefile instructions are contained in the
<CODE>Makefile.win</CODE> file. To compile Apache on Windows, simply
use one of the following commands:<P>
<UL>
<LI><CODE>nmake /f Makefile.win _apacher</CODE> (release build)
<LI><CODE>nmake /f Makefile.win _apached</CODE> (debug build)
</UL>
<P>These will both compile Apache. The latter will include debugging
information in the resulting files, making it easier to find bugs and
track down problems.</P>
<P>Apache can also be compiled using VC++'s Visual Studio development
environment. To simplify this process, a Visual Studio workspace,
Apache.dsw, is provided in the src folder. This workspace exposes
the entire list of working .dsp projects that are required for the
complete Apache binary release. It includes dependencies between
the projects to assure that they are built in the appropriate order.</P>
<P><STRONG>Notice: The Apache/VisualStudio project files are distributed
in VisualStudio 6.0 (98) format.</STRONG> In fact you may build with
VisualStudio 5.0 (97) but you must first use the perl script command:</P>
<PRE>
cd src\helpers
cvstodsp5.pl
</PRE>
<P>Without running the script you will be able to load and build Apache,
however VisualStudio 97 in particular will not recognize the /ZI flag
to the C compiler for the debugging mode. This script toggles the
new /ZI flag back to /Zi for Debug builds, among other adjustments.
The converse script in <CODE>src/helpers/dsp5tocvs.pl</CODE> will
reverse the adjustments, and we ask you to do so before submitting
patches against any .dsp project files.</P>
<P>The Apache.dsw workspace and makefile.win nmake script both build the
.dsp projects of the Apache server in the following sequence:</P>
<OL>
<LI><CODE>lib\apr\aprlib.dsp</CODE>
<LI><CODE>lib\apr\aprlibdll.dsp <EM>requires aprlib</EM></CODE>
<LI><CODE>lib\pcre\dftables.dsp</CODE>
<LI><CODE>lib\pcre\pcre.dsp <EM>requires dftables</EM></CODE>
<LI><CODE>lib\pcre\pcreposix.dsp <EM>requires dftables and pcre</EM></CODE>
<LI><CODE>lib\expat-lite\xmltok.dsp</CODE>
<LI><CODE>lib\expat-lite\xmlparse.dsp <EM>requires xmltok</EM></CODE>
<LI><CODE>main\gen_uri_delims.dsp</CODE>
<LI><CODE>main\gen_test_char.dsp</CODE>
<LI><CODE>ApacheCore.dsp <EM>requires all of the above</EM></CODE>
<LI><CODE>Apache.dsp <EM>requires ApacheCore and aprlibdll</EM></CODE>
</OL>
In addition, the <CODE>os\win32</CODE> subdirectory contains
project files for the optional modules.
<OL>
<LI><CODE>os\win32\ApacheModuleAuthAnon.dsp</CODE>
<LI><CODE>os\win32\ApacheModuleAuthDigest.dsp</CODE>
<LI><CODE>os\win32\ApacheModuleCERNMeta.dsp</CODE>
<LI><CODE>os\win32\ApacheModuleExpires.dsp</CODE>
<LI><CODE>os\win32\ApacheModuleFileCache.dsp</CODE>
<LI><CODE>os\win32\ApacheModuleHeaders.dsp</CODE>
<LI><CODE>os\win32\ApacheModuleInfo.dsp</CODE>
<LI><CODE>os\win32\ApacheModuleRewrite.dsp</CODE>
<LI><CODE>os\win32\ApacheModuleSpeling.dsp</CODE>
<LI><CODE>os\win32\ApacheModuleStatus.dsp</CODE>
<LI><CODE>os\win32\ApacheModuleUserTrack.dsp</CODE>
<LI><CODE>modules\proxy\ApacheModuleProxy.dsp</CODE>
</OL>
The <CODE>support\</CODE> folder contains project files for additional
programs that are not part of the apache runtime, but are used by
the administrator to test Apache and maintain password and log files.</P>
<OL>
<LI><CODE>support\ab.dsp</CODE>
<LI><CODE>support\htdigest.dsp</CODE>
<LI><CODE>support\htpasswd.dsp</CODE>
<LI><CODE>support\logresolve.dsp</CODE>
<LI><CODE>support\rotatelogs.dsp</CODE>
</OL>
<P>Once Apache has been compiled, it needs to be installed in its server
root directory. The default is the <CODE>\Apache</CODE>
directory, on the current hard drive. </P>
<P>To build and install all the files into the desired folder <EM>dir</EM>
automatically, use one the following nmake commands:
<UL>
<LI><CODE>nmake /f Makefile.win installr INSTDIR=<EM>dir</EM></CODE>
(for release build)
<LI><CODE>nmake /f Makefile.win installd INSTDIR=<EM>dir</EM></CODE>
(for debug build)
</UL>
The <EM>dir</EM> argument to INSTDIR gives the installation directory; it
can be omitted if Apache is to be installed into <SAMP>\Apache</SAMP>.</P>
<P>This will install the following:</P>
<UL>
<LI><CODE><EM>dir</EM>\Apache.exe</CODE> - Apache executable
<LI><CODE><EM>dir</EM>\aprlib.dll</CODE> - Apache Portable Runtime shared library
<LI><CODE><EM>dir</EM>\ApacheCore.dll</CODE> - Apache Core application
<LI><CODE><EM>dir</EM>\modules\ApacheModule*.dll</CODE> - Loadable Apache
modules
<LI><CODE><EM>dir</EM>\bin\*.exe</CODE> - Administrator support executables
<LI><CODE><EM>dir</EM>\conf</CODE> - Empty configuration directory
<LI><CODE><EM>dir</EM>\logs</CODE> - Empty logging directory
</UL>
<P>If you do not have nmake, or wish to install in a different directory,
be sure to use a similar naming scheme, or use the following shortcut.</P>
<P>To simplify the process, dependencies between all projects
are defined in the Microsoft VisualStudio workspace file:
<PRE>
src/Apache.dsw
</PRE>
<P>This assures that lower-level sources are rebuilt from within
VisualStudio. The top level project is InstallBin, which invokes
Makefile.win to move the compiled executables and dlls. You may
personalize the INSTDIR= setting by changing the Settings for
InstallBin, Build command line entry under the General tab.
The default from within the InstallBin.dsp project is one level up
(..) from the src tree.</P>
<P><STRONG>Warning about building Apache from the development tree</STRONG></P>
<P>Only the .dsp files are distributed between release builds. The
.mak files are NOT regenerated, due to the tremendous waste of
reviewer's time. Therefore, you cannot rely on the NMAKE commands
above to build revised .dsp project files unless you then export
all .mak files yourself from the project. This is unnecessary if
you build from withing the Microsoft DeveloperStudio environment.</P>
<P>Before running the server you must fill out the conf directory.
Copy the *.conf-dist-win from the distribution conf directory
and rename *.conf. Edit the @@ServerRoot@@ entries to your
actual server root (for example "C:\apache"). Copy over
the conf/magic and conf/mime.types files as well.</P>
<!--#include virtual="footer.html" -->
</BODY>
</HTML>