summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Jonas <mark.jonas@de.bosch.com>2018-08-09 10:59:05 +0200
committerMarc Kleine-Budde <mkl@pengutronix.de>2018-08-13 13:19:41 +0200
commitb217774ca825ba449ddb27e2bc9be6f3b8cad9b1 (patch)
treebb1ebfc23e06b998770f8782697b92e687285328
parent15af38a25c679d3ed0f72bbc1109c6b34a959c39 (diff)
downloadlibsocketcan-b217774ca825ba449ddb27e2bc9be6f3b8cad9b1.tar.gz
libsocketcan-b217774ca825ba449ddb27e2bc9be6f3b8cad9b1.tar.xz
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>
-rw-r--r--configure.ac17
-rw-r--r--src/libsocketcan.c4
2 files changed, 21 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 492da2c..9a807ec 100644
--- a/configure.ac
+++ b/configure.ac
@@ -99,6 +99,23 @@ else
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([
GNUmakefile
config/libsocketcan.pc
diff --git a/src/libsocketcan.c b/src/libsocketcan.c
index 5c7665c..c802849 100644
--- a/src/libsocketcan.c
+++ b/src/libsocketcan.c
@@ -22,6 +22,10 @@
* @brief library code
*/
+#ifdef HAVE_CONFIG_H
+#include "libsocketcan_config.h"
+#endif
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>