aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2005-11-02 10:10:28 +0000
committerWerner Koch <[email protected]>2005-11-02 10:10:28 +0000
commitd1371025c1c05c82387581d26fb97d95be43303e (patch)
tree629ddd30b309853bb871326c7b7b502c02714f24
parentUse bzip2 for the dist target. (diff)
downloadlibgpg-error-d1371025c1c05c82387581d26fb97d95be43303e.tar.gz
libgpg-error-d1371025c1c05c82387581d26fb97d95be43303e.zip
Changes for building on W32 without needing libintl.
-rw-r--r--ChangeLog13
-rwxr-xr-xautogen.sh3
-rw-r--r--configure.ac9
-rw-r--r--src/Makefile.am2
-rw-r--r--src/gpg-error.c4
-rw-r--r--src/w32-gettext.c26
-rw-r--r--src/w32-gettext.h2
7 files changed, 39 insertions, 20 deletions
diff --git a/ChangeLog b/ChangeLog
index fd84467..a3c5f47 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2005-11-02 Werner Koch <[email protected]>
+
+ * src/Makefile.am (gpg_error_SOURCES): Include ARCH_SOURCES.
+ * src/gpg-error.c [W32]: Include gettext.h instead of libintl.h.
+
+ * configure.ac (AH_BOTTOM): Define ENABLE_NLS for W32 builds.
+ * src/w32-gettext.h (dgettext): Changed prototype from
+ libintl_dgettext.
+ * src/w32-gettext.c: Replaced use of WIN32 by HAVE_W32_SYSTEM on
+ demand of the holy GNUquisition.
+ (bindtextdomain, textdomain, dgettext): Need to cast the const way
+ from the return value.
+
2005-10-26 Werner Koch <[email protected]>
* Makefile.am: Used dist-bzip2 option.
diff --git a/autogen.sh b/autogen.sh
index d20cc90..06ab93f 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -74,8 +74,7 @@ if test "$1" = "--build-w32"; then
fi
./configure --enable-maintainer-mode --prefix=${w32root} \
- --host=i586-mingw32msvc --build=${build} \
- --disable-shared
+ --host=i586-mingw32msvc --build=${build}
exit $?
fi
diff --git a/configure.ac b/configure.ac
index 0c2d982..291fce1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -80,7 +80,14 @@ case "${host}" in
esac
-# Checks for libraries.
+AH_BOTTOM([
+/* Force using of NLS for W32 even if no libintl has been found. This is
+ okay because we have our own gettext implementation for W32. */
+#if defined(HAVE_W32_SYSTEM) && !defined(ENABLE_NLS)
+#define ENABLE_NLS 1
+#endif
+])
+
# Note, that autogen.sh greps for the next line.
AM_GNU_GETTEXT_VERSION(0.12.1)
diff --git a/src/Makefile.am b/src/Makefile.am
index 69764b3..c0f8fc2 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -95,7 +95,7 @@ libgpg_error_la_SOURCES = gpg-error.h gettext.h $(arch_sources) \
libgpg_error_la_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\"
libgpg_error_la_LIBADD = $(intllibs)
-gpg_error_SOURCES = strsource-sym.c strerror-sym.c gpg-error.c
+gpg_error_SOURCES = strsource-sym.c strerror-sym.c gpg-error.c $(arch_sources)
gpg_error_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\"
gpg_error_LDADD = ./libgpg-error.la @LTLIBINTL@
diff --git a/src/gpg-error.c b/src/gpg-error.c
index 676149d..8197356 100644
--- a/src/gpg-error.c
+++ b/src/gpg-error.c
@@ -33,7 +33,11 @@
# include <locale.h>
#endif
#ifdef ENABLE_NLS
+#ifdef HAVE_W32_SYSTEM
+# include "gettext.h"
+#else
# include <libintl.h>
+#endif
# define _(a) gettext (a)
# ifdef gettext_noop
# define N_(a) gettext_noop (a)
diff --git a/src/w32-gettext.c b/src/w32-gettext.c
index 643711a..34c2a77 100644
--- a/src/w32-gettext.c
+++ b/src/w32-gettext.c
@@ -70,13 +70,7 @@
#include <stdlib.h>
#include <locale.h>
-#if defined _WIN32 || defined __WIN32__
-# undef WIN32 /* avoid warning on mingw32 */
-# define WIN32
-#endif
-
-#ifdef WIN32
-# define WIN32_LEAN_AND_MEAN
+#ifdef HAVE_W32_SYSTEM
# include <windows.h>
/* List of language codes, sorted by value:
0x01 LANG_ARABIC
@@ -725,7 +719,7 @@
# ifndef SUBLANG_UZBEK_CYRILLIC
# define SUBLANG_UZBEK_CYRILLIC 0x02
# endif
-#endif
+#endif /* HAVE_W32_SYSTEM */
/* XPG3 defines the result of 'setlocale (category, NULL)' as:
"Directs 'setlocale()' to query 'category' and return the current
@@ -748,13 +742,13 @@ _nl_locale_name (int category, const char *categoryname)
{
const char *retval;
-#ifndef WIN32
+#ifndef HAVE_W32_SYSTEM
/* Use the POSIX methods of looking to 'LC_ALL', 'LC_xxx', and 'LANG'.
On some systems this can be done by the 'setlocale' function itself. */
# if defined HAVE_SETLOCALE && defined HAVE_LC_MESSAGES && defined HAVE_LOCALE_NULL
retval = setlocale (category, NULL);
-# else
+# else
/* Setting of LC_ALL overwrites all other. */
retval = getenv ("LC_ALL");
if (retval == NULL || retval[0] == '\0')
@@ -775,7 +769,7 @@ _nl_locale_name (int category, const char *categoryname)
return retval;
-#else /* WIN32 */
+#else /* HAVE_W32_SYSTEM */
/* Return an XPG style locale name language[_territory][@modifier].
Don't even bother determining the codeset; it's not useful in this
@@ -1185,7 +1179,7 @@ _nl_locale_name (int category, const char *categoryname)
default: return "C";
}
-#endif
+#endif /* HAVE_W32_SYSTEM */
}
/* localname.c from gettext END. */
@@ -1617,7 +1611,9 @@ bindtextdomain (const char *domainname, const char *dirname)
if (the_domain)
free_domain (the_domain);
the_domain = domain;
- return dirname;
+
+ /* For historic reasoins we are not allowed to return a const char*. */
+ return (char*)dirname;
}
@@ -1705,12 +1701,12 @@ char *
textdomain (const char *domainname)
{
/* For now, support only one domain. */
- return domainname;
+ return (char*)domainname;
}
char *
dgettext (const char *domainname, const char *msgid)
{
/* For now, support only one domain. */
- return gettext (msgid);
+ return (char*)gettext (msgid);
}
diff --git a/src/w32-gettext.h b/src/w32-gettext.h
index b85528a..ee11f2a 100644
--- a/src/w32-gettext.h
+++ b/src/w32-gettext.h
@@ -49,6 +49,6 @@ const char *gettext (const char *msgid);
char *textdomain (const char *domainname);
-char *libintl_dgettext (const char *domainname, const char *msgid);
+char *dgettext (const char *domainname, const char *msgid);
#endif /* ENABLE_NLS */