@@ -14,12 +14,9 @@ fn main() {
1414 configure_check_cfg ( ) ;
1515 configure_f16_f128 ( & target) ;
1616
17- println ! ( "cargo:compiler-rt={}" , cwd . join ( "compiler-rt" ) . display ( ) ) ;
17+ configure_libm ( & target ) ;
1818
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( ) ) ;
2320
2421 // Emscripten's runtime includes all the builtins
2522 if target. os == "emscripten" {
@@ -104,6 +101,47 @@ fn main() {
104101 }
105102}
106103
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-cfg=intrinsics_enabled" ) ;
109+ println ! ( "cargo:rustc-cfg=arch_enabled" ) ;
110+ println ! ( "cargo:rustc-cfg=optimizations_enabled" ) ;
111+
112+ // Always use intrinsics
113+ println ! ( "cargo:rustc-cfg=intrinsics_enabled" ) ;
114+
115+ //
116+ if cfg ! ( feature = "no-asm" ) {
117+ println ! ( "cargo:rustc-cfg=feature=\" force-soft-floats\" " ) ;
118+ } else {
119+ println ! ( "cargo:rustc-cfg=arch_enabled" ) ;
120+ }
121+
122+ println ! ( "cargo:rustc-check-cfg=cfg(optimizations_enabled)" ) ;
123+ if target. opt_level >= 2 {
124+ println ! ( "cargo:rustc-cfg=optimizations_enabled" ) ;
125+ }
126+
127+ // Config shorthands
128+ println ! ( "cargo:rustc-check-cfg=cfg(x86_no_sse)" ) ;
129+ if target. arch == "x86" && !target. features . iter ( ) . any ( |f| f == "sse" ) {
130+ // Shorthand to detect i586 targets
131+ println ! ( "cargo:rustc-cfg=x86_no_sse" ) ;
132+ }
133+
134+ println ! (
135+ "cargo:rustc-env=CFG_CARGO_FEATURES={:?}" ,
136+ target. cargo_features
137+ ) ;
138+ println ! ( "cargo:rustc-env=CFG_OPT_LEVEL={}" , target. opt_level) ;
139+ println ! ( "cargo:rustc-env=CFG_TARGET_FEATURES={:?}" , target. features) ;
140+
141+ // Activate libm's unstable features to make full use of Nightly.
142+ println ! ( "cargo:rustc-cfg=feature=\" unstable-intrinsics\" " ) ;
143+ }
144+
107145fn aarch64_symbol ( ordering : Ordering ) -> & ' static str {
108146 match ordering {
109147 Ordering :: Relaxed => "relax" ,
0 commit comments