readline.m4 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. dnl Check to find the readline headers/libraries
  2. AC_DEFUN([tinc_READLINE],
  3. [
  4. AC_ARG_ENABLE([readline],
  5. AS_HELP_STRING([--disable-readline], [disable readline support]))
  6. AS_IF([test "x$enable_readline" != "xno"], [
  7. AC_DEFINE(HAVE_READLINE, 1, [have readline support])
  8. readline=true
  9. AC_ARG_WITH(readline,
  10. AS_HELP_STRING([--with-readline=DIR], [readline base directory, or:]),
  11. [readline="$withval"
  12. CPPFLAGS="$CPPFLAGS -I$withval/include"
  13. LDFLAGS="$LDFLAGS -L$withval/lib"]
  14. )
  15. AC_ARG_WITH(readline-include,
  16. AS_HELP_STRING([--with-readline-include=DIR], [readline headers directory]),
  17. [readline_include="$withval"
  18. CPPFLAGS="$CPPFLAGS -I$withval"]
  19. )
  20. AC_ARG_WITH(readline-lib,
  21. AS_HELP_STRING([--with-readline-lib=DIR], [readline library directory]),
  22. [readline_lib="$withval"
  23. LDFLAGS="$LDFLAGS -L$withval"]
  24. )
  25. AC_CHECK_HEADERS([readline/readline.h readline/history.h],
  26. [],
  27. [AC_MSG_ERROR("readline header files not found."); break]
  28. )
  29. AC_CHECK_LIB(readline, readline,
  30. [READLINE_LIBS="-lreadline"],
  31. [AC_MSG_ERROR("readline library not found.")],
  32. [$CURSES_LIBS]
  33. )
  34. ])
  35. AC_SUBST(READLINE_LIBS)
  36. ])