Skip to content

Commit

Permalink
configure: allow enabling/disabling stackdump support
Browse files Browse the repository at this point in the history
Signed-off-by: László Várady <[email protected]>
  • Loading branch information
MrAnno committed Feb 13, 2025
1 parent 2f98c5a commit 1c3d7ef
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cmake/syslog-ng-config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,4 @@
#cmakedefine01 SYSLOG_NG_ENABLE_AFSOCKET_MEMINFO_METRICS
#cmakedefine01 SYSLOG_NG_HAVE_IV_WORK_POOL_SUBMIT_CONTINUATION
#cmakedefine01 SYSLOG_NG_ENABLE_PERF
#cmakedefine01 SYSLOG_NG_ENABLE_LIBUNWIND
#cmakedefine01 SYSLOG_NG_ENABLE_STACKDUMP
22 changes: 20 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,10 @@ AC_ARG_ENABLE(native,

AC_ARG_ENABLE(afsnmp, [ --enable-afsnmp Enable afsnmp module (default: auto)],, enable_afsnmp="auto")

AC_ARG_ENABLE(stackdump,
[ --disable-stackdump Disable stackdump support]
,,enable_stackdump="auto")

AC_ARG_ENABLE(all-modules,
[ --enable-all-modules Forcibly enable all modules. (default: auto)]
,,enable_all_modules="auto")
Expand Down Expand Up @@ -1407,6 +1411,10 @@ dnl ***************************************************************************

PKG_CHECK_MODULES(LIBUNWIND, libunwind >= 1.6.2, enable_libunwind="yes", enable_libunwind="no")

if test "$enable_stackdump" = "yes" && test "$enable_libunwind" = "no"; then
AC_MSG_ERROR([Could not find libunwind, and stackdump support was explicitly enabled.])
fi

dnl ***************************************************************************
dnl libesmtp headers/libraries
dnl ***************************************************************************
Expand Down Expand Up @@ -2001,6 +2009,16 @@ if test "x$enable_kafka" = "xauto"; then
AC_MSG_RESULT([$enable_kafka])
fi

if test "x$enable_stackdump" = "xauto"; then
AC_MSG_CHECKING(whether to enable stackdump support)
if test "x$enable_libunwind" != "xno"; then
enable_stackdump="yes"
else
enable_stackdump="no"
fi
AC_MSG_RESULT([$enable_stackdump])
fi

if test "x$enable_systemd" = "xauto"; then
if test "$ostype" = "Linux" -a "$have_libsystemd" = "yes"; then
enable_systemd=yes
Expand Down Expand Up @@ -2269,7 +2287,7 @@ AC_DEFINE_UNQUOTED(ENABLE_ENV_WRAPPER, `enable_value $enable_env_wrapper`, [Enab
AC_DEFINE_UNQUOTED(ENABLE_SYSTEMD, `enable_value $enable_systemd`, [Enable systemd support])
AC_DEFINE_UNQUOTED(ENABLE_KAFKA, `enable_value $enable_kafka`, [Enable kafka support])
AC_DEFINE_UNQUOTED(ENABLE_CPP, `enable_value $enable_cpp`, [Enable C++ support])
AC_DEFINE_UNQUOTED(ENABLE_LIBUNWIND, `enable_value $enable_libunwind`, [Enable stackdump using libunwind])
AC_DEFINE_UNQUOTED(ENABLE_STACKDUMP, `enable_value $enable_stackdump`, [Enable stackdump using libunwind])
AC_DEFINE_UNQUOTED(SYSTEMD_JOURNAL_MODE, `journald_mode`, [Systemd-journal support mode])
AC_DEFINE_UNQUOTED(HAVE_INOTIFY, `enable_value $ac_cv_func_inotify_init`, [Have inotify])
AC_DEFINE_UNQUOTED(USE_CONST_IVYKIS_MOCK, `enable_value $IVYKIS_VERSION_UPDATED`, [ivykis version is greater than $IVYKIS_UPDATED_VERSION])
Expand Down Expand Up @@ -2439,7 +2457,7 @@ echo " systemd support : ${enable_systemd:=no} (unit dir: ${systemd
echo " systemd-journal support : ${with_systemd_journal:=no}"
echo " JSON support : $with_jsonc"
echo " perf support : ${enable_perf:=no}"
echo " unwind support : ${enable_libunwind:=no}"
echo " stackdump support : ${enable_stackdump:=no}"
echo " Build options:"
echo " Generate manual pages : ${enable_manpages:=no}"
echo " Install manual pages : ${enable_manpages_install:=no}"
Expand Down
2 changes: 1 addition & 1 deletion lib/stackdump.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include <fcntl.h>
#include <unistd.h>

#if SYSLOG_NG_ENABLE_LIBUNWIND
#if SYSLOG_NG_ENABLE_STACKDUMP

#define UNW_LOCAL_ONLY
#include <libunwind.h>
Expand Down

0 comments on commit 1c3d7ef

Please sign in to comment.