Merge "res_pjsip_registrar.c: Prevent potential double free if AOR is not found"
[asterisk/asterisk.git] / third-party / pjproject / configure.m4
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         ac_mandatory_list="$ac_mandatory_list PJPROJECT"
13         PJPROJECT_DIR="${ac_top_build_prefix}third-party/pjproject"
14
15         AC_MSG_CHECKING(for embedded pjproject (may have to download))
16         AC_MSG_RESULT(configuring)
17
18         if test "x${DOWNLOAD_TO_STDOUT}" = "x" ; then
19                 AC_MSG_ERROR(A download utility (wget, curl, or fetch) is required to download bundled pjproject)
20         fi
21         if test "${BZIP2}" = ":" ; then
22                 AC_MSG_ERROR(bzip2 is required to extract the pjproject tar file)
23         fi
24         if test "${TAR}" = ":" ; then
25                 AC_MSG_ERROR(tar is required to extract the pjproject tar file)
26         fi
27         if test "${PATCH}" = ":" ; then
28                 AC_MSG_ERROR(patch is required to configure bundled pjproject)
29         fi
30         if test "${SED}" = ":" ; then
31                 AC_MSG_ERROR(sed is required to configure bundled pjproject)
32         fi
33         if test "${NM}" = ":" ; then
34                 AC_MSG_ERROR(nm is required to build bundled pjproject)
35         fi
36         if test "${MD5}" = ":" ; then
37                 AC_MSG_ERROR(md5sum is required to build bundled pjproject)
38         fi
39         if test "${CAT}" = ":" ; then
40                 AC_MSG_ERROR(cat is required to build bundled pjproject)
41         fi
42         if test "${CUT}" = ":" ; then
43                 AC_MSG_ERROR(cut is required to build bundled pjproject)
44         fi
45         if test "${GREP}" = ":" ; then
46                 AC_MSG_ERROR(grep is required to build bundled pjproject)
47         fi
48
49         AC_ARG_VAR([PJPROJECT_CONFIGURE_OPTS],[Additional configure options to pass to bundled pjproject])
50         this_host=$(./config.sub $(./config.guess))
51         if test "$build" != "$this_host" ; then
52                 PJPROJECT_CONFIGURE_OPTS+=" --build=$build_alias"
53         fi
54         if test "$host" != "$this_host" ; then
55                 PJPROJECT_CONFIGURE_OPTS+=" --host=$host_alias"
56         fi
57         # This was a copy of the autoconf generated code from the root ./configure.
58         # Hopefully, when you read this, the code is still the same.
59         if test "${with_ssl+set}" = set; then :
60                 case $with_ssl in
61                 n|no)
62                 PJPROJECT_CONFIGURE_OPTS+=" --disable-ssl"
63                 ;;
64                 y|ye|yes)
65                 # This is the default value in PJProject and means "autodetect".
66                 # In Asterisk, "./configure --with-ssl" means "must be present".
67                 PJPROJECT_CONFIGURE_OPTS+=" --enable-ssl"
68                 ;;
69                 *)
70                 PJPROJECT_CONFIGURE_OPTS+=" --with-ssl=${with_ssl}"
71                 ;;
72                 esac
73         fi
74
75         export TAR PATCH SED NM EXTERNALS_CACHE_DIR AST_DOWNLOAD_CACHE DOWNLOAD_TO_STDOUT DOWNLOAD_TIMEOUT DOWNLOAD MD5 CAT CUT GREP
76         export NOISY_BUILD AST_DEVMODE
77         ${GNU_MAKE} --quiet --no-print-directory -C ${PJPROJECT_DIR} \
78                 PJPROJECT_CONFIGURE_OPTS="$PJPROJECT_CONFIGURE_OPTS" \
79                 EXTERNALS_CACHE_DIR="${EXTERNALS_CACHE_DIR:-${AST_DOWNLOAD_CACHE}}" \
80                 configure
81         if test $? -ne 0 ; then
82                 AC_MSG_RESULT(failed)
83                 AC_MSG_NOTICE(Unable to configure ${PJPROJECT_DIR})
84                 AC_MSG_ERROR(Re-run the ./configure command with 'NOISY_BUILD=yes' appended to see error details.)
85         fi
86
87         AC_MSG_CHECKING(for bundled pjproject)
88
89         PJPROJECT_INCLUDE=$(${GNU_MAKE} --quiet --no-print-directory -C ${PJPROJECT_DIR} PJPROJECT_CONFIGURE_OPTS="$PJPROJECT_CONFIGURE_OPTS" EXTERNALS_CACHE_DIR="${EXTERNALS_CACHE_DIR:-${AST_DOWNLOAD_CACHE}}" echo_cflags)
90         PJPROJECT_CFLAGS="$PJPROJECT_INCLUDE"
91         PBX_PJPROJECT=1
92
93         AC_DEFINE([HAVE_PJPROJECT], 1, [Define if your system has PJPROJECT])
94         AC_DEFINE([HAVE_PJPROJECT_BUNDLED], 1, [Define if your system has PJPROJECT_BUNDLED])
95
96         AC_DEFINE([HAVE_PJSIP_DLG_CREATE_UAS_AND_INC_LOCK], 1, [Define if your system has pjsip_dlg_create_uas_and_inc_lock declared.])
97         AC_DEFINE([HAVE_PJ_TRANSACTION_GRP_LOCK], 1, [Define if your system has pjsip_tsx_create_uac2 declared.])
98         AC_DEFINE([HAVE_PJSIP_REPLACE_MEDIA_STREAM], 1, [Define if your system has PJSIP_REPLACE_MEDIA_STREAM declared])
99         AC_DEFINE([HAVE_PJSIP_GET_DEST_INFO], 1, [Define if your system has pjsip_get_dest_info declared.])
100         AC_DEFINE([HAVE_PJ_SSL_CERT_LOAD_FROM_FILES2], 1, [Define if your system has pj_ssl_cert_load_from_files2 declared.])
101         AC_DEFINE([HAVE_PJSIP_EXTERNAL_RESOLVER], 1, [Define if your system has pjsip_endpt_set_ext_resolver declared.])
102         AC_DEFINE([HAVE_PJSIP_TLS_TRANSPORT_PROTO], 1, [Define if your system has PJSIP_TLS_TRANSPORT_PROTO])
103         AC_DEFINE([HAVE_PJSIP_EVSUB_GRP_LOCK], 1, [Define if your system has PJSIP_EVSUB_GRP_LOCK])
104         AC_DEFINE([HAVE_PJSIP_INV_SESSION_REF], 1, [Define if your system has PJSIP_INV_SESSION_REF])
105         AC_DEFINE([HAVE_PJSIP_AUTH_CLT_DEINIT], 1, [Define if your system has pjsip_auth_clt_deinit declared.])
106         AC_DEFINE([HAVE_PJSIP_TSX_LAYER_FIND_TSX2], 1, [Define if your system has pjsip_tsx_layer_find_tsx2 declared.])
107         AC_DEFINE([HAVE_PJSIP_INV_ACCEPT_MULTIPLE_SDP_ANSWERS], 1, [Define if your system has HAVE_PJSIP_INV_ACCEPT_MULTIPLE_SDP_ANSWERS declared.])
108         AC_DEFINE([HAVE_PJSIP_ENDPOINT_COMPACT_FORM], 1, [Define if your system has HAVE_PJSIP_ENDPOINT_COMPACT_FORM declared.])
109         AC_DEFINE([HAVE_PJSIP_TRANSPORT_DISABLE_CONNECTION_REUSE], 1, [Define if your system has HAVE_PJSIP_TRANSPORT_DISABLE_CONNECTION_REUSE declared])
110         AC_DEFINE([HAVE_PJSIP_OAUTH_AUTHENTICATION], 1, [Define if your system has HAVE_PJSIP_OAUTH_AUTHENTICATION declared])
111
112         AC_SUBST([PJPROJECT_BUNDLED])
113         AC_SUBST([PJPROJECT_DIR])
114         AC_SUBST([PBX_PJPROJECT])
115         AC_SUBST([PJPROJECT_LIB])
116         AC_SUBST([PJPROJECT_INCLUDE])
117         AC_MSG_RESULT(yes)
118 ])
119
120 AC_DEFUN([PJPROJECT_CONFIGURE],
121 [
122         if test "$PJPROJECT_BUNDLED" = "yes" ; then
123                 _PJPROJECT_CONFIGURE()
124         fi
125 ])