Build: Add --disable-doc to configure.
[xz/debian.git] / INSTALL
blobba1939ac7c4ca6e3b2f09f929de4b08722ce5e77
2 XZ Utils Installation
3 =====================
5     0. Preface
6     1. Supported platforms
7        1.1. Compilers
8        1.2. Platform-specific notes
9             1.2.1. AIX
10             1.2.2. IRIX
11             1.2.3. MINIX 3
12             1.2.4. OpenVMS
13             1.2.5. Solaris, OpenSolaris, and derivatives
14             1.2.6. Tru64
15             1.2.7. Windows
16             1.2.8. DOS
17        1.3. Adding support for new platforms
18     2. configure options
19        2.1. Static vs. dynamic linking of liblzma
20        2.2. Optimizing xzdec and lzmadec
21     3. xzgrep and other scripts
22        3.1. Dependencies
23        3.2. PATH
24     4. Troubleshooting
25        4.1. "No C99 compiler was found."
26        4.2. "No POSIX conforming shell (sh) was found."
27        4.3. configure works but build fails at crc32_x86.S
28        4.4. Lots of warnings about symbol visibility
29        4.5. "make check" fails
30        4.6. liblzma.so (or similar) not found when running xz
33 0. Preface
34 ----------
36     If you aren't familiar with building packages that use GNU Autotools,
37     see the file INSTALL.generic for generic instructions before reading
38     further.
40     If you are going to build a package for distribution, see also the
41     file PACKAGERS. It contains information that should help making the
42     binary packages as good as possible, but the information isn't very
43     interesting to those making local builds for private use or for use
44     in special situations like embedded systems.
47 1. Supported platforms
48 ----------------------
50     XZ Utils are developed on GNU/Linux, but they should work on many
51     POSIX-like operating systems like *BSDs and Solaris, and even on
52     a few non-POSIX operating systems.
55 1.1. Compilers
57     A C99 compiler is required to compile XZ Utils. If you use GCC, you
58     need at least version 3.x.x. GCC version 2.xx.x doesn't support some
59     C99 features used in XZ Utils source code, thus GCC 2 won't compile
60     XZ Utils.
62     XZ Utils takes advantage of some GNU C extensions when building
63     with GCC. Because these extensions are used only when building
64     with GCC, it should be possible to use any C99 compiler.
67 1.2. Platform-specific notes
69 1.2.1. AIX
71     If you use IBM XL C compiler, pass CC=xlc_r to configure. If
72     you use CC=xlc instead, you must disable threading support
73     with --disable-threads (usually not recommended).
76 1.2.2. IRIX
78     MIPSpro 7.4.4m has been reported to produce broken code if using
79     the -O2 optimization flag ("make check" fails). Using -O1 should
80     work.
82     A problem has been reported when using shared liblzma. Passing
83     --disable-shared to configure works around this. Alternatively,
84     putting "-64" to CFLAGS to build a 64-bit version might help too.
87 1.2.3. MINIX 3
89     The default install of MINIX 3 includes Amsterdam Compiler Kit (ACK),
90     which doesn't support C99. Install GCC to compile XZ Utils.
92     MINIX 3.1.8 and older have bugs in /usr/include/stdint.h, which has
93     to be patched before XZ Utils can be compiled correctly. See
94     <http://gforge.cs.vu.nl/gf/project/minix/tracker/?action=TrackerItemEdit&tracker_item_id=537>.
96     MINIX 3.2.0 and later use a different libc and aren't affected by
97     the above bug.
99     XZ Utils doesn't have code to detect the amount of physical RAM and
100     number of CPU cores on MINIX 3.
102     See section 4.4 in this file about symbol visibility warnings (you
103     may want to pass gl_cv_cc_visibility=no to configure).
106 1.2.4. OpenVMS
108     XZ Utils can be built for OpenVMS, but the build system files
109     are not included in the XZ Utils source package. The required
110     OpenVMS-specific files are maintained by Jouk Jansen and can be
111     downloaded here:
113         http://nchrem.tnw.tudelft.nl/openvms/software2.html#xzutils
116 1.2.5. Solaris, OpenSolaris, and derivatives
118     The following linker error has been reported on some x86 systems:
120         ld: fatal: relocation error: R_386_GOTOFF: ...
122     This can be worked around by passing gl_cv_cc_visibility=no
123     as an argument to the configure script.
126 1.2.6. Tru64
128     If you try to use the native C compiler on Tru64 (passing CC=cc to
129     configure), you may need the workaround mention in section 4.1 in
130     this file (pass also ac_cv_prog_cc_c99= to configure).
133 1.2.7. Windows
135     Building XZ Utils on Windows is supported under MinGW + MSYS,
136     MinGW-w64 + MSYS, and Cygwin. There is windows/build.bash to
137     ease packaging XZ Utils with MinGW(-w64) + MSYS into a
138     redistributable .zip or .7z file. See windows/INSTALL-Windows.txt
139     for more information.
141     It might be possible to build liblzma with a non-GNU toolchain too,
142     but that will probably require writing a separate makefile. Building
143     the command line tools with non-GNU toolchains will be harder than
144     building only liblzma.
146     Even if liblzma is built with MinGW, the resulting DLL or static
147     library can be used by other compilers and linkers, including MSVC.
148     Thus, it shouldn't be a problem to use MinGW to build liblzma even
149     if you cannot use MinGW to build the rest of your project. See
150     windows/README-Windows.txt for details.
153 1.2.8. DOS
155     There is an experimental Makefile in the "dos" directory to build
156     XZ Utils on DOS using DJGPP. Support for long file names (LFN) is
157     needed. See dos/README for more information.
159     GNU Autotools based build hasn't been tried on DOS. If you try, I
160     would like to hear if it worked.
163 1.3. Adding support for new platforms
165     If you have written patches to make XZ Utils to work on previously
166     unsupported platform, please send the patches to me! I will consider
167     including them to the official version. It's nice to minimize the
168     need of third-party patching.
170     One exception: Don't request or send patches to change the whole
171     source package to C89. I find C99 substantially nicer to write and
172     maintain. However, the public library headers must be in C89 to
173     avoid frustrating those who maintain programs, which are strictly
174     in C89 or C++.
177 2. configure options
178 --------------------
180     In most cases, the defaults are what you want. Many of the options
181     below are useful only when building a size-optimized version of
182     liblzma or command line tools.
184     --enable-encoders=LIST
185     --disable-encoders
186                 Specify a comma-separated LIST of filter encoders to
187                 build. See "./configure --help" for exact list of
188                 available filter encoders. The default is to build all
189                 supported encoders.
191                 If LIST is empty or --disable-encoders is used, no filter
192                 encoders will be built and also the code shared between
193                 encoders will be omitted.
195                 Disabling encoders will remove some symbols from the
196                 liblzma ABI, so this option should be used only when it
197                 is known to not cause problems.
199     --enable-decoders=LIST
200     --disable-decoders
201                 This is like --enable-encoders but for decoders. The
202                 default is to build all supported decoders.
204     --enable-match-finders=LIST
205                 liblzma includes two categories of match finders:
206                 hash chains and binary trees. Hash chains (hc3 and hc4)
207                 are quite fast but they don't provide the best compression
208                 ratio. Binary trees (bt2, bt3 and bt4) give excellent
209                 compression ratio, but they are slower and need more
210                 memory than hash chains.
212                 You need to enable at least one match finder to build the
213                 LZMA1 or LZMA2 filter encoders. Usually hash chains are
214                 used only in the fast mode, while binary trees are used to
215                 when the best compression ratio is wanted.
217                 The default is to build all the match finders if LZMA1
218                 or LZMA2 filter encoders are being built.
220     --enable-checks=LIST
221                 liblzma support multiple integrity checks. CRC32 is
222                 mandatory, and cannot be omitted. See "./configure --help"
223                 for exact list of available integrity check types.
225                 liblzma and the command line tools can decompress files
226                 which use unsupported integrity check type, but naturally
227                 the file integrity cannot be verified in that case.
229                 Disabling integrity checks may remove some symbols from
230                 the liblzma ABI, so this option should be used only when
231                 it is known to not cause problems.
233     --disable-xz
234     --disable-xzdec
235     --disable-lzmadec
236     --disable-lzmainfo
237                 Don't build and install the command line tool mentioned
238                 in the option name.
240                 NOTE: Disabling xz will skip some tests in "make check".
242                 NOTE: If xzdec is disabled and lzmadec is left enabled,
243                 a dangling man page symlink lzmadec.1 -> xzdec.1 is
244                 created.
246     --disable-lzma-links
247                 Don't create symlinks for LZMA Utils compatibility.
248                 This includes lzma, unlzma, and lzcat. If scripts are
249                 installed, also lzdiff, lzcmp, lzgrep, lzegrep, lzfgrep,
250                 lzmore, and lzless will be omitted if this option is used.
252     --disable-scripts
253                 Don't install the scripts xzdiff, xzgrep, xzmore, xzless,
254                 and their symlinks.
256     --disable-doc
257                 Don't install the documentation files to $docdir
258                 (often /usr/doc/xz or /usr/local/doc/xz). Man pages
259                 will still be installed. The $docdir can be changed
260                 with --docdir=DIR.
262     --disable-assembler
263                 liblzma includes some assembler optimizations. Currently
264                 there is only assembler code for CRC32 and CRC64 for
265                 32-bit x86.
267                 All the assembler code in liblzma is position-independent
268                 code, which is suitable for use in shared libraries and
269                 position-independent executables. So far only i386
270                 instructions are used, but the code is optimized for i686
271                 class CPUs. If you are compiling liblzma exclusively for
272                 pre-i686 systems, you may want to disable the assembler
273                 code.
275     --enable-unaligned-access
276                 Allow liblzma to use unaligned memory access for 16-bit
277                 and 32-bit loads and stores. This should be enabled only
278                 when the hardware supports this, i.e. when unaligned
279                 access is fast. Some operating system kernels emulate
280                 unaligned access, which is extremely slow. This option
281                 shouldn't be used on systems that rely on such emulation.
283                 Unaligned access is enabled by default on x86, x86-64,
284                 and big endian PowerPC.
286     --enable-small
287                 Reduce the size of liblzma by selecting smaller but
288                 semantically equivalent version of some functions, and
289                 omit precomputed lookup tables. This option tends to
290                 make liblzma slightly slower.
292                 Note that while omitting the precomputed tables makes
293                 liblzma smaller on disk, the tables are still needed at
294                 run time, and need to be computed at startup. This also
295                 means that the RAM holding the tables won't be shared
296                 between applications linked against shared liblzma.
298                 This option doesn't modify CFLAGS to tell the compiler
299                 to optimize for size. You need to add -Os or equivalent
300                 flag(s) to CFLAGS manually.
302     --enable-assume-ram=SIZE
303                 On the most common operating systems, XZ Utils is able to
304                 detect the amount of physical memory on the system. This
305                 information is used by the options --memlimit-compress,
306                 --memlimit-decompress, and --memlimit when setting the
307                 limit to a percentage of total RAM.
309                 On some systems, there is no code to detect the amount of
310                 RAM though. Using --enable-assume-ram one can set how much
311                 memory to assume on these systems. SIZE is given as MiB.
312                 The default is 128 MiB.
314                 Feel free to send patches to add support for detecting
315                 the amount of RAM on the operating system you use. See
316                 src/common/tuklib_physmem.c for details.
318     --disable-threads
319                 Disable threading support. This makes some things
320                 thread-unsafe, meaning that if multithreaded application
321                 calls liblzma functions from more than one thread,
322                 something bad may happen.
324                 Use this option if threading support causes you trouble,
325                 or if you know that you will use liblzma only from
326                 single-threaded applications and want to avoid dependency
327                 on libpthread.
329     --enable-debug
330                 This enables the assert() macro and possibly some other
331                 run-time consistency checks. It makes the code slower, so
332                 you normally don't want to have this enabled.
334     --enable-werror
335                 If building with GCC, make all compiler warnings an error,
336                 that abort the compilation. This may help catching bugs,
337                 and should work on most systems. This has no effect on the
338                 resulting binaries.
341 2.1. Static vs. dynamic linking of liblzma
343     On 32-bit x86, linking against static liblzma can give a minor
344     speed improvement. Static libraries on x86 are usually compiled as
345     position-dependent code (non-PIC) and shared libraries are built as
346     position-independent code (PIC). PIC wastes one register, which can
347     make the code slightly slower compared to a non-PIC version. (Note
348     that this doesn't apply to x86-64.)
350     If you want to link xz against static liblzma, the simplest way
351     is to pass --disable-shared to configure. If you want also shared
352     liblzma, run configure again and run "make install" only for
353     src/liblzma.
356 2.2. Optimizing xzdec and lzmadec
358     xzdec and lzmadec are intended to be relatively small instead of
359     optimizing for the best speed. Thus, it is a good idea to build
360     xzdec and lzmadec separately:
362       - To link the tools against static liblzma, pass --disable-shared
363         to configure.
365       - To select somewhat size-optimized variant of some things in
366         liblzma, pass --enable-small to configure.
368       - Tell the compiler to optimize for size instead of speed.
369         E.g. with GCC, put -Os into CFLAGS.
371       - xzdec and lzmadec will never use multithreading capabilities of
372         liblzma. You can avoid dependency on libpthread by passing
373         --disable-threads to configure.
375       - There are and will be no translated messages for xzdec and
376         lzmadec, so it is fine to pass also --disable-nls to configure.
378       - Only decoder code is needed, so you can speed up the build
379         slightly by passing --disable-encoders to configure. This
380         shouldn't affect the final size of the executables though,
381         because the linker is able to omit the encoder code anyway.
383     If you have no use for xzdec or lzmadec, you can disable them with
384     --disable-xzdec and --disable-lzmadec.
387 3. xzgrep and other scripts
388 ---------------------------
390 3.1. Dependencies
392     POSIX shell (sh) and bunch of other standard POSIX tools are required
393     to run the scripts. The configure script tries to find a POSIX
394     compliant sh, but if it fails, you can force the shell by passing
395     gl_cv_posix_shell=/path/to/posix-sh as an argument to the configure
396     script.
398     Some of the scripts require also mktemp. The original mktemp can be
399     found from <http://www.mktemp.org/>. On GNU, most will use the mktemp
400     program from GNU coreutils instead of the original implementation.
401     Both mktemp versions are fine for XZ Utils (and practically for
402     everything else too).
405 3.2. PATH
407     The scripts assume that the required tools (standard POSIX utilities,
408     mktemp, and xz) are in PATH; the scripts don't set the PATH themselves.
409     Some people like this while some think this is a bug. Those in the
410     latter group can easily patch the scripts before running the configure
411     script by taking advantage of a placeholder line in the scripts.
413     For example, to make the scripts prefix /usr/bin:/bin to PATH:
415         perl -pi -e 's|^#SET_PATH.*$|PATH=/usr/bin:/bin:\$PATH|' \
416                 src/scripts/xz*.in
419 4. Troubleshooting
420 ------------------
422 4.1. "No C99 compiler was found."
424     You need a C99 compiler to build XZ Utils. If the configure script
425     cannot find a C99 compiler and you think you have such a compiler
426     installed, set the compiler command by passing CC=/path/to/c99 as
427     an argument to the configure script.
429     If you get this error even when you think your compiler supports C99,
430     you can override the test by passing ac_cv_prog_cc_c99= as an argument
431     to the configure script. The test for C99 compiler is not perfect (and
432     it is not as easy to make it perfect as it sounds), so sometimes this
433     may be needed. You will get a compile error if your compiler doesn't
434     support enough C99.
437 4.2. "No POSIX conforming shell (sh) was found."
439     xzgrep and other scripts need a shell that (roughly) conforms
440     to POSIX. The configure script tries to find such a shell. If
441     it fails, you can force the shell to be used by passing
442     gl_cv_posix_shell=/path/to/posix-sh as an argument to the configure
443     script.
446 4.3. configure works but build fails at crc32_x86.S
448     The easy fix is to pass --disable-assembler to the configure script.
450     The configure script determines if assembler code can be used by
451     looking at the configure triplet; there is currently no check if
452     the assembler code can actually actually be built. The x86 assembler
453     code should work on x86 GNU/Linux, *BSDs, Solaris, Darwin, MinGW,
454     Cygwin, and DJGPP. On other x86 systems, there may be problems and
455     the assembler code may need to be disabled with the configure option.
457     If you get this error when building for x86-64, you have specified or
458     the configure script has misguessed your architecture. Pass the
459     correct configure triplet using the --build=CPU-COMPANY-SYSTEM option
460     (see INSTALL.generic).
463 4.4. Lots of warnings about symbol visibility
465     On some systems where symbol visibility isn't supported, GCC may
466     still accept the visibility options and attributes, which will make
467     configure think that visibility is supported. This will result in
468     many compiler warnings. You can avoid the warnings by forcing the
469     visibility support off by passing gl_cv_cc_visibility=no as an
470     argument to the configure script. This has no effect on the
471     resulting binaries, but fewer warnings looks nicer and may allow
472     using --enable-werror.
475 4.5. "make check" fails
477     A likely reason is that libtool links the test programs against
478     an installed version of liblzma instead of the version that was
479     just built. This is obviously a bug which seems to happen on
480     some platforms. A workaround is to uninstall the old liblzma
481     versions first.
483     If the problem isn't the one described above, then it's likely
484     a bug in XZ Utils or in the compiler. See the platform-specific
485     notes in this file for possible known problems. Please report
486     a bug if you cannot solve the problem. See README for contact
487     information.
490 4.6. liblzma.so (or similar) not found when running xz
492     If you installed the package with "make install" and get an error
493     about liblzma.so (or a similarly named file) being missing, try
494     running "ldconfig" to update the run-time linker cache (if your
495     operating system has such a command).