1 dnl***************************************************************************
2 dnl Copyright (c) 2003-2009,2010 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.34 2010/04/04 00:08:48 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: 9 updated: 2010/01/09 11:05:50
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: 12 updated: 2009/01/18 10:00:47
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_LIBDIR version: 8 updated: 2009/01/18 10:01:08
190 dnl Adds to the library-path
192 dnl Some machines have trouble with multiple -L options.
194 dnl $1 is the (list of) directory(s) to add
195 dnl $2 is the optional name of the variable to update (default LDFLAGS)
197 AC_DEFUN([CF_ADD_LIBDIR],
199 if test -n "$1" ; then
200 for cf_add_libdir in $1
202 if test $cf_add_libdir = /usr/lib ; then
204 elif test -d $cf_add_libdir
207 if test -n "$LDFLAGS$LIBS" ; then
208 # a loop is needed to ensure we can add subdirs of existing dirs
209 for cf_test_libdir in $LDFLAGS $LIBS ; do
210 if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then
211 cf_have_libdir=yes; break
215 if test "$cf_have_libdir" = no ; then
216 CF_VERBOSE(adding $cf_add_libdir to library-path)
217 ifelse($2,,LDFLAGS,$2)="-L$cf_add_libdir $ifelse($2,,LDFLAGS,$2)"
223 dnl ---------------------------------------------------------------------------
224 dnl CF_ADD_SUBDIR_PATH version: 2 updated: 2007/07/29 10:12:59
225 dnl ------------------
226 dnl Append to a search-list for a nonstandard header/lib-file
227 dnl $1 = the variable to return as result
228 dnl $2 = the package name
229 dnl $3 = the subdirectory, e.g., bin, include or lib
230 dnl $4 = the directory under which we will test for subdirectories
231 dnl $5 = a directory that we do not want $4 to match
232 AC_DEFUN([CF_ADD_SUBDIR_PATH],
234 test "$4" != "$5" && \
236 ifelse([$5],NONE,,[(test $5 = NONE || test -d $5) &&]) {
237 test -n "$verbose" && echo " ... testing for $3-directories under $4"
238 test -d $4/$3 && $1="[$]$1 $4/$3"
239 test -d $4/$3/$2 && $1="[$]$1 $4/$3/$2"
240 test -d $4/$3/$2/$3 && $1="[$]$1 $4/$3/$2/$3"
241 test -d $4/$2/$3 && $1="[$]$1 $4/$2/$3"
242 test -d $4/$2/$3/$2 && $1="[$]$1 $4/$2/$3/$2"
245 dnl ---------------------------------------------------------------------------
246 dnl CF_ANSI_CC_CHECK version: 9 updated: 2001/12/30 17:53:34
248 dnl This is adapted from the macros 'fp_PROG_CC_STDC' and 'fp_C_PROTOTYPES'
249 dnl in the sharutils 4.2 distribution.
250 AC_DEFUN([CF_ANSI_CC_CHECK],
252 AC_CACHE_CHECK(for ${CC-cc} option to accept ANSI C, cf_cv_ansi_cc,[
254 cf_save_CFLAGS="$CFLAGS"
255 cf_save_CPPFLAGS="$CPPFLAGS"
256 # Don't try gcc -ansi; that turns off useful extensions and
257 # breaks some systems' header files.
259 # Ultrix and OSF/1 -std1
260 # HP-UX -Aa -D_HPUX_SOURCE
262 # UnixWare 1.2 (cannot use -Xc, since ANSI/POSIX clashes)
263 for cf_arg in "-DCC_HAS_PROTOS" \
268 "-Aa -D_HPUX_SOURCE" \
271 CF_ADD_CFLAGS($cf_arg)
274 #ifndef CC_HAS_PROTOS
275 #if !defined(__STDC__) || (__STDC__ != 1)
280 int test (int i, double x);
281 struct s1 {int (*f) (int a);};
282 struct s2 {int (*f) (double a);};],
283 [cf_cv_ansi_cc="$cf_arg"; break])
285 CFLAGS="$cf_save_CFLAGS"
286 CPPFLAGS="$cf_save_CPPFLAGS"
289 if test "$cf_cv_ansi_cc" != "no"; then
290 if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then
291 CF_ADD_CFLAGS($cf_cv_ansi_cc)
293 AC_DEFINE(CC_HAS_PROTOS)
297 dnl ---------------------------------------------------------------------------
298 dnl CF_ANSI_CC_REQD version: 4 updated: 2008/03/23 14:48:54
300 dnl For programs that must use an ANSI compiler, obtain compiler options that
301 dnl will make it recognize prototypes. We'll do preprocessor checks in other
302 dnl macros, since tools such as unproto can fake prototypes, but only part of
303 dnl the preprocessor.
304 AC_DEFUN([CF_ANSI_CC_REQD],
305 [AC_REQUIRE([CF_ANSI_CC_CHECK])
306 if test "$cf_cv_ansi_cc" = "no"; then
308 [Your compiler does not appear to recognize prototypes.
309 You have the following choices:
310 a. adjust your compiler options
311 b. get an up-to-date compiler
312 c. use a wrapper such as unproto])
315 dnl ---------------------------------------------------------------------------
316 dnl CF_ARG_DISABLE version: 3 updated: 1999/03/30 17:24:31
318 dnl Allow user to disable a normally-on option.
319 AC_DEFUN([CF_ARG_DISABLE],
320 [CF_ARG_OPTION($1,[$2],[$3],[$4],yes)])dnl
321 dnl ---------------------------------------------------------------------------
322 dnl CF_ARG_ENABLE version: 3 updated: 1999/03/30 17:24:31
324 dnl Allow user to enable a normally-off option.
325 AC_DEFUN([CF_ARG_ENABLE],
326 [CF_ARG_OPTION($1,[$2],[$3],[$4],no)])dnl
327 dnl ---------------------------------------------------------------------------
328 dnl CF_ARG_OPTION version: 3 updated: 1997/10/18 14:42:41
330 dnl Restricted form of AC_ARG_ENABLE that ensures user doesn't give bogus
336 dnl $3 = action to perform if option is not default
337 dnl $4 = action if perform if option is default
338 dnl $5 = default option value (either 'yes' or 'no')
339 AC_DEFUN([CF_ARG_OPTION],
340 [AC_ARG_ENABLE($1,[$2],[test "$enableval" != ifelse($5,no,yes,no) && enableval=ifelse($5,no,no,yes)
341 if test "$enableval" != "$5" ; then
343 ,[ $3]) ifelse($4,,,[
346 fi],[enableval=$5 ifelse($4,,,[
350 dnl ---------------------------------------------------------------------------
351 dnl CF_CHECK_CACHE version: 11 updated: 2008/03/23 14:45:59
353 dnl Check if we're accidentally using a cache from a different machine.
354 dnl Derive the system name, as a check for reusing the autoconf cache.
356 dnl If we've packaged config.guess and config.sub, run that (since it does a
357 dnl better job than uname). Normally we'll use AC_CANONICAL_HOST, but allow
358 dnl an extra parameter that we may override, e.g., for AC_CANONICAL_SYSTEM
359 dnl which is useful in cross-compiles.
361 dnl Note: we would use $ac_config_sub, but that is one of the places where
362 dnl autoconf 2.5x broke compatibility with autoconf 2.13
363 AC_DEFUN([CF_CHECK_CACHE],
365 if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then
366 ifelse([$1],,[AC_CANONICAL_HOST],[$1])
367 system_name="$host_os"
369 system_name="`(uname -s -r) 2>/dev/null`"
370 if test -z "$system_name" ; then
371 system_name="`(hostname) 2>/dev/null`"
374 test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name")
375 AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"])
377 test -z "$system_name" && system_name="$cf_cv_system_name"
378 test -n "$cf_cv_system_name" && AC_MSG_RESULT(Configuring for $cf_cv_system_name)
380 if test ".$system_name" != ".$cf_cv_system_name" ; then
381 AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name))
382 AC_MSG_ERROR("Please remove config.cache and try again.")
385 dnl ---------------------------------------------------------------------------
386 dnl CF_CHECK_CFLAGS version: 2 updated: 2001/12/30 19:09:58
388 dnl Conditionally add to $CFLAGS and $CPPFLAGS values which are derived from
389 dnl a build-configuration such as imake. These have the pitfall that they
390 dnl often contain compiler-specific options which we cannot use, mixed with
391 dnl preprocessor options that we usually can.
392 AC_DEFUN([CF_CHECK_CFLAGS],
394 CF_VERBOSE(checking additions to CFLAGS)
395 cf_check_cflags="$CFLAGS"
396 cf_check_cppflags="$CPPFLAGS"
397 CF_ADD_CFLAGS($1,yes)
398 if test "$cf_check_cflags" != "$CFLAGS" ; then
399 AC_TRY_LINK([#include <stdio.h>],[printf("Hello world");],,
400 [CF_VERBOSE(test-compile failed. Undoing change to \$CFLAGS)
401 if test "$cf_check_cppflags" != "$CPPFLAGS" ; then
402 CF_VERBOSE(but keeping change to \$CPPFLAGS)
404 CFLAGS="$cf_check_flags"])
407 dnl ---------------------------------------------------------------------------
408 dnl CF_CURSES_ACS_MAP version: 5 updated: 2009/03/28 16:08:10
409 dnl -----------------
410 dnl Check for likely values of acs_map[]:
411 AC_DEFUN([CF_CURSES_ACS_MAP],
413 AC_REQUIRE([CF_NCURSES_WRAP_PREFIX])dnl
414 AC_CACHE_CHECK(for alternate character set array, cf_cv_curses_acs_map,[
415 cf_cv_curses_acs_map=unknown
416 for name in acs_map _acs_map __acs_map ${NCURSES_WRAP_PREFIX}acs_map
419 #include <${cf_cv_ncurses_header-curses.h}>
421 $name['k'] = ACS_PLUS
422 ],[cf_cv_curses_acs_map=$name; break])
426 test "$cf_cv_curses_acs_map" != unknown && AC_DEFINE_UNQUOTED(CURSES_ACS_ARRAY,$cf_cv_curses_acs_map)
428 dnl ---------------------------------------------------------------------------
429 dnl CF_CURSES_CHECK_DATA version: 2 updated: 2009/07/16 21:03:10
430 dnl --------------------
431 dnl Check if curses.h defines the given data/variable.
432 dnl Use this after CF_NCURSES_CONFIG or CF_CURSES_CONFIG.
433 AC_DEFUN([CF_CURSES_CHECK_DATA],
435 AC_MSG_CHECKING(for data $1 declaration in ${cf_cv_ncurses_header-curses.h})
436 AC_TRY_COMPILE(CF__CURSES_HEAD,[
438 ],cf_result=yes,cf_result=no)
439 AC_MSG_RESULT($cf_result)
440 if test $cf_result = yes ; then
441 CF_UPPER(cf_result,have_curses_data_$1)
442 AC_DEFINE_UNQUOTED($cf_result)
444 AC_MSG_CHECKING(for data $1 in library)
445 AC_TRY_LINK(CF__CURSES_HEAD
449 ${cf_cv_main_return-return}(foo == 0);
451 ],[cf_result=yes],[cf_result=no])
452 AC_MSG_RESULT($cf_result)
453 if test $cf_result = yes ; then
454 CF_UPPER(cf_result,decl_curses_data_$1)
455 AC_DEFINE_UNQUOTED($cf_result)
459 dnl ---------------------------------------------------------------------------
460 dnl CF_CURSES_CHECK_TYPE version: 2 updated: 2003/03/01 23:40:33
461 dnl --------------------
462 dnl Check if curses.h defines the given type
463 AC_DEFUN([CF_CURSES_CHECK_TYPE],
465 AC_MSG_CHECKING(for type $1 in ${cf_cv_ncurses_header-curses.h})
467 #ifndef _XOPEN_SOURCE_EXTENDED
468 #define _XOPEN_SOURCE_EXTENDED
470 #include <${cf_cv_ncurses_header-curses.h}>],[
472 ],cf_result=yes,cf_result=no)
473 AC_MSG_RESULT($cf_result)
474 if test $cf_result = yes ; then
475 CF_UPPER(cf_result,have_type_$1)
476 AC_DEFINE_UNQUOTED($cf_result)
478 AC_DEFINE_UNQUOTED($1,$2)
481 dnl ---------------------------------------------------------------------------
482 dnl CF_CURSES_CONFIG version: 2 updated: 2006/10/29 11:06:27
484 dnl Tie together the configure-script macros for curses. It may be ncurses,
485 dnl but unless asked, we do not make a special search for ncurses. However,
486 dnl still check for the ncurses version number, for use in other macros.
487 AC_DEFUN([CF_CURSES_CONFIG],
493 dnl ---------------------------------------------------------------------------
494 dnl CF_CURSES_CPPFLAGS version: 10 updated: 2009/01/06 19:34:11
495 dnl ------------------
496 dnl Look for the curses headers.
497 AC_DEFUN([CF_CURSES_CPPFLAGS],[
499 AC_CACHE_CHECK(for extra include directories,cf_cv_curses_incdir,[
500 cf_cv_curses_incdir=no
501 case $host_os in #(vi
503 test -d /usr/include/curses_colr && \
504 cf_cv_curses_incdir="-I/usr/include/curses_colr"
507 test -d /usr/5lib && \
508 test -d /usr/5include && \
509 cf_cv_curses_incdir="-I/usr/5include"
513 test "$cf_cv_curses_incdir" != no && CPPFLAGS="$CPPFLAGS $cf_cv_curses_incdir"
518 dnl ---------------------------------------------------------------------------
519 dnl CF_CURSES_FUNCS version: 14 updated: 2009/07/16 19:34:55
521 dnl Curses-functions are a little complicated, since a lot of them are macros.
522 AC_DEFUN([CF_CURSES_FUNCS],
524 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
525 AC_REQUIRE([CF_XOPEN_CURSES])
526 AC_REQUIRE([CF_CURSES_TERM_H])
529 CF_UPPER(cf_tr_func,$cf_func)
530 AC_MSG_CHECKING(for ${cf_func})
531 CF_MSG_LOG(${cf_func})
532 AC_CACHE_VAL(cf_cv_func_$cf_func,[
533 eval cf_result='$ac_cv_func_'$cf_func
534 if test ".$cf_result" != ".no"; then
535 AC_TRY_LINK(CF__CURSES_HEAD,
538 long foo = (long)(&${cf_func});
539 ${cf_cv_main_return-return}(foo == 0);
545 eval 'cf_cv_func_'$cf_func'=$cf_result'
547 # use the computed/retrieved cache-value:
548 eval 'cf_result=$cf_cv_func_'$cf_func
549 AC_MSG_RESULT($cf_result)
550 if test $cf_result != no; then
551 AC_DEFINE_UNQUOTED(HAVE_${cf_tr_func})
555 dnl ---------------------------------------------------------------------------
556 dnl CF_CURSES_HEADER version: 1 updated: 2005/12/31 13:28:25
558 dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common
559 dnl variations of ncurses' installs.
561 dnl See also CF_NCURSES_HEADER, which sets the same cache variable.
562 AC_DEFUN([CF_CURSES_HEADER],[
563 AC_CACHE_CHECK(if we have identified curses headers,cf_cv_ncurses_header,[
564 cf_cv_ncurses_header=none
571 AC_TRY_COMPILE([#include <${cf_header}>],
572 [initscr(); tgoto("?", 0,0)],
573 [cf_cv_ncurses_header=$cf_header; break],[])
577 if test "$cf_cv_ncurses_header" = none ; then
578 AC_MSG_ERROR(No curses header-files found)
581 # cheat, to get the right #define's for HAVE_NCURSES_H, etc.
582 AC_CHECK_HEADERS($cf_cv_ncurses_header)
584 dnl ---------------------------------------------------------------------------
585 dnl CF_CURSES_LIBS version: 29 updated: 2009/01/06 19:34:57
587 dnl Look for the curses libraries. Older curses implementations may require
588 dnl termcap/termlib to be linked as well. Call CF_CURSES_CPPFLAGS first.
589 AC_DEFUN([CF_CURSES_LIBS],[
591 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
592 AC_MSG_CHECKING(if we have identified curses libraries)
593 AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>],
594 [initscr(); tgoto("?", 0,0)],
597 AC_MSG_RESULT($cf_result)
599 if test "$cf_result" = no ; then
600 case $host_os in #(vi
602 AC_CHECK_LIB(mytinfo,tgoto,[LIBS="-lmytinfo $LIBS"])
605 AC_CHECK_LIB(cur_colr,initscr,[
606 LIBS="-lcur_colr $LIBS"
607 ac_cv_func_initscr=yes
609 AC_CHECK_LIB(Hcurses,initscr,[
610 # HP's header uses __HP_CURSES, but user claims _HP_CURSES.
611 LIBS="-lHcurses $LIBS"
612 CPPFLAGS="$CPPFLAGS -D__HP_CURSES -D_HP_CURSES"
613 ac_cv_func_initscr=yes
616 linux*) # Suse Linux does not follow /usr/lib convention
620 if test -d /usr/5lib ; then
621 CF_ADD_LIBDIR(/usr/5lib)
622 LIBS="$LIBS -lcurses -ltermcap"
624 ac_cv_func_initscr=yes
628 if test ".$ac_cv_func_initscr" != .yes ; then
633 if test ".${cf_cv_ncurses_version-no}" != .no
635 cf_check_list="ncurses curses cursesX"
637 cf_check_list="cursesX curses ncurses"
640 # Check for library containing tgoto. Do this before curses library
641 # because it may be needed to link the test-case for initscr.
642 AC_CHECK_FUNC(tgoto,[cf_term_lib=predefined],[
643 for cf_term_lib in $cf_check_list termcap termlib unknown
645 AC_CHECK_LIB($cf_term_lib,tgoto,[break])
649 # Check for library containing initscr
650 test "$cf_term_lib" != predefined && test "$cf_term_lib" != unknown && LIBS="-l$cf_term_lib $cf_save_LIBS"
651 for cf_curs_lib in $cf_check_list xcurses jcurses pdcurses unknown
653 AC_CHECK_LIB($cf_curs_lib,initscr,[break])
655 test $cf_curs_lib = unknown && AC_MSG_ERROR(no curses library found)
657 LIBS="-l$cf_curs_lib $cf_save_LIBS"
658 if test "$cf_term_lib" = unknown ; then
659 AC_MSG_CHECKING(if we can link with $cf_curs_lib library)
660 AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>],
664 AC_MSG_RESULT($cf_result)
665 test $cf_result = no && AC_MSG_ERROR(Cannot link curses library)
666 elif test "$cf_curs_lib" = "$cf_term_lib" ; then
668 elif test "$cf_term_lib" != predefined ; then
669 AC_MSG_CHECKING(if we need both $cf_curs_lib and $cf_term_lib libraries)
670 AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>],
671 [initscr(); tgoto((char *)0, 0, 0);],
674 LIBS="-l$cf_curs_lib -l$cf_term_lib $cf_save_LIBS"
675 AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>],
680 AC_MSG_RESULT($cf_result)
686 dnl ---------------------------------------------------------------------------
687 dnl CF_CURSES_TERM_H version: 7 updated: 2010/01/24 18:40:06
689 dnl SVr4 curses should have term.h as well (where it puts the definitions of
690 dnl the low-level interface). This may not be true in old/broken implementations,
691 dnl as well as in misconfigured systems (e.g., gcc configured for Solaris 2.4
692 dnl running with Solaris 2.5.1).
693 AC_DEFUN([CF_CURSES_TERM_H],
695 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
697 AC_CACHE_CHECK(for term.h, cf_cv_term_header,[
699 # If we found <ncurses/curses.h>, look for <ncurses/term.h>, but always look
700 # for <term.h> if we do not find the variant.
702 `echo ${cf_cv_ncurses_header-curses.h} | sed -e 's%/.*%/%'`term.h \
706 #include <${cf_cv_ncurses_header-curses.h}>
707 #include <${cf_header}>],
709 [cf_cv_term_header=$cf_header
711 [cf_cv_term_header=no])
714 case $cf_cv_term_header in #(vi
716 # If curses is ncurses, some packagers still mess it up by trying to make
717 # us use GNU termcap. This handles the most common case.
718 for cf_header in ncurses/term.h ncursesw/term.h
721 #include <${cf_cv_ncurses_header-curses.h}>
722 #ifdef NCURSES_VERSION
723 #include <${cf_header}>
728 [cf_cv_term_header=$cf_header
730 [cf_cv_term_header=no])
736 case $cf_cv_term_header in #(vi
738 AC_DEFINE(HAVE_TERM_H)
741 AC_DEFINE(HAVE_NCURSES_TERM_H)
744 AC_DEFINE(HAVE_NCURSESW_TERM_H)
748 dnl ---------------------------------------------------------------------------
749 dnl CF_CURSES_WACS_MAP version: 3 updated: 2003/05/17 22:19:02
750 dnl ------------------
751 dnl Check for likely values of wacs_map[]:
752 AC_DEFUN([CF_CURSES_WACS_MAP],
754 AC_CACHE_CHECK(for wide alternate character set array, cf_cv_curses_wacs_map,[
755 cf_cv_curses_wacs_map=unknown
756 for name in wacs_map _wacs_map __wacs_map _nc_wacs
759 #ifndef _XOPEN_SOURCE_EXTENDED
760 #define _XOPEN_SOURCE_EXTENDED
762 #include <${cf_cv_ncurses_header-curses.h}>],
763 [$name['k'] = *WACS_PLUS],
764 [cf_cv_curses_wacs_map=$name
768 dnl ---------------------------------------------------------------------------
769 dnl CF_DIRNAME version: 4 updated: 2002/12/21 19:25:52
771 dnl "dirname" is not portable, so we fake it with a shell script.
772 AC_DEFUN([CF_DIRNAME],[$1=`echo $2 | sed -e 's%/[[^/]]*$%%'`])dnl
773 dnl ---------------------------------------------------------------------------
774 dnl CF_DISABLE_ECHO version: 11 updated: 2009/12/13 13:16:57
776 dnl You can always use "make -n" to see the actual options, but it's hard to
777 dnl pick out/analyze warning messages when the compile-line is long.
780 dnl ECHO_LT - symbol to control if libtool is verbose
781 dnl ECHO_LD - symbol to prefix "cc -o" lines
782 dnl RULE_CC - symbol to put before implicit "cc -c" lines (e.g., .c.o)
783 dnl SHOW_CC - symbol to put before explicit "cc -c" lines
784 dnl ECHO_CC - symbol to put before any "cc" line
786 AC_DEFUN([CF_DISABLE_ECHO],[
787 AC_MSG_CHECKING(if you want to see long compiling messages)
789 [ --disable-echo display "compiling" commands],
792 ECHO_LD='@echo linking [$]@;'
793 RULE_CC='@echo compiling [$]<'
794 SHOW_CC='@echo compiling [$]@'
803 AC_MSG_RESULT($enableval)
810 dnl ---------------------------------------------------------------------------
811 dnl CF_ENABLE_WARNINGS version: 4 updated: 2009/07/26 17:53:03
812 dnl ------------------
813 dnl Configure-option to enable gcc warnings
814 AC_DEFUN([CF_ENABLE_WARNINGS],[
815 if ( test "$GCC" = yes || test "$GXX" = yes )
817 AC_MSG_CHECKING(if you want to turn on gcc warnings)
818 CF_ARG_ENABLE(warnings,
819 [ --enable-warnings test: turn on gcc compiler warnings],
822 AC_MSG_RESULT($with_warnings)
823 if test "$with_warnings" = "yes"
830 dnl ---------------------------------------------------------------------------
831 dnl CF_FIND_LIBRARY version: 9 updated: 2008/03/23 14:48:54
833 dnl Look for a non-standard library, given parameters for AC_TRY_LINK. We
834 dnl prefer a standard location, and use -L options only if we do not find the
835 dnl library in the standard library location(s).
836 dnl $1 = library name
837 dnl $2 = library class, usually the same as library name
839 dnl $4 = code fragment to compile/link
840 dnl $5 = corresponding function-name
841 dnl $6 = flag, nonnull if failure should not cause an error-exit
843 dnl Sets the variable "$cf_libdir" as a side-effect, so we can see if we had
844 dnl to use a -L option.
845 AC_DEFUN([CF_FIND_LIBRARY],
847 eval 'cf_cv_have_lib_'$1'=no'
850 eval 'cf_cv_have_lib_'$1'=yes',[
852 AC_MSG_CHECKING(for $5 in -l$1)
854 AC_TRY_LINK([$3],[$4],
856 eval 'cf_cv_have_lib_'$1'=yes'
859 CF_LIBRARY_PATH(cf_search,$2)
860 for cf_libdir in $cf_search
862 AC_MSG_CHECKING(for -l$1 in $cf_libdir)
863 LIBS="-L$cf_libdir -l$1 $cf_save_LIBS"
864 AC_TRY_LINK([$3],[$4],
866 eval 'cf_cv_have_lib_'$1'=yes'
869 LIBS="$cf_save_LIBS"])
873 eval 'cf_found_library=[$]cf_cv_have_lib_'$1
875 if test $cf_found_library = no ; then
876 AC_MSG_ERROR(Cannot link $1 library)
880 dnl ---------------------------------------------------------------------------
881 dnl CF_FIND_LINKAGE version: 15 updated: 2010/04/03 18:35:33
883 dnl Find a library (specifically the linkage used in the code fragment),
884 dnl searching for it if it is not already in the library path.
885 dnl See also CF_ADD_SEARCHPATH.
887 dnl Parameters (4-on are optional):
888 dnl $1 = headers for library entrypoint
889 dnl $2 = code fragment for library entrypoint
890 dnl $3 = the library name without the "-l" option or ".so" suffix.
891 dnl $4 = action to perform if successful (default: update CPPFLAGS, etc)
892 dnl $5 = action to perform if not successful
893 dnl $6 = module name, if not the same as the library name
894 dnl $7 = extra libraries
896 dnl Sets these variables:
897 dnl $cf_cv_find_linkage_$3 - yes/no according to whether linkage is found
898 dnl $cf_cv_header_path_$3 - include-directory if needed
899 dnl $cf_cv_library_path_$3 - library-directory if needed
900 dnl $cf_cv_library_file_$3 - library-file if needed, e.g., -l$3
901 AC_DEFUN([CF_FIND_LINKAGE],[
903 # If the linkage is not already in the $CPPFLAGS/$LDFLAGS configuration, these
904 # will be set on completion of the AC_TRY_LINK below.
905 cf_cv_header_path_$3=
906 cf_cv_library_path_$3=
908 CF_MSG_LOG([Starting [FIND_LINKAGE]($3,$6)])
910 AC_TRY_LINK([$1],[$2],[
911 cf_cv_find_linkage_$3=yes
915 LIBS="-l$3 $7 $cf_save_LIBS"
917 AC_TRY_LINK([$1],[$2],[
918 cf_cv_find_linkage_$3=yes
919 cf_cv_library_file_$3="-l$3"
921 cf_cv_find_linkage_$3=no
924 CF_VERBOSE(find linkage for $3 library)
925 CF_MSG_LOG([Searching for headers in [FIND_LINKAGE]($3,$6)])
927 cf_save_CPPFLAGS="$CPPFLAGS"
928 cf_test_CPPFLAGS="$CPPFLAGS"
930 CF_HEADER_PATH(cf_search,ifelse([$6],,[$3],[$6]))
931 for cf_cv_header_path_$3 in $cf_search
933 if test -d $cf_cv_header_path_$3 ; then
934 CF_VERBOSE(... testing $cf_cv_header_path_$3)
935 CPPFLAGS="$cf_save_CPPFLAGS -I$cf_cv_header_path_$3"
936 AC_TRY_COMPILE([$1],[$2],[
937 CF_VERBOSE(... found $3 headers in $cf_cv_header_path_$3)
938 cf_cv_find_linkage_$3=maybe
939 cf_test_CPPFLAGS="$CPPFLAGS"
941 CPPFLAGS="$cf_save_CPPFLAGS"
946 if test "$cf_cv_find_linkage_$3" = maybe ; then
948 CF_MSG_LOG([Searching for $3 library in [FIND_LINKAGE]($3,$6)])
951 cf_save_LDFLAGS="$LDFLAGS"
954 CPPFLAGS="$cf_test_CPPFLAGS"
955 LIBS="-l$3 $7 $cf_save_LIBS"
956 AC_TRY_LINK([$1],[$2],[
957 CF_VERBOSE(... found $3 library in system)
958 cf_cv_find_linkage_$3=yes])
959 CPPFLAGS="$cf_save_CPPFLAGS"
963 if test "$cf_cv_find_linkage_$3" != yes ; then
964 CF_LIBRARY_PATH(cf_search,$3)
965 for cf_cv_library_path_$3 in $cf_search
967 if test -d $cf_cv_library_path_$3 ; then
968 CF_VERBOSE(... testing $cf_cv_library_path_$3)
969 CPPFLAGS="$cf_test_CPPFLAGS"
970 LIBS="-l$3 $7 $cf_save_LIBS"
971 LDFLAGS="$cf_save_LDFLAGS -L$cf_cv_library_path_$3"
972 AC_TRY_LINK([$1],[$2],[
973 CF_VERBOSE(... found $3 library in $cf_cv_library_path_$3)
974 cf_cv_find_linkage_$3=yes
975 cf_cv_library_file_$3="-l$3"
977 CPPFLAGS="$cf_save_CPPFLAGS"
979 LDFLAGS="$cf_save_LDFLAGS"
984 CPPFLAGS="$cf_save_CPPFLAGS"
985 LDFLAGS="$cf_save_LDFLAGS"
989 cf_cv_find_linkage_$3=no
994 if test "$cf_cv_find_linkage_$3" = yes ; then
996 CF_ADD_INCDIR($cf_cv_header_path_$3)
997 CF_ADD_LIBDIR($cf_cv_library_path_$3)
1001 ifelse([$5],,AC_MSG_WARN(Cannot find $3 library),[$5])
1004 dnl ---------------------------------------------------------------------------
1005 dnl CF_FUNC_CURSES_VERSION version: 4 updated: 2007/04/28 09:15:55
1006 dnl ----------------------
1007 dnl Solaris has a data item 'curses_version', which confuses AC_CHECK_FUNCS.
1008 dnl It's a character string "SVR4", not documented.
1009 AC_DEFUN([CF_FUNC_CURSES_VERSION],
1011 AC_CACHE_CHECK(for function curses_version, cf_cv_func_curses_version,[
1013 #include <${cf_cv_ncurses_header-curses.h}>
1017 sprintf(temp, "%s\n", curses_version());
1018 ${cf_cv_main_return-return}(0);
1020 ,[cf_cv_func_curses_version=yes]
1021 ,[cf_cv_func_curses_version=no]
1022 ,[cf_cv_func_curses_version=unknown])
1024 test "$cf_cv_func_curses_version" = yes && AC_DEFINE(HAVE_CURSES_VERSION)
1026 dnl ---------------------------------------------------------------------------
1027 dnl CF_GCC_ATTRIBUTES version: 13 updated: 2009/08/11 20:19:56
1028 dnl -----------------
1029 dnl Test for availability of useful gcc __attribute__ directives to quiet
1030 dnl compiler warnings. Though useful, not all are supported -- and contrary
1031 dnl to documentation, unrecognized directives cause older compilers to barf.
1032 AC_DEFUN([CF_GCC_ATTRIBUTES],
1034 if test "$GCC" = yes
1036 cat > conftest.i <<EOF
1038 #define GCC_PRINTF 0
1043 #ifndef GCC_NORETURN
1044 #define GCC_NORETURN /* nothing */
1047 #define GCC_UNUSED /* nothing */
1050 if test "$GCC" = yes
1052 AC_CHECKING([for $CC __attribute__ directives])
1053 cat > conftest.$ac_ext <<EOF
1054 #line __oline__ "${as_me-configure}"
1055 #include "confdefs.h"
1056 #include "conftest.h"
1057 #include "conftest.i"
1059 #define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
1061 #define GCC_PRINTFLIKE(fmt,var) /*nothing*/
1064 #define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var)))
1066 #define GCC_SCANFLIKE(fmt,var) /*nothing*/
1068 extern void wow(char *,...) GCC_SCANFLIKE(1,2);
1069 extern void oops(char *,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN;
1070 extern void foo(void) GCC_NORETURN;
1071 int main(int argc GCC_UNUSED, char *argv[[]] GCC_UNUSED) { return 0; }
1073 cf_printf_attribute=no
1074 cf_scanf_attribute=no
1075 for cf_attribute in scanf printf unused noreturn
1077 CF_UPPER(cf_ATTRIBUTE,$cf_attribute)
1078 cf_directive="__attribute__(($cf_attribute))"
1079 echo "checking for $CC $cf_directive" 1>&AC_FD_CC
1081 case $cf_attribute in #(vi
1083 cf_printf_attribute=yes
1084 cat >conftest.h <<EOF
1085 #define GCC_$cf_ATTRIBUTE 1
1089 cf_scanf_attribute=yes
1090 cat >conftest.h <<EOF
1091 #define GCC_$cf_ATTRIBUTE 1
1095 cat >conftest.h <<EOF
1096 #define GCC_$cf_ATTRIBUTE $cf_directive
1101 if AC_TRY_EVAL(ac_compile); then
1102 test -n "$verbose" && AC_MSG_RESULT(... $cf_attribute)
1103 cat conftest.h >>confdefs.h
1104 case $cf_attribute in #(vi
1106 if test "$cf_printf_attribute" = no ; then
1107 cat >>confdefs.h <<EOF
1108 #define GCC_PRINTFLIKE(fmt,var) /* nothing */
1111 cat >>confdefs.h <<EOF
1112 #define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
1117 if test "$cf_scanf_attribute" = no ; then
1118 cat >>confdefs.h <<EOF
1119 #define GCC_SCANFLIKE(fmt,var) /* nothing */
1122 cat >>confdefs.h <<EOF
1123 #define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var)))
1131 fgrep define conftest.i >>confdefs.h
1136 dnl ---------------------------------------------------------------------------
1137 dnl CF_GCC_VERSION version: 4 updated: 2005/08/27 09:53:42
1139 dnl Find version of gcc
1140 AC_DEFUN([CF_GCC_VERSION],[
1141 AC_REQUIRE([AC_PROG_CC])
1143 if test "$GCC" = yes ; then
1144 AC_MSG_CHECKING(version of $CC)
1145 GCC_VERSION="`${CC} --version| sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`"
1146 test -z "$GCC_VERSION" && GCC_VERSION=unknown
1147 AC_MSG_RESULT($GCC_VERSION)
1150 dnl ---------------------------------------------------------------------------
1151 dnl CF_GCC_WARNINGS version: 24 updated: 2009/02/01 15:21:00
1153 dnl Check if the compiler supports useful warning options. There's a few that
1154 dnl we don't use, simply because they're too noisy:
1156 dnl -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x)
1157 dnl -Wredundant-decls (system headers make this too noisy)
1158 dnl -Wtraditional (combines too many unrelated messages, only a few useful)
1159 dnl -Wwrite-strings (too noisy, but should review occasionally). This
1160 dnl is enabled for ncurses using "--enable-const".
1164 dnl $1 is an optional list of gcc warning flags that a particular
1165 dnl application might want to use, e.g., "no-unused" for
1168 dnl If $with_ext_const is "yes", add a check for -Wwrite-strings
1170 AC_DEFUN([CF_GCC_WARNINGS],
1172 AC_REQUIRE([CF_GCC_VERSION])
1173 CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS)
1175 cat > conftest.$ac_ext <<EOF
1176 #line __oline__ "${as_me-configure}"
1177 int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; }
1180 if test "$INTEL_COMPILER" = yes
1182 # The "-wdXXX" options suppress warnings:
1183 # remark #1419: external declaration in primary source file
1184 # remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
1185 # remark #1684: conversion from pointer to same-sized integral type (potential portability problem)
1186 # remark #193: zero used for undefined preprocessing identifier
1187 # remark #593: variable "curs_sb_left_arrow" was set but never used
1188 # remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits
1189 # remark #869: parameter "tw" was never referenced
1190 # remark #981: operands are evaluated in unspecified order
1191 # warning #279: controlling expression is constant
1193 AC_CHECKING([for $CC warning options])
1194 cf_save_CFLAGS="$CFLAGS"
1195 EXTRA_CFLAGS="-Wall"
1207 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
1208 if AC_TRY_EVAL(ac_compile); then
1209 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
1210 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
1213 CFLAGS="$cf_save_CFLAGS"
1215 elif test "$GCC" = yes
1217 AC_CHECKING([for $CC warning options])
1218 cf_save_CFLAGS="$CFLAGS"
1219 EXTRA_CFLAGS="-W -Wall"
1221 test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings"
1223 Wbad-function-cast \
1227 Wmissing-declarations \
1228 Wmissing-prototypes \
1232 Wstrict-prototypes \
1233 Wundef $cf_warn_CONST $1
1235 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
1236 if AC_TRY_EVAL(ac_compile); then
1237 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
1238 case $cf_opt in #(vi
1240 CPPFLAGS="$CPPFLAGS -DXTSTRINGDEFINES"
1243 case $GCC_VERSION in
1245 CF_VERBOSE(feature is broken in gcc $GCC_VERSION)
1250 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
1253 CFLAGS="$cf_save_CFLAGS"
1257 AC_SUBST(EXTRA_CFLAGS)
1259 dnl ---------------------------------------------------------------------------
1260 dnl CF_GNU_SOURCE version: 6 updated: 2005/07/09 13:23:07
1262 dnl Check if we must define _GNU_SOURCE to get a reasonable value for
1263 dnl _XOPEN_SOURCE, upon which many POSIX definitions depend. This is a defect
1264 dnl (or misfeature) of glibc2, which breaks portability of many applications,
1265 dnl since it is interwoven with GNU extensions.
1267 dnl Well, yes we could work around it...
1268 AC_DEFUN([CF_GNU_SOURCE],
1270 AC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[
1271 AC_TRY_COMPILE([#include <sys/types.h>],[
1272 #ifndef _XOPEN_SOURCE
1275 [cf_cv_gnu_source=no],
1276 [cf_save="$CPPFLAGS"
1277 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
1278 AC_TRY_COMPILE([#include <sys/types.h>],[
1279 #ifdef _XOPEN_SOURCE
1282 [cf_cv_gnu_source=no],
1283 [cf_cv_gnu_source=yes])
1287 test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
1289 dnl ---------------------------------------------------------------------------
1290 dnl CF_HEADER_PATH version: 10 updated: 2010/01/17 20:36:17
1292 dnl Construct a search-list of directories for a nonstandard header-file
1295 dnl $1 = the variable to return as result
1296 dnl $2 = the package name
1297 AC_DEFUN([CF_HEADER_PATH],
1300 cf_header_path_list=""
1301 if test -n "${CFLAGS}${CPPFLAGS}" ; then
1302 for cf_header_path in $CPPFLAGS $CFLAGS
1304 case $cf_header_path in #(vi
1306 cf_header_path=`echo ".$cf_header_path" |sed -e 's/^...//' -e 's,/include$,,'`
1307 CF_ADD_SUBDIR_PATH($1,$2,include,$cf_header_path,NONE)
1308 cf_header_path_list="$cf_header_path_list [$]$1"
1314 CF_SUBDIR_PATH($1,$2,include)
1316 test "$includedir" != NONE && \
1317 test "$includedir" != "/usr/include" && \
1318 test -d "$includedir" && {
1319 test -d $includedir && $1="[$]$1 $includedir"
1320 test -d $includedir/$2 && $1="[$]$1 $includedir/$2"
1323 test "$oldincludedir" != NONE && \
1324 test "$oldincludedir" != "/usr/include" && \
1325 test -d "$oldincludedir" && {
1326 test -d $oldincludedir && $1="[$]$1 $oldincludedir"
1327 test -d $oldincludedir/$2 && $1="[$]$1 $oldincludedir/$2"
1330 $1="$cf_header_path_list [$]$1"
1332 dnl ---------------------------------------------------------------------------
1333 dnl CF_INHERIT_SCRIPT version: 2 updated: 2003/03/01 23:50:42
1334 dnl -----------------
1335 dnl If we do not have a given script, look for it in the parent directory.
1336 AC_DEFUN([CF_INHERIT_SCRIPT],
1338 test -f $1 || ( test -f ../$1 && cp ../$1 ./ )
1340 dnl ---------------------------------------------------------------------------
1341 dnl CF_INTEL_COMPILER version: 3 updated: 2005/08/06 18:37:29
1342 dnl -----------------
1343 dnl Check if the given compiler is really the Intel compiler for Linux. It
1344 dnl tries to imitate gcc, but does not return an error when it finds a mismatch
1345 dnl between prototypes, e.g., as exercised by CF_MISSING_CHECK.
1347 dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to
1348 dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from
1349 dnl the wrappers for gcc and g++ warnings.
1351 dnl $1 = GCC (default) or GXX
1352 dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS
1353 dnl $3 = CFLAGS (default) or CXXFLAGS
1354 AC_DEFUN([CF_INTEL_COMPILER],[
1355 ifelse($2,,INTEL_COMPILER,[$2])=no
1357 if test "$ifelse($1,,[$1],GCC)" = yes ; then
1360 AC_MSG_CHECKING(if this is really Intel ifelse($1,GXX,C++,C) compiler)
1361 cf_save_CFLAGS="$ifelse($3,,CFLAGS,[$3])"
1362 ifelse($3,,CFLAGS,[$3])="$ifelse($3,,CFLAGS,[$3]) -no-gcc"
1364 #ifdef __INTEL_COMPILER
1368 ],[ifelse($2,,INTEL_COMPILER,[$2])=yes
1369 cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc"
1371 ifelse($3,,CFLAGS,[$3])="$cf_save_CFLAGS"
1372 AC_MSG_RESULT($ifelse($2,,INTEL_COMPILER,[$2]))
1377 dnl ---------------------------------------------------------------------------
1378 dnl CF_LIBRARY_PATH version: 9 updated: 2010/03/28 12:52:50
1380 dnl Construct a search-list of directories for a nonstandard library-file
1383 dnl $1 = the variable to return as result
1384 dnl $2 = the package name
1385 AC_DEFUN([CF_LIBRARY_PATH],
1388 cf_library_path_list=""
1389 if test -n "${LDFLAGS}${LIBS}" ; then
1390 for cf_library_path in $LDFLAGS $LIBS
1392 case $cf_library_path in #(vi
1394 cf_library_path=`echo ".$cf_library_path" |sed -e 's/^...//' -e 's,/lib$,,'`
1395 CF_ADD_SUBDIR_PATH($1,$2,lib,$cf_library_path,NONE)
1396 cf_library_path_list="$cf_library_path_list [$]$1"
1402 CF_SUBDIR_PATH($1,$2,lib)
1404 $1="$cf_library_path_list [$]$1"
1406 dnl ---------------------------------------------------------------------------
1407 dnl CF_MAKE_TAGS version: 5 updated: 2010/04/03 20:07:32
1409 dnl Generate tags/TAGS targets for makefiles. Do not generate TAGS if we have
1410 dnl a monocase filesystem.
1411 AC_DEFUN([CF_MAKE_TAGS],[
1412 AC_REQUIRE([CF_MIXEDCASE_FILENAMES])
1414 AC_CHECK_PROGS(CTAGS, exctags ctags)
1415 AC_CHECK_PROGS(ETAGS, exetags etags)
1417 AC_CHECK_PROG(MAKE_LOWER_TAGS, ${CTAGS-ctags}, yes, no)
1419 if test "$cf_cv_mixedcase" = yes ; then
1420 AC_CHECK_PROG(MAKE_UPPER_TAGS, ${ETAGS-etags}, yes, no)
1425 if test "$MAKE_UPPER_TAGS" = yes ; then
1431 if test "$MAKE_LOWER_TAGS" = yes ; then
1440 AC_SUBST(MAKE_UPPER_TAGS)
1441 AC_SUBST(MAKE_LOWER_TAGS)
1443 dnl ---------------------------------------------------------------------------
1444 dnl CF_MIN_GETCCHAR version: 2 updated: 2009/07/16 21:03:10
1447 dnl Check whether getcchar's return value counts the trailing null in a wchar_t
1448 dnl string, or not. X/Open says it does, but Tru64 and Solaris do not do this.
1449 AC_DEFUN([CF_MIN_GETCCHAR],[
1450 AC_CACHE_CHECK(if getcchar counts trailing null,cf_cv_min_getcchar,[
1454 #include <${cf_cv_ncurses_header-curses.h}>
1462 setcchar(temp, data, 0, 0, (void *)0);
1463 count = getcchar(temp, (wchar_t *)0, (attr_t *)0, (short *)0, (void *)0);
1464 ${cf_cv_main_return-return}(count != 0);
1466 [cf_cv_min_getcchar=no],
1467 [cf_cv_min_getcchar=yes],
1468 [cf_cv_min_getcchar=yes])
1470 if test "$cf_cv_min_getcchar" = yes ; then
1471 AC_DEFINE(MIN_GETCCHAR,1)
1474 dnl ---------------------------------------------------------------------------
1475 dnl CF_MIXEDCASE_FILENAMES version: 3 updated: 2003/09/20 17:07:55
1476 dnl ----------------------
1477 dnl Check if the file-system supports mixed-case filenames. If we're able to
1478 dnl create a lowercase name and see it as uppercase, it doesn't support that.
1479 AC_DEFUN([CF_MIXEDCASE_FILENAMES],
1481 AC_CACHE_CHECK(if filesystem supports mixed-case filenames,cf_cv_mixedcase,[
1482 if test "$cross_compiling" = yes ; then
1483 case $target_alias in #(vi
1484 *-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-mingw32*|*-uwin*) #(vi
1492 rm -f conftest CONFTEST
1494 if test -f CONFTEST ; then
1499 rm -f conftest CONFTEST
1502 test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES)
1504 dnl ---------------------------------------------------------------------------
1505 dnl CF_MSG_LOG version: 4 updated: 2007/07/29 09:55:12
1507 dnl Write a debug message to config.log, along with the line number in the
1508 dnl configure script.
1509 AC_DEFUN([CF_MSG_LOG],[
1510 echo "${as_me-configure}:__oline__: testing $* ..." 1>&AC_FD_CC
1512 dnl ---------------------------------------------------------------------------
1513 dnl CF_NCURSES_CC_CHECK version: 4 updated: 2007/07/29 10:39:05
1514 dnl -------------------
1515 dnl Check if we can compile with ncurses' header file
1516 dnl $1 is the cache variable to set
1517 dnl $2 is the header-file to include
1518 dnl $3 is the root name (ncurses or ncursesw)
1519 AC_DEFUN([CF_NCURSES_CC_CHECK],[
1521 ]ifelse($3,ncursesw,[
1522 #define _XOPEN_SOURCE_EXTENDED
1523 #undef HAVE_LIBUTF8_H /* in case we used CF_UTF8_LIB */
1524 #define HAVE_LIBUTF8_H /* to force ncurses' header file to use cchar_t */
1527 #ifdef NCURSES_VERSION
1528 ]ifelse($3,ncursesw,[
1533 printf("%s\n", NCURSES_VERSION);
1545 dnl ---------------------------------------------------------------------------
1546 dnl CF_NCURSES_CONFIG version: 5 updated: 2009/01/11 15:31:22
1547 dnl -----------------
1548 dnl Tie together the configure-script macros for ncurses.
1549 dnl Prefer the "-config" script from ncurses 5.6, to simplify analysis.
1550 dnl Allow that to be overridden using the $NCURSES_CONFIG environment variable.
1552 dnl $1 is the root library name (default: "ncurses")
1553 AC_DEFUN([CF_NCURSES_CONFIG],
1555 cf_ncuconfig_root=ifelse($1,,ncurses,$1)
1557 echo "Looking for ${cf_ncuconfig_root}-config"
1558 AC_PATH_PROGS(NCURSES_CONFIG,${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config,none)
1560 if test "$NCURSES_CONFIG" != none ; then
1562 cf_cv_ncurses_header=curses.h
1564 CPPFLAGS="$CPPFLAGS `$NCURSES_CONFIG --cflags`"
1565 LIBS="`$NCURSES_CONFIG --libs` $LIBS"
1567 dnl like CF_NCURSES_CPPFLAGS
1570 dnl like CF_NCURSES_LIBS
1571 CF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_ncuconfig_root)
1572 AC_DEFINE_UNQUOTED($cf_nculib_ROOT)
1574 dnl like CF_NCURSES_VERSION
1575 cf_cv_ncurses_version=`$NCURSES_CONFIG --version`
1579 CF_NCURSES_CPPFLAGS(ifelse($1,,ncurses,$1))
1580 CF_NCURSES_LIBS(ifelse($1,,ncurses,$1))
1584 dnl ---------------------------------------------------------------------------
1585 dnl CF_NCURSES_CPPFLAGS version: 19 updated: 2007/07/29 13:35:20
1586 dnl -------------------
1587 dnl Look for the SVr4 curses clone 'ncurses' in the standard places, adjusting
1588 dnl the CPPFLAGS variable so we can include its header.
1590 dnl The header files may be installed as either curses.h, or ncurses.h (would
1591 dnl be obsolete, except that some packagers prefer this name to distinguish it
1592 dnl from a "native" curses implementation). If not installed for overwrite,
1593 dnl the curses.h file would be in an ncurses subdirectory (e.g.,
1594 dnl /usr/include/ncurses), but someone may have installed overwriting the
1595 dnl vendor's curses. Only very old versions (pre-1.9.2d, the first autoconf'd
1596 dnl version) of ncurses don't define either __NCURSES_H or NCURSES_VERSION in
1599 dnl If the installer has set $CFLAGS or $CPPFLAGS so that the ncurses header
1600 dnl is already in the include-path, don't even bother with this, since we cannot
1601 dnl easily determine which file it is. In this case, it has to be <curses.h>.
1603 dnl The optional parameter gives the root name of the library, in case it is
1604 dnl not installed as the default curses library. That is how the
1605 dnl wide-character version of ncurses is installed.
1606 AC_DEFUN([CF_NCURSES_CPPFLAGS],
1607 [AC_REQUIRE([CF_WITH_CURSES_DIR])
1609 AC_PROVIDE([CF_CURSES_CPPFLAGS])dnl
1610 cf_ncuhdr_root=ifelse($1,,ncurses,$1)
1612 test -n "$cf_cv_curses_dir" && \
1613 test "$cf_cv_curses_dir" != "no" && { \
1614 CF_ADD_INCDIR($cf_cv_curses_dir/include $cf_cv_curses_dir/include/$cf_ncuhdr_root)
1617 AC_CACHE_CHECK(for $cf_ncuhdr_root header in include-path, cf_cv_ncurses_h,[
1618 cf_header_list="$cf_ncuhdr_root/curses.h $cf_ncuhdr_root/ncurses.h"
1619 ( test "$cf_ncuhdr_root" = ncurses || test "$cf_ncuhdr_root" = ncursesw ) && cf_header_list="$cf_header_list curses.h ncurses.h"
1620 for cf_header in $cf_header_list
1622 CF_NCURSES_CC_CHECK(cf_cv_ncurses_h,$cf_header,$1)
1623 test "$cf_cv_ncurses_h" != no && break
1630 # some applications need this, but should check for NCURSES_VERSION
1635 dnl ---------------------------------------------------------------------------
1636 dnl CF_NCURSES_EXT_FUNCS version: 1 updated: 2010/04/03 11:44:55
1637 dnl --------------------
1638 dnl Since 2007/11/17, ncurses has defined NCURSES_EXT_FUNCS; earlier versions
1639 dnl may provide these functions. Define the symbol if it is not defined, and
1641 AC_DEFUN([CF_NCURSES_EXT_FUNCS],
1643 AC_CACHE_CHECK(for ncurses extended functions,cf_cv_ncurses_ext_funcs,[
1645 #include <${cf_cv_ncurses_header-curses.h}>],
1647 int x = NCURSES_EXT_FUNCS
1648 ],[cf_cv_ncurses_ext_funcs=defined],[
1650 #include <${cf_cv_ncurses_header-curses.h}>],
1652 (void) assume_default_colors (0, 0);
1653 (void) curses_version ();
1654 (void) define_key (0, 0);
1655 (void) is_term_resized (0, 0);
1656 (void) key_defined (0);
1657 (void) keybound (0, 0);
1658 (void) keyok (0, 0);
1659 (void) resize_term (0, 0);
1660 (void) resizeterm (0, 0);
1661 (void) use_default_colors ();
1662 (void) use_extended_names (0);
1663 (void) wresize (0, 0, 0);],
1664 [cf_cv_ncurses_ext_funcs=yes],
1665 [cf_cv_ncurses_ext_funcs=no])
1668 test "$cf_cv_ncurses_ext_funcs" == yes && AC_DEFINE(NCURSES_EXT_FUNCS)
1670 dnl ---------------------------------------------------------------------------
1671 dnl CF_NCURSES_HEADER version: 2 updated: 2008/03/23 14:48:54
1672 dnl -----------------
1673 dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common
1674 dnl variations of ncurses' installs.
1676 dnl See also CF_CURSES_HEADER, which sets the same cache variable.
1677 AC_DEFUN([CF_NCURSES_HEADER],[
1679 if test "$cf_cv_ncurses_h" != no ; then
1680 cf_cv_ncurses_header=$cf_cv_ncurses_h
1683 AC_CACHE_CHECK(for $cf_ncuhdr_root include-path, cf_cv_ncurses_h2,[
1684 test -n "$verbose" && echo
1685 CF_HEADER_PATH(cf_search,$cf_ncuhdr_root)
1686 test -n "$verbose" && echo search path $cf_search
1687 cf_save2_CPPFLAGS="$CPPFLAGS"
1688 for cf_incdir in $cf_search
1690 CF_ADD_INCDIR($cf_incdir)
1695 CF_NCURSES_CC_CHECK(cf_cv_ncurses_h2,$cf_header,$1)
1696 if test "$cf_cv_ncurses_h2" != no ; then
1697 cf_cv_ncurses_h2=$cf_incdir/$cf_header
1698 test -n "$verbose" && echo $ac_n " ... found $ac_c" 1>&AC_FD_MSG
1701 test -n "$verbose" && echo " ... tested $cf_incdir/$cf_header" 1>&AC_FD_MSG
1703 CPPFLAGS="$cf_save2_CPPFLAGS"
1704 test "$cf_cv_ncurses_h2" != no && break
1706 test "$cf_cv_ncurses_h2" = no && AC_MSG_ERROR(not found)
1709 CF_DIRNAME(cf_1st_incdir,$cf_cv_ncurses_h2)
1710 cf_cv_ncurses_header=`basename $cf_cv_ncurses_h2`
1711 if test `basename $cf_1st_incdir` = $cf_ncuhdr_root ; then
1712 cf_cv_ncurses_header=$cf_ncuhdr_root/$cf_cv_ncurses_header
1714 CF_ADD_INCDIR($cf_1st_incdir)
1718 # Set definitions to allow ifdef'ing for ncurses.h
1720 case $cf_cv_ncurses_header in # (vi
1722 AC_DEFINE(HAVE_NCURSES_H)
1726 case $cf_cv_ncurses_header in # (vi
1727 ncurses/curses.h|ncurses/ncurses.h)
1728 AC_DEFINE(HAVE_NCURSES_NCURSES_H)
1730 ncursesw/curses.h|ncursesw/ncurses.h)
1731 AC_DEFINE(HAVE_NCURSESW_NCURSES_H)
1736 dnl ---------------------------------------------------------------------------
1737 dnl CF_NCURSES_LIBS version: 13 updated: 2007/07/29 10:29:20
1739 dnl Look for the ncurses library. This is a little complicated on Linux,
1740 dnl because it may be linked with the gpm (general purpose mouse) library.
1741 dnl Some distributions have gpm linked with (bsd) curses, which makes it
1742 dnl unusable with ncurses. However, we don't want to link with gpm unless
1743 dnl ncurses has a dependency, since gpm is normally set up as a shared library,
1744 dnl and the linker will record a dependency.
1746 dnl The optional parameter gives the root name of the library, in case it is
1747 dnl not installed as the default curses library. That is how the
1748 dnl wide-character version of ncurses is installed.
1749 AC_DEFUN([CF_NCURSES_LIBS],
1750 [AC_REQUIRE([CF_NCURSES_CPPFLAGS])
1752 cf_nculib_root=ifelse($1,,ncurses,$1)
1753 # This works, except for the special case where we find gpm, but
1754 # ncurses is in a nonstandard location via $LIBS, and we really want
1757 cf_ncurses_SAVE="$LIBS"
1758 AC_CHECK_LIB(gpm,Gpm_Open,
1759 [AC_CHECK_LIB(gpm,initscr,
1760 [LIBS="$cf_ncurses_SAVE"],
1761 [cf_ncurses_LIBS="-lgpm"])])
1763 case $host_os in #(vi
1765 # This is only necessary if you are linking against an obsolete
1766 # version of ncurses (but it should do no harm, since it's static).
1767 if test "$cf_nculib_root" = ncurses ; then
1768 AC_CHECK_LIB(mytinfo,tgoto,[cf_ncurses_LIBS="-lmytinfo $cf_ncurses_LIBS"])
1773 LIBS="$cf_ncurses_LIBS $LIBS"
1775 if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" )
1777 CF_ADD_LIBDIR($cf_cv_curses_dir/lib)
1778 LIBS="-l$cf_nculib_root $LIBS"
1780 CF_FIND_LIBRARY($cf_nculib_root,$cf_nculib_root,
1781 [#include <${cf_cv_ncurses_header-curses.h}>],
1786 if test -n "$cf_ncurses_LIBS" ; then
1787 AC_MSG_CHECKING(if we can link $cf_nculib_root without $cf_ncurses_LIBS)
1788 cf_ncurses_SAVE="$LIBS"
1789 for p in $cf_ncurses_LIBS ; do
1790 q=`echo $LIBS | sed -e "s%$p %%" -e "s%$p$%%"`
1791 if test "$q" != "$LIBS" ; then
1795 AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>],
1796 [initscr(); mousemask(0,0); tgoto((char *)0, 0, 0);],
1797 [AC_MSG_RESULT(yes)],
1799 LIBS="$cf_ncurses_SAVE"])
1802 CF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_nculib_root)
1803 AC_DEFINE_UNQUOTED($cf_nculib_ROOT)
1805 dnl ---------------------------------------------------------------------------
1806 dnl CF_NCURSES_VERSION version: 12 updated: 2007/04/28 09:15:55
1807 dnl ------------------
1808 dnl Check for the version of ncurses, to aid in reporting bugs, etc.
1809 dnl Call CF_CURSES_CPPFLAGS first, or CF_NCURSES_CPPFLAGS. We don't use
1810 dnl AC_REQUIRE since that does not work with the shell's if/then/else/fi.
1811 AC_DEFUN([CF_NCURSES_VERSION],
1813 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
1814 AC_CACHE_CHECK(for ncurses version, cf_cv_ncurses_version,[
1815 cf_cv_ncurses_version=no
1819 #include <${cf_cv_ncurses_header-curses.h}>
1823 FILE *fp = fopen("$cf_tempfile", "w");
1824 #ifdef NCURSES_VERSION
1825 # ifdef NCURSES_VERSION_PATCH
1826 fprintf(fp, "%s.%d\n", NCURSES_VERSION, NCURSES_VERSION_PATCH);
1828 fprintf(fp, "%s\n", NCURSES_VERSION);
1832 fprintf(fp, "old\n");
1837 ${cf_cv_main_return-return}(0);
1839 cf_cv_ncurses_version=`cat $cf_tempfile`],,[
1841 # This will not work if the preprocessor splits the line after the
1842 # Autoconf token. The 'unproto' program does that.
1843 cat > conftest.$ac_ext <<EOF
1844 #include <${cf_cv_ncurses_header-curses.h}>
1846 #ifdef NCURSES_VERSION
1847 Autoconf NCURSES_VERSION
1855 cf_try="$ac_cpp conftest.$ac_ext 2>&AC_FD_CC | grep '^Autoconf ' >conftest.out"
1857 if test -f conftest.out ; then
1858 cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[[^"]]*"%%' -e 's%".*%%'`
1859 test -n "$cf_out" && cf_cv_ncurses_version="$cf_out"
1865 test "$cf_cv_ncurses_version" = no || AC_DEFINE(NCURSES)
1867 dnl ---------------------------------------------------------------------------
1868 dnl CF_NCURSES_WRAP_PREFIX version: 1 updated: 2009/03/28 16:08:10
1869 dnl ----------------------
1870 dnl Check for ncurses "wrap-prefix" used for public variables which have been
1871 dnl wrapped with a function to help with concurrency control.
1872 AC_DEFUN([CF_NCURSES_WRAP_PREFIX],
1874 AC_MSG_CHECKING(for ncurses wrap-prefix)
1875 AC_ARG_WITH(ncurses-wrap-prefix,
1876 [ --with-ncurses-wrap-prefix naming-prefix for ncurses wrapped-variables],
1877 [NCURSES_WRAP_PREFIX=$withval],
1878 [NCURSES_WRAP_PREFIX=_nc_])
1879 AC_MSG_RESULT($NCURSES_WRAP_PREFIX)
1881 AC_SUBST(NCURSES_WRAP_PREFIX)
1883 dnl ---------------------------------------------------------------------------
1884 dnl CF_PATH_SYNTAX version: 12 updated: 2008/03/23 14:45:59
1886 dnl Check the argument to see that it looks like a pathname. Rewrite it if it
1887 dnl begins with one of the prefix/exec_prefix variables, and then again if the
1888 dnl result begins with 'NONE'. This is necessary to work around autoconf's
1889 dnl delayed evaluation of those symbols.
1890 AC_DEFUN([CF_PATH_SYNTAX],[
1891 if test "x$prefix" != xNONE; then
1892 cf_path_syntax="$prefix"
1894 cf_path_syntax="$ac_default_prefix"
1897 case ".[$]$1" in #(vi
1898 .\[$]\(*\)*|.\'*\'*) #(vi
1902 .[[a-zA-Z]]:[[\\/]]*) #(vi OS/2 EMX
1904 .\[$]{*prefix}*) #(vi
1906 case ".[$]$1" in #(vi
1908 $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%`
1913 $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%`
1916 ifelse($2,,[AC_MSG_ERROR([expected a pathname, not \"[$]$1\"])],$2)
1920 dnl ---------------------------------------------------------------------------
1921 dnl CF_PDCURSES_X11 version: 9 updated: 2009/01/11 15:31:37
1923 dnl Configure for PDCurses' X11 library
1924 AC_DEFUN([CF_PDCURSES_X11],[
1925 AC_REQUIRE([CF_X_ATHENA])
1927 AC_PATH_PROGS(XCURSES_CONFIG,xcurses-config,none)
1929 if test "$XCURSES_CONFIG" != none ; then
1931 CPPFLAGS="$CPPFLAGS `$XCURSES_CONFIG --cflags`"
1932 LIBS="`$XCURSES_CONFIG --libs` $LIBS"
1934 cf_cv_lib_XCurses=yes
1938 LDFLAGS="$LDFLAGS $X_LIBS"
1939 CF_CHECK_CFLAGS($X_CFLAGS)
1940 AC_CHECK_LIB(X11,XOpenDisplay,
1941 [LIBS="-lX11 $LIBS"],,
1942 [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])
1943 AC_CACHE_CHECK(for XCurses library,cf_cv_lib_XCurses,[
1944 LIBS="-lXCurses $LIBS"
1946 #include <xcurses.h>
1947 char *XCursesProgramName = "test";
1949 [cf_cv_lib_XCurses=yes],
1950 [cf_cv_lib_XCurses=no])
1955 if test $cf_cv_lib_XCurses = yes ; then
1958 AC_DEFINE(HAVE_XCURSES)
1960 AC_MSG_ERROR(Cannot link with XCurses)
1963 dnl ---------------------------------------------------------------------------
1964 dnl CF_POSIX_C_SOURCE version: 7 updated: 2010/01/09 11:05:50
1965 dnl -----------------
1966 dnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed.
1968 dnl POSIX.1-1990 _POSIX_SOURCE
1969 dnl POSIX.1-1990 and _POSIX_SOURCE and
1970 dnl POSIX.2-1992 C-Language _POSIX_C_SOURCE=2
1972 dnl POSIX.1b-1993 _POSIX_C_SOURCE=199309L
1973 dnl POSIX.1c-1996 _POSIX_C_SOURCE=199506L
1974 dnl X/Open 2000 _POSIX_C_SOURCE=200112L
1977 dnl $1 is the nominal value for _POSIX_C_SOURCE
1978 AC_DEFUN([CF_POSIX_C_SOURCE],
1980 cf_POSIX_C_SOURCE=ifelse($1,,199506L,$1)
1982 cf_save_CFLAGS="$CFLAGS"
1983 cf_save_CPPFLAGS="$CPPFLAGS"
1985 CF_REMOVE_DEFINE(cf_trim_CFLAGS,$cf_save_CFLAGS,_POSIX_C_SOURCE)
1986 CF_REMOVE_DEFINE(cf_trim_CPPFLAGS,$cf_save_CPPFLAGS,_POSIX_C_SOURCE)
1988 AC_CACHE_CHECK(if we should define _POSIX_C_SOURCE,cf_cv_posix_c_source,[
1989 CF_MSG_LOG(if the symbol is already defined go no further)
1990 AC_TRY_COMPILE([#include <sys/types.h>],[
1991 #ifndef _POSIX_C_SOURCE
1994 [cf_cv_posix_c_source=no],
1995 [cf_want_posix_source=no
1996 case .$cf_POSIX_C_SOURCE in #(vi
1998 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
2001 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
2002 cf_want_posix_source=yes
2005 cf_want_posix_source=yes
2008 if test "$cf_want_posix_source" = yes ; then
2009 AC_TRY_COMPILE([#include <sys/types.h>],[
2010 #ifdef _POSIX_SOURCE
2013 cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE")
2015 CF_MSG_LOG(ifdef from value $cf_POSIX_C_SOURCE)
2016 CFLAGS="$cf_trim_CFLAGS"
2017 CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source"
2018 CF_MSG_LOG(if the second compile does not leave our definition intact error)
2019 AC_TRY_COMPILE([#include <sys/types.h>],[
2020 #ifndef _POSIX_C_SOURCE
2023 [cf_cv_posix_c_source=no])
2024 CFLAGS="$cf_save_CFLAGS"
2025 CPPFLAGS="$cf_save_CPPFLAGS"
2029 if test "$cf_cv_posix_c_source" != no ; then
2030 CFLAGS="$cf_trim_CFLAGS"
2031 CPPFLAGS="$cf_trim_CPPFLAGS"
2032 CF_ADD_CFLAGS($cf_cv_posix_c_source)
2036 dnl ---------------------------------------------------------------------------
2037 dnl CF_PRG_RULES version: 1 updated: 2006/06/03 11:45:08
2039 dnl Append definitions and rules for the given programs to the subdirectory
2040 dnl Makefiles, and the recursion rule for the top-level Makefile.
2043 dnl $1 = script to run
2044 dnl $2 = list of subdirectories
2048 AC_DEFUN([CF_PRG_RULES],
2052 if test ! -d $srcdir/$cf_dir; then
2054 elif test -f $srcdir/$cf_dir/programs; then
2055 $AWK -f $1 $srcdir/$cf_dir/programs >>$cf_dir/Makefile
2060 dnl ---------------------------------------------------------------------------
2061 dnl CF_PROG_CC_U_D version: 1 updated: 2005/07/14 16:59:30
2063 dnl Check if C (preprocessor) -U and -D options are processed in the order
2064 dnl given rather than by type of option. Some compilers insist on apply all
2065 dnl of the -U options after all of the -D options. Others allow mixing them,
2066 dnl and may predefine symbols that conflict with those we define.
2067 AC_DEFUN([CF_PROG_CC_U_D],
2069 AC_CACHE_CHECK(if $CC -U and -D options work together,cf_cv_cc_u_d_options,[
2070 cf_save_CPPFLAGS="$CPPFLAGS"
2071 CPPFLAGS="-UU_D_OPTIONS -DU_D_OPTIONS -DD_U_OPTIONS -UD_U_OPTIONS"
2074 make an undefined-error
2077 make a defined-error
2080 cf_cv_cc_u_d_options=yes],[
2081 cf_cv_cc_u_d_options=no])
2082 CPPFLAGS="$cf_save_CPPFLAGS"
2085 dnl ---------------------------------------------------------------------------
2086 dnl CF_REMOVE_DEFINE version: 3 updated: 2010/01/09 11:05:50
2087 dnl ----------------
2088 dnl Remove all -U and -D options that refer to the given symbol from a list
2089 dnl of C compiler options. This works around the problem that not all
2090 dnl compilers process -U and -D options from left-to-right, so a -U option
2091 dnl cannot be used to cancel the effect of a preceding -D option.
2093 dnl $1 = target (which could be the same as the source variable)
2094 dnl $2 = source (including '$')
2095 dnl $3 = symbol to remove
2096 define([CF_REMOVE_DEFINE],
2099 sed -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[[ ]]/ /g' \
2100 -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[$]//g'`
2102 dnl ---------------------------------------------------------------------------
2103 dnl CF_SIG_ATOMIC_T version: 2 updated: 2005/09/18 17:27:12
2105 dnl signal handler, but there are some gcc depedencies in that recommendation.
2107 AC_DEFUN([CF_SIG_ATOMIC_T],
2109 AC_MSG_CHECKING(for signal global datatype)
2110 AC_CACHE_VAL(cf_cv_sig_atomic_t,[
2112 "volatile sig_atomic_t" \
2117 #include <sys/types.h>
2123 static void handler(int sig)
2127 [signal(SIGINT, handler);
2129 [cf_cv_sig_atomic_t=$cf_type],
2130 [cf_cv_sig_atomic_t=no])
2131 test "$cf_cv_sig_atomic_t" != no && break
2134 AC_MSG_RESULT($cf_cv_sig_atomic_t)
2135 test "$cf_cv_sig_atomic_t" != no && AC_DEFINE_UNQUOTED(SIG_ATOMIC_T, $cf_cv_sig_atomic_t)
2137 dnl ---------------------------------------------------------------------------
2138 dnl CF_SUBDIR_PATH version: 5 updated: 2007/07/29 09:55:12
2140 dnl Construct a search-list for a nonstandard header/lib-file
2141 dnl $1 = the variable to return as result
2142 dnl $2 = the package name
2143 dnl $3 = the subdirectory, e.g., bin, include or lib
2144 AC_DEFUN([CF_SUBDIR_PATH],
2147 CF_ADD_SUBDIR_PATH($1,$2,$3,/usr,$prefix)
2148 CF_ADD_SUBDIR_PATH($1,$2,$3,$prefix,NONE)
2149 CF_ADD_SUBDIR_PATH($1,$2,$3,/usr/local,$prefix)
2150 CF_ADD_SUBDIR_PATH($1,$2,$3,/opt,$prefix)
2151 CF_ADD_SUBDIR_PATH($1,$2,$3,[$]HOME,$prefix)
2153 dnl ---------------------------------------------------------------------------
2154 dnl CF_SYS_TIME_SELECT version: 4 updated: 2000/10/04 09:18:40
2155 dnl ------------------
2156 dnl Check if we can include <sys/time.h> with <sys/select.h>; this breaks on
2157 dnl older SCO configurations.
2158 AC_DEFUN([CF_SYS_TIME_SELECT],
2160 AC_MSG_CHECKING(if sys/time.h works with sys/select.h)
2161 AC_CACHE_VAL(cf_cv_sys_time_select,[
2163 #include <sys/types.h>
2164 #ifdef HAVE_SYS_TIME_H
2165 #include <sys/time.h>
2167 #ifdef HAVE_SYS_SELECT_H
2168 #include <sys/select.h>
2170 ],[],[cf_cv_sys_time_select=yes],
2171 [cf_cv_sys_time_select=no])
2173 AC_MSG_RESULT($cf_cv_sys_time_select)
2174 test "$cf_cv_sys_time_select" = yes && AC_DEFINE(HAVE_SYS_TIME_SELECT)
2176 dnl ---------------------------------------------------------------------------
2177 dnl CF_TERM_HEADER version: 1 updated: 2005/12/31 13:26:39
2179 dnl Look for term.h, which is part of X/Open curses. It defines the interface
2180 dnl to terminfo database. Usually it is in the same include-path as curses.h,
2181 dnl but some packagers change this, breaking various applications.
2182 AC_DEFUN([CF_TERM_HEADER],[
2183 AC_CACHE_CHECK(for terminfo header, cf_cv_term_header,[
2184 case ${cf_cv_ncurses_header} in #(vi
2185 */ncurses.h|*/ncursesw.h) #(vi
2186 cf_term_header=`echo "$cf_cv_ncurses_header" | sed -e 's%ncurses[[^.]]*\.h$%term.h%'`
2189 cf_term_header=term.h
2193 for cf_test in $cf_term_header "ncurses/term.h" "ncursesw/term.h"
2195 AC_TRY_COMPILE([#include <stdio.h>
2196 #include <${cf_cv_ncurses_header-curses.h}>
2198 ],[int x = auto_left_margin],[
2199 cf_cv_term_header="$cf_test"],[
2200 cf_cv_term_header=unknown
2202 test "$cf_cv_term_header" != unknown && break
2206 # Set definitions to allow ifdef'ing to accommodate subdirectories
2208 case $cf_cv_term_header in # (vi
2210 AC_DEFINE(HAVE_TERM_H)
2214 case $cf_cv_term_header in # (vi
2215 ncurses/term.h) #(vi
2216 AC_DEFINE(HAVE_NCURSES_TERM_H)
2219 AC_DEFINE(HAVE_NCURSESW_TERM_H)
2223 dnl ---------------------------------------------------------------------------
2224 dnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59
2226 dnl Make an uppercase version of a variable
2227 dnl $1=uppercase($2)
2228 AC_DEFUN([CF_UPPER],
2230 $1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
2232 dnl ---------------------------------------------------------------------------
2233 dnl CF_UTF8_LIB version: 5 updated: 2008/10/17 19:37:52
2235 dnl Check for multibyte support, and if not found, utf8 compatibility library
2236 AC_DEFUN([CF_UTF8_LIB],
2238 AC_CACHE_CHECK(for multibyte character support,cf_cv_utf8_lib,[
2239 cf_save_LIBS="$LIBS"
2241 #include <stdlib.h>],[putwc(0,0);],
2242 [cf_cv_utf8_lib=yes],
2244 #include <libutf8.h>],[putwc(0,0);],utf8,
2245 [cf_cv_utf8_lib=add-on],
2246 [cf_cv_utf8_lib=no])
2249 # HAVE_LIBUTF8_H is used by ncurses if curses.h is shared between
2251 if test "$cf_cv_utf8_lib" = "add-on" ; then
2252 AC_DEFINE(HAVE_LIBUTF8_H)
2253 CF_ADD_INCDIR($cf_cv_header_path_utf8)
2254 CF_ADD_LIBDIR($cf_cv_library_path_utf8)
2258 dnl ---------------------------------------------------------------------------
2259 dnl CF_VERBOSE version: 3 updated: 2007/07/29 09:55:12
2261 dnl Use AC_VERBOSE w/o the warnings
2262 AC_DEFUN([CF_VERBOSE],
2263 [test -n "$verbose" && echo " $1" 1>&AC_FD_MSG
2266 dnl ---------------------------------------------------------------------------
2267 dnl CF_WCHAR_TYPE version: 2 updated: 2004/01/17 19:18:20
2269 dnl Check if type wide-character type $1 is declared, and if so, which header
2270 dnl file is needed. The second parameter is used to set a shell variable when
2271 dnl the type is not found. The first parameter sets a shell variable for the
2273 AC_DEFUN([CF_WCHAR_TYPE],
2275 # This is needed on Tru64 5.0 to declare $1
2276 AC_CACHE_CHECK(if we must include wchar.h to declare $1,cf_cv_$1,[
2281 #ifdef HAVE_LIBUTF8_H
2282 #include <libutf8.h>
2291 #ifdef HAVE_LIBUTF8_H
2292 #include <libutf8.h>
2296 [cf_cv_$1=unknown])])])
2298 if test "$cf_cv_$1" = yes ; then
2299 AC_DEFINE(NEED_WCHAR_H)
2304 # if we do not find $1 in either place, use substitution to provide a fallback.
2305 if test "$cf_cv_$1" = unknown ; then
2310 # if we find $1 in either place, use substitution to provide a fallback.
2311 if test "$cf_cv_$1" != unknown ; then
2316 dnl ---------------------------------------------------------------------------
2317 dnl CF_WITH_CURSES_DIR version: 2 updated: 2002/11/10 14:46:59
2318 dnl ------------------
2319 dnl Wrapper for AC_ARG_WITH to specify directory under which to look for curses
2321 AC_DEFUN([CF_WITH_CURSES_DIR],[
2322 AC_ARG_WITH(curses-dir,
2323 [ --with-curses-dir=DIR directory in which (n)curses is installed],
2324 [CF_PATH_SYNTAX(withval)
2325 cf_cv_curses_dir=$withval],
2326 [cf_cv_curses_dir=no])
2328 dnl ---------------------------------------------------------------------------
2329 dnl CF_XOPEN_CURSES version: 8 updated: 2003/11/07 19:47:46
2331 dnl Test if we should define X/Open source for curses, needed on Digital Unix
2332 dnl 4.x, to see the extended functions, but breaks on IRIX 6.x.
2334 dnl The getbegyx() check is needed for HPUX, which omits legacy macros such
2335 dnl as getbegy(). The latter is better design, but the former is standard.
2336 AC_DEFUN([CF_XOPEN_CURSES],
2338 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
2339 AC_CACHE_CHECK(if we must define _XOPEN_SOURCE_EXTENDED,cf_cv_need_xopen_extension,[
2342 #include <${cf_cv_ncurses_header-curses.h}>],[
2343 long x = winnstr(stdscr, "", 0);
2345 getbegyx(stdscr, y1, x1)],
2346 [cf_cv_need_xopen_extension=no],
2348 #define _XOPEN_SOURCE_EXTENDED
2350 #include <${cf_cv_ncurses_header-curses.h}>],[
2351 long x = winnstr(stdscr, "", 0);
2353 getbegyx(stdscr, y1, x1)],
2354 [cf_cv_need_xopen_extension=yes],
2355 [cf_cv_need_xopen_extension=unknown])])])
2356 test $cf_cv_need_xopen_extension = yes && CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED"
2358 dnl ---------------------------------------------------------------------------
2359 dnl CF_XOPEN_SOURCE version: 33 updated: 2010/03/28 15:35:52
2361 dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions,
2362 dnl or adapt to the vendor's definitions to get equivalent functionality,
2363 dnl without losing the common non-POSIX features.
2366 dnl $1 is the nominal value for _XOPEN_SOURCE
2367 dnl $2 is the nominal value for _POSIX_C_SOURCE
2368 AC_DEFUN([CF_XOPEN_SOURCE],[
2370 cf_XOPEN_SOURCE=ifelse($1,,500,$1)
2371 cf_POSIX_C_SOURCE=ifelse($2,,199506L,$2)
2374 case $host_os in #(vi
2376 cf_xopen_source="-D_ALL_SOURCE"
2378 darwin[[0-8]].*) #(vi
2379 cf_xopen_source="-D_APPLE_C_SOURCE"
2382 cf_xopen_source="-D_DARWIN_C_SOURCE"
2384 freebsd*|dragonfly*) #(vi
2385 # 5.x headers associate
2386 # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L
2387 # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L
2388 cf_POSIX_C_SOURCE=200112L
2390 cf_xopen_source="-D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
2393 cf_xopen_source="-D_HPUX_SOURCE -D_XOPEN_SOURCE=500"
2396 cf_xopen_source="-D_HPUX_SOURCE"
2399 cf_xopen_source="-D_SGI_SOURCE"
2401 linux*|gnu*|mint*|k*bsd*-gnu) #(vi
2405 # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <arpa/inet.h>
2408 # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw
2411 # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw
2414 cf_xopen_source="-D_OSF_SOURCE"
2417 cf_xopen_source="-D_QNX_SOURCE"
2420 # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer
2422 solaris2.1[[0-9]]) #(vi
2423 cf_xopen_source="-D__EXTENSIONS__ -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
2425 solaris2.[[1-9]]) #(vi
2426 cf_xopen_source="-D__EXTENSIONS__"
2429 AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[
2430 AC_TRY_COMPILE([#include <sys/types.h>],[
2431 #ifndef _XOPEN_SOURCE
2434 [cf_cv_xopen_source=no],
2435 [cf_save="$CPPFLAGS"
2436 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
2437 AC_TRY_COMPILE([#include <sys/types.h>],[
2438 #ifdef _XOPEN_SOURCE
2441 [cf_cv_xopen_source=no],
2442 [cf_cv_xopen_source=$cf_XOPEN_SOURCE])
2446 if test "$cf_cv_xopen_source" != no ; then
2447 CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE)
2448 CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE)
2449 cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source"
2450 CF_ADD_CFLAGS($cf_temp_xopen_source)
2452 CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE)
2456 if test -n "$cf_xopen_source" ; then
2457 CF_ADD_CFLAGS($cf_xopen_source)
2460 dnl ---------------------------------------------------------------------------
2461 dnl CF_X_ATHENA version: 12 updated: 2004/06/15 21:14:41
2463 dnl Check for Xaw (Athena) libraries
2465 dnl Sets $cf_x_athena according to the flavor of Xaw which is used.
2466 AC_DEFUN([CF_X_ATHENA],
2467 [AC_REQUIRE([CF_X_TOOLKIT])
2468 cf_x_athena=${cf_x_athena-Xaw}
2470 AC_MSG_CHECKING(if you want to link with Xaw 3d library)
2473 [ --with-Xaw3d link with Xaw 3d library])
2474 if test "$withval" = yes ; then
2481 AC_MSG_CHECKING(if you want to link with neXT Athena library)
2484 [ --with-neXtaw link with neXT Athena library])
2485 if test "$withval" = yes ; then
2492 AC_MSG_CHECKING(if you want to link with Athena-Plus library)
2494 AC_ARG_WITH(XawPlus,
2495 [ --with-XawPlus link with Athena-Plus library])
2496 if test "$withval" = yes ; then
2503 AC_CHECK_LIB(Xext,XextCreateExtension,
2504 [LIBS="-lXext $LIBS"])
2508 CF_X_ATHENA_CPPFLAGS($cf_x_athena)
2509 CF_X_ATHENA_LIBS($cf_x_athena)
2511 dnl ---------------------------------------------------------------------------
2512 dnl CF_X_ATHENA_CPPFLAGS version: 3 updated: 2009/01/11 15:33:39
2513 dnl --------------------
2514 dnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of
2515 dnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw.
2516 AC_DEFUN([CF_X_ATHENA_CPPFLAGS],
2518 cf_x_athena_root=ifelse($1,,Xaw,$1)
2519 cf_x_athena_include=""
2521 for cf_path in default \
2522 /usr/contrib/X11R6 \
2523 /usr/contrib/X11R5 \
2527 if test -z "$cf_x_athena_include" ; then
2529 cf_test=X11/$cf_x_athena_root/SimpleMenu.h
2530 if test $cf_path != default ; then
2531 CPPFLAGS="$cf_save -I$cf_path/include"
2532 AC_MSG_CHECKING(for $cf_test in $cf_path)
2534 AC_MSG_CHECKING(for $cf_test)
2537 #include <X11/Intrinsic.h>
2538 #include <$cf_test>],[],
2541 AC_MSG_RESULT($cf_result)
2542 if test "$cf_result" = yes ; then
2543 cf_x_athena_include=$cf_path
2551 if test -z "$cf_x_athena_include" ; then
2553 [Unable to successfully find Athena header files with test program])
2554 elif test "$cf_x_athena_include" != default ; then
2555 CPPFLAGS="$CPPFLAGS -I$cf_x_athena_include"
2558 dnl ---------------------------------------------------------------------------
2559 dnl CF_X_ATHENA_LIBS version: 7 updated: 2008/03/23 14:46:03
2560 dnl ----------------
2561 dnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of
2562 dnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw.
2563 AC_DEFUN([CF_X_ATHENA_LIBS],
2564 [AC_REQUIRE([CF_X_TOOLKIT])
2565 cf_x_athena_root=ifelse($1,,Xaw,$1)
2568 for cf_path in default \
2569 /usr/contrib/X11R6 \
2570 /usr/contrib/X11R5 \
2575 "-l$cf_x_athena_root -lXmu" \
2576 "-l$cf_x_athena_root -lXpm -lXmu" \
2577 "-l${cf_x_athena_root}_s -lXmu_s"
2579 if test -z "$cf_x_athena_lib" ; then
2581 cf_test=XawSimpleMenuAddGlobalActions
2582 if test $cf_path != default ; then
2583 LIBS="-L$cf_path/lib $cf_lib $LIBS"
2584 AC_MSG_CHECKING(for $cf_lib in $cf_path)
2586 LIBS="$cf_lib $LIBS"
2587 AC_MSG_CHECKING(for $cf_test in $cf_lib)
2589 AC_TRY_LINK([],[$cf_test()],
2592 AC_MSG_RESULT($cf_result)
2593 if test "$cf_result" = yes ; then
2594 cf_x_athena_lib="$cf_lib"
2602 if test -z "$cf_x_athena_lib" ; then
2604 [Unable to successfully link Athena library (-l$cf_x_athena_root) with test program])
2607 CF_UPPER(cf_x_athena_LIBS,HAVE_LIB_$cf_x_athena)
2608 AC_DEFINE_UNQUOTED($cf_x_athena_LIBS)
2610 dnl ---------------------------------------------------------------------------
2611 dnl CF_X_TOOLKIT version: 12 updated: 2008/03/23 15:04:54
2613 dnl Check for X Toolkit libraries
2615 AC_DEFUN([CF_X_TOOLKIT],
2617 AC_REQUIRE([AC_PATH_XTRA])
2618 AC_REQUIRE([CF_CHECK_CACHE])
2620 # SYSTEM_NAME=`echo "$cf_cv_system_name"|tr ' ' -`
2624 LDFLAGS="$X_LIBS $LDFLAGS"
2625 CF_CHECK_CFLAGS($X_CFLAGS)
2627 AC_CHECK_FUNC(XOpenDisplay,,[
2628 AC_CHECK_LIB(X11,XOpenDisplay,
2629 [LIBS="-lX11 $LIBS"],,
2630 [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])])
2632 AC_CHECK_FUNC(XtAppInitialize,,[
2633 AC_CHECK_LIB(Xt, XtAppInitialize,
2634 [AC_DEFINE(HAVE_LIBXT)
2636 LIBS="-lXt $X_PRE_LIBS $LIBS $X_EXTRA_LIBS"],,
2637 [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])])
2639 if test $cf_have_X_LIBS = no ; then
2641 [Unable to successfully link X Toolkit library (-lXt) with
2642 test program. You will have to check and add the proper libraries by hand
2646 dnl ---------------------------------------------------------------------------
2647 dnl CF__CURSES_HEAD version: 1 updated: 2009/07/16 19:32:31
2649 dnl Define a reusable chunk which includes <curses.h> and <term.h> when they
2650 dnl are both available.
2651 define([CF__CURSES_HEAD],[
2653 #include <xcurses.h>
2654 char * XCursesProgramName = "test";
2656 #include <${cf_cv_ncurses_header-curses.h}>
2657 #if defined(NCURSES_VERSION) && defined(HAVE_NCURSESW_TERM_H)
2658 #include <ncursesw/term.h>
2659 #elif defined(NCURSES_VERSION) && defined(HAVE_NCURSES_TERM_H)
2660 #include <ncurses/term.h>
2661 #elif defined(HAVE_TERM_H)