This is the README file for DJ's GCC port to DOS ("djgpp") Contents: * Overview * What's available * How to install * Deviations and Caveats * Copyright information Disclaimer: This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. DJ Delorie USmail: 24 Kirsten Ave, Rochester, NH 03867-2954, USA email: dj@ctron.com mailing list: djgpp@sun.soe.clarkson.edu (listserv@sun.soe.clarkson.edu) djgpp-announce@sun.soe.clarkson.edu (listserv@sun.soe.clarkson.edu) (do not send add/delete messages to djgpp or djgpp-announce) (see the file README.1ST for info on joining the mailing list) Overview: This package contains a 32-bit 80386 DOS extender with symbolic debugger, a C/C++ compiler with utilities, development libraries, and source code. It generates full 32-bit programs and supports full virtual memory with paging to disk. Requirements: A 80386-based IBM compatible PC or PS/2, 4Mb of hard drive space (70M for full install), and 512K RAM. Available extended (or expanded under VCPI) memory is strongly recommended. Supported Wares: * Up to 128M of extended memory (expanded under VCPI) * Up to 128M of disk space used for swapping * SuperVGA 256-color mode up to 1024x768 * 80387 * XMS & VDISK memory allocation strategies * VCPI programs, such as QEMM, DESQview, and 386MAX * DPMI programs, such as Windows 3.x, OS/2, and QDPMI Unsupported: * Multiprocessing (fork()) File location: host: oak.oakland.edu (and other Simtel20 mirrors) login: ftp password: send your e-mail address directory: pub/msdos/djgpp Many thanks to the Simtel20 people for allowing djgpp to be part of their archives! NOTE: In accordance with FSF CopyLeft, you are not allowed to upload this program to a distribution site unless you upload the source modules with any binary module you upload. Please read the file COPYING for more details. NOTE: If your application links in object modules that were written by FSF, your application counts as a "derived work" and must obey the provisions of the FSF Copyrights. See the file COPYING for details. All FSF source-based libraries are in the file libgpl.a and libgpp.a. The mere act of compiling does not affect the copyright status of your program. INSTALLING: To install, you must do the following: * Create a "temp" directory, like c:\tmp. * Create a directory to install in, like c:\djgpp. * Un-zip the appropriate zipfiles in the install directory. C:\DJGPP> unzip -o djeoe112.zip (Minimum runtime stuff - required) C:\DJGPP> unzip -o djdev112.zip (Minimum development stuff - required) C:\DJGPP> unzip -o gcc257bn.zip (The C compiler - required) C:\DJGPP> unzip -o gas211bn.zip (The assembler - required) C:\DJGPP> unzip -o bnu22bn.zip (The linker etc - required) C:\DJGPP> unzip -o djdoc112.zip (If you want documentation) C:\DJGPP> unzip -o txi210bn.zip (If you want the online doc reader INFO.EXE) C:\DJGPP> unzip -o gpp257.zip (If you want to compile C++) C:\DJGPP> unzip -o objc257.zip (If you want to compile Objective-C) C:\DJGPP> unzip -o bsn121bn.zip (If you want to use bison) C:\DJGPP> unzip -o flx238bn.zip (If you want to use flex) C:\DJGPP> unzip -o gzp124bn.zip (If you want gzip) C:\DJGPP> unzip -o dj112m1.zip (Maintainence releases) The maintainance releases are numbered dj112m1.zip, dj112m2.zip, etc. Install them all, in order, after all other modules. If you prefer to use pkunzip, use "pkunzip -d -o" instead of "unzip -o". Note: The file "unzip386.exe" is available from where you got djgpp. It is Info-Zip's unzip built with djgpp, and includes a built-in copy of go32.exe. Other .zip files contain various documentation (*dc.zip) and source files (*sr.zip, *s1.zip, etc). * If you are installing over an existing djgpp area, make sure you remove the files bin/aout2exe.exe and bin/exe2aout.exe. They have been replaced with coff2exe and exe2coff. Also, some programs may not work correctly if using an old version of go32 and/or an old emu387, so be sure to remove any old versions of these files. * Add the following lines to C:\CONFIG.SYS file (or edit existing files= and shell= lines as appropriate). The files= line prevents "too many open files" errors when compiling, and the shell= line prevents "Out of environment space" errors when setting lots of environment variables. files=15 shell=c:\command.com c:\ /e:1000 /p The values 15 and 1000 are close to minimal. You may want to increase them to provide a little more margin. * Add the following lines to C:\AUTOEXEC.BAT: set DJGPP=c:/djgpp/djgpp.env * Optionally, add these lines: set TMPDIR=c:/tmp ^^^ this is where gcc's temp files go. It should be a ramdrive if you have one. set GO32TMP=c:/tmp ^^^ this is where your paging file goes - if not set, the variables TMP and TEMP are checked in that order. This should be a real drive. set GO32=driver c:/djgpp/drivers/SOMETHING.grd gw 1024 gh 768 ^^^ whatever driver works with your VGA (optional) Remember that unless you manually type these at the command line, they won't take effect until you reboot. Don't include the "ansi" keyword in the "go32" variable if you don't have an ANSI.SYS driver or equivalent. * Add your binaries directory to your PATH in C:\AUTOEXEC.BAT SET PATH= . . . ;c:\djgpp\bin That's it! djgpp is now installed on your system. To try it out, change into the samples/hello directory of the DJGPP distribution and type "tryit". If this doesn't work, run "testit", which will check things out for you. Note: For some operating systems, such as OS/2 and NT, you may need to use the 16-bit gcc driver instead of the 32-bit gcc driver. To do so, copy the gcc.exe file from utils/gcc-rm/gcc.exe to bin/gcc.exe. Don't forget to save the old gcc.exe first! About the environment If you set the DJGPP environment variable to point to a file, that file will be used to load the environment. There is a djgpp.env file distributed with djgpp that provides most of the values you need. The format of the file is like this: VAR=value VAR=value [program] VAR=value [prog2] VAR=value Note that all whitespace is preserved, so be careful about trailing spaces and spaces around the `='. Variables in the first section (before any [program] lines) apply to all programs. Variables in program-specific sections are loaded only when running that program. For example, a [gcc] section would have variables that gcc.exe needs. Values may refer to other variables using the DOS convention, like %DJGPP%. In addition, the first characters after the `%' can be used to process the value before using it. These syntaxes are allowed: %variable% Take the value as is %:variable% Take the directory portion only %;variable% Append with a semicolon if variable is defined %/variable% Replace all `\' with `/' %\variable% Replace all `/' with `\' %variable% Convert to lower case You may list multiple characters after the %, but they must be before the variable name, like %:/>DJGPP%. Variable names are case sensitive. The DOS environment variable names are usually upper case. Variables set through this file override any set in the DOS environment, unless the first character of the variable name is `+', in which case the DOS environment overrides the file (the `+' is removed from the name), as in `+USER=dosuser'. The GO32 environment variable: This variable controls the options available in go32. The syntax of this variable is: SET GO32=[parm [value]] [parm [value]] . . . Parameters: ansi Use ANSI commands to control the color in edebug32 mono Use the Monochrome monitor for debugging - useful when debugging graphics applications topline Display status information on the top line of the screen (or the top of the mono monitor) 1rm Redirect stdout (file #1) to the monochrome monitor 2rm Redirect stderr (file #2) to the monochrome monitor 1r2 Redirect stdout (file #1) to stderr (file #2) 2r1 Redirect stderr (file #2) to stdout (file #1) nodpmi don't use dpmi even if you find it. core [file] append exception traceback to the named file. glob enable globbing (default) noglob disable globbing emu [path] Use the specified file as the 80387 emulator driver [path] Use the specified file as the graphics driver gw [width] Default graphics width gh [height] Default graphics height tw [width] Default text width th [height] Default text height nc [colors] Number of colors (for new-style drivers only - see cbgrx*.zip) These parameters may occur in any order. Note that "1rm" and "2rm" are done before "1r2" and "2r1", so "1rm 2r1" sends stdout to the mono monitor and stderr to any redirection used. Examples: C:\> set GO32=mono driver c:\djgpp\drivers\tseng4k.grd gw 1024 gh 768 tw 132 th 43 nc 256 C:\> set GO32=ansi C:\> set GO32=driver c:\djgpp\drivers\tseng4k.grd ansi C:\> set GO32=mono 1rm 2rm nodpmi topline Debugging: To debug your code, compile with "gcc -g". Then, run the executable with a line like this: C:\> go32 -d edebug32 myprog (for non-DPMI) C:\> go32 -d ed32-dpmi myprog (for DPMI) See the docs/djgpp/edebug32.doc file for information on edebug32 commands. Deviations and Caveats: GCC/G++ deviates from the U**x version in a number of ways, mostly to accomodate deficiencies in the MS-DOS environment, and my own laziness. * An 80387 is required to do floating point. An emulator is provided. cc1 and cc1plus shouldn't use the 387 unless compiling floating point code. The environment variable "387" can override the auto-detection routine: SET 387=YES to force 387 handlers to be enabled SET 387=NO to force 387 accesses to fault SET 387=QUERY to get a message showing the results of the auto-detection If no 80387 is present and the program attempts to use it, a message indicating where the instruction is will be displayed. To use the 387 emulator, add "emu c:\djgpp\bin\emu387" to the GO32 environment variable. Specifying use of the emulator overrides the "387" environment variable and autodetection code. * The VDISK method of allocating extended memory is supported. The INT 15h method is also. When the extender runs out of conventional and extended memory, it uses a paging file named $(GO32TMP)/pgXXXXXX.386, where XXXX is an unspecified hex value. This file is normally removed on exit. * Up to 128 MB of physical memory and 128 MB of disk swap space are allowed. A 512K machine is sufficient, but very slow due to paging. * The utilies support the MS-DOS standard response file method for giving more than 128 bytes of command line. Example: "gcc -o foo @foo.lnk" where foo.lnk contains a list of .o files. Wildcard expansion (globbing) is performed on the parameters, unless they are surrounded by quotes. Quotes can be used to prevent spaces from separating arguments, much like Unix. Also supported is the GNUish-DOS method of passing arguments in environment variables. * Since MS-DOS does not distinguish case in file names, some .h files used for C++ have had underscores prepended to them to avoid conflict (ie: String.h conflicts with string.h, so it became _String.h). * The extender can be merged to create one .exe file that is the extender and the executable in one file, by using the stub.exe program: coff2exe myprog (this merges stub.exe, and go32.exe is still required) coff2exe -s go32.exe myprog (this merges go32.exe) The first case will only work if go32.exe is in your search path, because stub.exe runs it. Alternatively, you can prepend go32.exe itself to an COFF file to get a single executable (stub.exe is much smaller). Note that if you re-compile go32 or stub, you must strip off the symbol table first. Also note that coff2exe is designed to align the executable image for better performance, so coff2exe'd programs will run faster than those built with copy /b. * The extender runs programs at logical address 0. A copy of the first 1 MB of physical memory (including the AT channel) is mapped to 0xE0000000 in the program's address space. The stack grows down from 0x7FFFFFFC in the program's address space. These numbers will be different under DPMI. You should use or dosmemget/dosmemput to access DOS memory portably. * The paging mechanism understands how SuperVGA's map their memory onto the AT bus and automatically swaps pages as the program tries to access them. The program sees a linear range from 0xD0000000 to 0xD0100000 that corresponds to each pixel in the 256-color modes of SuperVGAs. To use this feature, you'll have to set the GO32 environment variable like this: C>set go32=driver c:\djgpp\drivers\tseng4k.grd gw 640 gh 480 tw 132 th 43 These parameter pairs can be omitted or rearranged as needed. They are the "driver" name, default graphics width and height, and default text width and height. Libgr.a doesn't have to be recompiled, nor do graphics programs, when a different graphics mode is selected (the extender handles it). It is strongly recommended that the program use the GR_default_graphics and GR_default_text modes to switch to graphics or text. These modes use the parameters specified by the GO32 environment variable, allowing the user to select a favorite graphics and text mode. Note that this isn't available in DPMI. * Signals are not reported to the program. However, interrupts do continue to get serviced while in protected mode (ie: keypress, timer, etc). CTRL-C will get you back to the external debugger, and you can continue from where you stopped. All signals (ie: exceptions) cause debugging traps in the external debugger, or general faults in go32. Copyright Information: * Source code for the GNU utilities is copyright (c) Free Software Foundation. For more information on the FSF copyright, see their source code or write Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. A copy of their file "COPYING" is included in the docs directory. Some of the FSF source code has been modified to operate properly in the MS-DOS environment. * Source code for most of libc.a are copyright (c) Regents of the University of California. These files include copyright information in them. The utilities are compiled against these libraries, and thus contain software developed by the University of California, Berkeley, and its contributors. Some of the BSD source code has been modified to operate properly in the MS-DOS environment. * Any sources not falling under the copyrights of FSF or UCB (as above) are Copyright (c) 1991 DJ Delorie, 24 Kirsten Ave, Rochester NH 03867-2954. To contact me via E-Mail, sent to "dj@ctron.com". Cabletron Systems Inc is in no way involved with this project; I just happen to work for them during the day. Terms and Conditions: * Source code copyright FSF is distributed under the terms of the GNU Public General License. See the file "COPYING" in doc.arc for more information. If your program links in object modules (in libgpl.a) that are compiled from GNU sources, then your entire program must be distributed under the terms of the GNU GPL as a "derived work". These modules are the C++ class library (including the streams classes) and obstacks, and are restricted to the libgpl.a and libgpp.a libraries. The sources in libsrc have the copyright notices in them for the various modules. * Source code copyright UCB is distributed under the terms listed in the UCB source code itself. * Source code copyright DJ Delorie is distributed under the terms of the file "copying.dj". * Changes to source code copyright BSD or FSF are copyright DJ Delorie, but fall under the terms of the original copyright. Donations may be made to any of the following: DJ Delorie 24 Kirsten Ave Rochester, NH 03867-2954 USA Free Software Foundation 675 Mass Ave Cambridge, MA 02139 USA Computer Systems Research Group Computer Science Division, EECS University of California Berkeley, California 94720 USA