소스 검색

libdpkg: Include <locale.h> from <i18n.h> to fix unoptimized builds

The pgettext() macros in gettext.h make use of LC_MESSAGES, which get
normally pulled from <locale.h> through <libintl.h>, but that only
happens on optimized builds. As this is an implementation detail,
pgettext() users (through the local C_() macro) should not need to
know they have to include <locale.h>. Arguably this is a deficiency
in gettext.h which we are working around here.

Reported-by: Steve Langasek <steve.langasek@ubuntu.com>
Guillem Jover 15 년 전
부모
커밋
58c6486cdf
2개의 변경된 파일7개의 추가작업 그리고 1개의 파일을 삭제
  1. 2 0
      debian/changelog
  2. 5 1
      lib/dpkg/i18n.h

+ 2 - 0
debian/changelog

@@ -2,6 +2,8 @@ dpkg (1.16.0.2) UNRELEASED; urgency=low
 
   * Fix dpkg-split --auto to not fail when opening the new depot file.
   * Fix dpkg-split to correctly set the last part split size.
+  * Fix build failure on DEB_BUILD_OPTIONS=noopt due to a missing <locale.h>
+    include in gettext.h needed by the gettext context functions.
 
  -- Guillem Jover <guillem@debian.org>  Fri, 15 Apr 2011 23:57:19 +0200
 

+ 5 - 1
lib/dpkg/i18n.h

@@ -2,7 +2,7 @@
  * libdpkg - Debian packaging suite library routines
  * i18n.h - i18n support
  *
- * Copyright © 2008-2010 Guillem Jover <guillem@debian.org>
+ * Copyright © 2008-2011 Guillem Jover <guillem@debian.org>
  *
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -27,6 +27,10 @@ DPKG_BEGIN_DECLS
 
 #include <gettext.h>
 
+/* We need to include this because pgettext() uses LC_MESSAGES, but libintl.h
+ * which gets pulled by gettext.h only includes it if building optimized. */
+#include <locale.h>
+
 #define _(str) gettext(str)
 #define P_(str, str_plural, n) ngettext(str, str_plural, n)
 #define N_(str) gettext_noop(str)