From 0e531f5e6a964d4b2a234e17052f4a254227af41 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Tue, 25 Oct 2005 09:23:10 +0000 Subject: Added auto-detection of ncursesw/ncurses lib in configure.in, fall back to ncurses if ncursesw is not found (auto-detect ncurses.h location too) --- configure.in | 19 ++++++++++++++----- src/gui/curses/gui-display.c | 5 +++++ src/gui/curses/gui-input.c | 5 +++++ weechat/configure.in | 19 ++++++++++++++----- weechat/src/gui/curses/gui-display.c | 5 +++++ weechat/src/gui/curses/gui-input.c | 5 +++++ 6 files changed, 48 insertions(+), 10 deletions(-) diff --git a/configure.in b/configure.in index bff83cb97..8cf84e7e2 100644 --- a/configure.in +++ b/configure.in @@ -34,7 +34,8 @@ ALL_LINGUAS="fr es cs" AM_GNU_GETTEXT # Checks for libraries -AC_CHECK_LIB(ncursesw, initscr, LIBNCURSES_FOUND=1, LIBNCURSES_FOUND=0) +AC_CHECK_LIB(ncurses, initscr, LIBNCURSES_FOUND=1, LIBNCURSES_FOUND=0) +AC_CHECK_LIB(ncursesw, initscr, LIBNCURSESW_FOUND=1, LIBNCURSESW_FOUND=0) # Checks for header files AC_HEADER_STDC @@ -103,12 +104,20 @@ AM_CONDITIONAL(HAVE_GNUTLS, test "$enable_gnutls" = "yes") # ------------------------------------------------------------------------------ if test "x$enable_ncurses" = "xyes" ; then - if test "$LIBNCURSES_FOUND" = "0" ; then - AC_MSG_ERROR([ -*** ncursesw library not found! + if test "$LIBNCURSESW_FOUND" = "0" ; then + if test "$LIBNCURSES_FOUND" = "0" ; then + AC_MSG_ERROR([ +*** ncurses library not found! *** Please install ncurses library or run ./configure with --disable-ncurses parameter.]) + fi + AC_MSG_WARN([ +*** ncursesw library not found! Falling back to "ncurses" +*** Be careful, UTF-8 display will not work properly.]) + NCURSES_LIBS="-lncurses" + else + NCURSES_LIBS="-lncursesw" + AC_CHECK_HEADERS(ncursesw/curses.h) fi - NCURSES_LIBS="-lncursesw" AC_SUBST(NCURSES_LIBS) fi diff --git a/src/gui/curses/gui-display.c b/src/gui/curses/gui-display.c index 8f0d57389..895f3c2bd 100644 --- a/src/gui/curses/gui-display.c +++ b/src/gui/curses/gui-display.c @@ -31,7 +31,12 @@ #include #include #include + +#ifdef HAVE_NCURSESW_CURSES_H #include +#else +#include +#endif #include "../../common/weechat.h" #include "../gui.h" diff --git a/src/gui/curses/gui-input.c b/src/gui/curses/gui-input.c index 90ffc97be..3993f7ad7 100644 --- a/src/gui/curses/gui-input.c +++ b/src/gui/curses/gui-input.c @@ -31,7 +31,12 @@ #include #include #include + +#ifdef HAVE_NCURSESW_CURSES_H #include +#else +#include +#endif #include "../../common/weechat.h" #include "../gui.h" diff --git a/weechat/configure.in b/weechat/configure.in index bff83cb97..8cf84e7e2 100644 --- a/weechat/configure.in +++ b/weechat/configure.in @@ -34,7 +34,8 @@ ALL_LINGUAS="fr es cs" AM_GNU_GETTEXT # Checks for libraries -AC_CHECK_LIB(ncursesw, initscr, LIBNCURSES_FOUND=1, LIBNCURSES_FOUND=0) +AC_CHECK_LIB(ncurses, initscr, LIBNCURSES_FOUND=1, LIBNCURSES_FOUND=0) +AC_CHECK_LIB(ncursesw, initscr, LIBNCURSESW_FOUND=1, LIBNCURSESW_FOUND=0) # Checks for header files AC_HEADER_STDC @@ -103,12 +104,20 @@ AM_CONDITIONAL(HAVE_GNUTLS, test "$enable_gnutls" = "yes") # ------------------------------------------------------------------------------ if test "x$enable_ncurses" = "xyes" ; then - if test "$LIBNCURSES_FOUND" = "0" ; then - AC_MSG_ERROR([ -*** ncursesw library not found! + if test "$LIBNCURSESW_FOUND" = "0" ; then + if test "$LIBNCURSES_FOUND" = "0" ; then + AC_MSG_ERROR([ +*** ncurses library not found! *** Please install ncurses library or run ./configure with --disable-ncurses parameter.]) + fi + AC_MSG_WARN([ +*** ncursesw library not found! Falling back to "ncurses" +*** Be careful, UTF-8 display will not work properly.]) + NCURSES_LIBS="-lncurses" + else + NCURSES_LIBS="-lncursesw" + AC_CHECK_HEADERS(ncursesw/curses.h) fi - NCURSES_LIBS="-lncursesw" AC_SUBST(NCURSES_LIBS) fi diff --git a/weechat/src/gui/curses/gui-display.c b/weechat/src/gui/curses/gui-display.c index 8f0d57389..895f3c2bd 100644 --- a/weechat/src/gui/curses/gui-display.c +++ b/weechat/src/gui/curses/gui-display.c @@ -31,7 +31,12 @@ #include #include #include + +#ifdef HAVE_NCURSESW_CURSES_H #include +#else +#include +#endif #include "../../common/weechat.h" #include "../gui.h" diff --git a/weechat/src/gui/curses/gui-input.c b/weechat/src/gui/curses/gui-input.c index 90ffc97be..3993f7ad7 100644 --- a/weechat/src/gui/curses/gui-input.c +++ b/weechat/src/gui/curses/gui-input.c @@ -31,7 +31,12 @@ #include #include #include + +#ifdef HAVE_NCURSESW_CURSES_H #include +#else +#include +#endif #include "../../common/weechat.h" #include "../gui.h" -- cgit v1.2.3