[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Porting the module 'fenv-environment'
|
From: |
Bruno Haible |
|
Subject: |
Porting the module 'fenv-environment' |
|
Date: |
Sun, 05 Nov 2023 16:03:10 +0100 |
Since the module 'fenv-environment' is likely to need workarounds on
future platforms, here is the best procedure to do so. It works even on
proprietary systems like macOS, AIX, MSVC.
1) Prepare a testdir of the relevant modules:
$ ./gnulib-tool --create-testdir --dir=../testdir4 --single-configure \
fenv-rounding \
fenv-exceptions-tracking-c23 \
fenv-exceptions-state-c23 \
fenv-exceptions-trapping \
fenv-environment
2) Compile it on any platform, with configure option -C, to see which
autoconf cache variables are available:
$ ./configure -C; grep gl_cv_func_fe config.cache
gl_cv_func_feenableexcept_in_libm=${gl_cv_func_feenableexcept_in_libm=yes}
gl_cv_func_feenableexcept_no_libm=${gl_cv_func_feenableexcept_no_libm=no}
gl_cv_func_fegetenv_works=${gl_cv_func_fegetenv_works='guessing yes'}
gl_cv_func_feholdexcept_works=${gl_cv_func_feholdexcept_works='guessing yes'}
gl_cv_func_feraiseexcept_in_libm=${gl_cv_func_feraiseexcept_in_libm=yes}
gl_cv_func_feraiseexcept_no_libm=${gl_cv_func_feraiseexcept_no_libm=no}
gl_cv_func_fesetenv_in_libm=${gl_cv_func_fesetenv_in_libm=yes}
gl_cv_func_fesetenv_no_libm=${gl_cv_func_fesetenv_no_libm=no}
gl_cv_func_fesetenv_works=${gl_cv_func_fesetenv_works='guessing yes'}
gl_cv_func_fesetexcept_in_libm=${gl_cv_func_fesetexcept_in_libm=yes}
gl_cv_func_fesetexcept_no_libm=${gl_cv_func_fesetexcept_no_libm=no}
gl_cv_func_fesetexcept_works=${gl_cv_func_fesetexcept_works=yes}
gl_cv_func_fesetexceptflag_in_libm=${gl_cv_func_fesetexceptflag_in_libm=yes}
gl_cv_func_fesetexceptflag_no_libm=${gl_cv_func_fesetexceptflag_no_libm=no}
gl_cv_func_fesetexceptflag_works1=${gl_cv_func_fesetexceptflag_works1=no}
gl_cv_func_fesetexceptflag_works2=${gl_cv_func_fesetexceptflag_works2=yes}
gl_cv_func_fesetround_in_libm=${gl_cv_func_fesetround_in_libm=yes}
gl_cv_func_fesetround_no_libm=${gl_cv_func_fesetround_no_libm=no}
gl_cv_func_fesetround_works=${gl_cv_func_fesetround_works='guessing yes'}
gl_cv_func_fetestexceptflag_in_libm=${gl_cv_func_fetestexceptflag_in_libm=yes}
gl_cv_func_fetestexceptflag_no_libm=${gl_cv_func_fetestexceptflag_no_libm=no}
gl_cv_func_feupdateenv_works=${gl_cv_func_feupdateenv_works='guessing yes'}
Here, the most useful among these variables are the *_works* variables:
gl_cv_func_fegetenv_works
gl_cv_func_feholdexcept_works
gl_cv_func_fesetenv_works
gl_cv_func_feupdateenv_works
3) Build the testdir on the target platform, and look at the test failures.
4) If there are test failures in other modules, that is, in the
fenv-rounding tests, fenv-exceptions-tracking* tests, or
fenv-exceptions-trapping tests, fix them first.
This is necessary because the fenv-environment tests depend on
fenv-rounding, fenv-exceptions-tracking*, and fenv-exceptions-trapping.
5) Find the minimal set of
gl_cv_func_fegetenv_works=no
gl_cv_func_feholdexcept_works=no
gl_cv_func_fesetenv_works=no
gl_cv_func_feupdateenv_works=no
assignments such that all unit tests pass.
Start with all assignments together:
make distclean; \
gl_cv_func_fegetenv_works=no \
gl_cv_func_feholdexcept_works=no \
gl_cv_func_fesetenv_works=no \
gl_cv_func_feupdateenv_works=no \
./configure -C && make && make check
Note that because fegetenv and fesetenv are currently implemented in the
same compilation unit, gl_cv_func_fegetenv_works=no and
gl_cv_func_fesetenv_works=no are currently equivalent. That is, you need
only one of these two; the other one is implied.
6) When you have found this minimal set, then for each of these assignments:
- Reconfigure with this one =yes instead of =no.
- Look at the test failures. This tells you what is wrong with that
function.
Bruno