eliot-dev
[Top][All Lists]
Advanced

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

[Eliot-dev] eliot configure.in dic/Makefile.am dic/compdic....


From: Olivier Teulière
Subject: [Eliot-dev] eliot configure.in dic/Makefile.am dic/compdic....
Date: Sun, 16 Jan 2011 21:30:32 +0000

CVSROOT:        /cvsroot/eliot
Module name:    eliot
Changes by:     Olivier Teulière <ipkiss>       11/01/16 21:30:31

Modified files:
        .              : configure.in 
        dic            : Makefile.am compdic.cpp compdic.h 
        game           : Makefile.am 
        qt             : Makefile.am 
        utils          : Makefile.am 
Added files:
        dic            : logging.h 

Log message:
        Added a new (optional) dependency on log4cxx, to enable logging.
        If disabled (the default), everything is compiled away.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/eliot/configure.in?cvsroot=eliot&r1=1.48&r2=1.49
http://cvs.savannah.gnu.org/viewcvs/eliot/dic/Makefile.am?cvsroot=eliot&r1=1.24&r2=1.25
http://cvs.savannah.gnu.org/viewcvs/eliot/dic/compdic.cpp?cvsroot=eliot&r1=1.21&r2=1.22
http://cvs.savannah.gnu.org/viewcvs/eliot/dic/compdic.h?cvsroot=eliot&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/eliot/dic/logging.h?cvsroot=eliot&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/eliot/game/Makefile.am?cvsroot=eliot&r1=1.27&r2=1.28
http://cvs.savannah.gnu.org/viewcvs/eliot/qt/Makefile.am?cvsroot=eliot&r1=1.23&r2=1.24
http://cvs.savannah.gnu.org/viewcvs/eliot/utils/Makefile.am?cvsroot=eliot&r1=1.14&r2=1.15

Patches:
Index: configure.in
===================================================================
RCS file: /cvsroot/eliot/eliot/configure.in,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -b -r1.48 -r1.49
--- configure.in        17 Oct 2010 21:23:39 -0000      1.48
+++ configure.in        16 Jan 2011 21:30:30 -0000      1.49
@@ -50,6 +50,14 @@
     CXXFLAGS+=" -Wextra"
 fi
 
+dnl Logging
+AC_ARG_ENABLE([logging],AC_HELP_STRING([--enable-logging],[logging (default 
disabled)]))
+if test "${enable_logging}" = "yes"; then
+    want_logging=1
+else
+    want_logging=0
+fi
+
 dnl Debug mode
 AC_ARG_ENABLE([debug],AC_HELP_STRING([--enable-debug],[debug mode (default 
disabled)]))
 if test "${enable_debug}" = "yes"; then
@@ -116,6 +124,19 @@
                    AC_DEFINE(HAVE_LIBCONFIG, 1, [Define to 1 if you have the 
libconfig library])],
                   [has_libconfig=0])
 
+dnl Check for liblog4cxx
+PKG_CHECK_MODULES(LOG4CXX, [liblog4cxx],
+                  [has_log4cxx=1
+                   AC_DEFINE(HAVE_LIBLOG4CXX, 1, [Define to 1 if you have the 
liblog4cxx library])],
+                  [has_log4cxx=0])
+AS_IF([test "${want_logging}" = "1"],
+      [AS_IF([test "${has_log4cxx}" = "1"],
+             [with_logging=1
+              AC_DEFINE(USE_LOGGING, 1, [Define to 1 if you want to enable 
logging])],
+             [AC_MSG_ERROR([Logging requested, but liblog4cxx could not be 
found on your system (using pkg-config)])])])
+# Conditional, to avoid a useless dependency (in the case of shared library)
+AM_CONDITIONAL([WITH_LOGGING], [test "${with_logging}" = "1"])
+
 dnl Check for Expat
 AX_LIB_EXPAT([2.0.1])
 

Index: dic/Makefile.am
===================================================================
RCS file: /cvsroot/eliot/eliot/dic/Makefile.am,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- dic/Makefile.am     17 Oct 2010 21:23:40 -0000      1.24
+++ dic/Makefile.am     16 Jan 2011 21:30:31 -0000      1.25
@@ -20,9 +20,10 @@
 noinst_LIBRARIES = libdic.a
 
 localedir = $(datadir)/locale
-AM_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\" -I$(top_srcdir) -I../intl 
-I$(top_srcdir)/intl $(INCICONV)
+AM_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\" -I$(top_srcdir) -I../intl 
-I$(top_srcdir)/intl $(INCICONV) @LOG4CXX_CFLAGS@
 
 libdic_a_SOURCES = \
+       logging.h \
        base_exception.cpp base_exception.h \
        dic_exception.cpp dic_exception.h \
        header.cpp header.h \
@@ -57,5 +58,11 @@
 regexp_SOURCES=regexpmain.cpp
 regexp_LDADD=libdic.a @LIBINTL@
 
+if WITH_LOGGING
+compdic_LDADD += @LOG4CXX_LIBS@
+listdic_LDADD += @LOG4CXX_LIBS@
+regexp_LDADD += @LOG4CXX_LIBS@
+endif
+
 endif
 

Index: dic/compdic.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/dic/compdic.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- dic/compdic.cpp     10 Sep 2010 18:36:36 -0000      1.21
+++ dic/compdic.cpp     16 Jan 2011 21:30:31 -0000      1.22
@@ -65,6 +65,8 @@
 #define fmt(a) boost::format(a)
 
 
+INIT_LOGGER(CompDic::logger, "Compdic");
+
 CompDic::CompDic()
     : m_currentRec(0), m_maxRec(0), m_loadTime(0), m_buildTime(0)
 {
@@ -184,15 +186,8 @@
         ioEdges[i] = htonl(ioEdges[i]);
     }
 
-#ifdef DEBUG_OUTPUT
-    cout << fmt(_("writing %1% edges")) % num << endl;
-    for (int i = 0; i < num; i++)
-    {
-        outFile.write((char*)(ioEdges + i), sizeof(DicEdge));
-    }
-#else
+    LOG_TRACE(logger, fmt("writing %1% edges") % num);
     outFile.write((char*)ioEdges, num * sizeof(DicEdge));
-#endif
 }
 
 #define MAX_EDGES 2000

Index: dic/compdic.h
===================================================================
RCS file: /cvsroot/eliot/eliot/dic/compdic.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- dic/compdic.h       16 May 2010 10:06:01 -0000      1.2
+++ dic/compdic.h       16 Jan 2011 21:30:31 -0000      1.3
@@ -26,6 +26,7 @@
 #include <iosfwd>
 #include <boost/unordered_map.hpp>
 
+#include "logging.h"
 #include "header.h"
 #include "dic_internals.h"
 
@@ -41,6 +42,7 @@
 
 class CompDic
 {
+    DEFINE_LOGGER(logger);
     typedef boost::unordered_map<vector<DicEdge>, unsigned int> HashMap;
 
 public:

Index: game/Makefile.am
===================================================================
RCS file: /cvsroot/eliot/eliot/game/Makefile.am,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- game/Makefile.am    6 Dec 2009 00:07:35 -0000       1.27
+++ game/Makefile.am    16 Jan 2011 21:30:31 -0000      1.28
@@ -19,7 +19,7 @@
 
 noinst_LIBRARIES = libgame.a
 
-AM_CPPFLAGS = -I$(top_srcdir)/dic -I../intl -I$(top_srcdir)/intl 
@LIBCONFIG_CFLAGS@ @ARABICA_CFLAGS@ @EXPAT_CFLAGS@
+AM_CPPFLAGS = -I$(top_srcdir)/dic -I../intl -I$(top_srcdir)/intl 
@LIBCONFIG_CFLAGS@ @ARABICA_CFLAGS@ @EXPAT_CFLAGS@ @LOG4CXX_CFLAGS@
 
 libgame_a_SOURCES= \
     game_exception.cpp game_exception.h \

Index: qt/Makefile.am
===================================================================
RCS file: /cvsroot/eliot/eliot/qt/Makefile.am,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- qt/Makefile.am      1 Nov 2010 17:49:55 -0000       1.23
+++ qt/Makefile.am      16 Jan 2011 21:30:31 -0000      1.24
@@ -20,7 +20,7 @@
 
 if BUILD_QT
 
-AM_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\" @QT_CFLAGS@ 
-DQT4LOCALEDIR=\"@address@hidden" -I$(top_srcdir) -I../intl -I$(top_srcdir)/dic 
-I$(top_srcdir)/game
+AM_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\" @QT_CFLAGS@ 
-DQT4LOCALEDIR=\"@address@hidden" -I$(top_srcdir) -I../intl -I$(top_srcdir)/dic 
-I$(top_srcdir)/game @LOG4CXX_CFLAGS@
 
 SUFFIXES=.ui.h .moc.cpp
 
@@ -113,6 +113,10 @@
 # Needed for proper stack trace handling
 eliot_LDFLAGS = -rdynamic
 
+if WITH_LOGGING
+eliot_LDADD += @LOG4CXX_LIBS@
+endif
+
 # Generate a cpp file from the resources
 resources.cpp: eliot.qrc $(RESOURCES)
        $(RCC) -o $@ $<

Index: utils/Makefile.am
===================================================================
RCS file: /cvsroot/eliot/eliot/utils/Makefile.am,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- utils/Makefile.am   6 Dec 2009 00:07:36 -0000       1.14
+++ utils/Makefile.am   16 Jan 2011 21:30:31 -0000      1.15
@@ -17,7 +17,7 @@
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 localedir = $(datadir)/locale
-AM_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\" -I$(top_srcdir)/dic 
-I$(top_srcdir)/game -I../intl -I$(top_srcdir)/intl
+AM_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\" -I$(top_srcdir)/dic 
-I$(top_srcdir)/game -I../intl -I$(top_srcdir)/intl @LOG4CXX_CFLAGS@
 
 noinst_PROGRAMS =
 bin_PROGRAMS =
@@ -30,11 +30,18 @@
 if HAS_READLINE
 eliottxt_LDADD += -lreadline
 endif
+if WITH_LOGGING
+eliottxt_LDADD += @LOG4CXX_LIBS@
+endif
 endif
 
 if BUILD_NCURSES
 bin_PROGRAMS += eliotcurses
 eliotcurses_SOURCES = ncurses.cpp ncurses.h
 eliotcurses_LDADD = ../game/libgame.a ../dic/libdic.a -lncursesw @LIBINTL@ 
@LIBCONFIG_LIBS@ @ARABICA_LIBS@ @EXPAT_LDFLAGS@
+if WITH_LOGGING
+eliotcurses_LDADD += @LOG4CXX_LIBS@
+endif
+
 endif
 

Index: dic/logging.h
===================================================================
RCS file: dic/logging.h
diff -N dic/logging.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ dic/logging.h       16 Jan 2011 21:30:31 -0000      1.1
@@ -0,0 +1,51 @@
+/*****************************************************************************
+ * Eliot
+ * Copyright (C) 2011 Olivier Teulière
+ * Authors: Olivier Teulière <ipkiss @@ gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 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 General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *****************************************************************************/
+
+#ifndef DIC_LOGGING_H_
+#define DIC_LOGGING_H_
+
+#include <config.h>
+
+#ifdef USE_LOGGING
+#   include <log4cxx/logger.h>
+
+#   define DEFINE_LOGGER(logger) static log4cxx::LoggerPtr logger;
+#   define INIT_LOGGER(logger, name) log4cxx::LoggerPtr 
logger(log4cxx::Logger::getLogger(name))
+
+#   define LOG_TRACE(a, b) LOG4CXX_TRACE(a, b)
+#   define LOG_DEBUG(a, b) LOG4CXX_DEBUG(a, b)
+#   define LOG_INFO(a, b) LOG4CXX_INFO(a, b)
+#   define LOG_WARN(a, b) LOG4CXX_WARN(a, b)
+#   define LOG_ERROR(a, b) LOG4CXX_ERROR(a, b)
+#   define LOG_FATAL(a, b) LOG4CXX_FATAL(a, b)
+#else
+#   define DEFINE_LOGGER(logger)
+#   define INIT_LOGGER(logger, name)
+
+#   define LOG_TRACE(a, b)
+#   define LOG_DEBUG(a, b)
+#   define LOG_INFO(a, b)
+#   define LOG_WARN(a, b)
+#   define LOG_ERROR(a, b)
+#   define LOG_FATAL(a, b)
+#endif // USE_LOGGING
+
+#endif
+



reply via email to

[Prev in Thread] Current Thread [Next in Thread]