/util/drmingw: 3103eb8b8594: Use some dummy libintl_* stubs to p...

Daniel Atallah datallah at pidgin.im
Mon Sep 10 12:11:13 EDT 2012


Changeset: 3103eb8b85945c209251031eab3d7a4bec611d6d
Author:	 Daniel Atallah <datallah at pidgin.im>
Date:	 2012-09-07 16:05 -0400
Branch:	 default
URL: http://hg.pidgin.im/util/drmingw/rev/3103eb8b8594

Description:

Use some dummy libintl_* stubs to prevent actually depending on libintl.dll (due to bdf).

diffstat:

 SConscript           |   9 +++++++
 dummy_libintl_stub.h |  59 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 68 insertions(+), 0 deletions(-)

diffs (83 lines):

diff --git a/SConscript b/SConscript
--- a/SConscript
+++ b/SConscript
@@ -6,6 +6,15 @@ env.Append(CPPPATH = [
     'include',
 ])
 
+env.Append(CPPFLAGS = [
+    '-include', 'dummy_libintl_stub.h',
+])
+
+#If __USE_MINGW_ANSI_STDIO is defined to fix vfprintf, this is needed
+env.Append(LIBS = [
+    'mingwex',
+])
+
 env.Append(LINKFLAGS = [
     '-mwindows',
 ])
diff --git a/dummy_libintl_stub.h b/dummy_libintl_stub.h
new file mode 100644
--- /dev/null
+++ b/dummy_libintl_stub.h
@@ -0,0 +1,59 @@
+/* Dummy libintl_* functions to avoid depending on libintl.dll (needed for bfd) */
+#define __USE_MINGW_ANSI_STDIO 1
+#include <stdio.h>
+#include <stdarg.h>
+
+int libintl_fprintf (FILE *stream, const char *format, ...);
+inline int libintl_fprintf (FILE *stream, const char *format, ...)
+{
+	int ret = 0;
+#ifdef __USE_MINGW_ANSI_STDIO
+	va_list argptr;
+
+	va_start(argptr, format);
+	ret = vfprintf(stream, format, argptr);
+	va_end(argptr);
+#endif
+	return ret;
+}
+
+const char *libintl_dgettext (const char *domain, const char *msg);
+inline const char *libintl_dgettext (const char *domain, const char *msg)
+{
+	return msg;
+}
+
+int libintl_sprintf (char *resultbuf, const char *format, ...);
+inline int
+libintl_sprintf (char *resultbuf, const char *format, ...)
+{
+	va_list argptr;
+	int ret;
+
+	va_start(argptr, format);
+	ret = vsprintf(resultbuf, format, argptr);
+	va_end(argptr);
+
+	return ret;
+}
+
+int libintl_snprintf (char *resultbuf, size_t length, const char *format, ...);
+inline int
+libintl_snprintf (char *resultbuf, size_t length, const char *format, ...)
+{
+	va_list argptr;
+	int ret;
+
+	va_start(argptr, format);
+	ret = vsnprintf(resultbuf, length, format, argptr);
+	va_end(argptr);
+
+	return ret;
+}
+
+int libintl_vfprintf (FILE *stream, const char *format, va_list args);
+inline int
+libintl_vfprintf (FILE *stream, const char *format, va_list args)
+{
+	return vfprintf(stream, format, args);
+}



More information about the Commits mailing list