1 dnl***************************************************************************
2 dnl Copyright (c) 1998-2004,2005 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.373 2005/09/24 21:58:59 tom Exp $
32 dnl Macros used in NCURSES auto-configuration script.
34 dnl See http://invisible-island.net/autoconf/ for additional information.
36 dnl ---------------------------------------------------------------------------
37 dnl ---------------------------------------------------------------------------
38 dnl AM_LANGINFO_CODESET version: 3 updated: 2002/10/27 23:21:42
39 dnl -------------------
40 dnl Inserted as requested by gettext 0.10.40
41 dnl File from /usr/share/aclocal
43 dnl ====================
46 dnl From Bruno Haible.
47 AC_DEFUN([AM_LANGINFO_CODESET],
49 AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
50 [AC_TRY_LINK([#include <langinfo.h>],
51 [char* cs = nl_langinfo(CODESET);],
52 am_cv_langinfo_codeset=yes,
53 am_cv_langinfo_codeset=no)
55 if test $am_cv_langinfo_codeset = yes; then
56 AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
57 [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
60 dnl ---------------------------------------------------------------------------
61 dnl CF_ADA_INCLUDE_DIRS version: 4 updated: 2002/12/01 00:12:15
62 dnl -------------------
63 dnl Construct the list of include-options for the C programs in the Ada95
65 AC_DEFUN([CF_ADA_INCLUDE_DIRS],
67 ACPPFLAGS="-I. -I../../include $ACPPFLAGS"
68 if test "$srcdir" != "."; then
69 ACPPFLAGS="-I\$(srcdir)/../../include $ACPPFLAGS"
71 if test "$GCC" != yes; then
72 ACPPFLAGS="$ACPPFLAGS -I\$(includedir)"
73 elif test "$includedir" != "/usr/include"; then
74 if test "$includedir" = '${prefix}/include' ; then
75 if test $prefix != /usr ; then
76 ACPPFLAGS="$ACPPFLAGS -I\$(includedir)"
79 ACPPFLAGS="$ACPPFLAGS -I\$(includedir)"
84 dnl ---------------------------------------------------------------------------
85 dnl CF_ADD_CFLAGS version: 7 updated: 2004/04/25 17:48:30
87 dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS
88 dnl The second parameter if given makes this macro verbose.
90 dnl Put any preprocessor definitions that use quoted strings in $EXTRA_CPPFLAGS,
91 dnl to simplify use of $CPPFLAGS in compiler checks, etc., that are easily
92 dnl confused by the quotes (which require backslashes to keep them usable).
93 AC_DEFUN([CF_ADD_CFLAGS],
98 cf_new_extra_cppflags=
100 for cf_add_cflags in $1
102 case $cf_fix_cppflags in
104 case $cf_add_cflags in #(vi
105 -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi
106 case $cf_add_cflags in
108 cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[[^=]]*='\''\"[[^"]]*//'`
110 test "${cf_add_cflags}" != "${cf_tst_cflags}" \
111 && test -z "${cf_tst_cflags}" \
112 && cf_fix_cppflags=yes
114 if test $cf_fix_cppflags = yes ; then
115 cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
117 elif test "${cf_tst_cflags}" = "\"'" ; then
118 cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
124 *$cf_add_cflags) #(vi
127 cf_new_cppflags="$cf_new_cppflags $cf_add_cflags"
132 cf_new_cflags="$cf_new_cflags $cf_add_cflags"
137 cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
139 cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[[^"]]*"'\''//'`
141 test "${cf_add_cflags}" != "${cf_tst_cflags}" \
142 && test -z "${cf_tst_cflags}" \
143 && cf_fix_cppflags=no
148 if test -n "$cf_new_cflags" ; then
149 ifelse($2,,,[CF_VERBOSE(add to \$CFLAGS $cf_new_cflags)])
150 CFLAGS="$CFLAGS $cf_new_cflags"
153 if test -n "$cf_new_cppflags" ; then
154 ifelse($2,,,[CF_VERBOSE(add to \$CPPFLAGS $cf_new_cppflags)])
155 CPPFLAGS="$cf_new_cppflags $CPPFLAGS"
158 if test -n "$cf_new_extra_cppflags" ; then
159 ifelse($2,,,[CF_VERBOSE(add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags)])
160 EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
163 AC_SUBST(EXTRA_CPPFLAGS)
166 dnl ---------------------------------------------------------------------------
167 dnl CF_ANSI_CC_CHECK version: 9 updated: 2001/12/30 17:53:34
169 dnl This is adapted from the macros 'fp_PROG_CC_STDC' and 'fp_C_PROTOTYPES'
170 dnl in the sharutils 4.2 distribution.
171 AC_DEFUN([CF_ANSI_CC_CHECK],
173 AC_CACHE_CHECK(for ${CC-cc} option to accept ANSI C, cf_cv_ansi_cc,[
175 cf_save_CFLAGS="$CFLAGS"
176 cf_save_CPPFLAGS="$CPPFLAGS"
177 # Don't try gcc -ansi; that turns off useful extensions and
178 # breaks some systems' header files.
180 # Ultrix and OSF/1 -std1
181 # HP-UX -Aa -D_HPUX_SOURCE
183 # UnixWare 1.2 (cannot use -Xc, since ANSI/POSIX clashes)
184 for cf_arg in "-DCC_HAS_PROTOS" \
189 "-Aa -D_HPUX_SOURCE" \
192 CF_ADD_CFLAGS($cf_arg)
195 #ifndef CC_HAS_PROTOS
196 #if !defined(__STDC__) || (__STDC__ != 1)
201 int test (int i, double x);
202 struct s1 {int (*f) (int a);};
203 struct s2 {int (*f) (double a);};],
204 [cf_cv_ansi_cc="$cf_arg"; break])
206 CFLAGS="$cf_save_CFLAGS"
207 CPPFLAGS="$cf_save_CPPFLAGS"
210 if test "$cf_cv_ansi_cc" != "no"; then
211 if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then
212 CF_ADD_CFLAGS($cf_cv_ansi_cc)
214 AC_DEFINE(CC_HAS_PROTOS)
218 dnl ---------------------------------------------------------------------------
219 dnl CF_ANSI_CC_REQD version: 3 updated: 1997/09/06 13:40:44
221 dnl For programs that must use an ANSI compiler, obtain compiler options that
222 dnl will make it recognize prototypes. We'll do preprocessor checks in other
223 dnl macros, since tools such as unproto can fake prototypes, but only part of
224 dnl the preprocessor.
225 AC_DEFUN([CF_ANSI_CC_REQD],
226 [AC_REQUIRE([CF_ANSI_CC_CHECK])
227 if test "$cf_cv_ansi_cc" = "no"; then
229 [Your compiler does not appear to recognize prototypes.
230 You have the following choices:
231 a. adjust your compiler options
232 b. get an up-to-date compiler
233 c. use a wrapper such as unproto])
236 dnl ---------------------------------------------------------------------------
237 dnl CF_BOOL_DECL version: 8 updated: 2004/01/30 15:51:18
239 dnl Test if 'bool' is a builtin type in the configured C++ compiler. Some
240 dnl older compilers (e.g., gcc 2.5.8) don't support 'bool' directly; gcc
241 dnl 2.6.3 does, in anticipation of the ANSI C++ standard.
243 dnl Treat the configuration-variable specially here, since we're directly
244 dnl substituting its value (i.e., 1/0).
246 dnl $1 is the shell variable to store the result in, if not $cv_cv_builtin_bool
247 AC_DEFUN([CF_BOOL_DECL],
249 AC_MSG_CHECKING(if we should include stdbool.h)
251 AC_CACHE_VAL(cf_cv_header_stdbool_h,[
252 AC_TRY_COMPILE([],[bool foo = false],
253 [cf_cv_header_stdbool_h=0],
258 ],[bool foo = false],
259 [cf_cv_header_stdbool_h=1],
260 [cf_cv_header_stdbool_h=0])])])
262 if test "$cf_cv_header_stdbool_h" = 1
263 then AC_MSG_RESULT(yes)
264 else AC_MSG_RESULT(no)
267 AC_MSG_CHECKING([for builtin bool type])
269 AC_CACHE_VAL(ifelse($1,,cf_cv_builtin_bool,[$1]),[
272 #include <sys/types.h>
274 [ifelse($1,,cf_cv_builtin_bool,[$1])=1],
275 [ifelse($1,,cf_cv_builtin_bool,[$1])=0])
278 if test "$ifelse($1,,cf_cv_builtin_bool,[$1])" = 1
279 then AC_MSG_RESULT(yes)
280 else AC_MSG_RESULT(no)
283 dnl ---------------------------------------------------------------------------
284 dnl CF_BOOL_SIZE version: 10 updated: 2002/02/23 20:38:31
286 dnl Test for the size of 'bool' in the configured C++ compiler (e.g., a type).
287 dnl Don't bother looking for bool.h, since it's been deprecated.
289 dnl If the current compiler is C rather than C++, we get the bool definition
290 dnl from <stdbool.h>.
291 AC_DEFUN([CF_BOOL_SIZE],
293 AC_MSG_CHECKING([for size of bool])
294 AC_CACHE_VAL(cf_cv_type_of_bool,[
300 #if defined(__cplusplus)
302 #ifdef HAVE_GXX_BUILTIN_H
303 #include <g++/builtin.h>
304 #elif HAVE_GPP_BUILTIN_H
305 #include <gpp/builtin.h>
312 #if $cf_cv_header_stdbool_h
320 FILE *fp = fopen("cf_test.out", "w");
324 fputs("unsigned ", fp);
325 if (sizeof(x) == sizeof(int)) fputs("int", fp);
326 else if (sizeof(x) == sizeof(char)) fputs("char", fp);
327 else if (sizeof(x) == sizeof(short))fputs("short",fp);
328 else if (sizeof(x) == sizeof(long)) fputs("long", fp);
334 [cf_cv_type_of_bool=`cat cf_test.out`
335 if test -z "$cf_cv_type_of_bool"; then
336 cf_cv_type_of_bool=unknown
338 [cf_cv_type_of_bool=unknown],
339 [cf_cv_type_of_bool=unknown])
342 AC_MSG_RESULT($cf_cv_type_of_bool)
343 if test "$cf_cv_type_of_bool" = unknown ; then
344 case .$NCURSES_BOOL in #(vi
345 .auto|.) NCURSES_BOOL=unsigned;;
347 AC_MSG_WARN(Assuming $NCURSES_BOOL for type of bool)
348 cf_cv_type_of_bool=$NCURSES_BOOL
351 dnl ---------------------------------------------------------------------------
352 dnl CF_BUILD_CC version: 5 updated: 2005/09/24 17:55:52
354 dnl If we're cross-compiling, allow the user to override the tools and their
355 dnl options. The configure script is oriented toward identifying the host
356 dnl compiler, etc., but we need a build compiler to generate parts of the
359 dnl $1 = default for $CPPFLAGS
360 dnl $2 = default for $LIBS
361 AC_DEFUN([CF_BUILD_CC],[
362 AC_REQUIRE([CF_PROG_EXT])
363 if test "$cross_compiling" = yes ; then
365 # defaults that we might want to override
366 : ${BUILD_CFLAGS:=''}
367 : ${BUILD_CPPFLAGS:='ifelse([$1],,,[$1])'}
368 : ${BUILD_LDFLAGS:=''}
369 : ${BUILD_LIBS:='ifelse([$2],,,[$2])'}
370 : ${BUILD_EXEEXT:='$x'}
371 : ${BUILD_OBJEXT:='o'}
373 AC_ARG_WITH(build-cc,
374 [ --with-build-cc=XXX the build C compiler ($BUILD_CC)],
375 [BUILD_CC="$withval"],
376 [AC_CHECK_PROGS(BUILD_CC, gcc cc cl)])
377 AC_MSG_CHECKING(for native build C compiler)
378 AC_MSG_RESULT($BUILD_CC)
380 AC_MSG_CHECKING(for native build C preprocessor)
381 AC_ARG_WITH(build-cpp,
382 [ --with-build-cpp=XXX the build C preprocessor ($BUILD_CPP)],
383 [BUILD_CPP="$withval"],
384 [BUILD_CPP='$(BUILD_CC) -E'])
385 AC_MSG_RESULT($BUILD_CPP)
387 AC_MSG_CHECKING(for native build C flags)
388 AC_ARG_WITH(build-cflags,
389 [ --with-build-cflags=XXX the build C compiler-flags ($BUILD_CFLAGS)],
390 [BUILD_CFLAGS="$withval"])
391 AC_MSG_RESULT($BUILD_CFLAGS)
393 AC_MSG_CHECKING(for native build C preprocessor-flags)
394 AC_ARG_WITH(build-cppflags,
395 [ --with-build-cppflags=XXX the build C preprocessor-flags ($BUILD_CPPFLAGS)],
396 [BUILD_CPPFLAGS="$withval"])
397 AC_MSG_RESULT($BUILD_CPPFLAGS)
399 AC_MSG_CHECKING(for native build linker-flags)
400 AC_ARG_WITH(build-ldflags,
401 [ --with-build-ldflags=XXX the build linker-flags ($BUILD_LDFLAGS)],
402 [BUILD_LDFLAGS="$withval"])
403 AC_MSG_RESULT($BUILD_LDFLAGS)
405 AC_MSG_CHECKING(for native build linker-libraries)
406 AC_ARG_WITH(build-libs,
407 [ --with-build-libs=XXX the build libraries ($(BUILD_LIBS)],
408 [BUILD_LIBS="$withval"])
409 AC_MSG_RESULT($BUILD_LIBS)
411 # this assumes we're on Unix.
415 : ${BUILD_CC:='$(CC)'}
417 if ( test "$BUILD_CC" = "$CC" || test "$BUILD_CC" = '$(CC)' ) ; then
418 AC_MSG_ERROR([Cross-build requires two compilers.
419 Use --with-build-cc to specify the native compiler.])
423 : ${BUILD_CC:='$(CC)'}
424 : ${BUILD_CPP:='$(CPP)'}
425 : ${BUILD_CFLAGS:='$(CFLAGS)'}
426 : ${BUILD_CPPFLAGS:='$(CPPFLAGS)'}
427 : ${BUILD_LDFLAGS:='$(LDFLAGS)'}
428 : ${BUILD_LIBS:='$(LIBS)'}
429 : ${BUILD_EXEEXT:='$x'}
430 : ${BUILD_OBJEXT:='o'}
435 AC_SUBST(BUILD_CFLAGS)
436 AC_SUBST(BUILD_CPPFLAGS)
437 AC_SUBST(BUILD_LDFLAGS)
439 AC_SUBST(BUILD_EXEEXT)
440 AC_SUBST(BUILD_OBJEXT)
442 dnl ---------------------------------------------------------------------------
443 dnl CF_CFG_DEFAULTS version: 7 updated: 2005/09/24 16:15:00
445 dnl Determine the default configuration into which we'll install ncurses. This
446 dnl can be overridden by the user's command-line options. There's two items to
448 dnl 1. the prefix (e.g., /usr)
449 dnl 2. the header files (e.g., /usr/include/ncurses)
450 dnl We'll look for a previous installation of ncurses and use the same defaults.
452 dnl We don't use AC_PREFIX_DEFAULT, because it gets evaluated too soon, and
453 dnl we don't use AC_PREFIX_PROGRAM, because we cannot distinguish ncurses's
454 dnl programs from a vendor's.
455 AC_DEFUN([CF_CFG_DEFAULTS],
457 AC_MSG_CHECKING(for prefix)
458 if test "x$prefix" = "xNONE" ; then
459 case "$cf_cv_system_name" in
460 # non-vendor systems don't have a conflict
461 openbsd*|freebsd*|linux*|cygwin*|k*bsd*-gnu)
464 *) prefix=$ac_default_prefix
468 AC_MSG_RESULT($prefix)
470 if test "x$prefix" = "xNONE" ; then
471 AC_MSG_CHECKING(for default include-directory)
472 test -n "$verbose" && echo 1>&AC_FD_MSG
475 $includedir/ncurses \
477 $prefix/include/ncurses \
479 /usr/local/include/ncurses \
483 cf_dir=`eval echo $cf_symbol`
484 if test -f $cf_dir/curses.h ; then
485 if ( fgrep NCURSES_VERSION $cf_dir/curses.h 2>&1 >/dev/null ) ; then
486 includedir="$cf_symbol"
487 test -n "$verbose" && echo $ac_n " found " 1>&AC_FD_MSG
491 test -n "$verbose" && echo " tested $cf_dir" 1>&AC_FD_MSG
493 AC_MSG_RESULT($includedir)
496 dnl ---------------------------------------------------------------------------
497 dnl CF_CGETENT version: 3 updated: 2000/08/12 23:18:52
499 dnl Check if the terminal-capability database functions are available. If not,
500 dnl ncurses has a much-reduced version.
501 AC_DEFUN([CF_CGETENT],[
502 AC_MSG_CHECKING(for terminal-capability database functions)
503 AC_CACHE_VAL(cf_cv_cgetent,[
505 #include <stdlib.h>],[
508 char *db_array = temp;
509 cgetent(&buf, /* int *, */ &db_array, "vt100");
510 cgetcap(buf, "tc", '=');
511 cgetmatch(buf, "tc");
516 AC_MSG_RESULT($cf_cv_cgetent)
517 test "$cf_cv_cgetent" = yes && AC_DEFINE(HAVE_BSD_CGETENT)
519 dnl ---------------------------------------------------------------------------
520 dnl CF_CHECK_CACHE version: 10 updated: 2004/05/23 13:03:31
522 dnl Check if we're accidentally using a cache from a different machine.
523 dnl Derive the system name, as a check for reusing the autoconf cache.
525 dnl If we've packaged config.guess and config.sub, run that (since it does a
526 dnl better job than uname). Normally we'll use AC_CANONICAL_HOST, but allow
527 dnl an extra parameter that we may override, e.g., for AC_CANONICAL_SYSTEM
528 dnl which is useful in cross-compiles.
530 dnl Note: we would use $ac_config_sub, but that is one of the places where
531 dnl autoconf 2.5x broke compatibility with autoconf 2.13
532 AC_DEFUN([CF_CHECK_CACHE],
534 if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then
535 ifelse([$1],,[AC_CANONICAL_HOST],[$1])
536 system_name="$host_os"
538 system_name="`(uname -s -r) 2>/dev/null`"
539 if test -z "$system_name" ; then
540 system_name="`(hostname) 2>/dev/null`"
543 test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name")
544 AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"])
546 test -z "$system_name" && system_name="$cf_cv_system_name"
547 test -n "$cf_cv_system_name" && AC_MSG_RESULT(Configuring for $cf_cv_system_name)
549 if test ".$system_name" != ".$cf_cv_system_name" ; then
550 AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name))
551 AC_ERROR("Please remove config.cache and try again.")
554 dnl ---------------------------------------------------------------------------
555 dnl CF_CHECK_ERRNO version: 9 updated: 2001/12/30 18:03:23
557 dnl Check for data that is usually declared in <stdio.h> or <errno.h>, e.g.,
558 dnl the 'errno' variable. Define a DECL_xxx symbol if we must declare it
561 dnl $1 = the name to check
562 AC_DEFUN([CF_CHECK_ERRNO],
564 AC_CACHE_CHECK(if external $1 is declared, cf_cv_dcl_$1,[
570 #include <sys/types.h>
571 #include <errno.h> ],
572 [long x = (long) $1],
577 if test "$cf_cv_dcl_$1" = no ; then
578 CF_UPPER(cf_result,decl_$1)
579 AC_DEFINE_UNQUOTED($cf_result)
582 # It's possible (for near-UNIX clones) that the data doesn't exist
583 CF_CHECK_EXTERN_DATA($1,int)
585 dnl ---------------------------------------------------------------------------
586 dnl CF_CHECK_EXTERN_DATA version: 3 updated: 2001/12/30 18:03:23
587 dnl --------------------
588 dnl Check for existence of external data in the current set of libraries. If
589 dnl we can modify it, it's real enough.
590 dnl $1 = the name to check
592 AC_DEFUN([CF_CHECK_EXTERN_DATA],
594 AC_CACHE_CHECK(if external $1 exists, cf_cv_have_$1,[
604 if test "$cf_cv_have_$1" = yes ; then
605 CF_UPPER(cf_result,have_$1)
606 AC_DEFINE_UNQUOTED($cf_result)
610 dnl ---------------------------------------------------------------------------
611 dnl CF_CPP_PARAM_INIT version: 4 updated: 2001/04/07 22:31:18
612 dnl -----------------
613 dnl Check if the C++ compiler accepts duplicate parameter initialization. This
614 dnl is a late feature for the standard and is not in some recent compilers
616 AC_DEFUN([CF_CPP_PARAM_INIT],
618 if test -n "$CXX"; then
619 AC_CACHE_CHECK(if $CXX accepts parameter initialization,cf_cv_cpp_param_init,[
631 TEST::TEST(int x = 1) // some compilers do not like second initializer
637 [cf_cv_cpp_param_init=yes],
638 [cf_cv_cpp_param_init=no],
639 [cf_cv_cpp_param_init=unknown])
643 test "$cf_cv_cpp_param_init" = yes && AC_DEFINE(CPP_HAS_PARAM_INIT)
645 dnl ---------------------------------------------------------------------------
646 dnl CF_CPP_STATIC_CAST version: 1 updated: 2005/07/23 16:52:43
647 dnl ------------------
648 dnl Check if the C++ compiler accepts static_cast in generics. This appears to
649 dnl not be supported in g++ before 3.0
650 AC_DEFUN([CF_CPP_STATIC_CAST],
652 if test -n "$CXX"; then
654 AC_CACHE_CHECK(if $CXX accepts static_cast,cf_cv_cpp_static_cast,[
662 NCursesPanel(int nlines,
672 template<class T> class NCursesUserPanel : public NCursesPanel
675 NCursesUserPanel (int nlines,
679 const T* p_UserData = static_cast<T*>(0))
680 : NCursesPanel (nlines, ncols, begin_y, begin_x)
683 NCursesUserPanel(const T* p_UserData = static_cast<T*>(0)) : NCursesPanel()
687 virtual ~NCursesUserPanel() {};
690 const char* p_UserData = static_cast<char*>(0)],
691 [cf_cv_cpp_static_cast=yes],
692 [cf_cv_cpp_static_cast=no])
699 test "$cf_cv_cpp_static_cast" = yes && AC_DEFINE(CPP_HAS_STATIC_CAST)
701 dnl ---------------------------------------------------------------------------
702 dnl CF_CPP_VSCAN_FUNC version: 5 updated: 2001/12/02 01:39:28
703 dnl -----------------
704 dnl Check if the g++ compiler supports vscan function (not a standard feature).
705 AC_DEFUN([CF_CPP_VSCAN_FUNC],
707 if test -n "$CXX"; then
711 AC_CHECK_HEADERS(strstream.h)
713 AC_CACHE_CHECK(if $CXX supports vscan function,cf_cv_cpp_vscan_func,[
714 for cf_vscan_func in strstream strstream_cast stdio
716 case $cf_vscan_func in #(vi
717 stdio) cf_vscan_defs=USE_STDIO_VSCAN ;; #(vi
718 strstream) cf_vscan_defs=USE_STRSTREAM_VSCAN ;;
719 strstream_cast) cf_vscan_defs=USE_STRSTREAM_VSCAN_CAST ;;
724 #define $cf_vscan_defs 1
725 #if defined(USE_STDIO_VSCAN)
726 #elif defined(HAVE_STRSTREAM_H) && defined(USE_STRSTREAM_VSCAN)
727 #include <strstream.h>
730 int scanw(const char* fmt, ...)
737 #if defined(USE_STDIO_VSCAN)
738 if (::vsscanf(buf, fmt, args) != -1)
740 #elif defined(USE_STRSTREAM_VSCAN)
741 strstreambuf ss(buf, sizeof(buf));
742 if (ss.vscan(fmt, args) != -1)
744 #elif defined(USE_STRSTREAM_VSCAN_CAST)
745 strstreambuf ss(buf, sizeof(buf));
746 if (ss.vscan(fmt, (_IO_va_list)args) != -1)
749 #error case $cf_vscan_func failed
754 ],[int tmp, foo = scanw("%d", &tmp)],
755 [cf_cv_cpp_vscan_func=$cf_vscan_func; break],
756 [cf_cv_cpp_vscan_func=no])
757 test "$cf_cv_cpp_vscan_func" != no && break
764 case $cf_cv_cpp_vscan_func in #(vi
766 AC_DEFINE(CPP_HAS_VSCAN_FUNC)
767 AC_DEFINE(USE_STDIO_VSCAN)
770 AC_DEFINE(CPP_HAS_VSCAN_FUNC)
771 AC_DEFINE(USE_STRSTREAM_VSCAN)
774 AC_DEFINE(CPP_HAS_VSCAN_FUNC)
775 AC_DEFINE(USE_STRSTREAM_VSCAN_CAST)
779 dnl ---------------------------------------------------------------------------
780 dnl CF_DIRNAME version: 4 updated: 2002/12/21 19:25:52
782 dnl "dirname" is not portable, so we fake it with a shell script.
783 AC_DEFUN([CF_DIRNAME],[$1=`echo $2 | sed -e 's%/[[^/]]*$%%'`])dnl
784 dnl ---------------------------------------------------------------------------
785 dnl CF_DIRS_TO_MAKE version: 3 updated: 2002/02/23 20:38:31
787 AC_DEFUN([CF_DIRS_TO_MAKE],
790 for cf_item in $cf_list_models
792 CF_OBJ_SUBDIR($cf_item,cf_subdir)
793 for cf_item2 in $DIRS_TO_MAKE
795 test $cf_item2 = $cf_subdir && break
797 test ".$cf_item2" != ".$cf_subdir" && DIRS_TO_MAKE="$DIRS_TO_MAKE $cf_subdir"
799 for cf_dir in $DIRS_TO_MAKE
801 test ! -d $cf_dir && mkdir $cf_dir
803 AC_SUBST(DIRS_TO_MAKE)
805 dnl ---------------------------------------------------------------------------
806 dnl CF_ERRNO version: 5 updated: 1997/11/30 12:44:39
808 dnl Check if 'errno' is declared in <errno.h>
811 CF_CHECK_ERRNO(errno)
813 dnl ---------------------------------------------------------------------------
814 dnl CF_ETIP_DEFINES version: 3 updated: 2003/03/22 19:13:43
816 dnl Test for conflicting definitions of exception in gcc 2.8.0, etc., between
817 dnl math.h and builtin.h, only for ncurses
818 AC_DEFUN([CF_ETIP_DEFINES],
820 AC_MSG_CHECKING(for special defines needed for etip.h)
821 cf_save_CXXFLAGS="$CXXFLAGS"
823 for cf_math in "" MATH_H
825 for cf_excp in "" MATH_EXCEPTION
827 CXXFLAGS="$cf_save_CXXFLAGS -I${srcdir}/c++ -I${srcdir}/menu -I${srcdir}/include"
828 test -n "$cf_math" && CXXFLAGS="$CXXFLAGS -DETIP_NEEDS_${cf_math}"
829 test -n "$cf_excp" && CXXFLAGS="$CXXFLAGS -DETIP_NEEDS_${cf_excp}"
833 test -n "$cf_math" && AC_DEFINE_UNQUOTED(ETIP_NEEDS_${cf_math})
834 test -n "$cf_excp" && AC_DEFINE_UNQUOTED(ETIP_NEEDS_${cf_excp})
835 cf_result="$cf_math $cf_excp"
840 AC_MSG_RESULT($cf_result)
841 CXXFLAGS="$cf_save_CXXFLAGS"
843 dnl ---------------------------------------------------------------------------
844 dnl CF_FUNC_DLSYM version: 1 updated: 2004/06/16 20:52:45
846 dnl Test for dlsym() and related functions, as well as libdl.
851 AC_DEFUN([CF_FUNC_DLSYM],[
853 AC_CHECK_FUNC(dlsym,cf_have_dlsym=yes,[
856 AC_CHECK_LIB(dl,dlsym,[
858 cf_have_libdl=yes])])
860 if test "$cf_have_dlsym" = yes ; then
861 test "$cf_have_libdl" = yes && LIBS="-ldl $LIBS"
863 AC_MSG_CHECKING(whether able to link to dl*() functions)
864 AC_TRY_LINK([#include <dlfcn.h>],[
866 if ((obj = dlopen("filename", 0)) != 0) {
867 if (dlsym(obj, "symbolname") == 0) {
871 AC_DEFINE(HAVE_LIBDL)],[
872 AC_MSG_ERROR(Cannot link test program for libdl)])
875 AC_MSG_ERROR(Cannot find dlsym function)
878 dnl ---------------------------------------------------------------------------
879 dnl CF_FUNC_MEMMOVE version: 5 updated: 2000/08/12 23:18:52
881 dnl Check for memmove, or a bcopy that can handle overlapping copy. If neither
882 dnl is found, add our own version of memmove to the list of objects.
883 AC_DEFUN([CF_FUNC_MEMMOVE],
885 AC_CHECK_FUNC(memmove,,[
886 AC_CHECK_FUNC(bcopy,[
887 AC_CACHE_CHECK(if bcopy does overlapping moves,cf_cv_good_bcopy,[
890 static char data[] = "abcdefghijklmnopqrstuwwxyz";
892 bcopy(data, temp, sizeof(data));
893 bcopy(temp+10, temp, 15);
894 bcopy(temp+5, temp+15, 10);
895 exit (strcmp(temp, "klmnopqrstuwwxypqrstuwwxyz"));
898 [cf_cv_good_bcopy=yes],
899 [cf_cv_good_bcopy=no],
900 [cf_cv_good_bcopy=unknown])
902 ],[cf_cv_good_bcopy=no])
903 if test "$cf_cv_good_bcopy" = yes ; then
904 AC_DEFINE(USE_OK_BCOPY)
906 AC_DEFINE(USE_MY_MEMMOVE)
909 dnl ---------------------------------------------------------------------------
910 dnl CF_FUNC_NANOSLEEP version: 1 updated: 2005/07/02 15:38:12
911 dnl -----------------
912 dnl Check for existence of workable nanosleep() function. Some systems, e.g.,
913 dnl AIX 4.x, provide a non-working version.
914 AC_DEFUN([CF_FUNC_NANOSLEEP],[
915 AC_CACHE_CHECK(if nanosleep really works,cf_cv_func_nanosleep,[
921 #ifdef HAVE_SYS_TIME_H
922 #include <sys/time.h>
926 struct timespec ts1, ts2;
929 ts1.tv_nsec = 750000000;
933 code = nanosleep(&ts1, &ts2); /* on failure errno is ENOSYS. */
937 [cf_cv_func_nanosleep=yes],
938 [cf_cv_func_nanosleep=no],
939 [cf_cv_func_nanosleep=unknown])])
941 test "$cf_cv_func_nanosleep" = "yes" && AC_DEFINE(HAVE_NANOSLEEP)
943 dnl ---------------------------------------------------------------------------
944 dnl CF_FUNC_POLL version: 2 updated: 2000/02/06 01:38:04
946 dnl See if the poll function really works. Some platforms have poll(), but
947 dnl it does not work for terminals or files.
948 AC_DEFUN([CF_FUNC_POLL],[
949 AC_CACHE_CHECK(if poll really works,cf_cv_working_poll,[
955 #include <sys/poll.h>
962 myfds.events = POLLIN;
964 ret = poll(&myfds, 1, 100);
967 [cf_cv_working_poll=yes],
968 [cf_cv_working_poll=no],
969 [cf_cv_working_poll=unknown])])
970 test "$cf_cv_working_poll" = "yes" && AC_DEFINE(HAVE_WORKING_POLL)
972 dnl ---------------------------------------------------------------------------
973 dnl CF_FUNC_TERMIOS version: 2 updated: 2000/07/22 23:37:24
975 dnl Some old/broken variations define tcgetattr() only as a macro in
977 AC_DEFUN([CF_FUNC_TERMIOS],[
978 AC_REQUIRE([CF_STRUCT_TERMIOS])
979 AC_CACHE_CHECK(for tcgetattr, cf_cv_have_tcgetattr,[
981 #include <sys/types.h>
985 #ifdef HAVE_TERMIOS_H
987 #define TTY struct termios
991 #define TTY struct termio
996 tcgetattr(1, &foo);],
997 [cf_cv_have_tcgetattr=yes],
998 [cf_cv_have_tcgetattr=no])])
999 test "$cf_cv_have_tcgetattr" = yes && AC_DEFINE(HAVE_TCGETATTR)
1001 dnl ---------------------------------------------------------------------------
1002 dnl CF_FUNC_VSSCANF version: 3 updated: 2001/12/19 00:50:10
1004 dnl Check for vsscanf() function, which is in c9x but generally not in earlier
1005 dnl versions of C. It is in the GNU C library, and can often be simulated by
1006 dnl other functions.
1007 AC_DEFUN([CF_FUNC_VSSCANF],
1009 AC_CACHE_CHECK(for vsscanf function or workaround,cf_cv_func_vsscanf,[
1012 #include <stdio.h>],[
1014 vsscanf("from", "%d", ap)],[cf_cv_func_vsscanf=vsscanf],[
1017 #include <stdio.h>],[
1021 strbuf._flag = _IOREAD;
1022 strbuf._ptr = strbuf._base = (unsigned char *) str;
1023 strbuf._cnt = strlen(str);
1024 strbuf._file = _NFILE;
1025 return (vfscanf(&strbuf, "%d", ap))],[cf_cv_func_vsscanf=vfscanf],[
1028 #include <stdio.h>],[
1032 strbuf._flag = _IOREAD;
1033 strbuf._ptr = strbuf._base = (unsigned char *) str;
1034 strbuf._cnt = strlen(str);
1035 strbuf._file = _NFILE;
1036 return (_doscan(&strbuf, "%d", ap))],[cf_cv_func_vsscanf=_doscan],[
1037 cf_cv_func_vsscanf=no])])])])
1039 case $cf_cv_func_vsscanf in #(vi
1040 vsscanf) AC_DEFINE(HAVE_VSSCANF);; #(vi
1041 vfscanf) AC_DEFINE(HAVE_VFSCANF);; #(vi
1042 _doscan) AC_DEFINE(HAVE__DOSCAN);;
1046 dnl ---------------------------------------------------------------------------
1047 dnl CF_GCC_ATTRIBUTES version: 10 updated: 2005/05/28 13:16:28
1048 dnl -----------------
1049 dnl Test for availability of useful gcc __attribute__ directives to quiet
1050 dnl compiler warnings. Though useful, not all are supported -- and contrary
1051 dnl to documentation, unrecognized directives cause older compilers to barf.
1052 AC_DEFUN([CF_GCC_ATTRIBUTES],
1054 if test "$GCC" = yes
1056 cat > conftest.i <<EOF
1058 #define GCC_PRINTF 0
1063 #ifndef GCC_NORETURN
1064 #define GCC_NORETURN /* nothing */
1067 #define GCC_UNUSED /* nothing */
1070 if test "$GCC" = yes
1072 AC_CHECKING([for $CC __attribute__ directives])
1073 cat > conftest.$ac_ext <<EOF
1074 #line __oline__ "configure"
1075 #include "confdefs.h"
1076 #include "conftest.h"
1077 #include "conftest.i"
1079 #define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
1081 #define GCC_PRINTFLIKE(fmt,var) /*nothing*/
1084 #define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var)))
1086 #define GCC_SCANFLIKE(fmt,var) /*nothing*/
1088 extern void wow(char *,...) GCC_SCANFLIKE(1,2);
1089 extern void oops(char *,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN;
1090 extern void foo(void) GCC_NORETURN;
1091 int main(int argc GCC_UNUSED, char *argv[[]] GCC_UNUSED) { return 0; }
1093 for cf_attribute in scanf printf unused noreturn
1095 CF_UPPER(cf_ATTRIBUTE,$cf_attribute)
1096 cf_directive="__attribute__(($cf_attribute))"
1097 echo "checking for $CC $cf_directive" 1>&AC_FD_CC
1098 case $cf_attribute in
1100 cat >conftest.h <<EOF
1101 #define GCC_$cf_ATTRIBUTE 1
1105 cat >conftest.h <<EOF
1106 #define GCC_$cf_ATTRIBUTE $cf_directive
1110 if AC_TRY_EVAL(ac_compile); then
1111 test -n "$verbose" && AC_MSG_RESULT(... $cf_attribute)
1112 cat conftest.h >>confdefs.h
1116 fgrep define conftest.i >>confdefs.h
1121 dnl ---------------------------------------------------------------------------
1122 dnl CF_GCC_VERSION version: 4 updated: 2005/08/27 09:53:42
1124 dnl Find version of gcc
1125 AC_DEFUN([CF_GCC_VERSION],[
1126 AC_REQUIRE([AC_PROG_CC])
1128 if test "$GCC" = yes ; then
1129 AC_MSG_CHECKING(version of $CC)
1130 GCC_VERSION="`${CC} --version| sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`"
1131 test -z "$GCC_VERSION" && GCC_VERSION=unknown
1132 AC_MSG_RESULT($GCC_VERSION)
1135 dnl ---------------------------------------------------------------------------
1136 dnl CF_GCC_WARNINGS version: 20 updated: 2005/08/06 18:37:29
1138 dnl Check if the compiler supports useful warning options. There's a few that
1139 dnl we don't use, simply because they're too noisy:
1141 dnl -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x)
1142 dnl -Wredundant-decls (system headers make this too noisy)
1143 dnl -Wtraditional (combines too many unrelated messages, only a few useful)
1144 dnl -Wwrite-strings (too noisy, but should review occasionally). This
1145 dnl is enabled for ncurses using "--enable-const".
1149 dnl $1 is an optional list of gcc warning flags that a particular
1150 dnl application might want to use, e.g., "no-unused" for
1153 dnl If $with_ext_const is "yes", add a check for -Wwrite-strings
1155 AC_DEFUN([CF_GCC_WARNINGS],
1157 AC_REQUIRE([CF_GCC_VERSION])
1158 CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS)
1160 cat > conftest.$ac_ext <<EOF
1161 #line __oline__ "configure"
1162 int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; }
1165 if test "$INTEL_COMPILER" = yes
1167 # The "-wdXXX" options suppress warnings:
1168 # remark #1419: external declaration in primary source file
1169 # remark #1682: implicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
1170 # remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
1171 # remark #1684: conversion from pointer to same-sized integral type (potential portability problem)
1172 # remark #193: zero used for undefined preprocessing identifier
1173 # remark #593: variable "curs_sb_left_arrow" was set but never used
1174 # remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits
1175 # remark #869: parameter "tw" was never referenced
1176 # remark #981: operands are evaluated in unspecified order
1177 # warning #269: invalid format string conversion
1179 AC_CHECKING([for $CC warning options])
1180 cf_save_CFLAGS="$CFLAGS"
1181 EXTRA_CFLAGS="-Wall"
1194 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
1195 if AC_TRY_EVAL(ac_compile); then
1196 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
1197 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
1200 CFLAGS="$cf_save_CFLAGS"
1202 elif test "$GCC" = yes
1204 AC_CHECKING([for $CC warning options])
1205 cf_save_CFLAGS="$CFLAGS"
1206 EXTRA_CFLAGS="-W -Wall"
1208 test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings"
1210 Wbad-function-cast \
1214 Wmissing-declarations \
1215 Wmissing-prototypes \
1219 Wstrict-prototypes \
1220 Wundef $cf_warn_CONST $1
1222 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
1223 if AC_TRY_EVAL(ac_compile); then
1224 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
1225 case $cf_opt in #(vi
1227 CPPFLAGS="$CPPFLAGS -DXTSTRINGDEFINES"
1230 case $GCC_VERSION in
1232 CF_VERBOSE(feature is broken in gcc $GCC_VERSION)
1237 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
1240 CFLAGS="$cf_save_CFLAGS"
1244 AC_SUBST(EXTRA_CFLAGS)
1246 dnl ---------------------------------------------------------------------------
1247 dnl CF_GNAT_TRY_LINK version: 1 updated: 2004/08/21 19:02:08
1248 dnl ----------------
1249 dnl Verify that a test program compiles/links with GNAT.
1250 dnl $cf_ada_make is set to the program that compiles/links
1251 dnl $ADAFLAGS may be set to the GNAT flags.
1253 dnl $1 is the text of the spec
1254 dnl $2 is the text of the body
1255 dnl $3 is the shell command to execute if successful
1256 dnl $4 is the shell command to execute if not successful
1257 AC_DEFUN([CF_GNAT_TRY_LINK],
1260 cat >>conftest.ads <<CF_EOF
1263 cat >>conftest.adb <<CF_EOF
1266 if ( $cf_ada_make $ADAFLAGS conftest 1>&AC_FD_CC 2>&1 ) ; then
1267 ifelse($3,, :,[ $3])
1273 dnl ---------------------------------------------------------------------------
1274 dnl CF_GNAT_TRY_RUN version: 3 updated: 2004/08/21 19:02:08
1276 dnl Verify that a test program compiles and runs with GNAT
1277 dnl $cf_ada_make is set to the program that compiles/links
1278 dnl $ADAFLAGS may be set to the GNAT flags.
1280 dnl $1 is the text of the spec
1281 dnl $2 is the text of the body
1282 dnl $3 is the shell command to execute if successful
1283 dnl $4 is the shell command to execute if not successful
1284 AC_DEFUN([CF_GNAT_TRY_RUN],
1287 cat >>conftest.ads <<CF_EOF
1290 cat >>conftest.adb <<CF_EOF
1293 if ( $cf_ada_make $ADAFLAGS conftest 1>&AC_FD_CC 2>&1 ) ; then
1294 if ( ./conftest 1>&AC_FD_CC 2>&1 ) ; then
1295 ifelse($3,, :,[ $3])
1304 dnl ---------------------------------------------------------------------------
1305 dnl CF_GNAT_VERSION version: 11 updated: 2003/09/06 19:42:09
1307 dnl Verify version of GNAT.
1308 AC_DEFUN([CF_GNAT_VERSION],
1310 AC_MSG_CHECKING(for gnat version)
1311 cf_gnat_version=`${cf_ada_make-gnatmake} -v 2>&1 | grep '[[0-9]].[[0-9]][[0-9]]*' |\
1312 sed -e '2,$d' -e 's/[[^0-9 \.]]//g' -e 's/^[[ ]]*//' -e 's/ .*//'`
1313 AC_MSG_RESULT($cf_gnat_version)
1315 case $cf_gnat_version in
1316 3.1[[1-9]]*|3.[[2-9]]*|[[4-9]].*)
1317 cf_cv_prog_gnat_correct=yes
1319 *) echo Unsupported GNAT version $cf_gnat_version. Required is 3.11 or better. Disabling Ada95 binding.
1320 cf_cv_prog_gnat_correct=no
1323 case $cf_gnat_version in
1324 3.[[1-9]]*|[[4-9]].*)
1325 cf_compile_generics=generics
1326 cf_generic_objects="\$(GENOBJS)"
1328 *) cf_compile_generics=
1333 dnl ---------------------------------------------------------------------------
1334 dnl CF_GNU_SOURCE version: 6 updated: 2005/07/09 13:23:07
1336 dnl Check if we must define _GNU_SOURCE to get a reasonable value for
1337 dnl _XOPEN_SOURCE, upon which many POSIX definitions depend. This is a defect
1338 dnl (or misfeature) of glibc2, which breaks portability of many applications,
1339 dnl since it is interwoven with GNU extensions.
1341 dnl Well, yes we could work around it...
1342 AC_DEFUN([CF_GNU_SOURCE],
1344 AC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[
1345 AC_TRY_COMPILE([#include <sys/types.h>],[
1346 #ifndef _XOPEN_SOURCE
1349 [cf_cv_gnu_source=no],
1350 [cf_save="$CPPFLAGS"
1351 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
1352 AC_TRY_COMPILE([#include <sys/types.h>],[
1353 #ifdef _XOPEN_SOURCE
1356 [cf_cv_gnu_source=no],
1357 [cf_cv_gnu_source=yes])
1361 test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
1363 dnl ---------------------------------------------------------------------------
1364 dnl CF_GPP_LIBRARY version: 8 updated: 2003/02/02 01:41:46
1366 dnl If we're trying to use g++, test if libg++ is installed (a rather common
1367 dnl problem :-). If we have the compiler but no library, we'll be able to
1368 dnl configure, but won't be able to build the c++ demo program.
1369 AC_DEFUN([CF_GPP_LIBRARY],
1371 cf_cxx_library=unknown
1372 case $cf_cv_system_name in #(vi
1380 if test "$GXX" = yes; then
1381 AC_MSG_CHECKING([for lib$cf_gpp_libname])
1383 LIBS="$LIBS -l$cf_gpp_libname"
1385 #include <$cf_gpp_libname/builtin.h>
1387 [two_arg_error_handler_t foo2 = lib_error_handler],
1389 CXXLIBS="$CXXLIBS -l$cf_gpp_libname"
1390 if test "$cf_gpp_libname" = cpp ; then
1391 AC_DEFINE(HAVE_GPP_BUILTIN_H)
1393 AC_DEFINE(HAVE_GXX_BUILTIN_H)
1396 #include <builtin.h>
1398 [two_arg_error_handler_t foo2 = lib_error_handler],
1400 CXXLIBS="$CXXLIBS -l$cf_gpp_libname"
1401 AC_DEFINE(HAVE_BUILTIN_H)],
1402 [cf_cxx_library=no])])
1404 AC_MSG_RESULT($cf_cxx_library)
1407 dnl ---------------------------------------------------------------------------
1408 dnl CF_GXX_VERSION version: 5 updated: 2005/08/27 09:53:42
1410 dnl Check for version of g++
1411 AC_DEFUN([CF_GXX_VERSION],[
1412 AC_REQUIRE([AC_PROG_CPP])
1414 if test "$GXX" = yes; then
1415 AC_MSG_CHECKING(version of g++)
1416 GXX_VERSION="`${CXX-g++} --version| sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`"
1417 test -z "$GXX_VERSION" && GXX_VERSION=unknown
1418 AC_MSG_RESULT($GXX_VERSION)
1421 dnl ---------------------------------------------------------------------------
1422 dnl CF_GXX_WARNINGS version: 5 updated: 2005/08/13 14:54:38
1424 dnl Check if the compiler supports useful warning options.
1426 dnl Most of gcc's options apply to g++, except:
1427 dnl -Wbad-function-cast
1428 dnl -Wmissing-declarations
1429 dnl -Wnested-externs
1431 dnl Omit a few (for now):
1435 dnl $1 is an optional list of g++ warning flags that a particular
1436 dnl application might want to use, e.g., "no-unused" for
1439 dnl If $with_ext_const is "yes", add a check for -Wwrite-strings
1441 AC_DEFUN([CF_GXX_WARNINGS],
1444 CF_INTEL_COMPILER(GXX,INTEL_CPLUSPLUS,CXXFLAGS)
1446 AC_REQUIRE([CF_GXX_VERSION])
1451 cat > conftest.$ac_ext <<EOF
1452 #line __oline__ "configure"
1453 int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; }
1456 if test "$INTEL_CPLUSPLUS" = yes
1458 # The "-wdXXX" options suppress warnings:
1459 # remark #1419: external declaration in primary source file
1460 # remark #1682: implicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
1461 # remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
1462 # remark #1684: conversion from pointer to same-sized integral type (potential portability problem)
1463 # remark #193: zero used for undefined preprocessing identifier
1464 # remark #593: variable "curs_sb_left_arrow" was set but never used
1465 # remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits
1466 # remark #869: parameter "tw" was never referenced
1467 # remark #981: operands are evaluated in unspecified order
1468 # warning #269: invalid format string conversion
1470 AC_CHECKING([for $CC warning options])
1471 cf_save_CXXFLAGS="$CXXFLAGS"
1472 EXTRA_CXXFLAGS="-Wall"
1485 CXXFLAGS="$cf_save_CXXFLAGS $EXTRA_CXXFLAGS -$cf_opt"
1486 if AC_TRY_EVAL(ac_compile); then
1487 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
1488 EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS -$cf_opt"
1491 CXXFLAGS="$cf_save_CXXFLAGS"
1493 elif test "$GXX" = yes
1495 AC_CHECKING([for $CXX warning options])
1496 cf_save_CXXFLAGS="$CXXFLAGS"
1497 EXTRA_CXXFLAGS="-W -Wall"
1498 cf_gxx_extra_warnings=""
1499 test "$with_ext_const" = yes && cf_gxx_extra_warnings="Wwrite-strings"
1500 case "$GCC_VERSION" in
1504 cf_gxx_extra_warnings="$cf_gxx_extra_warnings Weffc++"
1510 Woverloaded-virtual \
1516 Wmissing-prototypes \
1519 Wstrict-prototypes \
1520 Wundef $cf_gxx_extra_warnings $1
1522 CXXFLAGS="$cf_save_CXXFLAGS $EXTRA_CXXFLAGS -Werror -$cf_opt"
1523 if AC_TRY_EVAL(ac_compile); then
1524 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
1525 EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS -$cf_opt"
1527 test -n "$verbose" && AC_MSG_RESULT(... no -$cf_opt)
1530 CXXFLAGS="$cf_save_CXXFLAGS"
1535 AC_SUBST(EXTRA_CXXFLAGS)
1537 dnl ---------------------------------------------------------------------------
1538 dnl CF_HELP_MESSAGE version: 3 updated: 1998/01/14 10:56:23
1540 dnl Insert text into the help-message, for readability, from AC_ARG_WITH.
1541 AC_DEFUN([CF_HELP_MESSAGE],
1542 [AC_DIVERT_HELP([$1])dnl
1544 dnl ---------------------------------------------------------------------------
1545 dnl CF_INCLUDE_DIRS version: 4 updated: 2002/12/01 00:12:15
1547 dnl Construct the list of include-options according to whether we're building
1548 dnl in the source directory or using '--srcdir=DIR' option. If we're building
1549 dnl with gcc, don't append the includedir if it happens to be /usr/include,
1550 dnl since that usually breaks gcc's shadow-includes.
1551 AC_DEFUN([CF_INCLUDE_DIRS],
1553 CPPFLAGS="-I. -I../include $CPPFLAGS"
1554 if test "$srcdir" != "."; then
1555 CPPFLAGS="-I\$(srcdir)/../include $CPPFLAGS"
1557 if test "$GCC" != yes; then
1558 CPPFLAGS="$CPPFLAGS -I\$(includedir)"
1559 elif test "$includedir" != "/usr/include"; then
1560 if test "$includedir" = '${prefix}/include' ; then
1561 if test $prefix != /usr ; then
1562 CPPFLAGS="$CPPFLAGS -I\$(includedir)"
1565 CPPFLAGS="$CPPFLAGS -I\$(includedir)"
1570 dnl ---------------------------------------------------------------------------
1571 dnl CF_INTEL_COMPILER version: 3 updated: 2005/08/06 18:37:29
1572 dnl -----------------
1573 dnl Check if the given compiler is really the Intel compiler for Linux. It
1574 dnl tries to imitate gcc, but does not return an error when it finds a mismatch
1575 dnl between prototypes, e.g., as exercised by CF_MISSING_CHECK.
1577 dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to
1578 dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from
1579 dnl the wrappers for gcc and g++ warnings.
1581 dnl $1 = GCC (default) or GXX
1582 dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS
1583 dnl $3 = CFLAGS (default) or CXXFLAGS
1584 AC_DEFUN([CF_INTEL_COMPILER],[
1585 ifelse($2,,INTEL_COMPILER,[$2])=no
1587 if test "$ifelse($1,,[$1],GCC)" = yes ; then
1590 AC_MSG_CHECKING(if this is really Intel ifelse($1,GXX,C++,C) compiler)
1591 cf_save_CFLAGS="$ifelse($3,,CFLAGS,[$3])"
1592 ifelse($3,,CFLAGS,[$3])="$ifelse($3,,CFLAGS,[$3]) -no-gcc"
1594 #ifdef __INTEL_COMPILER
1598 ],[ifelse($2,,INTEL_COMPILER,[$2])=yes
1599 cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc"
1601 ifelse($3,,CFLAGS,[$3])="$cf_save_CFLAGS"
1602 AC_MSG_RESULT($ifelse($2,,INTEL_COMPILER,[$2]))
1607 dnl ---------------------------------------------------------------------------
1608 dnl CF_ISASCII version: 3 updated: 2000/08/12 23:18:52
1610 dnl Check if we have either a function or macro for 'isascii()'.
1611 AC_DEFUN([CF_ISASCII],
1613 AC_MSG_CHECKING(for isascii)
1614 AC_CACHE_VAL(cf_cv_have_isascii,[
1615 AC_TRY_LINK([#include <ctype.h>],[int x = isascii(' ')],
1616 [cf_cv_have_isascii=yes],
1617 [cf_cv_have_isascii=no])
1619 AC_MSG_RESULT($cf_cv_have_isascii)
1620 test "$cf_cv_have_isascii" = yes && AC_DEFINE(HAVE_ISASCII)
1622 dnl ---------------------------------------------------------------------------
1623 dnl CF_LARGEFILE version: 5 updated: 2005/07/17 11:03:36
1625 dnl Add checks for large file support.
1626 AC_DEFUN([CF_LARGEFILE],[
1627 ifdef([AC_FUNC_FSEEKO],[
1631 # Normally we would collect these definitions in the config.h,
1632 # but (like _XOPEN_SOURCE), some environments rely on having these
1633 # defined before any of the system headers are included. Another
1634 # case comes up with C++, e.g., on AIX the compiler compiles the
1635 # header files by themselves before looking at the body files it is
1636 # told to compile. For ncurses, those header files do not include
1638 test "$ac_cv_sys_large_files" != no && CPPFLAGS="$CPPFLAGS -D_LARGE_FILES "
1639 test "$ac_cv_sys_largefile_source" != no && CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE "
1641 AC_CACHE_CHECK(whether to use struct dirent64, cf_cv_struct_dirent64,[
1643 #include <sys/types.h>
1646 /* if transitional largefile support is setup, this is true */
1647 extern struct dirent64 * readdir(DIR *);
1648 struct dirent64 *x = readdir((DIR *)0);
1649 struct dirent *y = readdir((DIR *)0);
1652 [cf_cv_struct_dirent64=yes],
1653 [cf_cv_struct_dirent64=no])
1655 test "$cf_cv_struct_dirent64" = yes && AC_DEFINE(HAVE_STRUCT_DIRENT64)
1658 dnl ---------------------------------------------------------------------------
1659 dnl CF_LIBUTF8 version: 2 updated: 2002/01/19 22:51:32
1661 dnl Check for libutf8
1662 AC_DEFUN([CF_LIBUTF8],
1664 AC_CACHE_CHECK(for putwc in libutf8,cf_cv_libutf8,[
1665 cf_save_LIBS="$LIBS"
1668 #include <libutf8.h>],[putwc(0,0);],
1669 [cf_cv_libutf8=yes],
1671 LIBS="$cf_save_LIBS"
1674 if test "$cf_cv_libutf8" = yes ; then
1675 AC_DEFINE(HAVE_LIBUTF8_H)
1679 dnl ---------------------------------------------------------------------------
1680 dnl CF_LIB_PREFIX version: 7 updated: 2001/01/12 01:23:48
1682 dnl Compute the library-prefix for the given host system
1683 dnl $1 = variable to set
1684 AC_DEFUN([CF_LIB_PREFIX],
1686 case $cf_cv_system_name in
1687 OS/2*) LIB_PREFIX='' ;;
1688 os2*) LIB_PREFIX='' ;;
1689 *) LIB_PREFIX='lib' ;;
1691 ifelse($1,,,[$1=$LIB_PREFIX])
1692 AC_SUBST(LIB_PREFIX)
1694 dnl ---------------------------------------------------------------------------
1695 dnl CF_LIB_RULES version: 36 updated: 2005/05/28 13:16:28
1697 dnl Append definitions and rules for the given models to the subdirectory
1698 dnl Makefiles, and the recursion rule for the top-level Makefile. If the
1699 dnl subdirectory is a library-source directory, modify the LIBRARIES list in
1700 dnl the corresponding makefile to list the models that we'll generate.
1702 dnl For shared libraries, make a list of symbolic links to construct when
1703 dnl generating each library. The convention used for Linux is the simplest
1706 dnl lib<name>.so.<major> ->
1707 dnl lib<name>.so.<maj>.<minor>
1708 AC_DEFUN([CF_LIB_RULES],
1710 CF_LIB_PREFIX(cf_prefix)
1711 AC_REQUIRE([CF_SUBST_NCURSES_VERSION])
1712 for cf_dir in $SRC_SUBDIRS
1714 if test -f $srcdir/$cf_dir/modules; then
1719 for cf_item in $CF_LIST_MODELS
1721 CF_LIB_SUFFIX($cf_item,cf_suffix)
1722 if test $cf_item = shared ; then
1723 if test "$cf_cv_do_symlinks" = yes ; then
1724 case "$cf_cv_shlib_version" in #(vi
1726 case "$cf_cv_system_name" in #(vi
1728 case .${LIB_SUFFIX} in
1730 cf_suffix=`echo $cf_suffix | sed 's/^w//'`
1731 cf_suffix=w'.$(REL_VERSION)'"$cf_suffix"
1734 cf_suffix='.$(REL_VERSION)'"$cf_suffix"
1738 *) cf_suffix="$cf_suffix"'.$(REL_VERSION)' ;;
1742 case "$cf_cv_system_name" in #(vi
1744 case .${LIB_SUFFIX} in
1746 cf_suffix=`echo $cf_suffix | sed 's/^w//'`
1747 cf_suffix=w'.$(ABI_VERSION)'"$cf_suffix"
1750 cf_suffix='.$(ABI_VERSION)'"$cf_suffix"
1754 *) cf_suffix="$cf_suffix"'.$(ABI_VERSION)' ;;
1759 # cygwin needs import library, and has unique naming convention
1760 # use autodetected ${cf_prefix} for import lib and static lib, but
1761 # use 'cyg' prefix for shared lib.
1762 if test $cf_cv_shlib_version = cygdll ; then
1763 SHARED_LIB="../lib/cyg${cf_dir}\$(ABI_VERSION).dll"
1764 IMPORT_LIB="../lib/${cf_prefix}${cf_dir}.dll.a"
1765 LIBS_TO_MAKE="$LIBS_TO_MAKE \$(SHARED_LIB) \$(IMPORT_LIB)"
1769 LIBS_TO_MAKE="$LIBS_TO_MAKE ../lib/${cf_prefix}${cf_dir}${cf_suffix}"
1772 if test $cf_dir = ncurses ; then
1773 cf_subsets="$LIB_SUBSETS"
1774 cf_termlib=`echo "$cf_subsets" |sed -e 's/ .*$//'`
1775 if test "$cf_termlib" != "$cf_subsets" ; then
1776 cf_item=`echo $LIBS_TO_MAKE |sed -e s%${LIB_NAME}${LIB_SUFFIX}%${TINFO_LIB_SUFFIX}%g`
1777 LIBS_TO_MAKE="$cf_item $LIBS_TO_MAKE"
1780 cf_subsets=`echo "$LIB_SUBSETS" | sed -e 's/^termlib.* //'`
1783 sed -e "s%@LIBS_TO_MAKE@%$LIBS_TO_MAKE%" \
1784 -e "s%@IMPORT_LIB@%$IMPORT_LIB%" \
1785 -e "s%@SHARED_LIB@%$SHARED_LIB%" \
1786 $cf_dir/Makefile >$cf_dir/Makefile.out
1787 mv $cf_dir/Makefile.out $cf_dir/Makefile
1789 $AWK -f $srcdir/mk-0th.awk \
1790 libname="${cf_dir}${LIB_SUFFIX}" subsets="$LIB_SUBSETS" \
1791 $srcdir/$cf_dir/modules >>$cf_dir/Makefile
1793 for cf_subset in $cf_subsets
1796 for cf_item in $CF_LIST_MODELS
1798 echo "Appending rules for ${cf_item} model (${cf_dir}: ${cf_subset})"
1799 CF_UPPER(cf_ITEM,$cf_item)
1800 CF_LIB_SUFFIX($cf_item,cf_suffix)
1801 CF_OBJ_SUBDIR($cf_item,cf_subdir)
1803 # Test for case where we build libtinfo with a different name.
1805 if test $cf_dir = ncurses ; then
1810 cf_libname=$TINFO_LIB_SUFFIX
1811 if test -n "${DFT_ARG_SUFFIX}" ; then
1812 # undo $LIB_SUFFIX add-on in CF_LIB_SUFFIX
1813 cf_suffix=`echo $cf_suffix |sed -e "s%^${LIB_SUFFIX}%%"`
1819 # These dependencies really are for development, not
1820 # builds, but they are useful in porting, too.
1821 cf_depend="../include/ncurses_cfg.h"
1822 if test "$srcdir" = "."; then
1825 cf_reldir="\$(srcdir)"
1828 if test -f $srcdir/$cf_dir/$cf_dir.priv.h; then
1829 cf_depend="$cf_depend $cf_reldir/$cf_dir.priv.h"
1830 elif test -f $srcdir/$cf_dir/curses.priv.h; then
1831 cf_depend="$cf_depend $cf_reldir/curses.priv.h"
1835 old_cf_suffix="$cf_suffix"
1836 if test "$cf_cv_shlib_version_infix" = yes ; then
1837 if test -n "$LIB_SUFFIX" ; then
1840 cf_libname=`echo $cf_libname | sed 's/w$//'`
1841 cf_suffix=`echo $cf_suffix | sed 's/^w//'`
1848 $AWK -f $srcdir/mk-1st.awk \
1849 name=${cf_libname}${cf_dir_suffix} \
1850 traces=$LIB_TRACING \
1856 ShlibVer=$cf_cv_shlib_version \
1857 ShlibVerInfix=$cf_cv_shlib_version_infix \
1858 DoLinks=$cf_cv_do_symlinks \
1859 rmSoLocs=$cf_cv_rm_so_locs \
1860 ldconfig="$LDCONFIG" \
1861 overwrite=$WITH_OVERWRITE \
1862 depend="$cf_depend" \
1864 $srcdir/$cf_dir/modules >>$cf_dir/Makefile
1866 cf_suffix="$old_cf_suffix"
1868 for cf_subdir2 in $cf_subdirs lib
1870 test $cf_subdir = $cf_subdir2 && break
1872 test "${cf_subset}.${cf_subdir2}" != "${cf_subset}.${cf_subdir}" && \
1873 $AWK -f $srcdir/mk-2nd.awk \
1875 traces=$LIB_TRACING \
1881 crenames=$cf_cv_prog_CC_c_o \
1882 cxxrenames=$cf_cv_prog_CXX_c_o \
1883 $srcdir/$cf_dir/modules >>$cf_dir/Makefile
1884 cf_subdirs="$cf_subdirs $cf_subdir"
1889 echo ' cd '$cf_dir' && $(MAKE) $(CF_MFLAGS) [$]@' >>Makefile
1892 for cf_dir in $SRC_SUBDIRS
1894 if test -f $cf_dir/Makefile ; then
1897 echo 'libs \' >> Makefile
1898 echo 'install.libs \' >> Makefile
1899 echo 'uninstall.libs ::' >> Makefile
1900 echo ' cd '$cf_dir' && $(MAKE) $(CF_MFLAGS) [$]@' >> Makefile
1905 if test -f $srcdir/$cf_dir/modules; then
1907 if test -f $srcdir/$cf_dir/headers; then
1908 cat >> Makefile <<CF_EOF
1910 uninstall.includes \\
1913 if test "$cf_dir" != "c++" ; then
1914 echo 'lint \' >> Makefile
1916 cat >> Makefile <<CF_EOF
1922 uninstall.$cf_dir ::
1923 cd $cf_dir && \$(MAKE) \$(CF_MFLAGS) \[$]@
1925 elif test -f $srcdir/$cf_dir/headers; then
1926 cat >> Makefile <<CF_EOF
1932 uninstall.includes ::
1933 cd $cf_dir && \$(MAKE) \$(CF_MFLAGS) \[$]@
1938 cat >> Makefile <<CF_EOF
1942 $MAKE_TERMINFO cd misc && \$(MAKE) \$(CF_MFLAGS) \[$]@
1946 cd man && \$(MAKE) \$(CF_MFLAGS) \[$]@
1949 rm -f config.cache config.log config.status Makefile include/ncurses_cfg.h
1950 rm -f headers.sh headers.sed
1951 rm -rf \$(DIRS_TO_MAKE)
1954 # Special case: tack's manpage lives in its own directory.
1955 if test -d tack ; then
1956 if test -f $srcdir/$tack.h; then
1957 cat >> Makefile <<CF_EOF
1961 cd tack && \$(MAKE) \$(CF_MFLAGS) \[$]@
1966 dnl If we're installing into a subdirectory of /usr/include, etc., we should
1967 dnl prepend the subdirectory's name to the "#include" paths. It won't hurt
1968 dnl anything, and will make it more standardized. It's awkward to decide this
1969 dnl at configuration because of quoting, so we'll simply make all headers
1970 dnl installed via a script that can do the right thing.
1972 rm -f headers.sed headers.sh
1974 dnl ( generating this script makes the makefiles a little tidier :-)
1975 echo creating headers.sh
1976 cat >headers.sh <<CF_EOF
1978 # This shell script is generated by the 'configure' script. It is invoked in a
1979 # subdirectory of the build tree. It generates a sed-script in the parent
1980 # directory that is used to adjust includes for header files that reside in a
1981 # subdirectory of /usr/include, etc.
1983 while test \[$]# != 3
1985 PRG="\$PRG \[$]1"; shift
1990 TMPSRC=\${TMPDIR-/tmp}/\`basename \$SRC\`\$\$
1991 TMPSED=\${TMPDIR-/tmp}/headers.sed\$\$
1992 echo installing \$SRC in \$DST
1994 if test $WITH_CURSES_H = yes; then
1995 cat >>headers.sh <<CF_EOF
1998 END=\`basename \$DST\`
1999 for i in \`cat \$REF/../*/headers |fgrep -v "#"\`
2001 NAME=\`basename \$i\`
2002 echo "s/<\$NAME>/<\$END\/\$NAME>/" >> \$TMPSED
2011 cat >>headers.sh <<CF_EOF
2014 END=\`basename \$DST\`
2015 for i in \`cat \$REF/../*/headers |fgrep -v "#"\`
2017 NAME=\`basename \$i\`
2018 if test "\$NAME" = "curses.h"
2020 echo "s/<curses.h>/<ncurses.h>/" >> \$TMPSED
2023 echo "s/<\$NAME>/<\$END\/\$NAME>/" >> \$TMPSED
2027 echo "s/<curses.h>/<ncurses.h>/" >> \$TMPSED
2032 cat >>headers.sh <<CF_EOF
2034 sed -f \$TMPSED \$SRC > \$TMPSRC
2035 NAME=\`basename \$SRC\`
2037 if test $WITH_CURSES_H != yes; then
2038 cat >>headers.sh <<CF_EOF
2039 test "\$NAME" = "curses.h" && NAME=ncurses.h
2042 cat >>headers.sh <<CF_EOF
2043 # Just in case someone gzip'd manpages, remove the conflicting copy.
2044 test -f \$DST/\$NAME.gz && rm -f \$DST/\$NAME.gz
2046 eval \$PRG \$TMPSRC \$DST/\$NAME
2047 rm -f \$TMPSRC \$TMPSED
2050 chmod 0755 headers.sh
2052 for cf_dir in $SRC_SUBDIRS
2054 if test -f $srcdir/$cf_dir/headers; then
2055 cat >>$cf_dir/Makefile <<CF_EOF
2056 \$(DESTDIR)\$(includedir) :
2057 sh \$(srcdir)/../mkinstalldirs \[$]@
2061 install.includes :: \$(AUTO_SRC) \$(DESTDIR)\$(includedir) \\
2064 for i in `cat $srcdir/$cf_dir/headers |fgrep -v "#"`
2066 test -n "$j" && echo " $j \\" >>$cf_dir/Makefile
2069 echo " $j" >>$cf_dir/Makefile
2070 for i in `cat $srcdir/$cf_dir/headers |fgrep -v "#"`
2072 echo " @ (cd \$(DESTDIR)\$(includedir) && rm -f `basename $i`) ; ../headers.sh \$(INSTALL_DATA) \$(DESTDIR)\$(includedir) \$(srcdir) $i" >>$cf_dir/Makefile
2073 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
2076 cat >>$cf_dir/Makefile <<CF_EOF
2080 uninstall.includes ::
2082 for i in `cat $srcdir/$cf_dir/headers |fgrep -v "#"`
2085 echo " -@ (cd \$(DESTDIR)\$(includedir) && rm -f $i)" >>$cf_dir/Makefile
2086 test $i = curses.h && echo " -@ (cd \$(DESTDIR)\$(includedir) && rm -f ncurses.h)" >>$cf_dir/Makefile
2090 if test -f $srcdir/$cf_dir/modules; then
2091 if test "$cf_dir" != "c++" ; then
2092 cat >>$cf_dir/Makefile <<"CF_EOF"
2093 depend : $(AUTO_SRC)
2094 makedepend -- $(CPPFLAGS) -- $(C_SRC)
2096 # DO NOT DELETE THIS LINE -- make depend depends on it.
2103 dnl ---------------------------------------------------------------------------
2104 dnl CF_LIB_SONAME version: 2 updated: 2005/06/25 16:05:47
2106 dnl Find the and soname for the given shared library. Set the cache variable
2107 dnl cf_cv_$3_soname to this, unless it is not found. Then set the cache
2108 dnl variable to "unknown".
2112 dnl $3 = library name
2113 AC_DEFUN([CF_LIB_SONAME],
2115 AC_CACHE_CHECK(for soname of $3 library,cf_cv_$3_soname,[
2117 cf_cv_$3_soname=unknown
2118 if test "$cross_compiling" != yes ; then
2119 cat >conftest.$ac_ext <<CF_EOF
2127 cf_save_LIBS="$LIBS"
2129 if AC_TRY_EVAL(ac_compile) ; then
2130 if AC_TRY_EVAL(ac_link) ; then
2131 cf_cv_$3_soname=`ldd conftest$ac_exeext 2>/dev/null | sed -e 's,^.*/,,' -e 's, .*$,,' | fgrep lib$3.`
2132 test -z "$cf_cv_$3_soname" && cf_cv_$3_soname=unknown
2136 LIBS="$cf_save_LIBS"
2140 dnl ---------------------------------------------------------------------------
2141 dnl CF_LIB_SUFFIX version: 13 updated: 2003/11/01 16:09:07
2143 dnl Compute the library file-suffix from the given model name
2145 dnl $2 = variable to set
2146 dnl The variable $LIB_SUFFIX, if set, prepends the variable to set.
2147 AC_DEFUN([CF_LIB_SUFFIX],
2149 AC_REQUIRE([CF_SUBST_NCURSES_VERSION])
2151 libtool) $2='.la' ;;
2154 profile) $2='_p.a' ;;
2156 case $cf_cv_system_name in
2157 cygwin*) $2='.dll' ;;
2158 darwin*) $2='.dylib' ;;
2168 test -n "$LIB_SUFFIX" && $2="${LIB_SUFFIX}[$]{$2}"
2170 dnl ---------------------------------------------------------------------------
2171 dnl CF_LIB_TYPE version: 4 updated: 2000/10/20 22:57:49
2173 dnl Compute the string to append to -library from the given model name
2175 dnl $2 = variable to set
2176 dnl The variable $LIB_SUFFIX, if set, prepends the variable to set.
2177 AC_DEFUN([CF_LIB_TYPE],
2186 test -n "$LIB_SUFFIX" && $2="${LIB_SUFFIX}[$]{$2}"
2188 dnl ---------------------------------------------------------------------------
2189 dnl CF_LINK_DATAONLY version: 6 updated: 2003/02/02 01:41:46
2190 dnl ----------------
2191 dnl Some systems have a non-ANSI linker that doesn't pull in modules that have
2192 dnl only data (i.e., no functions), for example NeXT. On those systems we'll
2193 dnl have to provide wrappers for global tables to ensure they're linked
2195 AC_DEFUN([CF_LINK_DATAONLY],
2197 AC_MSG_CHECKING([if data-only library module links])
2198 AC_CACHE_VAL(cf_cv_link_dataonly,[
2200 cat >conftest.$ac_ext <<EOF
2201 #line __oline__ "configure"
2202 int testdata[[3]] = { 123, 456, 789 };
2204 if AC_TRY_EVAL(ac_compile) ; then
2205 mv conftest.o data.o && \
2206 ( $AR $AR_OPTS conftest.a data.o ) 2>&AC_FD_CC 1>/dev/null
2208 rm -f conftest.$ac_ext data.o
2209 cat >conftest.$ac_ext <<EOF
2210 #line __oline__ "configure"
2214 exit(1); /* I'm told this linker is broken */
2216 extern int testdata[[3]];
2217 return testdata[[0]] == 123
2218 && testdata[[1]] == 456
2219 && testdata[[2]] == 789;
2223 if AC_TRY_EVAL(ac_compile); then
2224 mv conftest.o func.o && \
2225 ( $AR $AR_OPTS conftest.a func.o ) 2>&AC_FD_CC 1>/dev/null
2227 rm -f conftest.$ac_ext func.o
2228 ( eval $RANLIB conftest.a ) 2>&AC_FD_CC >/dev/null
2230 LIBS="conftest.a $LIBS"
2234 extern int testfunc();
2238 [cf_cv_link_dataonly=yes],
2239 [cf_cv_link_dataonly=no],
2240 [cf_cv_link_dataonly=unknown])
2243 AC_MSG_RESULT($cf_cv_link_dataonly)
2245 if test "$cf_cv_link_dataonly" = no ; then
2246 AC_DEFINE(BROKEN_LINKER)
2251 dnl ---------------------------------------------------------------------------
2252 dnl CF_LINK_FUNCS version: 5 updated: 2003/02/02 01:41:46
2254 dnl Most Unix systems have both link and symlink, a few don't have symlink.
2255 dnl A few non-Unix systems implement symlink, but not link.
2256 dnl A few non-systems implement neither (or have nonfunctional versions).
2257 AC_DEFUN([CF_LINK_FUNCS],
2263 if test "$cross_compiling" = yes ; then
2268 AC_CACHE_CHECK(if link/symlink functions work,cf_cv_link_funcs,[
2270 for cf_func in link symlink ; do
2272 #include <sys/types.h>
2273 #include <sys/stat.h>
2274 #ifdef HAVE_UNISTD_H
2280 char *src = "config.log";
2281 char *dst = "conftest.chk";
2286 fail = ($cf_func("config.log", "conftest.chk") < 0)
2287 || (stat(dst, &dst_sb) < 0)
2288 || (dst_sb.st_mtime != src_sb.st_mtime);
2297 cf_cv_link_funcs="$cf_cv_link_funcs $cf_func"
2298 eval 'ac_cv_func_'$cf_func'=yes'],[
2299 eval 'ac_cv_func_'$cf_func'=no'],[
2300 eval 'ac_cv_func_'$cf_func'=error'])
2302 test -z "$cf_cv_link_funcs" && cf_cv_link_funcs=no
2304 test "$ac_cv_func_link" = yes && AC_DEFINE(HAVE_LINK)
2305 test "$ac_cv_func_symlink" = yes && AC_DEFINE(HAVE_SYMLINK)
2308 dnl ---------------------------------------------------------------------------
2309 dnl CF_MAKEFLAGS version: 9 updated: 2001/12/30 18:17:27
2311 dnl Some 'make' programs support $(MAKEFLAGS), some $(MFLAGS), to pass 'make'
2312 dnl options to lower-levels. It's very useful for "make -n" -- if we have it.
2313 dnl (GNU 'make' does both, something POSIX 'make', which happens to make the
2314 dnl $(MAKEFLAGS) variable incompatible because it adds the assignments :-)
2315 AC_DEFUN([CF_MAKEFLAGS],
2317 AC_CACHE_CHECK(for makeflags variable, cf_cv_makeflags,[
2319 for cf_option in '-$(MAKEFLAGS)' '$(MFLAGS)'
2321 cat >cf_makeflags.tmp <<CF_EOF
2324 @ echo '.$cf_option'
2326 cf_result=`${MAKE-make} -k -f cf_makeflags.tmp 2>/dev/null`
2327 case "$cf_result" in
2329 cf_result=`${MAKE-make} -k -f cf_makeflags.tmp CC=cc 2>/dev/null`
2330 case "$cf_result" in
2331 .*CC=*) cf_cv_makeflags=
2333 *) cf_cv_makeflags=$cf_option
2338 *) echo no match "$cf_result"
2342 rm -f cf_makeflags.tmp
2345 AC_SUBST(cf_cv_makeflags)
2347 dnl ---------------------------------------------------------------------------
2348 dnl CF_MAKE_TAGS version: 2 updated: 2000/10/04 09:18:40
2350 dnl Generate tags/TAGS targets for makefiles. Do not generate TAGS if we have
2351 dnl a monocase filesystem.
2352 AC_DEFUN([CF_MAKE_TAGS],[
2353 AC_REQUIRE([CF_MIXEDCASE_FILENAMES])
2354 AC_CHECK_PROG(MAKE_LOWER_TAGS, ctags, yes, no)
2356 if test "$cf_cv_mixedcase" = yes ; then
2357 AC_CHECK_PROG(MAKE_UPPER_TAGS, etags, yes, no)
2362 if test "$MAKE_UPPER_TAGS" = yes ; then
2367 AC_SUBST(MAKE_UPPER_TAGS)
2369 if test "$MAKE_LOWER_TAGS" = yes ; then
2374 AC_SUBST(MAKE_LOWER_TAGS)
2376 dnl ---------------------------------------------------------------------------
2377 dnl CF_MANPAGE_FORMAT version: 7 updated: 2003/12/20 19:30:34
2378 dnl -----------------
2379 dnl Option to allow user to override automatic configuration of manpage format.
2380 dnl There are several special cases:
2382 dnl gzip - man checks for, can display gzip'd files
2383 dnl compress - man checks for, can display compressed files
2384 dnl BSDI - files in the cat-directories are suffixed ".0"
2385 dnl formatted - installer should format (put files in cat-directory)
2386 dnl catonly - installer should only format, e.g., for a turnkey system.
2388 dnl There are other configurations which this macro does not test, e.g., HPUX's
2389 dnl compressed manpages (but uncompressed manpages are fine, and HPUX's naming
2390 dnl convention would not match our use).
2391 AC_DEFUN([CF_MANPAGE_FORMAT],
2393 AC_REQUIRE([CF_PATHSEP])
2394 AC_MSG_CHECKING(format of man-pages)
2396 AC_ARG_WITH(manpage-format,
2397 [ --with-manpage-format specify manpage-format: gzip/compress/BSDI/normal and
2398 optionally formatted/catonly, e.g., gzip,formatted],
2399 [MANPAGE_FORMAT=$withval],
2400 [MANPAGE_FORMAT=unknown])
2402 test -z "$MANPAGE_FORMAT" && MANPAGE_FORMAT=unknown
2403 MANPAGE_FORMAT=`echo "$MANPAGE_FORMAT" | sed -e 's/,/ /g'`
2407 case $MANPAGE_FORMAT in
2409 if test -z "$MANPATH" ; then
2410 MANPATH="/usr/man:/usr/share/man"
2413 # look for the 'date' man-page (it's most likely to be installed!)
2419 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATHSEP}"
2420 for cf_dir in $MANPATH; do
2421 test -z "$cf_dir" && cf_dir=/usr/man
2422 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
2424 cf_test=`echo $cf_name | sed -e 's/*//'`
2425 if test "x$cf_test" = "x$cf_name" ; then
2428 *.gz) MANPAGE_FORMAT="$MANPAGE_FORMAT gzip";;
2429 *.Z) MANPAGE_FORMAT="$MANPAGE_FORMAT compress";;
2430 *.0) MANPAGE_FORMAT="$MANPAGE_FORMAT BSDI";;
2431 *) MANPAGE_FORMAT="$MANPAGE_FORMAT normal";;
2445 # if we found a match in either man* or cat*, stop looking
2446 if test -n "$MANPAGE_FORMAT" ; then
2448 test "$cf_preform" = yes && MANPAGE_FORMAT="$MANPAGE_FORMAT formatted"
2449 test "$cf_catonly" = yes && MANPAGE_FORMAT="$MANPAGE_FORMAT catonly"
2455 test $cf_found=yes && break
2458 # only check the first directory in $MANPATH where we find manpages
2459 if test -n "$MANPAGE_FORMAT" ; then
2463 # if we did not find the example, just assume it is normal
2464 test -z "$MANPAGE_FORMAT" && MANPAGE_FORMAT=normal
2468 for cf_option in $MANPAGE_FORMAT; do
2469 case $cf_option in #(vi
2470 gzip|compress|BSDI|normal|formatted|catonly)
2473 cf_unknown="$cf_unknown $cf_option"
2480 AC_MSG_RESULT($MANPAGE_FORMAT)
2481 if test -n "$cf_unknown" ; then
2482 AC_MSG_WARN(Unexpected manpage-format $cf_unknown)
2485 dnl ---------------------------------------------------------------------------
2486 dnl CF_MANPAGE_RENAMES version: 7 updated: 2005/06/18 18:51:57
2487 dnl ------------------
2488 dnl The Debian people have their own naming convention for manpages. This
2489 dnl option lets us override the name of the file containing renaming, or
2490 dnl disable it altogether.
2491 AC_DEFUN([CF_MANPAGE_RENAMES],
2493 AC_MSG_CHECKING(for manpage renaming)
2495 AC_ARG_WITH(manpage-renames,
2496 [ --with-manpage-renames specify manpage-renaming],
2497 [MANPAGE_RENAMES=$withval],
2498 [MANPAGE_RENAMES=yes])
2500 case ".$MANPAGE_RENAMES" in #(vi
2504 # Debian 'man' program?
2505 if test -f /etc/debian_version ; then
2506 MANPAGE_RENAMES=`cd $srcdir && pwd`/man/man_db.renames
2513 if test "$MANPAGE_RENAMES" != no ; then
2514 if test -f $srcdir/man/$MANPAGE_RENAMES ; then
2515 MANPAGE_RENAMES=`cd $srcdir/man && pwd`/$MANPAGE_RENAMES
2516 elif test ! -f $MANPAGE_RENAMES ; then
2517 AC_MSG_ERROR(not a filename: $MANPAGE_RENAMES)
2520 test ! -d man && mkdir man
2522 # Construct a sed-script to perform renaming within man-pages
2523 if test -n "$MANPAGE_RENAMES" ; then
2524 test ! -d man && mkdir man
2525 sh $srcdir/man/make_sed.sh $MANPAGE_RENAMES >./edit_man.sed
2529 AC_MSG_RESULT($MANPAGE_RENAMES)
2530 AC_SUBST(MANPAGE_RENAMES)
2532 dnl ---------------------------------------------------------------------------
2533 dnl CF_MANPAGE_SYMLINKS version: 4 updated: 2003/12/13 18:01:58
2534 dnl -------------------
2535 dnl Some people expect each tool to make all aliases for manpages in the
2536 dnl man-directory. This accommodates the older, less-capable implementations
2537 dnl of 'man', and is optional.
2538 AC_DEFUN([CF_MANPAGE_SYMLINKS],
2540 AC_MSG_CHECKING(if manpage aliases will be installed)
2542 AC_ARG_WITH(manpage-aliases,
2543 [ --with-manpage-aliases specify manpage-aliases using .so],
2544 [MANPAGE_ALIASES=$withval],
2545 [MANPAGE_ALIASES=yes])
2547 AC_MSG_RESULT($MANPAGE_ALIASES)
2549 if test "$LN_S" = "ln -s"; then
2556 if test "$MANPAGE_ALIASES" = yes ; then
2557 AC_MSG_CHECKING(if manpage symlinks should be used)
2559 AC_ARG_WITH(manpage-symlinks,
2560 [ --with-manpage-symlinks specify manpage-aliases using symlinks],
2561 [MANPAGE_SYMLINKS=$withval],
2562 [MANPAGE_SYMLINKS=$cf_use_symlinks])
2564 if test "$$cf_use_symlinks" = no; then
2565 if test "$MANPAGE_SYMLINKS" = yes ; then
2566 AC_MSG_WARN(cannot make symlinks, will use .so files)
2571 AC_MSG_RESULT($MANPAGE_SYMLINKS)
2575 dnl ---------------------------------------------------------------------------
2576 dnl CF_MANPAGE_TBL version: 3 updated: 2002/01/19 22:51:32
2578 dnl This option causes manpages to be run through tbl(1) to generate tables
2580 AC_DEFUN([CF_MANPAGE_TBL],
2582 AC_MSG_CHECKING(for manpage tbl)
2584 AC_ARG_WITH(manpage-tbl,
2585 [ --with-manpage-tbl specify manpage processing with tbl],
2586 [MANPAGE_TBL=$withval],
2589 AC_MSG_RESULT($MANPAGE_TBL)
2591 dnl ---------------------------------------------------------------------------
2592 dnl CF_MAN_PAGES version: 29 updated: 2005/06/18 19:42:52
2594 dnl Try to determine if the man-pages on the system are compressed, and if
2595 dnl so, what format is used. Use this information to construct a script that
2596 dnl will install man-pages.
2597 AC_DEFUN([CF_MAN_PAGES],
2599 CF_HELP_MESSAGE(Options to Specify How Manpages are Installed:)
2605 if test "$prefix" = "NONE" ; then
2606 cf_prefix="$ac_default_prefix"
2611 case "$MANPAGE_FORMAT" in # (vi
2626 test ! -d man && mkdir man
2630 case "$MANPAGE_FORMAT" in #(vi
2633 cf_compress=compress
2641 cf_edit_man=./edit_man.sh
2643 cat >$cf_edit_man <<CF_EOF
2645 # this script is generated by the configure-script CF_MAN_PAGES macro.
2648 NCURSES_OSPEED="$NCURSES_OSPEED"
2649 TERMINFO="$TERMINFO"
2650 MKDIRS="sh `cd $srcdir && pwd`/mkinstalldirs"
2652 INSTALL_DATA="$INSTALL_DATA"
2653 transform="$program_transform_name"
2655 TMP=\${TMPDIR-/tmp}/man\$\$
2656 trap "rm -f \$TMP" 0 1 2 5 15
2668 top_srcdir=\[$]srcdir/..
2671 if test "\$form" = normal ; then
2672 if test "$cf_format" = yes ; then
2673 if test "$cf_inboth" = no ; then
2674 sh \[$]0 format \$verb \$mandir \$srcdir \[$]*
2678 cf_subdir=\$mandir/man
2679 cf_tables=$MANPAGE_TBL
2681 cf_subdir=\$mandir/cat
2685 # process the list of source-files
2688 *.orig|*.rej) ;; #(vi
2690 section=\`expr "\$i" : '.*\\.\\([[0-9]]\\)[[xm]]*'\`;
2691 if test \$verb = installing ; then
2692 if test ! -d \$cf_subdir\${section} ; then
2693 \$MKDIRS \$cf_subdir\$section
2697 source=\`basename \$i\`
2699 test ! -f \$inalias && inalias="\$srcdir/\$inalias"
2700 if test ! -f \$inalias ; then
2701 echo .. skipped \$source
2706 if test "$MANPAGE_ALIASES" != no ; then
2707 cat >>$cf_edit_man <<CF_EOF
2708 aliases=\`sed -f \$top_srcdir/man/manlinks.sed \$inalias | sort -u\`
2712 if test "$MANPAGE_RENAMES" = no ; then
2713 cat >>$cf_edit_man <<CF_EOF
2714 # perform program transformations for section 1 man pages
2715 if test \$section = 1 ; then
2716 target=\$cf_subdir\${section}/\`echo \$source|sed "\${transform}"\`
2718 target=\$cf_subdir\${section}/\$source
2722 cat >>$cf_edit_man <<CF_EOF
2723 target=\`grep "^\$source" $MANPAGE_RENAMES | $AWK '{print \[$]2}'\`
2724 if test -z "\$target" ; then
2725 echo '? missing rename for '\$source
2728 target="\$cf_subdir\${section}/\${target}"
2732 # replace variables in man page
2736 cat >>$cf_edit_man <<CF_EOF
2737 prog_$cf_name=\`echo $cf_name|sed "\${transform}"\`
2741 cat >>$cf_edit_man <<CF_EOF
2742 sed -e "s,@DATADIR@,\$datadir," \\
2743 -e "s,@TERMINFO@,\$TERMINFO," \\
2744 -e "s,@NCURSES_OSPEED@,\$NCURSES_OSPEED," \\
2750 cf_NAME=`echo "$cf_name" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
2751 cat >>$cf_edit_man <<CF_EOF
2752 -e "s,@$cf_NAME@,\$prog_$cf_name," \\
2757 if test -f $MANPAGE_RENAMES ; then
2758 cat >>$cf_edit_man <<CF_EOF
2759 < \$i | sed -f `pwd`/edit_man.sed >\$TMP
2762 cat >>$cf_edit_man <<CF_EOF
2767 cat >>$cf_edit_man <<CF_EOF
2768 if test \$cf_tables = yes ; then
2769 tbl \$TMP >\$TMP.out
2774 if test $with_curses_h != yes ; then
2775 cat >>$cf_edit_man <<CF_EOF
2776 sed -e "/\#[ ]*include/s,curses.h,ncurses.h," < \$TMP >\$TMP.out
2781 cat >>$cf_edit_man <<CF_EOF
2782 if test \$form = format ; then
2783 nroff -man \$TMP >\$TMP.out
2788 if test -n "$cf_compress" ; then
2789 cat >>$cf_edit_man <<CF_EOF
2790 if test \$verb = installing ; then
2791 if ( $cf_compress -f \$TMP )
2793 mv \$TMP.$cf_so_strip \$TMP
2796 target="\$target.$cf_so_strip"
2800 case "$MANPAGE_FORMAT" in #(vi
2802 cat >>$cf_edit_man <<CF_EOF
2803 if test \$form = format ; then
2804 # BSDI installs only .0 suffixes in the cat directories
2805 target="\`echo \$target|sed -e 's/\.[[1-9]]\+[[a-z]]*/.0/'\`"
2811 cat >>$cf_edit_man <<CF_EOF
2812 suffix=\`basename \$target | sed -e 's%^[[^.]]*%%'\`
2813 if test \$verb = installing ; then
2814 echo \$verb \$target
2815 \$INSTALL_DATA \$TMP \$target
2816 test -n "\$aliases" && (
2817 cd \$cf_subdir\${section} && (
2818 source=\`echo \$target |sed -e 's%^.*/\([[^/]][[^/]]*/[[^/]][[^/]]*$\)%\1%'\`
2819 test -n "$cf_so_strip" && source=\`echo \$source |sed -e 's%\.$cf_so_strip\$%%'\`
2820 target=\`basename \$target\`
2821 for cf_alias in \$aliases
2823 if test \$section = 1 ; then
2824 cf_alias=\`echo \$cf_alias|sed "\${transform}"\`
2827 if test "$MANPAGE_SYMLINKS" = yes ; then
2828 if test -f \$cf_alias\${suffix} ; then
2829 if ( cmp -s \$target \$cf_alias\${suffix} )
2834 echo .. \$verb alias \$cf_alias\${suffix}
2835 rm -f \$cf_alias\${suffix}
2836 $LN_S \$target \$cf_alias\${suffix}
2837 elif test "\$target" != "\$cf_alias\${suffix}" ; then
2838 echo ".so \$source" >\$TMP
2840 if test -n "$cf_compress" ; then
2841 cat >>$cf_edit_man <<CF_EOF
2842 if test -n "$cf_so_strip" ; then
2843 $cf_compress -f \$TMP
2844 mv \$TMP.$cf_so_strip \$TMP
2848 cat >>$cf_edit_man <<CF_EOF
2849 echo .. \$verb alias \$cf_alias\${suffix}
2850 rm -f \$cf_alias\${suffix}
2851 \$INSTALL_DATA \$TMP \$cf_alias\${suffix}
2856 elif test \$verb = removing ; then
2857 echo \$verb \$target
2859 test -n "\$aliases" && (
2860 cd \$cf_subdir\${section} && (
2861 for cf_alias in \$aliases
2863 if test \$section = 1 ; then
2864 cf_alias=\`echo \$cf_alias|sed "\${transform}"\`
2867 echo .. \$verb alias \$cf_alias\${suffix}
2868 rm -f \$cf_alias\${suffix}
2880 if test $cf_inboth = yes ; then
2881 if test \$form != format ; then
2882 sh \[$]0 format \$verb \$mandir \$srcdir \[$]*
2888 chmod 755 $cf_edit_man
2891 dnl ---------------------------------------------------------------------------
2892 dnl CF_MATH_LIB version: 5 updated: 2000/05/28 01:39:10
2894 dnl Checks for libraries. At least one UNIX system, Apple Macintosh
2895 dnl Rhapsody 5.5, does not have -lm. We cannot use the simpler
2896 dnl AC_CHECK_LIB(m,sin), because that fails for C++.
2897 AC_DEFUN([CF_MATH_LIB],
2899 AC_CACHE_CHECK(if -lm needed for math functions,
2905 [double x = rand(); printf("result = %g\n", ]ifelse($2,,sin(x),$2)[)],
2906 [cf_cv_need_libm=no],
2907 [cf_cv_need_libm=yes])])
2908 if test "$cf_cv_need_libm" = yes
2915 dnl ---------------------------------------------------------------------------
2916 dnl CF_MIXEDCASE_FILENAMES version: 3 updated: 2003/09/20 17:07:55
2917 dnl ----------------------
2918 dnl Check if the file-system supports mixed-case filenames. If we're able to
2919 dnl create a lowercase name and see it as uppercase, it doesn't support that.
2920 AC_DEFUN([CF_MIXEDCASE_FILENAMES],
2922 AC_CACHE_CHECK(if filesystem supports mixed-case filenames,cf_cv_mixedcase,[
2923 if test "$cross_compiling" = yes ; then
2924 case $target_alias in #(vi
2925 *-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-mingw32*|*-uwin*) #(vi
2933 rm -f conftest CONFTEST
2935 if test -f CONFTEST ; then
2940 rm -f conftest CONFTEST
2943 test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES)
2945 dnl ---------------------------------------------------------------------------
2946 dnl CF_MKSTEMP version: 3 updated: 2001/11/08 20:59:59
2948 dnl Check for a working mkstemp. This creates two files, checks that they are
2949 dnl successfully created and distinct (AmigaOS apparently fails on the last).
2950 AC_DEFUN([CF_MKSTEMP],[
2951 AC_CACHE_CHECK(for working mkstemp, cf_cv_func_mkstemp,[
2954 #include <sys/types.h>
2958 #include <sys/stat.h>
2961 char *tmpl = "conftestXXXXXX";
2969 for (n = 0; n < 2; ++n) {
2970 strcpy(name[n], tmpl);
2971 if ((fd = mkstemp(name[n])) >= 0) {
2972 if (!strcmp(name[n], tmpl)
2973 || stat(name[n], &sb) != 0
2974 || (sb.st_mode & S_IFMT) != S_IFREG
2975 || (sb.st_mode & 077) != 0) {
2982 && !strcmp(name[0], name[1]))
2986 ],[cf_cv_func_mkstemp=yes
2987 ],[cf_cv_func_mkstemp=no
2988 ],[AC_CHECK_FUNC(mkstemp)
2991 if test "$cf_cv_func_mkstemp" = yes ; then
2992 AC_DEFINE(HAVE_MKSTEMP)
2995 dnl ---------------------------------------------------------------------------
2996 dnl CF_MSG_LOG version: 3 updated: 1997/09/07 14:05:52
2998 dnl Write a debug message to config.log, along with the line number in the
2999 dnl configure script.
3000 AC_DEFUN([CF_MSG_LOG],[
3001 echo "(line __oline__) testing $* ..." 1>&AC_FD_CC
3003 dnl ---------------------------------------------------------------------------
3004 dnl CF_NCURSES_ABI_6 version: 1 updated: 2005/09/17 18:42:49
3005 dnl ----------------
3006 dnl Set ncurses' ABI to 6 unless overridden by explicit configure option, and
3007 dnl warn about this.
3008 AC_DEFUN([CF_NCURSES_ABI_6],[
3009 if test "${with_abi_version+set}" != set; then
3010 case $cf_cv_rel_version in
3012 cf_cv_rel_version=6.0
3014 AC_MSG_WARN(Overriding ABI version to $cf_cv_abi_version)
3019 dnl ---------------------------------------------------------------------------
3020 dnl CF_NUMBER_SYNTAX version: 1 updated: 2003/09/20 18:12:49
3021 dnl ----------------
3022 dnl Check if the given variable is a number. If not, report an error.
3023 dnl $1 is the variable
3024 dnl $2 is the message
3025 AC_DEFUN([CF_NUMBER_SYNTAX],[
3026 if test -n "$1" ; then
3031 AC_MSG_ERROR($2 is not a number: $1)
3035 AC_MSG_ERROR($2 value is empty)
3038 dnl ---------------------------------------------------------------------------
3039 dnl CF_OBJ_SUBDIR version: 4 updated: 2002/02/23 20:38:31
3041 dnl Compute the object-directory name from the given model name
3042 AC_DEFUN([CF_OBJ_SUBDIR],
3045 libtool) $2='obj_lo' ;;
3046 normal) $2='objects' ;;
3047 debug) $2='obj_g' ;;
3048 profile) $2='obj_p' ;;
3050 case $cf_cv_system_name in #(vi
3058 dnl ---------------------------------------------------------------------------
3059 dnl CF_PATHSEP version: 3 updated: 2001/01/12 01:23:53
3061 dnl Provide a value for the $PATH and similar separator
3062 AC_DEFUN([CF_PATHSEP],
3064 case $cf_cv_system_name in
3065 os2*) PATHSEP=';' ;;
3068 ifelse($1,,,[$1=$PATHSEP])
3071 dnl ---------------------------------------------------------------------------
3072 dnl CF_PATH_SYNTAX version: 9 updated: 2002/09/17 23:03:38
3074 dnl Check the argument to see that it looks like a pathname. Rewrite it if it
3075 dnl begins with one of the prefix/exec_prefix variables, and then again if the
3076 dnl result begins with 'NONE'. This is necessary to work around autoconf's
3077 dnl delayed evaluation of those symbols.
3078 AC_DEFUN([CF_PATH_SYNTAX],[
3079 case ".[$]$1" in #(vi
3080 .\[$]\(*\)*|.\'*\'*) #(vi
3084 .[[a-zA-Z]]:[[\\/]]*) #(vi OS/2 EMX
3086 .\[$]{*prefix}*) #(vi
3088 case ".[$]$1" in #(vi
3090 $1=`echo [$]$1 | sed -e s%NONE%$ac_default_prefix%`
3095 $1=`echo [$]$1 | sed -e s%NONE%$ac_default_prefix%`
3098 ifelse($2,,[AC_ERROR([expected a pathname, not \"[$]$1\"])],$2)
3102 dnl ---------------------------------------------------------------------------
3103 dnl CF_POSIX_C_SOURCE version: 6 updated: 2005/07/14 20:25:10
3104 dnl -----------------
3105 dnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed.
3107 dnl POSIX.1-1990 _POSIX_SOURCE
3108 dnl POSIX.1-1990 and _POSIX_SOURCE and
3109 dnl POSIX.2-1992 C-Language _POSIX_C_SOURCE=2
3111 dnl POSIX.1b-1993 _POSIX_C_SOURCE=199309L
3112 dnl POSIX.1c-1996 _POSIX_C_SOURCE=199506L
3113 dnl X/Open 2000 _POSIX_C_SOURCE=200112L
3116 dnl $1 is the nominal value for _POSIX_C_SOURCE
3117 AC_DEFUN([CF_POSIX_C_SOURCE],
3119 cf_POSIX_C_SOURCE=ifelse($1,,199506L,$1)
3121 cf_save_CFLAGS="$CFLAGS"
3122 cf_save_CPPFLAGS="$CPPFLAGS"
3124 CF_REMOVE_DEFINE(cf_trim_CFLAGS,$cf_save_CFLAGS,_POSIX_C_SOURCE)
3125 CF_REMOVE_DEFINE(cf_trim_CPPFLAGS,$cf_save_CPPFLAGS,_POSIX_C_SOURCE)
3127 AC_CACHE_CHECK(if we should define _POSIX_C_SOURCE,cf_cv_posix_c_source,[
3128 CF_MSG_LOG(if the symbol is already defined go no further)
3129 AC_TRY_COMPILE([#include <sys/types.h>],[
3130 #ifndef _POSIX_C_SOURCE
3133 [cf_cv_posix_c_source=no],
3134 [cf_want_posix_source=no
3135 case .$cf_POSIX_C_SOURCE in #(vi
3137 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
3140 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
3141 cf_want_posix_source=yes
3144 cf_want_posix_source=yes
3147 if test "$cf_want_posix_source" = yes ; then
3148 AC_TRY_COMPILE([#include <sys/types.h>],[
3149 #ifdef _POSIX_SOURCE
3152 cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE")
3154 CF_MSG_LOG(ifdef from value $cf_POSIX_C_SOURCE)
3155 CFLAGS="$cf_trim_CFLAGS"
3156 CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source"
3157 CF_MSG_LOG(if the second compile does not leave our definition intact error)
3158 AC_TRY_COMPILE([#include <sys/types.h>],[
3159 #ifndef _POSIX_C_SOURCE
3162 [cf_cv_posix_c_source=no])
3163 CFLAGS="$cf_save_CFLAGS"
3164 CPPFLAGS="$cf_save_CPPFLAGS"
3168 if test "$cf_cv_posix_c_source" != no ; then
3169 CFLAGS="$cf_trim_CFLAGS"
3170 CPPFLAGS="$cf_trim_CPPFLAGS"
3171 if test "$cf_cv_cc_u_d_options" = yes ; then
3172 cf_temp_posix_c_source=`echo "$cf_cv_posix_c_source" | \
3173 sed -e 's/-D/-U/g' -e 's/=[[^ ]]*//g'`
3174 CPPFLAGS="$CPPFLAGS $cf_temp_posix_c_source"
3176 CPPFLAGS="$CPPFLAGS $cf_cv_posix_c_source"
3180 dnl ---------------------------------------------------------------------------
3181 dnl CF_PREDEFINE version: 1 updated: 2003/07/26 17:53:56
3183 dnl Add definitions to CPPFLAGS to ensure they're predefined for all compiles.
3185 dnl $1 = symbol to test
3186 dnl $2 = value (if any) to use for a predefinition
3187 AC_DEFUN([CF_PREDEFINE],
3189 AC_MSG_CHECKING(if we must define $1)
3190 AC_TRY_COMPILE([#include <sys/types.h>
3194 #endif],[cf_result=no],[cf_result=yes])
3195 AC_MSG_RESULT($cf_result)
3197 if test "$cf_result" = yes ; then
3198 CPPFLAGS="$CPPFLAGS ifelse($2,,-D$1,[-D$1=$2])"
3199 elif test "x$2" != "x" ; then
3200 AC_MSG_CHECKING(checking for compatible value versus $2)
3201 AC_TRY_COMPILE([#include <sys/types.h>
3205 #endif],[cf_result=yes],[cf_result=no])
3206 AC_MSG_RESULT($cf_result)
3207 if test "$cf_result" = no ; then
3208 # perhaps we can override it - try...
3209 CPPFLAGS="$CPPFLAGS -D$1=$2"
3213 dnl ---------------------------------------------------------------------------
3214 dnl CF_PROG_CC_C_O version: 1 updated: 2004/02/14 15:00:43
3216 dnl Analogous to AC_PROG_CC_C_O, but more useful: tests only $CC, ensures that
3217 dnl the output file can be renamed, and allows for a shell variable that can
3218 dnl be used later. The parameter is either CC or CXX. The result is the
3220 dnl $cf_cv_prog_CC_c_o
3221 dnl $cf_cv_prog_CXX_c_o
3222 AC_DEFUN([CF_PROG_CC_C_O],
3223 [AC_REQUIRE([AC_PROG_CC])dnl
3224 AC_MSG_CHECKING([whether [$]$1 understands -c and -o together])
3225 AC_CACHE_VAL(cf_cv_prog_$1_c_o,
3227 cat > conftest.$ac_ext <<CF_EOF
3234 # We do the test twice because some compilers refuse to overwrite an
3235 # existing .o file with -o, though they will create one.
3236 ac_try='[$]$1 -c conftest.$ac_ext -o conftest2.$ac_objext >&AC_FD_CC'
3237 if AC_TRY_EVAL(ac_try) &&
3238 test -f conftest2.$ac_objext && AC_TRY_EVAL(ac_try);
3240 eval cf_cv_prog_$1_c_o=yes
3242 eval cf_cv_prog_$1_c_o=no
3246 if test $cf_cv_prog_$1_c_o = yes; then
3247 AC_MSG_RESULT([yes])
3252 dnl ---------------------------------------------------------------------------
3253 dnl CF_PROG_CC_U_D version: 1 updated: 2005/07/14 16:59:30
3255 dnl Check if C (preprocessor) -U and -D options are processed in the order
3256 dnl given rather than by type of option. Some compilers insist on apply all
3257 dnl of the -U options after all of the -D options. Others allow mixing them,
3258 dnl and may predefine symbols that conflict with those we define.
3259 AC_DEFUN([CF_PROG_CC_U_D],
3261 AC_CACHE_CHECK(if $CC -U and -D options work together,cf_cv_cc_u_d_options,[
3262 cf_save_CPPFLAGS="$CPPFLAGS"
3263 CPPFLAGS="-UU_D_OPTIONS -DU_D_OPTIONS -DD_U_OPTIONS -UD_U_OPTIONS"
3266 make an undefined-error
3269 make a defined-error
3272 cf_cv_cc_u_d_options=yes],[
3273 cf_cv_cc_u_d_options=no])
3274 CPPFLAGS="$cf_save_CPPFLAGS"
3277 dnl ---------------------------------------------------------------------------
3278 dnl CF_PROG_EXT version: 10 updated: 2004/01/03 19:28:18
3280 dnl Compute $PROG_EXT, used for non-Unix ports, such as OS/2 EMX.
3281 AC_DEFUN([CF_PROG_EXT],
3283 AC_REQUIRE([CF_CHECK_CACHE])
3284 case $cf_cv_system_name in
3286 CFLAGS="$CFLAGS -Zmt"
3287 CPPFLAGS="$CPPFLAGS -D__ST_MT_ERRNO__"
3288 CXXFLAGS="$CXXFLAGS -Zmt"
3289 # autoconf's macro sets -Zexe and suffix both, which conflict:w
3290 LDFLAGS="$LDFLAGS -Zmt -Zcrtdll"
3300 test -n "$PROG_EXT" && AC_DEFINE_UNQUOTED(PROG_EXT,"$PROG_EXT")
3302 dnl ---------------------------------------------------------------------------
3303 dnl CF_PROG_INSTALL version: 5 updated: 2002/12/21 22:46:07
3305 dnl Force $INSTALL to be an absolute-path. Otherwise, edit_man.sh and the
3306 dnl misc/tabset install won't work properly. Usually this happens only when
3307 dnl using the fallback mkinstalldirs script
3308 AC_DEFUN([CF_PROG_INSTALL],
3314 CF_DIRNAME(cf_dir,$INSTALL)
3315 test -z "$cf_dir" && cf_dir=.
3316 INSTALL=`cd $cf_dir && pwd`/`echo $INSTALL | sed -e 's%^.*/%%'`
3320 dnl ---------------------------------------------------------------------------
3321 dnl CF_PROG_LDCONFIG version: 1 updated: 2003/09/20 17:07:55
3322 dnl ----------------
3323 dnl Check for ldconfig, needed to fixup shared libraries that would be built
3324 dnl and then used in the install.
3325 AC_DEFUN([CF_PROG_LDCONFIG],[
3326 if test "$cross_compiling" = yes ; then
3329 case "$cf_cv_system_name" in #(vi
3331 test -z "$LDCONFIG" && LDCONFIG="/sbin/ldconfig -R"
3333 *) LDPATH=$PATH:/sbin:/usr/sbin
3334 AC_PATH_PROG(LDCONFIG,ldconfig,,$LDPATH)
3340 dnl ---------------------------------------------------------------------------
3341 dnl CF_REGEX version: 3 updated: 1997/11/01 14:26:01
3343 dnl Attempt to determine if we've got one of the flavors of regular-expression
3344 dnl code that we can support.
3345 AC_DEFUN([CF_REGEX],
3347 AC_MSG_CHECKING([for regular-expression headers])
3348 AC_CACHE_VAL(cf_cv_regex,[
3349 AC_TRY_LINK([#include <sys/types.h>
3350 #include <regex.h>],[
3352 int x = regcomp(p, "", 0);
3353 int y = regexec(p, "", 0, 0, 0);
3355 ],[cf_cv_regex="regex.h"],[
3356 AC_TRY_LINK([#include <regexp.h>],[
3357 char *p = compile("", "", "", 0);
3358 int x = step("", "");
3359 ],[cf_cv_regex="regexp.h"],[
3360 cf_save_LIBS="$LIBS"
3362 AC_TRY_LINK([#include <regexpr.h>],[
3363 char *p = compile("", "", "");
3364 int x = step("", "");
3365 ],[cf_cv_regex="regexpr.h"],[LIBS="$cf_save_LIBS"])])])
3367 AC_MSG_RESULT($cf_cv_regex)
3368 case $cf_cv_regex in
3369 regex.h) AC_DEFINE(HAVE_REGEX_H_FUNCS) ;;
3370 regexp.h) AC_DEFINE(HAVE_REGEXP_H_FUNCS) ;;
3371 regexpr.h) AC_DEFINE(HAVE_REGEXPR_H_FUNCS) ;;
3374 dnl ---------------------------------------------------------------------------
3375 dnl CF_REMOVE_DEFINE version: 2 updated: 2005/07/09 16:12:18
3376 dnl ----------------
3377 dnl Remove all -U and -D options that refer to the given symbol from a list
3378 dnl of C compiler options. This works around the problem that not all
3379 dnl compilers process -U and -D options from left-to-right, so a -U option
3380 dnl cannot be used to cancel the effect of a preceding -D option.
3382 dnl $1 = target (which could be the same as the source variable)
3383 dnl $2 = source (including '$')
3384 dnl $3 = symbol to remove
3385 define([CF_REMOVE_DEFINE],
3387 # remove $3 symbol from $2
3389 sed -e 's/-[[UD]]$3\(=[[^ ]]*\)\?[[ ]]/ /g' \
3390 -e 's/-[[UD]]$3\(=[[^ ]]*\)\?[$]//g'`
3392 dnl ---------------------------------------------------------------------------
3393 dnl CF_SHARED_OPTS version: 31 updated: 2005/01/01 16:39:44
3395 dnl Attempt to determine the appropriate CC/LD options for creating a shared
3398 dnl Note: $(LOCAL_LDFLAGS) is used to link executables that will run within the
3399 dnl build-tree, i.e., by making use of the libraries that are compiled in ../lib
3400 dnl We avoid compiling-in a ../lib path for the shared library since that can
3401 dnl lead to unexpected results at runtime.
3402 dnl $(LOCAL_LDFLAGS2) has the same intention but assumes that the shared libraries
3403 dnl are compiled in ../../lib
3405 dnl The variable 'cf_cv_do_symlinks' is used to control whether we configure
3406 dnl to install symbolic links to the rel/abi versions of shared libraries.
3408 dnl The variable 'cf_cv_shlib_version' controls whether we use the rel or abi
3409 dnl version when making symbolic links.
3411 dnl The variable 'cf_cv_shlib_version_infix' controls whether shared library
3412 dnl version numbers are infix (ex: libncurses.<ver>.dylib) or postfix
3413 dnl (ex: libncurses.so.<ver>).
3415 dnl Some loaders leave 'so_locations' lying around. It's nice to clean up.
3416 AC_DEFUN([CF_SHARED_OPTS],
3418 AC_REQUIRE([CF_SUBST_NCURSES_VERSION])
3422 INSTALL_LIB="-m 644"
3424 cf_cv_do_symlinks=no
3426 AC_MSG_CHECKING(if release/abi version should be used for shared libs)
3427 AC_ARG_WITH(shlib-version,
3428 [ --with-shlib-version=X Specify rel or abi version for shared libs],
3429 [test -z "$withval" && withval=auto
3430 case $withval in #(vi
3432 cf_cv_shlib_version=auto
3434 rel|abi|auto|no) #(vi
3435 cf_cv_shlib_version=$withval
3438 AC_ERROR([option value must be one of: rel, abi, auto or no])
3441 ],[cf_cv_shlib_version=auto])
3442 AC_MSG_RESULT($cf_cv_shlib_version)
3446 # Some less-capable ports of gcc support only -fpic
3448 if test "$GCC" = yes
3450 AC_MSG_CHECKING(which $CC option to use)
3451 cf_save_CFLAGS="$CFLAGS"
3452 for CC_SHARED_OPTS in -fPIC -fpic ''
3454 CFLAGS="$cf_save_CFLAGS $CC_SHARED_OPTS"
3455 AC_TRY_COMPILE([#include <stdio.h>],[int x = 1],[break],[])
3457 AC_MSG_RESULT($CC_SHARED_OPTS)
3458 CFLAGS="$cf_save_CFLAGS"
3461 cf_cv_shlib_version_infix=no
3463 case $cf_cv_system_name in
3465 MK_SHARED_LIB='$(CC) -o $[@] -Xlinker -soname=`basename $[@]` -nostart -e 0'
3469 MK_SHARED_LIB='$(CC) -shared -Wl,--out-implib=$(IMPORT_LIB) -Wl,--export-all-symbols -o $(SHARED_LIB)'
3470 cf_cv_shlib_version=cygdll
3471 cf_cv_shlib_version_infix=cygdll
3474 EXTRA_CFLAGS="-no-cpp-precomp"
3475 CC_SHARED_OPTS="-dynamic"
3476 MK_SHARED_LIB='$(CC) -dynamiclib -install_name $(DESTDIR)$(libdir)/`basename $[@]` -compatibility_version $(ABI_VERSION) -current_version $(ABI_VERSION) -o $[@]'
3477 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=abi
3478 cf_cv_shlib_version_infix=yes
3481 # (tested with gcc 2.7.2 -- I don't have c89)
3482 if test "$GCC" = yes; then
3483 LD_SHARED_OPTS='-Xlinker +b -Xlinker $(libdir)'
3486 LD_SHARED_OPTS='-Wl,+b,$(libdir)'
3488 MK_SHARED_LIB='$(LD) +b $(libdir) -b -o $[@]'
3489 # HP-UX shared libraries must be executable, and should be
3490 # readonly to exploit a quirk in the memory manager.
3491 INSTALL_LIB="-m 555"
3494 if test "$cf_cv_ld_rpath" = yes ; then
3495 if test "$GCC" = yes; then
3496 cf_ld_rpath_opt="-Wl,-rpath,"
3497 EXTRA_LDFLAGS="-Wl,-rpath,\$(libdir) $EXTRA_LDFLAGS"
3499 cf_ld_rpath_opt="-rpath "
3500 EXTRA_LDFLAGS="-rpath \$(libdir) $EXTRA_LDFLAGS"
3503 # tested with IRIX 5.2 and 'cc'.
3504 if test "$GCC" != yes; then
3505 CC_SHARED_OPTS='-KPIC'
3507 MK_SHARED_LIB='$(LD) -shared -rdata_shared -soname `basename $[@]` -o $[@]'
3508 cf_cv_rm_so_locs=yes
3510 linux*|gnu*|k*bsd*-gnu)
3511 if test "$DFT_LWR_MODEL" = "shared" ; then
3512 LOCAL_LDFLAGS="-Wl,-rpath,`pwd`/lib"
3513 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
3515 if test "$cf_cv_ld_rpath" = yes ; then
3516 cf_ld_rpath_opt="-Wl,-rpath,"
3517 EXTRA_LDFLAGS="$LOCAL_LDFLAGS $EXTRA_LDFLAGS"
3519 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
3520 MK_SHARED_LIB='$(CC) -shared -Wl,-soname,`basename $[@] .$(REL_VERSION)`.$(ABI_VERSION),-stats,-lc -o $[@]'
3523 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
3524 MK_SHARED_LIB='$(LD) -Bshareable -soname,`basename $[@].$(ABI_VERSION)` -o $[@]'
3527 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
3528 MK_SHARED_LIB='$(LD) -Bshareable -soname=`basename $[@]` -o $[@]'
3529 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
3531 # This doesn't work - I keep getting spurious references to needing
3532 # libncurses.so.5.3 when ldd says it's resolved. LOCAL_LDFLAGS2 seems to be
3533 # no longer used anyway. And the rpath logic isn't relative - so I have to
3534 # add the local and install lib-directories:
3536 # if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_ld_rpath" = yes ; then
3537 # LOCAL_LDFLAGS="-rpath `pwd`/lib"
3538 # LOCAL_LDFLAGS2="-rpath \$(libdir) $LOCAL_LDFLAGS"
3539 # cf_ld_rpath_opt="-rpath "
3540 # EXTRA_LDFLAGS="$LOCAL_LDFLAGS $EXTRA_LDFLAGS"
3544 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
3545 MK_SHARED_LIB='$(LD) -Bshareable -o $[@]'
3546 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
3549 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
3550 test "$cf_cv_ld_rpath" = yes && cf_ld_rpath_opt="-Wl,-rpath,"
3551 if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_ld_rpath" = yes ; then
3552 LOCAL_LDFLAGS="-Wl,-rpath,`pwd`/lib"
3553 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
3554 EXTRA_LDFLAGS="-Wl,-rpath,\$(libdir) $EXTRA_LDFLAGS"
3555 MK_SHARED_LIB='$(CC) -shared -Wl,-soname,`basename $[@] .$(REL_VERSION)`.$(ABI_VERSION) -o $[@]'
3556 if test "$cf_cv_shlib_version" = auto; then
3557 if test ! -f /usr/libexec/ld.elf_so; then
3558 cf_cv_shlib_version=rel
3562 MK_SHARED_LIB='$(LD) -Bshareable -o $[@]'
3566 # tested with OSF/1 V3.2 and 'cc'
3567 # tested with OSF/1 V3.2 and gcc 2.6.3 (but the c++ demo didn't
3568 # link with shared libs).
3569 MK_SHARED_LIB='$(LD) -set_version $(REL_VERSION):$(ABI_VERSION) -expect_unresolved "*" -shared -soname `basename $[@]`'
3572 MK_SHARED_LIB="${MK_SHARED_LIB} -msym"
3575 MK_SHARED_LIB="${MK_SHARED_LIB}"' -o $[@]'
3576 if test "$DFT_LWR_MODEL" = "shared" ; then
3577 LOCAL_LDFLAGS="-Wl,-rpath,`pwd`/lib"
3578 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
3580 if test "$cf_cv_ld_rpath" = yes ; then
3581 cf_ld_rpath_opt="-rpath"
3582 # EXTRA_LDFLAGS="$LOCAL_LDFLAGS $EXTRA_LDFLAGS"
3584 cf_cv_rm_so_locs=yes
3586 sco3.2v5*) # (also uw2* and UW7) hops 13-Apr-98
3587 # tested with osr5.0.5
3588 if test "$GCC" != yes; then
3589 CC_SHARED_OPTS='-belf -KPIC'
3591 MK_SHARED_LIB='$(LD) -dy -G -h `basename $[@] .$(REL_VERSION)`.$(ABI_VERSION) -o [$]@'
3592 if test "$cf_cv_ld_rpath" = yes ; then
3593 # only way is to set LD_RUN_PATH but no switch for it
3596 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
3597 LINK_PROGS='LD_RUN_PATH=$(libdir)'
3598 LINK_TESTS='Pwd=`pwd`;LD_RUN_PATH=`dirname $${Pwd}`/lib'
3601 # tested with SunOS 4.1.1 and gcc 2.7.0
3602 if test "$GCC" != yes; then
3603 CC_SHARED_OPTS='-KPIC'
3605 MK_SHARED_LIB='$(LD) -assert pure-text -o $[@]'
3606 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
3609 # tested with SunOS 5.5.1 (solaris 2.5.1) and gcc 2.7.2
3610 if test "$GCC" != yes; then
3611 CC_SHARED_OPTS='-KPIC'
3613 MK_SHARED_LIB='$(LD) -dy -G -h `basename $[@] .$(REL_VERSION)`.$(ABI_VERSION) -o $[@]'
3614 if test "$DFT_LWR_MODEL" = "shared" ; then
3615 LOCAL_LDFLAGS="-R `pwd`/lib:\$(libdir)"
3616 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
3618 if test "$cf_cv_ld_rpath" = yes ; then
3619 cf_ld_rpath_opt="-R"
3620 EXTRA_LDFLAGS="$LOCAL_LDFLAGS $EXTRA_LDFLAGS"
3622 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
3625 # tested with UnixWare 7.1.0 (gcc 2.95.2 and cc)
3626 if test "$GCC" != yes; then
3627 CC_SHARED_OPTS='-KPIC'
3629 MK_SHARED_LIB='$(LD) -d y -G -o [$]@'
3632 CC_SHARED_OPTS='unknown'
3633 MK_SHARED_LIB='echo unknown'
3637 # This works if the last tokens in $MK_SHARED_LIB are the -o target.
3638 case "$cf_cv_shlib_version" in #(vi
3640 case "$MK_SHARED_LIB" in #(vi
3642 test "$cf_cv_do_symlinks" = no && cf_cv_do_symlinks=yes
3645 AC_MSG_WARN(ignored --with-shlib-version)
3651 if test -n "$cf_ld_rpath_opt" ; then
3652 AC_MSG_CHECKING(if we need a space after rpath option)
3653 cf_save_LIBS="$LIBS"
3654 LIBS="$LIBS ${cf_ld_rpath_opt}$libdir"
3655 AC_TRY_LINK(, , cf_rpath_space=no, cf_rpath_space=yes)
3656 LIBS="$cf_save_LIBS"
3657 AC_MSG_RESULT($cf_rpath_space)
3658 test "$cf_rpath_space" = yes && cf_ld_rpath_opt="$cf_ld_rpath_opt "
3659 MK_SHARED_LIB="$MK_SHARED_LIB $cf_ld_rpath_opt\$(libdir)"
3662 AC_SUBST(CC_SHARED_OPTS)
3663 AC_SUBST(LD_SHARED_OPTS)
3664 AC_SUBST(MK_SHARED_LIB)
3665 AC_SUBST(LINK_PROGS)
3666 AC_SUBST(LINK_TESTS)
3667 AC_SUBST(EXTRA_LDFLAGS)
3668 AC_SUBST(LOCAL_LDFLAGS)
3669 AC_SUBST(LOCAL_LDFLAGS2)
3670 AC_SUBST(INSTALL_LIB)
3672 dnl ---------------------------------------------------------------------------
3673 dnl CF_SIZECHANGE version: 8 updated: 2000/11/04 12:22:16
3675 dnl Check for definitions & structures needed for window size-changing
3676 dnl FIXME: check that this works with "snake" (HP-UX 10.x)
3677 AC_DEFUN([CF_SIZECHANGE],
3679 AC_REQUIRE([CF_STRUCT_TERMIOS])
3680 AC_CACHE_CHECK(declaration of size-change, cf_cv_sizechange,[
3681 cf_cv_sizechange=unknown
3682 cf_save_CPPFLAGS="$CPPFLAGS"
3684 for cf_opts in "" "NEED_PTEM_H"
3687 CPPFLAGS="$cf_save_CPPFLAGS"
3688 test -n "$cf_opts" && CPPFLAGS="$CPPFLAGS -D$cf_opts"
3689 AC_TRY_COMPILE([#include <sys/types.h>
3690 #ifdef HAVE_TERMIOS_H
3691 #include <termios.h>
3693 #ifdef HAVE_TERMIO_H
3698 /* This is a workaround for SCO: they neglected to define struct winsize in
3699 * termios.h -- it's only in termio.h and ptem.h
3701 #include <sys/stream.h>
3702 #include <sys/ptem.h>
3704 #if !defined(sun) || !defined(HAVE_TERMIOS_H)
3705 #include <sys/ioctl.h>
3709 struct ttysize win; /* FIXME: what system is this? */
3710 int y = win.ts_lines;
3711 int x = win.ts_cols;
3718 no TIOCGSIZE or TIOCGWINSZ
3719 #endif /* TIOCGWINSZ */
3720 #endif /* TIOCGSIZE */
3722 [cf_cv_sizechange=yes],
3723 [cf_cv_sizechange=no])
3725 CPPFLAGS="$cf_save_CPPFLAGS"
3726 if test "$cf_cv_sizechange" = yes ; then
3727 echo "size-change succeeded ($cf_opts)" >&AC_FD_CC
3728 test -n "$cf_opts" && cf_cv_sizechange="$cf_opts"
3733 if test "$cf_cv_sizechange" != no ; then
3734 AC_DEFINE(HAVE_SIZECHANGE)
3735 case $cf_cv_sizechange in #(vi
3737 AC_DEFINE_UNQUOTED($cf_cv_sizechange )
3742 dnl ---------------------------------------------------------------------------
3743 dnl CF_SRC_MODULES version: 18 updated: 2005/05/28 12:58:54
3745 dnl For each parameter, test if the source-directory exists, and if it contains
3746 dnl a 'modules' file. If so, add to the list $cf_cv_src_modules which we'll
3747 dnl use in CF_LIB_RULES.
3749 dnl This uses the configured value to make the lists SRC_SUBDIRS and
3750 dnl SUB_MAKEFILES which are used in the makefile-generation scheme.
3751 AC_DEFUN([CF_SRC_MODULES],
3753 AC_MSG_CHECKING(for src modules)
3755 # dependencies and linker-arguments for test-programs
3756 TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${LIB_NAME}${DFT_DEP_SUFFIX} $TEST_DEPS"
3757 TEST_DEP2="${LIB_2ND}/${LIB_PREFIX}${LIB_NAME}${DFT_DEP_SUFFIX} $TEST_DEP2"
3758 if test "$DFT_LWR_MODEL" = "libtool"; then
3759 TEST_ARGS="${TEST_DEPS}"
3760 TEST_ARG2="${TEST_DEP2}"
3762 TEST_ARGS="-l${LIB_NAME}${DFT_ARG_SUFFIX} $TEST_ARGS"
3763 TEST_ARG2="-l${LIB_NAME}${DFT_ARG_SUFFIX} $TEST_ARG2"
3769 if test -f $srcdir/$cf_dir/modules; then
3771 # We may/may not have tack in the distribution, though the
3773 if test $cf_dir = tack ; then
3774 if test ! -f $srcdir/${cf_dir}/${cf_dir}.h; then
3779 if test -z "$cf_cv_src_modules"; then
3780 cf_cv_src_modules=$cf_dir
3782 cf_cv_src_modules="$cf_cv_src_modules $cf_dir"
3785 # Make the ncurses_cfg.h file record the library interface files as
3786 # well. These are header files that are the same name as their
3787 # directory. Ncurses is the only library that does not follow
3789 if test $cf_dir = tack ; then
3791 elif test -f $srcdir/${cf_dir}/${cf_dir}.h; then
3792 CF_UPPER(cf_have_include,$cf_dir)
3793 AC_DEFINE_UNQUOTED(HAVE_${cf_have_include}_H)
3794 AC_DEFINE_UNQUOTED(HAVE_LIB${cf_have_include})
3795 TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${cf_dir}${DFT_DEP_SUFFIX} $TEST_DEPS"
3796 TEST_DEP2="${LIB_2ND}/${LIB_PREFIX}${cf_dir}${DFT_DEP_SUFFIX} $TEST_DEP2"
3797 if test "$DFT_LWR_MODEL" = "libtool"; then
3798 TEST_ARGS="${TEST_DEPS}"
3799 TEST_ARG2="${TEST_DEP2}"
3801 TEST_ARGS="-l${cf_dir}${DFT_ARG_SUFFIX} $TEST_ARGS"
3802 TEST_ARG2="-l${cf_dir}${DFT_ARG_SUFFIX} $TEST_ARG2"
3807 AC_MSG_RESULT($cf_cv_src_modules)
3809 TEST_ARGS="-L${LIB_DIR} $TEST_ARGS"
3810 TEST_ARG2="-L${LIB_2ND} $TEST_ARG2"
3818 SRC_SUBDIRS="man include"
3819 for cf_dir in $cf_cv_src_modules
3821 SRC_SUBDIRS="$SRC_SUBDIRS $cf_dir"
3823 SRC_SUBDIRS="$SRC_SUBDIRS test"
3824 test -z "$MAKE_TERMINFO" && SRC_SUBDIRS="$SRC_SUBDIRS misc"
3825 test "$cf_with_cxx_binding" != no && SRC_SUBDIRS="$SRC_SUBDIRS c++"
3828 if test "$cf_cv_prog_gnat_correct" = yes && test -f $srcdir/Ada95/Makefile.in; then
3829 SRC_SUBDIRS="$SRC_SUBDIRS Ada95"
3830 ADA_SUBDIRS="gen src samples"
3834 for cf_dir in $SRC_SUBDIRS
3836 SUB_MAKEFILES="$SUB_MAKEFILES $cf_dir/Makefile"
3839 if test -n "$ADA_SUBDIRS"; then
3840 for cf_dir in $ADA_SUBDIRS
3842 SUB_MAKEFILES="$SUB_MAKEFILES Ada95/$cf_dir/Makefile"
3844 AC_SUBST(ADA_SUBDIRS)
3847 dnl ---------------------------------------------------------------------------
3848 dnl CF_STDCPP_LIBRARY version: 5 updated: 2000/08/12 23:18:52
3849 dnl -----------------
3850 dnl Check for -lstdc++, which is GNU's standard C++ library.
3851 AC_DEFUN([CF_STDCPP_LIBRARY],
3853 if test -n "$GXX" ; then
3854 case $cf_cv_system_name in #(vi
3856 cf_stdcpp_libname=stdcpp
3859 cf_stdcpp_libname=stdc++
3862 AC_CACHE_CHECK(for library $cf_stdcpp_libname,cf_cv_libstdcpp,[
3864 LIBS="$LIBS -l$cf_stdcpp_libname"
3866 #include <strstream.h>],[
3868 strstreambuf foo(buf, sizeof(buf))
3870 [cf_cv_libstdcpp=yes],
3871 [cf_cv_libstdcpp=no])
3874 test "$cf_cv_libstdcpp" = yes && CXXLIBS="$CXXLIBS -l$cf_stdcpp_libname"
3877 dnl ---------------------------------------------------------------------------
3878 dnl CF_STRIP_G_OPT version: 3 updated: 2002/12/21 19:25:52
3880 dnl Remove "-g" option from the compiler options
3881 AC_DEFUN([CF_STRIP_G_OPT],
3882 [$1=`echo ${$1} | sed -e 's%-g %%' -e 's%-g$%%'`])dnl
3883 dnl ---------------------------------------------------------------------------
3884 dnl CF_STRUCT_SIGACTION version: 3 updated: 2000/08/12 23:18:52
3885 dnl -------------------
3886 dnl Check if we need _POSIX_SOURCE defined to use struct sigaction. We'll only
3887 dnl do this if we've found the sigaction function.
3889 dnl If needed, define SVR4_ACTION.
3890 AC_DEFUN([CF_STRUCT_SIGACTION],[
3891 if test "$ac_cv_func_sigaction" = yes; then
3892 AC_MSG_CHECKING(whether sigaction needs _POSIX_SOURCE)
3894 #include <sys/types.h>
3895 #include <signal.h>],
3896 [struct sigaction act],
3900 #define _POSIX_SOURCE
3901 #include <sys/types.h>
3902 #include <signal.h>],
3903 [struct sigaction act],
3905 AC_DEFINE(SVR4_ACTION)],
3906 [sigact_bad=unknown])])
3907 AC_MSG_RESULT($sigact_bad)
3910 dnl ---------------------------------------------------------------------------
3911 dnl CF_STRUCT_TERMIOS version: 5 updated: 2000/11/04 12:22:46
3912 dnl -----------------
3913 dnl Some machines require _POSIX_SOURCE to completely define struct termios.
3914 dnl If so, define SVR4_TERMIO
3915 AC_DEFUN([CF_STRUCT_TERMIOS],[
3921 if test "$ISC" = yes ; then
3922 AC_CHECK_HEADERS( sys/termio.h )
3924 if test "$ac_cv_header_termios_h" = yes ; then
3925 case "$CFLAGS $CPPFLAGS" in
3927 termios_bad=dunno ;;
3928 *) termios_bad=maybe ;;
3930 if test "$termios_bad" = maybe ; then
3931 AC_MSG_CHECKING(whether termios.h needs _POSIX_SOURCE)
3932 AC_TRY_COMPILE([#include <termios.h>],
3933 [struct termios foo; int x = foo.c_iflag],
3936 #define _POSIX_SOURCE
3937 #include <termios.h>],
3938 [struct termios foo; int x = foo.c_iflag],
3939 termios_bad=unknown,
3940 termios_bad=yes AC_DEFINE(SVR4_TERMIO))
3942 AC_MSG_RESULT($termios_bad)
3946 dnl ---------------------------------------------------------------------------
3947 dnl CF_SUBST version: 2 updated: 1997/09/06 23:41:28
3949 dnl Shorthand macro for substituting things that the user may override
3950 dnl with an environment variable.
3952 dnl $1 = long/descriptive name
3953 dnl $2 = environment variable
3954 dnl $3 = default value
3955 AC_DEFUN([CF_SUBST],
3956 [AC_CACHE_VAL(cf_cv_subst_$2,[
3957 AC_MSG_CHECKING(for $1 (symbol $2))
3958 test -z "[$]$2" && $2=$3
3959 AC_MSG_RESULT([$]$2)
3961 cf_cv_subst_$2=[$]$2])
3962 $2=${cf_cv_subst_$2}
3964 dnl ---------------------------------------------------------------------------
3965 dnl CF_SUBST_NCURSES_VERSION version: 7 updated: 2003/06/07 16:22:51
3966 dnl ------------------------
3967 dnl Get the version-number for use in shared-library naming, etc.
3968 AC_DEFUN([CF_SUBST_NCURSES_VERSION],
3970 NCURSES_MAJOR="`egrep '^NCURSES_MAJOR[[ ]]*=' $srcdir/dist.mk | sed -e 's/^[[^0-9]]*//'`"
3971 NCURSES_MINOR="`egrep '^NCURSES_MINOR[[ ]]*=' $srcdir/dist.mk | sed -e 's/^[[^0-9]]*//'`"
3972 NCURSES_PATCH="`egrep '^NCURSES_PATCH[[ ]]*=' $srcdir/dist.mk | sed -e 's/^[[^0-9]]*//'`"
3973 cf_cv_abi_version=${NCURSES_MAJOR}
3974 cf_cv_rel_version=${NCURSES_MAJOR}.${NCURSES_MINOR}
3975 dnl Show the computed version, for logging
3976 cf_cv_timestamp=`date`
3977 AC_MSG_RESULT(Configuring NCURSES $cf_cv_rel_version ABI $cf_cv_abi_version ($cf_cv_timestamp))
3978 dnl We need these values in the generated headers
3979 AC_SUBST(NCURSES_MAJOR)
3980 AC_SUBST(NCURSES_MINOR)
3981 AC_SUBST(NCURSES_PATCH)
3982 dnl We need these values in the generated makefiles
3983 AC_SUBST(cf_cv_rel_version)
3984 AC_SUBST(cf_cv_abi_version)
3985 AC_SUBST(cf_cv_builtin_bool)
3986 AC_SUBST(cf_cv_header_stdbool_h)
3987 AC_SUBST(cf_cv_type_of_bool)dnl
3989 dnl ---------------------------------------------------------------------------
3990 dnl CF_SYS_TIME_SELECT version: 4 updated: 2000/10/04 09:18:40
3991 dnl ------------------
3992 dnl Check if we can include <sys/time.h> with <sys/select.h>; this breaks on
3993 dnl older SCO configurations.
3994 AC_DEFUN([CF_SYS_TIME_SELECT],
3996 AC_MSG_CHECKING(if sys/time.h works with sys/select.h)
3997 AC_CACHE_VAL(cf_cv_sys_time_select,[
3999 #include <sys/types.h>
4000 #ifdef HAVE_SYS_TIME_H
4001 #include <sys/time.h>
4003 #ifdef HAVE_SYS_SELECT_H
4004 #include <sys/select.h>
4006 ],[],[cf_cv_sys_time_select=yes],
4007 [cf_cv_sys_time_select=no])
4009 AC_MSG_RESULT($cf_cv_sys_time_select)
4010 test "$cf_cv_sys_time_select" = yes && AC_DEFINE(HAVE_SYS_TIME_SELECT)
4012 dnl ---------------------------------------------------------------------------
4013 dnl CF_TYPEOF_CHTYPE version: 6 updated: 2005/06/25 16:16:34
4014 dnl ----------------
4015 dnl Determine the type we should use for chtype (and attr_t, which is treated
4016 dnl as the same thing). We want around 32 bits, so on most machines want a
4017 dnl long, but on newer 64-bit machines, probably want an int. If we're using
4018 dnl wide characters, we have to have a type compatible with that, as well.
4019 AC_DEFUN([CF_TYPEOF_CHTYPE],
4021 AC_MSG_CHECKING([for type of chtype])
4022 AC_CACHE_VAL(cf_cv_typeof_chtype,[
4024 #define WANT_BITS 31
4028 FILE *fp = fopen("cf_test.out", "w");
4030 char *result = "long";
4031 if (sizeof(unsigned long) > sizeof(unsigned int)) {
4034 for (n = 0; n < WANT_BITS; n++) {
4037 if (y != 1 || x == 0) {
4043 * If x is nonzero, an int is big enough for the bits
4046 result = (x != 0) ? "int" : "long";
4054 [cf_cv_typeof_chtype=`cat cf_test.out`],
4055 [cf_cv_typeof_chtype=long],
4056 [cf_cv_typeof_chtype=long])
4059 AC_MSG_RESULT($cf_cv_typeof_chtype)
4061 AC_SUBST(cf_cv_typeof_chtype)
4062 AC_DEFINE_UNQUOTED(TYPEOF_CHTYPE,$cf_cv_typeof_chtype)
4064 dnl ---------------------------------------------------------------------------
4065 dnl CF_TYPE_SIGACTION version: 3 updated: 2000/08/12 23:18:52
4066 dnl -----------------
4068 AC_DEFUN([CF_TYPE_SIGACTION],
4070 AC_MSG_CHECKING([for type sigaction_t])
4071 AC_CACHE_VAL(cf_cv_type_sigaction,[
4073 #include <signal.h>],
4075 [cf_cv_type_sigaction=yes],
4076 [cf_cv_type_sigaction=no])])
4077 AC_MSG_RESULT($cf_cv_type_sigaction)
4078 test "$cf_cv_type_sigaction" = yes && AC_DEFINE(HAVE_TYPE_SIGACTION)
4080 dnl ---------------------------------------------------------------------------
4081 dnl CF_UNSIGNED_LITERALS version: 2 updated: 1998/02/07 22:10:16
4082 dnl --------------------
4083 dnl Test if the compiler supports 'U' and 'L' suffixes. Only old compilers
4084 dnl won't, but they're still there.
4085 AC_DEFUN([CF_UNSIGNED_LITERALS],
4087 AC_MSG_CHECKING([if unsigned literals are legal])
4088 AC_CACHE_VAL(cf_cv_unsigned_literals,[
4089 AC_TRY_COMPILE([],[long x = 1L + 1UL + 1U + 1],
4090 [cf_cv_unsigned_literals=yes],
4091 [cf_cv_unsigned_literals=no])
4093 AC_MSG_RESULT($cf_cv_unsigned_literals)
4095 dnl ---------------------------------------------------------------------------
4096 dnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59
4098 dnl Make an uppercase version of a variable
4099 dnl $1=uppercase($2)
4100 AC_DEFUN([CF_UPPER],
4102 $1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
4104 dnl ---------------------------------------------------------------------------
4105 dnl CF_VERBOSE version: 2 updated: 1997/09/05 10:45:14
4107 dnl Use AC_VERBOSE w/o the warnings
4108 AC_DEFUN([CF_VERBOSE],
4109 [test -n "$verbose" && echo " $1" 1>&AC_FD_MSG
4111 dnl ---------------------------------------------------------------------------
4112 dnl CF_WCHAR_TYPE version: 2 updated: 2004/01/17 19:18:20
4114 dnl Check if type wide-character type $1 is declared, and if so, which header
4115 dnl file is needed. The second parameter is used to set a shell variable when
4116 dnl the type is not found. The first parameter sets a shell variable for the
4118 AC_DEFUN([CF_WCHAR_TYPE],
4120 # This is needed on Tru64 5.0 to declare $1
4121 AC_CACHE_CHECK(if we must include wchar.h to declare $1,cf_cv_$1,[
4126 #ifdef HAVE_LIBUTF8_H
4127 #include <libutf8.h>
4136 #ifdef HAVE_LIBUTF8_H
4137 #include <libutf8.h>
4141 [cf_cv_$1=unknown])])])
4143 if test "$cf_cv_$1" = yes ; then
4144 AC_DEFINE(NEED_WCHAR_H)
4149 # if we do not find $1 in either place, use substitution to provide a fallback.
4150 if test "$cf_cv_$1" = unknown ; then
4155 # if we find $1 in either place, use substitution to provide a fallback.
4156 if test "$cf_cv_$1" != unknown ; then
4161 dnl ---------------------------------------------------------------------------
4162 dnl CF_WITH_ABI_VERSION version: 1 updated: 2003/09/20 18:12:49
4163 dnl -------------------
4164 dnl Allow library's ABI to be overridden. Generally this happens when a
4165 dnl packager has incremented the ABI past that used in the original package,
4166 dnl and wishes to keep doing this.
4168 dnl $1 is the package name, if any, to derive a corresponding {package}_ABI
4170 AC_DEFUN([CF_WITH_ABI_VERSION],[
4171 test -z "$cf_cv_abi_version" && cf_cv_abi_version=0
4172 AC_ARG_WITH(abi-version,
4173 [ --with-abi-version=XXX override derived ABI version],
4174 [AC_MSG_WARN(overriding ABI version $cf_cv_abi_version to $withval)
4175 cf_cv_abi_version=$withval])
4176 CF_NUMBER_SYNTAX($cf_cv_abi_version,ABI version)
4178 $1_ABI=$cf_cv_abi_version
4181 dnl ---------------------------------------------------------------------------
4182 dnl CF_WITH_DBMALLOC version: 4 updated: 2004/02/28 05:49:27
4183 dnl ----------------
4184 dnl Configure-option for dbmalloc. The optional parameter is used to override
4185 dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests.
4186 AC_DEFUN([CF_WITH_DBMALLOC],[
4187 AC_MSG_CHECKING(if you want to link with dbmalloc for testing)
4188 AC_ARG_WITH(dbmalloc,
4189 [ --with-dbmalloc use Conor Cahill's dbmalloc library],
4190 [with_dbmalloc=$withval],
4192 AC_MSG_RESULT($with_dbmalloc)
4193 if test "$with_dbmalloc" = yes ; then
4194 AC_CHECK_HEADER(dbmalloc.h,
4195 [AC_CHECK_LIB(dbmalloc,[debug_malloc]ifelse($1,,[],[,$1]))])
4198 dnl ---------------------------------------------------------------------------
4199 dnl CF_WITH_DMALLOC version: 4 updated: 2004/02/28 05:49:27
4201 dnl Configure-option for dmalloc. The optional parameter is used to override
4202 dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests.
4203 AC_DEFUN([CF_WITH_DMALLOC],[
4204 AC_MSG_CHECKING(if you want to link with dmalloc for testing)
4205 AC_ARG_WITH(dmalloc,
4206 [ --with-dmalloc use Gray Watson's dmalloc library],
4207 [with_dmalloc=$withval],
4209 AC_MSG_RESULT($with_dmalloc)
4210 if test "$with_dmalloc" = yes ; then
4211 AC_CHECK_HEADER(dmalloc.h,
4212 [AC_CHECK_LIB(dmalloc,[dmalloc_debug]ifelse($1,,[],[,$1]))])
4215 dnl ---------------------------------------------------------------------------
4216 dnl CF_WITH_GPM version: 1 updated: 2005/06/25 15:47:45
4218 AC_DEFUN([CF_WITH_GPM],
4220 AC_MSG_CHECKING(if you want to link with the GPM mouse library)
4222 [ --with-gpm use Alessandro Rubini's GPM library],
4223 [with_gpm=$withval],
4225 AC_MSG_RESULT($with_gpm)
4226 if test "$with_gpm" != no ; then
4227 AC_CHECK_LIB(gpm,Gpm_Open,[
4228 AC_CHECK_HEADER(gpm.h,[
4229 AC_DEFINE(HAVE_GPM_H)
4232 if test "$with_gpm" = yes ; then
4233 AC_ERROR(Cannot find GPM header)
4237 if test "$with_gpm" = yes ; then
4238 AC_ERROR(Cannot link with GPM library)
4244 dnl ---------------------------------------------------------------------------
4245 dnl CF_WITH_LIBTOOL version: 9 updated: 2004/01/16 14:55:37
4247 dnl Provide a configure option to incorporate libtool. Define several useful
4248 dnl symbols for the makefile rules.
4250 dnl The reference to AC_PROG_LIBTOOL does not normally work, since it uses
4251 dnl macros from libtool.m4 which is in the aclocal directory of automake.
4252 dnl Following is a simple script which turns on the AC_PROG_LIBTOOL macro.
4253 dnl But that still does not work properly since the macro is expanded outside
4254 dnl the CF_WITH_LIBTOOL macro:
4257 dnl ACLOCAL=`aclocal --print-ac-dir`
4258 dnl if test -z "$ACLOCAL" ; then
4259 dnl echo cannot find aclocal directory
4261 dnl elif test ! -f $ACLOCAL/libtool.m4 ; then
4262 dnl echo cannot find libtool.m4 file
4266 dnl LOCAL=aclocal.m4
4267 dnl ORIG=aclocal.m4.orig
4269 dnl trap "mv $ORIG $LOCAL" 0 1 2 5 15
4273 dnl # sed the LIBTOOL= assignment to omit the current directory?
4274 dnl sed -e 's/^LIBTOOL=.*/LIBTOOL=${LIBTOOL-libtool}/' $ACLOCAL/libtool.m4 >>$LOCAL
4275 dnl cat $ORIG >>$LOCAL
4279 AC_DEFUN([CF_WITH_LIBTOOL],
4281 ifdef([AC_PROG_LIBTOOL],,[
4284 # common library maintenance symbols that are convenient for libtool scripts:
4285 LIB_CREATE='$(AR) -cr'
4286 LIB_OBJECT='$(OBJECTS)'
4290 # symbols used to prop libtool up to enable it to determine what it should be
4298 AC_MSG_CHECKING(if you want to build libraries with libtool)
4299 AC_ARG_WITH(libtool,
4300 [ --with-libtool generate libraries with libtool],
4301 [with_libtool=$withval],
4303 AC_MSG_RESULT($with_libtool)
4304 if test "$with_libtool" != "no"; then
4305 ifdef([AC_PROG_LIBTOOL],[
4306 # missing_content_AC_PROG_LIBTOOL{{
4308 # missing_content_AC_PROG_LIBTOOL}}
4310 if test "$with_libtool" != "yes" ; then
4311 CF_PATH_SYNTAX(with_libtool)
4312 LIBTOOL=$with_libtool
4314 AC_PATH_PROG(LIBTOOL,libtool)
4316 if test -z "$LIBTOOL" ; then
4317 AC_MSG_ERROR(Cannot find libtool)
4320 LIB_CREATE='$(LIBTOOL) --mode=link $(CC) -rpath $(DESTDIR)$(libdir) -version-info `cut -f1 $(srcdir)/VERSION` -o'
4321 LIB_OBJECT='$(OBJECTS:.o=.lo)'
4323 LIB_CLEAN='$(LIBTOOL) --mode=clean'
4324 LIB_COMPILE='$(LIBTOOL) --mode=compile'
4325 LIB_LINK='$(LIBTOOL) --mode=link'
4326 LIB_INSTALL='$(LIBTOOL) --mode=install'
4327 LIB_UNINSTALL='$(LIBTOOL) --mode=uninstall'
4330 # Show the version of libtool
4331 AC_MSG_CHECKING(version of libtool)
4333 # Save the version in a cache variable - this is not entirely a good
4334 # thing, but the version string from libtool is very ugly, and for
4335 # bug reports it might be useful to have the original string.
4336 cf_cv_libtool_version=`$LIBTOOL --version 2>&1 | sed -e '2,$d' -e 's/([[^)]]*)//g' -e 's/^[[^1-9]]*//' -e 's/[[^0-9.]].*//'`
4337 AC_MSG_RESULT($cf_cv_libtool_version)
4338 if test -z "$cf_cv_libtool_version" ; then
4339 AC_MSG_ERROR(This is not libtool)
4342 # special hack to add --tag option for C++ compiler
4343 case $cf_cv_libtool_version in
4344 1.[[5-9]]*|[[2-9]]*)
4345 LIBTOOL_CXX="$LIBTOOL --tag=CXX"
4348 LIBTOOL_CXX="$LIBTOOL"
4356 test -z "$LIBTOOL" && ECHO_LT=
4359 AC_SUBST(LIBTOOL_CXX)
4361 AC_SUBST(LIB_CREATE)
4362 AC_SUBST(LIB_OBJECT)
4363 AC_SUBST(LIB_SUFFIX)
4367 AC_SUBST(LIB_COMPILE)
4369 AC_SUBST(LIB_INSTALL)
4370 AC_SUBST(LIB_UNINSTALL)
4373 dnl ---------------------------------------------------------------------------
4374 dnl CF_WITH_PATH version: 6 updated: 1998/10/11 00:40:17
4376 dnl Wrapper for AC_ARG_WITH to ensure that user supplies a pathname, not just
4377 dnl defaulting to yes/no.
4379 dnl $1 = option name
4381 dnl $3 = environment variable to set
4382 dnl $4 = default value, shown in the help-message, must be a constant
4383 dnl $5 = default value, if it's an expression & cannot be in the help-message
4385 AC_DEFUN([CF_WITH_PATH],
4386 [AC_ARG_WITH($1,[$2 ](default: ifelse($4,,empty,$4)),,
4387 ifelse($4,,[withval="${$3}"],[withval="${$3-ifelse($5,,$4,$5)}"]))dnl
4388 CF_PATH_SYNTAX(withval)
4392 dnl ---------------------------------------------------------------------------
4393 dnl CF_WITH_PATHLIST version: 5 updated: 2001/12/10 01:28:30
4394 dnl ----------------
4395 dnl Process an option specifying a list of colon-separated paths.
4397 dnl $1 = option name
4399 dnl $3 = environment variable to set
4400 dnl $4 = default value, shown in the help-message, must be a constant
4401 dnl $5 = default value, if it's an expression & cannot be in the help-message
4402 dnl $6 = flag to tell if we want to define or substitute
4404 AC_DEFUN([CF_WITH_PATHLIST],[
4405 AC_REQUIRE([CF_PATHSEP])
4406 AC_ARG_WITH($1,[$2 ](default: ifelse($4,,empty,$4)),,
4407 ifelse($4,,[withval=${$3}],[withval=${$3-ifelse($5,,$4,$5)}]))dnl
4409 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${PATHSEP}"
4411 for cf_src_path in $withval
4413 CF_PATH_SYNTAX(cf_src_path)
4414 test -n "$cf_dst_path" && cf_dst_path="${cf_dst_path}:"
4415 cf_dst_path="${cf_dst_path}${cf_src_path}"
4420 # Strip single quotes from the value, e.g., when it was supplied as a literal
4422 case $cf_dst_path in #(vi
4424 cf_dst_path=`echo $cf_dst_path |sed -e s/\'// -e s/\'\$//`
4427 cf_dst_path=`echo "$cf_dst_path" | sed -e 's/\\\\/\\\\\\\\/g'`
4430 eval '$3="$cf_dst_path"'
4434 dnl ---------------------------------------------------------------------------
4435 dnl CF_WITH_REL_VERSION version: 1 updated: 2003/09/20 18:12:49
4436 dnl -------------------
4437 dnl Allow library's release-version to be overridden. Generally this happens when a
4438 dnl packager has incremented the release-version past that used in the original package,
4439 dnl and wishes to keep doing this.
4441 dnl $1 is the package name, if any, to derive corresponding {package}_MAJOR
4442 dnl and {package}_MINOR symbols
4444 AC_DEFUN([CF_WITH_REL_VERSION],[
4445 test -z "$cf_cv_rel_version" && cf_cv_rel_version=0.0
4446 AC_ARG_WITH(rel-version,
4447 [ --with-rel-version=XXX override derived release version],
4448 [AC_MSG_WARN(overriding release version $cf_cv_rel_version to $withval)
4449 cf_cv_rel_version=$withval])
4451 CF_NUMBER_SYNTAX($cf_cv_rel_version,Release version)
4453 $1_MAJOR=`echo "$cf_cv_rel_version" | sed -e 's/\..*//'`
4454 $1_MINOR=`echo "$cf_cv_rel_version" | sed -e 's/^[[^.]]*//' -e 's/^\.//' -e 's/\..*//'`
4455 CF_NUMBER_SYNTAX([$]$1_MAJOR,Release major-version)
4456 CF_NUMBER_SYNTAX([$]$1_MINOR,Release minor-version)
4459 dnl ---------------------------------------------------------------------------
4460 dnl CF_WITH_SYSMOUSE version: 2 updated: 2003/03/22 19:13:43
4461 dnl ----------------
4462 dnl If we can compile with sysmouse, make it available unless it is not wanted.
4463 AC_DEFUN([CF_WITH_SYSMOUSE],[
4464 # not everyone has "test -c"
4465 if test -c /dev/sysmouse 2>/dev/null ; then
4466 AC_MSG_CHECKING(if you want to use sysmouse)
4467 AC_ARG_WITH(sysmouse,
4468 [ --with-sysmouse use sysmouse (FreeBSD console)],
4469 [cf_with_sysmouse=$withval],
4470 [cf_with_sysmouse=maybe])
4471 if test "$cf_with_sysmouse" != no ; then
4473 #include <osreldate.h>
4474 #if (__FreeBSD_version >= 400017)
4475 #include <sys/consio.h>
4476 #include <sys/fbio.h>
4478 #include <machine/console.h>
4481 struct mouse_info the_mouse;
4482 ioctl(0, CONS_MOUSECTL, &the_mouse);
4483 ],[cf_with_sysmouse=yes],[cf_with_sysmouse=no])
4485 AC_MSG_RESULT($cf_with_sysmouse)
4486 test "$cf_with_sysmouse" = yes && AC_DEFINE(USE_SYSMOUSE)
4489 dnl ---------------------------------------------------------------------------
4490 dnl CF_XOPEN_SOURCE version: 22 updated: 2005/08/06 18:06:32
4492 dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions,
4493 dnl or adapt to the vendor's definitions to get equivalent functionality.
4496 dnl $1 is the nominal value for _XOPEN_SOURCE
4497 dnl $2 is the nominal value for _POSIX_C_SOURCE
4498 AC_DEFUN([CF_XOPEN_SOURCE],[
4500 AC_REQUIRE([CF_PROG_CC_U_D])
4502 cf_XOPEN_SOURCE=ifelse($1,,500,$1)
4503 cf_POSIX_C_SOURCE=ifelse($2,,199506L,$2)
4505 case $host_os in #(vi
4507 CPPFLAGS="$CPPFLAGS -D_ALL_SOURCE"
4510 # setting _XOPEN_SOURCE breaks things on Darwin
4513 # 5.x headers associate
4514 # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L
4515 # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L
4516 cf_POSIX_C_SOURCE=200112L
4518 CPPFLAGS="$CPPFLAGS -D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
4521 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE"
4524 CPPFLAGS="$CPPFLAGS -D_SGI_SOURCE"
4530 # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <arpa/inet.h>
4533 # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw
4536 # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw
4539 CPPFLAGS="$CPPFLAGS -D_OSF_SOURCE"
4542 CPPFLAGS="$CPPFLAGS -D_QNX_SOURCE"
4545 # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer
4548 CPPFLAGS="$CPPFLAGS -D__EXTENSIONS__"
4551 AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[
4552 AC_TRY_COMPILE([#include <sys/types.h>],[
4553 #ifndef _XOPEN_SOURCE
4556 [cf_cv_xopen_source=no],
4557 [cf_save="$CPPFLAGS"
4558 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
4559 AC_TRY_COMPILE([#include <sys/types.h>],[
4560 #ifdef _XOPEN_SOURCE
4563 [cf_cv_xopen_source=no],
4564 [cf_cv_xopen_source=$cf_XOPEN_SOURCE])
4568 if test "$cf_cv_xopen_source" != no ; then
4569 CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE)
4570 CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE)
4571 test "$cf_cv_cc_u_d_options" = yes && \
4572 CPPFLAGS="$CPPFLAGS -U_XOPEN_SOURCE"
4573 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_cv_xopen_source"
4575 CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE)