• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

examples/H03-May-2022-7040

src/H03-May-2022-598383

tests/H03-May-2022-149

.cargo-checksum.jsonH A D03-May-202289 11

.cargo_vcs_info.jsonH A D01-Jan-197074 65

.gitignoreH A D24-Aug-201931 53

.travis.ymlH A D20-Oct-2019810 4138

Cargo.lockH A D01-Jan-1970139 75

Cargo.tomlH A D01-Jan-1970876 2522

Cargo.toml.orig-cargoH A D20-Oct-2019351 1311

LICENSE-APACHEH A D24-Aug-201910.6 KiB202169

LICENSE-MITH A D24-Aug-20191 KiB2622

README.mdH A D20-Oct-20192.5 KiB8557

README.md

1autocfg
2=======
3
4[![autocfg crate](https://img.shields.io/crates/v/autocfg.svg)](https://crates.io/crates/autocfg)
5[![autocfg documentation](https://docs.rs/autocfg/badge.svg)](https://docs.rs/autocfg)
6![minimum rustc 1.0](https://img.shields.io/badge/rustc-1.0+-red.svg)
7[![Travis Status](https://travis-ci.org/cuviper/autocfg.svg?branch=master)](https://travis-ci.org/cuviper/autocfg)
8
9A Rust library for build scripts to automatically configure code based on
10compiler support.  Code snippets are dynamically tested to see if the `rustc`
11will accept them, rather than hard-coding specific version support.
12
13
14## Usage
15
16Add this to your `Cargo.toml`:
17
18```toml
19[build-dependencies]
20autocfg = "0.1"
21```
22
23Then use it in your `build.rs` script to detect compiler features.  For
24example, to test for 128-bit integer support, it might look like:
25
26```rust
27extern crate autocfg;
28
29fn main() {
30    let ac = autocfg::new();
31    ac.emit_has_type("i128");
32
33    // (optional) We don't need to rerun for anything external.
34    autocfg::rerun_path(file!());
35}
36```
37
38If the type test succeeds, this will write a `cargo:rustc-cfg=has_i128` line
39for Cargo, which translates to Rust arguments `--cfg has_i128`.  Then in the
40rest of your Rust code, you can add `#[cfg(has_i128)]` conditions on code that
41should only be used when the compiler supports it.
42
43
44## Release Notes
45
46- 0.1.7 (2019-10-20)
47  - Apply `RUSTFLAGS` when probing `$TARGET != $HOST`, mainly for sysroot, by @roblabla.
48
49- 0.1.6 (2019-08-19)
50  - Add `probe`/`emit_sysroot_crate`, by @leo60228.
51
52- 0.1.5 (2019-07-16)
53  - Mask some warnings from newer rustc.
54
55- 0.1.4 (2019-05-22)
56  - Relax `std`/`no_std` probing to a warning instead of an error.
57  - Improve `rustc` bootstrap compatibility.
58
59- 0.1.3 (2019-05-21)
60  - Auto-detects if `#![no_std]` is needed for the `$TARGET`.
61
62- 0.1.2 (2019-01-16)
63  - Add `rerun_env(ENV)` to print `cargo:rerun-if-env-changed=ENV`.
64  - Add `rerun_path(PATH)` to print `cargo:rerun-if-changed=PATH`.
65
66
67## Minimum Rust version policy
68
69This crate's minimum supported `rustc` version is `1.0.0`.  Compatibility is
70its entire reason for existence, so this crate will be extremely conservative
71about raising this requirement.  If this is ever deemed necessary, it will be
72treated as a major breaking change for semver purposes.
73
74
75## License
76
77This project is licensed under either of
78
79 * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
80   http://www.apache.org/licenses/LICENSE-2.0)
81 * MIT license ([LICENSE-MIT](LICENSE-MIT) or
82   http://opensource.org/licenses/MIT)
83
84at your option.
85