carnold 2005/03/16 11:07:21
Modified: . build.xml
include/log4cxx portability.h
include/log4cxx/spi configurator.h
src configurator.cpp
Log:
LOGCXX-77: static builds broken (windows iter)
Revision Changes Path
1.58 +5 -6 logging-log4cxx/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/logging-log4cxx/build.xml,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -r1.57 -r1.58
--- build.xml 16 Mar 2005 17:11:20 -0000 1.57
+++ build.xml 16 Mar 2005 19:07:21 -0000 1.58
@@ -169,9 +169,6 @@
<condition property="is-mingw" value="true">
<isset property="is-gcc"/>
</condition>
- <condition property="is-win-static" value="true">
- <equals arg1="${lib.type}" arg2="static"/>
- </condition>
</target>
<target name="mac-init" depends="os-detect" if="is-mac">
@@ -196,9 +193,6 @@
<condition property="is-cygwin" value="true">
<os family="windows"/>
</condition>
- <condition property="is-unix-static" value="true">
- <equals arg1="${lib.type}" arg2="static"/>
- </condition>
</target>
@@ -661,6 +655,7 @@
<includepath path="${apriconv.include.dir}"/>
<defineset define="_USRDLL DLL_EXPORTS" if="is-windows"/>
<defineset define="LOG4CXX"/>
+ <defineset define="LOG4CXX_STATIC" if="is-static"/>
<defineset define="APR_DECLARE_STATIC" if="apr-static"/>
<defineset define="API_DECLARE_STATIC" if="apriconv-static"/>
<defineset define="APU_DECLARE_STATIC" if="aprutil-static"/>
@@ -698,6 +693,7 @@
<includepath path="${apr.include.dir}"/>
<defineset define="WIN32" if="is-windows"/>
+ <defineset define="LOG4CXX_STATIC" if="is-static"/>
<defineset define="APR_DECLARE_STATIC" if="apr-static"/>
<defineset define="APU_DECLARE_STATIC" if="aprutil-static"/>
<defineset define="API_DECLARE_STATIC" if="apriconv-static"/>
@@ -801,6 +797,7 @@
<includepath path="${include.dir}"/>
<includepath path="${apr.include.dir}"/>
<compilerarg value="${pic-option}" if="pic-option"/>
+ <defineset define="LOG4CXX_STATIC" if="is-static"/>
<defineset if="is-utf8">
<define name="LOG4CXX_LOGCHAR_IS_UTF8" value="1"/>
</defineset>
@@ -837,6 +834,7 @@
<includepath path="${apr.include.dir}"/>
<includepath path="${aprutil.include.dir}"/>
<includepath path="${apriconv.include.dir}"/>
+ <defineset define="LOG4CXX_STATIC" if="is-static"/>
<defineset define="APR_DECLARE_STATIC" if="apr-static"/>
<defineset define="API_DECLARE_STATIC" if="apriconv-static"/>
<defineset define="APU_DECLARE_STATIC" if="aprutil-static"/>
@@ -882,6 +880,7 @@
<includepath path="${apr.include.dir}"/>
<includepath path="${aprutil.include.dir}"/>
<includepath path="${apriconv.include.dir}"/>
+ <defineset define="LOG4CXX"/>
<defineset define="APR_DECLARE_STATIC" if="apr-static"/>
<defineset define="API_DECLARE_STATIC" if="apriconv-static"/>
<defineset define="APU_DECLARE_STATIC" if="aprutil-static"/>
1.15 +0 -5 logging-log4cxx/include/log4cxx/portability.h
Index: portability.h
===================================================================
RCS file: /home/cvs/logging-log4cxx/include/log4cxx/portability.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- portability.h 13 Mar 2005 06:52:45 -0000 1.14
+++ portability.h 16 Mar 2005 19:07:21 -0000 1.15
@@ -34,11 +34,6 @@
#if defined(_MSC_VER)
#pragma warning(disable : 4250 4251 4786 4290)
-#ifdef LOG4CXX_STATIC
-// cf. file msvc/static/static.cpp
-#pragma comment(linker, "/include:?ForceSymbolReferences@@YAXXZ")
-#endif
-
#if defined(_MSC_VER) && _MSC_VER >= 1200
typedef __int64 log4cxx_int64_t;
1.13 +9 -2 logging-log4cxx/include/log4cxx/spi/configurator.h
Index: configurator.h
===================================================================
RCS file: /home/cvs/logging-log4cxx/include/log4cxx/spi/configurator.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- configurator.h 15 Feb 2005 23:56:00 -0000 1.12
+++ configurator.h 16 Mar 2005 19:07:21 -0000 1.13
@@ -36,7 +36,8 @@
class LOG4CXX_EXPORT Configurator : virtual public helpers::Object
{
public:
- DECLARE_ABSTRACT_LOG4CXX_OBJECT(Configurator)
+ DECLARE_ABSTRACT_LOG4CXX_OBJECT(Configurator)
+ Configurator();
/**
Interpret a resource pointed by a URL and set up log4j accordingly.
@@ -48,7 +49,13 @@
@param repository The hierarchy to operation upon.
*/
virtual void doConfigure(const File& configFileName,
- spi::LoggerRepositoryPtr& repository) = 0;
+ spi::LoggerRepositoryPtr& repository) = 0;
+
+
+ private:
+ Configurator(const Configurator&);
+ Configurator& operator=(const Configurator&);
+ bool initialized;
};
typedef helpers::ObjectPtrT<Configurator> ConfiguratorPtr;
1.5 +83 -1 logging-log4cxx/src/configurator.cpp
Index: configurator.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/src/configurator.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- configurator.cpp 21 Oct 2004 04:53:44 -0000 1.4
+++ configurator.cpp 16 Mar 2005 19:07:21 -0000 1.5
@@ -14,10 +14,92 @@
* limitations under the License.
*/
-#include <log4cxx/spi/configurator.h>
+#include <log4cxx/spi/configurator.h>
+#include <assert.h>
using namespace log4cxx;
using namespace log4cxx::spi;
IMPLEMENT_LOG4CXX_OBJECT(Configurator);
+
+
+
+
+#define REFERENCE_LOG4CXX_OBJECT(object) \
+namespace log4cxx { namespace classes { extern bool object##IsRegistered; } }
+
+#define STATUS_LOG4CXX_OBJECT(object) \
+log4cxx::classes::object##IsRegistered
+
+//
+// force all common Appenders and Layouts to be referenced here
+// so that a static link including a configurator is
+// required to pull them in
+//
+REFERENCE_LOG4CXX_OBJECT(AsyncAppender)
+REFERENCE_LOG4CXX_OBJECT(ConsoleAppender)
+REFERENCE_LOG4CXX_OBJECT(FileAppender)
+#ifdef LOG4CXX_HAVE_ODBC
+REFERENCE_LOG4CXX_OBJECT(ODBCAppender)
+#endif
+#if defined(WIN32) || defined(_WIN32)
+REFERENCE_LOG4CXX_OBJECT(NTEventLogAppender)
+REFERENCE_LOG4CXX_OBJECT(OutputDebugStringAppender)
+#endif
+REFERENCE_LOG4CXX_OBJECT(RollingFileAppender)
+#ifdef LOG4CXX_HAVE_SMTP
+REFERENCE_LOG4CXX_OBJECT(SMTPAppender)
+#endif
+REFERENCE_LOG4CXX_OBJECT(SocketAppender)
+REFERENCE_LOG4CXX_OBJECT(SocketHubAppender)
+REFERENCE_LOG4CXX_OBJECT(SyslogAppender)
+REFERENCE_LOG4CXX_OBJECT(TelnetAppender)
+REFERENCE_LOG4CXX_OBJECT(WriterAppender)
+REFERENCE_LOG4CXX_OBJECT(XMLSocketAppender)
+//REFERENCE_LOG4CXX_OBJECT(DateLayout)
+REFERENCE_LOG4CXX_OBJECT(HTMLLayout)
+REFERENCE_LOG4CXX_OBJECT(Layout)
+REFERENCE_LOG4CXX_OBJECT(PatternLayout)
+REFERENCE_LOG4CXX_OBJECT(SimpleLayout)
+REFERENCE_LOG4CXX_OBJECT(TTCCLayout)
+REFERENCE_LOG4CXX_OBJECT(XMLLayout)
+REFERENCE_LOG4CXX_OBJECT(LevelMatchFilter)
+REFERENCE_LOG4CXX_OBJECT(LevelRangeFilter)
+REFERENCE_LOG4CXX_OBJECT(StringMatchFilter)
+
+
+
+Configurator::Configurator() {
+ initialized =
+ STATUS_LOG4CXX_OBJECT(AsyncAppender) &&
+ STATUS_LOG4CXX_OBJECT(ConsoleAppender) &&
+ STATUS_LOG4CXX_OBJECT(FileAppender) &&
+#ifdef LOG4CXX_HAVE_ODBC
+ STATUS_LOG4CXX_OBJECT(ODBCAppender) &&
+#endif
+#if defined(WIN32) || defined(_WIN32)
+ STATUS_LOG4CXX_OBJECT(NTEventLogAppender) &&
+ STATUS_LOG4CXX_OBJECT(OutputDebugStringAppender) &&
+#endif
+ STATUS_LOG4CXX_OBJECT(RollingFileAppender) &&
+#ifdef LOG4CXX_HAVE_SMTP
+ STATUS_LOG4CXX_OBJECT(SMTPAppender) &&
+#endif
+ STATUS_LOG4CXX_OBJECT(SocketAppender) &&
+ STATUS_LOG4CXX_OBJECT(SocketHubAppender) &&
+ STATUS_LOG4CXX_OBJECT(SyslogAppender) &&
+ STATUS_LOG4CXX_OBJECT(TelnetAppender) &&
+ STATUS_LOG4CXX_OBJECT(WriterAppender) &&
+ STATUS_LOG4CXX_OBJECT(XMLSocketAppender) &&
+ // STATUS_LOG4CXX_OBJECT(DateLayout) &&
+ STATUS_LOG4CXX_OBJECT(HTMLLayout) &&
+ STATUS_LOG4CXX_OBJECT(Layout) &&
+ STATUS_LOG4CXX_OBJECT(PatternLayout) &&
+ STATUS_LOG4CXX_OBJECT(SimpleLayout) &&
+ STATUS_LOG4CXX_OBJECT(TTCCLayout) &&
+ STATUS_LOG4CXX_OBJECT(XMLLayout) &&
+ STATUS_LOG4CXX_OBJECT(LevelMatchFilter) &&
+ STATUS_LOG4CXX_OBJECT(LevelRangeFilter) &&
+ STATUS_LOG4CXX_OBJECT(StringMatchFilter);
+}
\ No newline at end of file