pjproject_bundled: Add 3 upstream patches
[asterisk/asterisk.git] / third-party / pjproject / configure.m4
1 AC_DEFUN([_PJPROJECT_CONFIGURE],
2 [
3         if test "${ac_mandatory_list#*PJPROJECT*}" != "$ac_mandatory_list" ; then
4                 AC_MSG_ERROR(--with-pjproject and --with-pjproject-bundled can't both be specified)
5         fi
6
7         ac_mandatory_list="$ac_mandatory_list PJPROJECT"
8         PJPROJECT_DIR="${ac_top_build_prefix}third-party/pjproject"
9
10         AC_MSG_CHECKING(for embedded pjproject (may have to download))
11         AC_MSG_RESULT(configuring)
12
13         if test "x${DOWNLOAD_TO_STDOUT}" = "x" ; then
14                 AC_MSG_ERROR(A download utility (wget, curl or fetch) is required to download bundled pjproject)
15         fi
16         if test "${BZIP2}" = ":" ; then
17                 AC_MSG_ERROR(bzip2 is required to extract the pjproject tar file)
18         fi
19         if test "${TAR}" = ":" ; then
20                 AC_MSG_ERROR(tar is required to extract the pjproject tar file)
21         fi
22         if test "${PATCH}" = ":" ; then
23                 AC_MSG_ERROR(patch is required to configure bundled pjproject)
24         fi
25         if test "${SED}" = ":" ; then
26                 AC_MSG_ERROR(sed is required to configure bundled pjproject)
27         fi
28         if test "${NM}" = ":" ; then
29                 AC_MSG_ERROR(nm is required to build bundled pjproject)
30         fi
31         if test "${MD5}" = ":" ; then
32                 AC_MSG_ERROR(md5sum is required to build bundled pjproject)
33         fi
34         if test "${CAT}" = ":" ; then
35                 AC_MSG_ERROR(cat is required to build bundled pjproject)
36         fi
37
38         export TAR PATCH SED NM EXTERNALS_CACHE_DIR DOWNLOAD_TO_STDOUT DOWNLOAD_TIMEOUT DOWNLOAD MD5 CAT
39         ${GNU_MAKE} --quiet --no-print-directory -C ${PJPROJECT_DIR} EXTERNALS_CACHE_DIR=${EXTERNALS_CACHE_DIR} configure
40         if test $? -ne 0 ; then
41                 AC_MSG_RESULT(failed)
42                 AC_MSG_NOTICE(Unable to configure ${PJPROJECT_DIR})
43                 AC_MSG_ERROR(Run "${GNU_MAKE} -C ${PJPROJECT_DIR} NOISY_BUILD=yes configure" to see error details.)
44         fi
45
46         AC_MSG_CHECKING(for bundled pjproject)
47
48         PJPROJECT_INCLUDE=$(${GNU_MAKE} --quiet --no-print-directory -C ${PJPROJECT_DIR} EXTERNALS_CACHE_DIR=${EXTERNALS_CACHE_DIR} echo_cflags)
49         PJPROJECT_CFLAGS="$PJPROJECT_INCLUDE"
50         PBX_PJPROJECT=1
51
52         AC_DEFINE([HAVE_PJPROJECT], 1, [Define if your system has PJPROJECT])
53         AC_DEFINE([HAVE_PJPROJECT_BUNDLED], 1, [Define if your system has PJPROJECT_BUNDLED])
54
55         AC_DEFINE([HAVE_PJSIP_DLG_CREATE_UAS_AND_INC_LOCK], 1, [Define if your system has pjsip_dlg_create_uas_and_inc_lock declared.])
56         AC_DEFINE([HAVE_PJ_TRANSACTION_GRP_LOCK], 1, [Define if your system has pjsip_tsx_create_uac2 declared.])
57         AC_DEFINE([HAVE_PJSIP_REPLACE_MEDIA_STREAM], 1, [Define if your system has PJSIP_REPLACE_MEDIA_STREAM declared])
58         AC_DEFINE([HAVE_PJSIP_GET_DEST_INFO], 1, [Define if your system has pjsip_get_dest_info declared.])
59         AC_DEFINE([HAVE_PJ_SSL_CERT_LOAD_FROM_FILES2], 1, [Define if your system has pj_ssl_cert_load_from_files2 declared.])
60         AC_DEFINE([HAVE_PJSIP_EXTERNAL_RESOLVER], 1, [Define if your system has pjsip_endpt_set_ext_resolver declared.])
61         AC_DEFINE([HAVE_PJSIP_TLS_TRANSPORT_PROTO], 1, [Define if your system has PJSIP_TLS_TRANSPORT_PROTO])
62         AC_DEFINE([HAVE_PJSIP_EVSUB_GRP_LOCK], 1, [Define if your system has PJSIP_EVSUB_GRP_LOCK])
63         AC_DEFINE([HAVE_PJSIP_INV_SESSION_REF], 1, [Define if your system has PJSIP_INV_SESSION_REF])
64         AC_DEFINE([HAVE_PJSIP_AUTH_CLT_DEINIT], 1, [Define if your system has pjsip_auth_clt_deinit declared.])
65         AC_DEFINE([HAVE_PJSIP_EVSUB_SET_UAS_TIMEOUT], 1, [Define if your system has pjsip_evsub_set_uas_timeout declared.])
66         AC_DEFINE([HAVE_PJSIP_TSX_LAYER_FIND_TSX2], 1, [Define if your system has pjsip_tsx_layer_find_tsx2 declared.])
67
68         AC_SUBST([PJPROJECT_BUNDLED])
69         AC_SUBST([PJPROJECT_DIR])
70         AC_SUBST([PBX_PJPROJECT])
71         AC_SUBST([PJPROJECT_LIB])
72         AC_SUBST([PJPROJECT_INCLUDE])
73         AC_MSG_RESULT(yes)
74 ])
75
76 AC_DEFUN([PJPROJECT_CONFIGURE],
77 [
78         if test "$PJPROJECT_BUNDLED" = "yes" ; then
79                 _PJPROJECT_CONFIGURE()
80         fi
81 ])