]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Deal with the case of a pre-existing GNU libintl.{a,so}.
authorBruno Haible <bruno@clisp.org>
Thu, 14 Sep 2000 17:54:44 +0000 (17:54 +0000)
committerBruno Haible <bruno@clisp.org>
Thu, 14 Sep 2000 17:54:44 +0000 (17:54 +0000)
m4/ChangeLog
m4/gettext.m4

index 2e66947841051acd4a17afc51b14ea954fa92d4e..8c46d58e1a6fab9a6c3814d928f24f081d1402e6 100644 (file)
@@ -1,3 +1,10 @@
+2000-09-14  Bruno Haible  <haible@clisp.cons.org>
+
+       * 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 <gael.roualland@dial.oleane.com>.
+
 2000-08-23  Bruno Haible  <haible@clisp.cons.org>
 
        * c-bs-a.m4: New file, from sh-utils-2.0j.
index 87e868d512fd87c638e778bbd91cd65b0028b9e9..b3a94856346a9ec4fa6048fd03cadb76ce3e3fe4 100644 (file)
@@ -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 <libintl.h>], [return (int) gettext ("")],
+           [AC_TRY_LINK([#include <libintl.h>],
+              [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 <libintl.h>],
+                 [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