From: Bruno Haible Date: Thu, 14 Sep 2000 17:54:44 +0000 (+0000) Subject: Deal with the case of a pre-existing GNU libintl.{a,so}. X-Git-Tag: v0.10.36~223 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=75cbb08e616b1d6e7d2a412997f291c6cd2dffc0;p=thirdparty%2Fgettext.git Deal with the case of a pre-existing GNU libintl.{a,so}. --- diff --git a/m4/ChangeLog b/m4/ChangeLog index 2e6694784..8c46d58e1 100644 --- a/m4/ChangeLog +++ b/m4/ChangeLog @@ -1,3 +1,10 @@ +2000-09-14 Bruno Haible + + * gettext.m4 (AM_WITH_NLS): Make the tests for gettext in libc and + in libintl similar. If found in libintl, add "-lintl" to $LIBS during + subsequent AC_TRY_LINKs and later to INTLLIBS. + Reported by Gaƫl Roualland . + 2000-08-23 Bruno Haible * c-bs-a.m4: New file, from sh-utils-2.0j. diff --git a/m4/gettext.m4 b/m4/gettext.m4 index 87e868d51..b3a948563 100644 --- a/m4/gettext.m4 +++ b/m4/gettext.m4 @@ -69,17 +69,19 @@ AC_DEFUN(AM_WITH_NLS, AC_CHECK_HEADER(libintl.h, [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc, - [AC_TRY_LINK([#include ], [return (int) gettext ("")], + [AC_TRY_LINK([#include ], + [bindtextdomain ("", ""); return (int) gettext ("")], gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)]) if test "$gt_cv_func_gettext_libc" != "yes"; then - AC_CHECK_LIB(intl, bindtextdomain, - [AC_CACHE_CHECK([for gettext in libintl], - gt_cv_func_gettext_libintl, - [AC_CHECK_LIB(intl, gettext, - gt_cv_func_gettext_libintl=yes, - gt_cv_func_gettext_libintl=no)], - gt_cv_func_gettext_libintl=no)]) + AC_CACHE_CHECK([for gettext in libintl], + gt_cv_func_gettext_libintl, + [gt_save_LIBS="$LIBS" + LIBS="$LIBS -lintl" + AC_TRY_LINK([#include ], + [bindtextdomain ("", ""); return (int) gettext ("")], + gt_cv_func_gettext_libintl=yes, gt_cv_func_gettext_libintl=no) + LIBS="$gt_save_LIBS"]) fi if test "$gt_cv_func_gettext_libc" = "yes" \ @@ -92,14 +94,22 @@ AC_DEFUN(AM_WITH_NLS, AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) + gt_save_LIBS="$LIBS" + if test "$gt_cv_func_gettext_libintl" = "yes"; then + LIBS="$LIBS -lintl" + fi AC_TRY_LINK(, [extern int _nl_msg_cat_cntr; return _nl_msg_cat_cntr], [CATOBJEXT=.gmo DATADIRNAME=share], [CATOBJEXT=.mo DATADIRNAME=lib]) + LIBS="$gt_save_LIBS" INSTOBJEXT=.mo fi + if test "$gt_cv_func_gettext_libintl" = "yes"; then + INTLLIBS="-lintl" + fi fi ]) @@ -132,7 +142,7 @@ ifelse([$1], no-catgets, ,[ DATADIRNAME=lib INTLDEPS='ifelse([$2],[],$(top_builddir)/intl/libintl.a,[$2])' INTLLIBS=$INTLDEPS - LIBS=`echo $LIBS | sed -e 's/-lintl//'` + LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` nls_cv_header_intl=ifelse([$3],[],intl,[$3])/libintl.h nls_cv_header_libgt=ifelse([$3],[],intl,[$3])/libgettext.h fi]) @@ -162,7 +172,7 @@ ifelse([$1], no-catgets, ,[ DATADIRNAME=share INTLDEPS='ifelse([$2],[],$(top_builddir)/intl/libintl.a,[$2])' INTLLIBS=$INTLDEPS - LIBS=`echo $LIBS | sed -e 's/-lintl//'` + LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` nls_cv_header_intl=ifelse([$3],[],intl,[$3])/libintl.h nls_cv_header_libgt=ifelse([$3],[],intl,[$3])/libgettext.h fi