]> icculus.org git repositories - icculus/xz.git/blob - INSTALL
Mention in INSTALL that --enable-small doesn't modify CFLAGS.
[icculus/xz.git] / INSTALL
1
2 XZ Utils Installation
3 =====================
4
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
23
24
25 0. Preface
26 ----------
27
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.
31
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.
37
38
39 1. Supported platforms
40 ----------------------
41
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.
45
46
47 1.1. Compilers
48
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.
53
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.
57
58
59 1.2. Platform-specific notes
60
61 1.2.1. Darwin (Mac OS X)
62
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)).
69
70
71 1.2.2. Tru64
72
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.
78
79
80 1.2.3. Windows
81
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.
85
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:
91
92         lib /def:liblzma.def /out:liblzma.lib /machine:ix86
93
94     On x86-64, the /machine argument has to naturally be changed:
95
96         lib /def:liblzma.def /out:liblzma.lib /machine:x64
97
98
99 1.2.4. DOS
100
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.
104
105     GNU Autotools based build hasn't been tried on DOS.
106
107
108 1.2.5. OS/2
109
110     You will need to pass --disable-assembler to configure when building
111     on OS/2.
112
113     To omit large number of harmless warnings about visibility support,
114     pass gl_cv_cc_visibility=no as an argument to the configure script.
115     This isn't mandatory since it should have no effect on the resulting
116     binaries.
117
118
119 1.3. Adding support for new platforms
120
121     If you have written patches to make XZ Utils to work on previously
122     unsupported platform, please send the patches to me! I will consider
123     including them to the official version. It's nice to minimize the
124     need of third-party patching.
125
126     One exception: Don't request or send patches to change the whole
127     source package to C89. I find C99 substantially nicer to write and
128     maintain. However, the public library headers must be in C89 to
129     avoid frustrating those who maintain programs, which are strictly
130     in C89 or C++.
131
132
133 2. configure options
134 --------------------
135
136     In most cases, the defaults are what you want. Most of the options
137     below are useful only when building a size-optimized version of
138     liblzma or command line tools.
139
140     --enable-encoders=LIST
141     --disable-encoders
142                 Specify a comma-separated LIST of filter encoders to
143                 build. See "./configure --help" for exact list of
144                 available filter encoders. The default is to build all
145                 supported encoders.
146
147                 If LIST is empty or --disable-encoders is used, no filter
148                 encoders will be built and also the code shared between
149                 encoders will be omitted.
150
151                 Disabling encoders will remove some symbols from the
152                 liblzma ABI, so this option should be used only when it
153                 is known to not cause problems.
154
155     --enable-decoders=LIST
156     --disable-decoders
157                 This is like --enable-encoders but for decoders. The
158                 default is to build all supported decoders.
159
160     --enable-match-finders=LIST
161                 liblzma includes two categories of match finders:
162                 hash chains and binary trees. Hash chains (hc3 and hc4)
163                 are quite fast but they don't provide the best compression
164                 ratio. Binary trees (bt2, bt3 and bt4) give excellent
165                 compression ratio, but they are slower and need more
166                 memory than hash chains.
167
168                 You need to enable at least one match finder to build the
169                 LZMA1 or LZMA2 filter encoders. Usually hash chains are
170                 used only in the fast mode, while binary trees are used to
171                 when the best compression ratio is wanted.
172
173                 The default is to build all the match finders if LZMA1
174                 or LZMA2 filter encoders are being built.
175
176     --enable-checks=LIST
177                 liblzma support multiple integrity checks. CRC32 is
178                 mandatory, and cannot be omitted. See "./configure --help"
179                 for exact list of available integrity check types.
180
181                 liblzma and the command line tools can decompress files
182                 which use unsupported integrity check type, but naturally
183                 the file integrity cannot be verified in that case.
184
185                 Disabling integrity checks may remove some symbols from
186                 the liblzma ABI, so this option should be used only when
187                 it is known to not cause problems.
188
189     --disable-assembler
190                 liblzma includes some assembler optimizations. Currently
191                 there is only assembler code for CRC32 and CRC64 for
192                 32-bit x86.
193
194                 All the assembler code in liblzma is position-independent
195                 code, which is suitable for use in shared libraries and
196                 position-independent executables. So far only i386
197                 instructions are used, but the code is optimized for i686
198                 class CPUs. If you are compiling liblzma exclusively for
199                 pre-i686 systems, you may want to disable the assembler
200                 code.
201
202     --enable-unaligned-access
203                 Allow liblzma to use unaligned memory access for 16-bit
204                 and 32-bit loads and stores. This should be enabled only
205                 when the hardware supports this, i.e. when unaligned
206                 access is fast. Some operating system kernels emulate
207                 unaligned access, which is extremely slow. This option
208                 shouldn't be used on systems that rely on such emulation.
209
210                 Unaligned access is enabled by default on x86, x86-64,
211                 and big endian PowerPC.
212
213     --enable-small
214                 Reduce the size of liblzma by selecting smaller but
215                 semantically equivalent version of some functions, and
216                 omit precomputed lookup tables. This option tends to
217                 make liblzma slightly slower.
218
219                 Note that while omitting the precomputed tables makes
220                 liblzma smaller on disk, the tables are still needed at
221                 run time, and need to be computed at startup. This also
222                 means that the RAM holding the tables won't be shared
223                 between applications linked against shared liblzma.
224
225                 This option doesn't modify CFLAGS to tell the compiler
226                 to optimize for size. You need to add -Os or equivalent
227                 flag(s) to CFLAGS manually.
228
229     --disable-threads
230                 Disable threading support. This makes some things
231                 thread-unsafe, meaning that if multithreaded application
232                 calls liblzma functions from more than one thread,
233                 something bad may happen.
234
235                 Use this option if threading support causes you trouble,
236                 or if you know that you will use liblzma only from
237                 single-threaded applications and want to avoid dependency
238                 on libpthread.
239
240     --enable-dynamic=TYPE
241                 Specify how command line tools should be linked against
242                 liblzma. Possible TYPES:
243
244                     yes     All command line tools are linked against
245                             shared liblzma (if shared liblzma was built).
246                             This is equivalent to --enable-dynamic (i.e.
247                             no =TYPE).
248
249                     mixed   Some tools are linked against static liblzma
250                             and some against shared liblzma. This is the
251                             default and recommended way.
252
253                     no      All command line tools are linked against
254                             static liblzma (if static liblzma was built).
255                             This is equivalent to --disable-dynamic.
256
257                 This option is mostly useful for packagers, if distro
258                 policy requires linking against shared libaries. See the
259                 file PACKAGERS for more information about pros and cons
260                 of this option.
261
262     --enable-debug
263                 This enables the assert() macro and possibly some other
264                 run-time consistency checks. It makes the code slower, so
265                 you normally don't want to have this enabled.
266
267     --enable-werror
268                 If building with GCC, make all compiler warnings an error,
269                 that abort the compilation. This may help catching bugs,
270                 and should work on most systems. This has no effect on the
271                 resulting binaries.
272
273
274 3. xzgrep and other scripts
275 ---------------------------
276
277 3.1. Dependencies
278
279     POSIX shell (sh) and bunch of other standard POSIX tools are required
280     to run the scripts. The configure script tries to find a POSIX
281     compliant sh, but if it fails, you can force the shell by passing
282     gl_cv_posix_shell=/path/to/posix-sh as an argument to the configure
283     script.
284
285     Some of the scripts require also mktemp. The original mktemp can be
286     found from <http://www.mktemp.org/>. On GNU, most will use the mktemp
287     program from GNU coreutils instead of the original implementation.
288     Both mktemp versions are fine for XZ Utils (and practically for
289     everything else too).
290
291
292 3.2. PATH
293
294     The scripts assume that the required tools (standard POSIX utilities,
295     mktemp, and xz) are in PATH; the scripts don't set the PATH themselves.
296     Some people like this while some think this is a bug. Those in the
297     latter group can easily patch the scripts before running the configure
298     script by taking advantage of a placeholder line in the scripts.
299
300     For example, to make the scripts prefix /usr/bin:/bin to PATH:
301
302         perl -pi -e 's|^#SET_PATH.*$|PATH=/usr/bin:/bin:\$PATH|' \
303                 src/scripts/xz*.in
304
305
306 4. Troubleshooting
307 ------------------
308
309 4.1. "No C99 compiler was found."
310
311     You need a C99 compiler to build XZ Utils. If the configure script
312     cannot find a C99 compiler and you think you have such a compiler
313     installed, set the compiler command by passing CC=/path/to/c99 as
314     an argument to the configure script.
315
316     If you get this error even when you think your compiler supports C99,
317     you can override the test by passing ac_cv_prog_cc_c99= as an argument
318     to the configure script. The test for C99 compiler is not perfect (and
319     it is not as easy to make it perfect as it sounds), so sometimes this
320     may be needed. You will get a compile error if your compiler doesn't
321     support enough C99.
322
323
324 4.1. "No POSIX conforming shell (sh) was found."
325
326     xzgrep and other scripts need a shell that (roughly) conforms
327     to POSIX. The configure script tries to find such a shell. If
328     it fails, you can force the shell to be used by passing
329     gl_cv_posix_shell=/path/to/posix-sh as an argument to the configure
330     script.
331
332
333 4.2. configure works but build fails at crc32_x86.S
334
335     The easy fix is to pass --disable-assembler to the configure script.
336
337     The configure script determines if assembler code can be used by
338     looking at the configure triplet; there is currently no check if
339     the assembler code can actually actually be built. The x86 assembler
340     code should work on x86 GNU/Linux, *BSDs, Solaris, Darwin, MinGW,
341     Cygwin, and DJGPP. On other x86 systems, there may be problems and
342     the assembler code may need to be disabled with the configure option.
343
344     If you get this error when building for x86-64, you have specified or
345     the configure script has misguessed your architecture. Pass the
346     correct configure triplet using the --build=CPU-COMPANY-SYSTEM option
347     (see INSTALL.generic).
348