This is the port of gcc-2.95.2 for DJGPP (this includes not only
gcc-2.95.2 but also libg++-2.8.1.3). 


Please read this file up to end (maybe skipping sections You don't need,
for example You don't need to read how to build gcc-2.95.2 from sources
if You only intend to use binary archives). Also consult DJGPP documentation
and FAQ where needed.


Requirements to use this binary release:
    DJGPP-2.02 or above (If You are still using djdev200.zip or djdev201.zip,
            then please upgrade immediatelly)
    binutils-2.8.1 or above (2.9.1 or above recommended)

Requirements to build gcc-2.95.2 from sources:
    Long filename support (will NOT work when not available)
    DJGPP-2.03 recommended (Also 2.02 will work, but not earlier versions) 
    other GNU utilities (see below)


Changes since previous release of DJGPP port of gcc-2.95.2
==========================================================

    - wchar_t is now unsigned short int in C++ (earlier it was
      unsigned int
      
    - included patches from Mumit Khan for protoize. So I hope 
      protoize.exe and unprotoize.exe should work. But not much testing
      done. Also some my additional DJGPP related fixes there.
      
    - built with released official binary distribution of DJGPP 2.03
      (I used development sources updated from CVS earlier)
      
    - added command line option -mbnu210 which enables generation of weak
      symbols and .gnu.linkonce section. This does not work with binutils-2.8.1
      and binutils-2.9.1. You need recent development snapshot of binutils to
      use this feature (at least now: January 2000). Enabling this feature
      will fix linker problems when using static members in template classes.
	  
	  To use this please specify command line option -mbnu210 for compiler.
	  You will get errors from assembler and linker if binutils does not
	  support these features.

    - some rearangement and fixes done in gcc/config/i386/djgpp.h and  	
      gcc/config/i386/xm-djgpp.h (not visible for end user)
      
    - fixed building cross-compiler (tested only under Linux). It worked
      Ok with 2.95.1, but stopped to work with first release of port of
      2.95.2 (also not visible for users of binary archives)
    
Source archives
===============

Archive gcc2952s2.zip contains script which modifies original GCC-2.95.2
and libg++ sources for DJGPP. You don't need it unless You want to recreate
GCC source archive for DJGPP. If You are using this archive and original 
sources of gcc-2.95.2 and libg++-2.8.1.3, then You don't need gcc2952s.zip.
    
The source archive gcc2952s.zip contains all the sources to build
all compilers (C, C++, Objective C, GNU Fortran, Chill, Java) and also C++
and Fortran libraries (libstdcxx.a, libgpp.a and libg2c.a). 
I included in source archive libg++-2.8.1.3 which is not a part of gcc-2.95.2
distribution. 

Most users don't need source archives at all.

Binary archives
================

Binary archives are split into 5 parts:

  gcc2952b.zip  : The gcc.exe driver program and the C compiler.
                 It also contains the documentation.

  gpp2952b.zip  : The C++ compiler and libstdcxx.a together 
                 with needed header files 

  objc2952.zip : The Objective C compiler and libobjc.a and the needed
                 header files.

  g772952b.zip : GNU Fortran compiler and libg2c.a and g2f.h. 

  lgp2952b.zip : libg++-2.8.1.3 binary archive (needed if You want 
                 to use it). Using libg++ for new programs is not 
                 recommended as this library is no more maintained. 
		 Also this archive is for use with gcc-2.95.2 only.
	         Don't use it with other versions of gcc or egcs

The archive gcc2952b.zip is required by all other binary packages

GNU Pascal is currently not supported. You should use DJGPP port of
egcs-1.1.2 if You need GNU Pascal.


Before you install gcc-2.95.2 binaries
====================================

The DJGPP distribution of gcc-2.95.2 is now different from the one used
by gcc 2.7.x. Now the directory structure is more similar to that of
unix systems and also all the DJGPP standard directories are hardcoded
already. Similar directory structure were already used for gcc-2.8.X
and egcs-1.1.2

You should remove previous installation of gcc or egcs completely
(unless You really know what You are doing).

Make sure You don't have follwing files from earlier versions
(relative paths againt to DJGPP directory is given):
	bin/cc1.exe		(from gcc272b.zip or gcc2721b.zip)
	bin/cc1plus.exe		(from gpp272b.zip or gpp2721b.zip)
	bin/f771.exe		(from g7705XXb.zip, XX are 2 digits)
	lib/libgcc.a		(from gcc272b.zip or gcc2721b.zip)
	lib/libobjc.a		
	lib/specs		(from djdev201.zip or djdev202.zip) 

NOTE:   If You have deleted lib/djgpp.djl earlier You MUST restore
	it from djdev202.zip (or newer) or gcc-2.95.2 binaries will not
        work

Following packages are required for binaries:
	binutils-2.8.1 or above (binutils 2.9.1 or above recommended,
	but unfortunatelly are not officially released for DJGPP)

	DJGPP-2.02 (djdev202.zip) or above. DJGPP-2.03 or above recommended.
	Binaries are built using recent development version so hopefully
        new features of upcomming DJGPP 2.03 should be supported 
	(/dev/env/ , /dev/c, ...). If You are still using djdev200.zip or 
        djdev201.zip please upgrade to djdev202.zip (or above when available) 
        immediatelly.


Installing binaries of gcc-2.95.2
================================

Needed archives for different programing languages
	C 			: gcc2952b.zip

	C++			: gcc2952b.zip, gpp2952b.zip (and lgp2952b.zip,
			          if You need libg++)

	Fortran	                : gcc2952b.zip, g772952b.zip

	Pascal			: sorry but You should use DJGPP port of
                                  egcs-1.1.2 instead.

Of course for ALL languages You also need at least binutils (bnu281b.zip
or newer) and djdev202.zip or djdev203.zip (when it will be released)

Unzip all the zip files from that directory, preserving the
directory structure.  For example:

	pkunzip -d djdev203
or
	unzip386 djdev203

1. Only long filenames
----------------------

Unzip the binaries with an unzip program, which can restore the long filenames
stored in the zip archive.

2. Only short filenames
-----------------------

Unzip the binaries with an unzip program which doesn't know about long
filenames, or if your unzipper knows about them, please follow first
the steps described in the DJGPP FAQ in the section 
about setting the NameNumericTail to 0 __BEFORE__!!! unzipping the archives.

3. Long and short filenames at the same time
--------------------------------------------

Use an unzip program which can restore the long filenames and follow
the instructions under 2. when the unzipper knows about long filenames.




NOTE for users of RHIDE-1.4
============================

The name of C++ library is now libstdcxx.a instead of libstdcx.a as it was
for port of gcc-2.7.2.1. RHIDE-1.4 uses latest name by default. I included
fix (section [rhide]) in example of DJGPP.ENV file mentioned above.
An alternate way is to add line (create new file if needed). There is no 
such problem with RHIDE-1.4.5. 

RHIDE_TYPED_LIBS_DJGPP.cc=stdcxx

to file %DJDIR/share/rhide/rhide.env

Similary to use GNU Fortran from RHIDE, You should add line 

RHIDE_TYPED_LIBS.f=g2c m

to the same file (this change is needed also in RHIDE-1.4.7)




DJGPP specific hints for C++
============================

Since there are still some long filename problems which could not be solved
in an easy way, there are some tricks to get all the functionality in C++.
Especially, some headers are renamed to avoid conflicts with either each other
or with existing header files from libc.

I list here all the relevant header files and how they are named for DJGPP

Complex.h   		-> _Complex.h
String.h    		-> _String.h
Regex.h     		-> _Regex.h
iostreamP.h 		-> _iostreamP.h
stl_algobase.h 		-> stlalgobase.h
stl_hash_map.h 		-> stlhashmap.h
stl_hash_set.h 		-> stlhashset.h
stl_hashtable.h 	-> stlhashtable.h
stl_multiset.h 		-> stlmultiset.h
GetOpt.h		-> _GetOpt.h

So there are now two ways to include these headers. Either use the DJGPP
specific name or use a new feature of the preprocessor cpp. It accepts now
a new commandline switch "-remap" which tells cpp to look in a directory
for a file named "header.gcc". It takes that file as a translation
table if a requested file was not found in the directory.

I put -remap into default options for cpp so this feature is enabled 
allways. Some possible problems
	#include <String.h>
in C++ program will actually include $DJDIR/lang/cxx/_String.h but
not $DJDIR/include/string.h. You should use 
	#include <string.h>
to use $DJDIR/include/string.h. I think it's OK as mixing uppercase and
lowercase in #include statements without special need will cause unneeded
problems if You ever tried to move the program to different system (e.g.
Linux)

The DJGPP distribution of g++ and libg++ already come with these translation
files. Earlier versions of DJGPP port of gcc and egcs didn't use these tables
unless user modified the specs file. Currently for gcc-2.95.2 they are enabled. 


Rebuilding gcc-2.95.2 from the sources
====================================

Requirememts
------------

-  Long filename support is required. It means You should build gcc-2.95.2
   under Win95 or Win98. Building under WinNT using LFN driver written
   by Andrew Crabtree is not tested (and may not work)

-  Much of free disk space (perhaps 200Mb or slightly more, especially if
   You are using FAT16)

-  Many GNU packges. Please check whether You really have them:
	bsh1147b.zip 	GNU BASH 1.14.7 or above. It is recommended to use
                        bash-2.0.3 as You may have problems configuring
                        gcc-2.95.2 when DJGPP port of bash-1.14.7 is being 
                        used. Port of bash-2.0.3 is still in beta stage -
                        see http://snowball.frogspace.net/djgpp/index.html
	dif271b.zip
	fil316b.zip
	find41b.zip
	grep22b.zip
	gwk303b.zip
	mak377b.zip
	sed302b.zip
	shl112b.zip
	txt122b.zip
	txi312b.zip
	tar112b.zip
	bnu281b.zip     binutils-2.8.1 or above (tested with binutils-2.9.1 and
                        990710 snapshot of binutils). 
	working GNU C compiler (gcc281b.zip, gcce112b.zip or gcc295b.zip)

   WARNING: Use of recent binutils snapshots when configuring gcc will make 
            binaries of GCC incompatible with earlier binutils versions 
	    (2.8.1 and 2.9.1). 

   If You modify some source files You may also need
	acnf213b.zip
   You need autoconf also if You are using gcc2952s2.zip.
   However it's normally not needed for most users who builds gcc-2.95 from
   contents of gcc2952s.zip.

   Usually newer versions of these packages should also work

-  INFO-ZIP binary (compiled with DJGPP v2!!!) is needed for using build.bat 
   to create binary distrubution archives. There is no problems to compile 
   it. See http://www.cdrom.com/pub/infozip/Zip.html for additional informtion
   about INFO-ZIP. You can find DJGPP compiled binary there but I recommend
   to build it from sources. 

-  Working DJGPP installation of course (DJGPP-2.02 and above,
   binutils-2.8.1 or above, working gcc installation)
   I initially built gcc-2.95.2 using egcs-1.1.2 (later I used 
   gcc-2.95). Also gcc-2.8.1 should work. 

-  You should have sh.exe in DJGPP bin directory as symbolic link to  
   bash.exe (type 'ln -s bash.exe sh.exe' in that directory)


Directory gnu/gcc-2.952/build.cross contains script I used to build 
cross-compiler under Linux. I hope it will work also under other systems
but I haven't tested that. Following things are needed to run this 
script:
	stubify exectutable on path (from djcrx20X.zip)
	cross-binutils for DJGPP installed (target i586-pc-msdosdjgpp)
	DJGPP header files in /usr/i586-pc-msdosdjgpp/include (it may be
		symbolic link to corresponding directory on DOS partition)


Extracting the sources
----------------------

At first you should unzip the archive gcc2952s.zip. The sources are _NOT_
the complete sources like the original gcc-2.95.2 distribution. I have
removed many files to save disk space which are not needed for the DJGPP
port. However I left configuration of other machines in to make archives
usable to build cross-to-DJGPP compilers


Compiling gcc
-------------

Directory gnu/gcc-2.952 contains all sources of gcc-2.95.2 and additional
packages (currently libg++-2.8.1.3 only).

Sources are NOT configured. There are 2 main possibilities how to build
gcc-2.95.2 from sources:
	
1) change to directory gnu/gcc-2.951/build.djg and run BAT file
   	build.bat
   For this no DJGPP program should be running at that time in the
   same DOS session (eg. don't run it directly or indirectly from 
   DJGPP port of bash). It's not possible to build so large package 
   under Win9X in a single step as Win9X DPMI servers leaks many resources.
   Fortunatelly returning to command.com (including one running BAT file)
   reverts these leaks. This bat file was written to split all process
   in such parts Win95 DPMI server can take. Second reason was to
   simulate bootstraping gcc which was impossible in other way due to
   absence of fully functional symbolic links. 

   This bat file redirects output of each step to file. Use some
   program that allows to view this file from other DOS session
   to see the progress of building. 
   
2) using scripts djconfig.sh and djmake.sh which are located in the 
   same directory. 

   To configure sources run
	sh djconfig.sh [any-additional-paramter]

   After that run
	sh djmake.sh [any-additional-paramter]
   to build gcc-2.95.2. As I already mentioned building will crash some times
   due to Win95 DPMI server bugs. You may need even to remove some generated
   directory if this crash will happen in bad place.

   Don't use configure and make directly as these both scripts sets needed
   environment variables.


Installing newly compiled gcc
-----------------------------

If You are using build.bat then this step is not required as build.bat 
builds binary distribution zip archives You only need to unzip in
Your DJGPP directory

You can install newly compiled gcc by typing (You may do this after You have
built and tested libraries)

./djmake.sh install prefix=directory_where_to_install

You MUST specify prefix where to install in this command.

I recommend to install into temporary directory instead of directly into
DJGPP directory as some manual changes will be needed after this.
It is necessary to specify prefix as ./djconfig.sh uses some tricks 
to get $DJDIR hardcoded into binaries. That will prevent normal work
of ./djmake.sh install when prefix is not specified.


Things to do
============

- Make compiling gcc to work without LFN support.  Perhaps I'll
  not do this. Unfortunatelly I don't think all things will work without 
  LFN support, but at least compiling should work. Some things are already
  done but this all is not finished.



Available resources
===================

See also following URLs for additional information and sources:

gcc-2.95.2:       http://gcc.gnu.org/gcc-2.95/gcc-2.95.2.html

libg++:		  ftp://gcc.gnu.org/pub/egcs/infrastructure/




Reporting bugs
==============

If you found a bug in GCC-2.95.2 (gcc, g77, libstdc++, etc) please report it to 
the GCC bug adresses and _NOT_ (or at least not only) in the DJGPP news group. 

But if you think you found a bug in the DJGPP related things, then please 
report it in comp.os.msdos.djgpp (the news group) or mail it to 
djgpp@delorie.com, which is the gateway to the news group.

Some possible situations:
  - gcc says 'Internal compiler error' (or something similar)
       more likely it is error of gcc. It would be nice to test on some other
       system (e.g. Linux) and also with different version of compiler if 
       possible and submit report to gcc bug address
  - gcc crashes or freezes. 
       In this situation it's hard to guess where is the problem. It may be
       problem with gcc itself but it may be also DJGPP specific one
  

Please email me directly only in rare cases, if you think it is only of
interest to me, since I see the reports in comp.os.msdos.djgpp also.


  Have fun with gcc

Andris Pavenis <pavenis@lanet.lv>