4 | | # If we are on Mac OS X, do a universal build |
5 | | if [ `uname` == "Darwin" ]; then |
6 | | # On older versions of Mac OS X, look for the latest SDK |
7 | | if [ -d /Developer/SDKs ]; then |
8 | | LATEST_SDK='' |
9 | | for sdk_dir in /Developer/SDKs/*; do |
10 | | LATEST_SDK=$sdk_dir |
11 | | done |
12 | | if [[ $LATEST_SDK == /Developer/SDKs/MacOSX10.4u.sdk ]]; then |
13 | | # Check if we have an old gcc on Mac OS 10.4 (from XCode < 2.4) which did not support x86_64 |
14 | | gcc -arch x86_64 -v |
15 | | if [ $? -eq 0 ]; then |
16 | | export CFLAGS='-arch i386 -arch ppc -arch x86_64 -arch ppc64' |
17 | | export LDFLAGS='-arch i386 -arch ppc -arch x86_64 -arch ppc64' |
18 | | else |
19 | | export CFLAGS='-arch i386 -arch ppc -arch ppc64' |
20 | | export LDFLAGS='-arch i386 -arch ppc -arch ppc64' |
21 | | fi |
22 | | elif [[ $LATEST_SDK == /Developer/SDKs/MacOSX10.5.sdk ]]; then |
23 | | export CFLAGS='-isysroot '${LATEST_SDK}' -arch i386 -arch ppc -arch x86_64 -arch ppc64' |
24 | | export LDFLAGS='-syslibroot,'${LATEST_SDK}' -arch i386 -arch ppc -arch x86_64 -arch ppc64' |
25 | | else |
26 | | # Starting with 10.6 (Snow Leopard), only Intel architecture is supported |
27 | | export CFLAGS='-isysroot '${LATEST_SDK}' -arch i386 -arch x86_64' |
28 | | export LDFLAGS='-syslibroot,'${LATEST_SDK}' -arch i386 -arch x86_64' |
29 | | fi |
30 | | else |
31 | | # Starting with 10.7 (Lion) and Xcode 4.3, the SDK is inside the Xcode.app - ignore it |
32 | | export CFLAGS='-arch i386 -arch x86_64' |
33 | | export LDFLAGS='-arch i386 -arch x86_64' |
34 | | fi |
35 | | fi |
36 | | |