autoupdate
[gnulib.git] / doc / install.texi
1 @c This file is included by autoconf.texi and is used to produce
2 @c the INSTALL file.
3
4 @ifclear autoconf
5 @firstparagraphindent insert
6
7 @unnumbered Installation Instructions
8
9 Copyright @copyright{} 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004,
10 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
11
12 Copying and distribution of this file, with or without modification, are
13 permitted in any medium without royalty provided the copyright notice
14 and this notice are preserved.  This file is offered as-is, without
15 warranty of any kind.
16
17 @end ifclear
18
19 @node Basic Installation
20 @section Basic Installation
21
22 Briefly, the shell commands @samp{./configure; make; make install}
23 should configure, build, and install this package.  The following
24 more-detailed instructions are generic; see the @file{README} file for
25 instructions specific to this package.
26 @ifclear autoconf
27 Some packages provide this @file{INSTALL} file but do not implement all
28 of the features documented below.  The lack of an optional feature in a
29 given package is not necessarily a bug.
30 @end ifclear
31 More recommendations for @acronym{GNU} packages can be found in
32 @ref{Makefile Conventions, , Makefile Conventions, standards,
33 @acronym{GNU} Coding Standards}.
34
35 The @command{configure} shell script attempts to guess correct values
36 for various system-dependent variables used during compilation.  It uses
37 those values to create a @file{Makefile} in each directory of the
38 package.  It may also create one or more @file{.h} files containing
39 system-dependent definitions.  Finally, it creates a shell script
40 @file{config.status} that you can run in the future to recreate the
41 current configuration, and a file @file{config.log} containing compiler
42 output (useful mainly for debugging @command{configure}).
43
44 It can also use an optional file (typically called @file{config.cache}
45 and enabled with @option{--cache-file=config.cache} or simply
46 @option{-C}) that saves the results of its tests to speed up
47 reconfiguring.  Caching is disabled by default to prevent problems with
48 accidental use of stale cache files.
49
50 If you need to do unusual things to compile the package, please try to
51 figure out how @command{configure} could check whether to do them, and
52 mail diffs or instructions to the address given in the @file{README} so
53 they can be considered for the next release.  If you are using the
54 cache, and at some point @file{config.cache} contains results you don't
55 want to keep, you may remove or edit it.
56
57 The file @file{configure.ac} (or @file{configure.in}) is used to create
58 @file{configure} by a program called @command{autoconf}.  You need
59 @file{configure.ac} if you want to change it or regenerate
60 @file{configure} using a newer version of @command{autoconf}.
61
62 The simplest way to compile this package is:
63
64 @enumerate
65 @item
66 @command{cd} to the directory containing the package's source code and type
67 @samp{./configure} to configure the package for your system.
68
69 Running @command{configure} might take a while.  While running, it prints some
70 messages telling which features it is checking for.
71
72 @item
73 Type @samp{make} to compile the package.
74
75 @item
76 Optionally, type @samp{make check} to run any self-tests that come with
77 the package, generally using the just-built uninstalled binaries.
78
79 @item
80 Type @samp{make install} to install the programs and any data files and
81 documentation.  When installing into a prefix owned by root, it is
82 recommended that the package be configured and built as a regular user,
83 and only the @samp{make install} phase executed with root privileges.
84
85 @item
86 Optionally, type @samp{make installcheck} to repeat any self-tests, but
87 this time using the binaries in their final installed location.
88
89 @item
90 You can remove the program binaries and object files from the source
91 code directory by typing @samp{make clean}.  To also remove the files
92 that @command{configure} created (so you can compile the package for a
93 different kind of computer), type @samp{make distclean}.  There is also
94 a @samp{make maintainer-clean} target, but that is intended mainly for
95 the package's developers.  If you use it, you may have to get all sorts
96 of other programs in order to regenerate files that came with the
97 distribution.
98
99 @item
100 Often, you can also type @samp{make uninstall} to remove the installed
101 files again.  In practice, not all packages have tested that
102 uninstallation works correctly, even though it is required by the
103 @acronym{GNU} Coding Standards.
104
105 @item
106 Some packages, particularly those that use Automake, provide @samp{make
107 distcheck}, which can by used by developers to test that all other
108 targets like @samp{make install} and @samp{make uninstall} work
109 correctly.  This target is generally not run by end users.
110 @end enumerate
111
112 @node Compilers and Options
113 @section Compilers and Options
114
115 Some systems require unusual options for compilation or linking that the
116 @command{configure} script does not know about.  Run @samp{./configure
117 --help} for details on some of the pertinent environment variables.
118
119 You can give @command{configure} initial values for configuration
120 parameters by setting variables in the command line or in the environment.
121 Here is an example:
122
123 @example
124 ./configure CC=c99 CFLAGS=-g LIBS=-lposix
125 @end example
126
127 @xref{Defining Variables}, for more details.
128
129
130 @node Multiple Architectures
131 @section Compiling For Multiple Architectures
132
133 You can compile the package for more than one kind of computer at the
134 same time, by placing the object files for each architecture in their
135 own directory.  To do this, you can use @acronym{GNU} @command{make}.
136 @command{cd} to the directory where you want the object files and
137 executables to go and run the @command{configure} script.
138 @command{configure} automatically checks for the source code in the
139 directory that @command{configure} is in and in @file{..}.  This is
140 known as a @dfn{VPATH} build.
141
142 With a non-@acronym{GNU} @command{make},
143 it is safer to compile the package for one
144 architecture at a time in the source code directory.  After you have
145 installed the package for one architecture, use @samp{make distclean}
146 before reconfiguring for another architecture.
147
148 On MacOS X 10.5 and later systems, you can create libraries and
149 executables that work on multiple system types---known as @dfn{fat} or
150 @dfn{universal} binaries---by specifying multiple @option{-arch} options
151 to the compiler but only a single @option{-arch} option to the
152 preprocessor.  Like this:
153
154 @example
155 ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
156             CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
157             CPP="gcc -E" CXXCPP="g++ -E"
158 @end example
159
160 This is not guaranteed to produce working output in all cases, you may
161 have to build one architecture at a time and combine the results
162 using the @command{lipo} tool if you have problems.
163
164 @node Installation Names
165 @section Installation Names
166
167 By default, @samp{make install} installs the package's commands under
168 @file{/usr/local/bin}, include files under @file{/usr/local/include}, etc.
169 You can specify an
170 installation prefix other than @file{/usr/local} by giving
171 @command{configure} the option @option{--prefix=@var{prefix}}, where
172 @var{prefix} must be an absolute path.
173
174 You can specify separate installation prefixes for architecture-specific
175 files and architecture-independent files.  If you pass the option
176 @option{--exec-prefix=@var{prefix}} to @command{configure}, the
177 package uses @var{prefix} as the prefix for installing programs and
178 libraries.  Documentation and other data files still use the
179 regular prefix.
180
181 In addition, if you use an unusual directory layout you can give options
182 like @option{--bindir=@var{dir}} to specify different values for
183 particular kinds of files.  Run @samp{configure --help} for a list of
184 the directories you can set and what kinds of files go in them.  In
185 general, the default for these options is expressed in terms of
186 @samp{$@{prefix@}}, so that specifying just @option{--prefix} will
187 affect all of the other directory specifications.
188
189 The most portable way to affect installation locations is to pass the
190 correct locations to @command{configure}; however, many packages provide
191 one or both of the following shortcuts of passing variable assignments
192 to the @samp{make install} command line to change installation locations
193 without having to reconfigure or recompile.
194
195 The first method involves providing an override variable for each
196 affected directory.  For example, @samp{make install
197 prefix=/path/to/alternate} will choose an alternate location, as well as
198 influencing all other directory configuration variables that were
199 expressed in terms of @samp{$@{prefix@}} (or, put another way, all
200 directories specified during @command{configure} but not in terms of the
201 common prefix must each be overridden at install time for the entire
202 installation to be relocated).  The approach of makefile variable
203 overrides for each directory variable is required by the @acronym{GNU}
204 Coding Standards, and ideally causes no recompilation.  However, some
205 platforms have known limitations with the semantics of shared libraries
206 that end up requiring recompilation when using this method, particularly
207 noticeable in packages that use @acronym{GNU} Libtool.
208
209 The second method involves providing the @samp{DESTDIR} variable.  For
210 example, @samp{make install DESTDIR=/path/to/alternate} will prepend
211 @samp{/path/to/alternate} before all installation paths.  The approach
212 of @samp{DESTDIR} overrides is not required by the @acronym{GNU} Coding
213 Standards, and does not work on platforms that have drive letters.  On
214 the other hand, it does better at avoiding recompilation issues, and
215 works well even when some directory options were not specified in terms
216 of @samp{$@{prefix@}} at @command{configure} time.  For packages which
217 support @samp{DESTDIR}, the variable should remain undefined during
218 @command{configure} and @samp{make all}, and only be specified during
219 @samp{make install}.
220
221 @node Optional Features
222 @section Optional Features
223
224 If the package supports it, you can cause programs to be installed with
225 an extra prefix or suffix on their names by giving @command{configure}
226 the option @option{--program-prefix=@var{PREFIX}} or
227 @option{--program-suffix=@var{SUFFIX}}.
228
229 Some packages pay attention to @option{--enable-@var{feature}} options
230 to @command{configure}, where @var{feature} indicates an optional part
231 of the package.  They may also pay attention to
232 @option{--with-@var{package}} options, where @var{package} is something
233 like @samp{gnu-as} or @samp{x} (for the X Window System).  The
234 @file{README} should mention any @option{--enable-} and @option{--with-}
235 options that the package recognizes.
236
237 For packages that use the X Window System, @command{configure} can
238 usually find the X include and library files automatically, but if it
239 doesn't, you can use the @command{configure} options
240 @option{--x-includes=@var{dir}} and @option{--x-libraries=@var{dir}} to
241 specify their locations.
242
243 Some packages offer the ability to configure how verbose the execution
244 of @command{make} will be.  For these packages, running
245 @samp{./configure --enable-silent-rules} sets the default to minimal
246 output, which can be overridden with @code{make V=1}; while running
247 @samp{./configure --disable-silent-rules} sets the default to verbose,
248 which can be overridden with @code{make V=0}.
249
250 @node Particular Systems
251 @section Particular systems
252
253 On HP-UX, the default C compiler is not ANSI C compatible.  If GNU CC is
254 not installed, it is recommended to use the following options in order to
255 use an ANSI C compiler:
256
257 @example
258 ./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
259 @end example
260
261 @noindent
262 and if that doesn't work, install pre-built binaries of GCC for HP-UX.
263
264 On OSF/1 a.k.a.@: Tru64, some versions of the default C compiler cannot
265 parse its @code{<wchar.h>} header file.  The option @option{-nodtk} can be
266 used as a workaround.  If GNU CC is not installed, it is therefore
267 recommended to try
268
269 @example
270 ./configure CC="cc"
271 @end example
272
273 @noindent
274 and if that doesn't work, try
275
276 @example
277 ./configure CC="cc -nodtk"
278 @end example
279
280 On Solaris, don't put @code{/usr/ucb} early in your @env{PATH}.  This
281 directory contains several dysfunctional programs; working variants
282 of these programs are available in @code{/usr/bin}.  So, if you need
283 @code{/usr/ucb} in your @env{PATH}, put it @emph{after} @code{/usr/bin}.
284
285 On Haiku, software installed for all users goes in @file{/boot/common},
286 not @file{/usr/local}.  It is recommended to use the following options:
287
288 @example
289 ./configure --prefix=/boot/common
290 @end example
291
292 @node System Type
293 @section Specifying the System Type
294
295 There may be some features @command{configure} cannot figure out
296 automatically, but needs to determine by the type of machine the package
297 will run on.  Usually, assuming the package is built to be run on the
298 @emph{same} architectures, @command{configure} can figure that out, but
299 if it prints a message saying it cannot guess the machine type, give it
300 the @option{--build=@var{type}} option.  @var{type} can either be a
301 short name for the system type, such as @samp{sun4}, or a canonical name
302 which has the form:
303
304 @example
305 @var{cpu}-@var{company}-@var{system}
306 @end example
307
308 @noindent
309 where @var{system} can have one of these forms:
310
311 @example
312 @var{os}
313 @var{kernel}-@var{os}
314 @end example
315
316 See the file @file{config.sub} for the possible values of each field.
317 If @file{config.sub} isn't included in this package, then this package
318 doesn't need to know the machine type.
319
320 If you are @emph{building} compiler tools for cross-compiling, you
321 should use the option @option{--target=@var{type}} to select the type of
322 system they will produce code for.
323
324 If you want to @emph{use} a cross compiler, that generates code for a
325 platform different from the build platform, you should specify the
326 @dfn{host} platform (i.e., that on which the generated programs will
327 eventually be run) with @option{--host=@var{type}}.
328
329 @node Sharing Defaults
330 @section Sharing Defaults
331
332 If you want to set default values for @command{configure} scripts to
333 share, you can create a site shell script called @file{config.site} that
334 gives default values for variables like @code{CC}, @code{cache_file},
335 and @code{prefix}.  @command{configure} looks for
336 @file{@var{prefix}/share/config.site} if it exists, then
337 @file{@var{prefix}/etc/config.site} if it exists.  Or, you can set the
338 @code{CONFIG_SITE} environment variable to the location of the site
339 script.  A warning: not all @command{configure} scripts look for a site
340 script.
341
342 @node Defining Variables
343 @section Defining Variables
344
345 Variables not defined in a site shell script can be set in the
346 environment passed to @command{configure}.  However, some packages may
347 run configure again during the build, and the customized values of these
348 variables may be lost.  In order to avoid this problem, you should set
349 them in the @command{configure} command line, using @samp{VAR=value}.
350 For example:
351
352 @example
353 ./configure CC=/usr/local2/bin/gcc
354 @end example
355
356 @noindent
357 causes the specified @command{gcc} to be used as the C compiler (unless it is
358 overridden in the site shell script).
359
360 @noindent
361 Unfortunately, this technique does not work for @env{CONFIG_SHELL} due
362 to an Autoconf bug.  Until the bug is fixed you can use this
363 workaround:
364
365 @example
366 CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
367 @end example
368
369 @node configure Invocation
370 @section @command{configure} Invocation
371
372 @command{configure} recognizes the following options to control how it
373 operates.
374
375 @table @option
376 @item --help
377 @itemx -h
378 Print a summary of all of the options to @command{configure}, and exit.
379
380 @item --help=short
381 @itemx --help=recursive
382 Print a summary of the options unique to this package's
383 @command{configure}, and exit.  The @code{short} variant lists options
384 used only in the top level, while the @code{recursive} variant lists
385 options also present in any nested packages.
386
387 @item --version
388 @itemx -V
389 Print the version of Autoconf used to generate the @command{configure}
390 script, and exit.
391
392 @item --cache-file=@var{file}
393 @cindex Cache, enabling
394 Enable the cache: use and save the results of the tests in @var{file},
395 traditionally @file{config.cache}.  @var{file} defaults to
396 @file{/dev/null} to disable caching.
397
398 @item --config-cache
399 @itemx -C
400 Alias for @option{--cache-file=config.cache}.
401
402 @item --quiet
403 @itemx --silent
404 @itemx -q
405 Do not print messages saying which checks are being made.  To suppress
406 all normal output, redirect it to @file{/dev/null} (any error messages
407 will still be shown).
408
409 @item --srcdir=@var{dir}
410 Look for the package's source code in directory @var{dir}.  Usually
411 @command{configure} can determine that directory automatically.
412
413 @item --prefix=@var{dir}
414 Use @var{dir} as the installation prefix.  @ref{Installation Names}
415 for more details, including other options available for fine-tuning
416 the installation locations.
417
418 @item --no-create
419 @itemx -n
420 Run the configure checks, but stop before creating any output files.
421 @end table
422
423 @noindent
424 @command{configure} also accepts some other, not widely useful, options.
425 Run @samp{configure --help} for more details.
426
427 @c Local Variables:
428 @c fill-column: 72
429 @c ispell-local-dictionary: "american"
430 @c indent-tabs-mode: nil
431 @c whitespace-check-buffer-indent: nil
432 @c End: