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.39 2010/05/29 20:55:40 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_LIBDIR version: 9 updated: 2010/05/26 16:44:57
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: 4 updated: 2010/05/26 05:38:42
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: 2 updated: 2010/04/28 06:02:16
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 $1 = ncurses when looking for ncurses, or is empty
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
565 for cf_header in ifelse($1,,,[ \
569 ncurses.h ifelse($1,,[ncurses/curses.h ncurses/ncurses.h])
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: 19 updated: 2010/05/29 16:31:02
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)])
912 AC_TRY_LINK([$1],[$2],[
913 cf_cv_find_linkage_$3=yes
914 cf_cv_header_path_$3=/usr/include
915 cf_cv_library_path_$3=/usr/lib
918 LIBS="-l$3 $7 $cf_save_LIBS"
920 AC_TRY_LINK([$1],[$2],[
921 cf_cv_find_linkage_$3=yes
922 cf_cv_header_path_$3=/usr/include
923 cf_cv_library_path_$3=/usr/lib
924 cf_cv_library_file_$3="-l$3"
926 cf_cv_find_linkage_$3=no
929 CF_VERBOSE(find linkage for $3 library)
930 CF_MSG_LOG([Searching for headers in [FIND_LINKAGE]($3,$6)])
932 cf_save_CPPFLAGS="$CPPFLAGS"
933 cf_test_CPPFLAGS="$CPPFLAGS"
935 CF_HEADER_PATH(cf_search,ifelse([$6],,[$3],[$6]))
936 for cf_cv_header_path_$3 in $cf_search
938 if test -d $cf_cv_header_path_$3 ; then
939 CF_VERBOSE(... testing $cf_cv_header_path_$3)
940 CPPFLAGS="$cf_save_CPPFLAGS -I$cf_cv_header_path_$3"
941 AC_TRY_COMPILE([$1],[$2],[
942 CF_VERBOSE(... found $3 headers in $cf_cv_header_path_$3)
943 cf_cv_find_linkage_$3=maybe
944 cf_test_CPPFLAGS="$CPPFLAGS"
946 CPPFLAGS="$cf_save_CPPFLAGS"
951 if test "$cf_cv_find_linkage_$3" = maybe ; then
953 CF_MSG_LOG([Searching for $3 library in [FIND_LINKAGE]($3,$6)])
956 cf_save_LDFLAGS="$LDFLAGS"
959 CPPFLAGS="$cf_test_CPPFLAGS"
960 LIBS="-l$3 $7 $cf_save_LIBS"
961 AC_TRY_LINK([$1],[$2],[
962 CF_VERBOSE(... found $3 library in system)
963 cf_cv_find_linkage_$3=yes])
964 CPPFLAGS="$cf_save_CPPFLAGS"
968 if test "$cf_cv_find_linkage_$3" != yes ; then
969 CF_LIBRARY_PATH(cf_search,$3)
970 for cf_cv_library_path_$3 in $cf_search
972 if test -d $cf_cv_library_path_$3 ; then
973 CF_VERBOSE(... testing $cf_cv_library_path_$3)
974 CPPFLAGS="$cf_test_CPPFLAGS"
975 LIBS="-l$3 $7 $cf_save_LIBS"
976 LDFLAGS="$cf_save_LDFLAGS -L$cf_cv_library_path_$3"
977 AC_TRY_LINK([$1],[$2],[
978 CF_VERBOSE(... found $3 library in $cf_cv_library_path_$3)
979 cf_cv_find_linkage_$3=yes
980 cf_cv_library_file_$3="-l$3"
982 CPPFLAGS="$cf_save_CPPFLAGS"
984 LDFLAGS="$cf_save_LDFLAGS"
988 CPPFLAGS="$cf_save_CPPFLAGS"
989 LDFLAGS="$cf_save_LDFLAGS"
993 cf_cv_find_linkage_$3=no
1000 if test "$cf_cv_find_linkage_$3" = yes ; then
1002 CF_ADD_INCDIR($cf_cv_header_path_$3)
1003 CF_ADD_LIBDIR($cf_cv_library_path_$3)
1007 ifelse([$5],,AC_MSG_WARN(Cannot find $3 library),[$5])
1010 dnl ---------------------------------------------------------------------------
1011 dnl CF_FUNC_CURSES_VERSION version: 4 updated: 2007/04/28 09:15:55
1012 dnl ----------------------
1013 dnl Solaris has a data item 'curses_version', which confuses AC_CHECK_FUNCS.
1014 dnl It's a character string "SVR4", not documented.
1015 AC_DEFUN([CF_FUNC_CURSES_VERSION],
1017 AC_CACHE_CHECK(for function curses_version, cf_cv_func_curses_version,[
1019 #include <${cf_cv_ncurses_header-curses.h}>
1023 sprintf(temp, "%s\n", curses_version());
1024 ${cf_cv_main_return-return}(0);
1026 ,[cf_cv_func_curses_version=yes]
1027 ,[cf_cv_func_curses_version=no]
1028 ,[cf_cv_func_curses_version=unknown])
1030 test "$cf_cv_func_curses_version" = yes && AC_DEFINE(HAVE_CURSES_VERSION)
1032 dnl ---------------------------------------------------------------------------
1033 dnl CF_GCC_ATTRIBUTES version: 13 updated: 2009/08/11 20:19:56
1034 dnl -----------------
1035 dnl Test for availability of useful gcc __attribute__ directives to quiet
1036 dnl compiler warnings. Though useful, not all are supported -- and contrary
1037 dnl to documentation, unrecognized directives cause older compilers to barf.
1038 AC_DEFUN([CF_GCC_ATTRIBUTES],
1040 if test "$GCC" = yes
1042 cat > conftest.i <<EOF
1044 #define GCC_PRINTF 0
1049 #ifndef GCC_NORETURN
1050 #define GCC_NORETURN /* nothing */
1053 #define GCC_UNUSED /* nothing */
1056 if test "$GCC" = yes
1058 AC_CHECKING([for $CC __attribute__ directives])
1059 cat > conftest.$ac_ext <<EOF
1060 #line __oline__ "${as_me-configure}"
1061 #include "confdefs.h"
1062 #include "conftest.h"
1063 #include "conftest.i"
1065 #define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
1067 #define GCC_PRINTFLIKE(fmt,var) /*nothing*/
1070 #define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var)))
1072 #define GCC_SCANFLIKE(fmt,var) /*nothing*/
1074 extern void wow(char *,...) GCC_SCANFLIKE(1,2);
1075 extern void oops(char *,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN;
1076 extern void foo(void) GCC_NORETURN;
1077 int main(int argc GCC_UNUSED, char *argv[[]] GCC_UNUSED) { return 0; }
1079 cf_printf_attribute=no
1080 cf_scanf_attribute=no
1081 for cf_attribute in scanf printf unused noreturn
1083 CF_UPPER(cf_ATTRIBUTE,$cf_attribute)
1084 cf_directive="__attribute__(($cf_attribute))"
1085 echo "checking for $CC $cf_directive" 1>&AC_FD_CC
1087 case $cf_attribute in #(vi
1089 cf_printf_attribute=yes
1090 cat >conftest.h <<EOF
1091 #define GCC_$cf_ATTRIBUTE 1
1095 cf_scanf_attribute=yes
1096 cat >conftest.h <<EOF
1097 #define GCC_$cf_ATTRIBUTE 1
1101 cat >conftest.h <<EOF
1102 #define GCC_$cf_ATTRIBUTE $cf_directive
1107 if AC_TRY_EVAL(ac_compile); then
1108 test -n "$verbose" && AC_MSG_RESULT(... $cf_attribute)
1109 cat conftest.h >>confdefs.h
1110 case $cf_attribute in #(vi
1112 if test "$cf_printf_attribute" = no ; then
1113 cat >>confdefs.h <<EOF
1114 #define GCC_PRINTFLIKE(fmt,var) /* nothing */
1117 cat >>confdefs.h <<EOF
1118 #define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
1123 if test "$cf_scanf_attribute" = no ; then
1124 cat >>confdefs.h <<EOF
1125 #define GCC_SCANFLIKE(fmt,var) /* nothing */
1128 cat >>confdefs.h <<EOF
1129 #define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var)))
1137 fgrep define conftest.i >>confdefs.h
1142 dnl ---------------------------------------------------------------------------
1143 dnl CF_GCC_VERSION version: 5 updated: 2010/04/24 11:02:31
1145 dnl Find version of gcc
1146 AC_DEFUN([CF_GCC_VERSION],[
1147 AC_REQUIRE([AC_PROG_CC])
1149 if test "$GCC" = yes ; then
1150 AC_MSG_CHECKING(version of $CC)
1151 GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`"
1152 test -z "$GCC_VERSION" && GCC_VERSION=unknown
1153 AC_MSG_RESULT($GCC_VERSION)
1156 dnl ---------------------------------------------------------------------------
1157 dnl CF_GCC_WARNINGS version: 25 updated: 2010/04/24 11:03:31
1159 dnl Check if the compiler supports useful warning options. There's a few that
1160 dnl we don't use, simply because they're too noisy:
1162 dnl -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x)
1163 dnl -Wredundant-decls (system headers make this too noisy)
1164 dnl -Wtraditional (combines too many unrelated messages, only a few useful)
1165 dnl -Wwrite-strings (too noisy, but should review occasionally). This
1166 dnl is enabled for ncurses using "--enable-const".
1170 dnl $1 is an optional list of gcc warning flags that a particular
1171 dnl application might want to use, e.g., "no-unused" for
1174 dnl If $with_ext_const is "yes", add a check for -Wwrite-strings
1176 AC_DEFUN([CF_GCC_WARNINGS],
1178 AC_REQUIRE([CF_GCC_VERSION])
1179 CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS)
1181 cat > conftest.$ac_ext <<EOF
1182 #line __oline__ "${as_me-configure}"
1183 int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; }
1186 if test "$INTEL_COMPILER" = yes
1188 # The "-wdXXX" options suppress warnings:
1189 # remark #1419: external declaration in primary source file
1190 # remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
1191 # remark #1684: conversion from pointer to same-sized integral type (potential portability problem)
1192 # remark #193: zero used for undefined preprocessing identifier
1193 # remark #593: variable "curs_sb_left_arrow" was set but never used
1194 # remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits
1195 # remark #869: parameter "tw" was never referenced
1196 # remark #981: operands are evaluated in unspecified order
1197 # warning #279: controlling expression is constant
1199 AC_CHECKING([for $CC warning options])
1200 cf_save_CFLAGS="$CFLAGS"
1201 EXTRA_CFLAGS="-Wall"
1213 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
1214 if AC_TRY_EVAL(ac_compile); then
1215 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
1216 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
1219 CFLAGS="$cf_save_CFLAGS"
1221 elif test "$GCC" = yes
1223 AC_CHECKING([for $CC warning options])
1224 cf_save_CFLAGS="$CFLAGS"
1227 test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings"
1228 for cf_opt in W Wall \
1229 Wbad-function-cast \
1233 Wmissing-declarations \
1234 Wmissing-prototypes \
1238 Wstrict-prototypes \
1239 Wundef $cf_warn_CONST $1
1241 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
1242 if AC_TRY_EVAL(ac_compile); then
1243 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
1244 case $cf_opt in #(vi
1246 CPPFLAGS="$CPPFLAGS -DXTSTRINGDEFINES"
1249 case $GCC_VERSION in
1251 CF_VERBOSE(feature is broken in gcc $GCC_VERSION)
1256 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
1259 CFLAGS="$cf_save_CFLAGS"
1263 AC_SUBST(EXTRA_CFLAGS)
1265 dnl ---------------------------------------------------------------------------
1266 dnl CF_GNU_SOURCE version: 6 updated: 2005/07/09 13:23:07
1268 dnl Check if we must define _GNU_SOURCE to get a reasonable value for
1269 dnl _XOPEN_SOURCE, upon which many POSIX definitions depend. This is a defect
1270 dnl (or misfeature) of glibc2, which breaks portability of many applications,
1271 dnl since it is interwoven with GNU extensions.
1273 dnl Well, yes we could work around it...
1274 AC_DEFUN([CF_GNU_SOURCE],
1276 AC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[
1277 AC_TRY_COMPILE([#include <sys/types.h>],[
1278 #ifndef _XOPEN_SOURCE
1281 [cf_cv_gnu_source=no],
1282 [cf_save="$CPPFLAGS"
1283 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
1284 AC_TRY_COMPILE([#include <sys/types.h>],[
1285 #ifdef _XOPEN_SOURCE
1288 [cf_cv_gnu_source=no],
1289 [cf_cv_gnu_source=yes])
1293 test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
1295 dnl ---------------------------------------------------------------------------
1296 dnl CF_HEADER_PATH version: 12 updated: 2010/05/05 05:22:40
1298 dnl Construct a search-list of directories for a nonstandard header-file
1301 dnl $1 = the variable to return as result
1302 dnl $2 = the package name
1303 AC_DEFUN([CF_HEADER_PATH],
1307 # collect the current set of include-directories from compiler flags
1308 cf_header_path_list=""
1309 if test -n "${CFLAGS}${CPPFLAGS}" ; then
1310 for cf_header_path in $CPPFLAGS $CFLAGS
1312 case $cf_header_path in #(vi
1314 cf_header_path=`echo ".$cf_header_path" |sed -e 's/^...//' -e 's,/include$,,'`
1315 CF_ADD_SUBDIR_PATH($1,$2,include,$cf_header_path,NONE)
1316 cf_header_path_list="$cf_header_path_list [$]$1"
1322 # add the variations for the package we are looking for
1323 CF_SUBDIR_PATH($1,$2,include)
1325 test "$includedir" != NONE && \
1326 test "$includedir" != "/usr/include" && \
1327 test -d "$includedir" && {
1328 test -d $includedir && $1="[$]$1 $includedir"
1329 test -d $includedir/$2 && $1="[$]$1 $includedir/$2"
1332 test "$oldincludedir" != NONE && \
1333 test "$oldincludedir" != "/usr/include" && \
1334 test -d "$oldincludedir" && {
1335 test -d $oldincludedir && $1="[$]$1 $oldincludedir"
1336 test -d $oldincludedir/$2 && $1="[$]$1 $oldincludedir/$2"
1339 $1="[$]$1 $cf_header_path_list"
1341 dnl ---------------------------------------------------------------------------
1342 dnl CF_INHERIT_SCRIPT version: 2 updated: 2003/03/01 23:50:42
1343 dnl -----------------
1344 dnl If we do not have a given script, look for it in the parent directory.
1345 AC_DEFUN([CF_INHERIT_SCRIPT],
1347 test -f $1 || ( test -f ../$1 && cp ../$1 ./ )
1349 dnl ---------------------------------------------------------------------------
1350 dnl CF_INTEL_COMPILER version: 4 updated: 2010/05/26 05:38:42
1351 dnl -----------------
1352 dnl Check if the given compiler is really the Intel compiler for Linux. It
1353 dnl tries to imitate gcc, but does not return an error when it finds a mismatch
1354 dnl between prototypes, e.g., as exercised by CF_MISSING_CHECK.
1356 dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to
1357 dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from
1358 dnl the wrappers for gcc and g++ warnings.
1360 dnl $1 = GCC (default) or GXX
1361 dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS
1362 dnl $3 = CFLAGS (default) or CXXFLAGS
1363 AC_DEFUN([CF_INTEL_COMPILER],[
1364 ifelse([$2],,INTEL_COMPILER,[$2])=no
1366 if test "$ifelse([$1],,[$1],GCC)" = yes ; then
1369 AC_MSG_CHECKING(if this is really Intel ifelse([$1],GXX,C++,C) compiler)
1370 cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])"
1371 ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -no-gcc"
1373 #ifdef __INTEL_COMPILER
1377 ],[ifelse([$2],,INTEL_COMPILER,[$2])=yes
1378 cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc"
1380 ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS"
1381 AC_MSG_RESULT($ifelse([$2],,INTEL_COMPILER,[$2]))
1386 dnl ---------------------------------------------------------------------------
1387 dnl CF_LIBRARY_PATH version: 9 updated: 2010/03/28 12:52:50
1389 dnl Construct a search-list of directories for a nonstandard library-file
1392 dnl $1 = the variable to return as result
1393 dnl $2 = the package name
1394 AC_DEFUN([CF_LIBRARY_PATH],
1397 cf_library_path_list=""
1398 if test -n "${LDFLAGS}${LIBS}" ; then
1399 for cf_library_path in $LDFLAGS $LIBS
1401 case $cf_library_path in #(vi
1403 cf_library_path=`echo ".$cf_library_path" |sed -e 's/^...//' -e 's,/lib$,,'`
1404 CF_ADD_SUBDIR_PATH($1,$2,lib,$cf_library_path,NONE)
1405 cf_library_path_list="$cf_library_path_list [$]$1"
1411 CF_SUBDIR_PATH($1,$2,lib)
1413 $1="$cf_library_path_list [$]$1"
1415 dnl ---------------------------------------------------------------------------
1416 dnl CF_MAKE_TAGS version: 5 updated: 2010/04/03 20:07:32
1418 dnl Generate tags/TAGS targets for makefiles. Do not generate TAGS if we have
1419 dnl a monocase filesystem.
1420 AC_DEFUN([CF_MAKE_TAGS],[
1421 AC_REQUIRE([CF_MIXEDCASE_FILENAMES])
1423 AC_CHECK_PROGS(CTAGS, exctags ctags)
1424 AC_CHECK_PROGS(ETAGS, exetags etags)
1426 AC_CHECK_PROG(MAKE_LOWER_TAGS, ${CTAGS-ctags}, yes, no)
1428 if test "$cf_cv_mixedcase" = yes ; then
1429 AC_CHECK_PROG(MAKE_UPPER_TAGS, ${ETAGS-etags}, yes, no)
1434 if test "$MAKE_UPPER_TAGS" = yes ; then
1440 if test "$MAKE_LOWER_TAGS" = yes ; then
1449 AC_SUBST(MAKE_UPPER_TAGS)
1450 AC_SUBST(MAKE_LOWER_TAGS)
1452 dnl ---------------------------------------------------------------------------
1453 dnl CF_MIN_GETCCHAR version: 2 updated: 2009/07/16 21:03:10
1456 dnl Check whether getcchar's return value counts the trailing null in a wchar_t
1457 dnl string, or not. X/Open says it does, but Tru64 and Solaris do not do this.
1458 AC_DEFUN([CF_MIN_GETCCHAR],[
1459 AC_CACHE_CHECK(if getcchar counts trailing null,cf_cv_min_getcchar,[
1463 #include <${cf_cv_ncurses_header-curses.h}>
1471 setcchar(temp, data, 0, 0, (void *)0);
1472 count = getcchar(temp, (wchar_t *)0, (attr_t *)0, (short *)0, (void *)0);
1473 ${cf_cv_main_return-return}(count != 0);
1475 [cf_cv_min_getcchar=no],
1476 [cf_cv_min_getcchar=yes],
1477 [cf_cv_min_getcchar=yes])
1479 if test "$cf_cv_min_getcchar" = yes ; then
1480 AC_DEFINE(MIN_GETCCHAR,1)
1483 dnl ---------------------------------------------------------------------------
1484 dnl CF_MIXEDCASE_FILENAMES version: 3 updated: 2003/09/20 17:07:55
1485 dnl ----------------------
1486 dnl Check if the file-system supports mixed-case filenames. If we're able to
1487 dnl create a lowercase name and see it as uppercase, it doesn't support that.
1488 AC_DEFUN([CF_MIXEDCASE_FILENAMES],
1490 AC_CACHE_CHECK(if filesystem supports mixed-case filenames,cf_cv_mixedcase,[
1491 if test "$cross_compiling" = yes ; then
1492 case $target_alias in #(vi
1493 *-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-mingw32*|*-uwin*) #(vi
1501 rm -f conftest CONFTEST
1503 if test -f CONFTEST ; then
1508 rm -f conftest CONFTEST
1511 test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES)
1513 dnl ---------------------------------------------------------------------------
1514 dnl CF_MSG_LOG version: 4 updated: 2007/07/29 09:55:12
1516 dnl Write a debug message to config.log, along with the line number in the
1517 dnl configure script.
1518 AC_DEFUN([CF_MSG_LOG],[
1519 echo "${as_me-configure}:__oline__: testing $* ..." 1>&AC_FD_CC
1521 dnl ---------------------------------------------------------------------------
1522 dnl CF_NCURSES_CC_CHECK version: 4 updated: 2007/07/29 10:39:05
1523 dnl -------------------
1524 dnl Check if we can compile with ncurses' header file
1525 dnl $1 is the cache variable to set
1526 dnl $2 is the header-file to include
1527 dnl $3 is the root name (ncurses or ncursesw)
1528 AC_DEFUN([CF_NCURSES_CC_CHECK],[
1530 ]ifelse($3,ncursesw,[
1531 #define _XOPEN_SOURCE_EXTENDED
1532 #undef HAVE_LIBUTF8_H /* in case we used CF_UTF8_LIB */
1533 #define HAVE_LIBUTF8_H /* to force ncurses' header file to use cchar_t */
1536 #ifdef NCURSES_VERSION
1537 ]ifelse($3,ncursesw,[
1542 printf("%s\n", NCURSES_VERSION);
1554 dnl ---------------------------------------------------------------------------
1555 dnl CF_NCURSES_CONFIG version: 6 updated: 2010/04/28 06:02:16
1556 dnl -----------------
1557 dnl Tie together the configure-script macros for ncurses.
1558 dnl Prefer the "-config" script from ncurses 5.6, to simplify analysis.
1559 dnl Allow that to be overridden using the $NCURSES_CONFIG environment variable.
1561 dnl $1 is the root library name (default: "ncurses")
1562 AC_DEFUN([CF_NCURSES_CONFIG],
1564 cf_ncuconfig_root=ifelse($1,,ncurses,$1)
1566 echo "Looking for ${cf_ncuconfig_root}-config"
1567 AC_PATH_PROGS(NCURSES_CONFIG,${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config,none)
1569 if test "$NCURSES_CONFIG" != none ; then
1571 CPPFLAGS="$CPPFLAGS `$NCURSES_CONFIG --cflags`"
1572 LIBS="`$NCURSES_CONFIG --libs` $LIBS"
1574 # even with config script, some packages use no-override for curses.h
1575 CF_CURSES_HEADER(ifelse($1,,ncurses,$1))
1577 dnl like CF_NCURSES_CPPFLAGS
1580 dnl like CF_NCURSES_LIBS
1581 CF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_ncuconfig_root)
1582 AC_DEFINE_UNQUOTED($cf_nculib_ROOT)
1584 dnl like CF_NCURSES_VERSION
1585 cf_cv_ncurses_version=`$NCURSES_CONFIG --version`
1589 CF_NCURSES_CPPFLAGS(ifelse($1,,ncurses,$1))
1590 CF_NCURSES_LIBS(ifelse($1,,ncurses,$1))
1594 dnl ---------------------------------------------------------------------------
1595 dnl CF_NCURSES_CPPFLAGS version: 19 updated: 2007/07/29 13:35:20
1596 dnl -------------------
1597 dnl Look for the SVr4 curses clone 'ncurses' in the standard places, adjusting
1598 dnl the CPPFLAGS variable so we can include its header.
1600 dnl The header files may be installed as either curses.h, or ncurses.h (would
1601 dnl be obsolete, except that some packagers prefer this name to distinguish it
1602 dnl from a "native" curses implementation). If not installed for overwrite,
1603 dnl the curses.h file would be in an ncurses subdirectory (e.g.,
1604 dnl /usr/include/ncurses), but someone may have installed overwriting the
1605 dnl vendor's curses. Only very old versions (pre-1.9.2d, the first autoconf'd
1606 dnl version) of ncurses don't define either __NCURSES_H or NCURSES_VERSION in
1609 dnl If the installer has set $CFLAGS or $CPPFLAGS so that the ncurses header
1610 dnl is already in the include-path, don't even bother with this, since we cannot
1611 dnl easily determine which file it is. In this case, it has to be <curses.h>.
1613 dnl The optional parameter gives the root name of the library, in case it is
1614 dnl not installed as the default curses library. That is how the
1615 dnl wide-character version of ncurses is installed.
1616 AC_DEFUN([CF_NCURSES_CPPFLAGS],
1617 [AC_REQUIRE([CF_WITH_CURSES_DIR])
1619 AC_PROVIDE([CF_CURSES_CPPFLAGS])dnl
1620 cf_ncuhdr_root=ifelse($1,,ncurses,$1)
1622 test -n "$cf_cv_curses_dir" && \
1623 test "$cf_cv_curses_dir" != "no" && { \
1624 CF_ADD_INCDIR($cf_cv_curses_dir/include $cf_cv_curses_dir/include/$cf_ncuhdr_root)
1627 AC_CACHE_CHECK(for $cf_ncuhdr_root header in include-path, cf_cv_ncurses_h,[
1628 cf_header_list="$cf_ncuhdr_root/curses.h $cf_ncuhdr_root/ncurses.h"
1629 ( test "$cf_ncuhdr_root" = ncurses || test "$cf_ncuhdr_root" = ncursesw ) && cf_header_list="$cf_header_list curses.h ncurses.h"
1630 for cf_header in $cf_header_list
1632 CF_NCURSES_CC_CHECK(cf_cv_ncurses_h,$cf_header,$1)
1633 test "$cf_cv_ncurses_h" != no && break
1640 # some applications need this, but should check for NCURSES_VERSION
1645 dnl ---------------------------------------------------------------------------
1646 dnl CF_NCURSES_EXT_FUNCS version: 1 updated: 2010/04/03 11:44:55
1647 dnl --------------------
1648 dnl Since 2007/11/17, ncurses has defined NCURSES_EXT_FUNCS; earlier versions
1649 dnl may provide these functions. Define the symbol if it is not defined, and
1651 AC_DEFUN([CF_NCURSES_EXT_FUNCS],
1653 AC_CACHE_CHECK(for ncurses extended functions,cf_cv_ncurses_ext_funcs,[
1655 #include <${cf_cv_ncurses_header-curses.h}>],
1657 int x = NCURSES_EXT_FUNCS
1658 ],[cf_cv_ncurses_ext_funcs=defined],[
1660 #include <${cf_cv_ncurses_header-curses.h}>],
1662 (void) assume_default_colors (0, 0);
1663 (void) curses_version ();
1664 (void) define_key (0, 0);
1665 (void) is_term_resized (0, 0);
1666 (void) key_defined (0);
1667 (void) keybound (0, 0);
1668 (void) keyok (0, 0);
1669 (void) resize_term (0, 0);
1670 (void) resizeterm (0, 0);
1671 (void) use_default_colors ();
1672 (void) use_extended_names (0);
1673 (void) wresize (0, 0, 0);],
1674 [cf_cv_ncurses_ext_funcs=yes],
1675 [cf_cv_ncurses_ext_funcs=no])
1678 test "$cf_cv_ncurses_ext_funcs" == yes && AC_DEFINE(NCURSES_EXT_FUNCS)
1680 dnl ---------------------------------------------------------------------------
1681 dnl CF_NCURSES_HEADER version: 2 updated: 2008/03/23 14:48:54
1682 dnl -----------------
1683 dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common
1684 dnl variations of ncurses' installs.
1686 dnl See also CF_CURSES_HEADER, which sets the same cache variable.
1687 AC_DEFUN([CF_NCURSES_HEADER],[
1689 if test "$cf_cv_ncurses_h" != no ; then
1690 cf_cv_ncurses_header=$cf_cv_ncurses_h
1693 AC_CACHE_CHECK(for $cf_ncuhdr_root include-path, cf_cv_ncurses_h2,[
1694 test -n "$verbose" && echo
1695 CF_HEADER_PATH(cf_search,$cf_ncuhdr_root)
1696 test -n "$verbose" && echo search path $cf_search
1697 cf_save2_CPPFLAGS="$CPPFLAGS"
1698 for cf_incdir in $cf_search
1700 CF_ADD_INCDIR($cf_incdir)
1705 CF_NCURSES_CC_CHECK(cf_cv_ncurses_h2,$cf_header,$1)
1706 if test "$cf_cv_ncurses_h2" != no ; then
1707 cf_cv_ncurses_h2=$cf_incdir/$cf_header
1708 test -n "$verbose" && echo $ac_n " ... found $ac_c" 1>&AC_FD_MSG
1711 test -n "$verbose" && echo " ... tested $cf_incdir/$cf_header" 1>&AC_FD_MSG
1713 CPPFLAGS="$cf_save2_CPPFLAGS"
1714 test "$cf_cv_ncurses_h2" != no && break
1716 test "$cf_cv_ncurses_h2" = no && AC_MSG_ERROR(not found)
1719 CF_DIRNAME(cf_1st_incdir,$cf_cv_ncurses_h2)
1720 cf_cv_ncurses_header=`basename $cf_cv_ncurses_h2`
1721 if test `basename $cf_1st_incdir` = $cf_ncuhdr_root ; then
1722 cf_cv_ncurses_header=$cf_ncuhdr_root/$cf_cv_ncurses_header
1724 CF_ADD_INCDIR($cf_1st_incdir)
1728 # Set definitions to allow ifdef'ing for ncurses.h
1730 case $cf_cv_ncurses_header in # (vi
1732 AC_DEFINE(HAVE_NCURSES_H)
1736 case $cf_cv_ncurses_header in # (vi
1737 ncurses/curses.h|ncurses/ncurses.h)
1738 AC_DEFINE(HAVE_NCURSES_NCURSES_H)
1740 ncursesw/curses.h|ncursesw/ncurses.h)
1741 AC_DEFINE(HAVE_NCURSESW_NCURSES_H)
1746 dnl ---------------------------------------------------------------------------
1747 dnl CF_NCURSES_LIBS version: 13 updated: 2007/07/29 10:29:20
1749 dnl Look for the ncurses library. This is a little complicated on Linux,
1750 dnl because it may be linked with the gpm (general purpose mouse) library.
1751 dnl Some distributions have gpm linked with (bsd) curses, which makes it
1752 dnl unusable with ncurses. However, we don't want to link with gpm unless
1753 dnl ncurses has a dependency, since gpm is normally set up as a shared library,
1754 dnl and the linker will record a dependency.
1756 dnl The optional parameter gives the root name of the library, in case it is
1757 dnl not installed as the default curses library. That is how the
1758 dnl wide-character version of ncurses is installed.
1759 AC_DEFUN([CF_NCURSES_LIBS],
1760 [AC_REQUIRE([CF_NCURSES_CPPFLAGS])
1762 cf_nculib_root=ifelse($1,,ncurses,$1)
1763 # This works, except for the special case where we find gpm, but
1764 # ncurses is in a nonstandard location via $LIBS, and we really want
1767 cf_ncurses_SAVE="$LIBS"
1768 AC_CHECK_LIB(gpm,Gpm_Open,
1769 [AC_CHECK_LIB(gpm,initscr,
1770 [LIBS="$cf_ncurses_SAVE"],
1771 [cf_ncurses_LIBS="-lgpm"])])
1773 case $host_os in #(vi
1775 # This is only necessary if you are linking against an obsolete
1776 # version of ncurses (but it should do no harm, since it's static).
1777 if test "$cf_nculib_root" = ncurses ; then
1778 AC_CHECK_LIB(mytinfo,tgoto,[cf_ncurses_LIBS="-lmytinfo $cf_ncurses_LIBS"])
1783 LIBS="$cf_ncurses_LIBS $LIBS"
1785 if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" )
1787 CF_ADD_LIBDIR($cf_cv_curses_dir/lib)
1788 LIBS="-l$cf_nculib_root $LIBS"
1790 CF_FIND_LIBRARY($cf_nculib_root,$cf_nculib_root,
1791 [#include <${cf_cv_ncurses_header-curses.h}>],
1796 if test -n "$cf_ncurses_LIBS" ; then
1797 AC_MSG_CHECKING(if we can link $cf_nculib_root without $cf_ncurses_LIBS)
1798 cf_ncurses_SAVE="$LIBS"
1799 for p in $cf_ncurses_LIBS ; do
1800 q=`echo $LIBS | sed -e "s%$p %%" -e "s%$p$%%"`
1801 if test "$q" != "$LIBS" ; then
1805 AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>],
1806 [initscr(); mousemask(0,0); tgoto((char *)0, 0, 0);],
1807 [AC_MSG_RESULT(yes)],
1809 LIBS="$cf_ncurses_SAVE"])
1812 CF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_nculib_root)
1813 AC_DEFINE_UNQUOTED($cf_nculib_ROOT)
1815 dnl ---------------------------------------------------------------------------
1816 dnl CF_NCURSES_VERSION version: 12 updated: 2007/04/28 09:15:55
1817 dnl ------------------
1818 dnl Check for the version of ncurses, to aid in reporting bugs, etc.
1819 dnl Call CF_CURSES_CPPFLAGS first, or CF_NCURSES_CPPFLAGS. We don't use
1820 dnl AC_REQUIRE since that does not work with the shell's if/then/else/fi.
1821 AC_DEFUN([CF_NCURSES_VERSION],
1823 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
1824 AC_CACHE_CHECK(for ncurses version, cf_cv_ncurses_version,[
1825 cf_cv_ncurses_version=no
1829 #include <${cf_cv_ncurses_header-curses.h}>
1833 FILE *fp = fopen("$cf_tempfile", "w");
1834 #ifdef NCURSES_VERSION
1835 # ifdef NCURSES_VERSION_PATCH
1836 fprintf(fp, "%s.%d\n", NCURSES_VERSION, NCURSES_VERSION_PATCH);
1838 fprintf(fp, "%s\n", NCURSES_VERSION);
1842 fprintf(fp, "old\n");
1847 ${cf_cv_main_return-return}(0);
1849 cf_cv_ncurses_version=`cat $cf_tempfile`],,[
1851 # This will not work if the preprocessor splits the line after the
1852 # Autoconf token. The 'unproto' program does that.
1853 cat > conftest.$ac_ext <<EOF
1854 #include <${cf_cv_ncurses_header-curses.h}>
1856 #ifdef NCURSES_VERSION
1857 Autoconf NCURSES_VERSION
1865 cf_try="$ac_cpp conftest.$ac_ext 2>&AC_FD_CC | grep '^Autoconf ' >conftest.out"
1867 if test -f conftest.out ; then
1868 cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[[^"]]*"%%' -e 's%".*%%'`
1869 test -n "$cf_out" && cf_cv_ncurses_version="$cf_out"
1875 test "$cf_cv_ncurses_version" = no || AC_DEFINE(NCURSES)
1877 dnl ---------------------------------------------------------------------------
1878 dnl CF_NCURSES_WRAP_PREFIX version: 1 updated: 2009/03/28 16:08:10
1879 dnl ----------------------
1880 dnl Check for ncurses "wrap-prefix" used for public variables which have been
1881 dnl wrapped with a function to help with concurrency control.
1882 AC_DEFUN([CF_NCURSES_WRAP_PREFIX],
1884 AC_MSG_CHECKING(for ncurses wrap-prefix)
1885 AC_ARG_WITH(ncurses-wrap-prefix,
1886 [ --with-ncurses-wrap-prefix naming-prefix for ncurses wrapped-variables],
1887 [NCURSES_WRAP_PREFIX=$withval],
1888 [NCURSES_WRAP_PREFIX=_nc_])
1889 AC_MSG_RESULT($NCURSES_WRAP_PREFIX)
1891 AC_SUBST(NCURSES_WRAP_PREFIX)
1893 dnl ---------------------------------------------------------------------------
1894 dnl CF_PATH_SYNTAX version: 13 updated: 2010/05/26 05:38:42
1896 dnl Check the argument to see that it looks like a pathname. Rewrite it if it
1897 dnl begins with one of the prefix/exec_prefix variables, and then again if the
1898 dnl result begins with 'NONE'. This is necessary to work around autoconf's
1899 dnl delayed evaluation of those symbols.
1900 AC_DEFUN([CF_PATH_SYNTAX],[
1901 if test "x$prefix" != xNONE; then
1902 cf_path_syntax="$prefix"
1904 cf_path_syntax="$ac_default_prefix"
1907 case ".[$]$1" in #(vi
1908 .\[$]\(*\)*|.\'*\'*) #(vi
1912 .[[a-zA-Z]]:[[\\/]]*) #(vi OS/2 EMX
1914 .\[$]{*prefix}*) #(vi
1916 case ".[$]$1" in #(vi
1918 $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%`
1923 $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%`
1926 ifelse([$2],,[AC_MSG_ERROR([expected a pathname, not \"[$]$1\"])],$2)
1930 dnl ---------------------------------------------------------------------------
1931 dnl CF_PDCURSES_X11 version: 9 updated: 2009/01/11 15:31:37
1933 dnl Configure for PDCurses' X11 library
1934 AC_DEFUN([CF_PDCURSES_X11],[
1935 AC_REQUIRE([CF_X_ATHENA])
1937 AC_PATH_PROGS(XCURSES_CONFIG,xcurses-config,none)
1939 if test "$XCURSES_CONFIG" != none ; then
1941 CPPFLAGS="$CPPFLAGS `$XCURSES_CONFIG --cflags`"
1942 LIBS="`$XCURSES_CONFIG --libs` $LIBS"
1944 cf_cv_lib_XCurses=yes
1948 LDFLAGS="$LDFLAGS $X_LIBS"
1949 CF_CHECK_CFLAGS($X_CFLAGS)
1950 AC_CHECK_LIB(X11,XOpenDisplay,
1951 [LIBS="-lX11 $LIBS"],,
1952 [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])
1953 AC_CACHE_CHECK(for XCurses library,cf_cv_lib_XCurses,[
1954 LIBS="-lXCurses $LIBS"
1956 #include <xcurses.h>
1957 char *XCursesProgramName = "test";
1959 [cf_cv_lib_XCurses=yes],
1960 [cf_cv_lib_XCurses=no])
1965 if test $cf_cv_lib_XCurses = yes ; then
1968 AC_DEFINE(HAVE_XCURSES)
1970 AC_MSG_ERROR(Cannot link with XCurses)
1973 dnl ---------------------------------------------------------------------------
1974 dnl CF_PKG_CONFIG version: 3 updated: 2009/01/25 10:55:09
1976 dnl Check for the package-config program, unless disabled by command-line.
1977 AC_DEFUN([CF_PKG_CONFIG],
1979 AC_MSG_CHECKING(if you want to use pkg-config)
1980 AC_ARG_WITH(pkg-config,
1981 [ --with-pkg-config{=path} enable/disable use of pkg-config],
1982 [cf_pkg_config=$withval],
1983 [cf_pkg_config=yes])
1984 AC_MSG_RESULT($cf_pkg_config)
1986 case $cf_pkg_config in #(vi
1991 AC_PATH_PROG(PKG_CONFIG, pkg-config, none)
1998 test -z "$PKG_CONFIG" && PKG_CONFIG=none
1999 if test "$PKG_CONFIG" != none ; then
2000 CF_PATH_SYNTAX(PKG_CONFIG)
2003 AC_SUBST(PKG_CONFIG)
2005 dnl ---------------------------------------------------------------------------
2006 dnl CF_POSIX_C_SOURCE version: 8 updated: 2010/05/26 05:38:42
2007 dnl -----------------
2008 dnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed.
2010 dnl POSIX.1-1990 _POSIX_SOURCE
2011 dnl POSIX.1-1990 and _POSIX_SOURCE and
2012 dnl POSIX.2-1992 C-Language _POSIX_C_SOURCE=2
2014 dnl POSIX.1b-1993 _POSIX_C_SOURCE=199309L
2015 dnl POSIX.1c-1996 _POSIX_C_SOURCE=199506L
2016 dnl X/Open 2000 _POSIX_C_SOURCE=200112L
2019 dnl $1 is the nominal value for _POSIX_C_SOURCE
2020 AC_DEFUN([CF_POSIX_C_SOURCE],
2022 cf_POSIX_C_SOURCE=ifelse([$1],,199506L,[$1])
2024 cf_save_CFLAGS="$CFLAGS"
2025 cf_save_CPPFLAGS="$CPPFLAGS"
2027 CF_REMOVE_DEFINE(cf_trim_CFLAGS,$cf_save_CFLAGS,_POSIX_C_SOURCE)
2028 CF_REMOVE_DEFINE(cf_trim_CPPFLAGS,$cf_save_CPPFLAGS,_POSIX_C_SOURCE)
2030 AC_CACHE_CHECK(if we should define _POSIX_C_SOURCE,cf_cv_posix_c_source,[
2031 CF_MSG_LOG(if the symbol is already defined go no further)
2032 AC_TRY_COMPILE([#include <sys/types.h>],[
2033 #ifndef _POSIX_C_SOURCE
2036 [cf_cv_posix_c_source=no],
2037 [cf_want_posix_source=no
2038 case .$cf_POSIX_C_SOURCE in #(vi
2040 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
2043 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
2044 cf_want_posix_source=yes
2047 cf_want_posix_source=yes
2050 if test "$cf_want_posix_source" = yes ; then
2051 AC_TRY_COMPILE([#include <sys/types.h>],[
2052 #ifdef _POSIX_SOURCE
2055 cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE")
2057 CF_MSG_LOG(ifdef from value $cf_POSIX_C_SOURCE)
2058 CFLAGS="$cf_trim_CFLAGS"
2059 CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source"
2060 CF_MSG_LOG(if the second compile does not leave our definition intact error)
2061 AC_TRY_COMPILE([#include <sys/types.h>],[
2062 #ifndef _POSIX_C_SOURCE
2065 [cf_cv_posix_c_source=no])
2066 CFLAGS="$cf_save_CFLAGS"
2067 CPPFLAGS="$cf_save_CPPFLAGS"
2071 if test "$cf_cv_posix_c_source" != no ; then
2072 CFLAGS="$cf_trim_CFLAGS"
2073 CPPFLAGS="$cf_trim_CPPFLAGS"
2074 CF_ADD_CFLAGS($cf_cv_posix_c_source)
2078 dnl ---------------------------------------------------------------------------
2079 dnl CF_PRG_RULES version: 1 updated: 2006/06/03 11:45:08
2081 dnl Append definitions and rules for the given programs to the subdirectory
2082 dnl Makefiles, and the recursion rule for the top-level Makefile.
2085 dnl $1 = script to run
2086 dnl $2 = list of subdirectories
2090 AC_DEFUN([CF_PRG_RULES],
2094 if test ! -d $srcdir/$cf_dir; then
2096 elif test -f $srcdir/$cf_dir/programs; then
2097 $AWK -f $1 $srcdir/$cf_dir/programs >>$cf_dir/Makefile
2102 dnl ---------------------------------------------------------------------------
2103 dnl CF_PROG_CC_U_D version: 1 updated: 2005/07/14 16:59:30
2105 dnl Check if C (preprocessor) -U and -D options are processed in the order
2106 dnl given rather than by type of option. Some compilers insist on apply all
2107 dnl of the -U options after all of the -D options. Others allow mixing them,
2108 dnl and may predefine symbols that conflict with those we define.
2109 AC_DEFUN([CF_PROG_CC_U_D],
2111 AC_CACHE_CHECK(if $CC -U and -D options work together,cf_cv_cc_u_d_options,[
2112 cf_save_CPPFLAGS="$CPPFLAGS"
2113 CPPFLAGS="-UU_D_OPTIONS -DU_D_OPTIONS -DD_U_OPTIONS -UD_U_OPTIONS"
2116 make an undefined-error
2119 make a defined-error
2122 cf_cv_cc_u_d_options=yes],[
2123 cf_cv_cc_u_d_options=no])
2124 CPPFLAGS="$cf_save_CPPFLAGS"
2127 dnl ---------------------------------------------------------------------------
2128 dnl CF_REMOVE_DEFINE version: 3 updated: 2010/01/09 11:05:50
2129 dnl ----------------
2130 dnl Remove all -U and -D options that refer to the given symbol from a list
2131 dnl of C compiler options. This works around the problem that not all
2132 dnl compilers process -U and -D options from left-to-right, so a -U option
2133 dnl cannot be used to cancel the effect of a preceding -D option.
2135 dnl $1 = target (which could be the same as the source variable)
2136 dnl $2 = source (including '$')
2137 dnl $3 = symbol to remove
2138 define([CF_REMOVE_DEFINE],
2141 sed -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[[ ]]/ /g' \
2142 -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[$]//g'`
2144 dnl ---------------------------------------------------------------------------
2145 dnl CF_SIG_ATOMIC_T version: 2 updated: 2005/09/18 17:27:12
2147 dnl signal handler, but there are some gcc depedencies in that recommendation.
2149 AC_DEFUN([CF_SIG_ATOMIC_T],
2151 AC_MSG_CHECKING(for signal global datatype)
2152 AC_CACHE_VAL(cf_cv_sig_atomic_t,[
2154 "volatile sig_atomic_t" \
2159 #include <sys/types.h>
2165 static void handler(int sig)
2169 [signal(SIGINT, handler);
2171 [cf_cv_sig_atomic_t=$cf_type],
2172 [cf_cv_sig_atomic_t=no])
2173 test "$cf_cv_sig_atomic_t" != no && break
2176 AC_MSG_RESULT($cf_cv_sig_atomic_t)
2177 test "$cf_cv_sig_atomic_t" != no && AC_DEFINE_UNQUOTED(SIG_ATOMIC_T, $cf_cv_sig_atomic_t)
2179 dnl ---------------------------------------------------------------------------
2180 dnl CF_SUBDIR_PATH version: 6 updated: 2010/04/21 06:20:50
2182 dnl Construct a search-list for a nonstandard header/lib-file
2183 dnl $1 = the variable to return as result
2184 dnl $2 = the package name
2185 dnl $3 = the subdirectory, e.g., bin, include or lib
2186 AC_DEFUN([CF_SUBDIR_PATH],
2190 CF_ADD_SUBDIR_PATH($1,$2,$3,/usr,$prefix)
2191 CF_ADD_SUBDIR_PATH($1,$2,$3,$prefix,NONE)
2192 CF_ADD_SUBDIR_PATH($1,$2,$3,/usr/local,$prefix)
2193 CF_ADD_SUBDIR_PATH($1,$2,$3,/opt,$prefix)
2194 CF_ADD_SUBDIR_PATH($1,$2,$3,[$]HOME,$prefix)
2196 dnl ---------------------------------------------------------------------------
2197 dnl CF_SYS_TIME_SELECT version: 4 updated: 2000/10/04 09:18:40
2198 dnl ------------------
2199 dnl Check if we can include <sys/time.h> with <sys/select.h>; this breaks on
2200 dnl older SCO configurations.
2201 AC_DEFUN([CF_SYS_TIME_SELECT],
2203 AC_MSG_CHECKING(if sys/time.h works with sys/select.h)
2204 AC_CACHE_VAL(cf_cv_sys_time_select,[
2206 #include <sys/types.h>
2207 #ifdef HAVE_SYS_TIME_H
2208 #include <sys/time.h>
2210 #ifdef HAVE_SYS_SELECT_H
2211 #include <sys/select.h>
2213 ],[],[cf_cv_sys_time_select=yes],
2214 [cf_cv_sys_time_select=no])
2216 AC_MSG_RESULT($cf_cv_sys_time_select)
2217 test "$cf_cv_sys_time_select" = yes && AC_DEFINE(HAVE_SYS_TIME_SELECT)
2219 dnl ---------------------------------------------------------------------------
2220 dnl CF_TERM_HEADER version: 1 updated: 2005/12/31 13:26:39
2222 dnl Look for term.h, which is part of X/Open curses. It defines the interface
2223 dnl to terminfo database. Usually it is in the same include-path as curses.h,
2224 dnl but some packagers change this, breaking various applications.
2225 AC_DEFUN([CF_TERM_HEADER],[
2226 AC_CACHE_CHECK(for terminfo header, cf_cv_term_header,[
2227 case ${cf_cv_ncurses_header} in #(vi
2228 */ncurses.h|*/ncursesw.h) #(vi
2229 cf_term_header=`echo "$cf_cv_ncurses_header" | sed -e 's%ncurses[[^.]]*\.h$%term.h%'`
2232 cf_term_header=term.h
2236 for cf_test in $cf_term_header "ncurses/term.h" "ncursesw/term.h"
2238 AC_TRY_COMPILE([#include <stdio.h>
2239 #include <${cf_cv_ncurses_header-curses.h}>
2241 ],[int x = auto_left_margin],[
2242 cf_cv_term_header="$cf_test"],[
2243 cf_cv_term_header=unknown
2245 test "$cf_cv_term_header" != unknown && break
2249 # Set definitions to allow ifdef'ing to accommodate subdirectories
2251 case $cf_cv_term_header in # (vi
2253 AC_DEFINE(HAVE_TERM_H)
2257 case $cf_cv_term_header in # (vi
2258 ncurses/term.h) #(vi
2259 AC_DEFINE(HAVE_NCURSES_TERM_H)
2262 AC_DEFINE(HAVE_NCURSESW_TERM_H)
2266 dnl ---------------------------------------------------------------------------
2267 dnl CF_TRY_PKG_CONFIG version: 2 updated: 2010/05/26 05:38:42
2268 dnl -----------------
2269 dnl This is a simple wrapper to use for pkg-config, for libraries which may be
2270 dnl available in that form.
2272 dnl $1 = package name
2273 dnl $2 = extra logic to use, if any, after updating CFLAGS and LIBS
2274 dnl $3 = logic to use if pkg-config does not have the package
2275 AC_DEFUN([CF_TRY_PKG_CONFIG],[
2276 AC_REQUIRE([CF_PKG_CONFIG])
2278 if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists $1; then
2279 CF_VERBOSE(found package $1)
2280 cf_pkgconfig_incs="`$PKG_CONFIG --cflags $1 2>/dev/null`"
2281 cf_pkgconfig_libs="`$PKG_CONFIG --libs $1 2>/dev/null`"
2282 CF_ADD_CFLAGS($cf_pkgconfig_incs)
2283 LIBS="$cf_pkgconfig_libs $LIBS"
2284 ifelse([$2],,:,[$2])
2286 ifelse([$3],,:,[$3])
2289 dnl ---------------------------------------------------------------------------
2290 dnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59
2292 dnl Make an uppercase version of a variable
2293 dnl $1=uppercase($2)
2294 AC_DEFUN([CF_UPPER],
2296 $1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
2298 dnl ---------------------------------------------------------------------------
2299 dnl CF_UTF8_LIB version: 6 updated: 2010/04/21 06:20:50
2301 dnl Check for multibyte support, and if not found, utf8 compatibility library
2302 AC_DEFUN([CF_UTF8_LIB],
2304 AC_CACHE_CHECK(for multibyte character support,cf_cv_utf8_lib,[
2305 cf_save_LIBS="$LIBS"
2307 #include <stdlib.h>],[putwc(0,0);],
2308 [cf_cv_utf8_lib=yes],
2310 #include <libutf8.h>],[putwc(0,0);],utf8,
2311 [cf_cv_utf8_lib=add-on],
2312 [cf_cv_utf8_lib=no])
2315 # HAVE_LIBUTF8_H is used by ncurses if curses.h is shared between
2317 if test "$cf_cv_utf8_lib" = "add-on" ; then
2318 AC_DEFINE(HAVE_LIBUTF8_H)
2319 CF_ADD_INCDIR($cf_cv_header_path_utf8)
2320 CF_ADD_LIBDIR($cf_cv_library_path_utf8)
2321 LIBS="$cf_cv_library_file_utf8 $LIBS"
2324 dnl ---------------------------------------------------------------------------
2325 dnl CF_VERBOSE version: 3 updated: 2007/07/29 09:55:12
2327 dnl Use AC_VERBOSE w/o the warnings
2328 AC_DEFUN([CF_VERBOSE],
2329 [test -n "$verbose" && echo " $1" 1>&AC_FD_MSG
2332 dnl ---------------------------------------------------------------------------
2333 dnl CF_WCHAR_TYPE version: 3 updated: 2010/05/26 16:44:57
2335 dnl Check if type wide-character type $1 is declared, and if so, which header
2336 dnl file is needed. The second parameter is used to set a shell variable when
2337 dnl the type is not found. The first parameter sets a shell variable for the
2339 AC_DEFUN([CF_WCHAR_TYPE],
2341 # This is needed on Tru64 5.0 to declare $1
2342 AC_CACHE_CHECK(if we must include wchar.h to declare $1,cf_cv_$1,[
2347 #ifdef HAVE_LIBUTF8_H
2348 #include <libutf8.h>
2357 #ifdef HAVE_LIBUTF8_H
2358 #include <libutf8.h>
2362 [cf_cv_$1=unknown])])])
2364 if test "$cf_cv_$1" = yes ; then
2365 AC_DEFINE(NEED_WCHAR_H)
2370 # if we do not find $1 in either place, use substitution to provide a fallback.
2371 if test "$cf_cv_$1" = unknown ; then
2376 # if we find $1 in either place, use substitution to provide a fallback.
2377 if test "$cf_cv_$1" != unknown ; then
2382 dnl ---------------------------------------------------------------------------
2383 dnl CF_WITH_CURSES_DIR version: 2 updated: 2002/11/10 14:46:59
2384 dnl ------------------
2385 dnl Wrapper for AC_ARG_WITH to specify directory under which to look for curses
2387 AC_DEFUN([CF_WITH_CURSES_DIR],[
2388 AC_ARG_WITH(curses-dir,
2389 [ --with-curses-dir=DIR directory in which (n)curses is installed],
2390 [CF_PATH_SYNTAX(withval)
2391 cf_cv_curses_dir=$withval],
2392 [cf_cv_curses_dir=no])
2394 dnl ---------------------------------------------------------------------------
2395 dnl CF_XOPEN_CURSES version: 9 updated: 2010/04/28 06:02:16
2397 dnl Test if we should define X/Open source for curses, needed on Digital Unix
2398 dnl 4.x, to see the extended functions, but breaks on IRIX 6.x.
2400 dnl The getbegyx() check is needed for HPUX, which omits legacy macros such
2401 dnl as getbegy(). The latter is better design, but the former is standard.
2402 AC_DEFUN([CF_XOPEN_CURSES],
2404 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
2405 AC_CACHE_CHECK(if we must define _XOPEN_SOURCE_EXTENDED,cf_cv_need_xopen_extension,[
2408 #include <${cf_cv_ncurses_header-curses.h}>],[
2409 #if defined(NCURSES_VERSION_PATCH)
2410 if (NCURSES_VERSION_PATCH < 20100501) && (NCURSES_VERSION_PATCH >= 20100403)
2414 long x = winnstr(stdscr, "", 0);
2416 getbegyx(stdscr, y1, x1)],
2417 [cf_cv_need_xopen_extension=no],
2419 #define _XOPEN_SOURCE_EXTENDED
2421 #include <${cf_cv_ncurses_header-curses.h}>],[
2422 #ifdef NCURSES_VERSION
2424 int check2 = curs_set((int)sizeof(check));
2426 long x = winnstr(stdscr, "", 0);
2428 getbegyx(stdscr, y1, x1)],
2429 [cf_cv_need_xopen_extension=yes],
2430 [cf_cv_need_xopen_extension=unknown])])])
2431 test $cf_cv_need_xopen_extension = yes && CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED"
2433 dnl ---------------------------------------------------------------------------
2434 dnl CF_XOPEN_SOURCE version: 34 updated: 2010/05/26 05:38:42
2436 dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions,
2437 dnl or adapt to the vendor's definitions to get equivalent functionality,
2438 dnl without losing the common non-POSIX features.
2441 dnl $1 is the nominal value for _XOPEN_SOURCE
2442 dnl $2 is the nominal value for _POSIX_C_SOURCE
2443 AC_DEFUN([CF_XOPEN_SOURCE],[
2445 cf_XOPEN_SOURCE=ifelse([$1],,500,[$1])
2446 cf_POSIX_C_SOURCE=ifelse([$2],,199506L,[$2])
2449 case $host_os in #(vi
2451 cf_xopen_source="-D_ALL_SOURCE"
2453 darwin[[0-8]].*) #(vi
2454 cf_xopen_source="-D_APPLE_C_SOURCE"
2457 cf_xopen_source="-D_DARWIN_C_SOURCE"
2459 freebsd*|dragonfly*) #(vi
2460 # 5.x headers associate
2461 # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L
2462 # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L
2463 cf_POSIX_C_SOURCE=200112L
2465 cf_xopen_source="-D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
2468 cf_xopen_source="-D_HPUX_SOURCE -D_XOPEN_SOURCE=500"
2471 cf_xopen_source="-D_HPUX_SOURCE"
2474 cf_xopen_source="-D_SGI_SOURCE"
2476 linux*|gnu*|mint*|k*bsd*-gnu) #(vi
2480 # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <arpa/inet.h>
2483 # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw
2486 # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw
2489 cf_xopen_source="-D_OSF_SOURCE"
2492 cf_xopen_source="-D_QNX_SOURCE"
2495 # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer
2497 solaris2.1[[0-9]]) #(vi
2498 cf_xopen_source="-D__EXTENSIONS__ -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
2500 solaris2.[[1-9]]) #(vi
2501 cf_xopen_source="-D__EXTENSIONS__"
2504 AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[
2505 AC_TRY_COMPILE([#include <sys/types.h>],[
2506 #ifndef _XOPEN_SOURCE
2509 [cf_cv_xopen_source=no],
2510 [cf_save="$CPPFLAGS"
2511 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
2512 AC_TRY_COMPILE([#include <sys/types.h>],[
2513 #ifdef _XOPEN_SOURCE
2516 [cf_cv_xopen_source=no],
2517 [cf_cv_xopen_source=$cf_XOPEN_SOURCE])
2521 if test "$cf_cv_xopen_source" != no ; then
2522 CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE)
2523 CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE)
2524 cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source"
2525 CF_ADD_CFLAGS($cf_temp_xopen_source)
2527 CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE)
2531 if test -n "$cf_xopen_source" ; then
2532 CF_ADD_CFLAGS($cf_xopen_source)
2535 dnl ---------------------------------------------------------------------------
2536 dnl CF_X_ATHENA version: 14 updated: 2010/05/26 19:19:58
2538 dnl Check for Xaw (Athena) libraries
2540 dnl Sets $cf_x_athena according to the flavor of Xaw which is used.
2541 AC_DEFUN([CF_X_ATHENA],
2543 cf_x_athena=${cf_x_athena-Xaw}
2545 AC_MSG_CHECKING(if you want to link with Xaw 3d library)
2548 [ --with-Xaw3d link with Xaw 3d library])
2549 if test "$withval" = yes ; then
2556 AC_MSG_CHECKING(if you want to link with neXT Athena library)
2559 [ --with-neXtaw link with neXT Athena library])
2560 if test "$withval" = yes ; then
2567 AC_MSG_CHECKING(if you want to link with Athena-Plus library)
2569 AC_ARG_WITH(XawPlus,
2570 [ --with-XawPlus link with Athena-Plus library])
2571 if test "$withval" = yes ; then
2580 if test "$PKG_CONFIG" != none ; then
2582 test "$cf_x_athena" = Xaw && cf_athena_list="xaw8 xaw7 xaw6"
2583 for cf_athena_pkg in \
2586 ${cf_x_athena}-devel \
2588 lib${cf_x_athena}-devel
2590 if "$PKG_CONFIG" --exists $cf_athena_pkg; then
2591 CF_VERBOSE(found package $cf_athena_pkg)
2592 cf_x_athena_inc="`$PKG_CONFIG --cflags $cf_athena_pkg 2>/dev/null`"
2593 cf_x_athena_lib="`$PKG_CONFIG --libs $cf_athena_pkg 2>/dev/null`"
2594 CF_ADD_CFLAGS($cf_x_athena_inc)
2595 LIBS="$cf_x_athena_lib $LIBS"
2597 CF_UPPER(cf_x_athena_LIBS,HAVE_LIB_$cf_x_athena)
2598 AC_DEFINE_UNQUOTED($cf_x_athena_LIBS)
2604 if test -z "$cf_x_athena_lib" ; then
2607 CF_X_ATHENA_CPPFLAGS($cf_x_athena)
2608 CF_X_ATHENA_LIBS($cf_x_athena)
2611 dnl ---------------------------------------------------------------------------
2612 dnl CF_X_ATHENA_CPPFLAGS version: 5 updated: 2010/05/26 17:35:30
2613 dnl --------------------
2614 dnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of
2615 dnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw.
2616 AC_DEFUN([CF_X_ATHENA_CPPFLAGS],
2618 cf_x_athena_root=ifelse([$1],,Xaw,[$1])
2621 for cf_path in default \
2622 /usr/contrib/X11R6 \
2623 /usr/contrib/X11R5 \
2627 if test -z "$cf_x_athena_inc" ; then
2629 cf_test=X11/$cf_x_athena_root/SimpleMenu.h
2630 if test $cf_path != default ; then
2631 CPPFLAGS="$cf_save -I$cf_path/include"
2632 AC_MSG_CHECKING(for $cf_test in $cf_path)
2634 AC_MSG_CHECKING(for $cf_test)
2637 #include <X11/Intrinsic.h>
2638 #include <$cf_test>],[],
2641 AC_MSG_RESULT($cf_result)
2642 if test "$cf_result" = yes ; then
2643 cf_x_athena_inc=$cf_path
2651 if test -z "$cf_x_athena_inc" ; then
2653 [Unable to successfully find Athena header files with test program])
2654 elif test "$cf_x_athena_inc" != default ; then
2655 CPPFLAGS="$CPPFLAGS -I$cf_x_athena_inc"
2658 dnl ---------------------------------------------------------------------------
2659 dnl CF_X_ATHENA_LIBS version: 8 updated: 2010/05/26 05:38:42
2660 dnl ----------------
2661 dnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of
2662 dnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw.
2663 AC_DEFUN([CF_X_ATHENA_LIBS],
2664 [AC_REQUIRE([CF_X_TOOLKIT])
2665 cf_x_athena_root=ifelse([$1],,Xaw,[$1])
2668 for cf_path in default \
2669 /usr/contrib/X11R6 \
2670 /usr/contrib/X11R5 \
2675 "-l$cf_x_athena_root -lXmu" \
2676 "-l$cf_x_athena_root -lXpm -lXmu" \
2677 "-l${cf_x_athena_root}_s -lXmu_s"
2679 if test -z "$cf_x_athena_lib" ; then
2681 cf_test=XawSimpleMenuAddGlobalActions
2682 if test $cf_path != default ; then
2683 LIBS="-L$cf_path/lib $cf_lib $LIBS"
2684 AC_MSG_CHECKING(for $cf_lib in $cf_path)
2686 LIBS="$cf_lib $LIBS"
2687 AC_MSG_CHECKING(for $cf_test in $cf_lib)
2689 AC_TRY_LINK([],[$cf_test()],
2692 AC_MSG_RESULT($cf_result)
2693 if test "$cf_result" = yes ; then
2694 cf_x_athena_lib="$cf_lib"
2702 if test -z "$cf_x_athena_lib" ; then
2704 [Unable to successfully link Athena library (-l$cf_x_athena_root) with test program])
2707 CF_UPPER(cf_x_athena_LIBS,HAVE_LIB_$cf_x_athena)
2708 AC_DEFINE_UNQUOTED($cf_x_athena_LIBS)
2710 dnl ---------------------------------------------------------------------------
2711 dnl CF_X_EXT version: 2 updated: 2010/05/26 05:38:42
2713 AC_DEFUN([CF_X_EXT],[
2714 CF_TRY_PKG_CONFIG(Xext,,[
2715 AC_CHECK_LIB(Xext,XextCreateExtension,
2716 [LIBS="-lXext $LIBS"])])
2718 dnl ---------------------------------------------------------------------------
2719 dnl CF_X_TOOLKIT version: 13 updated: 2010/05/26 05:45:44
2721 dnl Check for X Toolkit libraries
2723 AC_DEFUN([CF_X_TOOLKIT],
2725 AC_REQUIRE([AC_PATH_XTRA])
2726 AC_REQUIRE([CF_CHECK_CACHE])
2730 CF_TRY_PKG_CONFIG(xt,[
2734 LDFLAGS="$X_LIBS $LDFLAGS"
2735 CF_CHECK_CFLAGS($X_CFLAGS)
2737 AC_CHECK_FUNC(XOpenDisplay,,[
2738 AC_CHECK_LIB(X11,XOpenDisplay,
2739 [LIBS="-lX11 $LIBS"],,
2740 [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])])
2742 AC_CHECK_FUNC(XtAppInitialize,,[
2743 AC_CHECK_LIB(Xt, XtAppInitialize,
2744 [AC_DEFINE(HAVE_LIBXT)
2746 LIBS="-lXt $X_PRE_LIBS $LIBS $X_EXTRA_LIBS"],,
2747 [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])])
2750 if test $cf_have_X_LIBS = no ; then
2752 [Unable to successfully link X Toolkit library (-lXt) with
2753 test program. You will have to check and add the proper libraries by hand
2757 dnl ---------------------------------------------------------------------------
2758 dnl CF__CURSES_HEAD version: 1 updated: 2009/07/16 19:32:31
2760 dnl Define a reusable chunk which includes <curses.h> and <term.h> when they
2761 dnl are both available.
2762 define([CF__CURSES_HEAD],[
2764 #include <xcurses.h>
2765 char * XCursesProgramName = "test";
2767 #include <${cf_cv_ncurses_header-curses.h}>
2768 #if defined(NCURSES_VERSION) && defined(HAVE_NCURSESW_TERM_H)
2769 #include <ncursesw/term.h>
2770 #elif defined(NCURSES_VERSION) && defined(HAVE_NCURSES_TERM_H)
2771 #include <ncurses/term.h>
2772 #elif defined(HAVE_TERM_H)