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