This patch allows much easier cross-compilation under Darwin/OSX to produce universal binaries (x86/ppc/ppc64).
When OSTYPE is Darwin, it checks CFLAGS for flags like "-arch i386" or "-arch ppc". Alternatively, you can specify ARCHTYPES="x86 ppc" when compiling for the same result (they will be added to CFLAGS). There's some flexibility in the naming (powerpc for ppc, i386=i686=x86). If more than one architecture is specified, it does a few things:
- It won't add the -m486 flag even if you're on x86... this doesn't work with multiple architectures.
- Sets BUILD_UNIVERSAL to 1
- Changes MACHTYPE to 'u'. The only effect this will have is to change the object directory and library names to reflect that it's a universal binary (libpt_Darwin_u_r.dylib instead of libpt_Darwin_x86_r.dylib).
-arch flags in CFLAGS are also added to LDFLAGS.
Note: the -M flag to gcc can't be used with multiple archs, so make depend won't work. You'll have to compile fresh or specify dependencies manually.
The ARCHTYPES (or CFLAGS) will also affect projects that build using unix.mak, making them universal.
Example compilation for universal:
cd $PWLIBDIR
./configure && \
ARCHTYPES="x86 ppc" make both
# Compiling openh323 on top
cd $OPENH323DIR
./configure && \
ARCHTYPES="x86 ppc" make both
unix.mak patch for producing universal binaries in Darwin