1 AC_DEFUN([NTP_LINEEDITLIBS], [
3 AC_ARG_WITH([lineeditlibs],
4 [AC_HELP_STRING([--with-lineeditlibs], [edit,editline (readline may be specified if desired)])],
5 [use_lineeditlibs="$withval"],
6 [use_lineeditlibs="edit,editline"])
8 AC_MSG_CHECKING([line editing libraries])
9 AC_MSG_RESULT([$use_lineeditlibs])
10 case "$use_lineeditlibs" in
15 for lineedit_lib in `echo $use_lineeditlibs | sed -e 's/,/ /'`; do
16 for term_lib in "" termcap curses ncurses; do
19 TRY_LIB="-l$lineedit_lib"
21 *) TRY_LIB="-l$lineedit_lib -l$term_lib"
23 LIBS="$NTP_ORIG_LIBS $TRY_LIB"
24 AC_MSG_CHECKING([for readline() with $TRY_LIB])
25 AC_TRY_LINK_FUNC([readline], [ntp_lib_lineedit="$TRY_LIB"])
26 case "$ntp_lib_lineedit" in
34 esac # $ntp_lib_lineedit
37 # do not try el_gets without a terminal library
40 AC_MSG_CHECKING([for el_gets() with $TRY_LIB])
41 AC_TRY_LINK_FUNC([el_gets], [ntp_lib_lineedit="$TRY_LIB"])
42 case "$ntp_lib_lineedit" in
50 esac # $ntp_lib_lineedit
53 case "$ntp_lib_lineedit" in
60 esac # $use_lineeditlibs
62 case "$ntp_lib_lineedit" in
69 EDITLINE_LIBS="$ntp_lib_lineedit"
70 AC_SUBST(EDITLINE_LIBS)
72 esac # $ntp_lib_lineedit
74 case "$ntp_lib_lineedit" in
78 dnl AC_DEFINE(HAVE_LIBREADLINE, 1,
79 dnl [Define if you have a readline compatible library])
80 AC_CHECK_HEADERS([readline.h readline/readline.h histedit.h])
81 AC_CHECK_HEADERS([history.h readline/history.h])
83 AC_MSG_CHECKING([whether readline supports history])
85 ntp_lib_lineedit_history="no"
87 LIBS="$ORIG_LIBS $ntp_lib_lineedit"
88 AC_TRY_LINK_FUNC([add_history], [ntp_lib_lineedit_history="yes"])
91 AC_MSG_RESULT([$ntp_lib_lineedit_history])
93 case "$ntp_lib_lineedit_history" in
95 AC_DEFINE(HAVE_READLINE_HISTORY, 1,
96 [Define if your readline library has \`add_history'])
97 esac # $ntp_lib_lineedit_history
98 esac # $ntp_lib_lineedit
99 dnl when oldest supported autoconf has AS_UNSET
100 dnl AS_UNSET([NTP_ORIG_LIBS TRY_LIB use_lineeditlibs])
101 $as_unset NTP_ORIG_LIBS TRY_LIB use_lineeditlibs