tentative fix for issue 3 (ex 53)
[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}).  This is most useful for
862 fonts (bitmaps, TFM's, and arbitrarily-sizable Metafont sources such as
863 the Sauter and EC fonts), since any given document can use fonts never
864 before referenced.  Trying to build all fonts in advance is therefore
865 impractical, if not impossible.
866
867 The script is passed the name of the file to create and possibly other
868 arguments, as explained below.  It must echo the full pathname of the
869 file it created (and nothing else) to standard output; it can write
870 diagnostics to standard error.
871
872 @menu
873 * mktex configuration::
874 * mktex script names::
875 * mktex script arguments::
876 @end menu
877
878
879 @node mktex configuration
880 @subsubsection @file{mktex} configuration
881
882 @cindex @file{mktex} script configuration
883 @cindex configuration of @file{mktex} scripts
884 @cindex enabling @file{mktex} scripts
885 @cindex disabling @file{mktex} scripts
886
887 The following file types can run an external program to create missing
888 files: @file{pk}, @file{tfm}, @file{mf}, @file{tex}; the scripts are
889 named @file{mktexpk}, @file{mktextfm}, @file{mktexmf}, and
890 @file{mktextex}.
891
892 In the absence of @code{configure} options specifying otherwise,
893 everything but @file{mktextex} will be enabled by default. The
894 @code{configure} options to change the defaults are:
895
896 @cindex @code{configure} options for @file{mktex} scripts
897 @opindex --without-mktexmf-default
898 @opindex --without-mktexpk-default
899 @opindex --without-mktextfm-default
900 @opindex --with-mktextex-default
901 @example
902 --without-mktexmf-default
903 --without-mktexpk-default
904 --without-mktextfm-default
905 --with-mktextex-default
906 @end example
907
908 The @code{configure} setting is overridden if the environment variable
909 or configuration file value named for the script is set; e.g.,
910 @file{MKTEXPK} (@pxref{mktex script arguments}).
911
912 @flindex mktex.cnf
913 @cindex site overrides for @code{mktex@dots{}}
914 As distributed, all the scripts source a file
915 @file{texmf/web2c/mktex.cnf} if it exists, so you can override
916 various defaults.  See @file{mktex.opt}, for instance, which defines
917 the default mode, resolution, some special directory names, etc.  If you
918 prefer not to change the distributed scripts, you can simply create
919 @file{mktex.cnf} with the appropriate definitions (you do not need to
920 create it if you have nothing to put in it).  @file{mktex.cnf} has no
921 special syntax; it's an arbitrary Bourne shell script.  The distribution
922 contains a sample @file{mktex.cnf} for you to copy and modify as you
923 please (it is not installed anywhere).
924
925 @flindex mktex.opt
926 @vindex MT_FEATURES
927 In addition, you can configure a number of features with the
928 @code{MT_FEATURES} variable, which you can define:
929 @itemize @bullet
930 @item
931 in @file{mktex.opt}, as just mentioned;
932
933 @item
934 by editing the file @file{mktex.opt}, either before @samp{make
935 install} (in the source hierarchy) or after (in the installed
936 hierarchy);
937
938 @item
939 or in the environment.
940 @end itemize
941
942 If none of the options below are enabled, @code{mktexpk},
943 @code{mktextfm}, and @code{mktexmf} follow the following procedure to
944 decide where fonts should be installed.  Find the tree where the font's
945 sources are, and test the permissions of the @samp{fonts} directory of
946 that tree to determine whether it is writable.  If it is, put the files
947 in the tree in appropriate locations.  If it isn't writable, see whether
948 the tree is a system tree (named in @code{SYSTEXMF}).  If so, the
949 @code{VARTEXFONTS} tree is used.  In all other cases the working
950 directory is used.
951
952 The @samp{appendonlydir} option is enabled by default.
953
954 @vtable @samp
955 @item appendonlydir
956 @cindex directories, making append-only
957 @flindex mktexdir
958 Tell @code{mktexdir} to create directories append-only, i.e., set
959 their sticky bit (@pxref{Mode Structure,,, coreutils, GNU Core
960 Utilities}).  This feature is silently ignored on non-Unix platforms
961 (e.g. Windows/NT and MS-DOS) which don't support similar functionality.
962 This feature is enabled by default.
963
964 @item dosnames
965 @cindex 8.3 filenames, using
966 @cindex DOS compatible names
967 @flindex dpi@var{nnn} directories
968 Use 8.3 names; e.g., @file{dpi600/cmr10.pk} instead of
969 @file{cmr10.600pk}.  Note that this feature only affects filenames that
970 would otherwise clash with other TeX-related filenames; @file{mktex}
971 scripts do nothing about filenames which exceed the 8+3 MS-DOS limits
972 but remain unique when truncated (by the OS) to these limits, and nether
973 do the scripts care about possible clashes with files which aren't
974 related with TeX.  For example, @file{cmr10.600pk} would clash with
975 @file{cmr10.600gf} and is therefore changed when @samp{dosnames} is in
976 effect, but @file{mf.pool} and @file{mp.base} don't clash with any
977 TeX-related files and are therefore unchanged.
978
979 This feature is turned on by default on MS-DOS.  If you do not wish
980 @samp{dosnames} to be set on an MS-DOS platform, you need to set the
981 @code{MT_FEATURES} environment variable to a value that doesn't include
982 @samp{dosnames}.  You can also change the default setting by editing
983 @file{mktex.opt}, but only if you use the @file{mktex} shell scripts;
984 the emulation programs don't consult @file{mktex.opt}.
985
986 @item fontmaps
987 @cindex fontmaps
988 @cindex fontname
989 Instead of deriving the location of a font in the destination tree from
990 the location of the sources, the aliases and directory names from the
991 Fontname distribution are used. (@pxref{Top,, Introduction, fontname,
992 Fontname}).
993
994 @item nomfdrivers
995 @cindex metafont driver files
996 Let mktexpk and mktextfm create metafont driver files in a temporary
997 directory.  These will be used for just one metafont run and not
998 installed permanently.
999
1000 @item nomode
1001 @cindex mode directory, omitting
1002 Omit the directory level for the mode name; this is fine as long as
1003 you generate fonts for only one mode.
1004
1005 @item stripsupplier
1006 @cindex supplier directory, omitting
1007 Omit the font supplier name directory level.
1008
1009 @item striptypeface
1010 @cindex typeface directory, omitting
1011 Omit the font typeface name directory level.
1012
1013 @item strip
1014 @cindex supplier directory, omitting
1015 @cindex typeface directory, omitting
1016 Omit the font supplier and typeface name directory levels.  This feature
1017 is deprecated in favour of @samp{stripsupplier} and @samp{striptypeface}.
1018
1019 @item varfonts
1020 @flindex /var/tmp/texfonts
1021 @vindex VARTEXFONTS
1022 @cindex Linux File System Standard
1023 When this option is enabled, fonts that would otherwise be written in
1024 system texmf tree go to the @code{VARTEXFONTS} tree instead.  The
1025 default value in @file{kpathsea/Makefile.in} is
1026 @file{/var/tmp/texfonts}.  The @cite{Linux File System Standard}
1027 recommends @file{/var/tex/fonts}.
1028
1029 @vindex USE_VARTEXFONTS
1030 The @samp{varfonts} setting in @code{MT_FEATURES} is overridden by the
1031 @code{USE_VARTEXFONTS} environment variable: if set to @samp{1}, the
1032 feature is enabled, and if set to @samp{0}, the feature is disabled.
1033
1034 @item texmfvar
1035 @vindex TEXMFVAR
1036 Force generated files that would go into a system tree (as defined by
1037 @code{SYSTEXMF}) into @code{TEXMFVAR}. Starting with te@TeX{}-3.0, the
1038 variable @code{TEXMFVAR} is always set.  The @samp{varfonts} feature takes
1039 precedence if also set.
1040
1041 @vindex USE_TEXMFVAR
1042 The @samp{texmfvar} setting in @code{MT_FEATURES} is overridden by the
1043 @code{USE_TEXMFVAR} environment variable: if set to @samp{1}, the
1044 feature is enabled, and if set to @samp{0}, the feature is disabled.
1045 @end vtable
1046
1047
1048 @node mktex script names
1049 @subsubsection @file{mktex} script names
1050
1051 @cindex @file{mktex} script names
1052 @cindex names for @file{mktex} scripts
1053
1054 @flindex tex-make.c
1055 @vindex kpse_make_specs
1056 The following table shows the default name of the script for each
1057 possible file types.  (The source is the variable @code{kpse_make_specs}
1058 in @file{kpathsea/tex-make.c}.)
1059
1060 @table @file
1061 @item mktexpk
1062 @pindex mktexpk
1063 Glyph fonts.
1064
1065 @item mktextex
1066 @pindex mktextex
1067 @TeX{} input files.
1068
1069 @item mktexmf
1070 @pindex mktexmf
1071 Metafont input files.
1072
1073 @item mktextfm
1074 @pindex mktextfm
1075 TFM files.
1076 @end table
1077
1078 @vindex DVIPSMAKEPK
1079 @vindex XDVIMAKEPK
1080 @vindex DVILJMAKEPK
1081 @noindent These names are overridden by an environment variable specific
1082 to the program---for example, @code{DVIPSMAKEPK} for Dvipsk.
1083
1084 @comment next two paragraphs are repeated in dvips.texi
1085 @flindex missfont.log
1086 @cindex failed @code{mktex@dots{}} script invocation
1087 If a @code{mktex@dots{}} script fails, the invocation is appended to a
1088 file @file{missfont.log} (by default) in the current directory.  You can
1089 then execute the log file to create the missing files after fixing the
1090 problem.
1091
1092 @vindex TEXMFOUTPUT
1093 @vindex MISSFONT_LOG
1094 If the current directory is not writable and the environment variable or
1095 configuration file value @code{TEXMFOUTPUT} is set, its value is
1096 used.  Otherwise, nothing is written.  The name @samp{missfont.log} is
1097 overridden by the @code{MISSFONT_LOG} environment variable or
1098 configuration file value.
1099
1100
1101 @node mktex script arguments
1102 @subsubsection @file{mktex} script arguments
1103
1104 @cindex arguments to @file{mktex}
1105
1106 The first argument to a @file{mktex} script is always the name
1107 of the file to be created.
1108
1109 In the default @file{mktexpk} implementation, additional arguments may
1110 also be passed:
1111
1112 @table @samp
1113 @item --dpi @var{num}
1114 Sets the resolution of the generated font to @var{num}.
1115 @item --mfmode @var{name}
1116 Sets the Metafont mode to @var{name}.
1117 @item --bdpi @var{num}
1118 Sets the the ``base dpi'' for the font.  This must match the mode being
1119 used.
1120 @item --mag @var{string}
1121 A ``magstep'' string suitable for the Metafont @code{mag} variable.
1122 This must match the combination of @var{bdpi} and @var{dpi} being used.
1123 @item --destdir @var{string}
1124 A directory name. If the directory is absolute, it is used as-is.
1125 Otherwise, it is appended to the root destination directory set in the
1126 script.
1127 @end table
1128
1129 @c  The feature mentioned here doesn't seem to be implemented.
1130 @c  Worse, the variable name clashed with the "switch" used to select
1131 @c  whether a mktex program is run at all.  However, a dearth of
1132 @c  complains suggests that no-one was using it anyway.
1133 @c
1134 @c @vindex MKTEXPK @r{environment variable}
1135 @c @cindex specification for @code{mktexpk}
1136 @c You can change the specification for the arguments passed to the
1137 @c external script by setting the environment variable named as the script
1138 @c name, but all capitals---@code{MKTEXPK}, for example.  If you've
1139 @c changed the script name by setting (say) @code{DVIPSMAKEPK} to
1140 @c @samp{foo}, then the spec is taken from the environment variable
1141 @c @code{FOO}.
1142 @c
1143 @c The spec can contain any variable references, to the above variables or
1144 @c any others.  As an example, the default spec for @code{mktexpk} is:
1145 @c @example
1146 @c $KPATHSEA_DPI $MAKETEX_BASE_DPI $MAKETEX_MAG $MAKETEX_MODE
1147 @c @end example
1148 @c
1149 @c @noindent The convention of passing the name of the file to be created
1150 @c as the first argument cannot be changed.
1151
1152
1153 @node Installation testing 
1154 @subsection Installation testing
1155
1156 @cindex testing, post-installation
1157 @cindex installation testing
1158
1159 Besides the tests listed in @ref{Simple installation}, you can try
1160 running @samp{make check}.  This includes the torture tests (trip, trap,
1161 and mptrap) that come with Web2c (@pxref{Triptrap,,, web2c, Web2c}).
1162
1163
1164 @node Security
1165 @section Security
1166
1167 @cindex security considerations
1168
1169 None of the programs in the @TeX{} system require any special system
1170 privileges, so there's no first-level security concern of people gaining
1171 illegitimate root access.
1172
1173 @cindex trojan horse attack
1174 @flindex .rhosts@r{, writable by @TeX{}}
1175 A @TeX{} document, however, can write to arbitrary files, e.g.,
1176 @file{~/.rhosts}, and thus an unwitting user who runs @TeX{} on a random
1177 document is vulnerable to a trojan horse attack.  This loophole is
1178 closed by default, but you can be permissive if you so desire in
1179 @file{texmf.cnf}.  @xref{tex invocation,,, web2c, Web2c}.  MetaPost has
1180 the same issue.
1181
1182 Dvips, Xdvi, and @TeX{} can also execute shell commands under some
1183 circumstances.  To disable this, see the @samp{-R} option in @ref{Option
1184 details,,, dvips, Dvips}, the xdvi man page, and @ref{tex
1185 invocation,,, web2c, Web2c}, respectively.
1186
1187 @cindex local cache of fonts
1188 @cindex cache of fonts, local
1189 Another security issue arises because it's very useful---almost
1190 necessary---to make arbitrary fonts on user demand with @code{mktexpk}
1191 and friends.  Where do these files get installed?  By default, the
1192 @code{mktexpk} distributed with Kpathsea assumes a world-writable
1193 @file{/var/tmp} directory; this is a simple and convenient approach, but
1194 it may not suit your situation because it means that a local cache of
1195 fonts is created on every machine.
1196
1197 @cindex globally writable directories
1198 To avoid this duplication, many people consider a shared, globally
1199 writable font tree desirable, in spite of the potential security
1200 problems.  To do this you should change the value of @code{VARTEXFONTS}
1201 in @file{texmf.cnf} to refer to some globally known directory.
1202 @xref{mktex configuration}.
1203
1204 @cindex append-only directories and @code{mktexpk}
1205 The first restriction you can apply is to make newly-created directories
1206 under @file{texmf} be append-only with an option in @file{mktex.cnf}.
1207 @xref{mktex configuration}.
1208
1209 @cindex group-writable directories
1210 @cindex setgid scripts
1211 Another approach is to establish a group (or user) for @TeX{} files,
1212 make the @file{texmf} tree writable only to that group (or user), and
1213 make @code{mktexpk} et al.@: setgid to that group (or setuid to that
1214 user).  Then users must invoke the scripts to install things.  (If
1215 you're worried about the inevitable security holes in scripts, then you
1216 could write a C wrapper to exec the script.)
1217
1218 @cindex file permissions
1219 @cindex permissions, file
1220 The @file{mktex@dots{}} scripts install files with the same read and
1221 write permissions as the directory they are installed in.  The
1222 executable, sgid, suid, and sticky bits are always cleared.
1223
1224 @cindex directory permissions
1225 @cindex permissions, directory
1226 Any directories created by the @file{mktex@dots{}} scripts have the
1227 same permissions as their parent directory, unless the
1228 @code{appendonlydir} feature is used, in which case the sticky bit is
1229 always set.