Re: [Qemu-devel] [PATCH] configure: Fix curses probe for older ncurses

2017-12-11 Thread Peter Maydell
On 26 November 2017 at 21:13, Brad Smith  wrote:
> Fix the curses probe with older ncurses (.e.g. 5.7, as used by OpenBSD).
>
> ncurses 5.7 requires _XOPEN_SOURCE_EXTENDED to be defined for WACS_* 
> constants.
>
> Signed-off-by: Brad Smith 
>
>
> diff --git a/configure b/configure
> index 0c6e7572db..9715b9c2cc 100755
> --- a/configure
> +++ b/configure
> @@ -3186,7 +3186,7 @@ EOF
>IFS=:
>for curses_inc in $curses_inc_list; do
>  # Make sure we get the wide character prototypes
> -curses_inc="-DNCURSES_WIDECHAR $curses_inc"
> +curses_inc="-DNCURSES_WIDECHAR -D_XOPEN_SOURCE_EXTENDED $curses_inc"
>  IFS=:
>  for curses_lib in $curses_lib_list; do
>unset IFS

Having thought about this a bit more, I think I'm definitely not
happy with defining _XOPEN_SOURCE_EXTENDED by default for every
host OS. I think we should either:
 (a) define it only for OpenBSD in the per-host case statement
in configure, with a note that we're doing it to work around the
supplied ncurses version being ancient
 (b) just say that if you want this optional QEMU feature you need
a version of ncurses that was released this decade

To be honest I'd favour (b): there are limits to how much
we need to support adventures in retrocomputing.

thanks
-- PMM



Re: [Qemu-devel] [PATCH] configure: Fix curses probe for older ncurses

2017-11-27 Thread Fam Zheng
On Mon, 11/27 13:02, Peter Maydell wrote:
> On 26 November 2017 at 22:13, Brad Smith  wrote:
> > Fix the curses probe with older ncurses (.e.g. 5.7, as used by OpenBSD).
> >
> > ncurses 5.7 requires _XOPEN_SOURCE_EXTENDED to be defined for WACS_* 
> > constants.
> 
> ncurses 5.7 was released in 2008 and is now 9 years old. Why
> is OpenBSD still using such an ancient version?
> 
> > Signed-off-by: Brad Smith 
> >
> >
> > diff --git a/configure b/configure
> > index 0c6e7572db..9715b9c2cc 100755
> > --- a/configure
> > +++ b/configure
> > @@ -3186,7 +3186,7 @@ EOF
> >IFS=:
> >for curses_inc in $curses_inc_list; do
> >  # Make sure we get the wide character prototypes
> > -curses_inc="-DNCURSES_WIDECHAR $curses_inc"
> > +curses_inc="-DNCURSES_WIDECHAR -D_XOPEN_SOURCE_EXTENDED $curses_inc"
> 
> I'm a bit wary of this because we've found in the past that
> defining _XOPEN_* defines breaks compilation with some
> C libraries which assume that if you define _XOPEN_whatever
> it means "only that X/Open stuff and no OS-specific extras",
> and we depend on the OS-specific extras.
> 
> That said, I did a test compile on OSX, which was the
> one that had trouble previously, so this may be OK. I think
> I'd rather leave it until after 2.11 releases, though.

One way to contain the effect of this change would be add it to per object
CFLAGS and LIBS, instead of QEMU_CFLAGS and libs_softmmu.

Fam



Re: [Qemu-devel] [PATCH] configure: Fix curses probe for older ncurses

2017-11-27 Thread Brad Smith

On 11/27/17 07:02, Peter Maydell wrote:

On 26 November 2017 at 22:13, Brad Smith  wrote:

Fix the curses probe with older ncurses (.e.g. 5.7, as used by OpenBSD).

ncurses 5.7 requires _XOPEN_SOURCE_EXTENDED to be defined for WACS_* constants.


ncurses 5.7 was released in 2008 and is now 9 years old. Why
is OpenBSD still using such an ancient version?


Signed-off-by: Brad Smith 


diff --git a/configure b/configure
index 0c6e7572db..9715b9c2cc 100755
--- a/configure
+++ b/configure
@@ -3186,7 +3186,7 @@ EOF
IFS=:
for curses_inc in $curses_inc_list; do
  # Make sure we get the wide character prototypes
-curses_inc="-DNCURSES_WIDECHAR $curses_inc"
+curses_inc="-DNCURSES_WIDECHAR -D_XOPEN_SOURCE_EXTENDED $curses_inc"


I'm a bit wary of this because we've found in the past that
defining _XOPEN_* defines breaks compilation with some
C libraries which assume that if you define _XOPEN_whatever
it means "only that X/Open stuff and no OS-specific extras",
and we depend on the OS-specific extras.

That said, I did a test compile on OSX, which was the
one that had trouble previously, so this may be OK. I think
I'd rather leave it until after 2.11 releases, though.


I am not in a rush for 2.11. This and the other issues being
mentioned are not new. Thanks for the consideration of the diff
at all.



Re: [Qemu-devel] [PATCH] configure: Fix curses probe for older ncurses

2017-11-27 Thread Peter Maydell
On 27 November 2017 at 14:52, Brad Smith  wrote:
> On 11/27/2017 7:02 AM, Peter Maydell wrote:
>
>> On 26 November 2017 at 22:13, Brad Smith  wrote:
>>>
>>> Fix the curses probe with older ncurses (.e.g. 5.7, as used by OpenBSD).
>>>
>>> ncurses 5.7 requires _XOPEN_SOURCE_EXTENDED to be defined for WACS_*
>>> constants.
>>
>> ncurses 5.7 was released in 2008 and is now 9 years old. Why
>> is OpenBSD still using such an ancient version?

> Someone has to put the time and effort into updating it.

Yes, but staying up to date with the libraries you ship is
table stakes for being a serious OS. Having a sufficiently
large and active developer community that this can happen is
one of the things that separates "OS usable in production"
from "hobby project, research project or just defunct OS"
in my view.

>> I'm a bit wary of this because we've found in the past that
>> defining _XOPEN_* defines breaks compilation with some
>> C libraries which assume that if you define _XOPEN_whatever
>> it means "only that X/Open stuff and no OS-specific extras",
>> and we depend on the OS-specific extras.
>>
>> That said, I did a test compile on OSX, which was the
>> one that had trouble previously, so this may be OK. I think
>> I'd rather leave it until after 2.11 releases, though.

> The other option I was looking at was removing the add_wch() function
> call from the probe as the rest of the curses code within QEMU compiles
> Ok without _XOPEN_SOURCE_EXTENDED.

That would break the fix made in commit 7c7030029626 -- we want
to be sure we're actually getting a wide-character aware version
of the headers, on systems which might have both the non-widechar
and widechar headers in different places.

thanks
-- PMM



Re: [Qemu-devel] [PATCH] configure: Fix curses probe for older ncurses

2017-11-27 Thread Brad Smith

On 11/27/2017 7:02 AM, Peter Maydell wrote:


On 26 November 2017 at 22:13, Brad Smith  wrote:

Fix the curses probe with older ncurses (.e.g. 5.7, as used by OpenBSD).

ncurses 5.7 requires _XOPEN_SOURCE_EXTENDED to be defined for WACS_* constants.

ncurses 5.7 was released in 2008 and is now 9 years old. Why
is OpenBSD still using such an ancient version?


Someone has to put the time and effort into updating it.

revision 1.61
date: 2010/09/06 17:26:17;  author: nicm;  state: Exp;  lines: +257 -5;
Enable wide character support in ncurses. It is built into libcurses,
libform, libmenu, libpanel and each library is also linked to a
corresponding "w" version.

This is a major bump for all four libraries.

Thanks to landry, stsp, sthen, naddy, oga, Martin Pieuchot, and anyone
else I've forgotten for testing.

ok naddy krw deraadt

revision 1.60
date: 2010/01/12 23:21:59;  author: nicm;  state: Exp;  lines: +768 -638;
Update to ncurses 5.7, with local changes reapplied.

This is around eight years worth of changes (previously we were around 
ncurses

5.2), too many to list - many bug fixes and also a few new functions.

A major bump for libcurses, libpanel, libform and libmenu.

ok deraadt

revision 1.59
date: 2001/02/28 22:58:53;  author: millert;  state: Exp;  lines: +2 -2;
ncurses-5.2-20010224

revision 1.58
date: 2001/02/22 04:16:34;  author: millert;  state: Exp;  lines: +2 -2;
Update to ncurses-5.2-20010210:
o remove macro callPutChar() from tty_update.c, since this is no longer
  needed (reported by Philippe Blain).
o add a null-pointer check in tic.c to handle the case when the input
  file is really empty.  Modify the next_char() function in comp_scan.c
  to allow arbitrarily long lines, and incidentally supply a newline to
  files that do not end in a newline.  These changes improve tic's
  recovery from attempts to read binary files, e.g., its output from
  the terminfo database (reported by Bernhard Rosenkraenzer).
o revert change to c++/demo.cc from 20001209, which changed definition
  of main() apparently to accommodate cygwin linker, but broke the demo
  program.

revision 1.57
date: 2001/01/22 18:01:33;  author: millert;  state: Exp;  lines: +497 -484;
Update to ncurses-5.2-20010114

revision 1.56
date: 2000/12/06 17:18:49;  author: deraadt;  state: Exp;  lines: +3 -3;
use __x__ formats for __attribute__ arguments; guent...@gac.edu

revision 1.55
date: 2000/10/22 18:27:19;  author: millert;  state: Exp;  lines: +4 -4;
update to ncurses 5.2


Signed-off-by: Brad Smith 


diff --git a/configure b/configure
index 0c6e7572db..9715b9c2cc 100755
--- a/configure
+++ b/configure
@@ -3186,7 +3186,7 @@ EOF
IFS=:
for curses_inc in $curses_inc_list; do
  # Make sure we get the wide character prototypes
-curses_inc="-DNCURSES_WIDECHAR $curses_inc"
+curses_inc="-DNCURSES_WIDECHAR -D_XOPEN_SOURCE_EXTENDED $curses_inc"

I'm a bit wary of this because we've found in the past that
defining _XOPEN_* defines breaks compilation with some
C libraries which assume that if you define _XOPEN_whatever
it means "only that X/Open stuff and no OS-specific extras",
and we depend on the OS-specific extras.

That said, I did a test compile on OSX, which was the
one that had trouble previously, so this may be OK. I think
I'd rather leave it until after 2.11 releases, though.

thanks
-- PMM


The other option I was looking at was removing the add_wch() function
call from the probe as the rest of the curses code within QEMU compiles
Ok without _XOPEN_SOURCE_EXTENDED.



Re: [Qemu-devel] [PATCH] configure: Fix curses probe for older ncurses

2017-11-27 Thread Peter Maydell
On 26 November 2017 at 22:13, Brad Smith  wrote:
> Fix the curses probe with older ncurses (.e.g. 5.7, as used by OpenBSD).
>
> ncurses 5.7 requires _XOPEN_SOURCE_EXTENDED to be defined for WACS_* 
> constants.

ncurses 5.7 was released in 2008 and is now 9 years old. Why
is OpenBSD still using such an ancient version?

> Signed-off-by: Brad Smith 
>
>
> diff --git a/configure b/configure
> index 0c6e7572db..9715b9c2cc 100755
> --- a/configure
> +++ b/configure
> @@ -3186,7 +3186,7 @@ EOF
>IFS=:
>for curses_inc in $curses_inc_list; do
>  # Make sure we get the wide character prototypes
> -curses_inc="-DNCURSES_WIDECHAR $curses_inc"
> +curses_inc="-DNCURSES_WIDECHAR -D_XOPEN_SOURCE_EXTENDED $curses_inc"

I'm a bit wary of this because we've found in the past that
defining _XOPEN_* defines breaks compilation with some
C libraries which assume that if you define _XOPEN_whatever
it means "only that X/Open stuff and no OS-specific extras",
and we depend on the OS-specific extras.

That said, I did a test compile on OSX, which was the
one that had trouble previously, so this may be OK. I think
I'd rather leave it until after 2.11 releases, though.

thanks
-- PMM



[Qemu-devel] [PATCH] configure: Fix curses probe for older ncurses

2017-11-26 Thread Brad Smith
Fix the curses probe with older ncurses (.e.g. 5.7, as used by OpenBSD).

ncurses 5.7 requires _XOPEN_SOURCE_EXTENDED to be defined for WACS_* constants.

Signed-off-by: Brad Smith 


diff --git a/configure b/configure
index 0c6e7572db..9715b9c2cc 100755
--- a/configure
+++ b/configure
@@ -3186,7 +3186,7 @@ EOF
   IFS=:
   for curses_inc in $curses_inc_list; do
 # Make sure we get the wide character prototypes
-curses_inc="-DNCURSES_WIDECHAR $curses_inc"
+curses_inc="-DNCURSES_WIDECHAR -D_XOPEN_SOURCE_EXTENDED $curses_inc"
 IFS=:
 for curses_lib in $curses_lib_list; do
   unset IFS