<div dir="ltr"><div class="gmail_quote">We are having an issue within Debian to compile ilmbase. We are still using autotool (instead of cmake). And it currently fails to compile on kFreeBSD (FreeBSD kernel with GNU userland).<br><br>It seems to me that the autoconf macro is currently broken or at least is not doing what it should. As explained below, FreeBSD people are using the cmake based build system and everything is fine (ILMBASE_HAVE_CONTROL_REGISTER_SUPPORT is always defined).</div><div class="gmail_quote">However for us, the autoconf macro fails to detect ILMBASE_HAVE_CONTROL_REGISTER_SUPPORT and therefore is not defined, which lead to code that does not compile.</div><div class="gmail_quote"><br></div><div class="gmail_quote">Could someone with more background on ILMBASE_HAVE_CONTROL_REGISTER_SUPPORT and autoconf, please comment on the issue.</div><div class="gmail_quote"><br></div><div class="gmail_quote">Thanks.<br><br>On 2015-07-22 Steven Chamberlain <<a href="mailto:steven@pyro.eu.org">steven@pyro.eu.org</a>> wrote:<br>
[...]<br>
<span class="">> I see that FreeBSD Ports has ilmbase-2.20 and succeeded building<br>
> libIexMath, yet they don't seem to have patched this source file.<br>
> I should try building it on a real FreeBSD system, to compare the<br>
> build log with that of a GNU/kFreeBSD system.<br>
<br>
</span>IexMath/IexMathFpu.cpp<br>
static inline void<br>
setCw (uint16_t cw)<br>
{<br>
    asm volatile ("fldcw %0" : : "m" (cw) );<br>
}<br>
[...]<br>
static inline void<br>
setMxcsr (uint32_t mxcsr, bool clearExceptions)<br>
{<br>
    mxcsr &= clearExceptions ? 0xffffffc0 : 0xffffffff;<br>
    asm volatile ("ldmxcsr %0" : : "m" (mxcsr) );<br>
}<br>
<br>
[...]<br>
#ifdef ILMBASE_HAVE_CONTROL_REGISTER_SUPPORT<br>
<br>
inline void<br>
restoreControlRegs (const ucontext_t & ucon, bool clearExceptions)<br>
{<br>
    setCw ((ucon.uc_mcontext.fpregs->cwd & cwRestoreMask) | cwRestoreVal);<br>
    setMxcsr (ucon.uc_mcontext.fpregs->mxcsr, clearExceptions);<br>
}<br>
<br>
#else<br>
[ the failing code ]<br>
<br>
and while autoconf tests for ILMBASE_HAVE_CONTROL_REGISTER_SUPPORT<br>
with<br>
--------------------------------<br>
AC_MSG_CHECKING(for fpe support handling)<br>
control_register_support="no"<br>
AC_TRY_COMPILE([<br>
#include <stdint.h><br>
#include <ucontext.h><br>
],[<br>
    ucontext_t ucon;<br>
<span class="">    uint32_t mxcsr = ucon.uc_mcontext.fpregs->mxcsr;<br>
</span>    uint16_t cw    = ucon.uc_mcontext.fpregs->cwd;<br>
<br>
],<br>
AC_DEFINE(ILMBASE_HAVE_CONTROL_REGISTER_SUPPORT) control_register_support=yes)<br>
AC_MSG_RESULT($control_register_support)<br>
--------------------------------<br>
This test fails on kfreebsd-x (and also on e.g. i386).<br>
<br>
<br>
the respective part of the cmake setup simply looks like this:<br>
IF (WIN32)<br>
[...]<br>
ELSE ()<br>
  IF (APPLE)<br>
[...]<br>
  ELSE ()<br>
    FILE ( APPEND ${CMAKE_CURRENT_BINARY_DIR}/config/IlmBaseConfig.h "#define ILMBASE_HAVE_CONTROL_REGISTER_SUPPORT 1\n")<br>
  ENDIF ()<br>
ENDIF ()<br>
<br>
FreeBSD Ports uses cmake instead of autoconf (which Debian uses) and<br>
therefore ILMBASE_HAVE_CONTROL_REGISTER_SUPPORT is #defined.<br>
<br>
I do not know whether<br>
a) the autoconf test for ILMBASE_HAVE_CONTROL_REGISTER_SUPPORT is<br>
broken and should actually succeed and kfreebsd (and any other Debian<br>
architecture or<br>
b) the cmake setup is broken and incorrecty enables<br>
ILMBASE_HAVE_CONTROL_REGISTER_SUPPORT and causes broken code.<br>
<br>
cu Andreas<br>
<span class="HOEnZb"><font color="#888888">--<br>
`What a good friend you are to him, Dr. Maturin. His other friends are<br>
so grateful to you.'<br>
`I sew his ears on from time to time, sure'<br>
</font></span></div><br></div>