diff mbox series

[3/4] Better recognition of ncurses header files

Message ID 20171116034914.7820-3-cyrilbur@gmail.com
State Accepted
Headers show
Series [1/4] configure.ac: Fix unmatched brackets | expand

Commit Message

Cyril Bur Nov. 16, 2017, 3:49 a.m. UTC
This patch was lifted directly from:
https://github.com/Tlf/tlf/commit/a21513254ce8bf66d0b019f6075eea918958741a

The commit message reads:
  If ax_with_ncurses finds a ncursesw instance the former code checks
  only for <ncursesw/panelh>. If not there the search fails.
  That let to problems at least in Arch Linux which has only <panel.h>
  installed.
  The patched version here checks first for <ncursesw/panel.h> and if
  not found also for <panel.h>.

  Tested for the following distributions:

  Gentoo, Debian 7..9, Linux Mint 17 and 18.1, Arch Linux, Ubuntu

ARCH Linux builds ncurses with wide character support but does not add
any ncurses specific headers. nurses its self (by default) adds almost
no ncurses specific headers. No {prefix}/include/ncurses directory. In
fact the only ncurses specific file is the ncurses.h symlink to
curses.h, other than that there are no ncurses headers.

The ax_with_curses.m4 script detects if the installed ncurses has wide
character support. It checks using code snippets against all possible
ncurses header files.

If the ax_with_curses.m4 script detects wide character support the
ax_with_curses_extra.m4 will only look for extra curses features (in
the case of petitboot, form.h and menu.h) inside the
{prefix}/include/ncurses directory, when they could simply be in
{prefix}/include.

Signed-off-by: Cyril Bur <cyrilbur@gmail.com>
---
As an added side note: carrying these is an extremely good idea, it
appears upstream is subtly broken (I really didn't go that much into
it), just know that pulling upstream doesn't work.
Confirmed here: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=840974

 m4/ax_with_curses_extra.m4 | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Cyril Bur Nov. 16, 2017, 3:58 a.m. UTC | #1
On Thu, 2017-11-16 at 14:49 +1100, Cyril Bur wrote:
> This patch was lifted directly from:
> https://github.com/Tlf/tlf/commit/a21513254ce8bf66d0b019f6075eea918958741a
> 
> The commit message reads:
>   If ax_with_ncurses finds a ncursesw instance the former code checks
>   only for <ncursesw/panelh>. If not there the search fails.
>   That let to problems at least in Arch Linux which has only <panel.h>
>   installed.
>   The patched version here checks first for <ncursesw/panel.h> and if
>   not found also for <panel.h>.
> 
>   Tested for the following distributions:
> 
>   Gentoo, Debian 7..9, Linux Mint 17 and 18.1, Arch Linux, Ubuntu
> 
> ARCH Linux builds ncurses with wide character support but does not add
> any ncurses specific headers. nurses its self (by default) adds almost
> no ncurses specific headers. No {prefix}/include/ncurses directory. In
> fact the only ncurses specific file is the ncurses.h symlink to
> curses.h, other than that there are no ncurses headers.
> 
> The ax_with_curses.m4 script detects if the installed ncurses has wide
> character support. It checks using code snippets against all possible
> ncurses header files.
> 
> If the ax_with_curses.m4 script detects wide character support the
> ax_with_curses_extra.m4 will only look for extra curses features (in
> the case of petitboot, form.h and menu.h) inside the
> {prefix}/include/ncurses directory, when they could simply be in
> {prefix}/include.
> 

Sorry I forgot to mention that I did test this both on my ARCH laptop
which fails to detect ncurses correctly without patch applied and in
op-build using both PETITBOOT_OVERRIDE_SRCDIR and changing the
petitboot.mk and changing the github repo it points to. No change
observed in op-build.

> Signed-off-by: Cyril Bur <cyrilbur@gmail.com>
> ---
> As an added side note: carrying these is an extremely good idea, it
> appears upstream is subtly broken (I really didn't go that much into
> it), just know that pulling upstream doesn't work.
> Confirmed here: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=840974
> 
>  m4/ax_with_curses_extra.m4 | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/m4/ax_with_curses_extra.m4 b/m4/ax_with_curses_extra.m4
> index e0de4a6..67a1a68 100644
> --- a/m4/ax_with_curses_extra.m4
> +++ b/m4/ax_with_curses_extra.m4
> @@ -200,6 +200,11 @@ AC_DEFUN([_AX_WITH_CURSES_EXTRA], [
>      ], [
>          AS_IF([test "x$ax_cv_curses_which" = xncursesw], [
>              _AX_WITH_CURSES_CHECKEXTRA([$1], [$2], [$3], [ncursesw/$4], [$5])
> +            dnl This fixes problem building on distos with 'odd'
> +            dnl ncurses header file setups
> +            AS_IF([test x$[]ax_cv_[]m4_tolower($1) != "xyes"], [
> +                _AX_WITH_CURSES_CHECKEXTRA([$1], [$2], [$3], [$4], [$5])
> +            ])
>          ], [test "x$ax_cv_curses_which" = xncurses], [
>              _AX_WITH_CURSES_CHECKEXTRA([$1], [$2], [$3], [ncurses/$4], [$6])
>              _AX_WITH_CURSES_CHECKEXTRA([$1], [$2], [$3], [$4], [$6])
diff mbox series

Patch

diff --git a/m4/ax_with_curses_extra.m4 b/m4/ax_with_curses_extra.m4
index e0de4a6..67a1a68 100644
--- a/m4/ax_with_curses_extra.m4
+++ b/m4/ax_with_curses_extra.m4
@@ -200,6 +200,11 @@  AC_DEFUN([_AX_WITH_CURSES_EXTRA], [
     ], [
         AS_IF([test "x$ax_cv_curses_which" = xncursesw], [
             _AX_WITH_CURSES_CHECKEXTRA([$1], [$2], [$3], [ncursesw/$4], [$5])
+            dnl This fixes problem building on distos with 'odd'
+            dnl ncurses header file setups
+            AS_IF([test x$[]ax_cv_[]m4_tolower($1) != "xyes"], [
+                _AX_WITH_CURSES_CHECKEXTRA([$1], [$2], [$3], [$4], [$5])
+            ])
         ], [test "x$ax_cv_curses_which" = xncurses], [
             _AX_WITH_CURSES_CHECKEXTRA([$1], [$2], [$3], [ncurses/$4], [$6])
             _AX_WITH_CURSES_CHECKEXTRA([$1], [$2], [$3], [$4], [$6])