From e42523dbf5820c4d1b0c3496b2d6a226fb31832e Mon Sep 17 00:00:00 2001 From: David Levine Date: Mon, 16 Jan 2012 09:50:10 -0600 Subject: [PATCH] Fixed build on Cygwin by adding configure check for ncurses/termcap.h. --- MACHINES | 9 ++++++++- configure.ac | 2 +- h/prototypes.h | 14 +++++++------- uip/termsbr.c | 5 +++++ 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/MACHINES b/MACHINES index ddd30fa..60741ef 100644 --- a/MACHINES +++ b/MACHINES @@ -6,6 +6,7 @@ nmh is known to compile on the following platforms (save the exceptions noted below), using an ANSI C compiler, such as gcc. AIX 4.1.5.0.01 +Cygwin, setup version 2.763 FreeBSD IRIX 6.5 Linux 2.2, 2.3, 2.4 (glibc 2.1, glibc 2.2) @@ -39,6 +40,12 @@ option. It appears to find conflicts in the headers only when debugging is disabled. With debugging enabled, it compiles and runs happily. -------------------------------------- +Cygwin: + +Be sure to install Cygwin package libncurses-devel, in the Devel or +Libs category. And libncurses10 or later in the Lib category. + +-------------------------------------- HPUX: Lots of problems have been reported with using HPUX `cc'. In particular, @@ -91,7 +98,7 @@ SunOS 4.1.1/4.1.3/4.1.4: You can't use the C compiler that comes with SunOS 4 since it isn't ANSI C. But nmh builds just fine with gcc. With ---enable-debug you will see a lot of warnings. +--enable-debug you will see a lot of warnings. -------------------------------------- diff --git a/configure.ac b/configure.ac index 7b6859a..e4b0e9f 100644 --- a/configure.ac +++ b/configure.ac @@ -485,7 +485,7 @@ AC_SUBST(OURDEFS) AC_HEADER_STDC AC_HEADER_TIOCGWINSZ -AC_CHECK_HEADERS(errno.h fcntl.h crypt.h termcap.h \ +AC_CHECK_HEADERS(errno.h fcntl.h crypt.h ncurses/termcap.h termcap.h \ langinfo.h wchar.h wctype.h iconv.h netdb.h \ sys/param.h sys/time.h sys/stream.h) diff --git a/h/prototypes.h b/h/prototypes.h index fcc8f0c..12124cd 100644 --- a/h/prototypes.h +++ b/h/prototypes.h @@ -6,13 +6,13 @@ /* * missing system prototypes */ -#ifndef HAVE_TERMCAP_H -extern int tgetent (char *bp, char *name); -extern int tgetnum (char *id); -extern int tgetflag (char *id); -extern char *tgetstr (char *id, char **area); -extern char *tgoto (char *cm, int destcol, int destline); -extern int tputs (char *cp, int affcnt, int (*outc) (int)); +#if ! defined(HAVE_TERMCAP_H) && ! defined (HAVE_NCURSES_TERMCAP_H) + extern int tgetent (char *bp, char *name); + extern int tgetnum (char *id); + extern int tgetflag (char *id); + extern char *tgetstr (char *id, char **area); + extern char *tgoto (char *cm, int destcol, int destline); + extern int tputs (char *cp, int affcnt, int (*outc) (int)); #endif /* diff --git a/uip/termsbr.c b/uip/termsbr.c index f30a058..4804776 100644 --- a/uip/termsbr.c +++ b/uip/termsbr.c @@ -11,8 +11,13 @@ #include +/* It might be better to tie this to the termcap_curses_order in + configure.ac. It would be fine to check for ncurses/termcap.h + first on Linux, it's a symlink to termcap.h. */ #ifdef HAVE_TERMCAP_H # include +#elif defined (HAVE_NCURSES_TERMCAP_H) +# include #endif /* is need anyway for ioctl() -- 1.7.10.4