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