diff -r 57280a01aecf setup.py --- a/setup.py Thu Jan 27 21:38:46 2011 +0100 +++ b/setup.py Fri Jan 28 15:15:23 2011 +0100 @@ -562,24 +562,42 @@ readline_termcap_library = "" curses_library = "" # Determine if readline is already linked against curses or tinfo. - if do_readline and find_executable('ldd'): + ret = None # Temporary reuse - it's ugly without goto + if do_readline: + if platform == 'darwin': + if find_executable('otool'): + ret = True + elif find_executable('ldd'): + ret = True + if ret: # 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 ret >> 8 == 0: - with open(tmpfile) as fp: - for ln in fp: - if 'curses' in ln: - readline_termcap_library = re.sub( - r'.*lib(n?cursesw?)\.so.*', r'\1', ln - ).rstrip() - break - # termcap interface split out from ncurses - if 'tinfo' in ln: - readline_termcap_library = 'tinfo' - break + if platform == 'darwin': + ret = os.system("otool -L %s > %s" % (do_readline, tmpfile)) + if ret >> 8 == 0: + with open(tmpfile) as fp: + for ln in fp: + if 'curses' in ln: + readline_termcap_library = re.sub( + r'.*lib(n?cursesw?).+?\.dylib.*', r'\1', ln + ).rstrip() + break + else: + ret = os.system("ldd %s > %s" % (do_readline, tmpfile)) + if ret >> 8 == 0: + with open(tmpfile) as fp: + for ln in fp: + if 'curses' in ln: + readline_termcap_library = re.sub( + r'.*lib(n?cursesw?)\.so.*', r'\1', ln + ).rstrip() + break + # termcap interface split out from ncurses + if 'tinfo' in ln: + readline_termcap_library = 'tinfo' + break os.unlink(tmpfile) # Issue 7384: If readline is already linked against curses, # use the same library for the readline and curses modules. @@ -593,9 +611,15 @@ curses_library = 'curses' if platform == 'darwin': + # STEFFEN: I don't know what this is all about, i am using + # MacOS X since 10.6, but both, 10.5 and 10.6 SDKs work properly! + # I've *never* used GNU Autoconf! os_release = int(os.uname()[2].split('.')[0]) - dep_target = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET') - if dep_target and dep_target.split('.') < ['10', '5']: + # dep_target = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET') + dep_target = '10.5' + if os_release >= 9: + pass + elif dep_target and dep_target.split('.') < ['10', '5']: os_release = 8 if os_release < 9: # MacOSX 10.4 has a broken readline. Don't try to build