1 dnl***************************************************************************
2 dnl Copyright (c) 1998-2000,2001,2002 Free Software Foundation, Inc. *
4 dnl Permission is hereby granted, free of charge, to any person obtaining a *
5 dnl copy of this software and associated documentation files (the *
6 dnl "Software"), to deal in the Software without restriction, including *
7 dnl without limitation the rights to use, copy, modify, merge, publish, *
8 dnl distribute, distribute with modifications, sublicense, and/or sell *
9 dnl copies of the Software, and to permit persons to whom the Software is *
10 dnl furnished to do so, subject to the following conditions: *
12 dnl The above copyright notice and this permission notice shall be included *
13 dnl in all copies or substantial portions of the Software. *
15 dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
16 dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
17 dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
18 dnl IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
19 dnl DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
20 dnl OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
21 dnl THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
23 dnl Except as contained in this notice, the name(s) of the above copyright *
24 dnl holders shall not be used in advertising or otherwise to promote the *
25 dnl sale, use or other dealings in this Software without prior written *
27 dnl***************************************************************************
29 dnl Author: Thomas E. Dickey 1996,1997,1998,1999,2000,2001
31 dnl $Id: aclocal.m4,v 1.285 2002/09/21 23:59:01 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 Construct the list of include-options for the C programs in the Ada95
40 AC_DEFUN([CF_ADA_INCLUDE_DIRS],
42 ACPPFLAGS="$ACPPFLAGS -I. -I../../include"
43 if test "$srcdir" != "."; then
44 ACPPFLAGS="$ACPPFLAGS -I\$(srcdir)/../../include"
46 if test "$GCC" != yes; then
47 ACPPFLAGS="$ACPPFLAGS -I\$(includedir)"
48 elif test "$includedir" != "/usr/include"; then
49 if test "$includedir" = '${prefix}/include' ; then
50 if test $prefix != /usr ; then
51 ACPPFLAGS="$ACPPFLAGS -I\$(includedir)"
54 ACPPFLAGS="$ACPPFLAGS -I\$(includedir)"
59 dnl ---------------------------------------------------------------------------
60 dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS
61 dnl The second parameter if given makes this macro verbose.
62 AC_DEFUN([CF_ADD_CFLAGS],
66 for cf_add_cflags in $1
68 case $cf_add_cflags in #(vi
69 -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi
74 cf_new_cppflags="$cf_new_cppflags $cf_add_cflags"
79 cf_new_cflags="$cf_new_cflags $cf_add_cflags"
84 if test -n "$cf_new_cflags" ; then
85 ifelse($2,,,[CF_VERBOSE(add to \$CFLAGS $cf_new_cflags)])
86 CFLAGS="$CFLAGS $cf_new_cflags"
89 if test -n "$cf_new_cppflags" ; then
90 ifelse($2,,,[CF_VERBOSE(add to \$CPPFLAGS $cf_new_cppflags)])
91 CPPFLAGS="$CPPFLAGS $cf_new_cppflags"
95 dnl ---------------------------------------------------------------------------
96 dnl This is adapted from the macros 'fp_PROG_CC_STDC' and 'fp_C_PROTOTYPES'
97 dnl in the sharutils 4.2 distribution.
98 AC_DEFUN([CF_ANSI_CC_CHECK],
100 AC_CACHE_CHECK(for ${CC-cc} option to accept ANSI C, cf_cv_ansi_cc,[
102 cf_save_CFLAGS="$CFLAGS"
103 cf_save_CPPFLAGS="$CPPFLAGS"
104 # Don't try gcc -ansi; that turns off useful extensions and
105 # breaks some systems' header files.
107 # Ultrix and OSF/1 -std1
108 # HP-UX -Aa -D_HPUX_SOURCE
110 # UnixWare 1.2 (cannot use -Xc, since ANSI/POSIX clashes)
111 for cf_arg in "-DCC_HAS_PROTOS" \
116 "-Aa -D_HPUX_SOURCE" \
119 CF_ADD_CFLAGS($cf_arg)
122 #ifndef CC_HAS_PROTOS
123 #if !defined(__STDC__) || (__STDC__ != 1)
128 int test (int i, double x);
129 struct s1 {int (*f) (int a);};
130 struct s2 {int (*f) (double a);};],
131 [cf_cv_ansi_cc="$cf_arg"; break])
133 CFLAGS="$cf_save_CFLAGS"
134 CPPFLAGS="$cf_save_CPPFLAGS"
137 if test "$cf_cv_ansi_cc" != "no"; then
138 if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then
139 CF_ADD_CFLAGS($cf_cv_ansi_cc)
141 AC_DEFINE(CC_HAS_PROTOS)
145 dnl ---------------------------------------------------------------------------
146 dnl For programs that must use an ANSI compiler, obtain compiler options that
147 dnl will make it recognize prototypes. We'll do preprocessor checks in other
148 dnl macros, since tools such as unproto can fake prototypes, but only part of
149 dnl the preprocessor.
150 AC_DEFUN([CF_ANSI_CC_REQD],
151 [AC_REQUIRE([CF_ANSI_CC_CHECK])
152 if test "$cf_cv_ansi_cc" = "no"; then
154 [Your compiler does not appear to recognize prototypes.
155 You have the following choices:
156 a. adjust your compiler options
157 b. get an up-to-date compiler
158 c. use a wrapper such as unproto])
161 dnl ---------------------------------------------------------------------------
162 dnl Test if 'bool' is a builtin type in the configured C++ compiler. Some
163 dnl older compilers (e.g., gcc 2.5.8) don't support 'bool' directly; gcc
164 dnl 2.6.3 does, in anticipation of the ANSI C++ standard.
166 dnl Treat the configuration-variable specially here, since we're directly
167 dnl substituting its value (i.e., 1/0).
168 AC_DEFUN([CF_BOOL_DECL],
170 AC_CHECK_HEADER(stdbool.h,
171 cf_cv_header_stdbool_h=1,
172 cf_cv_header_stdbool_h=0)
173 AC_MSG_CHECKING([for builtin bool type])
174 AC_CACHE_VAL(ifelse($1,,cf_cv_builtin_bool,[$1]),[
177 #include <sys/types.h>
179 [ifelse($1,,cf_cv_builtin_bool,[$1])=1],
180 [ifelse($1,,cf_cv_builtin_bool,[$1])=0])
182 if test "$ifelse($1,,cf_cv_builtin_bool,[$1])" = 1
183 then AC_MSG_RESULT(yes)
184 else AC_MSG_RESULT(no)
187 dnl ---------------------------------------------------------------------------
188 dnl Test for the size of 'bool' in the configured C++ compiler (e.g., a type).
189 dnl Don't bother looking for bool.h, since it's been deprecated.
191 dnl If the current compiler is C rather than C++, we get the bool definition
192 dnl from <stdbool.h>.
193 AC_DEFUN([CF_BOOL_SIZE],
195 AC_MSG_CHECKING([for size of bool])
196 AC_CACHE_VAL(cf_cv_type_of_bool,[
202 #if defined(__cplusplus)
204 #ifdef HAVE_GXX_BUILTIN_H
205 #include <g++/builtin.h>
206 #elif HAVE_GPP_BUILTIN_H
207 #include <gpp/builtin.h>
214 #if $cf_cv_header_stdbool_h
222 FILE *fp = fopen("cf_test.out", "w");
226 fputs("unsigned ", fp);
227 if (sizeof(x) == sizeof(int)) fputs("int", fp);
228 else if (sizeof(x) == sizeof(char)) fputs("char", fp);
229 else if (sizeof(x) == sizeof(short))fputs("short",fp);
230 else if (sizeof(x) == sizeof(long)) fputs("long", fp);
236 [cf_cv_type_of_bool=`cat cf_test.out`
237 if test -z "$cf_cv_type_of_bool"; then
238 cf_cv_type_of_bool=unknown
240 [cf_cv_type_of_bool=unknown],
241 [cf_cv_type_of_bool=unknown])
244 AC_MSG_RESULT($cf_cv_type_of_bool)
245 if test "$cf_cv_type_of_bool" = unknown ; then
246 case .$NCURSES_BOOL in #(vi
247 .auto|.) NCURSES_BOOL=unsigned;;
249 AC_MSG_WARN(Assuming $NCURSES_BOOL for type of bool)
250 cf_cv_type_of_bool=$NCURSES_BOOL
253 dnl ---------------------------------------------------------------------------
254 dnl Determine the default configuration into which we'll install ncurses. This
255 dnl can be overridden by the user's command-line options. There's two items to
257 dnl 1. the prefix (e.g., /usr)
258 dnl 2. the header files (e.g., /usr/include/ncurses)
259 dnl We'll look for a previous installation of ncurses and use the same defaults.
261 dnl We don't use AC_PREFIX_DEFAULT, because it gets evaluated too soon, and
262 dnl we don't use AC_PREFIX_PROGRAM, because we cannot distinguish ncurses's
263 dnl programs from a vendor's.
264 AC_DEFUN([CF_CFG_DEFAULTS],
266 AC_MSG_CHECKING(for prefix)
267 if test "x$prefix" = "xNONE" ; then
268 case "$cf_cv_system_name" in
269 # non-vendor systems don't have a conflict
270 openbsd*|netbsd*|freebsd*|linux*|cygwin*)
273 *) prefix=$ac_default_prefix
277 AC_MSG_RESULT($prefix)
279 if test "x$prefix" = "xNONE" ; then
280 AC_MSG_CHECKING(for default include-directory)
281 test -n "$verbose" && echo 1>&AC_FD_MSG
284 $includedir/ncurses \
286 $prefix/include/ncurses \
288 /usr/local/include/ncurses \
292 cf_dir=`eval echo $cf_symbol`
293 if test -f $cf_dir/curses.h ; then
294 if ( fgrep NCURSES_VERSION $cf_dir/curses.h 2>&1 >/dev/null ) ; then
295 includedir="$cf_symbol"
296 test -n "$verbose" && echo $ac_n " found " 1>&AC_FD_MSG
300 test -n "$verbose" && echo " tested $cf_dir" 1>&AC_FD_MSG
302 AC_MSG_RESULT($includedir)
305 dnl ---------------------------------------------------------------------------
306 dnl Check if the terminal-capability database functions are available. If not,
307 dnl ncurses has a much-reduced version.
308 AC_DEFUN([CF_CGETENT],[
309 AC_MSG_CHECKING(for terminal-capability database functions)
310 AC_CACHE_VAL(cf_cv_cgetent,[
312 #include <stdlib.h>],[
315 char *db_array = temp;
316 cgetent(&buf, /* int *, */ &db_array, "vt100");
317 cgetcap(buf, "tc", '=');
318 cgetmatch(buf, "tc");
323 AC_MSG_RESULT($cf_cv_cgetent)
324 test "$cf_cv_cgetent" = yes && AC_DEFINE(HAVE_BSD_CGETENT)
326 dnl ---------------------------------------------------------------------------
327 dnl Check if we're accidentally using a cache from a different machine.
328 dnl Derive the system name, as a check for reusing the autoconf cache.
330 dnl If we've packaged config.guess and config.sub, run that (since it does a
331 dnl better job than uname). Normally we'll use AC_CANONICAL_HOST, but allow
332 dnl an extra parameter that we may override, e.g., for AC_CANONICAL_SYSTEM
333 dnl which is useful in cross-compiles.
334 AC_DEFUN([CF_CHECK_CACHE],
336 if test -f $srcdir/config.guess ; then
337 ifelse([$1],,[AC_CANONICAL_HOST],[$1])
338 system_name="$host_os"
340 system_name="`(uname -s -r) 2>/dev/null`"
341 if test -z "$system_name" ; then
342 system_name="`(hostname) 2>/dev/null`"
345 test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name")
346 AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"])
348 test -z "$system_name" && system_name="$cf_cv_system_name"
349 test -n "$cf_cv_system_name" && AC_MSG_RESULT(Configuring for $cf_cv_system_name)
351 if test ".$system_name" != ".$cf_cv_system_name" ; then
352 AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name))
353 AC_ERROR("Please remove config.cache and try again.")
356 dnl ---------------------------------------------------------------------------
357 dnl Check for data that is usually declared in <stdio.h> or <errno.h>, e.g.,
358 dnl the 'errno' variable. Define a DECL_xxx symbol if we must declare it
361 dnl $1 = the name to check
362 AC_DEFUN([CF_CHECK_ERRNO],
364 AC_CACHE_CHECK(if external $1 is declared, cf_cv_dcl_$1,[
370 #include <sys/types.h>
371 #include <errno.h> ],
372 [long x = (long) $1],
377 if test "$cf_cv_dcl_$1" = no ; then
378 CF_UPPER(cf_result,decl_$1)
379 AC_DEFINE_UNQUOTED($cf_result)
382 # It's possible (for near-UNIX clones) that the data doesn't exist
383 CF_CHECK_EXTERN_DATA($1,int)
385 dnl ---------------------------------------------------------------------------
386 dnl Check for existence of external data in the current set of libraries. If
387 dnl we can modify it, it's real enough.
388 dnl $1 = the name to check
390 AC_DEFUN([CF_CHECK_EXTERN_DATA],
392 AC_CACHE_CHECK(if external $1 exists, cf_cv_have_$1,[
402 if test "$cf_cv_have_$1" = yes ; then
403 CF_UPPER(cf_result,have_$1)
404 AC_DEFINE_UNQUOTED($cf_result)
408 dnl ---------------------------------------------------------------------------
409 dnl Check if the C++ compiler accepts duplicate parameter initialization. This
410 dnl is a late feature for the standard and is not in some recent compilers
412 AC_DEFUN([CF_CPP_PARAM_INIT],
414 if test -n "$CXX"; then
415 AC_CACHE_CHECK(if $CXX accepts parameter initialization,cf_cv_cpp_param_init,[
427 TEST::TEST(int x = 1) // some compilers do not like second initializer
433 [cf_cv_cpp_param_init=yes],
434 [cf_cv_cpp_param_init=no],
435 [cf_cv_cpp_param_init=unknown])
439 test "$cf_cv_cpp_param_init" = yes && AC_DEFINE(CPP_HAS_PARAM_INIT)
441 dnl ---------------------------------------------------------------------------
442 dnl Check if the g++ compiler supports vscan function (not a standard feature).
443 AC_DEFUN([CF_CPP_VSCAN_FUNC],
445 if test -n "$CXX"; then
449 AC_CHECK_HEADERS(strstream.h)
451 AC_CACHE_CHECK(if $CXX supports vscan function,cf_cv_cpp_vscan_func,[
452 for cf_vscan_func in strstream strstream_cast stdio
454 case $cf_vscan_func in #(vi
455 stdio) cf_vscan_defs=USE_STDIO_VSCAN ;; #(vi
456 strstream) cf_vscan_defs=USE_STRSTREAM_VSCAN ;;
457 strstream_cast) cf_vscan_defs=USE_STRSTREAM_VSCAN_CAST ;;
462 #define $cf_vscan_defs 1
463 #if defined(USE_STDIO_VSCAN)
464 #elif defined(HAVE_STRSTREAM_H) && defined(USE_STRSTREAM_VSCAN)
465 #include <strstream.h>
468 int scanw(const char* fmt, ...)
475 #if defined(USE_STDIO_VSCAN)
476 if (::vsscanf(buf, fmt, args) != -1)
478 #elif defined(USE_STRSTREAM_VSCAN)
479 strstreambuf ss(buf, sizeof(buf));
480 if (ss.vscan(fmt, args) != -1)
482 #elif defined(USE_STRSTREAM_VSCAN_CAST)
483 strstreambuf ss(buf, sizeof(buf));
484 if (ss.vscan(fmt, (_IO_va_list)args) != -1)
487 #error case $cf_vscan_func failed
492 ],[int tmp, foo = scanw("%d", &tmp)],
493 [cf_cv_cpp_vscan_func=$cf_vscan_func; break],
494 [cf_cv_cpp_vscan_func=no])
495 test "$cf_cv_cpp_vscan_func" != no && break
502 case $cf_cv_cpp_vscan_func in #(vi
504 AC_DEFINE(CPP_HAS_VSCAN_FUNC)
505 AC_DEFINE(USE_STDIO_VSCAN)
508 AC_DEFINE(CPP_HAS_VSCAN_FUNC)
509 AC_DEFINE(USE_STRSTREAM_VSCAN)
512 AC_DEFINE(CPP_HAS_VSCAN_FUNC)
513 AC_DEFINE(USE_STRSTREAM_VSCAN_CAST)
517 dnl ---------------------------------------------------------------------------
518 dnl "dirname" is not portable, so we fake it with a shell script.
519 AC_DEFUN([CF_DIRNAME],[$1=`echo $2 | sed -e 's:/[[^/]]*$::'`])dnl
520 dnl ---------------------------------------------------------------------------
521 AC_DEFUN([CF_DIRS_TO_MAKE],
524 for cf_item in $cf_list_models
526 CF_OBJ_SUBDIR($cf_item,cf_subdir)
527 for cf_item2 in $DIRS_TO_MAKE
529 test $cf_item2 = $cf_subdir && break
531 test ".$cf_item2" != ".$cf_subdir" && DIRS_TO_MAKE="$DIRS_TO_MAKE $cf_subdir"
533 for cf_dir in $DIRS_TO_MAKE
535 test ! -d $cf_dir && mkdir $cf_dir
537 AC_SUBST(DIRS_TO_MAKE)
539 dnl ---------------------------------------------------------------------------
540 dnl Check if 'errno' is declared in <errno.h>
543 CF_CHECK_ERRNO(errno)
545 dnl ---------------------------------------------------------------------------
546 dnl Test for conflicting definitions of exception in gcc 2.8.0, etc., between
547 dnl math.h and builtin.h, only for ncurses
548 AC_DEFUN([CF_ETIP_DEFINES],
550 AC_MSG_CHECKING(for special defines needed for etip.h)
551 cf_save_CXXFLAGS="$CXXFLAGS"
553 for cf_math in "" MATH_H
555 for cf_excp in "" MATH_EXCEPTION
557 CXXFLAGS="$cf_save_CXXFLAGS -I${srcdir}/c++ -I${srcdir}/menu"
558 test -n "$cf_math" && CXXFLAGS="$CXXFLAGS -DETIP_NEEDS_${cf_math}"
559 test -n "$cf_excp" && CXXFLAGS="$CXXFLAGS -DETIP_NEEDS_${cf_excp}"
563 test -n "$cf_math" && AC_DEFINE_UNQUOTED(ETIP_NEEDS_${cf_math})
564 test -n "$cf_excp" && AC_DEFINE_UNQUOTED(ETIP_NEEDS_${cf_excp})
565 cf_result="$cf_math $cf_excp"
570 AC_MSG_RESULT($cf_result)
571 CXXFLAGS="$cf_save_CXXFLAGS"
573 dnl ---------------------------------------------------------------------------
574 dnl Check for memmove, or a bcopy that can handle overlapping copy. If neither
575 dnl is found, add our own version of memmove to the list of objects.
576 AC_DEFUN([CF_FUNC_MEMMOVE],
578 AC_CHECK_FUNC(memmove,,[
579 AC_CHECK_FUNC(bcopy,[
580 AC_CACHE_CHECK(if bcopy does overlapping moves,cf_cv_good_bcopy,[
583 static char data[] = "abcdefghijklmnopqrstuwwxyz";
585 bcopy(data, temp, sizeof(data));
586 bcopy(temp+10, temp, 15);
587 bcopy(temp+5, temp+15, 10);
588 exit (strcmp(temp, "klmnopqrstuwwxypqrstuwwxyz"));
591 [cf_cv_good_bcopy=yes],
592 [cf_cv_good_bcopy=no],
593 [cf_cv_good_bcopy=unknown])
595 ],[cf_cv_good_bcopy=no])
596 if test "$cf_cv_good_bcopy" = yes ; then
597 AC_DEFINE(USE_OK_BCOPY)
599 AC_DEFINE(USE_MY_MEMMOVE)
602 dnl ---------------------------------------------------------------------------
603 dnl See if the poll function really works. Some platforms have poll(), but
604 dnl it does not work for terminals or files.
605 AC_DEFUN([CF_FUNC_POLL],[
606 AC_CACHE_CHECK(if poll really works,cf_cv_working_poll,[
612 #include <sys/poll.h>
619 myfds.events = POLLIN;
621 ret = poll(&myfds, 1, 100);
624 [cf_cv_working_poll=yes],
625 [cf_cv_working_poll=no],
626 [cf_cv_working_poll=unknown])])
627 test "$cf_cv_working_poll" = "yes" && AC_DEFINE(HAVE_WORKING_POLL)
629 dnl ---------------------------------------------------------------------------
630 dnl Some old/broken variations define tcgetattr() only as a macro in
632 AC_DEFUN([CF_FUNC_TERMIOS],[
633 AC_REQUIRE([CF_STRUCT_TERMIOS])
634 AC_CACHE_CHECK(for tcgetattr, cf_cv_have_tcgetattr,[
636 #include <sys/types.h>
640 #ifdef HAVE_TERMIOS_H
642 #define TTY struct termios
646 #define TTY struct termio
651 tcgetattr(1, &foo);],
652 [cf_cv_have_tcgetattr=yes],
653 [cf_cv_have_tcgetattr=no])])
654 test "$cf_cv_have_tcgetattr" = yes && AC_DEFINE(HAVE_TCGETATTR)
656 dnl ---------------------------------------------------------------------------
657 dnl Check for vsscanf() function, which is in c9x but generally not in earlier
658 dnl versions of C. It is in the GNU C library, and can often be simulated by
660 AC_DEFUN([CF_FUNC_VSSCANF],
662 AC_CACHE_CHECK(for vsscanf function or workaround,cf_cv_func_vsscanf,[
665 #include <stdio.h>],[
667 vsscanf("from", "%d", ap)],[cf_cv_func_vsscanf=vsscanf],[
670 #include <stdio.h>],[
674 strbuf._flag = _IOREAD;
675 strbuf._ptr = strbuf._base = (unsigned char *) str;
676 strbuf._cnt = strlen(str);
677 strbuf._file = _NFILE;
678 return (vfscanf(&strbuf, "%d", ap))],[cf_cv_func_vsscanf=vfscanf],[
681 #include <stdio.h>],[
685 strbuf._flag = _IOREAD;
686 strbuf._ptr = strbuf._base = (unsigned char *) str;
687 strbuf._cnt = strlen(str);
688 strbuf._file = _NFILE;
689 return (_doscan(&strbuf, "%d", ap))],[cf_cv_func_vsscanf=_doscan],[
690 cf_cv_func_vsscanf=no])])])])
692 case $cf_cv_func_vsscanf in #(vi
693 vsscanf) AC_DEFINE(HAVE_VSSCANF);; #(vi
694 vfscanf) AC_DEFINE(HAVE_VFSCANF);; #(vi
695 _doscan) AC_DEFINE(HAVE__DOSCAN);;
699 dnl ---------------------------------------------------------------------------
700 dnl Test for availability of useful gcc __attribute__ directives to quiet
701 dnl compiler warnings. Though useful, not all are supported -- and contrary
702 dnl to documentation, unrecognized directives cause older compilers to barf.
703 AC_DEFUN([CF_GCC_ATTRIBUTES],
707 cat > conftest.i <<EOF
715 #define GCC_NORETURN /* nothing */
718 #define GCC_UNUSED /* nothing */
723 AC_CHECKING([for $CC __attribute__ directives])
724 cat > conftest.$ac_ext <<EOF
725 #line __oline__ "configure"
726 #include "confdefs.h"
727 #include "conftest.h"
728 #include "conftest.i"
730 #define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
732 #define GCC_PRINTFLIKE(fmt,var) /*nothing*/
735 #define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var)))
737 #define GCC_SCANFLIKE(fmt,var) /*nothing*/
739 extern void wow(char *,...) GCC_SCANFLIKE(1,2);
740 extern void oops(char *,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN;
741 extern void foo(void) GCC_NORETURN;
742 int main(int argc GCC_UNUSED, char *argv[[]] GCC_UNUSED) { return 0; }
744 for cf_attribute in scanf printf unused noreturn
746 CF_UPPER(CF_ATTRIBUTE,$cf_attribute)
747 cf_directive="__attribute__(($cf_attribute))"
748 echo "checking for $CC $cf_directive" 1>&AC_FD_CC
749 case $cf_attribute in
751 cat >conftest.h <<EOF
752 #define GCC_$CF_ATTRIBUTE 1
756 cat >conftest.h <<EOF
757 #define GCC_$CF_ATTRIBUTE $cf_directive
761 if AC_TRY_EVAL(ac_compile); then
762 test -n "$verbose" && AC_MSG_RESULT(... $cf_attribute)
763 cat conftest.h >>confdefs.h
765 # sed -e 's/__attr.*/\/*nothing*\//' conftest.h >>confdefs.h
769 fgrep define conftest.i >>confdefs.h
774 dnl ---------------------------------------------------------------------------
775 dnl Check if the compiler supports useful warning options. There's a few that
776 dnl we don't use, simply because they're too noisy:
778 dnl -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x)
779 dnl -Wredundant-decls (system headers make this too noisy)
780 dnl -Wtraditional (combines too many unrelated messages, only a few useful)
781 dnl -Wwrite-strings (too noisy, but should review occasionally)
784 AC_DEFUN([CF_GCC_WARNINGS],
788 cat > conftest.$ac_ext <<EOF
789 #line __oline__ "configure"
790 int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; }
792 AC_CHECKING([for $CC warning options])
793 cf_save_CFLAGS="$CFLAGS"
794 EXTRA_CFLAGS="-W -Wall"
796 test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings"
802 Wmissing-declarations \
803 Wmissing-prototypes \
808 Wundef $cf_warn_CONST
810 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
811 if AC_TRY_EVAL(ac_compile); then
812 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
813 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
814 test "$cf_opt" = Wcast-qual && EXTRA_CFLAGS="$EXTRA_CFLAGS -DXTSTRINGDEFINES"
818 CFLAGS="$cf_save_CFLAGS"
820 AC_SUBST(EXTRA_CFLAGS)
822 dnl ---------------------------------------------------------------------------
823 dnl Verify that a test program compiles and runs with GNAT
824 dnl $cf_ada_make is set to the program that compiles/links
825 AC_DEFUN([CF_GNAT_TRY_RUN],
828 cat >>conftest.ads <<CF_EOF
831 cat >>conftest.adb <<CF_EOF
834 if ( $cf_ada_make conftest 1>&AC_FD_CC 2>&1 ) ; then
835 if ( ./conftest 1>&AC_FD_CC 2>&1 ) ; then
845 dnl ---------------------------------------------------------------------------
846 dnl Verify Version of GNAT.
847 AC_DEFUN([CF_GNAT_VERSION],
849 cf_cv_gnat_version=`$cf_ada_make -v 2>&1 | grep '[[0-9]].[[0-9]][[0-9]]*' |\
850 sed -e 's/[[^0-9 \.]]//g' | $AWK '{print $[1];}'`
851 case $cf_cv_gnat_version in
852 3.1[[1-9]]*|3.[[2-9]]*|[[4-9]].*)
853 cf_cv_prog_gnat_correct=yes
855 *) echo Unsupported GNAT version $cf_cv_gnat_version. Required is 3.11 or better. Disabling Ada95 binding.
856 cf_cv_prog_gnat_correct=no
859 case $cf_cv_gnat_version in
861 cf_compile_generics=generics
862 cf_generic_objects="\$(GENOBJS)"
864 *) cf_compile_generics=
869 dnl ---------------------------------------------------------------------------
870 dnl Check if we must define _GNU_SOURCE to get a reasonable value for
871 dnl _XOPEN_SOURCE, upon which many POSIX definitions depend. This is a defect
872 dnl (or misfeature) of glibc2, which breaks portability of many applications,
873 dnl since it is interwoven with GNU extensions.
875 dnl Well, yes we could work around it...
876 AC_DEFUN([CF_GNU_SOURCE],
878 AC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[
879 AC_TRY_COMPILE([#include <sys/types.h>],[
880 #ifndef _XOPEN_SOURCE
883 [cf_cv_gnu_source=no],
885 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
886 AC_TRY_COMPILE([#include <sys/types.h>],[
890 [cf_cv_gnu_source=no],
891 [cf_cv_gnu_source=yes])
895 test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
897 dnl ---------------------------------------------------------------------------
898 dnl If we're trying to use g++, test if libg++ is installed (a rather common
899 dnl problem :-). If we have the compiler but no library, we'll be able to
900 dnl configure, but won't be able to build the c++ demo program.
901 AC_DEFUN([CF_GPP_LIBRARY],
903 cf_cxx_library=unknown
904 case $cf_cv_system_name in #(vi
912 if test "$ac_cv_prog_gxx" = yes; then
913 AC_MSG_CHECKING([for lib$cf_gpp_libname])
915 LIBS="$LIBS -l$cf_gpp_libname"
917 #include <$cf_gpp_libname/builtin.h>
919 [two_arg_error_handler_t foo2 = lib_error_handler],
921 CXXLIBS="$CXXLIBS -l$cf_gpp_libname"
922 if test "$cf_gpp_libname" = cpp ; then
923 AC_DEFINE(HAVE_GPP_BUILTIN_H)
925 AC_DEFINE(HAVE_GXX_BUILTIN_H)
930 [two_arg_error_handler_t foo2 = lib_error_handler],
932 CXXLIBS="$CXXLIBS -l$cf_gpp_libname"
933 AC_DEFINE(HAVE_BUILTIN_H)],
934 [cf_cxx_library=no])])
936 AC_MSG_RESULT($cf_cxx_library)
939 dnl ---------------------------------------------------------------------------
940 dnl Insert text into the help-message, for readability, from AC_ARG_WITH.
941 AC_DEFUN([CF_HELP_MESSAGE],
942 [AC_DIVERT_HELP([$1])dnl
944 dnl ---------------------------------------------------------------------------
945 dnl Construct the list of include-options according to whether we're building
946 dnl in the source directory or using '--srcdir=DIR' option. If we're building
947 dnl with gcc, don't append the includedir if it happens to be /usr/include,
948 dnl since that usually breaks gcc's shadow-includes.
949 AC_DEFUN([CF_INCLUDE_DIRS],
951 CPPFLAGS="$CPPFLAGS -I. -I../include"
952 if test "$srcdir" != "."; then
953 CPPFLAGS="$CPPFLAGS -I\$(srcdir)/../include"
955 if test "$GCC" != yes; then
956 CPPFLAGS="$CPPFLAGS -I\$(includedir)"
957 elif test "$includedir" != "/usr/include"; then
958 if test "$includedir" = '${prefix}/include' ; then
959 if test $prefix != /usr ; then
960 CPPFLAGS="$CPPFLAGS -I\$(includedir)"
963 CPPFLAGS="$CPPFLAGS -I\$(includedir)"
968 dnl ---------------------------------------------------------------------------
969 dnl Check if we have either a function or macro for 'isascii()'.
970 AC_DEFUN([CF_ISASCII],
972 AC_MSG_CHECKING(for isascii)
973 AC_CACHE_VAL(cf_cv_have_isascii,[
974 AC_TRY_LINK([#include <ctype.h>],[int x = isascii(' ')],
975 [cf_cv_have_isascii=yes],
976 [cf_cv_have_isascii=no])
978 AC_MSG_RESULT($cf_cv_have_isascii)
979 test "$cf_cv_have_isascii" = yes && AC_DEFINE(HAVE_ISASCII)
981 dnl ---------------------------------------------------------------------------
982 dnl Check for libutf8
983 AC_DEFUN([CF_LIBUTF8],
985 AC_CACHE_CHECK(for putwc in libutf8,cf_cv_libutf8,[
989 #include <libutf8.h>],[putwc(0,0);],
995 if test "$cf_cv_libutf8" = yes ; then
996 AC_DEFINE(HAVE_LIBUTF8_H)
1000 dnl ---------------------------------------------------------------------------
1001 dnl Compute the library-prefix for the given host system
1002 dnl $1 = variable to set
1003 AC_DEFUN([CF_LIB_PREFIX],
1005 case $cf_cv_system_name in
1006 OS/2*) LIB_PREFIX='' ;;
1007 os2*) LIB_PREFIX='' ;;
1008 *) LIB_PREFIX='lib' ;;
1010 ifelse($1,,,[$1=$LIB_PREFIX])
1011 AC_SUBST(LIB_PREFIX)
1013 dnl ---------------------------------------------------------------------------
1014 dnl Append definitions and rules for the given models to the subdirectory
1015 dnl Makefiles, and the recursion rule for the top-level Makefile. If the
1016 dnl subdirectory is a library-source directory, modify the LIBRARIES list in
1017 dnl the corresponding makefile to list the models that we'll generate.
1019 dnl For shared libraries, make a list of symbolic links to construct when
1020 dnl generating each library. The convention used for Linux is the simplest
1023 dnl lib<name>.so.<major> ->
1024 dnl lib<name>.so.<maj>.<minor>
1025 AC_DEFUN([CF_LIB_RULES],
1027 CF_LIB_PREFIX(cf_prefix)
1028 AC_REQUIRE([CF_SUBST_NCURSES_VERSION])
1029 for cf_dir in $SRC_SUBDIRS
1031 if test -f $srcdir/$cf_dir/modules; then
1036 for cf_item in $CF_LIST_MODELS
1038 CF_LIB_SUFFIX($cf_item,cf_suffix)
1039 if test $cf_item = shared ; then
1040 if test "$cf_cv_do_symlinks" = yes ; then
1041 case "$cf_cv_shlib_version" in #(vi
1043 case "$cf_cv_system_name" in #(vi
1044 darwin*) cf_suffix='.$(REL_VERSION)'"$cf_suffix" ;; #(vi
1045 *) cf_suffix="$cf_suffix"'.$(REL_VERSION)' ;;
1049 case "$cf_cv_system_name" in #(vi
1050 darwin*) cf_suffix='.$(ABI_VERSION)'"$cf_suffix" ;; #(vi
1051 *) cf_suffix="$cf_suffix"'.$(ABI_VERSION)' ;;
1056 # cygwin needs import library, and has unique naming convention
1057 if test $cf_cv_shlib_version = cygdll ; then
1058 SHARED_LIB="../lib/${cf_prefix}${cf_dir}\$(ABI_VERSION).dll"
1059 IMPORT_LIB="../lib/${cf_prefix}${cf_dir}.dll.a"
1060 LIBS_TO_MAKE="$LIBS_TO_MAKE \$(SHARED_LIB) \$(IMPORT_LIB)"
1064 LIBS_TO_MAKE="$LIBS_TO_MAKE ../lib/${cf_prefix}${cf_dir}${cf_suffix}"
1067 if test $cf_dir = ncurses ; then
1068 cf_subsets="$LIB_SUBSETS"
1069 case "$LIB_SUBSETS" in #(vi
1073 cf_item=`echo $LIBS_TO_MAKE |sed -e s/$LIB_NAME/$TINFO_NAME/g`
1074 LIBS_TO_MAKE="$cf_item $LIBS_TO_MAKE"
1078 cf_subsets=`echo "$LIB_SUBSETS" | sed -e 's/^termlib //'`
1081 sed -e "s%@LIBS_TO_MAKE@%$LIBS_TO_MAKE%" \
1082 -e "s%@IMPORT_LIB@%$IMPORT_LIB%" \
1083 -e "s%@SHARED_LIB@%$SHARED_LIB%" \
1084 $cf_dir/Makefile >$cf_dir/Makefile.out
1085 mv $cf_dir/Makefile.out $cf_dir/Makefile
1087 $AWK -f $srcdir/mk-0th.awk \
1088 libname="${cf_dir}${LIB_SUFFIX}" subsets="$LIB_SUBSETS" \
1089 $srcdir/$cf_dir/modules >>$cf_dir/Makefile
1091 for cf_subset in $cf_subsets
1094 for cf_item in $CF_LIST_MODELS
1096 echo "Appending rules for ${cf_item} model (${cf_dir}: ${cf_subset})"
1097 CF_UPPER(CF_ITEM,$cf_item)
1098 CF_LIB_SUFFIX($cf_item,cf_suffix)
1099 CF_OBJ_SUBDIR($cf_item,cf_subdir)
1101 # These dependencies really are for development, not
1102 # builds, but they are useful in porting, too.
1103 cf_depend="../include/ncurses_cfg.h"
1104 if test "$srcdir" = "."; then
1107 cf_reldir="\$(srcdir)"
1110 if test -f $srcdir/$cf_dir/$cf_dir.priv.h; then
1111 cf_depend="$cf_depend $cf_reldir/$cf_dir.priv.h"
1112 elif test -f $srcdir/$cf_dir/curses.priv.h; then
1113 cf_depend="$cf_depend $cf_reldir/curses.priv.h"
1116 $AWK -f $srcdir/mk-1st.awk \
1118 traces=$LIB_TRACING \
1124 ShlibVer=$cf_cv_shlib_version \
1125 ShlibVerInfix=$cf_cv_shlib_version_infix \
1126 DoLinks=$cf_cv_do_symlinks \
1127 rmSoLocs=$cf_cv_rm_so_locs \
1128 ldconfig="$LDCONFIG" \
1129 overwrite=$WITH_OVERWRITE \
1130 depend="$cf_depend" \
1132 $srcdir/$cf_dir/modules >>$cf_dir/Makefile
1133 for cf_subdir2 in $cf_subdirs lib
1135 test $cf_subdir = $cf_subdir2 && break
1137 test "${cf_subset}.${cf_subdir2}" != "${cf_subset}.${cf_subdir}" && \
1138 $AWK -f $srcdir/mk-2nd.awk \
1140 traces=$LIB_TRACING \
1146 $srcdir/$cf_dir/modules >>$cf_dir/Makefile
1147 cf_subdirs="$cf_subdirs $cf_subdir"
1152 echo ' cd '$cf_dir' && $(MAKE) $(CF_MFLAGS) [$]@' >>Makefile
1155 for cf_dir in $SRC_SUBDIRS
1157 if test -f $cf_dir/Makefile ; then
1160 echo 'libs \' >> Makefile
1161 echo 'install.libs \' >> Makefile
1162 echo 'uninstall.libs ::' >> Makefile
1163 echo ' cd '$cf_dir' && $(MAKE) $(CF_MFLAGS) [$]@' >> Makefile
1168 if test -f $srcdir/$cf_dir/modules; then
1170 if test -f $srcdir/$cf_dir/headers; then
1171 cat >> Makefile <<CF_EOF
1173 uninstall.includes \\
1176 if test "$cf_dir" != "c++" ; then
1177 echo 'lint \' >> Makefile
1179 cat >> Makefile <<CF_EOF
1185 uninstall.$cf_dir ::
1186 cd $cf_dir && \$(MAKE) \$(CF_MFLAGS) \[$]@
1188 elif test -f $srcdir/$cf_dir/headers; then
1189 cat >> Makefile <<CF_EOF
1195 uninstall.includes ::
1196 cd $cf_dir && \$(MAKE) \$(CF_MFLAGS) \[$]@
1201 cat >> Makefile <<CF_EOF
1205 $MAKE_TERMINFO cd misc && \$(MAKE) \$(CF_MFLAGS) \[$]@
1209 cd man && \$(MAKE) \$(CF_MFLAGS) \[$]@
1212 rm -f config.cache config.log config.status Makefile include/ncurses_cfg.h
1213 rm -f headers.sh headers.sed
1214 rm -rf \$(DIRS_TO_MAKE)
1217 # Special case: tack's manpage lives in its own directory.
1218 if test -d tack ; then
1219 if test -f $srcdir/$tack.h; then
1220 cat >> Makefile <<CF_EOF
1224 cd tack && \$(MAKE) \$(CF_MFLAGS) \[$]@
1229 dnl If we're installing into a subdirectory of /usr/include, etc., we should
1230 dnl prepend the subdirectory's name to the "#include" paths. It won't hurt
1231 dnl anything, and will make it more standardized. It's awkward to decide this
1232 dnl at configuration because of quoting, so we'll simply make all headers
1233 dnl installed via a script that can do the right thing.
1235 rm -f headers.sed headers.sh
1237 dnl ( generating this script makes the makefiles a little tidier :-)
1238 echo creating headers.sh
1239 cat >headers.sh <<CF_EOF
1241 # This shell script is generated by the 'configure' script. It is invoked in a
1242 # subdirectory of the build tree. It generates a sed-script in the parent
1243 # directory that is used to adjust includes for header files that reside in a
1244 # subdirectory of /usr/include, etc.
1246 while test \[$]# != 3
1248 PRG="\$PRG \[$]1"; shift
1253 TMPSRC=\${TMPDIR-/tmp}/\`basename \$SRC\`\$\$
1254 TMPSED=\${TMPDIR-/tmp}/headers.sed\$\$
1255 echo installing \$SRC in \$DST
1257 if test $WITH_CURSES_H = yes; then
1258 cat >>headers.sh <<CF_EOF
1261 END=\`basename \$DST\`
1262 for i in \`cat \$REF/../*/headers |fgrep -v "#"\`
1264 NAME=\`basename \$i\`
1265 echo "s/<\$NAME>/<\$END\/\$NAME>/" >> \$TMPSED
1274 cat >>headers.sh <<CF_EOF
1277 END=\`basename \$DST\`
1278 for i in \`cat \$REF/../*/headers |fgrep -v "#"\`
1280 NAME=\`basename \$i\`
1281 if test "\$NAME" = "curses.h"
1283 echo "s/<curses.h>/<ncurses.h>/" >> \$TMPSED
1286 echo "s/<\$NAME>/<\$END\/\$NAME>/" >> \$TMPSED
1290 echo "s/<curses.h>/<ncurses.h>/" >> \$TMPSED
1295 cat >>headers.sh <<CF_EOF
1297 sed -f \$TMPSED \$SRC > \$TMPSRC
1298 NAME=\`basename \$SRC\`
1300 if test $WITH_CURSES_H != yes; then
1301 cat >>headers.sh <<CF_EOF
1302 test "\$NAME" = "curses.h" && NAME=ncurses.h
1305 cat >>headers.sh <<CF_EOF
1306 # Just in case someone gzip'd manpages, remove the conflicting copy.
1307 test -f \$DST/\$NAME.gz && rm -f \$DST/\$NAME.gz
1309 eval \$PRG \$TMPSRC \$DST/\$NAME
1310 rm -f \$TMPSRC \$TMPSED
1313 chmod 0755 headers.sh
1315 for cf_dir in $SRC_SUBDIRS
1317 if test -f $srcdir/$cf_dir/headers; then
1318 cat >>$cf_dir/Makefile <<CF_EOF
1319 \$(DESTDIR)\$(includedir) :
1320 sh \$(srcdir)/../mkinstalldirs \[$]@
1324 install.includes :: \$(AUTO_SRC) \$(DESTDIR)\$(includedir) \\
1327 for i in `cat $srcdir/$cf_dir/headers |fgrep -v "#"`
1329 test -n "$j" && echo " $j \\" >>$cf_dir/Makefile
1332 echo " $j" >>$cf_dir/Makefile
1333 for i in `cat $srcdir/$cf_dir/headers |fgrep -v "#"`
1335 echo " @ (cd \$(DESTDIR)\$(includedir) && rm -f `basename $i`) ; ../headers.sh \$(INSTALL_DATA) \$(DESTDIR)\$(includedir) \$(srcdir) $i" >>$cf_dir/Makefile
1336 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
1339 cat >>$cf_dir/Makefile <<CF_EOF
1343 uninstall.includes ::
1345 for i in `cat $srcdir/$cf_dir/headers |fgrep -v "#"`
1348 echo " -@ (cd \$(DESTDIR)\$(includedir) && rm -f $i)" >>$cf_dir/Makefile
1349 test $i = curses.h && echo " -@ (cd \$(DESTDIR)\$(includedir) && rm -f ncurses.h)" >>$cf_dir/Makefile
1353 if test -f $srcdir/$cf_dir/modules; then
1354 if test "$cf_dir" != "c++" ; then
1355 cat >>$cf_dir/Makefile <<"CF_EOF"
1356 depend : $(AUTO_SRC)
1357 makedepend -- $(CPPFLAGS) -- $(C_SRC)
1359 # DO NOT DELETE THIS LINE -- make depend depends on it.
1366 dnl ---------------------------------------------------------------------------
1367 dnl Compute the library file-suffix from the given model name
1369 dnl $2 = variable to set
1370 dnl The variable $LIB_SUFFIX, if set, prepends the variable to set.
1371 AC_DEFUN([CF_LIB_SUFFIX],
1373 AC_REQUIRE([CF_SUBST_NCURSES_VERSION])
1375 libtool) $2='.la' ;;
1378 profile) $2='_p.a' ;;
1380 case $cf_cv_system_name in
1381 cygwin*) $2='.dll' ;;
1382 darwin*) $2='.dylib' ;;
1387 test -n "$LIB_SUFFIX" && $2="${LIB_SUFFIX}[$]{$2}"
1389 dnl ---------------------------------------------------------------------------
1390 dnl Compute the string to append to -library from the given model name
1392 dnl $2 = variable to set
1393 dnl The variable $LIB_SUFFIX, if set, prepends the variable to set.
1394 AC_DEFUN([CF_LIB_TYPE],
1403 test -n "$LIB_SUFFIX" && $2="${LIB_SUFFIX}[$]{$2}"
1405 dnl ---------------------------------------------------------------------------
1406 dnl Some systems have a non-ANSI linker that doesn't pull in modules that have
1407 dnl only data (i.e., no functions), for example NeXT. On those systems we'll
1408 dnl have to provide wrappers for global tables to ensure they're linked
1410 AC_DEFUN([CF_LINK_DATAONLY],
1412 AC_MSG_CHECKING([if data-only library module links])
1413 AC_CACHE_VAL(cf_cv_link_dataonly,[
1415 cat >conftest.$ac_ext <<EOF
1416 #line __oline__ "configure"
1417 int testdata[[3]] = { 123, 456, 789 };
1419 if AC_TRY_EVAL(ac_compile) ; then
1420 mv conftest.o data.o && \
1421 ( $AR $AR_OPTS conftest.a data.o ) 2>&5 1>/dev/null
1423 rm -f conftest.$ac_ext data.o
1424 cat >conftest.$ac_ext <<EOF
1425 #line __oline__ "configure"
1429 exit(1); /* I'm told this linker is broken */
1431 extern int testdata[[3]];
1432 return testdata[[0]] == 123
1433 && testdata[[1]] == 456
1434 && testdata[[2]] == 789;
1438 if AC_TRY_EVAL(ac_compile); then
1439 mv conftest.o func.o && \
1440 ( $AR $AR_OPTS conftest.a func.o ) 2>&5 1>/dev/null
1442 rm -f conftest.$ac_ext func.o
1443 ( eval $ac_cv_prog_RANLIB conftest.a ) 2>&5 >/dev/null
1445 LIBS="conftest.a $LIBS"
1449 extern int testfunc();
1453 [cf_cv_link_dataonly=yes],
1454 [cf_cv_link_dataonly=no],
1455 [cf_cv_link_dataonly=unknown])
1458 AC_MSG_RESULT($cf_cv_link_dataonly)
1460 if test "$cf_cv_link_dataonly" = no ; then
1461 AC_DEFINE(BROKEN_LINKER)
1466 dnl ---------------------------------------------------------------------------
1467 dnl Most Unix systems have both link and symlink, a few don't have symlink.
1468 dnl A few non-Unix systems implement symlink, but not link.
1469 dnl A few non-systems implement neither (or have nonfunctional versions).
1470 AC_DEFUN([CF_LINK_FUNCS],
1476 if test "$ac_cv_prog_cc_cross" = yes ; then
1481 AC_CACHE_CHECK(if link/symlink functions work,cf_cv_link_funcs,[
1483 for cf_func in link symlink ; do
1485 #include <sys/types.h>
1486 #include <sys/stat.h>
1487 #ifdef HAVE_UNISTD_H
1493 char *src = "config.log";
1494 char *dst = "conftest.chk";
1499 fail = ($cf_func("config.log", "conftest.chk") < 0)
1500 || (stat(dst, &dst_sb) < 0)
1501 || (dst_sb.st_mtime != src_sb.st_mtime);
1510 cf_cv_link_funcs="$cf_cv_link_funcs $cf_func"
1511 eval 'ac_cv_func_'$cf_func'=yes'],[
1512 eval 'ac_cv_func_'$cf_func'=no'],[
1513 eval 'ac_cv_func_'$cf_func'=error'])
1515 test -z "$cf_cv_link_funcs" && cf_cv_link_funcs=no
1517 test "$ac_cv_func_link" = yes && AC_DEFINE(HAVE_LINK)
1518 test "$ac_cv_func_symlink" = yes && AC_DEFINE(HAVE_SYMLINK)
1521 dnl ---------------------------------------------------------------------------
1522 dnl Some 'make' programs support $(MAKEFLAGS), some $(MFLAGS), to pass 'make'
1523 dnl options to lower-levels. It's very useful for "make -n" -- if we have it.
1524 dnl (GNU 'make' does both, something POSIX 'make', which happens to make the
1525 dnl $(MAKEFLAGS) variable incompatible because it adds the assignments :-)
1526 AC_DEFUN([CF_MAKEFLAGS],
1528 AC_CACHE_CHECK(for makeflags variable, cf_cv_makeflags,[
1530 for cf_option in '-$(MAKEFLAGS)' '$(MFLAGS)'
1532 cat >cf_makeflags.tmp <<CF_EOF
1535 @ echo '.$cf_option'
1537 cf_result=`${MAKE-make} -k -f cf_makeflags.tmp 2>/dev/null`
1538 case "$cf_result" in
1540 cf_result=`${MAKE-make} -k -f cf_makeflags.tmp CC=cc 2>/dev/null`
1541 case "$cf_result" in
1542 .*CC=*) cf_cv_makeflags=
1544 *) cf_cv_makeflags=$cf_option
1549 *) echo no match "$cf_result"
1553 rm -f cf_makeflags.tmp
1556 AC_SUBST(cf_cv_makeflags)
1558 dnl ---------------------------------------------------------------------------
1559 dnl Generate tags/TAGS targets for makefiles. Do not generate TAGS if we have
1560 dnl a monocase filesystem.
1561 AC_DEFUN([CF_MAKE_TAGS],[
1562 AC_REQUIRE([CF_MIXEDCASE_FILENAMES])
1563 AC_CHECK_PROG(MAKE_LOWER_TAGS, ctags, yes, no)
1565 if test "$cf_cv_mixedcase" = yes ; then
1566 AC_CHECK_PROG(MAKE_UPPER_TAGS, etags, yes, no)
1571 if test "$MAKE_UPPER_TAGS" = yes ; then
1576 AC_SUBST(MAKE_UPPER_TAGS)
1578 if test "$MAKE_LOWER_TAGS" = yes ; then
1583 AC_SUBST(MAKE_LOWER_TAGS)
1585 dnl ---------------------------------------------------------------------------
1586 dnl Option to allow user to override automatic configuration of manpage format.
1587 dnl There are several special cases.
1588 AC_DEFUN([CF_MANPAGE_FORMAT],
1590 AC_REQUIRE([CF_PATHSEP])
1591 AC_MSG_CHECKING(format of man-pages)
1593 AC_ARG_WITH(manpage-format,
1594 [ --with-manpage-format specify manpage-format: gzip/compress/BSDI/normal and
1595 optionally formatted, e.g., gzip,formatted],
1596 [MANPAGE_FORMAT=$withval],
1597 [MANPAGE_FORMAT=unknown])
1599 case ".$MANPAGE_FORMAT" in
1600 .gzip|.compress|.BSDI|.normal|.formatted) # (vi
1603 if test -z "$MANPATH" ; then
1604 MANPATH="/usr/man:/usr/share/man"
1606 # look for the 'date' man-page (it's most likely to be installed!)
1607 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATHSEP}"
1608 MANPAGE_FORMAT=unknown
1609 for cf_dir in $MANPATH; do
1610 test -z "$cf_dir" && cf_dir=/usr/man
1611 for cf_name in $cf_dir/*/date.[[01]]* $cf_dir/*/date
1613 cf_test=`echo $cf_name | sed -e 's/*//'`
1614 if test "x$cf_test" = "x$cf_name" ; then
1616 *.gz) MANPAGE_FORMAT=gzip;;
1617 *.Z) MANPAGE_FORMAT=compress;;
1618 *.0) MANPAGE_FORMAT=BSDI,formatted;;
1619 *) MANPAGE_FORMAT=normal;;
1624 if test "$MANPAGE_FORMAT" != "unknown" ; then
1631 AC_MSG_WARN(Unexpected manpage-format)
1635 AC_MSG_RESULT($MANPAGE_FORMAT)
1637 dnl ---------------------------------------------------------------------------
1638 dnl The Debian people have their own naming convention for manpages. This
1639 dnl option lets us override the name of the file containing renaming, or
1640 dnl disable it altogether.
1641 AC_DEFUN([CF_MANPAGE_RENAMES],
1643 AC_MSG_CHECKING(for manpage renaming)
1645 AC_ARG_WITH(manpage-renames,
1646 [ --with-manpage-renames specify manpage-renaming],
1647 [MANPAGE_RENAMES=$withval],
1648 [MANPAGE_RENAMES=yes])
1650 case ".$MANPAGE_RENAMES" in #(vi
1654 # Debian 'man' program?
1655 if test -f /etc/debian_version ; then
1656 MANPAGE_RENAMES=`cd $srcdir && pwd`/man/man_db.renames
1663 if test "$MANPAGE_RENAMES" != no ; then
1664 if test -f $srcdir/man/$MANPAGE_RENAMES ; then
1665 MANPAGE_RENAMES=`cd $srcdir/man && pwd`/$MANPAGE_RENAMES
1666 elif test ! -f $MANPAGE_RENAMES ; then
1667 AC_MSG_ERROR(not a filename: $MANPAGE_RENAMES)
1670 test ! -d man && mkdir man
1672 # Construct a sed-script to perform renaming within man-pages
1673 if test -n "$MANPAGE_RENAMES" ; then
1674 test ! -d man && mkdir man
1675 sh $srcdir/man/make_sed.sh $MANPAGE_RENAMES >man/edit_man.sed
1679 AC_MSG_RESULT($MANPAGE_RENAMES)
1680 AC_SUBST(MANPAGE_RENAMES)
1682 dnl ---------------------------------------------------------------------------
1683 dnl Some people expect each tool to make all aliases for manpages in the
1684 dnl man-directory. This accommodates the older, less-capable implementations
1685 dnl of 'man', and is optional.
1686 AC_DEFUN([CF_MANPAGE_SYMLINKS],
1688 AC_MSG_CHECKING(for manpage symlinks)
1690 AC_ARG_WITH(manpage-symlinks,
1691 [ --with-manpage-symlinks specify manpage-symlinks],
1692 [MANPAGE_SYMLINKS=$withval],
1693 [MANPAGE_SYMLINKS=yes])
1695 AC_MSG_RESULT($MANPAGE_SYMLINKS)
1697 dnl ---------------------------------------------------------------------------
1698 dnl This option causes manpages to be run through tbl(1) to generate tables
1700 AC_DEFUN([CF_MANPAGE_TBL],
1702 AC_MSG_CHECKING(for manpage tbl)
1704 AC_ARG_WITH(manpage-tbl,
1705 [ --with-manpage-tbl specify manpage processing with tbl],
1706 [MANPAGE_TBL=$withval],
1709 AC_MSG_RESULT($MANPAGE_TBL)
1711 dnl ---------------------------------------------------------------------------
1712 dnl Try to determine if the man-pages on the system are compressed, and if
1713 dnl so, what format is used. Use this information to construct a script that
1714 dnl will install man-pages.
1715 AC_DEFUN([CF_MAN_PAGES],
1717 CF_HELP_MESSAGE(Options to Specify How Manpages are Installed:)
1723 if test "$prefix" = "NONE" ; then
1724 cf_prefix="$ac_default_prefix"
1729 case "$MANPAGE_FORMAT" in # (vi
1731 cf_subdir='$mandir/cat'
1735 cf_subdir='$mandir/man'
1740 test ! -d man && mkdir man
1741 cat >man/edit_man.sh <<CF_EOF
1743 # this script is generated by the configure-script
1746 NCURSES_OSPEED="$NCURSES_OSPEED"
1747 TERMINFO="$TERMINFO"
1748 MKDIRS="sh `cd $srcdir && pwd`/mkinstalldirs"
1750 INSTALL_DATA="$INSTALL_DATA"
1751 transform="$program_transform_name"
1753 TMP=\${TMPDIR-/tmp}/man\$\$
1754 trap "rm -f \$TMP" 0 1 2 5 15
1767 *.orig|*.rej) ;; #(vi
1769 section=\`expr "\$i" : '.*\\.\\([[0-9]]\\)[[xm]]*'\`;
1770 if test \$verb = installing ; then
1771 if test ! -d $cf_subdir\${section} ; then
1772 \$MKDIRS $cf_subdir\$section
1776 source=\`basename \$i\`
1778 test ! -f \$inalias && inalias="\$srcdir/\$inalias"
1779 if test ! -f \$inalias ; then
1780 echo .. skipped \$source
1784 if test "$MANPAGE_SYMLINKS" = yes ; then
1785 cat >>man/edit_man.sh <<CF_EOF
1786 aliases=\`sed -f \$srcdir/manlinks.sed \$inalias | sort -u\`
1790 if test "$MANPAGE_RENAMES" = no ; then
1791 cat >>man/edit_man.sh <<CF_EOF
1792 # perform program transformations for section 1 man pages
1793 if test \$section = 1 ; then
1794 target=$cf_subdir\${section}/\`echo \$source|sed "\${transform}"\`
1796 target=$cf_subdir\${section}/\$source
1800 cat >>man/edit_man.sh <<CF_EOF
1801 target=\`grep "^\$source" $MANPAGE_RENAMES | $AWK '{print \[$]2}'\`
1802 if test -z "\$target" ; then
1803 echo '? missing rename for '\$source
1806 target="$cf_subdir\${section}/\${target}"
1810 # replace variables in man page
1814 cat >>man/edit_man.sh <<CF_EOF
1815 prog_$cf_name=\`echo $cf_name|sed "\${transform}"\`
1819 cat >>man/edit_man.sh <<CF_EOF
1820 sed -e "s,@DATADIR@,\$datadir," \\
1821 -e "s,@TERMINFO@,\$TERMINFO," \\
1822 -e "s,@NCURSES_OSPEED@,\$NCURSES_OSPEED," \\
1827 cf_NAME=`echo "$cf_name" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
1828 cat >>man/edit_man.sh <<CF_EOF
1829 -e "s,@$cf_NAME@,\$prog_$cf_name," \\
1833 if test -f $MANPAGE_RENAMES ; then
1834 cat >>man/edit_man.sh <<CF_EOF
1835 < \$i | sed -f edit_man.sed >\$TMP
1838 cat >>man/edit_man.sh <<CF_EOF
1842 if test $MANPAGE_TBL = yes ; then
1843 cat >>man/edit_man.sh <<CF_EOF
1844 tbl \$TMP >\$TMP.out
1848 if test $with_curses_h != yes ; then
1849 cat >>man/edit_man.sh <<CF_EOF
1850 sed -e "/\#[ ]*include/s,curses.h,ncurses.h," < \$TMP >\$TMP.out
1854 if test $cf_format = yes ; then
1855 cat >>man/edit_man.sh <<CF_EOF
1856 nroff -man \$TMP >\$TMP.out
1860 case "$MANPAGE_FORMAT" in #(vi
1862 cat >>man/edit_man.sh <<CF_EOF
1863 if test \$verb = installing ; then
1864 if ( compress -f \$TMP )
1873 cat >>man/edit_man.sh <<CF_EOF
1874 if test \$verb = installing ; then
1875 if ( gzip -f \$TMP )
1880 target="\$target.gz"
1884 cat >>man/edit_man.sh <<CF_EOF
1885 # BSDI installs only .0 suffixes in the cat directories
1886 target="\`echo \$target|sed -e 's/\.[[1-9]]\+.\?/.0/'\`"
1890 cat >>man/edit_man.sh <<CF_EOF
1891 suffix=\`basename \$target | sed -e 's/^[[^.]]*//'\`
1892 if test \$verb = installing ; then
1893 echo \$verb \$target
1894 \$INSTALL_DATA \$TMP \$target
1895 test -n "\$aliases" && (
1896 cd $cf_subdir\${section} && (
1897 target=\`basename \$target\`
1898 for cf_alias in \$aliases
1900 if test \$section = 1 ; then
1901 cf_alias=\`echo \$cf_alias|sed "\${transform}"\`
1904 if test -f \$cf_alias\${suffix} ; then
1905 if ( cmp -s \$target \$cf_alias\${suffix} )
1909 echo .. \$verb alias \$cf_alias\${suffix}
1910 rm -f \$cf_alias\${suffix}
1911 $LN_S \$target \$cf_alias\${suffix}
1914 echo .. \$verb alias \$cf_alias\${suffix}
1915 rm -f \$cf_alias\${suffix}
1916 $LN_S \$target \$cf_alias\${suffix}
1921 elif test \$verb = removing ; then
1922 echo \$verb \$target
1924 test -n "\$aliases" && (
1925 cd $cf_subdir\${section} && (
1926 for cf_alias in \$aliases
1928 if test \$section = 1 ; then
1929 cf_alias=\`echo \$cf_alias|sed "\${transform}"\`
1932 echo .. \$verb alias \$cf_alias\${suffix}
1933 rm -f \$cf_alias\${suffix}
1946 chmod 755 man/edit_man.sh
1949 dnl ---------------------------------------------------------------------------
1950 dnl Checks for libraries. At least one UNIX system, Apple Macintosh
1951 dnl Rhapsody 5.5, does not have -lm. We cannot use the simpler
1952 dnl AC_CHECK_LIB(m,sin), because that fails for C++.
1953 AC_DEFUN([CF_MATH_LIB],
1955 AC_CACHE_CHECK(if -lm needed for math functions,
1961 [double x = rand(); printf("result = %g\n", ]ifelse($2,,sin(x),$2)[)],
1962 [cf_cv_need_libm=no],
1963 [cf_cv_need_libm=yes])])
1964 if test "$cf_cv_need_libm" = yes
1971 dnl ---------------------------------------------------------------------------
1972 dnl Check if mbstate_t is declared, and if so, which header file.
1973 AC_DEFUN([CF_MBSTATE_T],
1975 # This is needed on Tru64 5.0 to declare mbstate_t
1976 AC_CACHE_CHECK(if we must include wchar.h to declare mbstate_t,cf_cv_mbstate_t,[
1979 #ifdef HAVE_LIBUTF8_H
1980 #include <libutf8.h>
1983 [cf_cv_mbstate_t=no],
1987 #ifdef HAVE_LIBUTF8_H
1988 #include <libutf8.h>
1991 [cf_cv_mbstate_t=yes],
1992 [cf_cv_mbstate_t=unknown])])])
1994 if test "$cf_cv_mbstate_t" = yes ; then
1995 AC_DEFINE(NEED_WCHAR_H)
1998 if test "$cf_cv_mbstate_t" != unknown ; then
1999 AC_DEFINE(HAVE_MBSTATE_T)
2002 dnl ---------------------------------------------------------------------------
2003 dnl Check if the file-system supports mixed-case filenames. If we're able to
2004 dnl create a lowercase name and see it as uppercase, it doesn't support that.
2005 AC_DEFUN([CF_MIXEDCASE_FILENAMES],
2007 AC_CACHE_CHECK(if filesystem supports mixed-case filenames,cf_cv_mixedcase,[
2008 rm -f conftest CONFTEST
2010 if test -f CONFTEST ; then
2015 rm -f conftest CONFTEST
2017 test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES)
2019 dnl ---------------------------------------------------------------------------
2020 dnl Check for a working mkstemp. This creates two files, checks that they are
2021 dnl successfully created and distinct (AmigaOS apparently fails on the last).
2022 AC_DEFUN([CF_MKSTEMP],[
2023 AC_CACHE_CHECK(for working mkstemp, cf_cv_func_mkstemp,[
2026 #include <sys/types.h>
2030 #include <sys/stat.h>
2033 char *tmpl = "conftestXXXXXX";
2041 for (n = 0; n < 2; ++n) {
2042 strcpy(name[n], tmpl);
2043 if ((fd = mkstemp(name[n])) >= 0) {
2044 if (!strcmp(name[n], tmpl)
2045 || stat(name[n], &sb) != 0
2046 || (sb.st_mode & S_IFMT) != S_IFREG
2047 || (sb.st_mode & 077) != 0) {
2054 && !strcmp(name[0], name[1]))
2058 ],[cf_cv_func_mkstemp=yes
2059 ],[cf_cv_func_mkstemp=no
2060 ],[AC_CHECK_FUNC(mkstemp)
2063 if test "$cf_cv_func_mkstemp" = yes ; then
2064 AC_DEFINE(HAVE_MKSTEMP)
2067 dnl ---------------------------------------------------------------------------
2068 dnl Compute the object-directory name from the given model name
2069 AC_DEFUN([CF_OBJ_SUBDIR],
2072 libtool) $2='obj_lo' ;;
2073 normal) $2='objects' ;;
2074 debug) $2='obj_g' ;;
2075 profile) $2='obj_p' ;;
2077 case $cf_cv_system_name in #(vi
2085 dnl ---------------------------------------------------------------------------
2086 dnl Provide a value for the $PATH and similar separator
2087 AC_DEFUN([CF_PATHSEP],
2089 case $cf_cv_system_name in
2090 os2*) PATHSEP=';' ;;
2093 ifelse($1,,,[$1=$PATHSEP])
2096 dnl ---------------------------------------------------------------------------
2097 dnl Check the argument to see that it looks like a pathname. Rewrite it if it
2098 dnl begins with one of the prefix/exec_prefix variables, and then again if the
2099 dnl result begins with 'NONE'. This is necessary to work around autoconf's
2100 dnl delayed evaluation of those symbols.
2101 AC_DEFUN([CF_PATH_SYNTAX],[
2102 case ".[$]$1" in #(vi
2103 .\[$]\(*\)*|.\'*\'*) #(vi
2107 .[[a-zA-Z]]:[[\\/]]*) #(vi OS/2 EMX
2109 .\[$]{*prefix}*) #(vi
2111 case ".[$]$1" in #(vi
2113 $1=`echo [$]$1 | sed -e s%NONE%$ac_default_prefix%`
2118 $1=`echo [$]$1 | sed -e s%NONE%$ac_default_prefix%`
2121 ifelse($2,,[AC_ERROR([expected a pathname, not \"[$]$1\"])],$2)
2125 dnl ---------------------------------------------------------------------------
2126 dnl Compute $PROG_EXT, used for non-Unix ports, such as OS/2 EMX.
2127 AC_DEFUN([CF_PROG_EXT],
2129 AC_REQUIRE([CF_CHECK_CACHE])
2131 case $cf_cv_system_name in
2133 # We make sure -Zexe is not used -- it would interfere with @PROG_EXT@
2134 CFLAGS="$CFLAGS -Zmt"
2135 CPPFLAGS="$CPPFLAGS -D__ST_MT_ERRNO__"
2136 CXXFLAGS="$CXXFLAGS -Zmt"
2137 LDFLAGS=`echo "$LDFLAGS -Zmt -Zcrtdll" | sed "s/-Zexe//g"`
2145 test -n "$PROG_EXT" && AC_DEFINE_UNQUOTED(PROG_EXT,"$PROG_EXT")
2147 dnl ---------------------------------------------------------------------------
2148 dnl Force $INSTALL to be an absolute-path. Otherwise, edit_man.sh and the
2149 dnl misc/tabset install won't work properly. Usually this happens only when
2150 dnl using the fallback mkinstalldirs script
2151 AC_DEFUN([CF_PROG_INSTALL],
2157 CF_DIRNAME(cf_dir,$INSTALL)
2158 test -z "$cf_dir" && cf_dir=.
2159 INSTALL=`cd $cf_dir && pwd`/`echo $INSTALL | sed -e 's:^.*/::'`
2163 dnl ---------------------------------------------------------------------------
2164 dnl Attempt to determine if we've got one of the flavors of regular-expression
2165 dnl code that we can support.
2166 AC_DEFUN([CF_REGEX],
2168 AC_MSG_CHECKING([for regular-expression headers])
2169 AC_CACHE_VAL(cf_cv_regex,[
2170 AC_TRY_LINK([#include <sys/types.h>
2171 #include <regex.h>],[
2173 int x = regcomp(p, "", 0);
2174 int y = regexec(p, "", 0, 0, 0);
2176 ],[cf_cv_regex="regex.h"],[
2177 AC_TRY_LINK([#include <regexp.h>],[
2178 char *p = compile("", "", "", 0);
2179 int x = step("", "");
2180 ],[cf_cv_regex="regexp.h"],[
2181 cf_save_LIBS="$LIBS"
2183 AC_TRY_LINK([#include <regexpr.h>],[
2184 char *p = compile("", "", "");
2185 int x = step("", "");
2186 ],[cf_cv_regex="regexpr.h"],[LIBS="$cf_save_LIBS"])])])
2188 AC_MSG_RESULT($cf_cv_regex)
2189 case $cf_cv_regex in
2190 regex.h) AC_DEFINE(HAVE_REGEX_H_FUNCS) ;;
2191 regexp.h) AC_DEFINE(HAVE_REGEXP_H_FUNCS) ;;
2192 regexpr.h) AC_DEFINE(HAVE_REGEXPR_H_FUNCS) ;;
2195 dnl ---------------------------------------------------------------------------
2196 dnl Attempt to determine the appropriate CC/LD options for creating a shared
2199 dnl Note: $(LOCAL_LDFLAGS) is used to link executables that will run within the
2200 dnl build-tree, i.e., by making use of the libraries that are compiled in ../lib
2201 dnl We avoid compiling-in a ../lib path for the shared library since that can
2202 dnl lead to unexpected results at runtime.
2203 dnl $(LOCAL_LDFLAGS2) has the same intention but assumes that the shared libraries
2204 dnl are compiled in ../../lib
2206 dnl The variable 'cf_cv_do_symlinks' is used to control whether we configure
2207 dnl to install symbolic links to the rel/abi versions of shared libraries.
2209 dnl The variable 'cf_cv_shlib_version' controls whether we use the rel or abi
2210 dnl version when making symbolic links.
2212 dnl The variable 'cf_cv_shlib_version_infix' controls whether shared library
2213 dnl version numbers are infix (ex: libncurses.<ver>.dylib) or postfix
2214 dnl (ex: libncurses.so.<ver>).
2216 dnl Some loaders leave 'so_locations' lying around. It's nice to clean up.
2217 AC_DEFUN([CF_SHARED_OPTS],
2219 AC_REQUIRE([CF_SUBST_NCURSES_VERSION])
2223 INSTALL_LIB="-m 644"
2225 cf_cv_do_symlinks=no
2227 AC_MSG_CHECKING(if release/abi version should be used for shared libs)
2228 AC_ARG_WITH(shlib-version,
2229 [ --with-shlib-version=X Specify rel or abi version for shared libs],
2230 [test -z "$withval" && withval=auto
2231 case $withval in #(vi
2233 cf_cv_shlib_version=auto
2235 rel|abi|auto|no) #(vi
2236 cf_cv_shlib_version=$withval
2239 AC_ERROR([option value must be one of: rel, abi, auto or no])
2242 ],[cf_cv_shlib_version=auto])
2243 AC_MSG_RESULT($cf_cv_shlib_version)
2247 # Some less-capable ports of gcc support only -fpic
2249 if test "$GCC" = yes
2251 AC_MSG_CHECKING(which $CC option to use)
2252 cf_save_CFLAGS="$CFLAGS"
2253 for CC_SHARED_OPTS in -fPIC -fpic ''
2255 CFLAGS="$cf_save_CFLAGS $CC_SHARED_OPTS"
2256 AC_TRY_COMPILE([#include <stdio.h>],[int x = 1],[break],[])
2258 AC_MSG_RESULT($CC_SHARED_OPTS)
2259 CFLAGS="$cf_save_CFLAGS"
2262 cf_cv_shlib_version_infix=no
2264 case $cf_cv_system_name in
2266 MK_SHARED_LIB='$(CC) -o $[@] -Xlinker -soname=`basename $[@]` -nostart -e 0'
2270 MK_SHARED_LIB='$(CC) -shared -Wl,--out-implib=$(IMPORT_LIB) -Wl,--export-all-symbols -o $(SHARED_LIB)'
2271 cf_cv_shlib_version=cygdll
2272 cf_cv_shlib_version_infix=cygdll
2275 EXTRA_CFLAGS="-no-cpp-precomp"
2276 CC_SHARED_OPTS="-dynamic"
2277 MK_SHARED_LIB='$(CC) -dynamiclib -install_name $(DESTDIR)$(libdir)/`basename $[@]` -compatibility_version $(ABI_VERSION) -current_version $(ABI_VERSION) -o $[@]'
2278 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=abi
2279 cf_cv_shlib_version_infix=yes
2282 # (tested with gcc 2.7.2 -- I don't have c89)
2283 if test "$GCC" = yes; then
2284 LD_SHARED_OPTS='-Xlinker +b -Xlinker $(libdir)'
2287 LD_SHARED_OPTS='-Wl,+b,$(libdir)'
2289 MK_SHARED_LIB='$(LD) +b $(libdir) -b -o $[@]'
2290 # HP-UX shared libraries must be executable, and should be
2291 # readonly to exploit a quirk in the memory manager.
2292 INSTALL_LIB="-m 555"
2295 if test "$cf_cv_ld_rpath" = yes ; then
2296 cf_ld_rpath_opt="-Wl,-rpath,"
2297 EXTRA_LDFLAGS="-Wl,-rpath,\$(libdir) $EXTRA_LDFLAGS"
2299 # tested with IRIX 5.2 and 'cc'.
2300 if test "$GCC" != yes; then
2301 CC_SHARED_OPTS='-KPIC'
2303 MK_SHARED_LIB='$(LD) -shared -rdata_shared -soname `basename $[@]` -o $[@]'
2304 cf_cv_rm_so_locs=yes
2307 if test "$DFT_LWR_MODEL" = "shared" ; then
2308 LOCAL_LDFLAGS="-Wl,-rpath,`pwd`/lib"
2309 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
2311 if test "$cf_cv_ld_rpath" = yes ; then
2312 cf_ld_rpath_opt="-Wl,-rpath,"
2313 EXTRA_LDFLAGS="$LOCAL_LDFLAGS $EXTRA_LDFLAGS"
2315 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
2316 MK_SHARED_LIB='$(CC) -shared -Wl,-soname,`basename $[@] .$(REL_VERSION)`.$(ABI_VERSION),-stats,-lc -o $[@]'
2319 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
2320 MK_SHARED_LIB='$(LD) -Bshareable -soname,`basename $[@].$(ABI_VERSION)` -o $[@]'
2323 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
2324 MK_SHARED_LIB='$(LD) -Bshareable -o $[@]'
2325 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
2328 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
2329 test "$cf_cv_ld_rpath" = yes && cf_ld_rpath_opt="-Wl,-rpath,"
2330 if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_ld_rpath" = yes ; then
2331 LOCAL_LDFLAGS="-Wl,-rpath,`pwd`/lib"
2332 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
2333 EXTRA_LDFLAGS="-Wl,-rpath,\$(libdir) $EXTRA_LDFLAGS"
2334 MK_SHARED_LIB='$(CC) -shared -Wl,-soname,`basename $[@] .$(REL_VERSION)`.$(ABI_VERSION) -o $[@]'
2335 if test "$cf_cv_shlib_version" = auto; then
2336 if test ! -f /usr/libexec/ld.elf_so; then
2337 cf_cv_shlib_version=rel
2341 MK_SHARED_LIB='$(LD) -Bshareable -o $[@]'
2345 # tested with OSF/1 V3.2 and 'cc'
2346 # tested with OSF/1 V3.2 and gcc 2.6.3 (but the c++ demo didn't
2347 # link with shared libs).
2348 MK_SHARED_LIB='$(LD) -set_version $(REL_VERSION):$(ABI_VERSION) -expect_unresolved "*" -shared -soname `basename $[@]`'
2351 MK_SHARED_LIB="${MK_SHARED_LIB} -msym"
2354 MK_SHARED_LIB="${MK_SHARED_LIB}"' -o $[@]'
2355 if test "$DFT_LWR_MODEL" = "shared" ; then
2356 LOCAL_LDFLAGS="-Wl,-rpath,`pwd`/lib"
2357 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
2359 if test "$cf_cv_ld_rpath" = yes ; then
2360 cf_ld_rpath_opt="-rpath"
2361 # EXTRA_LDFLAGS="$LOCAL_LDFLAGS $EXTRA_LDFLAGS"
2363 cf_cv_rm_so_locs=yes
2365 sco3.2v5*) # (also uw2* and UW7) hops 13-Apr-98
2366 # tested with osr5.0.5
2367 if test "$ac_cv_prog_gcc" != yes; then
2368 CC_SHARED_OPTS='-belf -KPIC'
2370 MK_SHARED_LIB='$(LD) -dy -G -h `basename $[@] .$(REL_VERSION)`.$(ABI_VERSION) -o [$]@'
2371 if test "$cf_cv_ld_rpath" = yes ; then
2372 # only way is to set LD_RUN_PATH but no switch for it
2375 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
2376 LINK_PROGS='LD_RUN_PATH=$(libdir)'
2377 LINK_TESTS='Pwd=`pwd`;LD_RUN_PATH=`dirname $${Pwd}`/lib'
2380 # tested with SunOS 4.1.1 and gcc 2.7.0
2381 if test "$ac_cv_prog_gcc" != yes; then
2382 CC_SHARED_OPTS='-KPIC'
2384 MK_SHARED_LIB='$(LD) -assert pure-text -o $[@]'
2385 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
2388 # tested with SunOS 5.5.1 (solaris 2.5.1) and gcc 2.7.2
2389 if test "$ac_cv_prog_gcc" != yes; then
2390 CC_SHARED_OPTS='-KPIC'
2392 MK_SHARED_LIB='$(LD) -dy -G -h `basename $[@] .$(REL_VERSION)`.$(ABI_VERSION) -o $[@]'
2393 if test "$DFT_LWR_MODEL" = "shared" ; then
2394 LOCAL_LDFLAGS="-R `pwd`/lib:\$(libdir)"
2395 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
2397 if test "$cf_cv_ld_rpath" = yes ; then
2398 cf_ld_rpath_opt="-R"
2399 EXTRA_LDFLAGS="$LOCAL_LDFLAGS $EXTRA_LDFLAGS"
2401 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
2404 # tested with UnixWare 7.1.0 (gcc 2.95.2 and cc)
2405 if test "$ac_cv_prog_gcc" != yes; then
2406 CC_SHARED_OPTS='-KPIC'
2408 MK_SHARED_LIB='$(LD) -d y -G -o [$]@'
2411 CC_SHARED_OPTS='unknown'
2412 MK_SHARED_LIB='echo unknown'
2416 # This works if the last tokens in $MK_SHARED_LIB are the -o target.
2417 case "$cf_cv_shlib_version" in #(vi
2419 case "$MK_SHARED_LIB" in #(vi
2421 test "$cf_cv_do_symlinks" = no && cf_cv_do_symlinks=yes
2424 AC_MSG_WARN(ignored --with-shlib-version)
2430 if test -n "$cf_ld_rpath_opt" ; then
2431 AC_MSG_CHECKING(if we need a space after rpath option)
2432 cf_save_LIBS="$LIBS"
2433 LIBS="$LIBS ${cf_ld_rpath_opt}$libdir"
2434 AC_TRY_LINK(, , cf_rpath_space=no, cf_rpath_space=yes)
2435 LIBS="$cf_save_LIBS"
2436 AC_MSG_RESULT($cf_rpath_space)
2437 test "$cf_rpath_space" = yes && cf_ld_rpath_opt="$cf_ld_rpath_opt "
2438 MK_SHARED_LIB="$MK_SHARED_LIB $cf_ld_rpath_opt\$(libdir)"
2441 AC_SUBST(CC_SHARED_OPTS)
2442 AC_SUBST(LD_SHARED_OPTS)
2443 AC_SUBST(MK_SHARED_LIB)
2444 AC_SUBST(LINK_PROGS)
2445 AC_SUBST(LINK_TESTS)
2446 AC_SUBST(EXTRA_LDFLAGS)
2447 AC_SUBST(LOCAL_LDFLAGS)
2448 AC_SUBST(LOCAL_LDFLAGS2)
2449 AC_SUBST(INSTALL_LIB)
2451 dnl ---------------------------------------------------------------------------
2452 dnl Check for definitions & structures needed for window size-changing
2453 dnl FIXME: check that this works with "snake" (HP-UX 10.x)
2454 AC_DEFUN([CF_SIZECHANGE],
2456 AC_REQUIRE([CF_STRUCT_TERMIOS])
2457 AC_CACHE_CHECK(declaration of size-change, cf_cv_sizechange,[
2458 cf_cv_sizechange=unknown
2459 cf_save_CPPFLAGS="$CPPFLAGS"
2461 for cf_opts in "" "NEED_PTEM_H"
2464 CPPFLAGS="$cf_save_CPPFLAGS"
2465 test -n "$cf_opts" && CPPFLAGS="$CPPFLAGS -D$cf_opts"
2466 AC_TRY_COMPILE([#include <sys/types.h>
2467 #ifdef HAVE_TERMIOS_H
2468 #include <termios.h>
2470 #ifdef HAVE_TERMIO_H
2475 /* This is a workaround for SCO: they neglected to define struct winsize in
2476 * termios.h -- it's only in termio.h and ptem.h
2478 #include <sys/stream.h>
2479 #include <sys/ptem.h>
2481 #if !defined(sun) || !defined(HAVE_TERMIOS_H)
2482 #include <sys/ioctl.h>
2486 struct ttysize win; /* FIXME: what system is this? */
2487 int y = win.ts_lines;
2488 int x = win.ts_cols;
2495 no TIOCGSIZE or TIOCGWINSZ
2496 #endif /* TIOCGWINSZ */
2497 #endif /* TIOCGSIZE */
2499 [cf_cv_sizechange=yes],
2500 [cf_cv_sizechange=no])
2502 CPPFLAGS="$cf_save_CPPFLAGS"
2503 if test "$cf_cv_sizechange" = yes ; then
2504 echo "size-change succeeded ($cf_opts)" >&AC_FD_CC
2505 test -n "$cf_opts" && cf_cv_sizechange="$cf_opts"
2510 if test "$cf_cv_sizechange" != no ; then
2511 AC_DEFINE(HAVE_SIZECHANGE)
2512 case $cf_cv_sizechange in #(vi
2514 AC_DEFINE_UNQUOTED($cf_cv_sizechange )
2519 dnl ---------------------------------------------------------------------------
2520 dnl For each parameter, test if the source-directory exists, and if it contains
2521 dnl a 'modules' file. If so, add to the list $cf_cv_src_modules which we'll
2522 dnl use in CF_LIB_RULES.
2524 dnl This uses the configured value to make the lists SRC_SUBDIRS and
2525 dnl SUB_MAKEFILES which are used in the makefile-generation scheme.
2526 AC_DEFUN([CF_SRC_MODULES],
2528 AC_MSG_CHECKING(for src modules)
2530 # dependencies and linker-arguments for test-programs
2531 TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${LIB_NAME}${DFT_DEP_SUFFIX} $TEST_DEPS"
2532 if test "$DFT_LWR_MODEL" = "libtool"; then
2533 TEST_ARGS="${TEST_DEPS}"
2535 TEST_ARGS="-l${LIB_NAME}${DFT_ARG_SUFFIX} $TEST_ARGS"
2538 # dependencies and linker-arguments for utility-programs
2539 PROG_ARGS="$TEST_ARGS"
2544 if test -f $srcdir/$cf_dir/modules; then
2546 # We may/may not have tack in the distribution, though the
2548 if test $cf_dir = tack ; then
2549 if test ! -f $srcdir/${cf_dir}/${cf_dir}.h; then
2554 if test -z "$cf_cv_src_modules"; then
2555 cf_cv_src_modules=$cf_dir
2557 cf_cv_src_modules="$cf_cv_src_modules $cf_dir"
2560 # Make the ncurses_cfg.h file record the library interface files as
2561 # well. These are header files that are the same name as their
2562 # directory. Ncurses is the only library that does not follow
2564 if test $cf_dir = tack ; then
2566 elif test -f $srcdir/${cf_dir}/${cf_dir}.h; then
2567 CF_UPPER(cf_have_include,$cf_dir)
2568 AC_DEFINE_UNQUOTED(HAVE_${cf_have_include}_H)
2569 AC_DEFINE_UNQUOTED(HAVE_LIB${cf_have_include})
2570 TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${cf_dir}${DFT_DEP_SUFFIX} $TEST_DEPS"
2571 if test "$DFT_LWR_MODEL" = "libtool"; then
2572 TEST_ARGS="${TEST_DEPS}"
2574 TEST_ARGS="-l${cf_dir}${DFT_ARG_SUFFIX} $TEST_ARGS"
2579 AC_MSG_RESULT($cf_cv_src_modules)
2580 TEST_ARGS="-L${LIB_DIR} $TEST_ARGS"
2584 PROG_ARGS="-L${LIB_DIR} $PROG_ARGS"
2587 SRC_SUBDIRS="man include"
2588 for cf_dir in $cf_cv_src_modules
2590 SRC_SUBDIRS="$SRC_SUBDIRS $cf_dir"
2592 SRC_SUBDIRS="$SRC_SUBDIRS test"
2593 test -z "$MAKE_TERMINFO" && SRC_SUBDIRS="$SRC_SUBDIRS misc"
2594 test "$cf_with_cxx_binding" != no && SRC_SUBDIRS="$SRC_SUBDIRS c++"
2597 if test "$cf_cv_prog_gnat_correct" = yes && test -f $srcdir/Ada95/Makefile.in; then
2598 SRC_SUBDIRS="$SRC_SUBDIRS Ada95"
2599 ADA_SUBDIRS="gen src samples"
2603 for cf_dir in $SRC_SUBDIRS
2605 SUB_MAKEFILES="$SUB_MAKEFILES $cf_dir/Makefile"
2608 if test -n "$ADA_SUBDIRS"; then
2609 for cf_dir in $ADA_SUBDIRS
2611 SUB_MAKEFILES="$SUB_MAKEFILES Ada95/$cf_dir/Makefile"
2613 AC_SUBST(ADA_SUBDIRS)
2616 dnl ---------------------------------------------------------------------------
2617 dnl Check for -lstdc++, which is GNU's standard C++ library.
2618 AC_DEFUN([CF_STDCPP_LIBRARY],
2620 if test -n "$GXX" ; then
2621 case $cf_cv_system_name in #(vi
2623 cf_stdcpp_libname=stdcpp
2626 cf_stdcpp_libname=stdc++
2629 AC_CACHE_CHECK(for library $cf_stdcpp_libname,cf_cv_libstdcpp,[
2631 LIBS="$LIBS -l$cf_stdcpp_libname"
2633 #include <strstream.h>],[
2635 strstreambuf foo(buf, sizeof(buf))
2637 [cf_cv_libstdcpp=yes],
2638 [cf_cv_libstdcpp=no])
2641 test "$cf_cv_libstdcpp" = yes && CXXLIBS="$CXXLIBS -l$cf_stdcpp_libname"
2644 dnl ---------------------------------------------------------------------------
2645 dnl Remove "-g" option from the compiler options
2646 AC_DEFUN([CF_STRIP_G_OPT],
2647 [$1=`echo ${$1} | sed -e 's/-g //' -e 's/-g$//'`])dnl
2648 dnl ---------------------------------------------------------------------------
2649 dnl Check if we need _POSIX_SOURCE defined to use struct sigaction. We'll only
2650 dnl do this if we've found the sigaction function.
2652 dnl If needed, define SVR4_ACTION.
2653 AC_DEFUN([CF_STRUCT_SIGACTION],[
2654 if test "$ac_cv_func_sigaction" = yes; then
2655 AC_MSG_CHECKING(whether sigaction needs _POSIX_SOURCE)
2657 #include <sys/types.h>
2658 #include <signal.h>],
2659 [struct sigaction act],
2663 #define _POSIX_SOURCE
2664 #include <sys/types.h>
2665 #include <signal.h>],
2666 [struct sigaction act],
2668 AC_DEFINE(SVR4_ACTION)],
2669 [sigact_bad=unknown])])
2670 AC_MSG_RESULT($sigact_bad)
2673 dnl ---------------------------------------------------------------------------
2674 dnl Some machines require _POSIX_SOURCE to completely define struct termios.
2675 dnl If so, define SVR4_TERMIO
2676 AC_DEFUN([CF_STRUCT_TERMIOS],[
2682 if test "$ISC" = yes ; then
2683 AC_CHECK_HEADERS( sys/termio.h )
2685 if test "$ac_cv_header_termios_h" = yes ; then
2686 case "$CFLAGS $CPPFLAGS" in
2688 termios_bad=dunno ;;
2689 *) termios_bad=maybe ;;
2691 if test "$termios_bad" = maybe ; then
2692 AC_MSG_CHECKING(whether termios.h needs _POSIX_SOURCE)
2693 AC_TRY_COMPILE([#include <termios.h>],
2694 [struct termios foo; int x = foo.c_iflag],
2697 #define _POSIX_SOURCE
2698 #include <termios.h>],
2699 [struct termios foo; int x = foo.c_iflag],
2700 termios_bad=unknown,
2701 termios_bad=yes AC_DEFINE(SVR4_TERMIO))
2703 AC_MSG_RESULT($termios_bad)
2707 dnl ---------------------------------------------------------------------------
2708 dnl Shorthand macro for substituting things that the user may override
2709 dnl with an environment variable.
2711 dnl $1 = long/descriptive name
2712 dnl $2 = environment variable
2713 dnl $3 = default value
2714 AC_DEFUN([CF_SUBST],
2715 [AC_CACHE_VAL(cf_cv_subst_$2,[
2716 AC_MSG_CHECKING(for $1 (symbol $2))
2717 test -z "[$]$2" && $2=$3
2718 AC_MSG_RESULT([$]$2)
2720 cf_cv_subst_$2=[$]$2])
2721 $2=${cf_cv_subst_$2}
2723 dnl ---------------------------------------------------------------------------
2724 dnl Get the version-number for use in shared-library naming, etc.
2725 AC_DEFUN([CF_SUBST_NCURSES_VERSION],
2727 NCURSES_MAJOR="`egrep '^NCURSES_MAJOR[[ ]]*=' $srcdir/dist.mk | sed -e 's/^[[^0-9]]*//'`"
2728 NCURSES_MINOR="`egrep '^NCURSES_MINOR[[ ]]*=' $srcdir/dist.mk | sed -e 's/^[[^0-9]]*//'`"
2729 NCURSES_PATCH="`egrep '^NCURSES_PATCH[[ ]]*=' $srcdir/dist.mk | sed -e 's/^[[^0-9]]*//'`"
2730 cf_cv_abi_version=${NCURSES_MAJOR}
2731 cf_cv_rel_version=${NCURSES_MAJOR}.${NCURSES_MINOR}
2732 dnl Show the computed version, for logging
2733 cf_cv_timestamp=`date`
2734 AC_MSG_RESULT(Configuring NCURSES $cf_cv_rel_version ABI $cf_cv_abi_version ($cf_cv_timestamp))
2735 dnl We need these values in the generated headers
2736 AC_SUBST(NCURSES_MAJOR)
2737 AC_SUBST(NCURSES_MINOR)
2738 AC_SUBST(NCURSES_PATCH)
2739 dnl We need these values in the generated makefiles
2740 AC_SUBST(cf_cv_rel_version)
2741 AC_SUBST(cf_cv_abi_version)
2742 AC_SUBST(cf_cv_cc_bool_type)
2743 AC_SUBST(cf_cv_builtin_bool)
2744 AC_SUBST(cf_cv_header_stdbool_h)
2745 AC_SUBST(cf_cv_type_of_bool)dnl
2747 dnl ---------------------------------------------------------------------------
2748 dnl Check if we can include <sys/time.h> with <sys/select.h>; this breaks on
2749 dnl older SCO configurations.
2750 AC_DEFUN([CF_SYS_TIME_SELECT],
2752 AC_MSG_CHECKING(if sys/time.h works with sys/select.h)
2753 AC_CACHE_VAL(cf_cv_sys_time_select,[
2755 #include <sys/types.h>
2756 #ifdef HAVE_SYS_TIME_H
2757 #include <sys/time.h>
2759 #ifdef HAVE_SYS_SELECT_H
2760 #include <sys/select.h>
2762 ],[],[cf_cv_sys_time_select=yes],
2763 [cf_cv_sys_time_select=no])
2765 AC_MSG_RESULT($cf_cv_sys_time_select)
2766 test "$cf_cv_sys_time_select" = yes && AC_DEFINE(HAVE_SYS_TIME_SELECT)
2768 dnl ---------------------------------------------------------------------------
2769 dnl Determine the type we should use for chtype (and attr_t, which is treated
2770 dnl as the same thing). We want around 32 bits, so on most machines want a
2771 dnl long, but on newer 64-bit machines, probably want an int. If we're using
2772 dnl wide characters, we have to have a type compatible with that, as well.
2773 AC_DEFUN([CF_TYPEOF_CHTYPE],
2775 AC_REQUIRE([CF_UNSIGNED_LITERALS])
2776 AC_MSG_CHECKING([for type of chtype])
2777 AC_CACHE_VAL(cf_cv_typeof_chtype,[
2779 #ifdef USE_WIDEC_SUPPORT
2780 #include <stddef.h> /* we want wchar_t */
2781 #define WANT_BITS 39
2783 #define WANT_BITS 31
2788 FILE *fp = fopen("cf_test.out", "w");
2790 char *result = "long";
2791 #ifdef USE_WIDEC_SUPPORT
2793 * If wchar_t is smaller than a long, it must be an int or a
2794 * short. We prefer not to use a short anyway.
2796 if (sizeof(unsigned long) > sizeof(wchar_t))
2799 if (sizeof(unsigned long) > sizeof(unsigned int)) {
2802 for (n = 0; n < WANT_BITS; n++) {
2803 unsigned int y = (x >> n);
2804 if (y != 1 || x == 0) {
2810 * If x is nonzero, an int is big enough for the bits
2813 result = (x != 0) ? "int" : "long";
2821 [cf_cv_typeof_chtype=`cat cf_test.out`],
2822 [cf_cv_typeof_chtype=long],
2823 [cf_cv_typeof_chtype=long])
2826 AC_MSG_RESULT($cf_cv_typeof_chtype)
2828 AC_SUBST(cf_cv_typeof_chtype)
2829 AC_DEFINE_UNQUOTED(TYPEOF_CHTYPE,$cf_cv_typeof_chtype)
2832 test "$cf_cv_unsigned_literals" = yes && cf_cv_1UL="${cf_cv_1UL}U"
2833 test "$cf_cv_typeof_chtype" = long && cf_cv_1UL="${cf_cv_1UL}L"
2837 dnl ---------------------------------------------------------------------------
2839 AC_DEFUN([CF_TYPE_SIGACTION],
2841 AC_MSG_CHECKING([for type sigaction_t])
2842 AC_CACHE_VAL(cf_cv_type_sigaction,[
2844 #include <signal.h>],
2846 [cf_cv_type_sigaction=yes],
2847 [cf_cv_type_sigaction=no])])
2848 AC_MSG_RESULT($cf_cv_type_sigaction)
2849 test "$cf_cv_type_sigaction" = yes && AC_DEFINE(HAVE_TYPE_SIGACTION)
2851 dnl ---------------------------------------------------------------------------
2852 dnl Test if the compiler supports 'U' and 'L' suffixes. Only old compilers
2853 dnl won't, but they're still there.
2854 AC_DEFUN([CF_UNSIGNED_LITERALS],
2856 AC_MSG_CHECKING([if unsigned literals are legal])
2857 AC_CACHE_VAL(cf_cv_unsigned_literals,[
2858 AC_TRY_COMPILE([],[long x = 1L + 1UL + 1U + 1],
2859 [cf_cv_unsigned_literals=yes],
2860 [cf_cv_unsigned_literals=no])
2862 AC_MSG_RESULT($cf_cv_unsigned_literals)
2864 dnl ---------------------------------------------------------------------------
2865 dnl Make an uppercase version of a variable
2866 dnl $1=uppercase($2)
2867 AC_DEFUN([CF_UPPER],
2869 $1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
2871 dnl ---------------------------------------------------------------------------
2872 dnl Use AC_VERBOSE w/o the warnings
2873 AC_DEFUN([CF_VERBOSE],
2874 [test -n "$verbose" && echo " $1" 1>&AC_FD_MSG
2876 dnl ---------------------------------------------------------------------------
2877 dnl Wrapper for AC_ARG_WITH to ensure that user supplies a pathname, not just
2878 dnl defaulting to yes/no.
2880 dnl $1 = option name
2882 dnl $3 = environment variable to set
2883 dnl $4 = default value, shown in the help-message, must be a constant
2884 dnl $5 = default value, if it's an expression & cannot be in the help-message
2886 AC_DEFUN([CF_WITH_PATH],
2887 [AC_ARG_WITH($1,[$2 ](default: ifelse($4,,empty,$4)),,
2888 ifelse($4,,[withval="${$3}"],[withval="${$3-ifelse($5,,$4,$5)}"]))dnl
2889 CF_PATH_SYNTAX(withval)
2893 dnl ---------------------------------------------------------------------------
2894 dnl Process an option specifying a list of colon-separated paths.
2896 dnl $1 = option name
2898 dnl $3 = environment variable to set
2899 dnl $4 = default value, shown in the help-message, must be a constant
2900 dnl $5 = default value, if it's an expression & cannot be in the help-message
2901 dnl $6 = flag to tell if we want to define or substitute
2903 AC_DEFUN([CF_WITH_PATHLIST],[
2904 AC_REQUIRE([CF_PATHSEP])
2905 AC_ARG_WITH($1,[$2 ](default: ifelse($4,,empty,$4)),,
2906 ifelse($4,,[withval=${$3}],[withval=${$3-ifelse($5,,$4,$5)}]))dnl
2908 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${PATHSEP}"
2910 for cf_src_path in $withval
2912 CF_PATH_SYNTAX(cf_src_path)
2913 test -n "$cf_dst_path" && cf_dst_path="${cf_dst_path}:"
2914 cf_dst_path="${cf_dst_path}${cf_src_path}"
2919 # Strip single quotes from the value, e.g., when it was supplied as a literal
2921 case $cf_dst_path in #(vi
2923 cf_dst_path=`echo $cf_dst_path |sed -e s/\'// -e s/\'\$//`
2926 cf_dst_path=`echo "$cf_dst_path" | sed -e 's/\\\\/\\\\\\\\/g'`
2929 eval '$3="$cf_dst_path"'