curses.m4 1.2 KB

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