1 dnl***************************************************************************
2 dnl Copyright (c) 2003-2010,2011 Free Software Foundation, Inc. *
4 dnl Permission is hereby granted, free of charge, to any person obtaining a *
5 dnl copy of this software and associated documentation files (the *
6 dnl "Software"), to deal in the Software without restriction, including *
7 dnl without limitation the rights to use, copy, modify, merge, publish, *
8 dnl distribute, distribute with modifications, sublicense, and/or sell *
9 dnl copies of the Software, and to permit persons to whom the Software is *
10 dnl furnished to do so, subject to the following conditions: *
12 dnl The above copyright notice and this permission notice shall be included *
13 dnl in all copies or substantial portions of the Software. *
15 dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
16 dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
17 dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
18 dnl IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
19 dnl DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
20 dnl OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
21 dnl THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
23 dnl Except as contained in this notice, the name(s) of the above copyright *
24 dnl holders shall not be used in advertising or otherwise to promote the *
25 dnl sale, use or other dealings in this Software without prior written *
27 dnl***************************************************************************
29 dnl $Id: aclocal.m4,v 1.60 2011/05/07 15:34:44 tom Exp $
31 dnl Author: Thomas E. Dickey
33 dnl Macros used in NCURSES test programs auto-configuration script.
35 dnl These macros are maintained separately from NCURSES. The copyright on
36 dnl this file applies to the aggregation of macros and does not affect use of
37 dnl these macros in other applications.
39 dnl See http://invisible-island.net/autoconf/ for additional information.
41 dnl ---------------------------------------------------------------------------
42 dnl ---------------------------------------------------------------------------
43 dnl CF_ADD_CFLAGS version: 10 updated: 2010/05/26 05:38:42
45 dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS
46 dnl The second parameter if given makes this macro verbose.
48 dnl Put any preprocessor definitions that use quoted strings in $EXTRA_CPPFLAGS,
49 dnl to simplify use of $CPPFLAGS in compiler checks, etc., that are easily
50 dnl confused by the quotes (which require backslashes to keep them usable).
51 AC_DEFUN([CF_ADD_CFLAGS],
56 cf_new_extra_cppflags=
58 for cf_add_cflags in $1
60 case $cf_fix_cppflags in
62 case $cf_add_cflags in #(vi
63 -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi
64 case $cf_add_cflags in
66 cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[[^=]]*='\''\"[[^"]]*//'`
68 test "${cf_add_cflags}" != "${cf_tst_cflags}" \
69 && test -z "${cf_tst_cflags}" \
70 && cf_fix_cppflags=yes
72 if test $cf_fix_cppflags = yes ; then
73 cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
75 elif test "${cf_tst_cflags}" = "\"'" ; then
76 cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
85 case $cf_add_cflags in #(vi
87 cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'`
88 CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,$cf_tst_cppflags)
91 cf_new_cppflags="$cf_new_cppflags $cf_add_cflags"
96 cf_new_cflags="$cf_new_cflags $cf_add_cflags"
101 cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
103 cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[[^"]]*"'\''//'`
105 test "${cf_add_cflags}" != "${cf_tst_cflags}" \
106 && test -z "${cf_tst_cflags}" \
107 && cf_fix_cppflags=no
112 if test -n "$cf_new_cflags" ; then
113 ifelse([$2],,,[CF_VERBOSE(add to \$CFLAGS $cf_new_cflags)])
114 CFLAGS="$CFLAGS $cf_new_cflags"
117 if test -n "$cf_new_cppflags" ; then
118 ifelse([$2],,,[CF_VERBOSE(add to \$CPPFLAGS $cf_new_cppflags)])
119 CPPFLAGS="$CPPFLAGS $cf_new_cppflags"
122 if test -n "$cf_new_extra_cppflags" ; then
123 ifelse([$2],,,[CF_VERBOSE(add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags)])
124 EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
127 AC_SUBST(EXTRA_CPPFLAGS)
130 dnl ---------------------------------------------------------------------------
131 dnl CF_ADD_INCDIR version: 13 updated: 2010/05/26 16:44:57
133 dnl Add an include-directory to $CPPFLAGS. Don't add /usr/include, since it's
134 dnl redundant. We don't normally need to add -I/usr/local/include for gcc,
135 dnl but old versions (and some misinstalled ones) need that. To make things
136 dnl worse, gcc 3.x may give error messages if -I/usr/local/include is added to
137 dnl the include-path).
138 AC_DEFUN([CF_ADD_INCDIR],
140 if test -n "$1" ; then
141 for cf_add_incdir in $1
143 while test $cf_add_incdir != /usr/include
145 if test -d $cf_add_incdir
148 if test -n "$CFLAGS$CPPFLAGS" ; then
149 # a loop is needed to ensure we can add subdirs of existing dirs
150 for cf_test_incdir in $CFLAGS $CPPFLAGS ; do
151 if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then
152 cf_have_incdir=yes; break
157 if test "$cf_have_incdir" = no ; then
158 if test "$cf_add_incdir" = /usr/local/include ; then
161 cf_save_CPPFLAGS=$CPPFLAGS
162 CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
163 AC_TRY_COMPILE([#include <stdio.h>],
166 [cf_have_incdir=yes])
167 CPPFLAGS=$cf_save_CPPFLAGS
172 if test "$cf_have_incdir" = no ; then
173 CF_VERBOSE(adding $cf_add_incdir to include-path)
174 ifelse([$2],,CPPFLAGS,[$2])="$ifelse([$2],,CPPFLAGS,[$2]) -I$cf_add_incdir"
176 cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'`
177 test "$cf_top_incdir" = "$cf_add_incdir" && break
178 cf_add_incdir="$cf_top_incdir"
187 dnl ---------------------------------------------------------------------------
188 dnl CF_ADD_LIB version: 2 updated: 2010/06/02 05:03:05
190 dnl Add a library, used to enforce consistency.
192 dnl $1 = library to add, without the "-l"
193 dnl $2 = variable to update (default $LIBS)
194 AC_DEFUN([CF_ADD_LIB],[CF_ADD_LIBS(-l$1,ifelse($2,,LIBS,[$2]))])dnl
195 dnl ---------------------------------------------------------------------------
196 dnl CF_ADD_LIBDIR version: 9 updated: 2010/05/26 16:44:57
198 dnl Adds to the library-path
200 dnl Some machines have trouble with multiple -L options.
202 dnl $1 is the (list of) directory(s) to add
203 dnl $2 is the optional name of the variable to update (default LDFLAGS)
205 AC_DEFUN([CF_ADD_LIBDIR],
207 if test -n "$1" ; then
208 for cf_add_libdir in $1
210 if test $cf_add_libdir = /usr/lib ; then
212 elif test -d $cf_add_libdir
215 if test -n "$LDFLAGS$LIBS" ; then
216 # a loop is needed to ensure we can add subdirs of existing dirs
217 for cf_test_libdir in $LDFLAGS $LIBS ; do
218 if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then
219 cf_have_libdir=yes; break
223 if test "$cf_have_libdir" = no ; then
224 CF_VERBOSE(adding $cf_add_libdir to library-path)
225 ifelse([$2],,LDFLAGS,[$2])="-L$cf_add_libdir $ifelse([$2],,LDFLAGS,[$2])"
231 dnl ---------------------------------------------------------------------------
232 dnl CF_ADD_LIBS version: 1 updated: 2010/06/02 05:03:05
234 dnl Add one or more libraries, used to enforce consistency.
236 dnl $1 = libraries to add, with the "-l", etc.
237 dnl $2 = variable to update (default $LIBS)
238 AC_DEFUN([CF_ADD_LIBS],[ifelse($2,,LIBS,[$2])="$1 [$]ifelse($2,,LIBS,[$2])"])dnl
239 dnl ---------------------------------------------------------------------------
240 dnl CF_ADD_LIB_AFTER version: 2 updated: 2010/11/08 20:33:46
242 dnl Add a given library after another, e.g., following the one it satisfies a
245 dnl $1 = the first library
246 dnl $2 = its dependency
247 AC_DEFUN([CF_ADD_LIB_AFTER],[
248 CF_VERBOSE(...before $LIBS)
249 LIBS=`echo "$LIBS" | sed -e "s/[[ ]][[ ]]*/ /g" -e "s,$1 ,$1 $2 ," -e 's/ / /g'`
250 CF_VERBOSE(...after $LIBS)
252 dnl ---------------------------------------------------------------------------
253 dnl CF_ADD_SUBDIR_PATH version: 3 updated: 2010/07/03 20:58:12
254 dnl ------------------
255 dnl Append to a search-list for a nonstandard header/lib-file
256 dnl $1 = the variable to return as result
257 dnl $2 = the package name
258 dnl $3 = the subdirectory, e.g., bin, include or lib
259 dnl $4 = the directory under which we will test for subdirectories
260 dnl $5 = a directory that we do not want $4 to match
261 AC_DEFUN([CF_ADD_SUBDIR_PATH],
263 test "$4" != "$5" && \
265 ifelse([$5],NONE,,[(test $5 = NONE || test "$4" != "$5") &&]) {
266 test -n "$verbose" && echo " ... testing for $3-directories under $4"
267 test -d $4/$3 && $1="[$]$1 $4/$3"
268 test -d $4/$3/$2 && $1="[$]$1 $4/$3/$2"
269 test -d $4/$3/$2/$3 && $1="[$]$1 $4/$3/$2/$3"
270 test -d $4/$2/$3 && $1="[$]$1 $4/$2/$3"
271 test -d $4/$2/$3/$2 && $1="[$]$1 $4/$2/$3/$2"
274 dnl ---------------------------------------------------------------------------
275 dnl CF_ANSI_CC_CHECK version: 10 updated: 2010/10/23 15:52:32
277 dnl This is adapted from the macros 'fp_PROG_CC_STDC' and 'fp_C_PROTOTYPES'
278 dnl in the sharutils 4.2 distribution.
279 AC_DEFUN([CF_ANSI_CC_CHECK],
281 AC_CACHE_CHECK(for ${CC:-cc} option to accept ANSI C, cf_cv_ansi_cc,[
283 cf_save_CFLAGS="$CFLAGS"
284 cf_save_CPPFLAGS="$CPPFLAGS"
285 # Don't try gcc -ansi; that turns off useful extensions and
286 # breaks some systems' header files.
288 # Ultrix and OSF/1 -std1
289 # HP-UX -Aa -D_HPUX_SOURCE
291 # UnixWare 1.2 (cannot use -Xc, since ANSI/POSIX clashes)
292 for cf_arg in "-DCC_HAS_PROTOS" \
297 "-Aa -D_HPUX_SOURCE" \
300 CF_ADD_CFLAGS($cf_arg)
303 #ifndef CC_HAS_PROTOS
304 #if !defined(__STDC__) || (__STDC__ != 1)
309 int test (int i, double x);
310 struct s1 {int (*f) (int a);};
311 struct s2 {int (*f) (double a);};],
312 [cf_cv_ansi_cc="$cf_arg"; break])
314 CFLAGS="$cf_save_CFLAGS"
315 CPPFLAGS="$cf_save_CPPFLAGS"
318 if test "$cf_cv_ansi_cc" != "no"; then
319 if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then
320 CF_ADD_CFLAGS($cf_cv_ansi_cc)
322 AC_DEFINE(CC_HAS_PROTOS)
326 dnl ---------------------------------------------------------------------------
327 dnl CF_ANSI_CC_REQD version: 4 updated: 2008/03/23 14:48:54
329 dnl For programs that must use an ANSI compiler, obtain compiler options that
330 dnl will make it recognize prototypes. We'll do preprocessor checks in other
331 dnl macros, since tools such as unproto can fake prototypes, but only part of
332 dnl the preprocessor.
333 AC_DEFUN([CF_ANSI_CC_REQD],
334 [AC_REQUIRE([CF_ANSI_CC_CHECK])
335 if test "$cf_cv_ansi_cc" = "no"; then
337 [Your compiler does not appear to recognize prototypes.
338 You have the following choices:
339 a. adjust your compiler options
340 b. get an up-to-date compiler
341 c. use a wrapper such as unproto])
344 dnl ---------------------------------------------------------------------------
345 dnl CF_ARG_DISABLE version: 3 updated: 1999/03/30 17:24:31
347 dnl Allow user to disable a normally-on option.
348 AC_DEFUN([CF_ARG_DISABLE],
349 [CF_ARG_OPTION($1,[$2],[$3],[$4],yes)])dnl
350 dnl ---------------------------------------------------------------------------
351 dnl CF_ARG_ENABLE version: 3 updated: 1999/03/30 17:24:31
353 dnl Allow user to enable a normally-off option.
354 AC_DEFUN([CF_ARG_ENABLE],
355 [CF_ARG_OPTION($1,[$2],[$3],[$4],no)])dnl
356 dnl ---------------------------------------------------------------------------
357 dnl CF_ARG_OPTION version: 4 updated: 2010/05/26 05:38:42
359 dnl Restricted form of AC_ARG_ENABLE that ensures user doesn't give bogus
365 dnl $3 = action to perform if option is not default
366 dnl $4 = action if perform if option is default
367 dnl $5 = default option value (either 'yes' or 'no')
368 AC_DEFUN([CF_ARG_OPTION],
369 [AC_ARG_ENABLE([$1],[$2],[test "$enableval" != ifelse([$5],no,yes,no) && enableval=ifelse([$5],no,no,yes)
370 if test "$enableval" != "$5" ; then
372 ,[ $3]) ifelse([$4],,,[
375 fi],[enableval=$5 ifelse([$4],,,[
379 dnl ---------------------------------------------------------------------------
380 dnl CF_CHECK_CACHE version: 11 updated: 2008/03/23 14:45:59
382 dnl Check if we're accidentally using a cache from a different machine.
383 dnl Derive the system name, as a check for reusing the autoconf cache.
385 dnl If we've packaged config.guess and config.sub, run that (since it does a
386 dnl better job than uname). Normally we'll use AC_CANONICAL_HOST, but allow
387 dnl an extra parameter that we may override, e.g., for AC_CANONICAL_SYSTEM
388 dnl which is useful in cross-compiles.
390 dnl Note: we would use $ac_config_sub, but that is one of the places where
391 dnl autoconf 2.5x broke compatibility with autoconf 2.13
392 AC_DEFUN([CF_CHECK_CACHE],
394 if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then
395 ifelse([$1],,[AC_CANONICAL_HOST],[$1])
396 system_name="$host_os"
398 system_name="`(uname -s -r) 2>/dev/null`"
399 if test -z "$system_name" ; then
400 system_name="`(hostname) 2>/dev/null`"
403 test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name")
404 AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"])
406 test -z "$system_name" && system_name="$cf_cv_system_name"
407 test -n "$cf_cv_system_name" && AC_MSG_RESULT(Configuring for $cf_cv_system_name)
409 if test ".$system_name" != ".$cf_cv_system_name" ; then
410 AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name))
411 AC_MSG_ERROR("Please remove config.cache and try again.")
414 dnl ---------------------------------------------------------------------------
415 dnl CF_CHECK_CFLAGS version: 2 updated: 2001/12/30 19:09:58
417 dnl Conditionally add to $CFLAGS and $CPPFLAGS values which are derived from
418 dnl a build-configuration such as imake. These have the pitfall that they
419 dnl often contain compiler-specific options which we cannot use, mixed with
420 dnl preprocessor options that we usually can.
421 AC_DEFUN([CF_CHECK_CFLAGS],
423 CF_VERBOSE(checking additions to CFLAGS)
424 cf_check_cflags="$CFLAGS"
425 cf_check_cppflags="$CPPFLAGS"
426 CF_ADD_CFLAGS($1,yes)
427 if test "$cf_check_cflags" != "$CFLAGS" ; then
428 AC_TRY_LINK([#include <stdio.h>],[printf("Hello world");],,
429 [CF_VERBOSE(test-compile failed. Undoing change to \$CFLAGS)
430 if test "$cf_check_cppflags" != "$CPPFLAGS" ; then
431 CF_VERBOSE(but keeping change to \$CPPFLAGS)
433 CFLAGS="$cf_check_flags"])
436 dnl ---------------------------------------------------------------------------
437 dnl CF_CURSES_ACS_MAP version: 6 updated: 2010/10/23 15:54:49
438 dnl -----------------
439 dnl Check for likely values of acs_map[]:
440 AC_DEFUN([CF_CURSES_ACS_MAP],
442 AC_REQUIRE([CF_NCURSES_WRAP_PREFIX])dnl
443 AC_CACHE_CHECK(for alternate character set array, cf_cv_curses_acs_map,[
444 cf_cv_curses_acs_map=unknown
445 for name in acs_map _acs_map __acs_map ${NCURSES_WRAP_PREFIX}acs_map
448 #include <${cf_cv_ncurses_header:-curses.h}>
450 $name['k'] = ACS_PLUS
451 ],[cf_cv_curses_acs_map=$name; break])
455 test "$cf_cv_curses_acs_map" != unknown && AC_DEFINE_UNQUOTED(CURSES_ACS_ARRAY,$cf_cv_curses_acs_map)
457 dnl ---------------------------------------------------------------------------
458 dnl CF_CURSES_CHECK_DATA version: 4 updated: 2011/01/15 16:39:24
459 dnl --------------------
460 dnl Check if curses.h defines the given data/variable.
461 dnl Use this after CF_NCURSES_CONFIG or CF_CURSES_CONFIG.
462 AC_DEFUN([CF_CURSES_CHECK_DATA],
464 AC_MSG_CHECKING(for data $1 declaration in ${cf_cv_ncurses_header:-curses.h})
466 AC_TRY_COMPILE(CF__CURSES_HEAD,[
468 ],cf_result=yes,cf_result=no)
469 AC_MSG_RESULT($cf_result)
471 if test $cf_result = yes ; then
472 CF_UPPER(cf_result,have_curses_data_$1)
473 AC_DEFINE_UNQUOTED($cf_result)
475 AC_MSG_CHECKING(for data $1 in library)
476 # BSD linkers insist on making weak linkage, but resolve at runtime.
477 AC_TRY_RUN(CF__CURSES_HEAD
483 ${cf_cv_main_return:-return}(foo == 0);
484 }],[cf_result=yes],[cf_result=no],[
486 AC_TRY_LINK(CF__CURSES_HEAD
490 ${cf_cv_main_return:-return}(foo == 0);
492 ],[cf_result=yes],[cf_result=no])
494 AC_MSG_RESULT($cf_result)
495 if test $cf_result = yes ; then
496 CF_UPPER(cf_result,decl_curses_data_$1)
497 AC_DEFINE_UNQUOTED($cf_result)
501 dnl ---------------------------------------------------------------------------
502 dnl CF_CURSES_CHECK_TYPE version: 3 updated: 2010/10/23 15:54:49
503 dnl --------------------
504 dnl Check if curses.h defines the given type
505 AC_DEFUN([CF_CURSES_CHECK_TYPE],
507 AC_MSG_CHECKING(for type $1 in ${cf_cv_ncurses_header:-curses.h})
509 #ifndef _XOPEN_SOURCE_EXTENDED
510 #define _XOPEN_SOURCE_EXTENDED
512 #include <${cf_cv_ncurses_header:-curses.h}>],[
514 ],cf_result=yes,cf_result=no)
515 AC_MSG_RESULT($cf_result)
516 if test $cf_result = yes ; then
517 CF_UPPER(cf_result,have_type_$1)
518 AC_DEFINE_UNQUOTED($cf_result)
520 AC_DEFINE_UNQUOTED($1,$2)
523 dnl ---------------------------------------------------------------------------
524 dnl CF_CURSES_CONFIG version: 2 updated: 2006/10/29 11:06:27
526 dnl Tie together the configure-script macros for curses. It may be ncurses,
527 dnl but unless asked, we do not make a special search for ncurses. However,
528 dnl still check for the ncurses version number, for use in other macros.
529 AC_DEFUN([CF_CURSES_CONFIG],
535 dnl ---------------------------------------------------------------------------
536 dnl CF_CURSES_CPPFLAGS version: 11 updated: 2011/04/09 14:51:08
537 dnl ------------------
538 dnl Look for the curses headers.
539 AC_DEFUN([CF_CURSES_CPPFLAGS],[
541 AC_CACHE_CHECK(for extra include directories,cf_cv_curses_incdir,[
542 cf_cv_curses_incdir=no
543 case $host_os in #(vi
545 if test "x$cf_cv_screen" = "xcurses_colr"
547 test -d /usr/include/curses_colr && \
548 cf_cv_curses_incdir="-I/usr/include/curses_colr"
552 if test "x$cf_cv_screen" = "xcurses_5lib"
554 test -d /usr/5lib && \
555 test -d /usr/5include && \
556 cf_cv_curses_incdir="-I/usr/5include"
561 test "$cf_cv_curses_incdir" != no && CPPFLAGS="$CPPFLAGS $cf_cv_curses_incdir"
566 dnl ---------------------------------------------------------------------------
567 dnl CF_CURSES_FUNCS version: 16 updated: 2011/04/09 18:19:55
569 dnl Curses-functions are a little complicated, since a lot of them are macros.
570 AC_DEFUN([CF_CURSES_FUNCS],
572 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
573 AC_REQUIRE([CF_XOPEN_CURSES])
574 AC_REQUIRE([CF_CURSES_TERM_H])
575 AC_REQUIRE([CF_CURSES_UNCTRL_H])
578 CF_UPPER(cf_tr_func,$cf_func)
579 AC_MSG_CHECKING(for ${cf_func})
580 CF_MSG_LOG(${cf_func})
581 AC_CACHE_VAL(cf_cv_func_$cf_func,[
582 eval cf_result='$ac_cv_func_'$cf_func
583 if test ".$cf_result" != ".no"; then
584 AC_TRY_LINK(CF__CURSES_HEAD,
587 long foo = (long)(&${cf_func});
588 ${cf_cv_main_return:-return}(foo == 0);
594 eval 'cf_cv_func_'$cf_func'=$cf_result'
596 # use the computed/retrieved cache-value:
597 eval 'cf_result=$cf_cv_func_'$cf_func
598 AC_MSG_RESULT($cf_result)
599 if test $cf_result != no; then
600 AC_DEFINE_UNQUOTED(HAVE_${cf_tr_func})
604 dnl ---------------------------------------------------------------------------
605 dnl CF_CURSES_HEADER version: 3 updated: 2011/05/01 19:47:45
607 dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common
608 dnl variations of ncurses' installs.
610 dnl $1 = ncurses when looking for ncurses, or is empty
611 AC_DEFUN([CF_CURSES_HEADER],[
612 AC_CACHE_CHECK(if we have identified curses headers,cf_cv_ncurses_header,[
613 cf_cv_ncurses_header=none
614 for cf_header in ifelse($1,,,[ \
618 curses.h ifelse($1,,[ncurses/ncurses.h ncurses/curses.h])
620 AC_TRY_COMPILE([#include <${cf_header}>],
621 [initscr(); tgoto("?", 0,0)],
622 [cf_cv_ncurses_header=$cf_header; break],[])
626 if test "$cf_cv_ncurses_header" = none ; then
627 AC_MSG_ERROR(No curses header-files found)
630 # cheat, to get the right #define's for HAVE_NCURSES_H, etc.
631 AC_CHECK_HEADERS($cf_cv_ncurses_header)
633 dnl ---------------------------------------------------------------------------
634 dnl CF_CURSES_LIBS version: 34 updated: 2011/04/09 14:51:08
636 dnl Look for the curses libraries. Older curses implementations may require
637 dnl termcap/termlib to be linked as well. Call CF_CURSES_CPPFLAGS first.
638 AC_DEFUN([CF_CURSES_LIBS],[
640 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
641 AC_MSG_CHECKING(if we have identified curses libraries)
642 AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>],
643 [initscr(); tgoto("?", 0,0)],
646 AC_MSG_RESULT($cf_result)
648 if test "$cf_result" = no ; then
649 case $host_os in #(vi
651 AC_CHECK_LIB(mytinfo,tgoto,[CF_ADD_LIBS(-lmytinfo)])
654 # Looking at HPUX 10.20, the Hcurses library is the oldest (1997), cur_colr
655 # next (1998), and xcurses "newer" (2000). There is no header file for
656 # Hcurses; the subdirectory curses_colr has the headers (curses.h and
657 # term.h) for cur_colr
658 if test "x$cf_cv_screen" = "xcurses_colr"
660 AC_CHECK_LIB(cur_colr,initscr,[
661 CF_ADD_LIBS(-lcur_colr)
662 ac_cv_func_initscr=yes
664 AC_CHECK_LIB(Hcurses,initscr,[
665 # HP's header uses __HP_CURSES, but user claims _HP_CURSES.
666 CF_ADD_LIBS(-lHcurses)
667 CPPFLAGS="$CPPFLAGS -D__HP_CURSES -D_HP_CURSES"
668 ac_cv_func_initscr=yes
673 case `arch 2>/dev/null` in
677 CF_ADD_LIBDIR(/lib64)
688 if test "x$cf_cv_screen" = "xcurses_5lib"
690 if test -d /usr/5lib ; then
691 CF_ADD_LIBDIR(/usr/5lib)
692 CF_ADD_LIBS(-lcurses -ltermcap)
695 ac_cv_func_initscr=yes
699 if test ".$ac_cv_func_initscr" != .yes ; then
704 if test ".${cf_cv_ncurses_version:-no}" != .no
706 cf_check_list="ncurses curses cursesX"
708 cf_check_list="cursesX curses ncurses"
711 # Check for library containing tgoto. Do this before curses library
712 # because it may be needed to link the test-case for initscr.
713 AC_CHECK_FUNC(tgoto,[cf_term_lib=predefined],[
714 for cf_term_lib in $cf_check_list termcap termlib unknown
716 AC_CHECK_LIB($cf_term_lib,tgoto,[break])
720 # Check for library containing initscr
721 test "$cf_term_lib" != predefined && test "$cf_term_lib" != unknown && LIBS="-l$cf_term_lib $cf_save_LIBS"
722 for cf_curs_lib in $cf_check_list xcurses jcurses pdcurses unknown
724 AC_CHECK_LIB($cf_curs_lib,initscr,[break])
726 test $cf_curs_lib = unknown && AC_MSG_ERROR(no curses library found)
728 LIBS="-l$cf_curs_lib $cf_save_LIBS"
729 if test "$cf_term_lib" = unknown ; then
730 AC_MSG_CHECKING(if we can link with $cf_curs_lib library)
731 AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>],
735 AC_MSG_RESULT($cf_result)
736 test $cf_result = no && AC_MSG_ERROR(Cannot link curses library)
737 elif test "$cf_curs_lib" = "$cf_term_lib" ; then
739 elif test "$cf_term_lib" != predefined ; then
740 AC_MSG_CHECKING(if we need both $cf_curs_lib and $cf_term_lib libraries)
741 AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>],
742 [initscr(); tgoto((char *)0, 0, 0);],
745 LIBS="-l$cf_curs_lib -l$cf_term_lib $cf_save_LIBS"
746 AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>],
751 AC_MSG_RESULT($cf_result)
757 dnl ---------------------------------------------------------------------------
758 dnl CF_CURSES_TERM_H version: 9 updated: 2011/04/09 18:19:55
760 dnl SVr4 curses should have term.h as well (where it puts the definitions of
761 dnl the low-level interface). This may not be true in old/broken implementations,
762 dnl as well as in misconfigured systems (e.g., gcc configured for Solaris 2.4
763 dnl running with Solaris 2.5.1).
764 AC_DEFUN([CF_CURSES_TERM_H],
766 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
768 AC_CACHE_CHECK(for term.h, cf_cv_term_header,[
770 # If we found <ncurses/curses.h>, look for <ncurses/term.h>, but always look
771 # for <term.h> if we do not find the variant.
773 cf_header_list="term.h ncurses/term.h ncursesw/term.h"
775 case ${cf_cv_ncurses_header:-curses.h} in #(vi
777 cf_header_item=`echo ${cf_cv_ncurses_header:-curses.h} | sed -e 's%\..*%%' -e 's%/.*%/%'`term.h
778 cf_header_list="$cf_header_item $cf_header_list"
782 for cf_header in $cf_header_list
785 #include <${cf_cv_ncurses_header:-curses.h}>
786 #include <${cf_header}>],
788 [cf_cv_term_header=$cf_header
790 [cf_cv_term_header=no])
793 case $cf_cv_term_header in #(vi
795 # If curses is ncurses, some packagers still mess it up by trying to make
796 # us use GNU termcap. This handles the most common case.
797 for cf_header in ncurses/term.h ncursesw/term.h
800 #include <${cf_cv_ncurses_header:-curses.h}>
801 #ifdef NCURSES_VERSION
802 #include <${cf_header}>
807 [cf_cv_term_header=$cf_header
809 [cf_cv_term_header=no])
815 case $cf_cv_term_header in #(vi
817 AC_DEFINE(HAVE_TERM_H)
820 AC_DEFINE(HAVE_NCURSES_TERM_H)
823 AC_DEFINE(HAVE_NCURSESW_TERM_H)
827 dnl ---------------------------------------------------------------------------
828 dnl CF_CURSES_UNCTRL_H version: 1 updated: 2011/04/09 18:19:55
829 dnl ------------------
830 dnl Any X/Open curses implementation must have unctrl.h, but ncurses packages
831 dnl may put it in a subdirectory (along with ncurses' other headers, of
832 dnl course). Packages which put the headers in inconsistent locations are
834 AC_DEFUN([CF_CURSES_UNCTRL_H],
836 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
838 AC_CACHE_CHECK(for unctrl.h, cf_cv_unctrl_header,[
840 # If we found <ncurses/curses.h>, look for <ncurses/unctrl.h>, but always look
841 # for <unctrl.h> if we do not find the variant.
843 cf_header_list="unctrl.h ncurses/unctrl.h ncursesw/unctrl.h"
845 case ${cf_cv_ncurses_header:-curses.h} in #(vi
847 cf_header_item=`echo ${cf_cv_ncurses_header:-curses.h} | sed -e 's%\..*%%' -e 's%/.*%/%'`unctrl.h
848 cf_header_list="$cf_header_item $cf_header_list"
852 for cf_header in $cf_header_list
855 #include <${cf_cv_ncurses_header:-curses.h}>
856 #include <${cf_header}>],
858 [cf_cv_unctrl_header=$cf_header
860 [cf_cv_unctrl_header=no])
863 case $cf_cv_unctrl_header in #(vi
865 AC_MSG_WARN(unctrl.h header not found)
870 case $cf_cv_unctrl_header in #(vi
872 AC_DEFINE(HAVE_UNCTRL_H)
874 ncurses/unctrl.h) #(vi
875 AC_DEFINE(HAVE_NCURSES_UNCTRL_H)
878 AC_DEFINE(HAVE_NCURSESW_UNCTRL_H)
882 dnl ---------------------------------------------------------------------------
883 dnl CF_CURSES_WACS_MAP version: 5 updated: 2011/01/15 11:28:59
884 dnl ------------------
885 dnl Check for likely values of wacs_map[].
886 AC_DEFUN([CF_CURSES_WACS_MAP],
888 AC_CACHE_CHECK(for wide alternate character set array, cf_cv_curses_wacs_map,[
889 cf_cv_curses_wacs_map=unknown
890 for name in wacs_map _wacs_map __wacs_map _nc_wacs _wacs_char
893 #ifndef _XOPEN_SOURCE_EXTENDED
894 #define _XOPEN_SOURCE_EXTENDED
896 #include <${cf_cv_ncurses_header:-curses.h}>],
897 [void *foo = &($name['k'])],
898 [cf_cv_curses_wacs_map=$name
902 test "$cf_cv_curses_wacs_map" != unknown && AC_DEFINE_UNQUOTED(CURSES_WACS_ARRAY,$cf_cv_curses_wacs_map)
904 dnl ---------------------------------------------------------------------------
905 dnl CF_CURSES_WACS_SYMBOLS version: 1 updated: 2011/01/15 11:28:59
906 dnl ----------------------
907 dnl Do a check to see if the WACS_xxx constants are defined compatibly with
908 dnl X/Open Curses. In particular, NetBSD's implementation of the WACS_xxx
909 dnl constants is broken since those constants do not point to cchar_t's.
910 AC_DEFUN([CF_CURSES_WACS_SYMBOLS],
912 AC_REQUIRE([CF_CURSES_WACS_MAP])
914 AC_CACHE_CHECK(for wide alternate character constants, cf_cv_curses_wacs_symbols,[
915 cf_cv_curses_wacs_symbols=no
916 if test "$cf_cv_curses_wacs_map" != unknown
919 #ifndef _XOPEN_SOURCE_EXTENDED
920 #define _XOPEN_SOURCE_EXTENDED
922 #include <${cf_cv_ncurses_header:-curses.h}>],
923 [cchar_t *foo = WACS_PLUS;
924 $cf_cv_curses_wacs_map['k'] = *WACS_PLUS],
925 [cf_cv_curses_wacs_symbols=yes])
928 #ifndef _XOPEN_SOURCE_EXTENDED
929 #define _XOPEN_SOURCE_EXTENDED
931 #include <${cf_cv_ncurses_header:-curses.h}>],
932 [cchar_t *foo = WACS_PLUS],
933 [cf_cv_curses_wacs_symbols=yes])
937 test "$cf_cv_curses_wacs_symbols" != no && AC_DEFINE(CURSES_WACS_SYMBOLS)
939 dnl ---------------------------------------------------------------------------
940 dnl CF_DIRNAME version: 4 updated: 2002/12/21 19:25:52
942 dnl "dirname" is not portable, so we fake it with a shell script.
943 AC_DEFUN([CF_DIRNAME],[$1=`echo $2 | sed -e 's%/[[^/]]*$%%'`])dnl
944 dnl ---------------------------------------------------------------------------
945 dnl CF_DISABLE_ECHO version: 11 updated: 2009/12/13 13:16:57
947 dnl You can always use "make -n" to see the actual options, but it's hard to
948 dnl pick out/analyze warning messages when the compile-line is long.
951 dnl ECHO_LT - symbol to control if libtool is verbose
952 dnl ECHO_LD - symbol to prefix "cc -o" lines
953 dnl RULE_CC - symbol to put before implicit "cc -c" lines (e.g., .c.o)
954 dnl SHOW_CC - symbol to put before explicit "cc -c" lines
955 dnl ECHO_CC - symbol to put before any "cc" line
957 AC_DEFUN([CF_DISABLE_ECHO],[
958 AC_MSG_CHECKING(if you want to see long compiling messages)
960 [ --disable-echo display "compiling" commands],
963 ECHO_LD='@echo linking [$]@;'
964 RULE_CC='@echo compiling [$]<'
965 SHOW_CC='@echo compiling [$]@'
974 AC_MSG_RESULT($enableval)
981 dnl ---------------------------------------------------------------------------
982 dnl CF_DISABLE_LEAKS version: 6 updated: 2010/07/23 04:14:32
984 dnl Combine no-leak checks with the libraries or tools that are used for the
986 AC_DEFUN([CF_DISABLE_LEAKS],[
988 AC_REQUIRE([CF_WITH_DMALLOC])
989 AC_REQUIRE([CF_WITH_DBMALLOC])
990 AC_REQUIRE([CF_WITH_VALGRIND])
992 AC_MSG_CHECKING(if you want to perform memory-leak testing)
994 [ --disable-leaks test: free permanent memory, analyze leaks],
995 [if test "x$enableval" = xno; then with_no_leaks=yes; else with_no_leaks=no; fi],
996 : ${with_no_leaks:=no})
997 AC_MSG_RESULT($with_no_leaks)
999 if test "$with_no_leaks" = yes ; then
1001 AC_DEFINE(YY_NO_LEAKS)
1004 dnl ---------------------------------------------------------------------------
1005 dnl CF_ENABLE_WARNINGS version: 4 updated: 2009/07/26 17:53:03
1006 dnl ------------------
1007 dnl Configure-option to enable gcc warnings
1008 AC_DEFUN([CF_ENABLE_WARNINGS],[
1009 if ( test "$GCC" = yes || test "$GXX" = yes )
1011 AC_MSG_CHECKING(if you want to turn on gcc warnings)
1012 CF_ARG_ENABLE(warnings,
1013 [ --enable-warnings test: turn on gcc compiler warnings],
1014 [with_warnings=yes],
1016 AC_MSG_RESULT($with_warnings)
1017 if test "$with_warnings" = "yes"
1024 dnl ---------------------------------------------------------------------------
1025 dnl CF_FIND_LIBRARY version: 9 updated: 2008/03/23 14:48:54
1027 dnl Look for a non-standard library, given parameters for AC_TRY_LINK. We
1028 dnl prefer a standard location, and use -L options only if we do not find the
1029 dnl library in the standard library location(s).
1030 dnl $1 = library name
1031 dnl $2 = library class, usually the same as library name
1033 dnl $4 = code fragment to compile/link
1034 dnl $5 = corresponding function-name
1035 dnl $6 = flag, nonnull if failure should not cause an error-exit
1037 dnl Sets the variable "$cf_libdir" as a side-effect, so we can see if we had
1038 dnl to use a -L option.
1039 AC_DEFUN([CF_FIND_LIBRARY],
1041 eval 'cf_cv_have_lib_'$1'=no'
1044 eval 'cf_cv_have_lib_'$1'=yes',[
1045 cf_save_LIBS="$LIBS"
1046 AC_MSG_CHECKING(for $5 in -l$1)
1048 AC_TRY_LINK([$3],[$4],
1050 eval 'cf_cv_have_lib_'$1'=yes'
1053 CF_LIBRARY_PATH(cf_search,$2)
1054 for cf_libdir in $cf_search
1056 AC_MSG_CHECKING(for -l$1 in $cf_libdir)
1057 LIBS="-L$cf_libdir -l$1 $cf_save_LIBS"
1058 AC_TRY_LINK([$3],[$4],
1060 eval 'cf_cv_have_lib_'$1'=yes'
1063 LIBS="$cf_save_LIBS"])
1067 eval 'cf_found_library=[$]cf_cv_have_lib_'$1
1069 if test $cf_found_library = no ; then
1070 AC_MSG_ERROR(Cannot link $1 library)
1074 dnl ---------------------------------------------------------------------------
1075 dnl CF_FIND_LINKAGE version: 19 updated: 2010/05/29 16:31:02
1077 dnl Find a library (specifically the linkage used in the code fragment),
1078 dnl searching for it if it is not already in the library path.
1079 dnl See also CF_ADD_SEARCHPATH.
1081 dnl Parameters (4-on are optional):
1082 dnl $1 = headers for library entrypoint
1083 dnl $2 = code fragment for library entrypoint
1084 dnl $3 = the library name without the "-l" option or ".so" suffix.
1085 dnl $4 = action to perform if successful (default: update CPPFLAGS, etc)
1086 dnl $5 = action to perform if not successful
1087 dnl $6 = module name, if not the same as the library name
1088 dnl $7 = extra libraries
1090 dnl Sets these variables:
1091 dnl $cf_cv_find_linkage_$3 - yes/no according to whether linkage is found
1092 dnl $cf_cv_header_path_$3 - include-directory if needed
1093 dnl $cf_cv_library_path_$3 - library-directory if needed
1094 dnl $cf_cv_library_file_$3 - library-file if needed, e.g., -l$3
1095 AC_DEFUN([CF_FIND_LINKAGE],[
1097 # If the linkage is not already in the $CPPFLAGS/$LDFLAGS configuration, these
1098 # will be set on completion of the AC_TRY_LINK below.
1099 cf_cv_header_path_$3=
1100 cf_cv_library_path_$3=
1102 CF_MSG_LOG([Starting [FIND_LINKAGE]($3,$6)])
1104 cf_save_LIBS="$LIBS"
1106 AC_TRY_LINK([$1],[$2],[
1107 cf_cv_find_linkage_$3=yes
1108 cf_cv_header_path_$3=/usr/include
1109 cf_cv_library_path_$3=/usr/lib
1112 LIBS="-l$3 $7 $cf_save_LIBS"
1114 AC_TRY_LINK([$1],[$2],[
1115 cf_cv_find_linkage_$3=yes
1116 cf_cv_header_path_$3=/usr/include
1117 cf_cv_library_path_$3=/usr/lib
1118 cf_cv_library_file_$3="-l$3"
1120 cf_cv_find_linkage_$3=no
1121 LIBS="$cf_save_LIBS"
1123 CF_VERBOSE(find linkage for $3 library)
1124 CF_MSG_LOG([Searching for headers in [FIND_LINKAGE]($3,$6)])
1126 cf_save_CPPFLAGS="$CPPFLAGS"
1127 cf_test_CPPFLAGS="$CPPFLAGS"
1129 CF_HEADER_PATH(cf_search,ifelse([$6],,[$3],[$6]))
1130 for cf_cv_header_path_$3 in $cf_search
1132 if test -d $cf_cv_header_path_$3 ; then
1133 CF_VERBOSE(... testing $cf_cv_header_path_$3)
1134 CPPFLAGS="$cf_save_CPPFLAGS -I$cf_cv_header_path_$3"
1135 AC_TRY_COMPILE([$1],[$2],[
1136 CF_VERBOSE(... found $3 headers in $cf_cv_header_path_$3)
1137 cf_cv_find_linkage_$3=maybe
1138 cf_test_CPPFLAGS="$CPPFLAGS"
1140 CPPFLAGS="$cf_save_CPPFLAGS"
1145 if test "$cf_cv_find_linkage_$3" = maybe ; then
1147 CF_MSG_LOG([Searching for $3 library in [FIND_LINKAGE]($3,$6)])
1149 cf_save_LIBS="$LIBS"
1150 cf_save_LDFLAGS="$LDFLAGS"
1153 CPPFLAGS="$cf_test_CPPFLAGS"
1154 LIBS="-l$3 $7 $cf_save_LIBS"
1155 AC_TRY_LINK([$1],[$2],[
1156 CF_VERBOSE(... found $3 library in system)
1157 cf_cv_find_linkage_$3=yes])
1158 CPPFLAGS="$cf_save_CPPFLAGS"
1159 LIBS="$cf_save_LIBS"
1162 if test "$cf_cv_find_linkage_$3" != yes ; then
1163 CF_LIBRARY_PATH(cf_search,$3)
1164 for cf_cv_library_path_$3 in $cf_search
1166 if test -d $cf_cv_library_path_$3 ; then
1167 CF_VERBOSE(... testing $cf_cv_library_path_$3)
1168 CPPFLAGS="$cf_test_CPPFLAGS"
1169 LIBS="-l$3 $7 $cf_save_LIBS"
1170 LDFLAGS="$cf_save_LDFLAGS -L$cf_cv_library_path_$3"
1171 AC_TRY_LINK([$1],[$2],[
1172 CF_VERBOSE(... found $3 library in $cf_cv_library_path_$3)
1173 cf_cv_find_linkage_$3=yes
1174 cf_cv_library_file_$3="-l$3"
1176 CPPFLAGS="$cf_save_CPPFLAGS"
1177 LIBS="$cf_save_LIBS"
1178 LDFLAGS="$cf_save_LDFLAGS"
1182 CPPFLAGS="$cf_save_CPPFLAGS"
1183 LDFLAGS="$cf_save_LDFLAGS"
1187 cf_cv_find_linkage_$3=no
1192 LIBS="$cf_save_LIBS"
1194 if test "$cf_cv_find_linkage_$3" = yes ; then
1196 CF_ADD_INCDIR($cf_cv_header_path_$3)
1197 CF_ADD_LIBDIR($cf_cv_library_path_$3)
1201 ifelse([$5],,AC_MSG_WARN(Cannot find $3 library),[$5])
1204 dnl ---------------------------------------------------------------------------
1205 dnl CF_FUNC_CURSES_VERSION version: 5 updated: 2010/10/23 15:54:49
1206 dnl ----------------------
1207 dnl Solaris has a data item 'curses_version', which confuses AC_CHECK_FUNCS.
1208 dnl It's a character string "SVR4", not documented.
1209 AC_DEFUN([CF_FUNC_CURSES_VERSION],
1211 AC_CACHE_CHECK(for function curses_version, cf_cv_func_curses_version,[
1213 #include <${cf_cv_ncurses_header:-curses.h}>
1217 sprintf(temp, "%s\n", curses_version());
1218 ${cf_cv_main_return:-return}(0);
1220 ,[cf_cv_func_curses_version=yes]
1221 ,[cf_cv_func_curses_version=no]
1222 ,[cf_cv_func_curses_version=unknown])
1224 test "$cf_cv_func_curses_version" = yes && AC_DEFINE(HAVE_CURSES_VERSION)
1226 dnl ---------------------------------------------------------------------------
1227 dnl CF_GCC_ATTRIBUTES version: 14 updated: 2010/10/23 15:52:32
1228 dnl -----------------
1229 dnl Test for availability of useful gcc __attribute__ directives to quiet
1230 dnl compiler warnings. Though useful, not all are supported -- and contrary
1231 dnl to documentation, unrecognized directives cause older compilers to barf.
1232 AC_DEFUN([CF_GCC_ATTRIBUTES],
1234 if test "$GCC" = yes
1236 cat > conftest.i <<EOF
1238 #define GCC_PRINTF 0
1243 #ifndef GCC_NORETURN
1244 #define GCC_NORETURN /* nothing */
1247 #define GCC_UNUSED /* nothing */
1250 if test "$GCC" = yes
1252 AC_CHECKING([for $CC __attribute__ directives])
1253 cat > conftest.$ac_ext <<EOF
1254 #line __oline__ "${as_me:-configure}"
1255 #include "confdefs.h"
1256 #include "conftest.h"
1257 #include "conftest.i"
1259 #define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
1261 #define GCC_PRINTFLIKE(fmt,var) /*nothing*/
1264 #define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var)))
1266 #define GCC_SCANFLIKE(fmt,var) /*nothing*/
1268 extern void wow(char *,...) GCC_SCANFLIKE(1,2);
1269 extern void oops(char *,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN;
1270 extern void foo(void) GCC_NORETURN;
1271 int main(int argc GCC_UNUSED, char *argv[[]] GCC_UNUSED) { return 0; }
1273 cf_printf_attribute=no
1274 cf_scanf_attribute=no
1275 for cf_attribute in scanf printf unused noreturn
1277 CF_UPPER(cf_ATTRIBUTE,$cf_attribute)
1278 cf_directive="__attribute__(($cf_attribute))"
1279 echo "checking for $CC $cf_directive" 1>&AC_FD_CC
1281 case $cf_attribute in #(vi
1283 cf_printf_attribute=yes
1284 cat >conftest.h <<EOF
1285 #define GCC_$cf_ATTRIBUTE 1
1289 cf_scanf_attribute=yes
1290 cat >conftest.h <<EOF
1291 #define GCC_$cf_ATTRIBUTE 1
1295 cat >conftest.h <<EOF
1296 #define GCC_$cf_ATTRIBUTE $cf_directive
1301 if AC_TRY_EVAL(ac_compile); then
1302 test -n "$verbose" && AC_MSG_RESULT(... $cf_attribute)
1303 cat conftest.h >>confdefs.h
1304 case $cf_attribute in #(vi
1306 if test "$cf_printf_attribute" = no ; then
1307 cat >>confdefs.h <<EOF
1308 #define GCC_PRINTFLIKE(fmt,var) /* nothing */
1311 cat >>confdefs.h <<EOF
1312 #define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
1317 if test "$cf_scanf_attribute" = no ; then
1318 cat >>confdefs.h <<EOF
1319 #define GCC_SCANFLIKE(fmt,var) /* nothing */
1322 cat >>confdefs.h <<EOF
1323 #define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var)))
1331 fgrep define conftest.i >>confdefs.h
1336 dnl ---------------------------------------------------------------------------
1337 dnl CF_GCC_VERSION version: 5 updated: 2010/04/24 11:02:31
1339 dnl Find version of gcc
1340 AC_DEFUN([CF_GCC_VERSION],[
1341 AC_REQUIRE([AC_PROG_CC])
1343 if test "$GCC" = yes ; then
1344 AC_MSG_CHECKING(version of $CC)
1345 GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`"
1346 test -z "$GCC_VERSION" && GCC_VERSION=unknown
1347 AC_MSG_RESULT($GCC_VERSION)
1350 dnl ---------------------------------------------------------------------------
1351 dnl CF_GCC_WARNINGS version: 27 updated: 2010/10/23 15:52:32
1353 dnl Check if the compiler supports useful warning options. There's a few that
1354 dnl we don't use, simply because they're too noisy:
1356 dnl -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x)
1357 dnl -Wredundant-decls (system headers make this too noisy)
1358 dnl -Wtraditional (combines too many unrelated messages, only a few useful)
1359 dnl -Wwrite-strings (too noisy, but should review occasionally). This
1360 dnl is enabled for ncurses using "--enable-const".
1364 dnl $1 is an optional list of gcc warning flags that a particular
1365 dnl application might want to use, e.g., "no-unused" for
1368 dnl If $with_ext_const is "yes", add a check for -Wwrite-strings
1370 AC_DEFUN([CF_GCC_WARNINGS],
1372 AC_REQUIRE([CF_GCC_VERSION])
1373 CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS)
1375 cat > conftest.$ac_ext <<EOF
1376 #line __oline__ "${as_me:-configure}"
1377 int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; }
1380 if test "$INTEL_COMPILER" = yes
1382 # The "-wdXXX" options suppress warnings:
1383 # remark #1419: external declaration in primary source file
1384 # remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
1385 # remark #1684: conversion from pointer to same-sized integral type (potential portability problem)
1386 # remark #193: zero used for undefined preprocessing identifier
1387 # remark #593: variable "curs_sb_left_arrow" was set but never used
1388 # remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits
1389 # remark #869: parameter "tw" was never referenced
1390 # remark #981: operands are evaluated in unspecified order
1391 # warning #279: controlling expression is constant
1393 AC_CHECKING([for $CC warning options])
1394 cf_save_CFLAGS="$CFLAGS"
1395 EXTRA_CFLAGS="-Wall"
1407 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
1408 if AC_TRY_EVAL(ac_compile); then
1409 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
1410 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
1413 CFLAGS="$cf_save_CFLAGS"
1415 elif test "$GCC" = yes
1417 AC_CHECKING([for $CC warning options])
1418 cf_save_CFLAGS="$CFLAGS"
1421 test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings"
1422 for cf_opt in W Wall \
1423 Wbad-function-cast \
1427 Wmissing-declarations \
1428 Wmissing-prototypes \
1432 Wstrict-prototypes \
1433 Wundef $cf_warn_CONST $1
1435 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
1436 if AC_TRY_EVAL(ac_compile); then
1437 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
1438 case $cf_opt in #(vi
1440 CPPFLAGS="$CPPFLAGS -DXTSTRINGDEFINES"
1443 case $GCC_VERSION in
1445 CF_VERBOSE(feature is broken in gcc $GCC_VERSION)
1450 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
1453 CFLAGS="$cf_save_CFLAGS"
1457 AC_SUBST(EXTRA_CFLAGS)
1459 dnl ---------------------------------------------------------------------------
1460 dnl CF_GETOPT_HEADER version: 4 updated: 2009/08/31 20:07:52
1461 dnl ----------------
1462 dnl Check for getopt's variables which are commonly defined in stdlib.h,
1463 dnl unistd.h or (nonstandard) in getopt.h
1464 AC_DEFUN([CF_GETOPT_HEADER],
1466 AC_HAVE_HEADERS(unistd.h getopt.h)
1467 AC_CACHE_CHECK(for header declaring getopt variables,cf_cv_getopt_header,[
1468 cf_cv_getopt_header=none
1469 for cf_header in stdio.h stdlib.h unistd.h getopt.h
1472 #include <$cf_header>],
1473 [int x = optind; char *y = optarg],
1474 [cf_cv_getopt_header=$cf_header
1478 if test $cf_cv_getopt_header != none ; then
1479 AC_DEFINE(HAVE_GETOPT_HEADER)
1482 dnl ---------------------------------------------------------------------------
1483 dnl CF_GNU_SOURCE version: 6 updated: 2005/07/09 13:23:07
1485 dnl Check if we must define _GNU_SOURCE to get a reasonable value for
1486 dnl _XOPEN_SOURCE, upon which many POSIX definitions depend. This is a defect
1487 dnl (or misfeature) of glibc2, which breaks portability of many applications,
1488 dnl since it is interwoven with GNU extensions.
1490 dnl Well, yes we could work around it...
1491 AC_DEFUN([CF_GNU_SOURCE],
1493 AC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[
1494 AC_TRY_COMPILE([#include <sys/types.h>],[
1495 #ifndef _XOPEN_SOURCE
1498 [cf_cv_gnu_source=no],
1499 [cf_save="$CPPFLAGS"
1500 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
1501 AC_TRY_COMPILE([#include <sys/types.h>],[
1502 #ifdef _XOPEN_SOURCE
1505 [cf_cv_gnu_source=no],
1506 [cf_cv_gnu_source=yes])
1510 test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
1512 dnl ---------------------------------------------------------------------------
1513 dnl CF_HEADER_PATH version: 12 updated: 2010/05/05 05:22:40
1515 dnl Construct a search-list of directories for a nonstandard header-file
1518 dnl $1 = the variable to return as result
1519 dnl $2 = the package name
1520 AC_DEFUN([CF_HEADER_PATH],
1524 # collect the current set of include-directories from compiler flags
1525 cf_header_path_list=""
1526 if test -n "${CFLAGS}${CPPFLAGS}" ; then
1527 for cf_header_path in $CPPFLAGS $CFLAGS
1529 case $cf_header_path in #(vi
1531 cf_header_path=`echo ".$cf_header_path" |sed -e 's/^...//' -e 's,/include$,,'`
1532 CF_ADD_SUBDIR_PATH($1,$2,include,$cf_header_path,NONE)
1533 cf_header_path_list="$cf_header_path_list [$]$1"
1539 # add the variations for the package we are looking for
1540 CF_SUBDIR_PATH($1,$2,include)
1542 test "$includedir" != NONE && \
1543 test "$includedir" != "/usr/include" && \
1544 test -d "$includedir" && {
1545 test -d $includedir && $1="[$]$1 $includedir"
1546 test -d $includedir/$2 && $1="[$]$1 $includedir/$2"
1549 test "$oldincludedir" != NONE && \
1550 test "$oldincludedir" != "/usr/include" && \
1551 test -d "$oldincludedir" && {
1552 test -d $oldincludedir && $1="[$]$1 $oldincludedir"
1553 test -d $oldincludedir/$2 && $1="[$]$1 $oldincludedir/$2"
1556 $1="[$]$1 $cf_header_path_list"
1558 dnl ---------------------------------------------------------------------------
1559 dnl CF_INHERIT_SCRIPT version: 2 updated: 2003/03/01 23:50:42
1560 dnl -----------------
1561 dnl If we do not have a given script, look for it in the parent directory.
1562 AC_DEFUN([CF_INHERIT_SCRIPT],
1564 test -f $1 || ( test -f ../$1 && cp ../$1 ./ )
1566 dnl ---------------------------------------------------------------------------
1567 dnl CF_INTEL_COMPILER version: 4 updated: 2010/05/26 05:38:42
1568 dnl -----------------
1569 dnl Check if the given compiler is really the Intel compiler for Linux. It
1570 dnl tries to imitate gcc, but does not return an error when it finds a mismatch
1571 dnl between prototypes, e.g., as exercised by CF_MISSING_CHECK.
1573 dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to
1574 dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from
1575 dnl the wrappers for gcc and g++ warnings.
1577 dnl $1 = GCC (default) or GXX
1578 dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS
1579 dnl $3 = CFLAGS (default) or CXXFLAGS
1580 AC_DEFUN([CF_INTEL_COMPILER],[
1581 ifelse([$2],,INTEL_COMPILER,[$2])=no
1583 if test "$ifelse([$1],,[$1],GCC)" = yes ; then
1586 AC_MSG_CHECKING(if this is really Intel ifelse([$1],GXX,C++,C) compiler)
1587 cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])"
1588 ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -no-gcc"
1590 #ifdef __INTEL_COMPILER
1594 ],[ifelse([$2],,INTEL_COMPILER,[$2])=yes
1595 cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc"
1597 ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS"
1598 AC_MSG_RESULT($ifelse([$2],,INTEL_COMPILER,[$2]))
1603 dnl ---------------------------------------------------------------------------
1604 dnl CF_LIBRARY_PATH version: 9 updated: 2010/03/28 12:52:50
1606 dnl Construct a search-list of directories for a nonstandard library-file
1609 dnl $1 = the variable to return as result
1610 dnl $2 = the package name
1611 AC_DEFUN([CF_LIBRARY_PATH],
1614 cf_library_path_list=""
1615 if test -n "${LDFLAGS}${LIBS}" ; then
1616 for cf_library_path in $LDFLAGS $LIBS
1618 case $cf_library_path in #(vi
1620 cf_library_path=`echo ".$cf_library_path" |sed -e 's/^...//' -e 's,/lib$,,'`
1621 CF_ADD_SUBDIR_PATH($1,$2,lib,$cf_library_path,NONE)
1622 cf_library_path_list="$cf_library_path_list [$]$1"
1628 CF_SUBDIR_PATH($1,$2,lib)
1630 $1="$cf_library_path_list [$]$1"
1632 dnl ---------------------------------------------------------------------------
1633 dnl CF_MAKE_TAGS version: 6 updated: 2010/10/23 15:52:32
1635 dnl Generate tags/TAGS targets for makefiles. Do not generate TAGS if we have
1636 dnl a monocase filesystem.
1637 AC_DEFUN([CF_MAKE_TAGS],[
1638 AC_REQUIRE([CF_MIXEDCASE_FILENAMES])
1640 AC_CHECK_PROGS(CTAGS, exctags ctags)
1641 AC_CHECK_PROGS(ETAGS, exetags etags)
1643 AC_CHECK_PROG(MAKE_LOWER_TAGS, ${CTAGS:-ctags}, yes, no)
1645 if test "$cf_cv_mixedcase" = yes ; then
1646 AC_CHECK_PROG(MAKE_UPPER_TAGS, ${ETAGS:-etags}, yes, no)
1651 if test "$MAKE_UPPER_TAGS" = yes ; then
1657 if test "$MAKE_LOWER_TAGS" = yes ; then
1666 AC_SUBST(MAKE_UPPER_TAGS)
1667 AC_SUBST(MAKE_LOWER_TAGS)
1669 dnl ---------------------------------------------------------------------------
1670 dnl CF_MATH_LIB version: 8 updated: 2010/05/29 16:31:02
1672 dnl Checks for libraries. At least one UNIX system, Apple Macintosh
1673 dnl Rhapsody 5.5, does not have -lm. We cannot use the simpler
1674 dnl AC_CHECK_LIB(m,sin), because that fails for C++.
1675 AC_DEFUN([CF_MATH_LIB],
1677 AC_CACHE_CHECK(if -lm needed for math functions,
1683 [double x = rand(); printf("result = %g\n", ]ifelse([$2],,sin(x),$2)[)],
1684 [cf_cv_need_libm=no],
1685 [cf_cv_need_libm=yes])])
1686 if test "$cf_cv_need_libm" = yes
1693 dnl ---------------------------------------------------------------------------
1694 dnl CF_MIN_GETCCHAR version: 3 updated: 2010/10/23 15:54:49
1697 dnl Check whether getcchar's return value counts the trailing null in a wchar_t
1698 dnl string, or not. X/Open says it does, but Tru64 and Solaris do not do this.
1699 AC_DEFUN([CF_MIN_GETCCHAR],[
1700 AC_CACHE_CHECK(if getcchar counts trailing null,cf_cv_min_getcchar,[
1704 #include <${cf_cv_ncurses_header:-curses.h}>
1712 setcchar(temp, data, 0, 0, (void *)0);
1713 count = getcchar(temp, (wchar_t *)0, (attr_t *)0, (short *)0, (void *)0);
1714 ${cf_cv_main_return:-return}(count != 0);
1716 [cf_cv_min_getcchar=no],
1717 [cf_cv_min_getcchar=yes],
1718 [cf_cv_min_getcchar=yes])
1720 if test "$cf_cv_min_getcchar" = yes ; then
1721 AC_DEFINE(MIN_GETCCHAR,1)
1724 dnl ---------------------------------------------------------------------------
1725 dnl CF_MIXEDCASE_FILENAMES version: 3 updated: 2003/09/20 17:07:55
1726 dnl ----------------------
1727 dnl Check if the file-system supports mixed-case filenames. If we're able to
1728 dnl create a lowercase name and see it as uppercase, it doesn't support that.
1729 AC_DEFUN([CF_MIXEDCASE_FILENAMES],
1731 AC_CACHE_CHECK(if filesystem supports mixed-case filenames,cf_cv_mixedcase,[
1732 if test "$cross_compiling" = yes ; then
1733 case $target_alias in #(vi
1734 *-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-mingw32*|*-uwin*) #(vi
1742 rm -f conftest CONFTEST
1744 if test -f CONFTEST ; then
1749 rm -f conftest CONFTEST
1752 test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES)
1754 dnl ---------------------------------------------------------------------------
1755 dnl CF_MSG_LOG version: 5 updated: 2010/10/23 15:52:32
1757 dnl Write a debug message to config.log, along with the line number in the
1758 dnl configure script.
1759 AC_DEFUN([CF_MSG_LOG],[
1760 echo "${as_me:-configure}:__oline__: testing $* ..." 1>&AC_FD_CC
1762 dnl ---------------------------------------------------------------------------
1763 dnl CF_NCURSES_CC_CHECK version: 4 updated: 2007/07/29 10:39:05
1764 dnl -------------------
1765 dnl Check if we can compile with ncurses' header file
1766 dnl $1 is the cache variable to set
1767 dnl $2 is the header-file to include
1768 dnl $3 is the root name (ncurses or ncursesw)
1769 AC_DEFUN([CF_NCURSES_CC_CHECK],[
1771 ]ifelse($3,ncursesw,[
1772 #define _XOPEN_SOURCE_EXTENDED
1773 #undef HAVE_LIBUTF8_H /* in case we used CF_UTF8_LIB */
1774 #define HAVE_LIBUTF8_H /* to force ncurses' header file to use cchar_t */
1777 #ifdef NCURSES_VERSION
1778 ]ifelse($3,ncursesw,[
1783 printf("%s\n", NCURSES_VERSION);
1795 dnl ---------------------------------------------------------------------------
1796 dnl CF_NCURSES_CONFIG version: 8 updated: 2010/07/08 05:17:30
1797 dnl -----------------
1798 dnl Tie together the configure-script macros for ncurses.
1799 dnl Prefer the "-config" script from ncurses 6.x, to simplify analysis.
1800 dnl Allow that to be overridden using the $NCURSES_CONFIG environment variable.
1802 dnl $1 is the root library name (default: "ncurses")
1803 AC_DEFUN([CF_NCURSES_CONFIG],
1805 cf_ncuconfig_root=ifelse($1,,ncurses,$1)
1807 echo "Looking for ${cf_ncuconfig_root}-config"
1808 AC_PATH_PROGS(NCURSES_CONFIG,${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config,none)
1810 if test "$NCURSES_CONFIG" != none ; then
1812 CPPFLAGS="$CPPFLAGS `$NCURSES_CONFIG --cflags`"
1813 CF_ADD_LIBS(`$NCURSES_CONFIG --libs`)
1815 # even with config script, some packages use no-override for curses.h
1816 CF_CURSES_HEADER(ifelse($1,,ncurses,$1))
1818 dnl like CF_NCURSES_CPPFLAGS
1821 dnl like CF_NCURSES_LIBS
1822 CF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_ncuconfig_root)
1823 AC_DEFINE_UNQUOTED($cf_nculib_ROOT)
1825 dnl like CF_NCURSES_VERSION
1826 cf_cv_ncurses_version=`$NCURSES_CONFIG --version`
1830 CF_NCURSES_CPPFLAGS(ifelse($1,,ncurses,$1))
1831 CF_NCURSES_LIBS(ifelse($1,,ncurses,$1))
1835 dnl ---------------------------------------------------------------------------
1836 dnl CF_NCURSES_CPPFLAGS version: 20 updated: 2010/11/20 17:02:38
1837 dnl -------------------
1838 dnl Look for the SVr4 curses clone 'ncurses' in the standard places, adjusting
1839 dnl the CPPFLAGS variable so we can include its header.
1841 dnl The header files may be installed as either curses.h, or ncurses.h (would
1842 dnl be obsolete, except that some packagers prefer this name to distinguish it
1843 dnl from a "native" curses implementation). If not installed for overwrite,
1844 dnl the curses.h file would be in an ncurses subdirectory (e.g.,
1845 dnl /usr/include/ncurses), but someone may have installed overwriting the
1846 dnl vendor's curses. Only very old versions (pre-1.9.2d, the first autoconf'd
1847 dnl version) of ncurses don't define either __NCURSES_H or NCURSES_VERSION in
1850 dnl If the installer has set $CFLAGS or $CPPFLAGS so that the ncurses header
1851 dnl is already in the include-path, don't even bother with this, since we cannot
1852 dnl easily determine which file it is. In this case, it has to be <curses.h>.
1854 dnl The optional parameter gives the root name of the library, in case it is
1855 dnl not installed as the default curses library. That is how the
1856 dnl wide-character version of ncurses is installed.
1857 AC_DEFUN([CF_NCURSES_CPPFLAGS],
1858 [AC_REQUIRE([CF_WITH_CURSES_DIR])
1860 AC_PROVIDE([CF_CURSES_CPPFLAGS])dnl
1861 cf_ncuhdr_root=ifelse($1,,ncurses,$1)
1863 test -n "$cf_cv_curses_dir" && \
1864 test "$cf_cv_curses_dir" != "no" && { \
1865 CF_ADD_INCDIR($cf_cv_curses_dir/include/$cf_ncuhdr_root)
1868 AC_CACHE_CHECK(for $cf_ncuhdr_root header in include-path, cf_cv_ncurses_h,[
1869 cf_header_list="$cf_ncuhdr_root/curses.h $cf_ncuhdr_root/ncurses.h"
1870 ( test "$cf_ncuhdr_root" = ncurses || test "$cf_ncuhdr_root" = ncursesw ) && cf_header_list="$cf_header_list curses.h ncurses.h"
1871 for cf_header in $cf_header_list
1873 CF_NCURSES_CC_CHECK(cf_cv_ncurses_h,$cf_header,$1)
1874 test "$cf_cv_ncurses_h" != no && break
1881 # some applications need this, but should check for NCURSES_VERSION
1886 dnl ---------------------------------------------------------------------------
1887 dnl CF_NCURSES_EXT_FUNCS version: 3 updated: 2010/11/13 19:43:23
1888 dnl --------------------
1889 dnl Since 2007/11/17, ncurses has defined NCURSES_EXT_FUNCS; earlier versions
1890 dnl may provide these functions. Define the symbol if it is not defined, and
1892 AC_DEFUN([CF_NCURSES_EXT_FUNCS],
1894 AC_CACHE_CHECK(for ncurses extended functions,cf_cv_ncurses_ext_funcs,[
1896 #include <${cf_cv_ncurses_header:-curses.h}>],
1898 int x = NCURSES_EXT_FUNCS
1899 ],[cf_cv_ncurses_ext_funcs=defined],[
1901 #include <${cf_cv_ncurses_header:-curses.h}>],
1903 (void) assume_default_colors (0, 0);
1904 (void) curses_version ();
1905 (void) define_key (0, 0);
1906 (void) is_term_resized (0, 0);
1907 (void) key_defined (0);
1908 (void) keybound (0, 0);
1909 (void) keyok (0, 0);
1910 (void) resize_term (0, 0);
1911 (void) resizeterm (0, 0);
1912 (void) use_default_colors ();
1913 (void) use_extended_names (0);
1914 (void) wresize (0, 0, 0);],
1915 [cf_cv_ncurses_ext_funcs=yes],
1916 [cf_cv_ncurses_ext_funcs=no])
1919 test "$cf_cv_ncurses_ext_funcs" = yes && AC_DEFINE(NCURSES_EXT_FUNCS)
1921 dnl ---------------------------------------------------------------------------
1922 dnl CF_NCURSES_HEADER version: 2 updated: 2008/03/23 14:48:54
1923 dnl -----------------
1924 dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common
1925 dnl variations of ncurses' installs.
1927 dnl See also CF_CURSES_HEADER, which sets the same cache variable.
1928 AC_DEFUN([CF_NCURSES_HEADER],[
1930 if test "$cf_cv_ncurses_h" != no ; then
1931 cf_cv_ncurses_header=$cf_cv_ncurses_h
1934 AC_CACHE_CHECK(for $cf_ncuhdr_root include-path, cf_cv_ncurses_h2,[
1935 test -n "$verbose" && echo
1936 CF_HEADER_PATH(cf_search,$cf_ncuhdr_root)
1937 test -n "$verbose" && echo search path $cf_search
1938 cf_save2_CPPFLAGS="$CPPFLAGS"
1939 for cf_incdir in $cf_search
1941 CF_ADD_INCDIR($cf_incdir)
1946 CF_NCURSES_CC_CHECK(cf_cv_ncurses_h2,$cf_header,$1)
1947 if test "$cf_cv_ncurses_h2" != no ; then
1948 cf_cv_ncurses_h2=$cf_incdir/$cf_header
1949 test -n "$verbose" && echo $ac_n " ... found $ac_c" 1>&AC_FD_MSG
1952 test -n "$verbose" && echo " ... tested $cf_incdir/$cf_header" 1>&AC_FD_MSG
1954 CPPFLAGS="$cf_save2_CPPFLAGS"
1955 test "$cf_cv_ncurses_h2" != no && break
1957 test "$cf_cv_ncurses_h2" = no && AC_MSG_ERROR(not found)
1960 CF_DIRNAME(cf_1st_incdir,$cf_cv_ncurses_h2)
1961 cf_cv_ncurses_header=`basename $cf_cv_ncurses_h2`
1962 if test `basename $cf_1st_incdir` = $cf_ncuhdr_root ; then
1963 cf_cv_ncurses_header=$cf_ncuhdr_root/$cf_cv_ncurses_header
1965 CF_ADD_INCDIR($cf_1st_incdir)
1969 # Set definitions to allow ifdef'ing for ncurses.h
1971 case $cf_cv_ncurses_header in # (vi
1973 AC_DEFINE(HAVE_NCURSES_H)
1977 case $cf_cv_ncurses_header in # (vi
1978 ncurses/curses.h|ncurses/ncurses.h)
1979 AC_DEFINE(HAVE_NCURSES_NCURSES_H)
1981 ncursesw/curses.h|ncursesw/ncurses.h)
1982 AC_DEFINE(HAVE_NCURSESW_NCURSES_H)
1987 dnl ---------------------------------------------------------------------------
1988 dnl CF_NCURSES_LIBS version: 16 updated: 2010/11/20 17:02:38
1990 dnl Look for the ncurses library. This is a little complicated on Linux,
1991 dnl because it may be linked with the gpm (general purpose mouse) library.
1992 dnl Some distributions have gpm linked with (bsd) curses, which makes it
1993 dnl unusable with ncurses. However, we don't want to link with gpm unless
1994 dnl ncurses has a dependency, since gpm is normally set up as a shared library,
1995 dnl and the linker will record a dependency.
1997 dnl The optional parameter gives the root name of the library, in case it is
1998 dnl not installed as the default curses library. That is how the
1999 dnl wide-character version of ncurses is installed.
2000 AC_DEFUN([CF_NCURSES_LIBS],
2001 [AC_REQUIRE([CF_NCURSES_CPPFLAGS])
2003 cf_nculib_root=ifelse($1,,ncurses,$1)
2004 # This works, except for the special case where we find gpm, but
2005 # ncurses is in a nonstandard location via $LIBS, and we really want
2008 cf_ncurses_SAVE="$LIBS"
2009 AC_CHECK_LIB(gpm,Gpm_Open,
2010 [AC_CHECK_LIB(gpm,initscr,
2011 [LIBS="$cf_ncurses_SAVE"],
2012 [cf_ncurses_LIBS="-lgpm"])])
2014 case $host_os in #(vi
2016 # This is only necessary if you are linking against an obsolete
2017 # version of ncurses (but it should do no harm, since it's static).
2018 if test "$cf_nculib_root" = ncurses ; then
2019 AC_CHECK_LIB(mytinfo,tgoto,[cf_ncurses_LIBS="-lmytinfo $cf_ncurses_LIBS"])
2024 CF_ADD_LIBS($cf_ncurses_LIBS)
2026 if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" )
2028 CF_ADD_LIBS(-l$cf_nculib_root)
2030 CF_FIND_LIBRARY($cf_nculib_root,$cf_nculib_root,
2031 [#include <${cf_cv_ncurses_header:-curses.h}>],
2036 if test -n "$cf_ncurses_LIBS" ; then
2037 AC_MSG_CHECKING(if we can link $cf_nculib_root without $cf_ncurses_LIBS)
2038 cf_ncurses_SAVE="$LIBS"
2039 for p in $cf_ncurses_LIBS ; do
2040 q=`echo $LIBS | sed -e "s%$p %%" -e "s%$p$%%"`
2041 if test "$q" != "$LIBS" ; then
2045 AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>],
2046 [initscr(); mousemask(0,0); tgoto((char *)0, 0, 0);],
2047 [AC_MSG_RESULT(yes)],
2049 LIBS="$cf_ncurses_SAVE"])
2052 CF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_nculib_root)
2053 AC_DEFINE_UNQUOTED($cf_nculib_ROOT)
2055 dnl ---------------------------------------------------------------------------
2056 dnl CF_NCURSES_VERSION version: 13 updated: 2010/10/23 15:54:49
2057 dnl ------------------
2058 dnl Check for the version of ncurses, to aid in reporting bugs, etc.
2059 dnl Call CF_CURSES_CPPFLAGS first, or CF_NCURSES_CPPFLAGS. We don't use
2060 dnl AC_REQUIRE since that does not work with the shell's if/then/else/fi.
2061 AC_DEFUN([CF_NCURSES_VERSION],
2063 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
2064 AC_CACHE_CHECK(for ncurses version, cf_cv_ncurses_version,[
2065 cf_cv_ncurses_version=no
2069 #include <${cf_cv_ncurses_header:-curses.h}>
2073 FILE *fp = fopen("$cf_tempfile", "w");
2074 #ifdef NCURSES_VERSION
2075 # ifdef NCURSES_VERSION_PATCH
2076 fprintf(fp, "%s.%d\n", NCURSES_VERSION, NCURSES_VERSION_PATCH);
2078 fprintf(fp, "%s\n", NCURSES_VERSION);
2082 fprintf(fp, "old\n");
2087 ${cf_cv_main_return:-return}(0);
2089 cf_cv_ncurses_version=`cat $cf_tempfile`],,[
2091 # This will not work if the preprocessor splits the line after the
2092 # Autoconf token. The 'unproto' program does that.
2093 cat > conftest.$ac_ext <<EOF
2094 #include <${cf_cv_ncurses_header:-curses.h}>
2096 #ifdef NCURSES_VERSION
2097 Autoconf NCURSES_VERSION
2105 cf_try="$ac_cpp conftest.$ac_ext 2>&AC_FD_CC | grep '^Autoconf ' >conftest.out"
2107 if test -f conftest.out ; then
2108 cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[[^"]]*"%%' -e 's%".*%%'`
2109 test -n "$cf_out" && cf_cv_ncurses_version="$cf_out"
2115 test "$cf_cv_ncurses_version" = no || AC_DEFINE(NCURSES)
2117 dnl ---------------------------------------------------------------------------
2118 dnl CF_NCURSES_WRAP_PREFIX version: 1 updated: 2009/03/28 16:08:10
2119 dnl ----------------------
2120 dnl Check for ncurses "wrap-prefix" used for public variables which have been
2121 dnl wrapped with a function to help with concurrency control.
2122 AC_DEFUN([CF_NCURSES_WRAP_PREFIX],
2124 AC_MSG_CHECKING(for ncurses wrap-prefix)
2125 AC_ARG_WITH(ncurses-wrap-prefix,
2126 [ --with-ncurses-wrap-prefix naming-prefix for ncurses wrapped-variables],
2127 [NCURSES_WRAP_PREFIX=$withval],
2128 [NCURSES_WRAP_PREFIX=_nc_])
2129 AC_MSG_RESULT($NCURSES_WRAP_PREFIX)
2131 AC_SUBST(NCURSES_WRAP_PREFIX)
2133 dnl ---------------------------------------------------------------------------
2134 dnl CF_NETBSD_FORM_H version: 1 updated: 2011/01/15 14:59:18
2135 dnl ----------------
2136 dnl Check for NetBSD's form.h, which is incompatible with SVr4 and ncurses.
2137 dnl Some workarounds are needed in client programs to allow them to compile.
2138 AC_DEFUN([CF_NETBSD_FORM_H],[
2139 AC_CACHE_CHECK(for NetBSD form.h,cf_cv_netbsd_form_h,[
2141 #include <${cf_cv_ncurses_header:-curses.h}>
2145 int y = current_field(form)->cursor_ypos;
2146 int x = current_field(form)->cursor_xpos;
2147 ],[cf_cv_netbsd_form_h=yes
2148 ],[cf_cv_netbsd_form_h=no])
2151 test "$cf_cv_netbsd_form_h" = yes && AC_DEFINE(HAVE_NETBSD_FORM_H)
2153 dnl ---------------------------------------------------------------------------
2154 dnl CF_NETBSD_MENU_H version: 1 updated: 2011/01/15 14:59:18
2155 dnl ----------------
2156 dnl Check for NetBSD's menu.h, which is incompatible with SVr4 and ncurses.
2157 dnl Some workarounds are needed in client programs to allow them to compile.
2158 AC_DEFUN([CF_NETBSD_MENU_H],[
2159 AC_CACHE_CHECK(for NetBSD menu.h,cf_cv_netbsd_menu_h,[
2161 #include <${cf_cv_ncurses_header:-curses.h}>
2165 int y = menu->max_item_width;
2166 ],[cf_cv_netbsd_menu_h=yes
2167 ],[cf_cv_netbsd_menu_h=no])
2170 test "$cf_cv_netbsd_menu_h" = yes && AC_DEFINE(HAVE_NETBSD_MENU_H)
2172 dnl ---------------------------------------------------------------------------
2173 dnl CF_NO_LEAKS_OPTION version: 4 updated: 2006/12/16 14:24:05
2174 dnl ------------------
2175 dnl see CF_WITH_NO_LEAKS
2176 AC_DEFUN([CF_NO_LEAKS_OPTION],[
2177 AC_MSG_CHECKING(if you want to use $1 for testing)
2180 [AC_DEFINE($3)ifelse([$4],,[
2183 : ${with_cflags:=-g}
2184 : ${with_no_leaks:=yes}
2187 AC_MSG_RESULT(${with_$1:-no})
2189 case .$with_cflags in #(vi
2191 case .$CFLAGS in #(vi
2201 dnl ---------------------------------------------------------------------------
2202 dnl CF_PATH_SYNTAX version: 13 updated: 2010/05/26 05:38:42
2204 dnl Check the argument to see that it looks like a pathname. Rewrite it if it
2205 dnl begins with one of the prefix/exec_prefix variables, and then again if the
2206 dnl result begins with 'NONE'. This is necessary to work around autoconf's
2207 dnl delayed evaluation of those symbols.
2208 AC_DEFUN([CF_PATH_SYNTAX],[
2209 if test "x$prefix" != xNONE; then
2210 cf_path_syntax="$prefix"
2212 cf_path_syntax="$ac_default_prefix"
2215 case ".[$]$1" in #(vi
2216 .\[$]\(*\)*|.\'*\'*) #(vi
2220 .[[a-zA-Z]]:[[\\/]]*) #(vi OS/2 EMX
2222 .\[$]{*prefix}*) #(vi
2224 case ".[$]$1" in #(vi
2226 $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%`
2231 $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%`
2234 ifelse([$2],,[AC_MSG_ERROR([expected a pathname, not \"[$]$1\"])],$2)
2238 dnl ---------------------------------------------------------------------------
2239 dnl CF_PDCURSES_X11 version: 11 updated: 2011/01/15 18:45:38
2241 dnl Configure for PDCurses' X11 library
2242 AC_DEFUN([CF_PDCURSES_X11],[
2243 AC_REQUIRE([CF_X_ATHENA])
2245 AC_PATH_PROGS(XCURSES_CONFIG,xcurses-config,none)
2247 if test "$XCURSES_CONFIG" != none ; then
2249 CPPFLAGS="$CPPFLAGS `$XCURSES_CONFIG --cflags`"
2250 CF_ADD_LIBS(`$XCURSES_CONFIG --libs`)
2252 cf_cv_lib_XCurses=yes
2256 LDFLAGS="$LDFLAGS $X_LIBS"
2257 CF_CHECK_CFLAGS($X_CFLAGS)
2258 AC_CHECK_LIB(X11,XOpenDisplay,
2259 [CF_ADD_LIBS(-lX11)],,
2260 [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])
2261 AC_CACHE_CHECK(for XCurses library,cf_cv_lib_XCurses,[
2262 CF_ADD_LIBS(-lXCurses)
2264 #include <xcurses.h>
2265 char *XCursesProgramName = "test";
2267 [cf_cv_lib_XCurses=yes],
2268 [cf_cv_lib_XCurses=no])
2273 if test $cf_cv_lib_XCurses = yes ; then
2276 AC_CHECK_HEADER(xcurses.h, AC_DEFINE(HAVE_XCURSES))
2278 AC_MSG_ERROR(Cannot link with XCurses)
2281 dnl ---------------------------------------------------------------------------
2282 dnl CF_PKG_CONFIG version: 6 updated: 2011/04/17 06:36:21
2284 dnl Check for the package-config program, unless disabled by command-line.
2285 AC_DEFUN([CF_PKG_CONFIG],
2287 AC_MSG_CHECKING(if you want to use pkg-config)
2288 AC_ARG_WITH(pkg-config,
2289 [ --with-pkg-config{=path} enable/disable use of pkg-config],
2290 [cf_pkg_config=$withval],
2291 [cf_pkg_config=yes])
2292 AC_MSG_RESULT($cf_pkg_config)
2294 case $cf_pkg_config in #(vi
2299 AC_PATH_TOOL(PKG_CONFIG, pkg-config, none)
2306 test -z "$PKG_CONFIG" && PKG_CONFIG=none
2307 if test "$PKG_CONFIG" != none ; then
2308 CF_PATH_SYNTAX(PKG_CONFIG)
2311 AC_SUBST(PKG_CONFIG)
2313 dnl ---------------------------------------------------------------------------
2314 dnl CF_POSIX_C_SOURCE version: 8 updated: 2010/05/26 05:38:42
2315 dnl -----------------
2316 dnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed.
2318 dnl POSIX.1-1990 _POSIX_SOURCE
2319 dnl POSIX.1-1990 and _POSIX_SOURCE and
2320 dnl POSIX.2-1992 C-Language _POSIX_C_SOURCE=2
2322 dnl POSIX.1b-1993 _POSIX_C_SOURCE=199309L
2323 dnl POSIX.1c-1996 _POSIX_C_SOURCE=199506L
2324 dnl X/Open 2000 _POSIX_C_SOURCE=200112L
2327 dnl $1 is the nominal value for _POSIX_C_SOURCE
2328 AC_DEFUN([CF_POSIX_C_SOURCE],
2330 cf_POSIX_C_SOURCE=ifelse([$1],,199506L,[$1])
2332 cf_save_CFLAGS="$CFLAGS"
2333 cf_save_CPPFLAGS="$CPPFLAGS"
2335 CF_REMOVE_DEFINE(cf_trim_CFLAGS,$cf_save_CFLAGS,_POSIX_C_SOURCE)
2336 CF_REMOVE_DEFINE(cf_trim_CPPFLAGS,$cf_save_CPPFLAGS,_POSIX_C_SOURCE)
2338 AC_CACHE_CHECK(if we should define _POSIX_C_SOURCE,cf_cv_posix_c_source,[
2339 CF_MSG_LOG(if the symbol is already defined go no further)
2340 AC_TRY_COMPILE([#include <sys/types.h>],[
2341 #ifndef _POSIX_C_SOURCE
2344 [cf_cv_posix_c_source=no],
2345 [cf_want_posix_source=no
2346 case .$cf_POSIX_C_SOURCE in #(vi
2348 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
2351 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
2352 cf_want_posix_source=yes
2355 cf_want_posix_source=yes
2358 if test "$cf_want_posix_source" = yes ; then
2359 AC_TRY_COMPILE([#include <sys/types.h>],[
2360 #ifdef _POSIX_SOURCE
2363 cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE")
2365 CF_MSG_LOG(ifdef from value $cf_POSIX_C_SOURCE)
2366 CFLAGS="$cf_trim_CFLAGS"
2367 CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source"
2368 CF_MSG_LOG(if the second compile does not leave our definition intact error)
2369 AC_TRY_COMPILE([#include <sys/types.h>],[
2370 #ifndef _POSIX_C_SOURCE
2373 [cf_cv_posix_c_source=no])
2374 CFLAGS="$cf_save_CFLAGS"
2375 CPPFLAGS="$cf_save_CPPFLAGS"
2379 if test "$cf_cv_posix_c_source" != no ; then
2380 CFLAGS="$cf_trim_CFLAGS"
2381 CPPFLAGS="$cf_trim_CPPFLAGS"
2382 CF_ADD_CFLAGS($cf_cv_posix_c_source)
2386 dnl ---------------------------------------------------------------------------
2387 dnl CF_PRG_RULES version: 1 updated: 2006/06/03 11:45:08
2389 dnl Append definitions and rules for the given programs to the subdirectory
2390 dnl Makefiles, and the recursion rule for the top-level Makefile.
2393 dnl $1 = script to run
2394 dnl $2 = list of subdirectories
2398 AC_DEFUN([CF_PRG_RULES],
2402 if test ! -d $srcdir/$cf_dir; then
2404 elif test -f $srcdir/$cf_dir/programs; then
2405 $AWK -f $1 $srcdir/$cf_dir/programs >>$cf_dir/Makefile
2410 dnl ---------------------------------------------------------------------------
2411 dnl CF_PROG_CC_U_D version: 1 updated: 2005/07/14 16:59:30
2413 dnl Check if C (preprocessor) -U and -D options are processed in the order
2414 dnl given rather than by type of option. Some compilers insist on apply all
2415 dnl of the -U options after all of the -D options. Others allow mixing them,
2416 dnl and may predefine symbols that conflict with those we define.
2417 AC_DEFUN([CF_PROG_CC_U_D],
2419 AC_CACHE_CHECK(if $CC -U and -D options work together,cf_cv_cc_u_d_options,[
2420 cf_save_CPPFLAGS="$CPPFLAGS"
2421 CPPFLAGS="-UU_D_OPTIONS -DU_D_OPTIONS -DD_U_OPTIONS -UD_U_OPTIONS"
2424 make an undefined-error
2427 make a defined-error
2430 cf_cv_cc_u_d_options=yes],[
2431 cf_cv_cc_u_d_options=no])
2432 CPPFLAGS="$cf_save_CPPFLAGS"
2435 dnl ---------------------------------------------------------------------------
2436 dnl CF_PROG_INSTALL version: 5 updated: 2002/12/21 22:46:07
2438 dnl Force $INSTALL to be an absolute-path. Otherwise, edit_man.sh and the
2439 dnl misc/tabset install won't work properly. Usually this happens only when
2440 dnl using the fallback mkinstalldirs script
2441 AC_DEFUN([CF_PROG_INSTALL],
2447 CF_DIRNAME(cf_dir,$INSTALL)
2448 test -z "$cf_dir" && cf_dir=.
2449 INSTALL=`cd $cf_dir && pwd`/`echo $INSTALL | sed -e 's%^.*/%%'`
2453 dnl ---------------------------------------------------------------------------
2454 dnl CF_PROG_LINT version: 2 updated: 2009/08/12 04:43:14
2456 AC_DEFUN([CF_PROG_LINT],
2458 AC_CHECK_PROGS(LINT, tdlint lint alint splint lclint)
2461 dnl ---------------------------------------------------------------------------
2462 dnl CF_REMOVE_DEFINE version: 3 updated: 2010/01/09 11:05:50
2463 dnl ----------------
2464 dnl Remove all -U and -D options that refer to the given symbol from a list
2465 dnl of C compiler options. This works around the problem that not all
2466 dnl compilers process -U and -D options from left-to-right, so a -U option
2467 dnl cannot be used to cancel the effect of a preceding -D option.
2469 dnl $1 = target (which could be the same as the source variable)
2470 dnl $2 = source (including '$')
2471 dnl $3 = symbol to remove
2472 define([CF_REMOVE_DEFINE],
2475 sed -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[[ ]]/ /g' \
2476 -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[$]//g'`
2478 dnl ---------------------------------------------------------------------------
2479 dnl CF_SIG_ATOMIC_T version: 2 updated: 2005/09/18 17:27:12
2481 dnl signal handler, but there are some gcc depedencies in that recommendation.
2483 AC_DEFUN([CF_SIG_ATOMIC_T],
2485 AC_MSG_CHECKING(for signal global datatype)
2486 AC_CACHE_VAL(cf_cv_sig_atomic_t,[
2488 "volatile sig_atomic_t" \
2493 #include <sys/types.h>
2499 static void handler(int sig)
2503 [signal(SIGINT, handler);
2505 [cf_cv_sig_atomic_t=$cf_type],
2506 [cf_cv_sig_atomic_t=no])
2507 test "$cf_cv_sig_atomic_t" != no && break
2510 AC_MSG_RESULT($cf_cv_sig_atomic_t)
2511 test "$cf_cv_sig_atomic_t" != no && AC_DEFINE_UNQUOTED(SIG_ATOMIC_T, $cf_cv_sig_atomic_t)
2513 dnl ---------------------------------------------------------------------------
2514 dnl CF_SUBDIR_PATH version: 6 updated: 2010/04/21 06:20:50
2516 dnl Construct a search-list for a nonstandard header/lib-file
2517 dnl $1 = the variable to return as result
2518 dnl $2 = the package name
2519 dnl $3 = the subdirectory, e.g., bin, include or lib
2520 AC_DEFUN([CF_SUBDIR_PATH],
2524 CF_ADD_SUBDIR_PATH($1,$2,$3,/usr,$prefix)
2525 CF_ADD_SUBDIR_PATH($1,$2,$3,$prefix,NONE)
2526 CF_ADD_SUBDIR_PATH($1,$2,$3,/usr/local,$prefix)
2527 CF_ADD_SUBDIR_PATH($1,$2,$3,/opt,$prefix)
2528 CF_ADD_SUBDIR_PATH($1,$2,$3,[$]HOME,$prefix)
2530 dnl ---------------------------------------------------------------------------
2531 dnl CF_SYS_TIME_SELECT version: 4 updated: 2000/10/04 09:18:40
2532 dnl ------------------
2533 dnl Check if we can include <sys/time.h> with <sys/select.h>; this breaks on
2534 dnl older SCO configurations.
2535 AC_DEFUN([CF_SYS_TIME_SELECT],
2537 AC_MSG_CHECKING(if sys/time.h works with sys/select.h)
2538 AC_CACHE_VAL(cf_cv_sys_time_select,[
2540 #include <sys/types.h>
2541 #ifdef HAVE_SYS_TIME_H
2542 #include <sys/time.h>
2544 #ifdef HAVE_SYS_SELECT_H
2545 #include <sys/select.h>
2547 ],[],[cf_cv_sys_time_select=yes],
2548 [cf_cv_sys_time_select=no])
2550 AC_MSG_RESULT($cf_cv_sys_time_select)
2551 test "$cf_cv_sys_time_select" = yes && AC_DEFINE(HAVE_SYS_TIME_SELECT)
2553 dnl ---------------------------------------------------------------------------
2554 dnl CF_TERM_HEADER version: 2 updated: 2010/10/23 15:54:49
2556 dnl Look for term.h, which is part of X/Open curses. It defines the interface
2557 dnl to terminfo database. Usually it is in the same include-path as curses.h,
2558 dnl but some packagers change this, breaking various applications.
2559 AC_DEFUN([CF_TERM_HEADER],[
2560 AC_CACHE_CHECK(for terminfo header, cf_cv_term_header,[
2561 case ${cf_cv_ncurses_header} in #(vi
2562 */ncurses.h|*/ncursesw.h) #(vi
2563 cf_term_header=`echo "$cf_cv_ncurses_header" | sed -e 's%ncurses[[^.]]*\.h$%term.h%'`
2566 cf_term_header=term.h
2570 for cf_test in $cf_term_header "ncurses/term.h" "ncursesw/term.h"
2572 AC_TRY_COMPILE([#include <stdio.h>
2573 #include <${cf_cv_ncurses_header:-curses.h}>
2575 ],[int x = auto_left_margin],[
2576 cf_cv_term_header="$cf_test"],[
2577 cf_cv_term_header=unknown
2579 test "$cf_cv_term_header" != unknown && break
2583 # Set definitions to allow ifdef'ing to accommodate subdirectories
2585 case $cf_cv_term_header in # (vi
2587 AC_DEFINE(HAVE_TERM_H)
2591 case $cf_cv_term_header in # (vi
2592 ncurses/term.h) #(vi
2593 AC_DEFINE(HAVE_NCURSES_TERM_H)
2596 AC_DEFINE(HAVE_NCURSESW_TERM_H)
2600 dnl ---------------------------------------------------------------------------
2601 dnl CF_TPUTS_PROTO version: 2 updated: 2011/04/23 19:25:50
2603 dnl Check for type of function-pointer passed to tputs. Some old
2604 dnl implementations used functions that had different prototypes, making it
2605 dnl hard to compile portable programs using tputs.
2606 AC_DEFUN([CF_TPUTS_PROTO],[
2607 CF_CURSES_FUNCS(tputs)
2608 if test x$cf_cv_func_tputs = xyes
2611 for cf_arg in int char
2613 for cf_ret in int void
2615 if test $cf_ret = void
2617 cf_return="/* nothing */"
2619 cf_return="return value"
2622 #include <${cf_cv_ncurses_header:-curses.h}>
2623 #include <$cf_cv_term_header>
2625 static $cf_ret outc($cf_arg value) { $cf_return; }
2627 tputs("hello", 0, outc);
2628 ${cf_cv_main_return:-return}(0);
2630 CF_VERBOSE([prototype $cf_ret func($cf_arg value)])
2631 cat >>confdefs.h <<EOF
2632 #define TPUTS_ARG $cf_arg
2633 #define TPUTS_PROTO(func,value) $cf_ret func(TPUTS_ARG value)
2634 #define TPUTS_RETURN(value) $cf_return
2640 test $cf_done = yes && break
2644 dnl ---------------------------------------------------------------------------
2645 dnl CF_TRY_PKG_CONFIG version: 4 updated: 2010/06/14 17:42:30
2646 dnl -----------------
2647 dnl This is a simple wrapper to use for pkg-config, for libraries which may be
2648 dnl available in that form.
2650 dnl $1 = package name
2651 dnl $2 = extra logic to use, if any, after updating CFLAGS and LIBS
2652 dnl $3 = logic to use if pkg-config does not have the package
2653 AC_DEFUN([CF_TRY_PKG_CONFIG],[
2654 AC_REQUIRE([CF_PKG_CONFIG])
2656 if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists $1; then
2657 CF_VERBOSE(found package $1)
2658 cf_pkgconfig_incs="`$PKG_CONFIG --cflags $1 2>/dev/null`"
2659 cf_pkgconfig_libs="`$PKG_CONFIG --libs $1 2>/dev/null`"
2660 CF_VERBOSE(package $1 CFLAGS: $cf_pkgconfig_incs)
2661 CF_VERBOSE(package $1 LIBS: $cf_pkgconfig_libs)
2662 CF_ADD_CFLAGS($cf_pkgconfig_incs)
2663 CF_ADD_LIBS($cf_pkgconfig_libs)
2664 ifelse([$2],,:,[$2])
2666 ifelse([$3],,:,[$3])
2669 dnl ---------------------------------------------------------------------------
2670 dnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59
2672 dnl Make an uppercase version of a variable
2673 dnl $1=uppercase($2)
2674 AC_DEFUN([CF_UPPER],
2676 $1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
2678 dnl ---------------------------------------------------------------------------
2679 dnl CF_UTF8_LIB version: 7 updated: 2010/06/20 09:24:28
2681 dnl Check for multibyte support, and if not found, utf8 compatibility library
2682 AC_DEFUN([CF_UTF8_LIB],
2684 AC_CACHE_CHECK(for multibyte character support,cf_cv_utf8_lib,[
2685 cf_save_LIBS="$LIBS"
2687 #include <stdlib.h>],[putwc(0,0);],
2688 [cf_cv_utf8_lib=yes],
2690 #include <libutf8.h>],[putwc(0,0);],utf8,
2691 [cf_cv_utf8_lib=add-on],
2692 [cf_cv_utf8_lib=no])
2695 # HAVE_LIBUTF8_H is used by ncurses if curses.h is shared between
2697 if test "$cf_cv_utf8_lib" = "add-on" ; then
2698 AC_DEFINE(HAVE_LIBUTF8_H)
2699 CF_ADD_INCDIR($cf_cv_header_path_utf8)
2700 CF_ADD_LIBDIR($cf_cv_library_path_utf8)
2701 CF_ADD_LIBS($cf_cv_library_file_utf8)
2704 dnl ---------------------------------------------------------------------------
2705 dnl CF_VERBOSE version: 3 updated: 2007/07/29 09:55:12
2707 dnl Use AC_VERBOSE w/o the warnings
2708 AC_DEFUN([CF_VERBOSE],
2709 [test -n "$verbose" && echo " $1" 1>&AC_FD_MSG
2712 dnl ---------------------------------------------------------------------------
2713 dnl CF_WCHAR_TYPE version: 3 updated: 2010/05/26 16:44:57
2715 dnl Check if type wide-character type $1 is declared, and if so, which header
2716 dnl file is needed. The second parameter is used to set a shell variable when
2717 dnl the type is not found. The first parameter sets a shell variable for the
2719 AC_DEFUN([CF_WCHAR_TYPE],
2721 # This is needed on Tru64 5.0 to declare $1
2722 AC_CACHE_CHECK(if we must include wchar.h to declare $1,cf_cv_$1,[
2727 #ifdef HAVE_LIBUTF8_H
2728 #include <libutf8.h>
2737 #ifdef HAVE_LIBUTF8_H
2738 #include <libutf8.h>
2742 [cf_cv_$1=unknown])])])
2744 if test "$cf_cv_$1" = yes ; then
2745 AC_DEFINE(NEED_WCHAR_H)
2750 # if we do not find $1 in either place, use substitution to provide a fallback.
2751 if test "$cf_cv_$1" = unknown ; then
2756 # if we find $1 in either place, use substitution to provide a fallback.
2757 if test "$cf_cv_$1" != unknown ; then
2762 dnl ---------------------------------------------------------------------------
2763 dnl CF_WITH_CURSES_DIR version: 3 updated: 2010/11/20 17:02:38
2764 dnl ------------------
2765 dnl Wrapper for AC_ARG_WITH to specify directory under which to look for curses
2767 AC_DEFUN([CF_WITH_CURSES_DIR],[
2769 AC_MSG_CHECKING(for specific curses-directory)
2770 AC_ARG_WITH(curses-dir,
2771 [ --with-curses-dir=DIR directory in which (n)curses is installed],
2772 [cf_cv_curses_dir=$withval],
2773 [cf_cv_curses_dir=no])
2774 AC_MSG_RESULT($cf_cv_curses_dir)
2776 if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" )
2778 CF_PATH_SYNTAX(withval)
2779 if test -d "$cf_cv_curses_dir"
2781 CF_ADD_INCDIR($cf_cv_curses_dir/include)
2782 CF_ADD_LIBDIR($cf_cv_curses_dir/lib)
2786 dnl ---------------------------------------------------------------------------
2787 dnl CF_WITH_DBMALLOC version: 7 updated: 2010/06/21 17:26:47
2788 dnl ----------------
2789 dnl Configure-option for dbmalloc. The optional parameter is used to override
2790 dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests.
2791 AC_DEFUN([CF_WITH_DBMALLOC],[
2792 CF_NO_LEAKS_OPTION(dbmalloc,
2793 [ --with-dbmalloc test: use Conor Cahill's dbmalloc library],
2796 if test "$with_dbmalloc" = yes ; then
2797 AC_CHECK_HEADER(dbmalloc.h,
2798 [AC_CHECK_LIB(dbmalloc,[debug_malloc]ifelse([$1],,[],[,$1]))])
2801 dnl ---------------------------------------------------------------------------
2802 dnl CF_WITH_DMALLOC version: 7 updated: 2010/06/21 17:26:47
2804 dnl Configure-option for dmalloc. The optional parameter is used to override
2805 dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests.
2806 AC_DEFUN([CF_WITH_DMALLOC],[
2807 CF_NO_LEAKS_OPTION(dmalloc,
2808 [ --with-dmalloc test: use Gray Watson's dmalloc library],
2811 if test "$with_dmalloc" = yes ; then
2812 AC_CHECK_HEADER(dmalloc.h,
2813 [AC_CHECK_LIB(dmalloc,[dmalloc_debug]ifelse([$1],,[],[,$1]))])
2816 dnl ---------------------------------------------------------------------------
2817 dnl CF_WITH_VALGRIND version: 1 updated: 2006/12/14 18:00:21
2818 dnl ----------------
2819 AC_DEFUN([CF_WITH_VALGRIND],[
2820 CF_NO_LEAKS_OPTION(valgrind,
2821 [ --with-valgrind test: use valgrind],
2824 dnl ---------------------------------------------------------------------------
2825 dnl CF_XOPEN_CURSES version: 11 updated: 2011/01/18 18:15:30
2827 dnl Test if we should define X/Open source for curses, needed on Digital Unix
2828 dnl 4.x, to see the extended functions, but breaks on IRIX 6.x.
2830 dnl The getbegyx() check is needed for HPUX, which omits legacy macros such
2831 dnl as getbegy(). The latter is better design, but the former is standard.
2832 AC_DEFUN([CF_XOPEN_CURSES],
2834 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
2835 AC_CACHE_CHECK(if we must define _XOPEN_SOURCE_EXTENDED,cf_cv_need_xopen_extension,[
2838 #include <${cf_cv_ncurses_header:-curses.h}>],[
2839 #if defined(NCURSES_VERSION_PATCH)
2840 #if (NCURSES_VERSION_PATCH < 20100501) && (NCURSES_VERSION_PATCH >= 20100403)
2844 long x = winnstr(stdscr, "", 0);
2846 getbegyx(stdscr, y1, x1)],
2847 [cf_cv_need_xopen_extension=no],
2849 #define _XOPEN_SOURCE_EXTENDED
2851 #include <${cf_cv_ncurses_header:-curses.h}>],[
2852 #ifdef NCURSES_VERSION
2854 int check2 = curs_set((int)sizeof(check));
2856 long x = winnstr(stdscr, "", 0);
2858 getbegyx(stdscr, y1, x1)],
2859 [cf_cv_need_xopen_extension=yes],
2860 [cf_cv_need_xopen_extension=unknown])])])
2861 test $cf_cv_need_xopen_extension = yes && CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED"
2863 dnl ---------------------------------------------------------------------------
2864 dnl CF_XOPEN_SOURCE version: 35 updated: 2011/02/20 20:37:37
2866 dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions,
2867 dnl or adapt to the vendor's definitions to get equivalent functionality,
2868 dnl without losing the common non-POSIX features.
2871 dnl $1 is the nominal value for _XOPEN_SOURCE
2872 dnl $2 is the nominal value for _POSIX_C_SOURCE
2873 AC_DEFUN([CF_XOPEN_SOURCE],[
2875 cf_XOPEN_SOURCE=ifelse([$1],,500,[$1])
2876 cf_POSIX_C_SOURCE=ifelse([$2],,199506L,[$2])
2879 case $host_os in #(vi
2881 cf_xopen_source="-D_ALL_SOURCE"
2886 darwin[[0-8]].*) #(vi
2887 cf_xopen_source="-D_APPLE_C_SOURCE"
2890 cf_xopen_source="-D_DARWIN_C_SOURCE"
2892 freebsd*|dragonfly*) #(vi
2893 # 5.x headers associate
2894 # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L
2895 # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L
2896 cf_POSIX_C_SOURCE=200112L
2898 cf_xopen_source="-D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
2901 cf_xopen_source="-D_HPUX_SOURCE -D_XOPEN_SOURCE=500"
2904 cf_xopen_source="-D_HPUX_SOURCE"
2907 cf_xopen_source="-D_SGI_SOURCE"
2909 linux*|gnu*|mint*|k*bsd*-gnu) #(vi
2913 # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <arpa/inet.h>
2916 # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw
2919 # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw
2922 cf_xopen_source="-D_OSF_SOURCE"
2925 cf_xopen_source="-D_QNX_SOURCE"
2928 # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer
2930 solaris2.1[[0-9]]) #(vi
2931 cf_xopen_source="-D__EXTENSIONS__ -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
2933 solaris2.[[1-9]]) #(vi
2934 cf_xopen_source="-D__EXTENSIONS__"
2937 AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[
2938 AC_TRY_COMPILE([#include <sys/types.h>],[
2939 #ifndef _XOPEN_SOURCE
2942 [cf_cv_xopen_source=no],
2943 [cf_save="$CPPFLAGS"
2944 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
2945 AC_TRY_COMPILE([#include <sys/types.h>],[
2946 #ifdef _XOPEN_SOURCE
2949 [cf_cv_xopen_source=no],
2950 [cf_cv_xopen_source=$cf_XOPEN_SOURCE])
2954 if test "$cf_cv_xopen_source" != no ; then
2955 CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE)
2956 CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE)
2957 cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source"
2958 CF_ADD_CFLAGS($cf_temp_xopen_source)
2960 CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE)
2964 if test -n "$cf_xopen_source" ; then
2965 CF_ADD_CFLAGS($cf_xopen_source)
2968 dnl ---------------------------------------------------------------------------
2969 dnl CF_X_ATHENA version: 20 updated: 2010/11/09 05:18:02
2971 dnl Check for Xaw (Athena) libraries
2973 dnl Sets $cf_x_athena according to the flavor of Xaw which is used.
2974 AC_DEFUN([CF_X_ATHENA],
2976 cf_x_athena=${cf_x_athena:-Xaw}
2978 AC_MSG_CHECKING(if you want to link with Xaw 3d library)
2981 [ --with-Xaw3d link with Xaw 3d library])
2982 if test "$withval" = yes ; then
2989 AC_MSG_CHECKING(if you want to link with neXT Athena library)
2992 [ --with-neXtaw link with neXT Athena library])
2993 if test "$withval" = yes ; then
3000 AC_MSG_CHECKING(if you want to link with Athena-Plus library)
3002 AC_ARG_WITH(XawPlus,
3003 [ --with-XawPlus link with Athena-Plus library])
3004 if test "$withval" = yes ; then
3013 if test "$PKG_CONFIG" != none ; then
3015 test "$cf_x_athena" = Xaw && cf_athena_list="xaw8 xaw7 xaw6"
3016 for cf_athena_pkg in \
3019 ${cf_x_athena}-devel \
3021 lib${cf_x_athena}-devel
3023 CF_TRY_PKG_CONFIG($cf_athena_pkg,[
3024 cf_x_athena_lib="$cf_pkgconfig_libs"
3025 CF_UPPER(cf_x_athena_LIBS,HAVE_LIB_$cf_x_athena)
3026 AC_DEFINE_UNQUOTED($cf_x_athena_LIBS)
3028 AC_CACHE_CHECK(for usable $cf_x_athena/Xmu package,cf_cv_xaw_compat,[
3030 #include <X11/Xmu/CharSet.h>
3032 int check = XmuCompareISOLatin1("big", "small")
3033 ],[cf_cv_xaw_compat=yes],[cf_cv_xaw_compat=no])])
3035 if test "$cf_cv_xaw_compat" = no
3037 # workaround for broken ".pc" files...
3038 case "$cf_x_athena_lib" in #(vi
3042 CF_VERBOSE(work around broken package)
3043 CF_TRY_PKG_CONFIG(xmu,,[CF_ADD_LIB_AFTER(-lXt,-lXmu)])
3052 if test -z "$cf_x_athena_lib" ; then
3055 CF_X_ATHENA_CPPFLAGS($cf_x_athena)
3056 CF_X_ATHENA_LIBS($cf_x_athena)
3059 dnl ---------------------------------------------------------------------------
3060 dnl CF_X_ATHENA_CPPFLAGS version: 5 updated: 2010/05/26 17:35:30
3061 dnl --------------------
3062 dnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of
3063 dnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw.
3064 AC_DEFUN([CF_X_ATHENA_CPPFLAGS],
3066 cf_x_athena_root=ifelse([$1],,Xaw,[$1])
3069 for cf_path in default \
3070 /usr/contrib/X11R6 \
3071 /usr/contrib/X11R5 \
3075 if test -z "$cf_x_athena_inc" ; then
3077 cf_test=X11/$cf_x_athena_root/SimpleMenu.h
3078 if test $cf_path != default ; then
3079 CPPFLAGS="$cf_save -I$cf_path/include"
3080 AC_MSG_CHECKING(for $cf_test in $cf_path)
3082 AC_MSG_CHECKING(for $cf_test)
3085 #include <X11/Intrinsic.h>
3086 #include <$cf_test>],[],
3089 AC_MSG_RESULT($cf_result)
3090 if test "$cf_result" = yes ; then
3091 cf_x_athena_inc=$cf_path
3099 if test -z "$cf_x_athena_inc" ; then
3101 [Unable to successfully find Athena header files with test program])
3102 elif test "$cf_x_athena_inc" != default ; then
3103 CPPFLAGS="$CPPFLAGS -I$cf_x_athena_inc"
3106 dnl ---------------------------------------------------------------------------
3107 dnl CF_X_ATHENA_LIBS version: 10 updated: 2011/02/13 13:31:33
3108 dnl ----------------
3109 dnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of
3110 dnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw.
3111 AC_DEFUN([CF_X_ATHENA_LIBS],
3112 [AC_REQUIRE([CF_X_TOOLKIT])
3113 cf_x_athena_root=ifelse([$1],,Xaw,[$1])
3116 for cf_path in default \
3117 /usr/contrib/X11R6 \
3118 /usr/contrib/X11R5 \
3123 "-l$cf_x_athena_root -lXmu" \
3124 "-l$cf_x_athena_root -lXpm -lXmu" \
3125 "-l${cf_x_athena_root}_s -lXmu_s"
3127 if test -z "$cf_x_athena_lib" ; then
3129 cf_test=XawSimpleMenuAddGlobalActions
3130 if test $cf_path != default ; then
3131 CF_ADD_LIBS(-L$cf_path/lib $cf_lib)
3132 AC_MSG_CHECKING(for $cf_lib in $cf_path)
3134 CF_ADD_LIBS($cf_lib)
3135 AC_MSG_CHECKING(for $cf_test in $cf_lib)
3138 #include <X11/Intrinsic.h>
3139 #include <X11/$cf_x_athena_root/SimpleMenu.h>
3141 $cf_test((XtAppContext) 0)],
3144 AC_MSG_RESULT($cf_result)
3145 if test "$cf_result" = yes ; then
3146 cf_x_athena_lib="$cf_lib"
3154 if test -z "$cf_x_athena_lib" ; then
3156 [Unable to successfully link Athena library (-l$cf_x_athena_root) with test program])
3159 CF_UPPER(cf_x_athena_LIBS,HAVE_LIB_$cf_x_athena)
3160 AC_DEFINE_UNQUOTED($cf_x_athena_LIBS)
3162 dnl ---------------------------------------------------------------------------
3163 dnl CF_X_EXT version: 3 updated: 2010/06/02 05:03:05
3165 AC_DEFUN([CF_X_EXT],[
3166 CF_TRY_PKG_CONFIG(Xext,,[
3167 AC_CHECK_LIB(Xext,XextCreateExtension,
3168 [CF_ADD_LIB(Xext)])])
3170 dnl ---------------------------------------------------------------------------
3171 dnl CF_X_TOOLKIT version: 20 updated: 2010/11/19 05:43:04
3173 dnl Check for X Toolkit libraries
3175 AC_DEFUN([CF_X_TOOLKIT],
3177 AC_REQUIRE([AC_PATH_XTRA])
3178 AC_REQUIRE([CF_CHECK_CACHE])
3182 CF_TRY_PKG_CONFIG(xt,[
3184 case "x$LIBS" in #(vi
3188 # we have an "xt" package, but it may omit Xt's dependency on X11
3189 AC_CACHE_CHECK(for usable X dependency,cf_cv_xt_x11_compat,[
3191 #include <X11/Xlib.h>
3193 int rc1 = XDrawLine((Display*) 0, (Drawable) 0, (GC) 0, 0, 0, 0, 0);
3194 int rc2 = XClearWindow((Display*) 0, (Window) 0);
3195 int rc3 = XMoveWindow((Display*) 0, (Window) 0, 0, 0);
3196 int rc4 = XMoveResizeWindow((Display*)0, (Window)0, 0, 0, 0, 0);
3197 ],[cf_cv_xt_x11_compat=yes],[cf_cv_xt_x11_compat=no])])
3198 if test "$cf_cv_xt_x11_compat" = no
3200 CF_VERBOSE(work around broken X11 dependency)
3201 # 2010/11/19 - good enough until a working Xt on Xcb is delivered.
3202 CF_TRY_PKG_CONFIG(x11,,[CF_ADD_LIB_AFTER(-lXt,-lX11)])
3207 AC_CACHE_CHECK(for usable X Toolkit package,cf_cv_xt_ice_compat,[
3209 #include <X11/Shell.h>
3210 ],[int num = IceConnectionNumber(0)
3211 ],[cf_cv_xt_ice_compat=yes],[cf_cv_xt_ice_compat=no])])
3213 if test "$cf_cv_xt_ice_compat" = no
3215 # workaround for broken ".pc" files used for X Toolkit.
3216 case "x$X_PRE_LIBS" in #(vi
3218 case "x$LIBS" in #(vi
3222 CF_VERBOSE(work around broken ICE dependency)
3223 CF_TRY_PKG_CONFIG(ice,
3224 [CF_TRY_PKG_CONFIG(sm)],
3225 [CF_ADD_LIB_AFTER(-lXt,$X_PRE_LIBS)])
3235 LDFLAGS="$X_LIBS $LDFLAGS"
3236 CF_CHECK_CFLAGS($X_CFLAGS)
3238 AC_CHECK_FUNC(XOpenDisplay,,[
3239 AC_CHECK_LIB(X11,XOpenDisplay,
3241 [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])])
3243 AC_CHECK_FUNC(XtAppInitialize,,[
3244 AC_CHECK_LIB(Xt, XtAppInitialize,
3245 [AC_DEFINE(HAVE_LIBXT)
3247 LIBS="-lXt $X_PRE_LIBS $LIBS $X_EXTRA_LIBS"],,
3248 [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])])
3251 if test $cf_have_X_LIBS = no ; then
3253 [Unable to successfully link X Toolkit library (-lXt) with
3254 test program. You will have to check and add the proper libraries by hand
3258 dnl ---------------------------------------------------------------------------
3259 dnl CF__CURSES_HEAD version: 2 updated: 2010/10/23 15:54:49
3261 dnl Define a reusable chunk which includes <curses.h> and <term.h> when they
3262 dnl are both available.
3263 define([CF__CURSES_HEAD],[
3265 #include <xcurses.h>
3266 char * XCursesProgramName = "test";
3268 #include <${cf_cv_ncurses_header:-curses.h}>
3269 #if defined(NCURSES_VERSION) && defined(HAVE_NCURSESW_TERM_H)
3270 #include <ncursesw/term.h>
3271 #elif defined(NCURSES_VERSION) && defined(HAVE_NCURSES_TERM_H)
3272 #include <ncurses/term.h>
3273 #elif defined(HAVE_TERM_H)