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 | |
---|
25 | dnl IT_PROG_INTLTOOL([MINIMUM-VERSION], [no-xml]) |
---|
26 | # serial 2 IT_PROG_INTLTOOL |
---|
27 | AC_DEFUN([IT_PROG_INTLTOOL], |
---|
28 | [ |
---|
29 | |
---|
30 | if test -n "$1"; then |
---|
31 | AC_MSG_CHECKING(for intltool >= $1) |
---|
32 | |
---|
33 | INTLTOOL_REQUIRED_VERSION_AS_INT=`echo $1 | awk -F. '{ printf "%d", $[1] * 100 + $[2]; }'` |
---|
34 | INTLTOOL_APPLIED_VERSION=`awk -F\" '/\\$VERSION / { printf $[2]; }' < ${ac_aux_dir}/intltool-update.in` |
---|
35 | changequote({{,}}) |
---|
36 | INTLTOOL_APPLIED_VERSION_AS_INT=`awk -F\" '/\\$VERSION / { split(${{2}}, VERSION, "."); printf "%d\n", VERSION[1] * 100 + VERSION[2];}' < ${ac_aux_dir}/intltool-update.in` |
---|
37 | changequote([,]) |
---|
38 | |
---|
39 | if test "$INTLTOOL_APPLIED_VERSION_AS_INT" -ge "$INTLTOOL_REQUIRED_VERSION_AS_INT"; then |
---|
40 | AC_MSG_RESULT([$INTLTOOL_APPLIED_VERSION found]) |
---|
41 | else |
---|
42 | AC_MSG_RESULT([$INTLTOOL_APPLIED_VERSION found. Your intltool is too old. You need intltool $1 or later.]) |
---|
43 | exit 1 |
---|
44 | fi |
---|
45 | fi |
---|
46 | |
---|
47 | 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 $< [$]@' |
---|
48 | INTLTOOL_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 $< [$]@' |
---|
49 | 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 $< [$]@' |
---|
50 | 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 $< [$]@' |
---|
51 | INTLTOOL_OAF_RULE='%.oaf: %.oaf.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -o -p $(top_srcdir)/po $< [$]@' |
---|
52 | 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 $< [$]@' |
---|
53 | 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 $< [$]@' |
---|
54 | 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 $< [$]@' |
---|
55 | INTLTOOL_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 $< [$]@' |
---|
56 | 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 $< [$]@' |
---|
57 | 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 $< [$]@' |
---|
58 | INTLTOOL_XML_NOMERGE_RULE='%.xml: %.xml.in $(INTLTOOL_MERGE) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u /tmp $< [$]@' |
---|
59 | 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 $< [$]@' |
---|
60 | 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 $< [$]@' |
---|
61 | 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 $< [$]@' |
---|
62 | 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 $< [$]@' |
---|
63 | 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 $< [$]@' |
---|
64 | |
---|
65 | AC_SUBST(INTLTOOL_DESKTOP_RULE) |
---|
66 | AC_SUBST(INTLTOOL_DIRECTORY_RULE) |
---|
67 | AC_SUBST(INTLTOOL_KEYS_RULE) |
---|
68 | AC_SUBST(INTLTOOL_PROP_RULE) |
---|
69 | AC_SUBST(INTLTOOL_OAF_RULE) |
---|
70 | AC_SUBST(INTLTOOL_PONG_RULE) |
---|
71 | AC_SUBST(INTLTOOL_SERVER_RULE) |
---|
72 | AC_SUBST(INTLTOOL_SHEET_RULE) |
---|
73 | AC_SUBST(INTLTOOL_SOUNDLIST_RULE) |
---|
74 | AC_SUBST(INTLTOOL_UI_RULE) |
---|
75 | AC_SUBST(INTLTOOL_XAM_RULE) |
---|
76 | AC_SUBST(INTLTOOL_KBD_RULE) |
---|
77 | AC_SUBST(INTLTOOL_XML_RULE) |
---|
78 | AC_SUBST(INTLTOOL_XML_NOMERGE_RULE) |
---|
79 | AC_SUBST(INTLTOOL_CAVES_RULE) |
---|
80 | AC_SUBST(INTLTOOL_SCHEMAS_RULE) |
---|
81 | AC_SUBST(INTLTOOL_THEME_RULE) |
---|
82 | |
---|
83 | # Use the tools built into the package, not the ones that are installed. |
---|
84 | |
---|
85 | INTLTOOL_EXTRACT='$(top_builddir)/intltool-extract' |
---|
86 | INTLTOOL_MERGE='$(top_builddir)/intltool-merge' |
---|
87 | INTLTOOL_UPDATE='$(top_builddir)/intltool-update' |
---|
88 | |
---|
89 | AC_SUBST(INTLTOOL_EXTRACT) |
---|
90 | AC_SUBST(INTLTOOL_MERGE) |
---|
91 | AC_SUBST(INTLTOOL_UPDATE) |
---|
92 | |
---|
93 | AC_PATH_PROG(INTLTOOL_PERL, perl) |
---|
94 | if test -z "$INTLTOOL_PERL"; then |
---|
95 | AC_MSG_ERROR([perl not found; required for intltool]) |
---|
96 | fi |
---|
97 | if test -z "`$INTLTOOL_PERL -v | fgrep '5.' 2> /dev/null`"; then |
---|
98 | AC_MSG_ERROR([perl 5.x required for intltool]) |
---|
99 | fi |
---|
100 | if test "x$2" != "xno-xml"; then |
---|
101 | AC_MSG_CHECKING([for XML::Parser]) |
---|
102 | if `$INTLTOOL_PERL -e "require XML::Parser" 2>/dev/null`; then |
---|
103 | AC_MSG_RESULT([ok]) |
---|
104 | else |
---|
105 | AC_MSG_ERROR([XML::Parser perl module is required for intltool]) |
---|
106 | fi |
---|
107 | fi |
---|
108 | |
---|
109 | AC_PATH_PROG(INTLTOOL_ICONV, iconv, iconv) |
---|
110 | AC_PATH_PROG(INTLTOOL_MSGFMT, msgfmt, msgfmt) |
---|
111 | AC_PATH_PROG(INTLTOOL_MSGMERGE, msgmerge, msgmerge) |
---|
112 | AC_PATH_PROG(INTLTOOL_XGETTEXT, xgettext, xgettext) |
---|
113 | |
---|
114 | # Remove file type tags (using []) from po/POTFILES. |
---|
115 | |
---|
116 | ifdef([AC_DIVERSION_ICMDS],[ |
---|
117 | AC_DIVERT_PUSH(AC_DIVERSION_ICMDS) |
---|
118 | changequote(,) |
---|
119 | mv -f po/POTFILES po/POTFILES.tmp |
---|
120 | sed -e '/\[encoding.*\]/d' -e 's/\[.*\] *//' < po/POTFILES.tmp > po/POTFILES |
---|
121 | rm -f po/POTFILES.tmp |
---|
122 | changequote([,]) |
---|
123 | AC_DIVERT_POP() |
---|
124 | ],[ |
---|
125 | ifdef([AC_CONFIG_COMMANDS_PRE],[ |
---|
126 | AC_CONFIG_COMMANDS_PRE([ |
---|
127 | changequote(,) |
---|
128 | mv -f po/POTFILES po/POTFILES.tmp |
---|
129 | sed -e '/\[encoding.*\]/d' -e 's/\[.*\] *//' < po/POTFILES.tmp > po/POTFILES |
---|
130 | rm -f po/POTFILES.tmp |
---|
131 | changequote([,]) |
---|
132 | ]) |
---|
133 | ]) |
---|
134 | |
---|
135 | ############################################################################ |
---|
136 | ## Take this bit from AM_PROG_MKDIR_P to set mkdir_p for automake 1.4 users |
---|
137 | ############################################################################ |
---|
138 | if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then |
---|
139 | # Keeping the `.' argument allows $(mkdir_p) to be used without |
---|
140 | # argument. Indeed, we sometimes output rules like |
---|
141 | # $(mkdir_p) $(somedir) |
---|
142 | # where $(somedir) is conditionally defined. |
---|
143 | # (`test -n '$(somedir)' && $(mkdir_p) $(somedir)' is a more |
---|
144 | # expensive solution, as it forces Make to start a sub-shell.) |
---|
145 | mkdir_p='mkdir -p -- .' |
---|
146 | else |
---|
147 | # On NextStep and OpenStep, the `mkdir' command does not |
---|
148 | # recognize any option. It will interpret all options as |
---|
149 | # directories to create, and then abort because `.' already |
---|
150 | # exists. |
---|
151 | for d in ./-p ./--version; |
---|
152 | do |
---|
153 | test -d $d && rmdir $d |
---|
154 | done |
---|
155 | # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. |
---|
156 | if test -f "$ac_aux_dir/mkinstalldirs"; then |
---|
157 | mkdir_p='$(mkinstalldirs)' |
---|
158 | else |
---|
159 | mkdir_p='$(install_sh) -d' |
---|
160 | fi |
---|
161 | fi |
---|
162 | AC_SUBST([mkdir_p]) |
---|
163 | ]) |
---|
164 | |
---|
165 | # Manually sed perl in so people don't have to put the intltool scripts in AC_OUTPUT. |
---|
166 | |
---|
167 | AC_CONFIG_COMMANDS([intltool], [ |
---|
168 | |
---|
169 | intltool_edit="-e 's#@INTLTOOL_EXTRACT@#`pwd`/intltool-extract#g' \ |
---|
170 | -e 's#@INTLTOOL_ICONV@#${INTLTOOL_ICONV}#g' \ |
---|
171 | -e 's#@INTLTOOL_MSGFMT@#${INTLTOOL_MSGFMT}#g' \ |
---|
172 | -e 's#@INTLTOOL_MSGMERGE@#${INTLTOOL_MSGMERGE}#g' \ |
---|
173 | -e 's#@INTLTOOL_XGETTEXT@#${INTLTOOL_XGETTEXT}#g' \ |
---|
174 | -e 's#@INTLTOOL_PERL@#${INTLTOOL_PERL}#g'" |
---|
175 | |
---|
176 | eval sed ${intltool_edit} < ${ac_aux_dir}/intltool-extract.in \ |
---|
177 | > intltool-extract.out |
---|
178 | if cmp -s intltool-extract intltool-extract.out 2>/dev/null; then |
---|
179 | rm -f intltool-extract.out |
---|
180 | else |
---|
181 | mv -f intltool-extract.out intltool-extract |
---|
182 | fi |
---|
183 | chmod ugo+x intltool-extract |
---|
184 | chmod u+w intltool-extract |
---|
185 | |
---|
186 | eval sed ${intltool_edit} < ${ac_aux_dir}/intltool-merge.in \ |
---|
187 | > intltool-merge.out |
---|
188 | if cmp -s intltool-merge intltool-merge.out 2>/dev/null; then |
---|
189 | rm -f intltool-merge.out |
---|
190 | else |
---|
191 | mv -f intltool-merge.out intltool-merge |
---|
192 | fi |
---|
193 | chmod ugo+x intltool-merge |
---|
194 | chmod u+w intltool-merge |
---|
195 | |
---|
196 | eval sed ${intltool_edit} < ${ac_aux_dir}/intltool-update.in \ |
---|
197 | > intltool-update.out |
---|
198 | if cmp -s intltool-update intltool-update.out 2>/dev/null; then |
---|
199 | rm -f intltool-update.out |
---|
200 | else |
---|
201 | mv -f intltool-update.out intltool-update |
---|
202 | fi |
---|
203 | chmod ugo+x intltool-update |
---|
204 | chmod u+w intltool-update |
---|
205 | |
---|
206 | ], INTLTOOL_PERL='${INTLTOOL_PERL}' ac_aux_dir=${ac_aux_dir} |
---|
207 | INTLTOOL_EXTRACT='${INTLTOOL_EXTRACT}' ICONV='${INTLTOOL_ICONV}' |
---|
208 | MSGFMT='${INTLTOOL_MSGFMT}' MSGMERGE='${INTLTOOL_MSGMERGE}' |
---|
209 | XGETTEXT='${INTLTOOL_XGETTEXT}') |
---|
210 | |
---|
211 | ]) |
---|
212 | |
---|
213 | # deprecated macros |
---|
214 | AC_DEFUN([AC_PROG_INTLTOOL], [IT_PROG_INTLTOOL($@)]) |
---|
215 | |
---|