1dnl*************************************************************************** 2dnl Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. * 3dnl * 4dnl Permission is hereby granted, free of charge, to any person obtaining a * 5dnl copy of this software and associated documentation files (the * 6dnl "Software"), to deal in the Software without restriction, including * 7dnl without limitation the rights to use, copy, modify, merge, publish, * 8dnl distribute, distribute with modifications, sublicense, and/or sell * 9dnl copies of the Software, and to permit persons to whom the Software is * 10dnl furnished to do so, subject to the following conditions: * 11dnl * 12dnl The above copyright notice and this permission notice shall be included * 13dnl in all copies or substantial portions of the Software. * 14dnl * 15dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * 16dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * 17dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * 18dnl IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * 19dnl DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * 20dnl OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * 21dnl THE USE OR OTHER DEALINGS IN THE SOFTWARE. * 22dnl * 23dnl Except as contained in this notice, the name(s) of the above copyright * 24dnl holders shall not be used in advertising or otherwise to promote the * 25dnl sale, use or other dealings in this Software without prior written * 26dnl authorization. * 27dnl*************************************************************************** 28dnl 29dnl Author: Thomas E. Dickey 1995-on 30dnl 31dnl $Id: aclocal.m4,v 1.407 2006/12/17 16:12:38 tom Exp $ 32dnl Macros used in NCURSES auto-configuration script. 33dnl 34dnl These macros are maintained separately from NCURSES. The copyright on 35dnl this file applies to the aggregation of macros and does not affect use of 36dnl these macros in other applications. 37dnl 38dnl See http://invisible-island.net/autoconf/ for additional information. 39dnl 40dnl --------------------------------------------------------------------------- 41dnl --------------------------------------------------------------------------- 42dnl AM_LANGINFO_CODESET version: 3 updated: 2002/10/27 23:21:42 43dnl ------------------- 44dnl Inserted as requested by gettext 0.10.40 45dnl File from /usr/share/aclocal 46dnl codeset.m4 47dnl ==================== 48dnl serial AM1 49dnl 50dnl From Bruno Haible. 51AC_DEFUN([AM_LANGINFO_CODESET], 52[ 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) 58 ]) 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).]) 62 fi 63])dnl 64dnl --------------------------------------------------------------------------- 65dnl CF_ADA_INCLUDE_DIRS version: 5 updated: 2006/10/14 15:23:15 66dnl ------------------- 67dnl Construct the list of include-options for the C programs in the Ada95 68dnl binding. 69AC_DEFUN([CF_ADA_INCLUDE_DIRS], 70[ 71ACPPFLAGS="-I. -I../../include $ACPPFLAGS" 72if test "$srcdir" != "."; then 73 ACPPFLAGS="-I\${srcdir}/../../include $ACPPFLAGS" 74fi 75if test "$GCC" != yes; then 76 ACPPFLAGS="$ACPPFLAGS -I\${includedir}" 77elif test "$includedir" != "/usr/include"; then 78 if test "$includedir" = '${prefix}/include' ; then 79 if test $prefix != /usr ; then 80 ACPPFLAGS="$ACPPFLAGS -I\${includedir}" 81 fi 82 else 83 ACPPFLAGS="$ACPPFLAGS -I\${includedir}" 84 fi 85fi 86AC_SUBST(ACPPFLAGS) 87])dnl 88dnl --------------------------------------------------------------------------- 89dnl CF_ADD_CFLAGS version: 7 updated: 2004/04/25 17:48:30 90dnl ------------- 91dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS 92dnl The second parameter if given makes this macro verbose. 93dnl 94dnl Put any preprocessor definitions that use quoted strings in $EXTRA_CPPFLAGS, 95dnl to simplify use of $CPPFLAGS in compiler checks, etc., that are easily 96dnl confused by the quotes (which require backslashes to keep them usable). 97AC_DEFUN([CF_ADD_CFLAGS], 98[ 99cf_fix_cppflags=no 100cf_new_cflags= 101cf_new_cppflags= 102cf_new_extra_cppflags= 103 104for cf_add_cflags in $1 105do 106case $cf_fix_cppflags in 107no) 108 case $cf_add_cflags in #(vi 109 -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi 110 case $cf_add_cflags in 111 -D*) 112 cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[[^=]]*='\''\"[[^"]]*//'` 113 114 test "${cf_add_cflags}" != "${cf_tst_cflags}" \ 115 && test -z "${cf_tst_cflags}" \ 116 && cf_fix_cppflags=yes 117 118 if test $cf_fix_cppflags = yes ; then 119 cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" 120 continue 121 elif test "${cf_tst_cflags}" = "\"'" ; then 122 cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" 123 continue 124 fi 125 ;; 126 esac 127 case "$CPPFLAGS" in 128 *$cf_add_cflags) #(vi 129 ;; 130 *) #(vi 131 cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" 132 ;; 133 esac 134 ;; 135 *) 136 cf_new_cflags="$cf_new_cflags $cf_add_cflags" 137 ;; 138 esac 139 ;; 140yes) 141 cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" 142 143 cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[[^"]]*"'\''//'` 144 145 test "${cf_add_cflags}" != "${cf_tst_cflags}" \ 146 && test -z "${cf_tst_cflags}" \ 147 && cf_fix_cppflags=no 148 ;; 149esac 150done 151 152if test -n "$cf_new_cflags" ; then 153 ifelse($2,,,[CF_VERBOSE(add to \$CFLAGS $cf_new_cflags)]) 154 CFLAGS="$CFLAGS $cf_new_cflags" 155fi 156 157if test -n "$cf_new_cppflags" ; then 158 ifelse($2,,,[CF_VERBOSE(add to \$CPPFLAGS $cf_new_cppflags)]) 159 CPPFLAGS="$cf_new_cppflags $CPPFLAGS" 160fi 161 162if test -n "$cf_new_extra_cppflags" ; then 163 ifelse($2,,,[CF_VERBOSE(add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags)]) 164 EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" 165fi 166 167AC_SUBST(EXTRA_CPPFLAGS) 168 169])dnl 170dnl --------------------------------------------------------------------------- 171dnl CF_ANSI_CC_CHECK version: 9 updated: 2001/12/30 17:53:34 172dnl ---------------- 173dnl This is adapted from the macros 'fp_PROG_CC_STDC' and 'fp_C_PROTOTYPES' 174dnl in the sharutils 4.2 distribution. 175AC_DEFUN([CF_ANSI_CC_CHECK], 176[ 177AC_CACHE_CHECK(for ${CC-cc} option to accept ANSI C, cf_cv_ansi_cc,[ 178cf_cv_ansi_cc=no 179cf_save_CFLAGS="$CFLAGS" 180cf_save_CPPFLAGS="$CPPFLAGS" 181# Don't try gcc -ansi; that turns off useful extensions and 182# breaks some systems' header files. 183# AIX -qlanglvl=ansi 184# Ultrix and OSF/1 -std1 185# HP-UX -Aa -D_HPUX_SOURCE 186# SVR4 -Xc 187# UnixWare 1.2 (cannot use -Xc, since ANSI/POSIX clashes) 188for cf_arg in "-DCC_HAS_PROTOS" \ 189 "" \ 190 -qlanglvl=ansi \ 191 -std1 \ 192 -Ae \ 193 "-Aa -D_HPUX_SOURCE" \ 194 -Xc 195do 196 CF_ADD_CFLAGS($cf_arg) 197 AC_TRY_COMPILE( 198[ 199#ifndef CC_HAS_PROTOS 200#if !defined(__STDC__) || (__STDC__ != 1) 201choke me 202#endif 203#endif 204],[ 205 int test (int i, double x); 206 struct s1 {int (*f) (int a);}; 207 struct s2 {int (*f) (double a);};], 208 [cf_cv_ansi_cc="$cf_arg"; break]) 209done 210CFLAGS="$cf_save_CFLAGS" 211CPPFLAGS="$cf_save_CPPFLAGS" 212]) 213 214if test "$cf_cv_ansi_cc" != "no"; then 215if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then 216 CF_ADD_CFLAGS($cf_cv_ansi_cc) 217else 218 AC_DEFINE(CC_HAS_PROTOS) 219fi 220fi 221])dnl 222dnl --------------------------------------------------------------------------- 223dnl CF_ANSI_CC_REQD version: 3 updated: 1997/09/06 13:40:44 224dnl --------------- 225dnl For programs that must use an ANSI compiler, obtain compiler options that 226dnl will make it recognize prototypes. We'll do preprocessor checks in other 227dnl macros, since tools such as unproto can fake prototypes, but only part of 228dnl the preprocessor. 229AC_DEFUN([CF_ANSI_CC_REQD], 230[AC_REQUIRE([CF_ANSI_CC_CHECK]) 231if test "$cf_cv_ansi_cc" = "no"; then 232 AC_ERROR( 233[Your compiler does not appear to recognize prototypes. 234You have the following choices: 235 a. adjust your compiler options 236 b. get an up-to-date compiler 237 c. use a wrapper such as unproto]) 238fi 239])dnl 240dnl --------------------------------------------------------------------------- 241dnl CF_BOOL_DECL version: 8 updated: 2004/01/30 15:51:18 242dnl ------------ 243dnl Test if 'bool' is a builtin type in the configured C++ compiler. Some 244dnl older compilers (e.g., gcc 2.5.8) don't support 'bool' directly; gcc 245dnl 2.6.3 does, in anticipation of the ANSI C++ standard. 246dnl 247dnl Treat the configuration-variable specially here, since we're directly 248dnl substituting its value (i.e., 1/0). 249dnl 250dnl $1 is the shell variable to store the result in, if not $cv_cv_builtin_bool 251AC_DEFUN([CF_BOOL_DECL], 252[ 253AC_MSG_CHECKING(if we should include stdbool.h) 254 255AC_CACHE_VAL(cf_cv_header_stdbool_h,[ 256 AC_TRY_COMPILE([],[bool foo = false], 257 [cf_cv_header_stdbool_h=0], 258 [AC_TRY_COMPILE([ 259#ifndef __BEOS__ 260#include <stdbool.h> 261#endif 262],[bool foo = false], 263 [cf_cv_header_stdbool_h=1], 264 [cf_cv_header_stdbool_h=0])])]) 265 266if test "$cf_cv_header_stdbool_h" = 1 267then AC_MSG_RESULT(yes) 268else AC_MSG_RESULT(no) 269fi 270 271AC_MSG_CHECKING([for builtin bool type]) 272 273AC_CACHE_VAL(ifelse($1,,cf_cv_builtin_bool,[$1]),[ 274 AC_TRY_COMPILE([ 275#include <stdio.h> 276#include <sys/types.h> 277],[bool x = false], 278 [ifelse($1,,cf_cv_builtin_bool,[$1])=1], 279 [ifelse($1,,cf_cv_builtin_bool,[$1])=0]) 280 ]) 281 282if test "$ifelse($1,,cf_cv_builtin_bool,[$1])" = 1 283then AC_MSG_RESULT(yes) 284else AC_MSG_RESULT(no) 285fi 286])dnl 287dnl --------------------------------------------------------------------------- 288dnl CF_BOOL_SIZE version: 12 updated: 2006/12/16 12:33:30 289dnl ------------ 290dnl Test for the size of 'bool' in the configured C++ compiler (e.g., a type). 291dnl Don't bother looking for bool.h, since it's been deprecated. 292dnl 293dnl If the current compiler is C rather than C++, we get the bool definition 294dnl from <stdbool.h>. 295AC_DEFUN([CF_BOOL_SIZE], 296[ 297AC_MSG_CHECKING([for size of bool]) 298AC_CACHE_VAL(cf_cv_type_of_bool,[ 299 rm -f cf_test.out 300 AC_TRY_RUN([ 301#include <stdlib.h> 302#include <stdio.h> 303 304#if defined(__cplusplus) 305 306#ifdef HAVE_GXX_BUILTIN_H 307#include <g++/builtin.h> 308#elif HAVE_GPP_BUILTIN_H 309#include <gpp/builtin.h> 310#elif HAVE_BUILTIN_H 311#include <builtin.h> 312#endif 313 314#else 315 316#if $cf_cv_header_stdbool_h 317#include <stdbool.h> 318#endif 319 320#endif 321 322main() 323{ 324 FILE *fp = fopen("cf_test.out", "w"); 325 if (fp != 0) { 326 bool x = true; 327 if ((bool)(-x) >= 0) 328 fputs("unsigned ", fp); 329 if (sizeof(x) == sizeof(int)) fputs("int", fp); 330 else if (sizeof(x) == sizeof(char)) fputs("char", fp); 331 else if (sizeof(x) == sizeof(short))fputs("short",fp); 332 else if (sizeof(x) == sizeof(long)) fputs("long", fp); 333 fclose(fp); 334 } 335 ${cf_cv_main_return:-return}(0); 336} 337 ], 338 [cf_cv_type_of_bool=`cat cf_test.out` 339 if test -z "$cf_cv_type_of_bool"; then 340 cf_cv_type_of_bool=unknown 341 fi], 342 [cf_cv_type_of_bool=unknown], 343 [cf_cv_type_of_bool=unknown]) 344 ]) 345 rm -f cf_test.out 346AC_MSG_RESULT($cf_cv_type_of_bool) 347if test "$cf_cv_type_of_bool" = unknown ; then 348 case .$NCURSES_BOOL in #(vi 349 .auto|.) NCURSES_BOOL=unsigned;; 350 esac 351 AC_MSG_WARN(Assuming $NCURSES_BOOL for type of bool) 352 cf_cv_type_of_bool=$NCURSES_BOOL 353fi 354])dnl 355dnl --------------------------------------------------------------------------- 356dnl CF_BUILD_CC version: 6 updated: 2006/10/14 15:23:15 357dnl ----------- 358dnl If we're cross-compiling, allow the user to override the tools and their 359dnl options. The configure script is oriented toward identifying the host 360dnl compiler, etc., but we need a build compiler to generate parts of the 361dnl source. 362dnl 363dnl $1 = default for $CPPFLAGS 364dnl $2 = default for $LIBS 365AC_DEFUN([CF_BUILD_CC],[ 366AC_REQUIRE([CF_PROG_EXT]) 367if test "$cross_compiling" = yes ; then 368 369 # defaults that we might want to override 370 : ${BUILD_CFLAGS:=''} 371 : ${BUILD_CPPFLAGS:='ifelse([$1],,,[$1])'} 372 : ${BUILD_LDFLAGS:=''} 373 : ${BUILD_LIBS:='ifelse([$2],,,[$2])'} 374 : ${BUILD_EXEEXT:='$x'} 375 : ${BUILD_OBJEXT:='o'} 376 377 AC_ARG_WITH(build-cc, 378 [ --with-build-cc=XXX the build C compiler ($BUILD_CC)], 379 [BUILD_CC="$withval"], 380 [AC_CHECK_PROGS(BUILD_CC, gcc cc cl)]) 381 AC_MSG_CHECKING(for native build C compiler) 382 AC_MSG_RESULT($BUILD_CC) 383 384 AC_MSG_CHECKING(for native build C preprocessor) 385 AC_ARG_WITH(build-cpp, 386 [ --with-build-cpp=XXX the build C preprocessor ($BUILD_CPP)], 387 [BUILD_CPP="$withval"], 388 [BUILD_CPP='${BUILD_CC} -E']) 389 AC_MSG_RESULT($BUILD_CPP) 390 391 AC_MSG_CHECKING(for native build C flags) 392 AC_ARG_WITH(build-cflags, 393 [ --with-build-cflags=XXX the build C compiler-flags ($BUILD_CFLAGS)], 394 [BUILD_CFLAGS="$withval"]) 395 AC_MSG_RESULT($BUILD_CFLAGS) 396 397 AC_MSG_CHECKING(for native build C preprocessor-flags) 398 AC_ARG_WITH(build-cppflags, 399 [ --with-build-cppflags=XXX the build C preprocessor-flags ($BUILD_CPPFLAGS)], 400 [BUILD_CPPFLAGS="$withval"]) 401 AC_MSG_RESULT($BUILD_CPPFLAGS) 402 403 AC_MSG_CHECKING(for native build linker-flags) 404 AC_ARG_WITH(build-ldflags, 405 [ --with-build-ldflags=XXX the build linker-flags ($BUILD_LDFLAGS)], 406 [BUILD_LDFLAGS="$withval"]) 407 AC_MSG_RESULT($BUILD_LDFLAGS) 408 409 AC_MSG_CHECKING(for native build linker-libraries) 410 AC_ARG_WITH(build-libs, 411 [ --with-build-libs=XXX the build libraries (${BUILD_LIBS})], 412 [BUILD_LIBS="$withval"]) 413 AC_MSG_RESULT($BUILD_LIBS) 414 415 # this assumes we're on Unix. 416 BUILD_EXEEXT= 417 BUILD_OBJEXT=o 418 419 : ${BUILD_CC:='${CC}'} 420 421 if ( test "$BUILD_CC" = "$CC" || test "$BUILD_CC" = '${CC}' ) ; then 422 AC_MSG_ERROR([Cross-build requires two compilers. 423Use --with-build-cc to specify the native compiler.]) 424 fi 425 426else 427 : ${BUILD_CC:='${CC}'} 428 : ${BUILD_CPP:='${CPP}'} 429 : ${BUILD_CFLAGS:='${CFLAGS}'} 430 : ${BUILD_CPPFLAGS:='${CPPFLAGS}'} 431 : ${BUILD_LDFLAGS:='${LDFLAGS}'} 432 : ${BUILD_LIBS:='${LIBS}'} 433 : ${BUILD_EXEEXT:='$x'} 434 : ${BUILD_OBJEXT:='o'} 435fi 436 437AC_SUBST(BUILD_CC) 438AC_SUBST(BUILD_CPP) 439AC_SUBST(BUILD_CFLAGS) 440AC_SUBST(BUILD_CPPFLAGS) 441AC_SUBST(BUILD_LDFLAGS) 442AC_SUBST(BUILD_LIBS) 443AC_SUBST(BUILD_EXEEXT) 444AC_SUBST(BUILD_OBJEXT) 445])dnl 446dnl --------------------------------------------------------------------------- 447dnl CF_CFG_DEFAULTS version: 7 updated: 2005/09/24 16:15:00 448dnl --------------- 449dnl Determine the default configuration into which we'll install ncurses. This 450dnl can be overridden by the user's command-line options. There's two items to 451dnl look for: 452dnl 1. the prefix (e.g., /usr) 453dnl 2. the header files (e.g., /usr/include/ncurses) 454dnl We'll look for a previous installation of ncurses and use the same defaults. 455dnl 456dnl We don't use AC_PREFIX_DEFAULT, because it gets evaluated too soon, and 457dnl we don't use AC_PREFIX_PROGRAM, because we cannot distinguish ncurses's 458dnl programs from a vendor's. 459AC_DEFUN([CF_CFG_DEFAULTS], 460[ 461AC_MSG_CHECKING(for prefix) 462if test "x$prefix" = "xNONE" ; then 463 case "$cf_cv_system_name" in 464 # non-vendor systems don't have a conflict 465 openbsd*|freebsd*|linux*|cygwin*|k*bsd*-gnu) 466 prefix=/usr 467 ;; 468 *) prefix=$ac_default_prefix 469 ;; 470 esac 471fi 472AC_MSG_RESULT($prefix) 473 474if test "x$prefix" = "xNONE" ; then 475AC_MSG_CHECKING(for default include-directory) 476test -n "$verbose" && echo 1>&AC_FD_MSG 477for cf_symbol in \ 478 $includedir \ 479 $includedir/ncurses \ 480 $prefix/include \ 481 $prefix/include/ncurses \ 482 /usr/local/include \ 483 /usr/local/include/ncurses \ 484 /usr/include \ 485 /usr/include/ncurses 486do 487 cf_dir=`eval echo $cf_symbol` 488 if test -f $cf_dir/curses.h ; then 489 if ( fgrep NCURSES_VERSION $cf_dir/curses.h 2>&1 >/dev/null ) ; then 490 includedir="$cf_symbol" 491 test -n "$verbose" && echo $ac_n " found " 1>&AC_FD_MSG 492 break 493 fi 494 fi 495 test -n "$verbose" && echo " tested $cf_dir" 1>&AC_FD_MSG 496done 497AC_MSG_RESULT($includedir) 498fi 499])dnl 500dnl --------------------------------------------------------------------------- 501dnl CF_CGETENT version: 3 updated: 2000/08/12 23:18:52 502dnl ---------- 503dnl Check if the terminal-capability database functions are available. If not, 504dnl ncurses has a much-reduced version. 505AC_DEFUN([CF_CGETENT],[ 506AC_MSG_CHECKING(for terminal-capability database functions) 507AC_CACHE_VAL(cf_cv_cgetent,[ 508AC_TRY_LINK([ 509#include <stdlib.h>],[ 510 char temp[128]; 511 char *buf = temp; 512 char *db_array = temp; 513 cgetent(&buf, /* int *, */ &db_array, "vt100"); 514 cgetcap(buf, "tc", '='); 515 cgetmatch(buf, "tc"); 516 ], 517 [cf_cv_cgetent=yes], 518 [cf_cv_cgetent=no]) 519]) 520AC_MSG_RESULT($cf_cv_cgetent) 521test "$cf_cv_cgetent" = yes && AC_DEFINE(HAVE_BSD_CGETENT) 522])dnl 523dnl --------------------------------------------------------------------------- 524dnl CF_CHECK_CACHE version: 10 updated: 2004/05/23 13:03:31 525dnl -------------- 526dnl Check if we're accidentally using a cache from a different machine. 527dnl Derive the system name, as a check for reusing the autoconf cache. 528dnl 529dnl If we've packaged config.guess and config.sub, run that (since it does a 530dnl better job than uname). Normally we'll use AC_CANONICAL_HOST, but allow 531dnl an extra parameter that we may override, e.g., for AC_CANONICAL_SYSTEM 532dnl which is useful in cross-compiles. 533dnl 534dnl Note: we would use $ac_config_sub, but that is one of the places where 535dnl autoconf 2.5x broke compatibility with autoconf 2.13 536AC_DEFUN([CF_CHECK_CACHE], 537[ 538if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then 539 ifelse([$1],,[AC_CANONICAL_HOST],[$1]) 540 system_name="$host_os" 541else 542 system_name="`(uname -s -r) 2>/dev/null`" 543 if test -z "$system_name" ; then 544 system_name="`(hostname) 2>/dev/null`" 545 fi 546fi 547test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name") 548AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"]) 549 550test -z "$system_name" && system_name="$cf_cv_system_name" 551test -n "$cf_cv_system_name" && AC_MSG_RESULT(Configuring for $cf_cv_system_name) 552 553if test ".$system_name" != ".$cf_cv_system_name" ; then 554 AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)) 555 AC_ERROR("Please remove config.cache and try again.") 556fi 557])dnl 558dnl --------------------------------------------------------------------------- 559dnl CF_CHECK_ERRNO version: 9 updated: 2001/12/30 18:03:23 560dnl -------------- 561dnl Check for data that is usually declared in <stdio.h> or <errno.h>, e.g., 562dnl the 'errno' variable. Define a DECL_xxx symbol if we must declare it 563dnl ourselves. 564dnl 565dnl $1 = the name to check 566AC_DEFUN([CF_CHECK_ERRNO], 567[ 568AC_CACHE_CHECK(if external $1 is declared, cf_cv_dcl_$1,[ 569 AC_TRY_COMPILE([ 570#ifdef HAVE_STDLIB_H 571#include <stdlib.h> 572#endif 573#include <stdio.h> 574#include <sys/types.h> 575#include <errno.h> ], 576 [long x = (long) $1], 577 [cf_cv_dcl_$1=yes], 578 [cf_cv_dcl_$1=no]) 579]) 580 581if test "$cf_cv_dcl_$1" = no ; then 582 CF_UPPER(cf_result,decl_$1) 583 AC_DEFINE_UNQUOTED($cf_result) 584fi 585 586# It's possible (for near-UNIX clones) that the data doesn't exist 587CF_CHECK_EXTERN_DATA($1,int) 588])dnl 589dnl --------------------------------------------------------------------------- 590dnl CF_CHECK_EXTERN_DATA version: 3 updated: 2001/12/30 18:03:23 591dnl -------------------- 592dnl Check for existence of external data in the current set of libraries. If 593dnl we can modify it, it's real enough. 594dnl $1 = the name to check 595dnl $2 = its type 596AC_DEFUN([CF_CHECK_EXTERN_DATA], 597[ 598AC_CACHE_CHECK(if external $1 exists, cf_cv_have_$1,[ 599 AC_TRY_LINK([ 600#undef $1 601extern $2 $1; 602], 603 [$1 = 2], 604 [cf_cv_have_$1=yes], 605 [cf_cv_have_$1=no]) 606]) 607 608if test "$cf_cv_have_$1" = yes ; then 609 CF_UPPER(cf_result,have_$1) 610 AC_DEFINE_UNQUOTED($cf_result) 611fi 612 613])dnl 614dnl --------------------------------------------------------------------------- 615dnl CF_CPP_PARAM_INIT version: 4 updated: 2001/04/07 22:31:18 616dnl ----------------- 617dnl Check if the C++ compiler accepts duplicate parameter initialization. This 618dnl is a late feature for the standard and is not in some recent compilers 619dnl (1999/9/11). 620AC_DEFUN([CF_CPP_PARAM_INIT], 621[ 622if test -n "$CXX"; then 623AC_CACHE_CHECK(if $CXX accepts parameter initialization,cf_cv_cpp_param_init,[ 624 AC_LANG_SAVE 625 AC_LANG_CPLUSPLUS 626 AC_TRY_RUN([ 627class TEST { 628private: 629 int value; 630public: 631 TEST(int x = 1); 632 ~TEST(); 633}; 634 635TEST::TEST(int x = 1) // some compilers do not like second initializer 636{ 637 value = x; 638} 639void main() { } 640], 641 [cf_cv_cpp_param_init=yes], 642 [cf_cv_cpp_param_init=no], 643 [cf_cv_cpp_param_init=unknown]) 644 AC_LANG_RESTORE 645]) 646fi 647test "$cf_cv_cpp_param_init" = yes && AC_DEFINE(CPP_HAS_PARAM_INIT) 648])dnl 649dnl --------------------------------------------------------------------------- 650dnl CF_CPP_STATIC_CAST version: 1 updated: 2005/07/23 16:52:43 651dnl ------------------ 652dnl Check if the C++ compiler accepts static_cast in generics. This appears to 653dnl not be supported in g++ before 3.0 654AC_DEFUN([CF_CPP_STATIC_CAST], 655[ 656if test -n "$CXX"; then 657 658AC_CACHE_CHECK(if $CXX accepts static_cast,cf_cv_cpp_static_cast,[ 659 AC_LANG_SAVE 660 AC_LANG_CPLUSPLUS 661 662 AC_TRY_COMPILE([ 663class NCursesPanel 664{ 665public: 666 NCursesPanel(int nlines, 667 int ncols, 668 int begin_y = 0, 669 int begin_x = 0) 670 { 671 } 672 673 ~NCursesPanel(); 674}; 675 676template<class T> class NCursesUserPanel : public NCursesPanel 677{ 678public: 679 NCursesUserPanel (int nlines, 680 int ncols, 681 int begin_y = 0, 682 int begin_x = 0, 683 const T* p_UserData = static_cast<T*>(0)) 684 : NCursesPanel (nlines, ncols, begin_y, begin_x) 685 { 686 }; 687 NCursesUserPanel(const T* p_UserData = static_cast<T*>(0)) : NCursesPanel() 688 { 689 }; 690 691 virtual ~NCursesUserPanel() {}; 692}; 693],[ 694 const char* p_UserData = static_cast<char*>(0)], 695 [cf_cv_cpp_static_cast=yes], 696 [cf_cv_cpp_static_cast=no]) 697 698 AC_LANG_RESTORE 699]) 700 701fi 702 703test "$cf_cv_cpp_static_cast" = yes && AC_DEFINE(CPP_HAS_STATIC_CAST) 704])dnl 705dnl --------------------------------------------------------------------------- 706dnl CF_CPP_VSCAN_FUNC version: 5 updated: 2001/12/02 01:39:28 707dnl ----------------- 708dnl Check if the g++ compiler supports vscan function (not a standard feature). 709AC_DEFUN([CF_CPP_VSCAN_FUNC], 710[ 711if test -n "$CXX"; then 712 713AC_LANG_SAVE 714AC_LANG_CPLUSPLUS 715AC_CHECK_HEADERS(strstream.h) 716 717AC_CACHE_CHECK(if $CXX supports vscan function,cf_cv_cpp_vscan_func,[ 718 for cf_vscan_func in strstream strstream_cast stdio 719 do 720 case $cf_vscan_func in #(vi 721 stdio) cf_vscan_defs=USE_STDIO_VSCAN ;; #(vi 722 strstream) cf_vscan_defs=USE_STRSTREAM_VSCAN ;; 723 strstream_cast) cf_vscan_defs=USE_STRSTREAM_VSCAN_CAST ;; 724 esac 725 AC_TRY_LINK([ 726#include <stdio.h> 727#include <stdarg.h> 728#define $cf_vscan_defs 1 729#if defined(USE_STDIO_VSCAN) 730#elif defined(HAVE_STRSTREAM_H) && defined(USE_STRSTREAM_VSCAN) 731#include <strstream.h> 732#endif 733 734int scanw(const char* fmt, ...) 735{ 736 int result = -1; 737 char buf[BUFSIZ]; 738 739 va_list args; 740 va_start(args, fmt); 741#if defined(USE_STDIO_VSCAN) 742 if (::vsscanf(buf, fmt, args) != -1) 743 result = 0; 744#elif defined(USE_STRSTREAM_VSCAN) 745 strstreambuf ss(buf, sizeof(buf)); 746 if (ss.vscan(fmt, args) != -1) 747 result = 0; 748#elif defined(USE_STRSTREAM_VSCAN_CAST) 749 strstreambuf ss(buf, sizeof(buf)); 750 if (ss.vscan(fmt, (_IO_va_list)args) != -1) 751 result = 0; 752#else 753#error case $cf_vscan_func failed 754#endif 755 va_end(args); 756 return result; 757} 758],[int tmp, foo = scanw("%d", &tmp)], 759 [cf_cv_cpp_vscan_func=$cf_vscan_func; break], 760 [cf_cv_cpp_vscan_func=no]) 761 test "$cf_cv_cpp_vscan_func" != no && break 762 done 763]) 764 765AC_LANG_RESTORE 766fi 767 768case $cf_cv_cpp_vscan_func in #(vi 769stdio) #(vi 770 AC_DEFINE(CPP_HAS_VSCAN_FUNC) 771 AC_DEFINE(USE_STDIO_VSCAN) 772 ;; 773strstream) 774 AC_DEFINE(CPP_HAS_VSCAN_FUNC) 775 AC_DEFINE(USE_STRSTREAM_VSCAN) 776 ;; 777strstream_cast) 778 AC_DEFINE(CPP_HAS_VSCAN_FUNC) 779 AC_DEFINE(USE_STRSTREAM_VSCAN_CAST) 780 ;; 781esac 782])dnl 783dnl --------------------------------------------------------------------------- 784dnl CF_DIRNAME version: 4 updated: 2002/12/21 19:25:52 785dnl ---------- 786dnl "dirname" is not portable, so we fake it with a shell script. 787AC_DEFUN([CF_DIRNAME],[$1=`echo $2 | sed -e 's%/[[^/]]*$%%'`])dnl 788dnl --------------------------------------------------------------------------- 789dnl CF_DIRS_TO_MAKE version: 3 updated: 2002/02/23 20:38:31 790dnl --------------- 791AC_DEFUN([CF_DIRS_TO_MAKE], 792[ 793DIRS_TO_MAKE="lib" 794for cf_item in $cf_list_models 795do 796 CF_OBJ_SUBDIR($cf_item,cf_subdir) 797 for cf_item2 in $DIRS_TO_MAKE 798 do 799 test $cf_item2 = $cf_subdir && break 800 done 801 test ".$cf_item2" != ".$cf_subdir" && DIRS_TO_MAKE="$DIRS_TO_MAKE $cf_subdir" 802done 803for cf_dir in $DIRS_TO_MAKE 804do 805 test ! -d $cf_dir && mkdir $cf_dir 806done 807AC_SUBST(DIRS_TO_MAKE) 808])dnl 809dnl --------------------------------------------------------------------------- 810dnl CF_DISABLE_LEAKS version: 4 updated: 2006/12/16 15:10:42 811dnl ---------------- 812dnl Combine no-leak checks with the libraries or tools that are used for the 813dnl checks. 814AC_DEFUN([CF_DISABLE_LEAKS],[ 815 816AC_REQUIRE([CF_WITH_DMALLOC]) 817AC_REQUIRE([CF_WITH_DBMALLOC]) 818AC_REQUIRE([CF_WITH_VALGRIND]) 819 820AC_MSG_CHECKING(if you want to perform memory-leak testing) 821AC_ARG_ENABLE(leaks, 822 [ --disable-leaks test: free permanent memory, analyze leaks], 823 [with_no_leaks=yes], 824 : ${with_no_leaks:=no}) 825AC_MSG_RESULT($with_no_leaks) 826 827if test "$with_no_leaks" = yes ; then 828 AC_DEFINE(NO_LEAKS) 829fi 830])dnl 831dnl --------------------------------------------------------------------------- 832dnl CF_ERRNO version: 5 updated: 1997/11/30 12:44:39 833dnl -------- 834dnl Check if 'errno' is declared in <errno.h> 835AC_DEFUN([CF_ERRNO], 836[ 837CF_CHECK_ERRNO(errno) 838])dnl 839dnl --------------------------------------------------------------------------- 840dnl CF_ETIP_DEFINES version: 3 updated: 2003/03/22 19:13:43 841dnl --------------- 842dnl Test for conflicting definitions of exception in gcc 2.8.0, etc., between 843dnl math.h and builtin.h, only for ncurses 844AC_DEFUN([CF_ETIP_DEFINES], 845[ 846AC_MSG_CHECKING(for special defines needed for etip.h) 847cf_save_CXXFLAGS="$CXXFLAGS" 848cf_result="none" 849for cf_math in "" MATH_H 850do 851for cf_excp in "" MATH_EXCEPTION 852do 853 CXXFLAGS="$cf_save_CXXFLAGS -I${srcdir}/c++ -I${srcdir}/menu -I${srcdir}/include" 854 test -n "$cf_math" && CXXFLAGS="$CXXFLAGS -DETIP_NEEDS_${cf_math}" 855 test -n "$cf_excp" && CXXFLAGS="$CXXFLAGS -DETIP_NEEDS_${cf_excp}" 856AC_TRY_COMPILE([ 857#include <etip.h.in> 858],[],[ 859 test -n "$cf_math" && AC_DEFINE_UNQUOTED(ETIP_NEEDS_${cf_math}) 860 test -n "$cf_excp" && AC_DEFINE_UNQUOTED(ETIP_NEEDS_${cf_excp}) 861 cf_result="$cf_math $cf_excp" 862 break 863],[]) 864done 865done 866AC_MSG_RESULT($cf_result) 867CXXFLAGS="$cf_save_CXXFLAGS" 868]) 869dnl --------------------------------------------------------------------------- 870dnl CF_FUNC_DLSYM version: 1 updated: 2004/06/16 20:52:45 871dnl ------------- 872dnl Test for dlsym() and related functions, as well as libdl. 873dnl 874dnl Sets 875dnl $cf_have_dlsym 876dnl $cf_have_libdl 877AC_DEFUN([CF_FUNC_DLSYM],[ 878cf_have_dlsym=no 879AC_CHECK_FUNC(dlsym,cf_have_dlsym=yes,[ 880 881cf_have_libdl=no 882AC_CHECK_LIB(dl,dlsym,[ 883 cf_have_dlsym=yes 884 cf_have_libdl=yes])]) 885 886if test "$cf_have_dlsym" = yes ; then 887 test "$cf_have_libdl" = yes && LIBS="-ldl $LIBS" 888 889 AC_MSG_CHECKING(whether able to link to dl*() functions) 890 AC_TRY_LINK([#include <dlfcn.h>],[ 891 void *obj; 892 if ((obj = dlopen("filename", 0)) != 0) { 893 if (dlsym(obj, "symbolname") == 0) { 894 dlclose(obj); 895 } 896 }],[ 897 AC_DEFINE(HAVE_LIBDL)],[ 898 AC_MSG_ERROR(Cannot link test program for libdl)]) 899 AC_MSG_RESULT(ok) 900else 901 AC_MSG_ERROR(Cannot find dlsym function) 902fi 903]) 904dnl --------------------------------------------------------------------------- 905dnl CF_FUNC_MEMMOVE version: 7 updated: 2006/12/16 12:33:30 906dnl --------------- 907dnl Check for memmove, or a bcopy that can handle overlapping copy. If neither 908dnl is found, add our own version of memmove to the list of objects. 909AC_DEFUN([CF_FUNC_MEMMOVE], 910[ 911AC_CHECK_FUNC(memmove,,[ 912AC_CHECK_FUNC(bcopy,[ 913 AC_CACHE_CHECK(if bcopy does overlapping moves,cf_cv_good_bcopy,[ 914 AC_TRY_RUN([ 915int main() { 916 static char data[] = "abcdefghijklmnopqrstuwwxyz"; 917 char temp[40]; 918 bcopy(data, temp, sizeof(data)); 919 bcopy(temp+10, temp, 15); 920 bcopy(temp+5, temp+15, 10); 921 ${cf_cv_main_return:-return} (strcmp(temp, "klmnopqrstuwwxypqrstuwwxyz")); 922} 923 ], 924 [cf_cv_good_bcopy=yes], 925 [cf_cv_good_bcopy=no], 926 [cf_cv_good_bcopy=unknown]) 927 ]) 928 ],[cf_cv_good_bcopy=no]) 929 if test "$cf_cv_good_bcopy" = yes ; then 930 AC_DEFINE(USE_OK_BCOPY) 931 else 932 AC_DEFINE(USE_MY_MEMMOVE) 933 fi 934])])dnl 935dnl --------------------------------------------------------------------------- 936dnl CF_FUNC_NANOSLEEP version: 3 updated: 2006/12/16 12:33:30 937dnl ----------------- 938dnl Check for existence of workable nanosleep() function. Some systems, e.g., 939dnl AIX 4.x, provide a non-working version. 940AC_DEFUN([CF_FUNC_NANOSLEEP],[ 941AC_CACHE_CHECK(if nanosleep really works,cf_cv_func_nanosleep,[ 942AC_TRY_RUN([ 943#include <stdio.h> 944#include <errno.h> 945#include <time.h> 946 947#ifdef HAVE_SYS_TIME_H 948#include <sys/time.h> 949#endif 950 951int main() { 952 struct timespec ts1, ts2; 953 int code; 954 ts1.tv_sec = 0; 955 ts1.tv_nsec = 750000000; 956 ts2.tv_sec = 0; 957 ts2.tv_nsec = 0; 958 errno = 0; 959 code = nanosleep(&ts1, &ts2); /* on failure errno is ENOSYS. */ 960 ${cf_cv_main_return:-return}(code != 0); 961} 962], 963 [cf_cv_func_nanosleep=yes], 964 [cf_cv_func_nanosleep=no], 965 [cf_cv_func_nanosleep=unknown])]) 966 967test "$cf_cv_func_nanosleep" = "yes" && AC_DEFINE(HAVE_NANOSLEEP) 968]) 969dnl --------------------------------------------------------------------------- 970dnl CF_FUNC_POLL version: 4 updated: 2006/12/16 12:33:30 971dnl ------------ 972dnl See if the poll function really works. Some platforms have poll(), but 973dnl it does not work for terminals or files. 974AC_DEFUN([CF_FUNC_POLL],[ 975AC_CACHE_CHECK(if poll really works,cf_cv_working_poll,[ 976AC_TRY_RUN([ 977#include <stdio.h> 978#ifdef HAVE_POLL_H 979#include <poll.h> 980#else 981#include <sys/poll.h> 982#endif 983int main() { 984 struct pollfd myfds; 985 int ret; 986 987 myfds.fd = 0; 988 myfds.events = POLLIN; 989 990 ret = poll(&myfds, 1, 100); 991 ${cf_cv_main_return:-return}(ret != 0); 992}], 993 [cf_cv_working_poll=yes], 994 [cf_cv_working_poll=no], 995 [cf_cv_working_poll=unknown])]) 996test "$cf_cv_working_poll" = "yes" && AC_DEFINE(HAVE_WORKING_POLL) 997])dnl 998dnl --------------------------------------------------------------------------- 999dnl CF_FUNC_TERMIOS version: 2 updated: 2000/07/22 23:37:24 1000dnl --------------- 1001dnl Some old/broken variations define tcgetattr() only as a macro in 1002dnl termio(s).h 1003AC_DEFUN([CF_FUNC_TERMIOS],[ 1004AC_REQUIRE([CF_STRUCT_TERMIOS]) 1005AC_CACHE_CHECK(for tcgetattr, cf_cv_have_tcgetattr,[ 1006AC_TRY_LINK([ 1007#include <sys/types.h> 1008#ifdef HAVE_UNISTD_H 1009#include <unistd.h> 1010#endif 1011#ifdef HAVE_TERMIOS_H 1012#include <termios.h> 1013#define TTY struct termios 1014#else 1015#ifdef HAVE_TERMIO_H 1016#include <termio.h> 1017#define TTY struct termio 1018#endif 1019#endif 1020],[ 1021TTY foo; 1022tcgetattr(1, &foo);], 1023[cf_cv_have_tcgetattr=yes], 1024[cf_cv_have_tcgetattr=no])]) 1025test "$cf_cv_have_tcgetattr" = yes && AC_DEFINE(HAVE_TCGETATTR) 1026])dnl 1027dnl --------------------------------------------------------------------------- 1028dnl CF_FUNC_VSSCANF version: 3 updated: 2001/12/19 00:50:10 1029dnl --------------- 1030dnl Check for vsscanf() function, which is in c9x but generally not in earlier 1031dnl versions of C. It is in the GNU C library, and can often be simulated by 1032dnl other functions. 1033AC_DEFUN([CF_FUNC_VSSCANF], 1034[ 1035AC_CACHE_CHECK(for vsscanf function or workaround,cf_cv_func_vsscanf,[ 1036AC_TRY_LINK([ 1037#include <stdarg.h> 1038#include <stdio.h>],[ 1039 va_list ap; 1040 vsscanf("from", "%d", ap)],[cf_cv_func_vsscanf=vsscanf],[ 1041AC_TRY_LINK([ 1042#include <stdarg.h> 1043#include <stdio.h>],[ 1044 FILE strbuf; 1045 char *str = "from"; 1046 1047 strbuf._flag = _IOREAD; 1048 strbuf._ptr = strbuf._base = (unsigned char *) str; 1049 strbuf._cnt = strlen(str); 1050 strbuf._file = _NFILE; 1051 return (vfscanf(&strbuf, "%d", ap))],[cf_cv_func_vsscanf=vfscanf],[ 1052AC_TRY_LINK([ 1053#include <stdarg.h> 1054#include <stdio.h>],[ 1055 FILE strbuf; 1056 char *str = "from"; 1057 1058 strbuf._flag = _IOREAD; 1059 strbuf._ptr = strbuf._base = (unsigned char *) str; 1060 strbuf._cnt = strlen(str); 1061 strbuf._file = _NFILE; 1062 return (_doscan(&strbuf, "%d", ap))],[cf_cv_func_vsscanf=_doscan],[ 1063cf_cv_func_vsscanf=no])])])]) 1064 1065case $cf_cv_func_vsscanf in #(vi 1066vsscanf) AC_DEFINE(HAVE_VSSCANF);; #(vi 1067vfscanf) AC_DEFINE(HAVE_VFSCANF);; #(vi 1068_doscan) AC_DEFINE(HAVE__DOSCAN);; 1069esac 1070 1071])dnl 1072dnl --------------------------------------------------------------------------- 1073dnl CF_GCC_ATTRIBUTES version: 10 updated: 2005/05/28 13:16:28 1074dnl ----------------- 1075dnl Test for availability of useful gcc __attribute__ directives to quiet 1076dnl compiler warnings. Though useful, not all are supported -- and contrary 1077dnl to documentation, unrecognized directives cause older compilers to barf. 1078AC_DEFUN([CF_GCC_ATTRIBUTES], 1079[ 1080if test "$GCC" = yes 1081then 1082cat > conftest.i <<EOF 1083#ifndef GCC_PRINTF 1084#define GCC_PRINTF 0 1085#endif 1086#ifndef GCC_SCANF 1087#define GCC_SCANF 0 1088#endif 1089#ifndef GCC_NORETURN 1090#define GCC_NORETURN /* nothing */ 1091#endif 1092#ifndef GCC_UNUSED 1093#define GCC_UNUSED /* nothing */ 1094#endif 1095EOF 1096if test "$GCC" = yes 1097then 1098 AC_CHECKING([for $CC __attribute__ directives]) 1099cat > conftest.$ac_ext <<EOF 1100#line __oline__ "configure" 1101#include "confdefs.h" 1102#include "conftest.h" 1103#include "conftest.i" 1104#if GCC_PRINTF 1105#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var))) 1106#else 1107#define GCC_PRINTFLIKE(fmt,var) /*nothing*/ 1108#endif 1109#if GCC_SCANF 1110#define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var))) 1111#else 1112#define GCC_SCANFLIKE(fmt,var) /*nothing*/ 1113#endif 1114extern void wow(char *,...) GCC_SCANFLIKE(1,2); 1115extern void oops(char *,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN; 1116extern void foo(void) GCC_NORETURN; 1117int main(int argc GCC_UNUSED, char *argv[[]] GCC_UNUSED) { return 0; } 1118EOF 1119 for cf_attribute in scanf printf unused noreturn 1120 do 1121 CF_UPPER(cf_ATTRIBUTE,$cf_attribute) 1122 cf_directive="__attribute__(($cf_attribute))" 1123 echo "checking for $CC $cf_directive" 1>&AC_FD_CC 1124 case $cf_attribute in 1125 scanf|printf) 1126 cat >conftest.h <<EOF 1127#define GCC_$cf_ATTRIBUTE 1 1128EOF 1129 ;; 1130 *) 1131 cat >conftest.h <<EOF 1132#define GCC_$cf_ATTRIBUTE $cf_directive 1133EOF 1134 ;; 1135 esac 1136 if AC_TRY_EVAL(ac_compile); then 1137 test -n "$verbose" && AC_MSG_RESULT(... $cf_attribute) 1138 cat conftest.h >>confdefs.h 1139 fi 1140 done 1141else 1142 fgrep define conftest.i >>confdefs.h 1143fi 1144rm -rf conftest* 1145fi 1146])dnl 1147dnl --------------------------------------------------------------------------- 1148dnl CF_GCC_VERSION version: 4 updated: 2005/08/27 09:53:42 1149dnl -------------- 1150dnl Find version of gcc 1151AC_DEFUN([CF_GCC_VERSION],[ 1152AC_REQUIRE([AC_PROG_CC]) 1153GCC_VERSION=none 1154if test "$GCC" = yes ; then 1155 AC_MSG_CHECKING(version of $CC) 1156 GCC_VERSION="`${CC} --version| sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`" 1157 test -z "$GCC_VERSION" && GCC_VERSION=unknown 1158 AC_MSG_RESULT($GCC_VERSION) 1159fi 1160])dnl 1161dnl --------------------------------------------------------------------------- 1162dnl CF_GCC_WARNINGS version: 20 updated: 2005/08/06 18:37:29 1163dnl --------------- 1164dnl Check if the compiler supports useful warning options. There's a few that 1165dnl we don't use, simply because they're too noisy: 1166dnl 1167dnl -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x) 1168dnl -Wredundant-decls (system headers make this too noisy) 1169dnl -Wtraditional (combines too many unrelated messages, only a few useful) 1170dnl -Wwrite-strings (too noisy, but should review occasionally). This 1171dnl is enabled for ncurses using "--enable-const". 1172dnl -pedantic 1173dnl 1174dnl Parameter: 1175dnl $1 is an optional list of gcc warning flags that a particular 1176dnl application might want to use, e.g., "no-unused" for 1177dnl -Wno-unused 1178dnl Special: 1179dnl If $with_ext_const is "yes", add a check for -Wwrite-strings 1180dnl 1181AC_DEFUN([CF_GCC_WARNINGS], 1182[ 1183AC_REQUIRE([CF_GCC_VERSION]) 1184CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS) 1185 1186cat > conftest.$ac_ext <<EOF 1187#line __oline__ "configure" 1188int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; } 1189EOF 1190 1191if test "$INTEL_COMPILER" = yes 1192then 1193# The "-wdXXX" options suppress warnings: 1194# remark #1419: external declaration in primary source file 1195# remark #1682: implicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem) 1196# remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem) 1197# remark #1684: conversion from pointer to same-sized integral type (potential portability problem) 1198# remark #193: zero used for undefined preprocessing identifier 1199# remark #593: variable "curs_sb_left_arrow" was set but never used 1200# remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits 1201# remark #869: parameter "tw" was never referenced 1202# remark #981: operands are evaluated in unspecified order 1203# warning #269: invalid format string conversion 1204 1205 AC_CHECKING([for $CC warning options]) 1206 cf_save_CFLAGS="$CFLAGS" 1207 EXTRA_CFLAGS="-Wall" 1208 for cf_opt in $1 \ 1209 wd1419 \ 1210 wd1682 \ 1211 wd1683 \ 1212 wd1684 \ 1213 wd193 \ 1214 wd279 \ 1215 wd593 \ 1216 wd810 \ 1217 wd869 \ 1218 wd981 1219 do 1220 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" 1221 if AC_TRY_EVAL(ac_compile); then 1222 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt) 1223 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" 1224 fi 1225 done 1226 CFLAGS="$cf_save_CFLAGS" 1227 1228elif test "$GCC" = yes 1229then 1230 AC_CHECKING([for $CC warning options]) 1231 cf_save_CFLAGS="$CFLAGS" 1232 EXTRA_CFLAGS="-W -Wall" 1233 cf_warn_CONST="" 1234 test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings" 1235 for cf_opt in \ 1236 Wbad-function-cast \ 1237 Wcast-align \ 1238 Wcast-qual \ 1239 Winline \ 1240 Wmissing-declarations \ 1241 Wmissing-prototypes \ 1242 Wnested-externs \ 1243 Wpointer-arith \ 1244 Wshadow \ 1245 Wstrict-prototypes \ 1246 Wundef $cf_warn_CONST $1 1247 do 1248 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" 1249 if AC_TRY_EVAL(ac_compile); then 1250 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt) 1251 case $cf_opt in #(vi 1252 Wcast-qual) #(vi 1253 CPPFLAGS="$CPPFLAGS -DXTSTRINGDEFINES" 1254 ;; 1255 Winline) #(vi 1256 case $GCC_VERSION in 1257 3.3*) 1258 CF_VERBOSE(feature is broken in gcc $GCC_VERSION) 1259 continue;; 1260 esac 1261 ;; 1262 esac 1263 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" 1264 fi 1265 done 1266 CFLAGS="$cf_save_CFLAGS" 1267fi 1268rm -f conftest* 1269 1270AC_SUBST(EXTRA_CFLAGS) 1271])dnl 1272dnl --------------------------------------------------------------------------- 1273dnl CF_GNAT_TRY_LINK version: 1 updated: 2004/08/21 19:02:08 1274dnl ---------------- 1275dnl Verify that a test program compiles/links with GNAT. 1276dnl $cf_ada_make is set to the program that compiles/links 1277dnl $ADAFLAGS may be set to the GNAT flags. 1278dnl 1279dnl $1 is the text of the spec 1280dnl $2 is the text of the body 1281dnl $3 is the shell command to execute if successful 1282dnl $4 is the shell command to execute if not successful 1283AC_DEFUN([CF_GNAT_TRY_LINK], 1284[ 1285rm -f conftest* 1286cat >>conftest.ads <<CF_EOF 1287$1 1288CF_EOF 1289cat >>conftest.adb <<CF_EOF 1290$2 1291CF_EOF 1292if ( $cf_ada_make $ADAFLAGS conftest 1>&AC_FD_CC 2>&1 ) ; then 1293ifelse($3,, :,[ $3]) 1294ifelse($4,,,[else 1295 $4]) 1296fi 1297rm -f conftest* 1298])dnl 1299dnl --------------------------------------------------------------------------- 1300dnl CF_GNAT_TRY_RUN version: 3 updated: 2004/08/21 19:02:08 1301dnl --------------- 1302dnl Verify that a test program compiles and runs with GNAT 1303dnl $cf_ada_make is set to the program that compiles/links 1304dnl $ADAFLAGS may be set to the GNAT flags. 1305dnl 1306dnl $1 is the text of the spec 1307dnl $2 is the text of the body 1308dnl $3 is the shell command to execute if successful 1309dnl $4 is the shell command to execute if not successful 1310AC_DEFUN([CF_GNAT_TRY_RUN], 1311[ 1312rm -f conftest* 1313cat >>conftest.ads <<CF_EOF 1314$1 1315CF_EOF 1316cat >>conftest.adb <<CF_EOF 1317$2 1318CF_EOF 1319if ( $cf_ada_make $ADAFLAGS conftest 1>&AC_FD_CC 2>&1 ) ; then 1320 if ( ./conftest 1>&AC_FD_CC 2>&1 ) ; then 1321ifelse($3,, :,[ $3]) 1322ifelse($4,,,[ else 1323 $4]) 1324 fi 1325ifelse($4,,,[else 1326 $4]) 1327fi 1328rm -f conftest* 1329])dnl 1330dnl --------------------------------------------------------------------------- 1331dnl CF_GNAT_VERSION version: 12 updated: 2006/10/14 15:23:15 1332dnl --------------- 1333dnl Verify version of GNAT. 1334AC_DEFUN([CF_GNAT_VERSION], 1335[ 1336AC_MSG_CHECKING(for gnat version) 1337cf_gnat_version=`${cf_ada_make-gnatmake} -v 2>&1 | grep '[[0-9]].[[0-9]][[0-9]]*' |\ 1338 sed -e '2,$d' -e 's/[[^0-9 \.]]//g' -e 's/^[[ ]]*//' -e 's/ .*//'` 1339AC_MSG_RESULT($cf_gnat_version) 1340 1341case $cf_gnat_version in 1342 3.1[[1-9]]*|3.[[2-9]]*|[[4-9]].*) 1343 cf_cv_prog_gnat_correct=yes 1344 ;; 1345 *) echo Unsupported GNAT version $cf_gnat_version. Required is 3.11 or better. Disabling Ada95 binding. 1346 cf_cv_prog_gnat_correct=no 1347 ;; 1348esac 1349case $cf_gnat_version in 1350 3.[[1-9]]*|[[4-9]].*) 1351 cf_compile_generics=generics 1352 cf_generic_objects="\${GENOBJS}" 1353 ;; 1354 *) cf_compile_generics= 1355 cf_generic_objects= 1356 ;; 1357esac 1358]) 1359dnl --------------------------------------------------------------------------- 1360dnl CF_GNU_SOURCE version: 6 updated: 2005/07/09 13:23:07 1361dnl ------------- 1362dnl Check if we must define _GNU_SOURCE to get a reasonable value for 1363dnl _XOPEN_SOURCE, upon which many POSIX definitions depend. This is a defect 1364dnl (or misfeature) of glibc2, which breaks portability of many applications, 1365dnl since it is interwoven with GNU extensions. 1366dnl 1367dnl Well, yes we could work around it... 1368AC_DEFUN([CF_GNU_SOURCE], 1369[ 1370AC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[ 1371AC_TRY_COMPILE([#include <sys/types.h>],[ 1372#ifndef _XOPEN_SOURCE 1373make an error 1374#endif], 1375 [cf_cv_gnu_source=no], 1376 [cf_save="$CPPFLAGS" 1377 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" 1378 AC_TRY_COMPILE([#include <sys/types.h>],[ 1379#ifdef _XOPEN_SOURCE 1380make an error 1381#endif], 1382 [cf_cv_gnu_source=no], 1383 [cf_cv_gnu_source=yes]) 1384 CPPFLAGS="$cf_save" 1385 ]) 1386]) 1387test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" 1388])dnl 1389dnl --------------------------------------------------------------------------- 1390dnl CF_GPP_LIBRARY version: 8 updated: 2003/02/02 01:41:46 1391dnl -------------- 1392dnl If we're trying to use g++, test if libg++ is installed (a rather common 1393dnl problem :-). If we have the compiler but no library, we'll be able to 1394dnl configure, but won't be able to build the c++ demo program. 1395AC_DEFUN([CF_GPP_LIBRARY], 1396[ 1397cf_cxx_library=unknown 1398case $cf_cv_system_name in #(vi 1399os2*) #(vi 1400 cf_gpp_libname=gpp 1401 ;; 1402*) 1403 cf_gpp_libname=g++ 1404 ;; 1405esac 1406if test "$GXX" = yes; then 1407 AC_MSG_CHECKING([for lib$cf_gpp_libname]) 1408 cf_save="$LIBS" 1409 LIBS="$LIBS -l$cf_gpp_libname" 1410 AC_TRY_LINK([ 1411#include <$cf_gpp_libname/builtin.h> 1412 ], 1413 [two_arg_error_handler_t foo2 = lib_error_handler], 1414 [cf_cxx_library=yes 1415 CXXLIBS="$CXXLIBS -l$cf_gpp_libname" 1416 if test "$cf_gpp_libname" = cpp ; then 1417 AC_DEFINE(HAVE_GPP_BUILTIN_H) 1418 else 1419 AC_DEFINE(HAVE_GXX_BUILTIN_H) 1420 fi], 1421 [AC_TRY_LINK([ 1422#include <builtin.h> 1423 ], 1424 [two_arg_error_handler_t foo2 = lib_error_handler], 1425 [cf_cxx_library=yes 1426 CXXLIBS="$CXXLIBS -l$cf_gpp_libname" 1427 AC_DEFINE(HAVE_BUILTIN_H)], 1428 [cf_cxx_library=no])]) 1429 LIBS="$cf_save" 1430 AC_MSG_RESULT($cf_cxx_library) 1431fi 1432])dnl 1433dnl --------------------------------------------------------------------------- 1434dnl CF_GXX_VERSION version: 5 updated: 2005/08/27 09:53:42 1435dnl -------------- 1436dnl Check for version of g++ 1437AC_DEFUN([CF_GXX_VERSION],[ 1438AC_REQUIRE([AC_PROG_CPP]) 1439GXX_VERSION=none 1440if test "$GXX" = yes; then 1441 AC_MSG_CHECKING(version of g++) 1442 GXX_VERSION="`${CXX-g++} --version| sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`" 1443 test -z "$GXX_VERSION" && GXX_VERSION=unknown 1444 AC_MSG_RESULT($GXX_VERSION) 1445fi 1446])dnl 1447dnl --------------------------------------------------------------------------- 1448dnl CF_GXX_WARNINGS version: 5 updated: 2005/08/13 14:54:38 1449dnl --------------- 1450dnl Check if the compiler supports useful warning options. 1451dnl 1452dnl Most of gcc's options apply to g++, except: 1453dnl -Wbad-function-cast 1454dnl -Wmissing-declarations 1455dnl -Wnested-externs 1456dnl 1457dnl Omit a few (for now): 1458dnl -Winline 1459dnl 1460dnl Parameter: 1461dnl $1 is an optional list of g++ warning flags that a particular 1462dnl application might want to use, e.g., "no-unused" for 1463dnl -Wno-unused 1464dnl Special: 1465dnl If $with_ext_const is "yes", add a check for -Wwrite-strings 1466dnl 1467AC_DEFUN([CF_GXX_WARNINGS], 1468[ 1469 1470CF_INTEL_COMPILER(GXX,INTEL_CPLUSPLUS,CXXFLAGS) 1471 1472AC_REQUIRE([CF_GXX_VERSION]) 1473 1474AC_LANG_SAVE 1475AC_LANG_CPLUSPLUS 1476 1477cat > conftest.$ac_ext <<EOF 1478#line __oline__ "configure" 1479int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; } 1480EOF 1481 1482if test "$INTEL_CPLUSPLUS" = yes 1483then 1484# The "-wdXXX" options suppress warnings: 1485# remark #1419: external declaration in primary source file 1486# remark #1682: implicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem) 1487# remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem) 1488# remark #1684: conversion from pointer to same-sized integral type (potential portability problem) 1489# remark #193: zero used for undefined preprocessing identifier 1490# remark #593: variable "curs_sb_left_arrow" was set but never used 1491# remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits 1492# remark #869: parameter "tw" was never referenced 1493# remark #981: operands are evaluated in unspecified order 1494# warning #269: invalid format string conversion 1495 1496 AC_CHECKING([for $CC warning options]) 1497 cf_save_CXXFLAGS="$CXXFLAGS" 1498 EXTRA_CXXFLAGS="-Wall" 1499 for cf_opt in \ 1500 wd1419 \ 1501 wd1682 \ 1502 wd1683 \ 1503 wd1684 \ 1504 wd193 \ 1505 wd279 \ 1506 wd593 \ 1507 wd810 \ 1508 wd869 \ 1509 wd981 1510 do 1511 CXXFLAGS="$cf_save_CXXFLAGS $EXTRA_CXXFLAGS -$cf_opt" 1512 if AC_TRY_EVAL(ac_compile); then 1513 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt) 1514 EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS -$cf_opt" 1515 fi 1516 done 1517 CXXFLAGS="$cf_save_CXXFLAGS" 1518 1519elif test "$GXX" = yes 1520then 1521 AC_CHECKING([for $CXX warning options]) 1522 cf_save_CXXFLAGS="$CXXFLAGS" 1523 EXTRA_CXXFLAGS="-W -Wall" 1524 cf_gxx_extra_warnings="" 1525 test "$with_ext_const" = yes && cf_gxx_extra_warnings="Wwrite-strings" 1526 case "$GCC_VERSION" in 1527 [[1-2]].*) 1528 ;; 1529 *) 1530 cf_gxx_extra_warnings="$cf_gxx_extra_warnings Weffc++" 1531 ;; 1532 esac 1533 for cf_opt in \ 1534 Wabi \ 1535 fabi-version=0 \ 1536 Woverloaded-virtual \ 1537 Wsign-promo \ 1538 Wsynth \ 1539 Wold-style-cast \ 1540 Wcast-align \ 1541 Wcast-qual \ 1542 Wmissing-prototypes \ 1543 Wpointer-arith \ 1544 Wshadow \ 1545 Wstrict-prototypes \ 1546 Wundef $cf_gxx_extra_warnings $1 1547 do 1548 CXXFLAGS="$cf_save_CXXFLAGS $EXTRA_CXXFLAGS -Werror -$cf_opt" 1549 if AC_TRY_EVAL(ac_compile); then 1550 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt) 1551 EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS -$cf_opt" 1552 else 1553 test -n "$verbose" && AC_MSG_RESULT(... no -$cf_opt) 1554 fi 1555 done 1556 CXXFLAGS="$cf_save_CXXFLAGS" 1557fi 1558 1559rm -f conftest* 1560AC_LANG_RESTORE 1561AC_SUBST(EXTRA_CXXFLAGS) 1562])dnl 1563dnl --------------------------------------------------------------------------- 1564dnl CF_HASHED_DB version: 1 updated: 2006/08/19 09:16:14 1565dnl ------------ 1566dnl Look for an instance of the Berkeley hashed database. 1567AC_DEFUN([CF_HASHED_DB], 1568[ 1569AC_CHECK_HEADER(db.h,[ 1570CF_HASHED_DB_VERSION 1571if test "$cf_cv_hashed_db_version" = unknown ; then 1572 AC_MSG_ERROR(Cannot determine version of db) 1573else 1574 CF_HASHED_DB_LIBS 1575 if test "$cf_cv_hashed_db_libs" = unknown ; then 1576 AC_MSG_ERROR(Cannot determine library for db) 1577 elif test "$cf_cv_hashed_db_libs" != default ; then 1578 LIBS="-l$cf_cv_hashed_db_libs $LIBS" 1579 fi 1580fi 1581],[ 1582 AC_MSG_ERROR(Cannot find db.h) 1583]) 1584])dnl 1585dnl --------------------------------------------------------------------------- 1586dnl CF_HASHED_DB_LIBS version: 6 updated: 2006/12/16 12:33:30 1587dnl ----------------- 1588dnl Given that we have the header and version for hashed database, find the 1589dnl library information. 1590AC_DEFUN([CF_HASHED_DB_LIBS], 1591[ 1592AC_CACHE_CHECK(for db libraries, cf_cv_hashed_db_libs,[ 1593cf_cv_hashed_db_libs=unknown 1594for cf_db_libs in db$cf_cv_hashed_db_version db '' 1595do 1596 cf_save_libs="$LIBS" 1597 if test -n "$cf_db_libs"; then 1598 LIBS="-l$cf_db_libs $LIBS" 1599 fi 1600 CF_MSG_LOG(checking for library "$cf_db_libs") 1601 AC_TRY_LINK([ 1602$ac_includes_default 1603#include <db.h> 1604],[ 1605 char *path = "/tmp/foo"; 1606#ifdef DB_VERSION_MAJOR 1607#if DB_VERSION_MAJOR >= 4 1608 DB *result = 0; 1609 db_create(&result, NULL, 0); 1610 result->open(result, 1611 NULL, 1612 path, 1613 path, 1614 DB_HASH, 1615 DB_CREATE, 1616 0644); 1617#elif DB_VERSION_MAJOR >= 3 1618 DB *result = 0; 1619 db_create(&result, NULL, 0); 1620 result->open(result, 1621 path, 1622 path, 1623 DB_HASH, 1624 DB_CREATE, 1625 0644); 1626#elif DB_VERSION_MAJOR >= 2 1627 DB *result = 0; 1628 db_open(path, 1629 DB_HASH, 1630 DB_CREATE, 1631 0644, 1632 (DB_ENV *) 0, 1633 (DB_INFO *) 0, 1634 &result); 1635#endif /* DB_VERSION_MAJOR */ 1636#else 1637 DB *result = dbopen(path, 1638 2, 1639 0644, 1640 DB_HASH, 1641 0); 1642#endif 1643 ${cf_cv_main_return:-return}(result != 0) 1644],[ 1645 if test -n "$cf_db_libs" ; then 1646 cf_cv_hashed_db_libs=$cf_db_libs 1647 else 1648 cf_cv_hashed_db_libs=default 1649 fi 1650 LIBS="$cf_save_libs" 1651 break 1652]) 1653 LIBS="$cf_save_libs" 1654done 1655]) 1656])dnl 1657dnl --------------------------------------------------------------------------- 1658dnl CF_HASHED_DB_VERSION version: 2 updated: 2006/08/19 15:12:49 1659dnl -------------------- 1660dnl Given that we have the header file for hashed database, find the version 1661dnl information. 1662AC_DEFUN([CF_HASHED_DB_VERSION], 1663[ 1664AC_CACHE_CHECK(for version of db, cf_cv_hashed_db_version,[ 1665cf_cv_hashed_db_version=unknown 1666 1667for cf_db_version in 1 2 3 4 1668do 1669 CF_MSG_LOG(checking for db version $cf_db_version) 1670 AC_TRY_COMPILE([ 1671$ac_includes_default 1672#include <db.h> 1673 1674#ifdef DB_VERSION_MAJOR 1675 /* db2 (DB_VERSION_MAJOR=2) has also DB_VERSION_MINOR, tested with 7 */ 1676#if $cf_db_version == DB_VERSION_MAJOR 1677 /* ok */ 1678#else 1679 make an error 1680#endif 1681#else 1682#if $cf_db_version == 1 1683 /* ok: assuming this is DB 1.8.5 */ 1684#else 1685 make an error 1686#endif 1687#endif 1688],[DBT *foo = 0],[ 1689 cf_cv_hashed_db_version=$cf_db_version 1690 break 1691 ]) 1692done 1693]) 1694])dnl 1695dnl --------------------------------------------------------------------------- 1696dnl CF_HELP_MESSAGE version: 3 updated: 1998/01/14 10:56:23 1697dnl --------------- 1698dnl Insert text into the help-message, for readability, from AC_ARG_WITH. 1699AC_DEFUN([CF_HELP_MESSAGE], 1700[AC_DIVERT_HELP([$1])dnl 1701])dnl 1702dnl --------------------------------------------------------------------------- 1703dnl CF_INCLUDE_DIRS version: 5 updated: 2006/10/14 15:23:15 1704dnl --------------- 1705dnl Construct the list of include-options according to whether we're building 1706dnl in the source directory or using '--srcdir=DIR' option. If we're building 1707dnl with gcc, don't append the includedir if it happens to be /usr/include, 1708dnl since that usually breaks gcc's shadow-includes. 1709AC_DEFUN([CF_INCLUDE_DIRS], 1710[ 1711CPPFLAGS="-I. -I../include $CPPFLAGS" 1712if test "$srcdir" != "."; then 1713 CPPFLAGS="-I\${srcdir}/../include $CPPFLAGS" 1714fi 1715if test "$GCC" != yes; then 1716 CPPFLAGS="$CPPFLAGS -I\${includedir}" 1717elif test "$includedir" != "/usr/include"; then 1718 if test "$includedir" = '${prefix}/include' ; then 1719 if test $prefix != /usr ; then 1720 CPPFLAGS="$CPPFLAGS -I\${includedir}" 1721 fi 1722 else 1723 CPPFLAGS="$CPPFLAGS -I\${includedir}" 1724 fi 1725fi 1726AC_SUBST(CPPFLAGS) 1727])dnl 1728dnl --------------------------------------------------------------------------- 1729dnl CF_INTEL_COMPILER version: 3 updated: 2005/08/06 18:37:29 1730dnl ----------------- 1731dnl Check if the given compiler is really the Intel compiler for Linux. It 1732dnl tries to imitate gcc, but does not return an error when it finds a mismatch 1733dnl between prototypes, e.g., as exercised by CF_MISSING_CHECK. 1734dnl 1735dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to 1736dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from 1737dnl the wrappers for gcc and g++ warnings. 1738dnl 1739dnl $1 = GCC (default) or GXX 1740dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS 1741dnl $3 = CFLAGS (default) or CXXFLAGS 1742AC_DEFUN([CF_INTEL_COMPILER],[ 1743ifelse($2,,INTEL_COMPILER,[$2])=no 1744 1745if test "$ifelse($1,,[$1],GCC)" = yes ; then 1746 case $host_os in 1747 linux*|gnu*) 1748 AC_MSG_CHECKING(if this is really Intel ifelse($1,GXX,C++,C) compiler) 1749 cf_save_CFLAGS="$ifelse($3,,CFLAGS,[$3])" 1750 ifelse($3,,CFLAGS,[$3])="$ifelse($3,,CFLAGS,[$3]) -no-gcc" 1751 AC_TRY_COMPILE([],[ 1752#ifdef __INTEL_COMPILER 1753#else 1754make an error 1755#endif 1756],[ifelse($2,,INTEL_COMPILER,[$2])=yes 1757cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc" 1758],[]) 1759 ifelse($3,,CFLAGS,[$3])="$cf_save_CFLAGS" 1760 AC_MSG_RESULT($ifelse($2,,INTEL_COMPILER,[$2])) 1761 ;; 1762 esac 1763fi 1764])dnl 1765dnl --------------------------------------------------------------------------- 1766dnl CF_ISASCII version: 3 updated: 2000/08/12 23:18:52 1767dnl ---------- 1768dnl Check if we have either a function or macro for 'isascii()'. 1769AC_DEFUN([CF_ISASCII], 1770[ 1771AC_MSG_CHECKING(for isascii) 1772AC_CACHE_VAL(cf_cv_have_isascii,[ 1773 AC_TRY_LINK([#include <ctype.h>],[int x = isascii(' ')], 1774 [cf_cv_have_isascii=yes], 1775 [cf_cv_have_isascii=no]) 1776])dnl 1777AC_MSG_RESULT($cf_cv_have_isascii) 1778test "$cf_cv_have_isascii" = yes && AC_DEFINE(HAVE_ISASCII) 1779])dnl 1780dnl --------------------------------------------------------------------------- 1781dnl CF_LARGEFILE version: 6 updated: 2006/09/23 19:07:52 1782dnl ------------ 1783dnl Add checks for large file support. 1784AC_DEFUN([CF_LARGEFILE],[ 1785ifdef([AC_FUNC_FSEEKO],[ 1786 AC_SYS_LARGEFILE 1787 if test "$enable_largefile" != no ; then 1788 AC_FUNC_FSEEKO 1789 1790 # Normally we would collect these definitions in the config.h, 1791 # but (like _XOPEN_SOURCE), some environments rely on having these 1792 # defined before any of the system headers are included. Another 1793 # case comes up with C++, e.g., on AIX the compiler compiles the 1794 # header files by themselves before looking at the body files it is 1795 # told to compile. For ncurses, those header files do not include 1796 # the config.h 1797 test "$ac_cv_sys_large_files" != no && CPPFLAGS="$CPPFLAGS -D_LARGE_FILES " 1798 test "$ac_cv_sys_largefile_source" != no && CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE " 1799 1800 AC_CACHE_CHECK(whether to use struct dirent64, cf_cv_struct_dirent64,[ 1801 AC_TRY_COMPILE([ 1802#include <sys/types.h> 1803#include <dirent.h> 1804 ],[ 1805 /* if transitional largefile support is setup, this is true */ 1806 extern struct dirent64 * readdir(DIR *); 1807 struct dirent64 *x = readdir((DIR *)0); 1808 struct dirent *y = readdir((DIR *)0); 1809 int z = x - y; 1810 ], 1811 [cf_cv_struct_dirent64=yes], 1812 [cf_cv_struct_dirent64=no]) 1813 ]) 1814 test "$cf_cv_struct_dirent64" = yes && AC_DEFINE(HAVE_STRUCT_DIRENT64) 1815 fi 1816]) 1817]) 1818dnl --------------------------------------------------------------------------- 1819dnl CF_LIBUTF8 version: 2 updated: 2002/01/19 22:51:32 1820dnl ---------- 1821dnl Check for libutf8 1822AC_DEFUN([CF_LIBUTF8], 1823[ 1824AC_CACHE_CHECK(for putwc in libutf8,cf_cv_libutf8,[ 1825 cf_save_LIBS="$LIBS" 1826 LIBS="-lutf8 $LIBS" 1827AC_TRY_LINK([ 1828#include <libutf8.h>],[putwc(0,0);], 1829 [cf_cv_libutf8=yes], 1830 [cf_cv_libutf8=no]) 1831 LIBS="$cf_save_LIBS" 1832]) 1833 1834if test "$cf_cv_libutf8" = yes ; then 1835 AC_DEFINE(HAVE_LIBUTF8_H) 1836 LIBS="-lutf8 $LIBS" 1837fi 1838])dnl 1839dnl --------------------------------------------------------------------------- 1840dnl CF_LIB_PREFIX version: 7 updated: 2001/01/12 01:23:48 1841dnl ------------- 1842dnl Compute the library-prefix for the given host system 1843dnl $1 = variable to set 1844AC_DEFUN([CF_LIB_PREFIX], 1845[ 1846 case $cf_cv_system_name in 1847 OS/2*) LIB_PREFIX='' ;; 1848 os2*) LIB_PREFIX='' ;; 1849 *) LIB_PREFIX='lib' ;; 1850 esac 1851ifelse($1,,,[$1=$LIB_PREFIX]) 1852 AC_SUBST(LIB_PREFIX) 1853])dnl 1854dnl --------------------------------------------------------------------------- 1855dnl CF_LIB_RULES version: 40 updated: 2006/10/14 15:23:15 1856dnl ------------ 1857dnl Append definitions and rules for the given models to the subdirectory 1858dnl Makefiles, and the recursion rule for the top-level Makefile. If the 1859dnl subdirectory is a library-source directory, modify the LIBRARIES list in 1860dnl the corresponding makefile to list the models that we'll generate. 1861dnl 1862dnl For shared libraries, make a list of symbolic links to construct when 1863dnl generating each library. The convention used for Linux is the simplest 1864dnl one: 1865dnl lib<name>.so -> 1866dnl lib<name>.so.<major> -> 1867dnl lib<name>.so.<maj>.<minor> 1868AC_DEFUN([CF_LIB_RULES], 1869[ 1870CF_LIB_PREFIX(cf_prefix) 1871AC_REQUIRE([CF_SUBST_NCURSES_VERSION]) 1872for cf_dir in $SRC_SUBDIRS 1873do 1874 if test ! -d $srcdir/$cf_dir ; then 1875 continue 1876 elif test -f $srcdir/$cf_dir/modules; then 1877 1878 IMPORT_LIB= 1879 SHARED_LIB= 1880 LIBS_TO_MAKE= 1881 for cf_item in $cf_LIST_MODELS 1882 do 1883 CF_LIB_SUFFIX($cf_item,cf_suffix) 1884 if test $cf_item = shared ; then 1885 if test "$cf_cv_do_symlinks" = yes ; then 1886 case "$cf_cv_shlib_version" in #(vi 1887 rel) #(vi 1888 case "$cf_cv_system_name" in #(vi 1889 darwin*) 1890 case .${LIB_SUFFIX} in 1891 .w*) 1892 cf_suffix=`echo $cf_suffix | sed 's/^w//'` 1893 cf_suffix=w'.${REL_VERSION}'"$cf_suffix" 1894 ;; 1895 *) 1896 cf_suffix='.${REL_VERSION}'"$cf_suffix" 1897 ;; 1898 esac 1899 ;; #(vi 1900 *) cf_suffix="$cf_suffix"'.${REL_VERSION}' ;; 1901 esac 1902 ;; 1903 abi) 1904 case "$cf_cv_system_name" in #(vi 1905 darwin*) 1906 case .${LIB_SUFFIX} in 1907 .w*) 1908 cf_suffix=`echo $cf_suffix | sed 's/^w//'` 1909 cf_suffix=w'.${ABI_VERSION}'"$cf_suffix" 1910 ;; 1911 *) 1912 cf_suffix='.${ABI_VERSION}'"$cf_suffix" 1913 ;; 1914 esac 1915 ;; #(vi 1916 *) cf_suffix="$cf_suffix"'.${ABI_VERSION}' ;; 1917 esac 1918 ;; 1919 esac 1920 fi 1921 # cygwin needs import library, and has unique naming convention 1922 # use autodetected ${cf_prefix} for import lib and static lib, but 1923 # use 'cyg' prefix for shared lib. 1924 if test $cf_cv_shlib_version = cygdll ; then 1925 SHARED_LIB="cyg${cf_dir}\${ABI_VERSION}.dll" 1926 IMPORT_LIB="${cf_prefix}${cf_dir}.dll.a" 1927 LIBS_TO_MAKE="$LIBS_TO_MAKE ../lib/\${SHARED_LIB} ../lib/\${IMPORT_LIB}" 1928 continue 1929 fi 1930 fi 1931 LIBS_TO_MAKE="$LIBS_TO_MAKE ../lib/${cf_prefix}${cf_dir}${cf_suffix}" 1932 done 1933 1934 if test $cf_dir = ncurses ; then 1935 cf_subsets="$LIB_SUBSETS" 1936 cf_termlib=`echo "$cf_subsets" |sed -e 's/ .*$//'` 1937 if test "$cf_termlib" != "$cf_subsets" ; then 1938 cf_item=`echo $LIBS_TO_MAKE |sed -e s%${LIB_NAME}${LIB_SUFFIX}%${TINFO_LIB_SUFFIX}%g` 1939 LIBS_TO_MAKE="$cf_item $LIBS_TO_MAKE" 1940 fi 1941 else 1942 cf_subsets=`echo "$LIB_SUBSETS" | sed -e 's/^termlib.* //'` 1943 fi 1944 1945 sed -e "s%@LIBS_TO_MAKE@%$LIBS_TO_MAKE%" \ 1946 -e "s%@IMPORT_LIB@%$IMPORT_LIB%" \ 1947 -e "s%@SHARED_LIB@%$SHARED_LIB%" \ 1948 $cf_dir/Makefile >$cf_dir/Makefile.out 1949 mv $cf_dir/Makefile.out $cf_dir/Makefile 1950 1951 $AWK -f $srcdir/mk-0th.awk \ 1952 libname="${cf_dir}${LIB_SUFFIX}" subsets="$LIB_SUBSETS" \ 1953 $srcdir/$cf_dir/modules >>$cf_dir/Makefile 1954 1955 for cf_subset in $cf_subsets 1956 do 1957 cf_subdirs= 1958 for cf_item in $cf_LIST_MODELS 1959 do 1960 echo "Appending rules for ${cf_item} model (${cf_dir}: ${cf_subset})" 1961 CF_UPPER(cf_ITEM,$cf_item) 1962 CF_LIB_SUFFIX($cf_item,cf_suffix) 1963 CF_OBJ_SUBDIR($cf_item,cf_subdir) 1964 1965 # Test for case where we build libtinfo with a different name. 1966 cf_libname=$cf_dir 1967 if test $cf_dir = ncurses ; then 1968 case $cf_subset in 1969 *base*) 1970 ;; 1971 termlib*) 1972 cf_libname=$TINFO_LIB_SUFFIX 1973 if test -n "${DFT_ARG_SUFFIX}" ; then 1974 # undo $LIB_SUFFIX add-on in CF_LIB_SUFFIX 1975 cf_suffix=`echo $cf_suffix |sed -e "s%^${LIB_SUFFIX}%%"` 1976 fi 1977 ;; 1978 esac 1979 fi 1980 1981 # These dependencies really are for development, not 1982 # builds, but they are useful in porting, too. 1983 cf_depend="../include/ncurses_cfg.h" 1984 if test "$srcdir" = "."; then 1985 cf_reldir="." 1986 else 1987 cf_reldir="\${srcdir}" 1988 fi 1989 1990 if test -f $srcdir/$cf_dir/$cf_dir.priv.h; then 1991 cf_depend="$cf_depend $cf_reldir/$cf_dir.priv.h" 1992 elif test -f $srcdir/$cf_dir/curses.priv.h; then 1993 cf_depend="$cf_depend $cf_reldir/curses.priv.h" 1994 fi 1995 1996 cf_dir_suffix= 1997 old_cf_suffix="$cf_suffix" 1998 if test "$cf_cv_shlib_version_infix" = yes ; then 1999 if test -n "$LIB_SUFFIX" ; then 2000 case $LIB_SUFFIX in 2001 w*) 2002 cf_libname=`echo $cf_libname | sed 's/w$//'` 2003 cf_suffix=`echo $cf_suffix | sed 's/^w//'` 2004 cf_dir_suffix=w 2005 ;; 2006 esac 2007 fi 2008 fi 2009 2010 $AWK -f $srcdir/mk-1st.awk \ 2011 name=${cf_libname}${cf_dir_suffix} \ 2012 traces=$LIB_TRACING \ 2013 MODEL=$cf_ITEM \ 2014 model=$cf_subdir \ 2015 prefix=$cf_prefix \ 2016 suffix=$cf_suffix \ 2017 subset=$cf_subset \ 2018 ShlibVer=$cf_cv_shlib_version \ 2019 ShlibVerInfix=$cf_cv_shlib_version_infix \ 2020 DoLinks=$cf_cv_do_symlinks \ 2021 rmSoLocs=$cf_cv_rm_so_locs \ 2022 ldconfig="$LDCONFIG" \ 2023 overwrite=$WITH_OVERWRITE \ 2024 depend="$cf_depend" \ 2025 host="$host" \ 2026 $srcdir/$cf_dir/modules >>$cf_dir/Makefile 2027 2028 cf_suffix="$old_cf_suffix" 2029 2030 for cf_subdir2 in $cf_subdirs lib 2031 do 2032 test $cf_subdir = $cf_subdir2 && break 2033 done 2034 test "${cf_subset}.${cf_subdir2}" != "${cf_subset}.${cf_subdir}" && \ 2035 $AWK -f $srcdir/mk-2nd.awk \ 2036 name=$cf_dir \ 2037 traces=$LIB_TRACING \ 2038 MODEL=$cf_ITEM \ 2039 model=$cf_subdir \ 2040 subset=$cf_subset \ 2041 srcdir=$srcdir \ 2042 echo=$WITH_ECHO \ 2043 crenames=$cf_cv_prog_CC_c_o \ 2044 cxxrenames=$cf_cv_prog_CXX_c_o \ 2045 $srcdir/$cf_dir/modules >>$cf_dir/Makefile 2046 cf_subdirs="$cf_subdirs $cf_subdir" 2047 done 2048 done 2049 fi 2050 2051 echo ' cd '$cf_dir' && ${MAKE} ${CF_MFLAGS} [$]@' >>Makefile 2052done 2053 2054for cf_dir in $SRC_SUBDIRS 2055do 2056 if test ! -d $srcdir/$cf_dir ; then 2057 continue 2058 fi 2059 2060 if test -f $cf_dir/Makefile ; then 2061 case "$cf_dir" in 2062 Ada95) #(vi 2063 echo 'libs \' >> Makefile 2064 echo 'install.libs \' >> Makefile 2065 echo 'uninstall.libs ::' >> Makefile 2066 echo ' cd '$cf_dir' && ${MAKE} ${CF_MFLAGS} [$]@' >> Makefile 2067 ;; 2068 esac 2069 fi 2070 2071 if test -f $srcdir/$cf_dir/modules; then 2072 echo >> Makefile 2073 if test -f $srcdir/$cf_dir/headers; then 2074cat >> Makefile <<CF_EOF 2075install.includes \\ 2076uninstall.includes \\ 2077CF_EOF 2078 fi 2079if test "$cf_dir" != "c++" ; then 2080echo 'lint \' >> Makefile 2081fi 2082cat >> Makefile <<CF_EOF 2083libs \\ 2084lintlib \\ 2085install.libs \\ 2086uninstall.libs \\ 2087install.$cf_dir \\ 2088uninstall.$cf_dir :: 2089 cd $cf_dir && \${MAKE} \${CF_MFLAGS} \[$]@ 2090CF_EOF 2091 elif test -f $srcdir/$cf_dir/headers; then 2092cat >> Makefile <<CF_EOF 2093 2094libs \\ 2095install.libs \\ 2096uninstall.libs \\ 2097install.includes \\ 2098uninstall.includes :: 2099 cd $cf_dir && \${MAKE} \${CF_MFLAGS} \[$]@ 2100CF_EOF 2101fi 2102done 2103 2104cat >> Makefile <<CF_EOF 2105 2106install.data \\ 2107uninstall.data :: 2108$MAKE_TERMINFO cd misc && \${MAKE} \${CF_MFLAGS} \[$]@ 2109 2110install.man \\ 2111uninstall.man :: 2112 cd man && \${MAKE} \${CF_MFLAGS} \[$]@ 2113 2114distclean :: 2115 rm -f config.cache config.log config.status Makefile include/ncurses_cfg.h 2116 rm -f headers.sh headers.sed 2117 rm -rf \${DIRS_TO_MAKE} 2118CF_EOF 2119 2120# Special case: tack's manpage lives in its own directory. 2121if test -d tack ; then 2122if test -f $srcdir/$tack.h; then 2123cat >> Makefile <<CF_EOF 2124 2125install.man \\ 2126uninstall.man :: 2127 cd tack && \${MAKE} \${CF_MFLAGS} \[$]@ 2128CF_EOF 2129fi 2130fi 2131 2132dnl If we're installing into a subdirectory of /usr/include, etc., we should 2133dnl prepend the subdirectory's name to the "#include" paths. It won't hurt 2134dnl anything, and will make it more standardized. It's awkward to decide this 2135dnl at configuration because of quoting, so we'll simply make all headers 2136dnl installed via a script that can do the right thing. 2137 2138rm -f headers.sed headers.sh 2139 2140dnl ( generating this script makes the makefiles a little tidier :-) 2141echo creating headers.sh 2142cat >headers.sh <<CF_EOF 2143#! /bin/sh 2144# This shell script is generated by the 'configure' script. It is invoked in a 2145# subdirectory of the build tree. It generates a sed-script in the parent 2146# directory that is used to adjust includes for header files that reside in a 2147# subdirectory of /usr/include, etc. 2148PRG="" 2149while test \[$]# != 3 2150do 2151PRG="\$PRG \[$]1"; shift 2152done 2153DST=\[$]1 2154REF=\[$]2 2155SRC=\[$]3 2156TMPSRC=\${TMPDIR-/tmp}/\`basename \$SRC\`\$\$ 2157TMPSED=\${TMPDIR-/tmp}/headers.sed\$\$ 2158echo installing \$SRC in \$DST 2159CF_EOF 2160 2161if test $WITH_CURSES_H = yes; then 2162 cat >>headers.sh <<CF_EOF 2163case \$DST in 2164/*/include/*) 2165 END=\`basename \$DST\` 2166 for i in \`cat \$REF/../*/headers |fgrep -v "#"\` 2167 do 2168 NAME=\`basename \$i\` 2169 echo "s/<\$NAME>/<\$END\/\$NAME>/" >> \$TMPSED 2170 done 2171 ;; 2172*) 2173 echo "" >> \$TMPSED 2174 ;; 2175esac 2176CF_EOF 2177 2178else 2179 cat >>headers.sh <<CF_EOF 2180case \$DST in 2181/*/include/*) 2182 END=\`basename \$DST\` 2183 for i in \`cat \$REF/../*/headers |fgrep -v "#"\` 2184 do 2185 NAME=\`basename \$i\` 2186 if test "\$NAME" = "curses.h" 2187 then 2188 echo "s/<curses.h>/<ncurses.h>/" >> \$TMPSED 2189 NAME=ncurses.h 2190 fi 2191 echo "s/<\$NAME>/<\$END\/\$NAME>/" >> \$TMPSED 2192 done 2193 ;; 2194*) 2195 echo "s/<curses.h>/<ncurses.h>/" >> \$TMPSED 2196 ;; 2197esac 2198CF_EOF 2199fi 2200cat >>headers.sh <<CF_EOF 2201rm -f \$TMPSRC 2202sed -f \$TMPSED \$SRC > \$TMPSRC 2203NAME=\`basename \$SRC\` 2204CF_EOF 2205if test $WITH_CURSES_H != yes; then 2206 cat >>headers.sh <<CF_EOF 2207test "\$NAME" = "curses.h" && NAME=ncurses.h 2208CF_EOF 2209fi 2210cat >>headers.sh <<CF_EOF 2211# Just in case someone gzip'd manpages, remove the conflicting copy. 2212test -f \$DST/\$NAME.gz && rm -f \$DST/\$NAME.gz 2213 2214eval \$PRG \$TMPSRC \$DST/\$NAME 2215rm -f \$TMPSRC \$TMPSED 2216CF_EOF 2217 2218chmod 0755 headers.sh 2219 2220for cf_dir in $SRC_SUBDIRS 2221do 2222 if test ! -d $srcdir/$cf_dir ; then 2223 continue 2224 fi 2225 2226 if test -f $srcdir/$cf_dir/headers; then 2227 cat >>$cf_dir/Makefile <<CF_EOF 2228\${DESTDIR}\${includedir} : 2229 sh \${srcdir}/../mkinstalldirs \[$]@ 2230 2231install \\ 2232install.libs \\ 2233install.includes :: \${AUTO_SRC} \${DESTDIR}\${includedir} \\ 2234CF_EOF 2235 j="" 2236 for i in `cat $srcdir/$cf_dir/headers |fgrep -v "#"` 2237 do 2238 test -n "$j" && echo " $j \\" >>$cf_dir/Makefile 2239 j=$i 2240 done 2241 2242 echo " $j" >>$cf_dir/Makefile 2243 2244 for i in `cat $srcdir/$cf_dir/headers |fgrep -v "#"` 2245 do 2246 echo " @ (cd \${DESTDIR}\${includedir} && rm -f `basename $i`) ; ../headers.sh \${INSTALL_DATA} \${DESTDIR}\${includedir} \${srcdir} $i" >>$cf_dir/Makefile 2247 test $i = curses.h && test $WITH_CURSES_H = yes && echo " @ (cd \${DESTDIR}\${includedir} && rm -f ncurses.h && \${LN_S} curses.h ncurses.h)" >>$cf_dir/Makefile 2248 done 2249 2250 cat >>$cf_dir/Makefile <<CF_EOF 2251 2252uninstall \\ 2253uninstall.libs \\ 2254uninstall.includes :: 2255CF_EOF 2256 for i in `cat $srcdir/$cf_dir/headers |fgrep -v "#"` 2257 do 2258 i=`basename $i` 2259 echo " -@ (cd \${DESTDIR}\${includedir} && rm -f $i)" >>$cf_dir/Makefile 2260 test $i = curses.h && echo " -@ (cd \${DESTDIR}\${includedir} && rm -f ncurses.h)" >>$cf_dir/Makefile 2261 done 2262 fi 2263 2264 if test -f $srcdir/$cf_dir/modules; then 2265 if test "$cf_dir" != "c++" ; then 2266 cat >>$cf_dir/Makefile <<"CF_EOF" 2267depend : ${AUTO_SRC} 2268 makedepend -- ${CPPFLAGS} -- ${C_SRC} 2269 2270# DO NOT DELETE THIS LINE -- make depend depends on it. 2271CF_EOF 2272 fi 2273 fi 2274done 2275 2276])dnl 2277dnl --------------------------------------------------------------------------- 2278dnl CF_LIB_SONAME version: 3 updated: 2006/12/16 15:55:46 2279dnl ------------- 2280dnl Find the and soname for the given shared library. Set the cache variable 2281dnl cf_cv_$3_soname to this, unless it is not found. Then set the cache 2282dnl variable to "unknown". 2283dnl 2284dnl $1 = headers 2285dnl $2 = code 2286dnl $3 = library name 2287AC_DEFUN([CF_LIB_SONAME], 2288[ 2289AC_CACHE_CHECK(for soname of $3 library,cf_cv_$3_soname,[ 2290 2291cf_cv_$3_soname=unknown 2292if test "$cross_compiling" != yes ; then 2293cat >conftest.$ac_ext <<CF_EOF 2294$1 2295int main() 2296{ 2297$2 2298 ${cf_cv_main_return:-return}(0); 2299} 2300CF_EOF 2301cf_save_LIBS="$LIBS" 2302 LIBS="-l$3 $LIBS" 2303 if AC_TRY_EVAL(ac_compile) ; then 2304 if AC_TRY_EVAL(ac_link) ; then 2305 cf_cv_$3_soname=`ldd conftest$ac_exeext 2>/dev/null | sed -e 's,^.*/,,' -e 's, .*$,,' | fgrep lib$3.` 2306 test -z "$cf_cv_$3_soname" && cf_cv_$3_soname=unknown 2307 fi 2308 fi 2309rm -f conftest* 2310LIBS="$cf_save_LIBS" 2311fi 2312]) 2313]) 2314dnl --------------------------------------------------------------------------- 2315dnl CF_LIB_SUFFIX version: 13 updated: 2003/11/01 16:09:07 2316dnl ------------- 2317dnl Compute the library file-suffix from the given model name 2318dnl $1 = model name 2319dnl $2 = variable to set 2320dnl The variable $LIB_SUFFIX, if set, prepends the variable to set. 2321AC_DEFUN([CF_LIB_SUFFIX], 2322[ 2323 AC_REQUIRE([CF_SUBST_NCURSES_VERSION]) 2324 case $1 in 2325 libtool) $2='.la' ;; 2326 normal) $2='.a' ;; 2327 debug) $2='_g.a' ;; 2328 profile) $2='_p.a' ;; 2329 shared) 2330 case $cf_cv_system_name in 2331 cygwin*) $2='.dll' ;; 2332 darwin*) $2='.dylib' ;; 2333 hpux*) 2334 case $target in 2335 ia64*) $2='.so' ;; 2336 *) $2='.sl' ;; 2337 esac 2338 ;; 2339 *) $2='.so' ;; 2340 esac 2341 esac 2342 test -n "$LIB_SUFFIX" && $2="${LIB_SUFFIX}[$]{$2}" 2343])dnl 2344dnl --------------------------------------------------------------------------- 2345dnl CF_LIB_TYPE version: 4 updated: 2000/10/20 22:57:49 2346dnl ----------- 2347dnl Compute the string to append to -library from the given model name 2348dnl $1 = model name 2349dnl $2 = variable to set 2350dnl The variable $LIB_SUFFIX, if set, prepends the variable to set. 2351AC_DEFUN([CF_LIB_TYPE], 2352[ 2353 case $1 in 2354 libtool) $2='' ;; 2355 normal) $2='' ;; 2356 debug) $2='_g' ;; 2357 profile) $2='_p' ;; 2358 shared) $2='' ;; 2359 esac 2360 test -n "$LIB_SUFFIX" && $2="${LIB_SUFFIX}[$]{$2}" 2361])dnl 2362dnl --------------------------------------------------------------------------- 2363dnl CF_LINK_DATAONLY version: 8 updated: 2006/12/16 12:33:30 2364dnl ---------------- 2365dnl Some systems have a non-ANSI linker that doesn't pull in modules that have 2366dnl only data (i.e., no functions), for example NeXT. On those systems we'll 2367dnl have to provide wrappers for global tables to ensure they're linked 2368dnl properly. 2369AC_DEFUN([CF_LINK_DATAONLY], 2370[ 2371AC_MSG_CHECKING([if data-only library module links]) 2372AC_CACHE_VAL(cf_cv_link_dataonly,[ 2373 rm -f conftest.a 2374 cat >conftest.$ac_ext <<EOF 2375#line __oline__ "configure" 2376int testdata[[3]] = { 123, 456, 789 }; 2377EOF 2378 if AC_TRY_EVAL(ac_compile) ; then 2379 mv conftest.o data.o && \ 2380 ( $AR $AR_OPTS conftest.a data.o ) 2>&AC_FD_CC 1>/dev/null 2381 fi 2382 rm -f conftest.$ac_ext data.o 2383 cat >conftest.$ac_ext <<EOF 2384#line __oline__ "configure" 2385int testfunc() 2386{ 2387#if defined(NeXT) 2388 ${cf_cv_main_return:-return}(1); /* I'm told this linker is broken */ 2389#else 2390 extern int testdata[[3]]; 2391 return testdata[[0]] == 123 2392 && testdata[[1]] == 456 2393 && testdata[[2]] == 789; 2394#endif 2395} 2396EOF 2397 if AC_TRY_EVAL(ac_compile); then 2398 mv conftest.o func.o && \ 2399 ( $AR $AR_OPTS conftest.a func.o ) 2>&AC_FD_CC 1>/dev/null 2400 fi 2401 rm -f conftest.$ac_ext func.o 2402 ( eval $RANLIB conftest.a ) 2>&AC_FD_CC >/dev/null 2403 cf_saveLIBS="$LIBS" 2404 LIBS="conftest.a $LIBS" 2405 AC_TRY_RUN([ 2406 int main() 2407 { 2408 extern int testfunc(); 2409 ${cf_cv_main_return:-return} (!testfunc()); 2410 } 2411 ], 2412 [cf_cv_link_dataonly=yes], 2413 [cf_cv_link_dataonly=no], 2414 [cf_cv_link_dataonly=unknown]) 2415 LIBS="$cf_saveLIBS" 2416 ]) 2417AC_MSG_RESULT($cf_cv_link_dataonly) 2418 2419if test "$cf_cv_link_dataonly" = no ; then 2420 AC_DEFINE(BROKEN_LINKER) 2421 BROKEN_LINKER=1 2422fi 2423 2424])dnl 2425dnl --------------------------------------------------------------------------- 2426dnl CF_LINK_FUNCS version: 7 updated: 2006/12/16 12:33:30 2427dnl ------------- 2428dnl Most Unix systems have both link and symlink, a few don't have symlink. 2429dnl A few non-Unix systems implement symlink, but not link. 2430dnl A few non-systems implement neither (or have nonfunctional versions). 2431AC_DEFUN([CF_LINK_FUNCS], 2432[ 2433AC_CHECK_FUNCS( \ 2434 remove \ 2435 unlink ) 2436 2437if test "$cross_compiling" = yes ; then 2438 AC_CHECK_FUNCS( \ 2439 link \ 2440 symlink ) 2441else 2442 AC_CACHE_CHECK(if link/symlink functions work,cf_cv_link_funcs,[ 2443 cf_cv_link_funcs= 2444 for cf_func in link symlink ; do 2445 AC_TRY_RUN([ 2446#include <sys/types.h> 2447#include <sys/stat.h> 2448#ifdef HAVE_UNISTD_H 2449#include <unistd.h> 2450#endif 2451int main() 2452{ 2453 int fail = 0; 2454 char *src = "config.log"; 2455 char *dst = "conftest.chk"; 2456 struct stat src_sb; 2457 struct stat dst_sb; 2458 2459 stat(src, &src_sb); 2460 fail = ($cf_func("config.log", "conftest.chk") < 0) 2461 || (stat(dst, &dst_sb) < 0) 2462 || (dst_sb.st_mtime != src_sb.st_mtime); 2463#ifdef HAVE_UNLINK 2464 unlink(dst); 2465#else 2466 remove(dst); 2467#endif 2468 ${cf_cv_main_return:-return} (fail); 2469} 2470 ],[ 2471 cf_cv_link_funcs="$cf_cv_link_funcs $cf_func" 2472 eval 'ac_cv_func_'$cf_func'=yes'],[ 2473 eval 'ac_cv_func_'$cf_func'=no'],[ 2474 eval 'ac_cv_func_'$cf_func'=error']) 2475 done 2476 test -z "$cf_cv_link_funcs" && cf_cv_link_funcs=no 2477 ]) 2478 test "$ac_cv_func_link" = yes && AC_DEFINE(HAVE_LINK) 2479 test "$ac_cv_func_symlink" = yes && AC_DEFINE(HAVE_SYMLINK) 2480fi 2481])dnl 2482dnl --------------------------------------------------------------------------- 2483dnl CF_MAIN_RETURN version: 1 updated: 2006/12/10 09:51:54 2484dnl -------------- 2485dnl Check if a return from main to the shell actually returns the same exit 2486dnl code. This is true for almost any POSIX environment. 2487dnl 2488dnl Some very old environments did not flush stdout, etc., on an exit. That 2489dnl would be a useful case to test for also. 2490AC_DEFUN([CF_MAIN_RETURN], 2491[ 2492cf_cv_main_return=return 2493])dnl 2494dnl --------------------------------------------------------------------------- 2495dnl CF_MAKEFLAGS version: 12 updated: 2006/10/21 08:27:03 2496dnl ------------ 2497dnl Some 'make' programs support ${MAKEFLAGS}, some ${MFLAGS}, to pass 'make' 2498dnl options to lower-levels. It's very useful for "make -n" -- if we have it. 2499dnl (GNU 'make' does both, something POSIX 'make', which happens to make the 2500dnl ${MAKEFLAGS} variable incompatible because it adds the assignments :-) 2501AC_DEFUN([CF_MAKEFLAGS], 2502[ 2503AC_CACHE_CHECK(for makeflags variable, cf_cv_makeflags,[ 2504 cf_cv_makeflags='' 2505 for cf_option in '-${MAKEFLAGS}' '${MFLAGS}' 2506 do 2507 cat >cf_makeflags.tmp <<CF_EOF 2508SHELL = /bin/sh 2509all : 2510 @ echo '.$cf_option' 2511CF_EOF 2512 cf_result=`${MAKE-make} -k -f cf_makeflags.tmp 2>/dev/null | sed -e 's,[[ ]]*$,,'` 2513 case "$cf_result" in 2514 .*k) 2515 cf_result=`${MAKE-make} -k -f cf_makeflags.tmp CC=cc 2>/dev/null` 2516 case "$cf_result" in 2517 .*CC=*) cf_cv_makeflags= 2518 ;; 2519 *) cf_cv_makeflags=$cf_option 2520 ;; 2521 esac 2522 break 2523 ;; 2524 .-) ;; 2525 *) echo "given option \"$cf_option\", no match \"$cf_result\"" 2526 ;; 2527 esac 2528 done 2529 rm -f cf_makeflags.tmp 2530]) 2531 2532AC_SUBST(cf_cv_makeflags) 2533])dnl 2534dnl --------------------------------------------------------------------------- 2535dnl CF_MAKE_TAGS version: 2 updated: 2000/10/04 09:18:40 2536dnl ------------ 2537dnl Generate tags/TAGS targets for makefiles. Do not generate TAGS if we have 2538dnl a monocase filesystem. 2539AC_DEFUN([CF_MAKE_TAGS],[ 2540AC_REQUIRE([CF_MIXEDCASE_FILENAMES]) 2541AC_CHECK_PROG(MAKE_LOWER_TAGS, ctags, yes, no) 2542 2543if test "$cf_cv_mixedcase" = yes ; then 2544 AC_CHECK_PROG(MAKE_UPPER_TAGS, etags, yes, no) 2545else 2546 MAKE_UPPER_TAGS=no 2547fi 2548 2549if test "$MAKE_UPPER_TAGS" = yes ; then 2550 MAKE_UPPER_TAGS= 2551else 2552 MAKE_UPPER_TAGS="#" 2553fi 2554AC_SUBST(MAKE_UPPER_TAGS) 2555 2556if test "$MAKE_LOWER_TAGS" = yes ; then 2557 MAKE_LOWER_TAGS= 2558else 2559 MAKE_LOWER_TAGS="#" 2560fi 2561AC_SUBST(MAKE_LOWER_TAGS) 2562])dnl 2563dnl --------------------------------------------------------------------------- 2564dnl CF_MANPAGE_FORMAT version: 7 updated: 2003/12/20 19:30:34 2565dnl ----------------- 2566dnl Option to allow user to override automatic configuration of manpage format. 2567dnl There are several special cases: 2568dnl 2569dnl gzip - man checks for, can display gzip'd files 2570dnl compress - man checks for, can display compressed files 2571dnl BSDI - files in the cat-directories are suffixed ".0" 2572dnl formatted - installer should format (put files in cat-directory) 2573dnl catonly - installer should only format, e.g., for a turnkey system. 2574dnl 2575dnl There are other configurations which this macro does not test, e.g., HPUX's 2576dnl compressed manpages (but uncompressed manpages are fine, and HPUX's naming 2577dnl convention would not match our use). 2578AC_DEFUN([CF_MANPAGE_FORMAT], 2579[ 2580AC_REQUIRE([CF_PATHSEP]) 2581AC_MSG_CHECKING(format of man-pages) 2582 2583AC_ARG_WITH(manpage-format, 2584 [ --with-manpage-format specify manpage-format: gzip/compress/BSDI/normal and 2585 optionally formatted/catonly, e.g., gzip,formatted], 2586 [MANPAGE_FORMAT=$withval], 2587 [MANPAGE_FORMAT=unknown]) 2588 2589test -z "$MANPAGE_FORMAT" && MANPAGE_FORMAT=unknown 2590MANPAGE_FORMAT=`echo "$MANPAGE_FORMAT" | sed -e 's/,/ /g'` 2591 2592cf_unknown= 2593 2594case $MANPAGE_FORMAT in 2595unknown) 2596 if test -z "$MANPATH" ; then 2597 MANPATH="/usr/man:/usr/share/man" 2598 fi 2599 2600 # look for the 'date' man-page (it's most likely to be installed!) 2601 MANPAGE_FORMAT= 2602 cf_preform=no 2603 cf_catonly=yes 2604 cf_example=date 2605 2606 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATHSEP}" 2607 for cf_dir in $MANPATH; do 2608 test -z "$cf_dir" && cf_dir=/usr/man 2609 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 2610 do 2611 cf_test=`echo $cf_name | sed -e 's/*//'` 2612 if test "x$cf_test" = "x$cf_name" ; then 2613 2614 case "$cf_name" in 2615 *.gz) MANPAGE_FORMAT="$MANPAGE_FORMAT gzip";; 2616 *.Z) MANPAGE_FORMAT="$MANPAGE_FORMAT compress";; 2617 *.0) MANPAGE_FORMAT="$MANPAGE_FORMAT BSDI";; 2618 *) MANPAGE_FORMAT="$MANPAGE_FORMAT normal";; 2619 esac 2620 2621 case "$cf_name" in 2622 $cf_dir/man*) 2623 cf_catonly=no 2624 ;; 2625 $cf_dir/cat*) 2626 cf_preform=yes 2627 ;; 2628 esac 2629 break 2630 fi 2631 2632 # if we found a match in either man* or cat*, stop looking 2633 if test -n "$MANPAGE_FORMAT" ; then 2634 cf_found=no 2635 test "$cf_preform" = yes && MANPAGE_FORMAT="$MANPAGE_FORMAT formatted" 2636 test "$cf_catonly" = yes && MANPAGE_FORMAT="$MANPAGE_FORMAT catonly" 2637 case "$cf_name" in 2638 $cf_dir/cat*) 2639 cf_found=yes 2640 ;; 2641 esac 2642 test $cf_found=yes && break 2643 fi 2644 done 2645 # only check the first directory in $MANPATH where we find manpages 2646 if test -n "$MANPAGE_FORMAT" ; then 2647 break 2648 fi 2649 done 2650 # if we did not find the example, just assume it is normal 2651 test -z "$MANPAGE_FORMAT" && MANPAGE_FORMAT=normal 2652 IFS="$ac_save_ifs" 2653 ;; 2654*) 2655 for cf_option in $MANPAGE_FORMAT; do 2656 case $cf_option in #(vi 2657 gzip|compress|BSDI|normal|formatted|catonly) 2658 ;; 2659 *) 2660 cf_unknown="$cf_unknown $cf_option" 2661 ;; 2662 esac 2663 done 2664 ;; 2665esac 2666 2667AC_MSG_RESULT($MANPAGE_FORMAT) 2668if test -n "$cf_unknown" ; then 2669 AC_MSG_WARN(Unexpected manpage-format $cf_unknown) 2670fi 2671])dnl 2672dnl --------------------------------------------------------------------------- 2673dnl CF_MANPAGE_RENAMES version: 7 updated: 2005/06/18 18:51:57 2674dnl ------------------ 2675dnl The Debian people have their own naming convention for manpages. This 2676dnl option lets us override the name of the file containing renaming, or 2677dnl disable it altogether. 2678AC_DEFUN([CF_MANPAGE_RENAMES], 2679[ 2680AC_MSG_CHECKING(for manpage renaming) 2681 2682AC_ARG_WITH(manpage-renames, 2683 [ --with-manpage-renames specify manpage-renaming], 2684 [MANPAGE_RENAMES=$withval], 2685 [MANPAGE_RENAMES=yes]) 2686 2687case ".$MANPAGE_RENAMES" in #(vi 2688.no) #(vi 2689 ;; 2690.|.yes) 2691 # Debian 'man' program? 2692 if test -f /etc/debian_version ; then 2693 MANPAGE_RENAMES=`cd $srcdir && pwd`/man/man_db.renames 2694 else 2695 MANPAGE_RENAMES=no 2696 fi 2697 ;; 2698esac 2699 2700if test "$MANPAGE_RENAMES" != no ; then 2701 if test -f $srcdir/man/$MANPAGE_RENAMES ; then 2702 MANPAGE_RENAMES=`cd $srcdir/man && pwd`/$MANPAGE_RENAMES 2703 elif test ! -f $MANPAGE_RENAMES ; then 2704 AC_MSG_ERROR(not a filename: $MANPAGE_RENAMES) 2705 fi 2706 2707 test ! -d man && mkdir man 2708 2709 # Construct a sed-script to perform renaming within man-pages 2710 if test -n "$MANPAGE_RENAMES" ; then 2711 test ! -d man && mkdir man 2712 sh $srcdir/man/make_sed.sh $MANPAGE_RENAMES >./edit_man.sed 2713 fi 2714fi 2715 2716AC_MSG_RESULT($MANPAGE_RENAMES) 2717AC_SUBST(MANPAGE_RENAMES) 2718])dnl 2719dnl --------------------------------------------------------------------------- 2720dnl CF_MANPAGE_SYMLINKS version: 4 updated: 2003/12/13 18:01:58 2721dnl ------------------- 2722dnl Some people expect each tool to make all aliases for manpages in the 2723dnl man-directory. This accommodates the older, less-capable implementations 2724dnl of 'man', and is optional. 2725AC_DEFUN([CF_MANPAGE_SYMLINKS], 2726[ 2727AC_MSG_CHECKING(if manpage aliases will be installed) 2728 2729AC_ARG_WITH(manpage-aliases, 2730 [ --with-manpage-aliases specify manpage-aliases using .so], 2731 [MANPAGE_ALIASES=$withval], 2732 [MANPAGE_ALIASES=yes]) 2733 2734AC_MSG_RESULT($MANPAGE_ALIASES) 2735 2736if test "$LN_S" = "ln -s"; then 2737 cf_use_symlinks=yes 2738else 2739 cf_use_symlinks=no 2740fi 2741 2742MANPAGE_SYMLINKS=no 2743if test "$MANPAGE_ALIASES" = yes ; then 2744AC_MSG_CHECKING(if manpage symlinks should be used) 2745 2746AC_ARG_WITH(manpage-symlinks, 2747 [ --with-manpage-symlinks specify manpage-aliases using symlinks], 2748 [MANPAGE_SYMLINKS=$withval], 2749 [MANPAGE_SYMLINKS=$cf_use_symlinks]) 2750 2751if test "$$cf_use_symlinks" = no; then 2752if test "$MANPAGE_SYMLINKS" = yes ; then 2753 AC_MSG_WARN(cannot make symlinks, will use .so files) 2754 MANPAGE_SYMLINKS=no 2755fi 2756fi 2757 2758AC_MSG_RESULT($MANPAGE_SYMLINKS) 2759fi 2760 2761])dnl 2762dnl --------------------------------------------------------------------------- 2763dnl CF_MANPAGE_TBL version: 3 updated: 2002/01/19 22:51:32 2764dnl -------------- 2765dnl This option causes manpages to be run through tbl(1) to generate tables 2766dnl correctly. 2767AC_DEFUN([CF_MANPAGE_TBL], 2768[ 2769AC_MSG_CHECKING(for manpage tbl) 2770 2771AC_ARG_WITH(manpage-tbl, 2772 [ --with-manpage-tbl specify manpage processing with tbl], 2773 [MANPAGE_TBL=$withval], 2774 [MANPAGE_TBL=no]) 2775 2776AC_MSG_RESULT($MANPAGE_TBL) 2777])dnl 2778dnl --------------------------------------------------------------------------- 2779dnl CF_MAN_PAGES version: 31 updated: 2006/12/09 12:27:08 2780dnl ------------ 2781dnl Try to determine if the man-pages on the system are compressed, and if 2782dnl so, what format is used. Use this information to construct a script that 2783dnl will install man-pages. 2784AC_DEFUN([CF_MAN_PAGES], 2785[ 2786CF_HELP_MESSAGE(Options to Specify How Manpages are Installed:) 2787CF_MANPAGE_FORMAT 2788CF_MANPAGE_RENAMES 2789CF_MANPAGE_SYMLINKS 2790CF_MANPAGE_TBL 2791 2792 if test "$prefix" = "NONE" ; then 2793 cf_prefix="$ac_default_prefix" 2794 else 2795 cf_prefix="$prefix" 2796 fi 2797 2798 case "$MANPAGE_FORMAT" in # (vi 2799 *catonly*) # (vi 2800 cf_format=yes 2801 cf_inboth=no 2802 ;; 2803 *formatted*) # (vi 2804 cf_format=yes 2805 cf_inboth=yes 2806 ;; 2807 *) 2808 cf_format=no 2809 cf_inboth=no 2810 ;; 2811 esac 2812 2813test ! -d man && mkdir man 2814 2815cf_so_strip= 2816cf_compress= 2817case "$MANPAGE_FORMAT" in #(vi 2818*compress*) #(vi 2819 cf_so_strip="Z" 2820 cf_compress=compress 2821 ;; 2822*gzip*) #(vi 2823 cf_so_strip="gz" 2824 cf_compress=gzip 2825 ;; 2826esac 2827 2828cf_edit_man=./edit_man.sh 2829 2830cat >$cf_edit_man <<CF_EOF 2831#! /bin/sh 2832# this script is generated by the configure-script CF_MAN_PAGES macro. 2833 2834prefix="$cf_prefix" 2835datadir="$datadir" 2836 2837NCURSES_MAJOR="$NCURSES_MAJOR" 2838NCURSES_MINOR="$NCURSES_MINOR" 2839NCURSES_PATCH="$NCURSES_PATCH" 2840 2841NCURSES_OSPEED="$NCURSES_OSPEED" 2842TERMINFO="$TERMINFO" 2843 2844MKDIRS="sh `cd $srcdir && pwd`/mkinstalldirs" 2845 2846INSTALL="$INSTALL" 2847INSTALL_DATA="$INSTALL_DATA" 2848 2849transform="$program_transform_name" 2850 2851TMP=\${TMPDIR-/tmp}/man\$\$ 2852trap "rm -f \$TMP" 0 1 2 5 15 2853 2854form=\[$]1 2855shift || exit 1 2856 2857verb=\[$]1 2858shift || exit 1 2859 2860mandir=\[$]1 2861shift || exit 1 2862 2863srcdir=\[$]1 2864top_srcdir=\[$]srcdir/.. 2865shift || exit 1 2866 2867if test "\$form" = normal ; then 2868 if test "$cf_format" = yes ; then 2869 if test "$cf_inboth" = no ; then 2870 sh \[$]0 format \$verb \$mandir \$srcdir \[$]* 2871 exit $? 2872 fi 2873 fi 2874 cf_subdir=\$mandir/man 2875 cf_tables=$MANPAGE_TBL 2876else 2877 cf_subdir=\$mandir/cat 2878 cf_tables=yes 2879fi 2880 2881# process the list of source-files 2882for i in \[$]* ; do 2883case \$i in #(vi 2884*.orig|*.rej) ;; #(vi 2885*.[[0-9]]*) 2886 section=\`expr "\$i" : '.*\\.\\([[0-9]]\\)[[xm]]*'\`; 2887 if test \$verb = installing ; then 2888 if test ! -d \$cf_subdir\${section} ; then 2889 \$MKDIRS \$cf_subdir\$section 2890 fi 2891 fi 2892 aliases= 2893 cf_source=\`basename \$i\` 2894 inalias=\$cf_source 2895 test ! -f \$inalias && inalias="\$srcdir/\$inalias" 2896 if test ! -f \$inalias ; then 2897 echo .. skipped \$cf_source 2898 continue 2899 fi 2900CF_EOF 2901 2902if test "$MANPAGE_ALIASES" != no ; then 2903cat >>$cf_edit_man <<CF_EOF 2904 aliases=\`sed -f \$top_srcdir/man/manlinks.sed \$inalias | sort -u\` 2905CF_EOF 2906fi 2907 2908if test "$MANPAGE_RENAMES" = no ; then 2909cat >>$cf_edit_man <<CF_EOF 2910 # perform program transformations for section 1 man pages 2911 if test \$section = 1 ; then 2912 cf_target=\$cf_subdir\${section}/\`echo \$cf_source|sed "\${transform}"\` 2913 else 2914 cf_target=\$cf_subdir\${section}/\$cf_source 2915 fi 2916CF_EOF 2917else 2918cat >>$cf_edit_man <<CF_EOF 2919 cf_target=\`grep "^\$cf_source" $MANPAGE_RENAMES | $AWK '{print \[$]2}'\` 2920 if test -z "\$cf_target" ; then 2921 echo '? missing rename for '\$cf_source 2922 cf_target="\$cf_source" 2923 fi 2924 cf_target="\$cf_subdir\${section}/\${cf_target}" 2925CF_EOF 2926fi 2927 2928 # replace variables in man page 2929 ifelse($1,,,[ 2930 for cf_name in $1 2931 do 2932cat >>$cf_edit_man <<CF_EOF 2933 prog_$cf_name=\`echo $cf_name|sed "\${transform}"\` 2934CF_EOF 2935 done 2936 ]) 2937cat >>$cf_edit_man <<CF_EOF 2938 sed -e "s,@DATADIR@,\$datadir," \\ 2939 -e "s,@TERMINFO@,\$TERMINFO," \\ 2940 -e "s,@NCURSES_MAJOR@,\$NCURSES_MAJOR," \\ 2941 -e "s,@NCURSES_MINOR@,\$NCURSES_MINOR," \\ 2942 -e "s,@NCURSES_PATCH@,\$NCURSES_PATCH," \\ 2943 -e "s,@NCURSES_OSPEED@,\$NCURSES_OSPEED," \\ 2944CF_EOF 2945 2946 ifelse($1,,,[ 2947 for cf_name in $1 2948 do 2949 cf_NAME=`echo "$cf_name" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` 2950cat >>$cf_edit_man <<CF_EOF 2951 -e "s,@$cf_NAME@,\$prog_$cf_name," \\ 2952CF_EOF 2953 done 2954 ]) 2955 2956if test -f $MANPAGE_RENAMES ; then 2957cat >>$cf_edit_man <<CF_EOF 2958 < \$i | sed -f `pwd`/edit_man.sed >\$TMP 2959CF_EOF 2960else 2961cat >>$cf_edit_man <<CF_EOF 2962 < \$i >\$TMP 2963CF_EOF 2964fi 2965 2966cat >>$cf_edit_man <<CF_EOF 2967if test \$cf_tables = yes ; then 2968 tbl \$TMP >\$TMP.out 2969 mv \$TMP.out \$TMP 2970fi 2971CF_EOF 2972 2973if test $with_curses_h != yes ; then 2974cat >>$cf_edit_man <<CF_EOF 2975 sed -e "/\#[ ]*include/s,curses.h,ncurses.h," < \$TMP >\$TMP.out 2976 mv \$TMP.out \$TMP 2977CF_EOF 2978fi 2979 2980cat >>$cf_edit_man <<CF_EOF 2981 if test \$form = format ; then 2982 nroff -man \$TMP >\$TMP.out 2983 mv \$TMP.out \$TMP 2984 fi 2985CF_EOF 2986 2987if test -n "$cf_compress" ; then 2988cat >>$cf_edit_man <<CF_EOF 2989 if test \$verb = installing ; then 2990 if ( $cf_compress -f \$TMP ) 2991 then 2992 mv \$TMP.$cf_so_strip \$TMP 2993 fi 2994 fi 2995 cf_target="\$cf_target.$cf_so_strip" 2996CF_EOF 2997fi 2998 2999case "$MANPAGE_FORMAT" in #(vi 3000*BSDI*) 3001cat >>$cf_edit_man <<CF_EOF 3002 if test \$form = format ; then 3003 # BSDI installs only .0 suffixes in the cat directories 3004 cf_target="\`echo \$cf_target|sed -e 's/\.[[1-9]]\+[[a-z]]*/.0/'\`" 3005 fi 3006CF_EOF 3007 ;; 3008esac 3009 3010cat >>$cf_edit_man <<CF_EOF 3011 suffix=\`basename \$cf_target | sed -e 's%^[[^.]]*%%'\` 3012 if test \$verb = installing ; then 3013 echo \$verb \$cf_target 3014 \$INSTALL_DATA \$TMP \$cf_target 3015 test -n "\$aliases" && ( 3016 cd \$cf_subdir\${section} && ( 3017 cf_source=\`echo \$cf_target |sed -e 's%^.*/\([[^/]][[^/]]*/[[^/]][[^/]]*$\)%\1%'\` 3018 test -n "$cf_so_strip" && cf_source=\`echo \$cf_source |sed -e 's%\.$cf_so_strip\$%%'\` 3019 cf_target=\`basename \$cf_target\` 3020 for cf_alias in \$aliases 3021 do 3022 if test \$section = 1 ; then 3023 cf_alias=\`echo \$cf_alias|sed "\${transform}"\` 3024 fi 3025 3026 if test "$MANPAGE_SYMLINKS" = yes ; then 3027 if test -f \$cf_alias\${suffix} ; then 3028 if ( cmp -s \$cf_target \$cf_alias\${suffix} ) 3029 then 3030 continue 3031 fi 3032 fi 3033 echo .. \$verb alias \$cf_alias\${suffix} 3034 rm -f \$cf_alias\${suffix} 3035 $LN_S \$cf_target \$cf_alias\${suffix} 3036 elif test "\$cf_target" != "\$cf_alias\${suffix}" ; then 3037 echo ".so \$cf_source" >\$TMP 3038CF_EOF 3039if test -n "$cf_compress" ; then 3040cat >>$cf_edit_man <<CF_EOF 3041 if test -n "$cf_so_strip" ; then 3042 $cf_compress -f \$TMP 3043 mv \$TMP.$cf_so_strip \$TMP 3044 fi 3045CF_EOF 3046fi 3047cat >>$cf_edit_man <<CF_EOF 3048 echo .. \$verb alias \$cf_alias\${suffix} 3049 rm -f \$cf_alias\${suffix} 3050 \$INSTALL_DATA \$TMP \$cf_alias\${suffix} 3051 fi 3052 done 3053 ) 3054 ) 3055 elif test \$verb = removing ; then 3056 echo \$verb \$cf_target 3057 rm -f \$cf_target 3058 test -n "\$aliases" && ( 3059 cd \$cf_subdir\${section} && ( 3060 for cf_alias in \$aliases 3061 do 3062 if test \$section = 1 ; then 3063 cf_alias=\`echo \$cf_alias|sed "\${transform}"\` 3064 fi 3065 3066 echo .. \$verb alias \$cf_alias\${suffix} 3067 rm -f \$cf_alias\${suffix} 3068 done 3069 ) 3070 ) 3071 else 3072# echo ".hy 0" 3073 cat \$TMP 3074 fi 3075 ;; 3076esac 3077done 3078 3079if test $cf_inboth = yes ; then 3080if test \$form != format ; then 3081 sh \[$]0 format \$verb \$mandir \$srcdir \[$]* 3082fi 3083fi 3084 3085exit 0 3086CF_EOF 3087chmod 755 $cf_edit_man 3088 3089])dnl 3090dnl --------------------------------------------------------------------------- 3091dnl CF_MATH_LIB version: 5 updated: 2000/05/28 01:39:10 3092dnl ----------- 3093dnl Checks for libraries. At least one UNIX system, Apple Macintosh 3094dnl Rhapsody 5.5, does not have -lm. We cannot use the simpler 3095dnl AC_CHECK_LIB(m,sin), because that fails for C++. 3096AC_DEFUN([CF_MATH_LIB], 3097[ 3098AC_CACHE_CHECK(if -lm needed for math functions, 3099 cf_cv_need_libm,[ 3100 AC_TRY_LINK([ 3101 #include <stdio.h> 3102 #include <math.h> 3103 ], 3104 [double x = rand(); printf("result = %g\n", ]ifelse($2,,sin(x),$2)[)], 3105 [cf_cv_need_libm=no], 3106 [cf_cv_need_libm=yes])]) 3107if test "$cf_cv_need_libm" = yes 3108then 3109ifelse($1,,[ 3110 LIBS="$LIBS -lm" 3111],[$1=-lm]) 3112fi 3113]) 3114dnl --------------------------------------------------------------------------- 3115dnl CF_MIXEDCASE_FILENAMES version: 3 updated: 2003/09/20 17:07:55 3116dnl ---------------------- 3117dnl Check if the file-system supports mixed-case filenames. If we're able to 3118dnl create a lowercase name and see it as uppercase, it doesn't support that. 3119AC_DEFUN([CF_MIXEDCASE_FILENAMES], 3120[ 3121AC_CACHE_CHECK(if filesystem supports mixed-case filenames,cf_cv_mixedcase,[ 3122if test "$cross_compiling" = yes ; then 3123 case $target_alias in #(vi 3124 *-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-mingw32*|*-uwin*) #(vi 3125 cf_cv_mixedcase=no 3126 ;; 3127 *) 3128 cf_cv_mixedcase=yes 3129 ;; 3130 esac 3131else 3132 rm -f conftest CONFTEST 3133 echo test >conftest 3134 if test -f CONFTEST ; then 3135 cf_cv_mixedcase=no 3136 else 3137 cf_cv_mixedcase=yes 3138 fi 3139 rm -f conftest CONFTEST 3140fi 3141]) 3142test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES) 3143])dnl 3144dnl --------------------------------------------------------------------------- 3145dnl CF_MKSTEMP version: 5 updated: 2006/12/16 12:33:30 3146dnl ---------- 3147dnl Check for a working mkstemp. This creates two files, checks that they are 3148dnl successfully created and distinct (AmigaOS apparently fails on the last). 3149AC_DEFUN([CF_MKSTEMP],[ 3150AC_CACHE_CHECK(for working mkstemp, cf_cv_func_mkstemp,[ 3151rm -f conftest* 3152AC_TRY_RUN([ 3153#include <sys/types.h> 3154#include <stdlib.h> 3155#include <stdio.h> 3156#include <string.h> 3157#include <sys/stat.h> 3158int main() 3159{ 3160 char *tmpl = "conftestXXXXXX"; 3161 char name[2][80]; 3162 int n; 3163 int result = 0; 3164 int fd; 3165 struct stat sb; 3166 3167 umask(077); 3168 for (n = 0; n < 2; ++n) { 3169 strcpy(name[n], tmpl); 3170 if ((fd = mkstemp(name[n])) >= 0) { 3171 if (!strcmp(name[n], tmpl) 3172 || stat(name[n], &sb) != 0 3173 || (sb.st_mode & S_IFMT) != S_IFREG 3174 || (sb.st_mode & 077) != 0) { 3175 result = 1; 3176 } 3177 close(fd); 3178 } 3179 } 3180 if (result == 0 3181 && !strcmp(name[0], name[1])) 3182 result = 1; 3183 ${cf_cv_main_return:-return}(result); 3184} 3185],[cf_cv_func_mkstemp=yes 3186],[cf_cv_func_mkstemp=no 3187],[AC_CHECK_FUNC(mkstemp) 3188]) 3189]) 3190if test "$cf_cv_func_mkstemp" = yes ; then 3191 AC_DEFINE(HAVE_MKSTEMP) 3192fi 3193])dnl 3194dnl --------------------------------------------------------------------------- 3195dnl CF_MSG_LOG version: 3 updated: 1997/09/07 14:05:52 3196dnl ---------- 3197dnl Write a debug message to config.log, along with the line number in the 3198dnl configure script. 3199AC_DEFUN([CF_MSG_LOG],[ 3200echo "(line __oline__) testing $* ..." 1>&AC_FD_CC 3201])dnl 3202dnl --------------------------------------------------------------------------- 3203dnl CF_NCURSES_ABI_6 version: 1 updated: 2005/09/17 18:42:49 3204dnl ---------------- 3205dnl Set ncurses' ABI to 6 unless overridden by explicit configure option, and 3206dnl warn about this. 3207AC_DEFUN([CF_NCURSES_ABI_6],[ 3208if test "${with_abi_version+set}" != set; then 3209 case $cf_cv_rel_version in 3210 5.*) 3211 cf_cv_rel_version=6.0 3212 cf_cv_abi_version=6 3213 AC_MSG_WARN(Overriding ABI version to $cf_cv_abi_version) 3214 ;; 3215 esac 3216fi 3217])dnl 3218dnl --------------------------------------------------------------------------- 3219dnl CF_NO_LEAKS_OPTION version: 4 updated: 2006/12/16 14:24:05 3220dnl ------------------ 3221dnl see CF_WITH_NO_LEAKS 3222AC_DEFUN([CF_NO_LEAKS_OPTION],[ 3223AC_MSG_CHECKING(if you want to use $1 for testing) 3224AC_ARG_WITH($1, 3225 [$2], 3226 [AC_DEFINE($3)ifelse([$4],,[ 3227 $4 3228]) 3229 : ${with_cflags:=-g} 3230 : ${with_no_leaks:=yes} 3231 with_$1=yes], 3232 [with_$1=]) 3233AC_MSG_RESULT(${with_$1:-no}) 3234 3235case .$with_cflags in #(vi 3236.*-g*) 3237 case .$CFLAGS in #(vi 3238 .*-g*) #(vi 3239 ;; 3240 *) 3241 CF_ADD_CFLAGS([-g]) 3242 ;; 3243 esac 3244 ;; 3245esac 3246])dnl 3247dnl --------------------------------------------------------------------------- 3248dnl CF_NUMBER_SYNTAX version: 1 updated: 2003/09/20 18:12:49 3249dnl ---------------- 3250dnl Check if the given variable is a number. If not, report an error. 3251dnl $1 is the variable 3252dnl $2 is the message 3253AC_DEFUN([CF_NUMBER_SYNTAX],[ 3254if test -n "$1" ; then 3255 case $1 in #(vi 3256 [[0-9]]*) #(vi 3257 ;; 3258 *) 3259 AC_MSG_ERROR($2 is not a number: $1) 3260 ;; 3261 esac 3262else 3263 AC_MSG_ERROR($2 value is empty) 3264fi 3265])dnl 3266dnl --------------------------------------------------------------------------- 3267dnl CF_OBJ_SUBDIR version: 4 updated: 2002/02/23 20:38:31 3268dnl ------------- 3269dnl Compute the object-directory name from the given model name 3270AC_DEFUN([CF_OBJ_SUBDIR], 3271[ 3272 case $1 in 3273 libtool) $2='obj_lo' ;; 3274 normal) $2='objects' ;; 3275 debug) $2='obj_g' ;; 3276 profile) $2='obj_p' ;; 3277 shared) 3278 case $cf_cv_system_name in #(vi 3279 cygwin) #(vi 3280 $2='objects' ;; 3281 *) 3282 $2='obj_s' ;; 3283 esac 3284 esac 3285])dnl 3286dnl --------------------------------------------------------------------------- 3287dnl CF_PATHSEP version: 3 updated: 2001/01/12 01:23:53 3288dnl ---------- 3289dnl Provide a value for the $PATH and similar separator 3290AC_DEFUN([CF_PATHSEP], 3291[ 3292 case $cf_cv_system_name in 3293 os2*) PATHSEP=';' ;; 3294 *) PATHSEP=':' ;; 3295 esac 3296ifelse($1,,,[$1=$PATHSEP]) 3297 AC_SUBST(PATHSEP) 3298])dnl 3299dnl --------------------------------------------------------------------------- 3300dnl CF_PATH_SYNTAX version: 11 updated: 2006/09/02 08:55:46 3301dnl -------------- 3302dnl Check the argument to see that it looks like a pathname. Rewrite it if it 3303dnl begins with one of the prefix/exec_prefix variables, and then again if the 3304dnl result begins with 'NONE'. This is necessary to work around autoconf's 3305dnl delayed evaluation of those symbols. 3306AC_DEFUN([CF_PATH_SYNTAX],[ 3307if test "x$prefix" != xNONE; then 3308 cf_path_syntax="$prefix" 3309else 3310 cf_path_syntax="$ac_default_prefix" 3311fi 3312 3313case ".[$]$1" in #(vi 3314.\[$]\(*\)*|.\'*\'*) #(vi 3315 ;; 3316..|./*|.\\*) #(vi 3317 ;; 3318.[[a-zA-Z]]:[[\\/]]*) #(vi OS/2 EMX 3319 ;; 3320.\[$]{*prefix}*) #(vi 3321 eval $1="[$]$1" 3322 case ".[$]$1" in #(vi 3323 .NONE/*) 3324 $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%` 3325 ;; 3326 esac 3327 ;; #(vi 3328.no|.NONE/*) 3329 $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%` 3330 ;; 3331*) 3332 ifelse($2,,[AC_ERROR([expected a pathname, not \"[$]$1\"])],$2) 3333 ;; 3334esac 3335])dnl 3336dnl --------------------------------------------------------------------------- 3337dnl CF_POSIX_C_SOURCE version: 6 updated: 2005/07/14 20:25:10 3338dnl ----------------- 3339dnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed. 3340dnl 3341dnl POSIX.1-1990 _POSIX_SOURCE 3342dnl POSIX.1-1990 and _POSIX_SOURCE and 3343dnl POSIX.2-1992 C-Language _POSIX_C_SOURCE=2 3344dnl Bindings Option 3345dnl POSIX.1b-1993 _POSIX_C_SOURCE=199309L 3346dnl POSIX.1c-1996 _POSIX_C_SOURCE=199506L 3347dnl X/Open 2000 _POSIX_C_SOURCE=200112L 3348dnl 3349dnl Parameters: 3350dnl $1 is the nominal value for _POSIX_C_SOURCE 3351AC_DEFUN([CF_POSIX_C_SOURCE], 3352[ 3353cf_POSIX_C_SOURCE=ifelse($1,,199506L,$1) 3354 3355cf_save_CFLAGS="$CFLAGS" 3356cf_save_CPPFLAGS="$CPPFLAGS" 3357 3358CF_REMOVE_DEFINE(cf_trim_CFLAGS,$cf_save_CFLAGS,_POSIX_C_SOURCE) 3359CF_REMOVE_DEFINE(cf_trim_CPPFLAGS,$cf_save_CPPFLAGS,_POSIX_C_SOURCE) 3360 3361AC_CACHE_CHECK(if we should define _POSIX_C_SOURCE,cf_cv_posix_c_source,[ 3362 CF_MSG_LOG(if the symbol is already defined go no further) 3363 AC_TRY_COMPILE([#include <sys/types.h>],[ 3364#ifndef _POSIX_C_SOURCE 3365make an error 3366#endif], 3367 [cf_cv_posix_c_source=no], 3368 [cf_want_posix_source=no 3369 case .$cf_POSIX_C_SOURCE in #(vi 3370 .[[12]]??*) #(vi 3371 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" 3372 ;; 3373 .2) #(vi 3374 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" 3375 cf_want_posix_source=yes 3376 ;; 3377 .*) 3378 cf_want_posix_source=yes 3379 ;; 3380 esac 3381 if test "$cf_want_posix_source" = yes ; then 3382 AC_TRY_COMPILE([#include <sys/types.h>],[ 3383#ifdef _POSIX_SOURCE 3384make an error 3385#endif],[], 3386 cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE") 3387 fi 3388 CF_MSG_LOG(ifdef from value $cf_POSIX_C_SOURCE) 3389 CFLAGS="$cf_trim_CFLAGS" 3390 CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source" 3391 CF_MSG_LOG(if the second compile does not leave our definition intact error) 3392 AC_TRY_COMPILE([#include <sys/types.h>],[ 3393#ifndef _POSIX_C_SOURCE 3394make an error 3395#endif],, 3396 [cf_cv_posix_c_source=no]) 3397 CFLAGS="$cf_save_CFLAGS" 3398 CPPFLAGS="$cf_save_CPPFLAGS" 3399 ]) 3400]) 3401 3402if test "$cf_cv_posix_c_source" != no ; then 3403 CFLAGS="$cf_trim_CFLAGS" 3404 CPPFLAGS="$cf_trim_CPPFLAGS" 3405 if test "$cf_cv_cc_u_d_options" = yes ; then 3406 cf_temp_posix_c_source=`echo "$cf_cv_posix_c_source" | \ 3407 sed -e 's/-D/-U/g' -e 's/=[[^ ]]*//g'` 3408 CPPFLAGS="$CPPFLAGS $cf_temp_posix_c_source" 3409 fi 3410 CPPFLAGS="$CPPFLAGS $cf_cv_posix_c_source" 3411fi 3412 3413])dnl 3414dnl --------------------------------------------------------------------------- 3415dnl CF_PREDEFINE version: 1 updated: 2003/07/26 17:53:56 3416dnl ------------ 3417dnl Add definitions to CPPFLAGS to ensure they're predefined for all compiles. 3418dnl 3419dnl $1 = symbol to test 3420dnl $2 = value (if any) to use for a predefinition 3421AC_DEFUN([CF_PREDEFINE], 3422[ 3423AC_MSG_CHECKING(if we must define $1) 3424AC_TRY_COMPILE([#include <sys/types.h> 3425],[ 3426#ifndef $1 3427make an error 3428#endif],[cf_result=no],[cf_result=yes]) 3429AC_MSG_RESULT($cf_result) 3430 3431if test "$cf_result" = yes ; then 3432 CPPFLAGS="$CPPFLAGS ifelse($2,,-D$1,[-D$1=$2])" 3433elif test "x$2" != "x" ; then 3434 AC_MSG_CHECKING(checking for compatible value versus $2) 3435 AC_TRY_COMPILE([#include <sys/types.h> 3436],[ 3437#if $1-$2 < 0 3438make an error 3439#endif],[cf_result=yes],[cf_result=no]) 3440 AC_MSG_RESULT($cf_result) 3441 if test "$cf_result" = no ; then 3442 # perhaps we can override it - try... 3443 CPPFLAGS="$CPPFLAGS -D$1=$2" 3444 fi 3445fi 3446])dnl 3447dnl --------------------------------------------------------------------------- 3448dnl CF_PRG_RULES version: 1 updated: 2006/06/03 11:45:08 3449dnl ------------ 3450dnl Append definitions and rules for the given programs to the subdirectory 3451dnl Makefiles, and the recursion rule for the top-level Makefile. 3452dnl 3453dnl parameters 3454dnl $1 = script to run 3455dnl $2 = list of subdirectories 3456dnl 3457dnl variables 3458dnl $AWK 3459AC_DEFUN([CF_PRG_RULES], 3460[ 3461for cf_dir in $2 3462do 3463 if test ! -d $srcdir/$cf_dir; then 3464 continue 3465 elif test -f $srcdir/$cf_dir/programs; then 3466 $AWK -f $1 $srcdir/$cf_dir/programs >>$cf_dir/Makefile 3467 fi 3468done 3469 3470])dnl 3471dnl --------------------------------------------------------------------------- 3472dnl CF_PROG_AWK version: 1 updated: 2006/09/16 11:40:59 3473dnl ----------- 3474dnl Check for awk, ensure that the check found something. 3475AC_DEFUN([CF_PROG_AWK], 3476[ 3477AC_PROG_AWK 3478test -z "$AWK" && AC_MSG_ERROR(No awk program found) 3479])dnl 3480dnl --------------------------------------------------------------------------- 3481dnl CF_PROG_CC_C_O version: 2 updated: 2006/12/16 15:55:46 3482dnl -------------- 3483dnl Analogous to AC_PROG_CC_C_O, but more useful: tests only $CC, ensures that 3484dnl the output file can be renamed, and allows for a shell variable that can 3485dnl be used later. The parameter is either CC or CXX. The result is the 3486dnl cache variable: 3487dnl $cf_cv_prog_CC_c_o 3488dnl $cf_cv_prog_CXX_c_o 3489AC_DEFUN([CF_PROG_CC_C_O], 3490[AC_REQUIRE([AC_PROG_CC])dnl 3491AC_MSG_CHECKING([whether [$]$1 understands -c and -o together]) 3492AC_CACHE_VAL(cf_cv_prog_$1_c_o, 3493[ 3494cat > conftest.$ac_ext <<CF_EOF 3495#include <stdio.h> 3496int main() 3497{ 3498 ${cf_cv_main_return:-return}(0); 3499} 3500CF_EOF 3501# We do the test twice because some compilers refuse to overwrite an 3502# existing .o file with -o, though they will create one. 3503ac_try='[$]$1 -c conftest.$ac_ext -o conftest2.$ac_objext >&AC_FD_CC' 3504if AC_TRY_EVAL(ac_try) && 3505 test -f conftest2.$ac_objext && AC_TRY_EVAL(ac_try); 3506then 3507 eval cf_cv_prog_$1_c_o=yes 3508else 3509 eval cf_cv_prog_$1_c_o=no 3510fi 3511rm -f conftest* 3512])dnl 3513if test $cf_cv_prog_$1_c_o = yes; then 3514 AC_MSG_RESULT([yes]) 3515else 3516 AC_MSG_RESULT([no]) 3517fi 3518])dnl 3519dnl --------------------------------------------------------------------------- 3520dnl CF_PROG_CC_U_D version: 1 updated: 2005/07/14 16:59:30 3521dnl -------------- 3522dnl Check if C (preprocessor) -U and -D options are processed in the order 3523dnl given rather than by type of option. Some compilers insist on apply all 3524dnl of the -U options after all of the -D options. Others allow mixing them, 3525dnl and may predefine symbols that conflict with those we define. 3526AC_DEFUN([CF_PROG_CC_U_D], 3527[ 3528AC_CACHE_CHECK(if $CC -U and -D options work together,cf_cv_cc_u_d_options,[ 3529 cf_save_CPPFLAGS="$CPPFLAGS" 3530 CPPFLAGS="-UU_D_OPTIONS -DU_D_OPTIONS -DD_U_OPTIONS -UD_U_OPTIONS" 3531 AC_TRY_COMPILE([],[ 3532#ifndef U_D_OPTIONS 3533make an undefined-error 3534#endif 3535#ifdef D_U_OPTIONS 3536make a defined-error 3537#endif 3538 ],[ 3539 cf_cv_cc_u_d_options=yes],[ 3540 cf_cv_cc_u_d_options=no]) 3541 CPPFLAGS="$cf_save_CPPFLAGS" 3542]) 3543])dnl 3544dnl --------------------------------------------------------------------------- 3545dnl CF_PROG_EGREP version: 1 updated: 2006/09/16 11:40:59 3546dnl ------------- 3547dnl AC_PROG_EGREP was introduced in autoconf 2.53. 3548dnl This macro adds a check to ensure the script found something. 3549AC_DEFUN([CF_PROG_EGREP], 3550[AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep], 3551 [if echo a | (grep -E '(a|b)') >/dev/null 2>&1 3552 then ac_cv_prog_egrep='grep -E' 3553 else ac_cv_prog_egrep='egrep' 3554 fi]) 3555 EGREP=$ac_cv_prog_egrep 3556 AC_SUBST([EGREP]) 3557test -z "$EGREP" && AC_MSG_ERROR(No egrep program found) 3558])dnl 3559dnl --------------------------------------------------------------------------- 3560dnl CF_PROG_EXT version: 10 updated: 2004/01/03 19:28:18 3561dnl ----------- 3562dnl Compute $PROG_EXT, used for non-Unix ports, such as OS/2 EMX. 3563AC_DEFUN([CF_PROG_EXT], 3564[ 3565AC_REQUIRE([CF_CHECK_CACHE]) 3566case $cf_cv_system_name in 3567os2*) 3568 CFLAGS="$CFLAGS -Zmt" 3569 CPPFLAGS="$CPPFLAGS -D__ST_MT_ERRNO__" 3570 CXXFLAGS="$CXXFLAGS -Zmt" 3571 # autoconf's macro sets -Zexe and suffix both, which conflict:w 3572 LDFLAGS="$LDFLAGS -Zmt -Zcrtdll" 3573 ac_cv_exeext=.exe 3574 ;; 3575esac 3576 3577AC_EXEEXT 3578AC_OBJEXT 3579 3580PROG_EXT="$EXEEXT" 3581AC_SUBST(PROG_EXT) 3582test -n "$PROG_EXT" && AC_DEFINE_UNQUOTED(PROG_EXT,"$PROG_EXT") 3583])dnl 3584dnl --------------------------------------------------------------------------- 3585dnl CF_PROG_INSTALL version: 5 updated: 2002/12/21 22:46:07 3586dnl --------------- 3587dnl Force $INSTALL to be an absolute-path. Otherwise, edit_man.sh and the 3588dnl misc/tabset install won't work properly. Usually this happens only when 3589dnl using the fallback mkinstalldirs script 3590AC_DEFUN([CF_PROG_INSTALL], 3591[AC_PROG_INSTALL 3592case $INSTALL in 3593/*) 3594 ;; 3595*) 3596 CF_DIRNAME(cf_dir,$INSTALL) 3597 test -z "$cf_dir" && cf_dir=. 3598 INSTALL=`cd $cf_dir && pwd`/`echo $INSTALL | sed -e 's%^.*/%%'` 3599 ;; 3600esac 3601])dnl 3602dnl --------------------------------------------------------------------------- 3603dnl CF_PROG_LDCONFIG version: 1 updated: 2003/09/20 17:07:55 3604dnl ---------------- 3605dnl Check for ldconfig, needed to fixup shared libraries that would be built 3606dnl and then used in the install. 3607AC_DEFUN([CF_PROG_LDCONFIG],[ 3608if test "$cross_compiling" = yes ; then 3609 LDCONFIG=: 3610else 3611case "$cf_cv_system_name" in #(vi 3612freebsd*) #(vi 3613 test -z "$LDCONFIG" && LDCONFIG="/sbin/ldconfig -R" 3614 ;; 3615*) LDPATH=$PATH:/sbin:/usr/sbin 3616 AC_PATH_PROG(LDCONFIG,ldconfig,,$LDPATH) 3617 ;; 3618esac 3619fi 3620AC_SUBST(LDCONFIG) 3621])dnl 3622dnl --------------------------------------------------------------------------- 3623dnl CF_PROG_LINT version: 1 updated: 2006/09/16 11:40:59 3624dnl ------------ 3625AC_DEFUN([CF_PROG_LINT], 3626[ 3627AC_CHECK_PROGS(LINT, tdlint lint alint) 3628AC_SUBST(LINT_OPTS) 3629])dnl 3630dnl --------------------------------------------------------------------------- 3631dnl CF_REGEX version: 3 updated: 1997/11/01 14:26:01 3632dnl -------- 3633dnl Attempt to determine if we've got one of the flavors of regular-expression 3634dnl code that we can support. 3635AC_DEFUN([CF_REGEX], 3636[ 3637AC_MSG_CHECKING([for regular-expression headers]) 3638AC_CACHE_VAL(cf_cv_regex,[ 3639AC_TRY_LINK([#include <sys/types.h> 3640#include <regex.h>],[ 3641 regex_t *p; 3642 int x = regcomp(p, "", 0); 3643 int y = regexec(p, "", 0, 0, 0); 3644 regfree(p); 3645 ],[cf_cv_regex="regex.h"],[ 3646 AC_TRY_LINK([#include <regexp.h>],[ 3647 char *p = compile("", "", "", 0); 3648 int x = step("", ""); 3649 ],[cf_cv_regex="regexp.h"],[ 3650 cf_save_LIBS="$LIBS" 3651 LIBS="-lgen $LIBS" 3652 AC_TRY_LINK([#include <regexpr.h>],[ 3653 char *p = compile("", "", ""); 3654 int x = step("", ""); 3655 ],[cf_cv_regex="regexpr.h"],[LIBS="$cf_save_LIBS"])])]) 3656]) 3657AC_MSG_RESULT($cf_cv_regex) 3658case $cf_cv_regex in 3659 regex.h) AC_DEFINE(HAVE_REGEX_H_FUNCS) ;; 3660 regexp.h) AC_DEFINE(HAVE_REGEXP_H_FUNCS) ;; 3661 regexpr.h) AC_DEFINE(HAVE_REGEXPR_H_FUNCS) ;; 3662esac 3663])dnl 3664dnl --------------------------------------------------------------------------- 3665dnl CF_REMOVE_DEFINE version: 2 updated: 2005/07/09 16:12:18 3666dnl ---------------- 3667dnl Remove all -U and -D options that refer to the given symbol from a list 3668dnl of C compiler options. This works around the problem that not all 3669dnl compilers process -U and -D options from left-to-right, so a -U option 3670dnl cannot be used to cancel the effect of a preceding -D option. 3671dnl 3672dnl $1 = target (which could be the same as the source variable) 3673dnl $2 = source (including '$') 3674dnl $3 = symbol to remove 3675define([CF_REMOVE_DEFINE], 3676[ 3677# remove $3 symbol from $2 3678$1=`echo "$2" | \ 3679 sed -e 's/-[[UD]]$3\(=[[^ ]]*\)\?[[ ]]/ /g' \ 3680 -e 's/-[[UD]]$3\(=[[^ ]]*\)\?[$]//g'` 3681])dnl 3682dnl --------------------------------------------------------------------------- 3683dnl CF_SHARED_OPTS version: 41 updated: 2006/12/09 12:32:00 3684dnl -------------- 3685dnl -------------- 3686dnl Attempt to determine the appropriate CC/LD options for creating a shared 3687dnl library. 3688dnl 3689dnl Note: ${LOCAL_LDFLAGS} is used to link executables that will run within the 3690dnl build-tree, i.e., by making use of the libraries that are compiled in ../lib 3691dnl We avoid compiling-in a ../lib path for the shared library since that can 3692dnl lead to unexpected results at runtime. 3693dnl ${LOCAL_LDFLAGS2} has the same intention but assumes that the shared libraries 3694dnl are compiled in ../../lib 3695dnl 3696dnl The variable 'cf_cv_do_symlinks' is used to control whether we configure 3697dnl to install symbolic links to the rel/abi versions of shared libraries. 3698dnl 3699dnl The variable 'cf_cv_shlib_version' controls whether we use the rel or abi 3700dnl version when making symbolic links. 3701dnl 3702dnl The variable 'cf_cv_shlib_version_infix' controls whether shared library 3703dnl version numbers are infix (ex: libncurses.<ver>.dylib) or postfix 3704dnl (ex: libncurses.so.<ver>). 3705dnl 3706dnl Some loaders leave 'so_locations' lying around. It's nice to clean up. 3707AC_DEFUN([CF_SHARED_OPTS], 3708[ 3709 AC_REQUIRE([CF_SUBST_NCURSES_VERSION]) 3710 LOCAL_LDFLAGS= 3711 LOCAL_LDFLAGS2= 3712 LD_SHARED_OPTS= 3713 INSTALL_LIB="-m 644" 3714 3715 cf_cv_do_symlinks=no 3716 3717 AC_MSG_CHECKING(if release/abi version should be used for shared libs) 3718 AC_ARG_WITH(shlib-version, 3719 [ --with-shlib-version=X Specify rel or abi version for shared libs], 3720 [test -z "$withval" && withval=auto 3721 case $withval in #(vi 3722 yes) #(vi 3723 cf_cv_shlib_version=auto 3724 ;; 3725 rel|abi|auto|no) #(vi 3726 cf_cv_shlib_version=$withval 3727 ;; 3728 *) 3729 AC_ERROR([option value must be one of: rel, abi, auto or no]) 3730 ;; 3731 esac 3732 ],[cf_cv_shlib_version=auto]) 3733 AC_MSG_RESULT($cf_cv_shlib_version) 3734 3735 cf_cv_rm_so_locs=no 3736 3737 # Some less-capable ports of gcc support only -fpic 3738 CC_SHARED_OPTS= 3739 if test "$GCC" = yes 3740 then 3741 AC_MSG_CHECKING(which $CC option to use) 3742 cf_save_CFLAGS="$CFLAGS" 3743 for CC_SHARED_OPTS in -fPIC -fpic '' 3744 do 3745 CFLAGS="$cf_save_CFLAGS $CC_SHARED_OPTS" 3746 AC_TRY_COMPILE([#include <stdio.h>],[int x = 1],[break],[]) 3747 done 3748 AC_MSG_RESULT($CC_SHARED_OPTS) 3749 CFLAGS="$cf_save_CFLAGS" 3750 fi 3751 3752 cf_cv_shlib_version_infix=no 3753 3754 case $cf_cv_system_name in 3755 beos*) 3756 MK_SHARED_LIB='${CC} ${CFLAGS} -o $[@] -Xlinker -soname=`basename $[@]` -nostart -e 0' 3757 ;; 3758 cygwin*) 3759 CC_SHARED_OPTS= 3760 MK_SHARED_LIB='${CC} ${CFLAGS} -shared -Wl,--out-implib=../lib/${IMPORT_LIB} -Wl,--export-all-symbols -o ../lib/${SHARED_LIB}' 3761 cf_cv_shlib_version=cygdll 3762 cf_cv_shlib_version_infix=cygdll 3763 ;; 3764 darwin*) 3765 EXTRA_CFLAGS="-no-cpp-precomp" 3766 CC_SHARED_OPTS="-dynamic" 3767 MK_SHARED_LIB='${CC} ${CFLAGS} -dynamiclib -install_name ${DESTDIR}${libdir}/`basename $[@]` -compatibility_version ${ABI_VERSION} -current_version ${ABI_VERSION} -o $[@]' 3768 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=abi 3769 cf_cv_shlib_version_infix=yes 3770 AC_CACHE_CHECK([if ld -search_paths_first works], cf_cv_ldflags_search_paths_first, [ 3771 cf_save_LDFLAGS=$LDFLAGS 3772 LDFLAGS="$LDFLAGS -Wl,-search_paths_first" 3773 AC_TRY_LINK(, [int i;], cf_cv_ldflags_search_paths_first=yes, cf_cv_ldflags_search_paths_first=no) 3774 LDFLAGS=$cf_save_LDFLAGS]) 3775 if test $cf_cv_ldflags_search_paths_first = yes; then 3776 LDFLAGS="$LDFLAGS -Wl,-search_paths_first" 3777 fi 3778 ;; 3779 hpux*) 3780 # (tested with gcc 2.7.2 -- I don't have c89) 3781 if test "$GCC" = yes; then 3782 LD_SHARED_OPTS='-Xlinker +b -Xlinker ${libdir}' 3783 else 3784 CC_SHARED_OPTS='+Z' 3785 LD_SHARED_OPTS='-Wl,+b,${libdir}' 3786 fi 3787 MK_SHARED_LIB='${LD} +b ${libdir} -b -o $[@]' 3788 # HP-UX shared libraries must be executable, and should be 3789 # readonly to exploit a quirk in the memory manager. 3790 INSTALL_LIB="-m 555" 3791 ;; 3792 irix*) 3793 if test "$cf_cv_ld_rpath" = yes ; then 3794 if test "$GCC" = yes; then 3795 cf_ld_rpath_opt="-Wl,-rpath," 3796 EXTRA_LDFLAGS="-Wl,-rpath,\${libdir} $EXTRA_LDFLAGS" 3797 else 3798 cf_ld_rpath_opt="-rpath " 3799 EXTRA_LDFLAGS="-rpath \${libdir} $EXTRA_LDFLAGS" 3800 fi 3801 fi 3802 # tested with IRIX 5.2 and 'cc'. 3803 if test "$GCC" != yes; then 3804 CC_SHARED_OPTS='-KPIC' 3805 fi 3806 MK_SHARED_LIB='${CC} -shared -rdata_shared -soname `basename $[@]` -o $[@]' 3807 cf_cv_rm_so_locs=yes 3808 ;; 3809 linux*|gnu*|k*bsd*-gnu) 3810 if test "$DFT_LWR_MODEL" = "shared" ; then 3811 LOCAL_LDFLAGS="-Wl,-rpath,\$(LOCAL_LIBDIR)" 3812 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS" 3813 fi 3814 if test "$cf_cv_ld_rpath" = yes ; then 3815 cf_ld_rpath_opt="-Wl,-rpath," 3816 EXTRA_LDFLAGS="-Wl,-rpath,\${libdir} $EXTRA_LDFLAGS" 3817 fi 3818 CF_SHARED_SONAME 3819 MK_SHARED_LIB='${CC} ${CFLAGS} -shared -Wl,-soname,'$cf_shared_soname',-stats,-lc -o $[@]' 3820 ;; 3821 openbsd2*) 3822 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC" 3823 MK_SHARED_LIB='${LD} -Bshareable -soname,`basename $[@].${ABI_VERSION}` -o $[@]' 3824 ;; 3825 openbsd*|freebsd[[23]]*) 3826 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC" 3827 MK_SHARED_LIB='${LD} -Bshareable -o $[@]' 3828 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel 3829 ;; 3830 freebsd*) 3831 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC" 3832 if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_ld_rpath" = yes ; then 3833 LOCAL_LDFLAGS="-rpath \$(LOCAL_LIBDIR)" 3834 LOCAL_LDFLAGS2="-rpath \${libdir} $LOCAL_LDFLAGS" 3835 cf_ld_rpath_opt="-rpath " 3836 EXTRA_LDFLAGS="-rpath \${libdir} $EXTRA_LDFLAGS" 3837 fi 3838 CF_SHARED_SONAME 3839 MK_SHARED_LIB='${LD} -Bshareable -soname=`basename $[@]` -o $[@]' 3840 ;; 3841 netbsd*) 3842 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC" 3843 test "$cf_cv_ld_rpath" = yes && cf_ld_rpath_opt="-Wl,-rpath," 3844 if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_ld_rpath" = yes ; then 3845 LOCAL_LDFLAGS="-Wl,-rpath,\$(LOCAL_LIBDIR)" 3846 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS" 3847 EXTRA_LDFLAGS="-Wl,-rpath,\${libdir} $EXTRA_LDFLAGS" 3848 if test "$cf_cv_shlib_version" = auto; then 3849 if test -f /usr/libexec/ld.elf_so; then 3850 cf_cv_shlib_version=abi 3851 else 3852 cf_cv_shlib_version=rel 3853 fi 3854 fi 3855 CF_SHARED_SONAME 3856 MK_SHARED_LIB='${CC} ${CFLAGS} -shared -Wl,-soname,'$cf_shared_soname' -o $[@]' 3857 else 3858 MK_SHARED_LIB='${LD} -Bshareable -o $[@]' 3859 fi 3860 ;; 3861 osf*|mls+*) 3862 # tested with OSF/1 V3.2 and 'cc' 3863 # tested with OSF/1 V3.2 and gcc 2.6.3 (but the c++ demo didn't 3864 # link with shared libs). 3865 MK_SHARED_LIB='${LD} -set_version ${REL_VERSION}:${ABI_VERSION} -expect_unresolved "*" -shared -soname `basename $[@]`' 3866 case $host_os in 3867 osf4*) 3868 MK_SHARED_LIB="${MK_SHARED_LIB} -msym" 3869 ;; 3870 esac 3871 MK_SHARED_LIB="${MK_SHARED_LIB}"' -o $[@]' 3872 if test "$DFT_LWR_MODEL" = "shared" ; then 3873 LOCAL_LDFLAGS="-Wl,-rpath,\$(LOCAL_LIBDIR)" 3874 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS" 3875 fi 3876 if test "$cf_cv_ld_rpath" = yes ; then 3877 cf_ld_rpath_opt="-rpath" 3878 # EXTRA_LDFLAGS="$LOCAL_LDFLAGS $EXTRA_LDFLAGS" 3879 fi 3880 cf_cv_rm_so_locs=yes 3881 ;; 3882 sco3.2v5*) # (also uw2* and UW7) hops 13-Apr-98 3883 # tested with osr5.0.5 3884 if test "$GCC" != yes; then 3885 CC_SHARED_OPTS='-belf -KPIC' 3886 fi 3887 MK_SHARED_LIB='${LD} -dy -G -h `basename $[@] .${REL_VERSION}`.${ABI_VERSION} -o [$]@' 3888 if test "$cf_cv_ld_rpath" = yes ; then 3889 # only way is to set LD_RUN_PATH but no switch for it 3890 RUN_PATH=$libdir 3891 fi 3892 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel 3893 LINK_PROGS='LD_RUN_PATH=${libdir}' 3894 LINK_TESTS='Pwd=`pwd`;LD_RUN_PATH=`dirname $${Pwd}`/lib' 3895 ;; 3896 sunos4*) 3897 # tested with SunOS 4.1.1 and gcc 2.7.0 3898 if test "$GCC" != yes; then 3899 CC_SHARED_OPTS='-KPIC' 3900 fi 3901 MK_SHARED_LIB='${LD} -assert pure-text -o $[@]' 3902 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel 3903 ;; 3904 solaris2*) 3905 # tested with SunOS 5.5.1 (solaris 2.5.1) and gcc 2.7.2 3906 if test "$GCC" != yes; then 3907 CC_SHARED_OPTS='-KPIC' 3908 fi 3909 if test "$DFT_LWR_MODEL" = "shared" ; then 3910 LOCAL_LDFLAGS="-R \$(LOCAL_LIBDIR):\${libdir}" 3911 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS" 3912 fi 3913 if test "$cf_cv_ld_rpath" = yes ; then 3914 cf_ld_rpath_opt="-R" 3915 EXTRA_LDFLAGS="$LOCAL_LDFLAGS $EXTRA_LDFLAGS" 3916 fi 3917 CF_SHARED_SONAME 3918 MK_SHARED_LIB='${CC} -dy -G -h '$cf_shared_soname' -o $[@]' 3919 ;; 3920 sysv5uw7*|unix_sv*) 3921 # tested with UnixWare 7.1.0 (gcc 2.95.2 and cc) 3922 if test "$GCC" != yes; then 3923 CC_SHARED_OPTS='-KPIC' 3924 fi 3925 MK_SHARED_LIB='${LD} -d y -G -o [$]@' 3926 ;; 3927 *) 3928 CC_SHARED_OPTS='unknown' 3929 MK_SHARED_LIB='echo unknown' 3930 ;; 3931 esac 3932 3933 # This works if the last tokens in $MK_SHARED_LIB are the -o target. 3934 case "$cf_cv_shlib_version" in #(vi 3935 rel|abi) 3936 case "$MK_SHARED_LIB" in #(vi 3937 *'-o $[@]') 3938 test "$cf_cv_do_symlinks" = no && cf_cv_do_symlinks=yes 3939 ;; 3940 *) 3941 AC_MSG_WARN(ignored --with-shlib-version) 3942 ;; 3943 esac 3944 ;; 3945 esac 3946 3947 if test -n "$cf_ld_rpath_opt" ; then 3948 AC_MSG_CHECKING(if we need a space after rpath option) 3949 cf_save_LIBS="$LIBS" 3950 LIBS="$LIBS ${cf_ld_rpath_opt}$libdir" 3951 AC_TRY_LINK(, , cf_rpath_space=no, cf_rpath_space=yes) 3952 LIBS="$cf_save_LIBS" 3953 AC_MSG_RESULT($cf_rpath_space) 3954 test "$cf_rpath_space" = yes && cf_ld_rpath_opt="$cf_ld_rpath_opt " 3955 MK_SHARED_LIB="$MK_SHARED_LIB $cf_ld_rpath_opt\${libdir}" 3956 fi 3957 3958 AC_SUBST(CC_SHARED_OPTS) 3959 AC_SUBST(LD_SHARED_OPTS) 3960 AC_SUBST(MK_SHARED_LIB) 3961 AC_SUBST(LINK_PROGS) 3962 AC_SUBST(LINK_TESTS) 3963 AC_SUBST(EXTRA_LDFLAGS) 3964 AC_SUBST(LOCAL_LDFLAGS) 3965 AC_SUBST(LOCAL_LDFLAGS2) 3966 AC_SUBST(INSTALL_LIB) 3967])dnl 3968dnl --------------------------------------------------------------------------- 3969dnl CF_SHARED_SONAME version: 2 updated: 2006/10/21 12:33:41 3970dnl ---------------- 3971dnl utility macro for CF_SHARED_OPTS, constructs "$cf_shared_soname" for 3972dnl substitution into MK_SHARED_LIB string for the "-soname" (or similar) 3973dnl option. 3974dnl 3975dnl $1 is the default that should be used for "$cf_cv_shlib_version". 3976dnl If missing, use "rel". 3977define([CF_SHARED_SONAME], 3978[ 3979 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=ifelse($1,,rel,$1) 3980 if test "$cf_cv_shlib_version" = rel; then 3981 cf_shared_soname='`basename $[@] .${REL_VERSION}`.${ABI_VERSION}' 3982 else 3983 cf_shared_soname='`basename $[@]`' 3984 fi 3985]) 3986dnl --------------------------------------------------------------------------- 3987dnl CF_SIGWINCH version: 1 updated: 2006/04/02 16:41:09 3988dnl ----------- 3989dnl Use this macro after CF_XOPEN_SOURCE, but do not require it (not all 3990dnl programs need this test). 3991dnl 3992dnl This is really a MacOS X 10.4.3 workaround. Defining _POSIX_C_SOURCE 3993dnl forces SIGWINCH to be undefined (breaks xterm, ncurses). Oddly, the struct 3994dnl winsize declaration is left alone - we may revisit this if Apple choose to 3995dnl break that part of the interface as well. 3996AC_DEFUN([CF_SIGWINCH], 3997[ 3998AC_CACHE_CHECK(if SIGWINCH is defined,cf_cv_define_sigwinch,[ 3999 AC_TRY_COMPILE([ 4000#include <sys/types.h> 4001#include <sys/signal.h> 4002],[int x = SIGWINCH], 4003 [cf_cv_define_sigwinch=yes], 4004 [AC_TRY_COMPILE([ 4005#undef _XOPEN_SOURCE 4006#undef _POSIX_SOURCE 4007#undef _POSIX_C_SOURCE 4008#include <sys/types.h> 4009#include <sys/signal.h> 4010],[int x = SIGWINCH], 4011 [cf_cv_define_sigwinch=maybe], 4012 [cf_cv_define_sigwinch=no]) 4013]) 4014]) 4015 4016if test "$cf_cv_define_sigwinch" = maybe ; then 4017AC_CACHE_CHECK(for actual SIGWINCH definition,cf_cv_fixup_sigwinch,[ 4018cf_cv_fixup_sigwinch=unknown 4019cf_sigwinch=32 4020while test $cf_sigwinch != 1 4021do 4022 AC_TRY_COMPILE([ 4023#undef _XOPEN_SOURCE 4024#undef _POSIX_SOURCE 4025#undef _POSIX_C_SOURCE 4026#include <sys/types.h> 4027#include <sys/signal.h> 4028],[ 4029#if SIGWINCH != $cf_sigwinch 4030make an error 4031#endif 4032int x = SIGWINCH], 4033 [cf_cv_fixup_sigwinch=$cf_sigwinch 4034 break]) 4035 4036cf_sigwinch=`expr $cf_sigwinch - 1` 4037done 4038]) 4039 4040 if test "$cf_cv_fixup_sigwinch" != unknown ; then 4041 CPPFLAGS="$CPPFLAGS -DSIGWINCH=$cf_cv_fixup_sigwinch" 4042 fi 4043fi 4044])dnl 4045dnl --------------------------------------------------------------------------- 4046dnl CF_SIZECHANGE version: 8 updated: 2000/11/04 12:22:16 4047dnl ------------- 4048dnl Check for definitions & structures needed for window size-changing 4049dnl FIXME: check that this works with "snake" (HP-UX 10.x) 4050AC_DEFUN([CF_SIZECHANGE], 4051[ 4052AC_REQUIRE([CF_STRUCT_TERMIOS]) 4053AC_CACHE_CHECK(declaration of size-change, cf_cv_sizechange,[ 4054 cf_cv_sizechange=unknown 4055 cf_save_CPPFLAGS="$CPPFLAGS" 4056 4057for cf_opts in "" "NEED_PTEM_H" 4058do 4059 4060 CPPFLAGS="$cf_save_CPPFLAGS" 4061 test -n "$cf_opts" && CPPFLAGS="$CPPFLAGS -D$cf_opts" 4062 AC_TRY_COMPILE([#include <sys/types.h> 4063#ifdef HAVE_TERMIOS_H 4064#include <termios.h> 4065#else 4066#ifdef HAVE_TERMIO_H 4067#include <termio.h> 4068#endif 4069#endif 4070#ifdef NEED_PTEM_H 4071/* This is a workaround for SCO: they neglected to define struct winsize in 4072 * termios.h -- it's only in termio.h and ptem.h 4073 */ 4074#include <sys/stream.h> 4075#include <sys/ptem.h> 4076#endif 4077#if !defined(sun) || !defined(HAVE_TERMIOS_H) 4078#include <sys/ioctl.h> 4079#endif 4080],[ 4081#ifdef TIOCGSIZE 4082 struct ttysize win; /* FIXME: what system is this? */ 4083 int y = win.ts_lines; 4084 int x = win.ts_cols; 4085#else 4086#ifdef TIOCGWINSZ 4087 struct winsize win; 4088 int y = win.ws_row; 4089 int x = win.ws_col; 4090#else 4091 no TIOCGSIZE or TIOCGWINSZ 4092#endif /* TIOCGWINSZ */ 4093#endif /* TIOCGSIZE */ 4094 ], 4095 [cf_cv_sizechange=yes], 4096 [cf_cv_sizechange=no]) 4097 4098 CPPFLAGS="$cf_save_CPPFLAGS" 4099 if test "$cf_cv_sizechange" = yes ; then 4100 echo "size-change succeeded ($cf_opts)" >&AC_FD_CC 4101 test -n "$cf_opts" && cf_cv_sizechange="$cf_opts" 4102 break 4103 fi 4104done 4105]) 4106if test "$cf_cv_sizechange" != no ; then 4107 AC_DEFINE(HAVE_SIZECHANGE) 4108 case $cf_cv_sizechange in #(vi 4109 NEED*) 4110 AC_DEFINE_UNQUOTED($cf_cv_sizechange ) 4111 ;; 4112 esac 4113fi 4114])dnl 4115dnl --------------------------------------------------------------------------- 4116dnl CF_SRC_MODULES version: 18 updated: 2005/05/28 12:58:54 4117dnl -------------- 4118dnl For each parameter, test if the source-directory exists, and if it contains 4119dnl a 'modules' file. If so, add to the list $cf_cv_src_modules which we'll 4120dnl use in CF_LIB_RULES. 4121dnl 4122dnl This uses the configured value to make the lists SRC_SUBDIRS and 4123dnl SUB_MAKEFILES which are used in the makefile-generation scheme. 4124AC_DEFUN([CF_SRC_MODULES], 4125[ 4126AC_MSG_CHECKING(for src modules) 4127 4128# dependencies and linker-arguments for test-programs 4129TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${LIB_NAME}${DFT_DEP_SUFFIX} $TEST_DEPS" 4130TEST_DEP2="${LIB_2ND}/${LIB_PREFIX}${LIB_NAME}${DFT_DEP_SUFFIX} $TEST_DEP2" 4131if test "$DFT_LWR_MODEL" = "libtool"; then 4132 TEST_ARGS="${TEST_DEPS}" 4133 TEST_ARG2="${TEST_DEP2}" 4134else 4135 TEST_ARGS="-l${LIB_NAME}${DFT_ARG_SUFFIX} $TEST_ARGS" 4136 TEST_ARG2="-l${LIB_NAME}${DFT_ARG_SUFFIX} $TEST_ARG2" 4137fi 4138 4139cf_cv_src_modules= 4140for cf_dir in $1 4141do 4142 if test -f $srcdir/$cf_dir/modules; then 4143 4144 # We may/may not have tack in the distribution, though the 4145 # makefile is. 4146 if test $cf_dir = tack ; then 4147 if test ! -f $srcdir/${cf_dir}/${cf_dir}.h; then 4148 continue 4149 fi 4150 fi 4151 4152 if test -z "$cf_cv_src_modules"; then 4153 cf_cv_src_modules=$cf_dir 4154 else 4155 cf_cv_src_modules="$cf_cv_src_modules $cf_dir" 4156 fi 4157 4158 # Make the ncurses_cfg.h file record the library interface files as 4159 # well. These are header files that are the same name as their 4160 # directory. Ncurses is the only library that does not follow 4161 # that pattern. 4162 if test $cf_dir = tack ; then 4163 continue 4164 elif test -f $srcdir/${cf_dir}/${cf_dir}.h; then 4165 CF_UPPER(cf_have_include,$cf_dir) 4166 AC_DEFINE_UNQUOTED(HAVE_${cf_have_include}_H) 4167 AC_DEFINE_UNQUOTED(HAVE_LIB${cf_have_include}) 4168 TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${cf_dir}${DFT_DEP_SUFFIX} $TEST_DEPS" 4169 TEST_DEP2="${LIB_2ND}/${LIB_PREFIX}${cf_dir}${DFT_DEP_SUFFIX} $TEST_DEP2" 4170 if test "$DFT_LWR_MODEL" = "libtool"; then 4171 TEST_ARGS="${TEST_DEPS}" 4172 TEST_ARG2="${TEST_DEP2}" 4173 else 4174 TEST_ARGS="-l${cf_dir}${DFT_ARG_SUFFIX} $TEST_ARGS" 4175 TEST_ARG2="-l${cf_dir}${DFT_ARG_SUFFIX} $TEST_ARG2" 4176 fi 4177 fi 4178 fi 4179done 4180AC_MSG_RESULT($cf_cv_src_modules) 4181 4182TEST_ARGS="-L${LIB_DIR} $TEST_ARGS" 4183TEST_ARG2="-L${LIB_2ND} $TEST_ARG2" 4184 4185AC_SUBST(TEST_ARGS) 4186AC_SUBST(TEST_DEPS) 4187 4188AC_SUBST(TEST_ARG2) 4189AC_SUBST(TEST_DEP2) 4190 4191SRC_SUBDIRS="man include" 4192for cf_dir in $cf_cv_src_modules 4193do 4194 SRC_SUBDIRS="$SRC_SUBDIRS $cf_dir" 4195done 4196SRC_SUBDIRS="$SRC_SUBDIRS test" 4197test -z "$MAKE_TERMINFO" && SRC_SUBDIRS="$SRC_SUBDIRS misc" 4198test "$cf_with_cxx_binding" != no && SRC_SUBDIRS="$SRC_SUBDIRS c++" 4199 4200ADA_SUBDIRS= 4201if test "$cf_cv_prog_gnat_correct" = yes && test -f $srcdir/Ada95/Makefile.in; then 4202 SRC_SUBDIRS="$SRC_SUBDIRS Ada95" 4203 ADA_SUBDIRS="gen src samples" 4204fi 4205 4206SUB_MAKEFILES= 4207for cf_dir in $SRC_SUBDIRS 4208do 4209 SUB_MAKEFILES="$SUB_MAKEFILES $cf_dir/Makefile" 4210done 4211 4212if test -n "$ADA_SUBDIRS"; then 4213 for cf_dir in $ADA_SUBDIRS 4214 do 4215 SUB_MAKEFILES="$SUB_MAKEFILES Ada95/$cf_dir/Makefile" 4216 done 4217 AC_SUBST(ADA_SUBDIRS) 4218fi 4219])dnl 4220dnl --------------------------------------------------------------------------- 4221dnl CF_STDCPP_LIBRARY version: 5 updated: 2000/08/12 23:18:52 4222dnl ----------------- 4223dnl Check for -lstdc++, which is GNU's standard C++ library. 4224AC_DEFUN([CF_STDCPP_LIBRARY], 4225[ 4226if test -n "$GXX" ; then 4227case $cf_cv_system_name in #(vi 4228os2*) #(vi 4229 cf_stdcpp_libname=stdcpp 4230 ;; 4231*) 4232 cf_stdcpp_libname=stdc++ 4233 ;; 4234esac 4235AC_CACHE_CHECK(for library $cf_stdcpp_libname,cf_cv_libstdcpp,[ 4236 cf_save="$LIBS" 4237 LIBS="$LIBS -l$cf_stdcpp_libname" 4238AC_TRY_LINK([ 4239#include <strstream.h>],[ 4240char buf[80]; 4241strstreambuf foo(buf, sizeof(buf)) 4242], 4243 [cf_cv_libstdcpp=yes], 4244 [cf_cv_libstdcpp=no]) 4245 LIBS="$cf_save" 4246]) 4247test "$cf_cv_libstdcpp" = yes && CXXLIBS="$CXXLIBS -l$cf_stdcpp_libname" 4248fi 4249])dnl 4250dnl --------------------------------------------------------------------------- 4251dnl CF_STRIP_G_OPT version: 3 updated: 2002/12/21 19:25:52 4252dnl -------------- 4253dnl Remove "-g" option from the compiler options 4254AC_DEFUN([CF_STRIP_G_OPT], 4255[$1=`echo ${$1} | sed -e 's%-g %%' -e 's%-g$%%'`])dnl 4256dnl --------------------------------------------------------------------------- 4257dnl CF_STRUCT_SIGACTION version: 3 updated: 2000/08/12 23:18:52 4258dnl ------------------- 4259dnl Check if we need _POSIX_SOURCE defined to use struct sigaction. We'll only 4260dnl do this if we've found the sigaction function. 4261dnl 4262dnl If needed, define SVR4_ACTION. 4263AC_DEFUN([CF_STRUCT_SIGACTION],[ 4264if test "$ac_cv_func_sigaction" = yes; then 4265AC_MSG_CHECKING(whether sigaction needs _POSIX_SOURCE) 4266AC_TRY_COMPILE([ 4267#include <sys/types.h> 4268#include <signal.h>], 4269 [struct sigaction act], 4270 [sigact_bad=no], 4271 [ 4272AC_TRY_COMPILE([ 4273#define _POSIX_SOURCE 4274#include <sys/types.h> 4275#include <signal.h>], 4276 [struct sigaction act], 4277 [sigact_bad=yes 4278 AC_DEFINE(SVR4_ACTION)], 4279 [sigact_bad=unknown])]) 4280AC_MSG_RESULT($sigact_bad) 4281fi 4282])dnl 4283dnl --------------------------------------------------------------------------- 4284dnl CF_STRUCT_TERMIOS version: 5 updated: 2000/11/04 12:22:46 4285dnl ----------------- 4286dnl Some machines require _POSIX_SOURCE to completely define struct termios. 4287dnl If so, define SVR4_TERMIO 4288AC_DEFUN([CF_STRUCT_TERMIOS],[ 4289AC_CHECK_HEADERS( \ 4290termio.h \ 4291termios.h \ 4292unistd.h \ 4293) 4294if test "$ISC" = yes ; then 4295 AC_CHECK_HEADERS( sys/termio.h ) 4296fi 4297if test "$ac_cv_header_termios_h" = yes ; then 4298 case "$CFLAGS $CPPFLAGS" in 4299 *-D_POSIX_SOURCE*) 4300 termios_bad=dunno ;; 4301 *) termios_bad=maybe ;; 4302 esac 4303 if test "$termios_bad" = maybe ; then 4304 AC_MSG_CHECKING(whether termios.h needs _POSIX_SOURCE) 4305 AC_TRY_COMPILE([#include <termios.h>], 4306 [struct termios foo; int x = foo.c_iflag], 4307 termios_bad=no, [ 4308 AC_TRY_COMPILE([ 4309#define _POSIX_SOURCE 4310#include <termios.h>], 4311 [struct termios foo; int x = foo.c_iflag], 4312 termios_bad=unknown, 4313 termios_bad=yes AC_DEFINE(SVR4_TERMIO)) 4314 ]) 4315 AC_MSG_RESULT($termios_bad) 4316 fi 4317fi 4318])dnl 4319dnl --------------------------------------------------------------------------- 4320dnl CF_SUBST version: 4 updated: 2006/06/17 12:33:03 4321dnl -------- 4322dnl Shorthand macro for substituting things that the user may override 4323dnl with an environment variable. 4324dnl 4325dnl $1 = long/descriptive name 4326dnl $2 = environment variable 4327dnl $3 = default value 4328AC_DEFUN([CF_SUBST], 4329[AC_CACHE_VAL(cf_cv_subst_$2,[ 4330AC_MSG_CHECKING(for $1 (symbol $2)) 4331CF_SUBST_IF([-z "[$]$2"], [$2], [$3]) 4332cf_cv_subst_$2=[$]$2 4333AC_MSG_RESULT([$]$2) 4334]) 4335])dnl 4336dnl --------------------------------------------------------------------------- 4337dnl CF_SUBST_IF version: 2 updated: 2006/06/17 12:33:03 4338dnl ----------- 4339dnl Shorthand macro for substituting things that the user may override 4340dnl with an environment variable. 4341dnl 4342dnl $1 = condition to pass to "test" 4343dnl $2 = environment variable 4344dnl $3 = value if the test succeeds 4345dnl $4 = value if the test fails 4346AC_DEFUN([CF_SUBST_IF], 4347[ 4348if test $1 ; then 4349 $2=$3 4350ifelse($4,,,[else 4351 $2=$4]) 4352fi 4353AC_SUBST($2) 4354])dnl 4355dnl --------------------------------------------------------------------------- 4356dnl CF_SUBST_NCURSES_VERSION version: 8 updated: 2006/09/16 11:40:59 4357dnl ------------------------ 4358dnl Get the version-number for use in shared-library naming, etc. 4359AC_DEFUN([CF_SUBST_NCURSES_VERSION], 4360[ 4361AC_REQUIRE([CF_PROG_EGREP]) 4362NCURSES_MAJOR="`$ac_cv_prog_egrep '^NCURSES_MAJOR[[ ]]*=' $srcdir/dist.mk | sed -e 's/^[[^0-9]]*//'`" 4363NCURSES_MINOR="`$ac_cv_prog_egrep '^NCURSES_MINOR[[ ]]*=' $srcdir/dist.mk | sed -e 's/^[[^0-9]]*//'`" 4364NCURSES_PATCH="`$ac_cv_prog_egrep '^NCURSES_PATCH[[ ]]*=' $srcdir/dist.mk | sed -e 's/^[[^0-9]]*//'`" 4365cf_cv_abi_version=${NCURSES_MAJOR} 4366cf_cv_rel_version=${NCURSES_MAJOR}.${NCURSES_MINOR} 4367dnl Show the computed version, for logging 4368cf_cv_timestamp=`date` 4369AC_MSG_RESULT(Configuring NCURSES $cf_cv_rel_version ABI $cf_cv_abi_version ($cf_cv_timestamp)) 4370dnl We need these values in the generated headers 4371AC_SUBST(NCURSES_MAJOR) 4372AC_SUBST(NCURSES_MINOR) 4373AC_SUBST(NCURSES_PATCH) 4374dnl We need these values in the generated makefiles 4375AC_SUBST(cf_cv_rel_version) 4376AC_SUBST(cf_cv_abi_version) 4377AC_SUBST(cf_cv_builtin_bool) 4378AC_SUBST(cf_cv_header_stdbool_h) 4379AC_SUBST(cf_cv_type_of_bool)dnl 4380])dnl 4381dnl --------------------------------------------------------------------------- 4382dnl CF_SYS_TIME_SELECT version: 4 updated: 2000/10/04 09:18:40 4383dnl ------------------ 4384dnl Check if we can include <sys/time.h> with <sys/select.h>; this breaks on 4385dnl older SCO configurations. 4386AC_DEFUN([CF_SYS_TIME_SELECT], 4387[ 4388AC_MSG_CHECKING(if sys/time.h works with sys/select.h) 4389AC_CACHE_VAL(cf_cv_sys_time_select,[ 4390AC_TRY_COMPILE([ 4391#include <sys/types.h> 4392#ifdef HAVE_SYS_TIME_H 4393#include <sys/time.h> 4394#endif 4395#ifdef HAVE_SYS_SELECT_H 4396#include <sys/select.h> 4397#endif 4398],[],[cf_cv_sys_time_select=yes], 4399 [cf_cv_sys_time_select=no]) 4400 ]) 4401AC_MSG_RESULT($cf_cv_sys_time_select) 4402test "$cf_cv_sys_time_select" = yes && AC_DEFINE(HAVE_SYS_TIME_SELECT) 4403])dnl 4404dnl --------------------------------------------------------------------------- 4405dnl CF_TOP_BUILDDIR version: 1 updated: 2006/10/15 16:33:23 4406dnl --------------- 4407dnl Define a top_builddir symbol, for applications that need an absolute path. 4408AC_DEFUN([CF_TOP_BUILDDIR], 4409[ 4410top_builddir=`pwd` 4411AC_SUBST(top_builddir) 4412])dnl 4413dnl --------------------------------------------------------------------------- 4414dnl CF_TYPEOF_CHTYPE version: 8 updated: 2006/12/16 12:33:30 4415dnl ---------------- 4416dnl Determine the type we should use for chtype (and attr_t, which is treated 4417dnl as the same thing). We want around 32 bits, so on most machines want a 4418dnl long, but on newer 64-bit machines, probably want an int. If we're using 4419dnl wide characters, we have to have a type compatible with that, as well. 4420AC_DEFUN([CF_TYPEOF_CHTYPE], 4421[ 4422AC_MSG_CHECKING([for type of chtype]) 4423AC_CACHE_VAL(cf_cv_typeof_chtype,[ 4424 AC_TRY_RUN([ 4425#define WANT_BITS 31 4426#include <stdio.h> 4427int main() 4428{ 4429 FILE *fp = fopen("cf_test.out", "w"); 4430 if (fp != 0) { 4431 char *result = "long"; 4432 if (sizeof(unsigned long) > sizeof(unsigned int)) { 4433 int n; 4434 unsigned int x, y; 4435 for (n = 0; n < WANT_BITS; n++) { 4436 x = (1 << n); 4437 y = (x >> n); 4438 if (y != 1 || x == 0) { 4439 x = 0; 4440 break; 4441 } 4442 } 4443 /* 4444 * If x is nonzero, an int is big enough for the bits 4445 * that we want. 4446 */ 4447 result = (x != 0) ? "int" : "long"; 4448 } 4449 fputs(result, fp); 4450 fclose(fp); 4451 } 4452 ${cf_cv_main_return:-return}(0); 4453} 4454 ], 4455 [cf_cv_typeof_chtype=`cat cf_test.out`], 4456 [cf_cv_typeof_chtype=long], 4457 [cf_cv_typeof_chtype=long]) 4458 rm -f cf_test.out 4459 ]) 4460AC_MSG_RESULT($cf_cv_typeof_chtype) 4461 4462AC_SUBST(cf_cv_typeof_chtype) 4463AC_DEFINE_UNQUOTED(TYPEOF_CHTYPE,$cf_cv_typeof_chtype) 4464])dnl 4465dnl --------------------------------------------------------------------------- 4466dnl CF_TYPE_SIGACTION version: 3 updated: 2000/08/12 23:18:52 4467dnl ----------------- 4468dnl 4469AC_DEFUN([CF_TYPE_SIGACTION], 4470[ 4471AC_MSG_CHECKING([for type sigaction_t]) 4472AC_CACHE_VAL(cf_cv_type_sigaction,[ 4473 AC_TRY_COMPILE([ 4474#include <signal.h>], 4475 [sigaction_t x], 4476 [cf_cv_type_sigaction=yes], 4477 [cf_cv_type_sigaction=no])]) 4478AC_MSG_RESULT($cf_cv_type_sigaction) 4479test "$cf_cv_type_sigaction" = yes && AC_DEFINE(HAVE_TYPE_SIGACTION) 4480])dnl 4481dnl --------------------------------------------------------------------------- 4482dnl CF_UNSIGNED_LITERALS version: 2 updated: 1998/02/07 22:10:16 4483dnl -------------------- 4484dnl Test if the compiler supports 'U' and 'L' suffixes. Only old compilers 4485dnl won't, but they're still there. 4486AC_DEFUN([CF_UNSIGNED_LITERALS], 4487[ 4488AC_MSG_CHECKING([if unsigned literals are legal]) 4489AC_CACHE_VAL(cf_cv_unsigned_literals,[ 4490 AC_TRY_COMPILE([],[long x = 1L + 1UL + 1U + 1], 4491 [cf_cv_unsigned_literals=yes], 4492 [cf_cv_unsigned_literals=no]) 4493 ]) 4494AC_MSG_RESULT($cf_cv_unsigned_literals) 4495])dnl 4496dnl --------------------------------------------------------------------------- 4497dnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59 4498dnl -------- 4499dnl Make an uppercase version of a variable 4500dnl $1=uppercase($2) 4501AC_DEFUN([CF_UPPER], 4502[ 4503$1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` 4504])dnl 4505dnl --------------------------------------------------------------------------- 4506dnl CF_VERBOSE version: 2 updated: 1997/09/05 10:45:14 4507dnl ---------- 4508dnl Use AC_VERBOSE w/o the warnings 4509AC_DEFUN([CF_VERBOSE], 4510[test -n "$verbose" && echo " $1" 1>&AC_FD_MSG 4511])dnl 4512dnl --------------------------------------------------------------------------- 4513dnl CF_WCHAR_TYPE version: 2 updated: 2004/01/17 19:18:20 4514dnl ------------- 4515dnl Check if type wide-character type $1 is declared, and if so, which header 4516dnl file is needed. The second parameter is used to set a shell variable when 4517dnl the type is not found. The first parameter sets a shell variable for the 4518dnl opposite sense. 4519AC_DEFUN([CF_WCHAR_TYPE], 4520[ 4521# This is needed on Tru64 5.0 to declare $1 4522AC_CACHE_CHECK(if we must include wchar.h to declare $1,cf_cv_$1,[ 4523AC_TRY_COMPILE([ 4524#include <stdlib.h> 4525#include <stdarg.h> 4526#include <stdio.h> 4527#ifdef HAVE_LIBUTF8_H 4528#include <libutf8.h> 4529#endif], 4530 [$1 state], 4531 [cf_cv_$1=no], 4532 [AC_TRY_COMPILE([ 4533#include <stdlib.h> 4534#include <stdarg.h> 4535#include <stdio.h> 4536#include <wchar.h> 4537#ifdef HAVE_LIBUTF8_H 4538#include <libutf8.h> 4539#endif], 4540 [$1 value], 4541 [cf_cv_$1=yes], 4542 [cf_cv_$1=unknown])])]) 4543 4544if test "$cf_cv_$1" = yes ; then 4545 AC_DEFINE(NEED_WCHAR_H) 4546 NEED_WCHAR_H=1 4547fi 4548 4549ifelse($2,,,[ 4550# if we do not find $1 in either place, use substitution to provide a fallback. 4551if test "$cf_cv_$1" = unknown ; then 4552 $2=1 4553fi 4554]) 4555ifelse($3,,,[ 4556# if we find $1 in either place, use substitution to provide a fallback. 4557if test "$cf_cv_$1" != unknown ; then 4558 $3=1 4559fi 4560]) 4561])dnl 4562dnl --------------------------------------------------------------------------- 4563dnl CF_WITH_ABI_VERSION version: 1 updated: 2003/09/20 18:12:49 4564dnl ------------------- 4565dnl Allow library's ABI to be overridden. Generally this happens when a 4566dnl packager has incremented the ABI past that used in the original package, 4567dnl and wishes to keep doing this. 4568dnl 4569dnl $1 is the package name, if any, to derive a corresponding {package}_ABI 4570dnl symbol. 4571AC_DEFUN([CF_WITH_ABI_VERSION],[ 4572test -z "$cf_cv_abi_version" && cf_cv_abi_version=0 4573AC_ARG_WITH(abi-version, 4574[ --with-abi-version=XXX override derived ABI version], 4575[AC_MSG_WARN(overriding ABI version $cf_cv_abi_version to $withval) 4576 cf_cv_abi_version=$withval]) 4577 CF_NUMBER_SYNTAX($cf_cv_abi_version,ABI version) 4578ifelse($1,,,[ 4579$1_ABI=$cf_cv_abi_version 4580]) 4581])dnl 4582dnl --------------------------------------------------------------------------- 4583dnl CF_WITH_DBMALLOC version: 6 updated: 2006/12/16 14:24:05 4584dnl ---------------- 4585dnl Configure-option for dbmalloc. The optional parameter is used to override 4586dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests. 4587AC_DEFUN([CF_WITH_DBMALLOC],[ 4588CF_NO_LEAKS_OPTION(dbmalloc, 4589 [ --with-dbmalloc test: use Conor Cahill's dbmalloc library], 4590 [USE_DBMALLOC]) 4591 4592if test "$with_dbmalloc" = yes ; then 4593 AC_CHECK_HEADER(dbmalloc.h, 4594 [AC_CHECK_LIB(dbmalloc,[debug_malloc]ifelse($1,,[],[,$1]))]) 4595fi 4596])dnl 4597dnl --------------------------------------------------------------------------- 4598dnl CF_WITH_DMALLOC version: 6 updated: 2006/12/16 14:24:05 4599dnl --------------- 4600dnl Configure-option for dmalloc. The optional parameter is used to override 4601dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests. 4602AC_DEFUN([CF_WITH_DMALLOC],[ 4603CF_NO_LEAKS_OPTION(dmalloc, 4604 [ --with-dmalloc test: use Gray Watson's dmalloc library], 4605 [USE_DMALLOC]) 4606 4607if test "$with_dmalloc" = yes ; then 4608 AC_CHECK_HEADER(dmalloc.h, 4609 [AC_CHECK_LIB(dmalloc,[dmalloc_debug]ifelse($1,,[],[,$1]))]) 4610fi 4611])dnl 4612dnl --------------------------------------------------------------------------- 4613dnl CF_WITH_GPM version: 6 updated: 2006/12/17 11:12:09 4614dnl ----------- 4615dnl 4616dnl The option parameter (if neither yes/no) is assumed to be the name of 4617dnl the gpm library, e.g., for dynamic loading. 4618AC_DEFUN([CF_WITH_GPM], 4619[ 4620AC_MSG_CHECKING(if you want to link with the GPM mouse library) 4621AC_ARG_WITH(gpm, 4622 [ --with-gpm use Alessandro Rubini's GPM library], 4623 [with_gpm=$withval], 4624 [with_gpm=maybe]) 4625AC_MSG_RESULT($with_gpm) 4626 4627if test "$with_gpm" != no ; then 4628 AC_CHECK_HEADER(gpm.h,[ 4629 AC_DEFINE(HAVE_GPM_H) 4630 if test "$with_gpm" != yes && test "$with_gpm" != maybe ; then 4631 CF_VERBOSE(assuming we really have GPM library) 4632 AC_DEFINE(HAVE_LIBGPM) 4633 else 4634 AC_CHECK_LIB(gpm,Gpm_Open,[:],[ 4635 AC_ERROR(Cannot link with GPM library) 4636 fi 4637 with_gpm=yes 4638 ]) 4639 ],[ 4640 test "$with_gpm" != maybe && AC_MSG_WARN(Cannot find GPM header) 4641 with_gpm=no 4642 ]) 4643fi 4644]) 4645dnl --------------------------------------------------------------------------- 4646dnl CF_WITH_LIBTOOL version: 10 updated: 2006/10/14 15:23:15 4647dnl --------------- 4648dnl Provide a configure option to incorporate libtool. Define several useful 4649dnl symbols for the makefile rules. 4650dnl 4651dnl The reference to AC_PROG_LIBTOOL does not normally work, since it uses 4652dnl macros from libtool.m4 which is in the aclocal directory of automake. 4653dnl Following is a simple script which turns on the AC_PROG_LIBTOOL macro. 4654dnl But that still does not work properly since the macro is expanded outside 4655dnl the CF_WITH_LIBTOOL macro: 4656dnl 4657dnl #!/bin/sh 4658dnl ACLOCAL=`aclocal --print-ac-dir` 4659dnl if test -z "$ACLOCAL" ; then 4660dnl echo cannot find aclocal directory 4661dnl exit 1 4662dnl elif test ! -f $ACLOCAL/libtool.m4 ; then 4663dnl echo cannot find libtool.m4 file 4664dnl exit 1 4665dnl fi 4666dnl 4667dnl LOCAL=aclocal.m4 4668dnl ORIG=aclocal.m4.orig 4669dnl 4670dnl trap "mv $ORIG $LOCAL" 0 1 2 5 15 4671dnl rm -f $ORIG 4672dnl mv $LOCAL $ORIG 4673dnl 4674dnl # sed the LIBTOOL= assignment to omit the current directory? 4675dnl sed -e 's/^LIBTOOL=.*/LIBTOOL=${LIBTOOL-libtool}/' $ACLOCAL/libtool.m4 >>$LOCAL 4676dnl cat $ORIG >>$LOCAL 4677dnl 4678dnl autoconf-257 $* 4679dnl 4680AC_DEFUN([CF_WITH_LIBTOOL], 4681[ 4682ifdef([AC_PROG_LIBTOOL],,[ 4683LIBTOOL= 4684]) 4685# common library maintenance symbols that are convenient for libtool scripts: 4686LIB_CREATE='${AR} -cr' 4687LIB_OBJECT='${OBJECTS}' 4688LIB_SUFFIX=.a 4689LIB_PREP="$RANLIB" 4690 4691# symbols used to prop libtool up to enable it to determine what it should be 4692# doing: 4693LIB_CLEAN= 4694LIB_COMPILE= 4695LIB_LINK= 4696LIB_INSTALL= 4697LIB_UNINSTALL= 4698 4699AC_MSG_CHECKING(if you want to build libraries with libtool) 4700AC_ARG_WITH(libtool, 4701 [ --with-libtool generate libraries with libtool], 4702 [with_libtool=$withval], 4703 [with_libtool=no]) 4704AC_MSG_RESULT($with_libtool) 4705if test "$with_libtool" != "no"; then 4706ifdef([AC_PROG_LIBTOOL],[ 4707 # missing_content_AC_PROG_LIBTOOL{{ 4708 AC_PROG_LIBTOOL 4709 # missing_content_AC_PROG_LIBTOOL}} 4710],[ 4711 if test "$with_libtool" != "yes" ; then 4712 CF_PATH_SYNTAX(with_libtool) 4713 LIBTOOL=$with_libtool 4714 else 4715 AC_PATH_PROG(LIBTOOL,libtool) 4716 fi 4717 if test -z "$LIBTOOL" ; then 4718 AC_MSG_ERROR(Cannot find libtool) 4719 fi 4720])dnl 4721 LIB_CREATE='${LIBTOOL} --mode=link ${CC} -rpath ${DESTDIR}${libdir} -version-info `cut -f1 ${srcdir}/VERSION` -o' 4722 LIB_OBJECT='${OBJECTS}.o=.lo)' 4723 LIB_SUFFIX=.la 4724 LIB_CLEAN='${LIBTOOL} --mode=clean' 4725 LIB_COMPILE='${LIBTOOL} --mode=compile' 4726 LIB_LINK='${LIBTOOL} --mode=link' 4727 LIB_INSTALL='${LIBTOOL} --mode=install' 4728 LIB_UNINSTALL='${LIBTOOL} --mode=uninstall' 4729 LIB_PREP=: 4730 4731 # Show the version of libtool 4732 AC_MSG_CHECKING(version of libtool) 4733 4734 # Save the version in a cache variable - this is not entirely a good 4735 # thing, but the version string from libtool is very ugly, and for 4736 # bug reports it might be useful to have the original string. 4737 cf_cv_libtool_version=`$LIBTOOL --version 2>&1 | sed -e '2,$d' -e 's/([[^)]]*)//g' -e 's/^[[^1-9]]*//' -e 's/[[^0-9.]].*//'` 4738 AC_MSG_RESULT($cf_cv_libtool_version) 4739 if test -z "$cf_cv_libtool_version" ; then 4740 AC_MSG_ERROR(This is not libtool) 4741 fi 4742 4743 # special hack to add --tag option for C++ compiler 4744 case $cf_cv_libtool_version in 4745 1.[[5-9]]*|[[2-9]]*) 4746 LIBTOOL_CXX="$LIBTOOL --tag=CXX" 4747 ;; 4748 *) 4749 LIBTOOL_CXX="$LIBTOOL" 4750 ;; 4751 esac 4752else 4753 LIBTOOL="" 4754 LIBTOOL_CXX="" 4755fi 4756 4757test -z "$LIBTOOL" && ECHO_LT= 4758 4759AC_SUBST(LIBTOOL) 4760AC_SUBST(LIBTOOL_CXX) 4761 4762AC_SUBST(LIB_CREATE) 4763AC_SUBST(LIB_OBJECT) 4764AC_SUBST(LIB_SUFFIX) 4765AC_SUBST(LIB_PREP) 4766 4767AC_SUBST(LIB_CLEAN) 4768AC_SUBST(LIB_COMPILE) 4769AC_SUBST(LIB_LINK) 4770AC_SUBST(LIB_INSTALL) 4771AC_SUBST(LIB_UNINSTALL) 4772 4773])dnl 4774dnl --------------------------------------------------------------------------- 4775dnl CF_WITH_PATH version: 7 updated: 2006/08/03 15:20:08 4776dnl ------------ 4777dnl Wrapper for AC_ARG_WITH to ensure that user supplies a pathname, not just 4778dnl defaulting to yes/no. 4779dnl 4780dnl $1 = option name 4781dnl $2 = help-text 4782dnl $3 = environment variable to set 4783dnl $4 = default value, shown in the help-message, must be a constant 4784dnl $5 = default value, if it's an expression & cannot be in the help-message 4785dnl 4786AC_DEFUN([CF_WITH_PATH], 4787[AC_ARG_WITH($1,[$2 ](default: ifelse($4,,empty,$4)),, 4788ifelse($4,,[withval="${$3}"],[withval="${$3-ifelse($5,,$4,$5)}"]))dnl 4789CF_PATH_SYNTAX(withval) 4790$3="$withval" 4791AC_SUBST($3)dnl 4792])dnl 4793dnl --------------------------------------------------------------------------- 4794dnl CF_WITH_PATHLIST version: 5 updated: 2001/12/10 01:28:30 4795dnl ---------------- 4796dnl Process an option specifying a list of colon-separated paths. 4797dnl 4798dnl $1 = option name 4799dnl $2 = help-text 4800dnl $3 = environment variable to set 4801dnl $4 = default value, shown in the help-message, must be a constant 4802dnl $5 = default value, if it's an expression & cannot be in the help-message 4803dnl $6 = flag to tell if we want to define or substitute 4804dnl 4805AC_DEFUN([CF_WITH_PATHLIST],[ 4806AC_REQUIRE([CF_PATHSEP]) 4807AC_ARG_WITH($1,[$2 ](default: ifelse($4,,empty,$4)),, 4808ifelse($4,,[withval=${$3}],[withval=${$3-ifelse($5,,$4,$5)}]))dnl 4809 4810IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${PATHSEP}" 4811cf_dst_path= 4812for cf_src_path in $withval 4813do 4814 CF_PATH_SYNTAX(cf_src_path) 4815 test -n "$cf_dst_path" && cf_dst_path="${cf_dst_path}:" 4816 cf_dst_path="${cf_dst_path}${cf_src_path}" 4817done 4818IFS="$ac_save_ifs" 4819 4820ifelse($6,define,[ 4821# Strip single quotes from the value, e.g., when it was supplied as a literal 4822# for $4 or $5. 4823case $cf_dst_path in #(vi 4824\'*) 4825 cf_dst_path=`echo $cf_dst_path |sed -e s/\'// -e s/\'\$//` 4826 ;; 4827esac 4828cf_dst_path=`echo "$cf_dst_path" | sed -e 's/\\\\/\\\\\\\\/g'` 4829]) 4830 4831eval '$3="$cf_dst_path"' 4832AC_SUBST($3)dnl 4833 4834])dnl 4835dnl --------------------------------------------------------------------------- 4836dnl CF_WITH_REL_VERSION version: 1 updated: 2003/09/20 18:12:49 4837dnl ------------------- 4838dnl Allow library's release-version to be overridden. Generally this happens when a 4839dnl packager has incremented the release-version past that used in the original package, 4840dnl and wishes to keep doing this. 4841dnl 4842dnl $1 is the package name, if any, to derive corresponding {package}_MAJOR 4843dnl and {package}_MINOR symbols 4844dnl symbol. 4845AC_DEFUN([CF_WITH_REL_VERSION],[ 4846test -z "$cf_cv_rel_version" && cf_cv_rel_version=0.0 4847AC_ARG_WITH(rel-version, 4848[ --with-rel-version=XXX override derived release version], 4849[AC_MSG_WARN(overriding release version $cf_cv_rel_version to $withval) 4850 cf_cv_rel_version=$withval]) 4851ifelse($1,,[ 4852 CF_NUMBER_SYNTAX($cf_cv_rel_version,Release version) 4853],[ 4854 $1_MAJOR=`echo "$cf_cv_rel_version" | sed -e 's/\..*//'` 4855 $1_MINOR=`echo "$cf_cv_rel_version" | sed -e 's/^[[^.]]*//' -e 's/^\.//' -e 's/\..*//'` 4856 CF_NUMBER_SYNTAX([$]$1_MAJOR,Release major-version) 4857 CF_NUMBER_SYNTAX([$]$1_MINOR,Release minor-version) 4858]) 4859])dnl 4860dnl --------------------------------------------------------------------------- 4861dnl CF_WITH_SYSMOUSE version: 2 updated: 2003/03/22 19:13:43 4862dnl ---------------- 4863dnl If we can compile with sysmouse, make it available unless it is not wanted. 4864AC_DEFUN([CF_WITH_SYSMOUSE],[ 4865# not everyone has "test -c" 4866if test -c /dev/sysmouse 2>/dev/null ; then 4867AC_MSG_CHECKING(if you want to use sysmouse) 4868AC_ARG_WITH(sysmouse, 4869 [ --with-sysmouse use sysmouse (FreeBSD console)], 4870 [cf_with_sysmouse=$withval], 4871 [cf_with_sysmouse=maybe]) 4872 if test "$cf_with_sysmouse" != no ; then 4873 AC_TRY_COMPILE([ 4874#include <osreldate.h> 4875#if (__FreeBSD_version >= 400017) 4876#include <sys/consio.h> 4877#include <sys/fbio.h> 4878#else 4879#include <machine/console.h> 4880#endif 4881],[ 4882 struct mouse_info the_mouse; 4883 ioctl(0, CONS_MOUSECTL, &the_mouse); 4884],[cf_with_sysmouse=yes],[cf_with_sysmouse=no]) 4885 fi 4886AC_MSG_RESULT($cf_with_sysmouse) 4887test "$cf_with_sysmouse" = yes && AC_DEFINE(USE_SYSMOUSE) 4888fi 4889])dnl 4890dnl --------------------------------------------------------------------------- 4891dnl CF_WITH_VALGRIND version: 1 updated: 2006/12/14 18:00:21 4892dnl ---------------- 4893AC_DEFUN([CF_WITH_VALGRIND],[ 4894CF_NO_LEAKS_OPTION(valgrind, 4895 [ --with-valgrind test: use valgrind], 4896 [USE_VALGRIND]) 4897])dnl 4898dnl --------------------------------------------------------------------------- 4899dnl CF_XOPEN_SOURCE version: 24 updated: 2006/04/02 16:41:09 4900dnl --------------- 4901dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions, 4902dnl or adapt to the vendor's definitions to get equivalent functionality, 4903dnl without losing the common non-POSIX features. 4904dnl 4905dnl Parameters: 4906dnl $1 is the nominal value for _XOPEN_SOURCE 4907dnl $2 is the nominal value for _POSIX_C_SOURCE 4908AC_DEFUN([CF_XOPEN_SOURCE],[ 4909 4910AC_REQUIRE([CF_PROG_CC_U_D]) 4911 4912cf_XOPEN_SOURCE=ifelse($1,,500,$1) 4913cf_POSIX_C_SOURCE=ifelse($2,,199506L,$2) 4914 4915case $host_os in #(vi 4916aix[[45]]*) #(vi 4917 CPPFLAGS="$CPPFLAGS -D_ALL_SOURCE" 4918 ;; 4919freebsd*) #(vi 4920 # 5.x headers associate 4921 # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L 4922 # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L 4923 cf_POSIX_C_SOURCE=200112L 4924 cf_XOPEN_SOURCE=600 4925 CPPFLAGS="$CPPFLAGS -D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" 4926 ;; 4927hpux*) #(vi 4928 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE" 4929 ;; 4930irix[[56]].*) #(vi 4931 CPPFLAGS="$CPPFLAGS -D_SGI_SOURCE" 4932 ;; 4933linux*|gnu*) #(vi 4934 CF_GNU_SOURCE 4935 ;; 4936mirbsd*) #(vi 4937 # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <arpa/inet.h> 4938 ;; 4939netbsd*) #(vi 4940 # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw 4941 ;; 4942openbsd*) #(vi 4943 # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw 4944 ;; 4945osf[[45]]*) #(vi 4946 CPPFLAGS="$CPPFLAGS -D_OSF_SOURCE" 4947 ;; 4948nto-qnx*) #(vi 4949 CPPFLAGS="$CPPFLAGS -D_QNX_SOURCE" 4950 ;; 4951sco*) #(vi 4952 # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer 4953 ;; 4954solaris*) #(vi 4955 CPPFLAGS="$CPPFLAGS -D__EXTENSIONS__" 4956 ;; 4957*) 4958 AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[ 4959 AC_TRY_COMPILE([#include <sys/types.h>],[ 4960#ifndef _XOPEN_SOURCE 4961make an error 4962#endif], 4963 [cf_cv_xopen_source=no], 4964 [cf_save="$CPPFLAGS" 4965 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" 4966 AC_TRY_COMPILE([#include <sys/types.h>],[ 4967#ifdef _XOPEN_SOURCE 4968make an error 4969#endif], 4970 [cf_cv_xopen_source=no], 4971 [cf_cv_xopen_source=$cf_XOPEN_SOURCE]) 4972 CPPFLAGS="$cf_save" 4973 ]) 4974]) 4975 if test "$cf_cv_xopen_source" != no ; then 4976 CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE) 4977 CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE) 4978 test "$cf_cv_cc_u_d_options" = yes && \ 4979 CPPFLAGS="$CPPFLAGS -U_XOPEN_SOURCE" 4980 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_cv_xopen_source" 4981 fi 4982 CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE) 4983 ;; 4984esac 4985]) 4986