Debian Codegraph @

doc/install.texi

raw
1 @c This file is included by autoconf.texi and is used to produce
2 @c the INSTALL file.
3
4 @ifclear autoconf
5 @unnumbered Installation Instructions
6 @end ifclear
7
8 @node Basic Installation
9 @section Basic Installation
10
11 The following shell commands:
12
13 @example
14 test -f configure || ./bootstrap
15 ./configure
16 make
17 make install
18 @end example
19
20 @noindent
21 should configure, build, and install this package.
22 The first line, which bootstraps, is intended for developers;
23 when building from distribution tarballs it does nothing and can be skipped.
24 A package might name the bootstrapping script differently;
25 if the name is @file{autogen.sh}, for example, the first line should say
26 @command{./autogen.sh} instead of @command{./bootstrap}.
27
28 The following
29 more-detailed instructions are generic; see the @file{README} file for
30 instructions specific to this package.
31 @ifclear autoconf
32 Some packages provide this @file{INSTALL} file but do not implement all
33 of the features documented below. The lack of an optional feature in a
34 given package is not necessarily a bug.
35 @end ifclear
36 More recommendations for GNU packages can be found in
37 @ifset autoconf
38 @ref{Makefile Conventions, , Makefile Conventions, standards,
39 GNU Coding Standards}.
40 @end ifset
41 @ifclear autoconf
42 the GNU Coding Standards.
43 @end ifclear
44
45 Many packages have scripts meant for developers instead of ordinary
46 builders, as they may use developer tools that are less commonly installed,
47 or they may access the network, which has privacy implications.
48 These scripts attempt to bootstrap by building the
49 @command{configure} script and related files, possibly
50 using developer tools or the network. Because the output of
51 bootstrapping is system-independent, it is normally run by a
52 package developer so that its output can be put into the distribution
53 tarball and ordinary builders and users need not bootstrap.
54 Some packages have commands like @command{./autopull.sh} and
55 @command{./autogen.sh} that you can run instead of @command{./bootstrap},
56 for more fine-grained control over bootstrapping.
57
58 The @command{configure} script attempts to guess correct values
59 for various system-dependent variables used during compilation. It uses
60 those values to create a @file{Makefile} in each directory of the
61 package. It may also create one or more @file{.h} files containing
62 system-dependent definitions. Finally, it creates a script
63 @file{config.status} that you can run in the future to recreate the
64 current configuration, and a file @file{config.log} containing
65 output useful for debugging @command{configure}.
66
67 It can also use an optional file (typically called @file{config.cache}
68 and enabled with @option{--cache-file=config.cache} or simply
69 @option{-C}) that saves the results of its tests to speed up
70 reconfiguring. Caching is disabled by default to prevent problems with
71 accidental use of stale cache files.
72
73 If you need to do unusual things to compile the package, please try to
74 figure out how @command{configure} could check whether to do them, and
75 mail diffs or instructions to the address given in the @file{README} so
76 they can be considered for the next release. If you are using the
77 cache, and at some point @file{config.cache} contains results you don't
78 want to keep, you may remove or edit it.
79
80 The @command{autoconf} program generates @file{configure} from the file
81 @file{configure.ac}. Normally you should edit @file{configure.ac}
82 instead of editing @file{configure} directly.
83
84 The simplest way to compile this package is:
85
86 @enumerate
87 @item
88 @command{cd} to the directory containing the package's source code.
89
90 @item
91 If this is a developer checkout and file @file{configure} does not yet exist,
92 run the bootstrapping script (typically @command{./bootstrap} or
93 @command{./autogen.sh}) to bootstrap and create the file.
94 You may need special developer tools and network access to bootstrap,
95 and the network access may have privacy implications.
96
97 @item
98 Type @samp{./configure} to configure the package for your system.
99 This might take a while. While running, @command{configure} prints
100 messages telling which features it is checking for.
101
102 @item
103 Type @samp{make} to compile the package.
104
105 @item
106 Optionally, type @samp{make check} to run any self-tests that come with
107 the package, generally using the just-built uninstalled binaries.
108
109 @item
110 Type @samp{make install} to install the programs and any data files and
111 documentation. When installing into a prefix owned by root, it is
112 recommended that the package be configured and built as a regular user,
113 and only the @samp{make install} phase executed with root privileges.
114
115 @item
116 Optionally, type @samp{make installcheck} to repeat any self-tests, but
117 this time using the binaries in their final installed location. This
118 target does not install anything. Running this target as a regular
119 user, particularly if the prior @samp{make install} required root
120 privileges, verifies that the installation completed correctly.
121
122 @item
123 You can remove the program binaries and object files from the source
124 code directory by typing @samp{make clean}. To also remove the files
125 that @command{configure} created (so you can compile the package for a
126 different kind of computer), type @samp{make distclean}. There is also
127 a @samp{make maintainer-clean} target, but that is intended mainly for
128 the package's developers. If you use it, you may have to bootstrap again.
129
130 @item
131 If the package follows the GNU Coding Standards,
132 you can type @samp{make uninstall} to remove the installed files.
133 @end enumerate
134
135 @node Installation Prerequisites
136 @section Installation Prerequisites
137
138 Installation requires a POSIX-like environment
139 with a shell and at least the following standard utilities:
140
141 @quotation
142 @t{awk cat cp diff echo expr false
143 ls mkdir mv printf pwd
144 rm rmdir sed sort test tr}
145 @end quotation
146
147 @noindent
148 This package's installation may need other standard utilities such as
149 @command{grep}, @command{make}, @command{sleep} and @command{touch},
150 along with compilers like @command{gcc}.
151
152 @node Compilers and Options
153 @section Compilers and Options
154
155 Some systems require unusual options for compilation or linking that the
156 @command{configure} script does not know about. Run @samp{./configure
157 --help} for details on some of the pertinent environment variables.
158
159 You can give @command{configure} initial values for configuration
160 parameters by setting variables in the command line or in the environment.
161 Here is an example:
162
163 @example
164 ./configure CC=gcc CFLAGS=-g LIBS=-lposix
165 @end example
166
167 @ifplaintext
168 See ``Defining Variables''
169 @end ifplaintext
170 @ifnotplaintext
171 @ref{Defining Variables}
172 @end ifnotplaintext
173 @ifset autoconf
174 and @ref{Preset Output Variables}
175 @end ifset
176 for more details.
177
178 @node Multiple Architectures
179 @section Compiling For Multiple Architectures
180
181 You can compile the package for more than one kind of computer at the
182 same time, by placing the object files for each system in their
183 own directory. To do this, you can use GNU @command{make}.
184 @command{cd} to the directory where you want the object files and
185 executables to go and run the @command{configure} script.
186 @command{configure} automatically checks for the source code in the
187 directory that @command{configure} is in and in @file{..}. This is
188 known as a @dfn{VPATH} build.
189
190 With a non-GNU @command{make},
191 it is safer to compile the package for one
192 system at a time in the source code directory. After you have
193 installed the package for one system, use @samp{make distclean}
194 before reconfiguring for another system.
195
196 Some platforms, notably macOS, support ``fat'' or ``universal'' binaries,
197 where a single binary can execute on different architectures.
198 On these platforms you can configure and compile just once,
199 with options specific to that platform.
200
201 @node Installation Names
202 @section Installation Names
203
204 By default, @samp{make install} installs the package's commands under
205 @file{/usr/local/bin}, include files under @file{/usr/local/include}, etc.
206 You can specify an
207 installation prefix other than @file{/usr/local} by giving
208 @command{configure} the option @option{--prefix=@var{prefix}}, where
209 @var{prefix} must be an absolute file name.
210
211 You can specify separate installation prefixes for architecture-specific
212 files and architecture-independent files. If you pass the option
213 @option{--exec-prefix=@var{prefix}} to @command{configure}, the
214 package uses @var{prefix} as the prefix for installing programs and
215 libraries. Documentation and other data files still use the
216 regular prefix.
217
218 In addition, if you use an unusual directory layout you can give options
219 like @option{--bindir=@var{dir}} to specify different values for
220 particular kinds of files. Run @samp{configure --help} for a list of
221 the directories you can set and what kinds of files go in them. In
222 general, the default for these options is expressed in terms of
223 @samp{$@{prefix@}}, so that specifying just @option{--prefix} will
224 affect all of the other directory specifications that were not
225 explicitly provided.
226
227 The most portable way to affect installation locations is to pass the
228 correct locations to @command{configure}; however, many packages provide
229 one or both of the following shortcuts of passing variable assignments
230 to the @samp{make install} command line to change installation locations
231 without having to reconfigure or recompile.
232
233 The first method involves providing an override variable for each
234 affected directory. For example, @samp{make install
235 prefix=/alternate/directory} will choose an alternate location for all
236 directory configuration variables that were expressed in terms of
237 @samp{$@{prefix@}}. Any directories that were specified during
238 @command{configure}, but not in terms of @samp{$@{prefix@}}, must each be
239 overridden at install time for the entire
240 installation to be relocated. The approach of makefile variable
241 overrides for each directory variable is required by the GNU
242 Coding Standards, and ideally causes no recompilation. However, some
243 platforms have known limitations with the semantics of shared libraries
244 that end up requiring recompilation when using this method, particularly
245 noticeable in packages that use GNU Libtool.
246
247 The second method involves providing the @samp{DESTDIR} variable. For
248 example, @samp{make install DESTDIR=/alternate/directory} will prepend
249 @samp{/alternate/directory} before all installation names. The approach
250 of @samp{DESTDIR} overrides is not required by the GNU Coding
251 Standards, and does not work on platforms that have drive letters. On
252 the other hand, it does better at avoiding recompilation issues, and
253 works well even when some directory options were not specified in terms
254 of @samp{$@{prefix@}} at @command{configure} time.
255
256 @node Optional Features
257 @section Optional Features
258
259 If the package supports it, you can cause programs to be installed with
260 an extra prefix or suffix on their names by giving @command{configure}
261 the option @option{--program-prefix=@var{PREFIX}} or
262 @option{--program-suffix=@var{SUFFIX}}.
263
264 Some packages pay attention to @option{--enable-@var{feature}}
265 and @option{--disable-@var{feature}} options
266 to @command{configure}, where @var{feature} indicates an optional part
267 of the package. They may also pay attention to
268 @option{--with-@var{package}} and @option{--without-@var{package}} options,
269 where @var{package} is something like @samp{gnu-ld}.
270 @samp{./configure --help} should mention the
271 @option{--enable-...} and @option{--with-...}
272 options that the package recognizes.
273
274 Some packages offer the ability to configure how verbose the execution
275 of @command{make} will be. For these packages, running
276 @samp{./configure --enable-silent-rules} sets the default to minimal
277 output, which can be overridden with @code{make V=1}; while running
278 @samp{./configure --disable-silent-rules} sets the default to verbose,
279 which can be overridden with @code{make V=0}.
280
281 @node System Types
282 @section Specifying a System Type
283
284 By default @command{configure} builds for the current system.
285 To create binaries that can run on a different system type,
286 specify a @option{--host=@var{type}} option along with compiler
287 variables that specify how to generate object code for @var{type}.
288 For example, to create binaries intended to run on a 64-bit ARM
289 processor:
290
291 @example
292 ./configure --host=aarch64-linux-gnu \
293 CC=aarch64-linux-gnu-gcc \
294 CXX=aarch64-linux-gnu-g++
295 @end example
296
297 @noindent
298 If done on a machine that can execute these binaries
299 (e.g., via @command{qemu-aarch64}, @env{$QEMU_LD_PREFIX}, and Linux's
300 @code{binfmt_misc} capability), the build behaves like a native build.
301 Otherwise it is a cross-build: @code{configure}
302 will make cross-compilation guesses instead of running test programs,
303 and @code{make check} will not work.
304
305 A system type can either be a short name like @samp{mingw64},
306 or a canonical name like @samp{x86_64-pc-linux-gnu}.
307 Canonical names have the form @var{cpu}-@var{company}-@var{system}
308 where @var{system} is either @var{os} or @var{kernel}-@var{os}.
309 To canonicalize and validate a system type,
310 you can run the command @file{config.sub},
311 which is often squirreled away in a subdirectory like @file{build-aux}.
312 For example:
313
314 @example
315 $ build-aux/config.sub arm64-linux
316 aarch64-unknown-linux-gnu
317 $ build-aux/config.sub riscv-lnx
318 Invalid configuration 'riscv-lnx': OS 'lnx' not recognized
319 @end example
320
321 @noindent
322 You can look at the @file{config.sub} file to see which types are recognized.
323 If the file is absent, this package does not need the system type.
324
325 If @command{configure} fails with the diagnostic ``cannot guess build type''.
326 @file{config.sub} did not recognize your system's type.
327 In this case, first fetch the newest versions of these files
328 from the @url{https://savannah.gnu.org/projects/config, GNU config package}.
329 If that fixes things, please report it to the
330 maintainers of the package containing @command{configure}.
331 Otherwise, you can try the configure option
332 @option{--build=@var{type}} where @var{type} comes close to your
333 system type; also, please report the problem to
334 @email{config-patches@@gnu.org}.
335
336 For more details about configuring system types, see
337 @ifset autoconf
338 @ref{Manual Configuration}.
339 @end ifset
340 @ifclear autoconf
341 the Autoconf documentation.
342 @end ifclear
343
344 @node Sharing Defaults
345 @section Sharing Defaults
346
347 If you want to set default values for @command{configure} scripts to
348 share, you can create a site shell script called @file{config.site} that
349 gives default values for variables like @code{CC}, @code{cache_file},
350 and @code{prefix}. @command{configure} looks for
351 @file{@var{prefix}/share/config.site} if it exists, then
352 @file{@var{prefix}/etc/config.site} if it exists. Or, you can set the
353 @code{CONFIG_SITE} environment variable to the location of the site
354 script. A warning: not all @command{configure} scripts look for a site
355 script.
356
357 @node Defining Variables
358 @section Defining Variables
359
360 Variables not defined in a site shell script can be set in the
361 environment passed to @command{configure}. However, some packages may
362 run configure again during the build, and the customized values of these
363 variables may be lost. In order to avoid this problem, you should set
364 them in the @command{configure} command line, using @samp{VAR=value}.
365 For example:
366
367 @example
368 ./configure CC=/usr/local2/bin/gcc
369 @end example
370
371 @noindent
372 causes the specified @command{gcc} to be used as the C compiler (unless it is
373 overridden in the site shell script).
374
375 @noindent
376 Unfortunately, this technique does not work for @env{CONFIG_SHELL} due
377 to an Autoconf limitation. Until the limitation is lifted, you can use
378 this workaround:
379
380 @example
381 CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash
382 @end example
383
384 @node configure Invocation
385 @section @command{configure} Invocation
386
387 @command{configure} recognizes the following options to control how it
388 operates.
389
390 @table @option
391 @item --help
392 @itemx -h
393 Print a summary of all of the options to @command{configure}, and exit.
394
395 @item --help=short
396 @itemx --help=recursive
397 Print a summary of the options unique to this package's
398 @command{configure}, and exit. The @code{short} variant lists options
399 used only in the top level, while the @code{recursive} variant lists
400 options also present in any nested packages.
401
402 @item --version
403 @itemx -V
404 Print the version of Autoconf used to generate the @command{configure}
405 script, and exit.
406
407 @item --cache-file=@var{file}
408 @cindex Cache, enabling
409 Enable the cache: use and save the results of the tests in @var{file},
410 traditionally @file{config.cache}. @var{file} defaults to
411 @file{/dev/null} to disable caching.
412
413 @item --config-cache
414 @itemx -C
415 Alias for @option{--cache-file=config.cache}.
416
417 @item --srcdir=@var{dir}
418 Look for the package's source code in directory @var{dir}. Usually
419 @command{configure} can determine that directory automatically.
420
421 @item --prefix=@var{dir}
422 Use @var{dir} as the installation prefix.
423 @ifplaintext
424 See ``Installation Names''
425 @end ifplaintext
426 @ifnotplaintext
427 @ref{Installation Names}
428 @end ifnotplaintext
429 for more details, including other options available for fine-tuning
430 the installation locations.
431
432 @item --host=@var{type}
433 Build binaries for system @var{type}.
434 @ifplaintext
435 See ``Specifying a System Type''.
436 @end ifplaintext
437 @ifnotplaintext
438 @xref{System Types}.
439 @end ifnotplaintext
440
441 @item --enable-@var{feature}
442 @itemx --disable-@var{feature}
443 Enable or disable the optional @var{feature}.
444 @ifplaintext
445 See ``Optional Features''.
446 @end ifplaintext
447 @ifnotplaintext
448 @xref{Optional Features}.
449 @end ifnotplaintext
450
451 @item --with-@var{package}
452 @itemx --without-@var{package}
453 Use or omit @var{package} when building.
454 @ifplaintext
455 See ``Optional Features''.
456 @end ifplaintext
457 @ifnotplaintext
458 @xref{Optional Features}.
459 @end ifnotplaintext
460
461 @item --quiet
462 @itemx --silent
463 @itemx -q
464 Do not print messages saying which checks are being made. To suppress
465 all normal output, redirect it to @file{/dev/null} (any error messages
466 will still be shown).
467
468 @item --no-create
469 @itemx -n
470 Run the configure checks, but stop before creating any output files.
471 @end table
472
473 @noindent
474 @command{configure} also recognizes several environment variables,
475 and accepts some other, less widely useful, options.
476 Run @samp{configure --help} for more details.
477
478 @ifclear autoconf
479 @node Copyright notice
480 @section Copyright notice
481
482 Copyright @copyright{} 1994--1996, 1999--2002, 2004--2017, 2020--2026
483 Free Software Foundation, Inc.
484
485 Copying and distribution of this file, with or without modification, are
486 permitted in any medium without royalty provided the copyright notice
487 and this notice are preserved. This file is offered as-is, without
488 warranty of any kind.
489 @end ifclear
490
491 @c Local Variables:
492 @c fill-column: 72
493 @c ispell-local-dictionary: "american"
494 @c indent-tabs-mode: nil
495 @c whitespace-check-buffer-indent: nil
496 @c End: