3 dnl Don't use "echo -n", which is not portable (e.g., not available on
4 dnl MacOS X). Instead, use `patsubst' to remove the newline.
5 AC_INIT(guile-readline,
6 patsubst(m4_esyscmd(. ../GUILE-VERSION && echo ${GUILE_VERSION}), [
10 AC_CONFIG_AUX_DIR([.])
11 AC_CONFIG_SRCDIR(readline.c)
12 AM_CONFIG_HEADER([guile-readline-config.h])
13 AM_INIT_AUTOMAKE([foreign no-define])
15 . $srcdir/../GUILE-VERSION
24 dnl Check for Winsock and other functionality on Win32 (*not* CygWin)
29 if test "$MINGW32" = "yes" ; then
30 if test $enable_shared = yes ; then
31 EXTRA_DEFS="-DSCM_IMPORT"
36 for termlib in ncurses curses termcap terminfo termlib ; do
37 AC_CHECK_LIB(${termlib}, tgoto,
38 [LIBS="-l${termlib} $LIBS"; break])
41 AC_CHECK_LIB(readline, readline)
42 if test $ac_cv_lib_readline_readline = no; then
43 AC_MSG_WARN([libreadline was not found on your system.])
46 AC_CHECK_FUNCS(siginterrupt rl_clear_signals rl_cleanup_after_signal)
48 dnl Check for modern readline naming
49 AC_CHECK_FUNCS(rl_filename_completion_function)
51 dnl Check for rl_get_keymap. We only use this for deciding whether to
52 dnl install paren matching on the Guile command line (when using
53 dnl readline for input), so it's completely optional.
54 AC_CHECK_FUNCS(rl_get_keymap)
56 dnl Check for rl_pre_input_hook. This is more complicated because on
57 dnl some systems (HP/UX), the linker wont let us treat
58 dnl rl_pre_input_hook as a function when it really is a function
61 AC_MSG_CHECKING([for rl_pre_input_hook])
62 AC_CACHE_VAL(ac_cv_var_rl_pre_input_hook,
65 #include <readline/readline.h>
67 rl_pre_input_hook = 0;
69 ac_cv_var_rl_pre_input_hook=yes,
70 ac_cv_var_rl_pre_input_hook=no)])
71 AC_MSG_RESULT($ac_cv_var_rl_pre_input_hook)
72 if test $ac_cv_var_rl_pre_input_hook = yes; then
73 AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK,1,
74 [Define if rl_pre_input_hook is available.])
78 AC_MSG_CHECKING(if readline clears SA_RESTART flag for SIGWINCH)
79 AC_CACHE_VAL(guile_cv_sigwinch_sa_restart_cleared,
80 AC_TRY_RUN([#include <signal.h>
82 #include <readline/readline.h>
87 struct sigaction action;
89 sigaction (SIGWINCH, NULL, &action);
90 rl_cleanup_after_signal();
92 /* exit with 0 if readline disabled SA_RESTART */
93 exit (action.sa_flags & SA_RESTART);
99 struct sigaction action;
101 sigaction (SIGWINCH, NULL, &action);
102 action.sa_flags |= SA_RESTART;
103 sigaction (SIGWINCH, &action, NULL);
105 /* Give readline something to read. Otherwise, it might hang, for
106 example when run as a background process with job control.
108 rl_instream = fopen ("/dev/null", "r");
109 if (rl_instream == NULL)
111 perror ("/dev/null");
115 rl_pre_input_hook = hook;
118 guile_cv_sigwinch_sa_restart_cleared=yes,
119 guile_cv_sigwinch_sa_restart_cleared=no,
120 guile_cv_sigwinch_sa_restart_cleared=yes))
121 AC_MSG_RESULT($guile_cv_sigwinch_sa_restart_cleared)
122 if test $guile_cv_sigwinch_sa_restart_cleared = yes; then
123 AC_DEFINE(GUILE_SIGWINCH_SA_RESTART_CLEARED, 1,
124 [Define if readline disables SA_RESTART.])
127 AC_CACHE_CHECK([for rl_getc_function pointer in readline],
128 ac_cv_var_rl_getc_function,
131 #include <readline/readline.h>],
132 [printf ("%ld", (long) rl_getc_function)],
133 [ac_cv_var_rl_getc_function=yes],
134 [ac_cv_var_rl_getc_function=no])])
135 if test "${ac_cv_var_rl_getc_function}" = "yes"; then
136 AC_DEFINE(HAVE_RL_GETC_FUNCTION, 1,
137 [Define if your readline library has the rl_getc_function variable.])
140 if test $ac_cv_lib_readline_readline = yes \
141 -a $ac_cv_var_rl_getc_function = no; then
142 AC_MSG_WARN([*** libreadline is too old on your system.])
143 AC_MSG_WARN([*** You need readline version 2.1 or later.])
146 AC_CHECK_FUNCS(strdup)
148 . $srcdir/LIBGUILEREADLINE-VERSION
149 AC_SUBST(LIBGUILEREADLINE_MAJOR)
150 AC_SUBST(LIBGUILEREADLINE_INTERFACE_CURRENT)
151 AC_SUBST(LIBGUILEREADLINE_INTERFACE_REVISION)
152 AC_SUBST(LIBGUILEREADLINE_INTERFACE_AGE)
153 AC_SUBST(LIBGUILEREADLINE_INTERFACE)
155 AC_SUBST(GUILE_EFFECTIVE_VERSION)
157 AC_CONFIG_FILES(Makefile ice-9/Makefile)