pub struct Config { /* private fields */ }
Expand description

Builder style configuration for a pending autotools build.

Note

Note that host and target have different meanings for Rust than for Gnu autotools. For Rust, the “host” machine is the one where the compiler is running, and the “target” machine is the one where the compiled artifact (library or binary) will be executed. For Gnu autotools, the machine where the compiler is running is called the “build” machine; the one where the compiled artifact will be executed is called the “host” machine; and if the compiled artifact happens to be a cross-compiler, it will generate code for a “target” machine; otherwise “target” will coincide with “host”.

Hence Rust’s host corresponds to Gnu autotools’ “build” and Rust’s target corresponds to their “host” (though the relevant names will sometimes differ slightly).

The host and target methods on this package’s autotools::Config structure (as well as the $HOST and $TARGET variables set by cargo) are understood with their Rust meaning.

When cross-compiling, we try to calculate automatically what Gnu autotools will expect for its “host” value, and supply that to the configure script using a --host="..." argument. If the auto-calculation is incorrect, you can override it with the config_option method, like this:

use autotools;

// Builds the project in the directory located in `libfoo`, installing it
// into $OUT_DIR
let mut cfg = autotools::Config::new("libfoo_source_directory");
cfg.config_option("host", Some("i686-pc-windows-gnu"));
let dst = cfg.build();

println!("cargo:rustc-link-search=native={}", dst.display());
println!("cargo:rustc-link-lib=static=foo");

Implementations

Creates a new blank set of configuration to build the project specified at the path path.

Enables building as a shared library (--enable-shared).

Disables building as a shared library (--disable-shared).

Enables building as a static library (--enable-static).

Disables building as a static library (--disable-static).

Additional arguments to pass through to make.

Passes --<opt><=optarg> to configure.

Passes --enable-<opt><=optarg> to configure.

Passes --disable-<opt><=optarg> to configure.

Passes --with-<opt><=optarg> to configure.

Passes --without-<opt><=optarg> to configure.

Adds a custom flag to pass down to the C compiler, supplementing those that this library already passes.

Default flags for the chosen compiler have lowest priority, then any flags from the environment variable $CFLAGS, then any flags specified with this method.

Adds a custom flag to pass down to the C++ compiler, supplementing those that this library already passes.

Default flags for the chosen compiler have lowest priority, then any flags from the environment variable $CXXFLAGS, then any flags specified with this method.

Adds a custom flag to pass down to the linker, supplementing those that this library already passes.

Flags from the environment variable $LDFLAGS have lowest priority, then any flags specified with this method.

Sets the target triple for this compilation.

This is automatically scraped from $TARGET which is set for Cargo build scripts so it’s not necessary to call this from a build script.

See Note on the differences between Rust’s and autotools’ interpretation of “target” (this method assumes the former).

Sets the host triple for this compilation.

This is automatically scraped from $HOST which is set for Cargo build scripts so it’s not necessary to call this from a build script.

See Note on the differences between Rust’s and autotools’ interpretation of “host” (this method assumes the former).

Sets the output directory for this compilation.

This is automatically scraped from $OUT_DIR which is set for Cargo build scripts so it’s not necessary to call this from a build script.

Configure an environment variable for the configure && make processes spawned by this crate in the build step.

If you want to set $CFLAGS, $CXXFLAGS, or $LDFLAGS, consider using the cflag, cxxflag, or ldflag methods instead, which will append to any external values. Setting those environment variables here will overwrite the external values, and will also discard any flags determined by the chosen compiler.

autotools::Config will automatically pass $CC and $CXX values to the configure script based on the chosen compiler. Setting those variables here will override, and interferes with other parts of this library, so is not recommended.

Options to pass through to autoreconf prior to configuring the build.

Build the given make target.

If this function is not called, the build will default to make install.

Build the library in-source.

This is generally not recommended, but can be required for libraries that make extensive use of nested Makefiles, which cannot be included in out-of-source builds.

Forbid an argument from being added to the configure command.

This can be used to account for non-standard configure scripts.

Enable fast building (which skips over configure if there is no) change in the configuration parameters.

Run this configuration, compiling the library with all the configured options.

This will run both the build system generator command as well as the command to build the library.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.