Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: avoid unnecessary curses.h include



This might help some situations.

Index: acconfig.h
===================================================================
RCS file: /cvsroot/zsh/zsh/acconfig.h,v
retrieving revision 1.8
diff -u -r1.8 acconfig.h
--- acconfig.h	2001/04/23 19:59:03	1.8
+++ acconfig.h	2001/04/26 15:35:02
@@ -317,3 +317,6 @@
 
 /* Define if you have the terminfo strnames symbol.  */
 #undef HAVE_STRNAMES
+
+/* Define if term.h chokes without curses.h */
+#undef TERM_H_NEEDS_CURSES_H
Index: configure.in
===================================================================
RCS file: /cvsroot/zsh/zsh/configure.in,v
retrieving revision 1.49
diff -u -r1.49 configure.in
--- configure.in	2001/04/24 06:48:54	1.49
+++ configure.in	2001/04/26 15:35:03
@@ -515,18 +515,38 @@
 esac
 
 AC_SEARCH_LIBS(tgetent, [$termcap_curses_order])
+AC_MSG_CHECKING(if term.h needs curses.h)
+AC_TRY_COMPILE([#include <term.h>], [char **test = boolcodes;], boolcodes_with_only_term_h=yes,
+boolcodes_with_only_term_h=no)
+AC_TRY_COMPILE([#include <curses.h>
+#include <term.h>], [char **test = boolcodes;], boolcodes_with_curses_h_and_term_h=yes,
+boolcodes_with_curses_h_and_term_h=no)
+if test "x$boolcodes_with_curses_h_and_term_h" = xyes && test "x$boolcodes_with_only_term_h" = xno;
+then
+AC_DEFINE(TERM_H_NEEDS_CURSES_H)
+AC_MSG_RESULT(yes)
+else
+AC_MSG_RESULT(no)
+fi
+
 AC_MSG_CHECKING(if boolcodes is available)
-AC_TRY_LINK([#include <curses.h>
+AC_TRY_LINK([#ifdef TERM_H_NEEDS_CURSES_H
+#include <curses.h>
+#endif
 #include <term.h>], [char **test = boolcodes;],
 AC_DEFINE(HAVE_BOOLCODES) boolcodes=yes, boolcodes=no)
 AC_MSG_RESULT($boolcodes)
 AC_MSG_CHECKING(if numcodes is available)
-AC_TRY_LINK([#include <curses.h>
+AC_TRY_LINK([#ifdef TERM_H_NEEDS_CURSES_H
+#include <curses.h>
+#endif
 #include <term.h>], [char **test = numcodes;],
 AC_DEFINE(HAVE_NUMCODES) numcodes=yes, numcodes=no)
 AC_MSG_RESULT($numcodes)
 AC_MSG_CHECKING(if strcodes is available)
-AC_TRY_LINK([#include <curses.h>
+AC_TRY_LINK([#ifdef TERM_H_NEEDS_CURSES_H
+#include <curses.h>
+#endif
 #include <term.h>], [char **test = strcodes;],
 AC_DEFINE(HAVE_STRCODES) strcodes=yes, strcodes=no)
 AC_MSG_RESULT($strcodes)
Index: Src/Modules/termcap.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/termcap.c,v
retrieving revision 1.10
diff -u -r1.10 termcap.c
--- Src/Modules/termcap.c	2001/04/26 14:35:53	1.10
+++ Src/Modules/termcap.c	2001/04/26 15:35:04
@@ -55,7 +55,9 @@
 #  ifdef HAVE_TERMIO_H
 #   include <termio.h>
 #  endif
-#  include <curses.h>
+#  ifdef TERM_H_NEEDS_CURSES_H
+#   include <curses.h>
+#  endif
 #  include <term.h>
 # else
 #  ifdef USES_TERMCAP_H



Messages sorted by: Reverse Date, Date, Thread, Author