From ad70b0fe0342a70797a36e0f278da76c2dd2791e Mon Sep 17 00:00:00 2001 From: Ben Kibbey Date: Sun, 4 Sep 2016 15:44:11 -0400 Subject: [PATCH] pwmc: Check for free_history_entry(). Not all readline implementations have this. --- configure.ac | 8 ++++++++ m4/libtool.m4 | 1 - src/pwmc.c | 2 ++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index b0175631..d0bb08f1 100644 --- a/configure.ac +++ b/configure.ac @@ -138,6 +138,14 @@ if test "x$WITH_INTERACTIVE" = "xyes"; then if test "x$vl_cv_lib_readline" != "xno"; then READLINE_LIBS="$vl_cv_lib_readline" AC_SUBST(READLINE_LIBS) + ORIG_LIBS="$LIBS" + LIBS="$READLINE_LIBS" + AC_TRY_LINK_FUNC([free_history_entry], [ac_cv_free_history_entry=yes]) + LIBS="$ORIG_LIBS" + if test "x$ac_cv_free_history_entry" = "xyes"; then + AC_DEFINE(HAVE_FREE_HISTORY_ENTRY, 1, + [Define if your libreadline has free_history_entry().]) + fi else AC_MSG_ERROR([Missing or incomplete readline installation.]) WITH_INTERACTIVE="no" diff --git a/m4/libtool.m4 b/m4/libtool.m4 index 10ab2844..ee80844b 100644 --- a/m4/libtool.m4 +++ b/m4/libtool.m4 @@ -728,7 +728,6 @@ _LT_CONFIG_SAVE_COMMANDS([ cat <<_LT_EOF >> "$cfgfile" #! $SHELL # Generated automatically by $as_me ($PACKAGE) $VERSION -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # Provide generalized library-building support services. diff --git a/src/pwmc.c b/src/pwmc.c index 37201869..71ff12ac 100644 --- a/src/pwmc.c +++ b/src/pwmc.c @@ -1661,7 +1661,9 @@ add_history_item (const char *line) char *s; p = remove_history (i); +#ifdef HAVE_FREE_HISTORY_ENTRY s = free_history_entry (p); +#endif free (s); } -- 2.11.4.GIT