dvitomp fix from Akira
[mplib] / src / texk / kpathsea / install.texi
1 @ifclear version
2 @defcodeindex cm
3 @defcodeindex fl
4 @defcodeindex op
5 @end ifclear
6
7 @node Installation
8 @chapter Installation
9
10 @cindex installation
11 @cindex configuration
12 @cindex compilation
13
14 @ifset version
15 (A copy of this chapter is in the distribution file @file{kpathsea/INSTALL}.)
16 @end ifset
17
18 The procedure for Kpathsea (and Web2c, etc.) configuration and
19 installation follows.  If you encounter trouble, see @ref{Common
20 problems}, a copy of which is in the file @file{kpathsea/BUGS}.
21
22 @menu
23 * Simple installation::      If you just want to do it.
24 * Custom installation::      If you want to change things around.
25 * Security::                 Who can write what files, etc.
26 * TeX directory structure::  Managing the horde of TeX input files.
27 * unixtex.ftp::              Getting software via FTP, on CD-ROM, or on tape.
28 * Reporting bugs::           Where and how to report bugs.
29 @end menu
30
31
32 @node Simple installation
33 @section Simple installation
34
35 @cindex simple installation
36 @cindex installation, simple
37
38 @cindex precompiled executables, instead of installation
39 @cindex installation, getting executables instead of
40 Installing @TeX{} and friends for the first time can be a daunting
41 experience.  Thus, you may prefer to skip this whole thing and just get
42 precompiled executables: see @ref{unixtex.ftp}.
43
44 This section explains what to do if you wish to take the defaults for
45 everything, and generally to install in the simplest possible way.  Most
46 steps here refer to corresponding subsection in the next section which
47 explains how to override defaults and generally gives more details.
48
49 By default everything will be installed under @file{/usr/local} and the
50 following discussion assumes this.  However, if you already have @TeX{}
51 installed, its location is used to derive the directory under which
52 everything is to be installed.
53
54 @enumerate
55 @item
56 Be sure you have enough disk space: approximately 8 megabytes for the
57 compressed archives, 15MB for sources, 50MB for compilation, 40MB for
58 the (initial) installed system (including library files).  @xref{Disk
59 space}.
60
61 @item
62 Retrieve these distribution archives:
63 @table @url
64 @item ftp://ftp.tug.org/tex/texk.tar.gz
65 These are the sources, which you will be compiling. 
66
67 @item ftp://ftp.tug.org/tex/texklib.tar.gz
68 This is a basic set of input files.  You should unpack it in the
69 directory @file{/usr/local/share}; doing so will create a @file{texmf}
70 subdirectory there.
71 @end table
72
73 These archives are mirrored on the CTAN hosts, in the
74 @file{systems/web2c} directory.
75
76 @noindent @xref{Kpathsea application distributions}.
77
78 @item
79 When using the default search paths, there is no need to edit any
80 distribution files. @xref{Changing search paths}.
81
82 @item
83 At the top level of the distribution, run @samp{sh configure}.  (If you
84 have the GNU Bash shell installed, run @samp{bash configure}.)
85 @xref{Running configure}.
86
87 @item
88 @samp{make}. @xref{Running make}.  If you are using a BSD 4.4 system
89 such as FreeBSD or NetBSD, you may have to use GNU make (often installed
90 in @file{/usr/local/bin}), not the BSD make.
91
92 @item 
93 @samp{make install}. @xref{Installing files}.
94
95 @item
96 @samp{make distclean}. @xref{Cleaning up}.
97
98 @item
99 Set up a cron job to rebuild the filename database that makes searching
100 faster.  This line will rebuild it every midnight:
101 @example
102 0 0 * * * cd /usr/local/share/texmf && @var{/bindir}/mktexlsr
103 @end example
104 @xref{Filename database generation}, and @ref{Filename database}.
105
106 @item
107 @cindex printer configuration files
108 @cindex PostScript fonts, additional
109 @cindex color printers, configuring
110 If you're installing Dvips, you also need to set up configuration files
111 for your printers and make any additional PostScript fonts available.
112 @xref{Installation,,, dvips, Dvips}.  If you have any color printers,
113 see @ref{Color device configuration,,, dvips, Dvips}.
114
115 @item
116 The first time you run a DVI driver, a bunch of PK fonts will be built
117 by Metafont via @code{mktexpk} (and added to the filename database).
118 This will take some time.  Don't be alarmed; they will created only this
119 first time (unless something is wrong with your path definitions).
120
121 By default, @code{mktexpk} will create these fonts in a hierarchy
122 under @file{/var/tmp/texfonts}; it simply assumes that @file{/var/tmp}
123 exists and is globally writable.  If you need a different arrangement,
124 see @ref{mktex configuration}.
125
126 @xref{mktex scripts}.
127
128 @item
129 @cindex fonts, being created
130 @pindex mktexpk @r{, initial runs}
131 @cindex tests, simple
132 For some simple tests, try @samp{tex story \\bye} and @samp{latex
133 sample2e}.  Then run @file{xdvi story} or @file{dvips sample2e} on the
134 resulting DVI files to preview/print the documents.  @xref{Installation
135 testing}.
136 @end enumerate
137
138
139 @node Custom installation
140 @section Custom installation
141
142 @cindex custom installation
143 @cindex installation, customized
144
145 Most sites need to modify the default installation procedure in some
146 way, perhaps merely changing the prefix from @samp{/usr/local}, perhaps
147 adding extra compiler or loader options to work around @code{configure}
148 bugs.  This section explains how to override default choices.  For
149 additional distribution-specific information:
150 @itemize @bullet
151 @item @file{dviljk/INSTALL}.
152 @item @xref{Installation,,,dvips,Dvips}.
153 @item @xref{Installation,,,web2c,Web2c}.
154 @item @file{xdvik/INSTALL}.
155 @end itemize
156
157 @cindex non-Unix operating systems
158 @cindex Amiga support
159 @cindex DOS support
160 @cindex OS/2 support
161 @cindex VMS support
162 These instructions are for Unix systems.  Other operating-system
163 specific distributions have their own instructions.  The code base
164 itself supports Amiga, DOS, OS/2, and VMS.
165
166
167 Following are the same steps as in the previous section (which describes
168 the simplest installation), but with much more detail.
169
170 @menu
171 * Disk space::                          
172 * Kpathsea application distributions::  
173 * Changing search paths::               
174 * Running configure::                   
175 * Running make::                        
176 * Installing files::                    
177 * Cleaning up::                         
178 * Filename database generation::        
179 * mktex scripts::                     
180 * Installation testing::               
181 @end menu
182
183
184 @node Disk space
185 @subsection Disk space
186
187 @cindex disk space, needed
188 @cindex total disk space
189 @cindex size of distribution archives
190 Here is a table showing the disk space needed for each distribution
191 (described in the next section).  The `(totals)' line reflects the
192 @samp{texk} source distribution and @samp{texklib}; the individual
193 distributions don't enter into it.  Sizes are in megabytes.  All numbers
194 are approximate.
195
196 @multitable {distribution} {.tar.gz} {unpacked} {compiled} {installed}
197 @item Distribution @tab .tar.gz @tab Unpacked @tab Compiled @tab Installed
198 @item dviljk   @tab   .9 @tab  3.8 @tab
199 @item dvipsk   @tab   .9 @tab  3.2 @tab
200 @item xdvik    @tab   .7 @tab  2.5 @tab
201 @item web2c    @tab  1.3 @tab  5.0 @tab
202 @item web      @tab  1.9 @tab  6.5 @tab    - @tab -
203 @item texk     @tab  7.5 @tab 32.1 @tab 95.3 @tab 33.5
204 @item texklib  @tab  6.3 @tab 15.0 @tab    - @tab 15.0
205 @item (totals) @tab 14.6 @tab 47.1 @tab 95.3 @tab 48.5
206 @end multitable
207
208
209 @node Kpathsea application distributions
210 @subsection Kpathsea application distributions
211
212 @cindex distributions, compiling simultaneously
213 @cindex version number, of Kpathsea
214 @cindex Kpathsea version number
215
216 @cindex distributions, not compiling
217 @cindex NeXT, lacking X11
218 @cindex X11, lacking on NeXT
219 The archive @url{ftp://ftp.tug.org/tex/texk.tar.gz} contains all of the
220 Kpathsea applications I maintain, and the library itself.  For example,
221 since NeXT does not generally support X11, you'd probably want to skip
222 @samp{xdvik} (or simply remove it after unpacking @file{texk.tar.gz}.
223 If you are not interested in all of them, you can also retrieve them
224 separately:
225
226 @cindex DVI drivers
227 @table @file
228 @item dviljk.tar.gz
229 @cindex PCL driver
230 @cindex LaserJet drive
231 DVI to PCL, for LaserJet printers.
232
233 @item dvipsk.tar.gz
234 @cindex PDF generation
235 @cindex PostScript driver
236 DVI to PostScript, for previewers, printers, or PDF generation.
237
238 @item web2c.tar.gz
239 The software needed to compile @TeX{} and friends.
240
241 @item web.tar.gz
242 The original WEB source files, also used in compilation.
243
244 @item xdvik.tar.gz
245 @cindex X11 previewer
246 DVI previewing under the X window system.
247
248 @end table
249
250 @cindex Babel
251 @cindex non-English typesetting
252 If you want to use the Babel La@TeX{} package for support of non-English
253 typesetting, you may need to retrieve additional files.  See the file
254 @file{install.txt} in the Babel distribution.
255
256
257 @node Changing search paths
258 @subsection Changing search paths
259
260 @cindex search paths, changing default
261 @cindex paths, changing default
262 @flindex texmf.in@r{, editing}
263 If the search paths for your installation differ from the standard
264 @TeX{} directory structure (@pxref{Top,, Introduction, tds, A Directory
265 Structure for @TeX{} files}), edit the file @file{kpathsea/texmf.in}
266 as desired, before running @code{configure}.  For example, if you have
267 all your fonts or macros in one big directory.
268
269 You may also wish to edit the file @file{mktex.cnf}, either before or
270 after installation, to control various aspects of @code{mktexpk} and
271 friends.  @xref{mktex configuration}.
272
273 You do not need to edit @file{texmf.in} to change the default
274 top-level or other installation @emph{directories} (only the paths).
275 You can and should do that when you run @code{configure} (next step).
276
277 You also do not need to edit @file{texmf.in} if you are willing to
278 rely on @file{texmf.cnf} at runtime to define the paths, and let the
279 compile-time default paths be incorrect.  Usually there is no harm in
280 doing this.
281
282 The section below explains default generation in more detail.
283
284 @menu
285 * Default path features::       
286 * Default path generation::     
287 @end menu
288
289
290 @node Default path features
291 @subsubsection Default path features
292
293 @cindex default path features
294 @cindex features, of default paths
295
296 The purpose of having all the different files described in the section
297 above is to avoid having the same information in more than one place. If
298 you change the installation directories or top-level prefix at
299 @code{configure}-time, those changes will propagate through the whole
300 sequence.  And if you change the default paths in @file{texmf.in},
301 those changes are propagated to the compile-time defaults.
302
303 The Make definitions are all repeated in several @t{Makefile}'s; but
304 changing the top-level @file{Makefile} should suffice, as it passes down
305 all the variable definitions, thus overriding the submakes.  (The
306 definitions are repeated so you can run Make in the subdirectories, if
307 you should have occasion to.)
308
309 @vindex MAKETEX_MODE
310 @cindex paths, device name included in
311 By default, the bitmap font paths end with @samp{/$MAKETEX_MODE}, thus
312 including the device name (usually a Metafont mode name such as
313 @samp{ljfour}).  This distinguishes two different devices with the same
314 resolution---a write/white from a write/black 300@dmn{dpi} printer, for
315 example.
316
317 @findex kpse_init_prog@r{, and @code{MAKETEX_MODE}}
318 @flindex proginit.c
319 However, since most sites don't have this complication, Kpathsea
320 (specifically, the @code{kpse_init_prog} function in
321 @file{kpathsea/proginit.c}) has a special case: if the mode has not been
322 explicitly set by the user (or in a configuration file), it sets
323 @code{MAKETEX_MODE} to @code{/}.  This makes the default PK path, for
324 example, expand into @code{@dots{}/pk//}, so fonts will be found even if
325 there is no subdirectory for the mode (if you arranged things that way
326 because your site has only one printer, for example) or if the program
327 is mode-independent (e.g., @code{pktype}).
328
329 To make the paths independent of the mode, simply edit
330 @file{texmf.in} before installation, or the installed
331 @file{texmf.cnf}, and remove the @samp{$MAKETEX_MODE}.
332
333 @xref{mktex script arguments}, for how this interacts with @code{mktexpk}.
334
335 @flindex HIER
336 @flindex kpathsea/HIER
337 @xref{TeX directory structure,, @TeX{} directory structure}, for a
338 description of the default arrangement of the input files that comprise
339 the @TeX{} system.  The file @file{kpathsea/HIER} is a copy of that
340 section.
341
342
343 @node Default path generation
344 @subsubsection Default path generation
345
346 @cindex default paths, changing
347 @cindex paths, changing default
348 @cindex installation, changing default directories
349 @cindex directories, changing default installation
350
351 This section describes how the default paths are constructed.
352
353 You may wish to ignore the whole mess and simply edit @file{texmf.cnf}
354 after it is installed, perhaps even copying it into place beforehand so
355 you can complete the installation, if it seems necessary.
356
357 @cindex default paths, how they're made
358 To summarize the chain of events that go into defining the default paths:
359
360 @enumerate
361 @item
362 @samp{configure} creates a @file{Makefile} from each @file{Makefile.in}.
363
364 @item
365 @flindex texmf.sed
366 When Make runs in the @file{kpathsea} directory, it creates a file
367 @file{texmf.sed} that substitutes the Make value of @code{$(var)} for a
368 string @code{@@var@@}.  The variables in question are the one that
369 define the installation directories.
370
371 @item
372 @flindex texmf.in
373 @flindex texmf.cnf@r{, generated}
374 @file{texmf.sed} (together with a little extra magic---see
375 @file{kpathsea/Makefile}) is applied to @file{texmf.in} to generate
376 @file{texmf.cnf}.  This is the file that will eventually be installed
377 and used.
378
379 @item
380 @flindex paths.h
381 The definitions in @file{texmf.cnf} are recast as C @code{#define}'s in
382 @file{paths.h}.  These values will be the compile-time defaults; they
383 are not used at runtime unless no @file{texmf.cnf} file can be found.
384
385 (That's a lie: the compile-time defaults are what any extra @t{:}'s in
386 @file{texmf.cnf} expand into; but the paths as distributed have no extra
387 @t{:}'s, and there's no particular reason for them to.)
388 @end enumerate
389
390
391 @node Running configure
392 @subsection Running @code{configure}
393
394 @flindex configure@r{, running}
395 @flindex c-auto.in
396 @flindex Makefile.in
397 @findex ac_include@r{, Autoconf extension}
398 @cindex @@@var{var}@@ substitutions
399 @cindex system dependencies
400 Run @code{sh configure @var{options}} (in the top-level directory, the
401 one containing @file{kpathsea/}), possibly using a shell other than
402 @code{sh} (@pxref{configure shells}).
403
404 @code{configure} adapts the source distribution to the present system
405 via @code{#define}'s in @file{*/c-auto.h}, which are created from the
406 corresponding @file{c-auto.in}.  It also creates a @file{Makefile} from
407 the corresponding @file{Makefile.in}, doing @samp{@@@var{var}@@} and
408 @samp{ac_include} substitutions).
409
410 @flindex README.CONFIGURE
411 @flindex kpathsea/README.CONFIGURE
412 @code{configure} is the best place to control the configuration,
413 compilation, and installed location of the software, either via
414 command-line options, or by setting environment variables before
415 invoking it.  For example, you can disable @code{mktexpk} by default
416 with the option @samp{--disable-mktexpk}.
417 @xref{configure options}.
418
419 @menu
420 * configure shells::            
421 * configure options::           
422 * configure environment::
423 * configure scenarios::         
424 * Shared library::
425 @end menu
426
427
428 @node configure shells
429 @subsubsection @code{configure} shells
430
431 @cindex shells and @code{configure}
432 @pindex bash@r{, recommended for running @code{configure}}
433
434 Considerable effort has gone into trying to ensure that the
435 @code{configure} scripts can be run by most Bourne shell variants.
436 If @code{sh} runs into trouble, your best bet is to use Bash, the GNU
437 Bourne-again shell (@pxref{Top,,,bash,Bash Reference Manual}).
438
439 Bourne shell variants for which problems have been reported in the past
440 are:
441 @table @code
442 @item ksh
443 @pindex ksh@r{, losing with @code{configure}}
444 @pindex bsh@r{, ok with @code{configure}}
445 @cindex Korn shell@r{, losing with @code{configure}}
446 @cindex AIX shells and @code{configure}
447 Old versions of the Korn shell may fail to handle the scripts.  The Korn
448 shell may be installed as @file{/bin/sh} on AIX, in which case
449 @file{/bin/bsh} may serve instead.
450
451 @item ash
452 @pindex ash@r{, losing with @code{configure}}
453 @cindex NetBSD shells and @code{configure}
454 @cindex FreeBSD shells and @code{configure}
455 @cindex Linux shells and @code{configure}
456 Old versions of ash are unable to handle the scripts.  Ash is sometimes
457 installed as @file{/bin/sh} on NetBSD, FreeBSD, and Linux systems.
458 @file{/bin/bash} should be available for those systems, but might not be
459 part of a default installation.
460
461 @item @r{Ultrix} /bin/sh
462 @cindex DEC shells and @code{configure}
463 @cindex Ultrix shells and @code{configure}
464 @pindex sh5@r{, ok with @code{configure}}
465 @file{/bin/sh} under Ultrix is a DEC-grown shell that is notably
466 deficient in many ways.  @file{/bin/sh5} may be necessary.
467 @end table
468
469
470 @node configure options
471 @subsubsection @code{configure} options
472
473 @cindex @code{configure} options
474
475 For a complete list of all @code{configure} options, run @samp{configure
476 --help} or see @ref{Invoking configure,, Running @code{configure} scripts,
477 autoconf, Autoconf}, (a copy is in the file @file{kpathsea/README.CONFIGURE}).
478 The generic options are listed first in the @samp{--help} output, and
479 the package-specific options come last.  The environment variables
480 @code{configure} pays attention to are listed below.
481
482 Options particularly likely to be useful are @samp{--prefix},
483 @samp{--datadir}, and the like; see @ref{configure scenarios}.
484
485 @opindex --with @r{options}
486 @opindex --enable @r{options}
487 @cindex configuration of optional features
488 @cindex options to @code{configure}
489 This section gives pointers to descriptions of the @samp{--with} and
490 @samp{--enable} options to @code{configure} that Kpathsea-using programs
491 accept.
492
493 @table @samp
494 @item --without-mktexmf-default
495 @itemx --without-mktexpk-default
496 @itemx --without-mktextfm-default
497 @itemx --with-mktextex-default
498 Enable or disable the dynamic generation programs.  @xref{mktex
499 configuration}.
500
501 @item --enable-shared
502 @opindex --enable-shared
503 Build Kpathsea as a shared library, and link against it.  Also build the
504 usual static library.  @xref{Shared library}.
505
506 @item --disable-static
507 @opindex --disable-static
508 Build only the shared library.   Implies @samp{--enable-shared}.
509
510 @item --enable-maintainer-mode
511 @opindex --enable-maintainer-mode
512 Enables make targets that are useful for the maintainer and likely to be
513 a pain for anyone else; the makefiles created when this option is
514 enabled may not work at all for you.  You have been warned.
515 @end table
516
517 @node configure environment                           
518 @subsubsection @code{configure} environment
519
520 @code{configure} uses the value of the following environment variables in
521 determining your system's characteristics, and substitutes for them in
522 @t{Makefile}'s:
523
524 @vtable @samp
525 @item CC
526 @pindex gcc@r{, compiling with}
527 @pindex cc@r{, compiling with}
528 The compiler to use: default is @code{gcc} if it's installed, otherwise
529 @code{cc}.
530
531 @item CFLAGS
532 @cindex compiler options, specifying
533 Options to give the compiler: default is @samp{-g -O2} for @code{gcc},
534 @samp{-g} otherwise.  @code{CFLAGS} comes after any other options.  You
535 may need to include @code{-w} here if your compilations commonly have
536 useless warnings (e.g., @code{NULL redefined}), or @code{configure} may
537 fail to detect the presence of header files (it takes the messages on
538 standard error to mean the header file doesn't exist).
539
540 @item CPPFLAGS
541 @cindex configuration compiler options
542 Options to pass to the compiler preprocessor; this matters most for
543 configuration, not the actual source compilation.  The @code{configure}
544 script often does only preprocessing (e.g., to check for the existence
545 of @t{#include} files), and @code{CFLAGS} is not used for this.  You may
546 need to set this to something like
547 @samp{-I/usr/local/include/wwwhatever} if you have the libwww library
548 installed for hyper-xdvik (see @file{xdvik/INSTALL}).
549
550 @item DEFS
551 @cindex preprocessor options
552 Additional preprocessor options, but not used by @code{configure}.
553 Provided for enabling or disabling program features, as documented in
554 the various program-specific installation instructions.  @code{DEFS}
555 comes before any compiler options included by the distribution
556 @file{Makefile}s or by @code{configure}.
557
558 @item LDFLAGS
559 @cindex loader options
560 Additional options to give to the loader.  @code{LDFLAGS} comes before
561 any other linker options.
562
563 @item LIBS
564 @cindex libraries, specifying additional
565 Additional libraries to link with.
566 @end vtable
567
568
569 @node configure scenarios
570 @subsubsection @code{configure} scenarios
571
572 Here are some common installation scenarios:
573
574 @itemize @bullet
575 @item
576 Including X support in Metafont.  This is disabled by default, since
577 many sites have no use for it, and it's a leading cause of configuration
578 problems.
579 @example
580 configure --with-x
581 @end example
582
583 @item
584 @cindex @TeX{} hierarchy, one
585 Putting the binaries, @TeX{} files, GNU info files, etc.@: into a single
586 @TeX{} hierarchy, say @file{/here/texmf}, requires overriding defaults in
587 @code{configure}:
588 @example
589 configure --prefix=/here/texmf --datadir=/here
590 @end example
591
592 @item
593 @cindex multiple architectures, compiling on
594 @cindex architectures, compiling multiple
595 @cindex symbolic link trees, for multiple architectures
596 @opindex --srcdir@r{, for building multiple architectures}
597 @pindex lndir @r{for building symlink trees}
598 You can compile on multiple architectures simultaneously either by
599 building symbolic link trees with the @code{lndir} script from the X11
600 distribution, or with the @samp{--srcdir} option:
601 @example
602 configure --srcdir=@var{srcdir}
603 @end example
604
605 @item
606 @cindex multiple architectures, directories for
607 If you are installing binaries for multiple architectures into a single
608 hierarchy, you will probably want to override the default @file{bin} and
609 @file{lib} directories, something like this:
610 @example
611 configure --prefix=@var{texmf} --datadir=@var{texmf} \
612   --bindir=@var{texmf}/@var{arch}/bin --libdir=@var{texmf}/@var{arch}/lib
613 make texmf=@var{texmf}
614 @end example
615 @pindex depot
616 @cindex automounter, and configuration
617 @noindent (Unless you make provisions for architecture-specific files in
618 other ways, e.g., with Depot or an automounter.)
619
620 @item
621 @opindex -O@r{, compiling with}
622 @opindex -g@r{, compiling without}
623 @cindex optimization, enabling
624 @cindex debugging with @samp{-g}, disabling
625 To compile with optimization (to compile without debugging, remove the
626 @samp{-g}):
627 @example
628 env CFLAGS="-g -O" sh configure @dots{}
629 @end example
630 @noindent For a potential problem if you optimize, see @ref{TeX or
631 Metafont failing,, @TeX{} or Metafont failing}.
632 @end itemize
633   
634
635 @node Shared library
636 @subsubsection Shared library
637
638 @cindex shared library, making
639
640 @opindex --enable-shared
641 You can compile Kpathsea as a shared library on a few systems, by
642 specifying the option @samp{--enable-shared} when you run
643 @samp{configure}.
644
645 @cindex code sharing
646 The main advantage in doing this is that the executables can then share
647 the code, thus decreasing memory and disk space requirements.
648
649 On some systems, you can record the location of shared libraries in a
650 binary, usually by giving certain options to the linker.  Then
651 individual users do not need to set their system's environment variable
652 (e.g., @code{LD_LIBRARY_PATH}) to find shared libraries.  If you want to
653 do this, you will need to add the necessary options to @code{LDFLAGS}
654 yourself; for example, on Solaris, include something like
655 @samp{-R$@{prefix@}/lib}, on IRIX or Linux, use
656 @samp{-rpath$@{prefix@}/lib}.  (Unfortunately, making this happen by
657 default is very difficult, because of interactions with an existing
658 installed shared library.)
659
660
661 @node Running make
662 @subsection Running @code{make}
663
664 @pindex make@r{, running}
665
666 @flindex texmf.cnf@r{, creating}
667 @flindex paths.h@r{, creating}
668 @code{make} (still in the top-level directory).  This also creates the
669 @file{texmf.cnf} and @file{paths.h} files that define the default search
670 paths, and (by default) the @samp{plain} and @samp{latex} @TeX{} formats.
671
672 @cindex fallback resolutions, overriding
673 You can override directory names and other values at @code{make}-time.
674 @file{make/paths.make} lists the variables most commonly reset.  For
675 example, @samp{make default_texsizes=600} changes the list of fallback
676 resolutions.
677
678 You can also override each of @code{configure}'s environment variables
679 (@pxref{configure environment}).  The Make variables have the same names.
680
681 Finally, you can supply additional options via the following variables.
682 (@code{configure} does not use these.)
683
684 @vtable @samp
685 @item XCPPFLAGS
686 @itemx XDEFS
687 @cindex preprocessor options, additional
688 Preprocessor options.
689
690 @item XCFLAGS
691 @cindex compiler options, additional
692 Compiler options.
693
694 @item XLDFLAGS
695 @cindex loader options, initial
696 Loader options (included at beginning of link commands).
697
698 @item XLOADLIBES
699 @cindex loader options, final
700 More loader options (included at end of link commands).
701
702 @item XMAKEARGS
703 @cindex Make arguments, additional
704 Additional Make arguments passed to all sub-@code{make}'s. You may need
705 to include assignments to the other variables here via @code{XMAKEARGS};
706 for example: @samp{make XMAKEARGS="CFLAGS=-O XDEFS=-DA4"}.
707 @end vtable
708
709 @cindex compiler, changing
710 @cindex libraries, changing
711 It's generally a bad idea to use a different compiler (@samp{CC}) or
712 libraries (@code{LIBS}) for compilation than you did for configuration,
713 since the values @code{configure} determined may then be incorrect.
714
715 @cindex universe, BSD vs.@: system V
716 @cindex BSD universe
717 @cindex system V universe
718 @cindex Solaris BSD compatibility, not
719 @flindex libucb@r{, avoiding}
720 @flindex ucbinclude@r{, avoiding}
721 Adding compiler options to change the ``universe'' you are using
722 (typically BSD vs.@: system V) is generally a cause of trouble.  It's
723 best to use the native environment, whatever that is; @code{configure}
724 and the software usually adapt best to that.  In particular, under
725 Solaris 2.x, you should not use the BSD-compatibility library
726 (@file{libucb}) or include files (@file{ucbinclude}).
727
728 @cindex Babel
729 If you want to use the Babel La@TeX{} package for support of non-English
730 typesetting, you need to modify some files before making the La@TeX{}
731 format.  See the file @file{install.txt} in the Babel distribution.
732
733
734 @node Installing files
735 @subsection Installing files
736
737 @cindex installing files
738
739 The basic command is the usual @code{make install}.  For security
740 issues, @pxref{Security}.
741
742 The first time you install any manual in the GNU Info system, you should
743 add a line (you choose where) to the file @file{dir} in your
744 @samp{$(infodir)} directory.  Sample text for this is given near the top
745 of the Texinfo source files (@file{kpathsea/kpathsea.texi},
746 @file{dvipsk/dvips.texi}, and @file{web2c/doc/web2c.texi}).
747 If you have a recent version of the GNU Texinfo distribution installed
748 (@url{ftp://prep.ai.mit.edu/pub/gnu/texinfo-3.9.tar.gz} or later), this
749 should happen automatically.
750
751 On the offchance that this is your first Info installation, the
752 @file{dir} file I use is included in the distribution as
753 @file{etc/dir-example}.
754
755 @cindex multiple architectures, installing on
756 @cindex architecture-(in)dependent files, installing only
757 @cindex installation, architecture-(in)dependent files only
758 You may wish to use one of the following targets, especially if you are
759 installing on multiple architectures:
760 @itemize @bullet
761 @item
762 @findex install-exec @r{Make target}
763 @code{make install-exec} to install in architecture-dependent
764 directories, i.e., ones that depend on the @code{$(exec_prefix)} Make
765 variable.  This includes links to binaries, libraries, etc., not just
766 ``executables''.
767
768 @item
769 @findex install-data @r{Make target}
770 @code{make install-data} to install in architecture-independent
771 directories, such as documentation, configuration files, pool files, etc.
772 @end itemize
773
774 @cindex AFS
775 @cindex Andrew File System, installing with
776 @flindex /afs/@dots{} @r{, installing into}
777 If you use the Andrew File System, the normal path (e.g.,
778 @var{prefix}/bin) only gets you to a read-only copy of the files, and
779 you must specify a different path for installation.  The best way to do this
780 is by setting the @samp{prefix} variable on the @code{make} command
781 line.  The sequence becomes something like this:
782 @example
783 configure --prefix=/whatever
784 make
785 make install prefix=/afs/.@var{system.name}/system/1.3/@@sys/whatever
786 @end example
787 @flindex ls-R @r{and AFS}
788 @cindex relative filenames in @file{ls-R}
789 @noindent With AFS, you will definitely want to use relative filenames in 
790 @file{ls-R} (@pxref{Filename database}), not absolute filenames.  This
791 is done by default, but check anyway.
792
793
794 @node Cleaning up
795 @subsection Cleaning up
796
797 @findex distclean @r{Make target}
798 The basic command is @code{make distclean}.  This removes all files
799 created by the build.
800
801 Alternatively,
802 @itemize @bullet
803 @item
804 @findex mostlyclean @r{Make target}
805 @code{make mostlyclean} if you intend to compile on another
806 architecture.  For Web2C, since the generated C files are portable,
807 they are not removed.  If the @code{lex} vs.@: @code{flex} situation
808 is going to be different on the next machine, @code{rm
809 web2c/lex.yy.c}.
810
811 @item
812 @findex clean @r{Make target}
813 @code{make clean} to remove files created by compiling, but leave
814 configuration files and Makefiles.
815
816 @item
817 @findex maintainer-clean @r{Make target}
818 @code{make maintainer-clean} to remove everything that the Makefiles can
819 rebuild.  This is more than @samp{distclean} removes, and you should
820 only use it if you are thoroughly conversant with (and have the necessary
821 versions of) Autoconf.
822
823 @item
824 @findex extraclean @r{Make target}
825 @code{make extraclean} to remove other junk, e.g., core files, log
826 files, patch rejects.  This is independent of the other @samp{clean}
827 targets.
828 @end itemize
829
830
831 @node Filename database generation
832 @subsection Filename database generation
833
834 @cindex filename database generation
835 @cindex generation of filename database
836
837 You will probably want to set up a @code{cron} entry on the appropriate
838 machine(s) to rebuild the filename database nightly or so, as in:
839 @example
840 0 0 * * * cd @var{texmf} && @var{/bindir}/mktexlsr
841 @end example
842 @noindent @xref{Filename database}.
843
844 Although the @code{mktex@dots{}} scripts make every effort to add
845 newly-created files on the fly, it can't hurt to make sure you get a
846 fresh version every so often.
847
848
849 @node mktex scripts
850 @subsection @file{mktex} scripts
851
852 @cindex @file{mktex} scripts
853 @cindex scripts for file creation
854
855 @cindex font set, infinite
856 @cindex dynamic creation of files
857 @cindex Sauter fonts, and dynamic source creation
858 @cindex EC fonts, and dynamic source creation
859 If Kpathsea cannot otherwise find a file, for some file types it is
860 configured by default to invoke an external program to create it
861 dynamically (@pxref{mktex configuration}).  These are collectively
862 known as @dfn{@code{mktex} scripts}, since most of them are named
863 @code{mktex...}.
864
865 For example, this is useful for fonts (bitmaps, TFM's, and
866 arbitrarily-sizable Metafont sources such as the Sauter and EC fonts),
867 since any given document can use fonts never before referenced.
868 Building all fonts in advance is therefore impractical, if not
869 impossible.
870
871 It is also useful for the @TeX{} @samp{.fmt} (and Metafont
872 @samp{.base} and Metapost @samp{.mem} files, @pxref{Memory
873 dumps,,,Web2c,web2c}), where pre-generating every format consumes a
874 lot of both time and space.
875
876 The script is passed the name of the file to create and possibly other
877 arguments, as explained below.  It must echo the full pathname of the
878 file it created (and nothing else) to standard output; it can write
879 diagnostics to standard error.
880
881 @menu
882 * config: mktex configuration.
883 * names: mktex script names.
884 * args: mktex script arguments.
885 @end menu
886
887
888 @node mktex configuration
889 @subsubsection @file{mktex} configuration
890
891 @cindex @file{mktex} script configuration
892 @cindex configuration of @file{mktex} scripts
893 @cindex enabling @file{mktex} scripts
894 @cindex disabling @file{mktex} scripts
895
896 The list of file types and program names that can run an external
897 program to create missing files is listed in the next section.  In the
898 absence of @code{configure} options specifying otherwise, everything
899 but @file{mktextex} will be enabled by default.  The @code{configure}
900 options to change the defaults are:
901
902 @cindex @code{configure} options for @file{mktex} scripts
903 @opindex --without-mktexfmt-default
904 @opindex --without-mktexmf-default
905 @opindex --without-mktexocp-default
906 @opindex --without-mktexofm-default
907 @opindex --without-mktexpk-default
908 @opindex --without-mktextfm-default
909 @opindex --with-mktextex-default
910 @example
911 --without-mktexfmt-default
912 --without-mktexmf-default
913 --without-mktexocp-default
914 --without-mktexofm-default
915 --without-mktexpk-default
916 --without-mktextfm-default
917 --with-mktextex-default
918 @end example
919
920 The @code{configure} setting is overridden if the environment variable
921 or configuration file value named for the script is set; e.g.,
922 @file{MKTEXPK} (@pxref{mktex script arguments}).
923
924 @flindex fmtutils.cnf
925 @code{mktexfmt} reads a file @file{fmtutil.cnf}, typically located in
926 @file{texmf/web2c/} to glean its configuration information.  The rest
927 of the files and features in this section are primarily intended for
928 the font generation scripts.
929
930 @flindex mktex.cnf
931 @flindex mktex.opt
932 @cindex site overrides for @code{mktex@dots{}}
933 As distributed, all the scripts source a file
934 @file{texmf/web2c/mktex.cnf} if it exists, so you can override various
935 defaults.  
936 See @file{mktex.opt}, for instance, which defines the default mode,
937 resolution, some special directory names, etc.  If you prefer not to
938 change the distributed scripts, you can simply create @file{mktex.cnf}
939 with the appropriate definitions (you do not need to create it if you
940 have nothing to put in it).  @file{mktex.cnf} has no special syntax;
941 it's an arbitrary Bourne shell script.  The distribution contains a
942 sample @file{mktex.cnf} for you to copy and modify as you please (it
943 is not installed anywhere).
944
945 @flindex mktex.opt
946 @vindex MT_FEATURES
947 In addition, you can configure a number of features with the
948 @code{MT_FEATURES} variable, which you can define:
949
950 @itemize @bullet
951 @item
952 in @file{mktex.opt}, as just mentioned;
953
954 @item
955 by editing the file @file{mktex.opt}, either before @samp{make
956 install} (in the source hierarchy) or after (in the installed
957 hierarchy);
958
959 @item
960 or in the environment.
961 @end itemize
962
963 If none of the options below are enabled, @code{mktexpk},
964 @code{mktextfm}, and @code{mktexmf} follow the following procedure to
965 decide where fonts should be installed.  Find the tree where the font's
966 sources are, and test the permissions of the @samp{fonts} directory of
967 that tree to determine whether it is writable.  If it is, put the files
968 in the tree in appropriate locations.  If it isn't writable, see whether
969 the tree is a system tree (named in @code{SYSTEXMF}).  If so, the
970 @code{VARTEXFONTS} tree is used.  In all other cases the working
971 directory is used.
972
973 The @samp{appendonlydir} option is enabled by default.
974
975 @vtable @samp
976 @item appendonlydir
977 @cindex directories, making append-only
978 @flindex mktexdir
979 Tell @code{mktexdir} to create directories append-only, i.e., set
980 their sticky bit (@pxref{Mode Structure,,, coreutils, GNU Core
981 Utilities}).  This feature is silently ignored on non-Unix platforms
982 (e.g. Windows/NT and MS-DOS) which don't support similar functionality.
983 This feature is enabled by default.
984
985 @item dosnames
986 @cindex 8.3 filenames, using
987 @cindex DOS compatible names
988 @flindex dpi@var{nnn} directories
989 Use 8.3 names; e.g., @file{dpi600/cmr10.pk} instead of
990 @file{cmr10.600pk}.  Note that this feature only affects filenames that
991 would otherwise clash with other TeX-related filenames; @file{mktex}
992 scripts do nothing about filenames which exceed the 8+3 MS-DOS limits
993 but remain unique when truncated (by the OS) to these limits, and nether
994 do the scripts care about possible clashes with files which aren't
995 related with TeX.  For example, @file{cmr10.600pk} would clash with
996 @file{cmr10.600gf} and is therefore changed when @samp{dosnames} is in
997 effect, but @file{mf.pool} and @file{mp.base} don't clash with any
998 TeX-related files and are therefore unchanged.
999
1000 This feature is turned on by default on MS-DOS.  If you do not wish
1001 @samp{dosnames} to be set on an MS-DOS platform, you need to set the
1002 @code{MT_FEATURES} environment variable to a value that doesn't include
1003 @samp{dosnames}.  You can also change the default setting by editing
1004 @file{mktex.opt}, but only if you use the @file{mktex} shell scripts;
1005 the emulation programs don't consult @file{mktex.opt}.
1006
1007 @item fontmaps
1008 @cindex fontmaps
1009 @cindex fontname
1010 Instead of deriving the location of a font in the destination tree from
1011 the location of the sources, the aliases and directory names from the
1012 Fontname distribution are used. (@pxref{Top,, Introduction, fontname,
1013 Fontname}).
1014
1015 @item nomfdrivers
1016 @cindex metafont driver files
1017 Let mktexpk and mktextfm create metafont driver files in a temporary
1018 directory.  These will be used for just one metafont run and not
1019 installed permanently.
1020
1021 @item nomode
1022 @cindex mode directory, omitting
1023 Omit the directory level for the mode name; this is fine as long as
1024 you generate fonts for only one mode.
1025
1026 @item stripsupplier
1027 @cindex supplier directory, omitting
1028 Omit the font supplier name directory level.
1029
1030 @item striptypeface
1031 @cindex typeface directory, omitting
1032 Omit the font typeface name directory level.
1033
1034 @item strip
1035 @cindex supplier directory, omitting
1036 @cindex typeface directory, omitting
1037 Omit the font supplier and typeface name directory levels.  This feature
1038 is deprecated in favour of @samp{stripsupplier} and @samp{striptypeface}.
1039
1040 @item varfonts
1041 @flindex /var/tmp/texfonts
1042 @vindex VARTEXFONTS
1043 @cindex Linux File System Standard
1044 When this option is enabled, fonts that would otherwise be written in
1045 system texmf tree go to the @code{VARTEXFONTS} tree instead.  The
1046 default value in @file{kpathsea/Makefile.in} is
1047 @file{/var/tmp/texfonts}.  The @cite{Linux File System Standard}
1048 recommends @file{/var/tex/fonts}.
1049
1050 @vindex USE_VARTEXFONTS
1051 The @samp{varfonts} setting in @code{MT_FEATURES} is overridden by the
1052 @code{USE_VARTEXFONTS} environment variable: if set to @samp{1}, the
1053 feature is enabled, and if set to @samp{0}, the feature is disabled.
1054
1055 @item texmfvar
1056 @vindex TEXMFVAR
1057 Force generated files that would go into a system tree (as defined by
1058 @code{SYSTEXMF}) into @code{TEXMFVAR}. Starting with te@TeX{}-3.0, the
1059 variable @code{TEXMFVAR} is always set.  The @samp{varfonts} feature takes
1060 precedence if also set.
1061
1062 @vindex USE_TEXMFVAR
1063 The @samp{texmfvar} setting in @code{MT_FEATURES} is overridden by the
1064 @code{USE_TEXMFVAR} environment variable: if set to @samp{1}, the
1065 feature is enabled, and if set to @samp{0}, the feature is disabled.
1066 @end vtable
1067
1068
1069 @node mktex script names
1070 @subsubsection @file{mktex} script names
1071
1072 @cindex @file{mktex} script names
1073 @cindex names for @file{mktex} scripts
1074
1075 The following table shows the default name of the script for each
1076 of the file types which support runtime generation.
1077
1078 @table @file
1079 @item mktexfmt
1080 @pindex mktexfmt
1081 @pindex fmtutil
1082 (@samp{.fmt}, @samp{.base}, @samp{.mem}) @TeX{}/Metafont/MetaPost
1083 formats.  This script is also named @command{fmtutil}, and reads
1084 @file{fmtutil.cnf} for configuration information.
1085
1086 @item mktexmf
1087 @pindex mktexmf
1088 (@samp{.mf}) Metafont input files.
1089
1090 @item mkocp
1091 @pindex mkocp
1092 (@samp{.ocp}) Omega compiled process files.
1093
1094 @item mkofm
1095 @pindex mkofm
1096 (@samp{.ofm}) Omega font metric files.
1097
1098 @item mktexpk
1099 @pindex mktexpk
1100 (@samp{pk}) Glyph fonts.
1101
1102 @item mktextex
1103 @pindex mktextex
1104 (@samp{.tex}) @TeX{} input files (disabled by default).
1105
1106 @item mktextfm
1107 @pindex mktextfm
1108 (@samp{.tfm}) TFM files.
1109 @end table
1110
1111 @vindex DVIPSMAKEPK
1112 @vindex XDVIMAKEPK
1113 @vindex DVILJMAKEPK
1114 @noindent These names can be overridden by an environment variable specific
1115 to the program---for example, @code{DVIPSMAKEPK} for Dvipsk.
1116
1117 @comment next two paragraphs are repeated in dvips.texi
1118 @flindex missfont.log
1119 @cindex failed @code{mktex@dots{}} script invocation
1120 If a @code{mktex@dots{}} script fails, the invocation is appended to a
1121 file @file{missfont.log} (by default) in the current directory.  You can
1122 then execute the log file to create the missing files after fixing the
1123 problem.
1124
1125 @vindex TEXMFOUTPUT
1126 @vindex MISSFONT_LOG
1127 If the current directory is not writable and the environment variable or
1128 configuration file value @code{TEXMFOUTPUT} is set, its value is
1129 used.  Otherwise, nothing is written.  The name @samp{missfont.log} is
1130 overridden by the @code{MISSFONT_LOG} environment variable or
1131 configuration file value.
1132
1133
1134 @node mktex script arguments
1135 @subsubsection @file{mktex} script arguments
1136
1137 @cindex arguments to @file{mktex}
1138
1139 The first argument to a @file{mktex} script is always the name
1140 of the file to be created.
1141
1142 In the default @file{mktexpk} implementation, additional arguments may
1143 also be passed:
1144
1145 @table @samp
1146 @item --dpi @var{num}
1147 Sets the resolution of the generated font to @var{num}.
1148 @item --mfmode @var{name}
1149 Sets the Metafont mode to @var{name}.
1150 @item --bdpi @var{num}
1151 Sets the the ``base dpi'' for the font.  This must match the mode being
1152 used.
1153 @item --mag @var{string}
1154 A ``magstep'' string suitable for the Metafont @code{mag} variable.
1155 This must match the combination of @var{bdpi} and @var{dpi} being used.
1156 @item --destdir @var{string}
1157 A directory name. If the directory is absolute, it is used as-is.
1158 Otherwise, it is appended to the root destination directory set in the
1159 script.
1160 @end table
1161
1162
1163 @node Installation testing 
1164 @subsection Installation testing
1165
1166 @cindex testing, post-installation
1167 @cindex installation testing
1168
1169 Besides the tests listed in @ref{Simple installation}, you can try
1170 running @samp{make check}.  This includes the torture tests (trip, trap,
1171 and mptrap) that come with Web2c (@pxref{Triptrap,,, web2c, Web2c}).
1172
1173
1174 @node Security
1175 @section Security
1176
1177 @cindex security considerations
1178
1179 None of the programs in the @TeX{} system require any special system
1180 privileges, so there's no first-level security concern of people gaining
1181 illegitimate root access.
1182
1183 @cindex trojan horse attack
1184 @flindex .rhosts@r{, writable by @TeX{}}
1185 A @TeX{} document, however, can write to arbitrary files, e.g.,
1186 @file{~/.rhosts}, and thus an unwitting user who runs @TeX{} on a random
1187 document is vulnerable to a trojan horse attack.  This loophole is
1188 closed by default, but you can be permissive if you so desire in
1189 @file{texmf.cnf}.  @xref{tex invocation,,, web2c, Web2c}.  MetaPost has
1190 the same issue.
1191
1192 Dvips, Xdvi, and @TeX{} can also execute shell commands under some
1193 circumstances.  To disable this, see the @samp{-R} option in @ref{Option
1194 details,,, dvips, Dvips}, the xdvi man page, and @ref{tex
1195 invocation,,, web2c, Web2c}, respectively.
1196
1197 @cindex local cache of fonts
1198 @cindex cache of fonts, local
1199 Another security issue arises because it's very useful---almost
1200 necessary---to make arbitrary fonts on user demand with @code{mktexpk}
1201 and friends.  Where do these files get installed?  By default, the
1202 @code{mktexpk} distributed with Kpathsea assumes a world-writable
1203 @file{/var/tmp} directory; this is a simple and convenient approach, but
1204 it may not suit your situation because it means that a local cache of
1205 fonts is created on every machine.
1206
1207 @cindex globally writable directories
1208 To avoid this duplication, many people consider a shared, globally
1209 writable font tree desirable, in spite of the potential security
1210 problems.  To do this you should change the value of @code{VARTEXFONTS}
1211 in @file{texmf.cnf} to refer to some globally known directory.
1212 @xref{mktex configuration}.
1213
1214 @cindex append-only directories and @code{mktexpk}
1215 The first restriction you can apply is to make newly-created directories
1216 under @file{texmf} be append-only with an option in @file{mktex.cnf}.
1217 @xref{mktex configuration}.
1218
1219 @cindex group-writable directories
1220 @cindex setgid scripts
1221 Another approach is to establish a group (or user) for @TeX{} files,
1222 make the @file{texmf} tree writable only to that group (or user), and
1223 make @code{mktexpk} et al.@: setgid to that group (or setuid to that
1224 user).  Then users must invoke the scripts to install things.  (If
1225 you're worried about the inevitable security holes in scripts, then you
1226 could write a C wrapper to exec the script.)
1227
1228 @cindex file permissions
1229 @cindex permissions, file
1230 The @file{mktex@dots{}} scripts install files with the same read and
1231 write permissions as the directory they are installed in.  The
1232 executable, sgid, suid, and sticky bits are always cleared.
1233
1234 @cindex directory permissions
1235 @cindex permissions, directory
1236 Any directories created by the @file{mktex@dots{}} scripts have the
1237 same permissions as their parent directory, unless the
1238 @code{appendonlydir} feature is used, in which case the sticky bit is
1239 always set.