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.40 2010/06/12 12:31:55 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_SUBDIR_PATH version: 2 updated: 2007/07/29 10:12:59
241 dnl ------------------
242 dnl Append to a search-list for a nonstandard header/lib-file
243 dnl $1 = the variable to return as result
244 dnl $2 = the package name
245 dnl $3 = the subdirectory, e.g., bin, include or lib
246 dnl $4 = the directory under which we will test for subdirectories
247 dnl $5 = a directory that we do not want $4 to match
248 AC_DEFUN([CF_ADD_SUBDIR_PATH],
250 test "$4" != "$5" && \
252 ifelse([$5],NONE,,[(test $5 = NONE || test -d $5) &&]) {
253 test -n "$verbose" && echo " ... testing for $3-directories under $4"
254 test -d $4/$3 && $1="[$]$1 $4/$3"
255 test -d $4/$3/$2 && $1="[$]$1 $4/$3/$2"
256 test -d $4/$3/$2/$3 && $1="[$]$1 $4/$3/$2/$3"
257 test -d $4/$2/$3 && $1="[$]$1 $4/$2/$3"
258 test -d $4/$2/$3/$2 && $1="[$]$1 $4/$2/$3/$2"
261 dnl ---------------------------------------------------------------------------
262 dnl CF_ANSI_CC_CHECK version: 9 updated: 2001/12/30 17:53:34
264 dnl This is adapted from the macros 'fp_PROG_CC_STDC' and 'fp_C_PROTOTYPES'
265 dnl in the sharutils 4.2 distribution.
266 AC_DEFUN([CF_ANSI_CC_CHECK],
268 AC_CACHE_CHECK(for ${CC-cc} option to accept ANSI C, cf_cv_ansi_cc,[
270 cf_save_CFLAGS="$CFLAGS"
271 cf_save_CPPFLAGS="$CPPFLAGS"
272 # Don't try gcc -ansi; that turns off useful extensions and
273 # breaks some systems' header files.
275 # Ultrix and OSF/1 -std1
276 # HP-UX -Aa -D_HPUX_SOURCE
278 # UnixWare 1.2 (cannot use -Xc, since ANSI/POSIX clashes)
279 for cf_arg in "-DCC_HAS_PROTOS" \
284 "-Aa -D_HPUX_SOURCE" \
287 CF_ADD_CFLAGS($cf_arg)
290 #ifndef CC_HAS_PROTOS
291 #if !defined(__STDC__) || (__STDC__ != 1)
296 int test (int i, double x);
297 struct s1 {int (*f) (int a);};
298 struct s2 {int (*f) (double a);};],
299 [cf_cv_ansi_cc="$cf_arg"; break])
301 CFLAGS="$cf_save_CFLAGS"
302 CPPFLAGS="$cf_save_CPPFLAGS"
305 if test "$cf_cv_ansi_cc" != "no"; then
306 if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then
307 CF_ADD_CFLAGS($cf_cv_ansi_cc)
309 AC_DEFINE(CC_HAS_PROTOS)
313 dnl ---------------------------------------------------------------------------
314 dnl CF_ANSI_CC_REQD version: 4 updated: 2008/03/23 14:48:54
316 dnl For programs that must use an ANSI compiler, obtain compiler options that
317 dnl will make it recognize prototypes. We'll do preprocessor checks in other
318 dnl macros, since tools such as unproto can fake prototypes, but only part of
319 dnl the preprocessor.
320 AC_DEFUN([CF_ANSI_CC_REQD],
321 [AC_REQUIRE([CF_ANSI_CC_CHECK])
322 if test "$cf_cv_ansi_cc" = "no"; then
324 [Your compiler does not appear to recognize prototypes.
325 You have the following choices:
326 a. adjust your compiler options
327 b. get an up-to-date compiler
328 c. use a wrapper such as unproto])
331 dnl ---------------------------------------------------------------------------
332 dnl CF_ARG_DISABLE version: 3 updated: 1999/03/30 17:24:31
334 dnl Allow user to disable a normally-on option.
335 AC_DEFUN([CF_ARG_DISABLE],
336 [CF_ARG_OPTION($1,[$2],[$3],[$4],yes)])dnl
337 dnl ---------------------------------------------------------------------------
338 dnl CF_ARG_ENABLE version: 3 updated: 1999/03/30 17:24:31
340 dnl Allow user to enable a normally-off option.
341 AC_DEFUN([CF_ARG_ENABLE],
342 [CF_ARG_OPTION($1,[$2],[$3],[$4],no)])dnl
343 dnl ---------------------------------------------------------------------------
344 dnl CF_ARG_OPTION version: 4 updated: 2010/05/26 05:38:42
346 dnl Restricted form of AC_ARG_ENABLE that ensures user doesn't give bogus
352 dnl $3 = action to perform if option is not default
353 dnl $4 = action if perform if option is default
354 dnl $5 = default option value (either 'yes' or 'no')
355 AC_DEFUN([CF_ARG_OPTION],
356 [AC_ARG_ENABLE([$1],[$2],[test "$enableval" != ifelse([$5],no,yes,no) && enableval=ifelse([$5],no,no,yes)
357 if test "$enableval" != "$5" ; then
359 ,[ $3]) ifelse([$4],,,[
362 fi],[enableval=$5 ifelse([$4],,,[
366 dnl ---------------------------------------------------------------------------
367 dnl CF_CHECK_CACHE version: 11 updated: 2008/03/23 14:45:59
369 dnl Check if we're accidentally using a cache from a different machine.
370 dnl Derive the system name, as a check for reusing the autoconf cache.
372 dnl If we've packaged config.guess and config.sub, run that (since it does a
373 dnl better job than uname). Normally we'll use AC_CANONICAL_HOST, but allow
374 dnl an extra parameter that we may override, e.g., for AC_CANONICAL_SYSTEM
375 dnl which is useful in cross-compiles.
377 dnl Note: we would use $ac_config_sub, but that is one of the places where
378 dnl autoconf 2.5x broke compatibility with autoconf 2.13
379 AC_DEFUN([CF_CHECK_CACHE],
381 if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then
382 ifelse([$1],,[AC_CANONICAL_HOST],[$1])
383 system_name="$host_os"
385 system_name="`(uname -s -r) 2>/dev/null`"
386 if test -z "$system_name" ; then
387 system_name="`(hostname) 2>/dev/null`"
390 test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name")
391 AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"])
393 test -z "$system_name" && system_name="$cf_cv_system_name"
394 test -n "$cf_cv_system_name" && AC_MSG_RESULT(Configuring for $cf_cv_system_name)
396 if test ".$system_name" != ".$cf_cv_system_name" ; then
397 AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name))
398 AC_MSG_ERROR("Please remove config.cache and try again.")
401 dnl ---------------------------------------------------------------------------
402 dnl CF_CHECK_CFLAGS version: 2 updated: 2001/12/30 19:09:58
404 dnl Conditionally add to $CFLAGS and $CPPFLAGS values which are derived from
405 dnl a build-configuration such as imake. These have the pitfall that they
406 dnl often contain compiler-specific options which we cannot use, mixed with
407 dnl preprocessor options that we usually can.
408 AC_DEFUN([CF_CHECK_CFLAGS],
410 CF_VERBOSE(checking additions to CFLAGS)
411 cf_check_cflags="$CFLAGS"
412 cf_check_cppflags="$CPPFLAGS"
413 CF_ADD_CFLAGS($1,yes)
414 if test "$cf_check_cflags" != "$CFLAGS" ; then
415 AC_TRY_LINK([#include <stdio.h>],[printf("Hello world");],,
416 [CF_VERBOSE(test-compile failed. Undoing change to \$CFLAGS)
417 if test "$cf_check_cppflags" != "$CPPFLAGS" ; then
418 CF_VERBOSE(but keeping change to \$CPPFLAGS)
420 CFLAGS="$cf_check_flags"])
423 dnl ---------------------------------------------------------------------------
424 dnl CF_CURSES_ACS_MAP version: 5 updated: 2009/03/28 16:08:10
425 dnl -----------------
426 dnl Check for likely values of acs_map[]:
427 AC_DEFUN([CF_CURSES_ACS_MAP],
429 AC_REQUIRE([CF_NCURSES_WRAP_PREFIX])dnl
430 AC_CACHE_CHECK(for alternate character set array, cf_cv_curses_acs_map,[
431 cf_cv_curses_acs_map=unknown
432 for name in acs_map _acs_map __acs_map ${NCURSES_WRAP_PREFIX}acs_map
435 #include <${cf_cv_ncurses_header-curses.h}>
437 $name['k'] = ACS_PLUS
438 ],[cf_cv_curses_acs_map=$name; break])
442 test "$cf_cv_curses_acs_map" != unknown && AC_DEFINE_UNQUOTED(CURSES_ACS_ARRAY,$cf_cv_curses_acs_map)
444 dnl ---------------------------------------------------------------------------
445 dnl CF_CURSES_CHECK_DATA version: 2 updated: 2009/07/16 21:03:10
446 dnl --------------------
447 dnl Check if curses.h defines the given data/variable.
448 dnl Use this after CF_NCURSES_CONFIG or CF_CURSES_CONFIG.
449 AC_DEFUN([CF_CURSES_CHECK_DATA],
451 AC_MSG_CHECKING(for data $1 declaration in ${cf_cv_ncurses_header-curses.h})
452 AC_TRY_COMPILE(CF__CURSES_HEAD,[
454 ],cf_result=yes,cf_result=no)
455 AC_MSG_RESULT($cf_result)
456 if test $cf_result = yes ; then
457 CF_UPPER(cf_result,have_curses_data_$1)
458 AC_DEFINE_UNQUOTED($cf_result)
460 AC_MSG_CHECKING(for data $1 in library)
461 AC_TRY_LINK(CF__CURSES_HEAD
465 ${cf_cv_main_return-return}(foo == 0);
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,decl_curses_data_$1)
471 AC_DEFINE_UNQUOTED($cf_result)
475 dnl ---------------------------------------------------------------------------
476 dnl CF_CURSES_CHECK_TYPE version: 2 updated: 2003/03/01 23:40:33
477 dnl --------------------
478 dnl Check if curses.h defines the given type
479 AC_DEFUN([CF_CURSES_CHECK_TYPE],
481 AC_MSG_CHECKING(for type $1 in ${cf_cv_ncurses_header-curses.h})
483 #ifndef _XOPEN_SOURCE_EXTENDED
484 #define _XOPEN_SOURCE_EXTENDED
486 #include <${cf_cv_ncurses_header-curses.h}>],[
488 ],cf_result=yes,cf_result=no)
489 AC_MSG_RESULT($cf_result)
490 if test $cf_result = yes ; then
491 CF_UPPER(cf_result,have_type_$1)
492 AC_DEFINE_UNQUOTED($cf_result)
494 AC_DEFINE_UNQUOTED($1,$2)
497 dnl ---------------------------------------------------------------------------
498 dnl CF_CURSES_CONFIG version: 2 updated: 2006/10/29 11:06:27
500 dnl Tie together the configure-script macros for curses. It may be ncurses,
501 dnl but unless asked, we do not make a special search for ncurses. However,
502 dnl still check for the ncurses version number, for use in other macros.
503 AC_DEFUN([CF_CURSES_CONFIG],
509 dnl ---------------------------------------------------------------------------
510 dnl CF_CURSES_CPPFLAGS version: 10 updated: 2009/01/06 19:34:11
511 dnl ------------------
512 dnl Look for the curses headers.
513 AC_DEFUN([CF_CURSES_CPPFLAGS],[
515 AC_CACHE_CHECK(for extra include directories,cf_cv_curses_incdir,[
516 cf_cv_curses_incdir=no
517 case $host_os in #(vi
519 test -d /usr/include/curses_colr && \
520 cf_cv_curses_incdir="-I/usr/include/curses_colr"
523 test -d /usr/5lib && \
524 test -d /usr/5include && \
525 cf_cv_curses_incdir="-I/usr/5include"
529 test "$cf_cv_curses_incdir" != no && CPPFLAGS="$CPPFLAGS $cf_cv_curses_incdir"
534 dnl ---------------------------------------------------------------------------
535 dnl CF_CURSES_FUNCS version: 14 updated: 2009/07/16 19:34:55
537 dnl Curses-functions are a little complicated, since a lot of them are macros.
538 AC_DEFUN([CF_CURSES_FUNCS],
540 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
541 AC_REQUIRE([CF_XOPEN_CURSES])
542 AC_REQUIRE([CF_CURSES_TERM_H])
545 CF_UPPER(cf_tr_func,$cf_func)
546 AC_MSG_CHECKING(for ${cf_func})
547 CF_MSG_LOG(${cf_func})
548 AC_CACHE_VAL(cf_cv_func_$cf_func,[
549 eval cf_result='$ac_cv_func_'$cf_func
550 if test ".$cf_result" != ".no"; then
551 AC_TRY_LINK(CF__CURSES_HEAD,
554 long foo = (long)(&${cf_func});
555 ${cf_cv_main_return-return}(foo == 0);
561 eval 'cf_cv_func_'$cf_func'=$cf_result'
563 # use the computed/retrieved cache-value:
564 eval 'cf_result=$cf_cv_func_'$cf_func
565 AC_MSG_RESULT($cf_result)
566 if test $cf_result != no; then
567 AC_DEFINE_UNQUOTED(HAVE_${cf_tr_func})
571 dnl ---------------------------------------------------------------------------
572 dnl CF_CURSES_HEADER version: 2 updated: 2010/04/28 06:02:16
574 dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common
575 dnl variations of ncurses' installs.
577 dnl $1 = ncurses when looking for ncurses, or is empty
578 AC_DEFUN([CF_CURSES_HEADER],[
579 AC_CACHE_CHECK(if we have identified curses headers,cf_cv_ncurses_header,[
580 cf_cv_ncurses_header=none
581 for cf_header in ifelse($1,,,[ \
585 ncurses.h ifelse($1,,[ncurses/curses.h ncurses/ncurses.h])
587 AC_TRY_COMPILE([#include <${cf_header}>],
588 [initscr(); tgoto("?", 0,0)],
589 [cf_cv_ncurses_header=$cf_header; break],[])
593 if test "$cf_cv_ncurses_header" = none ; then
594 AC_MSG_ERROR(No curses header-files found)
597 # cheat, to get the right #define's for HAVE_NCURSES_H, etc.
598 AC_CHECK_HEADERS($cf_cv_ncurses_header)
600 dnl ---------------------------------------------------------------------------
601 dnl CF_CURSES_LIBS version: 29 updated: 2009/01/06 19:34:57
603 dnl Look for the curses libraries. Older curses implementations may require
604 dnl termcap/termlib to be linked as well. Call CF_CURSES_CPPFLAGS first.
605 AC_DEFUN([CF_CURSES_LIBS],[
607 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
608 AC_MSG_CHECKING(if we have identified curses libraries)
609 AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>],
610 [initscr(); tgoto("?", 0,0)],
613 AC_MSG_RESULT($cf_result)
615 if test "$cf_result" = no ; then
616 case $host_os in #(vi
618 AC_CHECK_LIB(mytinfo,tgoto,[LIBS="-lmytinfo $LIBS"])
621 AC_CHECK_LIB(cur_colr,initscr,[
622 LIBS="-lcur_colr $LIBS"
623 ac_cv_func_initscr=yes
625 AC_CHECK_LIB(Hcurses,initscr,[
626 # HP's header uses __HP_CURSES, but user claims _HP_CURSES.
627 LIBS="-lHcurses $LIBS"
628 CPPFLAGS="$CPPFLAGS -D__HP_CURSES -D_HP_CURSES"
629 ac_cv_func_initscr=yes
632 linux*) # Suse Linux does not follow /usr/lib convention
636 if test -d /usr/5lib ; then
637 CF_ADD_LIBDIR(/usr/5lib)
638 LIBS="$LIBS -lcurses -ltermcap"
640 ac_cv_func_initscr=yes
644 if test ".$ac_cv_func_initscr" != .yes ; then
649 if test ".${cf_cv_ncurses_version-no}" != .no
651 cf_check_list="ncurses curses cursesX"
653 cf_check_list="cursesX curses ncurses"
656 # Check for library containing tgoto. Do this before curses library
657 # because it may be needed to link the test-case for initscr.
658 AC_CHECK_FUNC(tgoto,[cf_term_lib=predefined],[
659 for cf_term_lib in $cf_check_list termcap termlib unknown
661 AC_CHECK_LIB($cf_term_lib,tgoto,[break])
665 # Check for library containing initscr
666 test "$cf_term_lib" != predefined && test "$cf_term_lib" != unknown && LIBS="-l$cf_term_lib $cf_save_LIBS"
667 for cf_curs_lib in $cf_check_list xcurses jcurses pdcurses unknown
669 AC_CHECK_LIB($cf_curs_lib,initscr,[break])
671 test $cf_curs_lib = unknown && AC_MSG_ERROR(no curses library found)
673 LIBS="-l$cf_curs_lib $cf_save_LIBS"
674 if test "$cf_term_lib" = unknown ; then
675 AC_MSG_CHECKING(if we can link with $cf_curs_lib library)
676 AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>],
680 AC_MSG_RESULT($cf_result)
681 test $cf_result = no && AC_MSG_ERROR(Cannot link curses library)
682 elif test "$cf_curs_lib" = "$cf_term_lib" ; then
684 elif test "$cf_term_lib" != predefined ; then
685 AC_MSG_CHECKING(if we need both $cf_curs_lib and $cf_term_lib libraries)
686 AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>],
687 [initscr(); tgoto((char *)0, 0, 0);],
690 LIBS="-l$cf_curs_lib -l$cf_term_lib $cf_save_LIBS"
691 AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>],
696 AC_MSG_RESULT($cf_result)
702 dnl ---------------------------------------------------------------------------
703 dnl CF_CURSES_TERM_H version: 7 updated: 2010/01/24 18:40:06
705 dnl SVr4 curses should have term.h as well (where it puts the definitions of
706 dnl the low-level interface). This may not be true in old/broken implementations,
707 dnl as well as in misconfigured systems (e.g., gcc configured for Solaris 2.4
708 dnl running with Solaris 2.5.1).
709 AC_DEFUN([CF_CURSES_TERM_H],
711 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
713 AC_CACHE_CHECK(for term.h, cf_cv_term_header,[
715 # If we found <ncurses/curses.h>, look for <ncurses/term.h>, but always look
716 # for <term.h> if we do not find the variant.
718 `echo ${cf_cv_ncurses_header-curses.h} | sed -e 's%/.*%/%'`term.h \
722 #include <${cf_cv_ncurses_header-curses.h}>
723 #include <${cf_header}>],
725 [cf_cv_term_header=$cf_header
727 [cf_cv_term_header=no])
730 case $cf_cv_term_header in #(vi
732 # If curses is ncurses, some packagers still mess it up by trying to make
733 # us use GNU termcap. This handles the most common case.
734 for cf_header in ncurses/term.h ncursesw/term.h
737 #include <${cf_cv_ncurses_header-curses.h}>
738 #ifdef NCURSES_VERSION
739 #include <${cf_header}>
744 [cf_cv_term_header=$cf_header
746 [cf_cv_term_header=no])
752 case $cf_cv_term_header in #(vi
754 AC_DEFINE(HAVE_TERM_H)
757 AC_DEFINE(HAVE_NCURSES_TERM_H)
760 AC_DEFINE(HAVE_NCURSESW_TERM_H)
764 dnl ---------------------------------------------------------------------------
765 dnl CF_CURSES_WACS_MAP version: 3 updated: 2003/05/17 22:19:02
766 dnl ------------------
767 dnl Check for likely values of wacs_map[]:
768 AC_DEFUN([CF_CURSES_WACS_MAP],
770 AC_CACHE_CHECK(for wide alternate character set array, cf_cv_curses_wacs_map,[
771 cf_cv_curses_wacs_map=unknown
772 for name in wacs_map _wacs_map __wacs_map _nc_wacs
775 #ifndef _XOPEN_SOURCE_EXTENDED
776 #define _XOPEN_SOURCE_EXTENDED
778 #include <${cf_cv_ncurses_header-curses.h}>],
779 [$name['k'] = *WACS_PLUS],
780 [cf_cv_curses_wacs_map=$name
784 dnl ---------------------------------------------------------------------------
785 dnl CF_DIRNAME version: 4 updated: 2002/12/21 19:25:52
787 dnl "dirname" is not portable, so we fake it with a shell script.
788 AC_DEFUN([CF_DIRNAME],[$1=`echo $2 | sed -e 's%/[[^/]]*$%%'`])dnl
789 dnl ---------------------------------------------------------------------------
790 dnl CF_DISABLE_ECHO version: 11 updated: 2009/12/13 13:16:57
792 dnl You can always use "make -n" to see the actual options, but it's hard to
793 dnl pick out/analyze warning messages when the compile-line is long.
796 dnl ECHO_LT - symbol to control if libtool is verbose
797 dnl ECHO_LD - symbol to prefix "cc -o" lines
798 dnl RULE_CC - symbol to put before implicit "cc -c" lines (e.g., .c.o)
799 dnl SHOW_CC - symbol to put before explicit "cc -c" lines
800 dnl ECHO_CC - symbol to put before any "cc" line
802 AC_DEFUN([CF_DISABLE_ECHO],[
803 AC_MSG_CHECKING(if you want to see long compiling messages)
805 [ --disable-echo display "compiling" commands],
808 ECHO_LD='@echo linking [$]@;'
809 RULE_CC='@echo compiling [$]<'
810 SHOW_CC='@echo compiling [$]@'
819 AC_MSG_RESULT($enableval)
826 dnl ---------------------------------------------------------------------------
827 dnl CF_ENABLE_WARNINGS version: 4 updated: 2009/07/26 17:53:03
828 dnl ------------------
829 dnl Configure-option to enable gcc warnings
830 AC_DEFUN([CF_ENABLE_WARNINGS],[
831 if ( test "$GCC" = yes || test "$GXX" = yes )
833 AC_MSG_CHECKING(if you want to turn on gcc warnings)
834 CF_ARG_ENABLE(warnings,
835 [ --enable-warnings test: turn on gcc compiler warnings],
838 AC_MSG_RESULT($with_warnings)
839 if test "$with_warnings" = "yes"
846 dnl ---------------------------------------------------------------------------
847 dnl CF_FIND_LIBRARY version: 9 updated: 2008/03/23 14:48:54
849 dnl Look for a non-standard library, given parameters for AC_TRY_LINK. We
850 dnl prefer a standard location, and use -L options only if we do not find the
851 dnl library in the standard library location(s).
852 dnl $1 = library name
853 dnl $2 = library class, usually the same as library name
855 dnl $4 = code fragment to compile/link
856 dnl $5 = corresponding function-name
857 dnl $6 = flag, nonnull if failure should not cause an error-exit
859 dnl Sets the variable "$cf_libdir" as a side-effect, so we can see if we had
860 dnl to use a -L option.
861 AC_DEFUN([CF_FIND_LIBRARY],
863 eval 'cf_cv_have_lib_'$1'=no'
866 eval 'cf_cv_have_lib_'$1'=yes',[
868 AC_MSG_CHECKING(for $5 in -l$1)
870 AC_TRY_LINK([$3],[$4],
872 eval 'cf_cv_have_lib_'$1'=yes'
875 CF_LIBRARY_PATH(cf_search,$2)
876 for cf_libdir in $cf_search
878 AC_MSG_CHECKING(for -l$1 in $cf_libdir)
879 LIBS="-L$cf_libdir -l$1 $cf_save_LIBS"
880 AC_TRY_LINK([$3],[$4],
882 eval 'cf_cv_have_lib_'$1'=yes'
885 LIBS="$cf_save_LIBS"])
889 eval 'cf_found_library=[$]cf_cv_have_lib_'$1
891 if test $cf_found_library = no ; then
892 AC_MSG_ERROR(Cannot link $1 library)
896 dnl ---------------------------------------------------------------------------
897 dnl CF_FIND_LINKAGE version: 19 updated: 2010/05/29 16:31:02
899 dnl Find a library (specifically the linkage used in the code fragment),
900 dnl searching for it if it is not already in the library path.
901 dnl See also CF_ADD_SEARCHPATH.
903 dnl Parameters (4-on are optional):
904 dnl $1 = headers for library entrypoint
905 dnl $2 = code fragment for library entrypoint
906 dnl $3 = the library name without the "-l" option or ".so" suffix.
907 dnl $4 = action to perform if successful (default: update CPPFLAGS, etc)
908 dnl $5 = action to perform if not successful
909 dnl $6 = module name, if not the same as the library name
910 dnl $7 = extra libraries
912 dnl Sets these variables:
913 dnl $cf_cv_find_linkage_$3 - yes/no according to whether linkage is found
914 dnl $cf_cv_header_path_$3 - include-directory if needed
915 dnl $cf_cv_library_path_$3 - library-directory if needed
916 dnl $cf_cv_library_file_$3 - library-file if needed, e.g., -l$3
917 AC_DEFUN([CF_FIND_LINKAGE],[
919 # If the linkage is not already in the $CPPFLAGS/$LDFLAGS configuration, these
920 # will be set on completion of the AC_TRY_LINK below.
921 cf_cv_header_path_$3=
922 cf_cv_library_path_$3=
924 CF_MSG_LOG([Starting [FIND_LINKAGE]($3,$6)])
928 AC_TRY_LINK([$1],[$2],[
929 cf_cv_find_linkage_$3=yes
930 cf_cv_header_path_$3=/usr/include
931 cf_cv_library_path_$3=/usr/lib
934 LIBS="-l$3 $7 $cf_save_LIBS"
936 AC_TRY_LINK([$1],[$2],[
937 cf_cv_find_linkage_$3=yes
938 cf_cv_header_path_$3=/usr/include
939 cf_cv_library_path_$3=/usr/lib
940 cf_cv_library_file_$3="-l$3"
942 cf_cv_find_linkage_$3=no
945 CF_VERBOSE(find linkage for $3 library)
946 CF_MSG_LOG([Searching for headers in [FIND_LINKAGE]($3,$6)])
948 cf_save_CPPFLAGS="$CPPFLAGS"
949 cf_test_CPPFLAGS="$CPPFLAGS"
951 CF_HEADER_PATH(cf_search,ifelse([$6],,[$3],[$6]))
952 for cf_cv_header_path_$3 in $cf_search
954 if test -d $cf_cv_header_path_$3 ; then
955 CF_VERBOSE(... testing $cf_cv_header_path_$3)
956 CPPFLAGS="$cf_save_CPPFLAGS -I$cf_cv_header_path_$3"
957 AC_TRY_COMPILE([$1],[$2],[
958 CF_VERBOSE(... found $3 headers in $cf_cv_header_path_$3)
959 cf_cv_find_linkage_$3=maybe
960 cf_test_CPPFLAGS="$CPPFLAGS"
962 CPPFLAGS="$cf_save_CPPFLAGS"
967 if test "$cf_cv_find_linkage_$3" = maybe ; then
969 CF_MSG_LOG([Searching for $3 library in [FIND_LINKAGE]($3,$6)])
972 cf_save_LDFLAGS="$LDFLAGS"
975 CPPFLAGS="$cf_test_CPPFLAGS"
976 LIBS="-l$3 $7 $cf_save_LIBS"
977 AC_TRY_LINK([$1],[$2],[
978 CF_VERBOSE(... found $3 library in system)
979 cf_cv_find_linkage_$3=yes])
980 CPPFLAGS="$cf_save_CPPFLAGS"
984 if test "$cf_cv_find_linkage_$3" != yes ; then
985 CF_LIBRARY_PATH(cf_search,$3)
986 for cf_cv_library_path_$3 in $cf_search
988 if test -d $cf_cv_library_path_$3 ; then
989 CF_VERBOSE(... testing $cf_cv_library_path_$3)
990 CPPFLAGS="$cf_test_CPPFLAGS"
991 LIBS="-l$3 $7 $cf_save_LIBS"
992 LDFLAGS="$cf_save_LDFLAGS -L$cf_cv_library_path_$3"
993 AC_TRY_LINK([$1],[$2],[
994 CF_VERBOSE(... found $3 library in $cf_cv_library_path_$3)
995 cf_cv_find_linkage_$3=yes
996 cf_cv_library_file_$3="-l$3"
998 CPPFLAGS="$cf_save_CPPFLAGS"
1000 LDFLAGS="$cf_save_LDFLAGS"
1004 CPPFLAGS="$cf_save_CPPFLAGS"
1005 LDFLAGS="$cf_save_LDFLAGS"
1009 cf_cv_find_linkage_$3=no
1014 LIBS="$cf_save_LIBS"
1016 if test "$cf_cv_find_linkage_$3" = yes ; then
1018 CF_ADD_INCDIR($cf_cv_header_path_$3)
1019 CF_ADD_LIBDIR($cf_cv_library_path_$3)
1023 ifelse([$5],,AC_MSG_WARN(Cannot find $3 library),[$5])
1026 dnl ---------------------------------------------------------------------------
1027 dnl CF_FUNC_CURSES_VERSION version: 4 updated: 2007/04/28 09:15:55
1028 dnl ----------------------
1029 dnl Solaris has a data item 'curses_version', which confuses AC_CHECK_FUNCS.
1030 dnl It's a character string "SVR4", not documented.
1031 AC_DEFUN([CF_FUNC_CURSES_VERSION],
1033 AC_CACHE_CHECK(for function curses_version, cf_cv_func_curses_version,[
1035 #include <${cf_cv_ncurses_header-curses.h}>
1039 sprintf(temp, "%s\n", curses_version());
1040 ${cf_cv_main_return-return}(0);
1042 ,[cf_cv_func_curses_version=yes]
1043 ,[cf_cv_func_curses_version=no]
1044 ,[cf_cv_func_curses_version=unknown])
1046 test "$cf_cv_func_curses_version" = yes && AC_DEFINE(HAVE_CURSES_VERSION)
1048 dnl ---------------------------------------------------------------------------
1049 dnl CF_GCC_ATTRIBUTES version: 13 updated: 2009/08/11 20:19:56
1050 dnl -----------------
1051 dnl Test for availability of useful gcc __attribute__ directives to quiet
1052 dnl compiler warnings. Though useful, not all are supported -- and contrary
1053 dnl to documentation, unrecognized directives cause older compilers to barf.
1054 AC_DEFUN([CF_GCC_ATTRIBUTES],
1056 if test "$GCC" = yes
1058 cat > conftest.i <<EOF
1060 #define GCC_PRINTF 0
1065 #ifndef GCC_NORETURN
1066 #define GCC_NORETURN /* nothing */
1069 #define GCC_UNUSED /* nothing */
1072 if test "$GCC" = yes
1074 AC_CHECKING([for $CC __attribute__ directives])
1075 cat > conftest.$ac_ext <<EOF
1076 #line __oline__ "${as_me-configure}"
1077 #include "confdefs.h"
1078 #include "conftest.h"
1079 #include "conftest.i"
1081 #define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
1083 #define GCC_PRINTFLIKE(fmt,var) /*nothing*/
1086 #define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var)))
1088 #define GCC_SCANFLIKE(fmt,var) /*nothing*/
1090 extern void wow(char *,...) GCC_SCANFLIKE(1,2);
1091 extern void oops(char *,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN;
1092 extern void foo(void) GCC_NORETURN;
1093 int main(int argc GCC_UNUSED, char *argv[[]] GCC_UNUSED) { return 0; }
1095 cf_printf_attribute=no
1096 cf_scanf_attribute=no
1097 for cf_attribute in scanf printf unused noreturn
1099 CF_UPPER(cf_ATTRIBUTE,$cf_attribute)
1100 cf_directive="__attribute__(($cf_attribute))"
1101 echo "checking for $CC $cf_directive" 1>&AC_FD_CC
1103 case $cf_attribute in #(vi
1105 cf_printf_attribute=yes
1106 cat >conftest.h <<EOF
1107 #define GCC_$cf_ATTRIBUTE 1
1111 cf_scanf_attribute=yes
1112 cat >conftest.h <<EOF
1113 #define GCC_$cf_ATTRIBUTE 1
1117 cat >conftest.h <<EOF
1118 #define GCC_$cf_ATTRIBUTE $cf_directive
1123 if AC_TRY_EVAL(ac_compile); then
1124 test -n "$verbose" && AC_MSG_RESULT(... $cf_attribute)
1125 cat conftest.h >>confdefs.h
1126 case $cf_attribute in #(vi
1128 if test "$cf_printf_attribute" = no ; then
1129 cat >>confdefs.h <<EOF
1130 #define GCC_PRINTFLIKE(fmt,var) /* nothing */
1133 cat >>confdefs.h <<EOF
1134 #define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
1139 if test "$cf_scanf_attribute" = no ; then
1140 cat >>confdefs.h <<EOF
1141 #define GCC_SCANFLIKE(fmt,var) /* nothing */
1144 cat >>confdefs.h <<EOF
1145 #define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var)))
1153 fgrep define conftest.i >>confdefs.h
1158 dnl ---------------------------------------------------------------------------
1159 dnl CF_GCC_VERSION version: 5 updated: 2010/04/24 11:02:31
1161 dnl Find version of gcc
1162 AC_DEFUN([CF_GCC_VERSION],[
1163 AC_REQUIRE([AC_PROG_CC])
1165 if test "$GCC" = yes ; then
1166 AC_MSG_CHECKING(version of $CC)
1167 GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`"
1168 test -z "$GCC_VERSION" && GCC_VERSION=unknown
1169 AC_MSG_RESULT($GCC_VERSION)
1172 dnl ---------------------------------------------------------------------------
1173 dnl CF_GCC_WARNINGS version: 25 updated: 2010/04/24 11:03:31
1175 dnl Check if the compiler supports useful warning options. There's a few that
1176 dnl we don't use, simply because they're too noisy:
1178 dnl -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x)
1179 dnl -Wredundant-decls (system headers make this too noisy)
1180 dnl -Wtraditional (combines too many unrelated messages, only a few useful)
1181 dnl -Wwrite-strings (too noisy, but should review occasionally). This
1182 dnl is enabled for ncurses using "--enable-const".
1186 dnl $1 is an optional list of gcc warning flags that a particular
1187 dnl application might want to use, e.g., "no-unused" for
1190 dnl If $with_ext_const is "yes", add a check for -Wwrite-strings
1192 AC_DEFUN([CF_GCC_WARNINGS],
1194 AC_REQUIRE([CF_GCC_VERSION])
1195 CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS)
1197 cat > conftest.$ac_ext <<EOF
1198 #line __oline__ "${as_me-configure}"
1199 int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; }
1202 if test "$INTEL_COMPILER" = yes
1204 # The "-wdXXX" options suppress warnings:
1205 # remark #1419: external declaration in primary source file
1206 # remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
1207 # remark #1684: conversion from pointer to same-sized integral type (potential portability problem)
1208 # remark #193: zero used for undefined preprocessing identifier
1209 # remark #593: variable "curs_sb_left_arrow" was set but never used
1210 # remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits
1211 # remark #869: parameter "tw" was never referenced
1212 # remark #981: operands are evaluated in unspecified order
1213 # warning #279: controlling expression is constant
1215 AC_CHECKING([for $CC warning options])
1216 cf_save_CFLAGS="$CFLAGS"
1217 EXTRA_CFLAGS="-Wall"
1229 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
1230 if AC_TRY_EVAL(ac_compile); then
1231 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
1232 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
1235 CFLAGS="$cf_save_CFLAGS"
1237 elif test "$GCC" = yes
1239 AC_CHECKING([for $CC warning options])
1240 cf_save_CFLAGS="$CFLAGS"
1243 test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings"
1244 for cf_opt in W Wall \
1245 Wbad-function-cast \
1249 Wmissing-declarations \
1250 Wmissing-prototypes \
1254 Wstrict-prototypes \
1255 Wundef $cf_warn_CONST $1
1257 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
1258 if AC_TRY_EVAL(ac_compile); then
1259 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
1260 case $cf_opt in #(vi
1262 CPPFLAGS="$CPPFLAGS -DXTSTRINGDEFINES"
1265 case $GCC_VERSION in
1267 CF_VERBOSE(feature is broken in gcc $GCC_VERSION)
1272 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
1275 CFLAGS="$cf_save_CFLAGS"
1279 AC_SUBST(EXTRA_CFLAGS)
1281 dnl ---------------------------------------------------------------------------
1282 dnl CF_GNU_SOURCE version: 6 updated: 2005/07/09 13:23:07
1284 dnl Check if we must define _GNU_SOURCE to get a reasonable value for
1285 dnl _XOPEN_SOURCE, upon which many POSIX definitions depend. This is a defect
1286 dnl (or misfeature) of glibc2, which breaks portability of many applications,
1287 dnl since it is interwoven with GNU extensions.
1289 dnl Well, yes we could work around it...
1290 AC_DEFUN([CF_GNU_SOURCE],
1292 AC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[
1293 AC_TRY_COMPILE([#include <sys/types.h>],[
1294 #ifndef _XOPEN_SOURCE
1297 [cf_cv_gnu_source=no],
1298 [cf_save="$CPPFLAGS"
1299 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
1300 AC_TRY_COMPILE([#include <sys/types.h>],[
1301 #ifdef _XOPEN_SOURCE
1304 [cf_cv_gnu_source=no],
1305 [cf_cv_gnu_source=yes])
1309 test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
1311 dnl ---------------------------------------------------------------------------
1312 dnl CF_HEADER_PATH version: 12 updated: 2010/05/05 05:22:40
1314 dnl Construct a search-list of directories for a nonstandard header-file
1317 dnl $1 = the variable to return as result
1318 dnl $2 = the package name
1319 AC_DEFUN([CF_HEADER_PATH],
1323 # collect the current set of include-directories from compiler flags
1324 cf_header_path_list=""
1325 if test -n "${CFLAGS}${CPPFLAGS}" ; then
1326 for cf_header_path in $CPPFLAGS $CFLAGS
1328 case $cf_header_path in #(vi
1330 cf_header_path=`echo ".$cf_header_path" |sed -e 's/^...//' -e 's,/include$,,'`
1331 CF_ADD_SUBDIR_PATH($1,$2,include,$cf_header_path,NONE)
1332 cf_header_path_list="$cf_header_path_list [$]$1"
1338 # add the variations for the package we are looking for
1339 CF_SUBDIR_PATH($1,$2,include)
1341 test "$includedir" != NONE && \
1342 test "$includedir" != "/usr/include" && \
1343 test -d "$includedir" && {
1344 test -d $includedir && $1="[$]$1 $includedir"
1345 test -d $includedir/$2 && $1="[$]$1 $includedir/$2"
1348 test "$oldincludedir" != NONE && \
1349 test "$oldincludedir" != "/usr/include" && \
1350 test -d "$oldincludedir" && {
1351 test -d $oldincludedir && $1="[$]$1 $oldincludedir"
1352 test -d $oldincludedir/$2 && $1="[$]$1 $oldincludedir/$2"
1355 $1="[$]$1 $cf_header_path_list"
1357 dnl ---------------------------------------------------------------------------
1358 dnl CF_INHERIT_SCRIPT version: 2 updated: 2003/03/01 23:50:42
1359 dnl -----------------
1360 dnl If we do not have a given script, look for it in the parent directory.
1361 AC_DEFUN([CF_INHERIT_SCRIPT],
1363 test -f $1 || ( test -f ../$1 && cp ../$1 ./ )
1365 dnl ---------------------------------------------------------------------------
1366 dnl CF_INTEL_COMPILER version: 4 updated: 2010/05/26 05:38:42
1367 dnl -----------------
1368 dnl Check if the given compiler is really the Intel compiler for Linux. It
1369 dnl tries to imitate gcc, but does not return an error when it finds a mismatch
1370 dnl between prototypes, e.g., as exercised by CF_MISSING_CHECK.
1372 dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to
1373 dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from
1374 dnl the wrappers for gcc and g++ warnings.
1376 dnl $1 = GCC (default) or GXX
1377 dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS
1378 dnl $3 = CFLAGS (default) or CXXFLAGS
1379 AC_DEFUN([CF_INTEL_COMPILER],[
1380 ifelse([$2],,INTEL_COMPILER,[$2])=no
1382 if test "$ifelse([$1],,[$1],GCC)" = yes ; then
1385 AC_MSG_CHECKING(if this is really Intel ifelse([$1],GXX,C++,C) compiler)
1386 cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])"
1387 ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -no-gcc"
1389 #ifdef __INTEL_COMPILER
1393 ],[ifelse([$2],,INTEL_COMPILER,[$2])=yes
1394 cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc"
1396 ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS"
1397 AC_MSG_RESULT($ifelse([$2],,INTEL_COMPILER,[$2]))
1402 dnl ---------------------------------------------------------------------------
1403 dnl CF_LIBRARY_PATH version: 9 updated: 2010/03/28 12:52:50
1405 dnl Construct a search-list of directories for a nonstandard library-file
1408 dnl $1 = the variable to return as result
1409 dnl $2 = the package name
1410 AC_DEFUN([CF_LIBRARY_PATH],
1413 cf_library_path_list=""
1414 if test -n "${LDFLAGS}${LIBS}" ; then
1415 for cf_library_path in $LDFLAGS $LIBS
1417 case $cf_library_path in #(vi
1419 cf_library_path=`echo ".$cf_library_path" |sed -e 's/^...//' -e 's,/lib$,,'`
1420 CF_ADD_SUBDIR_PATH($1,$2,lib,$cf_library_path,NONE)
1421 cf_library_path_list="$cf_library_path_list [$]$1"
1427 CF_SUBDIR_PATH($1,$2,lib)
1429 $1="$cf_library_path_list [$]$1"
1431 dnl ---------------------------------------------------------------------------
1432 dnl CF_MAKE_TAGS version: 5 updated: 2010/04/03 20:07:32
1434 dnl Generate tags/TAGS targets for makefiles. Do not generate TAGS if we have
1435 dnl a monocase filesystem.
1436 AC_DEFUN([CF_MAKE_TAGS],[
1437 AC_REQUIRE([CF_MIXEDCASE_FILENAMES])
1439 AC_CHECK_PROGS(CTAGS, exctags ctags)
1440 AC_CHECK_PROGS(ETAGS, exetags etags)
1442 AC_CHECK_PROG(MAKE_LOWER_TAGS, ${CTAGS-ctags}, yes, no)
1444 if test "$cf_cv_mixedcase" = yes ; then
1445 AC_CHECK_PROG(MAKE_UPPER_TAGS, ${ETAGS-etags}, yes, no)
1450 if test "$MAKE_UPPER_TAGS" = yes ; then
1456 if test "$MAKE_LOWER_TAGS" = yes ; then
1465 AC_SUBST(MAKE_UPPER_TAGS)
1466 AC_SUBST(MAKE_LOWER_TAGS)
1468 dnl ---------------------------------------------------------------------------
1469 dnl CF_MIN_GETCCHAR version: 2 updated: 2009/07/16 21:03:10
1472 dnl Check whether getcchar's return value counts the trailing null in a wchar_t
1473 dnl string, or not. X/Open says it does, but Tru64 and Solaris do not do this.
1474 AC_DEFUN([CF_MIN_GETCCHAR],[
1475 AC_CACHE_CHECK(if getcchar counts trailing null,cf_cv_min_getcchar,[
1479 #include <${cf_cv_ncurses_header-curses.h}>
1487 setcchar(temp, data, 0, 0, (void *)0);
1488 count = getcchar(temp, (wchar_t *)0, (attr_t *)0, (short *)0, (void *)0);
1489 ${cf_cv_main_return-return}(count != 0);
1491 [cf_cv_min_getcchar=no],
1492 [cf_cv_min_getcchar=yes],
1493 [cf_cv_min_getcchar=yes])
1495 if test "$cf_cv_min_getcchar" = yes ; then
1496 AC_DEFINE(MIN_GETCCHAR,1)
1499 dnl ---------------------------------------------------------------------------
1500 dnl CF_MIXEDCASE_FILENAMES version: 3 updated: 2003/09/20 17:07:55
1501 dnl ----------------------
1502 dnl Check if the file-system supports mixed-case filenames. If we're able to
1503 dnl create a lowercase name and see it as uppercase, it doesn't support that.
1504 AC_DEFUN([CF_MIXEDCASE_FILENAMES],
1506 AC_CACHE_CHECK(if filesystem supports mixed-case filenames,cf_cv_mixedcase,[
1507 if test "$cross_compiling" = yes ; then
1508 case $target_alias in #(vi
1509 *-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-mingw32*|*-uwin*) #(vi
1517 rm -f conftest CONFTEST
1519 if test -f CONFTEST ; then
1524 rm -f conftest CONFTEST
1527 test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES)
1529 dnl ---------------------------------------------------------------------------
1530 dnl CF_MSG_LOG version: 4 updated: 2007/07/29 09:55:12
1532 dnl Write a debug message to config.log, along with the line number in the
1533 dnl configure script.
1534 AC_DEFUN([CF_MSG_LOG],[
1535 echo "${as_me-configure}:__oline__: testing $* ..." 1>&AC_FD_CC
1537 dnl ---------------------------------------------------------------------------
1538 dnl CF_NCURSES_CC_CHECK version: 4 updated: 2007/07/29 10:39:05
1539 dnl -------------------
1540 dnl Check if we can compile with ncurses' header file
1541 dnl $1 is the cache variable to set
1542 dnl $2 is the header-file to include
1543 dnl $3 is the root name (ncurses or ncursesw)
1544 AC_DEFUN([CF_NCURSES_CC_CHECK],[
1546 ]ifelse($3,ncursesw,[
1547 #define _XOPEN_SOURCE_EXTENDED
1548 #undef HAVE_LIBUTF8_H /* in case we used CF_UTF8_LIB */
1549 #define HAVE_LIBUTF8_H /* to force ncurses' header file to use cchar_t */
1552 #ifdef NCURSES_VERSION
1553 ]ifelse($3,ncursesw,[
1558 printf("%s\n", NCURSES_VERSION);
1570 dnl ---------------------------------------------------------------------------
1571 dnl CF_NCURSES_CONFIG version: 6 updated: 2010/04/28 06:02:16
1572 dnl -----------------
1573 dnl Tie together the configure-script macros for ncurses.
1574 dnl Prefer the "-config" script from ncurses 5.6, to simplify analysis.
1575 dnl Allow that to be overridden using the $NCURSES_CONFIG environment variable.
1577 dnl $1 is the root library name (default: "ncurses")
1578 AC_DEFUN([CF_NCURSES_CONFIG],
1580 cf_ncuconfig_root=ifelse($1,,ncurses,$1)
1582 echo "Looking for ${cf_ncuconfig_root}-config"
1583 AC_PATH_PROGS(NCURSES_CONFIG,${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config,none)
1585 if test "$NCURSES_CONFIG" != none ; then
1587 CPPFLAGS="$CPPFLAGS `$NCURSES_CONFIG --cflags`"
1588 LIBS="`$NCURSES_CONFIG --libs` $LIBS"
1590 # even with config script, some packages use no-override for curses.h
1591 CF_CURSES_HEADER(ifelse($1,,ncurses,$1))
1593 dnl like CF_NCURSES_CPPFLAGS
1596 dnl like CF_NCURSES_LIBS
1597 CF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_ncuconfig_root)
1598 AC_DEFINE_UNQUOTED($cf_nculib_ROOT)
1600 dnl like CF_NCURSES_VERSION
1601 cf_cv_ncurses_version=`$NCURSES_CONFIG --version`
1605 CF_NCURSES_CPPFLAGS(ifelse($1,,ncurses,$1))
1606 CF_NCURSES_LIBS(ifelse($1,,ncurses,$1))
1610 dnl ---------------------------------------------------------------------------
1611 dnl CF_NCURSES_CPPFLAGS version: 19 updated: 2007/07/29 13:35:20
1612 dnl -------------------
1613 dnl Look for the SVr4 curses clone 'ncurses' in the standard places, adjusting
1614 dnl the CPPFLAGS variable so we can include its header.
1616 dnl The header files may be installed as either curses.h, or ncurses.h (would
1617 dnl be obsolete, except that some packagers prefer this name to distinguish it
1618 dnl from a "native" curses implementation). If not installed for overwrite,
1619 dnl the curses.h file would be in an ncurses subdirectory (e.g.,
1620 dnl /usr/include/ncurses), but someone may have installed overwriting the
1621 dnl vendor's curses. Only very old versions (pre-1.9.2d, the first autoconf'd
1622 dnl version) of ncurses don't define either __NCURSES_H or NCURSES_VERSION in
1625 dnl If the installer has set $CFLAGS or $CPPFLAGS so that the ncurses header
1626 dnl is already in the include-path, don't even bother with this, since we cannot
1627 dnl easily determine which file it is. In this case, it has to be <curses.h>.
1629 dnl The optional parameter gives the root name of the library, in case it is
1630 dnl not installed as the default curses library. That is how the
1631 dnl wide-character version of ncurses is installed.
1632 AC_DEFUN([CF_NCURSES_CPPFLAGS],
1633 [AC_REQUIRE([CF_WITH_CURSES_DIR])
1635 AC_PROVIDE([CF_CURSES_CPPFLAGS])dnl
1636 cf_ncuhdr_root=ifelse($1,,ncurses,$1)
1638 test -n "$cf_cv_curses_dir" && \
1639 test "$cf_cv_curses_dir" != "no" && { \
1640 CF_ADD_INCDIR($cf_cv_curses_dir/include $cf_cv_curses_dir/include/$cf_ncuhdr_root)
1643 AC_CACHE_CHECK(for $cf_ncuhdr_root header in include-path, cf_cv_ncurses_h,[
1644 cf_header_list="$cf_ncuhdr_root/curses.h $cf_ncuhdr_root/ncurses.h"
1645 ( test "$cf_ncuhdr_root" = ncurses || test "$cf_ncuhdr_root" = ncursesw ) && cf_header_list="$cf_header_list curses.h ncurses.h"
1646 for cf_header in $cf_header_list
1648 CF_NCURSES_CC_CHECK(cf_cv_ncurses_h,$cf_header,$1)
1649 test "$cf_cv_ncurses_h" != no && break
1656 # some applications need this, but should check for NCURSES_VERSION
1661 dnl ---------------------------------------------------------------------------
1662 dnl CF_NCURSES_EXT_FUNCS version: 1 updated: 2010/04/03 11:44:55
1663 dnl --------------------
1664 dnl Since 2007/11/17, ncurses has defined NCURSES_EXT_FUNCS; earlier versions
1665 dnl may provide these functions. Define the symbol if it is not defined, and
1667 AC_DEFUN([CF_NCURSES_EXT_FUNCS],
1669 AC_CACHE_CHECK(for ncurses extended functions,cf_cv_ncurses_ext_funcs,[
1671 #include <${cf_cv_ncurses_header-curses.h}>],
1673 int x = NCURSES_EXT_FUNCS
1674 ],[cf_cv_ncurses_ext_funcs=defined],[
1676 #include <${cf_cv_ncurses_header-curses.h}>],
1678 (void) assume_default_colors (0, 0);
1679 (void) curses_version ();
1680 (void) define_key (0, 0);
1681 (void) is_term_resized (0, 0);
1682 (void) key_defined (0);
1683 (void) keybound (0, 0);
1684 (void) keyok (0, 0);
1685 (void) resize_term (0, 0);
1686 (void) resizeterm (0, 0);
1687 (void) use_default_colors ();
1688 (void) use_extended_names (0);
1689 (void) wresize (0, 0, 0);],
1690 [cf_cv_ncurses_ext_funcs=yes],
1691 [cf_cv_ncurses_ext_funcs=no])
1694 test "$cf_cv_ncurses_ext_funcs" == yes && AC_DEFINE(NCURSES_EXT_FUNCS)
1696 dnl ---------------------------------------------------------------------------
1697 dnl CF_NCURSES_HEADER version: 2 updated: 2008/03/23 14:48:54
1698 dnl -----------------
1699 dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common
1700 dnl variations of ncurses' installs.
1702 dnl See also CF_CURSES_HEADER, which sets the same cache variable.
1703 AC_DEFUN([CF_NCURSES_HEADER],[
1705 if test "$cf_cv_ncurses_h" != no ; then
1706 cf_cv_ncurses_header=$cf_cv_ncurses_h
1709 AC_CACHE_CHECK(for $cf_ncuhdr_root include-path, cf_cv_ncurses_h2,[
1710 test -n "$verbose" && echo
1711 CF_HEADER_PATH(cf_search,$cf_ncuhdr_root)
1712 test -n "$verbose" && echo search path $cf_search
1713 cf_save2_CPPFLAGS="$CPPFLAGS"
1714 for cf_incdir in $cf_search
1716 CF_ADD_INCDIR($cf_incdir)
1721 CF_NCURSES_CC_CHECK(cf_cv_ncurses_h2,$cf_header,$1)
1722 if test "$cf_cv_ncurses_h2" != no ; then
1723 cf_cv_ncurses_h2=$cf_incdir/$cf_header
1724 test -n "$verbose" && echo $ac_n " ... found $ac_c" 1>&AC_FD_MSG
1727 test -n "$verbose" && echo " ... tested $cf_incdir/$cf_header" 1>&AC_FD_MSG
1729 CPPFLAGS="$cf_save2_CPPFLAGS"
1730 test "$cf_cv_ncurses_h2" != no && break
1732 test "$cf_cv_ncurses_h2" = no && AC_MSG_ERROR(not found)
1735 CF_DIRNAME(cf_1st_incdir,$cf_cv_ncurses_h2)
1736 cf_cv_ncurses_header=`basename $cf_cv_ncurses_h2`
1737 if test `basename $cf_1st_incdir` = $cf_ncuhdr_root ; then
1738 cf_cv_ncurses_header=$cf_ncuhdr_root/$cf_cv_ncurses_header
1740 CF_ADD_INCDIR($cf_1st_incdir)
1744 # Set definitions to allow ifdef'ing for ncurses.h
1746 case $cf_cv_ncurses_header in # (vi
1748 AC_DEFINE(HAVE_NCURSES_H)
1752 case $cf_cv_ncurses_header in # (vi
1753 ncurses/curses.h|ncurses/ncurses.h)
1754 AC_DEFINE(HAVE_NCURSES_NCURSES_H)
1756 ncursesw/curses.h|ncursesw/ncurses.h)
1757 AC_DEFINE(HAVE_NCURSESW_NCURSES_H)
1762 dnl ---------------------------------------------------------------------------
1763 dnl CF_NCURSES_LIBS version: 13 updated: 2007/07/29 10:29:20
1765 dnl Look for the ncurses library. This is a little complicated on Linux,
1766 dnl because it may be linked with the gpm (general purpose mouse) library.
1767 dnl Some distributions have gpm linked with (bsd) curses, which makes it
1768 dnl unusable with ncurses. However, we don't want to link with gpm unless
1769 dnl ncurses has a dependency, since gpm is normally set up as a shared library,
1770 dnl and the linker will record a dependency.
1772 dnl The optional parameter gives the root name of the library, in case it is
1773 dnl not installed as the default curses library. That is how the
1774 dnl wide-character version of ncurses is installed.
1775 AC_DEFUN([CF_NCURSES_LIBS],
1776 [AC_REQUIRE([CF_NCURSES_CPPFLAGS])
1778 cf_nculib_root=ifelse($1,,ncurses,$1)
1779 # This works, except for the special case where we find gpm, but
1780 # ncurses is in a nonstandard location via $LIBS, and we really want
1783 cf_ncurses_SAVE="$LIBS"
1784 AC_CHECK_LIB(gpm,Gpm_Open,
1785 [AC_CHECK_LIB(gpm,initscr,
1786 [LIBS="$cf_ncurses_SAVE"],
1787 [cf_ncurses_LIBS="-lgpm"])])
1789 case $host_os in #(vi
1791 # This is only necessary if you are linking against an obsolete
1792 # version of ncurses (but it should do no harm, since it's static).
1793 if test "$cf_nculib_root" = ncurses ; then
1794 AC_CHECK_LIB(mytinfo,tgoto,[cf_ncurses_LIBS="-lmytinfo $cf_ncurses_LIBS"])
1799 LIBS="$cf_ncurses_LIBS $LIBS"
1801 if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" )
1803 CF_ADD_LIBDIR($cf_cv_curses_dir/lib)
1804 LIBS="-l$cf_nculib_root $LIBS"
1806 CF_FIND_LIBRARY($cf_nculib_root,$cf_nculib_root,
1807 [#include <${cf_cv_ncurses_header-curses.h}>],
1812 if test -n "$cf_ncurses_LIBS" ; then
1813 AC_MSG_CHECKING(if we can link $cf_nculib_root without $cf_ncurses_LIBS)
1814 cf_ncurses_SAVE="$LIBS"
1815 for p in $cf_ncurses_LIBS ; do
1816 q=`echo $LIBS | sed -e "s%$p %%" -e "s%$p$%%"`
1817 if test "$q" != "$LIBS" ; then
1821 AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>],
1822 [initscr(); mousemask(0,0); tgoto((char *)0, 0, 0);],
1823 [AC_MSG_RESULT(yes)],
1825 LIBS="$cf_ncurses_SAVE"])
1828 CF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_nculib_root)
1829 AC_DEFINE_UNQUOTED($cf_nculib_ROOT)
1831 dnl ---------------------------------------------------------------------------
1832 dnl CF_NCURSES_VERSION version: 12 updated: 2007/04/28 09:15:55
1833 dnl ------------------
1834 dnl Check for the version of ncurses, to aid in reporting bugs, etc.
1835 dnl Call CF_CURSES_CPPFLAGS first, or CF_NCURSES_CPPFLAGS. We don't use
1836 dnl AC_REQUIRE since that does not work with the shell's if/then/else/fi.
1837 AC_DEFUN([CF_NCURSES_VERSION],
1839 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
1840 AC_CACHE_CHECK(for ncurses version, cf_cv_ncurses_version,[
1841 cf_cv_ncurses_version=no
1845 #include <${cf_cv_ncurses_header-curses.h}>
1849 FILE *fp = fopen("$cf_tempfile", "w");
1850 #ifdef NCURSES_VERSION
1851 # ifdef NCURSES_VERSION_PATCH
1852 fprintf(fp, "%s.%d\n", NCURSES_VERSION, NCURSES_VERSION_PATCH);
1854 fprintf(fp, "%s\n", NCURSES_VERSION);
1858 fprintf(fp, "old\n");
1863 ${cf_cv_main_return-return}(0);
1865 cf_cv_ncurses_version=`cat $cf_tempfile`],,[
1867 # This will not work if the preprocessor splits the line after the
1868 # Autoconf token. The 'unproto' program does that.
1869 cat > conftest.$ac_ext <<EOF
1870 #include <${cf_cv_ncurses_header-curses.h}>
1872 #ifdef NCURSES_VERSION
1873 Autoconf NCURSES_VERSION
1881 cf_try="$ac_cpp conftest.$ac_ext 2>&AC_FD_CC | grep '^Autoconf ' >conftest.out"
1883 if test -f conftest.out ; then
1884 cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[[^"]]*"%%' -e 's%".*%%'`
1885 test -n "$cf_out" && cf_cv_ncurses_version="$cf_out"
1891 test "$cf_cv_ncurses_version" = no || AC_DEFINE(NCURSES)
1893 dnl ---------------------------------------------------------------------------
1894 dnl CF_NCURSES_WRAP_PREFIX version: 1 updated: 2009/03/28 16:08:10
1895 dnl ----------------------
1896 dnl Check for ncurses "wrap-prefix" used for public variables which have been
1897 dnl wrapped with a function to help with concurrency control.
1898 AC_DEFUN([CF_NCURSES_WRAP_PREFIX],
1900 AC_MSG_CHECKING(for ncurses wrap-prefix)
1901 AC_ARG_WITH(ncurses-wrap-prefix,
1902 [ --with-ncurses-wrap-prefix naming-prefix for ncurses wrapped-variables],
1903 [NCURSES_WRAP_PREFIX=$withval],
1904 [NCURSES_WRAP_PREFIX=_nc_])
1905 AC_MSG_RESULT($NCURSES_WRAP_PREFIX)
1907 AC_SUBST(NCURSES_WRAP_PREFIX)
1909 dnl ---------------------------------------------------------------------------
1910 dnl CF_PATH_SYNTAX version: 13 updated: 2010/05/26 05:38:42
1912 dnl Check the argument to see that it looks like a pathname. Rewrite it if it
1913 dnl begins with one of the prefix/exec_prefix variables, and then again if the
1914 dnl result begins with 'NONE'. This is necessary to work around autoconf's
1915 dnl delayed evaluation of those symbols.
1916 AC_DEFUN([CF_PATH_SYNTAX],[
1917 if test "x$prefix" != xNONE; then
1918 cf_path_syntax="$prefix"
1920 cf_path_syntax="$ac_default_prefix"
1923 case ".[$]$1" in #(vi
1924 .\[$]\(*\)*|.\'*\'*) #(vi
1928 .[[a-zA-Z]]:[[\\/]]*) #(vi OS/2 EMX
1930 .\[$]{*prefix}*) #(vi
1932 case ".[$]$1" in #(vi
1934 $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%`
1939 $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%`
1942 ifelse([$2],,[AC_MSG_ERROR([expected a pathname, not \"[$]$1\"])],$2)
1946 dnl ---------------------------------------------------------------------------
1947 dnl CF_PDCURSES_X11 version: 9 updated: 2009/01/11 15:31:37
1949 dnl Configure for PDCurses' X11 library
1950 AC_DEFUN([CF_PDCURSES_X11],[
1951 AC_REQUIRE([CF_X_ATHENA])
1953 AC_PATH_PROGS(XCURSES_CONFIG,xcurses-config,none)
1955 if test "$XCURSES_CONFIG" != none ; then
1957 CPPFLAGS="$CPPFLAGS `$XCURSES_CONFIG --cflags`"
1958 LIBS="`$XCURSES_CONFIG --libs` $LIBS"
1960 cf_cv_lib_XCurses=yes
1964 LDFLAGS="$LDFLAGS $X_LIBS"
1965 CF_CHECK_CFLAGS($X_CFLAGS)
1966 AC_CHECK_LIB(X11,XOpenDisplay,
1967 [LIBS="-lX11 $LIBS"],,
1968 [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])
1969 AC_CACHE_CHECK(for XCurses library,cf_cv_lib_XCurses,[
1970 LIBS="-lXCurses $LIBS"
1972 #include <xcurses.h>
1973 char *XCursesProgramName = "test";
1975 [cf_cv_lib_XCurses=yes],
1976 [cf_cv_lib_XCurses=no])
1981 if test $cf_cv_lib_XCurses = yes ; then
1984 AC_DEFINE(HAVE_XCURSES)
1986 AC_MSG_ERROR(Cannot link with XCurses)
1989 dnl ---------------------------------------------------------------------------
1990 dnl CF_PKG_CONFIG version: 3 updated: 2009/01/25 10:55:09
1992 dnl Check for the package-config program, unless disabled by command-line.
1993 AC_DEFUN([CF_PKG_CONFIG],
1995 AC_MSG_CHECKING(if you want to use pkg-config)
1996 AC_ARG_WITH(pkg-config,
1997 [ --with-pkg-config{=path} enable/disable use of pkg-config],
1998 [cf_pkg_config=$withval],
1999 [cf_pkg_config=yes])
2000 AC_MSG_RESULT($cf_pkg_config)
2002 case $cf_pkg_config in #(vi
2007 AC_PATH_PROG(PKG_CONFIG, pkg-config, none)
2014 test -z "$PKG_CONFIG" && PKG_CONFIG=none
2015 if test "$PKG_CONFIG" != none ; then
2016 CF_PATH_SYNTAX(PKG_CONFIG)
2019 AC_SUBST(PKG_CONFIG)
2021 dnl ---------------------------------------------------------------------------
2022 dnl CF_POSIX_C_SOURCE version: 8 updated: 2010/05/26 05:38:42
2023 dnl -----------------
2024 dnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed.
2026 dnl POSIX.1-1990 _POSIX_SOURCE
2027 dnl POSIX.1-1990 and _POSIX_SOURCE and
2028 dnl POSIX.2-1992 C-Language _POSIX_C_SOURCE=2
2030 dnl POSIX.1b-1993 _POSIX_C_SOURCE=199309L
2031 dnl POSIX.1c-1996 _POSIX_C_SOURCE=199506L
2032 dnl X/Open 2000 _POSIX_C_SOURCE=200112L
2035 dnl $1 is the nominal value for _POSIX_C_SOURCE
2036 AC_DEFUN([CF_POSIX_C_SOURCE],
2038 cf_POSIX_C_SOURCE=ifelse([$1],,199506L,[$1])
2040 cf_save_CFLAGS="$CFLAGS"
2041 cf_save_CPPFLAGS="$CPPFLAGS"
2043 CF_REMOVE_DEFINE(cf_trim_CFLAGS,$cf_save_CFLAGS,_POSIX_C_SOURCE)
2044 CF_REMOVE_DEFINE(cf_trim_CPPFLAGS,$cf_save_CPPFLAGS,_POSIX_C_SOURCE)
2046 AC_CACHE_CHECK(if we should define _POSIX_C_SOURCE,cf_cv_posix_c_source,[
2047 CF_MSG_LOG(if the symbol is already defined go no further)
2048 AC_TRY_COMPILE([#include <sys/types.h>],[
2049 #ifndef _POSIX_C_SOURCE
2052 [cf_cv_posix_c_source=no],
2053 [cf_want_posix_source=no
2054 case .$cf_POSIX_C_SOURCE in #(vi
2056 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
2059 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
2060 cf_want_posix_source=yes
2063 cf_want_posix_source=yes
2066 if test "$cf_want_posix_source" = yes ; then
2067 AC_TRY_COMPILE([#include <sys/types.h>],[
2068 #ifdef _POSIX_SOURCE
2071 cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE")
2073 CF_MSG_LOG(ifdef from value $cf_POSIX_C_SOURCE)
2074 CFLAGS="$cf_trim_CFLAGS"
2075 CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source"
2076 CF_MSG_LOG(if the second compile does not leave our definition intact error)
2077 AC_TRY_COMPILE([#include <sys/types.h>],[
2078 #ifndef _POSIX_C_SOURCE
2081 [cf_cv_posix_c_source=no])
2082 CFLAGS="$cf_save_CFLAGS"
2083 CPPFLAGS="$cf_save_CPPFLAGS"
2087 if test "$cf_cv_posix_c_source" != no ; then
2088 CFLAGS="$cf_trim_CFLAGS"
2089 CPPFLAGS="$cf_trim_CPPFLAGS"
2090 CF_ADD_CFLAGS($cf_cv_posix_c_source)
2094 dnl ---------------------------------------------------------------------------
2095 dnl CF_PRG_RULES version: 1 updated: 2006/06/03 11:45:08
2097 dnl Append definitions and rules for the given programs to the subdirectory
2098 dnl Makefiles, and the recursion rule for the top-level Makefile.
2101 dnl $1 = script to run
2102 dnl $2 = list of subdirectories
2106 AC_DEFUN([CF_PRG_RULES],
2110 if test ! -d $srcdir/$cf_dir; then
2112 elif test -f $srcdir/$cf_dir/programs; then
2113 $AWK -f $1 $srcdir/$cf_dir/programs >>$cf_dir/Makefile
2118 dnl ---------------------------------------------------------------------------
2119 dnl CF_PROG_CC_U_D version: 1 updated: 2005/07/14 16:59:30
2121 dnl Check if C (preprocessor) -U and -D options are processed in the order
2122 dnl given rather than by type of option. Some compilers insist on apply all
2123 dnl of the -U options after all of the -D options. Others allow mixing them,
2124 dnl and may predefine symbols that conflict with those we define.
2125 AC_DEFUN([CF_PROG_CC_U_D],
2127 AC_CACHE_CHECK(if $CC -U and -D options work together,cf_cv_cc_u_d_options,[
2128 cf_save_CPPFLAGS="$CPPFLAGS"
2129 CPPFLAGS="-UU_D_OPTIONS -DU_D_OPTIONS -DD_U_OPTIONS -UD_U_OPTIONS"
2132 make an undefined-error
2135 make a defined-error
2138 cf_cv_cc_u_d_options=yes],[
2139 cf_cv_cc_u_d_options=no])
2140 CPPFLAGS="$cf_save_CPPFLAGS"
2143 dnl ---------------------------------------------------------------------------
2144 dnl CF_REMOVE_DEFINE version: 3 updated: 2010/01/09 11:05:50
2145 dnl ----------------
2146 dnl Remove all -U and -D options that refer to the given symbol from a list
2147 dnl of C compiler options. This works around the problem that not all
2148 dnl compilers process -U and -D options from left-to-right, so a -U option
2149 dnl cannot be used to cancel the effect of a preceding -D option.
2151 dnl $1 = target (which could be the same as the source variable)
2152 dnl $2 = source (including '$')
2153 dnl $3 = symbol to remove
2154 define([CF_REMOVE_DEFINE],
2157 sed -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[[ ]]/ /g' \
2158 -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[$]//g'`
2160 dnl ---------------------------------------------------------------------------
2161 dnl CF_SIG_ATOMIC_T version: 2 updated: 2005/09/18 17:27:12
2163 dnl signal handler, but there are some gcc depedencies in that recommendation.
2165 AC_DEFUN([CF_SIG_ATOMIC_T],
2167 AC_MSG_CHECKING(for signal global datatype)
2168 AC_CACHE_VAL(cf_cv_sig_atomic_t,[
2170 "volatile sig_atomic_t" \
2175 #include <sys/types.h>
2181 static void handler(int sig)
2185 [signal(SIGINT, handler);
2187 [cf_cv_sig_atomic_t=$cf_type],
2188 [cf_cv_sig_atomic_t=no])
2189 test "$cf_cv_sig_atomic_t" != no && break
2192 AC_MSG_RESULT($cf_cv_sig_atomic_t)
2193 test "$cf_cv_sig_atomic_t" != no && AC_DEFINE_UNQUOTED(SIG_ATOMIC_T, $cf_cv_sig_atomic_t)
2195 dnl ---------------------------------------------------------------------------
2196 dnl CF_SUBDIR_PATH version: 6 updated: 2010/04/21 06:20:50
2198 dnl Construct a search-list for a nonstandard header/lib-file
2199 dnl $1 = the variable to return as result
2200 dnl $2 = the package name
2201 dnl $3 = the subdirectory, e.g., bin, include or lib
2202 AC_DEFUN([CF_SUBDIR_PATH],
2206 CF_ADD_SUBDIR_PATH($1,$2,$3,/usr,$prefix)
2207 CF_ADD_SUBDIR_PATH($1,$2,$3,$prefix,NONE)
2208 CF_ADD_SUBDIR_PATH($1,$2,$3,/usr/local,$prefix)
2209 CF_ADD_SUBDIR_PATH($1,$2,$3,/opt,$prefix)
2210 CF_ADD_SUBDIR_PATH($1,$2,$3,[$]HOME,$prefix)
2212 dnl ---------------------------------------------------------------------------
2213 dnl CF_SYS_TIME_SELECT version: 4 updated: 2000/10/04 09:18:40
2214 dnl ------------------
2215 dnl Check if we can include <sys/time.h> with <sys/select.h>; this breaks on
2216 dnl older SCO configurations.
2217 AC_DEFUN([CF_SYS_TIME_SELECT],
2219 AC_MSG_CHECKING(if sys/time.h works with sys/select.h)
2220 AC_CACHE_VAL(cf_cv_sys_time_select,[
2222 #include <sys/types.h>
2223 #ifdef HAVE_SYS_TIME_H
2224 #include <sys/time.h>
2226 #ifdef HAVE_SYS_SELECT_H
2227 #include <sys/select.h>
2229 ],[],[cf_cv_sys_time_select=yes],
2230 [cf_cv_sys_time_select=no])
2232 AC_MSG_RESULT($cf_cv_sys_time_select)
2233 test "$cf_cv_sys_time_select" = yes && AC_DEFINE(HAVE_SYS_TIME_SELECT)
2235 dnl ---------------------------------------------------------------------------
2236 dnl CF_TERM_HEADER version: 1 updated: 2005/12/31 13:26:39
2238 dnl Look for term.h, which is part of X/Open curses. It defines the interface
2239 dnl to terminfo database. Usually it is in the same include-path as curses.h,
2240 dnl but some packagers change this, breaking various applications.
2241 AC_DEFUN([CF_TERM_HEADER],[
2242 AC_CACHE_CHECK(for terminfo header, cf_cv_term_header,[
2243 case ${cf_cv_ncurses_header} in #(vi
2244 */ncurses.h|*/ncursesw.h) #(vi
2245 cf_term_header=`echo "$cf_cv_ncurses_header" | sed -e 's%ncurses[[^.]]*\.h$%term.h%'`
2248 cf_term_header=term.h
2252 for cf_test in $cf_term_header "ncurses/term.h" "ncursesw/term.h"
2254 AC_TRY_COMPILE([#include <stdio.h>
2255 #include <${cf_cv_ncurses_header-curses.h}>
2257 ],[int x = auto_left_margin],[
2258 cf_cv_term_header="$cf_test"],[
2259 cf_cv_term_header=unknown
2261 test "$cf_cv_term_header" != unknown && break
2265 # Set definitions to allow ifdef'ing to accommodate subdirectories
2267 case $cf_cv_term_header in # (vi
2269 AC_DEFINE(HAVE_TERM_H)
2273 case $cf_cv_term_header in # (vi
2274 ncurses/term.h) #(vi
2275 AC_DEFINE(HAVE_NCURSES_TERM_H)
2278 AC_DEFINE(HAVE_NCURSESW_TERM_H)
2282 dnl ---------------------------------------------------------------------------
2283 dnl CF_TRY_PKG_CONFIG version: 3 updated: 2010/06/02 05:03:05
2284 dnl -----------------
2285 dnl This is a simple wrapper to use for pkg-config, for libraries which may be
2286 dnl available in that form.
2288 dnl $1 = package name
2289 dnl $2 = extra logic to use, if any, after updating CFLAGS and LIBS
2290 dnl $3 = logic to use if pkg-config does not have the package
2291 AC_DEFUN([CF_TRY_PKG_CONFIG],[
2292 AC_REQUIRE([CF_PKG_CONFIG])
2294 if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists $1; then
2295 CF_VERBOSE(found package $1)
2296 cf_pkgconfig_incs="`$PKG_CONFIG --cflags $1 2>/dev/null`"
2297 cf_pkgconfig_libs="`$PKG_CONFIG --libs $1 2>/dev/null`"
2298 CF_ADD_CFLAGS($cf_pkgconfig_incs)
2299 CF_ADD_LIBS($cf_pkgconfig_libs)
2300 ifelse([$2],,:,[$2])
2302 ifelse([$3],,:,[$3])
2305 dnl ---------------------------------------------------------------------------
2306 dnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59
2308 dnl Make an uppercase version of a variable
2309 dnl $1=uppercase($2)
2310 AC_DEFUN([CF_UPPER],
2312 $1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
2314 dnl ---------------------------------------------------------------------------
2315 dnl CF_UTF8_LIB version: 6 updated: 2010/04/21 06:20:50
2317 dnl Check for multibyte support, and if not found, utf8 compatibility library
2318 AC_DEFUN([CF_UTF8_LIB],
2320 AC_CACHE_CHECK(for multibyte character support,cf_cv_utf8_lib,[
2321 cf_save_LIBS="$LIBS"
2323 #include <stdlib.h>],[putwc(0,0);],
2324 [cf_cv_utf8_lib=yes],
2326 #include <libutf8.h>],[putwc(0,0);],utf8,
2327 [cf_cv_utf8_lib=add-on],
2328 [cf_cv_utf8_lib=no])
2331 # HAVE_LIBUTF8_H is used by ncurses if curses.h is shared between
2333 if test "$cf_cv_utf8_lib" = "add-on" ; then
2334 AC_DEFINE(HAVE_LIBUTF8_H)
2335 CF_ADD_INCDIR($cf_cv_header_path_utf8)
2336 CF_ADD_LIBDIR($cf_cv_library_path_utf8)
2337 LIBS="$cf_cv_library_file_utf8 $LIBS"
2340 dnl ---------------------------------------------------------------------------
2341 dnl CF_VERBOSE version: 3 updated: 2007/07/29 09:55:12
2343 dnl Use AC_VERBOSE w/o the warnings
2344 AC_DEFUN([CF_VERBOSE],
2345 [test -n "$verbose" && echo " $1" 1>&AC_FD_MSG
2348 dnl ---------------------------------------------------------------------------
2349 dnl CF_WCHAR_TYPE version: 3 updated: 2010/05/26 16:44:57
2351 dnl Check if type wide-character type $1 is declared, and if so, which header
2352 dnl file is needed. The second parameter is used to set a shell variable when
2353 dnl the type is not found. The first parameter sets a shell variable for the
2355 AC_DEFUN([CF_WCHAR_TYPE],
2357 # This is needed on Tru64 5.0 to declare $1
2358 AC_CACHE_CHECK(if we must include wchar.h to declare $1,cf_cv_$1,[
2363 #ifdef HAVE_LIBUTF8_H
2364 #include <libutf8.h>
2373 #ifdef HAVE_LIBUTF8_H
2374 #include <libutf8.h>
2378 [cf_cv_$1=unknown])])])
2380 if test "$cf_cv_$1" = yes ; then
2381 AC_DEFINE(NEED_WCHAR_H)
2386 # if we do not find $1 in either place, use substitution to provide a fallback.
2387 if test "$cf_cv_$1" = unknown ; then
2392 # if we find $1 in either place, use substitution to provide a fallback.
2393 if test "$cf_cv_$1" != unknown ; then
2398 dnl ---------------------------------------------------------------------------
2399 dnl CF_WITH_CURSES_DIR version: 2 updated: 2002/11/10 14:46:59
2400 dnl ------------------
2401 dnl Wrapper for AC_ARG_WITH to specify directory under which to look for curses
2403 AC_DEFUN([CF_WITH_CURSES_DIR],[
2404 AC_ARG_WITH(curses-dir,
2405 [ --with-curses-dir=DIR directory in which (n)curses is installed],
2406 [CF_PATH_SYNTAX(withval)
2407 cf_cv_curses_dir=$withval],
2408 [cf_cv_curses_dir=no])
2410 dnl ---------------------------------------------------------------------------
2411 dnl CF_XOPEN_CURSES version: 9 updated: 2010/04/28 06:02:16
2413 dnl Test if we should define X/Open source for curses, needed on Digital Unix
2414 dnl 4.x, to see the extended functions, but breaks on IRIX 6.x.
2416 dnl The getbegyx() check is needed for HPUX, which omits legacy macros such
2417 dnl as getbegy(). The latter is better design, but the former is standard.
2418 AC_DEFUN([CF_XOPEN_CURSES],
2420 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
2421 AC_CACHE_CHECK(if we must define _XOPEN_SOURCE_EXTENDED,cf_cv_need_xopen_extension,[
2424 #include <${cf_cv_ncurses_header-curses.h}>],[
2425 #if defined(NCURSES_VERSION_PATCH)
2426 if (NCURSES_VERSION_PATCH < 20100501) && (NCURSES_VERSION_PATCH >= 20100403)
2430 long x = winnstr(stdscr, "", 0);
2432 getbegyx(stdscr, y1, x1)],
2433 [cf_cv_need_xopen_extension=no],
2435 #define _XOPEN_SOURCE_EXTENDED
2437 #include <${cf_cv_ncurses_header-curses.h}>],[
2438 #ifdef NCURSES_VERSION
2440 int check2 = curs_set((int)sizeof(check));
2442 long x = winnstr(stdscr, "", 0);
2444 getbegyx(stdscr, y1, x1)],
2445 [cf_cv_need_xopen_extension=yes],
2446 [cf_cv_need_xopen_extension=unknown])])])
2447 test $cf_cv_need_xopen_extension = yes && CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED"
2449 dnl ---------------------------------------------------------------------------
2450 dnl CF_XOPEN_SOURCE version: 34 updated: 2010/05/26 05:38:42
2452 dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions,
2453 dnl or adapt to the vendor's definitions to get equivalent functionality,
2454 dnl without losing the common non-POSIX features.
2457 dnl $1 is the nominal value for _XOPEN_SOURCE
2458 dnl $2 is the nominal value for _POSIX_C_SOURCE
2459 AC_DEFUN([CF_XOPEN_SOURCE],[
2461 cf_XOPEN_SOURCE=ifelse([$1],,500,[$1])
2462 cf_POSIX_C_SOURCE=ifelse([$2],,199506L,[$2])
2465 case $host_os in #(vi
2467 cf_xopen_source="-D_ALL_SOURCE"
2469 darwin[[0-8]].*) #(vi
2470 cf_xopen_source="-D_APPLE_C_SOURCE"
2473 cf_xopen_source="-D_DARWIN_C_SOURCE"
2475 freebsd*|dragonfly*) #(vi
2476 # 5.x headers associate
2477 # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L
2478 # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L
2479 cf_POSIX_C_SOURCE=200112L
2481 cf_xopen_source="-D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
2484 cf_xopen_source="-D_HPUX_SOURCE -D_XOPEN_SOURCE=500"
2487 cf_xopen_source="-D_HPUX_SOURCE"
2490 cf_xopen_source="-D_SGI_SOURCE"
2492 linux*|gnu*|mint*|k*bsd*-gnu) #(vi
2496 # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <arpa/inet.h>
2499 # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw
2502 # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw
2505 cf_xopen_source="-D_OSF_SOURCE"
2508 cf_xopen_source="-D_QNX_SOURCE"
2511 # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer
2513 solaris2.1[[0-9]]) #(vi
2514 cf_xopen_source="-D__EXTENSIONS__ -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
2516 solaris2.[[1-9]]) #(vi
2517 cf_xopen_source="-D__EXTENSIONS__"
2520 AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[
2521 AC_TRY_COMPILE([#include <sys/types.h>],[
2522 #ifndef _XOPEN_SOURCE
2525 [cf_cv_xopen_source=no],
2526 [cf_save="$CPPFLAGS"
2527 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
2528 AC_TRY_COMPILE([#include <sys/types.h>],[
2529 #ifdef _XOPEN_SOURCE
2532 [cf_cv_xopen_source=no],
2533 [cf_cv_xopen_source=$cf_XOPEN_SOURCE])
2537 if test "$cf_cv_xopen_source" != no ; then
2538 CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE)
2539 CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE)
2540 cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source"
2541 CF_ADD_CFLAGS($cf_temp_xopen_source)
2543 CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE)
2547 if test -n "$cf_xopen_source" ; then
2548 CF_ADD_CFLAGS($cf_xopen_source)
2551 dnl ---------------------------------------------------------------------------
2552 dnl CF_X_ATHENA version: 15 updated: 2010/06/02 05:03:05
2554 dnl Check for Xaw (Athena) libraries
2556 dnl Sets $cf_x_athena according to the flavor of Xaw which is used.
2557 AC_DEFUN([CF_X_ATHENA],
2559 cf_x_athena=${cf_x_athena-Xaw}
2561 AC_MSG_CHECKING(if you want to link with Xaw 3d library)
2564 [ --with-Xaw3d link with Xaw 3d library])
2565 if test "$withval" = yes ; then
2572 AC_MSG_CHECKING(if you want to link with neXT Athena library)
2575 [ --with-neXtaw link with neXT Athena library])
2576 if test "$withval" = yes ; then
2583 AC_MSG_CHECKING(if you want to link with Athena-Plus library)
2585 AC_ARG_WITH(XawPlus,
2586 [ --with-XawPlus link with Athena-Plus library])
2587 if test "$withval" = yes ; then
2596 if test "$PKG_CONFIG" != none ; then
2598 test "$cf_x_athena" = Xaw && cf_athena_list="xaw8 xaw7 xaw6"
2599 for cf_athena_pkg in \
2602 ${cf_x_athena}-devel \
2604 lib${cf_x_athena}-devel
2606 if "$PKG_CONFIG" --exists $cf_athena_pkg; then
2607 CF_VERBOSE(found package $cf_athena_pkg)
2608 cf_x_athena_inc="`$PKG_CONFIG --cflags $cf_athena_pkg 2>/dev/null`"
2609 cf_x_athena_lib="`$PKG_CONFIG --libs $cf_athena_pkg 2>/dev/null`"
2610 CF_ADD_CFLAGS($cf_x_athena_inc)
2611 CF_ADD_LIBS($cf_x_athena_lib)
2613 CF_UPPER(cf_x_athena_LIBS,HAVE_LIB_$cf_x_athena)
2614 AC_DEFINE_UNQUOTED($cf_x_athena_LIBS)
2620 if test -z "$cf_x_athena_lib" ; then
2623 CF_X_ATHENA_CPPFLAGS($cf_x_athena)
2624 CF_X_ATHENA_LIBS($cf_x_athena)
2627 dnl ---------------------------------------------------------------------------
2628 dnl CF_X_ATHENA_CPPFLAGS version: 5 updated: 2010/05/26 17:35:30
2629 dnl --------------------
2630 dnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of
2631 dnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw.
2632 AC_DEFUN([CF_X_ATHENA_CPPFLAGS],
2634 cf_x_athena_root=ifelse([$1],,Xaw,[$1])
2637 for cf_path in default \
2638 /usr/contrib/X11R6 \
2639 /usr/contrib/X11R5 \
2643 if test -z "$cf_x_athena_inc" ; then
2645 cf_test=X11/$cf_x_athena_root/SimpleMenu.h
2646 if test $cf_path != default ; then
2647 CPPFLAGS="$cf_save -I$cf_path/include"
2648 AC_MSG_CHECKING(for $cf_test in $cf_path)
2650 AC_MSG_CHECKING(for $cf_test)
2653 #include <X11/Intrinsic.h>
2654 #include <$cf_test>],[],
2657 AC_MSG_RESULT($cf_result)
2658 if test "$cf_result" = yes ; then
2659 cf_x_athena_inc=$cf_path
2667 if test -z "$cf_x_athena_inc" ; then
2669 [Unable to successfully find Athena header files with test program])
2670 elif test "$cf_x_athena_inc" != default ; then
2671 CPPFLAGS="$CPPFLAGS -I$cf_x_athena_inc"
2674 dnl ---------------------------------------------------------------------------
2675 dnl CF_X_ATHENA_LIBS version: 9 updated: 2010/06/02 05:03:05
2676 dnl ----------------
2677 dnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of
2678 dnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw.
2679 AC_DEFUN([CF_X_ATHENA_LIBS],
2680 [AC_REQUIRE([CF_X_TOOLKIT])
2681 cf_x_athena_root=ifelse([$1],,Xaw,[$1])
2684 for cf_path in default \
2685 /usr/contrib/X11R6 \
2686 /usr/contrib/X11R5 \
2691 "-l$cf_x_athena_root -lXmu" \
2692 "-l$cf_x_athena_root -lXpm -lXmu" \
2693 "-l${cf_x_athena_root}_s -lXmu_s"
2695 if test -z "$cf_x_athena_lib" ; then
2697 cf_test=XawSimpleMenuAddGlobalActions
2698 if test $cf_path != default ; then
2699 CF_ADD_LIBS(-L$cf_path/lib $cf_lib)
2700 AC_MSG_CHECKING(for $cf_lib in $cf_path)
2702 CF_ADD_LIBS($cf_lib)
2703 AC_MSG_CHECKING(for $cf_test in $cf_lib)
2705 AC_TRY_LINK([],[$cf_test()],
2708 AC_MSG_RESULT($cf_result)
2709 if test "$cf_result" = yes ; then
2710 cf_x_athena_lib="$cf_lib"
2718 if test -z "$cf_x_athena_lib" ; then
2720 [Unable to successfully link Athena library (-l$cf_x_athena_root) with test program])
2723 CF_UPPER(cf_x_athena_LIBS,HAVE_LIB_$cf_x_athena)
2724 AC_DEFINE_UNQUOTED($cf_x_athena_LIBS)
2726 dnl ---------------------------------------------------------------------------
2727 dnl CF_X_EXT version: 3 updated: 2010/06/02 05:03:05
2729 AC_DEFUN([CF_X_EXT],[
2730 CF_TRY_PKG_CONFIG(Xext,,[
2731 AC_CHECK_LIB(Xext,XextCreateExtension,
2732 [CF_ADD_LIB(Xext)])])
2734 dnl ---------------------------------------------------------------------------
2735 dnl CF_X_TOOLKIT version: 14 updated: 2010/06/02 05:03:05
2737 dnl Check for X Toolkit libraries
2739 AC_DEFUN([CF_X_TOOLKIT],
2741 AC_REQUIRE([AC_PATH_XTRA])
2742 AC_REQUIRE([CF_CHECK_CACHE])
2746 CF_TRY_PKG_CONFIG(xt,[
2750 LDFLAGS="$X_LIBS $LDFLAGS"
2751 CF_CHECK_CFLAGS($X_CFLAGS)
2753 AC_CHECK_FUNC(XOpenDisplay,,[
2754 AC_CHECK_LIB(X11,XOpenDisplay,
2756 [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])])
2758 AC_CHECK_FUNC(XtAppInitialize,,[
2759 AC_CHECK_LIB(Xt, XtAppInitialize,
2760 [AC_DEFINE(HAVE_LIBXT)
2762 LIBS="-lXt $X_PRE_LIBS $LIBS $X_EXTRA_LIBS"],,
2763 [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])])
2766 if test $cf_have_X_LIBS = no ; then
2768 [Unable to successfully link X Toolkit library (-lXt) with
2769 test program. You will have to check and add the proper libraries by hand
2773 dnl ---------------------------------------------------------------------------
2774 dnl CF__CURSES_HEAD version: 1 updated: 2009/07/16 19:32:31
2776 dnl Define a reusable chunk which includes <curses.h> and <term.h> when they
2777 dnl are both available.
2778 define([CF__CURSES_HEAD],[
2780 #include <xcurses.h>
2781 char * XCursesProgramName = "test";
2783 #include <${cf_cv_ncurses_header-curses.h}>
2784 #if defined(NCURSES_VERSION) && defined(HAVE_NCURSESW_TERM_H)
2785 #include <ncursesw/term.h>
2786 #elif defined(NCURSES_VERSION) && defined(HAVE_NCURSES_TERM_H)
2787 #include <ncurses/term.h>
2788 #elif defined(HAVE_TERM_H)