rtp_engine: rtcp_report_to_json can overflow the ssrc integer value
[asterisk/asterisk.git] / third-party / jansson / configure.m4
1 #
2 # If this file is changed, be sure to run ASTTOPDIR/bootstrap.sh
3 # before committing.
4 #
5
6 AC_DEFUN([_JANSSON_CONFIGURE],
7 [
8         if test "${ac_mandatory_list#*JANSSON*}" != "$ac_mandatory_list" ; then
9                 AC_MSG_ERROR(--with-jansson and --with-jansson-bundled can't both be specified)
10         fi
11
12         ac_mandatory_list="$ac_mandatory_list JANSSON"
13         JANSSON_DIR="${ac_pwd}/third-party/jansson"
14
15         AC_MSG_CHECKING(for embedded jansson (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 jansson)
20         fi
21         if test "${BZIP2}" = ":" ; then
22                 AC_MSG_ERROR(bzip2 is required to extract the jansson tar file)
23         fi
24         if test "${TAR}" = ":" ; then
25                 AC_MSG_ERROR(tar is required to extract the jansson tar file)
26         fi
27         if test "${PATCH}" = ":" ; then
28                 AC_MSG_ERROR(patch is required to configure bundled jansson)
29         fi
30         if test "${SED}" = ":" ; then
31                 AC_MSG_ERROR(sed is required to configure bundled jansson)
32         fi
33         if test "${NM}" = ":" ; then
34                 AC_MSG_ERROR(nm is required to build bundled jansson)
35         fi
36         if test "${MD5}" = ":" ; then
37                 AC_MSG_ERROR(md5sum is required to build bundled jansson)
38         fi
39         if test "${CAT}" = ":" ; then
40                 AC_MSG_ERROR(cat is required to build bundled jansson)
41         fi
42         if test "${CUT}" = ":" ; then
43                 AC_MSG_ERROR(cut is required to build bundled jansson)
44         fi
45         if test "${GREP}" = ":" ; then
46                 AC_MSG_ERROR(grep is required to build bundled jansson)
47         fi
48
49         AC_ARG_VAR([JANSSON_CONFIGURE_OPTS],[Additional configure options to pass to bundled jansson])
50         this_host=$(./config.sub $(./config.guess))
51         if test "$build" != "$this_host" ; then
52                 JANSSON_CONFIGURE_OPTS+=" --build=$build"
53         fi
54         if test "$host" != "$this_host" ; then
55                 JANSSON_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 ${JANSSON_DIR} \
61                 JANSSON_CONFIGURE_OPTS="$JANSSON_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 ${JANSSON_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 jansson)
71
72         JANSSON_INCLUDE=-I${JANSSON_DIR}/dest/include
73         JANSSON_CFLAGS="$JANSSON_INCLUDE"
74         JANSSON_LIB="-L${JANSSON_DIR}/dest/lib -ljansson"
75         PBX_JANSSON=1
76
77         # We haven't run install yet
78         JANSSON_DEFINE_JSON_INT([$JANSSON_DIR]/source/src/)
79
80         AC_SUBST([JANSSON_BUNDLED])
81         AC_SUBST([PBX_JANSSON])
82         AC_SUBST([JANSSON_LIB])
83         AC_SUBST([JANSSON_INCLUDE])
84         AC_MSG_RESULT(yes)
85 ])
86
87 AC_DEFUN([JANSSON_CONFIGURE],
88 [
89         if test "$JANSSON_BUNDLED" = "yes" ; then
90                 _JANSSON_CONFIGURE()
91         fi
92 ])
93
94 AC_DEFUN([JANSSON_DEFINE_JSON_INT],
95 [
96         # Define the ast_json_int_t (large integer type) to match jansson's
97         saved_cppflags="${CPPFLAGS}"
98         CPPFLAGS="${CPPFLAGS} ${JANSSON_INCLUDE}"
99         AC_COMPILE_IFELSE(
100                 [AC_LANG_PROGRAM([#include <$1jansson.h>],
101                 [#if !JSON_INTEGER_IS_LONG_LONG
102                 #error "not long long"
103                 #endif
104                 ])],
105                 [AC_DEFINE([AST_JSON_INT_T], [long long], [Define to 'long' or 'long long'])],
106                 [AC_DEFINE([AST_JSON_INT_T], [long], [Define to 'long' or 'long long'])])
107         CPPFLAGS="${saved_cppflags}"
108 ])