@@ -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" ,
@@ -99,23 +101,35 @@ fn main() {
99101 set_cfg ( "linux_time_bits64" ) ;
100102 }
101103 println ! ( "cargo:rerun-if-env-changed=RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS" ) ;
102- match env:: var ( "RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS" ) {
103- Ok ( val) if val == "64" => {
104- if target_env == "gnu"
105- && target_os == "linux"
106- && target_ptr_width == "32"
107- && target_arch != "riscv32"
108- && target_arch != "x86_64"
109- {
104+ println ! ( "cargo:rerun-if-env-changed=RUST_LIBC_UNSTABLE_GNU_TIME_BITS" ) ;
105+ if target_env == "gnu"
106+ && target_os == "linux"
107+ && target_ptr_width == "32"
108+ && target_arch != "riscv32"
109+ && target_arch != "x86_64"
110+ {
111+ match env:: var ( "RUST_LIBC_UNSTABLE_GNU_TIME_BITS" ) {
112+ Ok ( val) if val == "64" => {
110113 set_cfg ( "gnu_file_offset_bits64" ) ;
114+ set_cfg ( "linux_time_bits64" ) ;
115+ set_cfg ( "gnu_time_bits64" ) ;
116+ }
117+ Ok ( val) if val != "32" => {
118+ panic ! ( "RUST_LIBC_UNSTABLE_GNU_TIME_BITS may only be set to '32' or '64'" )
119+ }
120+ _ => {
121+ match env:: var ( "RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS" ) {
122+ Ok ( val) if val == "64" => {
123+ set_cfg ( "gnu_file_offset_bits64" ) ;
124+ }
125+ Ok ( val) if val != "32" => {
126+ panic ! ( "RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS may only be set to '32' or '64'" )
127+ }
128+ _ => { }
129+ }
111130 }
112131 }
113- Ok ( val) if val != "32" => {
114- panic ! ( "RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS may only be set to '32' or '64'" )
115- }
116- _ => { }
117132 }
118-
119133 // On CI: deny all warnings
120134 if libc_ci {
121135 set_cfg ( "libc_deny_warnings" ) ;
0 commit comments