~ubuntu-branches/ubuntu/lucid/autoconf-archive/lucid

« back to all changes in this revision

Viewing changes to html/ac_lib_readline.html

  • Committer: Bazaar Package Importer
  • Author(s): Deng Xiyue
  • Date: 2009-05-12 17:30:18 UTC
  • mfrom: (1.1.9 upstream) (3.1.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090512173018-s7y88nfoxpaauztk
Tags: 20090426-1
* New upstream release.
* Update Standard-Version to 3.8.1:
  + List original Debianizer.
  + Point to versioned license file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
2
 
"http://www.w3.org/TR/html4/strict.dtd">
3
 
<html lang="en">
4
 
 <head>
5
 
  <title>
6
 
   Autoconf Macro: ac_lib_readline
7
 
  </title>
8
 
  <link rel="stylesheet" type="text/css" href="autoconf-archive.css">
9
 
 </head>
10
 
 <body>
11
 
  <table summary="web navigation" style="width:100%;">
12
 
   <tbody>
13
 
    <tr>
14
 
     <td style="width:25%;" align="center" valign="top">
15
 
      <a href="http://autoconf-archive.cryp.to/ac_lib_readline.m4">Download M4
16
 
      Source</a>
17
 
     </td>
18
 
     <td style="width:25%;" align="center" valign="top">
19
 
      <a href=
20
 
      "http://git.cryp.to/autoconf-archive?a=history;f=ac_lib_readline.m4">Macro
21
 
      History</a>
22
 
     </td>
23
 
     <td style="width:25%;" align="center" valign="top">
24
 
      <a href="macros-by-category.html">Category Index</a>
25
 
     </td>
26
 
     <td style="width:25%;" align="center" valign="top">
27
 
      <form method="get" action="http://www.google.com/search">
28
 
       <div>
29
 
        <input name="sitesearch" value="autoconf-archive.cryp.to" type=
30
 
        "hidden"><a href="http://www.google.com/">Search</a>: <input name="q"
31
 
        size="10" maxlength="255" type="text">
32
 
       </div>
33
 
      </form>
34
 
     </td>
35
 
    </tr>
36
 
   </tbody>
37
 
  </table>
38
 
  <hr>
39
 
  <h1>
40
 
   ac_lib_readline
41
 
  </h1>
42
 
  <h2>
43
 
   Obsolete Macro
44
 
  </h2>
45
 
  <p class="indent">
46
 
   Renamed to <a href="vl_lib_readline.html">VL_LIB_READLINE</a>.
47
 
  </p>
48
 
  <h2>
49
 
   Synopsis
50
 
  </h2>
51
 
  <p class="indent" style="white-space:nowrap;">
52
 
   <code>AC_LIB_READLINE</code>
53
 
  </p>
54
 
  <h2>
55
 
   Description
56
 
  </h2>
57
 
  <div class="indent">
58
 
   <p>
59
 
    Searches for a readline compatible library. If found, defines
60
 
    `HAVE_LIBREADLINE'. If the found library has the `add_history' function,
61
 
    sets also `HAVE_READLINE_HISTORY'. Also checks for the locations of the
62
 
    necessary include files and sets `HAVE_READLINE_H' or
63
 
    `HAVE_READLINE_READLINE_H' and `HAVE_READLINE_HISTORY_H' or
64
 
    'HAVE_HISTORY_H' if the corresponding include files exists.
65
 
   </p>
66
 
   <p>
67
 
    The libraries that may be readline compatible are `libedit', `libeditline'
68
 
    and `libreadline'. Sometimes we need to link a termcap library for readline
69
 
    to work, this macro tests these cases too by trying to link with
70
 
    `libtermcap', `libcurses' or `libncurses' before giving up.
71
 
   </p>
72
 
   <p>
73
 
    Here is an example of how to use the information provided by this macro to
74
 
    perform the necessary includes or declarations in a C file:
75
 
   </p>
76
 
   <pre>
77
 
  #include &lt;config.h&gt;
78
 
 
79
 
  #ifdef HAVE_LIBREADLINE
80
 
  #if defined(HAVE_READLINE_READLINE_H)
81
 
  #include &lt;readline/readline.h&gt;
82
 
  #elif defined(HAVE_READLINE_H)
83
 
  #include &lt;readline.h&gt;
84
 
  #else /* !defined(HAVE_READLINE_H) */
85
 
  extern char *readline ();
86
 
  #endif /* !defined(HAVE_READLINE_H) */
87
 
  char *cmdline = NULL;
88
 
  #else /* !defined(HAVE_READLINE_READLINE_H) */
89
 
    /* no readline */
90
 
  #endif /* HAVE_LIBREADLINE */
91
 
 
92
 
  #ifdef HAVE_READLINE_HISTORY
93
 
  #if defined(HAVE_READLINE_HISTORY_H)
94
 
  #include &lt;readline/history.h&gt;
95
 
  #elif defined(HAVE_HISTORY_H)
96
 
  #include &lt;history.h&gt;
97
 
  #else /* !defined(HAVE_HISTORY_H) */
98
 
  extern void add_history ();
99
 
  extern int write_history ();
100
 
  extern int read_history ();
101
 
  #endif /* defined(HAVE_READLINE_HISTORY_H) */
102
 
    /* no history */
103
 
  #endif /* HAVE_READLINE_HISTORY */
104
 
</pre>
105
 
  </div>
106
 
  <h2>
107
 
   Author
108
 
  </h2>
109
 
  <p class="indent">
110
 
   Ville Laurikari &lt;vl@iki.fi&gt;
111
 
  </p>
112
 
  <h2>
113
 
   Last Modified
114
 
  </h2>
115
 
  <p class="indent">
116
 
   2008-04-12
117
 
  </p>
118
 
  <h2>
119
 
   M4 Source Code
120
 
  </h2>
121
 
  <div class="indent">
122
 
   <pre class="m4source">
123
 
AC_DEFUN([AC_LIB_READLINE], [
124
 
  AC_CACHE_CHECK([for a readline compatible library],
125
 
                 ac_cv_lib_readline, [
126
 
    ORIG_LIBS=$LIBS
127
 
    for readline_lib in readline edit editline; do
128
 
      for termcap_lib in "" termcap curses ncurses; do
129
 
        if test -z "$termcap_lib"; then
130
 
          TRY_LIB="-l$readline_lib"
131
 
        else
132
 
          TRY_LIB="-l$readline_lib -l$termcap_lib"
133
 
        fi
134
 
        LIBS="$ORIG_LIBS $TRY_LIB"
135
 
        AC_TRY_LINK_FUNC(readline, ac_cv_lib_readline="$TRY_LIB")
136
 
        if test -n "$ac_cv_lib_readline"; then
137
 
          break
138
 
        fi
139
 
      done
140
 
      if test -n "$ac_cv_lib_readline"; then
141
 
        break
142
 
      fi
143
 
    done
144
 
    if test -z "$ac_cv_lib_readline"; then
145
 
      ac_cv_lib_readline="no"
146
 
      LIBS=$ORIG_LIBS
147
 
    fi
148
 
  ])
149
 
 
150
 
  if test "$ac_cv_lib_readline" != "no"; then
151
 
    AC_DEFINE(HAVE_LIBREADLINE, 1,
152
 
              [Define if you have a readline compatible library])
153
 
    AC_CHECK_HEADERS(readline.h readline/readline.h)
154
 
    AC_CACHE_CHECK([whether readline supports history],
155
 
                   ac_cv_lib_readline_history, [
156
 
      ac_cv_lib_readline_history="no"
157
 
      AC_TRY_LINK_FUNC(add_history, ac_cv_lib_readline_history="yes")
158
 
    ])
159
 
    if test "$ac_cv_lib_readline_history" = "yes"; then
160
 
      AC_DEFINE(HAVE_READLINE_HISTORY, 1,
161
 
                [Define if your readline library has \`add_history'])
162
 
      AC_CHECK_HEADERS(history.h readline/history.h)
163
 
    fi
164
 
  fi
165
 
])
166
 
</pre>
167
 
  </div>
168
 
  <h2>
169
 
   License
170
 
  </h2>
171
 
  <div class="indent">
172
 
   <span style="white-space:nowrap;">Copyright &copy; 2008 Ville Laurikari
173
 
   &lt;vl@iki.fi&gt;</span>
174
 
   <p>
175
 
    This program is free software: you can redistribute it and/or modify it
176
 
    under the terms of the GNU General Public License as published by the Free
177
 
    Software Foundation, either version 3 of the License, or (at your option)
178
 
    any later version.
179
 
   </p>
180
 
   <p>
181
 
    This program is distributed in the hope that it will be useful, but WITHOUT
182
 
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
183
 
    FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
184
 
    more details.
185
 
   </p>
186
 
   <p>
187
 
    You should have received a copy of the GNU General Public License along
188
 
    with this program. If not, see &lt;<a href=
189
 
    "http://www.gnu.org/licenses/">http://www.gnu.org/licenses/</a>&gt;.
190
 
   </p>
191
 
   <p>
192
 
    As a special exception, the respective Autoconf Macro's copyright owner
193
 
    gives unlimited permission to copy, distribute and modify the configure
194
 
    scripts that are the output of Autoconf when processing the Macro. You need
195
 
    not follow the terms of the GNU General Public License when using or
196
 
    distributing such scripts, even though portions of the text of the Macro
197
 
    appear in them. The GNU General Public License (GPL) does govern all other
198
 
    use of the material that constitutes the Autoconf Macro.
199
 
   </p>
200
 
   <p>
201
 
    This special exception to the GPL applies to versions of the Autoconf Macro
202
 
    released by the Autoconf Macro Archive. When you make and distribute a
203
 
    modified version of the Autoconf Macro, you may extend this special
204
 
    exception to the GPL to apply to your modified version as well.
205
 
   </p>
206
 
  </div>
207
 
 </body>
208
 
</html>