From 6b71d75c33e51b4ed03c183a5f2b80ed3b516f4f Mon Sep 17 00:00:00 2001 From: rakshasa Date: Mon, 27 Feb 2012 19:54:53 +0900 Subject: [PATCH] Test against both libtinfo and libtinfow. --- scripts/ax_with_curses.m4 | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/scripts/ax_with_curses.m4 b/scripts/ax_with_curses.m4 index 0840dc99..448dec76 100644 --- a/scripts/ax_with_curses.m4 +++ b/scripts/ax_with_curses.m4 @@ -318,27 +318,31 @@ AC_DEFUN([AX_WITH_CURSES], [ ]) dnl Test if we need to explicitly link against -ltinfow. - AC_CACHE_CHECK([if NcursesW wide-character info library is linked properly], [ax_cv_ncurses_compiled], [ + AC_CACHE_CHECK([if curses tinfo library is linked properly], [ax_cv_ncurses_compiled], [ LIBS="$ax_saved_LIBS $CURSES_LIB" + AC_LINK_IFELSE([AC_LANG_CALL([], [keypad])], [ax_cv_ncurses_compiled=yes], [ax_cv_ncurses_compiled=no]) - AC_LINK_IFELSE([AC_LANG_CALL([], [keypad])], - [ax_cv_ncurses_compiled=yes], [ax_cv_ncurses_compiled=no]) + LIBS="$ax_saved_LIBS $CURSES_LIB -ltinfo" + AC_LINK_IFELSE([AC_LANG_CALL([], [keypad])], [ax_cv_tinfo_compiled=yes], [ax_cv_tinfo_compiled=no]) - LIBS="$LIBS -ltinfow" - - AC_LINK_IFELSE([AC_LANG_CALL([], [keypad])], - [ax_cv_info_compiled=yes], [ax_cv_info_compiled=no]) + LIBS="$ax_saved_LIBS $CURSES_LIB -ltinfow" + AC_LINK_IFELSE([AC_LANG_CALL([], [keypad])], [ax_cv_tinfow_compiled=yes], [ax_cv_tinfow_compiled=no]) LIBS=$ax_saved_LIBS ]) - AS_IF([test "x$ax_cv_ncurses_compiled" = xno && test "x$ax_cv_info_compiled" = xno], [ - AC_MSG_ERROR([could not link ncursesw with/without tinfow]) - ]) - - AS_IF([test "x$ax_cv_ncurses_compiled" = xno && test "x$ax_cv_info_compiled" = xyes], [ - AC_MSG_RESULT([adding libtinfow]) - CURSES_LIB="$CURSES_LIB -ltinfow" + AS_IF([test "x$ax_cv_ncurses_compiled" = xno], [ + AS_IF( + [test "x$ax_cv_tinfo_compiled" = xyes], [ + AC_MSG_RESULT([adding libtinfo]) + CURSES_LIB="$CURSES_LIB -ltinfo" + ], + [test "x$ax_cv_tinfow_compiled" = xyes], [ + AC_MSG_RESULT([adding libtinfow]) + CURSES_LIB="$CURSES_LIB -ltinfow" + ], [ + AC_MSG_ERROR([no]) + ]) ]) ]) ])