www.emsdn.com
Class Profile: Home »» Java [Java] under "Java" »»» Intended commits

Intended commits


Hi,
I intend to commit the following patches.
They clean up and extend the logchar configuration.
All configuration of the LG4CXX_LGCHAR_IS_ and
the LGCHAR_IS_WCHAR macros is now done by the
build/configure scripts, so that no dependencies
need to be calculated in the include file.
I think that this is more straightforward and
easier to maintain, especially if new logchar types
like CFSTRING will be added in the future (the patches
already prepare the CFSTRING type).
I have started to summarize the logchar configuration
in the log4cxx wiki:
#preview
Thanks,
Andreas
LGCXX-43:
Index: include/log4cxx/log4cxx.h.in
include/log4cxx/log4cxx.h.in(Revision 332794)
include/log4cxx/log4cxx.h.in(Arbeitskopie)
@@ -24,12 +24,9 @@
*/
+#define LG4CXX_LGCHAR_IS_CFSTRING @LGCHAR_IS_CFSTRING@
#define LG4CXX_LGCHAR_IS_UTF8 @LGCHAR_IS_UTF8@
-#if LG4CXX_LGCHAR_IS_UTF8
-#define LG4CXX_LGCHAR_IS_WCHAR 0
-#else
-#define LG4CXX_LGCHAR_IS_WCHAR 1
-#endif
+#define LG4CXX_LGCHAR_IS_WCHAR @LGCHAR_IS_WCHAR@
#define LG4CXX_HAS_WCHAR_T @HAS_WCHAR_T@
Index: configure.in
configure.in(Revision 332794)
configure.in(Arbeitskopie)
@@ -271,14 +271,6 @@
AC_SUBST(LIBS_XML)
AC_SUBST(CPPFLAGS_XML)
-#for UNICDE
-AC_MSG_CHECKING(for UTF-16 Unicode support)
-AC_ARG_ENABLE(unicode,
- AC_HELP_STRING(, [UTF-16 Unicode support
(default=no)]),
- AC_DEFINE(UNICDE, 1, UTF-16 Unicode support.)
- AC_MSG_RESULT(yes),
- AC_MSG_RESULT(no))
-
#for DBCAppender
AC_MSG_CHECKING(for DBC support)
AC_ARG_WITH(DBC,
@@ -369,6 +361,54 @@
CPPFLAGS="-DLG4CXX $CPPFLAGS"
+#for wchar_t
+AC_MSG_CHECKING([for wchar_t])
+AC_CMPILE_IFELSE(AC_LANG_SURCE(wchar_t* w;), [have_wchar_t=yes],
[have_wchar_t=no])
+AC_MSG_RESULT($have_wchar_t)
+
+if test "$have_wchar_t" = "yes"
+then
+ AC_SUBST(HAS_WCHAR_T, 1)
+else
+ AC_SUBST(HAS_WCHAR_T, 0)
+fi
+
+#determine logchar type
+AC_MSG_CHECKING([logchar type])
+AC_ARG_WITH(logchar,
+ AC_HELP_STRING(, [type for logchar.
+ Accepted TYPE variants: utf-8, wchar_t, cfstring
(default=utf-8)]),
+ [ac_with_logchar=$withval],
+ [ac_with_logchar=utf-8])
+
+case "$ac_with_logchar" in
+ utf-8)
+ AC_MSG_RESULT(utf-8)
+ AC_SUBST(LGCHAR_IS_UTF8, 1)
+ AC_SUBST(LGCHAR_IS_WCHAR, 0)
+ AC_SUBST(LGCHAR_IS_CFSTRING, 0)
+ ;;
+
+ wchar_t)
+ AC_MSG_RESULT(wchar_t)
+ AC_SUBST(LGCHAR_IS_UTF8, 0)
+ AC_SUBST(LGCHAR_IS_WCHAR, 1)
+ AC_SUBST(LGCHAR_IS_CFSTRING, 0)
+ ;;
+
+ cfstring)
+ AC_MSG_RESULT(cfstring)
+ AC_SUBST(LGCHAR_IS_UTF8, 0)
+ AC_SUBST(LGCHAR_IS_WCHAR, 0)
+ AC_SUBST(LGCHAR_IS_CFSTRING, 1)
+ ;;
+
+ *)
+ AC_MSG_RESULT(?)
+ AC_MSG_ERRR(Invalid logchar type: $ac_with_logchar)
+ ;;
+esac
+
# Create files
#
Index: build.xml
build.xml(Revision 332794)
build.xml(Arbeitskopie)
@@ -52,8 +52,7 @@
<property name="optimize" value="none"/>
<property name="lib.type" value="shared"/>
<property name="has.wchar_t" value="1"/>
-<!-- utf-8 will be used if -Dhas.wchar_t=0 or -Dlogchar=utf-8
-<property name="logchar" value="wchar_t"/>
+
<property name="apache.mirror" value="http://apache.mirrors.pair.com"/>
<property name="cppunit.mirror"
value=""/>
@@ -109,6 +108,10 @@
-Doptimize=[speed|size|none]
-Dversion=n.n.n
-Dlib.type=[shared|static]
+-Dapr.dir=PATH
+-Daprutil.dir=PATH
+-Dhas.wchar_t=[0|1] (default=1)
+-Dlogchar=[utf-8|wchar_t|cfstring] (default=wchar_t)
</echo>
</target>
@@ -153,6 +156,10 @@
<property name="project.type" value="msvc6"/>
<property name="project.dir" value="msvc"/>
<property name="compiler" value="msvc"/>
+
+ <!-- Default value for logchar on windows
+ <property name="logchar" value="wchar_t"/>
+
<condition property="is-bcc" value="true">
<or>
<equals arg1="${compiler}" arg2="bcc"/>
@@ -169,6 +176,9 @@
<property name="project.dir" value="xcode"/>
<property name="has-iconv" value="true"/>
+ <!-- Default value for logchar on mac
+ <property name="logchar" value="wchar_t"/>
+
<condition property="" value="true">
<equals arg1="${has.wchar_t}" arg2="1"/>
</condition>
@@ -193,6 +203,10 @@
<property name="project.dir" value="cbx"/>
<property name="compiler" value="g++"/>
<property name="lib-suffix" value=""/>
+
+ <!-- Default value for logchar on Unix
+ <property name="logchar" value="utf-8"/>
+
<condition property="has-expat" value="true">
<not><isset property="is-mac"/></not>
</condition>
@@ -239,13 +253,14 @@
<istrue value="${debug}"/>
</condition>
- <condition property="is-utf8" value="true">
- <or>
- <not><equals arg1="${has.wchar_t}" arg2="1"/></not>
- <equals arg1="${logchar}" arg2="utf-8"/>
- </or>
+ <condition property="logchar_type" value="utf-8">
+ <not><equals arg1="${has.wchar_t}" arg2="1"/></not>
</condition>
+ <condition property="logchar_type" value="${logchar}">
+ <equals arg1="${has.wchar_t}" arg2="1"/>
+ </condition>
+
<condition property="debug.release" value="debug">
<isset property="is-debug"/>
</condition>
@@ -370,23 +385,42 @@
</target>
+<target name="configure" depends="init,
+ unix-configure,
+ win-configure">
+ <echo message="Configuring with has.wchar_t=${has.wchar_t}"/>
+ <echo message="Configuring with logchar_type=${logchar_type}" />
-<target name="configure" depends="unix-configure,
- win-configure">
<condition property="logchar_is_utf8" value="1">
- <isset property="is-utf8"/>
+ <equals arg1="${logchar_type}" arg2="utf-8"/>
</condition>
<property name="logchar_is_utf8" value="0"/>
+ <condition property="logchar_is_cfstring" value="1">
+ <equals arg1="${logchar_type}" arg2="cfstring"/>
+ </condition>
+ <property name="logchar_is_cfstring" value="0"/>
+
+ <condition property="logchar_is_wchar" value="1">
+ <equals arg1="${logchar_type}" arg2="wchar_t"/>
+ </condition>
+ <property name="logchar_is_wchar" value="0"/>
+
<replaceregexp file="${include.dir}/log4cxx/log4cxx.h"
- match="#define LG4CXX_LGCHAR_IS_UTF8.*"
- replace="#define LG4CXX_LGCHAR_IS_UTF8 ${logchar_is_utf8}"/>
+ match="@LGCHAR_IS_CFSTRING@"
+ replace="${logchar_is_cfstring}"/>
<replaceregexp file="${include.dir}/log4cxx/log4cxx.h"
+ match="@LGCHAR_IS_UTF8@"
+ replace="${logchar_is_utf8}"/>
+
+ <replaceregexp file="${include.dir}/log4cxx/log4cxx.h"
+ match="@LGCHAR_IS_WCHAR@"
+ replace="${logchar_is_wchar}"/>
+
+ <replaceregexp file="${include.dir}/log4cxx/log4cxx.h"
match="#define LG4CXX_HAS_WCHAR_T.*"
replace="#define LG4CXX_HAS_WCHAR_T ${has.wchar_t}"/>
-
-
</target>
<target name="get-apr-module">


No. 1# | By Developer Tags User at [2008-5-11] | size: 13 bytes

+1



Java Hot!

Java New!


Copyright © 2008 www.emsdn.com • All rights reserved • CMS Theme by www.emsdn.com - 0.422