From f52d9641ed05fb3b85500d80c9ace76f3c926e26 Mon Sep 17 00:00:00 2001 From: Suresh Sundriyal Date: Fri, 20 Mar 2015 20:50:14 -0700 Subject: [PATCH] [build] Make sure readline has the necessary symbols. On FreeBSD variant, readline functionality is provided by editline which is almost compatible but not quite. We could do a specific check for editline but if editline adds the functionality in the future, this check will still continue to fail. Instead look for one of the symbols currently missing in editline as a sanity check. --- m4/lnav_with_readline.m4 | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/m4/lnav_with_readline.m4 b/m4/lnav_with_readline.m4 index 1a76b147..8955ceed 100644 --- a/m4/lnav_with_readline.m4 +++ b/m4/lnav_with_readline.m4 @@ -27,7 +27,10 @@ AC_DEFUN([AX_PATH_LIB_READLINE], AC_MSG_ERROR([readline library not found]) )dnl AS_VAR_SET([READLINE_CFLAGS], ["-I$with_readline/include"]) + AS_VAR_SET([READLINE_SAVED_LDFLAGS], ["$LDFLAGS"]) LNAV_ADDTO(CPPFLAGS, ["-I$with_readline/include"]) + dnl We want the provided path to be the first in the search order. + LDFLAGS="-L$with_readline/lib $LDFLAGS" ]dnl ) @@ -43,6 +46,18 @@ AC_DEFUN([AX_PATH_LIB_READLINE], [AC_MSG_ERROR([readline headers not found])] ) + dnl Ensure that the readline library has the required symbols. + dnl i.e. We haven't picked up editline. + AC_SEARCH_LIBS([history_set_history_state], [readline], + [ + AS_VAR_SET_IF([READLINE_SAVED_LDFLAGS], + AS_VAR_SET([LDFLAGS], ["$READLINE_SAVED_LDFLAGS"]) + ) + ], + AC_MSG_ERROR([libreadline does not have the required symbols. editline possibly masquerading as readline.]) + [$CURSES] + ) + AC_SUBST([READLINE_LIBS]) AC_SUBST([READLINE_CFLAGS]) ]dnl