Add gettext support.
authorOwen Taylor <otaylor@redhat.com>
Tue, 16 Jan 2001 02:24:24 +0000 (02:24 +0000)
committerOwen Taylor <otaylor@src.gnome.org>
Tue, 16 Jan 2001 02:24:24 +0000 (02:24 +0000)
Mon Jan 15 21:12:49 2001  Owen Taylor  <otaylor@redhat.com>

        * configure.in acconfig.h glibintl.h gutils.c
po/{Makefile.in.in,POTFILES.in,po2tbl.in}: Add gettext
support.

* glib-gettext.m4 acinclude.m4: Clean up the GTK+ gettext macros
some more and put them in this file, though they also need
to be included in acinclude.m4 due to the brokeness of
aclocal.

* gspawn.c gspawn-win32.c gutf8.c gconvert.c gfileutils.c
gshell.c: Remove dummy _() #defines, include glibintl.m4.

36 files changed:
ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-12
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
README
acconfig.h
acinclude.m4
configure.in
gconvert.c
gfileutils.c
glib-gettext.m4 [new file with mode: 0644]
glib/gconvert.c
glib/gfileutils.c
glib/glibintl.h [new file with mode: 0644]
glib/gmarkup.c
glib/gshell.c
glib/gspawn-win32.c
glib/gspawn.c
glib/gutf8.c
glib/gutils.c
glibintl.h [new file with mode: 0644]
gmarkup.c
gshell.c
gspawn-win32.c
gspawn.c
gutf8.c
gutils.c
m4macros/glib-gettext.m4 [new file with mode: 0644]
po/.cvsignore [new file with mode: 0644]
po/Makefile.in.in [new file with mode: 0644]
po/POTFILES.in [new file with mode: 0644]
po/po2tbl.sed.in [new file with mode: 0644]

index 3f34a52b5021778c8c4b213426cb7922864fc062..a41f96ed374b867fdbc551897b4602f587b0998f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+Mon Jan 15 21:12:49 2001  Owen Taylor  <otaylor@redhat.com>
+
+        * configure.in acconfig.h glibintl.h gutils.c
+       po/{Makefile.in.in,POTFILES.in,po2tbl.in}: Add gettext
+       support.
+
+       * glib-gettext.m4 acinclude.m4: Clean up the GTK+ gettext macros
+       some more and put them in this file, though they also need
+       to be included in acinclude.m4 due to the brokeness of
+       aclocal.
+
+       * gspawn.c gspawn-win32.c gutf8.c gconvert.c gfileutils.c
+       gshell.c: Remove dummy _() #defines, include glibintl.m4.
+
 2001-01-09  Tor Lillqvist  <tml@iki.fi>
 
        * giowin32.c: Rework the changes needed to pass mainloop-test. Now
index 3f34a52b5021778c8c4b213426cb7922864fc062..a41f96ed374b867fdbc551897b4602f587b0998f 100644 (file)
@@ -1,3 +1,17 @@
+Mon Jan 15 21:12:49 2001  Owen Taylor  <otaylor@redhat.com>
+
+        * configure.in acconfig.h glibintl.h gutils.c
+       po/{Makefile.in.in,POTFILES.in,po2tbl.in}: Add gettext
+       support.
+
+       * glib-gettext.m4 acinclude.m4: Clean up the GTK+ gettext macros
+       some more and put them in this file, though they also need
+       to be included in acinclude.m4 due to the brokeness of
+       aclocal.
+
+       * gspawn.c gspawn-win32.c gutf8.c gconvert.c gfileutils.c
+       gshell.c: Remove dummy _() #defines, include glibintl.m4.
+
 2001-01-09  Tor Lillqvist  <tml@iki.fi>
 
        * giowin32.c: Rework the changes needed to pass mainloop-test. Now
index 3f34a52b5021778c8c4b213426cb7922864fc062..a41f96ed374b867fdbc551897b4602f587b0998f 100644 (file)
@@ -1,3 +1,17 @@
+Mon Jan 15 21:12:49 2001  Owen Taylor  <otaylor@redhat.com>
+
+        * configure.in acconfig.h glibintl.h gutils.c
+       po/{Makefile.in.in,POTFILES.in,po2tbl.in}: Add gettext
+       support.
+
+       * glib-gettext.m4 acinclude.m4: Clean up the GTK+ gettext macros
+       some more and put them in this file, though they also need
+       to be included in acinclude.m4 due to the brokeness of
+       aclocal.
+
+       * gspawn.c gspawn-win32.c gutf8.c gconvert.c gfileutils.c
+       gshell.c: Remove dummy _() #defines, include glibintl.m4.
+
 2001-01-09  Tor Lillqvist  <tml@iki.fi>
 
        * giowin32.c: Rework the changes needed to pass mainloop-test. Now
index 3f34a52b5021778c8c4b213426cb7922864fc062..a41f96ed374b867fdbc551897b4602f587b0998f 100644 (file)
@@ -1,3 +1,17 @@
+Mon Jan 15 21:12:49 2001  Owen Taylor  <otaylor@redhat.com>
+
+        * configure.in acconfig.h glibintl.h gutils.c
+       po/{Makefile.in.in,POTFILES.in,po2tbl.in}: Add gettext
+       support.
+
+       * glib-gettext.m4 acinclude.m4: Clean up the GTK+ gettext macros
+       some more and put them in this file, though they also need
+       to be included in acinclude.m4 due to the brokeness of
+       aclocal.
+
+       * gspawn.c gspawn-win32.c gutf8.c gconvert.c gfileutils.c
+       gshell.c: Remove dummy _() #defines, include glibintl.m4.
+
 2001-01-09  Tor Lillqvist  <tml@iki.fi>
 
        * giowin32.c: Rework the changes needed to pass mainloop-test. Now
index 3f34a52b5021778c8c4b213426cb7922864fc062..a41f96ed374b867fdbc551897b4602f587b0998f 100644 (file)
@@ -1,3 +1,17 @@
+Mon Jan 15 21:12:49 2001  Owen Taylor  <otaylor@redhat.com>
+
+        * configure.in acconfig.h glibintl.h gutils.c
+       po/{Makefile.in.in,POTFILES.in,po2tbl.in}: Add gettext
+       support.
+
+       * glib-gettext.m4 acinclude.m4: Clean up the GTK+ gettext macros
+       some more and put them in this file, though they also need
+       to be included in acinclude.m4 due to the brokeness of
+       aclocal.
+
+       * gspawn.c gspawn-win32.c gutf8.c gconvert.c gfileutils.c
+       gshell.c: Remove dummy _() #defines, include glibintl.m4.
+
 2001-01-09  Tor Lillqvist  <tml@iki.fi>
 
        * giowin32.c: Rework the changes needed to pass mainloop-test. Now
index 3f34a52b5021778c8c4b213426cb7922864fc062..a41f96ed374b867fdbc551897b4602f587b0998f 100644 (file)
@@ -1,3 +1,17 @@
+Mon Jan 15 21:12:49 2001  Owen Taylor  <otaylor@redhat.com>
+
+        * configure.in acconfig.h glibintl.h gutils.c
+       po/{Makefile.in.in,POTFILES.in,po2tbl.in}: Add gettext
+       support.
+
+       * glib-gettext.m4 acinclude.m4: Clean up the GTK+ gettext macros
+       some more and put them in this file, though they also need
+       to be included in acinclude.m4 due to the brokeness of
+       aclocal.
+
+       * gspawn.c gspawn-win32.c gutf8.c gconvert.c gfileutils.c
+       gshell.c: Remove dummy _() #defines, include glibintl.m4.
+
 2001-01-09  Tor Lillqvist  <tml@iki.fi>
 
        * giowin32.c: Rework the changes needed to pass mainloop-test. Now
index 3f34a52b5021778c8c4b213426cb7922864fc062..a41f96ed374b867fdbc551897b4602f587b0998f 100644 (file)
@@ -1,3 +1,17 @@
+Mon Jan 15 21:12:49 2001  Owen Taylor  <otaylor@redhat.com>
+
+        * configure.in acconfig.h glibintl.h gutils.c
+       po/{Makefile.in.in,POTFILES.in,po2tbl.in}: Add gettext
+       support.
+
+       * glib-gettext.m4 acinclude.m4: Clean up the GTK+ gettext macros
+       some more and put them in this file, though they also need
+       to be included in acinclude.m4 due to the brokeness of
+       aclocal.
+
+       * gspawn.c gspawn-win32.c gutf8.c gconvert.c gfileutils.c
+       gshell.c: Remove dummy _() #defines, include glibintl.m4.
+
 2001-01-09  Tor Lillqvist  <tml@iki.fi>
 
        * giowin32.c: Rework the changes needed to pass mainloop-test. Now
index 3f34a52b5021778c8c4b213426cb7922864fc062..a41f96ed374b867fdbc551897b4602f587b0998f 100644 (file)
@@ -1,3 +1,17 @@
+Mon Jan 15 21:12:49 2001  Owen Taylor  <otaylor@redhat.com>
+
+        * configure.in acconfig.h glibintl.h gutils.c
+       po/{Makefile.in.in,POTFILES.in,po2tbl.in}: Add gettext
+       support.
+
+       * glib-gettext.m4 acinclude.m4: Clean up the GTK+ gettext macros
+       some more and put them in this file, though they also need
+       to be included in acinclude.m4 due to the brokeness of
+       aclocal.
+
+       * gspawn.c gspawn-win32.c gutf8.c gconvert.c gfileutils.c
+       gshell.c: Remove dummy _() #defines, include glibintl.m4.
+
 2001-01-09  Tor Lillqvist  <tml@iki.fi>
 
        * giowin32.c: Rework the changes needed to pass mainloop-test. Now
diff --git a/README b/README
index ec10168f7b7dcceea6be547c0d055aafde618170..a20c4495997b2366c2f8bcc466507d2761d5b519 100644 (file)
--- a/README
+++ b/README
@@ -40,6 +40,7 @@ A mailing list is located at:
 To subscribe: mail -s subscribe gtk-list-request@redhat.com < /dev/null
 (Send mail to gtk-list-request@redhat.com with the subject "subscribe")
 
+
 Installation
 ============
 
index cb9e82c6cfd43e448b8bcb22bd60f2a10b70e68b..d0e2fd25a3b677679d5105800b179cee7804f7ff 100644 (file)
    The entries are in sort -df order: alphabetical, case insensitive,
    ignoring punctuation (such as underscores).  */
 
-#undef USE_LIBICONV
-#undef SANE_MALLOC_PROTOS
+#undef ENABLE_NLS
+#undef GETTEXT_PACKAGE
 #undef GLIB_SIZEOF_SYSTEM_THREAD
+#undef GLIB_LOCALE_DIR
+#undef HAVE_GETTEXT
+#undef HAVE_LC_MESSAGES
+#undef SANE_MALLOC_PROTOS
+#undef USE_LIBICONV
index 2ad32064dd79db7a0df7e1b35df7896d78c22a8d..d2ea6b22d58d2ec6acfa7655786e20ea942f2397 100644 (file)
@@ -425,3 +425,349 @@ AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
 
 dnl This is just to silence aclocal about the macro not being used
 ifelse([AC_DISABLE_FAST_INSTALL])dnl
+
+
+# Macro to add for using GNU gettext.
+# Ulrich Drepper <drepper@cygnus.com>, 1995.
+#
+# Modified to never use included libintl. 
+# Owen Taylor <otaylor@redhat.com>, 12/15/1998
+#
+#
+# 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.
+#
+#
+# If you make changes to this file, you MUST update the copy in
+# acinclude.m4. [ aclocal dies on duplicate macros, so if
+# we run 'aclocal -I macros/' then we'll run into problems
+# once we've installed glib-gettext.m4 :-( ]
+#
+
+# serial 5
+
+AC_DEFUN(AM_GLIB_WITH_NLS,
+  [AC_MSG_CHECKING([whether NLS is requested])
+    dnl Default is enabled NLS
+    AC_ARG_ENABLE(nls,
+      [  --disable-nls           do not use Native Language Support],
+      USE_NLS=$enableval, USE_NLS=yes)
+    AC_MSG_RESULT($USE_NLS)
+    AC_SUBST(USE_NLS)
+
+    USE_INCLUDED_LIBINTL=no
+
+    dnl If we use NLS figure out what method
+    if test "$USE_NLS" = "yes"; then
+#      AC_DEFINE(ENABLE_NLS)
+#      AC_MSG_CHECKING([whether included gettext is requested])
+#      AC_ARG_WITH(included-gettext,
+#        [  --with-included-gettext use the GNU gettext library included here],
+#        nls_cv_force_use_gnu_gettext=$withval,
+#        nls_cv_force_use_gnu_gettext=no)
+#      AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
+      nls_cv_force_use_gnu_gettext="no"
+
+      nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
+      if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
+        dnl User does not insist on using GNU NLS library.  Figure out what
+        dnl to use.  If gettext or catgets are available (in this order) we
+        dnl use this.  Else we have to fall back to GNU NLS library.
+       dnl catgets is only used if permitted by option --with-catgets.
+       nls_cv_header_intl=
+       nls_cv_header_libgt=
+       CATOBJEXT=NONE
+
+       AC_CHECK_HEADER(libintl.h,
+         [AC_CACHE_CHECK([for dgettext in libc], gt_cv_func_dgettext_libc,
+           [AC_TRY_LINK([#include <libintl.h>], [return (int) dgettext ("","")],
+              gt_cv_func_dgettext_libc=yes, gt_cv_func_dgettext_libc=no)])
+
+          if test "$gt_cv_func_dgettext_libc" != "yes"; then
+            AC_CHECK_LIB(intl, bindtextdomain,
+              [AC_CACHE_CHECK([for dgettext in libintl],
+                gt_cv_func_dgettext_libintl,
+                [AC_CHECK_LIB(intl, dgettext,
+                 gt_cv_func_dgettext_libintl=yes,
+                 gt_cv_func_dgettext_libintl=no)],
+                gt_cv_func_dgettext_libintl=no)])
+          fi
+
+           if test "$gt_cv_func_dgettext_libintl" = "yes"; then
+            LIBS="$LIBS -lintl";
+           fi
+
+          if test "$gt_cv_func_dgettext_libc" = "yes" \
+             || test "$gt_cv_func_dgettext_libintl" = "yes"; then
+             AC_DEFINE(HAVE_GETTEXT)
+             AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
+               [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
+             if test "$MSGFMT" != "no"; then
+               AC_CHECK_FUNCS(dcgettext)
+               AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
+               AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
+                 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
+               AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
+                              return _nl_msg_cat_cntr],
+                 [CATOBJEXT=.gmo
+                  DATADIRNAME=share],
+                 [CATOBJEXT=.mo
+                  DATADIRNAME=lib])
+               INSTOBJEXT=.mo
+             fi
+           fi
+
+           # Added by Martin Baulig 12/15/98 for libc5 systems
+           if test "$gt_cv_func_dgettext_libc" != "yes" \
+              && test "$gt_cv_func_dgettext_libintl" = "yes"; then
+              INTLLIBS=-lintl
+              LIBS=`echo $LIBS | sed -e 's/-lintl//'`
+           fi
+       ])
+
+#        if test "$CATOBJEXT" = "NONE"; then
+#        AC_MSG_CHECKING([whether catgets can be used])
+#        AC_ARG_WITH(catgets,
+#          [  --with-catgets          use catgets functions if available],
+#          nls_cv_use_catgets=$withval, nls_cv_use_catgets=no)
+#        AC_MSG_RESULT($nls_cv_use_catgets)
+#
+#        if test "$nls_cv_use_catgets" = "yes"; then
+#          dnl No gettext in C library.  Try catgets next.
+#          AC_CHECK_LIB(i, main)
+#          AC_CHECK_FUNC(catgets,
+#            [AC_DEFINE(HAVE_CATGETS)
+#             INTLOBJS="\$(CATOBJS)"
+#             AC_PATH_PROG(GENCAT, gencat, no)dnl
+#             if test "$GENCAT" != "no"; then
+#               AC_PATH_PROG(GMSGFMT, gmsgfmt, no)
+#               if test "$GMSGFMT" = "no"; then
+#                 AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt,
+#                  [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)
+#               fi
+#               AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
+#                 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
+#               USE_INCLUDED_LIBINTL=yes
+#               CATOBJEXT=.cat
+#               INSTOBJEXT=.cat
+#               DATADIRNAME=lib
+#               INTLDEPS='$(top_builddir)/intl/libintl.a'
+#               INTLLIBS=$INTLDEPS
+#               LIBS=`echo $LIBS | sed -e 's/-lintl//'`
+#               nls_cv_header_intl=intl/libintl.h
+#               nls_cv_header_libgt=intl/libgettext.h
+#              fi
+#            ])
+#        fi
+#        fi
+
+        if test "$CATOBJEXT" = "NONE"; then
+         dnl Neither gettext nor catgets in included in the C library.
+         dnl Fall back on GNU gettext library.
+         nls_cv_use_gnu_gettext=yes
+        fi
+      fi
+
+      if test "$nls_cv_use_gnu_gettext" != "yes"; then
+        AC_DEFINE(ENABLE_NLS)
+      else
+         dnl Unset this variable since we use the non-zero value as a flag.
+         CATOBJEXT=
+#        dnl Mark actions used to generate GNU NLS library.
+#        INTLOBJS="\$(GETTOBJS)"
+#        AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
+#        [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
+#        AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
+#        AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
+#        [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
+#        AC_SUBST(MSGFMT)
+#      USE_INCLUDED_LIBINTL=yes
+#        CATOBJEXT=.gmo
+#        INSTOBJEXT=.mo
+#        DATADIRNAME=share
+#      INTLDEPS='$(top_builddir)/intl/libintl.a'
+#      INTLLIBS=$INTLDEPS
+#      LIBS=`echo $LIBS | sed -e 's/-lintl//'`
+#        nls_cv_header_intl=intl/libintl.h
+#        nls_cv_header_libgt=intl/libgettext.h
+      fi
+
+      dnl Test whether we really found GNU xgettext.
+      if test "$XGETTEXT" != ":"; then
+       dnl If it is no GNU xgettext we define it as : so that the
+       dnl Makefiles still can work.
+       if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
+         : ;
+       else
+         AC_MSG_RESULT(
+           [found xgettext program is not GNU xgettext; ignore it])
+         XGETTEXT=":"
+       fi
+      fi
+
+      # We need to process the po/ directory.
+      POSUB=po
+    else
+      DATADIRNAME=share
+      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.
+#    if test "$PACKAGE" = gettext; then
+#      USE_NLS=yes
+#      USE_INCLUDED_LIBINTL=yes
+#    fi
+
+    dnl These rules are solely for the distribution goal.  While doing this
+    dnl we only have to keep exactly one list of the available catalogs
+    dnl in configure.in.
+    for lang in $ALL_LINGUAS; do
+      GMOFILES="$GMOFILES $lang.gmo"
+      POFILES="$POFILES $lang.po"
+    done
+
+    dnl Make all variables we use known to autoconf.
+    AC_SUBST(USE_INCLUDED_LIBINTL)
+    AC_SUBST(CATALOGS)
+    AC_SUBST(CATOBJEXT)
+    AC_SUBST(DATADIRNAME)
+    AC_SUBST(GMOFILES)
+    AC_SUBST(INSTOBJEXT)
+    AC_SUBST(INTLDEPS)
+    AC_SUBST(INTLLIBS)
+    AC_SUBST(INTLOBJS)
+    AC_SUBST(POFILES)
+    AC_SUBST(POSUB)
+  ])
+
+AC_DEFUN(AM_GLIB_GNU_GETTEXT,
+  [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+   AC_REQUIRE([AC_PROG_CC])dnl
+   AC_REQUIRE([AC_PROG_RANLIB])dnl
+#   AC_REQUIRE([AC_ISC_POSIX])dnl
+   AC_REQUIRE([AC_HEADER_STDC])dnl
+   AC_REQUIRE([AC_C_CONST])dnl
+   AC_REQUIRE([AC_C_INLINE])dnl
+   AC_REQUIRE([AC_TYPE_OFF_T])dnl
+   AC_REQUIRE([AC_TYPE_SIZE_T])dnl
+   AC_REQUIRE([AC_FUNC_ALLOCA])dnl
+   AC_REQUIRE([AC_FUNC_MMAP])dnl
+
+   AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
+unistd.h sys/param.h])
+   AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
+strdup __argz_count __argz_stringify __argz_next])
+
+#   if test "${ac_cv_func_stpcpy+set}" != "set"; then
+#     AC_CHECK_FUNCS(stpcpy)
+#   fi
+#   if test "${ac_cv_func_stpcpy}" = "yes"; then
+#     AC_DEFINE(HAVE_STPCPY)
+#   fi
+
+   AM_LC_MESSAGES
+   AM_GLIB_WITH_NLS
+
+   if test "x$CATOBJEXT" != "x"; then
+     if test "x$ALL_LINGUAS" = "x"; then
+       LINGUAS=
+     else
+       AC_MSG_CHECKING(for catalogs to be installed)
+       NEW_LINGUAS=
+       for lang in ${LINGUAS=$ALL_LINGUAS}; do
+         case "$ALL_LINGUAS" in
+          *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
+         esac
+       done
+       LINGUAS=$NEW_LINGUAS
+       AC_MSG_RESULT($LINGUAS)
+     fi
+
+     dnl Construct list of names of catalog files to be constructed.
+     if test -n "$LINGUAS"; then
+       for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
+     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
+   test -d po || mkdir po
+   if test "$CATOBJEXT" = ".cat"; then
+     AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
+
+     dnl Transform the SED scripts while copying because some dumb SEDs
+     dnl cannot handle comments.
+     sed -e '/^#/d' $srcdir/po/$msgformat-msg.sed > po/po2msg.sed
+   fi
+   dnl po2tbl.sed is always needed.
+   sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
+     $srcdir/po/po2tbl.sed.in > po/po2tbl.sed
+
+#   dnl In the intl/Makefile.in we have a special dependency which makes
+#   dnl only sense for gettext.  We comment this out for non-gettext
+#   dnl packages.
+#   if test "$PACKAGE" = "gettext"; then
+#     GT_NO="#NO#"
+#     GT_YES=
+#   else
+#     GT_NO=
+#     GT_YES="#YES#"
+#   fi
+#   AC_SUBST(GT_NO)
+#   AC_SUBST(GT_YES)
+
+   dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
+   dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
+   dnl Try to locate is.
+   MKINSTALLDIRS=
+   if test -n "$ac_aux_dir"; then
+     MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
+   fi
+   if test -z "$MKINSTALLDIRS"; then
+     MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
+   fi
+   AC_SUBST(MKINSTALLDIRS)
+
+#   dnl *** For now the libtool support in intl/Makefile is not for real.
+#   l=
+#   AC_SUBST(l)
+
+   dnl Generate list of files to be processed by xgettext which will
+   dnl be included in po/Makefile.
+   test -d po || mkdir po
+   if test "x$srcdir" != "x."; then
+     if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
+       posrcprefix="$srcdir/"
+     else
+       posrcprefix="../$srcdir/"
+     fi
+   else
+     posrcprefix="../"
+   fi
+   rm -f po/POTFILES
+   sed -e "/^#/d" -e "/^\$/d" -e "s,.*,        $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
+       < $srcdir/po/POTFILES.in > po/POTFILES
+  ])
+
index 58562bed407c3b3610b67f96a8d88fc193353e86..5876e1970e04cf817c0725fecb30eed5bb37f98b 100644 (file)
@@ -140,8 +140,9 @@ if test "x$enable_msg_prefix" = "xyes"; then
                     [Enable prefixing of error messages with program names])
 fi
 
-# Checks for programs.
+dnl Checks for programs.
 AC_PROG_CC
+
 AM_PROG_CC_STDC
 AC_PROG_INSTALL
 
@@ -175,6 +176,25 @@ if test "x$enable_rebuilds" = "xyes" && \
 fi
 AC_SUBST(REBUILD)
 
+
+dnl
+dnl gettext support
+dnl
+
+ALL_LINGUAS=""
+AM_GLIB_GNU_GETTEXT
+LIBS="$LIBS $INTLLIBS"
+
+GETTEXT_PACKAGE=glib20
+AC_SUBST(GETTEXT_PACKAGE)
+AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE")
+
+# AM_GLIB_GNU_GETTEXT above substs $DATADIRNAME
+# this is the directory where the *.{mo,gmo} files are installed
+GLIB_LOCALE_DIR="${prefix}/${DATADIRNAME}/locale"
+AC_DEFINE_UNQUOTED(GLIB_LOCALE_DIR,"$GLIB_LOCALE_DIR")
+
+
 dnl Initialize libtool
 AM_PROG_LIBTOOL
 
@@ -1778,6 +1798,7 @@ gmodule/gmoduleconf.h
 gmodule/Makefile
 gobject/Makefile
 gthread/Makefile
+po/Makefile.in
 docs/Makefile
 docs/glib-config.1
 docs/reference/Makefile
index 49cfad9aa364cb45f164903c1a7dae36945851b9..9307f43e82093e167bc637ac781c74cce397d407 100644 (file)
@@ -32,7 +32,7 @@
 #include <windows.h>
 #endif
 
-#define _(s) (s)
+#include "glibintl.h"
 
 GQuark 
 g_convert_error_quark()
index eb545dcb1d5e2eefccb680ae3b3d851f2666c76e..0777530b5dfe727e2845dac3ca69574d729ef628 100644 (file)
@@ -62,7 +62,7 @@
 #define O_BINARY 0
 #endif
 
-#define _(x) x
+#include "glibintl.h"
 
 /**
  * g_file_test:
diff --git a/glib-gettext.m4 b/glib-gettext.m4
new file mode 100644 (file)
index 0000000..a9155cb
--- /dev/null
@@ -0,0 +1,344 @@
+# Macro to add for using GNU gettext.
+# Ulrich Drepper <drepper@cygnus.com>, 1995.
+#
+# Modified to never use included libintl. 
+# Owen Taylor <otaylor@redhat.com>, 12/15/1998
+#
+#
+# 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.
+#
+#
+# If you make changes to this file, you MUST update the copy in
+# acinclude.m4. [ aclocal dies on duplicate macros, so if
+# we run 'aclocal -I macros/' then we'll run into problems
+# once we've installed glib-gettext.m4 :-( ]
+#
+
+# serial 5
+
+AC_DEFUN(AM_GLIB_WITH_NLS,
+  [AC_MSG_CHECKING([whether NLS is requested])
+    dnl Default is enabled NLS
+    AC_ARG_ENABLE(nls,
+      [  --disable-nls           do not use Native Language Support],
+      USE_NLS=$enableval, USE_NLS=yes)
+    AC_MSG_RESULT($USE_NLS)
+    AC_SUBST(USE_NLS)
+
+    USE_INCLUDED_LIBINTL=no
+
+    dnl If we use NLS figure out what method
+    if test "$USE_NLS" = "yes"; then
+#      AC_DEFINE(ENABLE_NLS)
+#      AC_MSG_CHECKING([whether included gettext is requested])
+#      AC_ARG_WITH(included-gettext,
+#        [  --with-included-gettext use the GNU gettext library included here],
+#        nls_cv_force_use_gnu_gettext=$withval,
+#        nls_cv_force_use_gnu_gettext=no)
+#      AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
+      nls_cv_force_use_gnu_gettext="no"
+
+      nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
+      if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
+        dnl User does not insist on using GNU NLS library.  Figure out what
+        dnl to use.  If gettext or catgets are available (in this order) we
+        dnl use this.  Else we have to fall back to GNU NLS library.
+       dnl catgets is only used if permitted by option --with-catgets.
+       nls_cv_header_intl=
+       nls_cv_header_libgt=
+       CATOBJEXT=NONE
+
+       AC_CHECK_HEADER(libintl.h,
+         [AC_CACHE_CHECK([for dgettext in libc], gt_cv_func_dgettext_libc,
+           [AC_TRY_LINK([#include <libintl.h>], [return (int) dgettext ("","")],
+              gt_cv_func_dgettext_libc=yes, gt_cv_func_dgettext_libc=no)])
+
+          if test "$gt_cv_func_dgettext_libc" != "yes"; then
+            AC_CHECK_LIB(intl, bindtextdomain,
+              [AC_CACHE_CHECK([for dgettext in libintl],
+                gt_cv_func_dgettext_libintl,
+                [AC_CHECK_LIB(intl, dgettext,
+                 gt_cv_func_dgettext_libintl=yes,
+                 gt_cv_func_dgettext_libintl=no)],
+                gt_cv_func_dgettext_libintl=no)])
+          fi
+
+           if test "$gt_cv_func_dgettext_libintl" = "yes"; then
+            LIBS="$LIBS -lintl";
+           fi
+
+          if test "$gt_cv_func_dgettext_libc" = "yes" \
+             || test "$gt_cv_func_dgettext_libintl" = "yes"; then
+             AC_DEFINE(HAVE_GETTEXT)
+             AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
+               [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
+             if test "$MSGFMT" != "no"; then
+               AC_CHECK_FUNCS(dcgettext)
+               AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
+               AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
+                 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
+               AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
+                              return _nl_msg_cat_cntr],
+                 [CATOBJEXT=.gmo
+                  DATADIRNAME=share],
+                 [CATOBJEXT=.mo
+                  DATADIRNAME=lib])
+               INSTOBJEXT=.mo
+             fi
+           fi
+
+           # Added by Martin Baulig 12/15/98 for libc5 systems
+           if test "$gt_cv_func_dgettext_libc" != "yes" \
+              && test "$gt_cv_func_dgettext_libintl" = "yes"; then
+              INTLLIBS=-lintl
+              LIBS=`echo $LIBS | sed -e 's/-lintl//'`
+           fi
+       ])
+
+#        if test "$CATOBJEXT" = "NONE"; then
+#        AC_MSG_CHECKING([whether catgets can be used])
+#        AC_ARG_WITH(catgets,
+#          [  --with-catgets          use catgets functions if available],
+#          nls_cv_use_catgets=$withval, nls_cv_use_catgets=no)
+#        AC_MSG_RESULT($nls_cv_use_catgets)
+#
+#        if test "$nls_cv_use_catgets" = "yes"; then
+#          dnl No gettext in C library.  Try catgets next.
+#          AC_CHECK_LIB(i, main)
+#          AC_CHECK_FUNC(catgets,
+#            [AC_DEFINE(HAVE_CATGETS)
+#             INTLOBJS="\$(CATOBJS)"
+#             AC_PATH_PROG(GENCAT, gencat, no)dnl
+#             if test "$GENCAT" != "no"; then
+#               AC_PATH_PROG(GMSGFMT, gmsgfmt, no)
+#               if test "$GMSGFMT" = "no"; then
+#                 AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt,
+#                  [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)
+#               fi
+#               AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
+#                 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
+#               USE_INCLUDED_LIBINTL=yes
+#               CATOBJEXT=.cat
+#               INSTOBJEXT=.cat
+#               DATADIRNAME=lib
+#               INTLDEPS='$(top_builddir)/intl/libintl.a'
+#               INTLLIBS=$INTLDEPS
+#               LIBS=`echo $LIBS | sed -e 's/-lintl//'`
+#               nls_cv_header_intl=intl/libintl.h
+#               nls_cv_header_libgt=intl/libgettext.h
+#              fi
+#            ])
+#        fi
+#        fi
+
+        if test "$CATOBJEXT" = "NONE"; then
+         dnl Neither gettext nor catgets in included in the C library.
+         dnl Fall back on GNU gettext library.
+         nls_cv_use_gnu_gettext=yes
+        fi
+      fi
+
+      if test "$nls_cv_use_gnu_gettext" != "yes"; then
+        AC_DEFINE(ENABLE_NLS)
+      else
+         dnl Unset this variable since we use the non-zero value as a flag.
+         CATOBJEXT=
+#        dnl Mark actions used to generate GNU NLS library.
+#        INTLOBJS="\$(GETTOBJS)"
+#        AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
+#        [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
+#        AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
+#        AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
+#        [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
+#        AC_SUBST(MSGFMT)
+#      USE_INCLUDED_LIBINTL=yes
+#        CATOBJEXT=.gmo
+#        INSTOBJEXT=.mo
+#        DATADIRNAME=share
+#      INTLDEPS='$(top_builddir)/intl/libintl.a'
+#      INTLLIBS=$INTLDEPS
+#      LIBS=`echo $LIBS | sed -e 's/-lintl//'`
+#        nls_cv_header_intl=intl/libintl.h
+#        nls_cv_header_libgt=intl/libgettext.h
+      fi
+
+      dnl Test whether we really found GNU xgettext.
+      if test "$XGETTEXT" != ":"; then
+       dnl If it is no GNU xgettext we define it as : so that the
+       dnl Makefiles still can work.
+       if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
+         : ;
+       else
+         AC_MSG_RESULT(
+           [found xgettext program is not GNU xgettext; ignore it])
+         XGETTEXT=":"
+       fi
+      fi
+
+      # We need to process the po/ directory.
+      POSUB=po
+    else
+      DATADIRNAME=share
+      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.
+#    if test "$PACKAGE" = gettext; then
+#      USE_NLS=yes
+#      USE_INCLUDED_LIBINTL=yes
+#    fi
+
+    dnl These rules are solely for the distribution goal.  While doing this
+    dnl we only have to keep exactly one list of the available catalogs
+    dnl in configure.in.
+    for lang in $ALL_LINGUAS; do
+      GMOFILES="$GMOFILES $lang.gmo"
+      POFILES="$POFILES $lang.po"
+    done
+
+    dnl Make all variables we use known to autoconf.
+    AC_SUBST(USE_INCLUDED_LIBINTL)
+    AC_SUBST(CATALOGS)
+    AC_SUBST(CATOBJEXT)
+    AC_SUBST(DATADIRNAME)
+    AC_SUBST(GMOFILES)
+    AC_SUBST(INSTOBJEXT)
+    AC_SUBST(INTLDEPS)
+    AC_SUBST(INTLLIBS)
+    AC_SUBST(INTLOBJS)
+    AC_SUBST(POFILES)
+    AC_SUBST(POSUB)
+  ])
+
+AC_DEFUN(AM_GLIB_GNU_GETTEXT,
+  [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+   AC_REQUIRE([AC_PROG_CC])dnl
+   AC_REQUIRE([AC_PROG_RANLIB])dnl
+#   AC_REQUIRE([AC_ISC_POSIX])dnl
+   AC_REQUIRE([AC_HEADER_STDC])dnl
+   AC_REQUIRE([AC_C_CONST])dnl
+   AC_REQUIRE([AC_C_INLINE])dnl
+   AC_REQUIRE([AC_TYPE_OFF_T])dnl
+   AC_REQUIRE([AC_TYPE_SIZE_T])dnl
+   AC_REQUIRE([AC_FUNC_ALLOCA])dnl
+   AC_REQUIRE([AC_FUNC_MMAP])dnl
+
+   AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
+unistd.h sys/param.h])
+   AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
+strdup __argz_count __argz_stringify __argz_next])
+
+#   if test "${ac_cv_func_stpcpy+set}" != "set"; then
+#     AC_CHECK_FUNCS(stpcpy)
+#   fi
+#   if test "${ac_cv_func_stpcpy}" = "yes"; then
+#     AC_DEFINE(HAVE_STPCPY)
+#   fi
+
+   AM_LC_MESSAGES
+   AM_GLIB_WITH_NLS
+
+   if test "x$CATOBJEXT" != "x"; then
+     if test "x$ALL_LINGUAS" = "x"; then
+       LINGUAS=
+     else
+       AC_MSG_CHECKING(for catalogs to be installed)
+       NEW_LINGUAS=
+       for lang in ${LINGUAS=$ALL_LINGUAS}; do
+         case "$ALL_LINGUAS" in
+          *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
+         esac
+       done
+       LINGUAS=$NEW_LINGUAS
+       AC_MSG_RESULT($LINGUAS)
+     fi
+
+     dnl Construct list of names of catalog files to be constructed.
+     if test -n "$LINGUAS"; then
+       for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
+     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
+   test -d po || mkdir po
+   if test "$CATOBJEXT" = ".cat"; then
+     AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
+
+     dnl Transform the SED scripts while copying because some dumb SEDs
+     dnl cannot handle comments.
+     sed -e '/^#/d' $srcdir/po/$msgformat-msg.sed > po/po2msg.sed
+   fi
+   dnl po2tbl.sed is always needed.
+   sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
+     $srcdir/po/po2tbl.sed.in > po/po2tbl.sed
+
+#   dnl In the intl/Makefile.in we have a special dependency which makes
+#   dnl only sense for gettext.  We comment this out for non-gettext
+#   dnl packages.
+#   if test "$PACKAGE" = "gettext"; then
+#     GT_NO="#NO#"
+#     GT_YES=
+#   else
+#     GT_NO=
+#     GT_YES="#YES#"
+#   fi
+#   AC_SUBST(GT_NO)
+#   AC_SUBST(GT_YES)
+
+   dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
+   dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
+   dnl Try to locate is.
+   MKINSTALLDIRS=
+   if test -n "$ac_aux_dir"; then
+     MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
+   fi
+   if test -z "$MKINSTALLDIRS"; then
+     MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
+   fi
+   AC_SUBST(MKINSTALLDIRS)
+
+#   dnl *** For now the libtool support in intl/Makefile is not for real.
+#   l=
+#   AC_SUBST(l)
+
+   dnl Generate list of files to be processed by xgettext which will
+   dnl be included in po/Makefile.
+   test -d po || mkdir po
+   if test "x$srcdir" != "x."; then
+     if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
+       posrcprefix="$srcdir/"
+     else
+       posrcprefix="../$srcdir/"
+     fi
+   else
+     posrcprefix="../"
+   fi
+   rm -f po/POTFILES
+   sed -e "/^#/d" -e "/^\$/d" -e "s,.*,        $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
+       < $srcdir/po/POTFILES.in > po/POTFILES
+  ])
+
index 49cfad9aa364cb45f164903c1a7dae36945851b9..9307f43e82093e167bc637ac781c74cce397d407 100644 (file)
@@ -32,7 +32,7 @@
 #include <windows.h>
 #endif
 
-#define _(s) (s)
+#include "glibintl.h"
 
 GQuark 
 g_convert_error_quark()
index eb545dcb1d5e2eefccb680ae3b3d851f2666c76e..0777530b5dfe727e2845dac3ca69574d729ef628 100644 (file)
@@ -62,7 +62,7 @@
 #define O_BINARY 0
 #endif
 
-#define _(x) x
+#include "glibintl.h"
 
 /**
  * g_file_test:
diff --git a/glib/glibintl.h b/glib/glibintl.h
new file mode 100644 (file)
index 0000000..a210170
--- /dev/null
@@ -0,0 +1,33 @@
+#ifndef __GLIBINTL_H__
+#define __GLIBINTL_H__
+
+#include "config.h"
+
+#ifdef ENABLE_NLS
+
+extern int _glib_gettext_initialized;
+
+char *_glib_gettext_init (const char *str);
+
+#include<libintl.h>
+#define _(String)                         \
+   (_glib_gettext_initialized ?            \
+      dgettext(GETTEXT_PACKAGE,String) :  \
+      _glib_gettext_init(String))
+
+#ifdef gettext_noop
+#define N_(String) gettext_noop(String)
+#else
+#define N_(String) (String)
+#endif
+#else /* NLS is disabled */
+#define _(String) (String)
+#define N_(String) (String)
+#define textdomain(String) (String)
+#define gettext(String) (String)
+#define dgettext(Domain,String) (String)
+#define dcgettext(Domain,String,Type) (String)
+#define bindtextdomain(Domain,Directory) (Domain) 
+#endif
+
+#endif /* __GLIBINTL_H__ */
index 0160d8c6e82f4cf3d8d61e0d95fd9a37b6878ab7..6fd5a10b9e96992bd0feb94768e61401a13bf26c 100644 (file)
@@ -25,8 +25,7 @@
 #include <stdlib.h>
 #include <errno.h>
 
-/* FIXME */
-#define _(x) x
+#include "glibintl.h"
 
 GQuark
 g_markup_error_quark ()
index 4bae260bec4820b00a82ec31cfda06d78c648c3b..0fe2fcdf73a1076cce085340b298c0a067e88cf3 100644 (file)
@@ -27,7 +27,7 @@
 #warning "FIXME remove gettext hack"
 #endif
 
-#define _(x) x
+#include "glibintl.h"
 
 GQuark
 g_shell_error_quark (void)
index 3033285d2ea0d7c30210f5acb90091fed767f6d8..2b81a22ba2a21396eab2c0f7908739aeef1aa7bc 100644 (file)
 #include <process.h>
 #include <direct.h>
 
-#ifdef _
-#warning "FIXME remove gettext hack"
-#endif
-
-#define _(x) x
+#include "glibintl.h"
 
 #ifdef G_SPAWN_WIN32_DEBUG
   static int debug = 1;
index b1342ccaa43b7e7ac305ec73e884985ea416a8d9..fdb8752daed2e3fcd51388a8197b2c0cba4ff2c6 100644 (file)
 #include <sys/select.h>
 #endif /* HAVE_SYS_SELECT_H */
 
-#ifdef _
-#warning "FIXME remove gettext hack"
-#endif
-
-#define _(x) x
+#include "glibintl.h"
 
 static gint g_execute (const gchar  *file,
                        gchar **argv,
index 788b74ad9b692774640f8cea585f39664fb22abf..e1091c6f1ca1848547d4a2fef698b4f4a40adbdd 100644 (file)
@@ -33,7 +33,7 @@
 #include <windows.h>
 #endif
 
-#define _(s) (s)
+#include "glibintl.h"
 
 #define UTF8_COMPUTE(Char, Mask, Len)                                        \
   if (Char < 128)                                                            \
index 449a2518df44dc33233ed94cf200ec470aedb22f..9004546d85eb26dd60d6484e84dcd721b6c920cf 100644 (file)
@@ -1001,3 +1001,20 @@ g_get_codeset (void)
 #endif
 #endif
 }
+
+#ifdef ENABLE_NLS
+
+#include <libintl.h>
+
+int _glib_gettext_initialized = 0;
+
+char *_glib_gettext_init (const char *str)
+{
+  bindtextdomain(GETTEXT_PACKAGE, GLIB_LOCALE_DIR);
+  
+  return dgettext (GETTEXT_PACKAGE, str);
+}
+
+#endif /* ENABLE_NLS */
+
+
diff --git a/glibintl.h b/glibintl.h
new file mode 100644 (file)
index 0000000..a210170
--- /dev/null
@@ -0,0 +1,33 @@
+#ifndef __GLIBINTL_H__
+#define __GLIBINTL_H__
+
+#include "config.h"
+
+#ifdef ENABLE_NLS
+
+extern int _glib_gettext_initialized;
+
+char *_glib_gettext_init (const char *str);
+
+#include<libintl.h>
+#define _(String)                         \
+   (_glib_gettext_initialized ?            \
+      dgettext(GETTEXT_PACKAGE,String) :  \
+      _glib_gettext_init(String))
+
+#ifdef gettext_noop
+#define N_(String) gettext_noop(String)
+#else
+#define N_(String) (String)
+#endif
+#else /* NLS is disabled */
+#define _(String) (String)
+#define N_(String) (String)
+#define textdomain(String) (String)
+#define gettext(String) (String)
+#define dgettext(Domain,String) (String)
+#define dcgettext(Domain,String,Type) (String)
+#define bindtextdomain(Domain,Directory) (Domain) 
+#endif
+
+#endif /* __GLIBINTL_H__ */
index 0160d8c6e82f4cf3d8d61e0d95fd9a37b6878ab7..6fd5a10b9e96992bd0feb94768e61401a13bf26c 100644 (file)
--- a/gmarkup.c
+++ b/gmarkup.c
@@ -25,8 +25,7 @@
 #include <stdlib.h>
 #include <errno.h>
 
-/* FIXME */
-#define _(x) x
+#include "glibintl.h"
 
 GQuark
 g_markup_error_quark ()
index 4bae260bec4820b00a82ec31cfda06d78c648c3b..0fe2fcdf73a1076cce085340b298c0a067e88cf3 100644 (file)
--- a/gshell.c
+++ b/gshell.c
@@ -27,7 +27,7 @@
 #warning "FIXME remove gettext hack"
 #endif
 
-#define _(x) x
+#include "glibintl.h"
 
 GQuark
 g_shell_error_quark (void)
index 3033285d2ea0d7c30210f5acb90091fed767f6d8..2b81a22ba2a21396eab2c0f7908739aeef1aa7bc 100644 (file)
 #include <process.h>
 #include <direct.h>
 
-#ifdef _
-#warning "FIXME remove gettext hack"
-#endif
-
-#define _(x) x
+#include "glibintl.h"
 
 #ifdef G_SPAWN_WIN32_DEBUG
   static int debug = 1;
index b1342ccaa43b7e7ac305ec73e884985ea416a8d9..fdb8752daed2e3fcd51388a8197b2c0cba4ff2c6 100644 (file)
--- a/gspawn.c
+++ b/gspawn.c
 #include <sys/select.h>
 #endif /* HAVE_SYS_SELECT_H */
 
-#ifdef _
-#warning "FIXME remove gettext hack"
-#endif
-
-#define _(x) x
+#include "glibintl.h"
 
 static gint g_execute (const gchar  *file,
                        gchar **argv,
diff --git a/gutf8.c b/gutf8.c
index 788b74ad9b692774640f8cea585f39664fb22abf..e1091c6f1ca1848547d4a2fef698b4f4a40adbdd 100644 (file)
--- a/gutf8.c
+++ b/gutf8.c
@@ -33,7 +33,7 @@
 #include <windows.h>
 #endif
 
-#define _(s) (s)
+#include "glibintl.h"
 
 #define UTF8_COMPUTE(Char, Mask, Len)                                        \
   if (Char < 128)                                                            \
index 449a2518df44dc33233ed94cf200ec470aedb22f..9004546d85eb26dd60d6484e84dcd721b6c920cf 100644 (file)
--- a/gutils.c
+++ b/gutils.c
@@ -1001,3 +1001,20 @@ g_get_codeset (void)
 #endif
 #endif
 }
+
+#ifdef ENABLE_NLS
+
+#include <libintl.h>
+
+int _glib_gettext_initialized = 0;
+
+char *_glib_gettext_init (const char *str)
+{
+  bindtextdomain(GETTEXT_PACKAGE, GLIB_LOCALE_DIR);
+  
+  return dgettext (GETTEXT_PACKAGE, str);
+}
+
+#endif /* ENABLE_NLS */
+
+
diff --git a/m4macros/glib-gettext.m4 b/m4macros/glib-gettext.m4
new file mode 100644 (file)
index 0000000..a9155cb
--- /dev/null
@@ -0,0 +1,344 @@
+# Macro to add for using GNU gettext.
+# Ulrich Drepper <drepper@cygnus.com>, 1995.
+#
+# Modified to never use included libintl. 
+# Owen Taylor <otaylor@redhat.com>, 12/15/1998
+#
+#
+# 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.
+#
+#
+# If you make changes to this file, you MUST update the copy in
+# acinclude.m4. [ aclocal dies on duplicate macros, so if
+# we run 'aclocal -I macros/' then we'll run into problems
+# once we've installed glib-gettext.m4 :-( ]
+#
+
+# serial 5
+
+AC_DEFUN(AM_GLIB_WITH_NLS,
+  [AC_MSG_CHECKING([whether NLS is requested])
+    dnl Default is enabled NLS
+    AC_ARG_ENABLE(nls,
+      [  --disable-nls           do not use Native Language Support],
+      USE_NLS=$enableval, USE_NLS=yes)
+    AC_MSG_RESULT($USE_NLS)
+    AC_SUBST(USE_NLS)
+
+    USE_INCLUDED_LIBINTL=no
+
+    dnl If we use NLS figure out what method
+    if test "$USE_NLS" = "yes"; then
+#      AC_DEFINE(ENABLE_NLS)
+#      AC_MSG_CHECKING([whether included gettext is requested])
+#      AC_ARG_WITH(included-gettext,
+#        [  --with-included-gettext use the GNU gettext library included here],
+#        nls_cv_force_use_gnu_gettext=$withval,
+#        nls_cv_force_use_gnu_gettext=no)
+#      AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
+      nls_cv_force_use_gnu_gettext="no"
+
+      nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
+      if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
+        dnl User does not insist on using GNU NLS library.  Figure out what
+        dnl to use.  If gettext or catgets are available (in this order) we
+        dnl use this.  Else we have to fall back to GNU NLS library.
+       dnl catgets is only used if permitted by option --with-catgets.
+       nls_cv_header_intl=
+       nls_cv_header_libgt=
+       CATOBJEXT=NONE
+
+       AC_CHECK_HEADER(libintl.h,
+         [AC_CACHE_CHECK([for dgettext in libc], gt_cv_func_dgettext_libc,
+           [AC_TRY_LINK([#include <libintl.h>], [return (int) dgettext ("","")],
+              gt_cv_func_dgettext_libc=yes, gt_cv_func_dgettext_libc=no)])
+
+          if test "$gt_cv_func_dgettext_libc" != "yes"; then
+            AC_CHECK_LIB(intl, bindtextdomain,
+              [AC_CACHE_CHECK([for dgettext in libintl],
+                gt_cv_func_dgettext_libintl,
+                [AC_CHECK_LIB(intl, dgettext,
+                 gt_cv_func_dgettext_libintl=yes,
+                 gt_cv_func_dgettext_libintl=no)],
+                gt_cv_func_dgettext_libintl=no)])
+          fi
+
+           if test "$gt_cv_func_dgettext_libintl" = "yes"; then
+            LIBS="$LIBS -lintl";
+           fi
+
+          if test "$gt_cv_func_dgettext_libc" = "yes" \
+             || test "$gt_cv_func_dgettext_libintl" = "yes"; then
+             AC_DEFINE(HAVE_GETTEXT)
+             AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
+               [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
+             if test "$MSGFMT" != "no"; then
+               AC_CHECK_FUNCS(dcgettext)
+               AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
+               AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
+                 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
+               AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
+                              return _nl_msg_cat_cntr],
+                 [CATOBJEXT=.gmo
+                  DATADIRNAME=share],
+                 [CATOBJEXT=.mo
+                  DATADIRNAME=lib])
+               INSTOBJEXT=.mo
+             fi
+           fi
+
+           # Added by Martin Baulig 12/15/98 for libc5 systems
+           if test "$gt_cv_func_dgettext_libc" != "yes" \
+              && test "$gt_cv_func_dgettext_libintl" = "yes"; then
+              INTLLIBS=-lintl
+              LIBS=`echo $LIBS | sed -e 's/-lintl//'`
+           fi
+       ])
+
+#        if test "$CATOBJEXT" = "NONE"; then
+#        AC_MSG_CHECKING([whether catgets can be used])
+#        AC_ARG_WITH(catgets,
+#          [  --with-catgets          use catgets functions if available],
+#          nls_cv_use_catgets=$withval, nls_cv_use_catgets=no)
+#        AC_MSG_RESULT($nls_cv_use_catgets)
+#
+#        if test "$nls_cv_use_catgets" = "yes"; then
+#          dnl No gettext in C library.  Try catgets next.
+#          AC_CHECK_LIB(i, main)
+#          AC_CHECK_FUNC(catgets,
+#            [AC_DEFINE(HAVE_CATGETS)
+#             INTLOBJS="\$(CATOBJS)"
+#             AC_PATH_PROG(GENCAT, gencat, no)dnl
+#             if test "$GENCAT" != "no"; then
+#               AC_PATH_PROG(GMSGFMT, gmsgfmt, no)
+#               if test "$GMSGFMT" = "no"; then
+#                 AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt,
+#                  [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)
+#               fi
+#               AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
+#                 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
+#               USE_INCLUDED_LIBINTL=yes
+#               CATOBJEXT=.cat
+#               INSTOBJEXT=.cat
+#               DATADIRNAME=lib
+#               INTLDEPS='$(top_builddir)/intl/libintl.a'
+#               INTLLIBS=$INTLDEPS
+#               LIBS=`echo $LIBS | sed -e 's/-lintl//'`
+#               nls_cv_header_intl=intl/libintl.h
+#               nls_cv_header_libgt=intl/libgettext.h
+#              fi
+#            ])
+#        fi
+#        fi
+
+        if test "$CATOBJEXT" = "NONE"; then
+         dnl Neither gettext nor catgets in included in the C library.
+         dnl Fall back on GNU gettext library.
+         nls_cv_use_gnu_gettext=yes
+        fi
+      fi
+
+      if test "$nls_cv_use_gnu_gettext" != "yes"; then
+        AC_DEFINE(ENABLE_NLS)
+      else
+         dnl Unset this variable since we use the non-zero value as a flag.
+         CATOBJEXT=
+#        dnl Mark actions used to generate GNU NLS library.
+#        INTLOBJS="\$(GETTOBJS)"
+#        AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
+#        [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
+#        AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
+#        AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
+#        [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
+#        AC_SUBST(MSGFMT)
+#      USE_INCLUDED_LIBINTL=yes
+#        CATOBJEXT=.gmo
+#        INSTOBJEXT=.mo
+#        DATADIRNAME=share
+#      INTLDEPS='$(top_builddir)/intl/libintl.a'
+#      INTLLIBS=$INTLDEPS
+#      LIBS=`echo $LIBS | sed -e 's/-lintl//'`
+#        nls_cv_header_intl=intl/libintl.h
+#        nls_cv_header_libgt=intl/libgettext.h
+      fi
+
+      dnl Test whether we really found GNU xgettext.
+      if test "$XGETTEXT" != ":"; then
+       dnl If it is no GNU xgettext we define it as : so that the
+       dnl Makefiles still can work.
+       if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
+         : ;
+       else
+         AC_MSG_RESULT(
+           [found xgettext program is not GNU xgettext; ignore it])
+         XGETTEXT=":"
+       fi
+      fi
+
+      # We need to process the po/ directory.
+      POSUB=po
+    else
+      DATADIRNAME=share
+      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.
+#    if test "$PACKAGE" = gettext; then
+#      USE_NLS=yes
+#      USE_INCLUDED_LIBINTL=yes
+#    fi
+
+    dnl These rules are solely for the distribution goal.  While doing this
+    dnl we only have to keep exactly one list of the available catalogs
+    dnl in configure.in.
+    for lang in $ALL_LINGUAS; do
+      GMOFILES="$GMOFILES $lang.gmo"
+      POFILES="$POFILES $lang.po"
+    done
+
+    dnl Make all variables we use known to autoconf.
+    AC_SUBST(USE_INCLUDED_LIBINTL)
+    AC_SUBST(CATALOGS)
+    AC_SUBST(CATOBJEXT)
+    AC_SUBST(DATADIRNAME)
+    AC_SUBST(GMOFILES)
+    AC_SUBST(INSTOBJEXT)
+    AC_SUBST(INTLDEPS)
+    AC_SUBST(INTLLIBS)
+    AC_SUBST(INTLOBJS)
+    AC_SUBST(POFILES)
+    AC_SUBST(POSUB)
+  ])
+
+AC_DEFUN(AM_GLIB_GNU_GETTEXT,
+  [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+   AC_REQUIRE([AC_PROG_CC])dnl
+   AC_REQUIRE([AC_PROG_RANLIB])dnl
+#   AC_REQUIRE([AC_ISC_POSIX])dnl
+   AC_REQUIRE([AC_HEADER_STDC])dnl
+   AC_REQUIRE([AC_C_CONST])dnl
+   AC_REQUIRE([AC_C_INLINE])dnl
+   AC_REQUIRE([AC_TYPE_OFF_T])dnl
+   AC_REQUIRE([AC_TYPE_SIZE_T])dnl
+   AC_REQUIRE([AC_FUNC_ALLOCA])dnl
+   AC_REQUIRE([AC_FUNC_MMAP])dnl
+
+   AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
+unistd.h sys/param.h])
+   AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
+strdup __argz_count __argz_stringify __argz_next])
+
+#   if test "${ac_cv_func_stpcpy+set}" != "set"; then
+#     AC_CHECK_FUNCS(stpcpy)
+#   fi
+#   if test "${ac_cv_func_stpcpy}" = "yes"; then
+#     AC_DEFINE(HAVE_STPCPY)
+#   fi
+
+   AM_LC_MESSAGES
+   AM_GLIB_WITH_NLS
+
+   if test "x$CATOBJEXT" != "x"; then
+     if test "x$ALL_LINGUAS" = "x"; then
+       LINGUAS=
+     else
+       AC_MSG_CHECKING(for catalogs to be installed)
+       NEW_LINGUAS=
+       for lang in ${LINGUAS=$ALL_LINGUAS}; do
+         case "$ALL_LINGUAS" in
+          *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
+         esac
+       done
+       LINGUAS=$NEW_LINGUAS
+       AC_MSG_RESULT($LINGUAS)
+     fi
+
+     dnl Construct list of names of catalog files to be constructed.
+     if test -n "$LINGUAS"; then
+       for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
+     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
+   test -d po || mkdir po
+   if test "$CATOBJEXT" = ".cat"; then
+     AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
+
+     dnl Transform the SED scripts while copying because some dumb SEDs
+     dnl cannot handle comments.
+     sed -e '/^#/d' $srcdir/po/$msgformat-msg.sed > po/po2msg.sed
+   fi
+   dnl po2tbl.sed is always needed.
+   sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
+     $srcdir/po/po2tbl.sed.in > po/po2tbl.sed
+
+#   dnl In the intl/Makefile.in we have a special dependency which makes
+#   dnl only sense for gettext.  We comment this out for non-gettext
+#   dnl packages.
+#   if test "$PACKAGE" = "gettext"; then
+#     GT_NO="#NO#"
+#     GT_YES=
+#   else
+#     GT_NO=
+#     GT_YES="#YES#"
+#   fi
+#   AC_SUBST(GT_NO)
+#   AC_SUBST(GT_YES)
+
+   dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
+   dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
+   dnl Try to locate is.
+   MKINSTALLDIRS=
+   if test -n "$ac_aux_dir"; then
+     MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
+   fi
+   if test -z "$MKINSTALLDIRS"; then
+     MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
+   fi
+   AC_SUBST(MKINSTALLDIRS)
+
+#   dnl *** For now the libtool support in intl/Makefile is not for real.
+#   l=
+#   AC_SUBST(l)
+
+   dnl Generate list of files to be processed by xgettext which will
+   dnl be included in po/Makefile.
+   test -d po || mkdir po
+   if test "x$srcdir" != "x."; then
+     if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
+       posrcprefix="$srcdir/"
+     else
+       posrcprefix="../$srcdir/"
+     fi
+   else
+     posrcprefix="../"
+   fi
+   rm -f po/POTFILES
+   sed -e "/^#/d" -e "/^\$/d" -e "s,.*,        $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
+       < $srcdir/po/POTFILES.in > po/POTFILES
+  ])
+
diff --git a/po/.cvsignore b/po/.cvsignore
new file mode 100644 (file)
index 0000000..3ab5cbd
--- /dev/null
@@ -0,0 +1,9 @@
+*.gmo
+*.mo
+Makefile
+Makefile.in
+POTFILES
+cat-id-tbl.c
+glib20.pot
+po2tbl.sed
+stamp-cat-id
diff --git a/po/Makefile.in.in b/po/Makefile.in.in
new file mode 100644 (file)
index 0000000..e6a1a75
--- /dev/null
@@ -0,0 +1,252 @@
+# Makefile for program source directory in GNU NLS utilities package.
+# Copyright (C) 1995, 1996, 1997 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
+#
+# This file file 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.
+#
+# - Modified by Owen Taylor <otaylor@redhat.com> to use GETTEXT_PACKAGE
+#   instead of PACKAGE and to look for po2tbl in ./ not in intl/
+#
+
+GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
+VERSION = @VERSION@
+
+SHELL = /bin/sh
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+datadir = $(prefix)/@DATADIRNAME@
+localedir = $(datadir)/locale
+gnulocaledir = $(prefix)/share/locale
+gettextsrcdir = $(prefix)/share/gettext/po
+subdir = po
+
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+MKINSTALLDIRS = $(top_srcdir)/@MKINSTALLDIRS@
+
+CC = @CC@
+GENCAT = @GENCAT@
+GMSGFMT = PATH=../src:$$PATH @GMSGFMT@
+MSGFMT = @MSGFMT@
+XGETTEXT = PATH=../src:$$PATH @XGETTEXT@
+MSGMERGE = PATH=../src:$$PATH msgmerge
+
+DEFS = @DEFS@
+CFLAGS = @CFLAGS@
+CPPFLAGS = @CPPFLAGS@
+
+INCLUDES = -I.. -I$(top_srcdir)/intl
+
+COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
+
+SOURCES = cat-id-tbl.c
+POFILES = @POFILES@
+GMOFILES = @GMOFILES@
+DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(GETTEXT_PACKAGE).pot \
+stamp-cat-id $(POFILES) $(GMOFILES) $(SOURCES)
+
+POTFILES = \
+
+CATALOGS = @CATALOGS@
+CATOBJEXT = @CATOBJEXT@
+INSTOBJEXT = @INSTOBJEXT@
+
+.SUFFIXES:
+.SUFFIXES: .c .o .po .pox .gmo .mo .msg .cat
+
+.c.o:
+       $(COMPILE) $<
+
+.po.pox:
+       $(MAKE) $(GETTEXT_PACKAGE).pot
+       $(MSGMERGE) $< $(srcdir)/$(GETTEXT_PACKAGE).pot -o $*.pox
+
+.po.mo:
+       $(MSGFMT) -o $@ $<
+
+.po.gmo:
+       file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \
+         && rm -f $$file && $(GMSGFMT) -o $$file $<
+
+.po.cat:
+       sed -f ../intl/po2msg.sed < $< > $*.msg \
+         && rm -f $@ && $(GENCAT) $@ $*.msg
+
+
+all: all-@USE_NLS@
+
+all-yes: cat-id-tbl.c $(CATALOGS)
+all-no:
+
+$(srcdir)/$(GETTEXT_PACKAGE).pot: $(POTFILES)
+       $(XGETTEXT) --default-domain=$(GETTEXT_PACKAGE) --directory=$(top_srcdir) \
+         --add-comments --keyword=_ --keyword=N_ \
+         --files-from=$(srcdir)/POTFILES.in \
+       && test ! -f $(GETTEXT_PACKAGE).po \
+          || ( rm -f $(srcdir)/$(GETTEXT_PACKAGE).pot \
+               && mv $(GETTEXT_PACKAGE).po $(srcdir)/$(GETTEXT_PACKAGE).pot )
+
+$(srcdir)/cat-id-tbl.c: stamp-cat-id; @:
+$(srcdir)/stamp-cat-id: $(GETTEXT_PACKAGE).pot
+       rm -f cat-id-tbl.tmp
+       sed -f ./po2tbl.sed $(srcdir)/$(GETTEXT_PACKAGE).pot \
+               | sed -e "s/@GETTEXT_PACKAGE NAME@/$(GETTEXT_PACKAGE)/" > cat-id-tbl.tmp
+       if cmp -s cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; then \
+         rm cat-id-tbl.tmp; \
+       else \
+         echo cat-id-tbl.c changed; \
+         rm -f $(srcdir)/cat-id-tbl.c; \
+         mv cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; \
+       fi
+       cd $(srcdir) && rm -f stamp-cat-id && echo timestamp > stamp-cat-id
+
+
+install: install-exec install-data
+install-exec:
+install-data: install-data-@USE_NLS@
+install-data-no: all
+install-data-yes: all
+       if test -r "$(MKINSTALLDIRS)"; then \
+         $(MKINSTALLDIRS) $(datadir); \
+       else \
+         $(SHELL) $(top_srcdir)/mkinstalldirs $(datadir); \
+       fi
+       @catalogs='$(CATALOGS)'; \
+       for cat in $$catalogs; do \
+         cat=`basename $$cat`; \
+         case "$$cat" in \
+           *.gmo) destdir=$(gnulocaledir);; \
+           *)     destdir=$(localedir);; \
+         esac; \
+         lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
+         dir=$$destdir/$$lang/LC_MESSAGES; \
+         if test -r "$(MKINSTALLDIRS)"; then \
+           $(MKINSTALLDIRS) $$dir; \
+         else \
+           $(SHELL) $(top_srcdir)/mkinstalldirs $$dir; \
+         fi; \
+         if test -r $$cat; then \
+           $(INSTALL_DATA) $$cat $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
+           echo "installing $$cat as $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT)"; \
+         else \
+           $(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
+           echo "installing $(srcdir)/$$cat as" \
+                "$$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT)"; \
+         fi; \
+         if test -r $$cat.m; then \
+           $(INSTALL_DATA) $$cat.m $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
+           echo "installing $$cat.m as $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m"; \
+         else \
+           if test -r $(srcdir)/$$cat.m ; then \
+             $(INSTALL_DATA) $(srcdir)/$$cat.m \
+               $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
+             echo "installing $(srcdir)/$$cat as" \
+                  "$$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m"; \
+           else \
+             true; \
+           fi; \
+         fi; \
+       done
+       if test "$(GETTEXT_PACKAGE)" = "gettext"; then \
+         if test -r "$(MKINSTALLDIRS)"; then \
+           $(MKINSTALLDIRS) $(gettextsrcdir); \
+         else \
+           $(SHELL) $(top_srcdir)/mkinstalldirs $(gettextsrcdir); \
+         fi; \
+         $(INSTALL_DATA) $(srcdir)/Makefile.in.in \
+                         $(gettextsrcdir)/Makefile.in.in; \
+       else \
+         : ; \
+       fi
+
+# Define this as empty until I found a useful application.
+installcheck:
+
+uninstall:
+       catalogs='$(CATALOGS)'; \
+       for cat in $$catalogs; do \
+         cat=`basename $$cat`; \
+         lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
+         rm -f $(localedir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
+         rm -f $(localedir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
+         rm -f $(gnulocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
+         rm -f $(gnulocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
+       done
+       rm -f $(gettextsrcdir)/po-Makefile.in.in
+
+check: all
+
+cat-id-tbl.o: ../intl/libgettext.h
+
+dvi info tags TAGS ID:
+
+mostlyclean:
+       rm -f core core.* *.pox $(GETTEXT_PACKAGE).po *.old.po cat-id-tbl.tmp
+       rm -fr *.o
+
+clean: mostlyclean
+
+distclean: clean
+       rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m
+
+maintainer-clean: distclean
+       @echo "This command is intended for maintainers to use;"
+       @echo "it deletes files that may require special tools to rebuild."
+       rm -f $(GMOFILES)
+
+distdir = ../$(GETTEXT_PACKAGE)-$(VERSION)/$(subdir)
+dist distdir: update-po $(DISTFILES)
+       dists="$(DISTFILES)"; \
+       for file in $$dists; do \
+         ln $(srcdir)/$$file $(distdir) 2> /dev/null \
+           || cp -p $(srcdir)/$$file $(distdir); \
+       done
+
+update-po: Makefile
+       $(MAKE) $(GETTEXT_PACKAGE).pot
+       PATH=`pwd`/../src:$$PATH; \
+       cd $(srcdir); \
+       catalogs='$(CATALOGS)'; \
+       for cat in $$catalogs; do \
+         cat=`basename $$cat`; \
+         lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
+         mv $$lang.po $$lang.old.po; \
+         echo "$$lang:"; \
+         if $(MSGMERGE) $$lang.old.po $(GETTEXT_PACKAGE).pot -o $$lang.po; then \
+           rm -f $$lang.old.po; \
+         else \
+           echo "msgmerge for $$cat failed!"; \
+           rm -f $$lang.po; \
+           mv $$lang.old.po $$lang.po; \
+         fi; \
+       done
+
+POTFILES: POTFILES.in
+       ( if test 'x$(srcdir)' != 'x.'; then \
+           posrcprefix='$(top_srcdir)/'; \
+         else \
+           posrcprefix="../"; \
+         fi; \
+         rm -f $@-t $@ \
+           && (sed -e '/^#/d' -e '/^[  ]*$$/d' \
+                   -e "s@.*@   $$posrcprefix& \\\\@" < $(srcdir)/$@.in \
+               | sed -e '$$s/\\$$//') > $@-t \
+           && chmod a-w $@-t \
+           && mv $@-t $@ )
+
+Makefile: Makefile.in.in ../config.status POTFILES
+       cd .. \
+         && CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \
+              $(SHELL) ./config.status
+
+# Tell versions [3.59,3.63) of GNU make not to export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/po/POTFILES.in b/po/POTFILES.in
new file mode 100644 (file)
index 0000000..5042c47
--- /dev/null
@@ -0,0 +1,7 @@
+gconvert.c
+gfileutils.c
+gmarkup.c
+gshell.c
+gspawn-win32.c
+gspawn.c
+gutf8.c
diff --git a/po/po2tbl.sed.in b/po/po2tbl.sed.in
new file mode 100644 (file)
index 0000000..b3bcca4
--- /dev/null
@@ -0,0 +1,102 @@
+# po2tbl.sed - Convert Uniforum style .po file to lookup table for catgets
+# Copyright (C) 1995 Free Software Foundation, Inc.
+# Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+1 {
+  i\
+/* Automatically generated by po2tbl.sed from @PACKAGE NAME@.pot.  */\
+\
+#if HAVE_CONFIG_H\
+# include <config.h>\
+#endif\
+\
+#include "libgettext.h"\
+\
+const struct _msg_ent _msg_tbl[] = {
+  h
+  s/.*/0/
+  x
+}
+#
+# Write msgid entries in C array form.
+#
+/^msgid/ {
+  s/msgid[     ]*\(".*"\)/  {\1/
+  tb
+# Append the next line
+  :b
+  N
+# Look whether second part is continuation line.
+  s/\(.*\)"\(\n\)"\(.*"\)/\1\2\3/
+# Yes, then branch.
+  ta
+# Because we assume that the input file correctly formed the line
+# just read cannot be again be a msgid line.  So it's safe to ignore
+# it.
+  s/\(.*\)\n.*/\1/
+  bc
+# We found a continuation line.  But before printing insert '\'.
+  :a
+  s/\(.*\)\(\n.*\)/\1\\\2/
+  P
+# We cannot use D here.
+  s/.*\n\(.*\)/\1/
+# Some buggy seds do not clear the `successful substitution since last ``t'''
+# flag on `N', so we do a `t' here to clear it.
+  tb
+# Not reached
+  :c
+  x
+# The following nice solution is by
+# Bruno <Haible@ma2s2.mathematik.uni-karlsruhe.de>
+  td
+# Increment a decimal number in pattern space.
+# First hide trailing `9' digits.
+  :d
+  s/9\(_*\)$/_\1/
+  td
+# Assure at least one digit is available.
+  s/^\(_*\)$/0\1/
+# Increment the last digit.
+  s/8\(_*\)$/9\1/
+  s/7\(_*\)$/8\1/
+  s/6\(_*\)$/7\1/
+  s/5\(_*\)$/6\1/
+  s/4\(_*\)$/5\1/
+  s/3\(_*\)$/4\1/
+  s/2\(_*\)$/3\1/
+  s/1\(_*\)$/2\1/
+  s/0\(_*\)$/1\1/
+# Convert the hidden `9' digits to `0's.
+  s/_/0/g
+  x
+  G
+  s/\(.*\)\n\([0-9]*\)/\1, \2},/
+  s/\(.*\)"$/\1/
+  p
+}
+#
+# Last line.
+#
+$ {
+  i\
+};\
+
+  g
+  s/0*\(.*\)/int _msg_tbl_length = \1;/p
+}
+d