Configuration in the gcc Directory#

The gcc directory is configured with an Autoconf-generated script configure. The configure script is generated from configure.ac and aclocal.m4. From the files configure.ac and acconfig.h, Autoheader generates the file config.in. The file cstamp-h.in is used as a timestamp.

Scripts Used by configure#

configure uses some other scripts to help in its work:

  • The standard GNU config.sub and config.guess files, kept in the top level directory, are used.

  • The file config.gcc is used to handle configuration specific to the particular target machine. The file config.build is used to handle configuration specific to the particular build machine. The file config.host is used to handle configuration specific to the particular host machine. (In general, these should only be used for features that cannot reasonably be tested in Autoconf feature tests.) See The config.build; config.host; and config.gcc Files, for details of the contents of these files.

  • Each language subdirectory has a file language/config-lang.in that is used for front-end-specific configuration. See The Front End config-lang.in File, for details of this file.

  • A helper script configure.frag is used as part of creating the output of configure.

The config.build; config.host; and config.gcc Files#

The config.build file contains specific rules for particular systems which GCC is built on. This should be used as rarely as possible, as the behavior of the build system can always be detected by autoconf.

The config.host file contains specific rules for particular systems which GCC will run on. This is rarely needed.

The config.gcc file contains specific rules for particular systems which GCC will generate code for. This is usually needed.

Each file has a list of the shell variables it sets, with descriptions, at the top of the file.

Todo

document the contents of these files, and what variables should be set to control build, host and target configuration.

Files Created by configure#

Here we spell out what files will be set up by configure in the gcc directory. Some other files are created as temporary files in the configuration process, and are not used in the subsequent build; these are not documented.

  • Makefile is constructed from Makefile.in, together with the host and target fragments (see Makefile Fragments) t-target and x-host from config, if any, and language Makefile fragments language/Make-lang.in.

  • auto-host.h contains information about the host machine determined by configure. If the host machine is different from the build machine, then auto-build.h is also created, containing such information about the build machine.

  • config.status is a script that may be run to recreate the current configuration.

  • configargs.h is a header containing details of the arguments passed to configure to configure GCC, and of the thread model used.

  • cstamp-h is used as a timestamp.

  • If a language config-lang.in file (see The Front End config-lang.in File) sets outputs, then the files listed in outputs there are also generated.

The following configuration headers are created from the Makefile, using mkconfig.sh, rather than directly by configure. config.h, bconfig.h and tconfig.h all contain the xm-machine.h header, if any, appropriate to the host, build and target machines respectively, the configuration headers for the target, and some definitions; for the host and build machines, these include the autoconfigured headers generated by configure. The other configuration headers are determined by config.gcc. They also contain the typedefs for rtx, rtvec and tree.

  • config.h, for use in programs that run on the host machine.

  • bconfig.h, for use in programs that run on the build machine.

  • tconfig.h, for use in programs and libraries for the target machine.

  • tm_p.h, which includes the header machine-protos.h that contains prototypes for functions in the target machine.c file. The machine-protos.h header is included after the rtl.h and/or tree.h would have been included. The tm_p.h also includes the header tm-preds.h which is generated by genpreds program during the build to define the declarations and inline functions for the predicate functions.