Skip to content
This repository has been archived by the owner on Feb 26, 2020. It is now read-only.

Implement --enable-debuginfo to permit us to force building with debuginfo #392

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 59 additions & 13 deletions config/spl-build.m4
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ AC_DEFUN([SPL_AC_CONFIG_KERNEL], [
AC_SUBST(KERNELCPPFLAGS)

SPL_AC_DEBUG
SPL_AC_DEBUGINFO
SPL_AC_DEBUG_KMEM
SPL_AC_DEBUG_KMEM_TRACKING
SPL_AC_TEST_MODULE
Expand Down Expand Up @@ -430,34 +431,79 @@ AC_DEFUN([SPL_AC_CONFIG], [
[test "x$enable_linux_builtin" != xyes ])
])

AC_DEFUN([SPL_AC_DEBUG_ENABLE], [
KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG -Werror"
DEBUG_CFLAGS="-DDEBUG -Werror"
DEBUG_SPL="_with_debug"
])

AC_DEFUN([SPL_AC_DEBUG_DISABLE], [
KERNELCPPFLAGS="${KERNELCPPFLAGS} -DNDEBUG"
DEBUG_CFLAGS="-DNDEBUG"
DEBUG_SPL="_without_debug"
])

dnl #
dnl # Enable if the SPL should be compiled with internal debugging enabled.
dnl # By default this support is disabled.
dnl #
AC_DEFUN([SPL_AC_DEBUG], [
AC_MSG_CHECKING([whether debugging is enabled])
AC_MSG_CHECKING([whether assertion support will be enabled])
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug],
[Enable generic debug support @<:@default=no@:>@])],
[Enable assertion support @<:@default=no@:>@])],
[],
[enable_debug=no])

AS_IF([test "x$enable_debug" = xyes],
[
KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG -Werror"
DEBUG_CFLAGS="-DDEBUG -Werror"
DEBUG_SPL="_with_debug"
], [
KERNELCPPFLAGS="${KERNELCPPFLAGS} -DNDEBUG"
DEBUG_CFLAGS="-DNDEBUG"
DEBUG_SPL="_without_debug"
])
AS_CASE(["x$enable_debug"],
["xyes"],
[SPL_AC_DEBUG_ENABLE],
["xno"],
[SPL_AC_DEBUG_DISABLE],
[AC_MSG_ERROR([Unknown option $enable_debug])])

AC_SUBST(DEBUG_CFLAGS)
AC_SUBST(DEBUG_SPL)
AC_MSG_RESULT([$enable_debug])
])

AC_DEFUN([SPL_AC_DEBUGINFO_KERNEL], [
KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS CONFIG_DEBUG_INFO=y"
])

AC_DEFUN([SPL_AC_DEBUGINFO_USER], [
DEBUG_CFLAGS="$DEBUG_CFLAGS -g"
])

dnl #
dnl # Enable if the build system should be forced to compile with debuginfo.
dnl # By default this is disabled because other things should control it.
dnl # This is provided for distributions such as Ubuntu where kernel modules
dnl # are not built with debuginfo, but the kernel is.
dnl #
AC_DEFUN([SPL_AC_DEBUGINFO], [
AC_MSG_CHECKING([whether debuginfo support will be forced])
AC_ARG_ENABLE([debuginfo],
[AS_HELP_STRING([--enable-debuginfo],
[Force generation of debuginfo @<:@default=no@:>@])],
[],
[enable_debuginfo=no])

AS_CASE(["x$enable_debuginfo"],
["xyes"],
[SPL_AC_DEBUGINFO_KERNEL
SPL_AC_DEBUGINFO_USER],
["xkernel"],
[SPL_AC_DEBUGINFO_KERNEL],
["xuser"],
[SPL_AC_DEBUGINFO_USER],
["xno"],
[],
[AC_MSG_ERROR([Unknown option $enable_debug])])

AC_SUBST(DEBUG_CFLAGS)
AC_MSG_RESULT([$enable_debuginfo])
])

dnl #
dnl # Enabled by default it provides a minimal level of memory tracking.
dnl # A total count of bytes allocated is kept for each alloc and free.
Expand Down