1dnl*************************************************************************** 2dnl Copyright (c) 1998-2000,2001,2002 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 1996,1997,1998,1999,2000,2001 30dnl 31dnl $Id: aclocal.m4,v 1.280 2002/04/27 19:31:30 tom Exp $ 32dnl Macros used in NCURSES auto-configuration script. 33dnl 34dnl See http://dickey.his.com/autoconf/ for additional information. 35dnl 36dnl --------------------------------------------------------------------------- 37dnl --------------------------------------------------------------------------- 38dnl Construct the list of include-options for the C programs in the Ada95 39dnl binding. 40AC_DEFUN([CF_ADA_INCLUDE_DIRS], 41[ 42ACPPFLAGS="$ACPPFLAGS -I. -I../../include" 43if test "$srcdir" != "."; then 44 ACPPFLAGS="$ACPPFLAGS -I\$(srcdir)/../../include" 45fi 46if test "$GCC" != yes; then 47 ACPPFLAGS="$ACPPFLAGS -I\$(includedir)" 48elif test "$includedir" != "/usr/include"; then 49 if test "$includedir" = '${prefix}/include' ; then 50 if test $prefix != /usr ; then 51 ACPPFLAGS="$ACPPFLAGS -I\$(includedir)" 52 fi 53 else 54 ACPPFLAGS="$ACPPFLAGS -I\$(includedir)" 55 fi 56fi 57AC_SUBST(ACPPFLAGS) 58])dnl 59dnl --------------------------------------------------------------------------- 60dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS 61dnl The second parameter if given makes this macro verbose. 62AC_DEFUN([CF_ADD_CFLAGS], 63[ 64cf_new_cflags= 65cf_new_cppflags= 66for cf_add_cflags in $1 67do 68 case $cf_add_cflags in #(vi 69 -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi 70 case "$CPPFLAGS" in 71 *$cf_add_cflags) #(vi 72 ;; 73 *) #(vi 74 cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" 75 ;; 76 esac 77 ;; 78 *) 79 cf_new_cflags="$cf_new_cflags $cf_add_cflags" 80 ;; 81 esac 82done 83 84if test -n "$cf_new_cflags" ; then 85 ifelse($2,,,[CF_VERBOSE(add to \$CFLAGS $cf_new_cflags)]) 86 CFLAGS="$CFLAGS $cf_new_cflags" 87fi 88 89if test -n "$cf_new_cppflags" ; then 90 ifelse($2,,,[CF_VERBOSE(add to \$CPPFLAGS $cf_new_cppflags)]) 91 CPPFLAGS="$CPPFLAGS $cf_new_cppflags" 92fi 93 94])dnl 95dnl --------------------------------------------------------------------------- 96dnl This is adapted from the macros 'fp_PROG_CC_STDC' and 'fp_C_PROTOTYPES' 97dnl in the sharutils 4.2 distribution. 98AC_DEFUN([CF_ANSI_CC_CHECK], 99[ 100AC_CACHE_CHECK(for ${CC-cc} option to accept ANSI C, cf_cv_ansi_cc,[ 101cf_cv_ansi_cc=no 102cf_save_CFLAGS="$CFLAGS" 103cf_save_CPPFLAGS="$CPPFLAGS" 104# Don't try gcc -ansi; that turns off useful extensions and 105# breaks some systems' header files. 106# AIX -qlanglvl=ansi 107# Ultrix and OSF/1 -std1 108# HP-UX -Aa -D_HPUX_SOURCE 109# SVR4 -Xc 110# UnixWare 1.2 (cannot use -Xc, since ANSI/POSIX clashes) 111for cf_arg in "-DCC_HAS_PROTOS" \ 112 "" \ 113 -qlanglvl=ansi \ 114 -std1 \ 115 -Ae \ 116 "-Aa -D_HPUX_SOURCE" \ 117 -Xc 118do 119 CF_ADD_CFLAGS($cf_arg) 120 AC_TRY_COMPILE( 121[ 122#ifndef CC_HAS_PROTOS 123#if !defined(__STDC__) || (__STDC__ != 1) 124choke me 125#endif 126#endif 127],[ 128 int test (int i, double x); 129 struct s1 {int (*f) (int a);}; 130 struct s2 {int (*f) (double a);};], 131 [cf_cv_ansi_cc="$cf_arg"; break]) 132done 133CFLAGS="$cf_save_CFLAGS" 134CPPFLAGS="$cf_save_CPPFLAGS" 135]) 136 137if test "$cf_cv_ansi_cc" != "no"; then 138if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then 139 CF_ADD_CFLAGS($cf_cv_ansi_cc) 140else 141 AC_DEFINE(CC_HAS_PROTOS) 142fi 143fi 144])dnl 145dnl --------------------------------------------------------------------------- 146dnl For programs that must use an ANSI compiler, obtain compiler options that 147dnl will make it recognize prototypes. We'll do preprocessor checks in other 148dnl macros, since tools such as unproto can fake prototypes, but only part of 149dnl the preprocessor. 150AC_DEFUN([CF_ANSI_CC_REQD], 151[AC_REQUIRE([CF_ANSI_CC_CHECK]) 152if test "$cf_cv_ansi_cc" = "no"; then 153 AC_ERROR( 154[Your compiler does not appear to recognize prototypes. 155You have the following choices: 156 a. adjust your compiler options 157 b. get an up-to-date compiler 158 c. use a wrapper such as unproto]) 159fi 160])dnl 161dnl --------------------------------------------------------------------------- 162dnl Test if 'bool' is a builtin type in the configured C++ compiler. Some 163dnl older compilers (e.g., gcc 2.5.8) don't support 'bool' directly; gcc 164dnl 2.6.3 does, in anticipation of the ANSI C++ standard. 165dnl 166dnl Treat the configuration-variable specially here, since we're directly 167dnl substituting its value (i.e., 1/0). 168AC_DEFUN([CF_BOOL_DECL], 169[ 170AC_CHECK_HEADER(stdbool.h, 171 cf_cv_header_stdbool_h=1, 172 cf_cv_header_stdbool_h=0) 173AC_MSG_CHECKING([for builtin bool type]) 174AC_CACHE_VAL(ifelse($1,,cf_cv_builtin_bool,[$1]),[ 175 AC_TRY_COMPILE([ 176#include <stdio.h> 177#include <sys/types.h> 178],[bool x = false], 179 [ifelse($1,,cf_cv_builtin_bool,[$1])=1], 180 [ifelse($1,,cf_cv_builtin_bool,[$1])=0]) 181 ]) 182if test "$ifelse($1,,cf_cv_builtin_bool,[$1])" = 1 183then AC_MSG_RESULT(yes) 184else AC_MSG_RESULT(no) 185fi 186])dnl 187dnl --------------------------------------------------------------------------- 188dnl Test for the size of 'bool' in the configured C++ compiler (e.g., a type). 189dnl Don't bother looking for bool.h, since it's been deprecated. 190dnl 191dnl If the current compiler is C rather than C++, we get the bool definition 192dnl from <stdbool.h>. 193AC_DEFUN([CF_BOOL_SIZE], 194[ 195AC_MSG_CHECKING([for size of bool]) 196AC_CACHE_VAL(cf_cv_type_of_bool,[ 197 rm -f cf_test.out 198 AC_TRY_RUN([ 199#include <stdlib.h> 200#include <stdio.h> 201 202#if defined(__cplusplus) 203 204#ifdef HAVE_GXX_BUILTIN_H 205#include <g++/builtin.h> 206#elif HAVE_GPP_BUILTIN_H 207#include <gpp/builtin.h> 208#elif HAVE_BUILTIN_H 209#include <builtin.h> 210#endif 211 212#else 213 214#if $cf_cv_header_stdbool_h 215#include <stdbool.h> 216#endif 217 218#endif 219 220main() 221{ 222 FILE *fp = fopen("cf_test.out", "w"); 223 if (fp != 0) { 224 bool x = true; 225 if ((bool)(-x) >= 0) 226 fputs("unsigned ", fp); 227 if (sizeof(x) == sizeof(int)) fputs("int", fp); 228 else if (sizeof(x) == sizeof(char)) fputs("char", fp); 229 else if (sizeof(x) == sizeof(short))fputs("short",fp); 230 else if (sizeof(x) == sizeof(long)) fputs("long", fp); 231 fclose(fp); 232 } 233 exit(0); 234} 235 ], 236 [cf_cv_type_of_bool=`cat cf_test.out` 237 if test -z "$cf_cv_type_of_bool"; then 238 cf_cv_type_of_bool=unknown 239 fi], 240 [cf_cv_type_of_bool=unknown], 241 [cf_cv_type_of_bool=unknown]) 242 ]) 243 rm -f cf_test.out 244AC_MSG_RESULT($cf_cv_type_of_bool) 245if test "$cf_cv_type_of_bool" = unknown ; then 246 case .$NCURSES_BOOL in #(vi 247 .auto|.) NCURSES_BOOL=unsigned;; 248 esac 249 AC_MSG_WARN(Assuming $NCURSES_BOOL for type of bool) 250 cf_cv_type_of_bool=$NCURSES_BOOL 251fi 252])dnl 253dnl --------------------------------------------------------------------------- 254dnl Determine the default configuration into which we'll install ncurses. This 255dnl can be overridden by the user's command-line options. There's two items to 256dnl look for: 257dnl 1. the prefix (e.g., /usr) 258dnl 2. the header files (e.g., /usr/include/ncurses) 259dnl We'll look for a previous installation of ncurses and use the same defaults. 260dnl 261dnl We don't use AC_PREFIX_DEFAULT, because it gets evaluated too soon, and 262dnl we don't use AC_PREFIX_PROGRAM, because we cannot distinguish ncurses's 263dnl programs from a vendor's. 264AC_DEFUN([CF_CFG_DEFAULTS], 265[ 266AC_MSG_CHECKING(for prefix) 267if test "x$prefix" = "xNONE" ; then 268 case "$cf_cv_system_name" in 269 # non-vendor systems don't have a conflict 270 openbsd*|netbsd*|freebsd*|linux*|cygwin*) 271 prefix=/usr 272 ;; 273 *) prefix=$ac_default_prefix 274 ;; 275 esac 276fi 277AC_MSG_RESULT($prefix) 278 279if test "x$prefix" = "xNONE" ; then 280AC_MSG_CHECKING(for default include-directory) 281test -n "$verbose" && echo 1>&AC_FD_MSG 282for cf_symbol in \ 283 $includedir \ 284 $includedir/ncurses \ 285 $prefix/include \ 286 $prefix/include/ncurses \ 287 /usr/local/include \ 288 /usr/local/include/ncurses \ 289 /usr/include \ 290 /usr/include/ncurses 291do 292 cf_dir=`eval echo $cf_symbol` 293 if test -f $cf_dir/curses.h ; then 294 if ( fgrep NCURSES_VERSION $cf_dir/curses.h 2>&1 >/dev/null ) ; then 295 includedir="$cf_symbol" 296 test -n "$verbose" && echo $ac_n " found " 1>&AC_FD_MSG 297 break 298 fi 299 fi 300 test -n "$verbose" && echo " tested $cf_dir" 1>&AC_FD_MSG 301done 302AC_MSG_RESULT($includedir) 303fi 304])dnl 305dnl --------------------------------------------------------------------------- 306dnl Check if the terminal-capability database functions are available. If not, 307dnl ncurses has a much-reduced version. 308AC_DEFUN([CF_CGETENT],[ 309AC_MSG_CHECKING(for terminal-capability database functions) 310AC_CACHE_VAL(cf_cv_cgetent,[ 311AC_TRY_LINK([ 312#include <stdlib.h>],[ 313 char temp[128]; 314 char *buf = temp; 315 char *db_array = temp; 316 cgetent(&buf, /* int *, */ &db_array, "vt100"); 317 cgetcap(buf, "tc", '='); 318 cgetmatch(buf, "tc"); 319 ], 320 [cf_cv_cgetent=yes], 321 [cf_cv_cgetent=no]) 322]) 323AC_MSG_RESULT($cf_cv_cgetent) 324test "$cf_cv_cgetent" = yes && AC_DEFINE(HAVE_BSD_CGETENT) 325])dnl 326dnl --------------------------------------------------------------------------- 327dnl Check if we're accidentally using a cache from a different machine. 328dnl Derive the system name, as a check for reusing the autoconf cache. 329dnl 330dnl If we've packaged config.guess and config.sub, run that (since it does a 331dnl better job than uname). Normally we'll use AC_CANONICAL_HOST, but allow 332dnl an extra parameter that we may override, e.g., for AC_CANONICAL_SYSTEM 333dnl which is useful in cross-compiles. 334AC_DEFUN([CF_CHECK_CACHE], 335[ 336if test -f $srcdir/config.guess ; then 337 ifelse([$1],,[AC_CANONICAL_HOST],[$1]) 338 system_name="$host_os" 339else 340 system_name="`(uname -s -r) 2>/dev/null`" 341 if test -z "$system_name" ; then 342 system_name="`(hostname) 2>/dev/null`" 343 fi 344fi 345test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name") 346AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"]) 347 348test -z "$system_name" && system_name="$cf_cv_system_name" 349test -n "$cf_cv_system_name" && AC_MSG_RESULT(Configuring for $cf_cv_system_name) 350 351if test ".$system_name" != ".$cf_cv_system_name" ; then 352 AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)) 353 AC_ERROR("Please remove config.cache and try again.") 354fi 355])dnl 356dnl --------------------------------------------------------------------------- 357dnl Check for data that is usually declared in <stdio.h> or <errno.h>, e.g., 358dnl the 'errno' variable. Define a DECL_xxx symbol if we must declare it 359dnl ourselves. 360dnl 361dnl $1 = the name to check 362AC_DEFUN([CF_CHECK_ERRNO], 363[ 364AC_CACHE_CHECK(if external $1 is declared, cf_cv_dcl_$1,[ 365 AC_TRY_COMPILE([ 366#ifdef HAVE_STDLIB_H 367#include <stdlib.h> 368#endif 369#include <stdio.h> 370#include <sys/types.h> 371#include <errno.h> ], 372 [long x = (long) $1], 373 [cf_cv_dcl_$1=yes], 374 [cf_cv_dcl_$1=no]) 375]) 376 377if test "$cf_cv_dcl_$1" = no ; then 378 CF_UPPER(cf_result,decl_$1) 379 AC_DEFINE_UNQUOTED($cf_result) 380fi 381 382# It's possible (for near-UNIX clones) that the data doesn't exist 383CF_CHECK_EXTERN_DATA($1,int) 384])dnl 385dnl --------------------------------------------------------------------------- 386dnl Check for existence of external data in the current set of libraries. If 387dnl we can modify it, it's real enough. 388dnl $1 = the name to check 389dnl $2 = its type 390AC_DEFUN([CF_CHECK_EXTERN_DATA], 391[ 392AC_CACHE_CHECK(if external $1 exists, cf_cv_have_$1,[ 393 AC_TRY_LINK([ 394#undef $1 395extern $2 $1; 396], 397 [$1 = 2], 398 [cf_cv_have_$1=yes], 399 [cf_cv_have_$1=no]) 400]) 401 402if test "$cf_cv_have_$1" = yes ; then 403 CF_UPPER(cf_result,have_$1) 404 AC_DEFINE_UNQUOTED($cf_result) 405fi 406 407])dnl 408dnl --------------------------------------------------------------------------- 409dnl Check if the C++ compiler accepts duplicate parameter initialization. This 410dnl is a late feature for the standard and is not in some recent compilers 411dnl (1999/9/11). 412AC_DEFUN([CF_CPP_PARAM_INIT], 413[ 414if test -n "$CXX"; then 415AC_CACHE_CHECK(if $CXX accepts parameter initialization,cf_cv_cpp_param_init,[ 416 AC_LANG_SAVE 417 AC_LANG_CPLUSPLUS 418 AC_TRY_RUN([ 419class TEST { 420private: 421 int value; 422public: 423 TEST(int x = 1); 424 ~TEST(); 425}; 426 427TEST::TEST(int x = 1) // some compilers do not like second initializer 428{ 429 value = x; 430} 431void main() { } 432], 433 [cf_cv_cpp_param_init=yes], 434 [cf_cv_cpp_param_init=no], 435 [cf_cv_cpp_param_init=unknown]) 436 AC_LANG_RESTORE 437]) 438fi 439test "$cf_cv_cpp_param_init" = yes && AC_DEFINE(CPP_HAS_PARAM_INIT) 440])dnl 441dnl --------------------------------------------------------------------------- 442dnl Check if the g++ compiler supports vscan function (not a standard feature). 443AC_DEFUN([CF_CPP_VSCAN_FUNC], 444[ 445if test -n "$CXX"; then 446 447AC_LANG_SAVE 448AC_LANG_CPLUSPLUS 449AC_CHECK_HEADERS(strstream.h) 450 451AC_CACHE_CHECK(if $CXX supports vscan function,cf_cv_cpp_vscan_func,[ 452 for cf_vscan_func in strstream strstream_cast stdio 453 do 454 case $cf_vscan_func in #(vi 455 stdio) cf_vscan_defs=USE_STDIO_VSCAN ;; #(vi 456 strstream) cf_vscan_defs=USE_STRSTREAM_VSCAN ;; 457 strstream_cast) cf_vscan_defs=USE_STRSTREAM_VSCAN_CAST ;; 458 esac 459 AC_TRY_LINK([ 460#include <stdio.h> 461#include <stdarg.h> 462#define $cf_vscan_defs 1 463#if defined(USE_STDIO_VSCAN) 464#elif defined(HAVE_STRSTREAM_H) && defined(USE_STRSTREAM_VSCAN) 465#include <strstream.h> 466#endif 467 468int scanw(const char* fmt, ...) 469{ 470 int result = -1; 471 char buf[BUFSIZ]; 472 473 va_list args; 474 va_start(args, fmt); 475#if defined(USE_STDIO_VSCAN) 476 if (::vsscanf(buf, fmt, args) != -1) 477 result = 0; 478#elif defined(USE_STRSTREAM_VSCAN) 479 strstreambuf ss(buf, sizeof(buf)); 480 if (ss.vscan(fmt, args) != -1) 481 result = 0; 482#elif defined(USE_STRSTREAM_VSCAN_CAST) 483 strstreambuf ss(buf, sizeof(buf)); 484 if (ss.vscan(fmt, (_IO_va_list)args) != -1) 485 result = 0; 486#else 487#error case $cf_vscan_func failed 488#endif 489 va_end(args); 490 return result; 491} 492],[int tmp, foo = scanw("%d", &tmp)], 493 [cf_cv_cpp_vscan_func=$cf_vscan_func; break], 494 [cf_cv_cpp_vscan_func=no]) 495 test "$cf_cv_cpp_vscan_func" != no && break 496 done 497]) 498 499AC_LANG_RESTORE 500fi 501 502case $cf_cv_cpp_vscan_func in #(vi 503stdio) #(vi 504 AC_DEFINE(CPP_HAS_VSCAN_FUNC) 505 AC_DEFINE(USE_STDIO_VSCAN) 506 ;; 507strstream) 508 AC_DEFINE(CPP_HAS_VSCAN_FUNC) 509 AC_DEFINE(USE_STRSTREAM_VSCAN) 510 ;; 511strstream_cast) 512 AC_DEFINE(CPP_HAS_VSCAN_FUNC) 513 AC_DEFINE(USE_STRSTREAM_VSCAN_CAST) 514 ;; 515esac 516])dnl 517dnl --------------------------------------------------------------------------- 518dnl "dirname" is not portable, so we fake it with a shell script. 519AC_DEFUN([CF_DIRNAME],[$1=`echo $2 | sed -e 's:/[[^/]]*$::'`])dnl 520dnl --------------------------------------------------------------------------- 521AC_DEFUN([CF_DIRS_TO_MAKE], 522[ 523DIRS_TO_MAKE="lib" 524for cf_item in $cf_list_models 525do 526 CF_OBJ_SUBDIR($cf_item,cf_subdir) 527 for cf_item2 in $DIRS_TO_MAKE 528 do 529 test $cf_item2 = $cf_subdir && break 530 done 531 test ".$cf_item2" != ".$cf_subdir" && DIRS_TO_MAKE="$DIRS_TO_MAKE $cf_subdir" 532done 533for cf_dir in $DIRS_TO_MAKE 534do 535 test ! -d $cf_dir && mkdir $cf_dir 536done 537AC_SUBST(DIRS_TO_MAKE) 538])dnl 539dnl --------------------------------------------------------------------------- 540dnl Check if 'errno' is declared in <errno.h> 541AC_DEFUN([CF_ERRNO], 542[ 543CF_CHECK_ERRNO(errno) 544])dnl 545dnl --------------------------------------------------------------------------- 546dnl Test for conflicting definitions of exception in gcc 2.8.0, etc., between 547dnl math.h and builtin.h, only for ncurses 548AC_DEFUN([CF_ETIP_DEFINES], 549[ 550AC_MSG_CHECKING(for special defines needed for etip.h) 551cf_save_CXXFLAGS="$CXXFLAGS" 552cf_result="none" 553for cf_math in "" MATH_H 554do 555for cf_excp in "" MATH_EXCEPTION 556do 557 CXXFLAGS="$cf_save_CXXFLAGS -I${srcdir}/c++ -I${srcdir}/menu" 558 test -n "$cf_math" && CXXFLAGS="$CXXFLAGS -DETIP_NEEDS_${cf_math}" 559 test -n "$cf_excp" && CXXFLAGS="$CXXFLAGS -DETIP_NEEDS_${cf_excp}" 560AC_TRY_COMPILE([ 561#include <etip.h.in> 562],[],[ 563 test -n "$cf_math" && AC_DEFINE_UNQUOTED(ETIP_NEEDS_${cf_math}) 564 test -n "$cf_excp" && AC_DEFINE_UNQUOTED(ETIP_NEEDS_${cf_excp}) 565 cf_result="$cf_math $cf_excp" 566 break 567],[]) 568done 569done 570AC_MSG_RESULT($cf_result) 571CXXFLAGS="$cf_save_CXXFLAGS" 572]) 573dnl --------------------------------------------------------------------------- 574dnl Check for memmove, or a bcopy that can handle overlapping copy. If neither 575dnl is found, add our own version of memmove to the list of objects. 576AC_DEFUN([CF_FUNC_MEMMOVE], 577[ 578AC_CHECK_FUNC(memmove,,[ 579AC_CHECK_FUNC(bcopy,[ 580 AC_CACHE_CHECK(if bcopy does overlapping moves,cf_cv_good_bcopy,[ 581 AC_TRY_RUN([ 582int main() { 583 static char data[] = "abcdefghijklmnopqrstuwwxyz"; 584 char temp[40]; 585 bcopy(data, temp, sizeof(data)); 586 bcopy(temp+10, temp, 15); 587 bcopy(temp+5, temp+15, 10); 588 exit (strcmp(temp, "klmnopqrstuwwxypqrstuwwxyz")); 589} 590 ], 591 [cf_cv_good_bcopy=yes], 592 [cf_cv_good_bcopy=no], 593 [cf_cv_good_bcopy=unknown]) 594 ]) 595 ],[cf_cv_good_bcopy=no]) 596 if test "$cf_cv_good_bcopy" = yes ; then 597 AC_DEFINE(USE_OK_BCOPY) 598 else 599 AC_DEFINE(USE_MY_MEMMOVE) 600 fi 601])])dnl 602dnl --------------------------------------------------------------------------- 603dnl See if the poll function really works. Some platforms have poll(), but 604dnl it does not work for terminals or files. 605AC_DEFUN([CF_FUNC_POLL],[ 606AC_CACHE_CHECK(if poll really works,cf_cv_working_poll,[ 607AC_TRY_RUN([ 608#include <stdio.h> 609#ifdef HAVE_POLL_H 610#include <poll.h> 611#else 612#include <sys/poll.h> 613#endif 614int main() { 615 struct pollfd myfds; 616 int ret; 617 618 myfds.fd = 0; 619 myfds.events = POLLIN; 620 621 ret = poll(&myfds, 1, 100); 622 exit(ret != 0); 623}], 624 [cf_cv_working_poll=yes], 625 [cf_cv_working_poll=no], 626 [cf_cv_working_poll=unknown])]) 627test "$cf_cv_working_poll" = "yes" && AC_DEFINE(HAVE_WORKING_POLL) 628])dnl 629dnl --------------------------------------------------------------------------- 630dnl Some old/broken variations define tcgetattr() only as a macro in 631dnl termio(s).h 632AC_DEFUN([CF_FUNC_TERMIOS],[ 633AC_REQUIRE([CF_STRUCT_TERMIOS]) 634AC_CACHE_CHECK(for tcgetattr, cf_cv_have_tcgetattr,[ 635AC_TRY_LINK([ 636#include <sys/types.h> 637#ifdef HAVE_UNISTD_H 638#include <unistd.h> 639#endif 640#ifdef HAVE_TERMIOS_H 641#include <termios.h> 642#define TTY struct termios 643#else 644#ifdef HAVE_TERMIO_H 645#include <termio.h> 646#define TTY struct termio 647#endif 648#endif 649],[ 650TTY foo; 651tcgetattr(1, &foo);], 652[cf_cv_have_tcgetattr=yes], 653[cf_cv_have_tcgetattr=no])]) 654test "$cf_cv_have_tcgetattr" = yes && AC_DEFINE(HAVE_TCGETATTR) 655])dnl 656dnl --------------------------------------------------------------------------- 657dnl Check for vsscanf() function, which is in c9x but generally not in earlier 658dnl versions of C. It is in the GNU C library, and can often be simulated by 659dnl other functions. 660AC_DEFUN([CF_FUNC_VSSCANF], 661[ 662AC_CACHE_CHECK(for vsscanf function or workaround,cf_cv_func_vsscanf,[ 663AC_TRY_LINK([ 664#include <stdarg.h> 665#include <stdio.h>],[ 666 va_list ap; 667 vsscanf("from", "%d", ap)],[cf_cv_func_vsscanf=vsscanf],[ 668AC_TRY_LINK([ 669#include <stdarg.h> 670#include <stdio.h>],[ 671 FILE strbuf; 672 char *str = "from"; 673 674 strbuf._flag = _IOREAD; 675 strbuf._ptr = strbuf._base = (unsigned char *) str; 676 strbuf._cnt = strlen(str); 677 strbuf._file = _NFILE; 678 return (vfscanf(&strbuf, "%d", ap))],[cf_cv_func_vsscanf=vfscanf],[ 679AC_TRY_LINK([ 680#include <stdarg.h> 681#include <stdio.h>],[ 682 FILE strbuf; 683 char *str = "from"; 684 685 strbuf._flag = _IOREAD; 686 strbuf._ptr = strbuf._base = (unsigned char *) str; 687 strbuf._cnt = strlen(str); 688 strbuf._file = _NFILE; 689 return (_doscan(&strbuf, "%d", ap))],[cf_cv_func_vsscanf=_doscan],[ 690cf_cv_func_vsscanf=no])])])]) 691 692case $cf_cv_func_vsscanf in #(vi 693vsscanf) AC_DEFINE(HAVE_VSSCANF);; #(vi 694vfscanf) AC_DEFINE(HAVE_VFSCANF);; #(vi 695_doscan) AC_DEFINE(HAVE__DOSCAN);; 696esac 697 698])dnl 699dnl --------------------------------------------------------------------------- 700dnl Test for availability of useful gcc __attribute__ directives to quiet 701dnl compiler warnings. Though useful, not all are supported -- and contrary 702dnl to documentation, unrecognized directives cause older compilers to barf. 703AC_DEFUN([CF_GCC_ATTRIBUTES], 704[ 705if test "$GCC" = yes 706then 707cat > conftest.i <<EOF 708#ifndef GCC_PRINTF 709#define GCC_PRINTF 0 710#endif 711#ifndef GCC_SCANF 712#define GCC_SCANF 0 713#endif 714#ifndef GCC_NORETURN 715#define GCC_NORETURN /* nothing */ 716#endif 717#ifndef GCC_UNUSED 718#define GCC_UNUSED /* nothing */ 719#endif 720EOF 721if test "$GCC" = yes 722then 723 AC_CHECKING([for $CC __attribute__ directives]) 724cat > conftest.$ac_ext <<EOF 725#line __oline__ "configure" 726#include "confdefs.h" 727#include "conftest.h" 728#include "conftest.i" 729#if GCC_PRINTF 730#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var))) 731#else 732#define GCC_PRINTFLIKE(fmt,var) /*nothing*/ 733#endif 734#if GCC_SCANF 735#define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var))) 736#else 737#define GCC_SCANFLIKE(fmt,var) /*nothing*/ 738#endif 739extern void wow(char *,...) GCC_SCANFLIKE(1,2); 740extern void oops(char *,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN; 741extern void foo(void) GCC_NORETURN; 742int main(int argc GCC_UNUSED, char *argv[[]] GCC_UNUSED) { return 0; } 743EOF 744 for cf_attribute in scanf printf unused noreturn 745 do 746 CF_UPPER(CF_ATTRIBUTE,$cf_attribute) 747 cf_directive="__attribute__(($cf_attribute))" 748 echo "checking for $CC $cf_directive" 1>&AC_FD_CC 749 case $cf_attribute in 750 scanf|printf) 751 cat >conftest.h <<EOF 752#define GCC_$CF_ATTRIBUTE 1 753EOF 754 ;; 755 *) 756 cat >conftest.h <<EOF 757#define GCC_$CF_ATTRIBUTE $cf_directive 758EOF 759 ;; 760 esac 761 if AC_TRY_EVAL(ac_compile); then 762 test -n "$verbose" && AC_MSG_RESULT(... $cf_attribute) 763 cat conftest.h >>confdefs.h 764# else 765# sed -e 's/__attr.*/\/*nothing*\//' conftest.h >>confdefs.h 766 fi 767 done 768else 769 fgrep define conftest.i >>confdefs.h 770fi 771rm -rf conftest* 772fi 773])dnl 774dnl --------------------------------------------------------------------------- 775dnl Check if the compiler supports useful warning options. There's a few that 776dnl we don't use, simply because they're too noisy: 777dnl 778dnl -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x) 779dnl -Wredundant-decls (system headers make this too noisy) 780dnl -Wtraditional (combines too many unrelated messages, only a few useful) 781dnl -Wwrite-strings (too noisy, but should review occasionally) 782dnl -pedantic 783dnl 784AC_DEFUN([CF_GCC_WARNINGS], 785[ 786if test "$GCC" = yes 787then 788 cat > conftest.$ac_ext <<EOF 789#line __oline__ "configure" 790int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; } 791EOF 792 AC_CHECKING([for $CC warning options]) 793 cf_save_CFLAGS="$CFLAGS" 794 EXTRA_CFLAGS="-W -Wall" 795 cf_warn_CONST="" 796 test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings" 797 for cf_opt in \ 798 Wbad-function-cast \ 799 Wcast-align \ 800 Wcast-qual \ 801 Winline \ 802 Wmissing-declarations \ 803 Wmissing-prototypes \ 804 Wnested-externs \ 805 Wpointer-arith \ 806 Wshadow \ 807 Wstrict-prototypes $cf_warn_CONST 808 do 809 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" 810 if AC_TRY_EVAL(ac_compile); then 811 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt) 812 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" 813 test "$cf_opt" = Wcast-qual && EXTRA_CFLAGS="$EXTRA_CFLAGS -DXTSTRINGDEFINES" 814 fi 815 done 816 rm -f conftest* 817 CFLAGS="$cf_save_CFLAGS" 818fi 819AC_SUBST(EXTRA_CFLAGS) 820])dnl 821dnl --------------------------------------------------------------------------- 822dnl Verify that a test program compiles and runs with GNAT 823dnl $cf_ada_make is set to the program that compiles/links 824AC_DEFUN([CF_GNAT_TRY_RUN], 825[ 826rm -f conftest* 827cat >>conftest.ads <<CF_EOF 828$1 829CF_EOF 830cat >>conftest.adb <<CF_EOF 831$2 832CF_EOF 833if ( $cf_ada_make conftest 1>&AC_FD_CC 2>&1 ) ; then 834 if ( ./conftest 1>&AC_FD_CC 2>&1 ) ; then 835ifelse($3,, :,[ $3]) 836ifelse($4,,,[ else 837 $4]) 838 fi 839ifelse($4,,,[else 840 $4]) 841fi 842rm -f conftest* 843])dnl 844dnl --------------------------------------------------------------------------- 845dnl Verify Version of GNAT. 846AC_DEFUN([CF_GNAT_VERSION], 847[ 848cf_cv_gnat_version=`$cf_ada_make -v 2>&1 | grep '[[0-9]].[[0-9]][[0-9]]*' |\ 849 sed -e 's/[[^0-9 \.]]//g' | $AWK '{print $[1];}'` 850case $cf_cv_gnat_version in 851 3.1[[1-9]]*|3.[[2-9]]*|[[4-9]].*) 852 cf_cv_prog_gnat_correct=yes 853 ;; 854 *) echo Unsupported GNAT version $cf_cv_gnat_version. Required is 3.11 or better. Disabling Ada95 binding. 855 cf_cv_prog_gnat_correct=no 856 ;; 857esac 858case $cf_cv_gnat_version in 859 3.1*|[[4-9]].*) 860 cf_compile_generics=generics 861 cf_generic_objects="\$(GENOBJS)" 862 ;; 863 *) cf_compile_generics= 864 cf_generic_objects= 865 ;; 866esac 867]) 868dnl --------------------------------------------------------------------------- 869dnl Check if we must define _GNU_SOURCE to get a reasonable value for 870dnl _XOPEN_SOURCE, upon which many POSIX definitions depend. This is a defect 871dnl (or misfeature) of glibc2, which breaks portability of many applications, 872dnl since it is interwoven with GNU extensions. 873dnl 874dnl Well, yes we could work around it... 875AC_DEFUN([CF_GNU_SOURCE], 876[ 877AC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[ 878AC_TRY_COMPILE([#include <sys/types.h>],[ 879#ifndef _XOPEN_SOURCE 880make an error 881#endif], 882 [cf_cv_gnu_source=no], 883 [cf_save="$CPPFLAGS" 884 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" 885 AC_TRY_COMPILE([#include <sys/types.h>],[ 886#ifdef _XOPEN_SOURCE 887make an error 888#endif], 889 [cf_cv_gnu_source=no], 890 [cf_cv_gnu_source=yes]) 891 CPPFLAGS="$cf_save" 892 ]) 893]) 894test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" 895])dnl 896dnl --------------------------------------------------------------------------- 897dnl If we're trying to use g++, test if libg++ is installed (a rather common 898dnl problem :-). If we have the compiler but no library, we'll be able to 899dnl configure, but won't be able to build the c++ demo program. 900AC_DEFUN([CF_GPP_LIBRARY], 901[ 902cf_cxx_library=unknown 903case $cf_cv_system_name in #(vi 904os2*) #(vi 905 cf_gpp_libname=gpp 906 ;; 907*) 908 cf_gpp_libname=g++ 909 ;; 910esac 911if test "$ac_cv_prog_gxx" = yes; then 912 AC_MSG_CHECKING([for lib$cf_gpp_libname]) 913 cf_save="$LIBS" 914 LIBS="$LIBS -l$cf_gpp_libname" 915 AC_TRY_LINK([ 916#include <$cf_gpp_libname/builtin.h> 917 ], 918 [two_arg_error_handler_t foo2 = lib_error_handler], 919 [cf_cxx_library=yes 920 CXXLIBS="$CXXLIBS -l$cf_gpp_libname" 921 if test "$cf_gpp_libname" = cpp ; then 922 AC_DEFINE(HAVE_GPP_BUILTIN_H) 923 else 924 AC_DEFINE(HAVE_GXX_BUILTIN_H) 925 fi], 926 [AC_TRY_LINK([ 927#include <builtin.h> 928 ], 929 [two_arg_error_handler_t foo2 = lib_error_handler], 930 [cf_cxx_library=yes 931 CXXLIBS="$CXXLIBS -l$cf_gpp_libname" 932 AC_DEFINE(HAVE_BUILTIN_H)], 933 [cf_cxx_library=no])]) 934 LIBS="$cf_save" 935 AC_MSG_RESULT($cf_cxx_library) 936fi 937])dnl 938dnl --------------------------------------------------------------------------- 939dnl Insert text into the help-message, for readability, from AC_ARG_WITH. 940AC_DEFUN([CF_HELP_MESSAGE], 941[AC_DIVERT_HELP([$1])dnl 942])dnl 943dnl --------------------------------------------------------------------------- 944dnl Construct the list of include-options according to whether we're building 945dnl in the source directory or using '--srcdir=DIR' option. If we're building 946dnl with gcc, don't append the includedir if it happens to be /usr/include, 947dnl since that usually breaks gcc's shadow-includes. 948AC_DEFUN([CF_INCLUDE_DIRS], 949[ 950CPPFLAGS="$CPPFLAGS -I. -I../include" 951if test "$srcdir" != "."; then 952 CPPFLAGS="$CPPFLAGS -I\$(srcdir)/../include" 953fi 954if test "$GCC" != yes; then 955 CPPFLAGS="$CPPFLAGS -I\$(includedir)" 956elif test "$includedir" != "/usr/include"; then 957 if test "$includedir" = '${prefix}/include' ; then 958 if test $prefix != /usr ; then 959 CPPFLAGS="$CPPFLAGS -I\$(includedir)" 960 fi 961 else 962 CPPFLAGS="$CPPFLAGS -I\$(includedir)" 963 fi 964fi 965AC_SUBST(CPPFLAGS) 966])dnl 967dnl --------------------------------------------------------------------------- 968dnl Check if we have either a function or macro for 'isascii()'. 969AC_DEFUN([CF_ISASCII], 970[ 971AC_MSG_CHECKING(for isascii) 972AC_CACHE_VAL(cf_cv_have_isascii,[ 973 AC_TRY_LINK([#include <ctype.h>],[int x = isascii(' ')], 974 [cf_cv_have_isascii=yes], 975 [cf_cv_have_isascii=no]) 976])dnl 977AC_MSG_RESULT($cf_cv_have_isascii) 978test "$cf_cv_have_isascii" = yes && AC_DEFINE(HAVE_ISASCII) 979])dnl 980dnl --------------------------------------------------------------------------- 981dnl Check for libutf8 982AC_DEFUN([CF_LIBUTF8], 983[ 984AC_CACHE_CHECK(for putwc in libutf8,cf_cv_libutf8,[ 985 cf_save_LIBS="$LIBS" 986 LIBS="-lutf8 $LIBS" 987AC_TRY_LINK([ 988#include <libutf8.h>],[putwc(0,0);], 989 [cf_cv_libutf8=yes], 990 [cf_cv_libutf8=no]) 991 LIBS="$cf_save_LIBS" 992]) 993 994if test "$cf_cv_libutf8" = yes ; then 995 AC_DEFINE(HAVE_LIBUTF8_H) 996 LIBS="-lutf8 $LIBS" 997fi 998])dnl 999dnl --------------------------------------------------------------------------- 1000dnl Compute the library-prefix for the given host system 1001dnl $1 = variable to set 1002AC_DEFUN([CF_LIB_PREFIX], 1003[ 1004 case $cf_cv_system_name in 1005 OS/2*) LIB_PREFIX='' ;; 1006 os2*) LIB_PREFIX='' ;; 1007 *) LIB_PREFIX='lib' ;; 1008 esac 1009ifelse($1,,,[$1=$LIB_PREFIX]) 1010 AC_SUBST(LIB_PREFIX) 1011])dnl 1012dnl --------------------------------------------------------------------------- 1013dnl Append definitions and rules for the given models to the subdirectory 1014dnl Makefiles, and the recursion rule for the top-level Makefile. If the 1015dnl subdirectory is a library-source directory, modify the LIBRARIES list in 1016dnl the corresponding makefile to list the models that we'll generate. 1017dnl 1018dnl For shared libraries, make a list of symbolic links to construct when 1019dnl generating each library. The convention used for Linux is the simplest 1020dnl one: 1021dnl lib<name>.so -> 1022dnl lib<name>.so.<major> -> 1023dnl lib<name>.so.<maj>.<minor> 1024AC_DEFUN([CF_LIB_RULES], 1025[ 1026CF_LIB_PREFIX(cf_prefix) 1027AC_REQUIRE([CF_SUBST_NCURSES_VERSION]) 1028for cf_dir in $SRC_SUBDIRS 1029do 1030 if test -f $srcdir/$cf_dir/modules; then 1031 1032 IMPORT_LIB= 1033 SHARED_LIB= 1034 LIBS_TO_MAKE= 1035 for cf_item in $CF_LIST_MODELS 1036 do 1037 CF_LIB_SUFFIX($cf_item,cf_suffix) 1038 if test $cf_item = shared ; then 1039 if test "$cf_cv_do_symlinks" = yes ; then 1040 case "$cf_cv_shlib_version" in #(vi 1041 rel) #(vi 1042 case "$cf_cv_system_name" in #(vi 1043 darwin*) cf_suffix='.$(REL_VERSION)'"$cf_suffix" ;; #(vi 1044 *) cf_suffix="$cf_suffix"'.$(REL_VERSION)' ;; 1045 esac 1046 ;; 1047 abi) 1048 case "$cf_cv_system_name" in #(vi 1049 darwin*) cf_suffix='.$(ABI_VERSION)'"$cf_suffix" ;; #(vi 1050 *) cf_suffix="$cf_suffix"'.$(ABI_VERSION)' ;; 1051 esac 1052 ;; 1053 esac 1054 fi 1055 # cygwin needs import library, and has unique naming convention 1056 if test $cf_cv_shlib_version = cygdll ; then 1057 SHARED_LIB="../lib/${cf_prefix}${cf_dir}\$(ABI_VERSION).dll" 1058 IMPORT_LIB="../lib/${cf_prefix}${cf_dir}.dll.a" 1059 LIBS_TO_MAKE="$LIBS_TO_MAKE \$(SHARED_LIB) \$(IMPORT_LIB)" 1060 continue 1061 fi 1062 fi 1063 LIBS_TO_MAKE="$LIBS_TO_MAKE ../lib/${cf_prefix}${cf_dir}${cf_suffix}" 1064 done 1065 1066 if test $cf_dir = ncurses ; then 1067 cf_subsets="$LIB_SUBSETS" 1068 case "$LIB_SUBSETS" in #(vi 1069 termlib+*) #(vi 1070 ;; 1071 *) #(vi 1072 cf_item=`echo $LIBS_TO_MAKE |sed -e s/$LIB_NAME/$TINFO_NAME/g` 1073 LIBS_TO_MAKE="$cf_item $LIBS_TO_MAKE" 1074 ;; 1075 esac 1076 else 1077 cf_subsets=`echo "$LIB_SUBSETS" | sed -e 's/^termlib //'` 1078 fi 1079 1080 sed -e "s@\@LIBS_TO_MAKE\@@$LIBS_TO_MAKE@" \ 1081 -e "s@\@IMPORT_LIB\@@$IMPORT_LIB@" \ 1082 -e "s@\@SHARED_LIB\@@$SHARED_LIB@" \ 1083 $cf_dir/Makefile >$cf_dir/Makefile.out 1084 mv $cf_dir/Makefile.out $cf_dir/Makefile 1085 1086 $AWK -f $srcdir/mk-0th.awk \ 1087 libname="${cf_dir}${LIB_SUFFIX}" subsets="$LIB_SUBSETS" \ 1088 $srcdir/$cf_dir/modules >>$cf_dir/Makefile 1089 1090 for cf_subset in $cf_subsets 1091 do 1092 cf_subdirs= 1093 for cf_item in $CF_LIST_MODELS 1094 do 1095 echo "Appending rules for ${cf_item} model (${cf_dir}: ${cf_subset})" 1096 CF_UPPER(CF_ITEM,$cf_item) 1097 CF_LIB_SUFFIX($cf_item,cf_suffix) 1098 CF_OBJ_SUBDIR($cf_item,cf_subdir) 1099 1100 # These dependencies really are for development, not 1101 # builds, but they are useful in porting, too. 1102 cf_depend="../include/ncurses_cfg.h" 1103 if test "$srcdir" = "."; then 1104 cf_reldir="." 1105 else 1106 cf_reldir="\$(srcdir)" 1107 fi 1108 1109 if test -f $srcdir/$cf_dir/$cf_dir.priv.h; then 1110 cf_depend="$cf_depend $cf_reldir/$cf_dir.priv.h" 1111 elif test -f $srcdir/$cf_dir/curses.priv.h; then 1112 cf_depend="$cf_depend $cf_reldir/curses.priv.h" 1113 fi 1114 1115 $AWK -f $srcdir/mk-1st.awk \ 1116 name=$cf_dir \ 1117 traces=$LIB_TRACING \ 1118 MODEL=$CF_ITEM \ 1119 model=$cf_subdir \ 1120 prefix=$cf_prefix \ 1121 suffix=$cf_suffix \ 1122 subset=$cf_subset \ 1123 ShlibVer=$cf_cv_shlib_version \ 1124 ShlibVerInfix=$cf_cv_shlib_version_infix \ 1125 DoLinks=$cf_cv_do_symlinks \ 1126 rmSoLocs=$cf_cv_rm_so_locs \ 1127 ldconfig="$LDCONFIG" \ 1128 overwrite=$WITH_OVERWRITE \ 1129 depend="$cf_depend" \ 1130 target="$target" \ 1131 $srcdir/$cf_dir/modules >>$cf_dir/Makefile 1132 for cf_subdir2 in $cf_subdirs lib 1133 do 1134 test $cf_subdir = $cf_subdir2 && break 1135 done 1136 test "${cf_subset}.${cf_subdir2}" != "${cf_subset}.${cf_subdir}" && \ 1137 $AWK -f $srcdir/mk-2nd.awk \ 1138 name=$cf_dir \ 1139 traces=$LIB_TRACING \ 1140 MODEL=$CF_ITEM \ 1141 model=$cf_subdir \ 1142 subset=$cf_subset \ 1143 srcdir=$srcdir \ 1144 echo=$WITH_ECHO \ 1145 $srcdir/$cf_dir/modules >>$cf_dir/Makefile 1146 cf_subdirs="$cf_subdirs $cf_subdir" 1147 done 1148 done 1149 fi 1150 1151 echo ' cd '$cf_dir' && $(MAKE) $(CF_MFLAGS) [$]@' >>Makefile 1152done 1153 1154for cf_dir in $SRC_SUBDIRS 1155do 1156 if test -f $cf_dir/Makefile ; then 1157 case "$cf_dir" in 1158 Ada95) #(vi 1159 echo 'libs \' >> Makefile 1160 echo 'install.libs \' >> Makefile 1161 echo 'uninstall.libs ::' >> Makefile 1162 echo ' cd '$cf_dir' && $(MAKE) $(CF_MFLAGS) [$]@' >> Makefile 1163 ;; 1164 esac 1165 fi 1166 1167 if test -f $srcdir/$cf_dir/modules; then 1168 echo >> Makefile 1169 if test -f $srcdir/$cf_dir/headers; then 1170cat >> Makefile <<CF_EOF 1171install.includes \\ 1172uninstall.includes \\ 1173CF_EOF 1174 fi 1175if test "$cf_dir" != "c++" ; then 1176echo 'lint \' >> Makefile 1177fi 1178cat >> Makefile <<CF_EOF 1179libs \\ 1180lintlib \\ 1181install.libs \\ 1182uninstall.libs \\ 1183install.$cf_dir \\ 1184uninstall.$cf_dir :: 1185 cd $cf_dir && \$(MAKE) \$(CF_MFLAGS) \[$]@ 1186CF_EOF 1187 elif test -f $srcdir/$cf_dir/headers; then 1188cat >> Makefile <<CF_EOF 1189 1190libs \\ 1191install.libs \\ 1192uninstall.libs \\ 1193install.includes \\ 1194uninstall.includes :: 1195 cd $cf_dir && \$(MAKE) \$(CF_MFLAGS) \[$]@ 1196CF_EOF 1197fi 1198done 1199 1200cat >> Makefile <<CF_EOF 1201 1202install.data \\ 1203uninstall.data :: 1204$MAKE_TERMINFO cd misc && \$(MAKE) \$(CF_MFLAGS) \[$]@ 1205 1206install.man \\ 1207uninstall.man :: 1208 cd man && \$(MAKE) \$(CF_MFLAGS) \[$]@ 1209 1210distclean :: 1211 rm -f config.cache config.log config.status Makefile include/ncurses_cfg.h 1212 rm -f headers.sh headers.sed 1213 rm -rf \$(DIRS_TO_MAKE) 1214CF_EOF 1215 1216# Special case: tack's manpage lives in its own directory. 1217if test -d tack ; then 1218if test -f $srcdir/$tack.h; then 1219cat >> Makefile <<CF_EOF 1220 1221install.man \\ 1222uninstall.man :: 1223 cd tack && \$(MAKE) \$(CF_MFLAGS) \[$]@ 1224CF_EOF 1225fi 1226fi 1227 1228dnl If we're installing into a subdirectory of /usr/include, etc., we should 1229dnl prepend the subdirectory's name to the "#include" paths. It won't hurt 1230dnl anything, and will make it more standardized. It's awkward to decide this 1231dnl at configuration because of quoting, so we'll simply make all headers 1232dnl installed via a script that can do the right thing. 1233 1234rm -f headers.sed headers.sh 1235 1236dnl ( generating this script makes the makefiles a little tidier :-) 1237echo creating headers.sh 1238cat >headers.sh <<CF_EOF 1239#! /bin/sh 1240# This shell script is generated by the 'configure' script. It is invoked in a 1241# subdirectory of the build tree. It generates a sed-script in the parent 1242# directory that is used to adjust includes for header files that reside in a 1243# subdirectory of /usr/include, etc. 1244PRG="" 1245while test \[$]# != 3 1246do 1247PRG="\$PRG \[$]1"; shift 1248done 1249DST=\[$]1 1250REF=\[$]2 1251SRC=\[$]3 1252TMPSRC=\${TMPDIR-/tmp}/\`basename \$SRC\`\$\$ 1253TMPSED=\${TMPDIR-/tmp}/headers.sed\$\$ 1254echo installing \$SRC in \$DST 1255CF_EOF 1256if test $WITH_CURSES_H = yes; then 1257 cat >>headers.sh <<CF_EOF 1258case \$DST in 1259/*/include/*) 1260 END=\`basename \$DST\` 1261 for i in \`cat \$REF/../*/headers |fgrep -v "#"\` 1262 do 1263 NAME=\`basename \$i\` 1264 echo "s/<\$NAME>/<\$END\/\$NAME>/" >> \$TMPSED 1265 done 1266 ;; 1267*) 1268 echo "" >> \$TMPSED 1269 ;; 1270esac 1271CF_EOF 1272else 1273 cat >>headers.sh <<CF_EOF 1274case \$DST in 1275/*/include/*) 1276 END=\`basename \$DST\` 1277 for i in \`cat \$REF/../*/headers |fgrep -v "#"\` 1278 do 1279 NAME=\`basename \$i\` 1280 if test "\$NAME" = "curses.h" 1281 then 1282 echo "s/<curses.h>/<ncurses.h>/" >> \$TMPSED 1283 NAME=ncurses.h 1284 fi 1285 echo "s/<\$NAME>/<\$END\/\$NAME>/" >> \$TMPSED 1286 done 1287 ;; 1288*) 1289 echo "s/<curses.h>/<ncurses.h>/" >> \$TMPSED 1290 ;; 1291esac 1292CF_EOF 1293fi 1294cat >>headers.sh <<CF_EOF 1295rm -f \$TMPSRC 1296sed -f \$TMPSED \$SRC > \$TMPSRC 1297NAME=\`basename \$SRC\` 1298CF_EOF 1299if test $WITH_CURSES_H != yes; then 1300 cat >>headers.sh <<CF_EOF 1301test "\$NAME" = "curses.h" && NAME=ncurses.h 1302CF_EOF 1303fi 1304cat >>headers.sh <<CF_EOF 1305# Just in case someone gzip'd manpages, remove the conflicting copy. 1306test -f \$DST/\$NAME.gz && rm -f \$DST/\$NAME.gz 1307 1308eval \$PRG \$TMPSRC \$DST/\$NAME 1309rm -f \$TMPSRC \$TMPSED 1310CF_EOF 1311 1312chmod 0755 headers.sh 1313 1314for cf_dir in $SRC_SUBDIRS 1315do 1316 if test -f $srcdir/$cf_dir/headers; then 1317 cat >>$cf_dir/Makefile <<CF_EOF 1318\$(DESTDIR)\$(includedir) : 1319 sh \$(srcdir)/../mkinstalldirs \[$]@ 1320 1321install \\ 1322install.libs \\ 1323install.includes :: \$(AUTO_SRC) \$(DESTDIR)\$(includedir) \\ 1324CF_EOF 1325 j="" 1326 for i in `cat $srcdir/$cf_dir/headers |fgrep -v "#"` 1327 do 1328 test -n "$j" && echo " $j \\" >>$cf_dir/Makefile 1329 j=$i 1330 done 1331 echo " $j" >>$cf_dir/Makefile 1332 for i in `cat $srcdir/$cf_dir/headers |fgrep -v "#"` 1333 do 1334 echo " @ (cd \$(DESTDIR)\$(includedir) && rm -f `basename $i`) ; ../headers.sh \$(INSTALL_DATA) \$(DESTDIR)\$(includedir) \$(srcdir) $i" >>$cf_dir/Makefile 1335 test $i = curses.h && test $WITH_CURSES_H = yes && echo " @ (cd \$(DESTDIR)\$(includedir) && rm -f ncurses.h && \$(LN_S) curses.h ncurses.h)" >>$cf_dir/Makefile 1336 done 1337 1338 cat >>$cf_dir/Makefile <<CF_EOF 1339 1340uninstall \\ 1341uninstall.libs \\ 1342uninstall.includes :: 1343CF_EOF 1344 for i in `cat $srcdir/$cf_dir/headers |fgrep -v "#"` 1345 do 1346 i=`basename $i` 1347 echo " -@ (cd \$(DESTDIR)\$(includedir) && rm -f $i)" >>$cf_dir/Makefile 1348 test $i = curses.h && echo " -@ (cd \$(DESTDIR)\$(includedir) && rm -f ncurses.h)" >>$cf_dir/Makefile 1349 done 1350 fi 1351 1352 if test -f $srcdir/$cf_dir/modules; then 1353 if test "$cf_dir" != "c++" ; then 1354 cat >>$cf_dir/Makefile <<"CF_EOF" 1355depend : $(AUTO_SRC) 1356 makedepend -- $(CPPFLAGS) -- $(C_SRC) 1357 1358# DO NOT DELETE THIS LINE -- make depend depends on it. 1359CF_EOF 1360 fi 1361 fi 1362done 1363 1364])dnl 1365dnl --------------------------------------------------------------------------- 1366dnl Compute the library file-suffix from the given model name 1367dnl $1 = model name 1368dnl $2 = variable to set 1369dnl The variable $LIB_SUFFIX, if set, prepends the variable to set. 1370AC_DEFUN([CF_LIB_SUFFIX], 1371[ 1372 AC_REQUIRE([CF_SUBST_NCURSES_VERSION]) 1373 case $1 in 1374 libtool) $2='.la' ;; 1375 normal) $2='.a' ;; 1376 debug) $2='_g.a' ;; 1377 profile) $2='_p.a' ;; 1378 shared) 1379 case $cf_cv_system_name in 1380 cygwin*) $2='.dll' ;; 1381 darwin*) $2='.dylib' ;; 1382 hpux*) $2='.sl' ;; 1383 *) $2='.so' ;; 1384 esac 1385 esac 1386 test -n "$LIB_SUFFIX" && $2="${LIB_SUFFIX}[$]{$2}" 1387])dnl 1388dnl --------------------------------------------------------------------------- 1389dnl Compute the string to append to -library from the given model name 1390dnl $1 = model name 1391dnl $2 = variable to set 1392dnl The variable $LIB_SUFFIX, if set, prepends the variable to set. 1393AC_DEFUN([CF_LIB_TYPE], 1394[ 1395 case $1 in 1396 libtool) $2='' ;; 1397 normal) $2='' ;; 1398 debug) $2='_g' ;; 1399 profile) $2='_p' ;; 1400 shared) $2='' ;; 1401 esac 1402 test -n "$LIB_SUFFIX" && $2="${LIB_SUFFIX}[$]{$2}" 1403])dnl 1404dnl --------------------------------------------------------------------------- 1405dnl Some systems have a non-ANSI linker that doesn't pull in modules that have 1406dnl only data (i.e., no functions), for example NeXT. On those systems we'll 1407dnl have to provide wrappers for global tables to ensure they're linked 1408dnl properly. 1409AC_DEFUN([CF_LINK_DATAONLY], 1410[ 1411AC_MSG_CHECKING([if data-only library module links]) 1412AC_CACHE_VAL(cf_cv_link_dataonly,[ 1413 rm -f conftest.a 1414 cat >conftest.$ac_ext <<EOF 1415#line __oline__ "configure" 1416int testdata[[3]] = { 123, 456, 789 }; 1417EOF 1418 if AC_TRY_EVAL(ac_compile) ; then 1419 mv conftest.o data.o && \ 1420 ( $AR $AR_OPTS conftest.a data.o ) 2>&5 1>/dev/null 1421 fi 1422 rm -f conftest.$ac_ext data.o 1423 cat >conftest.$ac_ext <<EOF 1424#line __oline__ "configure" 1425int testfunc() 1426{ 1427#if defined(NeXT) 1428 exit(1); /* I'm told this linker is broken */ 1429#else 1430 extern int testdata[[3]]; 1431 return testdata[[0]] == 123 1432 && testdata[[1]] == 456 1433 && testdata[[2]] == 789; 1434#endif 1435} 1436EOF 1437 if AC_TRY_EVAL(ac_compile); then 1438 mv conftest.o func.o && \ 1439 ( $AR $AR_OPTS conftest.a func.o ) 2>&5 1>/dev/null 1440 fi 1441 rm -f conftest.$ac_ext func.o 1442 ( eval $ac_cv_prog_RANLIB conftest.a ) 2>&5 >/dev/null 1443 cf_saveLIBS="$LIBS" 1444 LIBS="conftest.a $LIBS" 1445 AC_TRY_RUN([ 1446 int main() 1447 { 1448 extern int testfunc(); 1449 exit (!testfunc()); 1450 } 1451 ], 1452 [cf_cv_link_dataonly=yes], 1453 [cf_cv_link_dataonly=no], 1454 [cf_cv_link_dataonly=unknown]) 1455 LIBS="$cf_saveLIBS" 1456 ]) 1457AC_MSG_RESULT($cf_cv_link_dataonly) 1458 1459if test "$cf_cv_link_dataonly" = no ; then 1460 AC_DEFINE(BROKEN_LINKER) 1461 BROKEN_LINKER=1 1462fi 1463 1464])dnl 1465dnl --------------------------------------------------------------------------- 1466dnl Most Unix systems have both link and symlink, a few don't have symlink. 1467dnl A few non-Unix systems implement symlink, but not link. 1468dnl A few non-systems implement neither (or have nonfunctional versions). 1469AC_DEFUN([CF_LINK_FUNCS], 1470[ 1471AC_CHECK_FUNCS( \ 1472 remove \ 1473 unlink ) 1474 1475if test "$ac_cv_prog_cc_cross" = yes ; then 1476 AC_CHECK_FUNCS( \ 1477 link \ 1478 symlink ) 1479else 1480 AC_CACHE_CHECK(if link/symlink functions work,cf_cv_link_funcs,[ 1481 cf_cv_link_funcs= 1482 for cf_func in link symlink ; do 1483 AC_TRY_RUN([ 1484#include <sys/types.h> 1485#include <sys/stat.h> 1486#ifdef HAVE_UNISTD_H 1487#include <unistd.h> 1488#endif 1489int main() 1490{ 1491 int fail = 0; 1492 char *src = "config.log"; 1493 char *dst = "conftest.chk"; 1494 struct stat src_sb; 1495 struct stat dst_sb; 1496 1497 stat(src, &src_sb); 1498 fail = ($cf_func("config.log", "conftest.chk") < 0) 1499 || (stat(dst, &dst_sb) < 0) 1500 || (dst_sb.st_mtime != src_sb.st_mtime); 1501#ifdef HAVE_UNLINK 1502 unlink(dst); 1503#else 1504 remove(dst); 1505#endif 1506 exit (fail); 1507} 1508 ],[ 1509 cf_cv_link_funcs="$cf_cv_link_funcs $cf_func" 1510 eval 'ac_cv_func_'$cf_func'=yes'],[ 1511 eval 'ac_cv_func_'$cf_func'=no'],[ 1512 eval 'ac_cv_func_'$cf_func'=error']) 1513 done 1514 test -z "$cf_cv_link_funcs" && cf_cv_link_funcs=no 1515 ]) 1516 test "$ac_cv_func_link" = yes && AC_DEFINE(HAVE_LINK) 1517 test "$ac_cv_func_symlink" = yes && AC_DEFINE(HAVE_SYMLINK) 1518fi 1519])dnl 1520dnl --------------------------------------------------------------------------- 1521dnl Some 'make' programs support $(MAKEFLAGS), some $(MFLAGS), to pass 'make' 1522dnl options to lower-levels. It's very useful for "make -n" -- if we have it. 1523dnl (GNU 'make' does both, something POSIX 'make', which happens to make the 1524dnl $(MAKEFLAGS) variable incompatible because it adds the assignments :-) 1525AC_DEFUN([CF_MAKEFLAGS], 1526[ 1527AC_CACHE_CHECK(for makeflags variable, cf_cv_makeflags,[ 1528 cf_cv_makeflags='' 1529 for cf_option in '-$(MAKEFLAGS)' '$(MFLAGS)' 1530 do 1531 cat >cf_makeflags.tmp <<CF_EOF 1532SHELL = /bin/sh 1533all : 1534 @ echo '.$cf_option' 1535CF_EOF 1536 cf_result=`${MAKE-make} -k -f cf_makeflags.tmp 2>/dev/null` 1537 case "$cf_result" in 1538 .*k) 1539 cf_result=`${MAKE-make} -k -f cf_makeflags.tmp CC=cc 2>/dev/null` 1540 case "$cf_result" in 1541 .*CC=*) cf_cv_makeflags= 1542 ;; 1543 *) cf_cv_makeflags=$cf_option 1544 ;; 1545 esac 1546 break 1547 ;; 1548 *) echo no match "$cf_result" 1549 ;; 1550 esac 1551 done 1552 rm -f cf_makeflags.tmp 1553]) 1554 1555AC_SUBST(cf_cv_makeflags) 1556])dnl 1557dnl --------------------------------------------------------------------------- 1558dnl Generate tags/TAGS targets for makefiles. Do not generate TAGS if we have 1559dnl a monocase filesystem. 1560AC_DEFUN([CF_MAKE_TAGS],[ 1561AC_REQUIRE([CF_MIXEDCASE_FILENAMES]) 1562AC_CHECK_PROG(MAKE_LOWER_TAGS, ctags, yes, no) 1563 1564if test "$cf_cv_mixedcase" = yes ; then 1565 AC_CHECK_PROG(MAKE_UPPER_TAGS, etags, yes, no) 1566else 1567 MAKE_UPPER_TAGS=no 1568fi 1569 1570if test "$MAKE_UPPER_TAGS" = yes ; then 1571 MAKE_UPPER_TAGS= 1572else 1573 MAKE_UPPER_TAGS="#" 1574fi 1575AC_SUBST(MAKE_UPPER_TAGS) 1576 1577if test "$MAKE_LOWER_TAGS" = yes ; then 1578 MAKE_LOWER_TAGS= 1579else 1580 MAKE_LOWER_TAGS="#" 1581fi 1582AC_SUBST(MAKE_LOWER_TAGS) 1583])dnl 1584dnl --------------------------------------------------------------------------- 1585dnl Option to allow user to override automatic configuration of manpage format. 1586dnl There are several special cases. 1587AC_DEFUN([CF_MANPAGE_FORMAT], 1588[ 1589AC_REQUIRE([CF_PATHSEP]) 1590AC_MSG_CHECKING(format of man-pages) 1591 1592AC_ARG_WITH(manpage-format, 1593 [ --with-manpage-format specify manpage-format: gzip/compress/BSDI/normal and 1594 optionally formatted, e.g., gzip,formatted], 1595 [MANPAGE_FORMAT=$withval], 1596 [MANPAGE_FORMAT=unknown]) 1597 1598case ".$MANPAGE_FORMAT" in 1599.gzip|.compress|.BSDI|.normal|.formatted) # (vi 1600 ;; 1601.unknown|.) # (vi 1602 if test -z "$MANPATH" ; then 1603 MANPATH="/usr/man:/usr/share/man" 1604 fi 1605 # look for the 'date' man-page (it's most likely to be installed!) 1606 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATHSEP}" 1607 MANPAGE_FORMAT=unknown 1608 for cf_dir in $MANPATH; do 1609 test -z "$cf_dir" && cf_dir=/usr/man 1610 for cf_name in $cf_dir/*/date.[[01]]* $cf_dir/*/date 1611 do 1612 cf_test=`echo $cf_name | sed -e 's/*//'` 1613 if test "x$cf_test" = "x$cf_name" ; then 1614 case "$cf_name" in 1615 *.gz) MANPAGE_FORMAT=gzip;; 1616 *.Z) MANPAGE_FORMAT=compress;; 1617 *.0) MANPAGE_FORMAT=BSDI,formatted;; 1618 *) MANPAGE_FORMAT=normal;; 1619 esac 1620 break 1621 fi 1622 done 1623 if test "$MANPAGE_FORMAT" != "unknown" ; then 1624 break 1625 fi 1626 done 1627 IFS="$ac_save_ifs" 1628 ;; 1629.*) # (vi 1630 AC_MSG_WARN(Unexpected manpage-format) 1631 ;; 1632esac 1633 1634AC_MSG_RESULT($MANPAGE_FORMAT) 1635])dnl 1636dnl --------------------------------------------------------------------------- 1637dnl The Debian people have their own naming convention for manpages. This 1638dnl option lets us override the name of the file containing renaming, or 1639dnl disable it altogether. 1640AC_DEFUN([CF_MANPAGE_RENAMES], 1641[ 1642AC_MSG_CHECKING(for manpage renaming) 1643 1644AC_ARG_WITH(manpage-renames, 1645 [ --with-manpage-renames specify manpage-renaming], 1646 [MANPAGE_RENAMES=$withval], 1647 [MANPAGE_RENAMES=yes]) 1648 1649case ".$MANPAGE_RENAMES" in #(vi 1650.no) #(vi 1651 ;; 1652.|.yes) 1653 # Debian 'man' program? 1654 if test -f /etc/debian_version ; then 1655 MANPAGE_RENAMES=`cd $srcdir && pwd`/man/man_db.renames 1656 else 1657 MANPAGE_RENAMES=no 1658 fi 1659 ;; 1660esac 1661 1662if test "$MANPAGE_RENAMES" != no ; then 1663 if test -f $srcdir/man/$MANPAGE_RENAMES ; then 1664 MANPAGE_RENAMES=`cd $srcdir/man && pwd`/$MANPAGE_RENAMES 1665 elif test ! -f $MANPAGE_RENAMES ; then 1666 AC_MSG_ERROR(not a filename: $MANPAGE_RENAMES) 1667 fi 1668 1669 test ! -d man && mkdir man 1670 1671 # Construct a sed-script to perform renaming within man-pages 1672 if test -n "$MANPAGE_RENAMES" ; then 1673 test ! -d man && mkdir man 1674 sh $srcdir/man/make_sed.sh $MANPAGE_RENAMES >man/edit_man.sed 1675 fi 1676fi 1677 1678AC_MSG_RESULT($MANPAGE_RENAMES) 1679AC_SUBST(MANPAGE_RENAMES) 1680])dnl 1681dnl --------------------------------------------------------------------------- 1682dnl Some people expect each tool to make all aliases for manpages in the 1683dnl man-directory. This accommodates the older, less-capable implementations 1684dnl of 'man', and is optional. 1685AC_DEFUN([CF_MANPAGE_SYMLINKS], 1686[ 1687AC_MSG_CHECKING(for manpage symlinks) 1688 1689AC_ARG_WITH(manpage-symlinks, 1690 [ --with-manpage-symlinks specify manpage-symlinks], 1691 [MANPAGE_SYMLINKS=$withval], 1692 [MANPAGE_SYMLINKS=yes]) 1693 1694AC_MSG_RESULT($MANPAGE_SYMLINKS) 1695])dnl 1696dnl --------------------------------------------------------------------------- 1697dnl This option causes manpages to be run through tbl(1) to generate tables 1698dnl correctly. 1699AC_DEFUN([CF_MANPAGE_TBL], 1700[ 1701AC_MSG_CHECKING(for manpage tbl) 1702 1703AC_ARG_WITH(manpage-tbl, 1704 [ --with-manpage-tbl specify manpage processing with tbl], 1705 [MANPAGE_TBL=$withval], 1706 [MANPAGE_TBL=no]) 1707 1708AC_MSG_RESULT($MANPAGE_TBL) 1709])dnl 1710dnl --------------------------------------------------------------------------- 1711dnl Try to determine if the man-pages on the system are compressed, and if 1712dnl so, what format is used. Use this information to construct a script that 1713dnl will install man-pages. 1714AC_DEFUN([CF_MAN_PAGES], 1715[ 1716CF_HELP_MESSAGE(Options to Specify How Manpages are Installed:) 1717CF_MANPAGE_FORMAT 1718CF_MANPAGE_RENAMES 1719CF_MANPAGE_SYMLINKS 1720CF_MANPAGE_TBL 1721 1722 if test "$prefix" = "NONE" ; then 1723 cf_prefix="$ac_default_prefix" 1724 else 1725 cf_prefix="$prefix" 1726 fi 1727 1728 case "$MANPAGE_FORMAT" in # (vi 1729 *formatted*) # (vi 1730 cf_subdir='$mandir/cat' 1731 cf_format=yes 1732 ;; 1733 *) 1734 cf_subdir='$mandir/man' 1735 cf_format=no 1736 ;; 1737 esac 1738 1739test ! -d man && mkdir man 1740cat >man/edit_man.sh <<CF_EOF 1741#! /bin/sh 1742# this script is generated by the configure-script 1743prefix="$cf_prefix" 1744datadir="$datadir" 1745NCURSES_OSPEED="$NCURSES_OSPEED" 1746TERMINFO="$TERMINFO" 1747MKDIRS="sh `cd $srcdir && pwd`/mkinstalldirs" 1748INSTALL="$INSTALL" 1749INSTALL_DATA="$INSTALL_DATA" 1750transform="$program_transform_name" 1751 1752TMP=\${TMPDIR-/tmp}/man\$\$ 1753trap "rm -f \$TMP" 0 1 2 5 15 1754 1755verb=\[$]1 1756shift 1757 1758mandir=\[$]1 1759shift 1760 1761srcdir=\[$]1 1762shift 1763 1764for i in \[$]* ; do 1765case \$i in #(vi 1766*.orig|*.rej) ;; #(vi 1767*.[[0-9]]*) 1768 section=\`expr "\$i" : '.*\\.\\([[0-9]]\\)[[xm]]*'\`; 1769 if test \$verb = installing ; then 1770 if test ! -d $cf_subdir\${section} ; then 1771 \$MKDIRS $cf_subdir\$section 1772 fi 1773 fi 1774 aliases= 1775 source=\`basename \$i\` 1776 inalias=\$source 1777 test ! -f \$inalias && inalias="\$srcdir/\$inalias" 1778 if test ! -f \$inalias ; then 1779 echo .. skipped \$source 1780 continue 1781 fi 1782CF_EOF 1783if test "$MANPAGE_SYMLINKS" = yes ; then 1784cat >>man/edit_man.sh <<CF_EOF 1785 aliases=\`sed -f \$srcdir/manlinks.sed \$inalias | sort -u\` 1786CF_EOF 1787fi 1788 1789if test "$MANPAGE_RENAMES" = no ; then 1790cat >>man/edit_man.sh <<CF_EOF 1791 # perform program transformations for section 1 man pages 1792 if test \$section = 1 ; then 1793 target=$cf_subdir\${section}/\`echo \$source|sed "\${transform}"\` 1794 else 1795 target=$cf_subdir\${section}/\$source 1796 fi 1797CF_EOF 1798else 1799cat >>man/edit_man.sh <<CF_EOF 1800 target=\`grep "^\$source" $MANPAGE_RENAMES | $AWK '{print \[$]2}'\` 1801 if test -z "\$target" ; then 1802 echo '? missing rename for '\$source 1803 target="\$source" 1804 fi 1805 target="$cf_subdir\${section}/\${target}" 1806CF_EOF 1807fi 1808 1809 # replace variables in man page 1810 ifelse($1,,,[ 1811 for cf_name in $1 1812 do 1813cat >>man/edit_man.sh <<CF_EOF 1814 prog_$cf_name=\`echo $cf_name|sed "\${transform}"\` 1815CF_EOF 1816 done 1817 ]) 1818cat >>man/edit_man.sh <<CF_EOF 1819 sed -e "s,@DATADIR@,\$datadir," \\ 1820 -e "s,@TERMINFO@,\$TERMINFO," \\ 1821 -e "s,@NCURSES_OSPEED@,\$NCURSES_OSPEED," \\ 1822CF_EOF 1823 ifelse($1,,,[ 1824 for cf_name in $1 1825 do 1826 cf_NAME=`echo "$cf_name" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` 1827cat >>man/edit_man.sh <<CF_EOF 1828 -e "s,@$cf_NAME@,\$prog_$cf_name," \\ 1829CF_EOF 1830 done 1831 ]) 1832if test -f $MANPAGE_RENAMES ; then 1833cat >>man/edit_man.sh <<CF_EOF 1834 < \$i | sed -f edit_man.sed >\$TMP 1835CF_EOF 1836else 1837cat >>man/edit_man.sh <<CF_EOF 1838 < \$i >\$TMP 1839CF_EOF 1840fi 1841if test $MANPAGE_TBL = yes ; then 1842cat >>man/edit_man.sh <<CF_EOF 1843 tbl \$TMP >\$TMP.out 1844 mv \$TMP.out \$TMP 1845CF_EOF 1846fi 1847if test $with_curses_h != yes ; then 1848cat >>man/edit_man.sh <<CF_EOF 1849 sed -e "/\#[ ]*include/s,curses.h,ncurses.h," < \$TMP >\$TMP.out 1850 mv \$TMP.out \$TMP 1851CF_EOF 1852fi 1853if test $cf_format = yes ; then 1854cat >>man/edit_man.sh <<CF_EOF 1855 nroff -man \$TMP >\$TMP.out 1856 mv \$TMP.out \$TMP 1857CF_EOF 1858fi 1859case "$MANPAGE_FORMAT" in #(vi 1860*compress*) #(vi 1861cat >>man/edit_man.sh <<CF_EOF 1862 if test \$verb = installing ; then 1863 if ( compress -f \$TMP ) 1864 then 1865 mv \$TMP.Z \$TMP 1866 fi 1867 fi 1868 target="\$target.Z" 1869CF_EOF 1870 ;; 1871*gzip*) #(vi 1872cat >>man/edit_man.sh <<CF_EOF 1873 if test \$verb = installing ; then 1874 if ( gzip -f \$TMP ) 1875 then 1876 mv \$TMP.gz \$TMP 1877 fi 1878 fi 1879 target="\$target.gz" 1880CF_EOF 1881 ;; 1882*BSDI*) 1883cat >>man/edit_man.sh <<CF_EOF 1884 # BSDI installs only .0 suffixes in the cat directories 1885 target="\`echo \$target|sed -e 's/\.[[1-9]]\+.\?/.0/'\`" 1886CF_EOF 1887 ;; 1888esac 1889cat >>man/edit_man.sh <<CF_EOF 1890 suffix=\`basename \$target | sed -e 's/^[[^.]]*//'\` 1891 if test \$verb = installing ; then 1892 echo \$verb \$target 1893 \$INSTALL_DATA \$TMP \$target 1894 test -n "\$aliases" && ( 1895 cd $cf_subdir\${section} && ( 1896 target=\`basename \$target\` 1897 for cf_alias in \$aliases 1898 do 1899 if test \$section = 1 ; then 1900 cf_alias=\`echo \$cf_alias|sed "\${transform}"\` 1901 fi 1902 1903 if test -f \$cf_alias\${suffix} ; then 1904 if ( cmp -s \$target \$cf_alias\${suffix} ) 1905 then 1906 : 1907 else 1908 echo .. \$verb alias \$cf_alias\${suffix} 1909 rm -f \$cf_alias\${suffix} 1910 $LN_S \$target \$cf_alias\${suffix} 1911 fi 1912 else 1913 echo .. \$verb alias \$cf_alias\${suffix} 1914 rm -f \$cf_alias\${suffix} 1915 $LN_S \$target \$cf_alias\${suffix} 1916 fi 1917 done 1918 ) 1919 ) 1920 elif test \$verb = removing ; then 1921 echo \$verb \$target 1922 rm -f \$target 1923 test -n "\$aliases" && ( 1924 cd $cf_subdir\${section} && ( 1925 for cf_alias in \$aliases 1926 do 1927 if test \$section = 1 ; then 1928 cf_alias=\`echo \$cf_alias|sed "\${transform}"\` 1929 fi 1930 1931 echo .. \$verb alias \$cf_alias\${suffix} 1932 rm -f \$cf_alias\${suffix} 1933 done 1934 ) 1935 ) 1936 else 1937# echo ".hy 0" 1938 cat \$TMP 1939 fi 1940 ;; 1941esac 1942done 1943exit 0 1944CF_EOF 1945chmod 755 man/edit_man.sh 1946 1947])dnl 1948dnl --------------------------------------------------------------------------- 1949dnl Checks for libraries. At least one UNIX system, Apple Macintosh 1950dnl Rhapsody 5.5, does not have -lm. We cannot use the simpler 1951dnl AC_CHECK_LIB(m,sin), because that fails for C++. 1952AC_DEFUN([CF_MATH_LIB], 1953[ 1954AC_CACHE_CHECK(if -lm needed for math functions, 1955 cf_cv_need_libm,[ 1956 AC_TRY_LINK([ 1957 #include <stdio.h> 1958 #include <math.h> 1959 ], 1960 [double x = rand(); printf("result = %g\n", ]ifelse($2,,sin(x),$2)[)], 1961 [cf_cv_need_libm=no], 1962 [cf_cv_need_libm=yes])]) 1963if test "$cf_cv_need_libm" = yes 1964then 1965ifelse($1,,[ 1966 LIBS="$LIBS -lm" 1967],[$1=-lm]) 1968fi 1969]) 1970dnl --------------------------------------------------------------------------- 1971dnl Check if mbstate_t is declared, and if so, which header file. 1972AC_DEFUN([CF_MBSTATE_T], 1973[ 1974# This is needed on Tru64 5.0 to declare mbstate_t 1975AC_CACHE_CHECK(if we must include wchar.h to declare mbstate_t,cf_cv_mbstate_t,[ 1976AC_TRY_COMPILE([ 1977#include <stdlib.h> 1978#ifdef HAVE_LIBUTF8_H 1979#include <libutf8.h> 1980#endif], 1981 [mbstate_t state], 1982 [cf_cv_mbstate_t=no], 1983 [AC_TRY_COMPILE([ 1984#include <stdlib.h> 1985#include <wchar.h> 1986#ifdef HAVE_LIBUTF8_H 1987#include <libutf8.h> 1988#endif], 1989 [mbstate_t value], 1990 [cf_cv_mbstate_t=yes], 1991 [cf_cv_mbstate_t=unknown])])]) 1992 1993if test "$cf_cv_mbstate_t" = yes ; then 1994 AC_DEFINE(NEED_WCHAR_H) 1995fi 1996 1997if test "$cf_cv_mbstate_t" != unknown ; then 1998 AC_DEFINE(HAVE_MBSTATE_T) 1999fi 2000])dnl 2001dnl --------------------------------------------------------------------------- 2002dnl Check if the file-system supports mixed-case filenames. If we're able to 2003dnl create a lowercase name and see it as uppercase, it doesn't support that. 2004AC_DEFUN([CF_MIXEDCASE_FILENAMES], 2005[ 2006AC_CACHE_CHECK(if filesystem supports mixed-case filenames,cf_cv_mixedcase,[ 2007 rm -f conftest CONFTEST 2008 echo test >conftest 2009 if test -f CONFTEST ; then 2010 cf_cv_mixedcase=no 2011 else 2012 cf_cv_mixedcase=yes 2013 fi 2014 rm -f conftest CONFTEST 2015]) 2016test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES) 2017])dnl 2018dnl --------------------------------------------------------------------------- 2019dnl Check for a working mkstemp. This creates two files, checks that they are 2020dnl successfully created and distinct (AmigaOS apparently fails on the last). 2021AC_DEFUN([CF_MKSTEMP],[ 2022AC_CACHE_CHECK(for working mkstemp, cf_cv_func_mkstemp,[ 2023rm -f conftest* 2024AC_TRY_RUN([ 2025#include <sys/types.h> 2026#include <stdlib.h> 2027#include <stdio.h> 2028#include <string.h> 2029#include <sys/stat.h> 2030int main() 2031{ 2032 char *tmpl = "conftestXXXXXX"; 2033 char name[2][80]; 2034 int n; 2035 int result = 0; 2036 int fd; 2037 struct stat sb; 2038 2039 umask(077); 2040 for (n = 0; n < 2; ++n) { 2041 strcpy(name[n], tmpl); 2042 if ((fd = mkstemp(name[n])) >= 0) { 2043 if (!strcmp(name[n], tmpl) 2044 || stat(name[n], &sb) != 0 2045 || (sb.st_mode & S_IFMT) != S_IFREG 2046 || (sb.st_mode & 077) != 0) { 2047 result = 1; 2048 } 2049 close(fd); 2050 } 2051 } 2052 if (result == 0 2053 && !strcmp(name[0], name[1])) 2054 result = 1; 2055 exit(result); 2056} 2057],[cf_cv_func_mkstemp=yes 2058],[cf_cv_func_mkstemp=no 2059],[AC_CHECK_FUNC(mkstemp) 2060]) 2061]) 2062if test "$cf_cv_func_mkstemp" = yes ; then 2063 AC_DEFINE(HAVE_MKSTEMP) 2064fi 2065])dnl 2066dnl --------------------------------------------------------------------------- 2067dnl Compute the object-directory name from the given model name 2068AC_DEFUN([CF_OBJ_SUBDIR], 2069[ 2070 case $1 in 2071 libtool) $2='obj_lo' ;; 2072 normal) $2='objects' ;; 2073 debug) $2='obj_g' ;; 2074 profile) $2='obj_p' ;; 2075 shared) 2076 case $cf_cv_system_name in #(vi 2077 cygwin) #(vi 2078 $2='objects' ;; 2079 *) 2080 $2='obj_s' ;; 2081 esac 2082 esac 2083])dnl 2084dnl --------------------------------------------------------------------------- 2085dnl Provide a value for the $PATH and similar separator 2086AC_DEFUN([CF_PATHSEP], 2087[ 2088 case $cf_cv_system_name in 2089 os2*) PATHSEP=';' ;; 2090 *) PATHSEP=':' ;; 2091 esac 2092ifelse($1,,,[$1=$PATHSEP]) 2093 AC_SUBST(PATHSEP) 2094])dnl 2095dnl --------------------------------------------------------------------------- 2096dnl Check the argument to see that it looks like a pathname. Rewrite it if it 2097dnl begins with one of the prefix/exec_prefix variables, and then again if the 2098dnl result begins with 'NONE'. This is necessary to work around autoconf's 2099dnl delayed evaluation of those symbols. 2100AC_DEFUN([CF_PATH_SYNTAX],[ 2101case ".[$]$1" in #(vi 2102.\[$]\(*\)*|.\'*\'*) #(vi 2103 ;; 2104..|./*|.\\*) #(vi 2105 ;; 2106.[[a-zA-Z]]:[[\\/]]*) #(vi OS/2 EMX 2107 ;; 2108.\[$]{*prefix}*) #(vi 2109 eval $1="[$]$1" 2110 case ".[$]$1" in #(vi 2111 .NONE/*) 2112 $1=`echo [$]$1 | sed -e s@NONE@$ac_default_prefix@` 2113 ;; 2114 esac 2115 ;; #(vi 2116.NONE/*) 2117 $1=`echo [$]$1 | sed -e s@NONE@$ac_default_prefix@` 2118 ;; 2119*) 2120 ifelse($2,,[AC_ERROR([expected a pathname, not \"[$]$1\"])],$2) 2121 ;; 2122esac 2123])dnl 2124dnl --------------------------------------------------------------------------- 2125dnl Compute $PROG_EXT, used for non-Unix ports, such as OS/2 EMX. 2126AC_DEFUN([CF_PROG_EXT], 2127[ 2128AC_REQUIRE([CF_CHECK_CACHE]) 2129PROG_EXT= 2130case $cf_cv_system_name in 2131os2*) 2132 # We make sure -Zexe is not used -- it would interfere with @PROG_EXT@ 2133 CFLAGS="$CFLAGS -Zmt" 2134 CPPFLAGS="$CPPFLAGS -D__ST_MT_ERRNO__" 2135 CXXFLAGS="$CXXFLAGS -Zmt" 2136 LDFLAGS=`echo "$LDFLAGS -Zmt -Zcrtdll" | sed "s/-Zexe//g"` 2137 PROG_EXT=".exe" 2138 ;; 2139cygwin*) 2140 PROG_EXT=".exe" 2141 ;; 2142esac 2143AC_SUBST(PROG_EXT) 2144test -n "$PROG_EXT" && AC_DEFINE_UNQUOTED(PROG_EXT,"$PROG_EXT") 2145])dnl 2146dnl --------------------------------------------------------------------------- 2147dnl Force $INSTALL to be an absolute-path. Otherwise, edit_man.sh and the 2148dnl misc/tabset install won't work properly. Usually this happens only when 2149dnl using the fallback mkinstalldirs script 2150AC_DEFUN([CF_PROG_INSTALL], 2151[AC_PROG_INSTALL 2152case $INSTALL in 2153/*) 2154 ;; 2155*) 2156 CF_DIRNAME(cf_dir,$INSTALL) 2157 test -z "$cf_dir" && cf_dir=. 2158 INSTALL=`cd $cf_dir && pwd`/`echo $INSTALL | sed -e 's:^.*/::'` 2159 ;; 2160esac 2161])dnl 2162dnl --------------------------------------------------------------------------- 2163dnl Attempt to determine if we've got one of the flavors of regular-expression 2164dnl code that we can support. 2165AC_DEFUN([CF_REGEX], 2166[ 2167AC_MSG_CHECKING([for regular-expression headers]) 2168AC_CACHE_VAL(cf_cv_regex,[ 2169AC_TRY_LINK([#include <sys/types.h> 2170#include <regex.h>],[ 2171 regex_t *p; 2172 int x = regcomp(p, "", 0); 2173 int y = regexec(p, "", 0, 0, 0); 2174 regfree(p); 2175 ],[cf_cv_regex="regex.h"],[ 2176 AC_TRY_LINK([#include <regexp.h>],[ 2177 char *p = compile("", "", "", 0); 2178 int x = step("", ""); 2179 ],[cf_cv_regex="regexp.h"],[ 2180 cf_save_LIBS="$LIBS" 2181 LIBS="-lgen $LIBS" 2182 AC_TRY_LINK([#include <regexpr.h>],[ 2183 char *p = compile("", "", ""); 2184 int x = step("", ""); 2185 ],[cf_cv_regex="regexpr.h"],[LIBS="$cf_save_LIBS"])])]) 2186]) 2187AC_MSG_RESULT($cf_cv_regex) 2188case $cf_cv_regex in 2189 regex.h) AC_DEFINE(HAVE_REGEX_H_FUNCS) ;; 2190 regexp.h) AC_DEFINE(HAVE_REGEXP_H_FUNCS) ;; 2191 regexpr.h) AC_DEFINE(HAVE_REGEXPR_H_FUNCS) ;; 2192esac 2193])dnl 2194dnl --------------------------------------------------------------------------- 2195dnl Attempt to determine the appropriate CC/LD options for creating a shared 2196dnl library. 2197dnl 2198dnl Note: $(LOCAL_LDFLAGS) is used to link executables that will run within the 2199dnl build-tree, i.e., by making use of the libraries that are compiled in ../lib 2200dnl We avoid compiling-in a ../lib path for the shared library since that can 2201dnl lead to unexpected results at runtime. 2202dnl $(LOCAL_LDFLAGS2) has the same intention but assumes that the shared libraries 2203dnl are compiled in ../../lib 2204dnl 2205dnl The variable 'cf_cv_do_symlinks' is used to control whether we configure 2206dnl to install symbolic links to the rel/abi versions of shared libraries. 2207dnl 2208dnl The variable 'cf_cv_shlib_version' controls whether we use the rel or abi 2209dnl version when making symbolic links. 2210dnl 2211dnl The variable 'cf_cv_shlib_version_infix' controls whether shared library 2212dnl version numbers are infix (ex: libncurses.<ver>.dylib) or postfix 2213dnl (ex: libncurses.so.<ver>). 2214dnl 2215dnl Some loaders leave 'so_locations' lying around. It's nice to clean up. 2216AC_DEFUN([CF_SHARED_OPTS], 2217[ 2218 AC_REQUIRE([CF_SUBST_NCURSES_VERSION]) 2219 LOCAL_LDFLAGS= 2220 LOCAL_LDFLAGS2= 2221 LD_SHARED_OPTS= 2222 INSTALL_LIB="-m 644" 2223 2224 cf_cv_do_symlinks=no 2225 2226 AC_MSG_CHECKING(if release/abi version should be used for shared libs) 2227 AC_ARG_WITH(shlib-version, 2228 [ --with-shlib-version=X Specify rel or abi version for shared libs], 2229 [test -z "$withval" && withval=auto 2230 case $withval in #(vi 2231 yes) #(vi 2232 cf_cv_shlib_version=auto 2233 ;; 2234 rel|abi|auto|no) #(vi 2235 cf_cv_shlib_version=$withval 2236 ;; 2237 *) 2238 AC_ERROR([option value must be one of: rel, abi, auto or no]) 2239 ;; 2240 esac 2241 ],[cf_cv_shlib_version=auto]) 2242 AC_MSG_RESULT($cf_cv_shlib_version) 2243 2244 cf_cv_rm_so_locs=no 2245 2246 # Some less-capable ports of gcc support only -fpic 2247 CC_SHARED_OPTS= 2248 if test "$GCC" = yes 2249 then 2250 AC_MSG_CHECKING(which $CC option to use) 2251 cf_save_CFLAGS="$CFLAGS" 2252 for CC_SHARED_OPTS in -fPIC -fpic '' 2253 do 2254 CFLAGS="$cf_save_CFLAGS $CC_SHARED_OPTS" 2255 AC_TRY_COMPILE([#include <stdio.h>],[int x = 1],[break],[]) 2256 done 2257 AC_MSG_RESULT($CC_SHARED_OPTS) 2258 CFLAGS="$cf_save_CFLAGS" 2259 fi 2260 2261 cf_cv_shlib_version_infix=no 2262 2263 case $cf_cv_system_name in 2264 beos*) 2265 MK_SHARED_LIB='$(CC) -o $[@] -Xlinker -soname=`basename $[@]` -nostart -e 0' 2266 ;; 2267 cygwin*) 2268 CC_SHARED_OPTS= 2269 MK_SHARED_LIB='$(CC) -shared -Wl,--out-implib=$(IMPORT_LIB) -Wl,--export-all-symbols -o $(SHARED_LIB)' 2270 cf_cv_shlib_version=cygdll 2271 cf_cv_shlib_version_infix=cygdll 2272 ;; 2273 darwin*) 2274 EXTRA_CFLAGS="-no-cpp-precomp" 2275 CC_SHARED_OPTS="-dynamic" 2276 MK_SHARED_LIB='$(CC) -dynamiclib -install_name $(DESTDIR)$(libdir)/`basename $[@]` -compatibility_version $(ABI_VERSION) -current_version $(ABI_VERSION) -o $[@]' 2277 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=abi 2278 cf_cv_shlib_version_infix=yes 2279 ;; 2280 hpux*) 2281 # (tested with gcc 2.7.2 -- I don't have c89) 2282 if test "$GCC" = yes; then 2283 LD_SHARED_OPTS='-Xlinker +b -Xlinker $(libdir)' 2284 else 2285 CC_SHARED_OPTS='+Z' 2286 LD_SHARED_OPTS='-Wl,+b,$(libdir)' 2287 fi 2288 MK_SHARED_LIB='$(LD) +b $(libdir) -b -o $[@]' 2289 # HP-UX shared libraries must be executable, and should be 2290 # readonly to exploit a quirk in the memory manager. 2291 INSTALL_LIB="-m 555" 2292 ;; 2293 irix*) 2294 if test "$cf_cv_ld_rpath" = yes ; then 2295 cf_ld_rpath_opt="-Wl,-rpath," 2296 EXTRA_LDFLAGS="-Wl,-rpath,\$(libdir) $EXTRA_LDFLAGS" 2297 fi 2298 # tested with IRIX 5.2 and 'cc'. 2299 if test "$GCC" != yes; then 2300 CC_SHARED_OPTS='-KPIC' 2301 fi 2302 MK_SHARED_LIB='$(LD) -shared -rdata_shared -soname `basename $[@]` -o $[@]' 2303 cf_cv_rm_so_locs=yes 2304 ;; 2305 linux*|gnu*) 2306 if test "$DFT_LWR_MODEL" = "shared" ; then 2307 LOCAL_LDFLAGS="-Wl,-rpath,`pwd`/lib" 2308 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS" 2309 fi 2310 if test "$cf_cv_ld_rpath" = yes ; then 2311 cf_ld_rpath_opt="-Wl,-rpath," 2312 EXTRA_LDFLAGS="$LOCAL_LDFLAGS $EXTRA_LDFLAGS" 2313 fi 2314 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel 2315 MK_SHARED_LIB='$(CC) -shared -Wl,-soname,`basename $[@] .$(REL_VERSION)`.$(ABI_VERSION),-stats,-lc -o $[@]' 2316 ;; 2317 openbsd2*) 2318 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC" 2319 MK_SHARED_LIB='$(LD) -Bshareable -soname,`basename $[@].$(ABI_VERSION)` -o $[@]' 2320 ;; 2321 openbsd*|freebsd*) 2322 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC" 2323 MK_SHARED_LIB='$(LD) -Bshareable -o $[@]' 2324 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel 2325 ;; 2326 netbsd*) 2327 CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC" 2328 test "$cf_cv_ld_rpath" = yes && cf_ld_rpath_opt="-Wl,-rpath," 2329 if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_ld_rpath" = yes ; then 2330 LOCAL_LDFLAGS="-Wl,-rpath,`pwd`/lib" 2331 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS" 2332 EXTRA_LDFLAGS="-Wl,-rpath,\$(libdir) $EXTRA_LDFLAGS" 2333 MK_SHARED_LIB='$(CC) -shared -Wl,-soname,`basename $[@] .$(REL_VERSION)`.$(ABI_VERSION) -o $[@]' 2334 if test "$cf_cv_shlib_version" = auto; then 2335 if test ! -f /usr/libexec/ld.elf_so; then 2336 cf_cv_shlib_version=rel 2337 fi 2338 fi 2339 else 2340 MK_SHARED_LIB='$(LD) -Bshareable -o $[@]' 2341 fi 2342 ;; 2343 osf*|mls+*) 2344 # tested with OSF/1 V3.2 and 'cc' 2345 # tested with OSF/1 V3.2 and gcc 2.6.3 (but the c++ demo didn't 2346 # link with shared libs). 2347 MK_SHARED_LIB='$(LD) -set_version $(REL_VERSION):$(ABI_VERSION) -expect_unresolved "*" -shared -soname `basename $[@]`' 2348 case $host_os in 2349 osf4*) 2350 MK_SHARED_LIB="${MK_SHARED_LIB} -msym" 2351 ;; 2352 esac 2353 MK_SHARED_LIB="${MK_SHARED_LIB}"' -o $[@]' 2354 if test "$DFT_LWR_MODEL" = "shared" ; then 2355 LOCAL_LDFLAGS="-Wl,-rpath,`pwd`/lib" 2356 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS" 2357 fi 2358 if test "$cf_cv_ld_rpath" = yes ; then 2359 cf_ld_rpath_opt="-rpath" 2360 # EXTRA_LDFLAGS="$LOCAL_LDFLAGS $EXTRA_LDFLAGS" 2361 fi 2362 cf_cv_rm_so_locs=yes 2363 ;; 2364 sco3.2v5*) # (also uw2* and UW7) hops 13-Apr-98 2365 # tested with osr5.0.5 2366 if test "$ac_cv_prog_gcc" != yes; then 2367 CC_SHARED_OPTS='-belf -KPIC' 2368 fi 2369 MK_SHARED_LIB='$(LD) -dy -G -h `basename $[@] .$(REL_VERSION)`.$(ABI_VERSION) -o [$]@' 2370 if test "$cf_cv_ld_rpath" = yes ; then 2371 # only way is to set LD_RUN_PATH but no switch for it 2372 RUN_PATH=$libdir 2373 fi 2374 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel 2375 LINK_PROGS='LD_RUN_PATH=$(libdir)' 2376 LINK_TESTS='Pwd=`pwd`;LD_RUN_PATH=`dirname $${Pwd}`/lib' 2377 ;; 2378 sunos4*) 2379 # tested with SunOS 4.1.1 and gcc 2.7.0 2380 if test "$ac_cv_prog_gcc" != yes; then 2381 CC_SHARED_OPTS='-KPIC' 2382 fi 2383 MK_SHARED_LIB='$(LD) -assert pure-text -o $[@]' 2384 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel 2385 ;; 2386 solaris2*) 2387 # tested with SunOS 5.5.1 (solaris 2.5.1) and gcc 2.7.2 2388 if test "$ac_cv_prog_gcc" != yes; then 2389 CC_SHARED_OPTS='-KPIC' 2390 fi 2391 MK_SHARED_LIB='$(LD) -dy -G -h `basename $[@] .$(REL_VERSION)`.$(ABI_VERSION) -o $[@]' 2392 if test "$DFT_LWR_MODEL" = "shared" ; then 2393 LOCAL_LDFLAGS="-R `pwd`/lib:\$(libdir)" 2394 LOCAL_LDFLAGS2="$LOCAL_LDFLAGS" 2395 fi 2396 if test "$cf_cv_ld_rpath" = yes ; then 2397 cf_ld_rpath_opt="-R" 2398 EXTRA_LDFLAGS="$LOCAL_LDFLAGS $EXTRA_LDFLAGS" 2399 fi 2400 test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel 2401 ;; 2402 sysv5uw7*|unix_sv*) 2403 # tested with UnixWare 7.1.0 (gcc 2.95.2 and cc) 2404 if test "$ac_cv_prog_gcc" != yes; then 2405 CC_SHARED_OPTS='-KPIC' 2406 fi 2407 MK_SHARED_LIB='$(LD) -d y -G -o [$]@' 2408 ;; 2409 *) 2410 CC_SHARED_OPTS='unknown' 2411 MK_SHARED_LIB='echo unknown' 2412 ;; 2413 esac 2414 2415 # This works if the last tokens in $MK_SHARED_LIB are the -o target. 2416 case "$cf_cv_shlib_version" in #(vi 2417 rel|abi) 2418 case "$MK_SHARED_LIB" in #(vi 2419 *'-o $[@]') 2420 test "$cf_cv_do_symlinks" = no && cf_cv_do_symlinks=yes 2421 ;; 2422 *) 2423 AC_MSG_WARN(ignored --with-shlib-version) 2424 ;; 2425 esac 2426 ;; 2427 esac 2428 2429 if test -n "$cf_ld_rpath_opt" ; then 2430 AC_MSG_CHECKING(if we need a space after rpath option) 2431 cf_save_LIBS="$LIBS" 2432 LIBS="$LIBS ${cf_ld_rpath_opt}$libdir" 2433 AC_TRY_LINK(, , cf_rpath_space=no, cf_rpath_space=yes) 2434 LIBS="$cf_save_LIBS" 2435 AC_MSG_RESULT($cf_rpath_space) 2436 test "$cf_rpath_space" = yes && cf_ld_rpath_opt="$cf_ld_rpath_opt " 2437 MK_SHARED_LIB="$MK_SHARED_LIB $cf_ld_rpath_opt\$(libdir)" 2438 fi 2439 2440 AC_SUBST(CC_SHARED_OPTS) 2441 AC_SUBST(LD_SHARED_OPTS) 2442 AC_SUBST(MK_SHARED_LIB) 2443 AC_SUBST(LINK_PROGS) 2444 AC_SUBST(LINK_TESTS) 2445 AC_SUBST(EXTRA_LDFLAGS) 2446 AC_SUBST(LOCAL_LDFLAGS) 2447 AC_SUBST(LOCAL_LDFLAGS2) 2448 AC_SUBST(INSTALL_LIB) 2449])dnl 2450dnl --------------------------------------------------------------------------- 2451dnl Check for definitions & structures needed for window size-changing 2452dnl FIXME: check that this works with "snake" (HP-UX 10.x) 2453AC_DEFUN([CF_SIZECHANGE], 2454[ 2455AC_REQUIRE([CF_STRUCT_TERMIOS]) 2456AC_CACHE_CHECK(declaration of size-change, cf_cv_sizechange,[ 2457 cf_cv_sizechange=unknown 2458 cf_save_CPPFLAGS="$CPPFLAGS" 2459 2460for cf_opts in "" "NEED_PTEM_H" 2461do 2462 2463 CPPFLAGS="$cf_save_CPPFLAGS" 2464 test -n "$cf_opts" && CPPFLAGS="$CPPFLAGS -D$cf_opts" 2465 AC_TRY_COMPILE([#include <sys/types.h> 2466#ifdef HAVE_TERMIOS_H 2467#include <termios.h> 2468#else 2469#ifdef HAVE_TERMIO_H 2470#include <termio.h> 2471#endif 2472#endif 2473#ifdef NEED_PTEM_H 2474/* This is a workaround for SCO: they neglected to define struct winsize in 2475 * termios.h -- it's only in termio.h and ptem.h 2476 */ 2477#include <sys/stream.h> 2478#include <sys/ptem.h> 2479#endif 2480#if !defined(sun) || !defined(HAVE_TERMIOS_H) 2481#include <sys/ioctl.h> 2482#endif 2483],[ 2484#ifdef TIOCGSIZE 2485 struct ttysize win; /* FIXME: what system is this? */ 2486 int y = win.ts_lines; 2487 int x = win.ts_cols; 2488#else 2489#ifdef TIOCGWINSZ 2490 struct winsize win; 2491 int y = win.ws_row; 2492 int x = win.ws_col; 2493#else 2494 no TIOCGSIZE or TIOCGWINSZ 2495#endif /* TIOCGWINSZ */ 2496#endif /* TIOCGSIZE */ 2497 ], 2498 [cf_cv_sizechange=yes], 2499 [cf_cv_sizechange=no]) 2500 2501 CPPFLAGS="$cf_save_CPPFLAGS" 2502 if test "$cf_cv_sizechange" = yes ; then 2503 echo "size-change succeeded ($cf_opts)" >&AC_FD_CC 2504 test -n "$cf_opts" && cf_cv_sizechange="$cf_opts" 2505 break 2506 fi 2507done 2508]) 2509if test "$cf_cv_sizechange" != no ; then 2510 AC_DEFINE(HAVE_SIZECHANGE) 2511 case $cf_cv_sizechange in #(vi 2512 NEED*) 2513 AC_DEFINE_UNQUOTED($cf_cv_sizechange ) 2514 ;; 2515 esac 2516fi 2517])dnl 2518dnl --------------------------------------------------------------------------- 2519dnl For each parameter, test if the source-directory exists, and if it contains 2520dnl a 'modules' file. If so, add to the list $cf_cv_src_modules which we'll 2521dnl use in CF_LIB_RULES. 2522dnl 2523dnl This uses the configured value to make the lists SRC_SUBDIRS and 2524dnl SUB_MAKEFILES which are used in the makefile-generation scheme. 2525AC_DEFUN([CF_SRC_MODULES], 2526[ 2527AC_MSG_CHECKING(for src modules) 2528 2529# dependencies and linker-arguments for test-programs 2530TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${LIB_NAME}${DFT_DEP_SUFFIX} $TEST_DEPS" 2531if test "$DFT_LWR_MODEL" = "libtool"; then 2532 TEST_ARGS="${TEST_DEPS}" 2533else 2534 TEST_ARGS="-l${LIB_NAME}${DFT_ARG_SUFFIX} $TEST_ARGS" 2535fi 2536 2537# dependencies and linker-arguments for utility-programs 2538PROG_ARGS="$TEST_ARGS" 2539 2540cf_cv_src_modules= 2541for cf_dir in $1 2542do 2543 if test -f $srcdir/$cf_dir/modules; then 2544 2545 # We may/may not have tack in the distribution, though the 2546 # makefile is. 2547 if test $cf_dir = tack ; then 2548 if test ! -f $srcdir/${cf_dir}/${cf_dir}.h; then 2549 continue 2550 fi 2551 fi 2552 2553 if test -z "$cf_cv_src_modules"; then 2554 cf_cv_src_modules=$cf_dir 2555 else 2556 cf_cv_src_modules="$cf_cv_src_modules $cf_dir" 2557 fi 2558 2559 # Make the ncurses_cfg.h file record the library interface files as 2560 # well. These are header files that are the same name as their 2561 # directory. Ncurses is the only library that does not follow 2562 # that pattern. 2563 if test $cf_dir = tack ; then 2564 continue 2565 elif test -f $srcdir/${cf_dir}/${cf_dir}.h; then 2566 CF_UPPER(cf_have_include,$cf_dir) 2567 AC_DEFINE_UNQUOTED(HAVE_${cf_have_include}_H) 2568 AC_DEFINE_UNQUOTED(HAVE_LIB${cf_have_include}) 2569 TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${cf_dir}${DFT_DEP_SUFFIX} $TEST_DEPS" 2570 if test "$DFT_LWR_MODEL" = "libtool"; then 2571 TEST_ARGS="${TEST_DEPS}" 2572 else 2573 TEST_ARGS="-l${cf_dir}${DFT_ARG_SUFFIX} $TEST_ARGS" 2574 fi 2575 fi 2576 fi 2577done 2578AC_MSG_RESULT($cf_cv_src_modules) 2579TEST_ARGS="-L${LIB_DIR} $TEST_ARGS" 2580AC_SUBST(TEST_DEPS) 2581AC_SUBST(TEST_ARGS) 2582 2583PROG_ARGS="-L${LIB_DIR} $PROG_ARGS" 2584AC_SUBST(PROG_ARGS) 2585 2586SRC_SUBDIRS="man include" 2587for cf_dir in $cf_cv_src_modules 2588do 2589 SRC_SUBDIRS="$SRC_SUBDIRS $cf_dir" 2590done 2591SRC_SUBDIRS="$SRC_SUBDIRS test" 2592test -z "$MAKE_TERMINFO" && SRC_SUBDIRS="$SRC_SUBDIRS misc" 2593test "$cf_with_cxx_binding" != no && SRC_SUBDIRS="$SRC_SUBDIRS c++" 2594 2595ADA_SUBDIRS= 2596if test "$cf_cv_prog_gnat_correct" = yes && test -f $srcdir/Ada95/Makefile.in; then 2597 SRC_SUBDIRS="$SRC_SUBDIRS Ada95" 2598 ADA_SUBDIRS="gen src samples" 2599fi 2600 2601SUB_MAKEFILES= 2602for cf_dir in $SRC_SUBDIRS 2603do 2604 SUB_MAKEFILES="$SUB_MAKEFILES $cf_dir/Makefile" 2605done 2606 2607if test -n "$ADA_SUBDIRS"; then 2608 for cf_dir in $ADA_SUBDIRS 2609 do 2610 SUB_MAKEFILES="$SUB_MAKEFILES Ada95/$cf_dir/Makefile" 2611 done 2612 AC_SUBST(ADA_SUBDIRS) 2613fi 2614])dnl 2615dnl --------------------------------------------------------------------------- 2616dnl Check for -lstdc++, which is GNU's standard C++ library. 2617AC_DEFUN([CF_STDCPP_LIBRARY], 2618[ 2619if test -n "$GXX" ; then 2620case $cf_cv_system_name in #(vi 2621os2*) #(vi 2622 cf_stdcpp_libname=stdcpp 2623 ;; 2624*) 2625 cf_stdcpp_libname=stdc++ 2626 ;; 2627esac 2628AC_CACHE_CHECK(for library $cf_stdcpp_libname,cf_cv_libstdcpp,[ 2629 cf_save="$LIBS" 2630 LIBS="$LIBS -l$cf_stdcpp_libname" 2631AC_TRY_LINK([ 2632#include <strstream.h>],[ 2633char buf[80]; 2634strstreambuf foo(buf, sizeof(buf)) 2635], 2636 [cf_cv_libstdcpp=yes], 2637 [cf_cv_libstdcpp=no]) 2638 LIBS="$cf_save" 2639]) 2640test "$cf_cv_libstdcpp" = yes && CXXLIBS="$CXXLIBS -l$cf_stdcpp_libname" 2641fi 2642])dnl 2643dnl --------------------------------------------------------------------------- 2644dnl Remove "-g" option from the compiler options 2645AC_DEFUN([CF_STRIP_G_OPT], 2646[$1=`echo ${$1} | sed -e 's/-g //' -e 's/-g$//'`])dnl 2647dnl --------------------------------------------------------------------------- 2648dnl Check if we need _POSIX_SOURCE defined to use struct sigaction. We'll only 2649dnl do this if we've found the sigaction function. 2650dnl 2651dnl If needed, define SVR4_ACTION. 2652AC_DEFUN([CF_STRUCT_SIGACTION],[ 2653if test "$ac_cv_func_sigaction" = yes; then 2654AC_MSG_CHECKING(whether sigaction needs _POSIX_SOURCE) 2655AC_TRY_COMPILE([ 2656#include <sys/types.h> 2657#include <signal.h>], 2658 [struct sigaction act], 2659 [sigact_bad=no], 2660 [ 2661AC_TRY_COMPILE([ 2662#define _POSIX_SOURCE 2663#include <sys/types.h> 2664#include <signal.h>], 2665 [struct sigaction act], 2666 [sigact_bad=yes 2667 AC_DEFINE(SVR4_ACTION)], 2668 [sigact_bad=unknown])]) 2669AC_MSG_RESULT($sigact_bad) 2670fi 2671])dnl 2672dnl --------------------------------------------------------------------------- 2673dnl Some machines require _POSIX_SOURCE to completely define struct termios. 2674dnl If so, define SVR4_TERMIO 2675AC_DEFUN([CF_STRUCT_TERMIOS],[ 2676AC_CHECK_HEADERS( \ 2677termio.h \ 2678termios.h \ 2679unistd.h \ 2680) 2681if test "$ISC" = yes ; then 2682 AC_CHECK_HEADERS( sys/termio.h ) 2683fi 2684if test "$ac_cv_header_termios_h" = yes ; then 2685 case "$CFLAGS $CPPFLAGS" in 2686 *-D_POSIX_SOURCE*) 2687 termios_bad=dunno ;; 2688 *) termios_bad=maybe ;; 2689 esac 2690 if test "$termios_bad" = maybe ; then 2691 AC_MSG_CHECKING(whether termios.h needs _POSIX_SOURCE) 2692 AC_TRY_COMPILE([#include <termios.h>], 2693 [struct termios foo; int x = foo.c_iflag], 2694 termios_bad=no, [ 2695 AC_TRY_COMPILE([ 2696#define _POSIX_SOURCE 2697#include <termios.h>], 2698 [struct termios foo; int x = foo.c_iflag], 2699 termios_bad=unknown, 2700 termios_bad=yes AC_DEFINE(SVR4_TERMIO)) 2701 ]) 2702 AC_MSG_RESULT($termios_bad) 2703 fi 2704fi 2705])dnl 2706dnl --------------------------------------------------------------------------- 2707dnl Shorthand macro for substituting things that the user may override 2708dnl with an environment variable. 2709dnl 2710dnl $1 = long/descriptive name 2711dnl $2 = environment variable 2712dnl $3 = default value 2713AC_DEFUN([CF_SUBST], 2714[AC_CACHE_VAL(cf_cv_subst_$2,[ 2715AC_MSG_CHECKING(for $1 (symbol $2)) 2716test -z "[$]$2" && $2=$3 2717AC_MSG_RESULT([$]$2) 2718AC_SUBST($2) 2719cf_cv_subst_$2=[$]$2]) 2720$2=${cf_cv_subst_$2} 2721])dnl 2722dnl --------------------------------------------------------------------------- 2723dnl Get the version-number for use in shared-library naming, etc. 2724AC_DEFUN([CF_SUBST_NCURSES_VERSION], 2725[ 2726NCURSES_MAJOR="`egrep '^NCURSES_MAJOR[[ ]]*=' $srcdir/dist.mk | sed -e 's/^[[^0-9]]*//'`" 2727NCURSES_MINOR="`egrep '^NCURSES_MINOR[[ ]]*=' $srcdir/dist.mk | sed -e 's/^[[^0-9]]*//'`" 2728NCURSES_PATCH="`egrep '^NCURSES_PATCH[[ ]]*=' $srcdir/dist.mk | sed -e 's/^[[^0-9]]*//'`" 2729cf_cv_abi_version=${NCURSES_MAJOR} 2730cf_cv_rel_version=${NCURSES_MAJOR}.${NCURSES_MINOR} 2731dnl Show the computed version, for logging 2732cf_cv_timestamp=`date` 2733AC_MSG_RESULT(Configuring NCURSES $cf_cv_rel_version ABI $cf_cv_abi_version ($cf_cv_timestamp)) 2734dnl We need these values in the generated headers 2735AC_SUBST(NCURSES_MAJOR) 2736AC_SUBST(NCURSES_MINOR) 2737AC_SUBST(NCURSES_PATCH) 2738dnl We need these values in the generated makefiles 2739AC_SUBST(cf_cv_rel_version) 2740AC_SUBST(cf_cv_abi_version) 2741AC_SUBST(cf_cv_cc_bool_type) 2742AC_SUBST(cf_cv_builtin_bool) 2743AC_SUBST(cf_cv_header_stdbool_h) 2744AC_SUBST(cf_cv_type_of_bool)dnl 2745])dnl 2746dnl --------------------------------------------------------------------------- 2747dnl Check if we can include <sys/time.h> with <sys/select.h>; this breaks on 2748dnl older SCO configurations. 2749AC_DEFUN([CF_SYS_TIME_SELECT], 2750[ 2751AC_MSG_CHECKING(if sys/time.h works with sys/select.h) 2752AC_CACHE_VAL(cf_cv_sys_time_select,[ 2753AC_TRY_COMPILE([ 2754#include <sys/types.h> 2755#ifdef HAVE_SYS_TIME_H 2756#include <sys/time.h> 2757#endif 2758#ifdef HAVE_SYS_SELECT_H 2759#include <sys/select.h> 2760#endif 2761],[],[cf_cv_sys_time_select=yes], 2762 [cf_cv_sys_time_select=no]) 2763 ]) 2764AC_MSG_RESULT($cf_cv_sys_time_select) 2765test "$cf_cv_sys_time_select" = yes && AC_DEFINE(HAVE_SYS_TIME_SELECT) 2766])dnl 2767dnl --------------------------------------------------------------------------- 2768dnl Determine the type we should use for chtype (and attr_t, which is treated 2769dnl as the same thing). We want around 32 bits, so on most machines want a 2770dnl long, but on newer 64-bit machines, probably want an int. If we're using 2771dnl wide characters, we have to have a type compatible with that, as well. 2772AC_DEFUN([CF_TYPEOF_CHTYPE], 2773[ 2774AC_REQUIRE([CF_UNSIGNED_LITERALS]) 2775AC_MSG_CHECKING([for type of chtype]) 2776AC_CACHE_VAL(cf_cv_typeof_chtype,[ 2777 AC_TRY_RUN([ 2778#ifdef USE_WIDEC_SUPPORT 2779#include <stddef.h> /* we want wchar_t */ 2780#define WANT_BITS 39 2781#else 2782#define WANT_BITS 31 2783#endif 2784#include <stdio.h> 2785int main() 2786{ 2787 FILE *fp = fopen("cf_test.out", "w"); 2788 if (fp != 0) { 2789 char *result = "long"; 2790#ifdef USE_WIDEC_SUPPORT 2791 /* 2792 * If wchar_t is smaller than a long, it must be an int or a 2793 * short. We prefer not to use a short anyway. 2794 */ 2795 if (sizeof(unsigned long) > sizeof(wchar_t)) 2796 result = "int"; 2797#endif 2798 if (sizeof(unsigned long) > sizeof(unsigned int)) { 2799 int n; 2800 unsigned int x; 2801 for (n = 0; n < WANT_BITS; n++) { 2802 unsigned int y = (x >> n); 2803 if (y != 1 || x == 0) { 2804 x = 0; 2805 break; 2806 } 2807 } 2808 /* 2809 * If x is nonzero, an int is big enough for the bits 2810 * that we want. 2811 */ 2812 result = (x != 0) ? "int" : "long"; 2813 } 2814 fputs(result, fp); 2815 fclose(fp); 2816 } 2817 exit(0); 2818} 2819 ], 2820 [cf_cv_typeof_chtype=`cat cf_test.out`], 2821 [cf_cv_typeof_chtype=long], 2822 [cf_cv_typeof_chtype=long]) 2823 rm -f cf_test.out 2824 ]) 2825AC_MSG_RESULT($cf_cv_typeof_chtype) 2826 2827AC_SUBST(cf_cv_typeof_chtype) 2828AC_DEFINE_UNQUOTED(TYPEOF_CHTYPE,$cf_cv_typeof_chtype) 2829 2830cf_cv_1UL="1" 2831test "$cf_cv_unsigned_literals" = yes && cf_cv_1UL="${cf_cv_1UL}U" 2832test "$cf_cv_typeof_chtype" = long && cf_cv_1UL="${cf_cv_1UL}L" 2833AC_SUBST(cf_cv_1UL) 2834 2835])dnl 2836dnl --------------------------------------------------------------------------- 2837dnl 2838AC_DEFUN([CF_TYPE_SIGACTION], 2839[ 2840AC_MSG_CHECKING([for type sigaction_t]) 2841AC_CACHE_VAL(cf_cv_type_sigaction,[ 2842 AC_TRY_COMPILE([ 2843#include <signal.h>], 2844 [sigaction_t x], 2845 [cf_cv_type_sigaction=yes], 2846 [cf_cv_type_sigaction=no])]) 2847AC_MSG_RESULT($cf_cv_type_sigaction) 2848test "$cf_cv_type_sigaction" = yes && AC_DEFINE(HAVE_TYPE_SIGACTION) 2849])dnl 2850dnl --------------------------------------------------------------------------- 2851dnl Test if the compiler supports 'U' and 'L' suffixes. Only old compilers 2852dnl won't, but they're still there. 2853AC_DEFUN([CF_UNSIGNED_LITERALS], 2854[ 2855AC_MSG_CHECKING([if unsigned literals are legal]) 2856AC_CACHE_VAL(cf_cv_unsigned_literals,[ 2857 AC_TRY_COMPILE([],[long x = 1L + 1UL + 1U + 1], 2858 [cf_cv_unsigned_literals=yes], 2859 [cf_cv_unsigned_literals=no]) 2860 ]) 2861AC_MSG_RESULT($cf_cv_unsigned_literals) 2862])dnl 2863dnl --------------------------------------------------------------------------- 2864dnl Make an uppercase version of a variable 2865dnl $1=uppercase($2) 2866AC_DEFUN([CF_UPPER], 2867[ 2868$1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` 2869])dnl 2870dnl --------------------------------------------------------------------------- 2871dnl Use AC_VERBOSE w/o the warnings 2872AC_DEFUN([CF_VERBOSE], 2873[test -n "$verbose" && echo " $1" 1>&AC_FD_MSG 2874])dnl 2875dnl --------------------------------------------------------------------------- 2876dnl Wrapper for AC_ARG_WITH to ensure that user supplies a pathname, not just 2877dnl defaulting to yes/no. 2878dnl 2879dnl $1 = option name 2880dnl $2 = help-text 2881dnl $3 = environment variable to set 2882dnl $4 = default value, shown in the help-message, must be a constant 2883dnl $5 = default value, if it's an expression & cannot be in the help-message 2884dnl 2885AC_DEFUN([CF_WITH_PATH], 2886[AC_ARG_WITH($1,[$2 ](default: ifelse($4,,empty,$4)),, 2887ifelse($4,,[withval="${$3}"],[withval="${$3-ifelse($5,,$4,$5)}"]))dnl 2888CF_PATH_SYNTAX(withval) 2889eval $3="$withval" 2890AC_SUBST($3)dnl 2891])dnl 2892dnl --------------------------------------------------------------------------- 2893dnl Process an option specifying a list of colon-separated paths. 2894dnl 2895dnl $1 = option name 2896dnl $2 = help-text 2897dnl $3 = environment variable to set 2898dnl $4 = default value, shown in the help-message, must be a constant 2899dnl $5 = default value, if it's an expression & cannot be in the help-message 2900dnl $6 = flag to tell if we want to define or substitute 2901dnl 2902AC_DEFUN([CF_WITH_PATHLIST],[ 2903AC_REQUIRE([CF_PATHSEP]) 2904AC_ARG_WITH($1,[$2 ](default: ifelse($4,,empty,$4)),, 2905ifelse($4,,[withval=${$3}],[withval=${$3-ifelse($5,,$4,$5)}]))dnl 2906 2907IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${PATHSEP}" 2908cf_dst_path= 2909for cf_src_path in $withval 2910do 2911 CF_PATH_SYNTAX(cf_src_path) 2912 test -n "$cf_dst_path" && cf_dst_path="${cf_dst_path}:" 2913 cf_dst_path="${cf_dst_path}${cf_src_path}" 2914done 2915IFS="$ac_save_ifs" 2916 2917ifelse($6,define,[ 2918# Strip single quotes from the value, e.g., when it was supplied as a literal 2919# for $4 or $5. 2920case $cf_dst_path in #(vi 2921\'*) 2922 cf_dst_path=`echo $cf_dst_path |sed -e s/\'// -e s/\'\$//` 2923 ;; 2924esac 2925cf_dst_path=`echo "$cf_dst_path" | sed -e 's/\\\\/\\\\\\\\/g'` 2926]) 2927 2928eval '$3="$cf_dst_path"' 2929AC_SUBST($3)dnl 2930 2931])dnl 2932