The main change is to use Autoconf's syntax for consistency;

Now the detected program is used in the makefiles (user has the possibility
to change the name of the command);

A conditional is used to avoid enabling make targets that would fail if
the command does not exist.

Took opportunity to implement the silent-rules compliance to POT generation
rules.

Signed-off-by: Christophe CURIS <[email protected]>
---
 WINGs/po/Makefile.am      | 10 +++++++---
 WPrefs.app/po/Makefile.am |  9 ++++++---
 configure.ac              | 10 +---------
 m4/wm_i18n.m4             | 16 ++++++++++++++++
 po/Makefile.am            | 10 +++++++---
 util/po/Makefile.am       |  9 ++++++---
 6 files changed, 43 insertions(+), 21 deletions(-)

diff --git a/WINGs/po/Makefile.am b/WINGs/po/Makefile.am
index 857730d..3c0a248 100644
--- a/WINGs/po/Makefile.am
+++ b/WINGs/po/Makefile.am
@@ -79,14 +79,18 @@ SUFFIXES = .po .mo
 
 all-local: $(CATALOGS)
 
+
+if HAVE_XGETTEXT
 $(DOMAIN).pot: $(POTFILES)
-       xgettext --default-domain=$(DOMAIN) \
-       --add-comments --keyword=_ --keyword=N_ $(POTFILES)
-       if cmp -s $(DOMAIN).po $(DOMAIN).pot; then \
+       $(AM_V_GEN)$(XGETTEXT) --default-domain=$(DOMAIN) \
+           --add-comments --keyword=_ --keyword=N_ $(POTFILES)
+       @if cmp -s $(DOMAIN).po $(DOMAIN).pot; then \
            rm -f $(DOMAIN).po; \
        else \
            mv -f $(DOMAIN).po $(DOMAIN).pot; \
        fi
+endif
+
 
 install-data-local:  $(CATALOGS)
        $(mkinstalldirs) $(DESTDIR)$(nlsdir)
diff --git a/WPrefs.app/po/Makefile.am b/WPrefs.app/po/Makefile.am
index 21c23d3..2f9401d 100644
--- a/WPrefs.app/po/Makefile.am
+++ b/WPrefs.app/po/Makefile.am
@@ -45,14 +45,17 @@ SUFFIXES = .po .mo
 
 all-local: $(CATALOGS)
 
+
+if HAVE_XGETTEXT
 $(DOMAIN).pot: $(POTFILES)
-       xgettext --default-domain=$(DOMAIN) \
-       --add-comments --keyword=_ --keyword=N_ $(POTFILES)
-       if cmp -s $(DOMAIN).po $(DOMAIN).pot; then \
+       $(AM_V_GEN)$(XGETTEXT) --default-domain=$(DOMAIN) \
+           --add-comments --keyword=_ --keyword=N_ $(POTFILES)
+       @if cmp -s $(DOMAIN).po $(DOMAIN).pot; then \
            rm -f $(DOMAIN).po; \
        else \
            mv -f $(DOMAIN).po $(DOMAIN).pot; \
        fi
+endif
 
 
 install-data-local:  $(CATALOGS)
diff --git a/configure.ac b/configure.ac
index 95500ab..d1161b5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -417,17 +417,9 @@ dnl ====================
 dnl Detect the language for translations to be installed and check
 dnl that the gettext environment works
 WM_I18N_LANGUAGES
+WM_I18N_XGETTEXT
 
 
-AC_CHECK_PROG(XGETTEXT, xgettext, xgettext)
-
-if test "$XGETTEXT" != ""; then 
-    if $XGETTEXT --help 2>&1 | grep illegal >/dev/null ; then
-        echo "xgettext isn't GNU version"
-        XGETTEXT=""
-    fi
-fi
-
 dnl Added by Oliver - Support for NLSDIR option
 dnl ===========================================
 AC_ARG_WITH(nlsdir, AS_HELP_STRING([--with-nlsdir=PATH], [specify where the 
locale stuff should go]))
diff --git a/m4/wm_i18n.m4 b/m4/wm_i18n.m4
index 7059c4a..7a6340e 100644
--- a/m4/wm_i18n.m4
+++ b/m4/wm_i18n.m4
@@ -92,3 +92,19 @@ AC_SUBST([WMAKERMOFILES])dnl
 AC_SUBST([WPREFSMOFILES])dnl
 AC_SUBST([UTILMOFILES])dnl
 ])
+
+
+# WM_I18N_XGETTEXT
+# ----------------
+#
+# xgettext is used to generate the Templates for translation, it is not
+# mandatory for users, only for translation teams. We look for it even
+# if I18N was not asked because it can be used by dev team.
+AC_DEFUN_ONCE([WM_I18N_XGETTEXT],
+[AC_CHECK_PROGS([XGETTEXT], [xgettext], [])
+AS_IF([test "x$XGETTEXT" != "x"],
+    AS_IF([$XGETTEXT --help 2>&1 | grep "illegal" > /dev/null],
+        [AC_MSG_WARN([[$XGETTEXT is not GNU version, ignoring]])
+         XGETTEXT=""]))
+AM_CONDITIONAL([HAVE_XGETTEXT], [test "x$XGETTEXT" != "x"])dnl
+])
diff --git a/po/Makefile.am b/po/Makefile.am
index f8d4e84..55756fb 100644
--- a/po/Makefile.am
+++ b/po/Makefile.am
@@ -74,14 +74,18 @@ SUFFIXES = .po .mo
 
 all-local: $(CATALOGS)
 
+
+if HAVE_XGETTEXT
 $(DOMAIN).pot: $(POTFILES)
-       xgettext --default-domain=$(DOMAIN) \
-       --add-comments --keyword=_ --keyword=N_ $(POTFILES)
-       if cmp -s $(DOMAIN).po $(DOMAIN).pot; then \
+       $(AM_V_GEN)$(XGETTEXT) --default-domain=$(DOMAIN) \
+           --add-comments --keyword=_ --keyword=N_ $(POTFILES)
+       @if cmp -s $(DOMAIN).po $(DOMAIN).pot; then \
            rm -f $(DOMAIN).po; \
        else \
            mv -f $(DOMAIN).po $(DOMAIN).pot; \
        fi
+endif
+
 
 install-data-local:  $(CATALOGS)
        $(mkinstalldirs) $(DESTDIR)$(nlsdir)
diff --git a/util/po/Makefile.am b/util/po/Makefile.am
index d1b113c..53d895b 100644
--- a/util/po/Makefile.am
+++ b/util/po/Makefile.am
@@ -20,14 +20,17 @@ SUFFIXES = .po .mo
 
 all-local: $(CATALOGS)
 
+
+if HAVE_XGETTEXT
 $(DOMAIN).pot: $(POTFILES)
-       xgettext --default-domain=$(DOMAIN) \
-       --add-comments --keyword=_ --keyword=N_ $(POTFILES)
-       if cmp -s $(DOMAIN).po $(DOMAIN).pot; then \
+       $(AM_V_GEN)$(XGETTEXT) --default-domain=$(DOMAIN) \
+           --add-comments --keyword=_ --keyword=N_ $(POTFILES)
+       @if cmp -s $(DOMAIN).po $(DOMAIN).pot; then \
            rm -f $(DOMAIN).po; \
        else \
            mv -f $(DOMAIN).po $(DOMAIN).pot; \
        fi
+endif
 
 
 install-data-local:  $(CATALOGS)
-- 
2.1.4


-- 
To unsubscribe, send mail to [email protected].

Reply via email to