870468257b3bca1e112ddef8fce99d049ad8102a
[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
32         export TAR PATCH SED NM EXTERNALS_CACHE_DIR DOWNLOAD_TO_STDOUT
33         ${GNU_MAKE} --quiet --no-print-directory -C ${PJPROJECT_DIR} EXTERNALS_CACHE_DIR=${EXTERNALS_CACHE_DIR} configure
34         if test $? -ne 0 ; then
35                 AC_MSG_RESULT(failed)
36                 AC_MSG_NOTICE(Unable to configure ${PJPROJECT_DIR})
37                 AC_MSG_ERROR(Run "${GNU_MAKE} -C ${PJPROJECT_DIR} NOISY_BUILD=yes configure" to see error details.)
38         fi
39
40         AC_MSG_CHECKING(for bundled pjproject)
41
42         PJPROJECT_INCLUDE=$(${GNU_MAKE} --quiet --no-print-directory -C ${PJPROJECT_DIR} EXTERNALS_CACHE_DIR=${EXTERNALS_CACHE_DIR} echo_cflags)
43         PJPROJECT_CFLAGS="$PJPROJECT_INCLUDE"
44         PBX_PJPROJECT=1
45
46         AC_DEFINE([HAVE_PJPROJECT], 1, [Define if your system has PJPROJECT])
47         AC_DEFINE([HAVE_PJPROJECT_BUNDLED], 1, [Define if your system has PJPROJECT_BUNDLED])
48
49         AC_DEFINE([HAVE_PJSIP_DLG_CREATE_UAS_AND_INC_LOCK], 1, [Define if your system has pjsip_dlg_create_uas_and_inc_lock declared.])
50         AC_DEFINE([HAVE_PJ_TRANSACTION_GRP_LOCK], 1, [Define if your system has pjsip_tsx_create_uac2 declared.])
51         AC_DEFINE([HAVE_PJSIP_REPLACE_MEDIA_STREAM], 1, [Define if your system has PJSIP_REPLACE_MEDIA_STREAM declared])
52         AC_DEFINE([HAVE_PJSIP_GET_DEST_INFO], 1, [Define if your system has pjsip_get_dest_info declared.])
53         AC_DEFINE([HAVE_PJ_SSL_CERT_LOAD_FROM_FILES2], 1, [Define if your system has pj_ssl_cert_load_from_files2 declared.])
54         AC_DEFINE([HAVE_PJSIP_EXTERNAL_RESOLVER], 1, [Define if your system has pjsip_endpt_set_ext_resolver declared.])
55         AC_DEFINE([HAVE_PJSIP_TLS_TRANSPORT_PROTO], 1, [Define if your system has PJSIP_TLS_TRANSPORT_PROTO])
56         AC_DEFINE([HAVE_PJSIP_EVSUB_GRP_LOCK], 1, [Define if your system has PJSIP_EVSUB_GRP_LOCK])
57         AC_DEFINE([HAVE_PJSIP_INV_SESSION_REF], 1, [Define if your system has PJSIP_INV_SESSION_REF])
58
59         AC_SUBST([PJPROJECT_BUNDLED])
60         AC_SUBST([PJPROJECT_DIR])
61         AC_SUBST([PBX_PJPROJECT])
62         AC_SUBST([PJPROJECT_LIB])
63         AC_SUBST([PJPROJECT_INCLUDE])
64         AC_MSG_RESULT(yes)
65 ])
66
67 AC_DEFUN([PJPROJECT_CONFIGURE],
68 [
69         if test "$PJPROJECT_BUNDLED" = "yes" ; then
70                 _PJPROJECT_CONFIGURE()
71         fi
72 ])