1 dnl***************************************************************************
2 dnl Copyright (c) 2003-2005,2006 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.19 2007/06/09 20:01:31 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: 4 updated: 2002/12/21 14:25:52
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 gives error messages if -I/usr/local/include is added to
131 dnl the include-path).
132 AC_DEFUN([CF_ADD_INCDIR],
134 for cf_add_incdir in $1
138 case $cf_add_incdir in
141 /usr/local/include) # (vi
144 cf_save_CPPFLAGS="$CPPFLAGS"
145 CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
146 AC_TRY_COMPILE([#include <stdio.h>],
149 [CPPFLAGS="$cf_save_CPPFLAGS"])
153 CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
156 cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'`
157 test "$cf_top_incdir" = "$cf_add_incdir" && break
158 cf_add_incdir="$cf_top_incdir"
162 dnl ---------------------------------------------------------------------------
163 dnl CF_ANSI_CC_CHECK version: 9 updated: 2001/12/30 17:53:34
165 dnl This is adapted from the macros 'fp_PROG_CC_STDC' and 'fp_C_PROTOTYPES'
166 dnl in the sharutils 4.2 distribution.
167 AC_DEFUN([CF_ANSI_CC_CHECK],
169 AC_CACHE_CHECK(for ${CC-cc} option to accept ANSI C, cf_cv_ansi_cc,[
171 cf_save_CFLAGS="$CFLAGS"
172 cf_save_CPPFLAGS="$CPPFLAGS"
173 # Don't try gcc -ansi; that turns off useful extensions and
174 # breaks some systems' header files.
176 # Ultrix and OSF/1 -std1
177 # HP-UX -Aa -D_HPUX_SOURCE
179 # UnixWare 1.2 (cannot use -Xc, since ANSI/POSIX clashes)
180 for cf_arg in "-DCC_HAS_PROTOS" \
185 "-Aa -D_HPUX_SOURCE" \
188 CF_ADD_CFLAGS($cf_arg)
191 #ifndef CC_HAS_PROTOS
192 #if !defined(__STDC__) || (__STDC__ != 1)
197 int test (int i, double x);
198 struct s1 {int (*f) (int a);};
199 struct s2 {int (*f) (double a);};],
200 [cf_cv_ansi_cc="$cf_arg"; break])
202 CFLAGS="$cf_save_CFLAGS"
203 CPPFLAGS="$cf_save_CPPFLAGS"
206 if test "$cf_cv_ansi_cc" != "no"; then
207 if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then
208 CF_ADD_CFLAGS($cf_cv_ansi_cc)
210 AC_DEFINE(CC_HAS_PROTOS)
214 dnl ---------------------------------------------------------------------------
215 dnl CF_ANSI_CC_REQD version: 3 updated: 1997/09/06 13:40:44
217 dnl For programs that must use an ANSI compiler, obtain compiler options that
218 dnl will make it recognize prototypes. We'll do preprocessor checks in other
219 dnl macros, since tools such as unproto can fake prototypes, but only part of
220 dnl the preprocessor.
221 AC_DEFUN([CF_ANSI_CC_REQD],
222 [AC_REQUIRE([CF_ANSI_CC_CHECK])
223 if test "$cf_cv_ansi_cc" = "no"; then
225 [Your compiler does not appear to recognize prototypes.
226 You have the following choices:
227 a. adjust your compiler options
228 b. get an up-to-date compiler
229 c. use a wrapper such as unproto])
232 dnl ---------------------------------------------------------------------------
233 dnl CF_ARG_DISABLE version: 3 updated: 1999/03/30 17:24:31
235 dnl Allow user to disable a normally-on option.
236 AC_DEFUN([CF_ARG_DISABLE],
237 [CF_ARG_OPTION($1,[$2],[$3],[$4],yes)])dnl
238 dnl ---------------------------------------------------------------------------
239 dnl CF_ARG_ENABLE version: 3 updated: 1999/03/30 17:24:31
241 dnl Allow user to enable a normally-off option.
242 AC_DEFUN([CF_ARG_ENABLE],
243 [CF_ARG_OPTION($1,[$2],[$3],[$4],no)])dnl
244 dnl ---------------------------------------------------------------------------
245 dnl CF_ARG_OPTION version: 3 updated: 1997/10/18 14:42:41
247 dnl Restricted form of AC_ARG_ENABLE that ensures user doesn't give bogus
253 dnl $3 = action to perform if option is not default
254 dnl $4 = action if perform if option is default
255 dnl $5 = default option value (either 'yes' or 'no')
256 AC_DEFUN([CF_ARG_OPTION],
257 [AC_ARG_ENABLE($1,[$2],[test "$enableval" != ifelse($5,no,yes,no) && enableval=ifelse($5,no,no,yes)
258 if test "$enableval" != "$5" ; then
260 ,[ $3]) ifelse($4,,,[
263 fi],[enableval=$5 ifelse($4,,,[
267 dnl ---------------------------------------------------------------------------
268 dnl CF_CHECK_CACHE version: 10 updated: 2004/05/23 13:03:31
270 dnl Check if we're accidentally using a cache from a different machine.
271 dnl Derive the system name, as a check for reusing the autoconf cache.
273 dnl If we've packaged config.guess and config.sub, run that (since it does a
274 dnl better job than uname). Normally we'll use AC_CANONICAL_HOST, but allow
275 dnl an extra parameter that we may override, e.g., for AC_CANONICAL_SYSTEM
276 dnl which is useful in cross-compiles.
278 dnl Note: we would use $ac_config_sub, but that is one of the places where
279 dnl autoconf 2.5x broke compatibility with autoconf 2.13
280 AC_DEFUN([CF_CHECK_CACHE],
282 if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then
283 ifelse([$1],,[AC_CANONICAL_HOST],[$1])
284 system_name="$host_os"
286 system_name="`(uname -s -r) 2>/dev/null`"
287 if test -z "$system_name" ; then
288 system_name="`(hostname) 2>/dev/null`"
291 test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name")
292 AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"])
294 test -z "$system_name" && system_name="$cf_cv_system_name"
295 test -n "$cf_cv_system_name" && AC_MSG_RESULT(Configuring for $cf_cv_system_name)
297 if test ".$system_name" != ".$cf_cv_system_name" ; then
298 AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name))
299 AC_ERROR("Please remove config.cache and try again.")
302 dnl ---------------------------------------------------------------------------
303 dnl CF_CHECK_CFLAGS version: 2 updated: 2001/12/30 19:09:58
305 dnl Conditionally add to $CFLAGS and $CPPFLAGS values which are derived from
306 dnl a build-configuration such as imake. These have the pitfall that they
307 dnl often contain compiler-specific options which we cannot use, mixed with
308 dnl preprocessor options that we usually can.
309 AC_DEFUN([CF_CHECK_CFLAGS],
311 CF_VERBOSE(checking additions to CFLAGS)
312 cf_check_cflags="$CFLAGS"
313 cf_check_cppflags="$CPPFLAGS"
314 CF_ADD_CFLAGS($1,yes)
315 if test "$cf_check_cflags" != "$CFLAGS" ; then
316 AC_TRY_LINK([#include <stdio.h>],[printf("Hello world");],,
317 [CF_VERBOSE(test-compile failed. Undoing change to \$CFLAGS)
318 if test "$cf_check_cppflags" != "$CPPFLAGS" ; then
319 CF_VERBOSE(but keeping change to \$CPPFLAGS)
321 CFLAGS="$cf_check_flags"])
324 dnl ---------------------------------------------------------------------------
325 dnl CF_CURSES_ACS_MAP version: 3 updated: 2003/05/17 22:19:02
326 dnl -----------------
327 dnl Check for likely values of acs_map[]:
328 AC_DEFUN([CF_CURSES_ACS_MAP],
330 AC_CACHE_CHECK(for alternate character set array, cf_cv_curses_acs_map,[
331 cf_cv_curses_acs_map=unknown
332 for name in acs_map _acs_map __acs_map _nc_acs_map
335 #include <${cf_cv_ncurses_header-curses.h}>
337 $name['k'] = ACS_PLUS
338 ],[cf_cv_curses_acs_map=$name; break])
342 test "$cf_cv_curses_acs_map" != unknown && AC_DEFINE_UNQUOTED(CURSES_ACS_ARRAY,$cf_cv_curses_acs_map)
344 dnl ---------------------------------------------------------------------------
345 dnl CF_CURSES_CHECK_TYPE version: 2 updated: 2003/03/01 23:40:33
346 dnl --------------------
347 dnl Check if curses.h defines the given type
348 AC_DEFUN([CF_CURSES_CHECK_TYPE],
350 AC_MSG_CHECKING(for type $1 in ${cf_cv_ncurses_header-curses.h})
352 #ifndef _XOPEN_SOURCE_EXTENDED
353 #define _XOPEN_SOURCE_EXTENDED
355 #include <${cf_cv_ncurses_header-curses.h}>],[
357 ],cf_result=yes,cf_result=no)
358 AC_MSG_RESULT($cf_result)
359 if test $cf_result = yes ; then
360 CF_UPPER(cf_result,have_type_$1)
361 AC_DEFINE_UNQUOTED($cf_result)
363 AC_DEFINE_UNQUOTED($1,$2)
366 dnl ---------------------------------------------------------------------------
367 dnl CF_CURSES_CPPFLAGS version: 9 updated: 2006/02/04 19:44:43
368 dnl ------------------
369 dnl Look for the curses headers.
370 AC_DEFUN([CF_CURSES_CPPFLAGS],[
372 AC_CACHE_CHECK(for extra include directories,cf_cv_curses_incdir,[
373 cf_cv_curses_incdir=no
374 case $host_os in #(vi
376 test -d /usr/include/curses_colr && \
377 cf_cv_curses_incdir="-I/usr/include/curses_colr"
380 test -d /usr/5lib && \
381 test -d /usr/5include && \
382 cf_cv_curses_incdir="-I/usr/5include"
386 test "$cf_cv_curses_incdir" != no && CPPFLAGS="$cf_cv_curses_incdir $CPPFLAGS"
391 dnl ---------------------------------------------------------------------------
392 dnl CF_CURSES_HEADER version: 1 updated: 2005/12/31 13:28:25
394 dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common
395 dnl variations of ncurses' installs.
397 dnl See also CF_NCURSES_HEADER, which sets the same cache variable.
398 AC_DEFUN([CF_CURSES_HEADER],[
399 AC_CACHE_CHECK(if we have identified curses headers,cf_cv_ncurses_header,[
400 cf_cv_ncurses_header=none
407 AC_TRY_COMPILE([#include <${cf_header}>],
408 [initscr(); tgoto("?", 0,0)],
409 [cf_cv_ncurses_header=$cf_header; break],[])
413 if test "$cf_cv_ncurses_header" = none ; then
414 AC_MSG_ERROR(No curses header-files found)
417 # cheat, to get the right #define's for HAVE_NCURSES_H, etc.
418 AC_CHECK_HEADERS($cf_cv_ncurses_header)
420 dnl ---------------------------------------------------------------------------
421 dnl CF_CURSES_LIBS version: 24 updated: 2006/02/04 19:44:43
423 dnl Look for the curses libraries. Older curses implementations may require
424 dnl termcap/termlib to be linked as well. Call CF_CURSES_CPPFLAGS first.
425 AC_DEFUN([CF_CURSES_LIBS],[
427 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
428 AC_MSG_CHECKING(if we have identified curses libraries)
429 AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>],
430 [initscr(); tgoto("?", 0,0)],
433 AC_MSG_RESULT($cf_result)
435 if test "$cf_result" = no ; then
436 case $host_os in #(vi
438 AC_CHECK_LIB(mytinfo,tgoto,[LIBS="-lmytinfo $LIBS"])
441 AC_CHECK_LIB(cur_colr,initscr,[
442 LIBS="-lcur_colr $LIBS"
443 ac_cv_func_initscr=yes
445 AC_CHECK_LIB(Hcurses,initscr,[
446 # HP's header uses __HP_CURSES, but user claims _HP_CURSES.
447 LIBS="-lHcurses $LIBS"
448 CPPFLAGS="-D__HP_CURSES -D_HP_CURSES $CPPFLAGS"
449 ac_cv_func_initscr=yes
452 linux*) # Suse Linux does not follow /usr/lib convention
456 test -d /usr/5lib && \
457 LIBS="$LIBS -L/usr/5lib -lcurses -ltermcap"
458 ac_cv_func_initscr=yes
462 if test ".$ac_cv_func_initscr" != .yes ; then
467 if test ".${cf_cv_ncurses_version-no}" != .no
469 cf_check_list="ncurses curses cursesX"
471 cf_check_list="cursesX curses ncurses"
474 # Check for library containing tgoto. Do this before curses library
475 # because it may be needed to link the test-case for initscr.
476 AC_CHECK_FUNC(tgoto,[cf_term_lib=predefined],[
477 for cf_term_lib in $cf_check_list termcap termlib unknown
479 AC_CHECK_LIB($cf_term_lib,tgoto,[break])
483 # Check for library containing initscr
484 test "$cf_term_lib" != predefined && test "$cf_term_lib" != unknown && LIBS="-l$cf_term_lib $cf_save_LIBS"
485 for cf_curs_lib in $cf_check_list xcurses jcurses unknown
487 AC_CHECK_LIB($cf_curs_lib,initscr,[break])
489 test $cf_curs_lib = unknown && AC_ERROR(no curses library found)
491 LIBS="-l$cf_curs_lib $cf_save_LIBS"
492 if test "$cf_term_lib" = unknown ; then
493 AC_MSG_CHECKING(if we can link with $cf_curs_lib library)
494 AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>],
498 AC_MSG_RESULT($cf_result)
499 test $cf_result = no && AC_ERROR(Cannot link curses library)
500 elif test "$cf_curs_lib" = "$cf_term_lib" ; then
502 elif test "$cf_term_lib" != predefined ; then
503 AC_MSG_CHECKING(if we need both $cf_curs_lib and $cf_term_lib libraries)
504 AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>],
505 [initscr(); tgoto((char *)0, 0, 0);],
508 LIBS="-l$cf_curs_lib -l$cf_term_lib $cf_save_LIBS"
509 AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>],
514 AC_MSG_RESULT($cf_result)
520 dnl ---------------------------------------------------------------------------
521 dnl CF_CURSES_WACS_MAP version: 3 updated: 2003/05/17 22:19:02
522 dnl ------------------
523 dnl Check for likely values of wacs_map[]:
524 AC_DEFUN([CF_CURSES_WACS_MAP],
526 AC_CACHE_CHECK(for wide alternate character set array, cf_cv_curses_wacs_map,[
527 cf_cv_curses_wacs_map=unknown
528 for name in wacs_map _wacs_map __wacs_map _nc_wacs
531 #ifndef _XOPEN_SOURCE_EXTENDED
532 #define _XOPEN_SOURCE_EXTENDED
534 #include <${cf_cv_ncurses_header-curses.h}>],
535 [$name['k'] = *WACS_PLUS],
536 [cf_cv_curses_wacs_map=$name
540 dnl ---------------------------------------------------------------------------
541 dnl CF_DIRNAME version: 4 updated: 2002/12/21 19:25:52
543 dnl "dirname" is not portable, so we fake it with a shell script.
544 AC_DEFUN([CF_DIRNAME],[$1=`echo $2 | sed -e 's%/[[^/]]*$%%'`])dnl
545 dnl ---------------------------------------------------------------------------
546 dnl CF_DISABLE_ECHO version: 10 updated: 2003/04/17 22:27:11
548 dnl You can always use "make -n" to see the actual options, but it's hard to
549 dnl pick out/analyze warning messages when the compile-line is long.
552 dnl ECHO_LT - symbol to control if libtool is verbose
553 dnl ECHO_LD - symbol to prefix "cc -o" lines
554 dnl RULE_CC - symbol to put before implicit "cc -c" lines (e.g., .c.o)
555 dnl SHOW_CC - symbol to put before explicit "cc -c" lines
556 dnl ECHO_CC - symbol to put before any "cc" line
558 AC_DEFUN([CF_DISABLE_ECHO],[
559 AC_MSG_CHECKING(if you want to see long compiling messages)
561 [ --disable-echo display "compiling" commands],
564 ECHO_LD='@echo linking [$]@;'
565 RULE_CC=' @echo compiling [$]<'
566 SHOW_CC=' @echo compiling [$]@'
571 RULE_CC='# compiling'
572 SHOW_CC='# compiling'
575 AC_MSG_RESULT($enableval)
582 dnl ---------------------------------------------------------------------------
583 dnl CF_ENABLE_WARNINGS version: 3 updated: 2003/05/24 14:24:29
584 dnl ------------------
585 dnl Configure-option to enable gcc warnings
586 AC_DEFUN([CF_ENABLE_WARNINGS],[
587 if ( test "$GCC" = yes || test "$GXX" = yes )
589 AC_MSG_CHECKING(if you want to turn on gcc warnings)
590 CF_ARG_ENABLE(warnings,
591 [ --enable-warnings test: turn on gcc compiler warnings],
594 AC_MSG_RESULT($with_warnings)
595 if test "$with_warnings" = "yes"
601 dnl ---------------------------------------------------------------------------
602 dnl CF_FIND_LIBRARY version: 8 updated: 2004/11/23 20:14:58
604 dnl Look for a non-standard library, given parameters for AC_TRY_LINK. We
605 dnl prefer a standard location, and use -L options only if we do not find the
606 dnl library in the standard library location(s).
607 dnl $1 = library name
608 dnl $2 = library class, usually the same as library name
610 dnl $4 = code fragment to compile/link
611 dnl $5 = corresponding function-name
612 dnl $6 = flag, nonnull if failure should not cause an error-exit
614 dnl Sets the variable "$cf_libdir" as a side-effect, so we can see if we had
615 dnl to use a -L option.
616 AC_DEFUN([CF_FIND_LIBRARY],
618 eval 'cf_cv_have_lib_'$1'=no'
621 eval 'cf_cv_have_lib_'$1'=yes',[
623 AC_MSG_CHECKING(for $5 in -l$1)
625 AC_TRY_LINK([$3],[$4],
627 eval 'cf_cv_have_lib_'$1'=yes'
630 CF_LIBRARY_PATH(cf_search,$2)
631 for cf_libdir in $cf_search
633 AC_MSG_CHECKING(for -l$1 in $cf_libdir)
634 LIBS="-L$cf_libdir -l$1 $cf_save_LIBS"
635 AC_TRY_LINK([$3],[$4],
637 eval 'cf_cv_have_lib_'$1'=yes'
640 LIBS="$cf_save_LIBS"])
644 eval 'cf_found_library=[$]cf_cv_have_lib_'$1
646 if test $cf_found_library = no ; then
647 AC_ERROR(Cannot link $1 library)
651 dnl ---------------------------------------------------------------------------
652 dnl CF_FUNC_CURSES_VERSION version: 4 updated: 2007/04/28 09:15:55
653 dnl ----------------------
654 dnl Solaris has a data item 'curses_version', which confuses AC_CHECK_FUNCS.
655 dnl It's a character string "SVR4", not documented.
656 AC_DEFUN([CF_FUNC_CURSES_VERSION],
658 AC_CACHE_CHECK(for function curses_version, cf_cv_func_curses_version,[
660 #include <${cf_cv_ncurses_header-curses.h}>
664 sprintf(temp, "%s\n", curses_version());
665 ${cf_cv_main_return-return}(0);
667 ,[cf_cv_func_curses_version=yes]
668 ,[cf_cv_func_curses_version=no]
669 ,[cf_cv_func_curses_version=unknown])
671 test "$cf_cv_func_curses_version" = yes && AC_DEFINE(HAVE_CURSES_VERSION)
673 dnl ---------------------------------------------------------------------------
674 dnl CF_GCC_ATTRIBUTES version: 10 updated: 2005/05/28 13:16:28
675 dnl -----------------
676 dnl Test for availability of useful gcc __attribute__ directives to quiet
677 dnl compiler warnings. Though useful, not all are supported -- and contrary
678 dnl to documentation, unrecognized directives cause older compilers to barf.
679 AC_DEFUN([CF_GCC_ATTRIBUTES],
683 cat > conftest.i <<EOF
691 #define GCC_NORETURN /* nothing */
694 #define GCC_UNUSED /* nothing */
699 AC_CHECKING([for $CC __attribute__ directives])
700 cat > conftest.$ac_ext <<EOF
701 #line __oline__ "configure"
702 #include "confdefs.h"
703 #include "conftest.h"
704 #include "conftest.i"
706 #define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
708 #define GCC_PRINTFLIKE(fmt,var) /*nothing*/
711 #define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var)))
713 #define GCC_SCANFLIKE(fmt,var) /*nothing*/
715 extern void wow(char *,...) GCC_SCANFLIKE(1,2);
716 extern void oops(char *,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN;
717 extern void foo(void) GCC_NORETURN;
718 int main(int argc GCC_UNUSED, char *argv[[]] GCC_UNUSED) { return 0; }
720 for cf_attribute in scanf printf unused noreturn
722 CF_UPPER(cf_ATTRIBUTE,$cf_attribute)
723 cf_directive="__attribute__(($cf_attribute))"
724 echo "checking for $CC $cf_directive" 1>&AC_FD_CC
725 case $cf_attribute in
727 cat >conftest.h <<EOF
728 #define GCC_$cf_ATTRIBUTE 1
732 cat >conftest.h <<EOF
733 #define GCC_$cf_ATTRIBUTE $cf_directive
737 if AC_TRY_EVAL(ac_compile); then
738 test -n "$verbose" && AC_MSG_RESULT(... $cf_attribute)
739 cat conftest.h >>confdefs.h
743 fgrep define conftest.i >>confdefs.h
748 dnl ---------------------------------------------------------------------------
749 dnl CF_GCC_VERSION version: 4 updated: 2005/08/27 09:53:42
751 dnl Find version of gcc
752 AC_DEFUN([CF_GCC_VERSION],[
753 AC_REQUIRE([AC_PROG_CC])
755 if test "$GCC" = yes ; then
756 AC_MSG_CHECKING(version of $CC)
757 GCC_VERSION="`${CC} --version| sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`"
758 test -z "$GCC_VERSION" && GCC_VERSION=unknown
759 AC_MSG_RESULT($GCC_VERSION)
762 dnl ---------------------------------------------------------------------------
763 dnl CF_GCC_WARNINGS version: 20 updated: 2005/08/06 18:37:29
765 dnl Check if the compiler supports useful warning options. There's a few that
766 dnl we don't use, simply because they're too noisy:
768 dnl -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x)
769 dnl -Wredundant-decls (system headers make this too noisy)
770 dnl -Wtraditional (combines too many unrelated messages, only a few useful)
771 dnl -Wwrite-strings (too noisy, but should review occasionally). This
772 dnl is enabled for ncurses using "--enable-const".
776 dnl $1 is an optional list of gcc warning flags that a particular
777 dnl application might want to use, e.g., "no-unused" for
780 dnl If $with_ext_const is "yes", add a check for -Wwrite-strings
782 AC_DEFUN([CF_GCC_WARNINGS],
784 AC_REQUIRE([CF_GCC_VERSION])
785 CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS)
787 cat > conftest.$ac_ext <<EOF
788 #line __oline__ "configure"
789 int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; }
792 if test "$INTEL_COMPILER" = yes
794 # The "-wdXXX" options suppress warnings:
795 # remark #1419: external declaration in primary source file
796 # remark #1682: implicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
797 # remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
798 # remark #1684: conversion from pointer to same-sized integral type (potential portability problem)
799 # remark #193: zero used for undefined preprocessing identifier
800 # remark #593: variable "curs_sb_left_arrow" was set but never used
801 # remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits
802 # remark #869: parameter "tw" was never referenced
803 # remark #981: operands are evaluated in unspecified order
804 # warning #269: invalid format string conversion
806 AC_CHECKING([for $CC warning options])
807 cf_save_CFLAGS="$CFLAGS"
821 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
822 if AC_TRY_EVAL(ac_compile); then
823 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
824 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
827 CFLAGS="$cf_save_CFLAGS"
829 elif test "$GCC" = yes
831 AC_CHECKING([for $CC warning options])
832 cf_save_CFLAGS="$CFLAGS"
833 EXTRA_CFLAGS="-W -Wall"
835 test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings"
841 Wmissing-declarations \
842 Wmissing-prototypes \
847 Wundef $cf_warn_CONST $1
849 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
850 if AC_TRY_EVAL(ac_compile); then
851 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
854 CPPFLAGS="$CPPFLAGS -DXTSTRINGDEFINES"
859 CF_VERBOSE(feature is broken in gcc $GCC_VERSION)
864 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
867 CFLAGS="$cf_save_CFLAGS"
871 AC_SUBST(EXTRA_CFLAGS)
873 dnl ---------------------------------------------------------------------------
874 dnl CF_GNU_SOURCE version: 6 updated: 2005/07/09 13:23:07
876 dnl Check if we must define _GNU_SOURCE to get a reasonable value for
877 dnl _XOPEN_SOURCE, upon which many POSIX definitions depend. This is a defect
878 dnl (or misfeature) of glibc2, which breaks portability of many applications,
879 dnl since it is interwoven with GNU extensions.
881 dnl Well, yes we could work around it...
882 AC_DEFUN([CF_GNU_SOURCE],
884 AC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[
885 AC_TRY_COMPILE([#include <sys/types.h>],[
886 #ifndef _XOPEN_SOURCE
889 [cf_cv_gnu_source=no],
891 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
892 AC_TRY_COMPILE([#include <sys/types.h>],[
896 [cf_cv_gnu_source=no],
897 [cf_cv_gnu_source=yes])
901 test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
903 dnl ---------------------------------------------------------------------------
904 dnl CF_HEADER_PATH version: 8 updated: 2002/11/10 14:46:59
906 dnl Construct a search-list for a nonstandard header-file
907 AC_DEFUN([CF_HEADER_PATH],
908 [CF_SUBDIR_PATH($1,$2,include)
909 test "$includedir" != NONE && \
910 test "$includedir" != "/usr/include" && \
911 test -d "$includedir" && {
912 test -d $includedir && $1="[$]$1 $includedir"
913 test -d $includedir/$2 && $1="[$]$1 $includedir/$2"
916 test "$oldincludedir" != NONE && \
917 test "$oldincludedir" != "/usr/include" && \
918 test -d "$oldincludedir" && {
919 test -d $oldincludedir && $1="[$]$1 $oldincludedir"
920 test -d $oldincludedir/$2 && $1="[$]$1 $oldincludedir/$2"
924 dnl ---------------------------------------------------------------------------
925 dnl CF_INHERIT_SCRIPT version: 2 updated: 2003/03/01 23:50:42
926 dnl -----------------
927 dnl If we do not have a given script, look for it in the parent directory.
928 AC_DEFUN([CF_INHERIT_SCRIPT],
930 test -f $1 || ( test -f ../$1 && cp ../$1 ./ )
932 dnl ---------------------------------------------------------------------------
933 dnl CF_INTEL_COMPILER version: 3 updated: 2005/08/06 18:37:29
934 dnl -----------------
935 dnl Check if the given compiler is really the Intel compiler for Linux. It
936 dnl tries to imitate gcc, but does not return an error when it finds a mismatch
937 dnl between prototypes, e.g., as exercised by CF_MISSING_CHECK.
939 dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to
940 dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from
941 dnl the wrappers for gcc and g++ warnings.
943 dnl $1 = GCC (default) or GXX
944 dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS
945 dnl $3 = CFLAGS (default) or CXXFLAGS
946 AC_DEFUN([CF_INTEL_COMPILER],[
947 ifelse($2,,INTEL_COMPILER,[$2])=no
949 if test "$ifelse($1,,[$1],GCC)" = yes ; then
952 AC_MSG_CHECKING(if this is really Intel ifelse($1,GXX,C++,C) compiler)
953 cf_save_CFLAGS="$ifelse($3,,CFLAGS,[$3])"
954 ifelse($3,,CFLAGS,[$3])="$ifelse($3,,CFLAGS,[$3]) -no-gcc"
956 #ifdef __INTEL_COMPILER
960 ],[ifelse($2,,INTEL_COMPILER,[$2])=yes
961 cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc"
963 ifelse($3,,CFLAGS,[$3])="$cf_save_CFLAGS"
964 AC_MSG_RESULT($ifelse($2,,INTEL_COMPILER,[$2]))
969 dnl ---------------------------------------------------------------------------
970 dnl CF_LIBRARY_PATH version: 7 updated: 2002/11/10 14:46:59
972 dnl Construct a search-list for a nonstandard library-file
973 AC_DEFUN([CF_LIBRARY_PATH],
974 [CF_SUBDIR_PATH($1,$2,lib)])dnl
975 dnl ---------------------------------------------------------------------------
976 dnl CF_MSG_LOG version: 3 updated: 1997/09/07 14:05:52
978 dnl Write a debug message to config.log, along with the line number in the
979 dnl configure script.
980 AC_DEFUN([CF_MSG_LOG],[
981 echo "(line __oline__) testing $* ..." 1>&AC_FD_CC
983 dnl ---------------------------------------------------------------------------
984 dnl CF_NCURSES_CC_CHECK version: 3 updated: 2003/01/12 18:59:28
985 dnl -------------------
986 dnl Check if we can compile with ncurses' header file
987 dnl $1 is the cache variable to set
988 dnl $2 is the header-file to include
989 dnl $3 is the root name (ncurses or ncursesw)
990 AC_DEFUN([CF_NCURSES_CC_CHECK],[
992 ]ifelse($3,ncursesw,[
993 #define _XOPEN_SOURCE_EXTENDED
994 #undef HAVE_LIBUTF8_H /* in case we used CF_UTF8_LIB */
995 #define HAVE_LIBUTF8_H /* to force ncurses' header file to use cchar_t */
998 #ifdef NCURSES_VERSION
999 ]ifelse($3,ncursesw,[
1004 printf("%s\n", NCURSES_VERSION);
1016 dnl ---------------------------------------------------------------------------
1017 dnl CF_NCURSES_CPPFLAGS version: 18 updated: 2005/12/31 13:26:39
1018 dnl -------------------
1019 dnl Look for the SVr4 curses clone 'ncurses' in the standard places, adjusting
1020 dnl the CPPFLAGS variable so we can include its header.
1022 dnl The header files may be installed as either curses.h, or ncurses.h (would
1023 dnl be obsolete, except that some packagers prefer this name to distinguish it
1024 dnl from a "native" curses implementation). If not installed for overwrite,
1025 dnl the curses.h file would be in an ncurses subdirectory (e.g.,
1026 dnl /usr/include/ncurses), but someone may have installed overwriting the
1027 dnl vendor's curses. Only very old versions (pre-1.9.2d, the first autoconf'd
1028 dnl version) of ncurses don't define either __NCURSES_H or NCURSES_VERSION in
1031 dnl If the installer has set $CFLAGS or $CPPFLAGS so that the ncurses header
1032 dnl is already in the include-path, don't even bother with this, since we cannot
1033 dnl easily determine which file it is. In this case, it has to be <curses.h>.
1035 dnl The optional parameter gives the root name of the library, in case it is
1036 dnl not installed as the default curses library. That is how the
1037 dnl wide-character version of ncurses is installed.
1038 AC_DEFUN([CF_NCURSES_CPPFLAGS],
1039 [AC_REQUIRE([CF_WITH_CURSES_DIR])
1041 AC_PROVIDE([CF_CURSES_CPPFLAGS])dnl
1042 cf_ncuhdr_root=ifelse($1,,ncurses,$1)
1044 test -n "$cf_cv_curses_dir" && \
1045 test "$cf_cv_curses_dir" != "no" && \
1046 CPPFLAGS="-I$cf_cv_curses_dir/include -I$cf_cv_curses_dir/include/$cf_ncuhdr_root $CPPFLAGS"
1048 AC_CACHE_CHECK(for $cf_ncuhdr_root header in include-path, cf_cv_ncurses_h,[
1049 cf_header_list="$cf_ncuhdr_root/curses.h $cf_ncuhdr_root/ncurses.h"
1050 ( test "$cf_ncuhdr_root" = ncurses || test "$cf_ncuhdr_root" = ncursesw ) && cf_header_list="$cf_header_list curses.h ncurses.h"
1051 for cf_header in $cf_header_list
1053 CF_NCURSES_CC_CHECK(cf_cv_ncurses_h,$cf_header,$1)
1054 test "$cf_cv_ncurses_h" != no && break
1061 # some applications need this, but should check for NCURSES_VERSION
1066 dnl ---------------------------------------------------------------------------
1067 dnl CF_NCURSES_HEADER version: 1 updated: 2005/12/31 13:28:37
1068 dnl -----------------
1069 dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common
1070 dnl variations of ncurses' installs.
1072 dnl See also CF_CURSES_HEADER, which sets the same cache variable.
1073 AC_DEFUN([CF_NCURSES_HEADER],[
1075 if test "$cf_cv_ncurses_h" != no ; then
1076 cf_cv_ncurses_header=$cf_cv_ncurses_h
1079 AC_CACHE_CHECK(for $cf_ncuhdr_root include-path, cf_cv_ncurses_h2,[
1080 test -n "$verbose" && echo
1081 CF_HEADER_PATH(cf_search,$cf_ncuhdr_root)
1082 test -n "$verbose" && echo search path $cf_search
1083 cf_save2_CPPFLAGS="$CPPFLAGS"
1084 for cf_incdir in $cf_search
1086 CF_ADD_INCDIR($cf_incdir)
1091 CF_NCURSES_CC_CHECK(cf_cv_ncurses_h2,$cf_header,$1)
1092 if test "$cf_cv_ncurses_h2" != no ; then
1093 cf_cv_ncurses_h2=$cf_incdir/$cf_header
1094 test -n "$verbose" && echo $ac_n " ... found $ac_c" 1>&AC_FD_MSG
1097 test -n "$verbose" && echo " ... tested $cf_incdir/$cf_header" 1>&AC_FD_MSG
1099 CPPFLAGS="$cf_save2_CPPFLAGS"
1100 test "$cf_cv_ncurses_h2" != no && break
1102 test "$cf_cv_ncurses_h2" = no && AC_ERROR(not found)
1105 CF_DIRNAME(cf_1st_incdir,$cf_cv_ncurses_h2)
1106 cf_cv_ncurses_header=`basename $cf_cv_ncurses_h2`
1107 if test `basename $cf_1st_incdir` = $cf_ncuhdr_root ; then
1108 cf_cv_ncurses_header=$cf_ncuhdr_root/$cf_cv_ncurses_header
1110 CF_ADD_INCDIR($cf_1st_incdir)
1114 # Set definitions to allow ifdef'ing for ncurses.h
1116 case $cf_cv_ncurses_header in # (vi
1118 AC_DEFINE(HAVE_NCURSES_H)
1122 case $cf_cv_ncurses_header in # (vi
1123 ncurses/curses.h|ncurses/ncurses.h)
1124 AC_DEFINE(HAVE_NCURSES_NCURSES_H)
1126 ncursesw/curses.h|ncursesw/ncurses.h)
1127 AC_DEFINE(HAVE_NCURSESW_NCURSES_H)
1132 dnl ---------------------------------------------------------------------------
1133 dnl CF_NCURSES_LIBS version: 12 updated: 2004/04/27 16:26:05
1135 dnl Look for the ncurses library. This is a little complicated on Linux,
1136 dnl because it may be linked with the gpm (general purpose mouse) library.
1137 dnl Some distributions have gpm linked with (bsd) curses, which makes it
1138 dnl unusable with ncurses. However, we don't want to link with gpm unless
1139 dnl ncurses has a dependency, since gpm is normally set up as a shared library,
1140 dnl and the linker will record a dependency.
1142 dnl The optional parameter gives the root name of the library, in case it is
1143 dnl not installed as the default curses library. That is how the
1144 dnl wide-character version of ncurses is installed.
1145 AC_DEFUN([CF_NCURSES_LIBS],
1146 [AC_REQUIRE([CF_NCURSES_CPPFLAGS])
1148 cf_nculib_root=ifelse($1,,ncurses,$1)
1149 # This works, except for the special case where we find gpm, but
1150 # ncurses is in a nonstandard location via $LIBS, and we really want
1153 cf_ncurses_SAVE="$LIBS"
1154 AC_CHECK_LIB(gpm,Gpm_Open,
1155 [AC_CHECK_LIB(gpm,initscr,
1156 [LIBS="$cf_ncurses_SAVE"],
1157 [cf_ncurses_LIBS="-lgpm"])])
1159 case $host_os in #(vi
1161 # This is only necessary if you are linking against an obsolete
1162 # version of ncurses (but it should do no harm, since it's static).
1163 if test "$cf_nculib_root" = ncurses ; then
1164 AC_CHECK_LIB(mytinfo,tgoto,[cf_ncurses_LIBS="-lmytinfo $cf_ncurses_LIBS"])
1169 LIBS="$cf_ncurses_LIBS $LIBS"
1171 if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" )
1173 LIBS="-L$cf_cv_curses_dir/lib -l$cf_nculib_root $LIBS"
1175 CF_FIND_LIBRARY($cf_nculib_root,$cf_nculib_root,
1176 [#include <${cf_cv_ncurses_header-curses.h}>],
1181 if test -n "$cf_ncurses_LIBS" ; then
1182 AC_MSG_CHECKING(if we can link $cf_nculib_root without $cf_ncurses_LIBS)
1183 cf_ncurses_SAVE="$LIBS"
1184 for p in $cf_ncurses_LIBS ; do
1185 q=`echo $LIBS | sed -e "s%$p %%" -e "s%$p$%%"`
1186 if test "$q" != "$LIBS" ; then
1190 AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>],
1191 [initscr(); mousemask(0,0); tgoto((char *)0, 0, 0);],
1192 [AC_MSG_RESULT(yes)],
1194 LIBS="$cf_ncurses_SAVE"])
1197 CF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_nculib_root)
1198 AC_DEFINE_UNQUOTED($cf_nculib_ROOT)
1200 dnl ---------------------------------------------------------------------------
1201 dnl CF_NCURSES_VERSION version: 12 updated: 2007/04/28 09:15:55
1202 dnl ------------------
1203 dnl Check for the version of ncurses, to aid in reporting bugs, etc.
1204 dnl Call CF_CURSES_CPPFLAGS first, or CF_NCURSES_CPPFLAGS. We don't use
1205 dnl AC_REQUIRE since that does not work with the shell's if/then/else/fi.
1206 AC_DEFUN([CF_NCURSES_VERSION],
1208 AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
1209 AC_CACHE_CHECK(for ncurses version, cf_cv_ncurses_version,[
1210 cf_cv_ncurses_version=no
1214 #include <${cf_cv_ncurses_header-curses.h}>
1218 FILE *fp = fopen("$cf_tempfile", "w");
1219 #ifdef NCURSES_VERSION
1220 # ifdef NCURSES_VERSION_PATCH
1221 fprintf(fp, "%s.%d\n", NCURSES_VERSION, NCURSES_VERSION_PATCH);
1223 fprintf(fp, "%s\n", NCURSES_VERSION);
1227 fprintf(fp, "old\n");
1232 ${cf_cv_main_return-return}(0);
1234 cf_cv_ncurses_version=`cat $cf_tempfile`],,[
1236 # This will not work if the preprocessor splits the line after the
1237 # Autoconf token. The 'unproto' program does that.
1238 cat > conftest.$ac_ext <<EOF
1239 #include <${cf_cv_ncurses_header-curses.h}>
1241 #ifdef NCURSES_VERSION
1242 Autoconf NCURSES_VERSION
1250 cf_try="$ac_cpp conftest.$ac_ext 2>&AC_FD_CC | grep '^Autoconf ' >conftest.out"
1252 if test -f conftest.out ; then
1253 cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[[^"]]*"%%' -e 's%".*%%'`
1254 test -n "$cf_out" && cf_cv_ncurses_version="$cf_out"
1260 test "$cf_cv_ncurses_version" = no || AC_DEFINE(NCURSES)
1262 dnl ---------------------------------------------------------------------------
1263 dnl CF_PATH_SYNTAX version: 11 updated: 2006/09/02 08:55:46
1265 dnl Check the argument to see that it looks like a pathname. Rewrite it if it
1266 dnl begins with one of the prefix/exec_prefix variables, and then again if the
1267 dnl result begins with 'NONE'. This is necessary to work around autoconf's
1268 dnl delayed evaluation of those symbols.
1269 AC_DEFUN([CF_PATH_SYNTAX],[
1270 if test "x$prefix" != xNONE; then
1271 cf_path_syntax="$prefix"
1273 cf_path_syntax="$ac_default_prefix"
1276 case ".[$]$1" in #(vi
1277 .\[$]\(*\)*|.\'*\'*) #(vi
1281 .[[a-zA-Z]]:[[\\/]]*) #(vi OS/2 EMX
1283 .\[$]{*prefix}*) #(vi
1285 case ".[$]$1" in #(vi
1287 $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%`
1292 $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%`
1295 ifelse($2,,[AC_ERROR([expected a pathname, not \"[$]$1\"])],$2)
1299 dnl ---------------------------------------------------------------------------
1300 dnl CF_PDCURSES_X11 version: 7 updated: 2006/11/12 17:31:59
1302 dnl Configure for PDCurses' X11 library
1303 AC_DEFUN([CF_PDCURSES_X11],[
1304 AC_REQUIRE([CF_X_ATHENA])
1306 AC_PATH_PROGS(XCURSES_CONFIG,xcurses-config,none)
1308 if test "$XCURSES_CONFIG" != none ; then
1310 CPPFLAGS="`$XCURSES_CONFIG --cflags` $CPPFLAGS"
1311 LIBS="`$XCURSES_CONFIG --libs` $LIBS"
1313 cf_cv_lib_XCurses=yes
1317 LDFLAGS="$LDFLAGS $X_LIBS"
1318 CF_CHECK_CFLAGS($X_CFLAGS)
1319 AC_CHECK_LIB(X11,XOpenDisplay,
1320 [LIBS="-lX11 $LIBS"],,
1321 [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])
1322 AC_CACHE_CHECK(for XCurses library,cf_cv_lib_XCurses,[
1323 LIBS="-lXCurses $LIBS"
1325 #include <xcurses.h>
1326 char *XCursesProgramName = "test";
1328 [cf_cv_lib_XCurses=yes],
1329 [cf_cv_lib_XCurses=no])
1334 if test $cf_cv_lib_XCurses = yes ; then
1337 AC_DEFINE(HAVE_XCURSES)
1339 AC_ERROR(Cannot link with XCurses)
1342 dnl ---------------------------------------------------------------------------
1343 dnl CF_POSIX_C_SOURCE version: 6 updated: 2005/07/14 20:25:10
1344 dnl -----------------
1345 dnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed.
1347 dnl POSIX.1-1990 _POSIX_SOURCE
1348 dnl POSIX.1-1990 and _POSIX_SOURCE and
1349 dnl POSIX.2-1992 C-Language _POSIX_C_SOURCE=2
1351 dnl POSIX.1b-1993 _POSIX_C_SOURCE=199309L
1352 dnl POSIX.1c-1996 _POSIX_C_SOURCE=199506L
1353 dnl X/Open 2000 _POSIX_C_SOURCE=200112L
1356 dnl $1 is the nominal value for _POSIX_C_SOURCE
1357 AC_DEFUN([CF_POSIX_C_SOURCE],
1359 cf_POSIX_C_SOURCE=ifelse($1,,199506L,$1)
1361 cf_save_CFLAGS="$CFLAGS"
1362 cf_save_CPPFLAGS="$CPPFLAGS"
1364 CF_REMOVE_DEFINE(cf_trim_CFLAGS,$cf_save_CFLAGS,_POSIX_C_SOURCE)
1365 CF_REMOVE_DEFINE(cf_trim_CPPFLAGS,$cf_save_CPPFLAGS,_POSIX_C_SOURCE)
1367 AC_CACHE_CHECK(if we should define _POSIX_C_SOURCE,cf_cv_posix_c_source,[
1368 CF_MSG_LOG(if the symbol is already defined go no further)
1369 AC_TRY_COMPILE([#include <sys/types.h>],[
1370 #ifndef _POSIX_C_SOURCE
1373 [cf_cv_posix_c_source=no],
1374 [cf_want_posix_source=no
1375 case .$cf_POSIX_C_SOURCE in #(vi
1377 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
1380 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
1381 cf_want_posix_source=yes
1384 cf_want_posix_source=yes
1387 if test "$cf_want_posix_source" = yes ; then
1388 AC_TRY_COMPILE([#include <sys/types.h>],[
1389 #ifdef _POSIX_SOURCE
1392 cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE")
1394 CF_MSG_LOG(ifdef from value $cf_POSIX_C_SOURCE)
1395 CFLAGS="$cf_trim_CFLAGS"
1396 CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source"
1397 CF_MSG_LOG(if the second compile does not leave our definition intact error)
1398 AC_TRY_COMPILE([#include <sys/types.h>],[
1399 #ifndef _POSIX_C_SOURCE
1402 [cf_cv_posix_c_source=no])
1403 CFLAGS="$cf_save_CFLAGS"
1404 CPPFLAGS="$cf_save_CPPFLAGS"
1408 if test "$cf_cv_posix_c_source" != no ; then
1409 CFLAGS="$cf_trim_CFLAGS"
1410 CPPFLAGS="$cf_trim_CPPFLAGS"
1411 if test "$cf_cv_cc_u_d_options" = yes ; then
1412 cf_temp_posix_c_source=`echo "$cf_cv_posix_c_source" | \
1413 sed -e 's/-D/-U/g' -e 's/=[[^ ]]*//g'`
1414 CPPFLAGS="$CPPFLAGS $cf_temp_posix_c_source"
1416 CPPFLAGS="$CPPFLAGS $cf_cv_posix_c_source"
1420 dnl ---------------------------------------------------------------------------
1421 dnl CF_PRG_RULES version: 1 updated: 2006/06/03 11:45:08
1423 dnl Append definitions and rules for the given programs to the subdirectory
1424 dnl Makefiles, and the recursion rule for the top-level Makefile.
1427 dnl $1 = script to run
1428 dnl $2 = list of subdirectories
1432 AC_DEFUN([CF_PRG_RULES],
1436 if test ! -d $srcdir/$cf_dir; then
1438 elif test -f $srcdir/$cf_dir/programs; then
1439 $AWK -f $1 $srcdir/$cf_dir/programs >>$cf_dir/Makefile
1444 dnl ---------------------------------------------------------------------------
1445 dnl CF_PROG_CC_U_D version: 1 updated: 2005/07/14 16:59:30
1447 dnl Check if C (preprocessor) -U and -D options are processed in the order
1448 dnl given rather than by type of option. Some compilers insist on apply all
1449 dnl of the -U options after all of the -D options. Others allow mixing them,
1450 dnl and may predefine symbols that conflict with those we define.
1451 AC_DEFUN([CF_PROG_CC_U_D],
1453 AC_CACHE_CHECK(if $CC -U and -D options work together,cf_cv_cc_u_d_options,[
1454 cf_save_CPPFLAGS="$CPPFLAGS"
1455 CPPFLAGS="-UU_D_OPTIONS -DU_D_OPTIONS -DD_U_OPTIONS -UD_U_OPTIONS"
1458 make an undefined-error
1461 make a defined-error
1464 cf_cv_cc_u_d_options=yes],[
1465 cf_cv_cc_u_d_options=no])
1466 CPPFLAGS="$cf_save_CPPFLAGS"
1469 dnl ---------------------------------------------------------------------------
1470 dnl CF_REMOVE_DEFINE version: 2 updated: 2005/07/09 16:12:18
1471 dnl ----------------
1472 dnl Remove all -U and -D options that refer to the given symbol from a list
1473 dnl of C compiler options. This works around the problem that not all
1474 dnl compilers process -U and -D options from left-to-right, so a -U option
1475 dnl cannot be used to cancel the effect of a preceding -D option.
1477 dnl $1 = target (which could be the same as the source variable)
1478 dnl $2 = source (including '$')
1479 dnl $3 = symbol to remove
1480 define([CF_REMOVE_DEFINE],
1482 # remove $3 symbol from $2
1484 sed -e 's/-[[UD]]$3\(=[[^ ]]*\)\?[[ ]]/ /g' \
1485 -e 's/-[[UD]]$3\(=[[^ ]]*\)\?[$]//g'`
1487 dnl ---------------------------------------------------------------------------
1488 dnl CF_SIG_ATOMIC_T version: 2 updated: 2005/09/18 17:27:12
1490 dnl signal handler, but there are some gcc depedencies in that recommendation.
1492 AC_DEFUN([CF_SIG_ATOMIC_T],
1494 AC_MSG_CHECKING(for signal global datatype)
1495 AC_CACHE_VAL(cf_cv_sig_atomic_t,[
1497 "volatile sig_atomic_t" \
1502 #include <sys/types.h>
1508 static void handler(int sig)
1512 [signal(SIGINT, handler);
1514 [cf_cv_sig_atomic_t=$cf_type],
1515 [cf_cv_sig_atomic_t=no])
1516 test "$cf_cv_sig_atomic_t" != no && break
1519 AC_MSG_RESULT($cf_cv_sig_atomic_t)
1520 test "$cf_cv_sig_atomic_t" != no && AC_DEFINE_UNQUOTED(SIG_ATOMIC_T, $cf_cv_sig_atomic_t)
1522 dnl ---------------------------------------------------------------------------
1523 dnl CF_SUBDIR_PATH version: 4 updated: 2006/11/18 17:13:19
1525 dnl Construct a search-list for a nonstandard header/lib-file
1526 dnl $1 = the variable to return as result
1527 dnl $2 = the package name
1528 dnl $3 = the subdirectory, e.g., bin, include or lib
1529 AC_DEFUN([CF_SUBDIR_PATH],
1532 test -d "[$]HOME" && {
1533 test -n "$verbose" && echo " ... testing $3-directories under [$]HOME"
1534 test -d "[$]HOME/$3" && $1="[$]$1 [$]HOME/$3"
1535 test -d "[$]HOME/$3/$2" && $1="[$]$1 [$]HOME/$3/$2"
1536 test -d "[$]HOME/$3/$2/$3" && $1="[$]$1 [$]HOME/$3/$2/$3"
1539 # For other stuff under the home directory, it should be sufficient to put
1540 # a symbolic link for $HOME/$2 to the actual package location:
1541 test -d "[$]HOME/$2" && {
1542 test -n "$verbose" && echo " ... testing $3-directories under [$]HOME/$2"
1543 test -d "[$]HOME/$2/$3" && $1="[$]$1 [$]HOME/$2/$3"
1544 test -d "[$]HOME/$2/$3/$2" && $1="[$]$1 [$]HOME/$2/$3/$2"
1547 test "$prefix" != /usr/local && \
1548 test -d /usr/local && {
1549 test -n "$verbose" && echo " ... testing $3-directories under /usr/local"
1550 test -d /usr/local/$3 && $1="[$]$1 /usr/local/$3"
1551 test -d /usr/local/$3/$2 && $1="[$]$1 /usr/local/$3/$2"
1552 test -d /usr/local/$3/$2/$3 && $1="[$]$1 /usr/local/$3/$2/$3"
1553 test -d /usr/local/$2/$3 && $1="[$]$1 /usr/local/$2/$3"
1554 test -d /usr/local/$2/$3/$2 && $1="[$]$1 /usr/local/$2/$3/$2"
1557 test "$prefix" != NONE && \
1558 test -d $prefix && {
1559 test -n "$verbose" && echo " ... testing $3-directories under $prefix"
1560 test -d $prefix/$3 && $1="[$]$1 $prefix/$3"
1561 test -d $prefix/$3/$2 && $1="[$]$1 $prefix/$3/$2"
1562 test -d $prefix/$3/$2/$3 && $1="[$]$1 $prefix/$3/$2/$3"
1563 test -d $prefix/$2/$3 && $1="[$]$1 $prefix/$2/$3"
1564 test -d $prefix/$2/$3/$2 && $1="[$]$1 $prefix/$2/$3/$2"
1567 test "$prefix" != /opt && \
1569 test -n "$verbose" && echo " ... testing $3-directories under /opt"
1570 test -d /opt/$3 && $1="[$]$1 /opt/$3"
1571 test -d /opt/$3/$2 && $1="[$]$1 /opt/$3/$2"
1572 test -d /opt/$3/$2/$3 && $1="[$]$1 /opt/$3/$2/$3"
1573 test -d /opt/$2/$3 && $1="[$]$1 /opt/$2/$3"
1574 test -d /opt/$2/$3/$2 && $1="[$]$1 /opt/$2/$3/$2"
1577 test "$prefix" != /usr && \
1579 test -n "$verbose" && echo " ... testing $3-directories under /usr"
1580 test -d /usr/$3 && $1="[$]$1 /usr/$3"
1581 test -d /usr/$3/$2 && $1="[$]$1 /usr/$3/$2"
1582 test -d /usr/$3/$2/$3 && $1="[$]$1 /usr/$3/$2/$3"
1583 test -d /usr/$2/$3 && $1="[$]$1 /usr/$2/$3"
1586 dnl ---------------------------------------------------------------------------
1587 dnl CF_SYS_TIME_SELECT version: 4 updated: 2000/10/04 09:18:40
1588 dnl ------------------
1589 dnl Check if we can include <sys/time.h> with <sys/select.h>; this breaks on
1590 dnl older SCO configurations.
1591 AC_DEFUN([CF_SYS_TIME_SELECT],
1593 AC_MSG_CHECKING(if sys/time.h works with sys/select.h)
1594 AC_CACHE_VAL(cf_cv_sys_time_select,[
1596 #include <sys/types.h>
1597 #ifdef HAVE_SYS_TIME_H
1598 #include <sys/time.h>
1600 #ifdef HAVE_SYS_SELECT_H
1601 #include <sys/select.h>
1603 ],[],[cf_cv_sys_time_select=yes],
1604 [cf_cv_sys_time_select=no])
1606 AC_MSG_RESULT($cf_cv_sys_time_select)
1607 test "$cf_cv_sys_time_select" = yes && AC_DEFINE(HAVE_SYS_TIME_SELECT)
1609 dnl ---------------------------------------------------------------------------
1610 dnl CF_TERM_HEADER version: 1 updated: 2005/12/31 13:26:39
1612 dnl Look for term.h, which is part of X/Open curses. It defines the interface
1613 dnl to terminfo database. Usually it is in the same include-path as curses.h,
1614 dnl but some packagers change this, breaking various applications.
1615 AC_DEFUN([CF_TERM_HEADER],[
1616 AC_CACHE_CHECK(for terminfo header, cf_cv_term_header,[
1617 case ${cf_cv_ncurses_header} in #(vi
1618 */ncurses.h|*/ncursesw.h) #(vi
1619 cf_term_header=`echo "$cf_cv_ncurses_header" | sed -e 's%ncurses[[^.]]*\.h$%term.h%'`
1622 cf_term_header=term.h
1626 for cf_test in $cf_term_header "ncurses/term.h" "ncursesw/term.h"
1628 AC_TRY_COMPILE([#include <stdio.h>
1629 #include <${cf_cv_ncurses_header-curses.h}>
1631 ],[int x = auto_left_margin],[
1632 cf_cv_term_header="$cf_test"],[
1633 cf_cv_term_header=unknown
1635 test "$cf_cv_term_header" != unknown && break
1639 # Set definitions to allow ifdef'ing to accommodate subdirectories
1641 case $cf_cv_term_header in # (vi
1643 AC_DEFINE(HAVE_TERM_H)
1647 case $cf_cv_term_header in # (vi
1648 ncurses/term.h) #(vi
1649 AC_DEFINE(HAVE_NCURSES_TERM_H)
1652 AC_DEFINE(HAVE_NCURSESW_TERM_H)
1656 dnl ---------------------------------------------------------------------------
1657 dnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59
1659 dnl Make an uppercase version of a variable
1660 dnl $1=uppercase($2)
1661 AC_DEFUN([CF_UPPER],
1663 $1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
1665 dnl ---------------------------------------------------------------------------
1666 dnl CF_UTF8_LIB version: 4 updated: 2003/03/01 18:36:42
1668 dnl Check for multibyte support, and if not found, utf8 compatibility library
1669 AC_DEFUN([CF_UTF8_LIB],
1671 AC_CACHE_CHECK(for multibyte character support,cf_cv_utf8_lib,[
1672 cf_save_LIBS="$LIBS"
1674 #include <stdlib.h>],[putwc(0,0);],
1675 [cf_cv_utf8_lib=yes],
1676 [LIBS="-lutf8 $LIBS"
1678 #include <libutf8.h>],[putwc(0,0);],
1679 [cf_cv_utf8_lib=add-on],
1680 [cf_cv_utf8_lib=no])
1681 LIBS="$cf_save_LIBS"
1684 # HAVE_LIBUTF8_H is used by ncurses if curses.h is shared between
1686 if test "$cf_cv_utf8_lib" = "add-on" ; then
1687 AC_DEFINE(HAVE_LIBUTF8_H)
1691 dnl ---------------------------------------------------------------------------
1692 dnl CF_VERBOSE version: 2 updated: 1997/09/05 10:45:14
1694 dnl Use AC_VERBOSE w/o the warnings
1695 AC_DEFUN([CF_VERBOSE],
1696 [test -n "$verbose" && echo " $1" 1>&AC_FD_MSG
1698 dnl ---------------------------------------------------------------------------
1699 dnl CF_WITH_CURSES_DIR version: 2 updated: 2002/11/10 14:46:59
1700 dnl ------------------
1701 dnl Wrapper for AC_ARG_WITH to specify directory under which to look for curses
1703 AC_DEFUN([CF_WITH_CURSES_DIR],[
1704 AC_ARG_WITH(curses-dir,
1705 [ --with-curses-dir=DIR directory in which (n)curses is installed],
1706 [CF_PATH_SYNTAX(withval)
1707 cf_cv_curses_dir=$withval],
1708 [cf_cv_curses_dir=no])
1710 dnl ---------------------------------------------------------------------------
1711 dnl CF_XOPEN_SOURCE version: 25 updated: 2007/01/29 18:36:38
1713 dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions,
1714 dnl or adapt to the vendor's definitions to get equivalent functionality,
1715 dnl without losing the common non-POSIX features.
1718 dnl $1 is the nominal value for _XOPEN_SOURCE
1719 dnl $2 is the nominal value for _POSIX_C_SOURCE
1720 AC_DEFUN([CF_XOPEN_SOURCE],[
1722 AC_REQUIRE([CF_PROG_CC_U_D])
1724 cf_XOPEN_SOURCE=ifelse($1,,500,$1)
1725 cf_POSIX_C_SOURCE=ifelse($2,,199506L,$2)
1727 case $host_os in #(vi
1729 CPPFLAGS="$CPPFLAGS -D_ALL_SOURCE"
1732 # 5.x headers associate
1733 # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L
1734 # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L
1735 cf_POSIX_C_SOURCE=200112L
1737 CPPFLAGS="$CPPFLAGS -D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
1740 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE"
1743 CPPFLAGS="$CPPFLAGS -D_SGI_SOURCE"
1745 linux*|gnu*|k*bsd*-gnu) #(vi
1749 # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <arpa/inet.h>
1752 # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw
1755 # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw
1758 CPPFLAGS="$CPPFLAGS -D_OSF_SOURCE"
1761 CPPFLAGS="$CPPFLAGS -D_QNX_SOURCE"
1764 # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer
1767 CPPFLAGS="$CPPFLAGS -D__EXTENSIONS__"
1770 AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[
1771 AC_TRY_COMPILE([#include <sys/types.h>],[
1772 #ifndef _XOPEN_SOURCE
1775 [cf_cv_xopen_source=no],
1776 [cf_save="$CPPFLAGS"
1777 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
1778 AC_TRY_COMPILE([#include <sys/types.h>],[
1779 #ifdef _XOPEN_SOURCE
1782 [cf_cv_xopen_source=no],
1783 [cf_cv_xopen_source=$cf_XOPEN_SOURCE])
1787 if test "$cf_cv_xopen_source" != no ; then
1788 CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE)
1789 CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE)
1790 test "$cf_cv_cc_u_d_options" = yes && \
1791 CPPFLAGS="$CPPFLAGS -U_XOPEN_SOURCE"
1792 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_cv_xopen_source"
1794 CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE)
1798 dnl ---------------------------------------------------------------------------
1799 dnl CF_X_ATHENA version: 12 updated: 2004/06/15 21:14:41
1801 dnl Check for Xaw (Athena) libraries
1803 dnl Sets $cf_x_athena according to the flavor of Xaw which is used.
1804 AC_DEFUN([CF_X_ATHENA],
1805 [AC_REQUIRE([CF_X_TOOLKIT])
1806 cf_x_athena=${cf_x_athena-Xaw}
1808 AC_MSG_CHECKING(if you want to link with Xaw 3d library)
1811 [ --with-Xaw3d link with Xaw 3d library])
1812 if test "$withval" = yes ; then
1819 AC_MSG_CHECKING(if you want to link with neXT Athena library)
1822 [ --with-neXtaw link with neXT Athena library])
1823 if test "$withval" = yes ; then
1830 AC_MSG_CHECKING(if you want to link with Athena-Plus library)
1832 AC_ARG_WITH(XawPlus,
1833 [ --with-XawPlus link with Athena-Plus library])
1834 if test "$withval" = yes ; then
1841 AC_CHECK_LIB(Xext,XextCreateExtension,
1842 [LIBS="-lXext $LIBS"])
1846 CF_X_ATHENA_CPPFLAGS($cf_x_athena)
1847 CF_X_ATHENA_LIBS($cf_x_athena)
1849 dnl ---------------------------------------------------------------------------
1850 dnl CF_X_ATHENA_CPPFLAGS version: 2 updated: 2002/10/09 20:00:37
1851 dnl --------------------
1852 dnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of
1853 dnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw.
1854 AC_DEFUN([CF_X_ATHENA_CPPFLAGS],
1856 cf_x_athena_root=ifelse($1,,Xaw,$1)
1857 cf_x_athena_include=""
1859 for cf_path in default \
1860 /usr/contrib/X11R6 \
1861 /usr/contrib/X11R5 \
1865 if test -z "$cf_x_athena_include" ; then
1867 cf_test=X11/$cf_x_athena_root/SimpleMenu.h
1868 if test $cf_path != default ; then
1869 CPPFLAGS="-I$cf_path/include $cf_save"
1870 AC_MSG_CHECKING(for $cf_test in $cf_path)
1872 AC_MSG_CHECKING(for $cf_test)
1875 #include <X11/Intrinsic.h>
1876 #include <$cf_test>],[],
1879 AC_MSG_RESULT($cf_result)
1880 if test "$cf_result" = yes ; then
1881 cf_x_athena_include=$cf_path
1889 if test -z "$cf_x_athena_include" ; then
1891 [Unable to successfully find Athena header files with test program])
1892 elif test "$cf_x_athena_include" != default ; then
1893 CPPFLAGS="$CPPFLAGS -I$cf_x_athena_include"
1896 dnl ---------------------------------------------------------------------------
1897 dnl CF_X_ATHENA_LIBS version: 6 updated: 2006/11/30 17:57:11
1898 dnl ----------------
1899 dnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of
1900 dnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw.
1901 AC_DEFUN([CF_X_ATHENA_LIBS],
1902 [AC_REQUIRE([CF_X_TOOLKIT])
1903 cf_x_athena_root=ifelse($1,,Xaw,$1)
1906 for cf_path in default \
1907 /usr/contrib/X11R6 \
1908 /usr/contrib/X11R5 \
1913 "-l$cf_x_athena_root -lXmu" \
1914 "-l$cf_x_athena_root -lXpm -lXmu" \
1915 "-l${cf_x_athena_root}_s -lXmu_s"
1917 if test -z "$cf_x_athena_lib" ; then
1919 cf_test=XawSimpleMenuAddGlobalActions
1920 if test $cf_path != default ; then
1921 LIBS="-L$cf_path/lib $cf_lib $LIBS"
1922 AC_MSG_CHECKING(for $cf_lib in $cf_path)
1924 LIBS="$cf_lib $LIBS"
1925 AC_MSG_CHECKING(for $cf_test in $cf_lib)
1927 AC_TRY_LINK([],[$cf_test()],
1930 AC_MSG_RESULT($cf_result)
1931 if test "$cf_result" = yes ; then
1932 cf_x_athena_lib="$cf_lib"
1940 if test -z "$cf_x_athena_lib" ; then
1942 [Unable to successfully link Athena library (-l$cf_x_athena_root) with test program])
1945 CF_UPPER(cf_x_athena_LIBS,HAVE_LIB_$cf_x_athena)
1946 AC_DEFINE_UNQUOTED($cf_x_athena_LIBS)
1948 dnl ---------------------------------------------------------------------------
1949 dnl CF_X_TOOLKIT version: 11 updated: 2006/11/29 19:05:14
1951 dnl Check for X Toolkit libraries
1953 AC_DEFUN([CF_X_TOOLKIT],
1955 AC_REQUIRE([AC_PATH_XTRA])
1956 AC_REQUIRE([CF_CHECK_CACHE])
1958 # SYSTEM_NAME=`echo "$cf_cv_system_name"|tr ' ' -`
1962 LDFLAGS="$X_LIBS $LDFLAGS"
1963 CF_CHECK_CFLAGS($X_CFLAGS)
1965 AC_CHECK_FUNC(XOpenDisplay,,[
1966 AC_CHECK_LIB(X11,XOpenDisplay,
1967 [LIBS="-lX11 $LIBS"],,
1968 [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])])
1970 AC_CHECK_FUNC(XtAppInitialize,,[
1971 AC_CHECK_LIB(Xt, XtAppInitialize,
1972 [AC_DEFINE(HAVE_LIBXT)
1974 LIBS="-lXt $X_PRE_LIBS $LIBS $X_EXTRA_LIBS"],,
1975 [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])])
1977 if test $cf_have_X_LIBS = no ; then
1979 [Unable to successfully link X Toolkit library (-lXt) with
1980 test program. You will have to check and add the proper libraries by hand