3fc429854fecd9c6e4585f1c42c7bd9634be7ee5
[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
27 The @command{configure} shell script attempts to guess correct values
28 for various system-dependent variables used during compilation.  It uses
29 those values to create a @file{Makefile} in each directory of the
30 package.  It may also create one or more @file{.h} files containing
31 system-dependent definitions.  Finally, it creates a shell script
32 @file{config.status} that you can run in the future to recreate the
33 current configuration, and a file @file{config.log} containing compiler
34 output (useful mainly for debugging @command{configure}).
35
36 It can also use an optional file (typically called @file{config.cache}
37 and enabled with @option{--cache-file=config.cache} or simply
38 @option{-C}) that saves the results of its tests to speed up
39 reconfiguring.  Caching is disabled by default to prevent problems with
40 accidental use of stale cache files.
41
42 If you need to do unusual things to compile the package, please try to
43 figure out how @command{configure} could check whether to do them, and
44 mail diffs or instructions to the address given in the @file{README} so
45 they can be considered for the next release.  If you are using the
46 cache, and at some point @file{config.cache} contains results you don't
47 want to keep, you may remove or edit it.
48
49 The file @file{configure.ac} (or @file{configure.in}) is used to create
50 @file{configure} by a program called @code{autoconf}.  You need
51 @file{configure.ac} if you want to change it or regenerate
52 @file{configure} using a newer version of @code{autoconf}.
53
54 @noindent
55 The simplest way to compile this package is:
56
57 @enumerate
58 @item
59 @code{cd} to the directory containing the package's source code and type
60 @samp{./configure} to configure the package for your system.
61
62 Running @command{configure} might take a while.  While running, it prints some
63 messages telling which features it is checking for.
64
65 @item
66 Type @samp{make} to compile the package.
67
68 @item
69 Optionally, type @samp{make check} to run any self-tests that come with
70 the package.
71
72 @item
73 Type @samp{make install} to install the programs and any data files and
74 documentation.
75
76 @item
77 You can remove the program binaries and object files from the source
78 code directory by typing @samp{make clean}.  To also remove the files
79 that @command{configure} created (so you can compile the package for a
80 different kind of computer), type @samp{make distclean}.  There is also
81 a @samp{make maintainer-clean} target, but that is intended mainly for
82 the package's developers.  If you use it, you may have to get all sorts
83 of other programs in order to regenerate files that came with the
84 distribution.
85
86 @item
87 Often, you can also type @samp{make uninstall} to remove the installed
88 files again.
89 @end enumerate
90
91 @node Compilers and Options
92 @section Compilers and Options
93
94 Some systems require unusual options for compilation or linking that the
95 @command{configure} script does not know about.  Run @samp{./configure
96 --help} for details on some of the pertinent environment variables.
97
98 You can give @command{configure} initial values for configuration
99 parameters by setting variables in the command line or in the environment.
100 Here is an example:
101
102 @example
103 ./configure CC=c99 CFLAGS=-g LIBS=-lposix
104 @end example
105
106 @xref{Defining Variables}, for more details.
107
108
109 @node Multiple Architectures
110 @section Compiling For Multiple Architectures
111
112 You can compile the package for more than one kind of computer at the
113 same time, by placing the object files for each architecture in their
114 own directory.  To do this, you can use @acronym{GNU} @command{make}.
115 @command{cd} to the directory where you want the object files and
116 executables to go and run the @command{configure} script.
117 @command{configure} automatically checks for the source code in the
118 directory that @command{configure} is in and in @file{..}.
119
120 With a non-@acronym{GNU} @command{make},
121 it is safer to compile the package for one
122 architecture at a time in the source code directory.  After you have
123 installed the package for one architecture, use @samp{make distclean}
124 before reconfiguring for another architecture.
125
126 On MacOS X 10.5 and later systems, you can create libraries and
127 executables that work on multiple system types---known as @dfn{fat} or
128 @dfn{universal} binaries---by specifying multiple @option{-arch} options
129 to the compiler but only a single @option{-arch} option to the
130 preprocessor.  Like this:
131
132 @example
133 ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
134             CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
135             CPP="gcc -E" CXXCPP="g++ -E"
136 @end example
137
138 This is not guaranteed to produce working output in all cases, you may
139 have to build one architecture at a time and combine the results
140 using the @command{lipo} tool if you have problems.
141
142 @node Installation Names
143 @section Installation Names
144
145 By default, @samp{make install} installs the package's commands under
146 @file{/usr/local/bin}, include files under @file{/usr/local/include}, etc.
147 You can specify an
148 installation prefix other than @file{/usr/local} by giving
149 @command{configure} the option @option{--prefix=@var{prefix}}.
150
151 You can specify separate installation prefixes for architecture-specific
152 files and architecture-independent files.  If you pass the option
153 @option{--exec-prefix=@var{prefix}} to @command{configure}, the
154 package uses @var{prefix} as the prefix for installing programs and
155 libraries.  Documentation and other data files still use the
156 regular prefix.
157
158 In addition, if you use an unusual directory layout you can give options
159 like @option{--bindir=@var{dir}} to specify different values for
160 particular kinds of files.  Run @samp{configure --help} for a list of
161 the directories you can set and what kinds of files go in them.
162
163 If the package supports it, you can cause programs to be installed with
164 an extra prefix or suffix on their names by giving @command{configure}
165 the option @option{--program-prefix=@var{PREFIX}} or
166 @option{--program-suffix=@var{SUFFIX}}.
167
168 @node Optional Features
169 @section Optional Features
170
171 Some packages pay attention to @option{--enable-@var{feature}} options
172 to @command{configure}, where @var{feature} indicates an optional part
173 of the package.  They may also pay attention to
174 @option{--with-@var{package}} options, where @var{package} is something
175 like @samp{gnu-as} or @samp{x} (for the X Window System).  The
176 @file{README} should mention any @option{--enable-} and @option{--with-}
177 options that the package recognizes.
178
179 For packages that use the X Window System, @command{configure} can
180 usually find the X include and library files automatically, but if it
181 doesn't, you can use the @command{configure} options
182 @option{--x-includes=@var{dir}} and @option{--x-libraries=@var{dir}} to
183 specify their locations.
184
185 @node Particular Systems
186 @section Particular systems
187
188 On HP-UX, the default C compiler is not ANSI C compatible.  If GNU CC is
189 not installed, it is recommended to use the following options in order to
190 use an ANSI C compiler:
191
192 @example
193 ./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
194 @end example
195
196 @noindent
197 and if that doesn't work, install pre-built binaries of GCC for HP-UX.
198
199 On OSF/1 a.k.a.@: Tru64, some versions of the default C compiler cannot
200 parse its @code{<wchar.h>} header file.  The option @option{-nodtk} can be
201 used as a workaround.  If GNU CC is not installed, it is therefore
202 recommended to try
203
204 @example
205 ./configure CC="cc"
206 @end example
207
208 @noindent
209 and if that doesn't work, try
210
211 @example
212 ./configure CC="cc -nodtk"
213 @end example
214
215 On Solaris, don't put @code{/usr/ucb} early in your @env{PATH}.  This
216 directory contains several dysfunctional programs; working variants
217 of these programs are available in @code{/usr/bin}.  So, if you need
218 @code{/usr/ucb} in your @env{PATH}, put it @emph{after} @code{/usr/bin}.
219
220 On Haiku, software installed for all users goes in @file{/boot/common},
221 not @file{/usr/local}.  It is recommended to use the following options:
222
223 @example
224 ./configure --prefix=/boot/common
225 @end example
226
227 @node System Type
228 @section Specifying the System Type
229
230 There may be some features @command{configure} cannot figure out
231 automatically, but needs to determine by the type of machine the package
232 will run on.  Usually, assuming the package is built to be run on the
233 @emph{same} architectures, @command{configure} can figure that out, but
234 if it prints a message saying it cannot guess the machine type, give it
235 the @option{--build=@var{type}} option.  @var{type} can either be a
236 short name for the system type, such as @samp{sun4}, or a canonical name
237 which has the form:
238
239 @example
240 @var{cpu}-@var{company}-@var{system}
241 @end example
242
243 @noindent
244 where @var{system} can have one of these forms:
245
246 @example
247 @var{os}
248 @var{kernel}-@var{os}
249 @end example
250
251 See the file @file{config.sub} for the possible values of each field.
252 If @file{config.sub} isn't included in this package, then this package
253 doesn't need to know the machine type.
254
255 If you are @emph{building} compiler tools for cross-compiling, you
256 should use the option @option{--target=@var{type}} to select the type of
257 system they will produce code for.
258
259 If you want to @emph{use} a cross compiler, that generates code for a
260 platform different from the build platform, you should specify the
261 @dfn{host} platform (i.e., that on which the generated programs will
262 eventually be run) with @option{--host=@var{type}}.
263
264 @node Sharing Defaults
265 @section Sharing Defaults
266
267 If you want to set default values for @command{configure} scripts to
268 share, you can create a site shell script called @file{config.site} that
269 gives default values for variables like @code{CC}, @code{cache_file},
270 and @code{prefix}.  @command{configure} looks for
271 @file{@var{prefix}/share/config.site} if it exists, then
272 @file{@var{prefix}/etc/config.site} if it exists.  Or, you can set the
273 @code{CONFIG_SITE} environment variable to the location of the site
274 script.  A warning: not all @command{configure} scripts look for a site
275 script.
276
277 @node Defining Variables
278 @section Defining Variables
279
280 Variables not defined in a site shell script can be set in the
281 environment passed to @command{configure}.  However, some packages may
282 run configure again during the build, and the customized values of these
283 variables may be lost.  In order to avoid this problem, you should set
284 them in the @command{configure} command line, using @samp{VAR=value}.
285 For example:
286
287 @example
288 ./configure CC=/usr/local2/bin/gcc
289 @end example
290
291 @noindent
292 causes the specified @command{gcc} to be used as the C compiler (unless it is
293 overridden in the site shell script).
294
295 @noindent
296 Unfortunately, this technique does not work for @env{CONFIG_SHELL} due
297 to an Autoconf bug.  Until the bug is fixed you can use this
298 workaround:
299
300 @example
301 CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
302 @end example
303
304 @node configure Invocation
305 @section @command{configure} Invocation
306
307 @command{configure} recognizes the following options to control how it
308 operates.
309
310 @table @option
311 @item --help
312 @itemx -h
313 Print a summary of all of the options to @command{configure}, and exit.
314
315 @item --help=short
316 @itemx --help=recursive
317 Print a summary of the options unique to this package's
318 @command{configure}, and exit.  The @code{short} variant lists options
319 used only in the top level, while the @code{recursive} variant lists
320 options also present in any nested packages.
321
322 @item --version
323 @itemx -V
324 Print the version of Autoconf used to generate the @command{configure}
325 script, and exit.
326
327 @item --cache-file=@var{file}
328 @cindex Cache, enabling
329 Enable the cache: use and save the results of the tests in @var{file},
330 traditionally @file{config.cache}.  @var{file} defaults to
331 @file{/dev/null} to disable caching.
332
333 @item --config-cache
334 @itemx -C
335 Alias for @option{--cache-file=config.cache}.
336
337 @item --quiet
338 @itemx --silent
339 @itemx -q
340 Do not print messages saying which checks are being made.  To suppress
341 all normal output, redirect it to @file{/dev/null} (any error messages
342 will still be shown).
343
344 @item --srcdir=@var{dir}
345 Look for the package's source code in directory @var{dir}.  Usually
346 @command{configure} can determine that directory automatically.
347
348 @item --prefix=@var{dir}
349 Use @var{dir} as the installation prefix.  @ref{Installation Names}
350 for more details, including other options available for fine-tuning
351 the installation locations.
352
353 @item --no-create
354 @itemx -n
355 Run the configure checks, but stop before creating any output files.
356 @end table
357
358 @noindent
359 @command{configure} also accepts some other, not widely useful, options.
360 Run @samp{configure --help} for more details.
361
362 @c Local Variables:
363 @c fill-column: 72
364 @c ispell-local-dictionary: "american"
365 @c indent-tabs-mode: nil
366 @c whitespace-check-buffer-indent: nil
367 @c End: