]> git.ipfire.org Git - thirdparty/gcc.git/blob
9eb9b1c285d86f2aa46701cad77602fcc4810409
[thirdparty/gcc.git] /
1 ..
2 Copyright 1988-2022 Free Software Foundation, Inc.
3 This is part of the GCC manual.
4 For copying conditions, see the copyright.rst file.
5
6 .. _configuration:
7
8 Configuration in the gcc Directory
9 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
10
11 The :samp:`gcc` directory is configured with an Autoconf-generated
12 script :samp:`configure`. The :samp:`configure` script is generated
13 from :samp:`configure.ac` and :samp:`aclocal.m4`. From the files
14 :samp:`configure.ac` and :samp:`acconfig.h`, Autoheader generates the
15 file :samp:`config.in`. The file :samp:`cstamp-h.in` is used as a
16 timestamp.
17
18 .. toctree::
19 :maxdepth: 2
20
21
22 .. _config-fragments:
23
24 Scripts Used by configure
25 ~~~~~~~~~~~~~~~~~~~~~~~~~
26
27 :samp:`configure` uses some other scripts to help in its work:
28
29 * The standard GNU :samp:`config.sub` and :samp:`config.guess`
30 files, kept in the top level directory, are used.
31
32 * The file :samp:`config.gcc` is used to handle configuration
33 specific to the particular target machine. The file
34 :samp:`config.build` is used to handle configuration specific to the
35 particular build machine. The file :samp:`config.host` is used to handle
36 configuration specific to the particular host machine. (In general,
37 these should only be used for features that cannot reasonably be tested in
38 Autoconf feature tests.)
39 See :ref:`system-config`, for details of the contents of these files.
40
41 * Each language subdirectory has a file
42 :samp:`{language}/config-lang.in` that is used for
43 front-end-specific configuration. See :ref:`front-end-config`, for details of this file.
44
45 * A helper script :samp:`configure.frag` is used as part of
46 creating the output of :samp:`configure`.
47
48 .. _system-config:
49
50 The config.build; config.host; and config.gcc Files
51 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
52
53 The :samp:`config.build` file contains specific rules for particular systems
54 which GCC is built on. This should be used as rarely as possible, as the
55 behavior of the build system can always be detected by autoconf.
56
57 The :samp:`config.host` file contains specific rules for particular systems
58 which GCC will run on. This is rarely needed.
59
60 The :samp:`config.gcc` file contains specific rules for particular systems
61 which GCC will generate code for. This is usually needed.
62
63 Each file has a list of the shell variables it sets, with descriptions, at the
64 top of the file.
65
66 .. todo:: document the contents of these files, and what variables should
67 be set to control build, host and target configuration.
68
69 .. _configuration-files:
70
71 Files Created by configure
72 ~~~~~~~~~~~~~~~~~~~~~~~~~~
73
74 Here we spell out what files will be set up by :samp:`configure` in the
75 :samp:`gcc` directory. Some other files are created as temporary files
76 in the configuration process, and are not used in the subsequent
77 build; these are not documented.
78
79 * :samp:`Makefile` is constructed from :samp:`Makefile.in`, together with
80 the host and target fragments (see :ref:`fragments`) :samp:`t-{target}` and :samp:`x-{host}` from
81 :samp:`config`, if any, and language Makefile fragments
82 :samp:`{language}/Make-lang.in`.
83
84 * :samp:`auto-host.h` contains information about the host machine
85 determined by :samp:`configure`. If the host machine is different from
86 the build machine, then :samp:`auto-build.h` is also created,
87 containing such information about the build machine.
88
89 * :samp:`config.status` is a script that may be run to recreate the
90 current configuration.
91
92 * :samp:`configargs.h` is a header containing details of the arguments
93 passed to :samp:`configure` to configure GCC, and of the thread model
94 used.
95
96 * :samp:`cstamp-h` is used as a timestamp.
97
98 * If a language :samp:`config-lang.in` file (see :ref:`front-end-config`) sets ``outputs``, then
99 the files listed in ``outputs`` there are also generated.
100
101 The following configuration headers are created from the Makefile,
102 using :samp:`mkconfig.sh`, rather than directly by :samp:`configure`.
103 :samp:`config.h`, :samp:`bconfig.h` and :samp:`tconfig.h` all contain the
104 :samp:`xm-{machine}.h` header, if any, appropriate to the host,
105 build and target machines respectively, the configuration headers for
106 the target, and some definitions; for the host and build machines,
107 these include the autoconfigured headers generated by
108 :samp:`configure`. The other configuration headers are determined by
109 :samp:`config.gcc`. They also contain the typedefs for ``rtx``,
110 ``rtvec`` and ``tree``.
111
112 * :samp:`config.h`, for use in programs that run on the host machine.
113
114 * :samp:`bconfig.h`, for use in programs that run on the build machine.
115
116 * :samp:`tconfig.h`, for use in programs and libraries for the target
117 machine.
118
119 * :samp:`tm_p.h`, which includes the header :samp:`{machine}-protos.h`
120 that contains prototypes for functions in the target
121 :samp:`{machine}.c` file. The
122 :samp:`{machine}-protos.h` header is included after the :samp:`rtl.h`
123 and/or :samp:`tree.h` would have been included.
124 The :samp:`tm_p.h` also
125 includes the header :samp:`tm-preds.h` which is generated by
126 :samp:`genpreds` program during the build to define the declarations
127 and inline functions for the predicate functions.