zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: avoid unnecessary curses.h include
@ 2001-04-26 15:43 Clint Adams
  2001-04-26 15:58 ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Clint Adams @ 2001-04-26 15:43 UTC (permalink / raw)
  To: zsh-workers

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PATCH: avoid unnecessary curses.h include
  2001-04-26 15:43 PATCH: avoid unnecessary curses.h include Clint Adams
@ 2001-04-26 15:58 ` Bart Schaefer
  2001-04-26 21:12   ` Clint Adams
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2001-04-26 15:58 UTC (permalink / raw)
  To: Clint Adams, zsh-workers

On Apr 26, 11:43am, Clint Adams wrote:
} Subject: PATCH: avoid unnecessary curses.h include
}
} This might help some situations.

Hrm.  If term.h does not need curses.h, but curses.h defines `boolcodes'
et al., then after this change configure will #undef HAVE_BOOLCODES etc.
even though they could be #defined if curses.h were included.

Maybe that situation never arises ...

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PATCH: avoid unnecessary curses.h include
  2001-04-26 15:58 ` Bart Schaefer
@ 2001-04-26 21:12   ` Clint Adams
  0 siblings, 0 replies; 3+ messages in thread
From: Clint Adams @ 2001-04-26 21:12 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-workers

> Hrm.  If term.h does not need curses.h, but curses.h defines `boolcodes'
> et al., then after this change configure will #undef HAVE_BOOLCODES etc.
> even though they could be #defined if curses.h were included.
> 
> Maybe that situation never arises ...

Well, no, if curses.h defines boolcodes, then configure will wrongly assume
that term.h defines boolcodes and term.h requires curses.h.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2001-04-26 21:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-04-26 15:43 PATCH: avoid unnecessary curses.h include Clint Adams
2001-04-26 15:58 ` Bart Schaefer
2001-04-26 21:12   ` Clint Adams

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).