Debian Codegraph @

m4/ax_with_curses.m4

raw
1 # ===========================================================================
2 # http://www.gnu.org/software/autoconf-archive/ax_with_curses.html
3 # ===========================================================================
4 #
5 # SYNOPSIS
6 #
7 # AX_WITH_CURSES
8 #
9 # DESCRIPTION
10 #
11 # This macro checks whether a SysV or X/Open-compatible Curses library is
12 # present, along with the associated header file. The NcursesW
13 # (wide-character) library is searched for first, followed by Ncurses,
14 # then the system-default plain Curses. The first library found is the
15 # one returned.
16 #
17 # The following options are understood: --with-ncursesw, --with-ncurses,
18 # --without-ncursesw, --without-ncurses. The "--with" options force the
19 # macro to use that particular library, terminating with an error if not
20 # found. The "--without" options simply skip the check for that library.
21 # The effect on the search pattern is:
22 #
23 # (no options) - NcursesW, Ncurses, Curses
24 # --with-ncurses --with-ncursesw - NcursesW only [*]
25 # --without-ncurses --with-ncursesw - NcursesW only [*]
26 # --with-ncursesw - NcursesW only [*]
27 # --with-ncurses --without-ncursesw - Ncurses only [*]
28 # --with-ncurses - NcursesW, Ncurses [**]
29 # --without-ncurses --without-ncursesw - Curses only
30 # --without-ncursesw - Ncurses, Curses
31 # --without-ncurses - NcursesW, Curses
32 #
33 # [*] If the library is not found, abort the configure script.
34 #
35 # [**] If the second library (Ncurses) is not found, abort configure.
36 #
37 # The following preprocessor symbols may be defined by this macro if the
38 # appropriate conditions are met:
39 #
40 # HAVE_CURSES - if any SysV or X/Open Curses library found
41 # HAVE_CURSES_ENHANCED - if library supports X/Open Enhanced functions
42 # HAVE_CURSES_COLOR - if library supports color (enhanced functions)
43 # HAVE_CURSES_OBSOLETE - if library supports certain obsolete features
44 # HAVE_NCURSESW - if NcursesW (wide char) library is to be used
45 # HAVE_NCURSES - if the Ncurses library is to be used
46 #
47 # HAVE_CURSES_H - if <curses.h> is present and should be used
48 # HAVE_NCURSESW_H - if <ncursesw.h> should be used
49 # HAVE_NCURSES_H - if <ncurses.h> should be used
50 # HAVE_NCURSESW_CURSES_H - if <ncursesw/curses.h> should be used
51 # HAVE_NCURSES_CURSES_H - if <ncurses/curses.h> should be used
52 #
53 # (These preprocessor symbols are discussed later in this document.)
54 #
55 # The following output variable is defined by this macro; it is precious
56 # and may be overridden on the ./configure command line:
57 #
58 # CURSES_LIB - library to add to xxx_LDADD
59 #
60 # The library listed in CURSES_LIB is NOT added to LIBS by default. You
61 # need to add CURSES_LIB to the appropriate xxx_LDADD line in your
62 # Makefile.am. For example:
63 #
64 # prog_LDADD = @CURSES_LIB@
65 #
66 # If CURSES_LIB is set on the configure command line (such as by running
67 # "./configure CURSES_LIB=-lmycurses"), then the only header searched for
68 # is <curses.h>. The user may use the CPPFLAGS precious variable to
69 # override the standard #include search path. If the user needs to
70 # specify an alternative path for a library (such as for a non-standard
71 # NcurseW), the user should use the LDFLAGS variable.
72 #
73 # The following shell variables may be defined by this macro:
74 #
75 # ax_cv_curses - set to "yes" if any Curses library found
76 # ax_cv_curses_enhanced - set to "yes" if Enhanced functions present
77 # ax_cv_curses_color - set to "yes" if color functions present
78 # ax_cv_curses_obsolete - set to "yes" if obsolete features present
79 #
80 # ax_cv_ncursesw - set to "yes" if NcursesW library found
81 # ax_cv_ncurses - set to "yes" if Ncurses library found
82 # ax_cv_plaincurses - set to "yes" if plain Curses library found
83 # ax_cv_curses_which - set to "ncursesw", "ncurses", "plaincurses" or "no"
84 #
85 # These variables can be used in your configure.ac to determine the level
86 # of support you need from the Curses library. For example, if you must
87 # have either Ncurses or NcursesW, you could include:
88 #
89 # AX_WITH_CURSES
90 # if test "x$ax_cv_ncursesw" != xyes && test "x$ax_cv_ncurses" != xyes; then
91 # AX_MSG_ERROR([requires either NcursesW or Ncurses library])
92 # fi
93 #
94 # If any Curses library will do (but one must be present and must support
95 # color), you could use:
96 #
97 # AX_WITH_CURSES
98 # if test "x$ax_cv_curses" != xyes || test "x$ax_cv_curses_color" != xyes; then
99 # AC_MSG_ERROR([requires an X/Open-compatible Curses library with color])
100 # fi
101 #
102 # Certain preprocessor symbols and shell variables defined by this macro
103 # can be used to determine various features of the Curses library. In
104 # particular, HAVE_CURSES and ax_cv_curses are defined if the Curses
105 # library found conforms to the traditional SysV and/or X/Open Base Curses
106 # definition. Any working Curses library conforms to this level.
107 #
108 # HAVE_CURSES_ENHANCED and ax_cv_curses_enhanced are defined if the
109 # library supports the X/Open Enhanced Curses definition. In particular,
110 # the wide-character types attr_t, cchar_t and wint_t, the functions
111 # wattr_set() and wget_wch() and the macros WA_NORMAL and _XOPEN_CURSES
112 # are checked. The Ncurses library does NOT conform to this definition,
113 # although NcursesW does.
114 #
115 # HAVE_CURSES_COLOR and ax_cv_curses_color are defined if the library
116 # supports color functions and macros such as COLOR_PAIR, A_COLOR,
117 # COLOR_WHITE, COLOR_RED and init_pair(). These are NOT part of the
118 # X/Open Base Curses definition, but are part of the Enhanced set of
119 # functions. The Ncurses library DOES support these functions, as does
120 # NcursesW.
121 #
122 # HAVE_CURSES_OBSOLETE and ax_cv_curses_obsolete are defined if the
123 # library supports certain features present in SysV and BSD Curses but not
124 # defined in the X/Open definition. In particular, the functions
125 # getattrs(), getcurx() and getmaxx() are checked.
126 #
127 # To use the HAVE_xxx_H preprocessor symbols, insert the following into
128 # your system.h (or equivalent) header file:
129 #
130 # #if defined(HAVE_NCURSESW_CURSES_H)
131 # # include <ncursesw/curses.h>
132 # #elif defined(HAVE_NCURSESW_H)
133 # # include <ncursesw.h>
134 # #elif defined(HAVE_NCURSES_CURSES_H)
135 # # include <ncurses/curses.h>
136 # #elif defined(HAVE_NCURSES_H)
137 # # include <ncurses.h>
138 # #elif defined(HAVE_CURSES_H)
139 # # include <curses.h>
140 # #else
141 # # error "SysV or X/Open-compatible Curses header file required"
142 # #endif
143 #
144 # For previous users of this macro: you should not need to change anything
145 # in your configure.ac or Makefile.am, as the previous (serial 10)
146 # semantics are still valid. However, you should update your system.h (or
147 # equivalent) header file to the fragment shown above. You are encouraged
148 # also to make use of the extended functionality provided by this version
149 # of AX_WITH_CURSES, as well as in the additional macros
150 # AX_WITH_CURSES_PANEL, AX_WITH_CURSES_MENU and AX_WITH_CURSES_FORM.
151 #
152 # LICENSE
153 #
154 # Copyright (c) 2009 Mark Pulford <[email protected]>
155 # Copyright (c) 2009 Damian Pietras <[email protected]>
156 # Copyright (c) 2011 Reuben Thomas <[email protected]>
157 # Copyright (c) 2011 John Zaitseff <[email protected]>
158 #
159 # This program is free software: you can redistribute it and/or modify
160 # it under the terms of the GNU General Public License as published by
161 # the Free Software Foundation, either version 3 of the License, or
162 # (at your option) any later version.
163 #
164 # This program is distributed in the hope that it will be useful,
165 # but WITHOUT ANY WARRANTY; without even the implied warranty of
166 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
167 # GNU General Public License for more details.
168 # You should have received a copy of the GNU General Public License
169 # along with this program. If not, see <http://www.gnu.org/licenses/>.
170 #
171 # Parts of code have been taken from many other softwares.
172 # Thanks for the help.
173 #
174 # As a special exception, the respective Autoconf Macro's copyright owner
175 # gives unlimited permission to copy, distribute and modify the configure
176 # scripts that are the output of Autoconf when processing the Macro. You
177 # need not follow the terms of the GNU General Public License when using
178 # or distributing such scripts, even though portions of the text of the
179 # Macro appear in them. The GNU General Public License (GPL) does govern
180 # all other use of the material that constitutes the Autoconf Macro.
181 #
182 # This special exception to the GPL applies to versions of the Autoconf
183 # Macro released by the Autoconf Archive. When you make and distribute a
184 # modified version of the Autoconf Macro, you may extend this special
185 # exception to the GPL to apply to your modified version as well.
186
187 #serial 12
188
189 AU_ALIAS([MP_WITH_CURSES], [AX_WITH_CURSES])
190 AC_DEFUN([AX_WITH_CURSES], [
191 AC_ARG_VAR([CURSES_LIB], [linker library for Curses, e.g. -lcurses])
192 AC_ARG_WITH([ncurses], [AS_HELP_STRING([--with-ncurses],
193 [force the use of Ncurses or NcursesW])],
194 [], [with_ncurses=check])
195 AC_ARG_WITH([ncursesw], [AS_HELP_STRING([--without-ncursesw],
196 [do not use NcursesW (wide character support)])],
197 [], [with_ncursesw=check])
198
199 ax_saved_LIBS=$LIBS
200 AS_IF([test "x$with_ncurses" = xyes || test "x$with_ncursesw" = xyes],
201 [ax_with_plaincurses=no], [ax_with_plaincurses=check])
202
203 ax_cv_curses_which=no
204
205 # Test for NcursesW
206
207 AS_IF([test "x$CURSES_LIB" = x && test "x$with_ncursesw" != xno], [
208 LIBS="$ax_saved_LIBS -lncursesw"
209
210 AC_CACHE_CHECK([for NcursesW wide-character library], [ax_cv_ncursesw], [
211 AC_LINK_IFELSE([AC_LANG_CALL([], [initscr])],
212 [ax_cv_ncursesw=yes], [ax_cv_ncursesw=no])
213 ])
214 AS_IF([test "x$ax_cv_ncursesw" = xno && test "x$with_ncursesw" = xyes], [
215 AC_MSG_ERROR([--with-ncursesw specified but could not find NcursesW library])
216 ])
217
218 AS_IF([test "x$ax_cv_ncursesw" = xyes], [
219 ax_cv_curses=yes
220 ax_cv_curses_which=ncursesw
221 CURSES_LIB="-lncursesw"
222 AC_DEFINE([HAVE_NCURSESW], [1], [Define to 1 if the NcursesW library is present])
223 AC_DEFINE([HAVE_CURSES], [1], [Define to 1 if a SysV or X/Open compatible Curses library is present])
224
225 AC_CACHE_CHECK([for working ncursesw/curses.h], [ax_cv_header_ncursesw_curses_h], [
226 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
227 @%:@define _XOPEN_SOURCE_EXTENDED 1
228 @%:@include <ncursesw/curses.h>
229 ]], [[
230 chtype a = A_BOLD;
231 int b = KEY_LEFT;
232 chtype c = COLOR_PAIR(1) & A_COLOR;
233 attr_t d = WA_NORMAL;
234 cchar_t e;
235 wint_t f;
236 int g = getattrs(stdscr);
237 int h = getcurx(stdscr) + getmaxx(stdscr);
238 initscr();
239 init_pair(1, COLOR_WHITE, COLOR_RED);
240 wattr_set(stdscr, d, 0, NULL);
241 wget_wch(stdscr, &f);
242 ]])],
243 [ax_cv_header_ncursesw_curses_h=yes],
244 [ax_cv_header_ncursesw_curses_h=no])
245 ])
246 AS_IF([test "x$ax_cv_header_ncursesw_curses_h" = xyes], [
247 ax_cv_curses_enhanced=yes
248 ax_cv_curses_color=yes
249 ax_cv_curses_obsolete=yes
250 AC_DEFINE([HAVE_CURSES_ENHANCED], [1], [Define to 1 if library supports X/Open Enhanced functions])
251 AC_DEFINE([HAVE_CURSES_COLOR], [1], [Define to 1 if library supports color (enhanced functions)])
252 AC_DEFINE([HAVE_CURSES_OBSOLETE], [1], [Define to 1 if library supports certain obsolete features])
253 AC_DEFINE([HAVE_NCURSESW_CURSES_H], [1], [Define to 1 if <ncursesw/curses.h> is present])
254 ])
255
256 AC_CACHE_CHECK([for working ncursesw.h], [ax_cv_header_ncursesw_h], [
257 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
258 @%:@define _XOPEN_SOURCE_EXTENDED 1
259 @%:@include <ncursesw.h>
260 ]], [[
261 chtype a = A_BOLD;
262 int b = KEY_LEFT;
263 chtype c = COLOR_PAIR(1) & A_COLOR;
264 attr_t d = WA_NORMAL;
265 cchar_t e;
266 wint_t f;
267 int g = getattrs(stdscr);
268 int h = getcurx(stdscr) + getmaxx(stdscr);
269 initscr();
270 init_pair(1, COLOR_WHITE, COLOR_RED);
271 wattr_set(stdscr, d, 0, NULL);
272 wget_wch(stdscr, &f);
273 ]])],
274 [ax_cv_header_ncursesw_h=yes],
275 [ax_cv_header_ncursesw_h=no])
276 ])
277 AS_IF([test "x$ax_cv_header_ncursesw_h" = xyes], [
278 ax_cv_curses_enhanced=yes
279 ax_cv_curses_color=yes
280 ax_cv_curses_obsolete=yes
281 AC_DEFINE([HAVE_CURSES_ENHANCED], [1], [Define to 1 if library supports X/Open Enhanced functions])
282 AC_DEFINE([HAVE_CURSES_COLOR], [1], [Define to 1 if library supports color (enhanced functions)])
283 AC_DEFINE([HAVE_CURSES_OBSOLETE], [1], [Define to 1 if library supports certain obsolete features])
284 AC_DEFINE([HAVE_NCURSESW_H], [1], [Define to 1 if <ncursesw.h> is present])
285 ])
286
287 AC_CACHE_CHECK([for working ncurses.h], [ax_cv_header_ncurses_h_with_ncursesw], [
288 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
289 @%:@define _XOPEN_SOURCE_EXTENDED 1
290 @%:@include <ncurses.h>
291 ]], [[
292 chtype a = A_BOLD;
293 int b = KEY_LEFT;
294 chtype c = COLOR_PAIR(1) & A_COLOR;
295 attr_t d = WA_NORMAL;
296 cchar_t e;
297 wint_t f;
298 int g = getattrs(stdscr);
299 int h = getcurx(stdscr) + getmaxx(stdscr);
300 initscr();
301 init_pair(1, COLOR_WHITE, COLOR_RED);
302 wattr_set(stdscr, d, 0, NULL);
303 wget_wch(stdscr, &f);
304 ]])],
305 [ax_cv_header_ncurses_h_with_ncursesw=yes],
306 [ax_cv_header_ncurses_h_with_ncursesw=no])
307 ])
308 AS_IF([test "x$ax_cv_header_ncurses_h_with_ncursesw" = xyes], [
309 ax_cv_curses_enhanced=yes
310 ax_cv_curses_color=yes
311 ax_cv_curses_obsolete=yes
312 AC_DEFINE([HAVE_CURSES_ENHANCED], [1], [Define to 1 if library supports X/Open Enhanced functions])
313 AC_DEFINE([HAVE_CURSES_COLOR], [1], [Define to 1 if library supports color (enhanced functions)])
314 AC_DEFINE([HAVE_CURSES_OBSOLETE], [1], [Define to 1 if library supports certain obsolete features])
315 AC_DEFINE([HAVE_NCURSES_H], [1], [Define to 1 if <ncurses.h> is present])
316 ])
317
318 AS_IF([test "x$ax_cv_header_ncursesw_curses_h" = xno && test "x$ax_cv_header_ncursesw_h" = xno && test "x$ax_cv_header_ncurses_h_with_ncursesw" = xno], [
319 AC_MSG_WARN([could not find a working ncursesw/curses.h, ncursesw.h or ncurses.h])
320 ])
321 ])
322 ])
323
324 # Test for Ncurses
325
326 AS_IF([test "x$CURSES_LIB" = x && test "x$with_ncurses" != xno && test "x$ax_cv_curses_which" = xno], [
327 LIBS="$ax_saved_LIBS -lncurses"
328
329 AC_CACHE_CHECK([for Ncurses library], [ax_cv_ncurses], [
330 AC_LINK_IFELSE([AC_LANG_CALL([], [initscr])],
331 [ax_cv_ncurses=yes], [ax_cv_ncurses=no])
332 ])
333 AS_IF([test "x$ax_cv_ncurses" = xno && test "x$with_ncurses" = xyes], [
334 AC_MSG_ERROR([--with-ncurses specified but could not find Ncurses library])
335 ])
336
337 AS_IF([test "x$ax_cv_ncurses" = xyes], [
338 ax_cv_curses=yes
339 ax_cv_curses_which=ncurses
340 CURSES_LIB="-lncurses"
341 AC_DEFINE([HAVE_NCURSES], [1], [Define to 1 if the Ncurses library is present])
342 AC_DEFINE([HAVE_CURSES], [1], [Define to 1 if a SysV or X/Open compatible Curses library is present])
343
344 AC_CACHE_CHECK([for working ncurses/curses.h], [ax_cv_header_ncurses_curses_h], [
345 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
346 @%:@include <ncurses/curses.h>
347 ]], [[
348 chtype a = A_BOLD;
349 int b = KEY_LEFT;
350 chtype c = COLOR_PAIR(1) & A_COLOR;
351 int g = getattrs(stdscr);
352 int h = getcurx(stdscr) + getmaxx(stdscr);
353 initscr();
354 init_pair(1, COLOR_WHITE, COLOR_RED);
355 ]])],
356 [ax_cv_header_ncurses_curses_h=yes],
357 [ax_cv_header_ncurses_curses_h=no])
358 ])
359 AS_IF([test "x$ax_cv_header_ncurses_curses_h" = xyes], [
360 ax_cv_curses_color=yes
361 ax_cv_curses_obsolete=yes
362 AC_DEFINE([HAVE_CURSES_COLOR], [1], [Define to 1 if library supports color (enhanced functions)])
363 AC_DEFINE([HAVE_CURSES_OBSOLETE], [1], [Define to 1 if library supports certain obsolete features])
364 AC_DEFINE([HAVE_NCURSES_CURSES_H], [1], [Define to 1 if <ncurses/curses.h> is present])
365 ])
366
367 AC_CACHE_CHECK([for working ncurses.h], [ax_cv_header_ncurses_h], [
368 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
369 @%:@include <ncurses.h>
370 ]], [[
371 chtype a = A_BOLD;
372 int b = KEY_LEFT;
373 chtype c = COLOR_PAIR(1) & A_COLOR;
374 int g = getattrs(stdscr);
375 int h = getcurx(stdscr) + getmaxx(stdscr);
376 initscr();
377 init_pair(1, COLOR_WHITE, COLOR_RED);
378 ]])],
379 [ax_cv_header_ncurses_h=yes],
380 [ax_cv_header_ncurses_h=no])
381 ])
382 AS_IF([test "x$ax_cv_header_ncurses_h" = xyes], [
383 ax_cv_curses_color=yes
384 ax_cv_curses_obsolete=yes
385 AC_DEFINE([HAVE_CURSES_COLOR], [1], [Define to 1 if library supports color (enhanced functions)])
386 AC_DEFINE([HAVE_CURSES_OBSOLETE], [1], [Define to 1 if library supports certain obsolete features])
387 AC_DEFINE([HAVE_NCURSES_H], [1], [Define to 1 if <ncurses.h> is present])
388 ])
389
390 AS_IF([test "x$ax_cv_header_ncurses_curses_h" = xno && test "x$ax_cv_header_ncurses_h" = xno], [
391 AC_MSG_WARN([could not find a working ncurses/curses.h or ncurses.h])
392 ])
393 ])
394 ])
395
396 # Test for plain Curses (or if CURSES_LIB was set by user)
397
398 AS_IF([test "x$with_plaincurses" != xno && test "x$ax_cv_curses_which" = xno], [
399 AS_IF([test "x$CURSES_LIB" != x], [
400 LIBS="$ax_saved_LIBS $CURSES_LIB"
401 ], [
402 LIBS="$ax_saved_LIBS -lcurses"
403 ])
404
405 AC_CACHE_CHECK([for Curses library], [ax_cv_plaincurses], [
406 AC_LINK_IFELSE([AC_LANG_CALL([], [initscr])],
407 [ax_cv_plaincurses=yes], [ax_cv_plaincurses=no])
408 ])
409
410 AS_IF([test "x$ax_cv_plaincurses" = xyes], [
411 ax_cv_curses=yes
412 ax_cv_curses_which=plaincurses
413 AS_IF([test "x$CURSES_LIB" = x], [
414 CURSES_LIB="-lcurses"
415 ])
416 AC_DEFINE([HAVE_CURSES], [1], [Define to 1 if a SysV or X/Open compatible Curses library is present])
417
418 # Check for base conformance (and header file)
419
420 AC_CACHE_CHECK([for working curses.h], [ax_cv_header_curses_h], [
421 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
422 @%:@include <curses.h>
423 ]], [[
424 chtype a = A_BOLD;
425 int b = KEY_LEFT;
426 initscr();
427 ]])],
428 [ax_cv_header_curses_h=yes],
429 [ax_cv_header_curses_h=no])
430 ])
431 AS_IF([test "x$ax_cv_header_curses_h" = xyes], [
432 AC_DEFINE([HAVE_CURSES_H], [1], [Define to 1 if <curses.h> is present])
433
434 # Check for X/Open Enhanced conformance
435
436 AC_CACHE_CHECK([for X/Open Enhanced Curses conformance], [ax_cv_plaincurses_enhanced], [
437 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
438 @%:@define _XOPEN_SOURCE_EXTENDED 1
439 @%:@include <curses.h>
440 @%:@ifndef _XOPEN_CURSES
441 @%:@error "this Curses library is not enhanced"
442 "this Curses library is not enhanced"
443 @%:@endif
444 ]], [[
445 chtype a = A_BOLD;
446 int b = KEY_LEFT;
447 chtype c = COLOR_PAIR(1) & A_COLOR;
448 attr_t d = WA_NORMAL;
449 cchar_t e;
450 wint_t f;
451 initscr();
452 init_pair(1, COLOR_WHITE, COLOR_RED);
453 wattr_set(stdscr, d, 0, NULL);
454 wget_wch(stdscr, &f);
455 ]])],
456 [ax_cv_plaincurses_enhanced=yes],
457 [ax_cv_plaincurses_enhanced=no])
458 ])
459 AS_IF([test "x$ax_cv_plaincurses_enhanced" = xyes], [
460 ax_cv_curses_enhanced=yes
461 ax_cv_curses_color=yes
462 AC_DEFINE([HAVE_CURSES_ENHANCED], [1], [Define to 1 if library supports X/Open Enhanced functions])
463 AC_DEFINE([HAVE_CURSES_COLOR], [1], [Define to 1 if library supports color (enhanced functions)])
464 ])
465
466 # Check for color functions
467
468 AC_CACHE_CHECK([for Curses color functions], [ax_cv_plaincurses_color], [
469 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
470 @%:@define _XOPEN_SOURCE_EXTENDED 1
471 @%:@include <curses.h>
472 ]], [[
473 chtype a = A_BOLD;
474 int b = KEY_LEFT;
475 chtype c = COLOR_PAIR(1) & A_COLOR;
476 initscr();
477 init_pair(1, COLOR_WHITE, COLOR_RED);
478 ]])],
479 [ax_cv_plaincurses_color=yes],
480 [ax_cv_plaincurses_color=no])
481 ])
482 AS_IF([test "x$ax_cv_plaincurses_color" = xyes], [
483 ax_cv_curses_color=yes
484 AC_DEFINE([HAVE_CURSES_COLOR], [1], [Define to 1 if library supports color (enhanced functions)])
485 ])
486
487 # Check for obsolete functions
488
489 AC_CACHE_CHECK([for obsolete Curses functions], [ax_cv_plaincurses_obsolete], [
490 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
491 @%:@include <curses.h>
492 ]], [[
493 chtype a = A_BOLD;
494 int b = KEY_LEFT;
495 int g = getattrs(stdscr);
496 int h = getcurx(stdscr) + getmaxx(stdscr);
497 initscr();
498 ]])],
499 [ax_cv_plaincurses_obsolete=yes],
500 [ax_cv_plaincurses_obsolete=no])
501 ])
502 AS_IF([test "x$ax_cv_plaincurses_obsolete" = xyes], [
503 ax_cv_curses_obsolete=yes
504 AC_DEFINE([HAVE_CURSES_OBSOLETE], [1], [Define to 1 if library supports certain obsolete features])
505 ])
506 ])
507
508 AS_IF([test "x$ax_cv_header_curses_h" = xno], [
509 AC_MSG_WARN([could not find a working curses.h])
510 ])
511 ])
512 ])
513
514 AS_IF([test "x$ax_cv_curses" != xyes], [ax_cv_curses=no])
515 AS_IF([test "x$ax_cv_curses_enhanced" != xyes], [ax_cv_curses_enhanced=no])
516 AS_IF([test "x$ax_cv_curses_color" != xyes], [ax_cv_curses_color=no])
517 AS_IF([test "x$ax_cv_curses_obsolete" != xyes], [ax_cv_curses_obsolete=no])
518
519 LIBS=$ax_saved_LIBS
520 ])dnl