More #1025 (support for using external third party libraries):

- support for using external libspeex and libgsm
 - replaced --with-pa-path with --with-external-pa


git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@3062 74dad513-b988-da41-8d7b-12977e46ad98
This commit is contained in:
Benny Prijono 2010-01-14 14:46:54 +00:00
parent cb40a1c517
commit 8a9b3b272c
7 changed files with 246 additions and 68 deletions

View File

@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.64 for pjproject 1.0.
# Generated by GNU Autoconf 2.64 for pjproject 1.x.
#
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software
@ -546,8 +546,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='pjproject'
PACKAGE_TARNAME='pjproject'
PACKAGE_VERSION='1.0'
PACKAGE_STRING='pjproject 1.0'
PACKAGE_VERSION='1.x'
PACKAGE_STRING='pjproject 1.x'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
@ -610,8 +610,10 @@ ac_no_small_filter
ac_pa_use_oss
ac_pa_use_alsa
ac_pa_cflags
ac_pa_path
ac_external_pa
ac_pjmedia_snd
ac_external_gsm
ac_external_speex
ac_os_objs
EGREP
GREP
@ -683,8 +685,10 @@ ac_user_opts='
enable_option_checking
enable_floating_point
enable_epoll
with_external_speex
with_external_gsm
enable_sound
with_pa_path
with_external_pa
enable_oss
enable_ext_sound
enable_small_filter
@ -1255,7 +1259,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures pjproject 1.0 to adapt to many kinds of systems.
\`configure' configures pjproject 1.x to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1321,7 +1325,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of pjproject 1.0:";;
short | recursive ) echo "Configuration of pjproject 1.x:";;
esac
cat <<\_ACEOF
@ -1360,9 +1364,21 @@ Optional Features:
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-pa-path=DIR Specify PortAudio alternate location (e.g. /usr).
When this option is set, we will not use our copy of
PortAudio in third_party directory.
--with-external-speex Use external Speex development files, not the one in
"third_party" directory. When this option is set,
make sure that Speex is accessible to use (hint: use
CFLAGS and LDFLAGS env var to set the include/lib
paths)
--with-external-gsm Use external GSM codec library, not the one in
"third_party" directory. When this option is set,
make sure that the GSM include/lib files are
accessible to use (hint: use CFLAGS and LDFLAGS env
var to set the include/lib paths)
--with-external-pa Use external PortAudio development files, not the
one in "third_party" directory. When this option is
set, make sure that PortAudio is accessible to use
(hint: use CFLAGS and LDFLAGS env var to set the
include/lib paths)
Some influential environment variables:
CC C compiler command
@ -1442,7 +1458,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
pjproject configure 1.0
pjproject configure 1.x
generated by GNU Autoconf 2.64
Copyright (C) 2009 Free Software Foundation, Inc.
@ -1778,7 +1794,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by pjproject $as_me 1.0, which was
It was created by pjproject $as_me 1.x, which was
generated by GNU Autoconf 2.64. Invocation command line was
$ $0 $@
@ -2263,7 +2279,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/portaudio/os-auto.mak third_party/build/os-auto.mak"
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"
@ -5171,6 +5187,88 @@ esac
ac_external_speex=0
# Check whether --with-external-speex was given.
if test "${with_external_speex+set}" = set; then :
withval=$with_external_speex;
if test "x$with_external_speex" != "xno"; then
# Test Speex installation
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if external Speex devkit is installed" >&5
$as_echo_n "checking if external Speex devkit is installed... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <speex/speex.h>
#include <speex/speex_echo.h>
int
main ()
{
speex_echo_state_init(0, 0); speex_encoder_init(0);
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes!!" >&5
$as_echo "yes!!" >&6; }
$as_echo "#define PJMEDIA_EXTERNAL_SPEEX_CODEC 1" >>confdefs.h
ac_external_speex="1"
else
as_fn_error "Unable to use external Speex library. If Speex development files are not available in the default locations, use CFLAGS and LDFLAGS env var to set the include/lib paths" "$LINENO" 5
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
fi
ac_external_gsm=0
# Check whether --with-external-gsm was given.
if test "${with_external_gsm+set}" = set; then :
withval=$with_external_gsm;
if test "x$with_external_gsm" != "xno"; then
# Test GSM library installation
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if external GSM devkit is installed" >&5
$as_echo_n "checking if external GSM devkit is installed... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <gsm/gsm.h>
int
main ()
{
gsm_create();
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes!!" >&5
$as_echo "yes!!" >&6; }
$as_echo "#define PJMEDIA_EXTERNAL_GSM_CODEC 1" >>confdefs.h
ac_external_gsm="1"
else
as_fn_error "Unable to use external GSM library. If GSM development files are not available in the default locations, use CFLAGS and LDFLAGS env var to set the include/lib paths" "$LINENO" 5
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
fi
# Check whether --enable-sound was given.
if test "${enable_sound+set}" = set; then :
@ -5183,24 +5281,37 @@ $as_echo "Checking if sound is disabled... yes" >&6; }
fi
ac_external_pa=0
# Check whether --with-pa-path was given.
if test "${with_pa_path+set}" = set; then :
withval=$with_pa_path;
if test "x$with_pa_path" != "xno"; then
ac_pa_path=$with_pa_path
# Remove trailing backslash
ac_pa_path=`echo $ac_pa_path | sed 's/\/$//'`
# Test the path
#if test ! -f $ac_pa_path/include/portaudio.h; then
# AC_MSG_ERROR([Wrong --with-pa-path value, $ac_pa_path/include/portaudio.h does not exist])
#fi
#if test ! -d $ac_pa_path/lib; then
# AC_MSG_ERROR([Wrong --with-pa-path value, $ac_pa_path/lib does not exist])
#fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ** Using PortAudio in $ac_pa_path **" >&5
$as_echo "** Using PortAudio in $ac_pa_path **" >&6; }
# Check whether --with-external-pa was given.
if test "${with_external_pa+set}" = set; then :
withval=$with_external_pa;
if test "x$with_external_pa" != "xno"; then
# Test PortAudio installation
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if external PortAudio devkit is installed" >&5
$as_echo_n "checking if external PortAudio devkit is installed... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <portaudio.h>
int
main ()
{
Pa_Initialize();
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes!!" >&5
$as_echo "yes!!" >&6; }
ac_external_pa="1"
else
as_fn_error "Unable to use PortAudio. If PortAudio development files are not available in the default locations, use CFLAGS and LDFLAGS env var to set the include/lib paths" "$LINENO" 5
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
@ -5208,7 +5319,6 @@ fi
ac_fn_c_check_header_mongrel "$LINENO" "sys/soundcard.h" "ac_cv_header_sys_soundcard_h" "$ac_includes_default"
if test "x$ac_cv_header_sys_soundcard_h" = x""yes; then :
ac_pa_cflags="$ac_pa_cflags -DHAVE_SYS_SOUNDCARD_H"
@ -6445,7 +6555,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by pjproject $as_me 1.0, which was
This file was extended by pjproject $as_me 1.x, which was
generated by GNU Autoconf 2.64. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@ -6505,7 +6615,7 @@ Report bugs to the package provider."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_version="\\
pjproject config.status 1.0
pjproject config.status 1.x
configured by $0, generated by GNU Autoconf 2.64,
with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
@ -6629,8 +6739,8 @@ do
"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" ;;
"pjsip/build/os-auto.mak") CONFIG_FILES="$CONFIG_FILES pjsip/build/os-auto.mak" ;;
"third_party/build/portaudio/os-auto.mak") CONFIG_FILES="$CONFIG_FILES third_party/build/portaudio/os-auto.mak" ;;
"third_party/build/os-auto.mak") CONFIG_FILES="$CONFIG_FILES third_party/build/os-auto.mak" ;;
"third_party/build/portaudio/os-auto.mak") CONFIG_FILES="$CONFIG_FILES third_party/build/portaudio/os-auto.mak" ;;
*) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
esac

View File

@ -1,4 +1,4 @@
AC_INIT(pjproject,1.0)
AC_INIT(pjproject,1.x)
host_orig="$host"
@ -13,13 +13,13 @@ AC_CONFIG_HEADER([pjlib/include/pj/compat/os_auto.h
])
AC_CONFIG_FILES([build.mak
build/os-auto.mak
pjlib/build/os-auto.mak
pjlib-util/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/portaudio/os-auto.mak
third_party/build/os-auto.mak
])
third_party/build/portaudio/os-auto.mak
])
dnl
@ -379,6 +379,52 @@ dnl #
dnl # PJMEDIA
dnl #
dnl # Use external Speex installation
AC_SUBST(ac_external_speex,0)
AC_ARG_WITH(external-speex,
AC_HELP_STRING([--with-external-speex],
[Use external Speex development files, not the one in "third_party" directory. When this option is set, make sure that Speex is accessible to use (hint: use CFLAGS and LDFLAGS env var to set the include/lib paths)]),
[
if test "x$with_external_speex" != "xno"; then
# Test Speex installation
AC_MSG_CHECKING([if external Speex devkit is installed])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <speex/speex.h>
#include <speex/speex_echo.h>
]],
[speex_echo_state_init(0, 0); speex_encoder_init(0); ])],
[AC_MSG_RESULT(yes!!)
AC_DEFINE(PJMEDIA_EXTERNAL_SPEEX_CODEC, 1)
ac_external_speex="1"
],
[AC_MSG_ERROR([Unable to use external Speex library. If Speex development files are not available in the default locations, use CFLAGS and LDFLAGS env var to set the include/lib paths])])
fi
]
)
dnl # Use external GSM codec library installation
AC_SUBST(ac_external_gsm,0)
AC_ARG_WITH(external-gsm,
AC_HELP_STRING([--with-external-gsm],
[Use external GSM codec library, not the one in "third_party" directory. When this option is set, make sure that the GSM include/lib files are accessible to use (hint: use CFLAGS and LDFLAGS env var to set the include/lib paths)]),
[
if test "x$with_external_gsm" != "xno"; then
# Test GSM library installation
AC_MSG_CHECKING([if external GSM devkit is installed])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <gsm/gsm.h>
]],
[gsm_create(); ])
],
[AC_MSG_RESULT(yes!!)
AC_DEFINE(PJMEDIA_EXTERNAL_GSM_CODEC, 1)
ac_external_gsm="1"
],
[AC_MSG_ERROR([Unable to use external GSM library. If GSM development files are not available in the default locations, use CFLAGS and LDFLAGS env var to set the include/lib paths])])
fi
]
)
dnl # Sound device backend selection
AC_SUBST(ac_pjmedia_snd)
AC_ARG_ENABLE(sound,
@ -390,30 +436,26 @@ AC_ARG_ENABLE(sound,
fi]
)
dnl # PortAudio path. If ac_pa_path is not empty, we're using PortAudio
dnl # in external location (not under third_party)
AC_SUBST(ac_pa_path)
AC_ARG_WITH(pa-path,
AC_HELP_STRING([--with-pa-path=DIR],
[Specify PortAudio alternate location (e.g. /usr). When this option is set, we will not use our copy of PortAudio in third_party directory.]),
dnl # Use external PortAudio installation
AC_SUBST(ac_external_pa,0)
AC_ARG_WITH(external-pa,
AC_HELP_STRING([--with-external-pa],
[Use external PortAudio development files, not the one in "third_party" directory. When this option is set, make sure that PortAudio is accessible to use (hint: use CFLAGS and LDFLAGS env var to set the include/lib paths)]),
[
if test "x$with_pa_path" != "xno"; then
ac_pa_path=$with_pa_path
# Remove trailing backslash
ac_pa_path=`echo $ac_pa_path | sed 's/\/$//'`
# Test the path
#if test ! -f $ac_pa_path/include/portaudio.h; then
# AC_MSG_ERROR([Wrong --with-pa-path value, $ac_pa_path/include/portaudio.h does not exist])
#fi
#if test ! -d $ac_pa_path/lib; then
# AC_MSG_ERROR([Wrong --with-pa-path value, $ac_pa_path/lib does not exist])
#fi
AC_MSG_RESULT([** Using PortAudio in $ac_pa_path **])
if test "x$with_external_pa" != "xno"; then
# Test PortAudio installation
AC_MSG_CHECKING([if external PortAudio devkit is installed])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <portaudio.h>
]],
[Pa_Initialize();])],
[AC_MSG_RESULT(yes!!)
ac_external_pa="1"
],
[AC_MSG_ERROR([Unable to use PortAudio. If PortAudio development files are not available in the default locations, use CFLAGS and LDFLAGS env var to set the include/lib paths])])
fi
]
)
AC_SUBST(ac_pa_cflags)
AC_CHECK_HEADER(sys/soundcard.h,
[ac_pa_cflags="$ac_pa_cflags -DHAVE_SYS_SOUNDCARD_H"])

View File

@ -14,14 +14,25 @@ export APP_THIRD_PARTY_LIBS := -lresample-$(TARGET_NAME) -lmilenage-$(TARGET_NAM
export APP_THIRD_PARTY_LIB_FILES = $(PJ_DIR)/third_party/lib/libresample-$(LIB_SUFFIX) $(PJ_DIR)/third_party/lib/libmilenage-$(LIB_SUFFIX) $(PJ_DIR)/third_party/lib/libsrtp-$(LIB_SUFFIX)
ifneq (@ac_no_gsm_codec@,1)
ifeq (@ac_external_gsm@,1)
# External GSM library
APP_THIRD_PARTY_LIBS += -lgsm
APP_THIRD_PARTY_LIB_FILES +=
else
APP_THIRD_PARTY_LIBS += -lgsmcodec-$(TARGET_NAME)
APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libgsmcodec-$(LIB_SUFFIX)
endif
endif
ifneq (@ac_no_speex_codec@,1)
ifeq (@ac_external_speex@,1)
APP_THIRD_PARTY_LIBS += -lspeex -lspeexdsp
APP_THIRD_PARTY_LIB_FILES +=
else
APP_THIRD_PARTY_LIBS += -lspeex-$(TARGET_NAME)
APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libspeex-$(LIB_SUFFIX)
endif
endif
ifneq (@ac_no_ilbc_codec@,1)
APP_THIRD_PARTY_LIBS += -lilbccodec-$(TARGET_NAME)
@ -33,12 +44,11 @@ APP_THIRD_PARTY_LIBS += -lg7221codec-$(TARGET_NAME)
APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libg7221codec-$(LIB_SUFFIX)
endif
ifneq (x@ac_pa_path@,x)
# We're using external PortAudio
APP_THIRD_PARTY_LIBS += -L@ac_pa_path@/lib -lportaudio
ifneq ($(findstring pa,@ac_pjmedia_snd@),)
ifeq (@ac_external_pa@,1)
APP_THIRD_PARTY_LIBS += -lportaudio
APP_THIRD_PARTY_LIB_FILES +=
else
ifneq ($(findstring pa,@ac_pjmedia_snd@),)
APP_THIRD_PARTY_LIBS += -lportaudio-$(TARGET_NAME)
APP_THIRD_PARTY_LIB_FILES += $(PJ_DIR)/third_party/lib/libportaudio-$(LIB_SUFFIX)
endif

View File

@ -86,12 +86,12 @@ endif
# PortAudio
#
ifneq ($(findstring pa,$(AC_PJMEDIA_SND)),)
ifeq (x@ac_pa_path@,x)
ifeq (@ac_external_pa@,1)
# External PA
export CFLAGS += -DPJMEDIA_AUDIO_DEV_HAS_PORTAUDIO=1
#else
# Our PA in third_party
export CFLAGS += -I$(THIRD_PARTY)/build/portaudio -I$(THIRD_PARTY)/portaudio/include -DPJMEDIA_AUDIO_DEV_HAS_PORTAUDIO=1
else
# External PA
export CFLAGS += -I@ac_pa_path@/include -DPJMEDIA_AUDIO_DEV_HAS_PORTAUDIO=1
endif
endif

View File

@ -42,12 +42,14 @@
#undef PJMEDIA_HAS_GSM_CODEC
#endif
#undef PJMEDIA_EXTERNAL_GSM_CODEC
/* Speex codec */
#ifndef PJMEDIA_HAS_SPEEX_CODEC
#undef PJMEDIA_HAS_SPEEX_CODEC
#endif
#undef PJMEDIA_EXTERNAL_SPEEX_CODEC
/* iLBC codec */
#ifndef PJMEDIA_HAS_ILBC_CODEC

View File

@ -28,13 +28,18 @@
#include <pj/pool.h>
#include <pj/string.h>
#include <pj/os.h>
#include "../../third_party/gsm/inc/gsm.h"
/*
* Only build this file if PJMEDIA_HAS_GSM_CODEC != 0
*/
#if defined(PJMEDIA_HAS_GSM_CODEC) && PJMEDIA_HAS_GSM_CODEC != 0
#if defined(PJMEDIA_EXTERNAL_GSM_CODEC) && PJMEDIA_EXTERNAL_GSM_CODEC
# include <gsm/gsm.h>
#else
# include "../../third_party/gsm/inc/gsm.h"
#endif
/* We removed PLC in 0.6 (and re-enabled it again in 0.9!) */
#define PLC_DISABLED 0

View File

@ -1,23 +1,32 @@
ifneq (@ac_no_gsm_codec@,1)
ifeq (@ac_external_gsm@,1)
# External
else
DIRS += gsm
endif
endif
ifneq (@ac_no_ilbc_codec@,1)
DIRS += ilbc
endif
ifneq (@ac_no_speex_codec@,1)
ifeq (@ac_external_speex@,1)
# External speex
else
DIRS += speex
endif
endif
ifneq (@ac_no_g7221_codec@,1)
DIRS += g7221
endif
ifeq (x@ac_pa_path@,x)
# Only if we're using our own PA in third_party
ifneq ($(findstring pa,@ac_pjmedia_snd@),)
ifeq (@ac_external_pa@,1)
# External PA
else
DIRS += portaudio
endif
endif