			Windows installation instructions

This file describes how to compile GNU Prolog on Windows machines.
There are actually 3 ports:
   - pure Win32   with MS Visual C++ (MSVC++)
   - pure Win32   with MinGW  (gcc)
   - using Cygwin with Cygwin (gcc).

However, even to compile a source distribution of GNU Prolog with MSVC, you
need a Unix-like environment (providing standard Unix tools like: make, rm,
cp, ...). You can either use Cygwin or MinGW/MSYS for this.

NB: The current version DOES NOT accept spaces in pathnames. Do not
uncompress your source distribution under a pathname containing spaces. Do
not install it under a pathname containing spaces.


1) Installing and configuring Cygwin
------------------------------------

Cygwin is a Unix-like environment for Windows. It consists of two parts:
   - a DLL (cygwin1.dll) which acts as a Linux emulation layer providing
     substantial Linux API functionality.  
   - a collection of tools, which provide Linux look and feel.

Refer to www.cygwin.com to properly install Cygwin. The resulting system is
installed under something like c:\Cygwin.

You can set some variables in this .bat launching cygwin
(c:\cygwin\cygwin.bat) since environment variables are inherited by the
Cygwin shell. For instance if you use MSVC++ and the Microsoft SDK (see
below) you can add "call c:\Program Files\Microsoft SDK\SetEnv.Bat" to the
.bat (note that if you have installed "Register environment variables" from
the Microsoft SDK, you don't need to call SetEnv.bat as explained below).

You can also modify your .bashrc file to set the PATH variable for the tools
you will use.

Similarly if you want to use the Microsoft HTML Help Workshop (see below) you
can add something like "C:\Program Files\HTML Help Workshop" to your PATH in
the .bat file (or '/cygdrive/c/Program Files/HTML Help Workshop' in your
.bashrc file).

Here is an example of .bat file launching bash in a text console:
	@ECHO OFF
	CALL c:\hhvars.bat
	CALL c:\cygwin\cygwin.bat

with hhvars.bat containing:
	@ECHO OFF
	ECHO Setting environment for using HTML Help Workshop.
	PATH=%PATH%;C:\Program Files\HTML Help Workshop


Finally note that a pure Win32 native graphical version of Emacs exists for
winXX machines (in addition to the one provided by Cygwin which requires
Cygwin1.dll and runs in text mode unless a X server is started). Refer to
www.gnu.org/software/emacs/windows for more information. 

The gcc version provided by Cygwin is a cygwin port of gcc (it uses
cygwin1.dll). By default it generates a code using cygwin1.dll. It is however
possible to generate a pure win32 code using the -mno-cygwin option.  The
-mno-cygwin flag to gcc makes gcc link against standard Microsoft DLLs
instead of Cygwin (like what does MinGW/gcc). This is desirable for native
Windows programs that don't need a UNIX emulation layer. This is not to be
confused with MinGW (see below) whose gcc does not need cygwin1.dll to run
(it is a pure Win32 port of gcc).



2) Installing and configuring MinGW/MSYS
----------------------------------------

MinGW (Minimalist GNU For Windows) is a collection of freely available and
freely distributable Windows specific header files and import libraries
combined with GNU toolsets that allow one to produce native Windows programs
that do not rely on any 3rd-party C runtime DLLs.

MSYS is A Minimal SYStem to provide POSIX/Bourne configure scripts the
ability to execute and create a Makefile used by make.

Refer to www.mingw.org for more information (how to get MinGW/MSYS and all
needed tools).

NB: if you want your .bash_profile to be executed, add this line at the end
of /etc/profile (in c:\msys\1.0\etc):
if [ -f "$HOME/.bash_profile" ]; then source "$HOME/.bash_profile"; fi

The gcc version provided by MinGW is a native win32 port of gcc. It generates
a code for native win32.

By default, under MinGW/MSYS, the Win32 GUI console is compiled. For this you
need the HTML Help Workshop. See below on how to get/install it. You can
avoid the GUI console using ./configure --disable-gui-console (see INSTALL).


3) Compiling GNU Prolog using Cygwin or MinGW/MSYS
--------------------------------------------------

Launch a shell (Cygwin or MSYS) and follow the classical installation
procedure (see ../INSTALL file), i.e.:

	./configure
	make
	make install

The default gcc will be used (the one using cygwin1.dll and producing code
using cygwin1.dll) under cygwin and native win32 gcc under msys.


4) Compiling GNU Prolog using MSVC++
------------------------------------

You need MSVC++. GNU Prolog has been tested with version 6.0 and Visual C++
2005 Express Edition. The later is freely available from microsoft site:
http://msdn.microsoft.com/vstudio/express/visualc/download/.

Then install this SDK (or more recent version) : Microsoft Windows Server
2003 R2 Platform SDK. You can install it from :
http://www.microsoft.com/downloads/details.aspx?FamilyId=0BAF2B35-C656-4969-ACE8-E4C0C0716ADB&displaylang=en. 
If you chose to set up environement variables, MSVC++ is informed about new
include/library directories. Else your can execute .bat provided with the MS
compiler (e.g. vcvarvs32.bat or vsvar32.bat). Anyway, your PATH shoud contain
the cl.exe command-line compiler, INCLUDE and LIB should be correctly set.
NB: for MSVC6.0: its lib directory should appear before the lib directory of
the SDK (else an error occurs when linking the GUI console).

NB: recent cygwin include a /bin/link.exe command. Be sure it doesn't shadow
the Microsoft linker (also called link.exe). The simplest way to solve it is
to rename /bin/link.exe of cygwin.

Once MSVC++ and the SDK are well installed use --with-msvc at configure time:

	./configure --with-msvc
	make
	make install

By default, the GUI console is compiled (sources in W32GUICons) unless you
use ./configure --disable-gui-console. See the ../INSTALL file for further
information. Even if compiled with the GUI it is possible to avoid it (and
run in console mode) a Prolog program setting the environment variable
LINEDIT to a string containing gui=no, e.g. (bash) export LINEDIT='gui=no', 
(windows) SET LINEDIT=gui=no.
	


5) Using Microsoft HTML Help
----------------------------

If you compile under native Win32 with the GUI Console (see above), you can
have a direct access to the GNU Prolog manual (with contextual help, index,
table of contents, search). For this we use the Microsoft HMLT Help facility.
which is the standard help system for the Win32 platforms (replacing old
WinHelp). It is mainly based on HTML files + add-ons (table of contents,
index, search facilities,...). A SDK is freely available as a "HTML Help
Workshop". There are 2 parts: a compiler to create a .chm version of the
documentation (see doc/README) and a library that makes it possible to use
this file from a C program. 

You can get the HTML-Help Workshop from
msdn.microsoft.com/library/en-us/htmlhelp/html/vsconHH1Start.asp (file
HTMLHELP.EXE). In order to access to the compiler you have to add "C:\Program
Files\HTML Help Workshop" to your PATH (see file hhvars.bat above).

If you have the SDK (see above) the header file htmlhelp.h and the library
htmlhel.lib are already present. Else copy them from the workshop directory.

For MinGW (I suppose you are under MSYS and mingw is in /mingw):
	cp /c/Program\ Files/HTML\ Help\ Workshop/include/* /mingw/include/.
	cp /c/Program\ Files/HTML\ Help\ Workshop/lib/* /mingw/lib/

Note that it is possible to rename htmlhelp.lib to libhtmlhelp.a to follow
the Unix-like names (but a .lib also works).

Note: when building the GUI console a warning can be displayed by the linker
due to some directive placed by MS link.exe in the .lib. It does not
matter. The message looks like:

      Warning: .drectve `-defaultlib:uuid.lib ' unrecognized
      
Consult doc/README for more information about HTML Help Formats.





