Hi,
attached is a proposal for an enhanced automake configuration regarding
logchar. I added the following changes:
- removed check for UNICODE (--enable-unicode,
[UTF-16 Unicode support (default=no)]),
because the UNICODE define is not used anywhere. Please
correct me if this assumption is wrong.
- Modified checking for wchar_t.
The configure scripts only sets the value of HAS_WCHAR_T depending
on whether wchar_t was found or not.
- Added new option --with-logchar=TYPE
TYPE can be UTF8, WCHAR or CFSTRING. Default is UTF8.
The following #defines are set in log4cxx.h,
according to the choosen type:
LOG4CXX_LOGCHAR_IS_UTF8
LOG4CXX_LOGCHAR_IS_WCHAR
LOG4CXX_LOGCHAR_IS_CFSTRING
Only one of these #defines is set to 1, the others are set to 0.
Setting of LOG4CXX_LOGCHAR_IS_WCHAR depending on the setting of
LOG4CXX_LOGCHAR_IS_UTF8 in log4cxx.h has been removed, IHMO its
more straighforward (and easier to extend) to let the configure
script (or build.xml) set exactly one of these values to 1.
- I am not sure whether there is a dependency between the
existence of wchar_t and the logchar type; it is currently assumed
that they are independant (wchar_t defines if the API contains
wchar_t / wstring methods or not, the logchar type defines which
type to use for logstring).
Regards,
Andreas
--
Andreas Fester
mailto:[EMAIL PROTECTED]
WWW: http://littletux.homelinux.org
ICQ: 326674288
Index: configure.in
===================================================================
RCS file: /home/cvspublic/logging-log4cxx/configure.in,v
retrieving revision 1.54
diff -u -r1.54 configure.in
--- configure.in 3 Jun 2005 05:20:30 -0000 1.54
+++ configure.in 14 Jun 2005 17:01:40 -0000
@@ -271,14 +271,6 @@
AC_SUBST(LIBS_XML)
AC_SUBST(CPPFLAGS_XML)
-#for UNICODE
-AC_MSG_CHECKING(for UTF-16 Unicode support)
-AC_ARG_ENABLE(unicode,
- AC_HELP_STRING(--enable-unicode, [UTF-16 Unicode support
(default=no)]),
- AC_DEFINE(UNICODE, 1, UTF-16 Unicode support.)
- AC_MSG_RESULT(yes),
- AC_MSG_RESULT(no))
-
#for ODBCAppender
AC_MSG_CHECKING(for ODBC support)
AC_ARG_WITH(ODBC,
@@ -369,6 +361,54 @@
CPPFLAGS="-DLOG4CXX $CPPFLAGS"
+#for wchar_t
+AC_MSG_CHECKING([for wchar_t])
+AC_COMPILE_IFELSE(AC_LANG_SOURCE(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(--with-logchar=TYPE, [type for logchar.
+ Accepted TYPE variants: UTF8, WCHAR, CFSTRING (default=UTF8)]),
+ [ac_with_logchar=$withval],
+ [ac_with_logchar=UTF8])
+
+case "$ac_with_logchar" in
+ UTF8)
+ AC_MSG_RESULT(UTF8)
+ AC_SUBST(LOGCHAR_IS_UTF8, 1)
+ AC_SUBST(LOGCHAR_IS_WCHAR, 0)
+ AC_SUBST(LOGCHAR_IS_CFSTRING, 0)
+ ;;
+
+ WCHAR)
+ AC_MSG_RESULT(WCHAR)
+ AC_SUBST(LOGCHAR_IS_UTF8, 0)
+ AC_SUBST(LOGCHAR_IS_WCHAR, 1)
+ AC_SUBST(LOGCHAR_IS_CFSTRING, 0)
+ ;;
+
+ CFSTRING)
+ AC_MSG_RESULT(CFSTRING)
+ AC_SUBST(LOGCHAR_IS_UTF8, 0)
+ AC_SUBST(LOGCHAR_IS_WCHAR, 0)
+ AC_SUBST(LOGCHAR_IS_CFSTRING, 1)
+ ;;
+
+ *)
+ AC_MSG_RESULT(???)
+ AC_MSG_ERROR(Invalid logchar type: $ac_with_logchar)
+ ;;
+esac
+
# Create files
# ----------------------------------------------------------------------------
Index: include/log4cxx/log4cxx.h.in
===================================================================
RCS file: /home/cvspublic/logging-log4cxx/include/log4cxx/log4cxx.h.in,v
retrieving revision 1.2
diff -u -r1.2 log4cxx.h.in
--- include/log4cxx/log4cxx.h.in 13 Jun 2005 22:00:04 -0000 1.2
+++ include/log4cxx/log4cxx.h.in 14 Jun 2005 17:01:40 -0000
@@ -24,12 +24,9 @@
*/
+#define LOG4CXX_LOGCHAR_IS_CFSTRING @LOGCHAR_IS_CFSTRING@
#define LOG4CXX_LOGCHAR_IS_UTF8 @LOGCHAR_IS_UTF8@
-#if LOG4CXX_LOGCHAR_IS_UTF8
-#define LOG4CXX_LOGCHAR_IS_WCHAR 0
-#else
-#define LOG4CXX_LOGCHAR_IS_WCHAR 1
-#endif
+#define LOG4CXX_LOGCHAR_IS_WCHAR @LOGCHAR_IS_WCHAR@
#define LOG4CXX_HAS_WCHAR_T @HAS_WCHAR_T@