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


sendmailSearch this book
Previous: 2.3 What's What in src Chapter 2
Have a V8
Next: 2.5 Build

2.4 Preliminaries

Now that you have the distribution and have changed into the src directory, you will find a script called makesendmail . For nearly all systems, all you have to do is run that script to build sendmail . To determine whether your system is supported, run the makesendmail script now, with the -m command-line switch:


./makesendmail -m

Configuration: os=SunOS, rel=4.1.4, rbase=4, arch=sun4, sfx=

Will run in virgin obj.SunOS.4.1.4.sun4 using Makefile.SunOS


Here, makesendmail indicates that it knows how to build a sendmail for SunOS 4.1.4. It will use the Makefile called Makefile.SunOS . If it is unable to determine a Makefile , it will print a message like this and exit:

Cannot determine how to support 






Here, arch is the generic type of machine, such as sun4 or 9000/720 . The os is the operating system type, such as SunOS or HP-UX. And the rel is the version of the operating system, such as A or 4.1.3. If your system is not supported, you are going to have to do a port (ugh!). Read the READ_ME file, and skip ahead to Chapter 18, Compile and Install sendmail .

Fortunately makesendmail succeeded in this example, and, because we are running on a Sun system with SunOS 4.1.4, makesendmail selected Makefile.SunOS as the Makefile that we will be using. Had we been running on something else, for example, say an SGI machine, it might have selected a different Makefile , such as Makefile.IRIX . All the Makefile files are located under src in a subdirectory called Makefiles . That subdirectory should look something like this:

Makefile.386BSD            Makefile.ISC               Makefile.Solaris
Makefile.A-UX              Makefile.KSR               Makefile.SunOS
Makefile.AIX               Makefile.LUNA              Makefile.SunOS.4.0
Makefile.Altos             Makefile.Linux             Makefile.SunOS.5.1
Makefile.BSD-OS            Makefile.Mach386           Makefile.SunOS.5.2
Makefile.BSD43             Makefile.NCR3000           Makefile.SunOS.5.3
Makefile.CLIX              Makefile.NEWS-OS.4.x       Makefile.SunOS.5.4
Makefile.CSOS              Makefile.NEWS-OS.6.x       Makefile.SunOS.5.5
Makefile.ConvexOS          Makefile.NEXTSTEP          Makefile.Titan
Makefile.Dell              Makefile.NeXT              Makefile.ULTRIX
Makefile.DomainOS          Makefile.NetBSD            Makefile.UMAX
Makefile.Dynix             Makefile.NonStop-UX        Makefile.UNICOS
Makefile.EWS-UX_V          Makefile.OSF1              Makefile.UNIX_SV.4.x.i386
Makefile.FreeBSD           Makefile.PTX               Makefile.UX4800
Makefile.HP-UX             Makefile.Paragon           Makefile.UXPDS
Makefile.HP-UX.10.x        Makefile.RISCos            Makefile.Utah
Makefile.IRIX              Makefile.SCO               Makefile.dgux
Makefile.IRIX.5.x          Makefile.SCO.3.2v4.2       Makefile.dist
Makefile.IRIX64            Makefile.SVR4              Makefile.uts.systemV

Since we have thus far been successful, you can now go ahead and run makesendmail for real. Be prepared to interrupt it with a control-C, because we will need to tune your Makefile after it has been copied:



Configuration: os=SunOS, rel=4.1.4, rbase=4, arch=sun4, sfx=
Creating obj.SunOS.4.1.4.sun4 using Makefile.SunOS
Making dependencies in obj.SunOS.4.1.4.sun4
Making in obj.SunOS.4.1.4.sun4
cc -I. -O -I/usr/sww/include -DNDBM -DNEWDB -DNIS   -target sun4 -c  alias.c


The makesendmail script first creates a directory in which you will eventually build sendmail . It then (invisibly) creates links inside that directory to all the source files and to an appropriate Makefile . Finally, it starts to build sendmail . You interrupt the build with a control-C just after the first compiler line of output. From this point forward we will work inside that new directory, so cd into it:


cd obj.SunOS.4.1.4.sun4

As distributed, your newly created Makefile is not writable. But we may need to modify it, so we need to make it writable:


chmod u+w Makefile

There are three important reasons to modify your default Makefile . If you don't have the Berkeley db (3) library, you need to remove db support from your Makefile . If you are not connected to the Internet and are not running a named (8) name server, you need to eliminate DNS support from your Makefile . Finally, you need to read the comments inside your Makefile and make any changes suggested there.

2.4.1 Eliminate or Keep db Support?

If you have not installed the Berkeley db(8) library package, or do not know whether you have, you need to remove support for that package from your Makefile . Edit your Makefile and look for the line that begins with the word DBMDEF :

DBMDEF= -DNDBM -DNEWDB -DNIS                 
<- this line

 delete this from the line

Delete the string -DNEWDB from the DBMDEF line to form the following:

DBMDEF= -DNDBM -DNIS                        
 <- after delete

Next search for the line that begins with LIBS :

LIBS=   -ldb -ldbm -lresolv                
  <- this line (exact text may vary)

 delete this from the line

Delete the string -ldb from the LIBS= line to form the following:

LIBS=   -ldbm -lresolv                       
<- after delete

This completes the removal of Berkeley db (3) support from your Makefile .

If your site does support the Berkeley db(3) library package, you may still need to massage your Makefile . To include this support inside sendmail , you need to specify the correct include files and library path. Search for the line that begins with INCDIRS :

<- this line

# loader options 
LDOPTS= -Bstatic 

# library directories
<- and this line

You need to change both lines to contain the correct paths where you installed the Berkeley db (3) library. If you aren't sure about any of this information, you should eliminate support instead.





   <- new

# loader options 
LDOPTS= -Bstatic 

# library directories


<- new

As shown in the two preceding examples, we installed the Berkeley db (3) include files in /usr/local/include/db and the library in /usr/local/lib .

2.4.2 Eliminate DNS Support

If you are on a machine that does not support DNS (such as a home workstation that connects to the outside world exclusively via UUCP), you will need to exclude DNS support from sendmail . One way to tell whether your machine supports DNS is to run the nslookup (8) program. It may not be in your path, so if it is not found when you try to run it, you have to find it. Try looking in /usr/etc or /usr/sbin . If nslookup (8) hangs when you run it, your system probably does not support DNS. If it doesn't hang, its output will look like this. Just type Control-D to exit:



Default Server: localhost




If your system lacks DNS support, you must then redefine the value of NAMED_BIND as 0 in Makefile . One way to do that is to edit your Makefile and search for the line beginning with the string ENVDEF :


Append to that line the following string, which turns off DNS support inside sendmail :



append this

2.4.3 Other Massaging in Makefile

Independent of support for db (3) and DNS, your operating system may impose its own requirements. To discover whether it does and what they might be, edit your Makefile , and look through it for operating-system-specific comments. A sampling of the many such comments might look like this:

# you can use -O3 on AIX 3.2.4 or greater ONLY!            
<- Makefile.AIX

# use DGUX_5_4_2 for versions prior to 5.4.3.              
<- Makefile.DGUX

#  delete -l44bsd if you are not running BIND 4.9.x        
<- Makefile.SunOS.5.5

# define SPT_TYPE=SPT_NONE if you are using NEWS-OS 6.0.1  
<- Makefile.NEWS-OS.6.x

No matter which Makefile is yours, all customizing should be done before this line:

###################  end of user configuration flags  ######################

Unless you are an expert at compiling Makefiles , avoid changing anything after this line. You risk "breaking" your Makefile and ruining your ability to build.