This section contains information on the build options that you need to be aware of when using Xcode 2.2 and later on an Intel-based Macintosh computer. It lists the default compiler options, discusses how to set architecture-specific options, and provides information on using GNU Autoconf macros.
Default Compiler Options
Architecture-Specific Options
Autoconf Macros
In Xcode 2.2 and later on an Intel-based Macintosh computer, the defaults for compiler flags that differ from standard GCC distributions are listed in Table 1-1.
Compiler flag |
Default value |
Specifies to |
|---|---|---|
|
|
Use SSE instructions for floating-point math. |
|
On by default |
Enable the MMX, SSE, and SSE2 extensions in the Intel instruction set architecture. |
Most developers don’t need to use architecture-specific options for their projects.
In Xcode, to set one flag for an Intel-based Macintosh and another for PowerPC, you use the PER_ARCH_CFLAGS_i386 and PER_ARCH_CFLAGS_ppc build settings variables to supply the architecture-specific settings.
For example to set the architecture-specific flags -faltivec and -msse3, you would add the following build settings:
PER_ARCH_CFLAGS_i386 = -msse3 |
PER_ARCH_CFLAGS_ppc = -faltivec |
Similarly, you can supply architecture-specific linker flags using the OTHER_LDFLAGS_i386 and OTHER_LDFLAGS_ppc build settings variables.
You can pass the -arch flag to gcc, ld, and as. The allowable values are i386 and ppc. You can specify both flags as follows:
-arch ppc -arch i386 |
For more information on architecture-specific options, see Building Universal Binaries in Xcode User Guide.
If you are compiling a project that uses GNU Autoconf and trying to build it for both PowerPC-based and Intel-based Macintosh computers, you need to make sure that when the project configures itself, it doesn't use Autoconf macros to determine the endian type of the runtime system. For example, if your project uses the Autoconf AC_C_BIGENDIAN macro, the program won't work correctly when it is run on the opposite architecture from the one you are targeting when you configure the project. To correctly build for both PowerPC-based and Intel-based Macintosh computers, use the compiler-defined __BIG_ENDIAN__ and __LITTLE_ENDIAN__ macros in your code.
For more information, see Using GNU Autoconf in Porting UNIX/Linux Applications to Mac OS X.
Last updated: 2007-02-26