[Asterisk-code-review] bundled pjproject: Add tests for programs used by the Makef... (asterisk[master])
George Joseph
asteriskteam at digium.com
Mon Oct 3 15:30:44 CDT 2016
George Joseph has uploaded a new change for review.
https://gerrit.asterisk.org/4016
Change subject: bundled_pjproject: Add tests for programs used by the Makefile, et al.
......................................................................
bundled_pjproject: Add tests for programs used by the Makefile, et al.
Added tests for sed, tar, bzip2, patch and nm.
The tarball is now downloaded to the externals_cache_dir if it was
specified on the ./configure command line
Removed regeneration of the pjproject aconfigure file. It was only
needed for an old patch that no longer applies.
Converted the tests for symbols to explicit tests since we know that
they're now available in the bundled version. Saves a little time
during configure.
Fixed third-party/Makefile.rules to properly set TAR, PATCH, SED
and NM if not already set and fixed the logic that adds options to
DOWNLOAD.
ASTERISK-26416 #close
Reported-by: Corey Farrell
Change-Id: Id1d94251c0155f8dd41b7de7067f35cfbaafbb9b
---
M Makefile
M configure
M configure.ac
M makeopts.in
M third-party/Makefile.rules
M third-party/pjproject/Makefile
M third-party/pjproject/apply_patches
M third-party/pjproject/configure.m4
8 files changed, 301 insertions(+), 245 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/16/4016/1
diff --git a/Makefile b/Makefile
index 992e1d3..8e237e1 100644
--- a/Makefile
+++ b/Makefile
@@ -99,6 +99,10 @@
export LDCONFIG
export LDCONFIG_FLAGS
export PYTHON
+export TAR
+export PATCH
+export SED
+export NM
# makeopts is required unless the goal is clean or distclean
ifeq ($(findstring clean,$(MAKECMDGOALS)),)
diff --git a/configure b/configure
index a5da739..8cfef9f 100755
--- a/configure
+++ b/configure
@@ -1221,6 +1221,10 @@
LDCONFIG
DOWNLOAD
FETCH
+NM
+PATCH
+TAR
+BZIP2
ALEMBIC
GIT
BASH
@@ -1325,7 +1329,6 @@
docdir
oldincludedir
includedir
-runstatedir
localstatedir
sharedstatedir
sysconfdir
@@ -1507,7 +1510,6 @@
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
-runstatedir='${localstatedir}/run'
includedir='${prefix}/include'
oldincludedir='/usr/include'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1760,15 +1762,6 @@
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;
- -runstatedir | --runstatedir | --runstatedi | --runstated \
- | --runstate | --runstat | --runsta | --runst | --runs \
- | --run | --ru | --r)
- ac_prev=runstatedir ;;
- -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
- | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
- | --run=* | --ru=* | --r=*)
- runstatedir=$ac_optarg ;;
-
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1906,7 +1899,7 @@
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
- libdir localedir mandir runstatedir
+ libdir localedir mandir
do
eval ac_val=\$$ac_var
# Remove trailing slashes.
@@ -2059,7 +2052,6 @@
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
- --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
@@ -7644,6 +7636,212 @@
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
+
+
+# Extract the first word of "bzip2", so it can be a program name with args.
+set dummy bzip2; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_BZIP2+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $BZIP2 in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_BZIP2="$BZIP2" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_BZIP2="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ test -z "$ac_cv_path_BZIP2" && ac_cv_path_BZIP2=":"
+ ;;
+esac
+fi
+BZIP2=$ac_cv_path_BZIP2
+if test -n "$BZIP2"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BZIP2" >&5
+$as_echo "$BZIP2" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+# Extract the first word of "tar", so it can be a program name with args.
+set dummy tar; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_TAR+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $TAR in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_TAR="$TAR" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_TAR="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ test -z "$ac_cv_path_TAR" && ac_cv_path_TAR=":"
+ ;;
+esac
+fi
+TAR=$ac_cv_path_TAR
+if test -n "$TAR"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TAR" >&5
+$as_echo "$TAR" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+# Extract the first word of "patch", so it can be a program name with args.
+set dummy patch; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_PATCH+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $PATCH in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_PATCH="$PATCH" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_PATCH="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ test -z "$ac_cv_path_PATCH" && ac_cv_path_PATCH=":"
+ ;;
+esac
+fi
+PATCH=$ac_cv_path_PATCH
+if test -n "$PATCH"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PATCH" >&5
+$as_echo "$PATCH" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+# Extract the first word of "sed", so it can be a program name with args.
+set dummy sed; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_SED+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $SED in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_SED="$SED" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_SED="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ test -z "$ac_cv_path_SED" && ac_cv_path_SED=":"
+ ;;
+esac
+fi
+SED=$ac_cv_path_SED
+if test -n "$SED"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SED" >&5
+$as_echo "$SED" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+# Extract the first word of "nm", so it can be a program name with args.
+set dummy nm; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_NM+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $NM in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_NM="$NM" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_NM="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ test -z "$ac_cv_path_NM" && ac_cv_path_NM=":"
+ ;;
+esac
+fi
+NM=$ac_cv_path_NM
+if test -n "$NM"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NM" >&5
+$as_echo "$NM" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
if test "${WGET}" != ":" ; then
@@ -25159,6 +25357,22 @@
$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; }
+ if test "${BZIP2}" = ":" ; then
+ as_fn_error $? "bzip2 is required to extract the pjproject tar file" "$LINENO" 5
+ fi
+ if test "${TAR}" = ":" ; then
+ as_fn_error $? "tar is required to extract the pjproject tar file" "$LINENO" 5
+ fi
+ if test "${PATCH}" = ":" ; then
+ as_fn_error $? "patch is required to configure bundled pjproject" "$LINENO" 5
+ fi
+ if test "${SED}" = ":" ; then
+ as_fn_error $? "sed is required to configure bundled pjproject" "$LINENO" 5
+ fi
+ if test "${NM}" = ":" ; then
+ as_fn_error $? "nm is required to build bundled pjproject" "$LINENO" 5
+ fi
+ export TAR PATCH SED NM EXTERNALS_CACHE_DIR DOWNLOAD
${GNU_MAKE} --quiet --no-print-directory -C $PJPROJECT_DIR configure
if test $? -ne 0 ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5
@@ -25184,208 +25398,22 @@
$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"
$as_echo "#define HAVE_PJSIP_TLS_TRANSPORT_PROTO 1" >>confdefs.h
diff --git a/configure.ac b/configure.ac
index 17b8872..ba3928b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -284,6 +284,12 @@
AC_PATH_PROG([BASH], [bash], :)
AC_PATH_PROG([GIT], [git], :)
AC_PATH_PROG([ALEMBIC], [alembic], :)
+AC_PATH_PROG([BZIP2], [bzip2], :)
+AC_PATH_PROG([TAR], [tar], :)
+AC_PATH_PROG([PATCH], [patch], :)
+AC_PATH_PROG([SED], [sed], :)
+AC_PATH_PROG([NM], [nm], :)
+
if test "${WGET}" != ":" ; then
DOWNLOAD=${WGET}
else if test "${CURL}" != ":" ; then
diff --git a/makeopts.in b/makeopts.in
index b2b394b..18662ad 100644
--- a/makeopts.in
+++ b/makeopts.in
@@ -41,6 +41,10 @@
LDCONFIG=@LDCONFIG@
GIT=@GIT@
ALEMBIC=@ALEMBIC@
+TAR=@TAR@
+PATCH=@PATCH@
+SED=@SED@
+NM=@NM@
BUILD_PLATFORM=@BUILD_PLATFORM@
BUILD_CPU=@BUILD_CPU@
diff --git a/third-party/Makefile.rules b/third-party/Makefile.rules
index e633e0e..a587de4 100644
--- a/third-party/Makefile.rules
+++ b/third-party/Makefile.rules
@@ -13,16 +13,33 @@
REALLY_QUIET=
endif
-DOWNLOAD := $(shell which wget 2>/dev/null)
-DOWNLOAD := $(if $(DOWNLOAD),$(DOWNLOAD) -O- ,)
+# These are needed as fallbacks if top-level configure hasn't been run.
+# This doesn't guarantee that a third-party package will compile.
-ifeq ($(DOWNLOAD),)
-DOWNLOAD := $(shell which curl 2>/dev/null)
-DOWNLOAD := $(if $(DOWNLOAD), $(DOWNLOAD) -L ,)
+find_program=$(firstword $(wildcard $(addsuffix /$(1),$(subst :, ,$(PATH)))))
+fail_program=$(if $(call find_program,$(1)),$(call find_program,$(1)),$(error Unable to find '$(1)'))
+
+TAR ?= $(call fail_program,tar)
+PATCH ?= $(call fail_program,patch)
+SED ?= $(call fail_program,sed)
+NM ?= $(call fail_program,nm)
+DOWNLOAD ?= $(or $(call find_program,wget),$(call find_program,curl),$(call find_program,fetch))
+
+# These are needed regardless of whether top-level configure has been run.
+
+# Output to stdout to be comatible with curl
+ifeq ($(findstring wget,$(DOWNLOAD)),wget)
+DOWNLOAD += -O-
endif
-ifeq ($(DOWNLOAD),)
-DOWNLOAD := echo "No download program available" ; exit 1;
+# Output to stdout to be comatible with curl
+ifeq ($(findstring fetch,$(DOWNLOAD)),fetch)
+DOWNLOAD += -o-
+endif
+
+# Follow redirects
+ifeq ($(findstring curl,$(DOWNLOAD)),curl)
+DOWNLOAD += -L
endif
export SUBMAKE
@@ -34,3 +51,8 @@
export ASTSBINDIR
export DESTDIR
export ASTDATADIR
+export TAR
+export PATCH
+export SED
+export NM
+export DOWNLOAD
diff --git a/third-party/pjproject/Makefile b/third-party/pjproject/Makefile
index 7349db6..17e2cfb 100644
--- a/third-party/pjproject/Makefile
+++ b/third-party/pjproject/Makefile
@@ -59,13 +59,7 @@
ECHO_PREFIX := $(ECHO_PREFIX) echo '[pjproject] '
-ifndef $(TMPDIR)
- ifneq ($(wildcard /tmp),)
- TMPDIR=/tmp
- else
- TMPDIR=.
- endif
-endif
+TMPDIR ?= $(or $(EXTERNALS_CACHE_DIR),$(wildcard /tmp),.)
$(TMPDIR)/pjproject-$(PJPROJECT_VERSION).tar.bz2 : ../versions.mak
$(ECHO_PREFIX) Downloading $@ with $(DOWNLOAD)
@@ -75,7 +69,7 @@
$(ECHO_PREFIX) Unpacking $<
- at rm -rf source &>/dev/null
- at mkdir source &>/dev/null
- $(CMD_PREFIX) tar --strip-components=1 -C source -xjf $<
+ $(CMD_PREFIX) $(TAR) --strip-components=1 -C source -xjf $<
$(ECHO_PREFIX) Applying patches
$(CMD_PREFIX) ./apply_patches $(QUIET_CONFIGURE) ./patches ./source
- at touch source/.unpacked
@@ -90,8 +84,8 @@
build.mak: source/.unpacked source/pjlib/include/pj/config_site.h source/user.mak Makefile.rules
$(ECHO_PREFIX) Configuring with $(PJPROJECT_CONFIG_OPTS)
- $(CMD_PREFIX) (cd source ; autoconf aconfigure.ac > aconfigure && ./aconfigure $(QUIET_CONFIGURE) $(PJPROJECT_CONFIG_OPTS))
- @sed -r -e "/prefix|export PJ_SHARED_LIBRARIES|MACHINE_NAME|OS_NAME|HOST_NAME|CC_NAME|CROSS_COMPILE|LINUX_POLL/d" source/build.mak > build.mak
+ $(CMD_PREFIX) (cd source ; ./aconfigure $(QUIET_CONFIGURE) $(PJPROJECT_CONFIG_OPTS))
+ @$(SED) -r -e "/prefix|export PJ_SHARED_LIBRARIES|MACHINE_NAME|OS_NAME|HOST_NAME|CC_NAME|CROSS_COMPILE|LINUX_POLL/d" source/build.mak > build.mak
configure: build.mak
@@ -112,7 +106,7 @@
pjproject.symbols: source/pjlib/lib/libpj-$(TARGET_NAME).a
$(ECHO_PREFIX) Generating symbols
- $(CMD_PREFIX) nm -Pog $(PJ_LIB_FILES) | sed -n -r -e "s/.+: ([pP][jJ][^ ]+) .+/\1/gp" | sort -u > pjproject.symbols
+ $(CMD_PREFIX) $(NM) -Pog $(PJ_LIB_FILES) | $(SED) -n -r -e "s/.+: ([pP][jJ][^ ]+) .+/\1/gp" | sort -u > pjproject.symbols
source/pjsip-apps/bin/pjsua-$(TARGET_NAME): source/pjlib/lib/libpj-$(TARGET_NAME).a
$(ECHO_PREFIX) Compiling apps
@@ -151,4 +145,3 @@
distclean:
$(ECHO_PREFIX) Distcleaning
-$(CMD_PREFIX) rm -rf source pjproject.symbols pjproject-*.tar.bz2 build.mak
-
diff --git a/third-party/pjproject/apply_patches b/third-party/pjproject/apply_patches
index 5dfdd2a..c28f403 100755
--- a/third-party/pjproject/apply_patches
+++ b/third-party/pjproject/apply_patches
@@ -5,6 +5,8 @@
shift
fi
+PATCH=${PATCH:-patch}
+
patchdir=${1:?You must supply a patches directory}
sourcedir=${2?:You must supply a source directory}
@@ -27,12 +29,12 @@
fi
for patchfile in $patchdir/*.patch ; do
- patch -d $sourcedir -p1 -s -r- -f -N --dry-run -i "$patchfile" || (echo "Patchfile $(basename $patchfile) failed to apply" >&2 ; exit 1) || exit 1
+ ${PATCH} -d $sourcedir -p1 -s -r- -f -N --dry-run -i "$patchfile" || (echo "Patchfile $(basename $patchfile) failed to apply" >&2 ; exit 1) || exit 1
done
for patchfile in "$patchdir"/*.patch ; do
[ -z $quiet ] && echo "Applying patch $(basename $patchfile)"
- patch -d "$sourcedir" -p1 -s -i "$patchfile" || exit 1
+ ${PATCH} -d "$sourcedir" -p1 -s -i "$patchfile" || exit 1
done
exit 0
diff --git a/third-party/pjproject/configure.m4 b/third-party/pjproject/configure.m4
index 7a079f6..9919d05 100644
--- a/third-party/pjproject/configure.m4
+++ b/third-party/pjproject/configure.m4
@@ -1,26 +1,23 @@
-AC_DEFUN([PJPROJECT_SYMBOL_CHECK],
-[
- $1_INCLUDE="$PJPROJECT_INCLUDE"
- AC_MSG_CHECKING([for $2 declared in $3])
-
- saved_cpp="$CPPFLAGS"
- CPPFLAGS="$PJPROJECT_INCLUDE"
- AC_EGREP_HEADER($2, $3, [
- AC_MSG_RESULT(yes)
- PBX_$1=1
- AC_DEFINE([HAVE_$1], 1, [Define if your system has $2 declared.])
- ], [
- AC_MSG_RESULT(no)
- ])
-
- CPPGLAGS="$saved_cpp"
- $1_INCLUDE="$PJPROJECT_INCLUDE"
-])
-
AC_DEFUN([PJPROJECT_CONFIGURE],
[
AC_MSG_CHECKING(for embedded pjproject (may have to download))
AC_MSG_RESULT(configuring)
+ if test "${BZIP2}" = ":" ; then
+ AC_MSG_ERROR(bzip2 is required to extract the pjproject tar file)
+ fi
+ if test "${TAR}" = ":" ; then
+ AC_MSG_ERROR(tar is required to extract the pjproject tar file)
+ fi
+ if test "${PATCH}" = ":" ; then
+ AC_MSG_ERROR(patch is required to configure bundled pjproject)
+ fi
+ if test "${SED}" = ":" ; then
+ AC_MSG_ERROR(sed is required to configure bundled pjproject)
+ fi
+ if test "${NM}" = ":" ; then
+ AC_MSG_ERROR(nm is required to build bundled pjproject)
+ fi
+ export TAR PATCH SED NM EXTERNALS_CACHE_DIR DOWNLOAD
${GNU_MAKE} --quiet --no-print-directory -C $1 configure
if test $? -ne 0 ; then
AC_MSG_RESULT(failed)
@@ -37,12 +34,12 @@
AC_MSG_CHECKING(for embedded pjproject)
AC_MSG_RESULT(yes)
- PJPROJECT_SYMBOL_CHECK([PJSIP_DLG_CREATE_UAS_AND_INC_LOCK], [pjsip_dlg_create_uas_and_inc_lock], [pjsip.h])
- PJPROJECT_SYMBOL_CHECK([PJ_TRANSACTION_GRP_LOCK], [pjsip_tsx_create_uac2], [pjsip.h])
- PJPROJECT_SYMBOL_CHECK([PJSIP_REPLACE_MEDIA_STREAM], [PJMEDIA_SDP_NEG_ALLOW_MEDIA_CHANGE], [pjmedia.h])
- PJPROJECT_SYMBOL_CHECK([PJSIP_GET_DEST_INFO], [pjsip_get_dest_info], [pjsip.h])
- PJPROJECT_SYMBOL_CHECK([PJ_SSL_CERT_LOAD_FROM_FILES2], [pj_ssl_cert_load_from_files2], [pjlib.h])
- PJPROJECT_SYMBOL_CHECK([PJSIP_EXTERNAL_RESOLVER], [pjsip_endpt_set_ext_resolver], [pjsip.h])
+ AC_DEFINE([HAVE_PJSIP_DLG_CREATE_UAS_AND_INC_LOCK], 1, [Define if your system has pjsip_dlg_create_uas_and_inc_lock declared.])
+ AC_DEFINE([HAVE_PJ_TRANSACTION_GRP_LOCK], 1, [Define if your system has pjsip_tsx_create_uac2 declared.])
+ AC_DEFINE([HAVE_PJSIP_REPLACE_MEDIA_STREAM], 1, [Define if your system has PJSIP_REPLACE_MEDIA_STREAM declared])
+ AC_DEFINE([HAVE_PJSIP_GET_DEST_INFO], 1, [Define if your system has pjsip_get_dest_info declared.])
+ AC_DEFINE([HAVE_PJ_SSL_CERT_LOAD_FROM_FILES2], 1, [Define if your system has pj_ssl_cert_load_from_files2 declared.])
+ AC_DEFINE([HAVE_PJSIP_EXTERNAL_RESOLVER], 1, [Define if your system has pjsip_endpt_set_ext_resolver declared.])
AC_DEFINE([HAVE_PJSIP_TLS_TRANSPORT_PROTO], 1, [Define if your system has PJSIP_TLS_TRANSPORT_PROTO])
AC_DEFINE([HAVE_PJSIP_EVSUB_GRP_LOCK], 1, [Define if your system has PJSIP_EVSUB_GRP_LOCK])
AC_DEFINE([HAVE_PJSIP_INV_SESSION_REF], 1, [Define if your system has PJSIP_INV_SESSION_REF])
--
To view, visit https://gerrit.asterisk.org/4016
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id1d94251c0155f8dd41b7de7067f35cfbaafbb9b
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: George Joseph <gjoseph at digium.com>
More information about the asterisk-code-review
mailing list