configure.m4 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. #
  2. # If this file is changed, be sure to run ASTTOPDIR/bootstrap.sh
  3. # before committing.
  4. #
  5. AC_DEFUN([_JANSSON_CONFIGURE],
  6. [
  7. if test "${ac_mandatory_list#*JANSSON*}" != "$ac_mandatory_list" ; then
  8. AC_MSG_ERROR(--with-jansson and --with-jansson-bundled can't both be specified)
  9. fi
  10. ac_mandatory_list="$ac_mandatory_list JANSSON"
  11. JANSSON_DIR="${ac_pwd}/third-party/jansson"
  12. AC_MSG_CHECKING(for embedded jansson (may have to download))
  13. AC_MSG_RESULT(configuring)
  14. if test "x${DOWNLOAD_TO_STDOUT}" = "x" ; then
  15. AC_MSG_ERROR(A download utility (wget, curl, or fetch) is required to download bundled jansson)
  16. fi
  17. if test "${BZIP2}" = ":" ; then
  18. AC_MSG_ERROR(bzip2 is required to extract the jansson tar file)
  19. fi
  20. if test "${TAR}" = ":" ; then
  21. AC_MSG_ERROR(tar is required to extract the jansson tar file)
  22. fi
  23. if test "${PATCH}" = ":" ; then
  24. AC_MSG_ERROR(patch is required to configure bundled jansson)
  25. fi
  26. if test "${SED}" = ":" ; then
  27. AC_MSG_ERROR(sed is required to configure bundled jansson)
  28. fi
  29. if test "${NM}" = ":" ; then
  30. AC_MSG_ERROR(nm is required to build bundled jansson)
  31. fi
  32. if test "${MD5}" = ":" ; then
  33. AC_MSG_ERROR(md5sum is required to build bundled jansson)
  34. fi
  35. if test "${CAT}" = ":" ; then
  36. AC_MSG_ERROR(cat is required to build bundled jansson)
  37. fi
  38. if test "${CUT}" = ":" ; then
  39. AC_MSG_ERROR(cut is required to build bundled jansson)
  40. fi
  41. if test "${GREP}" = ":" ; then
  42. AC_MSG_ERROR(grep is required to build bundled jansson)
  43. fi
  44. AC_ARG_VAR([JANSSON_CONFIGURE_OPTS],[Additional configure options to pass to bundled jansson])
  45. this_host=$(./config.sub $(./config.guess))
  46. if test "$build" != "$this_host" ; then
  47. JANSSON_CONFIGURE_OPTS+=" --build=$build_alias"
  48. fi
  49. if test "$host" != "$this_host" ; then
  50. JANSSON_CONFIGURE_OPTS+=" --host=$host_alias"
  51. fi
  52. export TAR PATCH SED NM EXTERNALS_CACHE_DIR AST_DOWNLOAD_CACHE DOWNLOAD_TO_STDOUT DOWNLOAD_TIMEOUT DOWNLOAD MD5 CAT CUT GREP
  53. export NOISY_BUILD
  54. ${GNU_MAKE} --quiet --no-print-directory -C ${JANSSON_DIR} \
  55. JANSSON_CONFIGURE_OPTS="$JANSSON_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 ${JANSSON_DIR})
  61. AC_MSG_ERROR(Re-run the ./configure command with 'NOISY_BUILD=yes' appended to see error details.)
  62. fi
  63. AC_MSG_CHECKING(for bundled jansson)
  64. JANSSON_INCLUDE=-I${JANSSON_DIR}/dest/include
  65. JANSSON_CFLAGS="$JANSSON_INCLUDE"
  66. JANSSON_LIB="-L${JANSSON_DIR}/dest/lib -ljansson"
  67. PBX_JANSSON=1
  68. # We haven't run install yet
  69. JANSSON_DEFINE_JSON_INT([$JANSSON_DIR]/source/src/)
  70. AC_SUBST([JANSSON_BUNDLED])
  71. AC_SUBST([PBX_JANSSON])
  72. AC_SUBST([JANSSON_LIB])
  73. AC_SUBST([JANSSON_INCLUDE])
  74. AC_MSG_RESULT(yes)
  75. AC_DEFINE([HAVE_JANSSON_BUNDLED], 1, [Define if your system has JANSSON_BUNDLED])
  76. ])
  77. AC_DEFUN([JANSSON_CONFIGURE],
  78. [
  79. if test "$JANSSON_BUNDLED" = "yes" ; then
  80. _JANSSON_CONFIGURE()
  81. fi
  82. ])
  83. AC_DEFUN([JANSSON_DEFINE_JSON_INT],
  84. [
  85. # Define the ast_json_int_t (large integer type) to match jansson's
  86. saved_cppflags="${CPPFLAGS}"
  87. CPPFLAGS="${CPPFLAGS} ${JANSSON_INCLUDE}"
  88. AC_COMPILE_IFELSE(
  89. [AC_LANG_PROGRAM([#include <$1jansson.h>],
  90. [#if !JSON_INTEGER_IS_LONG_LONG
  91. #error "not long long"
  92. #endif
  93. ])],
  94. [AC_DEFINE([AST_JSON_INT_T], [long long], [Define to 'long' or 'long long'])],
  95. [AC_DEFINE([AST_JSON_INT_T], [long], [Define to 'long' or 'long long'])])
  96. CPPFLAGS="${saved_cppflags}"
  97. ])