2
0

install.texi 17 KB

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