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