From 4b2e5e591466d68f4d8f5cdcad1efbe2882f284e Mon Sep 17 00:00:00 2001 From: Cary R Date: Tue, 7 Apr 2009 10:22:26 -0700 Subject: [PATCH] Check for both the library and include file when adding history. When adding history (add_history) use both the existence of the library and the header file to determine if history can be supported. Add a new USE_HISTORY that is the and of these two. --- vvp/config.h.in | 9 +++++++++ vvp/stop.cc | 8 ++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/vvp/config.h.in b/vvp/config.h.in index a9d5605f1..71691a402 100644 --- a/vvp/config.h.in +++ b/vvp/config.h.in @@ -44,6 +44,7 @@ # undef HAVE_MALLOC_H # undef HAVE_LIBREADLINE # undef HAVE_READLINE_READLINE_H +# undef HAVE_LIBHISTORY # undef HAVE_READLINE_HISTORY_H # undef HAVE_INTTYPES_H # undef HAVE_LROUND @@ -63,6 +64,14 @@ #endif #endif +/* Figure if I can use history. */ +#undef USE_HISTORY +#ifdef HAVE_LIBHISTORY +#ifdef HAVE_READLINE_HISTORY_H +# define USE_HISTORY +#endif +#endif + #ifndef MODULE_DIR # define MODULE_DIR "." #endif diff --git a/vvp/stop.cc b/vvp/stop.cc index 07b6e2af8..b20230fd8 100644 --- a/vvp/stop.cc +++ b/vvp/stop.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2007 Stephen Williams (steve@icarus.com) + * Copyright (c) 2003-2009 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -30,10 +30,10 @@ # include "schedule.h" # include # include -#ifdef HAVE_READLINE_READLINE_H +#ifdef USE_READLINE # include #endif -#ifdef HAVE_READLINE_HISTORY_H +#ifdef USE_HISTORY # include #endif # include @@ -499,7 +499,7 @@ void stop_handler(int rc) first += 1; if (first[0] != 0) { -#ifdef HAVE_READLINE_HISTORY_H +#ifdef USE_HISTORY add_history(first); #endif invoke_command(first);