1 dnl***************************************************************************
2 dnl Copyright (c) 2003-2007,2008 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.22 2008/02/09 18:22:17 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: 7 updated: 2004/04/25 17:48:30
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 cf_new_cppflags="$cf_new_cppflags $cf_add_cflags"
90 cf_new_cflags="$cf_new_cflags $cf_add_cflags"
95 cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
97 cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[[^"]]*"'\''//'`
99 test "${cf_add_cflags}" != "${cf_tst_cflags}" \
100 && test -z "${cf_tst_cflags}" \
101 && cf_fix_cppflags=no
106 if test -n "$cf_new_cflags" ; then
107 ifelse($2,,,[CF_VERBOSE(add to \$CFLAGS $cf_new_cflags)])
108 CFLAGS="$CFLAGS $cf_new_cflags"
111 if test -n "$cf_new_cppflags" ; then
112 ifelse($2,,,[CF_VERBOSE(add to \$CPPFLAGS $cf_new_cppflags)])
113 CPPFLAGS="$cf_new_cppflags $CPPFLAGS"
116 if test -n "$cf_new_extra_cppflags" ; then
117 ifelse($2,,,[CF_VERBOSE(add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags)])
118 EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
121 AC_SUBST(EXTRA_CPPFLAGS)
124 dnl ---------------------------------------------------------------------------
125 dnl CF_ADD_INCDIR version: 9 updated: 2008/02/09 13:15:34
127 dnl Add an include-directory to $CPPFLAGS. Don't add /usr/include, since it's
128 dnl redundant. We don't normally need to add -I/usr/local/include for gcc,
129 dnl but old versions (and some misinstalled ones) need that. To make things
130 dnl worse, gcc 3.x may give error messages if -I/usr/local/include is added to
131 dnl the include-path).
132 AC_DEFUN([CF_ADD_INCDIR],
134 if test -n "$1" ; then
135 for cf_add_incdir in $1
137 while test $cf_add_incdir != /usr/include
139 if test -d $cf_add_incdir
142 if test -n "$CFLAGS$CPPFLAGS" ; then
143 # a loop is needed to ensure we can add subdirs of existing dirs
144 for cf_test_incdir in $CFLAGS $CPPFLAGS ; do
145 if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then
146 cf_have_incdir=yes; break
151 if test "$cf_have_incdir" = no ; then
152 if test "$cf_add_incdir" = /usr/local/include ; then
155 cf_save_CPPFLAGS=$CPPFLAGS
156 CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
157 AC_TRY_COMPILE([#include <stdio.h>],
160 [cf_have_incdir=yes])
161 CPPFLAGS=$cf_save_CPPFLAGS
166 if test "$cf_have_incdir" = no ; then
167 CF_VERBOSE(adding $cf_add_incdir to include-path)
168 ifelse($2,,CPPFLAGS,$2)="-I$cf_add_incdir $ifelse($2,,CPPFLAGS,[$]$2)"
170 cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'`
171 test "$cf_top_incdir" = "$cf_add_incdir" && break
172 cf_add_incdir="$cf_top_incdir"
181 dnl ---------------------------------------------------------------------------
182 dnl CF_ADD_LIBDIR version: 6 updated: 2008/02/09 13:15:34
184 dnl Adds to the library-path
186 dnl Some machines have trouble with multiple -L options.
188 dnl $1 is the (list of) directory(s) to add
189 dnl $2 is the optional name of the variable to update (default LDFLAGS)
191 AC_DEFUN([CF_ADD_LIBDIR],
193 if test -n "$1" ; then
194 for cf_add_libdir in $1
196 if test $cf_add_libdir = /usr/lib ; then
198 elif test -d $cf_add_libdir
201 if test -n "$LDFLAGS$LIBS" ; then
202 # a loop is needed to ensure we can add subdirs of existing dirs
203 for cf_test_libdir in $LDFLAGS $LIBS ; do
204 if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then
205 cf_have_libdir=yes; break
209 if test "$cf_have_libdir" = no ; then
210 CF_VERBOSE(adding $cf_add_libdir to library-path)
211 ifelse($2,,LDFLAGS,$2)="-L$cf_add_libdir $ifelse($2,,LDFLAGS,[$]$2)"
217 dnl ---------------------------------------------------------------------------
218 dnl CF_ADD_SUBDIR_PATH version: 2 updated: 2007/07/29 10:12:59
219 dnl ------------------
220 dnl Append to a search-list for a nonstandard header/lib-file
221 dnl $1 = the variable to return as result
222 dnl $2 = the package name
223 dnl $3 = the subdirectory, e.g., bin, include or lib
224 dnl $4 = the directory under which we will test for subdirectories
225 dnl $5 = a directory that we do not want $4 to match
226 AC_DEFUN([CF_ADD_SUBDIR_PATH],
228 test "$4" != "$5" && \
230 ifelse([$5],NONE,,[(test $5 = NONE || test -d $5) &&]) {
231 test -n "$verbose" && echo " ... testing for $3-directories under $4"
232 test -d $4/$3 && $1="[$]$1 $4/$3"
233 test -d $4/$3/$2 && $1="[$]$1 $4/$3/$2"
234 test -d $4/$3/$2/$3 && $1="[$]$1 $4/$3/$2/$3"
235 test -d $4/$2/$3 && $1="[$]$1 $4/$2/$3"
236 test -d $4/$2/$3/$2 && $1="[$]$1 $4/$2/$3/$2"
239 dnl ---------------------------------------------------------------------------
240 dnl CF_ANSI_CC_CHECK version: 9 updated: 2001/12/30 17:53:34
242 dnl This is adapted from the macros 'fp_PROG_CC_STDC' and 'fp_C_PROTOTYPES'
243 dnl in the sharutils 4.2 distribution.
244 AC_DEFUN([CF_ANSI_CC_CHECK],
246 AC_CACHE_CHECK(for ${CC-cc} option to accept ANSI C, cf_cv_ansi_cc,[
248 cf_save_CFLAGS="$CFLAGS"
249 cf_save_CPPFLAGS="$CPPFLAGS"
250 # Don't try gcc -ansi; that turns off useful extensions and
251 # breaks some systems' header files.
253 # Ultrix and OSF/1 -std1
254 # HP-UX -Aa -D_HPUX_SOURCE
256 # UnixWare 1.2 (cannot use -Xc, since ANSI/POSIX clashes)
257 for cf_arg in "-DCC_HAS_PROTOS" \
262 "-Aa -D_HPUX_SOURCE" \
265 CF_ADD_CFLAGS($cf_arg)
268 #ifndef CC_HAS_PROTOS
269 #if !defined(__STDC__) || (__STDC__ != 1)
274 int test (int i, double x);
275 struct s1 {int (*f) (int a);};
276 struct s2 {int (*f) (double a);};],
277 [cf_cv_ansi_cc="$cf_arg"; break])
279 CFLAGS="$cf_save_CFLAGS"
280 CPPFLAGS="$cf_save_CPPFLAGS"
283 if test "$cf_cv_ansi_cc" != "no"; then
284 if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then
285 CF_ADD_CFLAGS($cf_cv_ansi_cc)
287 AC_DEFINE(CC_HAS_PROTOS)
291 dnl ---------------------------------------------------------------------------
292 dnl CF_ANSI_CC_REQD version: 3 updated: 1997/09/06 13:40:44
294 dnl For programs that must use an ANSI compiler, obtain compiler options that
295 dnl will make it recognize prototypes. We'll do preprocessor checks in other
296 dnl macros, since tools such as unproto can fake prototypes, but only part of
297 dnl the preprocessor.
298 AC_DEFUN([CF_ANSI_CC_REQD],
299 [AC_REQUIRE([CF_ANSI_CC_CHECK])
300 if test "$cf_cv_ansi_cc" = "no"; then
302 [Your compiler does not appear to recognize prototypes.
303 You have the following choices:
304 a. adjust your compiler options
305 b. get an up-to-date compiler
306 c. use a wrapper such as unproto])
309 dnl ---------------------------------------------------------------------------
310 dnl CF_ARG_DISABLE version: 3 updated: 1999/03/30 17:24:31
312 dnl Allow user to disable a normally-on option.
313 AC_DEFUN([CF_ARG_DISABLE],
314 [CF_ARG_OPTION($1,[$2],[$3],[$4],yes)])dnl
315 dnl ---------------------------------------------------------------------------
316 dnl CF_ARG_ENABLE version: 3 updated: 1999/03/30 17:24:31
318 dnl Allow user to enable a normally-off option.
319 AC_DEFUN([CF_ARG_ENABLE],
320 [CF_ARG_OPTION($1,[$2],[$3],[$4],no)])dnl
321 dnl ---------------------------------------------------------------------------
322 dnl CF_ARG_OPTION version: 3 updated: 1997/10/18 14:42:41
324 dnl Restricted form of AC_ARG_ENABLE that ensures user doesn't give bogus
330 dnl $3 = action to perform if option is not default
331 dnl $4 = action if perform if option is default
332 dnl $5 = default option value (either 'yes' or 'no')
333 AC_DEFUN([CF_ARG_OPTION],
334 [AC_ARG_ENABLE($1,[$2],[test "$enableval" != ifelse($5,no,yes,no) && enableval=ifelse($5,no,no,yes)
335 if test "$enableval" != "$5" ; then
337 ,[ $3]) ifelse($4,,,[
340 fi],[enableval=$5 ifelse($4,,,[
344 dnl ---------------------------------------------------------------------------
345 dnl CF_CHECK_CACHE version: 10 updated: 2004/05/23 13:03:31
347 dnl Check if we're accidentally using a cache from a different machine.
348 dnl Derive the system name, as a check for reusing the autoconf cache.
350 dnl If we've packaged config.guess and config.sub, run that (since it does a
351 dnl better job than uname). Normally we'll use AC_CANONICAL_HOST, but allow
352 dnl an extra parameter that we may override, e.g., for AC_CANONICAL_SYSTEM
353 dnl which is useful in cross-compiles.
355 dnl Note: we would use $ac_config_sub, but that is one of the places where
356 dnl autoconf 2.5x broke compatibility with autoconf 2.13
357 AC_DEFUN([CF_CHECK_CACHE],
359 if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then
360 ifelse([$1],,[AC_CANONICAL_HOST],[$1])
361 system_name="$host_os"
363 system_name="`(uname -s -r) 2>/dev/null`"
364 if test -z "$system_name" ; then
365 system_name="`(hostname) 2>/dev/null`"
368 test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name")
369 AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"])
371 test -z "$system_name" && system_name="$cf_cv_system_name"
372 test -n "$cf_cv_system_name" && AC_MSG_RESULT(Configuring for $cf_cv_system_name)
374 if test ".$system_name" != ".$cf_cv_system_name" ; then
375 AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name))
376 AC_ERROR("Please remove config.cache and try again.")
379 dnl ---------------------------------------------------------------------------
380 dnl CF_CHECK_CFLAGS version: 2 updated: 2001/12/30 19:09:58
382 dnl Conditionally add to $CFLAGS and $CPPFLAGS values which are derived from
383 dnl a build-configuration such as imake. These have the pitfall that they
384 dnl often contain compiler-specific options which we cannot use, mixed with
385 dnl preprocessor options that we usually can.
386 AC_DEFUN([CF_CHECK_CFLAGS],
388 CF_VERBOSE(checking additions to CFLAGS)
389 cf_check_cflags="$CFLAGS"
390 cf_check_cppflags="$CPPFLAGS"
391 CF_ADD_CFLAGS($1,yes)
392 if test "$cf_check_cflags" != "$CFLAGS" ; then
393 AC_TRY_LINK([#include <stdio.h>],[printf("Hello world");],,
394 [CF_VERBOSE(test-compile failed. Undoing change to \$CFLAGS)
395 if test "$cf_check_cppflags" != "$CPPFLAGS" ; then
396 CF_VERBOSE(but keeping change to \$CPPFLAGS)
398 CFLAGS="$cf_check_flags"])
401 dnl ---------------------------------------------------------------------------
402 dnl CF_CURSES_ACS_MAP version: 3 updated: 2003/05/17 22:19:02
403 dnl -----------------
404 dnl Check for likely values of acs_map[]:
405 AC_DEFUN([CF_CURSES_ACS_MAP],
407 AC_CACHE_CHECK(for alternate character set array, cf_cv_curses_acs_map,[
408 cf_cv_curses_acs_map=unknown
409 for name in acs_map _acs_map __acs_map _nc_acs_map
412 #include <${cf_cv_ncurses_header-curses.h}>
414 $name['k'] = ACS_PLUS
415 ],[cf_cv_curses_acs_map=$name; break])
419 test "$cf_cv_curses_acs_map" != unknown && AC_DEFINE_UNQUOTED(CURSES_ACS_ARRAY,$cf_cv_curses_acs_map)
421 dnl ---------------------------------------------------------------------------
422 dnl CF_CURSES_CHECK_TYPE version: 2 updated: 2003/03/01 23:40:33
423 dnl --------------------
424 dnl Check if curses.h defines the given type
425 AC_DEFUN([CF_CURSES_CHECK_TYPE],
427 AC_MSG_CHECKING(for type $1 in ${cf_cv_ncurses_header-curses.h})
429 #ifndef _XOPEN_SOURCE_EXTENDED
430 #define _XOPEN_SOURCE_EXTENDED
432 #include <${cf_cv_ncurses_header-curses.h}>],[
434 ],cf_result=yes,cf_result=no)
435 AC_MSG_RESULT($cf_result)
436 if test $cf_result = yes ; then
437 CF_UPPER(cf_result,have_type_$1)
438 AC_DEFINE_UNQUOTED($cf_result)
440 AC_DEFINE_UNQUOTED($1,$2)
443 dnl ---------------------------------------------------------------------------
444 dnl CF_CURSES_CPPFLAGS version: 9 updated: 2006/02/04 19:44:43
445 dnl ------------------
446 dnl Look for the curses headers.
447 AC_DEFUN([CF_CURSES_CPPFLAGS],[
449 AC_CACHE_CHECK(for extra include directories,cf_cv_curses_incdir,[
450 cf_cv_curses_incdir=no
451 case $host_os in #(vi
453 test -d /usr/include/curses_colr && \
454 cf_cv_curses_incdir="-I/usr/include/curses_colr"
457 test -d /usr/5lib && \
458 test -d /usr/5include && \
459 cf_cv_curses_incdir="-I/usr/5include"
463 test "$cf_cv_curses_incdir" != no && CPPFLAGS="$cf_cv_curses_incdir $CPPFLAGS"
468 dnl ---------------------------------------------------------------------------
469 dnl CF_CURSES_FUNCS version: 13 updated: 2007/04/28 09:15:55
471 dnl Curses-functions are a little complicated, since a lot of them are macros.
472 AC_DEFUN([CF_CURSES_FUNCS],
474 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
475 AC_REQUIRE([CF_XOPEN_CURSES])
476 AC_REQUIRE([CF_CURSES_TERM_H])
479 CF_UPPER(cf_tr_func,$cf_func)
480 AC_MSG_CHECKING(for ${cf_func})
481 CF_MSG_LOG(${cf_func})
482 AC_CACHE_VAL(cf_cv_func_$cf_func,[
483 eval cf_result='$ac_cv_func_'$cf_func
484 if test ".$cf_result" != ".no"; then
488 char * XCursesProgramName = "test";
490 #include <${cf_cv_ncurses_header-curses.h}>
491 #if defined(NCURSES_VERSION) && defined(HAVE_NCURSESW_TERM_H)
492 #include <ncursesw/term.h>
494 #if defined(NCURSES_VERSION) && defined(HAVE_NCURSES_TERM_H)
495 #include <ncurses/term.h>
505 long foo = (long)(&${cf_func});
506 ${cf_cv_main_return-return}(foo == 0);
512 eval 'cf_cv_func_'$cf_func'=$cf_result'
514 # use the computed/retrieved cache-value:
515 eval 'cf_result=$cf_cv_func_'$cf_func
516 AC_MSG_RESULT($cf_result)
517 if test $cf_result != no; then
518 AC_DEFINE_UNQUOTED(HAVE_${cf_tr_func})
522 dnl ---------------------------------------------------------------------------
523 dnl CF_CURSES_HEADER version: 1 updated: 2005/12/31 13:28:25
525 dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common
526 dnl variations of ncurses' installs.
528 dnl See also CF_NCURSES_HEADER, which sets the same cache variable.
529 AC_DEFUN([CF_CURSES_HEADER],[
530 AC_CACHE_CHECK(if we have identified curses headers,cf_cv_ncurses_header,[
531 cf_cv_ncurses_header=none
538 AC_TRY_COMPILE([#include <${cf_header}>],
539 [initscr(); tgoto("?", 0,0)],
540 [cf_cv_ncurses_header=$cf_header; break],[])
544 if test "$cf_cv_ncurses_header" = none ; then
545 AC_MSG_ERROR(No curses header-files found)
548 # cheat, to get the right #define's for HAVE_NCURSES_H, etc.
549 AC_CHECK_HEADERS($cf_cv_ncurses_header)
551 dnl ---------------------------------------------------------------------------
552 dnl CF_CURSES_LIBS version: 26 updated: 2007/07/29 10:32:40
554 dnl Look for the curses libraries. Older curses implementations may require
555 dnl termcap/termlib to be linked as well. Call CF_CURSES_CPPFLAGS first.
556 AC_DEFUN([CF_CURSES_LIBS],[
558 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
559 AC_MSG_CHECKING(if we have identified curses libraries)
560 AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>],
561 [initscr(); tgoto("?", 0,0)],
564 AC_MSG_RESULT($cf_result)
566 if test "$cf_result" = no ; then
567 case $host_os in #(vi
569 AC_CHECK_LIB(mytinfo,tgoto,[LIBS="-lmytinfo $LIBS"])
572 AC_CHECK_LIB(cur_colr,initscr,[
573 LIBS="-lcur_colr $LIBS"
574 ac_cv_func_initscr=yes
576 AC_CHECK_LIB(Hcurses,initscr,[
577 # HP's header uses __HP_CURSES, but user claims _HP_CURSES.
578 LIBS="-lHcurses $LIBS"
579 CPPFLAGS="-D__HP_CURSES -D_HP_CURSES $CPPFLAGS"
580 ac_cv_func_initscr=yes
583 linux*) # Suse Linux does not follow /usr/lib convention
587 if test -d /usr/5lib ; then
588 CF_ADD_LIBDIR(/usr/5lib)
589 LIBS="$LIBS -lcurses -ltermcap"
591 ac_cv_func_initscr=yes
595 if test ".$ac_cv_func_initscr" != .yes ; then
600 if test ".${cf_cv_ncurses_version-no}" != .no
602 cf_check_list="ncurses curses cursesX"
604 cf_check_list="cursesX curses ncurses"
607 # Check for library containing tgoto. Do this before curses library
608 # because it may be needed to link the test-case for initscr.
609 AC_CHECK_FUNC(tgoto,[cf_term_lib=predefined],[
610 for cf_term_lib in $cf_check_list termcap termlib unknown
612 AC_CHECK_LIB($cf_term_lib,tgoto,[break])
616 # Check for library containing initscr
617 test "$cf_term_lib" != predefined && test "$cf_term_lib" != unknown && LIBS="-l$cf_term_lib $cf_save_LIBS"
618 for cf_curs_lib in $cf_check_list xcurses jcurses unknown
620 AC_CHECK_LIB($cf_curs_lib,initscr,[break])
622 test $cf_curs_lib = unknown && AC_ERROR(no curses library found)
624 LIBS="-l$cf_curs_lib $cf_save_LIBS"
625 if test "$cf_term_lib" = unknown ; then
626 AC_MSG_CHECKING(if we can link with $cf_curs_lib library)
627 AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>],
631 AC_MSG_RESULT($cf_result)
632 test $cf_result = no && AC_ERROR(Cannot link curses library)
633 elif test "$cf_curs_lib" = "$cf_term_lib" ; then
635 elif test "$cf_term_lib" != predefined ; then
636 AC_MSG_CHECKING(if we need both $cf_curs_lib and $cf_term_lib libraries)
637 AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>],
638 [initscr(); tgoto((char *)0, 0, 0);],
641 LIBS="-l$cf_curs_lib -l$cf_term_lib $cf_save_LIBS"
642 AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>],
647 AC_MSG_RESULT($cf_result)
653 dnl ---------------------------------------------------------------------------
654 dnl CF_CURSES_TERM_H version: 6 updated: 2003/11/06 19:59:57
656 dnl SVr4 curses should have term.h as well (where it puts the definitions of
657 dnl the low-level interface). This may not be true in old/broken implementations,
658 dnl as well as in misconfigured systems (e.g., gcc configured for Solaris 2.4
659 dnl running with Solaris 2.5.1).
660 AC_DEFUN([CF_CURSES_TERM_H],
662 AC_CACHE_CHECK(for term.h, cf_cv_term_header,[
664 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
665 # If we found <ncurses/curses.h>, look for <ncurses/term.h>, but always look
666 # for <term.h> if we do not find the variant.
668 `echo ${cf_cv_ncurses_header-curses.h} | sed -e 's%/.*%/%'`term.h \
672 #include <${cf_cv_ncurses_header-curses.h}>
673 #include <${cf_header}>],
675 [cf_cv_term_header=$cf_header
677 [cf_cv_term_header=no])
681 case $cf_cv_term_header in #(vi
683 AC_DEFINE(HAVE_TERM_H)
686 AC_DEFINE(HAVE_NCURSES_TERM_H)
689 AC_DEFINE(HAVE_NCURSESW_TERM_H)
693 dnl ---------------------------------------------------------------------------
694 dnl CF_CURSES_WACS_MAP version: 3 updated: 2003/05/17 22:19:02
695 dnl ------------------
696 dnl Check for likely values of wacs_map[]:
697 AC_DEFUN([CF_CURSES_WACS_MAP],
699 AC_CACHE_CHECK(for wide alternate character set array, cf_cv_curses_wacs_map,[
700 cf_cv_curses_wacs_map=unknown
701 for name in wacs_map _wacs_map __wacs_map _nc_wacs
704 #ifndef _XOPEN_SOURCE_EXTENDED
705 #define _XOPEN_SOURCE_EXTENDED
707 #include <${cf_cv_ncurses_header-curses.h}>],
708 [$name['k'] = *WACS_PLUS],
709 [cf_cv_curses_wacs_map=$name
713 dnl ---------------------------------------------------------------------------
714 dnl CF_DIRNAME version: 4 updated: 2002/12/21 19:25:52
716 dnl "dirname" is not portable, so we fake it with a shell script.
717 AC_DEFUN([CF_DIRNAME],[$1=`echo $2 | sed -e 's%/[[^/]]*$%%'`])dnl
718 dnl ---------------------------------------------------------------------------
719 dnl CF_DISABLE_ECHO version: 10 updated: 2003/04/17 22:27:11
721 dnl You can always use "make -n" to see the actual options, but it's hard to
722 dnl pick out/analyze warning messages when the compile-line is long.
725 dnl ECHO_LT - symbol to control if libtool is verbose
726 dnl ECHO_LD - symbol to prefix "cc -o" lines
727 dnl RULE_CC - symbol to put before implicit "cc -c" lines (e.g., .c.o)
728 dnl SHOW_CC - symbol to put before explicit "cc -c" lines
729 dnl ECHO_CC - symbol to put before any "cc" line
731 AC_DEFUN([CF_DISABLE_ECHO],[
732 AC_MSG_CHECKING(if you want to see long compiling messages)
734 [ --disable-echo display "compiling" commands],
737 ECHO_LD='@echo linking [$]@;'
738 RULE_CC=' @echo compiling [$]<'
739 SHOW_CC=' @echo compiling [$]@'
744 RULE_CC='# compiling'
745 SHOW_CC='# compiling'
748 AC_MSG_RESULT($enableval)
755 dnl ---------------------------------------------------------------------------
756 dnl CF_ENABLE_WARNINGS version: 3 updated: 2003/05/24 14:24:29
757 dnl ------------------
758 dnl Configure-option to enable gcc warnings
759 AC_DEFUN([CF_ENABLE_WARNINGS],[
760 if ( test "$GCC" = yes || test "$GXX" = yes )
762 AC_MSG_CHECKING(if you want to turn on gcc warnings)
763 CF_ARG_ENABLE(warnings,
764 [ --enable-warnings test: turn on gcc compiler warnings],
767 AC_MSG_RESULT($with_warnings)
768 if test "$with_warnings" = "yes"
774 dnl ---------------------------------------------------------------------------
775 dnl CF_FIND_LIBRARY version: 8 updated: 2004/11/23 20:14:58
777 dnl Look for a non-standard library, given parameters for AC_TRY_LINK. We
778 dnl prefer a standard location, and use -L options only if we do not find the
779 dnl library in the standard library location(s).
780 dnl $1 = library name
781 dnl $2 = library class, usually the same as library name
783 dnl $4 = code fragment to compile/link
784 dnl $5 = corresponding function-name
785 dnl $6 = flag, nonnull if failure should not cause an error-exit
787 dnl Sets the variable "$cf_libdir" as a side-effect, so we can see if we had
788 dnl to use a -L option.
789 AC_DEFUN([CF_FIND_LIBRARY],
791 eval 'cf_cv_have_lib_'$1'=no'
794 eval 'cf_cv_have_lib_'$1'=yes',[
796 AC_MSG_CHECKING(for $5 in -l$1)
798 AC_TRY_LINK([$3],[$4],
800 eval 'cf_cv_have_lib_'$1'=yes'
803 CF_LIBRARY_PATH(cf_search,$2)
804 for cf_libdir in $cf_search
806 AC_MSG_CHECKING(for -l$1 in $cf_libdir)
807 LIBS="-L$cf_libdir -l$1 $cf_save_LIBS"
808 AC_TRY_LINK([$3],[$4],
810 eval 'cf_cv_have_lib_'$1'=yes'
813 LIBS="$cf_save_LIBS"])
817 eval 'cf_found_library=[$]cf_cv_have_lib_'$1
819 if test $cf_found_library = no ; then
820 AC_ERROR(Cannot link $1 library)
824 dnl ---------------------------------------------------------------------------
825 dnl CF_FUNC_CURSES_VERSION version: 4 updated: 2007/04/28 09:15:55
826 dnl ----------------------
827 dnl Solaris has a data item 'curses_version', which confuses AC_CHECK_FUNCS.
828 dnl It's a character string "SVR4", not documented.
829 AC_DEFUN([CF_FUNC_CURSES_VERSION],
831 AC_CACHE_CHECK(for function curses_version, cf_cv_func_curses_version,[
833 #include <${cf_cv_ncurses_header-curses.h}>
837 sprintf(temp, "%s\n", curses_version());
838 ${cf_cv_main_return-return}(0);
840 ,[cf_cv_func_curses_version=yes]
841 ,[cf_cv_func_curses_version=no]
842 ,[cf_cv_func_curses_version=unknown])
844 test "$cf_cv_func_curses_version" = yes && AC_DEFINE(HAVE_CURSES_VERSION)
846 dnl ---------------------------------------------------------------------------
847 dnl CF_GCC_ATTRIBUTES version: 11 updated: 2007/07/29 09:55:12
848 dnl -----------------
849 dnl Test for availability of useful gcc __attribute__ directives to quiet
850 dnl compiler warnings. Though useful, not all are supported -- and contrary
851 dnl to documentation, unrecognized directives cause older compilers to barf.
852 AC_DEFUN([CF_GCC_ATTRIBUTES],
856 cat > conftest.i <<EOF
864 #define GCC_NORETURN /* nothing */
867 #define GCC_UNUSED /* nothing */
872 AC_CHECKING([for $CC __attribute__ directives])
873 cat > conftest.$ac_ext <<EOF
874 #line __oline__ "${as_me-configure}"
875 #include "confdefs.h"
876 #include "conftest.h"
877 #include "conftest.i"
879 #define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
881 #define GCC_PRINTFLIKE(fmt,var) /*nothing*/
884 #define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var)))
886 #define GCC_SCANFLIKE(fmt,var) /*nothing*/
888 extern void wow(char *,...) GCC_SCANFLIKE(1,2);
889 extern void oops(char *,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN;
890 extern void foo(void) GCC_NORETURN;
891 int main(int argc GCC_UNUSED, char *argv[[]] GCC_UNUSED) { return 0; }
893 for cf_attribute in scanf printf unused noreturn
895 CF_UPPER(cf_ATTRIBUTE,$cf_attribute)
896 cf_directive="__attribute__(($cf_attribute))"
897 echo "checking for $CC $cf_directive" 1>&AC_FD_CC
898 case $cf_attribute in
900 cat >conftest.h <<EOF
901 #define GCC_$cf_ATTRIBUTE 1
905 cat >conftest.h <<EOF
906 #define GCC_$cf_ATTRIBUTE $cf_directive
910 if AC_TRY_EVAL(ac_compile); then
911 test -n "$verbose" && AC_MSG_RESULT(... $cf_attribute)
912 cat conftest.h >>confdefs.h
916 fgrep define conftest.i >>confdefs.h
921 dnl ---------------------------------------------------------------------------
922 dnl CF_GCC_VERSION version: 4 updated: 2005/08/27 09:53:42
924 dnl Find version of gcc
925 AC_DEFUN([CF_GCC_VERSION],[
926 AC_REQUIRE([AC_PROG_CC])
928 if test "$GCC" = yes ; then
929 AC_MSG_CHECKING(version of $CC)
930 GCC_VERSION="`${CC} --version| sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`"
931 test -z "$GCC_VERSION" && GCC_VERSION=unknown
932 AC_MSG_RESULT($GCC_VERSION)
935 dnl ---------------------------------------------------------------------------
936 dnl CF_GCC_WARNINGS version: 22 updated: 2007/07/29 09:55:12
938 dnl Check if the compiler supports useful warning options. There's a few that
939 dnl we don't use, simply because they're too noisy:
941 dnl -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x)
942 dnl -Wredundant-decls (system headers make this too noisy)
943 dnl -Wtraditional (combines too many unrelated messages, only a few useful)
944 dnl -Wwrite-strings (too noisy, but should review occasionally). This
945 dnl is enabled for ncurses using "--enable-const".
949 dnl $1 is an optional list of gcc warning flags that a particular
950 dnl application might want to use, e.g., "no-unused" for
953 dnl If $with_ext_const is "yes", add a check for -Wwrite-strings
955 AC_DEFUN([CF_GCC_WARNINGS],
957 AC_REQUIRE([CF_GCC_VERSION])
958 CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS)
960 cat > conftest.$ac_ext <<EOF
961 #line __oline__ "${as_me-configure}"
962 int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; }
965 if test "$INTEL_COMPILER" = yes
967 # The "-wdXXX" options suppress warnings:
968 # remark #1419: external declaration in primary source file
969 # remark #1682: implicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
970 # remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
971 # remark #1684: conversion from pointer to same-sized integral type (potential portability problem)
972 # remark #193: zero used for undefined preprocessing identifier
973 # remark #593: variable "curs_sb_left_arrow" was set but never used
974 # remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits
975 # remark #869: parameter "tw" was never referenced
976 # remark #981: operands are evaluated in unspecified order
977 # warning #269: invalid format string conversion
979 AC_CHECKING([for $CC warning options])
980 cf_save_CFLAGS="$CFLAGS"
994 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
995 if AC_TRY_EVAL(ac_compile); then
996 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
997 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
1000 CFLAGS="$cf_save_CFLAGS"
1002 elif test "$GCC" = yes
1004 AC_CHECKING([for $CC warning options])
1005 cf_save_CFLAGS="$CFLAGS"
1006 EXTRA_CFLAGS="-W -Wall"
1008 test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings"
1010 Wbad-function-cast \
1014 Wmissing-declarations \
1015 Wmissing-prototypes \
1019 Wstrict-prototypes \
1020 Wundef $cf_warn_CONST $1
1022 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
1023 if AC_TRY_EVAL(ac_compile); then
1024 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
1025 case $cf_opt in #(vi
1027 CPPFLAGS="$CPPFLAGS -DXTSTRINGDEFINES"
1030 case $GCC_VERSION in
1032 CF_VERBOSE(feature is broken in gcc $GCC_VERSION)
1037 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
1040 CFLAGS="$cf_save_CFLAGS"
1044 AC_SUBST(EXTRA_CFLAGS)
1046 dnl ---------------------------------------------------------------------------
1047 dnl CF_GNU_SOURCE version: 6 updated: 2005/07/09 13:23:07
1049 dnl Check if we must define _GNU_SOURCE to get a reasonable value for
1050 dnl _XOPEN_SOURCE, upon which many POSIX definitions depend. This is a defect
1051 dnl (or misfeature) of glibc2, which breaks portability of many applications,
1052 dnl since it is interwoven with GNU extensions.
1054 dnl Well, yes we could work around it...
1055 AC_DEFUN([CF_GNU_SOURCE],
1057 AC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[
1058 AC_TRY_COMPILE([#include <sys/types.h>],[
1059 #ifndef _XOPEN_SOURCE
1062 [cf_cv_gnu_source=no],
1063 [cf_save="$CPPFLAGS"
1064 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
1065 AC_TRY_COMPILE([#include <sys/types.h>],[
1066 #ifdef _XOPEN_SOURCE
1069 [cf_cv_gnu_source=no],
1070 [cf_cv_gnu_source=yes])
1074 test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
1076 dnl ---------------------------------------------------------------------------
1077 dnl CF_HEADER_PATH version: 8 updated: 2002/11/10 14:46:59
1079 dnl Construct a search-list for a nonstandard header-file
1080 AC_DEFUN([CF_HEADER_PATH],
1081 [CF_SUBDIR_PATH($1,$2,include)
1082 test "$includedir" != NONE && \
1083 test "$includedir" != "/usr/include" && \
1084 test -d "$includedir" && {
1085 test -d $includedir && $1="[$]$1 $includedir"
1086 test -d $includedir/$2 && $1="[$]$1 $includedir/$2"
1089 test "$oldincludedir" != NONE && \
1090 test "$oldincludedir" != "/usr/include" && \
1091 test -d "$oldincludedir" && {
1092 test -d $oldincludedir && $1="[$]$1 $oldincludedir"
1093 test -d $oldincludedir/$2 && $1="[$]$1 $oldincludedir/$2"
1097 dnl ---------------------------------------------------------------------------
1098 dnl CF_INHERIT_SCRIPT version: 2 updated: 2003/03/01 23:50:42
1099 dnl -----------------
1100 dnl If we do not have a given script, look for it in the parent directory.
1101 AC_DEFUN([CF_INHERIT_SCRIPT],
1103 test -f $1 || ( test -f ../$1 && cp ../$1 ./ )
1105 dnl ---------------------------------------------------------------------------
1106 dnl CF_INTEL_COMPILER version: 3 updated: 2005/08/06 18:37:29
1107 dnl -----------------
1108 dnl Check if the given compiler is really the Intel compiler for Linux. It
1109 dnl tries to imitate gcc, but does not return an error when it finds a mismatch
1110 dnl between prototypes, e.g., as exercised by CF_MISSING_CHECK.
1112 dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to
1113 dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from
1114 dnl the wrappers for gcc and g++ warnings.
1116 dnl $1 = GCC (default) or GXX
1117 dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS
1118 dnl $3 = CFLAGS (default) or CXXFLAGS
1119 AC_DEFUN([CF_INTEL_COMPILER],[
1120 ifelse($2,,INTEL_COMPILER,[$2])=no
1122 if test "$ifelse($1,,[$1],GCC)" = yes ; then
1125 AC_MSG_CHECKING(if this is really Intel ifelse($1,GXX,C++,C) compiler)
1126 cf_save_CFLAGS="$ifelse($3,,CFLAGS,[$3])"
1127 ifelse($3,,CFLAGS,[$3])="$ifelse($3,,CFLAGS,[$3]) -no-gcc"
1129 #ifdef __INTEL_COMPILER
1133 ],[ifelse($2,,INTEL_COMPILER,[$2])=yes
1134 cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc"
1136 ifelse($3,,CFLAGS,[$3])="$cf_save_CFLAGS"
1137 AC_MSG_RESULT($ifelse($2,,INTEL_COMPILER,[$2]))
1142 dnl ---------------------------------------------------------------------------
1143 dnl CF_LIBRARY_PATH version: 7 updated: 2002/11/10 14:46:59
1145 dnl Construct a search-list for a nonstandard library-file
1146 AC_DEFUN([CF_LIBRARY_PATH],
1147 [CF_SUBDIR_PATH($1,$2,lib)])dnl
1148 dnl ---------------------------------------------------------------------------
1149 dnl CF_MSG_LOG version: 4 updated: 2007/07/29 09:55:12
1151 dnl Write a debug message to config.log, along with the line number in the
1152 dnl configure script.
1153 AC_DEFUN([CF_MSG_LOG],[
1154 echo "${as_me-configure}:__oline__: testing $* ..." 1>&AC_FD_CC
1156 dnl ---------------------------------------------------------------------------
1157 dnl CF_NCURSES_CC_CHECK version: 4 updated: 2007/07/29 10:39:05
1158 dnl -------------------
1159 dnl Check if we can compile with ncurses' header file
1160 dnl $1 is the cache variable to set
1161 dnl $2 is the header-file to include
1162 dnl $3 is the root name (ncurses or ncursesw)
1163 AC_DEFUN([CF_NCURSES_CC_CHECK],[
1165 ]ifelse($3,ncursesw,[
1166 #define _XOPEN_SOURCE_EXTENDED
1167 #undef HAVE_LIBUTF8_H /* in case we used CF_UTF8_LIB */
1168 #define HAVE_LIBUTF8_H /* to force ncurses' header file to use cchar_t */
1171 #ifdef NCURSES_VERSION
1172 ]ifelse($3,ncursesw,[
1177 printf("%s\n", NCURSES_VERSION);
1189 dnl ---------------------------------------------------------------------------
1190 dnl CF_NCURSES_CPPFLAGS version: 19 updated: 2007/07/29 13:35:20
1191 dnl -------------------
1192 dnl Look for the SVr4 curses clone 'ncurses' in the standard places, adjusting
1193 dnl the CPPFLAGS variable so we can include its header.
1195 dnl The header files may be installed as either curses.h, or ncurses.h (would
1196 dnl be obsolete, except that some packagers prefer this name to distinguish it
1197 dnl from a "native" curses implementation). If not installed for overwrite,
1198 dnl the curses.h file would be in an ncurses subdirectory (e.g.,
1199 dnl /usr/include/ncurses), but someone may have installed overwriting the
1200 dnl vendor's curses. Only very old versions (pre-1.9.2d, the first autoconf'd
1201 dnl version) of ncurses don't define either __NCURSES_H or NCURSES_VERSION in
1204 dnl If the installer has set $CFLAGS or $CPPFLAGS so that the ncurses header
1205 dnl is already in the include-path, don't even bother with this, since we cannot
1206 dnl easily determine which file it is. In this case, it has to be <curses.h>.
1208 dnl The optional parameter gives the root name of the library, in case it is
1209 dnl not installed as the default curses library. That is how the
1210 dnl wide-character version of ncurses is installed.
1211 AC_DEFUN([CF_NCURSES_CPPFLAGS],
1212 [AC_REQUIRE([CF_WITH_CURSES_DIR])
1214 AC_PROVIDE([CF_CURSES_CPPFLAGS])dnl
1215 cf_ncuhdr_root=ifelse($1,,ncurses,$1)
1217 test -n "$cf_cv_curses_dir" && \
1218 test "$cf_cv_curses_dir" != "no" && { \
1219 CF_ADD_INCDIR($cf_cv_curses_dir/include $cf_cv_curses_dir/include/$cf_ncuhdr_root)
1222 AC_CACHE_CHECK(for $cf_ncuhdr_root header in include-path, cf_cv_ncurses_h,[
1223 cf_header_list="$cf_ncuhdr_root/curses.h $cf_ncuhdr_root/ncurses.h"
1224 ( test "$cf_ncuhdr_root" = ncurses || test "$cf_ncuhdr_root" = ncursesw ) && cf_header_list="$cf_header_list curses.h ncurses.h"
1225 for cf_header in $cf_header_list
1227 CF_NCURSES_CC_CHECK(cf_cv_ncurses_h,$cf_header,$1)
1228 test "$cf_cv_ncurses_h" != no && break
1235 # some applications need this, but should check for NCURSES_VERSION
1240 dnl ---------------------------------------------------------------------------
1241 dnl CF_NCURSES_HEADER version: 1 updated: 2005/12/31 13:28:37
1242 dnl -----------------
1243 dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common
1244 dnl variations of ncurses' installs.
1246 dnl See also CF_CURSES_HEADER, which sets the same cache variable.
1247 AC_DEFUN([CF_NCURSES_HEADER],[
1249 if test "$cf_cv_ncurses_h" != no ; then
1250 cf_cv_ncurses_header=$cf_cv_ncurses_h
1253 AC_CACHE_CHECK(for $cf_ncuhdr_root include-path, cf_cv_ncurses_h2,[
1254 test -n "$verbose" && echo
1255 CF_HEADER_PATH(cf_search,$cf_ncuhdr_root)
1256 test -n "$verbose" && echo search path $cf_search
1257 cf_save2_CPPFLAGS="$CPPFLAGS"
1258 for cf_incdir in $cf_search
1260 CF_ADD_INCDIR($cf_incdir)
1265 CF_NCURSES_CC_CHECK(cf_cv_ncurses_h2,$cf_header,$1)
1266 if test "$cf_cv_ncurses_h2" != no ; then
1267 cf_cv_ncurses_h2=$cf_incdir/$cf_header
1268 test -n "$verbose" && echo $ac_n " ... found $ac_c" 1>&AC_FD_MSG
1271 test -n "$verbose" && echo " ... tested $cf_incdir/$cf_header" 1>&AC_FD_MSG
1273 CPPFLAGS="$cf_save2_CPPFLAGS"
1274 test "$cf_cv_ncurses_h2" != no && break
1276 test "$cf_cv_ncurses_h2" = no && AC_ERROR(not found)
1279 CF_DIRNAME(cf_1st_incdir,$cf_cv_ncurses_h2)
1280 cf_cv_ncurses_header=`basename $cf_cv_ncurses_h2`
1281 if test `basename $cf_1st_incdir` = $cf_ncuhdr_root ; then
1282 cf_cv_ncurses_header=$cf_ncuhdr_root/$cf_cv_ncurses_header
1284 CF_ADD_INCDIR($cf_1st_incdir)
1288 # Set definitions to allow ifdef'ing for ncurses.h
1290 case $cf_cv_ncurses_header in # (vi
1292 AC_DEFINE(HAVE_NCURSES_H)
1296 case $cf_cv_ncurses_header in # (vi
1297 ncurses/curses.h|ncurses/ncurses.h)
1298 AC_DEFINE(HAVE_NCURSES_NCURSES_H)
1300 ncursesw/curses.h|ncursesw/ncurses.h)
1301 AC_DEFINE(HAVE_NCURSESW_NCURSES_H)
1306 dnl ---------------------------------------------------------------------------
1307 dnl CF_NCURSES_LIBS version: 13 updated: 2007/07/29 10:29:20
1309 dnl Look for the ncurses library. This is a little complicated on Linux,
1310 dnl because it may be linked with the gpm (general purpose mouse) library.
1311 dnl Some distributions have gpm linked with (bsd) curses, which makes it
1312 dnl unusable with ncurses. However, we don't want to link with gpm unless
1313 dnl ncurses has a dependency, since gpm is normally set up as a shared library,
1314 dnl and the linker will record a dependency.
1316 dnl The optional parameter gives the root name of the library, in case it is
1317 dnl not installed as the default curses library. That is how the
1318 dnl wide-character version of ncurses is installed.
1319 AC_DEFUN([CF_NCURSES_LIBS],
1320 [AC_REQUIRE([CF_NCURSES_CPPFLAGS])
1322 cf_nculib_root=ifelse($1,,ncurses,$1)
1323 # This works, except for the special case where we find gpm, but
1324 # ncurses is in a nonstandard location via $LIBS, and we really want
1327 cf_ncurses_SAVE="$LIBS"
1328 AC_CHECK_LIB(gpm,Gpm_Open,
1329 [AC_CHECK_LIB(gpm,initscr,
1330 [LIBS="$cf_ncurses_SAVE"],
1331 [cf_ncurses_LIBS="-lgpm"])])
1333 case $host_os in #(vi
1335 # This is only necessary if you are linking against an obsolete
1336 # version of ncurses (but it should do no harm, since it's static).
1337 if test "$cf_nculib_root" = ncurses ; then
1338 AC_CHECK_LIB(mytinfo,tgoto,[cf_ncurses_LIBS="-lmytinfo $cf_ncurses_LIBS"])
1343 LIBS="$cf_ncurses_LIBS $LIBS"
1345 if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" )
1347 CF_ADD_LIBDIR($cf_cv_curses_dir/lib)
1348 LIBS="-l$cf_nculib_root $LIBS"
1350 CF_FIND_LIBRARY($cf_nculib_root,$cf_nculib_root,
1351 [#include <${cf_cv_ncurses_header-curses.h}>],
1356 if test -n "$cf_ncurses_LIBS" ; then
1357 AC_MSG_CHECKING(if we can link $cf_nculib_root without $cf_ncurses_LIBS)
1358 cf_ncurses_SAVE="$LIBS"
1359 for p in $cf_ncurses_LIBS ; do
1360 q=`echo $LIBS | sed -e "s%$p %%" -e "s%$p$%%"`
1361 if test "$q" != "$LIBS" ; then
1365 AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>],
1366 [initscr(); mousemask(0,0); tgoto((char *)0, 0, 0);],
1367 [AC_MSG_RESULT(yes)],
1369 LIBS="$cf_ncurses_SAVE"])
1372 CF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_nculib_root)
1373 AC_DEFINE_UNQUOTED($cf_nculib_ROOT)
1375 dnl ---------------------------------------------------------------------------
1376 dnl CF_NCURSES_VERSION version: 12 updated: 2007/04/28 09:15:55
1377 dnl ------------------
1378 dnl Check for the version of ncurses, to aid in reporting bugs, etc.
1379 dnl Call CF_CURSES_CPPFLAGS first, or CF_NCURSES_CPPFLAGS. We don't use
1380 dnl AC_REQUIRE since that does not work with the shell's if/then/else/fi.
1381 AC_DEFUN([CF_NCURSES_VERSION],
1383 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
1384 AC_CACHE_CHECK(for ncurses version, cf_cv_ncurses_version,[
1385 cf_cv_ncurses_version=no
1389 #include <${cf_cv_ncurses_header-curses.h}>
1393 FILE *fp = fopen("$cf_tempfile", "w");
1394 #ifdef NCURSES_VERSION
1395 # ifdef NCURSES_VERSION_PATCH
1396 fprintf(fp, "%s.%d\n", NCURSES_VERSION, NCURSES_VERSION_PATCH);
1398 fprintf(fp, "%s\n", NCURSES_VERSION);
1402 fprintf(fp, "old\n");
1407 ${cf_cv_main_return-return}(0);
1409 cf_cv_ncurses_version=`cat $cf_tempfile`],,[
1411 # This will not work if the preprocessor splits the line after the
1412 # Autoconf token. The 'unproto' program does that.
1413 cat > conftest.$ac_ext <<EOF
1414 #include <${cf_cv_ncurses_header-curses.h}>
1416 #ifdef NCURSES_VERSION
1417 Autoconf NCURSES_VERSION
1425 cf_try="$ac_cpp conftest.$ac_ext 2>&AC_FD_CC | grep '^Autoconf ' >conftest.out"
1427 if test -f conftest.out ; then
1428 cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[[^"]]*"%%' -e 's%".*%%'`
1429 test -n "$cf_out" && cf_cv_ncurses_version="$cf_out"
1435 test "$cf_cv_ncurses_version" = no || AC_DEFINE(NCURSES)
1437 dnl ---------------------------------------------------------------------------
1438 dnl CF_PATH_SYNTAX version: 11 updated: 2006/09/02 08:55:46
1440 dnl Check the argument to see that it looks like a pathname. Rewrite it if it
1441 dnl begins with one of the prefix/exec_prefix variables, and then again if the
1442 dnl result begins with 'NONE'. This is necessary to work around autoconf's
1443 dnl delayed evaluation of those symbols.
1444 AC_DEFUN([CF_PATH_SYNTAX],[
1445 if test "x$prefix" != xNONE; then
1446 cf_path_syntax="$prefix"
1448 cf_path_syntax="$ac_default_prefix"
1451 case ".[$]$1" in #(vi
1452 .\[$]\(*\)*|.\'*\'*) #(vi
1456 .[[a-zA-Z]]:[[\\/]]*) #(vi OS/2 EMX
1458 .\[$]{*prefix}*) #(vi
1460 case ".[$]$1" in #(vi
1462 $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%`
1467 $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%`
1470 ifelse($2,,[AC_ERROR([expected a pathname, not \"[$]$1\"])],$2)
1474 dnl ---------------------------------------------------------------------------
1475 dnl CF_PDCURSES_X11 version: 7 updated: 2006/11/12 17:31:59
1477 dnl Configure for PDCurses' X11 library
1478 AC_DEFUN([CF_PDCURSES_X11],[
1479 AC_REQUIRE([CF_X_ATHENA])
1481 AC_PATH_PROGS(XCURSES_CONFIG,xcurses-config,none)
1483 if test "$XCURSES_CONFIG" != none ; then
1485 CPPFLAGS="`$XCURSES_CONFIG --cflags` $CPPFLAGS"
1486 LIBS="`$XCURSES_CONFIG --libs` $LIBS"
1488 cf_cv_lib_XCurses=yes
1492 LDFLAGS="$LDFLAGS $X_LIBS"
1493 CF_CHECK_CFLAGS($X_CFLAGS)
1494 AC_CHECK_LIB(X11,XOpenDisplay,
1495 [LIBS="-lX11 $LIBS"],,
1496 [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])
1497 AC_CACHE_CHECK(for XCurses library,cf_cv_lib_XCurses,[
1498 LIBS="-lXCurses $LIBS"
1500 #include <xcurses.h>
1501 char *XCursesProgramName = "test";
1503 [cf_cv_lib_XCurses=yes],
1504 [cf_cv_lib_XCurses=no])
1509 if test $cf_cv_lib_XCurses = yes ; then
1512 AC_DEFINE(HAVE_XCURSES)
1514 AC_ERROR(Cannot link with XCurses)
1517 dnl ---------------------------------------------------------------------------
1518 dnl CF_POSIX_C_SOURCE version: 6 updated: 2005/07/14 20:25:10
1519 dnl -----------------
1520 dnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed.
1522 dnl POSIX.1-1990 _POSIX_SOURCE
1523 dnl POSIX.1-1990 and _POSIX_SOURCE and
1524 dnl POSIX.2-1992 C-Language _POSIX_C_SOURCE=2
1526 dnl POSIX.1b-1993 _POSIX_C_SOURCE=199309L
1527 dnl POSIX.1c-1996 _POSIX_C_SOURCE=199506L
1528 dnl X/Open 2000 _POSIX_C_SOURCE=200112L
1531 dnl $1 is the nominal value for _POSIX_C_SOURCE
1532 AC_DEFUN([CF_POSIX_C_SOURCE],
1534 cf_POSIX_C_SOURCE=ifelse($1,,199506L,$1)
1536 cf_save_CFLAGS="$CFLAGS"
1537 cf_save_CPPFLAGS="$CPPFLAGS"
1539 CF_REMOVE_DEFINE(cf_trim_CFLAGS,$cf_save_CFLAGS,_POSIX_C_SOURCE)
1540 CF_REMOVE_DEFINE(cf_trim_CPPFLAGS,$cf_save_CPPFLAGS,_POSIX_C_SOURCE)
1542 AC_CACHE_CHECK(if we should define _POSIX_C_SOURCE,cf_cv_posix_c_source,[
1543 CF_MSG_LOG(if the symbol is already defined go no further)
1544 AC_TRY_COMPILE([#include <sys/types.h>],[
1545 #ifndef _POSIX_C_SOURCE
1548 [cf_cv_posix_c_source=no],
1549 [cf_want_posix_source=no
1550 case .$cf_POSIX_C_SOURCE in #(vi
1552 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
1555 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
1556 cf_want_posix_source=yes
1559 cf_want_posix_source=yes
1562 if test "$cf_want_posix_source" = yes ; then
1563 AC_TRY_COMPILE([#include <sys/types.h>],[
1564 #ifdef _POSIX_SOURCE
1567 cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE")
1569 CF_MSG_LOG(ifdef from value $cf_POSIX_C_SOURCE)
1570 CFLAGS="$cf_trim_CFLAGS"
1571 CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source"
1572 CF_MSG_LOG(if the second compile does not leave our definition intact error)
1573 AC_TRY_COMPILE([#include <sys/types.h>],[
1574 #ifndef _POSIX_C_SOURCE
1577 [cf_cv_posix_c_source=no])
1578 CFLAGS="$cf_save_CFLAGS"
1579 CPPFLAGS="$cf_save_CPPFLAGS"
1583 if test "$cf_cv_posix_c_source" != no ; then
1584 CFLAGS="$cf_trim_CFLAGS"
1585 CPPFLAGS="$cf_trim_CPPFLAGS"
1586 if test "$cf_cv_cc_u_d_options" = yes ; then
1587 cf_temp_posix_c_source=`echo "$cf_cv_posix_c_source" | \
1588 sed -e 's/-D/-U/g' -e 's/=[[^ ]]*//g'`
1589 CPPFLAGS="$CPPFLAGS $cf_temp_posix_c_source"
1591 CPPFLAGS="$CPPFLAGS $cf_cv_posix_c_source"
1595 dnl ---------------------------------------------------------------------------
1596 dnl CF_PRG_RULES version: 1 updated: 2006/06/03 11:45:08
1598 dnl Append definitions and rules for the given programs to the subdirectory
1599 dnl Makefiles, and the recursion rule for the top-level Makefile.
1602 dnl $1 = script to run
1603 dnl $2 = list of subdirectories
1607 AC_DEFUN([CF_PRG_RULES],
1611 if test ! -d $srcdir/$cf_dir; then
1613 elif test -f $srcdir/$cf_dir/programs; then
1614 $AWK -f $1 $srcdir/$cf_dir/programs >>$cf_dir/Makefile
1619 dnl ---------------------------------------------------------------------------
1620 dnl CF_PROG_CC_U_D version: 1 updated: 2005/07/14 16:59:30
1622 dnl Check if C (preprocessor) -U and -D options are processed in the order
1623 dnl given rather than by type of option. Some compilers insist on apply all
1624 dnl of the -U options after all of the -D options. Others allow mixing them,
1625 dnl and may predefine symbols that conflict with those we define.
1626 AC_DEFUN([CF_PROG_CC_U_D],
1628 AC_CACHE_CHECK(if $CC -U and -D options work together,cf_cv_cc_u_d_options,[
1629 cf_save_CPPFLAGS="$CPPFLAGS"
1630 CPPFLAGS="-UU_D_OPTIONS -DU_D_OPTIONS -DD_U_OPTIONS -UD_U_OPTIONS"
1633 make an undefined-error
1636 make a defined-error
1639 cf_cv_cc_u_d_options=yes],[
1640 cf_cv_cc_u_d_options=no])
1641 CPPFLAGS="$cf_save_CPPFLAGS"
1644 dnl ---------------------------------------------------------------------------
1645 dnl CF_REMOVE_DEFINE version: 2 updated: 2005/07/09 16:12:18
1646 dnl ----------------
1647 dnl Remove all -U and -D options that refer to the given symbol from a list
1648 dnl of C compiler options. This works around the problem that not all
1649 dnl compilers process -U and -D options from left-to-right, so a -U option
1650 dnl cannot be used to cancel the effect of a preceding -D option.
1652 dnl $1 = target (which could be the same as the source variable)
1653 dnl $2 = source (including '$')
1654 dnl $3 = symbol to remove
1655 define([CF_REMOVE_DEFINE],
1657 # remove $3 symbol from $2
1659 sed -e 's/-[[UD]]$3\(=[[^ ]]*\)\?[[ ]]/ /g' \
1660 -e 's/-[[UD]]$3\(=[[^ ]]*\)\?[$]//g'`
1662 dnl ---------------------------------------------------------------------------
1663 dnl CF_SIG_ATOMIC_T version: 2 updated: 2005/09/18 17:27:12
1665 dnl signal handler, but there are some gcc depedencies in that recommendation.
1667 AC_DEFUN([CF_SIG_ATOMIC_T],
1669 AC_MSG_CHECKING(for signal global datatype)
1670 AC_CACHE_VAL(cf_cv_sig_atomic_t,[
1672 "volatile sig_atomic_t" \
1677 #include <sys/types.h>
1683 static void handler(int sig)
1687 [signal(SIGINT, handler);
1689 [cf_cv_sig_atomic_t=$cf_type],
1690 [cf_cv_sig_atomic_t=no])
1691 test "$cf_cv_sig_atomic_t" != no && break
1694 AC_MSG_RESULT($cf_cv_sig_atomic_t)
1695 test "$cf_cv_sig_atomic_t" != no && AC_DEFINE_UNQUOTED(SIG_ATOMIC_T, $cf_cv_sig_atomic_t)
1697 dnl ---------------------------------------------------------------------------
1698 dnl CF_SUBDIR_PATH version: 5 updated: 2007/07/29 09:55:12
1700 dnl Construct a search-list for a nonstandard header/lib-file
1701 dnl $1 = the variable to return as result
1702 dnl $2 = the package name
1703 dnl $3 = the subdirectory, e.g., bin, include or lib
1704 AC_DEFUN([CF_SUBDIR_PATH],
1707 CF_ADD_SUBDIR_PATH($1,$2,$3,/usr,$prefix)
1708 CF_ADD_SUBDIR_PATH($1,$2,$3,$prefix,NONE)
1709 CF_ADD_SUBDIR_PATH($1,$2,$3,/usr/local,$prefix)
1710 CF_ADD_SUBDIR_PATH($1,$2,$3,/opt,$prefix)
1711 CF_ADD_SUBDIR_PATH($1,$2,$3,[$]HOME,$prefix)
1713 dnl ---------------------------------------------------------------------------
1714 dnl CF_SYS_TIME_SELECT version: 4 updated: 2000/10/04 09:18:40
1715 dnl ------------------
1716 dnl Check if we can include <sys/time.h> with <sys/select.h>; this breaks on
1717 dnl older SCO configurations.
1718 AC_DEFUN([CF_SYS_TIME_SELECT],
1720 AC_MSG_CHECKING(if sys/time.h works with sys/select.h)
1721 AC_CACHE_VAL(cf_cv_sys_time_select,[
1723 #include <sys/types.h>
1724 #ifdef HAVE_SYS_TIME_H
1725 #include <sys/time.h>
1727 #ifdef HAVE_SYS_SELECT_H
1728 #include <sys/select.h>
1730 ],[],[cf_cv_sys_time_select=yes],
1731 [cf_cv_sys_time_select=no])
1733 AC_MSG_RESULT($cf_cv_sys_time_select)
1734 test "$cf_cv_sys_time_select" = yes && AC_DEFINE(HAVE_SYS_TIME_SELECT)
1736 dnl ---------------------------------------------------------------------------
1737 dnl CF_TERM_HEADER version: 1 updated: 2005/12/31 13:26:39
1739 dnl Look for term.h, which is part of X/Open curses. It defines the interface
1740 dnl to terminfo database. Usually it is in the same include-path as curses.h,
1741 dnl but some packagers change this, breaking various applications.
1742 AC_DEFUN([CF_TERM_HEADER],[
1743 AC_CACHE_CHECK(for terminfo header, cf_cv_term_header,[
1744 case ${cf_cv_ncurses_header} in #(vi
1745 */ncurses.h|*/ncursesw.h) #(vi
1746 cf_term_header=`echo "$cf_cv_ncurses_header" | sed -e 's%ncurses[[^.]]*\.h$%term.h%'`
1749 cf_term_header=term.h
1753 for cf_test in $cf_term_header "ncurses/term.h" "ncursesw/term.h"
1755 AC_TRY_COMPILE([#include <stdio.h>
1756 #include <${cf_cv_ncurses_header-curses.h}>
1758 ],[int x = auto_left_margin],[
1759 cf_cv_term_header="$cf_test"],[
1760 cf_cv_term_header=unknown
1762 test "$cf_cv_term_header" != unknown && break
1766 # Set definitions to allow ifdef'ing to accommodate subdirectories
1768 case $cf_cv_term_header in # (vi
1770 AC_DEFINE(HAVE_TERM_H)
1774 case $cf_cv_term_header in # (vi
1775 ncurses/term.h) #(vi
1776 AC_DEFINE(HAVE_NCURSES_TERM_H)
1779 AC_DEFINE(HAVE_NCURSESW_TERM_H)
1783 dnl ---------------------------------------------------------------------------
1784 dnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59
1786 dnl Make an uppercase version of a variable
1787 dnl $1=uppercase($2)
1788 AC_DEFUN([CF_UPPER],
1790 $1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
1792 dnl ---------------------------------------------------------------------------
1793 dnl CF_UTF8_LIB version: 4 updated: 2003/03/01 18:36:42
1795 dnl Check for multibyte support, and if not found, utf8 compatibility library
1796 AC_DEFUN([CF_UTF8_LIB],
1798 AC_CACHE_CHECK(for multibyte character support,cf_cv_utf8_lib,[
1799 cf_save_LIBS="$LIBS"
1801 #include <stdlib.h>],[putwc(0,0);],
1802 [cf_cv_utf8_lib=yes],
1803 [LIBS="-lutf8 $LIBS"
1805 #include <libutf8.h>],[putwc(0,0);],
1806 [cf_cv_utf8_lib=add-on],
1807 [cf_cv_utf8_lib=no])
1808 LIBS="$cf_save_LIBS"
1811 # HAVE_LIBUTF8_H is used by ncurses if curses.h is shared between
1813 if test "$cf_cv_utf8_lib" = "add-on" ; then
1814 AC_DEFINE(HAVE_LIBUTF8_H)
1818 dnl ---------------------------------------------------------------------------
1819 dnl CF_VERBOSE version: 3 updated: 2007/07/29 09:55:12
1821 dnl Use AC_VERBOSE w/o the warnings
1822 AC_DEFUN([CF_VERBOSE],
1823 [test -n "$verbose" && echo " $1" 1>&AC_FD_MSG
1826 dnl ---------------------------------------------------------------------------
1827 dnl CF_WITH_CURSES_DIR version: 2 updated: 2002/11/10 14:46:59
1828 dnl ------------------
1829 dnl Wrapper for AC_ARG_WITH to specify directory under which to look for curses
1831 AC_DEFUN([CF_WITH_CURSES_DIR],[
1832 AC_ARG_WITH(curses-dir,
1833 [ --with-curses-dir=DIR directory in which (n)curses is installed],
1834 [CF_PATH_SYNTAX(withval)
1835 cf_cv_curses_dir=$withval],
1836 [cf_cv_curses_dir=no])
1838 dnl ---------------------------------------------------------------------------
1839 dnl CF_XOPEN_CURSES version: 8 updated: 2003/11/07 19:47:46
1841 dnl Test if we should define X/Open source for curses, needed on Digital Unix
1842 dnl 4.x, to see the extended functions, but breaks on IRIX 6.x.
1844 dnl The getbegyx() check is needed for HPUX, which omits legacy macros such
1845 dnl as getbegy(). The latter is better design, but the former is standard.
1846 AC_DEFUN([CF_XOPEN_CURSES],
1848 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
1849 AC_CACHE_CHECK(if we must define _XOPEN_SOURCE_EXTENDED,cf_cv_need_xopen_extension,[
1852 #include <${cf_cv_ncurses_header-curses.h}>],[
1853 long x = winnstr(stdscr, "", 0);
1855 getbegyx(stdscr, y1, x1)],
1856 [cf_cv_need_xopen_extension=no],
1858 #define _XOPEN_SOURCE_EXTENDED
1860 #include <${cf_cv_ncurses_header-curses.h}>],[
1861 long x = winnstr(stdscr, "", 0);
1863 getbegyx(stdscr, y1, x1)],
1864 [cf_cv_need_xopen_extension=yes],
1865 [cf_cv_need_xopen_extension=unknown])])])
1866 test $cf_cv_need_xopen_extension = yes && CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED"
1868 dnl ---------------------------------------------------------------------------
1869 dnl CF_XOPEN_SOURCE version: 25 updated: 2007/01/29 18:36:38
1871 dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions,
1872 dnl or adapt to the vendor's definitions to get equivalent functionality,
1873 dnl without losing the common non-POSIX features.
1876 dnl $1 is the nominal value for _XOPEN_SOURCE
1877 dnl $2 is the nominal value for _POSIX_C_SOURCE
1878 AC_DEFUN([CF_XOPEN_SOURCE],[
1880 AC_REQUIRE([CF_PROG_CC_U_D])
1882 cf_XOPEN_SOURCE=ifelse($1,,500,$1)
1883 cf_POSIX_C_SOURCE=ifelse($2,,199506L,$2)
1885 case $host_os in #(vi
1887 CPPFLAGS="$CPPFLAGS -D_ALL_SOURCE"
1890 # 5.x headers associate
1891 # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L
1892 # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L
1893 cf_POSIX_C_SOURCE=200112L
1895 CPPFLAGS="$CPPFLAGS -D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
1898 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE"
1901 CPPFLAGS="$CPPFLAGS -D_SGI_SOURCE"
1903 linux*|gnu*|k*bsd*-gnu) #(vi
1907 # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <arpa/inet.h>
1910 # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw
1913 # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw
1916 CPPFLAGS="$CPPFLAGS -D_OSF_SOURCE"
1919 CPPFLAGS="$CPPFLAGS -D_QNX_SOURCE"
1922 # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer
1925 CPPFLAGS="$CPPFLAGS -D__EXTENSIONS__"
1928 AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[
1929 AC_TRY_COMPILE([#include <sys/types.h>],[
1930 #ifndef _XOPEN_SOURCE
1933 [cf_cv_xopen_source=no],
1934 [cf_save="$CPPFLAGS"
1935 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
1936 AC_TRY_COMPILE([#include <sys/types.h>],[
1937 #ifdef _XOPEN_SOURCE
1940 [cf_cv_xopen_source=no],
1941 [cf_cv_xopen_source=$cf_XOPEN_SOURCE])
1945 if test "$cf_cv_xopen_source" != no ; then
1946 CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE)
1947 CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE)
1948 test "$cf_cv_cc_u_d_options" = yes && \
1949 CPPFLAGS="$CPPFLAGS -U_XOPEN_SOURCE"
1950 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_cv_xopen_source"
1952 CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE)
1956 dnl ---------------------------------------------------------------------------
1957 dnl CF_X_ATHENA version: 12 updated: 2004/06/15 21:14:41
1959 dnl Check for Xaw (Athena) libraries
1961 dnl Sets $cf_x_athena according to the flavor of Xaw which is used.
1962 AC_DEFUN([CF_X_ATHENA],
1963 [AC_REQUIRE([CF_X_TOOLKIT])
1964 cf_x_athena=${cf_x_athena-Xaw}
1966 AC_MSG_CHECKING(if you want to link with Xaw 3d library)
1969 [ --with-Xaw3d link with Xaw 3d library])
1970 if test "$withval" = yes ; then
1977 AC_MSG_CHECKING(if you want to link with neXT Athena library)
1980 [ --with-neXtaw link with neXT Athena library])
1981 if test "$withval" = yes ; then
1988 AC_MSG_CHECKING(if you want to link with Athena-Plus library)
1990 AC_ARG_WITH(XawPlus,
1991 [ --with-XawPlus link with Athena-Plus library])
1992 if test "$withval" = yes ; then
1999 AC_CHECK_LIB(Xext,XextCreateExtension,
2000 [LIBS="-lXext $LIBS"])
2004 CF_X_ATHENA_CPPFLAGS($cf_x_athena)
2005 CF_X_ATHENA_LIBS($cf_x_athena)
2007 dnl ---------------------------------------------------------------------------
2008 dnl CF_X_ATHENA_CPPFLAGS version: 2 updated: 2002/10/09 20:00:37
2009 dnl --------------------
2010 dnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of
2011 dnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw.
2012 AC_DEFUN([CF_X_ATHENA_CPPFLAGS],
2014 cf_x_athena_root=ifelse($1,,Xaw,$1)
2015 cf_x_athena_include=""
2017 for cf_path in default \
2018 /usr/contrib/X11R6 \
2019 /usr/contrib/X11R5 \
2023 if test -z "$cf_x_athena_include" ; then
2025 cf_test=X11/$cf_x_athena_root/SimpleMenu.h
2026 if test $cf_path != default ; then
2027 CPPFLAGS="-I$cf_path/include $cf_save"
2028 AC_MSG_CHECKING(for $cf_test in $cf_path)
2030 AC_MSG_CHECKING(for $cf_test)
2033 #include <X11/Intrinsic.h>
2034 #include <$cf_test>],[],
2037 AC_MSG_RESULT($cf_result)
2038 if test "$cf_result" = yes ; then
2039 cf_x_athena_include=$cf_path
2047 if test -z "$cf_x_athena_include" ; then
2049 [Unable to successfully find Athena header files with test program])
2050 elif test "$cf_x_athena_include" != default ; then
2051 CPPFLAGS="$CPPFLAGS -I$cf_x_athena_include"
2054 dnl ---------------------------------------------------------------------------
2055 dnl CF_X_ATHENA_LIBS version: 6 updated: 2006/11/30 17:57:11
2056 dnl ----------------
2057 dnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of
2058 dnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw.
2059 AC_DEFUN([CF_X_ATHENA_LIBS],
2060 [AC_REQUIRE([CF_X_TOOLKIT])
2061 cf_x_athena_root=ifelse($1,,Xaw,$1)
2064 for cf_path in default \
2065 /usr/contrib/X11R6 \
2066 /usr/contrib/X11R5 \
2071 "-l$cf_x_athena_root -lXmu" \
2072 "-l$cf_x_athena_root -lXpm -lXmu" \
2073 "-l${cf_x_athena_root}_s -lXmu_s"
2075 if test -z "$cf_x_athena_lib" ; then
2077 cf_test=XawSimpleMenuAddGlobalActions
2078 if test $cf_path != default ; then
2079 LIBS="-L$cf_path/lib $cf_lib $LIBS"
2080 AC_MSG_CHECKING(for $cf_lib in $cf_path)
2082 LIBS="$cf_lib $LIBS"
2083 AC_MSG_CHECKING(for $cf_test in $cf_lib)
2085 AC_TRY_LINK([],[$cf_test()],
2088 AC_MSG_RESULT($cf_result)
2089 if test "$cf_result" = yes ; then
2090 cf_x_athena_lib="$cf_lib"
2098 if test -z "$cf_x_athena_lib" ; then
2100 [Unable to successfully link Athena library (-l$cf_x_athena_root) with test program])
2103 CF_UPPER(cf_x_athena_LIBS,HAVE_LIB_$cf_x_athena)
2104 AC_DEFINE_UNQUOTED($cf_x_athena_LIBS)
2106 dnl ---------------------------------------------------------------------------
2107 dnl CF_X_TOOLKIT version: 11 updated: 2006/11/29 19:05:14
2109 dnl Check for X Toolkit libraries
2111 AC_DEFUN([CF_X_TOOLKIT],
2113 AC_REQUIRE([AC_PATH_XTRA])
2114 AC_REQUIRE([CF_CHECK_CACHE])
2116 # SYSTEM_NAME=`echo "$cf_cv_system_name"|tr ' ' -`
2120 LDFLAGS="$X_LIBS $LDFLAGS"
2121 CF_CHECK_CFLAGS($X_CFLAGS)
2123 AC_CHECK_FUNC(XOpenDisplay,,[
2124 AC_CHECK_LIB(X11,XOpenDisplay,
2125 [LIBS="-lX11 $LIBS"],,
2126 [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])])
2128 AC_CHECK_FUNC(XtAppInitialize,,[
2129 AC_CHECK_LIB(Xt, XtAppInitialize,
2130 [AC_DEFINE(HAVE_LIBXT)
2132 LIBS="-lXt $X_PRE_LIBS $LIBS $X_EXTRA_LIBS"],,
2133 [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])])
2135 if test $cf_have_X_LIBS = no ; then
2137 [Unable to successfully link X Toolkit library (-lXt) with
2138 test program. You will have to check and add the proper libraries by hand