pjproject: fixed a few bugs
[asterisk/asterisk.git] / third-party / pjproject / configure.m4
1 AC_DEFUN([PJPROJECT_SYMBOL_CHECK],
2 [
3         $1_INCLUDE="$PJPROJECT_INCLUDE"
4     AC_MSG_CHECKING([for $2 declared in $3])
5
6         saved_cpp="$CPPFLAGS"
7         CPPFLAGS="$PJPROJECT_INCLUDE"
8         AC_EGREP_HEADER($2, $3, [
9                 AC_MSG_RESULT(yes)
10                 PBX_$1=1
11                 AC_DEFINE([HAVE_$1], 1, [Define if your system has $2 declared.])
12         ], [
13                 AC_MSG_RESULT(no)
14         ])
15
16         CPPGLAGS="$saved_cpp"
17         $1_INCLUDE="$PJPROJECT_INCLUDE"
18 ])
19
20 AC_DEFUN([PJPROJECT_CONFIGURE],
21 [
22         AC_MSG_CHECKING(for embedded pjproject (may have to download))
23         AC_MSG_RESULT(configuring)
24         ${GNU_MAKE} --quiet --no-print-directory -C $1 configure
25         if test $? -ne 0 ; then
26                 AC_MSG_RESULT(failed)
27                 AC_MSG_NOTICE(Unable to configure $1)
28                 AC_MSG_ERROR(Run "${GNU_MAKE} -C $1 NOISY_BUILD=yes configure" to see error details.)
29         fi
30
31         PJPROJECT_INCLUDE=$(${GNU_MAKE} --quiet --no-print-directory -C $1 echo_cflags)
32         PJPROJECT_CFLAGS="$PJPROJECT_INCLUDE"
33         PBX_PJPROJECT=1
34         PJPROJECT_BUNDLED=yes
35         AC_DEFINE([HAVE_PJPROJECT], 1, [Define if your system has PJPROJECT])
36         AC_DEFINE([HAVE_PJPROJECT_BUNDLED], 1, [Define if your system has PJPROJECT_BUNDLED])
37         AC_MSG_CHECKING(for embedded pjproject)
38         AC_MSG_RESULT(yes)
39
40         PJPROJECT_SYMBOL_CHECK([PJSIP_DLG_CREATE_UAS_AND_INC_LOCK], [pjsip_dlg_create_uas_and_inc_lock], [pjsip.h])
41         PJPROJECT_SYMBOL_CHECK([PJ_TRANSACTION_GRP_LOCK], [pjsip_tsx_create_uac2], [pjsip.h])
42         PJPROJECT_SYMBOL_CHECK([PJSIP_REPLACE_MEDIA_STREAM], [PJMEDIA_SDP_NEG_ALLOW_MEDIA_CHANGE], [pjmedia.h])
43         PJPROJECT_SYMBOL_CHECK([PJSIP_GET_DEST_INFO], [pjsip_get_dest_info], [pjsip.h])
44         PJPROJECT_SYMBOL_CHECK([PJ_SSL_CERT_LOAD_FROM_FILES2], [pj_ssl_cert_load_from_files2], [pjlib.h])
45         PJPROJECT_SYMBOL_CHECK([PJSIP_EXTERNAL_RESOLVER], [pjsip_endpt_set_ext_resolver], [pjsip.h])
46         AC_DEFINE([HAVE_PJSIP_TLS_TRANSPORT_PROTO], 1, [Define if your system has PJSIP_TLS_TRANSPORT_PROTO])
47         AC_DEFINE([HAVE_PJSIP_EVSUB_GRP_LOCK], 1, [Define if your system has PJSIP_EVSUB_GRP_LOCK])
48 ])