x_ac_ncurses.m4 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. ##*****************************************************************************
  2. # AUTHOR:
  3. # Morris Jette <jette1@llnl.gov>
  4. #
  5. # SYNOPSIS:
  6. # X_AC_NCURSES
  7. #
  8. # DESCRIPTION:
  9. # Test for NCURSES or CURSES. If found define NCURSES
  10. ##*****************************************************************************
  11. AC_DEFUN([X_AC_NCURSES],
  12. [
  13. AC_CHECK_LIB([ncurses],
  14. [initscr],
  15. [ac_have_ncurses=yes])
  16. AC_CHECK_LIB([curses],
  17. [initscr],
  18. [ac_have_curses=yes])
  19. AC_CHECK_LIB([tinfo],
  20. [tgetent],
  21. [ac_have_tinfo=yes])
  22. AC_SUBST(NCURSES)
  23. if test "$ac_have_ncurses" = "yes"; then
  24. NCURSES="-lncurses"
  25. NCURSES_HEADER="ncurses.h"
  26. ac_have_some_curses="yes"
  27. elif test "$ac_have_curses" = "yes"; then
  28. NCURSES="-lcurses"
  29. NCURSES_HEADER="curses.h"
  30. ac_have_some_curses="yes"
  31. fi
  32. if test "$ac_have_tinfo" = "yes"; then
  33. NCURSES="$NCURSES -ltinfo"
  34. fi
  35. if test "$ac_have_some_curses" = "yes"; then
  36. save_LIBS="$LIBS"
  37. LIBS="$NCURSES $save_LIBS"
  38. AC_TRY_LINK([#include <${NCURSES_HEADER}>],
  39. [(void)initscr(); (void)endwin();],
  40. [], [ac_have_some_curses="no"])
  41. LIBS="$save_LIBS"
  42. if test "$ac_have_some_curses" = "yes"; then
  43. AC_MSG_RESULT([NCURSES test program built properly.])
  44. else
  45. AC_MSG_WARN([*** NCURSES test program execution failed.])
  46. fi
  47. else
  48. AC_MSG_WARN([cannot build smap without curses or ncurses library])
  49. ac_have_some_curses="no"
  50. fi
  51. ])