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.
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.
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,
24 ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
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
32 ac_cv_path_$1="$ac_dir/$ac_word"
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"
45 if test -n "[$]$1"; then
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.
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.
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)
79 ######################################################################
80 # gettext.m4 from gettext 0.32
81 ######################################################################
82 # Macro to add for using GNU gettext.
83 # Ulrich Drepper <drepper@cygnus.com>, 1995.
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.
93 [AC_MSG_CHECKING([whether NLS is requested])
94 dnl Default is enabled NLS
96 [ --disable-nls do not use Native Language Support],
97 USE_NLS=$enableval, USE_NLS=yes)
98 AC_MSG_RESULT($USE_NLS)
101 USE_INCLUDED_LIBINTL=no
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)
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.
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)])
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)])])
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],
158 if test "$CATOBJEXT" = "NONE"; then
159 AC_MSG_CHECKING([whether catgets can be used])
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)
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)
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
184 INTLDEPS='$(top_builddir)/intl/libintl.a'
186 LIBS=`echo $LIBS | sed -e 's/-lintl//'`
187 nls_cv_header_intl=intl/libintl.h
188 nls_cv_header_libgt=intl/libgettext.h
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
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)'`"], :)
209 USE_INCLUDED_LIBINTL=yes
213 INTLDEPS='$(top_builddir)/intl/libintl.a'
215 LIBS=`echo $LIBS | sed -e 's/-lintl//'`
216 nls_cv_header_intl=intl/libintl.h
217 nls_cv_header_libgt=intl/libgettext.h
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
228 [found xgettext programs is not GNU xgettext; ignore it])
233 # We need to process the po/ directory.
237 nls_cv_header_intl=intl/libintl.h
238 nls_cv_header_libgt=intl/libgettext.h
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
245 USE_INCLUDED_LIBINTL=yes
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
251 for lang in $ALL_LINGUAS; do
252 GMOFILES="$GMOFILES $lang.gmo"
253 POFILES="$POFILES $lang.po"
256 dnl Make all variables we use known to autoconf.
257 AC_SUBST(USE_INCLUDED_LIBINTL)
260 AC_SUBST(DATADIRNAME)
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
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])
288 if test "${ac_cv_func_stpcpy+set}" != "set"; then
289 AC_CHECK_FUNCS(stpcpy)
291 if test "${ac_cv_func_stpcpy}" = "yes"; then
292 AC_DEFINE(HAVE_STPCPY)
298 if test "x$CATOBJEXT" != "x"; then
299 if test "x$ALL_LINGUAS" = "x"; then
302 AC_MSG_CHECKING(for catalogs to be installed)
304 for lang in ${LINGUAS=$ALL_LINGUAS}; do
305 case "$ALL_LINGUAS" in
306 *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
310 AC_MSG_RESULT($LINGUAS)
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
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>"
326 /* The system does not provide the header <locale.h>. Take care yourself. */"
328 AC_SUBST(INCLUDE_LOCALE_H)
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)
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
341 dnl po2tbl.sed is always needed.
342 sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
343 $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed
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
348 if test "$PACKAGE" = "gettext"; then
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.
362 if test -n "$ac_aux_dir"; then
363 MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
365 if test -z "$MKINSTALLDIRS"; then
366 MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
368 AC_SUBST(MKINSTALLDIRS)
370 dnl *** For now the libtool support in intl/Makefile is not for real.
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/"
381 posrcprefix="../$srcdir/"
387 sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
388 < $srcdir/po/POTFILES.in > po/POTFILES