Add configure switch for error logging

For keeping backwards compatibility the configure switch
--enable-error-log is enabled by default. To disable error logging
use --enable-error-log=no.

Signed-off-by: Mark Jonas <mark.jonas@de.bosch.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
pull/106/head^2
Mark Jonas 2018-08-09 10:59:05 +02:00 committed by Marc Kleine-Budde
parent 15af38a25c
commit b217774ca8
2 changed files with 21 additions and 0 deletions

View File

@ -99,6 +99,23 @@ else
fi fi
#
# Error logging
#
AC_MSG_CHECKING([whether to enable error logging])
AC_ARG_ENABLE(error-log,
AS_HELP_STRING([--enable-error-log], [enable error log @<:@default=yes@:>@]),
[case "$enableval" in
y | yes) CONFIG_ERROR_LOG=yes ;;
*) CONFIG_ERROR_LOG=no ;;
esac],
[CONFIG_ERROR_LOG=yes])
AC_MSG_RESULT([${CONFIG_ERROR_LOG}])
if test "${CONFIG_ERROR_LOG}" = "no"; then
AC_DEFINE(DISABLE_ERROR_LOG, 1, [disable error logging])
fi
AC_CONFIG_FILES([ AC_CONFIG_FILES([
GNUmakefile GNUmakefile
config/libsocketcan.pc config/libsocketcan.pc

View File

@ -22,6 +22,10 @@
* @brief library code * @brief library code
*/ */
#ifdef HAVE_CONFIG_H
#include "libsocketcan_config.h"
#endif
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>