Add libjwt to third-party

The current STIR/SHAKEN implementation is not currently usable due
to encryption issues. Rather than trying to futz with OpenSSL and
the the current code, we can take advantage of the existing
capabilities of libjwt but we first need to add it to the
third-party infrastructure already in place for jansson and
pjproject.

A few tweaks were also made to the third-party infrastructure as
a whole.  The jansson "dest" install directory was renamed "dist"
to better match convention, and the third-party Makefile was updated
to clean all product directories not just the ones currently in
use.

Resolves: #349
This commit is contained in:
George Joseph
2023-09-21 11:12:31 -06:00
parent 7369de127a
commit 733ab35848
17 changed files with 579 additions and 40 deletions

281
configure vendored
View File

@@ -707,6 +707,8 @@ LIBOBJS
PERMANENT_DLOPEN
DISABLE_XMLDOC
CONFIG_LIBXML2
LIBJWT_LIBS
LIBJWT_CFLAGS
JANSSON_LIBS
JANSSON_CFLAGS
UUID_LIB
@@ -1063,6 +1065,7 @@ PBX_LIBXML2
LIBXML2_DIR
LIBXML2_INCLUDE
LIBXML2_LIB
LIBJWT_DIR
PBX_LIBEDIT_IS_UNICODE
LIBEDIT_IS_UNICODE_DIR
LIBEDIT_IS_UNICODE_INCLUDE
@@ -1184,6 +1187,11 @@ PBX_ALSA
ALSA_DIR
ALSA_INCLUDE
ALSA_LIB
LIBJWT_INCLUDE
LIBJWT_LIB
PBX_LIBJWT
LIBJWT_BUNDLED
LIBJWT_CONFIGURE_OPTS
PJPROJECT_INCLUDE
PJPROJECT_LIB
PBX_PJPROJECT
@@ -1350,7 +1358,6 @@ infodir
docdir
oldincludedir
includedir
runstatedir
localstatedir
sharedstatedir
sysconfdir
@@ -1382,6 +1389,7 @@ with_externals_cache
enable_coverage
with_jansson_bundled
with_pjproject_bundled
with_libjwt_bundled
with_crypto
with_ssl
with_asound
@@ -1413,6 +1421,7 @@ with_kqueue
with_ldap
with_libcurl
with_libedit
with_libjwt
with_libxml2
with_libxslt
with_lua
@@ -1485,11 +1494,14 @@ OPENSSL_CFLAGS
OPENSSL_LIBS
JANSSON_CONFIGURE_OPTS
PJPROJECT_CONFIGURE_OPTS
LIBJWT_CONFIGURE_OPTS
LUA_VERSIONS
LIBEDIT_CFLAGS
LIBEDIT_LIBS
JANSSON_CFLAGS
JANSSON_LIBS
LIBJWT_CFLAGS
LIBJWT_LIBS
ILBC_CFLAGS
ILBC_LIBS
NETSNMP_CFLAGS
@@ -1544,7 +1556,6 @@ datadir='${datarootdir}'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
runstatedir='${localstatedir}/run'
includedir='${prefix}/include'
oldincludedir='/usr/include'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1797,15 +1808,6 @@ do
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;
-runstatedir | --runstatedir | --runstatedi | --runstated \
| --runstate | --runstat | --runsta | --runst | --runs \
| --run | --ru | --r)
ac_prev=runstatedir ;;
-runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
| --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
| --run=* | --ru=* | --r=*)
runstatedir=$ac_optarg ;;
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1943,7 +1945,7 @@ fi
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
libdir localedir mandir runstatedir
libdir localedir mandir
do
eval ac_val=\$$ac_var
# Remove trailing slashes.
@@ -2096,7 +2098,6 @@ Fine tuning of the installation directories:
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
@@ -2157,6 +2158,7 @@ Optional Packages:
--with-jansson-bundled Use bundled jansson library
--with-pjproject-bundled
Use bundled pjproject libraries (default)
--with-libjwt-bundled Use bundled libjwt library
--with-crypto=PATH use OpenSSL Cryptography files in PATH
--with-ssl=PATH use OpenSSL Secure Sockets Layer files in PATH
--with-asound=PATH use Advanced Linux Sound Architecture files in PATH
@@ -2191,6 +2193,7 @@ Optional Packages:
--with-libcurl=PREFIX look for the curl library in PREFIX/lib and headers
in PREFIX/include
--with-libedit=PATH use NetBSD Editline library files in PATH
--with-libjwt=PATH use LIBJWT files in PATH
--with-libxml2=PATH use LibXML2 files in PATH
--with-libxslt=PATH use LibXSLT files in PATH
--with-lua=PATH use Lua files in PATH
@@ -2263,6 +2266,8 @@ Some influential environment variables:
Additional configure options to pass to bundled jansson
PJPROJECT_CONFIGURE_OPTS
Additional configure options to pass to bundled pjproject
LIBJWT_CONFIGURE_OPTS
Additional configure options to pass to bundled libjwt
LUA_VERSIONS
A space separated list of target lua versions to test.
LIBEDIT_CFLAGS
@@ -2273,6 +2278,9 @@ Some influential environment variables:
C compiler flags for JANSSON, overriding pkg-config
JANSSON_LIBS
linker flags for JANSSON, overriding pkg-config
LIBJWT_CFLAGS
C compiler flags for LIBJWT, overriding pkg-config
LIBJWT_LIBS linker flags for LIBJWT, overriding pkg-config
ILBC_CFLAGS C compiler flags for ILBC, overriding pkg-config
ILBC_LIBS linker flags for ILBC, overriding pkg-config
NETSNMP_CFLAGS
@@ -9265,6 +9273,17 @@ if test "${with_pjproject}" = "no" || test "${with_pjproject}" = "n" ; then
PJPROJECT_BUNDLED=no
fi
LIBJWT_BUNDLED=no
# Check whether --with-libjwt-bundled was given.
if test "${with_libjwt_bundled+set}" = set; then :
withval=$with_libjwt_bundled; case "${withval}" in
y|ye|yes) LIBJWT_BUNDLED=yes ;;
*) LIBJWT_BUNDLED=no ;;
esac
fi
#
# OpenSSL stuff has to be done here because we want to pass
# any resulting CFLAGS and LDFLAGS to the bundled pjproject
@@ -10011,9 +10030,9 @@ $as_echo "$as_me: Unable to configure ${JANSSON_DIR}" >&6;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for bundled jansson" >&5
$as_echo_n "checking for bundled jansson... " >&6; }
JANSSON_INCLUDE=-I${JANSSON_DIR}/dest/include
JANSSON_INCLUDE=-I${JANSSON_DIR}/dist/usr/include
JANSSON_CFLAGS="$JANSSON_INCLUDE"
JANSSON_LIB="-L${JANSSON_DIR}/dest/lib -ljansson"
JANSSON_LIB="-L${JANSSON_DIR}/dist/usr/lib -ljansson"
PBX_JANSSON=1
# We haven't run install yet
@@ -10225,6 +10244,99 @@ $as_echo "yes" >&6; }
fi
if test "$LIBJWT_BUNDLED" = "yes" ; then
if test "${ac_mandatory_list#*LIBJWT*}" != "$ac_mandatory_list" ; then
as_fn_error $? "--with-libjwt and --with-libjwt-bundled can't both be specified" "$LINENO" 5
fi
ac_mandatory_list="$ac_mandatory_list LIBJWT"
LIBJWT_DIR="${ac_pwd}/third-party/libjwt"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for embedded libjwt (may have to download)" >&5
$as_echo_n "checking for embedded libjwt (may have to download)... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: configuring" >&5
$as_echo "configuring" >&6; }
if test "x${DOWNLOAD_TO_STDOUT}" = "x" ; then
as_fn_error $? "A download utility (wget, curl, or fetch) is required to download bundled libjwt" "$LINENO" 5
fi
if test "${GZIP}" = ":" ; then
as_fn_error $? "gzip is required to extract the libjwt tar file" "$LINENO" 5
fi
if test "${TAR}" = ":" ; then
as_fn_error $? "tar is required to extract the libjwt tar file" "$LINENO" 5
fi
if test "${PATCH}" = ":" ; then
as_fn_error $? "patch is required to configure bundled libjwt" "$LINENO" 5
fi
if test "${SED}" = ":" ; then
as_fn_error $? "sed is required to configure bundled libjwt" "$LINENO" 5
fi
if test "${NM}" = ":" ; then
as_fn_error $? "nm is required to build bundled libjwt" "$LINENO" 5
fi
if test "${MD5}" = ":" ; then
as_fn_error $? "md5sum is required to build bundled libjwt" "$LINENO" 5
fi
if test "${CAT}" = ":" ; then
as_fn_error $? "cat is required to build bundled libjwt" "$LINENO" 5
fi
if test "${CUT}" = ":" ; then
as_fn_error $? "cut is required to build bundled libjwt" "$LINENO" 5
fi
if test "${GREP}" = ":" ; then
as_fn_error $? "grep is required to build bundled libjwt" "$LINENO" 5
fi
this_host=$(./config.sub $(./config.guess))
if test "$build" != "$this_host" ; then
LIBJWT_CONFIGURE_OPTS+=" --build=$build_alias"
fi
if test "$host" != "$this_host" ; then
LIBJWT_CONFIGURE_OPTS+=" --host=$host_alias"
fi
export TAR PATCH SED NM EXTERNALS_CACHE_DIR AST_DOWNLOAD_CACHE DOWNLOAD_TO_STDOUT DOWNLOAD_TIMEOUT DOWNLOAD MD5 CAT CUT GREP
export NOISY_BUILD
export JANSSON_CFLAGS
export JANSSON_LIBS="${JANSSON_LIB}"
${GNU_MAKE} --quiet --no-print-directory -C ${LIBJWT_DIR} \
LIBJWT_CONFIGURE_OPTS="$LIBJWT_CONFIGURE_OPTS" \
EXTERNALS_CACHE_DIR="${EXTERNALS_CACHE_DIR:-${AST_DOWNLOAD_CACHE}}" \
configure
if test $? -ne 0 ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5
$as_echo "failed" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: Unable to configure ${LIBJWT_DIR}" >&5
$as_echo "$as_me: Unable to configure ${LIBJWT_DIR}" >&6;}
as_fn_error $? "Re-run the ./configure command with 'NOISY_BUILD=yes' appended to see error details." "$LINENO" 5
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for bundled libjwt" >&5
$as_echo_n "checking for bundled libjwt... " >&6; }
LIBJWT_INCLUDE=-I${LIBJWT_DIR}/dist/usr/include
LIBJWT_CFLAGS="$LIBJWT_INCLUDE"
LIBJWT_LIB="-L${LIBJWT_DIR}/dist/usr/lib -ljwt"
PBX_LIBJWT=1
# We haven't run install yet
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
$as_echo "#define HAVE_LIBJWT_BUNDLED 1" >>confdefs.h
fi
# AST_EXT_LIB_SETUP is used to tell configure to handle variables for
# various packages.
@@ -11547,6 +11659,38 @@ PBX_LIBEDIT_IS_UNICODE=0
LIBJWT_DESCRIP="LIBJWT"
LIBJWT_OPTION="libjwt"
PBX_LIBJWT=0
# Check whether --with-libjwt was given.
if test "${with_libjwt+set}" = set; then :
withval=$with_libjwt;
case ${withval} in
n|no)
USE_LIBJWT=no
# -1 is a magic value used by menuselect to know that the package
# was disabled, other than 'not found'
PBX_LIBJWT=-1
;;
y|ye|yes)
ac_mandatory_list="${ac_mandatory_list} LIBJWT"
;;
*)
LIBJWT_DIR="${withval}"
ac_mandatory_list="${ac_mandatory_list} LIBJWT"
;;
esac
fi
LIBXML2_DESCRIP="LibXML2"
LIBXML2_OPTION="libxml2"
PBX_LIBXML2=0
@@ -14711,6 +14855,101 @@ else
PBX_JANSSON=1
fi
source ./third-party/versions.mak
# Find required JWT support if bundled is not enabled.
if test "$LIBJWT_BUNDLED" = "no" ; then
if test "x${PBX_LIBJWT}" != "x1" -a "${USE_LIBJWT}" != "no"; then
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBJWT" >&5
$as_echo_n "checking for LIBJWT... " >&6; }
if test -n "$LIBJWT_CFLAGS"; then
pkg_cv_LIBJWT_CFLAGS="$LIBJWT_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libjwt >= \$LIBJWT_VERSION\""; } >&5
($PKG_CONFIG --exists --print-errors "libjwt >= $LIBJWT_VERSION") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_LIBJWT_CFLAGS=`$PKG_CONFIG --cflags "libjwt >= $LIBJWT_VERSION" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test -n "$LIBJWT_LIBS"; then
pkg_cv_LIBJWT_LIBS="$LIBJWT_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libjwt >= \$LIBJWT_VERSION\""; } >&5
($PKG_CONFIG --exists --print-errors "libjwt >= $LIBJWT_VERSION") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_LIBJWT_LIBS=`$PKG_CONFIG --libs "libjwt >= $LIBJWT_VERSION" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test $pkg_failed = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
_pkg_short_errors_supported=yes
else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
LIBJWT_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libjwt >= $LIBJWT_VERSION" 2>&1`
else
LIBJWT_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libjwt >= $LIBJWT_VERSION" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$LIBJWT_PKG_ERRORS" >&5
PBX_LIBJWT=0
elif test $pkg_failed = untried; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
PBX_LIBJWT=0
else
LIBJWT_CFLAGS=$pkg_cv_LIBJWT_CFLAGS
LIBJWT_LIBS=$pkg_cv_LIBJWT_LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
PBX_LIBJWT=1
LIBJWT_INCLUDE=$(echo ${LIBJWT_CFLAGS} | $SED -e "s|-std=c99||g")
LIBJWT_LIB="$LIBJWT_LIBS"
$as_echo "#define HAVE_LIBJWT 1" >>confdefs.h
fi
fi
else
PBX_LIBJWT=1
fi
# See if clock_gettime is in librt
if test "x${PBX_RT}" != "x1" -a "${USE_RT}" != "no"; then
@@ -15343,7 +15582,7 @@ else
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
@@ -15389,7 +15628,7 @@ else
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
@@ -15413,7 +15652,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
@@ -15458,7 +15697,7 @@ else
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
@@ -15482,7 +15721,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
@@ -16782,8 +17021,6 @@ main ()
if (*(data + i) != *(data3 + i))
return 14;
close (fd);
free (data);
free (data3);
return 0;
}
_ACEOF