1 dnl***************************************************************************
2 dnl Copyright (c) 1998-2003,2004 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-2003
31 dnl $Id: aclocal.m4,v 1.333 2004/01/30 20:59:56 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 CF_ADA_INCLUDE_DIRS version: 4 updated: 2002/12/01 00:12:15
39 dnl -------------------
40 dnl Construct the list of include-options for the C programs in the Ada95
42 AC_DEFUN([CF_ADA_INCLUDE_DIRS],
44 ACPPFLAGS="-I. -I../../include $ACPPFLAGS"
45 if test "$srcdir" != "."; then
46 ACPPFLAGS="-I\$(srcdir)/../../include $ACPPFLAGS"
48 if test "$GCC" != yes; then
49 ACPPFLAGS="$ACPPFLAGS -I\$(includedir)"
50 elif test "$includedir" != "/usr/include"; then
51 if test "$includedir" = '${prefix}/include' ; then
52 if test $prefix != /usr ; then
53 ACPPFLAGS="$ACPPFLAGS -I\$(includedir)"
56 ACPPFLAGS="$ACPPFLAGS -I\$(includedir)"
61 dnl ---------------------------------------------------------------------------
62 dnl CF_ADD_CFLAGS version: 5 updated: 2002/12/01 00:12:15
64 dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS
65 dnl The second parameter if given makes this macro verbose.
66 AC_DEFUN([CF_ADD_CFLAGS],
70 for cf_add_cflags in $1
72 case $cf_add_cflags in #(vi
73 -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi
78 cf_new_cppflags="$cf_new_cppflags $cf_add_cflags"
83 cf_new_cflags="$cf_new_cflags $cf_add_cflags"
88 if test -n "$cf_new_cflags" ; then
89 ifelse($2,,,[CF_VERBOSE(add to \$CFLAGS $cf_new_cflags)])
90 CFLAGS="$CFLAGS $cf_new_cflags"
93 if test -n "$cf_new_cppflags" ; then
94 ifelse($2,,,[CF_VERBOSE(add to \$CPPFLAGS $cf_new_cppflags)])
95 CPPFLAGS="$cf_new_cppflags $CPPFLAGS"
99 dnl ---------------------------------------------------------------------------
100 dnl CF_ANSI_CC_CHECK version: 9 updated: 2001/12/30 17:53:34
102 dnl This is adapted from the macros 'fp_PROG_CC_STDC' and 'fp_C_PROTOTYPES'
103 dnl in the sharutils 4.2 distribution.
104 AC_DEFUN([CF_ANSI_CC_CHECK],
106 AC_CACHE_CHECK(for ${CC-cc} option to accept ANSI C, cf_cv_ansi_cc,[
108 cf_save_CFLAGS="$CFLAGS"
109 cf_save_CPPFLAGS="$CPPFLAGS"
110 # Don't try gcc -ansi; that turns off useful extensions and
111 # breaks some systems' header files.
113 # Ultrix and OSF/1 -std1
114 # HP-UX -Aa -D_HPUX_SOURCE
116 # UnixWare 1.2 (cannot use -Xc, since ANSI/POSIX clashes)
117 for cf_arg in "-DCC_HAS_PROTOS" \
122 "-Aa -D_HPUX_SOURCE" \
125 CF_ADD_CFLAGS($cf_arg)
128 #ifndef CC_HAS_PROTOS
129 #if !defined(__STDC__) || (__STDC__ != 1)
134 int test (int i, double x);
135 struct s1 {int (*f) (int a);};
136 struct s2 {int (*f) (double a);};],
137 [cf_cv_ansi_cc="$cf_arg"; break])
139 CFLAGS="$cf_save_CFLAGS"
140 CPPFLAGS="$cf_save_CPPFLAGS"
143 if test "$cf_cv_ansi_cc" != "no"; then
144 if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then
145 CF_ADD_CFLAGS($cf_cv_ansi_cc)
147 AC_DEFINE(CC_HAS_PROTOS)
151 dnl ---------------------------------------------------------------------------
152 dnl CF_ANSI_CC_REQD version: 3 updated: 1997/09/06 13:40:44
154 dnl For programs that must use an ANSI compiler, obtain compiler options that
155 dnl will make it recognize prototypes. We'll do preprocessor checks in other
156 dnl macros, since tools such as unproto can fake prototypes, but only part of
157 dnl the preprocessor.
158 AC_DEFUN([CF_ANSI_CC_REQD],
159 [AC_REQUIRE([CF_ANSI_CC_CHECK])
160 if test "$cf_cv_ansi_cc" = "no"; then
162 [Your compiler does not appear to recognize prototypes.
163 You have the following choices:
164 a. adjust your compiler options
165 b. get an up-to-date compiler
166 c. use a wrapper such as unproto])
169 dnl ---------------------------------------------------------------------------
170 dnl CF_BOOL_DECL version: 8 updated: 2004/01/30 15:51:18
172 dnl Test if 'bool' is a builtin type in the configured C++ compiler. Some
173 dnl older compilers (e.g., gcc 2.5.8) don't support 'bool' directly; gcc
174 dnl 2.6.3 does, in anticipation of the ANSI C++ standard.
176 dnl Treat the configuration-variable specially here, since we're directly
177 dnl substituting its value (i.e., 1/0).
179 dnl $1 is the shell variable to store the result in, if not $cv_cv_builtin_bool
180 AC_DEFUN([CF_BOOL_DECL],
182 AC_MSG_CHECKING(if we should include stdbool.h)
184 AC_CACHE_VAL(cf_cv_header_stdbool_h,[
185 AC_TRY_COMPILE([],[bool foo = false],
186 [cf_cv_header_stdbool_h=0],
191 ],[bool foo = false],
192 [cf_cv_header_stdbool_h=1],
193 [cf_cv_header_stdbool_h=0])])])
195 if test "$cf_cv_header_stdbool_h" = 1
196 then AC_MSG_RESULT(yes)
197 else AC_MSG_RESULT(no)
200 AC_MSG_CHECKING([for builtin bool type])
202 AC_CACHE_VAL(ifelse($1,,cf_cv_builtin_bool,[$1]),[
205 #include <sys/types.h>
207 [ifelse($1,,cf_cv_builtin_bool,[$1])=1],
208 [ifelse($1,,cf_cv_builtin_bool,[$1])=0])
211 if test "$ifelse($1,,cf_cv_builtin_bool,[$1])" = 1
212 then AC_MSG_RESULT(yes)
213 else AC_MSG_RESULT(no)
216 dnl ---------------------------------------------------------------------------
217 dnl CF_BOOL_SIZE version: 10 updated: 2002/02/23 20:38:31
219 dnl Test for the size of 'bool' in the configured C++ compiler (e.g., a type).
220 dnl Don't bother looking for bool.h, since it's been deprecated.
222 dnl If the current compiler is C rather than C++, we get the bool definition
223 dnl from <stdbool.h>.
224 AC_DEFUN([CF_BOOL_SIZE],
226 AC_MSG_CHECKING([for size of bool])
227 AC_CACHE_VAL(cf_cv_type_of_bool,[
233 #if defined(__cplusplus)
235 #ifdef HAVE_GXX_BUILTIN_H
236 #include <g++/builtin.h>
237 #elif HAVE_GPP_BUILTIN_H
238 #include <gpp/builtin.h>
245 #if $cf_cv_header_stdbool_h
253 FILE *fp = fopen("cf_test.out", "w");
257 fputs("unsigned ", fp);
258 if (sizeof(x) == sizeof(int)) fputs("int", fp);
259 else if (sizeof(x) == sizeof(char)) fputs("char", fp);
260 else if (sizeof(x) == sizeof(short))fputs("short",fp);
261 else if (sizeof(x) == sizeof(long)) fputs("long", fp);
267 [cf_cv_type_of_bool=`cat cf_test.out`
268 if test -z "$cf_cv_type_of_bool"; then
269 cf_cv_type_of_bool=unknown
271 [cf_cv_type_of_bool=unknown],
272 [cf_cv_type_of_bool=unknown])
275 AC_MSG_RESULT($cf_cv_type_of_bool)
276 if test "$cf_cv_type_of_bool" = unknown ; then
277 case .$NCURSES_BOOL in #(vi
278 .auto|.) NCURSES_BOOL=unsigned;;
280 AC_MSG_WARN(Assuming $NCURSES_BOOL for type of bool)
281 cf_cv_type_of_bool=$NCURSES_BOOL
284 dnl ---------------------------------------------------------------------------
285 dnl CF_CFG_DEFAULTS version: 6 updated: 2003/07/12 15:15:19
287 dnl Determine the default configuration into which we'll install ncurses. This
288 dnl can be overridden by the user's command-line options. There's two items to
290 dnl 1. the prefix (e.g., /usr)
291 dnl 2. the header files (e.g., /usr/include/ncurses)
292 dnl We'll look for a previous installation of ncurses and use the same defaults.
294 dnl We don't use AC_PREFIX_DEFAULT, because it gets evaluated too soon, and
295 dnl we don't use AC_PREFIX_PROGRAM, because we cannot distinguish ncurses's
296 dnl programs from a vendor's.
297 AC_DEFUN([CF_CFG_DEFAULTS],
299 AC_MSG_CHECKING(for prefix)
300 if test "x$prefix" = "xNONE" ; then
301 case "$cf_cv_system_name" in
302 # non-vendor systems don't have a conflict
303 openbsd*|netbsd*|freebsd*|linux*|cygwin*|k*bsd*-gnu)
306 *) prefix=$ac_default_prefix
310 AC_MSG_RESULT($prefix)
312 if test "x$prefix" = "xNONE" ; then
313 AC_MSG_CHECKING(for default include-directory)
314 test -n "$verbose" && echo 1>&AC_FD_MSG
317 $includedir/ncurses \
319 $prefix/include/ncurses \
321 /usr/local/include/ncurses \
325 cf_dir=`eval echo $cf_symbol`
326 if test -f $cf_dir/curses.h ; then
327 if ( fgrep NCURSES_VERSION $cf_dir/curses.h 2>&1 >/dev/null ) ; then
328 includedir="$cf_symbol"
329 test -n "$verbose" && echo $ac_n " found " 1>&AC_FD_MSG
333 test -n "$verbose" && echo " tested $cf_dir" 1>&AC_FD_MSG
335 AC_MSG_RESULT($includedir)
338 dnl ---------------------------------------------------------------------------
339 dnl CF_CGETENT version: 3 updated: 2000/08/12 23:18:52
341 dnl Check if the terminal-capability database functions are available. If not,
342 dnl ncurses has a much-reduced version.
343 AC_DEFUN([CF_CGETENT],[
344 AC_MSG_CHECKING(for terminal-capability database functions)
345 AC_CACHE_VAL(cf_cv_cgetent,[
347 #include <stdlib.h>],[
350 char *db_array = temp;
351 cgetent(&buf, /* int *, */ &db_array, "vt100");
352 cgetcap(buf, "tc", '=');
353 cgetmatch(buf, "tc");
358 AC_MSG_RESULT($cf_cv_cgetent)
359 test "$cf_cv_cgetent" = yes && AC_DEFINE(HAVE_BSD_CGETENT)
361 dnl ---------------------------------------------------------------------------
362 dnl CF_CHECK_CACHE version: 9 updated: 2004/01/30 15:59:13
364 dnl Check if we're accidentally using a cache from a different machine.
365 dnl Derive the system name, as a check for reusing the autoconf cache.
367 dnl If we've packaged config.guess and config.sub, run that (since it does a
368 dnl better job than uname). Normally we'll use AC_CANONICAL_HOST, but allow
369 dnl an extra parameter that we may override, e.g., for AC_CANONICAL_SYSTEM
370 dnl which is useful in cross-compiles.
372 dnl Note: we would use $ac_config_sub, but that is one of the places where
373 dnl autoconf 2.5x broke compatibility with autoconf 2.13
374 AC_DEFUN([CF_CHECK_CACHE],
376 if test -f $srcdir/config.guess ; then
377 ifelse([$1],,[AC_CANONICAL_HOST],[$1])
378 system_name="$host_os"
380 system_name="`(uname -s -r) 2>/dev/null`"
381 if test -z "$system_name" ; then
382 system_name="`(hostname) 2>/dev/null`"
385 test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name")
386 AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"])
388 test -z "$system_name" && system_name="$cf_cv_system_name"
389 test -n "$cf_cv_system_name" && AC_MSG_RESULT(Configuring for $cf_cv_system_name)
391 if test ".$system_name" != ".$cf_cv_system_name" ; then
392 AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name))
393 AC_ERROR("Please remove config.cache and try again.")
396 dnl ---------------------------------------------------------------------------
397 dnl CF_CHECK_ERRNO version: 9 updated: 2001/12/30 18:03:23
399 dnl Check for data that is usually declared in <stdio.h> or <errno.h>, e.g.,
400 dnl the 'errno' variable. Define a DECL_xxx symbol if we must declare it
403 dnl $1 = the name to check
404 AC_DEFUN([CF_CHECK_ERRNO],
406 AC_CACHE_CHECK(if external $1 is declared, cf_cv_dcl_$1,[
412 #include <sys/types.h>
413 #include <errno.h> ],
414 [long x = (long) $1],
419 if test "$cf_cv_dcl_$1" = no ; then
420 CF_UPPER(cf_result,decl_$1)
421 AC_DEFINE_UNQUOTED($cf_result)
424 # It's possible (for near-UNIX clones) that the data doesn't exist
425 CF_CHECK_EXTERN_DATA($1,int)
427 dnl ---------------------------------------------------------------------------
428 dnl CF_CHECK_EXTERN_DATA version: 3 updated: 2001/12/30 18:03:23
429 dnl --------------------
430 dnl Check for existence of external data in the current set of libraries. If
431 dnl we can modify it, it's real enough.
432 dnl $1 = the name to check
434 AC_DEFUN([CF_CHECK_EXTERN_DATA],
436 AC_CACHE_CHECK(if external $1 exists, cf_cv_have_$1,[
446 if test "$cf_cv_have_$1" = yes ; then
447 CF_UPPER(cf_result,have_$1)
448 AC_DEFINE_UNQUOTED($cf_result)
452 dnl ---------------------------------------------------------------------------
453 dnl CF_CPP_PARAM_INIT version: 4 updated: 2001/04/07 22:31:18
454 dnl -----------------
455 dnl Check if the C++ compiler accepts duplicate parameter initialization. This
456 dnl is a late feature for the standard and is not in some recent compilers
458 AC_DEFUN([CF_CPP_PARAM_INIT],
460 if test -n "$CXX"; then
461 AC_CACHE_CHECK(if $CXX accepts parameter initialization,cf_cv_cpp_param_init,[
473 TEST::TEST(int x = 1) // some compilers do not like second initializer
479 [cf_cv_cpp_param_init=yes],
480 [cf_cv_cpp_param_init=no],
481 [cf_cv_cpp_param_init=unknown])
485 test "$cf_cv_cpp_param_init" = yes && AC_DEFINE(CPP_HAS_PARAM_INIT)
487 dnl ---------------------------------------------------------------------------
488 dnl CF_CPP_VSCAN_FUNC version: 5 updated: 2001/12/02 01:39:28
489 dnl -----------------
490 dnl Check if the g++ compiler supports vscan function (not a standard feature).
491 AC_DEFUN([CF_CPP_VSCAN_FUNC],
493 if test -n "$CXX"; then
497 AC_CHECK_HEADERS(strstream.h)
499 AC_CACHE_CHECK(if $CXX supports vscan function,cf_cv_cpp_vscan_func,[
500 for cf_vscan_func in strstream strstream_cast stdio
502 case $cf_vscan_func in #(vi
503 stdio) cf_vscan_defs=USE_STDIO_VSCAN ;; #(vi
504 strstream) cf_vscan_defs=USE_STRSTREAM_VSCAN ;;
505 strstream_cast) cf_vscan_defs=USE_STRSTREAM_VSCAN_CAST ;;
510 #define $cf_vscan_defs 1
511 #if defined(USE_STDIO_VSCAN)
512 #elif defined(HAVE_STRSTREAM_H) && defined(USE_STRSTREAM_VSCAN)
513 #include <strstream.h>
516 int scanw(const char* fmt, ...)
523 #if defined(USE_STDIO_VSCAN)
524 if (::vsscanf(buf, fmt, args) != -1)
526 #elif defined(USE_STRSTREAM_VSCAN)
527 strstreambuf ss(buf, sizeof(buf));
528 if (ss.vscan(fmt, args) != -1)
530 #elif defined(USE_STRSTREAM_VSCAN_CAST)
531 strstreambuf ss(buf, sizeof(buf));
532 if (ss.vscan(fmt, (_IO_va_list)args) != -1)
535 #error case $cf_vscan_func failed
540 ],[int tmp, foo = scanw("%d", &tmp)],
541 [cf_cv_cpp_vscan_func=$cf_vscan_func; break],
542 [cf_cv_cpp_vscan_func=no])
543 test "$cf_cv_cpp_vscan_func" != no && break
550 case $cf_cv_cpp_vscan_func in #(vi
552 AC_DEFINE(CPP_HAS_VSCAN_FUNC)
553 AC_DEFINE(USE_STDIO_VSCAN)
556 AC_DEFINE(CPP_HAS_VSCAN_FUNC)
557 AC_DEFINE(USE_STRSTREAM_VSCAN)
560 AC_DEFINE(CPP_HAS_VSCAN_FUNC)
561 AC_DEFINE(USE_STRSTREAM_VSCAN_CAST)
565 dnl ---------------------------------------------------------------------------
566 dnl CF_DIRNAME version: 4 updated: 2002/12/21 19:25:52
568 dnl "dirname" is not portable, so we fake it with a shell script.
569 AC_DEFUN([CF_DIRNAME],[$1=`echo $2 | sed -e 's%/[[^/]]*$%%'`])dnl
570 dnl ---------------------------------------------------------------------------
571 dnl CF_DIRS_TO_MAKE version: 3 updated: 2002/02/23 20:38:31
573 AC_DEFUN([CF_DIRS_TO_MAKE],
576 for cf_item in $cf_list_models
578 CF_OBJ_SUBDIR($cf_item,cf_subdir)
579 for cf_item2 in $DIRS_TO_MAKE
581 test $cf_item2 = $cf_subdir && break
583 test ".$cf_item2" != ".$cf_subdir" && DIRS_TO_MAKE="$DIRS_TO_MAKE $cf_subdir"
585 for cf_dir in $DIRS_TO_MAKE
587 test ! -d $cf_dir && mkdir $cf_dir
589 AC_SUBST(DIRS_TO_MAKE)
591 dnl ---------------------------------------------------------------------------
592 dnl CF_ERRNO version: 5 updated: 1997/11/30 12:44:39
594 dnl Check if 'errno' is declared in <errno.h>
597 CF_CHECK_ERRNO(errno)
599 dnl ---------------------------------------------------------------------------
600 dnl CF_ETIP_DEFINES version: 3 updated: 2003/03/22 19:13:43
602 dnl Test for conflicting definitions of exception in gcc 2.8.0, etc., between
603 dnl math.h and builtin.h, only for ncurses
604 AC_DEFUN([CF_ETIP_DEFINES],
606 AC_MSG_CHECKING(for special defines needed for etip.h)
607 cf_save_CXXFLAGS="$CXXFLAGS"
609 for cf_math in "" MATH_H
611 for cf_excp in "" MATH_EXCEPTION
613 CXXFLAGS="$cf_save_CXXFLAGS -I${srcdir}/c++ -I${srcdir}/menu -I${srcdir}/include"
614 test -n "$cf_math" && CXXFLAGS="$CXXFLAGS -DETIP_NEEDS_${cf_math}"
615 test -n "$cf_excp" && CXXFLAGS="$CXXFLAGS -DETIP_NEEDS_${cf_excp}"
619 test -n "$cf_math" && AC_DEFINE_UNQUOTED(ETIP_NEEDS_${cf_math})
620 test -n "$cf_excp" && AC_DEFINE_UNQUOTED(ETIP_NEEDS_${cf_excp})
621 cf_result="$cf_math $cf_excp"
626 AC_MSG_RESULT($cf_result)
627 CXXFLAGS="$cf_save_CXXFLAGS"
629 dnl ---------------------------------------------------------------------------
630 dnl CF_FUNC_MEMMOVE version: 5 updated: 2000/08/12 23:18:52
632 dnl Check for memmove, or a bcopy that can handle overlapping copy. If neither
633 dnl is found, add our own version of memmove to the list of objects.
634 AC_DEFUN([CF_FUNC_MEMMOVE],
636 AC_CHECK_FUNC(memmove,,[
637 AC_CHECK_FUNC(bcopy,[
638 AC_CACHE_CHECK(if bcopy does overlapping moves,cf_cv_good_bcopy,[
641 static char data[] = "abcdefghijklmnopqrstuwwxyz";
643 bcopy(data, temp, sizeof(data));
644 bcopy(temp+10, temp, 15);
645 bcopy(temp+5, temp+15, 10);
646 exit (strcmp(temp, "klmnopqrstuwwxypqrstuwwxyz"));
649 [cf_cv_good_bcopy=yes],
650 [cf_cv_good_bcopy=no],
651 [cf_cv_good_bcopy=unknown])
653 ],[cf_cv_good_bcopy=no])
654 if test "$cf_cv_good_bcopy" = yes ; then
655 AC_DEFINE(USE_OK_BCOPY)
657 AC_DEFINE(USE_MY_MEMMOVE)
660 dnl ---------------------------------------------------------------------------
661 dnl CF_FUNC_POLL version: 2 updated: 2000/02/06 01:38:04
663 dnl See if the poll function really works. Some platforms have poll(), but
664 dnl it does not work for terminals or files.
665 AC_DEFUN([CF_FUNC_POLL],[
666 AC_CACHE_CHECK(if poll really works,cf_cv_working_poll,[
672 #include <sys/poll.h>
679 myfds.events = POLLIN;
681 ret = poll(&myfds, 1, 100);
684 [cf_cv_working_poll=yes],
685 [cf_cv_working_poll=no],
686 [cf_cv_working_poll=unknown])])
687 test "$cf_cv_working_poll" = "yes" && AC_DEFINE(HAVE_WORKING_POLL)
689 dnl ---------------------------------------------------------------------------
690 dnl CF_FUNC_TERMIOS version: 2 updated: 2000/07/22 23:37:24
692 dnl Some old/broken variations define tcgetattr() only as a macro in
694 AC_DEFUN([CF_FUNC_TERMIOS],[
695 AC_REQUIRE([CF_STRUCT_TERMIOS])
696 AC_CACHE_CHECK(for tcgetattr, cf_cv_have_tcgetattr,[
698 #include <sys/types.h>
702 #ifdef HAVE_TERMIOS_H
704 #define TTY struct termios
708 #define TTY struct termio
713 tcgetattr(1, &foo);],
714 [cf_cv_have_tcgetattr=yes],
715 [cf_cv_have_tcgetattr=no])])
716 test "$cf_cv_have_tcgetattr" = yes && AC_DEFINE(HAVE_TCGETATTR)
718 dnl ---------------------------------------------------------------------------
719 dnl CF_FUNC_VSSCANF version: 3 updated: 2001/12/19 00:50:10
721 dnl Check for vsscanf() function, which is in c9x but generally not in earlier
722 dnl versions of C. It is in the GNU C library, and can often be simulated by
724 AC_DEFUN([CF_FUNC_VSSCANF],
726 AC_CACHE_CHECK(for vsscanf function or workaround,cf_cv_func_vsscanf,[
729 #include <stdio.h>],[
731 vsscanf("from", "%d", ap)],[cf_cv_func_vsscanf=vsscanf],[
734 #include <stdio.h>],[
738 strbuf._flag = _IOREAD;
739 strbuf._ptr = strbuf._base = (unsigned char *) str;
740 strbuf._cnt = strlen(str);
741 strbuf._file = _NFILE;
742 return (vfscanf(&strbuf, "%d", ap))],[cf_cv_func_vsscanf=vfscanf],[
745 #include <stdio.h>],[
749 strbuf._flag = _IOREAD;
750 strbuf._ptr = strbuf._base = (unsigned char *) str;
751 strbuf._cnt = strlen(str);
752 strbuf._file = _NFILE;
753 return (_doscan(&strbuf, "%d", ap))],[cf_cv_func_vsscanf=_doscan],[
754 cf_cv_func_vsscanf=no])])])])
756 case $cf_cv_func_vsscanf in #(vi
757 vsscanf) AC_DEFINE(HAVE_VSSCANF);; #(vi
758 vfscanf) AC_DEFINE(HAVE_VFSCANF);; #(vi
759 _doscan) AC_DEFINE(HAVE__DOSCAN);;
763 dnl ---------------------------------------------------------------------------
764 dnl CF_GCC_ATTRIBUTES version: 9 updated: 2002/12/21 19:25:52
765 dnl -----------------
766 dnl Test for availability of useful gcc __attribute__ directives to quiet
767 dnl compiler warnings. Though useful, not all are supported -- and contrary
768 dnl to documentation, unrecognized directives cause older compilers to barf.
769 AC_DEFUN([CF_GCC_ATTRIBUTES],
773 cat > conftest.i <<EOF
781 #define GCC_NORETURN /* nothing */
784 #define GCC_UNUSED /* nothing */
789 AC_CHECKING([for $CC __attribute__ directives])
790 cat > conftest.$ac_ext <<EOF
791 #line __oline__ "configure"
792 #include "confdefs.h"
793 #include "conftest.h"
794 #include "conftest.i"
796 #define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
798 #define GCC_PRINTFLIKE(fmt,var) /*nothing*/
801 #define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var)))
803 #define GCC_SCANFLIKE(fmt,var) /*nothing*/
805 extern void wow(char *,...) GCC_SCANFLIKE(1,2);
806 extern void oops(char *,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN;
807 extern void foo(void) GCC_NORETURN;
808 int main(int argc GCC_UNUSED, char *argv[[]] GCC_UNUSED) { return 0; }
810 for cf_attribute in scanf printf unused noreturn
812 CF_UPPER(CF_ATTRIBUTE,$cf_attribute)
813 cf_directive="__attribute__(($cf_attribute))"
814 echo "checking for $CC $cf_directive" 1>&AC_FD_CC
815 case $cf_attribute in
817 cat >conftest.h <<EOF
818 #define GCC_$CF_ATTRIBUTE 1
822 cat >conftest.h <<EOF
823 #define GCC_$CF_ATTRIBUTE $cf_directive
827 if AC_TRY_EVAL(ac_compile); then
828 test -n "$verbose" && AC_MSG_RESULT(... $cf_attribute)
829 cat conftest.h >>confdefs.h
833 fgrep define conftest.i >>confdefs.h
838 dnl ---------------------------------------------------------------------------
839 dnl CF_GCC_VERSION version: 3 updated: 2003/09/06 19:16:57
841 dnl Find version of gcc
842 AC_DEFUN([CF_GCC_VERSION],[
843 AC_REQUIRE([AC_PROG_CC])
845 if test "$GCC" = yes ; then
846 AC_MSG_CHECKING(version of $CC)
847 GCC_VERSION="`${CC} --version|sed -e '2,$d' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`"
848 test -z "$GCC_VERSION" && GCC_VERSION=unknown
849 AC_MSG_RESULT($GCC_VERSION)
852 dnl ---------------------------------------------------------------------------
853 dnl CF_GCC_WARNINGS version: 15 updated: 2003/07/05 18:42:30
855 dnl Check if the compiler supports useful warning options. There's a few that
856 dnl we don't use, simply because they're too noisy:
858 dnl -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x)
859 dnl -Wredundant-decls (system headers make this too noisy)
860 dnl -Wtraditional (combines too many unrelated messages, only a few useful)
861 dnl -Wwrite-strings (too noisy, but should review occasionally). This
862 dnl is enabled for ncurses using "--enable-const".
865 AC_DEFUN([CF_GCC_WARNINGS],
867 AC_REQUIRE([CF_GCC_VERSION])
870 cat > conftest.$ac_ext <<EOF
871 #line __oline__ "configure"
872 int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; }
874 AC_CHECKING([for $CC warning options])
875 cf_save_CFLAGS="$CFLAGS"
876 EXTRA_CFLAGS="-W -Wall"
878 test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings"
884 Wmissing-declarations \
885 Wmissing-prototypes \
890 Wundef $cf_warn_CONST
892 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
893 if AC_TRY_EVAL(ac_compile); then
894 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
897 CPPFLAGS="$CPPFLAGS -DXTSTRINGDEFINES"
902 CF_VERBOSE(feature is broken in gcc $GCC_VERSION)
907 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
911 CFLAGS="$cf_save_CFLAGS"
913 AC_SUBST(EXTRA_CFLAGS)
915 dnl ---------------------------------------------------------------------------
916 dnl CF_GNAT_TRY_RUN version: 2 updated: 1998/07/19 00:25:18
918 dnl Verify that a test program compiles and runs with GNAT
919 dnl $cf_ada_make is set to the program that compiles/links
920 AC_DEFUN([CF_GNAT_TRY_RUN],
923 cat >>conftest.ads <<CF_EOF
926 cat >>conftest.adb <<CF_EOF
929 if ( $cf_ada_make conftest 1>&AC_FD_CC 2>&1 ) ; then
930 if ( ./conftest 1>&AC_FD_CC 2>&1 ) ; then
940 dnl ---------------------------------------------------------------------------
941 dnl CF_GNAT_VERSION version: 11 updated: 2003/09/06 19:42:09
943 dnl Verify version of GNAT.
944 AC_DEFUN([CF_GNAT_VERSION],
946 AC_MSG_CHECKING(for gnat version)
947 cf_gnat_version=`${cf_ada_make-gnatmake} -v 2>&1 | grep '[[0-9]].[[0-9]][[0-9]]*' |\
948 sed -e '2,$d' -e 's/[[^0-9 \.]]//g' -e 's/^[[ ]]*//' -e 's/ .*//'`
949 AC_MSG_RESULT($cf_gnat_version)
951 case $cf_gnat_version in
952 3.1[[1-9]]*|3.[[2-9]]*|[[4-9]].*)
953 cf_cv_prog_gnat_correct=yes
955 *) echo Unsupported GNAT version $cf_gnat_version. Required is 3.11 or better. Disabling Ada95 binding.
956 cf_cv_prog_gnat_correct=no
959 case $cf_gnat_version in
960 3.[[1-9]]*|[[4-9]].*)
961 cf_compile_generics=generics
962 cf_generic_objects="\$(GENOBJS)"
964 *) cf_compile_generics=
969 dnl ---------------------------------------------------------------------------
970 dnl CF_GNU_SOURCE version: 3 updated: 2000/10/29 23:30:53
972 dnl Check if we must define _GNU_SOURCE to get a reasonable value for
973 dnl _XOPEN_SOURCE, upon which many POSIX definitions depend. This is a defect
974 dnl (or misfeature) of glibc2, which breaks portability of many applications,
975 dnl since it is interwoven with GNU extensions.
977 dnl Well, yes we could work around it...
978 AC_DEFUN([CF_GNU_SOURCE],
980 AC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[
981 AC_TRY_COMPILE([#include <sys/types.h>],[
982 #ifndef _XOPEN_SOURCE
985 [cf_cv_gnu_source=no],
987 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
988 AC_TRY_COMPILE([#include <sys/types.h>],[
992 [cf_cv_gnu_source=no],
993 [cf_cv_gnu_source=yes])
997 test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
999 dnl ---------------------------------------------------------------------------
1000 dnl CF_GPP_LIBRARY version: 8 updated: 2003/02/02 01:41:46
1002 dnl If we're trying to use g++, test if libg++ is installed (a rather common
1003 dnl problem :-). If we have the compiler but no library, we'll be able to
1004 dnl configure, but won't be able to build the c++ demo program.
1005 AC_DEFUN([CF_GPP_LIBRARY],
1007 cf_cxx_library=unknown
1008 case $cf_cv_system_name in #(vi
1016 if test "$GXX" = yes; then
1017 AC_MSG_CHECKING([for lib$cf_gpp_libname])
1019 LIBS="$LIBS -l$cf_gpp_libname"
1021 #include <$cf_gpp_libname/builtin.h>
1023 [two_arg_error_handler_t foo2 = lib_error_handler],
1025 CXXLIBS="$CXXLIBS -l$cf_gpp_libname"
1026 if test "$cf_gpp_libname" = cpp ; then
1027 AC_DEFINE(HAVE_GPP_BUILTIN_H)
1029 AC_DEFINE(HAVE_GXX_BUILTIN_H)
1032 #include <builtin.h>
1034 [two_arg_error_handler_t foo2 = lib_error_handler],
1036 CXXLIBS="$CXXLIBS -l$cf_gpp_libname"
1037 AC_DEFINE(HAVE_BUILTIN_H)],
1038 [cf_cxx_library=no])])
1040 AC_MSG_RESULT($cf_cxx_library)
1043 dnl ---------------------------------------------------------------------------
1044 dnl CF_GXX_VERSION version: 3 updated: 2003/09/06 19:16:21
1046 dnl Check for version of g++
1047 AC_DEFUN([CF_GXX_VERSION],[
1048 AC_REQUIRE([AC_PROG_CPP])
1050 if test "$GXX" = yes; then
1051 AC_MSG_CHECKING(version of g++)
1052 GXX_VERSION="`${CXX-g++} --version|sed -e '2,$d'`"
1053 AC_MSG_RESULT($GXX_VERSION)
1056 dnl ---------------------------------------------------------------------------
1057 dnl CF_HELP_MESSAGE version: 3 updated: 1998/01/14 10:56:23
1059 dnl Insert text into the help-message, for readability, from AC_ARG_WITH.
1060 AC_DEFUN([CF_HELP_MESSAGE],
1061 [AC_DIVERT_HELP([$1])dnl
1063 dnl ---------------------------------------------------------------------------
1064 dnl CF_INCLUDE_DIRS version: 4 updated: 2002/12/01 00:12:15
1066 dnl Construct the list of include-options according to whether we're building
1067 dnl in the source directory or using '--srcdir=DIR' option. If we're building
1068 dnl with gcc, don't append the includedir if it happens to be /usr/include,
1069 dnl since that usually breaks gcc's shadow-includes.
1070 AC_DEFUN([CF_INCLUDE_DIRS],
1072 CPPFLAGS="-I. -I../include $CPPFLAGS"
1073 if test "$srcdir" != "."; then
1074 CPPFLAGS="-I\$(srcdir)/../include $CPPFLAGS"
1076 if test "$GCC" != yes; then
1077 CPPFLAGS="$CPPFLAGS -I\$(includedir)"
1078 elif test "$includedir" != "/usr/include"; then
1079 if test "$includedir" = '${prefix}/include' ; then
1080 if test $prefix != /usr ; then
1081 CPPFLAGS="$CPPFLAGS -I\$(includedir)"
1084 CPPFLAGS="$CPPFLAGS -I\$(includedir)"
1089 dnl ---------------------------------------------------------------------------
1090 dnl CF_ISASCII version: 3 updated: 2000/08/12 23:18:52
1092 dnl Check if we have either a function or macro for 'isascii()'.
1093 AC_DEFUN([CF_ISASCII],
1095 AC_MSG_CHECKING(for isascii)
1096 AC_CACHE_VAL(cf_cv_have_isascii,[
1097 AC_TRY_LINK([#include <ctype.h>],[int x = isascii(' ')],
1098 [cf_cv_have_isascii=yes],
1099 [cf_cv_have_isascii=no])
1101 AC_MSG_RESULT($cf_cv_have_isascii)
1102 test "$cf_cv_have_isascii" = yes && AC_DEFINE(HAVE_ISASCII)
1104 dnl ---------------------------------------------------------------------------
1105 dnl CF_LIBUTF8 version: 2 updated: 2002/01/19 22:51:32
1107 dnl Check for libutf8
1108 AC_DEFUN([CF_LIBUTF8],
1110 AC_CACHE_CHECK(for putwc in libutf8,cf_cv_libutf8,[
1111 cf_save_LIBS="$LIBS"
1114 #include <libutf8.h>],[putwc(0,0);],
1115 [cf_cv_libutf8=yes],
1117 LIBS="$cf_save_LIBS"
1120 if test "$cf_cv_libutf8" = yes ; then
1121 AC_DEFINE(HAVE_LIBUTF8_H)
1125 dnl ---------------------------------------------------------------------------
1126 dnl CF_LIB_PREFIX version: 7 updated: 2001/01/12 01:23:48
1128 dnl Compute the library-prefix for the given host system
1129 dnl $1 = variable to set
1130 AC_DEFUN([CF_LIB_PREFIX],
1132 case $cf_cv_system_name in
1133 OS/2*) LIB_PREFIX='' ;;
1134 os2*) LIB_PREFIX='' ;;
1135 *) LIB_PREFIX='lib' ;;
1137 ifelse($1,,,[$1=$LIB_PREFIX])
1138 AC_SUBST(LIB_PREFIX)
1140 dnl ---------------------------------------------------------------------------
1141 dnl CF_LIB_RULES version: 30 updated: 2004/01/10 15:50:50
1143 dnl Append definitions and rules for the given models to the subdirectory
1144 dnl Makefiles, and the recursion rule for the top-level Makefile. If the
1145 dnl subdirectory is a library-source directory, modify the LIBRARIES list in
1146 dnl the corresponding makefile to list the models that we'll generate.
1148 dnl For shared libraries, make a list of symbolic links to construct when
1149 dnl generating each library. The convention used for Linux is the simplest
1152 dnl lib<name>.so.<major> ->
1153 dnl lib<name>.so.<maj>.<minor>
1154 AC_DEFUN([CF_LIB_RULES],
1156 CF_LIB_PREFIX(cf_prefix)
1157 AC_REQUIRE([CF_SUBST_NCURSES_VERSION])
1158 for cf_dir in $SRC_SUBDIRS
1160 if test -f $srcdir/$cf_dir/modules; then
1165 for cf_item in $CF_LIST_MODELS
1167 CF_LIB_SUFFIX($cf_item,cf_suffix)
1168 if test $cf_item = shared ; then
1169 if test "$cf_cv_do_symlinks" = yes ; then
1170 case "$cf_cv_shlib_version" in #(vi
1172 case "$cf_cv_system_name" in #(vi
1173 darwin*) cf_suffix='.$(REL_VERSION)'"$cf_suffix" ;; #(vi
1174 *) cf_suffix="$cf_suffix"'.$(REL_VERSION)' ;;
1178 case "$cf_cv_system_name" in #(vi
1179 darwin*) cf_suffix='.$(ABI_VERSION)'"$cf_suffix" ;; #(vi
1180 *) cf_suffix="$cf_suffix"'.$(ABI_VERSION)' ;;
1185 # cygwin needs import library, and has unique naming convention
1186 # use autodetected ${cf_prefix} for import lib and static lib, but
1187 # use 'cyg' prefix for shared lib.
1188 if test $cf_cv_shlib_version = cygdll ; then
1189 SHARED_LIB="../lib/cyg${cf_dir}\$(ABI_VERSION).dll"
1190 IMPORT_LIB="../lib/${cf_prefix}${cf_dir}.dll.a"
1191 LIBS_TO_MAKE="$LIBS_TO_MAKE \$(SHARED_LIB) \$(IMPORT_LIB)"
1195 LIBS_TO_MAKE="$LIBS_TO_MAKE ../lib/${cf_prefix}${cf_dir}${cf_suffix}"
1198 if test $cf_dir = ncurses ; then
1199 cf_subsets="$LIB_SUBSETS"
1200 cf_termlib=`echo "$cf_subsets" |sed -e 's/ .*$//'`
1201 if test "$cf_termlib" != "$cf_subsets" ; then
1202 cf_item=`echo $LIBS_TO_MAKE |sed -e s%$LIB_NAME%$TINFO_NAME%g`
1203 LIBS_TO_MAKE="$cf_item $LIBS_TO_MAKE"
1206 cf_subsets=`echo "$LIB_SUBSETS" | sed -e 's/^termlib.* //'`
1209 sed -e "s%@LIBS_TO_MAKE@%$LIBS_TO_MAKE%" \
1210 -e "s%@IMPORT_LIB@%$IMPORT_LIB%" \
1211 -e "s%@SHARED_LIB@%$SHARED_LIB%" \
1212 $cf_dir/Makefile >$cf_dir/Makefile.out
1213 mv $cf_dir/Makefile.out $cf_dir/Makefile
1215 $AWK -f $srcdir/mk-0th.awk \
1216 libname="${cf_dir}${LIB_SUFFIX}" subsets="$LIB_SUBSETS" \
1217 $srcdir/$cf_dir/modules >>$cf_dir/Makefile
1219 for cf_subset in $cf_subsets
1222 for cf_item in $CF_LIST_MODELS
1224 echo "Appending rules for ${cf_item} model (${cf_dir}: ${cf_subset})"
1225 CF_UPPER(CF_ITEM,$cf_item)
1226 CF_LIB_SUFFIX($cf_item,cf_suffix)
1227 CF_OBJ_SUBDIR($cf_item,cf_subdir)
1229 # These dependencies really are for development, not
1230 # builds, but they are useful in porting, too.
1231 cf_depend="../include/ncurses_cfg.h"
1232 if test "$srcdir" = "."; then
1235 cf_reldir="\$(srcdir)"
1238 if test -f $srcdir/$cf_dir/$cf_dir.priv.h; then
1239 cf_depend="$cf_depend $cf_reldir/$cf_dir.priv.h"
1240 elif test -f $srcdir/$cf_dir/curses.priv.h; then
1241 cf_depend="$cf_depend $cf_reldir/curses.priv.h"
1244 $AWK -f $srcdir/mk-1st.awk \
1246 traces=$LIB_TRACING \
1252 ShlibVer=$cf_cv_shlib_version \
1253 ShlibVerInfix=$cf_cv_shlib_version_infix \
1254 DoLinks=$cf_cv_do_symlinks \
1255 rmSoLocs=$cf_cv_rm_so_locs \
1256 ldconfig="$LDCONFIG" \
1257 overwrite=$WITH_OVERWRITE \
1258 depend="$cf_depend" \
1260 $srcdir/$cf_dir/modules >>$cf_dir/Makefile
1261 for cf_subdir2 in $cf_subdirs lib
1263 test $cf_subdir = $cf_subdir2 && break
1265 test "${cf_subset}.${cf_subdir2}" != "${cf_subset}.${cf_subdir}" && \
1266 $AWK -f $srcdir/mk-2nd.awk \
1268 traces=$LIB_TRACING \
1274 $srcdir/$cf_dir/modules >>$cf_dir/Makefile
1275 cf_subdirs="$cf_subdirs $cf_subdir"
1280 echo ' cd '$cf_dir' && $(MAKE) $(CF_MFLAGS) [$]@' >>Makefile
1283 for cf_dir in $SRC_SUBDIRS
1285 if test -f $cf_dir/Makefile ; then
1288 echo 'libs \' >> Makefile
1289 echo 'install.libs \' >> Makefile
1290 echo 'uninstall.libs ::' >> Makefile
1291 echo ' cd '$cf_dir' && $(MAKE) $(CF_MFLAGS) [$]@' >> Makefile
1296 if test -f $srcdir/$cf_dir/modules; then
1298 if test -f $srcdir/$cf_dir/headers; then
1299 cat >> Makefile <<CF_EOF
1301 uninstall.includes \\
1304 if test "$cf_dir" != "c++" ; then
1305 echo 'lint \' >> Makefile
1307 cat >> Makefile <<CF_EOF
1313 uninstall.$cf_dir ::
1314 cd $cf_dir && \$(MAKE) \$(CF_MFLAGS) \[$]@
1316 elif test -f $srcdir/$cf_dir/headers; then
1317 cat >> Makefile <<CF_EOF
1323 uninstall.includes ::
1324 cd $cf_dir && \$(MAKE) \$(CF_MFLAGS) \[$]@
1329 cat >> Makefile <<CF_EOF
1333 $MAKE_TERMINFO cd misc && \$(MAKE) \$(CF_MFLAGS) \[$]@
1337 cd man && \$(MAKE) \$(CF_MFLAGS) \[$]@
1340 rm -f config.cache config.log config.status Makefile include/ncurses_cfg.h
1341 rm -f headers.sh headers.sed
1342 rm -rf \$(DIRS_TO_MAKE)
1345 # Special case: tack's manpage lives in its own directory.
1346 if test -d tack ; then
1347 if test -f $srcdir/$tack.h; then
1348 cat >> Makefile <<CF_EOF
1352 cd tack && \$(MAKE) \$(CF_MFLAGS) \[$]@
1357 dnl If we're installing into a subdirectory of /usr/include, etc., we should
1358 dnl prepend the subdirectory's name to the "#include" paths. It won't hurt
1359 dnl anything, and will make it more standardized. It's awkward to decide this
1360 dnl at configuration because of quoting, so we'll simply make all headers
1361 dnl installed via a script that can do the right thing.
1363 rm -f headers.sed headers.sh
1365 dnl ( generating this script makes the makefiles a little tidier :-)
1366 echo creating headers.sh
1367 cat >headers.sh <<CF_EOF
1369 # This shell script is generated by the 'configure' script. It is invoked in a
1370 # subdirectory of the build tree. It generates a sed-script in the parent
1371 # directory that is used to adjust includes for header files that reside in a
1372 # subdirectory of /usr/include, etc.
1374 while test \[$]# != 3
1376 PRG="\$PRG \[$]1"; shift
1381 TMPSRC=\${TMPDIR-/tmp}/\`basename \$SRC\`\$\$
1382 TMPSED=\${TMPDIR-/tmp}/headers.sed\$\$
1383 echo installing \$SRC in \$DST
1385 if test $WITH_CURSES_H = yes; then
1386 cat >>headers.sh <<CF_EOF
1389 END=\`basename \$DST\`
1390 for i in \`cat \$REF/../*/headers |fgrep -v "#"\`
1392 NAME=\`basename \$i\`
1393 echo "s/<\$NAME>/<\$END\/\$NAME>/" >> \$TMPSED
1402 cat >>headers.sh <<CF_EOF
1405 END=\`basename \$DST\`
1406 for i in \`cat \$REF/../*/headers |fgrep -v "#"\`
1408 NAME=\`basename \$i\`
1409 if test "\$NAME" = "curses.h"
1411 echo "s/<curses.h>/<ncurses.h>/" >> \$TMPSED
1414 echo "s/<\$NAME>/<\$END\/\$NAME>/" >> \$TMPSED
1418 echo "s/<curses.h>/<ncurses.h>/" >> \$TMPSED
1423 cat >>headers.sh <<CF_EOF
1425 sed -f \$TMPSED \$SRC > \$TMPSRC
1426 NAME=\`basename \$SRC\`
1428 if test $WITH_CURSES_H != yes; then
1429 cat >>headers.sh <<CF_EOF
1430 test "\$NAME" = "curses.h" && NAME=ncurses.h
1433 cat >>headers.sh <<CF_EOF
1434 # Just in case someone gzip'd manpages, remove the conflicting copy.
1435 test -f \$DST/\$NAME.gz && rm -f \$DST/\$NAME.gz
1437 eval \$PRG \$TMPSRC \$DST/\$NAME
1438 rm -f \$TMPSRC \$TMPSED
1441 chmod 0755 headers.sh
1443 for cf_dir in $SRC_SUBDIRS
1445 if test -f $srcdir/$cf_dir/headers; then
1446 cat >>$cf_dir/Makefile <<CF_EOF
1447 \$(DESTDIR)\$(includedir) :
1448 sh \$(srcdir)/../mkinstalldirs \[$]@
1452 install.includes :: \$(AUTO_SRC) \$(DESTDIR)\$(includedir) \\
1455 for i in `cat $srcdir/$cf_dir/headers |fgrep -v "#"`
1457 test -n "$j" && echo " $j \\" >>$cf_dir/Makefile
1460 echo " $j" >>$cf_dir/Makefile
1461 for i in `cat $srcdir/$cf_dir/headers |fgrep -v "#"`
1463 echo " @ (cd \$(DESTDIR)\$(includedir) && rm -f `basename $i`) ; ../headers.sh \$(INSTALL_DATA) \$(DESTDIR)\$(includedir) \$(srcdir) $i" >>$cf_dir/Makefile
1464 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
1467 cat >>$cf_dir/Makefile <<CF_EOF
1471 uninstall.includes ::
1473 for i in `cat $srcdir/$cf_dir/headers |fgrep -v "#"`
1476 echo " -@ (cd \$(DESTDIR)\$(includedir) && rm -f $i)" >>$cf_dir/Makefile
1477 test $i = curses.h && echo " -@ (cd \$(DESTDIR)\$(includedir) && rm -f ncurses.h)" >>$cf_dir/Makefile
1481 if test -f $srcdir/$cf_dir/modules; then
1482 if test "$cf_dir" != "c++" ; then
1483 cat >>$cf_dir/Makefile <<"CF_EOF"
1484 depend : $(AUTO_SRC)
1485 makedepend -- $(CPPFLAGS) -- $(C_SRC)
1487 # DO NOT DELETE THIS LINE -- make depend depends on it.
1494 dnl ---------------------------------------------------------------------------
1495 dnl CF_LIB_SUFFIX version: 13 updated: 2003/11/01 16:09:07
1497 dnl Compute the library file-suffix from the given model name
1499 dnl $2 = variable to set
1500 dnl The variable $LIB_SUFFIX, if set, prepends the variable to set.
1501 AC_DEFUN([CF_LIB_SUFFIX],
1503 AC_REQUIRE([CF_SUBST_NCURSES_VERSION])
1505 libtool) $2='.la' ;;
1508 profile) $2='_p.a' ;;
1510 case $cf_cv_system_name in
1511 cygwin*) $2='.dll' ;;
1512 darwin*) $2='.dylib' ;;
1522 test -n "$LIB_SUFFIX" && $2="${LIB_SUFFIX}[$]{$2}"
1524 dnl ---------------------------------------------------------------------------
1525 dnl CF_LIB_TYPE version: 4 updated: 2000/10/20 22:57:49
1527 dnl Compute the string to append to -library from the given model name
1529 dnl $2 = variable to set
1530 dnl The variable $LIB_SUFFIX, if set, prepends the variable to set.
1531 AC_DEFUN([CF_LIB_TYPE],
1540 test -n "$LIB_SUFFIX" && $2="${LIB_SUFFIX}[$]{$2}"
1542 dnl ---------------------------------------------------------------------------
1543 dnl CF_LINK_DATAONLY version: 6 updated: 2003/02/02 01:41:46
1544 dnl ----------------
1545 dnl Some systems have a non-ANSI linker that doesn't pull in modules that have
1546 dnl only data (i.e., no functions), for example NeXT. On those systems we'll
1547 dnl have to provide wrappers for global tables to ensure they're linked
1549 AC_DEFUN([CF_LINK_DATAONLY],
1551 AC_MSG_CHECKING([if data-only library module links])
1552 AC_CACHE_VAL(cf_cv_link_dataonly,[
1554 cat >conftest.$ac_ext <<EOF
1555 #line __oline__ "configure"
1556 int testdata[[3]] = { 123, 456, 789 };
1558 if AC_TRY_EVAL(ac_compile) ; then
1559 mv conftest.o data.o && \
1560 ( $AR $AR_OPTS conftest.a data.o ) 2>&AC_FD_CC 1>/dev/null
1562 rm -f conftest.$ac_ext data.o
1563 cat >conftest.$ac_ext <<EOF
1564 #line __oline__ "configure"
1568 exit(1); /* I'm told this linker is broken */
1570 extern int testdata[[3]];
1571 return testdata[[0]] == 123
1572 && testdata[[1]] == 456
1573 && testdata[[2]] == 789;
1577 if AC_TRY_EVAL(ac_compile); then
1578 mv conftest.o func.o && \
1579 ( $AR $AR_OPTS conftest.a func.o ) 2>&AC_FD_CC 1>/dev/null
1581 rm -f conftest.$ac_ext func.o
1582 ( eval $RANLIB conftest.a ) 2>&AC_FD_CC >/dev/null
1584 LIBS="conftest.a $LIBS"
1588 extern int testfunc();
1592 [cf_cv_link_dataonly=yes],
1593 [cf_cv_link_dataonly=no],
1594 [cf_cv_link_dataonly=unknown])
1597 AC_MSG_RESULT($cf_cv_link_dataonly)
1599 if test "$cf_cv_link_dataonly" = no ; then
1600 AC_DEFINE(BROKEN_LINKER)
1605 dnl ---------------------------------------------------------------------------
1606 dnl CF_LINK_FUNCS version: 5 updated: 2003/02/02 01:41:46
1608 dnl Most Unix systems have both link and symlink, a few don't have symlink.
1609 dnl A few non-Unix systems implement symlink, but not link.
1610 dnl A few non-systems implement neither (or have nonfunctional versions).
1611 AC_DEFUN([CF_LINK_FUNCS],
1617 if test "$cross_compiling" = yes ; then
1622 AC_CACHE_CHECK(if link/symlink functions work,cf_cv_link_funcs,[
1624 for cf_func in link symlink ; do
1626 #include <sys/types.h>
1627 #include <sys/stat.h>
1628 #ifdef HAVE_UNISTD_H
1634 char *src = "config.log";
1635 char *dst = "conftest.chk";
1640 fail = ($cf_func("config.log", "conftest.chk") < 0)
1641 || (stat(dst, &dst_sb) < 0)
1642 || (dst_sb.st_mtime != src_sb.st_mtime);
1651 cf_cv_link_funcs="$cf_cv_link_funcs $cf_func"
1652 eval 'ac_cv_func_'$cf_func'=yes'],[
1653 eval 'ac_cv_func_'$cf_func'=no'],[
1654 eval 'ac_cv_func_'$cf_func'=error'])
1656 test -z "$cf_cv_link_funcs" && cf_cv_link_funcs=no
1658 test "$ac_cv_func_link" = yes && AC_DEFINE(HAVE_LINK)
1659 test "$ac_cv_func_symlink" = yes && AC_DEFINE(HAVE_SYMLINK)
1662 dnl ---------------------------------------------------------------------------
1663 dnl CF_MAKEFLAGS version: 9 updated: 2001/12/30 18:17:27
1665 dnl Some 'make' programs support $(MAKEFLAGS), some $(MFLAGS), to pass 'make'
1666 dnl options to lower-levels. It's very useful for "make -n" -- if we have it.
1667 dnl (GNU 'make' does both, something POSIX 'make', which happens to make the
1668 dnl $(MAKEFLAGS) variable incompatible because it adds the assignments :-)
1669 AC_DEFUN([CF_MAKEFLAGS],
1671 AC_CACHE_CHECK(for makeflags variable, cf_cv_makeflags,[
1673 for cf_option in '-$(MAKEFLAGS)' '$(MFLAGS)'
1675 cat >cf_makeflags.tmp <<CF_EOF
1678 @ echo '.$cf_option'
1680 cf_result=`${MAKE-make} -k -f cf_makeflags.tmp 2>/dev/null`
1681 case "$cf_result" in
1683 cf_result=`${MAKE-make} -k -f cf_makeflags.tmp CC=cc 2>/dev/null`
1684 case "$cf_result" in
1685 .*CC=*) cf_cv_makeflags=
1687 *) cf_cv_makeflags=$cf_option
1692 *) echo no match "$cf_result"
1696 rm -f cf_makeflags.tmp
1699 AC_SUBST(cf_cv_makeflags)
1701 dnl ---------------------------------------------------------------------------
1702 dnl CF_MAKE_TAGS version: 2 updated: 2000/10/04 09:18:40
1704 dnl Generate tags/TAGS targets for makefiles. Do not generate TAGS if we have
1705 dnl a monocase filesystem.
1706 AC_DEFUN([CF_MAKE_TAGS],[
1707 AC_REQUIRE([CF_MIXEDCASE_FILENAMES])
1708 AC_CHECK_PROG(MAKE_LOWER_TAGS, ctags, yes, no)
1710 if test "$cf_cv_mixedcase" = yes ; then
1711 AC_CHECK_PROG(MAKE_UPPER_TAGS, etags, yes, no)
1716 if test "$MAKE_UPPER_TAGS" = yes ; then
1721 AC_SUBST(MAKE_UPPER_TAGS)
1723 if test "$MAKE_LOWER_TAGS" = yes ; then
1728 AC_SUBST(MAKE_LOWER_TAGS)
1730 dnl ---------------------------------------------------------------------------
1731 dnl CF_MANPAGE_FORMAT version: 7 updated: 2003/12/20 19:30:34
1732 dnl -----------------
1733 dnl Option to allow user to override automatic configuration of manpage format.
1734 dnl There are several special cases:
1736 dnl gzip - man checks for, can display gzip'd files
1737 dnl compress - man checks for, can display compressed files
1738 dnl BSDI - files in the cat-directories are suffixed ".0"
1739 dnl formatted - installer should format (put files in cat-directory)
1740 dnl catonly - installer should only format, e.g., for a turnkey system.
1742 dnl There are other configurations which this macro does not test, e.g., HPUX's
1743 dnl compressed manpages (but uncompressed manpages are fine, and HPUX's naming
1744 dnl convention would not match our use).
1745 AC_DEFUN([CF_MANPAGE_FORMAT],
1747 AC_REQUIRE([CF_PATHSEP])
1748 AC_MSG_CHECKING(format of man-pages)
1750 AC_ARG_WITH(manpage-format,
1751 [ --with-manpage-format specify manpage-format: gzip/compress/BSDI/normal and
1752 optionally formatted/catonly, e.g., gzip,formatted],
1753 [MANPAGE_FORMAT=$withval],
1754 [MANPAGE_FORMAT=unknown])
1756 test -z "$MANPAGE_FORMAT" && MANPAGE_FORMAT=unknown
1757 MANPAGE_FORMAT=`echo "$MANPAGE_FORMAT" | sed -e 's/,/ /g'`
1761 case $MANPAGE_FORMAT in
1763 if test -z "$MANPATH" ; then
1764 MANPATH="/usr/man:/usr/share/man"
1767 # look for the 'date' man-page (it's most likely to be installed!)
1773 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATHSEP}"
1774 for cf_dir in $MANPATH; do
1775 test -z "$cf_dir" && cf_dir=/usr/man
1776 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
1778 cf_test=`echo $cf_name | sed -e 's/*//'`
1779 if test "x$cf_test" = "x$cf_name" ; then
1782 *.gz) MANPAGE_FORMAT="$MANPAGE_FORMAT gzip";;
1783 *.Z) MANPAGE_FORMAT="$MANPAGE_FORMAT compress";;
1784 *.0) MANPAGE_FORMAT="$MANPAGE_FORMAT BSDI";;
1785 *) MANPAGE_FORMAT="$MANPAGE_FORMAT normal";;
1799 # if we found a match in either man* or cat*, stop looking
1800 if test -n "$MANPAGE_FORMAT" ; then
1802 test "$cf_preform" = yes && MANPAGE_FORMAT="$MANPAGE_FORMAT formatted"
1803 test "$cf_catonly" = yes && MANPAGE_FORMAT="$MANPAGE_FORMAT catonly"
1809 test $cf_found=yes && break
1812 # only check the first directory in $MANPATH where we find manpages
1813 if test -n "$MANPAGE_FORMAT" ; then
1817 # if we did not find the example, just assume it is normal
1818 test -z "$MANPAGE_FORMAT" && MANPAGE_FORMAT=normal
1822 for cf_option in $MANPAGE_FORMAT; do
1823 case $cf_option in #(vi
1824 gzip|compress|BSDI|normal|formatted|catonly)
1827 cf_unknown="$cf_unknown $cf_option"
1834 AC_MSG_RESULT($MANPAGE_FORMAT)
1835 if test -n "$cf_unknown" ; then
1836 AC_MSG_WARN(Unexpected manpage-format $cf_unknown)
1839 dnl ---------------------------------------------------------------------------
1840 dnl CF_MANPAGE_RENAMES version: 6 updated: 2002/01/19 22:51:32
1841 dnl ------------------
1842 dnl The Debian people have their own naming convention for manpages. This
1843 dnl option lets us override the name of the file containing renaming, or
1844 dnl disable it altogether.
1845 AC_DEFUN([CF_MANPAGE_RENAMES],
1847 AC_MSG_CHECKING(for manpage renaming)
1849 AC_ARG_WITH(manpage-renames,
1850 [ --with-manpage-renames specify manpage-renaming],
1851 [MANPAGE_RENAMES=$withval],
1852 [MANPAGE_RENAMES=yes])
1854 case ".$MANPAGE_RENAMES" in #(vi
1858 # Debian 'man' program?
1859 if test -f /etc/debian_version ; then
1860 MANPAGE_RENAMES=`cd $srcdir && pwd`/man/man_db.renames
1867 if test "$MANPAGE_RENAMES" != no ; then
1868 if test -f $srcdir/man/$MANPAGE_RENAMES ; then
1869 MANPAGE_RENAMES=`cd $srcdir/man && pwd`/$MANPAGE_RENAMES
1870 elif test ! -f $MANPAGE_RENAMES ; then
1871 AC_MSG_ERROR(not a filename: $MANPAGE_RENAMES)
1874 test ! -d man && mkdir man
1876 # Construct a sed-script to perform renaming within man-pages
1877 if test -n "$MANPAGE_RENAMES" ; then
1878 test ! -d man && mkdir man
1879 sh $srcdir/man/make_sed.sh $MANPAGE_RENAMES >man/edit_man.sed
1883 AC_MSG_RESULT($MANPAGE_RENAMES)
1884 AC_SUBST(MANPAGE_RENAMES)
1886 dnl ---------------------------------------------------------------------------
1887 dnl CF_MANPAGE_SYMLINKS version: 4 updated: 2003/12/13 18:01:58
1888 dnl -------------------
1889 dnl Some people expect each tool to make all aliases for manpages in the
1890 dnl man-directory. This accommodates the older, less-capable implementations
1891 dnl of 'man', and is optional.
1892 AC_DEFUN([CF_MANPAGE_SYMLINKS],
1894 AC_MSG_CHECKING(if manpage aliases will be installed)
1896 AC_ARG_WITH(manpage-aliases,
1897 [ --with-manpage-aliases specify manpage-aliases using .so],
1898 [MANPAGE_ALIASES=$withval],
1899 [MANPAGE_ALIASES=yes])
1901 AC_MSG_RESULT($MANPAGE_ALIASES)
1903 if test "$LN_S" = "ln -s"; then
1910 if test "$MANPAGE_ALIASES" = yes ; then
1911 AC_MSG_CHECKING(if manpage symlinks should be used)
1913 AC_ARG_WITH(manpage-symlinks,
1914 [ --with-manpage-symlinks specify manpage-aliases using symlinks],
1915 [MANPAGE_SYMLINKS=$withval],
1916 [MANPAGE_SYMLINKS=$cf_use_symlinks])
1918 if test "$$cf_use_symlinks" = no; then
1919 if test "$MANPAGE_SYMLINKS" = yes ; then
1920 AC_MSG_WARN(cannot make symlinks, will use .so files)
1925 AC_MSG_RESULT($MANPAGE_SYMLINKS)
1929 dnl ---------------------------------------------------------------------------
1930 dnl CF_MANPAGE_TBL version: 3 updated: 2002/01/19 22:51:32
1932 dnl This option causes manpages to be run through tbl(1) to generate tables
1934 AC_DEFUN([CF_MANPAGE_TBL],
1936 AC_MSG_CHECKING(for manpage tbl)
1938 AC_ARG_WITH(manpage-tbl,
1939 [ --with-manpage-tbl specify manpage processing with tbl],
1940 [MANPAGE_TBL=$withval],
1943 AC_MSG_RESULT($MANPAGE_TBL)
1945 dnl ---------------------------------------------------------------------------
1946 dnl CF_MAN_PAGES version: 27 updated: 2003/12/20 20:39:45
1948 dnl Try to determine if the man-pages on the system are compressed, and if
1949 dnl so, what format is used. Use this information to construct a script that
1950 dnl will install man-pages.
1951 AC_DEFUN([CF_MAN_PAGES],
1953 CF_HELP_MESSAGE(Options to Specify How Manpages are Installed:)
1959 if test "$prefix" = "NONE" ; then
1960 cf_prefix="$ac_default_prefix"
1965 case "$MANPAGE_FORMAT" in # (vi
1980 test ! -d man && mkdir man
1984 case "$MANPAGE_FORMAT" in #(vi
1987 cf_compress=compress
1995 cf_edit_man=man/edit_man.sh
1997 cat >$cf_edit_man <<CF_EOF
1999 # this script is generated by the configure-script CF_MAN_PAGES macro.
2002 NCURSES_OSPEED="$NCURSES_OSPEED"
2003 TERMINFO="$TERMINFO"
2004 MKDIRS="sh `cd $srcdir && pwd`/mkinstalldirs"
2006 INSTALL_DATA="$INSTALL_DATA"
2007 transform="$program_transform_name"
2009 TMP=\${TMPDIR-/tmp}/man\$\$
2010 trap "rm -f \$TMP" 0 1 2 5 15
2024 if test "\$form" = normal ; then
2025 if test "$cf_format" = yes ; then
2026 if test "$cf_inboth" = no ; then
2027 sh \[$]0 format \$verb \$mandir \$srcdir \[$]*
2031 cf_subdir=\$mandir/man
2032 cf_tables=$MANPAGE_TBL
2034 cf_subdir=\$mandir/cat
2038 # process the list of source-files
2041 *.orig|*.rej) ;; #(vi
2043 section=\`expr "\$i" : '.*\\.\\([[0-9]]\\)[[xm]]*'\`;
2044 if test \$verb = installing ; then
2045 if test ! -d \$cf_subdir\${section} ; then
2046 \$MKDIRS \$cf_subdir\$section
2050 source=\`basename \$i\`
2052 test ! -f \$inalias && inalias="\$srcdir/\$inalias"
2053 if test ! -f \$inalias ; then
2054 echo .. skipped \$source
2059 if test "$MANPAGE_ALIASES" != no ; then
2060 cat >>$cf_edit_man <<CF_EOF
2061 aliases=\`sed -f \$srcdir/manlinks.sed \$inalias | sort -u\`
2065 if test "$MANPAGE_RENAMES" = no ; then
2066 cat >>$cf_edit_man <<CF_EOF
2067 # perform program transformations for section 1 man pages
2068 if test \$section = 1 ; then
2069 target=\$cf_subdir\${section}/\`echo \$source|sed "\${transform}"\`
2071 target=\$cf_subdir\${section}/\$source
2075 cat >>$cf_edit_man <<CF_EOF
2076 target=\`grep "^\$source" $MANPAGE_RENAMES | $AWK '{print \[$]2}'\`
2077 if test -z "\$target" ; then
2078 echo '? missing rename for '\$source
2081 target="\$cf_subdir\${section}/\${target}"
2085 # replace variables in man page
2089 cat >>$cf_edit_man <<CF_EOF
2090 prog_$cf_name=\`echo $cf_name|sed "\${transform}"\`
2094 cat >>$cf_edit_man <<CF_EOF
2095 sed -e "s,@DATADIR@,\$datadir," \\
2096 -e "s,@TERMINFO@,\$TERMINFO," \\
2097 -e "s,@NCURSES_OSPEED@,\$NCURSES_OSPEED," \\
2103 cf_NAME=`echo "$cf_name" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
2104 cat >>$cf_edit_man <<CF_EOF
2105 -e "s,@$cf_NAME@,\$prog_$cf_name," \\
2110 if test -f $MANPAGE_RENAMES ; then
2111 cat >>$cf_edit_man <<CF_EOF
2112 < \$i | sed -f $srcdir/edit_man.sed >\$TMP
2115 cat >>$cf_edit_man <<CF_EOF
2120 cat >>$cf_edit_man <<CF_EOF
2121 if test \$cf_tables = yes ; then
2122 tbl \$TMP >\$TMP.out
2127 if test $with_curses_h != yes ; then
2128 cat >>$cf_edit_man <<CF_EOF
2129 sed -e "/\#[ ]*include/s,curses.h,ncurses.h," < \$TMP >\$TMP.out
2134 cat >>$cf_edit_man <<CF_EOF
2135 if test \$form = format ; then
2136 nroff -man \$TMP >\$TMP.out
2141 if test -n "$cf_compress" ; then
2142 cat >>$cf_edit_man <<CF_EOF
2143 if test \$verb = installing ; then
2144 if ( $cf_compress -f \$TMP )
2146 mv \$TMP.$cf_so_strip \$TMP
2149 target="\$target.$cf_so_strip"
2153 case "$MANPAGE_FORMAT" in #(vi
2155 cat >>$cf_edit_man <<CF_EOF
2156 if test \$form = format ; then
2157 # BSDI installs only .0 suffixes in the cat directories
2158 target="\`echo \$target|sed -e 's/\.[[1-9]]\+[[a-z]]*/.0/'\`"
2164 cat >>$cf_edit_man <<CF_EOF
2165 suffix=\`basename \$target | sed -e 's%^[[^.]]*%%'\`
2166 if test \$verb = installing ; then
2167 echo \$verb \$target
2168 \$INSTALL_DATA \$TMP \$target
2169 test -n "\$aliases" && (
2170 cd \$cf_subdir\${section} && (
2171 source=\`echo \$target |sed -e 's%^.*/\([[^/]][[^/]]*/[[^/]][[^/]]*$\)%\1%'\`
2172 test -n "$cf_so_strip" && source=\`echo \$source |sed -e 's%\.$cf_so_strip\$%%'\`
2173 target=\`basename \$target\`
2174 for cf_alias in \$aliases
2176 if test \$section = 1 ; then
2177 cf_alias=\`echo \$cf_alias|sed "\${transform}"\`
2180 if test "$MANPAGE_SYMLINKS" = yes ; then
2181 if test -f \$cf_alias\${suffix} ; then
2182 if ( cmp -s \$target \$cf_alias\${suffix} )
2187 echo .. \$verb alias \$cf_alias\${suffix}
2188 rm -f \$cf_alias\${suffix}
2189 $LN_S \$target \$cf_alias\${suffix}
2190 elif test "\$target" != "\$cf_alias\${suffix}" ; then
2191 echo ".so \$source" >\$TMP
2193 if test -n "$cf_compress" ; then
2194 cat >>$cf_edit_man <<CF_EOF
2195 if test -n "$cf_so_strip" ; then
2196 $cf_compress -f \$TMP
2197 mv \$TMP.$cf_so_strip \$TMP
2201 cat >>$cf_edit_man <<CF_EOF
2202 echo .. \$verb alias \$cf_alias\${suffix}
2203 rm -f \$cf_alias\${suffix}
2204 \$INSTALL_DATA \$TMP \$cf_alias\${suffix}
2209 elif test \$verb = removing ; then
2210 echo \$verb \$target
2212 test -n "\$aliases" && (
2213 cd \$cf_subdir\${section} && (
2214 for cf_alias in \$aliases
2216 if test \$section = 1 ; then
2217 cf_alias=\`echo \$cf_alias|sed "\${transform}"\`
2220 echo .. \$verb alias \$cf_alias\${suffix}
2221 rm -f \$cf_alias\${suffix}
2233 if test $cf_inboth = yes ; then
2234 if test \$form != format ; then
2235 sh \[$]0 format \$verb \$mandir \$srcdir \[$]*
2241 chmod 755 $cf_edit_man
2244 dnl ---------------------------------------------------------------------------
2245 dnl CF_MATH_LIB version: 5 updated: 2000/05/28 01:39:10
2247 dnl Checks for libraries. At least one UNIX system, Apple Macintosh
2248 dnl Rhapsody 5.5, does not have -lm. We cannot use the simpler
2249 dnl AC_CHECK_LIB(m,sin), because that fails for C++.
2250 AC_DEFUN([CF_MATH_LIB],
2252 AC_CACHE_CHECK(if -lm needed for math functions,
2258 [double x = rand(); printf("result = %g\n", ]ifelse($2,,sin(x),$2)[)],
2259 [cf_cv_need_libm=no],
2260 [cf_cv_need_libm=yes])])
2261 if test "$cf_cv_need_libm" = yes
2268 dnl ---------------------------------------------------------------------------
2269 dnl CF_MIXEDCASE_FILENAMES version: 3 updated: 2003/09/20 17:07:55
2270 dnl ----------------------
2271 dnl Check if the file-system supports mixed-case filenames. If we're able to
2272 dnl create a lowercase name and see it as uppercase, it doesn't support that.
2273 AC_DEFUN([CF_MIXEDCASE_FILENAMES],
2275 AC_CACHE_CHECK(if filesystem supports mixed-case filenames,cf_cv_mixedcase,[
2276 if test "$cross_compiling" = yes ; then
2277 case $target_alias in #(vi
2278 *-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-mingw32*|*-uwin*) #(vi
2286 rm -f conftest CONFTEST
2288 if test -f CONFTEST ; then
2293 rm -f conftest CONFTEST
2296 test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES)
2298 dnl ---------------------------------------------------------------------------
2299 dnl CF_MKSTEMP version: 3 updated: 2001/11/08 20:59:59
2301 dnl Check for a working mkstemp. This creates two files, checks that they are
2302 dnl successfully created and distinct (AmigaOS apparently fails on the last).
2303 AC_DEFUN([CF_MKSTEMP],[
2304 AC_CACHE_CHECK(for working mkstemp, cf_cv_func_mkstemp,[
2307 #include <sys/types.h>
2311 #include <sys/stat.h>
2314 char *tmpl = "conftestXXXXXX";
2322 for (n = 0; n < 2; ++n) {
2323 strcpy(name[n], tmpl);
2324 if ((fd = mkstemp(name[n])) >= 0) {
2325 if (!strcmp(name[n], tmpl)
2326 || stat(name[n], &sb) != 0
2327 || (sb.st_mode & S_IFMT) != S_IFREG
2328 || (sb.st_mode & 077) != 0) {
2335 && !strcmp(name[0], name[1]))
2339 ],[cf_cv_func_mkstemp=yes
2340 ],[cf_cv_func_mkstemp=no
2341 ],[AC_CHECK_FUNC(mkstemp)
2344 if test "$cf_cv_func_mkstemp" = yes ; then
2345 AC_DEFINE(HAVE_MKSTEMP)
2348 dnl ---------------------------------------------------------------------------
2349 dnl CF_NUMBER_SYNTAX version: 1 updated: 2003/09/20 18:12:49
2350 dnl ----------------
2351 dnl Check if the given variable is a number. If not, report an error.
2352 dnl $1 is the variable
2353 dnl $2 is the message
2354 AC_DEFUN([CF_NUMBER_SYNTAX],[
2355 if test -n "$1" ; then
2360 AC_MSG_ERROR($2 is not a number: $1)
2364 AC_MSG_ERROR($2 value is empty)
2367 dnl ---------------------------------------------------------------------------
2368 dnl CF_OBJ_SUBDIR version: 4 updated: 2002/02/23 20:38:31
2370 dnl Compute the object-directory name from the given model name
2371 AC_DEFUN([CF_OBJ_SUBDIR],
2374 libtool) $2='obj_lo' ;;
2375 normal) $2='objects' ;;
2376 debug) $2='obj_g' ;;
2377 profile) $2='obj_p' ;;
2379 case $cf_cv_system_name in #(vi
2387 dnl ---------------------------------------------------------------------------
2388 dnl CF_PATHSEP version: 3 updated: 2001/01/12 01:23:53
2390 dnl Provide a value for the $PATH and similar separator
2391 AC_DEFUN([CF_PATHSEP],
2393 case $cf_cv_system_name in
2394 os2*) PATHSEP=';' ;;
2397 ifelse($1,,,[$1=$PATHSEP])
2400 dnl ---------------------------------------------------------------------------
2401 dnl CF_PATH_SYNTAX version: 9 updated: 2002/09/17 23:03:38
2403 dnl Check the argument to see that it looks like a pathname. Rewrite it if it
2404 dnl begins with one of the prefix/exec_prefix variables, and then again if the
2405 dnl result begins with 'NONE'. This is necessary to work around autoconf's
2406 dnl delayed evaluation of those symbols.
2407 AC_DEFUN([CF_PATH_SYNTAX],[
2408 case ".[$]$1" in #(vi
2409 .\[$]\(*\)*|.\'*\'*) #(vi
2413 .[[a-zA-Z]]:[[\\/]]*) #(vi OS/2 EMX
2415 .\[$]{*prefix}*) #(vi
2417 case ".[$]$1" in #(vi
2419 $1=`echo [$]$1 | sed -e s%NONE%$ac_default_prefix%`
2424 $1=`echo [$]$1 | sed -e s%NONE%$ac_default_prefix%`
2427 ifelse($2,,[AC_ERROR([expected a pathname, not \"[$]$1\"])],$2)
2431 dnl ---------------------------------------------------------------------------
2432 dnl CF_PREDEFINE version: 1 updated: 2003/07/26 17:53:56
2434 dnl Add definitions to CPPFLAGS to ensure they're predefined for all compiles.
2436 dnl $1 = symbol to test
2437 dnl $2 = value (if any) to use for a predefinition
2438 AC_DEFUN([CF_PREDEFINE],
2440 AC_MSG_CHECKING(if we must define $1)
2441 AC_TRY_COMPILE([#include <sys/types.h>
2445 #endif],[cf_result=no],[cf_result=yes])
2446 AC_MSG_RESULT($cf_result)
2448 if test "$cf_result" = yes ; then
2449 CPPFLAGS="$CPPFLAGS ifelse($2,,-D$1,[-D$1=$2])"
2450 elif test "x$2" != "x" ; then
2451 AC_MSG_CHECKING(checking for compatible value versus $2)
2452 AC_TRY_COMPILE([#include <sys/types.h>
2456 #endif],[cf_result=yes],[cf_result=no])
2457 AC_MSG_RESULT($cf_result)
2458 if test "$cf_result" = no ; then
2459 # perhaps we can override it - try...
2460 CPPFLAGS="$CPPFLAGS -D$1=$2"
2464 dnl ---------------------------------------------------------------------------
2465 dnl CF_PROG_EXT version: 10 updated: 2004/01/03 19:28:18
2467 dnl Compute $PROG_EXT, used for non-Unix ports, such as OS/2 EMX.
2468 AC_DEFUN([CF_PROG_EXT],
2470 AC_REQUIRE([CF_CHECK_CACHE])
2471 case $cf_cv_system_name in
2473 CFLAGS="$CFLAGS -Zmt"
2474 CPPFLAGS="$CPPFLAGS -D__ST_MT_ERRNO__"
2475 CXXFLAGS="$CXXFLAGS -Zmt"
2476 # autoconf's macro sets -Zexe and suffix both, which conflict:w
2477 LDFLAGS="$LDFLAGS -Zmt -Zcrtdll"
2487 test -n "$PROG_EXT" && AC_DEFINE_UNQUOTED(PROG_EXT,"$PROG_EXT")
2489 dnl ---------------------------------------------------------------------------
2490 dnl CF_PROG_INSTALL version: 5 updated: 2002/12/21 22:46:07
2492 dnl Force $INSTALL to be an absolute-path. Otherwise, edit_man.sh and the
2493 dnl misc/tabset install won't work properly. Usually this happens only when
2494 dnl using the fallback mkinstalldirs script
2495 AC_DEFUN([CF_PROG_INSTALL],
2501 CF_DIRNAME(cf_dir,$INSTALL)
2502 test -z "$cf_dir" && cf_dir=.
2503 INSTALL=`cd $cf_dir && pwd`/`echo $INSTALL | sed -e 's%^.*/%%'`
2507 dnl ---------------------------------------------------------------------------
2508 dnl CF_PROG_LDCONFIG version: 1 updated: 2003/09/20 17:07:55
2509 dnl ----------------
2510 dnl Check for ldconfig, needed to fixup shared libraries that would be built
2511 dnl and then used in the install.
2512 AC_DEFUN([CF_PROG_LDCONFIG],[
2513 if test "$cross_compiling" = yes ; then
2516 case "$cf_cv_system_name" in #(vi
2518 test -z "$LDCONFIG" && LDCONFIG="/sbin/ldconfig -R"
2520 *) LDPATH=$PATH:/sbin:/usr/sbin
2521 AC_PATH_PROG(LDCONFIG,ldconfig,,$LDPATH)
2527 dnl ---------------------------------------------------------------------------
2528 dnl CF_REGEX version: 3 updated: 1997/11/01 14:26:01
2530 dnl Attempt to determine if we've got one of the flavors of regular-expression
2531 dnl code that we can support.
2532 AC_DEFUN([CF_REGEX],
2534 AC_MSG_CHECKING([for regular-expression headers])
2535 AC_CACHE_VAL(cf_cv_regex,[
2536 AC_TRY_LINK([#include <sys/types.h>
2537 #include <regex.h>],[
2539 int x = regcomp(p, "", 0);
2540 int y = regexec(p, "", 0, 0, 0);
2542 ],[cf_cv_regex="regex.h"],[
2543 AC_TRY_LINK([#include <regexp.h>],[
2544 char *p = compile("", "", "", 0);
2545 int x = step("", "");
2546 ],[cf_cv_regex="regexp.h"],[
2547 cf_save_LIBS="$LIBS"
2549 AC_TRY_LINK([#include <regexpr.h>],[
2550 char *p = compile("", "", "");
2551 int x = step("", "");
2552 ],[cf_cv_regex="regexpr.h"],[LIBS="$cf_save_LIBS"])])])
2554 AC_MSG_RESULT($cf_cv_regex)
2555 case $cf_cv_regex in
2556 regex.h) AC_DEFINE(HAVE_REGEX_H_FUNCS) ;;
2557 regexp.h) AC_DEFINE(HAVE_REGEXP_H_FUNCS) ;;
2558 regexpr.h) AC_DEFINE(HAVE_REGEXPR_H_FUNCS) ;;
2561 dnl ---------------------------------------------------------------------------
2562 dnl CF_SHARED_OPTS version: 30 updated: 2003/12/27 20:48:07
2564 dnl Attempt to determine the appropriate CC/LD options for creating a shared
2567 dnl Note: $(LOCAL_LDFLAGS) is used to link executables that will run within the
2568 dnl build-tree, i.e., by making use of the libraries that are compiled in ../lib
2569 dnl We avoid compiling-in a ../lib path for the shared library since that can
2570 dnl lead to unexpected results at runtime.
2571 dnl $(LOCAL_LDFLAGS2) has the same intention but assumes that the shared libraries
2572 dnl are compiled in ../../lib
2574 dnl The variable 'cf_cv_do_symlinks' is used to control whether we configure
2575 dnl to install symbolic links to the rel/abi versions of shared libraries.
2577 dnl The variable 'cf_cv_shlib_version' controls whether we use the rel or abi
2578 dnl version when making symbolic links.
2580 dnl The variable 'cf_cv_shlib_version_infix' controls whether shared library
2581 dnl version numbers are infix (ex: libncurses.<ver>.dylib) or postfix
2582 dnl (ex: libncurses.so.<ver>).
2584 dnl Some loaders leave 'so_locations' lying around. It's nice to clean up.
2585 AC_DEFUN([CF_SHARED_OPTS],
2587 AC_REQUIRE([CF_SUBST_NCURSES_VERSION])
2591 INSTALL_LIB="-m 644"
2593 cf_cv_do_symlinks=no
2595 AC_MSG_CHECKING(if release/abi version should be used for shared libs)
2596 AC_ARG_WITH(shlib-version,
2597 [ --with-shlib-version=X Specify rel or abi version for shared libs],
2598 [test -z "$withval" && withval=auto
2599 case $withval in #(vi
2601 cf_cv_shlib_version=auto
2603 rel|abi|auto|no) #(vi
2604 cf_cv_shlib_version=$withval
2607 AC_ERROR([option value must be one of: rel, abi, auto or no])
2610 ],[cf_cv_shlib_version=auto])
2611 AC_MSG_RESULT($cf_cv_shlib_version)
2615 # Some less-capable ports of gcc support only -fpic
2617 if test "$GCC" = yes
2619 AC_MSG_CHECKING(which $CC option to use)
2620 cf_save_CFLAGS="$CFLAGS"
2621 for CC_SHARED_OPTS in -fPIC -fpic ''
2623 CFLAGS="$cf_save_CFLAGS $CC_SHARED_OPTS"
2624 AC_TRY_COMPILE([#include <stdio.h>],[int x = 1],[break],[])
2626 AC_MSG_RESULT($CC_SHARED_OPTS)
2627 CFLAGS="$cf_save_CFLAGS"
2630 cf_cv_shlib_version_infix=no
2632 case $cf_cv_system_name in
2634 MK_SHARED_LIB='$(CC) -o $[@] -Xlinker -soname=`basename $[@]` -nostart -e 0'
2638 MK_SHARED_LIB='$(CC) -shared -Wl,--out-implib=$(IMPORT_LIB) -Wl,--export-all-symbols -o $(SHARED_LIB)'
2639 cf_cv_shlib_version=cygdll
2640 cf_cv_shlib_version_infix=cygdll
2643 EXTRA_CFLAGS="-no-cpp-precomp"
2644 CC_SHARED_OPTS="-dynamic"
2645 MK_SHARED_LIB='$(CC) -dynamiclib -install_name $(DESTDIR)$(libdir)/`basename $[@]` -compatibility_version $(ABI_VERSION) -current_version $(ABI_VERSION) -o $[@]'
2646 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=abi
2647 cf_cv_shlib_version_infix=yes
2650 # (tested with gcc 2.7.2 -- I don't have c89)
2651 if test "$GCC" = yes; then
2652 LD_SHARED_OPTS='-Xlinker +b -Xlinker $(libdir)'
2655 LD_SHARED_OPTS='-Wl,+b,$(libdir)'
2657 MK_SHARED_LIB='$(LD) +b $(libdir) -b -o $[@]'
2658 # HP-UX shared libraries must be executable, and should be
2659 # readonly to exploit a quirk in the memory manager.
2660 INSTALL_LIB="-m 555"
2663 if test "$cf_cv_ld_rpath" = yes ; then
2664 cf_ld_rpath_opt="-Wl,-rpath,"
2665 EXTRA_LDFLAGS="-Wl,-rpath,\$(libdir) $EXTRA_LDFLAGS"
2667 # tested with IRIX 5.2 and 'cc'.
2668 if test "$GCC" != yes; then
2669 CC_SHARED_OPTS='-KPIC'
2671 MK_SHARED_LIB='$(LD) -shared -rdata_shared -soname `basename $[@]` -o $[@]'
2672 cf_cv_rm_so_locs=yes
2674 linux*|gnu*|k*bsd*-gnu)
2675 if test "$DFT_LWR_MODEL" = "shared" ; then
2676 LOCAL_LDFLAGS="-Wl,-rpath,`pwd`/lib"
2677 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
2679 if test "$cf_cv_ld_rpath" = yes ; then
2680 cf_ld_rpath_opt="-Wl,-rpath,"
2681 EXTRA_LDFLAGS="$LOCAL_LDFLAGS $EXTRA_LDFLAGS"
2683 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
2684 MK_SHARED_LIB='$(CC) -shared -Wl,-soname,`basename $[@] .$(REL_VERSION)`.$(ABI_VERSION),-stats,-lc -o $[@]'
2687 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
2688 MK_SHARED_LIB='$(LD) -Bshareable -soname,`basename $[@].$(ABI_VERSION)` -o $[@]'
2691 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
2692 MK_SHARED_LIB='$(LD) -Bshareable -soname=`basename $[@]` -o $[@]'
2693 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
2695 # This doesn't work - I keep getting spurious references to needing
2696 # libncurses.so.5.3 when ldd says it's resolved. LOCAL_LDFLAGS2 seems to be
2697 # no longer used anyway. And the rpath logic isn't relative - so I have to
2698 # add the local and install lib-directories:
2700 # if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_ld_rpath" = yes ; then
2701 # LOCAL_LDFLAGS="-rpath `pwd`/lib"
2702 # LOCAL_LDFLAGS2="-rpath \$(libdir) $LOCAL_LDFLAGS"
2703 # cf_ld_rpath_opt="-rpath "
2704 # EXTRA_LDFLAGS="$LOCAL_LDFLAGS $EXTRA_LDFLAGS"
2708 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
2709 MK_SHARED_LIB='$(LD) -Bshareable -o $[@]'
2710 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
2713 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
2714 test "$cf_cv_ld_rpath" = yes && cf_ld_rpath_opt="-Wl,-rpath,"
2715 if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_ld_rpath" = yes ; then
2716 LOCAL_LDFLAGS="-Wl,-rpath,`pwd`/lib"
2717 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
2718 EXTRA_LDFLAGS="-Wl,-rpath,\$(libdir) $EXTRA_LDFLAGS"
2719 MK_SHARED_LIB='$(CC) -shared -Wl,-soname,`basename $[@] .$(REL_VERSION)`.$(ABI_VERSION) -o $[@]'
2720 if test "$cf_cv_shlib_version" = auto; then
2721 if test ! -f /usr/libexec/ld.elf_so; then
2722 cf_cv_shlib_version=rel
2726 MK_SHARED_LIB='$(LD) -Bshareable -o $[@]'
2730 # tested with OSF/1 V3.2 and 'cc'
2731 # tested with OSF/1 V3.2 and gcc 2.6.3 (but the c++ demo didn't
2732 # link with shared libs).
2733 MK_SHARED_LIB='$(LD) -set_version $(REL_VERSION):$(ABI_VERSION) -expect_unresolved "*" -shared -soname `basename $[@]`'
2736 MK_SHARED_LIB="${MK_SHARED_LIB} -msym"
2739 MK_SHARED_LIB="${MK_SHARED_LIB}"' -o $[@]'
2740 if test "$DFT_LWR_MODEL" = "shared" ; then
2741 LOCAL_LDFLAGS="-Wl,-rpath,`pwd`/lib"
2742 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
2744 if test "$cf_cv_ld_rpath" = yes ; then
2745 cf_ld_rpath_opt="-rpath"
2746 # EXTRA_LDFLAGS="$LOCAL_LDFLAGS $EXTRA_LDFLAGS"
2748 cf_cv_rm_so_locs=yes
2750 sco3.2v5*) # (also uw2* and UW7) hops 13-Apr-98
2751 # tested with osr5.0.5
2752 if test "$GCC" != yes; then
2753 CC_SHARED_OPTS='-belf -KPIC'
2755 MK_SHARED_LIB='$(LD) -dy -G -h `basename $[@] .$(REL_VERSION)`.$(ABI_VERSION) -o [$]@'
2756 if test "$cf_cv_ld_rpath" = yes ; then
2757 # only way is to set LD_RUN_PATH but no switch for it
2760 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
2761 LINK_PROGS='LD_RUN_PATH=$(libdir)'
2762 LINK_TESTS='Pwd=`pwd`;LD_RUN_PATH=`dirname $${Pwd}`/lib'
2765 # tested with SunOS 4.1.1 and gcc 2.7.0
2766 if test "$GCC" != yes; then
2767 CC_SHARED_OPTS='-KPIC'
2769 MK_SHARED_LIB='$(LD) -assert pure-text -o $[@]'
2770 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
2773 # tested with SunOS 5.5.1 (solaris 2.5.1) and gcc 2.7.2
2774 if test "$GCC" != yes; then
2775 CC_SHARED_OPTS='-KPIC'
2777 MK_SHARED_LIB='$(LD) -dy -G -h `basename $[@] .$(REL_VERSION)`.$(ABI_VERSION) -o $[@]'
2778 if test "$DFT_LWR_MODEL" = "shared" ; then
2779 LOCAL_LDFLAGS="-R `pwd`/lib:\$(libdir)"
2780 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
2782 if test "$cf_cv_ld_rpath" = yes ; then
2783 cf_ld_rpath_opt="-R"
2784 EXTRA_LDFLAGS="$LOCAL_LDFLAGS $EXTRA_LDFLAGS"
2786 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
2789 # tested with UnixWare 7.1.0 (gcc 2.95.2 and cc)
2790 if test "$GCC" != yes; then
2791 CC_SHARED_OPTS='-KPIC'
2793 MK_SHARED_LIB='$(LD) -d y -G -o [$]@'
2796 CC_SHARED_OPTS='unknown'
2797 MK_SHARED_LIB='echo unknown'
2801 # This works if the last tokens in $MK_SHARED_LIB are the -o target.
2802 case "$cf_cv_shlib_version" in #(vi
2804 case "$MK_SHARED_LIB" in #(vi
2806 test "$cf_cv_do_symlinks" = no && cf_cv_do_symlinks=yes
2809 AC_MSG_WARN(ignored --with-shlib-version)
2815 if test -n "$cf_ld_rpath_opt" ; then
2816 AC_MSG_CHECKING(if we need a space after rpath option)
2817 cf_save_LIBS="$LIBS"
2818 LIBS="$LIBS ${cf_ld_rpath_opt}$libdir"
2819 AC_TRY_LINK(, , cf_rpath_space=no, cf_rpath_space=yes)
2820 LIBS="$cf_save_LIBS"
2821 AC_MSG_RESULT($cf_rpath_space)
2822 test "$cf_rpath_space" = yes && cf_ld_rpath_opt="$cf_ld_rpath_opt "
2823 MK_SHARED_LIB="$MK_SHARED_LIB $cf_ld_rpath_opt\$(libdir)"
2826 AC_SUBST(CC_SHARED_OPTS)
2827 AC_SUBST(LD_SHARED_OPTS)
2828 AC_SUBST(MK_SHARED_LIB)
2829 AC_SUBST(LINK_PROGS)
2830 AC_SUBST(LINK_TESTS)
2831 AC_SUBST(EXTRA_LDFLAGS)
2832 AC_SUBST(LOCAL_LDFLAGS)
2833 AC_SUBST(LOCAL_LDFLAGS2)
2834 AC_SUBST(INSTALL_LIB)
2836 dnl ---------------------------------------------------------------------------
2837 dnl CF_SIZECHANGE version: 8 updated: 2000/11/04 12:22:16
2839 dnl Check for definitions & structures needed for window size-changing
2840 dnl FIXME: check that this works with "snake" (HP-UX 10.x)
2841 AC_DEFUN([CF_SIZECHANGE],
2843 AC_REQUIRE([CF_STRUCT_TERMIOS])
2844 AC_CACHE_CHECK(declaration of size-change, cf_cv_sizechange,[
2845 cf_cv_sizechange=unknown
2846 cf_save_CPPFLAGS="$CPPFLAGS"
2848 for cf_opts in "" "NEED_PTEM_H"
2851 CPPFLAGS="$cf_save_CPPFLAGS"
2852 test -n "$cf_opts" && CPPFLAGS="$CPPFLAGS -D$cf_opts"
2853 AC_TRY_COMPILE([#include <sys/types.h>
2854 #ifdef HAVE_TERMIOS_H
2855 #include <termios.h>
2857 #ifdef HAVE_TERMIO_H
2862 /* This is a workaround for SCO: they neglected to define struct winsize in
2863 * termios.h -- it's only in termio.h and ptem.h
2865 #include <sys/stream.h>
2866 #include <sys/ptem.h>
2868 #if !defined(sun) || !defined(HAVE_TERMIOS_H)
2869 #include <sys/ioctl.h>
2873 struct ttysize win; /* FIXME: what system is this? */
2874 int y = win.ts_lines;
2875 int x = win.ts_cols;
2882 no TIOCGSIZE or TIOCGWINSZ
2883 #endif /* TIOCGWINSZ */
2884 #endif /* TIOCGSIZE */
2886 [cf_cv_sizechange=yes],
2887 [cf_cv_sizechange=no])
2889 CPPFLAGS="$cf_save_CPPFLAGS"
2890 if test "$cf_cv_sizechange" = yes ; then
2891 echo "size-change succeeded ($cf_opts)" >&AC_FD_CC
2892 test -n "$cf_opts" && cf_cv_sizechange="$cf_opts"
2897 if test "$cf_cv_sizechange" != no ; then
2898 AC_DEFINE(HAVE_SIZECHANGE)
2899 case $cf_cv_sizechange in #(vi
2901 AC_DEFINE_UNQUOTED($cf_cv_sizechange )
2906 dnl ---------------------------------------------------------------------------
2907 dnl CF_SRC_MODULES version: 15 updated: 2004/01/10 16:05:16
2909 dnl For each parameter, test if the source-directory exists, and if it contains
2910 dnl a 'modules' file. If so, add to the list $cf_cv_src_modules which we'll
2911 dnl use in CF_LIB_RULES.
2913 dnl This uses the configured value to make the lists SRC_SUBDIRS and
2914 dnl SUB_MAKEFILES which are used in the makefile-generation scheme.
2915 AC_DEFUN([CF_SRC_MODULES],
2917 AC_MSG_CHECKING(for src modules)
2919 # dependencies and linker-arguments for test-programs
2920 TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${LIB_NAME}${DFT_DEP_SUFFIX} $TEST_DEPS"
2921 if test "$DFT_LWR_MODEL" = "libtool"; then
2922 TEST_ARGS="${TEST_DEPS}"
2924 TEST_ARGS="-l${LIB_NAME}${DFT_ARG_SUFFIX} $TEST_ARGS"
2927 # dependencies and linker-arguments for utility-programs
2928 test "$with_termlib" != yes && PROG_ARGS="$TEST_ARGS"
2933 if test -f $srcdir/$cf_dir/modules; then
2935 # We may/may not have tack in the distribution, though the
2937 if test $cf_dir = tack ; then
2938 if test ! -f $srcdir/${cf_dir}/${cf_dir}.h; then
2943 if test -z "$cf_cv_src_modules"; then
2944 cf_cv_src_modules=$cf_dir
2946 cf_cv_src_modules="$cf_cv_src_modules $cf_dir"
2949 # Make the ncurses_cfg.h file record the library interface files as
2950 # well. These are header files that are the same name as their
2951 # directory. Ncurses is the only library that does not follow
2953 if test $cf_dir = tack ; then
2955 elif test -f $srcdir/${cf_dir}/${cf_dir}.h; then
2956 CF_UPPER(cf_have_include,$cf_dir)
2957 AC_DEFINE_UNQUOTED(HAVE_${cf_have_include}_H)
2958 AC_DEFINE_UNQUOTED(HAVE_LIB${cf_have_include})
2959 TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${cf_dir}${DFT_DEP_SUFFIX} $TEST_DEPS"
2960 if test "$DFT_LWR_MODEL" = "libtool"; then
2961 TEST_ARGS="${TEST_DEPS}"
2963 TEST_ARGS="-l${cf_dir}${DFT_ARG_SUFFIX} $TEST_ARGS"
2968 AC_MSG_RESULT($cf_cv_src_modules)
2969 TEST_ARGS="-L${LIB_DIR} $TEST_ARGS"
2973 PROG_ARGS="-L${LIB_DIR} $PROG_ARGS"
2976 SRC_SUBDIRS="man include"
2977 for cf_dir in $cf_cv_src_modules
2979 SRC_SUBDIRS="$SRC_SUBDIRS $cf_dir"
2981 SRC_SUBDIRS="$SRC_SUBDIRS test"
2982 test -z "$MAKE_TERMINFO" && SRC_SUBDIRS="$SRC_SUBDIRS misc"
2983 test "$cf_with_cxx_binding" != no && SRC_SUBDIRS="$SRC_SUBDIRS c++"
2986 if test "$cf_cv_prog_gnat_correct" = yes && test -f $srcdir/Ada95/Makefile.in; then
2987 SRC_SUBDIRS="$SRC_SUBDIRS Ada95"
2988 ADA_SUBDIRS="gen src samples"
2992 for cf_dir in $SRC_SUBDIRS
2994 SUB_MAKEFILES="$SUB_MAKEFILES $cf_dir/Makefile"
2997 if test -n "$ADA_SUBDIRS"; then
2998 for cf_dir in $ADA_SUBDIRS
3000 SUB_MAKEFILES="$SUB_MAKEFILES Ada95/$cf_dir/Makefile"
3002 AC_SUBST(ADA_SUBDIRS)
3005 dnl ---------------------------------------------------------------------------
3006 dnl CF_STDCPP_LIBRARY version: 5 updated: 2000/08/12 23:18:52
3007 dnl -----------------
3008 dnl Check for -lstdc++, which is GNU's standard C++ library.
3009 AC_DEFUN([CF_STDCPP_LIBRARY],
3011 if test -n "$GXX" ; then
3012 case $cf_cv_system_name in #(vi
3014 cf_stdcpp_libname=stdcpp
3017 cf_stdcpp_libname=stdc++
3020 AC_CACHE_CHECK(for library $cf_stdcpp_libname,cf_cv_libstdcpp,[
3022 LIBS="$LIBS -l$cf_stdcpp_libname"
3024 #include <strstream.h>],[
3026 strstreambuf foo(buf, sizeof(buf))
3028 [cf_cv_libstdcpp=yes],
3029 [cf_cv_libstdcpp=no])
3032 test "$cf_cv_libstdcpp" = yes && CXXLIBS="$CXXLIBS -l$cf_stdcpp_libname"
3035 dnl ---------------------------------------------------------------------------
3036 dnl CF_STRIP_G_OPT version: 3 updated: 2002/12/21 19:25:52
3038 dnl Remove "-g" option from the compiler options
3039 AC_DEFUN([CF_STRIP_G_OPT],
3040 [$1=`echo ${$1} | sed -e 's%-g %%' -e 's%-g$%%'`])dnl
3041 dnl ---------------------------------------------------------------------------
3042 dnl CF_STRUCT_SIGACTION version: 3 updated: 2000/08/12 23:18:52
3043 dnl -------------------
3044 dnl Check if we need _POSIX_SOURCE defined to use struct sigaction. We'll only
3045 dnl do this if we've found the sigaction function.
3047 dnl If needed, define SVR4_ACTION.
3048 AC_DEFUN([CF_STRUCT_SIGACTION],[
3049 if test "$ac_cv_func_sigaction" = yes; then
3050 AC_MSG_CHECKING(whether sigaction needs _POSIX_SOURCE)
3052 #include <sys/types.h>
3053 #include <signal.h>],
3054 [struct sigaction act],
3058 #define _POSIX_SOURCE
3059 #include <sys/types.h>
3060 #include <signal.h>],
3061 [struct sigaction act],
3063 AC_DEFINE(SVR4_ACTION)],
3064 [sigact_bad=unknown])])
3065 AC_MSG_RESULT($sigact_bad)
3068 dnl ---------------------------------------------------------------------------
3069 dnl CF_STRUCT_TERMIOS version: 5 updated: 2000/11/04 12:22:46
3070 dnl -----------------
3071 dnl Some machines require _POSIX_SOURCE to completely define struct termios.
3072 dnl If so, define SVR4_TERMIO
3073 AC_DEFUN([CF_STRUCT_TERMIOS],[
3079 if test "$ISC" = yes ; then
3080 AC_CHECK_HEADERS( sys/termio.h )
3082 if test "$ac_cv_header_termios_h" = yes ; then
3083 case "$CFLAGS $CPPFLAGS" in
3085 termios_bad=dunno ;;
3086 *) termios_bad=maybe ;;
3088 if test "$termios_bad" = maybe ; then
3089 AC_MSG_CHECKING(whether termios.h needs _POSIX_SOURCE)
3090 AC_TRY_COMPILE([#include <termios.h>],
3091 [struct termios foo; int x = foo.c_iflag],
3094 #define _POSIX_SOURCE
3095 #include <termios.h>],
3096 [struct termios foo; int x = foo.c_iflag],
3097 termios_bad=unknown,
3098 termios_bad=yes AC_DEFINE(SVR4_TERMIO))
3100 AC_MSG_RESULT($termios_bad)
3104 dnl ---------------------------------------------------------------------------
3105 dnl CF_SUBST version: 2 updated: 1997/09/06 23:41:28
3107 dnl Shorthand macro for substituting things that the user may override
3108 dnl with an environment variable.
3110 dnl $1 = long/descriptive name
3111 dnl $2 = environment variable
3112 dnl $3 = default value
3113 AC_DEFUN([CF_SUBST],
3114 [AC_CACHE_VAL(cf_cv_subst_$2,[
3115 AC_MSG_CHECKING(for $1 (symbol $2))
3116 test -z "[$]$2" && $2=$3
3117 AC_MSG_RESULT([$]$2)
3119 cf_cv_subst_$2=[$]$2])
3120 $2=${cf_cv_subst_$2}
3122 dnl ---------------------------------------------------------------------------
3123 dnl CF_SUBST_NCURSES_VERSION version: 7 updated: 2003/06/07 16:22:51
3124 dnl ------------------------
3125 dnl Get the version-number for use in shared-library naming, etc.
3126 AC_DEFUN([CF_SUBST_NCURSES_VERSION],
3128 NCURSES_MAJOR="`egrep '^NCURSES_MAJOR[[ ]]*=' $srcdir/dist.mk | sed -e 's/^[[^0-9]]*//'`"
3129 NCURSES_MINOR="`egrep '^NCURSES_MINOR[[ ]]*=' $srcdir/dist.mk | sed -e 's/^[[^0-9]]*//'`"
3130 NCURSES_PATCH="`egrep '^NCURSES_PATCH[[ ]]*=' $srcdir/dist.mk | sed -e 's/^[[^0-9]]*//'`"
3131 cf_cv_abi_version=${NCURSES_MAJOR}
3132 cf_cv_rel_version=${NCURSES_MAJOR}.${NCURSES_MINOR}
3133 dnl Show the computed version, for logging
3134 cf_cv_timestamp=`date`
3135 AC_MSG_RESULT(Configuring NCURSES $cf_cv_rel_version ABI $cf_cv_abi_version ($cf_cv_timestamp))
3136 dnl We need these values in the generated headers
3137 AC_SUBST(NCURSES_MAJOR)
3138 AC_SUBST(NCURSES_MINOR)
3139 AC_SUBST(NCURSES_PATCH)
3140 dnl We need these values in the generated makefiles
3141 AC_SUBST(cf_cv_rel_version)
3142 AC_SUBST(cf_cv_abi_version)
3143 AC_SUBST(cf_cv_builtin_bool)
3144 AC_SUBST(cf_cv_header_stdbool_h)
3145 AC_SUBST(cf_cv_type_of_bool)dnl
3147 dnl ---------------------------------------------------------------------------
3148 dnl CF_SYS_TIME_SELECT version: 4 updated: 2000/10/04 09:18:40
3149 dnl ------------------
3150 dnl Check if we can include <sys/time.h> with <sys/select.h>; this breaks on
3151 dnl older SCO configurations.
3152 AC_DEFUN([CF_SYS_TIME_SELECT],
3154 AC_MSG_CHECKING(if sys/time.h works with sys/select.h)
3155 AC_CACHE_VAL(cf_cv_sys_time_select,[
3157 #include <sys/types.h>
3158 #ifdef HAVE_SYS_TIME_H
3159 #include <sys/time.h>
3161 #ifdef HAVE_SYS_SELECT_H
3162 #include <sys/select.h>
3164 ],[],[cf_cv_sys_time_select=yes],
3165 [cf_cv_sys_time_select=no])
3167 AC_MSG_RESULT($cf_cv_sys_time_select)
3168 test "$cf_cv_sys_time_select" = yes && AC_DEFINE(HAVE_SYS_TIME_SELECT)
3170 dnl ---------------------------------------------------------------------------
3171 dnl CF_TYPEOF_CHTYPE version: 4 updated: 2000/10/04 09:18:40
3172 dnl ----------------
3173 dnl Determine the type we should use for chtype (and attr_t, which is treated
3174 dnl as the same thing). We want around 32 bits, so on most machines want a
3175 dnl long, but on newer 64-bit machines, probably want an int. If we're using
3176 dnl wide characters, we have to have a type compatible with that, as well.
3177 AC_DEFUN([CF_TYPEOF_CHTYPE],
3179 AC_REQUIRE([CF_UNSIGNED_LITERALS])
3180 AC_MSG_CHECKING([for type of chtype])
3181 AC_CACHE_VAL(cf_cv_typeof_chtype,[
3183 #ifdef USE_WIDEC_SUPPORT
3184 #include <stddef.h> /* we want wchar_t */
3185 #define WANT_BITS 39
3187 #define WANT_BITS 31
3192 FILE *fp = fopen("cf_test.out", "w");
3194 char *result = "long";
3195 #ifdef USE_WIDEC_SUPPORT
3197 * If wchar_t is smaller than a long, it must be an int or a
3198 * short. We prefer not to use a short anyway.
3200 if (sizeof(unsigned long) > sizeof(wchar_t))
3203 if (sizeof(unsigned long) > sizeof(unsigned int)) {
3206 for (n = 0; n < WANT_BITS; n++) {
3207 unsigned int y = (x >> n);
3208 if (y != 1 || x == 0) {
3214 * If x is nonzero, an int is big enough for the bits
3217 result = (x != 0) ? "int" : "long";
3225 [cf_cv_typeof_chtype=`cat cf_test.out`],
3226 [cf_cv_typeof_chtype=long],
3227 [cf_cv_typeof_chtype=long])
3230 AC_MSG_RESULT($cf_cv_typeof_chtype)
3232 AC_SUBST(cf_cv_typeof_chtype)
3233 AC_DEFINE_UNQUOTED(TYPEOF_CHTYPE,$cf_cv_typeof_chtype)
3236 test "$cf_cv_unsigned_literals" = yes && cf_cv_1UL="${cf_cv_1UL}U"
3237 test "$cf_cv_typeof_chtype" = long && cf_cv_1UL="${cf_cv_1UL}L"
3241 dnl ---------------------------------------------------------------------------
3242 dnl CF_TYPE_SIGACTION version: 3 updated: 2000/08/12 23:18:52
3243 dnl -----------------
3245 AC_DEFUN([CF_TYPE_SIGACTION],
3247 AC_MSG_CHECKING([for type sigaction_t])
3248 AC_CACHE_VAL(cf_cv_type_sigaction,[
3250 #include <signal.h>],
3252 [cf_cv_type_sigaction=yes],
3253 [cf_cv_type_sigaction=no])])
3254 AC_MSG_RESULT($cf_cv_type_sigaction)
3255 test "$cf_cv_type_sigaction" = yes && AC_DEFINE(HAVE_TYPE_SIGACTION)
3257 dnl ---------------------------------------------------------------------------
3258 dnl CF_UNSIGNED_LITERALS version: 2 updated: 1998/02/07 22:10:16
3259 dnl --------------------
3260 dnl Test if the compiler supports 'U' and 'L' suffixes. Only old compilers
3261 dnl won't, but they're still there.
3262 AC_DEFUN([CF_UNSIGNED_LITERALS],
3264 AC_MSG_CHECKING([if unsigned literals are legal])
3265 AC_CACHE_VAL(cf_cv_unsigned_literals,[
3266 AC_TRY_COMPILE([],[long x = 1L + 1UL + 1U + 1],
3267 [cf_cv_unsigned_literals=yes],
3268 [cf_cv_unsigned_literals=no])
3270 AC_MSG_RESULT($cf_cv_unsigned_literals)
3272 dnl ---------------------------------------------------------------------------
3273 dnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59
3275 dnl Make an uppercase version of a variable
3276 dnl $1=uppercase($2)
3277 AC_DEFUN([CF_UPPER],
3279 $1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
3281 dnl ---------------------------------------------------------------------------
3282 dnl CF_VERBOSE version: 2 updated: 1997/09/05 10:45:14
3284 dnl Use AC_VERBOSE w/o the warnings
3285 AC_DEFUN([CF_VERBOSE],
3286 [test -n "$verbose" && echo " $1" 1>&AC_FD_MSG
3288 dnl ---------------------------------------------------------------------------
3289 dnl CF_WCHAR_TYPE version: 2 updated: 2004/01/17 19:18:20
3291 dnl Check if type wide-character type $1 is declared, and if so, which header
3292 dnl file is needed. The second parameter is used to set a shell variable when
3293 dnl the type is not found. The first parameter sets a shell variable for the
3295 AC_DEFUN([CF_WCHAR_TYPE],
3297 # This is needed on Tru64 5.0 to declare $1
3298 AC_CACHE_CHECK(if we must include wchar.h to declare $1,cf_cv_$1,[
3303 #ifdef HAVE_LIBUTF8_H
3304 #include <libutf8.h>
3313 #ifdef HAVE_LIBUTF8_H
3314 #include <libutf8.h>
3318 [cf_cv_$1=unknown])])])
3320 if test "$cf_cv_$1" = yes ; then
3321 AC_DEFINE(NEED_WCHAR_H)
3326 # if we do not find $1 in either place, use substitution to provide a fallback.
3327 if test "$cf_cv_$1" = unknown ; then
3332 # if we find $1 in either place, use substitution to provide a fallback.
3333 if test "$cf_cv_$1" != unknown ; then
3338 dnl ---------------------------------------------------------------------------
3339 dnl CF_WITH_ABI_VERSION version: 1 updated: 2003/09/20 18:12:49
3340 dnl -------------------
3341 dnl Allow library's ABI to be overridden. Generally this happens when a
3342 dnl packager has incremented the ABI past that used in the original package,
3343 dnl and wishes to keep doing this.
3345 dnl $1 is the package name, if any, to derive a corresponding {package}_ABI
3347 AC_DEFUN([CF_WITH_ABI_VERSION],[
3348 test -z "$cf_cv_abi_version" && cf_cv_abi_version=0
3349 AC_ARG_WITH(abi-version,
3350 [ --with-abi-version=XXX override derived ABI version],
3351 [AC_MSG_WARN(overriding ABI version $cf_cv_abi_version to $withval)
3352 cf_cv_abi_version=$withval])
3353 CF_NUMBER_SYNTAX($cf_cv_abi_version,ABI version)
3355 $1_ABI=$cf_cv_abi_version
3358 dnl ---------------------------------------------------------------------------
3359 dnl CF_WITH_DBMALLOC version: 2 updated: 2002/12/29 21:11:45
3360 dnl ----------------
3361 dnl Configure-option for dbmalloc
3362 AC_DEFUN([CF_WITH_DBMALLOC],[
3363 AC_MSG_CHECKING(if you want to link with dbmalloc for testing)
3364 AC_ARG_WITH(dbmalloc,
3365 [ --with-dbmalloc test: use Conor Cahill's dbmalloc library],
3366 [with_dbmalloc=$withval],
3368 AC_MSG_RESULT($with_dbmalloc)
3369 if test $with_dbmalloc = yes ; then
3370 AC_CHECK_LIB(dbmalloc,debug_malloc)
3373 dnl ---------------------------------------------------------------------------
3374 dnl CF_WITH_DMALLOC version: 2 updated: 2002/12/29 21:11:45
3376 dnl Configure-option for dmalloc
3377 AC_DEFUN([CF_WITH_DMALLOC],[
3378 AC_MSG_CHECKING(if you want to link with dmalloc for testing)
3379 AC_ARG_WITH(dmalloc,
3380 [ --with-dmalloc test: use Gray Watson's dmalloc library],
3381 [with_dmalloc=$withval],
3383 AC_MSG_RESULT($with_dmalloc)
3384 if test $with_dmalloc = yes ; then
3385 AC_CHECK_LIB(dmalloc,dmalloc_debug)
3388 dnl ---------------------------------------------------------------------------
3389 dnl CF_WITH_LIBTOOL version: 9 updated: 2004/01/16 14:55:37
3391 dnl Provide a configure option to incorporate libtool. Define several useful
3392 dnl symbols for the makefile rules.
3394 dnl The reference to AC_PROG_LIBTOOL does not normally work, since it uses
3395 dnl macros from libtool.m4 which is in the aclocal directory of automake.
3396 dnl Following is a simple script which turns on the AC_PROG_LIBTOOL macro.
3397 dnl But that still does not work properly since the macro is expanded outside
3398 dnl the CF_WITH_LIBTOOL macro:
3401 dnl ACLOCAL=`aclocal --print-ac-dir`
3402 dnl if test -z "$ACLOCAL" ; then
3403 dnl echo cannot find aclocal directory
3405 dnl elif test ! -f $ACLOCAL/libtool.m4 ; then
3406 dnl echo cannot find libtool.m4 file
3410 dnl LOCAL=aclocal.m4
3411 dnl ORIG=aclocal.m4.orig
3413 dnl trap "mv $ORIG $LOCAL" 0 1 2 5 15
3417 dnl # sed the LIBTOOL= assignment to omit the current directory?
3418 dnl sed -e 's/^LIBTOOL=.*/LIBTOOL=${LIBTOOL-libtool}/' $ACLOCAL/libtool.m4 >>$LOCAL
3419 dnl cat $ORIG >>$LOCAL
3423 AC_DEFUN([CF_WITH_LIBTOOL],
3425 ifdef([AC_PROG_LIBTOOL],,[
3428 # common library maintenance symbols that are convenient for libtool scripts:
3429 LIB_CREATE='$(AR) -cr'
3430 LIB_OBJECT='$(OBJECTS)'
3434 # symbols used to prop libtool up to enable it to determine what it should be
3442 AC_MSG_CHECKING(if you want to build libraries with libtool)
3443 AC_ARG_WITH(libtool,
3444 [ --with-libtool generate libraries with libtool],
3445 [with_libtool=$withval],
3447 AC_MSG_RESULT($with_libtool)
3448 if test "$with_libtool" != "no"; then
3449 ifdef([AC_PROG_LIBTOOL],[
3450 # missing_content_AC_PROG_LIBTOOL{{
3452 # missing_content_AC_PROG_LIBTOOL}}
3454 if test "$with_libtool" != "yes" ; then
3455 CF_PATH_SYNTAX(with_libtool)
3456 LIBTOOL=$with_libtool
3458 AC_PATH_PROG(LIBTOOL,libtool)
3460 if test -z "$LIBTOOL" ; then
3461 AC_MSG_ERROR(Cannot find libtool)
3464 LIB_CREATE='$(LIBTOOL) --mode=link $(CC) -rpath $(DESTDIR)$(libdir) -version-info `cut -f1 $(srcdir)/VERSION` -o'
3465 LIB_OBJECT='$(OBJECTS:.o=.lo)'
3467 LIB_CLEAN='$(LIBTOOL) --mode=clean'
3468 LIB_COMPILE='$(LIBTOOL) --mode=compile'
3469 LIB_LINK='$(LIBTOOL) --mode=link'
3470 LIB_INSTALL='$(LIBTOOL) --mode=install'
3471 LIB_UNINSTALL='$(LIBTOOL) --mode=uninstall'
3474 # Show the version of libtool
3475 AC_MSG_CHECKING(version of libtool)
3477 # Save the version in a cache variable - this is not entirely a good
3478 # thing, but the version string from libtool is very ugly, and for
3479 # bug reports it might be useful to have the original string.
3480 cf_cv_libtool_version=`$LIBTOOL --version 2>&1 | sed -e '2,$d' -e 's/([[^)]]*)//g' -e 's/^[[^1-9]]*//' -e 's/[[^0-9.]].*//'`
3481 AC_MSG_RESULT($cf_cv_libtool_version)
3482 if test -z "$cf_cv_libtool_version" ; then
3483 AC_MSG_ERROR(This is not libtool)
3486 # special hack to add --tag option for C++ compiler
3487 case $cf_cv_libtool_version in
3488 1.[[5-9]]*|[[2-9]]*)
3489 LIBTOOL_CXX="$LIBTOOL --tag=CXX"
3492 LIBTOOL_CXX="$LIBTOOL"
3500 test -z "$LIBTOOL" && ECHO_LT=
3503 AC_SUBST(LIBTOOL_CXX)
3505 AC_SUBST(LIB_CREATE)
3506 AC_SUBST(LIB_OBJECT)
3507 AC_SUBST(LIB_SUFFIX)
3511 AC_SUBST(LIB_COMPILE)
3513 AC_SUBST(LIB_INSTALL)
3514 AC_SUBST(LIB_UNINSTALL)
3517 dnl ---------------------------------------------------------------------------
3518 dnl CF_WITH_PATH version: 6 updated: 1998/10/11 00:40:17
3520 dnl Wrapper for AC_ARG_WITH to ensure that user supplies a pathname, not just
3521 dnl defaulting to yes/no.
3523 dnl $1 = option name
3525 dnl $3 = environment variable to set
3526 dnl $4 = default value, shown in the help-message, must be a constant
3527 dnl $5 = default value, if it's an expression & cannot be in the help-message
3529 AC_DEFUN([CF_WITH_PATH],
3530 [AC_ARG_WITH($1,[$2 ](default: ifelse($4,,empty,$4)),,
3531 ifelse($4,,[withval="${$3}"],[withval="${$3-ifelse($5,,$4,$5)}"]))dnl
3532 CF_PATH_SYNTAX(withval)
3536 dnl ---------------------------------------------------------------------------
3537 dnl CF_WITH_PATHLIST version: 5 updated: 2001/12/10 01:28:30
3538 dnl ----------------
3539 dnl Process an option specifying a list of colon-separated paths.
3541 dnl $1 = option name
3543 dnl $3 = environment variable to set
3544 dnl $4 = default value, shown in the help-message, must be a constant
3545 dnl $5 = default value, if it's an expression & cannot be in the help-message
3546 dnl $6 = flag to tell if we want to define or substitute
3548 AC_DEFUN([CF_WITH_PATHLIST],[
3549 AC_REQUIRE([CF_PATHSEP])
3550 AC_ARG_WITH($1,[$2 ](default: ifelse($4,,empty,$4)),,
3551 ifelse($4,,[withval=${$3}],[withval=${$3-ifelse($5,,$4,$5)}]))dnl
3553 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${PATHSEP}"
3555 for cf_src_path in $withval
3557 CF_PATH_SYNTAX(cf_src_path)
3558 test -n "$cf_dst_path" && cf_dst_path="${cf_dst_path}:"
3559 cf_dst_path="${cf_dst_path}${cf_src_path}"
3564 # Strip single quotes from the value, e.g., when it was supplied as a literal
3566 case $cf_dst_path in #(vi
3568 cf_dst_path=`echo $cf_dst_path |sed -e s/\'// -e s/\'\$//`
3571 cf_dst_path=`echo "$cf_dst_path" | sed -e 's/\\\\/\\\\\\\\/g'`
3574 eval '$3="$cf_dst_path"'
3578 dnl ---------------------------------------------------------------------------
3579 dnl CF_WITH_REL_VERSION version: 1 updated: 2003/09/20 18:12:49
3580 dnl -------------------
3581 dnl Allow library's release-version to be overridden. Generally this happens when a
3582 dnl packager has incremented the release-version past that used in the original package,
3583 dnl and wishes to keep doing this.
3585 dnl $1 is the package name, if any, to derive corresponding {package}_MAJOR
3586 dnl and {package}_MINOR symbols
3588 AC_DEFUN([CF_WITH_REL_VERSION],[
3589 test -z "$cf_cv_rel_version" && cf_cv_rel_version=0.0
3590 AC_ARG_WITH(rel-version,
3591 [ --with-rel-version=XXX override derived release version],
3592 [AC_MSG_WARN(overriding release version $cf_cv_rel_version to $withval)
3593 cf_cv_rel_version=$withval])
3595 CF_NUMBER_SYNTAX($cf_cv_rel_version,Release version)
3597 $1_MAJOR=`echo "$cf_cv_rel_version" | sed -e 's/\..*//'`
3598 $1_MINOR=`echo "$cf_cv_rel_version" | sed -e 's/^[[^.]]*//' -e 's/^\.//' -e 's/\..*//'`
3599 CF_NUMBER_SYNTAX([$]$1_MAJOR,Release major-version)
3600 CF_NUMBER_SYNTAX([$]$1_MINOR,Release minor-version)
3603 dnl ---------------------------------------------------------------------------
3604 dnl CF_WITH_SYSMOUSE version: 2 updated: 2003/03/22 19:13:43
3605 dnl ----------------
3606 dnl If we can compile with sysmouse, make it available unless it is not wanted.
3607 AC_DEFUN([CF_WITH_SYSMOUSE],[
3608 # not everyone has "test -c"
3609 if test -c /dev/sysmouse 2>/dev/null ; then
3610 AC_MSG_CHECKING(if you want to use sysmouse)
3611 AC_ARG_WITH(sysmouse,
3612 [ --with-sysmouse use sysmouse (FreeBSD console)],
3613 [cf_with_sysmouse=$withval],
3614 [cf_with_sysmouse=maybe])
3615 if test "$cf_with_sysmouse" != no ; then
3617 #include <osreldate.h>
3618 #if (__FreeBSD_version >= 400017)
3619 #include <sys/consio.h>
3620 #include <sys/fbio.h>
3622 #include <machine/console.h>
3625 struct mouse_info the_mouse;
3626 ioctl(0, CONS_MOUSECTL, &the_mouse);
3627 ],[cf_with_sysmouse=yes],[cf_with_sysmouse=no])
3629 AC_MSG_RESULT($cf_with_sysmouse)
3630 test "$cf_with_sysmouse" = yes && AC_DEFINE(USE_SYSMOUSE)
3633 dnl ---------------------------------------------------------------------------
3634 dnl CF_XOPEN_SOURCE version: 11 updated: 2004/01/26 20:58:41
3636 dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions,
3637 dnl or adapt to the vendor's definitions to get equivalent functionality.
3638 AC_DEFUN([CF_XOPEN_SOURCE],[
3639 case $host_os in #(vi
3641 CPPFLAGS="$CPPFLAGS -D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600"
3644 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE"
3647 CPPFLAGS="$CPPFLAGS -D_SGI_SOURCE"
3653 # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <arpa/inet.h>
3656 # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw
3659 # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw
3662 CPPFLAGS="$CPPFLAGS -D_OSF_SOURCE"
3665 # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer
3668 CPPFLAGS="$CPPFLAGS -D__EXTENSIONS__"
3671 AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[
3672 AC_TRY_COMPILE([#include <sys/types.h>],[
3673 #ifndef _XOPEN_SOURCE
3676 [cf_cv_xopen_source=no],
3677 [cf_save="$CPPFLAGS"
3678 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500"
3679 AC_TRY_COMPILE([#include <sys/types.h>],[
3680 #ifdef _XOPEN_SOURCE
3683 [cf_cv_xopen_source=no],
3684 [cf_cv_xopen_source=yes])
3688 test "$cf_cv_xopen_source" = yes && CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500"
3690 # FreeBSD 5.x headers demand this...
3691 AC_CACHE_CHECK(if we should define _POSIX_C_SOURCE,cf_cv_xopen_source,[
3692 AC_TRY_COMPILE([#include <sys/types.h>],[
3693 #ifndef _POSIX_C_SOURCE
3696 [cf_cv_xopen_source=no],
3697 [cf_save="$CPPFLAGS"
3698 CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE"
3699 AC_TRY_COMPILE([#include <sys/types.h>],[
3700 #ifdef _POSIX_C_SOURCE
3703 [cf_cv_xopen_source=no],
3704 [cf_cv_xopen_source=yes])
3708 test "$cf_cv_xopen_source" = yes && CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE"