1 | |
---|
2 | ###################################################################### |
---|
3 | # progtest.m4 from gettext 0.32 |
---|
4 | ###################################################################### |
---|
5 | # Search path for a program which passes the given test. |
---|
6 | # Ulrich Drepper <drepper@cygnus.com>, 1996. |
---|
7 | # |
---|
8 | # This file file be copied and used freely without restrictions. It can |
---|
9 | # be used in projects which are not available under the GNU Public License |
---|
10 | # but which still want to provide support for the GNU gettext functionality. |
---|
11 | # Please note that the actual code is *not* freely available. |
---|
12 | |
---|
13 | # serial 1 |
---|
14 | |
---|
15 | dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, |
---|
16 | dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) |
---|
17 | AC_DEFUN(AM_PATH_PROG_WITH_TEST, |
---|
18 | [# Extract the first word of "$2", so it can be a program name with args. |
---|
19 | set dummy $2; ac_word=[$]2 |
---|
20 | AC_MSG_CHECKING([for $ac_word]) |
---|
21 | AC_CACHE_VAL(ac_cv_path_$1, |
---|
22 | [case "[$]$1" in |
---|
23 | /*) |
---|
24 | ac_cv_path_$1="[$]$1" # Let the user override the test with a path. |
---|
25 | ;; |
---|
26 | *) |
---|
27 | IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" |
---|
28 | for ac_dir in ifelse([$5], , $PATH, [$5]); do |
---|
29 | test -z "$ac_dir" && ac_dir=. |
---|
30 | if test -f $ac_dir/$ac_word; then |
---|
31 | if [$3]; then |
---|
32 | ac_cv_path_$1="$ac_dir/$ac_word" |
---|
33 | break |
---|
34 | fi |
---|
35 | fi |
---|
36 | done |
---|
37 | IFS="$ac_save_ifs" |
---|
38 | dnl If no 4th arg is given, leave the cache variable unset, |
---|
39 | dnl so AC_PATH_PROGS will keep looking. |
---|
40 | ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" |
---|
41 | ])dnl |
---|
42 | ;; |
---|
43 | esac])dnl |
---|
44 | $1="$ac_cv_path_$1" |
---|
45 | if test -n "[$]$1"; then |
---|
46 | AC_MSG_RESULT([$]$1) |
---|
47 | else |
---|
48 | AC_MSG_RESULT(no) |
---|
49 | fi |
---|
50 | AC_SUBST($1)dnl |
---|
51 | ]) |
---|
52 | |
---|
53 | |
---|
54 | ###################################################################### |
---|
55 | # lcmessage.m4 from gettext 0.32 |
---|
56 | ###################################################################### |
---|
57 | # Check whether LC_MESSAGES is available in <locale.h>. |
---|
58 | # Ulrich Drepper <drepper@cygnus.com>, 1995. |
---|
59 | # |
---|
60 | # This file file be copied and used freely without restrictions. It can |
---|
61 | # be used in projects which are not available under the GNU Public License |
---|
62 | # but which still want to provide support for the GNU gettext functionality. |
---|
63 | # Please note that the actual code is *not* freely available. |
---|
64 | |
---|
65 | # serial 1 |
---|
66 | |
---|
67 | AC_DEFUN(AM_LC_MESSAGES, |
---|
68 | [if test $ac_cv_header_locale_h = yes; then |
---|
69 | AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES, |
---|
70 | [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES], |
---|
71 | am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)]) |
---|
72 | if test $am_cv_val_LC_MESSAGES = yes; then |
---|
73 | AC_DEFINE(HAVE_LC_MESSAGES) |
---|
74 | fi |
---|
75 | fi]) |
---|
76 | |
---|
77 | |
---|
78 | |
---|
79 | ###################################################################### |
---|
80 | # gettext.m4 from gettext 0.32 |
---|
81 | ###################################################################### |
---|
82 | # Macro to add for using GNU gettext. |
---|
83 | # Ulrich Drepper <drepper@cygnus.com>, 1995. |
---|
84 | # |
---|
85 | # This file file be copied and used freely without restrictions. It can |
---|
86 | # be used in projects which are not available under the GNU Public License |
---|
87 | # but which still want to provide support for the GNU gettext functionality. |
---|
88 | # Please note that the actual code is *not* freely available. |
---|
89 | |
---|
90 | # serial 3 |
---|
91 | |
---|
92 | AC_DEFUN(AM_WITH_NLS, |
---|
93 | [AC_MSG_CHECKING([whether NLS is requested]) |
---|
94 | dnl Default is enabled NLS |
---|
95 | AC_ARG_ENABLE(nls, |
---|
96 | [ --disable-nls do not use Native Language Support], |
---|
97 | USE_NLS=$enableval, USE_NLS=yes) |
---|
98 | AC_MSG_RESULT($USE_NLS) |
---|
99 | AC_SUBST(USE_NLS) |
---|
100 | |
---|
101 | USE_INCLUDED_LIBINTL=no |
---|
102 | |
---|
103 | dnl If we use NLS figure out what method |
---|
104 | if test "$USE_NLS" = "yes"; then |
---|
105 | AC_DEFINE(ENABLE_NLS) |
---|
106 | AC_MSG_CHECKING([whether included gettext is requested]) |
---|
107 | AC_ARG_WITH(included-gettext, |
---|
108 | [ --with-included-gettext use the GNU gettext library included here], |
---|
109 | nls_cv_force_use_gnu_gettext=$withval, |
---|
110 | nls_cv_force_use_gnu_gettext=no) |
---|
111 | AC_MSG_RESULT($nls_cv_force_use_gnu_gettext) |
---|
112 | |
---|
113 | nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" |
---|
114 | if test "$nls_cv_force_use_gnu_gettext" != "yes"; then |
---|
115 | dnl User does not insist on using GNU NLS library. Figure out what |
---|
116 | dnl to use. If gettext or catgets are available (in this order) we |
---|
117 | dnl use this. Else we have to fall back to GNU NLS library. |
---|
118 | dnl catgets is only used if permitted by option --with-catgets. |
---|
119 | nls_cv_header_intl= |
---|
120 | nls_cv_header_libgt= |
---|
121 | CATOBJEXT=NONE |
---|
122 | |
---|
123 | AC_CHECK_HEADER(libintl.h, |
---|
124 | [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc, |
---|
125 | [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")], |
---|
126 | gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)]) |
---|
127 | |
---|
128 | if test "$gt_cv_func_gettext_libc" != "yes"; then |
---|
129 | AC_CHECK_LIB(intl, bindtextdomain, |
---|
130 | [AC_CACHE_CHECK([for gettext in libintl], |
---|
131 | gt_cv_func_gettext_libintl, |
---|
132 | [AC_TRY_LINK([], [return (int) gettext ("")], |
---|
133 | gt_cv_func_gettext_libintl=yes, |
---|
134 | gt_cv_func_gettext_libintl=no)])]) |
---|
135 | fi |
---|
136 | |
---|
137 | if test "$gt_cv_func_gettext_libc" = "yes" \ |
---|
138 | || test "$gt_cv_func_gettext_libintl" = "yes"; then |
---|
139 | AC_DEFINE(HAVE_GETTEXT) |
---|
140 | AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, |
---|
141 | [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl |
---|
142 | if test "$MSGFMT" != "no"; then |
---|
143 | AC_CHECK_FUNCS(dcgettext) |
---|
144 | AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) |
---|
145 | AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, |
---|
146 | [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) |
---|
147 | AC_TRY_LINK(, [extern int _nl_msg_cat_cntr; |
---|
148 | return _nl_msg_cat_cntr], |
---|
149 | [CATOBJEXT=.gmo |
---|
150 | DATADIRNAME=share], |
---|
151 | [CATOBJEXT=.mo |
---|
152 | DATADIRNAME=lib]) |
---|
153 | INSTOBJEXT=.mo |
---|
154 | fi |
---|
155 | fi |
---|
156 | ]) |
---|
157 | |
---|
158 | if test "$CATOBJEXT" = "NONE"; then |
---|
159 | AC_MSG_CHECKING([whether catgets can be used]) |
---|
160 | AC_ARG_WITH(catgets, |
---|
161 | [ --with-catgets use catgets functions if available], |
---|
162 | nls_cv_use_catgets=$withval, nls_cv_use_catgets=no) |
---|
163 | AC_MSG_RESULT($nls_cv_use_catgets) |
---|
164 | |
---|
165 | if test "$nls_cv_use_catgets" = "yes"; then |
---|
166 | dnl No gettext in C library. Try catgets next. |
---|
167 | AC_CHECK_LIB(i, main) |
---|
168 | AC_CHECK_FUNC(catgets, |
---|
169 | [AC_DEFINE(HAVE_CATGETS) |
---|
170 | INTLOBJS="\$(CATOBJS)" |
---|
171 | AC_PATH_PROG(GENCAT, gencat, no)dnl |
---|
172 | if test "$GENCAT" != "no"; then |
---|
173 | AC_PATH_PROG(GMSGFMT, gmsgfmt, no) |
---|
174 | if test "$GMSGFMT" = "no"; then |
---|
175 | AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt, |
---|
176 | [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no) |
---|
177 | fi |
---|
178 | AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, |
---|
179 | [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) |
---|
180 | USE_INCLUDED_LIBINTL=yes |
---|
181 | CATOBJEXT=.cat |
---|
182 | INSTOBJEXT=.cat |
---|
183 | DATADIRNAME=lib |
---|
184 | INTLDEPS='$(top_builddir)/intl/libintl.a' |
---|
185 | INTLLIBS=$INTLDEPS |
---|
186 | LIBS=`echo $LIBS | sed -e 's/-lintl//'` |
---|
187 | nls_cv_header_intl=intl/libintl.h |
---|
188 | nls_cv_header_libgt=intl/libgettext.h |
---|
189 | fi]) |
---|
190 | fi |
---|
191 | fi |
---|
192 | |
---|
193 | if test "$CATOBJEXT" = "NONE"; then |
---|
194 | dnl Neither gettext nor catgets in included in the C library. |
---|
195 | dnl Fall back on GNU gettext library. |
---|
196 | nls_cv_use_gnu_gettext=yes |
---|
197 | fi |
---|
198 | fi |
---|
199 | |
---|
200 | if test "$nls_cv_use_gnu_gettext" = "yes"; then |
---|
201 | dnl Mark actions used to generate GNU NLS library. |
---|
202 | INTLOBJS="\$(GETTOBJS)" |
---|
203 | AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, |
---|
204 | [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt) |
---|
205 | AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) |
---|
206 | AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, |
---|
207 | [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) |
---|
208 | AC_SUBST(MSGFMT) |
---|
209 | USE_INCLUDED_LIBINTL=yes |
---|
210 | CATOBJEXT=.gmo |
---|
211 | INSTOBJEXT=.mo |
---|
212 | DATADIRNAME=share |
---|
213 | INTLDEPS='$(top_builddir)/intl/libintl.a' |
---|
214 | INTLLIBS=$INTLDEPS |
---|
215 | LIBS=`echo $LIBS | sed -e 's/-lintl//'` |
---|
216 | nls_cv_header_intl=intl/libintl.h |
---|
217 | nls_cv_header_libgt=intl/libgettext.h |
---|
218 | fi |
---|
219 | |
---|
220 | dnl Test whether we really found GNU xgettext. |
---|
221 | if test "$XGETTEXT" != ":"; then |
---|
222 | dnl If it is no GNU xgettext we define it as : so that the |
---|
223 | dnl Makefiles still can work. |
---|
224 | if $XGETTEXT --omit-header /dev/null 2> /dev/null; then |
---|
225 | : ; |
---|
226 | else |
---|
227 | AC_MSG_RESULT( |
---|
228 | [found xgettext programs is not GNU xgettext; ignore it]) |
---|
229 | XGETTEXT=":" |
---|
230 | fi |
---|
231 | fi |
---|
232 | |
---|
233 | # We need to process the po/ directory. |
---|
234 | POSUB=po |
---|
235 | else |
---|
236 | DATADIRNAME=share |
---|
237 | nls_cv_header_intl=intl/libintl.h |
---|
238 | nls_cv_header_libgt=intl/libgettext.h |
---|
239 | fi |
---|
240 | |
---|
241 | # If this is used in GNU gettext we have to set USE_NLS to `yes' |
---|
242 | # because some of the sources are only built for this goal. |
---|
243 | if test "$PACKAGE" = gettext; then |
---|
244 | USE_NLS=yes |
---|
245 | USE_INCLUDED_LIBINTL=yes |
---|
246 | fi |
---|
247 | |
---|
248 | dnl These rules are solely for the distribution goal. While doing this |
---|
249 | dnl we only have to keep exactly one list of the available catalogs |
---|
250 | dnl in configure.in. |
---|
251 | for lang in $ALL_LINGUAS; do |
---|
252 | GMOFILES="$GMOFILES $lang.gmo" |
---|
253 | POFILES="$POFILES $lang.po" |
---|
254 | done |
---|
255 | |
---|
256 | dnl Make all variables we use known to autoconf. |
---|
257 | AC_SUBST(USE_INCLUDED_LIBINTL) |
---|
258 | AC_SUBST(CATALOGS) |
---|
259 | AC_SUBST(CATOBJEXT) |
---|
260 | AC_SUBST(DATADIRNAME) |
---|
261 | AC_SUBST(GMOFILES) |
---|
262 | AC_SUBST(INSTOBJEXT) |
---|
263 | AC_SUBST(INTLDEPS) |
---|
264 | AC_SUBST(INTLLIBS) |
---|
265 | AC_SUBST(INTLOBJS) |
---|
266 | AC_SUBST(POFILES) |
---|
267 | AC_SUBST(POSUB) |
---|
268 | ]) |
---|
269 | |
---|
270 | AC_DEFUN(AM_GNU_GETTEXT, |
---|
271 | [AC_REQUIRE([AC_PROG_MAKE_SET])dnl |
---|
272 | AC_REQUIRE([AC_PROG_CC])dnl |
---|
273 | AC_REQUIRE([AC_PROG_RANLIB])dnl |
---|
274 | AC_REQUIRE([AC_ISC_POSIX])dnl |
---|
275 | AC_REQUIRE([AC_HEADER_STDC])dnl |
---|
276 | AC_REQUIRE([AC_C_CONST])dnl |
---|
277 | AC_REQUIRE([AC_C_INLINE])dnl |
---|
278 | AC_REQUIRE([AC_TYPE_OFF_T])dnl |
---|
279 | AC_REQUIRE([AC_TYPE_SIZE_T])dnl |
---|
280 | AC_REQUIRE([AC_FUNC_ALLOCA])dnl |
---|
281 | AC_REQUIRE([AC_FUNC_MMAP])dnl |
---|
282 | |
---|
283 | AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \ |
---|
284 | unistd.h values.h sys/param.h]) |
---|
285 | AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \ |
---|
286 | __argz_count __argz_stringify __argz_next]) |
---|
287 | |
---|
288 | if test "${ac_cv_func_stpcpy+set}" != "set"; then |
---|
289 | AC_CHECK_FUNCS(stpcpy) |
---|
290 | fi |
---|
291 | if test "${ac_cv_func_stpcpy}" = "yes"; then |
---|
292 | AC_DEFINE(HAVE_STPCPY) |
---|
293 | fi |
---|
294 | |
---|
295 | AM_LC_MESSAGES |
---|
296 | AM_WITH_NLS |
---|
297 | |
---|
298 | if test "x$CATOBJEXT" != "x"; then |
---|
299 | if test "x$ALL_LINGUAS" = "x"; then |
---|
300 | LINGUAS= |
---|
301 | else |
---|
302 | AC_MSG_CHECKING(for catalogs to be installed) |
---|
303 | NEW_LINGUAS= |
---|
304 | for lang in ${LINGUAS=$ALL_LINGUAS}; do |
---|
305 | case "$ALL_LINGUAS" in |
---|
306 | *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;; |
---|
307 | esac |
---|
308 | done |
---|
309 | LINGUAS=$NEW_LINGUAS |
---|
310 | AC_MSG_RESULT($LINGUAS) |
---|
311 | fi |
---|
312 | |
---|
313 | dnl Construct list of names of catalog files to be constructed. |
---|
314 | if test -n "$LINGUAS"; then |
---|
315 | for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done |
---|
316 | fi |
---|
317 | fi |
---|
318 | |
---|
319 | dnl The reference to <locale.h> in the installed <libintl.h> file |
---|
320 | dnl must be resolved because we cannot expect the users of this |
---|
321 | dnl to define HAVE_LOCALE_H. |
---|
322 | if test $ac_cv_header_locale_h = yes; then |
---|
323 | INCLUDE_LOCALE_H="#include <locale.h>" |
---|
324 | else |
---|
325 | INCLUDE_LOCALE_H="\ |
---|
326 | /* The system does not provide the header <locale.h>. Take care yourself. */" |
---|
327 | fi |
---|
328 | AC_SUBST(INCLUDE_LOCALE_H) |
---|
329 | |
---|
330 | dnl Determine which catalog format we have (if any is needed) |
---|
331 | dnl For now we know about two different formats: |
---|
332 | dnl Linux libc-5 and the normal X/Open format |
---|
333 | test -d intl || mkdir intl |
---|
334 | if test "$CATOBJEXT" = ".cat"; then |
---|
335 | AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen) |
---|
336 | |
---|
337 | dnl Transform the SED scripts while copying because some dumb SEDs |
---|
338 | dnl cannot handle comments. |
---|
339 | sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed |
---|
340 | fi |
---|
341 | dnl po2tbl.sed is always needed. |
---|
342 | sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \ |
---|
343 | $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed |
---|
344 | |
---|
345 | dnl In the intl/Makefile.in we have a special dependency which makes |
---|
346 | dnl only sense for gettext. We comment this out for non-gettext |
---|
347 | dnl packages. |
---|
348 | if test "$PACKAGE" = "gettext"; then |
---|
349 | GT_NO="#NO#" |
---|
350 | GT_YES= |
---|
351 | else |
---|
352 | GT_NO= |
---|
353 | GT_YES="#YES#" |
---|
354 | fi |
---|
355 | AC_SUBST(GT_NO) |
---|
356 | AC_SUBST(GT_YES) |
---|
357 | |
---|
358 | dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly |
---|
359 | dnl find the mkinstalldirs script in another subdir but ($top_srcdir). |
---|
360 | dnl Try to locate is. |
---|
361 | MKINSTALLDIRS= |
---|
362 | if test -n "$ac_aux_dir"; then |
---|
363 | MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" |
---|
364 | fi |
---|
365 | if test -z "$MKINSTALLDIRS"; then |
---|
366 | MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" |
---|
367 | fi |
---|
368 | AC_SUBST(MKINSTALLDIRS) |
---|
369 | |
---|
370 | dnl *** For now the libtool support in intl/Makefile is not for real. |
---|
371 | l= |
---|
372 | AC_SUBST(l) |
---|
373 | |
---|
374 | dnl Generate list of files to be processed by xgettext which will |
---|
375 | dnl be included in po/Makefile. |
---|
376 | test -d po || mkdir po |
---|
377 | if test "x$srcdir" != "x."; then |
---|
378 | if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then |
---|
379 | posrcprefix="$srcdir/" |
---|
380 | else |
---|
381 | posrcprefix="../$srcdir/" |
---|
382 | fi |
---|
383 | else |
---|
384 | posrcprefix="../" |
---|
385 | fi |
---|
386 | rm -f po/POTFILES |
---|
387 | sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \ |
---|
388 | < $srcdir/po/POTFILES.in > po/POTFILES |
---|
389 | ]) |
---|