Renamed it to '--disable-xlocale' because the original name is misleading
about what the option really is for (it sets locale for X, not locales in
general) and updated its documentation;

Added checks to report incorrect uses to the user;

It is now possible to use '--enable-xlocale' to explicitely request for the
feature, so configure would stop if it were not found.

Signed-off-by: Christophe CURIS <christophe.cu...@free.fr>
---
 configure.ac  | 11 ++---------
 m4/wm_i18n.m4 | 23 +++++++++++++++++++++++
 2 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/configure.ac b/configure.ac
index 53e95b4..fac385a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -451,15 +451,8 @@ AC_SUBST(X_LIBRARY_PATH)
 dnl Decide which locale function to use, setlocale() or _Xsetlocale()
 dnl by MANOME Tomonori 
 dnl ===========================================
-use_locale=yes
-AC_ARG_ENABLE(locale, AS_HELP_STRING([--disable-locale], [disable use of X 
locale support]),
-              use_locale=no)
-
-if test "$use_locale" = yes; then
-       AC_CHECK_LIB(X11, _Xsetlocale,
-               AC_DEFINE(X_LOCALE, 1, [define if you want support for X 
window's X_LOCALE (set by configure)]),,
-               $XLFLAGS $XLIBS)
-fi
+WM_I18N_XLOCALE
+
 
 
 dnl Check whether XInternAtoms() exist
diff --git a/m4/wm_i18n.m4 b/m4/wm_i18n.m4
index 41cb84d..78224b6 100644
--- a/m4/wm_i18n.m4
+++ b/m4/wm_i18n.m4
@@ -135,3 +135,26 @@ AS_IF([test "x$menutextdomain" != "x"],
     [AC_DEFINE_UNQUOTED([MENU_TEXTDOMAIN], ["$menutextdomain"],
         [gettext domain to be used for menu translations]) ])
 ])
+
+
+dnl WM_I18N_XLOCALE
+dnl ---------------
+dnl
+dnl X11 needs to redefine the function 'setlocale' to properly initialize 
itself,
+dnl we check if user wants to disable this behaviour or if it is not supported
+AC_DEFUN_ONCE([WM_I18N_XLOCALE],
+[AC_ARG_ENABLE([xlocale],
+    [AS_HELP_STRING([--disable-xlocale],
+        [disable initialization of locale for X])],
+    [AS_CASE([$enableval],
+        [yes|no], [],
+        [AC_MSG_ERROR([bad value '$enableval' for --disable-xlocale])])],
+    [enable_xlocale=auto])
+AS_IF([test "x$enable_xlocale" != "xno"],
+    [AC_CHECK_LIB([X11], [_Xsetlocale],
+        [AC_DEFINE([X_LOCALE], [1],
+            [defined if the locale is initialized by X window])],
+        [AS_IF([test "x$enable_xlocale" = "xyes"],
+            [AC_MSG_ERROR([support for X_LOCALE was explicitely requested, but 
X11 lacks the appropriate function])])],
+        [$XLFLAGS $XLIBS]) ])
+])
-- 
2.1.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.

Reply via email to