This is the port of egcs-1.1.2 for DJGPP (this includes not only
egcs-1.1.2 but also following additional packages: libg++-2.8.1.3 and
GPC-19990118). It comes as usual in different zip-archives for the 
sources and the binaries.


##############################################################################
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 egcs-1.1a 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
    binutils-2.8.1 or above (2.9.1 or above recommended)
##############################################################################
Requirements to build egcs-1.1.1 from sources:
    Long filename support (will NOT work when not available)
    DJGPP-2.02 or above 
    other GNU utilities (see below)
##############################################################################

The source archive egcs111s.zip contains all the sources to build
all compilers (C, C++, Objective C, GNU Fortran, GNU Pascal) and also C++
and Fortran libraries (libstdcxx.a, libgpp.a and libf2c.a). 
I included in source archive libg++-2.8.1.3 and sources of latest GNU Pascal 
beta version which are not a part of egcs-1.1.2 distribution. 

NOTES: LFN support is required to build egcs-1.1.2 (and additional included 
       packages) from sources 

LFN support is not required to use the binaries but it IS REQUIRED to build
egcs-1.1.2 and additional packages included in source archive

But the binary archives are split into 5 parts:

  gcce112b.zip : The gcc.exe driver program and the C compiler.
                 It also contains the documentation.
  gppe112b.zip : The C++ compiler and libstdcxx.a together 
                 with needed header files 
  objce112.zip : The OBJC compiler and libobjc.a and the needed
                 header files.
  g77e112b.zip : GNU Fortran compiler (version 0.5.24) and libg2c.a
                 and g2f.h. 
  gpce112b.zip : GNU Pascal (beta 19990118) binaries
  lgpe112b.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. 

The archive gcce112b.zip is also required by gppe112b.zip, objce112.zip
and g77e112b.zip, gpce112b.zip.


Current problems
================

 -  Building from sources requires LFN support. I don't know when (or if)
    this could change.
 -  Beta version of GNU Pascal compiler is used. You may need additional
    packages to use some units included with GPC. See GPC related
    URLs for more info and required files.


Before you install egcs-1.1.2
============================

The DJGPP distribution of egcs-1.1.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

If the previos version of gcc You used were gcc-2.7.2.1 (or 2.7.2) You
MUST remove old gcc installation completely, especially the compilers
(cc1.exe, cc1plus.exe ...) and libgcc.a from directory $DJDIR/lib, 
because they will not overwritten by the new distribution. You will have 
such files if previous gcc version were 2.7.2.  You can omit this step 
if previous version were gcc-2.8.X or egcs-1.1 (however it's recommended
unless You are going to use also old version)

You should avoid having following files in $DJDIR/lib:
	specs, libgcc.a, libobjc.a, libgpc.a
and following files in $DJDIR/bin:
	cpp.exe, cc1.exe, cc1plus.exe, cc1obj.exe, f771.exe, gpc1.exe.

Archive gcce111b.zip comes with files specs and djgpp.djl (directory 
lib/gcc-lib/djgpp/egcs-291.63) which are different from similar files
in lib that comes with archive djdev202.zip. You should remove specs
file from djdev202.zip (%DJDIR%/lib/specs).

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)

NOTE for users of GNU Pascal
============================

GNU Pascal requires additional packages for some units. 
It is beta versions so You are on Your own. I haven't seriously tested it.


How to install the binary archives?
===================================

Install them like any other DJGPP binary archive:

- change to your DJGPP base directory (often c:/djgpp) and unzip
  there the archive

  unzip gcce112b.zip

  (if you are using PKUNZIP, remember to use the -d switch!!)

and that's all.

Installing under Windows 95
===========================

If you want to install and use gcc under Windows 95, you should remember
that this OS can handle long and case sensitive filenames. Here are
three cases:

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.


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

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.

The DJGPP distribution of g++ and libg++ already come with these translation
files, but they are currently not used. To use them, you have to modify your
specs file to add the "-remap" switch to the call for cpp, since this switch
cannot passed to cpp from the gcc comanndline. Here is a possible line
from the spec file in your lib/ directory:

*cpp:
-remap %{posix:-D_POSIX_SOURCE}

Exception support under DJGPP 
=============================

With djdev202.zip there is no need to do anything to get exceptions working.

If djdev201.zip is being used situation is more complicated. I didn't 
provide files that were included in DJGPP port of gcc-2.8.1 for that
purpose. Following steps are necessary:
   - take crtf.o from gcc-2.8.1 binary distribution (gcc281b). gcc281b
     contains also source (crtf.c) so You can recompile it however I
     think it is not needed. crtf.o should be copied to directory
   - specs file should be modified to provide linking crtf.o

Rebuilding gcc from the sources
===============================

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

To build gcc you need many GNU utilities installed. This includes at the
very least bash and a symlink sh to it.  
********
To get it, change to the DJGPP bin directory and type there

ln -s bash.exe sh.exe
********

You need LFN support to build
egcs-1.1.2 from current sources (don't even try to do this when 
LFN support is not available, this will not work).

I built egcs using djdev202.zip

Because it is really not possible for me to check for any needed program
I include here only a list of packages which you will need at least:

- fil316b.zip
- find41b.zip
- grep20b.zip
- gwk303b.zip
- mak377b.zip
- sed302b.zip
- shl112b.zip
- txt122b.zip
- txi312b.zip

I configured gcc and libraries with autoconf-1.13 and automake-1.4 installed.
However they should not be needed if configuration files are not modified.

And you need also much free disk space, when you build without
debugging information. I think 120 Mb free space before unpacking
source archive could be good approximation.

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

At first you should unzip the archive egcs11s.zip. The sources are _NOT_
the complete sources like the original egcs-1.1a distribution. I have
removed many files to save disk space which are not needed for the DJGPP
port. I changed also directory structure of source archive as building
gcc simultanously with libraries did not work under DJGPP.

Therefore sources are split into 2 directories: gcc and libs
    - directory gcc contains sources of gcc
    - directory libs contains sources of C++ and Fortran libraries.

There are 2 steps necessary to compile egcs for DJGPP
    - compile gcc
    - compile libraries with newly compiled gcc (previously built
        binaries of gcc is being used, no more need to install them
        before compiling libraries)


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

Directory gnu/egcs-1.12/gcc contains sources of gcc and should be
built before libraries. gcc sources are already configured, but if you 
want to reconfigure them, please use _ONLY_ the script file 'djconfig.sh'
instead of running the configure script, since it does some 
tricks before running configure. (Read the comments inside this file!!).
This file is in directory gnu/egcs-1.12/gcc/build.djg. To run it you 
must have bash installed and a symlink sh.exe to bash.exe.

I configured compiler sources to be compiled in directory gcc/build.djg. 

Then to run the djconfig.sh script type there

sh djconfig.sh [any-additional-paramter]


Another script 'djmake.sh' must be used used instead of simply make. 
As above: Please use _ONLY_ this script instead of running a simple make 
(unless of course you know what you're doing).

Now you run make by typing

sh djmake.sh [any-additional-paramter]

as replacement for

make [any-additional-parameter]


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

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

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.


Compiling in another directory
-------------------------------

I configured gcc to be compiled in directory build.djg. To change this
directory you should move its contents to the desired location and modify
both scripts (djconfig.sh and djmake.sh) to set the exact path to sources.
After that, you can use these scripts as described above.


Building C++ and Fortran libraries
==================================

Directory gnu/egcs-1.1a/libs contains sources of C++ and Fortran libraries
and will be built using previously compiled version of gcc.
Sources are already configured, but if you want to reconfigure them, 
please use _ONLY_ the script file 'djconfig.sh' instead of running the 
configure script, since it does some tricks before running configure. 
(Read the comments inside this file!!). This file is in directory 
gnu/egcs-1.1a/libs/build.djg. To run it you must have bash installed 
and a symlink sh.exe to bash.exe.

I configured libraries to be compiled in directory libs/build.djg. 

Then to run the djconfig.sh script type there

sh djconfig.sh [any-additional-paramter]


Another script 'djmake.sh' must be used used instead of simply make. 
As above: Please use _ONLY_ this script instead of running a simple make 
(unless of course you know what you're doing).

Now you run make by typing

sh djmake.sh [any-additional-paramter]

as replacement for

make [any-additional-parameter]


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

- Make compiling egcs to work without LFN support. It is significant not
  break things similary as it was done with port of gcc-2.8.1. Perhaps I'll
  not do this. Unfortunatelly I don't think all things will work without 
  LFN support, but at least compiling should work.



Patching original egcs sources to be used with DJGPP
====================================================

- This is newest and perhaps less tested part of source archive. I included
  shell script that creates sources usable with DJGPP in directory 
  gnu/egcs-1.1a/contrib. To get sources for DJGPP following steps
  should be done:
    1) unpack original sources of egcs
    2) unpack original sources of libg++ (move them to get subdirectories
       libg++ and librx under main egcs directory). I used 
       libg++-2.8.1.2a-19981114 (You may have problems with 
       './djmake.sh install' with different versions)
    3) change to main egcs directory and run patching script
            ../contrib/egcs-patch.sh
    4) in directory gcc/build.djg:
            - run './djconfig.sh'
            - run './djmake.sh cstamp-h.in' (You need patched autoheader, see 
                                              patch below)
            - run './djconfig.sh once more' 
    5) in directory libs/build.djg:
            - run './djconfig.sh'
            - run './djmake.sh configure-target-libiberty \
                configure-target-libio configure-target-libstdc++ \
                configure-target-libg++ configure-target-libf2c'
            - run './djmake.sh clean' if You intend o make distribution archive
               (otherwise You can skip this)
            - after that You can make source archive for DJGPP (some cleanup
              of directory texinfo can be done before). 

  This steps to build source distribution of egcs for DJGPP work 
  work also for PGCC (and may work also for next minor releases of egcs maybe 
  with some minimal modifications of patching script). With PGCC it will be
  necessary to modify some patches in patching script.


Installing newly compiled libraries
------------------------------------

You can install newly compiled libraries by typing

./djmake.sh install prefix=directory_where_to_install

I recommend to install into temporary directory instead of directly into
DJGPP directory as some manual changes will be needed after this.
Unfortunately this fails for libg++.

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

See also following URLs for additional information and sources:

egcs-1.1.2:       http://egcs.cygnus.com/egcs-1.1/egcs-1.1.2.html
		  ftp://egcs.cygnus.com/pub/egcs/releases/egcs-1.1.2/

libg++:		  ftp://egcs.cygnus.com/pub/egcs/infrastructure/

GPC:		  http://home.pages.de/~GNU-Pascal/
		  ftp://agnes.dida.physik.uni-essen.de/gnu-pascal/beta/
		  ftp://agnes.dida.physik.uni-essen.de/gnu-pascal/
		  ftp://kampi.hut.fi/jtv/gnu-pascal/
 


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

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

If You find a bug in GPC, please report it to GPC mailing list <gpc@hut.fi>. 

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 egcs 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.


Thanks
=======

Mark Elbrecht - patches to collect2.exe to get -frepo working
Peter Gerwinski - help with GPC
Laszlo Molnar - found why exceptions didn't work reliably with previous
		DJGPP binaries of egcs. So it was possible to fix the problems
and of course all who participates in egcs development


  Have fun with egcs and GPC,

Andris Pavenis <pavenis@lanet.lv>

----------------------------------------------------------------------
patch to autoheader. Nedeed ONLY if you need to run autoheader under 
Windows 95. Normally this is NOT NEEDED to build gcc unless you modify 
Configure.in
-----------------  patch to autoheader  ------------------------
*** autoheader~	Wed May 14 17:33:34 1997
--- autoheader	Tue Mar 24 15:03:18 1998
***************
*** 261,266 ****
--- 261,267 ----
  fi
  
  if test $# -eq 0; then
+   exec 2>&1 
    if test $status -eq 0; then
      if test -f ${config_h_in} && cmp -s $tmpout ${config_h_in}; then
        rm -f $tmpout # File didn't change, so don't update its mod time.
----------------------------------------------------------------
