Commits

Alex Gaynor  committed 04e742a Merge

Merged upstream (workin on train is fun!).

  • Participants
  • Parent commits e4ce179, c0b31ff

Comments (0)

Files changed (2)

File pypy/rlib/rlocale.py

 
 HAVE_LANGINFO = sys.platform != 'win32'
 HAVE_LIBINTL  = sys.platform != 'win32'
+libraries = []
 
 if HAVE_LIBINTL:
     try:
-        platform.verify_eci(ExternalCompilationInfo(includes=['libintl.h']))
+        platform.verify_eci(ExternalCompilationInfo(includes=['libintl.h'],
+                                                    libraries=['intl']))
+        libraries.append('intl')
     except platform.CompilationError:
-        HAVE_LIBINTL = False
+        try:
+            platform.verify_eci(ExternalCompilationInfo(includes=['libintl.h']))
+        except platform.CompilationError:
+            HAVE_LIBINTL = False
 
 class CConfig:
     includes = ['locale.h', 'limits.h', 'ctype.h']
+    libraries = libraries
 
     if HAVE_LANGINFO:
         includes += ['langinfo.h']
     if sys.platform == 'win32':
         includes += ['windows.h']
     _compilation_info_ = ExternalCompilationInfo(
-        includes=includes
+        includes=includes, libraries=libraries
     )
     HAVE_BIND_TEXTDOMAIN_CODESET = platform.Has('bind_textdomain_codeset')
     lconv = platform.Struct("struct lconv", [

File pypy/rlib/test/test_rlocale.py

 
 # -*- coding: utf-8 -*-
 
-import py
+import py, sys
 import locale as cpython_locale
 from pypy.rlib.rlocale import setlocale, LC_ALL, LocaleError, isupper, \
-     islower, isalpha, tolower, isalnum, numeric_formatting
+     islower, isalpha, tolower, isalnum, numeric_formatting, external
+from pypy.rpython.lltypesystem import rffi
 
 class TestLocale(object):
     def setup_class(cls):
     assert isinstance(dec, str)
     assert isinstance(th, str)
     assert isinstance(grouping, str)
+
+def test_libintl():
+    if sys.platform not in ("linux2", "darwin"):
+        py.test.skip("there is (maybe) no libintl here")
+    _gettext = external('gettext', [rffi.CCHARP], rffi.CCHARP)
+    res = _gettext("1234")
+    assert rffi.charp2str(res) == "1234"