]> icculus.org git repositories - icculus/xz.git/blob - INSTALL
xz: Make --help two lines shorter.
[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. IRIX
10             1.2.2. Tru64
11             1.2.3. Windows
12             1.2.4. DOS
13             1.2.5. OS/2
14             1.2.6. OpenVMS
15        1.3. Adding support for new platforms
16     2. configure options
17     3. xzgrep and other scripts
18        3.1. Dependencies
19        3.2. PATH
20     4. Troubleshooting
21        4.1. "No C99 compiler was found."
22        4.1. "No POSIX conforming shell (sh) was found."
23        4.2. configure works but build fails at crc32_x86.S
24
25
26 0. Preface
27 ----------
28
29     If you aren't familiar with building packages that use GNU Autotools,
30     see the file INSTALL.generic for generic instructions before reading
31     further.
32
33     If you are going to build a package for distribution, see also the
34     file PACKAGERS. It contains information that should help making the
35     binary packages as good as possible, but the information isn't very
36     interesting to those making local builds for private use or for use
37     in special situations like embedded systems.
38
39
40 1. Supported platforms
41 ----------------------
42
43     XZ Utils are developed on GNU/Linux, but they should work on many
44     POSIX-like operating systems like *BSDs and Solaris, and even on
45     a few non-POSIX operating systems.
46
47
48 1.1. Compilers
49
50     A C99 compiler is required to compile XZ Utils. If you use GCC, you
51     need at least version 3.x.x. GCC version 2.xx.x doesn't support some
52     C99 features used in XZ Utils source code, thus GCC 2 won't compile
53     XZ Utils.
54
55     XZ Utils takes advantage of some GNU C extensions when building
56     with GCC. Because these extensions are used only when building
57     with GCC, it should be possible to use any C99 compiler.
58
59
60 1.2. Platform-specific notes
61
62 1.2.1. IRIX
63
64     MIPSpro 7.4.4m has been reported to produce broken code if using
65     the -O2 optimization flag ("make check" fails). Using -O1 should
66     work.
67
68
69 1.2.2. Tru64
70
71     If you try to use the native C compiler on Tru64 (passing CC=cc to
72     configure), it is possible that the configure script will complain
73     that no C99 compiler was found even when the native compiler supports
74     C99. You can safely override the test for C99 compiler by passing
75     ac_cv_prog_cc_c99= as the argument to the configure script.
76
77
78 1.2.3. Windows
79
80     Building XZ Utils on Windows is supported under MinGW + MSYS and
81     Cygwin. There is windows/build.bash to ease packaging XZ Utils with
82     MinGW + MSYS into a redistributable .zip or .7z file. See
83     windows/INSTALL-Windows.txt for more information.
84
85     It might be possible to build liblzma with a non-GNU toolchain too,
86     but that will probably require writing a separate makefile. Building
87     the command line tools with non-GNU toolchains will be harder than
88     building only liblzma.
89
90     Even if liblzma is built with MinGW, the resulting DLL or static
91     library can be used by other compilers and linkers, including MSVC.
92     Thus, it shouldn't be a problem to use MinGW to build liblzma even
93     if you cannot use MinGW to build the rest of your project. See
94     windows/README-Windows.txt for details.
95
96
97 1.2.4. DOS
98
99     There is an experimental Makefile in the "dos" directory to build
100     XZ Utils on DOS using DJGPP. Support for long file names (LFN) is
101     needed. See dos/README for more information.
102
103     GNU Autotools based build hasn't been tried on DOS. If you try, I
104     would like to hear if it worked.
105
106
107 1.2.5. OS/2
108
109     To omit large number of harmless warnings about visibility support,
110     pass gl_cv_cc_visibility=no as an argument to the configure script.
111     This isn't mandatory since it should have no effect on the resulting
112     binaries.
113
114
115 1.2.6. OpenVMS
116
117     XZ Utils can be built for OpenVMS, but the build system files are
118     currently not included in the XZ Utils source package. The required
119     OpenVMS-specific files are maintained by Jouk Jansen and can be
120     downloaded here:
121
122         http://nchrem.tnw.tudelft.nl/openvms/software2.html#xzutils
123
124
125 1.3. Adding support for new platforms
126
127     If you have written patches to make XZ Utils to work on previously
128     unsupported platform, please send the patches to me! I will consider
129     including them to the official version. It's nice to minimize the
130     need of third-party patching.
131
132     One exception: Don't request or send patches to change the whole
133     source package to C89. I find C99 substantially nicer to write and
134     maintain. However, the public library headers must be in C89 to
135     avoid frustrating those who maintain programs, which are strictly
136     in C89 or C++.
137
138
139 2. configure options
140 --------------------
141
142     In most cases, the defaults are what you want. Most of the options
143     below are useful only when building a size-optimized version of
144     liblzma or command line tools.
145
146     --enable-encoders=LIST
147     --disable-encoders
148                 Specify a comma-separated LIST of filter encoders to
149                 build. See "./configure --help" for exact list of
150                 available filter encoders. The default is to build all
151                 supported encoders.
152
153                 If LIST is empty or --disable-encoders is used, no filter
154                 encoders will be built and also the code shared between
155                 encoders will be omitted.
156
157                 Disabling encoders will remove some symbols from the
158                 liblzma ABI, so this option should be used only when it
159                 is known to not cause problems.
160
161     --enable-decoders=LIST
162     --disable-decoders
163                 This is like --enable-encoders but for decoders. The
164                 default is to build all supported decoders.
165
166     --enable-match-finders=LIST
167                 liblzma includes two categories of match finders:
168                 hash chains and binary trees. Hash chains (hc3 and hc4)
169                 are quite fast but they don't provide the best compression
170                 ratio. Binary trees (bt2, bt3 and bt4) give excellent
171                 compression ratio, but they are slower and need more
172                 memory than hash chains.
173
174                 You need to enable at least one match finder to build the
175                 LZMA1 or LZMA2 filter encoders. Usually hash chains are
176                 used only in the fast mode, while binary trees are used to
177                 when the best compression ratio is wanted.
178
179                 The default is to build all the match finders if LZMA1
180                 or LZMA2 filter encoders are being built.
181
182     --enable-checks=LIST
183                 liblzma support multiple integrity checks. CRC32 is
184                 mandatory, and cannot be omitted. See "./configure --help"
185                 for exact list of available integrity check types.
186
187                 liblzma and the command line tools can decompress files
188                 which use unsupported integrity check type, but naturally
189                 the file integrity cannot be verified in that case.
190
191                 Disabling integrity checks may remove some symbols from
192                 the liblzma ABI, so this option should be used only when
193                 it is known to not cause problems.
194
195     --disable-assembler
196                 liblzma includes some assembler optimizations. Currently
197                 there is only assembler code for CRC32 and CRC64 for
198                 32-bit x86.
199
200                 All the assembler code in liblzma is position-independent
201                 code, which is suitable for use in shared libraries and
202                 position-independent executables. So far only i386
203                 instructions are used, but the code is optimized for i686
204                 class CPUs. If you are compiling liblzma exclusively for
205                 pre-i686 systems, you may want to disable the assembler
206                 code.
207
208     --enable-unaligned-access
209                 Allow liblzma to use unaligned memory access for 16-bit
210                 and 32-bit loads and stores. This should be enabled only
211                 when the hardware supports this, i.e. when unaligned
212                 access is fast. Some operating system kernels emulate
213                 unaligned access, which is extremely slow. This option
214                 shouldn't be used on systems that rely on such emulation.
215
216                 Unaligned access is enabled by default on x86, x86-64,
217                 and big endian PowerPC.
218
219     --enable-small
220                 Reduce the size of liblzma by selecting smaller but
221                 semantically equivalent version of some functions, and
222                 omit precomputed lookup tables. This option tends to
223                 make liblzma slightly slower.
224
225                 Note that while omitting the precomputed tables makes
226                 liblzma smaller on disk, the tables are still needed at
227                 run time, and need to be computed at startup. This also
228                 means that the RAM holding the tables won't be shared
229                 between applications linked against shared liblzma.
230
231                 This option doesn't modify CFLAGS to tell the compiler
232                 to optimize for size. You need to add -Os or equivalent
233                 flag(s) to CFLAGS manually.
234
235     --enable-assume-ram=SIZE
236                 On the most common operating systems, XZ Utils is able to
237                 detect the amount of physical memory on the system. This
238                 information is used to set the default memory usage limit.
239
240                 On some systems, there is no code to detect the amount of
241                 RAM though. Using --enable-assume-ram one can set how much
242                 memory to assume on these systems. SIZE is given as MiB.
243                 The default is 128 MiB, which allows decompressing files
244                 created with "xz -9".
245
246                 Feel free to send patches to add support for detecting
247                 the amount of RAM on the operating system you use. See
248                 src/common/tuklib_physmem.c for details.
249
250     --disable-threads
251                 Disable threading support. This makes some things
252                 thread-unsafe, meaning that if multithreaded application
253                 calls liblzma functions from more than one thread,
254                 something bad may happen.
255
256                 Use this option if threading support causes you trouble,
257                 or if you know that you will use liblzma only from
258                 single-threaded applications and want to avoid dependency
259                 on libpthread.
260
261     --enable-dynamic=TYPE
262                 Specify how command line tools should be linked against
263                 liblzma. Possible TYPES:
264
265                     yes     All command line tools are linked against
266                             shared liblzma (if shared liblzma was built).
267                             This is equivalent to --enable-dynamic (i.e.
268                             no =TYPE).
269
270                     mixed   Some tools are linked against static liblzma
271                             and some against shared liblzma. This is the
272                             default and recommended way.
273
274                     no      All command line tools are linked against
275                             static liblzma (if static liblzma was built).
276                             This is equivalent to --disable-dynamic.
277
278                 This option is mostly useful for packagers, if distro
279                 policy requires linking against shared libaries. See the
280                 file PACKAGERS for more information about pros and cons
281                 of this option.
282
283     --enable-debug
284                 This enables the assert() macro and possibly some other
285                 run-time consistency checks. It makes the code slower, so
286                 you normally don't want to have this enabled.
287
288     --enable-werror
289                 If building with GCC, make all compiler warnings an error,
290                 that abort the compilation. This may help catching bugs,
291                 and should work on most systems. This has no effect on the
292                 resulting binaries.
293
294
295 3. xzgrep and other scripts
296 ---------------------------
297
298 3.1. Dependencies
299
300     POSIX shell (sh) and bunch of other standard POSIX tools are required
301     to run the scripts. The configure script tries to find a POSIX
302     compliant sh, but if it fails, you can force the shell by passing
303     gl_cv_posix_shell=/path/to/posix-sh as an argument to the configure
304     script.
305
306     Some of the scripts require also mktemp. The original mktemp can be
307     found from <http://www.mktemp.org/>. On GNU, most will use the mktemp
308     program from GNU coreutils instead of the original implementation.
309     Both mktemp versions are fine for XZ Utils (and practically for
310     everything else too).
311
312
313 3.2. PATH
314
315     The scripts assume that the required tools (standard POSIX utilities,
316     mktemp, and xz) are in PATH; the scripts don't set the PATH themselves.
317     Some people like this while some think this is a bug. Those in the
318     latter group can easily patch the scripts before running the configure
319     script by taking advantage of a placeholder line in the scripts.
320
321     For example, to make the scripts prefix /usr/bin:/bin to PATH:
322
323         perl -pi -e 's|^#SET_PATH.*$|PATH=/usr/bin:/bin:\$PATH|' \
324                 src/scripts/xz*.in
325
326
327 4. Troubleshooting
328 ------------------
329
330 4.1. "No C99 compiler was found."
331
332     You need a C99 compiler to build XZ Utils. If the configure script
333     cannot find a C99 compiler and you think you have such a compiler
334     installed, set the compiler command by passing CC=/path/to/c99 as
335     an argument to the configure script.
336
337     If you get this error even when you think your compiler supports C99,
338     you can override the test by passing ac_cv_prog_cc_c99= as an argument
339     to the configure script. The test for C99 compiler is not perfect (and
340     it is not as easy to make it perfect as it sounds), so sometimes this
341     may be needed. You will get a compile error if your compiler doesn't
342     support enough C99.
343
344
345 4.1. "No POSIX conforming shell (sh) was found."
346
347     xzgrep and other scripts need a shell that (roughly) conforms
348     to POSIX. The configure script tries to find such a shell. If
349     it fails, you can force the shell to be used by passing
350     gl_cv_posix_shell=/path/to/posix-sh as an argument to the configure
351     script.
352
353
354 4.2. configure works but build fails at crc32_x86.S
355
356     The easy fix is to pass --disable-assembler to the configure script.
357
358     The configure script determines if assembler code can be used by
359     looking at the configure triplet; there is currently no check if
360     the assembler code can actually actually be built. The x86 assembler
361     code should work on x86 GNU/Linux, *BSDs, Solaris, Darwin, MinGW,
362     Cygwin, and DJGPP. On other x86 systems, there may be problems and
363     the assembler code may need to be disabled with the configure option.
364
365     If you get this error when building for x86-64, you have specified or
366     the configure script has misguessed your architecture. Pass the
367     correct configure triplet using the --build=CPU-COMPANY-SYSTEM option
368     (see INSTALL.generic).
369