glib: Remove usage of gettext/libintl/iconv

pkg-config doesn't use message translation, so there's no need to build
it into the bundled glib. Furthermore, when not using glibc, this drags
in extra dependencies on gettext, libintl and iconv. Remove their usage
in two steps:

1. Don't include libintl.h directly from code. glibintl.h
conditionalizes the include of libintl.h based on the ENABLE_NLS define
and creates fallback macros when it's unwanted.

2. Remove the usage of the gettext macros in glib's configure.ac. This
ensures that the unwanted dependencies aren't searched for. Two defines
are kept around to keep the code happy.
This commit is contained in:
Dan Nicholson 2012-08-17 08:29:23 -07:00
parent 51468f2a9b
commit f0e821fed2
4 changed files with 45 additions and 13 deletions

View file

@ -0,0 +1,42 @@
diff --git a/glib/configure.ac b/glib/configure.ac
index a78d516..8ac9631 100644
--- a/glib/configure.ac
+++ b/glib/configure.ac
@@ -455,23 +455,12 @@ dnl
dnl gettext support
dnl
-GLIB_GNU_GETTEXT
-
-if test "$gt_cv_have_gettext" != "yes" ; then
- AC_MSG_ERROR([
-*** You must have either have gettext support in your C library, or use the
-*** GNU gettext library. (http://www.gnu.org/software/gettext/gettext.html
-])
-fi
-
-LIBS="$INTLLIBS $LIBS"
-
GETTEXT_PACKAGE=glib20
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, ["$GETTEXT_PACKAGE"],
[Define the gettext package to be used])
-GLIB_DEFINE_LOCALEDIR(GLIB_LOCALE_DIR)
+AC_DEFINE_UNQUOTED([GLIB_LOCALE_DIR], [""], [Dummy catalog directory])
dnl
dnl Now we are done with gettext checks, figure out ICONV_LIBS
diff --git a/glib/glib/ggettext.c b/glib/glib/ggettext.c
index ff1bb6b..c2d1ad5 100644
--- a/glib/glib/ggettext.c
+++ b/glib/glib/ggettext.c
@@ -40,7 +40,7 @@
#include <string.h>
#include <locale.h>
-#include <libintl.h>
+#include "glibintl.h"
#ifdef G_OS_WIN32

View file

@ -3,5 +3,6 @@ no-installed-files.patch
foreign-automake.patch
no-gregex.patch
no-pkg-config.patch
no-gettext.patch
cross-compiling.patch
static-only.patch

View file

@ -455,23 +455,12 @@ dnl
dnl gettext support
dnl
GLIB_GNU_GETTEXT
if test "$gt_cv_have_gettext" != "yes" ; then
AC_MSG_ERROR([
*** You must have either have gettext support in your C library, or use the
*** GNU gettext library. (http://www.gnu.org/software/gettext/gettext.html
])
fi
LIBS="$INTLLIBS $LIBS"
GETTEXT_PACKAGE=glib20
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, ["$GETTEXT_PACKAGE"],
[Define the gettext package to be used])
GLIB_DEFINE_LOCALEDIR(GLIB_LOCALE_DIR)
AC_DEFINE_UNQUOTED([GLIB_LOCALE_DIR], [""], [Dummy catalog directory])
dnl
dnl Now we are done with gettext checks, figure out ICONV_LIBS

View file

@ -40,7 +40,7 @@
#include <string.h>
#include <locale.h>
#include <libintl.h>
#include "glibintl.h"
#ifdef G_OS_WIN32