| [10] | 1 | # This file is derived from `gettext.m4'. The difference is that the
|
|---|
| 2 | # included macros assume Cygnus-style source and build trees.
|
|---|
| 3 |
|
|---|
| 4 | # Macro to add for using GNU gettext.
|
|---|
| 5 | # Ulrich Drepper <[email protected]>, 1995.
|
|---|
| 6 | #
|
|---|
| 7 | # This file file be copied and used freely without restrictions. It can
|
|---|
| 8 | # be used in projects which are not available under the GNU Public License
|
|---|
| 9 | # but which still want to provide support for the GNU gettext functionality.
|
|---|
| 10 | # Please note that the actual code is *not* freely available.
|
|---|
| 11 |
|
|---|
| 12 | # serial 3
|
|---|
| 13 |
|
|---|
| 14 | AC_DEFUN(CY_WITH_NLS,
|
|---|
| 15 | [AC_MSG_CHECKING([whether NLS is requested])
|
|---|
| 16 | dnl Default is enabled NLS
|
|---|
| 17 | AC_ARG_ENABLE(nls,
|
|---|
| 18 | [ --disable-nls do not use Native Language Support],
|
|---|
| 19 | USE_NLS=$enableval, USE_NLS=yes)
|
|---|
| 20 | AC_MSG_RESULT($USE_NLS)
|
|---|
| 21 | AC_SUBST(USE_NLS)
|
|---|
| 22 |
|
|---|
| 23 | USE_INCLUDED_LIBINTL=no
|
|---|
| 24 |
|
|---|
| 25 | dnl If we use NLS figure out what method
|
|---|
| 26 | if test "$USE_NLS" = "yes"; then
|
|---|
| 27 | AC_DEFINE(ENABLE_NLS, 1, [Define to 1 if NLS is requested])
|
|---|
| 28 | AC_MSG_CHECKING([whether included gettext is requested])
|
|---|
| 29 | AC_ARG_WITH(included-gettext,
|
|---|
| 30 | [ --with-included-gettext use the GNU gettext library included here],
|
|---|
| 31 | nls_cv_force_use_gnu_gettext=$withval,
|
|---|
| 32 | nls_cv_force_use_gnu_gettext=no)
|
|---|
| 33 | AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
|
|---|
| 34 |
|
|---|
| 35 | nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
|
|---|
| 36 | if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
|
|---|
| 37 | dnl User does not insist on using GNU NLS library. Figure out what
|
|---|
| 38 | dnl to use. If gettext or catgets are available (in this order) we
|
|---|
| 39 | dnl use this. Else we have to fall back to GNU NLS library.
|
|---|
| 40 | dnl catgets is only used if permitted by option --with-catgets.
|
|---|
| 41 | nls_cv_header_intl=
|
|---|
| 42 | nls_cv_header_libgt=
|
|---|
| 43 | CATOBJEXT=NONE
|
|---|
| 44 |
|
|---|
| 45 | AC_CHECK_HEADER(libintl.h,
|
|---|
| 46 | [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
|
|---|
| 47 | [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
|
|---|
| 48 | gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
|
|---|
| 49 |
|
|---|
| 50 | if test "$gt_cv_func_gettext_libc" != "yes"; then
|
|---|
| 51 | AC_CHECK_LIB(intl, bindtextdomain,
|
|---|
| 52 | [AC_CACHE_CHECK([for gettext in libintl],
|
|---|
| 53 | gt_cv_func_gettext_libintl,
|
|---|
| 54 | [AC_TRY_LINK([], [return (int) gettext ("")],
|
|---|
| 55 | gt_cv_func_gettext_libintl=yes,
|
|---|
| 56 | gt_cv_func_gettext_libintl=no)])])
|
|---|
| 57 | fi
|
|---|
| 58 |
|
|---|
| 59 | if test "$gt_cv_func_gettext_libc" = "yes" \
|
|---|
| 60 | || test "$gt_cv_func_gettext_libintl" = "yes"; then
|
|---|
| 61 | AC_DEFINE(HAVE_GETTEXT, 1,
|
|---|
| 62 | [Define as 1 if you have gettext and don't want to use GNU gettext.])
|
|---|
| 63 | AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
|
|---|
| 64 | [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
|
|---|
| 65 | if test "$MSGFMT" != "no"; then
|
|---|
| 66 | AC_CHECK_FUNCS(dcgettext)
|
|---|
| 67 | AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
|
|---|
| 68 | AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
|
|---|
| 69 | [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
|
|---|
| 70 | AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
|
|---|
| 71 | return _nl_msg_cat_cntr],
|
|---|
| 72 | [CATOBJEXT=.gmo
|
|---|
| 73 | DATADIRNAME=share],
|
|---|
| 74 | [CATOBJEXT=.mo
|
|---|
| 75 | DATADIRNAME=lib])
|
|---|
| 76 | INSTOBJEXT=.mo
|
|---|
| 77 | fi
|
|---|
| 78 | fi
|
|---|
| 79 | ])
|
|---|
| 80 |
|
|---|
| 81 | dnl In the standard gettext, we would now check for catgets.
|
|---|
| 82 | dnl However, we never want to use catgets for our releases.
|
|---|
| 83 |
|
|---|
| 84 | if test "$CATOBJEXT" = "NONE"; then
|
|---|
| 85 | dnl Neither gettext nor catgets in included in the C library.
|
|---|
| 86 | dnl Fall back on GNU gettext library.
|
|---|
| 87 | nls_cv_use_gnu_gettext=yes
|
|---|
| 88 | fi
|
|---|
| 89 | fi
|
|---|
| 90 |
|
|---|
| 91 | if test "$nls_cv_use_gnu_gettext" = "yes"; then
|
|---|
| 92 | dnl Mark actions used to generate GNU NLS library.
|
|---|
| 93 | INTLOBJS="\$(GETTOBJS)"
|
|---|
| 94 | AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
|
|---|
| 95 | [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
|
|---|
| 96 | AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
|
|---|
| 97 | AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
|
|---|
| 98 | [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
|
|---|
| 99 | AC_SUBST(MSGFMT)
|
|---|
| 100 | USE_INCLUDED_LIBINTL=yes
|
|---|
| 101 | CATOBJEXT=.gmo
|
|---|
| 102 | INSTOBJEXT=.mo
|
|---|
| 103 | DATADIRNAME=share
|
|---|
| 104 | INTLDEPS='$(top_builddir)/../intl/libintl.a'
|
|---|
| 105 | INTLLIBS=$INTLDEPS
|
|---|
| 106 | LIBS=`echo $LIBS | sed -e 's/-lintl//'`
|
|---|
| |
|---|