1 dnl***************************************************************************
2 dnl Copyright (c) 1998-2000 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 1996,1997,1998,1999,2000
31 dnl $Id: aclocal.m4,v 1.238 2000/10/20 22:57:49 tom Exp $
32 dnl Macros used in NCURSES auto-configuration script.
34 dnl See http://dickey.his.com/autoconf/ for additional information.
36 dnl ---------------------------------------------------------------------------
37 dnl ---------------------------------------------------------------------------
38 dnl Construct the list of include-options for the C programs in the Ada95
40 AC_DEFUN([CF_ADA_INCLUDE_DIRS],
42 ACPPFLAGS="$ACPPFLAGS -I. -I../../include"
43 if test "$srcdir" != "."; then
44 ACPPFLAGS="$ACPPFLAGS -I\$(srcdir)/../../include"
46 if test "$GCC" != yes; then
47 ACPPFLAGS="$ACPPFLAGS -I\$(includedir)"
48 elif test "$includedir" != "/usr/include"; then
49 if test "$includedir" = '${prefix}/include' ; then
50 if test $prefix != /usr ; then
51 ACPPFLAGS="$ACPPFLAGS -I\$(includedir)"
54 ACPPFLAGS="$ACPPFLAGS -I\$(includedir)"
59 dnl ---------------------------------------------------------------------------
60 dnl This is adapted from the macros 'fp_PROG_CC_STDC' and 'fp_C_PROTOTYPES'
61 dnl in the sharutils 4.2 distribution.
62 AC_DEFUN([CF_ANSI_CC_CHECK],
64 AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
65 AC_CACHE_VAL(cf_cv_ansi_cc,[
67 cf_save_CFLAGS="$CFLAGS"
68 # Don't try gcc -ansi; that turns off useful extensions and
69 # breaks some systems' header files.
71 # Ultrix and OSF/1 -std1
72 # HP-UX -Aa -D_HPUX_SOURCE
74 # UnixWare 1.2 (cannot use -Xc, since ANSI/POSIX clashes)
75 for cf_arg in "-DCC_HAS_PROTOS" \
80 "-Aa -D_HPUX_SOURCE" \
83 CFLAGS="$cf_save_CFLAGS $cf_arg"
87 #if !defined(__STDC__) || (__STDC__ != 1)
92 int test (int i, double x);
93 struct s1 {int (*f) (int a);};
94 struct s2 {int (*f) (double a);};],
95 [cf_cv_ansi_cc="$cf_arg"; break])
97 CFLAGS="$cf_save_CFLAGS"
99 AC_MSG_RESULT($cf_cv_ansi_cc)
101 if test "$cf_cv_ansi_cc" != "no"; then
102 if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then
103 CFLAGS="$CFLAGS $cf_cv_ansi_cc"
105 AC_DEFINE(CC_HAS_PROTOS)
109 dnl ---------------------------------------------------------------------------
110 dnl For programs that must use an ANSI compiler, obtain compiler options that
111 dnl will make it recognize prototypes. We'll do preprocessor checks in other
112 dnl macros, since tools such as unproto can fake prototypes, but only part of
113 dnl the preprocessor.
114 AC_DEFUN([CF_ANSI_CC_REQD],
115 [AC_REQUIRE([CF_ANSI_CC_CHECK])
116 if test "$cf_cv_ansi_cc" = "no"; then
118 [Your compiler does not appear to recognize prototypes.
119 You have the following choices:
120 a. adjust your compiler options
121 b. get an up-to-date compiler
122 c. use a wrapper such as unproto])
125 dnl ---------------------------------------------------------------------------
126 dnl Test if 'bool' is a builtin type in the configured C++ compiler. Some
127 dnl older compilers (e.g., gcc 2.5.8) don't support 'bool' directly; gcc
128 dnl 2.6.3 does, in anticipation of the ANSI C++ standard.
130 dnl Treat the configuration-variable specially here, since we're directly
131 dnl substituting its value (i.e., 1/0).
132 AC_DEFUN([CF_BOOL_DECL],
134 AC_MSG_CHECKING([for builtin bool type])
135 AC_CACHE_VAL(ifelse($1,,cf_cv_builtin_bool,[$1]),[
138 #include <sys/types.h>
140 [ifelse($1,,cf_cv_builtin_bool,[$1])=1],
141 [ifelse($1,,cf_cv_builtin_bool,[$1])=0])
143 if test "$ifelse($1,,cf_cv_builtin_bool,[$1])" = 1
144 then AC_MSG_RESULT(yes)
145 else AC_MSG_RESULT(no)
148 dnl ---------------------------------------------------------------------------
149 dnl Test for the size of 'bool' in the configured C++ compiler (e.g., a type).
150 dnl Don't bother looking for bool.h, since it's been deprecated.
151 AC_DEFUN([CF_BOOL_SIZE],
153 AC_MSG_CHECKING([for size of bool])
154 AC_CACHE_VAL(cf_cv_type_of_bool,[
159 #ifdef HAVE_GXX_BUILTIN_H
160 #include <g++/builtin.h>
161 #elif HAVE_GPP_BUILTIN_H
162 #include <gpp/builtin.h>
168 FILE *fp = fopen("cf_test.out", "w");
172 fputs("unsigned ", fp);
173 if (sizeof(x) == sizeof(int)) fputs("int", fp);
174 else if (sizeof(x) == sizeof(char)) fputs("char", fp);
175 else if (sizeof(x) == sizeof(short))fputs("short",fp);
176 else if (sizeof(x) == sizeof(long)) fputs("long", fp);
182 [cf_cv_type_of_bool=`cat cf_test.out`],
183 [cf_cv_type_of_bool=unknown],
184 [cf_cv_type_of_bool=unknown])
187 AC_MSG_RESULT($cf_cv_type_of_bool)
188 if test "$cf_cv_type_of_bool" = unknown ; then
189 AC_MSG_WARN(Assuming unsigned for type of bool)
190 cf_cv_type_of_bool=unsigned
193 dnl ---------------------------------------------------------------------------
194 dnl Determine the default configuration into which we'll install ncurses. This
195 dnl can be overridden by the user's command-line options. There's two items to
197 dnl 1. the prefix (e.g., /usr)
198 dnl 2. the header files (e.g., /usr/include/ncurses)
199 dnl We'll look for a previous installation of ncurses and use the same defaults.
201 dnl We don't use AC_PREFIX_DEFAULT, because it gets evaluated too soon, and
202 dnl we don't use AC_PREFIX_PROGRAM, because we cannot distinguish ncurses's
203 dnl programs from a vendor's.
204 AC_DEFUN([CF_CFG_DEFAULTS],
206 AC_MSG_CHECKING(for prefix)
207 if test "x$prefix" = "xNONE" ; then
208 case "$cf_cv_system_name" in
209 # non-vendor systems don't have a conflict
210 openbsd*|netbsd*|freebsd*|linux*)
213 *) prefix=$ac_default_prefix
217 AC_MSG_RESULT($prefix)
219 if test "x$prefix" = "xNONE" ; then
220 AC_MSG_CHECKING(for default include-directory)
221 test -n "$verbose" && echo 1>&AC_FD_MSG
224 $includedir/ncurses \
226 $prefix/include/ncurses \
228 /usr/local/include/ncurses \
232 cf_dir=`eval echo $cf_symbol`
233 if test -f $cf_dir/curses.h ; then
234 if ( fgrep NCURSES_VERSION $cf_dir/curses.h 2>&1 >/dev/null ) ; then
235 includedir="$cf_symbol"
236 test -n "$verbose" && echo $ac_n " found " 1>&AC_FD_MSG
240 test -n "$verbose" && echo " tested $cf_dir" 1>&AC_FD_MSG
242 AC_MSG_RESULT($includedir)
245 dnl ---------------------------------------------------------------------------
246 dnl Check if the terminal-capability database functions are available. If not,
247 dnl ncurses has a much-reduced version.
248 AC_DEFUN([CF_CGETENT],[
249 AC_MSG_CHECKING(for terminal-capability database functions)
250 AC_CACHE_VAL(cf_cv_cgetent,[
252 #include <stdlib.h>],[
255 char *db_array = temp;
256 cgetent(&buf, /* int *, */ &db_array, "vt100");
257 cgetcap(buf, "tc", '=');
258 cgetmatch(buf, "tc");
263 AC_MSG_RESULT($cf_cv_cgetent)
264 test "$cf_cv_cgetent" = yes && AC_DEFINE(HAVE_BSD_CGETENT)
266 dnl ---------------------------------------------------------------------------
267 dnl Check if we're accidentally using a cache from a different machine.
268 dnl Derive the system name, as a check for reusing the autoconf cache.
270 dnl If we've packaged config.guess and config.sub, run that (since it does a
271 dnl better job than uname). Normally we'll use AC_CANONICAL_HOST, but allow
272 dnl an extra parameter that we may override, e.g., for AC_CANONICAL_SYSTEM
273 dnl which is useful in cross-compiles.
274 AC_DEFUN([CF_CHECK_CACHE],
276 if test -f $srcdir/config.guess ; then
277 ifelse([$1],,[AC_CANONICAL_HOST],[$1])
278 system_name="$host_os"
280 system_name="`(uname -s -r) 2>/dev/null`"
281 if test -z "$system_name" ; then
282 system_name="`(hostname) 2>/dev/null`"
285 test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name")
286 AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"])
288 test -z "$system_name" && system_name="$cf_cv_system_name"
289 test -n "$cf_cv_system_name" && AC_MSG_RESULT("Configuring for $cf_cv_system_name")
291 if test ".$system_name" != ".$cf_cv_system_name" ; then
292 AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name))
293 AC_ERROR("Please remove config.cache and try again.")
296 dnl ---------------------------------------------------------------------------
297 dnl Check for data that is usually declared in <stdio.h> or <errno.h>, e.g.,
298 dnl the 'errno' variable. Define a DECL_xxx symbol if we must declare it
301 dnl (I would use AC_CACHE_CHECK here, but it will not work when called in a
302 dnl loop from CF_SYS_ERRLIST).
304 dnl $1 = the name to check
305 AC_DEFUN([CF_CHECK_ERRNO],
307 AC_MSG_CHECKING(if external $1 is declared)
308 AC_CACHE_VAL(cf_cv_dcl_$1,[
314 #include <sys/types.h>
315 #include <errno.h> ],
316 [long x = (long) $1],
317 [eval 'cf_cv_dcl_'$1'=yes'],
318 [eval 'cf_cv_dcl_'$1'=no'])
321 eval 'cf_result=$cf_cv_dcl_'$1
322 AC_MSG_RESULT($cf_result)
324 if test "$cf_result" = no ; then
325 eval 'cf_result=DECL_'$1
326 CF_UPPER(cf_result,$cf_result)
327 AC_DEFINE_UNQUOTED($cf_result)
330 # It's possible (for near-UNIX clones) that the data doesn't exist
331 CF_CHECK_EXTERN_DATA($1,int)
333 dnl ---------------------------------------------------------------------------
334 dnl Check for existence of external data in the current set of libraries. If
335 dnl we can modify it, it's real enough.
336 dnl $1 = the name to check
338 AC_DEFUN([CF_CHECK_EXTERN_DATA],
340 AC_MSG_CHECKING(if external $1 exists)
341 AC_CACHE_VAL(cf_cv_have_$1,[
347 [eval 'cf_cv_have_'$1'=yes'],
348 [eval 'cf_cv_have_'$1'=no'])])
350 eval 'cf_result=$cf_cv_have_'$1
351 AC_MSG_RESULT($cf_result)
353 if test "$cf_result" = yes ; then
354 eval 'cf_result=HAVE_'$1
355 CF_UPPER(cf_result,$cf_result)
356 AC_DEFINE_UNQUOTED($cf_result)
360 dnl ---------------------------------------------------------------------------
361 dnl Check if the C++ compiler accepts duplicate parameter initialization. This
362 dnl is a late feature for the standard and is not in some recent compilers
364 AC_DEFUN([CF_CPP_PARAM_INIT],
366 if test "$CXX" = yes ; then
367 AC_CACHE_CHECK(if $CXX accepts parameter initialization,cf_cv_cpp_param_init,[
378 TEST::TEST(int x = 1) // some compilers do not like second initializer
384 [cf_cv_cpp_param_init=yes],
385 [cf_cv_cpp_param_init=no],
386 [cf_cv_cpp_param_init=unknown])
389 test "$cf_cv_cpp_param_init" = yes && AC_DEFINE(CPP_HAS_PARAM_INIT)
391 dnl ---------------------------------------------------------------------------
392 AC_DEFUN([CF_DIRS_TO_MAKE],
395 for cf_item in $cf_list_models
397 CF_OBJ_SUBDIR($cf_item,cf_subdir)
398 DIRS_TO_MAKE="$DIRS_TO_MAKE $cf_subdir"
400 for cf_dir in $DIRS_TO_MAKE
402 test ! -d $cf_dir && mkdir $cf_dir
404 AC_SUBST(DIRS_TO_MAKE)
406 dnl ---------------------------------------------------------------------------
407 dnl Check if 'errno' is declared in <errno.h>
410 CF_CHECK_ERRNO(errno)
412 dnl ---------------------------------------------------------------------------
413 dnl Test for conflicting definitions of exception in gcc 2.8.0, etc., between
414 dnl math.h and builtin.h, only for ncurses
415 AC_DEFUN([CF_ETIP_DEFINES],
417 AC_MSG_CHECKING(for special defines needed for etip.h)
418 cf_save_CXXFLAGS="$CXXFLAGS"
420 for cf_math in "" MATH_H
422 for cf_excp in "" MATH_EXCEPTION
424 CXXFLAGS="$cf_save_CXXFLAGS -I${srcdir}/c++ -I${srcdir}/menu"
425 test -n "$cf_math" && CXXFLAGS="$CXXFLAGS -DETIP_NEEDS_${cf_math}"
426 test -n "$cf_excp" && CXXFLAGS="$CXXFLAGS -DETIP_NEEDS_${cf_excp}"
430 test -n "$cf_math" && AC_DEFINE_UNQUOTED(ETIP_NEEDS_${cf_math})
431 test -n "$cf_excp" && AC_DEFINE_UNQUOTED(ETIP_NEEDS_${cf_excp})
432 cf_result="$cf_math $cf_excp"
437 AC_MSG_RESULT($cf_result)
438 CXXFLAGS="$cf_save_CXXFLAGS"
440 dnl ---------------------------------------------------------------------------
441 dnl Check for memmove, or a bcopy that can handle overlapping copy. If neither
442 dnl is found, add our own version of memmove to the list of objects.
443 AC_DEFUN([CF_FUNC_MEMMOVE],
445 AC_CHECK_FUNC(memmove,,[
446 AC_CHECK_FUNC(bcopy,[
447 AC_CACHE_CHECK(if bcopy does overlapping moves,cf_cv_good_bcopy,[
450 static char data[] = "abcdefghijklmnopqrstuwwxyz";
452 bcopy(data, temp, sizeof(data));
453 bcopy(temp+10, temp, 15);
454 bcopy(temp+5, temp+15, 10);
455 exit (strcmp(temp, "klmnopqrstuwwxypqrstuwwxyz"));
458 [cf_cv_good_bcopy=yes],
459 [cf_cv_good_bcopy=no],
460 [cf_cv_good_bcopy=unknown])
462 ],[cf_cv_good_bcopy=no])
463 if test "$cf_cv_good_bcopy" = yes ; then
464 AC_DEFINE(USE_OK_BCOPY)
466 AC_DEFINE(USE_MY_MEMMOVE)
469 dnl ---------------------------------------------------------------------------
470 dnl See if the poll function really works. Some platforms have poll(), but
471 dnl it does not work for terminals or files.
472 AC_DEFUN([CF_FUNC_POLL],[
473 AC_CACHE_CHECK(if poll really works,cf_cv_working_poll,[
479 #include <sys/poll.h>
486 myfds.events = POLLIN;
488 ret = poll(&myfds, 1, 100);
491 [cf_cv_working_poll=yes],
492 [cf_cv_working_poll=no],
493 [cf_cv_working_poll=unknown])])
494 test "$cf_cv_working_poll" = "yes" && AC_DEFINE(HAVE_WORKING_POLL)
496 dnl ---------------------------------------------------------------------------
497 dnl Some old/broken variations define tcgetattr() only as a macro in
499 AC_DEFUN([CF_FUNC_TERMIOS],[
500 AC_REQUIRE([CF_STRUCT_TERMIOS])
501 AC_CACHE_CHECK(for tcgetattr, cf_cv_have_tcgetattr,[
503 #include <sys/types.h>
507 #ifdef HAVE_TERMIOS_H
509 #define TTY struct termios
513 #define TTY struct termio
518 tcgetattr(1, &foo);],
519 [cf_cv_have_tcgetattr=yes],
520 [cf_cv_have_tcgetattr=no])])
521 test "$cf_cv_have_tcgetattr" = yes && AC_DEFINE(HAVE_TCGETATTR)
523 dnl ---------------------------------------------------------------------------
524 dnl Test for availability of useful gcc __attribute__ directives to quiet
525 dnl compiler warnings. Though useful, not all are supported -- and contrary
526 dnl to documentation, unrecognized directives cause older compilers to barf.
527 AC_DEFUN([CF_GCC_ATTRIBUTES],
531 cat > conftest.i <<EOF
539 #define GCC_NORETURN /* nothing */
542 #define GCC_UNUSED /* nothing */
547 AC_CHECKING([for $CC __attribute__ directives])
549 cat > conftest.$ac_ext <<EOF
550 #line __oline__ "configure"
551 #include "confdefs.h"
552 #include "conftest.h"
553 #include "conftest.i"
555 #define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
557 #define GCC_PRINTFLIKE(fmt,var) /*nothing*/
560 #define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var)))
562 #define GCC_SCANFLIKE(fmt,var) /*nothing*/
564 extern void wow(char *,...) GCC_SCANFLIKE(1,2);
565 extern void oops(char *,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN;
566 extern void foo(void) GCC_NORETURN;
567 int main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED) { return 0; }
570 for cf_attribute in scanf printf unused noreturn
572 CF_UPPER(CF_ATTRIBUTE,$cf_attribute)
573 cf_directive="__attribute__(($cf_attribute))"
574 echo "checking for $CC $cf_directive" 1>&AC_FD_CC
575 case $cf_attribute in
577 cat >conftest.h <<EOF
578 #define GCC_$CF_ATTRIBUTE 1
582 cat >conftest.h <<EOF
583 #define GCC_$CF_ATTRIBUTE $cf_directive
587 if AC_TRY_EVAL(ac_compile); then
588 test -n "$verbose" && AC_MSG_RESULT(... $cf_attribute)
589 cat conftest.h >>confdefs.h
591 # sed -e 's/__attr.*/\/*nothing*\//' conftest.h >>confdefs.h
595 fgrep define conftest.i >>confdefs.h
600 dnl ---------------------------------------------------------------------------
601 dnl Check if the compiler supports useful warning options. There's a few that
602 dnl we don't use, simply because they're too noisy:
604 dnl -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x)
605 dnl -Wredundant-decls (system headers make this too noisy)
606 dnl -Wtraditional (combines too many unrelated messages, only a few useful)
607 dnl -Wwrite-strings (too noisy, but should review occasionally)
610 AC_DEFUN([CF_GCC_WARNINGS],
615 cat > conftest.$ac_ext <<EOF
616 #line __oline__ "configure"
617 int main(int argc, char *argv[]) { return (argv[argc-1] == 0) ; }
620 AC_CHECKING([for $CC warning options])
621 cf_save_CFLAGS="$CFLAGS"
622 EXTRA_CFLAGS="-W -Wall"
624 test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings"
630 Wmissing-declarations \
631 Wmissing-prototypes \
635 Wstrict-prototypes $cf_warn_CONST
637 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
638 if AC_TRY_EVAL(ac_compile); then
639 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
640 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
641 test "$cf_opt" = Wcast-qual && EXTRA_CFLAGS="$EXTRA_CFLAGS -DXTSTRINGDEFINES"
645 CFLAGS="$cf_save_CFLAGS"
647 AC_SUBST(EXTRA_CFLAGS)
649 dnl ---------------------------------------------------------------------------
650 dnl Verify that a test program compiles and runs with GNAT
651 dnl $cf_ada_make is set to the program that compiles/links
652 AC_DEFUN([CF_GNAT_TRY_RUN],
655 cat >>conftest.ads <<CF_EOF
658 cat >>conftest.adb <<CF_EOF
661 if ( $cf_ada_make conftest 1>&AC_FD_CC 2>&1 ) ; then
662 if ( ./conftest 1>&AC_FD_CC 2>&1 ) ; then
672 dnl ---------------------------------------------------------------------------
673 dnl Verify Version of GNAT.
674 AC_DEFUN([CF_GNAT_VERSION],
676 changequote(<<, >>)dnl
677 cf_cv_gnat_version=`$cf_ada_make -v 2>&1 | grep '[0-9].[0-9][0-9]*' |\
678 sed -e 's/[^0-9 \.]//g' | $AWK '{print $<<1>>;}'`
679 case $cf_cv_gnat_version in
680 3.1[1-9]*|3.[2-9]*|[4-9].*)
681 cf_cv_prog_gnat_correct=yes
683 *) echo Unsupported GNAT version $cf_cv_gnat_version. Required is 3.11 or better. Disabling Ada95 binding.
684 cf_cv_prog_gnat_correct=no
687 case $cf_cv_gnat_version in
689 cf_compile_generics=generics
690 cf_generic_objects="\$(GENOBJS)"
692 *) cf_compile_generics=
698 dnl ---------------------------------------------------------------------------
699 dnl If we're trying to use g++, test if libg++ is installed (a rather common
700 dnl problem :-). If we have the compiler but no library, we'll be able to
701 dnl configure, but won't be able to build the c++ demo program.
702 AC_DEFUN([CF_GPP_LIBRARY],
704 cf_cxx_library=unknown
705 case $cf_cv_system_name in #(vi
713 if test "$ac_cv_prog_gxx" = yes; then
714 AC_MSG_CHECKING([for lib$cf_gpp_libname])
716 LIBS="$LIBS -l$cf_gpp_libname"
718 #include <$cf_gpp_libname/builtin.h>
720 [two_arg_error_handler_t foo2 = lib_error_handler],
722 CXXLIBS="$CXXLIBS -l$cf_gpp_libname"
723 if test "$cf_gpp_libname" = cpp ; then
724 AC_DEFINE(HAVE_GPP_BUILTIN_H)
726 AC_DEFINE(HAVE_GXX_BUILTIN_H)
731 [two_arg_error_handler_t foo2 = lib_error_handler],
733 CXXLIBS="$CXXLIBS -l$cf_gpp_libname"
734 AC_DEFINE(HAVE_BUILTIN_H)],
735 [cf_cxx_library=no])])
737 AC_MSG_RESULT($cf_cxx_library)
740 dnl ---------------------------------------------------------------------------
741 dnl Insert text into the help-message, for readability, from AC_ARG_WITH.
742 AC_DEFUN([CF_HELP_MESSAGE],
743 [AC_DIVERT_HELP([$1])dnl
745 dnl ---------------------------------------------------------------------------
746 dnl Construct the list of include-options according to whether we're building
747 dnl in the source directory or using '--srcdir=DIR' option. If we're building
748 dnl with gcc, don't append the includedir if it happens to be /usr/include,
749 dnl since that usually breaks gcc's shadow-includes.
750 AC_DEFUN([CF_INCLUDE_DIRS],
752 CPPFLAGS="$CPPFLAGS -I. -I../include"
753 if test "$srcdir" != "."; then
754 CPPFLAGS="$CPPFLAGS -I\$(srcdir)/../include"
756 if test "$GCC" != yes; then
757 CPPFLAGS="$CPPFLAGS -I\$(includedir)"
758 elif test "$includedir" != "/usr/include"; then
759 if test "$includedir" = '${prefix}/include' ; then
760 if test $prefix != /usr ; then
761 CPPFLAGS="$CPPFLAGS -I\$(includedir)"
764 CPPFLAGS="$CPPFLAGS -I\$(includedir)"
769 dnl ---------------------------------------------------------------------------
770 dnl Check if we have either a function or macro for 'isascii()'.
771 AC_DEFUN([CF_ISASCII],
773 AC_MSG_CHECKING(for isascii)
774 AC_CACHE_VAL(cf_cv_have_isascii,[
775 AC_TRY_LINK([#include <ctype.h>],[int x = isascii(' ')],
776 [cf_cv_have_isascii=yes],
777 [cf_cv_have_isascii=no])
779 AC_MSG_RESULT($cf_cv_have_isascii)
780 test "$cf_cv_have_isascii" = yes && AC_DEFINE(HAVE_ISASCII)
782 dnl ---------------------------------------------------------------------------
783 dnl Compute the library-prefix for the given host system
784 dnl $1 = variable to set
785 AC_DEFUN([CF_LIB_PREFIX],
787 case $cf_cv_system_name in
788 os2) LIB_PREFIX='' ;;
789 *) LIB_PREFIX='lib' ;;
791 ifelse($1,,,[$1=$LIB_PREFIX])
794 dnl ---------------------------------------------------------------------------
795 dnl Append definitions and rules for the given models to the subdirectory
796 dnl Makefiles, and the recursion rule for the top-level Makefile. If the
797 dnl subdirectory is a library-source directory, modify the LIBRARIES list in
798 dnl the corresponding makefile to list the models that we'll generate.
800 dnl For shared libraries, make a list of symbolic links to construct when
801 dnl generating each library. The convention used for Linux is the simplest
804 dnl lib<name>.so.<major> ->
805 dnl lib<name>.so.<maj>.<minor>
806 AC_DEFUN([CF_LIB_RULES],
808 CF_LIB_PREFIX(cf_prefix)
809 AC_REQUIRE([CF_SUBST_NCURSES_VERSION])
810 for cf_dir in $SRC_SUBDIRS
812 if test -f $srcdir/$cf_dir/modules; then
815 for cf_item in $CF_LIST_MODELS
817 CF_LIB_SUFFIX($cf_item,cf_suffix)
818 if test $cf_item = shared ; then
819 if test "$cf_cv_do_symlinks" = yes ; then
820 case "$cf_cv_shlib_version" in #(vi
821 rel) cf_suffix="$cf_suffix"'.$(REL_VERSION)' ;; #(vi
822 abi) cf_suffix="$cf_suffix"'.$(ABI_VERSION)' ;;
826 cf_libs_to_make="$cf_libs_to_make ../lib/${cf_prefix}${cf_dir}${cf_suffix}"
829 if test $cf_dir = ncurses ; then
830 case "$LIB_SUBSETS" in #(vi
834 cf_item=`echo $cf_libs_to_make |sed -e s/$LIB_NAME/$TINFO_NAME/g`
835 cf_libs_to_make="$cf_item $cf_libs_to_make"
840 sed -e "s@\@LIBS_TO_MAKE\@@$cf_libs_to_make@" \
841 $cf_dir/Makefile >$cf_dir/Makefile.out
842 mv $cf_dir/Makefile.out $cf_dir/Makefile
844 $AWK -f $srcdir/mk-0th.awk \
846 $srcdir/$cf_dir/modules >>$cf_dir/Makefile
848 for cf_item in $CF_LIST_MODELS
850 echo 'Appending rules for '$cf_item' model ('$cf_dir')'
851 CF_UPPER(CF_ITEM,$cf_item)
852 CF_LIB_SUFFIX($cf_item,cf_suffix)
853 CF_OBJ_SUBDIR($cf_item,cf_subdir)
855 # These dependencies really are for development, not
856 # builds, but they are useful in porting, too.
857 cf_depend="../include/ncurses_cfg.h"
858 if test "$srcdir" = "."; then
861 cf_reldir="\$(srcdir)"
864 if test -f $srcdir/$cf_dir/$cf_dir.priv.h; then
865 cf_depend="$cf_depend $cf_reldir/$cf_dir.priv.h"
866 elif test -f $srcdir/$cf_dir/curses.priv.h; then
867 cf_depend="$cf_depend $cf_reldir/curses.priv.h"
870 for cf_subset in $LIB_SUBSETS
872 $AWK -f $srcdir/mk-1st.awk \
874 traces=$LIB_TRACING \
880 ShlibVer=$cf_cv_shlib_version \
881 DoLinks=$cf_cv_do_symlinks \
882 rmSoLocs=$cf_cv_rm_so_locs \
883 ldconfig="$LDCONFIG" \
884 overwrite=$WITH_OVERWRITE \
885 depend="$cf_depend" \
887 $srcdir/$cf_dir/modules >>$cf_dir/Makefile
888 test $cf_dir = ncurses && WITH_OVERWRITE=no
889 $AWK -f $srcdir/mk-2nd.awk \
891 traces=$LIB_TRACING \
897 $srcdir/$cf_dir/modules >>$cf_dir/Makefile
902 echo ' cd '$cf_dir' && $(MAKE) $(CF_MFLAGS) [$]@' >>Makefile
905 for cf_dir in $SRC_SUBDIRS
907 if test -f $cf_dir/Makefile ; then
910 echo 'libs \' >> Makefile
911 echo 'install.libs \' >> Makefile
912 echo 'uninstall.libs ::' >> Makefile
913 echo ' cd '$cf_dir' && $(MAKE) $(CF_MFLAGS) [$]@' >> Makefile
918 if test -f $srcdir/$cf_dir/modules; then
920 if test -f $srcdir/$cf_dir/headers; then
921 cat >> Makefile <<CF_EOF
923 uninstall.includes \\
926 if test "$cf_dir" != "c++" ; then
927 echo 'lint \' >> Makefile
929 cat >> Makefile <<CF_EOF
936 cd $cf_dir && \$(MAKE) \$(CF_MFLAGS) \[$]@
938 elif test -f $srcdir/$cf_dir/headers; then
939 cat >> Makefile <<CF_EOF
945 uninstall.includes ::
946 cd $cf_dir && \$(MAKE) \$(CF_MFLAGS) \[$]@
951 cat >> Makefile <<CF_EOF
955 cd misc && \$(MAKE) \$(CF_MFLAGS) \[$]@
959 cd man && \$(MAKE) \$(CF_MFLAGS) \[$]@
962 rm -f config.cache config.log config.status Makefile include/ncurses_cfg.h
963 rm -f headers.sh headers.sed
964 rm -rf \$(DIRS_TO_MAKE)
967 # Special case: tack's manpage lives in its own directory.
968 if test -d tack ; then
969 if test -f $srcdir/$tack.h; then
970 cat >> Makefile <<CF_EOF
974 cd tack && \$(MAKE) \$(CF_MFLAGS) \[$]@
979 dnl If we're installing into a subdirectory of /usr/include, etc., we should
980 dnl prepend the subdirectory's name to the "#include" paths. It won't hurt
981 dnl anything, and will make it more standardized. It's awkward to decide this
982 dnl at configuration because of quoting, so we'll simply make all headers
983 dnl installed via a script that can do the right thing.
985 rm -f headers.sed headers.sh
987 dnl ( generating this script makes the makefiles a little tidier :-)
988 echo creating headers.sh
989 cat >headers.sh <<CF_EOF
991 # This shell script is generated by the 'configure' script. It is invoked in a
992 # subdirectory of the build tree. It generates a sed-script in the parent
993 # directory that is used to adjust includes for header files that reside in a
994 # subdirectory of /usr/include, etc.
996 while test \[$]# != 3
998 PRG="\$PRG \[$]1"; shift
1003 TMPSRC=\${TMPDIR-/tmp}/\`basename \$SRC\`\$\$
1004 TMPSED=\${TMPDIR-/tmp}/headers.sed\$\$
1005 echo installing \$SRC in \$DST
1007 if test $WITH_CURSES_H = yes; then
1008 cat >>headers.sh <<CF_EOF
1011 END=\`basename \$DST\`
1012 for i in \`cat \$REF/../*/headers |fgrep -v "#"\`
1014 NAME=\`basename \$i\`
1015 echo "s/<\$NAME>/<\$END\/\$NAME>/" >> \$TMPSED
1024 cat >>headers.sh <<CF_EOF
1027 END=\`basename \$DST\`
1028 for i in \`cat \$REF/../*/headers |fgrep -v "#"\`
1030 NAME=\`basename \$i\`
1031 if test "\$NAME" = "curses.h"
1033 echo "s/<curses.h>/<ncurses.h>/" >> \$TMPSED
1036 echo "s/<\$NAME>/<\$END\/\$NAME>/" >> \$TMPSED
1040 echo "s/<curses.h>/<ncurses.h>/" >> \$TMPSED
1045 cat >>headers.sh <<CF_EOF
1047 sed -f \$TMPSED \$SRC > \$TMPSRC
1048 NAME=\`basename \$SRC\`
1050 if test $WITH_CURSES_H != yes; then
1051 cat >>headers.sh <<CF_EOF
1052 test "\$NAME" = "curses.h" && NAME=ncurses.h
1055 cat >>headers.sh <<CF_EOF
1056 eval \$PRG \$TMPSRC \$DST/\$NAME
1057 rm -f \$TMPSRC \$TMPSED
1060 chmod 0755 headers.sh
1062 for cf_dir in $SRC_SUBDIRS
1064 if test -f $srcdir/$cf_dir/headers; then
1065 cat >>$cf_dir/Makefile <<CF_EOF
1066 \$(DESTDIR)\$(includedir) :
1067 \$(srcdir)/../mkinstalldirs \[$]@
1071 install.includes :: \$(AUTO_SRC) \$(DESTDIR)\$(includedir) \\
1074 for i in `cat $srcdir/$cf_dir/headers |fgrep -v "#"`
1076 test -n "$j" && echo " $j \\" >>$cf_dir/Makefile
1079 echo " $j" >>$cf_dir/Makefile
1080 for i in `cat $srcdir/$cf_dir/headers |fgrep -v "#"`
1082 echo " @ (cd \$(DESTDIR)\$(includedir) && rm -f `basename $i`) ; ../headers.sh \$(INSTALL_DATA) \$(DESTDIR)\$(includedir) \$(srcdir) $i" >>$cf_dir/Makefile
1083 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
1086 cat >>$cf_dir/Makefile <<CF_EOF
1090 uninstall.includes ::
1092 for i in `cat $srcdir/$cf_dir/headers |fgrep -v "#"`
1095 echo " -@ (cd \$(DESTDIR)\$(includedir) && rm -f $i)" >>$cf_dir/Makefile
1096 test $i = curses.h && echo " -@ (cd \$(DESTDIR)\$(includedir) && rm -f ncurses.h)" >>$cf_dir/Makefile
1102 dnl ---------------------------------------------------------------------------
1103 dnl Compute the library file-suffix from the given model name
1105 dnl $2 = variable to set
1106 dnl The variable $LIB_SUFFIX, if set, prepends the variable to set.
1107 AC_DEFUN([CF_LIB_SUFFIX],
1109 AC_REQUIRE([CF_SUBST_NCURSES_VERSION])
1111 libtool) $2='.la' ;;
1114 profile) $2='_p.a' ;;
1116 case $cf_cv_system_name in
1121 test -n "$LIB_SUFFIX" && $2="${LIB_SUFFIX}[$]{$2}"
1123 dnl ---------------------------------------------------------------------------
1124 dnl Compute the string to append to -library from the given model name
1126 dnl $2 = variable to set
1127 dnl The variable $LIB_SUFFIX, if set, prepends the variable to set.
1128 AC_DEFUN([CF_LIB_TYPE],
1137 test -n "$LIB_SUFFIX" && $2="${LIB_SUFFIX}[$]{$2}"
1139 dnl ---------------------------------------------------------------------------
1140 dnl Some systems have a non-ANSI linker that doesn't pull in modules that have
1141 dnl only data (i.e., no functions), for example NeXT. On those systems we'll
1142 dnl have to provide wrappers for global tables to ensure they're linked
1144 AC_DEFUN([CF_LINK_DATAONLY],
1146 AC_MSG_CHECKING([if data-only library module links])
1147 AC_CACHE_VAL(cf_cv_link_dataonly,[
1150 cat >conftest.$ac_ext <<EOF
1151 #line __oline__ "configure"
1152 int testdata[3] = { 123, 456, 789 };
1155 if AC_TRY_EVAL(ac_compile) ; then
1156 mv conftest.o data.o && \
1157 ( $AR $AR_OPTS conftest.a data.o ) 2>&5 1>/dev/null
1159 rm -f conftest.$ac_ext data.o
1161 cat >conftest.$ac_ext <<EOF
1162 #line __oline__ "configure"
1166 exit(1); /* I'm told this linker is broken */
1168 extern int testdata[3];
1169 return testdata[0] == 123
1170 && testdata[1] == 456
1171 && testdata[2] == 789;
1176 if AC_TRY_EVAL(ac_compile); then
1177 mv conftest.o func.o && \
1178 ( $AR $AR_OPTS conftest.a func.o ) 2>&5 1>/dev/null
1180 rm -f conftest.$ac_ext func.o
1181 ( eval $ac_cv_prog_RANLIB conftest.a ) 2>&5 >/dev/null
1183 LIBS="conftest.a $LIBS"
1187 extern int testfunc();
1191 [cf_cv_link_dataonly=yes],
1192 [cf_cv_link_dataonly=no],
1193 [cf_cv_link_dataonly=unknown])
1196 AC_MSG_RESULT($cf_cv_link_dataonly)
1197 test "$cf_cv_link_dataonly" = no && AC_DEFINE(BROKEN_LINKER)
1199 dnl ---------------------------------------------------------------------------
1200 dnl Most Unix systems have both link and symlink, a few don't have symlink.
1201 dnl A few non-Unix systems implement symlink, but not link.
1202 dnl A few non-systems implement neither (or have nonfunctional versions).
1203 AC_DEFUN([CF_LINK_FUNCS],
1209 if test "$ac_cv_prog_cc_cross" = yes ; then
1214 AC_CACHE_CHECK(if link/symlink functions work,cf_cv_link_funcs,[
1216 for cf_func in link symlink ; do
1218 #include <sys/types.h>
1219 #include <sys/stat.h>
1220 #ifdef HAVE_UNISTD_H
1226 char *src = "config.log";
1227 char *dst = "conftest.chk";
1232 fail = ($cf_func("config.log", "conftest.chk") < 0)
1233 || (stat(dst, &dst_sb) < 0)
1234 || (dst_sb.st_mtime != src_sb.st_mtime);
1243 cf_cv_link_funcs="$cf_cv_link_funcs $cf_func"
1244 eval 'ac_cv_func_'$cf_func'=yes'],[
1245 eval 'ac_cv_func_'$cf_func'=no'],[
1246 eval 'ac_cv_func_'$cf_func'=error'])
1248 test -z "$cf_cv_link_funcs" && cf_cv_link_funcs=no
1250 test "$ac_cv_func_link" = yes && AC_DEFINE(HAVE_LINK)
1251 test "$ac_cv_func_symlink" = yes && AC_DEFINE(HAVE_SYMLINK)
1254 dnl ---------------------------------------------------------------------------
1255 dnl Some 'make' programs support $(MAKEFLAGS), some $(MFLAGS), to pass 'make'
1256 dnl options to lower-levels. It's very useful for "make -n" -- if we have it.
1257 dnl (GNU 'make' does both, something POSIX 'make', which happens to make the
1258 dnl $(MAKEFLAGS) variable incompatible because it adds the assignments :-)
1259 AC_DEFUN([CF_MAKEFLAGS],
1261 AC_MSG_CHECKING([for makeflags variable])
1262 AC_CACHE_VAL(cf_cv_makeflags,[
1264 for cf_option in '-$(MAKEFLAGS)' '$(MFLAGS)'
1266 cat >cf_makeflags.tmp <<CF_EOF
1268 @ echo '.$cf_option'
1270 cf_result=`${MAKE-make} -k -f cf_makeflags.tmp 2>/dev/null`
1271 case "$cf_result" in
1273 cf_result=`${MAKE-make} -k -f cf_makeflags.tmp CC=cc 2>/dev/null`
1274 case "$cf_result" in
1275 .*CC=*) cf_cv_makeflags=
1277 *) cf_cv_makeflags=$cf_option
1282 *) echo no match "$cf_result"
1286 rm -f cf_makeflags.tmp])
1287 AC_MSG_RESULT($cf_cv_makeflags)
1288 AC_SUBST(cf_cv_makeflags)
1290 dnl ---------------------------------------------------------------------------
1291 dnl Generate tags/TAGS targets for makefiles. Do not generate TAGS if we have
1292 dnl a monocase filesystem.
1293 AC_DEFUN([CF_MAKE_TAGS],[
1294 AC_REQUIRE([CF_MIXEDCASE_FILENAMES])
1295 AC_CHECK_PROG(MAKE_LOWER_TAGS, ctags, yes, no)
1297 if test "$cf_cv_mixedcase" = yes ; then
1298 AC_CHECK_PROG(MAKE_UPPER_TAGS, etags, yes, no)
1303 if test "$MAKE_UPPER_TAGS" = yes ; then
1308 AC_SUBST(MAKE_UPPER_TAGS)
1310 if test "$MAKE_LOWER_TAGS" = yes ; then
1315 AC_SUBST(MAKE_LOWER_TAGS)
1317 dnl ---------------------------------------------------------------------------
1318 dnl Option to allow user to override automatic configuration of manpage format.
1319 dnl There are several special cases.
1320 AC_DEFUN([CF_MANPAGE_FORMAT],
1321 [ AC_MSG_CHECKING(format of man-pages)
1323 AC_ARG_WITH(manpage-format,
1324 [ --with-manpage-format specify manpage-format: gzip/compress/BSDI/normal and
1325 optionally formatted, e.g., gzip,formatted],
1326 [cf_manpage_form=$withval],
1327 [cf_manpage_form=unknown])
1329 case ".$cf_manpage_form" in
1330 .gzip|.compress|.BSDI|.normal|.formatted) # (vi
1333 if test -z "$MANPATH" ; then
1334 MANPATH="/usr/man:/usr/share/man"
1336 # look for the 'date' man-page (it's most likely to be installed!)
1337 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
1338 cf_manpage_form=unknown
1339 for cf_dir in $MANPATH; do
1340 test -z "$cf_dir" && cf_dir=/usr/man
1341 changequote({{,}})dnl
1342 for cf_name in $cf_dir/*/date.[01]* $cf_dir/*/date
1345 cf_test=`echo $cf_name | sed -e 's/*//'`
1346 if test "x$cf_test" = "x$cf_name" ; then
1348 *.gz) cf_manpage_form=gzip;;
1349 *.Z) cf_manpage_form=compress;;
1350 *.0) cf_manpage_form=BSDI,formatted;;
1351 *) cf_manpage_form=normal;;
1356 if test "$cf_manpage_form" != "unknown" ; then
1363 AC_MSG_WARN(Unexpected manpage-format)
1367 AC_MSG_RESULT($cf_manpage_form)
1369 dnl ---------------------------------------------------------------------------
1370 dnl The Debian people have their own naming convention for manpages. This
1371 dnl option lets us override the name of the file containing renaming, or
1372 dnl disable it altogether.
1373 AC_DEFUN([CF_MANPAGE_RENAMES],
1375 AC_MSG_CHECKING(for manpage renaming)
1377 AC_ARG_WITH(manpage-renames,
1378 [ --with-manpage-renames specify manpage-renaming],
1379 [cf_manpage_renames=$withval],
1380 [cf_manpage_renames=yes])
1382 case ".$cf_manpage_renames" in #(vi
1386 # Debian 'man' program?
1387 if test -f /etc/debian_version ; then
1388 cf_manpage_renames=`cd $srcdir && pwd`/man/man_db.renames
1390 cf_manpage_renames=no
1395 if test "$cf_manpage_renames" != no ; then
1396 if test ! -f $cf_manpage_renames ; then
1397 AC_MSG_ERROR(not a filename: $cf_manpage_renames)
1400 test ! -d man && mkdir man
1402 # Construct a sed-script to perform renaming within man-pages
1403 if test -n "$cf_manpage_renames" ; then
1404 test ! -d man && mkdir man
1405 $srcdir/man/make_sed.sh $cf_manpage_renames >man/edit_man.sed
1409 AC_MSG_RESULT($cf_manpage_renames)
1411 dnl ---------------------------------------------------------------------------
1412 dnl Some people expect each tool to make all aliases for manpages in the
1413 dnl man-directory. This accommodates the older, less-capable implementations
1414 dnl of 'man', and is optional.
1415 AC_DEFUN([CF_MANPAGE_SYMLINKS],
1417 AC_MSG_CHECKING(for manpage symlinks)
1419 AC_ARG_WITH(manpage-symlinks,
1420 [ --with-manpage-symlinks specify manpage-symlinks],
1421 [cf_manpage_symlinks=$withval],
1422 [cf_manpage_symlinks=yes])
1424 AC_MSG_RESULT($cf_manpage_symlinks)
1426 dnl ---------------------------------------------------------------------------
1427 dnl This option causes manpages to be run through tbl(1) to generate tables
1429 AC_DEFUN([CF_MANPAGE_TBL],
1431 AC_MSG_CHECKING(for manpage tbl)
1433 AC_ARG_WITH(manpage-tbl,
1434 [ --with-manpage-tbl specify manpage processing with tbl],
1435 [cf_manpage_tbl=$withval],
1436 [cf_manpage_tbl=no])
1438 AC_MSG_RESULT($cf_manpage_tbl)
1440 dnl ---------------------------------------------------------------------------
1441 dnl Try to determine if the man-pages on the system are compressed, and if
1442 dnl so, what format is used. Use this information to construct a script that
1443 dnl will install man-pages.
1444 AC_DEFUN([CF_MAN_PAGES],
1446 CF_HELP_MESSAGE(Options to Specify How Manpages are Installed:)
1452 if test "$prefix" = "NONE" ; then
1453 cf_prefix="$ac_default_prefix"
1458 case "$cf_manpage_form" in # (vi
1460 cf_subdir='$mandir/cat'
1464 cf_subdir='$mandir/man'
1469 test ! -d man && mkdir man
1470 cat >man/edit_man.sh <<CF_EOF
1471 changequote({{,}})dnl
1473 # this script is generated by the configure-script
1476 TERMINFO="$TERMINFO"
1477 MKDIRS="`cd $srcdir && pwd`/mkinstalldirs"
1479 INSTALL_DATA="$INSTALL_DATA"
1480 transform="$program_transform_name"
1482 TMP=\${TMPDIR-/tmp}/man\$\$
1483 trap "rm -f \$TMP" 0 1 2 5 15
1494 for i in \{{$}}* ; do
1496 *.orig|*.rej) ;; #(vi
1498 section=\`expr "\$i" : '.*\\.\\([0-9]\\)[xm]*'\`;
1499 if test \$verb = installing ; then
1500 if test ! -d $cf_subdir\${section} ; then
1501 \$MKDIRS $cf_subdir\$section
1505 source=\`basename \$i\`
1507 test ! -f \$inalias && inalias="\$srcdir/\$inalias"
1508 if test ! -f \$inalias ; then
1509 echo .. skipped \$source
1513 if test "$cf_manpage_symlinks" = yes ; then
1514 cat >>man/edit_man.sh <<CF_EOF
1515 aliases=\`sed -f \$srcdir/manlinks.sed \$inalias | sort -u\`
1518 if test "$cf_manpage_renames" = no ; then
1519 cat >>man/edit_man.sh <<CF_EOF
1520 # perform program transformations for section 1 man pages
1521 if test \$section = 1 ; then
1522 target=$cf_subdir\${section}/\`echo \$source|sed "\${transform}"\`
1524 target=$cf_subdir\${section}/\$source
1527 # replace variables in man page
1532 cat >>man/edit_man.sh <<CF_EOF
1533 prog_$cf_name=\`echo $cf_name|sed "\${transform}"\`
1537 cat >>man/edit_man.sh <<CF_EOF
1538 sed -e "s,@DATADIR@,\$datadir," \\
1539 -e "s,@TERMINFO@,\$TERMINFO," \\
1544 cf_NAME=`echo "$cf_name" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
1545 cat >>man/edit_man.sh <<CF_EOF
1546 -e "s,@$cf_NAME@,\$prog_$cf_name," \\
1550 cat >>man/edit_man.sh <<CF_EOF
1554 cat >>man/edit_man.sh <<CF_EOF
1555 target=\`grep "^\$source" $cf_manpage_renames | $AWK '{print \{{$}}2}'\`
1556 if test -z "\$target" ; then
1557 echo '? missing rename for '\$source
1560 target="$cf_subdir\$section/\$target"
1561 test \$verb = installing && sed -e "s,@DATADIR@,\$datadir," < \$i | sed -f edit_man.sed >\$TMP
1564 if test $cf_manpage_tbl = yes ; then
1565 cat >>man/edit_man.sh <<CF_EOF
1566 tbl \$TMP >\$TMP.out
1570 if test $with_curses_h != yes ; then
1571 cat >>man/edit_man.sh <<CF_EOF
1572 sed -e "/\#[ ]*include/s,curses.h,ncurses.h," < \$TMP >\$TMP.out
1576 if test $cf_format = yes ; then
1577 cat >>man/edit_man.sh <<CF_EOF
1578 nroff -man \$TMP >\$TMP.out
1582 case "$cf_manpage_form" in #(vi
1584 cat >>man/edit_man.sh <<CF_EOF
1585 if test \$verb = installing ; then
1586 if ( compress -f \$TMP )
1595 cat >>man/edit_man.sh <<CF_EOF
1596 if test \$verb = installing ; then
1597 if ( gzip -f \$TMP )
1602 target="\$target.gz"
1606 cat >>man/edit_man.sh <<CF_EOF
1607 # BSDI installs only .0 suffixes in the cat directories
1608 target="\`echo \$target|sed -e 's/\.[1-9]\+.\?/.0/'\`"
1612 cat >>man/edit_man.sh <<CF_EOF
1613 suffix=\`basename \$target | sed -e 's/^[^.]*//'\`
1614 if test \$verb = installing ; then
1615 echo \$verb \$target
1616 \$INSTALL_DATA \$TMP \$target
1617 test -n "\$aliases" && (
1618 cd $cf_subdir\${section} && (
1619 target=\`basename \$target\`
1620 for cf_alias in \$aliases
1622 if test \$section = 1 ; then
1623 cf_alias=\`echo \$cf_alias|sed "\${transform}"\`
1626 if test -f \$cf_alias\${suffix} ; then
1627 if ( cmp -s \$target \$cf_alias\${suffix} )
1631 echo .. \$verb alias \$cf_alias\${suffix}
1632 rm -f \$cf_alias\${suffix}
1633 $LN_S \$target \$cf_alias\${suffix}
1636 echo .. \$verb alias \$cf_alias\${suffix}
1637 rm -f \$cf_alias\${suffix}
1638 $LN_S \$target \$cf_alias\${suffix}
1643 elif test \$verb = removing ; then
1644 echo \$verb \$target
1646 test -n "\$aliases" && (
1647 cd $cf_subdir\${section} && (
1648 for cf_alias in \$aliases
1650 if test \$section = 1 ; then
1651 cf_alias=\`echo \$cf_alias|sed "\${transform}"\`
1654 echo .. \$verb alias \$cf_alias\${suffix}
1655 rm -f \$cf_alias\${suffix}
1669 chmod 755 man/edit_man.sh
1672 dnl ---------------------------------------------------------------------------
1673 dnl Checks for libraries. At least one UNIX system, Apple Macintosh
1674 dnl Rhapsody 5.5, does not have -lm. We cannot use the simpler
1675 dnl AC_CHECK_LIB(m,sin), because that fails for C++.
1676 AC_DEFUN([CF_MATH_LIB],
1678 AC_CACHE_CHECK(if -lm needed for math functions,
1684 [double x = rand(); printf("result = %g\n", ]ifelse($2,,sin(x),$2)[)],
1685 [cf_cv_need_libm=no],
1686 [cf_cv_need_libm=yes])])
1687 if test "$cf_cv_need_libm" = yes
1694 dnl ---------------------------------------------------------------------------
1695 dnl Check if the file-system supports mixed-case filenames. If we're able to
1696 dnl create a lowercase name and see it as uppercase, it doesn't support that.
1697 AC_DEFUN([CF_MIXEDCASE_FILENAMES],
1699 AC_CACHE_CHECK(if filesystem supports mixed-case filenames,cf_cv_mixedcase,[
1700 rm -f conftest CONFTEST
1702 if test -f CONFTEST ; then
1707 rm -f conftest CONFTEST
1709 test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES)
1711 dnl ---------------------------------------------------------------------------
1712 dnl Compute the object-directory name from the given model name
1713 AC_DEFUN([CF_OBJ_SUBDIR],
1716 libtool) $2='obj_lo' ;;
1717 normal) $2='objects' ;;
1718 debug) $2='obj_g' ;;
1719 profile) $2='obj_p' ;;
1720 shared) $2='obj_s' ;;
1723 dnl ---------------------------------------------------------------------------
1724 dnl Check the argument to see that it looks like a pathname. Rewrite it if it
1725 dnl begins with one of the prefix/exec_prefix variables, and then again if the
1726 dnl result begins with 'NONE'. This is necessary to workaround autoconf's
1727 dnl delayed evaluation of those symbols.
1728 AC_DEFUN([CF_PATH_SYNTAX],[
1729 case ".[$]$1" in #(vi
1732 .[a-zA-Z]:[\\/]*) #(vi OS/2 EMX
1734 .\[$]{*prefix}*) #(vi
1736 case ".[$]$1" in #(vi
1738 $1=`echo [$]$1 | sed -e s@NONE@$ac_default_prefix@`
1743 $1=`echo [$]$1 | sed -e s@NONE@$ac_default_prefix@`
1746 AC_ERROR(expected a pathname)
1750 dnl ---------------------------------------------------------------------------
1751 dnl Compute $PROG_EXT, used for non-Unix ports, such as OS/2 EMX.
1752 AC_DEFUN([CF_PROG_EXT],
1754 AC_REQUIRE([CF_CHECK_CACHE])
1756 case $cf_cv_system_name in
1758 # We make sure -Zexe is not used -- it would interfere with @PROG_EXT@
1759 CFLAGS="$CFLAGS -Zmt -D__ST_MT_ERRNO__"
1760 CXXFLAGS="$CXXFLAGS -Zmt -D__ST_MT_ERRNO__"
1761 LDFLAGS=`echo "$LDFLAGS -Zmt -Zcrtdll" | sed "s/-Zexe//g"`
1770 dnl ---------------------------------------------------------------------------
1771 dnl Force $INSTALL to be an absolute-path. Otherwise, edit_man.sh and the
1772 dnl misc/tabset install won't work properly. Usually this happens only when
1773 dnl using the fallback mkinstalldirs script
1774 AC_DEFUN([CF_PROG_INSTALL],
1780 changequote({{,}})dnl
1781 cf_dir=`echo $INSTALL|sed -e 's%/[^/]*$%%'`
1782 test -z "$cf_dir" && cf_dir=.
1784 INSTALL=`cd $cf_dir && pwd`/`echo $INSTALL | sed -e 's:^.*/::'`
1788 dnl ---------------------------------------------------------------------------
1789 dnl Attempt to determine if we've got one of the flavors of regular-expression
1790 dnl code that we can support.
1791 AC_DEFUN([CF_REGEX],
1793 AC_MSG_CHECKING([for regular-expression headers])
1794 AC_CACHE_VAL(cf_cv_regex,[
1795 AC_TRY_LINK([#include <sys/types.h>
1796 #include <regex.h>],[
1798 int x = regcomp(p, "", 0);
1799 int y = regexec(p, "", 0, 0, 0);
1801 ],[cf_cv_regex="regex.h"],[
1802 AC_TRY_LINK([#include <regexp.h>],[
1803 char *p = compile("", "", "", 0);
1804 int x = step("", "");
1805 ],[cf_cv_regex="regexp.h"],[
1806 cf_save_LIBS="$LIBS"
1808 AC_TRY_LINK([#include <regexpr.h>],[
1809 char *p = compile("", "", "");
1810 int x = step("", "");
1811 ],[cf_cv_regex="regexpr.h"],[LIBS="$cf_save_LIBS"])])])
1813 AC_MSG_RESULT($cf_cv_regex)
1814 case $cf_cv_regex in
1815 regex.h) AC_DEFINE(HAVE_REGEX_H_FUNCS) ;;
1816 regexp.h) AC_DEFINE(HAVE_REGEXP_H_FUNCS) ;;
1817 regexpr.h) AC_DEFINE(HAVE_REGEXPR_H_FUNCS) ;;
1820 dnl ---------------------------------------------------------------------------
1821 dnl Attempt to determine the appropriate CC/LD options for creating a shared
1824 dnl Note: $(LOCAL_LDFLAGS) is used to link executables that will run within the
1825 dnl build-tree, i.e., by making use of the libraries that are compiled in ../lib
1826 dnl We avoid compiling-in a ../lib path for the shared library since that can
1827 dnl lead to unexpected results at runtime.
1828 dnl $(LOCAL_LDFLAGS2) has the same intention but assumes that the shared libraries
1829 dnl are compiled in ../../lib
1831 dnl The variable 'cf_cv_do_symlinks' is used to control whether we configure
1832 dnl to install symbolic links to the rel/abi versions of shared libraries.
1834 dnl The variable 'cf_cv_shlib_version' controls whether we use the rel or abi
1835 dnl version when making symbolic links.
1837 dnl Some loaders leave 'so_locations' lying around. It's nice to clean up.
1838 AC_DEFUN([CF_SHARED_OPTS],
1840 AC_REQUIRE([CF_SUBST_NCURSES_VERSION])
1844 INSTALL_LIB="-m 644"
1846 cf_cv_do_symlinks=no
1848 AC_MSG_CHECKING(if release/abi version should be used for shared libs)
1849 AC_ARG_WITH(shlib-version,
1850 [ --with-shlib-version=X Specify rel or abi version for shared libs],
1851 [test -z "$withval" && withval=auto
1852 case $withval in #(vi
1854 cf_cv_shlib_version=auto
1856 rel|abi|auto|no) #(vi
1857 cf_cv_shlib_version=$withval
1860 AC_ERROR([option value must be one of: rel, abi, auto or no])
1863 ],[cf_cv_shlib_version=auto])
1864 AC_MSG_RESULT($cf_cv_shlib_version)
1868 # Some less-capable ports of gcc support only -fpic
1870 if test "$GCC" = yes
1872 AC_MSG_CHECKING(which $CC option to use)
1873 cf_save_CFLAGS="$CFLAGS"
1874 for CC_SHARED_OPTS in -fPIC -fpic ''
1876 CFLAGS="$cf_save_CFLAGS $CC_SHARED_OPTS"
1877 AC_TRY_COMPILE([#include <stdio.h>],[int x = 1],[break],[])
1879 AC_MSG_RESULT($CC_SHARED_OPTS)
1880 CFLAGS="$cf_save_CFLAGS"
1883 case $cf_cv_system_name in
1885 MK_SHARED_LIB='$(CC) -o $[@] -Xlinker -soname=`basename $[@]` -nostart -e 0'
1888 # (tested with gcc 2.7.2 -- I don't have c89)
1889 if test "$GCC" = yes; then
1890 LD_SHARED_OPTS='-Xlinker +b -Xlinker $(libdir)'
1893 LD_SHARED_OPTS='-Wl,+b,$(libdir)'
1895 MK_SHARED_LIB='$(LD) +b $(libdir) -b -o $[@]'
1896 # HP-UX shared libraries must be executable, and should be
1897 # readonly to exploit a quirk in the memory manager.
1898 INSTALL_LIB="-m 555"
1901 if test "$cf_cv_ld_rpath" = yes ; then
1902 cf_ld_rpath_opt="-Wl,-rpath,"
1903 EXTRA_LDFLAGS="-Wl,-rpath,\$(libdir) $EXTRA_LDFLAGS"
1905 # tested with IRIX 5.2 and 'cc'.
1906 if test "$GCC" != yes; then
1907 CC_SHARED_OPTS='-KPIC'
1909 MK_SHARED_LIB='$(LD) -shared -rdata_shared -soname `basename $[@]` -o $[@]'
1910 cf_cv_rm_so_locs=yes
1913 if test "$DFT_LWR_MODEL" = "shared" ; then
1914 LOCAL_LDFLAGS="-Wl,-rpath,`pwd`/lib"
1915 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
1917 if test "$cf_cv_ld_rpath" = yes ; then
1918 cf_ld_rpath_opt="-Wl,-rpath,"
1919 EXTRA_LDFLAGS="$LOCAL_LDFLAGS $EXTRA_LDFLAGS"
1921 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
1922 MK_SHARED_LIB='$(CC) -shared -Wl,-soname,`basename $[@] .$(REL_VERSION)`.$(ABI_VERSION),-stats,-lc -o $[@]'
1925 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
1926 MK_SHARED_LIB='$(LD) -Bshareable -soname,`basename $[@].$(ABI_VERSION)` -o $[@]'
1929 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
1930 MK_SHARED_LIB='$(LD) -Bshareable -o $[@]'
1931 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
1934 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
1935 test "$cf_cv_ld_rpath" = yes && cf_ld_rpath_opt="-Wl,-rpath,"
1936 if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_ld_rpath" = yes ; then
1937 LOCAL_LDFLAGS="-Wl,-rpath,`pwd`/lib"
1938 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
1939 EXTRA_LDFLAGS="-Wl,-rpath,\$(libdir) $EXTRA_LDFLAGS"
1940 MK_SHARED_LIB='$(CC) -shared -Wl,-soname,`basename $[@] .$(REL_VERSION)`.$(ABI_VERSION) -o $[@]'
1941 if test "$cf_cv_shlib_version" = auto; then
1942 if test ! -f /usr/libexec/ld.elf_so; then
1943 cf_cv_shlib_version=rel
1947 MK_SHARED_LIB='$(LD) -Bshareable -o $[@]'
1951 # tested with OSF/1 V3.2 and 'cc'
1952 # tested with OSF/1 V3.2 and gcc 2.6.3 (but the c++ demo didn't
1953 # link with shared libs).
1954 MK_SHARED_LIB='$(LD) -set_version $(REL_VERSION):$(ABI_VERSION) -expect_unresolved "*" -shared -soname `basename $[@]`'
1957 MK_SHARED_LIB="${MK_SHARED_LIB} -msym"
1960 MK_SHARED_LIB="${MK_SHARED_LIB}"' -o $[@]'
1961 if test "$DFT_LWR_MODEL" = "shared" ; then
1962 LOCAL_LDFLAGS="-Wl,-rpath,`pwd`/lib"
1963 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
1965 if test "$cf_cv_ld_rpath" = yes ; then
1966 cf_ld_rpath_opt="-rpath"
1967 # EXTRA_LDFLAGS="$LOCAL_LDFLAGS $EXTRA_LDFLAGS"
1969 cf_cv_rm_so_locs=yes
1971 sco3.2v5*) # (also uw2* and UW7) hops 13-Apr-98
1972 # tested with osr5.0.5
1973 if test "$ac_cv_prog_gcc" != yes; then
1974 CC_SHARED_OPTS='-belf -KPIC'
1976 MK_SHARED_LIB='$(LD) -dy -G -h `basename $[@] .$(REL_VERSION)`.$(ABI_VERSION) -o [$]@'
1977 if test "$cf_cv_ld_rpath" = yes ; then
1978 # only way is to set LD_RUN_PATH but no switch for it
1981 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
1982 LINK_PROGS='LD_RUN_PATH=$(libdir)'
1983 LINK_TESTS='Pwd=`pwd`;LD_RUN_PATH=`dirname $${Pwd}`/lib'
1986 # tested with SunOS 4.1.1 and gcc 2.7.0
1987 if test "$ac_cv_prog_gcc" != yes; then
1988 CC_SHARED_OPTS='-KPIC'
1990 MK_SHARED_LIB='$(LD) -assert pure-text -o $[@]'
1991 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
1994 # tested with SunOS 5.5.1 (solaris 2.5.1) and gcc 2.7.2
1995 if test "$ac_cv_prog_gcc" != yes; then
1996 CC_SHARED_OPTS='-KPIC'
1998 MK_SHARED_LIB='$(LD) -dy -G -h `basename $[@] .$(REL_VERSION)`.$(ABI_VERSION) -o $[@]'
1999 if test "$DFT_LWR_MODEL" = "shared" ; then
2000 LOCAL_LDFLAGS="-R `pwd`/lib:\$(libdir)"
2001 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
2003 if test "$cf_cv_ld_rpath" = yes ; then
2004 cf_ld_rpath_opt="-R"
2005 EXTRA_LDFLAGS="$LOCAL_LDFLAGS $EXTRA_LDFLAGS"
2007 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
2010 # tested with UnixWare 7.1.0 (gcc 2.95.2 and cc)
2011 if test "$ac_cv_prog_gcc" != yes; then
2012 CC_SHARED_OPTS='-KPIC'
2014 MK_SHARED_LIB='$(LD) -d y -G -o [$]@'
2017 CC_SHARED_OPTS='unknown'
2018 MK_SHARED_LIB='echo unknown'
2022 # This works if the last tokens in $MK_SHARED_LIB are the -o target.
2023 case "$cf_cv_shlib_version" in #(vi
2025 case "$MK_SHARED_LIB" in #(vi
2027 test "$cf_cv_do_symlinks" = no && cf_cv_do_symlinks=yes
2030 AC_MSG_WARN(ignored --with-shlib-version)
2036 if test -n "$cf_ld_rpath_opt" ; then
2037 AC_MSG_CHECKING(if we need a space after rpath option)
2038 cf_save_LIBS="$LIBS"
2039 LIBS="$LIBS ${cf_ld_rpath_opt}$libdir"
2040 AC_TRY_LINK(, , cf_rpath_space=no, cf_rpath_space=yes)
2041 LIBS="$cf_save_LIBS"
2042 AC_MSG_RESULT($cf_rpath_space)
2043 test "$cf_rpath_space" = yes && cf_ld_rpath_opt="$cf_ld_rpath_opt "
2044 MK_SHARED_LIB="$MK_SHARED_LIB $cf_ld_rpath_opt\$(libdir)"
2047 AC_SUBST(CC_SHARED_OPTS)
2048 AC_SUBST(LD_SHARED_OPTS)
2049 AC_SUBST(MK_SHARED_LIB)
2050 AC_SUBST(LINK_PROGS)
2051 AC_SUBST(LINK_TESTS)
2052 AC_SUBST(EXTRA_LDFLAGS)
2053 AC_SUBST(LOCAL_LDFLAGS)
2054 AC_SUBST(LOCAL_LDFLAGS2)
2055 AC_SUBST(INSTALL_LIB)
2057 dnl ---------------------------------------------------------------------------
2058 dnl Check for definitions & structures needed for window size-changing
2059 dnl FIXME: check that this works with "snake" (HP-UX 10.x)
2060 AC_DEFUN([CF_SIZECHANGE],
2062 AC_REQUIRE([CF_STRUCT_TERMIOS])
2063 AC_CACHE_CHECK(declaration of size-change, cf_cv_sizechange,[
2064 cf_cv_sizechange=unknown
2065 cf_save_CFLAGS="$CFLAGS"
2067 for cf_opts in "" "NEED_PTEM_H"
2070 CFLAGS="$cf_save_CFLAGS"
2071 test -n "$cf_opts" && CFLAGS="$CFLAGS -D$cf_opts"
2072 AC_TRY_COMPILE([#include <sys/types.h>
2073 #ifdef HAVE_TERMIOS_H
2074 #include <termios.h>
2076 #ifdef HAVE_TERMIO_H
2081 /* This is a workaround for SCO: they neglected to define struct winsize in
2082 * termios.h -- it's only in termio.h and ptem.h
2084 #include <sys/stream.h>
2085 #include <sys/ptem.h>
2087 #if !defined(sun) || !defined(HAVE_TERMIOS_H)
2088 #include <sys/ioctl.h>
2092 struct ttysize win; /* FIXME: what system is this? */
2093 int y = win.ts_lines;
2094 int x = win.ts_cols;
2101 no TIOCGSIZE or TIOCGWINSZ
2102 #endif /* TIOCGWINSZ */
2103 #endif /* TIOCGSIZE */
2105 [cf_cv_sizechange=yes],
2106 [cf_cv_sizechange=no])
2108 CFLAGS="$cf_save_CFLAGS"
2109 if test "$cf_cv_sizechange" = yes ; then
2110 echo "size-change succeeded ($cf_opts)" >&AC_FD_CC
2111 test -n "$cf_opts" && cf_cv_sizechange="$cf_opts"
2116 if test "$cf_cv_sizechange" != no ; then
2117 AC_DEFINE(HAVE_SIZECHANGE)
2118 case $cf_cv_sizechange in #(vi
2120 AC_DEFINE_UNQUOTED($cf_cv_sizechange )
2125 dnl ---------------------------------------------------------------------------
2126 dnl For each parameter, test if the source-directory exists, and if it contains
2127 dnl a 'modules' file. If so, add to the list $cf_cv_src_modules which we'll
2128 dnl use in CF_LIB_RULES.
2130 dnl This uses the configured value to make the lists SRC_SUBDIRS and
2131 dnl SUB_MAKEFILES which are used in the makefile-generation scheme.
2132 AC_DEFUN([CF_SRC_MODULES],
2134 AC_MSG_CHECKING(for src modules)
2136 # dependencies and linker-arguments for test-programs
2137 TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${LIB_NAME}${DFT_DEP_SUFFIX} $TEST_DEPS"
2138 if test "$DFT_LWR_MODEL" = "libtool"; then
2139 TEST_ARGS="${TEST_DEPS}"
2141 TEST_ARGS="-l${LIB_NAME}${DFT_ARG_SUFFIX} $TEST_ARGS"
2144 # dependencies and linker-arguments for utility-programs
2145 PROG_ARGS="$TEST_ARGS"
2150 if test -f $srcdir/$cf_dir/modules; then
2152 # We may/may not have tack in the distribution, though the
2154 if test $cf_dir = tack ; then
2155 if test ! -f $srcdir/${cf_dir}/${cf_dir}.h; then
2160 if test -z "$cf_cv_src_modules"; then
2161 cf_cv_src_modules=$cf_dir
2163 cf_cv_src_modules="$cf_cv_src_modules $cf_dir"
2166 # Make the ncurses_cfg.h file record the library interface files as
2167 # well. These are header files that are the same name as their
2168 # directory. Ncurses is the only library that does not follow
2170 if test $cf_dir = tack ; then
2172 elif test -f $srcdir/${cf_dir}/${cf_dir}.h; then
2173 CF_UPPER(cf_have_include,$cf_dir)
2174 AC_DEFINE_UNQUOTED(HAVE_${cf_have_include}_H)
2175 AC_DEFINE_UNQUOTED(HAVE_LIB${cf_have_include})
2176 TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${cf_dir}${DFT_DEP_SUFFIX} $TEST_DEPS"
2177 if test "$DFT_LWR_MODEL" = "libtool"; then
2178 TEST_ARGS="${TEST_DEPS}"
2180 TEST_ARGS="-l${cf_dir}${DFT_ARG_SUFFIX} $TEST_ARGS"
2185 AC_MSG_RESULT($cf_cv_src_modules)
2186 TEST_ARGS="-L${LIB_DIR} -L\$(libdir) $TEST_ARGS"
2190 PROG_ARGS="-L${LIB_DIR} -L\$(libdir) $PROG_ARGS"
2193 SRC_SUBDIRS="man include"
2194 for cf_dir in $cf_cv_src_modules
2196 SRC_SUBDIRS="$SRC_SUBDIRS $cf_dir"
2198 SRC_SUBDIRS="$SRC_SUBDIRS misc test"
2199 test "$cf_with_cxx_binding" != no && SRC_SUBDIRS="$SRC_SUBDIRS c++"
2202 if test "$cf_cv_prog_gnat_correct" = yes && test -f $srcdir/Ada95/Makefile.in; then
2203 SRC_SUBDIRS="$SRC_SUBDIRS Ada95"
2204 ADA_SUBDIRS="gen src samples"
2208 for cf_dir in $SRC_SUBDIRS
2210 SUB_MAKEFILES="$SUB_MAKEFILES $cf_dir/Makefile"
2213 if test -n "$ADA_SUBDIRS"; then
2214 for cf_dir in $ADA_SUBDIRS
2216 SUB_MAKEFILES="$SUB_MAKEFILES Ada95/$cf_dir/Makefile"
2218 AC_SUBST(ADA_SUBDIRS)
2221 dnl ---------------------------------------------------------------------------
2222 dnl Check for -lstdc++, which is GNU's standard C++ library.
2223 AC_DEFUN([CF_STDCPP_LIBRARY],
2225 if test -n "$GXX" ; then
2226 case $cf_cv_system_name in #(vi
2228 cf_stdcpp_libname=stdcpp
2231 cf_stdcpp_libname=stdc++
2234 AC_CACHE_CHECK(for library $cf_stdcpp_libname,cf_cv_libstdcpp,[
2236 LIBS="$LIBS -l$cf_stdcpp_libname"
2238 #include <strstream.h>],[
2240 strstreambuf foo(buf, sizeof(buf))
2242 [cf_cv_libstdcpp=yes],
2243 [cf_cv_libstdcpp=no])
2246 test "$cf_cv_libstdcpp" = yes && CXXLIBS="$CXXLIBS -l$cf_stdcpp_libname"
2249 dnl ---------------------------------------------------------------------------
2250 dnl Remove "-g" option from the compiler options
2251 AC_DEFUN([CF_STRIP_G_OPT],
2252 [$1=`echo ${$1} | sed -e 's/-g //' -e 's/-g$//'`])dnl
2253 dnl ---------------------------------------------------------------------------
2254 dnl Check if we need _POSIX_SOURCE defined to use struct sigaction. We'll only
2255 dnl do this if we've found the sigaction function.
2257 dnl If needed, define SVR4_ACTION.
2258 AC_DEFUN([CF_STRUCT_SIGACTION],[
2259 if test "$ac_cv_func_sigaction" = yes; then
2260 AC_MSG_CHECKING(whether sigaction needs _POSIX_SOURCE)
2262 #include <sys/types.h>
2263 #include <signal.h>],
2264 [struct sigaction act],
2268 #define _POSIX_SOURCE
2269 #include <sys/types.h>
2270 #include <signal.h>],
2271 [struct sigaction act],
2273 AC_DEFINE(SVR4_ACTION)],
2274 [sigact_bad=unknown])])
2275 AC_MSG_RESULT($sigact_bad)
2278 dnl ---------------------------------------------------------------------------
2279 dnl Some machines require _POSIX_SOURCE to completely define struct termios.
2280 dnl If so, define SVR4_TERMIO
2281 AC_DEFUN([CF_STRUCT_TERMIOS],[
2287 if test "$ISC" = yes ; then
2288 AC_CHECK_HEADERS( sys/termio.h )
2290 if test "$ac_cv_header_termios_h" = yes ; then
2293 termios_bad=dunno ;;
2294 *) termios_bad=maybe ;;
2296 if test "$termios_bad" = maybe ; then
2297 AC_MSG_CHECKING(whether termios.h needs _POSIX_SOURCE)
2298 AC_TRY_COMPILE([#include <termios.h>],
2299 [struct termios foo; int x = foo.c_iflag],
2302 #define _POSIX_SOURCE
2303 #include <termios.h>],
2304 [struct termios foo; int x = foo.c_iflag],
2305 termios_bad=unknown,
2306 termios_bad=yes AC_DEFINE(SVR4_TERMIO))
2308 AC_MSG_RESULT($termios_bad)
2312 dnl ---------------------------------------------------------------------------
2313 dnl Shorthand macro for substituting things that the user may override
2314 dnl with an environment variable.
2316 dnl $1 = long/descriptive name
2317 dnl $2 = environment variable
2318 dnl $3 = default value
2319 AC_DEFUN([CF_SUBST],
2320 [AC_CACHE_VAL(cf_cv_subst_$2,[
2321 AC_MSG_CHECKING(for $1 (symbol $2))
2322 test -z "[$]$2" && $2=$3
2323 AC_MSG_RESULT([$]$2)
2325 cf_cv_subst_$2=[$]$2])
2326 $2=${cf_cv_subst_$2}
2328 dnl ---------------------------------------------------------------------------
2329 dnl Get the version-number for use in shared-library naming, etc.
2330 AC_DEFUN([CF_SUBST_NCURSES_VERSION],
2333 NCURSES_MAJOR="`egrep '^NCURSES_MAJOR[ ]*=' $srcdir/dist.mk | sed -e 's/^[^0-9]*//'`"
2334 NCURSES_MINOR="`egrep '^NCURSES_MINOR[ ]*=' $srcdir/dist.mk | sed -e 's/^[^0-9]*//'`"
2335 NCURSES_PATCH="`egrep '^NCURSES_PATCH[ ]*=' $srcdir/dist.mk | sed -e 's/^[^0-9]*//'`"
2337 cf_cv_abi_version=${NCURSES_MAJOR}
2338 cf_cv_rel_version=${NCURSES_MAJOR}.${NCURSES_MINOR}
2339 dnl Show the computed version, for logging
2340 AC_MSG_RESULT(Configuring NCURSES $cf_cv_rel_version ABI $cf_cv_abi_version (`date`))
2341 dnl We need these values in the generated headers
2342 AC_SUBST(NCURSES_MAJOR)
2343 AC_SUBST(NCURSES_MINOR)
2344 AC_SUBST(NCURSES_PATCH)
2345 dnl We need these values in the generated makefiles
2346 AC_SUBST(cf_cv_rel_version)
2347 AC_SUBST(cf_cv_abi_version)
2348 AC_SUBST(cf_cv_cc_bool_type)
2349 AC_SUBST(cf_cv_builtin_bool)
2350 AC_SUBST(cf_cv_type_of_bool)dnl
2352 dnl ---------------------------------------------------------------------------
2353 dnl Check if we can include <sys/time.h> with <sys/select.h>; this breaks on
2354 dnl older SCO configurations.
2355 AC_DEFUN([CF_SYS_TIME_SELECT],
2357 AC_MSG_CHECKING(if sys/time.h works with sys/select.h)
2358 AC_CACHE_VAL(cf_cv_sys_time_select,[
2360 #include <sys/types.h>
2361 #ifdef HAVE_SYS_TIME_H
2362 #include <sys/time.h>
2364 #ifdef HAVE_SYS_SELECT_H
2365 #include <sys/select.h>
2367 ],[],[cf_cv_sys_time_select=yes],
2368 [cf_cv_sys_time_select=no])
2370 AC_MSG_RESULT($cf_cv_sys_time_select)
2371 test "$cf_cv_sys_time_select" = yes && AC_DEFINE(HAVE_SYS_TIME_SELECT)
2373 dnl ---------------------------------------------------------------------------
2374 dnl Determine the type we should use for chtype (and attr_t, which is treated
2375 dnl as the same thing). We want around 32 bits, so on most machines want a
2376 dnl long, but on newer 64-bit machines, probably want an int. If we're using
2377 dnl wide characters, we have to have a type compatible with that, as well.
2378 AC_DEFUN([CF_TYPEOF_CHTYPE],
2380 AC_REQUIRE([CF_UNSIGNED_LITERALS])
2381 AC_MSG_CHECKING([for type of chtype])
2382 AC_CACHE_VAL(cf_cv_typeof_chtype,[
2384 #ifdef USE_WIDEC_SUPPORT
2385 #include <stddef.h> /* we want wchar_t */
2386 #define WANT_BITS 39
2388 #define WANT_BITS 31
2393 FILE *fp = fopen("cf_test.out", "w");
2395 char *result = "long";
2396 #ifdef USE_WIDEC_SUPPORT
2398 * If wchar_t is smaller than a long, it must be an int or a
2399 * short. We prefer not to use a short anyway.
2401 if (sizeof(unsigned long) > sizeof(wchar_t))
2404 if (sizeof(unsigned long) > sizeof(unsigned int)) {
2407 for (n = 0; n < WANT_BITS; n++) {
2408 unsigned int y = (x >> n);
2409 if (y != 1 || x == 0) {
2415 * If x is nonzero, an int is big enough for the bits
2418 result = (x != 0) ? "int" : "long";
2426 [cf_cv_typeof_chtype=`cat cf_test.out`],
2427 [cf_cv_typeof_chtype=long],
2428 [cf_cv_typeof_chtype=long])
2431 AC_MSG_RESULT($cf_cv_typeof_chtype)
2433 AC_SUBST(cf_cv_typeof_chtype)
2434 AC_DEFINE_UNQUOTED(TYPEOF_CHTYPE,$cf_cv_typeof_chtype)
2437 test "$cf_cv_unsigned_literals" = yes && cf_cv_1UL="${cf_cv_1UL}U"
2438 test "$cf_cv_typeof_chtype" = long && cf_cv_1UL="${cf_cv_1UL}L"
2442 dnl ---------------------------------------------------------------------------
2444 AC_DEFUN([CF_TYPE_SIGACTION],
2446 AC_MSG_CHECKING([for type sigaction_t])
2447 AC_CACHE_VAL(cf_cv_type_sigaction,[
2449 #include <signal.h>],
2451 [cf_cv_type_sigaction=yes],
2452 [cf_cv_type_sigaction=no])])
2453 AC_MSG_RESULT($cf_cv_type_sigaction)
2454 test "$cf_cv_type_sigaction" = yes && AC_DEFINE(HAVE_TYPE_SIGACTION)
2456 dnl ---------------------------------------------------------------------------
2457 dnl Test if the compiler supports 'U' and 'L' suffixes. Only old compilers
2458 dnl won't, but they're still there.
2459 AC_DEFUN([CF_UNSIGNED_LITERALS],
2461 AC_MSG_CHECKING([if unsigned literals are legal])
2462 AC_CACHE_VAL(cf_cv_unsigned_literals,[
2463 AC_TRY_COMPILE([],[long x = 1L + 1UL + 1U + 1],
2464 [cf_cv_unsigned_literals=yes],
2465 [cf_cv_unsigned_literals=no])
2467 AC_MSG_RESULT($cf_cv_unsigned_literals)
2469 dnl ---------------------------------------------------------------------------
2470 dnl Make an uppercase version of a variable
2471 dnl $1=uppercase($2)
2472 AC_DEFUN([CF_UPPER],
2475 $1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
2478 dnl ---------------------------------------------------------------------------
2479 dnl Compute the shift-mask that we'll use for wide-character indices. We use
2480 dnl all but the index portion of chtype for storing attributes.
2481 AC_DEFUN([CF_WIDEC_SHIFT],
2483 AC_REQUIRE([CF_TYPEOF_CHTYPE])
2484 AC_MSG_CHECKING([for number of bits in chtype])
2485 AC_CACHE_VAL(cf_cv_shift_limit,[
2490 FILE *fp = fopen("cf_test.out", "w");
2493 unsigned TYPEOF_CHTYPE x = 1L;
2494 for (n = 0; ; n++) {
2495 unsigned long y = (x >> n);
2496 if (y != 1 || x == 0)
2500 fprintf(fp, "%d", n);
2506 [cf_cv_shift_limit=`cat cf_test.out`],
2507 [cf_cv_shift_limit=32],
2508 [cf_cv_shift_limit=32])
2511 AC_MSG_RESULT($cf_cv_shift_limit)
2512 AC_SUBST(cf_cv_shift_limit)
2514 AC_MSG_CHECKING([for width of character-index])
2515 AC_CACHE_VAL(cf_cv_widec_shift,[
2516 if test ".$with_widec" = ".yes" ; then
2518 if ( expr $cf_cv_shift_limit \> $cf_attrs_width >/dev/null )
2520 cf_cv_widec_shift=`expr 16 + $cf_cv_shift_limit - $cf_attrs_width`
2522 cf_cv_widec_shift=16
2528 AC_MSG_RESULT($cf_cv_widec_shift)
2529 AC_SUBST(cf_cv_widec_shift)
2531 dnl ---------------------------------------------------------------------------
2532 dnl Wrapper for AC_ARG_WITH to ensure that user supplies a pathname, not just
2533 dnl defaulting to yes/no.
2535 dnl $1 = option name
2537 dnl $3 = environment variable to set
2538 dnl $4 = default value, shown in the help-message, must be a constant
2539 dnl $5 = default value, if it's an expression & cannot be in the help-message
2541 AC_DEFUN([CF_WITH_PATH],
2542 [AC_ARG_WITH($1,[$2 ](default: ifelse($4,,empty,$4)),,
2543 ifelse($4,,[withval="${$3}"],[withval="${$3-ifelse($5,,$4,$5)}"]))dnl
2544 CF_PATH_SYNTAX(withval)
2548 dnl ---------------------------------------------------------------------------
2549 dnl Process an option specifying a list of colon-separated paths.
2551 dnl $1 = option name
2553 dnl $3 = environment variable to set
2554 dnl $4 = default value, shown in the help-message, must be a constant
2555 dnl $5 = default value, if it's an expression & cannot be in the help-message
2557 AC_DEFUN([CF_WITH_PATHLIST],[
2558 AC_ARG_WITH($1,[$2 ](default: ifelse($4,,empty,$4)),,
2559 ifelse($4,,[withval="${$3}"],[withval="${$3-ifelse($5,,$4,$5)}"]))dnl
2561 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
2563 for cf_src_path in $withval
2565 CF_PATH_SYNTAX(cf_src_path)
2566 test -n "$cf_dst_path" && cf_dst_path="${cf_dst_path}:"
2567 cf_dst_path="${cf_dst_path}${cf_src_path}"
2571 eval $3="$cf_dst_path"