]> git.lyx.org Git - lyx.git/blobdiff - config/gettext.m4
patch from Levon
[lyx.git] / config / gettext.m4
index 64f2e8e74ae88d98a0bd3c7f2c0cab5ded5c859f..7ecae1d0b1eef102392e5efa75cd7fc9fff867f6 100644 (file)
@@ -1,7 +1,12 @@
 # Macro to add for using GNU gettext.
 # Ulrich Drepper <drepper@cygnus.com>, 1995.
+#
+# This file can be copied and used freely without restrictions.  It can
+# be used in projects which are not available under the GNU Public License
+# but which still want to provide support for the GNU gettext functionality.
+# Please note that the actual code is *not* freely available.
 
-# serial 3
+# serial 5
 
 AC_DEFUN(AM_WITH_NLS,
   [AC_MSG_CHECKING([whether NLS is requested])
@@ -41,12 +46,16 @@ AC_DEFUN(AM_WITH_NLS,
 
           if test "$gt_cv_func_gettext_libc" != "yes"; then
             AC_CHECK_LIB(intl, bindtextdomain,
-              [LIBS="-lintl $LIBS"
-               AC_CACHE_CHECK([for gettext in libintl],
+              [AC_CACHE_CHECK([for gettext in libintl],
                 gt_cv_func_gettext_libintl,
-                [AC_TRY_LINK([], [return (int) gettext ("")],
-                gt_cv_func_gettext_libintl=yes,
-                gt_cv_func_gettext_libintl=no)])])
+                [AC_CHECK_LIB(intl, gettext,
+dnl ============== A fix is here! ======================
+dnl -lintl was not added to the LIBS variable in this case
+                 [gt_cv_func_gettext_libintl=yes
+                  INTLLIBS="-lintl"],
+dnl ==== end of fix
+                 gt_cv_func_gettext_libintl=no)],
+                gt_cv_func_gettext_libintl=no)])
           fi
 
           if test "$gt_cv_func_gettext_libc" = "yes" \
@@ -140,7 +149,7 @@ AC_DEFUN(AM_WITH_NLS,
          : ;
        else
          AC_MSG_RESULT(
-           [found xgettext programs is not GNU xgettext; ignore it])
+           [found xgettext program is not GNU xgettext; ignore it])
          XGETTEXT=":"
        fi
       fi
@@ -152,6 +161,12 @@ AC_DEFUN(AM_WITH_NLS,
       nls_cv_header_intl=intl/libintl.h
       nls_cv_header_libgt=intl/libgettext.h
     fi
+    AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl)
+    AC_OUTPUT_COMMANDS(
+     [case "$CONFIG_FILES" in *po/Makefile.in*)
+        sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
+      esac])
+
 
     # If this is used in GNU gettext we have to set USE_NLS to `yes'
     # because some of the sources are only built for this goal.
@@ -196,9 +211,9 @@ AC_DEFUN(AM_GNU_GETTEXT,
    AC_REQUIRE([AC_FUNC_MMAP])dnl
 
    AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
-unistd.h values.h sys/param.h])
+unistd.h sys/param.h])
    AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
-__argz_count __argz_stringify __argz_next])
+strdup __argz_count __argz_stringify __argz_next])
 
    if test "${ac_cv_func_stpcpy+set}" != "set"; then
      AC_CHECK_FUNCS(stpcpy)
@@ -216,7 +231,12 @@ __argz_count __argz_stringify __argz_next])
      else
        AC_MSG_CHECKING(for catalogs to be installed)
        NEW_LINGUAS=
-       for lang in ${LINGUAS=$ALL_LINGUAS}; do
+dnl ============== Fix is here! ======================
+dnl Some sh do not like substitution in bounds of for loops
+dnl    for lang in ${LINGUAS=$ALL_LINGUAS}; do
+    tmplinguas=${LINGUAS=$ALL_LINGUAS}
+    for lang in ${tmplinguas}; do
+dnl ==== end of fix
          case "$ALL_LINGUAS" in
           *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
          esac
@@ -231,6 +251,17 @@ __argz_count __argz_stringify __argz_next])
      fi
    fi
 
+   dnl The reference to <locale.h> in the installed <libintl.h> file
+   dnl must be resolved because we cannot expect the users of this
+   dnl to define HAVE_LOCALE_H.
+   if test $ac_cv_header_locale_h = yes; then
+     INCLUDE_LOCALE_H="#include <locale.h>"
+   else
+     INCLUDE_LOCALE_H="\
+/* The system does not provide the header <locale.h>.  Take care yourself.  */"
+   fi
+   AC_SUBST(INCLUDE_LOCALE_H)
+
    dnl Determine which catalog format we have (if any is needed)
    dnl For now we know about two different formats:
    dnl   Linux libc-5 and the normal X/Open format