[PATCH] Add configure switch for error logging

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxx>
---
 configure.ac       | 17 +++++++++++++++++
 src/libsocketcan.c |  4 ++++
 2 files changed, 21 insertions(+)

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>
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-can" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux