From 752fd06d1201b736ee11c9c0b0abea33ba1898cf Mon Sep 17 00:00:00 2001
From: Corey Farrell <git@cfware.com>
Date: Fri, 16 Nov 2018 07:20:11 -0500
Subject: [PATCH] pjproject-bundled: Use AST_DEVMODE for conditional
 compilation.

We previously allowed resample and g711 codecs to be built when
TEST_FRAMEWORK was enabled.  This could cause errors if the testsuite
was run without this option enabled.  Switch the build system to allow
those codecs to be built when --enable-dev-mode is used.  This removes a
chance for strange testsuite errors from use of an inadequate pjsua
binary.

Change-Id: Iee8a3613cdb711fa7e7d217c5a775a575907ae22
---
 configure                            | 2 +-
 third-party/pjproject/Makefile       | 4 +---
 third-party/pjproject/Makefile.rules | 2 +-
 third-party/pjproject/configure.m4   | 2 +-
 4 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/configure b/configure
index 47cf7e7b81..ee3eb4bcd4 100755
--- a/configure
+++ b/configure
@@ -9411,7 +9411,7 @@ $as_echo "configuring" >&6; }
 	fi
 
 	export TAR PATCH SED NM EXTERNALS_CACHE_DIR AST_DOWNLOAD_CACHE DOWNLOAD_TO_STDOUT DOWNLOAD_TIMEOUT DOWNLOAD MD5 CAT CUT GREP
-	export NOISY_BUILD
+	export NOISY_BUILD AST_DEVMODE
 	${GNU_MAKE} --quiet --no-print-directory -C ${PJPROJECT_DIR} \
 		PJPROJECT_CONFIGURE_OPTS="$PJPROJECT_CONFIGURE_OPTS" \
 		EXTERNALS_CACHE_DIR="${EXTERNALS_CACHE_DIR:-${AST_DOWNLOAD_CACHE}}" \
diff --git a/third-party/pjproject/Makefile b/third-party/pjproject/Makefile
index c761cb59c7..97835e4925 100644
--- a/third-party/pjproject/Makefile
+++ b/third-party/pjproject/Makefile
@@ -54,14 +54,12 @@ ifeq ($(SPECIAL_TARGETS),)
         include source/build.mak
         CF := $(filter-out -W%,$(CC_CFLAGS))
         CF := $(filter-out -I%,$(CF))
-        ifeq ($(findstring TEST_FRAMEWORK,$(MENUSELECT_CFLAGS)),TEST_FRAMEWORK)
+        ifeq ($(AST_DEVMODE),yes)
             apps := source/pjsip-apps/bin/pjsua-$(TARGET_NAME) source/pjsip-apps/bin/pjsystest-$(TARGET_NAME)
             TARGETS += $(apps)
             ifneq ($(PYTHONDEV_LIB),)
                 TARGETS += source/pjsip-apps/src/python/_pjsua.so
             endif
-        endif
-        ifeq ($(AST_DEVMODE),yes)
             CF += -DPJPROJECT_BUNDLED_ASSERTIONS=yes
         endif
         MALLOC_DEBUG_LIBS = source/pjsip-apps/lib/libasterisk_malloc_debug.a
diff --git a/third-party/pjproject/Makefile.rules b/third-party/pjproject/Makefile.rules
index 6a48e866c7..e76a753e58 100644
--- a/third-party/pjproject/Makefile.rules
+++ b/third-party/pjproject/Makefile.rules
@@ -39,7 +39,7 @@ PJPROJECT_CONFIG_OPTS = $(PJPROJECT_CONFIGURE_OPTS) --prefix=/opt/pjproject \
 	--without-external-pa \
 	--without-external-srtp
 
-ifeq ($(findstring TEST_FRAMEWORK,$(MENUSELECT_CFLAGS)),)
+ifneq ($(AST_DEVMODE),yes)
     PJPROJECT_CONFIG_OPTS += --disable-resample --disable-g711-codec
 endif
 
diff --git a/third-party/pjproject/configure.m4 b/third-party/pjproject/configure.m4
index 9e89098762..d0211520b7 100644
--- a/third-party/pjproject/configure.m4
+++ b/third-party/pjproject/configure.m4
@@ -73,7 +73,7 @@ AC_DEFUN([_PJPROJECT_CONFIGURE],
 	fi
 
 	export TAR PATCH SED NM EXTERNALS_CACHE_DIR AST_DOWNLOAD_CACHE DOWNLOAD_TO_STDOUT DOWNLOAD_TIMEOUT DOWNLOAD MD5 CAT CUT GREP
-	export NOISY_BUILD
+	export NOISY_BUILD AST_DEVMODE
 	${GNU_MAKE} --quiet --no-print-directory -C ${PJPROJECT_DIR} \
 		PJPROJECT_CONFIGURE_OPTS="$PJPROJECT_CONFIGURE_OPTS" \
 		EXTERNALS_CACHE_DIR="${EXTERNALS_CACHE_DIR:-${AST_DOWNLOAD_CACHE}}" \
-- 
GitLab