1 dnl***************************************************************************
2 dnl Copyright (c) 1998-2006,2007 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 Author: Thomas E. Dickey 1995-on
31 dnl $Id: aclocal.m4,v 1.420 2007/02/17 21:50:10 tom Exp $
32 dnl Macros used in NCURSES auto-configuration script.
34 dnl These macros are maintained separately from NCURSES. The copyright on
35 dnl this file applies to the aggregation of macros and does not affect use of
36 dnl these macros in other applications.
38 dnl See http://invisible-island.net/autoconf/ for additional information.
40 dnl ---------------------------------------------------------------------------
41 dnl ---------------------------------------------------------------------------
42 dnl AM_LANGINFO_CODESET version: 3 updated: 2002/10/27 23:21:42
43 dnl -------------------
44 dnl Inserted as requested by gettext 0.10.40
45 dnl File from /usr/share/aclocal
47 dnl ====================
50 dnl From Bruno Haible.
51 AC_DEFUN([AM_LANGINFO_CODESET],
53 AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
54 [AC_TRY_LINK([#include <langinfo.h>],
55 [char* cs = nl_langinfo(CODESET);],
56 am_cv_langinfo_codeset=yes,
57 am_cv_langinfo_codeset=no)
59 if test $am_cv_langinfo_codeset = yes; then
60 AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
61 [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
64 dnl ---------------------------------------------------------------------------
65 dnl CF_ADA_INCLUDE_DIRS version: 5 updated: 2006/10/14 15:23:15
66 dnl -------------------
67 dnl Construct the list of include-options for the C programs in the Ada95
69 AC_DEFUN([CF_ADA_INCLUDE_DIRS],
71 ACPPFLAGS="-I. -I../../include $ACPPFLAGS"
72 if test "$srcdir" != "."; then
73 ACPPFLAGS="-I\${srcdir}/../../include $ACPPFLAGS"
75 if test "$GCC" != yes; then
76 ACPPFLAGS="$ACPPFLAGS -I\${includedir}"
77 elif test "$includedir" != "/usr/include"; then
78 if test "$includedir" = '${prefix}/include' ; then
79 if test $prefix != /usr ; then
80 ACPPFLAGS="$ACPPFLAGS -I\${includedir}"
83 ACPPFLAGS="$ACPPFLAGS -I\${includedir}"
88 dnl ---------------------------------------------------------------------------
89 dnl CF_ADD_CFLAGS version: 7 updated: 2004/04/25 17:48:30
91 dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS
92 dnl The second parameter if given makes this macro verbose.
94 dnl Put any preprocessor definitions that use quoted strings in $EXTRA_CPPFLAGS,
95 dnl to simplify use of $CPPFLAGS in compiler checks, etc., that are easily
96 dnl confused by the quotes (which require backslashes to keep them usable).
97 AC_DEFUN([CF_ADD_CFLAGS],
102 cf_new_extra_cppflags=
104 for cf_add_cflags in $1
106 case $cf_fix_cppflags in
108 case $cf_add_cflags in #(vi
109 -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi
110 case $cf_add_cflags in
112 cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[[^=]]*='\''\"[[^"]]*//'`
114 test "${cf_add_cflags}" != "${cf_tst_cflags}" \
115 && test -z "${cf_tst_cflags}" \
116 && cf_fix_cppflags=yes
118 if test $cf_fix_cppflags = yes ; then
119 cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
121 elif test "${cf_tst_cflags}" = "\"'" ; then
122 cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
128 *$cf_add_cflags) #(vi
131 cf_new_cppflags="$cf_new_cppflags $cf_add_cflags"
136 cf_new_cflags="$cf_new_cflags $cf_add_cflags"
141 cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
143 cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[[^"]]*"'\''//'`
145 test "${cf_add_cflags}" != "${cf_tst_cflags}" \
146 && test -z "${cf_tst_cflags}" \
147 && cf_fix_cppflags=no
152 if test -n "$cf_new_cflags" ; then
153 ifelse($2,,,[CF_VERBOSE(add to \$CFLAGS $cf_new_cflags)])
154 CFLAGS="$CFLAGS $cf_new_cflags"
157 if test -n "$cf_new_cppflags" ; then
158 ifelse($2,,,[CF_VERBOSE(add to \$CPPFLAGS $cf_new_cppflags)])
159 CPPFLAGS="$cf_new_cppflags $CPPFLAGS"
162 if test -n "$cf_new_extra_cppflags" ; then
163 ifelse($2,,,[CF_VERBOSE(add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags)])
164 EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
167 AC_SUBST(EXTRA_CPPFLAGS)
170 dnl ---------------------------------------------------------------------------
171 dnl CF_ANSI_CC_CHECK version: 9 updated: 2001/12/30 17:53:34
173 dnl This is adapted from the macros 'fp_PROG_CC_STDC' and 'fp_C_PROTOTYPES'
174 dnl in the sharutils 4.2 distribution.
175 AC_DEFUN([CF_ANSI_CC_CHECK],
177 AC_CACHE_CHECK(for ${CC-cc} option to accept ANSI C, cf_cv_ansi_cc,[
179 cf_save_CFLAGS="$CFLAGS"
180 cf_save_CPPFLAGS="$CPPFLAGS"
181 # Don't try gcc -ansi; that turns off useful extensions and
182 # breaks some systems' header files.
184 # Ultrix and OSF/1 -std1
185 # HP-UX -Aa -D_HPUX_SOURCE
187 # UnixWare 1.2 (cannot use -Xc, since ANSI/POSIX clashes)
188 for cf_arg in "-DCC_HAS_PROTOS" \
193 "-Aa -D_HPUX_SOURCE" \
196 CF_ADD_CFLAGS($cf_arg)
199 #ifndef CC_HAS_PROTOS
200 #if !defined(__STDC__) || (__STDC__ != 1)
205 int test (int i, double x);
206 struct s1 {int (*f) (int a);};
207 struct s2 {int (*f) (double a);};],
208 [cf_cv_ansi_cc="$cf_arg"; break])
210 CFLAGS="$cf_save_CFLAGS"
211 CPPFLAGS="$cf_save_CPPFLAGS"
214 if test "$cf_cv_ansi_cc" != "no"; then
215 if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then
216 CF_ADD_CFLAGS($cf_cv_ansi_cc)
218 AC_DEFINE(CC_HAS_PROTOS)
222 dnl ---------------------------------------------------------------------------
223 dnl CF_ANSI_CC_REQD version: 3 updated: 1997/09/06 13:40:44
225 dnl For programs that must use an ANSI compiler, obtain compiler options that
226 dnl will make it recognize prototypes. We'll do preprocessor checks in other
227 dnl macros, since tools such as unproto can fake prototypes, but only part of
228 dnl the preprocessor.
229 AC_DEFUN([CF_ANSI_CC_REQD],
230 [AC_REQUIRE([CF_ANSI_CC_CHECK])
231 if test "$cf_cv_ansi_cc" = "no"; then
233 [Your compiler does not appear to recognize prototypes.
234 You have the following choices:
235 a. adjust your compiler options
236 b. get an up-to-date compiler
237 c. use a wrapper such as unproto])
240 dnl ---------------------------------------------------------------------------
241 dnl CF_BOOL_DECL version: 8 updated: 2004/01/30 15:51:18
243 dnl Test if 'bool' is a builtin type in the configured C++ compiler. Some
244 dnl older compilers (e.g., gcc 2.5.8) don't support 'bool' directly; gcc
245 dnl 2.6.3 does, in anticipation of the ANSI C++ standard.
247 dnl Treat the configuration-variable specially here, since we're directly
248 dnl substituting its value (i.e., 1/0).
250 dnl $1 is the shell variable to store the result in, if not $cv_cv_builtin_bool
251 AC_DEFUN([CF_BOOL_DECL],
253 AC_MSG_CHECKING(if we should include stdbool.h)
255 AC_CACHE_VAL(cf_cv_header_stdbool_h,[
256 AC_TRY_COMPILE([],[bool foo = false],
257 [cf_cv_header_stdbool_h=0],
262 ],[bool foo = false],
263 [cf_cv_header_stdbool_h=1],
264 [cf_cv_header_stdbool_h=0])])])
266 if test "$cf_cv_header_stdbool_h" = 1
267 then AC_MSG_RESULT(yes)
268 else AC_MSG_RESULT(no)
271 AC_MSG_CHECKING([for builtin bool type])
273 AC_CACHE_VAL(ifelse($1,,cf_cv_builtin_bool,[$1]),[
276 #include <sys/types.h>
278 [ifelse($1,,cf_cv_builtin_bool,[$1])=1],
279 [ifelse($1,,cf_cv_builtin_bool,[$1])=0])
282 if test "$ifelse($1,,cf_cv_builtin_bool,[$1])" = 1
283 then AC_MSG_RESULT(yes)
284 else AC_MSG_RESULT(no)
287 dnl ---------------------------------------------------------------------------
288 dnl CF_BOOL_SIZE version: 12 updated: 2006/12/16 12:33:30
290 dnl Test for the size of 'bool' in the configured C++ compiler (e.g., a type).
291 dnl Don't bother looking for bool.h, since it's been deprecated.
293 dnl If the current compiler is C rather than C++, we get the bool definition
294 dnl from <stdbool.h>.
295 AC_DEFUN([CF_BOOL_SIZE],
297 AC_MSG_CHECKING([for size of bool])
298 AC_CACHE_VAL(cf_cv_type_of_bool,[
304 #if defined(__cplusplus)
306 #ifdef HAVE_GXX_BUILTIN_H
307 #include <g++/builtin.h>
308 #elif HAVE_GPP_BUILTIN_H
309 #include <gpp/builtin.h>
316 #if $cf_cv_header_stdbool_h
324 FILE *fp = fopen("cf_test.out", "w");
328 fputs("unsigned ", fp);
329 if (sizeof(x) == sizeof(int)) fputs("int", fp);
330 else if (sizeof(x) == sizeof(char)) fputs("char", fp);
331 else if (sizeof(x) == sizeof(short))fputs("short",fp);
332 else if (sizeof(x) == sizeof(long)) fputs("long", fp);
335 ${cf_cv_main_return:-return}(0);
338 [cf_cv_type_of_bool=`cat cf_test.out`
339 if test -z "$cf_cv_type_of_bool"; then
340 cf_cv_type_of_bool=unknown
342 [cf_cv_type_of_bool=unknown],
343 [cf_cv_type_of_bool=unknown])
346 AC_MSG_RESULT($cf_cv_type_of_bool)
347 if test "$cf_cv_type_of_bool" = unknown ; then
348 case .$NCURSES_BOOL in #(vi
349 .auto|.) NCURSES_BOOL=unsigned;;
351 AC_MSG_WARN(Assuming $NCURSES_BOOL for type of bool)
352 cf_cv_type_of_bool=$NCURSES_BOOL
355 dnl ---------------------------------------------------------------------------
356 dnl CF_BUILD_CC version: 6 updated: 2006/10/14 15:23:15
358 dnl If we're cross-compiling, allow the user to override the tools and their
359 dnl options. The configure script is oriented toward identifying the host
360 dnl compiler, etc., but we need a build compiler to generate parts of the
363 dnl $1 = default for $CPPFLAGS
364 dnl $2 = default for $LIBS
365 AC_DEFUN([CF_BUILD_CC],[
366 AC_REQUIRE([CF_PROG_EXT])
367 if test "$cross_compiling" = yes ; then
369 # defaults that we might want to override
370 : ${BUILD_CFLAGS:=''}
371 : ${BUILD_CPPFLAGS:='ifelse([$1],,,[$1])'}
372 : ${BUILD_LDFLAGS:=''}
373 : ${BUILD_LIBS:='ifelse([$2],,,[$2])'}
374 : ${BUILD_EXEEXT:='$x'}
375 : ${BUILD_OBJEXT:='o'}
377 AC_ARG_WITH(build-cc,
378 [ --with-build-cc=XXX the build C compiler ($BUILD_CC)],
379 [BUILD_CC="$withval"],
380 [AC_CHECK_PROGS(BUILD_CC, gcc cc cl)])
381 AC_MSG_CHECKING(for native build C compiler)
382 AC_MSG_RESULT($BUILD_CC)
384 AC_MSG_CHECKING(for native build C preprocessor)
385 AC_ARG_WITH(build-cpp,
386 [ --with-build-cpp=XXX the build C preprocessor ($BUILD_CPP)],
387 [BUILD_CPP="$withval"],
388 [BUILD_CPP='${BUILD_CC} -E'])
389 AC_MSG_RESULT($BUILD_CPP)
391 AC_MSG_CHECKING(for native build C flags)
392 AC_ARG_WITH(build-cflags,
393 [ --with-build-cflags=XXX the build C compiler-flags ($BUILD_CFLAGS)],
394 [BUILD_CFLAGS="$withval"])
395 AC_MSG_RESULT($BUILD_CFLAGS)
397 AC_MSG_CHECKING(for native build C preprocessor-flags)
398 AC_ARG_WITH(build-cppflags,
399 [ --with-build-cppflags=XXX the build C preprocessor-flags ($BUILD_CPPFLAGS)],
400 [BUILD_CPPFLAGS="$withval"])
401 AC_MSG_RESULT($BUILD_CPPFLAGS)
403 AC_MSG_CHECKING(for native build linker-flags)
404 AC_ARG_WITH(build-ldflags,
405 [ --with-build-ldflags=XXX the build linker-flags ($BUILD_LDFLAGS)],
406 [BUILD_LDFLAGS="$withval"])
407 AC_MSG_RESULT($BUILD_LDFLAGS)
409 AC_MSG_CHECKING(for native build linker-libraries)
410 AC_ARG_WITH(build-libs,
411 [ --with-build-libs=XXX the build libraries (${BUILD_LIBS})],
412 [BUILD_LIBS="$withval"])
413 AC_MSG_RESULT($BUILD_LIBS)
415 # this assumes we're on Unix.
419 : ${BUILD_CC:='${CC}'}
421 if ( test "$BUILD_CC" = "$CC" || test "$BUILD_CC" = '${CC}' ) ; then
422 AC_MSG_ERROR([Cross-build requires two compilers.
423 Use --with-build-cc to specify the native compiler.])
427 : ${BUILD_CC:='${CC}'}
428 : ${BUILD_CPP:='${CPP}'}
429 : ${BUILD_CFLAGS:='${CFLAGS}'}
430 : ${BUILD_CPPFLAGS:='${CPPFLAGS}'}
431 : ${BUILD_LDFLAGS:='${LDFLAGS}'}
432 : ${BUILD_LIBS:='${LIBS}'}
433 : ${BUILD_EXEEXT:='$x'}
434 : ${BUILD_OBJEXT:='o'}
439 AC_SUBST(BUILD_CFLAGS)
440 AC_SUBST(BUILD_CPPFLAGS)
441 AC_SUBST(BUILD_LDFLAGS)
443 AC_SUBST(BUILD_EXEEXT)
444 AC_SUBST(BUILD_OBJEXT)
446 dnl ---------------------------------------------------------------------------
447 dnl CF_CFG_DEFAULTS version: 7 updated: 2005/09/24 16:15:00
449 dnl Determine the default configuration into which we'll install ncurses. This
450 dnl can be overridden by the user's command-line options. There's two items to
452 dnl 1. the prefix (e.g., /usr)
453 dnl 2. the header files (e.g., /usr/include/ncurses)
454 dnl We'll look for a previous installation of ncurses and use the same defaults.
456 dnl We don't use AC_PREFIX_DEFAULT, because it gets evaluated too soon, and
457 dnl we don't use AC_PREFIX_PROGRAM, because we cannot distinguish ncurses's
458 dnl programs from a vendor's.
459 AC_DEFUN([CF_CFG_DEFAULTS],
461 AC_MSG_CHECKING(for prefix)
462 if test "x$prefix" = "xNONE" ; then
463 case "$cf_cv_system_name" in
464 # non-vendor systems don't have a conflict
465 openbsd*|freebsd*|linux*|cygwin*|k*bsd*-gnu)
468 *) prefix=$ac_default_prefix
472 AC_MSG_RESULT($prefix)
474 if test "x$prefix" = "xNONE" ; then
475 AC_MSG_CHECKING(for default include-directory)
476 test -n "$verbose" && echo 1>&AC_FD_MSG
479 $includedir/ncurses \
481 $prefix/include/ncurses \
483 /usr/local/include/ncurses \
487 cf_dir=`eval echo $cf_symbol`
488 if test -f $cf_dir/curses.h ; then
489 if ( fgrep NCURSES_VERSION $cf_dir/curses.h 2>&1 >/dev/null ) ; then
490 includedir="$cf_symbol"
491 test -n "$verbose" && echo $ac_n " found " 1>&AC_FD_MSG
495 test -n "$verbose" && echo " tested $cf_dir" 1>&AC_FD_MSG
497 AC_MSG_RESULT($includedir)
500 dnl ---------------------------------------------------------------------------
501 dnl CF_CGETENT version: 3 updated: 2000/08/12 23:18:52
503 dnl Check if the terminal-capability database functions are available. If not,
504 dnl ncurses has a much-reduced version.
505 AC_DEFUN([CF_CGETENT],[
506 AC_MSG_CHECKING(for terminal-capability database functions)
507 AC_CACHE_VAL(cf_cv_cgetent,[
509 #include <stdlib.h>],[
512 char *db_array = temp;
513 cgetent(&buf, /* int *, */ &db_array, "vt100");
514 cgetcap(buf, "tc", '=');
515 cgetmatch(buf, "tc");
520 AC_MSG_RESULT($cf_cv_cgetent)
521 test "$cf_cv_cgetent" = yes && AC_DEFINE(HAVE_BSD_CGETENT)
523 dnl ---------------------------------------------------------------------------
524 dnl CF_CHECK_CACHE version: 10 updated: 2004/05/23 13:03:31
526 dnl Check if we're accidentally using a cache from a different machine.
527 dnl Derive the system name, as a check for reusing the autoconf cache.
529 dnl If we've packaged config.guess and config.sub, run that (since it does a
530 dnl better job than uname). Normally we'll use AC_CANONICAL_HOST, but allow
531 dnl an extra parameter that we may override, e.g., for AC_CANONICAL_SYSTEM
532 dnl which is useful in cross-compiles.
534 dnl Note: we would use $ac_config_sub, but that is one of the places where
535 dnl autoconf 2.5x broke compatibility with autoconf 2.13
536 AC_DEFUN([CF_CHECK_CACHE],
538 if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then
539 ifelse([$1],,[AC_CANONICAL_HOST],[$1])
540 system_name="$host_os"
542 system_name="`(uname -s -r) 2>/dev/null`"
543 if test -z "$system_name" ; then
544 system_name="`(hostname) 2>/dev/null`"
547 test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name")
548 AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"])
550 test -z "$system_name" && system_name="$cf_cv_system_name"
551 test -n "$cf_cv_system_name" && AC_MSG_RESULT(Configuring for $cf_cv_system_name)
553 if test ".$system_name" != ".$cf_cv_system_name" ; then
554 AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name))
555 AC_ERROR("Please remove config.cache and try again.")
558 dnl ---------------------------------------------------------------------------
559 dnl CF_CHECK_ERRNO version: 9 updated: 2001/12/30 18:03:23
561 dnl Check for data that is usually declared in <stdio.h> or <errno.h>, e.g.,
562 dnl the 'errno' variable. Define a DECL_xxx symbol if we must declare it
565 dnl $1 = the name to check
566 AC_DEFUN([CF_CHECK_ERRNO],
568 AC_CACHE_CHECK(if external $1 is declared, cf_cv_dcl_$1,[
574 #include <sys/types.h>
575 #include <errno.h> ],
576 [long x = (long) $1],
581 if test "$cf_cv_dcl_$1" = no ; then
582 CF_UPPER(cf_result,decl_$1)
583 AC_DEFINE_UNQUOTED($cf_result)
586 # It's possible (for near-UNIX clones) that the data doesn't exist
587 CF_CHECK_EXTERN_DATA($1,int)
589 dnl ---------------------------------------------------------------------------
590 dnl CF_CHECK_EXTERN_DATA version: 3 updated: 2001/12/30 18:03:23
591 dnl --------------------
592 dnl Check for existence of external data in the current set of libraries. If
593 dnl we can modify it, it's real enough.
594 dnl $1 = the name to check
596 AC_DEFUN([CF_CHECK_EXTERN_DATA],
598 AC_CACHE_CHECK(if external $1 exists, cf_cv_have_$1,[
608 if test "$cf_cv_have_$1" = yes ; then
609 CF_UPPER(cf_result,have_$1)
610 AC_DEFINE_UNQUOTED($cf_result)
614 dnl ---------------------------------------------------------------------------
615 dnl CF_CPP_PARAM_INIT version: 4 updated: 2001/04/07 22:31:18
616 dnl -----------------
617 dnl Check if the C++ compiler accepts duplicate parameter initialization. This
618 dnl is a late feature for the standard and is not in some recent compilers
620 AC_DEFUN([CF_CPP_PARAM_INIT],
622 if test -n "$CXX"; then
623 AC_CACHE_CHECK(if $CXX accepts parameter initialization,cf_cv_cpp_param_init,[
635 TEST::TEST(int x = 1) // some compilers do not like second initializer
641 [cf_cv_cpp_param_init=yes],
642 [cf_cv_cpp_param_init=no],
643 [cf_cv_cpp_param_init=unknown])
647 test "$cf_cv_cpp_param_init" = yes && AC_DEFINE(CPP_HAS_PARAM_INIT)
649 dnl ---------------------------------------------------------------------------
650 dnl CF_CPP_STATIC_CAST version: 1 updated: 2005/07/23 16:52:43
651 dnl ------------------
652 dnl Check if the C++ compiler accepts static_cast in generics. This appears to
653 dnl not be supported in g++ before 3.0
654 AC_DEFUN([CF_CPP_STATIC_CAST],
656 if test -n "$CXX"; then
658 AC_CACHE_CHECK(if $CXX accepts static_cast,cf_cv_cpp_static_cast,[
666 NCursesPanel(int nlines,
676 template<class T> class NCursesUserPanel : public NCursesPanel
679 NCursesUserPanel (int nlines,
683 const T* p_UserData = static_cast<T*>(0))
684 : NCursesPanel (nlines, ncols, begin_y, begin_x)
687 NCursesUserPanel(const T* p_UserData = static_cast<T*>(0)) : NCursesPanel()
691 virtual ~NCursesUserPanel() {};
694 const char* p_UserData = static_cast<char*>(0)],
695 [cf_cv_cpp_static_cast=yes],
696 [cf_cv_cpp_static_cast=no])
703 test "$cf_cv_cpp_static_cast" = yes && AC_DEFINE(CPP_HAS_STATIC_CAST)
705 dnl ---------------------------------------------------------------------------
706 dnl CF_DIRNAME version: 4 updated: 2002/12/21 19:25:52
708 dnl "dirname" is not portable, so we fake it with a shell script.
709 AC_DEFUN([CF_DIRNAME],[$1=`echo $2 | sed -e 's%/[[^/]]*$%%'`])dnl
710 dnl ---------------------------------------------------------------------------
711 dnl CF_DIRS_TO_MAKE version: 3 updated: 2002/02/23 20:38:31
713 AC_DEFUN([CF_DIRS_TO_MAKE],
716 for cf_item in $cf_list_models
718 CF_OBJ_SUBDIR($cf_item,cf_subdir)
719 for cf_item2 in $DIRS_TO_MAKE
721 test $cf_item2 = $cf_subdir && break
723 test ".$cf_item2" != ".$cf_subdir" && DIRS_TO_MAKE="$DIRS_TO_MAKE $cf_subdir"
725 for cf_dir in $DIRS_TO_MAKE
727 test ! -d $cf_dir && mkdir $cf_dir
729 AC_SUBST(DIRS_TO_MAKE)
731 dnl ---------------------------------------------------------------------------
732 dnl CF_DISABLE_LEAKS version: 4 updated: 2006/12/16 15:10:42
734 dnl Combine no-leak checks with the libraries or tools that are used for the
736 AC_DEFUN([CF_DISABLE_LEAKS],[
738 AC_REQUIRE([CF_WITH_DMALLOC])
739 AC_REQUIRE([CF_WITH_DBMALLOC])
740 AC_REQUIRE([CF_WITH_VALGRIND])
742 AC_MSG_CHECKING(if you want to perform memory-leak testing)
744 [ --disable-leaks test: free permanent memory, analyze leaks],
746 : ${with_no_leaks:=no})
747 AC_MSG_RESULT($with_no_leaks)
749 if test "$with_no_leaks" = yes ; then
753 dnl ---------------------------------------------------------------------------
754 dnl CF_ERRNO version: 5 updated: 1997/11/30 12:44:39
756 dnl Check if 'errno' is declared in <errno.h>
759 CF_CHECK_ERRNO(errno)
761 dnl ---------------------------------------------------------------------------
762 dnl CF_ETIP_DEFINES version: 3 updated: 2003/03/22 19:13:43
764 dnl Test for conflicting definitions of exception in gcc 2.8.0, etc., between
765 dnl math.h and builtin.h, only for ncurses
766 AC_DEFUN([CF_ETIP_DEFINES],
768 AC_MSG_CHECKING(for special defines needed for etip.h)
769 cf_save_CXXFLAGS="$CXXFLAGS"
771 for cf_math in "" MATH_H
773 for cf_excp in "" MATH_EXCEPTION
775 CXXFLAGS="$cf_save_CXXFLAGS -I${srcdir}/c++ -I${srcdir}/menu -I${srcdir}/include"
776 test -n "$cf_math" && CXXFLAGS="$CXXFLAGS -DETIP_NEEDS_${cf_math}"
777 test -n "$cf_excp" && CXXFLAGS="$CXXFLAGS -DETIP_NEEDS_${cf_excp}"
781 test -n "$cf_math" && AC_DEFINE_UNQUOTED(ETIP_NEEDS_${cf_math})
782 test -n "$cf_excp" && AC_DEFINE_UNQUOTED(ETIP_NEEDS_${cf_excp})
783 cf_result="$cf_math $cf_excp"
788 AC_MSG_RESULT($cf_result)
789 CXXFLAGS="$cf_save_CXXFLAGS"
791 dnl ---------------------------------------------------------------------------
792 dnl CF_FUNC_DLSYM version: 1 updated: 2004/06/16 20:52:45
794 dnl Test for dlsym() and related functions, as well as libdl.
799 AC_DEFUN([CF_FUNC_DLSYM],[
801 AC_CHECK_FUNC(dlsym,cf_have_dlsym=yes,[
804 AC_CHECK_LIB(dl,dlsym,[
806 cf_have_libdl=yes])])
808 if test "$cf_have_dlsym" = yes ; then
809 test "$cf_have_libdl" = yes && LIBS="-ldl $LIBS"
811 AC_MSG_CHECKING(whether able to link to dl*() functions)
812 AC_TRY_LINK([#include <dlfcn.h>],[
814 if ((obj = dlopen("filename", 0)) != 0) {
815 if (dlsym(obj, "symbolname") == 0) {
819 AC_DEFINE(HAVE_LIBDL)],[
820 AC_MSG_ERROR(Cannot link test program for libdl)])
823 AC_MSG_ERROR(Cannot find dlsym function)
826 dnl ---------------------------------------------------------------------------
827 dnl CF_FUNC_MEMMOVE version: 7 updated: 2006/12/16 12:33:30
829 dnl Check for memmove, or a bcopy that can handle overlapping copy. If neither
830 dnl is found, add our own version of memmove to the list of objects.
831 AC_DEFUN([CF_FUNC_MEMMOVE],
833 AC_CHECK_FUNC(memmove,,[
834 AC_CHECK_FUNC(bcopy,[
835 AC_CACHE_CHECK(if bcopy does overlapping moves,cf_cv_good_bcopy,[
838 static char data[] = "abcdefghijklmnopqrstuwwxyz";
840 bcopy(data, temp, sizeof(data));
841 bcopy(temp+10, temp, 15);
842 bcopy(temp+5, temp+15, 10);
843 ${cf_cv_main_return:-return} (strcmp(temp, "klmnopqrstuwwxypqrstuwwxyz"));
846 [cf_cv_good_bcopy=yes],
847 [cf_cv_good_bcopy=no],
848 [cf_cv_good_bcopy=unknown])
850 ],[cf_cv_good_bcopy=no])
851 if test "$cf_cv_good_bcopy" = yes ; then
852 AC_DEFINE(USE_OK_BCOPY)
854 AC_DEFINE(USE_MY_MEMMOVE)
857 dnl ---------------------------------------------------------------------------
858 dnl CF_FUNC_NANOSLEEP version: 3 updated: 2006/12/16 12:33:30
859 dnl -----------------
860 dnl Check for existence of workable nanosleep() function. Some systems, e.g.,
861 dnl AIX 4.x, provide a non-working version.
862 AC_DEFUN([CF_FUNC_NANOSLEEP],[
863 AC_CACHE_CHECK(if nanosleep really works,cf_cv_func_nanosleep,[
869 #ifdef HAVE_SYS_TIME_H
870 #include <sys/time.h>
874 struct timespec ts1, ts2;
877 ts1.tv_nsec = 750000000;
881 code = nanosleep(&ts1, &ts2); /* on failure errno is ENOSYS. */
882 ${cf_cv_main_return:-return}(code != 0);
885 [cf_cv_func_nanosleep=yes],
886 [cf_cv_func_nanosleep=no],
887 [cf_cv_func_nanosleep=unknown])])
889 test "$cf_cv_func_nanosleep" = "yes" && AC_DEFINE(HAVE_NANOSLEEP)
891 dnl ---------------------------------------------------------------------------
892 dnl CF_FUNC_POLL version: 4 updated: 2006/12/16 12:33:30
894 dnl See if the poll function really works. Some platforms have poll(), but
895 dnl it does not work for terminals or files.
896 AC_DEFUN([CF_FUNC_POLL],[
897 AC_CACHE_CHECK(if poll really works,cf_cv_working_poll,[
903 #include <sys/poll.h>
910 myfds.events = POLLIN;
912 ret = poll(&myfds, 1, 100);
913 ${cf_cv_main_return:-return}(ret != 0);
915 [cf_cv_working_poll=yes],
916 [cf_cv_working_poll=no],
917 [cf_cv_working_poll=unknown])])
918 test "$cf_cv_working_poll" = "yes" && AC_DEFINE(HAVE_WORKING_POLL)
920 dnl ---------------------------------------------------------------------------
921 dnl CF_FUNC_TERMIOS version: 2 updated: 2000/07/22 23:37:24
923 dnl Some old/broken variations define tcgetattr() only as a macro in
925 AC_DEFUN([CF_FUNC_TERMIOS],[
926 AC_REQUIRE([CF_STRUCT_TERMIOS])
927 AC_CACHE_CHECK(for tcgetattr, cf_cv_have_tcgetattr,[
929 #include <sys/types.h>
933 #ifdef HAVE_TERMIOS_H
935 #define TTY struct termios
939 #define TTY struct termio
944 tcgetattr(1, &foo);],
945 [cf_cv_have_tcgetattr=yes],
946 [cf_cv_have_tcgetattr=no])])
947 test "$cf_cv_have_tcgetattr" = yes && AC_DEFINE(HAVE_TCGETATTR)
949 dnl ---------------------------------------------------------------------------
950 dnl CF_FUNC_VSSCANF version: 3 updated: 2001/12/19 00:50:10
952 dnl Check for vsscanf() function, which is in c9x but generally not in earlier
953 dnl versions of C. It is in the GNU C library, and can often be simulated by
955 AC_DEFUN([CF_FUNC_VSSCANF],
957 AC_CACHE_CHECK(for vsscanf function or workaround,cf_cv_func_vsscanf,[
960 #include <stdio.h>],[
962 vsscanf("from", "%d", ap)],[cf_cv_func_vsscanf=vsscanf],[
965 #include <stdio.h>],[
969 strbuf._flag = _IOREAD;
970 strbuf._ptr = strbuf._base = (unsigned char *) str;
971 strbuf._cnt = strlen(str);
972 strbuf._file = _NFILE;
973 return (vfscanf(&strbuf, "%d", ap))],[cf_cv_func_vsscanf=vfscanf],[
976 #include <stdio.h>],[
980 strbuf._flag = _IOREAD;
981 strbuf._ptr = strbuf._base = (unsigned char *) str;
982 strbuf._cnt = strlen(str);
983 strbuf._file = _NFILE;
984 return (_doscan(&strbuf, "%d", ap))],[cf_cv_func_vsscanf=_doscan],[
985 cf_cv_func_vsscanf=no])])])])
987 case $cf_cv_func_vsscanf in #(vi
988 vsscanf) AC_DEFINE(HAVE_VSSCANF);; #(vi
989 vfscanf) AC_DEFINE(HAVE_VFSCANF);; #(vi
990 _doscan) AC_DEFINE(HAVE__DOSCAN);;
994 dnl ---------------------------------------------------------------------------
995 dnl CF_GCC_ATTRIBUTES version: 10 updated: 2005/05/28 13:16:28
996 dnl -----------------
997 dnl Test for availability of useful gcc __attribute__ directives to quiet
998 dnl compiler warnings. Though useful, not all are supported -- and contrary
999 dnl to documentation, unrecognized directives cause older compilers to barf.
1000 AC_DEFUN([CF_GCC_ATTRIBUTES],
1002 if test "$GCC" = yes
1004 cat > conftest.i <<EOF
1006 #define GCC_PRINTF 0
1011 #ifndef GCC_NORETURN
1012 #define GCC_NORETURN /* nothing */
1015 #define GCC_UNUSED /* nothing */
1018 if test "$GCC" = yes
1020 AC_CHECKING([for $CC __attribute__ directives])
1021 cat > conftest.$ac_ext <<EOF
1022 #line __oline__ "configure"
1023 #include "confdefs.h"
1024 #include "conftest.h"
1025 #include "conftest.i"
1027 #define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
1029 #define GCC_PRINTFLIKE(fmt,var) /*nothing*/
1032 #define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var)))
1034 #define GCC_SCANFLIKE(fmt,var) /*nothing*/
1036 extern void wow(char *,...) GCC_SCANFLIKE(1,2);
1037 extern void oops(char *,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN;
1038 extern void foo(void) GCC_NORETURN;
1039 int main(int argc GCC_UNUSED, char *argv[[]] GCC_UNUSED) { return 0; }
1041 for cf_attribute in scanf printf unused noreturn
1043 CF_UPPER(cf_ATTRIBUTE,$cf_attribute)
1044 cf_directive="__attribute__(($cf_attribute))"
1045 echo "checking for $CC $cf_directive" 1>&AC_FD_CC
1046 case $cf_attribute in
1048 cat >conftest.h <<EOF
1049 #define GCC_$cf_ATTRIBUTE 1
1053 cat >conftest.h <<EOF
1054 #define GCC_$cf_ATTRIBUTE $cf_directive
1058 if AC_TRY_EVAL(ac_compile); then
1059 test -n "$verbose" && AC_MSG_RESULT(... $cf_attribute)
1060 cat conftest.h >>confdefs.h
1064 fgrep define conftest.i >>confdefs.h
1069 dnl ---------------------------------------------------------------------------
1070 dnl CF_GCC_VERSION version: 4 updated: 2005/08/27 09:53:42
1072 dnl Find version of gcc
1073 AC_DEFUN([CF_GCC_VERSION],[
1074 AC_REQUIRE([AC_PROG_CC])
1076 if test "$GCC" = yes ; then
1077 AC_MSG_CHECKING(version of $CC)
1078 GCC_VERSION="`${CC} --version| sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`"
1079 test -z "$GCC_VERSION" && GCC_VERSION=unknown
1080 AC_MSG_RESULT($GCC_VERSION)
1083 dnl ---------------------------------------------------------------------------
1084 dnl CF_GCC_WARNINGS version: 20 updated: 2005/08/06 18:37:29
1086 dnl Check if the compiler supports useful warning options. There's a few that
1087 dnl we don't use, simply because they're too noisy:
1089 dnl -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x)
1090 dnl -Wredundant-decls (system headers make this too noisy)
1091 dnl -Wtraditional (combines too many unrelated messages, only a few useful)
1092 dnl -Wwrite-strings (too noisy, but should review occasionally). This
1093 dnl is enabled for ncurses using "--enable-const".
1097 dnl $1 is an optional list of gcc warning flags that a particular
1098 dnl application might want to use, e.g., "no-unused" for
1101 dnl If $with_ext_const is "yes", add a check for -Wwrite-strings
1103 AC_DEFUN([CF_GCC_WARNINGS],
1105 AC_REQUIRE([CF_GCC_VERSION])
1106 CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS)
1108 cat > conftest.$ac_ext <<EOF
1109 #line __oline__ "configure"
1110 int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; }
1113 if test "$INTEL_COMPILER" = yes
1115 # The "-wdXXX" options suppress warnings:
1116 # remark #1419: external declaration in primary source file
1117 # remark #1682: implicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
1118 # remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
1119 # remark #1684: conversion from pointer to same-sized integral type (potential portability problem)
1120 # remark #193: zero used for undefined preprocessing identifier
1121 # remark #593: variable "curs_sb_left_arrow" was set but never used
1122 # remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits
1123 # remark #869: parameter "tw" was never referenced
1124 # remark #981: operands are evaluated in unspecified order
1125 # warning #269: invalid format string conversion
1127 AC_CHECKING([for $CC warning options])
1128 cf_save_CFLAGS="$CFLAGS"
1129 EXTRA_CFLAGS="-Wall"
1142 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
1143 if AC_TRY_EVAL(ac_compile); then
1144 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
1145 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
1148 CFLAGS="$cf_save_CFLAGS"
1150 elif test "$GCC" = yes
1152 AC_CHECKING([for $CC warning options])
1153 cf_save_CFLAGS="$CFLAGS"
1154 EXTRA_CFLAGS="-W -Wall"
1156 test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings"
1158 Wbad-function-cast \
1162 Wmissing-declarations \
1163 Wmissing-prototypes \
1167 Wstrict-prototypes \
1168 Wundef $cf_warn_CONST $1
1170 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
1171 if AC_TRY_EVAL(ac_compile); then
1172 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
1173 case $cf_opt in #(vi
1175 CPPFLAGS="$CPPFLAGS -DXTSTRINGDEFINES"
1178 case $GCC_VERSION in
1180 CF_VERBOSE(feature is broken in gcc $GCC_VERSION)
1185 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
1188 CFLAGS="$cf_save_CFLAGS"
1192 AC_SUBST(EXTRA_CFLAGS)
1194 dnl ---------------------------------------------------------------------------
1195 dnl CF_GNAT_TRY_LINK version: 1 updated: 2004/08/21 19:02:08
1196 dnl ----------------
1197 dnl Verify that a test program compiles/links with GNAT.
1198 dnl $cf_ada_make is set to the program that compiles/links
1199 dnl $ADAFLAGS may be set to the GNAT flags.
1201 dnl $1 is the text of the spec
1202 dnl $2 is the text of the body
1203 dnl $3 is the shell command to execute if successful
1204 dnl $4 is the shell command to execute if not successful
1205 AC_DEFUN([CF_GNAT_TRY_LINK],
1208 cat >>conftest.ads <<CF_EOF
1211 cat >>conftest.adb <<CF_EOF
1214 if ( $cf_ada_make $ADAFLAGS conftest 1>&AC_FD_CC 2>&1 ) ; then
1215 ifelse($3,, :,[ $3])
1221 dnl ---------------------------------------------------------------------------
1222 dnl CF_GNAT_TRY_RUN version: 3 updated: 2004/08/21 19:02:08
1224 dnl Verify that a test program compiles and runs with GNAT
1225 dnl $cf_ada_make is set to the program that compiles/links
1226 dnl $ADAFLAGS may be set to the GNAT flags.
1228 dnl $1 is the text of the spec
1229 dnl $2 is the text of the body
1230 dnl $3 is the shell command to execute if successful
1231 dnl $4 is the shell command to execute if not successful
1232 AC_DEFUN([CF_GNAT_TRY_RUN],
1235 cat >>conftest.ads <<CF_EOF
1238 cat >>conftest.adb <<CF_EOF
1241 if ( $cf_ada_make $ADAFLAGS conftest 1>&AC_FD_CC 2>&1 ) ; then
1242 if ( ./conftest 1>&AC_FD_CC 2>&1 ) ; then
1243 ifelse($3,, :,[ $3])
1252 dnl ---------------------------------------------------------------------------
1253 dnl CF_GNAT_VERSION version: 12 updated: 2006/10/14 15:23:15
1255 dnl Verify version of GNAT.
1256 AC_DEFUN([CF_GNAT_VERSION],
1258 AC_MSG_CHECKING(for gnat version)
1259 cf_gnat_version=`${cf_ada_make-gnatmake} -v 2>&1 | grep '[[0-9]].[[0-9]][[0-9]]*' |\
1260 sed -e '2,$d' -e 's/[[^0-9 \.]]//g' -e 's/^[[ ]]*//' -e 's/ .*//'`
1261 AC_MSG_RESULT($cf_gnat_version)
1263 case $cf_gnat_version in
1264 3.1[[1-9]]*|3.[[2-9]]*|[[4-9]].*)
1265 cf_cv_prog_gnat_correct=yes
1267 *) echo Unsupported GNAT version $cf_gnat_version. Required is 3.11 or better. Disabling Ada95 binding.
1268 cf_cv_prog_gnat_correct=no
1271 case $cf_gnat_version in
1272 3.[[1-9]]*|[[4-9]].*)
1273 cf_compile_generics=generics
1274 cf_generic_objects="\${GENOBJS}"
1276 *) cf_compile_generics=
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_GPP_LIBRARY version: 8 updated: 2003/02/02 01:41:46
1314 dnl If we're trying to use g++, test if libg++ is installed (a rather common
1315 dnl problem :-). If we have the compiler but no library, we'll be able to
1316 dnl configure, but won't be able to build the c++ demo program.
1317 AC_DEFUN([CF_GPP_LIBRARY],
1319 cf_cxx_library=unknown
1320 case $cf_cv_system_name in #(vi
1328 if test "$GXX" = yes; then
1329 AC_MSG_CHECKING([for lib$cf_gpp_libname])
1331 LIBS="$LIBS -l$cf_gpp_libname"
1333 #include <$cf_gpp_libname/builtin.h>
1335 [two_arg_error_handler_t foo2 = lib_error_handler],
1337 CXXLIBS="$CXXLIBS -l$cf_gpp_libname"
1338 if test "$cf_gpp_libname" = cpp ; then
1339 AC_DEFINE(HAVE_GPP_BUILTIN_H)
1341 AC_DEFINE(HAVE_GXX_BUILTIN_H)
1344 #include <builtin.h>
1346 [two_arg_error_handler_t foo2 = lib_error_handler],
1348 CXXLIBS="$CXXLIBS -l$cf_gpp_libname"
1349 AC_DEFINE(HAVE_BUILTIN_H)],
1350 [cf_cxx_library=no])])
1352 AC_MSG_RESULT($cf_cxx_library)
1355 dnl ---------------------------------------------------------------------------
1356 dnl CF_GXX_VERSION version: 5 updated: 2005/08/27 09:53:42
1358 dnl Check for version of g++
1359 AC_DEFUN([CF_GXX_VERSION],[
1360 AC_REQUIRE([AC_PROG_CPP])
1362 if test "$GXX" = yes; then
1363 AC_MSG_CHECKING(version of g++)
1364 GXX_VERSION="`${CXX-g++} --version| sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`"
1365 test -z "$GXX_VERSION" && GXX_VERSION=unknown
1366 AC_MSG_RESULT($GXX_VERSION)
1369 dnl ---------------------------------------------------------------------------
1370 dnl CF_GXX_WARNINGS version: 5 updated: 2005/08/13 14:54:38
1372 dnl Check if the compiler supports useful warning options.
1374 dnl Most of gcc's options apply to g++, except:
1375 dnl -Wbad-function-cast
1376 dnl -Wmissing-declarations
1377 dnl -Wnested-externs
1379 dnl Omit a few (for now):
1383 dnl $1 is an optional list of g++ warning flags that a particular
1384 dnl application might want to use, e.g., "no-unused" for
1387 dnl If $with_ext_const is "yes", add a check for -Wwrite-strings
1389 AC_DEFUN([CF_GXX_WARNINGS],
1392 CF_INTEL_COMPILER(GXX,INTEL_CPLUSPLUS,CXXFLAGS)
1394 AC_REQUIRE([CF_GXX_VERSION])
1399 cat > conftest.$ac_ext <<EOF
1400 #line __oline__ "configure"
1401 int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; }
1404 if test "$INTEL_CPLUSPLUS" = yes
1406 # The "-wdXXX" options suppress warnings:
1407 # remark #1419: external declaration in primary source file
1408 # remark #1682: implicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
1409 # remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
1410 # remark #1684: conversion from pointer to same-sized integral type (potential portability problem)
1411 # remark #193: zero used for undefined preprocessing identifier
1412 # remark #593: variable "curs_sb_left_arrow" was set but never used
1413 # remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits
1414 # remark #869: parameter "tw" was never referenced
1415 # remark #981: operands are evaluated in unspecified order
1416 # warning #269: invalid format string conversion
1418 AC_CHECKING([for $CC warning options])
1419 cf_save_CXXFLAGS="$CXXFLAGS"
1420 EXTRA_CXXFLAGS="-Wall"
1433 CXXFLAGS="$cf_save_CXXFLAGS $EXTRA_CXXFLAGS -$cf_opt"
1434 if AC_TRY_EVAL(ac_compile); then
1435 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
1436 EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS -$cf_opt"
1439 CXXFLAGS="$cf_save_CXXFLAGS"
1441 elif test "$GXX" = yes
1443 AC_CHECKING([for $CXX warning options])
1444 cf_save_CXXFLAGS="$CXXFLAGS"
1445 EXTRA_CXXFLAGS="-W -Wall"
1446 cf_gxx_extra_warnings=""
1447 test "$with_ext_const" = yes && cf_gxx_extra_warnings="Wwrite-strings"
1448 case "$GCC_VERSION" in
1452 cf_gxx_extra_warnings="$cf_gxx_extra_warnings Weffc++"
1458 Woverloaded-virtual \
1464 Wmissing-prototypes \
1467 Wstrict-prototypes \
1468 Wundef $cf_gxx_extra_warnings $1
1470 CXXFLAGS="$cf_save_CXXFLAGS $EXTRA_CXXFLAGS -Werror -$cf_opt"
1471 if AC_TRY_EVAL(ac_compile); then
1472 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
1473 EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS -$cf_opt"
1475 test -n "$verbose" && AC_MSG_RESULT(... no -$cf_opt)
1478 CXXFLAGS="$cf_save_CXXFLAGS"
1483 AC_SUBST(EXTRA_CXXFLAGS)
1485 dnl ---------------------------------------------------------------------------
1486 dnl CF_HASHED_DB version: 1 updated: 2006/08/19 09:16:14
1488 dnl Look for an instance of the Berkeley hashed database.
1489 AC_DEFUN([CF_HASHED_DB],
1491 AC_CHECK_HEADER(db.h,[
1492 CF_HASHED_DB_VERSION
1493 if test "$cf_cv_hashed_db_version" = unknown ; then
1494 AC_MSG_ERROR(Cannot determine version of db)
1497 if test "$cf_cv_hashed_db_libs" = unknown ; then
1498 AC_MSG_ERROR(Cannot determine library for db)
1499 elif test "$cf_cv_hashed_db_libs" != default ; then
1500 LIBS="-l$cf_cv_hashed_db_libs $LIBS"
1504 AC_MSG_ERROR(Cannot find db.h)
1507 dnl ---------------------------------------------------------------------------
1508 dnl CF_HASHED_DB_LIBS version: 6 updated: 2006/12/16 12:33:30
1509 dnl -----------------
1510 dnl Given that we have the header and version for hashed database, find the
1511 dnl library information.
1512 AC_DEFUN([CF_HASHED_DB_LIBS],
1514 AC_CACHE_CHECK(for db libraries, cf_cv_hashed_db_libs,[
1515 cf_cv_hashed_db_libs=unknown
1516 for cf_db_libs in db$cf_cv_hashed_db_version db ''
1518 cf_save_libs="$LIBS"
1519 if test -n "$cf_db_libs"; then
1520 LIBS="-l$cf_db_libs $LIBS"
1522 CF_MSG_LOG(checking for library "$cf_db_libs")
1524 $ac_includes_default
1527 char *path = "/tmp/foo";
1528 #ifdef DB_VERSION_MAJOR
1529 #if DB_VERSION_MAJOR >= 4
1531 db_create(&result, NULL, 0);
1532 result->open(result,
1539 #elif DB_VERSION_MAJOR >= 3
1541 db_create(&result, NULL, 0);
1542 result->open(result,
1548 #elif DB_VERSION_MAJOR >= 2
1557 #endif /* DB_VERSION_MAJOR */
1559 DB *result = dbopen(path,
1565 ${cf_cv_main_return:-return}(result != 0)
1567 if test -n "$cf_db_libs" ; then
1568 cf_cv_hashed_db_libs=$cf_db_libs
1570 cf_cv_hashed_db_libs=default
1572 LIBS="$cf_save_libs"
1575 LIBS="$cf_save_libs"
1579 dnl ---------------------------------------------------------------------------
1580 dnl CF_HASHED_DB_VERSION version: 2 updated: 2006/08/19 15:12:49
1581 dnl --------------------
1582 dnl Given that we have the header file for hashed database, find the version
1584 AC_DEFUN([CF_HASHED_DB_VERSION],
1586 AC_CACHE_CHECK(for version of db, cf_cv_hashed_db_version,[
1587 cf_cv_hashed_db_version=unknown
1589 for cf_db_version in 1 2 3 4
1591 CF_MSG_LOG(checking for db version $cf_db_version)
1593 $ac_includes_default
1596 #ifdef DB_VERSION_MAJOR
1597 /* db2 (DB_VERSION_MAJOR=2) has also DB_VERSION_MINOR, tested with 7 */
1598 #if $cf_db_version == DB_VERSION_MAJOR
1604 #if $cf_db_version == 1
1605 /* ok: assuming this is DB 1.8.5 */
1611 cf_cv_hashed_db_version=$cf_db_version
1617 dnl ---------------------------------------------------------------------------
1618 dnl CF_HELP_MESSAGE version: 3 updated: 1998/01/14 10:56:23
1620 dnl Insert text into the help-message, for readability, from AC_ARG_WITH.
1621 AC_DEFUN([CF_HELP_MESSAGE],
1622 [AC_DIVERT_HELP([$1])dnl
1624 dnl ---------------------------------------------------------------------------
1625 dnl CF_INCLUDE_DIRS version: 5 updated: 2006/10/14 15:23:15
1627 dnl Construct the list of include-options according to whether we're building
1628 dnl in the source directory or using '--srcdir=DIR' option. If we're building
1629 dnl with gcc, don't append the includedir if it happens to be /usr/include,
1630 dnl since that usually breaks gcc's shadow-includes.
1631 AC_DEFUN([CF_INCLUDE_DIRS],
1633 CPPFLAGS="-I. -I../include $CPPFLAGS"
1634 if test "$srcdir" != "."; then
1635 CPPFLAGS="-I\${srcdir}/../include $CPPFLAGS"
1637 if test "$GCC" != yes; then
1638 CPPFLAGS="$CPPFLAGS -I\${includedir}"
1639 elif test "$includedir" != "/usr/include"; then
1640 if test "$includedir" = '${prefix}/include' ; then
1641 if test $prefix != /usr ; then
1642 CPPFLAGS="$CPPFLAGS -I\${includedir}"
1645 CPPFLAGS="$CPPFLAGS -I\${includedir}"
1650 dnl ---------------------------------------------------------------------------
1651 dnl CF_INTEL_COMPILER version: 3 updated: 2005/08/06 18:37:29
1652 dnl -----------------
1653 dnl Check if the given compiler is really the Intel compiler for Linux. It
1654 dnl tries to imitate gcc, but does not return an error when it finds a mismatch
1655 dnl between prototypes, e.g., as exercised by CF_MISSING_CHECK.
1657 dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to
1658 dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from
1659 dnl the wrappers for gcc and g++ warnings.
1661 dnl $1 = GCC (default) or GXX
1662 dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS
1663 dnl $3 = CFLAGS (default) or CXXFLAGS
1664 AC_DEFUN([CF_INTEL_COMPILER],[
1665 ifelse($2,,INTEL_COMPILER,[$2])=no
1667 if test "$ifelse($1,,[$1],GCC)" = yes ; then
1670 AC_MSG_CHECKING(if this is really Intel ifelse($1,GXX,C++,C) compiler)
1671 cf_save_CFLAGS="$ifelse($3,,CFLAGS,[$3])"
1672 ifelse($3,,CFLAGS,[$3])="$ifelse($3,,CFLAGS,[$3]) -no-gcc"
1674 #ifdef __INTEL_COMPILER
1678 ],[ifelse($2,,INTEL_COMPILER,[$2])=yes
1679 cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc"
1681 ifelse($3,,CFLAGS,[$3])="$cf_save_CFLAGS"
1682 AC_MSG_RESULT($ifelse($2,,INTEL_COMPILER,[$2]))
1687 dnl ---------------------------------------------------------------------------
1688 dnl CF_ISASCII version: 3 updated: 2000/08/12 23:18:52
1690 dnl Check if we have either a function or macro for 'isascii()'.
1691 AC_DEFUN([CF_ISASCII],
1693 AC_MSG_CHECKING(for isascii)
1694 AC_CACHE_VAL(cf_cv_have_isascii,[
1695 AC_TRY_LINK([#include <ctype.h>],[int x = isascii(' ')],
1696 [cf_cv_have_isascii=yes],
1697 [cf_cv_have_isascii=no])
1699 AC_MSG_RESULT($cf_cv_have_isascii)
1700 test "$cf_cv_have_isascii" = yes && AC_DEFINE(HAVE_ISASCII)
1702 dnl ---------------------------------------------------------------------------
1703 dnl CF_LARGEFILE version: 6 updated: 2006/09/23 19:07:52
1705 dnl Add checks for large file support.
1706 AC_DEFUN([CF_LARGEFILE],[
1707 ifdef([AC_FUNC_FSEEKO],[
1709 if test "$enable_largefile" != no ; then
1712 # Normally we would collect these definitions in the config.h,
1713 # but (like _XOPEN_SOURCE), some environments rely on having these
1714 # defined before any of the system headers are included. Another
1715 # case comes up with C++, e.g., on AIX the compiler compiles the
1716 # header files by themselves before looking at the body files it is
1717 # told to compile. For ncurses, those header files do not include
1719 test "$ac_cv_sys_large_files" != no && CPPFLAGS="$CPPFLAGS -D_LARGE_FILES "
1720 test "$ac_cv_sys_largefile_source" != no && CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE "
1722 AC_CACHE_CHECK(whether to use struct dirent64, cf_cv_struct_dirent64,[
1724 #include <sys/types.h>
1727 /* if transitional largefile support is setup, this is true */
1728 extern struct dirent64 * readdir(DIR *);
1729 struct dirent64 *x = readdir((DIR *)0);
1730 struct dirent *y = readdir((DIR *)0);
1733 [cf_cv_struct_dirent64=yes],
1734 [cf_cv_struct_dirent64=no])
1736 test "$cf_cv_struct_dirent64" = yes && AC_DEFINE(HAVE_STRUCT_DIRENT64)
1740 dnl ---------------------------------------------------------------------------
1741 dnl CF_LIBUTF8 version: 2 updated: 2002/01/19 22:51:32
1743 dnl Check for libutf8
1744 AC_DEFUN([CF_LIBUTF8],
1746 AC_CACHE_CHECK(for putwc in libutf8,cf_cv_libutf8,[
1747 cf_save_LIBS="$LIBS"
1750 #include <libutf8.h>],[putwc(0,0);],
1751 [cf_cv_libutf8=yes],
1753 LIBS="$cf_save_LIBS"
1756 if test "$cf_cv_libutf8" = yes ; then
1757 AC_DEFINE(HAVE_LIBUTF8_H)
1761 dnl ---------------------------------------------------------------------------
1762 dnl CF_LIB_PREFIX version: 7 updated: 2001/01/12 01:23:48
1764 dnl Compute the library-prefix for the given host system
1765 dnl $1 = variable to set
1766 AC_DEFUN([CF_LIB_PREFIX],
1768 case $cf_cv_system_name in
1769 OS/2*) LIB_PREFIX='' ;;
1770 os2*) LIB_PREFIX='' ;;
1771 *) LIB_PREFIX='lib' ;;
1773 ifelse($1,,,[$1=$LIB_PREFIX])
1774 AC_SUBST(LIB_PREFIX)
1776 dnl ---------------------------------------------------------------------------
1777 dnl CF_LIB_RULES version: 46 updated: 2007/02/17 16:49:32
1779 dnl Append definitions and rules for the given models to the subdirectory
1780 dnl Makefiles, and the recursion rule for the top-level Makefile. If the
1781 dnl subdirectory is a library-source directory, modify the LIBRARIES list in
1782 dnl the corresponding makefile to list the models that we'll generate.
1784 dnl For shared libraries, make a list of symbolic links to construct when
1785 dnl generating each library. The convention used for Linux is the simplest
1788 dnl lib<name>.so.<major> ->
1789 dnl lib<name>.so.<maj>.<minor>
1790 AC_DEFUN([CF_LIB_RULES],
1792 CF_LIB_PREFIX(cf_prefix)
1793 AC_REQUIRE([CF_SUBST_NCURSES_VERSION])
1794 for cf_dir in $SRC_SUBDIRS
1796 if test ! -d $srcdir/$cf_dir ; then
1798 elif test -f $srcdir/$cf_dir/modules; then
1803 for cf_item in $cf_LIST_MODELS
1805 CF_LIB_SUFFIX($cf_item,cf_suffix)
1806 if test $cf_item = shared ; then
1807 if test "$cf_cv_do_symlinks" = yes ; then
1808 case "$cf_cv_shlib_version" in #(vi
1810 case "$cf_cv_system_name" in #(vi
1812 case .${LIB_SUFFIX} in
1814 cf_suffix=`echo $cf_suffix | sed 's/^w//'`
1815 cf_suffix=w'.${REL_VERSION}'"$cf_suffix"
1818 cf_suffix='.${REL_VERSION}'"$cf_suffix"
1822 *) cf_suffix="$cf_suffix"'.${REL_VERSION}' ;;
1826 case "$cf_cv_system_name" in #(vi
1828 case .${LIB_SUFFIX} in
1830 cf_suffix=`echo $cf_suffix | sed 's/^w//'`
1831 cf_suffix=w'.${ABI_VERSION}'"$cf_suffix"
1834 cf_suffix='.${ABI_VERSION}'"$cf_suffix"
1838 *) cf_suffix="$cf_suffix"'.${ABI_VERSION}' ;;
1843 # cygwin needs import library, and has unique naming convention
1844 # use autodetected ${cf_prefix} for import lib and static lib, but
1845 # use 'cyg' prefix for shared lib.
1846 if test $cf_cv_shlib_version = cygdll ; then
1847 SHARED_LIB="cyg${cf_dir}\${ABI_VERSION}.dll"
1848 IMPORT_LIB="${cf_prefix}${cf_dir}.dll.a"
1849 LIBS_TO_MAKE="$LIBS_TO_MAKE ../lib/\${SHARED_LIB} ../lib/\${IMPORT_LIB}"
1853 LIBS_TO_MAKE="$LIBS_TO_MAKE ../lib/${cf_prefix}${cf_dir}${cf_suffix}"
1856 if test $cf_dir = ncurses ; then
1857 cf_subsets="$LIB_SUBSETS"
1858 cf_r_parts="$cf_subsets"
1860 while test -n "$cf_r_parts"
1862 cf_l_parts=`echo "$cf_r_parts" |sed -e 's/ .*$//'`
1863 cf_r_parts=`echo "$cf_r_parts" |sed -e 's/^[[^ ]]* //'`
1864 if test "$cf_l_parts" != "$cf_r_parts" ; then
1865 case $cf_l_parts in #(vi
1867 cf_item=`echo $LIBS_TO_MAKE |sed -e s%${LIB_NAME}${LIB_SUFFIX}%${TINFO_LIB_SUFFIX}%g`
1870 cf_item=`echo $LIBS_TO_MAKE |sed -e s%${LIB_NAME}${LIB_SUFFIX}%${TICS_LIB_SUFFIX}%g`
1876 LIBS_TO_MAKE="$cf_item $LIBS_TO_MAKE"
1882 cf_subsets=`echo "$LIB_SUBSETS" | sed -e 's/^termlib.* //'`
1885 sed -e "s%@LIBS_TO_MAKE@%$LIBS_TO_MAKE%" \
1886 -e "s%@IMPORT_LIB@%$IMPORT_LIB%" \
1887 -e "s%@SHARED_LIB@%$SHARED_LIB%" \
1888 $cf_dir/Makefile >$cf_dir/Makefile.out
1889 mv $cf_dir/Makefile.out $cf_dir/Makefile
1891 $AWK -f $srcdir/mk-0th.awk \
1892 libname="${cf_dir}${LIB_SUFFIX}" subsets="$LIB_SUBSETS" \
1893 $srcdir/$cf_dir/modules >>$cf_dir/Makefile
1895 for cf_subset in $cf_subsets
1898 for cf_item in $cf_LIST_MODELS
1900 echo "Appending rules for ${cf_item} model (${cf_dir}: ${cf_subset})"
1901 CF_UPPER(cf_ITEM,$cf_item)
1902 CF_LIB_SUFFIX($cf_item,cf_suffix)
1903 CF_OBJ_SUBDIR($cf_item,cf_subdir)
1905 # Test for case where we build libtinfo with a different name.
1907 if test $cf_dir = ncurses ; then
1912 cf_libname=$TINFO_LIB_SUFFIX
1913 if test -n "${DFT_ARG_SUFFIX}" ; then
1914 # undo $LIB_SUFFIX add-on in CF_LIB_SUFFIX
1915 cf_suffix=`echo $cf_suffix |sed -e "s%^${LIB_SUFFIX}%%"`
1919 cf_libname=$TICS_LIB_SUFFIX
1920 if test -n "${DFT_ARG_SUFFIX}" ; then
1921 # undo $LIB_SUFFIX add-on in CF_LIB_SUFFIX
1922 cf_suffix=`echo $cf_suffix |sed -e "s%^${LIB_SUFFIX}%%"`
1928 # These dependencies really are for development, not
1929 # builds, but they are useful in porting, too.
1930 cf_depend="../include/ncurses_cfg.h"
1931 if test "$srcdir" = "."; then
1934 cf_reldir="\${srcdir}"
1937 if test -f $srcdir/$cf_dir/$cf_dir.priv.h; then
1938 cf_depend="$cf_depend $cf_reldir/$cf_dir.priv.h"
1939 elif test -f $srcdir/$cf_dir/curses.priv.h; then
1940 cf_depend="$cf_depend $cf_reldir/curses.priv.h"
1944 old_cf_suffix="$cf_suffix"
1945 if test "$cf_cv_shlib_version_infix" = yes ; then
1946 if test -n "$LIB_SUFFIX" ; then
1949 cf_libname=`echo $cf_libname | sed 's/w$//'`
1950 cf_suffix=`echo $cf_suffix | sed 's/^w//'`
1957 $AWK -f $srcdir/mk-1st.awk \
1958 name=${cf_libname}${cf_dir_suffix} \
1959 traces=$LIB_TRACING \
1965 TermlibRoot=$TINFO_NAME \
1966 ShlibVer=$cf_cv_shlib_version \
1967 ShlibVerInfix=$cf_cv_shlib_version_infix \
1968 ReLink=${cf_cv_do_relink-no} \
1969 DoLinks=$cf_cv_do_symlinks \
1970 rmSoLocs=$cf_cv_rm_so_locs \
1971 ldconfig="$LDCONFIG" \
1972 overwrite=$WITH_OVERWRITE \
1973 depend="$cf_depend" \
1975 $srcdir/$cf_dir/modules >>$cf_dir/Makefile
1977 cf_suffix="$old_cf_suffix"
1979 for cf_subdir2 in $cf_subdirs lib
1981 test $cf_subdir = $cf_subdir2 && break
1983 test "${cf_subset}.${cf_subdir2}" != "${cf_subset}.${cf_subdir}" && \
1984 $AWK -f $srcdir/mk-2nd.awk \
1986 traces=$LIB_TRACING \
1992 crenames=$cf_cv_prog_CC_c_o \
1993 cxxrenames=$cf_cv_prog_CXX_c_o \
1994 $srcdir/$cf_dir/modules >>$cf_dir/Makefile
1995 cf_subdirs="$cf_subdirs $cf_subdir"
2000 echo ' cd '$cf_dir' && ${MAKE} ${CF_MFLAGS} [$]@' >>Makefile
2003 for cf_dir in $SRC_SUBDIRS
2005 if test ! -d $srcdir/$cf_dir ; then
2009 if test -f $cf_dir/Makefile ; then
2012 echo 'libs \' >> Makefile
2013 echo 'install.libs \' >> Makefile
2014 echo 'uninstall.libs ::' >> Makefile
2015 echo ' cd '$cf_dir' && ${MAKE} ${CF_MFLAGS} [$]@' >> Makefile
2020 if test -f $srcdir/$cf_dir/modules; then
2022 if test -f $srcdir/$cf_dir/headers; then
2023 cat >> Makefile <<CF_EOF
2025 uninstall.includes \\
2028 if test "$cf_dir" != "c++" ; then
2029 echo 'lint \' >> Makefile
2031 cat >> Makefile <<CF_EOF
2037 uninstall.$cf_dir ::
2038 cd $cf_dir && \${MAKE} \${CF_MFLAGS} \[$]@
2040 elif test -f $srcdir/$cf_dir/headers; then
2041 cat >> Makefile <<CF_EOF
2047 uninstall.includes ::
2048 cd $cf_dir && \${MAKE} \${CF_MFLAGS} \[$]@
2053 cat >> Makefile <<CF_EOF
2055 install.libs uninstall.libs \\
2056 install.data uninstall.data ::
2057 $MAKE_TERMINFO cd misc && \${MAKE} \${CF_MFLAGS} \[$]@
2061 cd man && \${MAKE} \${CF_MFLAGS} \[$]@
2064 rm -f config.cache config.log config.status Makefile include/ncurses_cfg.h
2065 rm -f headers.sh headers.sed
2066 rm -rf \${DIRS_TO_MAKE}
2069 # Special case: tack's manpage lives in its own directory.
2070 if test -d tack ; then
2071 if test -f $srcdir/$tack.h; then
2072 cat >> Makefile <<CF_EOF
2076 cd tack && \${MAKE} \${CF_MFLAGS} \[$]@
2081 dnl If we're installing into a subdirectory of /usr/include, etc., we should
2082 dnl prepend the subdirectory's name to the "#include" paths. It won't hurt
2083 dnl anything, and will make it more standardized. It's awkward to decide this
2084 dnl at configuration because of quoting, so we'll simply make all headers
2085 dnl installed via a script that can do the right thing.
2087 rm -f headers.sed headers.sh
2089 dnl ( generating this script makes the makefiles a little tidier :-)
2090 echo creating headers.sh
2091 cat >headers.sh <<CF_EOF
2093 # This shell script is generated by the 'configure' script. It is invoked in a
2094 # subdirectory of the build tree. It generates a sed-script in the parent
2095 # directory that is used to adjust includes for header files that reside in a
2096 # subdirectory of /usr/include, etc.
2098 while test \[$]# != 3
2100 PRG="\$PRG \[$]1"; shift
2105 TMPSRC=\${TMPDIR-/tmp}/\`basename \$SRC\`\$\$
2106 TMPSED=\${TMPDIR-/tmp}/headers.sed\$\$
2107 echo installing \$SRC in \$DST
2110 if test $WITH_CURSES_H = yes; then
2111 cat >>headers.sh <<CF_EOF
2114 END=\`basename \$DST\`
2115 for i in \`cat \$REF/../*/headers |fgrep -v "#"\`
2117 NAME=\`basename \$i\`
2118 echo "s/<\$NAME>/<\$END\/\$NAME>/" >> \$TMPSED
2128 cat >>headers.sh <<CF_EOF
2131 END=\`basename \$DST\`
2132 for i in \`cat \$REF/../*/headers |fgrep -v "#"\`
2134 NAME=\`basename \$i\`
2135 if test "\$NAME" = "curses.h"
2137 echo "s/<curses.h>/<ncurses.h>/" >> \$TMPSED
2140 echo "s/<\$NAME>/<\$END\/\$NAME>/" >> \$TMPSED
2144 echo "s/<curses.h>/<ncurses.h>/" >> \$TMPSED
2149 cat >>headers.sh <<CF_EOF
2151 sed -f \$TMPSED \$SRC > \$TMPSRC
2152 NAME=\`basename \$SRC\`
2154 if test $WITH_CURSES_H != yes; then
2155 cat >>headers.sh <<CF_EOF
2156 test "\$NAME" = "curses.h" && NAME=ncurses.h
2159 cat >>headers.sh <<CF_EOF
2160 # Just in case someone gzip'd manpages, remove the conflicting copy.
2161 test -f \$DST/\$NAME.gz && rm -f \$DST/\$NAME.gz
2163 eval \$PRG \$TMPSRC \$DST/\$NAME
2164 rm -f \$TMPSRC \$TMPSED
2167 chmod 0755 headers.sh
2169 for cf_dir in $SRC_SUBDIRS
2171 if test ! -d $srcdir/$cf_dir ; then
2175 if test -f $srcdir/$cf_dir/headers; then
2176 $AWK -f $srcdir/mk-hdr.awk \
2177 subset="$LIB_SUBSETS" \
2178 compat="$WITH_CURSES_H" \
2179 $srcdir/$cf_dir/headers >>$cf_dir/Makefile
2182 if test -f $srcdir/$cf_dir/modules; then
2183 if test "$cf_dir" != "c++" ; then
2184 cat >>$cf_dir/Makefile <<"CF_EOF"
2185 depend : ${AUTO_SRC}
2186 makedepend -- ${CPPFLAGS} -- ${C_SRC}
2188 # DO NOT DELETE THIS LINE -- make depend depends on it.
2195 dnl ---------------------------------------------------------------------------
2196 dnl CF_LIB_SONAME version: 3 updated: 2006/12/16 15:55:46
2198 dnl Find the and soname for the given shared library. Set the cache variable
2199 dnl cf_cv_$3_soname to this, unless it is not found. Then set the cache
2200 dnl variable to "unknown".
2204 dnl $3 = library name
2205 AC_DEFUN([CF_LIB_SONAME],
2207 AC_CACHE_CHECK(for soname of $3 library,cf_cv_$3_soname,[
2209 cf_cv_$3_soname=unknown
2210 if test "$cross_compiling" != yes ; then
2211 cat >conftest.$ac_ext <<CF_EOF
2216 ${cf_cv_main_return:-return}(0);
2219 cf_save_LIBS="$LIBS"
2221 if AC_TRY_EVAL(ac_compile) ; then
2222 if AC_TRY_EVAL(ac_link) ; then
2223 cf_cv_$3_soname=`ldd conftest$ac_exeext 2>/dev/null | sed -e 's,^.*/,,' -e 's, .*$,,' | fgrep lib$3.`
2224 test -z "$cf_cv_$3_soname" && cf_cv_$3_soname=unknown
2228 LIBS="$cf_save_LIBS"
2232 dnl ---------------------------------------------------------------------------
2233 dnl CF_LIB_SUFFIX version: 13 updated: 2003/11/01 16:09:07
2235 dnl Compute the library file-suffix from the given model name
2237 dnl $2 = variable to set
2238 dnl The variable $LIB_SUFFIX, if set, prepends the variable to set.
2239 AC_DEFUN([CF_LIB_SUFFIX],
2241 AC_REQUIRE([CF_SUBST_NCURSES_VERSION])
2243 libtool) $2='.la' ;;
2246 profile) $2='_p.a' ;;
2248 case $cf_cv_system_name in
2249 cygwin*) $2='.dll' ;;
2250 darwin*) $2='.dylib' ;;
2260 test -n "$LIB_SUFFIX" && $2="${LIB_SUFFIX}[$]{$2}"
2262 dnl ---------------------------------------------------------------------------
2263 dnl CF_LIB_TYPE version: 4 updated: 2000/10/20 22:57:49
2265 dnl Compute the string to append to -library from the given model name
2267 dnl $2 = variable to set
2268 dnl The variable $LIB_SUFFIX, if set, prepends the variable to set.
2269 AC_DEFUN([CF_LIB_TYPE],
2278 test -n "$LIB_SUFFIX" && $2="${LIB_SUFFIX}[$]{$2}"
2280 dnl ---------------------------------------------------------------------------
2281 dnl CF_LINK_DATAONLY version: 8 updated: 2006/12/16 12:33:30
2282 dnl ----------------
2283 dnl Some systems have a non-ANSI linker that doesn't pull in modules that have
2284 dnl only data (i.e., no functions), for example NeXT. On those systems we'll
2285 dnl have to provide wrappers for global tables to ensure they're linked
2287 AC_DEFUN([CF_LINK_DATAONLY],
2289 AC_MSG_CHECKING([if data-only library module links])
2290 AC_CACHE_VAL(cf_cv_link_dataonly,[
2292 cat >conftest.$ac_ext <<EOF
2293 #line __oline__ "configure"
2294 int testdata[[3]] = { 123, 456, 789 };
2296 if AC_TRY_EVAL(ac_compile) ; then
2297 mv conftest.o data.o && \
2298 ( $AR $AR_OPTS conftest.a data.o ) 2>&AC_FD_CC 1>/dev/null
2300 rm -f conftest.$ac_ext data.o
2301 cat >conftest.$ac_ext <<EOF
2302 #line __oline__ "configure"
2306 ${cf_cv_main_return:-return}(1); /* I'm told this linker is broken */
2308 extern int testdata[[3]];
2309 return testdata[[0]] == 123
2310 && testdata[[1]] == 456
2311 && testdata[[2]] == 789;
2315 if AC_TRY_EVAL(ac_compile); then
2316 mv conftest.o func.o && \
2317 ( $AR $AR_OPTS conftest.a func.o ) 2>&AC_FD_CC 1>/dev/null
2319 rm -f conftest.$ac_ext func.o
2320 ( eval $RANLIB conftest.a ) 2>&AC_FD_CC >/dev/null
2322 LIBS="conftest.a $LIBS"
2326 extern int testfunc();
2327 ${cf_cv_main_return:-return} (!testfunc());
2330 [cf_cv_link_dataonly=yes],
2331 [cf_cv_link_dataonly=no],
2332 [cf_cv_link_dataonly=unknown])
2335 AC_MSG_RESULT($cf_cv_link_dataonly)
2337 if test "$cf_cv_link_dataonly" = no ; then
2338 AC_DEFINE(BROKEN_LINKER)
2343 dnl ---------------------------------------------------------------------------
2344 dnl CF_LINK_FUNCS version: 7 updated: 2006/12/16 12:33:30
2346 dnl Most Unix systems have both link and symlink, a few don't have symlink.
2347 dnl A few non-Unix systems implement symlink, but not link.
2348 dnl A few non-systems implement neither (or have nonfunctional versions).
2349 AC_DEFUN([CF_LINK_FUNCS],
2355 if test "$cross_compiling" = yes ; then
2360 AC_CACHE_CHECK(if link/symlink functions work,cf_cv_link_funcs,[
2362 for cf_func in link symlink ; do
2364 #include <sys/types.h>
2365 #include <sys/stat.h>
2366 #ifdef HAVE_UNISTD_H
2372 char *src = "config.log";
2373 char *dst = "conftest.chk";
2378 fail = ($cf_func("config.log", "conftest.chk") < 0)
2379 || (stat(dst, &dst_sb) < 0)
2380 || (dst_sb.st_mtime != src_sb.st_mtime);
2386 ${cf_cv_main_return:-return} (fail);
2389 cf_cv_link_funcs="$cf_cv_link_funcs $cf_func"
2390 eval 'ac_cv_func_'$cf_func'=yes'],[
2391 eval 'ac_cv_func_'$cf_func'=no'],[
2392 eval 'ac_cv_func_'$cf_func'=error'])
2394 test -z "$cf_cv_link_funcs" && cf_cv_link_funcs=no
2396 test "$ac_cv_func_link" = yes && AC_DEFINE(HAVE_LINK)
2397 test "$ac_cv_func_symlink" = yes && AC_DEFINE(HAVE_SYMLINK)
2400 dnl ---------------------------------------------------------------------------
2401 dnl CF_MAIN_RETURN version: 1 updated: 2006/12/10 09:51:54
2403 dnl Check if a return from main to the shell actually returns the same exit
2404 dnl code. This is true for almost any POSIX environment.
2406 dnl Some very old environments did not flush stdout, etc., on an exit. That
2407 dnl would be a useful case to test for also.
2408 AC_DEFUN([CF_MAIN_RETURN],
2410 cf_cv_main_return=return
2412 dnl ---------------------------------------------------------------------------
2413 dnl CF_MAKEFLAGS version: 12 updated: 2006/10/21 08:27:03
2415 dnl Some 'make' programs support ${MAKEFLAGS}, some ${MFLAGS}, to pass 'make'
2416 dnl options to lower-levels. It's very useful for "make -n" -- if we have it.
2417 dnl (GNU 'make' does both, something POSIX 'make', which happens to make the
2418 dnl ${MAKEFLAGS} variable incompatible because it adds the assignments :-)
2419 AC_DEFUN([CF_MAKEFLAGS],
2421 AC_CACHE_CHECK(for makeflags variable, cf_cv_makeflags,[
2423 for cf_option in '-${MAKEFLAGS}' '${MFLAGS}'
2425 cat >cf_makeflags.tmp <<CF_EOF
2428 @ echo '.$cf_option'
2430 cf_result=`${MAKE-make} -k -f cf_makeflags.tmp 2>/dev/null | sed -e 's,[[ ]]*$,,'`
2431 case "$cf_result" in
2433 cf_result=`${MAKE-make} -k -f cf_makeflags.tmp CC=cc 2>/dev/null`
2434 case "$cf_result" in
2435 .*CC=*) cf_cv_makeflags=
2437 *) cf_cv_makeflags=$cf_option
2443 *) echo "given option \"$cf_option\", no match \"$cf_result\""
2447 rm -f cf_makeflags.tmp
2450 AC_SUBST(cf_cv_makeflags)
2452 dnl ---------------------------------------------------------------------------
2453 dnl CF_MAKE_TAGS version: 2 updated: 2000/10/04 09:18:40
2455 dnl Generate tags/TAGS targets for makefiles. Do not generate TAGS if we have
2456 dnl a monocase filesystem.
2457 AC_DEFUN([CF_MAKE_TAGS],[
2458 AC_REQUIRE([CF_MIXEDCASE_FILENAMES])
2459 AC_CHECK_PROG(MAKE_LOWER_TAGS, ctags, yes, no)
2461 if test "$cf_cv_mixedcase" = yes ; then
2462 AC_CHECK_PROG(MAKE_UPPER_TAGS, etags, yes, no)
2467 if test "$MAKE_UPPER_TAGS" = yes ; then
2472 AC_SUBST(MAKE_UPPER_TAGS)
2474 if test "$MAKE_LOWER_TAGS" = yes ; then
2479 AC_SUBST(MAKE_LOWER_TAGS)
2481 dnl ---------------------------------------------------------------------------
2482 dnl CF_MANPAGE_FORMAT version: 7 updated: 2003/12/20 19:30:34
2483 dnl -----------------
2484 dnl Option to allow user to override automatic configuration of manpage format.
2485 dnl There are several special cases:
2487 dnl gzip - man checks for, can display gzip'd files
2488 dnl compress - man checks for, can display compressed files
2489 dnl BSDI - files in the cat-directories are suffixed ".0"
2490 dnl formatted - installer should format (put files in cat-directory)
2491 dnl catonly - installer should only format, e.g., for a turnkey system.
2493 dnl There are other configurations which this macro does not test, e.g., HPUX's
2494 dnl compressed manpages (but uncompressed manpages are fine, and HPUX's naming
2495 dnl convention would not match our use).
2496 AC_DEFUN([CF_MANPAGE_FORMAT],
2498 AC_REQUIRE([CF_PATHSEP])
2499 AC_MSG_CHECKING(format of man-pages)
2501 AC_ARG_WITH(manpage-format,
2502 [ --with-manpage-format specify manpage-format: gzip/compress/BSDI/normal and
2503 optionally formatted/catonly, e.g., gzip,formatted],
2504 [MANPAGE_FORMAT=$withval],
2505 [MANPAGE_FORMAT=unknown])
2507 test -z "$MANPAGE_FORMAT" && MANPAGE_FORMAT=unknown
2508 MANPAGE_FORMAT=`echo "$MANPAGE_FORMAT" | sed -e 's/,/ /g'`
2512 case $MANPAGE_FORMAT in
2514 if test -z "$MANPATH" ; then
2515 MANPATH="/usr/man:/usr/share/man"
2518 # look for the 'date' man-page (it's most likely to be installed!)
2524 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATHSEP}"
2525 for cf_dir in $MANPATH; do
2526 test -z "$cf_dir" && cf_dir=/usr/man
2527 for cf_name in $cf_dir/man*/$cf_example.[[01]]* $cf_dir/cat*/$cf_example.[[01]]* $cf_dir/man*/$cf_example $cf_dir/cat*/$cf_example
2529 cf_test=`echo $cf_name | sed -e 's/*//'`
2530 if test "x$cf_test" = "x$cf_name" ; then
2533 *.gz) MANPAGE_FORMAT="$MANPAGE_FORMAT gzip";;
2534 *.Z) MANPAGE_FORMAT="$MANPAGE_FORMAT compress";;
2535 *.0) MANPAGE_FORMAT="$MANPAGE_FORMAT BSDI";;
2536 *) MANPAGE_FORMAT="$MANPAGE_FORMAT normal";;
2550 # if we found a match in either man* or cat*, stop looking
2551 if test -n "$MANPAGE_FORMAT" ; then
2553 test "$cf_preform" = yes && MANPAGE_FORMAT="$MANPAGE_FORMAT formatted"
2554 test "$cf_catonly" = yes && MANPAGE_FORMAT="$MANPAGE_FORMAT catonly"
2560 test $cf_found=yes && break
2563 # only check the first directory in $MANPATH where we find manpages
2564 if test -n "$MANPAGE_FORMAT" ; then
2568 # if we did not find the example, just assume it is normal
2569 test -z "$MANPAGE_FORMAT" && MANPAGE_FORMAT=normal
2573 for cf_option in $MANPAGE_FORMAT; do
2574 case $cf_option in #(vi
2575 gzip|compress|BSDI|normal|formatted|catonly)
2578 cf_unknown="$cf_unknown $cf_option"
2585 AC_MSG_RESULT($MANPAGE_FORMAT)
2586 if test -n "$cf_unknown" ; then
2587 AC_MSG_WARN(Unexpected manpage-format $cf_unknown)
2590 dnl ---------------------------------------------------------------------------
2591 dnl CF_MANPAGE_RENAMES version: 7 updated: 2005/06/18 18:51:57
2592 dnl ------------------
2593 dnl The Debian people have their own naming convention for manpages. This
2594 dnl option lets us override the name of the file containing renaming, or
2595 dnl disable it altogether.
2596 AC_DEFUN([CF_MANPAGE_RENAMES],
2598 AC_MSG_CHECKING(for manpage renaming)
2600 AC_ARG_WITH(manpage-renames,
2601 [ --with-manpage-renames specify manpage-renaming],
2602 [MANPAGE_RENAMES=$withval],
2603 [MANPAGE_RENAMES=yes])
2605 case ".$MANPAGE_RENAMES" in #(vi
2609 # Debian 'man' program?
2610 if test -f /etc/debian_version ; then
2611 MANPAGE_RENAMES=`cd $srcdir && pwd`/man/man_db.renames
2618 if test "$MANPAGE_RENAMES" != no ; then
2619 if test -f $srcdir/man/$MANPAGE_RENAMES ; then
2620 MANPAGE_RENAMES=`cd $srcdir/man && pwd`/$MANPAGE_RENAMES
2621 elif test ! -f $MANPAGE_RENAMES ; then
2622 AC_MSG_ERROR(not a filename: $MANPAGE_RENAMES)
2625 test ! -d man && mkdir man
2627 # Construct a sed-script to perform renaming within man-pages
2628 if test -n "$MANPAGE_RENAMES" ; then
2629 test ! -d man && mkdir man
2630 sh $srcdir/man/make_sed.sh $MANPAGE_RENAMES >./edit_man.sed
2634 AC_MSG_RESULT($MANPAGE_RENAMES)
2635 AC_SUBST(MANPAGE_RENAMES)
2637 dnl ---------------------------------------------------------------------------
2638 dnl CF_MANPAGE_SYMLINKS version: 4 updated: 2003/12/13 18:01:58
2639 dnl -------------------
2640 dnl Some people expect each tool to make all aliases for manpages in the
2641 dnl man-directory. This accommodates the older, less-capable implementations
2642 dnl of 'man', and is optional.
2643 AC_DEFUN([CF_MANPAGE_SYMLINKS],
2645 AC_MSG_CHECKING(if manpage aliases will be installed)
2647 AC_ARG_WITH(manpage-aliases,
2648 [ --with-manpage-aliases specify manpage-aliases using .so],
2649 [MANPAGE_ALIASES=$withval],
2650 [MANPAGE_ALIASES=yes])
2652 AC_MSG_RESULT($MANPAGE_ALIASES)
2654 if test "$LN_S" = "ln -s"; then
2661 if test "$MANPAGE_ALIASES" = yes ; then
2662 AC_MSG_CHECKING(if manpage symlinks should be used)
2664 AC_ARG_WITH(manpage-symlinks,
2665 [ --with-manpage-symlinks specify manpage-aliases using symlinks],
2666 [MANPAGE_SYMLINKS=$withval],
2667 [MANPAGE_SYMLINKS=$cf_use_symlinks])
2669 if test "$$cf_use_symlinks" = no; then
2670 if test "$MANPAGE_SYMLINKS" = yes ; then
2671 AC_MSG_WARN(cannot make symlinks, will use .so files)
2676 AC_MSG_RESULT($MANPAGE_SYMLINKS)
2680 dnl ---------------------------------------------------------------------------
2681 dnl CF_MANPAGE_TBL version: 3 updated: 2002/01/19 22:51:32
2683 dnl This option causes manpages to be run through tbl(1) to generate tables
2685 AC_DEFUN([CF_MANPAGE_TBL],
2687 AC_MSG_CHECKING(for manpage tbl)
2689 AC_ARG_WITH(manpage-tbl,
2690 [ --with-manpage-tbl specify manpage processing with tbl],
2691 [MANPAGE_TBL=$withval],
2694 AC_MSG_RESULT($MANPAGE_TBL)
2696 dnl ---------------------------------------------------------------------------
2697 dnl CF_MAN_PAGES version: 32 updated: 2006/12/24 15:18:27
2699 dnl Try to determine if the man-pages on the system are compressed, and if
2700 dnl so, what format is used. Use this information to construct a script that
2701 dnl will install man-pages.
2702 AC_DEFUN([CF_MAN_PAGES],
2704 CF_HELP_MESSAGE(Options to Specify How Manpages are Installed:)
2710 if test "$prefix" = "NONE" ; then
2711 cf_prefix="$ac_default_prefix"
2716 case "$MANPAGE_FORMAT" in # (vi
2731 test ! -d man && mkdir man
2735 case "$MANPAGE_FORMAT" in #(vi
2738 cf_compress=compress
2746 cf_edit_man=./edit_man.sh
2747 cf_man_alias=`pwd`/man_alias.sed
2749 cat >$cf_edit_man <<CF_EOF
2751 # this script is generated by the configure-script CF_MAN_PAGES macro.
2756 NCURSES_MAJOR="$NCURSES_MAJOR"
2757 NCURSES_MINOR="$NCURSES_MINOR"
2758 NCURSES_PATCH="$NCURSES_PATCH"
2760 NCURSES_OSPEED="$NCURSES_OSPEED"
2761 TERMINFO="$TERMINFO"
2763 MKDIRS="sh `cd $srcdir && pwd`/mkinstalldirs"
2766 INSTALL_DATA="$INSTALL_DATA"
2768 transform="$program_transform_name"
2770 TMP=\${TMPDIR-/tmp}/man\$\$
2771 trap "rm -f \$TMP" 0 1 2 5 15
2783 top_srcdir=\[$]srcdir/..
2786 if test "\$form" = normal ; then
2787 if test "$cf_format" = yes ; then
2788 if test "$cf_inboth" = no ; then
2789 sh \[$]0 format \$verb \$mandir \$srcdir \[$]*
2793 cf_subdir=\$mandir/man
2794 cf_tables=$MANPAGE_TBL
2796 cf_subdir=\$mandir/cat
2800 # process the list of source-files
2803 *.orig|*.rej) ;; #(vi
2805 section=\`expr "\$i" : '.*\\.\\([[0-9]]\\)[[xm]]*'\`;
2806 if test \$verb = installing ; then
2807 if test ! -d \$cf_subdir\${section} ; then
2808 \$MKDIRS \$cf_subdir\$section
2812 # replace variables in man page
2813 if test ! -f $cf_man_alias ; then
2814 cat >>$cf_man_alias <<-CF_EOF2
2815 s,@DATADIR@,\$datadir,
2816 s,@TERMINFO@,\$TERMINFO,
2817 s,@NCURSES_MAJOR@,\$NCURSES_MAJOR,
2818 s,@NCURSES_MINOR@,\$NCURSES_MINOR,
2819 s,@NCURSES_PATCH@,\$NCURSES_PATCH,
2820 s,@NCURSES_OSPEED@,\$NCURSES_OSPEED,
2825 cf_NAME=`echo "$cf_name" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
2826 cf_name=`echo $cf_name|sed "$program_transform_name"`
2827 cat >>$cf_edit_man <<-CF_EOF
2828 s,@$cf_NAME@,$cf_name,
2832 cat >>$cf_edit_man <<CF_EOF
2834 echo "...made $cf_man_alias"
2838 cf_source=\`basename \$i\`
2840 test ! -f \$inalias && inalias="\$srcdir/\$inalias"
2841 if test ! -f \$inalias ; then
2842 echo .. skipped \$cf_source
2847 if test "$MANPAGE_ALIASES" != no ; then
2848 cat >>$cf_edit_man <<CF_EOF
2849 aliases=\`sed -f \$top_srcdir/man/manlinks.sed \$inalias |sed -f $cf_man_alias | sort -u\`
2853 if test "$MANPAGE_RENAMES" = no ; then
2854 cat >>$cf_edit_man <<CF_EOF
2855 # perform program transformations for section 1 man pages
2856 if test \$section = 1 ; then
2857 cf_target=\$cf_subdir\${section}/\`echo \$cf_source|sed "\${transform}"\`
2859 cf_target=\$cf_subdir\${section}/\$cf_source
2863 cat >>$cf_edit_man <<CF_EOF
2864 cf_target=\`grep "^\$cf_source" $MANPAGE_RENAMES | $AWK '{print \[$]2}'\`
2865 if test -z "\$cf_target" ; then
2866 echo '? missing rename for '\$cf_source
2867 cf_target="\$cf_source"
2869 cf_target="\$cf_subdir\${section}/\${cf_target}"
2874 cat >>$cf_edit_man <<CF_EOF
2875 sed -f $cf_man_alias \\
2878 if test -f $MANPAGE_RENAMES ; then
2879 cat >>$cf_edit_man <<CF_EOF
2880 < \$i | sed -f `pwd`/edit_man.sed >\$TMP
2883 cat >>$cf_edit_man <<CF_EOF
2888 cat >>$cf_edit_man <<CF_EOF
2889 if test \$cf_tables = yes ; then
2890 tbl \$TMP >\$TMP.out
2895 if test $with_curses_h != yes ; then
2896 cat >>$cf_edit_man <<CF_EOF
2897 sed -e "/\#[ ]*include/s,curses.h,ncurses.h," < \$TMP >\$TMP.out
2902 cat >>$cf_edit_man <<CF_EOF
2903 if test \$form = format ; then
2904 nroff -man \$TMP >\$TMP.out
2909 if test -n "$cf_compress" ; then
2910 cat >>$cf_edit_man <<CF_EOF
2911 if test \$verb = installing ; then
2912 if ( $cf_compress -f \$TMP )
2914 mv \$TMP.$cf_so_strip \$TMP
2917 cf_target="\$cf_target.$cf_so_strip"
2921 case "$MANPAGE_FORMAT" in #(vi
2923 cat >>$cf_edit_man <<CF_EOF
2924 if test \$form = format ; then
2925 # BSDI installs only .0 suffixes in the cat directories
2926 cf_target="\`echo \$cf_target|sed -e 's/\.[[1-9]]\+[[a-z]]*/.0/'\`"
2932 cat >>$cf_edit_man <<CF_EOF
2933 suffix=\`basename \$cf_target | sed -e 's%^[[^.]]*%%'\`
2934 if test \$verb = installing ; then
2935 echo \$verb \$cf_target
2936 \$INSTALL_DATA \$TMP \$cf_target
2937 test -n "\$aliases" && (
2938 cd \$cf_subdir\${section} && (
2939 cf_source=\`echo \$cf_target |sed -e 's%^.*/\([[^/]][[^/]]*/[[^/]][[^/]]*$\)%\1%'\`
2940 test -n "$cf_so_strip" && cf_source=\`echo \$cf_source |sed -e 's%\.$cf_so_strip\$%%'\`
2941 cf_target=\`basename \$cf_target\`
2942 for cf_alias in \$aliases
2944 if test \$section = 1 ; then
2945 cf_alias=\`echo \$cf_alias|sed "\${transform}"\`
2948 if test "$MANPAGE_SYMLINKS" = yes ; then
2949 if test -f \$cf_alias\${suffix} ; then
2950 if ( cmp -s \$cf_target \$cf_alias\${suffix} )
2955 echo .. \$verb alias \$cf_alias\${suffix}
2956 rm -f \$cf_alias\${suffix}
2957 $LN_S \$cf_target \$cf_alias\${suffix}
2958 elif test "\$cf_target" != "\$cf_alias\${suffix}" ; then
2959 echo ".so \$cf_source" >\$TMP
2961 if test -n "$cf_compress" ; then
2962 cat >>$cf_edit_man <<CF_EOF
2963 if test -n "$cf_so_strip" ; then
2964 $cf_compress -f \$TMP
2965 mv \$TMP.$cf_so_strip \$TMP
2969 cat >>$cf_edit_man <<CF_EOF
2970 echo .. \$verb alias \$cf_alias\${suffix}
2971 rm -f \$cf_alias\${suffix}
2972 \$INSTALL_DATA \$TMP \$cf_alias\${suffix}
2977 elif test \$verb = removing ; then
2978 echo \$verb \$cf_target
2980 test -n "\$aliases" && (
2981 cd \$cf_subdir\${section} && (
2982 for cf_alias in \$aliases
2984 if test \$section = 1 ; then
2985 cf_alias=\`echo \$cf_alias|sed "\${transform}"\`
2988 echo .. \$verb alias \$cf_alias\${suffix}
2989 rm -f \$cf_alias\${suffix}
3001 if test $cf_inboth = yes ; then
3002 if test \$form != format ; then
3003 sh \[$]0 format \$verb \$mandir \$srcdir \[$]*
3009 chmod 755 $cf_edit_man
3012 dnl ---------------------------------------------------------------------------
3013 dnl CF_MATH_LIB version: 5 updated: 2000/05/28 01:39:10
3015 dnl Checks for libraries. At least one UNIX system, Apple Macintosh
3016 dnl Rhapsody 5.5, does not have -lm. We cannot use the simpler
3017 dnl AC_CHECK_LIB(m,sin), because that fails for C++.
3018 AC_DEFUN([CF_MATH_LIB],
3020 AC_CACHE_CHECK(if -lm needed for math functions,
3026 [double x = rand(); printf("result = %g\n", ]ifelse($2,,sin(x),$2)[)],
3027 [cf_cv_need_libm=no],
3028 [cf_cv_need_libm=yes])])
3029 if test "$cf_cv_need_libm" = yes
3036 dnl ---------------------------------------------------------------------------
3037 dnl CF_MIXEDCASE_FILENAMES version: 3 updated: 2003/09/20 17:07:55
3038 dnl ----------------------
3039 dnl Check if the file-system supports mixed-case filenames. If we're able to
3040 dnl create a lowercase name and see it as uppercase, it doesn't support that.
3041 AC_DEFUN([CF_MIXEDCASE_FILENAMES],
3043 AC_CACHE_CHECK(if filesystem supports mixed-case filenames,cf_cv_mixedcase,[
3044 if test "$cross_compiling" = yes ; then
3045 case $target_alias in #(vi
3046 *-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-mingw32*|*-uwin*) #(vi
3054 rm -f conftest CONFTEST
3056 if test -f CONFTEST ; then
3061 rm -f conftest CONFTEST
3064 test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES)
3066 dnl ---------------------------------------------------------------------------
3067 dnl CF_MKSTEMP version: 5 updated: 2006/12/16 12:33:30
3069 dnl Check for a working mkstemp. This creates two files, checks that they are
3070 dnl successfully created and distinct (AmigaOS apparently fails on the last).
3071 AC_DEFUN([CF_MKSTEMP],[
3072 AC_CACHE_CHECK(for working mkstemp, cf_cv_func_mkstemp,[
3075 #include <sys/types.h>
3079 #include <sys/stat.h>
3082 char *tmpl = "conftestXXXXXX";
3090 for (n = 0; n < 2; ++n) {
3091 strcpy(name[n], tmpl);
3092 if ((fd = mkstemp(name[n])) >= 0) {
3093 if (!strcmp(name[n], tmpl)
3094 || stat(name[n], &sb) != 0
3095 || (sb.st_mode & S_IFMT) != S_IFREG
3096 || (sb.st_mode & 077) != 0) {
3103 && !strcmp(name[0], name[1]))
3105 ${cf_cv_main_return:-return}(result);
3107 ],[cf_cv_func_mkstemp=yes
3108 ],[cf_cv_func_mkstemp=no
3109 ],[AC_CHECK_FUNC(mkstemp)
3112 if test "$cf_cv_func_mkstemp" = yes ; then
3113 AC_DEFINE(HAVE_MKSTEMP)
3116 dnl ---------------------------------------------------------------------------
3117 dnl CF_MSG_LOG version: 3 updated: 1997/09/07 14:05:52
3119 dnl Write a debug message to config.log, along with the line number in the
3120 dnl configure script.
3121 AC_DEFUN([CF_MSG_LOG],[
3122 echo "(line __oline__) testing $* ..." 1>&AC_FD_CC
3124 dnl ---------------------------------------------------------------------------
3125 dnl CF_NCURSES_ABI_6 version: 1 updated: 2005/09/17 18:42:49
3126 dnl ----------------
3127 dnl Set ncurses' ABI to 6 unless overridden by explicit configure option, and
3128 dnl warn about this.
3129 AC_DEFUN([CF_NCURSES_ABI_6],[
3130 if test "${with_abi_version+set}" != set; then
3131 case $cf_cv_rel_version in
3133 cf_cv_rel_version=6.0
3135 AC_MSG_WARN(Overriding ABI version to $cf_cv_abi_version)
3140 dnl ---------------------------------------------------------------------------
3141 dnl CF_NO_LEAKS_OPTION version: 4 updated: 2006/12/16 14:24:05
3142 dnl ------------------
3143 dnl see CF_WITH_NO_LEAKS
3144 AC_DEFUN([CF_NO_LEAKS_OPTION],[
3145 AC_MSG_CHECKING(if you want to use $1 for testing)
3148 [AC_DEFINE($3)ifelse([$4],,[
3151 : ${with_cflags:=-g}
3152 : ${with_no_leaks:=yes}
3155 AC_MSG_RESULT(${with_$1:-no})
3157 case .$with_cflags in #(vi
3159 case .$CFLAGS in #(vi
3169 dnl ---------------------------------------------------------------------------
3170 dnl CF_NUMBER_SYNTAX version: 1 updated: 2003/09/20 18:12:49
3171 dnl ----------------
3172 dnl Check if the given variable is a number. If not, report an error.
3173 dnl $1 is the variable
3174 dnl $2 is the message
3175 AC_DEFUN([CF_NUMBER_SYNTAX],[
3176 if test -n "$1" ; then
3181 AC_MSG_ERROR($2 is not a number: $1)
3185 AC_MSG_ERROR($2 value is empty)
3188 dnl ---------------------------------------------------------------------------
3189 dnl CF_OBJ_SUBDIR version: 4 updated: 2002/02/23 20:38:31
3191 dnl Compute the object-directory name from the given model name
3192 AC_DEFUN([CF_OBJ_SUBDIR],
3195 libtool) $2='obj_lo' ;;
3196 normal) $2='objects' ;;
3197 debug) $2='obj_g' ;;
3198 profile) $2='obj_p' ;;
3200 case $cf_cv_system_name in #(vi
3208 dnl ---------------------------------------------------------------------------
3209 dnl CF_PATHSEP version: 3 updated: 2001/01/12 01:23:53
3211 dnl Provide a value for the $PATH and similar separator
3212 AC_DEFUN([CF_PATHSEP],
3214 case $cf_cv_system_name in
3215 os2*) PATHSEP=';' ;;
3218 ifelse($1,,,[$1=$PATHSEP])
3221 dnl ---------------------------------------------------------------------------
3222 dnl CF_PATH_SYNTAX version: 11 updated: 2006/09/02 08:55:46
3224 dnl Check the argument to see that it looks like a pathname. Rewrite it if it
3225 dnl begins with one of the prefix/exec_prefix variables, and then again if the
3226 dnl result begins with 'NONE'. This is necessary to work around autoconf's
3227 dnl delayed evaluation of those symbols.
3228 AC_DEFUN([CF_PATH_SYNTAX],[
3229 if test "x$prefix" != xNONE; then
3230 cf_path_syntax="$prefix"
3232 cf_path_syntax="$ac_default_prefix"
3235 case ".[$]$1" in #(vi
3236 .\[$]\(*\)*|.\'*\'*) #(vi
3240 .[[a-zA-Z]]:[[\\/]]*) #(vi OS/2 EMX
3242 .\[$]{*prefix}*) #(vi
3244 case ".[$]$1" in #(vi
3246 $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%`
3251 $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%`
3254 ifelse($2,,[AC_ERROR([expected a pathname, not \"[$]$1\"])],$2)
3258 dnl ---------------------------------------------------------------------------
3259 dnl CF_POSIX_C_SOURCE version: 6 updated: 2005/07/14 20:25:10
3260 dnl -----------------
3261 dnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed.
3263 dnl POSIX.1-1990 _POSIX_SOURCE
3264 dnl POSIX.1-1990 and _POSIX_SOURCE and
3265 dnl POSIX.2-1992 C-Language _POSIX_C_SOURCE=2
3267 dnl POSIX.1b-1993 _POSIX_C_SOURCE=199309L
3268 dnl POSIX.1c-1996 _POSIX_C_SOURCE=199506L
3269 dnl X/Open 2000 _POSIX_C_SOURCE=200112L
3272 dnl $1 is the nominal value for _POSIX_C_SOURCE
3273 AC_DEFUN([CF_POSIX_C_SOURCE],
3275 cf_POSIX_C_SOURCE=ifelse($1,,199506L,$1)
3277 cf_save_CFLAGS="$CFLAGS"
3278 cf_save_CPPFLAGS="$CPPFLAGS"
3280 CF_REMOVE_DEFINE(cf_trim_CFLAGS,$cf_save_CFLAGS,_POSIX_C_SOURCE)
3281 CF_REMOVE_DEFINE(cf_trim_CPPFLAGS,$cf_save_CPPFLAGS,_POSIX_C_SOURCE)
3283 AC_CACHE_CHECK(if we should define _POSIX_C_SOURCE,cf_cv_posix_c_source,[
3284 CF_MSG_LOG(if the symbol is already defined go no further)
3285 AC_TRY_COMPILE([#include <sys/types.h>],[
3286 #ifndef _POSIX_C_SOURCE
3289 [cf_cv_posix_c_source=no],
3290 [cf_want_posix_source=no
3291 case .$cf_POSIX_C_SOURCE in #(vi
3293 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
3296 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
3297 cf_want_posix_source=yes
3300 cf_want_posix_source=yes
3303 if test "$cf_want_posix_source" = yes ; then
3304 AC_TRY_COMPILE([#include <sys/types.h>],[
3305 #ifdef _POSIX_SOURCE
3308 cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE")
3310 CF_MSG_LOG(ifdef from value $cf_POSIX_C_SOURCE)
3311 CFLAGS="$cf_trim_CFLAGS"
3312 CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source"
3313 CF_MSG_LOG(if the second compile does not leave our definition intact error)
3314 AC_TRY_COMPILE([#include <sys/types.h>],[
3315 #ifndef _POSIX_C_SOURCE
3318 [cf_cv_posix_c_source=no])
3319 CFLAGS="$cf_save_CFLAGS"
3320 CPPFLAGS="$cf_save_CPPFLAGS"
3324 if test "$cf_cv_posix_c_source" != no ; then
3325 CFLAGS="$cf_trim_CFLAGS"
3326 CPPFLAGS="$cf_trim_CPPFLAGS"
3327 if test "$cf_cv_cc_u_d_options" = yes ; then
3328 cf_temp_posix_c_source=`echo "$cf_cv_posix_c_source" | \
3329 sed -e 's/-D/-U/g' -e 's/=[[^ ]]*//g'`
3330 CPPFLAGS="$CPPFLAGS $cf_temp_posix_c_source"
3332 CPPFLAGS="$CPPFLAGS $cf_cv_posix_c_source"
3336 dnl ---------------------------------------------------------------------------
3337 dnl CF_PREDEFINE version: 1 updated: 2003/07/26 17:53:56
3339 dnl Add definitions to CPPFLAGS to ensure they're predefined for all compiles.
3341 dnl $1 = symbol to test
3342 dnl $2 = value (if any) to use for a predefinition
3343 AC_DEFUN([CF_PREDEFINE],
3345 AC_MSG_CHECKING(if we must define $1)
3346 AC_TRY_COMPILE([#include <sys/types.h>
3350 #endif],[cf_result=no],[cf_result=yes])
3351 AC_MSG_RESULT($cf_result)
3353 if test "$cf_result" = yes ; then
3354 CPPFLAGS="$CPPFLAGS ifelse($2,,-D$1,[-D$1=$2])"
3355 elif test "x$2" != "x" ; then
3356 AC_MSG_CHECKING(checking for compatible value versus $2)
3357 AC_TRY_COMPILE([#include <sys/types.h>
3361 #endif],[cf_result=yes],[cf_result=no])
3362 AC_MSG_RESULT($cf_result)
3363 if test "$cf_result" = no ; then
3364 # perhaps we can override it - try...
3365 CPPFLAGS="$CPPFLAGS -D$1=$2"
3369 dnl ---------------------------------------------------------------------------
3370 dnl CF_PRG_RULES version: 1 updated: 2006/06/03 11:45:08
3372 dnl Append definitions and rules for the given programs to the subdirectory
3373 dnl Makefiles, and the recursion rule for the top-level Makefile.
3376 dnl $1 = script to run
3377 dnl $2 = list of subdirectories
3381 AC_DEFUN([CF_PRG_RULES],
3385 if test ! -d $srcdir/$cf_dir; then
3387 elif test -f $srcdir/$cf_dir/programs; then
3388 $AWK -f $1 $srcdir/$cf_dir/programs >>$cf_dir/Makefile
3393 dnl ---------------------------------------------------------------------------
3394 dnl CF_PROG_AWK version: 1 updated: 2006/09/16 11:40:59
3396 dnl Check for awk, ensure that the check found something.
3397 AC_DEFUN([CF_PROG_AWK],
3400 test -z "$AWK" && AC_MSG_ERROR(No awk program found)
3402 dnl ---------------------------------------------------------------------------
3403 dnl CF_PROG_CC_C_O version: 2 updated: 2006/12/16 15:55:46
3405 dnl Analogous to AC_PROG_CC_C_O, but more useful: tests only $CC, ensures that
3406 dnl the output file can be renamed, and allows for a shell variable that can
3407 dnl be used later. The parameter is either CC or CXX. The result is the
3409 dnl $cf_cv_prog_CC_c_o
3410 dnl $cf_cv_prog_CXX_c_o
3411 AC_DEFUN([CF_PROG_CC_C_O],
3412 [AC_REQUIRE([AC_PROG_CC])dnl
3413 AC_MSG_CHECKING([whether [$]$1 understands -c and -o together])
3414 AC_CACHE_VAL(cf_cv_prog_$1_c_o,
3416 cat > conftest.$ac_ext <<CF_EOF
3420 ${cf_cv_main_return:-return}(0);
3423 # We do the test twice because some compilers refuse to overwrite an
3424 # existing .o file with -o, though they will create one.
3425 ac_try='[$]$1 -c conftest.$ac_ext -o conftest2.$ac_objext >&AC_FD_CC'
3426 if AC_TRY_EVAL(ac_try) &&
3427 test -f conftest2.$ac_objext && AC_TRY_EVAL(ac_try);
3429 eval cf_cv_prog_$1_c_o=yes
3431 eval cf_cv_prog_$1_c_o=no
3435 if test $cf_cv_prog_$1_c_o = yes; then
3436 AC_MSG_RESULT([yes])
3441 dnl ---------------------------------------------------------------------------
3442 dnl CF_PROG_CC_U_D version: 1 updated: 2005/07/14 16:59:30
3444 dnl Check if C (preprocessor) -U and -D options are processed in the order
3445 dnl given rather than by type of option. Some compilers insist on apply all
3446 dnl of the -U options after all of the -D options. Others allow mixing them,
3447 dnl and may predefine symbols that conflict with those we define.
3448 AC_DEFUN([CF_PROG_CC_U_D],
3450 AC_CACHE_CHECK(if $CC -U and -D options work together,cf_cv_cc_u_d_options,[
3451 cf_save_CPPFLAGS="$CPPFLAGS"
3452 CPPFLAGS="-UU_D_OPTIONS -DU_D_OPTIONS -DD_U_OPTIONS -UD_U_OPTIONS"
3455 make an undefined-error
3458 make a defined-error
3461 cf_cv_cc_u_d_options=yes],[
3462 cf_cv_cc_u_d_options=no])
3463 CPPFLAGS="$cf_save_CPPFLAGS"
3466 dnl ---------------------------------------------------------------------------
3467 dnl CF_PROG_EGREP version: 1 updated: 2006/09/16 11:40:59
3469 dnl AC_PROG_EGREP was introduced in autoconf 2.53.
3470 dnl This macro adds a check to ensure the script found something.
3471 AC_DEFUN([CF_PROG_EGREP],
3472 [AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep],
3473 [if echo a | (grep -E '(a|b)') >/dev/null 2>&1
3474 then ac_cv_prog_egrep='grep -E'
3475 else ac_cv_prog_egrep='egrep'
3477 EGREP=$ac_cv_prog_egrep
3479 test -z "$EGREP" && AC_MSG_ERROR(No egrep program found)
3481 dnl ---------------------------------------------------------------------------
3482 dnl CF_PROG_EXT version: 10 updated: 2004/01/03 19:28:18
3484 dnl Compute $PROG_EXT, used for non-Unix ports, such as OS/2 EMX.
3485 AC_DEFUN([CF_PROG_EXT],
3487 AC_REQUIRE([CF_CHECK_CACHE])
3488 case $cf_cv_system_name in
3490 CFLAGS="$CFLAGS -Zmt"
3491 CPPFLAGS="$CPPFLAGS -D__ST_MT_ERRNO__"
3492 CXXFLAGS="$CXXFLAGS -Zmt"
3493 # autoconf's macro sets -Zexe and suffix both, which conflict:w
3494 LDFLAGS="$LDFLAGS -Zmt -Zcrtdll"
3504 test -n "$PROG_EXT" && AC_DEFINE_UNQUOTED(PROG_EXT,"$PROG_EXT")
3506 dnl ---------------------------------------------------------------------------
3507 dnl CF_PROG_INSTALL version: 5 updated: 2002/12/21 22:46:07
3509 dnl Force $INSTALL to be an absolute-path. Otherwise, edit_man.sh and the
3510 dnl misc/tabset install won't work properly. Usually this happens only when
3511 dnl using the fallback mkinstalldirs script
3512 AC_DEFUN([CF_PROG_INSTALL],
3518 CF_DIRNAME(cf_dir,$INSTALL)
3519 test -z "$cf_dir" && cf_dir=.
3520 INSTALL=`cd $cf_dir && pwd`/`echo $INSTALL | sed -e 's%^.*/%%'`
3524 dnl ---------------------------------------------------------------------------
3525 dnl CF_PROG_LDCONFIG version: 1 updated: 2003/09/20 17:07:55
3526 dnl ----------------
3527 dnl Check for ldconfig, needed to fixup shared libraries that would be built
3528 dnl and then used in the install.
3529 AC_DEFUN([CF_PROG_LDCONFIG],[
3530 if test "$cross_compiling" = yes ; then
3533 case "$cf_cv_system_name" in #(vi
3535 test -z "$LDCONFIG" && LDCONFIG="/sbin/ldconfig -R"
3537 *) LDPATH=$PATH:/sbin:/usr/sbin
3538 AC_PATH_PROG(LDCONFIG,ldconfig,,$LDPATH)
3544 dnl ---------------------------------------------------------------------------
3545 dnl CF_PROG_LINT version: 1 updated: 2006/09/16 11:40:59
3547 AC_DEFUN([CF_PROG_LINT],
3549 AC_CHECK_PROGS(LINT, tdlint lint alint)
3552 dnl ---------------------------------------------------------------------------
3553 dnl CF_REGEX version: 3 updated: 1997/11/01 14:26:01
3555 dnl Attempt to determine if we've got one of the flavors of regular-expression
3556 dnl code that we can support.
3557 AC_DEFUN([CF_REGEX],
3559 AC_MSG_CHECKING([for regular-expression headers])
3560 AC_CACHE_VAL(cf_cv_regex,[
3561 AC_TRY_LINK([#include <sys/types.h>
3562 #include <regex.h>],[
3564 int x = regcomp(p, "", 0);
3565 int y = regexec(p, "", 0, 0, 0);
3567 ],[cf_cv_regex="regex.h"],[
3568 AC_TRY_LINK([#include <regexp.h>],[
3569 char *p = compile("", "", "", 0);
3570 int x = step("", "");
3571 ],[cf_cv_regex="regexp.h"],[
3572 cf_save_LIBS="$LIBS"
3574 AC_TRY_LINK([#include <regexpr.h>],[
3575 char *p = compile("", "", "");
3576 int x = step("", "");
3577 ],[cf_cv_regex="regexpr.h"],[LIBS="$cf_save_LIBS"])])])
3579 AC_MSG_RESULT($cf_cv_regex)
3580 case $cf_cv_regex in
3581 regex.h) AC_DEFINE(HAVE_REGEX_H_FUNCS) ;;
3582 regexp.h) AC_DEFINE(HAVE_REGEXP_H_FUNCS) ;;
3583 regexpr.h) AC_DEFINE(HAVE_REGEXPR_H_FUNCS) ;;
3586 dnl ---------------------------------------------------------------------------
3587 dnl CF_REMOVE_DEFINE version: 2 updated: 2005/07/09 16:12:18
3588 dnl ----------------
3589 dnl Remove all -U and -D options that refer to the given symbol from a list
3590 dnl of C compiler options. This works around the problem that not all
3591 dnl compilers process -U and -D options from left-to-right, so a -U option
3592 dnl cannot be used to cancel the effect of a preceding -D option.
3594 dnl $1 = target (which could be the same as the source variable)
3595 dnl $2 = source (including '$')
3596 dnl $3 = symbol to remove
3597 define([CF_REMOVE_DEFINE],
3599 # remove $3 symbol from $2
3601 sed -e 's/-[[UD]]$3\(=[[^ ]]*\)\?[[ ]]/ /g' \
3602 -e 's/-[[UD]]$3\(=[[^ ]]*\)\?[$]//g'`
3604 dnl ---------------------------------------------------------------------------
3605 dnl CF_REMOVE_LIB version: 1 updated: 2007/02/17 14:11:52
3607 dnl Remove the given library from the symbol
3609 dnl $1 = target (which could be the same as the source variable)
3610 dnl $2 = source (including '$')
3611 dnl $3 = library to remove
3612 define([CF_REMOVE_LIB],
3614 # remove $3 library from $2
3615 $1=`echo "$2" | sed -e 's/-l$3[[ ]]//g' -e 's/-l$3[$]//'`
3617 dnl ---------------------------------------------------------------------------
3618 dnl CF_SHARED_OPTS version: 43 updated: 2007/02/17 13:35:29
3621 dnl Attempt to determine the appropriate CC/LD options for creating a shared
3624 dnl Note: ${LOCAL_LDFLAGS} is used to link executables that will run within the
3625 dnl build-tree, i.e., by making use of the libraries that are compiled in ../lib
3626 dnl We avoid compiling-in a ../lib path for the shared library since that can
3627 dnl lead to unexpected results at runtime.
3628 dnl ${LOCAL_LDFLAGS2} has the same intention but assumes that the shared libraries
3629 dnl are compiled in ../../lib
3631 dnl The variable 'cf_cv_do_symlinks' is used to control whether we configure
3632 dnl to install symbolic links to the rel/abi versions of shared libraries.
3634 dnl The variable 'cf_cv_shlib_version' controls whether we use the rel or abi
3635 dnl version when making symbolic links.
3637 dnl The variable 'cf_cv_shlib_version_infix' controls whether shared library
3638 dnl version numbers are infix (ex: libncurses.<ver>.dylib) or postfix
3639 dnl (ex: libncurses.so.<ver>).
3641 dnl Some loaders leave 'so_locations' lying around. It's nice to clean up.
3642 AC_DEFUN([CF_SHARED_OPTS],
3644 AC_REQUIRE([CF_SUBST_NCURSES_VERSION])
3648 INSTALL_LIB="-m 644"
3650 cf_cv_do_symlinks=no
3652 AC_MSG_CHECKING(if release/abi version should be used for shared libs)
3653 AC_ARG_WITH(shlib-version,
3654 [ --with-shlib-version=X Specify rel or abi version for shared libs],
3655 [test -z "$withval" && withval=auto
3656 case $withval in #(vi
3658 cf_cv_shlib_version=auto
3660 rel|abi|auto|no) #(vi
3661 cf_cv_shlib_version=$withval
3664 AC_ERROR([option value must be one of: rel, abi, auto or no])
3667 ],[cf_cv_shlib_version=auto])
3668 AC_MSG_RESULT($cf_cv_shlib_version)
3672 # Some less-capable ports of gcc support only -fpic
3674 if test "$GCC" = yes
3676 AC_MSG_CHECKING(which $CC option to use)
3677 cf_save_CFLAGS="$CFLAGS"
3678 for CC_SHARED_OPTS in -fPIC -fpic ''
3680 CFLAGS="$cf_save_CFLAGS $CC_SHARED_OPTS"
3681 AC_TRY_COMPILE([#include <stdio.h>],[int x = 1],[break],[])
3683 AC_MSG_RESULT($CC_SHARED_OPTS)
3684 CFLAGS="$cf_save_CFLAGS"
3687 cf_cv_shlib_version_infix=no
3689 case $cf_cv_system_name in
3691 MK_SHARED_LIB='${CC} ${CFLAGS} -o $[@] -Xlinker -soname=`basename $[@]` -nostart -e 0'
3695 MK_SHARED_LIB='${CC} ${CFLAGS} -shared -Wl,--out-implib=../lib/${IMPORT_LIB} -Wl,--export-all-symbols -o ../lib/${SHARED_LIB}'
3696 cf_cv_shlib_version=cygdll
3697 cf_cv_shlib_version_infix=cygdll
3700 EXTRA_CFLAGS="-no-cpp-precomp"
3701 CC_SHARED_OPTS="-dynamic"
3702 MK_SHARED_LIB='${CC} ${CFLAGS} -dynamiclib -install_name ${libdir}/`basename $[@]` -compatibility_version ${ABI_VERSION} -current_version ${ABI_VERSION} -o $[@]'
3703 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=abi
3704 cf_cv_shlib_version_infix=yes
3705 AC_CACHE_CHECK([if ld -search_paths_first works], cf_cv_ldflags_search_paths_first, [
3706 cf_save_LDFLAGS=$LDFLAGS
3707 LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
3708 AC_TRY_LINK(, [int i;], cf_cv_ldflags_search_paths_first=yes, cf_cv_ldflags_search_paths_first=no)
3709 LDFLAGS=$cf_save_LDFLAGS])
3710 if test $cf_cv_ldflags_search_paths_first = yes; then
3711 LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
3715 # (tested with gcc 2.7.2 -- I don't have c89)
3716 if test "$GCC" = yes; then
3717 LD_SHARED_OPTS='-Xlinker +b -Xlinker ${libdir}'
3720 LD_SHARED_OPTS='-Wl,+b,${libdir}'
3722 MK_SHARED_LIB='${LD} +b ${libdir} -b -o $[@]'
3723 # HP-UX shared libraries must be executable, and should be
3724 # readonly to exploit a quirk in the memory manager.
3725 INSTALL_LIB="-m 555"
3728 if test "$cf_cv_ld_rpath" = yes ; then
3729 if test "$GCC" = yes; then
3730 cf_ld_rpath_opt="-Wl,-rpath,"
3731 EXTRA_LDFLAGS="-Wl,-rpath,\${libdir} $EXTRA_LDFLAGS"
3733 cf_ld_rpath_opt="-rpath "
3734 EXTRA_LDFLAGS="-rpath \${libdir} $EXTRA_LDFLAGS"
3737 # tested with IRIX 5.2 and 'cc'.
3738 if test "$GCC" != yes; then
3739 CC_SHARED_OPTS='-KPIC'
3741 MK_SHARED_LIB='${CC} -shared -rdata_shared -soname `basename $[@]` -o $[@]'
3742 cf_cv_rm_so_locs=yes
3744 linux*|gnu*|k*bsd*-gnu)
3745 if test "$DFT_LWR_MODEL" = "shared" ; then
3746 LOCAL_LDFLAGS="-Wl,-rpath,\$(LOCAL_LIBDIR)"
3747 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
3749 if test "$cf_cv_ld_rpath" = yes ; then
3750 cf_ld_rpath_opt="-Wl,-rpath,"
3751 EXTRA_LDFLAGS="-Wl,-rpath,\${libdir} $EXTRA_LDFLAGS"
3754 MK_SHARED_LIB='${CC} ${CFLAGS} -shared -Wl,-soname,'$cf_shared_soname',-stats,-lc -o $[@]'
3757 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
3758 MK_SHARED_LIB='${LD} -Bshareable -soname,`basename $[@].${ABI_VERSION}` -o $[@]'
3760 openbsd*|freebsd[[12]].*)
3761 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
3762 MK_SHARED_LIB='${LD} -Bshareable -o $[@]'
3763 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
3766 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
3767 if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_ld_rpath" = yes ; then
3768 LOCAL_LDFLAGS="-rpath \$(LOCAL_LIBDIR)"
3769 LOCAL_LDFLAGS2="-rpath \${libdir} $LOCAL_LDFLAGS"
3770 cf_ld_rpath_opt="-rpath "
3771 EXTRA_LDFLAGS="-rpath \${libdir} $EXTRA_LDFLAGS"
3774 MK_SHARED_LIB='${LD} -Bshareable -soname=`basename $[@]` -o $[@]'
3777 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
3778 test "$cf_cv_ld_rpath" = yes && cf_ld_rpath_opt="-Wl,-rpath,"
3779 if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_ld_rpath" = yes ; then
3780 LOCAL_LDFLAGS="-Wl,-rpath,\$(LOCAL_LIBDIR)"
3781 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
3782 EXTRA_LDFLAGS="-Wl,-rpath,\${libdir} $EXTRA_LDFLAGS"
3783 if test "$cf_cv_shlib_version" = auto; then
3784 if test -f /usr/libexec/ld.elf_so; then
3785 cf_cv_shlib_version=abi
3787 cf_cv_shlib_version=rel
3791 MK_SHARED_LIB='${CC} ${CFLAGS} -shared -Wl,-soname,'$cf_shared_soname' -o $[@]'
3793 MK_SHARED_LIB='${LD} -Bshareable -o $[@]'
3797 # tested with OSF/1 V3.2 and 'cc'
3798 # tested with OSF/1 V3.2 and gcc 2.6.3 (but the c++ demo didn't
3799 # link with shared libs).
3800 MK_SHARED_LIB='${LD} -set_version ${REL_VERSION}:${ABI_VERSION} -expect_unresolved "*" -shared -soname `basename $[@]`'
3803 MK_SHARED_LIB="${MK_SHARED_LIB} -msym"
3806 MK_SHARED_LIB="${MK_SHARED_LIB}"' -o $[@]'
3807 if test "$DFT_LWR_MODEL" = "shared" ; then
3808 LOCAL_LDFLAGS="-Wl,-rpath,\$(LOCAL_LIBDIR)"
3809 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
3811 if test "$cf_cv_ld_rpath" = yes ; then
3812 cf_ld_rpath_opt="-rpath"
3813 # EXTRA_LDFLAGS="$LOCAL_LDFLAGS $EXTRA_LDFLAGS"
3815 cf_cv_rm_so_locs=yes
3817 sco3.2v5*) # (also uw2* and UW7) hops 13-Apr-98
3818 # tested with osr5.0.5
3819 if test "$GCC" != yes; then
3820 CC_SHARED_OPTS='-belf -KPIC'
3822 MK_SHARED_LIB='${LD} -dy -G -h `basename $[@] .${REL_VERSION}`.${ABI_VERSION} -o [$]@'
3823 if test "$cf_cv_ld_rpath" = yes ; then
3824 # only way is to set LD_RUN_PATH but no switch for it
3827 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
3828 LINK_PROGS='LD_RUN_PATH=${libdir}'
3829 LINK_TESTS='Pwd=`pwd`;LD_RUN_PATH=`dirname $${Pwd}`/lib'
3832 # tested with SunOS 4.1.1 and gcc 2.7.0
3833 if test "$GCC" != yes; then
3834 CC_SHARED_OPTS='-KPIC'
3836 MK_SHARED_LIB='${LD} -assert pure-text -o $[@]'
3837 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
3840 # tested with SunOS 5.5.1 (solaris 2.5.1) and gcc 2.7.2
3841 if test "$GCC" != yes; then
3842 CC_SHARED_OPTS='-KPIC'
3844 if test "$DFT_LWR_MODEL" = "shared" ; then
3845 LOCAL_LDFLAGS="-R \$(LOCAL_LIBDIR):\${libdir}"
3846 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
3848 if test "$cf_cv_ld_rpath" = yes ; then
3849 cf_ld_rpath_opt="-R"
3850 EXTRA_LDFLAGS="$LOCAL_LDFLAGS $EXTRA_LDFLAGS"
3853 MK_SHARED_LIB='${CC} -dy -G -h '$cf_shared_soname' -o $[@]'
3856 # tested with UnixWare 7.1.0 (gcc 2.95.2 and cc)
3857 if test "$GCC" != yes; then
3858 CC_SHARED_OPTS='-KPIC'
3860 MK_SHARED_LIB='${LD} -d y -G -o [$]@'
3863 CC_SHARED_OPTS='unknown'
3864 MK_SHARED_LIB='echo unknown'
3868 # This works if the last tokens in $MK_SHARED_LIB are the -o target.
3869 case "$cf_cv_shlib_version" in #(vi
3871 case "$MK_SHARED_LIB" in #(vi
3873 test "$cf_cv_do_symlinks" = no && cf_cv_do_symlinks=yes
3876 AC_MSG_WARN(ignored --with-shlib-version)
3882 if test -n "$cf_ld_rpath_opt" ; then
3883 AC_MSG_CHECKING(if we need a space after rpath option)
3884 cf_save_LIBS="$LIBS"
3885 LIBS="$LIBS ${cf_ld_rpath_opt}$libdir"
3886 AC_TRY_LINK(, , cf_rpath_space=no, cf_rpath_space=yes)
3887 LIBS="$cf_save_LIBS"
3888 AC_MSG_RESULT($cf_rpath_space)
3889 test "$cf_rpath_space" = yes && cf_ld_rpath_opt="$cf_ld_rpath_opt "
3890 MK_SHARED_LIB="$MK_SHARED_LIB $cf_ld_rpath_opt\${libdir}"
3893 AC_SUBST(CC_SHARED_OPTS)
3894 AC_SUBST(LD_SHARED_OPTS)
3895 AC_SUBST(MK_SHARED_LIB)
3896 AC_SUBST(LINK_PROGS)
3897 AC_SUBST(LINK_TESTS)
3898 AC_SUBST(EXTRA_LDFLAGS)
3899 AC_SUBST(LOCAL_LDFLAGS)
3900 AC_SUBST(LOCAL_LDFLAGS2)
3901 AC_SUBST(INSTALL_LIB)
3903 dnl ---------------------------------------------------------------------------
3904 dnl CF_SHARED_SONAME version: 2 updated: 2006/10/21 12:33:41
3905 dnl ----------------
3906 dnl utility macro for CF_SHARED_OPTS, constructs "$cf_shared_soname" for
3907 dnl substitution into MK_SHARED_LIB string for the "-soname" (or similar)
3910 dnl $1 is the default that should be used for "$cf_cv_shlib_version".
3911 dnl If missing, use "rel".
3912 define([CF_SHARED_SONAME],
3914 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=ifelse($1,,rel,$1)
3915 if test "$cf_cv_shlib_version" = rel; then
3916 cf_shared_soname='`basename $[@] .${REL_VERSION}`.${ABI_VERSION}'
3918 cf_shared_soname='`basename $[@]`'
3921 dnl ---------------------------------------------------------------------------
3922 dnl CF_SIGWINCH version: 1 updated: 2006/04/02 16:41:09
3924 dnl Use this macro after CF_XOPEN_SOURCE, but do not require it (not all
3925 dnl programs need this test).
3927 dnl This is really a MacOS X 10.4.3 workaround. Defining _POSIX_C_SOURCE
3928 dnl forces SIGWINCH to be undefined (breaks xterm, ncurses). Oddly, the struct
3929 dnl winsize declaration is left alone - we may revisit this if Apple choose to
3930 dnl break that part of the interface as well.
3931 AC_DEFUN([CF_SIGWINCH],
3933 AC_CACHE_CHECK(if SIGWINCH is defined,cf_cv_define_sigwinch,[
3935 #include <sys/types.h>
3936 #include <sys/signal.h>
3937 ],[int x = SIGWINCH],
3938 [cf_cv_define_sigwinch=yes],
3940 #undef _XOPEN_SOURCE
3941 #undef _POSIX_SOURCE
3942 #undef _POSIX_C_SOURCE
3943 #include <sys/types.h>
3944 #include <sys/signal.h>
3945 ],[int x = SIGWINCH],
3946 [cf_cv_define_sigwinch=maybe],
3947 [cf_cv_define_sigwinch=no])
3951 if test "$cf_cv_define_sigwinch" = maybe ; then
3952 AC_CACHE_CHECK(for actual SIGWINCH definition,cf_cv_fixup_sigwinch,[
3953 cf_cv_fixup_sigwinch=unknown
3955 while test $cf_sigwinch != 1
3958 #undef _XOPEN_SOURCE
3959 #undef _POSIX_SOURCE
3960 #undef _POSIX_C_SOURCE
3961 #include <sys/types.h>
3962 #include <sys/signal.h>
3964 #if SIGWINCH != $cf_sigwinch
3968 [cf_cv_fixup_sigwinch=$cf_sigwinch
3971 cf_sigwinch=`expr $cf_sigwinch - 1`
3975 if test "$cf_cv_fixup_sigwinch" != unknown ; then
3976 CPPFLAGS="$CPPFLAGS -DSIGWINCH=$cf_cv_fixup_sigwinch"
3980 dnl ---------------------------------------------------------------------------
3981 dnl CF_SIZECHANGE version: 8 updated: 2000/11/04 12:22:16
3983 dnl Check for definitions & structures needed for window size-changing
3984 dnl FIXME: check that this works with "snake" (HP-UX 10.x)
3985 AC_DEFUN([CF_SIZECHANGE],
3987 AC_REQUIRE([CF_STRUCT_TERMIOS])
3988 AC_CACHE_CHECK(declaration of size-change, cf_cv_sizechange,[
3989 cf_cv_sizechange=unknown
3990 cf_save_CPPFLAGS="$CPPFLAGS"
3992 for cf_opts in "" "NEED_PTEM_H"
3995 CPPFLAGS="$cf_save_CPPFLAGS"
3996 test -n "$cf_opts" && CPPFLAGS="$CPPFLAGS -D$cf_opts"
3997 AC_TRY_COMPILE([#include <sys/types.h>
3998 #ifdef HAVE_TERMIOS_H
3999 #include <termios.h>
4001 #ifdef HAVE_TERMIO_H
4006 /* This is a workaround for SCO: they neglected to define struct winsize in
4007 * termios.h -- it's only in termio.h and ptem.h
4009 #include <sys/stream.h>
4010 #include <sys/ptem.h>
4012 #if !defined(sun) || !defined(HAVE_TERMIOS_H)
4013 #include <sys/ioctl.h>
4017 struct ttysize win; /* FIXME: what system is this? */
4018 int y = win.ts_lines;
4019 int x = win.ts_cols;
4026 no TIOCGSIZE or TIOCGWINSZ
4027 #endif /* TIOCGWINSZ */
4028 #endif /* TIOCGSIZE */
4030 [cf_cv_sizechange=yes],
4031 [cf_cv_sizechange=no])
4033 CPPFLAGS="$cf_save_CPPFLAGS"
4034 if test "$cf_cv_sizechange" = yes ; then
4035 echo "size-change succeeded ($cf_opts)" >&AC_FD_CC
4036 test -n "$cf_opts" && cf_cv_sizechange="$cf_opts"
4041 if test "$cf_cv_sizechange" != no ; then
4042 AC_DEFINE(HAVE_SIZECHANGE)
4043 case $cf_cv_sizechange in #(vi
4045 AC_DEFINE_UNQUOTED($cf_cv_sizechange )
4050 dnl ---------------------------------------------------------------------------
4051 dnl CF_SRC_MODULES version: 18 updated: 2005/05/28 12:58:54
4053 dnl For each parameter, test if the source-directory exists, and if it contains
4054 dnl a 'modules' file. If so, add to the list $cf_cv_src_modules which we'll
4055 dnl use in CF_LIB_RULES.
4057 dnl This uses the configured value to make the lists SRC_SUBDIRS and
4058 dnl SUB_MAKEFILES which are used in the makefile-generation scheme.
4059 AC_DEFUN([CF_SRC_MODULES],
4061 AC_MSG_CHECKING(for src modules)
4063 # dependencies and linker-arguments for test-programs
4064 TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${LIB_NAME}${DFT_DEP_SUFFIX} $TEST_DEPS"
4065 TEST_DEP2="${LIB_2ND}/${LIB_PREFIX}${LIB_NAME}${DFT_DEP_SUFFIX} $TEST_DEP2"
4066 if test "$DFT_LWR_MODEL" = "libtool"; then
4067 TEST_ARGS="${TEST_DEPS}"
4068 TEST_ARG2="${TEST_DEP2}"
4070 TEST_ARGS="-l${LIB_NAME}${DFT_ARG_SUFFIX} $TEST_ARGS"
4071 TEST_ARG2="-l${LIB_NAME}${DFT_ARG_SUFFIX} $TEST_ARG2"
4077 if test -f $srcdir/$cf_dir/modules; then
4079 # We may/may not have tack in the distribution, though the
4081 if test $cf_dir = tack ; then
4082 if test ! -f $srcdir/${cf_dir}/${cf_dir}.h; then
4087 if test -z "$cf_cv_src_modules"; then
4088 cf_cv_src_modules=$cf_dir
4090 cf_cv_src_modules="$cf_cv_src_modules $cf_dir"
4093 # Make the ncurses_cfg.h file record the library interface files as
4094 # well. These are header files that are the same name as their
4095 # directory. Ncurses is the only library that does not follow
4097 if test $cf_dir = tack ; then
4099 elif test -f $srcdir/${cf_dir}/${cf_dir}.h; then
4100 CF_UPPER(cf_have_include,$cf_dir)
4101 AC_DEFINE_UNQUOTED(HAVE_${cf_have_include}_H)
4102 AC_DEFINE_UNQUOTED(HAVE_LIB${cf_have_include})
4103 TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${cf_dir}${DFT_DEP_SUFFIX} $TEST_DEPS"
4104 TEST_DEP2="${LIB_2ND}/${LIB_PREFIX}${cf_dir}${DFT_DEP_SUFFIX} $TEST_DEP2"
4105 if test "$DFT_LWR_MODEL" = "libtool"; then
4106 TEST_ARGS="${TEST_DEPS}"
4107 TEST_ARG2="${TEST_DEP2}"
4109 TEST_ARGS="-l${cf_dir}${DFT_ARG_SUFFIX} $TEST_ARGS"
4110 TEST_ARG2="-l${cf_dir}${DFT_ARG_SUFFIX} $TEST_ARG2"
4115 AC_MSG_RESULT($cf_cv_src_modules)
4117 TEST_ARGS="-L${LIB_DIR} $TEST_ARGS"
4118 TEST_ARG2="-L${LIB_2ND} $TEST_ARG2"
4126 SRC_SUBDIRS="man include"
4127 for cf_dir in $cf_cv_src_modules
4129 SRC_SUBDIRS="$SRC_SUBDIRS $cf_dir"
4131 SRC_SUBDIRS="$SRC_SUBDIRS test"
4132 test -z "$MAKE_TERMINFO" && SRC_SUBDIRS="$SRC_SUBDIRS misc"
4133 test "$cf_with_cxx_binding" != no && SRC_SUBDIRS="$SRC_SUBDIRS c++"
4136 if test "$cf_cv_prog_gnat_correct" = yes && test -f $srcdir/Ada95/Makefile.in; then
4137 SRC_SUBDIRS="$SRC_SUBDIRS Ada95"
4138 ADA_SUBDIRS="gen src samples"
4142 for cf_dir in $SRC_SUBDIRS
4144 SUB_MAKEFILES="$SUB_MAKEFILES $cf_dir/Makefile"
4147 if test -n "$ADA_SUBDIRS"; then
4148 for cf_dir in $ADA_SUBDIRS
4150 SUB_MAKEFILES="$SUB_MAKEFILES Ada95/$cf_dir/Makefile"
4152 AC_SUBST(ADA_SUBDIRS)
4155 dnl ---------------------------------------------------------------------------
4156 dnl CF_STDCPP_LIBRARY version: 5 updated: 2000/08/12 23:18:52
4157 dnl -----------------
4158 dnl Check for -lstdc++, which is GNU's standard C++ library.
4159 AC_DEFUN([CF_STDCPP_LIBRARY],
4161 if test -n "$GXX" ; then
4162 case $cf_cv_system_name in #(vi
4164 cf_stdcpp_libname=stdcpp
4167 cf_stdcpp_libname=stdc++
4170 AC_CACHE_CHECK(for library $cf_stdcpp_libname,cf_cv_libstdcpp,[
4172 LIBS="$LIBS -l$cf_stdcpp_libname"
4174 #include <strstream.h>],[
4176 strstreambuf foo(buf, sizeof(buf))
4178 [cf_cv_libstdcpp=yes],
4179 [cf_cv_libstdcpp=no])
4182 test "$cf_cv_libstdcpp" = yes && CXXLIBS="$CXXLIBS -l$cf_stdcpp_libname"
4185 dnl ---------------------------------------------------------------------------
4186 dnl CF_STRIP_G_OPT version: 3 updated: 2002/12/21 19:25:52
4188 dnl Remove "-g" option from the compiler options
4189 AC_DEFUN([CF_STRIP_G_OPT],
4190 [$1=`echo ${$1} | sed -e 's%-g %%' -e 's%-g$%%'`])dnl
4191 dnl ---------------------------------------------------------------------------
4192 dnl CF_STRUCT_SIGACTION version: 3 updated: 2000/08/12 23:18:52
4193 dnl -------------------
4194 dnl Check if we need _POSIX_SOURCE defined to use struct sigaction. We'll only
4195 dnl do this if we've found the sigaction function.
4197 dnl If needed, define SVR4_ACTION.
4198 AC_DEFUN([CF_STRUCT_SIGACTION],[
4199 if test "$ac_cv_func_sigaction" = yes; then
4200 AC_MSG_CHECKING(whether sigaction needs _POSIX_SOURCE)
4202 #include <sys/types.h>
4203 #include <signal.h>],
4204 [struct sigaction act],
4208 #define _POSIX_SOURCE
4209 #include <sys/types.h>
4210 #include <signal.h>],
4211 [struct sigaction act],
4213 AC_DEFINE(SVR4_ACTION)],
4214 [sigact_bad=unknown])])
4215 AC_MSG_RESULT($sigact_bad)
4218 dnl ---------------------------------------------------------------------------
4219 dnl CF_STRUCT_TERMIOS version: 5 updated: 2000/11/04 12:22:46
4220 dnl -----------------
4221 dnl Some machines require _POSIX_SOURCE to completely define struct termios.
4222 dnl If so, define SVR4_TERMIO
4223 AC_DEFUN([CF_STRUCT_TERMIOS],[
4229 if test "$ISC" = yes ; then
4230 AC_CHECK_HEADERS( sys/termio.h )
4232 if test "$ac_cv_header_termios_h" = yes ; then
4233 case "$CFLAGS $CPPFLAGS" in
4235 termios_bad=dunno ;;
4236 *) termios_bad=maybe ;;
4238 if test "$termios_bad" = maybe ; then
4239 AC_MSG_CHECKING(whether termios.h needs _POSIX_SOURCE)
4240 AC_TRY_COMPILE([#include <termios.h>],
4241 [struct termios foo; int x = foo.c_iflag],
4244 #define _POSIX_SOURCE
4245 #include <termios.h>],
4246 [struct termios foo; int x = foo.c_iflag],
4247 termios_bad=unknown,
4248 termios_bad=yes AC_DEFINE(SVR4_TERMIO))
4250 AC_MSG_RESULT($termios_bad)
4254 dnl ---------------------------------------------------------------------------
4255 dnl CF_SUBST version: 4 updated: 2006/06/17 12:33:03
4257 dnl Shorthand macro for substituting things that the user may override
4258 dnl with an environment variable.
4260 dnl $1 = long/descriptive name
4261 dnl $2 = environment variable
4262 dnl $3 = default value
4263 AC_DEFUN([CF_SUBST],
4264 [AC_CACHE_VAL(cf_cv_subst_$2,[
4265 AC_MSG_CHECKING(for $1 (symbol $2))
4266 CF_SUBST_IF([-z "[$]$2"], [$2], [$3])
4267 cf_cv_subst_$2=[$]$2
4268 AC_MSG_RESULT([$]$2)
4271 dnl ---------------------------------------------------------------------------
4272 dnl CF_SUBST_IF version: 2 updated: 2006/06/17 12:33:03
4274 dnl Shorthand macro for substituting things that the user may override
4275 dnl with an environment variable.
4277 dnl $1 = condition to pass to "test"
4278 dnl $2 = environment variable
4279 dnl $3 = value if the test succeeds
4280 dnl $4 = value if the test fails
4281 AC_DEFUN([CF_SUBST_IF],
4290 dnl ---------------------------------------------------------------------------
4291 dnl CF_SUBST_NCURSES_VERSION version: 8 updated: 2006/09/16 11:40:59
4292 dnl ------------------------
4293 dnl Get the version-number for use in shared-library naming, etc.
4294 AC_DEFUN([CF_SUBST_NCURSES_VERSION],
4296 AC_REQUIRE([CF_PROG_EGREP])
4297 NCURSES_MAJOR="`$ac_cv_prog_egrep '^NCURSES_MAJOR[[ ]]*=' $srcdir/dist.mk | sed -e 's/^[[^0-9]]*//'`"
4298 NCURSES_MINOR="`$ac_cv_prog_egrep '^NCURSES_MINOR[[ ]]*=' $srcdir/dist.mk | sed -e 's/^[[^0-9]]*//'`"
4299 NCURSES_PATCH="`$ac_cv_prog_egrep '^NCURSES_PATCH[[ ]]*=' $srcdir/dist.mk | sed -e 's/^[[^0-9]]*//'`"
4300 cf_cv_abi_version=${NCURSES_MAJOR}
4301 cf_cv_rel_version=${NCURSES_MAJOR}.${NCURSES_MINOR}
4302 dnl Show the computed version, for logging
4303 cf_cv_timestamp=`date`
4304 AC_MSG_RESULT(Configuring NCURSES $cf_cv_rel_version ABI $cf_cv_abi_version ($cf_cv_timestamp))
4305 dnl We need these values in the generated headers
4306 AC_SUBST(NCURSES_MAJOR)
4307 AC_SUBST(NCURSES_MINOR)
4308 AC_SUBST(NCURSES_PATCH)
4309 dnl We need these values in the generated makefiles
4310 AC_SUBST(cf_cv_rel_version)
4311 AC_SUBST(cf_cv_abi_version)
4312 AC_SUBST(cf_cv_builtin_bool)
4313 AC_SUBST(cf_cv_header_stdbool_h)
4314 AC_SUBST(cf_cv_type_of_bool)dnl
4316 dnl ---------------------------------------------------------------------------
4317 dnl CF_SYS_TIME_SELECT version: 4 updated: 2000/10/04 09:18:40
4318 dnl ------------------
4319 dnl Check if we can include <sys/time.h> with <sys/select.h>; this breaks on
4320 dnl older SCO configurations.
4321 AC_DEFUN([CF_SYS_TIME_SELECT],
4323 AC_MSG_CHECKING(if sys/time.h works with sys/select.h)
4324 AC_CACHE_VAL(cf_cv_sys_time_select,[
4326 #include <sys/types.h>
4327 #ifdef HAVE_SYS_TIME_H
4328 #include <sys/time.h>
4330 #ifdef HAVE_SYS_SELECT_H
4331 #include <sys/select.h>
4333 ],[],[cf_cv_sys_time_select=yes],
4334 [cf_cv_sys_time_select=no])
4336 AC_MSG_RESULT($cf_cv_sys_time_select)
4337 test "$cf_cv_sys_time_select" = yes && AC_DEFINE(HAVE_SYS_TIME_SELECT)
4339 dnl ---------------------------------------------------------------------------
4340 dnl CF_TOP_BUILDDIR version: 1 updated: 2006/10/15 16:33:23
4342 dnl Define a top_builddir symbol, for applications that need an absolute path.
4343 AC_DEFUN([CF_TOP_BUILDDIR],
4346 AC_SUBST(top_builddir)
4348 dnl ---------------------------------------------------------------------------
4349 dnl CF_TYPEOF_CHTYPE version: 8 updated: 2006/12/16 12:33:30
4350 dnl ----------------
4351 dnl Determine the type we should use for chtype (and attr_t, which is treated
4352 dnl as the same thing). We want around 32 bits, so on most machines want a
4353 dnl long, but on newer 64-bit machines, probably want an int. If we're using
4354 dnl wide characters, we have to have a type compatible with that, as well.
4355 AC_DEFUN([CF_TYPEOF_CHTYPE],
4357 AC_MSG_CHECKING([for type of chtype])
4358 AC_CACHE_VAL(cf_cv_typeof_chtype,[
4360 #define WANT_BITS 31
4364 FILE *fp = fopen("cf_test.out", "w");
4366 char *result = "long";
4367 if (sizeof(unsigned long) > sizeof(unsigned int)) {
4370 for (n = 0; n < WANT_BITS; n++) {
4373 if (y != 1 || x == 0) {
4379 * If x is nonzero, an int is big enough for the bits
4382 result = (x != 0) ? "int" : "long";
4387 ${cf_cv_main_return:-return}(0);
4390 [cf_cv_typeof_chtype=`cat cf_test.out`],
4391 [cf_cv_typeof_chtype=long],
4392 [cf_cv_typeof_chtype=long])
4395 AC_MSG_RESULT($cf_cv_typeof_chtype)
4397 AC_SUBST(cf_cv_typeof_chtype)
4398 AC_DEFINE_UNQUOTED(TYPEOF_CHTYPE,$cf_cv_typeof_chtype)
4400 dnl ---------------------------------------------------------------------------
4401 dnl CF_TYPE_SIGACTION version: 3 updated: 2000/08/12 23:18:52
4402 dnl -----------------
4404 AC_DEFUN([CF_TYPE_SIGACTION],
4406 AC_MSG_CHECKING([for type sigaction_t])
4407 AC_CACHE_VAL(cf_cv_type_sigaction,[
4409 #include <signal.h>],
4411 [cf_cv_type_sigaction=yes],
4412 [cf_cv_type_sigaction=no])])
4413 AC_MSG_RESULT($cf_cv_type_sigaction)
4414 test "$cf_cv_type_sigaction" = yes && AC_DEFINE(HAVE_TYPE_SIGACTION)
4416 dnl ---------------------------------------------------------------------------
4417 dnl CF_UNSIGNED_LITERALS version: 2 updated: 1998/02/07 22:10:16
4418 dnl --------------------
4419 dnl Test if the compiler supports 'U' and 'L' suffixes. Only old compilers
4420 dnl won't, but they're still there.
4421 AC_DEFUN([CF_UNSIGNED_LITERALS],
4423 AC_MSG_CHECKING([if unsigned literals are legal])
4424 AC_CACHE_VAL(cf_cv_unsigned_literals,[
4425 AC_TRY_COMPILE([],[long x = 1L + 1UL + 1U + 1],
4426 [cf_cv_unsigned_literals=yes],
4427 [cf_cv_unsigned_literals=no])
4429 AC_MSG_RESULT($cf_cv_unsigned_literals)
4431 dnl ---------------------------------------------------------------------------
4432 dnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59
4434 dnl Make an uppercase version of a variable
4435 dnl $1=uppercase($2)
4436 AC_DEFUN([CF_UPPER],
4438 $1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
4440 dnl ---------------------------------------------------------------------------
4441 dnl CF_VERBOSE version: 2 updated: 1997/09/05 10:45:14
4443 dnl Use AC_VERBOSE w/o the warnings
4444 AC_DEFUN([CF_VERBOSE],
4445 [test -n "$verbose" && echo " $1" 1>&AC_FD_MSG
4447 dnl ---------------------------------------------------------------------------
4448 dnl CF_WCHAR_TYPE version: 2 updated: 2004/01/17 19:18:20
4450 dnl Check if type wide-character type $1 is declared, and if so, which header
4451 dnl file is needed. The second parameter is used to set a shell variable when
4452 dnl the type is not found. The first parameter sets a shell variable for the
4454 AC_DEFUN([CF_WCHAR_TYPE],
4456 # This is needed on Tru64 5.0 to declare $1
4457 AC_CACHE_CHECK(if we must include wchar.h to declare $1,cf_cv_$1,[
4462 #ifdef HAVE_LIBUTF8_H
4463 #include <libutf8.h>
4472 #ifdef HAVE_LIBUTF8_H
4473 #include <libutf8.h>
4477 [cf_cv_$1=unknown])])])