You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4cxx-dev@logging.apache.org by Curt Arnold <ca...@apache.org> on 2005/06/09 19:43:21 UTC

Re: Remaining autoconf patch

On Jun 9, 2005, at 12:17 PM, Andreas Fester wrote:

> Hi Tommi, Curt and Christophe,
>
> Tommi, you once sent a patch for autoconf regarding the UTF8 and WCHAR
> definitions. It has been partly applied some days ago, but the
> definition of the macros is still missing from configure.in:
>
> +AC_MSG_CHECKING([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(LOGCHAR_IS_UTF8, 0)
> +    AC_SUBST(HAS_WCHAR_T, 1)
> +  else
> +    AC_SUBST(LOGCHAR_IS_UTF8, 1)
> +    AC_SUBST(HAS_WCHAR_T, 0)
> +  fi
>
> There was some discussion about this issue three to four weeks
> ago about the dependency between LOGCHAR_IS_UTF8 and HAS_WCHAR_T.
>
> Christophe, you talked about an improved patch - did you make any
> progress yet? Did you intend to simply add a configure option
> like --with-utf8 or is there some other "magic" which can  
> automatically
> determine whether or not to use utf8?
>
> I am no ant expert, but if I interpret the build.xml correctly
> it sets
>
> 1) has.wchar_t to 0 if the platform supports wchar_t, to 1 otherwise

Vice-versa, has.wchar_t = 1 if platform supports wchar_t.  If set 0,  
no wchar_t API methods are compiled and mbstowcs et al cannot be used  
for converting from default char encoding
>
> 2) utf-8 to 1 if has.wchar_t is 0 *or* utf-8 is explicitly requested
>    during configuration (would then be something like
>    "configure --with-utf8"),
>    otherwise utf-8 is set to 0.

Using utf-8 is likely the best default for 'nix.  So I would  
recommend a switch to indicate that wchar_t should be used as  
logchar.  Most 'nix should have wchar_t types but use UTF-8 as logchar.