* lib/autoconf/general.m4 (AC_ARG_ENABLE): Print help about
[autoconf.git] / doc / install.texi
blob5a5d1c1821d7e8063488a6feef9868ade87de49d
1 @c This file is included by autoconf.texi and is used to produce
2 @c the INSTALL file.
4 @ifclear autoconf
6 @unnumbered Installation Instructions
8 Copyright @copyright{} 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004,
9 2005, 2006 Free Software Foundation, Inc.
11 This file is free documentation; the Free Software Foundation gives
12 unlimited permission to copy, distribute and modify it.
14 @end ifclear
16 @node Basic Installation
17 @section Basic Installation
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.
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}).
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.
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.
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}.
51 @noindent
52 The simplest way to compile this package is:
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.
59 Running @command{configure} might take a while.  While running, it prints some
60 messages telling which features it is checking for.
62 @item
63 Type @samp{make} to compile the package.
65 @item
66 Optionally, type @samp{make check} to run any self-tests that come with
67 the package.
69 @item
70 Type @samp{make install} to install the programs and any data files and
71 documentation.
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 @end enumerate
84 @node Compilers and Options
85 @section Compilers and Options
87 Some systems require unusual options for compilation or linking that the
88 @command{configure} script does not know about.  Run @samp{./configure
89 --help} for details on some of the pertinent environment variables.
91 You can give @command{configure} initial values for configuration
92 parameters by setting variables in the command line or in the environment.
93 Here is an example:
95 @example
96 ./configure CC=c99 CFLAGS=-g LIBS=-lposix
97 @end example
99 @xref{Defining Variables}, for more details.
102 @node Multiple Architectures
103 @section Compiling For Multiple Architectures
105 You can compile the package for more than one kind of computer at the
106 same time, by placing the object files for each architecture in their
107 own directory.  To do this, you can use @acronym{GNU} @command{make}.
108 @command{cd} to the directory where you want the object files and
109 executables to go and run the @command{configure} script.
110 @command{configure} automatically checks for the source code in the
111 directory that @command{configure} is in and in @file{..}.
113 With a non-@acronym{GNU} @command{make},
114 it is safer to compile the package for one
115 architecture at a time in the source code directory.  After you have
116 installed the package for one architecture, use @samp{make distclean}
117 before reconfiguring for another architecture.
119 @node Installation Names
120 @section Installation Names
122 By default, @samp{make install} installs the package's commands under
123 @file{/usr/local/bin}, include files under @file{/usr/local/include}, etc.
124 You can specify an
125 installation prefix other than @file{/usr/local} by giving
126 @command{configure} the option @option{--prefix=@var{prefix}}.
128 You can specify separate installation prefixes for architecture-specific
129 files and architecture-independent files.  If you pass the option
130 @option{--exec-prefix=@var{prefix}} to @command{configure}, the
131 package uses @var{prefix} as the prefix for installing programs and
132 libraries.  Documentation and other data files still use the
133 regular prefix.
135 In addition, if you use an unusual directory layout you can give options
136 like @option{--bindir=@var{dir}} to specify different values for
137 particular kinds of files.  Run @samp{configure --help} for a list of
138 the directories you can set and what kinds of files go in them.
140 If the package supports it, you can cause programs to be installed with
141 an extra prefix or suffix on their names by giving @command{configure}
142 the option @option{--program-prefix=@var{PREFIX}} or
143 @option{--program-suffix=@var{SUFFIX}}.
145 @node Optional Features
146 @section Optional Features
148 Some packages pay attention to @option{--enable-@var{feature}} options
149 to @command{configure}, where @var{feature} indicates an optional part
150 of the package.  They may also pay attention to
151 @option{--with-@var{package}} options, where @var{package} is something
152 like @samp{gnu-as} or @samp{x} (for the X Window System).  The
153 @file{README} should mention any @option{--enable-} and @option{--with-}
154 options that the package recognizes.
156 For packages that use the X Window System, @command{configure} can
157 usually find the X include and library files automatically, but if it
158 doesn't, you can use the @command{configure} options
159 @option{--x-includes=@var{dir}} and @option{--x-libraries=@var{dir}} to
160 specify their locations.
162 @node System Type
163 @section Specifying the System Type
165 There may be some features @command{configure} cannot figure out
166 automatically, but needs to determine by the type of machine the package
167 will run on.  Usually, assuming the package is built to be run on the
168 @emph{same} architectures, @command{configure} can figure that out, but
169 if it prints a message saying it cannot guess the machine type, give it
170 the @option{--build=@var{type}} option.  @var{type} can either be a
171 short name for the system type, such as @samp{sun4}, or a canonical name
172 which has the form:
174 @example
175 @var{cpu}-@var{company}-@var{system}
176 @end example
178 @noindent
179 where @var{system} can have one of these forms:
181 @example
182 @var{os} @var{kernel}-@var{os}
183 @end example
185 See the file @file{config.sub} for the possible values of each field.
186 If @file{config.sub} isn't included in this package, then this package
187 doesn't need to know the machine type.
189 If you are @emph{building} compiler tools for cross-compiling, you
190 should use the option @option{--target=@var{type}} to select the type of
191 system they will produce code for.
193 If you want to @emph{use} a cross compiler, that generates code for a
194 platform different from the build platform, you should specify the
195 @dfn{host} platform (i.e., that on which the generated programs will
196 eventually be run) with @option{--host=@var{type}}.
198 @node Sharing Defaults
199 @section Sharing Defaults
201 If you want to set default values for @command{configure} scripts to
202 share, you can create a site shell script called @file{config.site} that
203 gives default values for variables like @code{CC}, @code{cache_file},
204 and @code{prefix}.  @command{configure} looks for
205 @file{@var{prefix}/share/config.site} if it exists, then
206 @file{@var{prefix}/etc/config.site} if it exists.  Or, you can set the
207 @code{CONFIG_SITE} environment variable to the location of the site
208 script.  A warning: not all @command{configure} scripts look for a site
209 script.
211 @node Defining Variables
212 @section Defining Variables
214 Variables not defined in a site shell script can be set in the
215 environment passed to @command{configure}.  However, some packages may
216 run configure again during the build, and the customized values of these
217 variables may be lost.  In order to avoid this problem, you should set
218 them in the @command{configure} command line, using @samp{VAR=value}.
219 For example:
221 @example
222 ./configure CC=/usr/local2/bin/gcc
223 @end example
225 @noindent
226 causes the specified @command{gcc} to be used as the C compiler (unless it is
227 overridden in the site shell script).
229 @noindent
230 Unfortunately, this technique does not work for @env{CONFIG_SHELL} due
231 to an Autoconf bug.  Until the bug is fixed you can use this
232 workaround:
234 @example
235 CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
236 @end example
238 @node configure Invocation
239 @section @command{configure} Invocation
241 @command{configure} recognizes the following options to control how it
242 operates.
244 @table @option
245 @item --help
246 @itemx -h
247 Print a summary of the options to @command{configure}, and exit.
249 @item --version
250 @itemx -V
251 Print the version of Autoconf used to generate the @command{configure}
252 script, and exit.
254 @item --cache-file=@var{file}
255 @cindex Cache, enabling
256 Enable the cache: use and save the results of the tests in @var{file},
257 traditionally @file{config.cache}.  @var{file} defaults to
258 @file{/dev/null} to disable caching.
260 @item --config-cache
261 @itemx -C
262 Alias for @option{--cache-file=config.cache}.
264 @item --quiet
265 @itemx --silent
266 @itemx -q
267 Do not print messages saying which checks are being made.  To suppress
268 all normal output, redirect it to @file{/dev/null} (any error messages
269 will still be shown).
271 @item --srcdir=@var{dir}
272 Look for the package's source code in directory @var{dir}.  Usually
273 @command{configure} can determine that directory automatically.
274 @end table
276 @noindent
277 @command{configure} also accepts some other, not widely useful, options.
278 Run @samp{configure --help} for more details.