1README.LynxOS
2=============
3
4Written by Ronald F. Guilmette <rfg@monkeys.com>
5
6Last modified Wed Aug 14 23:10:07 PDT 1996
7------------------------------------------
8
90. Introduction
10---------------
11
12This file describes how to build and install the Berkeley nvi editor for
13the LynxOS 2.4.0 operating system.
14
15LynxOS 2.4.0 is available for a variety of different hardware platforms, in
16particular, x86, m680x0, Sparc, and PowerPC.  I have successfully built nvi
17on all four of these flavors of LynxOS by following the procedures given in
18this file.
19
20Note that these procedures may not work on versions of LynxOS prior to 2.4.0.
21(As I understand it, a good deal of work went into making the 2.4.0 release
22more POSIX-compliant, and I have no idea what build glitches, if any, you
23might encounter if you try to build nvi on a pre-2.4.0 version of LynxOS.)
24
25There are basically four steps to configuring, building, and installing nvi
26on LynxOS, namely:
27
28	1.  Get setup to use the proper C compiler.
29	2.  Replace your installed `tr' program.
30	3.  Fix your system include files.
31	4.  Do a normal configure, build, and install of nvi.
32
33These steps are described in separate sections below.
34
351.  Get Setup to Use the Proper C Compiler
36------------------------------------------
37
38The first step when building nvi on LynxOS is to set your $PATH environment
39variable properly so that the gcc 2.x compiler appears first on your path,
40prior to the older (and less robust) gcc 1.xx compiler (typically installed
41as /bin/gcc) and/or the old Lynx proprietary C compiler (typically installed
42as /bin/cc), both of which may also be present on your system.
43
44Note that for most operating systems, the configure script for nvi tries
45to use whatever compiler you have installed (and in your $PATH) as "cc",
46however in the special case of LynxOS, the configure script will auto-
47matically try to find a "gcc" program on your $PATH in preference to a
48compiler called "cc".  If the nvi configure script only find a compiler
49called "cc", that's OK.  It will still try to see if that is really just
50the GNU C compiler installed under the name "cc".
51
52Regardless of the name however (be it "gcc" or "cc") the first C compiler
53in your $PATH should be some _recent_ (i.e. 2.0 or later) version of the
54GNU C compiler... and the nvi configure script now checks that this is the
55case, and fails if it isn't.
56
57Oddly enough, LynxOS 2.4.0 (and some prior versions) shipped with as many
58as three different C compilers installed, so it is important to set your
59$PATH environment variable carfully in order to get the proper C compiler
60to appear first in your $PATH.  You want to avoid having either the /bin/gcc
61compiler or the /bin/cc compiler be the first C compiler in your $PATH.
62
63To make sure that the GNU C version 2.x compiler which was shipped with your
64LynxOS system appears first on your path, you will need to either set your
65$PATH variable (for sh/bash/ksh users) or your $path variable (for csh/tcsh
66users).  You can, of course, just do this at the shell command prompt, but
67it is probably better to actually edit this change into your .profile file
68(for sh/bash/ksh users) or into your .cshrc file (for csh/tcsh users).
69
70The pathname of the directory that contains the GNU C version 2.x compiler
71is (unfortunately) dependent upon the exact type of LynxOS system you have.
72
73For LynxOS 2.4.0 on x86 systems, gcc 2.x is located in:
74
75	/cygnus/94q4-lynxos-x86/bin
76
77For LynxOS 2.4.0 on m680x0 systems, gcc 2.x is located in:
78
79	/cygnus/94q4-lynxos-68k/bin
80
81For LynxOS 2.4.0 on Sparc systems, gcc 2.x is located in:
82
83	/cygnus/94q4-lynxos-usparc/bin
84
85For LynxOS 2.4.0 on PowerPC systems, gcc 2.x is located in:
86
87	/cygnus/95q2-lynxos-ppc/bin
88
89(Note also that these locations may change in LynxOS 2.5.x and beyond.)
90
91Anyway, it is imperative that you setup your $PATH environment variable
92(*before* you do the configure step for nvi) so that the GNU C version 2.x
93compiler appears in your $PATH before either the /bin/cc or /bin/gcc
94compilers (if present).  If you fail to do this, the configure step for
95nvi will fail, because the compiler script actually checks (now) that the
96compiler you are using (if your are on a LynxOS system) is gcc 2.0 or
97later.
98
99To make absolutely sure that you will be configuring and building nvi with
100the proper C compiler (i.e. the GNU C version 2.x compiler on your system)
101you should add the directory name listed above for your specific system type
102to your $PATH setting in your $HOME/.profile file.  (For csh/tcsh users, you
103will instead want to add the relevant directory name to the setting of your
104$path variable in your ~/.cshrc file.)  Once you have added the proper direc-
105tory name (from the list given above) to your $HOME/.profile file (or to your
106~/.cshrc file, if you are using csh or tcsh) you should log out completely
107and then log back into the system just to make sure your new $PATH/$path
108setting takes effect properly.
109
110When you finish making this adjustment to your $PATH (or $path), the most
111up-to-date version of gcc on your system should be available to you as the
112first `gcc' program on your $PATH.  You should verify that this is indeed the
113case simply by typing `gcc -v' and then checking the version number reported
114by the compiler.  It should say either "2.6-94q4" or (on PowerPC systems) it
115should say "2.6-95q2".  If you don't get these results, try again to set your
116$PATH (or $path) until you do.  You won't be able to build nvi until you are
117properly setup to use gcc version 2.0 or later.
118
119Performing the steps shown above will insure that your subsequent configura-
120tion and build steps for nvi will make use of the most up-to-date version of
121gcc that was shipped with your Lynx operating system.  (Note that the versions
122of gcc which are currently shipping with LynxOS 2.4.0 are also somewhat out-
123of-date themselves, but they are still quite a bit newer and more bug-free
124and ANSI conformant that those other two C compilers, /bin/cc and /bin/gcc,
125which also ship with LynxOS 2.4.0.)
126
127(Note:  At present, LynxOS version 2.4.0 is the latest officially released
128version of LynxOS, and all of the above information is accurate and correct
129for LynxOS 2.4.0 as of the time of this writing.  However it is rumored that
130future releases of LynxOS may provide a still newer version of gcc, and that
131it may be located in the /usr/bin directory.  Thus, if you are building nvi
132for some LynxOS version later than 2.4.0, you may wish to check and see if
133your system has a program called /usr/bin/gcc, and use that version of gcc,
134if available, rather than the one suggested above.)
135
1362.  Replace Your Installed `tr' Program
137---------------------------------------
138
139The `tr' program which comes bundled with LynxOS 2.4.0 (as /bin/tr) has a
140somewhat obscure bug which just happens to be tickled by almost all GNU
141`autoconf' generated `configure' scripts (including the one that nowadays
142comes bundled with nvi).  Using the stock /bin/tr program on LynxOS when
143executing such `configure' scripts _will_ cause these scripts to malfunction
144in various ways.  It is therefore imperative that you replace your LynxOS
145/bin/tr program with a properly working version of the `tr' command _before_
146you even try to configure nvi.  (You can tell if your `tr' program has the
147bug by executng the command "echo ab- | tr ab- ABC".  If this yields the
148string "Ab-" then you have the bug.  If it yields "ABC" then you don't.)
149
150You can obtain sources for a working version of the `tr' command as part of
151the GNU `textutils' package (the latest version of which, at the time of this
152writing, is 1.19).  The GNU textutils package is available for downloading
153from prep.ai.mit.edu in the pub/gnu directory.  Look for the file named
154textutils-1.19.tar.gz, or an even more recent version of textutils, if one
155is available.  Fetch it, gunzip it, untar it, and follow the directions in
156the INSTALL file included in the tar file to build and install the entire
157textutils set of utility programs (which includes a working `tr' program).
158Then just make sure that the GNU version of `tr' appears on your $PATH
159_before_ the LynxOS version of `tr' (i.e. /bin/tr).  Be sure to do this
160step _before_ you start to configure nvi.
161
162When building the textutils set of programs, I suggest that you use the most
163up-to-date C compiler available on your system (as described above).  Also,
164note that it will be important for you to AVOID using the -O (optimize)
165compiler option when building the GNU textutils package, even if you are
166using the most up-to-date version of gcc which shipped with your system.
167If you try to use -O when building the textutils package on an x86 with
168the Cygnus 94q4 C compiler, you will end up with a `tr' program which will
169malfunction even worse than the one you are trying to replace!  If you use
170-O when building the textutils package on LynxOS on the PowerPC (using the
171Cygnus 95q2 C compiler) you will just get yourself a compiler crash.  So
172just don't use -O when building textutils.  You can avoid using -O by in-
173voking make in the textutils directory as follows:
174
175	make CFLAGS="-g"
176
177(Note:  At present, LynxOS version 2.4.0 is the latest officially released
178version of LynxOS, and all of the above information is accurate and correct
179for LynxOS 2.4.0 as of the time of this writing.  However it is rumored that
180the bug in the /bin/tr program will be fixed in future releases of LynxOS,
181so if you have a version of LynxOS later than 2.4.0, you may wish to check
182and see if your /bin/tr program even has the problematic bug before bothering
183with all of this.)
184
185
1863.  Fix Your System Include Files
187---------------------------------
188
189If you are building nvi on a PowerPC system, it is also important that you
190apply the patches given at the end of this file to your /usr/include files.
191(Note that you will have to be root in order to do this.)  Two of the patches
192included below fix a pair of serious bugs in the /usr/include/stdarg.h file
193on the PowerPC, and you really _do_ want to have these bugs fixed anyway,
194because without these fixes, anything that you compile which uses <stdarg.h>
195will very likely malfunction at run-time.
196
197Regardless of which LynxOS platform you are using (i.e. x86, PowerPC, Sparc,
198or m680x0) you may want to apply all of the system include files patches that
199are included below anyway.  Doing so will clean up a few minor problems with
200the relevant system include files (i.e. <stdarg.h>, <ioctl.h>, and <wait.h>)
201and this step will also prevent a few warnings which you would otherwise get
202during the build of nvi.
203
204You can apply all of the patches given at the end of this file simply by
205doing the following:
206
207	su root
208	cd /usr/include
209	/bin/patch < this-file
210
211Where `this-file' is the actual full pathname of the file you are now reading,
212wherever it may reside on your own system.
213
214(Note:  At present, LynxOS version 2.4.0 is the latest officially released
215version of LynxOS, and all of the above information is accurate and correct
216for LynxOS 2.4.0 as of the time of this writing.  However it is rumored that
217future releases of LynxOS may incorporate some or all of the important system
218include file fixes provided below.  Thus, if you are building nvi for some
219LynxOS version later than 2.4.0, you should probably go ahead and try to
220apply the patches given below to your system include files, and then just
221don't worry about it if these patches seem to have already been applied.)
222
223
2244.  A Brief Note about Sendmail
225-------------------------------
226
227I should mention also that LynxOS does not normally ship with the `sendmail'
228mail transfer program installed, either under /usr/lib/ or anywhere else for
229that matter.  This isn't really a big problem, but nvi normally wants and
230expects to have a sendmail program available so that it can send users notifi-
231cations (by mail) whenever a partially edited file is preserved by the editor
232in response to a sudden system crash, a sudden system shutdown, or an unexpect-
233ed serial-line hangup.  You can configure and build nvi without any sendmail
234program installed on your system, but you will get warnings about its absence
235when you are doing the initial configure step prior to actually building nvi.
236If you want to have a fully-functional nvi which does send out notification
237messages (by mail) whenever partially edited files are preserved during a
238serial line hangup or system crash, then you should get the BSD sendmail
239sources (via ftp from ftp.cs.berkeley.edu), build and install sendmail, and
240then reconfigure, rebuild, and reinstall nvi.
241
242Please contact me at the E-mail address below if you experience any problems in
243building or using nvi on LynxOS.  I make no guarrantees, but I may be willing
244to try to help.
245
246Ron Guilmette
247Roseville, California
248<rfg@monkeys.com>
249August 14, 1996
250
251
252cut here for LynxOS 2.4.0 system include files patches
253-----------------------------------------------------------------------------
254*** wait.h	Fri Apr 26 10:02:45 1996
255--- wait.h	Sun May 19 05:36:50 1996
256***************
257*** 94,104 ****
258  /* Function prototypes */
259  #ifndef __LYNXOS
260- #ifdef _POSIX_SOURCE
261  extern pid_t wait		_AP((int *));
262  extern pid_t waitpid	_AP((pid_t, int *, int));
263! #else
264! extern int wait		_AP((union wait *));
265! extern int waitpid	_AP((int, union wait *, int));
266! extern int wait3	_AP((union wait *, int, struct rusage *));
267  #endif
268  #endif /* !__LYNXOS */
269--- 94,101 ----
270  /* Function prototypes */
271  #ifndef __LYNXOS
272  extern pid_t wait		_AP((int *));
273  extern pid_t waitpid	_AP((pid_t, int *, int));
274! #ifndef _POSIX_SOURCE
275! extern int wait3	_AP((int *, int, struct rusage *));
276  #endif
277  #endif /* !__LYNXOS */
278*** ioctl.h	Fri Apr 26 16:50:51 1996
279--- ioctl.h	Sat May 18 17:55:16 1996
280***************
281*** 572,576 ****
282
283  #ifndef __LYNXOS
284! extern int ioctl	_AP((int, int, char *));
285  #endif
286
287--- 572,576 ----
288
289  #ifndef __LYNXOS
290! extern int ioctl	_AP((int, int, ...));
291  #endif
292
293*** stdarg.h	Fri Apr 26 16:51:02 1996
294--- stdarg.h	Sat May 18 19:34:13 1996
295***************
296*** 88,92 ****
297  	(((sizeof(TYPE) + sizeof(int) - 1) / sizeof(int)) * sizeof(int))
298
299! #define va_start(AP, LASTARG)	(AP = ((char *) __builtin_next_arg ()))
300
301  void va_end(va_list);		/* Defined in libgcc.a */
302--- 88,92 ----
303  	(((sizeof(TYPE) + sizeof(int) - 1) / sizeof(int)) * sizeof(int))
304
305! #define va_start(AP, LASTARG)	(AP = ((char *) __builtin_next_arg (LASTARG)))
306
307  void va_end(va_list);		/* Defined in libgcc.a */
308***************
309*** 162,166 ****
310  	(((sizeof(TYPE) + sizeof(int) - 1) / sizeof(int)) * sizeof(int))
311
312! #define va_start(AP, LASTARG)	(AP = ((char *) __builtin_next_arg ()))
313
314  void va_end(va_list);		/* Defined in libgcc.a */
315--- 162,166 ----
316  	(((sizeof(TYPE) + sizeof(int) - 1) / sizeof(int)) * sizeof(int))
317
318! #define va_start(AP, LASTARG)	(AP = ((char *) __builtin_next_arg (LASTARG)))
319
320  void va_end(va_list);		/* Defined in libgcc.a */
321