8 @chapter The @TL{} Build System
11 @cindex the @TL{} build system
13 The @TL{} build system has been redesigned in 2009, using Autoconf,
14 Automake, and Libtool. Thus @* @ @ @ @code{configure && make && make check
15 && make install} @* or the more or less equivalent top-level @code{Build}
16 script suffice to build and install the @TL{} programs, where @code{make
17 check} performs various test of the generated programs that are not
18 necessary but strongly recommend.
20 The main components of the @TL{} build system are @TeX{} specific programs
21 in subdirectories @file{texk/@var{prog}}, utility programs in subdirectories
22 @file{utils/@var{prog}}, @TeX{} specific libraries in subdirectories
23 @file{texk/@var{lib}} (@code{@var{lib}=kpathsea}@dots{}) used by the @TeX{} specific
24 programs, and generic libraries in subdirectories @file{libs/@var{lib}}.
26 The primary design goal is modularity. Each program and library module (or
27 package) specifies its own requirements and properties, such as required
28 libraries, whether an installed (system) version of a library can be used,
29 configure options to be seen at the top-level, and more. An explicit list
30 of all available modules is only kept in one central place.
32 A second, related goal is to configure and build each library before
33 configuring any other (program or library) module using that library. This
34 allows to check for properties and features of a library built as part of
35 the @TL{} tree in much the same way as for a system version of that library.
37 All generic libraries and several programs are maintained independently.
38 The corresponding modules use (parts of) the distributed source tree and
39 document any modifications of that source tree.
41 All this should simplify upgrading of modules maintained independently
42 and/or integrating new modules into the @TL{} build system.
45 * Prerequisites:: Requirements to Build @TL{}.
46 * Building and Installing:: Building and Installing @TL{}.
47 * Source Tree:: The @TL{} Source Tree.
48 * Configure Options:: List of all Configure Options.
49 * Cross Compilation:: Cross Compilation.
50 * Coding Rules:: Coding Rules for @TL{}.
54 @section Requirements to Build @TL{}
56 Building the @TL{} programs requires
67 @noindent and uses the libraries included in the @TL{} source tree.
68 There are, however, some additional requirements
72 @file{xindy} requires GNU @command{clisp} and in addition
73 @command{perl}, @command{latex}, and @command{pdflatex} to build the rules
77 Autodetection of the @TL{} platform name for @file{biber} requires
81 @file{xpdfopen} and @file{xdvik} require X11 headers and libraries (often a
82 ``development'' package, not installed by default).
85 XeTeX requires an Objective C++ compiler under Mac OS X or otherwise
86 @file{libfontconfig} (again both headers and library).
89 Modification of any @code{.y} or @code{.l} source files requires
90 @file{bison} or @file{flex} to updatete the corresponding C sources;
91 modification of the sources for @code{.info} files requires
95 Modification of any part of the build system (@code{M4} macros,
96 @file{configure.ac}, @file{Makefile.am}, or their fragments) requires GNU
97 M4, GNU Autoconf, GNU Automake, and GNU Libtool to update the generated
102 @noindent Without the required tools modifying such files or building these
103 programs must avoided, e.g., via @code{--disable-xindy} or
106 @node Building and Installing
107 @section Building and Installing @TL{}
109 The top-level @file{Build} script can be used to configure and build
110 everything in a subdirectory (root of the build tree, default @file{Work}),
111 install everything in an other subdirectory (default @file{inst}), and
112 finally run @code{make check}. Several details of this process can be
113 specified via environment variables and a few leading options; all remaining
114 arguments (assignments or options) are passed to the @file{configure}
115 script. Or one can run @command{configure} and @command{make} in a suitable
116 empty subdirectory. In principle one could run @command{./configure} in the
117 top-level directory of the source tree; this is, however, not well tested
118 and should be avoided.
120 Running the top-level @file{configure} script configures just the top-level
121 and the subdirectories @file{libs}, @file{utils}, and @file{texk}. Running
122 @command{make} at the top-level first iterates over all @TeX{} specific
123 libraries, and then runs @command{make} in @file{libs}, @file{utils}, and
124 @file{texk} to iterate over all generic libraries, utility programs, and
125 @TeX{} specific programs. These iterations consist of two steps: @* (1) For
126 each library or program module not yet configured run @command{configure}
127 adding the configure option @code{--disable-build} if the module need not be
128 built or otherwise run @command{make all}. @* (2) For each library or
129 program module that must be built run @command{make} for the selected
130 target(s): @code{default} or @code{all} to (re-)build, @code{check} to run
131 tests, @code{install} etc.
133 Running the top-level @command{make} a second time iterates again over all
134 library and program modules but finds nothing to be done unless some source
135 files have been modified.
137 In case configuring or building a module fails, one could fix the problem,
138 remove the subdirectory for that module from the build tree, and rerun the
139 top-level @command{make} (or @file{Build} script with @code{--no-clean} as
140 additional first argument).
142 With the configure option @code{--disable-all-pkgs} all program and library
143 modules are configured but none of them are built. The @file{Makefile} for
144 each such module contains all build rules and dependencies and can be
145 invoked to build an individual program or library and causes to first build
146 any required libraries. This build "on demand" procedure is used, e.g., in
147 the @code{luatex} repository to build Lua@TeX{}, essentially from a subset
148 of the complete @TL{} tree. Similarly, when, e.g., building @eTeX{} has
149 been disabled (as by default), one can run @command{make etex} (or
150 @command{make etex.exe}) in @file{texk/web2c/} to build @eTeX{} (altough
151 there is no simple way to install @eTeX{}).
153 The @TL{} build system carefully formulates dependencies as well as make
154 rules when a tool (such as @command{tangle}, @command{ctangle}, or
155 @command{convert}) creates several output files. This allows for parallel
156 builds (@command{make -j @var{n}} with @var{n}>1 or even @command{make -j})
157 that can considerably speed up the @TL{} build on multi core systems.
158 Further speed up can be achieved by using a configure cache file, i.e., with
159 the option @code{-C}.
161 Running @command{make dist} at the top-level creates a tarball
162 @file{tex-live-@var{yyyy}-@var{mm}-@var{dd}.tar.xz} from the @TL{} source
163 tree, whereas @command{make dist-check} also verifies that this tarball
164 suffices to build and install all of @TL{}.
166 @subsection Installation Paths
168 Running @code{make install} (or @code{make install-strip}) installs
169 executables in @code{@var{bindir}}, libraries in @code{@var{libdir}},
170 headers in @code{@var{includedir}}, data (including "linked scripts") in
171 @code{@var{datarootdir}/texmf-dist}, manpages in @code{@var{mandir}}, and
172 @TeX{} info files in @code{@var{infodir}}. The values of these directories
173 are determined by @command{configure} and can be specified explictly as
174 options such as @code{--prefix=@var{prefix}} or
175 @code{--bindir=@var{bindir}}; otherwise they are given by their usual
179 @var{prefix} /usr/local
180 @var{exec_prefix} @var{prefix}
181 @var{bindir} @var{exec_prefix}/bin
182 @var{libdir} @var{exec_prefix}/lib
183 @var{includedir} @var{prefix}/include
184 @var{datarootdir} @var{prefix}/share
185 @var{mandir} @var{datarootdir}/man
186 @var{infodir} @var{datarootdir}/info
189 @noindent and modified as follows:
193 If the option @code{--enable-multiplatform} is given (or implied for a
194 native @TL{} build), @code{/@var{host}}, i.e., the canonical host name is
195 appended to @code{@var{bindir}} and @code{@var{libdir}}.
198 In a native @TL{} build @code{@var{datarootdir}} is set to
199 @code{@var{prefix}}, @code{@var{mandir}} to
200 @code{@var{prefix}/texmf-dist/doc/man}, and @code{@var{infodir}} to
201 @code{@var{prefix}/texmf-dist/doc/info}.
204 @noindent The top-level @file{configure} script displays all these
207 For a native @TL{} build either for the @TL{} DVD or for an additional
208 platform the contents of @code{@var{bindir}} should be copied to the
209 directory @code{Master/bin/@var{arch}} of the @TL{} tree where
210 @code{@var{arch}} is the @TL{} platform name corresponding to the canonical
211 host name @code{@var{host}}, the contents of @code{@var{libdir}} and
212 @code{@var{includedir}} can be discarded, and everything else should match
213 files already present in the @TL{} tree.
215 @subsection Linked Scripts
217 Quite a few executables are architecture independent Shell, Perl, or other
218 scripts. Some of them are maintained as part of the @TL{} source tree, but
219 most are maintained elsewhere with copies under
220 @file{texk/texlive/linked_scripts}. They are installed under
221 @code{@var{datarootdir}/texmf-dist/scripts}; for Unix-like systems there is
222 a symbolic link pointing, e.g., from @code{@var{bindir}/ps2eps} to
223 @code{@var{datarootdir}/texmf-dist/scripts/ps2eps/ps2eps.pl} whereas for
224 Windows @code{@var{bindir}/ps2eps.exe} is a copy of a small standard binary
225 serving the same purpose. One reason for all this is to avoid having many
226 copies for the same script, but most importantly this allows to invoke the
227 same Perl or other script under Windows.
229 @subsection Distro Builds
231 Although they use the same code base, building for a @TL{} binary distribution
232 as shipped by the user groups may be quite different from a 'distro' build
233 for, e.g., some kind of Linux distribution, a *Bsd or Mac OS X port, or
236 While a @TL{} binary distribution uses shared libraries (@file{libc},
237 @file{libm}, X11 libraries, and @file{libfontconfig}) only when absolutely
238 necessary, a distro might use as many shared libraries as possible,
239 including @TeX{} specific libraries such as @file{libkpathsea}. In addition
240 the installation paths will, in general, be quite different.
242 @subsubsection Configuring for a Distro
244 For a distro build you must use @* @ @ @
245 @code{--disable-native-texlive-build} @* and should use @* @ @ @
246 @code{--with-banner-add=/@var{SomeDistro}} @* to identify your distro. You
247 may specify @* @ @ @ @code{--enable-shared} @* to build shared @TeX{}
248 specific libraries and might add @* @ @ @ @code{--disable-static} @* to not
249 build the static ones. You would like to use @* @ @ @
250 @code{--with-system-@var{lib}} for as many libraries as possible and may
251 then have to add @code{--with-@var{lib}-includes=@var{dir}} and/or
252 @code{--with-@var{lib}-libdir=@var{dir}}.
254 You should specify @* @ @ @ @code{--prefix=/usr} or perhaps
255 @code{--prefix=/opt/TeXLive} @* and may have to add @* @ @ @
256 @code{--libdir=\$@{exec_prefix@}/lib64} @* for 64-bit bi-arch (Linux)
259 To make a usable @TeX{} installation, you need (thousands of) support files
260 in addition to the binaries that are built and installed here. The support
261 files are maintained completely independently. The best basis for dealing
262 with them is the @TL{} (plain text) database and/or the @TL{} installer.
265 @section The @TL{} Source Tree
267 The @TL{} source tree is the subtree rooted at @file{Build/source} of the
268 complete @TL{} tree and contains the sources for all @TL{} executables as
269 well as @command{make} rules to build and install them together with some of
273 * Top Levels:: The Top-Level Directories.
274 * Autoconf Macros:: @TL{} Specific Autoconf Macros
275 * Library Modules:: Structure of Library Modules.
276 * Program Modules:: Structure of Program Modules.
277 * Extending:: Adding New Modules.
282 @noindent These versions should be used to update the generated files (e.g.,
283 @file{configure} or @file{Makefile.in}) in all or parts of the @TL{} tree
284 when some of their sources have been changed. This can be done explicitly
285 with the top-level @command{reautoconf} script or implicitly by using the
286 configure option @code{--enable-maintainer-mode}.
288 The files in the SVN repository @url{svn://tug.org/texlive/trunk} are all up
289 to date, but this need not be reflected by their timestamps. To avoid
290 unnecessary runs of @command{bison}, @command{flex}, or @command{makeinfo}
291 it may be necessary to @command{touch} the generated (@file{.c}, @file{.h},
292 or @file{.info}) files. With @code{--enable-maintainer-mode} mode it may
293 also be necessary to @command{touch} first @file{aclocal.m4}, then
294 @file{configure} and @file{config.h.in} (or @file{c-auto.in}), and finally
295 all @file{Makefile.in} files.
298 @subsection The Top-Level Directories
300 The files @file{config.guess}, @file{config.sub}, etc.@ for most packages
301 are kept centrally in @file{build-aux/}, sourced from GNU Gnulib
302 (@url{http://www.gnu.org/software/gnulib}), which in turn pulls them from
303 their ultimate upstream source repository. There are, however, independent
304 copies in, e.g., @file{libs/freetype2/freetype-*/builds/unix/}, and similar
305 places. The @command{reautoconf} script does not take care of those, but a
306 @TL{} cron job keeps them in sync (nightly).
308 The directories @file{m4/} and @file{am/} contain Autoconf macros and
309 @file{Makefile.am} fragments respectively, all of them used in many places.
311 The file @file{m4/kpse-pkgs.m4} contains lists of all program and library
312 modules; missing modules are, however, silently ignored. Each such module
313 contributes fragments defining its capabilities and requirements to the
314 @file{configure.ac} scripts at the top-level and in the subdirectiories
315 @file{libs}, @file{utils}, and @file{texk}. The fragments from program
316 modules supply configure options to disable or enable building them, those
317 from library modules specify if an installed (system) version of that
318 library can be used. This decides which modules need to be built, although
319 all modules must be configured for the benefit of @file{make} targets such
320 as @code{dist} or @code{distcheck}.
322 The directory @file{extra/} contains things which are not part of the TeX
323 Live build, but are present for convenience, e.g., @file{epstopdf} developed
324 here or @file{xz} required by the @TL{} installer.
326 @node Autoconf Macros
327 @subsection @TL{} Specific Autoconf Macros
331 @c The ARG is an optional argument. To be used for macro arguments in
332 @c their documentation (@defmac).
334 @r{[}@var{\varname\}@r{]}
337 @c @dvar(ARG, DEFAULT)
338 @c -------------------
339 @c The ARG is an optional argument, defaulting to DEFAULT. To be used
340 @c for macro arguments in their documentation (@defmac).
341 @macro dvar{varname, default}
342 @r{[}@var{\varname\} = @samp{\default\}@r{]}
345 Here we describe Autoconf macros used for several modules. They are
346 supplemented by module specific macros in directories such as
347 @file{texk/dvipng/m4/}.
349 @subsubsection General Setup
351 The macro @code{KPSE_BASIC} is used to initialize the @TL{} infrastructure
352 common to all generic library and utility program modules, whereas the
353 @TeX{} specific library and program modules use @code{KPSE_COMMON} to
354 perform additional checks.
356 @defmac KPSE_BASIC (@var{name}, @ovar{more-options})
358 Initialize the basic @TL{} infrastructure for module @var{name}: @* @ @ @
359 @code{AM_INIT_AUTOMAKE([foreign @var{more-options}])} @* @ @ @
360 @code{AM_MAINTAINER_MODE} @* @ @ @ @code{KPSE_COMPILER_WARNINGS} @* and make sure the
361 C compiler understands function prototypes.
365 @defmac KPSE_COMMON (@var{name}, @ovar{more-options})
367 Like @code{KPSE_BASIC} but add: @* @ @ @ @code{LT_PREREQ([2.2.6])} @* @ @
368 @ @code{LT_INIT([win32-dll])} @* @ @ @ @code{AC_SYS_LARGEFILE} @* @ @ @
369 @code{AC_FUNC_FSEEKO} @* and check for various frequently used functions,
370 headers, types, and structures.
374 @subsubsection Programs
376 @defmac KPSE_CHECK_LATEX
378 Set LATEX to the name of the first of @command{latex}, @command{elatex}, or
379 @command{lambda} existing in the PATH, or to @code{no} if none of them
380 exists. Call @code{AC_SUBST} for LATEX. The result of this test can be
381 overridden by setting the LATEX variable or the cache variable
382 @code{ac_cv_prog_LATEX}.
386 @defmac KPSE_CHECK_PDFLATEX
388 Check for @command{pdflatex} existing in the PATH and set PDFLATEX.
392 @defmac KPSE_CHECK_PERL
394 Check for @command{perl} or @command{perl5} existing in the PATH and set PERL.
398 @defmac KPSE_PROG_LEX
400 Call @code{AC_PROG_LEX} and add the flag @code{-l} for @command{flex}.
404 @subsubsection Compilers
406 @defmac KPSE_COMPILER_WARNINGS
408 When using the (Objective) C/C++ compiler set WARNING_[OBJ]C[XX]FLAGS to
409 suitable warning flags (depending on the value given to or implied for
410 @code{--enable-compiler-warnings}). Call @code{AC_SUBST} for them. At the
411 moment this only works for GNU compilers, but could be extended to others
414 This macro caches its results in the @code{kpse_cv_warning_cflags}, @dots{}
419 @defmac KPSE_COMPILER_VISIBILITY
421 When using the C or C++ compiler try to set VISIBILITY_C[XX]FLAGS to flags
422 to hide external symbols. Call @code{AC_SUBST} for this variable. At the
423 moment this only tests for @code{-fvisibility=hidden}, but that could be
424 extended with more flags when necessary.
426 This macro caches its results in the @code{kpse_cv_visibility_cflags} or
427 @code{kpse_cv_visibility_cxxflags} variable.
431 @defmac KPSE_CXX_HACK
433 Provide the configure option @code{--enable-cxx-runtime-hack}. If enabled
434 and when using @command{g++}, try to statically link with @file{libstdc++},
435 somewhat improving portability.
437 This macro caches its result in the @code{kpse_cv_cxx_hack} variable.
441 @subsubsection Library Functions
443 @defmac KPSE_LARGEFILE (@var{variable}, @ovar{extra-define})
445 Call @code{AC_SYS_LARGEFILE} and @code{AC_FUNC_FSEEKO} and append suitable
446 @code{-D} flags (optionally including @code{-D@var{extra-define}}) to
451 @subsubsection Flags for Libraries and Headers
453 Each library module @file{libs/@var{lib}} or @file{texk/@var{lib}} there is
454 supplemented by a macro @code{KPSE_@var{LIB}_FLAGS} that provides make
455 variables for that library. For, e.g., @file{libs/libpng} there is:
457 @cpindex @code{KPSE_CAIRO_FLAGS}
458 @cpindex @code{KPSE_FONTCONFIG_FLAGS}
459 @cpindex @code{KPSE_FREETYPE2_FLAGS}
460 @cpindex @code{KPSE_GD_FLAGS}
461 @cpindex @code{KPSE_GRAPHITE2_FLAGS}
462 @cpindex @code{KPSE_HARFBUZZ_FLAGS}
463 @cpindex @code{KPSE_ICU_FLAGS}
464 @cpindex @code{KPSE_KPATHSEA_FLAGS}
465 @cpindex @code{KPSE_LIBPAPER_FLAGS}
466 @cpindex @code{KPSE_LUA52_FLAGS}
467 @cpindex @code{KPSE_LUAJIT_FLAGS}
468 @cpindex @code{KPSE_PIXMAN_FLAGS}
469 @cpindex @code{KPSE_POPPLER_FLAGS}
470 @cpindex @code{KPSE_POTRACE_FLAGS}
471 @cpindex @code{KPSE_PTEXENC_FLAGS}
472 @cpindex @code{KPSE_TECKIT_FLAGS}
473 @cpindex @code{KPSE_XPDF_FLAGS}
474 @cpindex @code{KPSE_ZLIB_FLAGS}
475 @cpindex @code{KPSE_ZZIPLIB_FLAGS}
476 @defmac KPSE_LIBPNG_FLAGS
478 Provide the configure option @code{--with-system-libpng}. Set and
479 @code{AC_SUBST} make variables for modules using this library (either an
480 installed version or from the @TL{} tree): LIBPNG_INCLUDES for use in
481 CPPFLAGS, LIBPNG_LIBS for use in LDADD, LIBPNG_DEPEND for use as dependency,
482 and LIBPNG_RULE defining @command{make} rules to rebuild the library.
486 @defmac KPSE_ADD_FLAGS (@var{name})
488 Temporarily extend CPPFLAGS and LIBS with the values required for the
489 library module @code{@var{name}}.
493 @defmac KPSE_RESTORE_FLAGS
495 Restore CPPFLAGS and LIBS to their original values.
499 @noindent The file @file{configure.ac} for a hypothetical module
500 @file{utils/foo} using @file{libpng} (and @file{zlib}) would contain @* @ @
501 @ @code{KPSE_ZLIB_FLAGS} @* @ @ @ @code{KPSE_LIBPNG_FLAGS} @* and
502 @file{Makefile.am} might contain @* @ @ @ bin_PROGRAMS = foo @* @ @ @
503 AM_CPPFLAGS = $@{LIBPNG_INCLUDES@} $@{ZLIB_INCLUDES@} @* @ @ @ foo_LDADD =
504 $@{LIBPNG_LIBS@} $@{ZLIB_LIBS@} @* @ @ @ foo_DEPENDENCIES =
505 $@{LIBPNG_DEPEND@} $@{ZLIB_DEPEND@} @* @ @ @ ## Rebuild libz @* @ @ @
506 @@ZLIB_RULE@@ @* @ @ @ ## Rebuild libpng @* @ @ @ @@LIBPNG_RULE@@
508 @noindent In order to examine some @file{libpng} features,
509 @file{configure.ac} should be continued with @* @ @ @
510 @code{KPSE_ADD_FLAGS([zlib])} @* @ @ @ @code{@dots{} #} tests for
511 @file{zlib} features (if any). @* @ @ @ @code{KPSE_ADD_FLAGS([libpng])} @*
512 @ @ @ @code{@dots{} #} tests for @file{libpng} features. @* @ @ @
513 @code{KPSE_RESTORE_FLAGS #} restore CPPFLAGS and LIBS.
515 @subsubsection Windows Specific Macros
517 Windows differs in several aspects from Unix-like systems, many of them due
518 to the lack of symbolic links.
520 @defmac KPSE_CHECK_WIN32
522 Check if compiling for a Windows system. The result is @code{no} for Unix-like
523 systems (including Cygwin), @code{mingw32} for Windows with GCC, or
524 @code{native} for Windows with MSVC and is cached in the
525 @code{kpse_cv_have_win32} variable.
529 @defmac KPSE_COND_WIN32
531 Call @code{KPSE_CHECK_WIN32} and define the Automake conditional
532 @code{WIN32} (@code{true} if the value of @code{kpse_cv_have_win32} is not
537 @defmac KPSE_COND_MINGW32
539 Call @code{KPSE_COND_WIN32} and define the Automake conditional
540 @code{MINGW32} (@code{true} if the value of @code{kpse_cv_have_win32} is
545 @defmac KPSE_COND_WIN32_WRAP
547 Call @code{KPSE_COND_WIN32} and define the Automake conditional
548 @code{WIN32_WRAP} (@code{true} if the standard Windows wrapper
549 @file{texk/texlive/w32_wrapper/runscript.exe} exists). This wrapper
550 is used on Windows instead of symlinks to the "linked scripts".
554 @defmac KPSE_WIN32_CALL
556 Call @code{KPSE_COND_WIN32}, check if the file
557 @file{texk/texlive/w32_wrapper/callexe.c} exists, and if so create a symlink
558 in the build tree. Compiling @file{callexe.c} with
559 @code{-DEXEPROG='"@var{foo}.exe"'} and installing @file{callexe.exe} as
560 @code{@var{bar}.exe} is used for Windows instead of a symlink
561 @code{@var{bar}->@var{foo}} for Unix-like systems.
565 @node Library Modules
566 @subsection Structure of Library Modules
568 The structure of library modules is best explained with a few examples.
570 @subsubsection The @code{png} Library in @file{libs/libpng}
572 This generic library uses the distributed source tree in, e.g.,
573 @file{libpng-1.5.17} with all modifications recorded in
574 @file{libpng-1.5.17-PATCHES/*}. The @file{configure.ac} fragment
575 @file{ac/withenable.ac} contains
578 KPSE_WITH_LIB([libpng], [zlib])
581 @noindent with the module name and indicating the dependency on @code{zlib}.
582 A third argument @code{tree} would specify that the library from the @TL{}
583 tree can not be replaced by a system version. That not being the case, a
584 second fragment @file{ac/libpng.ac} contains
587 KPSE_TRY_LIB([libpng],
589 [png_structp png; png_voidp io; png_rw_ptr fn;
590 png_set_read_fn(png, io, fn);])
593 @noindent and provides the simple C code
598 @{ png_structp png; png_voidp io; png_rw_ptr fn;
599 png_set_read_fn(png, io, fn);
603 @noindent used to verify the usability of a system version. The similar
604 macro @code{KPSE_TRY_LIBXX} would provide some C++ code. These fragments
605 are included by @file{configure.ac} at the top levels.
607 A proxy build system (@file{configure.ac}, @file{Makefile.am}, and
608 @file{include/Makefile.am}) ignores the distributed one and consequently a
609 few generated files and auxiliary scripts are removed from the distributed
610 source tree. The public headers @file{png.h}, @file{pngconf.h}, and
611 @file{pnglibconf.h} are 'installed' (as symlinks) under @file{include/} in
612 the build tree exactly as they are for a system version under, e.g.,
613 @file{/usr/include/}.
615 The module is supplemented by the file @file{m4/kpse-libpng-flags.m4} that
616 defines the @code{M4} macro @code{KPSE_LIBPNG_FLAGS} used by all modules
617 depending on this library in their @file{configure.ac} to generate the
618 @code{make} variables @code{LIBPNG_INCLUDES} for use in @code{CPPFLAGS},
619 @code{LIBPNG_LIBS} for use in @code{LDADD}, @code{LIBPNG_DEPEND} for use as
620 dependency, and @code{LIBPNG_RULE} defining @code{make} rules to rebuild the
623 In addition @file{m4/kpse-libpng-flags.m4} supplies the configure option
624 @code{--with-system-libpng} and uses @command{pkg-config} to determine the
625 flags required for the system library.
627 @subsubsection The @code{zlib} Library in @file{libs/zlib}
629 This generic library is quite analogous to @code{libpng} but does not depend
630 on any other library. The file @file{m4/kpse-zlib-flags.m4} supplies the
631 configure option @code{--with-system-zlib} as well as
632 @code{--with-zlib-includes} and @code{--with-zlib-libdir} to specify non
633 standard locations of the @code{zlib} headers and/or library.
635 @subsubsection The @code{freetype} Library in @file{libs/freetype2}
637 This module uses a wrapper build system with an almost trivial
638 @file{configure.ac} and with @file{Makefile.am} that invokes
639 @command{configure} and @command{make} for the distributed source, followed
640 by @command{make install} with the build tree as destination. The flags
641 required for the system library are obtained through
642 @command{freetype-config}.
644 @subsubsection The @code{kpathsea} Library in @file{texk/kpathsea}
646 This is one of the @TeX{} specific libraries that are maintained as part of
647 @TL{}. Other than the generic libraries they are (static and/or shared)
648 Libtool libraries and are installed together with the programs. They are,
649 however, not part of the @TL{} DVD as distributed by @TeX{} user groups.
651 It is possible, although quite unusual to specify the configure option
652 @code{--with-system-kpathsea} in order to use a system version of the
653 library and it may then be necessary to specify
654 @code{--with-kpathsea-includes} and/or @code{--with-kpathsea-libdir}.
656 In addition to @file{ac/withenable.ac} and @file{ac/kpathsea.ac} there is a
657 third fragment @file{ac/mktex.ac} included by both @file{ac/withenable.ac}
658 and @file{configure.ac} that supplies configure options such as
659 @code{--enable-mktextfm-default} determining the compile time default
660 whether or not to run @code{mktextfm} to generate a missing @file{.tfm}
661 file. Note, however, that the command line options @code{-mktex=tfm} or
662 @code{-no-mktex=tfm} for @TeX{}-like engines override this default.
664 @node Program Modules
665 @subsection Structure of Program Modules
667 The structure of program modules is again best explained with a few examples.
669 @subsubsection The @code{t1utils} Package in @file{utils/t1utils}
671 Once again we use the distributed source tree @file{t1utils-1.38} with
672 modifications documented in @file{t1utils-1.38-PATCHES/*} and a proxy build
673 system consisting of @file{configure.ac} and @file{Makefile.am}. The
674 fragment @file{ac/withenable.ac} contains
677 KPSE_ENABLE_PROG([t1utils])
680 @noindent specifying the module name without any dependencies and supplies
681 the configure option @code{--disable-t1utils}.
683 @subsubsection The @code{xindy} Package in @file{utils/xindy}
685 This module uses the distributed source tree @file{xindy-2.4} with
686 modifications documented in @file{xindy-2.4-PATCHES/*}, a proxy
687 @file{configure.ac}, and a wrapper @file{Makefile.am} that descends into
688 @file{xindy-2.4}. This requires that the distributed @file{Makefile}s allow
689 a VPATH build, can handle all targets, and do not refer to
690 @code{$@{top_srcdir@}} or @code{$@{top_builddir@}}. The fragment
691 @code{ac/withenable.ac} contains
694 KPSE_ENABLE_PROG([xindy], , [disable native])
695 m4_include(kpse_TL[utils/xindy/ac/xindy.ac])
696 m4_include(kpse_TL[utils/xindy/ac/clisp.ac])
699 @noindent where @code{disable} in the third argument indicates that
700 @code{xindy} is only built if explicitly enabled by @code{--enable-xindy}
701 (because it requires @code{clisp}) and @code{native} disallows cross
702 compilation. The additional fragments @file{ac/xindy.ac} and
703 @file{ac/clisp.ac} specify more configure options to be seen at the
704 top-leved with @file{ac/xindy.ac} also included by @file{configure.ac}.
706 @subsubsection The @code{xdvik} Package in @file{texk/xdvik}
708 This package is maintained as part of the @TL{} tree with sources in its
709 top-level and the subdirectory @file{gui}. The fragment
710 @code{ac/withenable.ac} contains
713 dnl extra_dirs = texk/xdvik/squeeze
714 KPSE_ENABLE_PROG([xdvik], [kpathsea freetype2], [x])
715 m4_include(kpse_TL[texk/xdvik/ac/xdvik.ac])
718 @noindent and specifies the dependency on the @code{kpathsea},
719 @code{freetype}, and @code{X11} libraries. The @code{M4} comment (following
720 @code{dnl}) signals the subsidiary @file{squeeze/configure.ac}. This is
721 needed because the main executable @file{xdvi-bin} (to be installed as,
722 e.g., @file{xdvi-xaw}) is for the @code{host} system whereas the auxiliary
723 program @file{squeeze/squeeze} has to run on the @code{build} system and in
724 a cross compilation they differ. The additional fragment @code{ac/xdvik.ac}
725 is also included by @file{configure.ac} and supplies the configure option
726 @code{--with-xdvi-x-toolkit} also seen at the top-level.
728 @subsubsection The Subdirectory @file{utils/asymptote}
730 This subdirectory contains the sources for @file{asy} and @file{xasy} but
731 due to its complexity and prerequisites (e.g., @file{libGL}) it is not part
732 the @TL{} build system. These programs must be built and installed
733 independently, but are contained in the @TL{} DVD together with their
738 @subsection Adding New Modules
740 @subsubsection Adding a New Program Module
742 A @TeX{} specific program module in a subdirectory @file{texk/@var{prog}} may use
743 the @TeX{} specific libraries and is included by adding its name @file{@var{prog}}
744 to the @code{M4} list @code{kpse_texk_pkgs} defined in
745 @file{m4/kpse-pkgs.m4}. A generic program module in a subdirectory
746 @file{utils/@var{prog}} must not use the @TeX{} specific libraries and is included
747 by adding its name @file{@var{prog}} to the @code{M4} list @code{kpse_utils_pkgs}
748 in @file{m4/kpse-pkgs.m4}. Apart from the program sources and build system
749 (@file{configure.ac} and @file{Makefile.am}) the subdirectory
750 @file{texk/@var{prog}} or @file{utils/@var{prog}} must provide a fragment
751 @file{ac/withenable.ac} that contains the @code{M4} macro
752 @code{KPSE_ENABLE_PROG} defined in @file{m4/kpse-setup.m4} with @code{@var{prog}}
753 as mandatory first argument and three optional arguments: a list of required
754 libraries from the @TL{} tree, a list of options (@code{disable} if this
755 module is not to be built without the configure option @code{--enable-@var{prog}},
756 @code{native} if cross compilation is not possible, @code{x} if the program
757 requires X11 libraries), and a comment added to the help text for the
758 configure option @code{--enable-@var{prog}} or @code{--disable-@var{prog}}.
760 If the module requires specific configure options to be seen at the
761 top-level, they should be defined in an additional fragment
762 @file{ac/@var{prog}.ac} included from @file{ac/withenable.ac} and
765 @subsubsection Adding a New Generic Library Module
767 A generic library module in a subdirectory @file{libs/@var{lib}} must not depend
768 on @TeX{} specific libraries and is included by adding its name @file{@var{lib}}
769 to the @code{M4} list @code{kpse_libs_pkgs} in @file{m4/kpse-pkgs.m4}
770 (before other libraries from the @TL{} tree it depends on). As for program
771 modules the subdirectory @file{libs/@var{lib}} must contain the sources and build
772 system for the library (and any installable support programs) and a fragment
773 @file{ac/withenable.ac} that contains the @code{M4} macro
774 @code{KPSE_WITH_LIB} defined in @file{m4/kpse-setup.m4} with @code{@var{lib}} as
775 mandatory first argument and two optional arguments: a list of required
776 libraries from the @TL{} tree, and a list of options (currently only
777 @code{tree} if this library can not be replaced by a system version).
779 If a system version can be used, a second fragment @file{ac/@var{lib}.ac}
780 containing the @code{M4} macro @code{KPSE_TRY_LIB} (or
781 @code{KPSE_TRY_LIBXX}) with @code{@var{lib}} as mandatory first argument and
782 two additional arguments for the Autoconf macro @code{AC_LANG_PROGRAM} used
783 to compile and link a small C (or C++) program as sanity check for using the
786 In addition a file @file{m4/kpse-@var{lib}-flags} (at the top-level) must define
787 the @code{M4} macro @code{KPSE_@var{LIB}_FLAGS} (all uppercase) setting up the @code{make}
788 variables @code{@var{LIB}_INCLUDES}, @code{@var{LIB}_LIBS}, @code{@var{LIB}_DEPEND}, and
789 @code{@var{LIB}_RULE} with the values required for @code{CPPFLAGS}, @code{LDADD},
790 dependencies, and a (multiline) make rule to rebuild the library when
791 necessary, all that for the library from the @TL{} tree or perhaps for a
794 If a system library is allowed @code{KPSE_@var{LIB}_FLAGS} also provides the
795 configure option @code{--with-system-@var{lib}} and uses the additional @code{M4}
796 macro @code{KPSE_@var{LIB}_SYSTEM_FLAGS} to generate the @code{make} variables for
797 a system library. Furthermore the definition of the @code{M4} macro @code{KPSE_ALL_SYSTEM_FLAGS} in
798 @file{m4/kpse-pkgs.m4} must be extended by the line @* @ @ @
799 @code{AC_REQUIRE([KPSE_@var{LIB}_SYSTEM_FLAGS])}
801 @subsubsection Adding a New @TeX{} Specific Library Module
803 A @TeX{} specific library module in a subdirectory @file{texk/@var{lib}} may
804 depend on other @TeX{} specific libraries but must not depend on any generic
805 library from the @TL{} tree. It is included as is a generic library module
806 with these modifications:
810 The library name @code{@var{lib}} is added to the @code{M4} list
811 @code{kpse_texlibs_pkgs} also in @file{m4/kpse-pkgs.m4}.
814 The fragment @code{ac/withenable.ac} must use @code{KPSE_WITH_TEXLIB}.
818 @node Configure Options
819 @section List of all Configure Options
821 Corresponding to the large number of program and library modules there are
822 plenty of configure options, most of which are described here. The command
823 @* @ @ @ @command{configure --help} @* at the top-level gives an exhaustive
824 list of all global options and a few important module specific ones,
825 whereas, e.g., @* @ @ @ @command{texk/lcdf-typetools/configure --help} @*
826 also displays the @code{lcdf-typetools} specific options not shown at the
827 top-level. The help text also mentions several influential environment
828 variables, but for @TL{} it is better to specify them as assigments on the
831 The @file{./Build} script used to make the binaries shipped with @TL{}
832 invokes the top-level @command{configure} with a few additional options.
833 Any defaults discussed below are those for the base @command{configure}
834 script; invoking @command{configure} via @file{./Build} may yield different
837 Defaults for most options are set at the top-level and propagated explicitly
838 to all subdirectories. Options specified on the command line are checked
839 for consistency but are never modified.
842 * Global Options:: Global Configure Options.
843 * Program Specific Options:: Configure Options for Program Modules.
844 * Library Specific Options:: Configure Options for Library Modules.
845 * Variable Assignments:: Interesting and/or Important Variables.
849 @subsection Global Configure Options
851 @subsubsection @code{--disable-native-texlive-build}
853 If enabled (the default), build for a @TL{} binary distribution as shipped
854 by the user groups; this requires GNU @command{make} and implies
855 @code{--enable-multiplatform} and @code{--enable-cxx-runtime-hack} unless
856 they are explicitly disabled and enforces @code{--disable-shared}.
858 If building @TL{} for a GNU/Linux or other distribution, this should be
859 disabled and system versions of most libraries would be used (see below).
860 This may require GNU @command{make}, but will also try without it.
862 A related option @code{--enable-texlive-build} is automatically passed to
863 all subdirectories (and can not be disabled). Subdirectories that could
864 also be built independently from the @TL{} tree (such as @file{utils/xindy}
865 or @file{texk/dvipng}) can use this option, e.g., to choose @TL{} specific
868 @subsubsection @code{--prefix}, @code{--exec-prefix}, @code{--bindir}, @dots{}
870 These options specify various installation directories as usual, all of them
871 still prefixed by the value of an assignment for @code{DESTDIR} on the
872 @code{make} command line (@pxref{Staged Installs, , Installation in a
873 temporary location, automake, GNU Automake}).
875 @subsubsection @code{--enable-multiplatform}
877 If enabled, install executables and libraries in platform dependent
878 subdirectories of @file{EPREFIX/bin} and @file{EPREFIX/lib} (unless
879 @code{--bindir=@var{dir}} or @code{--libdir=@var{dir}} is specified), where
880 @code{EPREFIX} is the value given or implied for @code{exec_prefix}. The
881 values for @code{bindir} and @code{libdir} are automatically propagated
882 to all subdirectories.
884 @subsubsection @code{--enable-cxx-runtime-hack}
886 If enabled and when using @code{g++}, try to statically link with
887 @code{libstdc++}, somewhat improving portability.
889 @subsubsection @code{--enable-shared}
891 Build shared versions of the @TeX{} specific libraries such as
892 @file{libkpathsea}; this is not allowed for a native @TL{} build.
894 @subsubsection @code{--disable-largefile}
896 Omit large file support (LFS), needed on most 32-bit Unix systems for files
897 with 2GB or more. The size of @code{DVI} and @code{GF} files must always be
898 @math{<2}GB. With LFS there should be no limit on the size of @code{PDF}
899 files created by @file{pdftex} or @code{PS} files created by @file{dvips}.
900 The size of @code{PDF} images included by @file{pdftex} must, however, be
901 @math{<4}GB when using @file{xpdf} and @math{<2}GB when using older versions
902 of @file{poppler} (even on 64-bit systems with LFS), whereas @file{poppler}
903 Version@tie{}0.23 and later imposes no such limit.
905 @subsubsection @code{--without-x}
907 Disable all programs using the X Window System.
909 @subsubsection @code{--enable-compiler-warnings=[no|min|yes|max|all]}
911 Enable various degrees of compiler warnings for (Objective) C and C++. The
912 default is @code{yes} in maintainer-mode and @code{min} otherwise. This
913 option defines @code{WARNING_[OBJ]C[XX]FLAGS} but these flags are not used in all
914 library and program modules. Using them should help to resolve portability
917 At the moment these warning flags are only defined for the GNU
918 compilers but flags for other compilers could be added when needed.
920 @subsubsection @code{--disable-missing}
922 Immediately terminate the build process if a requested program or feature
923 must be disabled, e.g., due to missing libraries.
925 @subsubsection @code{--enable-silent-rules}
927 Enable the use of less verbose build rules. When using GNU @command{make} or
928 another @command{make} implementation that supports nested variable expansions
929 you can always specify @code{V=1} on the make command line to get more
930 respectively @code{V=0} to get less verbosity.
932 @subsubsection @code{--without-ln-s}
934 Required when using a system without working @code{ln -s} to build binaries
935 for a Unix-like system. But note that @code{make install} will not create
936 anything useful and might even fail.
938 @subsubsection @code{--enable-maintainer-mode}
940 Enable @file{make} rules and dependencies not useful (and sometimes
941 confusing) to the casual user. This requires current versions of the GNU
944 @node Program Specific Options
945 @subsection Configure Options for Program Modules
947 @subsubsection @code{--enable-@var{prog}}, @code{--disable-@var{prog}}
949 Do or do not build and install the program(s) of the module @code{@var{prog}}.
951 @subsubsection @code{--disable-all-pkgs}
953 Do not build any program modules, except those explicitly enabled. Without
954 this option, all modules are built except those that are explicitly disabled
955 or specify @code{disable} in their @file{ac/withenable.ac} fragment.
957 @subsubsection Configure Options for @file{texk/web2c}
959 @noindent @code{--with-banner-add=@var{str}} @* Add @code{@var{str}} to the
960 default version string (@code{TeX Live @var{year}} or @code{Web2C
961 @var{year}}) appended to banner lines. This is ignored for a native @TL{}
962 build, but distro builds should specify, e.g., @code{/@var{SomeDistro}}.
964 @noindent @code{--with-editor=@var{cmd}} @* Specify the command
965 @code{@var{cmd}} to invoke from the @code{e} option of @TeX{}-like engines,
966 replacing the default @code{vi +%d '%s'} for Unix or @code{texworks
967 --position=%d "%s"} for Windows.
969 @noindent @code{--enable-auto-core} @* This option causes @TeX{} & METAFONT
970 to produce a core dump when a particular hacky filename is encountered.
972 @noindent @code{--disable-dump-share} @* Make the @code{fmt}/@code{base}
973 dump files architecture dependent (somewhat faster on little-endian
976 @noindent @code{--disable-ipc} @* Disable @TeX{}'s @code{--ipc} option.
978 @noindent @code{--disable-tex}, @code{--enable-etex}, @dots{} @* Do not or
979 do build the various @TeX{}, METAFONT, and MetaPost engines (defaults are
980 defined in the fragment @file{texk/web2c/ac/web2c.ac}).
982 @noindent @code{--enable-tex-synctex}, @code{--disable-etex-synctex},
983 @dots{} @* Build the various @TeX{}-like engines with or without
984 @code{SyncTeX} support (ignored for a native @TL{} build, defaults are
985 again defined in @file{texk/web2c/ac/web2c.ac}).
987 @noindent @code{--with-fontconfig-includes=@var{dir}},
988 @code{--with-fontconfig-libdir=@var{dir}} @* Building @code{XeTeX} on
989 non-Mac systems requires installed @code{fontconfig} headers and library.
990 If one or both of these options are given, the required flags are derived
991 from them; otherwise, they are determined via @file{pkg-config} (if
994 @noindent @code{--enable-libtool-hack} @*
995 If enabled (at present the default for all platforms), prevents
996 @code{libtool} from linking explicitly with dependencies of @file{libfontconfig}
997 such as @file{libexpat}.
999 @noindent @code{--with-mf-x-toolkit} @* Use the X toolkit (@file{libXt}) for
1000 METAFONT (default is yes).
1002 @noindent @code{--enable-*win} @* Include various types of other window
1003 support for METAFONT.
1005 @noindent @code{--disable-mf-nowin} @* Do not build a separate
1006 non-graphically-capable METAFONT.
1008 @noindent @code{--disable-web-progs} @* Do not build the WEB programs
1009 @file{bibtex}, @dots{}, @file{weave}, e.g., if you just want to (re)build
1012 @noindent @code{--disable-omfonts} @* Build the WEB versions of the
1013 Omega font utilities @file{ofm2opl}, @file{opl2ofm}, @file{ovf2ovp}, and
1014 @code{ovp2ovf} instead of the C version @file{omfonts}. The WEB and C versions
1015 should be roughly equivalent.
1017 @subsubsection Configure Options for @file{texk/bibtex-x}
1019 The former modules @code{bibtex8} and @code{bibtexu} have been merged into
1020 @code{bibtex-x} (extended BibTeX).
1022 @noindent @code{--disable-bibtex8} @* Do not build the @file{bibtex8} program.
1024 @noindent @code{--disable-bibtexu} @* Do not build the @file{bibtexu} program
1025 (building @file{bibtexu} requires @code{ICU} libraries).
1027 @subsubsection Configure Options for @file{texk/dvipdfm-x}
1029 The former modules @code{dvipdfmx} and @code{xdvipdfmx} have been merged into
1032 @noindent @code{--disable-dvipdfmx} @* Do not build the @file{dvipdfmx} program.
1034 @noindent @code{--disable-xdvipdfmx} @* Do not build the @file{xdvipdfmx}
1035 program (building @file{xdvipdfmx} requires the @code{freetype} library).
1037 @subsubsection Configure Options for @file{texk/dvisvgm}
1039 @noindent @code{--without-libgs} @* Build @file{dvisvgm} without PostScript
1042 @noindent @code{--with-system-libgs} @* Build @file{dvisvgm} using installed
1043 Ghostscript (@code{gs}) headers and library (not allowed for a native @TL{}
1044 build). The default is to load the @code{gs} library at runtime if
1045 possible, or otherwise disable support for PostScript specials.
1047 @noindent @code{--with-libgs-includes=@var{dir}}, @code{--with-libgs-libdir=@var{dir}}
1048 @* Specify non standard locations of the Ghostscript headers and library.
1050 @subsubsection Configure Options for @file{texk/xdvik}
1052 @noindent @code{--with-gs=@var{path}} @* Hardwire the location of Ghostscript
1055 @noindent @code{--with-xdvi-x-toolkit=@var{kit}} @* Use toolkit @code{@var{kit}}
1056 (@code{motif}/@/@code{xaw}/@/@code{xaw3d}/@/@code{neXtaw}) for @file{xdvi}.
1057 The default is @code{motif} if available, else @code{xaw}.
1059 @subsubsection Configure Options for @file{texk/texlive}
1061 @noindent @code{--disable-linked-scripts} @* Do not install the "linked
1062 script" but install the @TL{} scripts required to run @command{texlinks}.
1064 @subsubsection Configure Options for @file{utils/xindy}
1066 @noindent @code{--enable-xindy-rules} @* Build and install xindy rules
1067 (default: yes, except for a native @TL{} build).
1069 @noindent @code{--enable-xindy-docs} @* Build and install xindy
1070 documentation (default: yes, except for a native @TL{} build).
1072 @noindent @code{--with-clisp-runtime=@var{path}} @* Specifies the full path
1073 of the @code{CLISP} runtime (@file{lisp.run} or @file{lisp.exe}) to be
1074 installed. When specified as @code{default} (the default for a native TeX
1075 Live build) the path is determined by the @code{CLISP} executable; the value
1076 @code{system} (not allowed for a native @TL{} build, but the default for
1077 a non-native one) indicates that @file{xindy} will use the installed version
1078 of @file{clisp} (that must be identical to the one used to build @file{xindy}).
1080 @noindent @code{--with-recode} @* Use @file{recode} instead of @file{iconv}
1081 to build the xindy rules and documentation, required for some systems where
1082 @file{iconv} is missing or broken.
1085 @node Library Specific Options
1086 @subsection Configure Options for Library Modules
1088 @subsubsection @code{--with-system-@var{lib}}
1090 Use an installed (system) version of the library @code{@var{lib}}; this
1091 option exists for most libraries, but is not allowed for a native @TL{}
1092 build. Using a system version implies to also use system versions of all
1093 libraries (if any) this library depends on.
1095 For many libraries there are in addition
1096 @code{--with-@var{lib}-includes=@var{dir}} and
1097 @code{--with-@var{lib}-libdir=@var{dir}} to indicate non standard search
1098 locations, others use @file{pkg-config} or similar to determine the required
1101 The top-level @file{configure} script performs a consistency check for all
1102 required system libraries and bails out if some of these tests fail.
1104 @subsubsection Configure Options for @code{kpathsea}
1106 @noindent @code{--enable-@var{cmd}-default},
1107 @code{--disable-@var{cmd}-default} @* Determine the compile time default
1108 whether or not to run @var{cmd}=@command{mktexmf}, @command{mktexpk},
1109 @command{mktextfm}, @command{mkocp}, @command{mkofm}, @command{mktexfmt}, or
1110 @command{mktextex} to generate a missing MF source, PK font, TFM file, OCP
1111 file, OFM file, format file, or @TeX{} source respectively.
1113 @subsubsection Configure Options for system @file{poppler}
1115 Building @code{LuaTeX} and @code{XeTeX} requires @code{poppler} either from
1116 the @TL{} tree or system headers and library; @code{pdfTeX} requires either
1117 @code{xpdf} from the @TL{} tree or system @code{poppler} headers and
1120 @noindent @code{--with-system-poppler} @* Use a system version (0.18 or
1121 better) of @code{poppler} for @code{LuaTeX} and @code{XeTeX} (and
1122 @file{pkg-config} to obtain the required flags).
1124 @noindent @code{--with-system-xpdf} @* Use a system version (0.12 or better)
1125 of @code{poppler} (and @file{pkg-config}) for @code{pdfTeX} instead of
1126 @code{xpdf} from the @TL{} tree.
1128 REFER to @code{--disable-largefile}
1130 @node Variable Assignments
1131 @subsection Interesting and/or Important Variables
1133 The values for these variables can be specified as @command{configure}
1134 arguments of the form @code{@var{VAR}=@var{value}}. (In principle they
1135 could also come from the environment but that might not work for cross
1138 @subsubsection @code{CC}, @code{CXX}, @code{CPPFLAGS}, @dots{}
1140 As usual, these variables specify the name (or full path) of compilers,
1141 preprocessor flags, and similar.
1143 @subsubsection @code{FT2_CONFIG}, @code{ICU_CONFIG}, @code{PKG_CONFIG}
1145 These specify the name (or path) for the @file{freetype-config},
1146 @file{icu-config}, and @file{pkg-config} commands used to determine the
1147 flags required for system versions of @file{libfreetype}, the @code{ICU}
1148 libraries, or many other libraries.
1150 @subsubsection @code{CLISP}
1152 Name (or path) of the @file{clisp} executable, used to build @code{xindy}.
1154 @subsubsection @code{PERL}, @code{LATEX}, @code{PDFLATEX}
1156 Name (or path) for the @file{perl}, @file{latex}, and @file{pdflatex}
1157 commands used, e.g., to build the @code{xindy} documentation
1159 @subsubsection @code{TL_PLATFORM}
1161 The utility program @file{biber} consists of many components bundled by the
1162 @code{Par::Packer} mechanism of @file{perl}. Therefore they are not built
1163 as part of @TL{} but by the @code{biber} maintainers and third-party
1166 In order that @code{make install} creates all executables in @file{bindir},
1167 the @code{biber} module contains pre-made binaries for the platforms for
1168 which they are available. @TL{} merely checks if an executable is present
1169 for the current platform, and if so, installs it.
1171 The complication is hidden in the phrase "current platform". @TL{} has its
1172 own ideas about platform names, and the mapping from the canonical system
1173 name determined by @file{config.guess} or @file{config.sub} to the @TL{}
1174 platform name is not trivial. A value given for @code{TL_PLATFORM} is used
1175 as @TL{} platform name. Otherwise, we use copies of the standard
1176 @code{perl} modules @code{TeXLive/TLUtils.pm} and
1177 @code{TeXLive/TLConfig.pm}, to avoid duplicating the platform-detection
1180 @subsubsection @code{KPSEWHICH}
1182 Name (or path) of an installed @file{kpsewhich} binary, used by @code{make
1183 check} to determine the location of, e.g., @file{cmbx10.tfm}.
1185 @subsubsection @code{MAKE}, @code{SED}, @dots{}
1187 Name (or path) of GNU @command{make}, GNU @command{sed}, and similar; used
1188 at the top-level and propagated to all subdirectories.
1191 @node Cross Compilation
1192 @section Cross Compilation
1194 In a cross compilation a @code{build} system is used to create binaries to
1195 be executed on a @code{host} system with different hardware and/or operating
1198 In simple cases the build system can execute binaries for the host system.
1199 This typically occurs for bi-arch systems where, e.g., @code{i386-linux}
1200 binaries can run on @code{x86_64-linux} systems and @code{win32} binaries
1201 can run on @code{win64} systems. Although sometimes called "native cross",
1202 this is technically no cross compilation. In most such cases it suffices to
1203 specify suitable compiler flags. It might be useful to add the configure
1204 option @code{--build=@var{host}} to get the correct canonical host name, but
1205 note that this should not be @code{--host=@var{host}} (@pxref{Hosts and
1206 Cross-Compilation, , , autoconf, Autoconf})!
1208 In order to, e.g., build 32-bit binaries with @command{clang} on a 64-bit
1209 OSX system one could use @* @ @ @ @code{./Build --build=i386-apple-darwin
1210 CC='clang -arch i386'} @backslashchar{} @* @ @ @ @ @ @ @ @ @
1211 @code{CXX='clang++ -arch i386' OBJCXX='clang++ -arch i386'}
1214 * Configuring:: Configuring for Cross Compilation.
1215 * Problems:: Cross Compilation Problems.
1219 @subsection Configuring for Cross Compilation
1221 In a genuine cross compilation binaries for the host system can not execute
1222 on the build system and it is necessary to specify the configure options
1223 @code{--host=@var{host}} and @code{--build=@var{build}} with two different
1224 values. Building binaries requires suitable "cross" tools, e.g., compiler,
1225 linker, and archiver, and perhaps a "cross" version of @command{pkg-config}
1226 and similar to locate host system libraries. Autoconf expects that these
1227 cross tools are given by their usual variables or found under their usual
1228 name prefixed with @code{@var{host}-}. Here a list of such tools and
1229 corresponding variables:
1233 @command{freetype-config} FT2_CONFIG
1236 @command{icu-config} ICU_CONFIG
1237 @command{objdump} OBJDUMP
1238 @command{pkg-config} PKG_CONFIG
1239 @command{ranlib} RANLIB
1240 @command{strip} STRIP
1243 @noindent In order to, e.g., build @code{mingw32} binaries on
1244 @code{x86_64-linux} with a cross compiler found as
1245 @file{i386-pc-mingw32-gcc} one would specify @* @ @ @
1246 @code{--host=i386-pc-mingw32 --build=x86_64-linux-gnu} @* or perhaps @* @ @
1247 @ @code{--host=mingw32 --build=x86_64-linux CC=i386-pc-mingw32-gcc} @* but
1248 this might require to add @code{CXX} and others.
1250 Configure arguments such as @code{CFLAGS=@dots{}} refer to the cross compiler.
1251 If necessary, you can specify compilers and flags for the few auxiliary C
1252 and C++ programs required for the build process as configure arguments
1256 BUILDCPPFLAGS=@dots{}
1259 BUILDCXXFLAGS=@dots{}
1260 BUILDLDFLAGS=@dots{}
1264 @subsection Cross Compilation Problems
1266 The fact that binaries for the host system can not be executed on the build
1267 system causes some problems.
1269 One problem is, that configure tests using @code{AC_RUN_IFELSE} can compile
1270 and link the test program but can not execute it. Such tests should be
1271 avoided if possible and otherwise must supply a pessimistic test result.
1273 An other problem arises if the build process must execute some (auxiliary or
1274 installable) programs. Auxiliary programs can be placed into a subdirectory
1275 that is configured natively as is done for @file{texk/dvipsk/squeeze},
1276 @file{texk/web2c/web2c}, and @file{texk/xdvik/squeeze}. The module
1277 @file{libs/freetype} uses the value of @code{CC_BUILD},
1278 @file{@var{build}-gcc}, @file{gcc}, or @file{cc} as compiler for the
1281 The situation for installable programs needed by the build process is
1282 somewhat different. A quite expensive possibility, chosen for the
1283 @code{ICU} libraries in module @file{libs/icu}, is to first compile natively
1284 for the build system and in a second step to use these (uninstalled)
1285 programs during the cross compilation. This would also be possible for the
1286 tools such as @file{tangle} used in the module @file{texk/web2c} to build
1287 the WEB programs, but that would require to first build a native
1288 @code{kpathsea} library. To avoid this complication, cross compilation of
1289 the WEB or CWEB programs in this module requires sufficiently recent
1290 installed versions of @file{tangle}, @file{ctangle}, @file{otangle}, and
1293 Building @code{xindy} requires to run the host system @file{clisp} binary,
1294 thus cross compilation is not possible.
1297 @section Coding Rules
1299 Ideally, building all of @TL{} with @code{--enable-compiler-warnings=max}
1300 should produce no (GCC) compiler warnings at all. In spite of
1301 considerable efforts into that direction we are still far from that goal and
1302 there are reasons that we may never fully reach it. Below are some rules
1303 about declarations of functions or variables and the use of @code{const}.
1304 These rules should be applied to all parts of the @TL{} tree, except some of
1305 those maintained independently.
1307 @subsection Declarations
1309 @subsubsection ANSI C Function Prototypes and Definitions
1311 The @TL{} build system no longer supports pre-ANSI C compilers.
1312 Thus all function prototypes and definitions must conform to the
1313 ANSI C standard (including @code{void} in the declaration of C
1314 functions with no parameters). On the other hand @TL{} is built for many
1315 different systems, some of them not supporting the C99 standard. Therefore
1316 using C99 features should be avoided if that can easily be done. In
1317 particular C code must not contain declarations after statements or C++ type
1320 If some C99 (or later) constructs have to be used, the module should verify
1321 that they are available and otherwise provide an alternative. The module
1322 @file{texk/chktex} uses, e.g., the C99 function @code{stpcpy()} that may or
1323 may not be available on a particular system, uses
1324 @code{AC_CHECK_DECLS([stpcpy])} in @file{configure.ac} to test this, and
1325 provides the perhaps slightly less efficient alternative @* @ @ @ @code{#if
1326 !(defined HAVE_DECL_STPCPY && HAVE_DECL_STPCPY)} @* @ @ @ @code{static
1327 inline char * stpcpy(char *dest, const char *src)} @* @ @ @ @code{@{} @* @ @
1328 @ @code{@ @ @ return strcpy(dest, src) + strlen(src);} @* @ @ @ @code{@}} @* @ @
1329 @ @code{#endif} @* in the file @file{Utility.h}.
1331 @subsubsection Static Functions
1333 Functions used in only one file should be declared @code{static}; they
1334 require no prototype except as forward declaration.
1336 @subsubsection Extern Functions
1338 Functions not declared @code{static}, usually because they are used in
1339 several files, require an (@code{extern}) prototype in exactly one header
1340 which is included in the file defining the function and in all files using
1341 that function --- this is the only way to guarantee consistency between
1342 definition and use of functions. There must be no @code{extern}
1343 declarations sprinkled throughout the C code (with or without comment where
1344 that function is defined).
1346 @subsubsection Variables
1348 The declaration of global variables must follow analogous rules, they are
1349 either declared @code{static} if used in only one files or declared
1350 @code{extern} in exactly one header and instantiated in exactly one file.
1354 @subsubsection Function Parameters
1356 Ideally, a function parameter not modified by the function should be
1357 declared as @code{const}. This is important in particular for strings
1358 (@code{char*}) because the actual arguments are often string literals. It
1359 is perfectly legitimate and safe to use a type @code{char*} value for a type
1360 @code{const char*} variable (in an assignment, as initializer, as function
1361 argument, or as return value). It is equally safe to use a type
1362 @code{char**} value for a type @code{const char*const*} variable, but not
1363 for a type @code{const char**} variable since that might cause modification
1364 of a quantity supposed to be constant. Getting all @code{const} qualifiers
1365 right is often quite involved but can be done in most cases. There are,
1366 however, a few notable exceptions: the X11 headers are full of declarations
1367 that ought to use @code{const} but do not and the same is true to some
1368 extent for @file{libfreetype} (but not anymore for @code{zlib}).
1370 @subsubsection What Must be Avoided
1372 The GCC compiler warnings "assignment discards qualifiers@dots{}" and
1373 analogous warnings for "initialization", "passing arg", or "return" must be
1374 avoided under all circumstances, except when caused by X11 headers/macros or
1377 @subsubsection What Should be Avoided
1379 A type cast, e.g., from @code{const char*} to @code{char*} does not solve
1380 any problems; depending on warning options, it may only hide them.
1381 Therefore such casts should be avoided whenever possible and otherwise must
1382 be carefully analyzed to make sure that they can not cause the modification
1383 of quantities supposed to be constant.