diff options
author | George Joseph <george.joseph@fairview5.com> | 2016-01-18 20:54:28 -0700 |
---|---|---|
committer | George Joseph <george.joseph@fairview5.com> | 2016-03-01 09:33:17 -0700 |
commit | b59956a875817367834431e7f1fa02486b5aed7f (patch) | |
tree | 8acb188cd7a98418ccb13698c66c4a1863e9eb92 /configure | |
parent | d1495bc0ebed86d322488bed647b43aba0ae9b1f (diff) |
build-system: Allow building with static pjproject
Background here:
http://lists.digium.com/pipermail/asterisk-dev/2016-January/075266.html
From CHANGES:
* To help insure that Asterisk is compiled and run with the same known
version of pjproject, a new option (--with-pjproject-bundled) has been
added to ./configure. When specified, the version of pjproject specified
in third-party/versions.mak will be downloaded and configured. When you
make Asterisk, the build process will also automatically build pjproject
and Asterisk will be statically linked to it. Once a particular version
of pjproject is configured and built, it won't be configured or built
again unless you run a 'make distclean'.
To facilitate testing, when 'make install' is run, the pjsua and pjsystest
utilities and the pjproject python bindings will be installed in
ASTDATADIR/third-party/pjproject.
The default behavior remains building with the shared pjproject
installation, if any.
Building:
All you have to do is include the --with-pjproject-bundled option on
the ./configure command line (and remove any existing --with-pjproject
option if specified). Everything else is automatic.
Behind the scenes:
The top-level Makefile was modified to include 'third-party' in the
list of MOD_SUBDIRS.
The third-party directory was created to contain any third party
packages that may be needed in the future. Its Makefile automatically
iterates over any subdirectories passing on targets.
The third-party/pjproject directory was created to house the pjproject
source distribution. Its Makefile contains targets to download, patch
configure, generate dependencies, compile libs, apps and python bindings,
sanitized build.mak and generate a symbols list.
When bootstrap.sh is run, it automatically includes the configure.m4
file in third-party/pjproject. This file has a macro to download and
conifgure pjproject and get and set PJPROJECT_INCLUDE, PJPROJECT_DIR
and PJPROJECT_BUNDLED. It also tests for the capabilities like
PJ_TRANSACTION_GRP_LOCK by parsing preprocessor output as opposed to
trying to compile. Of course, bootstrap.sh is only run once and the
configure file is incldued in the patch.
When configure is run with the new options, the macro in configure.m4
triggers the download, patch, conifgure and tests. No compilation is
performed at this time. The downloaded tarball is cached in /tmp so
it doesn't get downloaded again on a distclean.
When make is run in the top-level Asterisk source directory, it will
automatically descend all the subdirectories in third_party just as it
does for addons, apps, etc. The top-level Makefile makes sure that
the 'third-party' is built before 'main' so that dependencies from the
other directories are built first.
When main does build, a new shared library (libasteriskpj) is created that
links statically to the pjproject .a files and exports all their symbols.
The asterisk binary links to that, just as it does with libasteriskssl.
When Asterisk is installed, the pjsua and pjsystest apps, and the pjproject
python bindings are installed in ASTDATADIR/third-party/pjproject. This
will facilitate testing, including running the testsuite which will be
updated to check that directory for the pjsua module ahead of the system
python library.
Modules should continue to depend on pjproject if they use pjproject APIs
directly. They should not care about the implementation. No changes to any
res_pjsip modules were made.
Change-Id: Ia7a60c28c2e9ba9537c5570f933c1ebcb20a3103
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 469 |
1 files changed, 429 insertions, 40 deletions
@@ -907,6 +907,14 @@ PBX_PORTAUDIO PORTAUDIO_DIR PORTAUDIO_INCLUDE PORTAUDIO_LIB +PBX_POPT +POPT_DIR +POPT_INCLUDE +POPT_LIB +PBX_PJSIP_EXTERNAL_RESOLVER +PJSIP_EXTERNAL_RESOLVER_DIR +PJSIP_EXTERNAL_RESOLVER_INCLUDE +PJSIP_EXTERNAL_RESOLVER_LIB PBX_PJ_SSL_CERT_LOAD_FROM_FILES2 PJ_SSL_CERT_LOAD_FROM_FILES2_DIR PJ_SSL_CERT_LOAD_FROM_FILES2_INCLUDE @@ -927,10 +935,7 @@ PBX_PJSIP_DLG_CREATE_UAS_AND_INC_LOCK PJSIP_DLG_CREATE_UAS_AND_INC_LOCK_DIR PJSIP_DLG_CREATE_UAS_AND_INC_LOCK_INCLUDE PJSIP_DLG_CREATE_UAS_AND_INC_LOCK_LIB -PBX_POPT -POPT_DIR -POPT_INCLUDE -POPT_LIB +PJPROJECT_BUNDLED PBX_PJPROJECT PJPROJECT_DIR PJPROJECT_INCLUDE @@ -1350,6 +1355,7 @@ with_osptk with_oss with_postgres with_pjproject +with_pjproject_bundled with_popt with_portaudio with_pri @@ -2088,6 +2094,8 @@ Optional Packages: --with-oss=PATH use Open Sound System files in PATH --with-postgres=PATH use PostgreSQL files in PATH --with-pjproject=PATH use PJPROJECT files in PATH + --with-pjproject-bundled + Use bundled pjproject libraries --with-popt=PATH use popt files in PATH --with-portaudio=PATH use PortAudio files in PATH --with-pri=PATH use ISDN PRI files in PATH @@ -10401,6 +10409,7 @@ fi + PJPROJECT_DESCRIP="PJPROJECT" PJPROJECT_OPTION="pjproject" PBX_PJPROJECT=0 @@ -10432,37 +10441,28 @@ fi +PJPROJECT_BUNDLED=no - POPT_DESCRIP="popt" - POPT_OPTION="popt" - PBX_POPT=0 -# Check whether --with-popt was given. -if test "${with_popt+set}" = set; then : - withval=$with_popt; - case ${withval} in - n|no) - USE_POPT=no - # -1 is a magic value used by menuselect to know that the package - # was disabled, other than 'not found' - PBX_POPT=-1 - ;; - y|ye|yes) - ac_mandatory_list="${ac_mandatory_list} POPT" - ;; - *) - POPT_DIR="${withval}" - ac_mandatory_list="${ac_mandatory_list} POPT" - ;; - esac +# Check whether --with-pjproject-bundled was given. +if test "${with_pjproject_bundled+set}" = set; then : + withval=$with_pjproject_bundled; case "${enableval}" in + n|no) PJPROJECT_BUNDLED=no ;; + *) PJPROJECT_BUNDLED=yes ;; + esac fi +if test "$PJPROJECT_BUNDLED" = "yes" -a "${ac_mandatory_list#*PJPROJECT*}" != "$ac_mandatory_list" ; then + as_fn_error $? "--with-pjproject and --with-pjproject-bundled can't both be specified" "$LINENO" 5 +fi - - +if test "$PJPROJECT_BUNDLED" = "yes" ; then + ac_mandatory_list="$ac_mandatory_list PJPROJECT" + PJPROJECT_DIR="${ac_top_build_prefix}third-party/pjproject" +fi PJSIP_DLG_CREATE_UAS_AND_INC_LOCK_DESCRIP="PJSIP Dialog Create UAS with Incremented Lock" @@ -10525,6 +10525,51 @@ PBX_PJ_SSL_CERT_LOAD_FROM_FILES2=0 +PJSIP_EXTERNAL_RESOLVER_DESCRIP="PJSIP External Resolver Support" +PJSIP_EXTERNAL_RESOLVER_OPTION=pjsip +PJSIP_EXTERNAL_RESOLVER_DIR=${PJPROJECT_DIR} + +PBX_PJSIP_EXTERNAL_RESOLVER=0 + + + + + + + + + POPT_DESCRIP="popt" + POPT_OPTION="popt" + PBX_POPT=0 + +# Check whether --with-popt was given. +if test "${with_popt+set}" = set; then : + withval=$with_popt; + case ${withval} in + n|no) + USE_POPT=no + # -1 is a magic value used by menuselect to know that the package + # was disabled, other than 'not found' + PBX_POPT=-1 + ;; + y|ye|yes) + ac_mandatory_list="${ac_mandatory_list} POPT" + ;; + *) + POPT_DIR="${withval}" + ac_mandatory_list="${ac_mandatory_list} POPT" + ;; + esac + +fi + + + + + + + + PORTAUDIO_DESCRIP="PortAudio" PORTAUDIO_OPTION="portaudio" PBX_PORTAUDIO=0 @@ -24153,6 +24198,244 @@ $as_echo "$as_me: *** including --without-postgres" >&6;} fi fi +if test "$USE_PJPROJECT" != "no" ; then + if test "$PJPROJECT_BUNDLED" = "yes" ; then + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for embedded pjproject (may have to download)" >&5 +$as_echo_n "checking for embedded pjproject (may have to download)... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: configuring" >&5 +$as_echo "configuring" >&6; } + make --quiet --no-print-directory -C $PJPROJECT_DIR configure + if test $? -ne 0 ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 +$as_echo "failed" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: Unable to configure $PJPROJECT_DIR" >&5 +$as_echo "$as_me: Unable to configure $PJPROJECT_DIR" >&6;} + as_fn_error $? "Run \"make -C $PJPROJECT_DIR NOISY_BUILD=yes configure\" to see error details." "$LINENO" 5 + fi + + PJPROJECT_INCLUDE=$(make --quiet --no-print-directory -C $PJPROJECT_DIR echo_cflags) + PJPROJECT_CFLAGS="$PJPROJECT_INCLUDE" + PBX_PJPROJECT=1 + PJPROJECT_BUNDLED=yes + +$as_echo "#define HAVE_PJPROJECT 1" >>confdefs.h + + +$as_echo "#define HAVE_PJPROJECT_BUNDLED 1" >>confdefs.h + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for embedded pjproject" >&5 +$as_echo_n "checking for embedded pjproject... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + + + PJSIP_DLG_CREATE_UAS_AND_INC_LOCK_INCLUDE="$PJPROJECT_INCLUDE" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pjsip_dlg_create_uas_and_inc_lock declared in pjsip.h" >&5 +$as_echo_n "checking for pjsip_dlg_create_uas_and_inc_lock declared in pjsip.h... " >&6; } + + saved_cpp="$CPPFLAGS" + CPPFLAGS="$PJPROJECT_INCLUDE" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <pjsip.h> + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "pjsip_dlg_create_uas_and_inc_lock" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + PBX_PJSIP_DLG_CREATE_UAS_AND_INC_LOCK=1 + +$as_echo "#define HAVE_PJSIP_DLG_CREATE_UAS_AND_INC_LOCK 1" >>confdefs.h + + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +fi +rm -f conftest* + + + CPPGLAGS="$saved_cpp" + PJSIP_DLG_CREATE_UAS_AND_INC_LOCK_INCLUDE="$PJPROJECT_INCLUDE" + + + PJ_TRANSACTION_GRP_LOCK_INCLUDE="$PJPROJECT_INCLUDE" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pjsip_tsx_create_uac2 declared in pjsip.h" >&5 +$as_echo_n "checking for pjsip_tsx_create_uac2 declared in pjsip.h... " >&6; } + + saved_cpp="$CPPFLAGS" + CPPFLAGS="$PJPROJECT_INCLUDE" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <pjsip.h> + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "pjsip_tsx_create_uac2" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + PBX_PJ_TRANSACTION_GRP_LOCK=1 + +$as_echo "#define HAVE_PJ_TRANSACTION_GRP_LOCK 1" >>confdefs.h + + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +fi +rm -f conftest* + + + CPPGLAGS="$saved_cpp" + PJ_TRANSACTION_GRP_LOCK_INCLUDE="$PJPROJECT_INCLUDE" + + + PJSIP_REPLACE_MEDIA_STREAM_INCLUDE="$PJPROJECT_INCLUDE" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PJMEDIA_SDP_NEG_ALLOW_MEDIA_CHANGE declared in pjmedia.h" >&5 +$as_echo_n "checking for PJMEDIA_SDP_NEG_ALLOW_MEDIA_CHANGE declared in pjmedia.h... " >&6; } + + saved_cpp="$CPPFLAGS" + CPPFLAGS="$PJPROJECT_INCLUDE" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <pjmedia.h> + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "PJMEDIA_SDP_NEG_ALLOW_MEDIA_CHANGE" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + PBX_PJSIP_REPLACE_MEDIA_STREAM=1 + +$as_echo "#define HAVE_PJSIP_REPLACE_MEDIA_STREAM 1" >>confdefs.h + + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +fi +rm -f conftest* + + + CPPGLAGS="$saved_cpp" + PJSIP_REPLACE_MEDIA_STREAM_INCLUDE="$PJPROJECT_INCLUDE" + + + PJSIP_GET_DEST_INFO_INCLUDE="$PJPROJECT_INCLUDE" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pjsip_get_dest_info declared in pjsip.h" >&5 +$as_echo_n "checking for pjsip_get_dest_info declared in pjsip.h... " >&6; } + + saved_cpp="$CPPFLAGS" + CPPFLAGS="$PJPROJECT_INCLUDE" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <pjsip.h> + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "pjsip_get_dest_info" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + PBX_PJSIP_GET_DEST_INFO=1 + +$as_echo "#define HAVE_PJSIP_GET_DEST_INFO 1" >>confdefs.h + + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +fi +rm -f conftest* + + + CPPGLAGS="$saved_cpp" + PJSIP_GET_DEST_INFO_INCLUDE="$PJPROJECT_INCLUDE" + + + PJ_SSL_CERT_LOAD_FROM_FILES2_INCLUDE="$PJPROJECT_INCLUDE" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pj_ssl_cert_load_from_files2 declared in pjlib.h" >&5 +$as_echo_n "checking for pj_ssl_cert_load_from_files2 declared in pjlib.h... " >&6; } + + saved_cpp="$CPPFLAGS" + CPPFLAGS="$PJPROJECT_INCLUDE" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <pjlib.h> + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "pj_ssl_cert_load_from_files2" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + PBX_PJ_SSL_CERT_LOAD_FROM_FILES2=1 + +$as_echo "#define HAVE_PJ_SSL_CERT_LOAD_FROM_FILES2 1" >>confdefs.h + + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +fi +rm -f conftest* + + + CPPGLAGS="$saved_cpp" + PJ_SSL_CERT_LOAD_FROM_FILES2_INCLUDE="$PJPROJECT_INCLUDE" + + + PJSIP_EXTERNAL_RESOLVER_INCLUDE="$PJPROJECT_INCLUDE" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pjsip_endpt_set_ext_resolver declared in pjsip.h" >&5 +$as_echo_n "checking for pjsip_endpt_set_ext_resolver declared in pjsip.h... " >&6; } + + saved_cpp="$CPPFLAGS" + CPPFLAGS="$PJPROJECT_INCLUDE" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <pjsip.h> + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "pjsip_endpt_set_ext_resolver" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + PBX_PJSIP_EXTERNAL_RESOLVER=1 + +$as_echo "#define HAVE_PJSIP_EXTERNAL_RESOLVER 1" >>confdefs.h + + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +fi +rm -f conftest* + + + CPPGLAGS="$saved_cpp" + PJSIP_EXTERNAL_RESOLVER_INCLUDE="$PJPROJECT_INCLUDE" + + + else if test "x${PBX_PJPROJECT}" != "x1" -a "${USE_PJPROJECT}" != "no"; then @@ -24370,7 +24653,7 @@ if eval \${$as_ac_Lib+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lpjsip ${pbxlibdir} $PJPROJECT_LIBS $LIBS" +LIBS="-lpjsip ${pbxlibdir} $PJPROJECT_LIB $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -24412,7 +24695,7 @@ fi # now check for the header. if test "${AST_PJ_TRANSACTION_GRP_LOCK_FOUND}" = "yes"; then - PJ_TRANSACTION_GRP_LOCK_LIB="${pbxlibdir} -lpjsip $PJPROJECT_LIBS" + PJ_TRANSACTION_GRP_LOCK_LIB="${pbxlibdir} -lpjsip $PJPROJECT_LIB" # if --with-PJ_TRANSACTION_GRP_LOCK=DIR has been specified, use it. if test "x${PJ_TRANSACTION_GRP_LOCK_DIR}" != "x"; then PJ_TRANSACTION_GRP_LOCK_INCLUDE="-I${PJ_TRANSACTION_GRP_LOCK_DIR}/include" @@ -24451,10 +24734,10 @@ fi -saved_cppflags="${CPPFLAGS}" -saved_libs="${LIBS}" -CPPFLAGS="${CPPFLAGS} ${PJPROJECT_CFLAGS}" -LIBS="${LIBS} ${PJPROJECT_LIBS}" + saved_cppflags="${CPPFLAGS}" + saved_libs="${LIBS}" + CPPFLAGS="${CPPFLAGS} ${PJPROJECT_CFLAGS}" + LIBS="${LIBS} ${PJPROJECT_LIB}" if test "x${PBX_PJSIP_REPLACE_MEDIA_STREAM}" != "x1" -a "${USE_PJSIP_REPLACE_MEDIA_STREAM}" != "no"; then if test "x" != "x"; then @@ -24500,8 +24783,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CPPFLAGS="${saved_cppflags}" fi -LIBS="${saved_libs}" -CPPFLAGS="${saved_cppflags}" + LIBS="${saved_libs}" + CPPFLAGS="${saved_cppflags}" if test "x${PBX_PJSIP_GET_DEST_INFO}" != "x1" -a "${USE_PJSIP_GET_DEST_INFO}" != "no"; then @@ -24527,7 +24810,7 @@ if eval \${$as_ac_Lib+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lpjsip ${pbxlibdir} $PJPROJECT_LIBS $LIBS" +LIBS="-lpjsip ${pbxlibdir} $PJPROJECT_LIB $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -24569,7 +24852,7 @@ fi # now check for the header. if test "${AST_PJSIP_GET_DEST_INFO_FOUND}" = "yes"; then - PJSIP_GET_DEST_INFO_LIB="${pbxlibdir} -lpjsip $PJPROJECT_LIBS" + PJSIP_GET_DEST_INFO_LIB="${pbxlibdir} -lpjsip $PJPROJECT_LIB" # if --with-PJSIP_GET_DEST_INFO=DIR has been specified, use it. if test "x${PJSIP_GET_DEST_INFO_DIR}" != "x"; then PJSIP_GET_DEST_INFO_INCLUDE="-I${PJSIP_GET_DEST_INFO_DIR}/include" @@ -24618,7 +24901,7 @@ if test "x${PBX_PJ_SSL_CERT_LOAD_FROM_FILES2}" != "x1" -a "${USE_PJ_SSL_CERT_LOA pbxlibdir="-L${PJ_SSL_CERT_LOAD_FROM_FILES2_DIR}" fi fi - pbxfuncname="pj_ssl_cert_load_from_files2" + pbxfuncname="pjsip/include/pjsip/sip_util.h" if test "x${pbxfuncname}" = "x" ; then # empty lib, assume only headers AST_PJ_SSL_CERT_LOAD_FROM_FILES2_FOUND=yes else @@ -24631,7 +24914,7 @@ if eval \${$as_ac_Lib+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lpj ${pbxlibdir} $PJPROJECT_LIBS $LIBS" +LIBS="-lpj ${pbxlibdir} $PJPROJECT_LIB $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -24673,7 +24956,7 @@ fi # now check for the header. if test "${AST_PJ_SSL_CERT_LOAD_FROM_FILES2_FOUND}" = "yes"; then - PJ_SSL_CERT_LOAD_FROM_FILES2_LIB="${pbxlibdir} -lpj $PJPROJECT_LIBS" + PJ_SSL_CERT_LOAD_FROM_FILES2_LIB="${pbxlibdir} -lpj $PJPROJECT_LIB" # if --with-PJ_SSL_CERT_LOAD_FROM_FILES2=DIR has been specified, use it. if test "x${PJ_SSL_CERT_LOAD_FROM_FILES2_DIR}" != "x"; then PJ_SSL_CERT_LOAD_FROM_FILES2_INCLUDE="-I${PJ_SSL_CERT_LOAD_FROM_FILES2_DIR}/include" @@ -24712,6 +24995,112 @@ fi +if test "x${PBX_PJSIP_EXTERNAL_RESOLVER}" != "x1" -a "${USE_PJSIP_EXTERNAL_RESOLVER}" != "no"; then + pbxlibdir="" + # if --with-PJSIP_EXTERNAL_RESOLVER=DIR has been specified, use it. + if test "x${PJSIP_EXTERNAL_RESOLVER_DIR}" != "x"; then + if test -d ${PJSIP_EXTERNAL_RESOLVER_DIR}/lib; then + pbxlibdir="-L${PJSIP_EXTERNAL_RESOLVER_DIR}/lib" + else + pbxlibdir="-L${PJSIP_EXTERNAL_RESOLVER_DIR}" + fi + fi + pbxfuncname="pjsip_endpt_set_ext_resolver" + if test "x${pbxfuncname}" = "x" ; then # empty lib, assume only headers + AST_PJSIP_EXTERNAL_RESOLVER_FOUND=yes + else + ast_ext_lib_check_save_CFLAGS="${CFLAGS}" + CFLAGS="${CFLAGS} $PJPROJECT_CFLAGS" + as_ac_Lib=`$as_echo "ac_cv_lib_pjsip_${pbxfuncname}" | $as_tr_sh` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpjsip" >&5 +$as_echo_n "checking for ${pbxfuncname} in -lpjsip... " >&6; } +if eval \${$as_ac_Lib+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpjsip ${pbxlibdir} $PJPROJECT_LIBS $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char ${pbxfuncname} (); +int +main () +{ +return ${pbxfuncname} (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$as_ac_Lib=yes" +else + eval "$as_ac_Lib=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +eval ac_res=\$$as_ac_Lib + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : + AST_PJSIP_EXTERNAL_RESOLVER_FOUND=yes +else + AST_PJSIP_EXTERNAL_RESOLVER_FOUND=no +fi + + CFLAGS="${ast_ext_lib_check_save_CFLAGS}" + fi + + # now check for the header. + if test "${AST_PJSIP_EXTERNAL_RESOLVER_FOUND}" = "yes"; then + PJSIP_EXTERNAL_RESOLVER_LIB="${pbxlibdir} -lpjsip $PJPROJECT_LIBS" + # if --with-PJSIP_EXTERNAL_RESOLVER=DIR has been specified, use it. + if test "x${PJSIP_EXTERNAL_RESOLVER_DIR}" != "x"; then + PJSIP_EXTERNAL_RESOLVER_INCLUDE="-I${PJSIP_EXTERNAL_RESOLVER_DIR}/include" + fi + PJSIP_EXTERNAL_RESOLVER_INCLUDE="${PJSIP_EXTERNAL_RESOLVER_INCLUDE} $PJPROJECT_CFLAGS" + if test "xpjsip.h" = "x" ; then # no header, assume found + PJSIP_EXTERNAL_RESOLVER_HEADER_FOUND="1" + else # check for the header + ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}" + CPPFLAGS="${CPPFLAGS} ${PJSIP_EXTERNAL_RESOLVER_INCLUDE}" + ac_fn_c_check_header_mongrel "$LINENO" "pjsip.h" "ac_cv_header_pjsip_h" "$ac_includes_default" +if test "x$ac_cv_header_pjsip_h" = xyes; then : + PJSIP_EXTERNAL_RESOLVER_HEADER_FOUND=1 +else + PJSIP_EXTERNAL_RESOLVER_HEADER_FOUND=0 +fi + + + CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}" + fi + if test "x${PJSIP_EXTERNAL_RESOLVER_HEADER_FOUND}" = "x0" ; then + PJSIP_EXTERNAL_RESOLVER_LIB="" + PJSIP_EXTERNAL_RESOLVER_INCLUDE="" + else + if test "x${pbxfuncname}" = "x" ; then # only checking headers -> no library + PJSIP_EXTERNAL_RESOLVER_LIB="" + fi + PBX_PJSIP_EXTERNAL_RESOLVER=1 + cat >>confdefs.h <<_ACEOF +#define HAVE_PJSIP_EXTERNAL_RESOLVER 1 +_ACEOF + + fi + fi +fi + + + fi +fi + if test "x${PBX_POPT}" != "x1" -a "${USE_POPT}" != "no"; then pbxlibdir="" |