Support for iPhone tools in the build system:

- more flexible redeclaration of build tools. Now users may
   override build tools with environment variables, e.g.
   CC, AR, RANLIB, etc.
 - added configure-iphone: configure wrapper for iphone
 - tested with iPhone 2.x SDK

This closes #1050


git-svn-id: https://svn.pjsip.org/repos/pjproject/branches/projects/iphone@3168 74dad513-b988-da41-8d7b-12977e46ad98
This commit is contained in:
Benny Prijono 2010-05-12 10:59:20 +00:00
parent 2be59c3733
commit 8ec5eae272
7 changed files with 237 additions and 10 deletions

View File

@ -671,6 +671,17 @@ OBJEXT
CXX
CXXFLAGS
ac_ct_CXX
AR
LD
LDOUT
RANLIB
LIBEXT
LIBEXT2
CC_OUT
CC_INC
CC_DEF
CC_OPTIMIZE
CC_CFLAGS
ac_pjdir
ac_build_mak_vars
CPP
@ -1945,7 +1956,7 @@ test -n "$target_alias" &&
program_prefix=${target_alias}-
ac_config_headers="$ac_config_headers pjlib/include/pj/compat/os_auto.h pjlib/include/pj/compat/m_auto.h pjmedia/include/pjmedia/config_auto.h pjmedia/include/pjmedia-codec/config_auto.h pjsip/include/pjsip/sip_autoconf.h"
ac_config_files="$ac_config_files build.mak build/os-auto.mak pjlib/build/os-auto.mak pjlib-util/build/os-auto.mak pjmedia/build/os-auto.mak pjsip/build/os-auto.mak third_party/build/os-auto.mak third_party/build/portaudio/os-auto.mak"
ac_config_files="$ac_config_files build.mak build/os-auto.mak build/cc-auto.mak pjlib/build/os-auto.mak pjlib-util/build/os-auto.mak pjmedia/build/os-auto.mak pjsip/build/os-auto.mak third_party/build/os-auto.mak third_party/build/portaudio/os-auto.mak"
@ -3247,6 +3258,33 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
ac_compiler_gnu=$ac_cv_c_compiler_gnu
if test "$AR" = ""; then AR="$(CROSS_COMPILE)ar rv"; fi
if test "$LD" = ""; then LD="$CC"; fi
if test "$LDOUT" = ""; then LDOUT="-o"; fi
if test "$RANLIB" = ""; then RANLIB="$(CROSSCOMPILE)ranlib"; fi
if test "$OBJEXT" = ""; then OBJEXT='o'; fi
if test "$LIBEXT" = ""; then LIBEXT='a'; fi
if test "$LIBEXT2" = ""; then LIBEXT2=""; fi
if test "$CC_OUT" = ""; then CC_OUT="-o"; fi
if test "$CC_INC" = ""; then CC_INC="-I"; fi
if test "$CC_DEF" = ""; then CC_DEF="-D"; fi
if test "$CC_OPTIMIZE" = ""; then CC_OPTIMIZE="-O2"; fi
if test "$CC_CFLAGS" = ""; then CC_CFLAGS="-Wall"; fi
case $target in
@ -11002,6 +11040,11 @@ if test "$enable_sound" = "no"; then
true;
else
case $target in
arm-apple-darwin*)
LIBS="$LIBS -framework CoreAudio -framework CoreFoundation -framework AudioToolbox"
{ echo "$as_me:$LINENO: result: Checking sound device backend... AudioUnit" >&5
echo "${ECHO_T}Checking sound device backend... AudioUnit" >&6; }
;;
*darwin*)
LIBS="$LIBS -framework CoreAudio -framework CoreServices -framework AudioUnit -framework AudioToolbox"
if test "`uname -r`" = "6.8"; then
@ -12769,6 +12812,7 @@ do
"pjsip/include/pjsip/sip_autoconf.h") CONFIG_HEADERS="$CONFIG_HEADERS pjsip/include/pjsip/sip_autoconf.h" ;;
"build.mak") CONFIG_FILES="$CONFIG_FILES build.mak" ;;
"build/os-auto.mak") CONFIG_FILES="$CONFIG_FILES build/os-auto.mak" ;;
"build/cc-auto.mak") CONFIG_FILES="$CONFIG_FILES build/cc-auto.mak" ;;
"pjlib/build/os-auto.mak") CONFIG_FILES="$CONFIG_FILES pjlib/build/os-auto.mak" ;;
"pjlib-util/build/os-auto.mak") CONFIG_FILES="$CONFIG_FILES pjlib-util/build/os-auto.mak" ;;
"pjmedia/build/os-auto.mak") CONFIG_FILES="$CONFIG_FILES pjmedia/build/os-auto.mak" ;;
@ -12895,6 +12939,17 @@ OBJEXT!$OBJEXT$ac_delim
CXX!$CXX$ac_delim
CXXFLAGS!$CXXFLAGS$ac_delim
ac_ct_CXX!$ac_ct_CXX$ac_delim
AR!$AR$ac_delim
LD!$LD$ac_delim
LDOUT!$LDOUT$ac_delim
RANLIB!$RANLIB$ac_delim
LIBEXT!$LIBEXT$ac_delim
LIBEXT2!$LIBEXT2$ac_delim
CC_OUT!$CC_OUT$ac_delim
CC_INC!$CC_INC$ac_delim
CC_DEF!$CC_DEF$ac_delim
CC_OPTIMIZE!$CC_OPTIMIZE$ac_delim
CC_CFLAGS!$CC_CFLAGS$ac_delim
ac_pjdir!$ac_pjdir$ac_delim
ac_build_mak_vars!$ac_build_mak_vars$ac_delim
CPP!$CPP$ac_delim
@ -12922,15 +12977,9 @@ ac_no_ssl!$ac_no_ssl$ac_delim
openssl_h_present!$openssl_h_present$ac_delim
libssl_present!$libssl_present$ac_delim
libcrypto_present!$libcrypto_present$ac_delim
ac_cross_compile!$ac_cross_compile$ac_delim
ac_linux_poll!$ac_linux_poll$ac_delim
ac_host!$ac_host$ac_delim
ac_main_obj!$ac_main_obj$ac_delim
LIBOBJS!$LIBOBJS$ac_delim
LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 92; then
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
break
elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
@ -12949,6 +12998,53 @@ fi
cat >>$CONFIG_STATUS <<_ACEOF
cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof
/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
_ACEOF
sed '
s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
s/^/s,@/; s/!/@,|#_!!_#|/
:n
t n
s/'"$ac_delim"'$/,g/; t
s/$/\\/; p
N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
' >>$CONFIG_STATUS <conf$$subs.sed
rm -f conf$$subs.sed
cat >>$CONFIG_STATUS <<_ACEOF
CEOF$ac_eof
_ACEOF
ac_delim='%!_!# '
for ac_last_try in false false false false false :; do
cat >conf$$subs.sed <<_ACEOF
ac_cross_compile!$ac_cross_compile$ac_delim
ac_linux_poll!$ac_linux_poll$ac_delim
ac_host!$ac_host$ac_delim
ac_main_obj!$ac_main_obj$ac_delim
LIBOBJS!$LIBOBJS$ac_delim
LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 6; then
break
elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
{ (exit 1); exit 1; }; }
else
ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
fi
done
ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
if test -n "$ac_eof"; then
ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
ac_eof=`expr $ac_eof + 1`
fi
cat >>$CONFIG_STATUS <<_ACEOF
cat >"\$tmp/subs-2.sed" <<\CEOF$ac_eof
/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end
_ACEOF
sed '
@ -13206,7 +13302,7 @@ s&@builddir@&$ac_builddir&;t t
s&@abs_builddir@&$ac_abs_builddir&;t t
s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
$ac_datarootdir_hack
" $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out
" $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" >$tmp/out
test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
{ ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&

View File

@ -13,6 +13,7 @@ AC_CONFIG_HEADER([pjlib/include/pj/compat/os_auto.h
])
AC_CONFIG_FILES([build.mak
build/os-auto.mak
build/cc-auto.mak
pjlib/build/os-auto.mak
pjlib-util/build/os-auto.mak
pjmedia/build/os-auto.mak
@ -33,10 +34,40 @@ fi
CXXFLAGS="$CFLAGS $CXXFLAGS"
dnl #
dnl # Configure tools
dnl #
AC_PROG_CC
AC_PROG_CXX
AC_LANG_C
if test "$AR" = ""; then AR="$(CROSS_COMPILE)ar rv"; fi
AC_SUBST(AR)
if test "$LD" = ""; then LD="$CC"; fi
AC_SUBST(LD)
if test "$LDOUT" = ""; then LDOUT="-o"; fi
AC_SUBST(LDOUT)
if test "$RANLIB" = ""; then RANLIB="$(CROSSCOMPILE)ranlib"; fi
AC_SUBST(RANLIB)
if test "$OBJEXT" = ""; then OBJEXT='o'; fi
AC_SUBST(OBJEXT)
if test "$LIBEXT" = ""; then LIBEXT='a'; fi
AC_SUBST(LIBEXT)
if test "$LIBEXT2" = ""; then LIBEXT2=""; fi
AC_SUBST(LIBEXT2)
if test "$CC_OUT" = ""; then CC_OUT="-o"; fi
AC_SUBST(CC_OUT)
if test "$CC_INC" = ""; then CC_INC="-I"; fi
AC_SUBST(CC_INC)
if test "$CC_DEF" = ""; then CC_DEF="-D"; fi
AC_SUBST(CC_DEF)
if test "$CC_OPTIMIZE" = ""; then CC_OPTIMIZE="-O2"; fi
AC_SUBST(CC_OPTIMIZE)
if test "$CC_CFLAGS" = ""; then CC_CFLAGS="-Wall"; fi
AC_SUBST(CC_CFLAGS)
AC_SUBST(ac_pjdir)
AC_SUBST(ac_build_mak_vars)
case $target in
@ -474,6 +505,10 @@ if test "$enable_sound" = "no"; then
true;
else
case $target in
arm-apple-darwin*)
LIBS="$LIBS -framework CoreAudio -framework CoreFoundation -framework AudioToolbox"
AC_MSG_RESULT([Checking sound device backend... AudioUnit])
;;
*darwin*)
LIBS="$LIBS -framework CoreAudio -framework CoreServices -framework AudioUnit -framework AudioToolbox"
if test "`uname -r`" = "6.8"; then

View File

@ -60,7 +60,8 @@ endif
# CFLAGS, LDFLAGS, and LIBS to be used by applications
export PJDIR := @ac_pjdir@
export APP_CC := $(CROSS_COMPILE)$(CC_NAME)
export APP_CC := @CC@
export APP_CXX := @CXX@
export APP_CFLAGS := -DPJ_AUTOCONF=1\
@CFLAGS@\
-I$(PJDIR)/pjlib/include\
@ -105,6 +106,7 @@ export APP_LIB_FILES = $(PJ_DIR)/pjsip/lib/libpjsua-$(LIB_SUFFIX) \
# from within the source distribution
export PJ_DIR := $(PJDIR)
export PJ_CC := $(APP_CC)
export PJ_CXX := $(APP_CXX)
export PJ_CFLAGS := $(APP_CFLAGS)
export PJ_CXXFLAGS := $(APP_CXXFLAGS)
export PJ_LDFLAGS := $(APP_LDFLAGS)

21
build/cc-auto.mak.in Normal file
View File

@ -0,0 +1,21 @@
export CC = @CC@ -c
export CXX = @CXX@ -c
export AR = @AR@
export LD = @LD@
export LDOUT = -o
export RANLIB = @RANLIB@
export OBJEXT := .@OBJEXT@
export LIBEXT := .@LIBEXT@
export LIBEXT2 := @LIBEXT2@
export CC_OUT := @CC_OUT@
export CC_INC := @CC_INC@
export CC_DEF := @CC_DEF@
export CC_OPTIMIZE := @CC_OPTIMIZE@
export CC_LIB := -l
export CC_SOURCES :=
export CC_CFLAGS := @CC_CFLAGS@
export CC_LDFLAGS :=

View File

@ -16,6 +16,15 @@ include $(PJDIR)/build/cc-$(CC_NAME).mak
#
-include cc-$(CC_NAME).mak
#
# Include auto configured compiler specification.
# This will override the compiler settings above.
# Currently this is made OPTIONAL, to prevent people
# from getting errors because they don't re-run ./configure
# after downloading new PJSIP.
#
-include $(PJDIR)/build/cc-auto.mak
#
# Include global machine specific definitions
#

View File

@ -65,6 +65,9 @@ print_common:
@echo $(APP)_CXXFLAGS=$($(APP)_CXXFLAGS)
@echo $(APP)_LDFLAGS=$($(APP)_LDFLAGS)
@echo DEPFLAGS=$(DEPFLAGS)
@echo CC=$(CC)
@echo AR=$(AR)
@echo RANLIB=$(RANLIB)
print_bin: print_common
@echo EXE=$(EXE)

61
configure-iphone Executable file
View File

@ -0,0 +1,61 @@
#!/bin/bash
if test "$*" = "--help" -o "$*" = "-h"; then
echo "configure-iphone [SDK=name_path] [OPTIONS]"
echo ""
echo "SDK=name_path Choose which SDK to use. Value can be SDK name (e.g."
echo " iPhoneOS2.2.1.sdk) or the full path of the SDK"
echo "OPTIONS Other options that will be passed directly to "
echo " ./aconfigure script. Run ./aconfigure --help for"
echo " more info."
echo ""
exit 0
fi
F="configure-iphone"
# Set the main iPhone developer directory, if not set
if test "x${DEVPATH}" = "x"; then
DEVPATH=/Developer/Platforms/iPhoneOS.platform/Developer
fi
# Make sure $DEVPATH directory exist
if test ! -d $DEVPATH; then
echo "$F error: directory $DEVPATH does not exist. Please install iPhone development kit"
exit 1
fi
# Choose SDK version to use
if test "x$SDK" = "x"; then
# If SDK is not set, use the latest one
for f in `ls $DEVPATH/SDKs/`; do echo $f | sed 's/\(.sdk\)//'; done | sort | tail -1 > tmpsdkname
SDK=`cat tmpsdkname`.sdk
rm -f tmpsdkname
echo "$F info: using ${SDK}"
SDKPATH=${DEVPATH}/SDKs/${SDK}
elif test -d ${SDK}; then
# .. else if SDK is set and it points to a valid path, just use it
SDKPATH=${SDK}
else
# .. else assume the SDK name is used.
SDKPATH=${DEVPATH}/SDKs/${SDK}
fi
# Test the SDK directory
if test ! -d ${SDKPATH}/usr/include; then
echo "$F error: unable to find valid iPhone SDK in ${SDKPATH}"
exit 1
fi
# Settings to feed to configure script
export CFLAGS="-O2 -arch armv6 -isysroot ${SDKPATH}"
export LDFLAGS="-O2 -arch armv6 -isysroot ${SDKPATH} -framework AudioToolbox -framework Foundation"
export AR="${DEVPATH}/usr/bin/libtool -static -o"
export RANLIB="echo ranlib"
# Use gcc -E as preprocessor instead of cpp, since cpp will find the
# header files in standard /usr/include
export CPP="${DEVPATH}/usr/bin/arm-apple-darwin9-gcc -E -isysroot ${SDKPATH}"
# And finally invoke configure script itself
./aconfigure --host=arm-apple-darwin9 --disable-floating-point $*