home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


Previous Section Next Section

2.4 Building with m4

The make(1) program is used to compile and install sendmail,[4] a site that provides precompiled compilers that you can easily install. The Build script creates not only an object working directory, but also an appropriate Makefile in that directory using m4(1). Unless you tell Build to do otherwise, the Makefile it creates will be based solely on information it finds in the appropriate devtools/OS and devtools/Site subdirectories.

[4] Some operating systems put make in odd locations. If it is not found, look in /usr/local/bin, or under Solaris look in /usr/ccs/bin. Also under Solaris you might lack a compiler altogether. If so, see http://sunfreeware.com.

For most sites this default behavior will produce the desired result. For other sites different defaults are needed.

In this section we discuss those m4 directives necessary for building a Makefile. To understand m4(1), leap ahead to Chapter 4, review the information there, then return here.

Creating a Makefile with Build is simplicity itself. First decide whether you wish to maintain your m4 file inside the sendmail source tree, or outside it. If you choose to maintain your m4 file inside the source tree, just name it devtools/Site/site.config.m4 (see Section 2.5 for details) and run Build like this:

% ./Build

Note, here we have chosen to maintain all our Build m4 files inside the sendmail source tree. This approach allows administrators to rebuild sendmail without needing to remember where the m4 file is located.

If you choose to maintain your m4 file outside the source tree, use the -f command-line switch with Build to specify the location of that file:

% ./Build -f /usr/local/configs/sendmail/oursite.m4

Note that here, we have chosen to maintain all our Build m4 files in a directory that is outside the sendmail distribution. This approach allows you to upgrade to new releases of sendmail without having to remember to copy the devtools/Site directory each time. The downside to this approach is that you must remember to use the -f command-line switch every time you build. If you fail to remember, or if someone else builds without knowing the need for -f, the created sendmail binary may not work as you expect or might lack the abilities you require.

Your m4 file is built using the directives shown in Table 2-3, which are described more fully in the sections that follow. One example of an m4 file might look like this:

define(`confOPTIMIZE', `-g')
define(`confENVDEF', `-DMATCHGECOS=0')
APPENDDEF(`confMAPDEF', `-DNIS')

Here we compile with -g to help debug new code we added, and with -DMATCHGECOS=0 to turn off support for fuzzy name matching (MATCHGECOS). Then we declare that we want to use nis(3) for aliases (with -DNIS).

Table 2-3. Build m4 directives

Directive

§

Description

APPENDDEF( )

APPENDDEF( )

Append to an existing define

confBEFORE

confBEFORE

Establish files before compiling

confBLDVARIANT

confBLDVARIANT

Controls variations on objects

confBUILDBIN

confBUILDBIN

Location of devtools/bin

confCC

confCC

The compiler with which to build sendmail

confCCOPTS

confCCOPTS

Command-line switches to pass to the compiler

confCCOPTS_SO[5]

confCCOPTS_SO

Command-line switches for shared-library objects

confCOPY

confCOPY

The copy command to use

confDEPEND_TYPE

confDEPEND_TYPE

How to build Makefile dependencies

confDEPLIBS

confDEPLIBS

Shared object dependencies

confDONT_INSTALL_CATMAN

confDONT_INSTALL_CATMAN

Don't install preformatted manual pages

confEBINDIR

confEBINDIR

Bin directory for mail.local and smrsh

confENVDEF

confENVDEF and conf_prog_ENVDEF

Pass -D switches during compilation

conf_prog_ENVDEF

confENVDEF and conf_prog_ENVDEF

Pass -D switches during compilation

confFORCE_RMAIL

confFORCE_RMAIL

Install the rmail program no matter what

confGBIN...

confGBIN...

The set-group-id settings

confHFDIR

confHFDIR

Where to install the sendmail help file

confHFFILE

confHFFILE

The name of the sendmail help file

confINCDIRS

confINCDIRS

Compiler -I switches

confINC...

confINC...

Permissions and locations for installed #include files

confINSTALL

confINSTALL

Program to install programs and files

confINSTALL_RAWMAN

confINSTALL_RAWMAN

Install unformatted manuals

confLD

confLD

The linker to use

confLDOPTS

confLDOPTS

Linker options

confLDOPTS_SO[5]

confLDOPTS_SO

Linker options for creating a shared library

confLIB...

confLIB...

Location and modes for installed library files

confLIBDIRS

confLIBDIRS

Linker -L switches

confLIBS

confLIBS and conf_prog_LIBS

Linker -l libraries

conf_prog_LIBS

confLIBS and conf_prog_LIBS

Linker -l libraries

confLIBSEARCH

confLIBSEARCH

Automatic library search

confLIBSEARCHPATH

confLIBSEARCHPATH

Paths to search for libraries

confLINKS

confLINKS

What to link to sendmail

confLN

confLN

Program to link files

confLNOPTS

confLNOPTS

Switches for the program to link files

confMAN...

confMAN...

How to install manual pages

confMAPDEF

confMAPDEF

Which database libraries to use

confMBIN...

confMBIN...

Where and how to install sendmail

confMSPQOWN

confMSPQOWN

Owner of the MSP queue

confMSP_QUEUE_DIR

confMSP_QUEUE_DIR

Location of the MSP queue

confMTCCOPTS[5]

confMTCCOPTS

Compiler options for multithreading

confMTLDOPTS[5]

confMTLDOPTS

Linker options for multithreading

confNO_HELPFILE_INSTALL

confNO_HELPFILE_INSTALL

Prevent installation of the helpfile

confNO_MAN_BUILD

confNO_MAN_BUILD

Prevent formatting of manuals

confNO_MAN_INSTALL

confNO_MAN_INSTALL

Prevent installation of manuals

confNO_STATISTICS_INSTALL

confNO_STATISTICS_INSTALL

Prevent installation of the statistics file

confNROFF

See this section

Program to format the manual pages

confOBJADD

confOBJADD

Extra .o files to be linked in all programs

confOPTIMIZE

confOPTIMIZE

How to optimize the compile

confRANLIB

confRANLIB

The ranlib program for library archive files

confRANLIBOPTS

confRANLIBOPTS

Arguments to give the ranlib program

confREQUIRE_LIBSM

confREQUIRE_LIBSM

Define if libsm is required

confSBINDIR

confSBINDIR

Root-oriented program directory

confSBINGRP

confSBINGRP

Group for set-user-id programs

confSBINMODE

confSBINMODE

Permissions for set-user-id programs

confSBINOWN

confSBINOWN

Owner for set-user-id programs

confSHAREDLIB...

confSHAREDLIB...

Shared library definitions

confSHELL

confSHELL

SHELL= for Makefile

confSM_OS_HEADER

confSM_OS_HEADER

Platform-specific #include file

confSMOBJADD

confSMOBJADD

Extra .o files to be linked in sendmail

confSMSRCADD

confSMSRCADD

Source .c files corresponding to confSMOBJADD

confSONAME

confSONAME

Shared object ID flag

conf_prog_SRCADD

conf_prog_SRCADD

Extra .o files to be linked per program

conf_prog_OBJADD

conf_prog_OBJADD

.c files corresponding to conf_prog_OBJADD

confSRCADD

conf_prog_SRCADD

Source for confOBJADD files

confSRCDIR

confSRCDIR

Location of sendmail source

confSTDIOTYPE

confSTDIOTYPE

Use torek for buffered file I/O (V8.10 and earlier)

confSTDIR

confSTDIR

Location of the statistics file

confSTFILE

confSTFILE

Name of the statistics file

confSTMODE

confSTFILE

Name of the statistics file

confSTRIP

confSTRIP

Name of the program to strip the binary

confSTRIPOPTS

confSTRIPOPTS

Command-line arguments for the strip program

confUBINDIR

confUBINDIR

Location of user executables

confUBINGRP

confUBINGRP

Group for user executables

confUBINMODE

confUBINMODE

Permissions for user executables

confUBINOWN

confUBINOWN

Ownership of user executables

PREPENDDEF( )

PREPENDDEF( )

Prepend to an existing define

[5] These macros are not part of the open source distribution, but are mentioned in devtools/README.

Before creating your own m4 files, be sure to read devtools/README. That file always contains the latest information about building sendmail with m4(1).

    Previous Section Next Section