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.280 2002/04/27 19:31:30 tom Exp $
32 dnl Macros used in NCURSES auto-configuration script.
34 dnl See http://dickey.his.com/autoconf/ for additional information.
36 dnl ---------------------------------------------------------------------------
37 dnl ---------------------------------------------------------------------------
38 dnl Construct the list of include-options for the C programs in the Ada95
40 AC_DEFUN([CF_ADA_INCLUDE_DIRS],
42 ACPPFLAGS="$ACPPFLAGS -I. -I../../include"
43 if test "$srcdir" != "."; then
44 ACPPFLAGS="$ACPPFLAGS -I\$(srcdir)/../../include"
46 if test "$GCC" != yes; then
47 ACPPFLAGS="$ACPPFLAGS -I\$(includedir)"
48 elif test "$includedir" != "/usr/include"; then
49 if test "$includedir" = '${prefix}/include' ; then
50 if test $prefix != /usr ; then
51 ACPPFLAGS="$ACPPFLAGS -I\$(includedir)"
54 ACPPFLAGS="$ACPPFLAGS -I\$(includedir)"
59 dnl ---------------------------------------------------------------------------
60 dnl 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 \
807 Wstrict-prototypes $cf_warn_CONST
809 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
810 if AC_TRY_EVAL(ac_compile); then
811 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
812 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
813 test "$cf_opt" = Wcast-qual && EXTRA_CFLAGS="$EXTRA_CFLAGS -DXTSTRINGDEFINES"
817 CFLAGS="$cf_save_CFLAGS"
819 AC_SUBST(EXTRA_CFLAGS)
821 dnl ---------------------------------------------------------------------------
822 dnl Verify that a test program compiles and runs with GNAT
823 dnl $cf_ada_make is set to the program that compiles/links
824 AC_DEFUN([CF_GNAT_TRY_RUN],
827 cat >>conftest.ads <<CF_EOF
830 cat >>conftest.adb <<CF_EOF
833 if ( $cf_ada_make conftest 1>&AC_FD_CC 2>&1 ) ; then
834 if ( ./conftest 1>&AC_FD_CC 2>&1 ) ; then
844 dnl ---------------------------------------------------------------------------
845 dnl Verify Version of GNAT.
846 AC_DEFUN([CF_GNAT_VERSION],
848 cf_cv_gnat_version=`$cf_ada_make -v 2>&1 | grep '[[0-9]].[[0-9]][[0-9]]*' |\
849 sed -e 's/[[^0-9 \.]]//g' | $AWK '{print $[1];}'`
850 case $cf_cv_gnat_version in
851 3.1[[1-9]]*|3.[[2-9]]*|[[4-9]].*)
852 cf_cv_prog_gnat_correct=yes
854 *) echo Unsupported GNAT version $cf_cv_gnat_version. Required is 3.11 or better. Disabling Ada95 binding.
855 cf_cv_prog_gnat_correct=no
858 case $cf_cv_gnat_version in
860 cf_compile_generics=generics
861 cf_generic_objects="\$(GENOBJS)"
863 *) cf_compile_generics=
868 dnl ---------------------------------------------------------------------------
869 dnl Check if we must define _GNU_SOURCE to get a reasonable value for
870 dnl _XOPEN_SOURCE, upon which many POSIX definitions depend. This is a defect
871 dnl (or misfeature) of glibc2, which breaks portability of many applications,
872 dnl since it is interwoven with GNU extensions.
874 dnl Well, yes we could work around it...
875 AC_DEFUN([CF_GNU_SOURCE],
877 AC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[
878 AC_TRY_COMPILE([#include <sys/types.h>],[
879 #ifndef _XOPEN_SOURCE
882 [cf_cv_gnu_source=no],
884 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
885 AC_TRY_COMPILE([#include <sys/types.h>],[
889 [cf_cv_gnu_source=no],
890 [cf_cv_gnu_source=yes])
894 test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
896 dnl ---------------------------------------------------------------------------
897 dnl If we're trying to use g++, test if libg++ is installed (a rather common
898 dnl problem :-). If we have the compiler but no library, we'll be able to
899 dnl configure, but won't be able to build the c++ demo program.
900 AC_DEFUN([CF_GPP_LIBRARY],
902 cf_cxx_library=unknown
903 case $cf_cv_system_name in #(vi
911 if test "$ac_cv_prog_gxx" = yes; then
912 AC_MSG_CHECKING([for lib$cf_gpp_libname])
914 LIBS="$LIBS -l$cf_gpp_libname"
916 #include <$cf_gpp_libname/builtin.h>
918 [two_arg_error_handler_t foo2 = lib_error_handler],
920 CXXLIBS="$CXXLIBS -l$cf_gpp_libname"
921 if test "$cf_gpp_libname" = cpp ; then
922 AC_DEFINE(HAVE_GPP_BUILTIN_H)
924 AC_DEFINE(HAVE_GXX_BUILTIN_H)
929 [two_arg_error_handler_t foo2 = lib_error_handler],
931 CXXLIBS="$CXXLIBS -l$cf_gpp_libname"
932 AC_DEFINE(HAVE_BUILTIN_H)],
933 [cf_cxx_library=no])])
935 AC_MSG_RESULT($cf_cxx_library)
938 dnl ---------------------------------------------------------------------------
939 dnl Insert text into the help-message, for readability, from AC_ARG_WITH.
940 AC_DEFUN([CF_HELP_MESSAGE],
941 [AC_DIVERT_HELP([$1])dnl
943 dnl ---------------------------------------------------------------------------
944 dnl Construct the list of include-options according to whether we're building
945 dnl in the source directory or using '--srcdir=DIR' option. If we're building
946 dnl with gcc, don't append the includedir if it happens to be /usr/include,
947 dnl since that usually breaks gcc's shadow-includes.
948 AC_DEFUN([CF_INCLUDE_DIRS],
950 CPPFLAGS="$CPPFLAGS -I. -I../include"
951 if test "$srcdir" != "."; then
952 CPPFLAGS="$CPPFLAGS -I\$(srcdir)/../include"
954 if test "$GCC" != yes; then
955 CPPFLAGS="$CPPFLAGS -I\$(includedir)"
956 elif test "$includedir" != "/usr/include"; then
957 if test "$includedir" = '${prefix}/include' ; then
958 if test $prefix != /usr ; then
959 CPPFLAGS="$CPPFLAGS -I\$(includedir)"
962 CPPFLAGS="$CPPFLAGS -I\$(includedir)"
967 dnl ---------------------------------------------------------------------------
968 dnl Check if we have either a function or macro for 'isascii()'.
969 AC_DEFUN([CF_ISASCII],
971 AC_MSG_CHECKING(for isascii)
972 AC_CACHE_VAL(cf_cv_have_isascii,[
973 AC_TRY_LINK([#include <ctype.h>],[int x = isascii(' ')],
974 [cf_cv_have_isascii=yes],
975 [cf_cv_have_isascii=no])
977 AC_MSG_RESULT($cf_cv_have_isascii)
978 test "$cf_cv_have_isascii" = yes && AC_DEFINE(HAVE_ISASCII)
980 dnl ---------------------------------------------------------------------------
981 dnl Check for libutf8
982 AC_DEFUN([CF_LIBUTF8],
984 AC_CACHE_CHECK(for putwc in libutf8,cf_cv_libutf8,[
988 #include <libutf8.h>],[putwc(0,0);],
994 if test "$cf_cv_libutf8" = yes ; then
995 AC_DEFINE(HAVE_LIBUTF8_H)
999 dnl ---------------------------------------------------------------------------
1000 dnl Compute the library-prefix for the given host system
1001 dnl $1 = variable to set
1002 AC_DEFUN([CF_LIB_PREFIX],
1004 case $cf_cv_system_name in
1005 OS/2*) LIB_PREFIX='' ;;
1006 os2*) LIB_PREFIX='' ;;
1007 *) LIB_PREFIX='lib' ;;
1009 ifelse($1,,,[$1=$LIB_PREFIX])
1010 AC_SUBST(LIB_PREFIX)
1012 dnl ---------------------------------------------------------------------------
1013 dnl Append definitions and rules for the given models to the subdirectory
1014 dnl Makefiles, and the recursion rule for the top-level Makefile. If the
1015 dnl subdirectory is a library-source directory, modify the LIBRARIES list in
1016 dnl the corresponding makefile to list the models that we'll generate.
1018 dnl For shared libraries, make a list of symbolic links to construct when
1019 dnl generating each library. The convention used for Linux is the simplest
1022 dnl lib<name>.so.<major> ->
1023 dnl lib<name>.so.<maj>.<minor>
1024 AC_DEFUN([CF_LIB_RULES],
1026 CF_LIB_PREFIX(cf_prefix)
1027 AC_REQUIRE([CF_SUBST_NCURSES_VERSION])
1028 for cf_dir in $SRC_SUBDIRS
1030 if test -f $srcdir/$cf_dir/modules; then
1035 for cf_item in $CF_LIST_MODELS
1037 CF_LIB_SUFFIX($cf_item,cf_suffix)
1038 if test $cf_item = shared ; then
1039 if test "$cf_cv_do_symlinks" = yes ; then
1040 case "$cf_cv_shlib_version" in #(vi
1042 case "$cf_cv_system_name" in #(vi
1043 darwin*) cf_suffix='.$(REL_VERSION)'"$cf_suffix" ;; #(vi
1044 *) cf_suffix="$cf_suffix"'.$(REL_VERSION)' ;;
1048 case "$cf_cv_system_name" in #(vi
1049 darwin*) cf_suffix='.$(ABI_VERSION)'"$cf_suffix" ;; #(vi
1050 *) cf_suffix="$cf_suffix"'.$(ABI_VERSION)' ;;
1055 # cygwin needs import library, and has unique naming convention
1056 if test $cf_cv_shlib_version = cygdll ; then
1057 SHARED_LIB="../lib/${cf_prefix}${cf_dir}\$(ABI_VERSION).dll"
1058 IMPORT_LIB="../lib/${cf_prefix}${cf_dir}.dll.a"
1059 LIBS_TO_MAKE="$LIBS_TO_MAKE \$(SHARED_LIB) \$(IMPORT_LIB)"
1063 LIBS_TO_MAKE="$LIBS_TO_MAKE ../lib/${cf_prefix}${cf_dir}${cf_suffix}"
1066 if test $cf_dir = ncurses ; then
1067 cf_subsets="$LIB_SUBSETS"
1068 case "$LIB_SUBSETS" in #(vi
1072 cf_item=`echo $LIBS_TO_MAKE |sed -e s/$LIB_NAME/$TINFO_NAME/g`
1073 LIBS_TO_MAKE="$cf_item $LIBS_TO_MAKE"
1077 cf_subsets=`echo "$LIB_SUBSETS" | sed -e 's/^termlib //'`
1080 sed -e "s@\@LIBS_TO_MAKE\@@$LIBS_TO_MAKE@" \
1081 -e "s@\@IMPORT_LIB\@@$IMPORT_LIB@" \
1082 -e "s@\@SHARED_LIB\@@$SHARED_LIB@" \
1083 $cf_dir/Makefile >$cf_dir/Makefile.out
1084 mv $cf_dir/Makefile.out $cf_dir/Makefile
1086 $AWK -f $srcdir/mk-0th.awk \
1087 libname="${cf_dir}${LIB_SUFFIX}" subsets="$LIB_SUBSETS" \
1088 $srcdir/$cf_dir/modules >>$cf_dir/Makefile
1090 for cf_subset in $cf_subsets
1093 for cf_item in $CF_LIST_MODELS
1095 echo "Appending rules for ${cf_item} model (${cf_dir}: ${cf_subset})"
1096 CF_UPPER(CF_ITEM,$cf_item)
1097 CF_LIB_SUFFIX($cf_item,cf_suffix)
1098 CF_OBJ_SUBDIR($cf_item,cf_subdir)
1100 # These dependencies really are for development, not
1101 # builds, but they are useful in porting, too.
1102 cf_depend="../include/ncurses_cfg.h"
1103 if test "$srcdir" = "."; then
1106 cf_reldir="\$(srcdir)"
1109 if test -f $srcdir/$cf_dir/$cf_dir.priv.h; then
1110 cf_depend="$cf_depend $cf_reldir/$cf_dir.priv.h"
1111 elif test -f $srcdir/$cf_dir/curses.priv.h; then
1112 cf_depend="$cf_depend $cf_reldir/curses.priv.h"
1115 $AWK -f $srcdir/mk-1st.awk \
1117 traces=$LIB_TRACING \
1123 ShlibVer=$cf_cv_shlib_version \
1124 ShlibVerInfix=$cf_cv_shlib_version_infix \
1125 DoLinks=$cf_cv_do_symlinks \
1126 rmSoLocs=$cf_cv_rm_so_locs \
1127 ldconfig="$LDCONFIG" \
1128 overwrite=$WITH_OVERWRITE \
1129 depend="$cf_depend" \
1131 $srcdir/$cf_dir/modules >>$cf_dir/Makefile
1132 for cf_subdir2 in $cf_subdirs lib
1134 test $cf_subdir = $cf_subdir2 && break
1136 test "${cf_subset}.${cf_subdir2}" != "${cf_subset}.${cf_subdir}" && \
1137 $AWK -f $srcdir/mk-2nd.awk \
1139 traces=$LIB_TRACING \
1145 $srcdir/$cf_dir/modules >>$cf_dir/Makefile
1146 cf_subdirs="$cf_subdirs $cf_subdir"
1151 echo ' cd '$cf_dir' && $(MAKE) $(CF_MFLAGS) [$]@' >>Makefile
1154 for cf_dir in $SRC_SUBDIRS
1156 if test -f $cf_dir/Makefile ; then
1159 echo 'libs \' >> Makefile
1160 echo 'install.libs \' >> Makefile
1161 echo 'uninstall.libs ::' >> Makefile
1162 echo ' cd '$cf_dir' && $(MAKE) $(CF_MFLAGS) [$]@' >> Makefile
1167 if test -f $srcdir/$cf_dir/modules; then
1169 if test -f $srcdir/$cf_dir/headers; then
1170 cat >> Makefile <<CF_EOF
1172 uninstall.includes \\
1175 if test "$cf_dir" != "c++" ; then
1176 echo 'lint \' >> Makefile
1178 cat >> Makefile <<CF_EOF
1184 uninstall.$cf_dir ::
1185 cd $cf_dir && \$(MAKE) \$(CF_MFLAGS) \[$]@
1187 elif test -f $srcdir/$cf_dir/headers; then
1188 cat >> Makefile <<CF_EOF
1194 uninstall.includes ::
1195 cd $cf_dir && \$(MAKE) \$(CF_MFLAGS) \[$]@
1200 cat >> Makefile <<CF_EOF
1204 $MAKE_TERMINFO cd misc && \$(MAKE) \$(CF_MFLAGS) \[$]@
1208 cd man && \$(MAKE) \$(CF_MFLAGS) \[$]@
1211 rm -f config.cache config.log config.status Makefile include/ncurses_cfg.h
1212 rm -f headers.sh headers.sed
1213 rm -rf \$(DIRS_TO_MAKE)
1216 # Special case: tack's manpage lives in its own directory.
1217 if test -d tack ; then
1218 if test -f $srcdir/$tack.h; then
1219 cat >> Makefile <<CF_EOF
1223 cd tack && \$(MAKE) \$(CF_MFLAGS) \[$]@
1228 dnl If we're installing into a subdirectory of /usr/include, etc., we should
1229 dnl prepend the subdirectory's name to the "#include" paths. It won't hurt
1230 dnl anything, and will make it more standardized. It's awkward to decide this
1231 dnl at configuration because of quoting, so we'll simply make all headers
1232 dnl installed via a script that can do the right thing.
1234 rm -f headers.sed headers.sh
1236 dnl ( generating this script makes the makefiles a little tidier :-)
1237 echo creating headers.sh
1238 cat >headers.sh <<CF_EOF
1240 # This shell script is generated by the 'configure' script. It is invoked in a
1241 # subdirectory of the build tree. It generates a sed-script in the parent
1242 # directory that is used to adjust includes for header files that reside in a
1243 # subdirectory of /usr/include, etc.
1245 while test \[$]# != 3
1247 PRG="\$PRG \[$]1"; shift
1252 TMPSRC=\${TMPDIR-/tmp}/\`basename \$SRC\`\$\$
1253 TMPSED=\${TMPDIR-/tmp}/headers.sed\$\$
1254 echo installing \$SRC in \$DST
1256 if test $WITH_CURSES_H = yes; then
1257 cat >>headers.sh <<CF_EOF
1260 END=\`basename \$DST\`
1261 for i in \`cat \$REF/../*/headers |fgrep -v "#"\`
1263 NAME=\`basename \$i\`
1264 echo "s/<\$NAME>/<\$END\/\$NAME>/" >> \$TMPSED
1273 cat >>headers.sh <<CF_EOF
1276 END=\`basename \$DST\`
1277 for i in \`cat \$REF/../*/headers |fgrep -v "#"\`
1279 NAME=\`basename \$i\`
1280 if test "\$NAME" = "curses.h"
1282 echo "s/<curses.h>/<ncurses.h>/" >> \$TMPSED
1285 echo "s/<\$NAME>/<\$END\/\$NAME>/" >> \$TMPSED
1289 echo "s/<curses.h>/<ncurses.h>/" >> \$TMPSED
1294 cat >>headers.sh <<CF_EOF
1296 sed -f \$TMPSED \$SRC > \$TMPSRC
1297 NAME=\`basename \$SRC\`
1299 if test $WITH_CURSES_H != yes; then
1300 cat >>headers.sh <<CF_EOF
1301 test "\$NAME" = "curses.h" && NAME=ncurses.h
1304 cat >>headers.sh <<CF_EOF
1305 # Just in case someone gzip'd manpages, remove the conflicting copy.
1306 test -f \$DST/\$NAME.gz && rm -f \$DST/\$NAME.gz
1308 eval \$PRG \$TMPSRC \$DST/\$NAME
1309 rm -f \$TMPSRC \$TMPSED
1312 chmod 0755 headers.sh
1314 for cf_dir in $SRC_SUBDIRS
1316 if test -f $srcdir/$cf_dir/headers; then
1317 cat >>$cf_dir/Makefile <<CF_EOF
1318 \$(DESTDIR)\$(includedir) :
1319 sh \$(srcdir)/../mkinstalldirs \[$]@
1323 install.includes :: \$(AUTO_SRC) \$(DESTDIR)\$(includedir) \\
1326 for i in `cat $srcdir/$cf_dir/headers |fgrep -v "#"`
1328 test -n "$j" && echo " $j \\" >>$cf_dir/Makefile
1331 echo " $j" >>$cf_dir/Makefile
1332 for i in `cat $srcdir/$cf_dir/headers |fgrep -v "#"`
1334 echo " @ (cd \$(DESTDIR)\$(includedir) && rm -f `basename $i`) ; ../headers.sh \$(INSTALL_DATA) \$(DESTDIR)\$(includedir) \$(srcdir) $i" >>$cf_dir/Makefile
1335 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
1338 cat >>$cf_dir/Makefile <<CF_EOF
1342 uninstall.includes ::
1344 for i in `cat $srcdir/$cf_dir/headers |fgrep -v "#"`
1347 echo " -@ (cd \$(DESTDIR)\$(includedir) && rm -f $i)" >>$cf_dir/Makefile
1348 test $i = curses.h && echo " -@ (cd \$(DESTDIR)\$(includedir) && rm -f ncurses.h)" >>$cf_dir/Makefile
1352 if test -f $srcdir/$cf_dir/modules; then
1353 if test "$cf_dir" != "c++" ; then
1354 cat >>$cf_dir/Makefile <<"CF_EOF"
1355 depend : $(AUTO_SRC)
1356 makedepend -- $(CPPFLAGS) -- $(C_SRC)
1358 # DO NOT DELETE THIS LINE -- make depend depends on it.
1365 dnl ---------------------------------------------------------------------------
1366 dnl Compute the library file-suffix from the given model name
1368 dnl $2 = variable to set
1369 dnl The variable $LIB_SUFFIX, if set, prepends the variable to set.
1370 AC_DEFUN([CF_LIB_SUFFIX],
1372 AC_REQUIRE([CF_SUBST_NCURSES_VERSION])
1374 libtool) $2='.la' ;;
1377 profile) $2='_p.a' ;;
1379 case $cf_cv_system_name in
1380 cygwin*) $2='.dll' ;;
1381 darwin*) $2='.dylib' ;;
1386 test -n "$LIB_SUFFIX" && $2="${LIB_SUFFIX}[$]{$2}"
1388 dnl ---------------------------------------------------------------------------
1389 dnl Compute the string to append to -library from the given model name
1391 dnl $2 = variable to set
1392 dnl The variable $LIB_SUFFIX, if set, prepends the variable to set.
1393 AC_DEFUN([CF_LIB_TYPE],
1402 test -n "$LIB_SUFFIX" && $2="${LIB_SUFFIX}[$]{$2}"
1404 dnl ---------------------------------------------------------------------------
1405 dnl Some systems have a non-ANSI linker that doesn't pull in modules that have
1406 dnl only data (i.e., no functions), for example NeXT. On those systems we'll
1407 dnl have to provide wrappers for global tables to ensure they're linked
1409 AC_DEFUN([CF_LINK_DATAONLY],
1411 AC_MSG_CHECKING([if data-only library module links])
1412 AC_CACHE_VAL(cf_cv_link_dataonly,[
1414 cat >conftest.$ac_ext <<EOF
1415 #line __oline__ "configure"
1416 int testdata[[3]] = { 123, 456, 789 };
1418 if AC_TRY_EVAL(ac_compile) ; then
1419 mv conftest.o data.o && \
1420 ( $AR $AR_OPTS conftest.a data.o ) 2>&5 1>/dev/null
1422 rm -f conftest.$ac_ext data.o
1423 cat >conftest.$ac_ext <<EOF
1424 #line __oline__ "configure"
1428 exit(1); /* I'm told this linker is broken */
1430 extern int testdata[[3]];
1431 return testdata[[0]] == 123
1432 && testdata[[1]] == 456
1433 && testdata[[2]] == 789;
1437 if AC_TRY_EVAL(ac_compile); then
1438 mv conftest.o func.o && \
1439 ( $AR $AR_OPTS conftest.a func.o ) 2>&5 1>/dev/null
1441 rm -f conftest.$ac_ext func.o
1442 ( eval $ac_cv_prog_RANLIB conftest.a ) 2>&5 >/dev/null
1444 LIBS="conftest.a $LIBS"
1448 extern int testfunc();
1452 [cf_cv_link_dataonly=yes],
1453 [cf_cv_link_dataonly=no],
1454 [cf_cv_link_dataonly=unknown])
1457 AC_MSG_RESULT($cf_cv_link_dataonly)
1459 if test "$cf_cv_link_dataonly" = no ; then
1460 AC_DEFINE(BROKEN_LINKER)
1465 dnl ---------------------------------------------------------------------------
1466 dnl Most Unix systems have both link and symlink, a few don't have symlink.
1467 dnl A few non-Unix systems implement symlink, but not link.
1468 dnl A few non-systems implement neither (or have nonfunctional versions).
1469 AC_DEFUN([CF_LINK_FUNCS],
1475 if test "$ac_cv_prog_cc_cross" = yes ; then
1480 AC_CACHE_CHECK(if link/symlink functions work,cf_cv_link_funcs,[
1482 for cf_func in link symlink ; do
1484 #include <sys/types.h>
1485 #include <sys/stat.h>
1486 #ifdef HAVE_UNISTD_H
1492 char *src = "config.log";
1493 char *dst = "conftest.chk";
1498 fail = ($cf_func("config.log", "conftest.chk") < 0)
1499 || (stat(dst, &dst_sb) < 0)
1500 || (dst_sb.st_mtime != src_sb.st_mtime);
1509 cf_cv_link_funcs="$cf_cv_link_funcs $cf_func"
1510 eval 'ac_cv_func_'$cf_func'=yes'],[
1511 eval 'ac_cv_func_'$cf_func'=no'],[
1512 eval 'ac_cv_func_'$cf_func'=error'])
1514 test -z "$cf_cv_link_funcs" && cf_cv_link_funcs=no
1516 test "$ac_cv_func_link" = yes && AC_DEFINE(HAVE_LINK)
1517 test "$ac_cv_func_symlink" = yes && AC_DEFINE(HAVE_SYMLINK)
1520 dnl ---------------------------------------------------------------------------
1521 dnl Some 'make' programs support $(MAKEFLAGS), some $(MFLAGS), to pass 'make'
1522 dnl options to lower-levels. It's very useful for "make -n" -- if we have it.
1523 dnl (GNU 'make' does both, something POSIX 'make', which happens to make the
1524 dnl $(MAKEFLAGS) variable incompatible because it adds the assignments :-)
1525 AC_DEFUN([CF_MAKEFLAGS],
1527 AC_CACHE_CHECK(for makeflags variable, cf_cv_makeflags,[
1529 for cf_option in '-$(MAKEFLAGS)' '$(MFLAGS)'
1531 cat >cf_makeflags.tmp <<CF_EOF
1534 @ echo '.$cf_option'
1536 cf_result=`${MAKE-make} -k -f cf_makeflags.tmp 2>/dev/null`
1537 case "$cf_result" in
1539 cf_result=`${MAKE-make} -k -f cf_makeflags.tmp CC=cc 2>/dev/null`
1540 case "$cf_result" in
1541 .*CC=*) cf_cv_makeflags=
1543 *) cf_cv_makeflags=$cf_option
1548 *) echo no match "$cf_result"
1552 rm -f cf_makeflags.tmp
1555 AC_SUBST(cf_cv_makeflags)
1557 dnl ---------------------------------------------------------------------------
1558 dnl Generate tags/TAGS targets for makefiles. Do not generate TAGS if we have
1559 dnl a monocase filesystem.
1560 AC_DEFUN([CF_MAKE_TAGS],[
1561 AC_REQUIRE([CF_MIXEDCASE_FILENAMES])
1562 AC_CHECK_PROG(MAKE_LOWER_TAGS, ctags, yes, no)
1564 if test "$cf_cv_mixedcase" = yes ; then
1565 AC_CHECK_PROG(MAKE_UPPER_TAGS, etags, yes, no)
1570 if test "$MAKE_UPPER_TAGS" = yes ; then
1575 AC_SUBST(MAKE_UPPER_TAGS)
1577 if test "$MAKE_LOWER_TAGS" = yes ; then
1582 AC_SUBST(MAKE_LOWER_TAGS)
1584 dnl ---------------------------------------------------------------------------
1585 dnl Option to allow user to override automatic configuration of manpage format.
1586 dnl There are several special cases.
1587 AC_DEFUN([CF_MANPAGE_FORMAT],
1589 AC_REQUIRE([CF_PATHSEP])
1590 AC_MSG_CHECKING(format of man-pages)
1592 AC_ARG_WITH(manpage-format,
1593 [ --with-manpage-format specify manpage-format: gzip/compress/BSDI/normal and
1594 optionally formatted, e.g., gzip,formatted],
1595 [MANPAGE_FORMAT=$withval],
1596 [MANPAGE_FORMAT=unknown])
1598 case ".$MANPAGE_FORMAT" in
1599 .gzip|.compress|.BSDI|.normal|.formatted) # (vi
1602 if test -z "$MANPATH" ; then
1603 MANPATH="/usr/man:/usr/share/man"
1605 # look for the 'date' man-page (it's most likely to be installed!)
1606 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATHSEP}"
1607 MANPAGE_FORMAT=unknown
1608 for cf_dir in $MANPATH; do
1609 test -z "$cf_dir" && cf_dir=/usr/man
1610 for cf_name in $cf_dir/*/date.[[01]]* $cf_dir/*/date
1612 cf_test=`echo $cf_name | sed -e 's/*//'`
1613 if test "x$cf_test" = "x$cf_name" ; then
1615 *.gz) MANPAGE_FORMAT=gzip;;
1616 *.Z) MANPAGE_FORMAT=compress;;
1617 *.0) MANPAGE_FORMAT=BSDI,formatted;;
1618 *) MANPAGE_FORMAT=normal;;
1623 if test "$MANPAGE_FORMAT" != "unknown" ; then
1630 AC_MSG_WARN(Unexpected manpage-format)
1634 AC_MSG_RESULT($MANPAGE_FORMAT)
1636 dnl ---------------------------------------------------------------------------
1637 dnl The Debian people have their own naming convention for manpages. This
1638 dnl option lets us override the name of the file containing renaming, or
1639 dnl disable it altogether.
1640 AC_DEFUN([CF_MANPAGE_RENAMES],
1642 AC_MSG_CHECKING(for manpage renaming)
1644 AC_ARG_WITH(manpage-renames,
1645 [ --with-manpage-renames specify manpage-renaming],
1646 [MANPAGE_RENAMES=$withval],
1647 [MANPAGE_RENAMES=yes])
1649 case ".$MANPAGE_RENAMES" in #(vi
1653 # Debian 'man' program?
1654 if test -f /etc/debian_version ; then
1655 MANPAGE_RENAMES=`cd $srcdir && pwd`/man/man_db.renames
1662 if test "$MANPAGE_RENAMES" != no ; then
1663 if test -f $srcdir/man/$MANPAGE_RENAMES ; then
1664 MANPAGE_RENAMES=`cd $srcdir/man && pwd`/$MANPAGE_RENAMES
1665 elif test ! -f $MANPAGE_RENAMES ; then
1666 AC_MSG_ERROR(not a filename: $MANPAGE_RENAMES)
1669 test ! -d man && mkdir man
1671 # Construct a sed-script to perform renaming within man-pages
1672 if test -n "$MANPAGE_RENAMES" ; then
1673 test ! -d man && mkdir man
1674 sh $srcdir/man/make_sed.sh $MANPAGE_RENAMES >man/edit_man.sed
1678 AC_MSG_RESULT($MANPAGE_RENAMES)
1679 AC_SUBST(MANPAGE_RENAMES)
1681 dnl ---------------------------------------------------------------------------
1682 dnl Some people expect each tool to make all aliases for manpages in the
1683 dnl man-directory. This accommodates the older, less-capable implementations
1684 dnl of 'man', and is optional.
1685 AC_DEFUN([CF_MANPAGE_SYMLINKS],
1687 AC_MSG_CHECKING(for manpage symlinks)
1689 AC_ARG_WITH(manpage-symlinks,
1690 [ --with-manpage-symlinks specify manpage-symlinks],
1691 [MANPAGE_SYMLINKS=$withval],
1692 [MANPAGE_SYMLINKS=yes])
1694 AC_MSG_RESULT($MANPAGE_SYMLINKS)
1696 dnl ---------------------------------------------------------------------------
1697 dnl This option causes manpages to be run through tbl(1) to generate tables
1699 AC_DEFUN([CF_MANPAGE_TBL],
1701 AC_MSG_CHECKING(for manpage tbl)
1703 AC_ARG_WITH(manpage-tbl,
1704 [ --with-manpage-tbl specify manpage processing with tbl],
1705 [MANPAGE_TBL=$withval],
1708 AC_MSG_RESULT($MANPAGE_TBL)
1710 dnl ---------------------------------------------------------------------------
1711 dnl Try to determine if the man-pages on the system are compressed, and if
1712 dnl so, what format is used. Use this information to construct a script that
1713 dnl will install man-pages.
1714 AC_DEFUN([CF_MAN_PAGES],
1716 CF_HELP_MESSAGE(Options to Specify How Manpages are Installed:)
1722 if test "$prefix" = "NONE" ; then
1723 cf_prefix="$ac_default_prefix"
1728 case "$MANPAGE_FORMAT" in # (vi
1730 cf_subdir='$mandir/cat'
1734 cf_subdir='$mandir/man'
1739 test ! -d man && mkdir man
1740 cat >man/edit_man.sh <<CF_EOF
1742 # this script is generated by the configure-script
1745 NCURSES_OSPEED="$NCURSES_OSPEED"
1746 TERMINFO="$TERMINFO"
1747 MKDIRS="sh `cd $srcdir && pwd`/mkinstalldirs"
1749 INSTALL_DATA="$INSTALL_DATA"
1750 transform="$program_transform_name"
1752 TMP=\${TMPDIR-/tmp}/man\$\$
1753 trap "rm -f \$TMP" 0 1 2 5 15
1766 *.orig|*.rej) ;; #(vi
1768 section=\`expr "\$i" : '.*\\.\\([[0-9]]\\)[[xm]]*'\`;
1769 if test \$verb = installing ; then
1770 if test ! -d $cf_subdir\${section} ; then
1771 \$MKDIRS $cf_subdir\$section
1775 source=\`basename \$i\`
1777 test ! -f \$inalias && inalias="\$srcdir/\$inalias"
1778 if test ! -f \$inalias ; then
1779 echo .. skipped \$source
1783 if test "$MANPAGE_SYMLINKS" = yes ; then
1784 cat >>man/edit_man.sh <<CF_EOF
1785 aliases=\`sed -f \$srcdir/manlinks.sed \$inalias | sort -u\`
1789 if test "$MANPAGE_RENAMES" = no ; then
1790 cat >>man/edit_man.sh <<CF_EOF
1791 # perform program transformations for section 1 man pages
1792 if test \$section = 1 ; then
1793 target=$cf_subdir\${section}/\`echo \$source|sed "\${transform}"\`
1795 target=$cf_subdir\${section}/\$source
1799 cat >>man/edit_man.sh <<CF_EOF
1800 target=\`grep "^\$source" $MANPAGE_RENAMES | $AWK '{print \[$]2}'\`
1801 if test -z "\$target" ; then
1802 echo '? missing rename for '\$source
1805 target="$cf_subdir\${section}/\${target}"
1809 # replace variables in man page
1813 cat >>man/edit_man.sh <<CF_EOF
1814 prog_$cf_name=\`echo $cf_name|sed "\${transform}"\`
1818 cat >>man/edit_man.sh <<CF_EOF
1819 sed -e "s,@DATADIR@,\$datadir," \\
1820 -e "s,@TERMINFO@,\$TERMINFO," \\
1821 -e "s,@NCURSES_OSPEED@,\$NCURSES_OSPEED," \\
1826 cf_NAME=`echo "$cf_name" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
1827 cat >>man/edit_man.sh <<CF_EOF
1828 -e "s,@$cf_NAME@,\$prog_$cf_name," \\
1832 if test -f $MANPAGE_RENAMES ; then
1833 cat >>man/edit_man.sh <<CF_EOF
1834 < \$i | sed -f edit_man.sed >\$TMP
1837 cat >>man/edit_man.sh <<CF_EOF
1841 if test $MANPAGE_TBL = yes ; then
1842 cat >>man/edit_man.sh <<CF_EOF
1843 tbl \$TMP >\$TMP.out
1847 if test $with_curses_h != yes ; then
1848 cat >>man/edit_man.sh <<CF_EOF
1849 sed -e "/\#[ ]*include/s,curses.h,ncurses.h," < \$TMP >\$TMP.out
1853 if test $cf_format = yes ; then
1854 cat >>man/edit_man.sh <<CF_EOF
1855 nroff -man \$TMP >\$TMP.out
1859 case "$MANPAGE_FORMAT" in #(vi
1861 cat >>man/edit_man.sh <<CF_EOF
1862 if test \$verb = installing ; then
1863 if ( compress -f \$TMP )
1872 cat >>man/edit_man.sh <<CF_EOF
1873 if test \$verb = installing ; then
1874 if ( gzip -f \$TMP )
1879 target="\$target.gz"
1883 cat >>man/edit_man.sh <<CF_EOF
1884 # BSDI installs only .0 suffixes in the cat directories
1885 target="\`echo \$target|sed -e 's/\.[[1-9]]\+.\?/.0/'\`"
1889 cat >>man/edit_man.sh <<CF_EOF
1890 suffix=\`basename \$target | sed -e 's/^[[^.]]*//'\`
1891 if test \$verb = installing ; then
1892 echo \$verb \$target
1893 \$INSTALL_DATA \$TMP \$target
1894 test -n "\$aliases" && (
1895 cd $cf_subdir\${section} && (
1896 target=\`basename \$target\`
1897 for cf_alias in \$aliases
1899 if test \$section = 1 ; then
1900 cf_alias=\`echo \$cf_alias|sed "\${transform}"\`
1903 if test -f \$cf_alias\${suffix} ; then
1904 if ( cmp -s \$target \$cf_alias\${suffix} )
1908 echo .. \$verb alias \$cf_alias\${suffix}
1909 rm -f \$cf_alias\${suffix}
1910 $LN_S \$target \$cf_alias\${suffix}
1913 echo .. \$verb alias \$cf_alias\${suffix}
1914 rm -f \$cf_alias\${suffix}
1915 $LN_S \$target \$cf_alias\${suffix}
1920 elif test \$verb = removing ; then
1921 echo \$verb \$target
1923 test -n "\$aliases" && (
1924 cd $cf_subdir\${section} && (
1925 for cf_alias in \$aliases
1927 if test \$section = 1 ; then
1928 cf_alias=\`echo \$cf_alias|sed "\${transform}"\`
1931 echo .. \$verb alias \$cf_alias\${suffix}
1932 rm -f \$cf_alias\${suffix}
1945 chmod 755 man/edit_man.sh
1948 dnl ---------------------------------------------------------------------------
1949 dnl Checks for libraries. At least one UNIX system, Apple Macintosh
1950 dnl Rhapsody 5.5, does not have -lm. We cannot use the simpler
1951 dnl AC_CHECK_LIB(m,sin), because that fails for C++.
1952 AC_DEFUN([CF_MATH_LIB],
1954 AC_CACHE_CHECK(if -lm needed for math functions,
1960 [double x = rand(); printf("result = %g\n", ]ifelse($2,,sin(x),$2)[)],
1961 [cf_cv_need_libm=no],
1962 [cf_cv_need_libm=yes])])
1963 if test "$cf_cv_need_libm" = yes
1970 dnl ---------------------------------------------------------------------------
1971 dnl Check if mbstate_t is declared, and if so, which header file.
1972 AC_DEFUN([CF_MBSTATE_T],
1974 # This is needed on Tru64 5.0 to declare mbstate_t
1975 AC_CACHE_CHECK(if we must include wchar.h to declare mbstate_t,cf_cv_mbstate_t,[
1978 #ifdef HAVE_LIBUTF8_H
1979 #include <libutf8.h>
1982 [cf_cv_mbstate_t=no],
1986 #ifdef HAVE_LIBUTF8_H
1987 #include <libutf8.h>
1990 [cf_cv_mbstate_t=yes],
1991 [cf_cv_mbstate_t=unknown])])])
1993 if test "$cf_cv_mbstate_t" = yes ; then
1994 AC_DEFINE(NEED_WCHAR_H)
1997 if test "$cf_cv_mbstate_t" != unknown ; then
1998 AC_DEFINE(HAVE_MBSTATE_T)
2001 dnl ---------------------------------------------------------------------------
2002 dnl Check if the file-system supports mixed-case filenames. If we're able to
2003 dnl create a lowercase name and see it as uppercase, it doesn't support that.
2004 AC_DEFUN([CF_MIXEDCASE_FILENAMES],
2006 AC_CACHE_CHECK(if filesystem supports mixed-case filenames,cf_cv_mixedcase,[
2007 rm -f conftest CONFTEST
2009 if test -f CONFTEST ; then
2014 rm -f conftest CONFTEST
2016 test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES)
2018 dnl ---------------------------------------------------------------------------
2019 dnl Check for a working mkstemp. This creates two files, checks that they are
2020 dnl successfully created and distinct (AmigaOS apparently fails on the last).
2021 AC_DEFUN([CF_MKSTEMP],[
2022 AC_CACHE_CHECK(for working mkstemp, cf_cv_func_mkstemp,[
2025 #include <sys/types.h>
2029 #include <sys/stat.h>
2032 char *tmpl = "conftestXXXXXX";
2040 for (n = 0; n < 2; ++n) {
2041 strcpy(name[n], tmpl);
2042 if ((fd = mkstemp(name[n])) >= 0) {
2043 if (!strcmp(name[n], tmpl)
2044 || stat(name[n], &sb) != 0
2045 || (sb.st_mode & S_IFMT) != S_IFREG
2046 || (sb.st_mode & 077) != 0) {
2053 && !strcmp(name[0], name[1]))
2057 ],[cf_cv_func_mkstemp=yes
2058 ],[cf_cv_func_mkstemp=no
2059 ],[AC_CHECK_FUNC(mkstemp)
2062 if test "$cf_cv_func_mkstemp" = yes ; then
2063 AC_DEFINE(HAVE_MKSTEMP)
2066 dnl ---------------------------------------------------------------------------
2067 dnl Compute the object-directory name from the given model name
2068 AC_DEFUN([CF_OBJ_SUBDIR],
2071 libtool) $2='obj_lo' ;;
2072 normal) $2='objects' ;;
2073 debug) $2='obj_g' ;;
2074 profile) $2='obj_p' ;;
2076 case $cf_cv_system_name in #(vi
2084 dnl ---------------------------------------------------------------------------
2085 dnl Provide a value for the $PATH and similar separator
2086 AC_DEFUN([CF_PATHSEP],
2088 case $cf_cv_system_name in
2089 os2*) PATHSEP=';' ;;
2092 ifelse($1,,,[$1=$PATHSEP])
2095 dnl ---------------------------------------------------------------------------
2096 dnl Check the argument to see that it looks like a pathname. Rewrite it if it
2097 dnl begins with one of the prefix/exec_prefix variables, and then again if the
2098 dnl result begins with 'NONE'. This is necessary to work around autoconf's
2099 dnl delayed evaluation of those symbols.
2100 AC_DEFUN([CF_PATH_SYNTAX],[
2101 case ".[$]$1" in #(vi
2102 .\[$]\(*\)*|.\'*\'*) #(vi
2106 .[[a-zA-Z]]:[[\\/]]*) #(vi OS/2 EMX
2108 .\[$]{*prefix}*) #(vi
2110 case ".[$]$1" in #(vi
2112 $1=`echo [$]$1 | sed -e s@NONE@$ac_default_prefix@`
2117 $1=`echo [$]$1 | sed -e s@NONE@$ac_default_prefix@`
2120 ifelse($2,,[AC_ERROR([expected a pathname, not \"[$]$1\"])],$2)
2124 dnl ---------------------------------------------------------------------------
2125 dnl Compute $PROG_EXT, used for non-Unix ports, such as OS/2 EMX.
2126 AC_DEFUN([CF_PROG_EXT],
2128 AC_REQUIRE([CF_CHECK_CACHE])
2130 case $cf_cv_system_name in
2132 # We make sure -Zexe is not used -- it would interfere with @PROG_EXT@
2133 CFLAGS="$CFLAGS -Zmt"
2134 CPPFLAGS="$CPPFLAGS -D__ST_MT_ERRNO__"
2135 CXXFLAGS="$CXXFLAGS -Zmt"
2136 LDFLAGS=`echo "$LDFLAGS -Zmt -Zcrtdll" | sed "s/-Zexe//g"`
2144 test -n "$PROG_EXT" && AC_DEFINE_UNQUOTED(PROG_EXT,"$PROG_EXT")
2146 dnl ---------------------------------------------------------------------------
2147 dnl Force $INSTALL to be an absolute-path. Otherwise, edit_man.sh and the
2148 dnl misc/tabset install won't work properly. Usually this happens only when
2149 dnl using the fallback mkinstalldirs script
2150 AC_DEFUN([CF_PROG_INSTALL],
2156 CF_DIRNAME(cf_dir,$INSTALL)
2157 test -z "$cf_dir" && cf_dir=.
2158 INSTALL=`cd $cf_dir && pwd`/`echo $INSTALL | sed -e 's:^.*/::'`
2162 dnl ---------------------------------------------------------------------------
2163 dnl Attempt to determine if we've got one of the flavors of regular-expression
2164 dnl code that we can support.
2165 AC_DEFUN([CF_REGEX],
2167 AC_MSG_CHECKING([for regular-expression headers])
2168 AC_CACHE_VAL(cf_cv_regex,[
2169 AC_TRY_LINK([#include <sys/types.h>
2170 #include <regex.h>],[
2172 int x = regcomp(p, "", 0);
2173 int y = regexec(p, "", 0, 0, 0);
2175 ],[cf_cv_regex="regex.h"],[
2176 AC_TRY_LINK([#include <regexp.h>],[
2177 char *p = compile("", "", "", 0);
2178 int x = step("", "");
2179 ],[cf_cv_regex="regexp.h"],[
2180 cf_save_LIBS="$LIBS"
2182 AC_TRY_LINK([#include <regexpr.h>],[
2183 char *p = compile("", "", "");
2184 int x = step("", "");
2185 ],[cf_cv_regex="regexpr.h"],[LIBS="$cf_save_LIBS"])])])
2187 AC_MSG_RESULT($cf_cv_regex)
2188 case $cf_cv_regex in
2189 regex.h) AC_DEFINE(HAVE_REGEX_H_FUNCS) ;;
2190 regexp.h) AC_DEFINE(HAVE_REGEXP_H_FUNCS) ;;
2191 regexpr.h) AC_DEFINE(HAVE_REGEXPR_H_FUNCS) ;;
2194 dnl ---------------------------------------------------------------------------
2195 dnl Attempt to determine the appropriate CC/LD options for creating a shared
2198 dnl Note: $(LOCAL_LDFLAGS) is used to link executables that will run within the
2199 dnl build-tree, i.e., by making use of the libraries that are compiled in ../lib
2200 dnl We avoid compiling-in a ../lib path for the shared library since that can
2201 dnl lead to unexpected results at runtime.
2202 dnl $(LOCAL_LDFLAGS2) has the same intention but assumes that the shared libraries
2203 dnl are compiled in ../../lib
2205 dnl The variable 'cf_cv_do_symlinks' is used to control whether we configure
2206 dnl to install symbolic links to the rel/abi versions of shared libraries.
2208 dnl The variable 'cf_cv_shlib_version' controls whether we use the rel or abi
2209 dnl version when making symbolic links.
2211 dnl The variable 'cf_cv_shlib_version_infix' controls whether shared library
2212 dnl version numbers are infix (ex: libncurses.<ver>.dylib) or postfix
2213 dnl (ex: libncurses.so.<ver>).
2215 dnl Some loaders leave 'so_locations' lying around. It's nice to clean up.
2216 AC_DEFUN([CF_SHARED_OPTS],
2218 AC_REQUIRE([CF_SUBST_NCURSES_VERSION])
2222 INSTALL_LIB="-m 644"
2224 cf_cv_do_symlinks=no
2226 AC_MSG_CHECKING(if release/abi version should be used for shared libs)
2227 AC_ARG_WITH(shlib-version,
2228 [ --with-shlib-version=X Specify rel or abi version for shared libs],
2229 [test -z "$withval" && withval=auto
2230 case $withval in #(vi
2232 cf_cv_shlib_version=auto
2234 rel|abi|auto|no) #(vi
2235 cf_cv_shlib_version=$withval
2238 AC_ERROR([option value must be one of: rel, abi, auto or no])
2241 ],[cf_cv_shlib_version=auto])
2242 AC_MSG_RESULT($cf_cv_shlib_version)
2246 # Some less-capable ports of gcc support only -fpic
2248 if test "$GCC" = yes
2250 AC_MSG_CHECKING(which $CC option to use)
2251 cf_save_CFLAGS="$CFLAGS"
2252 for CC_SHARED_OPTS in -fPIC -fpic ''
2254 CFLAGS="$cf_save_CFLAGS $CC_SHARED_OPTS"
2255 AC_TRY_COMPILE([#include <stdio.h>],[int x = 1],[break],[])
2257 AC_MSG_RESULT($CC_SHARED_OPTS)
2258 CFLAGS="$cf_save_CFLAGS"
2261 cf_cv_shlib_version_infix=no
2263 case $cf_cv_system_name in
2265 MK_SHARED_LIB='$(CC) -o $[@] -Xlinker -soname=`basename $[@]` -nostart -e 0'
2269 MK_SHARED_LIB='$(CC) -shared -Wl,--out-implib=$(IMPORT_LIB) -Wl,--export-all-symbols -o $(SHARED_LIB)'
2270 cf_cv_shlib_version=cygdll
2271 cf_cv_shlib_version_infix=cygdll
2274 EXTRA_CFLAGS="-no-cpp-precomp"
2275 CC_SHARED_OPTS="-dynamic"
2276 MK_SHARED_LIB='$(CC) -dynamiclib -install_name $(DESTDIR)$(libdir)/`basename $[@]` -compatibility_version $(ABI_VERSION) -current_version $(ABI_VERSION) -o $[@]'
2277 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=abi
2278 cf_cv_shlib_version_infix=yes
2281 # (tested with gcc 2.7.2 -- I don't have c89)
2282 if test "$GCC" = yes; then
2283 LD_SHARED_OPTS='-Xlinker +b -Xlinker $(libdir)'
2286 LD_SHARED_OPTS='-Wl,+b,$(libdir)'
2288 MK_SHARED_LIB='$(LD) +b $(libdir) -b -o $[@]'
2289 # HP-UX shared libraries must be executable, and should be
2290 # readonly to exploit a quirk in the memory manager.
2291 INSTALL_LIB="-m 555"
2294 if test "$cf_cv_ld_rpath" = yes ; then
2295 cf_ld_rpath_opt="-Wl,-rpath,"
2296 EXTRA_LDFLAGS="-Wl,-rpath,\$(libdir) $EXTRA_LDFLAGS"
2298 # tested with IRIX 5.2 and 'cc'.
2299 if test "$GCC" != yes; then
2300 CC_SHARED_OPTS='-KPIC'
2302 MK_SHARED_LIB='$(LD) -shared -rdata_shared -soname `basename $[@]` -o $[@]'
2303 cf_cv_rm_so_locs=yes
2306 if test "$DFT_LWR_MODEL" = "shared" ; then
2307 LOCAL_LDFLAGS="-Wl,-rpath,`pwd`/lib"
2308 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
2310 if test "$cf_cv_ld_rpath" = yes ; then
2311 cf_ld_rpath_opt="-Wl,-rpath,"
2312 EXTRA_LDFLAGS="$LOCAL_LDFLAGS $EXTRA_LDFLAGS"
2314 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
2315 MK_SHARED_LIB='$(CC) -shared -Wl,-soname,`basename $[@] .$(REL_VERSION)`.$(ABI_VERSION),-stats,-lc -o $[@]'
2318 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
2319 MK_SHARED_LIB='$(LD) -Bshareable -soname,`basename $[@].$(ABI_VERSION)` -o $[@]'
2322 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
2323 MK_SHARED_LIB='$(LD) -Bshareable -o $[@]'
2324 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
2327 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
2328 test "$cf_cv_ld_rpath" = yes && cf_ld_rpath_opt="-Wl,-rpath,"
2329 if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_ld_rpath" = yes ; then
2330 LOCAL_LDFLAGS="-Wl,-rpath,`pwd`/lib"
2331 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
2332 EXTRA_LDFLAGS="-Wl,-rpath,\$(libdir) $EXTRA_LDFLAGS"
2333 MK_SHARED_LIB='$(CC) -shared -Wl,-soname,`basename $[@] .$(REL_VERSION)`.$(ABI_VERSION) -o $[@]'
2334 if test "$cf_cv_shlib_version" = auto; then
2335 if test ! -f /usr/libexec/ld.elf_so; then
2336 cf_cv_shlib_version=rel
2340 MK_SHARED_LIB='$(LD) -Bshareable -o $[@]'
2344 # tested with OSF/1 V3.2 and 'cc'
2345 # tested with OSF/1 V3.2 and gcc 2.6.3 (but the c++ demo didn't
2346 # link with shared libs).
2347 MK_SHARED_LIB='$(LD) -set_version $(REL_VERSION):$(ABI_VERSION) -expect_unresolved "*" -shared -soname `basename $[@]`'
2350 MK_SHARED_LIB="${MK_SHARED_LIB} -msym"
2353 MK_SHARED_LIB="${MK_SHARED_LIB}"' -o $[@]'
2354 if test "$DFT_LWR_MODEL" = "shared" ; then
2355 LOCAL_LDFLAGS="-Wl,-rpath,`pwd`/lib"
2356 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
2358 if test "$cf_cv_ld_rpath" = yes ; then
2359 cf_ld_rpath_opt="-rpath"
2360 # EXTRA_LDFLAGS="$LOCAL_LDFLAGS $EXTRA_LDFLAGS"
2362 cf_cv_rm_so_locs=yes
2364 sco3.2v5*) # (also uw2* and UW7) hops 13-Apr-98
2365 # tested with osr5.0.5
2366 if test "$ac_cv_prog_gcc" != yes; then
2367 CC_SHARED_OPTS='-belf -KPIC'
2369 MK_SHARED_LIB='$(LD) -dy -G -h `basename $[@] .$(REL_VERSION)`.$(ABI_VERSION) -o [$]@'
2370 if test "$cf_cv_ld_rpath" = yes ; then
2371 # only way is to set LD_RUN_PATH but no switch for it
2374 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
2375 LINK_PROGS='LD_RUN_PATH=$(libdir)'
2376 LINK_TESTS='Pwd=`pwd`;LD_RUN_PATH=`dirname $${Pwd}`/lib'
2379 # tested with SunOS 4.1.1 and gcc 2.7.0
2380 if test "$ac_cv_prog_gcc" != yes; then
2381 CC_SHARED_OPTS='-KPIC'
2383 MK_SHARED_LIB='$(LD) -assert pure-text -o $[@]'
2384 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
2387 # tested with SunOS 5.5.1 (solaris 2.5.1) and gcc 2.7.2
2388 if test "$ac_cv_prog_gcc" != yes; then
2389 CC_SHARED_OPTS='-KPIC'
2391 MK_SHARED_LIB='$(LD) -dy -G -h `basename $[@] .$(REL_VERSION)`.$(ABI_VERSION) -o $[@]'
2392 if test "$DFT_LWR_MODEL" = "shared" ; then
2393 LOCAL_LDFLAGS="-R `pwd`/lib:\$(libdir)"
2394 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
2396 if test "$cf_cv_ld_rpath" = yes ; then
2397 cf_ld_rpath_opt="-R"
2398 EXTRA_LDFLAGS="$LOCAL_LDFLAGS $EXTRA_LDFLAGS"
2400 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
2403 # tested with UnixWare 7.1.0 (gcc 2.95.2 and cc)
2404 if test "$ac_cv_prog_gcc" != yes; then
2405 CC_SHARED_OPTS='-KPIC'
2407 MK_SHARED_LIB='$(LD) -d y -G -o [$]@'
2410 CC_SHARED_OPTS='unknown'
2411 MK_SHARED_LIB='echo unknown'
2415 # This works if the last tokens in $MK_SHARED_LIB are the -o target.
2416 case "$cf_cv_shlib_version" in #(vi
2418 case "$MK_SHARED_LIB" in #(vi
2420 test "$cf_cv_do_symlinks" = no && cf_cv_do_symlinks=yes
2423 AC_MSG_WARN(ignored --with-shlib-version)
2429 if test -n "$cf_ld_rpath_opt" ; then
2430 AC_MSG_CHECKING(if we need a space after rpath option)
2431 cf_save_LIBS="$LIBS"
2432 LIBS="$LIBS ${cf_ld_rpath_opt}$libdir"
2433 AC_TRY_LINK(, , cf_rpath_space=no, cf_rpath_space=yes)
2434 LIBS="$cf_save_LIBS"
2435 AC_MSG_RESULT($cf_rpath_space)
2436 test "$cf_rpath_space" = yes && cf_ld_rpath_opt="$cf_ld_rpath_opt "
2437 MK_SHARED_LIB="$MK_SHARED_LIB $cf_ld_rpath_opt\$(libdir)"
2440 AC_SUBST(CC_SHARED_OPTS)
2441 AC_SUBST(LD_SHARED_OPTS)
2442 AC_SUBST(MK_SHARED_LIB)
2443 AC_SUBST(LINK_PROGS)
2444 AC_SUBST(LINK_TESTS)
2445 AC_SUBST(EXTRA_LDFLAGS)
2446 AC_SUBST(LOCAL_LDFLAGS)
2447 AC_SUBST(LOCAL_LDFLAGS2)
2448 AC_SUBST(INSTALL_LIB)
2450 dnl ---------------------------------------------------------------------------
2451 dnl Check for definitions & structures needed for window size-changing
2452 dnl FIXME: check that this works with "snake" (HP-UX 10.x)
2453 AC_DEFUN([CF_SIZECHANGE],
2455 AC_REQUIRE([CF_STRUCT_TERMIOS])
2456 AC_CACHE_CHECK(declaration of size-change, cf_cv_sizechange,[
2457 cf_cv_sizechange=unknown
2458 cf_save_CPPFLAGS="$CPPFLAGS"
2460 for cf_opts in "" "NEED_PTEM_H"
2463 CPPFLAGS="$cf_save_CPPFLAGS"
2464 test -n "$cf_opts" && CPPFLAGS="$CPPFLAGS -D$cf_opts"
2465 AC_TRY_COMPILE([#include <sys/types.h>
2466 #ifdef HAVE_TERMIOS_H
2467 #include <termios.h>
2469 #ifdef HAVE_TERMIO_H
2474 /* This is a workaround for SCO: they neglected to define struct winsize in
2475 * termios.h -- it's only in termio.h and ptem.h
2477 #include <sys/stream.h>
2478 #include <sys/ptem.h>
2480 #if !defined(sun) || !defined(HAVE_TERMIOS_H)
2481 #include <sys/ioctl.h>
2485 struct ttysize win; /* FIXME: what system is this? */
2486 int y = win.ts_lines;
2487 int x = win.ts_cols;
2494 no TIOCGSIZE or TIOCGWINSZ
2495 #endif /* TIOCGWINSZ */
2496 #endif /* TIOCGSIZE */
2498 [cf_cv_sizechange=yes],
2499 [cf_cv_sizechange=no])
2501 CPPFLAGS="$cf_save_CPPFLAGS"
2502 if test "$cf_cv_sizechange" = yes ; then
2503 echo "size-change succeeded ($cf_opts)" >&AC_FD_CC
2504 test -n "$cf_opts" && cf_cv_sizechange="$cf_opts"
2509 if test "$cf_cv_sizechange" != no ; then
2510 AC_DEFINE(HAVE_SIZECHANGE)
2511 case $cf_cv_sizechange in #(vi
2513 AC_DEFINE_UNQUOTED($cf_cv_sizechange )
2518 dnl ---------------------------------------------------------------------------
2519 dnl For each parameter, test if the source-directory exists, and if it contains
2520 dnl a 'modules' file. If so, add to the list $cf_cv_src_modules which we'll
2521 dnl use in CF_LIB_RULES.
2523 dnl This uses the configured value to make the lists SRC_SUBDIRS and
2524 dnl SUB_MAKEFILES which are used in the makefile-generation scheme.
2525 AC_DEFUN([CF_SRC_MODULES],
2527 AC_MSG_CHECKING(for src modules)
2529 # dependencies and linker-arguments for test-programs
2530 TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${LIB_NAME}${DFT_DEP_SUFFIX} $TEST_DEPS"
2531 if test "$DFT_LWR_MODEL" = "libtool"; then
2532 TEST_ARGS="${TEST_DEPS}"
2534 TEST_ARGS="-l${LIB_NAME}${DFT_ARG_SUFFIX} $TEST_ARGS"
2537 # dependencies and linker-arguments for utility-programs
2538 PROG_ARGS="$TEST_ARGS"
2543 if test -f $srcdir/$cf_dir/modules; then
2545 # We may/may not have tack in the distribution, though the
2547 if test $cf_dir = tack ; then
2548 if test ! -f $srcdir/${cf_dir}/${cf_dir}.h; then
2553 if test -z "$cf_cv_src_modules"; then
2554 cf_cv_src_modules=$cf_dir
2556 cf_cv_src_modules="$cf_cv_src_modules $cf_dir"
2559 # Make the ncurses_cfg.h file record the library interface files as
2560 # well. These are header files that are the same name as their
2561 # directory. Ncurses is the only library that does not follow
2563 if test $cf_dir = tack ; then
2565 elif test -f $srcdir/${cf_dir}/${cf_dir}.h; then
2566 CF_UPPER(cf_have_include,$cf_dir)
2567 AC_DEFINE_UNQUOTED(HAVE_${cf_have_include}_H)
2568 AC_DEFINE_UNQUOTED(HAVE_LIB${cf_have_include})
2569 TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${cf_dir}${DFT_DEP_SUFFIX} $TEST_DEPS"
2570 if test "$DFT_LWR_MODEL" = "libtool"; then
2571 TEST_ARGS="${TEST_DEPS}"
2573 TEST_ARGS="-l${cf_dir}${DFT_ARG_SUFFIX} $TEST_ARGS"
2578 AC_MSG_RESULT($cf_cv_src_modules)
2579 TEST_ARGS="-L${LIB_DIR} $TEST_ARGS"
2583 PROG_ARGS="-L${LIB_DIR} $PROG_ARGS"
2586 SRC_SUBDIRS="man include"
2587 for cf_dir in $cf_cv_src_modules
2589 SRC_SUBDIRS="$SRC_SUBDIRS $cf_dir"
2591 SRC_SUBDIRS="$SRC_SUBDIRS test"
2592 test -z "$MAKE_TERMINFO" && SRC_SUBDIRS="$SRC_SUBDIRS misc"
2593 test "$cf_with_cxx_binding" != no && SRC_SUBDIRS="$SRC_SUBDIRS c++"
2596 if test "$cf_cv_prog_gnat_correct" = yes && test -f $srcdir/Ada95/Makefile.in; then
2597 SRC_SUBDIRS="$SRC_SUBDIRS Ada95"
2598 ADA_SUBDIRS="gen src samples"
2602 for cf_dir in $SRC_SUBDIRS
2604 SUB_MAKEFILES="$SUB_MAKEFILES $cf_dir/Makefile"
2607 if test -n "$ADA_SUBDIRS"; then
2608 for cf_dir in $ADA_SUBDIRS
2610 SUB_MAKEFILES="$SUB_MAKEFILES Ada95/$cf_dir/Makefile"
2612 AC_SUBST(ADA_SUBDIRS)
2615 dnl ---------------------------------------------------------------------------
2616 dnl Check for -lstdc++, which is GNU's standard C++ library.
2617 AC_DEFUN([CF_STDCPP_LIBRARY],
2619 if test -n "$GXX" ; then
2620 case $cf_cv_system_name in #(vi
2622 cf_stdcpp_libname=stdcpp
2625 cf_stdcpp_libname=stdc++
2628 AC_CACHE_CHECK(for library $cf_stdcpp_libname,cf_cv_libstdcpp,[
2630 LIBS="$LIBS -l$cf_stdcpp_libname"
2632 #include <strstream.h>],[
2634 strstreambuf foo(buf, sizeof(buf))
2636 [cf_cv_libstdcpp=yes],
2637 [cf_cv_libstdcpp=no])
2640 test "$cf_cv_libstdcpp" = yes && CXXLIBS="$CXXLIBS -l$cf_stdcpp_libname"
2643 dnl ---------------------------------------------------------------------------
2644 dnl Remove "-g" option from the compiler options
2645 AC_DEFUN([CF_STRIP_G_OPT],
2646 [$1=`echo ${$1} | sed -e 's/-g //' -e 's/-g$//'`])dnl
2647 dnl ---------------------------------------------------------------------------
2648 dnl Check if we need _POSIX_SOURCE defined to use struct sigaction. We'll only
2649 dnl do this if we've found the sigaction function.
2651 dnl If needed, define SVR4_ACTION.
2652 AC_DEFUN([CF_STRUCT_SIGACTION],[
2653 if test "$ac_cv_func_sigaction" = yes; then
2654 AC_MSG_CHECKING(whether sigaction needs _POSIX_SOURCE)
2656 #include <sys/types.h>
2657 #include <signal.h>],
2658 [struct sigaction act],
2662 #define _POSIX_SOURCE
2663 #include <sys/types.h>
2664 #include <signal.h>],
2665 [struct sigaction act],
2667 AC_DEFINE(SVR4_ACTION)],
2668 [sigact_bad=unknown])])
2669 AC_MSG_RESULT($sigact_bad)
2672 dnl ---------------------------------------------------------------------------
2673 dnl Some machines require _POSIX_SOURCE to completely define struct termios.
2674 dnl If so, define SVR4_TERMIO
2675 AC_DEFUN([CF_STRUCT_TERMIOS],[
2681 if test "$ISC" = yes ; then
2682 AC_CHECK_HEADERS( sys/termio.h )
2684 if test "$ac_cv_header_termios_h" = yes ; then
2685 case "$CFLAGS $CPPFLAGS" in
2687 termios_bad=dunno ;;
2688 *) termios_bad=maybe ;;
2690 if test "$termios_bad" = maybe ; then
2691 AC_MSG_CHECKING(whether termios.h needs _POSIX_SOURCE)
2692 AC_TRY_COMPILE([#include <termios.h>],
2693 [struct termios foo; int x = foo.c_iflag],
2696 #define _POSIX_SOURCE
2697 #include <termios.h>],
2698 [struct termios foo; int x = foo.c_iflag],
2699 termios_bad=unknown,
2700 termios_bad=yes AC_DEFINE(SVR4_TERMIO))
2702 AC_MSG_RESULT($termios_bad)
2706 dnl ---------------------------------------------------------------------------
2707 dnl Shorthand macro for substituting things that the user may override
2708 dnl with an environment variable.
2710 dnl $1 = long/descriptive name
2711 dnl $2 = environment variable
2712 dnl $3 = default value
2713 AC_DEFUN([CF_SUBST],
2714 [AC_CACHE_VAL(cf_cv_subst_$2,[
2715 AC_MSG_CHECKING(for $1 (symbol $2))
2716 test -z "[$]$2" && $2=$3
2717 AC_MSG_RESULT([$]$2)
2719 cf_cv_subst_$2=[$]$2])
2720 $2=${cf_cv_subst_$2}
2722 dnl ---------------------------------------------------------------------------
2723 dnl Get the version-number for use in shared-library naming, etc.
2724 AC_DEFUN([CF_SUBST_NCURSES_VERSION],
2726 NCURSES_MAJOR="`egrep '^NCURSES_MAJOR[[ ]]*=' $srcdir/dist.mk | sed -e 's/^[[^0-9]]*//'`"
2727 NCURSES_MINOR="`egrep '^NCURSES_MINOR[[ ]]*=' $srcdir/dist.mk | sed -e 's/^[[^0-9]]*//'`"
2728 NCURSES_PATCH="`egrep '^NCURSES_PATCH[[ ]]*=' $srcdir/dist.mk | sed -e 's/^[[^0-9]]*//'`"
2729 cf_cv_abi_version=${NCURSES_MAJOR}
2730 cf_cv_rel_version=${NCURSES_MAJOR}.${NCURSES_MINOR}
2731 dnl Show the computed version, for logging
2732 cf_cv_timestamp=`date`
2733 AC_MSG_RESULT(Configuring NCURSES $cf_cv_rel_version ABI $cf_cv_abi_version ($cf_cv_timestamp))
2734 dnl We need these values in the generated headers
2735 AC_SUBST(NCURSES_MAJOR)
2736 AC_SUBST(NCURSES_MINOR)
2737 AC_SUBST(NCURSES_PATCH)
2738 dnl We need these values in the generated makefiles
2739 AC_SUBST(cf_cv_rel_version)
2740 AC_SUBST(cf_cv_abi_version)
2741 AC_SUBST(cf_cv_cc_bool_type)
2742 AC_SUBST(cf_cv_builtin_bool)
2743 AC_SUBST(cf_cv_header_stdbool_h)
2744 AC_SUBST(cf_cv_type_of_bool)dnl
2746 dnl ---------------------------------------------------------------------------
2747 dnl Check if we can include <sys/time.h> with <sys/select.h>; this breaks on
2748 dnl older SCO configurations.
2749 AC_DEFUN([CF_SYS_TIME_SELECT],
2751 AC_MSG_CHECKING(if sys/time.h works with sys/select.h)
2752 AC_CACHE_VAL(cf_cv_sys_time_select,[
2754 #include <sys/types.h>
2755 #ifdef HAVE_SYS_TIME_H
2756 #include <sys/time.h>
2758 #ifdef HAVE_SYS_SELECT_H
2759 #include <sys/select.h>
2761 ],[],[cf_cv_sys_time_select=yes],
2762 [cf_cv_sys_time_select=no])
2764 AC_MSG_RESULT($cf_cv_sys_time_select)
2765 test "$cf_cv_sys_time_select" = yes && AC_DEFINE(HAVE_SYS_TIME_SELECT)
2767 dnl ---------------------------------------------------------------------------
2768 dnl Determine the type we should use for chtype (and attr_t, which is treated
2769 dnl as the same thing). We want around 32 bits, so on most machines want a
2770 dnl long, but on newer 64-bit machines, probably want an int. If we're using
2771 dnl wide characters, we have to have a type compatible with that, as well.
2772 AC_DEFUN([CF_TYPEOF_CHTYPE],
2774 AC_REQUIRE([CF_UNSIGNED_LITERALS])
2775 AC_MSG_CHECKING([for type of chtype])
2776 AC_CACHE_VAL(cf_cv_typeof_chtype,[
2778 #ifdef USE_WIDEC_SUPPORT
2779 #include <stddef.h> /* we want wchar_t */
2780 #define WANT_BITS 39
2782 #define WANT_BITS 31
2787 FILE *fp = fopen("cf_test.out", "w");
2789 char *result = "long";
2790 #ifdef USE_WIDEC_SUPPORT
2792 * If wchar_t is smaller than a long, it must be an int or a
2793 * short. We prefer not to use a short anyway.
2795 if (sizeof(unsigned long) > sizeof(wchar_t))
2798 if (sizeof(unsigned long) > sizeof(unsigned int)) {
2801 for (n = 0; n < WANT_BITS; n++) {
2802 unsigned int y = (x >> n);
2803 if (y != 1 || x == 0) {
2809 * If x is nonzero, an int is big enough for the bits
2812 result = (x != 0) ? "int" : "long";
2820 [cf_cv_typeof_chtype=`cat cf_test.out`],
2821 [cf_cv_typeof_chtype=long],
2822 [cf_cv_typeof_chtype=long])
2825 AC_MSG_RESULT($cf_cv_typeof_chtype)
2827 AC_SUBST(cf_cv_typeof_chtype)
2828 AC_DEFINE_UNQUOTED(TYPEOF_CHTYPE,$cf_cv_typeof_chtype)
2831 test "$cf_cv_unsigned_literals" = yes && cf_cv_1UL="${cf_cv_1UL}U"
2832 test "$cf_cv_typeof_chtype" = long && cf_cv_1UL="${cf_cv_1UL}L"
2836 dnl ---------------------------------------------------------------------------
2838 AC_DEFUN([CF_TYPE_SIGACTION],
2840 AC_MSG_CHECKING([for type sigaction_t])
2841 AC_CACHE_VAL(cf_cv_type_sigaction,[
2843 #include <signal.h>],
2845 [cf_cv_type_sigaction=yes],
2846 [cf_cv_type_sigaction=no])])
2847 AC_MSG_RESULT($cf_cv_type_sigaction)
2848 test "$cf_cv_type_sigaction" = yes && AC_DEFINE(HAVE_TYPE_SIGACTION)
2850 dnl ---------------------------------------------------------------------------
2851 dnl Test if the compiler supports 'U' and 'L' suffixes. Only old compilers
2852 dnl won't, but they're still there.
2853 AC_DEFUN([CF_UNSIGNED_LITERALS],
2855 AC_MSG_CHECKING([if unsigned literals are legal])
2856 AC_CACHE_VAL(cf_cv_unsigned_literals,[
2857 AC_TRY_COMPILE([],[long x = 1L + 1UL + 1U + 1],
2858 [cf_cv_unsigned_literals=yes],
2859 [cf_cv_unsigned_literals=no])
2861 AC_MSG_RESULT($cf_cv_unsigned_literals)
2863 dnl ---------------------------------------------------------------------------
2864 dnl Make an uppercase version of a variable
2865 dnl $1=uppercase($2)
2866 AC_DEFUN([CF_UPPER],
2868 $1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
2870 dnl ---------------------------------------------------------------------------
2871 dnl Use AC_VERBOSE w/o the warnings
2872 AC_DEFUN([CF_VERBOSE],
2873 [test -n "$verbose" && echo " $1" 1>&AC_FD_MSG
2875 dnl ---------------------------------------------------------------------------
2876 dnl Wrapper for AC_ARG_WITH to ensure that user supplies a pathname, not just
2877 dnl defaulting to yes/no.
2879 dnl $1 = option name
2881 dnl $3 = environment variable to set
2882 dnl $4 = default value, shown in the help-message, must be a constant
2883 dnl $5 = default value, if it's an expression & cannot be in the help-message
2885 AC_DEFUN([CF_WITH_PATH],
2886 [AC_ARG_WITH($1,[$2 ](default: ifelse($4,,empty,$4)),,
2887 ifelse($4,,[withval="${$3}"],[withval="${$3-ifelse($5,,$4,$5)}"]))dnl
2888 CF_PATH_SYNTAX(withval)
2892 dnl ---------------------------------------------------------------------------
2893 dnl Process an option specifying a list of colon-separated paths.
2895 dnl $1 = option name
2897 dnl $3 = environment variable to set
2898 dnl $4 = default value, shown in the help-message, must be a constant
2899 dnl $5 = default value, if it's an expression & cannot be in the help-message
2900 dnl $6 = flag to tell if we want to define or substitute
2902 AC_DEFUN([CF_WITH_PATHLIST],[
2903 AC_REQUIRE([CF_PATHSEP])
2904 AC_ARG_WITH($1,[$2 ](default: ifelse($4,,empty,$4)),,
2905 ifelse($4,,[withval=${$3}],[withval=${$3-ifelse($5,,$4,$5)}]))dnl
2907 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${PATHSEP}"
2909 for cf_src_path in $withval
2911 CF_PATH_SYNTAX(cf_src_path)
2912 test -n "$cf_dst_path" && cf_dst_path="${cf_dst_path}:"
2913 cf_dst_path="${cf_dst_path}${cf_src_path}"
2918 # Strip single quotes from the value, e.g., when it was supplied as a literal
2920 case $cf_dst_path in #(vi
2922 cf_dst_path=`echo $cf_dst_path |sed -e s/\'// -e s/\'\$//`
2925 cf_dst_path=`echo "$cf_dst_path" | sed -e 's/\\\\/\\\\\\\\/g'`
2928 eval '$3="$cf_dst_path"'