From 78ae652613d55eaf32426c08d83b67e20caa09e9 Mon Sep 17 00:00:00 2001 From: Robert Izzard <r.izzard@surrey.ac.uk> Date: Sat, 7 Dec 2019 20:43:05 +0000 Subject: [PATCH] update meson.build for 32-bit build problems on RPi4 * fix FILE_OFFSET_BITS check * fix FPU check --- meson.build | 43 +++++++++++++++++++++++++++++----- src/binary_c_function_macros.h | 7 ++++-- tbse | 2 -- 3 files changed, 42 insertions(+), 10 deletions(-) diff --git a/meson.build b/meson.build index 26949b990..d618c2c43 100644 --- a/meson.build +++ b/meson.build @@ -340,15 +340,46 @@ else endif ############################################################ -# 64- or 32-bit build -# -if compiler.compiles('int main(int argc,char **argv){return 0;}', - args : '-m64', - name : '64-bit check') +# 64- or 32-bit file offset +# +if compiler.compiles(''' +#include <fts.h> +int main(int argc,char **argv){return 0;} +''', + args : '-D_FILE_OFFSET_BITS=64', + name : '_FILE_OFFSET_BITS=64 check') # 64-bit system cflags += '-D_FILE_OFFSET_BITS=64' + message('_FILE_OFFSET_BITS=64') +else + cflags += '-U_FILE_OFFSET_BITS' + message('_FILE_OFFSET_BITS disabled') +endif + +############################################################ +# check for FPU precision control +# +if compiler.compiles(''' +#include <fpu_control.h> +int main(int argc,char **argv) +{ + fpu_control_t fpu_oldcw,fpu_cw; + _FPU_GETCW(fpu_oldcw); + fpu_cw = (fpu_oldcw & + ~ _FPU_EXTENDED & + ~ _FPU_DOUBLE & + ~ _FPU_SINGLE) | + _FPU_DOUBLE; + _FPU_SETCW(fpu_cw); +return 0; +} +''', + args : '-lm', + name : 'FPU control check') + message('Enabled FPU control on this CPU') else - # assume 32-bit system + cflags += '-DNO_FPU_CONTROL' + message('Disabled FPU control on this CPU') endif ############################################################ diff --git a/src/binary_c_function_macros.h b/src/binary_c_function_macros.h index 7f4fee6bc..c27f8453c 100644 --- a/src/binary_c_function_macros.h +++ b/src/binary_c_function_macros.h @@ -33,7 +33,10 @@ * Floating point precision : * http://christian-seiler.de/projekte/fpmath/ */ -#if defined FPU_PRECISION && !defined NO_FPU_CONTROL +#if defined FPU_PRECISION && \ + !defined NO_FPU_CONTROL && \ + defined _FPU_EXTENDED + #define Set_FPU_precision fpu_control_t fpu_oldcw,fpu_cw; \ _FPU_GETCW(fpu_oldcw); \ fpu_cw = (fpu_oldcw & \ @@ -42,7 +45,7 @@ ~ _FPU_SINGLE) | \ _FPU_DOUBLE; \ _FPU_SETCW(fpu_cw); - +pats #else #define Set_FPU_precision /* */ #endif // FPU_PRECISION diff --git a/tbse b/tbse index a8db32bd0..54dd004dd 100755 --- a/tbse +++ b/tbse @@ -2172,7 +2172,6 @@ $TIMESTEP_MULTIPLIERS \ --nova_timestep_accelerator_num $NOVA_TIMESTEP_ACCELERATOR_NUM \ --nova_timestep_accelerator_index $NOVA_TIMESTEP_ACCELERATOR_INDEX \ --nova_timestep_accelerator_max $NOVA_TIMESTEP_ACCELERATOR_MAX \ - "; # valgrind options @@ -2391,7 +2390,6 @@ else ARGS="$DEFAULT_ARGS $*" fi - if [ "$RUNMODE" == "echo" ]; then # print out the current arguments (in one line) and exit -- GitLab