Patchwork configure: don't try to compile against known broken curses.

login
register
mail settings
Submitter andrzej zaborowski
Date Dec. 7, 2011, 7:47 a.m.
Message ID <1323244048-6021-1-git-send-email-balrogg@gmail.com>
Download mbox | patch
Permalink /patch/130012/
State New
Headers show

Comments

andrzej zaborowski - Dec. 7, 2011, 7:47 a.m.
This should resolve a problem noted by Caraman Mihai Claudiu.

Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
---
 configure |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
Stefan Weil - Dec. 7, 2011, 6:57 p.m.
Am 07.12.2011 08:47, schrieb Andrzej Zaborowski:
> This should resolve a problem noted by Caraman Mihai Claudiu.
>
> Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
> ---
> configure | 5 +++++
> 1 files changed, 5 insertions(+), 0 deletions(-)
>
> diff --git a/configure b/configure
> index 61c43b9..678b982 100755
> --- a/configure
> +++ b/configure
> @@ -1846,6 +1846,11 @@ if test "$curses" != "no" ; then
> #ifdef __OpenBSD__
> #define resize_term resizeterm
> #endif
> +#ifdef NCURSES_VERSION
> +# if NCURSES_VERSION_PATCH < 20040117
> +# error Old ncurses contain dangerous typedefs, break qemu build (and 
> are old)
> +# endif
> +#endif
> int main(void) { resize_term(0, 0); return curses_version(); }
> EOF
> for curses_lib in $curses_list; do

Is NCURSES_VERSION_PATCH always defined when NCURSES_VERSION is?
If not, code like the following is more robust:

#if !defined(NCURSES_VERSION_PATCH) || NCURSES_VERSION_PATCH < 20040117
# error Old ncurses contain dangerous typedefs, break qemu build (and 
are old)
#endif

Otherwise the patch is good.

Reviewed-by: Stefan Weil <sw@weilnetz.de>
andrzej zaborowski - Dec. 7, 2011, 7:06 p.m.
On 7 December 2011 19:57, Stefan Weil <sw@weilnetz.de> wrote:
> Am 07.12.2011 08:47, schrieb Andrzej Zaborowski:
>> +#ifdef NCURSES_VERSION
>> +# if NCURSES_VERSION_PATCH < 20040117
>> +# error Old ncurses contain dangerous typedefs, break qemu build (and are
>> old)
>> +# endif
>> +#endif
>> int main(void) { resize_term(0, 0); return curses_version(); }
>> EOF
>> for curses_lib in $curses_list; do
>
>
> Is NCURSES_VERSION_PATCH always defined when NCURSES_VERSION is?

I'm not sure, will try to find out.  If it isn't then we should check
that NCURSES_VERSION_MINOR < 4 perhaps.

The intent of checking defined(NCURSES_VERSION) is to detect ncurses
because qemu should also build with other implementations of curses
(in theory).

Cheers
Stefan Weil - Dec. 7, 2011, 7:51 p.m.
Am 07.12.2011 20:06, schrieb andrzej zaborowski:
> On 7 December 2011 19:57, Stefan Weil <sw@weilnetz.de> wrote:
>> Am 07.12.2011 08:47, schrieb Andrzej Zaborowski:
>>> +#ifdef NCURSES_VERSION
>>> +# if NCURSES_VERSION_PATCH < 20040117
>>> +# error Old ncurses contain dangerous typedefs, break qemu build 
>>> (and are
>>> old)
>>> +# endif
>>> +#endif
>>> int main(void) { resize_term(0, 0); return curses_version(); }
>>> EOF
>>> for curses_lib in $curses_list; do
>>
>>
>> Is NCURSES_VERSION_PATCH always defined when NCURSES_VERSION is?
>
> I'm not sure, will try to find out. If it isn't then we should check
> that NCURSES_VERSION_MINOR < 4 perhaps.
>
> The intent of checking defined(NCURSES_VERSION) is to detect ncurses
> because qemu should also build with other implementations of curses
> (in theory).
>
> Cheers

Yes, that's right. W32 for example supports pdcurses. So the check
might look like this:

#if defined(NCURSES_VERSION_PATCH) && NCURSES_VERSION_PATCH < 20040117
# error Old ncurses contain dangerous typedefs, break qemu build (and 
are old)
#endif

Cheers,
Stefan
andrzej zaborowski - Dec. 14, 2011, 9:58 p.m.
On 7 December 2011 20:06, andrzej zaborowski <balrogg@gmail.com> wrote:
> On 7 December 2011 19:57, Stefan Weil <sw@weilnetz.de> wrote:
>> Am 07.12.2011 08:47, schrieb Andrzej Zaborowski:
>>> +#ifdef NCURSES_VERSION
>>> +# if NCURSES_VERSION_PATCH < 20040117
>>> +# error Old ncurses contain dangerous typedefs, break qemu build (and are
>>> old)
>>> +# endif
>>> +#endif
>>> int main(void) { resize_term(0, 0); return curses_version(); }
>>> EOF
>>> for curses_lib in $curses_list; do
>>
>>
>> Is NCURSES_VERSION_PATCH always defined when NCURSES_VERSION is?
>
> I'm not sure, will try to find out.  If it isn't then we should check
> that NCURSES_VERSION_MINOR < 4 perhaps.

At least since 4.2 (19980211) both are defined, I'll apply a version
of the patch similar to what you proposed.

Cheers

Patch

diff --git a/configure b/configure
index 61c43b9..678b982 100755
--- a/configure
+++ b/configure
@@ -1846,6 +1846,11 @@  if test "$curses" != "no" ; then
 #ifdef __OpenBSD__
 #define resize_term resizeterm
 #endif
+#ifdef NCURSES_VERSION
+# if NCURSES_VERSION_PATCH < 20040117
+#  error Old ncurses contain dangerous typedefs, break qemu build (and are old)
+# endif
+#endif
 int main(void) { resize_term(0, 0); return curses_version(); }
 EOF
   for curses_lib in $curses_list; do