Skip to content

Commit

Permalink
configure.ac: add libunwind as an optional dependency
Browse files Browse the repository at this point in the history
Signed-off-by: Balazs Scheidler <[email protected]>
  • Loading branch information
bazsi committed Feb 3, 2025
1 parent 6c57a1f commit 6a601fa
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 3 deletions.
25 changes: 25 additions & 0 deletions cmake/Modules/FindUNWIND.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#############################################################################
# Copyright (c) 2016 Balabit
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# As an additional exemption you are allowed to compile & link against the
# OpenSSL libraries as published by the OpenSSL project. See the file
# COPYING for details.
#
#############################################################################

find_package(PkgConfig)
pkg_check_modules(LIBUNWIND QUIET libunwind>=1.6.2)
1 change: 1 addition & 0 deletions cmake/syslog-ng-config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,4 @@
#cmakedefine01 SYSLOG_NG_HAVE_SO_MEMINFO
#cmakedefine01 SYSLOG_NG_ENABLE_AFSOCKET_MEMINFO_METRICS
#cmakedefine01 SYSLOG_NG_HAVE_IV_WORK_POOL_SUBMIT_CONTINUATION
#cmakedefine01 SYSLOG_NG_ENABLE_LIBUNWIND
14 changes: 11 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1396,6 +1396,12 @@ AC_CHECK_DECLS([MONGOC_URI_SERVERSELECTIONTIMEOUTMS], [], [], [[#include <mongoc
CPPFLAGS="$CPPFLAGS_SAVE"
fi

dnl ***************************************************************************
dnl libunwind headers/libraries
dnl ***************************************************************************

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

dnl ***************************************************************************
dnl libesmtp headers/libraries
dnl ***************************************************************************
Expand Down Expand Up @@ -2097,7 +2103,7 @@ fi
python_moduledir="$moduledir"/python
python_sysconf_moduledir="${sysconfdir}/python"

CPPFLAGS="$CPPFLAGS $GLIB_CFLAGS $EVTLOG_CFLAGS $PCRE2_CFLAGS $OPENSSL_CFLAGS $LIBNET_CFLAGS $LIBDBI_CFLAGS $IVYKIS_CFLAGS $JSON_CFLAGS $LIBCAP_CFLAGS -D_GNU_SOURCE -D_DEFAULT_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
CPPFLAGS="$CPPFLAGS $GLIB_CFLAGS $EVTLOG_CFLAGS $PCRE2_CFLAGS $OPENSSL_CFLAGS $LIBNET_CFLAGS $LIBUNWIND_CFLAGS $LIBDBI_CFLAGS $IVYKIS_CFLAGS $JSON_CFLAGS $LIBCAP_CFLAGS -D_GNU_SOURCE -D_DEFAULT_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"

########################################################
## NOTES: on how syslog-ng is linked
Expand Down Expand Up @@ -2145,7 +2151,7 @@ fi
MODULE_DEPS_LIBS="\$(top_builddir)/lib/libsyslog-ng.la"

if test "x$linking_mode" = "xdynamic"; then
SYSLOGNG_DEPS_LIBS="$LIBS $BASE_LIBS $GLIB_LIBS $EVTLOG_LIBS $SECRETSTORAGE_LIBS $RESOLV_LIBS $LIBCAP_LIBS $PCRE2_LIBS $REGEX_LIBS $DL_LIBS"
SYSLOGNG_DEPS_LIBS="$LIBS $BASE_LIBS $GLIB_LIBS $EVTLOG_LIBS $SECRETSTORAGE_LIBS $RESOLV_LIBS $LIBCAP_LIBS $PCRE2_LIBS $REGEX_LIBS $DL_LIBS $LIBUNWIND_LIBS"

if test "x$with_ivykis" = "xinternal"; then
# when using the internal ivykis, we're linking it statically into libsyslog-ng.so
Expand All @@ -2164,7 +2170,7 @@ if test "x$linking_mode" = "xdynamic"; then
# syslog-ng binary is linked with the default link command (e.g. libtool)
SYSLOGNG_LINK='$(LINK)'
else
SYSLOGNG_DEPS_LIBS="$LIBS $BASE_LIBS $RESOLV_LIBS $EVTLOG_NO_LIBTOOL_LIBS $SECRETSTORAGE_NO_LIBTOOL_LIBS $LD_START_STATIC -Wl,${WHOLE_ARCHIVE_OPT} $GLIB_LIBS $PCRE2_LIBS $REGEX_LIBS -Wl,${NO_WHOLE_ARCHIVE_OPT} $IVYKIS_NO_LIBTOOL_LIBS $LD_END_STATIC $LIBCAP_LIBS $DL_LIBS"
SYSLOGNG_DEPS_LIBS="$LIBS $BASE_LIBS $RESOLV_LIBS $EVTLOG_NO_LIBTOOL_LIBS $SECRETSTORAGE_NO_LIBTOOL_LIBS $LD_START_STATIC -Wl,${WHOLE_ARCHIVE_OPT} $GLIB_LIBS $PCRE2_LIBS $REGEX_LIBS -Wl,${NO_WHOLE_ARCHIVE_OPT} $IVYKIS_NO_LIBTOOL_LIBS $LD_END_STATIC $LIBCAP_LIBS $DL_LIBS $LIBUNWIND_LIBS"
TOOL_DEPS_LIBS="$LIBS $BASE_LIBS $GLIB_LIBS $EVTLOG_LIBS $SECRETSTORAGE_LIBS $RESOLV_LIBS $LIBCAP_LIBS $PCRE2_LIBS $REGEX_LIBS $IVYKIS_LIBS $DL_LIBS"
CORE_DEPS_LIBS=""

Expand Down Expand Up @@ -2247,6 +2253,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(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 @@ -2414,6 +2421,7 @@ echo " Env wrapper support : ${enable_env_wrapper:=no}"
echo " systemd support : ${enable_systemd:=no} (unit dir: ${systemdsystemunitdir:=none})"
echo " systemd-journal support : ${with_systemd_journal:=no}"
echo " JSON support : $with_jsonc"
echo " unwind support : ${enable_libunwind:=no}"
echo " Build options:"
echo " Generate manual pages : ${enable_manpages:=no}"
echo " Install manual pages : ${enable_manpages_install:=no}"
Expand Down

0 comments on commit 6a601fa

Please sign in to comment.