1 AC_DEFUN([NTP_LINEEDITLIBS], [
7 [edit,editline (readline may be specified if desired)]
9 [use_lineeditlibs="$withval"],
10 [use_lineeditlibs="edit,editline"]
12 AC_MSG_CHECKING([line editing libraries])
13 AC_MSG_RESULT([$use_lineeditlibs])
14 case "$use_lineeditlibs" in
19 for lineedit_lib in `echo $use_lineeditlibs | sed -e 's/,/ /'`; do
20 for term_lib in "" termcap curses ncurses; do
23 TRY_LIB="-l$lineedit_lib"
26 TRY_LIB="-l$lineedit_lib -l$term_lib"
29 LIBS="$NTP_ORIG_LIBS $TRY_LIB"
30 AC_MSG_CHECKING([for readline() with $TRY_LIB])
31 AC_TRY_LINK_FUNC([readline], [ntp_lib_lineedit="$TRY_LIB"])
32 case "$ntp_lib_lineedit" in
43 # do not try el_gets without a terminal library
46 AC_MSG_CHECKING([for el_gets() with $TRY_LIB])
47 AC_TRY_LINK_FUNC([el_gets], [ntp_lib_lineedit="$TRY_LIB"])
48 case "$ntp_lib_lineedit" in
56 esac # $ntp_lib_lineedit
59 case "$ntp_lib_lineedit" in
69 esac # $use_lineeditlibs
71 case "$ntp_lib_lineedit" in
78 EDITLINE_LIBS="$ntp_lib_lineedit"
79 AC_SUBST([EDITLINE_LIBS])
81 esac # $ntp_lib_lineedit
83 case "$ntp_lib_lineedit" in
87 AC_CHECK_HEADERS([readline.h readline/readline.h histedit.h])
88 AC_CHECK_HEADERS([history.h readline/history.h])
90 case "$ac_cv_header_histedit_h" in
93 [number of arguments to el_init()],
94 [ntp_cv_el_init_args],
102 el_init("conftest", stdin, stdout, stderr);
105 [ntp_cv_el_init_args=4],
106 [ntp_cv_el_init_args=3]
111 [$ntp_cv_el_init_args],
112 [number of args to el_init()]
116 AC_MSG_CHECKING([whether readline supports history])
118 ntp_lib_lineedit_history="no"
120 LIBS="$ORIG_LIBS $ntp_lib_lineedit"
121 AC_TRY_LINK_FUNC([add_history], [ntp_lib_lineedit_history="yes"])
124 AC_MSG_RESULT([$ntp_lib_lineedit_history])
126 case "$ntp_lib_lineedit_history" in
128 AC_DEFINE([HAVE_READLINE_HISTORY], [1],
129 [Define if your readline library has \`add_history'])
131 esac # $ntp_lib_lineedit
132 AS_UNSET([NTP_ORIG_LIBS])
133 AS_UNSET([ORIG_LIBS])
135 AS_UNSET([use_lineeditlibs])