@@ -15,6 +15,8 @@ const ALLOWED_CFGS: &[&str] = &[
1515 "freebsd15" ,
1616 // Corresponds to `_FILE_OFFSET_BITS=64` in glibc
1717 "gnu_file_offset_bits64" ,
18+ // Corresponds to `_TIME_BITS=64` in glibc
19+ "gnu_time_bits64" ,
1820 // FIXME(ctest): this config shouldn't be needed but ctest can't parse `const extern fn`
1921 "libc_const_extern_fn" ,
2022 "libc_deny_warnings" ,
@@ -91,23 +93,35 @@ fn main() {
9193 set_cfg ( "linux_time_bits64" ) ;
9294 }
9395 println ! ( "cargo:rerun-if-env-changed=RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS" ) ;
94- match env:: var ( "RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS" ) {
95- Ok ( val) if val == "64" => {
96- if target_env == "gnu"
97- && target_os == "linux"
98- && target_ptr_width == "32"
99- && target_arch != "riscv32"
100- && target_arch != "x86_64"
101- {
96+ println ! ( "cargo:rerun-if-env-changed=RUST_LIBC_UNSTABLE_GNU_TIME_BITS" ) ;
97+ if target_env == "gnu"
98+ && target_os == "linux"
99+ && target_ptr_width == "32"
100+ && target_arch != "riscv32"
101+ && target_arch != "x86_64"
102+ {
103+ match env:: var ( "RUST_LIBC_UNSTABLE_GNU_TIME_BITS" ) {
104+ Ok ( val) if val == "64" => {
102105 set_cfg ( "gnu_file_offset_bits64" ) ;
106+ set_cfg ( "linux_time_bits64" ) ;
107+ set_cfg ( "gnu_time_bits64" ) ;
108+ }
109+ Ok ( val) if val != "32" => {
110+ panic ! ( "RUST_LIBC_UNSTABLE_GNU_TIME_BITS may only be set to '32' or '64'" )
111+ }
112+ _ => {
113+ match env:: var ( "RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS" ) {
114+ Ok ( val) if val == "64" => {
115+ set_cfg ( "gnu_file_offset_bits64" ) ;
116+ }
117+ Ok ( val) if val != "32" => {
118+ panic ! ( "RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS may only be set to '32' or '64'" )
119+ }
120+ _ => { }
121+ }
103122 }
104123 }
105- Ok ( val) if val != "32" => {
106- panic ! ( "RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS may only be set to '32' or '64'" )
107- }
108- _ => { }
109124 }
110-
111125 // On CI: deny all warnings
112126 if libc_ci {
113127 set_cfg ( "libc_deny_warnings" ) ;
0 commit comments