<p>George Joseph has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/5939">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">pjproject_bundled:  Allow passing configure options to bundled<br><br>There wasn't any good way to pass options like --host or --build<br>down to the pjproject configure which makes cross-compiling difficult.<br><br>* Added a new PJPROJECT_CONFIGURE_OPTS environment variable which<br>  can be used to pass arbitrary options to pjproject configure.<br>* Automatically set the pjproject configure --host and --build<br>  options to match those supplied for the asterisk configure.<br><br>ASTERISK-27097 #close<br>Reported-by: Kinsey Moore<br><br>Change-Id: I5fa776e110262851173002a26ffe1172e4c35b2e<br>---<br>M CHANGES<br>M configure<br>M third-party/configure.m4<br>M third-party/pjproject/Makefile.rules<br>M third-party/pjproject/configure.m4<br>5 files changed, 63 insertions(+), 26 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/39/5939/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/CHANGES b/CHANGES<br>index 98b4aa1..c3a2d0a 100644<br>--- a/CHANGES<br>+++ b/CHANGES<br>@@ -54,6 +54,14 @@<br>    from the SDP, unless the remote side sends a different codec and we will<br>    switch to match.<br> <br>+Build System<br>+------------------<br>+ * Added a new PJPROJECT_CONFIGURE_OPTS environment variable which can be used<br>+   to pass arbitrary options to the bundled pjproject configure.<br>+<br>+ * Automatically set the bundled pjproject configure --host and --build<br>+   options to match those supplied for the asterisk configure.<br>+<br> ------------------------------------------------------------------------------<br> --- Functionality changes from Asterisk 13.15.0 to Asterisk 13.16.0 ----------<br> ------------------------------------------------------------------------------<br>diff --git a/configure b/configure<br>index 55b0225..c566357 100755<br>--- a/configure<br>+++ b/configure<br>@@ -1191,6 +1191,7 @@<br> PBX_PJPROJECT<br> PJPROJECT_DIR<br> PJPROJECT_BUNDLED<br>+PJPROJECT_CONFIGURE_OPTS<br> AST_C_COMPILER_FAMILY<br> AST_CLANG_BLOCKS<br> AST_CLANG_BLOCKS_LIBS<br>@@ -1327,7 +1328,6 @@<br> docdir<br> oldincludedir<br> includedir<br>-runstatedir<br> localstatedir<br> sharedstatedir<br> sysconfdir<br>@@ -1452,6 +1452,7 @@<br> CXXFLAGS<br> CCC<br> CXXCPP<br>+PJPROJECT_CONFIGURE_OPTS<br> PKG_CONFIG<br> PKG_CONFIG_PATH<br> PKG_CONFIG_LIBDIR<br>@@ -1507,7 +1508,6 @@<br> sysconfdir='${prefix}/etc'<br> sharedstatedir='${prefix}/com'<br> localstatedir='${prefix}/var'<br>-runstatedir='${localstatedir}/run'<br> includedir='${prefix}/include'<br> oldincludedir='/usr/include'<br> docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'<br>@@ -1760,15 +1760,6 @@<br>   | -silent | --silent | --silen | --sile | --sil)<br>     silent=yes ;;<br> <br>-  -runstatedir | --runstatedir | --runstatedi | --runstated \<br>-  | --runstate | --runstat | --runsta | --runst | --runs \<br>-  | --run | --ru | --r)<br>-    ac_prev=runstatedir ;;<br>-  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \<br>-  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \<br>-  | --run=* | --ru=* | --r=*)<br>-    runstatedir=$ac_optarg ;;<br>-<br>   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)<br>     ac_prev=sbindir ;;<br>   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \<br>@@ -1906,7 +1897,7 @@<br> for ac_var in    exec_prefix prefix bindir sbindir libexecdir datarootdir \<br>            datadir sysconfdir sharedstatedir localstatedir includedir \<br>          oldincludedir docdir infodir htmldir dvidir pdfdir psdir \<br>-           libdir localedir mandir runstatedir<br>+          libdir localedir mandir<br> do<br>   eval ac_val=\$$ac_var<br>   # Remove trailing slashes.<br>@@ -2059,7 +2050,6 @@<br>   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]<br>   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]<br>   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]<br>-  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]<br>   --libdir=DIR            object code libraries [EPREFIX/lib]<br>   --includedir=DIR        C header files [PREFIX/include]<br>   --oldincludedir=DIR     C header files for non-gcc [/usr/include]<br>@@ -2206,6 +2196,8 @@<br>   CXX         C++ compiler command<br>   CXXFLAGS    C++ compiler flags<br>   CXXCPP      C++ preprocessor<br>+  PJPROJECT_CONFIGURE_OPTS<br>+              Additional configure options to pass to bundled pjproject<br>   PKG_CONFIG  path to pkg-config utility<br>   PKG_CONFIG_PATH<br>               directories to add to pkg-config's search path<br>@@ -9276,20 +9268,33 @@<br>                 as_fn_error $? "cat is required to build bundled pjproject" "$LINENO" 5<br>   fi<br> <br>+<br>+     this_host=$(./config.sub $(./config.guess))<br>+  if test "$build" != "$this_host" ; then<br>+          PJPROJECT_CONFIGURE_OPTS+=" --build=$build"<br>+        fi<br>+   if test "$host" != "$this_host" ; then<br>+           PJPROJECT_CONFIGURE_OPTS+=" --host=$host"<br>+  fi<br>+<br>         export TAR PATCH SED NM EXTERNALS_CACHE_DIR DOWNLOAD_TO_STDOUT DOWNLOAD_TIMEOUT DOWNLOAD MD5 CAT<br>-     ${GNU_MAKE} --quiet --no-print-directory -C ${PJPROJECT_DIR} EXTERNALS_CACHE_DIR=${EXTERNALS_CACHE_DIR} configure<br>+    export NOISY_BUILD<br>+   ${GNU_MAKE} --quiet --no-print-directory -C ${PJPROJECT_DIR} \<br>+               PJPROJECT_CONFIGURE_OPTS="$PJPROJECT_CONFIGURE_OPTS" \<br>+             EXTERNALS_CACHE_DIR="${EXTERNALS_CACHE_DIR}" \<br>+             configure<br>     if test $? -ne 0 ; then<br>               { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5<br> $as_echo "failed" >&6; }<br>             { $as_echo "$as_me:${as_lineno-$LINENO}: Unable to configure ${PJPROJECT_DIR}" >&5<br> $as_echo "$as_me: Unable to configure ${PJPROJECT_DIR}" >&6;}<br>-         as_fn_error $? "Run \"${GNU_MAKE} -C ${PJPROJECT_DIR} NOISY_BUILD=yes configure\" to see error details." "$LINENO" 5<br>+           as_fn_error $? "Re-run the ./configure command with 'NOISY_BUILD=yes' appended to see error details." "$LINENO" 5<br>         fi<br> <br>         { $as_echo "$as_me:${as_lineno-$LINENO}: checking for bundled pjproject" >&5<br> $as_echo_n "checking for bundled pjproject... " >&6; }<br> <br>-   PJPROJECT_INCLUDE=$(${GNU_MAKE} --quiet --no-print-directory -C ${PJPROJECT_DIR} EXTERNALS_CACHE_DIR=${EXTERNALS_CACHE_DIR} echo_cflags)<br>+     PJPROJECT_INCLUDE=$(${GNU_MAKE} --quiet --no-print-directory -C ${PJPROJECT_DIR} PJPROJECT_CONFIGURE_OPTS="$PJPROJECT_CONFIGURE_OPTS" EXTERNALS_CACHE_DIR="${EXTERNALS_CACHE_DIR}" echo_cflags)<br>   PJPROJECT_CFLAGS="$PJPROJECT_INCLUDE"<br>       PBX_PJPROJECT=1<br> <br>@@ -14668,7 +14673,7 @@<br>     We can't simply define LARGE_OFF_T to be 9223372036854775807,<br>     since some C++ compilers masquerading as C compilers<br>     incorrectly reject 9223372036854775807.  */<br>-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))<br>+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))<br>   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721<br>                     && LARGE_OFF_T % 2147483647 == 1)<br>                    ? 1 : -1];<br>@@ -14714,7 +14719,7 @@<br>     We can't simply define LARGE_OFF_T to be 9223372036854775807,<br>     since some C++ compilers masquerading as C compilers<br>     incorrectly reject 9223372036854775807.  */<br>-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))<br>+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))<br>   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721<br>                       && LARGE_OFF_T % 2147483647 == 1)<br>                    ? 1 : -1];<br>@@ -14738,7 +14743,7 @@<br>     We can't simply define LARGE_OFF_T to be 9223372036854775807,<br>     since some C++ compilers masquerading as C compilers<br>     incorrectly reject 9223372036854775807.  */<br>-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))<br>+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))<br>   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721<br>                       && LARGE_OFF_T % 2147483647 == 1)<br>                    ? 1 : -1];<br>@@ -14783,7 +14788,7 @@<br>     We can't simply define LARGE_OFF_T to be 9223372036854775807,<br>     since some C++ compilers masquerading as C compilers<br>     incorrectly reject 9223372036854775807.  */<br>-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))<br>+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))<br>   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721<br>                       && LARGE_OFF_T % 2147483647 == 1)<br>                    ? 1 : -1];<br>@@ -14807,7 +14812,7 @@<br>     We can't simply define LARGE_OFF_T to be 9223372036854775807,<br>     since some C++ compilers masquerading as C compilers<br>     incorrectly reject 9223372036854775807.  */<br>-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))<br>+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))<br>   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721<br>                       && LARGE_OFF_T % 2147483647 == 1)<br>                    ? 1 : -1];<br>diff --git a/third-party/configure.m4 b/third-party/configure.m4<br>index 6354466..55b72da 100644<br>--- a/third-party/configure.m4<br>+++ b/third-party/configure.m4<br>@@ -1,4 +1,7 @@<br>-<br>+#<br>+# If this file is changed, be sure to run ASTTOPDIR/bootstrap.sh<br>+# before committing.<br>+#<br> <br> AC_DEFUN([THIRD_PARTY_CONFIGURE],<br> [<br>diff --git a/third-party/pjproject/Makefile.rules b/third-party/pjproject/Makefile.rules<br>index 3f99c8a..acd7662 100644<br>--- a/third-party/pjproject/Makefile.rules<br>+++ b/third-party/pjproject/Makefile.rules<br>@@ -1,8 +1,11 @@<br> PJPROJECT_URL ?= https://raw.githubusercontent.com/asterisk/third-party/master/pjproject/$(PJPROJECT_VERSION)<br> <br>+# PJPROJECT_CONFIGURE_OPTS could come from the command line or could be<br>+# set/modified by configure.m4 if the build or host tuples aren't the same<br>+# as the current build environment (cross-compile).<br> # Even though we're not installing pjproject, we're setting prefix to /opt/pjproject to be safe<br> <br>-PJPROJECT_CONFIG_OPTS = --prefix=/opt/pjproject \<br>+PJPROJECT_CONFIG_OPTS = $(PJPROJECT_CONFIGURE_OPTS) --prefix=/opt/pjproject \<br>    --disable-speex-codec \<br>       --disable-speex-aec \<br>         --disable-speex-aec \<br>diff --git a/third-party/pjproject/configure.m4 b/third-party/pjproject/configure.m4<br>index a5e9fca..709a706 100644<br>--- a/third-party/pjproject/configure.m4<br>+++ b/third-party/pjproject/configure.m4<br>@@ -1,3 +1,8 @@<br>+#<br>+# If this file is changed, be sure to run ASTTOPDIR/bootstrap.sh<br>+# before committing.<br>+#<br>+<br> AC_DEFUN([_PJPROJECT_CONFIGURE],<br> [<br>   if test "${ac_mandatory_list#*PJPROJECT*}" != "$ac_mandatory_list" ; then<br>@@ -35,17 +40,30 @@<br>            AC_MSG_ERROR(cat is required to build bundled pjproject)<br>      fi<br> <br>+        AC_ARG_VAR([PJPROJECT_CONFIGURE_OPTS],[Additional configure options to pass to bundled pjproject])<br>+   this_host=$(./config.sub $(./config.guess))<br>+  if test "$build" != "$this_host" ; then<br>+          PJPROJECT_CONFIGURE_OPTS+=" --build=$build"<br>+        fi<br>+   if test "$host" != "$this_host" ; then<br>+           PJPROJECT_CONFIGURE_OPTS+=" --host=$host"<br>+  fi<br>+<br>         export TAR PATCH SED NM EXTERNALS_CACHE_DIR DOWNLOAD_TO_STDOUT DOWNLOAD_TIMEOUT DOWNLOAD MD5 CAT<br>-     ${GNU_MAKE} --quiet --no-print-directory -C ${PJPROJECT_DIR} EXTERNALS_CACHE_DIR=${EXTERNALS_CACHE_DIR} configure<br>+    export NOISY_BUILD<br>+   ${GNU_MAKE} --quiet --no-print-directory -C ${PJPROJECT_DIR} \<br>+               PJPROJECT_CONFIGURE_OPTS="$PJPROJECT_CONFIGURE_OPTS" \<br>+             EXTERNALS_CACHE_DIR="${EXTERNALS_CACHE_DIR}" \<br>+             configure<br>     if test $? -ne 0 ; then<br>               AC_MSG_RESULT(failed)<br>                 AC_MSG_NOTICE(Unable to configure ${PJPROJECT_DIR})<br>-          AC_MSG_ERROR(Run "${GNU_MAKE} -C ${PJPROJECT_DIR} NOISY_BUILD=yes configure" to see error details.)<br>+                AC_MSG_ERROR(Re-run the ./configure command with 'NOISY_BUILD=yes' appended to see error details.)<br>    fi<br> <br>         AC_MSG_CHECKING(for bundled pjproject)<br> <br>-    PJPROJECT_INCLUDE=$(${GNU_MAKE} --quiet --no-print-directory -C ${PJPROJECT_DIR} EXTERNALS_CACHE_DIR=${EXTERNALS_CACHE_DIR} echo_cflags)<br>+     PJPROJECT_INCLUDE=$(${GNU_MAKE} --quiet --no-print-directory -C ${PJPROJECT_DIR} PJPROJECT_CONFIGURE_OPTS="$PJPROJECT_CONFIGURE_OPTS" EXTERNALS_CACHE_DIR="${EXTERNALS_CACHE_DIR}" echo_cflags)<br>   PJPROJECT_CFLAGS="$PJPROJECT_INCLUDE"<br>       PBX_PJPROJECT=1<br> <br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/5939">change 5939</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/5939"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 13 </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I5fa776e110262851173002a26ffe1172e4c35b2e </div>
<div style="display:none"> Gerrit-Change-Number: 5939 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: George Joseph <gjoseph@digium.com> </div>