summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJérémie Courrèges-Anglas <jca@wxcvbn.org>2014-06-14 16:55:15 +0200
committerJérémie Courrèges-Anglas <jca@wxcvbn.org>2014-06-14 16:55:15 +0200
commitfa8ec99a9054f006fac10bb57df35d457c06ce93 (patch)
tree26f0ed4a11fb17b22b2e500bc8a53978d0da3e30
parentfd4cfa89a0baaa0ecaf5a2901c9a506d1748907e (diff)
downloadratpoison-fa8ec99a9054f006fac10bb57df35d457c06ce93.zip
Rewrite libhistory handling.
-rw-r--r--configure.ac44
1 files changed, 24 insertions, 20 deletions
diff --git a/configure.ac b/configure.ac
index 47f72fe..c90eb31 100644
--- a/configure.ac
+++ b/configure.ac
@@ -127,26 +127,30 @@ fi
dnl Those who do not learn the lessons of history
dnl are doomed to delete it... yuk yuk. --ttn
-AC_ARG_ENABLE(history,AS_HELP_STRING([--disable-history],[ignore libhistory (default: use it if available, only used for ! expansion)]),
- [ if test x${enableval} = xyes ; then
- check_for_libhistory=yes
- else
- check_for_libhistory=no
- fi],[check_for_libhistory=default])
-
-HISTORY_LIBS=""
-if test x$check_for_libhistory != xno ; then
- AC_CHECK_HEADERS([readline/history.h],
- AC_CHECK_LIB(history, add_history,
- [HISTORY_LIBS="-lhistory"
- AC_DEFINE_UNQUOTED(HAVE_HISTORY, 1, Define this to enable history)],
- if test x$check_for_libhistory = xyes ; then
- AC_MSG_ERROR([*** Can't find History lib. Install readline dev libs for history expansion.])
- fi),
- if test x$check_for_libhistory = xyes ; then
- AC_MSG_ERROR([*** Can't find History header. Install readline dev libs for history expansion.])
- fi)
-fi
+AC_ARG_ENABLE([history],
+ AS_HELP_STRING([--disable-history],
+ [ignore libhistory (default: use it if available, only used for ! expansion)]),
+ [], [enable_history=default])
+
+HISTORY_LIBS=
+have_history=no
+AS_CASE([$enable_history],
+ [no], [],
+ [yes|default],
+ [AC_CHECK_HEADERS([readline/history.h],
+ [AC_CHECK_LIB([history], [add_history], [have_history=yes], [])],
+ [])],
+ [AC_MSG_ERROR([invalid --enable-history="$enable_history" parameter])])
+
+AC_MSG_CHECKING([whether to use libhistory])
+AS_CASE([$enable_history:$have_history],
+ [yes:no], [AC_MSG_ERROR([Can't find history headers/lib. \
+Install readline dev libs for history expansion.])],
+ [default:no|no:*], [AC_MSG_RESULT([no])],
+ [*:yes], [AC_MSG_RESULT([yes])
+ AC_DEFINE_UNQUOTED(HAVE_HISTORY, 1, Define this to enable history)
+ HISTORY_LIBS="-lhistory"])
+
AC_SUBST(HISTORY_LIBS)
AC_CHECK_LIB(X11, XOpenDisplay, [X_LIBS="-lX11 $X_LIBS"],