configure.in 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. AC_PREREQ(2.50)
  2. dnl Don't use "echo -n", which is not portable (e.g., not available on
  3. dnl MacOS X). Instead, use `patsubst' to remove the newline.
  4. AC_INIT(guile-readline,
  5. patsubst(m4_esyscmd(. ../GUILE-VERSION && echo ${GUILE_VERSION}), [
  6. ]),
  7. [bug-guile@gnu.org])
  8. AC_CONFIG_AUX_DIR([.])
  9. AC_CONFIG_SRCDIR(readline.c)
  10. AM_CONFIG_HEADER([guile-readline-config.h])
  11. AM_INIT_AUTOMAKE([foreign no-define])
  12. . $srcdir/../GUILE-VERSION
  13. AC_PROG_INSTALL
  14. AC_PROG_CC
  15. AM_PROG_CC_STDC
  16. AC_LIBTOOL_WIN32_DLL
  17. AC_PROG_LIBTOOL
  18. dnl
  19. dnl Check for Winsock and other functionality on Win32 (*not* CygWin)
  20. dnl
  21. AC_CYGWIN
  22. AC_MINGW32
  23. EXTRA_DEFS=""
  24. if test "$MINGW32" = "yes" ; then
  25. if test $enable_shared = yes ; then
  26. EXTRA_DEFS="-DSCM_IMPORT"
  27. fi
  28. fi
  29. AC_SUBST(EXTRA_DEFS)
  30. for termlib in ncurses curses termcap terminfo termlib ; do
  31. AC_CHECK_LIB(${termlib}, tgoto,
  32. [LIBS="-l${termlib} $LIBS"; break])
  33. done
  34. AC_CHECK_LIB(readline, readline)
  35. if test $ac_cv_lib_readline_readline = no; then
  36. AC_MSG_WARN([libreadline was not found on your system.])
  37. fi
  38. AC_CHECK_FUNCS(siginterrupt rl_clear_signals rl_cleanup_after_signal)
  39. dnl Check for modern readline naming
  40. AC_CHECK_FUNCS(rl_filename_completion_function)
  41. dnl Check for rl_get_keymap. We only use this for deciding whether to
  42. dnl install paren matching on the Guile command line (when using
  43. dnl readline for input), so it's completely optional.
  44. AC_CHECK_FUNCS(rl_get_keymap)
  45. dnl Check for rl_pre_input_hook. This is more complicated because on
  46. dnl some systems (HP/UX), the linker wont let us treat
  47. dnl rl_pre_input_hook as a function when it really is a function
  48. dnl pointer.
  49. AC_MSG_CHECKING([for rl_pre_input_hook])
  50. AC_CACHE_VAL(ac_cv_var_rl_pre_input_hook,
  51. [AC_TRY_LINK([
  52. #include <stdio.h>
  53. #include <readline/readline.h>
  54. ], [
  55. rl_pre_input_hook = 0;
  56. ],
  57. ac_cv_var_rl_pre_input_hook=yes,
  58. ac_cv_var_rl_pre_input_hook=no)])
  59. AC_MSG_RESULT($ac_cv_var_rl_pre_input_hook)
  60. if test $ac_cv_var_rl_pre_input_hook = yes; then
  61. AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK,1,
  62. [Define if rl_pre_input_hook is available.])
  63. fi
  64. AC_MSG_CHECKING(if readline clears SA_RESTART flag for SIGWINCH)
  65. AC_CACHE_VAL(guile_cv_sigwinch_sa_restart_cleared,
  66. AC_TRY_RUN([#include <signal.h>
  67. #include <stdio.h>
  68. #include <readline/readline.h>
  69. int
  70. hook ()
  71. {
  72. struct sigaction action;
  73. sigaction (SIGWINCH, NULL, &action);
  74. rl_cleanup_after_signal();
  75. /* exit with 0 if readline disabled SA_RESTART */
  76. exit (action.sa_flags & SA_RESTART);
  77. }
  78. int
  79. main ()
  80. {
  81. struct sigaction action;
  82. sigaction (SIGWINCH, NULL, &action);
  83. action.sa_flags |= SA_RESTART;
  84. sigaction (SIGWINCH, &action, NULL);
  85. /* Give readline something to read. Otherwise, it might hang, for
  86. example when run as a background process with job control.
  87. */
  88. rl_instream = fopen ("/dev/null", "r");
  89. if (rl_instream == NULL)
  90. {
  91. perror ("/dev/null");
  92. exit (1);
  93. }
  94. rl_pre_input_hook = hook;
  95. readline ("");
  96. }],
  97. guile_cv_sigwinch_sa_restart_cleared=yes,
  98. guile_cv_sigwinch_sa_restart_cleared=no,
  99. guile_cv_sigwinch_sa_restart_cleared=yes))
  100. AC_MSG_RESULT($guile_cv_sigwinch_sa_restart_cleared)
  101. if test $guile_cv_sigwinch_sa_restart_cleared = yes; then
  102. AC_DEFINE(GUILE_SIGWINCH_SA_RESTART_CLEARED, 1,
  103. [Define if readline disables SA_RESTART.])
  104. fi
  105. AC_CACHE_CHECK([for rl_getc_function pointer in readline],
  106. ac_cv_var_rl_getc_function,
  107. [AC_TRY_LINK([
  108. #include <stdio.h>
  109. #include <readline/readline.h>],
  110. [printf ("%ld", (long) rl_getc_function)],
  111. [ac_cv_var_rl_getc_function=yes],
  112. [ac_cv_var_rl_getc_function=no])])
  113. if test "${ac_cv_var_rl_getc_function}" = "yes"; then
  114. AC_DEFINE(HAVE_RL_GETC_FUNCTION, 1,
  115. [Define if your readline library has the rl_getc_function variable.])
  116. fi
  117. if test $ac_cv_lib_readline_readline = yes \
  118. -a $ac_cv_var_rl_getc_function = no; then
  119. AC_MSG_WARN([*** libreadline is too old on your system.])
  120. AC_MSG_WARN([*** You need readline version 2.1 or later.])
  121. fi
  122. AC_CHECK_FUNCS(strdup)
  123. . $srcdir/LIBGUILEREADLINE-VERSION
  124. AC_SUBST(LIBGUILEREADLINE_MAJOR)
  125. AC_SUBST(LIBGUILEREADLINE_INTERFACE_CURRENT)
  126. AC_SUBST(LIBGUILEREADLINE_INTERFACE_REVISION)
  127. AC_SUBST(LIBGUILEREADLINE_INTERFACE_AGE)
  128. AC_SUBST(LIBGUILEREADLINE_INTERFACE)
  129. AC_SUBST(GUILE_EFFECTIVE_VERSION)
  130. AC_CONFIG_FILES(Makefile ice-9/Makefile)
  131. AC_OUTPUT