19.2 Build with m4
The process of building a
sendmail
configuration file begins by creating a file of
m4
statements. Traditionally, the suffix for such files is
generic-bsd4.4.mc generic-solaris2.mc generic-hpux10.mc generic-sunos4.1.mc generic-hpux9.mc generic-ultrix4.mc generic-osf1.mc
All
OSTYPE(sunos4.1)dnl see Section 19.3.1, "OSTYPE()" MAILER(local)dnl see Section 19.3.2 MAILER(smtp)dnl see Section 19.3.2 To build a configuration file from these statements, you would place them into a file, say localsun.mc , then run the following command:
%
Here, the If you are using an old version of m4 , the following error message will be printed:
You need a newer version of M4, at least as new as System V or GNU m4: file not found: NoSuchFile Just as the messages says, you need a newer version of m4 . (The third line is just a result of forcing m4 to fail and may be safely ignored.) In our localsun.mc example we would need to rerun it as
%
Another cause of failure could be that the
/usr/5bin/m4:-:1 can't open file SysV m4 m4: ../m4/cf.m4: No such file or directory GNU m4 m4: file not found: ../m4/cf.m4 BSD m4
One possible reason for this error might be that you are
developing your
After you have successfully produced a "first draft" of your configuration file, you can edit localsun.mc and add features as you need them. Many possibilities are described in the rest of this chapter. 19.2.1 Maintain local files with _CF_DIR_It can be advantageous to maintain all the files that make up your local m4 configuration separately from the sendmail distribution. This prevents new releases of sendmail from clobbering your source files. It also allows you to maintain configuration information more conveniently (perhaps under rcs (1) control) and to use programs like make (1) to simplify configuring and installation. Most modern versions of m4 allow you to define macros on the command line, and one such macro is recognized internally by the m4 technique:
_CF_DIR_ This macro tells m4 where the m4/cf.m4 file described above is located. This macro needs to be set to the cf directory under the sendmail source distribution, and it needs to end in a slash character. For example, GNU m4 version 1.2 allows this:
%
Notice that we store the value for
By using the _CF_DIR_ macro, configuration and installation can be further simplified by using make (1). To illustrate, consider the following few lines from a Makefile on a SunOS system:
M4=/usr/local/gnu/bin/m4 CFDIR=/usr/local/src/mail/sendmail/cf/ localsun: localsun.mc $(M4) -D_CF_DIR_=$(CFDIR) $(CFDIR)/m4/cf.m4 localsun.mc > sendmail.cf With this Makefile the above two complex command lines are reduced to a single, simple command line:
%
|
|