| 14 | | # serial 105 |
| 15 | | |
| 16 | | AC_DEFUN(MUTT_AM_WITH_NLS, |
| | 13 | # serial 109 |
| | 14 | |
| | 15 | dnl Usage: AM_WITH_NLS([TOOLSYMBOL], [NEEDSYMBOL], [LIBDIR]). |
| | 16 | dnl If TOOLSYMBOL is specified and is 'use-libtool', then a libtool library |
| | 17 | dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static, |
| | 18 | dnl depending on --{enable,disable}-{shared,static} and on the presence of |
| | 19 | dnl AM-DISABLE-SHARED). Otherwise, a static library |
| | 20 | dnl $(top_builddir)/intl/libintl.a will be created. |
| | 21 | dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext |
| | 22 | dnl implementations (in libc or libintl) without the ngettext() function |
| | 23 | dnl will be ignored. |
| | 24 | dnl LIBDIR is used to find the intl libraries. If empty, |
| | 25 | dnl the value `$(top_builddir)/intl/' is used. |
| | 26 | dnl |
| | 27 | dnl The result of the configuration is one of three cases: |
| | 28 | dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled |
| | 29 | dnl and used. |
| | 30 | dnl Catalog format: GNU --> install in $(datadir) |
| | 31 | dnl Catalog extension: .mo after installation, .gmo in source tree |
| | 32 | dnl 2) GNU gettext has been found in the system's C library. |
| | 33 | dnl Catalog format: GNU --> install in $(datadir) |
| | 34 | dnl Catalog extension: .mo after installation, .gmo in source tree |
| | 35 | dnl 3) No internationalization, always use English msgid. |
| | 36 | dnl Catalog format: none |
| | 37 | dnl Catalog extension: none |
| | 38 | dnl The use of .gmo is historical (it was needed to avoid overwriting the |
| | 39 | dnl GNU format catalogs when building on a platform with an X/Open gettext), |
| | 40 | dnl but we keep it in order not to force irrelevant filename changes on the |
| | 41 | dnl maintainers. |
| | 42 | dnl |
| | 43 | AC_DEFUN([MUTT_AM_WITH_NLS], |
| 48 | | [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc, |
| 49 | | [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")], |
| 50 | | gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)]) |
| 51 | | |
| 52 | | if test "$gt_cv_func_gettext_libc" != "yes"; then |
| 53 | | AC_CHECK_LIB(intl, bindtextdomain, |
| 54 | | [AC_CHECK_LIB(intl, gettext, |
| 55 | | gt_cv_func_gettext_libintl=yes, |
| 56 | | gt_cv_func_gettext_libintl=no)]) |
| | 80 | [AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc, |
| | 81 | [AC_TRY_LINK([#include <libintl.h> |
| | 82 | extern int _nl_msg_cat_cntr;], |
| | 83 | [bindtextdomain ("", ""); |
| | 84 | return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr], |
| | 85 | gt_cv_func_gnugettext_libc=yes, |
| | 86 | gt_cv_func_gnugettext_libc=no)]) |
| | 87 | |
| | 88 | if test "$gt_cv_func_gnugettext_libc" != "yes"; then |
| | 89 | AC_CACHE_CHECK([for GNU gettext in libintl], |
| | 90 | gt_cv_func_gnugettext_libintl, |
| | 91 | [gt_save_LIBS="$LIBS" |
| | 92 | LIBS="$LIBS -lintl $LIBICONV" |
| | 93 | AC_TRY_LINK([#include <libintl.h> |
| | 94 | extern int _nl_msg_cat_cntr;], |
| | 95 | [bindtextdomain ("", ""); |
| | 96 | return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr], |
| | 97 | gt_cv_func_gnugettext_libintl=yes, |
| | 98 | gt_cv_func_gnugettext_libintl=no) |
| | 99 | LIBS="$gt_save_LIBS"]) |
| 58 | | |
| 59 | | if test "$gt_cv_func_gettext_libintl" = yes; then |
| 60 | | LIBS="$LIBS -lintl" |
| | 101 | |
| | 102 | dnl If an already present or preinstalled GNU gettext() is found, |
| | 103 | dnl use it. But if this macro is used in GNU gettext, and GNU |
| | 104 | dnl gettext is already preinstalled in libintl, we update this |
| | 105 | dnl libintl. (Cf. the install rule in intl/Makefile.in.) |
| | 106 | if test "$gt_cv_func_gnugettext_libc" = "yes" \ |
| | 107 | || { test "$gt_cv_func_gnugettext_libintl" = "yes" \ |
| | 108 | && test "$PACKAGE" != gettext; }; then |
| | 109 | AC_DEFINE(HAVE_GETTEXT, 1, |
| | 110 | [Define if the GNU gettext() function is already present or preinstalled.]) |
| | 111 | |
| | 112 | if test "$gt_cv_func_gnugettext_libintl" = "yes"; then |
| | 113 | dnl If iconv() is in a separate libiconv library, then anyone |
| | 114 | dnl linking with libintl{.a,.so} also needs to link with |
| | 115 | dnl libiconv. |
| | 116 | INTLLIBS="-lintl $LIBICONV" |
| | 117 | fi |
| | 118 | |
| | 119 | gt_save_LIBS="$LIBS" |
| | 120 | LIBS="$LIBS $INTLLIBS" |
| | 121 | AC_CHECK_FUNCS(dcgettext) |
| | 122 | LIBS="$gt_save_LIBS" |
| | 123 | |
| | 124 | MUTT_AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, |
| | 125 | [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl |
| | 126 | if test "$MSGFMT" != "no"; then |
| | 127 | AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) |
| | 128 | fi |
| | 129 | |
| | 130 | MUTT_AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, |
| | 131 | [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) |
| | 132 | |
| | 133 | CATOBJEXT=.gmo |
| 62 | | |
| 63 | | if test "$gt_cv_func_gettext_libc" = "yes" \ |
| 64 | | || test "$gt_cv_func_gettext_libintl" = "yes"; then |
| 65 | | AC_DEFINE(HAVE_GETTEXT) |
| 66 | | MUTT_AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, |
| 67 | | [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl |
| 68 | | if test "$MSGFMT" != "no"; then |
| 69 | | AC_CHECK_FUNCS(dcgettext) |
| 70 | | AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) |
| 71 | | MUTT_AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, |
| 72 | | [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) |
| 73 | | AC_TRY_LINK(, [extern int _nl_msg_cat_cntr; |
| 74 | | return _nl_msg_cat_cntr], |
| 75 | | [CATOBJEXT=.gmo |
| 76 | | DATADIRNAME=share], |
| 77 | | [CATOBJEXT=.mo |
| 78 | | DATADIRNAME=lib]) |
| 79 | | INSTOBJEXT=.mo |
| 80 | | fi |
| 81 | | fi |
| 85 | | AC_MSG_CHECKING([whether catgets can be used]) |
| 86 | | AC_ARG_WITH(catgets, |
| 87 | | [ --with-catgets Use catgets functions if available], |
| 88 | | nls_cv_use_catgets=$withval, nls_cv_use_catgets=no) |
| 89 | | AC_MSG_RESULT($nls_cv_use_catgets) |
| 90 | | |
| 91 | | if test "$nls_cv_use_catgets" = "yes"; then |
| 92 | | dnl No gettext in C library. Try catgets next. |
| 93 | | AC_CHECK_LIB(i, main) |
| 94 | | AC_CHECK_FUNC(catgets, |
| 95 | | [AC_DEFINE(HAVE_CATGETS) |
| 96 | | INTLOBJS="\$(CATOBJS)" |
| 97 | | AC_PATH_PROG(GENCAT, gencat, no)dnl |
| 98 | | if test "$GENCAT" != "no"; then |
| 99 | | AC_PATH_PROG(GMSGFMT, gmsgfmt, no) |
| 100 | | if test "$GMSGFMT" = "no"; then |
| 101 | | MUTT_AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt, |
| 102 | | [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no) |
| 103 | | fi |
| 104 | | MUTT_AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, |
| 105 | | [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) |
| 106 | | USE_INCLUDED_LIBINTL=yes |
| 107 | | CATOBJEXT=.cat |
| 108 | | INSTOBJEXT=.cat |
| 109 | | DATADIRNAME=lib |
| 110 | | INTLDEPS='$(top_builddir)/intl/libintl.a' |
| 111 | | INTLLIBS=$INTLDEPS |
| 112 | | LIBS=`echo $LIBS | sed -e 's/-lintl//'` |
| 113 | | nls_cv_header_intl=intl/libintl.h |
| 114 | | nls_cv_header_libgt=intl/libgettext.h |
| 115 | | fi]) |
| 116 | | fi |
| 117 | | fi |
| 118 | | |
| 119 | | if test "$CATOBJEXT" = "NONE"; then |
| 120 | | dnl Neither gettext nor catgets in included in the C library. |
| | 138 | dnl GNU gettext is not found in the C library. |
| 137 | | INSTOBJEXT=.mo |
| 138 | | DATADIRNAME=share |
| 139 | | INTLDEPS='$(top_builddir)/intl/libintl.a' |
| 140 | | INTLLIBS=$INTLDEPS |
| 141 | | LIBS=`echo $LIBS | sed -e 's/-lintl//'` |
| 142 | | nls_cv_header_intl=intl/libintl.h |
| 143 | | nls_cv_header_libgt=intl/libgettext.h |
| | 156 | INTLLIBS="ifelse([$3],[],\$(top_builddir)/intl,[$3])/libintl.ifelse([$1], use-libtool, [l], [])a $LIBICONV" |
| | 157 | LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` |
| | 175 | fi |
| | 176 | AC_OUTPUT_COMMANDS( |
| | 177 | [for ac_file in $CONFIG_FILES; do |
| | 178 | # Support "outfile[:infile[:infile...]]" |
| | 179 | case "$ac_file" in |
| | 180 | *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; |
| | 181 | esac |
| | 182 | # PO directories have a Makefile.in generated from Makefile.in.in. |
| | 183 | case "$ac_file" in */Makefile.in) |
| | 184 | # Adjust a relative srcdir. |
| | 185 | ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` |
| | 186 | ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" |
| | 187 | ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` |
| | 188 | case "$ac_given_srcdir" in |
| | 189 | .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; |
| | 190 | /*) top_srcdir="$ac_given_srcdir" ;; |
| | 191 | *) top_srcdir="$ac_dots$ac_given_srcdir" ;; |
| | 192 | esac |
| | 193 | if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then |
| | 194 | rm -f "$ac_dir/POTFILES" |
| | 195 | echo creating "$ac_dir/POTFILES" |
| | 196 | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," -e "\$s/\(.*\) \\\\/\1/" < "$ac_given_srcdir/$ac_dir/POTFILES.in" > "$ac_dir/POTFILES" |
| | 197 | echo creating "$ac_dir/Makefile" |
| | 198 | sed -e "/POTFILES =/r $ac_dir/POTFILES" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" |
| | 199 | fi |
| | 200 | ;; |
| | 201 | esac |
| | 202 | done]) |
| | 203 | |
| | 204 | |
| | 205 | dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL |
| | 206 | dnl to 'yes' because some of the testsuite requires it. |
| | 207 | if test "$PACKAGE" = gettext; then |
| | 208 | BUILD_INCLUDED_LIBINTL=yes |
| | 209 | fi |
| | 210 | |
| | 211 | dnl intl/plural.c is generated from intl/plural.y. It requires bison, |
| | 212 | dnl because plural.y uses bison specific features. It requires at least |
| | 213 | dnl bison-1.26 because earlier versions generate a plural.c that doesn't |
| | 214 | dnl compile. |
| | 215 | dnl bison is only needed for the maintainer (who touches plural.y). But in |
| | 216 | dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put |
| | 217 | dnl the rule in general Makefile. Now, some people carelessly touch the |
| | 218 | dnl files or have a broken "make" program, hence the plural.c rule will |
| | 219 | dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not |
| | 220 | dnl present or too old. |
| | 221 | AC_CHECK_PROGS([INTLBISON], [bison]) |
| | 222 | if test -z "$INTLBISON"; then |
| | 223 | ac_verc_fail=yes |
| 162 | | DATADIRNAME=share |
| 163 | | nls_cv_header_intl=intl/libintl.h |
| 164 | | nls_cv_header_libgt=intl/libgettext.h |
| | 225 | dnl Found it, now check the version. |
| | 226 | AC_MSG_CHECKING([version of bison]) |
| | 227 | changequote(<<,>>)dnl |
| | 228 | ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison .* \([0-9]*\.[0-9.]*\).*$/\1/p'` |
| | 229 | case $ac_prog_version in |
| | 230 | '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; |
| | 231 | 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*) |
| | 232 | changequote([,])dnl |
| | 233 | ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; |
| | 234 | *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; |
| | 235 | esac |
| | 236 | AC_MSG_RESULT([$ac_prog_version]) |
| 166 | | if test -z "$nsl_cv_header_intl"; then |
| 167 | | # Clean out junk possibly left behind by a previous configuration. |
| 168 | | rm -f intl/libintl.h |
| 169 | | fi |
| 170 | | AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl) |
| 171 | | AC_OUTPUT_COMMANDS( |
| 172 | | [case "$CONFIG_FILES" in *po/Makefile.in*) |
| 173 | | sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile |
| 174 | | esac]) |
| 175 | | |
| 176 | | |
| 177 | | # If this is used in GNU gettext we have to set USE_NLS to `yes' |
| 178 | | # because some of the sources are only built for this goal. |
| 179 | | if test "$PACKAGE" = gettext; then |
| 180 | | USE_NLS=yes |
| 181 | | USE_INCLUDED_LIBINTL=yes |
| | 238 | if test $ac_verc_fail = yes; then |
| | 239 | INTLBISON=: |
| 218 | | |
| 219 | | AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \ |
| 220 | | unistd.h sys/param.h]) |
| 221 | | AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \ |
| 222 | | strdup __argz_count __argz_stringify __argz_next]) |
| 223 | | |
| 224 | | if test "${ac_cv_func_stpcpy+set}" != "set"; then |
| 225 | | AC_CHECK_FUNCS(stpcpy) |
| 226 | | fi |
| 227 | | if test "${ac_cv_func_stpcpy}" = "yes"; then |
| 228 | | AC_DEFINE(HAVE_STPCPY) |
| 229 | | fi |
| 230 | | |
| | 293 | AC_REQUIRE([jm_GLIBC21])dnl |
| | 294 | |
| | 295 | AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \ |
| | 296 | stdlib.h string.h unistd.h sys/param.h]) |
| | 297 | AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getcwd getegid geteuid \ |
| | 298 | getgid getuid mempcpy munmap putenv setenv setlocale stpcpy strchr strcasecmp \ |
| | 299 | strdup strtoul tsearch __argz_count __argz_stringify __argz_next]) |
| | 300 | |
| | 301 | MUTT_AM_ICONV |
| | 302 | MUTT_AM_LANGINFO_CODESET |
| 240 | | for lang in ${LINGUAS=$ALL_LINGUAS}; do |
| 241 | | case "$ALL_LINGUAS" in |
| 242 | | *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;; |
| 243 | | esac |
| | 312 | for presentlang in $ALL_LINGUAS; do |
| | 313 | useit=no |
| | 314 | for desiredlang in ${LINGUAS-$ALL_LINGUAS}; do |
| | 315 | # Use the presentlang catalog if desiredlang is |
| | 316 | # a. equal to presentlang, or |
| | 317 | # b. a variant of presentlang (because in this case, |
| | 318 | # presentlang can be used as a fallback for messages |
| | 319 | # which are not translated in the desiredlang catalog). |
| | 320 | case "$desiredlang" in |
| | 321 | "$presentlang"*) useit=yes;; |
| | 322 | esac |
| | 323 | done |
| | 324 | if test $useit = yes; then |
| | 325 | NEW_LINGUAS="$NEW_LINGUAS $presentlang" |
| | 326 | fi |
| 255 | | dnl The reference to <locale.h> in the installed <libintl.h> file |
| 256 | | dnl must be resolved because we cannot expect the users of this |
| 257 | | dnl to define HAVE_LOCALE_H. |
| 258 | | if test $ac_cv_header_locale_h = yes; then |
| 259 | | INCLUDE_LOCALE_H="#include <locale.h>" |
| 260 | | else |
| 261 | | INCLUDE_LOCALE_H="\ |
| 262 | | /* The system does not provide the header <locale.h>. Take care yourself. */" |
| 263 | | fi |
| 264 | | AC_SUBST(INCLUDE_LOCALE_H) |
| 265 | | |
| 266 | | dnl Determine which catalog format we have (if any is needed) |
| 267 | | dnl For now we know about two different formats: |
| 268 | | dnl Linux libc-5 and the normal X/Open format |
| 269 | | test -d intl || mkdir intl |
| 270 | | if test "$CATOBJEXT" = ".cat"; then |
| 271 | | AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen) |
| 272 | | |
| 273 | | dnl Transform the SED scripts while copying because some dumb SEDs |
| 274 | | dnl cannot handle comments. |
| 275 | | sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed |
| 276 | | fi |
| 277 | | dnl po2tbl.sed is always needed. |
| 278 | | sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \ |
| 279 | | $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed |
| 280 | | |
| 281 | | dnl In the intl/Makefile.in we have a special dependency which makes |
| 282 | | dnl only sense for gettext. We comment this out for non-gettext |
| 283 | | dnl packages. |
| 284 | | if test "$PACKAGE" = "gettext"; then |
| 285 | | GT_NO="#NO#" |
| 286 | | GT_YES= |
| 287 | | else |
| 288 | | GT_NO= |
| 289 | | GT_YES="#YES#" |
| 290 | | fi |
| 291 | | AC_SUBST(GT_NO) |
| 292 | | AC_SUBST(GT_YES) |
| 293 | | |
| 306 | | dnl *** For now the libtool support in intl/Makefile is not for real. |
| 307 | | l= |
| 308 | | AC_SUBST(l) |
| 309 | | |
| 310 | | dnl Generate list of files to be processed by xgettext which will |
| 311 | | dnl be included in po/Makefile. |
| 312 | | test -d po || mkdir po |
| 313 | | if test "x$srcdir" != "x."; then |
| 314 | | if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then |
| 315 | | posrcprefix="$srcdir/" |
| 316 | | else |
| 317 | | posrcprefix="../$srcdir/" |
| 318 | | fi |
| 319 | | else |
| 320 | | posrcprefix="../" |
| 321 | | fi |
| 322 | | rm -f po/POTFILES |
| 323 | | sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \ |
| 324 | | < $srcdir/po/POTFILES.in > po/POTFILES |
| | 350 | dnl Enable libtool support if the surrounding package wishes it. |
| | 351 | INTL_LIBTOOL_SUFFIX_PREFIX=ifelse([$1], use-libtool, [l], []) |
| | 352 | AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX) |