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