From 343dc2e221148f8e0ea845b9d118d20ca89c6d58 Mon Sep 17 00:00:00 2001 From: Ben Kibbey Date: Mon, 18 Jun 2012 19:00:36 -0400 Subject: [PATCH] Revert "Include m4 readline checking macro in the dist." This reverts commit 31e647726f989d84486d98ed37cd01f76f147840. Already had readline checking from Matthias Andree. --- acinclude.m4 | 62 --------------------------------------------------------- configure.ac | 15 +++++++++++--- src/Makefile.am | 5 ++++- src/pwmc.c | 18 +++++++++++++---- 4 files changed, 30 insertions(+), 70 deletions(-) delete mode 100644 acinclude.m4 diff --git a/acinclude.m4 b/acinclude.m4 deleted file mode 100644 index cfbe3b5c..00000000 --- a/acinclude.m4 +++ /dev/null @@ -1,62 +0,0 @@ -dnl Check for readline and dependencies -dnl Copyright (C) 2004, 2005 Free Software Foundation, Inc. -dnl -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. -dnl -dnl Defines HAVE_LIBREADLINE to 1 if a working readline setup is -dnl found, and sets @LIBREADLINE@ to the necessary libraries. - -AC_DEFUN([GNUPG_CHECK_READLINE], -[ - AC_ARG_WITH(readline, - AC_HELP_STRING([--with-readline=DIR], - [look for the readline library in DIR]), - [_do_readline=$withval],[_do_readline=yes]) - - if test "$_do_readline" != "no" ; then - if test -d "$withval" ; then - CPPFLAGS="${CPPFLAGS} -I$withval/include" - LDFLAGS="${LDFLAGS} -L$withval/lib" - fi - - for _termcap in "" "-ltermcap" "-lcurses" "-lncurses" ; do - _readline_save_libs=$LIBS - _combo="-lreadline${_termcap:+ $_termcap}" - LIBS="$LIBS $_combo" - - AC_MSG_CHECKING([whether readline via \"$_combo\" is present and sane]) - - AC_LINK_IFELSE([AC_LANG_PROGRAM([[ -#include -#include -#include -]],[[ -rl_completion_func_t *completer; -add_history("foobar"); -rl_catch_signals=0; -rl_inhibit_completion=0; -rl_attempted_completion_function=NULL; -rl_completion_matches(NULL,NULL); -]])],[_found_readline=yes],[_found_readline=no]) - - AC_MSG_RESULT([$_found_readline]) - - LIBS=$_readline_save_libs - - if test $_found_readline = yes ; then - AC_DEFINE(HAVE_LIBREADLINE,1, - [Define to 1 if you have a fully functional readline library.]) - AC_SUBST(LIBREADLINE,$_combo) - break - fi - done - - unset _termcap - unset _readline_save_libs - unset _combo - fi -])dnl diff --git a/configure.ac b/configure.ac index 5b46c466..49734f1e 100644 --- a/configure.ac +++ b/configure.ac @@ -112,10 +112,19 @@ PKG_PROG_PKG_CONFIG AC_ARG_ENABLE(interactive, AC_HELP_STRING([--disable-interactive], [Disable interactive mode in pwmc.]), WITH_INTERACTIVE=no, WITH_INTERACTIVE=yes) -if test $WITH_INTERACTIVE = "yes"; then - GNUPG_CHECK_READLINE - WITH_INTERACTIVE=$_found_readline +AC_MSG_CHECKING([if interactive mode is wanted]) +AC_MSG_RESULT($WITH_INTERACTIVE) +if test "x$WITH_INTERACTIVE" = "xyes"; then + AX_LIB_READLINE + + if test "x$ax_cv_lib_readline" != "xno"; then + READLINE_LIBS="$ax_cv_lib_readline" + AC_SUBST(READLINE_LIBS) + else + WITH_INTERACTIVE="no" + fi fi +AM_CONDITIONAL([WITH_READLINE], [test "x$ax_cv_lib_readline" != "xno"]) AM_PATH_LIBASSUAN([2.0.0],, AC_MSG_ERROR([libassuan not found])) AM_PATH_GPG_ERROR(,, AC_MSG_ERROR([Missing or incomplete libgpg-error installation.])) diff --git a/src/Makefile.am b/src/Makefile.am index 245376e2..304fb0f6 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -6,7 +6,7 @@ libpwmd_la_SOURCES = libpwmd.c libpwmd.h types.h gettext.h mem.h misc.c misc.h libpwmd_la_HEADERS = libpwmd.h libpwmd_la_LDFLAGS = -version-info @VER_MAJOR@:@VER_PATCH@:@VER_MINOR@ \ @PTHREAD_LIBS@ @GPG_ERROR_LIBS@ @LTLIBINTL@ \ - @LIBASSUAN_LIBS@ @LIBREADLINE@ + @LIBASSUAN_LIBS@ libpwmd_la_CFLAGS = -DLOCALEDIR=\"${prefix}/share/locale\" @GPG_ERROR_CFLAGS@ \ @PTHREAD_CFLAGS@ @LIBASSUAN_CFLAGS@ @@ -39,6 +39,9 @@ pwmc_CFLAGS = -DLOCALEDIR=\"${prefix}/share/locale\" @GPG_ERROR_CFLAGS@ pwmc_LDFLAGS = @GPG_ERROR_LIBS@ pwmc_LDADD= -lpwmd pwmc_DEPENDENCIES= libpwmd.la +if WITH_READLINE +pwmc_LDFLAGS += @READLINE_LIBS@ +endif if MEM_DEBUG CPPFLAGS += -DMEM_DEBUG diff --git a/src/pwmc.c b/src/pwmc.c index 56a76c07..bbe964d2 100644 --- a/src/pwmc.c +++ b/src/pwmc.c @@ -53,12 +53,22 @@ #endif #ifdef HAVE_LIBREADLINE -#include -#include - +# if defined(HAVE_READLINE_READLINE_H) +# include +# elif defined(HAVE_READLINE_H) +# include +# endif /* !defined(HAVE_READLINE_H) */ static int interactive_error; static int interactive; -#endif +#endif /* HAVE_LIBREADLINE */ + +#ifdef HAVE_READLINE_HISTORY +# if defined(HAVE_READLINE_HISTORY_H) +# include +# elif defined(HAVE_HISTORY_H) +# include +# endif +#endif /* HAVE_READLINE_HISTORY */ #ifndef LINE_MAX #define LINE_MAX 2048 -- 2.11.4.GIT