| 1 |
# |
| 2 |
# If this file is changed, be sure to run ASTTOPDIR/bootstrap.sh |
| 3 |
# before committing. |
| 4 |
# |
| 5 |
|
| 6 |
AC_DEFUN([_LIBJWT_CONFIGURE], |
| 7 |
[ |
| 8 |
if test "${ac_mandatory_list#*LIBJWT*}" != "$ac_mandatory_list" ; then |
| 9 |
AC_MSG_ERROR(--with-libjwt and --with-libjwt-bundled can't both be specified) |
| 10 |
fi |
| 11 |
|
| 12 |
ac_mandatory_list="$ac_mandatory_list LIBJWT" |
| 13 |
LIBJWT_DIR="${ac_pwd}/third-party/libjwt" |
| 14 |
|
| 15 |
AC_MSG_CHECKING(for embedded libjwt (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 libjwt) |
| 20 |
fi |
| 21 |
if test "${GZIP}" = ":" ; then |
| 22 |
AC_MSG_ERROR(gzip is required to extract the libjwt tar file) |
| 23 |
fi |
| 24 |
if test "${TAR}" = ":" ; then |
| 25 |
AC_MSG_ERROR(tar is required to extract the libjwt tar file) |
| 26 |
fi |
| 27 |
if test "${PATCH}" = ":" ; then |
| 28 |
AC_MSG_ERROR(patch is required to configure bundled libjwt) |
| 29 |
fi |
| 30 |
if test "${SED}" = ":" ; then |
| 31 |
AC_MSG_ERROR(sed is required to configure bundled libjwt) |
| 32 |
fi |
| 33 |
if test "${NM}" = ":" ; then |
| 34 |
AC_MSG_ERROR(nm is required to build bundled libjwt) |
| 35 |
fi |
| 36 |
if test "${MD5}" = ":" ; then |
| 37 |
AC_MSG_ERROR(md5sum is required to build bundled libjwt) |
| 38 |
fi |
| 39 |
if test "${CAT}" = ":" ; then |
| 40 |
AC_MSG_ERROR(cat is required to build bundled libjwt) |
| 41 |
fi |
| 42 |
if test "${CUT}" = ":" ; then |
| 43 |
AC_MSG_ERROR(cut is required to build bundled libjwt) |
| 44 |
fi |
| 45 |
if test "${GREP}" = ":" ; then |
| 46 |
AC_MSG_ERROR(grep is required to build bundled libjwt) |
| 47 |
fi |
| 48 |
|
| 49 |
AC_ARG_VAR([LIBJWT_CONFIGURE_OPTS],[Additional configure options to pass to bundled libjwt]) |
| 50 |
this_host=$(./config.sub $(./config.guess)) |
| 51 |
if test "$build" != "$this_host" ; then |
| 52 |
LIBJWT_CONFIGURE_OPTS+=" --build=$build_alias" |
| 53 |
fi |
| 54 |
if test "$host" != "$this_host" ; then |
| 55 |
LIBJWT_CONFIGURE_OPTS+=" --host=$host_alias" |
| 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 |
export JANSSON_CFLAGS |
| 61 |
export JANSSON_LIBS="${JANSSON_LIB}" |
| 62 |
${GNU_MAKE} --quiet --no-print-directory -C ${LIBJWT_DIR} \ |
| 63 |
LIBJWT_CONFIGURE_OPTS="$LIBJWT_CONFIGURE_OPTS" \ |
| 64 |
EXTERNALS_CACHE_DIR="${EXTERNALS_CACHE_DIR:-${AST_DOWNLOAD_CACHE}}" \ |
| 65 |
configure |
| 66 |
if test $? -ne 0 ; then |
| 67 |
AC_MSG_RESULT(failed) |
| 68 |
AC_MSG_NOTICE(Unable to configure ${LIBJWT_DIR}) |
| 69 |
AC_MSG_ERROR(Re-run the ./configure command with 'NOISY_BUILD=yes' appended to see error details.) |
| 70 |
fi |
| 71 |
|
| 72 |
AC_MSG_CHECKING(for bundled libjwt) |
| 73 |
|
| 74 |
LIBJWT_INCLUDE=-I${LIBJWT_DIR}/dist/usr/include |
| 75 |
LIBJWT_CFLAGS="$LIBJWT_INCLUDE" |
| 76 |
LIBJWT_LIB="-L${LIBJWT_DIR}/dist/usr/lib -ljwt" |
| 77 |
PBX_LIBJWT=1 |
| 78 |
|
| 79 |
# We haven't run install yet |
| 80 |
|
| 81 |
AC_SUBST([LIBJWT_BUNDLED]) |
| 82 |
AC_SUBST([PBX_LIBJWT]) |
| 83 |
AC_SUBST([LIBJWT_LIB]) |
| 84 |
AC_SUBST([LIBJWT_INCLUDE]) |
| 85 |
AC_MSG_RESULT(yes) |
| 86 |
AC_DEFINE([HAVE_LIBJWT_BUNDLED], 1, [Define if your system has LIBJWT_BUNDLED]) |
| 87 |
]) |
| 88 |
|
| 89 |
AC_DEFUN([LIBJWT_CONFIGURE], |
| 90 |
[ |
| 91 |
if test "$LIBJWT_BUNDLED" = "yes" ; then |
| 92 |
_LIBJWT_CONFIGURE() |
| 93 |
fi |
| 94 |
]) |
| 95 |
|