[Pkg-phototools-devel] Bug#788102: ILMBASE_HAVE_CONTROL_REGISTER_SUPPORT autoconf macro broken ?

Mathieu Malaterre malat at debian.org
Thu Aug 20 09:32:04 UTC 2015


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).

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).
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.

Could someone with more background on ILMBASE_HAVE_CONTROL_REGISTER_SUPPORT
and autoconf, please comment on the issue.

Thanks.

On 2015-07-22 Steven Chamberlain <steven at pyro.eu.org> wrote:
[...]
> I see that FreeBSD Ports has ilmbase-2.20 and succeeded building
> libIexMath, yet they don't seem to have patched this source file.
> I should try building it on a real FreeBSD system, to compare the
> build log with that of a GNU/kFreeBSD system.

IexMath/IexMathFpu.cpp
static inline void
setCw (uint16_t cw)
{
    asm volatile ("fldcw %0" : : "m" (cw) );
}
[...]
static inline void
setMxcsr (uint32_t mxcsr, bool clearExceptions)
{
    mxcsr &= clearExceptions ? 0xffffffc0 : 0xffffffff;
    asm volatile ("ldmxcsr %0" : : "m" (mxcsr) );
}

[...]
#ifdef ILMBASE_HAVE_CONTROL_REGISTER_SUPPORT

inline void
restoreControlRegs (const ucontext_t & ucon, bool clearExceptions)
{
    setCw ((ucon.uc_mcontext.fpregs->cwd & cwRestoreMask) | cwRestoreVal);
    setMxcsr (ucon.uc_mcontext.fpregs->mxcsr, clearExceptions);
}

#else
[ the failing code ]

and while autoconf tests for ILMBASE_HAVE_CONTROL_REGISTER_SUPPORT
with
--------------------------------
AC_MSG_CHECKING(for fpe support handling)
control_register_support="no"
AC_TRY_COMPILE([
#include <stdint.h>
#include <ucontext.h>
],[
    ucontext_t ucon;
    uint32_t mxcsr = ucon.uc_mcontext.fpregs->mxcsr;
    uint16_t cw    = ucon.uc_mcontext.fpregs->cwd;

],
AC_DEFINE(ILMBASE_HAVE_CONTROL_REGISTER_SUPPORT)
control_register_support=yes)
AC_MSG_RESULT($control_register_support)
--------------------------------
This test fails on kfreebsd-x (and also on e.g. i386).


the respective part of the cmake setup simply looks like this:
IF (WIN32)
[...]
ELSE ()
  IF (APPLE)
[...]
  ELSE ()
    FILE ( APPEND ${CMAKE_CURRENT_BINARY_DIR}/config/IlmBaseConfig.h
"#define ILMBASE_HAVE_CONTROL_REGISTER_SUPPORT 1\n")
  ENDIF ()
ENDIF ()

FreeBSD Ports uses cmake instead of autoconf (which Debian uses) and
therefore ILMBASE_HAVE_CONTROL_REGISTER_SUPPORT is #defined.

I do not know whether
a) the autoconf test for ILMBASE_HAVE_CONTROL_REGISTER_SUPPORT is
broken and should actually succeed and kfreebsd (and any other Debian
architecture or
b) the cmake setup is broken and incorrecty enables
ILMBASE_HAVE_CONTROL_REGISTER_SUPPORT and causes broken code.

cu Andreas
--
`What a good friend you are to him, Dr. Maturin. His other friends are
so grateful to you.'
`I sew his ears on from time to time, sure'
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/pkg-phototools-devel/attachments/20150820/0c8dfdd7/attachment.html>


More information about the Pkg-phototools-devel mailing list