Ignore:
Timestamp:
May 13, 2010 4:35:16 AM (14 years ago)
Author:
bennylp
Message:

Re #1050: automatic selection of ARM compiler to use based on the SDK. No need to create symbolic links to gcc now.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/branches/projects/iphone/configure-iphone

    r3169 r3170  
    11#!/bin/bash 
    22 
     3F="configure-iphone" 
     4 
    35if test "$*" = "--help" -o "$*" = "-h"; then 
    4   echo "configure-iphone [IPHONESDK=name_path] [OPTIONS]" 
     6  echo "$F [OPTIONS]" 
    57  echo "" 
    6   echo "IPHONESDK=name_path   Choose which SDK to use. Value can be SDK name" 
    7   echo "                      (e.g. iPhoneOS2.2.1.sdk) or the full path of" 
    8   echo "                      the SDK" 
    9   echo "OPTIONS               Other options that will be passed directly to" 
    10   echo "                      ./aconfigure script. Run ./aconfigure --help" 
    11   echo "                      for more info." 
     8  echo "where:" 
     9  echo "  OPTIONS    Other options that will be passed directly to" 
     10  echo "             ./aconfigure script. Run ./aconfigure --help" 
     11  echo "             for more info." 
     12  echo "" 
     13  echo "Environment variables:" 
     14  echo "  IPHONESDK  Optionally specify which SDK to use. Value is the full " 
     15  echo "             path of the SDK. By default, the latest SDK installed" 
     16  echo "             will be used." 
     17  echo "  CC         Optionally specify the path of the ARM cross compiler" 
     18  echo "             to use. By default, the compiler is deduced from the" 
     19  echo "             SDK." 
    1220  echo "" 
    1321  exit 0 
    1422fi 
    1523 
    16 F="configure-iphone" 
    17  
    1824# Set the main iPhone developer directory, if not set 
    1925if test "x${DEVPATH}" = "x"; then 
    2026  DEVPATH=/Developer/Platforms/iPhoneOS.platform/Developer 
     27  echo "$F: DEVPATH is not specified, using ${DEVPATH}" 
    2128fi 
    2229 
     
    4855fi 
    4956 
     57echo "$F: IPHONESDK is not specified, choosing ${IPHONESDK}" 
     58 
    5059# Default CFLAGS if it's not specified 
    5160if test "$CFLAGS" = ""; then 
     
    5867fi 
    5968 
    60 # Settings to feed to configure script. Binaries should have the 
     69# Determine which gcc for this SDK. Binaries should have the 
    6170# full path as it's not normally in user's PATH 
    62 export CC="${DEVPATH}/usr/bin/arm-apple-darwin9-gcc" 
    63 export CXX="${DEVPATH}/usr/bin/arm-apple-darwin9-g++" 
     71 
     72if test "${CC}" = ""; then 
     73  for archpath in `ls -d ${SDKPATH}/usr/lib/gcc/arm-apple-darwin*`; do 
     74    archname=`basename ${archpath}` 
     75    for gccver in `ls ${archpath}`; do 
     76       gccpath="${DEVPATH}/usr/bin/${archname}-gcc-${gccver}" 
     77       if test -e ${gccpath}; then 
     78          export CC="${gccpath}" 
     79          break 
     80       fi 
     81    done 
     82    if test ! "${CC}" = ""; then 
     83       echo "$F: CC is not specified, choosing ${CC}" 
     84       break 
     85    fi 
     86  done 
     87fi 
     88 
     89if test "${CC}" = ""; then 
     90    echo "$F error: unable to find gcc for ${IPHONESDK}. If you think you have the right gcc, set the full path in CC environment variable." 
     91    exit 1 
     92fi 
     93 
     94# Set CXX if not set 
     95if test "${CXX}" = ""; then 
     96  export CXX=`echo ${CC} | sed 's/gcc/g++/'` 
     97  echo "$F: CXX is not specified, using ${CXX}" 
     98fi 
     99 
     100# Other settings to feed to configure script.  
    64101export CFLAGS="${CFLAGS} -arch armv6 -isysroot ${SDKPATH}" 
    65102export LDFLAGS="${LDFLAGS} -arch armv6 -isysroot ${SDKPATH} -framework AudioToolbox -framework Foundation" 
     
    69106# header files in standard /usr/include instead of in isysroot 
    70107export CPP="${CC} -E -isysroot ${SDKPATH}" 
     108 
     109# Print settings 
     110if test "1" = "1"; then 
     111  echo "$F: calling ./aconfigure with these settings:" 
     112  echo " CC = ${CC}" 
     113  echo " CXX = ${CXX}" 
     114  echo " SDKPATH = ${SDKPATH}" 
     115  echo " CFLAGS = ${CFLAGS}" 
     116  echo " AR = ${AR}" 
     117fi 
    71118 
    72119# And finally invoke the configure script itself 
Note: See TracChangeset for help on using the changeset viewer.