drop log4c support

This commit is contained in:
Romuald Conty 2012-01-06 13:05:10 +00:00
parent b41edfb0b4
commit 48e92149e4
9 changed files with 2 additions and 133 deletions

View file

@ -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"])

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -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 <http://www.gnu.org/licenses/>
*/
#include "config.h"
#include <fcntl.h>
#include <log4c.h>
#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);
}
}

View file

@ -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 <log4c.h>
#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);

View file

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