source: trunk/m4/intltool.m4 @ 7104

Last change on this file since 7104 was 7104, checked in by charles, 14 years ago

follow glib-gettextize's suggestion of adding these to the m4 directory

File size: 9.8 KB
Line 
1## intltool.m4 - Configure intltool for the target system. -*-Shell-script-*-
2## Copyright (C) 2001 Eazel, Inc.
3## Author: Maciej Stachowiak <mjs@noisehavoc.org>
4##         Kenneth Christiansen <kenneth@gnu.org>
5##
6## This program is free software; you can redistribute it and/or modify
7## it under the terms of the GNU General Public License as published by
8## the Free Software Foundation; either version 2 of the License, or
9## (at your option) any later version.
10##
11## This program is distributed in the hope that it will be useful, but
12## WITHOUT ANY WARRANTY; without even the implied warranty of
13## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14## General Public License for more details.
15##
16## You should have received a copy of the GNU General Public License
17## along with this program; if not, write to the Free Software
18## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19##
20## As a special exception to the GNU General Public License, if you
21## distribute this file as part of a program that contains a
22## configuration script generated by Autoconf, you may include it under
23## the same distribution terms that you use for the rest of that program.
24
25dnl IT_PROG_INTLTOOL([MINIMUM-VERSION], [no-xml])
26# serial 40 IT_PROG_INTLTOOL
27AC_DEFUN([IT_PROG_INTLTOOL], [
28AC_PREREQ([2.50])dnl
29AC_REQUIRE([AM_NLS])dnl
30
31case "$am__api_version" in
32    1.[01234])
33        AC_MSG_ERROR([Automake 1.5 or newer is required to use intltool])
34    ;;
35    *)
36    ;;
37esac
38
39if test -n "$1"; then
40    AC_MSG_CHECKING([for intltool >= $1])
41
42    INTLTOOL_REQUIRED_VERSION_AS_INT=`echo $1 | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'`
43    INTLTOOL_APPLIED_VERSION=`intltool-update --version | head -1 | cut -d" " -f3`
44    [INTLTOOL_APPLIED_VERSION_AS_INT=`echo $INTLTOOL_APPLIED_VERSION | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'`
45    ]
46    AC_MSG_RESULT([$INTLTOOL_APPLIED_VERSION found])
47    test "$INTLTOOL_APPLIED_VERSION_AS_INT" -ge "$INTLTOOL_REQUIRED_VERSION_AS_INT" ||
48        AC_MSG_ERROR([Your intltool is too old.  You need intltool $1 or later.])
49fi
50
51AC_PATH_PROG(INTLTOOL_UPDATE, [intltool-update])
52AC_PATH_PROG(INTLTOOL_MERGE, [intltool-merge])
53AC_PATH_PROG(INTLTOOL_EXTRACT, [intltool-extract])
54if test -z "$INTLTOOL_UPDATE" -o -z "$INTLTOOL_MERGE" -o -z "$INTLTOOL_EXTRACT"; then
55    AC_MSG_ERROR([The intltool scripts were not found. Please install intltool.])
56fi
57
58  INTLTOOL_DESKTOP_RULE='%.desktop:   %.desktop.in   $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
59INTLTOOL_DIRECTORY_RULE='%.directory: %.directory.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
60     INTLTOOL_KEYS_RULE='%.keys:      %.keys.in      $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -k -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
61     INTLTOOL_PROP_RULE='%.prop:      %.prop.in      $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
62      INTLTOOL_OAF_RULE='%.oaf:       %.oaf.in       $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -o -p $(top_srcdir)/po $< [$]@'
63     INTLTOOL_PONG_RULE='%.pong:      %.pong.in      $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
64   INTLTOOL_SERVER_RULE='%.server:    %.server.in    $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -o -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
65    INTLTOOL_SHEET_RULE='%.sheet:     %.sheet.in     $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
66INTLTOOL_SOUNDLIST_RULE='%.soundlist: %.soundlist.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
67       INTLTOOL_UI_RULE='%.ui:        %.ui.in        $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
68      INTLTOOL_XML_RULE='%.xml:       %.xml.in       $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
69      INTLTOOL_XML_NOMERGE_RULE='%.xml:       %.xml.in       $(INTLTOOL_MERGE) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u /tmp $< [$]@'
70      INTLTOOL_XAM_RULE='%.xam:       %.xml.in       $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
71      INTLTOOL_KBD_RULE='%.kbd:       %.kbd.in       $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -m -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
72    INTLTOOL_CAVES_RULE='%.caves:     %.caves.in     $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
73  INTLTOOL_SCHEMAS_RULE='%.schemas:   %.schemas.in   $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -s -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
74    INTLTOOL_THEME_RULE='%.theme:     %.theme.in     $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
75    INTLTOOL_SERVICE_RULE='%.service: %.service.in   $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
76   INTLTOOL_POLICY_RULE='%.policy:    %.policy.in    $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
77
78AC_SUBST(INTLTOOL_DESKTOP_RULE)
79AC_SUBST(INTLTOOL_DIRECTORY_RULE)
80AC_SUBST(INTLTOOL_KEYS_RULE)
81AC_SUBST(INTLTOOL_PROP_RULE)
82AC_SUBST(INTLTOOL_OAF_RULE)
83AC_SUBST(INTLTOOL_PONG_RULE)
84AC_SUBST(INTLTOOL_SERVER_RULE)
85AC_SUBST(INTLTOOL_SHEET_RULE)
86AC_SUBST(INTLTOOL_SOUNDLIST_RULE)
87AC_SUBST(INTLTOOL_UI_RULE)
88AC_SUBST(INTLTOOL_XAM_RULE)
89AC_SUBST(INTLTOOL_KBD_RULE)
90AC_SUBST(INTLTOOL_XML_RULE)
91AC_SUBST(INTLTOOL_XML_NOMERGE_RULE)
92AC_SUBST(INTLTOOL_CAVES_RULE)
93AC_SUBST(INTLTOOL_SCHEMAS_RULE)
94AC_SUBST(INTLTOOL_THEME_RULE)
95AC_SUBST(INTLTOOL_SERVICE_RULE)
96AC_SUBST(INTLTOOL_POLICY_RULE)
97
98# Check the gettext tools to make sure they are GNU
99AC_PATH_PROG(XGETTEXT, xgettext)
100AC_PATH_PROG(MSGMERGE, msgmerge)
101AC_PATH_PROG(MSGFMT, msgfmt)
102AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
103if test -z "$XGETTEXT" -o -z "$MSGMERGE" -o -z "$MSGFMT"; then
104    AC_MSG_ERROR([GNU gettext tools not found; required for intltool])
105fi
106xgversion="`$XGETTEXT --version|grep '(GNU ' 2> /dev/null`"
107mmversion="`$MSGMERGE --version|grep '(GNU ' 2> /dev/null`"
108mfversion="`$MSGFMT --version|grep '(GNU ' 2> /dev/null`"
109if test -z "$xgversion" -o -z "$mmversion" -o -z "$mfversion"; then
110    AC_MSG_ERROR([GNU gettext tools not found; required for intltool])
111fi
112
113AC_PATH_PROG(INTLTOOL_PERL, [perl])
114if test -z "$INTLTOOL_PERL"; then
115   AC_MSG_ERROR([perl not found; required for intltool])
116fi
117if test -z "`$INTLTOOL_PERL -v | fgrep '5.' 2> /dev/null`"; then
118   AC_MSG_ERROR([perl 5.x required for intltool])
119fi
120if test "x$2" != "xno-xml"; then
121   AC_MSG_CHECKING([for XML::Parser])
122   if `$INTLTOOL_PERL -e "require XML::Parser" 2>/dev/null`; then
123       AC_MSG_RESULT([ok])
124   else
125       AC_MSG_ERROR([XML::Parser perl module is required for intltool])
126   fi
127fi
128
129# Substitute ALL_LINGUAS so we can use it in po/Makefile
130AC_SUBST(ALL_LINGUAS)
131
132# Set DATADIRNAME correctly if it is not set yet
133# (copied from glib-gettext.m4)
134if test -z "$DATADIRNAME"; then
135  AC_LINK_IFELSE(
136    [AC_LANG_PROGRAM([[]],
137                     [[extern int _nl_msg_cat_cntr;
138                       return _nl_msg_cat_cntr]])],
139    [DATADIRNAME=share],
140    [case $host in
141    *-*-solaris*)
142    dnl On Solaris, if bind_textdomain_codeset is in libc,
143    dnl GNU format message catalog is always supported,
144    dnl since both are added to the libc all together.
145    dnl Hence, we'd like to go with DATADIRNAME=share
146    dnl in this case.
147    AC_CHECK_FUNC(bind_textdomain_codeset,
148      [DATADIRNAME=share], [DATADIRNAME=lib])
149    ;;
150    *)
151    [DATADIRNAME=lib]
152    ;;
153    esac])
154fi
155AC_SUBST(DATADIRNAME)
156
157IT_PO_SUBDIR([po])
158
159])
160
161
162# IT_PO_SUBDIR(DIRNAME)
163# ---------------------
164# All po subdirs have to be declared with this macro; the subdir "po" is
165# declared by IT_PROG_INTLTOOL.
166#
167AC_DEFUN([IT_PO_SUBDIR],
168[AC_PREREQ([2.53])dnl We use ac_top_srcdir inside AC_CONFIG_COMMANDS.
169dnl
170dnl The following CONFIG_COMMANDS should be exetuted at the very end
171dnl of config.status.
172AC_CONFIG_COMMANDS_PRE([
173  AC_CONFIG_COMMANDS([$1/stamp-it], [
174    if [ ! grep "^# INTLTOOL_MAKEFILE$" "$1/Makefile.in" ]; then
175       AC_MSG_ERROR([$1/Makefile.in.in was not created by intltoolize.])
176    fi
177    rm -f "$1/stamp-it" "$1/stamp-it.tmp" "$1/POTFILES" "$1/Makefile.tmp"
178    >"$1/stamp-it.tmp"
179    [sed '/^#/d
180         s/^[[].*] *//
181         /^[    ]*$/d
182        '"s|^|  $ac_top_srcdir/|" \
183      "$srcdir/$1/POTFILES.in" | sed '$!s/$/ \\/' >"$1/POTFILES"
184    ]
185    [sed '/^POTFILES =/,/[^\\]$/ {
186                /^POTFILES =/!d
187                r $1/POTFILES
188          }
189         ' "$1/Makefile.in" >"$1/Makefile"]
190    rm -f "$1/Makefile.tmp"
191    mv "$1/stamp-it.tmp" "$1/stamp-it"
192  ])
193])dnl
194])
195
196# deprecated macros
197AU_ALIAS([AC_PROG_INTLTOOL], [IT_PROG_INTLTOOL])
198# A hint is needed for aclocal from Automake <= 1.9.4:
199# AC_DEFUN([AC_PROG_INTLTOOL], ...)
200
Note: See TracBrowser for help on using the repository browser.