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