diff --git a/config/zfs-build.m4 b/config/zfs-build.m4 index 78a87aef7253..a8609b8299b3 100644 --- a/config/zfs-build.m4 +++ b/config/zfs-build.m4 @@ -38,12 +38,43 @@ AC_DEFUN([ZFS_AC_DEBUG], [ [ZFS_AC_DEBUG_DISABLE], [AC_MSG_ERROR([Unknown option $enable_debug])]) - AC_SUBST(DEBUG_CFLAGS) AC_SUBST(DEBUG_STACKFLAGS) AC_SUBST(DEBUG_ZFS) AC_MSG_RESULT([$enable_debug]) ]) +AC_DEFUN([ZFS_AC_DEBUGINFO_KERNEL], [ + KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS CONFIG_DEBUG_INFO=y" +]) + +AC_DEFUN([ZFS_AC_DEBUGINFO_USER], [ + DEBUG_CFLAGS="$DEBUG_CFLAGS -g" +]) + +AC_DEFUN([ZFS_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"], + [ZFS_AC_DEBUGINFO_KERNEL + ZFS_AC_DEBUGINFO_USER], + ["xkernel"], + [ZFS_AC_DEBUGINFO_KERNEL], + ["xuser"], + [ZFS_AC_DEBUGINFO_USER], + ["xno"], + [], + [AC_MSG_ERROR([Unknown option $enable_debug])]) + + AC_SUBST(DEBUG_CFLAGS) + AC_MSG_RESULT([$enable_debuginfo]) +]) + AC_DEFUN([ZFS_AC_CONFIG_ALWAYS], [ ZFS_AC_CONFIG_ALWAYS_NO_UNUSED_BUT_SET_VARIABLE ZFS_AC_CONFIG_ALWAYS_NO_BOOL_COMPARE diff --git a/configure.ac b/configure.ac index 0c7977ef80ea..e145aa370871 100644 --- a/configure.ac +++ b/configure.ac @@ -55,6 +55,7 @@ ZFS_AC_LICENSE ZFS_AC_PACKAGE ZFS_AC_CONFIG ZFS_AC_DEBUG +ZFS_AC_DEBUGINFO AC_CONFIG_FILES([ Makefile