Skip to content

Commit

Permalink
Detect FreeBSD 14
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnTitor committed Nov 17, 2021
1 parent 1f3e2ab commit 74faaa3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions build.rs
Expand Up @@ -31,6 +31,7 @@ fn main() {
Some(11) if libc_ci => println!("cargo:rustc-cfg=freebsd11"),
Some(12) if libc_ci => println!("cargo:rustc-cfg=freebsd12"),
Some(13) if libc_ci => println!("cargo:rustc-cfg=freebsd13"),
Some(14) if libc_ci => println!("cargo:rustc-cfg=freebsd14"),
Some(_) | None => println!("cargo:rustc-cfg=freebsd11"),
}

Expand Down Expand Up @@ -150,6 +151,7 @@ fn which_freebsd() -> Option<i32> {
s if s.starts_with("11") => Some(11),
s if s.starts_with("12") => Some(12),
s if s.starts_with("13") => Some(13),
s if s.starts_with("14") => Some(14),
_ => None,
}
}
6 changes: 6 additions & 0 deletions libc-test/build.rs
Expand Up @@ -1756,6 +1756,7 @@ fn test_freebsd(target: &str) {
Some(11) => cfg.cfg("freebsd11", None),
Some(12) => cfg.cfg("freebsd12", None),
Some(13) => cfg.cfg("freebsd13", None),
Some(14) => cfg.cfg("freebsd14", None),
_ => &mut cfg,
};

Expand All @@ -1777,6 +1778,11 @@ fn test_freebsd(target: &str) {
_ => false,
};

let freebsd14 = match freebsd_ver {
Some(n) if n >= 14 => true,
_ => false,
};

headers! { cfg:
"aio.h",
"arpa/inet.h",
Expand Down
2 changes: 1 addition & 1 deletion src/unix/bsd/freebsdlike/freebsd/mod.rs
Expand Up @@ -2624,7 +2624,7 @@ extern "C" {
}

cfg_if! {
if #[cfg(freebsd13)] {
if #[cfg(any(freebsd13, freebsd14))] {
mod freebsd13;
pub use self::freebsd13::*;
} else if #[cfg(freebsd12)] {
Expand Down

0 comments on commit 74faaa3

Please sign in to comment.