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.44 2010/11/14 00:44:52 tom Exp $
31 dnl Author: Thomas E. Dickey
33 dnl Macros used in NCURSES test programs auto-configuration script.
35 dnl These macros are maintained separately from NCURSES. The copyright on
36 dnl this file applies to the aggregation of macros and does not affect use of
37 dnl these macros in other applications.
39 dnl See http://invisible-island.net/autoconf/ for additional information.
41 dnl ---------------------------------------------------------------------------
42 dnl ---------------------------------------------------------------------------
43 dnl CF_ADD_CFLAGS version: 10 updated: 2010/05/26 05:38:42
45 dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS
46 dnl The second parameter if given makes this macro verbose.
48 dnl Put any preprocessor definitions that use quoted strings in $EXTRA_CPPFLAGS,
49 dnl to simplify use of $CPPFLAGS in compiler checks, etc., that are easily
50 dnl confused by the quotes (which require backslashes to keep them usable).
51 AC_DEFUN([CF_ADD_CFLAGS],
56 cf_new_extra_cppflags=
58 for cf_add_cflags in $1
60 case $cf_fix_cppflags in
62 case $cf_add_cflags in #(vi
63 -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi
64 case $cf_add_cflags in
66 cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[[^=]]*='\''\"[[^"]]*//'`
68 test "${cf_add_cflags}" != "${cf_tst_cflags}" \
69 && test -z "${cf_tst_cflags}" \
70 && cf_fix_cppflags=yes
72 if test $cf_fix_cppflags = yes ; then
73 cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
75 elif test "${cf_tst_cflags}" = "\"'" ; then
76 cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
85 case $cf_add_cflags in #(vi
87 cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'`
88 CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,$cf_tst_cppflags)
91 cf_new_cppflags="$cf_new_cppflags $cf_add_cflags"
96 cf_new_cflags="$cf_new_cflags $cf_add_cflags"
101 cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
103 cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[[^"]]*"'\''//'`
105 test "${cf_add_cflags}" != "${cf_tst_cflags}" \
106 && test -z "${cf_tst_cflags}" \
107 && cf_fix_cppflags=no
112 if test -n "$cf_new_cflags" ; then
113 ifelse([$2],,,[CF_VERBOSE(add to \$CFLAGS $cf_new_cflags)])
114 CFLAGS="$CFLAGS $cf_new_cflags"
117 if test -n "$cf_new_cppflags" ; then
118 ifelse([$2],,,[CF_VERBOSE(add to \$CPPFLAGS $cf_new_cppflags)])
119 CPPFLAGS="$CPPFLAGS $cf_new_cppflags"
122 if test -n "$cf_new_extra_cppflags" ; then
123 ifelse([$2],,,[CF_VERBOSE(add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags)])
124 EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
127 AC_SUBST(EXTRA_CPPFLAGS)
130 dnl ---------------------------------------------------------------------------
131 dnl CF_ADD_INCDIR version: 13 updated: 2010/05/26 16:44:57
133 dnl Add an include-directory to $CPPFLAGS. Don't add /usr/include, since it's
134 dnl redundant. We don't normally need to add -I/usr/local/include for gcc,
135 dnl but old versions (and some misinstalled ones) need that. To make things
136 dnl worse, gcc 3.x may give error messages if -I/usr/local/include is added to
137 dnl the include-path).
138 AC_DEFUN([CF_ADD_INCDIR],
140 if test -n "$1" ; then
141 for cf_add_incdir in $1
143 while test $cf_add_incdir != /usr/include
145 if test -d $cf_add_incdir
148 if test -n "$CFLAGS$CPPFLAGS" ; then
149 # a loop is needed to ensure we can add subdirs of existing dirs
150 for cf_test_incdir in $CFLAGS $CPPFLAGS ; do
151 if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then
152 cf_have_incdir=yes; break
157 if test "$cf_have_incdir" = no ; then
158 if test "$cf_add_incdir" = /usr/local/include ; then
161 cf_save_CPPFLAGS=$CPPFLAGS
162 CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
163 AC_TRY_COMPILE([#include <stdio.h>],
166 [cf_have_incdir=yes])
167 CPPFLAGS=$cf_save_CPPFLAGS
172 if test "$cf_have_incdir" = no ; then
173 CF_VERBOSE(adding $cf_add_incdir to include-path)
174 ifelse([$2],,CPPFLAGS,[$2])="$ifelse([$2],,CPPFLAGS,[$2]) -I$cf_add_incdir"
176 cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'`
177 test "$cf_top_incdir" = "$cf_add_incdir" && break
178 cf_add_incdir="$cf_top_incdir"
187 dnl ---------------------------------------------------------------------------
188 dnl CF_ADD_LIB version: 2 updated: 2010/06/02 05:03:05
190 dnl Add a library, used to enforce consistency.
192 dnl $1 = library to add, without the "-l"
193 dnl $2 = variable to update (default $LIBS)
194 AC_DEFUN([CF_ADD_LIB],[CF_ADD_LIBS(-l$1,ifelse($2,,LIBS,[$2]))])dnl
195 dnl ---------------------------------------------------------------------------
196 dnl CF_ADD_LIBDIR version: 9 updated: 2010/05/26 16:44:57
198 dnl Adds to the library-path
200 dnl Some machines have trouble with multiple -L options.
202 dnl $1 is the (list of) directory(s) to add
203 dnl $2 is the optional name of the variable to update (default LDFLAGS)
205 AC_DEFUN([CF_ADD_LIBDIR],
207 if test -n "$1" ; then
208 for cf_add_libdir in $1
210 if test $cf_add_libdir = /usr/lib ; then
212 elif test -d $cf_add_libdir
215 if test -n "$LDFLAGS$LIBS" ; then
216 # a loop is needed to ensure we can add subdirs of existing dirs
217 for cf_test_libdir in $LDFLAGS $LIBS ; do
218 if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then
219 cf_have_libdir=yes; break
223 if test "$cf_have_libdir" = no ; then
224 CF_VERBOSE(adding $cf_add_libdir to library-path)
225 ifelse([$2],,LDFLAGS,[$2])="-L$cf_add_libdir $ifelse([$2],,LDFLAGS,[$2])"
231 dnl ---------------------------------------------------------------------------
232 dnl CF_ADD_LIBS version: 1 updated: 2010/06/02 05:03:05
234 dnl Add one or more libraries, used to enforce consistency.
236 dnl $1 = libraries to add, with the "-l", etc.
237 dnl $2 = variable to update (default $LIBS)
238 AC_DEFUN([CF_ADD_LIBS],[ifelse($2,,LIBS,[$2])="$1 [$]ifelse($2,,LIBS,[$2])"])dnl
239 dnl ---------------------------------------------------------------------------
240 dnl CF_ADD_LIB_AFTER version: 2 updated: 2010/11/08 20:33:46
242 dnl Add a given library after another, e.g., following the one it satisfies a
245 dnl $1 = the first library
246 dnl $2 = its dependency
247 AC_DEFUN([CF_ADD_LIB_AFTER],[
248 CF_VERBOSE(...before $LIBS)
249 LIBS=`echo "$LIBS" | sed -e "s/[[ ]][[ ]]*/ /g" -e "s,$1 ,$1 $2 ," -e 's/ / /g'`
250 CF_VERBOSE(...after $LIBS)
252 dnl ---------------------------------------------------------------------------
253 dnl CF_ADD_SUBDIR_PATH version: 3 updated: 2010/07/03 20:58:12
254 dnl ------------------
255 dnl Append to a search-list for a nonstandard header/lib-file
256 dnl $1 = the variable to return as result
257 dnl $2 = the package name
258 dnl $3 = the subdirectory, e.g., bin, include or lib
259 dnl $4 = the directory under which we will test for subdirectories
260 dnl $5 = a directory that we do not want $4 to match
261 AC_DEFUN([CF_ADD_SUBDIR_PATH],
263 test "$4" != "$5" && \
265 ifelse([$5],NONE,,[(test $5 = NONE || test "$4" != "$5") &&]) {
266 test -n "$verbose" && echo " ... testing for $3-directories under $4"
267 test -d $4/$3 && $1="[$]$1 $4/$3"
268 test -d $4/$3/$2 && $1="[$]$1 $4/$3/$2"
269 test -d $4/$3/$2/$3 && $1="[$]$1 $4/$3/$2/$3"
270 test -d $4/$2/$3 && $1="[$]$1 $4/$2/$3"
271 test -d $4/$2/$3/$2 && $1="[$]$1 $4/$2/$3/$2"
274 dnl ---------------------------------------------------------------------------
275 dnl CF_ANSI_CC_CHECK version: 10 updated: 2010/10/23 15:52:32
277 dnl This is adapted from the macros 'fp_PROG_CC_STDC' and 'fp_C_PROTOTYPES'
278 dnl in the sharutils 4.2 distribution.
279 AC_DEFUN([CF_ANSI_CC_CHECK],
281 AC_CACHE_CHECK(for ${CC:-cc} option to accept ANSI C, cf_cv_ansi_cc,[
283 cf_save_CFLAGS="$CFLAGS"
284 cf_save_CPPFLAGS="$CPPFLAGS"
285 # Don't try gcc -ansi; that turns off useful extensions and
286 # breaks some systems' header files.
288 # Ultrix and OSF/1 -std1
289 # HP-UX -Aa -D_HPUX_SOURCE
291 # UnixWare 1.2 (cannot use -Xc, since ANSI/POSIX clashes)
292 for cf_arg in "-DCC_HAS_PROTOS" \
297 "-Aa -D_HPUX_SOURCE" \
300 CF_ADD_CFLAGS($cf_arg)
303 #ifndef CC_HAS_PROTOS
304 #if !defined(__STDC__) || (__STDC__ != 1)
309 int test (int i, double x);
310 struct s1 {int (*f) (int a);};
311 struct s2 {int (*f) (double a);};],
312 [cf_cv_ansi_cc="$cf_arg"; break])
314 CFLAGS="$cf_save_CFLAGS"
315 CPPFLAGS="$cf_save_CPPFLAGS"
318 if test "$cf_cv_ansi_cc" != "no"; then
319 if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then
320 CF_ADD_CFLAGS($cf_cv_ansi_cc)
322 AC_DEFINE(CC_HAS_PROTOS)
326 dnl ---------------------------------------------------------------------------
327 dnl CF_ANSI_CC_REQD version: 4 updated: 2008/03/23 14:48:54
329 dnl For programs that must use an ANSI compiler, obtain compiler options that
330 dnl will make it recognize prototypes. We'll do preprocessor checks in other
331 dnl macros, since tools such as unproto can fake prototypes, but only part of
332 dnl the preprocessor.
333 AC_DEFUN([CF_ANSI_CC_REQD],
334 [AC_REQUIRE([CF_ANSI_CC_CHECK])
335 if test "$cf_cv_ansi_cc" = "no"; then
337 [Your compiler does not appear to recognize prototypes.
338 You have the following choices:
339 a. adjust your compiler options
340 b. get an up-to-date compiler
341 c. use a wrapper such as unproto])
344 dnl ---------------------------------------------------------------------------
345 dnl CF_ARG_DISABLE version: 3 updated: 1999/03/30 17:24:31
347 dnl Allow user to disable a normally-on option.
348 AC_DEFUN([CF_ARG_DISABLE],
349 [CF_ARG_OPTION($1,[$2],[$3],[$4],yes)])dnl
350 dnl ---------------------------------------------------------------------------
351 dnl CF_ARG_ENABLE version: 3 updated: 1999/03/30 17:24:31
353 dnl Allow user to enable a normally-off option.
354 AC_DEFUN([CF_ARG_ENABLE],
355 [CF_ARG_OPTION($1,[$2],[$3],[$4],no)])dnl
356 dnl ---------------------------------------------------------------------------
357 dnl CF_ARG_OPTION version: 4 updated: 2010/05/26 05:38:42
359 dnl Restricted form of AC_ARG_ENABLE that ensures user doesn't give bogus
365 dnl $3 = action to perform if option is not default
366 dnl $4 = action if perform if option is default
367 dnl $5 = default option value (either 'yes' or 'no')
368 AC_DEFUN([CF_ARG_OPTION],
369 [AC_ARG_ENABLE([$1],[$2],[test "$enableval" != ifelse([$5],no,yes,no) && enableval=ifelse([$5],no,no,yes)
370 if test "$enableval" != "$5" ; then
372 ,[ $3]) ifelse([$4],,,[
375 fi],[enableval=$5 ifelse([$4],,,[
379 dnl ---------------------------------------------------------------------------
380 dnl CF_CHECK_CACHE version: 11 updated: 2008/03/23 14:45:59
382 dnl Check if we're accidentally using a cache from a different machine.
383 dnl Derive the system name, as a check for reusing the autoconf cache.
385 dnl If we've packaged config.guess and config.sub, run that (since it does a
386 dnl better job than uname). Normally we'll use AC_CANONICAL_HOST, but allow
387 dnl an extra parameter that we may override, e.g., for AC_CANONICAL_SYSTEM
388 dnl which is useful in cross-compiles.
390 dnl Note: we would use $ac_config_sub, but that is one of the places where
391 dnl autoconf 2.5x broke compatibility with autoconf 2.13
392 AC_DEFUN([CF_CHECK_CACHE],
394 if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then
395 ifelse([$1],,[AC_CANONICAL_HOST],[$1])
396 system_name="$host_os"
398 system_name="`(uname -s -r) 2>/dev/null`"
399 if test -z "$system_name" ; then
400 system_name="`(hostname) 2>/dev/null`"
403 test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name")
404 AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"])
406 test -z "$system_name" && system_name="$cf_cv_system_name"
407 test -n "$cf_cv_system_name" && AC_MSG_RESULT(Configuring for $cf_cv_system_name)
409 if test ".$system_name" != ".$cf_cv_system_name" ; then
410 AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name))
411 AC_MSG_ERROR("Please remove config.cache and try again.")
414 dnl ---------------------------------------------------------------------------
415 dnl CF_CHECK_CFLAGS version: 2 updated: 2001/12/30 19:09:58
417 dnl Conditionally add to $CFLAGS and $CPPFLAGS values which are derived from
418 dnl a build-configuration such as imake. These have the pitfall that they
419 dnl often contain compiler-specific options which we cannot use, mixed with
420 dnl preprocessor options that we usually can.
421 AC_DEFUN([CF_CHECK_CFLAGS],
423 CF_VERBOSE(checking additions to CFLAGS)
424 cf_check_cflags="$CFLAGS"
425 cf_check_cppflags="$CPPFLAGS"
426 CF_ADD_CFLAGS($1,yes)
427 if test "$cf_check_cflags" != "$CFLAGS" ; then
428 AC_TRY_LINK([#include <stdio.h>],[printf("Hello world");],,
429 [CF_VERBOSE(test-compile failed. Undoing change to \$CFLAGS)
430 if test "$cf_check_cppflags" != "$CPPFLAGS" ; then
431 CF_VERBOSE(but keeping change to \$CPPFLAGS)
433 CFLAGS="$cf_check_flags"])
436 dnl ---------------------------------------------------------------------------
437 dnl CF_CURSES_ACS_MAP version: 6 updated: 2010/10/23 15:54:49
438 dnl -----------------
439 dnl Check for likely values of acs_map[]:
440 AC_DEFUN([CF_CURSES_ACS_MAP],
442 AC_REQUIRE([CF_NCURSES_WRAP_PREFIX])dnl
443 AC_CACHE_CHECK(for alternate character set array, cf_cv_curses_acs_map,[
444 cf_cv_curses_acs_map=unknown
445 for name in acs_map _acs_map __acs_map ${NCURSES_WRAP_PREFIX}acs_map
448 #include <${cf_cv_ncurses_header:-curses.h}>
450 $name['k'] = ACS_PLUS
451 ],[cf_cv_curses_acs_map=$name; break])
455 test "$cf_cv_curses_acs_map" != unknown && AC_DEFINE_UNQUOTED(CURSES_ACS_ARRAY,$cf_cv_curses_acs_map)
457 dnl ---------------------------------------------------------------------------
458 dnl CF_CURSES_CHECK_DATA version: 3 updated: 2010/10/23 15:54:49
459 dnl --------------------
460 dnl Check if curses.h defines the given data/variable.
461 dnl Use this after CF_NCURSES_CONFIG or CF_CURSES_CONFIG.
462 AC_DEFUN([CF_CURSES_CHECK_DATA],
464 AC_MSG_CHECKING(for data $1 declaration in ${cf_cv_ncurses_header:-curses.h})
465 AC_TRY_COMPILE(CF__CURSES_HEAD,[
467 ],cf_result=yes,cf_result=no)
468 AC_MSG_RESULT($cf_result)
469 if test $cf_result = yes ; then
470 CF_UPPER(cf_result,have_curses_data_$1)
471 AC_DEFINE_UNQUOTED($cf_result)
473 AC_MSG_CHECKING(for data $1 in library)
474 AC_TRY_LINK(CF__CURSES_HEAD
478 ${cf_cv_main_return:-return}(foo == 0);
480 ],[cf_result=yes],[cf_result=no])
481 AC_MSG_RESULT($cf_result)
482 if test $cf_result = yes ; then
483 CF_UPPER(cf_result,decl_curses_data_$1)
484 AC_DEFINE_UNQUOTED($cf_result)
488 dnl ---------------------------------------------------------------------------
489 dnl CF_CURSES_CHECK_TYPE version: 3 updated: 2010/10/23 15:54:49
490 dnl --------------------
491 dnl Check if curses.h defines the given type
492 AC_DEFUN([CF_CURSES_CHECK_TYPE],
494 AC_MSG_CHECKING(for type $1 in ${cf_cv_ncurses_header:-curses.h})
496 #ifndef _XOPEN_SOURCE_EXTENDED
497 #define _XOPEN_SOURCE_EXTENDED
499 #include <${cf_cv_ncurses_header:-curses.h}>],[
501 ],cf_result=yes,cf_result=no)
502 AC_MSG_RESULT($cf_result)
503 if test $cf_result = yes ; then
504 CF_UPPER(cf_result,have_type_$1)
505 AC_DEFINE_UNQUOTED($cf_result)
507 AC_DEFINE_UNQUOTED($1,$2)
510 dnl ---------------------------------------------------------------------------
511 dnl CF_CURSES_CONFIG version: 2 updated: 2006/10/29 11:06:27
513 dnl Tie together the configure-script macros for curses. It may be ncurses,
514 dnl but unless asked, we do not make a special search for ncurses. However,
515 dnl still check for the ncurses version number, for use in other macros.
516 AC_DEFUN([CF_CURSES_CONFIG],
522 dnl ---------------------------------------------------------------------------
523 dnl CF_CURSES_CPPFLAGS version: 10 updated: 2009/01/06 19:34:11
524 dnl ------------------
525 dnl Look for the curses headers.
526 AC_DEFUN([CF_CURSES_CPPFLAGS],[
528 AC_CACHE_CHECK(for extra include directories,cf_cv_curses_incdir,[
529 cf_cv_curses_incdir=no
530 case $host_os in #(vi
532 test -d /usr/include/curses_colr && \
533 cf_cv_curses_incdir="-I/usr/include/curses_colr"
536 test -d /usr/5lib && \
537 test -d /usr/5include && \
538 cf_cv_curses_incdir="-I/usr/5include"
542 test "$cf_cv_curses_incdir" != no && CPPFLAGS="$CPPFLAGS $cf_cv_curses_incdir"
547 dnl ---------------------------------------------------------------------------
548 dnl CF_CURSES_FUNCS version: 15 updated: 2010/10/23 15:52:32
550 dnl Curses-functions are a little complicated, since a lot of them are macros.
551 AC_DEFUN([CF_CURSES_FUNCS],
553 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
554 AC_REQUIRE([CF_XOPEN_CURSES])
555 AC_REQUIRE([CF_CURSES_TERM_H])
558 CF_UPPER(cf_tr_func,$cf_func)
559 AC_MSG_CHECKING(for ${cf_func})
560 CF_MSG_LOG(${cf_func})
561 AC_CACHE_VAL(cf_cv_func_$cf_func,[
562 eval cf_result='$ac_cv_func_'$cf_func
563 if test ".$cf_result" != ".no"; then
564 AC_TRY_LINK(CF__CURSES_HEAD,
567 long foo = (long)(&${cf_func});
568 ${cf_cv_main_return:-return}(foo == 0);
574 eval 'cf_cv_func_'$cf_func'=$cf_result'
576 # use the computed/retrieved cache-value:
577 eval 'cf_result=$cf_cv_func_'$cf_func
578 AC_MSG_RESULT($cf_result)
579 if test $cf_result != no; then
580 AC_DEFINE_UNQUOTED(HAVE_${cf_tr_func})
584 dnl ---------------------------------------------------------------------------
585 dnl CF_CURSES_HEADER version: 2 updated: 2010/04/28 06:02:16
587 dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common
588 dnl variations of ncurses' installs.
590 dnl $1 = ncurses when looking for ncurses, or is empty
591 AC_DEFUN([CF_CURSES_HEADER],[
592 AC_CACHE_CHECK(if we have identified curses headers,cf_cv_ncurses_header,[
593 cf_cv_ncurses_header=none
594 for cf_header in ifelse($1,,,[ \
598 ncurses.h ifelse($1,,[ncurses/curses.h ncurses/ncurses.h])
600 AC_TRY_COMPILE([#include <${cf_header}>],
601 [initscr(); tgoto("?", 0,0)],
602 [cf_cv_ncurses_header=$cf_header; break],[])
606 if test "$cf_cv_ncurses_header" = none ; then
607 AC_MSG_ERROR(No curses header-files found)
610 # cheat, to get the right #define's for HAVE_NCURSES_H, etc.
611 AC_CHECK_HEADERS($cf_cv_ncurses_header)
613 dnl ---------------------------------------------------------------------------
614 dnl CF_CURSES_LIBS version: 31 updated: 2010/10/23 15:54:49
616 dnl Look for the curses libraries. Older curses implementations may require
617 dnl termcap/termlib to be linked as well. Call CF_CURSES_CPPFLAGS first.
618 AC_DEFUN([CF_CURSES_LIBS],[
620 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
621 AC_MSG_CHECKING(if we have identified curses libraries)
622 AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>],
623 [initscr(); tgoto("?", 0,0)],
626 AC_MSG_RESULT($cf_result)
628 if test "$cf_result" = no ; then
629 case $host_os in #(vi
631 AC_CHECK_LIB(mytinfo,tgoto,[CF_ADD_LIBS(-lmytinfo)])
634 AC_CHECK_LIB(cur_colr,initscr,[
635 CF_ADD_LIBS(-lcur_colr)
636 ac_cv_func_initscr=yes
638 AC_CHECK_LIB(Hcurses,initscr,[
639 # HP's header uses __HP_CURSES, but user claims _HP_CURSES.
640 CF_ADD_LIBS(-lHcurses)
641 CPPFLAGS="$CPPFLAGS -D__HP_CURSES -D_HP_CURSES"
642 ac_cv_func_initscr=yes
645 linux*) # Suse Linux does not follow /usr/lib convention
649 if test -d /usr/5lib ; then
650 CF_ADD_LIBDIR(/usr/5lib)
651 CF_ADD_LIBS(-lcurses -ltermcap)
653 ac_cv_func_initscr=yes
657 if test ".$ac_cv_func_initscr" != .yes ; then
662 if test ".${cf_cv_ncurses_version:-no}" != .no
664 cf_check_list="ncurses curses cursesX"
666 cf_check_list="cursesX curses ncurses"
669 # Check for library containing tgoto. Do this before curses library
670 # because it may be needed to link the test-case for initscr.
671 AC_CHECK_FUNC(tgoto,[cf_term_lib=predefined],[
672 for cf_term_lib in $cf_check_list termcap termlib unknown
674 AC_CHECK_LIB($cf_term_lib,tgoto,[break])
678 # Check for library containing initscr
679 test "$cf_term_lib" != predefined && test "$cf_term_lib" != unknown && LIBS="-l$cf_term_lib $cf_save_LIBS"
680 for cf_curs_lib in $cf_check_list xcurses jcurses pdcurses unknown
682 AC_CHECK_LIB($cf_curs_lib,initscr,[break])
684 test $cf_curs_lib = unknown && AC_MSG_ERROR(no curses library found)
686 LIBS="-l$cf_curs_lib $cf_save_LIBS"
687 if test "$cf_term_lib" = unknown ; then
688 AC_MSG_CHECKING(if we can link with $cf_curs_lib library)
689 AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>],
693 AC_MSG_RESULT($cf_result)
694 test $cf_result = no && AC_MSG_ERROR(Cannot link curses library)
695 elif test "$cf_curs_lib" = "$cf_term_lib" ; then
697 elif test "$cf_term_lib" != predefined ; then
698 AC_MSG_CHECKING(if we need both $cf_curs_lib and $cf_term_lib libraries)
699 AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>],
700 [initscr(); tgoto((char *)0, 0, 0);],
703 LIBS="-l$cf_curs_lib -l$cf_term_lib $cf_save_LIBS"
704 AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>],
709 AC_MSG_RESULT($cf_result)
715 dnl ---------------------------------------------------------------------------
716 dnl CF_CURSES_TERM_H version: 8 updated: 2010/10/23 15:54:49
718 dnl SVr4 curses should have term.h as well (where it puts the definitions of
719 dnl the low-level interface). This may not be true in old/broken implementations,
720 dnl as well as in misconfigured systems (e.g., gcc configured for Solaris 2.4
721 dnl running with Solaris 2.5.1).
722 AC_DEFUN([CF_CURSES_TERM_H],
724 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
726 AC_CACHE_CHECK(for term.h, cf_cv_term_header,[
728 # If we found <ncurses/curses.h>, look for <ncurses/term.h>, but always look
729 # for <term.h> if we do not find the variant.
731 `echo ${cf_cv_ncurses_header:-curses.h} | sed -e 's%/.*%/%'`term.h \
735 #include <${cf_cv_ncurses_header:-curses.h}>
736 #include <${cf_header}>],
738 [cf_cv_term_header=$cf_header
740 [cf_cv_term_header=no])
743 case $cf_cv_term_header in #(vi
745 # If curses is ncurses, some packagers still mess it up by trying to make
746 # us use GNU termcap. This handles the most common case.
747 for cf_header in ncurses/term.h ncursesw/term.h
750 #include <${cf_cv_ncurses_header:-curses.h}>
751 #ifdef NCURSES_VERSION
752 #include <${cf_header}>
757 [cf_cv_term_header=$cf_header
759 [cf_cv_term_header=no])
765 case $cf_cv_term_header in #(vi
767 AC_DEFINE(HAVE_TERM_H)
770 AC_DEFINE(HAVE_NCURSES_TERM_H)
773 AC_DEFINE(HAVE_NCURSESW_TERM_H)
777 dnl ---------------------------------------------------------------------------
778 dnl CF_CURSES_WACS_MAP version: 4 updated: 2010/10/23 15:54:49
779 dnl ------------------
780 dnl Check for likely values of wacs_map[]:
781 AC_DEFUN([CF_CURSES_WACS_MAP],
783 AC_CACHE_CHECK(for wide alternate character set array, cf_cv_curses_wacs_map,[
784 cf_cv_curses_wacs_map=unknown
785 for name in wacs_map _wacs_map __wacs_map _nc_wacs
788 #ifndef _XOPEN_SOURCE_EXTENDED
789 #define _XOPEN_SOURCE_EXTENDED
791 #include <${cf_cv_ncurses_header:-curses.h}>],
792 [$name['k'] = *WACS_PLUS],
793 [cf_cv_curses_wacs_map=$name
797 dnl ---------------------------------------------------------------------------
798 dnl CF_DIRNAME version: 4 updated: 2002/12/21 19:25:52
800 dnl "dirname" is not portable, so we fake it with a shell script.
801 AC_DEFUN([CF_DIRNAME],[$1=`echo $2 | sed -e 's%/[[^/]]*$%%'`])dnl
802 dnl ---------------------------------------------------------------------------
803 dnl CF_DISABLE_ECHO version: 11 updated: 2009/12/13 13:16:57
805 dnl You can always use "make -n" to see the actual options, but it's hard to
806 dnl pick out/analyze warning messages when the compile-line is long.
809 dnl ECHO_LT - symbol to control if libtool is verbose
810 dnl ECHO_LD - symbol to prefix "cc -o" lines
811 dnl RULE_CC - symbol to put before implicit "cc -c" lines (e.g., .c.o)
812 dnl SHOW_CC - symbol to put before explicit "cc -c" lines
813 dnl ECHO_CC - symbol to put before any "cc" line
815 AC_DEFUN([CF_DISABLE_ECHO],[
816 AC_MSG_CHECKING(if you want to see long compiling messages)
818 [ --disable-echo display "compiling" commands],
821 ECHO_LD='@echo linking [$]@;'
822 RULE_CC='@echo compiling [$]<'
823 SHOW_CC='@echo compiling [$]@'
832 AC_MSG_RESULT($enableval)
839 dnl ---------------------------------------------------------------------------
840 dnl CF_ENABLE_WARNINGS version: 4 updated: 2009/07/26 17:53:03
841 dnl ------------------
842 dnl Configure-option to enable gcc warnings
843 AC_DEFUN([CF_ENABLE_WARNINGS],[
844 if ( test "$GCC" = yes || test "$GXX" = yes )
846 AC_MSG_CHECKING(if you want to turn on gcc warnings)
847 CF_ARG_ENABLE(warnings,
848 [ --enable-warnings test: turn on gcc compiler warnings],
851 AC_MSG_RESULT($with_warnings)
852 if test "$with_warnings" = "yes"
859 dnl ---------------------------------------------------------------------------
860 dnl CF_FIND_LIBRARY version: 9 updated: 2008/03/23 14:48:54
862 dnl Look for a non-standard library, given parameters for AC_TRY_LINK. We
863 dnl prefer a standard location, and use -L options only if we do not find the
864 dnl library in the standard library location(s).
865 dnl $1 = library name
866 dnl $2 = library class, usually the same as library name
868 dnl $4 = code fragment to compile/link
869 dnl $5 = corresponding function-name
870 dnl $6 = flag, nonnull if failure should not cause an error-exit
872 dnl Sets the variable "$cf_libdir" as a side-effect, so we can see if we had
873 dnl to use a -L option.
874 AC_DEFUN([CF_FIND_LIBRARY],
876 eval 'cf_cv_have_lib_'$1'=no'
879 eval 'cf_cv_have_lib_'$1'=yes',[
881 AC_MSG_CHECKING(for $5 in -l$1)
883 AC_TRY_LINK([$3],[$4],
885 eval 'cf_cv_have_lib_'$1'=yes'
888 CF_LIBRARY_PATH(cf_search,$2)
889 for cf_libdir in $cf_search
891 AC_MSG_CHECKING(for -l$1 in $cf_libdir)
892 LIBS="-L$cf_libdir -l$1 $cf_save_LIBS"
893 AC_TRY_LINK([$3],[$4],
895 eval 'cf_cv_have_lib_'$1'=yes'
898 LIBS="$cf_save_LIBS"])
902 eval 'cf_found_library=[$]cf_cv_have_lib_'$1
904 if test $cf_found_library = no ; then
905 AC_MSG_ERROR(Cannot link $1 library)
909 dnl ---------------------------------------------------------------------------
910 dnl CF_FIND_LINKAGE version: 19 updated: 2010/05/29 16:31:02
912 dnl Find a library (specifically the linkage used in the code fragment),
913 dnl searching for it if it is not already in the library path.
914 dnl See also CF_ADD_SEARCHPATH.
916 dnl Parameters (4-on are optional):
917 dnl $1 = headers for library entrypoint
918 dnl $2 = code fragment for library entrypoint
919 dnl $3 = the library name without the "-l" option or ".so" suffix.
920 dnl $4 = action to perform if successful (default: update CPPFLAGS, etc)
921 dnl $5 = action to perform if not successful
922 dnl $6 = module name, if not the same as the library name
923 dnl $7 = extra libraries
925 dnl Sets these variables:
926 dnl $cf_cv_find_linkage_$3 - yes/no according to whether linkage is found
927 dnl $cf_cv_header_path_$3 - include-directory if needed
928 dnl $cf_cv_library_path_$3 - library-directory if needed
929 dnl $cf_cv_library_file_$3 - library-file if needed, e.g., -l$3
930 AC_DEFUN([CF_FIND_LINKAGE],[
932 # If the linkage is not already in the $CPPFLAGS/$LDFLAGS configuration, these
933 # will be set on completion of the AC_TRY_LINK below.
934 cf_cv_header_path_$3=
935 cf_cv_library_path_$3=
937 CF_MSG_LOG([Starting [FIND_LINKAGE]($3,$6)])
941 AC_TRY_LINK([$1],[$2],[
942 cf_cv_find_linkage_$3=yes
943 cf_cv_header_path_$3=/usr/include
944 cf_cv_library_path_$3=/usr/lib
947 LIBS="-l$3 $7 $cf_save_LIBS"
949 AC_TRY_LINK([$1],[$2],[
950 cf_cv_find_linkage_$3=yes
951 cf_cv_header_path_$3=/usr/include
952 cf_cv_library_path_$3=/usr/lib
953 cf_cv_library_file_$3="-l$3"
955 cf_cv_find_linkage_$3=no
958 CF_VERBOSE(find linkage for $3 library)
959 CF_MSG_LOG([Searching for headers in [FIND_LINKAGE]($3,$6)])
961 cf_save_CPPFLAGS="$CPPFLAGS"
962 cf_test_CPPFLAGS="$CPPFLAGS"
964 CF_HEADER_PATH(cf_search,ifelse([$6],,[$3],[$6]))
965 for cf_cv_header_path_$3 in $cf_search
967 if test -d $cf_cv_header_path_$3 ; then
968 CF_VERBOSE(... testing $cf_cv_header_path_$3)
969 CPPFLAGS="$cf_save_CPPFLAGS -I$cf_cv_header_path_$3"
970 AC_TRY_COMPILE([$1],[$2],[
971 CF_VERBOSE(... found $3 headers in $cf_cv_header_path_$3)
972 cf_cv_find_linkage_$3=maybe
973 cf_test_CPPFLAGS="$CPPFLAGS"
975 CPPFLAGS="$cf_save_CPPFLAGS"
980 if test "$cf_cv_find_linkage_$3" = maybe ; then
982 CF_MSG_LOG([Searching for $3 library in [FIND_LINKAGE]($3,$6)])
985 cf_save_LDFLAGS="$LDFLAGS"
988 CPPFLAGS="$cf_test_CPPFLAGS"
989 LIBS="-l$3 $7 $cf_save_LIBS"
990 AC_TRY_LINK([$1],[$2],[
991 CF_VERBOSE(... found $3 library in system)
992 cf_cv_find_linkage_$3=yes])
993 CPPFLAGS="$cf_save_CPPFLAGS"
997 if test "$cf_cv_find_linkage_$3" != yes ; then
998 CF_LIBRARY_PATH(cf_search,$3)
999 for cf_cv_library_path_$3 in $cf_search
1001 if test -d $cf_cv_library_path_$3 ; then
1002 CF_VERBOSE(... testing $cf_cv_library_path_$3)
1003 CPPFLAGS="$cf_test_CPPFLAGS"
1004 LIBS="-l$3 $7 $cf_save_LIBS"
1005 LDFLAGS="$cf_save_LDFLAGS -L$cf_cv_library_path_$3"
1006 AC_TRY_LINK([$1],[$2],[
1007 CF_VERBOSE(... found $3 library in $cf_cv_library_path_$3)
1008 cf_cv_find_linkage_$3=yes
1009 cf_cv_library_file_$3="-l$3"
1011 CPPFLAGS="$cf_save_CPPFLAGS"
1012 LIBS="$cf_save_LIBS"
1013 LDFLAGS="$cf_save_LDFLAGS"
1017 CPPFLAGS="$cf_save_CPPFLAGS"
1018 LDFLAGS="$cf_save_LDFLAGS"
1022 cf_cv_find_linkage_$3=no
1027 LIBS="$cf_save_LIBS"
1029 if test "$cf_cv_find_linkage_$3" = yes ; then
1031 CF_ADD_INCDIR($cf_cv_header_path_$3)
1032 CF_ADD_LIBDIR($cf_cv_library_path_$3)
1036 ifelse([$5],,AC_MSG_WARN(Cannot find $3 library),[$5])
1039 dnl ---------------------------------------------------------------------------
1040 dnl CF_FUNC_CURSES_VERSION version: 5 updated: 2010/10/23 15:54:49
1041 dnl ----------------------
1042 dnl Solaris has a data item 'curses_version', which confuses AC_CHECK_FUNCS.
1043 dnl It's a character string "SVR4", not documented.
1044 AC_DEFUN([CF_FUNC_CURSES_VERSION],
1046 AC_CACHE_CHECK(for function curses_version, cf_cv_func_curses_version,[
1048 #include <${cf_cv_ncurses_header:-curses.h}>
1052 sprintf(temp, "%s\n", curses_version());
1053 ${cf_cv_main_return:-return}(0);
1055 ,[cf_cv_func_curses_version=yes]
1056 ,[cf_cv_func_curses_version=no]
1057 ,[cf_cv_func_curses_version=unknown])
1059 test "$cf_cv_func_curses_version" = yes && AC_DEFINE(HAVE_CURSES_VERSION)
1061 dnl ---------------------------------------------------------------------------
1062 dnl CF_GCC_ATTRIBUTES version: 14 updated: 2010/10/23 15:52:32
1063 dnl -----------------
1064 dnl Test for availability of useful gcc __attribute__ directives to quiet
1065 dnl compiler warnings. Though useful, not all are supported -- and contrary
1066 dnl to documentation, unrecognized directives cause older compilers to barf.
1067 AC_DEFUN([CF_GCC_ATTRIBUTES],
1069 if test "$GCC" = yes
1071 cat > conftest.i <<EOF
1073 #define GCC_PRINTF 0
1078 #ifndef GCC_NORETURN
1079 #define GCC_NORETURN /* nothing */
1082 #define GCC_UNUSED /* nothing */
1085 if test "$GCC" = yes
1087 AC_CHECKING([for $CC __attribute__ directives])
1088 cat > conftest.$ac_ext <<EOF
1089 #line __oline__ "${as_me:-configure}"
1090 #include "confdefs.h"
1091 #include "conftest.h"
1092 #include "conftest.i"
1094 #define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
1096 #define GCC_PRINTFLIKE(fmt,var) /*nothing*/
1099 #define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var)))
1101 #define GCC_SCANFLIKE(fmt,var) /*nothing*/
1103 extern void wow(char *,...) GCC_SCANFLIKE(1,2);
1104 extern void oops(char *,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN;
1105 extern void foo(void) GCC_NORETURN;
1106 int main(int argc GCC_UNUSED, char *argv[[]] GCC_UNUSED) { return 0; }
1108 cf_printf_attribute=no
1109 cf_scanf_attribute=no
1110 for cf_attribute in scanf printf unused noreturn
1112 CF_UPPER(cf_ATTRIBUTE,$cf_attribute)
1113 cf_directive="__attribute__(($cf_attribute))"
1114 echo "checking for $CC $cf_directive" 1>&AC_FD_CC
1116 case $cf_attribute in #(vi
1118 cf_printf_attribute=yes
1119 cat >conftest.h <<EOF
1120 #define GCC_$cf_ATTRIBUTE 1
1124 cf_scanf_attribute=yes
1125 cat >conftest.h <<EOF
1126 #define GCC_$cf_ATTRIBUTE 1
1130 cat >conftest.h <<EOF
1131 #define GCC_$cf_ATTRIBUTE $cf_directive
1136 if AC_TRY_EVAL(ac_compile); then
1137 test -n "$verbose" && AC_MSG_RESULT(... $cf_attribute)
1138 cat conftest.h >>confdefs.h
1139 case $cf_attribute in #(vi
1141 if test "$cf_printf_attribute" = no ; then
1142 cat >>confdefs.h <<EOF
1143 #define GCC_PRINTFLIKE(fmt,var) /* nothing */
1146 cat >>confdefs.h <<EOF
1147 #define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
1152 if test "$cf_scanf_attribute" = no ; then
1153 cat >>confdefs.h <<EOF
1154 #define GCC_SCANFLIKE(fmt,var) /* nothing */
1157 cat >>confdefs.h <<EOF
1158 #define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var)))
1166 fgrep define conftest.i >>confdefs.h
1171 dnl ---------------------------------------------------------------------------
1172 dnl CF_GCC_VERSION version: 5 updated: 2010/04/24 11:02:31
1174 dnl Find version of gcc
1175 AC_DEFUN([CF_GCC_VERSION],[
1176 AC_REQUIRE([AC_PROG_CC])
1178 if test "$GCC" = yes ; then
1179 AC_MSG_CHECKING(version of $CC)
1180 GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`"
1181 test -z "$GCC_VERSION" && GCC_VERSION=unknown
1182 AC_MSG_RESULT($GCC_VERSION)
1185 dnl ---------------------------------------------------------------------------
1186 dnl CF_GCC_WARNINGS version: 27 updated: 2010/10/23 15:52:32
1188 dnl Check if the compiler supports useful warning options. There's a few that
1189 dnl we don't use, simply because they're too noisy:
1191 dnl -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x)
1192 dnl -Wredundant-decls (system headers make this too noisy)
1193 dnl -Wtraditional (combines too many unrelated messages, only a few useful)
1194 dnl -Wwrite-strings (too noisy, but should review occasionally). This
1195 dnl is enabled for ncurses using "--enable-const".
1199 dnl $1 is an optional list of gcc warning flags that a particular
1200 dnl application might want to use, e.g., "no-unused" for
1203 dnl If $with_ext_const is "yes", add a check for -Wwrite-strings
1205 AC_DEFUN([CF_GCC_WARNINGS],
1207 AC_REQUIRE([CF_GCC_VERSION])
1208 CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS)
1210 cat > conftest.$ac_ext <<EOF
1211 #line __oline__ "${as_me:-configure}"
1212 int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; }
1215 if test "$INTEL_COMPILER" = yes
1217 # The "-wdXXX" options suppress warnings:
1218 # remark #1419: external declaration in primary source file
1219 # remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
1220 # remark #1684: conversion from pointer to same-sized integral type (potential portability problem)
1221 # remark #193: zero used for undefined preprocessing identifier
1222 # remark #593: variable "curs_sb_left_arrow" was set but never used
1223 # remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits
1224 # remark #869: parameter "tw" was never referenced
1225 # remark #981: operands are evaluated in unspecified order
1226 # warning #279: controlling expression is constant
1228 AC_CHECKING([for $CC warning options])
1229 cf_save_CFLAGS="$CFLAGS"
1230 EXTRA_CFLAGS="-Wall"
1242 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
1243 if AC_TRY_EVAL(ac_compile); then
1244 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
1245 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
1248 CFLAGS="$cf_save_CFLAGS"
1250 elif test "$GCC" = yes
1252 AC_CHECKING([for $CC warning options])
1253 cf_save_CFLAGS="$CFLAGS"
1256 test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings"
1257 for cf_opt in W Wall \
1258 Wbad-function-cast \
1262 Wmissing-declarations \
1263 Wmissing-prototypes \
1267 Wstrict-prototypes \
1268 Wundef $cf_warn_CONST $1
1270 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
1271 if AC_TRY_EVAL(ac_compile); then
1272 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
1273 case $cf_opt in #(vi
1275 CPPFLAGS="$CPPFLAGS -DXTSTRINGDEFINES"
1278 case $GCC_VERSION in
1280 CF_VERBOSE(feature is broken in gcc $GCC_VERSION)
1285 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
1288 CFLAGS="$cf_save_CFLAGS"
1292 AC_SUBST(EXTRA_CFLAGS)
1294 dnl ---------------------------------------------------------------------------
1295 dnl CF_GNU_SOURCE version: 6 updated: 2005/07/09 13:23:07
1297 dnl Check if we must define _GNU_SOURCE to get a reasonable value for
1298 dnl _XOPEN_SOURCE, upon which many POSIX definitions depend. This is a defect
1299 dnl (or misfeature) of glibc2, which breaks portability of many applications,
1300 dnl since it is interwoven with GNU extensions.
1302 dnl Well, yes we could work around it...
1303 AC_DEFUN([CF_GNU_SOURCE],
1305 AC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[
1306 AC_TRY_COMPILE([#include <sys/types.h>],[
1307 #ifndef _XOPEN_SOURCE
1310 [cf_cv_gnu_source=no],
1311 [cf_save="$CPPFLAGS"
1312 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
1313 AC_TRY_COMPILE([#include <sys/types.h>],[
1314 #ifdef _XOPEN_SOURCE
1317 [cf_cv_gnu_source=no],
1318 [cf_cv_gnu_source=yes])
1322 test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
1324 dnl ---------------------------------------------------------------------------
1325 dnl CF_HEADER_PATH version: 12 updated: 2010/05/05 05:22:40
1327 dnl Construct a search-list of directories for a nonstandard header-file
1330 dnl $1 = the variable to return as result
1331 dnl $2 = the package name
1332 AC_DEFUN([CF_HEADER_PATH],
1336 # collect the current set of include-directories from compiler flags
1337 cf_header_path_list=""
1338 if test -n "${CFLAGS}${CPPFLAGS}" ; then
1339 for cf_header_path in $CPPFLAGS $CFLAGS
1341 case $cf_header_path in #(vi
1343 cf_header_path=`echo ".$cf_header_path" |sed -e 's/^...//' -e 's,/include$,,'`
1344 CF_ADD_SUBDIR_PATH($1,$2,include,$cf_header_path,NONE)
1345 cf_header_path_list="$cf_header_path_list [$]$1"
1351 # add the variations for the package we are looking for
1352 CF_SUBDIR_PATH($1,$2,include)
1354 test "$includedir" != NONE && \
1355 test "$includedir" != "/usr/include" && \
1356 test -d "$includedir" && {
1357 test -d $includedir && $1="[$]$1 $includedir"
1358 test -d $includedir/$2 && $1="[$]$1 $includedir/$2"
1361 test "$oldincludedir" != NONE && \
1362 test "$oldincludedir" != "/usr/include" && \
1363 test -d "$oldincludedir" && {
1364 test -d $oldincludedir && $1="[$]$1 $oldincludedir"
1365 test -d $oldincludedir/$2 && $1="[$]$1 $oldincludedir/$2"
1368 $1="[$]$1 $cf_header_path_list"
1370 dnl ---------------------------------------------------------------------------
1371 dnl CF_INHERIT_SCRIPT version: 2 updated: 2003/03/01 23:50:42
1372 dnl -----------------
1373 dnl If we do not have a given script, look for it in the parent directory.
1374 AC_DEFUN([CF_INHERIT_SCRIPT],
1376 test -f $1 || ( test -f ../$1 && cp ../$1 ./ )
1378 dnl ---------------------------------------------------------------------------
1379 dnl CF_INTEL_COMPILER version: 4 updated: 2010/05/26 05:38:42
1380 dnl -----------------
1381 dnl Check if the given compiler is really the Intel compiler for Linux. It
1382 dnl tries to imitate gcc, but does not return an error when it finds a mismatch
1383 dnl between prototypes, e.g., as exercised by CF_MISSING_CHECK.
1385 dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to
1386 dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from
1387 dnl the wrappers for gcc and g++ warnings.
1389 dnl $1 = GCC (default) or GXX
1390 dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS
1391 dnl $3 = CFLAGS (default) or CXXFLAGS
1392 AC_DEFUN([CF_INTEL_COMPILER],[
1393 ifelse([$2],,INTEL_COMPILER,[$2])=no
1395 if test "$ifelse([$1],,[$1],GCC)" = yes ; then
1398 AC_MSG_CHECKING(if this is really Intel ifelse([$1],GXX,C++,C) compiler)
1399 cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])"
1400 ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -no-gcc"
1402 #ifdef __INTEL_COMPILER
1406 ],[ifelse([$2],,INTEL_COMPILER,[$2])=yes
1407 cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc"
1409 ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS"
1410 AC_MSG_RESULT($ifelse([$2],,INTEL_COMPILER,[$2]))
1415 dnl ---------------------------------------------------------------------------
1416 dnl CF_LIBRARY_PATH version: 9 updated: 2010/03/28 12:52:50
1418 dnl Construct a search-list of directories for a nonstandard library-file
1421 dnl $1 = the variable to return as result
1422 dnl $2 = the package name
1423 AC_DEFUN([CF_LIBRARY_PATH],
1426 cf_library_path_list=""
1427 if test -n "${LDFLAGS}${LIBS}" ; then
1428 for cf_library_path in $LDFLAGS $LIBS
1430 case $cf_library_path in #(vi
1432 cf_library_path=`echo ".$cf_library_path" |sed -e 's/^...//' -e 's,/lib$,,'`
1433 CF_ADD_SUBDIR_PATH($1,$2,lib,$cf_library_path,NONE)
1434 cf_library_path_list="$cf_library_path_list [$]$1"
1440 CF_SUBDIR_PATH($1,$2,lib)
1442 $1="$cf_library_path_list [$]$1"
1444 dnl ---------------------------------------------------------------------------
1445 dnl CF_MAKE_TAGS version: 6 updated: 2010/10/23 15:52:32
1447 dnl Generate tags/TAGS targets for makefiles. Do not generate TAGS if we have
1448 dnl a monocase filesystem.
1449 AC_DEFUN([CF_MAKE_TAGS],[
1450 AC_REQUIRE([CF_MIXEDCASE_FILENAMES])
1452 AC_CHECK_PROGS(CTAGS, exctags ctags)
1453 AC_CHECK_PROGS(ETAGS, exetags etags)
1455 AC_CHECK_PROG(MAKE_LOWER_TAGS, ${CTAGS:-ctags}, yes, no)
1457 if test "$cf_cv_mixedcase" = yes ; then
1458 AC_CHECK_PROG(MAKE_UPPER_TAGS, ${ETAGS:-etags}, yes, no)
1463 if test "$MAKE_UPPER_TAGS" = yes ; then
1469 if test "$MAKE_LOWER_TAGS" = yes ; then
1478 AC_SUBST(MAKE_UPPER_TAGS)
1479 AC_SUBST(MAKE_LOWER_TAGS)
1481 dnl ---------------------------------------------------------------------------
1482 dnl CF_MATH_LIB version: 8 updated: 2010/05/29 16:31:02
1484 dnl Checks for libraries. At least one UNIX system, Apple Macintosh
1485 dnl Rhapsody 5.5, does not have -lm. We cannot use the simpler
1486 dnl AC_CHECK_LIB(m,sin), because that fails for C++.
1487 AC_DEFUN([CF_MATH_LIB],
1489 AC_CACHE_CHECK(if -lm needed for math functions,
1495 [double x = rand(); printf("result = %g\n", ]ifelse([$2],,sin(x),$2)[)],
1496 [cf_cv_need_libm=no],
1497 [cf_cv_need_libm=yes])])
1498 if test "$cf_cv_need_libm" = yes
1505 dnl ---------------------------------------------------------------------------
1506 dnl CF_MIN_GETCCHAR version: 3 updated: 2010/10/23 15:54:49
1509 dnl Check whether getcchar's return value counts the trailing null in a wchar_t
1510 dnl string, or not. X/Open says it does, but Tru64 and Solaris do not do this.
1511 AC_DEFUN([CF_MIN_GETCCHAR],[
1512 AC_CACHE_CHECK(if getcchar counts trailing null,cf_cv_min_getcchar,[
1516 #include <${cf_cv_ncurses_header:-curses.h}>
1524 setcchar(temp, data, 0, 0, (void *)0);
1525 count = getcchar(temp, (wchar_t *)0, (attr_t *)0, (short *)0, (void *)0);
1526 ${cf_cv_main_return:-return}(count != 0);
1528 [cf_cv_min_getcchar=no],
1529 [cf_cv_min_getcchar=yes],
1530 [cf_cv_min_getcchar=yes])
1532 if test "$cf_cv_min_getcchar" = yes ; then
1533 AC_DEFINE(MIN_GETCCHAR,1)
1536 dnl ---------------------------------------------------------------------------
1537 dnl CF_MIXEDCASE_FILENAMES version: 3 updated: 2003/09/20 17:07:55
1538 dnl ----------------------
1539 dnl Check if the file-system supports mixed-case filenames. If we're able to
1540 dnl create a lowercase name and see it as uppercase, it doesn't support that.
1541 AC_DEFUN([CF_MIXEDCASE_FILENAMES],
1543 AC_CACHE_CHECK(if filesystem supports mixed-case filenames,cf_cv_mixedcase,[
1544 if test "$cross_compiling" = yes ; then
1545 case $target_alias in #(vi
1546 *-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-mingw32*|*-uwin*) #(vi
1554 rm -f conftest CONFTEST
1556 if test -f CONFTEST ; then
1561 rm -f conftest CONFTEST
1564 test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES)
1566 dnl ---------------------------------------------------------------------------
1567 dnl CF_MSG_LOG version: 5 updated: 2010/10/23 15:52:32
1569 dnl Write a debug message to config.log, along with the line number in the
1570 dnl configure script.
1571 AC_DEFUN([CF_MSG_LOG],[
1572 echo "${as_me:-configure}:__oline__: testing $* ..." 1>&AC_FD_CC
1574 dnl ---------------------------------------------------------------------------
1575 dnl CF_NCURSES_CC_CHECK version: 4 updated: 2007/07/29 10:39:05
1576 dnl -------------------
1577 dnl Check if we can compile with ncurses' header file
1578 dnl $1 is the cache variable to set
1579 dnl $2 is the header-file to include
1580 dnl $3 is the root name (ncurses or ncursesw)
1581 AC_DEFUN([CF_NCURSES_CC_CHECK],[
1583 ]ifelse($3,ncursesw,[
1584 #define _XOPEN_SOURCE_EXTENDED
1585 #undef HAVE_LIBUTF8_H /* in case we used CF_UTF8_LIB */
1586 #define HAVE_LIBUTF8_H /* to force ncurses' header file to use cchar_t */
1589 #ifdef NCURSES_VERSION
1590 ]ifelse($3,ncursesw,[
1595 printf("%s\n", NCURSES_VERSION);
1607 dnl ---------------------------------------------------------------------------
1608 dnl CF_NCURSES_CONFIG version: 8 updated: 2010/07/08 05:17:30
1609 dnl -----------------
1610 dnl Tie together the configure-script macros for ncurses.
1611 dnl Prefer the "-config" script from ncurses 6.x, to simplify analysis.
1612 dnl Allow that to be overridden using the $NCURSES_CONFIG environment variable.
1614 dnl $1 is the root library name (default: "ncurses")
1615 AC_DEFUN([CF_NCURSES_CONFIG],
1617 cf_ncuconfig_root=ifelse($1,,ncurses,$1)
1619 echo "Looking for ${cf_ncuconfig_root}-config"
1620 AC_PATH_PROGS(NCURSES_CONFIG,${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config,none)
1622 if test "$NCURSES_CONFIG" != none ; then
1624 CPPFLAGS="$CPPFLAGS `$NCURSES_CONFIG --cflags`"
1625 CF_ADD_LIBS(`$NCURSES_CONFIG --libs`)
1627 # even with config script, some packages use no-override for curses.h
1628 CF_CURSES_HEADER(ifelse($1,,ncurses,$1))
1630 dnl like CF_NCURSES_CPPFLAGS
1633 dnl like CF_NCURSES_LIBS
1634 CF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_ncuconfig_root)
1635 AC_DEFINE_UNQUOTED($cf_nculib_ROOT)
1637 dnl like CF_NCURSES_VERSION
1638 cf_cv_ncurses_version=`$NCURSES_CONFIG --version`
1642 CF_NCURSES_CPPFLAGS(ifelse($1,,ncurses,$1))
1643 CF_NCURSES_LIBS(ifelse($1,,ncurses,$1))
1647 dnl ---------------------------------------------------------------------------
1648 dnl CF_NCURSES_CPPFLAGS version: 19 updated: 2007/07/29 13:35:20
1649 dnl -------------------
1650 dnl Look for the SVr4 curses clone 'ncurses' in the standard places, adjusting
1651 dnl the CPPFLAGS variable so we can include its header.
1653 dnl The header files may be installed as either curses.h, or ncurses.h (would
1654 dnl be obsolete, except that some packagers prefer this name to distinguish it
1655 dnl from a "native" curses implementation). If not installed for overwrite,
1656 dnl the curses.h file would be in an ncurses subdirectory (e.g.,
1657 dnl /usr/include/ncurses), but someone may have installed overwriting the
1658 dnl vendor's curses. Only very old versions (pre-1.9.2d, the first autoconf'd
1659 dnl version) of ncurses don't define either __NCURSES_H or NCURSES_VERSION in
1662 dnl If the installer has set $CFLAGS or $CPPFLAGS so that the ncurses header
1663 dnl is already in the include-path, don't even bother with this, since we cannot
1664 dnl easily determine which file it is. In this case, it has to be <curses.h>.
1666 dnl The optional parameter gives the root name of the library, in case it is
1667 dnl not installed as the default curses library. That is how the
1668 dnl wide-character version of ncurses is installed.
1669 AC_DEFUN([CF_NCURSES_CPPFLAGS],
1670 [AC_REQUIRE([CF_WITH_CURSES_DIR])
1672 AC_PROVIDE([CF_CURSES_CPPFLAGS])dnl
1673 cf_ncuhdr_root=ifelse($1,,ncurses,$1)
1675 test -n "$cf_cv_curses_dir" && \
1676 test "$cf_cv_curses_dir" != "no" && { \
1677 CF_ADD_INCDIR($cf_cv_curses_dir/include $cf_cv_curses_dir/include/$cf_ncuhdr_root)
1680 AC_CACHE_CHECK(for $cf_ncuhdr_root header in include-path, cf_cv_ncurses_h,[
1681 cf_header_list="$cf_ncuhdr_root/curses.h $cf_ncuhdr_root/ncurses.h"
1682 ( test "$cf_ncuhdr_root" = ncurses || test "$cf_ncuhdr_root" = ncursesw ) && cf_header_list="$cf_header_list curses.h ncurses.h"
1683 for cf_header in $cf_header_list
1685 CF_NCURSES_CC_CHECK(cf_cv_ncurses_h,$cf_header,$1)
1686 test "$cf_cv_ncurses_h" != no && break
1693 # some applications need this, but should check for NCURSES_VERSION
1698 dnl ---------------------------------------------------------------------------
1699 dnl CF_NCURSES_EXT_FUNCS version: 3 updated: 2010/11/13 19:43:23
1700 dnl --------------------
1701 dnl Since 2007/11/17, ncurses has defined NCURSES_EXT_FUNCS; earlier versions
1702 dnl may provide these functions. Define the symbol if it is not defined, and
1704 AC_DEFUN([CF_NCURSES_EXT_FUNCS],
1706 AC_CACHE_CHECK(for ncurses extended functions,cf_cv_ncurses_ext_funcs,[
1708 #include <${cf_cv_ncurses_header:-curses.h}>],
1710 int x = NCURSES_EXT_FUNCS
1711 ],[cf_cv_ncurses_ext_funcs=defined],[
1713 #include <${cf_cv_ncurses_header:-curses.h}>],
1715 (void) assume_default_colors (0, 0);
1716 (void) curses_version ();
1717 (void) define_key (0, 0);
1718 (void) is_term_resized (0, 0);
1719 (void) key_defined (0);
1720 (void) keybound (0, 0);
1721 (void) keyok (0, 0);
1722 (void) resize_term (0, 0);
1723 (void) resizeterm (0, 0);
1724 (void) use_default_colors ();
1725 (void) use_extended_names (0);
1726 (void) wresize (0, 0, 0);],
1727 [cf_cv_ncurses_ext_funcs=yes],
1728 [cf_cv_ncurses_ext_funcs=no])
1731 test "$cf_cv_ncurses_ext_funcs" = yes && AC_DEFINE(NCURSES_EXT_FUNCS)
1733 dnl ---------------------------------------------------------------------------
1734 dnl CF_NCURSES_HEADER version: 2 updated: 2008/03/23 14:48:54
1735 dnl -----------------
1736 dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common
1737 dnl variations of ncurses' installs.
1739 dnl See also CF_CURSES_HEADER, which sets the same cache variable.
1740 AC_DEFUN([CF_NCURSES_HEADER],[
1742 if test "$cf_cv_ncurses_h" != no ; then
1743 cf_cv_ncurses_header=$cf_cv_ncurses_h
1746 AC_CACHE_CHECK(for $cf_ncuhdr_root include-path, cf_cv_ncurses_h2,[
1747 test -n "$verbose" && echo
1748 CF_HEADER_PATH(cf_search,$cf_ncuhdr_root)
1749 test -n "$verbose" && echo search path $cf_search
1750 cf_save2_CPPFLAGS="$CPPFLAGS"
1751 for cf_incdir in $cf_search
1753 CF_ADD_INCDIR($cf_incdir)
1758 CF_NCURSES_CC_CHECK(cf_cv_ncurses_h2,$cf_header,$1)
1759 if test "$cf_cv_ncurses_h2" != no ; then
1760 cf_cv_ncurses_h2=$cf_incdir/$cf_header
1761 test -n "$verbose" && echo $ac_n " ... found $ac_c" 1>&AC_FD_MSG
1764 test -n "$verbose" && echo " ... tested $cf_incdir/$cf_header" 1>&AC_FD_MSG
1766 CPPFLAGS="$cf_save2_CPPFLAGS"
1767 test "$cf_cv_ncurses_h2" != no && break
1769 test "$cf_cv_ncurses_h2" = no && AC_MSG_ERROR(not found)
1772 CF_DIRNAME(cf_1st_incdir,$cf_cv_ncurses_h2)
1773 cf_cv_ncurses_header=`basename $cf_cv_ncurses_h2`
1774 if test `basename $cf_1st_incdir` = $cf_ncuhdr_root ; then
1775 cf_cv_ncurses_header=$cf_ncuhdr_root/$cf_cv_ncurses_header
1777 CF_ADD_INCDIR($cf_1st_incdir)
1781 # Set definitions to allow ifdef'ing for ncurses.h
1783 case $cf_cv_ncurses_header in # (vi
1785 AC_DEFINE(HAVE_NCURSES_H)
1789 case $cf_cv_ncurses_header in # (vi
1790 ncurses/curses.h|ncurses/ncurses.h)
1791 AC_DEFINE(HAVE_NCURSES_NCURSES_H)
1793 ncursesw/curses.h|ncursesw/ncurses.h)
1794 AC_DEFINE(HAVE_NCURSESW_NCURSES_H)
1799 dnl ---------------------------------------------------------------------------
1800 dnl CF_NCURSES_LIBS version: 15 updated: 2010/10/23 15:54:49
1802 dnl Look for the ncurses library. This is a little complicated on Linux,
1803 dnl because it may be linked with the gpm (general purpose mouse) library.
1804 dnl Some distributions have gpm linked with (bsd) curses, which makes it
1805 dnl unusable with ncurses. However, we don't want to link with gpm unless
1806 dnl ncurses has a dependency, since gpm is normally set up as a shared library,
1807 dnl and the linker will record a dependency.
1809 dnl The optional parameter gives the root name of the library, in case it is
1810 dnl not installed as the default curses library. That is how the
1811 dnl wide-character version of ncurses is installed.
1812 AC_DEFUN([CF_NCURSES_LIBS],
1813 [AC_REQUIRE([CF_NCURSES_CPPFLAGS])
1815 cf_nculib_root=ifelse($1,,ncurses,$1)
1816 # This works, except for the special case where we find gpm, but
1817 # ncurses is in a nonstandard location via $LIBS, and we really want
1820 cf_ncurses_SAVE="$LIBS"
1821 AC_CHECK_LIB(gpm,Gpm_Open,
1822 [AC_CHECK_LIB(gpm,initscr,
1823 [LIBS="$cf_ncurses_SAVE"],
1824 [cf_ncurses_LIBS="-lgpm"])])
1826 case $host_os in #(vi
1828 # This is only necessary if you are linking against an obsolete
1829 # version of ncurses (but it should do no harm, since it's static).
1830 if test "$cf_nculib_root" = ncurses ; then
1831 AC_CHECK_LIB(mytinfo,tgoto,[cf_ncurses_LIBS="-lmytinfo $cf_ncurses_LIBS"])
1836 CF_ADD_LIBS($cf_ncurses_LIBS)
1838 if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" )
1840 CF_ADD_LIBDIR($cf_cv_curses_dir/lib)
1841 CF_ADD_LIBS(-l$cf_nculib_root)
1843 CF_FIND_LIBRARY($cf_nculib_root,$cf_nculib_root,
1844 [#include <${cf_cv_ncurses_header:-curses.h}>],
1849 if test -n "$cf_ncurses_LIBS" ; then
1850 AC_MSG_CHECKING(if we can link $cf_nculib_root without $cf_ncurses_LIBS)
1851 cf_ncurses_SAVE="$LIBS"
1852 for p in $cf_ncurses_LIBS ; do
1853 q=`echo $LIBS | sed -e "s%$p %%" -e "s%$p$%%"`
1854 if test "$q" != "$LIBS" ; then
1858 AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>],
1859 [initscr(); mousemask(0,0); tgoto((char *)0, 0, 0);],
1860 [AC_MSG_RESULT(yes)],
1862 LIBS="$cf_ncurses_SAVE"])
1865 CF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_nculib_root)
1866 AC_DEFINE_UNQUOTED($cf_nculib_ROOT)
1868 dnl ---------------------------------------------------------------------------
1869 dnl CF_NCURSES_VERSION version: 13 updated: 2010/10/23 15:54:49
1870 dnl ------------------
1871 dnl Check for the version of ncurses, to aid in reporting bugs, etc.
1872 dnl Call CF_CURSES_CPPFLAGS first, or CF_NCURSES_CPPFLAGS. We don't use
1873 dnl AC_REQUIRE since that does not work with the shell's if/then/else/fi.
1874 AC_DEFUN([CF_NCURSES_VERSION],
1876 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
1877 AC_CACHE_CHECK(for ncurses version, cf_cv_ncurses_version,[
1878 cf_cv_ncurses_version=no
1882 #include <${cf_cv_ncurses_header:-curses.h}>
1886 FILE *fp = fopen("$cf_tempfile", "w");
1887 #ifdef NCURSES_VERSION
1888 # ifdef NCURSES_VERSION_PATCH
1889 fprintf(fp, "%s.%d\n", NCURSES_VERSION, NCURSES_VERSION_PATCH);
1891 fprintf(fp, "%s\n", NCURSES_VERSION);
1895 fprintf(fp, "old\n");
1900 ${cf_cv_main_return:-return}(0);
1902 cf_cv_ncurses_version=`cat $cf_tempfile`],,[
1904 # This will not work if the preprocessor splits the line after the
1905 # Autoconf token. The 'unproto' program does that.
1906 cat > conftest.$ac_ext <<EOF
1907 #include <${cf_cv_ncurses_header:-curses.h}>
1909 #ifdef NCURSES_VERSION
1910 Autoconf NCURSES_VERSION
1918 cf_try="$ac_cpp conftest.$ac_ext 2>&AC_FD_CC | grep '^Autoconf ' >conftest.out"
1920 if test -f conftest.out ; then
1921 cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[[^"]]*"%%' -e 's%".*%%'`
1922 test -n "$cf_out" && cf_cv_ncurses_version="$cf_out"
1928 test "$cf_cv_ncurses_version" = no || AC_DEFINE(NCURSES)
1930 dnl ---------------------------------------------------------------------------
1931 dnl CF_NCURSES_WRAP_PREFIX version: 1 updated: 2009/03/28 16:08:10
1932 dnl ----------------------
1933 dnl Check for ncurses "wrap-prefix" used for public variables which have been
1934 dnl wrapped with a function to help with concurrency control.
1935 AC_DEFUN([CF_NCURSES_WRAP_PREFIX],
1937 AC_MSG_CHECKING(for ncurses wrap-prefix)
1938 AC_ARG_WITH(ncurses-wrap-prefix,
1939 [ --with-ncurses-wrap-prefix naming-prefix for ncurses wrapped-variables],
1940 [NCURSES_WRAP_PREFIX=$withval],
1941 [NCURSES_WRAP_PREFIX=_nc_])
1942 AC_MSG_RESULT($NCURSES_WRAP_PREFIX)
1944 AC_SUBST(NCURSES_WRAP_PREFIX)
1946 dnl ---------------------------------------------------------------------------
1947 dnl CF_PATH_SYNTAX version: 13 updated: 2010/05/26 05:38:42
1949 dnl Check the argument to see that it looks like a pathname. Rewrite it if it
1950 dnl begins with one of the prefix/exec_prefix variables, and then again if the
1951 dnl result begins with 'NONE'. This is necessary to work around autoconf's
1952 dnl delayed evaluation of those symbols.
1953 AC_DEFUN([CF_PATH_SYNTAX],[
1954 if test "x$prefix" != xNONE; then
1955 cf_path_syntax="$prefix"
1957 cf_path_syntax="$ac_default_prefix"
1960 case ".[$]$1" in #(vi
1961 .\[$]\(*\)*|.\'*\'*) #(vi
1965 .[[a-zA-Z]]:[[\\/]]*) #(vi OS/2 EMX
1967 .\[$]{*prefix}*) #(vi
1969 case ".[$]$1" in #(vi
1971 $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%`
1976 $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%`
1979 ifelse([$2],,[AC_MSG_ERROR([expected a pathname, not \"[$]$1\"])],$2)
1983 dnl ---------------------------------------------------------------------------
1984 dnl CF_PDCURSES_X11 version: 10 updated: 2010/06/20 09:24:28
1986 dnl Configure for PDCurses' X11 library
1987 AC_DEFUN([CF_PDCURSES_X11],[
1988 AC_REQUIRE([CF_X_ATHENA])
1990 AC_PATH_PROGS(XCURSES_CONFIG,xcurses-config,none)
1992 if test "$XCURSES_CONFIG" != none ; then
1994 CPPFLAGS="$CPPFLAGS `$XCURSES_CONFIG --cflags`"
1995 CF_ADD_LIBS(`$XCURSES_CONFIG --libs`)
1997 cf_cv_lib_XCurses=yes
2001 LDFLAGS="$LDFLAGS $X_LIBS"
2002 CF_CHECK_CFLAGS($X_CFLAGS)
2003 AC_CHECK_LIB(X11,XOpenDisplay,
2004 [CF_ADD_LIBS(-lX11)],,
2005 [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])
2006 AC_CACHE_CHECK(for XCurses library,cf_cv_lib_XCurses,[
2007 CF_ADD_LIBS(-lXCurses)
2009 #include <xcurses.h>
2010 char *XCursesProgramName = "test";
2012 [cf_cv_lib_XCurses=yes],
2013 [cf_cv_lib_XCurses=no])
2018 if test $cf_cv_lib_XCurses = yes ; then
2021 AC_DEFINE(HAVE_XCURSES)
2023 AC_MSG_ERROR(Cannot link with XCurses)
2026 dnl ---------------------------------------------------------------------------
2027 dnl CF_PKG_CONFIG version: 3 updated: 2009/01/25 10:55:09
2029 dnl Check for the package-config program, unless disabled by command-line.
2030 AC_DEFUN([CF_PKG_CONFIG],
2032 AC_MSG_CHECKING(if you want to use pkg-config)
2033 AC_ARG_WITH(pkg-config,
2034 [ --with-pkg-config{=path} enable/disable use of pkg-config],
2035 [cf_pkg_config=$withval],
2036 [cf_pkg_config=yes])
2037 AC_MSG_RESULT($cf_pkg_config)
2039 case $cf_pkg_config in #(vi
2044 AC_PATH_PROG(PKG_CONFIG, pkg-config, none)
2051 test -z "$PKG_CONFIG" && PKG_CONFIG=none
2052 if test "$PKG_CONFIG" != none ; then
2053 CF_PATH_SYNTAX(PKG_CONFIG)
2056 AC_SUBST(PKG_CONFIG)
2058 dnl ---------------------------------------------------------------------------
2059 dnl CF_POSIX_C_SOURCE version: 8 updated: 2010/05/26 05:38:42
2060 dnl -----------------
2061 dnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed.
2063 dnl POSIX.1-1990 _POSIX_SOURCE
2064 dnl POSIX.1-1990 and _POSIX_SOURCE and
2065 dnl POSIX.2-1992 C-Language _POSIX_C_SOURCE=2
2067 dnl POSIX.1b-1993 _POSIX_C_SOURCE=199309L
2068 dnl POSIX.1c-1996 _POSIX_C_SOURCE=199506L
2069 dnl X/Open 2000 _POSIX_C_SOURCE=200112L
2072 dnl $1 is the nominal value for _POSIX_C_SOURCE
2073 AC_DEFUN([CF_POSIX_C_SOURCE],
2075 cf_POSIX_C_SOURCE=ifelse([$1],,199506L,[$1])
2077 cf_save_CFLAGS="$CFLAGS"
2078 cf_save_CPPFLAGS="$CPPFLAGS"
2080 CF_REMOVE_DEFINE(cf_trim_CFLAGS,$cf_save_CFLAGS,_POSIX_C_SOURCE)
2081 CF_REMOVE_DEFINE(cf_trim_CPPFLAGS,$cf_save_CPPFLAGS,_POSIX_C_SOURCE)
2083 AC_CACHE_CHECK(if we should define _POSIX_C_SOURCE,cf_cv_posix_c_source,[
2084 CF_MSG_LOG(if the symbol is already defined go no further)
2085 AC_TRY_COMPILE([#include <sys/types.h>],[
2086 #ifndef _POSIX_C_SOURCE
2089 [cf_cv_posix_c_source=no],
2090 [cf_want_posix_source=no
2091 case .$cf_POSIX_C_SOURCE in #(vi
2093 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
2096 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
2097 cf_want_posix_source=yes
2100 cf_want_posix_source=yes
2103 if test "$cf_want_posix_source" = yes ; then
2104 AC_TRY_COMPILE([#include <sys/types.h>],[
2105 #ifdef _POSIX_SOURCE
2108 cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE")
2110 CF_MSG_LOG(ifdef from value $cf_POSIX_C_SOURCE)
2111 CFLAGS="$cf_trim_CFLAGS"
2112 CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source"
2113 CF_MSG_LOG(if the second compile does not leave our definition intact error)
2114 AC_TRY_COMPILE([#include <sys/types.h>],[
2115 #ifndef _POSIX_C_SOURCE
2118 [cf_cv_posix_c_source=no])
2119 CFLAGS="$cf_save_CFLAGS"
2120 CPPFLAGS="$cf_save_CPPFLAGS"
2124 if test "$cf_cv_posix_c_source" != no ; then
2125 CFLAGS="$cf_trim_CFLAGS"
2126 CPPFLAGS="$cf_trim_CPPFLAGS"
2127 CF_ADD_CFLAGS($cf_cv_posix_c_source)
2131 dnl ---------------------------------------------------------------------------
2132 dnl CF_PRG_RULES version: 1 updated: 2006/06/03 11:45:08
2134 dnl Append definitions and rules for the given programs to the subdirectory
2135 dnl Makefiles, and the recursion rule for the top-level Makefile.
2138 dnl $1 = script to run
2139 dnl $2 = list of subdirectories
2143 AC_DEFUN([CF_PRG_RULES],
2147 if test ! -d $srcdir/$cf_dir; then
2149 elif test -f $srcdir/$cf_dir/programs; then
2150 $AWK -f $1 $srcdir/$cf_dir/programs >>$cf_dir/Makefile
2155 dnl ---------------------------------------------------------------------------
2156 dnl CF_PROG_CC_U_D version: 1 updated: 2005/07/14 16:59:30
2158 dnl Check if C (preprocessor) -U and -D options are processed in the order
2159 dnl given rather than by type of option. Some compilers insist on apply all
2160 dnl of the -U options after all of the -D options. Others allow mixing them,
2161 dnl and may predefine symbols that conflict with those we define.
2162 AC_DEFUN([CF_PROG_CC_U_D],
2164 AC_CACHE_CHECK(if $CC -U and -D options work together,cf_cv_cc_u_d_options,[
2165 cf_save_CPPFLAGS="$CPPFLAGS"
2166 CPPFLAGS="-UU_D_OPTIONS -DU_D_OPTIONS -DD_U_OPTIONS -UD_U_OPTIONS"
2169 make an undefined-error
2172 make a defined-error
2175 cf_cv_cc_u_d_options=yes],[
2176 cf_cv_cc_u_d_options=no])
2177 CPPFLAGS="$cf_save_CPPFLAGS"
2180 dnl ---------------------------------------------------------------------------
2181 dnl CF_PROG_INSTALL version: 5 updated: 2002/12/21 22:46:07
2183 dnl Force $INSTALL to be an absolute-path. Otherwise, edit_man.sh and the
2184 dnl misc/tabset install won't work properly. Usually this happens only when
2185 dnl using the fallback mkinstalldirs script
2186 AC_DEFUN([CF_PROG_INSTALL],
2192 CF_DIRNAME(cf_dir,$INSTALL)
2193 test -z "$cf_dir" && cf_dir=.
2194 INSTALL=`cd $cf_dir && pwd`/`echo $INSTALL | sed -e 's%^.*/%%'`
2198 dnl ---------------------------------------------------------------------------
2199 dnl CF_PROG_LINT version: 2 updated: 2009/08/12 04:43:14
2201 AC_DEFUN([CF_PROG_LINT],
2203 AC_CHECK_PROGS(LINT, tdlint lint alint splint lclint)
2206 dnl ---------------------------------------------------------------------------
2207 dnl CF_REMOVE_DEFINE version: 3 updated: 2010/01/09 11:05:50
2208 dnl ----------------
2209 dnl Remove all -U and -D options that refer to the given symbol from a list
2210 dnl of C compiler options. This works around the problem that not all
2211 dnl compilers process -U and -D options from left-to-right, so a -U option
2212 dnl cannot be used to cancel the effect of a preceding -D option.
2214 dnl $1 = target (which could be the same as the source variable)
2215 dnl $2 = source (including '$')
2216 dnl $3 = symbol to remove
2217 define([CF_REMOVE_DEFINE],
2220 sed -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[[ ]]/ /g' \
2221 -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[$]//g'`
2223 dnl ---------------------------------------------------------------------------
2224 dnl CF_SIG_ATOMIC_T version: 2 updated: 2005/09/18 17:27:12
2226 dnl signal handler, but there are some gcc depedencies in that recommendation.
2228 AC_DEFUN([CF_SIG_ATOMIC_T],
2230 AC_MSG_CHECKING(for signal global datatype)
2231 AC_CACHE_VAL(cf_cv_sig_atomic_t,[
2233 "volatile sig_atomic_t" \
2238 #include <sys/types.h>
2244 static void handler(int sig)
2248 [signal(SIGINT, handler);
2250 [cf_cv_sig_atomic_t=$cf_type],
2251 [cf_cv_sig_atomic_t=no])
2252 test "$cf_cv_sig_atomic_t" != no && break
2255 AC_MSG_RESULT($cf_cv_sig_atomic_t)
2256 test "$cf_cv_sig_atomic_t" != no && AC_DEFINE_UNQUOTED(SIG_ATOMIC_T, $cf_cv_sig_atomic_t)
2258 dnl ---------------------------------------------------------------------------
2259 dnl CF_SUBDIR_PATH version: 6 updated: 2010/04/21 06:20:50
2261 dnl Construct a search-list for a nonstandard header/lib-file
2262 dnl $1 = the variable to return as result
2263 dnl $2 = the package name
2264 dnl $3 = the subdirectory, e.g., bin, include or lib
2265 AC_DEFUN([CF_SUBDIR_PATH],
2269 CF_ADD_SUBDIR_PATH($1,$2,$3,/usr,$prefix)
2270 CF_ADD_SUBDIR_PATH($1,$2,$3,$prefix,NONE)
2271 CF_ADD_SUBDIR_PATH($1,$2,$3,/usr/local,$prefix)
2272 CF_ADD_SUBDIR_PATH($1,$2,$3,/opt,$prefix)
2273 CF_ADD_SUBDIR_PATH($1,$2,$3,[$]HOME,$prefix)
2275 dnl ---------------------------------------------------------------------------
2276 dnl CF_SYS_TIME_SELECT version: 4 updated: 2000/10/04 09:18:40
2277 dnl ------------------
2278 dnl Check if we can include <sys/time.h> with <sys/select.h>; this breaks on
2279 dnl older SCO configurations.
2280 AC_DEFUN([CF_SYS_TIME_SELECT],
2282 AC_MSG_CHECKING(if sys/time.h works with sys/select.h)
2283 AC_CACHE_VAL(cf_cv_sys_time_select,[
2285 #include <sys/types.h>
2286 #ifdef HAVE_SYS_TIME_H
2287 #include <sys/time.h>
2289 #ifdef HAVE_SYS_SELECT_H
2290 #include <sys/select.h>
2292 ],[],[cf_cv_sys_time_select=yes],
2293 [cf_cv_sys_time_select=no])
2295 AC_MSG_RESULT($cf_cv_sys_time_select)
2296 test "$cf_cv_sys_time_select" = yes && AC_DEFINE(HAVE_SYS_TIME_SELECT)
2298 dnl ---------------------------------------------------------------------------
2299 dnl CF_TERM_HEADER version: 2 updated: 2010/10/23 15:54:49
2301 dnl Look for term.h, which is part of X/Open curses. It defines the interface
2302 dnl to terminfo database. Usually it is in the same include-path as curses.h,
2303 dnl but some packagers change this, breaking various applications.
2304 AC_DEFUN([CF_TERM_HEADER],[
2305 AC_CACHE_CHECK(for terminfo header, cf_cv_term_header,[
2306 case ${cf_cv_ncurses_header} in #(vi
2307 */ncurses.h|*/ncursesw.h) #(vi
2308 cf_term_header=`echo "$cf_cv_ncurses_header" | sed -e 's%ncurses[[^.]]*\.h$%term.h%'`
2311 cf_term_header=term.h
2315 for cf_test in $cf_term_header "ncurses/term.h" "ncursesw/term.h"
2317 AC_TRY_COMPILE([#include <stdio.h>
2318 #include <${cf_cv_ncurses_header:-curses.h}>
2320 ],[int x = auto_left_margin],[
2321 cf_cv_term_header="$cf_test"],[
2322 cf_cv_term_header=unknown
2324 test "$cf_cv_term_header" != unknown && break
2328 # Set definitions to allow ifdef'ing to accommodate subdirectories
2330 case $cf_cv_term_header in # (vi
2332 AC_DEFINE(HAVE_TERM_H)
2336 case $cf_cv_term_header in # (vi
2337 ncurses/term.h) #(vi
2338 AC_DEFINE(HAVE_NCURSES_TERM_H)
2341 AC_DEFINE(HAVE_NCURSESW_TERM_H)
2345 dnl ---------------------------------------------------------------------------
2346 dnl CF_TRY_PKG_CONFIG version: 4 updated: 2010/06/14 17:42:30
2347 dnl -----------------
2348 dnl This is a simple wrapper to use for pkg-config, for libraries which may be
2349 dnl available in that form.
2351 dnl $1 = package name
2352 dnl $2 = extra logic to use, if any, after updating CFLAGS and LIBS
2353 dnl $3 = logic to use if pkg-config does not have the package
2354 AC_DEFUN([CF_TRY_PKG_CONFIG],[
2355 AC_REQUIRE([CF_PKG_CONFIG])
2357 if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists $1; then
2358 CF_VERBOSE(found package $1)
2359 cf_pkgconfig_incs="`$PKG_CONFIG --cflags $1 2>/dev/null`"
2360 cf_pkgconfig_libs="`$PKG_CONFIG --libs $1 2>/dev/null`"
2361 CF_VERBOSE(package $1 CFLAGS: $cf_pkgconfig_incs)
2362 CF_VERBOSE(package $1 LIBS: $cf_pkgconfig_libs)
2363 CF_ADD_CFLAGS($cf_pkgconfig_incs)
2364 CF_ADD_LIBS($cf_pkgconfig_libs)
2365 ifelse([$2],,:,[$2])
2367 ifelse([$3],,:,[$3])
2370 dnl ---------------------------------------------------------------------------
2371 dnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59
2373 dnl Make an uppercase version of a variable
2374 dnl $1=uppercase($2)
2375 AC_DEFUN([CF_UPPER],
2377 $1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
2379 dnl ---------------------------------------------------------------------------
2380 dnl CF_UTF8_LIB version: 7 updated: 2010/06/20 09:24:28
2382 dnl Check for multibyte support, and if not found, utf8 compatibility library
2383 AC_DEFUN([CF_UTF8_LIB],
2385 AC_CACHE_CHECK(for multibyte character support,cf_cv_utf8_lib,[
2386 cf_save_LIBS="$LIBS"
2388 #include <stdlib.h>],[putwc(0,0);],
2389 [cf_cv_utf8_lib=yes],
2391 #include <libutf8.h>],[putwc(0,0);],utf8,
2392 [cf_cv_utf8_lib=add-on],
2393 [cf_cv_utf8_lib=no])
2396 # HAVE_LIBUTF8_H is used by ncurses if curses.h is shared between
2398 if test "$cf_cv_utf8_lib" = "add-on" ; then
2399 AC_DEFINE(HAVE_LIBUTF8_H)
2400 CF_ADD_INCDIR($cf_cv_header_path_utf8)
2401 CF_ADD_LIBDIR($cf_cv_library_path_utf8)
2402 CF_ADD_LIBS($cf_cv_library_file_utf8)
2405 dnl ---------------------------------------------------------------------------
2406 dnl CF_VERBOSE version: 3 updated: 2007/07/29 09:55:12
2408 dnl Use AC_VERBOSE w/o the warnings
2409 AC_DEFUN([CF_VERBOSE],
2410 [test -n "$verbose" && echo " $1" 1>&AC_FD_MSG
2413 dnl ---------------------------------------------------------------------------
2414 dnl CF_WCHAR_TYPE version: 3 updated: 2010/05/26 16:44:57
2416 dnl Check if type wide-character type $1 is declared, and if so, which header
2417 dnl file is needed. The second parameter is used to set a shell variable when
2418 dnl the type is not found. The first parameter sets a shell variable for the
2420 AC_DEFUN([CF_WCHAR_TYPE],
2422 # This is needed on Tru64 5.0 to declare $1
2423 AC_CACHE_CHECK(if we must include wchar.h to declare $1,cf_cv_$1,[
2428 #ifdef HAVE_LIBUTF8_H
2429 #include <libutf8.h>
2438 #ifdef HAVE_LIBUTF8_H
2439 #include <libutf8.h>
2443 [cf_cv_$1=unknown])])])
2445 if test "$cf_cv_$1" = yes ; then
2446 AC_DEFINE(NEED_WCHAR_H)
2451 # if we do not find $1 in either place, use substitution to provide a fallback.
2452 if test "$cf_cv_$1" = unknown ; then
2457 # if we find $1 in either place, use substitution to provide a fallback.
2458 if test "$cf_cv_$1" != unknown ; then
2463 dnl ---------------------------------------------------------------------------
2464 dnl CF_WITH_CURSES_DIR version: 2 updated: 2002/11/10 14:46:59
2465 dnl ------------------
2466 dnl Wrapper for AC_ARG_WITH to specify directory under which to look for curses
2468 AC_DEFUN([CF_WITH_CURSES_DIR],[
2469 AC_ARG_WITH(curses-dir,
2470 [ --with-curses-dir=DIR directory in which (n)curses is installed],
2471 [CF_PATH_SYNTAX(withval)
2472 cf_cv_curses_dir=$withval],
2473 [cf_cv_curses_dir=no])
2475 dnl ---------------------------------------------------------------------------
2476 dnl CF_XOPEN_CURSES version: 10 updated: 2010/10/23 15:54:49
2478 dnl Test if we should define X/Open source for curses, needed on Digital Unix
2479 dnl 4.x, to see the extended functions, but breaks on IRIX 6.x.
2481 dnl The getbegyx() check is needed for HPUX, which omits legacy macros such
2482 dnl as getbegy(). The latter is better design, but the former is standard.
2483 AC_DEFUN([CF_XOPEN_CURSES],
2485 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
2486 AC_CACHE_CHECK(if we must define _XOPEN_SOURCE_EXTENDED,cf_cv_need_xopen_extension,[
2489 #include <${cf_cv_ncurses_header:-curses.h}>],[
2490 #if defined(NCURSES_VERSION_PATCH)
2491 if (NCURSES_VERSION_PATCH < 20100501) && (NCURSES_VERSION_PATCH >= 20100403)
2495 long x = winnstr(stdscr, "", 0);
2497 getbegyx(stdscr, y1, x1)],
2498 [cf_cv_need_xopen_extension=no],
2500 #define _XOPEN_SOURCE_EXTENDED
2502 #include <${cf_cv_ncurses_header:-curses.h}>],[
2503 #ifdef NCURSES_VERSION
2505 int check2 = curs_set((int)sizeof(check));
2507 long x = winnstr(stdscr, "", 0);
2509 getbegyx(stdscr, y1, x1)],
2510 [cf_cv_need_xopen_extension=yes],
2511 [cf_cv_need_xopen_extension=unknown])])])
2512 test $cf_cv_need_xopen_extension = yes && CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED"
2514 dnl ---------------------------------------------------------------------------
2515 dnl CF_XOPEN_SOURCE version: 34 updated: 2010/05/26 05:38:42
2517 dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions,
2518 dnl or adapt to the vendor's definitions to get equivalent functionality,
2519 dnl without losing the common non-POSIX features.
2522 dnl $1 is the nominal value for _XOPEN_SOURCE
2523 dnl $2 is the nominal value for _POSIX_C_SOURCE
2524 AC_DEFUN([CF_XOPEN_SOURCE],[
2526 cf_XOPEN_SOURCE=ifelse([$1],,500,[$1])
2527 cf_POSIX_C_SOURCE=ifelse([$2],,199506L,[$2])
2530 case $host_os in #(vi
2532 cf_xopen_source="-D_ALL_SOURCE"
2534 darwin[[0-8]].*) #(vi
2535 cf_xopen_source="-D_APPLE_C_SOURCE"
2538 cf_xopen_source="-D_DARWIN_C_SOURCE"
2540 freebsd*|dragonfly*) #(vi
2541 # 5.x headers associate
2542 # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L
2543 # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L
2544 cf_POSIX_C_SOURCE=200112L
2546 cf_xopen_source="-D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
2549 cf_xopen_source="-D_HPUX_SOURCE -D_XOPEN_SOURCE=500"
2552 cf_xopen_source="-D_HPUX_SOURCE"
2555 cf_xopen_source="-D_SGI_SOURCE"
2557 linux*|gnu*|mint*|k*bsd*-gnu) #(vi
2561 # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <arpa/inet.h>
2564 # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw
2567 # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw
2570 cf_xopen_source="-D_OSF_SOURCE"
2573 cf_xopen_source="-D_QNX_SOURCE"
2576 # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer
2578 solaris2.1[[0-9]]) #(vi
2579 cf_xopen_source="-D__EXTENSIONS__ -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
2581 solaris2.[[1-9]]) #(vi
2582 cf_xopen_source="-D__EXTENSIONS__"
2585 AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[
2586 AC_TRY_COMPILE([#include <sys/types.h>],[
2587 #ifndef _XOPEN_SOURCE
2590 [cf_cv_xopen_source=no],
2591 [cf_save="$CPPFLAGS"
2592 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
2593 AC_TRY_COMPILE([#include <sys/types.h>],[
2594 #ifdef _XOPEN_SOURCE
2597 [cf_cv_xopen_source=no],
2598 [cf_cv_xopen_source=$cf_XOPEN_SOURCE])
2602 if test "$cf_cv_xopen_source" != no ; then
2603 CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE)
2604 CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE)
2605 cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source"
2606 CF_ADD_CFLAGS($cf_temp_xopen_source)
2608 CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE)
2612 if test -n "$cf_xopen_source" ; then
2613 CF_ADD_CFLAGS($cf_xopen_source)
2616 dnl ---------------------------------------------------------------------------
2617 dnl CF_X_ATHENA version: 20 updated: 2010/11/09 05:18:02
2619 dnl Check for Xaw (Athena) libraries
2621 dnl Sets $cf_x_athena according to the flavor of Xaw which is used.
2622 AC_DEFUN([CF_X_ATHENA],
2624 cf_x_athena=${cf_x_athena:-Xaw}
2626 AC_MSG_CHECKING(if you want to link with Xaw 3d library)
2629 [ --with-Xaw3d link with Xaw 3d library])
2630 if test "$withval" = yes ; then
2637 AC_MSG_CHECKING(if you want to link with neXT Athena library)
2640 [ --with-neXtaw link with neXT Athena library])
2641 if test "$withval" = yes ; then
2648 AC_MSG_CHECKING(if you want to link with Athena-Plus library)
2650 AC_ARG_WITH(XawPlus,
2651 [ --with-XawPlus link with Athena-Plus library])
2652 if test "$withval" = yes ; then
2661 if test "$PKG_CONFIG" != none ; then
2663 test "$cf_x_athena" = Xaw && cf_athena_list="xaw8 xaw7 xaw6"
2664 for cf_athena_pkg in \
2667 ${cf_x_athena}-devel \
2669 lib${cf_x_athena}-devel
2671 CF_TRY_PKG_CONFIG($cf_athena_pkg,[
2672 cf_x_athena_lib="$cf_pkgconfig_libs"
2673 CF_UPPER(cf_x_athena_LIBS,HAVE_LIB_$cf_x_athena)
2674 AC_DEFINE_UNQUOTED($cf_x_athena_LIBS)
2676 AC_CACHE_CHECK(for usable $cf_x_athena/Xmu package,cf_cv_xaw_compat,[
2678 #include <X11/Xmu/CharSet.h>
2680 int check = XmuCompareISOLatin1("big", "small")
2681 ],[cf_cv_xaw_compat=yes],[cf_cv_xaw_compat=no])])
2683 if test "$cf_cv_xaw_compat" = no
2685 # workaround for broken ".pc" files...
2686 case "$cf_x_athena_lib" in #(vi
2690 CF_VERBOSE(work around broken package)
2691 CF_TRY_PKG_CONFIG(xmu,,[CF_ADD_LIB_AFTER(-lXt,-lXmu)])
2700 if test -z "$cf_x_athena_lib" ; then
2703 CF_X_ATHENA_CPPFLAGS($cf_x_athena)
2704 CF_X_ATHENA_LIBS($cf_x_athena)
2707 dnl ---------------------------------------------------------------------------
2708 dnl CF_X_ATHENA_CPPFLAGS version: 5 updated: 2010/05/26 17:35:30
2709 dnl --------------------
2710 dnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of
2711 dnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw.
2712 AC_DEFUN([CF_X_ATHENA_CPPFLAGS],
2714 cf_x_athena_root=ifelse([$1],,Xaw,[$1])
2717 for cf_path in default \
2718 /usr/contrib/X11R6 \
2719 /usr/contrib/X11R5 \
2723 if test -z "$cf_x_athena_inc" ; then
2725 cf_test=X11/$cf_x_athena_root/SimpleMenu.h
2726 if test $cf_path != default ; then
2727 CPPFLAGS="$cf_save -I$cf_path/include"
2728 AC_MSG_CHECKING(for $cf_test in $cf_path)
2730 AC_MSG_CHECKING(for $cf_test)
2733 #include <X11/Intrinsic.h>
2734 #include <$cf_test>],[],
2737 AC_MSG_RESULT($cf_result)
2738 if test "$cf_result" = yes ; then
2739 cf_x_athena_inc=$cf_path
2747 if test -z "$cf_x_athena_inc" ; then
2749 [Unable to successfully find Athena header files with test program])
2750 elif test "$cf_x_athena_inc" != default ; then
2751 CPPFLAGS="$CPPFLAGS -I$cf_x_athena_inc"
2754 dnl ---------------------------------------------------------------------------
2755 dnl CF_X_ATHENA_LIBS version: 9 updated: 2010/06/02 05:03:05
2756 dnl ----------------
2757 dnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of
2758 dnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw.
2759 AC_DEFUN([CF_X_ATHENA_LIBS],
2760 [AC_REQUIRE([CF_X_TOOLKIT])
2761 cf_x_athena_root=ifelse([$1],,Xaw,[$1])
2764 for cf_path in default \
2765 /usr/contrib/X11R6 \
2766 /usr/contrib/X11R5 \
2771 "-l$cf_x_athena_root -lXmu" \
2772 "-l$cf_x_athena_root -lXpm -lXmu" \
2773 "-l${cf_x_athena_root}_s -lXmu_s"
2775 if test -z "$cf_x_athena_lib" ; then
2777 cf_test=XawSimpleMenuAddGlobalActions
2778 if test $cf_path != default ; then
2779 CF_ADD_LIBS(-L$cf_path/lib $cf_lib)
2780 AC_MSG_CHECKING(for $cf_lib in $cf_path)
2782 CF_ADD_LIBS($cf_lib)
2783 AC_MSG_CHECKING(for $cf_test in $cf_lib)
2785 AC_TRY_LINK([],[$cf_test()],
2788 AC_MSG_RESULT($cf_result)
2789 if test "$cf_result" = yes ; then
2790 cf_x_athena_lib="$cf_lib"
2798 if test -z "$cf_x_athena_lib" ; then
2800 [Unable to successfully link Athena library (-l$cf_x_athena_root) with test program])
2803 CF_UPPER(cf_x_athena_LIBS,HAVE_LIB_$cf_x_athena)
2804 AC_DEFINE_UNQUOTED($cf_x_athena_LIBS)
2806 dnl ---------------------------------------------------------------------------
2807 dnl CF_X_EXT version: 3 updated: 2010/06/02 05:03:05
2809 AC_DEFUN([CF_X_EXT],[
2810 CF_TRY_PKG_CONFIG(Xext,,[
2811 AC_CHECK_LIB(Xext,XextCreateExtension,
2812 [CF_ADD_LIB(Xext)])])
2814 dnl ---------------------------------------------------------------------------
2815 dnl CF_X_TOOLKIT version: 19 updated: 2010/11/09 05:18:02
2817 dnl Check for X Toolkit libraries
2819 AC_DEFUN([CF_X_TOOLKIT],
2821 AC_REQUIRE([AC_PATH_XTRA])
2822 AC_REQUIRE([CF_CHECK_CACHE])
2826 CF_TRY_PKG_CONFIG(xt,[
2828 AC_CACHE_CHECK(for usable X Toolkit package,cf_cv_xt_compat,[
2830 #include <X11/Shell.h>
2831 ],[int num = IceConnectionNumber(0)
2832 ],[cf_cv_xt_compat=no],[cf_cv_xt_compat=no])])
2834 if test "$cf_cv_xt_compat" = no
2836 # workaround for broken ".pc" files used for X Toolkit.
2837 case "x$X_PRE_LIBS" in #(vi
2839 case "x$LIBS" in #(vi
2843 CF_VERBOSE(work around broken package)
2844 CF_TRY_PKG_CONFIG(ice,
2845 [CF_TRY_PKG_CONFIG(sm)],
2846 [CF_ADD_LIB_AFTER(-lXt,$X_PRE_LIBS)])
2856 LDFLAGS="$X_LIBS $LDFLAGS"
2857 CF_CHECK_CFLAGS($X_CFLAGS)
2859 AC_CHECK_FUNC(XOpenDisplay,,[
2860 AC_CHECK_LIB(X11,XOpenDisplay,
2862 [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])])
2864 AC_CHECK_FUNC(XtAppInitialize,,[
2865 AC_CHECK_LIB(Xt, XtAppInitialize,
2866 [AC_DEFINE(HAVE_LIBXT)
2868 LIBS="-lXt $X_PRE_LIBS $LIBS $X_EXTRA_LIBS"],,
2869 [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])])
2872 if test $cf_have_X_LIBS = no ; then
2874 [Unable to successfully link X Toolkit library (-lXt) with
2875 test program. You will have to check and add the proper libraries by hand
2879 dnl ---------------------------------------------------------------------------
2880 dnl CF__CURSES_HEAD version: 2 updated: 2010/10/23 15:54:49
2882 dnl Define a reusable chunk which includes <curses.h> and <term.h> when they
2883 dnl are both available.
2884 define([CF__CURSES_HEAD],[
2886 #include <xcurses.h>
2887 char * XCursesProgramName = "test";
2889 #include <${cf_cv_ncurses_header:-curses.h}>
2890 #if defined(NCURSES_VERSION) && defined(HAVE_NCURSESW_TERM_H)
2891 #include <ncursesw/term.h>
2892 #elif defined(NCURSES_VERSION) && defined(HAVE_NCURSES_TERM_H)
2893 #include <ncurses/term.h>
2894 #elif defined(HAVE_TERM_H)