/[bison]/bison/m4/gettext.m4
ViewVC logotype

Diff of /bison/m4/gettext.m4

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3.2.1 by eggert, Fri Oct 26 07:04:29 2001 UTC revision 1.3.2.2 by akim, Wed Mar 20 08:43:12 2002 UTC
# Line 1  Line 1 
1  # Macro to add for using GNU gettext.  # gettext.m4 serial 13 (gettext-0.11.1)
2  # Ulrich Drepper <drepper@cygnus.com>, 1995.  dnl Copyright (C) 1995-2002 Free Software Foundation, Inc.
3  #  dnl This file is free software, distributed under the terms of the GNU
4  # This file can be copied and used freely without restrictions.  It can  dnl General Public License.  As a special exception to the GNU General
5  # be used in projects which are not available under the GNU General Public  dnl Public License, this file may be distributed as part of a program
6  # License or the GNU Library General Public License but which still want  dnl that contains a configuration script generated by Autoconf, under
7  # to provide support for the GNU gettext functionality.  dnl the same distribution terms as the rest of that program.
8  # Please note that the actual code of the GNU gettext library is covered  dnl
9  # by the GNU Library General Public License, and the rest of the GNU  dnl This file can can be used in projects which are not available under
10  # gettext package package is covered by the GNU General Public License.  dnl the GNU General Public License or the GNU Library General Public
11  # They are *not* in the public domain.  dnl License but which still want to provide support for the GNU gettext
12    dnl functionality.
13  # serial 10  dnl Please note that the actual code of the GNU gettext library is covered
14    dnl by the GNU Library General Public License, and the rest of the GNU
15  dnl Usage: AM_WITH_NLS([TOOLSYMBOL], [NEEDSYMBOL], [LIBDIR]).  dnl gettext package package is covered by the GNU General Public License.
16  dnl If TOOLSYMBOL is specified and is 'use-libtool', then a libtool library  dnl They are *not* in the public domain.
17    
18    dnl Authors:
19    dnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
20    dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2002.
21    
22    dnl Macro to add for using GNU gettext.
23    
24    dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]).
25    dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The
26    dnl    default (if it is not specified or empty) is 'no-libtool'.
27    dnl    INTLSYMBOL should be 'external' for packages with no intl directory,
28    dnl    and 'no-libtool' or 'use-libtool' for packages with an intl directory.
29    dnl    If INTLSYMBOL is 'use-libtool', then a libtool library
30  dnl    $(top_builddir)/intl/libintl.la will be created (shared and/or static,  dnl    $(top_builddir)/intl/libintl.la will be created (shared and/or static,
31  dnl    depending on --{enable,disable}-{shared,static} and on the presence of  dnl    depending on --{enable,disable}-{shared,static} and on the presence of
32  dnl    AM-DISABLE-SHARED). Otherwise, a static library  dnl    AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library
33  dnl    $(top_builddir)/intl/libintl.a will be created.  dnl    $(top_builddir)/intl/libintl.a will be created.
34  dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext  dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
35  dnl    implementations (in libc or libintl) without the ngettext() function  dnl    implementations (in libc or libintl) without the ngettext() function
36  dnl    will be ignored.  dnl    will be ignored.
37  dnl LIBDIR is used to find the intl libraries.  If empty,  dnl INTLDIR is used to find the intl libraries.  If empty,
38  dnl    the value `$(top_builddir)/intl/' is used.  dnl    the value `$(top_builddir)/intl/' is used.
39  dnl  dnl
40  dnl The result of the configuration is one of three cases:  dnl The result of the configuration is one of three cases:
# Line 35  dnl    Catalog extension: .mo after inst Line 48  dnl    Catalog extension: .mo after inst
48  dnl 3) No internationalization, always use English msgid.  dnl 3) No internationalization, always use English msgid.
49  dnl    Catalog format: none  dnl    Catalog format: none
50  dnl    Catalog extension: none  dnl    Catalog extension: none
51    dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur.
52  dnl The use of .gmo is historical (it was needed to avoid overwriting the  dnl The use of .gmo is historical (it was needed to avoid overwriting the
53  dnl GNU format catalogs when building on a platform with an X/Open gettext),  dnl GNU format catalogs when building on a platform with an X/Open gettext),
54  dnl but we keep it in order not to force irrelevant filename changes on the  dnl but we keep it in order not to force irrelevant filename changes on the
55  dnl maintainers.  dnl maintainers.
56  dnl  dnl
57  AC_DEFUN([AM_WITH_NLS],  AC_DEFUN([AM_GNU_GETTEXT],
58    [AC_MSG_CHECKING([whether NLS is requested])  [
59      dnl Default is enabled NLS    dnl Argument checking.
60      AC_ARG_ENABLE(nls,    ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], ,
61        [  --disable-nls           do not use Native Language Support],      [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT
62        USE_NLS=$enableval, USE_NLS=yes)  ])])])])])
63      AC_MSG_RESULT($USE_NLS)    ifelse([$2], [], , [ifelse([$2], [need-ngettext], ,
64      AC_SUBST(USE_NLS)      [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT
65    ])])])
66      define(gt_included_intl, ifelse([$1], [external], [no], [yes]))
67      define(gt_libtool_suffix_prefix, ifelse([$1], [use-libtool], [l], []))
68    
69      AC_REQUIRE([AM_PO_SUBDIRS])dnl
70      ifelse(gt_included_intl, yes, [
71        AC_REQUIRE([AM_INTL_SUBDIR])dnl
72      ])
73    
74      dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
75      AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
76      AC_REQUIRE([AC_LIB_RPATH])
77    
78      AC_MSG_CHECKING([whether NLS is requested])
79      dnl Default is enabled NLS
80      AC_ARG_ENABLE(nls,
81        [  --disable-nls           do not use Native Language Support],
82        USE_NLS=$enableval, USE_NLS=yes)
83      AC_MSG_RESULT($USE_NLS)
84      AC_SUBST(USE_NLS)
85    
86      ifelse(gt_included_intl, yes, [
87      BUILD_INCLUDED_LIBINTL=no      BUILD_INCLUDED_LIBINTL=no
88      USE_INCLUDED_LIBINTL=no      USE_INCLUDED_LIBINTL=no
89      INTLLIBS=    ])
90      LIBINTL=
91      dnl If we use NLS figure out what method    LTLIBINTL=
92      if test "$USE_NLS" = "yes"; then    POSUB=
93        AC_DEFINE(ENABLE_NLS, 1,  
94          [Define to 1 if translation of program messages to the user's native language    dnl If we use NLS figure out what method
95     is requested.])    if test "$USE_NLS" = "yes"; then
96        gt_use_preinstalled_gnugettext=no
97        ifelse(gt_included_intl, yes, [
98        AC_MSG_CHECKING([whether included gettext is requested])        AC_MSG_CHECKING([whether included gettext is requested])
99        AC_ARG_WITH(included-gettext,        AC_ARG_WITH(included-gettext,
100          [  --with-included-gettext use the GNU gettext library included here],          [  --with-included-gettext use the GNU gettext library included here],
# Line 67  AC_DEFUN([AM_WITH_NLS], Line 104  AC_DEFUN([AM_WITH_NLS],
104    
105        nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"        nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
106        if test "$nls_cv_force_use_gnu_gettext" != "yes"; then        if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
107        ])
108          dnl User does not insist on using GNU NLS library.  Figure out what          dnl User does not insist on using GNU NLS library.  Figure out what
109          dnl to use.  If GNU gettext is available we use this.  Else we have          dnl to use.  If GNU gettext is available we use this.  Else we have
110          dnl to fall back to GNU NLS library.          dnl to fall back to GNU NLS library.
         CATOBJEXT=NONE  
111    
112          dnl Add a version number to the cache macros.          dnl Add a version number to the cache macros.
113          define(gt_cv_func_gnugettext_libc, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libc])          define([gt_api_version], ifelse([$2], [need-ngettext], 2, 1))
114          define(gt_cv_func_gnugettext_libintl, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libintl])          define([gt_cv_func_gnugettext_libc], [gt_cv_func_gnugettext]gt_api_version[_libc])
115            define([gt_cv_func_gnugettext_libintl], [gt_cv_func_gnugettext]gt_api_version[_libintl])
116    
117            AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,
118             [AC_TRY_LINK([#include <libintl.h>
119    extern int _nl_msg_cat_cntr;
120    extern int *_nl_domain_bindings;],
121                [bindtextdomain ("", "");
122    return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings],
123                gt_cv_func_gnugettext_libc=yes,
124                gt_cv_func_gnugettext_libc=no)])
125    
126            if test "$gt_cv_func_gnugettext_libc" != "yes"; then
127              dnl Sometimes libintl requires libiconv, so first search for libiconv.
128              ifelse(gt_included_intl, yes, , [
129                AM_ICONV_LINK
130              ])
131              dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL
132              dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv])
133              dnl because that would add "-liconv" to LIBINTL and LTLIBINTL
134              dnl even if libiconv doesn't exist.
135              AC_LIB_LINKFLAGS_BODY([intl])
136              AC_CACHE_CHECK([for GNU gettext in libintl],
137                gt_cv_func_gnugettext_libintl,
138               [gt_save_CPPFLAGS="$CPPFLAGS"
139                CPPFLAGS="$CPPFLAGS $INCINTL"
140                gt_save_LIBS="$LIBS"
141                LIBS="$LIBS $LIBINTL"
142                dnl Now see whether libintl exists and does not depend on libiconv.
143                AC_TRY_LINK([#include <libintl.h>
144    extern int _nl_msg_cat_cntr;
145    extern int *_nl_domain_bindings;
146    extern
147    #ifdef __cplusplus
148    "C"
149    #endif
150    const char *_nl_expand_alias ();],
151                  [bindtextdomain ("", "");
152    return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings + *_nl_expand_alias (0)],
153                  gt_cv_func_gnugettext_libintl=yes,
154                  gt_cv_func_gnugettext_libintl=no)
155                dnl Now see whether libintl exists and depends on libiconv.
156                if test "$gt_cv_func_gnugettext_libintl" != yes && test -n "$LIBICONV"; then
157                  LIBS="$LIBS $LIBICONV"
158                  AC_TRY_LINK([#include <libintl.h>
159    extern int _nl_msg_cat_cntr;
160    extern int *_nl_domain_bindings;
161    extern
162    #ifdef __cplusplus
163    "C"
164    #endif
165    const char *_nl_expand_alias ();],
166                    [bindtextdomain ("", "");
167    return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings + *_nl_expand_alias (0)],
168                   [LIBINTL="$LIBINTL $LIBICONV"
169                    LTLIBINTL="$LTLIBINTL $LTLIBICONV"
170                    gt_cv_func_gnugettext_libintl=yes
171                   ])
172                fi
173                CPPFLAGS="$gt_save_CPPFLAGS"
174                LIBS="$gt_save_LIBS"])
175            fi
176    
177            dnl If an already present or preinstalled GNU gettext() is found,
178            dnl use it.  But if this macro is used in GNU gettext, and GNU
179            dnl gettext is already preinstalled in libintl, we update this
180            dnl libintl.  (Cf. the install rule in intl/Makefile.in.)
181            if test "$gt_cv_func_gnugettext_libc" = "yes" \
182               || { test "$gt_cv_func_gnugettext_libintl" = "yes" \
183                    && test "$PACKAGE" != gettext; }; then
184              gt_use_preinstalled_gnugettext=yes
185            else
186              dnl Reset the values set by searching for libintl.
187              LIBINTL=
188              LTLIBINTL=
189              INCINTL=
190            fi
191    
192          AC_CHECK_HEADER(libintl.h,      ifelse(gt_included_intl, yes, [
193            [AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,          if test "$gt_use_preinstalled_gnugettext" != "yes"; then
194              [AC_TRY_LINK([#include <libintl.h>            dnl GNU gettext is not found in the C library.
195  extern int _nl_msg_cat_cntr;],            dnl Fall back on included GNU gettext library.
196                 [bindtextdomain ("", "");            nls_cv_use_gnu_gettext=yes
 return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr],  
                gt_cv_func_gnugettext_libc=yes,  
                gt_cv_func_gnugettext_libc=no)])  
   
            if test "$gt_cv_func_gnugettext_libc" != "yes"; then  
              AC_CACHE_CHECK([for GNU gettext in libintl],  
                gt_cv_func_gnugettext_libintl,  
                [gt_save_LIBS="$LIBS"  
                 LIBS="$LIBS -lintl $LIBICONV"  
                 AC_TRY_LINK([#include <libintl.h>  
 extern int _nl_msg_cat_cntr;],  
                   [bindtextdomain ("", "");  
 return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr],  
                   gt_cv_func_gnugettext_libintl=yes,  
                   gt_cv_func_gnugettext_libintl=no)  
                 LIBS="$gt_save_LIBS"])  
            fi  
   
            dnl If an already present or preinstalled GNU gettext() is found,  
            dnl use it.  But if this macro is used in GNU gettext, and GNU  
            dnl gettext is already preinstalled in libintl, we update this  
            dnl libintl.  (Cf. the install rule in intl/Makefile.in.)  
            if test "$gt_cv_func_gnugettext_libc" = "yes" \  
               || { test "$gt_cv_func_gnugettext_libintl" = "yes" \  
                    && test "$PACKAGE" != gettext; }; then  
              AC_DEFINE(HAVE_GETTEXT, 1,  
                [Define if the GNU gettext() function is already present or preinstalled.])  
   
              if test "$gt_cv_func_gnugettext_libintl" = "yes"; then  
                dnl If iconv() is in a separate libiconv library, then anyone  
                dnl linking with libintl{.a,.so} also needs to link with  
                dnl libiconv.  
                INTLLIBS="-lintl $LIBICONV"  
              fi  
   
              gt_save_LIBS="$LIBS"  
              LIBS="$LIBS $INTLLIBS"  
              AC_CHECK_FUNCS(dcgettext)  
              LIBS="$gt_save_LIBS"  
   
              dnl Search for GNU msgfmt in the PATH.  
              AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,  
                [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :)  
              AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)  
   
              dnl Search for GNU xgettext in the PATH.  
              AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,  
                [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :)  
   
              CATOBJEXT=.gmo  
            fi  
         ])  
   
         if test "$CATOBJEXT" = "NONE"; then  
           dnl GNU gettext is not found in the C library.  
           dnl Fall back on GNU gettext library.  
           nls_cv_use_gnu_gettext=yes  
197          fi          fi
198        fi        fi
199    
200        if test "$nls_cv_use_gnu_gettext" = "yes"; then        if test "$nls_cv_use_gnu_gettext" = "yes"; then
201          dnl Mark actions used to generate GNU NLS library.          dnl Mark actions used to generate GNU NLS library.
202          INTLOBJS="\$(GETTOBJS)"          INTLOBJS="\$(GETTOBJS)"
203          AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,          BUILD_INCLUDED_LIBINTL=yes
204            [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :)          USE_INCLUDED_LIBINTL=yes
205          AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)          LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV"
206          AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,          LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV"
207            [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :)          LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
         AC_SUBST(MSGFMT)  
         BUILD_INCLUDED_LIBINTL=yes  
         USE_INCLUDED_LIBINTL=yes  
         CATOBJEXT=.gmo  
         INTLLIBS="ifelse([$3],[],\$(top_builddir)/intl,[$3])/libintl.ifelse([$1], use-libtool, [l], [])a $LIBICONV"  
         LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`  
208        fi        fi
209    
210        dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.        if test "$gt_use_preinstalled_gnugettext" = "yes" \
211        dnl Test whether we really found GNU msgfmt.           || test "$nls_cv_use_gnu_gettext" = "yes"; then
212        if test "$GMSGFMT" != ":"; then          dnl Mark actions to use GNU gettext tools.
213          dnl If it is no GNU msgfmt we define it as : so that the          CATOBJEXT=.gmo
         dnl Makefiles still can work.  
         if $GMSGFMT --statistics /dev/null >/dev/null 2>&1; then  
           : ;  
         else  
           AC_MSG_RESULT(  
             [found msgfmt program is not GNU msgfmt; ignore it])  
           GMSGFMT=":"  
         fi  
214        fi        fi
215        ])
216    
217        if test "$gt_use_preinstalled_gnugettext" = "yes" \
218           || test "$nls_cv_use_gnu_gettext" = "yes"; then
219          AC_DEFINE(ENABLE_NLS, 1,
220            [Define to 1 if translation of program messages to the user's native language
221       is requested.])
222        else
223          USE_NLS=no
224        fi
225      fi
226    
227      if test "$USE_NLS" = "yes"; then
228    
229        dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.      if test "$gt_use_preinstalled_gnugettext" = "yes"; then
230        dnl Test whether we really found GNU xgettext.        if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
231        if test "$XGETTEXT" != ":"; then          AC_MSG_CHECKING([how to link with libintl])
232          dnl If it is no GNU xgettext we define it as : so that the          AC_MSG_RESULT([$LIBINTL])
233          dnl Makefiles still can work.          AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL])
         if $XGETTEXT --omit-header /dev/null >/dev/null 2>&1; then  
           : ;  
         else  
           AC_MSG_RESULT(  
             [found xgettext program is not GNU xgettext; ignore it])  
           XGETTEXT=":"  
         fi  
234        fi        fi
235    
236        dnl We need to process the po/ directory.        dnl For backward compatibility. Some packages may be using this.
237        POSUB=po        AC_DEFINE(HAVE_GETTEXT, 1,
238           [Define if the GNU gettext() function is already present or preinstalled.])
239          AC_DEFINE(HAVE_DCGETTEXT, 1,
240           [Define if the GNU dcgettext() function is already present or preinstalled.])
241      fi      fi
     AC_OUTPUT_COMMANDS(  
      [for ac_file in $CONFIG_FILES; do  
         # Support "outfile[:infile[:infile...]]"  
         case "$ac_file" in  
           *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;  
         esac  
         # PO directories have a Makefile.in generated from Makefile.in.in.  
         case "$ac_file" in */Makefile.in)  
           # Adjust a relative srcdir.  
           ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`  
           ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"  
           ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`  
           # In autoconf-2.13 it is called $ac_given_srcdir.  
           # In autoconf-2.50 it is called $srcdir.  
           test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"  
           case "$ac_given_srcdir" in  
             .)  top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;  
             /*) top_srcdir="$ac_given_srcdir" ;;  
             *)  top_srcdir="$ac_dots$ac_given_srcdir" ;;  
           esac  
           if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then  
             rm -f "$ac_dir/POTFILES"  
             test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"  
             sed -e "/^#/d" -e "/^[      ]*\$/d" -e "s,.*,     $top_srcdir/& \\\\," -e "\$s/\(.*\) \\\\/\1/" < "$ac_given_srcdir/$ac_dir/POTFILES.in" > "$ac_dir/POTFILES"  
             test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"  
             sed -e "/POTFILES =/r $ac_dir/POTFILES" "$ac_dir/Makefile.in" > "$ac_dir/Makefile"  
           fi  
           ;;  
         esac  
       done])  
242    
243        dnl We need to process the po/ directory.
244        POSUB=po
245      fi
246    
247      ifelse(gt_included_intl, yes, [
248      dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL      dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
249      dnl to 'yes' because some of the testsuite requires it.      dnl to 'yes' because some of the testsuite requires it.
250      if test "$PACKAGE" = gettext; then      if test "$PACKAGE" = gettext; then
251        BUILD_INCLUDED_LIBINTL=yes        BUILD_INCLUDED_LIBINTL=yes
252      fi      fi
253    
     dnl intl/plural.c is generated from intl/plural.y. It requires bison,  
     dnl because plural.y uses bison specific features. It requires at least  
     dnl bison-1.26 because earlier versions generate a plural.c that doesn't  
     dnl compile.  
     dnl bison is only needed for the maintainer (who touches plural.y). But in  
     dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put  
     dnl the rule in general Makefile. Now, some people carelessly touch the  
     dnl files or have a broken "make" program, hence the plural.c rule will  
     dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not  
     dnl present or too old.  
     AC_CHECK_PROGS([INTLBISON], [bison])  
     if test -z "$INTLBISON"; then  
       ac_verc_fail=yes  
     else  
       dnl Found it, now check the version.  
       AC_MSG_CHECKING([version of bison])  
 changequote(<<,>>)dnl  
       ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`  
       case $ac_prog_version in  
         '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;  
         1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)  
 changequote([,])dnl  
            ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;  
         *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;  
       esac  
       AC_MSG_RESULT([$ac_prog_version])  
     fi  
     if test $ac_verc_fail = yes; then  
       INTLBISON=:  
     fi  
   
     dnl These rules are solely for the distribution goal.  While doing this  
     dnl we only have to keep exactly one list of the available catalogs  
     dnl in configure.in.  
     for lang in $ALL_LINGUAS; do  
       GMOFILES="$GMOFILES $lang.gmo"  
       POFILES="$POFILES $lang.po"  
     done  
   
254      dnl Make all variables we use known to autoconf.      dnl Make all variables we use known to autoconf.
255      AC_SUBST(BUILD_INCLUDED_LIBINTL)      AC_SUBST(BUILD_INCLUDED_LIBINTL)
256      AC_SUBST(USE_INCLUDED_LIBINTL)      AC_SUBST(USE_INCLUDED_LIBINTL)
     AC_SUBST(CATALOGS)  
257      AC_SUBST(CATOBJEXT)      AC_SUBST(CATOBJEXT)
     AC_SUBST(GMOFILES)  
     AC_SUBST(INTLLIBS)  
258      AC_SUBST(INTLOBJS)      AC_SUBST(INTLOBJS)
     AC_SUBST(POFILES)  
     AC_SUBST(POSUB)  
259    
260      dnl For backward compatibility. Some configure.ins may be using this.      dnl For backward compatibility. Some configure.ins may be using this.
261      nls_cv_header_intl=      nls_cv_header_intl=
# Line 291  changequote([,])dnl Line 272  changequote([,])dnl
272      dnl For backward compatibility. Some Makefiles may be using this.      dnl For backward compatibility. Some Makefiles may be using this.
273      GENCAT=gencat      GENCAT=gencat
274      AC_SUBST(GENCAT)      AC_SUBST(GENCAT)
275    
276        dnl Enable libtool support if the surrounding package wishes it.
277        INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix
278        AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
279    ])    ])
280    
281  dnl Usage: Just like AM_WITH_NLS, which see.    dnl For backward compatibility. Some Makefiles may be using this.
282  AC_DEFUN([AM_GNU_GETTEXT],    INTLLIBS="$LIBINTL"
283    [AC_REQUIRE([AC_PROG_MAKE_SET])dnl    AC_SUBST(INTLLIBS)
284     AC_REQUIRE([AC_PROG_CC])dnl  
285     AC_REQUIRE([AC_CANONICAL_HOST])dnl    dnl Make all documented variables known to autoconf.
286     AC_REQUIRE([AC_PROG_RANLIB])dnl    AC_SUBST(LIBINTL)
287     AC_REQUIRE([AC_ISC_POSIX])dnl    AC_SUBST(LTLIBINTL)
288     AC_REQUIRE([AC_HEADER_STDC])dnl    AC_SUBST(POSUB)
289     AC_REQUIRE([AC_C_CONST])dnl  ])
290     AC_REQUIRE([AC_C_INLINE])dnl  
291     AC_REQUIRE([AC_TYPE_OFF_T])dnl  
292     AC_REQUIRE([AC_TYPE_SIZE_T])dnl  dnl Checks for all prerequisites of the po subdirectory,
293     AC_REQUIRE([AC_FUNC_ALLOCA])dnl  dnl except for USE_NLS.
294     AC_REQUIRE([AC_FUNC_MMAP])dnl  AC_DEFUN([AM_PO_SUBDIRS],
295     AC_REQUIRE([jm_GLIBC21])dnl  [
296      AC_REQUIRE([AC_PROG_MAKE_SET])dnl
297      AC_REQUIRE([AC_PROG_INSTALL])dnl
298      AC_REQUIRE([AM_MKINSTALLDIRS])dnl
299    
300      dnl Perform the following tests also if --disable-nls has been given,
301      dnl because they are needed for "make dist" to work.
302    
303      dnl Search for GNU msgfmt in the PATH.
304      dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions.
305      dnl The second test excludes FreeBSD msgfmt.
306      AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
307        [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 &&
308         (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
309        :)
310      AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
311    
312      dnl Search for GNU xgettext 0.11 or newer in the PATH.
313      dnl The first test excludes Solaris xgettext and early GNU xgettext versions.
314      dnl The second test excludes FreeBSD xgettext.
315      AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
316        [$ac_dir/$ac_word --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 &&
317         (if $ac_dir/$ac_word --omit-header --copyright-holder= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
318        :)
319      dnl Remove leftover from FreeBSD xgettext call.
320      rm -f messages.po
321    
322      dnl Search for GNU msgmerge 0.11 or newer in the PATH.
323      AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge,
324        [$ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1], :)
325    
326      dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
327      dnl Test whether we really found GNU msgfmt.
328      if test "$GMSGFMT" != ":"; then
329        dnl If it is no GNU msgfmt we define it as : so that the
330        dnl Makefiles still can work.
331        if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 &&
332           (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
333          : ;
334        else
335          GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'`
336          AC_MSG_RESULT(
337            [found $GMSGFMT program is not GNU msgfmt; ignore it])
338          GMSGFMT=":"
339        fi
340      fi
341    
342     AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \    dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
343      dnl Test whether we really found GNU xgettext.
344      if test "$XGETTEXT" != ":"; then
345        dnl If it is no GNU xgettext we define it as : so that the
346        dnl Makefiles still can work.
347        if $XGETTEXT --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 &&
348           (if $XGETTEXT --omit-header --copyright-holder= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
349          : ;
350        else
351          AC_MSG_RESULT(
352            [found xgettext program is not GNU xgettext; ignore it])
353          XGETTEXT=":"
354        fi
355        dnl Remove leftover from FreeBSD xgettext call.
356        rm -f messages.po
357      fi
358    
359      AC_OUTPUT_COMMANDS([
360        for ac_file in $CONFIG_FILES; do
361          # Support "outfile[:infile[:infile...]]"
362          case "$ac_file" in
363            *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
364          esac
365          # PO directories have a Makefile.in generated from Makefile.in.in.
366          case "$ac_file" in */Makefile.in)
367            # Adjust a relative srcdir.
368            ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
369            ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
370            ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
371            # In autoconf-2.13 it is called $ac_given_srcdir.
372            # In autoconf-2.50 it is called $srcdir.
373            test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
374            case "$ac_given_srcdir" in
375              .)  top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
376              /*) top_srcdir="$ac_given_srcdir" ;;
377              *)  top_srcdir="$ac_dots$ac_given_srcdir" ;;
378            esac
379            if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
380              rm -f "$ac_dir/POTFILES"
381              test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
382              cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[   ]*\$/d" -e "s,.*,     $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES"
383              # ALL_LINGUAS, POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES depend
384              # on $ac_dir but don't depend on user-specified configuration
385              # parameters.
386              if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
387                # The LINGUAS file contains the set of available languages.
388                if test -n "$ALL_LINGUAS"; then
389                  test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
390                fi
391                ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"`
392                # Hide the ALL_LINGUAS assigment from automake.
393                eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
394              fi
395              case "$ac_given_srcdir" in
396                .) srcdirpre= ;;
397                *) srcdirpre='$(srcdir)/' ;;
398              esac
399              POFILES=
400              GMOFILES=
401              UPDATEPOFILES=
402              DUMMYPOFILES=
403              for lang in $ALL_LINGUAS; do
404                POFILES="$POFILES $srcdirpre$lang.po"
405                GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
406                UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
407                DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
408              done
409              # CATALOGS depends on both $ac_dir and the user's LINGUAS
410              # environment variable.
411              INST_LINGUAS=
412              if test -n "$ALL_LINGUAS"; then
413                for presentlang in $ALL_LINGUAS; do
414                  useit=no
415                  if test "%UNSET%" != "$LINGUAS"; then
416                    desiredlanguages="$LINGUAS"
417                  else
418                    desiredlanguages="$ALL_LINGUAS"
419                  fi
420                  for desiredlang in $desiredlanguages; do
421                    # Use the presentlang catalog if desiredlang is
422                    #   a. equal to presentlang, or
423                    #   b. a variant of presentlang (because in this case,
424                    #      presentlang can be used as a fallback for messages
425                    #      which are not translated in the desiredlang catalog).
426                    case "$desiredlang" in
427                      "$presentlang"*) useit=yes;;
428                    esac
429                  done
430                  if test $useit = yes; then
431                    INST_LINGUAS="$INST_LINGUAS $presentlang"
432                  fi
433                done
434              fi
435              CATALOGS=
436              if test -n "$INST_LINGUAS"; then
437                for lang in $INST_LINGUAS; do
438                  CATALOGS="$CATALOGS $lang.gmo"
439                done
440              fi
441              test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
442              sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile"
443              for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do
444                if test -f "$f"; then
445                  case "$f" in
446                    *.orig | *.bak | *~) ;;
447                    *) cat "$f" >> "$ac_dir/Makefile" ;;
448                  esac
449                fi
450              done
451            fi
452            ;;
453          esac
454        done],
455       [# Capture the value of obsolete $ALL_LINGUAS because we need it to compute
456        # POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES, CATALOGS. But hide it
457        # from automake.
458        eval 'ALL_LINGUAS''="$ALL_LINGUAS"'
459        # Capture the value of LINGUAS because we need it to compute CATALOGS.
460        LINGUAS="${LINGUAS-%UNSET%}"
461       ])
462    ])
463    
464    
465    dnl Checks for all prerequisites of the intl subdirectory,
466    dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS,
467    dnl            USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL.
468    AC_DEFUN([AM_INTL_SUBDIR],
469    [
470      AC_REQUIRE([AC_PROG_INSTALL])dnl
471      AC_REQUIRE([AM_MKINSTALLDIRS])dnl
472      AC_REQUIRE([AC_PROG_CC])dnl
473      AC_REQUIRE([AC_CANONICAL_HOST])dnl
474      AC_REQUIRE([AC_PROG_RANLIB])dnl
475      AC_REQUIRE([AC_ISC_POSIX])dnl
476      AC_REQUIRE([AC_HEADER_STDC])dnl
477      AC_REQUIRE([AC_C_CONST])dnl
478      AC_REQUIRE([AC_C_INLINE])dnl
479      AC_REQUIRE([AC_TYPE_OFF_T])dnl
480      AC_REQUIRE([AC_TYPE_SIZE_T])dnl
481      AC_REQUIRE([AC_FUNC_ALLOCA])dnl
482      AC_REQUIRE([AC_FUNC_MMAP])dnl
483      AC_REQUIRE([jm_GLIBC21])dnl
484    
485      AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
486  stdlib.h string.h unistd.h sys/param.h])  stdlib.h string.h unistd.h sys/param.h])
487     AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getcwd getegid geteuid \    AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getc_unlocked getcwd getegid \
488  getgid getuid mempcpy munmap putenv setenv setlocale stpcpy strchr strcasecmp \  geteuid getgid getuid mempcpy munmap putenv setenv setlocale stpcpy \
489  strdup strtoul tsearch __argz_count __argz_stringify __argz_next])  strcasecmp strdup strtoul tsearch __argz_count __argz_stringify __argz_next])
490    
491     AM_ICONV    AM_ICONV
492     AM_LANGINFO_CODESET    AM_LANGINFO_CODESET
493     AM_LC_MESSAGES    AM_LC_MESSAGES
494     AM_WITH_NLS([$1],[$2],[$3])  
495      dnl intl/plural.c is generated from intl/plural.y. It requires bison,
496     if test "x$CATOBJEXT" != "x"; then    dnl because plural.y uses bison specific features. It requires at least
497       if test "x$ALL_LINGUAS" = "x"; then    dnl bison-1.26 because earlier versions generate a plural.c that doesn't
498         LINGUAS=    dnl compile.
499       else    dnl bison is only needed for the maintainer (who touches plural.y). But in
500         AC_MSG_CHECKING(for catalogs to be installed)    dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
501         NEW_LINGUAS=    dnl the rule in general Makefile. Now, some people carelessly touch the
502         for presentlang in $ALL_LINGUAS; do    dnl files or have a broken "make" program, hence the plural.c rule will
503           useit=no    dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
504           for desiredlang in ${LINGUAS-$ALL_LINGUAS}; do    dnl present or too old.
505             # Use the presentlang catalog if desiredlang is    AC_CHECK_PROGS([INTLBISON], [bison])
506             #   a. equal to presentlang, or    if test -z "$INTLBISON"; then
507             #   b. a variant of presentlang (because in this case,      ac_verc_fail=yes
508             #      presentlang can be used as a fallback for messages    else
509             #      which are not translated in the desiredlang catalog).      dnl Found it, now check the version.
510             case "$desiredlang" in      AC_MSG_CHECKING([version of bison])
511               "$presentlang"*) useit=yes;;  changequote(<<,>>)dnl
512             esac      ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
513           done      case $ac_prog_version in
514           if test $useit = yes; then        '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
515             NEW_LINGUAS="$NEW_LINGUAS $presentlang"        1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
516           fi  changequote([,])dnl
517         done           ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
518         LINGUAS=$NEW_LINGUAS        *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
519         AC_MSG_RESULT($LINGUAS)      esac
520       fi      AC_MSG_RESULT([$ac_prog_version])
521      fi
522       dnl Construct list of names of catalog files to be constructed.    if test $ac_verc_fail = yes; then
523       if test -n "$LINGUAS"; then      INTLBISON=:
524         for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done    fi
525       fi  ])
526     fi  
527    
528     dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly  AC_DEFUN([AM_MKINSTALLDIRS],
529     dnl find the mkinstalldirs script in another subdir but $(top_srcdir).  [
530     dnl Try to locate is.    dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
531     MKINSTALLDIRS=    dnl find the mkinstalldirs script in another subdir but $(top_srcdir).
532     if test -n "$ac_aux_dir"; then    dnl Try to locate is.
533       MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"    MKINSTALLDIRS=
534     fi    if test -n "$ac_aux_dir"; then
535     if test -z "$MKINSTALLDIRS"; then      MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
536       MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"    fi
537     fi    if test -z "$MKINSTALLDIRS"; then
538     AC_SUBST(MKINSTALLDIRS)      MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
539      fi
540     dnl Enable libtool support if the surrounding package wishes it.    AC_SUBST(MKINSTALLDIRS)
541     INTL_LIBTOOL_SUFFIX_PREFIX=ifelse([$1], use-libtool, [l], [])  ])
    AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)  
   ])  

Legend:
Removed from v.1.3.2.1  
changed lines
  Added in v.1.3.2.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26