~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to m4/pandora_have_libreadline.m4

pandora-build v0.72 - Moved remaining hard-coded tests into pandora-build
macros.
Add PANDORA_DRIZZLE_BUILD to run the extra checks that drizzle needs that 
plugins would also need to run so we can just use that macro in generated
external plugin builds.
Added support to register_plugins for external plugin building.
Renamed register_plugins.py to pandora-plugin.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
##### http://autoconf-archive.cryp.to/vl_lib_readline.html
2
1
#
3
2
# SYNOPSIS
4
3
#
5
 
#   VL_LIB_READLINE
 
4
#   PANDORA_HAVE_LIBREADLINE
6
5
#
7
6
# DESCRIPTION
8
7
#
51
50
#
52
51
# LAST MODIFICATION
53
52
#
54
 
#   2002-04-04
 
53
#   2009-11-17
 
54
#
 
55
# Based on VL_LIB_READLINE from  Ville Laurikari
55
56
#
56
57
# COPYLEFT
57
58
#
 
59
#   Copyright (c) 2009 Monty Taylor
58
60
#   Copyright (c) 2002 Ville Laurikari <vl@iki.fi>
59
61
#
60
62
#   Copying and distribution of this file, with or without
61
63
#   modification, are permitted in any medium without royalty provided
62
64
#   the copyright notice and this notice are preserved.
63
65
 
64
 
AC_DEFUN([VL_LIB_READLINE], [
 
66
AC_DEFUN([PANDORA_CHECK_TIOCGWINSZ],[
 
67
  AC_CACHE_CHECK([for TIOCGWINSZ in sys/ioctl.h],
 
68
    [pandora_cv_tiocgwinsz_in_ioctl],[
 
69
    AC_COMPILE_IFELSE([
 
70
      AC_LANG_PROGRAM([[
 
71
#include <sys/types.h>
 
72
#include <sys/ioctl.h>
 
73
      ]],[[
 
74
int x= TIOCGWINSZ;
 
75
      ]])
 
76
    ],[
 
77
      pandora_cv_tiocgwinsz_in_ioctl=yes
 
78
    ],[
 
79
      pandora_cv_tiocgwinsz_in_ioctl=no
 
80
    ])
 
81
  ])
 
82
  AS_IF([test "$pandora_cv_tiocgwinsz_in_ioctl" = "yes"],[   
 
83
    AC_DEFINE([GWINSZ_IN_SYS_IOCTL], [1],
 
84
              [READLINE: your system defines TIOCGWINSZ in sys/ioctl.h.])
 
85
  ])
 
86
])
 
87
 
 
88
AC_DEFUN([PANDORA_CHECK_RL_COMPENTRY], [
 
89
  AC_CACHE_CHECK([defined rl_compentry_func_t], [pandora_cv_rl_compentry],[
 
90
    AC_COMPILE_IFELSE([
 
91
      AC_LANG_PROGRAM([[
 
92
#include "stdio.h"
 
93
#include "readline/readline.h"
 
94
      ]],[[
 
95
rl_compentry_func_t *func2= (rl_compentry_func_t*)0;
 
96
      ]])
 
97
    ],[
 
98
      pandora_cv_rl_compentry=yes
 
99
    ],[
 
100
      pandora_cv_rl_compentry=no
 
101
    ])
 
102
  ])
 
103
  AS_IF([test "$pandora_cv_rl_compentry" = "yes"],[
 
104
    AC_DEFINE([HAVE_RL_COMPENTRY], [1],
 
105
              [Does system provide rl_compentry_func_t])
 
106
  ])
 
107
 
 
108
  AC_LANG_PUSH(C++)
 
109
  save_CXXFLAGS="${CXXFLAGS}"
 
110
  CXXFLAGS="${AM_CXXFLAGS} ${CXXFLAGS}"
 
111
  AC_CACHE_CHECK([rl_compentry_func_t works], [pandora_cv_rl_compentry_works],[
 
112
    AC_COMPILE_IFELSE([
 
113
      AC_LANG_PROGRAM([[
 
114
#include "stdio.h"
 
115
#include "readline/readline.h"
 
116
      ]],[[
 
117
rl_completion_entry_function= (rl_compentry_func_t*)NULL;
 
118
      ]])
 
119
    ],[
 
120
      pandora_cv_rl_compentry_works=yes
 
121
    ],[
 
122
      pandora_cv_rl_compentry_works=no
 
123
    ])
 
124
  ])
 
125
  AS_IF([test "$pandora_cv_rl_compentry_works" = "yes"],[
 
126
    AC_DEFINE([HAVE_WORKING_RL_COMPENTRY], [1],
 
127
              [Does system provide an rl_compentry_func_t that is usable])
 
128
  ])
 
129
  CXXFLAGS="${save_CXXFLAGS}"
 
130
  AC_LANG_POP()
 
131
])
 
132
 
 
133
 
 
134
AC_DEFUN([PANDORA_CHECK_RL_COMPLETION_FUNC], [
 
135
  AC_CACHE_CHECK([defined rl_completion_func_t], [pandora_cv_rl_completion],[
 
136
    AC_COMPILE_IFELSE([
 
137
      AC_LANG_PROGRAM([[
 
138
#include "stdio.h"
 
139
#include "readline/readline.h"
 
140
      ]],[[
 
141
rl_completion_func_t *func1= (rl_completion_func_t*)0;
 
142
      ]])
 
143
    ],[
 
144
      pandora_cv_rl_completion=yes
 
145
    ],[
 
146
      pandora_cv_rl_completion=no
 
147
    ])
 
148
  ])
 
149
  AS_IF([test "$pandora_cv_rl_completion" = "yes"],[
 
150
    AC_DEFINE([HAVE_RL_COMPLETION], [1],
 
151
              [Does system provide rl_completion_func_t])
 
152
  ])
 
153
])
 
154
 
 
155
AC_DEFUN([_PANDORA_SEARCH_LIBREADLINE], [
 
156
 
 
157
  save_LIBS="${LIBS}"
 
158
  LIBS=""
 
159
 
65
160
  AC_CACHE_CHECK([for a readline compatible library],
66
 
                 vl_cv_lib_readline, [
 
161
                 ac_cv_libreadline, [
67
162
    ORIG_LIBS="$LIBS"
68
163
    for readline_lib in readline edit editline; do
69
164
      for termcap_lib in "" termcap curses ncurses; do
73
168
          TRY_LIB="-l$readline_lib -l$termcap_lib"
74
169
        fi
75
170
        LIBS="$ORIG_LIBS $TRY_LIB"
76
 
        AC_TRY_LINK_FUNC(readline, vl_cv_lib_readline="$TRY_LIB")
77
 
        if test -n "$vl_cv_lib_readline"; then
 
171
        AC_TRY_LINK_FUNC(readline, ac_cv_libreadline="$TRY_LIB")
 
172
        if test -n "$ac_cv_libreadline"; then
78
173
          break
79
174
        fi
80
175
      done
81
 
      if test -n "$vl_cv_lib_readline"; then
 
176
      if test -n "$ac_cv_libreadline"; then
82
177
        break
83
178
      fi
84
179
    done
85
 
    if test -z "$vl_cv_lib_readline"; then
86
 
      vl_cv_lib_readline="no"
 
180
    if test -z "$ac_cv_libreadline"; then
 
181
      ac_cv_libreadline="no"
87
182
      LIBS="$ORIG_LIBS"
88
183
    fi
89
184
  ])
90
185
 
91
 
  if test "$vl_cv_lib_readline" != "no"; then
 
186
  if test "$ac_cv_libreadline" != "no"; then
92
187
    AC_DEFINE(HAVE_LIBREADLINE, 1,
93
188
              [Define if you have a readline compatible library])
94
189
    AC_CHECK_HEADERS(readline.h readline/readline.h)
95
190
    AC_CACHE_CHECK([whether readline supports history],
96
 
                   vl_cv_lib_readline_history, [
97
 
      vl_cv_lib_readline_history="no"
98
 
      AC_TRY_LINK_FUNC(add_history, vl_cv_lib_readline_history="yes")
 
191
                   ac_cv_libreadline_history, [
 
192
      ac_cv_libreadline_history="no"
 
193
      AC_TRY_LINK_FUNC(add_history, ac_cv_libreadline_history="yes")
99
194
    ])
100
 
    if test "$vl_cv_lib_readline_history" = "yes"; then
 
195
    if test "$ac_cv_libreadline_history" = "yes"; then
101
196
      AC_DEFINE(HAVE_READLINE_HISTORY, 1,
102
197
                [Define if your readline library has \`add_history'])
103
198
      AC_CHECK_HEADERS(history.h readline/history.h)
104
199
    fi
105
200
  fi
106
 
])dnl
 
201
  PANDORA_CHECK_RL_COMPENTRY  
 
202
  PANDORA_CHECK_RL_COMPLETION_FUNC
 
203
  PANDORA_CHECK_TIOCGWINSZ
 
204
 
 
205
 
 
206
  READLINE_LIBS="${LIBS}"
 
207
  LIBS="${save_LIBS}"
 
208
  AC_SUBST(READLINE_LIBS)
 
209
 
 
210
  AM_CONDITIONAL(HAVE_LIBREADLINE, [test "x${ac_cv_libreadline}" = "xyes"])
 
211
])
 
212
 
 
213
AC_DEFUN([_PANDORA_HAVE_LIBREADLINE],[
 
214
 
 
215
  AC_ARG_ENABLE([libreadline],
 
216
    [AS_HELP_STRING([--disable-libreadline],
 
217
      [Build with libreadline support @<:@default=on@:>@])],
 
218
    [ac_enable_libreadline="$enableval"],
 
219
    [ac_enable_libreadline="yes"])
 
220
 
 
221
  _PANDORA_SEARCH_LIBREADLINE
 
222
])
 
223
 
 
224
 
 
225
AC_DEFUN([PANDORA_HAVE_LIBREADLINE],[
 
226
  AC_REQUIRE([_PANDORA_HAVE_LIBREADLINE])
 
227
])
 
228
 
 
229
AC_DEFUN([_PANDORA_REQUIRE_LIBREADLINE],[
 
230
  ac_enable_libreadline="yes"
 
231
  _PANDORA_SEARCH_LIBREADLINE
 
232
 
 
233
  AS_IF([test "x$ac_cv_libreadline" = "xno"],
 
234
    AC_MSG_ERROR([libreadline is required for ${PACKAGE}. On Debian this can be found in libreadline5-dev. On RedHat this can be found in readline-devel.]))
 
235
 
 
236
])
 
237
 
 
238
AC_DEFUN([PANDORA_REQUIRE_LIBREADLINE],[
 
239
  AC_REQUIRE([_PANDORA_REQUIRE_LIBREADLINE])
 
240
])
 
241
 
 
242