1 dnl***************************************************************************
2 dnl Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. *
4 dnl Permission is hereby granted, free of charge, to any person obtaining a *
5 dnl copy of this software and associated documentation files (the *
6 dnl "Software"), to deal in the Software without restriction, including *
7 dnl without limitation the rights to use, copy, modify, merge, publish, *
8 dnl distribute, distribute with modifications, sublicense, and/or sell *
9 dnl copies of the Software, and to permit persons to whom the Software is *
10 dnl furnished to do so, subject to the following conditions: *
12 dnl The above copyright notice and this permission notice shall be included *
13 dnl in all copies or substantial portions of the Software. *
15 dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
16 dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
17 dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
18 dnl IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
19 dnl DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
20 dnl OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
21 dnl THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
23 dnl Except as contained in this notice, the name(s) of the above copyright *
24 dnl holders shall not be used in advertising or otherwise to promote the *
25 dnl sale, use or other dealings in this Software without prior written *
27 dnl***************************************************************************
29 dnl Author: Thomas E. Dickey 1995-on
31 dnl $Id: aclocal.m4,v 1.411 2006/12/31 00:00:26 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_CPP_VSCAN_FUNC version: 5 updated: 2001/12/02 01:39:28
707 dnl -----------------
708 dnl Check if the g++ compiler supports vscan function (not a standard feature).
709 AC_DEFUN([CF_CPP_VSCAN_FUNC],
711 if test -n "$CXX"; then
715 AC_CHECK_HEADERS(strstream.h)
717 AC_CACHE_CHECK(if $CXX supports vscan function,cf_cv_cpp_vscan_func,[
718 for cf_vscan_func in strstream strstream_cast stdio
720 case $cf_vscan_func in #(vi
721 stdio) cf_vscan_defs=USE_STDIO_VSCAN ;; #(vi
722 strstream) cf_vscan_defs=USE_STRSTREAM_VSCAN ;;
723 strstream_cast) cf_vscan_defs=USE_STRSTREAM_VSCAN_CAST ;;
728 #define $cf_vscan_defs 1
729 #if defined(USE_STDIO_VSCAN)
730 #elif defined(HAVE_STRSTREAM_H) && defined(USE_STRSTREAM_VSCAN)
731 #include <strstream.h>
734 int scanw(const char* fmt, ...)
741 #if defined(USE_STDIO_VSCAN)
742 if (::vsscanf(buf, fmt, args) != -1)
744 #elif defined(USE_STRSTREAM_VSCAN)
745 strstreambuf ss(buf, sizeof(buf));
746 if (ss.vscan(fmt, args) != -1)
748 #elif defined(USE_STRSTREAM_VSCAN_CAST)
749 strstreambuf ss(buf, sizeof(buf));
750 if (ss.vscan(fmt, (_IO_va_list)args) != -1)
753 #error case $cf_vscan_func failed
758 ],[int tmp, foo = scanw("%d", &tmp)],
759 [cf_cv_cpp_vscan_func=$cf_vscan_func; break],
760 [cf_cv_cpp_vscan_func=no])
761 test "$cf_cv_cpp_vscan_func" != no && break
768 case $cf_cv_cpp_vscan_func in #(vi
770 AC_DEFINE(CPP_HAS_VSCAN_FUNC)
771 AC_DEFINE(USE_STDIO_VSCAN)
774 AC_DEFINE(CPP_HAS_VSCAN_FUNC)
775 AC_DEFINE(USE_STRSTREAM_VSCAN)
778 AC_DEFINE(CPP_HAS_VSCAN_FUNC)
779 AC_DEFINE(USE_STRSTREAM_VSCAN_CAST)
783 dnl ---------------------------------------------------------------------------
784 dnl CF_DIRNAME version: 4 updated: 2002/12/21 19:25:52
786 dnl "dirname" is not portable, so we fake it with a shell script.
787 AC_DEFUN([CF_DIRNAME],[$1=`echo $2 | sed -e 's%/[[^/]]*$%%'`])dnl
788 dnl ---------------------------------------------------------------------------
789 dnl CF_DIRS_TO_MAKE version: 3 updated: 2002/02/23 20:38:31
791 AC_DEFUN([CF_DIRS_TO_MAKE],
794 for cf_item in $cf_list_models
796 CF_OBJ_SUBDIR($cf_item,cf_subdir)
797 for cf_item2 in $DIRS_TO_MAKE
799 test $cf_item2 = $cf_subdir && break
801 test ".$cf_item2" != ".$cf_subdir" && DIRS_TO_MAKE="$DIRS_TO_MAKE $cf_subdir"
803 for cf_dir in $DIRS_TO_MAKE
805 test ! -d $cf_dir && mkdir $cf_dir
807 AC_SUBST(DIRS_TO_MAKE)
809 dnl ---------------------------------------------------------------------------
810 dnl CF_DISABLE_LEAKS version: 4 updated: 2006/12/16 15:10:42
812 dnl Combine no-leak checks with the libraries or tools that are used for the
814 AC_DEFUN([CF_DISABLE_LEAKS],[
816 AC_REQUIRE([CF_WITH_DMALLOC])
817 AC_REQUIRE([CF_WITH_DBMALLOC])
818 AC_REQUIRE([CF_WITH_VALGRIND])
820 AC_MSG_CHECKING(if you want to perform memory-leak testing)
822 [ --disable-leaks test: free permanent memory, analyze leaks],
824 : ${with_no_leaks:=no})
825 AC_MSG_RESULT($with_no_leaks)
827 if test "$with_no_leaks" = yes ; then
831 dnl ---------------------------------------------------------------------------
832 dnl CF_ERRNO version: 5 updated: 1997/11/30 12:44:39
834 dnl Check if 'errno' is declared in <errno.h>
837 CF_CHECK_ERRNO(errno)
839 dnl ---------------------------------------------------------------------------
840 dnl CF_ETIP_DEFINES version: 3 updated: 2003/03/22 19:13:43
842 dnl Test for conflicting definitions of exception in gcc 2.8.0, etc., between
843 dnl math.h and builtin.h, only for ncurses
844 AC_DEFUN([CF_ETIP_DEFINES],
846 AC_MSG_CHECKING(for special defines needed for etip.h)
847 cf_save_CXXFLAGS="$CXXFLAGS"
849 for cf_math in "" MATH_H
851 for cf_excp in "" MATH_EXCEPTION
853 CXXFLAGS="$cf_save_CXXFLAGS -I${srcdir}/c++ -I${srcdir}/menu -I${srcdir}/include"
854 test -n "$cf_math" && CXXFLAGS="$CXXFLAGS -DETIP_NEEDS_${cf_math}"
855 test -n "$cf_excp" && CXXFLAGS="$CXXFLAGS -DETIP_NEEDS_${cf_excp}"
859 test -n "$cf_math" && AC_DEFINE_UNQUOTED(ETIP_NEEDS_${cf_math})
860 test -n "$cf_excp" && AC_DEFINE_UNQUOTED(ETIP_NEEDS_${cf_excp})
861 cf_result="$cf_math $cf_excp"
866 AC_MSG_RESULT($cf_result)
867 CXXFLAGS="$cf_save_CXXFLAGS"
869 dnl ---------------------------------------------------------------------------
870 dnl CF_FUNC_DLSYM version: 1 updated: 2004/06/16 20:52:45
872 dnl Test for dlsym() and related functions, as well as libdl.
877 AC_DEFUN([CF_FUNC_DLSYM],[
879 AC_CHECK_FUNC(dlsym,cf_have_dlsym=yes,[
882 AC_CHECK_LIB(dl,dlsym,[
884 cf_have_libdl=yes])])
886 if test "$cf_have_dlsym" = yes ; then
887 test "$cf_have_libdl" = yes && LIBS="-ldl $LIBS"
889 AC_MSG_CHECKING(whether able to link to dl*() functions)
890 AC_TRY_LINK([#include <dlfcn.h>],[
892 if ((obj = dlopen("filename", 0)) != 0) {
893 if (dlsym(obj, "symbolname") == 0) {
897 AC_DEFINE(HAVE_LIBDL)],[
898 AC_MSG_ERROR(Cannot link test program for libdl)])
901 AC_MSG_ERROR(Cannot find dlsym function)
904 dnl ---------------------------------------------------------------------------
905 dnl CF_FUNC_MEMMOVE version: 7 updated: 2006/12/16 12:33:30
907 dnl Check for memmove, or a bcopy that can handle overlapping copy. If neither
908 dnl is found, add our own version of memmove to the list of objects.
909 AC_DEFUN([CF_FUNC_MEMMOVE],
911 AC_CHECK_FUNC(memmove,,[
912 AC_CHECK_FUNC(bcopy,[
913 AC_CACHE_CHECK(if bcopy does overlapping moves,cf_cv_good_bcopy,[
916 static char data[] = "abcdefghijklmnopqrstuwwxyz";
918 bcopy(data, temp, sizeof(data));
919 bcopy(temp+10, temp, 15);
920 bcopy(temp+5, temp+15, 10);
921 ${cf_cv_main_return:-return} (strcmp(temp, "klmnopqrstuwwxypqrstuwwxyz"));
924 [cf_cv_good_bcopy=yes],
925 [cf_cv_good_bcopy=no],
926 [cf_cv_good_bcopy=unknown])
928 ],[cf_cv_good_bcopy=no])
929 if test "$cf_cv_good_bcopy" = yes ; then
930 AC_DEFINE(USE_OK_BCOPY)
932 AC_DEFINE(USE_MY_MEMMOVE)
935 dnl ---------------------------------------------------------------------------
936 dnl CF_FUNC_NANOSLEEP version: 3 updated: 2006/12/16 12:33:30
937 dnl -----------------
938 dnl Check for existence of workable nanosleep() function. Some systems, e.g.,
939 dnl AIX 4.x, provide a non-working version.
940 AC_DEFUN([CF_FUNC_NANOSLEEP],[
941 AC_CACHE_CHECK(if nanosleep really works,cf_cv_func_nanosleep,[
947 #ifdef HAVE_SYS_TIME_H
948 #include <sys/time.h>
952 struct timespec ts1, ts2;
955 ts1.tv_nsec = 750000000;
959 code = nanosleep(&ts1, &ts2); /* on failure errno is ENOSYS. */
960 ${cf_cv_main_return:-return}(code != 0);
963 [cf_cv_func_nanosleep=yes],
964 [cf_cv_func_nanosleep=no],
965 [cf_cv_func_nanosleep=unknown])])
967 test "$cf_cv_func_nanosleep" = "yes" && AC_DEFINE(HAVE_NANOSLEEP)
969 dnl ---------------------------------------------------------------------------
970 dnl CF_FUNC_POLL version: 4 updated: 2006/12/16 12:33:30
972 dnl See if the poll function really works. Some platforms have poll(), but
973 dnl it does not work for terminals or files.
974 AC_DEFUN([CF_FUNC_POLL],[
975 AC_CACHE_CHECK(if poll really works,cf_cv_working_poll,[
981 #include <sys/poll.h>
988 myfds.events = POLLIN;
990 ret = poll(&myfds, 1, 100);
991 ${cf_cv_main_return:-return}(ret != 0);
993 [cf_cv_working_poll=yes],
994 [cf_cv_working_poll=no],
995 [cf_cv_working_poll=unknown])])
996 test "$cf_cv_working_poll" = "yes" && AC_DEFINE(HAVE_WORKING_POLL)
998 dnl ---------------------------------------------------------------------------
999 dnl CF_FUNC_TERMIOS version: 2 updated: 2000/07/22 23:37:24
1001 dnl Some old/broken variations define tcgetattr() only as a macro in
1003 AC_DEFUN([CF_FUNC_TERMIOS],[
1004 AC_REQUIRE([CF_STRUCT_TERMIOS])
1005 AC_CACHE_CHECK(for tcgetattr, cf_cv_have_tcgetattr,[
1007 #include <sys/types.h>
1008 #ifdef HAVE_UNISTD_H
1011 #ifdef HAVE_TERMIOS_H
1012 #include <termios.h>
1013 #define TTY struct termios
1015 #ifdef HAVE_TERMIO_H
1017 #define TTY struct termio
1022 tcgetattr(1, &foo);],
1023 [cf_cv_have_tcgetattr=yes],
1024 [cf_cv_have_tcgetattr=no])])
1025 test "$cf_cv_have_tcgetattr" = yes && AC_DEFINE(HAVE_TCGETATTR)
1027 dnl ---------------------------------------------------------------------------
1028 dnl CF_FUNC_VSSCANF version: 3 updated: 2001/12/19 00:50:10
1030 dnl Check for vsscanf() function, which is in c9x but generally not in earlier
1031 dnl versions of C. It is in the GNU C library, and can often be simulated by
1032 dnl other functions.
1033 AC_DEFUN([CF_FUNC_VSSCANF],
1035 AC_CACHE_CHECK(for vsscanf function or workaround,cf_cv_func_vsscanf,[
1038 #include <stdio.h>],[
1040 vsscanf("from", "%d", ap)],[cf_cv_func_vsscanf=vsscanf],[
1043 #include <stdio.h>],[
1047 strbuf._flag = _IOREAD;
1048 strbuf._ptr = strbuf._base = (unsigned char *) str;
1049 strbuf._cnt = strlen(str);
1050 strbuf._file = _NFILE;
1051 return (vfscanf(&strbuf, "%d", ap))],[cf_cv_func_vsscanf=vfscanf],[
1054 #include <stdio.h>],[
1058 strbuf._flag = _IOREAD;
1059 strbuf._ptr = strbuf._base = (unsigned char *) str;
1060 strbuf._cnt = strlen(str);
1061 strbuf._file = _NFILE;
1062 return (_doscan(&strbuf, "%d", ap))],[cf_cv_func_vsscanf=_doscan],[
1063 cf_cv_func_vsscanf=no])])])])
1065 case $cf_cv_func_vsscanf in #(vi
1066 vsscanf) AC_DEFINE(HAVE_VSSCANF);; #(vi
1067 vfscanf) AC_DEFINE(HAVE_VFSCANF);; #(vi
1068 _doscan) AC_DEFINE(HAVE__DOSCAN);;
1072 dnl ---------------------------------------------------------------------------
1073 dnl CF_GCC_ATTRIBUTES version: 10 updated: 2005/05/28 13:16:28
1074 dnl -----------------
1075 dnl Test for availability of useful gcc __attribute__ directives to quiet
1076 dnl compiler warnings. Though useful, not all are supported -- and contrary
1077 dnl to documentation, unrecognized directives cause older compilers to barf.
1078 AC_DEFUN([CF_GCC_ATTRIBUTES],
1080 if test "$GCC" = yes
1082 cat > conftest.i <<EOF
1084 #define GCC_PRINTF 0
1089 #ifndef GCC_NORETURN
1090 #define GCC_NORETURN /* nothing */
1093 #define GCC_UNUSED /* nothing */
1096 if test "$GCC" = yes
1098 AC_CHECKING([for $CC __attribute__ directives])
1099 cat > conftest.$ac_ext <<EOF
1100 #line __oline__ "configure"
1101 #include "confdefs.h"
1102 #include "conftest.h"
1103 #include "conftest.i"
1105 #define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
1107 #define GCC_PRINTFLIKE(fmt,var) /*nothing*/
1110 #define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var)))
1112 #define GCC_SCANFLIKE(fmt,var) /*nothing*/
1114 extern void wow(char *,...) GCC_SCANFLIKE(1,2);
1115 extern void oops(char *,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN;
1116 extern void foo(void) GCC_NORETURN;
1117 int main(int argc GCC_UNUSED, char *argv[[]] GCC_UNUSED) { return 0; }
1119 for cf_attribute in scanf printf unused noreturn
1121 CF_UPPER(cf_ATTRIBUTE,$cf_attribute)
1122 cf_directive="__attribute__(($cf_attribute))"
1123 echo "checking for $CC $cf_directive" 1>&AC_FD_CC
1124 case $cf_attribute in
1126 cat >conftest.h <<EOF
1127 #define GCC_$cf_ATTRIBUTE 1
1131 cat >conftest.h <<EOF
1132 #define GCC_$cf_ATTRIBUTE $cf_directive
1136 if AC_TRY_EVAL(ac_compile); then
1137 test -n "$verbose" && AC_MSG_RESULT(... $cf_attribute)
1138 cat conftest.h >>confdefs.h
1142 fgrep define conftest.i >>confdefs.h
1147 dnl ---------------------------------------------------------------------------
1148 dnl CF_GCC_VERSION version: 4 updated: 2005/08/27 09:53:42
1150 dnl Find version of gcc
1151 AC_DEFUN([CF_GCC_VERSION],[
1152 AC_REQUIRE([AC_PROG_CC])
1154 if test "$GCC" = yes ; then
1155 AC_MSG_CHECKING(version of $CC)
1156 GCC_VERSION="`${CC} --version| sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`"
1157 test -z "$GCC_VERSION" && GCC_VERSION=unknown
1158 AC_MSG_RESULT($GCC_VERSION)
1161 dnl ---------------------------------------------------------------------------
1162 dnl CF_GCC_WARNINGS version: 20 updated: 2005/08/06 18:37:29
1164 dnl Check if the compiler supports useful warning options. There's a few that
1165 dnl we don't use, simply because they're too noisy:
1167 dnl -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x)
1168 dnl -Wredundant-decls (system headers make this too noisy)
1169 dnl -Wtraditional (combines too many unrelated messages, only a few useful)
1170 dnl -Wwrite-strings (too noisy, but should review occasionally). This
1171 dnl is enabled for ncurses using "--enable-const".
1175 dnl $1 is an optional list of gcc warning flags that a particular
1176 dnl application might want to use, e.g., "no-unused" for
1179 dnl If $with_ext_const is "yes", add a check for -Wwrite-strings
1181 AC_DEFUN([CF_GCC_WARNINGS],
1183 AC_REQUIRE([CF_GCC_VERSION])
1184 CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS)
1186 cat > conftest.$ac_ext <<EOF
1187 #line __oline__ "configure"
1188 int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; }
1191 if test "$INTEL_COMPILER" = yes
1193 # The "-wdXXX" options suppress warnings:
1194 # remark #1419: external declaration in primary source file
1195 # remark #1682: implicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
1196 # remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
1197 # remark #1684: conversion from pointer to same-sized integral type (potential portability problem)
1198 # remark #193: zero used for undefined preprocessing identifier
1199 # remark #593: variable "curs_sb_left_arrow" was set but never used
1200 # remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits
1201 # remark #869: parameter "tw" was never referenced
1202 # remark #981: operands are evaluated in unspecified order
1203 # warning #269: invalid format string conversion
1205 AC_CHECKING([for $CC warning options])
1206 cf_save_CFLAGS="$CFLAGS"
1207 EXTRA_CFLAGS="-Wall"
1220 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
1221 if AC_TRY_EVAL(ac_compile); then
1222 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
1223 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
1226 CFLAGS="$cf_save_CFLAGS"
1228 elif test "$GCC" = yes
1230 AC_CHECKING([for $CC warning options])
1231 cf_save_CFLAGS="$CFLAGS"
1232 EXTRA_CFLAGS="-W -Wall"
1234 test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings"
1236 Wbad-function-cast \
1240 Wmissing-declarations \
1241 Wmissing-prototypes \
1245 Wstrict-prototypes \
1246 Wundef $cf_warn_CONST $1
1248 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
1249 if AC_TRY_EVAL(ac_compile); then
1250 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
1251 case $cf_opt in #(vi
1253 CPPFLAGS="$CPPFLAGS -DXTSTRINGDEFINES"
1256 case $GCC_VERSION in
1258 CF_VERBOSE(feature is broken in gcc $GCC_VERSION)
1263 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
1266 CFLAGS="$cf_save_CFLAGS"
1270 AC_SUBST(EXTRA_CFLAGS)
1272 dnl ---------------------------------------------------------------------------
1273 dnl CF_GNAT_TRY_LINK version: 1 updated: 2004/08/21 19:02:08
1274 dnl ----------------
1275 dnl Verify that a test program compiles/links with GNAT.
1276 dnl $cf_ada_make is set to the program that compiles/links
1277 dnl $ADAFLAGS may be set to the GNAT flags.
1279 dnl $1 is the text of the spec
1280 dnl $2 is the text of the body
1281 dnl $3 is the shell command to execute if successful
1282 dnl $4 is the shell command to execute if not successful
1283 AC_DEFUN([CF_GNAT_TRY_LINK],
1286 cat >>conftest.ads <<CF_EOF
1289 cat >>conftest.adb <<CF_EOF
1292 if ( $cf_ada_make $ADAFLAGS conftest 1>&AC_FD_CC 2>&1 ) ; then
1293 ifelse($3,, :,[ $3])
1299 dnl ---------------------------------------------------------------------------
1300 dnl CF_GNAT_TRY_RUN version: 3 updated: 2004/08/21 19:02:08
1302 dnl Verify that a test program compiles and runs with GNAT
1303 dnl $cf_ada_make is set to the program that compiles/links
1304 dnl $ADAFLAGS may be set to the GNAT flags.
1306 dnl $1 is the text of the spec
1307 dnl $2 is the text of the body
1308 dnl $3 is the shell command to execute if successful
1309 dnl $4 is the shell command to execute if not successful
1310 AC_DEFUN([CF_GNAT_TRY_RUN],
1313 cat >>conftest.ads <<CF_EOF
1316 cat >>conftest.adb <<CF_EOF
1319 if ( $cf_ada_make $ADAFLAGS conftest 1>&AC_FD_CC 2>&1 ) ; then
1320 if ( ./conftest 1>&AC_FD_CC 2>&1 ) ; then
1321 ifelse($3,, :,[ $3])
1330 dnl ---------------------------------------------------------------------------
1331 dnl CF_GNAT_VERSION version: 12 updated: 2006/10/14 15:23:15
1333 dnl Verify version of GNAT.
1334 AC_DEFUN([CF_GNAT_VERSION],
1336 AC_MSG_CHECKING(for gnat version)
1337 cf_gnat_version=`${cf_ada_make-gnatmake} -v 2>&1 | grep '[[0-9]].[[0-9]][[0-9]]*' |\
1338 sed -e '2,$d' -e 's/[[^0-9 \.]]//g' -e 's/^[[ ]]*//' -e 's/ .*//'`
1339 AC_MSG_RESULT($cf_gnat_version)
1341 case $cf_gnat_version in
1342 3.1[[1-9]]*|3.[[2-9]]*|[[4-9]].*)
1343 cf_cv_prog_gnat_correct=yes
1345 *) echo Unsupported GNAT version $cf_gnat_version. Required is 3.11 or better. Disabling Ada95 binding.
1346 cf_cv_prog_gnat_correct=no
1349 case $cf_gnat_version in
1350 3.[[1-9]]*|[[4-9]].*)
1351 cf_compile_generics=generics
1352 cf_generic_objects="\${GENOBJS}"
1354 *) cf_compile_generics=
1359 dnl ---------------------------------------------------------------------------
1360 dnl CF_GNU_SOURCE version: 6 updated: 2005/07/09 13:23:07
1362 dnl Check if we must define _GNU_SOURCE to get a reasonable value for
1363 dnl _XOPEN_SOURCE, upon which many POSIX definitions depend. This is a defect
1364 dnl (or misfeature) of glibc2, which breaks portability of many applications,
1365 dnl since it is interwoven with GNU extensions.
1367 dnl Well, yes we could work around it...
1368 AC_DEFUN([CF_GNU_SOURCE],
1370 AC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[
1371 AC_TRY_COMPILE([#include <sys/types.h>],[
1372 #ifndef _XOPEN_SOURCE
1375 [cf_cv_gnu_source=no],
1376 [cf_save="$CPPFLAGS"
1377 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
1378 AC_TRY_COMPILE([#include <sys/types.h>],[
1379 #ifdef _XOPEN_SOURCE
1382 [cf_cv_gnu_source=no],
1383 [cf_cv_gnu_source=yes])
1387 test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
1389 dnl ---------------------------------------------------------------------------
1390 dnl CF_GPP_LIBRARY version: 8 updated: 2003/02/02 01:41:46
1392 dnl If we're trying to use g++, test if libg++ is installed (a rather common
1393 dnl problem :-). If we have the compiler but no library, we'll be able to
1394 dnl configure, but won't be able to build the c++ demo program.
1395 AC_DEFUN([CF_GPP_LIBRARY],
1397 cf_cxx_library=unknown
1398 case $cf_cv_system_name in #(vi
1406 if test "$GXX" = yes; then
1407 AC_MSG_CHECKING([for lib$cf_gpp_libname])
1409 LIBS="$LIBS -l$cf_gpp_libname"
1411 #include <$cf_gpp_libname/builtin.h>
1413 [two_arg_error_handler_t foo2 = lib_error_handler],
1415 CXXLIBS="$CXXLIBS -l$cf_gpp_libname"
1416 if test "$cf_gpp_libname" = cpp ; then
1417 AC_DEFINE(HAVE_GPP_BUILTIN_H)
1419 AC_DEFINE(HAVE_GXX_BUILTIN_H)
1422 #include <builtin.h>
1424 [two_arg_error_handler_t foo2 = lib_error_handler],
1426 CXXLIBS="$CXXLIBS -l$cf_gpp_libname"
1427 AC_DEFINE(HAVE_BUILTIN_H)],
1428 [cf_cxx_library=no])])
1430 AC_MSG_RESULT($cf_cxx_library)
1433 dnl ---------------------------------------------------------------------------
1434 dnl CF_GXX_VERSION version: 5 updated: 2005/08/27 09:53:42
1436 dnl Check for version of g++
1437 AC_DEFUN([CF_GXX_VERSION],[
1438 AC_REQUIRE([AC_PROG_CPP])
1440 if test "$GXX" = yes; then
1441 AC_MSG_CHECKING(version of g++)
1442 GXX_VERSION="`${CXX-g++} --version| sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`"
1443 test -z "$GXX_VERSION" && GXX_VERSION=unknown
1444 AC_MSG_RESULT($GXX_VERSION)
1447 dnl ---------------------------------------------------------------------------
1448 dnl CF_GXX_WARNINGS version: 5 updated: 2005/08/13 14:54:38
1450 dnl Check if the compiler supports useful warning options.
1452 dnl Most of gcc's options apply to g++, except:
1453 dnl -Wbad-function-cast
1454 dnl -Wmissing-declarations
1455 dnl -Wnested-externs
1457 dnl Omit a few (for now):
1461 dnl $1 is an optional list of g++ warning flags that a particular
1462 dnl application might want to use, e.g., "no-unused" for
1465 dnl If $with_ext_const is "yes", add a check for -Wwrite-strings
1467 AC_DEFUN([CF_GXX_WARNINGS],
1470 CF_INTEL_COMPILER(GXX,INTEL_CPLUSPLUS,CXXFLAGS)
1472 AC_REQUIRE([CF_GXX_VERSION])
1477 cat > conftest.$ac_ext <<EOF
1478 #line __oline__ "configure"
1479 int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; }
1482 if test "$INTEL_CPLUSPLUS" = yes
1484 # The "-wdXXX" options suppress warnings:
1485 # remark #1419: external declaration in primary source file
1486 # remark #1682: implicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
1487 # remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
1488 # remark #1684: conversion from pointer to same-sized integral type (potential portability problem)
1489 # remark #193: zero used for undefined preprocessing identifier
1490 # remark #593: variable "curs_sb_left_arrow" was set but never used
1491 # remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits
1492 # remark #869: parameter "tw" was never referenced
1493 # remark #981: operands are evaluated in unspecified order
1494 # warning #269: invalid format string conversion
1496 AC_CHECKING([for $CC warning options])
1497 cf_save_CXXFLAGS="$CXXFLAGS"
1498 EXTRA_CXXFLAGS="-Wall"
1511 CXXFLAGS="$cf_save_CXXFLAGS $EXTRA_CXXFLAGS -$cf_opt"
1512 if AC_TRY_EVAL(ac_compile); then
1513 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
1514 EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS -$cf_opt"
1517 CXXFLAGS="$cf_save_CXXFLAGS"
1519 elif test "$GXX" = yes
1521 AC_CHECKING([for $CXX warning options])
1522 cf_save_CXXFLAGS="$CXXFLAGS"
1523 EXTRA_CXXFLAGS="-W -Wall"
1524 cf_gxx_extra_warnings=""
1525 test "$with_ext_const" = yes && cf_gxx_extra_warnings="Wwrite-strings"
1526 case "$GCC_VERSION" in
1530 cf_gxx_extra_warnings="$cf_gxx_extra_warnings Weffc++"
1536 Woverloaded-virtual \
1542 Wmissing-prototypes \
1545 Wstrict-prototypes \
1546 Wundef $cf_gxx_extra_warnings $1
1548 CXXFLAGS="$cf_save_CXXFLAGS $EXTRA_CXXFLAGS -Werror -$cf_opt"
1549 if AC_TRY_EVAL(ac_compile); then
1550 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
1551 EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS -$cf_opt"
1553 test -n "$verbose" && AC_MSG_RESULT(... no -$cf_opt)
1556 CXXFLAGS="$cf_save_CXXFLAGS"
1561 AC_SUBST(EXTRA_CXXFLAGS)
1563 dnl ---------------------------------------------------------------------------
1564 dnl CF_HASHED_DB version: 1 updated: 2006/08/19 09:16:14
1566 dnl Look for an instance of the Berkeley hashed database.
1567 AC_DEFUN([CF_HASHED_DB],
1569 AC_CHECK_HEADER(db.h,[
1570 CF_HASHED_DB_VERSION
1571 if test "$cf_cv_hashed_db_version" = unknown ; then
1572 AC_MSG_ERROR(Cannot determine version of db)
1575 if test "$cf_cv_hashed_db_libs" = unknown ; then
1576 AC_MSG_ERROR(Cannot determine library for db)
1577 elif test "$cf_cv_hashed_db_libs" != default ; then
1578 LIBS="-l$cf_cv_hashed_db_libs $LIBS"
1582 AC_MSG_ERROR(Cannot find db.h)
1585 dnl ---------------------------------------------------------------------------
1586 dnl CF_HASHED_DB_LIBS version: 6 updated: 2006/12/16 12:33:30
1587 dnl -----------------
1588 dnl Given that we have the header and version for hashed database, find the
1589 dnl library information.
1590 AC_DEFUN([CF_HASHED_DB_LIBS],
1592 AC_CACHE_CHECK(for db libraries, cf_cv_hashed_db_libs,[
1593 cf_cv_hashed_db_libs=unknown
1594 for cf_db_libs in db$cf_cv_hashed_db_version db ''
1596 cf_save_libs="$LIBS"
1597 if test -n "$cf_db_libs"; then
1598 LIBS="-l$cf_db_libs $LIBS"
1600 CF_MSG_LOG(checking for library "$cf_db_libs")
1602 $ac_includes_default
1605 char *path = "/tmp/foo";
1606 #ifdef DB_VERSION_MAJOR
1607 #if DB_VERSION_MAJOR >= 4
1609 db_create(&result, NULL, 0);
1610 result->open(result,
1617 #elif DB_VERSION_MAJOR >= 3
1619 db_create(&result, NULL, 0);
1620 result->open(result,
1626 #elif DB_VERSION_MAJOR >= 2
1635 #endif /* DB_VERSION_MAJOR */
1637 DB *result = dbopen(path,
1643 ${cf_cv_main_return:-return}(result != 0)
1645 if test -n "$cf_db_libs" ; then
1646 cf_cv_hashed_db_libs=$cf_db_libs
1648 cf_cv_hashed_db_libs=default
1650 LIBS="$cf_save_libs"
1653 LIBS="$cf_save_libs"
1657 dnl ---------------------------------------------------------------------------
1658 dnl CF_HASHED_DB_VERSION version: 2 updated: 2006/08/19 15:12:49
1659 dnl --------------------
1660 dnl Given that we have the header file for hashed database, find the version
1662 AC_DEFUN([CF_HASHED_DB_VERSION],
1664 AC_CACHE_CHECK(for version of db, cf_cv_hashed_db_version,[
1665 cf_cv_hashed_db_version=unknown
1667 for cf_db_version in 1 2 3 4
1669 CF_MSG_LOG(checking for db version $cf_db_version)
1671 $ac_includes_default
1674 #ifdef DB_VERSION_MAJOR
1675 /* db2 (DB_VERSION_MAJOR=2) has also DB_VERSION_MINOR, tested with 7 */
1676 #if $cf_db_version == DB_VERSION_MAJOR
1682 #if $cf_db_version == 1
1683 /* ok: assuming this is DB 1.8.5 */
1689 cf_cv_hashed_db_version=$cf_db_version
1695 dnl ---------------------------------------------------------------------------
1696 dnl CF_HELP_MESSAGE version: 3 updated: 1998/01/14 10:56:23
1698 dnl Insert text into the help-message, for readability, from AC_ARG_WITH.
1699 AC_DEFUN([CF_HELP_MESSAGE],
1700 [AC_DIVERT_HELP([$1])dnl
1702 dnl ---------------------------------------------------------------------------
1703 dnl CF_INCLUDE_DIRS version: 5 updated: 2006/10/14 15:23:15
1705 dnl Construct the list of include-options according to whether we're building
1706 dnl in the source directory or using '--srcdir=DIR' option. If we're building
1707 dnl with gcc, don't append the includedir if it happens to be /usr/include,
1708 dnl since that usually breaks gcc's shadow-includes.
1709 AC_DEFUN([CF_INCLUDE_DIRS],
1711 CPPFLAGS="-I. -I../include $CPPFLAGS"
1712 if test "$srcdir" != "."; then
1713 CPPFLAGS="-I\${srcdir}/../include $CPPFLAGS"
1715 if test "$GCC" != yes; then
1716 CPPFLAGS="$CPPFLAGS -I\${includedir}"
1717 elif test "$includedir" != "/usr/include"; then
1718 if test "$includedir" = '${prefix}/include' ; then
1719 if test $prefix != /usr ; then
1720 CPPFLAGS="$CPPFLAGS -I\${includedir}"
1723 CPPFLAGS="$CPPFLAGS -I\${includedir}"
1728 dnl ---------------------------------------------------------------------------
1729 dnl CF_INTEL_COMPILER version: 3 updated: 2005/08/06 18:37:29
1730 dnl -----------------
1731 dnl Check if the given compiler is really the Intel compiler for Linux. It
1732 dnl tries to imitate gcc, but does not return an error when it finds a mismatch
1733 dnl between prototypes, e.g., as exercised by CF_MISSING_CHECK.
1735 dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to
1736 dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from
1737 dnl the wrappers for gcc and g++ warnings.
1739 dnl $1 = GCC (default) or GXX
1740 dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS
1741 dnl $3 = CFLAGS (default) or CXXFLAGS
1742 AC_DEFUN([CF_INTEL_COMPILER],[
1743 ifelse($2,,INTEL_COMPILER,[$2])=no
1745 if test "$ifelse($1,,[$1],GCC)" = yes ; then
1748 AC_MSG_CHECKING(if this is really Intel ifelse($1,GXX,C++,C) compiler)
1749 cf_save_CFLAGS="$ifelse($3,,CFLAGS,[$3])"
1750 ifelse($3,,CFLAGS,[$3])="$ifelse($3,,CFLAGS,[$3]) -no-gcc"
1752 #ifdef __INTEL_COMPILER
1756 ],[ifelse($2,,INTEL_COMPILER,[$2])=yes
1757 cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc"
1759 ifelse($3,,CFLAGS,[$3])="$cf_save_CFLAGS"
1760 AC_MSG_RESULT($ifelse($2,,INTEL_COMPILER,[$2]))
1765 dnl ---------------------------------------------------------------------------
1766 dnl CF_ISASCII version: 3 updated: 2000/08/12 23:18:52
1768 dnl Check if we have either a function or macro for 'isascii()'.
1769 AC_DEFUN([CF_ISASCII],
1771 AC_MSG_CHECKING(for isascii)
1772 AC_CACHE_VAL(cf_cv_have_isascii,[
1773 AC_TRY_LINK([#include <ctype.h>],[int x = isascii(' ')],
1774 [cf_cv_have_isascii=yes],
1775 [cf_cv_have_isascii=no])
1777 AC_MSG_RESULT($cf_cv_have_isascii)
1778 test "$cf_cv_have_isascii" = yes && AC_DEFINE(HAVE_ISASCII)
1780 dnl ---------------------------------------------------------------------------
1781 dnl CF_LARGEFILE version: 6 updated: 2006/09/23 19:07:52
1783 dnl Add checks for large file support.
1784 AC_DEFUN([CF_LARGEFILE],[
1785 ifdef([AC_FUNC_FSEEKO],[
1787 if test "$enable_largefile" != no ; then
1790 # Normally we would collect these definitions in the config.h,
1791 # but (like _XOPEN_SOURCE), some environments rely on having these
1792 # defined before any of the system headers are included. Another
1793 # case comes up with C++, e.g., on AIX the compiler compiles the
1794 # header files by themselves before looking at the body files it is
1795 # told to compile. For ncurses, those header files do not include
1797 test "$ac_cv_sys_large_files" != no && CPPFLAGS="$CPPFLAGS -D_LARGE_FILES "
1798 test "$ac_cv_sys_largefile_source" != no && CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE "
1800 AC_CACHE_CHECK(whether to use struct dirent64, cf_cv_struct_dirent64,[
1802 #include <sys/types.h>
1805 /* if transitional largefile support is setup, this is true */
1806 extern struct dirent64 * readdir(DIR *);
1807 struct dirent64 *x = readdir((DIR *)0);
1808 struct dirent *y = readdir((DIR *)0);
1811 [cf_cv_struct_dirent64=yes],
1812 [cf_cv_struct_dirent64=no])
1814 test "$cf_cv_struct_dirent64" = yes && AC_DEFINE(HAVE_STRUCT_DIRENT64)
1818 dnl ---------------------------------------------------------------------------
1819 dnl CF_LIBUTF8 version: 2 updated: 2002/01/19 22:51:32
1821 dnl Check for libutf8
1822 AC_DEFUN([CF_LIBUTF8],
1824 AC_CACHE_CHECK(for putwc in libutf8,cf_cv_libutf8,[
1825 cf_save_LIBS="$LIBS"
1828 #include <libutf8.h>],[putwc(0,0);],
1829 [cf_cv_libutf8=yes],
1831 LIBS="$cf_save_LIBS"
1834 if test "$cf_cv_libutf8" = yes ; then
1835 AC_DEFINE(HAVE_LIBUTF8_H)
1839 dnl ---------------------------------------------------------------------------
1840 dnl CF_LIB_PREFIX version: 7 updated: 2001/01/12 01:23:48
1842 dnl Compute the library-prefix for the given host system
1843 dnl $1 = variable to set
1844 AC_DEFUN([CF_LIB_PREFIX],
1846 case $cf_cv_system_name in
1847 OS/2*) LIB_PREFIX='' ;;
1848 os2*) LIB_PREFIX='' ;;
1849 *) LIB_PREFIX='lib' ;;
1851 ifelse($1,,,[$1=$LIB_PREFIX])
1852 AC_SUBST(LIB_PREFIX)
1854 dnl ---------------------------------------------------------------------------
1855 dnl CF_LIB_RULES version: 41 updated: 2006/12/23 18:04:51
1857 dnl Append definitions and rules for the given models to the subdirectory
1858 dnl Makefiles, and the recursion rule for the top-level Makefile. If the
1859 dnl subdirectory is a library-source directory, modify the LIBRARIES list in
1860 dnl the corresponding makefile to list the models that we'll generate.
1862 dnl For shared libraries, make a list of symbolic links to construct when
1863 dnl generating each library. The convention used for Linux is the simplest
1866 dnl lib<name>.so.<major> ->
1867 dnl lib<name>.so.<maj>.<minor>
1868 AC_DEFUN([CF_LIB_RULES],
1870 CF_LIB_PREFIX(cf_prefix)
1871 AC_REQUIRE([CF_SUBST_NCURSES_VERSION])
1872 for cf_dir in $SRC_SUBDIRS
1874 if test ! -d $srcdir/$cf_dir ; then
1876 elif test -f $srcdir/$cf_dir/modules; then
1881 for cf_item in $cf_LIST_MODELS
1883 CF_LIB_SUFFIX($cf_item,cf_suffix)
1884 if test $cf_item = shared ; then
1885 if test "$cf_cv_do_symlinks" = yes ; then
1886 case "$cf_cv_shlib_version" in #(vi
1888 case "$cf_cv_system_name" in #(vi
1890 case .${LIB_SUFFIX} in
1892 cf_suffix=`echo $cf_suffix | sed 's/^w//'`
1893 cf_suffix=w'.${REL_VERSION}'"$cf_suffix"
1896 cf_suffix='.${REL_VERSION}'"$cf_suffix"
1900 *) cf_suffix="$cf_suffix"'.${REL_VERSION}' ;;
1904 case "$cf_cv_system_name" in #(vi
1906 case .${LIB_SUFFIX} in
1908 cf_suffix=`echo $cf_suffix | sed 's/^w//'`
1909 cf_suffix=w'.${ABI_VERSION}'"$cf_suffix"
1912 cf_suffix='.${ABI_VERSION}'"$cf_suffix"
1916 *) cf_suffix="$cf_suffix"'.${ABI_VERSION}' ;;
1921 # cygwin needs import library, and has unique naming convention
1922 # use autodetected ${cf_prefix} for import lib and static lib, but
1923 # use 'cyg' prefix for shared lib.
1924 if test $cf_cv_shlib_version = cygdll ; then
1925 SHARED_LIB="cyg${cf_dir}\${ABI_VERSION}.dll"
1926 IMPORT_LIB="${cf_prefix}${cf_dir}.dll.a"
1927 LIBS_TO_MAKE="$LIBS_TO_MAKE ../lib/\${SHARED_LIB} ../lib/\${IMPORT_LIB}"
1931 LIBS_TO_MAKE="$LIBS_TO_MAKE ../lib/${cf_prefix}${cf_dir}${cf_suffix}"
1934 if test $cf_dir = ncurses ; then
1935 cf_subsets="$LIB_SUBSETS"
1936 cf_termlib=`echo "$cf_subsets" |sed -e 's/ .*$//'`
1937 if test "$cf_termlib" != "$cf_subsets" ; then
1938 cf_item=`echo $LIBS_TO_MAKE |sed -e s%${LIB_NAME}${LIB_SUFFIX}%${TINFO_LIB_SUFFIX}%g`
1939 LIBS_TO_MAKE="$cf_item $LIBS_TO_MAKE"
1942 cf_subsets=`echo "$LIB_SUBSETS" | sed -e 's/^termlib.* //'`
1945 sed -e "s%@LIBS_TO_MAKE@%$LIBS_TO_MAKE%" \
1946 -e "s%@IMPORT_LIB@%$IMPORT_LIB%" \
1947 -e "s%@SHARED_LIB@%$SHARED_LIB%" \
1948 $cf_dir/Makefile >$cf_dir/Makefile.out
1949 mv $cf_dir/Makefile.out $cf_dir/Makefile
1951 $AWK -f $srcdir/mk-0th.awk \
1952 libname="${cf_dir}${LIB_SUFFIX}" subsets="$LIB_SUBSETS" \
1953 $srcdir/$cf_dir/modules >>$cf_dir/Makefile
1955 for cf_subset in $cf_subsets
1958 for cf_item in $cf_LIST_MODELS
1960 echo "Appending rules for ${cf_item} model (${cf_dir}: ${cf_subset})"
1961 CF_UPPER(cf_ITEM,$cf_item)
1962 CF_LIB_SUFFIX($cf_item,cf_suffix)
1963 CF_OBJ_SUBDIR($cf_item,cf_subdir)
1965 # Test for case where we build libtinfo with a different name.
1967 if test $cf_dir = ncurses ; then
1972 cf_libname=$TINFO_LIB_SUFFIX
1973 if test -n "${DFT_ARG_SUFFIX}" ; then
1974 # undo $LIB_SUFFIX add-on in CF_LIB_SUFFIX
1975 cf_suffix=`echo $cf_suffix |sed -e "s%^${LIB_SUFFIX}%%"`
1981 # These dependencies really are for development, not
1982 # builds, but they are useful in porting, too.
1983 cf_depend="../include/ncurses_cfg.h"
1984 if test "$srcdir" = "."; then
1987 cf_reldir="\${srcdir}"
1990 if test -f $srcdir/$cf_dir/$cf_dir.priv.h; then
1991 cf_depend="$cf_depend $cf_reldir/$cf_dir.priv.h"
1992 elif test -f $srcdir/$cf_dir/curses.priv.h; then
1993 cf_depend="$cf_depend $cf_reldir/curses.priv.h"
1997 old_cf_suffix="$cf_suffix"
1998 if test "$cf_cv_shlib_version_infix" = yes ; then
1999 if test -n "$LIB_SUFFIX" ; then
2002 cf_libname=`echo $cf_libname | sed 's/w$//'`
2003 cf_suffix=`echo $cf_suffix | sed 's/^w//'`
2010 $AWK -f $srcdir/mk-1st.awk \
2011 name=${cf_libname}${cf_dir_suffix} \
2012 traces=$LIB_TRACING \
2018 ShlibVer=$cf_cv_shlib_version \
2019 ShlibVerInfix=$cf_cv_shlib_version_infix \
2020 DoLinks=$cf_cv_do_symlinks \
2021 rmSoLocs=$cf_cv_rm_so_locs \
2022 ldconfig="$LDCONFIG" \
2023 overwrite=$WITH_OVERWRITE \
2024 depend="$cf_depend" \
2026 $srcdir/$cf_dir/modules >>$cf_dir/Makefile
2028 cf_suffix="$old_cf_suffix"
2030 for cf_subdir2 in $cf_subdirs lib
2032 test $cf_subdir = $cf_subdir2 && break
2034 test "${cf_subset}.${cf_subdir2}" != "${cf_subset}.${cf_subdir}" && \
2035 $AWK -f $srcdir/mk-2nd.awk \
2037 traces=$LIB_TRACING \
2043 crenames=$cf_cv_prog_CC_c_o \
2044 cxxrenames=$cf_cv_prog_CXX_c_o \
2045 $srcdir/$cf_dir/modules >>$cf_dir/Makefile
2046 cf_subdirs="$cf_subdirs $cf_subdir"
2051 echo ' cd '$cf_dir' && ${MAKE} ${CF_MFLAGS} [$]@' >>Makefile
2054 for cf_dir in $SRC_SUBDIRS
2056 if test ! -d $srcdir/$cf_dir ; then
2060 if test -f $cf_dir/Makefile ; then
2063 echo 'libs \' >> Makefile
2064 echo 'install.libs \' >> Makefile
2065 echo 'uninstall.libs ::' >> Makefile
2066 echo ' cd '$cf_dir' && ${MAKE} ${CF_MFLAGS} [$]@' >> Makefile
2071 if test -f $srcdir/$cf_dir/modules; then
2073 if test -f $srcdir/$cf_dir/headers; then
2074 cat >> Makefile <<CF_EOF
2076 uninstall.includes \\
2079 if test "$cf_dir" != "c++" ; then
2080 echo 'lint \' >> Makefile
2082 cat >> Makefile <<CF_EOF
2088 uninstall.$cf_dir ::
2089 cd $cf_dir && \${MAKE} \${CF_MFLAGS} \[$]@
2091 elif test -f $srcdir/$cf_dir/headers; then
2092 cat >> Makefile <<CF_EOF
2098 uninstall.includes ::
2099 cd $cf_dir && \${MAKE} \${CF_MFLAGS} \[$]@
2104 cat >> Makefile <<CF_EOF
2106 install.libs uninstall.libs \\
2107 install.data uninstall.data ::
2108 $MAKE_TERMINFO cd misc && \${MAKE} \${CF_MFLAGS} \[$]@
2112 cd man && \${MAKE} \${CF_MFLAGS} \[$]@
2115 rm -f config.cache config.log config.status Makefile include/ncurses_cfg.h
2116 rm -f headers.sh headers.sed
2117 rm -rf \${DIRS_TO_MAKE}
2120 # Special case: tack's manpage lives in its own directory.
2121 if test -d tack ; then
2122 if test -f $srcdir/$tack.h; then
2123 cat >> Makefile <<CF_EOF
2127 cd tack && \${MAKE} \${CF_MFLAGS} \[$]@
2132 dnl If we're installing into a subdirectory of /usr/include, etc., we should
2133 dnl prepend the subdirectory's name to the "#include" paths. It won't hurt
2134 dnl anything, and will make it more standardized. It's awkward to decide this
2135 dnl at configuration because of quoting, so we'll simply make all headers
2136 dnl installed via a script that can do the right thing.
2138 rm -f headers.sed headers.sh
2140 dnl ( generating this script makes the makefiles a little tidier :-)
2141 echo creating headers.sh
2142 cat >headers.sh <<CF_EOF
2144 # This shell script is generated by the 'configure' script. It is invoked in a
2145 # subdirectory of the build tree. It generates a sed-script in the parent
2146 # directory that is used to adjust includes for header files that reside in a
2147 # subdirectory of /usr/include, etc.
2149 while test \[$]# != 3
2151 PRG="\$PRG \[$]1"; shift
2156 TMPSRC=\${TMPDIR-/tmp}/\`basename \$SRC\`\$\$
2157 TMPSED=\${TMPDIR-/tmp}/headers.sed\$\$
2158 echo installing \$SRC in \$DST
2161 if test $WITH_CURSES_H = yes; then
2162 cat >>headers.sh <<CF_EOF
2165 END=\`basename \$DST\`
2166 for i in \`cat \$REF/../*/headers |fgrep -v "#"\`
2168 NAME=\`basename \$i\`
2169 echo "s/<\$NAME>/<\$END\/\$NAME>/" >> \$TMPSED
2179 cat >>headers.sh <<CF_EOF
2182 END=\`basename \$DST\`
2183 for i in \`cat \$REF/../*/headers |fgrep -v "#"\`
2185 NAME=\`basename \$i\`
2186 if test "\$NAME" = "curses.h"
2188 echo "s/<curses.h>/<ncurses.h>/" >> \$TMPSED
2191 echo "s/<\$NAME>/<\$END\/\$NAME>/" >> \$TMPSED
2195 echo "s/<curses.h>/<ncurses.h>/" >> \$TMPSED
2200 cat >>headers.sh <<CF_EOF
2202 sed -f \$TMPSED \$SRC > \$TMPSRC
2203 NAME=\`basename \$SRC\`
2205 if test $WITH_CURSES_H != yes; then
2206 cat >>headers.sh <<CF_EOF
2207 test "\$NAME" = "curses.h" && NAME=ncurses.h
2210 cat >>headers.sh <<CF_EOF
2211 # Just in case someone gzip'd manpages, remove the conflicting copy.
2212 test -f \$DST/\$NAME.gz && rm -f \$DST/\$NAME.gz
2214 eval \$PRG \$TMPSRC \$DST/\$NAME
2215 rm -f \$TMPSRC \$TMPSED
2218 chmod 0755 headers.sh
2220 for cf_dir in $SRC_SUBDIRS
2222 if test ! -d $srcdir/$cf_dir ; then
2226 if test -f $srcdir/$cf_dir/headers; then
2227 cat >>$cf_dir/Makefile <<CF_EOF
2228 \${DESTDIR}\${includedir} :
2229 sh \${srcdir}/../mkinstalldirs \[$]@
2233 install.includes :: \${AUTO_SRC} \${DESTDIR}\${includedir} \\
2236 for i in `cat $srcdir/$cf_dir/headers |fgrep -v "#"`
2238 test -n "$j" && echo " $j \\" >>$cf_dir/Makefile
2242 echo " $j" >>$cf_dir/Makefile
2244 for i in `cat $srcdir/$cf_dir/headers |fgrep -v "#"`
2246 echo " @ (cd \${DESTDIR}\${includedir} && rm -f `basename $i`) ; ../headers.sh \${INSTALL_DATA} \${DESTDIR}\${includedir} \${srcdir} $i" >>$cf_dir/Makefile
2247 test $i = curses.h && test $WITH_CURSES_H = yes && echo " @ (cd \${DESTDIR}\${includedir} && rm -f ncurses.h && \${LN_S} curses.h ncurses.h)" >>$cf_dir/Makefile
2250 cat >>$cf_dir/Makefile <<CF_EOF
2254 uninstall.includes ::
2256 for i in `cat $srcdir/$cf_dir/headers |fgrep -v "#"`
2259 echo " -@ (cd \${DESTDIR}\${includedir} && rm -f $i)" >>$cf_dir/Makefile
2260 test $i = curses.h && echo " -@ (cd \${DESTDIR}\${includedir} && rm -f ncurses.h)" >>$cf_dir/Makefile
2264 if test -f $srcdir/$cf_dir/modules; then
2265 if test "$cf_dir" != "c++" ; then
2266 cat >>$cf_dir/Makefile <<"CF_EOF"
2267 depend : ${AUTO_SRC}
2268 makedepend -- ${CPPFLAGS} -- ${C_SRC}
2270 # DO NOT DELETE THIS LINE -- make depend depends on it.
2277 dnl ---------------------------------------------------------------------------
2278 dnl CF_LIB_SONAME version: 3 updated: 2006/12/16 15:55:46
2280 dnl Find the and soname for the given shared library. Set the cache variable
2281 dnl cf_cv_$3_soname to this, unless it is not found. Then set the cache
2282 dnl variable to "unknown".
2286 dnl $3 = library name
2287 AC_DEFUN([CF_LIB_SONAME],
2289 AC_CACHE_CHECK(for soname of $3 library,cf_cv_$3_soname,[
2291 cf_cv_$3_soname=unknown
2292 if test "$cross_compiling" != yes ; then
2293 cat >conftest.$ac_ext <<CF_EOF
2298 ${cf_cv_main_return:-return}(0);
2301 cf_save_LIBS="$LIBS"
2303 if AC_TRY_EVAL(ac_compile) ; then
2304 if AC_TRY_EVAL(ac_link) ; then
2305 cf_cv_$3_soname=`ldd conftest$ac_exeext 2>/dev/null | sed -e 's,^.*/,,' -e 's, .*$,,' | fgrep lib$3.`
2306 test -z "$cf_cv_$3_soname" && cf_cv_$3_soname=unknown
2310 LIBS="$cf_save_LIBS"
2314 dnl ---------------------------------------------------------------------------
2315 dnl CF_LIB_SUFFIX version: 13 updated: 2003/11/01 16:09:07
2317 dnl Compute the library file-suffix from the given model name
2319 dnl $2 = variable to set
2320 dnl The variable $LIB_SUFFIX, if set, prepends the variable to set.
2321 AC_DEFUN([CF_LIB_SUFFIX],
2323 AC_REQUIRE([CF_SUBST_NCURSES_VERSION])
2325 libtool) $2='.la' ;;
2328 profile) $2='_p.a' ;;
2330 case $cf_cv_system_name in
2331 cygwin*) $2='.dll' ;;
2332 darwin*) $2='.dylib' ;;
2342 test -n "$LIB_SUFFIX" && $2="${LIB_SUFFIX}[$]{$2}"
2344 dnl ---------------------------------------------------------------------------
2345 dnl CF_LIB_TYPE version: 4 updated: 2000/10/20 22:57:49
2347 dnl Compute the string to append to -library from the given model name
2349 dnl $2 = variable to set
2350 dnl The variable $LIB_SUFFIX, if set, prepends the variable to set.
2351 AC_DEFUN([CF_LIB_TYPE],
2360 test -n "$LIB_SUFFIX" && $2="${LIB_SUFFIX}[$]{$2}"
2362 dnl ---------------------------------------------------------------------------
2363 dnl CF_LINK_DATAONLY version: 8 updated: 2006/12/16 12:33:30
2364 dnl ----------------
2365 dnl Some systems have a non-ANSI linker that doesn't pull in modules that have
2366 dnl only data (i.e., no functions), for example NeXT. On those systems we'll
2367 dnl have to provide wrappers for global tables to ensure they're linked
2369 AC_DEFUN([CF_LINK_DATAONLY],
2371 AC_MSG_CHECKING([if data-only library module links])
2372 AC_CACHE_VAL(cf_cv_link_dataonly,[
2374 cat >conftest.$ac_ext <<EOF
2375 #line __oline__ "configure"
2376 int testdata[[3]] = { 123, 456, 789 };
2378 if AC_TRY_EVAL(ac_compile) ; then
2379 mv conftest.o data.o && \
2380 ( $AR $AR_OPTS conftest.a data.o ) 2>&AC_FD_CC 1>/dev/null
2382 rm -f conftest.$ac_ext data.o
2383 cat >conftest.$ac_ext <<EOF
2384 #line __oline__ "configure"
2388 ${cf_cv_main_return:-return}(1); /* I'm told this linker is broken */
2390 extern int testdata[[3]];
2391 return testdata[[0]] == 123
2392 && testdata[[1]] == 456
2393 && testdata[[2]] == 789;
2397 if AC_TRY_EVAL(ac_compile); then
2398 mv conftest.o func.o && \
2399 ( $AR $AR_OPTS conftest.a func.o ) 2>&AC_FD_CC 1>/dev/null
2401 rm -f conftest.$ac_ext func.o
2402 ( eval $RANLIB conftest.a ) 2>&AC_FD_CC >/dev/null
2404 LIBS="conftest.a $LIBS"
2408 extern int testfunc();
2409 ${cf_cv_main_return:-return} (!testfunc());
2412 [cf_cv_link_dataonly=yes],
2413 [cf_cv_link_dataonly=no],
2414 [cf_cv_link_dataonly=unknown])
2417 AC_MSG_RESULT($cf_cv_link_dataonly)
2419 if test "$cf_cv_link_dataonly" = no ; then
2420 AC_DEFINE(BROKEN_LINKER)
2425 dnl ---------------------------------------------------------------------------
2426 dnl CF_LINK_FUNCS version: 7 updated: 2006/12/16 12:33:30
2428 dnl Most Unix systems have both link and symlink, a few don't have symlink.
2429 dnl A few non-Unix systems implement symlink, but not link.
2430 dnl A few non-systems implement neither (or have nonfunctional versions).
2431 AC_DEFUN([CF_LINK_FUNCS],
2437 if test "$cross_compiling" = yes ; then
2442 AC_CACHE_CHECK(if link/symlink functions work,cf_cv_link_funcs,[
2444 for cf_func in link symlink ; do
2446 #include <sys/types.h>
2447 #include <sys/stat.h>
2448 #ifdef HAVE_UNISTD_H
2454 char *src = "config.log";
2455 char *dst = "conftest.chk";
2460 fail = ($cf_func("config.log", "conftest.chk") < 0)
2461 || (stat(dst, &dst_sb) < 0)
2462 || (dst_sb.st_mtime != src_sb.st_mtime);
2468 ${cf_cv_main_return:-return} (fail);
2471 cf_cv_link_funcs="$cf_cv_link_funcs $cf_func"
2472 eval 'ac_cv_func_'$cf_func'=yes'],[
2473 eval 'ac_cv_func_'$cf_func'=no'],[
2474 eval 'ac_cv_func_'$cf_func'=error'])
2476 test -z "$cf_cv_link_funcs" && cf_cv_link_funcs=no
2478 test "$ac_cv_func_link" = yes && AC_DEFINE(HAVE_LINK)
2479 test "$ac_cv_func_symlink" = yes && AC_DEFINE(HAVE_SYMLINK)
2482 dnl ---------------------------------------------------------------------------
2483 dnl CF_MAIN_RETURN version: 1 updated: 2006/12/10 09:51:54
2485 dnl Check if a return from main to the shell actually returns the same exit
2486 dnl code. This is true for almost any POSIX environment.
2488 dnl Some very old environments did not flush stdout, etc., on an exit. That
2489 dnl would be a useful case to test for also.
2490 AC_DEFUN([CF_MAIN_RETURN],
2492 cf_cv_main_return=return
2494 dnl ---------------------------------------------------------------------------
2495 dnl CF_MAKEFLAGS version: 12 updated: 2006/10/21 08:27:03
2497 dnl Some 'make' programs support ${MAKEFLAGS}, some ${MFLAGS}, to pass 'make'
2498 dnl options to lower-levels. It's very useful for "make -n" -- if we have it.
2499 dnl (GNU 'make' does both, something POSIX 'make', which happens to make the
2500 dnl ${MAKEFLAGS} variable incompatible because it adds the assignments :-)
2501 AC_DEFUN([CF_MAKEFLAGS],
2503 AC_CACHE_CHECK(for makeflags variable, cf_cv_makeflags,[
2505 for cf_option in '-${MAKEFLAGS}' '${MFLAGS}'
2507 cat >cf_makeflags.tmp <<CF_EOF
2510 @ echo '.$cf_option'
2512 cf_result=`${MAKE-make} -k -f cf_makeflags.tmp 2>/dev/null | sed -e 's,[[ ]]*$,,'`
2513 case "$cf_result" in
2515 cf_result=`${MAKE-make} -k -f cf_makeflags.tmp CC=cc 2>/dev/null`
2516 case "$cf_result" in
2517 .*CC=*) cf_cv_makeflags=
2519 *) cf_cv_makeflags=$cf_option
2525 *) echo "given option \"$cf_option\", no match \"$cf_result\""
2529 rm -f cf_makeflags.tmp
2532 AC_SUBST(cf_cv_makeflags)
2534 dnl ---------------------------------------------------------------------------
2535 dnl CF_MAKE_TAGS version: 2 updated: 2000/10/04 09:18:40
2537 dnl Generate tags/TAGS targets for makefiles. Do not generate TAGS if we have
2538 dnl a monocase filesystem.
2539 AC_DEFUN([CF_MAKE_TAGS],[
2540 AC_REQUIRE([CF_MIXEDCASE_FILENAMES])
2541 AC_CHECK_PROG(MAKE_LOWER_TAGS, ctags, yes, no)
2543 if test "$cf_cv_mixedcase" = yes ; then
2544 AC_CHECK_PROG(MAKE_UPPER_TAGS, etags, yes, no)
2549 if test "$MAKE_UPPER_TAGS" = yes ; then
2554 AC_SUBST(MAKE_UPPER_TAGS)
2556 if test "$MAKE_LOWER_TAGS" = yes ; then
2561 AC_SUBST(MAKE_LOWER_TAGS)
2563 dnl ---------------------------------------------------------------------------
2564 dnl CF_MANPAGE_FORMAT version: 7 updated: 2003/12/20 19:30:34
2565 dnl -----------------
2566 dnl Option to allow user to override automatic configuration of manpage format.
2567 dnl There are several special cases:
2569 dnl gzip - man checks for, can display gzip'd files
2570 dnl compress - man checks for, can display compressed files
2571 dnl BSDI - files in the cat-directories are suffixed ".0"
2572 dnl formatted - installer should format (put files in cat-directory)
2573 dnl catonly - installer should only format, e.g., for a turnkey system.
2575 dnl There are other configurations which this macro does not test, e.g., HPUX's
2576 dnl compressed manpages (but uncompressed manpages are fine, and HPUX's naming
2577 dnl convention would not match our use).
2578 AC_DEFUN([CF_MANPAGE_FORMAT],
2580 AC_REQUIRE([CF_PATHSEP])
2581 AC_MSG_CHECKING(format of man-pages)
2583 AC_ARG_WITH(manpage-format,
2584 [ --with-manpage-format specify manpage-format: gzip/compress/BSDI/normal and
2585 optionally formatted/catonly, e.g., gzip,formatted],
2586 [MANPAGE_FORMAT=$withval],
2587 [MANPAGE_FORMAT=unknown])
2589 test -z "$MANPAGE_FORMAT" && MANPAGE_FORMAT=unknown
2590 MANPAGE_FORMAT=`echo "$MANPAGE_FORMAT" | sed -e 's/,/ /g'`
2594 case $MANPAGE_FORMAT in
2596 if test -z "$MANPATH" ; then
2597 MANPATH="/usr/man:/usr/share/man"
2600 # look for the 'date' man-page (it's most likely to be installed!)
2606 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATHSEP}"
2607 for cf_dir in $MANPATH; do
2608 test -z "$cf_dir" && cf_dir=/usr/man
2609 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
2611 cf_test=`echo $cf_name | sed -e 's/*//'`
2612 if test "x$cf_test" = "x$cf_name" ; then
2615 *.gz) MANPAGE_FORMAT="$MANPAGE_FORMAT gzip";;
2616 *.Z) MANPAGE_FORMAT="$MANPAGE_FORMAT compress";;
2617 *.0) MANPAGE_FORMAT="$MANPAGE_FORMAT BSDI";;
2618 *) MANPAGE_FORMAT="$MANPAGE_FORMAT normal";;
2632 # if we found a match in either man* or cat*, stop looking
2633 if test -n "$MANPAGE_FORMAT" ; then
2635 test "$cf_preform" = yes && MANPAGE_FORMAT="$MANPAGE_FORMAT formatted"
2636 test "$cf_catonly" = yes && MANPAGE_FORMAT="$MANPAGE_FORMAT catonly"
2642 test $cf_found=yes && break
2645 # only check the first directory in $MANPATH where we find manpages
2646 if test -n "$MANPAGE_FORMAT" ; then
2650 # if we did not find the example, just assume it is normal
2651 test -z "$MANPAGE_FORMAT" && MANPAGE_FORMAT=normal
2655 for cf_option in $MANPAGE_FORMAT; do
2656 case $cf_option in #(vi
2657 gzip|compress|BSDI|normal|formatted|catonly)
2660 cf_unknown="$cf_unknown $cf_option"
2667 AC_MSG_RESULT($MANPAGE_FORMAT)
2668 if test -n "$cf_unknown" ; then
2669 AC_MSG_WARN(Unexpected manpage-format $cf_unknown)
2672 dnl ---------------------------------------------------------------------------
2673 dnl CF_MANPAGE_RENAMES version: 7 updated: 2005/06/18 18:51:57
2674 dnl ------------------
2675 dnl The Debian people have their own naming convention for manpages. This
2676 dnl option lets us override the name of the file containing renaming, or
2677 dnl disable it altogether.
2678 AC_DEFUN([CF_MANPAGE_RENAMES],
2680 AC_MSG_CHECKING(for manpage renaming)
2682 AC_ARG_WITH(manpage-renames,
2683 [ --with-manpage-renames specify manpage-renaming],
2684 [MANPAGE_RENAMES=$withval],
2685 [MANPAGE_RENAMES=yes])
2687 case ".$MANPAGE_RENAMES" in #(vi
2691 # Debian 'man' program?
2692 if test -f /etc/debian_version ; then
2693 MANPAGE_RENAMES=`cd $srcdir && pwd`/man/man_db.renames
2700 if test "$MANPAGE_RENAMES" != no ; then
2701 if test -f $srcdir/man/$MANPAGE_RENAMES ; then
2702 MANPAGE_RENAMES=`cd $srcdir/man && pwd`/$MANPAGE_RENAMES
2703 elif test ! -f $MANPAGE_RENAMES ; then
2704 AC_MSG_ERROR(not a filename: $MANPAGE_RENAMES)
2707 test ! -d man && mkdir man
2709 # Construct a sed-script to perform renaming within man-pages
2710 if test -n "$MANPAGE_RENAMES" ; then
2711 test ! -d man && mkdir man
2712 sh $srcdir/man/make_sed.sh $MANPAGE_RENAMES >./edit_man.sed
2716 AC_MSG_RESULT($MANPAGE_RENAMES)
2717 AC_SUBST(MANPAGE_RENAMES)
2719 dnl ---------------------------------------------------------------------------
2720 dnl CF_MANPAGE_SYMLINKS version: 4 updated: 2003/12/13 18:01:58
2721 dnl -------------------
2722 dnl Some people expect each tool to make all aliases for manpages in the
2723 dnl man-directory. This accommodates the older, less-capable implementations
2724 dnl of 'man', and is optional.
2725 AC_DEFUN([CF_MANPAGE_SYMLINKS],
2727 AC_MSG_CHECKING(if manpage aliases will be installed)
2729 AC_ARG_WITH(manpage-aliases,
2730 [ --with-manpage-aliases specify manpage-aliases using .so],
2731 [MANPAGE_ALIASES=$withval],
2732 [MANPAGE_ALIASES=yes])
2734 AC_MSG_RESULT($MANPAGE_ALIASES)
2736 if test "$LN_S" = "ln -s"; then
2743 if test "$MANPAGE_ALIASES" = yes ; then
2744 AC_MSG_CHECKING(if manpage symlinks should be used)
2746 AC_ARG_WITH(manpage-symlinks,
2747 [ --with-manpage-symlinks specify manpage-aliases using symlinks],
2748 [MANPAGE_SYMLINKS=$withval],
2749 [MANPAGE_SYMLINKS=$cf_use_symlinks])
2751 if test "$$cf_use_symlinks" = no; then
2752 if test "$MANPAGE_SYMLINKS" = yes ; then
2753 AC_MSG_WARN(cannot make symlinks, will use .so files)
2758 AC_MSG_RESULT($MANPAGE_SYMLINKS)
2762 dnl ---------------------------------------------------------------------------
2763 dnl CF_MANPAGE_TBL version: 3 updated: 2002/01/19 22:51:32
2765 dnl This option causes manpages to be run through tbl(1) to generate tables
2767 AC_DEFUN([CF_MANPAGE_TBL],
2769 AC_MSG_CHECKING(for manpage tbl)
2771 AC_ARG_WITH(manpage-tbl,
2772 [ --with-manpage-tbl specify manpage processing with tbl],
2773 [MANPAGE_TBL=$withval],
2776 AC_MSG_RESULT($MANPAGE_TBL)
2778 dnl ---------------------------------------------------------------------------
2779 dnl CF_MAN_PAGES version: 32 updated: 2006/12/24 15:18:27
2781 dnl Try to determine if the man-pages on the system are compressed, and if
2782 dnl so, what format is used. Use this information to construct a script that
2783 dnl will install man-pages.
2784 AC_DEFUN([CF_MAN_PAGES],
2786 CF_HELP_MESSAGE(Options to Specify How Manpages are Installed:)
2792 if test "$prefix" = "NONE" ; then
2793 cf_prefix="$ac_default_prefix"
2798 case "$MANPAGE_FORMAT" in # (vi
2813 test ! -d man && mkdir man
2817 case "$MANPAGE_FORMAT" in #(vi
2820 cf_compress=compress
2828 cf_edit_man=./edit_man.sh
2829 cf_man_alias=`pwd`/man_alias.sed
2831 cat >$cf_edit_man <<CF_EOF
2833 # this script is generated by the configure-script CF_MAN_PAGES macro.
2838 NCURSES_MAJOR="$NCURSES_MAJOR"
2839 NCURSES_MINOR="$NCURSES_MINOR"
2840 NCURSES_PATCH="$NCURSES_PATCH"
2842 NCURSES_OSPEED="$NCURSES_OSPEED"
2843 TERMINFO="$TERMINFO"
2845 MKDIRS="sh `cd $srcdir && pwd`/mkinstalldirs"
2848 INSTALL_DATA="$INSTALL_DATA"
2850 transform="$program_transform_name"
2852 TMP=\${TMPDIR-/tmp}/man\$\$
2853 trap "rm -f \$TMP" 0 1 2 5 15
2865 top_srcdir=\[$]srcdir/..
2868 if test "\$form" = normal ; then
2869 if test "$cf_format" = yes ; then
2870 if test "$cf_inboth" = no ; then
2871 sh \[$]0 format \$verb \$mandir \$srcdir \[$]*
2875 cf_subdir=\$mandir/man
2876 cf_tables=$MANPAGE_TBL
2878 cf_subdir=\$mandir/cat
2882 # process the list of source-files
2885 *.orig|*.rej) ;; #(vi
2887 section=\`expr "\$i" : '.*\\.\\([[0-9]]\\)[[xm]]*'\`;
2888 if test \$verb = installing ; then
2889 if test ! -d \$cf_subdir\${section} ; then
2890 \$MKDIRS \$cf_subdir\$section
2894 # replace variables in man page
2895 if test ! -f $cf_man_alias ; then
2896 cat >>$cf_man_alias <<-CF_EOF2
2897 s,@DATADIR@,\$datadir,
2898 s,@TERMINFO@,\$TERMINFO,
2899 s,@NCURSES_MAJOR@,\$NCURSES_MAJOR,
2900 s,@NCURSES_MINOR@,\$NCURSES_MINOR,
2901 s,@NCURSES_PATCH@,\$NCURSES_PATCH,
2902 s,@NCURSES_OSPEED@,\$NCURSES_OSPEED,
2907 cf_NAME=`echo "$cf_name" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
2908 cf_name=`echo $cf_name|sed "$program_transform_name"`
2909 cat >>$cf_edit_man <<-CF_EOF
2910 s,@$cf_NAME@,$cf_name,
2914 cat >>$cf_edit_man <<CF_EOF
2916 echo "...made $cf_man_alias"
2920 cf_source=\`basename \$i\`
2922 test ! -f \$inalias && inalias="\$srcdir/\$inalias"
2923 if test ! -f \$inalias ; then
2924 echo .. skipped \$cf_source
2929 if test "$MANPAGE_ALIASES" != no ; then
2930 cat >>$cf_edit_man <<CF_EOF
2931 aliases=\`sed -f \$top_srcdir/man/manlinks.sed \$inalias |sed -f $cf_man_alias | sort -u\`
2935 if test "$MANPAGE_RENAMES" = no ; then
2936 cat >>$cf_edit_man <<CF_EOF
2937 # perform program transformations for section 1 man pages
2938 if test \$section = 1 ; then
2939 cf_target=\$cf_subdir\${section}/\`echo \$cf_source|sed "\${transform}"\`
2941 cf_target=\$cf_subdir\${section}/\$cf_source
2945 cat >>$cf_edit_man <<CF_EOF
2946 cf_target=\`grep "^\$cf_source" $MANPAGE_RENAMES | $AWK '{print \[$]2}'\`
2947 if test -z "\$cf_target" ; then
2948 echo '? missing rename for '\$cf_source
2949 cf_target="\$cf_source"
2951 cf_target="\$cf_subdir\${section}/\${cf_target}"
2956 cat >>$cf_edit_man <<CF_EOF
2957 sed -f $cf_man_alias \\
2960 if test -f $MANPAGE_RENAMES ; then
2961 cat >>$cf_edit_man <<CF_EOF
2962 < \$i | sed -f `pwd`/edit_man.sed >\$TMP
2965 cat >>$cf_edit_man <<CF_EOF
2970 cat >>$cf_edit_man <<CF_EOF
2971 if test \$cf_tables = yes ; then
2972 tbl \$TMP >\$TMP.out
2977 if test $with_curses_h != yes ; then
2978 cat >>$cf_edit_man <<CF_EOF
2979 sed -e "/\#[ ]*include/s,curses.h,ncurses.h," < \$TMP >\$TMP.out
2984 cat >>$cf_edit_man <<CF_EOF
2985 if test \$form = format ; then
2986 nroff -man \$TMP >\$TMP.out
2991 if test -n "$cf_compress" ; then
2992 cat >>$cf_edit_man <<CF_EOF
2993 if test \$verb = installing ; then
2994 if ( $cf_compress -f \$TMP )
2996 mv \$TMP.$cf_so_strip \$TMP
2999 cf_target="\$cf_target.$cf_so_strip"
3003 case "$MANPAGE_FORMAT" in #(vi
3005 cat >>$cf_edit_man <<CF_EOF
3006 if test \$form = format ; then
3007 # BSDI installs only .0 suffixes in the cat directories
3008 cf_target="\`echo \$cf_target|sed -e 's/\.[[1-9]]\+[[a-z]]*/.0/'\`"
3014 cat >>$cf_edit_man <<CF_EOF
3015 suffix=\`basename \$cf_target | sed -e 's%^[[^.]]*%%'\`
3016 if test \$verb = installing ; then
3017 echo \$verb \$cf_target
3018 \$INSTALL_DATA \$TMP \$cf_target
3019 test -n "\$aliases" && (
3020 cd \$cf_subdir\${section} && (
3021 cf_source=\`echo \$cf_target |sed -e 's%^.*/\([[^/]][[^/]]*/[[^/]][[^/]]*$\)%\1%'\`
3022 test -n "$cf_so_strip" && cf_source=\`echo \$cf_source |sed -e 's%\.$cf_so_strip\$%%'\`
3023 cf_target=\`basename \$cf_target\`
3024 for cf_alias in \$aliases
3026 if test \$section = 1 ; then
3027 cf_alias=\`echo \$cf_alias|sed "\${transform}"\`
3030 if test "$MANPAGE_SYMLINKS" = yes ; then
3031 if test -f \$cf_alias\${suffix} ; then
3032 if ( cmp -s \$cf_target \$cf_alias\${suffix} )
3037 echo .. \$verb alias \$cf_alias\${suffix}
3038 rm -f \$cf_alias\${suffix}
3039 $LN_S \$cf_target \$cf_alias\${suffix}
3040 elif test "\$cf_target" != "\$cf_alias\${suffix}" ; then
3041 echo ".so \$cf_source" >\$TMP
3043 if test -n "$cf_compress" ; then
3044 cat >>$cf_edit_man <<CF_EOF
3045 if test -n "$cf_so_strip" ; then
3046 $cf_compress -f \$TMP
3047 mv \$TMP.$cf_so_strip \$TMP
3051 cat >>$cf_edit_man <<CF_EOF
3052 echo .. \$verb alias \$cf_alias\${suffix}
3053 rm -f \$cf_alias\${suffix}
3054 \$INSTALL_DATA \$TMP \$cf_alias\${suffix}
3059 elif test \$verb = removing ; then
3060 echo \$verb \$cf_target
3062 test -n "\$aliases" && (
3063 cd \$cf_subdir\${section} && (
3064 for cf_alias in \$aliases
3066 if test \$section = 1 ; then
3067 cf_alias=\`echo \$cf_alias|sed "\${transform}"\`
3070 echo .. \$verb alias \$cf_alias\${suffix}
3071 rm -f \$cf_alias\${suffix}
3083 if test $cf_inboth = yes ; then
3084 if test \$form != format ; then
3085 sh \[$]0 format \$verb \$mandir \$srcdir \[$]*
3091 chmod 755 $cf_edit_man
3094 dnl ---------------------------------------------------------------------------
3095 dnl CF_MATH_LIB version: 5 updated: 2000/05/28 01:39:10
3097 dnl Checks for libraries. At least one UNIX system, Apple Macintosh
3098 dnl Rhapsody 5.5, does not have -lm. We cannot use the simpler
3099 dnl AC_CHECK_LIB(m,sin), because that fails for C++.
3100 AC_DEFUN([CF_MATH_LIB],
3102 AC_CACHE_CHECK(if -lm needed for math functions,
3108 [double x = rand(); printf("result = %g\n", ]ifelse($2,,sin(x),$2)[)],
3109 [cf_cv_need_libm=no],
3110 [cf_cv_need_libm=yes])])
3111 if test "$cf_cv_need_libm" = yes
3118 dnl ---------------------------------------------------------------------------
3119 dnl CF_MIXEDCASE_FILENAMES version: 3 updated: 2003/09/20 17:07:55
3120 dnl ----------------------
3121 dnl Check if the file-system supports mixed-case filenames. If we're able to
3122 dnl create a lowercase name and see it as uppercase, it doesn't support that.
3123 AC_DEFUN([CF_MIXEDCASE_FILENAMES],
3125 AC_CACHE_CHECK(if filesystem supports mixed-case filenames,cf_cv_mixedcase,[
3126 if test "$cross_compiling" = yes ; then
3127 case $target_alias in #(vi
3128 *-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-mingw32*|*-uwin*) #(vi
3136 rm -f conftest CONFTEST
3138 if test -f CONFTEST ; then
3143 rm -f conftest CONFTEST
3146 test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES)
3148 dnl ---------------------------------------------------------------------------
3149 dnl CF_MKSTEMP version: 5 updated: 2006/12/16 12:33:30
3151 dnl Check for a working mkstemp. This creates two files, checks that they are
3152 dnl successfully created and distinct (AmigaOS apparently fails on the last).
3153 AC_DEFUN([CF_MKSTEMP],[
3154 AC_CACHE_CHECK(for working mkstemp, cf_cv_func_mkstemp,[
3157 #include <sys/types.h>
3161 #include <sys/stat.h>
3164 char *tmpl = "conftestXXXXXX";
3172 for (n = 0; n < 2; ++n) {
3173 strcpy(name[n], tmpl);
3174 if ((fd = mkstemp(name[n])) >= 0) {
3175 if (!strcmp(name[n], tmpl)
3176 || stat(name[n], &sb) != 0
3177 || (sb.st_mode & S_IFMT) != S_IFREG
3178 || (sb.st_mode & 077) != 0) {
3185 && !strcmp(name[0], name[1]))
3187 ${cf_cv_main_return:-return}(result);
3189 ],[cf_cv_func_mkstemp=yes
3190 ],[cf_cv_func_mkstemp=no
3191 ],[AC_CHECK_FUNC(mkstemp)
3194 if test "$cf_cv_func_mkstemp" = yes ; then
3195 AC_DEFINE(HAVE_MKSTEMP)
3198 dnl ---------------------------------------------------------------------------
3199 dnl CF_MSG_LOG version: 3 updated: 1997/09/07 14:05:52
3201 dnl Write a debug message to config.log, along with the line number in the
3202 dnl configure script.
3203 AC_DEFUN([CF_MSG_LOG],[
3204 echo "(line __oline__) testing $* ..." 1>&AC_FD_CC
3206 dnl ---------------------------------------------------------------------------
3207 dnl CF_NCURSES_ABI_6 version: 1 updated: 2005/09/17 18:42:49
3208 dnl ----------------
3209 dnl Set ncurses' ABI to 6 unless overridden by explicit configure option, and
3210 dnl warn about this.
3211 AC_DEFUN([CF_NCURSES_ABI_6],[
3212 if test "${with_abi_version+set}" != set; then
3213 case $cf_cv_rel_version in
3215 cf_cv_rel_version=6.0
3217 AC_MSG_WARN(Overriding ABI version to $cf_cv_abi_version)
3222 dnl ---------------------------------------------------------------------------
3223 dnl CF_NO_LEAKS_OPTION version: 4 updated: 2006/12/16 14:24:05
3224 dnl ------------------
3225 dnl see CF_WITH_NO_LEAKS
3226 AC_DEFUN([CF_NO_LEAKS_OPTION],[
3227 AC_MSG_CHECKING(if you want to use $1 for testing)
3230 [AC_DEFINE($3)ifelse([$4],,[
3233 : ${with_cflags:=-g}
3234 : ${with_no_leaks:=yes}
3237 AC_MSG_RESULT(${with_$1:-no})
3239 case .$with_cflags in #(vi
3241 case .$CFLAGS in #(vi
3251 dnl ---------------------------------------------------------------------------
3252 dnl CF_NUMBER_SYNTAX version: 1 updated: 2003/09/20 18:12:49
3253 dnl ----------------
3254 dnl Check if the given variable is a number. If not, report an error.
3255 dnl $1 is the variable
3256 dnl $2 is the message
3257 AC_DEFUN([CF_NUMBER_SYNTAX],[
3258 if test -n "$1" ; then
3263 AC_MSG_ERROR($2 is not a number: $1)
3267 AC_MSG_ERROR($2 value is empty)
3270 dnl ---------------------------------------------------------------------------
3271 dnl CF_OBJ_SUBDIR version: 4 updated: 2002/02/23 20:38:31
3273 dnl Compute the object-directory name from the given model name
3274 AC_DEFUN([CF_OBJ_SUBDIR],
3277 libtool) $2='obj_lo' ;;
3278 normal) $2='objects' ;;
3279 debug) $2='obj_g' ;;
3280 profile) $2='obj_p' ;;
3282 case $cf_cv_system_name in #(vi
3290 dnl ---------------------------------------------------------------------------
3291 dnl CF_PATHSEP version: 3 updated: 2001/01/12 01:23:53
3293 dnl Provide a value for the $PATH and similar separator
3294 AC_DEFUN([CF_PATHSEP],
3296 case $cf_cv_system_name in
3297 os2*) PATHSEP=';' ;;
3300 ifelse($1,,,[$1=$PATHSEP])
3303 dnl ---------------------------------------------------------------------------
3304 dnl CF_PATH_SYNTAX version: 11 updated: 2006/09/02 08:55:46
3306 dnl Check the argument to see that it looks like a pathname. Rewrite it if it
3307 dnl begins with one of the prefix/exec_prefix variables, and then again if the
3308 dnl result begins with 'NONE'. This is necessary to work around autoconf's
3309 dnl delayed evaluation of those symbols.
3310 AC_DEFUN([CF_PATH_SYNTAX],[
3311 if test "x$prefix" != xNONE; then
3312 cf_path_syntax="$prefix"
3314 cf_path_syntax="$ac_default_prefix"
3317 case ".[$]$1" in #(vi
3318 .\[$]\(*\)*|.\'*\'*) #(vi
3322 .[[a-zA-Z]]:[[\\/]]*) #(vi OS/2 EMX
3324 .\[$]{*prefix}*) #(vi
3326 case ".[$]$1" in #(vi
3328 $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%`
3333 $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%`
3336 ifelse($2,,[AC_ERROR([expected a pathname, not \"[$]$1\"])],$2)
3340 dnl ---------------------------------------------------------------------------
3341 dnl CF_POSIX_C_SOURCE version: 6 updated: 2005/07/14 20:25:10
3342 dnl -----------------
3343 dnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed.
3345 dnl POSIX.1-1990 _POSIX_SOURCE
3346 dnl POSIX.1-1990 and _POSIX_SOURCE and
3347 dnl POSIX.2-1992 C-Language _POSIX_C_SOURCE=2
3349 dnl POSIX.1b-1993 _POSIX_C_SOURCE=199309L
3350 dnl POSIX.1c-1996 _POSIX_C_SOURCE=199506L
3351 dnl X/Open 2000 _POSIX_C_SOURCE=200112L
3354 dnl $1 is the nominal value for _POSIX_C_SOURCE
3355 AC_DEFUN([CF_POSIX_C_SOURCE],
3357 cf_POSIX_C_SOURCE=ifelse($1,,199506L,$1)
3359 cf_save_CFLAGS="$CFLAGS"
3360 cf_save_CPPFLAGS="$CPPFLAGS"
3362 CF_REMOVE_DEFINE(cf_trim_CFLAGS,$cf_save_CFLAGS,_POSIX_C_SOURCE)
3363 CF_REMOVE_DEFINE(cf_trim_CPPFLAGS,$cf_save_CPPFLAGS,_POSIX_C_SOURCE)
3365 AC_CACHE_CHECK(if we should define _POSIX_C_SOURCE,cf_cv_posix_c_source,[
3366 CF_MSG_LOG(if the symbol is already defined go no further)
3367 AC_TRY_COMPILE([#include <sys/types.h>],[
3368 #ifndef _POSIX_C_SOURCE
3371 [cf_cv_posix_c_source=no],
3372 [cf_want_posix_source=no
3373 case .$cf_POSIX_C_SOURCE in #(vi
3375 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
3378 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
3379 cf_want_posix_source=yes
3382 cf_want_posix_source=yes
3385 if test "$cf_want_posix_source" = yes ; then
3386 AC_TRY_COMPILE([#include <sys/types.h>],[
3387 #ifdef _POSIX_SOURCE
3390 cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE")
3392 CF_MSG_LOG(ifdef from value $cf_POSIX_C_SOURCE)
3393 CFLAGS="$cf_trim_CFLAGS"
3394 CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source"
3395 CF_MSG_LOG(if the second compile does not leave our definition intact error)
3396 AC_TRY_COMPILE([#include <sys/types.h>],[
3397 #ifndef _POSIX_C_SOURCE
3400 [cf_cv_posix_c_source=no])
3401 CFLAGS="$cf_save_CFLAGS"
3402 CPPFLAGS="$cf_save_CPPFLAGS"
3406 if test "$cf_cv_posix_c_source" != no ; then
3407 CFLAGS="$cf_trim_CFLAGS"
3408 CPPFLAGS="$cf_trim_CPPFLAGS"
3409 if test "$cf_cv_cc_u_d_options" = yes ; then
3410 cf_temp_posix_c_source=`echo "$cf_cv_posix_c_source" | \
3411 sed -e 's/-D/-U/g' -e 's/=[[^ ]]*//g'`
3412 CPPFLAGS="$CPPFLAGS $cf_temp_posix_c_source"
3414 CPPFLAGS="$CPPFLAGS $cf_cv_posix_c_source"
3418 dnl ---------------------------------------------------------------------------
3419 dnl CF_PREDEFINE version: 1 updated: 2003/07/26 17:53:56
3421 dnl Add definitions to CPPFLAGS to ensure they're predefined for all compiles.
3423 dnl $1 = symbol to test
3424 dnl $2 = value (if any) to use for a predefinition
3425 AC_DEFUN([CF_PREDEFINE],
3427 AC_MSG_CHECKING(if we must define $1)
3428 AC_TRY_COMPILE([#include <sys/types.h>
3432 #endif],[cf_result=no],[cf_result=yes])
3433 AC_MSG_RESULT($cf_result)
3435 if test "$cf_result" = yes ; then
3436 CPPFLAGS="$CPPFLAGS ifelse($2,,-D$1,[-D$1=$2])"
3437 elif test "x$2" != "x" ; then
3438 AC_MSG_CHECKING(checking for compatible value versus $2)
3439 AC_TRY_COMPILE([#include <sys/types.h>
3443 #endif],[cf_result=yes],[cf_result=no])
3444 AC_MSG_RESULT($cf_result)
3445 if test "$cf_result" = no ; then
3446 # perhaps we can override it - try...
3447 CPPFLAGS="$CPPFLAGS -D$1=$2"
3451 dnl ---------------------------------------------------------------------------
3452 dnl CF_PRG_RULES version: 1 updated: 2006/06/03 11:45:08
3454 dnl Append definitions and rules for the given programs to the subdirectory
3455 dnl Makefiles, and the recursion rule for the top-level Makefile.
3458 dnl $1 = script to run
3459 dnl $2 = list of subdirectories
3463 AC_DEFUN([CF_PRG_RULES],
3467 if test ! -d $srcdir/$cf_dir; then
3469 elif test -f $srcdir/$cf_dir/programs; then
3470 $AWK -f $1 $srcdir/$cf_dir/programs >>$cf_dir/Makefile
3475 dnl ---------------------------------------------------------------------------
3476 dnl CF_PROG_AWK version: 1 updated: 2006/09/16 11:40:59
3478 dnl Check for awk, ensure that the check found something.
3479 AC_DEFUN([CF_PROG_AWK],
3482 test -z "$AWK" && AC_MSG_ERROR(No awk program found)
3484 dnl ---------------------------------------------------------------------------
3485 dnl CF_PROG_CC_C_O version: 2 updated: 2006/12/16 15:55:46
3487 dnl Analogous to AC_PROG_CC_C_O, but more useful: tests only $CC, ensures that
3488 dnl the output file can be renamed, and allows for a shell variable that can
3489 dnl be used later. The parameter is either CC or CXX. The result is the
3491 dnl $cf_cv_prog_CC_c_o
3492 dnl $cf_cv_prog_CXX_c_o
3493 AC_DEFUN([CF_PROG_CC_C_O],
3494 [AC_REQUIRE([AC_PROG_CC])dnl
3495 AC_MSG_CHECKING([whether [$]$1 understands -c and -o together])
3496 AC_CACHE_VAL(cf_cv_prog_$1_c_o,
3498 cat > conftest.$ac_ext <<CF_EOF
3502 ${cf_cv_main_return:-return}(0);
3505 # We do the test twice because some compilers refuse to overwrite an
3506 # existing .o file with -o, though they will create one.
3507 ac_try='[$]$1 -c conftest.$ac_ext -o conftest2.$ac_objext >&AC_FD_CC'
3508 if AC_TRY_EVAL(ac_try) &&
3509 test -f conftest2.$ac_objext && AC_TRY_EVAL(ac_try);
3511 eval cf_cv_prog_$1_c_o=yes
3513 eval cf_cv_prog_$1_c_o=no
3517 if test $cf_cv_prog_$1_c_o = yes; then
3518 AC_MSG_RESULT([yes])
3523 dnl ---------------------------------------------------------------------------
3524 dnl CF_PROG_CC_U_D version: 1 updated: 2005/07/14 16:59:30
3526 dnl Check if C (preprocessor) -U and -D options are processed in the order
3527 dnl given rather than by type of option. Some compilers insist on apply all
3528 dnl of the -U options after all of the -D options. Others allow mixing them,
3529 dnl and may predefine symbols that conflict with those we define.
3530 AC_DEFUN([CF_PROG_CC_U_D],
3532 AC_CACHE_CHECK(if $CC -U and -D options work together,cf_cv_cc_u_d_options,[
3533 cf_save_CPPFLAGS="$CPPFLAGS"
3534 CPPFLAGS="-UU_D_OPTIONS -DU_D_OPTIONS -DD_U_OPTIONS -UD_U_OPTIONS"
3537 make an undefined-error
3540 make a defined-error
3543 cf_cv_cc_u_d_options=yes],[
3544 cf_cv_cc_u_d_options=no])
3545 CPPFLAGS="$cf_save_CPPFLAGS"
3548 dnl ---------------------------------------------------------------------------
3549 dnl CF_PROG_EGREP version: 1 updated: 2006/09/16 11:40:59
3551 dnl AC_PROG_EGREP was introduced in autoconf 2.53.
3552 dnl This macro adds a check to ensure the script found something.
3553 AC_DEFUN([CF_PROG_EGREP],
3554 [AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep],
3555 [if echo a | (grep -E '(a|b)') >/dev/null 2>&1
3556 then ac_cv_prog_egrep='grep -E'
3557 else ac_cv_prog_egrep='egrep'
3559 EGREP=$ac_cv_prog_egrep
3561 test -z "$EGREP" && AC_MSG_ERROR(No egrep program found)
3563 dnl ---------------------------------------------------------------------------
3564 dnl CF_PROG_EXT version: 10 updated: 2004/01/03 19:28:18
3566 dnl Compute $PROG_EXT, used for non-Unix ports, such as OS/2 EMX.
3567 AC_DEFUN([CF_PROG_EXT],
3569 AC_REQUIRE([CF_CHECK_CACHE])
3570 case $cf_cv_system_name in
3572 CFLAGS="$CFLAGS -Zmt"
3573 CPPFLAGS="$CPPFLAGS -D__ST_MT_ERRNO__"
3574 CXXFLAGS="$CXXFLAGS -Zmt"
3575 # autoconf's macro sets -Zexe and suffix both, which conflict:w
3576 LDFLAGS="$LDFLAGS -Zmt -Zcrtdll"
3586 test -n "$PROG_EXT" && AC_DEFINE_UNQUOTED(PROG_EXT,"$PROG_EXT")
3588 dnl ---------------------------------------------------------------------------
3589 dnl CF_PROG_INSTALL version: 5 updated: 2002/12/21 22:46:07
3591 dnl Force $INSTALL to be an absolute-path. Otherwise, edit_man.sh and the
3592 dnl misc/tabset install won't work properly. Usually this happens only when
3593 dnl using the fallback mkinstalldirs script
3594 AC_DEFUN([CF_PROG_INSTALL],
3600 CF_DIRNAME(cf_dir,$INSTALL)
3601 test -z "$cf_dir" && cf_dir=.
3602 INSTALL=`cd $cf_dir && pwd`/`echo $INSTALL | sed -e 's%^.*/%%'`
3606 dnl ---------------------------------------------------------------------------
3607 dnl CF_PROG_LDCONFIG version: 1 updated: 2003/09/20 17:07:55
3608 dnl ----------------
3609 dnl Check for ldconfig, needed to fixup shared libraries that would be built
3610 dnl and then used in the install.
3611 AC_DEFUN([CF_PROG_LDCONFIG],[
3612 if test "$cross_compiling" = yes ; then
3615 case "$cf_cv_system_name" in #(vi
3617 test -z "$LDCONFIG" && LDCONFIG="/sbin/ldconfig -R"
3619 *) LDPATH=$PATH:/sbin:/usr/sbin
3620 AC_PATH_PROG(LDCONFIG,ldconfig,,$LDPATH)
3626 dnl ---------------------------------------------------------------------------
3627 dnl CF_PROG_LINT version: 1 updated: 2006/09/16 11:40:59
3629 AC_DEFUN([CF_PROG_LINT],
3631 AC_CHECK_PROGS(LINT, tdlint lint alint)
3634 dnl ---------------------------------------------------------------------------
3635 dnl CF_REGEX version: 3 updated: 1997/11/01 14:26:01
3637 dnl Attempt to determine if we've got one of the flavors of regular-expression
3638 dnl code that we can support.
3639 AC_DEFUN([CF_REGEX],
3641 AC_MSG_CHECKING([for regular-expression headers])
3642 AC_CACHE_VAL(cf_cv_regex,[
3643 AC_TRY_LINK([#include <sys/types.h>
3644 #include <regex.h>],[
3646 int x = regcomp(p, "", 0);
3647 int y = regexec(p, "", 0, 0, 0);
3649 ],[cf_cv_regex="regex.h"],[
3650 AC_TRY_LINK([#include <regexp.h>],[
3651 char *p = compile("", "", "", 0);
3652 int x = step("", "");
3653 ],[cf_cv_regex="regexp.h"],[
3654 cf_save_LIBS="$LIBS"
3656 AC_TRY_LINK([#include <regexpr.h>],[
3657 char *p = compile("", "", "");
3658 int x = step("", "");
3659 ],[cf_cv_regex="regexpr.h"],[LIBS="$cf_save_LIBS"])])])
3661 AC_MSG_RESULT($cf_cv_regex)
3662 case $cf_cv_regex in
3663 regex.h) AC_DEFINE(HAVE_REGEX_H_FUNCS) ;;
3664 regexp.h) AC_DEFINE(HAVE_REGEXP_H_FUNCS) ;;
3665 regexpr.h) AC_DEFINE(HAVE_REGEXPR_H_FUNCS) ;;
3668 dnl ---------------------------------------------------------------------------
3669 dnl CF_REMOVE_DEFINE version: 2 updated: 2005/07/09 16:12:18
3670 dnl ----------------
3671 dnl Remove all -U and -D options that refer to the given symbol from a list
3672 dnl of C compiler options. This works around the problem that not all
3673 dnl compilers process -U and -D options from left-to-right, so a -U option
3674 dnl cannot be used to cancel the effect of a preceding -D option.
3676 dnl $1 = target (which could be the same as the source variable)
3677 dnl $2 = source (including '$')
3678 dnl $3 = symbol to remove
3679 define([CF_REMOVE_DEFINE],
3681 # remove $3 symbol from $2
3683 sed -e 's/-[[UD]]$3\(=[[^ ]]*\)\?[[ ]]/ /g' \
3684 -e 's/-[[UD]]$3\(=[[^ ]]*\)\?[$]//g'`
3686 dnl ---------------------------------------------------------------------------
3687 dnl CF_SHARED_OPTS version: 42 updated: 2006/12/23 18:04:51
3690 dnl Attempt to determine the appropriate CC/LD options for creating a shared
3693 dnl Note: ${LOCAL_LDFLAGS} is used to link executables that will run within the
3694 dnl build-tree, i.e., by making use of the libraries that are compiled in ../lib
3695 dnl We avoid compiling-in a ../lib path for the shared library since that can
3696 dnl lead to unexpected results at runtime.
3697 dnl ${LOCAL_LDFLAGS2} has the same intention but assumes that the shared libraries
3698 dnl are compiled in ../../lib
3700 dnl The variable 'cf_cv_do_symlinks' is used to control whether we configure
3701 dnl to install symbolic links to the rel/abi versions of shared libraries.
3703 dnl The variable 'cf_cv_shlib_version' controls whether we use the rel or abi
3704 dnl version when making symbolic links.
3706 dnl The variable 'cf_cv_shlib_version_infix' controls whether shared library
3707 dnl version numbers are infix (ex: libncurses.<ver>.dylib) or postfix
3708 dnl (ex: libncurses.so.<ver>).
3710 dnl Some loaders leave 'so_locations' lying around. It's nice to clean up.
3711 AC_DEFUN([CF_SHARED_OPTS],
3713 AC_REQUIRE([CF_SUBST_NCURSES_VERSION])
3717 INSTALL_LIB="-m 644"
3719 cf_cv_do_symlinks=no
3721 AC_MSG_CHECKING(if release/abi version should be used for shared libs)
3722 AC_ARG_WITH(shlib-version,
3723 [ --with-shlib-version=X Specify rel or abi version for shared libs],
3724 [test -z "$withval" && withval=auto
3725 case $withval in #(vi
3727 cf_cv_shlib_version=auto
3729 rel|abi|auto|no) #(vi
3730 cf_cv_shlib_version=$withval
3733 AC_ERROR([option value must be one of: rel, abi, auto or no])
3736 ],[cf_cv_shlib_version=auto])
3737 AC_MSG_RESULT($cf_cv_shlib_version)
3741 # Some less-capable ports of gcc support only -fpic
3743 if test "$GCC" = yes
3745 AC_MSG_CHECKING(which $CC option to use)
3746 cf_save_CFLAGS="$CFLAGS"
3747 for CC_SHARED_OPTS in -fPIC -fpic ''
3749 CFLAGS="$cf_save_CFLAGS $CC_SHARED_OPTS"
3750 AC_TRY_COMPILE([#include <stdio.h>],[int x = 1],[break],[])
3752 AC_MSG_RESULT($CC_SHARED_OPTS)
3753 CFLAGS="$cf_save_CFLAGS"
3756 cf_cv_shlib_version_infix=no
3758 case $cf_cv_system_name in
3760 MK_SHARED_LIB='${CC} ${CFLAGS} -o $[@] -Xlinker -soname=`basename $[@]` -nostart -e 0'
3764 MK_SHARED_LIB='${CC} ${CFLAGS} -shared -Wl,--out-implib=../lib/${IMPORT_LIB} -Wl,--export-all-symbols -o ../lib/${SHARED_LIB}'
3765 cf_cv_shlib_version=cygdll
3766 cf_cv_shlib_version_infix=cygdll
3769 EXTRA_CFLAGS="-no-cpp-precomp"
3770 CC_SHARED_OPTS="-dynamic"
3771 MK_SHARED_LIB='${CC} ${CFLAGS} -dynamiclib -install_name ${DESTDIR}${libdir}/`basename $[@]` -compatibility_version ${ABI_VERSION} -current_version ${ABI_VERSION} -o $[@]'
3772 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=abi
3773 cf_cv_shlib_version_infix=yes
3774 AC_CACHE_CHECK([if ld -search_paths_first works], cf_cv_ldflags_search_paths_first, [
3775 cf_save_LDFLAGS=$LDFLAGS
3776 LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
3777 AC_TRY_LINK(, [int i;], cf_cv_ldflags_search_paths_first=yes, cf_cv_ldflags_search_paths_first=no)
3778 LDFLAGS=$cf_save_LDFLAGS])
3779 if test $cf_cv_ldflags_search_paths_first = yes; then
3780 LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
3784 # (tested with gcc 2.7.2 -- I don't have c89)
3785 if test "$GCC" = yes; then
3786 LD_SHARED_OPTS='-Xlinker +b -Xlinker ${libdir}'
3789 LD_SHARED_OPTS='-Wl,+b,${libdir}'
3791 MK_SHARED_LIB='${LD} +b ${libdir} -b -o $[@]'
3792 # HP-UX shared libraries must be executable, and should be
3793 # readonly to exploit a quirk in the memory manager.
3794 INSTALL_LIB="-m 555"
3797 if test "$cf_cv_ld_rpath" = yes ; then
3798 if test "$GCC" = yes; then
3799 cf_ld_rpath_opt="-Wl,-rpath,"
3800 EXTRA_LDFLAGS="-Wl,-rpath,\${libdir} $EXTRA_LDFLAGS"
3802 cf_ld_rpath_opt="-rpath "
3803 EXTRA_LDFLAGS="-rpath \${libdir} $EXTRA_LDFLAGS"
3806 # tested with IRIX 5.2 and 'cc'.
3807 if test "$GCC" != yes; then
3808 CC_SHARED_OPTS='-KPIC'
3810 MK_SHARED_LIB='${CC} -shared -rdata_shared -soname `basename $[@]` -o $[@]'
3811 cf_cv_rm_so_locs=yes
3813 linux*|gnu*|k*bsd*-gnu)
3814 if test "$DFT_LWR_MODEL" = "shared" ; then
3815 LOCAL_LDFLAGS="-Wl,-rpath,\$(LOCAL_LIBDIR)"
3816 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
3818 if test "$cf_cv_ld_rpath" = yes ; then
3819 cf_ld_rpath_opt="-Wl,-rpath,"
3820 EXTRA_LDFLAGS="-Wl,-rpath,\${libdir} $EXTRA_LDFLAGS"
3823 MK_SHARED_LIB='${CC} ${CFLAGS} -shared -Wl,-soname,'$cf_shared_soname',-stats,-lc -o $[@]'
3826 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
3827 MK_SHARED_LIB='${LD} -Bshareable -soname,`basename $[@].${ABI_VERSION}` -o $[@]'
3829 openbsd*|freebsd[[12]].*)
3830 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
3831 MK_SHARED_LIB='${LD} -Bshareable -o $[@]'
3832 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
3835 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
3836 if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_ld_rpath" = yes ; then
3837 LOCAL_LDFLAGS="-rpath \$(LOCAL_LIBDIR)"
3838 LOCAL_LDFLAGS2="-rpath \${libdir} $LOCAL_LDFLAGS"
3839 cf_ld_rpath_opt="-rpath "
3840 EXTRA_LDFLAGS="-rpath \${libdir} $EXTRA_LDFLAGS"
3843 MK_SHARED_LIB='${LD} -Bshareable -soname=`basename $[@]` -o $[@]'
3846 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
3847 test "$cf_cv_ld_rpath" = yes && cf_ld_rpath_opt="-Wl,-rpath,"
3848 if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_ld_rpath" = yes ; then
3849 LOCAL_LDFLAGS="-Wl,-rpath,\$(LOCAL_LIBDIR)"
3850 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
3851 EXTRA_LDFLAGS="-Wl,-rpath,\${libdir} $EXTRA_LDFLAGS"
3852 if test "$cf_cv_shlib_version" = auto; then
3853 if test -f /usr/libexec/ld.elf_so; then
3854 cf_cv_shlib_version=abi
3856 cf_cv_shlib_version=rel
3860 MK_SHARED_LIB='${CC} ${CFLAGS} -shared -Wl,-soname,'$cf_shared_soname' -o $[@]'
3862 MK_SHARED_LIB='${LD} -Bshareable -o $[@]'
3866 # tested with OSF/1 V3.2 and 'cc'
3867 # tested with OSF/1 V3.2 and gcc 2.6.3 (but the c++ demo didn't
3868 # link with shared libs).
3869 MK_SHARED_LIB='${LD} -set_version ${REL_VERSION}:${ABI_VERSION} -expect_unresolved "*" -shared -soname `basename $[@]`'
3872 MK_SHARED_LIB="${MK_SHARED_LIB} -msym"
3875 MK_SHARED_LIB="${MK_SHARED_LIB}"' -o $[@]'
3876 if test "$DFT_LWR_MODEL" = "shared" ; then
3877 LOCAL_LDFLAGS="-Wl,-rpath,\$(LOCAL_LIBDIR)"
3878 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
3880 if test "$cf_cv_ld_rpath" = yes ; then
3881 cf_ld_rpath_opt="-rpath"
3882 # EXTRA_LDFLAGS="$LOCAL_LDFLAGS $EXTRA_LDFLAGS"
3884 cf_cv_rm_so_locs=yes
3886 sco3.2v5*) # (also uw2* and UW7) hops 13-Apr-98
3887 # tested with osr5.0.5
3888 if test "$GCC" != yes; then
3889 CC_SHARED_OPTS='-belf -KPIC'
3891 MK_SHARED_LIB='${LD} -dy -G -h `basename $[@] .${REL_VERSION}`.${ABI_VERSION} -o [$]@'
3892 if test "$cf_cv_ld_rpath" = yes ; then
3893 # only way is to set LD_RUN_PATH but no switch for it
3896 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
3897 LINK_PROGS='LD_RUN_PATH=${libdir}'
3898 LINK_TESTS='Pwd=`pwd`;LD_RUN_PATH=`dirname $${Pwd}`/lib'
3901 # tested with SunOS 4.1.1 and gcc 2.7.0
3902 if test "$GCC" != yes; then
3903 CC_SHARED_OPTS='-KPIC'
3905 MK_SHARED_LIB='${LD} -assert pure-text -o $[@]'
3906 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
3909 # tested with SunOS 5.5.1 (solaris 2.5.1) and gcc 2.7.2
3910 if test "$GCC" != yes; then
3911 CC_SHARED_OPTS='-KPIC'
3913 if test "$DFT_LWR_MODEL" = "shared" ; then
3914 LOCAL_LDFLAGS="-R \$(LOCAL_LIBDIR):\${libdir}"
3915 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
3917 if test "$cf_cv_ld_rpath" = yes ; then
3918 cf_ld_rpath_opt="-R"
3919 EXTRA_LDFLAGS="$LOCAL_LDFLAGS $EXTRA_LDFLAGS"
3922 MK_SHARED_LIB='${CC} -dy -G -h '$cf_shared_soname' -o $[@]'
3925 # tested with UnixWare 7.1.0 (gcc 2.95.2 and cc)
3926 if test "$GCC" != yes; then
3927 CC_SHARED_OPTS='-KPIC'
3929 MK_SHARED_LIB='${LD} -d y -G -o [$]@'
3932 CC_SHARED_OPTS='unknown'
3933 MK_SHARED_LIB='echo unknown'
3937 # This works if the last tokens in $MK_SHARED_LIB are the -o target.
3938 case "$cf_cv_shlib_version" in #(vi
3940 case "$MK_SHARED_LIB" in #(vi
3942 test "$cf_cv_do_symlinks" = no && cf_cv_do_symlinks=yes
3945 AC_MSG_WARN(ignored --with-shlib-version)
3951 if test -n "$cf_ld_rpath_opt" ; then
3952 AC_MSG_CHECKING(if we need a space after rpath option)
3953 cf_save_LIBS="$LIBS"
3954 LIBS="$LIBS ${cf_ld_rpath_opt}$libdir"
3955 AC_TRY_LINK(, , cf_rpath_space=no, cf_rpath_space=yes)
3956 LIBS="$cf_save_LIBS"
3957 AC_MSG_RESULT($cf_rpath_space)
3958 test "$cf_rpath_space" = yes && cf_ld_rpath_opt="$cf_ld_rpath_opt "
3959 MK_SHARED_LIB="$MK_SHARED_LIB $cf_ld_rpath_opt\${libdir}"
3962 AC_SUBST(CC_SHARED_OPTS)
3963 AC_SUBST(LD_SHARED_OPTS)
3964 AC_SUBST(MK_SHARED_LIB)
3965 AC_SUBST(LINK_PROGS)
3966 AC_SUBST(LINK_TESTS)
3967 AC_SUBST(EXTRA_LDFLAGS)
3968 AC_SUBST(LOCAL_LDFLAGS)
3969 AC_SUBST(LOCAL_LDFLAGS2)
3970 AC_SUBST(INSTALL_LIB)
3972 dnl ---------------------------------------------------------------------------
3973 dnl CF_SHARED_SONAME version: 2 updated: 2006/10/21 12:33:41
3974 dnl ----------------
3975 dnl utility macro for CF_SHARED_OPTS, constructs "$cf_shared_soname" for
3976 dnl substitution into MK_SHARED_LIB string for the "-soname" (or similar)
3979 dnl $1 is the default that should be used for "$cf_cv_shlib_version".
3980 dnl If missing, use "rel".
3981 define([CF_SHARED_SONAME],
3983 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=ifelse($1,,rel,$1)
3984 if test "$cf_cv_shlib_version" = rel; then
3985 cf_shared_soname='`basename $[@] .${REL_VERSION}`.${ABI_VERSION}'
3987 cf_shared_soname='`basename $[@]`'
3990 dnl ---------------------------------------------------------------------------
3991 dnl CF_SIGWINCH version: 1 updated: 2006/04/02 16:41:09
3993 dnl Use this macro after CF_XOPEN_SOURCE, but do not require it (not all
3994 dnl programs need this test).
3996 dnl This is really a MacOS X 10.4.3 workaround. Defining _POSIX_C_SOURCE
3997 dnl forces SIGWINCH to be undefined (breaks xterm, ncurses). Oddly, the struct
3998 dnl winsize declaration is left alone - we may revisit this if Apple choose to
3999 dnl break that part of the interface as well.
4000 AC_DEFUN([CF_SIGWINCH],
4002 AC_CACHE_CHECK(if SIGWINCH is defined,cf_cv_define_sigwinch,[
4004 #include <sys/types.h>
4005 #include <sys/signal.h>
4006 ],[int x = SIGWINCH],
4007 [cf_cv_define_sigwinch=yes],
4009 #undef _XOPEN_SOURCE
4010 #undef _POSIX_SOURCE
4011 #undef _POSIX_C_SOURCE
4012 #include <sys/types.h>
4013 #include <sys/signal.h>
4014 ],[int x = SIGWINCH],
4015 [cf_cv_define_sigwinch=maybe],
4016 [cf_cv_define_sigwinch=no])
4020 if test "$cf_cv_define_sigwinch" = maybe ; then
4021 AC_CACHE_CHECK(for actual SIGWINCH definition,cf_cv_fixup_sigwinch,[
4022 cf_cv_fixup_sigwinch=unknown
4024 while test $cf_sigwinch != 1
4027 #undef _XOPEN_SOURCE
4028 #undef _POSIX_SOURCE
4029 #undef _POSIX_C_SOURCE
4030 #include <sys/types.h>
4031 #include <sys/signal.h>
4033 #if SIGWINCH != $cf_sigwinch
4037 [cf_cv_fixup_sigwinch=$cf_sigwinch
4040 cf_sigwinch=`expr $cf_sigwinch - 1`
4044 if test "$cf_cv_fixup_sigwinch" != unknown ; then
4045 CPPFLAGS="$CPPFLAGS -DSIGWINCH=$cf_cv_fixup_sigwinch"
4049 dnl ---------------------------------------------------------------------------
4050 dnl CF_SIZECHANGE version: 8 updated: 2000/11/04 12:22:16
4052 dnl Check for definitions & structures needed for window size-changing
4053 dnl FIXME: check that this works with "snake" (HP-UX 10.x)
4054 AC_DEFUN([CF_SIZECHANGE],
4056 AC_REQUIRE([CF_STRUCT_TERMIOS])
4057 AC_CACHE_CHECK(declaration of size-change, cf_cv_sizechange,[
4058 cf_cv_sizechange=unknown
4059 cf_save_CPPFLAGS="$CPPFLAGS"
4061 for cf_opts in "" "NEED_PTEM_H"
4064 CPPFLAGS="$cf_save_CPPFLAGS"
4065 test -n "$cf_opts" && CPPFLAGS="$CPPFLAGS -D$cf_opts"
4066 AC_TRY_COMPILE([#include <sys/types.h>
4067 #ifdef HAVE_TERMIOS_H
4068 #include <termios.h>
4070 #ifdef HAVE_TERMIO_H
4075 /* This is a workaround for SCO: they neglected to define struct winsize in
4076 * termios.h -- it's only in termio.h and ptem.h
4078 #include <sys/stream.h>
4079 #include <sys/ptem.h>
4081 #if !defined(sun) || !defined(HAVE_TERMIOS_H)
4082 #include <sys/ioctl.h>
4086 struct ttysize win; /* FIXME: what system is this? */
4087 int y = win.ts_lines;
4088 int x = win.ts_cols;
4095 no TIOCGSIZE or TIOCGWINSZ
4096 #endif /* TIOCGWINSZ */
4097 #endif /* TIOCGSIZE */
4099 [cf_cv_sizechange=yes],
4100 [cf_cv_sizechange=no])
4102 CPPFLAGS="$cf_save_CPPFLAGS"
4103 if test "$cf_cv_sizechange" = yes ; then
4104 echo "size-change succeeded ($cf_opts)" >&AC_FD_CC
4105 test -n "$cf_opts" && cf_cv_sizechange="$cf_opts"
4110 if test "$cf_cv_sizechange" != no ; then
4111 AC_DEFINE(HAVE_SIZECHANGE)
4112 case $cf_cv_sizechange in #(vi
4114 AC_DEFINE_UNQUOTED($cf_cv_sizechange )
4119 dnl ---------------------------------------------------------------------------
4120 dnl CF_SRC_MODULES version: 18 updated: 2005/05/28 12:58:54
4122 dnl For each parameter, test if the source-directory exists, and if it contains
4123 dnl a 'modules' file. If so, add to the list $cf_cv_src_modules which we'll
4124 dnl use in CF_LIB_RULES.
4126 dnl This uses the configured value to make the lists SRC_SUBDIRS and
4127 dnl SUB_MAKEFILES which are used in the makefile-generation scheme.
4128 AC_DEFUN([CF_SRC_MODULES],
4130 AC_MSG_CHECKING(for src modules)
4132 # dependencies and linker-arguments for test-programs
4133 TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${LIB_NAME}${DFT_DEP_SUFFIX} $TEST_DEPS"
4134 TEST_DEP2="${LIB_2ND}/${LIB_PREFIX}${LIB_NAME}${DFT_DEP_SUFFIX} $TEST_DEP2"
4135 if test "$DFT_LWR_MODEL" = "libtool"; then
4136 TEST_ARGS="${TEST_DEPS}"
4137 TEST_ARG2="${TEST_DEP2}"
4139 TEST_ARGS="-l${LIB_NAME}${DFT_ARG_SUFFIX} $TEST_ARGS"
4140 TEST_ARG2="-l${LIB_NAME}${DFT_ARG_SUFFIX} $TEST_ARG2"
4146 if test -f $srcdir/$cf_dir/modules; then
4148 # We may/may not have tack in the distribution, though the
4150 if test $cf_dir = tack ; then
4151 if test ! -f $srcdir/${cf_dir}/${cf_dir}.h; then
4156 if test -z "$cf_cv_src_modules"; then
4157 cf_cv_src_modules=$cf_dir
4159 cf_cv_src_modules="$cf_cv_src_modules $cf_dir"
4162 # Make the ncurses_cfg.h file record the library interface files as
4163 # well. These are header files that are the same name as their
4164 # directory. Ncurses is the only library that does not follow
4166 if test $cf_dir = tack ; then
4168 elif test -f $srcdir/${cf_dir}/${cf_dir}.h; then
4169 CF_UPPER(cf_have_include,$cf_dir)
4170 AC_DEFINE_UNQUOTED(HAVE_${cf_have_include}_H)
4171 AC_DEFINE_UNQUOTED(HAVE_LIB${cf_have_include})
4172 TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${cf_dir}${DFT_DEP_SUFFIX} $TEST_DEPS"
4173 TEST_DEP2="${LIB_2ND}/${LIB_PREFIX}${cf_dir}${DFT_DEP_SUFFIX} $TEST_DEP2"
4174 if test "$DFT_LWR_MODEL" = "libtool"; then
4175 TEST_ARGS="${TEST_DEPS}"
4176 TEST_ARG2="${TEST_DEP2}"
4178 TEST_ARGS="-l${cf_dir}${DFT_ARG_SUFFIX} $TEST_ARGS"
4179 TEST_ARG2="-l${cf_dir}${DFT_ARG_SUFFIX} $TEST_ARG2"
4184 AC_MSG_RESULT($cf_cv_src_modules)
4186 TEST_ARGS="-L${LIB_DIR} $TEST_ARGS"
4187 TEST_ARG2="-L${LIB_2ND} $TEST_ARG2"
4195 SRC_SUBDIRS="man include"
4196 for cf_dir in $cf_cv_src_modules
4198 SRC_SUBDIRS="$SRC_SUBDIRS $cf_dir"
4200 SRC_SUBDIRS="$SRC_SUBDIRS test"
4201 test -z "$MAKE_TERMINFO" && SRC_SUBDIRS="$SRC_SUBDIRS misc"
4202 test "$cf_with_cxx_binding" != no && SRC_SUBDIRS="$SRC_SUBDIRS c++"
4205 if test "$cf_cv_prog_gnat_correct" = yes && test -f $srcdir/Ada95/Makefile.in; then
4206 SRC_SUBDIRS="$SRC_SUBDIRS Ada95"
4207 ADA_SUBDIRS="gen src samples"
4211 for cf_dir in $SRC_SUBDIRS
4213 SUB_MAKEFILES="$SUB_MAKEFILES $cf_dir/Makefile"
4216 if test -n "$ADA_SUBDIRS"; then
4217 for cf_dir in $ADA_SUBDIRS
4219 SUB_MAKEFILES="$SUB_MAKEFILES Ada95/$cf_dir/Makefile"
4221 AC_SUBST(ADA_SUBDIRS)
4224 dnl ---------------------------------------------------------------------------
4225 dnl CF_STDCPP_LIBRARY version: 5 updated: 2000/08/12 23:18:52
4226 dnl -----------------
4227 dnl Check for -lstdc++, which is GNU's standard C++ library.
4228 AC_DEFUN([CF_STDCPP_LIBRARY],
4230 if test -n "$GXX" ; then
4231 case $cf_cv_system_name in #(vi
4233 cf_stdcpp_libname=stdcpp
4236 cf_stdcpp_libname=stdc++
4239 AC_CACHE_CHECK(for library $cf_stdcpp_libname,cf_cv_libstdcpp,[
4241 LIBS="$LIBS -l$cf_stdcpp_libname"
4243 #include <strstream.h>],[
4245 strstreambuf foo(buf, sizeof(buf))
4247 [cf_cv_libstdcpp=yes],
4248 [cf_cv_libstdcpp=no])
4251 test "$cf_cv_libstdcpp" = yes && CXXLIBS="$CXXLIBS -l$cf_stdcpp_libname"
4254 dnl ---------------------------------------------------------------------------
4255 dnl CF_STRIP_G_OPT version: 3 updated: 2002/12/21 19:25:52
4257 dnl Remove "-g" option from the compiler options
4258 AC_DEFUN([CF_STRIP_G_OPT],
4259 [$1=`echo ${$1} | sed -e 's%-g %%' -e 's%-g$%%'`])dnl
4260 dnl ---------------------------------------------------------------------------
4261 dnl CF_STRUCT_SIGACTION version: 3 updated: 2000/08/12 23:18:52
4262 dnl -------------------
4263 dnl Check if we need _POSIX_SOURCE defined to use struct sigaction. We'll only
4264 dnl do this if we've found the sigaction function.
4266 dnl If needed, define SVR4_ACTION.
4267 AC_DEFUN([CF_STRUCT_SIGACTION],[
4268 if test "$ac_cv_func_sigaction" = yes; then
4269 AC_MSG_CHECKING(whether sigaction needs _POSIX_SOURCE)
4271 #include <sys/types.h>
4272 #include <signal.h>],
4273 [struct sigaction act],
4277 #define _POSIX_SOURCE
4278 #include <sys/types.h>
4279 #include <signal.h>],
4280 [struct sigaction act],
4282 AC_DEFINE(SVR4_ACTION)],
4283 [sigact_bad=unknown])])
4284 AC_MSG_RESULT($sigact_bad)
4287 dnl ---------------------------------------------------------------------------
4288 dnl CF_STRUCT_TERMIOS version: 5 updated: 2000/11/04 12:22:46
4289 dnl -----------------
4290 dnl Some machines require _POSIX_SOURCE to completely define struct termios.
4291 dnl If so, define SVR4_TERMIO
4292 AC_DEFUN([CF_STRUCT_TERMIOS],[
4298 if test "$ISC" = yes ; then
4299 AC_CHECK_HEADERS( sys/termio.h )
4301 if test "$ac_cv_header_termios_h" = yes ; then
4302 case "$CFLAGS $CPPFLAGS" in
4304 termios_bad=dunno ;;
4305 *) termios_bad=maybe ;;
4307 if test "$termios_bad" = maybe ; then
4308 AC_MSG_CHECKING(whether termios.h needs _POSIX_SOURCE)
4309 AC_TRY_COMPILE([#include <termios.h>],
4310 [struct termios foo; int x = foo.c_iflag],
4313 #define _POSIX_SOURCE
4314 #include <termios.h>],
4315 [struct termios foo; int x = foo.c_iflag],
4316 termios_bad=unknown,
4317 termios_bad=yes AC_DEFINE(SVR4_TERMIO))
4319 AC_MSG_RESULT($termios_bad)
4323 dnl ---------------------------------------------------------------------------
4324 dnl CF_SUBST version: 4 updated: 2006/06/17 12:33:03
4326 dnl Shorthand macro for substituting things that the user may override
4327 dnl with an environment variable.
4329 dnl $1 = long/descriptive name
4330 dnl $2 = environment variable
4331 dnl $3 = default value
4332 AC_DEFUN([CF_SUBST],
4333 [AC_CACHE_VAL(cf_cv_subst_$2,[
4334 AC_MSG_CHECKING(for $1 (symbol $2))
4335 CF_SUBST_IF([-z "[$]$2"], [$2], [$3])
4336 cf_cv_subst_$2=[$]$2
4337 AC_MSG_RESULT([$]$2)
4340 dnl ---------------------------------------------------------------------------
4341 dnl CF_SUBST_IF version: 2 updated: 2006/06/17 12:33:03
4343 dnl Shorthand macro for substituting things that the user may override
4344 dnl with an environment variable.
4346 dnl $1 = condition to pass to "test"
4347 dnl $2 = environment variable
4348 dnl $3 = value if the test succeeds
4349 dnl $4 = value if the test fails
4350 AC_DEFUN([CF_SUBST_IF],
4359 dnl ---------------------------------------------------------------------------
4360 dnl CF_SUBST_NCURSES_VERSION version: 8 updated: 2006/09/16 11:40:59
4361 dnl ------------------------
4362 dnl Get the version-number for use in shared-library naming, etc.
4363 AC_DEFUN([CF_SUBST_NCURSES_VERSION],
4365 AC_REQUIRE([CF_PROG_EGREP])
4366 NCURSES_MAJOR="`$ac_cv_prog_egrep '^NCURSES_MAJOR[[ ]]*=' $srcdir/dist.mk | sed -e 's/^[[^0-9]]*//'`"
4367 NCURSES_MINOR="`$ac_cv_prog_egrep '^NCURSES_MINOR[[ ]]*=' $srcdir/dist.mk | sed -e 's/^[[^0-9]]*//'`"
4368 NCURSES_PATCH="`$ac_cv_prog_egrep '^NCURSES_PATCH[[ ]]*=' $srcdir/dist.mk | sed -e 's/^[[^0-9]]*//'`"
4369 cf_cv_abi_version=${NCURSES_MAJOR}
4370 cf_cv_rel_version=${NCURSES_MAJOR}.${NCURSES_MINOR}
4371 dnl Show the computed version, for logging
4372 cf_cv_timestamp=`date`
4373 AC_MSG_RESULT(Configuring NCURSES $cf_cv_rel_version ABI $cf_cv_abi_version ($cf_cv_timestamp))
4374 dnl We need these values in the generated headers
4375 AC_SUBST(NCURSES_MAJOR)
4376 AC_SUBST(NCURSES_MINOR)
4377 AC_SUBST(NCURSES_PATCH)
4378 dnl We need these values in the generated makefiles
4379 AC_SUBST(cf_cv_rel_version)
4380 AC_SUBST(cf_cv_abi_version)
4381 AC_SUBST(cf_cv_builtin_bool)
4382 AC_SUBST(cf_cv_header_stdbool_h)
4383 AC_SUBST(cf_cv_type_of_bool)dnl
4385 dnl ---------------------------------------------------------------------------
4386 dnl CF_SYS_TIME_SELECT version: 4 updated: 2000/10/04 09:18:40
4387 dnl ------------------
4388 dnl Check if we can include <sys/time.h> with <sys/select.h>; this breaks on
4389 dnl older SCO configurations.
4390 AC_DEFUN([CF_SYS_TIME_SELECT],
4392 AC_MSG_CHECKING(if sys/time.h works with sys/select.h)
4393 AC_CACHE_VAL(cf_cv_sys_time_select,[
4395 #include <sys/types.h>
4396 #ifdef HAVE_SYS_TIME_H
4397 #include <sys/time.h>
4399 #ifdef HAVE_SYS_SELECT_H
4400 #include <sys/select.h>
4402 ],[],[cf_cv_sys_time_select=yes],
4403 [cf_cv_sys_time_select=no])
4405 AC_MSG_RESULT($cf_cv_sys_time_select)
4406 test "$cf_cv_sys_time_select" = yes && AC_DEFINE(HAVE_SYS_TIME_SELECT)
4408 dnl ---------------------------------------------------------------------------
4409 dnl CF_TOP_BUILDDIR version: 1 updated: 2006/10/15 16:33:23
4411 dnl Define a top_builddir symbol, for applications that need an absolute path.
4412 AC_DEFUN([CF_TOP_BUILDDIR],
4415 AC_SUBST(top_builddir)
4417 dnl ---------------------------------------------------------------------------
4418 dnl CF_TYPEOF_CHTYPE version: 8 updated: 2006/12/16 12:33:30
4419 dnl ----------------
4420 dnl Determine the type we should use for chtype (and attr_t, which is treated
4421 dnl as the same thing). We want around 32 bits, so on most machines want a
4422 dnl long, but on newer 64-bit machines, probably want an int. If we're using
4423 dnl wide characters, we have to have a type compatible with that, as well.
4424 AC_DEFUN([CF_TYPEOF_CHTYPE],
4426 AC_MSG_CHECKING([for type of chtype])
4427 AC_CACHE_VAL(cf_cv_typeof_chtype,[
4429 #define WANT_BITS 31
4433 FILE *fp = fopen("cf_test.out", "w");
4435 char *result = "long";
4436 if (sizeof(unsigned long) > sizeof(unsigned int)) {
4439 for (n = 0; n < WANT_BITS; n++) {
4442 if (y != 1 || x == 0) {
4448 * If x is nonzero, an int is big enough for the bits
4451 result = (x != 0) ? "int" : "long";
4456 ${cf_cv_main_return:-return}(0);
4459 [cf_cv_typeof_chtype=`cat cf_test.out`],
4460 [cf_cv_typeof_chtype=long],
4461 [cf_cv_typeof_chtype=long])
4464 AC_MSG_RESULT($cf_cv_typeof_chtype)
4466 AC_SUBST(cf_cv_typeof_chtype)
4467 AC_DEFINE_UNQUOTED(TYPEOF_CHTYPE,$cf_cv_typeof_chtype)
4469 dnl ---------------------------------------------------------------------------
4470 dnl CF_TYPE_SIGACTION version: 3 updated: 2000/08/12 23:18:52
4471 dnl -----------------
4473 AC_DEFUN([CF_TYPE_SIGACTION],
4475 AC_MSG_CHECKING([for type sigaction_t])
4476 AC_CACHE_VAL(cf_cv_type_sigaction,[
4478 #include <signal.h>],
4480 [cf_cv_type_sigaction=yes],
4481 [cf_cv_type_sigaction=no])])
4482 AC_MSG_RESULT($cf_cv_type_sigaction)
4483 test "$cf_cv_type_sigaction" = yes && AC_DEFINE(HAVE_TYPE_SIGACTION)
4485 dnl ---------------------------------------------------------------------------
4486 dnl CF_UNSIGNED_LITERALS version: 2 updated: 1998/02/07 22:10:16
4487 dnl --------------------
4488 dnl Test if the compiler supports 'U' and 'L' suffixes. Only old compilers
4489 dnl won't, but they're still there.
4490 AC_DEFUN([CF_UNSIGNED_LITERALS],
4492 AC_MSG_CHECKING([if unsigned literals are legal])
4493 AC_CACHE_VAL(cf_cv_unsigned_literals,[
4494 AC_TRY_COMPILE([],[long x = 1L + 1UL + 1U + 1],
4495 [cf_cv_unsigned_literals=yes],
4496 [cf_cv_unsigned_literals=no])
4498 AC_MSG_RESULT($cf_cv_unsigned_literals)
4500 dnl ---------------------------------------------------------------------------
4501 dnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59
4503 dnl Make an uppercase version of a variable
4504 dnl $1=uppercase($2)
4505 AC_DEFUN([CF_UPPER],
4507 $1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
4509 dnl ---------------------------------------------------------------------------
4510 dnl CF_VERBOSE version: 2 updated: 1997/09/05 10:45:14
4512 dnl Use AC_VERBOSE w/o the warnings
4513 AC_DEFUN([CF_VERBOSE],
4514 [test -n "$verbose" && echo " $1" 1>&AC_FD_MSG
4516 dnl ---------------------------------------------------------------------------
4517 dnl CF_WCHAR_TYPE version: 2 updated: 2004/01/17 19:18:20
4519 dnl Check if type wide-character type $1 is declared, and if so, which header
4520 dnl file is needed. The second parameter is used to set a shell variable when
4521 dnl the type is not found. The first parameter sets a shell variable for the
4523 AC_DEFUN([CF_WCHAR_TYPE],
4525 # This is needed on Tru64 5.0 to declare $1
4526 AC_CACHE_CHECK(if we must include wchar.h to declare $1,cf_cv_$1,[
4531 #ifdef HAVE_LIBUTF8_H
4532 #include <libutf8.h>
4541 #ifdef HAVE_LIBUTF8_H
4542 #include <libutf8.h>
4546 [cf_cv_$1=unknown])])])
4548 if test "$cf_cv_$1" = yes ; then
4549 AC_DEFINE(NEED_WCHAR_H)
4554 # if we do not find $1 in either place, use substitution to provide a fallback.
4555 if test "$cf_cv_$1" = unknown ; then
4560 # if we find $1 in either place, use substitution to provide a fallback.
4561 if test "$cf_cv_$1" != unknown ; then
4566 dnl ---------------------------------------------------------------------------
4567 dnl CF_WITH_ABI_VERSION version: 1 updated: 2003/09/20 18:12:49
4568 dnl -------------------
4569 dnl Allow library's ABI to be overridden. Generally this happens when a
4570 dnl packager has incremented the ABI past that used in the original package,
4571 dnl and wishes to keep doing this.
4573 dnl $1 is the package name, if any, to derive a corresponding {package}_ABI
4575 AC_DEFUN([CF_WITH_ABI_VERSION],[
4576 test -z "$cf_cv_abi_version" && cf_cv_abi_version=0
4577 AC_ARG_WITH(abi-version,
4578 [ --with-abi-version=XXX override derived ABI version],
4579 [AC_MSG_WARN(overriding ABI version $cf_cv_abi_version to $withval)
4580 cf_cv_abi_version=$withval])
4581 CF_NUMBER_SYNTAX($cf_cv_abi_version,ABI version)
4583 $1_ABI=$cf_cv_abi_version
4586 dnl ---------------------------------------------------------------------------
4587 dnl CF_WITH_DBMALLOC version: 6 updated: 2006/12/16 14:24:05
4588 dnl ----------------
4589 dnl Configure-option for dbmalloc. The optional parameter is used to override
4590 dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests.
4591 AC_DEFUN([CF_WITH_DBMALLOC],[
4592 CF_NO_LEAKS_OPTION(dbmalloc,
4593 [ --with-dbmalloc test: use Conor Cahill's dbmalloc library],
4596 if test "$with_dbmalloc" = yes ; then
4597 AC_CHECK_HEADER(dbmalloc.h,
4598 [AC_CHECK_LIB(dbmalloc,[debug_malloc]ifelse($1,,[],[,$1]))])
4601 dnl ---------------------------------------------------------------------------
4602 dnl CF_WITH_DMALLOC version: 6 updated: 2006/12/16 14:24:05
4604 dnl Configure-option for dmalloc. The optional parameter is used to override
4605 dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests.
4606 AC_DEFUN([CF_WITH_DMALLOC],[
4607 CF_NO_LEAKS_OPTION(dmalloc,
4608 [ --with-dmalloc test: use Gray Watson's dmalloc library],
4611 if test "$with_dmalloc" = yes ; then
4612 AC_CHECK_HEADER(dmalloc.h,
4613 [AC_CHECK_LIB(dmalloc,[dmalloc_debug]ifelse($1,,[],[,$1]))])
4616 dnl ---------------------------------------------------------------------------
4617 dnl CF_WITH_GPM version: 6 updated: 2006/12/17 11:12:09
4620 dnl The option parameter (if neither yes/no) is assumed to be the name of
4621 dnl the gpm library, e.g., for dynamic loading.
4622 AC_DEFUN([CF_WITH_GPM],
4624 AC_MSG_CHECKING(if you want to link with the GPM mouse library)
4626 [ --with-gpm use Alessandro Rubini's GPM library],
4627 [with_gpm=$withval],
4629 AC_MSG_RESULT($with_gpm)
4631 if test "$with_gpm" != no ; then
4632 AC_CHECK_HEADER(gpm.h,[
4633 AC_DEFINE(HAVE_GPM_H)
4634 if test "$with_gpm" != yes && test "$with_gpm" != maybe ; then
4635 CF_VERBOSE(assuming we really have GPM library)
4636 AC_DEFINE(HAVE_LIBGPM)
4638 AC_CHECK_LIB(gpm,Gpm_Open,[:],[
4639 AC_ERROR(Cannot link with GPM library)
4644 test "$with_gpm" != maybe && AC_MSG_WARN(Cannot find GPM header)
4649 dnl ---------------------------------------------------------------------------
4650 dnl CF_WITH_LIBTOOL version: 12 updated: 2006/12/30 19:00:13
4652 dnl Provide a configure option to incorporate libtool. Define several useful
4653 dnl symbols for the makefile rules.
4655 dnl The reference to AC_PROG_LIBTOOL does not normally work, since it uses
4656 dnl macros from libtool.m4 which is in the aclocal directory of automake.
4657 dnl Following is a simple script which turns on the AC_PROG_LIBTOOL macro.
4658 dnl But that still does not work properly since the macro is expanded outside
4659 dnl the CF_WITH_LIBTOOL macro:
4662 dnl ACLOCAL=`aclocal --print-ac-dir`
4663 dnl if test -z "$ACLOCAL" ; then
4664 dnl echo cannot find aclocal directory
4666 dnl elif test ! -f $ACLOCAL/libtool.m4 ; then
4667 dnl echo cannot find libtool.m4 file
4671 dnl LOCAL=aclocal.m4
4672 dnl ORIG=aclocal.m4.orig
4674 dnl trap "mv $ORIG $LOCAL" 0 1 2 5 15
4678 dnl # sed the LIBTOOL= assignment to omit the current directory?
4679 dnl sed -e 's/^LIBTOOL=.*/LIBTOOL=${LIBTOOL-libtool}/' $ACLOCAL/libtool.m4 >>$LOCAL
4680 dnl cat $ORIG >>$LOCAL
4684 AC_DEFUN([CF_WITH_LIBTOOL],
4686 ifdef([AC_PROG_LIBTOOL],,[
4689 # common library maintenance symbols that are convenient for libtool scripts:
4690 LIB_CREATE='${AR} -cr'
4691 LIB_OBJECT='${OBJECTS}'
4695 # symbols used to prop libtool up to enable it to determine what it should be
4703 AC_MSG_CHECKING(if you want to build libraries with libtool)
4704 AC_ARG_WITH(libtool,
4705 [ --with-libtool generate libraries with libtool],
4706 [with_libtool=$withval],
4708 AC_MSG_RESULT($with_libtool)
4709 if test "$with_libtool" != "no"; then
4710 ifdef([AC_PROG_LIBTOOL],[
4711 # missing_content_AC_PROG_LIBTOOL{{
4713 # missing_content_AC_PROG_LIBTOOL}}
4715 if test "$with_libtool" != "yes" ; then
4716 CF_PATH_SYNTAX(with_libtool)
4717 LIBTOOL=$with_libtool
4719 AC_PATH_PROG(LIBTOOL,libtool)
4721 if test -z "$LIBTOOL" ; then
4722 AC_MSG_ERROR(Cannot find libtool)
4725 LIB_CREATE='${LIBTOOL} --mode=link ${CC} -rpath ${DESTDIR}${libdir} -version-info `cut -f1 ${srcdir}/VERSION` -o'
4726 LIB_OBJECT='${OBJECTS}.o=.lo)'
4728 LIB_CLEAN='${LIBTOOL} --mode=clean'
4729 LIB_COMPILE='${LIBTOOL} --mode=compile'
4730 LIB_LINK='${LIBTOOL} --mode=link'
4731 LIB_INSTALL='${LIBTOOL} --mode=install'
4732 LIB_UNINSTALL='${LIBTOOL} --mode=uninstall'
4735 # Show the version of libtool
4736 AC_MSG_CHECKING(version of libtool)
4738 # Save the version in a cache variable - this is not entirely a good
4739 # thing, but the version string from libtool is very ugly, and for
4740 # bug reports it might be useful to have the original string.
4741 cf_cv_libtool_version=`$LIBTOOL --version 2>&1 | sed -e '/^$/d' -e '2,$d' -e 's/([[^)]]*)//g' -e 's/^[[^1-9]]*//' -e 's/[[^0-9.]].*//'`
4742 AC_MSG_RESULT($cf_cv_libtool_version)
4743 if test -z "$cf_cv_libtool_version" ; then
4744 AC_MSG_ERROR(This is not libtool)
4747 # special hack to add --tag option for C++ compiler
4748 case $cf_cv_libtool_version in
4749 1.[[5-9]]*|[[2-9]]*)
4750 LIBTOOL_CXX="$LIBTOOL --tag=CXX"
4753 LIBTOOL_CXX="$LIBTOOL"
4761 test -z "$LIBTOOL" && ECHO_LT=
4764 AC_SUBST(LIBTOOL_CXX)
4766 AC_SUBST(LIB_CREATE)
4767 AC_SUBST(LIB_OBJECT)
4768 AC_SUBST(LIB_SUFFIX)
4772 AC_SUBST(LIB_COMPILE)
4774 AC_SUBST(LIB_INSTALL)
4775 AC_SUBST(LIB_UNINSTALL)
4778 dnl ---------------------------------------------------------------------------
4779 dnl CF_WITH_PATH version: 7 updated: 2006/08/03 15:20:08
4781 dnl Wrapper for AC_ARG_WITH to ensure that user supplies a pathname, not just
4782 dnl defaulting to yes/no.
4784 dnl $1 = option name
4786 dnl $3 = environment variable to set
4787 dnl $4 = default value, shown in the help-message, must be a constant
4788 dnl $5 = default value, if it's an expression & cannot be in the help-message
4790 AC_DEFUN([CF_WITH_PATH],
4791 [AC_ARG_WITH($1,[$2 ](default: ifelse($4,,empty,$4)),,
4792 ifelse($4,,[withval="${$3}"],[withval="${$3-ifelse($5,,$4,$5)}"]))dnl
4793 CF_PATH_SYNTAX(withval)
4797 dnl ---------------------------------------------------------------------------
4798 dnl CF_WITH_PATHLIST version: 5 updated: 2001/12/10 01:28:30
4799 dnl ----------------
4800 dnl Process an option specifying a list of colon-separated paths.
4802 dnl $1 = option name
4804 dnl $3 = environment variable to set
4805 dnl $4 = default value, shown in the help-message, must be a constant
4806 dnl $5 = default value, if it's an expression & cannot be in the help-message
4807 dnl $6 = flag to tell if we want to define or substitute
4809 AC_DEFUN([CF_WITH_PATHLIST],[
4810 AC_REQUIRE([CF_PATHSEP])
4811 AC_ARG_WITH($1,[$2 ](default: ifelse($4,,empty,$4)),,
4812 ifelse($4,,[withval=${$3}],[withval=${$3-ifelse($5,,$4,$5)}]))dnl
4814 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${PATHSEP}"
4816 for cf_src_path in $withval
4818 CF_PATH_SYNTAX(cf_src_path)
4819 test -n "$cf_dst_path" && cf_dst_path="${cf_dst_path}:"
4820 cf_dst_path="${cf_dst_path}${cf_src_path}"
4825 # Strip single quotes from the value, e.g., when it was supplied as a literal
4827 case $cf_dst_path in #(vi
4829 cf_dst_path=`echo $cf_dst_path |sed -e s/\'// -e s/\'\$//`
4832 cf_dst_path=`echo "$cf_dst_path" | sed -e 's/\\\\/\\\\\\\\/g'`
4835 eval '$3="$cf_dst_path"'
4839 dnl ---------------------------------------------------------------------------
4840 dnl CF_WITH_REL_VERSION version: 1 updated: 2003/09/20 18:12:49
4841 dnl -------------------
4842 dnl Allow library's release-version to be overridden. Generally this happens when a
4843 dnl packager has incremented the release-version past that used in the original package,
4844 dnl and wishes to keep doing this.
4846 dnl $1 is the package name, if any, to derive corresponding {package}_MAJOR
4847 dnl and {package}_MINOR symbols
4849 AC_DEFUN([CF_WITH_REL_VERSION],[
4850 test -z "$cf_cv_rel_version" && cf_cv_rel_version=0.0
4851 AC_ARG_WITH(rel-version,
4852 [ --with-rel-version=XXX override derived release version],
4853 [AC_MSG_WARN(overriding release version $cf_cv_rel_version to $withval)
4854 cf_cv_rel_version=$withval])
4856 CF_NUMBER_SYNTAX($cf_cv_rel_version,Release version)
4858 $1_MAJOR=`echo "$cf_cv_rel_version" | sed -e 's/\..*//'`
4859 $1_MINOR=`echo "$cf_cv_rel_version" | sed -e 's/^[[^.]]*//' -e 's/^\.//' -e 's/\..*//'`
4860 CF_NUMBER_SYNTAX([$]$1_MAJOR,Release major-version)
4861 CF_NUMBER_SYNTAX([$]$1_MINOR,Release minor-version)
4864 dnl ---------------------------------------------------------------------------
4865 dnl CF_WITH_SYSMOUSE version: 2 updated: 2003/03/22 19:13:43
4866 dnl ----------------
4867 dnl If we can compile with sysmouse, make it available unless it is not wanted.
4868 AC_DEFUN([CF_WITH_SYSMOUSE],[
4869 # not everyone has "test -c"
4870 if test -c /dev/sysmouse 2>/dev/null ; then
4871 AC_MSG_CHECKING(if you want to use sysmouse)
4872 AC_ARG_WITH(sysmouse,
4873 [ --with-sysmouse use sysmouse (FreeBSD console)],
4874 [cf_with_sysmouse=$withval],
4875 [cf_with_sysmouse=maybe])
4876 if test "$cf_with_sysmouse" != no ; then
4878 #include <osreldate.h>
4879 #if (__FreeBSD_version >= 400017)
4880 #include <sys/consio.h>
4881 #include <sys/fbio.h>
4883 #include <machine/console.h>
4886 struct mouse_info the_mouse;
4887 ioctl(0, CONS_MOUSECTL, &the_mouse);
4888 ],[cf_with_sysmouse=yes],[cf_with_sysmouse=no])
4890 AC_MSG_RESULT($cf_with_sysmouse)
4891 test "$cf_with_sysmouse" = yes && AC_DEFINE(USE_SYSMOUSE)
4894 dnl ---------------------------------------------------------------------------
4895 dnl CF_WITH_VALGRIND version: 1 updated: 2006/12/14 18:00:21
4896 dnl ----------------
4897 AC_DEFUN([CF_WITH_VALGRIND],[
4898 CF_NO_LEAKS_OPTION(valgrind,
4899 [ --with-valgrind test: use valgrind],
4902 dnl ---------------------------------------------------------------------------
4903 dnl CF_XOPEN_SOURCE version: 24 updated: 2006/04/02 16:41:09
4905 dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions,
4906 dnl or adapt to the vendor's definitions to get equivalent functionality,
4907 dnl without losing the common non-POSIX features.
4910 dnl $1 is the nominal value for _XOPEN_SOURCE
4911 dnl $2 is the nominal value for _POSIX_C_SOURCE
4912 AC_DEFUN([CF_XOPEN_SOURCE],[
4914 AC_REQUIRE([CF_PROG_CC_U_D])
4916 cf_XOPEN_SOURCE=ifelse($1,,500,$1)
4917 cf_POSIX_C_SOURCE=ifelse($2,,199506L,$2)
4919 case $host_os in #(vi
4921 CPPFLAGS="$CPPFLAGS -D_ALL_SOURCE"
4924 # 5.x headers associate
4925 # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L
4926 # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L
4927 cf_POSIX_C_SOURCE=200112L
4929 CPPFLAGS="$CPPFLAGS -D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
4932 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE"
4935 CPPFLAGS="$CPPFLAGS -D_SGI_SOURCE"
4941 # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <arpa/inet.h>
4944 # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw
4947 # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw
4950 CPPFLAGS="$CPPFLAGS -D_OSF_SOURCE"
4953 CPPFLAGS="$CPPFLAGS -D_QNX_SOURCE"
4956 # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer
4959 CPPFLAGS="$CPPFLAGS -D__EXTENSIONS__"
4962 AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[
4963 AC_TRY_COMPILE([#include <sys/types.h>],[
4964 #ifndef _XOPEN_SOURCE
4967 [cf_cv_xopen_source=no],
4968 [cf_save="$CPPFLAGS"
4969 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
4970 AC_TRY_COMPILE([#include <sys/types.h>],[
4971 #ifdef _XOPEN_SOURCE
4974 [cf_cv_xopen_source=no],
4975 [cf_cv_xopen_source=$cf_XOPEN_SOURCE])
4979 if test "$cf_cv_xopen_source" != no ; then
4980 CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE)
4981 CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE)
4982 test "$cf_cv_cc_u_d_options" = yes && \
4983 CPPFLAGS="$CPPFLAGS -U_XOPEN_SOURCE"
4984 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_cv_xopen_source"
4986 CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE)