The GNU Radio Build Configuration System

The GNU Radio source code build system uses the standard method:

$ ./configure

$ make
$ sudo make install

or using an alternate build directory:

$ mkdir build
$ cd build
$ ../configure
$ make
$ sudo make install

to build and install the software. This is a sufficient starting point for most users.


GNU Radio consists of a set of component libraries, simply called "components" in what follows.

Each component lives in a separate directory off the source code tree root, and has a set of prerequisites for which the 'configure' script tests. Depending on the outcome of these configuration checks, the build system either selects or deselects individual components to build, test, and install. The default behavior is to perform all configuration tests, build all components that pass, and ignore the ones that don't.

Some users may wish to have finer control over what gets built and what does not, and the build system provides a facility to accomplish that. The build system also allows for incremental installation of individual components.

Build System Configuration Options

Three options exist for each component in the GNU Radio source code tree:

--enable-foo
--disable-foo
--with-foo[=arg]

where *foo* is the directory name of the component to be affected, and for the last option *arg* is the full path to the pkg-config file for foo ('foo.pc').


There are also:

--enable-all-components
--disable-all-components

These apply to all components in the tree that are not further specified on the configure script command line.

Default Behavior

Controlling individual components using --enable-foo, --disable-foo, and --with-foo[=arg]

Specifying --enable-foo causes the build system to consider it an error if configuration checks fail for the *foo* component, and exit with an error when that happens ('error out'). This option is suitable for ensuring that a particular component gets built and installed, or for understanding why configure errored out when the checks fail.

Specifying --disable-foo prevents that component from being built or installed even if its configuration checks pass. This option is suitable for components that you're not interested in or you know ahead of time won't pass configuration checks.

Specifying --enable-all-components or --disable-all-components applies the above behavior to everything that isn't otherwise specified later in the command line.

Specifying --with-foo causes the build system to look for the pkg-config file, using the provided PKG_CONFIG_PATH environment variable, for *foo* as evidence that the component *foo* is already installed. If *foo* is not already installed, the an error will be printed and configuration will stop. Significant efforts have been made to ensure that if --with-foo is specified, and *foo* is installed, then the paths to *foo*'s libraries and header files will not interfere with those from the --enable'd components.

Speficying --with-foo=arg is the same as --with-foo, except that component *foo* is searched for solely using PKG_CONFIG_PATH=arg.

NOTE: Specifying both --enable-foo and --with-foo will result in an error.

NOTE: When using --with-foo[=arg] : Because the build system uses pkg-config to locate components, PKG_CONFIG_PATH must include the full path (e.g. "/opt/local/lib/pkgconfig") of those packages unless they are installed in the --prefix provided to configure since that path is internally prepended to PKG_CONFIG_PATH.

WARNING: It is possible to install components into different --prefix's, and thus to include them as pre-installed using the --with option. The build system will use the first found pkg-config file for any given pre-installed and --with included component.

Common Use Cases

Default Behavior:

$ ./configure

Select for build and installation everything that passes configuration checks.


Checking for Everything:


$ ./configure --enable-all-components


Select everything for build and installation, except exit with an error message if any configuration check doesn't pass. This will likely fail for everyone because some platform-specific configuration checks are mutually exclusive (such as the various audio modules for different systems).


Selective Build:

$ ./configure --enable-all-components \
--disable-foo1 \
--disable-foo2

where *foo1* and *foo2* are components that will fail and you don't care about, or that you don't want to build regardless. Otherwise you want the build to fail if anything else fails configuration checks. For example, on a Linux system that otherwise has all the build dependent libraries installed:

$ ./configure --enable-all-components \
--disable-gr-audio-osx \
--disable-gr-audio-windows \
--disable-gr-audio-oss

will ignore the non-Linux platform modules as well as the OSS audio stuff (which would otherwise compile ok).


Build Using Pre-Installed Components:

$ ./configure --disable-all-components \
--enable-foo1 \
--with-foo2

will try to build component *foo1* using just the already-installed library and header files for component *foo2* as found by pkg-config in the provided PKG_CONFIG_PATH.


Build Using Pre-Installed Components at a Specific Location:


$ ./configure --disable-all-components \
--enable-foo1 \
--with-foo2=bar

will try to build component *foo1* using just the already-installed library and header files for component *foo2* as found by pkg-config in PKG_CONFIG_PATH=bar.

"Minimal" Component Builds

To select a single component to build and install, use:

$ ./configure --disable-all-components \

--enable-foo

where *foo* is a single component directory. This will cause the build to fail if *foo* doesn't pass configuration checks, and ignore any other packages.


WARNING:
Individual GNU Radio components generally depend upon other components (such as *gnuradio-core*) to successfully compile. When using --disable-all-components, each component dependency must be specified via an --enable or --with option. The build system will produce an error if dependencies are not met, and most likely that component build will be skipped.

For example, component *gr-usrp* depends on components *usrp* and *gnuradio-core*. The former depends on components *omnithread*, *mblock*, and *pmt*. The latter depends on the component *omnithread*, which is redundant with the *usrp*'s dependencies. Hence, from a fresh source code build with nothing already installed, one would need to use the following command line in order to try to build *gr-usrp*:

$ ./configure --disable-all-components \
--enable-gr-usrp \
--enable-gnuradio-core \
--enable-usrp \
--enable-pmt \
--enable-mblock \
--enable-omnithread



The order of these on the configure command line is not important; the build system knows the proper order in which to build them.


As another example, suppose that components *usrp* (and its dependents) are already installed, via the commands:

$ ./configure --disable-all-components \
--enable-usrp \
--enable-pmt \
--enable-mblock \
--enable-omnithread
$ make
$ sudo make install

Then one could use those pre-installed components and build *gr-usrp* via the command:

$ ./configure --disable-all-components \
--enable-gr-usrp
--enable-gnuradio-core \
--with-usrp \
--with-pmt \
--with-mblock \
--with-omnithread

Making Distribution Tarballs

Regardless of what gets enabled, disabled, or included via --with-foo[=arg], the 'make dist' and 'make distcheck' operations will create a source distribution tarball of the entire collection of components.







注: The GNU Radio Build Configuration System(原文出处,翻译整理仅供者参考!)