Split development option into separate things

This commit is contained in:
matt335672 2021-05-19 11:19:43 +01:00
parent fa1a6cfe5e
commit 52a52daddd
22 changed files with 61 additions and 88 deletions

View File

@ -29,10 +29,6 @@ AM_CPPFLAGS = \
-DXRDP_LOG_PATH=\"${localstatedir}/log\" \
-DXRDP_SOCKET_PATH=\"${socketdir}\"
if XRDP_DEBUG
AM_CPPFLAGS += -DXRDP_DEBUG
endif
# -no-suppress is an automake-specific flag which is needed
# to prevent us missing compiler errors in some circumstances
# (see https://github.com/neutrinolabs/xrdp/pull/1843 )

View File

@ -25,6 +25,13 @@
#include "defines.h"
#include "list.h"
/* Check the config_ac.h file is included so we know whether to enable the
* development macros
*/
#ifndef CONFIG_AC_H
# error config_ac.h not visible in log.h
#endif
/* logging buffer size */
#define LOG_BUFFER_SIZE 8192
#define LOGGER_NAME_SIZE 50
@ -66,7 +73,7 @@ enum logReturns
/* enable threading */
/*#define LOG_ENABLE_THREAD*/
#ifdef XRDP_DEBUG
#ifdef USE_DEVEL_LOGGING
#define LOG_PER_LOGGER_LEVEL
@ -77,9 +84,10 @@ enum logReturns
* Note: all log levels are relavant to help a developer understand XRDP at
* different levels of granularity.
*
* Note: the logging function calls are removed when XRDP_DEBUG is NOT defined.
* Note: the logging function calls are removed when USE_DEVEL_LOGGING is
* NOT defined.
*
* Note: when the build is configured with --enable-xrdpdebug, then
* Note: when the build is configured with --enable-devel-logging, then
* the log level can be configured per the source file name or method name
* (with the suffix "()") in the [LoggingPerLogger]
* section of the configuration file.
@ -103,7 +111,7 @@ enum logReturns
* configure and run XRDP on their machine.
*
* Note: the logging function calls contain additional code location info when
* XRDP_DEBUG is defined.
* USE_DEVEL_LOGGING is defined.
*
* @param lvl, the log level
* @param msg, the log text as a printf format c-string
@ -116,7 +124,8 @@ enum logReturns
* @brief Logging macro for logging the contents of a byte array using a hex
* dump format.
*
* Note: the logging function calls are removed when XRDP_DEBUG is NOT defined.
* Note: the logging function calls are removed when USE_DEVEL_LOGGING is
* NOT defined.
*
* @param log_level, the log level
* @param message, a message prefix for the hex dump. Note: no printf like

View File

@ -89,7 +89,7 @@
#define PREFIX(x) pixman_region##x
#endif
#ifdef XRDP_DEBUG
#ifdef USE_DEVEL_LOGGING
pixman_bool_t PREFIX(_selfcheck) (region_type_t *reg);

View File

@ -98,10 +98,19 @@ AC_ARG_ENABLE(pam-config, AS_HELP_STRING([--enable-pam-config=CONF],
[Select PAM config to install: arch, debian, redhat, suse, freebsd, macos, unix
(default: autodetect)]))
AC_ARG_ENABLE(xrdpdebug, AS_HELP_STRING([--enable-xrdpdebug],
[Build debug (default: no)]),
[], [enable_xrdpdebug=no])
AM_CONDITIONAL(XRDP_DEBUG, [test x$enable_xrdpdebug = xyes])
# Development options. devel_all is first as this provides a default for
# the others
AC_ARG_ENABLE(devel_all, AS_HELP_STRING([--enable-devel-all],
[Enable all development options (default: no)]),
[devel_all=$enableval], [devel_all=no])
AC_ARG_ENABLE(devel_debug, AS_HELP_STRING([--enable-devel-debug],
[Build exes with no optimisation and debugging symbols (default: no)]),
[devel_debug=$enableval], [devel_debug=$devel_all])
AM_CONDITIONAL(DEVEL_DEBUG, [test x$devel_debug = xyes ])
AC_ARG_ENABLE(devel_logging, AS_HELP_STRING([--enable-devel-logging],
[Enable development logging (default: no)]),
[devel_logging=$enableval], [devel_logging=$devel_all])
AC_ARG_ENABLE(neutrinordp, AS_HELP_STRING([--enable-neutrinordp],
[Build neutrinordp module (default: no)]),
[], [enable_neutrinordp=no])
@ -163,7 +172,7 @@ AX_APPEND_COMPILE_FLAGS([-Wwrite-strings])
AM_COND_IF([LINUX],
[AX_APPEND_COMPILE_FLAGS([-Werror])]) # bsd has warnings that have not been fixed yet
AM_COND_IF([XRDP_DEBUG],
AM_COND_IF([DEVEL_DEBUG],
[AX_APPEND_COMPILE_FLAGS([-g -O0])],
[AX_APPEND_COMPILE_FLAGS([-O2])])
@ -247,6 +256,13 @@ fi
AC_SUBST(PAM_RULES)
# Add define for development options to config_ac.h
AC_DEFINE([CONFIG_AC_H],1, [Allow sources to check config_ac.h is included])
if test x$devel_logging = xyes
then
AC_DEFINE([USE_DEVEL_LOGGING],1,[Enable development logging])
fi
if test "x$enable_vsock" = "xyes"
then
enable_vsock=yes
@ -438,21 +454,22 @@ AC_OUTPUT
echo ""
echo "xrdp will be compiled with:"
echo ""
echo " mp3lame $enable_mp3lame"
echo " opus $enable_opus"
echo " fdkaac $enable_fdkaac"
echo " jpeg $enable_jpeg"
echo " turbo jpeg $enable_tjpeg"
echo " rfxcodec $enable_rfxcodec"
echo " painter $enable_painter"
echo " pixman $enable_pixman"
echo " fuse $enable_fuse"
echo " ipv6 $enable_ipv6"
echo " ipv6only $enable_ipv6only"
echo " vsock $enable_vsock"
echo " auth mechanism $auth_mech"
echo " debug $enable_xrdpdebug"
echo " rdpsndaudin $enable_rdpsndaudin"
echo " mp3lame $enable_mp3lame"
echo " opus $enable_opus"
echo " fdkaac $enable_fdkaac"
echo " jpeg $enable_jpeg"
echo " turbo jpeg $enable_tjpeg"
echo " rfxcodec $enable_rfxcodec"
echo " painter $enable_painter"
echo " pixman $enable_pixman"
echo " fuse $enable_fuse"
echo " ipv6 $enable_ipv6"
echo " ipv6only $enable_ipv6only"
echo " vsock $enable_vsock"
echo " auth mechanism $auth_mech"
echo " rdpsndaudin $enable_rdpsndaudin"
echo
echo " development logging $devel_logging"
echo ""
echo " strict_locations $enable_strict_locations"
echo " prefix $prefix"

View File

@ -14,10 +14,6 @@ AM_LDFLAGS =
LIBXRDP_EXTRA_LIBS =
if XRDP_DEBUG
AM_CPPFLAGS += -DXRDP_DEBUG
endif
if XRDP_NEUTRINORDP
AM_CPPFLAGS += -DXRDP_NEUTRINORDP
LIBXRDP_EXTRA_LIBS += $(FREERDP_LIBS)

View File

@ -626,7 +626,7 @@ static int
xrdp_caps_process_surface_cmds(struct xrdp_rdp *self, struct stream *s, int len)
{
int cmdFlags;
#ifndef XRDP_DEBUG
#ifndef USE_DEVEL_LOGGING
/* TODO: remove UNUSED_VAR once the `cmdFlags` variable is used for more than
logging in debug mode */
UNUSED_VAR(cmdFlags);

View File

@ -1406,7 +1406,7 @@ xrdp_sec_recv_fastpath(struct xrdp_sec *self, struct stream *s)
int len;
int pad;
#ifndef XRDP_DEBUG
#ifndef USE_DEVEL_LOGGING
/* TODO: remove UNUSED_VAR once the `ver` variable is used for more than
logging in debug mode */
UNUSED_VAR(ver);

View File

@ -5,10 +5,6 @@ AM_CPPFLAGS = \
-DXRDP_PID_PATH=\"${localstatedir}/run\" \
-I$(top_srcdir)/common
if XRDP_DEBUG
AM_CPPFLAGS += -DXRDP_DEBUG
endif
module_LTLIBRARIES = \
libmc.la

View File

@ -6,10 +6,6 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/common \
$(FREERDP_CFLAGS)
if XRDP_DEBUG
AM_CPPFLAGS += -DXRDP_DEBUG
endif
module_LTLIBRARIES = \
libxrdpneutrinordp.la

View File

@ -11,10 +11,6 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/common \
-I$(top_srcdir)/sesman/libscp
if XRDP_DEBUG
AM_CPPFLAGS += -DXRDP_DEBUG
endif
if SESMAN_BSD
AUTH_C = verify_user_bsd.c
AUTH_LIB =

View File

@ -11,10 +11,6 @@ AM_CPPFLAGS = \
-DXRDP_SOCKET_PATH=\"${socketdir}\" \
-I$(top_srcdir)/common
if XRDP_DEBUG
AM_CPPFLAGS += -DXRDP_DEBUG
endif
CHANSRV_EXTRA_LIBS =
if XRDP_FUSE

View File

@ -5,10 +5,6 @@ AM_CPPFLAGS = \
-DXRDP_PID_PATH=\"${localstatedir}/run\" \
-I$(top_srcdir)/common
if XRDP_DEBUG
AM_CPPFLAGS += -DXRDP_DEBUG
endif
module_LTLIBRARIES = \
libscp.la

View File

@ -74,7 +74,8 @@ EnableSyslog=true
#EnableProcessId=false
[LoggingPerLogger]
; Note: per logger configuration is only used in XRDP_DEBUG builds of XRDP.
; Note: per logger configuration is only used if xrdp is built with
; --enable-devel-logging
#sesman.c=INFO
#main()=INFO
@ -139,7 +140,8 @@ EnableSyslog=true
#EnableProcessId=false
[ChansrvLoggingPerLogger]
; Note: per logger configuration is only used in XRDP_DEBUG builds of XRDP.
; Note: per logger configuration is only used if xrdp is built with
; --enable-devel-logging
#chansrv.c=INFO
#main()=INFO

View File

@ -8,10 +8,6 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/sesman/libscp \
-I$(top_srcdir)/sesman
if XRDP_DEBUG
AM_CPPFLAGS += -DXRDP_DEBUG
endif
AM_CFLAGS = $(X_CFLAGS)
bin_PROGRAMS = \

View File

@ -3,10 +3,6 @@ AM_CPPFLAGS = \
-I$(top_builddir) \
-I$(top_srcdir)/common
if XRDP_DEBUG
AM_CPPFLAGS += -DXRDP_DEBUG
endif
LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \
$(top_srcdir)/tap-driver.sh

View File

@ -2,10 +2,6 @@
AM_CPPFLAGS = \
-I$(top_srcdir)/common
if XRDP_DEBUG
AM_CPPFLAGS += -DXRDP_DEBUG
endif
check_PROGRAMS = \
memtest

View File

@ -2,10 +2,6 @@
AM_CPPFLAGS = \
-I$(top_srcdir)/common
if XRDP_DEBUG
AM_CPPFLAGS += -DXRDP_DEBUG
endif
noinst_PROGRAMS = \
tcp_proxy

View File

@ -5,10 +5,6 @@ AM_CPPFLAGS = \
-DXRDP_PID_PATH=\"${localstatedir}/run\" \
-I$(top_srcdir)/common
if XRDP_DEBUG
AM_CPPFLAGS += -DXRDP_DEBUG
endif
module_LTLIBRARIES = \
libvnc.la

View File

@ -16,10 +16,6 @@ AM_CPPFLAGS = \
XRDP_EXTRA_LIBS =
if XRDP_DEBUG
AM_CPPFLAGS += -DXRDP_DEBUG
endif
if XRDP_RFXCODEC
AM_CPPFLAGS += -DXRDP_RFXCODEC
AM_CPPFLAGS += -I$(top_srcdir)/librfxcodec/include

View File

@ -454,7 +454,7 @@ main(int argc, char **argv)
const char *pid_file = XRDP_PID_PATH "/xrdp.pid";
int errored_argc;
#ifdef XRDP_DEBUG
#ifdef USE_DEVEL_LOGGING
int test;
for (test = 0; test < argc; test++)
{

View File

@ -166,7 +166,8 @@ EnableSyslog=true
#EnableProcessId=false
[LoggingPerLogger]
; Note: per logger configuration is only used in XRDP_DEBUG builds of XRDP.
; Note: per logger configuration is only used if xrdp is built with
; --enable-devel-logging
#xrdp.c=INFO
#main()=INFO

View File

@ -5,10 +5,6 @@ AM_CPPFLAGS = \
-DXRDP_PID_PATH=\"${localstatedir}/run\" \
-I$(top_srcdir)/common
if XRDP_DEBUG
AM_CPPFLAGS += -DXRDP_DEBUG
endif
module_LTLIBRARIES = \
libxup.la