summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--Src/Modules/curses.c2
-rw-r--r--Src/system.h4
-rw-r--r--configure.ac16
4 files changed, 24 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index b78e4c906..2700f934a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2007-12-14  Peter Stephenson  <pws@csr.com>
 
+	* 24252: configure.ac, Src/system.h, Src/Modules/curses.c:
+	_XOPEN_SOURCE_EXTENDED was causing problems on OpenBSD.
+
 	* 24251: Doc/ztexi.yo: fix sitem() macro.
 
 2007-12-13  Clint Adams  <clint@zsh.org>
diff --git a/Src/Modules/curses.c b/Src/Modules/curses.c
index 0e5e7e1f1..4f5cbd80b 100644
--- a/Src/Modules/curses.c
+++ b/Src/Modules/curses.c
@@ -27,7 +27,7 @@
  *
  */
 
-#define _XOPEN_SOURCE_EXTENDED 1
+#define ZSH_CURSES_SOURCE 1
 
 #include "curses.mdh"
 #include "curses.pro"
diff --git a/Src/system.h b/Src/system.h
index 2d89ac80e..34b06c583 100644
--- a/Src/system.h
+++ b/Src/system.h
@@ -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
diff --git a/configure.ac b/configure.ac
index c43d42a72..8a56a4c05 100644
--- a/configure.ac
+++ b/configure.ac
@@ -669,6 +669,22 @@ fi],
    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],