summaryrefslogtreecommitdiff
path: root/guile-readline/configure.in
blob: 9098a31e6c63eb336d9bb8dea08788ffed0150f1 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
AC_PREREQ(2.50)

dnl Don't use "echo -n", which is not portable (e.g., not available on
dnl MacOS X).  Instead, use `patsubst' to remove the newline.
AC_INIT(guile-readline,
        patsubst(m4_esyscmd(. ../GUILE-VERSION && echo ${GUILE_VERSION}), [
]),
	[bug-guile@gnu.org])

AC_CONFIG_AUX_DIR([.])
AC_CONFIG_SRCDIR(readline.c)
AM_CONFIG_HEADER([guile-readline-config.h])
AM_INIT_AUTOMAKE([foreign no-define])

. $srcdir/../GUILE-VERSION

AC_PROG_INSTALL
AC_PROG_CC
AM_PROG_CC_STDC
AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL

dnl
dnl Check for Winsock and other functionality on Win32 (*not* CygWin)
dnl
AC_CYGWIN
AC_MINGW32
EXTRA_DEFS=""
if test "$MINGW32" = "yes" ; then
    if test $enable_shared = yes ; then
      EXTRA_DEFS="-DSCM_IMPORT"
    fi
fi
AC_SUBST(EXTRA_DEFS)

for termlib in ncurses curses termcap terminfo termlib ; do
   AC_CHECK_LIB(${termlib}, tgoto,
                [LIBS="-l${termlib} $LIBS"; break])
done

AC_CHECK_LIB(readline, readline)
if test $ac_cv_lib_readline_readline = no; then
  AC_MSG_WARN([libreadline was not found on your system.])
fi

AC_CHECK_FUNCS(siginterrupt rl_clear_signals rl_cleanup_after_signal)

dnl Check for modern readline naming
AC_CHECK_FUNCS(rl_filename_completion_function)

dnl Check for rl_get_keymap.  We only use this for deciding whether to
dnl install paren matching on the Guile command line (when using
dnl readline for input), so it's completely optional.
AC_CHECK_FUNCS(rl_get_keymap)

dnl Check for rl_pre_input_hook.  This is more complicated because on
dnl some systems (HP/UX), the linker wont let us treat
dnl rl_pre_input_hook as a function when it really is a function
dnl pointer.

AC_MSG_CHECKING([for rl_pre_input_hook])
AC_CACHE_VAL(ac_cv_var_rl_pre_input_hook,
[AC_TRY_LINK([
#include <stdio.h>
#include <readline/readline.h>
], [
rl_pre_input_hook = 0;
],
ac_cv_var_rl_pre_input_hook=yes,
ac_cv_var_rl_pre_input_hook=no)])
AC_MSG_RESULT($ac_cv_var_rl_pre_input_hook)
if test $ac_cv_var_rl_pre_input_hook = yes; then
  AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK,1,
            [Define if rl_pre_input_hook is available.])
fi


AC_MSG_CHECKING(if readline clears SA_RESTART flag for SIGWINCH)
AC_CACHE_VAL(guile_cv_sigwinch_sa_restart_cleared,
AC_TRY_RUN([#include <signal.h>
#include <stdio.h>
#include <readline/readline.h>

int
hook ()
{
  struct sigaction action;

  sigaction (SIGWINCH, NULL, &action);
  rl_cleanup_after_signal();

  /* exit with 0 if readline disabled SA_RESTART */
  exit (action.sa_flags & SA_RESTART);
}

int
main ()
{
  struct sigaction action;

  sigaction (SIGWINCH, NULL, &action);
  action.sa_flags |= SA_RESTART;
  sigaction (SIGWINCH, &action, NULL);

  /* Give readline something to read.  Otherwise, it might hang, for
     example when run as a background process with job control.
  */
  rl_instream = fopen ("/dev/null", "r");
  if (rl_instream == NULL)
    {
      perror ("/dev/null");
      exit (1);
    }

  rl_pre_input_hook = hook;
  readline ("");
}],
guile_cv_sigwinch_sa_restart_cleared=yes,
guile_cv_sigwinch_sa_restart_cleared=no,
guile_cv_sigwinch_sa_restart_cleared=yes))
AC_MSG_RESULT($guile_cv_sigwinch_sa_restart_cleared)
if test $guile_cv_sigwinch_sa_restart_cleared = yes; then
  AC_DEFINE(GUILE_SIGWINCH_SA_RESTART_CLEARED, 1,
    [Define if readline disables SA_RESTART.])
fi

AC_CACHE_CHECK([for rl_getc_function pointer in readline],
		 ac_cv_var_rl_getc_function,
		 [AC_TRY_LINK([
#include <stdio.h>
#include <readline/readline.h>],
			      [printf ("%ld", (long) rl_getc_function)],
			      [ac_cv_var_rl_getc_function=yes],
			      [ac_cv_var_rl_getc_function=no])])
if test "${ac_cv_var_rl_getc_function}" = "yes"; then
  AC_DEFINE(HAVE_RL_GETC_FUNCTION, 1,
    [Define if your readline library has the rl_getc_function variable.])
fi

if test $ac_cv_lib_readline_readline = yes \
        -a $ac_cv_var_rl_getc_function = no; then
  AC_MSG_WARN([*** libreadline is too old on your system.])
  AC_MSG_WARN([*** You need readline version 2.1 or later.])
fi

AC_CHECK_FUNCS(strdup)

. $srcdir/LIBGUILEREADLINE-VERSION
AC_SUBST(LIBGUILEREADLINE_MAJOR)
AC_SUBST(LIBGUILEREADLINE_INTERFACE_CURRENT)
AC_SUBST(LIBGUILEREADLINE_INTERFACE_REVISION)
AC_SUBST(LIBGUILEREADLINE_INTERFACE_AGE)
AC_SUBST(LIBGUILEREADLINE_INTERFACE)

AC_SUBST(GUILE_EFFECTIVE_VERSION)

AC_CONFIG_FILES(Makefile ice-9/Makefile)
AC_OUTPUT