Merge from vendor branch FILE:
[dragonfly.git] / contrib / nvi / build / README.LynxOS
1 README.LynxOS
2 =============
3
4 Written by Ronald F. Guilmette <rfg@monkeys.com>
5
6 Last modified Wed Aug 14 23:10:07 PDT 1996
7 ------------------------------------------
8
9 0. Introduction
10 ---------------
11
12 This file describes how to build and install the Berkeley nvi editor for
13 the LynxOS 2.4.0 operating system.
14
15 LynxOS 2.4.0 is available for a variety of different hardware platforms, in
16 particular, x86, m680x0, Sparc, and PowerPC.  I have successfully built nvi
17 on all four of these flavors of LynxOS by following the procedures given in
18 this file.
19
20 Note 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
22 more POSIX-compliant, and I have no idea what build glitches, if any, you
23 might encounter if you try to build nvi on a pre-2.4.0 version of LynxOS.)
24
25 There are basically four steps to configuring, building, and installing nvi
26 on 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
33 These steps are described in separate sections below.
34
35 1.  Get Setup to Use the Proper C Compiler
36 ------------------------------------------
37
38 The first step when building nvi on LynxOS is to set your $PATH environment
39 variable properly so that the gcc 2.x compiler appears first on your path,
40 prior to the older (and less robust) gcc 1.xx compiler (typically installed
41 as /bin/gcc) and/or the old Lynx proprietary C compiler (typically installed
42 as /bin/cc), both of which may also be present on your system.
43
44 Note that for most operating systems, the configure script for nvi tries
45 to use whatever compiler you have installed (and in your $PATH) as "cc",
46 however in the special case of LynxOS, the configure script will auto-
47 matically try to find a "gcc" program on your $PATH in preference to a
48 compiler called "cc".  If the nvi configure script only find a compiler
49 called "cc", that's OK.  It will still try to see if that is really just
50 the GNU C compiler installed under the name "cc".
51
52 Regardless of the name however (be it "gcc" or "cc") the first C compiler
53 in your $PATH should be some _recent_ (i.e. 2.0 or later) version of the
54 GNU C compiler... and the nvi configure script now checks that this is the
55 case, and fails if it isn't.
56
57 Oddly enough, LynxOS 2.4.0 (and some prior versions) shipped with as many
58 as 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
60 to appear first in your $PATH.  You want to avoid having either the /bin/gcc
61 compiler or the /bin/cc compiler be the first C compiler in your $PATH.
62
63 To make sure that the GNU C version 2.x compiler which was shipped with your
64 LynxOS 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
66 users).  You can, of course, just do this at the shell command prompt, but
67 it 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
70 The pathname of the directory that contains the GNU C version 2.x compiler
71 is (unfortunately) dependent upon the exact type of LynxOS system you have.
72
73 For LynxOS 2.4.0 on x86 systems, gcc 2.x is located in:
74
75         /cygnus/94q4-lynxos-x86/bin
76
77 For LynxOS 2.4.0 on m680x0 systems, gcc 2.x is located in:
78
79         /cygnus/94q4-lynxos-68k/bin
80
81 For LynxOS 2.4.0 on Sparc systems, gcc 2.x is located in:
82
83         /cygnus/94q4-lynxos-usparc/bin
84
85 For 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
91 Anyway, 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
93 compiler appears in your $PATH before either the /bin/cc or /bin/gcc
94 compilers (if present).  If you fail to do this, the configure step for
95 nvi will fail, because the compiler script actually checks (now) that the
96 compiler you are using (if your are on a LynxOS system) is gcc 2.0 or
97 later.
98
99 To make absolutely sure that you will be configuring and building nvi with
100 the proper C compiler (i.e. the GNU C version 2.x compiler on your system)
101 you should add the directory name listed above for your specific system type
102 to your $PATH setting in your $HOME/.profile file.  (For csh/tcsh users, you
103 will 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-
105 tory 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
107 and then log back into the system just to make sure your new $PATH/$path
108 setting takes effect properly.
109
110 When you finish making this adjustment to your $PATH (or $path), the most
111 up-to-date version of gcc on your system should be available to you as the
112 first `gcc' program on your $PATH.  You should verify that this is indeed the
113 case simply by typing `gcc -v' and then checking the version number reported
114 by the compiler.  It should say either "2.6-94q4" or (on PowerPC systems) it
115 should 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
117 properly setup to use gcc version 2.0 or later.
118
119 Performing the steps shown above will insure that your subsequent configura-
120 tion and build steps for nvi will make use of the most up-to-date version of
121 gcc that was shipped with your Lynx operating system.  (Note that the versions
122 of gcc which are currently shipping with LynxOS 2.4.0 are also somewhat out-
123 of-date themselves, but they are still quite a bit newer and more bug-free
124 and ANSI conformant that those other two C compilers, /bin/cc and /bin/gcc,
125 which also ship with LynxOS 2.4.0.)
126
127 (Note:  At present, LynxOS version 2.4.0 is the latest officially released
128 version of LynxOS, and all of the above information is accurate and correct
129 for LynxOS 2.4.0 as of the time of this writing.  However it is rumored that
130 future releases of LynxOS may provide a still newer version of gcc, and that
131 it may be located in the /usr/bin directory.  Thus, if you are building nvi
132 for some LynxOS version later than 2.4.0, you may wish to check and see if
133 your system has a program called /usr/bin/gcc, and use that version of gcc,
134 if available, rather than the one suggested above.)
135
136 2.  Replace Your Installed `tr' Program
137 ---------------------------------------
138
139 The `tr' program which comes bundled with LynxOS 2.4.0 (as /bin/tr) has a
140 somewhat obscure bug which just happens to be tickled by almost all GNU
141 `autoconf' generated `configure' scripts (including the one that nowadays
142 comes bundled with nvi).  Using the stock /bin/tr program on LynxOS when
143 executing such `configure' scripts _will_ cause these scripts to malfunction
144 in 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_
146 you even try to configure nvi.  (You can tell if your `tr' program has the
147 bug by executng the command "echo ab- | tr ab- ABC".  If this yields the
148 string "Ab-" then you have the bug.  If it yields "ABC" then you don't.)
149
150 You can obtain sources for a working version of the `tr' command as part of
151 the GNU `textutils' package (the latest version of which, at the time of this
152 writing, is 1.19).  The GNU textutils package is available for downloading
153 from prep.ai.mit.edu in the pub/gnu directory.  Look for the file named
154 textutils-1.19.tar.gz, or an even more recent version of textutils, if one
155 is available.  Fetch it, gunzip it, untar it, and follow the directions in
156 the INSTALL file included in the tar file to build and install the entire
157 textutils set of utility programs (which includes a working `tr' program).
158 Then 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
160 step _before_ you start to configure nvi.
161
162 When building the textutils set of programs, I suggest that you use the most
163 up-to-date C compiler available on your system (as described above).  Also,
164 note that it will be important for you to AVOID using the -O (optimize)
165 compiler option when building the GNU textutils package, even if you are
166 using the most up-to-date version of gcc which shipped with your system.
167 If you try to use -O when building the textutils package on an x86 with
168 the Cygnus 94q4 C compiler, you will end up with a `tr' program which will
169 malfunction 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
171 Cygnus 95q2 C compiler) you will just get yourself a compiler crash.  So
172 just don't use -O when building textutils.  You can avoid using -O by in-
173 voking 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
178 version of LynxOS, and all of the above information is accurate and correct
179 for LynxOS 2.4.0 as of the time of this writing.  However it is rumored that
180 the bug in the /bin/tr program will be fixed in future releases of LynxOS,
181 so if you have a version of LynxOS later than 2.4.0, you may wish to check
182 and see if your /bin/tr program even has the problematic bug before bothering
183 with all of this.)
184
185
186 3.  Fix Your System Include Files
187 ---------------------------------
188
189 If you are building nvi on a PowerPC system, it is also important that you
190 apply 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
192 included below fix a pair of serious bugs in the /usr/include/stdarg.h file
193 on the PowerPC, and you really _do_ want to have these bugs fixed anyway,
194 because without these fixes, anything that you compile which uses <stdarg.h>
195 will very likely malfunction at run-time.
196
197 Regardless of which LynxOS platform you are using (i.e. x86, PowerPC, Sparc,
198 or m680x0) you may want to apply all of the system include files patches that
199 are included below anyway.  Doing so will clean up a few minor problems with
200 the relevant system include files (i.e. <stdarg.h>, <ioctl.h>, and <wait.h>)
201 and this step will also prevent a few warnings which you would otherwise get
202 during the build of nvi.
203
204 You can apply all of the patches given at the end of this file simply by
205 doing the following:
206
207         su root
208         cd /usr/include
209         /bin/patch < this-file
210
211 Where `this-file' is the actual full pathname of the file you are now reading,
212 wherever it may reside on your own system.
213
214 (Note:  At present, LynxOS version 2.4.0 is the latest officially released
215 version of LynxOS, and all of the above information is accurate and correct
216 for LynxOS 2.4.0 as of the time of this writing.  However it is rumored that
217 future releases of LynxOS may incorporate some or all of the important system
218 include file fixes provided below.  Thus, if you are building nvi for some
219 LynxOS version later than 2.4.0, you should probably go ahead and try to
220 apply the patches given below to your system include files, and then just
221 don't worry about it if these patches seem to have already been applied.)
222
223
224 4.  A Brief Note about Sendmail
225 -------------------------------
226
227 I should mention also that LynxOS does not normally ship with the `sendmail'
228 mail transfer program installed, either under /usr/lib/ or anywhere else for
229 that matter.  This isn't really a big problem, but nvi normally wants and
230 expects to have a sendmail program available so that it can send users notifi-
231 cations (by mail) whenever a partially edited file is preserved by the editor
232 in response to a sudden system crash, a sudden system shutdown, or an unexpect-
233 ed serial-line hangup.  You can configure and build nvi without any sendmail
234 program installed on your system, but you will get warnings about its absence
235 when you are doing the initial configure step prior to actually building nvi.
236 If you want to have a fully-functional nvi which does send out notification
237 messages (by mail) whenever partially edited files are preserved during a
238 serial line hangup or system crash, then you should get the BSD sendmail
239 sources (via ftp from ftp.cs.berkeley.edu), build and install sendmail, and
240 then reconfigure, rebuild, and reinstall nvi.
241
242 Please contact me at the E-mail address below if you experience any problems in
243 building or using nvi on LynxOS.  I make no guarrantees, but I may be willing
244 to try to help.
245
246 Ron Guilmette
247 Roseville, California
248 <rfg@monkeys.com>
249 August 14, 1996
250
251
252 cut 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 */