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

Re: 4.3.4-dev-4 and 4.2.6-dev-2 available



On Fri, 14 Dec 2007 13:30:35 +0100
Pea <zsh@xxxxxxxxxxxx> wrote:
> > Is there any indication of why the headers are allowing wchar_t to be
> > defined twice?  Is there are anything around lines 54/59 of stddef.h
> > that would indicate what's going on?
> > 
> 
> I think I found the problem.
> In ncurses.h (line 94):
> 
> #ifdef _XOPEN_SOURCE_EXTENDED
> #include <stddef.h>     /* we want wchar_t */
> #endif /* _XOPEN_SOURCE_EXTENDED */
> 
> and in Src/Modules/src.c we have #define _XOPEN_SOURCE_EXTENDED 1
> If i remove this line, compilation doesn't fail.

Thanks for investigating.  OK, so that has to come out for openbsd.  I hope
the following patch does the trick:  it's a bit complicated in order to
ensure we get the definition before any system header files.

Clint, can you remember why we needed _XOPEN_SOURCE_EXTENDED for curses.c?
We should at least document it.  This seems to have been there since the
start.

> I added --with-term-lib=curses to my configure and i have not applied
> your patch.

It should now be OK not to use --with-term-lib (and to ignore the previous
patch): it looks like this is ultimately picking up the same files anyway,
and I'd like to be sure it compiles without special options.

> zmodload zsh/curses works. Let me play with this and i will say you if
> i have some pbs.

Thank you.

Index: configure.ac
===================================================================
RCS file: /cvsroot/zsh/zsh/configure.ac,v
retrieving revision 1.86
diff -u -r1.86 configure.ac
--- configure.ac	7 Dec 2007 11:34:48 -0000	1.86
+++ configure.ac	14 Dec 2007 12:53:37 -0000
@@ -669,6 +669,22 @@
    termcap_curses_order="$ncursesw_test tinfo termcap $ncurses_test curses" ;;
 esac])dnl
 
+AH_TEMPLATE([ZSH_CURSES_NEEDS_XOPEN],
+[Define if the curses libraries need _XOPEN_SOURCE_EXTENDED defined])
+AC_CACHE_CHECK(if the curses library needs _XOPEN_SOURCE_EXTENDED,
+zsh_cv_curses_needs_xopen,
+[case "$host_os" in
+  *openbsd*)
+  zsh_cv_curses_needs_xopen=no
+  ;;
+  *)
+  zsh_cv_curses_needs_xopen=yes
+  ;;
+esac])
+if test x$zsh_cv_curses_needs_xopen = xyes; then
+  AC_DEFINE(ZSH_CURSES_NEEDS_XOPEN)
+fi
+
 AH_TEMPLATE([HAVE_BOOLCODES],
 [Define if you have the termcap boolcodes symbol.])
 AH_TEMPLATE([HAVE_NUMCODES],
Index: Src/system.h
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/system.h,v
retrieving revision 1.48
diff -u -r1.48 system.h
--- Src/system.h	1 Nov 2007 17:57:57 -0000	1.48
+++ Src/system.h	14 Dec 2007 12:53:37 -0000
@@ -52,6 +52,10 @@
 # undef HAVE_SYS_UTSNAME_H
 #endif
 
+#if defined(ZSH_CURSES_SOURCE) && defined(ZSH_CURSES_NEEDS_XOPEN)
+#define _XOPEN_SOURCE_EXTENDED 1
+#endif
+
 /*
  * Solaris by default zeroes all elements of the tm structure in
  * strptime().  Unfortunately that gives us no way of telling whether
Index: Src/Modules/curses.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/curses.c,v
retrieving revision 1.42
diff -u -r1.42 curses.c
--- Src/Modules/curses.c	21 Nov 2007 09:53:49 -0000	1.42
+++ Src/Modules/curses.c	14 Dec 2007 12:53:38 -0000
@@ -27,7 +27,7 @@
  *
  */
 
-#define _XOPEN_SOURCE_EXTENDED 1
+#define ZSH_CURSES_SOURCE 1
 
 #include "curses.mdh"
 #include "curses.pro"

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070



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