| 1 |
# |
| 2 |
# If this file is changed, be sure to run ASTTOPDIR/bootstrap.sh |
| 3 |
# before committing. |
| 4 |
# |
| 5 |
|
| 6 |
AC_DEFUN([_PJPROJECT_CONFIGURE], |
| 7 |
[ |
| 8 |
if test "${ac_mandatory_list#*PJPROJECT*}" != "$ac_mandatory_list" ; then |
| 9 |
AC_MSG_ERROR(--with-pjproject and --with-pjproject-bundled can't both be specified) |
| 10 |
fi |
| 11 |
|
| 12 |
if test "${with_pjproject}" != "no" && test "${with_pjproject}" != "n" ; then |
| 13 |
|
| 14 |
ac_mandatory_list="$ac_mandatory_list PJPROJECT" |
| 15 |
PJPROJECT_DIR="${ac_top_build_prefix}third-party/pjproject" |
| 16 |
|
| 17 |
AC_MSG_CHECKING(for embedded pjproject (may have to download)) |
| 18 |
AC_MSG_RESULT(configuring) |
| 19 |
|
| 20 |
if test "x${DOWNLOAD_TO_STDOUT}" = "x" ; then |
| 21 |
AC_MSG_ERROR(A download utility (wget, curl, or fetch) is required to download bundled pjproject) |
| 22 |
fi |
| 23 |
if test "${BZIP2}" = ":" ; then |
| 24 |
AC_MSG_ERROR(bzip2 is required to extract the pjproject tar file) |
| 25 |
fi |
| 26 |
if test "${TAR}" = ":" ; then |
| 27 |
AC_MSG_ERROR(tar is required to extract the pjproject tar file) |
| 28 |
fi |
| 29 |
if test "${PATCH}" = ":" ; then |
| 30 |
AC_MSG_ERROR(patch is required to configure bundled pjproject) |
| 31 |
fi |
| 32 |
if test "${SED}" = ":" ; then |
| 33 |
AC_MSG_ERROR(sed is required to configure bundled pjproject) |
| 34 |
fi |
| 35 |
if test "${NM}" = ":" ; then |
| 36 |
AC_MSG_ERROR(nm is required to build bundled pjproject) |
| 37 |
fi |
| 38 |
if test "${MD5}" = ":" ; then |
| 39 |
AC_MSG_ERROR(md5sum is required to build bundled pjproject) |
| 40 |
fi |
| 41 |
if test "${CAT}" = ":" ; then |
| 42 |
AC_MSG_ERROR(cat is required to build bundled pjproject) |
| 43 |
fi |
| 44 |
if test "${CUT}" = ":" ; then |
| 45 |
AC_MSG_ERROR(cut is required to build bundled pjproject) |
| 46 |
fi |
| 47 |
if test "${GREP}" = ":" ; then |
| 48 |
AC_MSG_ERROR(grep is required to build bundled pjproject) |
| 49 |
fi |
| 50 |
if test "${FIND}" = ":" ; then |
| 51 |
AC_MSG_ERROR(find is required to build bundled pjproject) |
| 52 |
fi |
| 53 |
if test "x${AST_DEVMODE}" != "x" ; then |
| 54 |
if test "${REALPATH}" = ":" ; then |
| 55 |
AC_MSG_ERROR(realpath is required to build bundled pjproject in dev mode) |
| 56 |
fi |
| 57 |
fi |
| 58 |
|
| 59 |
AC_ARG_VAR([PJPROJECT_CONFIGURE_OPTS],[Additional configure options to pass to bundled pjproject]) |
| 60 |
this_host=$(./config.sub $(./config.guess)) |
| 61 |
if test "$build" != "$this_host" ; then |
| 62 |
PJPROJECT_CONFIGURE_OPTS="${PJPROJECT_CONFIGURE_OPTS} --build=$build_alias" |
| 63 |
fi |
| 64 |
if test "$host" != "$this_host" ; then |
| 65 |
PJPROJECT_CONFIGURE_OPTS="${PJPROJECT_CONFIGURE_OPTS} --host=$host_alias" |
| 66 |
fi |
| 67 |
# This was a copy of the autoconf generated code from the root ./configure. |
| 68 |
# Hopefully, when you read this, the code is still the same. |
| 69 |
if test "${with_ssl+set}" = set; then : |
| 70 |
case $with_ssl in |
| 71 |
n|no) |
| 72 |
PJPROJECT_CONFIGURE_OPTS="${PJPROJECT_CONFIGURE_OPTS} --disable-ssl" |
| 73 |
;; |
| 74 |
y|ye|yes) |
| 75 |
# Not to mention SSL is the default in PJProject and means "autodetect". |
| 76 |
# In Asterisk, "./configure --with-ssl" means "must be present". |
| 77 |
PJPROJECT_CONFIGURE_OPTS="${PJPROJECT_CONFIGURE_OPTS} --with-ssl" |
| 78 |
;; |
| 79 |
*) |
| 80 |
PJPROJECT_CONFIGURE_OPTS="${PJPROJECT_CONFIGURE_OPTS} --with-ssl=${with_ssl}" |
| 81 |
;; |
| 82 |
esac |
| 83 |
else |
| 84 |
if test $PBX_OPENSSL -eq 1 ; then |
| 85 |
PJPROJECT_CONFIGURE_OPTS="${PJPROJECT_CONFIGURE_OPTS} --with-ssl" |
| 86 |
fi |
| 87 |
fi |
| 88 |
|
| 89 |
# Determine if we're doing an out-of-tree build... |
| 90 |
AH_TEMPLATE(m4_bpatsubst([[HAVE_PJPROJECT_BUNDLED_OOT]], [(.*)]), [Define if doing a bundled pjproject out-of-tree build.]) |
| 91 |
if test -L ${PJPROJECT_DIR}/source -o -d ${PJPROJECT_DIR}/source/.git ; then |
| 92 |
AC_DEFINE([HAVE_PJPROJECT_BUNDLED_OOT], 1) |
| 93 |
PJPROJECT_BUNDLED_OOT=yes |
| 94 |
fi |
| 95 |
|
| 96 |
export TAR PATCH SED NM EXTERNALS_CACHE_DIR AST_DOWNLOAD_CACHE DOWNLOAD_TO_STDOUT DOWNLOAD_TIMEOUT DOWNLOAD MD5 CAT CUT GREP FIND REALPATH |
| 97 |
export NOISY_BUILD AST_DEVMODE |
| 98 |
${GNU_MAKE} --quiet --no-print-directory -C ${PJPROJECT_DIR} \ |
| 99 |
PJPROJECT_CONFIGURE_OPTS="$PJPROJECT_CONFIGURE_OPTS" \ |
| 100 |
EXTERNALS_CACHE_DIR="${EXTERNALS_CACHE_DIR:-${AST_DOWNLOAD_CACHE}}" \ |
| 101 |
PJPROJECT_BUNDLED_OOT="${PJPROJECT_BUNDLED_OOT}" \ |
| 102 |
configure |
| 103 |
if test $? -ne 0 ; then |
| 104 |
AC_MSG_RESULT(failed) |
| 105 |
AC_MSG_NOTICE(Unable to configure ${PJPROJECT_DIR}) |
| 106 |
AC_MSG_ERROR(Re-run the ./configure command with 'NOISY_BUILD=yes' appended to see error details.) |
| 107 |
fi |
| 108 |
|
| 109 |
AC_MSG_CHECKING(for bundled pjproject) |
| 110 |
|
| 111 |
PJPROJECT_INCLUDE=$(${GNU_MAKE} --quiet --no-print-directory -C ${PJPROJECT_DIR} \ |
| 112 |
PJPROJECT_CONFIGURE_OPTS="$PJPROJECT_CONFIGURE_OPTS" \ |
| 113 |
EXTERNALS_CACHE_DIR="${EXTERNALS_CACHE_DIR:-${AST_DOWNLOAD_CACHE}}" \ |
| 114 |
PJPROJECT_BUNDLED_OOT="${PJPROJECT_BUNDLED_OOT}" \ |
| 115 |
echo_cflags) |
| 116 |
PJPROJECT_CFLAGS="$PJPROJECT_INCLUDE" |
| 117 |
PBX_PJPROJECT=1 |
| 118 |
|
| 119 |
AC_DEFINE([HAVE_PJPROJECT], 1, [Define if your system has PJPROJECT]) |
| 120 |
AC_DEFINE([HAVE_PJPROJECT_BUNDLED], 1, [Define if your system has PJPROJECT_BUNDLED]) |
| 121 |
|
| 122 |
AC_DEFINE([HAVE_PJSIP_DLG_CREATE_UAS_AND_INC_LOCK], 1, [Define if your system has pjsip_dlg_create_uas_and_inc_lock declared.]) |
| 123 |
AC_DEFINE([HAVE_PJ_TRANSACTION_GRP_LOCK], 1, [Define if your system has pjsip_tsx_create_uac2 declared.]) |
| 124 |
AC_DEFINE([HAVE_PJSIP_REPLACE_MEDIA_STREAM], 1, [Define if your system has PJSIP_REPLACE_MEDIA_STREAM declared]) |
| 125 |
AC_DEFINE([HAVE_PJSIP_GET_DEST_INFO], 1, [Define if your system has pjsip_get_dest_info declared.]) |
| 126 |
AC_DEFINE([HAVE_PJ_SSL_CERT_LOAD_FROM_FILES2], 1, [Define if your system has pj_ssl_cert_load_from_files2 declared.]) |
| 127 |
AC_DEFINE([HAVE_PJSIP_EXTERNAL_RESOLVER], 1, [Define if your system has pjsip_endpt_set_ext_resolver declared.]) |
| 128 |
AC_DEFINE([HAVE_PJSIP_TLS_TRANSPORT_PROTO], 1, [Define if your system has PJSIP_TLS_TRANSPORT_PROTO]) |
| 129 |
AC_DEFINE([HAVE_PJSIP_TLS_1_1], 1, [Define if your system has PJSIP with TLSv1.1 support.]) |
| 130 |
AC_DEFINE([HAVE_PJSIP_TLS_1_2], 1, [Define if your system has PJSIP with TLSv1.2 support.]) |
| 131 |
AC_DEFINE([HAVE_PJSIP_TLS_1_3], 1, [Define if your system has PJSIP with TLSv1.3 support.]) |
| 132 |
AC_DEFINE([HAVE_PJSIP_EVSUB_GRP_LOCK], 1, [Define if your system has PJSIP_EVSUB_GRP_LOCK]) |
| 133 |
AC_DEFINE([HAVE_PJSIP_INV_SESSION_REF], 1, [Define if your system has PJSIP_INV_SESSION_REF]) |
| 134 |
AC_DEFINE([HAVE_PJSIP_AUTH_CLT_DEINIT], 1, [Define if your system has pjsip_auth_clt_deinit declared.]) |
| 135 |
AC_DEFINE([HAVE_PJSIP_TSX_LAYER_FIND_TSX2], 1, [Define if your system has pjsip_tsx_layer_find_tsx2 declared.]) |
| 136 |
AC_DEFINE([HAVE_PJSIP_INV_ACCEPT_MULTIPLE_SDP_ANSWERS], 1, [Define if your system has HAVE_PJSIP_INV_ACCEPT_MULTIPLE_SDP_ANSWERS declared.]) |
| 137 |
AC_DEFINE([HAVE_PJSIP_ENDPOINT_COMPACT_FORM], 1, [Define if your system has HAVE_PJSIP_ENDPOINT_COMPACT_FORM declared.]) |
| 138 |
AC_DEFINE([HAVE_PJSIP_TRANSPORT_DISABLE_CONNECTION_REUSE], 1, [Define if your system has HAVE_PJSIP_TRANSPORT_DISABLE_CONNECTION_REUSE declared]) |
| 139 |
AC_DEFINE([HAVE_PJSIP_OAUTH_AUTHENTICATION], 1, [Define if your system has HAVE_PJSIP_OAUTH_AUTHENTICATION declared]) |
| 140 |
AC_DEFINE([HAVE_PJPROJECT_ON_VALID_ICE_PAIR_CALLBACK], 1, [Define if your system has the on_valid_pair pjnath callback.]) |
| 141 |
AC_DEFINE([HAVE_PJSIP_TLS_TRANSPORT_RESTART], 1, [Define if your system has pjsip_tls_transport_restart support.]) |
| 142 |
AC_DEFINE([HAVE_PJSIP_AUTH_NEW_DIGESTS], 1, [Define if your system has pjsip new auth algorithm support.]) |
| 143 |
|
| 144 |
AC_SUBST([PJPROJECT_BUNDLED]) |
| 145 |
AC_SUBST([PJPROJECT_BUNDLED_OOT]) |
| 146 |
AC_SUBST([PJPROJECT_DIR]) |
| 147 |
AC_SUBST([PBX_PJPROJECT]) |
| 148 |
AC_SUBST([PJPROJECT_LIB]) |
| 149 |
AC_SUBST([PJPROJECT_INCLUDE]) |
| 150 |
AC_SUBST([PJPROJECT_CONFIGURE_OPTS]) |
| 151 |
AC_MSG_RESULT(yes) |
| 152 |
|
| 153 |
fi |
| 154 |
]) |
| 155 |
|
| 156 |
AC_DEFUN([PJPROJECT_CONFIGURE], |
| 157 |
[ |
| 158 |
if test "$PJPROJECT_BUNDLED" = "yes" ; then |
| 159 |
_PJPROJECT_CONFIGURE() |
| 160 |
fi |
| 161 |
]) |