@@ -14,12 +14,9 @@ fn main() {
14
14
configure_check_cfg ( ) ;
15
15
configure_f16_f128 ( & target) ;
16
16
17
- println ! ( "cargo:compiler-rt={}" , cwd . join ( "compiler-rt" ) . display ( ) ) ;
17
+ configure_libm ( & target ) ;
18
18
19
- // Activate libm's unstable features to make full use of Nightly.
20
- println ! ( "cargo::rustc-check-cfg=cfg(feature, values(\" unstable\" , \" force-soft-floats\" ))" ) ;
21
- println ! ( "cargo:rustc-cfg=feature=\" unstable\" " ) ;
22
- println ! ( "cargo:rustc-cfg=feature=\" force-soft-floats\" " ) ;
19
+ println ! ( "cargo:compiler-rt={}" , cwd. join( "compiler-rt" ) . display( ) ) ;
23
20
24
21
// Emscripten's runtime includes all the builtins
25
22
if target. os == "emscripten" {
@@ -104,6 +101,48 @@ fn main() {
104
101
}
105
102
}
106
103
104
+ /// Run configuration for `libm` since it is included directly.
105
+ ///
106
+ /// Much of this is copied from `libm/configure.rs`.
107
+ fn configure_libm ( target : & Target ) {
108
+ println ! ( "cargo:rustc-check-cfg=cfg(intrinsics_enabled)" ) ;
109
+ println ! ( "cargo:rustc-check-cfg=cfg(arch_enabled)" ) ;
110
+ println ! ( "cargo:rustc-check-cfg=cfg(optimizations_enabled)" ) ;
111
+ println ! ( "cargo:rustc-check-cfg=cfg(feature, values(\" unstable-public-internals\" ))" ) ;
112
+
113
+ // Always use intrinsics
114
+ println ! ( "cargo:rustc-cfg=intrinsics_enabled" ) ;
115
+
116
+ // The arch module may contain assembly.
117
+ if cfg ! ( feature = "no-asm" ) {
118
+ println ! ( "cargo:rustc-cfg=feature=\" force-soft-floats\" " ) ;
119
+ } else {
120
+ println ! ( "cargo:rustc-cfg=arch_enabled" ) ;
121
+ }
122
+
123
+ println ! ( "cargo:rustc-check-cfg=cfg(optimizations_enabled)" ) ;
124
+ if target. opt_level >= 2 {
125
+ println ! ( "cargo:rustc-cfg=optimizations_enabled" ) ;
126
+ }
127
+
128
+ // Config shorthands
129
+ println ! ( "cargo:rustc-check-cfg=cfg(x86_no_sse)" ) ;
130
+ if target. arch == "x86" && !target. features . iter ( ) . any ( |f| f == "sse" ) {
131
+ // Shorthand to detect i586 targets
132
+ println ! ( "cargo:rustc-cfg=x86_no_sse" ) ;
133
+ }
134
+
135
+ println ! (
136
+ "cargo:rustc-env=CFG_CARGO_FEATURES={:?}" ,
137
+ target. cargo_features
138
+ ) ;
139
+ println ! ( "cargo:rustc-env=CFG_OPT_LEVEL={}" , target. opt_level) ;
140
+ println ! ( "cargo:rustc-env=CFG_TARGET_FEATURES={:?}" , target. features) ;
141
+
142
+ // Activate libm's unstable features to make full use of Nightly.
143
+ println ! ( "cargo:rustc-cfg=feature=\" unstable-intrinsics\" " ) ;
144
+ }
145
+
107
146
fn aarch64_symbol ( ordering : Ordering ) -> & ' static str {
108
147
match ordering {
109
148
Ordering :: Relaxed => "relax" ,
0 commit comments