debian/README.source: simplify build instructions
[xz/debian.git] / INSTALL
blobb0970d17e646aff024a7d1eea0be0056247cd938
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. Darwin (Mac OS X)
10             1.2.2. Tru64
11             1.2.3. Windows
12             1.2.4. DOS
13             1.2.5. OS/2
14        1.3. Adding support for new platforms
15     2. configure options
16     3. xzgrep and other scripts
17        3.1. Dependencies
18        3.2. PATH
19     4. Troubleshooting
20        4.1. "No C99 compiler was found."
21        4.1. "No POSIX conforming shell (sh) was found."
22        4.2. configure works but build fails at crc32_x86.S
25 0. Preface
26 ----------
28     If you aren't familiar with building packages that use GNU Autotools,
29     see the file INSTALL.generic for generic instructions before reading
30     further.
32     If you are going to build a package for distribution, see also the
33     file PACKAGERS. It contains information that should help making the
34     binary packages as good as possible, but the information isn't very
35     interesting to those making local builds for private use or for use
36     in special situations like embedded systems.
39 1. Supported platforms
40 ----------------------
42     XZ Utils are developed on GNU/Linux, but they should work on many
43     POSIX-like operating systems like *BSDs and Solaris, and even on
44     a few non-POSIX operating systems.
47 1.1. Compilers
49     A C99 compiler is required to compile XZ Utils. If you use GCC, you
50     need at least version 3.x.x. GCC version 2.xx.x doesn't support some
51     C99 features used in XZ Utils source code, thus GCC 2 won't compile
52     XZ Utils.
54     XZ Utils takes advantage of some GNU C extensions when building
55     with GCC. Because these extensions are used only when building
56     with GCC, it should be possible to use any C99 compiler.
59 1.2. Platform-specific notes
61 1.2.1. Darwin (Mac OS X)
63     You may need --disable-assembler if building universal binaries on
64     Darwin. This is because different files are built when assembler is
65     enabled, and there's no way to make it work with universal build.
66     If you want to keep the assembler code, consider building one
67     architecture at a time, and then combining the results to create
68     universal binaries (see lipo(1)).
71 1.2.2. Tru64
73     If you try to use the native C compiler on Tru64 (passing CC=cc to
74     configure), it is possible that the configure script will complain
75     that no C99 compiler was found even when the native compiler supports
76     C99. You can safely override the test for C99 compiler by passing
77     ac_cv_prog_cc_c99= as the argument to the configure script.
80 1.2.3. Windows
82     Building XZ Utils on Windows is supported under MinGW and Cygwin.
83     If the Autotools based build gives you trouble with MinGW, you may
84     want try the alternative method found from the "windows" directory.
86     MSVC doesn't support C99, thus it is not possible to use MSVC to
87     compile XZ Utils. However, it is possible to use liblzma.dll from
88     MSVC once liblzma.dll has been built with MinGW. The required
89     import library for MSVC can be created from liblzma.def using the
90     "lib" command shipped in MSVC:
92         lib /def:liblzma.def /out:liblzma.lib /machine:ix86
94     On x86-64, the /machine argument has to naturally be changed:
96         lib /def:liblzma.def /out:liblzma.lib /machine:x64
99 1.2.4. DOS
101     There is an experimental Makefile in the "dos" directory to build
102     XZ Utils on DOS using DJGPP. Support for long file names (LFN) is
103     needed.
105     GNU Autotools based build hasn't been tried on DOS.
108 1.2.5. OS/2
110     You will need to pass --disable-assembler to configure when building
111     on OS/2.
114 1.3. Adding support for new platforms
116     If you have written patches to make XZ Utils to work on previously
117     unsupported platform, please send the patches to me! I will consider
118     including them to the official version. It's nice to minimize the
119     need of third-party patching.
121     One exception: Don't request or send patches to change the whole
122     source package to C89. I find C99 substantially nicer to write and
123     maintain. However, the public library headers must be in C89 to
124     avoid frustrating those who maintain programs, which are strictly
125     in C89 or C++.
128 2. configure options
129 --------------------
131     In most cases, the defaults are what you want. Most of the options
132     below are useful only when building a size-optimized version of
133     liblzma or command line tools.
135     --enable-encoders=LIST
136     --disable-encoders
137                 Specify a comma-separated LIST of filter encoders to
138                 build. See "./configure --help" for exact list of
139                 available filter encoders. The default is to build all
140                 supported encoders.
142                 If LIST is empty or --disable-encoders is used, no filter
143                 encoders will be built and also the code shared between
144                 encoders will be omitted.
146                 Disabling encoders will remove some symbols from the
147                 liblzma ABI, so this option should be used only when it
148                 is known to not cause problems.
150     --enable-decoders=LIST
151     --disable-decoders
152                 This is like --enable-encoders but for decoders. The
153                 default is to build all supported decoders.
155     --enable-match-finders=LIST
156                 liblzma includes two categories of match finders:
157                 hash chains and binary trees. Hash chains (hc3 and hc4)
158                 are quite fast but they don't provide the best compression
159                 ratio. Binary trees (bt2, bt3 and bt4) give excellent
160                 compression ratio, but they are slower and need more
161                 memory than hash chains.
163                 You need to enable at least one match finder to build the
164                 LZMA1 or LZMA2 filter encoders. Usually hash chains are
165                 used only in the fast mode, while binary trees are used to
166                 when the best compression ratio is wanted.
168                 The default is to build all the match finders if LZMA1
169                 or LZMA2 filter encoders are being built.
171     --enable-checks=LIST
172                 liblzma support multiple integrity checks. CRC32 is
173                 mandatory, and cannot be omitted. See "./configure --help"
174                 for exact list of available integrity check types.
176                 liblzma and the command line tools can decompress files
177                 which use unsupported integrity check type, but naturally
178                 the file integrity cannot be verified in that case.
180                 Disabling integrity checks may remove some symbols from
181                 the liblzma ABI, so this option should be used only when
182                 it is known to not cause problems.
184     --disable-assembler
185                 liblzma includes some assembler optimizations. Currently
186                 there is only assembler code for CRC32 and CRC64 for
187                 32-bit x86.
189                 All the assembler code in liblzma is position-independent
190                 code, which is suitable for use in shared libraries and
191                 position-independent executables. So far only i386
192                 instructions are used, but the code is optimized for i686
193                 class CPUs. If you are compiling liblzma exclusively for
194                 pre-i686 systems, you may want to disable the assembler
195                 code.
197     --enable-unaligned-access
198                 Allow liblzma to use unaligned memory access for 16-bit
199                 and 32-bit loads and stores. This should be enabled only
200                 when the hardware supports this, i.e. when unaligned
201                 access is fast. Some operating system kernels emulate
202                 unaligned access, which is extremely slow. This option
203                 shouldn't be used on systems that rely on such emulation.
205                 Unaligned access is enabled by default on x86, x86-64,
206                 and big endian PowerPC.
208     --enable-small
209                 Reduce the size of liblzma by selecting smaller but
210                 semantically equivalent version of some functions, and
211                 omit precomputed lookup tables. This option tends to
212                 make liblzma slightly slower.
214                 Note that while omitting the precomputed tables makes
215                 liblzma smaller on disk, the tables are still needed at
216                 run time, and need to be computed at startup. This also
217                 means that the RAM holding the tables won't be shared
218                 between applications linked against shared liblzma.
220     --disable-threads
221                 Disable threading support. This makes some things
222                 thread-unsafe, meaning that if multithreaded application
223                 calls liblzma functions from more than one thread,
224                 something bad may happen.
226                 Use this option if threading support causes you trouble,
227                 or if you know that you will use liblzma only from
228                 single-threaded applications and want to avoid dependency
229                 on libpthread.
231     --enable-dynamic
232                 Link the command line tools against shared liblzma. The
233                 default (and recommended way) is to link the command line
234                 tools against static liblzma.
236                 This option is mostly useful for packagers, if distro
237                 policy requires linking against shared libaries. See the
238                 file PACKAGERS for more information about pros and cons
239                 of this option.
241     --enable-debug
242                 This enables the assert() macro and possibly some other
243                 run-time consistency checks. It makes the code slower, so
244                 you normally don't want to have this enabled.
246     --enable-werror
247                 If building with GCC, make all compiler warnings an error,
248                 that abort the compilation. This may help catching bugs,
249                 and should work on most systems. This has no effect on the
250                 resulting binaries.
253 3. xzgrep and other scripts
254 ---------------------------
256 3.1. Dependencies
258     POSIX shell (sh) and bunch of other standard POSIX tools are required
259     to run the scripts. The configure script tries to find a POSIX
260     compliant sh, but if it fails, you can force the shell by passing
261     gl_cv_posix_shell=/path/to/posix-sh as an argument to the configure
262     script.
264     Some of the scripts require also mktemp. The original mktemp can be
265     found from <http://www.mktemp.org/>. On GNU, most will use the mktemp
266     program from GNU coreutils instead of the original implementation.
267     Both mktemp versions are fine for XZ Utils (and practically for
268     everything else too).
271 3.2. PATH
273     The scripts assume that the required tools (standard POSIX utilities,
274     mktemp, and xz) are in PATH; the scripts don't set the PATH themselves.
275     Some people like this while some think this is a bug. Those in the
276     latter group can easily patch the scripts before running the configure
277     script by taking advantage of a placeholder line in the scripts.
279     For example, to make the scripts prefix /usr/bin:/bin to PATH:
281         perl -pi -e 's|^#SET_PATH.*$|PATH=/usr/bin:/bin:\$PATH|' \
282                 src/scripts/xz*.in
285 4. Troubleshooting
286 ------------------
288 4.1. "No C99 compiler was found."
290     You need a C99 compiler to build XZ Utils. If the configure script
291     cannot find a C99 compiler and you think you have such a compiler
292     installed, set the compiler command by passing CC=/path/to/c99 as
293     an argument to the configure script.
295     If you get this error even when you think your compiler supports C99,
296     you can override the test by passing ac_cv_prog_cc_c99= as an argument
297     to the configure script. The test for C99 compiler is not perfect (and
298     it is not as easy to make it perfect as it sounds), so sometimes this
299     may be needed. You will get a compile error if your compiler doesn't
300     support enough C99.
303 4.1. "No POSIX conforming shell (sh) was found."
305     xzgrep and other scripts need a shell that (roughly) conforms
306     to POSIX. The configure script tries to find such a shell. If
307     it fails, you can force the shell to be used by passing
308     gl_cv_posix_shell=/path/to/posix-sh as an argument to the configure
309     script.
312 4.2. configure works but build fails at crc32_x86.S
314     The easy fix is to pass --disable-assembler to the configure script.
316     The configure script determines if assembler code can be used by
317     looking at the configure triplet; there is currently no check if
318     the assembler code can actually actually be built. The x86 assembler
319     code should work on x86 GNU/Linux, *BSDs, Solaris, Darwin, MinGW,
320     Cygwin, and DJGPP. On other x86 systems, there may be problems and
321     the assembler code may need to be disabled with the configure option.
323     If you get this error when building for x86-64, you have specified or
324     the configure script has misguessed your architecture. Pass the
325     correct configure triplet using the --build=CPU-COMPANY-SYSTEM option
326     (see INSTALL.generic).