Import sendmail 8.14.2
[dragonfly.git] / contrib / sendmail-8.14 / devtools / README
1 This directory contains tools.  Do not attempt to actually build
2 anything in this directory.
3
4 The Build script allows you to specify a base location for the object
5 files by using the -O flag:
6
7         Build -O /tmp
8
9 will put the object files in /tmp/obj.*/.  Also, if the SENDMAIL_SUFFIX
10 environment variable is set, its value will be used in the obj.* directory
11 name.
12
13 The Build script allows you to specify a site configuration file by using
14 the -f flag:
15
16         Build -f siteconfig.m4
17
18 You can put such site configuration files in the Site sub-directory;
19 see Site/README for details.
20
21 If you need to support multiple build configurations from the same tree,
22 you can use prefixes to differentiate your configurations.  Use the -Q
23 flag to Build:
24
25         Build -Q prefix
26
27 Build will select a prefix.*.m4 file instead of the site.*.m4 file according
28 to the conventions in Site/README, and use it to modify the build
29 configuration.  The object directory used will be obj.prefix.*/.  Your
30 prefix.*.m4 files should reside in the Site directory.  You may not use
31 -Q and -f simultaneously.
32
33 While building a site configuration file, beyond using define() to set
34 variables, you can also add to a definition using the APPENDDEF() and
35 PREPENDDEF() macros.  For example:
36
37         APPENDDEF(`confINCDIRS', `-I/usr/local/bind/include')
38
39 will add -I/usr/local/bind/include to the already existing confINCDIRS.
40 Note: There must be no trailing spaces after the last quote mark and
41 before the closing parenthesis.  Also you may need to properly quote
42 m4 reserved words as specified by your vendor's m4 command.
43
44 By default, sendmail will search your system for include and library
45 directories as well as certain libraries (libdb.* for Berkeley DB and
46 libbind.a or libresolv.* for name resolution).  You can turn off this
47 configuration step by specifying the -S flag with the Build command.
48
49 The OS subtree contains definitions for variations on a standard
50 model for system installation.  The M4 variables that can be defined
51 and their defaults before referencing the appropriate OS definitions
52 are listed below.  Note that variables preceded by an asterisk (*)
53 are currently not used in the open source distribution.
54
55 confBEFORE          [empty]             Files to create before sendmail is
56                                         compiled.  The methods must be defined
57                                         in the Makefile using PUSHDIVERT(3).
58 confBLDVARIANT      OPTIMIZED           This controls which object variant will
59                                         be built and is controlled with the
60                                         -v flag to the Build
61                                         script. Internally, this macro is
62                                         used to select compiler options in
63                                         the devtools/OS/*.m4 files.  Valid
64                                         arguments for the Build -v flag are
65                                         "optimized", "debug", and "purify"
66                                         which map to confBLDVARIANT values
67                                         of "OPTIMIZED", "DEBUG", and
68                                         "PURIFY".  This is a work in
69                                         progress, and as such not all
70                                         devtools/OS/*.m4 have been updated
71                                         yet. (See Linux for an example of
72                                         one that has.)  Also, in the future
73                                         it may be desirable to append a
74                                         variant identifier to the object
75                                         directory name to allow different
76                                         variants to independently co-exist
77                                         on a given target platform.  Note:
78                                         the PURIFY variant has not been
79                                         fully implemented on any platforms
80                                         yet. Other variants can be added as
81                                         needed in the future. Changing this
82                                         macro from its default will affect
83                                         other default values.
84 confBUILDBIN        ../../devtools/bin  The location of the build support
85                                         binaries, relative to the obj.*
86                                         directory.
87 confCC              cc                  The C compiler to use.
88 confCCOPTS          [empty]             Additional options to pass to confCC.
89 *confCCOPTS_SO      -fPIC               Additional options for compiling
90                                         shared object libraries.
91 confCCLINK          confCC              Linker to use (for executables).
92 confCOPY            cp                  A program that copies files.
93 confMKDIR           [empty]             A program that creates directories
94                                         (mkdir) and takes the -p parameter
95                                         to create also intermediate directories
96                                         as required.  If this macro is set,
97                                         then it used by "make install" to
98                                         create the required installation
99                                         directories.
100 confDEPEND_TYPE     generic             How to build dependencies.  This should
101                                         be the name of a file in
102                                         devtools/M4/depend
103 confDEPLIBS         [empty]             Dependent libraries when building 
104                                         shared objects. 
105 confDONT_INSTALL_CATMAN  [undefined]    Don't install the formatted manual
106                                         pages.
107 confEBINDIR         /usr/libexec        The location for binaries executed
108                                         from other binaries, e.g., mail.local
109                                         or smrsh.
110 confENVDEF          [empty]             -D flags passed to C compiler.
111 confFORCE_RMAIL     [undefined]         If defined, install the rmail program
112                                         without question.
113 confGBINGRP         smmsp               The group for set-group-ID binaries.
114 confGBINMODE        2555                The mode for set-group-ID binaries.
115 confGBINOWN         root                The owner for set-group-ID binaries.
116 confMSPQOWN         smmsp               The owner of the MSP queue.
117 confMSP_QUEUE_DIR   /var/spool/clientmqueue   The MSP queue directory.
118 confMSP_STFILE      sm-client.st        Name of the MSP statistics file.
119 confHFDIR           /etc/mail           Location of the sendmail helpfile.
120 confHFFILE          helpfile            Name of the installed helpfile.
121 confINCDIRS         [empty]             -I flags passed to C compiler.
122 confINCGRP          bin                 The group for include files.
123 confINCMODE         444                 The mode of installed include files.
124 confINCOWN          root                The owner for include files.
125 confINCLUDEDIR      /usr/include        Where to install include files.
126 confINSTALL         install             The BSD-compatible install program.
127                                         Use ${BUILDBIN}/install.sh if none
128                                         is available on your system.
129 confINSTALL_RAWMAN  [undefined]         Install the unformatted manual pages.
130 *confLD             confCC              Linker to use (for libraries).
131 confLDOPTS          [empty]             Linker options.
132 *confLDOPTS_SO      -shared -Wl         Additional linker options for
133                                         linking shared object libraries.
134 confLIBDIR          /usr/lib            Where to install library files.
135 confLIBDIRS         [empty]             -L flags passed to ld.
136 confLIBGRP          bin                 The group for libraries.
137 confLIBMODE         444                 The mode of installed libraries.
138 confLIBOWN          root                The owner for libraries.
139 confLIBS            [varies]            -l flags passed to ld.
140 confLIBSEARCH       db bind resolv 44bsd
141                                         Search for these libraries for
142                                         linking with programs.
143 confLIBSEARCHPATH   /lib /usr/lib /usr/shlib
144                                         Locations to search for the
145                                         libraries specified by confLIBSEARCH.
146 confLINKS           ${UBINDIR}/newaliases ${UBINDIR}/mailq \
147                     ${UBINDIR}/hoststat ${UBINDIR}/purgestat
148                                         Names of links to sendmail.
149 confLN              ln                  The command used to create links.
150 confLNOPTS          -f -s               The parameters for confLN.
151 confMAN1            confMANROOT 1       The location of man1 files.
152 confMAN1EXT         1                   The extension on files in confMAN1.
153 confMAN1SRC         0                   The source for man pages installed
154                                         in confMAN1.
155 confMAN3            confMANROOT 3       The location of man3 files.
156 confMAN3EXT         3                   The extension on files in confMAN3.
157 confMAN3SRC         0                   The source for man pages installed
158                                         in confMAN3.
159 confMAN4            confMANROOT 4       The location of man4 files.
160 confMAN4EXT         4                   The extension on files in confMAN4.
161 confMAN4SRC         0                   The source for man pages installed
162                                         in confMAN4.
163 confMAN5            confMANROOT 5       The location of man5 files.
164 confMAN5EXT         5                   The extension on files in confMAN5.
165 confMAN5SRC         0                   The source for man pages installed
166                                         in confMAN5.
167 confMAN8            confMANROOT 8       The location of man8 files.
168 confMAN8EXT         8                   The extension on files in confMAN8.
169 confMAN8SRC         0                   The source for man pages installed
170                                         in confMAN8.
171 confMANDOC          -man                The macros used to format man pages.
172 confMANGRP          bin                 The group of installed man pages.
173 confMANMODE         444                 The mode of installed man pages.
174 confMANOWN          bin                 The owner of installed man pages.
175 confMANROOT         /usr/share/man/cat  The root of the man subtree.
176 confMANROOTMAN      /usr/share/man/man  The root of the man subtree, for
177                                         unformatted manual pages.
178 confMAPDEF          [varies]            The map definitions, e.g.,
179                                         -DNDBM -DNEWDB.  -DNEWDB is always
180                                         added if libdb.* can be found.
181 confMBINDIR         /usr/sbin           The location of the MTA (sm-mta,
182                                         sendmail) binary.
183 confMBINGRP         bin                 The group of the MTA binary (sm-mta).
184 confMBINMODE        550                 The mode of the MTA binary (sm-mta).
185 confMBINOWN         root                The owner of the MTA binary (sm-mta).
186 confMTCCOPTS        [empty]             Additional options for compiling
187                                         multi-threaded object files.
188 confMTLDOPTS        [empty]             Additional linker options for
189                                         linking multithreaded binaries.
190 confNO_HELPFILE_INSTALL  [undefined]    If defined, don't install the sendmail
191                                         helpfile by default.
192 confNO_MAN_BUILD    [undefined]         If defined, don't build the man
193                                         pages.
194 confNO_MAN_INSTALL  [undefined]         If defined, don't install the man
195                                         pages by default.
196 confNO_STATISTICS_INSTALL  [undefined]  If defined, don't install the sendmail
197                                         statistics file by default.
198 confNROFF           groff -Tascii       The command to format man pages.
199 confOBJADD          [empty]             Objects that should be included in
200                                         when linking sendmail and the
201                                         associated utilities.  See also
202                                         confSRCADD.
203 confOPTIMIZE        -O                  Flags passed to C compiler as ${O}.
204 confRANLIB          echo                The path to the program to use
205                                         as ranlib.
206 confRANLIBOPTS      [empty]             Options to pass to ranlib.
207 confREQUIRE_LIBSM   [empty]             Define if libsm is required.
208 confSBINDIR         /usr/sbin           The location of root-oriented
209                                         commands, such as makemap.
210 confSBINGRP         bin                 The group for set-user-ID binaries.
211 confSBINMODE        4555                The mode for set-user-ID binaries.
212 confSBINOWN         root                The owner for set-user-ID binaries.
213 confSETUSERID_INSTALL   [undefined]     Needs to be defined to enable the
214                                         install-set-user-id target for
215                                         sendmail.  See sendmail/SECURITY.
216 confSHAREDLIB_EXT   .so                 Shared library file extenion name.
217 confSHAREDLIB_SUFFIX [empty]            Shared object version suffix.   
218 confSHAREDLIBDIR    /usr/lib            Directory for installing shared 
219                                         library. 
220 confSHELL           /bin/sh             The shell to use inside make.
221 confSM_OS_HEADER    [varies]            The name of the platform specific
222                                         include file.  Undefine this if
223                                         libsm is not used.
224 confSMOBJADD        [empty]             Objects that should be included in
225                                         when linking sendmail.  See also
226                                         confSMSRCADD.
227 confSMSRCADD        [empty]             C source files which correspond to
228                                         objects listed in confSMOBJADD.
229 confSMSRCDIR        [varies]            The sendmail source directory
230                                         relative to support program obj.*
231                                         directories.  If not set, the
232                                         Makefile will use a path set by the
233                                         Build script.
234 confSRCADD          [empty]             C source files which correspond to
235                                         objects listed in confOBJADD.
236 confSRCDIR          [varies]            The root of the source directories
237                                         relative to support program obj.*
238                                         directories.  If not set, the
239                                         Makefile will use a path set by the
240                                         Build script.
241 confSONAME          [empty]             ld flag for recording the shared object
242                                         name into shared object.
243 confSTDIR           /etc/mail           The directory in which to store the
244                                         sendmail statistics file.
245 confSTFILE          statistics          Name of the installed statistics file.
246 confSTMODE          0600                Mode of the installed statistics file.
247 confSTRIP           strip               What program to use for stripping
248                                         executables.
249 confSTRIPOPTS       [empty]             Options to pass to the strip program.
250 confUBINDIR         /usr/bin            The directory for user-executable
251                                         binaries.
252 confUBINGRP         bin                 The group for user-executable binaries.
253 confUBINMODE        555                 The mode for user-executable binaries.
254 confUBINOWN         bin                 The owner for user-executable binaries.
255
256 There are also program specific variables for each of the programs
257 in the sendmail distribution.  Each has the form `conf_prog_ENVDEF',
258 for example, `conf_sendmail_ENVDEF'.  If the program name contains
259 a '.' it must be replaced by '_' first, e.g., use `conf_mail_local_LIBS'
260 instead of `conf_mail.local_LIBS'.  The variables are:
261
262 conf_prog_ENVDEF    [empty]             -D flags passed to C compiler when
263                                         compiling prog.
264 conf_prog_LIB_POST  [empty]             -l flags passed to ld when linking
265                                         prog (after other libraries).
266 conf_prog_LIBS      [varies]            -l flags passed to ld when linking
267                                         prog (before other libraries).
268 conf_prog_OBJADD    [empty]             Additional object files given to ld
269                                         when linking prog.
270 conf_prog_SRCADD    [empty]             C source files to compile and link
271                                         for prog.
272
273 The order of the different conf*LIBS* is as follows:
274 conf_prog_LIBS confLIBS conf_prog_LIB_POST
275
276 ----------------------------------------------------------------
277
278 ----------------
279 New build system
280 ----------------
281
282 Sendmail's build system has undergone some rearrangement to accommodate
283 future development.  To the end user building sendmail from a distribution,
284 this should have little effect.  All the same configuration files and macros
285 should still behave the same.
286
287 If you need to make some radical changes to a Makefile.m4 or are adding new
288 libraries or utilities, you may want to read the rest of this document on
289 how to work with the new system.
290
291
292 --------
293 Overview
294 --------
295
296 The purpose of the redesign is twofold.  First, it cuts down massively on
297 replicated information.  Second, the new design should lend itself better to
298 working on platforms with somewhat different build tools than on standard
299 unix.
300
301 The main idea is to have the Makefile.m4 in each subdirectory contain the
302 minimum amount of information needed to describe the elements needed for
303 the build process and the products produced.
304
305 Each product has a type and each type has a template that provides a basic
306 makefile for that type.  Right now the templates are organized by the broad
307 type of the operating system. The two existing types are UNIX and NT.
308
309
310 ------------------
311 Makefile.m4 basics
312 ------------------
313
314 Each Makefile.m4 is split into separate products.  For the most part, the
315 products are considered totally separate from other products in the
316 Makefile.m4.  Each products is delineated by two macros: bldPRODUCT_START and
317 bldPRODUCT_END.
318
319 The form for bldPRODUCT_START is:
320 bldPRODUCT_START(<product_type>, <product_name>)
321 where <product_type> is the type of product to be produced (e.g., executable,
322 library, manpage) and <product_name> is a unique identifier within the
323 product_type name space for this Makefile.m4
324
325 The form for bldPRODUCT_END is:
326 bldPRODUCT_END
327
328 This is marks the end of all the information for the current product.
329
330 There is one other macro required in any Makefile.m4 and that is bldFINISH
331 which takes no arguments and must appear after all the products have been
332 defined.
333
334 When the actual makefile is generated each product appears in two sections.
335 The first is where makefile variables are set (e.g., CFLAGS=-O).  The second
336 is where the targets appear (e.g., foo.o: foo.c).  Anything diverted to
337 bldTARGETS_SECTION ends up in the second part of the makefile.  Anything
338 else turns up in the header part where variables are defined.
339
340 As always, any straight text put into Makefile.m4 will just show up as is
341 in the finished makefile.
342
343
344 -------------
345 Product Types
346 -------------
347
348 executable
349 ----------
350
351 This means an executable created from C sources.  The name of the executable
352 is derived from the product_name in the bldPRODUCT_START macro.
353
354 bldSOURCES - This should be defined to a space separated list of source
355 files that make up the executable.
356
357 bldBIN_TYPE - This determines where the binaries will be installed and what
358 permissions they will have.  Available types are `M', `U', `K', `S', and `E'.
359 See M4/UNIX/make/executable.m4 for what the different types mean.
360
361 bldTARGET_LINKS - This determines where additional symbolic links to the
362 executable are placed.  These should be full pathnames, separated by
363 spaces.
364
365
366 test
367 ----
368
369 This is just like 'executable', but is used for test programs.
370 The program cannot be installed.  Each time it is built, it is executed
371 by make with no arguments.
372
373
374 manpage
375 -------
376
377 This builds manpages from source using *roff.
378
379 bldSOURCES - This should be defined to a space separated list of man source
380 files.
381
382
383 library
384 -------
385
386 This builds a static library from C sources.
387
388 bldSOURCES - This should be defined to a space separated list of C source
389 files that make up the library.
390
391 bldINSTALLABLE - This should be set if the library should be installed in
392 confLIBDIR.
393
394 $Revision: 8.98 $, Last updated $Date: 2007/05/18 16:26:09 $