Commit ab4e5602a88402fdf7109e5093cace35a7471699

Authored by Jan Kiszka
Committed by Anthony Liguori
1 parent fc57bc57

Prefer ncurses over curses

Not every distro provides libcurses anymore, at least OpenSUSE, and at
least under a standard library search path. So try to link against
standard ncurses first and then fall back to legacy curses.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Showing 1 changed file with 10 additions and 2 deletions
configure
... ... @@ -1078,6 +1078,7 @@ fi # -z $brlapi
1078 1078  
1079 1079 if test "$curses" = "yes" ; then
1080 1080 curses=no
  1081 + ncurses=no
1081 1082 cat > $TMPC << EOF
1082 1083 #include <curses.h>
1083 1084 #ifdef __OpenBSD__
... ... @@ -1085,7 +1086,10 @@ if test &quot;$curses&quot; = &quot;yes&quot; ; then
1085 1086 #endif
1086 1087 int main(void) { resize_term(0, 0); return curses_version(); }
1087 1088 EOF
1088   - if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses > /dev/null 2> /dev/null ; then
  1089 + if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lncurses > /dev/null 2> /dev/null ; then
  1090 + curses=yes
  1091 + ncurses=yes
  1092 + elif $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses > /dev/null 2> /dev/null ; then
1089 1093 curses=yes
1090 1094 fi
1091 1095 fi # test "$curses"
... ... @@ -1735,7 +1739,11 @@ fi
1735 1739 if test "$curses" = "yes" ; then
1736 1740 echo "#define CONFIG_CURSES 1" >> $config_h
1737 1741 echo "CONFIG_CURSES=yes" >> $config_mak
1738   - echo "CURSES_LIBS=-lcurses" >> $config_mak
  1742 + if test "$ncurses" = "yes" ; then
  1743 + echo "CURSES_LIBS=-lncurses" >> $config_mak
  1744 + else
  1745 + echo "CURSES_LIBS=-lcurses" >> $config_mak
  1746 + fi
1739 1747 fi
1740 1748 if test "$atfile" = "yes" ; then
1741 1749 echo "#define CONFIG_ATFILE 1" >> $config_h
... ...