diff -r b66e82c9f852 setup.py --- a/setup.py Tue Jun 26 23:05:27 2012 +0200 +++ b/setup.py Wed Jun 27 00:00:35 2012 -0500 @@ -1198,6 +1198,7 @@ curses_defines.append(('HAVE_NCURSESW', '1')) curses_defines.append(('_XOPEN_SOURCE_EXTENDED', '1')) + if curses_library.startswith('ncurses'): curses_libs = [curses_library] exts.append( Extension('_curses', ['_cursesmodule.c'], @@ -1207,7 +1208,26 @@ elif curses_library == 'curses' and platform != 'darwin': # OSX has an old Berkeley curses, not good enough for # the _curses module. - if (self.compiler.find_library_file(lib_dirs, 'terminfo')): + curses_undefines = [] + curses_libraries = [] + curses_runtime = [] + curses_include = [] + # Bug 3786 and possibly Bug 13552: Solaris curses workarounds. + # Solaris 11 includes SysV curses, XPG4 curses, and GNU curses. + # This section sets up GNU curses. Since curses is found first + # we check and see if we can use the GNU version. + if platform == 'sunos5' and os.path.exists('/usr/include/ncurses'): + # this next guard may not be needed for gcc + if '-Kpic' in sysconfig.get_config_vars('CCSHARED'): + curses_defines=[] + # work around for assumption on line 128 of Modules/_cursesmodule.c + curses_undefines = ['__sun'] + curses_includes=['/usr/include/ncurses'] + curses_libraries=['/usr/gnu/lib'] + curses_runtime=['/usr/gnu/lib'] + curses_libs = ['ncurses'] + # and as if by magical _curses_panel should work as well + elif (self.compiler.find_library_file(lib_dirs, 'terminfo')): curses_libs = ['curses', 'terminfo'] elif (self.compiler.find_library_file(lib_dirs, 'termcap')): curses_libs = ['curses', 'termcap'] @@ -1215,7 +1235,11 @@ curses_libs = ['curses'] exts.append( Extension('_curses', ['_cursesmodule.c'], - define_macros=curses_defines, + undef_macros = curses_undefines, + define_macros = curses_defines, + include_dirs = curses_includes, + library_dirs = curses_libraries, + runtime_library_dirs = curses_runtime, libraries = curses_libs) ) else: missing.append('_curses') @@ -1764,7 +1788,9 @@ # this option. If you want to compile ctypes with the Sun # compiler, please research a proper solution, instead of # finding some -z option for the Sun compiler. - extra_link_args.append('-mimpure-text') + if '-Kpic' not in sysconfig.get_config_vars('CCSHARED'): + # make sure this is only gcc and not the sunpro compiler + extra_link_args.append('-mimpure-text') elif sys.platform.startswith('hp-ux'): extra_link_args.append('-fPIC')