diff -r 2d8e4047c270 Include/py_curses.h --- a/Include/py_curses.h Thu Apr 16 11:54:14 2015 +0300 +++ b/Include/py_curses.h Fri Apr 17 12:51:47 2015 +0900 @@ -10,11 +10,6 @@ #ifdef _BSD_WCHAR_T_DEFINED_ #define _WCHAR_T #endif - -/* the following define is necessary for OS X 10.6; without it, the - Apple-supplied ncurses.h sets NCURSES_OPAQUE to 1, and then Python - can't get at the WINDOW flags field. */ -#define NCURSES_OPAQUE 0 #endif /* __APPLE__ */ #ifdef __FreeBSD__ @@ -55,11 +50,6 @@ #endif #ifdef HAVE_NCURSES_H -/* configure was checking , but we will - use , which has all these features. */ -#ifndef WINDOW_HAS_FLAGS -#define WINDOW_HAS_FLAGS 1 -#endif #ifndef MVWDELCH_IS_EXPRESSION #define MVWDELCH_IS_EXPRESSION 1 #endif diff -r 2d8e4047c270 configure --- a/configure Thu Apr 16 11:54:14 2015 +0300 +++ b/configure Fri Apr 17 12:51:47 2015 +0900 @@ -14831,10 +14831,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether WINDOW has _flags" >&5 $as_echo_n "checking whether WINDOW has _flags... " >&6; } -if ${ac_cv_window_has_flags+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int @@ -14854,11 +14851,87 @@ ac_cv_window_has_flags=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_window_has_flags" >&5 $as_echo "$ac_cv_window_has_flags" >&6; } +if test "$ac_cv_window_has_flags" = no +then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether WINDOW has _flags in non-opaque structure" >&5 +$as_echo_n "checking whether WINDOW has _flags in non-opaque structure... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + #define NCURSES_OPAQUE 0 + #include + +int +main () +{ + + WINDOW *w; + w->_flags = 0; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + py_curses_window_is_opaque=yes +else + py_curses_window_is_opaque=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_curses_window_is_opaque" >&5 +$as_echo "$py_curses_window_is_opaque" >&6; } +fi +if test "x$py_curses_window_is_opaque" = xyes +then + ac_cv_window_has_flags=yes + +$as_echo "#define NCURSES_OPAQUE 0" >>confdefs.h + +fi + +if test "$ac_cv_window_has_flags" = no +then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether WINDOW has _flags as internal structure" >&5 +$as_echo_n "checking whether WINDOW has _flags as internal structure... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + #define NCURSES_INTERNALS 1 + #include + +int +main () +{ + + WINDOW *w; + w->_flags = 0; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + py_curses_window_is_internal=yes +else + py_curses_window_is_internal=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_curses_window_is_internal" >&5 +$as_echo "$py_curses_window_is_internal" >&6; } +fi +if test "x$py_curses_window_is_internal" = xyes +then + ac_cv_window_has_flags=yes + +$as_echo "#define NCURSES_INTERNALS 1" >>confdefs.h + +fi + if test "$ac_cv_window_has_flags" = yes then diff -r 2d8e4047c270 configure.ac --- a/configure.ac Thu Apr 16 11:54:14 2015 +0300 +++ b/configure.ac Fri Apr 17 12:51:47 2015 +0900 @@ -4438,15 +4438,58 @@ fi AC_MSG_CHECKING(whether WINDOW has _flags) -AC_CACHE_VAL(ac_cv_window_has_flags, AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[ WINDOW *w; w->_flags = 0; ]])], [ac_cv_window_has_flags=yes], -[ac_cv_window_has_flags=no])) +[ac_cv_window_has_flags=no]) AC_MSG_RESULT($ac_cv_window_has_flags) +if test "$ac_cv_window_has_flags" = no +then + AC_MSG_CHECKING([whether WINDOW has _flags in non-opaque structure]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + #define NCURSES_OPAQUE 0 + #include + ]],[[ + WINDOW *w; + w->_flags = 0; + ]])], + [py_curses_window_is_opaque=yes], + [py_curses_window_is_opaque=no]) + AC_MSG_RESULT([$py_curses_window_is_opaque]) +fi +if test "x$py_curses_window_is_opaque" = xyes +then + ac_cv_window_has_flags=yes + AC_DEFINE([NCURSES_OPAQUE], [0], + [Define to 0 if you have WINDOW _flags in non-opaque structure.]) +fi + +if test "$ac_cv_window_has_flags" = no +then + AC_MSG_CHECKING([whether WINDOW has _flags as internal structure]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + #define NCURSES_INTERNALS 1 + #include + ]],[[ + WINDOW *w; + w->_flags = 0; + ]])], + [py_curses_window_is_internal=yes], + [py_curses_window_is_internal=no]) + AC_MSG_RESULT([$py_curses_window_is_internal]) +fi +if test "x$py_curses_window_is_internal" = xyes +then + ac_cv_window_has_flags=yes + AC_DEFINE([NCURSES_INTERNALS], [1], + [Define to 1 if you have WINDOW _flags as internal structure.]) +fi + if test "$ac_cv_window_has_flags" = yes then diff -r 2d8e4047c270 pyconfig.h.in --- a/pyconfig.h.in Thu Apr 16 11:54:14 2015 +0300 +++ b/pyconfig.h.in Fri Apr 17 12:51:47 2015 +0900 @@ -1172,6 +1172,12 @@ /* Define if mvwdelch in curses.h is an expression. */ #undef MVWDELCH_IS_EXPRESSION +/* Define to 1 if you have WINDOW _flags as internal structure. */ +#undef NCURSES_INTERNALS + +/* Define to 0 if you have WINDOW _flags in non-opaque structure. */ +#undef NCURSES_OPAQUE + /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT