As a good general rule, when writing abstraction layers, plug-in architectures, and so on, architectural portability should be considered. Most existing open source software is already fairly flexible in this regard. However, when dealing with OS-specific code, you may find that consistent support for things like endianness and alignment are not always considered.
When you encounter code specific to Mac OS X with architectural dependencies on a particular processor architecture, there are a number of ways to handle the situation. Here are some tips that should help:
Altivec or SSE code should be special-cased with equivalent scalar versions that can be compiled in. This will ensure that it is easy for developers familiar with other chip architectures to understand what is happening and write equivalents for other architectures.
Testing of alignment should generally occur at compile time, not configuration time, to avoid unnecessary problems when cross-compiling.
Testing of endianness should generally occur at either compile time or execution time, at your option.
Executing intermediate build products is a bad idea and should be avoided where possible.
For more detailed information, see “Compiling for Multiple CPU Architectures” and the document Universal Binary Programming Guidelines, Second Edition.
Last updated: 2008-04-08