Merge "BuildSystem: pjsip_evsub_set_uas_timeout was not used."
[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"
53         fi
54         if test "$host" != "$this_host" ; then
55                 PJPROJECT_CONFIGURE_OPTS+=" --host=$host"
56         fi
57
58         export TAR PATCH SED NM EXTERNALS_CACHE_DIR AST_DOWNLOAD_CACHE DOWNLOAD_TO_STDOUT DOWNLOAD_TIMEOUT DOWNLOAD MD5 CAT CUT GREP
59         export NOISY_BUILD
60         ${GNU_MAKE} --quiet --no-print-directory -C ${PJPROJECT_DIR} \
61                 PJPROJECT_CONFIGURE_OPTS="$PJPROJECT_CONFIGURE_OPTS" \
62                 EXTERNALS_CACHE_DIR="${EXTERNALS_CACHE_DIR:-${AST_DOWNLOAD_CACHE}}" \
63                 configure
64         if test $? -ne 0 ; then
65                 AC_MSG_RESULT(failed)
66                 AC_MSG_NOTICE(Unable to configure ${PJPROJECT_DIR})
67                 AC_MSG_ERROR(Re-run the ./configure command with 'NOISY_BUILD=yes' appended to see error details.)
68         fi
69
70         AC_MSG_CHECKING(for bundled pjproject)
71
72         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)
73         PJPROJECT_CFLAGS="$PJPROJECT_INCLUDE"
74         PBX_PJPROJECT=1
75
76         AC_DEFINE([HAVE_PJPROJECT], 1, [Define if your system has PJPROJECT])
77         AC_DEFINE([HAVE_PJPROJECT_BUNDLED], 1, [Define if your system has PJPROJECT_BUNDLED])
78
79         AC_DEFINE([HAVE_PJSIP_DLG_CREATE_UAS_AND_INC_LOCK], 1, [Define if your system has pjsip_dlg_create_uas_and_inc_lock declared.])
80         AC_DEFINE([HAVE_PJ_TRANSACTION_GRP_LOCK], 1, [Define if your system has pjsip_tsx_create_uac2 declared.])
81         AC_DEFINE([HAVE_PJSIP_REPLACE_MEDIA_STREAM], 1, [Define if your system has PJSIP_REPLACE_MEDIA_STREAM declared])
82         AC_DEFINE([HAVE_PJSIP_GET_DEST_INFO], 1, [Define if your system has pjsip_get_dest_info declared.])
83         AC_DEFINE([HAVE_PJ_SSL_CERT_LOAD_FROM_FILES2], 1, [Define if your system has pj_ssl_cert_load_from_files2 declared.])
84         AC_DEFINE([HAVE_PJSIP_EXTERNAL_RESOLVER], 1, [Define if your system has pjsip_endpt_set_ext_resolver declared.])
85         AC_DEFINE([HAVE_PJSIP_TLS_TRANSPORT_PROTO], 1, [Define if your system has PJSIP_TLS_TRANSPORT_PROTO])
86         AC_DEFINE([HAVE_PJSIP_EVSUB_GRP_LOCK], 1, [Define if your system has PJSIP_EVSUB_GRP_LOCK])
87         AC_DEFINE([HAVE_PJSIP_INV_SESSION_REF], 1, [Define if your system has PJSIP_INV_SESSION_REF])
88         AC_DEFINE([HAVE_PJSIP_AUTH_CLT_DEINIT], 1, [Define if your system has pjsip_auth_clt_deinit declared.])
89         AC_DEFINE([HAVE_PJSIP_TSX_LAYER_FIND_TSX2], 1, [Define if your system has pjsip_tsx_layer_find_tsx2 declared.])
90
91         AC_SUBST([PJPROJECT_BUNDLED])
92         AC_SUBST([PJPROJECT_DIR])
93         AC_SUBST([PBX_PJPROJECT])
94         AC_SUBST([PJPROJECT_LIB])
95         AC_SUBST([PJPROJECT_INCLUDE])
96         AC_MSG_RESULT(yes)
97 ])
98
99 AC_DEFUN([PJPROJECT_CONFIGURE],
100 [
101         if test "$PJPROJECT_BUNDLED" = "yes" ; then
102                 _PJPROJECT_CONFIGURE()
103         fi
104 ])