* build.texinfo (HPUX): Make HPUX compiler flags simpler
[krb5.git] / doc / build.texinfo
1 @value{PRODUCT} uses a configuration system built using the Free
2 Software Foundation's @samp{autoconf} program.  This system makes
3 Kerberos V5 much simpler to build and reduces the amount of effort
4 required in porting Kerberos V5 to a new platform.
5
6 @menu
7 * Organization of the Source Directory::  Description of the source tree.
8 * Build Requirements::          How much disk space, etc. you need to
9                                            build Kerberos.
10 * Unpacking the Sources::       Preparing the source tree.
11 * Doing the Build::             Compiling Kerberos.
12 * Testing the Build::           Making sure Kerberos built correctly.
13 * Options to Configure::        Command-line options to Configure
14 * osconf.h::                    Header file-specific configurations
15 * Shared Library Support::      Building Shared Libraries for Kerberos V5
16 * OS Incompatibilities::        Special cases to watch for.
17 * Using Autoconf::              Modifying Kerberos V5's 
18                                             configuration scripts.
19 @end menu
20
21 @node Organization of the Source Directory, Build Requirements, Building Kerberos V5, Building Kerberos V5
22 @section Build Requirements
23
24 Below is a brief overview of the organization of the complete source
25 directory.  More detailed descriptions follow.
26
27 @table @b
28 @itemx appl
29 applications with @value{PRODUCT} extensions
30 @itemx clients
31 @value{PRODUCT} user programs
32 @itemx gen-manpages
33 manpages for @value{PRODUCT} and the @value{PRODUCT} login program
34 @itemx include
35 include files
36 @itemx kadmin
37 administrative interface to the Kerberos master database
38 @itemx kdc
39 the @value{PRODUCT} Authentication Service and Key Distribution Center
40 @itemx krb524
41 utilities for converting between Kerberos 4 and Kerberos 5
42 @itemx lib
43 libraries for use with/by @value{PRODUCT}
44 @itemx mac
45 source code for building @value{PRODUCT} on MacOS
46 @itemx prototype
47 templates for source code files
48 @itemx slave
49 utilities for propagating the database to slave KDCs
50 @itemx tests
51 test suite
52 @itemx util
53 various utilities for building/configuring the code, sending bug reports, etc.
54 @itemx windows
55 source code for building @value{PRODUCT} on Windows (see windows/README)
56 @end table
57
58 @menu
59 * The appl Directory::          
60 * The clients Directory::
61 * The gen-manpages Directory::
62 * The include Directory::
63 * The kadmin Directory::        
64 * The kdc Directory::           
65 * The krb524 Directory::        
66 * The lib Directory::
67 * The prototype Directory::
68 * The slave Directory::
69 * The util Directory::          
70 @end menu
71
72 @node The appl Directory, The clients Directory, Organization of the Source Directory, Organization of the Source Directory
73 @subsection The appl Directory
74
75 The Kerberos release provides certain UNIX utilities, modified to use
76 Kerberos authentication.  In the @i{appl/bsd} directory are the
77 Berkeley utilities @i{login}, @i{rlogin}, @i{rsh}, and @i{rcp}, as well as
78 the associated daemons @i{kshd} and @i{klogind}.  The @i{login} program
79 obtains ticket-granting tickets for users upon login; the other utilities
80 provide authenticated Unix network services.
81
82 The @i{appl} directory also contains Kerberized telnet and ftp programs,
83 as well as sample Kerberos application client and server programs.
84
85 @node The clients Directory, The gen-manpages Directory, The appl Directory, Organization of the Source Directory
86 @subsection The clients Directory
87
88 This directory contains the code for several user-oriented programs.
89
90 @table @b
91 @itemx kdestroy
92 This program destroys the user's active Kerberos authorization tickets.
93 @value{COMPANY} recommends that users @code{kdestroy} before logging out.
94
95 @itemx kinit
96 This program prompts users for their Kerberos principal name and password,
97 and attempts to get an initial ticket-granting-ticket for that principal.
98
99 @itemx klist
100 This program lists the Kerberos principal and Kerberos tickets held in
101 a credentials cache, or the keys held in a keytab file.
102
103 @itemx kpasswd
104 This program changes a user's Kerberos password.
105
106 @itemx ksu
107 This program is a Kerberized verions of the @code{su} program that is
108 meant to securely change the real and effective user ID to that of the
109 target user and to create a new security context.
110
111 @itemx kvno
112 This program acquires a service ticket for the specified Kerberos
113 principals and prints out the key version numbers of each.
114 @end table
115
116 @node The gen-manpages Directory, The include Directory, The clients Directory, Organization of the Source Directory
117 @subsection The gen-manpages Directory
118
119 There are two manual pages in this directory.  One is an introduction
120 to the Kerberos system.  The other describes the @code{.k5login} file
121 which allows users to give access with their UID to other users
122 authenticated by the Kerberos system.
123
124 @node The include Directory, The kadmin Directory, The gen-manpages Directory, Organization of the Source Directory
125 @subsection The include Directory
126
127 This directory contains the @i{include} files needed to build the
128 Kerberos system.
129
130 @node The kadmin Directory, The kdc Directory, The include Directory, Organization of the Source Directory
131 @subsection The kadmin Directory
132
133 In this directory is the code for the utilities @code{kadmin},
134 @code{kadmin.local}, @code{kdb5_util}, and @code{ktutil}.
135 @code{ktutil} is the Kerberos keytab file maintenance utility from
136 which a Kerberos administrator can read, write, or edit entries in a
137 Kerberos V5 keytab or Kerberos V4 srvtab.  @code{kadmin} and
138 @code{kadmin.local} are command-line interfaces to the Kerberos V5 KADM5
139 administration system.  @code{kadmin.local} runs on the master KDC and
140 does not use Kerberos to authenticate to the database, while
141 @code{kadmin} uses Kerberos authentication and an encrypted RPC.  The
142 two provide identical functionalities, which allow administrators to
143 modify the database of Kerberos principals.  @code{kdb5_util} allows
144 administrators to perform low-level maintenance procedures on Kerberos
145 and the KADM5 database.  With this utility, databases can be created,
146 destroyed, or dumped to and loaded from ASCII files.  It can also be
147 used to create master key stash files.
148
149 @node The kdc Directory, The krb524 Directory, The kadmin Directory, Organization of the Source Directory
150 @subsection The kdc Directory
151
152 This directory contains the code for the @code{krb5kdc} daemon, the
153 Kerberos Authentication Service and Key Distribution Center.
154
155 @node The krb524 Directory, The lib Directory, The kdc Directory, Organization of the Source Directory
156 @subsection The krb524 Directory
157
158 This directory contains the code for @code{krb524}, a service that
159 converts Kerberos V5 credentials into Kerberos V4 credentials suitable
160 for use with applications that for whatever reason do not use V5
161 directly.
162
163 @node The lib Directory, The prototype Directory, The krb524 Directory, Organization of the Source Directory
164 @subsection The lib Directory
165
166 The @i{lib} directory contain 10 subdirectories as well as some
167 definition and glue files.  The @i{crypto} subdirectory contains the
168 Kerberos V5 encryption library.  The @i{des425} subdirectory exports
169 the Kerberos V4 encryption API, and translates these functions into
170 calls to the Kerberos V5 encryption API.  The @i{gssapi} library
171 contains the Generic Security Services API, which is a library of
172 commands to be used in secure client-server communication.  The
173 @i{kadm5} directory contains the libraries for the KADM5 administration
174 utilities.  The Kerberos 5 database libraries are contained in
175 @i{kdb}.  The directories @i{krb4} and @i{krb5} contain the Kerberos 4
176 and Kerberos 5 APIs, respectively.  The @i{rpc} directory contains the
177 API for the Kerberos Remote Procedure Call protocol.
178
179 @node The prototype Directory, The slave Directory, The lib Directory, Organization of the Source Directory
180 @subsection The prototype Directory
181
182 This directory contains several template files.  The @code{prototype.h}
183 and @code{prototype.c} files contain the MIT copyright message and a
184 placeholder for the title and description of the file.
185 @code{prototype.h} also has a short template for writing @code{ifdef}
186 and @code{ifndef} preprocessor statements.  The @code{getopt.c} file
187 provides a template for writing code that will parse the options with
188 which a program was called.
189
190 @node The slave Directory, The util Directory, The prototype Directory, Organization of the Source Directory
191 @subsection The slave Directory
192
193 This directory contains code which allows for the propagation of the
194 Kerberos principal database from the master KDC to slave KDCs over an
195 encrypted, secure channel.  @code{kprop} is the program which actually
196 propagates the database dump file.  @code{kpropd} is the Kerberos V5
197 slave KDC update server which accepts connections from the @code{kprop}
198 program.  @code{kslave_update} is a script that takes the name of a
199 slave server, and propagates the database to that server if the
200 database has been modified since the last dump or if the database has
201 been dumped since the last propagation.
202
203 @node The util Directory,  , The slave Directory, Organization of the Source Directory
204 @subsection The util Directory
205
206 This directory contains several utility programs and libraries.  The
207 programs used to configure and build the code, such as @code{autoconf},
208 @code{lndir}, @code{kbuild}, @code{reconf},  and @code{makedepend},
209 are in this directory.  The @i{profile} directory contains most of the
210 functions which parse the Kerberos configuration files (@code{krb5.conf}
211 and @code{kdc.conf}).  Also in this directory are the Kerberos error table
212 library and utilities (@i{et}), the Sub-system library and utilities
213 (@i{ss}), database utilities (@i{db2}), pseudo-terminal utilities
214 (@i{pty}), and bug-reporting program @code{send-pr}.
215
216 @node Build Requirements, Unpacking the Sources, Organization of the Source Directory, Building Kerberos V5
217 @section Organization of the Source Directory
218
219 In order to build Kerberos V5, you will need approximately 60-70
220 megabytes of disk space.  The exact amount will vary depending on the
221 platform and whether the distribution is compiled with debugging symbol
222 tables or not.
223
224 If you wish to keep a separate @dfn{build tree}, which contains the compiled
225 @file{*.o} file and executables, separate from your source tree, you
226 will need a @samp{make} program which supports @samp{VPATH}, or
227 you will need to use a tool such as @samp{lndir} to produce a symbolic
228 link tree for your build tree.
229
230 @node Unpacking the Sources, Doing the Build, Build Requirements, Building Kerberos V5
231 @section Unpacking the Sources
232
233 The first step in each of these build procedures is to unpack the
234 source distribution.  The Kerberos V5 distribution comes in a tar file,
235 generally named @file{krb5-@value{RELEASE}.tar}, which contains a
236 compressed tar file consisting of the sources for all of Kerberos
237 (generally @file{krb5-@value{RELEASE}.tar.gz}) and a PGP signature for
238 this source tree (generally @file{krb5-@value{RELEASE}.tar.gz.asc}).
239 @value{COMPANY} highly recommends that you verify the integrity of the
240 source code using this signature.
241
242 Unpack the compressed tar file in some directory, such as
243 @file{/u1/krb5-@value{RELEASE}}.  (In the rest of this document, we
244 will assume that you have chosen to unpack the Kerberos V5 source
245 distribution in this directory.  Note that the tarfiles will by default
246 all unpack into the @file{./krb5-@value{RELEASE}} directory, so that if
247 your current directory is @file{/u1} when you unpack the tarfiles, you
248 will get @file{/u1/krb5-@value{RELEASE}/src}, etc.)
249
250
251 @node Doing the Build, Testing the Build, Unpacking the Sources, Building Kerberos V5
252 @section Doing the Build
253
254 You have a number of different options in how to build Kerberos.  If you
255 only need to build Kerberos for one platform, using a single directory
256 tree which contains both the source files and the object files is the
257 simplest.  However, if you need to maintain Kerberos for a large number
258 of platforms, you will probably want to use separate build trees for
259 each platform. We recommend that you look at @ref{OS
260 Incompatibilities}, for notes that we have on particular operating
261 systems. 
262
263 @menu
264 * Building Within a Single Tree::  
265 * Building with Separate Build Directories::  
266 * Building using lndir::        
267 @end menu
268
269 @node Building Within a Single Tree, Building with Separate Build Directories, Doing the Build, Doing the Build
270 @subsection Building Within a Single Tree
271
272 If you don't want separate build trees for each architecture, then
273 use the following abbreviated procedure.
274
275 @enumerate
276 @item
277  @code{cd /u1/krb5-@value{RELEASE}/src}
278 @item
279  @code{./configure}
280 @item
281  @code{make}
282 @end enumerate
283
284 That's it!
285
286 @node Building with Separate Build Directories, Building using lndir, Building Within a Single Tree, Doing the Build
287 @subsection Building with Separate Build Directories
288
289 If you wish to keep separate build directories for each platform, you
290 can do so using the following procedure.  (Note, this requires that your
291 @samp{make} program support @samp{VPATH}.  GNU's make will provide this
292 functionality, for example.)  If your @samp{make} program does not
293 support this, see the next section.
294
295 For example, if you wish to create a build directory for @code{pmax} binaries
296 you might use the following procedure:
297
298 @enumerate
299 @item 
300 @code{mkdir /u1/krb5-@value{RELEASE}/pmax}
301 @item
302  @code{cd /u1/krb5-@value{RELEASE}/pmax}
303 @item
304  @code{../src/configure}
305 @item
306  @code{make}
307 @end enumerate
308
309 @node Building using lndir,  , Building with Separate Build Directories, Doing the Build
310 @subsection Building Using @samp{lndir}
311
312 If you wish to keep separate build directories for each platform, and
313 you do not have access to a @samp{make} program which supports @samp{VPATH},
314 all is not lost.  You can use the @samp{lndir} program to create
315 symbolic link trees in your build directory.
316
317 For example, if you wish to create a build directory for solaris binaries
318 you might use the following procedure:
319
320 @enumerate
321 @item
322  @code{mkdir /u1/krb5-@value{RELEASE}/solaris}
323 @item
324  @code{cd /u1/krb5-@value{RELEASE}/solaris}
325 @item
326  @code{/u1/krb5-@value{RELEASE}/src/util/lndir `pwd`/../src}
327 @item
328  @code{./configure}
329 @item
330  @code{make}
331 @end enumerate
332
333 You must give an absolute pathname to @samp{lndir} because it has a bug that
334 makes it fail for relative pathnames. Note that this version differs
335 from the latest version as distributed and installed by the XConsortium
336 with X11R6. Either version should be acceptable.
337
338 @node Testing the Build, Options to Configure, Doing the Build, Building Kerberos V5
339 @section Testing the Build
340
341 The Kerberos V5 distribution comes with built-in regression tests.  To
342 run them, simply type the following command while in the top-level build
343 directory (i.e., the directory where you sent typed @samp{make} to start
344 building Kerberos; see @ref{Doing the Build}.): 
345
346 @example
347 % make check
348 @end example
349
350 @menu
351 * The DejaGnu Tests::           
352 * The KADM5 Tests::             
353 @end menu
354
355 @node The DejaGnu Tests, The KADM5 Tests, Testing the Build, Testing the Build
356 @subsection The DejaGnu Tests 
357
358 Some of the built-in regression tests are setup to use the DejaGnu
359 framework for running tests. These tests tend to be more comprehensive
360 than the normal built-in tests as they setup test servers and test
361 client/server activities. 
362
363 DejaGnu may be found wherever GNU software is archived.  
364
365 Most of the tests are setup to run as a non-privledged user.  For some
366 of the krb-root tests to work properly, either (a) the user running the
367 tests must not have a .k5login file in the home directory or (b) the
368 .k5login file must contain an entry for @code{<username>@@KRBTEST.COM}.
369 There are two series of tests (@samp{rlogind} and @samp{telnetd}) which
370 require the ability to @samp{rlogin} as root to the local
371 machine. Admittedly, this does require the use of a @file{.rhosts} file
372 or some authenticated means. @footnote{If you are fortunate enough to
373 have a previous version of Kerberos V5 or V4 installed, and the Kerberos
374 rlogin is first in your path, you can setup @file{.k5login} or
375 @file{.klogin} respectively to allow you access.}
376
377 If you cannot obtain root access to your machine, all the other tests
378 will still run. Note however, with DejaGnu 1.2, the "untested testcases"
379 will cause the testsuite to exit with a non-zero exit status which
380 @samp{make} will consider a failure of the testing process. Do not worry
381 about this, as these tests are the last run when @samp{make check} is
382 executed from the top level of the build tree.  This problem does not
383 exist with DejaGnu 1.3.
384
385 @node The KADM5 Tests,  , The DejaGnu Tests, Testing the Build
386 @subsection The KADM5 Tests
387
388 Regression tests for the KADM5 system, including the GSS-RPC, KADM5
389 client and server libraries, and kpasswd, are also included in this
390 release.  Each set of KADM5 tests is contained in a sub-directory called
391 @code{unit-test} directly below the system being tested.  For example,
392 lib/rpc/unit-test contains the tests for GSS-RPC.  The tests are all
393 based on DejaGnu (but they are not actually called part of "The DejaGnu
394 tests," whose naming predates the inclusion of the KADM5 system).  In
395 addition, they require the Tool Command Language (TCL) header files and
396 libraries to be available during compilation and some of the tests also
397 require Perl in order to operate.  If all of these resources are not
398 available during configuration, the KADM5 tests will not run.  The TCL
399 installation directory can be specified with the @code{--with-tcl}
400 configure option.  (See @xref{Options to Configure}.)  The runtest and
401 perl programs must be in the current execution path.
402
403 If you install DejaGnu, TCL, or Perl after configuring and building
404 Kerberos and then want to run the KADM5 tests, you will need to
405 re-configure the tree and run @code{make} at the top level again to make
406 sure all the proper programs are built.  To save time, you actually only
407 need to reconfigure and build in the directories src/kadmin/testing,
408 src/lib/rpc, src/lib/kadm5.
409
410 @node Options to Configure, osconf.h, Testing the Build, Building Kerberos V5
411 @section Options to Configure 
412
413 There are a number of options to @samp{configure} which you can use to
414 control how the Kerberos distribution is built.  The following table
415 lists the most commonly used options to Kerberos V5's @samp{configure}
416 program.
417
418 @table @code
419
420 @item --help
421
422 Provides help to configure. This will list the set of commonly used
423 options for building Kerberos.
424
425 @item --prefix=PREFIX
426
427 By default, Kerberos will install the package's files rooted at
428 `/usr/local' as in `/usr/local/bin', `/usr/local/sbin', etc. If you
429 desire a different location, use this option.
430
431 @item --exec-prefix=EXECPREFIX
432
433 This option allows one to separate the architecture independent programs
434 from the configuration files and manual pages. 
435
436 @item --localstatedir=LOCALSTATEDIR
437
438 This option sets the directory for locally modifiable single-machine
439 data.  In Kerberos, this mostly is useful for setting a location for the
440 KDC data files, as they will be installed in
441 @code{LOCALSTATEDIR/krb5kdc}, which is by default
442 @code{PREFIX/var/krb5kdc}.
443
444 @item CC=COMPILER
445
446 Use @code{COMPILER} as the C compiler.
447
448 @item CFLAGS=FLAGS
449
450 Use @code{FLAGS} as the default set of C compiler flags.
451
452 Note that if you use the native Ultrix compiler on a
453 DECstation you are likely to lose if you pass no flags to cc; md4.c
454 takes an estimated 3,469 billion years to compile if you provide neither
455 the @samp{-g} flag nor the @samp{-O} flag to @samp{cc}.
456
457 @item CPPFLAGS=CPPOPTS 
458
459 Use @code{CPPOPTS} as the default set of C preprocessor flags.  The most
460 common use of this option is to select certain @code{#define}'s for use
461 with the operating system's include files.
462
463 @item LD=LINKER
464
465 Use @code{LINKER} as the default loader if it should be different from C
466 compiler as specified above.
467
468 @item LDFLAGS=LDOPTS
469
470 This option allows one to specify optional arguments to be passed to the
471 linker. This might be used to specify optional library paths.
472
473 @item  --with-krb4
474
475 This option enables Kerberos V4 backwards compatibility using the
476 builtin Kerberos V4 library.
477
478 @item  --with-krb4=KRB4DIR 
479
480 This option enables Kerberos V4 backwards compatibility using a
481 pre-existing Kerberos V4 installation.  The directory specified by
482 @code{KRB4DIR} specifies where the V4 header files should be found
483 (@file{KRB4DIR/include}) as well as where the V4 Kerberos library should
484 be found (@file{KRB4DIR/lib}).
485
486 @item  --without-krb4
487
488 Disables Kerberos V4 backwards compatibility. This prevents Kerberos V4
489 clients from using the V5 services including the KDC. This would be
490 useful if you know you will never install or need to interact with V4
491 clients. 
492
493 @item --with-netlib[=libs]
494
495 Allows for suppression of or replacement of network libraries. By
496 default, Kerberos V5 configuration will look for @code{-lnsl} and
497 @code{-lsocket}. If your operating system has a broken resolver library
498 (see @ref{Solaris versions 2.0 through 2.3}) or fails to pass the tests in
499 @file{src/tests/resolv} you will need to use this option.
500
501 @item --with-tcl=TCLPATH
502
503 Some of the unit-tests in the build tree rely upon using a program in
504 Tcl. The directory specified by @code{TCLPATH} specifies where the Tcl
505 header file (@file{TCLPATH/include/tcl.h} as well as where the Tcl
506 library should be found (@file{TCLPATH/lib}).
507
508 @item --enable-shared
509
510 This option will turn on the building and use of shared library objects
511 in the Kerberos build. This option is only supported on certain
512 platforms. 
513
514 @item --enable-dns
515 @item --enable-dns-for-kdc
516 @item --enable-dns-for-realm
517
518 Enable the use of DNS to look up a host's Kerberos realm, or a realm's
519 KDCs, if the information is not provided in krb5.conf. See @ref{Hostnames
520 for the Master and Slave KDCs} for information about using DNS to
521 locate the KDCs, and @ref{Mapping Hostnames onto Kerberos Realms} for
522 information about using DNS to determine the default realm.  By default,
523 DNS lookups are enabled for the former but not for the latter.
524
525 @item --enable-kdc-replay-cache
526
527 Enable a cache in the KDC to detect retransmitted messages, and resend
528 the previous responses to them.  This protects against certain types of
529 attempts to extract information from the KDC through some of the
530 hardware preauthentication systems.
531
532 @item --with-system-et
533
534 Use an installed version of the error-table support software, the
535 @samp{compile_et} program, the @file{com_err.h} header file and the
536 @file{com_err} library.  If these are not in the default locations,
537 you may wish to specify @code{CPPFLAGS=-I/some/dir} and
538 @code{LDFLAGS=-L/some/other/dir} options at configuration time as
539 well.
540
541 If this option is not given, a version supplied with the Kerberos
542 sources will be built and installed along with the rest of the
543 Kerberos tree, for Kerberos applications to link against.
544
545 @item --with-system-ss
546
547 Use an installed version of the subsystem command-line interface
548 software, the @samp{mk_cmds} program, the @file{ss/ss.h} header file
549 and the @file{ss} library.  If these are not in the default locations,
550 you may wish to specify @code{CPPFLAGS=-I/some/dir} and
551 @code{LDFLAGS=-L/some/other/dir} options at configuration time as
552 well.  See also the @samp{SS_LIB} option.
553
554 If this option is not given, the @file{ss} library supplied with the
555 Kerberos sources will be compiled and linked into those programs that
556 need it; it will not be installed separately.
557
558 @item SS_LIB=libs...
559
560 If @samp{-lss} is not the correct way to link in your installed
561 @file{ss} library, for example if additional support libraries are
562 needed, specify the correct link options here.  Some variants of this
563 library are around which allow for Emacs-like line editing, but
564 different versions require different support libraries to be
565 explicitly specified.
566
567 This option is ignored if @samp{--with-system-ss} is not specified.
568
569 @item --with-system-db
570
571 Use an installed version of the Berkeley DB package, which must
572 provide an API compatible with version 1.85.
573
574 If this option is not given, a version supplied with the Kerberos
575 sources will be built and installed.  (We are not updating this
576 version at this time because of licensing issues with newer versions
577 that we haven't investigated sufficiently yet.)
578
579 @item DB_HEADER=headername.h
580
581 If @samp{db.h} is not the correct header file to include to compile
582 against the Berkeley DB 1.85 API, specify the correct header file name
583 with this option.  For example, @samp{DB_HEADER=db3/db_185.h}.
584
585 @item DB_LIB=libs...
586
587 If @samp{-ldb} is not the correct library specification for the
588 Berkeley DB library version to be used, override it with this option.
589 For example, @samp{DB_LIB=-ldb-3.3}.
590
591 @end table
592
593 For example, in order to configure Kerberos on a Solaris machine using
594 the @samp{suncc} compiler with the optimizer turned on, run the configure
595 script with the following options:
596
597 @example
598 % ./configure CC=suncc CFLAGS=-O
599 @end example
600
601 For a slightly more complicated example, consider a system where
602 several packages to be used by Kerberos are installed in
603 @samp{/usr/foobar}, including Berkeley DB 3.3, and an @samp{ss}
604 library that needs to link against the @samp{curses} library.  The
605 configuration of Kerberos might be done thus:
606
607 @example
608 % ./configure CPPFLAGS=-I/usr/foobar/include LDFLAGS=-L/usr/foobar/lib \
609               --with-system-et --with-system-ss --with-system-db \
610               SS_LIB='-lss -lcurses' \
611               DB_HEADER=db3/db_185.h DB_LIB=-ldb-3.3
612 @end example
613
614 In previous releases, @code{--with-} options were used to specify the
615 compiler and linker and their options.
616
617 @node osconf.h, Shared Library Support, Options to Configure, Building Kerberos V5
618 @section @file{osconf.h}
619
620 There is one configuration file which you may wish to edit to control
621 various compile-time parameters in the Kerberos distribution:
622 @file{include/krb5/stock/osconf.h}. The list that follows is by no means
623 complete, just some of the more interesting variables.
624
625 Please note: The former configuration file @file{config.h} no longer
626 exists as its functionality has been merged into the auto-configuration
627 process. @xref{Options to Configure}.
628
629
630 @table @code
631
632 @item DEFAULT_PROFILE_PATH
633
634 The pathname to the file which contains the profiles for the known realms,
635 their KDCs, etc.  The default value is @value{DefaultDefaultProfilePath}.
636
637 The profile file format is no longer the same format as Kerberos V4's
638 @file{krb.conf} file. 
639
640 @item DEFAULT_KEYTAB_NAME
641
642 The type and pathname to the default server keytab file (the
643 equivalent of Kerberos V4's @file{/etc/srvtab}).  The default is
644 @value{DefaultDefaultKeytabName}.
645
646 @item DEFAULT_KDC_ENCTYPE
647
648 The default encryption type for the KDC.  The default value is
649 @value{DefaultMasterKeyType}.
650
651 @item KDCRCACHE
652
653 The name of the replay cache used by the KDC.  The default value is
654 @value{DefaultKDCRCache}.
655
656 @item RCTMPDIR
657
658 The directory which stores replay caches.  The default is to try
659 @value{DefaultRCTmpDirs}.
660
661 @item DEFAULT_KDB_FILE
662
663 The location of the default database.  The default value is
664 @value{DefaultDatabaseName}.
665
666 @end table
667
668 @node Shared Library Support, OS Incompatibilities, osconf.h, Building Kerberos V5
669 @section Shared Library Support
670
671 Shared library support is provided for a few operating systems. There
672 are restrictions as to which compiler to use when using shared
673 libraries. In all cases, executables linked with the shared libraries in
674 this build process will have built in the location of the libraries,
675 therefore obliterating the need for special LD_LIBRARY_PATH, et al environment
676 variables when using the programs. Except where noted, multiple versions
677 of the libraries may be installed on the same system and continue to
678 work.
679
680 Currently the supported platforms are Solaris 2.6-2.9 (aka SunOS
681 5.6-5.9), Irix 6.5, Redhat Linux, MacOS 8-10, and Microsoft Windows
682 (using DLLs).
683
684 Shared library support has been tested on the following platforms but
685 not exhaustively (they have been built but not necessarily tested in an
686 installed state): Tru64 (aka Alpha OSF/1 or Digital Unix) 4.0, and
687 HP/UX 10.20.
688
689 Platforms for which there is shared library support but not significant
690 testing include FreeBSD, OpenBSD, AIX (4.3.3), Linux, NetBSD 1.4.x
691 (i386), and SunOS 4.x.
692
693 To enable shared libraries on the above platforms, run the configure
694 script with the option @samp{--enable-shared}.
695
696 @ifset notdef
697
698 XXX What does this mean?
699
700 One special note is that if the Kerberos V4 compatibility is compiled
701 in, you @b{must not} specify an alternate Kerberos V4 library from the
702 one in the tree or you will be missing references.
703
704 @end ifset
705
706 @node OS Incompatibilities, Using Autoconf, Shared Library Support, Building Kerberos V5
707 @section Operating System Incompatibilities
708
709 This section details operating system incompatibilities with Kerberos V5
710 which have been reported to the developers at MIT.  If you find
711 additional incompatibilities, and/or discover work arounds to such
712 problems, please send a report via the @code{krb5-send-pr} program.
713 Thanks!
714
715 @menu
716 * AIX::                         
717 * Alpha OSF/1 V1.3::            
718 * Alpha OSF/1 (Digital Unix) V2.0++::  
719 * BSDI::                        
720 * HPUX::                        
721 * Solaris versions 2.0 through 2.3::  
722 * Solaris 2.X::                 
723 * SGI Irix 5.X::                
724 * Ultrix 4.2/3::                
725 @end menu
726
727 @node AIX, Alpha OSF/1 V1.3, OS Incompatibilities, OS Incompatibilities
728 @subsection AIX
729
730 The AIX 3.2.5 linker dumps core trying to build a shared
731 @samp{libkrb5.a} produced with the GNU C compiler.  The native AIX
732 compiler works fine.  This problem is fixed using the AIX 4.1 linker.
733
734 @node Alpha OSF/1 V1.3, Alpha OSF/1 (Digital Unix) V2.0++, AIX, OS Incompatibilities
735 @subsection Alpha OSF/1 V1.3
736
737 Using the native compiler, compiling with the @samp{-O} compiler flag
738 causes the @code{asn.1} library to be compiled incorrectly.  
739
740 Using GCC version 2.6.3 or later instead of the native compiler will also work
741 fine, both with or without optimization.
742
743 @node Alpha OSF/1 (Digital Unix) V2.0++, BSDI, Alpha OSF/1 V1.3, OS Incompatibilities
744 @subsection Alpha OSF/1 V2.0++
745
746 There used to be a bug when using the native compiler in compiling
747 @file{md4.c} when compiled without either the @samp{-O} or @samp{-g}
748 compiler options.  We have changed the code and there is no problem
749 under V2.1, but we do not have access to V2.0 to test and see if the
750 problem would exist there. (We welcome feedback on this issue). There
751 was never a problem in using GCC version 2.6.3.
752
753 In version 3.2 and beyond of the operating system, we have not seen any
754 problems with the native compiler. 
755
756 @c @node Alpha Tru64 UNIX 5.0
757 @c @subsection Alpha Tru64 UNIX 5.0
758 @c ... login.krb5 problems
759
760 @node BSDI, HPUX, Alpha OSF/1 (Digital Unix) V2.0++, OS Incompatibilities
761 @subsection BSDI
762
763 BSDI versions 1.0 and 1.1 reportedly has a bad @samp{sed} which causes
764 it to go into an infinite loop during the build.  The work around is
765 to use a @samp{sed} from somewhere else, such as GNU.  (This may be
766 true for some versions of other systems derived from BSD 4.4, such as
767 NetBSD and FreeBSD.)
768
769 @node HPUX, Solaris versions 2.0 through 2.3, BSDI, OS Incompatibilities
770 @subsection HPUX
771
772 The native (bundled) compiler for HPUX currently will not work,
773 because it is not a full ANSI C compiler.  The optional ANSI C
774 compiler should work as long as you give it the @samp{-Ae} flag
775 (i.e. @samp{./configure CC='cc -Ae}).  This is equivalent to
776 @samp{./configure CC='c89 -D_HPUX_SOURCE'}, which was the previous
777 recommendation.  This has only been tested recently for HPUX 10.20.
778
779 @node Solaris versions 2.0 through 2.3, Solaris 2.X, HPUX, OS Incompatibilities
780 @subsection Solaris versions 2.0 through 2.3
781
782 The @code{gethostbyname()} routine is broken; it does not return a fully
783 qualified domain name, even if you are using the Domain Name Service
784 routines.  Since Kerberos V5 uses the fully qualified domain name as the
785 second component of a service principal (i.e,
786 @samp{host/tsx-11.mit.edu@@ATHENA.MIT.EDU}), this causes problems for servers
787 who try to figure out their own fully qualified domain name.  
788
789 Workarounds:  
790
791 @enumerate
792
793 @item
794    Supply your own resolver library. (such as bind-4.9.3pl1 available
795 from ftp.vix.com)
796
797 @item
798    Upgrade to Solaris 2.4
799
800 @item
801    Make sure your /etc/nsswitch.conf has `files' before `dns' like:
802
803 @example
804 hosts:      files dns
805 @end example
806
807 and then in /etc/hosts, make sure there is a line with your
808 workstation's IP address and hostname, with the fully qualified domain
809 name first.  Example:
810
811 @example
812 18.172.1.4      dcl.mit.edu dcl
813 @end example
814
815 Note that making this change may cause other programs in your
816 environment to break or behave differently.
817
818 @end enumerate
819
820 @node Solaris 2.X, SGI Irix 5.X, Solaris versions 2.0 through 2.3, OS Incompatibilities
821 @subsection Solaris 2.X
822
823 You @b{must} compile Kerberos V5 without the UCB compatibility
824 libraries.  This means that @file{/usr/ucblib} must not be in the
825 LD_LIBRARY_PATH environment variable when you compile it.  Alternatively
826 you can use the @code{-i} option to @samp{cc}, by using the specifying
827 @code{CFLAGS=-i} option to @samp{configure}.
828
829 If you are compiling for a 64-bit execution environment, you may need
830 to configure with the option @code{CFLAGS="-D_XOPEN_SOURCE=500
831 -D__EXTENSIONS__"}.  This is not well tested; at MIT we work primarily
832 with the 32-bit execution environment.
833
834 @node SGI Irix 5.X, Ultrix 4.2/3, Solaris 2.X, OS Incompatibilities
835 @subsection SGI Irix 5.X
836
837 If you are building in a tree separate from the source tree, the vendors
838 version of make does not work properly with regards to
839 @samp{VPATH}. It also has problems with standard inference rules in 5.2
840 (not tested yet in 5.3) so one needs to use GNU's make.
841
842 Under 5.2, there is a bug in the optional System V @code{-lsocket}
843 library in which the routine @code{gethostbyname()} is broken. The
844 system supplied version in @code{-lc} appears to work though so one may
845 simply specify @code{--with-netlib} option to @samp{configure}. 
846
847 In 5.3, @code{gethostbyname()} is no longer present in @code{-lsocket} and
848 is no longer an issue. 
849
850 @node Ultrix 4.2/3,  , SGI Irix 5.X, OS Incompatibilities
851 @subsection Ultrix 4.2/3
852
853 The DEC MIPS platform currently will not support the native compiler,
854 since the Ultrix compiler is not a full ANSI C compiler.  You should use
855 GCC instead.
856
857 @ifset notdef
858
859 On the DEC MIPS platform, using the native compiler, @file{md4.c} and
860 @file{md5.c} can not be compiled with the optimizer set at level 1.
861 That is, you must specify either @samp{CFLAGS=-O} and
862 @samp{CFLAGS=-g} to configure.  If you don't specify either, the
863 compile will never complete.
864
865 The optimizer isn't hung; it just takes an exponentially long time.
866 Compiling 6 out of the 48 algorithmic steps takes 3 seconds; compiling 7
867 steps takes 9 seconds; compiling 8 steps takes 27 seconds, and so on.
868 Calculations estimate it will finish in approximately 3,469 billion
869 years....
870
871 Using GCC instead of the native compiler will also work fine, both with
872 or without optimization.
873
874 @end ifset
875
876 @node Using Autoconf,  , OS Incompatibilities, Building Kerberos V5
877 @section Using @samp{Autoconf}
878
879 (If you are not a developer, you can skip this section.)
880
881 In most of the Kerberos V5 source directories, there is a
882 @file{configure} script which automatically determines the compilation
883 environment and creates the proper Makefiles for a particular
884 platform.  These @file{configure} files are generated using
885 @samp{autoconf}, which can be found in the @file{src/util/autoconf}
886 directory in the distribution.
887
888 Normal users will not need to worry about running @samp{autoconf}; the
889 distribution comes with the @file{configure} files already prebuilt.
890 Developers who wish to modify the @file{configure.in} files should see
891 @ref{Top, , Overview, autoconf, The Autoconf Manual}.  
892
893 Note that in order to run @samp{autoconf}, you must have GNU @samp{m4}
894 in your path.  Before you use the @samp{autoconf} in the Kerberos V5
895 source tree, you may also need to run @samp{configure}, and then run
896 @samp{make} in the @file{src/util/autoconf} directory in order to
897 properly set up @samp{autoconf}.
898
899 One tool which is provided for the convenience of developers can be
900 found in @file{src/util/reconf}.  This program should be run while the
901 current directory is the top source directory.  It will automatically
902 rebuild any @file{configure} files which need rebuilding.  If you know
903 that you have made a change that will require that all the
904 @file{configure} files need to be rebuilt from scratch, specify the
905 @code{--force} option:
906
907 @example
908 % cd /u1/krb5-@value{RELEASE}/src
909 % ./util/reconf --force
910 @end example
911
912 The developmental sources are a raw source tree (before it's been packaged
913 for public release), without the pre-built @file{configure} files.
914 In order to build from such a source tree, you must do:
915
916 @example
917 % cd krb5/util/autoconf
918 % ./configure
919 % make
920 % cd ../..
921 % util/reconf
922 @end example
923
924 Then follow the instructions for building packaged source trees (above).
925 To install the binaries into a binary tree, do:
926
927 @example
928 % cd /u1/krb5-@value{RELEASE}/src
929 % make all
930 % make install DESTDIR=somewhere-else
931 @end example
932