aboutsummaryrefslogtreecommitdiff
path: root/coreutils-5.3.0-bin/contrib/gawk/3.1.6/gawk-3.1.6-src/README_d/README.pc
blob: 9ee2f12f181c63d36bafe7a604f35845b3b24b94 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
This is the README for GNU awk 3.1 under Windows32, OS/2, and DOS.

    Gawk has been compiled and tested under OS/2, DOS, and Windows32 using
the GNU development tools from DJ Delorie (DJGPP; DOS with special
support for long filenames under Win95), Eberhard Mattes (EMX; OS/2,
DOS, and Windows32 with rsxnt), and Jan-Jaap van der Heijden and Mumit Khan
(Mingw32; Windows32).  Microsoft Visual C/C++ can be used to build a Windows32
version for Windows 9x/NT, and MSC can be used to build 16-bit versions
for DOS and OS/2. (As of 3.1.2, the MSC version doesn't work, but the
maintainer for it is working on fixing it.)

    The cygwin environment (http://www.cygwin.com) may also be used
to compile and run gawk under Windows.  For cygwin, building and
installation is the same as under Unix:

	tar -xvpzf gawk-3.1.x.tar.gz
	cd gawk-3.1.x
	./configure && make

The `configure' step takes a long time, but works otherwise.

******************************** N O T E **********************************
* The `|&' operator only works when gawk is compiled for cygwin.  Neither *
* socket support nor two-way pipes work in any other Windows environment! *
***************************************************************************

Building gawk
-------------

Building on DOS or Windows environments can be troublesome, in part due
to shell limitations, the long filename issue, and various Windows32 pipe
considerations.  The situation is somewhat better on OS/2.  The general
recommendation is to use tools (especially make) which are compatible
or built with the compiler to be used on gawk.

Building versions which do not understand long filenames on systems
that offer long names is a special case.  The maintainers unpack the
distribution and process using utilities (unzip, make, cmp) which do not
use long filenames.  (For example, the djgpp tools will work if LFN=n is
set in the environment.)

Copy the files in the `pc' directory (EXCEPT for `ChangeLog') to the
directory with the rest of the gawk sources.  (The subdirectories of 
`pc' need not be copied.)  The makefile contains a configuration 
section with comments, and may need to be edited in order to work
with your make utility.

The "prefix" line in the Makefile is used during the install of gawk
(and in building igawk.bat and igawk.cmd). Since the libraries for
gawk will be installed under $(prefix)/lib/awk (e.g., /gnu/lib/awk),
it is convenient to have this directory in DEFPATH of config.h. 

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


Testing and installing gawk
---------------------------

The command "make test" (and possibly "make install") requires several 
Unix-like tools, including an sh-like shell, sed, cp, and cmp.  Only 
dmake and GNU make are known to work on "make test".

There are two methods for the install: Method 1 uses a typical Unix-like 
approach and requires cat, cp, mkdir, sed, and sh; method 2 uses gawk 
and batch files. See the configuration section of the makefile.

The file test/Makefile will need some editing (especially for DOS). A
sample makefile with comments appears in pc/Makefile.tst, and can be
used to modify test/Makefile for your platform.  In addition, some
files in the test directory may need to have their end-of-line markers
converted, as described in Makefile.tst.

As with building gawk, the OS, shell, and long filename issues come into
play when testing, too.  If you are testing gawk on a LFN aware system with
some LFN aware tools, you may have problems if the shell that you specify in
test/Makefile is not LFN aware.  This problem will apply whether or not
you are building a LFN aware gawk.  See the comments in pc/Makefile.tst
for more information on this.

It is routine to install by hand, but note that the install target also
builds igawk.bat and igawk.cmd, which are used to add an include
facility to gawk (and which require sh).


Notes
-----

1. Collections containing gawk and various utilities for OS/2 or DOS
include the GNUish Project, Rommel's OS/2 collection at LEO, and the 
djgpp collection.	

The GNUish Project was designed to bring GNU-like programs to small
systems running OS/2 and DOS.  Binary distributions of gawk are
maintained in GNUish, and include 16bit OS/2 and DOS, 32bit djgpp,
and Windows32 versions.  Information on GNUish is available via

  http://www.simtel.net/simtel.net/
or
  ftp://ftp.simtel.net/simtelnet/gnu/gnuish

Documentation appears in gnuish.htm (html) or gnuish.inf (info).

Kai Uwe Rommel <rommel@leo.org> maintains a (mostly OS/2) collection at 
  
   http://www.leo.org/archiv/os2  or  ftp://ftp.leo.org

It contains emx-compiled (32bit) versions of gawk for OS/2, DOS, and Windows32,
along with many OS/2 utilities.

The djgpp collection at 

   ftp://ftp.delorie.com/pub/djgpp/current/v2gnu/   

contains a djgpp-compiled (32bit) version of gawk, along with many
djgpp-compiled utilities.

The Mingw32 collection at http://www.mingw.org contains links to ported
software.  The site by Jan-Jaap van der Heijden

  http://agnes.dida.physik.uni-essen.de/~janjaap/

is apparently no longer maintained, but it was accessible as of Jan 2001
and may contain files of interest.


2. The following table illustrates some of the differences among the various
compiled versions of gawk.  For example, the djgpp version runs on all the
systems, but with differing capabilities: it supports long filenames under
Win-9x but not under NT, and it runs as a DPMI application under OS/2 (which
translates into "works in the DOS-box under OS/2, but not as a true OS/2
application").

              DOS        Win/WfW  Win9x       NT          OS/2 
	     -------------------------------------------------------
  djgpp     | DPMI       DPMI     DPMI        DPMI,NoLFN  DPMI 
  emx(1)    | N          N        N           N           OS2
  emxbnd(2) | VCPI,DPMI  DPMI     DPMI,NoLFN  DPMI,NoLFN  DPMI,OS2
  emxnt(3)  | N          N        Windows32   Windows32   N    
  msc(4)    | 16         16       16,NoLFN    16,NoLFN    16,DOS  
  msc6bnd   | 16         16       16,NoLFN    16,NoLFN    16,DOS,OS2   
  msc6os2   | N          N        N           N           16,OS2
  vcWin32   | N          N        Windows32   Windows32   N    
  mingw32   | N          N        Windows32   Windows32   N

    (1)  Requires emxrt.

    (2)  May run as a DPMI app in plain DOS and in a DOS-shell under OS/2
         or Windows, and as a true OS/2 application under OS/2.  DPMI
         requires rsxnt, and VCPI or use as an OS/2 app requires emxrt.

    (3)  Requires rsxnt. 

    (4)  When compiling, MSC 8, when run in Windows 9x, will require that if
         files are listed in #include statements with LFNs
         (eg. <patchlevel.h>), that the file be named with the LFN.

     16  16bit; limited capacity, especially under DOS.

    DOS  Runs as a DOS application.

   DPMI  Dos Protected Mode Interface; program runs as a DOS application.
         Under plain DOS, a DPMI server (such as csdpmi from the djgpp 
         archives) is required.  See also VCPI.

  emxrt  The emx runtime, available from LEO.

      N  Not supported.

  NoLFN  No long filename support.

    OS2  Runs as an OS/2 application.

  rsxnt  Runtimes for use with DPMI or Windows32.

   VCPI  Virtual Control Program Interface; program runs as a DOS app.
         Memory managers (such as emm386) may need adjustment.  VCPI cannot
         be used under OS/2, Win/WfW, Win-95, or NT.  See also DPMI.

Windows32  Uses/supports Windows32 features (such as long filenames).

Reportedly, NTEmacs (another Windows32 program) can run programs such as
Windows32-gawk asynchronously.  Similarly, as native OS/2 versions are a
plus under OS/2 even for command-line programs, native Windows32 versions
may be desired under NT and Win95.

Users interested in Windows32 applications may also wish to examine the
Cygnus cygwin project at http://sources.redhat.com/cygwin/ or the
Mingw32 work at http://www.mingw.org.  Windows32 gawk will often require
that utilities run from within gawk be Windows32 (e.g., the tests place this
requirement on the cat utility).


3.  An sh-like shell may be useful for awk programming (and is essential
for running "make test").  Stewartson's sh (OS/2 and DOS) is a good 
choice, and may be found in GNUish.

Stewartson's shell uses a configuration file (see "Command Line Building"
in the sh manual page), and it may be necessary to edit the entry for 
gawk.  The following entries are suggested:

  -- $(EXTENDED_LINE) --   -- Comment only, not part of file --
  gawk = unix ignoretype   # emxbnd
  gawk = unix              # djgpp; msc* with Stewartson's stdargv
                           # No entry for emx or for msc* without stdargv
  gawk = ignoretype        # if you want something which which always work
                           # --but without the use of @-include files.

However, users of djgpp versions of gawk may prefer "dos" over "unix"
in the above, due to the way djgpp handles @-include files.  Entries 
for other other utilities (such as sed and wc) may need to be edited 
in order to match your specific collection of programs.

Daisuke Aoyama <jack@st.rim.or.jp> has ported Bash 1.14.7 to djgpp.
This version worked flawlessly in tests with djgpp gawk and make.  bash
is now part of the djgpp collection; the older port may be found on

   http://www.neongenesis.com/~jack/djgpp-work/beta/index.html

Under OS/2, bash should be a good choice; however, there has been some
trouble getting a solid version.  As of Feb-95, there are two bash ports,
available at LEO under shells/gnu/.

LEO also contains a Korn shell (ksh), tcsh, zsh, and a demo of 
Hamilton's C shell, but these have not been tested with gawk by the 
maintainers.  Reports are welcomed.

Users of the emx versions of gawk may wish to set EMXSHELL, which 
overrides COMSPEC when running shells from emx programs.  Similarly,
the djgpp version of gawk respects SHELL.

Compatibility among shells and various utilities (including gawk)
continues to be a problem.  Stewartson's shell may be the best choice 
for emx-compiled programs (although djgpp-bash almost works with 
emx on DOS).  GNU make is recommended if using djgpp-bash.

Beginning with 3.0.4, the MSC (DOS/Windows32) and Mingw32 versions write
pipe and system() commands to a temporary file, and then execute
with SHELL or COMSPEC.  The current mechanism defaults to dos-style
shell conventions unless the shell is one of sh, bash, csh, tcsh, sh32,
sh16, or ksh.


4. GNU make is available at LEO for OS/2, in the djgpp collection
for DOS, and in the Mingw32 collection for Windows32.

dmake is by Dennis Vadura (dvadura@watdragon.uwaterloo.ca), CS
Dept., University of Waterloo.  OS/2 and DOS versions can be found as
part of the GNUish project.  Note that DOS users will need the DOS-only
version (due to the swap requirement).

Ndmake is by D.G. Kneller.  This ShareWare program was later released
as Opus Make (which is available for OS/2 and DOS).  Ndmake 4.5 is
available at

  ftp://ftp.simtel.net/simtelnet/msdos/c/ndmake45.zip


5. Stewartson's shell contains sources for a setargv-replacement
for MSC, which can add enhanced command-line processing capabilities
to gawk.  See the makefile.  Note that there is a fatal bug in 
stdargv.c, triggered in the case of no closing quote.  The following
patch treats this case as if a quote was inserted as the last
character on the command-line.

478,479c478,482
<               else
<                   spos = &spos[strlen (cpos)];
---
>               else {
>                   /* No matching quote. Fake it. */
>                   spos = cpos + strlen (cpos) + 1;
>                   break;
>               }


Known bugs
----------

1. DJGPP version 1 has known problems with signals, and in the way it 
handles command-lines.  Older versions of this file contain notes on 
other bugs, and on a few bugs uncovered in the v2 betas.  Testing of 
gawk with DJGPP v1 ended with gawk-3.0.  djgpp-2.01 and djgpp ports of 
GNU make 3.75 or later are strongly preferred, in part due to enhanced
support for sh-like shells.

2. emx does not support DST.  On 2-Jan-96, Mattes writes:

   Quotation from ISO 9899-1990:

      7.12.3.5  The strftime function
      [...]
      %Z    is replaced by the time zone name or abbreviation, or by no
	    characters if no time zone is determinable.

   As emx does not yet support DST, it does not know which one of the two
   time zones (with DST vs. without DST) applies.  In consequence, `no
   time zone is determinable'.

As a workaround, it may be possible to edit do_strftime() of builtin.c 
according to Mattes' recommendation:

   If you happen to know whether DST applies or not for a given struct
   tm, just set its tm_isdst to a positive value or to zero, respectively.
   Then, strftime() will replace %Z with the name of the time zone.

However, this probably won't yield a generic solution given that the rules
for when DST starts and stops vary depending upon your location and the 
rules have changed over time.  Most versions of UNIX maintain this 
information in a database (of sorts).  In Solaris, for instance, it can be
found in /usr/share/zoneinfo/*.  The setting of the TZ environment variable
(eg. TZ=US/Pacific) is then used to lookup the specifics for that locale.

3. The 16-bit DOS version can exhaust memory on scripts such as Henry
Spencer's "awf".  Use GNU C versions if possible. 

4. builtin.c of gawk-3.0.[1-6] triggers a bug in MSC 6.00A.  The makefile
works around the bug by compiling builtin.c without optimizations (-Od).
In limited testing, it appears that inserting some dummy code in 
builtin.c can provide a better solution than disabling optimizations.

5. There are problems with system() when using the rsx package with emx
programs (rsx is used in DPMI environments such as MS-Win).  The djgpp
versions are preferred in this case.

6. In contrast to getpid() on UNIX, the getpid() in Microsoft C/C++ 1.52
(AKA 8.0) sometimes returns negative numbers.  The DOS Gawk developers felt
that it was best to use Microsoft's built-in function; but at the same time,
we are placing this warning here, because this behavior will undoubtably be
surprising to many.

7. MSC 6 fails the strftlng test.  The funstack test exhausts memory
on the 16bit DOS versions.

8. Eli Zaretskii writes: "Make can crash with SIGFPE after finishing all
the tests.  This happens on Windows 95 only, and Gawk 3.0.3 does that as
well (as do older versions of Make).  The cause for this is the log(-1)
call in the last test.  Based on some limited testing, I'd say that the
problem is in sloppy Windows handling of the  FPU: it doesn't clean up the
FPU after a program exits, so if Make has SIGFPE unmasked, it crashes."

9. gawk built from the mingw32 and vcWin32 targets continues to have
problems with pipes; in particular, the pipeio1 test fails.

10. As mentioned above, `|&' only works with cygwin.


Gawk thanks
-----------

The DOS maintainers wish to express their thanks to Eli Zaretskii 
<eliz@is.elta.co.il> for his work and for the many conversations
concerning gawk, make, and djgpp.  His FAQ for djgpp is essential
reading, and he was always willing to answer our questions (even when
we didn't read the relevant portions of the FAQ :).

We are indebted to Juan Grigera <juan@biophnet.unlp.edu.ar> for the
Visual C++ target, and for additional help on changes for Windows32.


----
If you have any problems with the DOS or OS/2 versions of Gawk, 
please send bug reports (along with the version and compiler used) to 

   Scott Deifik, scottd.mail@sbcglobal.net (DOS versions)
or
   gawk-maintainer@unixos2.org (OS/2 version)
   Darrel Hankerson, hankedr@mail.auburn.edu

Support for Windows32 started in gawk-3.0.3.   Reports on
the Visual C++ version (vcWin32) may be sent to

   Juan Grigera, juan@biophnet.unlp.edu.ar (Visual C++ version)

with a copy to Scott Deifik.  Other Windows32 reports may go to Darrel
Hankerson.