On 27 Aug., 14:54, Martin Albrecht <[email protected]> wrote: > Hi there, > > the upgrade of M4RI to the most recent upstream version > > cf.http://trac.sagemath.org/sage_trac/ticket/11574 > > exposed the following bug: M4RI uses SSE2 instructions (XORs btw.) and hence > tests whether the machine it is built on supports these. If this is the case > it defines __M4RI_HAVE_SSE2 as 1 otherwise as 0. It also passes -msse2 to the > compiler. So far so good.
Use #if defined(__SSE2__) ... #else ... #endif which tests a *compile-time*, rather than configure-time condition. If the actual machine supports SSE2, gcc normally enables -msse2, unless it is "ill-configured" or you pass contrary options, like for example -march=i486. You can use pkg-config if it is available, but we even have Linux machines on Skynet where it simply isn't installed. You can add '-msse2' to libm4ri.pc's "Cflags: ", but this will likely fail if the selected target architecture doesn't support it, i.e. gcc -march=pentium `pkg-config --cflags libm4ri` -c foo.c won't work. (The '-march=...' might come from "global", user-specified CFLAGS.) If some of Sage's extension modules link against M4RI, you could dynamically add '-msse2' to their extra_compile_args, depending on whether it is supported / allowed by the current gcc / CFLAGS setting. -leif -- To post to this group, send an email to [email protected] To unsubscribe from this group, send an email to [email protected] For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
