lac : 6349254c2683423252ea16357547773a05b39eeb
1: # readline.m4 serial 10
2: dnl Copyright (C) 2005-2006, 2009-2017 Free Software Foundation, Inc.
3: dnl This file is free software; the Free Software Foundation
4: dnl gives unlimited permission to copy and/or distribute it,
5: dnl with or without modifications, as long as this notice is preserved.
6:
7: dnl Written by Simon Josefsson, with help from Bruno Haible and Oskar
8: dnl Liljeblad.
9:
10: AC_DEFUN([gl_FUNC_READLINE],
11: [
12: dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
13: AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
14: AC_REQUIRE([AC_LIB_RPATH])
15:
16: dnl Search for libreadline and define LIBREADLINE, LTLIBREADLINE and
17: dnl INCREADLINE accordingly.
18: AC_LIB_LINKFLAGS_BODY([readline])
19:
20: dnl Add $INCREADLINE to CPPFLAGS before performing the following checks,
21: dnl because if the user has installed libreadline and not disabled its use
22: dnl via --without-libreadline-prefix, he wants to use it. The AC_LINK_IFELSE
23: dnl will then succeed.
24: am_save_CPPFLAGS="$CPPFLAGS"
25: AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCREADLINE])
26:
27: AC_CACHE_CHECK([for readline], [gl_cv_lib_readline], [
28: gl_cv_lib_readline=no
29: am_save_LIBS="$LIBS"
30: dnl On some systems, -lreadline doesn't link without an additional
31: dnl -lncurses or -ltermcap.
32: dnl Try -lncurses before -ltermcap, because libtermcap is insecure
33: dnl by design and obsolete since 1994. Try -lcurses last, because
34: dnl libcurses is unusable on some old Unices.
35: for extra_lib in "" ncurses termcap curses; do
36: LIBS="$am_save_LIBS $LIBREADLINE"
37: if test -n "$extra_lib"; then
38: LIBS="$LIBS -l$extra_lib"
39: fi
40: AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>
41: #include <readline/readline.h>]],
42: [[readline((char*)0);]])],
43: [if test -n "$extra_lib"; then
44: gl_cv_lib_readline="yes, requires -l$extra_lib"
45: else
46: gl_cv_lib_readline="yes"
47: fi
48: ])
49: if test "$gl_cv_lib_readline" != no; then
50: break
51: fi
52: done
53: LIBS="$am_save_LIBS"
54: ])
55:
56: if test "$gl_cv_lib_readline" != no; then
57: AC_DEFINE([HAVE_READLINE], [1], [Define if you have the readline library.])
58: extra_lib=`echo "$gl_cv_lib_readline" | sed -n -e 's/yes, requires //p'`
59: if test -n "$extra_lib"; then
60: LIBREADLINE="$LIBREADLINE $extra_lib"
61: LTLIBREADLINE="$LTLIBREADLINE $extra_lib"
62: fi
63: AC_MSG_CHECKING([how to link with libreadline])
64: AC_MSG_RESULT([$LIBREADLINE])
65: else
66: dnl If $LIBREADLINE didn't lead to a usable library, we don't
67: dnl need $INCREADLINE either.
68: CPPFLAGS="$am_save_CPPFLAGS"
69: LIBREADLINE=
70: LTLIBREADLINE=
71: fi
72: AC_SUBST([LIBREADLINE])
73: AC_SUBST([LTLIBREADLINE])
74:
75: AC_CHECK_HEADERS([readline/readline.h readline/history.h])
76: ])
77:
78: # Prerequisites of lib/readline.c.
79: AC_DEFUN([gl_PREREQ_READLINE], [
80: :
81: ])
Generated by git2html.