From 48e92149e41e59ff11ea3a0546125ba9b72717f3 Mon Sep 17 00:00:00 2001 From: Romuald Conty Date: Fri, 6 Jan 2012 13:05:10 +0000 Subject: [PATCH] drop log4c support --- configure.ac | 11 ------- examples/Makefile.am | 5 --- libnfc/Makefile.am | 11 ------- libnfc/buses/Makefile.am | 4 --- libnfc/chips/Makefile.am | 6 ---- libnfc/drivers/Makefile.am | 5 --- libnfc/log-log4c.c | 66 -------------------------------------- libnfc/log.h | 22 ++----------- utils/Makefile.am | 5 --- 9 files changed, 2 insertions(+), 133 deletions(-) delete mode 100644 libnfc/log-log4c.c diff --git a/configure.ac b/configure.ac index d2c5a10..fddb523 100644 --- a/configure.ac +++ b/configure.ac @@ -69,17 +69,6 @@ AC_TYPE_SIGNAL LIBNFC_CFLAGS='-I$(top_srcdir)/libnfc -I$(top_builddir)/include -I$(top_srcdir)/include' AC_SUBST(LIBNFC_CFLAGS) -# Checks for log4c -AC_PATH_PROG([LOG4C_CONFIG], [log4c-config]) -if test x"$LOG4C_CONFIG" != x""; then - log4c_CFLAGS=`$LOG4C_CONFIG --cflags` - log4c_LIBS=`$LOG4C_CONFIG --libs` - AC_SUBST([log4c_CFLAGS]) - AC_SUBST([log4c_LIBS]) - AC_DEFINE([HAS_LOG4C], [1], [Define to 1 if log4c is available.]) -fi -AM_CONDITIONAL(HAS_LOG4C, [test x"$LOG4C_CONFIG" != x""]) - # Debug support (default:no) AC_ARG_ENABLE([debug],AS_HELP_STRING([--enable-debug],[Enable debug output]),[enable_debug=$enableval],[enable_debug="no"]) diff --git a/examples/Makefile.am b/examples/Makefile.am index c0eda51..e0a93ff 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -87,9 +87,4 @@ dist_man_MANS = \ pn53x-sam.1 \ pn53x-tamashell.1 -if HAS_LOG4C - AM_CFLAGS += @log4c_CFLAGS@ - LIBADD = @log4c_LIBS@ -endif - EXTRA_DIST = CMakeLists.txt diff --git a/libnfc/Makefile.am b/libnfc/Makefile.am index a48d818..634a9e9 100644 --- a/libnfc/Makefile.am +++ b/libnfc/Makefile.am @@ -35,22 +35,11 @@ if LIBUSB_ENABLED libnfc_la_LIBADD += @libusb_LIBS@ endif -if HAS_LOG4C - libnfc_la_CFLAGS += @log4c_CFLAGS@ - libnfc_la_LIBADD += @log4c_LIBS@ - - libnfc_la_SOURCES += log-log4c.c -else if WITH_DEBUG - libnfc_la_CFLAGS += @log4c_CFLAGS@ - libnfc_la_LIBADD += @log4c_LIBS@ - libnfc_la_SOURCES += log-printf.c endif -endif EXTRA_DIST = \ CMakeLists.txt \ - log-log4c.c \ log-printf.c diff --git a/libnfc/buses/Makefile.am b/libnfc/buses/Makefile.am index f3475c4..e28ac91 100644 --- a/libnfc/buses/Makefile.am +++ b/libnfc/buses/Makefile.am @@ -9,7 +9,3 @@ libnfcbuses_la_CFLAGS = -I$(top_srcdir)/libnfc EXTRA_DIST = uart_posix.c uart_win32.c -if HAS_LOG4C - libnfcbuses_la_CFLAGS += @log4c_CFLAGS@ - libnfcbuses_la_LIBADD = @log4c_LIBS@ -endif diff --git a/libnfc/chips/Makefile.am b/libnfc/chips/Makefile.am index a8ad491..2359e78 100644 --- a/libnfc/chips/Makefile.am +++ b/libnfc/chips/Makefile.am @@ -7,9 +7,3 @@ noinst_LTLIBRARIES = libnfcchips.la libnfcchips_la_SOURCES = pn53x.c libnfcchips_la_CFLAGS = -I$(top_srcdir)/libnfc - -if HAS_LOG4C - libnfcchips_la_CFLAGS += @log4c_CFLAGS@ - libnfcchips_la_LIBADD = @log4c_LIBS@ -endif - diff --git a/libnfc/drivers/Makefile.am b/libnfc/drivers/Makefile.am index 5ea129e..0ac2250 100644 --- a/libnfc/drivers/Makefile.am +++ b/libnfc/drivers/Makefile.am @@ -34,8 +34,3 @@ if LIBUSB_ENABLED libnfcdrivers_la_LIBADD += @libusb_LIBS@ endif -if HAS_LOG4C - libnfcdrivers_la_CFLAGS += @log4c_CFLAGS@ - libnfcdrivers_la_LIBADD += @log4c_LIBS@ -endif - diff --git a/libnfc/log-log4c.c b/libnfc/log-log4c.c deleted file mode 100644 index ef0cf2e..0000000 --- a/libnfc/log-log4c.c +++ /dev/null @@ -1,66 +0,0 @@ -/*- - * Copyright (C) 2011, Romain Tartière, Romuald Conty - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or (at your - * option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see - */ - -#include "config.h" - -#include -#include - -#include "log.h" - -static uint8_t __log_init_counter = 0; - -int -log_init (void) -{ - int res = 0; - - if (__log_init_counter == 0) { - res = log4c_init (); - } - if (!res) { - __log_init_counter++; - } - return res; -} - -int -log_fini (void) -{ - int res = 0; - if (__log_init_counter >= 1) { - if (__log_init_counter == 1) { - res = log4c_fini (); - } - __log_init_counter--; - } else { - res = -1; - } - return res; -} - -void -log_put (char *category, int priority, char *format, ...) -{ - const log4c_category_t *cat = log4c_category_get (category); - if (log4c_category_is_priority_enabled (cat, priority)) { - va_list va; - va_start (va, format); - log4c_category_vlog (cat, priority, format, va); -// va_end (va); - } -} diff --git a/libnfc/log.h b/libnfc/log.h index 9d8b543..6a41a07 100644 --- a/libnfc/log.h +++ b/libnfc/log.h @@ -22,26 +22,8 @@ # include "config.h" #endif // HAVE_CONFIG_H -#if defined(HAS_LOG4C) && HAS_LOG4C - // log4c have been detected so we use it.. - #include - #define LOGGING 1 - - int log_init (void); - int log_fini (void); - void log_put (char *category, int priority, char *format, ...); - - #define NFC_PRIORITY_FATAL LOG4C_PRIORITY_FATAL - #define NFC_PRIORITY_ALERT LOG4C_PRIORITY_ALERT - #define NFC_PRIORITY_CRIT LOG4C_PRIORITY_CRIT - #define NFC_PRIORITY_ERROR LOG4C_PRIORITY_ERROR - #define NFC_PRIORITY_WARN LOG4C_PRIORITY_WARN - #define NFC_PRIORITY_NOTICE LOG4C_PRIORITY_NOTICE - #define NFC_PRIORITY_INFO LOG4C_PRIORITY_INFO - #define NFC_PRIORITY_DEBUG LOG4C_PRIORITY_DEBUG - #define NFC_PRIORITY_TRACE LOG4C_PRIORITY_TRACE -#elif defined DEBUG - // log4c is not detected but user want debug features +#if defined DEBUG + // User want debug features #define LOGGING 1 int log_init (void); int log_fini (void); diff --git a/utils/Makefile.am b/utils/Makefile.am index 49ec624..78c2dc2 100644 --- a/utils/Makefile.am +++ b/utils/Makefile.am @@ -52,9 +52,4 @@ dist_man_MANS = \ nfc-mfultralight.1 \ nfc-relay-picc.1 -if HAS_LOG4C - AM_CFLAGS += @log4c_CFLAGS@ - LIBADD = @log4c_LIBS@ -endif - EXTRA_DIST = CMakeLists.txt