2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-22 01:59:26 +00:00

Print the used jemalloc version in autoconf and named -V output

The autoconf and named -V now prints used version of jemalloc.  This
doesn't work with system supplied jemalloc, so in it prints `system`
instead in the autoconf and nothing in named -V output.
This commit is contained in:
Ondřej Surý 2023-09-05 14:58:15 +02:00
parent d862f4bc64
commit 2e99dcefa8
No known key found for this signature in database
GPG Key ID: 2820F37E873DEA41
3 changed files with 31 additions and 0 deletions

View File

@ -103,6 +103,14 @@
#include <nghttp2/nghttp2.h>
#endif
/* On DragonFly BSD the header does not provide jemalloc API */
#if defined(HAVE_MALLOC_NP_H) && !defined(__DragonFly__)
#include <malloc_np.h>
#include <sys/malloc.h> /* For M_VERSION */
#elif defined(HAVE_JEMALLOC)
#include <jemalloc/jemalloc.h>
#endif
/*
* Include header files for database drivers here.
*/
@ -596,6 +604,13 @@ printversion(bool verbose) {
UV_VERSION_MINOR, UV_VERSION_PATCH);
printf("linked to libuv version: %s\n", uv_version_string());
printf("compiled with %s version: %s\n", RCU_FLAVOR, RCU_VERSION);
#if defined(JEMALLOC_VERSION)
printf("compiled with jemalloc version: %u.%u.%u\n",
JEMALLOC_VERSION_MAJOR, JEMALLOC_VERSION_MINOR,
JEMALLOC_VERSION_BUGFIX);
#elif defined(M_VERSION)
printf("compiled with system jemalloc version: %u\n", M_VERSION);
#endif
#if HAVE_LIBNGHTTP2
nghttp2_info *nginfo = NULL;
printf("compiled with libnghttp2 version: %s\n", NGHTTP2_VERSION);
@ -1181,6 +1196,17 @@ setup(void) {
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_MAIN, ISC_LOG_NOTICE,
"linked to libuv version: %s", uv_version_string());
#if defined(JEMALLOC_VERSION)
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_MAIN, ISC_LOG_NOTICE,
"compiled with jemalloc version: %u.%u.%u",
JEMALLOC_VERSION_MAJOR, JEMALLOC_VERSION_MINOR,
JEMALLOC_VERSION_BUGFIX);
#elif defined(M_VERSION)
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_MAIN, ISC_LOG_NOTICE,
"compiled with system jemalloc version: %u", M_VERSION);
#endif
#ifdef HAVE_LIBXML2
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_MAIN, ISC_LOG_NOTICE,

View File

@ -1763,6 +1763,9 @@ report() {
echo " OpenSSL: $OPENSSL_VERSION"
echo " libuv: $LIBUV_VERSION"
echo " Userspace-RCU: $RCU_VERSION"
if test "no" != "$with_jemalloc"; then
echo " jemalloc: $JEMALLOC_VERSION"
fi
echo "-------------------------------------------------------------------------------"
echo "Features disabled or unavailable on this platform:"

View File

@ -29,6 +29,7 @@ AC_DEFUN([AX_CHECK_JEMALLOC], [
PKG_CHECK_MODULES(
[JEMALLOC], [jemalloc],
[
PKG_CHECK_VERSION([JEMALLOC_VERSION], [jemalloc])
found=true
], [
AC_CHECK_HEADERS([malloc_np.h jemalloc/jemalloc.h],
@ -39,6 +40,7 @@ AC_DEFUN([AX_CHECK_JEMALLOC], [
AC_SEARCH_LIBS([sdallocx], [jemalloc],
[
found=true
JEMALLOC_VERSION=system
AS_IF([test "$ac_cv_search_mallocx" != "none required"],
[JEMALLOC_LIBS="$ac_cv_search_mallocx"])
])