This is the port of gcc-2.95.3 for DJGPP (this includes not only
gcc-2.95.3 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.3 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.03 or above (If You are still using djdev200.zip or djdev201.zip,
            then please upgrade immediatelly).
    binutils-2.10 or above. It's still possible to use binutils-2.8.1 or 
            2.9.1 but in this case You should use command line option
            -mno-bnu210 when compiling sources, but this is not recommended.

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


Changes since earlier releases of DJGPP port of gcc
==========================================================

    - Now gcov.exe is also available and is included in gcc2953b.zip.
      The name of file written by gcov.exe is generated by appending
      ".gcov" to name of source file. When LFN support is not available
      the name of output file is converted to be acceptable in this case:
		foo.c.gcov    ==>  foo.cgcov    ==> foo.cgc
		foo.cc.gcov   ==>  foo.ccgcov   ==> foo.ccg
		foo.cpp.gcov  ==>  foo.cpgcov   ==> foo.cpg
      Be warned that no test for overwritting existing files is performed.
      When LFN support is available no conversion is done.

    - 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 options -mbnu210 and -mno-bnu210 which 
      enables/disables generation of weak symbols and .gnu.linkonce section. 
      The default now is -mbnu210 as DJGPP port of binutils 2.10 is 
      available. To use DJGPP port of gcc-2.95.3 with old binutils 
      (2.8.1 or 2.9.1) gcc command line option -mno-bnu210 should be used.
      However I added a compiler warning that this possibility will
      not be available in next gcc versions. Specifying -mno-bnu210
      will cause problems when using static members in template classes.
	  
    - 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 under Linux only)
    
    - added script for cross-building native compiler for DJGPP 
      (tested under Linux only)

Source archives
===============

Archive gcc2953s2.zip contains script which modifies original GCC-2.95.3
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.3 and libg++-2.8.1.3, then You don't need gcc2953s.zip.
    
The source archive gcc2953s.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.3
distribution. 

Most users don't need source archives at all.

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

Binary archives are split into 5 parts:

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

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

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

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

  lgp2953b.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.3 only.
	         Don't use it with other versions of gcc or egcs.
		 (perhaps it could work with 

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


Before you install gcc-2.95.3 binaries
====================================

The DJGPP distribution of gcc-2.95.3 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 following files from earlier versions
(relative paths againt to DJGPP directory are 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.3 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.3
================================

Needed archives for different programing languages
	C 			: gcc2953b.zip

	C++			: gcc2953b.zip, gpp2953b.zip (and lgp2953b.zip,
			          if You need libg++)

	Fortran	                : gcc2953b.zip, g772953b.zip

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. To fix it 
add line 

RHIDE_TYPED_LIBS_DJGPP.cc=stdcxx

to file %DJDIR/share/rhide/rhide.env (create file if it doesn't exist)

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

RHIDE_TYPED_LIBS.f=g2c m

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

You may also download updated version of 1.4.7 from
	http://www.lanet.lv/~pavenis/rhide.html
(currently last is version 1.4.7.8)


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.3 they are enabled. 


Rebuilding gcc-2.95.3 from the sources
======================================

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

-  Long filename support is required. It means You should build gcc-2.95.3
   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:
	bsh203b.zip 	GNU BASH 2.0.3 or above. It's not recommended to
			to use bash-1.14.7 (It maybe works, but maybe not)
	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).
			One should configure gcc-2.95.3 for DJGPP using
			binutils-2.8.1 or 2.9.1 or command line option
			-mno-bnu210 will not be useable.
	working GNU C compiler (perhaps not earlier than egcs-1.1.X). 

   WARNING: It's recommended to use binutils-2.8.1 or 2.9.1. Using binutils 
            snapshots when configuring gcc (it includes bnu295?b.zip) 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 gcc2953s2.zip.
   However it's normally not needed for most users who builds gcc-2.95 from
   contents of gcc2953s.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.03 and above (2.02 may also work),
   	binutils-2.8.1 or above, 
	working gcc installation (egcs-1.1.2, gcc-2.95 or above)

-  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.953/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/sys-include (it may be
		symbolic link to corresponding directory on DOS partition)


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

At first you should unzip the archive gcc2953s.zip. The sources are _NOT_
the complete sources like the original gcc-2.95.3 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.953 contains all sources of gcc-2.95.3 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.3 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.3. 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.



Building gcc-2.95.3 from the sources as cross-compiler
======================================================

I have only tested building cross-compiler for DJGPP under i586-pc-linux-gnu
only and I don't know whether it will work on other systems.
These steps are slightly different from ones mentioned in 
	http://www.delorie.com/howto/djgpp/linux-x-djgpp.html
I used prefix=/usr. If You want to change it to for example /usr/local
then You'll have to set in corresponding scripts (and instructions below)

  - build cross-binutils (Your system to DJGPP). There is enough info
    about that at URL mentioned above.
  - build stubify and stubedit from djcrx203.zip and install them on 
    path.
  - put DJGPP header files in /usr/i586-pc-msdosdjgpp/include. I used
	mkdir /usr/i586-pc-msdosdjgpp
	ln -s /c/djgpp/include /usr/i586-pc-msdosdjgpp/sys-include
  - put DJGPP lib directory in /usr/i586-pc-msdosdjgpp/lib. I used
	ln -s /c/djgpp/lib /usr/i586-pc-msdosdjgpp/lib
  - create directory /usr/lib/gcc-lib/i586-pc-msdosdjgpp/2.95.3
  - unpack gcc2953s.zip somewhere, change to directory gnu/gcc-2.953/build.cross
    and run 
        sh build-cross.sh
  - script installs binaries in temporary directory gnu/gcc-2.953/install.cross.
    So You can move needed files to real installation place under /usr
     (I don't recommend to copy blindly all files)



Building gcc-2.95.3 as native compiler for DJGPP under Linux
============================================================

At first You should build cross-compiler from Linux to DJGPP. After completing
it change to directory gnu/gcc-2.953/build.djg and run script
	sh dj-cross.sh
If You have all needed stuff installed and there will no other problems
You'll get binary distribution ZIP archives in gnu/gcc-2.953/install.djg
after some time. Unpack them in Your DJGPP directory (on DOS partition) 
and enjoy. I built binaries of DJGPP port of GCC-2.95.3 in this way.



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

See also following URLs for additional information and sources:

gcc:		  http://gcc.gnu.org

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




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

If you found a bug in GCC-2.95.3 (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 if it is reproducible. 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.
       I didn't strip executables so there is enough info for symify
       to get stack trace when gcc crashes.

Please email me directly only in rare cases, if you think it is only of
interest to me, since I'll see the reports in DJGPP mailing list.

  Have fun with gcc

Andris Pavenis <pavenis@lanet.lv>