Added docs/contrib/build_nmh script.
[mmh] / INSTALL
1 #
2 # INSTALL -- installation instructions
3 #
4
5 --------------------------------
6 Installing nmh, guided by script
7 --------------------------------
8 For routine installation on popular platforms, the shell script in
9 docs/contrib/build_nmh can be used to guide you through configuration.
10 It will then build and optionally (with -i) install in the configured
11 location.
12
13
14 ------------------------
15 Installing nmh, manually
16 ------------------------
17 Please read all of the following instructions before you begin
18 building nmh.
19
20 You should check the MACHINES file to see if there are any specific
21 build instructions for your operating system.  To build nmh, you will
22 need an ANSI C compiler such as gcc.
23
24 0) If you have obtained nmh by checking it out of the git repository,
25    you will need to run the GNU autotools to regenerate some files.
26    (If your directory already contains a file 'config.h.in' then this
27    has already been done and you do not need to do it.)  You can
28    regenerate the files by running the command
29
30    ./autogen.sh
31
32    (Note that if you're doing nmh development, you should look at
33    docs/README.developers, since there is other developer-friendly
34    advice there as well.)
35
36    If you have obtained nmh in the form of a tar archive and are
37    trying to unpack it with cpio:  due to an apparent bug in cpio, it
38    might fail with "Malformed number" error messages.  Try another
39    tool to unpack, such as tar or pax.
40
41 1) From the top-level source directory, run the command
42
43    ./configure [options]
44
45    This will check the configuration of your OS, and create the
46    include file config.h, as well as the Makefile.
47
48    The configure script accepts various options.  The options of
49    most interest are listed in a section below.  To see the list
50    of all available options, you can run
51
52    ./configure --help
53
54 2) Look through the user configuration section at the beginning
55    of the generated include file `config.h'. You may
56    want to customize some #defines for your environment, though
57    that is usually unnecessary.  Note the configure options below
58    control some of the #defines.
59
60 3) make
61
62 4) make check
63
64    This takes a bit of time, around one minute on a modern machine,
65    but is highly recommended.
66
67 5) make install
68
69    Note that if you have [n]mh files in your install directories with
70    the same names as the files being installed, the old ones will get
71    overwritten without any warning.  The only directory that isn't
72    true for is the `etc' directory -- in that directory, the previous
73    copy of each <file> will be backed up as <file>.prev if it differs
74    from the newly-installed copy.  Watch for any diff output while
75    make is processing that directory to see if you need to merge
76    changes from *.prev files into the new versions.
77
78 6) Edit the file `mts.conf' (installed in the nmh `etc' directory)
79    and make any necessary changes for the mail transport interface
80    you are using.
81
82    The default `mts.conf' file assumes you retrieve new mail from
83    a local (or NFS mounted) maildrop, and send outgoing mail by
84    injecting the message to a mail transfer agent (such as sendmail)
85    on the local machine via SMTP.
86
87    If, instead, all your mail sending and receiving occurs on a
88    remote POP/SMTP server, you will need to look at the values of the
89    variables "localname", "pophost", and "servers":
90
91     a) "localname" defines the hostname that nmh considers local.
92        If not set, then nmh queries your OS for this value.  You will
93        want to change this if you wish your e-mail to appear as if it
94        originated on the POP server.
95
96     b) "pophost" defines the server that runs the POP daemon, and to
97        which `inc' and `msgchk' will always query for new mail.
98
99     c) "servers" defines the server to which you send outgoing SMTP
100        traffic.  See the discussion of the --with-smtpserver configure
101        option below.
102
103    If you don't want to hardcode pophost in `mts.conf', you can use
104    the `-host' and `-user' options to `inc' and `msgchk'.
105
106    Check the `mh-tailor' man page for a list of all the available options
107    for this file.
108
109 7) Edit the file `mhn.defaults' (installed in the nmh `etc' directory).
110    This file contains the default profile entries for the nmh command
111    `mhn' and is created by the script `mhn.defaults.sh'.  This script
112    will search a generic path (essentially your $PATH) for programs to
113    handle various content types (for example, xv to display images).
114    You can re-run this script and give it a more tailored path.  You may
115    want to re-run this script later if you install new programs to
116    display content.  An example of this is:
117
118     % cd support/general
119     % ./mhn.defaults.sh /usr/local/bin:/usr/X11/bin:/usr/ucb > mhn.defaults
120
121    and then move `mhn.defaults' into the nmh `etc' directory.
122
123    The `mhn.defaults.sh' script only searches for a simple set of programs.
124    If you have specialized programs to handle various types, you will need
125    to edit the `mhn.defaults' file manually.  The syntax of this file is
126    described in the man page for `mhn', and in section 9.4 of the book
127    "MH & xmh: Email for Users and Programmers", 3rd edition, by Jerry Peek,
128    on the Internet at <http://rand-mh.sourceforge.net/book/mh/confmhn.html>.
129
130 8) Add an optional global mh.profile, if desired.  This profile should be
131    placed in the nmh `etc' directory with the name `mh.profile'.  This
132    file will be used to construct the initial .mh_profile of a new nmh
133    user, but will not be consulted after that.
134
135 -----------------------------------------------
136 Compiler options, or using a different compiler
137 -----------------------------------------------
138
139 By default, configure will use the "gcc" compiler if found.  You can
140 use a different compiler, or add unusual options for compiling or
141 linking that the "configure" script does not know about, by giving
142 "configure" initial values for these on its command line or in its
143 environment.  For example,
144
145     ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
146
147 If you wish to add options that are only used at compile time instead of
148 link time, you can use the CPPFLAGS variable:
149
150    ./configure CPPFLAGS='-Wextra -Wno-sign-compare'
151
152 If you want to add to both compile and link flags at build time
153 without putting them in the configuration, you can use the AM_CFLAGS
154 Makefile macro:
155
156     make AM_CFLAGS=--coverage
157
158 ----------------------------------------
159 Building nmh on additional architectures
160 ----------------------------------------
161 To build nmh on additional architectures, you can do a "make distclean".
162 This should restore the nmh source distribution back to its original
163 state.  You can then configure nmh as above on other architectures in
164 which you wish to build nmh.  Or alternatively, you can use a different
165 build directory for each architecture.
166
167 ---------------------------------
168 Using a different build directory
169 ---------------------------------
170 You can compile the nmh in a different directory from the one containing
171 the source code.  Doing so allows you to compile it on more than one
172 architecture at the same time.  To do this, you must use a version of
173 "make" that supports the "VPATH" variable, such as GNU "make".  "cd" to
174 the directory where you want the object files and executables to go and
175 run the "configure" script.  "configure" automatically checks for the
176 source code in the directory that "configure" is in.  For example,
177
178     cd /usr/local/solaris/nmh
179     /usr/local/src/nmh-1.5/configure
180     make
181
182 ---------------------
183 Options for configure
184 ---------------------
185 --prefix=DIR     (DEFAULT is /usr/local/nmh)
186      This will change the base prefix for the installation location
187      for the various parts of nmh.  Unless overridden, nmh is installed
188      in ${prefix}/bin, ${prefix}/etc, ${prefix}/lib, ${prefix}/man.
189
190 --bindir=DIR     (DEFAULT is ${prefix}/bin)
191      nmh's binaries (show, inc, comp, ...) are installed here.
192
193 --libdir=DIR     (DEFAULT is ${prefix}/lib)
194      nmh's support binaries (post, slocal, mhl, ...) are installed here.
195
196 --sysconfdir=DIR     (DEFAULT is ${prefix}/etc)
197      nmh's config files (mts.conf, mhn.defaults, ...) are installed here.
198
199 --mandir=DIR     (DEFAULT is ${prefix}/man)
200      nmh's man pages are installed here.
201
202 --enable-debug
203      Enable debugging support.
204
205 --with-editor=EDITOR  (DEFAULT is vi)
206      specify the full path of the default editor to use.  If this
207      option is not given, then the configuration process will search
208      for the `vi' command and use it as the default.  If you wish to
209      specify an interface which is compatible with MH, then use the
210      nmh command `prompter'.  If you specify `prompter', then you don't
211      need to give the full pathname.
212
213 --with-locking=LOCKTYPE    (DEFAULT is dot)
214      Specify the locking mechanism when attempting to "inc" or
215      "msgchk" a local mail spool. Valid options are "dot",
216      "fcntl", "flock", and "lockf". Of the four, dot-locking
217      requires no special kernel or filesystem support, and simply
218      creates a file called "FILE.lock" to indicate that "FILE" is
219      locked.
220
221      In order to be effective, you should contact the site
222      administrator to find out what locking mechanisms other
223      mail delivery and user programs respect. The most common
224      reason not to use dot-locking is if the mail spool directory
225      is not world- or user-writeable, and thus a lock file cannot
226      be created.
227
228 --with-mts=MTS   (DEFAULT is smtp)
229      Specify the default mail transport system you want to use.  The two
230      acceptable options are "smtp" (which is the default), and
231      "sendmail".  This value will be put into the mts.conf file.  You
232      may find it convenient to specify a value at configure-time,
233      however, so that each time nmh is reinstalled, the right value will
234      be there.
235
236      If you use "smtp", this will enable a direct SMTP (simple mail
237      transport protocol) interface in nmh.  When sending mail, instead
238      of passing the message to the mail transport agent, `post' will
239      open a socket connection to the mail port on the machine specified
240      in the `mts.conf' file (default is localhost), and speak SMTP
241      directly.
242
243      If you use "sendmail", then `post' will send messages by forking a
244      local copy of sendmail.  Currently it will still speak SMTP with
245      this local copy of sendmail.
246
247      If you wish to use a transport agent other than sendmail, you will
248      need to use a `sendmail wrapper'.
249
250 --with-ndbm=LIB    (DEFAULT is to autodetect)
251 --with-ndbmheader=HEADER     (DEFAULT is to autodetect)
252      Specify the header file (eg ndbm.h) and library (eg ndbm) to use
253      to compile against the ndbm database library. By default, configure
254      will try various possibilities until it finds one that works; this
255      option only needs to be specified if the autodetection fails or
256      makes the wrong choice.
257
258      If either of these options is given then the other must also be
259      specified.
260
261 --with-pager=PAGER    (DEFAULT is more)
262      Specify the default pager (file lister) to use.  If this option
263      is not given, then the configuration process will search for the
264      command `more' and use it as the default.
265
266 --with-smtpservers='SMTPSERVER1[ SMTPSERVER2...]'    (DEFAULT is localhost)
267      If this option is not specified, the mts.conf file will contain
268      the line "servers: localhost", which may be manually edited later.
269      You may find it convenient to specify a value at configure-time,
270      however, so that each time nmh is reinstalled, the right value will be
271      there.
272
273      See the mh-tailor(5) man page for full documentation of "servers:".
274
275 --
276 The nmh team
277 nmh-workers@nongnu.org