[Python-checkins] cpython (2.7): - Issue #21285: Refactor and fix curses configure check to always search

matthias.klose python-checkins at python.org
Thu Apr 17 20:14:42 CEST 2014


http://hg.python.org/cpython/rev/1bc0a8310b9f
changeset:   90386:1bc0a8310b9f
branch:      2.7
parent:      90373:2a793df32be5
user:        doko at ubuntu.com
date:        Thu Apr 17 20:11:19 2014 +0200
summary:
  - Issue #21285: Refactor and fix curses configure check to always search
  in a ncursesw directory.

files:
  Misc/NEWS    |   6 +++
  configure    |  62 ++++++++++++++++++++++++++-------------
  configure.ac |  26 ++++++++++-----
  setup.py     |   5 +++
  4 files changed, 69 insertions(+), 30 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -367,6 +367,12 @@
 - Issue #21093: Prevent failures of ctypes test_macholib on OS X if a
   copy of libz exists in $HOME/lib or /usr/local/lib.
 
+Build
+-----
+
+- Issue #21285: Refactor and fix curses configure check to always search
+  in a ncursesw directory.
+
 Documentation
 -------------
 
diff --git a/configure b/configure
--- a/configure
+++ b/configure
@@ -6651,9 +6651,9 @@
 
 fi
 
-for ac_header in asm/types.h conio.h curses.h direct.h dlfcn.h errno.h \
+for ac_header in asm/types.h conio.h direct.h dlfcn.h errno.h \
 fcntl.h grp.h \
-ieeefp.h io.h langinfo.h libintl.h ncurses.h poll.h process.h pthread.h \
+ieeefp.h io.h langinfo.h libintl.h poll.h process.h pthread.h \
 shadow.h signal.h stdint.h stropts.h termios.h thread.h \
 unistd.h utime.h \
 sys/audioio.h sys/bsdtty.h sys/epoll.h sys/event.h sys/file.h sys/loadavg.h \
@@ -6884,25 +6884,6 @@
 fi
 
 
-# On Solaris, term.h requires curses.h
-for ac_header in term.h
-do :
-  ac_fn_c_check_header_compile "$LINENO" "term.h" "ac_cv_header_term_h" "
-#ifdef HAVE_CURSES_H
-#include <curses.h>
-#endif
-
-"
-if test "x$ac_cv_header_term_h" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_TERM_H 1
-_ACEOF
-
-fi
-
-done
-
-
 # On Linux, netlink.h requires asm/types.h
 for ac_header in linux/netlink.h
 do :
@@ -14132,6 +14113,43 @@
 
 fi
 
+# first curses configure check
+ac_save_cppflags="$CPPFLAGS"
+CPPFLAGS="$CPPFLAGS -I/usr/include/ncursesw"
+
+for ac_header in curses.h ncurses.h
+do :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+# On Solaris, term.h requires curses.h
+for ac_header in term.h
+do :
+  ac_fn_c_check_header_compile "$LINENO" "term.h" "ac_cv_header_term_h" "
+#ifdef HAVE_CURSES_H
+#include <curses.h>
+#endif
+
+"
+if test "x$ac_cv_header_term_h" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_TERM_H 1
+_ACEOF
+
+fi
+
+done
+
+
 # On HP/UX 11.0, mvwdelch is a block with a return statement
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mvwdelch is an expression" >&5
 $as_echo_n "checking whether mvwdelch is an expression... " >&6; }
@@ -14285,6 +14303,8 @@
 
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+# last curses configure check
+CPPFLAGS=$ac_save_cppflags
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for device files" >&5
 $as_echo "$as_me: checking for device files" >&6;}
diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -1508,9 +1508,9 @@
 
 # checks for header files
 AC_HEADER_STDC
-AC_CHECK_HEADERS(asm/types.h conio.h curses.h direct.h dlfcn.h errno.h \
+AC_CHECK_HEADERS(asm/types.h conio.h direct.h dlfcn.h errno.h \
 fcntl.h grp.h \
-ieeefp.h io.h langinfo.h libintl.h ncurses.h poll.h process.h pthread.h \
+ieeefp.h io.h langinfo.h libintl.h poll.h process.h pthread.h \
 shadow.h signal.h stdint.h stropts.h termios.h thread.h \
 unistd.h utime.h \
 sys/audioio.h sys/bsdtty.h sys/epoll.h sys/event.h sys/file.h sys/loadavg.h \
@@ -1523,13 +1523,6 @@
 AC_HEADER_DIRENT
 AC_HEADER_MAJOR
 
-# On Solaris, term.h requires curses.h
-AC_CHECK_HEADERS(term.h,,,[
-#ifdef HAVE_CURSES_H
-#include <curses.h>
-#endif
-])
-
 # On Linux, netlink.h requires asm/types.h
 AC_CHECK_HEADERS(linux/netlink.h,,,[
 #ifdef HAVE_ASM_TYPES_H
@@ -4296,6 +4289,19 @@
   [Define if you have struct stat.st_mtimensec])
 fi
 
+# first curses configure check
+ac_save_cppflags="$CPPFLAGS"
+CPPFLAGS="$CPPFLAGS -I/usr/include/ncursesw"
+
+AC_CHECK_HEADERS(curses.h ncurses.h)
+
+# On Solaris, term.h requires curses.h
+AC_CHECK_HEADERS(term.h,,,[
+#ifdef HAVE_CURSES_H
+#include <curses.h>
+#endif
+])
+
 # On HP/UX 11.0, mvwdelch is a block with a return statement
 AC_MSG_CHECKING(whether mvwdelch is an expression)
 AC_CACHE_VAL(ac_cv_mvwdelch_is_expression,
@@ -4350,6 +4356,8 @@
    AC_MSG_RESULT(yes)],
   [AC_MSG_RESULT(no)]
 )
+# last curses configure check
+CPPFLAGS=$ac_save_cppflags
 
 AC_MSG_NOTICE([checking for device files])
 
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -1339,13 +1339,17 @@
         # Curses support, requiring the System V version of curses, often
         # provided by the ncurses library.
         panel_library = 'panel'
+        curses_incs = None
         if curses_library.startswith('ncurses'):
             if curses_library == 'ncursesw':
                 # Bug 1464056: If _curses.so links with ncursesw,
                 # _curses_panel.so must link with panelw.
                 panel_library = 'panelw'
             curses_libs = [curses_library]
+            curses_incs = find_file('curses.h', inc_dirs,
+                                    [os.path.join(d, 'ncursesw') for d in inc_dirs])
             exts.append( Extension('_curses', ['_cursesmodule.c'],
+                                   include_dirs = curses_incs,
                                    libraries = curses_libs) )
         elif curses_library == 'curses' and host_platform != 'darwin':
                 # OSX has an old Berkeley curses, not good enough for
@@ -1366,6 +1370,7 @@
         if (module_enabled(exts, '_curses') and
             self.compiler.find_library_file(lib_dirs, panel_library)):
             exts.append( Extension('_curses_panel', ['_curses_panel.c'],
+                                   include_dirs = curses_incs,
                                    libraries = [panel_library] + curses_libs) )
         else:
             missing.append('_curses_panel')

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list