about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog183
-rw-r--r--math/lgamma-compat.h3
-rw-r--r--math/w_acos_compat.c4
-rw-r--r--math/w_acosf_compat.c2
-rw-r--r--math/w_acosh_compat.c4
-rw-r--r--math/w_acoshf_compat.c2
-rw-r--r--math/w_acoshl_compat.c2
-rw-r--r--math/w_acosl_compat.c2
-rw-r--r--math/w_asin_compat.c4
-rw-r--r--math/w_asinf_compat.c2
-rw-r--r--math/w_asinl_compat.c2
-rw-r--r--math/w_atan2_compat.c4
-rw-r--r--math/w_atan2f_compat.c2
-rw-r--r--math/w_atan2l_compat.c2
-rw-r--r--math/w_atanh_compat.c4
-rw-r--r--math/w_atanhf_compat.c2
-rw-r--r--math/w_atanhl_compat.c2
-rw-r--r--math/w_cosh_compat.c4
-rw-r--r--math/w_coshf_compat.c2
-rw-r--r--math/w_coshl_compat.c2
-rw-r--r--math/w_exp10_compat.c10
-rw-r--r--math/w_exp10f_compat.c4
-rw-r--r--math/w_exp10l_compat.c4
-rw-r--r--math/w_exp2_compat.c4
-rw-r--r--math/w_exp2f_compat.c2
-rw-r--r--math/w_exp2l_compat.c2
-rw-r--r--math/w_fmod_compat.c4
-rw-r--r--math/w_fmodf_compat.c2
-rw-r--r--math/w_fmodl_compat.c2
-rw-r--r--math/w_hypot_compat.c4
-rw-r--r--math/w_hypotf_compat.c2
-rw-r--r--math/w_hypotl_compat.c2
-rw-r--r--math/w_j0_compat.c8
-rw-r--r--math/w_j0f_compat.c2
-rw-r--r--math/w_j0l_compat.c2
-rw-r--r--math/w_j1_compat.c8
-rw-r--r--math/w_j1f_compat.c2
-rw-r--r--math/w_j1l_compat.c2
-rw-r--r--math/w_jn_compat.c8
-rw-r--r--math/w_jnf_compat.c2
-rw-r--r--math/w_jnl_compat.c14
-rw-r--r--math/w_lgamma_r_compat.c4
-rw-r--r--math/w_lgammaf_r_compat.c2
-rw-r--r--math/w_lgammal_r_compat.c2
-rw-r--r--math/w_log10_compat.c4
-rw-r--r--math/w_log10f_compat.c2
-rw-r--r--math/w_log10l_compat.c2
-rw-r--r--math/w_log2_compat.c4
-rw-r--r--math/w_log2f_compat.c2
-rw-r--r--math/w_log2l_compat.c2
-rw-r--r--math/w_log_compat.c4
-rw-r--r--math/w_logf_compat.c2
-rw-r--r--math/w_logl_compat.c2
-rw-r--r--math/w_pow_compat.c4
-rw-r--r--math/w_powf_compat.c2
-rw-r--r--math/w_powl_compat.c2
-rw-r--r--math/w_remainder_compat.c4
-rw-r--r--math/w_remainderf_compat.c2
-rw-r--r--math/w_remainderl_compat.c2
-rw-r--r--math/w_scalb_compat.c4
-rw-r--r--math/w_scalbf_compat.c4
-rw-r--r--math/w_scalbl_compat.c4
-rw-r--r--math/w_sinh_compat.c4
-rw-r--r--math/w_sinhf_compat.c2
-rw-r--r--math/w_sinhl_compat.c2
-rw-r--r--math/w_sqrt_compat.c4
-rw-r--r--math/w_sqrtf_compat.c2
-rw-r--r--math/w_sqrtl_compat.c2
-rw-r--r--math/w_tgamma_compat.c4
-rw-r--r--math/w_tgammaf_compat.c2
-rw-r--r--math/w_tgammal_compat.c2
-rw-r--r--sysdeps/generic/math-type-macros-double.h6
-rw-r--r--sysdeps/generic/math-type-macros-float.h6
-rw-r--r--sysdeps/generic/math-type-macros-ldouble.h6
-rw-r--r--sysdeps/i386/fpu/w_sqrt.c9
-rw-r--r--sysdeps/ia64/fpu/w_acos.c1
-rw-r--r--sysdeps/ia64/fpu/w_acosf.c1
-rw-r--r--sysdeps/ia64/fpu/w_acosh.c1
-rw-r--r--sysdeps/ia64/fpu/w_acoshf.c1
-rw-r--r--sysdeps/ia64/fpu/w_acoshl.c1
-rw-r--r--sysdeps/ia64/fpu/w_acosl.c1
-rw-r--r--sysdeps/ia64/fpu/w_asin.c1
-rw-r--r--sysdeps/ia64/fpu/w_asinf.c1
-rw-r--r--sysdeps/ia64/fpu/w_asinl.c1
-rw-r--r--sysdeps/ia64/fpu/w_atan2.c1
-rw-r--r--sysdeps/ia64/fpu/w_atan2f.c1
-rw-r--r--sysdeps/ia64/fpu/w_atan2l.c1
-rw-r--r--sysdeps/ia64/fpu/w_atanh.c1
-rw-r--r--sysdeps/ia64/fpu/w_atanhf.c1
-rw-r--r--sysdeps/ia64/fpu/w_atanhl.c1
-rw-r--r--sysdeps/ia64/fpu/w_cosh.c1
-rw-r--r--sysdeps/ia64/fpu/w_coshf.c1
-rw-r--r--sysdeps/ia64/fpu/w_coshl.c1
-rw-r--r--sysdeps/ia64/fpu/w_exp.c1
-rw-r--r--sysdeps/ia64/fpu/w_exp10.c1
-rw-r--r--sysdeps/ia64/fpu/w_exp10f.c1
-rw-r--r--sysdeps/ia64/fpu/w_exp10l.c1
-rw-r--r--sysdeps/ia64/fpu/w_exp2.c1
-rw-r--r--sysdeps/ia64/fpu/w_exp2f.c1
-rw-r--r--sysdeps/ia64/fpu/w_exp2l.c1
-rw-r--r--sysdeps/ia64/fpu/w_expf.c1
-rw-r--r--sysdeps/ia64/fpu/w_expl.c1
-rw-r--r--sysdeps/ia64/fpu/w_fmod.c1
-rw-r--r--sysdeps/ia64/fpu/w_fmodf.c1
-rw-r--r--sysdeps/ia64/fpu/w_fmodl.c1
-rw-r--r--sysdeps/ia64/fpu/w_hypot.c1
-rw-r--r--sysdeps/ia64/fpu/w_hypotf.c1
-rw-r--r--sysdeps/ia64/fpu/w_hypotl.c1
-rw-r--r--sysdeps/ia64/fpu/w_lgamma_r.c1
-rw-r--r--sysdeps/ia64/fpu/w_lgammaf_r.c1
-rw-r--r--sysdeps/ia64/fpu/w_lgammal_r.c1
-rw-r--r--sysdeps/ia64/fpu/w_log.c1
-rw-r--r--sysdeps/ia64/fpu/w_log10.c1
-rw-r--r--sysdeps/ia64/fpu/w_log10f.c1
-rw-r--r--sysdeps/ia64/fpu/w_log10l.c1
-rw-r--r--sysdeps/ia64/fpu/w_log2.c1
-rw-r--r--sysdeps/ia64/fpu/w_log2f.c1
-rw-r--r--sysdeps/ia64/fpu/w_log2l.c1
-rw-r--r--sysdeps/ia64/fpu/w_logf.c1
-rw-r--r--sysdeps/ia64/fpu/w_logl.c1
-rw-r--r--sysdeps/ia64/fpu/w_pow.c1
-rw-r--r--sysdeps/ia64/fpu/w_powf.c1
-rw-r--r--sysdeps/ia64/fpu/w_powl.c1
-rw-r--r--sysdeps/ia64/fpu/w_remainder.c1
-rw-r--r--sysdeps/ia64/fpu/w_remainderf.c1
-rw-r--r--sysdeps/ia64/fpu/w_remainderl.c1
-rw-r--r--sysdeps/ia64/fpu/w_sinh.c1
-rw-r--r--sysdeps/ia64/fpu/w_sinhf.c1
-rw-r--r--sysdeps/ia64/fpu/w_sinhl.c1
-rw-r--r--sysdeps/ia64/fpu/w_sqrt.c1
-rw-r--r--sysdeps/ia64/fpu/w_sqrtf.c1
-rw-r--r--sysdeps/ia64/fpu/w_sqrtl.c1
-rw-r--r--sysdeps/ia64/fpu/w_tgamma.c1
-rw-r--r--sysdeps/ia64/fpu/w_tgammaf.c1
-rw-r--r--sysdeps/ia64/fpu/w_tgammal.c1
-rw-r--r--sysdeps/ieee754/dbl-64/w_exp_compat.c4
-rw-r--r--sysdeps/ieee754/flt-32/w_expf_compat.c2
-rw-r--r--sysdeps/ieee754/k_standard.c37
-rw-r--r--sysdeps/ieee754/k_standardf.c2
-rw-r--r--sysdeps/ieee754/k_standardl.c3
-rw-r--r--sysdeps/ieee754/ldbl-128/w_expl_compat.c8
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/w_expl_compat.c2
-rw-r--r--sysdeps/ieee754/ldbl-64-128/w_expl_compat.c2
-rw-r--r--sysdeps/ieee754/ldbl-96/w_expl_compat.c2
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_acoshl_compat.c2
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_acosl_compat.c2
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_asinl_compat.c2
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_atan2l_compat.c2
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_atanhl_compat.c2
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_coshl_compat.c2
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_exp10l_compat.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_fmodl_compat.c2
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_hypotl_compat.c2
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_j0l_compat.c2
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_j1l_compat.c2
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_jnl_compat.c2
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_lgammal_r_compat.c2
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_log10l_compat.c2
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_log2l_compat.c2
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_logl_compat.c2
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_powl_compat.c2
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_remainderl_compat.c2
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_sinhl_compat.c2
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_sqrtl_compat.c2
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_tgammal_compat.c2
165 files changed, 535 insertions, 70 deletions
diff --git a/ChangeLog b/ChangeLog
index 92110bd671..5e3bc26421 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,186 @@
+2017-09-05  Joseph Myers  <joseph@codesourcery.com>
+
+	* sysdeps/generic/math-type-macros-double.h: Include
+	<math-svid-compat.h>.
+	(__USE_WRAPPER_TEMPLATE): Define to !LIBM_SVID_COMPAT.
+	* sysdeps/generic/math-type-macros-float.h: Include
+	<math-svid-compat.h>.
+	(__USE_WRAPPER_TEMPLATE): Define to !LIBM_SVID_COMPAT.
+	* sysdeps/generic/math-type-macros-ldouble.h: Include
+	<math-svid-compat.h>.
+	(__USE_WRAPPER_TEMPLATE): Define to !LIBM_SVID_COMPAT.
+	* math/lgamma-compat.h (BUILD_LGAMMA): Include LIBM_SVID_COMPAT
+	condition.
+	* math/w_acos_compat.c: Condition contents on [LIBM_SVID_COMPAT].
+	* math/w_acosf_compat.c: Likewise.
+	* math/w_acosh_compat.c: Likewise.
+	* math/w_acoshf_compat.c: Likewise.
+	* math/w_acoshl_compat.c: Likewise.
+	* math/w_acosl_compat.c: Likewise.
+	* math/w_asin_compat.c: Likewise.
+	* math/w_asinf_compat.c: Likewise.
+	* math/w_asinl_compat.c: Likewise.
+	* math/w_atan2_compat.c: Likewise.
+	* math/w_atan2f_compat.c: Likewise.
+	* math/w_atan2l_compat.c: Likewise.
+	* math/w_atanh_compat.c: Likewise.
+	* math/w_atanhf_compat.c: Likewise.
+	* math/w_atanhl_compat.c: Likewise.
+	* math/w_cosh_compat.c: Likewise.
+	* math/w_coshf_compat.c: Likewise.
+	* math/w_coshl_compat.c: Likewise.
+	* math/w_exp10_compat.c: Likewise.
+	* math/w_exp10f_compat.c: Likewise.
+	* math/w_exp10l_compat.c: Likewise.
+	* math/w_exp2_compat.c: Likewise.
+	* math/w_exp2f_compat.c: Likewise.
+	* math/w_exp2l_compat.c: Likewise.
+	* math/w_fmod_compat.c: Likewise.
+	* math/w_fmodf_compat.c: Likewise.
+	* math/w_fmodl_compat.c: Likewise.
+	* math/w_hypot_compat.c: Likewise.
+	* math/w_hypotf_compat.c: Likewise.
+	* math/w_hypotl_compat.c: Likewise.
+	* math/w_j0_compat.c: Likewise.
+	* math/w_j0f_compat.c: Likewise.
+	* math/w_j0l_compat.c: Likewise.
+	* math/w_j1_compat.c: Likewise.
+	* math/w_j1f_compat.c: Likewise.
+	* math/w_j1l_compat.c: Likewise.
+	* math/w_jn_compat.c: Likewise.
+	* math/w_jnf_compat.c: Likewise.
+	* math/w_jnl_compat.c: Likewise.
+	* math/w_lgamma_r_compat.c: Likewise.
+	* math/w_lgammaf_r_compat.c: Likewise.
+	* math/w_lgammal_r_compat.c: Likewise.
+	* math/w_log10_compat.c: Likewise.
+	* math/w_log10f_compat.c: Likewise.
+	* math/w_log10l_compat.c: Likewise.
+	* math/w_log2_compat.c: Likewise.
+	* math/w_log2f_compat.c: Likewise.
+	* math/w_log2l_compat.c: Likewise.
+	* math/w_log_compat.c: Likewise.
+	* math/w_logf_compat.c: Likewise.
+	* math/w_logl_compat.c: Likewise.
+	* math/w_pow_compat.c: Likewise.
+	* math/w_powf_compat.c: Likewise.
+	* math/w_powl_compat.c: Likewise.
+	* math/w_remainder_compat.c: Likewise.
+	* math/w_remainderf_compat.c: Likewise.
+	* math/w_remainderl_compat.c: Likewise.
+	* math/w_sinh_compat.c: Likewise.
+	* math/w_sinhf_compat.c: Likewise.
+	* math/w_sinhl_compat.c: Likewise.
+	* math/w_sqrt_compat.c: Likewise.
+	* math/w_sqrtf_compat.c: Likewise.
+	* math/w_sqrtl_compat.c: Likewise.
+	* math/w_tgamma_compat.c: Likewise.
+	* math/w_tgammaf_compat.c: Likewise.
+	* math/w_tgammal_compat.c: Likewise.
+	* math/w_scalb_compat.c (sysv_scalb): Condition definition on
+	[LIBM_SVID_COMPAT].
+	(__scalb): Condition call to sysv_scalb on [LIBM_SVID_COMPAT].
+	* math/w_scalbf_compat.c (sysv_scalbf): Condition definition on
+	[LIBM_SVID_COMPAT].
+	(__scalbf): Condition call to sysv_scalbf on [LIBM_SVID_COMPAT].
+	* math/w_scalbl_compat.c (sysv_scalbl): Condition definition on
+	[LIBM_SVID_COMPAT].
+	(__scalbl): Condition call to sysv_scalbl on [LIBM_SVID_COMPAT].
+	* sysdeps/i386/fpu/w_sqrt.c: New file.
+	* sysdeps/ia64/fpu/w_acos.c: Likewise.
+	* sysdeps/ia64/fpu/w_acosf.c: Likewise.
+	* sysdeps/ia64/fpu/w_acosh.c: Likewise.
+	* sysdeps/ia64/fpu/w_acoshf.c: Likewise.
+	* sysdeps/ia64/fpu/w_acoshl.c: Likewise.
+	* sysdeps/ia64/fpu/w_acosl.c: Likewise.
+	* sysdeps/ia64/fpu/w_asin.c: Likewise.
+	* sysdeps/ia64/fpu/w_asinf.c: Likewise.
+	* sysdeps/ia64/fpu/w_asinl.c: Likewise.
+	* sysdeps/ia64/fpu/w_atan2.c: Likewise.
+	* sysdeps/ia64/fpu/w_atan2f.c: Likewise.
+	* sysdeps/ia64/fpu/w_atan2l.c: Likewise.
+	* sysdeps/ia64/fpu/w_atanh.c: Likewise.
+	* sysdeps/ia64/fpu/w_atanhf.c: Likewise.
+	* sysdeps/ia64/fpu/w_atanhl.c: Likewise.
+	* sysdeps/ia64/fpu/w_cosh.c: Likewise.
+	* sysdeps/ia64/fpu/w_coshf.c: Likewise.
+	* sysdeps/ia64/fpu/w_coshl.c: Likewise.
+	* sysdeps/ia64/fpu/w_exp.c: Likewise.
+	* sysdeps/ia64/fpu/w_exp10.c: Likewise.
+	* sysdeps/ia64/fpu/w_exp10f.c: Likewise.
+	* sysdeps/ia64/fpu/w_exp10l.c: Likewise.
+	* sysdeps/ia64/fpu/w_exp2.c: Likewise.
+	* sysdeps/ia64/fpu/w_exp2f.c: Likewise.
+	* sysdeps/ia64/fpu/w_exp2l.c: Likewise.
+	* sysdeps/ia64/fpu/w_expf.c: Likewise.
+	* sysdeps/ia64/fpu/w_expl.c: Likewise.
+	* sysdeps/ia64/fpu/w_fmod.c: Likewise.
+	* sysdeps/ia64/fpu/w_fmodf.c: Likewise.
+	* sysdeps/ia64/fpu/w_fmodl.c: Likewise.
+	* sysdeps/ia64/fpu/w_hypot.c: Likewise.
+	* sysdeps/ia64/fpu/w_hypotf.c: Likewise.
+	* sysdeps/ia64/fpu/w_hypotl.c: Likewise.
+	* sysdeps/ia64/fpu/w_lgamma_r.c: Likewise.
+	* sysdeps/ia64/fpu/w_lgammaf_r.c: Likewise.
+	* sysdeps/ia64/fpu/w_lgammal_r.c: Likewise.
+	* sysdeps/ia64/fpu/w_log.c: Likewise.
+	* sysdeps/ia64/fpu/w_log10.c: Likewise.
+	* sysdeps/ia64/fpu/w_log10f.c: Likewise.
+	* sysdeps/ia64/fpu/w_log10l.c: Likewise.
+	* sysdeps/ia64/fpu/w_log2.c: Likewise.
+	* sysdeps/ia64/fpu/w_log2f.c: Likewise.
+	* sysdeps/ia64/fpu/w_log2l.c: Likewise.
+	* sysdeps/ia64/fpu/w_logf.c: Likewise.
+	* sysdeps/ia64/fpu/w_logl.c: Likewise.
+	* sysdeps/ia64/fpu/w_pow.c: Likewise.
+	* sysdeps/ia64/fpu/w_powf.c: Likewise.
+	* sysdeps/ia64/fpu/w_powl.c: Likewise.
+	* sysdeps/ia64/fpu/w_remainder.c: Likewise.
+	* sysdeps/ia64/fpu/w_remainderf.c: Likewise.
+	* sysdeps/ia64/fpu/w_remainderl.c: Likewise.
+	* sysdeps/ia64/fpu/w_sinh.c: Likewise.
+	* sysdeps/ia64/fpu/w_sinhf.c: Likewise.
+	* sysdeps/ia64/fpu/w_sinhl.c: Likewise.
+	* sysdeps/ia64/fpu/w_sqrt.c: Likewise.
+	* sysdeps/ia64/fpu/w_sqrtf.c: Likewise.
+	* sysdeps/ia64/fpu/w_sqrtl.c: Likewise.
+	* sysdeps/ia64/fpu/w_tgamma.c: Likewise.
+	* sysdeps/ia64/fpu/w_tgammaf.c: Likewise.
+	* sysdeps/ia64/fpu/w_tgammal.c: Likewise.
+	* sysdeps/ieee754/dbl-64/w_exp_compat.c: Condition contents on
+	[LIBM_SVID_COMPAT].
+	* sysdeps/ieee754/flt-32/w_expf_compat.c: Likewise.
+	* sysdeps/ieee754/k_standard.c: Likewise.
+	* sysdeps/ieee754/k_standardf.c: Likewise.
+	* sysdeps/ieee754/k_standardl.c: Likewise.
+	* sysdeps/ieee754/ldbl-128/w_expl_compat.c: Likewise.
+	* sysdeps/ieee754/ldbl-128ibm/w_expl_compat.c: Likewise.
+	* sysdeps/ieee754/ldbl-96/w_expl_compat.c: Likewise.
+	* sysdeps/ieee754/ldbl-64-128/w_expl_compat.c: Condition
+	long_double_symbol call on [LIBM_SVID_COMPAT].
+	* sysdeps/ieee754/ldbl-opt/w_acoshl_compat.c: Likewise.
+	* sysdeps/ieee754/ldbl-opt/w_acosl_compat.c: Likewise.
+	* sysdeps/ieee754/ldbl-opt/w_asinl_compat.c: Likewise.
+	* sysdeps/ieee754/ldbl-opt/w_atan2l_compat.c: Likewise.
+	* sysdeps/ieee754/ldbl-opt/w_atanhl_compat.c: Likewise.
+	* sysdeps/ieee754/ldbl-opt/w_coshl_compat.c: Likewise.
+	* sysdeps/ieee754/ldbl-opt/w_fmodl_compat.c: Likewise.
+	* sysdeps/ieee754/ldbl-opt/w_hypotl_compat.c: Likewise.
+	* sysdeps/ieee754/ldbl-opt/w_j0l_compat.c: Likewise.
+	* sysdeps/ieee754/ldbl-opt/w_j1l_compat.c: Likewise.
+	* sysdeps/ieee754/ldbl-opt/w_jnl_compat.c: Likewise.
+	* sysdeps/ieee754/ldbl-opt/w_lgammal_r_compat.c: Likewise.
+	* sysdeps/ieee754/ldbl-opt/w_log10l_compat.c: Likewise.
+	* sysdeps/ieee754/ldbl-opt/w_log2l_compat.c: Likewise.
+	* sysdeps/ieee754/ldbl-opt/w_logl_compat.c: Likewise.
+	* sysdeps/ieee754/ldbl-opt/w_powl_compat.c: Likewise.
+	* sysdeps/ieee754/ldbl-opt/w_remainderl_compat.c: Likewise.
+	* sysdeps/ieee754/ldbl-opt/w_sinhl_compat.c: Likewise.
+	* sysdeps/ieee754/ldbl-opt/w_sqrtl_compat.c: Likewise.
+	* sysdeps/ieee754/ldbl-opt/w_tgammal_compat.c: Likewise.
+	* sysdeps/ieee754/ldbl-opt/w_exp10l_compat.c: Condition
+	long_double_symbol and compat_symbol calls on [LIBM_SVID_COMPAT].
+
 2017-09-05  Steve Ellcey  <sellcey@cavium.com>
 
 	* include/shlib-compat.h (TEST_COMPAT): New Macro.
diff --git a/math/lgamma-compat.h b/math/lgamma-compat.h
index 189d126882..b7b6b36d16 100644
--- a/math/lgamma-compat.h
+++ b/math/lgamma-compat.h
@@ -41,7 +41,8 @@
 #define HAVE_LGAMMA_COMPAT SHLIB_COMPAT (libm, LGAMMA_OLD_VER, LGAMMA_NEW_VER)
 
 /* Whether to build this version at all.  */
-#define BUILD_LGAMMA (HAVE_LGAMMA_COMPAT || !USE_AS_COMPAT)
+#define BUILD_LGAMMA \
+  (LIBM_SVID_COMPAT && (HAVE_LGAMMA_COMPAT || !USE_AS_COMPAT))
 
 /* The name to use for this version.  */
 #if USE_AS_COMPAT
diff --git a/math/w_acos_compat.c b/math/w_acos_compat.c
index 5115732a83..1930105153 100644
--- a/math/w_acos_compat.c
+++ b/math/w_acos_compat.c
@@ -22,6 +22,7 @@
 #include <math-svid-compat.h>
 
 
+#if LIBM_SVID_COMPAT
 /* wrapper acos */
 double
 __acos (double x)
@@ -37,7 +38,8 @@ __acos (double x)
   return __ieee754_acos (x);
 }
 weak_alias (__acos, acos)
-#ifdef NO_LONG_DOUBLE
+# ifdef NO_LONG_DOUBLE
 strong_alias (__acos, __acosl)
 weak_alias (__acos, acosl)
+# endif
 #endif
diff --git a/math/w_acosf_compat.c b/math/w_acosf_compat.c
index 0bf557c9c5..97cac13cd6 100644
--- a/math/w_acosf_compat.c
+++ b/math/w_acosf_compat.c
@@ -22,6 +22,7 @@
 #include <math-svid-compat.h>
 
 
+#if LIBM_SVID_COMPAT
 /* wrapper acosf */
 float
 __acosf (float x)
@@ -37,3 +38,4 @@ __acosf (float x)
   return __ieee754_acosf (x);
 }
 weak_alias (__acosf, acosf)
+#endif
diff --git a/math/w_acosh_compat.c b/math/w_acosh_compat.c
index 31251ce760..f6d298e17b 100644
--- a/math/w_acosh_compat.c
+++ b/math/w_acosh_compat.c
@@ -21,6 +21,7 @@
 #include <math-svid-compat.h>
 
 
+#if LIBM_SVID_COMPAT
 /* wrapper acosh */
 double
 __acosh (double x)
@@ -32,7 +33,8 @@ __acosh (double x)
   return __ieee754_acosh (x);
 }
 weak_alias (__acosh, acosh)
-#ifdef NO_LONG_DOUBLE
+# ifdef NO_LONG_DOUBLE
 strong_alias (__acosh, __acoshl)
 weak_alias (__acosh, acoshl)
+# endif
 #endif
diff --git a/math/w_acoshf_compat.c b/math/w_acoshf_compat.c
index 6a4482e534..7a8c87bf4f 100644
--- a/math/w_acoshf_compat.c
+++ b/math/w_acoshf_compat.c
@@ -21,6 +21,7 @@
 #include <math-svid-compat.h>
 
 
+#if LIBM_SVID_COMPAT
 /* wrapper acoshf */
 float
 __acoshf (float x)
@@ -32,3 +33,4 @@ __acoshf (float x)
   return __ieee754_acoshf (x);
 }
 weak_alias (__acoshf, acoshf)
+#endif
diff --git a/math/w_acoshl_compat.c b/math/w_acoshl_compat.c
index b9f66c53ef..79d0370eb3 100644
--- a/math/w_acoshl_compat.c
+++ b/math/w_acoshl_compat.c
@@ -21,6 +21,7 @@
 #include <math-svid-compat.h>
 
 
+#if LIBM_SVID_COMPAT
 /* wrapper acosl */
 long double
 __acoshl (long double x)
@@ -32,3 +33,4 @@ __acoshl (long double x)
   return __ieee754_acoshl (x);
 }
 weak_alias (__acoshl, acoshl)
+#endif
diff --git a/math/w_acosl_compat.c b/math/w_acosl_compat.c
index 66600b5d38..7d2f1835ae 100644
--- a/math/w_acosl_compat.c
+++ b/math/w_acosl_compat.c
@@ -22,6 +22,7 @@
 #include <math-svid-compat.h>
 
 
+#if LIBM_SVID_COMPAT
 /* wrapper acosl */
 long double
 __acosl (long double x)
@@ -37,3 +38,4 @@ __acosl (long double x)
   return __ieee754_acosl (x);
 }
 weak_alias (__acosl, acosl)
+#endif
diff --git a/math/w_asin_compat.c b/math/w_asin_compat.c
index 59beea817d..7780f85883 100644
--- a/math/w_asin_compat.c
+++ b/math/w_asin_compat.c
@@ -22,6 +22,7 @@
 #include <math-svid-compat.h>
 
 
+#if LIBM_SVID_COMPAT
 /* wrapper asin */
 double
 __asin (double x)
@@ -37,7 +38,8 @@ __asin (double x)
   return __ieee754_asin (x);
 }
 weak_alias (__asin, asin)
-#ifdef NO_LONG_DOUBLE
+# ifdef NO_LONG_DOUBLE
 strong_alias (__asin, __asinl)
 weak_alias (__asin, asinl)
+# endif
 #endif
diff --git a/math/w_asinf_compat.c b/math/w_asinf_compat.c
index 0eb20b10b5..10ee32328e 100644
--- a/math/w_asinf_compat.c
+++ b/math/w_asinf_compat.c
@@ -22,6 +22,7 @@
 #include <math-svid-compat.h>
 
 
+#if LIBM_SVID_COMPAT
 /* wrapper asinf */
 float
 __asinf (float x)
@@ -37,3 +38,4 @@ __asinf (float x)
   return __ieee754_asinf (x);
 }
 weak_alias (__asinf, asinf)
+#endif
diff --git a/math/w_asinl_compat.c b/math/w_asinl_compat.c
index c8f4d150c6..c9e1a340cc 100644
--- a/math/w_asinl_compat.c
+++ b/math/w_asinl_compat.c
@@ -22,6 +22,7 @@
 #include <math-svid-compat.h>
 
 
+#if LIBM_SVID_COMPAT
 /* wrapper asinl */
 long double
 __asinl (long double x)
@@ -37,3 +38,4 @@ __asinl (long double x)
   return __ieee754_asinl (x);
 }
 weak_alias (__asinl, asinl)
+#endif
diff --git a/math/w_atan2_compat.c b/math/w_atan2_compat.c
index fa098ffeb7..1ca3349207 100644
--- a/math/w_atan2_compat.c
+++ b/math/w_atan2_compat.c
@@ -26,6 +26,7 @@
 #include <math-svid-compat.h>
 
 
+#if LIBM_SVID_COMPAT
 double
 __atan2 (double y, double x)
 {
@@ -40,7 +41,8 @@ __atan2 (double y, double x)
   return z;
 }
 weak_alias (__atan2, atan2)
-#ifdef NO_LONG_DOUBLE
+# ifdef NO_LONG_DOUBLE
 strong_alias (__atan2, __atan2l)
 weak_alias (__atan2, atan2l)
+# endif
 #endif
diff --git a/math/w_atan2f_compat.c b/math/w_atan2f_compat.c
index 15e05d8253..8d7ad71b70 100644
--- a/math/w_atan2f_compat.c
+++ b/math/w_atan2f_compat.c
@@ -26,6 +26,7 @@
 #include <math-svid-compat.h>
 
 
+#if LIBM_SVID_COMPAT
 float
 __atan2f (float y, float x)
 {
@@ -40,3 +41,4 @@ __atan2f (float y, float x)
   return z;
 }
 weak_alias (__atan2f, atan2f)
+#endif
diff --git a/math/w_atan2l_compat.c b/math/w_atan2l_compat.c
index 87b73948da..9dc2b144ea 100644
--- a/math/w_atan2l_compat.c
+++ b/math/w_atan2l_compat.c
@@ -26,6 +26,7 @@
 #include <math-svid-compat.h>
 
 
+#if LIBM_SVID_COMPAT
 long double
 __atan2l (long double y, long double x)
 {
@@ -40,3 +41,4 @@ __atan2l (long double y, long double x)
   return z;
 }
 weak_alias (__atan2l, atan2l)
+#endif
diff --git a/math/w_atanh_compat.c b/math/w_atanh_compat.c
index f7a43beb09..c2cbb2ee5f 100644
--- a/math/w_atanh_compat.c
+++ b/math/w_atanh_compat.c
@@ -21,6 +21,7 @@
 #include <math-svid-compat.h>
 
 
+#if LIBM_SVID_COMPAT
 /* wrapper atanh */
 double
 __atanh (double x)
@@ -35,7 +36,8 @@ __atanh (double x)
   return __ieee754_atanh (x);
 }
 weak_alias (__atanh, atanh)
-#ifdef NO_LONG_DOUBLE
+# ifdef NO_LONG_DOUBLE
 strong_alias (__atanh, __atanhl)
 weak_alias (__atanh, atanhl)
+# endif
 #endif
diff --git a/math/w_atanhf_compat.c b/math/w_atanhf_compat.c
index c9d2c3a3ae..6045188bd8 100644
--- a/math/w_atanhf_compat.c
+++ b/math/w_atanhf_compat.c
@@ -21,6 +21,7 @@
 #include <math-svid-compat.h>
 
 
+#if LIBM_SVID_COMPAT
 /* wrapper atanhf */
 float
 __atanhf (float x)
@@ -35,3 +36,4 @@ __atanhf (float x)
   return __ieee754_atanhf (x);
 }
 weak_alias (__atanhf, atanhf)
+#endif
diff --git a/math/w_atanhl_compat.c b/math/w_atanhl_compat.c
index 56f9f1ed61..837a6652b8 100644
--- a/math/w_atanhl_compat.c
+++ b/math/w_atanhl_compat.c
@@ -21,6 +21,7 @@
 #include <math-svid-compat.h>
 
 
+#if LIBM_SVID_COMPAT
 /* wrapper atanhl */
 long double
 __atanhl (long double x)
@@ -35,3 +36,4 @@ __atanhl (long double x)
   return __ieee754_atanhl (x);
 }
 weak_alias (__atanhl, atanhl)
+#endif
diff --git a/math/w_cosh_compat.c b/math/w_cosh_compat.c
index fd16436520..d0cb6b165f 100644
--- a/math/w_cosh_compat.c
+++ b/math/w_cosh_compat.c
@@ -18,6 +18,7 @@
 #include <math_private.h>
 #include <math-svid-compat.h>
 
+#if LIBM_SVID_COMPAT
 double
 __cosh (double x)
 {
@@ -29,7 +30,8 @@ __cosh (double x)
 	return z;
 }
 weak_alias (__cosh, cosh)
-#ifdef NO_LONG_DOUBLE
+# ifdef NO_LONG_DOUBLE
 strong_alias (__cosh, __coshl)
 weak_alias (__cosh, coshl)
+# endif
 #endif
diff --git a/math/w_coshf_compat.c b/math/w_coshf_compat.c
index dd62281693..b5d53168f2 100644
--- a/math/w_coshf_compat.c
+++ b/math/w_coshf_compat.c
@@ -22,6 +22,7 @@
 #include <math_private.h>
 #include <math-svid-compat.h>
 
+#if LIBM_SVID_COMPAT
 float
 __coshf (float x)
 {
@@ -33,3 +34,4 @@ __coshf (float x)
 	return z;
 }
 weak_alias (__coshf, coshf)
+#endif
diff --git a/math/w_coshl_compat.c b/math/w_coshl_compat.c
index 5fa32bea88..4dab6eff67 100644
--- a/math/w_coshl_compat.c
+++ b/math/w_coshl_compat.c
@@ -23,6 +23,7 @@
 #include <math_private.h>
 #include <math-svid-compat.h>
 
+#if LIBM_SVID_COMPAT
 long double
 __coshl (long double x)
 {
@@ -34,3 +35,4 @@ __coshl (long double x)
 	return z;
 }
 weak_alias (__coshl, coshl)
+#endif
diff --git a/math/w_exp10_compat.c b/math/w_exp10_compat.c
index 5256f5b06f..42dc312ee8 100644
--- a/math/w_exp10_compat.c
+++ b/math/w_exp10_compat.c
@@ -25,6 +25,7 @@
 #include <math_private.h>
 #include <math-svid-compat.h>
 
+#if LIBM_SVID_COMPAT
 double
 __exp10 (double x)
 {
@@ -37,15 +38,16 @@ __exp10 (double x)
   return z;
 }
 weak_alias (__exp10, exp10)
-#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_27)
+# if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_27)
 strong_alias (__exp10, __pow10)
 compat_symbol (libm, __pow10, pow10, GLIBC_2_1);
-#endif
-#ifdef NO_LONG_DOUBLE
+# endif
+# ifdef NO_LONG_DOUBLE
 strong_alias (__exp10, __exp10l)
 weak_alias (__exp10, exp10l)
-# if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_27)
+#  if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_27)
 strong_alias (__exp10l, __pow10l)
 compat_symbol (libm, __pow10l, pow10l, GLIBC_2_1);
+#  endif
 # endif
 #endif
diff --git a/math/w_exp10f_compat.c b/math/w_exp10f_compat.c
index c559e6a629..bacf2eb9d2 100644
--- a/math/w_exp10f_compat.c
+++ b/math/w_exp10f_compat.c
@@ -25,6 +25,7 @@
 #include <math_private.h>
 #include <math-svid-compat.h>
 
+#if LIBM_SVID_COMPAT
 float
 __exp10f (float x)
 {
@@ -37,7 +38,8 @@ __exp10f (float x)
   return z;
 }
 weak_alias (__exp10f, exp10f)
-#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_27)
+# if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_27)
 strong_alias (__exp10f, __pow10f)
 compat_symbol (libm, __pow10f, pow10f, GLIBC_2_1);
+# endif
 #endif
diff --git a/math/w_exp10l_compat.c b/math/w_exp10l_compat.c
index 03b7ce9b6b..3d7d66d5af 100644
--- a/math/w_exp10l_compat.c
+++ b/math/w_exp10l_compat.c
@@ -25,6 +25,7 @@
 #include <math_private.h>
 #include <math-svid-compat.h>
 
+#if LIBM_SVID_COMPAT
 long double
 __exp10l (long double x)
 {
@@ -37,7 +38,8 @@ __exp10l (long double x)
   return z;
 }
 weak_alias (__exp10l, exp10l)
-#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_27)
+# if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_27)
 strong_alias (__exp10l, __pow10l)
 compat_symbol (libm, __pow10l, pow10l, GLIBC_2_1);
+# endif
 #endif
diff --git a/math/w_exp2_compat.c b/math/w_exp2_compat.c
index a4d4653708..5739547859 100644
--- a/math/w_exp2_compat.c
+++ b/math/w_exp2_compat.c
@@ -6,6 +6,7 @@
 #include <math_private.h>
 #include <math-svid-compat.h>
 
+#if LIBM_SVID_COMPAT
 double
 __exp2 (double x)
 {
@@ -18,7 +19,8 @@ __exp2 (double x)
   return z;
 }
 weak_alias (__exp2, exp2)
-#ifdef NO_LONG_DOUBLE
+# ifdef NO_LONG_DOUBLE
 strong_alias (__exp2, __exp2l)
 weak_alias (__exp2, exp2l)
+# endif
 #endif
diff --git a/math/w_exp2f_compat.c b/math/w_exp2f_compat.c
index b21fe36903..b058daed30 100644
--- a/math/w_exp2f_compat.c
+++ b/math/w_exp2f_compat.c
@@ -6,6 +6,7 @@
 #include <math_private.h>
 #include <math-svid-compat.h>
 
+#if LIBM_SVID_COMPAT
 float
 __exp2f (float x)
 {
@@ -18,3 +19,4 @@ __exp2f (float x)
   return z;
 }
 weak_alias (__exp2f, exp2f)
+#endif
diff --git a/math/w_exp2l_compat.c b/math/w_exp2l_compat.c
index 04cd666b68..96d4b96c11 100644
--- a/math/w_exp2l_compat.c
+++ b/math/w_exp2l_compat.c
@@ -6,6 +6,7 @@
 #include <math_private.h>
 #include <math-svid-compat.h>
 
+#if LIBM_SVID_COMPAT
 long double
 __exp2l (long double x)
 {
@@ -18,3 +19,4 @@ __exp2l (long double x)
   return z;
 }
 weak_alias (__exp2l, exp2l)
+#endif
diff --git a/math/w_fmod_compat.c b/math/w_fmod_compat.c
index 1079d3a603..f75b8615d0 100644
--- a/math/w_fmod_compat.c
+++ b/math/w_fmod_compat.c
@@ -20,6 +20,7 @@
 #include <math_private.h>
 #include <math-svid-compat.h>
 
+#if LIBM_SVID_COMPAT
 /* wrapper fmod */
 double
 __fmod (double x, double y)
@@ -32,7 +33,8 @@ __fmod (double x, double y)
   return __ieee754_fmod (x, y);
 }
 weak_alias (__fmod, fmod)
-#ifdef NO_LONG_DOUBLE
+# ifdef NO_LONG_DOUBLE
 strong_alias (__fmod, __fmodl)
 weak_alias (__fmod, fmodl)
+# endif
 #endif
diff --git a/math/w_fmodf_compat.c b/math/w_fmodf_compat.c
index 88b64a24bd..a2739d856a 100644
--- a/math/w_fmodf_compat.c
+++ b/math/w_fmodf_compat.c
@@ -20,6 +20,7 @@
 #include <math_private.h>
 #include <math-svid-compat.h>
 
+#if LIBM_SVID_COMPAT
 /* wrapper fmodf */
 float
 __fmodf (float x, float y)
@@ -32,3 +33,4 @@ __fmodf (float x, float y)
   return __ieee754_fmodf (x, y);
 }
 weak_alias (__fmodf, fmodf)
+#endif
diff --git a/math/w_fmodl_compat.c b/math/w_fmodl_compat.c
index 23422fa652..3136e82d65 100644
--- a/math/w_fmodl_compat.c
+++ b/math/w_fmodl_compat.c
@@ -20,6 +20,7 @@
 #include <math_private.h>
 #include <math-svid-compat.h>
 
+#if LIBM_SVID_COMPAT
 /* wrapper fmodl */
 long double
 __fmodl (long double x, long double y)
@@ -32,3 +33,4 @@ __fmodl (long double x, long double y)
   return __ieee754_fmodl (x, y);
 }
 weak_alias (__fmodl, fmodl)
+#endif
diff --git a/math/w_hypot_compat.c b/math/w_hypot_compat.c
index ff3774cf62..21c7e65c5e 100644
--- a/math/w_hypot_compat.c
+++ b/math/w_hypot_compat.c
@@ -19,6 +19,7 @@
 #include <math-svid-compat.h>
 
 
+#if LIBM_SVID_COMPAT
 double
 __hypot (double x, double y)
 {
@@ -30,7 +31,8 @@ __hypot (double x, double y)
 	return z;
 }
 weak_alias (__hypot, hypot)
-#ifdef NO_LONG_DOUBLE
+# ifdef NO_LONG_DOUBLE
 strong_alias (__hypot, __hypotl)
 weak_alias (__hypot, hypotl)
+# endif
 #endif
diff --git a/math/w_hypotf_compat.c b/math/w_hypotf_compat.c
index 0a43d90a00..8e6d2343eb 100644
--- a/math/w_hypotf_compat.c
+++ b/math/w_hypotf_compat.c
@@ -22,6 +22,7 @@
 #include <math-svid-compat.h>
 
 
+#if LIBM_SVID_COMPAT
 float
 __hypotf(float x, float y)
 {
@@ -34,3 +35,4 @@ __hypotf(float x, float y)
 	return z;
 }
 weak_alias (__hypotf, hypotf)
+#endif
diff --git a/math/w_hypotl_compat.c b/math/w_hypotl_compat.c
index 13060f74a7..bc56d29a04 100644
--- a/math/w_hypotl_compat.c
+++ b/math/w_hypotl_compat.c
@@ -23,6 +23,7 @@
 #include <math-svid-compat.h>
 
 
+#if LIBM_SVID_COMPAT
 long double
 __hypotl(long double x, long double y)
 {
@@ -35,3 +36,4 @@ __hypotl(long double x, long double y)
 	return z;
 }
 weak_alias (__hypotl, hypotl)
+#endif
diff --git a/math/w_j0_compat.c b/math/w_j0_compat.c
index 80d21acde1..3df71e0b7b 100644
--- a/math/w_j0_compat.c
+++ b/math/w_j0_compat.c
@@ -22,6 +22,7 @@
 #include <math-svid-compat.h>
 
 
+#if LIBM_SVID_COMPAT
 /* wrapper j0 */
 double
 j0 (double x)
@@ -33,9 +34,9 @@ j0 (double x)
 
   return __ieee754_j0 (x);
 }
-#ifdef NO_LONG_DOUBLE
+# ifdef NO_LONG_DOUBLE
 weak_alias (j0, j0l)
-#endif
+# endif
 
 
 /* wrapper y0 */
@@ -64,6 +65,7 @@ y0 (double x)
 
   return __ieee754_y0 (x);
 }
-#ifdef NO_LONG_DOUBLE
+# ifdef NO_LONG_DOUBLE
 weak_alias (y0, y0l)
+# endif
 #endif
diff --git a/math/w_j0f_compat.c b/math/w_j0f_compat.c
index 36fc4f9443..e9ac74f23a 100644
--- a/math/w_j0f_compat.c
+++ b/math/w_j0f_compat.c
@@ -22,6 +22,7 @@
 #include <math-svid-compat.h>
 
 
+#if LIBM_SVID_COMPAT
 /* wrapper j0f */
 float
 j0f (float x)
@@ -62,3 +63,4 @@ y0f (float x)
 
   return __ieee754_y0f (x);
 }
+#endif
diff --git a/math/w_j0l_compat.c b/math/w_j0l_compat.c
index ff7e1b1456..76ec812729 100644
--- a/math/w_j0l_compat.c
+++ b/math/w_j0l_compat.c
@@ -22,6 +22,7 @@
 #include <math-svid-compat.h>
 
 
+#if LIBM_SVID_COMPAT
 /* wrapper j0l */
 long double
 __j0l (long double x)
@@ -63,3 +64,4 @@ __y0l (long double x)
   return __ieee754_y0l (x);
 }
 weak_alias (__y0l, y0l)
+#endif
diff --git a/math/w_j1_compat.c b/math/w_j1_compat.c
index f7a76c10d5..be788f9864 100644
--- a/math/w_j1_compat.c
+++ b/math/w_j1_compat.c
@@ -22,6 +22,7 @@
 #include <math-svid-compat.h>
 
 
+#if LIBM_SVID_COMPAT
 /* wrapper j1 */
 double
 j1 (double x)
@@ -33,9 +34,9 @@ j1 (double x)
 
   return __ieee754_j1 (x);
 }
-#ifdef NO_LONG_DOUBLE
+# ifdef NO_LONG_DOUBLE
 weak_alias (j1, j1l)
-#endif
+# endif
 
 
 /* wrapper y1 */
@@ -64,6 +65,7 @@ y1 (double x)
 
   return __ieee754_y1 (x);
 }
-#ifdef NO_LONG_DOUBLE
+# ifdef NO_LONG_DOUBLE
 weak_alias (y1, y1l)
+# endif
 #endif
diff --git a/math/w_j1f_compat.c b/math/w_j1f_compat.c
index 9aa5c8c4fd..c3222bbc8d 100644
--- a/math/w_j1f_compat.c
+++ b/math/w_j1f_compat.c
@@ -22,6 +22,7 @@
 #include <math-svid-compat.h>
 
 
+#if LIBM_SVID_COMPAT
 /* wrapper j1f */
 float
 j1f (float x)
@@ -62,3 +63,4 @@ y1f (float x)
 
   return __ieee754_y1f (x);
 }
+#endif
diff --git a/math/w_j1l_compat.c b/math/w_j1l_compat.c
index 7e6d9f57f2..c3acfdfe76 100644
--- a/math/w_j1l_compat.c
+++ b/math/w_j1l_compat.c
@@ -22,6 +22,7 @@
 #include <math-svid-compat.h>
 
 
+#if LIBM_SVID_COMPAT
 /* wrapper j1l */
 long double
 __j1l (long double x)
@@ -63,3 +64,4 @@ __y1l (long double x)
   return __ieee754_y1l (x);
 }
 weak_alias (__y1l, y1l)
+#endif
diff --git a/math/w_jn_compat.c b/math/w_jn_compat.c
index 7c49992cf4..496c779e8c 100644
--- a/math/w_jn_compat.c
+++ b/math/w_jn_compat.c
@@ -22,6 +22,7 @@
 #include <math-svid-compat.h>
 
 
+#if LIBM_SVID_COMPAT
 /* wrapper jn */
 double
 jn (int n, double x)
@@ -33,9 +34,9 @@ jn (int n, double x)
 
   return __ieee754_jn (n, x);
 }
-#ifdef NO_LONG_DOUBLE
+# ifdef NO_LONG_DOUBLE
 weak_alias (jn, jnl)
-#endif
+# endif
 
 
 /* wrapper yn */
@@ -64,6 +65,7 @@ yn (int n, double x)
 
   return __ieee754_yn (n, x);
 }
-#ifdef NO_LONG_DOUBLE
+# ifdef NO_LONG_DOUBLE
 weak_alias (yn, ynl)
+# endif
 #endif
diff --git a/math/w_jnf_compat.c b/math/w_jnf_compat.c
index ead40e7a60..440d53d13e 100644
--- a/math/w_jnf_compat.c
+++ b/math/w_jnf_compat.c
@@ -22,6 +22,7 @@
 #include <math-svid-compat.h>
 
 
+#if LIBM_SVID_COMPAT
 /* wrapper jnf */
 float
 jnf (int n, float x)
@@ -62,3 +63,4 @@ ynf (int n, float x)
 
   return __ieee754_ynf (n, x);
 }
+#endif
diff --git a/math/w_jnl_compat.c b/math/w_jnl_compat.c
index bc416359c2..7298c73a3b 100644
--- a/math/w_jnl_compat.c
+++ b/math/w_jnl_compat.c
@@ -48,11 +48,12 @@ static char rcsid[] = "$NetBSD: $";
 #include <math_private.h>
 #include <math-svid-compat.h>
 
+#if LIBM_SVID_COMPAT
 long double __jnl(int n, long double x)	/* wrapper jnl */
 {
-#ifdef _IEEE_LIBM
+# ifdef _IEEE_LIBM
 	return __ieee754_jnl(n,x);
-#else
+# else
 	long double z;
 	z = __ieee754_jnl(n,x);
 	if (_LIB_VERSION == _IEEE_
@@ -63,15 +64,15 @@ long double __jnl(int n, long double x)	/* wrapper jnl */
 	    return __kernel_standard_l((double)n,x,238); /* jn(|x|>X_TLOSS,n) */
 	} else
 	    return z;
-#endif
+# endif
 }
 weak_alias (__jnl, jnl)
 
 long double __ynl(int n, long double x)	/* wrapper ynl */
 {
-#ifdef _IEEE_LIBM
+# ifdef _IEEE_LIBM
 	return __ieee754_ynl(n,x);
-#else
+# else
 	long double z;
 	z = __ieee754_ynl(n,x);
 	if(_LIB_VERSION == _IEEE_ || isnan(x) ) return z;
@@ -87,6 +88,7 @@ long double __ynl(int n, long double x)	/* wrapper ynl */
 	    return __kernel_standard_l((double)n,x,239); /* yn(x>X_TLOSS,n) */
 	} else
 	    return z;
-#endif
+# endif
 }
 weak_alias (__ynl, ynl)
+#endif
diff --git a/math/w_lgamma_r_compat.c b/math/w_lgamma_r_compat.c
index 3f7fbce62b..f88a5df6a5 100644
--- a/math/w_lgamma_r_compat.c
+++ b/math/w_lgamma_r_compat.c
@@ -19,6 +19,7 @@
 #include <math-svid-compat.h>
 
 
+#if LIBM_SVID_COMPAT
 double
 __lgamma_r(double x, int *signgamp)
 {
@@ -33,7 +34,8 @@ __lgamma_r(double x, int *signgamp)
 	return y;
 }
 weak_alias (__lgamma_r, lgamma_r)
-#ifdef NO_LONG_DOUBLE
+# ifdef NO_LONG_DOUBLE
 strong_alias (__lgamma_r, __lgammal_r)
 weak_alias (__lgamma_r, lgammal_r)
+# endif
 #endif
diff --git a/math/w_lgammaf_r_compat.c b/math/w_lgammaf_r_compat.c
index d9601f45d7..86003de59a 100644
--- a/math/w_lgammaf_r_compat.c
+++ b/math/w_lgammaf_r_compat.c
@@ -22,6 +22,7 @@
 #include <math-svid-compat.h>
 
 
+#if LIBM_SVID_COMPAT
 float
 __lgammaf_r(float x, int *signgamp)
 {
@@ -36,3 +37,4 @@ __lgammaf_r(float x, int *signgamp)
 	return y;
 }
 weak_alias (__lgammaf_r, lgammaf_r)
+#endif
diff --git a/math/w_lgammal_r_compat.c b/math/w_lgammal_r_compat.c
index d1b58e42dd..781bfa45e7 100644
--- a/math/w_lgammal_r_compat.c
+++ b/math/w_lgammal_r_compat.c
@@ -23,6 +23,7 @@
 #include <math-svid-compat.h>
 
 
+#if LIBM_SVID_COMPAT
 long double
 __lgammal_r(long double x, int *signgamp)
 {
@@ -37,3 +38,4 @@ __lgammal_r(long double x, int *signgamp)
 	return y;
 }
 weak_alias (__lgammal_r, lgammal_r)
+#endif
diff --git a/math/w_log10_compat.c b/math/w_log10_compat.c
index 6f3eb3408c..b8247aa886 100644
--- a/math/w_log10_compat.c
+++ b/math/w_log10_compat.c
@@ -22,6 +22,7 @@
 #include <math-svid-compat.h>
 
 
+#if LIBM_SVID_COMPAT
 /* wrapper log10(x) */
 double
 __log10 (double x)
@@ -43,7 +44,8 @@ __log10 (double x)
   return  __ieee754_log10 (x);
 }
 weak_alias (__log10, log10)
-#ifdef NO_LONG_DOUBLE
+# ifdef NO_LONG_DOUBLE
 strong_alias (__log10, __log10l)
 weak_alias (__log10, log10l)
+# endif
 #endif
diff --git a/math/w_log10f_compat.c b/math/w_log10f_compat.c
index 2cb5c9a1bb..151c94b4dc 100644
--- a/math/w_log10f_compat.c
+++ b/math/w_log10f_compat.c
@@ -22,6 +22,7 @@
 #include <math-svid-compat.h>
 
 
+#if LIBM_SVID_COMPAT
 /* wrapper log10f(x) */
 float
 __log10f (float x)
@@ -43,3 +44,4 @@ __log10f (float x)
   return  __ieee754_log10f (x);
 }
 weak_alias (__log10f, log10f)
+#endif
diff --git a/math/w_log10l_compat.c b/math/w_log10l_compat.c
index 0063c50778..88d9c40354 100644
--- a/math/w_log10l_compat.c
+++ b/math/w_log10l_compat.c
@@ -22,6 +22,7 @@
 #include <math-svid-compat.h>
 
 
+#if LIBM_SVID_COMPAT
 /* wrapper log10l(x) */
 long double
 __log10l (long double x)
@@ -43,3 +44,4 @@ __log10l (long double x)
   return  __ieee754_log10l (x);
 }
 weak_alias (__log10l, log10l)
+#endif
diff --git a/math/w_log2_compat.c b/math/w_log2_compat.c
index 252fc0d86a..6d1f9f2159 100644
--- a/math/w_log2_compat.c
+++ b/math/w_log2_compat.c
@@ -22,6 +22,7 @@
 #include <math-svid-compat.h>
 
 
+#if LIBM_SVID_COMPAT
 /* wrapper log2(x) */
 double
 __log2 (double x)
@@ -43,7 +44,8 @@ __log2 (double x)
   return  __ieee754_log2 (x);
 }
 weak_alias (__log2, log2)
-#ifdef NO_LONG_DOUBLE
+# ifdef NO_LONG_DOUBLE
 strong_alias (__log2, __log2l)
 weak_alias (__log2, log2l)
+# endif
 #endif
diff --git a/math/w_log2f_compat.c b/math/w_log2f_compat.c
index 6adaff6c72..82085d5222 100644
--- a/math/w_log2f_compat.c
+++ b/math/w_log2f_compat.c
@@ -22,6 +22,7 @@
 #include <math-svid-compat.h>
 
 
+#if LIBM_SVID_COMPAT
 /* wrapper log2f(x) */
 float
 __log2f (float x)
@@ -43,3 +44,4 @@ __log2f (float x)
   return  __ieee754_log2f (x);
 }
 weak_alias (__log2f, log2f)
+#endif
diff --git a/math/w_log2l_compat.c b/math/w_log2l_compat.c
index f496c3630e..cd367f2f51 100644
--- a/math/w_log2l_compat.c
+++ b/math/w_log2l_compat.c
@@ -22,6 +22,7 @@
 #include <math-svid-compat.h>
 
 
+#if LIBM_SVID_COMPAT
 /* wrapper log2l(x) */
 long double
 __log2l (long double x)
@@ -43,3 +44,4 @@ __log2l (long double x)
   return  __ieee754_log2l (x);
 }
 weak_alias (__log2l, log2l)
+#endif
diff --git a/math/w_log_compat.c b/math/w_log_compat.c
index 82f3ff4eec..80750b4371 100644
--- a/math/w_log_compat.c
+++ b/math/w_log_compat.c
@@ -22,6 +22,7 @@
 #include <math-svid-compat.h>
 
 
+#if LIBM_SVID_COMPAT
 /* wrapper log(x) */
 double
 __log (double x)
@@ -43,7 +44,8 @@ __log (double x)
   return  __ieee754_log (x);
 }
 weak_alias (__log, log)
-#ifdef NO_LONG_DOUBLE
+# ifdef NO_LONG_DOUBLE
 strong_alias (__log, __logl)
 weak_alias (__log, logl)
+# endif
 #endif
diff --git a/math/w_logf_compat.c b/math/w_logf_compat.c
index ac18b65c5e..4423bd527a 100644
--- a/math/w_logf_compat.c
+++ b/math/w_logf_compat.c
@@ -22,6 +22,7 @@
 #include <math-svid-compat.h>
 
 
+#if LIBM_SVID_COMPAT
 /* wrapper logf(x) */
 float
 __logf (float x)
@@ -43,3 +44,4 @@ __logf (float x)
   return  __ieee754_logf (x);
 }
 weak_alias (__logf, logf)
+#endif
diff --git a/math/w_logl_compat.c b/math/w_logl_compat.c
index ba65830b67..e37a17475e 100644
--- a/math/w_logl_compat.c
+++ b/math/w_logl_compat.c
@@ -22,6 +22,7 @@
 #include <math-svid-compat.h>
 
 
+#if LIBM_SVID_COMPAT
 /* wrapper logl(x) */
 long double
 __logl (long double x)
@@ -43,3 +44,4 @@ __logl (long double x)
   return  __ieee754_logl (x);
 }
 weak_alias (__logl, logl)
+#endif
diff --git a/math/w_pow_compat.c b/math/w_pow_compat.c
index 367f609dc2..4865f4d0d6 100644
--- a/math/w_pow_compat.c
+++ b/math/w_pow_compat.c
@@ -21,6 +21,7 @@
 #include <math-svid-compat.h>
 
 
+#if LIBM_SVID_COMPAT
 /* wrapper pow */
 double
 __pow (double x, double y)
@@ -59,7 +60,8 @@ __pow (double x, double y)
   return z;
 }
 weak_alias (__pow, pow)
-#ifdef NO_LONG_DOUBLE
+# ifdef NO_LONG_DOUBLE
 strong_alias (__pow, __powl)
 weak_alias (__pow, powl)
+# endif
 #endif
diff --git a/math/w_powf_compat.c b/math/w_powf_compat.c
index afc3fced80..ce1235baee 100644
--- a/math/w_powf_compat.c
+++ b/math/w_powf_compat.c
@@ -21,6 +21,7 @@
 #include <math-svid-compat.h>
 
 
+#if LIBM_SVID_COMPAT
 /* wrapper powf */
 float
 __powf (float x, float y)
@@ -59,3 +60,4 @@ __powf (float x, float y)
   return z;
 }
 weak_alias (__powf, powf)
+#endif
diff --git a/math/w_powl_compat.c b/math/w_powl_compat.c
index b25dad870d..9159f610d2 100644
--- a/math/w_powl_compat.c
+++ b/math/w_powl_compat.c
@@ -21,6 +21,7 @@
 #include <math-svid-compat.h>
 
 
+#if LIBM_SVID_COMPAT
 /* wrapper powl */
 long double
 __powl (long double x, long double y)
@@ -59,3 +60,4 @@ __powl (long double x, long double y)
   return z;
 }
 weak_alias (__powl, powl)
+#endif
diff --git a/math/w_remainder_compat.c b/math/w_remainder_compat.c
index 6bf5d1ff2e..68e322efdc 100644
--- a/math/w_remainder_compat.c
+++ b/math/w_remainder_compat.c
@@ -21,6 +21,7 @@
 #include <math-svid-compat.h>
 
 
+#if LIBM_SVID_COMPAT
 /* wrapper remainder */
 double
 __remainder (double x, double y)
@@ -34,8 +35,9 @@ __remainder (double x, double y)
 }
 weak_alias (__remainder, remainder)
 weak_alias (__remainder, drem)
-#ifdef NO_LONG_DOUBLE
+# ifdef NO_LONG_DOUBLE
 strong_alias (__remainder, __remainderl)
 weak_alias (__remainder, remainderl)
 weak_alias (__remainder, dreml)
+# endif
 #endif
diff --git a/math/w_remainderf_compat.c b/math/w_remainderf_compat.c
index 3ffefde83d..39ff3b4468 100644
--- a/math/w_remainderf_compat.c
+++ b/math/w_remainderf_compat.c
@@ -21,6 +21,7 @@
 #include <math-svid-compat.h>
 
 
+#if LIBM_SVID_COMPAT
 /* wrapper remainderf */
 float
 __remainderf (float x, float y)
@@ -34,3 +35,4 @@ __remainderf (float x, float y)
 }
 weak_alias (__remainderf, remainderf)
 weak_alias (__remainderf, dremf)
+#endif
diff --git a/math/w_remainderl_compat.c b/math/w_remainderl_compat.c
index b01b0b1365..c11ba24a8a 100644
--- a/math/w_remainderl_compat.c
+++ b/math/w_remainderl_compat.c
@@ -21,6 +21,7 @@
 #include <math-svid-compat.h>
 
 
+#if LIBM_SVID_COMPAT
 /* wrapper remainderl */
 long double
 __remainderl (long double x, long double y)
@@ -34,3 +35,4 @@ __remainderl (long double x, long double y)
 }
 weak_alias (__remainderl, remainderl)
 weak_alias (__remainderl, dreml)
+#endif
diff --git a/math/w_scalb_compat.c b/math/w_scalb_compat.c
index a31e54dd78..277e724415 100644
--- a/math/w_scalb_compat.c
+++ b/math/w_scalb_compat.c
@@ -22,6 +22,7 @@
 #include <math-svid-compat.h>
 
 
+#if LIBM_SVID_COMPAT
 static double
 __attribute__ ((noinline))
 sysv_scalb (double x, double fn)
@@ -40,15 +41,18 @@ sysv_scalb (double x, double fn)
 
   return z;
 }
+#endif
 
 
 /* Wrapper scalb */
 double
 __scalb (double x, double fn)
 {
+#if LIBM_SVID_COMPAT
   if (__glibc_unlikely (_LIB_VERSION == _SVID_))
     return sysv_scalb (x, fn);
   else
+#endif
     {
       double z = __ieee754_scalb (x, fn);
 
diff --git a/math/w_scalbf_compat.c b/math/w_scalbf_compat.c
index 2b96df0cbf..79798aef1e 100644
--- a/math/w_scalbf_compat.c
+++ b/math/w_scalbf_compat.c
@@ -22,6 +22,7 @@
 #include <math-svid-compat.h>
 
 
+#if LIBM_SVID_COMPAT
 static float
 __attribute__ ((noinline))
 sysv_scalbf (float x, float fn)
@@ -40,15 +41,18 @@ sysv_scalbf (float x, float fn)
 
   return z;
 }
+#endif
 
 
 /* Wrapper scalbf */
 float
 __scalbf (float x, float fn)
 {
+#if LIBM_SVID_COMPAT
   if (__glibc_unlikely (_LIB_VERSION == _SVID_))
     return sysv_scalbf (x, fn);
   else
+#endif
     {
       float z = __ieee754_scalbf (x, fn);
 
diff --git a/math/w_scalbl_compat.c b/math/w_scalbl_compat.c
index a4a0f8e942..4c73e6b180 100644
--- a/math/w_scalbl_compat.c
+++ b/math/w_scalbl_compat.c
@@ -22,6 +22,7 @@
 #include <math-svid-compat.h>
 
 
+#if LIBM_SVID_COMPAT
 static long double
 __attribute__ ((noinline))
 sysv_scalbl (long double x, long double fn)
@@ -40,15 +41,18 @@ sysv_scalbl (long double x, long double fn)
 
   return z;
 }
+#endif
 
 
 /* Wrapper scalbl */
 long double
 __scalbl (long double x, long double fn)
 {
+#if LIBM_SVID_COMPAT
   if (__glibc_unlikely (_LIB_VERSION == _SVID_))
     return sysv_scalbl (x, fn);
   else
+#endif
     {
       long double z = __ieee754_scalbl (x, fn);
 
diff --git a/math/w_sinh_compat.c b/math/w_sinh_compat.c
index 121edfc892..e5c3724763 100644
--- a/math/w_sinh_compat.c
+++ b/math/w_sinh_compat.c
@@ -18,6 +18,7 @@
 #include <math_private.h>
 #include <math-svid-compat.h>
 
+#if LIBM_SVID_COMPAT
 double
 __sinh (double x)
 {
@@ -29,7 +30,8 @@ __sinh (double x)
 	return z;
 }
 weak_alias (__sinh, sinh)
-#ifdef NO_LONG_DOUBLE
+# ifdef NO_LONG_DOUBLE
 strong_alias (__sinh, __sinhl)
 weak_alias (__sinh, sinhl)
+# endif
 #endif
diff --git a/math/w_sinhf_compat.c b/math/w_sinhf_compat.c
index 2103b06253..1310ccf93b 100644
--- a/math/w_sinhf_compat.c
+++ b/math/w_sinhf_compat.c
@@ -21,6 +21,7 @@
 #include <math_private.h>
 #include <math-svid-compat.h>
 
+#if LIBM_SVID_COMPAT
 float
 __sinhf (float x)
 {
@@ -32,3 +33,4 @@ __sinhf (float x)
 	return z;
 }
 weak_alias (__sinhf, sinhf)
+#endif
diff --git a/math/w_sinhl_compat.c b/math/w_sinhl_compat.c
index 57f08e7ecc..348209860a 100644
--- a/math/w_sinhl_compat.c
+++ b/math/w_sinhl_compat.c
@@ -22,6 +22,7 @@
 #include <math_private.h>
 #include <math-svid-compat.h>
 
+#if LIBM_SVID_COMPAT
 long double
 __sinhl (long double x)
 {
@@ -33,3 +34,4 @@ __sinhl (long double x)
 	return z;
 }
 weak_alias (__sinhl, sinhl)
+#endif
diff --git a/math/w_sqrt_compat.c b/math/w_sqrt_compat.c
index 743df321d5..aeead2e49c 100644
--- a/math/w_sqrt_compat.c
+++ b/math/w_sqrt_compat.c
@@ -21,6 +21,7 @@
 #include <math-svid-compat.h>
 
 
+#if LIBM_SVID_COMPAT
 /* wrapper sqrt */
 double
 __sqrt (double x)
@@ -31,7 +32,8 @@ __sqrt (double x)
   return __ieee754_sqrt (x);
 }
 weak_alias (__sqrt, sqrt)
-#ifdef NO_LONG_DOUBLE
+# ifdef NO_LONG_DOUBLE
 strong_alias (__sqrt, __sqrtl)
 weak_alias (__sqrt, sqrtl)
+# endif
 #endif
diff --git a/math/w_sqrtf_compat.c b/math/w_sqrtf_compat.c
index 0689b4bb1a..bd3d5048fc 100644
--- a/math/w_sqrtf_compat.c
+++ b/math/w_sqrtf_compat.c
@@ -21,6 +21,7 @@
 #include <math-svid-compat.h>
 
 
+#if LIBM_SVID_COMPAT
 /* wrapper sqrtf */
 float
 __sqrtf (float x)
@@ -31,3 +32,4 @@ __sqrtf (float x)
   return __ieee754_sqrtf (x);
 }
 weak_alias (__sqrtf, sqrtf)
+#endif
diff --git a/math/w_sqrtl_compat.c b/math/w_sqrtl_compat.c
index 43e81acf0a..b0afd1171c 100644
--- a/math/w_sqrtl_compat.c
+++ b/math/w_sqrtl_compat.c
@@ -21,6 +21,7 @@
 #include <math-svid-compat.h>
 
 
+#if LIBM_SVID_COMPAT
 /* wrapper sqrtl */
 long double
 __sqrtl (long double x)
@@ -31,3 +32,4 @@ __sqrtl (long double x)
   return __ieee754_sqrtl (x);
 }
 weak_alias (__sqrtl, sqrtl)
+#endif
diff --git a/math/w_tgamma_compat.c b/math/w_tgamma_compat.c
index 93bd48fd3f..f843475f10 100644
--- a/math/w_tgamma_compat.c
+++ b/math/w_tgamma_compat.c
@@ -20,6 +20,7 @@
 #include <math_private.h>
 #include <math-svid-compat.h>
 
+#if LIBM_SVID_COMPAT
 double
 __tgamma(double x)
 {
@@ -41,7 +42,8 @@ __tgamma(double x)
 	return local_signgam < 0 ? -y : y;
 }
 weak_alias (__tgamma, tgamma)
-#ifdef NO_LONG_DOUBLE
+# ifdef NO_LONG_DOUBLE
 strong_alias (__tgamma, __tgammal)
 weak_alias (__tgamma, tgammal)
+# endif
 #endif
diff --git a/math/w_tgammaf_compat.c b/math/w_tgammaf_compat.c
index e6ae48c1f5..796850b4d9 100644
--- a/math/w_tgammaf_compat.c
+++ b/math/w_tgammaf_compat.c
@@ -18,6 +18,7 @@
 #include <math_private.h>
 #include <math-svid-compat.h>
 
+#if LIBM_SVID_COMPAT
 float
 __tgammaf(float x)
 {
@@ -43,3 +44,4 @@ __tgammaf(float x)
 	return local_signgam < 0 ? - y : y;
 }
 weak_alias (__tgammaf, tgammaf)
+#endif
diff --git a/math/w_tgammal_compat.c b/math/w_tgammal_compat.c
index 306f672077..c0e442955b 100644
--- a/math/w_tgammal_compat.c
+++ b/math/w_tgammal_compat.c
@@ -23,6 +23,7 @@
 #include <math_private.h>
 #include <math-svid-compat.h>
 
+#if LIBM_SVID_COMPAT
 long double
 __tgammal(long double x)
 {
@@ -44,3 +45,4 @@ __tgammal(long double x)
 	return local_signgam < 0 ? - y : y;
 }
 weak_alias (__tgammal, tgammal)
+#endif
diff --git a/sysdeps/generic/math-type-macros-double.h b/sysdeps/generic/math-type-macros-double.h
index 6116f7f32f..a755699190 100644
--- a/sysdeps/generic/math-type-macros-double.h
+++ b/sysdeps/generic/math-type-macros-double.h
@@ -47,7 +47,9 @@
 /* Supply the generic macros.  */
 #include <math-type-macros.h>
 
-/* Do not use the type-generic wrapper templates.  */
-#define __USE_WRAPPER_TEMPLATE 0
+/* Do not use the type-generic wrapper templates if compatibility with
+   SVID error handling is needed.  */
+#include <math-svid-compat.h>
+#define __USE_WRAPPER_TEMPLATE !LIBM_SVID_COMPAT
 
 #endif
diff --git a/sysdeps/generic/math-type-macros-float.h b/sysdeps/generic/math-type-macros-float.h
index 712e517a81..cc8c4b0bcd 100644
--- a/sysdeps/generic/math-type-macros-float.h
+++ b/sysdeps/generic/math-type-macros-float.h
@@ -33,7 +33,9 @@
 /* Supply the generic macros.  */
 #include <math-type-macros.h>
 
-/* Do not use the type-generic wrapper templates.  */
-#define __USE_WRAPPER_TEMPLATE 0
+/* Do not use the type-generic wrapper templates if compatibility with
+   SVID error handling is needed.  */
+#include <math-svid-compat.h>
+#define __USE_WRAPPER_TEMPLATE !LIBM_SVID_COMPAT
 
 #endif
diff --git a/sysdeps/generic/math-type-macros-ldouble.h b/sysdeps/generic/math-type-macros-ldouble.h
index 4e02e53f70..7dbd559249 100644
--- a/sysdeps/generic/math-type-macros-ldouble.h
+++ b/sysdeps/generic/math-type-macros-ldouble.h
@@ -30,7 +30,9 @@
 /* Supply the generic macros.  */
 #include <math-type-macros.h>
 
-/* Do not use the type-generic wrapper templates.  */
-#define __USE_WRAPPER_TEMPLATE 0
+/* Do not use the type-generic wrapper templates if compatibility with
+   SVID error handling is needed.  */
+#include <math-svid-compat.h>
+#define __USE_WRAPPER_TEMPLATE !LIBM_SVID_COMPAT
 
 #endif
diff --git a/sysdeps/i386/fpu/w_sqrt.c b/sysdeps/i386/fpu/w_sqrt.c
new file mode 100644
index 0000000000..d37a5d55bf
--- /dev/null
+++ b/sysdeps/i386/fpu/w_sqrt.c
@@ -0,0 +1,9 @@
+/* The inline __ieee754_sqrt is not correctly rounding; it's OK for
+   most internal uses in glibc, but not for sqrt itself.  */
+#define __ieee754_sqrt __avoid_ieee754_sqrt
+#include <math.h>
+#include <math_private.h>
+#undef __ieee754_sqrt
+extern double __ieee754_sqrt (double);
+#include <math-type-macros-double.h>
+#include <w_sqrt_template.c>
diff --git a/sysdeps/ia64/fpu/w_acos.c b/sysdeps/ia64/fpu/w_acos.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_acos.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ia64/fpu/w_acosf.c b/sysdeps/ia64/fpu/w_acosf.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_acosf.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ia64/fpu/w_acosh.c b/sysdeps/ia64/fpu/w_acosh.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_acosh.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ia64/fpu/w_acoshf.c b/sysdeps/ia64/fpu/w_acoshf.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_acoshf.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ia64/fpu/w_acoshl.c b/sysdeps/ia64/fpu/w_acoshl.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_acoshl.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ia64/fpu/w_acosl.c b/sysdeps/ia64/fpu/w_acosl.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_acosl.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ia64/fpu/w_asin.c b/sysdeps/ia64/fpu/w_asin.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_asin.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ia64/fpu/w_asinf.c b/sysdeps/ia64/fpu/w_asinf.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_asinf.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ia64/fpu/w_asinl.c b/sysdeps/ia64/fpu/w_asinl.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_asinl.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ia64/fpu/w_atan2.c b/sysdeps/ia64/fpu/w_atan2.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_atan2.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ia64/fpu/w_atan2f.c b/sysdeps/ia64/fpu/w_atan2f.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_atan2f.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ia64/fpu/w_atan2l.c b/sysdeps/ia64/fpu/w_atan2l.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_atan2l.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ia64/fpu/w_atanh.c b/sysdeps/ia64/fpu/w_atanh.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_atanh.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ia64/fpu/w_atanhf.c b/sysdeps/ia64/fpu/w_atanhf.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_atanhf.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ia64/fpu/w_atanhl.c b/sysdeps/ia64/fpu/w_atanhl.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_atanhl.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ia64/fpu/w_cosh.c b/sysdeps/ia64/fpu/w_cosh.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_cosh.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ia64/fpu/w_coshf.c b/sysdeps/ia64/fpu/w_coshf.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_coshf.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ia64/fpu/w_coshl.c b/sysdeps/ia64/fpu/w_coshl.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_coshl.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ia64/fpu/w_exp.c b/sysdeps/ia64/fpu/w_exp.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_exp.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ia64/fpu/w_exp10.c b/sysdeps/ia64/fpu/w_exp10.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_exp10.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ia64/fpu/w_exp10f.c b/sysdeps/ia64/fpu/w_exp10f.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_exp10f.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ia64/fpu/w_exp10l.c b/sysdeps/ia64/fpu/w_exp10l.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_exp10l.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ia64/fpu/w_exp2.c b/sysdeps/ia64/fpu/w_exp2.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_exp2.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ia64/fpu/w_exp2f.c b/sysdeps/ia64/fpu/w_exp2f.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_exp2f.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ia64/fpu/w_exp2l.c b/sysdeps/ia64/fpu/w_exp2l.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_exp2l.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ia64/fpu/w_expf.c b/sysdeps/ia64/fpu/w_expf.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_expf.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ia64/fpu/w_expl.c b/sysdeps/ia64/fpu/w_expl.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_expl.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ia64/fpu/w_fmod.c b/sysdeps/ia64/fpu/w_fmod.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_fmod.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ia64/fpu/w_fmodf.c b/sysdeps/ia64/fpu/w_fmodf.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_fmodf.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ia64/fpu/w_fmodl.c b/sysdeps/ia64/fpu/w_fmodl.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_fmodl.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ia64/fpu/w_hypot.c b/sysdeps/ia64/fpu/w_hypot.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_hypot.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ia64/fpu/w_hypotf.c b/sysdeps/ia64/fpu/w_hypotf.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_hypotf.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ia64/fpu/w_hypotl.c b/sysdeps/ia64/fpu/w_hypotl.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_hypotl.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ia64/fpu/w_lgamma_r.c b/sysdeps/ia64/fpu/w_lgamma_r.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_lgamma_r.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ia64/fpu/w_lgammaf_r.c b/sysdeps/ia64/fpu/w_lgammaf_r.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_lgammaf_r.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ia64/fpu/w_lgammal_r.c b/sysdeps/ia64/fpu/w_lgammal_r.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_lgammal_r.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ia64/fpu/w_log.c b/sysdeps/ia64/fpu/w_log.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_log.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ia64/fpu/w_log10.c b/sysdeps/ia64/fpu/w_log10.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_log10.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ia64/fpu/w_log10f.c b/sysdeps/ia64/fpu/w_log10f.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_log10f.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ia64/fpu/w_log10l.c b/sysdeps/ia64/fpu/w_log10l.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_log10l.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ia64/fpu/w_log2.c b/sysdeps/ia64/fpu/w_log2.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_log2.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ia64/fpu/w_log2f.c b/sysdeps/ia64/fpu/w_log2f.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_log2f.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ia64/fpu/w_log2l.c b/sysdeps/ia64/fpu/w_log2l.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_log2l.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ia64/fpu/w_logf.c b/sysdeps/ia64/fpu/w_logf.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_logf.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ia64/fpu/w_logl.c b/sysdeps/ia64/fpu/w_logl.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_logl.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ia64/fpu/w_pow.c b/sysdeps/ia64/fpu/w_pow.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_pow.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ia64/fpu/w_powf.c b/sysdeps/ia64/fpu/w_powf.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_powf.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ia64/fpu/w_powl.c b/sysdeps/ia64/fpu/w_powl.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_powl.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ia64/fpu/w_remainder.c b/sysdeps/ia64/fpu/w_remainder.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_remainder.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ia64/fpu/w_remainderf.c b/sysdeps/ia64/fpu/w_remainderf.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_remainderf.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ia64/fpu/w_remainderl.c b/sysdeps/ia64/fpu/w_remainderl.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_remainderl.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ia64/fpu/w_sinh.c b/sysdeps/ia64/fpu/w_sinh.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_sinh.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ia64/fpu/w_sinhf.c b/sysdeps/ia64/fpu/w_sinhf.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_sinhf.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ia64/fpu/w_sinhl.c b/sysdeps/ia64/fpu/w_sinhl.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_sinhl.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ia64/fpu/w_sqrt.c b/sysdeps/ia64/fpu/w_sqrt.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_sqrt.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ia64/fpu/w_sqrtf.c b/sysdeps/ia64/fpu/w_sqrtf.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_sqrtf.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ia64/fpu/w_sqrtl.c b/sysdeps/ia64/fpu/w_sqrtl.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_sqrtl.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ia64/fpu/w_tgamma.c b/sysdeps/ia64/fpu/w_tgamma.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_tgamma.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ia64/fpu/w_tgammaf.c b/sysdeps/ia64/fpu/w_tgammaf.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_tgammaf.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ia64/fpu/w_tgammal.c b/sysdeps/ia64/fpu/w_tgammal.c
new file mode 100644
index 0000000000..1cc8931700
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_tgammal.c
@@ -0,0 +1 @@
+/* Not needed.  */
diff --git a/sysdeps/ieee754/dbl-64/w_exp_compat.c b/sysdeps/ieee754/dbl-64/w_exp_compat.c
index 69ec0a1ebc..98aa5b76a0 100644
--- a/sysdeps/ieee754/dbl-64/w_exp_compat.c
+++ b/sysdeps/ieee754/dbl-64/w_exp_compat.c
@@ -20,6 +20,7 @@
 #include <math_private.h>
 #include <math-svid-compat.h>
 
+#if LIBM_SVID_COMPAT
 /* wrapper exp */
 double
 __exp (double x)
@@ -33,7 +34,8 @@ __exp (double x)
 }
 hidden_def (__exp)
 weak_alias (__exp, exp)
-#ifdef NO_LONG_DOUBLE
+# ifdef NO_LONG_DOUBLE
 strong_alias (__exp, __expl)
 weak_alias (__exp, expl)
+# endif
 #endif
diff --git a/sysdeps/ieee754/flt-32/w_expf_compat.c b/sysdeps/ieee754/flt-32/w_expf_compat.c
index 8a1fa51e46..a38ff4082d 100644
--- a/sysdeps/ieee754/flt-32/w_expf_compat.c
+++ b/sysdeps/ieee754/flt-32/w_expf_compat.c
@@ -20,6 +20,7 @@
 #include <math_private.h>
 #include <math-svid-compat.h>
 
+#if LIBM_SVID_COMPAT
 /* wrapper expf */
 float
 __expf (float x)
@@ -33,3 +34,4 @@ __expf (float x)
 }
 hidden_def (__expf)
 weak_alias (__expf, expf)
+#endif
diff --git a/sysdeps/ieee754/k_standard.c b/sysdeps/ieee754/k_standard.c
index 8f906bd604..f74f9c712e 100644
--- a/sysdeps/ieee754/k_standard.c
+++ b/sysdeps/ieee754/k_standard.c
@@ -21,23 +21,25 @@ static char rcsid[] = "$NetBSD: k_standard.c,v 1.6 1995/05/10 20:46:35 jtc Exp $
 
 #include <assert.h>
 
-#ifndef _USE_WRITE
-#include <stdio.h>			/* fputs(), stderr */
-#define	WRITE2(u,v)	fputs(u, stderr)
-#else	/* !defined(_USE_WRITE) */
-#include <unistd.h>			/* write */
-#define	WRITE2(u,v)	write(2, u, v)
-#undef fflush
-#endif	/* !defined(_USE_WRITE) */
+#if LIBM_SVID_COMPAT
+
+# ifndef _USE_WRITE
+#  include <stdio.h>			/* fputs(), stderr */
+#  define	WRITE2(u,v)	fputs(u, stderr)
+# else	/* !defined(_USE_WRITE) */
+#  include <unistd.h>			/* write */
+#  define	WRITE2(u,v)	write(2, u, v)
+#  undef fflush
+# endif	/* !defined(_USE_WRITE) */
 
 /* XXX gcc versions until now don't delay the 0.0/0.0 division until
    runtime but produce NaN at compile time.  This is wrong since the
    exceptions are not set correctly.  */
-#if 0
+# if 0
 static const double zero = 0.0;	/* used as const */
-#else
+# else
 static double zero = 0.0;	/* used as const */
-#endif
+# endif
 
 /*
  * Standard conformance (non-IEEE) on exception cases.
@@ -97,21 +99,21 @@ double
 __kernel_standard(double x, double y, int type)
 {
 	struct exception exc;
-#ifndef HUGE_VAL	/* this is the only routine that uses HUGE_VAL */
-#define HUGE_VAL inf
+# ifndef HUGE_VAL	/* this is the only routine that uses HUGE_VAL */
+# define HUGE_VAL inf
 	double inf = 0.0;
 
 	SET_HIGH_WORD(inf,0x7ff00000);	/* set inf to infinite */
-#endif
+# endif
 
 	/* The SVID struct exception uses a field "char *name;".  */
-#define CSTR(func) ((char *) (type < 100				\
+# define CSTR(func) ((char *) (type < 100				\
 			      ? func					\
 			      : (type < 200 ? func "f" : func "l")))
 
-#ifdef _USE_WRITE
+# ifdef _USE_WRITE
 	(void) fflush(stdout);
-#endif
+# endif
 	exc.arg1 = x;
 	exc.arg2 = y;
 	switch(type) {
@@ -945,3 +947,4 @@ __kernel_standard(double x, double y, int type)
 	}
 	return exc.retval;
 }
+#endif
diff --git a/sysdeps/ieee754/k_standardf.c b/sysdeps/ieee754/k_standardf.c
index 85b2003daf..62d25d22db 100644
--- a/sysdeps/ieee754/k_standardf.c
+++ b/sysdeps/ieee754/k_standardf.c
@@ -21,6 +21,7 @@
 #include <math-svid-compat.h>
 
 
+#if LIBM_SVID_COMPAT
 /* Handle errors for a libm function as specified by TYPE (see
    comments in k_standard.c for details), with arguments X and Y,
    returning the appropriate return value for that function.  */
@@ -30,3 +31,4 @@ __kernel_standard_f (float x, float y, int type)
 {
   return __kernel_standard (x, y, type);
 }
+#endif
diff --git a/sysdeps/ieee754/k_standardl.c b/sysdeps/ieee754/k_standardl.c
index 783fd0b87d..484ec91354 100644
--- a/sysdeps/ieee754/k_standardl.c
+++ b/sysdeps/ieee754/k_standardl.c
@@ -38,6 +38,8 @@
 #include <errno.h>
 
 
+#if LIBM_SVID_COMPAT
+
 static double zero = 0.0;
 
 /* Handle errors for a libm function as specified by TYPE (see
@@ -106,3 +108,4 @@ __kernel_standard_l (long double x, long double y, int type)
       return __kernel_standard (dx, dy, type);
     }
 }
+#endif
diff --git a/sysdeps/ieee754/ldbl-128/w_expl_compat.c b/sysdeps/ieee754/ldbl-128/w_expl_compat.c
index e0fa9e3501..ec076deaad 100644
--- a/sysdeps/ieee754/ldbl-128/w_expl_compat.c
+++ b/sysdeps/ieee754/ldbl-128/w_expl_compat.c
@@ -26,18 +26,20 @@ static char rcsid[] = "$NetBSD: $";
 #include <math_private.h>
 #include <math-svid-compat.h>
 
+#if LIBM_SVID_COMPAT
 long double __expl(long double x)	/* wrapper exp */
 {
-#ifdef _IEEE_LIBM
+# ifdef _IEEE_LIBM
 	return __ieee754_expl(x);
-#else
+# else
 	long double z = __ieee754_expl (x);
 	if (__glibc_unlikely (!isfinite (z) || z == 0)
 	    && isfinite (x) && _LIB_VERSION != _IEEE_)
 	  return __kernel_standard_l (x, x, 206 + !!signbit (x));
 
 	return z;
-#endif
+# endif
 }
 hidden_def (__expl)
 weak_alias (__expl, expl)
+#endif
diff --git a/sysdeps/ieee754/ldbl-128ibm/w_expl_compat.c b/sysdeps/ieee754/ldbl-128ibm/w_expl_compat.c
index 019a48fb0d..53948a96e6 100644
--- a/sysdeps/ieee754/ldbl-128ibm/w_expl_compat.c
+++ b/sysdeps/ieee754/ldbl-128ibm/w_expl_compat.c
@@ -3,6 +3,7 @@
 #include <math-svid-compat.h>
 #include <math_ldbl_opt.h>
 
+#if LIBM_SVID_COMPAT
 long double __expl(long double x)	/* wrapper exp  */
 {
   long double z;
@@ -20,3 +21,4 @@ long double __expl(long double x)	/* wrapper exp  */
 }
 hidden_def (__expl)
 long_double_symbol (libm, __expl, expl);
+#endif
diff --git a/sysdeps/ieee754/ldbl-64-128/w_expl_compat.c b/sysdeps/ieee754/ldbl-64-128/w_expl_compat.c
index 37c153e2a4..037e8bf348 100644
--- a/sysdeps/ieee754/ldbl-64-128/w_expl_compat.c
+++ b/sysdeps/ieee754/ldbl-64-128/w_expl_compat.c
@@ -2,4 +2,6 @@
 #undef weak_alias
 #define weak_alias(n,a)
 #include <sysdeps/ieee754/ldbl-128/w_expl_compat.c>
+#if LIBM_SVID_COMPAT
 long_double_symbol (libm, __expl, expl);
+#endif
diff --git a/sysdeps/ieee754/ldbl-96/w_expl_compat.c b/sysdeps/ieee754/ldbl-96/w_expl_compat.c
index c9e6003a43..ae9ab586cb 100644
--- a/sysdeps/ieee754/ldbl-96/w_expl_compat.c
+++ b/sysdeps/ieee754/ldbl-96/w_expl_compat.c
@@ -20,6 +20,7 @@
 #include <math_private.h>
 #include <math-svid-compat.h>
 
+#if LIBM_SVID_COMPAT
 /* wrapper expl */
 long double
 __expl (long double x)
@@ -33,3 +34,4 @@ __expl (long double x)
 }
 hidden_def (__expl)
 weak_alias (__expl, expl)
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_acoshl_compat.c b/sysdeps/ieee754/ldbl-opt/w_acoshl_compat.c
index df4338d9fa..f66964a138 100644
--- a/sysdeps/ieee754/ldbl-opt/w_acoshl_compat.c
+++ b/sysdeps/ieee754/ldbl-opt/w_acoshl_compat.c
@@ -2,4 +2,6 @@
 #undef weak_alias
 #define weak_alias(n,a)
 #include <math/w_acoshl_compat.c>
+#if LIBM_SVID_COMPAT
 long_double_symbol (libm, __acoshl, acoshl);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_acosl_compat.c b/sysdeps/ieee754/ldbl-opt/w_acosl_compat.c
index 5efc99024c..ff33e9a9ed 100644
--- a/sysdeps/ieee754/ldbl-opt/w_acosl_compat.c
+++ b/sysdeps/ieee754/ldbl-opt/w_acosl_compat.c
@@ -2,4 +2,6 @@
 #undef weak_alias
 #define weak_alias(n,a)
 #include <math/w_acosl_compat.c>
+#if LIBM_SVID_COMPAT
 long_double_symbol (libm, __acosl, acosl);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_asinl_compat.c b/sysdeps/ieee754/ldbl-opt/w_asinl_compat.c
index 087fab25bb..a53f1cb1f5 100644
--- a/sysdeps/ieee754/ldbl-opt/w_asinl_compat.c
+++ b/sysdeps/ieee754/ldbl-opt/w_asinl_compat.c
@@ -2,4 +2,6 @@
 #undef weak_alias
 #define weak_alias(n,a)
 #include <math/w_asinl_compat.c>
+#if LIBM_SVID_COMPAT
 long_double_symbol (libm, __asinl, asinl);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_atan2l_compat.c b/sysdeps/ieee754/ldbl-opt/w_atan2l_compat.c
index 6b12209625..c70f77e4c4 100644
--- a/sysdeps/ieee754/ldbl-opt/w_atan2l_compat.c
+++ b/sysdeps/ieee754/ldbl-opt/w_atan2l_compat.c
@@ -2,4 +2,6 @@
 #undef weak_alias
 #define weak_alias(n,a)
 #include <math/w_atan2l_compat.c>
+#if LIBM_SVID_COMPAT
 long_double_symbol (libm, __atan2l, atan2l);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_atanhl_compat.c b/sysdeps/ieee754/ldbl-opt/w_atanhl_compat.c
index 49bae1ee8f..67450c5859 100644
--- a/sysdeps/ieee754/ldbl-opt/w_atanhl_compat.c
+++ b/sysdeps/ieee754/ldbl-opt/w_atanhl_compat.c
@@ -2,4 +2,6 @@
 #undef weak_alias
 #define weak_alias(n,a)
 #include <math/w_atanhl_compat.c>
+#if LIBM_SVID_COMPAT
 long_double_symbol (libm, __atanhl, atanhl);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_coshl_compat.c b/sysdeps/ieee754/ldbl-opt/w_coshl_compat.c
index a8808778ba..392511bab6 100644
--- a/sysdeps/ieee754/ldbl-opt/w_coshl_compat.c
+++ b/sysdeps/ieee754/ldbl-opt/w_coshl_compat.c
@@ -2,4 +2,6 @@
 #undef weak_alias
 #define weak_alias(n,a)
 #include <math/w_coshl_compat.c>
+#if LIBM_SVID_COMPAT
 long_double_symbol (libm, __coshl, coshl);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_exp10l_compat.c b/sysdeps/ieee754/ldbl-opt/w_exp10l_compat.c
index cf154882fe..5a52a75ba5 100644
--- a/sysdeps/ieee754/ldbl-opt/w_exp10l_compat.c
+++ b/sysdeps/ieee754/ldbl-opt/w_exp10l_compat.c
@@ -4,15 +4,17 @@
 #undef compat_symbol
 #define compat_symbol(l,n,a,v)
 #include <math/w_exp10l_compat.c>
+#if LIBM_SVID_COMPAT
 long_double_symbol (libm, __exp10l, exp10l);
-#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_27)
+# if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_27)
 /* compat_symbol was undefined and redefined above to avoid the
    default pow10l compat symbol at version GLIBC_2_1 (as for ldbl-opt
    configurations, that version should have the alias to exp10).  So
    it now needs to be redefined to define the compat symbol at version
    LONG_DOUBLE_COMPAT_VERSION.  */
-# undef compat_symbol
-# define compat_symbol(lib, local, symbol, version)	\
+#  undef compat_symbol
+#  define compat_symbol(lib, local, symbol, version)	\
   compat_symbol_reference (lib, local, symbol, version)
 compat_symbol (libm, __pow10l, pow10l, LONG_DOUBLE_COMPAT_VERSION);
+# endif
 #endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_fmodl_compat.c b/sysdeps/ieee754/ldbl-opt/w_fmodl_compat.c
index 88fe0ac4d2..12419e3060 100644
--- a/sysdeps/ieee754/ldbl-opt/w_fmodl_compat.c
+++ b/sysdeps/ieee754/ldbl-opt/w_fmodl_compat.c
@@ -2,4 +2,6 @@
 #undef weak_alias
 #define weak_alias(n,a)
 #include <math/w_fmodl_compat.c>
+#if LIBM_SVID_COMPAT
 long_double_symbol (libm, __fmodl, fmodl);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_hypotl_compat.c b/sysdeps/ieee754/ldbl-opt/w_hypotl_compat.c
index 68e3997489..b87bac7ce8 100644
--- a/sysdeps/ieee754/ldbl-opt/w_hypotl_compat.c
+++ b/sysdeps/ieee754/ldbl-opt/w_hypotl_compat.c
@@ -2,4 +2,6 @@
 #undef weak_alias
 #define weak_alias(n,a)
 #include <math/w_hypotl_compat.c>
+#if LIBM_SVID_COMPAT
 long_double_symbol (libm, __hypotl, hypotl);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_j0l_compat.c b/sysdeps/ieee754/ldbl-opt/w_j0l_compat.c
index 9050657e03..8fc865128d 100644
--- a/sysdeps/ieee754/ldbl-opt/w_j0l_compat.c
+++ b/sysdeps/ieee754/ldbl-opt/w_j0l_compat.c
@@ -2,5 +2,7 @@
 #undef weak_alias
 #define weak_alias(n,a)
 #include <math/w_j0l_compat.c>
+#if LIBM_SVID_COMPAT
 long_double_symbol (libm, __j0l, j0l);
 long_double_symbol (libm, __y0l, y0l);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_j1l_compat.c b/sysdeps/ieee754/ldbl-opt/w_j1l_compat.c
index 4ed9e2dd12..85b3feed9f 100644
--- a/sysdeps/ieee754/ldbl-opt/w_j1l_compat.c
+++ b/sysdeps/ieee754/ldbl-opt/w_j1l_compat.c
@@ -2,5 +2,7 @@
 #undef weak_alias
 #define weak_alias(n,a)
 #include <math/w_j1l_compat.c>
+#if LIBM_SVID_COMPAT
 long_double_symbol (libm, __j1l, j1l);
 long_double_symbol (libm, __y1l, y1l);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_jnl_compat.c b/sysdeps/ieee754/ldbl-opt/w_jnl_compat.c
index d22ee54997..9b2c998536 100644
--- a/sysdeps/ieee754/ldbl-opt/w_jnl_compat.c
+++ b/sysdeps/ieee754/ldbl-opt/w_jnl_compat.c
@@ -2,5 +2,7 @@
 #undef weak_alias
 #define weak_alias(n,a)
 #include <math/w_jnl_compat.c>
+#if LIBM_SVID_COMPAT
 long_double_symbol (libm, __jnl, jnl);
 long_double_symbol (libm, __ynl, ynl);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_lgammal_r_compat.c b/sysdeps/ieee754/ldbl-opt/w_lgammal_r_compat.c
index 6fdf2bba87..431aa5d15c 100644
--- a/sysdeps/ieee754/ldbl-opt/w_lgammal_r_compat.c
+++ b/sysdeps/ieee754/ldbl-opt/w_lgammal_r_compat.c
@@ -2,4 +2,6 @@
 #undef weak_alias
 #define weak_alias(n,a)
 #include <math/w_lgammal_r_compat.c>
+#if LIBM_SVID_COMPAT
 long_double_symbol (libm, __lgammal_r, lgammal_r);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_log10l_compat.c b/sysdeps/ieee754/ldbl-opt/w_log10l_compat.c
index 17de3e7856..6eb9ea7928 100644
--- a/sysdeps/ieee754/ldbl-opt/w_log10l_compat.c
+++ b/sysdeps/ieee754/ldbl-opt/w_log10l_compat.c
@@ -2,4 +2,6 @@
 #undef weak_alias
 #define weak_alias(n,a)
 #include <math/w_log10l_compat.c>
+#if LIBM_SVID_COMPAT
 long_double_symbol (libm, __log10l, log10l);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_log2l_compat.c b/sysdeps/ieee754/ldbl-opt/w_log2l_compat.c
index 3c5e734573..1507e937b8 100644
--- a/sysdeps/ieee754/ldbl-opt/w_log2l_compat.c
+++ b/sysdeps/ieee754/ldbl-opt/w_log2l_compat.c
@@ -2,4 +2,6 @@
 #undef weak_alias
 #define weak_alias(n,a)
 #include <math/w_log2l_compat.c>
+#if LIBM_SVID_COMPAT
 long_double_symbol (libm, __log2l, log2l);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_logl_compat.c b/sysdeps/ieee754/ldbl-opt/w_logl_compat.c
index 2b55842139..6b71ef2659 100644
--- a/sysdeps/ieee754/ldbl-opt/w_logl_compat.c
+++ b/sysdeps/ieee754/ldbl-opt/w_logl_compat.c
@@ -2,4 +2,6 @@
 #undef weak_alias
 #define weak_alias(n,a)
 #include <math/w_logl_compat.c>
+#if LIBM_SVID_COMPAT
 long_double_symbol (libm, __logl, logl);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_powl_compat.c b/sysdeps/ieee754/ldbl-opt/w_powl_compat.c
index 1897cf1c63..c6f8d859be 100644
--- a/sysdeps/ieee754/ldbl-opt/w_powl_compat.c
+++ b/sysdeps/ieee754/ldbl-opt/w_powl_compat.c
@@ -2,4 +2,6 @@
 #undef weak_alias
 #define weak_alias(n,a)
 #include <math/w_powl_compat.c>
+#if LIBM_SVID_COMPAT
 long_double_symbol (libm, __powl, powl);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_remainderl_compat.c b/sysdeps/ieee754/ldbl-opt/w_remainderl_compat.c
index b2ce5c9563..849d2db425 100644
--- a/sysdeps/ieee754/ldbl-opt/w_remainderl_compat.c
+++ b/sysdeps/ieee754/ldbl-opt/w_remainderl_compat.c
@@ -2,6 +2,8 @@
 #undef weak_alias
 #define weak_alias(n,a)
 #include <math/w_remainderl_compat.c>
+#if LIBM_SVID_COMPAT
 long_double_symbol (libm, __remainderl, remainderl);
 strong_alias (__remainderl, __dreml)
 long_double_symbol (libm, __dreml, dreml);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_sinhl_compat.c b/sysdeps/ieee754/ldbl-opt/w_sinhl_compat.c
index 305ed82357..8fce55c74f 100644
--- a/sysdeps/ieee754/ldbl-opt/w_sinhl_compat.c
+++ b/sysdeps/ieee754/ldbl-opt/w_sinhl_compat.c
@@ -2,4 +2,6 @@
 #undef weak_alias
 #define weak_alias(n,a)
 #include <math/w_sinhl_compat.c>
+#if LIBM_SVID_COMPAT
 long_double_symbol (libm, __sinhl, sinhl);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_sqrtl_compat.c b/sysdeps/ieee754/ldbl-opt/w_sqrtl_compat.c
index 1e4526f2c6..05be917772 100644
--- a/sysdeps/ieee754/ldbl-opt/w_sqrtl_compat.c
+++ b/sysdeps/ieee754/ldbl-opt/w_sqrtl_compat.c
@@ -2,4 +2,6 @@
 #undef weak_alias
 #define weak_alias(n,a)
 #include <math/w_sqrtl_compat.c>
+#if LIBM_SVID_COMPAT
 long_double_symbol (libm, __sqrtl, sqrtl);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_tgammal_compat.c b/sysdeps/ieee754/ldbl-opt/w_tgammal_compat.c
index aaf5403522..8c201ca8e2 100644
--- a/sysdeps/ieee754/ldbl-opt/w_tgammal_compat.c
+++ b/sysdeps/ieee754/ldbl-opt/w_tgammal_compat.c
@@ -2,4 +2,6 @@
 #undef weak_alias
 #define weak_alias(n,a)
 #include <math/w_tgammal_compat.c>
+#if LIBM_SVID_COMPAT
 long_double_symbol (libm, __tgammal, tgammal);
+#endif