1 dnl aclocal.m4 generated automatically by aclocal 1.4-p6
3 dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
8 dnl This program is distributed in the hope that it will be useful,
9 dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10 dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 dnl PARTICULAR PURPOSE.
15 dnl This is copied from the NcFTP distribution.
16 dnl Author Mike Gleason mgleason@NcFTP.com
18 dnl This macro will check for the presence and version
19 dnl of the readline library. To get it into the aclocal.m4
21 dnl aclocal -I . --verbose
23 dnl The --verbose will show all of the files that are searched
25 AC_DEFUN([wi_LIB_READLINE], [
26 AC_MSG_CHECKING([for GNU Readline library, version 2.0 or newer])
29 wi_cv_lib_readline_result=no
31 # Note: $LIBCURSES is permitted to be empty.
32 for LIBREADLINE in "-lreadline" "-lreadline $LIBCURSES" "-lreadline -ltermcap" "-lreadline -lncurses" "-lreadline -lcurses"
34 LIBS="$ac_save_LIBS $LIBREADLINE"
40 main(int argc, char **argv)
42 /* Note: don't actually call readline, since it may block;
43 * We just want to see if it (dynamic) linked in okay.
45 if (argc == 0) /* never true */
51 wi_cv_lib_readline=yes
56 # action if cross compiling
60 if test "$wi_cv_lib_readline" = yes ; then break ; fi
63 # Now try it again, to be sure it is recent enough.
64 # rl_function_of_keyseq appeared in version 2.0
66 dnl AC_CHECK_FUNC(rl_function_of_keyseq, [wi_cv_lib_readline=yes],[
67 dnl wi_cv_lib_readline=no;wi_cv_lib_readline_result="no (it is present but too old to use)"
74 rl_function_of_keyseq(0);
76 wi_cv_lib_readline=yes
79 wi_cv_lib_readline_result="no (it is present but too old to use)"
82 if test "$wi_cv_lib_readline" = no ; then
87 /bin/rm -f readline.ver
93 #include <sys/types.h>
96 extern char *rl_library_version;
103 sscanf(rl_library_version, "%lf", &d);
104 fp = fopen("readline.ver", "w");
105 if (fp == NULL) exit(1);
106 if (fprintf(fp, "%s\n", rl_library_version) < 0) exit(1);
107 if (fprintf(fp, "%03d\n", (int) (d * 100.0)) < 0) exit(1);
108 if (fclose(fp) < 0) exit(1);
113 rl_library_version=`sed -n 1,1p readline.ver 2>/dev/null`
114 rlver=`sed -n 2,2p readline.ver 2>/dev/null`
115 /bin/rm -f readline.ver
118 rl_library_version=''
120 /bin/rm -f readline.ver
122 # action if cross compiling
123 rl_library_version=''
125 /bin/rm -f readline.ver
130 wi_cv_lib_readline_result="yes, installed version is $rl_library_version"
133 # Test using current LIBS.
136 extern int rl_completion_append_character;
140 rl_completion_append_character = 0;
147 if test "$rlver" = "210" ; then
148 wi_cv_lib_readline_result="yes, version 2.1 or higher"
150 wi_cv_lib_readline_result="yes, version 2.0"
155 wi_cv_lib_readline=yes
159 AC_MSG_RESULT($wi_cv_lib_readline_result)
160 AC_SUBST(LIBREADLINE)
162 if test "$wi_cv_lib_readline" = yes ; then
163 # Now verify that all the headers are installed.
166 unset ac_cv_header_readline_chardefs_h
167 unset ac_cv_header_readline_history_h
168 unset ac_cv_header_readline_keymaps_h
169 unset ac_cv_header_readline_readline_h
170 unset ac_cv_header_readline_tilde_h
171 AC_CHECK_HEADERS([readline/chardefs.h readline/history.h readline/keymaps.h readline/readline.h readline/tilde.h])
174 "$ac_cv_header_readline_chardefs_h" \
175 "$ac_cv_header_readline_history_h" \
176 "$ac_cv_header_readline_keymaps_h" \
177 "$ac_cv_header_readline_readline_h" \
178 "$ac_cv_header_readline_tilde_h"
180 if test "$xxwi" = no ; then
185 if test "$xxwi" = no ; then
186 AC_MSG_WARN([GNU Readline headers are not installed or could not be found -- GNU Readline will not be used.])
187 wi_cv_lib_readline=no
188 wi_cv_lib_readline_result="no (headers not installed)"
190 AC_DEFINE_UNQUOTED(HAVE_LIBREADLINE, $rlver,[Readline])
193 dnl Check to see if we have a namespace clean version of readline
194 dnl or not. At least FreeBSD 4.9 ships with non-ns-clean readline.
195 if test "$wi_cv_lib_readline" = "yes" ; then
197 LIBS="$ac_save_LIBS $LIBREADLINE"
198 AC_CHECK_FUNCS(rl_completion_matches completion_matches)
202 dnl Check to see if rl_callback_handler_install takes a cast
203 AC_MSG_CHECKING([to see if readline callbacks take a cast])
205 LIBS="$ac_save_LIBS $LIBREADLINE"
210 #include <readline/readline.h>
211 void func(void) { return; }
213 rl_callback_handler_install(">", (void(*)(char*))func);
215 AC_DEFINE(READLINE_CB_TAKES_CAST, 1, [callbacks take a cast])