X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fmain.cc;h=759091ee11f4adc11b72bde8aeaa26d6d2c94365;hb=5db2447d084320c092768bb7c5683f76e10e4a8a;hp=3c0f7ae88eb7a4f28a065d1555ff4ffcf9c07aa9;hpb=e93e62137f606881f3e1350423734523b9812673;p=lilypond.git diff --git a/lily/main.cc b/lily/main.cc index 3c0f7ae88e..759091ee11 100644 --- a/lily/main.cc +++ b/lily/main.cc @@ -166,6 +166,29 @@ static Long_option_init options_static[] char const *LILYPOND_DATADIR = PACKAGE_DATADIR "/" TOPLEVEL_VERSION; + +/* x86 defaults to using 80-bit extended precision arithmetic. This can cause + problems because the truncation from 80 bits to 64 bits can occur in + unpredictable places. To get around this, we tell the x87 FPU to use only + double precision. Note that this is not needed for x86_64 because that uses + the SSE unit by default instead of the x87 FPU. */ +#if ((defined(__x86__) || defined(__i386__)) \ + && defined(HAVE_FPU_CONTROL_H) && (HAVE_FPU_CONTROL_H == 1)) + +#include +static void configure_fpu() { + fpu_control_t fpu_control = 0x027f; + _FPU_SETCW (fpu_control); +} + +#else + +static void configure_fpu() { +} + +#endif /* defined(__x86__) || defined(__i386__) */ + + static void env_var_info (FILE *out, char const *key) { @@ -217,9 +240,10 @@ static void notice () { identify (stdout); - puts (_f (NOTICE, PROGRAM_NAME).c_str ()); printf ("\n"); copyright (); + printf ("\n"); + puts (_f (NOTICE, PROGRAM_NAME).c_str ()); } LY_DEFINE (ly_usage, "ly:usage", @@ -534,7 +558,6 @@ parse_argv (int argc, char **argv) if (show_help) { - identify (stdout); ly_usage (); if (be_verbose_global) dir_info (stdout); @@ -569,6 +592,8 @@ vector start_environment_global; int main (int argc, char **argv, char **envp) { + configure_fpu(); + for (char **p = envp; *p; p++) start_environment_global.push_back(*p);