]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Don't fail to recognize libintl.so if it was built without libiconv.so.
authorBruno Haible <bruno@clisp.org>
Mon, 21 Jan 2002 13:21:55 +0000 (13:21 +0000)
committerBruno Haible <bruno@clisp.org>
Sun, 21 Jun 2009 23:04:11 +0000 (01:04 +0200)
m4/ChangeLog
m4/gettext.m4

index 570eef76d21f5fa4466f6af6ddb96b3ece2006a8..04163cf3bfd70d4aa767f3c3a607105dfba36c61 100644 (file)
@@ -1,3 +1,9 @@
+2002-01-19  Bruno Haible  <bruno@clisp.org>
+
+       * gettext.m4 (AM_GNU_GETTEXT): Don't consider that -liconv is
+       necessary for -lintl. Instead, use the $LIBICONV value determined by
+       the AM_ICONV macro.
+
 2002-01-19  Bruno Haible  <bruno@clisp.org>
 
        * gettext.m4 (AM_GNU_GETTEXT): Remove shortcut check for <libintl.h>.
index 15266265018844d9240339532cc1e6c4073fcf95..b5f9f7456ed63fb7b153cf1bfcd18f1b07a4137d 100644 (file)
@@ -113,9 +113,6 @@ AC_DEFUN([AM_GNU_GETTEXT],
         define([gt_cv_func_gnugettext_libc], [gt_cv_func_gnugettext]gt_api_version[_libc])
         define([gt_cv_func_gnugettext_libintl], [gt_cv_func_gnugettext]gt_api_version[_libintl])
 
-        dnl Search for libintl and define LIBINTL and INCINTL accordingly.
-        AC_LIB_LINKFLAGS_BODY([intl], [iconv])
-
         AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,
          [AC_TRY_LINK([#include <libintl.h>
 extern int _nl_msg_cat_cntr;],
@@ -125,21 +122,38 @@ return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("",
             gt_cv_func_gnugettext_libc=no)])
 
         if test "$gt_cv_func_gnugettext_libc" != "yes"; then
+          dnl Sometimes libintl requires libiconv, so first search for libiconv.
           ifelse(gt_included_intl, yes, , [
             AM_ICONV
           ])
+          dnl Search for libintl and define LIBINTL and INCINTL accordingly.
+          dnl Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv]) because that would
+          dnl add "-liconv" to LIBINTL even if libiconv doesn't exist.
+          AC_LIB_LINKFLAGS_BODY([intl])
           AC_CACHE_CHECK([for GNU gettext in libintl],
             gt_cv_func_gnugettext_libintl,
            [gt_save_CPPFLAGS="$CPPFLAGS"
             CPPFLAGS="$CPPFLAGS $INCINTL"
             gt_save_LIBS="$LIBS"
             LIBS="$LIBS $LIBINTL"
+            dnl Now see whether libintl exists and does not depend on libiconv.
             AC_TRY_LINK([#include <libintl.h>
 extern int _nl_msg_cat_cntr;],
               [bindtextdomain ("", "");
 return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr],
               gt_cv_func_gnugettext_libintl=yes,
               gt_cv_func_gnugettext_libintl=no)
+            dnl Now see whether libintl exists and depends on libiconv.
+            if test "$gt_cv_func_gnugettext_libintl" != yes && test -n "$LIBICONV"; then
+              LIBS="$LIBS $LIBICONV"
+              AC_TRY_LINK([#include <libintl.h>
+extern int _nl_msg_cat_cntr;],
+                [bindtextdomain ("", "");
+return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr],
+               [LIBINTL="$LIBINTL $LIBICONV"
+                gt_cv_func_gnugettext_libintl=yes
+               ])
+            fi
             CPPFLAGS="$gt_save_CPPFLAGS"
             LIBS="$gt_save_LIBS"])
         fi