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