]> granicus.if.org Git - python/commitdiff
Merge
authorAntoine Pitrou <solipsis@pitrou.net>
Sat, 30 Jun 2012 21:03:18 +0000 (23:03 +0200)
committerAntoine Pitrou <solipsis@pitrou.net>
Sat, 30 Jun 2012 21:03:18 +0000 (23:03 +0200)
1  2 
setup.py

diff --cc setup.py
index 62e5ad2428a963fb6d002618841786013be68a87,30a7a8fee6b9f8d5025d3a41f5870ed933d90956..c1d6968a4e2c84a3d02dd1463eedb000cc483dd2
+++ b/setup.py
@@@ -590,14 -643,21 +643,21 @@@ class PyBuildExt(build_ext)
          do_readline = self.compiler.find_library_file(lib_dirs, 'readline')
          readline_termcap_library = ""
          curses_library = ""
+         # Cannot use os.popen here in py3k.
+         tmpfile = os.path.join(self.build_temp, 'readline_termcap_lib')
+         if not os.path.exists(self.build_temp):
+             os.makedirs(self.build_temp)
          # Determine if readline is already linked against curses or tinfo.
-         if do_readline and find_executable('ldd'):
-             # Cannot use os.popen here in py3k.
-             tmpfile = os.path.join(self.build_temp, 'readline_termcap_lib')
-             if not os.path.exists(self.build_temp):
-                 os.makedirs(self.build_temp)
-             ret = os.system("ldd %s > %s" % (do_readline, tmpfile))
+         if do_readline:
+             if cross_compiling:
+                 ret = os.system("%s -d %s | grep '(NEEDED)' > %s" \
+                                 % (sysconfig.get_config_var('READELF'),
+                                    do_readline, tmpfile))
+             elif find_executable('ldd'):
+                 ret = os.system("ldd %s > %s" % (do_readline, tmpfile))
+             else:
+                 ret = 256
 -            if ret >> 8 == 0:
 +            if ret == 0:
                  with open(tmpfile) as fp:
                      for ln in fp:
                          if 'curses' in ln: