1 dnl***************************************************************************
2 dnl Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. *
4 dnl Permission is hereby granted, free of charge, to any person obtaining a *
5 dnl copy of this software and associated documentation files (the *
6 dnl "Software"), to deal in the Software without restriction, including *
7 dnl without limitation the rights to use, copy, modify, merge, publish, *
8 dnl distribute, distribute with modifications, sublicense, and/or sell *
9 dnl copies of the Software, and to permit persons to whom the Software is *
10 dnl furnished to do so, subject to the following conditions: *
12 dnl The above copyright notice and this permission notice shall be included *
13 dnl in all copies or substantial portions of the Software. *
15 dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
16 dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
17 dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
18 dnl IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
19 dnl DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
20 dnl OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
21 dnl THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
23 dnl Except as contained in this notice, the name(s) of the above copyright *
24 dnl holders shall not be used in advertising or otherwise to promote the *
25 dnl sale, use or other dealings in this Software without prior written *
27 dnl***************************************************************************
29 dnl Author: Thomas E. Dickey 1995-on
31 dnl $Id: aclocal.m4,v 1.549 2011/02/21 01:40:21 tom Exp $
32 dnl Macros used in NCURSES auto-configuration script.
34 dnl These macros are maintained separately from NCURSES. The copyright on
35 dnl this file applies to the aggregation of macros and does not affect use of
36 dnl these macros in other applications.
38 dnl See http://invisible-island.net/autoconf/ for additional information.
40 dnl ---------------------------------------------------------------------------
41 dnl ---------------------------------------------------------------------------
42 dnl AM_LANGINFO_CODESET version: 3 updated: 2002/10/27 23:21:42
43 dnl -------------------
44 dnl Inserted as requested by gettext 0.10.40
45 dnl File from /usr/share/aclocal
47 dnl ====================
50 dnl From Bruno Haible.
51 AC_DEFUN([AM_LANGINFO_CODESET],
53 AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
54 [AC_TRY_LINK([#include <langinfo.h>],
55 [char* cs = nl_langinfo(CODESET);],
56 am_cv_langinfo_codeset=yes,
57 am_cv_langinfo_codeset=no)
59 if test $am_cv_langinfo_codeset = yes; then
60 AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
61 [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
64 dnl ---------------------------------------------------------------------------
65 dnl CF_ADA_INCLUDE_DIRS version: 6 updated: 2010/02/26 19:52:07
66 dnl -------------------
67 dnl Construct the list of include-options for the C programs in the Ada95
69 AC_DEFUN([CF_ADA_INCLUDE_DIRS],
71 ACPPFLAGS="-I. -I../include -I../../include $ACPPFLAGS"
72 if test "$srcdir" != "."; then
73 ACPPFLAGS="-I\${srcdir}/../../include $ACPPFLAGS"
77 dnl ---------------------------------------------------------------------------
78 dnl CF_ADD_ADAFLAGS version: 1 updated: 2010/06/19 15:22:18
80 dnl Add to $ADAFLAGS, which is substituted into makefile and scripts.
81 AC_DEFUN([CF_ADD_ADAFLAGS],[
82 ADAFLAGS="$ADAFLAGS $1"
85 dnl ---------------------------------------------------------------------------
86 dnl CF_ADD_CFLAGS version: 10 updated: 2010/05/26 05:38:42
88 dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS
89 dnl The second parameter if given makes this macro verbose.
91 dnl Put any preprocessor definitions that use quoted strings in $EXTRA_CPPFLAGS,
92 dnl to simplify use of $CPPFLAGS in compiler checks, etc., that are easily
93 dnl confused by the quotes (which require backslashes to keep them usable).
94 AC_DEFUN([CF_ADD_CFLAGS],
99 cf_new_extra_cppflags=
101 for cf_add_cflags in $1
103 case $cf_fix_cppflags in
105 case $cf_add_cflags in #(vi
106 -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi
107 case $cf_add_cflags in
109 cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[[^=]]*='\''\"[[^"]]*//'`
111 test "${cf_add_cflags}" != "${cf_tst_cflags}" \
112 && test -z "${cf_tst_cflags}" \
113 && cf_fix_cppflags=yes
115 if test $cf_fix_cppflags = yes ; then
116 cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
118 elif test "${cf_tst_cflags}" = "\"'" ; then
119 cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
125 *$cf_add_cflags) #(vi
128 case $cf_add_cflags in #(vi
130 cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'`
131 CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,$cf_tst_cppflags)
134 cf_new_cppflags="$cf_new_cppflags $cf_add_cflags"
139 cf_new_cflags="$cf_new_cflags $cf_add_cflags"
144 cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
146 cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[[^"]]*"'\''//'`
148 test "${cf_add_cflags}" != "${cf_tst_cflags}" \
149 && test -z "${cf_tst_cflags}" \
150 && cf_fix_cppflags=no
155 if test -n "$cf_new_cflags" ; then
156 ifelse([$2],,,[CF_VERBOSE(add to \$CFLAGS $cf_new_cflags)])
157 CFLAGS="$CFLAGS $cf_new_cflags"
160 if test -n "$cf_new_cppflags" ; then
161 ifelse([$2],,,[CF_VERBOSE(add to \$CPPFLAGS $cf_new_cppflags)])
162 CPPFLAGS="$CPPFLAGS $cf_new_cppflags"
165 if test -n "$cf_new_extra_cppflags" ; then
166 ifelse([$2],,,[CF_VERBOSE(add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags)])
167 EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
170 AC_SUBST(EXTRA_CPPFLAGS)
173 dnl ---------------------------------------------------------------------------
174 dnl CF_ADD_INCDIR version: 13 updated: 2010/05/26 16:44:57
176 dnl Add an include-directory to $CPPFLAGS. Don't add /usr/include, since it's
177 dnl redundant. We don't normally need to add -I/usr/local/include for gcc,
178 dnl but old versions (and some misinstalled ones) need that. To make things
179 dnl worse, gcc 3.x may give error messages if -I/usr/local/include is added to
180 dnl the include-path).
181 AC_DEFUN([CF_ADD_INCDIR],
183 if test -n "$1" ; then
184 for cf_add_incdir in $1
186 while test $cf_add_incdir != /usr/include
188 if test -d $cf_add_incdir
191 if test -n "$CFLAGS$CPPFLAGS" ; then
192 # a loop is needed to ensure we can add subdirs of existing dirs
193 for cf_test_incdir in $CFLAGS $CPPFLAGS ; do
194 if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then
195 cf_have_incdir=yes; break
200 if test "$cf_have_incdir" = no ; then
201 if test "$cf_add_incdir" = /usr/local/include ; then
204 cf_save_CPPFLAGS=$CPPFLAGS
205 CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
206 AC_TRY_COMPILE([#include <stdio.h>],
209 [cf_have_incdir=yes])
210 CPPFLAGS=$cf_save_CPPFLAGS
215 if test "$cf_have_incdir" = no ; then
216 CF_VERBOSE(adding $cf_add_incdir to include-path)
217 ifelse([$2],,CPPFLAGS,[$2])="$ifelse([$2],,CPPFLAGS,[$2]) -I$cf_add_incdir"
219 cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'`
220 test "$cf_top_incdir" = "$cf_add_incdir" && break
221 cf_add_incdir="$cf_top_incdir"
230 dnl ---------------------------------------------------------------------------
231 dnl CF_ADD_LIB version: 2 updated: 2010/06/02 05:03:05
233 dnl Add a library, used to enforce consistency.
235 dnl $1 = library to add, without the "-l"
236 dnl $2 = variable to update (default $LIBS)
237 AC_DEFUN([CF_ADD_LIB],[CF_ADD_LIBS(-l$1,ifelse($2,,LIBS,[$2]))])dnl
238 dnl ---------------------------------------------------------------------------
239 dnl CF_ADD_LIBDIR version: 9 updated: 2010/05/26 16:44:57
241 dnl Adds to the library-path
243 dnl Some machines have trouble with multiple -L options.
245 dnl $1 is the (list of) directory(s) to add
246 dnl $2 is the optional name of the variable to update (default LDFLAGS)
248 AC_DEFUN([CF_ADD_LIBDIR],
250 if test -n "$1" ; then
251 for cf_add_libdir in $1
253 if test $cf_add_libdir = /usr/lib ; then
255 elif test -d $cf_add_libdir
258 if test -n "$LDFLAGS$LIBS" ; then
259 # a loop is needed to ensure we can add subdirs of existing dirs
260 for cf_test_libdir in $LDFLAGS $LIBS ; do
261 if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then
262 cf_have_libdir=yes; break
266 if test "$cf_have_libdir" = no ; then
267 CF_VERBOSE(adding $cf_add_libdir to library-path)
268 ifelse([$2],,LDFLAGS,[$2])="-L$cf_add_libdir $ifelse([$2],,LDFLAGS,[$2])"
274 dnl ---------------------------------------------------------------------------
275 dnl CF_ADD_LIBS version: 1 updated: 2010/06/02 05:03:05
277 dnl Add one or more libraries, used to enforce consistency.
279 dnl $1 = libraries to add, with the "-l", etc.
280 dnl $2 = variable to update (default $LIBS)
281 AC_DEFUN([CF_ADD_LIBS],[ifelse($2,,LIBS,[$2])="$1 [$]ifelse($2,,LIBS,[$2])"])dnl
282 dnl ---------------------------------------------------------------------------
283 dnl CF_ADD_SUBDIR_PATH version: 3 updated: 2010/07/03 20:58:12
284 dnl ------------------
285 dnl Append to a search-list for a nonstandard header/lib-file
286 dnl $1 = the variable to return as result
287 dnl $2 = the package name
288 dnl $3 = the subdirectory, e.g., bin, include or lib
289 dnl $4 = the directory under which we will test for subdirectories
290 dnl $5 = a directory that we do not want $4 to match
291 AC_DEFUN([CF_ADD_SUBDIR_PATH],
293 test "$4" != "$5" && \
295 ifelse([$5],NONE,,[(test $5 = NONE || test "$4" != "$5") &&]) {
296 test -n "$verbose" && echo " ... testing for $3-directories under $4"
297 test -d $4/$3 && $1="[$]$1 $4/$3"
298 test -d $4/$3/$2 && $1="[$]$1 $4/$3/$2"
299 test -d $4/$3/$2/$3 && $1="[$]$1 $4/$3/$2/$3"
300 test -d $4/$2/$3 && $1="[$]$1 $4/$2/$3"
301 test -d $4/$2/$3/$2 && $1="[$]$1 $4/$2/$3/$2"
304 dnl ---------------------------------------------------------------------------
305 dnl CF_ANSI_CC_CHECK version: 10 updated: 2010/10/23 15:52:32
307 dnl This is adapted from the macros 'fp_PROG_CC_STDC' and 'fp_C_PROTOTYPES'
308 dnl in the sharutils 4.2 distribution.
309 AC_DEFUN([CF_ANSI_CC_CHECK],
311 AC_CACHE_CHECK(for ${CC:-cc} option to accept ANSI C, cf_cv_ansi_cc,[
313 cf_save_CFLAGS="$CFLAGS"
314 cf_save_CPPFLAGS="$CPPFLAGS"
315 # Don't try gcc -ansi; that turns off useful extensions and
316 # breaks some systems' header files.
318 # Ultrix and OSF/1 -std1
319 # HP-UX -Aa -D_HPUX_SOURCE
321 # UnixWare 1.2 (cannot use -Xc, since ANSI/POSIX clashes)
322 for cf_arg in "-DCC_HAS_PROTOS" \
327 "-Aa -D_HPUX_SOURCE" \
330 CF_ADD_CFLAGS($cf_arg)
333 #ifndef CC_HAS_PROTOS
334 #if !defined(__STDC__) || (__STDC__ != 1)
339 int test (int i, double x);
340 struct s1 {int (*f) (int a);};
341 struct s2 {int (*f) (double a);};],
342 [cf_cv_ansi_cc="$cf_arg"; break])
344 CFLAGS="$cf_save_CFLAGS"
345 CPPFLAGS="$cf_save_CPPFLAGS"
348 if test "$cf_cv_ansi_cc" != "no"; then
349 if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then
350 CF_ADD_CFLAGS($cf_cv_ansi_cc)
352 AC_DEFINE(CC_HAS_PROTOS,[],[CC_HAS_PROTOS])
356 dnl ---------------------------------------------------------------------------
357 dnl CF_ANSI_CC_REQD version: 4 updated: 2008/03/23 14:48:54
359 dnl For programs that must use an ANSI compiler, obtain compiler options that
360 dnl will make it recognize prototypes. We'll do preprocessor checks in other
361 dnl macros, since tools such as unproto can fake prototypes, but only part of
362 dnl the preprocessor.
363 AC_DEFUN([CF_ANSI_CC_REQD],
364 [AC_REQUIRE([CF_ANSI_CC_CHECK])
365 if test "$cf_cv_ansi_cc" = "no"; then
367 [Your compiler does not appear to recognize prototypes.
368 You have the following choices:
369 a. adjust your compiler options
370 b. get an up-to-date compiler
371 c. use a wrapper such as unproto])
374 dnl ---------------------------------------------------------------------------
375 dnl CF_ARG_DISABLE version: 3 updated: 1999/03/30 17:24:31
377 dnl Allow user to disable a normally-on option.
378 AC_DEFUN([CF_ARG_DISABLE],
379 [CF_ARG_OPTION($1,[$2],[$3],[$4],yes)])dnl
380 dnl ---------------------------------------------------------------------------
381 dnl CF_ARG_OPTION version: 4 updated: 2010/05/26 05:38:42
383 dnl Restricted form of AC_ARG_ENABLE that ensures user doesn't give bogus
389 dnl $3 = action to perform if option is not default
390 dnl $4 = action if perform if option is default
391 dnl $5 = default option value (either 'yes' or 'no')
392 AC_DEFUN([CF_ARG_OPTION],
393 [AC_ARG_ENABLE([$1],[$2],[test "$enableval" != ifelse([$5],no,yes,no) && enableval=ifelse([$5],no,no,yes)
394 if test "$enableval" != "$5" ; then
396 ,[ $3]) ifelse([$4],,,[
399 fi],[enableval=$5 ifelse([$4],,,[
403 dnl ---------------------------------------------------------------------------
404 dnl CF_AR_FLAGS version: 5 updated: 2010/05/20 20:24:29
406 dnl Check for suitable "ar" (archiver) options for updating an archive.
407 AC_DEFUN([CF_AR_FLAGS],[
408 AC_REQUIRE([CF_PROG_AR])
410 AC_CACHE_CHECK(for options to update archives, cf_cv_ar_flags,[
411 cf_cv_ar_flags=unknown
412 for cf_ar_flags in -curv curv -crv crv -cqv cqv -rv rv
415 # check if $ARFLAGS already contains this choice
416 if test "x$ARFLAGS" != "x" ; then
417 cf_check_ar_flags=`echo "x$ARFLAGS" | sed -e "s/$cf_ar_flags\$//" -e "s/$cf_ar_flags / /"`
418 if test "x$ARFLAGS" != "$cf_check_ar_flags" ; then
424 rm -f conftest.$ac_cv_objext
427 cat >conftest.$ac_ext <<EOF
428 #line __oline__ "configure"
429 int testdata[[3]] = { 123, 456, 789 };
431 if AC_TRY_EVAL(ac_compile) ; then
432 echo "$AR $ARFLAGS $cf_ar_flags conftest.a conftest.$ac_cv_objext" >&AS_MESSAGE_LOG_FD
433 $AR $ARFLAGS $cf_ar_flags conftest.a conftest.$ac_cv_objext 2>&AS_MESSAGE_LOG_FD 1>/dev/null
434 if test -f conftest.a ; then
435 cf_cv_ar_flags=$cf_ar_flags
439 CF_VERBOSE(cannot compile test-program)
443 rm -f conftest.a conftest.$ac_ext conftest.$ac_cv_objext
446 if test -n "$ARFLAGS" ; then
447 if test -n "$cf_cv_ar_flags" ; then
448 ARFLAGS="$ARFLAGS $cf_cv_ar_flags"
451 ARFLAGS=$cf_cv_ar_flags
456 dnl ---------------------------------------------------------------------------
457 dnl CF_AWK_BIG_PRINTF version: 3 updated: 2008/12/27 12:30:03
458 dnl -----------------
459 dnl Check if awk can handle big strings using printf. Some older versions of
460 dnl awk choke on large strings passed via "%s".
462 dnl $1 = desired string size
463 dnl $2 = variable to set with result
464 AC_DEFUN([CF_AWK_BIG_PRINTF],
471 if ( ${AWK} 'BEGIN { xx = "x"; while (length(xx) < $1) { xx = xx "x"; }; printf("%s\n", xx); }' \
472 | $AWK '{ printf "%d\n", length([$]0); }' | $AWK 'BEGIN { eqls=0; recs=0; } { recs++; if ([$]0 == 12000) eqls++; } END { if (recs != 1 || eqls != 1) exit 1; }' 2>/dev/null >/dev/null ) ; then
480 dnl ---------------------------------------------------------------------------
481 dnl CF_BOOL_DECL version: 8 updated: 2004/01/30 15:51:18
483 dnl Test if 'bool' is a builtin type in the configured C++ compiler. Some
484 dnl older compilers (e.g., gcc 2.5.8) don't support 'bool' directly; gcc
485 dnl 2.6.3 does, in anticipation of the ANSI C++ standard.
487 dnl Treat the configuration-variable specially here, since we're directly
488 dnl substituting its value (i.e., 1/0).
490 dnl $1 is the shell variable to store the result in, if not $cv_cv_builtin_bool
491 AC_DEFUN([CF_BOOL_DECL],
493 AC_MSG_CHECKING(if we should include stdbool.h)
495 AC_CACHE_VAL(cf_cv_header_stdbool_h,[
496 AC_TRY_COMPILE([],[bool foo = false],
497 [cf_cv_header_stdbool_h=0],
502 ],[bool foo = false],
503 [cf_cv_header_stdbool_h=1],
504 [cf_cv_header_stdbool_h=0])])])
506 if test "$cf_cv_header_stdbool_h" = 1
507 then AC_MSG_RESULT(yes)
508 else AC_MSG_RESULT(no)
511 AC_MSG_CHECKING([for builtin bool type])
513 AC_CACHE_VAL(ifelse($1,,cf_cv_builtin_bool,[$1]),[
516 #include <sys/types.h>
518 [ifelse($1,,cf_cv_builtin_bool,[$1])=1],
519 [ifelse($1,,cf_cv_builtin_bool,[$1])=0])
522 if test "$ifelse($1,,cf_cv_builtin_bool,[$1])" = 1
523 then AC_MSG_RESULT(yes)
524 else AC_MSG_RESULT(no)
527 dnl ---------------------------------------------------------------------------
528 dnl CF_BOOL_SIZE version: 12 updated: 2006/12/16 12:33:30
530 dnl Test for the size of 'bool' in the configured C++ compiler (e.g., a type).
531 dnl Don't bother looking for bool.h, since it's been deprecated.
533 dnl If the current compiler is C rather than C++, we get the bool definition
534 dnl from <stdbool.h>.
535 AC_DEFUN([CF_BOOL_SIZE],
537 AC_MSG_CHECKING([for size of bool])
538 AC_CACHE_VAL(cf_cv_type_of_bool,[
544 #if defined(__cplusplus)
546 #ifdef HAVE_GXX_BUILTIN_H
547 #include <g++/builtin.h>
548 #elif HAVE_GPP_BUILTIN_H
549 #include <gpp/builtin.h>
556 #if $cf_cv_header_stdbool_h
564 FILE *fp = fopen("cf_test.out", "w");
568 fputs("unsigned ", fp);
569 if (sizeof(x) == sizeof(int)) fputs("int", fp);
570 else if (sizeof(x) == sizeof(char)) fputs("char", fp);
571 else if (sizeof(x) == sizeof(short))fputs("short",fp);
572 else if (sizeof(x) == sizeof(long)) fputs("long", fp);
575 ${cf_cv_main_return:-return}(0);
578 [cf_cv_type_of_bool=`cat cf_test.out`
579 if test -z "$cf_cv_type_of_bool"; then
580 cf_cv_type_of_bool=unknown
582 [cf_cv_type_of_bool=unknown],
583 [cf_cv_type_of_bool=unknown])
586 AC_MSG_RESULT($cf_cv_type_of_bool)
587 if test "$cf_cv_type_of_bool" = unknown ; then
588 case .$NCURSES_BOOL in #(vi
589 .auto|.) NCURSES_BOOL=unsigned;;
591 AC_MSG_WARN(Assuming $NCURSES_BOOL for type of bool)
592 cf_cv_type_of_bool=$NCURSES_BOOL
595 dnl ---------------------------------------------------------------------------
596 dnl CF_BUILD_CC version: 6 updated: 2006/10/14 15:23:15
598 dnl If we're cross-compiling, allow the user to override the tools and their
599 dnl options. The configure script is oriented toward identifying the host
600 dnl compiler, etc., but we need a build compiler to generate parts of the
603 dnl $1 = default for $CPPFLAGS
604 dnl $2 = default for $LIBS
605 AC_DEFUN([CF_BUILD_CC],[
606 AC_REQUIRE([CF_PROG_EXT])
607 if test "$cross_compiling" = yes ; then
609 # defaults that we might want to override
610 : ${BUILD_CFLAGS:=''}
611 : ${BUILD_CPPFLAGS:='ifelse([$1],,,[$1])'}
612 : ${BUILD_LDFLAGS:=''}
613 : ${BUILD_LIBS:='ifelse([$2],,,[$2])'}
614 : ${BUILD_EXEEXT:='$x'}
615 : ${BUILD_OBJEXT:='o'}
617 AC_ARG_WITH(build-cc,
618 [ --with-build-cc=XXX the build C compiler ($BUILD_CC)],
619 [BUILD_CC="$withval"],
620 [AC_CHECK_PROGS(BUILD_CC, gcc cc cl)])
621 AC_MSG_CHECKING(for native build C compiler)
622 AC_MSG_RESULT($BUILD_CC)
624 AC_MSG_CHECKING(for native build C preprocessor)
625 AC_ARG_WITH(build-cpp,
626 [ --with-build-cpp=XXX the build C preprocessor ($BUILD_CPP)],
627 [BUILD_CPP="$withval"],
628 [BUILD_CPP='${BUILD_CC} -E'])
629 AC_MSG_RESULT($BUILD_CPP)
631 AC_MSG_CHECKING(for native build C flags)
632 AC_ARG_WITH(build-cflags,
633 [ --with-build-cflags=XXX the build C compiler-flags ($BUILD_CFLAGS)],
634 [BUILD_CFLAGS="$withval"])
635 AC_MSG_RESULT($BUILD_CFLAGS)
637 AC_MSG_CHECKING(for native build C preprocessor-flags)
638 AC_ARG_WITH(build-cppflags,
639 [ --with-build-cppflags=XXX the build C preprocessor-flags ($BUILD_CPPFLAGS)],
640 [BUILD_CPPFLAGS="$withval"])
641 AC_MSG_RESULT($BUILD_CPPFLAGS)
643 AC_MSG_CHECKING(for native build linker-flags)
644 AC_ARG_WITH(build-ldflags,
645 [ --with-build-ldflags=XXX the build linker-flags ($BUILD_LDFLAGS)],
646 [BUILD_LDFLAGS="$withval"])
647 AC_MSG_RESULT($BUILD_LDFLAGS)
649 AC_MSG_CHECKING(for native build linker-libraries)
650 AC_ARG_WITH(build-libs,
651 [ --with-build-libs=XXX the build libraries (${BUILD_LIBS})],
652 [BUILD_LIBS="$withval"])
653 AC_MSG_RESULT($BUILD_LIBS)
655 # this assumes we're on Unix.
659 : ${BUILD_CC:='${CC}'}
661 if ( test "$BUILD_CC" = "$CC" || test "$BUILD_CC" = '${CC}' ) ; then
662 AC_MSG_ERROR([Cross-build requires two compilers.
663 Use --with-build-cc to specify the native compiler.])
667 : ${BUILD_CC:='${CC}'}
668 : ${BUILD_CPP:='${CPP}'}
669 : ${BUILD_CFLAGS:='${CFLAGS}'}
670 : ${BUILD_CPPFLAGS:='${CPPFLAGS}'}
671 : ${BUILD_LDFLAGS:='${LDFLAGS}'}
672 : ${BUILD_LIBS:='${LIBS}'}
673 : ${BUILD_EXEEXT:='$x'}
674 : ${BUILD_OBJEXT:='o'}
679 AC_SUBST(BUILD_CFLAGS)
680 AC_SUBST(BUILD_CPPFLAGS)
681 AC_SUBST(BUILD_LDFLAGS)
683 AC_SUBST(BUILD_EXEEXT)
684 AC_SUBST(BUILD_OBJEXT)
686 dnl ---------------------------------------------------------------------------
687 dnl CF_CFG_DEFAULTS version: 7 updated: 2005/09/24 16:15:00
689 dnl Determine the default configuration into which we'll install ncurses. This
690 dnl can be overridden by the user's command-line options. There's two items to
692 dnl 1. the prefix (e.g., /usr)
693 dnl 2. the header files (e.g., /usr/include/ncurses)
694 dnl We'll look for a previous installation of ncurses and use the same defaults.
696 dnl We don't use AC_PREFIX_DEFAULT, because it gets evaluated too soon, and
697 dnl we don't use AC_PREFIX_PROGRAM, because we cannot distinguish ncurses's
698 dnl programs from a vendor's.
699 AC_DEFUN([CF_CFG_DEFAULTS],
701 AC_MSG_CHECKING(for prefix)
702 if test "x$prefix" = "xNONE" ; then
703 case "$cf_cv_system_name" in
704 # non-vendor systems don't have a conflict
705 openbsd*|freebsd*|linux*|cygwin*|k*bsd*-gnu)
708 *) prefix=$ac_default_prefix
712 AC_MSG_RESULT($prefix)
714 if test "x$prefix" = "xNONE" ; then
715 AC_MSG_CHECKING(for default include-directory)
716 test -n "$verbose" && echo 1>&AS_MESSAGE_FD
719 $includedir/ncurses \
721 $prefix/include/ncurses \
723 /usr/local/include/ncurses \
727 cf_dir=`eval echo $cf_symbol`
728 if test -f $cf_dir/curses.h ; then
729 if ( fgrep NCURSES_VERSION $cf_dir/curses.h 2>&1 >/dev/null ) ; then
730 includedir="$cf_symbol"
731 test -n "$verbose" && echo $ac_n " found " 1>&AS_MESSAGE_FD
735 test -n "$verbose" && echo " tested $cf_dir" 1>&AS_MESSAGE_FD
737 AC_MSG_RESULT($includedir)
740 dnl ---------------------------------------------------------------------------
741 dnl CF_CGETENT version: 3 updated: 2000/08/12 23:18:52
743 dnl Check if the terminal-capability database functions are available. If not,
744 dnl ncurses has a much-reduced version.
745 AC_DEFUN([CF_CGETENT],[
746 AC_MSG_CHECKING(for terminal-capability database functions)
747 AC_CACHE_VAL(cf_cv_cgetent,[
749 #include <stdlib.h>],[
752 char *db_array = temp;
753 cgetent(&buf, /* int *, */ &db_array, "vt100");
754 cgetcap(buf, "tc", '=');
755 cgetmatch(buf, "tc");
760 AC_MSG_RESULT($cf_cv_cgetent)
761 test "$cf_cv_cgetent" = yes && AC_DEFINE(HAVE_BSD_CGETENT,[],[HAVE_BSD_CGETENT])
763 dnl ---------------------------------------------------------------------------
764 dnl CF_CHECK_CACHE version: 11 updated: 2008/03/23 14:45:59
766 dnl Check if we're accidentally using a cache from a different machine.
767 dnl Derive the system name, as a check for reusing the autoconf cache.
769 dnl If we've packaged config.guess and config.sub, run that (since it does a
770 dnl better job than uname). Normally we'll use AC_CANONICAL_HOST, but allow
771 dnl an extra parameter that we may override, e.g., for AC_CANONICAL_SYSTEM
772 dnl which is useful in cross-compiles.
774 dnl Note: we would use $ac_config_sub, but that is one of the places where
775 dnl autoconf 2.5x broke compatibility with autoconf 2.13
776 AC_DEFUN([CF_CHECK_CACHE],
778 if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then
779 ifelse([$1],,[AC_CANONICAL_HOST],[$1])
780 system_name="$host_os"
782 system_name="`(uname -s -r) 2>/dev/null`"
783 if test -z "$system_name" ; then
784 system_name="`(hostname) 2>/dev/null`"
787 test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name",[SYSTEM_NAME])
788 AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"])
790 test -z "$system_name" && system_name="$cf_cv_system_name"
791 test -n "$cf_cv_system_name" && AC_MSG_RESULT(Configuring for $cf_cv_system_name)
793 if test ".$system_name" != ".$cf_cv_system_name" ; then
794 AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name))
795 AC_MSG_ERROR("Please remove config.cache and try again.")
798 dnl ---------------------------------------------------------------------------
799 dnl CF_CHECK_ERRNO version: 11 updated: 2010/05/26 05:38:42
801 dnl Check for data that is usually declared in <stdio.h> or <errno.h>, e.g.,
802 dnl the 'errno' variable. Define a DECL_xxx symbol if we must declare it
805 dnl $1 = the name to check
806 dnl $2 = the assumed type
807 AC_DEFUN([CF_CHECK_ERRNO],
809 AC_CACHE_CHECK(if external $1 is declared, cf_cv_dcl_$1,[
815 #include <sys/types.h>
816 #include <errno.h> ],
817 ifelse([$2],,int,[$2]) x = (ifelse([$2],,int,[$2])) $1,
822 if test "$cf_cv_dcl_$1" = no ; then
823 CF_UPPER(cf_result,decl_$1)
824 AC_DEFINE_UNQUOTED($cf_result)
827 # It's possible (for near-UNIX clones) that the data doesn't exist
828 CF_CHECK_EXTERN_DATA($1,ifelse([$2],,int,[$2]))
830 dnl ---------------------------------------------------------------------------
831 dnl CF_CHECK_EXTERN_DATA version: 3 updated: 2001/12/30 18:03:23
832 dnl --------------------
833 dnl Check for existence of external data in the current set of libraries. If
834 dnl we can modify it, it's real enough.
835 dnl $1 = the name to check
837 AC_DEFUN([CF_CHECK_EXTERN_DATA],
839 AC_CACHE_CHECK(if external $1 exists, cf_cv_have_$1,[
849 if test "$cf_cv_have_$1" = yes ; then
850 CF_UPPER(cf_result,have_$1)
851 AC_DEFINE_UNQUOTED($cf_result)
855 dnl ---------------------------------------------------------------------------
856 dnl CF_CHECK_GPM_WGETCH version: 2 updated: 2010/08/14 18:25:37
857 dnl -------------------
858 dnl Check if GPM is already linked with curses. If so - and if the linkage
859 dnl is not "weak" - warn about this because it can create problems linking
860 dnl applications with ncurses.
861 AC_DEFUN([CF_CHECK_GPM_WGETCH],[
862 AC_CHECK_LIB(gpm,Gpm_Wgetch,[
864 AC_CACHE_CHECK(if GPM is weakly bound to curses library, cf_cv_check_gpm_wgetch,[
865 cf_cv_check_gpm_wgetch=unknown
866 if test "$cross_compiling" != yes ; then
868 cat >conftest.$ac_ext <<CF_EOF
873 ${cf_cv_main_return:-return}(0);
878 # This only works if we can look at the symbol table. If a shared
879 # library is stripped for install, we cannot use that. So we're forced
880 # to rely on the static library, noting that some packagers may not
882 LIBS="-static -lgpm -dynamic $LIBS"
883 if AC_TRY_EVAL(ac_compile) ; then
884 if AC_TRY_EVAL(ac_link) ; then
885 cf_cv_check_gpm_wgetch=`nm conftest$ac_exeext | egrep '\<wgetch\>' | egrep '\<[[vVwW]]\>'`
886 test -n "$cf_cv_check_gpm_wgetch" && cf_cv_check_gpm_wgetch=yes
887 test -z "$cf_cv_check_gpm_wgetch" && cf_cv_check_gpm_wgetch=no
895 if test "$cf_cv_check_gpm_wgetch" != yes ; then
896 AC_MSG_WARN(GPM library is already linked with curses - read the FAQ)
899 dnl ---------------------------------------------------------------------------
900 dnl CF_CPP_PARAM_INIT version: 4 updated: 2001/04/07 22:31:18
901 dnl -----------------
902 dnl Check if the C++ compiler accepts duplicate parameter initialization. This
903 dnl is a late feature for the standard and is not in some recent compilers
905 AC_DEFUN([CF_CPP_PARAM_INIT],
907 if test -n "$CXX"; then
908 AC_CACHE_CHECK(if $CXX accepts parameter initialization,cf_cv_cpp_param_init,[
920 TEST::TEST(int x = 1) // some compilers do not like second initializer
926 [cf_cv_cpp_param_init=yes],
927 [cf_cv_cpp_param_init=no],
928 [cf_cv_cpp_param_init=unknown])
932 test "$cf_cv_cpp_param_init" = yes && AC_DEFINE(CPP_HAS_PARAM_INIT,[],[CPP_HAS_PARAM_INIT])
934 dnl ---------------------------------------------------------------------------
935 dnl CF_CPP_STATIC_CAST version: 1 updated: 2005/07/23 16:52:43
936 dnl ------------------
937 dnl Check if the C++ compiler accepts static_cast in generics. This appears to
938 dnl not be supported in g++ before 3.0
939 AC_DEFUN([CF_CPP_STATIC_CAST],
941 if test -n "$CXX"; then
943 AC_CACHE_CHECK(if $CXX accepts static_cast,cf_cv_cpp_static_cast,[
951 NCursesPanel(int nlines,
961 template<class T> class NCursesUserPanel : public NCursesPanel
964 NCursesUserPanel (int nlines,
968 const T* p_UserData = static_cast<T*>(0))
969 : NCursesPanel (nlines, ncols, begin_y, begin_x)
972 NCursesUserPanel(const T* p_UserData = static_cast<T*>(0)) : NCursesPanel()
976 virtual ~NCursesUserPanel() {};
979 const char* p_UserData = static_cast<char*>(0)],
980 [cf_cv_cpp_static_cast=yes],
981 [cf_cv_cpp_static_cast=no])
988 test "$cf_cv_cpp_static_cast" = yes && AC_DEFINE(CPP_HAS_STATIC_CAST,[],[CPP_HAS_STATIC_CAST])
990 dnl ---------------------------------------------------------------------------
991 dnl CF_C_INLINE version: 3 updated: 2010/05/01 15:14:41
993 dnl Check if the C compiler supports "inline".
994 dnl $1 is the name of a shell variable to set if inline is supported
995 dnl $2 is the threshold for gcc 4.x's option controlling maximum inline size
996 AC_DEFUN([CF_C_INLINE],[
999 if test "$ac_cv_c_inline" != no ; then
1001 if test "$INTEL_COMPILER" = yes
1004 elif test "$GCC" = yes
1006 AC_CACHE_CHECK(if $CC supports options to tune inlining,cf_cv_gcc_inline,[
1007 cf_save_CFLAGS=$CFLAGS
1008 CFLAGS="$CFLAGS --param max-inline-insns-single=$2"
1009 AC_TRY_COMPILE([inline int foo(void) { return 1; }],
1010 [${cf_cv_main_return:-return} foo()],
1011 [cf_cv_gcc_inline=yes],
1012 [cf_cv_gcc_inline=no])
1013 CFLAGS=$cf_save_CFLAGS
1015 if test "$cf_cv_gcc_inline" = yes ; then
1016 CF_ADD_CFLAGS([--param max-inline-insns-single=$2])
1022 dnl ---------------------------------------------------------------------------
1023 dnl CF_DIRNAME version: 4 updated: 2002/12/21 19:25:52
1025 dnl "dirname" is not portable, so we fake it with a shell script.
1026 AC_DEFUN([CF_DIRNAME],[$1=`echo $2 | sed -e 's%/[[^/]]*$%%'`])dnl
1027 dnl ---------------------------------------------------------------------------
1028 dnl CF_DIRS_TO_MAKE version: 3 updated: 2002/02/23 20:38:31
1030 AC_DEFUN([CF_DIRS_TO_MAKE],
1033 for cf_item in $cf_list_models
1035 CF_OBJ_SUBDIR($cf_item,cf_subdir)
1036 for cf_item2 in $DIRS_TO_MAKE
1038 test $cf_item2 = $cf_subdir && break
1040 test ".$cf_item2" != ".$cf_subdir" && DIRS_TO_MAKE="$DIRS_TO_MAKE $cf_subdir"
1042 for cf_dir in $DIRS_TO_MAKE
1044 test ! -d $cf_dir && mkdir $cf_dir
1046 AC_SUBST(DIRS_TO_MAKE)
1048 dnl ---------------------------------------------------------------------------
1049 dnl CF_DISABLE_LEAKS version: 6 updated: 2010/07/23 04:14:32
1050 dnl ----------------
1051 dnl Combine no-leak checks with the libraries or tools that are used for the
1053 AC_DEFUN([CF_DISABLE_LEAKS],[
1055 AC_REQUIRE([CF_WITH_DMALLOC])
1056 AC_REQUIRE([CF_WITH_DBMALLOC])
1057 AC_REQUIRE([CF_WITH_VALGRIND])
1059 AC_MSG_CHECKING(if you want to perform memory-leak testing)
1060 AC_ARG_ENABLE(leaks,
1061 [ --disable-leaks test: free permanent memory, analyze leaks],
1062 [if test "x$enableval" = xno; then with_no_leaks=yes; else with_no_leaks=no; fi],
1063 : ${with_no_leaks:=no})
1064 AC_MSG_RESULT($with_no_leaks)
1066 if test "$with_no_leaks" = yes ; then
1068 AC_DEFINE(YY_NO_LEAKS,[],[NO_LEAKS])
1071 dnl ---------------------------------------------------------------------------
1072 dnl CF_DISABLE_LIBTOOL_VERSION version: 1 updated: 2010/05/15 15:45:59
1073 dnl --------------------------
1074 dnl Check if we should use the libtool 1.5 feature "-version-number" instead of
1075 dnl the older "-version-info" feature. The newer feature allows us to use
1076 dnl version numbering on shared libraries which make them compatible with
1077 dnl various systems.
1078 AC_DEFUN([CF_DISABLE_LIBTOOL_VERSION],
1080 AC_MSG_CHECKING(if libtool -version-number should be used)
1081 CF_ARG_DISABLE(libtool-version,
1082 [ --disable-libtool-version enable to use libtool's incompatible naming scheme],
1083 [cf_libtool_version=no],
1084 [cf_libtool_version=yes])
1085 AC_MSG_RESULT($cf_libtool_version)
1087 if test "$cf_libtool_version" = yes ; then
1088 LIBTOOL_VERSION="-version-number"
1090 LIBTOOL_VERSION="-version-info"
1093 AC_SUBST(LIBTOOL_VERSION)
1095 dnl ---------------------------------------------------------------------------
1096 dnl CF_DISABLE_RPATH_HACK version: 2 updated: 2011/02/13 13:31:33
1097 dnl ---------------------
1098 dnl The rpath-hack makes it simpler to build programs, particularly with the
1099 dnl *BSD ports which may have essential libraries in unusual places. But it
1100 dnl can interfere with building an executable for the base system. Use this
1101 dnl option in that case.
1102 AC_DEFUN([CF_DISABLE_RPATH_HACK],
1104 AC_MSG_CHECKING(if rpath-hack should be disabled)
1105 CF_ARG_DISABLE(rpath-hack,
1106 [ --disable-rpath-hack don't add rpath options for additional libraries],
1107 [cf_disable_rpath_hack=yes],
1108 [cf_disable_rpath_hack=no])
1109 AC_MSG_RESULT($cf_disable_rpath_hack)
1110 if test "$cf_disable_rpath_hack" = no ; then
1114 dnl ---------------------------------------------------------------------------
1115 dnl CF_ENABLE_RPATH version: 2 updated: 2010/03/27 18:39:42
1117 dnl Check if the rpath option should be used, setting cache variable
1118 dnl cf_cv_enable_rpath if so.
1119 AC_DEFUN([CF_ENABLE_RPATH],
1121 AC_MSG_CHECKING(if rpath option should be used)
1122 AC_ARG_ENABLE(rpath,
1123 [ --enable-rpath use rpath option when generating shared libraries],
1124 [cf_cv_enable_rpath=$enableval],
1125 [cf_cv_enable_rpath=no])
1126 AC_MSG_RESULT($cf_cv_enable_rpath)
1128 dnl ---------------------------------------------------------------------------
1129 dnl CF_ERRNO version: 5 updated: 1997/11/30 12:44:39
1131 dnl Check if 'errno' is declared in <errno.h>
1132 AC_DEFUN([CF_ERRNO],
1134 CF_CHECK_ERRNO(errno)
1136 dnl ---------------------------------------------------------------------------
1137 dnl CF_ETIP_DEFINES version: 3 updated: 2003/03/22 19:13:43
1139 dnl Test for conflicting definitions of exception in gcc 2.8.0, etc., between
1140 dnl math.h and builtin.h, only for ncurses
1141 AC_DEFUN([CF_ETIP_DEFINES],
1143 AC_MSG_CHECKING(for special defines needed for etip.h)
1144 cf_save_CXXFLAGS="$CXXFLAGS"
1146 for cf_math in "" MATH_H
1148 for cf_excp in "" MATH_EXCEPTION
1150 CXXFLAGS="$cf_save_CXXFLAGS -I${srcdir}/c++ -I${srcdir}/menu -I${srcdir}/include"
1151 test -n "$cf_math" && CXXFLAGS="$CXXFLAGS -DETIP_NEEDS_${cf_math}"
1152 test -n "$cf_excp" && CXXFLAGS="$CXXFLAGS -DETIP_NEEDS_${cf_excp}"
1154 #include <etip.h.in>
1156 test -n "$cf_math" && AC_DEFINE_UNQUOTED(ETIP_NEEDS_${cf_math})
1157 test -n "$cf_excp" && AC_DEFINE_UNQUOTED(ETIP_NEEDS_${cf_excp})
1158 cf_result="$cf_math $cf_excp"
1163 AC_MSG_RESULT($cf_result)
1164 CXXFLAGS="$cf_save_CXXFLAGS"
1166 dnl ---------------------------------------------------------------------------
1167 dnl CF_FIND_LINKAGE version: 19 updated: 2010/05/29 16:31:02
1169 dnl Find a library (specifically the linkage used in the code fragment),
1170 dnl searching for it if it is not already in the library path.
1171 dnl See also CF_ADD_SEARCHPATH.
1173 dnl Parameters (4-on are optional):
1174 dnl $1 = headers for library entrypoint
1175 dnl $2 = code fragment for library entrypoint
1176 dnl $3 = the library name without the "-l" option or ".so" suffix.
1177 dnl $4 = action to perform if successful (default: update CPPFLAGS, etc)
1178 dnl $5 = action to perform if not successful
1179 dnl $6 = module name, if not the same as the library name
1180 dnl $7 = extra libraries
1182 dnl Sets these variables:
1183 dnl $cf_cv_find_linkage_$3 - yes/no according to whether linkage is found
1184 dnl $cf_cv_header_path_$3 - include-directory if needed
1185 dnl $cf_cv_library_path_$3 - library-directory if needed
1186 dnl $cf_cv_library_file_$3 - library-file if needed, e.g., -l$3
1187 AC_DEFUN([CF_FIND_LINKAGE],[
1189 # If the linkage is not already in the $CPPFLAGS/$LDFLAGS configuration, these
1190 # will be set on completion of the AC_TRY_LINK below.
1191 cf_cv_header_path_$3=
1192 cf_cv_library_path_$3=
1194 CF_MSG_LOG([Starting [FIND_LINKAGE]($3,$6)])
1196 cf_save_LIBS="$LIBS"
1198 AC_TRY_LINK([$1],[$2],[
1199 cf_cv_find_linkage_$3=yes
1200 cf_cv_header_path_$3=/usr/include
1201 cf_cv_library_path_$3=/usr/lib
1204 LIBS="-l$3 $7 $cf_save_LIBS"
1206 AC_TRY_LINK([$1],[$2],[
1207 cf_cv_find_linkage_$3=yes
1208 cf_cv_header_path_$3=/usr/include
1209 cf_cv_library_path_$3=/usr/lib
1210 cf_cv_library_file_$3="-l$3"
1212 cf_cv_find_linkage_$3=no
1213 LIBS="$cf_save_LIBS"
1215 CF_VERBOSE(find linkage for $3 library)
1216 CF_MSG_LOG([Searching for headers in [FIND_LINKAGE]($3,$6)])
1218 cf_save_CPPFLAGS="$CPPFLAGS"
1219 cf_test_CPPFLAGS="$CPPFLAGS"
1221 CF_HEADER_PATH(cf_search,ifelse([$6],,[$3],[$6]))
1222 for cf_cv_header_path_$3 in $cf_search
1224 if test -d $cf_cv_header_path_$3 ; then
1225 CF_VERBOSE(... testing $cf_cv_header_path_$3)
1226 CPPFLAGS="$cf_save_CPPFLAGS -I$cf_cv_header_path_$3"
1227 AC_TRY_COMPILE([$1],[$2],[
1228 CF_VERBOSE(... found $3 headers in $cf_cv_header_path_$3)
1229 cf_cv_find_linkage_$3=maybe
1230 cf_test_CPPFLAGS="$CPPFLAGS"
1232 CPPFLAGS="$cf_save_CPPFLAGS"
1237 if test "$cf_cv_find_linkage_$3" = maybe ; then
1239 CF_MSG_LOG([Searching for $3 library in [FIND_LINKAGE]($3,$6)])
1241 cf_save_LIBS="$LIBS"
1242 cf_save_LDFLAGS="$LDFLAGS"
1245 CPPFLAGS="$cf_test_CPPFLAGS"
1246 LIBS="-l$3 $7 $cf_save_LIBS"
1247 AC_TRY_LINK([$1],[$2],[
1248 CF_VERBOSE(... found $3 library in system)
1249 cf_cv_find_linkage_$3=yes])
1250 CPPFLAGS="$cf_save_CPPFLAGS"
1251 LIBS="$cf_save_LIBS"
1254 if test "$cf_cv_find_linkage_$3" != yes ; then
1255 CF_LIBRARY_PATH(cf_search,$3)
1256 for cf_cv_library_path_$3 in $cf_search
1258 if test -d $cf_cv_library_path_$3 ; then
1259 CF_VERBOSE(... testing $cf_cv_library_path_$3)
1260 CPPFLAGS="$cf_test_CPPFLAGS"
1261 LIBS="-l$3 $7 $cf_save_LIBS"
1262 LDFLAGS="$cf_save_LDFLAGS -L$cf_cv_library_path_$3"
1263 AC_TRY_LINK([$1],[$2],[
1264 CF_VERBOSE(... found $3 library in $cf_cv_library_path_$3)
1265 cf_cv_find_linkage_$3=yes
1266 cf_cv_library_file_$3="-l$3"
1268 CPPFLAGS="$cf_save_CPPFLAGS"
1269 LIBS="$cf_save_LIBS"
1270 LDFLAGS="$cf_save_LDFLAGS"
1274 CPPFLAGS="$cf_save_CPPFLAGS"
1275 LDFLAGS="$cf_save_LDFLAGS"
1279 cf_cv_find_linkage_$3=no
1284 LIBS="$cf_save_LIBS"
1286 if test "$cf_cv_find_linkage_$3" = yes ; then
1288 CF_ADD_INCDIR($cf_cv_header_path_$3)
1289 CF_ADD_LIBDIR($cf_cv_library_path_$3)
1293 ifelse([$5],,AC_MSG_WARN(Cannot find $3 library),[$5])
1296 dnl ---------------------------------------------------------------------------
1297 dnl CF_FUNC_DLSYM version: 2 updated: 2010/05/29 16:31:02
1299 dnl Test for dlsym() and related functions, as well as libdl.
1304 AC_DEFUN([CF_FUNC_DLSYM],[
1306 AC_CHECK_FUNC(dlsym,cf_have_dlsym=yes,[
1309 AC_CHECK_LIB(dl,dlsym,[
1311 cf_have_libdl=yes])])
1313 if test "$cf_have_dlsym" = yes ; then
1314 test "$cf_have_libdl" = yes && CF_ADD_LIB(dl)
1316 AC_MSG_CHECKING(whether able to link to dl*() functions)
1317 AC_TRY_LINK([#include <dlfcn.h>],[
1319 if ((obj = dlopen("filename", 0)) != 0) {
1320 if (dlsym(obj, "symbolname") == 0) {
1324 AC_DEFINE(HAVE_LIBDL,[],[HAVE_LIBDL])],[
1325 AC_MSG_ERROR(Cannot link test program for libdl)])
1328 AC_MSG_ERROR(Cannot find dlsym function)
1331 dnl ---------------------------------------------------------------------------
1332 dnl CF_FUNC_MEMMOVE version: 7 updated: 2006/12/16 12:33:30
1334 dnl Check for memmove, or a bcopy that can handle overlapping copy. If neither
1335 dnl is found, add our own version of memmove to the list of objects.
1336 AC_DEFUN([CF_FUNC_MEMMOVE],
1338 AC_CHECK_FUNC(memmove,,[
1339 AC_CHECK_FUNC(bcopy,[
1340 AC_CACHE_CHECK(if bcopy does overlapping moves,cf_cv_good_bcopy,[
1343 static char data[] = "abcdefghijklmnopqrstuwwxyz";
1345 bcopy(data, temp, sizeof(data));
1346 bcopy(temp+10, temp, 15);
1347 bcopy(temp+5, temp+15, 10);
1348 ${cf_cv_main_return:-return} (strcmp(temp, "klmnopqrstuwwxypqrstuwwxyz"));
1351 [cf_cv_good_bcopy=yes],
1352 [cf_cv_good_bcopy=no],
1353 [cf_cv_good_bcopy=unknown])
1355 ],[cf_cv_good_bcopy=no])
1356 if test "$cf_cv_good_bcopy" = yes ; then
1357 AC_DEFINE(USE_OK_BCOPY,[],[USE_OK_BCOPY])
1359 AC_DEFINE(USE_MY_MEMMOVE,[],[USE_MY_MEMMOVE])
1362 dnl ---------------------------------------------------------------------------
1363 dnl CF_FUNC_NANOSLEEP version: 3 updated: 2006/12/16 12:33:30
1364 dnl -----------------
1365 dnl Check for existence of workable nanosleep() function. Some systems, e.g.,
1366 dnl AIX 4.x, provide a non-working version.
1367 AC_DEFUN([CF_FUNC_NANOSLEEP],[
1368 AC_CACHE_CHECK(if nanosleep really works,cf_cv_func_nanosleep,[
1374 #ifdef HAVE_SYS_TIME_H
1375 #include <sys/time.h>
1379 struct timespec ts1, ts2;
1382 ts1.tv_nsec = 750000000;
1386 code = nanosleep(&ts1, &ts2); /* on failure errno is ENOSYS. */
1387 ${cf_cv_main_return:-return}(code != 0);
1390 [cf_cv_func_nanosleep=yes],
1391 [cf_cv_func_nanosleep=no],
1392 [cf_cv_func_nanosleep=unknown])])
1394 test "$cf_cv_func_nanosleep" = "yes" && AC_DEFINE(HAVE_NANOSLEEP,[],[HAVE_NANOSLEEP])
1396 dnl ---------------------------------------------------------------------------
1397 dnl CF_FUNC_OPENPTY version: 3 updated: 2010/05/29 16:31:02
1399 dnl Check for openpty() function, along with <pty.h> header. It may need the
1400 dnl "util" library as well.
1401 AC_DEFUN([CF_FUNC_OPENPTY],
1403 AC_CHECK_LIB(util,openpty,cf_cv_lib_util=yes,cf_cv_lib_util=no)
1404 AC_CACHE_CHECK(for openpty header,cf_cv_func_openpty,[
1405 cf_save_LIBS="$LIBS"
1406 test $cf_cv_lib_util = yes && CF_ADD_LIB(util)
1407 for cf_header in pty.h libutil.h util.h
1410 #include <$cf_header>
1412 int x = openpty((int *)0, (int *)0, (char *)0,
1413 (struct termios *)0, (struct winsize *)0);
1415 cf_cv_func_openpty=$cf_header
1418 cf_cv_func_openpty=no
1421 LIBS="$cf_save_LIBS"
1424 dnl ---------------------------------------------------------------------------
1425 dnl CF_FUNC_POLL version: 4 updated: 2006/12/16 12:33:30
1427 dnl See if the poll function really works. Some platforms have poll(), but
1428 dnl it does not work for terminals or files.
1429 AC_DEFUN([CF_FUNC_POLL],[
1430 AC_CACHE_CHECK(if poll really works,cf_cv_working_poll,[
1436 #include <sys/poll.h>
1439 struct pollfd myfds;
1443 myfds.events = POLLIN;
1445 ret = poll(&myfds, 1, 100);
1446 ${cf_cv_main_return:-return}(ret != 0);
1448 [cf_cv_working_poll=yes],
1449 [cf_cv_working_poll=no],
1450 [cf_cv_working_poll=unknown])])
1451 test "$cf_cv_working_poll" = "yes" && AC_DEFINE(HAVE_WORKING_POLL,[],[HAVE_WORKING_POLL])
1453 dnl ---------------------------------------------------------------------------
1454 dnl CF_FUNC_TERMIOS version: 2 updated: 2000/07/22 23:37:24
1456 dnl Some old/broken variations define tcgetattr() only as a macro in
1458 AC_DEFUN([CF_FUNC_TERMIOS],[
1459 AC_REQUIRE([CF_STRUCT_TERMIOS])
1460 AC_CACHE_CHECK(for tcgetattr, cf_cv_have_tcgetattr,[
1462 #include <sys/types.h>
1463 #ifdef HAVE_UNISTD_H
1466 #ifdef HAVE_TERMIOS_H
1467 #include <termios.h>
1468 #define TTY struct termios
1470 #ifdef HAVE_TERMIO_H
1472 #define TTY struct termio
1477 tcgetattr(1, &foo);],
1478 [cf_cv_have_tcgetattr=yes],
1479 [cf_cv_have_tcgetattr=no])])
1480 test "$cf_cv_have_tcgetattr" = yes && AC_DEFINE(HAVE_TCGETATTR,[],[HAVE_TCGETATTR])
1482 dnl ---------------------------------------------------------------------------
1483 dnl CF_FUNC_VSSCANF version: 3 updated: 2001/12/19 00:50:10
1485 dnl Check for vsscanf() function, which is in c9x but generally not in earlier
1486 dnl versions of C. It is in the GNU C library, and can often be simulated by
1487 dnl other functions.
1488 AC_DEFUN([CF_FUNC_VSSCANF],
1490 AC_CACHE_CHECK(for vsscanf function or workaround,cf_cv_func_vsscanf,[
1493 #include <stdio.h>],[
1495 vsscanf("from", "%d", ap)],[cf_cv_func_vsscanf=vsscanf],[
1498 #include <stdio.h>],[
1502 strbuf._flag = _IOREAD;
1503 strbuf._ptr = strbuf._base = (unsigned char *) str;
1504 strbuf._cnt = strlen(str);
1505 strbuf._file = _NFILE;
1506 return (vfscanf(&strbuf, "%d", ap))],[cf_cv_func_vsscanf=vfscanf],[
1509 #include <stdio.h>],[
1513 strbuf._flag = _IOREAD;
1514 strbuf._ptr = strbuf._base = (unsigned char *) str;
1515 strbuf._cnt = strlen(str);
1516 strbuf._file = _NFILE;
1517 return (_doscan(&strbuf, "%d", ap))],[cf_cv_func_vsscanf=_doscan],[
1518 cf_cv_func_vsscanf=no])])])])
1520 case $cf_cv_func_vsscanf in #(vi
1521 vsscanf) AC_DEFINE(HAVE_VSSCANF,[],[HAVE_VSSCANF]);; #(vi
1522 vfscanf) AC_DEFINE(HAVE_VFSCANF,[1],[HAVE_VSSCANF]);; #(vi
1523 _doscan) AC_DEFINE(HAVE__DOSCAN,[],[HAVE__DOSCAN]);;
1527 dnl ---------------------------------------------------------------------------
1528 dnl CF_GCC_ATTRIBUTES version: 14 updated: 2010/10/23 15:52:32
1529 dnl -----------------
1530 dnl Test for availability of useful gcc __attribute__ directives to quiet
1531 dnl compiler warnings. Though useful, not all are supported -- and contrary
1532 dnl to documentation, unrecognized directives cause older compilers to barf.
1533 AC_DEFUN([CF_GCC_ATTRIBUTES],
1535 if test "$GCC" = yes
1537 cat > conftest.i <<EOF
1539 #define GCC_PRINTF 0
1544 #ifndef GCC_NORETURN
1545 #define GCC_NORETURN /* nothing */
1548 #define GCC_UNUSED /* nothing */
1551 if test "$GCC" = yes
1553 AC_CHECKING([for $CC __attribute__ directives])
1554 cat > conftest.$ac_ext <<EOF
1555 #line __oline__ "${as_me:-configure}"
1556 #include "confdefs.h"
1557 #include "conftest.h"
1558 #include "conftest.i"
1560 #define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
1562 #define GCC_PRINTFLIKE(fmt,var) /*nothing*/
1565 #define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var)))
1567 #define GCC_SCANFLIKE(fmt,var) /*nothing*/
1569 extern void wow(char *,...) GCC_SCANFLIKE(1,2);
1570 extern void oops(char *,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN;
1571 extern void foo(void) GCC_NORETURN;
1572 int main(int argc GCC_UNUSED, char *argv[[]] GCC_UNUSED) { return 0; }
1574 cf_printf_attribute=no
1575 cf_scanf_attribute=no
1576 for cf_attribute in scanf printf unused noreturn
1578 CF_UPPER(cf_ATTRIBUTE,$cf_attribute)
1579 cf_directive="__attribute__(($cf_attribute))"
1580 echo "checking for $CC $cf_directive" 1>&AS_MESSAGE_LOG_FD
1582 case $cf_attribute in #(vi
1584 cf_printf_attribute=yes
1585 cat >conftest.h <<EOF
1586 #define GCC_$cf_ATTRIBUTE 1
1590 cf_scanf_attribute=yes
1591 cat >conftest.h <<EOF
1592 #define GCC_$cf_ATTRIBUTE 1
1596 cat >conftest.h <<EOF
1597 #define GCC_$cf_ATTRIBUTE $cf_directive
1602 if AC_TRY_EVAL(ac_compile); then
1603 test -n "$verbose" && AC_MSG_RESULT(... $cf_attribute)
1604 cat conftest.h >>confdefs.h
1605 case $cf_attribute in #(vi
1607 if test "$cf_printf_attribute" = no ; then
1608 cat >>confdefs.h <<EOF
1609 #define GCC_PRINTFLIKE(fmt,var) /* nothing */
1612 cat >>confdefs.h <<EOF
1613 #define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
1618 if test "$cf_scanf_attribute" = no ; then
1619 cat >>confdefs.h <<EOF
1620 #define GCC_SCANFLIKE(fmt,var) /* nothing */
1623 cat >>confdefs.h <<EOF
1624 #define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var)))
1632 fgrep define conftest.i >>confdefs.h
1637 dnl ---------------------------------------------------------------------------
1638 dnl CF_GCC_VERSION version: 5 updated: 2010/04/24 11:02:31
1640 dnl Find version of gcc
1641 AC_DEFUN([CF_GCC_VERSION],[
1642 AC_REQUIRE([AC_PROG_CC])
1644 if test "$GCC" = yes ; then
1645 AC_MSG_CHECKING(version of $CC)
1646 GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`"
1647 test -z "$GCC_VERSION" && GCC_VERSION=unknown
1648 AC_MSG_RESULT($GCC_VERSION)
1651 dnl ---------------------------------------------------------------------------
1652 dnl CF_GCC_WARNINGS version: 27 updated: 2010/10/23 15:52:32
1654 dnl Check if the compiler supports useful warning options. There's a few that
1655 dnl we don't use, simply because they're too noisy:
1657 dnl -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x)
1658 dnl -Wredundant-decls (system headers make this too noisy)
1659 dnl -Wtraditional (combines too many unrelated messages, only a few useful)
1660 dnl -Wwrite-strings (too noisy, but should review occasionally). This
1661 dnl is enabled for ncurses using "--enable-const".
1665 dnl $1 is an optional list of gcc warning flags that a particular
1666 dnl application might want to use, e.g., "no-unused" for
1669 dnl If $with_ext_const is "yes", add a check for -Wwrite-strings
1671 AC_DEFUN([CF_GCC_WARNINGS],
1673 AC_REQUIRE([CF_GCC_VERSION])
1674 CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS)
1676 cat > conftest.$ac_ext <<EOF
1677 #line __oline__ "${as_me:-configure}"
1678 int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; }
1681 if test "$INTEL_COMPILER" = yes
1683 # The "-wdXXX" options suppress warnings:
1684 # remark #1419: external declaration in primary source file
1685 # remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
1686 # remark #1684: conversion from pointer to same-sized integral type (potential portability problem)
1687 # remark #193: zero used for undefined preprocessing identifier
1688 # remark #593: variable "curs_sb_left_arrow" was set but never used
1689 # remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits
1690 # remark #869: parameter "tw" was never referenced
1691 # remark #981: operands are evaluated in unspecified order
1692 # warning #279: controlling expression is constant
1694 AC_CHECKING([for $CC warning options])
1695 cf_save_CFLAGS="$CFLAGS"
1696 EXTRA_CFLAGS="-Wall"
1708 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
1709 if AC_TRY_EVAL(ac_compile); then
1710 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
1711 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
1714 CFLAGS="$cf_save_CFLAGS"
1716 elif test "$GCC" = yes
1718 AC_CHECKING([for $CC warning options])
1719 cf_save_CFLAGS="$CFLAGS"
1722 test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings"
1723 for cf_opt in W Wall \
1724 Wbad-function-cast \
1728 Wmissing-declarations \
1729 Wmissing-prototypes \
1733 Wstrict-prototypes \
1734 Wundef $cf_warn_CONST $1
1736 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
1737 if AC_TRY_EVAL(ac_compile); then
1738 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
1739 case $cf_opt in #(vi
1741 CPPFLAGS="$CPPFLAGS -DXTSTRINGDEFINES"
1744 case $GCC_VERSION in
1746 CF_VERBOSE(feature is broken in gcc $GCC_VERSION)
1751 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
1754 CFLAGS="$cf_save_CFLAGS"
1758 AC_SUBST(EXTRA_CFLAGS)
1760 dnl ---------------------------------------------------------------------------
1761 dnl CF_GNAT_GENERICS version: 1 updated: 2010/11/13 14:15:18
1762 dnl ----------------
1763 AC_DEFUN([CF_GNAT_GENERICS],
1765 AC_MSG_CHECKING(if GNAT supports generics)
1766 case $cf_gnat_version in #(vi
1767 3.[[1-9]]*|[[4-9]].*) #(vi
1768 cf_gnat_generics=yes
1774 AC_MSG_RESULT($cf_gnat_generics)
1776 if test "$cf_gnat_generics" = yes
1778 cf_compile_generics=generics
1779 cf_generic_objects="\${GENOBJS}"
1781 cf_compile_generics=
1785 AC_SUBST(cf_compile_generics)
1786 AC_SUBST(cf_generic_objects)
1788 dnl ---------------------------------------------------------------------------
1789 dnl CF_GNAT_PRAGMA_UNREF version: 1 updated: 2010/06/19 15:22:18
1790 dnl --------------------
1791 dnl Check if the gnat pragma "Unreferenced" works.
1792 AC_DEFUN([CF_GNAT_PRAGMA_UNREF],[
1793 AC_CACHE_CHECK(if GNAT pragma Unreferenced works,cf_cv_pragma_unreferenced,[
1794 CF_GNAT_TRY_LINK([procedure conftest;],
1797 procedure conftest is
1799 pragma Unreferenced (test);
1802 Text_IO.Put ("Hello World");
1804 GNAT.OS_Lib.OS_Exit (0);
1806 [cf_cv_pragma_unreferenced=yes],
1807 [cf_cv_pragma_unreferenced=no])])
1809 # if the pragma is supported, use it (needed in the Trace code).
1810 if test $cf_cv_pragma_unreferenced = yes ; then
1815 AC_SUBST(PRAGMA_UNREF)
1817 dnl ---------------------------------------------------------------------------
1818 dnl CF_GNAT_PROJECTS version: 1 updated: 2010/11/13 14:15:18
1819 dnl ----------------
1820 AC_DEFUN([CF_GNAT_PROJECTS],
1822 AC_MSG_CHECKING(if GNAT supports project files)
1823 case $cf_gnat_version in #(vi
1828 case $cf_cv_system_name in #(vi
1833 cf_gnat_projects=yes
1838 AC_MSG_RESULT($cf_gnat_projects)
1840 if test "$cf_gnat_projects" = yes
1842 USE_OLD_MAKERULES="#"
1843 USE_GNAT_PROJECTS=""
1845 USE_OLD_MAKERULES=""
1846 USE_GNAT_PROJECTS="#"
1849 AC_SUBST(USE_OLD_MAKERULES)
1850 AC_SUBST(USE_GNAT_PROJECTS)
1852 dnl ---------------------------------------------------------------------------
1853 dnl CF_GNAT_TRY_LINK version: 2 updated: 2010/08/14 18:25:37
1854 dnl ----------------
1855 dnl Verify that a test program compiles/links with GNAT.
1856 dnl $cf_ada_make is set to the program that compiles/links
1857 dnl $ADAFLAGS may be set to the GNAT flags.
1859 dnl $1 is the text of the spec
1860 dnl $2 is the text of the body
1861 dnl $3 is the shell command to execute if successful
1862 dnl $4 is the shell command to execute if not successful
1863 AC_DEFUN([CF_GNAT_TRY_LINK],
1866 cat >>conftest.ads <<CF_EOF
1869 cat >>conftest.adb <<CF_EOF
1872 if ( $cf_ada_make $ADAFLAGS conftest 1>&AS_MESSAGE_LOG_FD 2>&1 ) ; then
1873 ifelse($3,, :,[ $3])
1879 dnl ---------------------------------------------------------------------------
1880 dnl CF_GNAT_TRY_RUN version: 4 updated: 2010/08/14 18:25:37
1882 dnl Verify that a test program compiles and runs with GNAT
1883 dnl $cf_ada_make is set to the program that compiles/links
1884 dnl $ADAFLAGS may be set to the GNAT flags.
1886 dnl $1 is the text of the spec
1887 dnl $2 is the text of the body
1888 dnl $3 is the shell command to execute if successful
1889 dnl $4 is the shell command to execute if not successful
1890 AC_DEFUN([CF_GNAT_TRY_RUN],
1893 cat >>conftest.ads <<CF_EOF
1896 cat >>conftest.adb <<CF_EOF
1899 if ( $cf_ada_make $ADAFLAGS conftest 1>&AS_MESSAGE_LOG_FD 2>&1 ) ; then
1900 if ( ./conftest 1>&AS_MESSAGE_LOG_FD 2>&1 ) ; then
1901 ifelse($3,, :,[ $3])
1910 dnl ---------------------------------------------------------------------------
1911 dnl CF_GNAT_VERSION version: 16 updated: 2010/11/13 14:15:18
1913 dnl Verify version of GNAT.
1914 AC_DEFUN([CF_GNAT_VERSION],
1916 AC_MSG_CHECKING(for gnat version)
1917 cf_gnat_version=`${cf_ada_make:-gnatmake} -v 2>&1 | \
1918 grep '[[0-9]].[[0-9]][[0-9]]*' |\
1919 sed -e '2,$d' -e 's/[[^0-9 \.]]//g' -e 's/^[[ ]]*//' -e 's/ .*//'`
1920 AC_MSG_RESULT($cf_gnat_version)
1922 case $cf_gnat_version in #(vi
1923 3.1[[1-9]]*|3.[[2-9]]*|[[4-9]].*) #(vi
1924 cf_cv_prog_gnat_correct=yes
1927 AC_MSG_WARN(Unsupported GNAT version $cf_gnat_version. We require 3.11 or better. Disabling Ada95 binding.)
1928 cf_cv_prog_gnat_correct=no
1935 dnl ---------------------------------------------------------------------------
1936 dnl CF_GNU_SOURCE version: 6 updated: 2005/07/09 13:23:07
1938 dnl Check if we must define _GNU_SOURCE to get a reasonable value for
1939 dnl _XOPEN_SOURCE, upon which many POSIX definitions depend. This is a defect
1940 dnl (or misfeature) of glibc2, which breaks portability of many applications,
1941 dnl since it is interwoven with GNU extensions.
1943 dnl Well, yes we could work around it...
1944 AC_DEFUN([CF_GNU_SOURCE],
1946 AC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[
1947 AC_TRY_COMPILE([#include <sys/types.h>],[
1948 #ifndef _XOPEN_SOURCE
1951 [cf_cv_gnu_source=no],
1952 [cf_save="$CPPFLAGS"
1953 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
1954 AC_TRY_COMPILE([#include <sys/types.h>],[
1955 #ifdef _XOPEN_SOURCE
1958 [cf_cv_gnu_source=no],
1959 [cf_cv_gnu_source=yes])
1963 test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
1965 dnl ---------------------------------------------------------------------------
1966 dnl CF_GPP_LIBRARY version: 10 updated: 2010/05/29 16:31:02
1968 dnl If we're trying to use g++, test if libg++ is installed (a rather common
1969 dnl problem :-). If we have the compiler but no library, we'll be able to
1970 dnl configure, but won't be able to build the c++ demo program.
1971 AC_DEFUN([CF_GPP_LIBRARY],
1973 cf_cxx_library=unknown
1974 case $cf_cv_system_name in #(vi
1982 if test "$GXX" = yes; then
1983 AC_MSG_CHECKING([for lib$cf_gpp_libname])
1985 CF_ADD_LIB($cf_gpp_libname)
1987 #include <$cf_gpp_libname/builtin.h>
1989 [two_arg_error_handler_t foo2 = lib_error_handler],
1991 CF_ADD_LIB($cf_gpp_libname,CXXLIBS)
1992 if test "$cf_gpp_libname" = cpp ; then
1993 AC_DEFINE(HAVE_GPP_BUILTIN_H,[],[HAVE_GPP_BUILTIN_H])
1995 AC_DEFINE(HAVE_GXX_BUILTIN_H,[],[HAVE_GXX_BUILTIN_H])
1998 #include <builtin.h>
2000 [two_arg_error_handler_t foo2 = lib_error_handler],
2002 CF_ADD_LIB($cf_gpp_libname,CXXLIBS)
2003 AC_DEFINE(HAVE_BUILTIN_H,[],[HAVE_BUILTIN_H])],
2004 [cf_cxx_library=no])])
2006 AC_MSG_RESULT($cf_cxx_library)
2009 dnl ---------------------------------------------------------------------------
2010 dnl CF_GXX_VERSION version: 6 updated: 2010/10/23 15:44:18
2012 dnl Check for version of g++
2013 AC_DEFUN([CF_GXX_VERSION],[
2014 AC_REQUIRE([AC_PROG_CPP])
2016 if test "$GXX" = yes; then
2017 AC_MSG_CHECKING(version of g++)
2018 GXX_VERSION="`${CXX:-g++} --version| sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`"
2019 test -z "$GXX_VERSION" && GXX_VERSION=unknown
2020 AC_MSG_RESULT($GXX_VERSION)
2023 dnl ---------------------------------------------------------------------------
2024 dnl CF_GXX_WARNINGS version: 6 updated: 2010/08/14 18:25:37
2026 dnl Check if the compiler supports useful warning options.
2028 dnl Most of gcc's options apply to g++, except:
2029 dnl -Wbad-function-cast
2030 dnl -Wmissing-declarations
2031 dnl -Wnested-externs
2033 dnl Omit a few (for now):
2037 dnl $1 is an optional list of g++ warning flags that a particular
2038 dnl application might want to use, e.g., "no-unused" for
2041 dnl If $with_ext_const is "yes", add a check for -Wwrite-strings
2043 AC_DEFUN([CF_GXX_WARNINGS],
2046 CF_INTEL_COMPILER(GXX,INTEL_CPLUSPLUS,CXXFLAGS)
2048 AC_REQUIRE([CF_GXX_VERSION])
2053 cat > conftest.$ac_ext <<EOF
2054 #line __oline__ "configure"
2055 int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; }
2058 if test "$INTEL_CPLUSPLUS" = yes
2060 # The "-wdXXX" options suppress warnings:
2061 # remark #1419: external declaration in primary source file
2062 # remark #1682: implicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
2063 # remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
2064 # remark #1684: conversion from pointer to same-sized integral type (potential portability problem)
2065 # remark #193: zero used for undefined preprocessing identifier
2066 # remark #593: variable "curs_sb_left_arrow" was set but never used
2067 # remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits
2068 # remark #869: parameter "tw" was never referenced
2069 # remark #981: operands are evaluated in unspecified order
2070 # warning #269: invalid format string conversion
2072 AC_CHECKING([for $CC warning options])
2073 cf_save_CXXFLAGS="$CXXFLAGS"
2074 EXTRA_CXXFLAGS="-Wall"
2087 CXXFLAGS="$cf_save_CXXFLAGS $EXTRA_CXXFLAGS -$cf_opt"
2088 if AC_TRY_EVAL(ac_compile); then
2089 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
2090 EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS -$cf_opt"
2093 CXXFLAGS="$cf_save_CXXFLAGS"
2095 elif test "$GXX" = yes
2097 AC_CHECKING([for $CXX warning options])
2098 cf_save_CXXFLAGS="$CXXFLAGS"
2099 EXTRA_CXXFLAGS="-W -Wall"
2100 cf_gxx_extra_warnings=""
2101 test "$with_ext_const" = yes && cf_gxx_extra_warnings="Wwrite-strings"
2102 case "$GCC_VERSION" in
2106 cf_gxx_extra_warnings="$cf_gxx_extra_warnings Weffc++"
2112 Woverloaded-virtual \
2118 Wmissing-prototypes \
2121 Wstrict-prototypes \
2122 Wundef $cf_gxx_extra_warnings $1
2124 CXXFLAGS="$cf_save_CXXFLAGS $EXTRA_CXXFLAGS -Werror -$cf_opt"
2125 if AC_TRY_EVAL(ac_compile); then
2126 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
2127 EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS -$cf_opt"
2129 test -n "$verbose" && AC_MSG_RESULT(... no -$cf_opt)
2132 CXXFLAGS="$cf_save_CXXFLAGS"
2137 AC_SUBST(EXTRA_CXXFLAGS)
2139 dnl ---------------------------------------------------------------------------
2140 dnl CF_HASHED_DB version: 4 updated: 2010/05/29 16:31:02
2142 dnl Look for an instance of the Berkeley hashed database.
2144 dnl $1 = optional parameter, to specify install-prefix for the database.
2145 AC_DEFUN([CF_HASHED_DB],
2152 if test -d "$1" ; then
2153 CF_ADD_INCDIR($1/include)
2154 CF_ADD_LIBDIR($1/lib)
2158 AC_CHECK_HEADER(db.h,[
2159 CF_HASHED_DB_VERSION
2160 if test "$cf_cv_hashed_db_version" = unknown ; then
2161 AC_MSG_ERROR(Cannot determine version of db)
2164 if test "$cf_cv_hashed_db_libs" = unknown ; then
2165 AC_MSG_ERROR(Cannot determine library for db)
2166 elif test "$cf_cv_hashed_db_libs" != default ; then
2167 CF_ADD_LIB($cf_cv_hashed_db_libs)
2171 AC_MSG_ERROR(Cannot find db.h)
2174 dnl ---------------------------------------------------------------------------
2175 dnl CF_HASHED_DB_LIBS version: 9 updated: 2010/05/29 16:31:02
2176 dnl -----------------
2177 dnl Given that we have the header and version for hashed database, find the
2178 dnl library information.
2179 AC_DEFUN([CF_HASHED_DB_LIBS],
2181 AC_CACHE_CHECK(for db libraries, cf_cv_hashed_db_libs,[
2182 cf_cv_hashed_db_libs=unknown
2183 for cf_db_libs in "" db$cf_cv_hashed_db_version db-$cf_cv_hashed_db_version db ''
2185 cf_save_libs="$LIBS"
2186 if test -n "$cf_db_libs"; then
2187 CF_ADD_LIB($cf_db_libs)
2189 CF_MSG_LOG(checking for library "$cf_db_libs")
2191 $ac_includes_default
2194 char *path = "/tmp/foo";
2195 #ifdef DB_VERSION_MAJOR
2196 #if DB_VERSION_MAJOR >= 4
2198 db_create(&result, NULL, 0);
2199 result->open(result,
2206 #elif DB_VERSION_MAJOR >= 3
2208 db_create(&result, NULL, 0);
2209 result->open(result,
2215 #elif DB_VERSION_MAJOR >= 2
2224 #endif /* DB_VERSION_MAJOR */
2226 DB *result = dbopen(path,
2232 ${cf_cv_main_return:-return}(result != 0)
2234 if test -n "$cf_db_libs" ; then
2235 cf_cv_hashed_db_libs=$cf_db_libs
2237 cf_cv_hashed_db_libs=default
2239 LIBS="$cf_save_libs"
2242 LIBS="$cf_save_libs"
2246 dnl ---------------------------------------------------------------------------
2247 dnl CF_HASHED_DB_VERSION version: 3 updated: 2007/12/01 15:01:37
2248 dnl --------------------
2249 dnl Given that we have the header file for hashed database, find the version
2251 AC_DEFUN([CF_HASHED_DB_VERSION],
2253 AC_CACHE_CHECK(for version of db, cf_cv_hashed_db_version,[
2254 cf_cv_hashed_db_version=unknown
2256 for cf_db_version in 1 2 3 4 5
2258 CF_MSG_LOG(checking for db version $cf_db_version)
2260 $ac_includes_default
2263 #ifdef DB_VERSION_MAJOR
2264 /* db2 (DB_VERSION_MAJOR=2) has also DB_VERSION_MINOR, tested with 7 */
2265 #if $cf_db_version == DB_VERSION_MAJOR
2271 #if $cf_db_version == 1
2272 /* ok: assuming this is DB 1.8.5 */
2278 cf_cv_hashed_db_version=$cf_db_version
2284 dnl ---------------------------------------------------------------------------
2285 dnl CF_HEADER_PATH version: 12 updated: 2010/05/05 05:22:40
2287 dnl Construct a search-list of directories for a nonstandard header-file
2290 dnl $1 = the variable to return as result
2291 dnl $2 = the package name
2292 AC_DEFUN([CF_HEADER_PATH],
2296 # collect the current set of include-directories from compiler flags
2297 cf_header_path_list=""
2298 if test -n "${CFLAGS}${CPPFLAGS}" ; then
2299 for cf_header_path in $CPPFLAGS $CFLAGS
2301 case $cf_header_path in #(vi
2303 cf_header_path=`echo ".$cf_header_path" |sed -e 's/^...//' -e 's,/include$,,'`
2304 CF_ADD_SUBDIR_PATH($1,$2,include,$cf_header_path,NONE)
2305 cf_header_path_list="$cf_header_path_list [$]$1"
2311 # add the variations for the package we are looking for
2312 CF_SUBDIR_PATH($1,$2,include)
2314 test "$includedir" != NONE && \
2315 test "$includedir" != "/usr/include" && \
2316 test -d "$includedir" && {
2317 test -d $includedir && $1="[$]$1 $includedir"
2318 test -d $includedir/$2 && $1="[$]$1 $includedir/$2"
2321 test "$oldincludedir" != NONE && \
2322 test "$oldincludedir" != "/usr/include" && \
2323 test -d "$oldincludedir" && {
2324 test -d $oldincludedir && $1="[$]$1 $oldincludedir"
2325 test -d $oldincludedir/$2 && $1="[$]$1 $oldincludedir/$2"
2328 $1="[$]$1 $cf_header_path_list"
2330 dnl ---------------------------------------------------------------------------
2331 dnl CF_HELP_MESSAGE version: 3 updated: 1998/01/14 10:56:23
2333 dnl Insert text into the help-message, for readability, from AC_ARG_WITH.
2334 AC_DEFUN([CF_HELP_MESSAGE], [m4_append_uniq([HELP_ENABLE],[$1])])dnl
2335 dnl AC_DEFUN([CF_HELP_MESSAGE], [m4_append_uniq([_AC_USER_OPTS],[$1])])dnl
2337 dnl ---------------------------------------------------------------------------
2338 dnl CF_INCLUDE_DIRS version: 6 updated: 2009/01/06 19:37:40
2340 dnl Construct the list of include-options according to whether we're building
2341 dnl in the source directory or using '--srcdir=DIR' option. If we're building
2342 dnl with gcc, don't append the includedir if it happens to be /usr/include,
2343 dnl since that usually breaks gcc's shadow-includes.
2344 AC_DEFUN([CF_INCLUDE_DIRS],
2346 CPPFLAGS="$CPPFLAGS -I. -I../include"
2347 if test "$srcdir" != "."; then
2348 CPPFLAGS="$CPPFLAGS -I\${srcdir}/../include"
2352 dnl ---------------------------------------------------------------------------
2353 dnl CF_INTEL_COMPILER version: 4 updated: 2010/05/26 05:38:42
2354 dnl -----------------
2355 dnl Check if the given compiler is really the Intel compiler for Linux. It
2356 dnl tries to imitate gcc, but does not return an error when it finds a mismatch
2357 dnl between prototypes, e.g., as exercised by CF_MISSING_CHECK.
2359 dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to
2360 dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from
2361 dnl the wrappers for gcc and g++ warnings.
2363 dnl $1 = GCC (default) or GXX
2364 dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS
2365 dnl $3 = CFLAGS (default) or CXXFLAGS
2366 AC_DEFUN([CF_INTEL_COMPILER],[
2367 ifelse([$2],,INTEL_COMPILER,[$2])=no
2369 if test "$ifelse([$1],,[$1],GCC)" = yes ; then
2372 AC_MSG_CHECKING(if this is really Intel ifelse([$1],GXX,C++,C) compiler)
2373 cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])"
2374 ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -no-gcc"
2376 #ifdef __INTEL_COMPILER
2380 ],[ifelse([$2],,INTEL_COMPILER,[$2])=yes
2381 cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc"
2383 ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS"
2384 AC_MSG_RESULT($ifelse([$2],,INTEL_COMPILER,[$2]))
2389 dnl ---------------------------------------------------------------------------
2390 dnl CF_ISASCII version: 3 updated: 2000/08/12 23:18:52
2392 dnl Check if we have either a function or macro for 'isascii()'.
2393 AC_DEFUN([CF_ISASCII],
2395 AC_MSG_CHECKING(for isascii)
2396 AC_CACHE_VAL(cf_cv_have_isascii,[
2397 AC_TRY_LINK([#include <ctype.h>],[int x = isascii(' ')],
2398 [cf_cv_have_isascii=yes],
2399 [cf_cv_have_isascii=no])
2401 AC_MSG_RESULT($cf_cv_have_isascii)
2402 test "$cf_cv_have_isascii" = yes && AC_DEFINE(HAVE_ISASCII,[],[HAVE_ISASCII])
2404 dnl ---------------------------------------------------------------------------
2405 dnl CF_LARGEFILE version: 7 updated: 2007/06/02 11:58:50
2407 dnl Add checks for large file support.
2408 AC_DEFUN([CF_LARGEFILE],[
2409 ifdef([AC_FUNC_FSEEKO],[
2411 if test "$enable_largefile" != no ; then
2414 # Normally we would collect these definitions in the config.h,
2415 # but (like _XOPEN_SOURCE), some environments rely on having these
2416 # defined before any of the system headers are included. Another
2417 # case comes up with C++, e.g., on AIX the compiler compiles the
2418 # header files by themselves before looking at the body files it is
2419 # told to compile. For ncurses, those header files do not include
2421 test "$ac_cv_sys_large_files" != no && CPPFLAGS="$CPPFLAGS -D_LARGE_FILES "
2422 test "$ac_cv_sys_largefile_source" != no && CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE "
2423 test "$ac_cv_sys_file_offset_bits" != no && CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits "
2425 AC_CACHE_CHECK(whether to use struct dirent64, cf_cv_struct_dirent64,[
2427 #include <sys/types.h>
2430 /* if transitional largefile support is setup, this is true */
2431 extern struct dirent64 * readdir(DIR *);
2432 struct dirent64 *x = readdir((DIR *)0);
2433 struct dirent *y = readdir((DIR *)0);
2436 [cf_cv_struct_dirent64=yes],
2437 [cf_cv_struct_dirent64=no])
2439 test "$cf_cv_struct_dirent64" = yes && AC_DEFINE(HAVE_STRUCT_DIRENT64,[],[HAVE_STRUCT_DIRENT64])
2443 dnl ---------------------------------------------------------------------------
2444 dnl CF_LDFLAGS_STATIC version: 8 updated: 2010/10/23 14:39:56
2445 dnl -----------------
2446 dnl Check for compiler/linker flags used to temporarily force usage of static
2447 dnl libraries. This depends on the compiler and platform. Use this to help
2448 dnl ensure that the linker picks up a given library based on its position in
2449 dnl the list of linker options and libraries.
2450 AC_DEFUN([CF_LDFLAGS_STATIC],[
2452 if test "$GCC" = yes ; then
2453 case $cf_cv_system_name in #(
2454 OS/2*|os2*|aix[[4]]*|solaris2.1[[0-9]]|darwin*) #( vi
2458 *) #( normally, except when broken
2459 LDFLAGS_STATIC=-static
2460 LDFLAGS_SHARED=-dynamic
2464 case $cf_cv_system_name in #(
2465 aix[[456]]*) #( from ld manpage
2466 LDFLAGS_STATIC=-bstatic
2467 LDFLAGS_SHARED=-bdynamic
2469 hpux*) #( from ld manpage for hpux10.20, hpux11.11
2470 # We could also use just "archive" and "shared".
2471 LDFLAGS_STATIC=-Wl,-a,archive_shared
2472 LDFLAGS_SHARED=-Wl,-a,shared_archive
2474 irix*) #( from ld manpage IRIX64
2475 LDFLAGS_STATIC=-Bstatic
2476 LDFLAGS_SHARED=-Bdynamic
2478 osf[[45]]*) #( from ld manpage osf4.0d, osf5.1
2479 # alternative "-oldstyle_liblookup" (not in cc manpage)
2480 LDFLAGS_STATIC=-noso
2481 LDFLAGS_SHARED=-so_archive
2484 LDFLAGS_STATIC=-Bstatic
2485 LDFLAGS_SHARED=-Bdynamic
2490 if test -n "$LDFLAGS_STATIC" && test -n "$LDFLAGS_SHARED"
2492 AC_MSG_CHECKING(if linker supports switching between static/dynamic)
2495 cat >conftest.$ac_ext <<EOF
2496 #line __oline__ "configure"
2498 int cf_ldflags_static(FILE *fp) { return fflush(fp); }
2500 if AC_TRY_EVAL(ac_compile) ; then
2501 ( $AR $ARFLAGS libconftest.a conftest.o ) 2>&AS_MESSAGE_LOG_FD 1>/dev/null
2502 ( eval $RANLIB libconftest.a ) 2>&AS_MESSAGE_LOG_FD >/dev/null
2506 cf_save_LIBS="$LIBS"
2508 LIBS="$LDFLAGS_STATIC -L`pwd` -lconftest $LDFLAGS_DYNAMIC $LIBS"
2510 #line __oline__ "configure"
2512 int cf_ldflags_static(FILE *fp);
2514 return cf_ldflags_static(stdin);
2515 ],[cf_ldflags_static=yes],[cf_ldflags_static=no])
2518 LIBS="$cf_save_LIBS"
2520 AC_MSG_RESULT($cf_ldflags_static)
2522 if test $cf_ldflags_static != yes
2532 AC_SUBST(LDFLAGS_STATIC)
2533 AC_SUBST(LDFLAGS_SHARED)
2535 dnl ---------------------------------------------------------------------------
2536 dnl CF_LD_RPATH_OPT version: 3 updated: 2010/06/02 05:03:05
2538 dnl For the given system and compiler, find the compiler flags to pass to the
2539 dnl loader to use the "rpath" feature.
2540 AC_DEFUN([CF_LD_RPATH_OPT],
2542 AC_REQUIRE([CF_CHECK_CACHE])
2545 AC_MSG_CHECKING(for an rpath option)
2546 case $cf_cv_system_name in #(vi
2548 if test "$GCC" = yes; then
2549 LD_RPATH_OPT="-Wl,-rpath,"
2551 LD_RPATH_OPT="-rpath "
2554 linux*|gnu*|k*bsd*-gnu) #(vi
2555 LD_RPATH_OPT="-Wl,-rpath,"
2557 openbsd[[2-9]].*) #(vi
2558 LD_RPATH_OPT="-Wl,-rpath,"
2561 LD_RPATH_OPT="-rpath "
2564 LD_RPATH_OPT="-Wl,-rpath,"
2567 LD_RPATH_OPT="-rpath "
2575 AC_MSG_RESULT($LD_RPATH_OPT)
2577 case "x$LD_RPATH_OPT" in #(vi
2579 AC_MSG_CHECKING(if we need a space after rpath option)
2580 cf_save_LIBS="$LIBS"
2581 CF_ADD_LIBS(${LD_RPATH_OPT}$libdir)
2582 AC_TRY_LINK(, , cf_rpath_space=no, cf_rpath_space=yes)
2583 LIBS="$cf_save_LIBS"
2584 AC_MSG_RESULT($cf_rpath_space)
2585 test "$cf_rpath_space" = yes && LD_RPATH_OPT="$LD_RPATH_OPT "
2589 dnl ---------------------------------------------------------------------------
2590 dnl CF_LIBRARY_PATH version: 9 updated: 2010/03/28 12:52:50
2592 dnl Construct a search-list of directories for a nonstandard library-file
2595 dnl $1 = the variable to return as result
2596 dnl $2 = the package name
2597 AC_DEFUN([CF_LIBRARY_PATH],
2600 cf_library_path_list=""
2601 if test -n "${LDFLAGS}${LIBS}" ; then
2602 for cf_library_path in $LDFLAGS $LIBS
2604 case $cf_library_path in #(vi
2606 cf_library_path=`echo ".$cf_library_path" |sed -e 's/^...//' -e 's,/lib$,,'`
2607 CF_ADD_SUBDIR_PATH($1,$2,lib,$cf_library_path,NONE)
2608 cf_library_path_list="$cf_library_path_list [$]$1"
2614 CF_SUBDIR_PATH($1,$2,lib)
2616 $1="$cf_library_path_list [$]$1"
2618 dnl ---------------------------------------------------------------------------
2619 dnl CF_LIB_PREFIX version: 8 updated: 2008/09/13 11:34:16
2621 dnl Compute the library-prefix for the given host system
2622 dnl $1 = variable to set
2623 AC_DEFUN([CF_LIB_PREFIX],
2625 case $cf_cv_system_name in #(vi
2632 ifelse($1,,,[$1=$LIB_PREFIX])
2633 AC_SUBST(LIB_PREFIX)
2635 dnl ---------------------------------------------------------------------------
2636 dnl CF_LIB_RULES version: 61 updated: 2010/10/23 16:10:30
2638 dnl Append definitions and rules for the given models to the subdirectory
2639 dnl Makefiles, and the recursion rule for the top-level Makefile. If the
2640 dnl subdirectory is a library-source directory, modify the LIBS_TO_MAKE list in
2641 dnl the corresponding makefile to list the models that we'll generate.
2643 dnl For shared libraries, make a list of symbolic links to construct when
2644 dnl generating each library. The convention used for Linux is the simplest
2647 dnl lib<name>.so.<major> ->
2648 dnl lib<name>.so.<maj>.<minor>
2649 AC_DEFUN([CF_LIB_RULES],
2651 CF_LIB_PREFIX(cf_prefix)
2652 AC_REQUIRE([CF_SUBST_NCURSES_VERSION])
2654 if test $cf_cv_shlib_version = cygdll ; then
2655 TINFO_NAME=$TINFO_ARG_SUFFIX
2659 if test -n "$TINFO_SUFFIX" ; then
2660 case $TINFO_SUFFIX in
2662 TINFO_NAME="${TINFO_NAME}tw"
2663 TINFO_SUFFIX=`echo $TINFO_SUFFIX | sed 's/^tw//'`
2666 TINFO_NAME="${TINFO_NAME}t"
2667 TINFO_SUFFIX=`echo $TINFO_SUFFIX | sed 's/^t//'`
2670 TINFO_NAME="${TINFO_NAME}w"
2671 TINFO_SUFFIX=`echo $TINFO_SUFFIX | sed 's/^w//'`
2676 for cf_dir in $SRC_SUBDIRS
2678 if test ! -d $srcdir/$cf_dir ; then
2680 elif test -f $srcdir/$cf_dir/modules; then
2684 for cf_item in $cf_LIST_MODELS
2686 CF_LIB_SUFFIX($cf_item,cf_suffix,cf_depsuf)
2687 if test $cf_item = shared ; then
2688 if test "$cf_cv_do_symlinks" = yes ; then
2689 case "$cf_cv_shlib_version" in #(vi
2691 case "$cf_cv_system_name" in #(vi
2693 case .${LIB_SUFFIX} in
2695 cf_suffix=`echo $cf_suffix | sed 's/^tw//'`
2696 cf_suffix=tw'.${REL_VERSION}'"$cf_suffix"
2699 cf_suffix=`echo $cf_suffix | sed 's/^t//'`
2700 cf_suffix=t'.${REL_VERSION}'"$cf_suffix"
2703 cf_suffix=`echo $cf_suffix | sed 's/^w//'`
2704 cf_suffix=w'.${REL_VERSION}'"$cf_suffix"
2707 cf_suffix='.${REL_VERSION}'"$cf_suffix"
2711 *) cf_suffix="$cf_suffix"'.${REL_VERSION}' ;;
2715 case "$cf_cv_system_name" in #(vi
2717 case .${LIB_SUFFIX} in
2719 cf_suffix=`echo $cf_suffix | sed 's/^tw//'`
2720 cf_suffix=tw'.${ABI_VERSION}'"$cf_suffix"
2723 cf_suffix=`echo $cf_suffix | sed 's/^t//'`
2724 cf_suffix=t'.${ABI_VERSION}'"$cf_suffix"
2727 cf_suffix=`echo $cf_suffix | sed 's/^w//'`
2728 cf_suffix=w'.${ABI_VERSION}'"$cf_suffix"
2731 cf_suffix='.${ABI_VERSION}'"$cf_suffix"
2735 *) cf_suffix="$cf_suffix"'.${ABI_VERSION}' ;;
2740 # cygwin needs import library, and has unique naming convention
2741 # use autodetected ${cf_prefix} for import lib and static lib, but
2742 # use 'cyg' prefix for shared lib.
2743 if test $cf_cv_shlib_version = cygdll ; then
2744 cf_cygsuf=`echo "$cf_suffix" | sed -e 's/\.dll/\${ABI_VERSION}.dll/'`
2745 LIBS_TO_MAKE="$LIBS_TO_MAKE ../lib/cyg${cf_dir}${cf_cygsuf}"
2749 LIBS_TO_MAKE="$LIBS_TO_MAKE ../lib/${cf_prefix}${cf_dir}${cf_suffix}"
2752 if test $cf_dir = ncurses ; then
2753 cf_subsets="$LIB_SUBSETS"
2754 cf_r_parts="$cf_subsets"
2755 cf_liblist="$LIBS_TO_MAKE"
2757 while test -n "$cf_r_parts"
2759 cf_l_parts=`echo "$cf_r_parts" |sed -e 's/ .*$//'`
2760 cf_r_parts=`echo "$cf_r_parts" |sed -e 's/^[[^ ]]* //'`
2761 if test "$cf_l_parts" != "$cf_r_parts" ; then
2763 case $cf_l_parts in #(vi
2765 cf_item=`echo $cf_liblist |sed -e s%${LIB_NAME}${LIB_SUFFIX}%${TINFO_LIB_SUFFIX}%g`
2768 cf_item=`echo $cf_liblist |sed -e s%${LIB_NAME}${LIB_SUFFIX}%${TICS_LIB_SUFFIX}%g`
2774 if test -n "$cf_item"; then
2775 LIBS_TO_MAKE="$cf_item $LIBS_TO_MAKE"
2782 cf_subsets=`echo "$LIB_SUBSETS" | sed -e 's/^termlib.* //'`
2785 sed -e "s%@LIBS_TO_MAKE@%$LIBS_TO_MAKE%" \
2786 -e "s%@SHARED_LIB@%$SHARED_LIB%" \
2787 $cf_dir/Makefile >$cf_dir/Makefile.out
2788 mv $cf_dir/Makefile.out $cf_dir/Makefile
2790 $AWK -f $srcdir/mk-0th.awk \
2791 libname="${cf_dir}${LIB_SUFFIX}" subsets="$LIB_SUBSETS" \
2792 $srcdir/$cf_dir/modules >>$cf_dir/Makefile
2794 for cf_subset in $cf_subsets
2797 for cf_item in $cf_LIST_MODELS
2799 echo "Appending rules for ${cf_item} model (${cf_dir}: ${cf_subset})"
2800 CF_UPPER(cf_ITEM,$cf_item)
2801 CF_LIB_SUFFIX($cf_item,cf_suffix,cf_depsuf)
2802 CF_OBJ_SUBDIR($cf_item,cf_subdir)
2804 # Test for case where we build libtinfo with a different name.
2806 if test $cf_dir = ncurses ; then
2809 cf_libname=${cf_libname}$LIB_SUFFIX
2812 cf_libname=$TINFO_LIB_SUFFIX
2815 cf_libname=$TICS_LIB_SUFFIX
2819 cf_libname=${cf_libname}$LIB_SUFFIX
2821 if test -n "${DFT_ARG_SUFFIX}" ; then
2822 # undo $LIB_SUFFIX add-on in CF_LIB_SUFFIX
2823 cf_suffix=`echo $cf_suffix |sed -e "s%^${LIB_SUFFIX}%%"`
2826 # These dependencies really are for development, not
2827 # builds, but they are useful in porting, too.
2828 cf_depend="../include/ncurses_cfg.h"
2829 if test "$srcdir" = "."; then
2832 cf_reldir="\${srcdir}"
2835 if test -f $srcdir/$cf_dir/$cf_dir.priv.h; then
2836 cf_depend="$cf_depend $cf_reldir/$cf_dir.priv.h"
2837 elif test -f $srcdir/$cf_dir/curses.priv.h; then
2838 cf_depend="$cf_depend $cf_reldir/curses.priv.h"
2842 old_cf_suffix="$cf_suffix"
2843 if test "$cf_cv_shlib_version_infix" = yes ; then
2844 if test -n "$LIB_SUFFIX" ; then
2847 cf_libname=`echo $cf_libname | sed 's/tw$//'`
2848 cf_suffix=`echo $cf_suffix | sed 's/^tw//'`
2852 cf_libname=`echo $cf_libname | sed 's/t$//'`
2853 cf_suffix=`echo $cf_suffix | sed 's/^t//'`
2857 cf_libname=`echo $cf_libname | sed 's/w$//'`
2858 cf_suffix=`echo $cf_suffix | sed 's/^w//'`
2865 $AWK -f $srcdir/mk-1st.awk \
2866 name=${cf_libname}${cf_dir_suffix} \
2867 traces=$LIB_TRACING \
2874 TermlibRoot=$TINFO_NAME \
2875 TermlibSuffix=$TINFO_SUFFIX \
2876 ShlibVer=$cf_cv_shlib_version \
2877 ShlibVerInfix=$cf_cv_shlib_version_infix \
2878 ReLink=${cf_cv_do_relink:-no} \
2879 DoLinks=$cf_cv_do_symlinks \
2880 rmSoLocs=$cf_cv_rm_so_locs \
2881 ldconfig="$LDCONFIG" \
2882 overwrite=$WITH_OVERWRITE \
2883 depend="$cf_depend" \
2885 libtool_version="$LIBTOOL_VERSION" \
2886 $srcdir/$cf_dir/modules >>$cf_dir/Makefile
2888 cf_suffix="$old_cf_suffix"
2890 for cf_subdir2 in $cf_subdirs lib
2892 test $cf_subdir = $cf_subdir2 && break
2894 test "${cf_subset}.${cf_subdir2}" != "${cf_subset}.${cf_subdir}" && \
2895 $AWK -f $srcdir/mk-2nd.awk \
2897 traces=$LIB_TRACING \
2903 crenames=$cf_cv_prog_CC_c_o \
2904 cxxrenames=$cf_cv_prog_CXX_c_o \
2905 $srcdir/$cf_dir/modules >>$cf_dir/Makefile
2906 cf_subdirs="$cf_subdirs $cf_subdir"
2911 echo ' cd '$cf_dir' && ${MAKE} ${CF_MFLAGS} [$]@' >>Makefile
2914 for cf_dir in $SRC_SUBDIRS
2916 if test ! -d $srcdir/$cf_dir ; then
2920 if test -f $cf_dir/Makefile ; then
2923 echo 'libs \' >> Makefile
2924 echo 'install.libs \' >> Makefile
2925 echo 'uninstall.libs ::' >> Makefile
2926 echo ' cd '$cf_dir' && ${MAKE} ${CF_MFLAGS} [$]@' >> Makefile
2931 if test -f $srcdir/$cf_dir/modules; then
2933 if test -f $srcdir/$cf_dir/headers; then
2934 cat >> Makefile <<CF_EOF
2936 uninstall.includes \\
2939 if test "$cf_dir" != "c++" ; then
2940 echo 'lint \' >> Makefile
2942 cat >> Makefile <<CF_EOF
2948 uninstall.$cf_dir ::
2949 cd $cf_dir && \${MAKE} \${CF_MFLAGS} \[$]@
2951 elif test -f $srcdir/$cf_dir/headers; then
2952 cat >> Makefile <<CF_EOF
2958 uninstall.includes ::
2959 cd $cf_dir && \${MAKE} \${CF_MFLAGS} \[$]@
2964 cat >> Makefile <<CF_EOF
2966 install.libs uninstall.libs \\
2967 install.data uninstall.data ::
2968 $MAKE_TERMINFO cd misc && \${MAKE} \${CF_MFLAGS} \[$]@
2971 if test "x$cf_with_manpages" = xyes; then
2972 cat >> Makefile <<CF_EOF
2976 cd man && \${MAKE} \${CF_MFLAGS} \[$]@
2980 cat >> Makefile <<CF_EOF
2983 rm -f config.cache config.log config.status Makefile include/ncurses_cfg.h
2984 rm -f headers.sh headers.sed mk_shared_lib.sh
2985 rm -f edit_man.* man_alias.*
2986 rm -rf \${DIRS_TO_MAKE}
2989 # Special case: tack's manpage lives in its own directory.
2990 if test "x$cf_with_manpages" = xyes; then
2991 if test -d tack ; then
2992 if test -f $srcdir/$tack.h; then
2993 cat >> Makefile <<CF_EOF
2997 cd tack && \${MAKE} \${CF_MFLAGS} \[$]@
3003 dnl If we're installing into a subdirectory of /usr/include, etc., we should
3004 dnl prepend the subdirectory's name to the "#include" paths. It won't hurt
3005 dnl anything, and will make it more standardized. It's awkward to decide this
3006 dnl at configuration because of quoting, so we'll simply make all headers
3007 dnl installed via a script that can do the right thing.
3009 rm -f headers.sed headers.sh
3011 dnl ( generating this script makes the makefiles a little tidier :-)
3012 echo creating headers.sh
3013 cat >headers.sh <<CF_EOF
3015 # This shell script is generated by the 'configure' script. It is invoked in a
3016 # subdirectory of the build tree. It generates a sed-script in the parent
3017 # directory that is used to adjust includes for header files that reside in a
3018 # subdirectory of /usr/include, etc.
3020 while test \[$]# != 3
3022 PRG="\$PRG \[$]1"; shift
3027 TMPSRC=\${TMPDIR:-/tmp}/\`basename \$SRC\`\$\$
3028 TMPSED=\${TMPDIR:-/tmp}/headers.sed\$\$
3029 echo installing \$SRC in \$DST
3032 if test $WITH_CURSES_H = yes; then
3033 cat >>headers.sh <<CF_EOF
3036 END=\`basename \$DST\`
3037 for i in \`cat \$REF/../*/headers |fgrep -v "#"\`
3039 NAME=\`basename \$i\`
3040 echo "s/<\$NAME>/<\$END\/\$NAME>/" >> \$TMPSED
3050 cat >>headers.sh <<CF_EOF
3053 END=\`basename \$DST\`
3054 for i in \`cat \$REF/../*/headers |fgrep -v "#"\`
3056 NAME=\`basename \$i\`
3057 if test "\$NAME" = "curses.h"
3059 echo "s/<curses.h>/<ncurses.h>/" >> \$TMPSED
3062 echo "s/<\$NAME>/<\$END\/\$NAME>/" >> \$TMPSED
3066 echo "s/<curses.h>/<ncurses.h>/" >> \$TMPSED
3071 cat >>headers.sh <<CF_EOF
3073 sed -f \$TMPSED \$SRC > \$TMPSRC
3074 NAME=\`basename \$SRC\`
3076 if test $WITH_CURSES_H != yes; then
3077 cat >>headers.sh <<CF_EOF
3078 test "\$NAME" = "curses.h" && NAME=ncurses.h
3081 cat >>headers.sh <<CF_EOF
3082 # Just in case someone gzip'd manpages, remove the conflicting copy.
3083 test -f \$DST/\$NAME.gz && rm -f \$DST/\$NAME.gz
3085 eval \$PRG \$TMPSRC \$DST/\$NAME
3086 rm -f \$TMPSRC \$TMPSED
3089 chmod 0755 headers.sh
3091 for cf_dir in $SRC_SUBDIRS
3093 if test ! -d $srcdir/$cf_dir ; then
3097 if test -f $srcdir/$cf_dir/headers; then
3098 $AWK -f $srcdir/mk-hdr.awk \
3099 subset="$LIB_SUBSETS" \
3100 compat="$WITH_CURSES_H" \
3101 $srcdir/$cf_dir/headers >>$cf_dir/Makefile
3104 if test -f $srcdir/$cf_dir/modules; then
3105 if test "$cf_dir" != "c++" ; then
3106 cat >>$cf_dir/Makefile <<"CF_EOF"
3107 depend : ${AUTO_SRC}
3108 makedepend -- ${CPPFLAGS} -- ${C_SRC}
3110 # DO NOT DELETE THIS LINE -- make depend depends on it.
3115 AC_SUBST(LIBS_TO_MAKE)
3117 dnl ---------------------------------------------------------------------------
3118 dnl CF_LIB_SONAME version: 5 updated: 2010/08/14 18:25:37
3120 dnl Find the and soname for the given shared library. Set the cache variable
3121 dnl cf_cv_$3_soname to this, unless it is not found. Then set the cache
3122 dnl variable to "unknown".
3126 dnl $3 = library name
3127 AC_DEFUN([CF_LIB_SONAME],
3129 AC_CACHE_CHECK(for soname of $3 library,cf_cv_$3_soname,[
3131 cf_cv_$3_soname=unknown
3132 if test "$cross_compiling" != yes ; then
3133 cat >conftest.$ac_ext <<CF_EOF
3138 ${cf_cv_main_return:-return}(0);
3141 cf_save_LIBS="$LIBS"
3143 if AC_TRY_EVAL(ac_compile) ; then
3144 if AC_TRY_EVAL(ac_link) ; then
3145 cf_cv_$3_soname=`ldd conftest$ac_exeext 2>/dev/null | sed -e 's,^.*/,,' -e 's, .*$,,' | fgrep lib$3.`
3146 test -z "$cf_cv_$3_soname" && cf_cv_$3_soname=unknown
3150 LIBS="$cf_save_LIBS"
3154 dnl ---------------------------------------------------------------------------
3155 dnl CF_LIB_SUFFIX version: 16 updated: 2008/12/27 12:30:03
3157 dnl Compute the library file-suffix from the given model name
3159 dnl $2 = variable to set (the nominal library suffix)
3160 dnl $3 = dependency variable to set (actual filename)
3161 dnl The variable $LIB_SUFFIX, if set, prepends the variable to set.
3162 AC_DEFUN([CF_LIB_SUFFIX],
3164 AC_REQUIRE([CF_SUBST_NCURSES_VERSION])
3183 case $cf_cv_system_name in
3213 test -n "$LIB_SUFFIX" && $2="${LIB_SUFFIX}[$]{$2}"
3214 test -n "$LIB_SUFFIX" && $3="${LIB_SUFFIX}[$]{$3}"
3216 dnl ---------------------------------------------------------------------------
3217 dnl CF_LIB_TYPE version: 4 updated: 2000/10/20 22:57:49
3219 dnl Compute the string to append to -library from the given model name
3221 dnl $2 = variable to set
3222 dnl The variable $LIB_SUFFIX, if set, prepends the variable to set.
3223 AC_DEFUN([CF_LIB_TYPE],
3232 test -n "$LIB_SUFFIX" && $2="${LIB_SUFFIX}[$]{$2}"
3234 dnl ---------------------------------------------------------------------------
3235 dnl CF_LINK_DATAONLY version: 9 updated: 2009/01/01 20:21:38
3236 dnl ----------------
3237 dnl Some systems have a non-ANSI linker that doesn't pull in modules that have
3238 dnl only data (i.e., no functions), for example NeXT. On those systems we'll
3239 dnl have to provide wrappers for global tables to ensure they're linked
3241 AC_DEFUN([CF_LINK_DATAONLY],
3243 AC_MSG_CHECKING([if data-only library module links])
3244 AC_CACHE_VAL(cf_cv_link_dataonly,[
3246 cat >conftest.$ac_ext <<EOF
3247 #line __oline__ "configure"
3248 int testdata[[3]] = { 123, 456, 789 };
3250 if AC_TRY_EVAL(ac_compile) ; then
3251 mv conftest.o data.o && \
3252 ( $AR $ARFLAGS conftest.a data.o ) 2>&AS_MESSAGE_LOG_FD 1>/dev/null
3254 rm -f conftest.$ac_ext data.o
3255 cat >conftest.$ac_ext <<EOF
3256 #line __oline__ "configure"
3260 ${cf_cv_main_return:-return}(1); /* I'm told this linker is broken */
3262 extern int testdata[[3]];
3263 return testdata[[0]] == 123
3264 && testdata[[1]] == 456
3265 && testdata[[2]] == 789;
3269 if AC_TRY_EVAL(ac_compile); then
3270 mv conftest.o func.o && \
3271 ( $AR $ARFLAGS conftest.a func.o ) 2>&AS_MESSAGE_LOG_FD 1>/dev/null
3273 rm -f conftest.$ac_ext func.o
3274 ( eval $RANLIB conftest.a ) 2>&AS_MESSAGE_LOG_FD >/dev/null
3276 LIBS="conftest.a $LIBS"
3280 extern int testfunc();
3281 ${cf_cv_main_return:-return} (!testfunc());
3284 [cf_cv_link_dataonly=yes],
3285 [cf_cv_link_dataonly=no],
3286 [cf_cv_link_dataonly=unknown])
3289 AC_MSG_RESULT($cf_cv_link_dataonly)
3291 if test "$cf_cv_link_dataonly" = no ; then
3292 AC_DEFINE(BROKEN_LINKER)
3297 dnl ---------------------------------------------------------------------------
3298 dnl CF_LINK_FUNCS version: 7 updated: 2006/12/16 12:33:30
3300 dnl Most Unix systems have both link and symlink, a few don't have symlink.
3301 dnl A few non-Unix systems implement symlink, but not link.
3302 dnl A few non-systems implement neither (or have nonfunctional versions).
3303 AC_DEFUN([CF_LINK_FUNCS],
3309 if test "$cross_compiling" = yes ; then
3314 AC_CACHE_CHECK(if link/symlink functions work,cf_cv_link_funcs,[
3316 for cf_func in link symlink ; do
3318 #include <sys/types.h>
3319 #include <sys/stat.h>
3320 #ifdef HAVE_UNISTD_H
3326 char *src = "config.log";
3327 char *dst = "conftest.chk";
3332 fail = ($cf_func("config.log", "conftest.chk") < 0)
3333 || (stat(dst, &dst_sb) < 0)
3334 || (dst_sb.st_mtime != src_sb.st_mtime);
3340 ${cf_cv_main_return:-return} (fail);
3343 cf_cv_link_funcs="$cf_cv_link_funcs $cf_func"
3344 eval 'ac_cv_func_'$cf_func'=yes'],[
3345 eval 'ac_cv_func_'$cf_func'=no'],[
3346 eval 'ac_cv_func_'$cf_func'=error'])
3348 test -z "$cf_cv_link_funcs" && cf_cv_link_funcs=no
3350 test "$ac_cv_func_link" = yes && AC_DEFINE(HAVE_LINK,[],[HAVE_LINK])
3351 test "$ac_cv_func_symlink" = yes && AC_DEFINE(HAVE_SYMLINK,[],[HAVE_SYMLINK])
3354 dnl ---------------------------------------------------------------------------
3355 dnl CF_MAIN_RETURN version: 1 updated: 2006/12/10 09:51:54
3357 dnl Check if a return from main to the shell actually returns the same exit
3358 dnl code. This is true for almost any POSIX environment.
3360 dnl Some very old environments did not flush stdout, etc., on an exit. That
3361 dnl would be a useful case to test for also.
3362 AC_DEFUN([CF_MAIN_RETURN],
3364 cf_cv_main_return=return
3366 dnl ---------------------------------------------------------------------------
3367 dnl CF_MAKEFLAGS version: 13 updated: 2010/10/23 15:52:32
3369 dnl Some 'make' programs support ${MAKEFLAGS}, some ${MFLAGS}, to pass 'make'
3370 dnl options to lower-levels. It's very useful for "make -n" -- if we have it.
3371 dnl (GNU 'make' does both, something POSIX 'make', which happens to make the
3372 dnl ${MAKEFLAGS} variable incompatible because it adds the assignments :-)
3373 AC_DEFUN([CF_MAKEFLAGS],
3375 AC_CACHE_CHECK(for makeflags variable, cf_cv_makeflags,[
3377 for cf_option in '-${MAKEFLAGS}' '${MFLAGS}'
3379 cat >cf_makeflags.tmp <<CF_EOF
3382 @ echo '.$cf_option'
3384 cf_result=`${MAKE:-make} -k -f cf_makeflags.tmp 2>/dev/null | sed -e 's,[[ ]]*$,,'`
3385 case "$cf_result" in
3387 cf_result=`${MAKE:-make} -k -f cf_makeflags.tmp CC=cc 2>/dev/null`
3388 case "$cf_result" in
3389 .*CC=*) cf_cv_makeflags=
3391 *) cf_cv_makeflags=$cf_option
3397 *) echo "given option \"$cf_option\", no match \"$cf_result\""
3401 rm -f cf_makeflags.tmp
3404 AC_SUBST(cf_cv_makeflags)
3406 dnl ---------------------------------------------------------------------------
3407 dnl CF_MAKE_TAGS version: 6 updated: 2010/10/23 15:52:32
3409 dnl Generate tags/TAGS targets for makefiles. Do not generate TAGS if we have
3410 dnl a monocase filesystem.
3411 AC_DEFUN([CF_MAKE_TAGS],[
3412 AC_REQUIRE([CF_MIXEDCASE_FILENAMES])
3414 AC_CHECK_PROGS(CTAGS, exctags ctags)
3415 AC_CHECK_PROGS(ETAGS, exetags etags)
3417 AC_CHECK_PROG(MAKE_LOWER_TAGS, ${CTAGS:-ctags}, yes, no)
3419 if test "$cf_cv_mixedcase" = yes ; then
3420 AC_CHECK_PROG(MAKE_UPPER_TAGS, ${ETAGS:-etags}, yes, no)
3425 if test "$MAKE_UPPER_TAGS" = yes ; then
3431 if test "$MAKE_LOWER_TAGS" = yes ; then
3440 AC_SUBST(MAKE_UPPER_TAGS)
3441 AC_SUBST(MAKE_LOWER_TAGS)
3443 dnl ---------------------------------------------------------------------------
3444 dnl CF_MANPAGE_FORMAT version: 9 updated: 2010/10/23 16:10:30
3445 dnl -----------------
3446 dnl Option to allow user to override automatic configuration of manpage format.
3447 dnl There are several special cases:
3449 dnl gzip - man checks for, can display gzip'd files
3450 dnl compress - man checks for, can display compressed files
3451 dnl BSDI - files in the cat-directories are suffixed ".0"
3452 dnl formatted - installer should format (put files in cat-directory)
3453 dnl catonly - installer should only format, e.g., for a turnkey system.
3455 dnl There are other configurations which this macro does not test, e.g., HPUX's
3456 dnl compressed manpages (but uncompressed manpages are fine, and HPUX's naming
3457 dnl convention would not match our use).
3458 AC_DEFUN([CF_MANPAGE_FORMAT],
3460 AC_REQUIRE([CF_PATHSEP])
3461 AC_MSG_CHECKING(format of man-pages)
3463 AC_ARG_WITH(manpage-format,
3464 [ --with-manpage-format specify manpage-format: gzip/compress/BSDI/normal and
3465 optionally formatted/catonly, e.g., gzip,formatted],
3466 [MANPAGE_FORMAT=$withval],
3467 [MANPAGE_FORMAT=unknown])
3469 test -z "$MANPAGE_FORMAT" && MANPAGE_FORMAT=unknown
3470 MANPAGE_FORMAT=`echo "$MANPAGE_FORMAT" | sed -e 's/,/ /g'`
3474 case $MANPAGE_FORMAT in
3476 if test -z "$MANPATH" ; then
3477 MANPATH="/usr/man:/usr/share/man"
3480 # look for the 'date' man-page (it's most likely to be installed!)
3486 IFS="${IFS:- }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
3487 for cf_dir in $MANPATH; do
3488 test -z "$cf_dir" && cf_dir=/usr/man
3489 for cf_name in $cf_dir/man*/$cf_example.[[01]]* $cf_dir/cat*/$cf_example.[[01]]* $cf_dir/man*/$cf_example $cf_dir/cat*/$cf_example
3491 cf_test=`echo $cf_name | sed -e 's/*//'`
3492 if test "x$cf_test" = "x$cf_name" ; then
3495 *.gz) MANPAGE_FORMAT="$MANPAGE_FORMAT gzip";;
3496 *.Z) MANPAGE_FORMAT="$MANPAGE_FORMAT compress";;
3497 *.0) MANPAGE_FORMAT="$MANPAGE_FORMAT BSDI";;
3498 *) MANPAGE_FORMAT="$MANPAGE_FORMAT normal";;
3512 # if we found a match in either man* or cat*, stop looking
3513 if test -n "$MANPAGE_FORMAT" ; then
3515 test "$cf_preform" = yes && MANPAGE_FORMAT="$MANPAGE_FORMAT formatted"
3516 test "$cf_catonly" = yes && MANPAGE_FORMAT="$MANPAGE_FORMAT catonly"
3522 test $cf_found=yes && break
3525 # only check the first directory in $MANPATH where we find manpages
3526 if test -n "$MANPAGE_FORMAT" ; then
3530 # if we did not find the example, just assume it is normal
3531 test -z "$MANPAGE_FORMAT" && MANPAGE_FORMAT=normal
3535 for cf_option in $MANPAGE_FORMAT; do
3536 case $cf_option in #(vi
3537 gzip|compress|BSDI|normal|formatted|catonly)
3540 cf_unknown="$cf_unknown $cf_option"
3547 AC_MSG_RESULT($MANPAGE_FORMAT)
3548 if test -n "$cf_unknown" ; then
3549 AC_MSG_WARN(Unexpected manpage-format $cf_unknown)
3552 dnl ---------------------------------------------------------------------------
3553 dnl CF_MANPAGE_RENAMES version: 7 updated: 2005/06/18 18:51:57
3554 dnl ------------------
3555 dnl The Debian people have their own naming convention for manpages. This
3556 dnl option lets us override the name of the file containing renaming, or
3557 dnl disable it altogether.
3558 AC_DEFUN([CF_MANPAGE_RENAMES],
3560 AC_MSG_CHECKING(for manpage renaming)
3562 AC_ARG_WITH(manpage-renames,
3563 [ --with-manpage-renames specify manpage-renaming],
3564 [MANPAGE_RENAMES=$withval],
3565 [MANPAGE_RENAMES=yes])
3567 case ".$MANPAGE_RENAMES" in #(vi
3571 # Debian 'man' program?
3572 if test -f /etc/debian_version ; then
3573 MANPAGE_RENAMES=`cd $srcdir && pwd`/man/man_db.renames
3580 if test "$MANPAGE_RENAMES" != no ; then
3581 if test -f $srcdir/man/$MANPAGE_RENAMES ; then
3582 MANPAGE_RENAMES=`cd $srcdir/man && pwd`/$MANPAGE_RENAMES
3583 elif test ! -f $MANPAGE_RENAMES ; then
3584 AC_MSG_ERROR(not a filename: $MANPAGE_RENAMES)
3587 test ! -d man && mkdir man
3589 # Construct a sed-script to perform renaming within man-pages
3590 if test -n "$MANPAGE_RENAMES" ; then
3591 test ! -d man && mkdir man
3592 sh $srcdir/man/make_sed.sh $MANPAGE_RENAMES >./edit_man.sed
3596 AC_MSG_RESULT($MANPAGE_RENAMES)
3597 AC_SUBST(MANPAGE_RENAMES)
3599 dnl ---------------------------------------------------------------------------
3600 dnl CF_MANPAGE_SYMLINKS version: 5 updated: 2010/07/24 17:12:40
3601 dnl -------------------
3602 dnl Some people expect each tool to make all aliases for manpages in the
3603 dnl man-directory. This accommodates the older, less-capable implementations
3604 dnl of 'man', and is optional.
3605 AC_DEFUN([CF_MANPAGE_SYMLINKS],
3607 AC_MSG_CHECKING(if manpage aliases will be installed)
3609 AC_ARG_WITH(manpage-aliases,
3610 [ --with-manpage-aliases specify manpage-aliases using .so],
3611 [MANPAGE_ALIASES=$withval],
3612 [MANPAGE_ALIASES=yes])
3614 AC_MSG_RESULT($MANPAGE_ALIASES)
3616 case "x$LN_S" in #(vi
3626 if test "$MANPAGE_ALIASES" = yes ; then
3627 AC_MSG_CHECKING(if manpage symlinks should be used)
3629 AC_ARG_WITH(manpage-symlinks,
3630 [ --with-manpage-symlinks specify manpage-aliases using symlinks],
3631 [MANPAGE_SYMLINKS=$withval],
3632 [MANPAGE_SYMLINKS=$cf_use_symlinks])
3634 if test "$$cf_use_symlinks" = no; then
3635 if test "$MANPAGE_SYMLINKS" = yes ; then
3636 AC_MSG_WARN(cannot make symlinks, will use .so files)
3641 AC_MSG_RESULT($MANPAGE_SYMLINKS)
3645 dnl ---------------------------------------------------------------------------
3646 dnl CF_MANPAGE_TBL version: 3 updated: 2002/01/19 22:51:32
3648 dnl This option causes manpages to be run through tbl(1) to generate tables
3650 AC_DEFUN([CF_MANPAGE_TBL],
3652 AC_MSG_CHECKING(for manpage tbl)
3654 AC_ARG_WITH(manpage-tbl,
3655 [ --with-manpage-tbl specify manpage processing with tbl],
3656 [MANPAGE_TBL=$withval],
3659 AC_MSG_RESULT($MANPAGE_TBL)
3661 dnl ---------------------------------------------------------------------------
3662 dnl CF_MAN_PAGES version: 39 updated: 2010/10/23 15:44:18
3664 dnl Try to determine if the man-pages on the system are compressed, and if
3665 dnl so, what format is used. Use this information to construct a script that
3666 dnl will install man-pages.
3667 AC_DEFUN([CF_MAN_PAGES],
3669 CF_HELP_MESSAGE(Options to Specify How Manpages are Installed:)
3675 if test "$prefix" = "NONE" ; then
3676 cf_prefix="$ac_default_prefix"
3681 case "$MANPAGE_FORMAT" in # (vi
3696 test ! -d man && mkdir man
3700 case "$MANPAGE_FORMAT" in #(vi
3703 cf_compress=compress
3711 cf_edit_man=./edit_man.sh
3712 cf_man_alias=`pwd`/man_alias.sed
3714 cat >$cf_edit_man <<CF_EOF
3716 # this script is generated by the configure-script CF_MAN_PAGES macro.
3721 NCURSES_MAJOR="$NCURSES_MAJOR"
3722 NCURSES_MINOR="$NCURSES_MINOR"
3723 NCURSES_PATCH="$NCURSES_PATCH"
3725 NCURSES_OSPEED="$NCURSES_OSPEED"
3726 TERMINFO="$TERMINFO"
3729 INSTALL_DATA="$INSTALL_DATA"
3731 transform="$program_transform_name"
3733 TMP=\${TMPDIR:=/tmp}/man\$\$
3734 trap "rm -f \$TMP" 0 1 2 5 15
3746 top_srcdir=\[$]srcdir/..
3749 if test "\$form" = normal ; then
3750 if test "$cf_format" = yes ; then
3751 if test "$cf_inboth" = no ; then
3752 sh \[$]0 format \$verb \$mandir \$srcdir \[$]*
3756 cf_subdir=\$mandir/man
3757 cf_tables=$MANPAGE_TBL
3759 cf_subdir=\$mandir/cat
3763 # process the list of source-files
3766 *.orig|*.rej) ;; #(vi
3768 section=\`expr "\$i" : '.*\\.\\([[0-9]]\\)[[xm]]*'\`;
3769 if test \$verb = installing ; then
3770 if test ! -d \$cf_subdir\${section} ; then
3771 mkdir -p \$cf_subdir\$section
3775 # replace variables in man page
3776 if test ! -f $cf_man_alias ; then
3777 cat >>$cf_man_alias <<-CF_EOF2
3778 s,@DATADIR@,\$datadir,g
3779 s,@TERMINFO@,\$TERMINFO,g
3780 s,@NCURSES_MAJOR@,\$NCURSES_MAJOR,g
3781 s,@NCURSES_MINOR@,\$NCURSES_MINOR,g
3782 s,@NCURSES_PATCH@,\$NCURSES_PATCH,g
3783 s,@NCURSES_OSPEED@,\$NCURSES_OSPEED,g
3788 cf_NAME=`echo "$cf_name" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
3789 cf_name=`echo $cf_name|sed "$program_transform_name"`
3790 cat >>$cf_edit_man <<-CF_EOF
3791 s,@$cf_NAME@,$cf_name,g
3795 cat >>$cf_edit_man <<CF_EOF
3797 echo "...made $cf_man_alias"
3801 cf_source=\`basename \$i\`
3803 test ! -f \$inalias && inalias="\$srcdir/\$inalias"
3804 if test ! -f \$inalias ; then
3805 echo .. skipped \$cf_source
3810 if test "$MANPAGE_ALIASES" != no ; then
3811 cat >>$cf_edit_man <<CF_EOF
3812 aliases=\`sed -f \$top_srcdir/man/manlinks.sed \$inalias |sed -f $cf_man_alias | sort -u\`
3816 if test "$MANPAGE_RENAMES" = no ; then
3817 cat >>$cf_edit_man <<CF_EOF
3818 # perform program transformations for section 1 man pages
3819 if test \$section = 1 ; then
3820 cf_target=\$cf_subdir\${section}/\`echo \$cf_source|sed "\${transform}"\`
3822 cf_target=\$cf_subdir\${section}/\$cf_source
3826 cat >>$cf_edit_man <<CF_EOF
3827 cf_target=\`grep "^\$cf_source" $MANPAGE_RENAMES | $AWK '{print \[$]2}'\`
3828 if test -z "\$cf_target" ; then
3829 echo '? missing rename for '\$cf_source
3830 cf_target="\$cf_source"
3832 cf_target="\$cf_subdir\${section}/\${cf_target}"
3837 cat >>$cf_edit_man <<CF_EOF
3838 sed -f $cf_man_alias \\
3841 if test -f $MANPAGE_RENAMES ; then
3842 cat >>$cf_edit_man <<CF_EOF
3843 < \$i | sed -f `pwd`/edit_man.sed >\$TMP
3846 cat >>$cf_edit_man <<CF_EOF
3851 cat >>$cf_edit_man <<CF_EOF
3852 if test \$cf_tables = yes ; then
3853 tbl \$TMP >\$TMP.out
3858 if test $with_curses_h != yes ; then
3859 cat >>$cf_edit_man <<CF_EOF
3860 sed -e "/\#[ ]*include/s,curses.h,ncurses.h," < \$TMP >\$TMP.out
3865 cat >>$cf_edit_man <<CF_EOF
3866 if test \$form = format ; then
3867 nroff -man \$TMP >\$TMP.out
3872 if test -n "$cf_compress" ; then
3873 cat >>$cf_edit_man <<CF_EOF
3874 if test \$verb = installing ; then
3875 if ( $cf_compress -f \$TMP )
3877 mv \$TMP.$cf_so_strip \$TMP
3880 cf_target="\$cf_target.$cf_so_strip"
3884 case "$MANPAGE_FORMAT" in #(vi
3886 cat >>$cf_edit_man <<CF_EOF
3887 if test \$form = format ; then
3888 # BSDI installs only .0 suffixes in the cat directories
3889 cf_target="\`echo \$cf_target|sed -e 's/\.[[1-9]]\+[[a-z]]*/.0/'\`"
3895 cat >>$cf_edit_man <<CF_EOF
3896 suffix=\`basename \$cf_target | sed -e 's%^[[^.]]*%%'\`
3897 if test \$verb = installing ; then
3898 echo \$verb \$cf_target
3899 \$INSTALL_DATA \$TMP \$cf_target
3900 test -d \$cf_subdir\${section} &&
3901 test -n "\$aliases" && (
3902 cd \$cf_subdir\${section} && (
3903 cf_source=\`echo \$cf_target |sed -e 's%^.*/\([[^/]][[^/]]*/[[^/]][[^/]]*$\)%\1%'\`
3904 test -n "$cf_so_strip" && cf_source=\`echo \$cf_source |sed -e 's%\.$cf_so_strip\$%%'\`
3905 cf_target=\`basename \$cf_target\`
3906 for cf_alias in \$aliases
3908 if test \$section = 1 ; then
3909 cf_alias=\`echo \$cf_alias|sed "\${transform}"\`
3912 if test "$MANPAGE_SYMLINKS" = yes ; then
3913 if test -f \$cf_alias\${suffix} ; then
3914 if ( cmp -s \$cf_target \$cf_alias\${suffix} )
3919 echo .. \$verb alias \$cf_alias\${suffix}
3921 case "x$LN_S" in #(vi
3923 cat >>$cf_edit_man <<CF_EOF
3924 $LN_S \$cf_target \$cf_alias\${suffix}
3928 cat >>$cf_edit_man <<CF_EOF
3929 rm -f \$cf_alias\${suffix}
3930 $LN_S \$cf_target \$cf_alias\${suffix}
3934 cat >>$cf_edit_man <<CF_EOF
3935 elif test "\$cf_target" != "\$cf_alias\${suffix}" ; then
3936 echo ".so \$cf_source" >\$TMP
3938 if test -n "$cf_compress" ; then
3939 cat >>$cf_edit_man <<CF_EOF
3940 if test -n "$cf_so_strip" ; then
3941 $cf_compress -f \$TMP
3942 mv \$TMP.$cf_so_strip \$TMP
3946 cat >>$cf_edit_man <<CF_EOF
3947 echo .. \$verb alias \$cf_alias\${suffix}
3948 rm -f \$cf_alias\${suffix}
3949 \$INSTALL_DATA \$TMP \$cf_alias\${suffix}
3954 elif test \$verb = removing ; then
3955 test -f \$cf_target && (
3956 echo \$verb \$cf_target
3959 test -d \$cf_subdir\${section} &&
3960 test -n "\$aliases" && (
3961 cd \$cf_subdir\${section} && (
3962 for cf_alias in \$aliases
3964 if test \$section = 1 ; then
3965 cf_alias=\`echo \$cf_alias|sed "\${transform}"\`
3968 echo .. \$verb alias \$cf_alias\${suffix}
3969 rm -f \$cf_alias\${suffix}
3981 if test $cf_inboth = yes ; then
3982 if test \$form != format ; then
3983 sh \[$]0 format \$verb \$mandir \$srcdir \[$]*
3989 chmod 755 $cf_edit_man
3992 dnl ---------------------------------------------------------------------------
3993 dnl CF_MATH_LIB version: 8 updated: 2010/05/29 16:31:02
3995 dnl Checks for libraries. At least one UNIX system, Apple Macintosh
3996 dnl Rhapsody 5.5, does not have -lm. We cannot use the simpler
3997 dnl AC_CHECK_LIB(m,sin), because that fails for C++.
3998 AC_DEFUN([CF_MATH_LIB],
4000 AC_CACHE_CHECK(if -lm needed for math functions,
4006 [double x = rand(); printf("result = %g\n", ]ifelse([$2],,sin(x),$2)[)],
4007 [cf_cv_need_libm=no],
4008 [cf_cv_need_libm=yes])])
4009 if test "$cf_cv_need_libm" = yes
4016 dnl ---------------------------------------------------------------------------
4017 dnl CF_MIXEDCASE_FILENAMES version: 3 updated: 2003/09/20 17:07:55
4018 dnl ----------------------
4019 dnl Check if the file-system supports mixed-case filenames. If we're able to
4020 dnl create a lowercase name and see it as uppercase, it doesn't support that.
4021 AC_DEFUN([CF_MIXEDCASE_FILENAMES],
4023 AC_CACHE_CHECK(if filesystem supports mixed-case filenames,cf_cv_mixedcase,[
4024 if test "$cross_compiling" = yes ; then
4025 case $target_alias in #(vi
4026 *-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-mingw32*|*-uwin*) #(vi
4034 rm -f conftest CONFTEST
4036 if test -f CONFTEST ; then
4041 rm -f conftest CONFTEST
4044 test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES,[],[MIXEDCASE_FILENAMES])
4046 dnl ---------------------------------------------------------------------------
4047 dnl CF_MKSTEMP version: 7 updated: 2010/08/14 18:25:37
4049 dnl Check for a working mkstemp. This creates two files, checks that they are
4050 dnl successfully created and distinct (AmigaOS apparently fails on the last).
4051 AC_DEFUN([CF_MKSTEMP],[
4052 AC_CACHE_CHECK(for working mkstemp, cf_cv_func_mkstemp,[
4055 #include <sys/types.h>
4059 #include <sys/stat.h>
4062 char *tmpl = "conftestXXXXXX";
4070 for (n = 0; n < 2; ++n) {
4071 strcpy(name[n], tmpl);
4072 if ((fd = mkstemp(name[n])) >= 0) {
4073 if (!strcmp(name[n], tmpl)
4074 || stat(name[n], &sb) != 0
4075 || (sb.st_mode & S_IFMT) != S_IFREG
4076 || (sb.st_mode & 077) != 0) {
4083 && !strcmp(name[0], name[1]))
4085 ${cf_cv_main_return:-return}(result);
4087 ],[cf_cv_func_mkstemp=yes
4088 ],[cf_cv_func_mkstemp=no
4089 ],[AC_CHECK_FUNC(mkstemp)
4092 if test "x$cf_cv_func_mkstemp" = xyes || test "x$ac_cv_func_mkstemp" = xyes ; then
4093 AC_DEFINE(HAVE_MKSTEMP,[],[HAVE_MKSTEMP])
4096 dnl ---------------------------------------------------------------------------
4097 dnl CF_MSG_LOG version: 5 updated: 2010/10/23 15:52:32
4099 dnl Write a debug message to config.log, along with the line number in the
4100 dnl configure script.
4101 AC_DEFUN([CF_MSG_LOG],[
4102 echo "${as_me:-configure}:__oline__: testing $* ..." 1>&AS_MESSAGE_LOG_FD
4104 dnl ---------------------------------------------------------------------------
4105 dnl CF_NCURSES_ABI_6 version: 1 updated: 2005/09/17 18:42:49
4106 dnl ----------------
4107 dnl Set ncurses' ABI to 6 unless overridden by explicit configure option, and
4108 dnl warn about this.
4109 AC_DEFUN([CF_NCURSES_ABI_6],[
4110 if test "${with_abi_version+set}" != set; then
4111 case $cf_cv_rel_version in
4113 cf_cv_rel_version=6.0
4115 AC_MSG_WARN(Overriding ABI version to $cf_cv_abi_version)
4120 dnl ---------------------------------------------------------------------------
4121 dnl CF_NO_LEAKS_OPTION version: 4 updated: 2006/12/16 14:24:05
4122 dnl ------------------
4123 dnl see CF_WITH_NO_LEAKS
4124 AC_DEFUN([CF_NO_LEAKS_OPTION],[
4125 AC_MSG_CHECKING(if you want to use $1 for testing)
4128 [AC_DEFINE($3,[],[$3])ifelse([$4],,[
4131 : ${with_cflags:=-g}
4132 : ${with_no_leaks:=yes}
4135 AC_MSG_RESULT(${with_$1:-no})
4137 case .$with_cflags in #(vi
4139 case .$CFLAGS in #(vi
4149 dnl ---------------------------------------------------------------------------
4150 dnl CF_NUMBER_SYNTAX version: 1 updated: 2003/09/20 18:12:49
4151 dnl ----------------
4152 dnl Check if the given variable is a number. If not, report an error.
4153 dnl $1 is the variable
4154 dnl $2 is the message
4155 AC_DEFUN([CF_NUMBER_SYNTAX],[
4156 if test -n "$1" ; then
4161 AC_MSG_ERROR($2 is not a number: $1)
4165 AC_MSG_ERROR($2 value is empty)
4168 dnl ---------------------------------------------------------------------------
4169 dnl CF_OBJ_SUBDIR version: 4 updated: 2002/02/23 20:38:31
4171 dnl Compute the object-directory name from the given model name
4172 AC_DEFUN([CF_OBJ_SUBDIR],
4175 libtool) $2='obj_lo' ;;
4176 normal) $2='objects' ;;
4177 debug) $2='obj_g' ;;
4178 profile) $2='obj_p' ;;
4180 case $cf_cv_system_name in #(vi
4188 dnl ---------------------------------------------------------------------------
4189 dnl CF_PATHSEP version: 5 updated: 2010/05/26 05:38:42
4191 dnl Provide a value for the $PATH and similar separator
4192 AC_DEFUN([CF_PATHSEP],
4194 case $cf_cv_system_name in
4195 os2*) PATH_SEPARATOR=';' ;;
4196 *) PATH_SEPARATOR=':' ;;
4198 ifelse([$1],,,[$1=$PATH_SEPARATOR])
4199 AC_SUBST(PATH_SEPARATOR)
4201 dnl ---------------------------------------------------------------------------
4202 dnl CF_PATH_SYNTAX version: 13 updated: 2010/05/26 05:38:42
4204 dnl Check the argument to see that it looks like a pathname. Rewrite it if it
4205 dnl begins with one of the prefix/exec_prefix variables, and then again if the
4206 dnl result begins with 'NONE'. This is necessary to work around autoconf's
4207 dnl delayed evaluation of those symbols.
4208 AC_DEFUN([CF_PATH_SYNTAX],[
4209 if test "x$prefix" != xNONE; then
4210 cf_path_syntax="$prefix"
4212 cf_path_syntax="$ac_default_prefix"
4215 case ".[$]$1" in #(vi
4216 .\[$]\(*\)*|.\'*\'*) #(vi
4220 .[[a-zA-Z]]:[[\\/]]*) #(vi OS/2 EMX
4222 .\[$]{*prefix}*) #(vi
4224 case ".[$]$1" in #(vi
4226 $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%`
4230 .\[$]{datadir}*) #(vi
4232 case ".[$]$1" in #(vi
4234 $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%`
4238 .\[$]{datarootdir}*) #(vi
4240 case ".[$]$1" in #(vi
4242 $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%`
4247 $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%`
4250 ifelse([$2],,[AC_MSG_ERROR([expected a pathname, not \"[$]$1\"])],$2)
4254 dnl ---------------------------------------------------------------------------
4255 dnl CF_PKG_CONFIG version: 4 updated: 2011/02/18 20:26:24
4257 dnl Check for the package-config program, unless disabled by command-line.
4258 AC_DEFUN([CF_PKG_CONFIG],
4260 AC_MSG_CHECKING(if you want to use pkg-config)
4261 AC_ARG_WITH(pkg-config,
4262 [ --with-pkg-config{=path} enable/disable use of pkg-config],
4263 [cf_pkg_config=$withval],
4264 [cf_pkg_config=yes])
4265 AC_MSG_RESULT($cf_pkg_config)
4267 case $cf_pkg_config in #(vi
4272 AC_PATH_TOOL(PKG_CONFIG, pkg-config, none)
4279 test -z "$PKG_CONFIG" && PKG_CONFIG=none
4280 if test "$PKG_CONFIG" != none ; then
4281 CF_PATH_SYNTAX(PKG_CONFIG)
4284 AC_SUBST(PKG_CONFIG)
4286 dnl ---------------------------------------------------------------------------
4287 dnl CF_POSIX_C_SOURCE version: 8 updated: 2010/05/26 05:38:42
4288 dnl -----------------
4289 dnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed.
4291 dnl POSIX.1-1990 _POSIX_SOURCE
4292 dnl POSIX.1-1990 and _POSIX_SOURCE and
4293 dnl POSIX.2-1992 C-Language _POSIX_C_SOURCE=2
4295 dnl POSIX.1b-1993 _POSIX_C_SOURCE=199309L
4296 dnl POSIX.1c-1996 _POSIX_C_SOURCE=199506L
4297 dnl X/Open 2000 _POSIX_C_SOURCE=200112L
4300 dnl $1 is the nominal value for _POSIX_C_SOURCE
4301 AC_DEFUN([CF_POSIX_C_SOURCE],
4303 cf_POSIX_C_SOURCE=ifelse([$1],,199506L,[$1])
4305 cf_save_CFLAGS="$CFLAGS"
4306 cf_save_CPPFLAGS="$CPPFLAGS"
4308 CF_REMOVE_DEFINE(cf_trim_CFLAGS,$cf_save_CFLAGS,_POSIX_C_SOURCE)
4309 CF_REMOVE_DEFINE(cf_trim_CPPFLAGS,$cf_save_CPPFLAGS,_POSIX_C_SOURCE)
4311 AC_CACHE_CHECK(if we should define _POSIX_C_SOURCE,cf_cv_posix_c_source,[
4312 CF_MSG_LOG(if the symbol is already defined go no further)
4313 AC_TRY_COMPILE([#include <sys/types.h>],[
4314 #ifndef _POSIX_C_SOURCE
4317 [cf_cv_posix_c_source=no],
4318 [cf_want_posix_source=no
4319 case .$cf_POSIX_C_SOURCE in #(vi
4321 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
4324 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
4325 cf_want_posix_source=yes
4328 cf_want_posix_source=yes
4331 if test "$cf_want_posix_source" = yes ; then
4332 AC_TRY_COMPILE([#include <sys/types.h>],[
4333 #ifdef _POSIX_SOURCE
4336 cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE")
4338 CF_MSG_LOG(ifdef from value $cf_POSIX_C_SOURCE)
4339 CFLAGS="$cf_trim_CFLAGS"
4340 CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source"
4341 CF_MSG_LOG(if the second compile does not leave our definition intact error)
4342 AC_TRY_COMPILE([#include <sys/types.h>],[
4343 #ifndef _POSIX_C_SOURCE
4346 [cf_cv_posix_c_source=no])
4347 CFLAGS="$cf_save_CFLAGS"
4348 CPPFLAGS="$cf_save_CPPFLAGS"
4352 if test "$cf_cv_posix_c_source" != no ; then
4353 CFLAGS="$cf_trim_CFLAGS"
4354 CPPFLAGS="$cf_trim_CPPFLAGS"
4355 CF_ADD_CFLAGS($cf_cv_posix_c_source)
4359 dnl ---------------------------------------------------------------------------
4360 dnl CF_PREDEFINE version: 2 updated: 2010/05/26 16:44:57
4362 dnl Add definitions to CPPFLAGS to ensure they're predefined for all compiles.
4364 dnl $1 = symbol to test
4365 dnl $2 = value (if any) to use for a predefinition
4366 AC_DEFUN([CF_PREDEFINE],
4368 AC_MSG_CHECKING(if we must define $1)
4369 AC_TRY_COMPILE([#include <sys/types.h>
4373 #endif],[cf_result=no],[cf_result=yes])
4374 AC_MSG_RESULT($cf_result)
4376 if test "$cf_result" = yes ; then
4377 CPPFLAGS="$CPPFLAGS ifelse([$2],,-D$1,[-D$1=$2])"
4378 elif test "x$2" != "x" ; then
4379 AC_MSG_CHECKING(checking for compatible value versus $2)
4380 AC_TRY_COMPILE([#include <sys/types.h>
4384 #endif],[cf_result=yes],[cf_result=no])
4385 AC_MSG_RESULT($cf_result)
4386 if test "$cf_result" = no ; then
4387 # perhaps we can override it - try...
4388 CPPFLAGS="$CPPFLAGS -D$1=$2"
4392 dnl ---------------------------------------------------------------------------
4393 dnl CF_PRG_RULES version: 1 updated: 2006/06/03 11:45:08
4395 dnl Append definitions and rules for the given programs to the subdirectory
4396 dnl Makefiles, and the recursion rule for the top-level Makefile.
4399 dnl $1 = script to run
4400 dnl $2 = list of subdirectories
4404 AC_DEFUN([CF_PRG_RULES],
4408 if test ! -d $srcdir/$cf_dir; then
4410 elif test -f $srcdir/$cf_dir/programs; then
4411 $AWK -f $1 $srcdir/$cf_dir/programs >>$cf_dir/Makefile
4416 dnl ---------------------------------------------------------------------------
4417 dnl CF_PROG_AR version: 1 updated: 2009/01/01 20:15:22
4419 dnl Check for archiver "ar".
4420 AC_DEFUN([CF_PROG_AR],[
4421 AC_CHECK_TOOL(AR, ar, ar)
4423 dnl ---------------------------------------------------------------------------
4424 dnl CF_PROG_AWK version: 1 updated: 2006/09/16 11:40:59
4426 dnl Check for awk, ensure that the check found something.
4427 AC_DEFUN([CF_PROG_AWK],
4430 test -z "$AWK" && AC_MSG_ERROR(No awk program found)
4432 dnl ---------------------------------------------------------------------------
4433 dnl CF_PROG_CC_C_O version: 3 updated: 2010/08/14 18:25:37
4435 dnl Analogous to AC_PROG_CC_C_O, but more useful: tests only $CC, ensures that
4436 dnl the output file can be renamed, and allows for a shell variable that can
4437 dnl be used later. The parameter is either CC or CXX. The result is the
4439 dnl $cf_cv_prog_CC_c_o
4440 dnl $cf_cv_prog_CXX_c_o
4441 AC_DEFUN([CF_PROG_CC_C_O],
4442 [AC_REQUIRE([AC_PROG_CC])dnl
4443 AC_MSG_CHECKING([whether [$]$1 understands -c and -o together])
4444 AC_CACHE_VAL(cf_cv_prog_$1_c_o,
4446 cat > conftest.$ac_ext <<CF_EOF
4450 ${cf_cv_main_return:-return}(0);
4453 # We do the test twice because some compilers refuse to overwrite an
4454 # existing .o file with -o, though they will create one.
4455 ac_try='[$]$1 -c conftest.$ac_ext -o conftest2.$ac_objext >&AS_MESSAGE_LOG_FD'
4456 if AC_TRY_EVAL(ac_try) &&
4457 test -f conftest2.$ac_objext && AC_TRY_EVAL(ac_try);
4459 eval cf_cv_prog_$1_c_o=yes
4461 eval cf_cv_prog_$1_c_o=no
4465 if test $cf_cv_prog_$1_c_o = yes; then
4466 AC_MSG_RESULT([yes])
4471 dnl ---------------------------------------------------------------------------
4472 dnl CF_PROG_CC_U_D version: 1 updated: 2005/07/14 16:59:30
4474 dnl Check if C (preprocessor) -U and -D options are processed in the order
4475 dnl given rather than by type of option. Some compilers insist on apply all
4476 dnl of the -U options after all of the -D options. Others allow mixing them,
4477 dnl and may predefine symbols that conflict with those we define.
4478 AC_DEFUN([CF_PROG_CC_U_D],
4480 AC_CACHE_CHECK(if $CC -U and -D options work together,cf_cv_cc_u_d_options,[
4481 cf_save_CPPFLAGS="$CPPFLAGS"
4482 CPPFLAGS="-UU_D_OPTIONS -DU_D_OPTIONS -DD_U_OPTIONS -UD_U_OPTIONS"
4485 make an undefined-error
4488 make a defined-error
4491 cf_cv_cc_u_d_options=yes],[
4492 cf_cv_cc_u_d_options=no])
4493 CPPFLAGS="$cf_save_CPPFLAGS"
4496 dnl ---------------------------------------------------------------------------
4497 dnl CF_PROG_EGREP version: 1 updated: 2006/09/16 11:40:59
4499 dnl AC_PROG_EGREP was introduced in autoconf 2.53.
4500 dnl This macro adds a check to ensure the script found something.
4501 AC_DEFUN([CF_PROG_EGREP],
4502 [AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep],
4503 [if echo a | (grep -E '(a|b)') >/dev/null 2>&1
4504 then ac_cv_prog_egrep='grep -E'
4505 else ac_cv_prog_egrep='egrep'
4507 EGREP=$ac_cv_prog_egrep
4509 test -z "$EGREP" && AC_MSG_ERROR(No egrep program found)
4511 dnl ---------------------------------------------------------------------------
4512 dnl CF_PROG_EXT version: 10 updated: 2004/01/03 19:28:18
4514 dnl Compute $PROG_EXT, used for non-Unix ports, such as OS/2 EMX.
4515 AC_DEFUN([CF_PROG_EXT],
4517 AC_REQUIRE([CF_CHECK_CACHE])
4518 case $cf_cv_system_name in
4520 CFLAGS="$CFLAGS -Zmt"
4521 CPPFLAGS="$CPPFLAGS -D__ST_MT_ERRNO__"
4522 CXXFLAGS="$CXXFLAGS -Zmt"
4523 # autoconf's macro sets -Zexe and suffix both, which conflict:w
4524 LDFLAGS="$LDFLAGS -Zmt -Zcrtdll"
4534 test -n "$PROG_EXT" && AC_DEFINE_UNQUOTED(PROG_EXT,"$PROG_EXT",[PROG_EXT])
4536 dnl ---------------------------------------------------------------------------
4537 dnl CF_PROG_GNAT version: 1 updated: 2010/06/19 15:22:18
4539 dnl Check for gnatmake, ensure that it is complete.
4540 AC_DEFUN([CF_PROG_GNAT],[
4541 cf_ada_make=gnatmake
4542 AC_CHECK_PROG(gnat_exists, $cf_ada_make, yes, no)
4543 if test "$ac_cv_prog_gnat_exists" = no; then
4547 AC_CHECK_PROG(M4_exists, m4, yes, no)
4548 if test "$ac_cv_prog_M4_exists" = no; then
4549 cf_cv_prog_gnat_correct=no
4550 echo Ada95 binding required program m4 not found. Ada95 binding disabled.
4552 if test "$cf_cv_prog_gnat_correct" = yes; then
4553 AC_MSG_CHECKING(if GNAT works)
4554 CF_GNAT_TRY_RUN([procedure conftest;],
4557 procedure conftest is
4559 Text_IO.Put ("Hello World");
4561 GNAT.OS_Lib.OS_Exit (0);
4562 end conftest;],[cf_cv_prog_gnat_correct=yes],[cf_cv_prog_gnat_correct=no])
4563 AC_MSG_RESULT($cf_cv_prog_gnat_correct)
4567 AC_SUBST(cf_ada_make)
4569 dnl ---------------------------------------------------------------------------
4570 dnl CF_PROG_INSTALL version: 5 updated: 2002/12/21 22:46:07
4572 dnl Force $INSTALL to be an absolute-path. Otherwise, edit_man.sh and the
4573 dnl misc/tabset install won't work properly. Usually this happens only when
4574 dnl using the fallback mkinstalldirs script
4575 AC_DEFUN([CF_PROG_INSTALL],
4581 CF_DIRNAME(cf_dir,$INSTALL)
4582 test -z "$cf_dir" && cf_dir=.
4583 INSTALL=`cd $cf_dir && pwd`/`echo $INSTALL | sed -e 's%^.*/%%'`
4587 dnl ---------------------------------------------------------------------------
4588 dnl CF_PROG_LDCONFIG version: 2 updated: 2008/12/13 14:08:40
4589 dnl ----------------
4590 dnl Check for ldconfig, needed to fixup shared libraries that would be built
4591 dnl and then used in the install.
4592 AC_DEFUN([CF_PROG_LDCONFIG],[
4593 if test "$cross_compiling" = yes ; then
4596 case "$cf_cv_system_name" in #(vi
4597 dragonfly*|freebsd*) #(vi
4598 test -z "$LDCONFIG" && LDCONFIG="/sbin/ldconfig -R"
4600 *) LDPATH=$PATH:/sbin:/usr/sbin
4601 AC_PATH_PROG(LDCONFIG,ldconfig,,$LDPATH)
4607 dnl ---------------------------------------------------------------------------
4608 dnl CF_PROG_LINT version: 2 updated: 2009/08/12 04:43:14
4610 AC_DEFUN([CF_PROG_LINT],
4612 AC_CHECK_PROGS(LINT, tdlint lint alint splint lclint)
4615 dnl ---------------------------------------------------------------------------
4616 dnl CF_PROG_LN_S version: 2 updated: 2010/08/14 18:25:37
4618 dnl Combine checks for "ln -s" and "ln -sf", updating $LN_S to include "-f"
4619 dnl option if it is supported.
4620 AC_DEFUN([CF_PROG_LN_S],[
4622 AC_MSG_CHECKING(if $LN_S -f options work)
4624 rm -f conf$$.src conf$$dst
4626 echo first >conf$$.src
4627 if $LN_S -f conf$$.src conf$$.dst 2>/dev/null; then
4632 rm -f conf$$.dst conf$$src
4633 AC_MSG_RESULT($cf_prog_ln_sf)
4635 test "$cf_prog_ln_sf" = yes && LN_S="$LN_S -f"
4637 dnl ---------------------------------------------------------------------------
4638 dnl CF_REGEX version: 8 updated: 2010/08/07 14:09:44
4640 dnl Attempt to determine if we've got one of the flavors of regular-expression
4641 dnl code that we can support.
4642 AC_DEFUN([CF_REGEX],
4647 cf_regex_libs="regex re"
4648 case $host_os in #(vi
4650 cf_regex_libs="regex.dll $cf_regex_libs"
4654 AC_CHECK_FUNC(regcomp,[cf_regex_func=regcomp],[
4655 for cf_regex_lib in $cf_regex_libs
4657 AC_CHECK_LIB($cf_regex_lib,regcomp,[
4658 CF_ADD_LIB($cf_regex_lib)
4659 cf_regex_func=regcomp
4664 if test "$cf_regex_func" = no ; then
4665 AC_CHECK_FUNC(compile,[cf_regex_func=compile],[
4666 AC_CHECK_LIB(gen,compile,[
4668 cf_regex_func=compile])])
4671 if test "$cf_regex_func" = no ; then
4672 AC_MSG_WARN(cannot find regular expression library)
4675 AC_CACHE_CHECK(for regular-expression headers,cf_cv_regex_hdrs,[
4678 case $cf_regex_func in #(vi
4680 for cf_regex_hdr in regexp.h regexpr.h
4682 AC_TRY_LINK([#include <$cf_regex_hdr>],[
4683 char *p = compile("", "", "", 0);
4684 int x = step("", "");
4686 cf_cv_regex_hdrs=$cf_regex_hdr
4692 for cf_regex_hdr in regex.h
4694 AC_TRY_LINK([#include <sys/types.h>
4695 #include <$cf_regex_hdr>],[
4697 int x = regcomp(p, "", 0);
4698 int y = regexec(p, "", 0, 0, 0);
4701 cf_cv_regex_hdrs=$cf_regex_hdr
4710 case $cf_cv_regex_hdrs in #(vi
4711 no) AC_MSG_WARN(no regular expression header found) ;; #(vi
4712 regex.h) AC_DEFINE(HAVE_REGEX_H_FUNCS,[],[HAVE_REGEX_H_FUNCS]) ;; #(vi
4713 regexp.h) AC_DEFINE(HAVE_REGEXP_H_FUNCS,[],[HAVE_REGEXP_H_FUNCS]) ;; #(vi
4714 regexpr.h) AC_DEFINE(HAVE_REGEXPR_H_FUNCS,[],[HAVE_REGPR_H_FUNCS]) ;;
4717 dnl ---------------------------------------------------------------------------
4718 dnl CF_REMOVE_DEFINE version: 3 updated: 2010/01/09 11:05:50
4719 dnl ----------------
4720 dnl Remove all -U and -D options that refer to the given symbol from a list
4721 dnl of C compiler options. This works around the problem that not all
4722 dnl compilers process -U and -D options from left-to-right, so a -U option
4723 dnl cannot be used to cancel the effect of a preceding -D option.
4725 dnl $1 = target (which could be the same as the source variable)
4726 dnl $2 = source (including '$')
4727 dnl $3 = symbol to remove
4728 define([CF_REMOVE_DEFINE],
4731 sed -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[[ ]]/ /g' \
4732 -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[$]//g'`
4734 dnl ---------------------------------------------------------------------------
4735 dnl CF_REMOVE_LIB version: 1 updated: 2007/02/17 14:11:52
4737 dnl Remove the given library from the symbol
4739 dnl $1 = target (which could be the same as the source variable)
4740 dnl $2 = source (including '$')
4741 dnl $3 = library to remove
4742 define([CF_REMOVE_LIB],
4744 # remove $3 library from $2
4745 $1=`echo "$2" | sed -e 's/-l$3[[ ]]//g' -e 's/-l$3[$]//'`
4747 dnl ---------------------------------------------------------------------------
4748 dnl CF_RPATH_HACK version: 9 updated: 2011/02/13 13:31:33
4750 AC_DEFUN([CF_RPATH_HACK],
4752 AC_REQUIRE([CF_LD_RPATH_OPT])
4753 AC_MSG_CHECKING(for updated LDFLAGS)
4754 if test -n "$LD_RPATH_OPT" ; then
4755 AC_MSG_RESULT(maybe)
4757 AC_CHECK_PROGS(cf_ldd_prog,ldd,no)
4758 cf_rpath_list="/usr/lib /lib"
4759 if test "$cf_ldd_prog" != no
4763 AC_TRY_LINK([#include <stdio.h>],
4765 [cf_rpath_oops=`$cf_ldd_prog conftest$ac_exeext | fgrep ' not found' | sed -e 's% =>.*$%%' |sort -u`
4766 cf_rpath_list=`$cf_ldd_prog conftest$ac_exeext | fgrep / | sed -e 's%^.*[[ ]]/%/%' -e 's%/[[^/]][[^/]]*$%%' |sort -u`])
4768 # If we passed the link-test, but get a "not found" on a given library,
4769 # this could be due to inept reconfiguration of gcc to make it only
4770 # partly honor /usr/local/lib (or whatever). Sometimes this behavior
4771 # is intentional, e.g., installing gcc in /usr/bin and suppressing the
4772 # /usr/local libraries.
4773 if test -n "$cf_rpath_oops"
4775 for cf_rpath_src in $cf_rpath_oops
4777 for cf_rpath_dir in \
4782 if test -f $cf_rpath_dir/lib/$cf_rpath_src
4784 CF_VERBOSE(...adding -L$cf_rpath_dir/lib to LDFLAGS for $cf_rpath_src)
4785 LDFLAGS="$LDFLAGS -L$cf_rpath_dir/lib"
4793 CF_VERBOSE(...checking EXTRA_LDFLAGS $EXTRA_LDFLAGS)
4795 CF_RPATH_HACK_2(LDFLAGS)
4796 CF_RPATH_HACK_2(LIBS)
4798 CF_VERBOSE(...checked EXTRA_LDFLAGS $EXTRA_LDFLAGS)
4800 AC_SUBST(EXTRA_LDFLAGS)
4802 dnl ---------------------------------------------------------------------------
4803 dnl CF_RPATH_HACK_2 version: 6 updated: 2010/04/17 16:31:24
4805 dnl Do one set of substitutions for CF_RPATH_HACK, adding an rpath option to
4806 dnl EXTRA_LDFLAGS for each -L option found.
4808 dnl $cf_rpath_list contains a list of directories to ignore.
4810 dnl $1 = variable name to update. The LDFLAGS variable should be the only one,
4811 dnl but LIBS often has misplaced -L options.
4812 AC_DEFUN([CF_RPATH_HACK_2],
4814 CF_VERBOSE(...checking $1 [$]$1)
4817 for cf_rpath_src in [$]$1
4819 case $cf_rpath_src in #(vi
4822 # check if this refers to a directory which we will ignore
4824 if test -n "$cf_rpath_list"
4826 for cf_rpath_item in $cf_rpath_list
4828 if test "x$cf_rpath_src" = "x-L$cf_rpath_item"
4836 if test "$cf_rpath_skip" = no
4838 # transform the option
4839 if test "$LD_RPATH_OPT" = "-R " ; then
4840 cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%-R %"`
4842 cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%$LD_RPATH_OPT%"`
4845 # if we have not already added this, add it now
4846 cf_rpath_tst=`echo "$EXTRA_LDFLAGS" | sed -e "s%$cf_rpath_tmp %%"`
4847 if test "x$cf_rpath_tst" = "x$EXTRA_LDFLAGS"
4849 CF_VERBOSE(...Filter $cf_rpath_src ->$cf_rpath_tmp)
4850 EXTRA_LDFLAGS="$cf_rpath_tmp $EXTRA_LDFLAGS"
4855 cf_rpath_dst="$cf_rpath_dst $cf_rpath_src"
4859 CF_VERBOSE(...checked $1 [$]$1)
4860 AC_SUBST(EXTRA_LDFLAGS)
4862 dnl ---------------------------------------------------------------------------
4863 dnl CF_SHARED_OPTS version: 64 updated: 2010/06/05 16:51:16
4866 dnl Attempt to determine the appropriate CC/LD options for creating a shared
4869 dnl Note: ${LOCAL_LDFLAGS} is used to link executables that will run within the
4870 dnl build-tree, i.e., by making use of the libraries that are compiled in ../lib
4871 dnl We avoid compiling-in a ../lib path for the shared library since that can
4872 dnl lead to unexpected results at runtime.
4873 dnl ${LOCAL_LDFLAGS2} has the same intention but assumes that the shared libraries
4874 dnl are compiled in ../../lib
4876 dnl The variable 'cf_cv_do_symlinks' is used to control whether we configure
4877 dnl to install symbolic links to the rel/abi versions of shared libraries.
4879 dnl The variable 'cf_cv_shlib_version' controls whether we use the rel or abi
4880 dnl version when making symbolic links.
4882 dnl The variable 'cf_cv_shlib_version_infix' controls whether shared library
4883 dnl version numbers are infix (ex: libncurses.<ver>.dylib) or postfix
4884 dnl (ex: libncurses.so.<ver>).
4886 dnl Some loaders leave 'so_locations' lying around. It's nice to clean up.
4887 AC_DEFUN([CF_SHARED_OPTS],
4889 AC_REQUIRE([CF_SUBST_NCURSES_VERSION])
4890 AC_REQUIRE([CF_LD_RPATH_OPT])
4894 INSTALL_LIB="-m 644"
4896 cf_cv_do_symlinks=no
4898 test "$cf_cv_enable_rpath" = yes && cf_ld_rpath_opt="$LD_RPATH_OPT"
4900 AC_MSG_CHECKING(if release/abi version should be used for shared libs)
4901 AC_ARG_WITH(shlib-version,
4902 [ --with-shlib-version=X Specify rel or abi version for shared libs],
4903 [test -z "$withval" && withval=auto
4904 case $withval in #(vi
4906 cf_cv_shlib_version=auto
4908 rel|abi|auto|no) #(vi
4909 cf_cv_shlib_version=$withval
4912 AC_MSG_ERROR([option value must be one of: rel, abi, auto or no])
4915 ],[cf_cv_shlib_version=auto])
4916 AC_MSG_RESULT($cf_cv_shlib_version)
4920 # Some less-capable ports of gcc support only -fpic
4922 if test "$GCC" = yes
4924 AC_MSG_CHECKING(which $CC option to use)
4925 cf_save_CFLAGS="$CFLAGS"
4926 for CC_SHARED_OPTS in -fPIC -fpic ''
4928 CFLAGS="$cf_save_CFLAGS $CC_SHARED_OPTS"
4929 AC_TRY_COMPILE([#include <stdio.h>],[int x = 1],[break],[])
4931 AC_MSG_RESULT($CC_SHARED_OPTS)
4932 CFLAGS="$cf_save_CFLAGS"
4935 cf_cv_shlib_version_infix=no
4937 case $cf_cv_system_name in #(vi
4939 if test "$GCC" = yes; then
4941 MK_SHARED_LIB='$(CC) -shared'
4945 MK_SHARED_LIB='${CC} ${CFLAGS} -o $[@] -Xlinker -soname=`basename $[@]` -nostart -e 0'
4949 MK_SHARED_LIB='sh ../mk_shared_lib.sh [$]@ [$]{CC} [$]{CFLAGS}'
4950 cf_cv_shlib_version=cygdll
4951 cf_cv_shlib_version_infix=cygdll
4952 cat >mk_shared_lib.sh <<-CF_EOF
4955 IMPORT_LIB=\`echo "\[$]1" | sed -e 's/cyg/lib/' -e 's/[[0-9]]*\.dll[$]/.dll.a/'\`
4958 Linking shared library
4959 ** SHARED_LIB \[$]SHARED_LIB
4960 ** IMPORT_LIB \[$]IMPORT_LIB
4962 exec \[$]* -shared -Wl,--out-implib=../lib/\[$]{IMPORT_LIB} -Wl,--export-all-symbols -o ../lib/\[$]{SHARED_LIB}
4964 chmod +x mk_shared_lib.sh
4967 EXTRA_CFLAGS="-no-cpp-precomp"
4968 CC_SHARED_OPTS="-dynamic"
4969 MK_SHARED_LIB='${CC} ${CFLAGS} -dynamiclib -install_name ${libdir}/`basename $[@]` -compatibility_version ${ABI_VERSION} -current_version ${ABI_VERSION} -o $[@]'
4970 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=abi
4971 cf_cv_shlib_version_infix=yes
4972 AC_CACHE_CHECK([if ld -search_paths_first works], cf_cv_ldflags_search_paths_first, [
4973 cf_save_LDFLAGS=$LDFLAGS
4974 LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
4975 AC_TRY_LINK(, [int i;], cf_cv_ldflags_search_paths_first=yes, cf_cv_ldflags_search_paths_first=no)
4976 LDFLAGS=$cf_save_LDFLAGS])
4977 if test $cf_cv_ldflags_search_paths_first = yes; then
4978 LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
4982 # (tested with gcc 2.7.2 -- I don't have c89)
4983 if test "$GCC" = yes; then
4984 LD_SHARED_OPTS='-Xlinker +b -Xlinker ${libdir}'
4987 LD_SHARED_OPTS='-Wl,+b,${libdir}'
4989 MK_SHARED_LIB='${LD} +b ${libdir} -b -o $[@]'
4990 # HP-UX shared libraries must be executable, and should be
4991 # readonly to exploit a quirk in the memory manager.
4992 INSTALL_LIB="-m 555"
4995 if test "$cf_cv_enable_rpath" = yes ; then
4996 EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS"
4998 # tested with IRIX 5.2 and 'cc'.
4999 if test "$GCC" != yes; then
5000 CC_SHARED_OPTS='-KPIC'
5001 MK_SHARED_LIB='${CC} -shared -rdata_shared -soname `basename $[@]` -o $[@]'
5003 MK_SHARED_LIB='${CC} -shared -Wl,-soname,`basename $[@]` -o $[@]'
5005 cf_cv_rm_so_locs=yes
5007 linux*|gnu*|k*bsd*-gnu) #(vi
5008 if test "$DFT_LWR_MODEL" = "shared" ; then
5009 LOCAL_LDFLAGS="${LD_RPATH_OPT}\$(LOCAL_LIBDIR)"
5010 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
5012 if test "$cf_cv_enable_rpath" = yes ; then
5013 EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS"
5016 MK_SHARED_LIB='${CC} ${CFLAGS} -shared -Wl,-soname,'$cf_cv_shared_soname',-stats,-lc -o $[@]'
5018 openbsd[[2-9]].*) #(vi
5019 if test "$DFT_LWR_MODEL" = "shared" ; then
5020 LOCAL_LDFLAGS="${LD_RPATH_OPT}\$(LOCAL_LIBDIR)"
5021 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
5023 if test "$cf_cv_enable_rpath" = yes ; then
5024 EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS"
5026 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
5028 MK_SHARED_LIB='${CC} ${CFLAGS} -shared -Wl,-Bshareable,-soname,'$cf_cv_shared_soname',-stats,-lc -o $[@]'
5030 nto-qnx*|openbsd*|freebsd[[12]].*) #(vi
5031 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
5032 MK_SHARED_LIB='${LD} -Bshareable -o $[@]'
5033 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
5036 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
5037 if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_enable_rpath" = yes ; then
5038 LOCAL_LDFLAGS="${cf_ld_rpath_opt}\$(LOCAL_LIBDIR)"
5039 LOCAL_LDFLAGS2="${cf_ld_rpath_opt}\${libdir} $LOCAL_LDFLAGS"
5040 EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS"
5043 MK_SHARED_LIB='${LD} -shared -Bshareable -soname=`basename $[@]` -o $[@]'
5046 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
5047 if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_enable_rpath" = yes ; then
5048 LOCAL_LDFLAGS="${cf_ld_rpath_opt}\$(LOCAL_LIBDIR)"
5049 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
5050 EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS"
5051 if test "$cf_cv_shlib_version" = auto; then
5052 if test -f /usr/libexec/ld.elf_so; then
5053 cf_cv_shlib_version=abi
5055 cf_cv_shlib_version=rel
5059 MK_SHARED_LIB='${CC} ${CFLAGS} -shared -Wl,-soname,'$cf_cv_shared_soname' -o $[@]'
5061 MK_SHARED_LIB='${LD} -shared -Bshareable -o $[@]'
5065 # tested with OSF/1 V3.2 and 'cc'
5066 # tested with OSF/1 V3.2 and gcc 2.6.3 (but the c++ demo didn't
5067 # link with shared libs).
5068 MK_SHARED_LIB='${LD} -set_version ${REL_VERSION}:${ABI_VERSION} -expect_unresolved "*" -shared -soname `basename $[@]`'
5069 case $host_os in #(vi
5071 MK_SHARED_LIB="${MK_SHARED_LIB} -msym"
5074 MK_SHARED_LIB="${MK_SHARED_LIB}"' -o $[@]'
5075 if test "$DFT_LWR_MODEL" = "shared" ; then
5076 LOCAL_LDFLAGS="${LD_RPATH_OPT}\$(LOCAL_LIBDIR)"
5077 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
5079 cf_cv_rm_so_locs=yes
5081 sco3.2v5*) # (also uw2* and UW7: hops 13-Apr-98
5082 # tested with osr5.0.5
5083 if test "$GCC" != yes; then
5084 CC_SHARED_OPTS='-belf -KPIC'
5086 MK_SHARED_LIB='${LD} -dy -G -h `basename $[@] .${REL_VERSION}`.${ABI_VERSION} -o [$]@'
5087 if test "$cf_cv_enable_rpath" = yes ; then
5088 # only way is to set LD_RUN_PATH but no switch for it
5091 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
5092 LINK_PROGS='LD_RUN_PATH=${libdir}'
5093 LINK_TESTS='Pwd=`pwd`;LD_RUN_PATH=`dirname $${Pwd}`/lib'
5096 # tested with SunOS 4.1.1 and gcc 2.7.0
5097 if test "$GCC" != yes; then
5098 CC_SHARED_OPTS='-KPIC'
5100 MK_SHARED_LIB='${LD} -assert pure-text -o $[@]'
5101 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
5104 # tested with SunOS 5.5.1 (solaris 2.5.1) and gcc 2.7.2
5105 # tested with SunOS 5.10 (solaris 10) and gcc 3.4.3
5106 if test "$DFT_LWR_MODEL" = "shared" ; then
5107 LOCAL_LDFLAGS="-R \$(LOCAL_LIBDIR):\${libdir}"
5108 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
5110 if test "$cf_cv_enable_rpath" = yes ; then
5111 EXTRA_LDFLAGS="-R \${libdir} $EXTRA_LDFLAGS"
5114 if test "$GCC" != yes; then
5115 cf_save_CFLAGS="$CFLAGS"
5116 for cf_shared_opts in -xcode=pic32 -xcode=pic13 -KPIC -Kpic -O
5118 CFLAGS="$cf_shared_opts $cf_save_CFLAGS"
5119 AC_TRY_COMPILE([#include <stdio.h>],[printf("Hello\n");],[break])
5121 CFLAGS="$cf_save_CFLAGS"
5122 CC_SHARED_OPTS=$cf_shared_opts
5123 MK_SHARED_LIB='${CC} -dy -G -h '$cf_cv_shared_soname' -o $[@]'
5125 MK_SHARED_LIB='${CC} -shared -dy -G -h '$cf_cv_shared_soname' -o $[@]'
5128 sysv5uw7*|unix_sv*) #(vi
5129 # tested with UnixWare 7.1.0 (gcc 2.95.2 and cc)
5130 if test "$GCC" != yes; then
5131 CC_SHARED_OPTS='-KPIC'
5133 MK_SHARED_LIB='${LD} -d y -G -o [$]@'
5136 CC_SHARED_OPTS='unknown'
5137 MK_SHARED_LIB='echo unknown'
5141 # This works if the last tokens in $MK_SHARED_LIB are the -o target.
5142 case "$cf_cv_shlib_version" in #(vi
5144 case "$MK_SHARED_LIB" in #(vi
5146 test "$cf_cv_do_symlinks" = no && cf_cv_do_symlinks=yes
5149 AC_MSG_WARN(ignored --with-shlib-version)
5155 if test -n "$cf_ld_rpath_opt" ; then
5156 MK_SHARED_LIB="$MK_SHARED_LIB $cf_ld_rpath_opt\${libdir}"
5159 AC_SUBST(CC_SHARED_OPTS)
5160 AC_SUBST(LD_RPATH_OPT)
5161 AC_SUBST(LD_SHARED_OPTS)
5162 AC_SUBST(MK_SHARED_LIB)
5163 AC_SUBST(LINK_PROGS)
5164 AC_SUBST(LINK_TESTS)
5165 AC_SUBST(EXTRA_LDFLAGS)
5166 AC_SUBST(LOCAL_LDFLAGS)
5167 AC_SUBST(LOCAL_LDFLAGS2)
5168 AC_SUBST(INSTALL_LIB)
5170 dnl ---------------------------------------------------------------------------
5171 dnl CF_SHARED_SONAME version: 3 updated: 2008/09/08 18:34:43
5172 dnl ----------------
5173 dnl utility macro for CF_SHARED_OPTS, constructs "$cf_cv_shared_soname" for
5174 dnl substitution into MK_SHARED_LIB string for the "-soname" (or similar)
5177 dnl $1 is the default that should be used for "$cf_cv_shlib_version".
5178 dnl If missing, use "rel".
5179 define([CF_SHARED_SONAME],
5181 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=ifelse($1,,rel,$1)
5182 if test "$cf_cv_shlib_version" = rel; then
5183 cf_cv_shared_soname='`basename $[@] .${REL_VERSION}`.${ABI_VERSION}'
5185 cf_cv_shared_soname='`basename $[@]`'
5188 dnl ---------------------------------------------------------------------------
5189 dnl CF_SIGWINCH version: 1 updated: 2006/04/02 16:41:09
5191 dnl Use this macro after CF_XOPEN_SOURCE, but do not require it (not all
5192 dnl programs need this test).
5194 dnl This is really a MacOS X 10.4.3 workaround. Defining _POSIX_C_SOURCE
5195 dnl forces SIGWINCH to be undefined (breaks xterm, ncurses). Oddly, the struct
5196 dnl winsize declaration is left alone - we may revisit this if Apple choose to
5197 dnl break that part of the interface as well.
5198 AC_DEFUN([CF_SIGWINCH],
5200 AC_CACHE_CHECK(if SIGWINCH is defined,cf_cv_define_sigwinch,[
5202 #include <sys/types.h>
5203 #include <sys/signal.h>
5204 ],[int x = SIGWINCH],
5205 [cf_cv_define_sigwinch=yes],
5207 #undef _XOPEN_SOURCE
5208 #undef _POSIX_SOURCE
5209 #undef _POSIX_C_SOURCE
5210 #include <sys/types.h>
5211 #include <sys/signal.h>
5212 ],[int x = SIGWINCH],
5213 [cf_cv_define_sigwinch=maybe],
5214 [cf_cv_define_sigwinch=no])
5218 if test "$cf_cv_define_sigwinch" = maybe ; then
5219 AC_CACHE_CHECK(for actual SIGWINCH definition,cf_cv_fixup_sigwinch,[
5220 cf_cv_fixup_sigwinch=unknown
5222 while test $cf_sigwinch != 1
5225 #undef _XOPEN_SOURCE
5226 #undef _POSIX_SOURCE
5227 #undef _POSIX_C_SOURCE
5228 #include <sys/types.h>
5229 #include <sys/signal.h>
5231 #if SIGWINCH != $cf_sigwinch
5235 [cf_cv_fixup_sigwinch=$cf_sigwinch
5238 cf_sigwinch=`expr $cf_sigwinch - 1`
5242 if test "$cf_cv_fixup_sigwinch" != unknown ; then
5243 CPPFLAGS="$CPPFLAGS -DSIGWINCH=$cf_cv_fixup_sigwinch"
5247 dnl ---------------------------------------------------------------------------
5248 dnl CF_SIG_ATOMIC_T version: 2 updated: 2005/09/18 17:27:12
5250 dnl signal handler, but there are some gcc depedencies in that recommendation.
5252 AC_DEFUN([CF_SIG_ATOMIC_T],
5254 AC_MSG_CHECKING(for signal global datatype)
5255 AC_CACHE_VAL(cf_cv_sig_atomic_t,[
5257 "volatile sig_atomic_t" \
5262 #include <sys/types.h>
5268 static void handler(int sig)
5272 [signal(SIGINT, handler);
5274 [cf_cv_sig_atomic_t=$cf_type],
5275 [cf_cv_sig_atomic_t=no])
5276 test "$cf_cv_sig_atomic_t" != no && break
5279 AC_MSG_RESULT($cf_cv_sig_atomic_t)
5280 test "$cf_cv_sig_atomic_t" != no && AC_DEFINE_UNQUOTED(SIG_ATOMIC_T, $cf_cv_sig_atomic_t,[SIG_ATOMIC_T])
5282 dnl ---------------------------------------------------------------------------
5283 dnl CF_SIZECHANGE version: 8 updated: 2000/11/04 12:22:16
5285 dnl Check for definitions & structures needed for window size-changing
5286 dnl FIXME: check that this works with "snake" (HP-UX 10.x)
5287 AC_DEFUN([CF_SIZECHANGE],
5289 AC_REQUIRE([CF_STRUCT_TERMIOS])
5290 AC_CACHE_CHECK(declaration of size-change, cf_cv_sizechange,[
5291 cf_cv_sizechange=unknown
5292 cf_save_CPPFLAGS="$CPPFLAGS"
5294 for cf_opts in "" "NEED_PTEM_H"
5297 CPPFLAGS="$cf_save_CPPFLAGS"
5298 test -n "$cf_opts" && CPPFLAGS="$CPPFLAGS -D$cf_opts"
5299 AC_TRY_COMPILE([#include <sys/types.h>
5300 #ifdef HAVE_TERMIOS_H
5301 #include <termios.h>
5303 #ifdef HAVE_TERMIO_H
5308 /* This is a workaround for SCO: they neglected to define struct winsize in
5309 * termios.h -- it's only in termio.h and ptem.h
5311 #include <sys/stream.h>
5312 #include <sys/ptem.h>
5314 #if !defined(sun) || !defined(HAVE_TERMIOS_H)
5315 #include <sys/ioctl.h>
5319 struct ttysize win; /* FIXME: what system is this? */
5320 int y = win.ts_lines;
5321 int x = win.ts_cols;
5328 no TIOCGSIZE or TIOCGWINSZ
5329 #endif /* TIOCGWINSZ */
5330 #endif /* TIOCGSIZE */
5332 [cf_cv_sizechange=yes],
5333 [cf_cv_sizechange=no])
5335 CPPFLAGS="$cf_save_CPPFLAGS"
5336 if test "$cf_cv_sizechange" = yes ; then
5337 echo "size-change succeeded ($cf_opts)" >&AS_MESSAGE_LOG_FD
5338 test -n "$cf_opts" && cf_cv_sizechange="$cf_opts"
5343 if test "$cf_cv_sizechange" != no ; then
5344 AC_DEFINE(HAVE_SIZECHANGE,[1],[HAVE_SIZECHANGE])
5345 case $cf_cv_sizechange in #(vi
5347 AC_DEFINE_UNQUOTED($cf_cv_sizechange )
5352 dnl ---------------------------------------------------------------------------
5353 dnl CF_SRC_MODULES version: 21 updated: 2010/09/04 17:37:40
5355 dnl For each parameter, test if the source-directory exists, and if it contains
5356 dnl a 'modules' file. If so, add to the list $cf_cv_src_modules which we'll
5357 dnl use in CF_LIB_RULES.
5359 dnl This uses the configured value to make the lists SRC_SUBDIRS and
5360 dnl SUB_MAKEFILES which are used in the makefile-generation scheme.
5361 AC_DEFUN([CF_SRC_MODULES],
5363 AC_MSG_CHECKING(for src modules)
5365 # dependencies and linker-arguments for test-programs
5366 TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${LIB_NAME}${DFT_DEP_SUFFIX} $TEST_DEPS"
5367 TEST_DEP2="${LIB_2ND}/${LIB_PREFIX}${LIB_NAME}${DFT_DEP_SUFFIX} $TEST_DEP2"
5368 if test "$DFT_LWR_MODEL" = "libtool"; then
5369 TEST_ARGS="${TEST_DEPS}"
5370 TEST_ARG2="${TEST_DEP2}"
5372 TEST_ARGS="-l${LIB_NAME}${DFT_ARG_SUFFIX} $TEST_ARGS"
5373 TEST_ARG2="-l${LIB_NAME}${DFT_ARG_SUFFIX} $TEST_ARG2"
5379 if test -f $srcdir/$cf_dir/modules; then
5381 # We may/may not have tack in the distribution, though the
5383 if test $cf_dir = tack ; then
5384 if test ! -f $srcdir/${cf_dir}/${cf_dir}.h; then
5389 if test -z "$cf_cv_src_modules"; then
5390 cf_cv_src_modules=$cf_dir
5392 cf_cv_src_modules="$cf_cv_src_modules $cf_dir"
5395 # Make the ncurses_cfg.h file record the library interface files as
5396 # well. These are header files that are the same name as their
5397 # directory. Ncurses is the only library that does not follow
5399 if test $cf_dir = tack ; then
5401 elif test -f $srcdir/${cf_dir}/${cf_dir}.h; then
5402 CF_UPPER(cf_have_include,$cf_dir)
5403 AC_DEFINE_UNQUOTED(HAVE_${cf_have_include}_H)
5404 AC_DEFINE_UNQUOTED(HAVE_LIB${cf_have_include})
5405 TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${cf_dir}${DFT_DEP_SUFFIX} $TEST_DEPS"
5406 TEST_DEP2="${LIB_2ND}/${LIB_PREFIX}${cf_dir}${DFT_DEP_SUFFIX} $TEST_DEP2"
5407 if test "$DFT_LWR_MODEL" = "libtool"; then
5408 TEST_ARGS="${TEST_DEPS}"
5409 TEST_ARG2="${TEST_DEP2}"
5411 TEST_ARGS="-l${cf_dir}${DFT_ARG_SUFFIX} $TEST_ARGS"
5412 TEST_ARG2="-l${cf_dir}${DFT_ARG_SUFFIX} $TEST_ARG2"
5417 AC_MSG_RESULT($cf_cv_src_modules)
5419 TEST_ARGS="-L${LIB_DIR} $TEST_ARGS"
5420 TEST_ARG2="-L${LIB_2ND} $TEST_ARG2"
5429 if test "x$cf_with_manpages" != xno ; then
5430 SRC_SUBDIRS="$SRC_SUBDIRS man"
5432 SRC_SUBDIRS="$SRC_SUBDIRS include"
5433 for cf_dir in $cf_cv_src_modules
5435 SRC_SUBDIRS="$SRC_SUBDIRS $cf_dir"
5437 if test "x$cf_with_tests" != "xno" ; then
5438 SRC_SUBDIRS="$SRC_SUBDIRS test"
5440 test -z "$MAKE_TERMINFO" && SRC_SUBDIRS="$SRC_SUBDIRS misc"
5441 test "$cf_with_cxx_binding" != no && SRC_SUBDIRS="$SRC_SUBDIRS c++"
5444 if test "$cf_cv_prog_gnat_correct" = yes && test -f $srcdir/Ada95/Makefile.in; then
5445 SRC_SUBDIRS="$SRC_SUBDIRS Ada95"
5446 ADA_SUBDIRS="gen src"
5447 if test "x$cf_with_tests" != "xno" ; then
5448 ADA_SUBDIRS="$ADA_SUBDIRS samples"
5453 for cf_dir in $SRC_SUBDIRS
5455 SUB_MAKEFILES="$SUB_MAKEFILES $cf_dir/Makefile"
5458 if test -n "$ADA_SUBDIRS"; then
5459 for cf_dir in $ADA_SUBDIRS
5461 SUB_MAKEFILES="$SUB_MAKEFILES Ada95/$cf_dir/Makefile"
5463 AC_SUBST(ADA_SUBDIRS)
5466 dnl ---------------------------------------------------------------------------
5467 dnl CF_STDCPP_LIBRARY version: 7 updated: 2010/05/29 16:31:02
5468 dnl -----------------
5469 dnl Check for -lstdc++, which is GNU's standard C++ library.
5470 AC_DEFUN([CF_STDCPP_LIBRARY],
5472 if test -n "$GXX" ; then
5473 case $cf_cv_system_name in #(vi
5475 cf_stdcpp_libname=stdcpp
5478 cf_stdcpp_libname=stdc++
5481 AC_CACHE_CHECK(for library $cf_stdcpp_libname,cf_cv_libstdcpp,[
5483 CF_ADD_LIB($cf_stdcpp_libname)
5485 #include <strstream.h>],[
5487 strstreambuf foo(buf, sizeof(buf))
5489 [cf_cv_libstdcpp=yes],
5490 [cf_cv_libstdcpp=no])
5493 test "$cf_cv_libstdcpp" = yes && CF_ADD_LIB($cf_stdcpp_libname,CXXLIBS)
5496 dnl ---------------------------------------------------------------------------
5497 dnl CF_STRIP_G_OPT version: 3 updated: 2002/12/21 19:25:52
5499 dnl Remove "-g" option from the compiler options
5500 AC_DEFUN([CF_STRIP_G_OPT],
5501 [$1=`echo ${$1} | sed -e 's%-g %%' -e 's%-g$%%'`])dnl
5502 dnl ---------------------------------------------------------------------------
5503 dnl CF_STRUCT_SIGACTION version: 3 updated: 2000/08/12 23:18:52
5504 dnl -------------------
5505 dnl Check if we need _POSIX_SOURCE defined to use struct sigaction. We'll only
5506 dnl do this if we've found the sigaction function.
5508 dnl If needed, define SVR4_ACTION.
5509 AC_DEFUN([CF_STRUCT_SIGACTION],[
5510 if test "$ac_cv_func_sigaction" = yes; then
5511 AC_MSG_CHECKING(whether sigaction needs _POSIX_SOURCE)
5513 #include <sys/types.h>
5514 #include <signal.h>],
5515 [struct sigaction act],
5519 #define _POSIX_SOURCE
5520 #include <sys/types.h>
5521 #include <signal.h>],
5522 [struct sigaction act],
5524 AC_DEFINE(SVR4_ACTION,[],[SRV4_ACTION])],
5525 [sigact_bad=unknown])])
5526 AC_MSG_RESULT($sigact_bad)
5529 dnl ---------------------------------------------------------------------------
5530 dnl CF_STRUCT_TERMIOS version: 5 updated: 2000/11/04 12:22:46
5531 dnl -----------------
5532 dnl Some machines require _POSIX_SOURCE to completely define struct termios.
5533 dnl If so, define SVR4_TERMIO
5534 AC_DEFUN([CF_STRUCT_TERMIOS],[
5540 if test "$ISC" = yes ; then
5541 AC_CHECK_HEADERS( sys/termio.h )
5543 if test "$ac_cv_header_termios_h" = yes ; then
5544 case "$CFLAGS $CPPFLAGS" in
5546 termios_bad=dunno ;;
5547 *) termios_bad=maybe ;;
5549 if test "$termios_bad" = maybe ; then
5550 AC_MSG_CHECKING(whether termios.h needs _POSIX_SOURCE)
5551 AC_TRY_COMPILE([#include <termios.h>],
5552 [struct termios foo; int x = foo.c_iflag],
5555 #define _POSIX_SOURCE
5556 #include <termios.h>],
5557 [struct termios foo; int x = foo.c_iflag],
5558 termios_bad=unknown,
5559 termios_bad=yes AC_DEFINE(SVR4_TERMIO,[],[SRV4_TERMIO]))
5561 AC_MSG_RESULT($termios_bad)
5565 dnl ---------------------------------------------------------------------------
5566 dnl CF_SUBDIR_PATH version: 6 updated: 2010/04/21 06:20:50
5568 dnl Construct a search-list for a nonstandard header/lib-file
5569 dnl $1 = the variable to return as result
5570 dnl $2 = the package name
5571 dnl $3 = the subdirectory, e.g., bin, include or lib
5572 AC_DEFUN([CF_SUBDIR_PATH],
5576 CF_ADD_SUBDIR_PATH($1,$2,$3,/usr,$prefix)
5577 CF_ADD_SUBDIR_PATH($1,$2,$3,$prefix,NONE)
5578 CF_ADD_SUBDIR_PATH($1,$2,$3,/usr/local,$prefix)
5579 CF_ADD_SUBDIR_PATH($1,$2,$3,/opt,$prefix)
5580 CF_ADD_SUBDIR_PATH($1,$2,$3,[$]HOME,$prefix)
5582 dnl ---------------------------------------------------------------------------
5583 dnl CF_SUBST version: 4 updated: 2006/06/17 12:33:03
5585 dnl Shorthand macro for substituting things that the user may override
5586 dnl with an environment variable.
5588 dnl $1 = long/descriptive name
5589 dnl $2 = environment variable
5590 dnl $3 = default value
5591 AC_DEFUN([CF_SUBST],
5592 [AC_CACHE_VAL(cf_cv_subst_$2,[
5593 AC_MSG_CHECKING(for $1 (symbol $2))
5594 CF_SUBST_IF([-z "[$]$2"], [$2], [$3])
5595 cf_cv_subst_$2=[$]$2
5596 AC_MSG_RESULT([$]$2)
5599 dnl ---------------------------------------------------------------------------
5600 dnl CF_SUBST_IF version: 2 updated: 2006/06/17 12:33:03
5602 dnl Shorthand macro for substituting things that the user may override
5603 dnl with an environment variable.
5605 dnl $1 = condition to pass to "test"
5606 dnl $2 = environment variable
5607 dnl $3 = value if the test succeeds
5608 dnl $4 = value if the test fails
5609 AC_DEFUN([CF_SUBST_IF],
5618 dnl ---------------------------------------------------------------------------
5619 dnl CF_SUBST_NCURSES_VERSION version: 8 updated: 2006/09/16 11:40:59
5620 dnl ------------------------
5621 dnl Get the version-number for use in shared-library naming, etc.
5622 AC_DEFUN([CF_SUBST_NCURSES_VERSION],
5624 AC_REQUIRE([CF_PROG_EGREP])
5625 NCURSES_MAJOR="`$ac_cv_prog_egrep '^NCURSES_MAJOR[[ ]]*=' $srcdir/dist.mk | sed -e 's/^[[^0-9]]*//'`"
5626 NCURSES_MINOR="`$ac_cv_prog_egrep '^NCURSES_MINOR[[ ]]*=' $srcdir/dist.mk | sed -e 's/^[[^0-9]]*//'`"
5627 NCURSES_PATCH="`$ac_cv_prog_egrep '^NCURSES_PATCH[[ ]]*=' $srcdir/dist.mk | sed -e 's/^[[^0-9]]*//'`"
5628 cf_cv_abi_version=${NCURSES_MAJOR}
5629 cf_cv_rel_version=${NCURSES_MAJOR}.${NCURSES_MINOR}
5630 dnl Show the computed version, for logging
5631 cf_cv_timestamp=`date`
5632 AC_MSG_RESULT(Configuring NCURSES $cf_cv_rel_version ABI $cf_cv_abi_version ($cf_cv_timestamp))
5633 dnl We need these values in the generated headers
5634 AC_SUBST(NCURSES_MAJOR)
5635 AC_SUBST(NCURSES_MINOR)
5636 AC_SUBST(NCURSES_PATCH)
5637 dnl We need these values in the generated makefiles
5638 AC_SUBST(cf_cv_rel_version)
5639 AC_SUBST(cf_cv_abi_version)
5640 AC_SUBST(cf_cv_builtin_bool)
5641 AC_SUBST(cf_cv_header_stdbool_h)
5642 AC_SUBST(cf_cv_type_of_bool)dnl
5644 dnl ---------------------------------------------------------------------------
5645 dnl CF_SYS_TIME_SELECT version: 4 updated: 2000/10/04 09:18:40
5646 dnl ------------------
5647 dnl Check if we can include <sys/time.h> with <sys/select.h>; this breaks on
5648 dnl older SCO configurations.
5649 AC_DEFUN([CF_SYS_TIME_SELECT],
5651 AC_MSG_CHECKING(if sys/time.h works with sys/select.h)
5652 AC_CACHE_VAL(cf_cv_sys_time_select,[
5654 #include <sys/types.h>
5655 #ifdef HAVE_SYS_TIME_H
5656 #include <sys/time.h>
5658 #ifdef HAVE_SYS_SELECT_H
5659 #include <sys/select.h>
5661 ],[],[cf_cv_sys_time_select=yes],
5662 [cf_cv_sys_time_select=no])
5664 AC_MSG_RESULT($cf_cv_sys_time_select)
5665 test "$cf_cv_sys_time_select" = yes && AC_DEFINE(HAVE_SYS_TIME_SELECT,[],[HAVE_SYS_TIME_SELECT])
5667 dnl ---------------------------------------------------------------------------
5668 dnl CF_TOP_BUILDDIR version: 1 updated: 2006/10/15 16:33:23
5670 dnl Define a top_builddir symbol, for applications that need an absolute path.
5671 AC_DEFUN([CF_TOP_BUILDDIR],
5674 AC_SUBST(top_builddir)
5676 dnl ---------------------------------------------------------------------------
5677 dnl CF_TYPEOF_CHTYPE version: 8 updated: 2006/12/16 12:33:30
5678 dnl ----------------
5679 dnl Determine the type we should use for chtype (and attr_t, which is treated
5680 dnl as the same thing). We want around 32 bits, so on most machines want a
5681 dnl long, but on newer 64-bit machines, probably want an int. If we're using
5682 dnl wide characters, we have to have a type compatible with that, as well.
5683 AC_DEFUN([CF_TYPEOF_CHTYPE],
5685 AC_MSG_CHECKING([for type of chtype])
5686 AC_CACHE_VAL(cf_cv_typeof_chtype,[
5688 #define WANT_BITS 31
5692 FILE *fp = fopen("cf_test.out", "w");
5694 char *result = "long";
5695 if (sizeof(unsigned long) > sizeof(unsigned int)) {
5698 for (n = 0; n < WANT_BITS; n++) {
5701 if (y != 1 || x == 0) {
5707 * If x is nonzero, an int is big enough for the bits
5710 result = (x != 0) ? "int" : "long";
5715 ${cf_cv_main_return:-return}(0);
5718 [cf_cv_typeof_chtype=`cat cf_test.out`],
5719 [cf_cv_typeof_chtype=long],
5720 [cf_cv_typeof_chtype=long])
5723 AC_MSG_RESULT($cf_cv_typeof_chtype)
5725 AC_SUBST(cf_cv_typeof_chtype)
5726 AC_DEFINE_UNQUOTED(TYPEOF_CHTYPE,$cf_cv_typeof_chtype,[TYPEOF_CHTYPE])
5728 dnl ---------------------------------------------------------------------------
5729 dnl CF_TYPE_SIGACTION version: 3 updated: 2000/08/12 23:18:52
5730 dnl -----------------
5732 AC_DEFUN([CF_TYPE_SIGACTION],
5734 AC_MSG_CHECKING([for type sigaction_t])
5735 AC_CACHE_VAL(cf_cv_type_sigaction,[
5737 #include <signal.h>],
5739 [cf_cv_type_sigaction=yes],
5740 [cf_cv_type_sigaction=no])])
5741 AC_MSG_RESULT($cf_cv_type_sigaction)
5742 test "$cf_cv_type_sigaction" = yes && AC_DEFINE(HAVE_TYPE_SIGACTION,[],[HAVE_TYPE_SIGACTION])
5744 dnl ---------------------------------------------------------------------------
5745 dnl CF_UNSIGNED_LITERALS version: 2 updated: 1998/02/07 22:10:16
5746 dnl --------------------
5747 dnl Test if the compiler supports 'U' and 'L' suffixes. Only old compilers
5748 dnl won't, but they're still there.
5749 AC_DEFUN([CF_UNSIGNED_LITERALS],
5751 AC_MSG_CHECKING([if unsigned literals are legal])
5752 AC_CACHE_VAL(cf_cv_unsigned_literals,[
5753 AC_TRY_COMPILE([],[long x = 1L + 1UL + 1U + 1],
5754 [cf_cv_unsigned_literals=yes],
5755 [cf_cv_unsigned_literals=no])
5757 AC_MSG_RESULT($cf_cv_unsigned_literals)
5759 dnl ---------------------------------------------------------------------------
5760 dnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59
5762 dnl Make an uppercase version of a variable
5763 dnl $1=uppercase($2)
5764 AC_DEFUN([CF_UPPER],
5766 $1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
5768 dnl ---------------------------------------------------------------------------
5769 dnl CF_UTF8_LIB version: 7 updated: 2010/06/20 09:24:28
5771 dnl Check for multibyte support, and if not found, utf8 compatibility library
5772 AC_DEFUN([CF_UTF8_LIB],
5774 AC_CACHE_CHECK(for multibyte character support,cf_cv_utf8_lib,[
5775 cf_save_LIBS="$LIBS"
5777 #include <stdlib.h>],[putwc(0,0);],
5778 [cf_cv_utf8_lib=yes],
5780 #include <libutf8.h>],[putwc(0,0);],utf8,
5781 [cf_cv_utf8_lib=add-on],
5782 [cf_cv_utf8_lib=no])
5785 # HAVE_LIBUTF8_H is used by ncurses if curses.h is shared between
5787 if test "$cf_cv_utf8_lib" = "add-on" ; then
5788 AC_DEFINE(HAVE_LIBUTF8_H,[],[Have libutf8.h])
5789 CF_ADD_INCDIR($cf_cv_header_path_utf8)
5790 CF_ADD_LIBDIR($cf_cv_library_path_utf8)
5791 CF_ADD_LIBS($cf_cv_library_file_utf8)
5794 dnl ---------------------------------------------------------------------------
5795 dnl CF_VA_COPY version: 2 updated: 2010/03/04 05:37:29
5797 dnl check for va_copy, part of stdarg.h
5798 dnl Also, workaround for glibc's __va_copy, by checking for both.
5799 AC_DEFUN([CF_VA_COPY],[
5800 AC_CACHE_CHECK(for va_copy, cf_cv_have_va_copy,[
5807 cf_cv_have_va_copy=yes,
5808 cf_cv_have_va_copy=no)])
5810 test "$cf_cv_have_va_copy" = yes && AC_DEFINE(HAVE_VA_COPY)
5812 AC_CACHE_CHECK(for __va_copy, cf_cv_have___va_copy,[
5818 __va_copy(dst, src)],
5819 cf_cv_have___va_copy=yes,
5820 cf_cv_have___va_copy=no)])
5822 test "$cf_cv_have___va_copy" = yes && AC_DEFINE(HAVE___VA_COPY)
5824 dnl ---------------------------------------------------------------------------
5825 dnl CF_VERBOSE version: 3 updated: 2007/07/29 09:55:12
5827 dnl Use AC_VERBOSE w/o the warnings
5828 AC_DEFUN([CF_VERBOSE],
5829 [test -n "$verbose" && echo " $1" 1>&AS_MESSAGE_FD
5832 dnl ---------------------------------------------------------------------------
5833 dnl CF_WCHAR_TYPE version: 3 updated: 2010/05/26 16:44:57
5835 dnl Check if type wide-character type $1 is declared, and if so, which header
5836 dnl file is needed. The second parameter is used to set a shell variable when
5837 dnl the type is not found. The first parameter sets a shell variable for the
5839 AC_DEFUN([CF_WCHAR_TYPE],
5841 # This is needed on Tru64 5.0 to declare $1
5842 AC_CACHE_CHECK(if we must include wchar.h to declare $1,cf_cv_$1,[
5847 #ifdef HAVE_LIBUTF8_H
5848 #include <libutf8.h>
5857 #ifdef HAVE_LIBUTF8_H
5858 #include <libutf8.h>
5862 [cf_cv_$1=unknown])])])
5864 if test "$cf_cv_$1" = yes ; then
5865 AC_DEFINE(NEED_WCHAR_H,[],[NEED_WCHAR_H])
5870 # if we do not find $1 in either place, use substitution to provide a fallback.
5871 if test "$cf_cv_$1" = unknown ; then
5876 # if we find $1 in either place, use substitution to provide a fallback.
5877 if test "$cf_cv_$1" != unknown ; then
5882 dnl ---------------------------------------------------------------------------
5883 dnl CF_WEAK_SYMBOLS version: 1 updated: 2008/08/16 19:18:06
5885 dnl Check for compiler-support for weak symbols.
5886 dnl This works with "recent" gcc.
5887 AC_DEFUN([CF_WEAK_SYMBOLS],[
5888 AC_CACHE_CHECK(if $CC supports weak symbols,cf_cv_weak_symbols,[
5891 #include <stdio.h>],
5893 #if defined(__GNUC__)
5894 # if defined __USE_ISOC99
5895 # define _cat_pragma(exp) _Pragma(#exp)
5896 # define _weak_pragma(exp) _cat_pragma(weak name)
5898 # define _weak_pragma(exp)
5900 # define _declare(name) __extension__ extern __typeof__(name) name
5901 # define weak_symbol(name) _weak_pragma(name) _declare(name) __attribute__((weak))
5905 ],[cf_cv_weak_symbols=yes],[cf_cv_weak_symbols=no])
5908 dnl ---------------------------------------------------------------------------
5909 dnl CF_WITH_ABI_VERSION version: 1 updated: 2003/09/20 18:12:49
5910 dnl -------------------
5911 dnl Allow library's ABI to be overridden. Generally this happens when a
5912 dnl packager has incremented the ABI past that used in the original package,
5913 dnl and wishes to keep doing this.
5915 dnl $1 is the package name, if any, to derive a corresponding {package}_ABI
5917 AC_DEFUN([CF_WITH_ABI_VERSION],[
5918 test -z "$cf_cv_abi_version" && cf_cv_abi_version=0
5919 AC_ARG_WITH(abi-version,
5920 [ --with-abi-version=XXX override derived ABI version],
5921 [AC_MSG_WARN(overriding ABI version $cf_cv_abi_version to $withval)
5922 cf_cv_abi_version=$withval])
5923 CF_NUMBER_SYNTAX($cf_cv_abi_version,ABI version)
5925 $1_ABI=$cf_cv_abi_version
5928 dnl ---------------------------------------------------------------------------
5929 dnl CF_WITH_ADA_COMPILER version: 2 updated: 2010/06/26 17:35:58
5930 dnl --------------------
5931 dnl Command-line option to specify the Ada95 compiler.
5932 AC_DEFUN([CF_WITH_ADA_COMPILER],[
5933 AC_MSG_CHECKING(for ada-compiler)
5934 AC_ARG_WITH(ada-compiler,
5935 [ --with-ada-compiler=CMD specify Ada95 compiler command (default gnatmake)],
5936 [cf_ada_compiler=$withval],
5937 [cf_ada_compiler=gnatmake])
5938 AC_SUBST(cf_ada_compiler)
5939 AC_MSG_RESULT($cf_ada_compiler)
5941 dnl ---------------------------------------------------------------------------
5942 dnl CF_WITH_ADA_INCLUDE version: 2 updated: 2010/06/26 17:35:58
5943 dnl -------------------
5944 dnl Command-line option to specify where Ada includes will install.
5945 AC_DEFUN([CF_WITH_ADA_INCLUDE],[
5946 AC_MSG_CHECKING(for ada-include)
5947 CF_WITH_PATH(ada-include,
5948 [ --with-ada-include=DIR Ada includes are in DIR],
5950 PREFIX/share/ada/adainclude,
5951 [$]prefix/share/ada/adainclude)
5952 AC_SUBST(ADA_INCLUDE)
5953 AC_MSG_RESULT($ADA_INCLUDE)
5955 dnl ---------------------------------------------------------------------------
5956 dnl CF_WITH_ADA_OBJECTS version: 2 updated: 2010/06/26 17:35:58
5957 dnl -------------------
5958 dnl Command-line option to specify where Ada objects will install.
5959 AC_DEFUN([CF_WITH_ADA_OBJECTS],[
5960 AC_MSG_CHECKING(for ada-objects)
5961 CF_WITH_PATH(ada-objects,
5962 [ --with-ada-objects=DIR Ada objects are in DIR],
5964 PREFIX/lib/ada/adalib,
5965 [$]prefix/lib/ada/adalib)
5966 AC_SUBST(ADA_OBJECTS)
5967 AC_MSG_RESULT($ADA_OBJECTS)
5969 dnl ---------------------------------------------------------------------------
5970 dnl CF_WITH_ADA_SHAREDLIB version: 2 updated: 2010/06/26 17:35:58
5971 dnl ---------------------
5972 dnl Command-line option to specify if an Ada95 shared-library should be built,
5973 dnl and optionally what its soname should be.
5974 AC_DEFUN([CF_WITH_ADA_SHAREDLIB],[
5975 AC_MSG_CHECKING(if an Ada95 shared-library should be built)
5976 AC_ARG_WITH(ada-sharedlib,
5977 [ --with-ada-sharedlib=XX build Ada95 shared-library],
5978 [with_ada_sharedlib=$withval],
5979 [with_ada_sharedlib=no])
5980 AC_MSG_RESULT($with_ada_sharedlib)
5982 ADA_SHAREDLIB='lib$(LIB_NAME).so.1'
5983 MAKE_ADA_SHAREDLIB="#"
5985 if test "x$with_ada_sharedlib" != xno
5988 if test "x$with_ada_sharedlib" != xyes
5990 ADA_SHAREDLIB="$with_ada_sharedlib"
5994 AC_SUBST(ADA_SHAREDLIB)
5995 AC_SUBST(MAKE_ADA_SHAREDLIB)
5997 dnl ---------------------------------------------------------------------------
5998 dnl CF_WITH_DBMALLOC version: 7 updated: 2010/06/21 17:26:47
5999 dnl ----------------
6000 dnl Configure-option for dbmalloc. The optional parameter is used to override
6001 dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests.
6002 AC_DEFUN([CF_WITH_DBMALLOC],[
6003 CF_NO_LEAKS_OPTION(dbmalloc,
6004 [ --with-dbmalloc test: use Conor Cahill's dbmalloc library],
6007 if test "$with_dbmalloc" = yes ; then
6008 AC_CHECK_HEADER(dbmalloc.h,
6009 [AC_CHECK_LIB(dbmalloc,[debug_malloc]ifelse([$1],,[],[,$1]))])
6012 dnl ---------------------------------------------------------------------------
6013 dnl CF_WITH_DMALLOC version: 7 updated: 2010/06/21 17:26:47
6015 dnl Configure-option for dmalloc. The optional parameter is used to override
6016 dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests.
6017 AC_DEFUN([CF_WITH_DMALLOC],[
6018 CF_NO_LEAKS_OPTION(dmalloc,
6019 [ --with-dmalloc test: use Gray Watson's dmalloc library],
6022 if test "$with_dmalloc" = yes ; then
6023 AC_CHECK_HEADER(dmalloc.h,
6024 [AC_CHECK_LIB(dmalloc,[dmalloc_debug]ifelse([$1],,[],[,$1]))])
6027 dnl ---------------------------------------------------------------------------
6028 dnl CF_WITH_GPM version: 7 updated: 2008/03/23 14:48:54
6031 dnl The option parameter (if neither yes/no) is assumed to be the name of
6032 dnl the gpm library, e.g., for dynamic loading.
6033 AC_DEFUN([CF_WITH_GPM],
6035 AC_MSG_CHECKING(if you want to link with the GPM mouse library)
6037 [ --with-gpm use Alessandro Rubini's GPM library],
6038 [with_gpm=$withval],
6040 AC_MSG_RESULT($with_gpm)
6042 if test "$with_gpm" != no ; then
6043 AC_CHECK_HEADER(gpm.h,[
6044 AC_DEFINE([HAVE_GPM_H],[],[HAVE_GPM_H])
6045 if test "$with_gpm" != yes && test "$with_gpm" != maybe ; then
6046 CF_VERBOSE(assuming we really have GPM library)
6047 AC_DEFINE(HAVE_LIBGPM,[],[HAVE_LIBGPM])
6049 AC_CHECK_LIB(gpm,Gpm_Open,[:],[
6050 AC_MSG_ERROR(Cannot link with GPM library)
6055 test "$with_gpm" != maybe && AC_MSG_WARN(Cannot find GPM header)
6060 dnl ---------------------------------------------------------------------------
6061 dnl CF_WITH_LIBTOOL version: 26 updated: 2010/10/23 15:55:24
6063 dnl Provide a configure option to incorporate libtool. Define several useful
6064 dnl symbols for the makefile rules.
6066 dnl The reference to AC_PROG_LIBTOOL does not normally work, since it uses
6067 dnl macros from libtool.m4 which is in the aclocal directory of automake.
6068 dnl Following is a simple script which turns on the AC_PROG_LIBTOOL macro.
6069 dnl But that still does not work properly since the macro is expanded outside
6070 dnl the CF_WITH_LIBTOOL macro:
6073 dnl ACLOCAL=`aclocal --print-ac-dir`
6074 dnl if test -z "$ACLOCAL" ; then
6075 dnl echo cannot find aclocal directory
6077 dnl elif test ! -f $ACLOCAL/libtool.m4 ; then
6078 dnl echo cannot find libtool.m4 file
6082 dnl LOCAL=aclocal.m4
6083 dnl ORIG=aclocal.m4.orig
6085 dnl trap "mv $ORIG $LOCAL" 0 1 2 5 15
6089 dnl # sed the LIBTOOL= assignment to omit the current directory?
6090 dnl sed -e 's/^LIBTOOL=.*/LIBTOOL=${LIBTOOL:-libtool}/' $ACLOCAL/libtool.m4 >>$LOCAL
6091 dnl cat $ORIG >>$LOCAL
6095 AC_DEFUN([CF_WITH_LIBTOOL],
6097 AC_REQUIRE([CF_DISABLE_LIBTOOL_VERSION])
6098 ifdef([AC_PROG_LIBTOOL],,[
6101 # common library maintenance symbols that are convenient for libtool scripts:
6102 LIB_CREATE='${AR} -cr'
6103 LIB_OBJECT='${OBJECTS}'
6107 # symbols used to prop libtool up to enable it to determine what it should be
6115 AC_MSG_CHECKING(if you want to build libraries with libtool)
6116 AC_ARG_WITH(libtool,
6117 [ --with-libtool generate libraries with libtool],
6118 [with_libtool=$withval],
6120 AC_MSG_RESULT($with_libtool)
6121 if test "$with_libtool" != "no"; then
6122 ifdef([AC_PROG_LIBTOOL],[
6123 # missing_content_AC_PROG_LIBTOOL{{
6125 # missing_content_AC_PROG_LIBTOOL}}
6127 if test "$with_libtool" != "yes" ; then
6128 CF_PATH_SYNTAX(with_libtool)
6129 LIBTOOL=$with_libtool
6131 AC_PATH_PROG(LIBTOOL,libtool)
6133 if test -z "$LIBTOOL" ; then
6134 AC_MSG_ERROR(Cannot find libtool)
6137 LIB_CREATE='${LIBTOOL} --mode=link ${CC} -rpath ${DESTDIR}${libdir} ${LIBTOOL_VERSION} `cut -f1 ${srcdir}/VERSION` ${LIBTOOL_OPTS} ${LT_UNDEF} -o'
6138 LIB_OBJECT='${OBJECTS:.o=.lo}'
6140 LIB_CLEAN='${LIBTOOL} --mode=clean'
6141 LIB_COMPILE='${LIBTOOL} --mode=compile'
6142 LIB_LINK='${LIBTOOL} --mode=link ${CC} ${LIBTOOL_OPTS}'
6143 LIB_INSTALL='${LIBTOOL} --mode=install'
6144 LIB_UNINSTALL='${LIBTOOL} --mode=uninstall'
6147 # Show the version of libtool
6148 AC_MSG_CHECKING(version of libtool)
6150 # Save the version in a cache variable - this is not entirely a good
6151 # thing, but the version string from libtool is very ugly, and for
6152 # bug reports it might be useful to have the original string. "("
6153 cf_cv_libtool_version=`$LIBTOOL --version 2>&1 | sed -e '/^$/d' |sed -e '2,$d' -e 's/([[^)]]*)//g' -e 's/^[[^1-9]]*//' -e 's/[[^0-9.]].*//'`
6154 AC_MSG_RESULT($cf_cv_libtool_version)
6155 if test -z "$cf_cv_libtool_version" ; then
6156 AC_MSG_ERROR(This is not GNU libtool)
6159 # special hack to add -no-undefined (which libtool should do for itself)
6161 case "$cf_cv_system_name" in #(vi
6162 cygwin*|mingw32*|uwin*|aix[[456]]) #(vi
6163 LT_UNDEF=-no-undefined
6166 AC_SUBST([LT_UNDEF])
6168 # special hack to add --tag option for C++ compiler
6169 case $cf_cv_libtool_version in #(vi
6170 1.[[5-9]]*|[[2-9]].[[0-9.a-z]]*) #(vi
6171 LIBTOOL_CXX="$LIBTOOL --tag=CXX"
6172 LIBTOOL="$LIBTOOL --tag=CC"
6175 LIBTOOL_CXX="$LIBTOOL"
6183 test -z "$LIBTOOL" && ECHO_LT=
6186 AC_SUBST(LIBTOOL_CXX)
6187 AC_SUBST(LIBTOOL_OPTS)
6189 AC_SUBST(LIB_CREATE)
6190 AC_SUBST(LIB_OBJECT)
6191 AC_SUBST(LIB_SUFFIX)
6195 AC_SUBST(LIB_COMPILE)
6197 AC_SUBST(LIB_INSTALL)
6198 AC_SUBST(LIB_UNINSTALL)
6201 dnl ---------------------------------------------------------------------------
6202 dnl CF_WITH_PATH version: 10 updated: 2010/10/23 15:44:18
6204 dnl Wrapper for AC_ARG_WITH to ensure that user supplies a pathname, not just
6205 dnl defaulting to yes/no.
6207 dnl $1 = option name
6209 dnl $3 = environment variable to set
6210 dnl $4 = default value, shown in the help-message, must be a constant
6211 dnl $5 = default value, if it's an expression & cannot be in the help-message
6213 AC_DEFUN([CF_WITH_PATH],
6214 [AC_ARG_WITH($1,[$2 ](default: ifelse([$4],,empty,[$4])),,
6215 ifelse([$4],,[withval="${$3}"],[withval="${$3:-ifelse([$5],,[$4],[$5])}"]))dnl
6216 if ifelse([$5],,true,[test -n "$5"]) ; then
6217 CF_PATH_SYNTAX(withval)
6222 dnl ---------------------------------------------------------------------------
6223 dnl CF_WITH_PATHLIST version: 7 updated: 2010/10/23 16:10:30
6224 dnl ----------------
6225 dnl Process an option specifying a list of colon-separated paths.
6227 dnl $1 = option name
6229 dnl $3 = environment variable to set
6230 dnl $4 = default value, shown in the help-message, must be a constant
6231 dnl $5 = default value, if it's an expression & cannot be in the help-message
6232 dnl $6 = flag to tell if we want to define or substitute
6234 AC_DEFUN([CF_WITH_PATHLIST],[
6235 AC_REQUIRE([CF_PATHSEP])
6236 AC_ARG_WITH($1,[$2 ](default: ifelse($4,,empty,$4)),,
6237 ifelse($4,,[withval=${$3}],[withval=${$3:-ifelse($5,,$4,$5)}]))dnl
6239 IFS="${IFS:- }"; ac_save_ifs="$IFS"; IFS="${PATH_SEPARATOR}"
6241 for cf_src_path in $withval
6243 CF_PATH_SYNTAX(cf_src_path)
6244 test -n "$cf_dst_path" && cf_dst_path="${cf_dst_path}:"
6245 cf_dst_path="${cf_dst_path}${cf_src_path}"
6250 # Strip single quotes from the value, e.g., when it was supplied as a literal
6252 case $cf_dst_path in #(vi
6254 cf_dst_path=`echo $cf_dst_path |sed -e s/\'// -e s/\'\$//`
6257 cf_dst_path=`echo "$cf_dst_path" | sed -e 's/\\\\/\\\\\\\\/g'`
6260 eval '$3="$cf_dst_path"'
6264 dnl ---------------------------------------------------------------------------
6265 dnl CF_WITH_PTHREAD version: 3 updated: 2010/05/29 16:31:02
6267 dnl Check for POSIX thread library.
6268 AC_DEFUN([CF_WITH_PTHREAD],
6270 AC_MSG_CHECKING(if you want to link with the pthread library)
6271 AC_ARG_WITH(pthread,
6272 [ --with-pthread use POSIX thread library],
6273 [with_pthread=$withval],
6275 AC_MSG_RESULT($with_pthread)
6277 if test "$with_pthread" != no ; then
6278 AC_CHECK_HEADER(pthread.h,[
6279 AC_DEFINE(HAVE_PTHREADS_H,[],[Define if we have pthreads.h])
6281 AC_MSG_CHECKING(if we can link with the pthread library)
6282 cf_save_LIBS="$LIBS"
6285 #include <pthread.h>
6287 int rc = pthread_create(0,0,0,0);
6288 ],[with_pthread=yes],[with_pthread=no])
6289 LIBS="$cf_save_LIBS"
6290 AC_MSG_RESULT($with_pthread)
6292 if test "$with_pthread" = yes ; then
6294 AC_DEFINE(HAVE_LIBPTHREADS,[],[Define if we have libpthreads])
6296 AC_MSG_ERROR(Cannot link with pthread library)
6301 dnl ---------------------------------------------------------------------------
6302 dnl CF_WITH_REL_VERSION version: 1 updated: 2003/09/20 18:12:49
6303 dnl -------------------
6304 dnl Allow library's release-version to be overridden. Generally this happens when a
6305 dnl packager has incremented the release-version past that used in the original package,
6306 dnl and wishes to keep doing this.
6308 dnl $1 is the package name, if any, to derive corresponding {package}_MAJOR
6309 dnl and {package}_MINOR symbols
6311 AC_DEFUN([CF_WITH_REL_VERSION],[
6312 test -z "$cf_cv_rel_version" && cf_cv_rel_version=0.0
6313 AC_ARG_WITH(rel-version,
6314 [ --with-rel-version=XXX override derived release version],
6315 [AC_MSG_WARN(overriding release version $cf_cv_rel_version to $withval)
6316 cf_cv_rel_version=$withval])
6318 CF_NUMBER_SYNTAX($cf_cv_rel_version,Release version)
6320 $1_MAJOR=`echo "$cf_cv_rel_version" | sed -e 's/\..*//'`
6321 $1_MINOR=`echo "$cf_cv_rel_version" | sed -e 's/^[[^.]]*//' -e 's/^\.//' -e 's/\..*//'`
6322 CF_NUMBER_SYNTAX([$]$1_MAJOR,Release major-version)
6323 CF_NUMBER_SYNTAX([$]$1_MINOR,Release minor-version)
6326 dnl ---------------------------------------------------------------------------
6327 dnl CF_WITH_SYSMOUSE version: 2 updated: 2003/03/22 19:13:43
6328 dnl ----------------
6329 dnl If we can compile with sysmouse, make it available unless it is not wanted.
6330 AC_DEFUN([CF_WITH_SYSMOUSE],[
6331 # not everyone has "test -c"
6332 if test -c /dev/sysmouse 2>/dev/null ; then
6333 AC_MSG_CHECKING(if you want to use sysmouse)
6334 AC_ARG_WITH(sysmouse,
6335 [ --with-sysmouse use sysmouse (FreeBSD console)],
6336 [cf_with_sysmouse=$withval],
6337 [cf_with_sysmouse=maybe])
6338 if test "$cf_with_sysmouse" != no ; then
6340 #include <osreldate.h>
6341 #if (__FreeBSD_version >= 400017)
6342 #include <sys/consio.h>
6343 #include <sys/fbio.h>
6345 #include <machine/console.h>
6348 struct mouse_info the_mouse;
6349 ioctl(0, CONS_MOUSECTL, &the_mouse);
6350 ],[cf_with_sysmouse=yes],[cf_with_sysmouse=no])
6352 AC_MSG_RESULT($cf_with_sysmouse)
6353 test "$cf_with_sysmouse" = yes && AC_DEFINE(USE_SYSMOUSE,[],[USE_SYSMOUSE])
6356 dnl ---------------------------------------------------------------------------
6357 dnl CF_WITH_VALGRIND version: 1 updated: 2006/12/14 18:00:21
6358 dnl ----------------
6359 AC_DEFUN([CF_WITH_VALGRIND],[
6360 CF_NO_LEAKS_OPTION(valgrind,
6361 [ --with-valgrind test: use valgrind],
6364 dnl ---------------------------------------------------------------------------
6365 dnl CF_XOPEN_SOURCE version: 35 updated: 2011/02/20 20:37:37
6367 dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions,
6368 dnl or adapt to the vendor's definitions to get equivalent functionality,
6369 dnl without losing the common non-POSIX features.
6372 dnl $1 is the nominal value for _XOPEN_SOURCE
6373 dnl $2 is the nominal value for _POSIX_C_SOURCE
6374 AC_DEFUN([CF_XOPEN_SOURCE],[
6376 cf_XOPEN_SOURCE=ifelse([$1],,500,[$1])
6377 cf_POSIX_C_SOURCE=ifelse([$2],,199506L,[$2])
6380 case $host_os in #(vi
6382 cf_xopen_source="-D_ALL_SOURCE"
6387 darwin[[0-8]].*) #(vi
6388 cf_xopen_source="-D_APPLE_C_SOURCE"
6391 cf_xopen_source="-D_DARWIN_C_SOURCE"
6393 freebsd*|dragonfly*) #(vi
6394 # 5.x headers associate
6395 # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L
6396 # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L
6397 cf_POSIX_C_SOURCE=200112L
6399 cf_xopen_source="-D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
6402 cf_xopen_source="-D_HPUX_SOURCE -D_XOPEN_SOURCE=500"
6405 cf_xopen_source="-D_HPUX_SOURCE"
6408 cf_xopen_source="-D_SGI_SOURCE"
6410 linux*|gnu*|mint*|k*bsd*-gnu) #(vi
6414 # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <arpa/inet.h>
6417 # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw
6420 # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw
6423 cf_xopen_source="-D_OSF_SOURCE"
6426 cf_xopen_source="-D_QNX_SOURCE"
6429 # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer
6431 solaris2.1[[0-9]]) #(vi
6432 cf_xopen_source="-D__EXTENSIONS__ -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
6434 solaris2.[[1-9]]) #(vi
6435 cf_xopen_source="-D__EXTENSIONS__"
6438 AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[
6439 AC_TRY_COMPILE([#include <sys/types.h>],[
6440 #ifndef _XOPEN_SOURCE
6443 [cf_cv_xopen_source=no],
6444 [cf_save="$CPPFLAGS"
6445 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
6446 AC_TRY_COMPILE([#include <sys/types.h>],[
6447 #ifdef _XOPEN_SOURCE
6450 [cf_cv_xopen_source=no],
6451 [cf_cv_xopen_source=$cf_XOPEN_SOURCE])
6455 if test "$cf_cv_xopen_source" != no ; then
6456 CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE)
6457 CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE)
6458 cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source"
6459 CF_ADD_CFLAGS($cf_temp_xopen_source)
6461 CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE)
6465 if test -n "$cf_xopen_source" ; then
6466 CF_ADD_CFLAGS($cf_xopen_source)