# IT_ENABLE_NLS # ------------- # Check for functions necessary to translate a text string into the user's # native language and define ENABLE_NLS to 1 in the autoconf generated # configuration file (usually called config.h) in that case. # AC_DEFUN([IT_ENABLE_NLS], [ if test "$USE_NLS" = "yes"; then gt_cv_have_gettext=no INTLLIBS= AC_CHECK_HEADER(libintl.h, [ gt_cv_func_dgettext_libintl=no libintl_extra_libs= # # first check in libc # AC_CACHE_CHECK([for ngettext in libc], gt_cv_func_ngettext_libc, [ AC_TRY_LINK([#include ], [return !ngettext("", "", 1)], gt_cv_func_ngettext_libc=yes, gt_cv_func_ngettext_libc=no) ]) if test "$gt_cv_func_ngettext_libc" = "yes"; then AC_CACHE_CHECK([for dgettext in libc], gt_cv_func_dgettext_libc, [ AC_TRY_LINK([#include ], [return !dgettext("", "")], gt_cv_func_dgettext_libc=yes, gt_cv_func_dgettext_libc=no) ]) fi if test "$gt_cv_func_ngettext_libc" = "yes"; then AC_CHECK_FUNCS(bind_textdomain_codeset) fi # # if we don't have everything we want, check in libintl # if test "$gt_cv_func_dgettext_libc" != "yes" -o \ "$gt_cv_func_ngettext_libc" != "yes" -o \ "$ac_cv_func_bind_textdomain_codeset" != "yes"; then AC_CHECK_LIB(intl, bindtextdomain, [ AC_CHECK_LIB(intl, ngettext, [ AC_CHECK_LIB(intl, dgettext, gt_cv_func_dgettext_libintl=yes) ]) ]) if test "$gt_cv_func_dgettext_libintl" != "yes"; then AC_MSG_CHECKING([if -liconv is needed to use gettext]) AC_MSG_RESULT([]) AC_CHECK_LIB(intl, ngettext, [ AC_CHECK_LIB(intl, dcgettext, [ gt_cv_func_dgettext_libintl=yes libintl_extra_libs=-liconv ], :, -liconv) ], :, -liconv) fi # # if we found libintl, then check in it for bind_textdomain_codeset(); # we'll prefer libc if neither have bind_textdomain_codeset() # and both have dgettext and ngettext # if test "$gt_cv_func_dgettext_libintl" = "yes"; then it_save_LIBS="$LIBS" LIBS="$LIBS -lintl $libintl_extra_libs" unset ac_cv_func_bind_textdomain_codeset AC_CHECK_FUNCS(bind_textdomain_codeset) LIBS="$it_save_LIBS" if test "$ac_cv_func_bind_textdomain_codeset" = "yes"; then gt_cv_func_dgettext_libc=no else if test "$gt_cv_func_dgettext_libc" = "yes" -a \ "$gt_cv_func_ngettext_libc" = "yes"; then gt_cv_func_dgettext_libintl=no fi fi fi fi if test "$gt_cv_func_dgettext_libc" = "yes" -o \ "$gt_cv_func_dgettext_libintl" = "yes"; then gt_cv_have_gettext=yes fi if test "$gt_cv_func_dgettext_libintl" = "yes"; then INTLLIBS="-lintl $libintl_extra_libs" AC_SUBST(INTLLIBS) fi if test "$gt_cv_have_gettext" = "yes"; then AC_DEFINE(ENABLE_NLS, 1, [Define to 1 if i18n is enabled.]) fi ]) fi ])