Node:PC Compiling, Next:, Previous:PC Binary Installation, Up:PC Installation



Compiling gawk for PC Operating Systems

gawk can be compiled for MS-DOS, Win32, and OS/2 using the GNU development tools from DJ Delorie (DJGPP; MS-DOS only) or Eberhard Mattes (EMX; MS-DOS, Win32 and OS/2). Microsoft Visual C/C++ can be used to build a Win32 version, and Microsoft C/C++ can be used to build 16-bit versions for MS-DOS and OS/2. The file README_d/README.pc in the gawk distribution contains additional notes, and pc/Makefile contains important information on compilation options.

To build gawk for MS-DOS, Win32, and OS/2 (16 bit; for 32 bit (EMX) see below), copy the files in the pc directory (except for ChangeLog) to the directory with the rest of the gawk sources. The Makefile contains a configuration section with comments and may need to be edited in order to work with your make utility.

The Makefile contains a number of targets for building various MS-DOS, Win32, and OS/2 versions. A list of targets is printed if the make command is given without a target. As an example, to build gawk using the DJGPP tools, enter make djgpp.

Using make to run the standard tests and to install gawk requires additional Unix-like tools, including sh, sed, and cp. In order to run the tests, the test/*.ok files may need to be converted so that they have the usual DOS-style end-of-line markers. Most of the tests work properly with Stewartson's shell along with the companion utilities or appropriate GNU utilities. However, some editing of test/Makefile is required. It is recommended that you copy the file pc/Makefile.tst over the file test/Makefile as a replacement. Details can be found in README_d/README.pc and in the file pc/Makefile.tst.

To build gawk for OS/2 (32 bit, EMX), there are three possibilities:

  1. Using the configure script included in the official gawk distribution. configure need not be recreated but a number of restrictions exist when using this choice:

  2. Using a special version of Autoconf 2.13 for OS/2 to recreate configure. Not tested. In principle this should work but the same restrictions apply as in 1, but the environment variables CC, AWK, LDFLAGS and RANLIB are not necessary.
  3. Using Autoconf 2.5x to recreate configure (2.52f or higher recommended). Some patches must be applied to Makefile.am and test/Makefile.am and po/Makefile.in.in. Currently not supported.

Note: Even if the compiled gawk.exe executable contains a DOS header (a.out format), it does not work under DOS. To compile an executable that runs under DOS, CPPFLAGS must be set to "-DPIPES_SIMULATED". But then some nonstandard extensions of gawk (e.g., |&) do not work!

After compilation the internal tests can be performed. Enter make check CMP="diff -a" at your command prompt. All tests but the pid test are expected to work properly. The pid test might or might not work, no idea why.

Note: Most OS/2 ports of GNU make are not able to handle the Makefiles of this package. If you encounter any problems with make try GNU make 3.79.1. You should find the latest version on ftp://ftp.unixos2.org.