1dnl $Id: aclocal.m4,v 1.28 2018/04/01 19:09:57 tom Exp $ 2dnl autoconf macros for 'add' 3dnl 4dnl --------------------------------------------------------------------------- 5dnl 6dnl Copyright 2002-2015,2018 by Thomas E. Dickey 7dnl 8dnl All Rights Reserved 9dnl 10dnl Permission is hereby granted, free of charge, to any person obtaining a 11dnl copy of this software and associated documentation files (the 12dnl "Software"), to deal in the Software without restriction, including 13dnl without limitation the rights to use, copy, modify, merge, publish, 14dnl distribute, sublicense, and/or sell copies of the Software, and to 15dnl permit persons to whom the Software is furnished to do so, subject to 16dnl the following conditions: 17dnl 18dnl The above copyright notice and this permission notice shall be included 19dnl in all copies or substantial portions of the Software. 20dnl 21dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 22dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 24dnl IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY 25dnl CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 26dnl TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 27dnl SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28dnl 29dnl Except as contained in this notice, the name(s) of the above copyright 30dnl holders shall not be used in advertising or otherwise to promote the 31dnl sale, use or other dealings in this Software without prior written 32dnl authorization. 33dnl 34dnl --------------------------------------------------------------------------- 35dnl see 36dnl https://invisible-island.net/autoconf/ 37dnl --------------------------------------------------------------------------- 38dnl --------------------------------------------------------------------------- 39dnl CF_ACVERSION_CHECK version: 5 updated: 2014/06/04 19:11:49 40dnl ------------------ 41dnl Conditionally generate script according to whether we're using a given autoconf. 42dnl 43dnl $1 = version to compare against 44dnl $2 = code to use if AC_ACVERSION is at least as high as $1. 45dnl $3 = code to use if AC_ACVERSION is older than $1. 46define([CF_ACVERSION_CHECK], 47[ 48ifdef([AC_ACVERSION], ,[ifdef([AC_AUTOCONF_VERSION],[m4_copy([AC_AUTOCONF_VERSION],[AC_ACVERSION])],[m4_copy([m4_PACKAGE_VERSION],[AC_ACVERSION])])])dnl 49ifdef([m4_version_compare], 50[m4_if(m4_version_compare(m4_defn([AC_ACVERSION]), [$1]), -1, [$3], [$2])], 51[CF_ACVERSION_COMPARE( 52AC_PREREQ_CANON(AC_PREREQ_SPLIT([$1])), 53AC_PREREQ_CANON(AC_PREREQ_SPLIT(AC_ACVERSION)), AC_ACVERSION, [$2], [$3])])])dnl 54dnl --------------------------------------------------------------------------- 55dnl CF_ACVERSION_COMPARE version: 3 updated: 2012/10/03 18:39:53 56dnl -------------------- 57dnl CF_ACVERSION_COMPARE(MAJOR1, MINOR1, TERNARY1, 58dnl MAJOR2, MINOR2, TERNARY2, 59dnl PRINTABLE2, not FOUND, FOUND) 60define([CF_ACVERSION_COMPARE], 61[ifelse(builtin([eval], [$2 < $5]), 1, 62[ifelse([$8], , ,[$8])], 63[ifelse([$9], , ,[$9])])])dnl 64dnl --------------------------------------------------------------------------- 65dnl CF_ADD_CFLAGS version: 13 updated: 2017/02/25 18:57:40 66dnl ------------- 67dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS 68dnl The second parameter if given makes this macro verbose. 69dnl 70dnl Put any preprocessor definitions that use quoted strings in $EXTRA_CPPFLAGS, 71dnl to simplify use of $CPPFLAGS in compiler checks, etc., that are easily 72dnl confused by the quotes (which require backslashes to keep them usable). 73AC_DEFUN([CF_ADD_CFLAGS], 74[ 75cf_fix_cppflags=no 76cf_new_cflags= 77cf_new_cppflags= 78cf_new_extra_cppflags= 79 80for cf_add_cflags in $1 81do 82case $cf_fix_cppflags in 83(no) 84 case $cf_add_cflags in 85 (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) 86 case $cf_add_cflags in 87 (-D*) 88 cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[[^=]]*='\''\"[[^"]]*//'` 89 90 test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ 91 && test -z "${cf_tst_cflags}" \ 92 && cf_fix_cppflags=yes 93 94 if test $cf_fix_cppflags = yes ; then 95 CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags) 96 continue 97 elif test "${cf_tst_cflags}" = "\"'" ; then 98 CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags) 99 continue 100 fi 101 ;; 102 esac 103 case "$CPPFLAGS" in 104 (*$cf_add_cflags) 105 ;; 106 (*) 107 case $cf_add_cflags in 108 (-D*) 109 cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` 110 CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,$cf_tst_cppflags) 111 ;; 112 esac 113 CF_APPEND_TEXT(cf_new_cppflags,$cf_add_cflags) 114 ;; 115 esac 116 ;; 117 (*) 118 CF_APPEND_TEXT(cf_new_cflags,$cf_add_cflags) 119 ;; 120 esac 121 ;; 122(yes) 123 CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags) 124 125 cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[[^"]]*"'\''//'` 126 127 test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ 128 && test -z "${cf_tst_cflags}" \ 129 && cf_fix_cppflags=no 130 ;; 131esac 132done 133 134if test -n "$cf_new_cflags" ; then 135 ifelse([$2],,,[CF_VERBOSE(add to \$CFLAGS $cf_new_cflags)]) 136 CF_APPEND_TEXT(CFLAGS,$cf_new_cflags) 137fi 138 139if test -n "$cf_new_cppflags" ; then 140 ifelse([$2],,,[CF_VERBOSE(add to \$CPPFLAGS $cf_new_cppflags)]) 141 CF_APPEND_TEXT(CPPFLAGS,$cf_new_cppflags) 142fi 143 144if test -n "$cf_new_extra_cppflags" ; then 145 ifelse([$2],,,[CF_VERBOSE(add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags)]) 146 CF_APPEND_TEXT(EXTRA_CPPFLAGS,$cf_new_extra_cppflags) 147fi 148 149AC_SUBST(EXTRA_CPPFLAGS) 150 151])dnl 152dnl --------------------------------------------------------------------------- 153dnl CF_ADD_INCDIR version: 14 updated: 2015/05/25 20:53:04 154dnl ------------- 155dnl Add an include-directory to $CPPFLAGS. Don't add /usr/include, since it's 156dnl redundant. We don't normally need to add -I/usr/local/include for gcc, 157dnl but old versions (and some misinstalled ones) need that. To make things 158dnl worse, gcc 3.x may give error messages if -I/usr/local/include is added to 159dnl the include-path). 160AC_DEFUN([CF_ADD_INCDIR], 161[ 162if test -n "$1" ; then 163 for cf_add_incdir in $1 164 do 165 while test $cf_add_incdir != /usr/include 166 do 167 if test -d $cf_add_incdir 168 then 169 cf_have_incdir=no 170 if test -n "$CFLAGS$CPPFLAGS" ; then 171 # a loop is needed to ensure we can add subdirs of existing dirs 172 for cf_test_incdir in $CFLAGS $CPPFLAGS ; do 173 if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then 174 cf_have_incdir=yes; break 175 fi 176 done 177 fi 178 179 if test "$cf_have_incdir" = no ; then 180 if test "$cf_add_incdir" = /usr/local/include ; then 181 if test "$GCC" = yes 182 then 183 cf_save_CPPFLAGS=$CPPFLAGS 184 CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" 185 AC_TRY_COMPILE([#include <stdio.h>], 186 [printf("Hello")], 187 [], 188 [cf_have_incdir=yes]) 189 CPPFLAGS=$cf_save_CPPFLAGS 190 fi 191 fi 192 fi 193 194 if test "$cf_have_incdir" = no ; then 195 CF_VERBOSE(adding $cf_add_incdir to include-path) 196 ifelse([$2],,CPPFLAGS,[$2])="$ifelse([$2],,CPPFLAGS,[$2]) -I$cf_add_incdir" 197 198 cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'` 199 test "$cf_top_incdir" = "$cf_add_incdir" && break 200 cf_add_incdir="$cf_top_incdir" 201 else 202 break 203 fi 204 else 205 break 206 fi 207 done 208 done 209fi 210])dnl 211dnl --------------------------------------------------------------------------- 212dnl CF_ADD_LIB version: 2 updated: 2010/06/02 05:03:05 213dnl ---------- 214dnl Add a library, used to enforce consistency. 215dnl 216dnl $1 = library to add, without the "-l" 217dnl $2 = variable to update (default $LIBS) 218AC_DEFUN([CF_ADD_LIB],[CF_ADD_LIBS(-l$1,ifelse($2,,LIBS,[$2]))])dnl 219dnl --------------------------------------------------------------------------- 220dnl CF_ADD_LIBDIR version: 10 updated: 2015/04/18 08:56:57 221dnl ------------- 222dnl Adds to the library-path 223dnl 224dnl Some machines have trouble with multiple -L options. 225dnl 226dnl $1 is the (list of) directory(s) to add 227dnl $2 is the optional name of the variable to update (default LDFLAGS) 228dnl 229AC_DEFUN([CF_ADD_LIBDIR], 230[ 231if test -n "$1" ; then 232 for cf_add_libdir in $1 233 do 234 if test $cf_add_libdir = /usr/lib ; then 235 : 236 elif test -d $cf_add_libdir 237 then 238 cf_have_libdir=no 239 if test -n "$LDFLAGS$LIBS" ; then 240 # a loop is needed to ensure we can add subdirs of existing dirs 241 for cf_test_libdir in $LDFLAGS $LIBS ; do 242 if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then 243 cf_have_libdir=yes; break 244 fi 245 done 246 fi 247 if test "$cf_have_libdir" = no ; then 248 CF_VERBOSE(adding $cf_add_libdir to library-path) 249 ifelse([$2],,LDFLAGS,[$2])="-L$cf_add_libdir $ifelse([$2],,LDFLAGS,[$2])" 250 fi 251 fi 252 done 253fi 254])dnl 255dnl --------------------------------------------------------------------------- 256dnl CF_ADD_LIBS version: 2 updated: 2014/07/13 14:33:27 257dnl ----------- 258dnl Add one or more libraries, used to enforce consistency. Libraries are 259dnl prepended to an existing list, since their dependencies are assumed to 260dnl already exist in the list. 261dnl 262dnl $1 = libraries to add, with the "-l", etc. 263dnl $2 = variable to update (default $LIBS) 264AC_DEFUN([CF_ADD_LIBS],[ 265cf_add_libs="$1" 266# Filter out duplicates - this happens with badly-designed ".pc" files... 267for cf_add_1lib in [$]ifelse($2,,LIBS,[$2]) 268do 269 for cf_add_2lib in $cf_add_libs 270 do 271 if test "x$cf_add_1lib" = "x$cf_add_2lib" 272 then 273 cf_add_1lib= 274 break 275 fi 276 done 277 test -n "$cf_add_1lib" && cf_add_libs="$cf_add_libs $cf_add_1lib" 278done 279ifelse($2,,LIBS,[$2])="$cf_add_libs" 280])dnl 281dnl --------------------------------------------------------------------------- 282dnl CF_ADD_LIB_AFTER version: 3 updated: 2013/07/09 21:27:22 283dnl ---------------- 284dnl Add a given library after another, e.g., following the one it satisfies a 285dnl dependency for. 286dnl 287dnl $1 = the first library 288dnl $2 = its dependency 289AC_DEFUN([CF_ADD_LIB_AFTER],[ 290CF_VERBOSE(...before $LIBS) 291LIBS=`echo "$LIBS" | sed -e "s/[[ ]][[ ]]*/ /g" -e "s%$1 %$1 $2 %" -e 's% % %g'` 292CF_VERBOSE(...after $LIBS) 293])dnl 294dnl --------------------------------------------------------------------------- 295dnl CF_ADD_SUBDIR_PATH version: 4 updated: 2013/10/08 17:47:05 296dnl ------------------ 297dnl Append to a search-list for a nonstandard header/lib-file 298dnl $1 = the variable to return as result 299dnl $2 = the package name 300dnl $3 = the subdirectory, e.g., bin, include or lib 301dnl $4 = the directory under which we will test for subdirectories 302dnl $5 = a directory that we do not want $4 to match 303AC_DEFUN([CF_ADD_SUBDIR_PATH], 304[ 305test "x$4" != "x$5" && \ 306test -d "$4" && \ 307ifelse([$5],NONE,,[(test -z "$5" || test x$5 = xNONE || test "x$4" != "x$5") &&]) { 308 test -n "$verbose" && echo " ... testing for $3-directories under $4" 309 test -d $4/$3 && $1="[$]$1 $4/$3" 310 test -d $4/$3/$2 && $1="[$]$1 $4/$3/$2" 311 test -d $4/$3/$2/$3 && $1="[$]$1 $4/$3/$2/$3" 312 test -d $4/$2/$3 && $1="[$]$1 $4/$2/$3" 313 test -d $4/$2/$3/$2 && $1="[$]$1 $4/$2/$3/$2" 314} 315])dnl 316dnl --------------------------------------------------------------------------- 317dnl CF_APPEND_TEXT version: 1 updated: 2017/02/25 18:58:55 318dnl -------------- 319dnl use this macro for appending text without introducing an extra blank at 320dnl the beginning 321define([CF_APPEND_TEXT], 322[ 323 test -n "[$]$1" && $1="[$]$1 " 324 $1="[$]{$1}$2" 325])dnl 326dnl --------------------------------------------------------------------------- 327dnl CF_ARG_DISABLE version: 3 updated: 1999/03/30 17:24:31 328dnl -------------- 329dnl Allow user to disable a normally-on option. 330AC_DEFUN([CF_ARG_DISABLE], 331[CF_ARG_OPTION($1,[$2],[$3],[$4],yes)])dnl 332dnl --------------------------------------------------------------------------- 333dnl CF_ARG_ENABLE version: 3 updated: 1999/03/30 17:24:31 334dnl ------------- 335dnl Allow user to enable a normally-off option. 336AC_DEFUN([CF_ARG_ENABLE], 337[CF_ARG_OPTION($1,[$2],[$3],[$4],no)])dnl 338dnl --------------------------------------------------------------------------- 339dnl CF_ARG_OPTION version: 5 updated: 2015/05/10 19:52:14 340dnl ------------- 341dnl Restricted form of AC_ARG_ENABLE that ensures user doesn't give bogus 342dnl values. 343dnl 344dnl Parameters: 345dnl $1 = option name 346dnl $2 = help-string 347dnl $3 = action to perform if option is not default 348dnl $4 = action if perform if option is default 349dnl $5 = default option value (either 'yes' or 'no') 350AC_DEFUN([CF_ARG_OPTION], 351[AC_ARG_ENABLE([$1],[$2],[test "$enableval" != ifelse([$5],no,yes,no) && enableval=ifelse([$5],no,no,yes) 352 if test "$enableval" != "$5" ; then 353ifelse([$3],,[ :]dnl 354,[ $3]) ifelse([$4],,,[ 355 else 356 $4]) 357 fi],[enableval=$5 ifelse([$4],,,[ 358 $4 359])dnl 360])])dnl 361dnl --------------------------------------------------------------------------- 362dnl CF_CC_ENV_FLAGS version: 8 updated: 2017/09/23 08:50:24 363dnl --------------- 364dnl Check for user's environment-breakage by stuffing CFLAGS/CPPFLAGS content 365dnl into CC. This will not help with broken scripts that wrap the compiler 366dnl with options, but eliminates a more common category of user confusion. 367dnl 368dnl In particular, it addresses the problem of being able to run the C 369dnl preprocessor in a consistent manner. 370dnl 371dnl Caveat: this also disallows blanks in the pathname for the compiler, but 372dnl the nuisance of having inconsistent settings for compiler and preprocessor 373dnl outweighs that limitation. 374AC_DEFUN([CF_CC_ENV_FLAGS], 375[ 376# This should have been defined by AC_PROG_CC 377: ${CC:=cc} 378 379AC_MSG_CHECKING(\$CC variable) 380case "$CC" in 381(*[[\ \ ]]-*) 382 AC_MSG_RESULT(broken) 383 AC_MSG_WARN(your environment misuses the CC variable to hold CFLAGS/CPPFLAGS options) 384 # humor him... 385 cf_prog=`echo "$CC" | sed -e 's/ / /g' -e 's/[[ ]]* / /g' -e 's/[[ ]]*[[ ]]-[[^ ]].*//'` 386 cf_flags=`echo "$CC" | ${AWK:-awk} -v prog="$cf_prog" '{ printf("%s", [substr]([$]0,1+length(prog))); }'` 387 CC="$cf_prog" 388 for cf_arg in $cf_flags 389 do 390 case "x$cf_arg" in 391 (x-[[IUDfgOW]]*) 392 CF_ADD_CFLAGS($cf_arg) 393 ;; 394 (*) 395 CC="$CC $cf_arg" 396 ;; 397 esac 398 done 399 CF_VERBOSE(resulting CC: '$CC') 400 CF_VERBOSE(resulting CFLAGS: '$CFLAGS') 401 CF_VERBOSE(resulting CPPFLAGS: '$CPPFLAGS') 402 ;; 403(*) 404 AC_MSG_RESULT(ok) 405 ;; 406esac 407])dnl 408dnl --------------------------------------------------------------------------- 409dnl CF_CHECK_CACHE version: 12 updated: 2012/10/02 20:55:03 410dnl -------------- 411dnl Check if we're accidentally using a cache from a different machine. 412dnl Derive the system name, as a check for reusing the autoconf cache. 413dnl 414dnl If we've packaged config.guess and config.sub, run that (since it does a 415dnl better job than uname). Normally we'll use AC_CANONICAL_HOST, but allow 416dnl an extra parameter that we may override, e.g., for AC_CANONICAL_SYSTEM 417dnl which is useful in cross-compiles. 418dnl 419dnl Note: we would use $ac_config_sub, but that is one of the places where 420dnl autoconf 2.5x broke compatibility with autoconf 2.13 421AC_DEFUN([CF_CHECK_CACHE], 422[ 423if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then 424 ifelse([$1],,[AC_CANONICAL_HOST],[$1]) 425 system_name="$host_os" 426else 427 system_name="`(uname -s -r) 2>/dev/null`" 428 if test -z "$system_name" ; then 429 system_name="`(hostname) 2>/dev/null`" 430 fi 431fi 432test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name",[Define to the system name.]) 433AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"]) 434 435test -z "$system_name" && system_name="$cf_cv_system_name" 436test -n "$cf_cv_system_name" && AC_MSG_RESULT(Configuring for $cf_cv_system_name) 437 438if test ".$system_name" != ".$cf_cv_system_name" ; then 439 AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)) 440 AC_MSG_ERROR("Please remove config.cache and try again.") 441fi 442])dnl 443dnl --------------------------------------------------------------------------- 444dnl CF_CHECK_CFLAGS version: 3 updated: 2014/07/22 05:32:57 445dnl --------------- 446dnl Conditionally add to $CFLAGS and $CPPFLAGS values which are derived from 447dnl a build-configuration such as imake. These have the pitfall that they 448dnl often contain compiler-specific options which we cannot use, mixed with 449dnl preprocessor options that we usually can. 450AC_DEFUN([CF_CHECK_CFLAGS], 451[ 452CF_VERBOSE(checking additions to CFLAGS) 453cf_check_cflags="$CFLAGS" 454cf_check_cppflags="$CPPFLAGS" 455CF_ADD_CFLAGS($1,yes) 456if test "x$cf_check_cflags" != "x$CFLAGS" ; then 457AC_TRY_LINK([#include <stdio.h>],[printf("Hello world");],, 458 [CF_VERBOSE(test-compile failed. Undoing change to \$CFLAGS) 459 if test "x$cf_check_cppflags" != "x$CPPFLAGS" ; then 460 CF_VERBOSE(but keeping change to \$CPPFLAGS) 461 fi 462 CFLAGS="$cf_check_flags"]) 463fi 464])dnl 465dnl --------------------------------------------------------------------------- 466dnl CF_CLANG_COMPILER version: 2 updated: 2013/11/19 19:23:35 467dnl ----------------- 468dnl Check if the given compiler is really clang. clang's C driver defines 469dnl __GNUC__ (fooling the configure script into setting $GCC to yes) but does 470dnl not ignore some gcc options. 471dnl 472dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to 473dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from 474dnl the wrappers for gcc and g++ warnings. 475dnl 476dnl $1 = GCC (default) or GXX 477dnl $2 = CLANG_COMPILER (default) 478dnl $3 = CFLAGS (default) or CXXFLAGS 479AC_DEFUN([CF_CLANG_COMPILER],[ 480ifelse([$2],,CLANG_COMPILER,[$2])=no 481 482if test "$ifelse([$1],,[$1],GCC)" = yes ; then 483 AC_MSG_CHECKING(if this is really Clang ifelse([$1],GXX,C++,C) compiler) 484 cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])" 485 ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -Qunused-arguments" 486 AC_TRY_COMPILE([],[ 487#ifdef __clang__ 488#else 489make an error 490#endif 491],[ifelse([$2],,CLANG_COMPILER,[$2])=yes 492cf_save_CFLAGS="$cf_save_CFLAGS -Qunused-arguments" 493],[]) 494 ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS" 495 AC_MSG_RESULT($ifelse([$2],,CLANG_COMPILER,[$2])) 496fi 497]) 498dnl --------------------------------------------------------------------------- 499dnl CF_CURSES_CONFIG version: 2 updated: 2006/10/29 11:06:27 500dnl ---------------- 501dnl Tie together the configure-script macros for curses. It may be ncurses, 502dnl but unless asked, we do not make a special search for ncurses. However, 503dnl still check for the ncurses version number, for use in other macros. 504AC_DEFUN([CF_CURSES_CONFIG], 505[ 506CF_CURSES_CPPFLAGS 507CF_NCURSES_VERSION 508CF_CURSES_LIBS 509])dnl 510dnl --------------------------------------------------------------------------- 511dnl CF_CURSES_CPPFLAGS version: 12 updated: 2015/04/15 19:08:48 512dnl ------------------ 513dnl Look for the curses headers. 514AC_DEFUN([CF_CURSES_CPPFLAGS],[ 515 516AC_CACHE_CHECK(for extra include directories,cf_cv_curses_incdir,[ 517cf_cv_curses_incdir=no 518case $host_os in 519(hpux10.*) 520 if test "x$cf_cv_screen" = "xcurses_colr" 521 then 522 test -d /usr/include/curses_colr && \ 523 cf_cv_curses_incdir="-I/usr/include/curses_colr" 524 fi 525 ;; 526(sunos3*|sunos4*) 527 if test "x$cf_cv_screen" = "xcurses_5lib" 528 then 529 test -d /usr/5lib && \ 530 test -d /usr/5include && \ 531 cf_cv_curses_incdir="-I/usr/5include" 532 fi 533 ;; 534esac 535]) 536test "$cf_cv_curses_incdir" != no && CPPFLAGS="$CPPFLAGS $cf_cv_curses_incdir" 537 538CF_CURSES_HEADER 539CF_TERM_HEADER 540])dnl 541dnl --------------------------------------------------------------------------- 542dnl CF_CURSES_FUNCS version: 19 updated: 2018/01/03 04:47:33 543dnl --------------- 544dnl Curses-functions are a little complicated, since a lot of them are macros. 545AC_DEFUN([CF_CURSES_FUNCS], 546[ 547AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl 548AC_REQUIRE([CF_XOPEN_CURSES]) 549AC_REQUIRE([CF_CURSES_TERM_H]) 550AC_REQUIRE([CF_CURSES_UNCTRL_H]) 551for cf_func in $1 552do 553 CF_UPPER(cf_tr_func,$cf_func) 554 AC_MSG_CHECKING(for ${cf_func}) 555 CF_MSG_LOG(${cf_func}) 556 AC_CACHE_VAL(cf_cv_func_$cf_func,[ 557 eval cf_result='$ac_cv_func_'$cf_func 558 if test ".$cf_result" != ".no"; then 559 AC_TRY_LINK(CF__CURSES_HEAD, 560 [ 561#ifndef ${cf_func} 562long foo = (long)(&${cf_func}); 563fprintf(stderr, "testing linkage of $cf_func:%p\n", (void *)foo); 564if (foo + 1234L > 5678L) 565 ${cf_cv_main_return:-return}(foo != 0); 566#endif 567 ], 568 [cf_result=yes], 569 [cf_result=no]) 570 fi 571 eval 'cf_cv_func_'$cf_func'=$cf_result' 572 ]) 573 # use the computed/retrieved cache-value: 574 eval 'cf_result=$cf_cv_func_'$cf_func 575 AC_MSG_RESULT($cf_result) 576 if test $cf_result != no; then 577 AC_DEFINE_UNQUOTED(HAVE_${cf_tr_func}) 578 fi 579done 580])dnl 581dnl --------------------------------------------------------------------------- 582dnl CF_CURSES_HEADER version: 5 updated: 2015/04/23 20:35:30 583dnl ---------------- 584dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common 585dnl variations of ncurses' installs. 586dnl 587dnl $1 = ncurses when looking for ncurses, or is empty 588AC_DEFUN([CF_CURSES_HEADER],[ 589AC_CACHE_CHECK(if we have identified curses headers,cf_cv_ncurses_header,[ 590cf_cv_ncurses_header=none 591for cf_header in \ 592 ncurses.h ifelse($1,,,[$1/ncurses.h]) \ 593 curses.h ifelse($1,,,[$1/curses.h]) ifelse($1,,[ncurses/ncurses.h ncurses/curses.h]) 594do 595AC_TRY_COMPILE([#include <${cf_header}>], 596 [initscr(); tgoto("?", 0,0)], 597 [cf_cv_ncurses_header=$cf_header; break],[]) 598done 599]) 600 601if test "$cf_cv_ncurses_header" = none ; then 602 AC_MSG_ERROR(No curses header-files found) 603fi 604 605# cheat, to get the right #define's for HAVE_NCURSES_H, etc. 606AC_CHECK_HEADERS($cf_cv_ncurses_header) 607])dnl 608dnl --------------------------------------------------------------------------- 609dnl CF_CURSES_LIBS version: 41 updated: 2017/12/31 19:23:43 610dnl -------------- 611dnl Look for the curses libraries. Older curses implementations may require 612dnl termcap/termlib to be linked as well. Call CF_CURSES_CPPFLAGS first. 613AC_DEFUN([CF_CURSES_LIBS],[ 614 615AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl 616AC_MSG_CHECKING(if we have identified curses libraries) 617AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>], 618 [initscr(); tgoto("?", 0,0)], 619 cf_result=yes, 620 cf_result=no) 621AC_MSG_RESULT($cf_result) 622 623if test "$cf_result" = no ; then 624case $host_os in 625(freebsd*) 626 AC_CHECK_LIB(mytinfo,tgoto,[CF_ADD_LIBS(-lmytinfo)]) 627 ;; 628(hpux10.*) 629 # Looking at HPUX 10.20, the Hcurses library is the oldest (1997), cur_colr 630 # next (1998), and xcurses "newer" (2000). There is no header file for 631 # Hcurses; the subdirectory curses_colr has the headers (curses.h and 632 # term.h) for cur_colr 633 if test "x$cf_cv_screen" = "xcurses_colr" 634 then 635 AC_CHECK_LIB(cur_colr,initscr,[ 636 CF_ADD_LIBS(-lcur_colr) 637 ac_cv_func_initscr=yes 638 ],[ 639 AC_CHECK_LIB(Hcurses,initscr,[ 640 # HP's header uses __HP_CURSES, but user claims _HP_CURSES. 641 CF_ADD_LIBS(-lHcurses) 642 CPPFLAGS="$CPPFLAGS -D__HP_CURSES -D_HP_CURSES" 643 ac_cv_func_initscr=yes 644 ])]) 645 fi 646 ;; 647(linux*) 648 case `arch 2>/dev/null` in 649 (x86_64) 650 if test -d /lib64 651 then 652 CF_ADD_LIBDIR(/lib64) 653 else 654 CF_ADD_LIBDIR(/lib) 655 fi 656 ;; 657 (*) 658 CF_ADD_LIBDIR(/lib) 659 ;; 660 esac 661 ;; 662(sunos3*|sunos4*) 663 if test "x$cf_cv_screen" = "xcurses_5lib" 664 then 665 if test -d /usr/5lib ; then 666 CF_ADD_LIBDIR(/usr/5lib) 667 CF_ADD_LIBS(-lcurses -ltermcap) 668 fi 669 fi 670 ac_cv_func_initscr=yes 671 ;; 672esac 673 674if test ".$ac_cv_func_initscr" != .yes ; then 675 cf_save_LIBS="$LIBS" 676 677 if test ".${cf_cv_ncurses_version:-no}" != .no 678 then 679 cf_check_list="ncurses curses cursesX" 680 else 681 cf_check_list="cursesX curses ncurses" 682 fi 683 684 # Check for library containing tgoto. Do this before curses library 685 # because it may be needed to link the test-case for initscr. 686 if test "x$cf_term_lib" = x 687 then 688 AC_CHECK_FUNC(tgoto,[cf_term_lib=predefined],[ 689 for cf_term_lib in $cf_check_list otermcap termcap tinfo termlib unknown 690 do 691 AC_CHECK_LIB($cf_term_lib,tgoto,[ 692 : ${cf_nculib_root:=$cf_term_lib} 693 break 694 ]) 695 done 696 ]) 697 fi 698 699 # Check for library containing initscr 700 test "$cf_term_lib" != predefined && test "$cf_term_lib" != unknown && LIBS="-l$cf_term_lib $cf_save_LIBS" 701 if test "x$cf_curs_lib" = x 702 then 703 for cf_curs_lib in $cf_check_list xcurses jcurses pdcurses unknown 704 do 705 LIBS="-l$cf_curs_lib $cf_save_LIBS" 706 if test "$cf_term_lib" = unknown || test "$cf_term_lib" = "$cf_curs_lib" ; then 707 AC_MSG_CHECKING(if we can link with $cf_curs_lib library) 708 AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>], 709 [initscr()], 710 [cf_result=yes], 711 [cf_result=no]) 712 AC_MSG_RESULT($cf_result) 713 test $cf_result = yes && break 714 elif test "$cf_curs_lib" = "$cf_term_lib" ; then 715 cf_result=no 716 elif test "$cf_term_lib" != predefined ; then 717 AC_MSG_CHECKING(if we need both $cf_curs_lib and $cf_term_lib libraries) 718 AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>], 719 [initscr(); tgoto((char *)0, 0, 0);], 720 [cf_result=no], 721 [ 722 LIBS="-l$cf_curs_lib -l$cf_term_lib $cf_save_LIBS" 723 AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>], 724 [initscr()], 725 [cf_result=yes], 726 [cf_result=error]) 727 ]) 728 AC_MSG_RESULT($cf_result) 729 test $cf_result != error && break 730 fi 731 done 732 fi 733 test $cf_curs_lib = unknown && AC_MSG_ERROR(no curses library found) 734fi 735fi 736 737])dnl 738dnl --------------------------------------------------------------------------- 739dnl CF_CURSES_TERM_H version: 11 updated: 2015/04/15 19:08:48 740dnl ---------------- 741dnl SVr4 curses should have term.h as well (where it puts the definitions of 742dnl the low-level interface). This may not be true in old/broken implementations, 743dnl as well as in misconfigured systems (e.g., gcc configured for Solaris 2.4 744dnl running with Solaris 2.5.1). 745AC_DEFUN([CF_CURSES_TERM_H], 746[ 747AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl 748 749AC_CACHE_CHECK(for term.h, cf_cv_term_header,[ 750 751# If we found <ncurses/curses.h>, look for <ncurses/term.h>, but always look 752# for <term.h> if we do not find the variant. 753 754cf_header_list="term.h ncurses/term.h ncursesw/term.h" 755 756case ${cf_cv_ncurses_header:-curses.h} in 757(*/*) 758 cf_header_item=`echo ${cf_cv_ncurses_header:-curses.h} | sed -e 's%\..*%%' -e 's%/.*%/%'`term.h 759 cf_header_list="$cf_header_item $cf_header_list" 760 ;; 761esac 762 763for cf_header in $cf_header_list 764do 765 AC_TRY_COMPILE([ 766#include <${cf_cv_ncurses_header:-curses.h}> 767#include <${cf_header}>], 768 [WINDOW *x], 769 [cf_cv_term_header=$cf_header 770 break], 771 [cf_cv_term_header=no]) 772done 773 774case $cf_cv_term_header in 775(no) 776 # If curses is ncurses, some packagers still mess it up by trying to make 777 # us use GNU termcap. This handles the most common case. 778 for cf_header in ncurses/term.h ncursesw/term.h 779 do 780 AC_TRY_COMPILE([ 781#include <${cf_cv_ncurses_header:-curses.h}> 782#ifdef NCURSES_VERSION 783#include <${cf_header}> 784#else 785make an error 786#endif], 787 [WINDOW *x], 788 [cf_cv_term_header=$cf_header 789 break], 790 [cf_cv_term_header=no]) 791 done 792 ;; 793esac 794]) 795 796case $cf_cv_term_header in 797(term.h) 798 AC_DEFINE(HAVE_TERM_H,1,[Define to 1 if we have term.h]) 799 ;; 800(ncurses/term.h) 801 AC_DEFINE(HAVE_NCURSES_TERM_H,1,[Define to 1 if we have ncurses/term.h]) 802 ;; 803(ncursesw/term.h) 804 AC_DEFINE(HAVE_NCURSESW_TERM_H,1,[Define to 1 if we have ncursesw/term.h]) 805 ;; 806esac 807])dnl 808dnl --------------------------------------------------------------------------- 809dnl CF_CURSES_UNCTRL_H version: 4 updated: 2015/04/15 19:08:48 810dnl ------------------ 811dnl Any X/Open curses implementation must have unctrl.h, but ncurses packages 812dnl may put it in a subdirectory (along with ncurses' other headers, of 813dnl course). Packages which put the headers in inconsistent locations are 814dnl broken). 815AC_DEFUN([CF_CURSES_UNCTRL_H], 816[ 817AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl 818 819AC_CACHE_CHECK(for unctrl.h, cf_cv_unctrl_header,[ 820 821# If we found <ncurses/curses.h>, look for <ncurses/unctrl.h>, but always look 822# for <unctrl.h> if we do not find the variant. 823 824cf_header_list="unctrl.h ncurses/unctrl.h ncursesw/unctrl.h" 825 826case ${cf_cv_ncurses_header:-curses.h} in 827(*/*) 828 cf_header_item=`echo ${cf_cv_ncurses_header:-curses.h} | sed -e 's%\..*%%' -e 's%/.*%/%'`unctrl.h 829 cf_header_list="$cf_header_item $cf_header_list" 830 ;; 831esac 832 833for cf_header in $cf_header_list 834do 835 AC_TRY_COMPILE([ 836#include <${cf_cv_ncurses_header:-curses.h}> 837#include <${cf_header}>], 838 [WINDOW *x], 839 [cf_cv_unctrl_header=$cf_header 840 break], 841 [cf_cv_unctrl_header=no]) 842done 843]) 844 845case $cf_cv_unctrl_header in 846(no) 847 AC_MSG_WARN(unctrl.h header not found) 848 ;; 849esac 850 851case $cf_cv_unctrl_header in 852(unctrl.h) 853 AC_DEFINE(HAVE_UNCTRL_H,1,[Define to 1 if we have unctrl.h]) 854 ;; 855(ncurses/unctrl.h) 856 AC_DEFINE(HAVE_NCURSES_UNCTRL_H,1,[Define to 1 if we have ncurses/unctrl.h]) 857 ;; 858(ncursesw/unctrl.h) 859 AC_DEFINE(HAVE_NCURSESW_UNCTRL_H,1,[Define to 1 if we have ncursesw/unctrl.h]) 860 ;; 861esac 862])dnl 863dnl --------------------------------------------------------------------------- 864dnl CF_DIRNAME version: 4 updated: 2002/12/21 19:25:52 865dnl ---------- 866dnl "dirname" is not portable, so we fake it with a shell script. 867AC_DEFUN([CF_DIRNAME],[$1=`echo $2 | sed -e 's%/[[^/]]*$%%'`])dnl 868dnl --------------------------------------------------------------------------- 869dnl CF_DISABLE_ECHO version: 13 updated: 2015/04/18 08:56:57 870dnl --------------- 871dnl You can always use "make -n" to see the actual options, but it's hard to 872dnl pick out/analyze warning messages when the compile-line is long. 873dnl 874dnl Sets: 875dnl ECHO_LT - symbol to control if libtool is verbose 876dnl ECHO_LD - symbol to prefix "cc -o" lines 877dnl RULE_CC - symbol to put before implicit "cc -c" lines (e.g., .c.o) 878dnl SHOW_CC - symbol to put before explicit "cc -c" lines 879dnl ECHO_CC - symbol to put before any "cc" line 880dnl 881AC_DEFUN([CF_DISABLE_ECHO],[ 882AC_MSG_CHECKING(if you want to see long compiling messages) 883CF_ARG_DISABLE(echo, 884 [ --disable-echo do not display "compiling" commands], 885 [ 886 ECHO_LT='--silent' 887 ECHO_LD='@echo linking [$]@;' 888 RULE_CC='@echo compiling [$]<' 889 SHOW_CC='@echo compiling [$]@' 890 ECHO_CC='@' 891],[ 892 ECHO_LT='' 893 ECHO_LD='' 894 RULE_CC='' 895 SHOW_CC='' 896 ECHO_CC='' 897]) 898AC_MSG_RESULT($enableval) 899AC_SUBST(ECHO_LT) 900AC_SUBST(ECHO_LD) 901AC_SUBST(RULE_CC) 902AC_SUBST(SHOW_CC) 903AC_SUBST(ECHO_CC) 904])dnl 905dnl --------------------------------------------------------------------------- 906dnl CF_DISABLE_LEAKS version: 7 updated: 2012/10/02 20:55:03 907dnl ---------------- 908dnl Combine no-leak checks with the libraries or tools that are used for the 909dnl checks. 910AC_DEFUN([CF_DISABLE_LEAKS],[ 911 912AC_REQUIRE([CF_WITH_DMALLOC]) 913AC_REQUIRE([CF_WITH_DBMALLOC]) 914AC_REQUIRE([CF_WITH_VALGRIND]) 915 916AC_MSG_CHECKING(if you want to perform memory-leak testing) 917AC_ARG_ENABLE(leaks, 918 [ --disable-leaks test: free permanent memory, analyze leaks], 919 [if test "x$enableval" = xno; then with_no_leaks=yes; else with_no_leaks=no; fi], 920 : ${with_no_leaks:=no}) 921AC_MSG_RESULT($with_no_leaks) 922 923if test "$with_no_leaks" = yes ; then 924 AC_DEFINE(NO_LEAKS,1,[Define to 1 if you want to perform memory-leak testing.]) 925 AC_DEFINE(YY_NO_LEAKS,1,[Define to 1 if you want to perform memory-leak testing.]) 926fi 927])dnl 928dnl --------------------------------------------------------------------------- 929dnl CF_ENABLE_WARNINGS version: 5 updated: 2017/09/29 20:01:16 930dnl ------------------ 931dnl Configure-option to enable gcc warnings 932AC_DEFUN([CF_ENABLE_WARNINGS],[ 933if ( test "$GCC" = yes || test "$GXX" = yes ) 934then 935AC_MSG_CHECKING(if you want to turn on gcc warnings) 936CF_ARG_ENABLE(warnings, 937 [ --enable-warnings test: turn on gcc compiler warnings], 938 [with_warnings=yes], 939 [with_warnings=no]) 940AC_MSG_RESULT($with_warnings) 941if test "$with_warnings" = "yes" 942then 943 CF_GCC_ATTRIBUTES 944 CF_GCC_WARNINGS($1) 945fi 946fi 947])dnl 948dnl --------------------------------------------------------------------------- 949dnl CF_FIND_LIBRARY version: 9 updated: 2008/03/23 14:48:54 950dnl --------------- 951dnl Look for a non-standard library, given parameters for AC_TRY_LINK. We 952dnl prefer a standard location, and use -L options only if we do not find the 953dnl library in the standard library location(s). 954dnl $1 = library name 955dnl $2 = library class, usually the same as library name 956dnl $3 = includes 957dnl $4 = code fragment to compile/link 958dnl $5 = corresponding function-name 959dnl $6 = flag, nonnull if failure should not cause an error-exit 960dnl 961dnl Sets the variable "$cf_libdir" as a side-effect, so we can see if we had 962dnl to use a -L option. 963AC_DEFUN([CF_FIND_LIBRARY], 964[ 965 eval 'cf_cv_have_lib_'$1'=no' 966 cf_libdir="" 967 AC_CHECK_FUNC($5, 968 eval 'cf_cv_have_lib_'$1'=yes',[ 969 cf_save_LIBS="$LIBS" 970 AC_MSG_CHECKING(for $5 in -l$1) 971 LIBS="-l$1 $LIBS" 972 AC_TRY_LINK([$3],[$4], 973 [AC_MSG_RESULT(yes) 974 eval 'cf_cv_have_lib_'$1'=yes' 975 ], 976 [AC_MSG_RESULT(no) 977 CF_LIBRARY_PATH(cf_search,$2) 978 for cf_libdir in $cf_search 979 do 980 AC_MSG_CHECKING(for -l$1 in $cf_libdir) 981 LIBS="-L$cf_libdir -l$1 $cf_save_LIBS" 982 AC_TRY_LINK([$3],[$4], 983 [AC_MSG_RESULT(yes) 984 eval 'cf_cv_have_lib_'$1'=yes' 985 break], 986 [AC_MSG_RESULT(no) 987 LIBS="$cf_save_LIBS"]) 988 done 989 ]) 990 ]) 991eval 'cf_found_library=[$]cf_cv_have_lib_'$1 992ifelse($6,,[ 993if test $cf_found_library = no ; then 994 AC_MSG_ERROR(Cannot link $1 library) 995fi 996]) 997])dnl 998dnl --------------------------------------------------------------------------- 999dnl CF_FIND_LINKAGE version: 20 updated: 2015/04/18 08:56:57 1000dnl --------------- 1001dnl Find a library (specifically the linkage used in the code fragment), 1002dnl searching for it if it is not already in the library path. 1003dnl See also CF_ADD_SEARCHPATH. 1004dnl 1005dnl Parameters (4-on are optional): 1006dnl $1 = headers for library entrypoint 1007dnl $2 = code fragment for library entrypoint 1008dnl $3 = the library name without the "-l" option or ".so" suffix. 1009dnl $4 = action to perform if successful (default: update CPPFLAGS, etc) 1010dnl $5 = action to perform if not successful 1011dnl $6 = module name, if not the same as the library name 1012dnl $7 = extra libraries 1013dnl 1014dnl Sets these variables: 1015dnl $cf_cv_find_linkage_$3 - yes/no according to whether linkage is found 1016dnl $cf_cv_header_path_$3 - include-directory if needed 1017dnl $cf_cv_library_path_$3 - library-directory if needed 1018dnl $cf_cv_library_file_$3 - library-file if needed, e.g., -l$3 1019AC_DEFUN([CF_FIND_LINKAGE],[ 1020 1021# If the linkage is not already in the $CPPFLAGS/$LDFLAGS configuration, these 1022# will be set on completion of the AC_TRY_LINK below. 1023cf_cv_header_path_$3= 1024cf_cv_library_path_$3= 1025 1026CF_MSG_LOG([Starting [FIND_LINKAGE]($3,$6)]) 1027 1028cf_save_LIBS="$LIBS" 1029 1030AC_TRY_LINK([$1],[$2],[ 1031 cf_cv_find_linkage_$3=yes 1032 cf_cv_header_path_$3=/usr/include 1033 cf_cv_library_path_$3=/usr/lib 1034],[ 1035 1036LIBS="-l$3 $7 $cf_save_LIBS" 1037 1038AC_TRY_LINK([$1],[$2],[ 1039 cf_cv_find_linkage_$3=yes 1040 cf_cv_header_path_$3=/usr/include 1041 cf_cv_library_path_$3=/usr/lib 1042 cf_cv_library_file_$3="-l$3" 1043],[ 1044 cf_cv_find_linkage_$3=no 1045 LIBS="$cf_save_LIBS" 1046 1047 CF_VERBOSE(find linkage for $3 library) 1048 CF_MSG_LOG([Searching for headers in [FIND_LINKAGE]($3,$6)]) 1049 1050 cf_save_CPPFLAGS="$CPPFLAGS" 1051 cf_test_CPPFLAGS="$CPPFLAGS" 1052 1053 CF_HEADER_PATH(cf_search,ifelse([$6],,[$3],[$6])) 1054 for cf_cv_header_path_$3 in $cf_search 1055 do 1056 if test -d $cf_cv_header_path_$3 ; then 1057 CF_VERBOSE(... testing $cf_cv_header_path_$3) 1058 CPPFLAGS="$cf_save_CPPFLAGS -I$cf_cv_header_path_$3" 1059 AC_TRY_COMPILE([$1],[$2],[ 1060 CF_VERBOSE(... found $3 headers in $cf_cv_header_path_$3) 1061 cf_cv_find_linkage_$3=maybe 1062 cf_test_CPPFLAGS="$CPPFLAGS" 1063 break],[ 1064 CPPFLAGS="$cf_save_CPPFLAGS" 1065 ]) 1066 fi 1067 done 1068 1069 if test "$cf_cv_find_linkage_$3" = maybe ; then 1070 1071 CF_MSG_LOG([Searching for $3 library in [FIND_LINKAGE]($3,$6)]) 1072 1073 cf_save_LIBS="$LIBS" 1074 cf_save_LDFLAGS="$LDFLAGS" 1075 1076 ifelse([$6],,,[ 1077 CPPFLAGS="$cf_test_CPPFLAGS" 1078 LIBS="-l$3 $7 $cf_save_LIBS" 1079 AC_TRY_LINK([$1],[$2],[ 1080 CF_VERBOSE(... found $3 library in system) 1081 cf_cv_find_linkage_$3=yes]) 1082 CPPFLAGS="$cf_save_CPPFLAGS" 1083 LIBS="$cf_save_LIBS" 1084 ]) 1085 1086 if test "$cf_cv_find_linkage_$3" != yes ; then 1087 CF_LIBRARY_PATH(cf_search,$3) 1088 for cf_cv_library_path_$3 in $cf_search 1089 do 1090 if test -d $cf_cv_library_path_$3 ; then 1091 CF_VERBOSE(... testing $cf_cv_library_path_$3) 1092 CPPFLAGS="$cf_test_CPPFLAGS" 1093 LIBS="-l$3 $7 $cf_save_LIBS" 1094 LDFLAGS="$cf_save_LDFLAGS -L$cf_cv_library_path_$3" 1095 AC_TRY_LINK([$1],[$2],[ 1096 CF_VERBOSE(... found $3 library in $cf_cv_library_path_$3) 1097 cf_cv_find_linkage_$3=yes 1098 cf_cv_library_file_$3="-l$3" 1099 break],[ 1100 CPPFLAGS="$cf_save_CPPFLAGS" 1101 LIBS="$cf_save_LIBS" 1102 LDFLAGS="$cf_save_LDFLAGS" 1103 ]) 1104 fi 1105 done 1106 CPPFLAGS="$cf_save_CPPFLAGS" 1107 LDFLAGS="$cf_save_LDFLAGS" 1108 fi 1109 1110 else 1111 cf_cv_find_linkage_$3=no 1112 fi 1113 ],$7) 1114]) 1115 1116LIBS="$cf_save_LIBS" 1117 1118if test "$cf_cv_find_linkage_$3" = yes ; then 1119ifelse([$4],,[ 1120 CF_ADD_INCDIR($cf_cv_header_path_$3) 1121 CF_ADD_LIBDIR($cf_cv_library_path_$3) 1122 CF_ADD_LIB($3) 1123],[$4]) 1124else 1125ifelse([$5],,AC_MSG_WARN(Cannot find $3 library),[$5]) 1126fi 1127])dnl 1128dnl --------------------------------------------------------------------------- 1129dnl CF_GCC_ATTRIBUTES version: 17 updated: 2015/04/12 15:39:00 1130dnl ----------------- 1131dnl Test for availability of useful gcc __attribute__ directives to quiet 1132dnl compiler warnings. Though useful, not all are supported -- and contrary 1133dnl to documentation, unrecognized directives cause older compilers to barf. 1134AC_DEFUN([CF_GCC_ATTRIBUTES], 1135[ 1136if test "$GCC" = yes 1137then 1138cat > conftest.i <<EOF 1139#ifndef GCC_PRINTF 1140#define GCC_PRINTF 0 1141#endif 1142#ifndef GCC_SCANF 1143#define GCC_SCANF 0 1144#endif 1145#ifndef GCC_NORETURN 1146#define GCC_NORETURN /* nothing */ 1147#endif 1148#ifndef GCC_UNUSED 1149#define GCC_UNUSED /* nothing */ 1150#endif 1151EOF 1152if test "$GCC" = yes 1153then 1154 AC_CHECKING([for $CC __attribute__ directives]) 1155cat > conftest.$ac_ext <<EOF 1156#line __oline__ "${as_me:-configure}" 1157#include "confdefs.h" 1158#include "conftest.h" 1159#include "conftest.i" 1160#if GCC_PRINTF 1161#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var))) 1162#else 1163#define GCC_PRINTFLIKE(fmt,var) /*nothing*/ 1164#endif 1165#if GCC_SCANF 1166#define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var))) 1167#else 1168#define GCC_SCANFLIKE(fmt,var) /*nothing*/ 1169#endif 1170extern void wow(char *,...) GCC_SCANFLIKE(1,2); 1171extern void oops(char *,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN; 1172extern void foo(void) GCC_NORETURN; 1173int main(int argc GCC_UNUSED, char *argv[[]] GCC_UNUSED) { return 0; } 1174EOF 1175 cf_printf_attribute=no 1176 cf_scanf_attribute=no 1177 for cf_attribute in scanf printf unused noreturn 1178 do 1179 CF_UPPER(cf_ATTRIBUTE,$cf_attribute) 1180 cf_directive="__attribute__(($cf_attribute))" 1181 echo "checking for $CC $cf_directive" 1>&AC_FD_CC 1182 1183 case $cf_attribute in 1184 (printf) 1185 cf_printf_attribute=yes 1186 cat >conftest.h <<EOF 1187#define GCC_$cf_ATTRIBUTE 1 1188EOF 1189 ;; 1190 (scanf) 1191 cf_scanf_attribute=yes 1192 cat >conftest.h <<EOF 1193#define GCC_$cf_ATTRIBUTE 1 1194EOF 1195 ;; 1196 (*) 1197 cat >conftest.h <<EOF 1198#define GCC_$cf_ATTRIBUTE $cf_directive 1199EOF 1200 ;; 1201 esac 1202 1203 if AC_TRY_EVAL(ac_compile); then 1204 test -n "$verbose" && AC_MSG_RESULT(... $cf_attribute) 1205 cat conftest.h >>confdefs.h 1206 case $cf_attribute in 1207 (noreturn) 1208 AC_DEFINE_UNQUOTED(GCC_NORETURN,$cf_directive,[Define to noreturn-attribute for gcc]) 1209 ;; 1210 (printf) 1211 cf_value='/* nothing */' 1212 if test "$cf_printf_attribute" != no ; then 1213 cf_value='__attribute__((format(printf,fmt,var)))' 1214 AC_DEFINE(GCC_PRINTF,1,[Define to 1 if the compiler supports gcc-like printf attribute.]) 1215 fi 1216 AC_DEFINE_UNQUOTED(GCC_PRINTFLIKE(fmt,var),$cf_value,[Define to printf-attribute for gcc]) 1217 ;; 1218 (scanf) 1219 cf_value='/* nothing */' 1220 if test "$cf_scanf_attribute" != no ; then 1221 cf_value='__attribute__((format(scanf,fmt,var)))' 1222 AC_DEFINE(GCC_SCANF,1,[Define to 1 if the compiler supports gcc-like scanf attribute.]) 1223 fi 1224 AC_DEFINE_UNQUOTED(GCC_SCANFLIKE(fmt,var),$cf_value,[Define to sscanf-attribute for gcc]) 1225 ;; 1226 (unused) 1227 AC_DEFINE_UNQUOTED(GCC_UNUSED,$cf_directive,[Define to unused-attribute for gcc]) 1228 ;; 1229 esac 1230 fi 1231 done 1232else 1233 fgrep define conftest.i >>confdefs.h 1234fi 1235rm -rf conftest* 1236fi 1237])dnl 1238dnl --------------------------------------------------------------------------- 1239dnl CF_GCC_VERSION version: 7 updated: 2012/10/18 06:46:33 1240dnl -------------- 1241dnl Find version of gcc 1242AC_DEFUN([CF_GCC_VERSION],[ 1243AC_REQUIRE([AC_PROG_CC]) 1244GCC_VERSION=none 1245if test "$GCC" = yes ; then 1246 AC_MSG_CHECKING(version of $CC) 1247 GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(GCC[[^)]]*) //' -e 's/^.*(Debian[[^)]]*) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`" 1248 test -z "$GCC_VERSION" && GCC_VERSION=unknown 1249 AC_MSG_RESULT($GCC_VERSION) 1250fi 1251])dnl 1252dnl --------------------------------------------------------------------------- 1253dnl CF_GCC_WARNINGS version: 32 updated: 2015/04/12 15:39:00 1254dnl --------------- 1255dnl Check if the compiler supports useful warning options. There's a few that 1256dnl we don't use, simply because they're too noisy: 1257dnl 1258dnl -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x) 1259dnl -Wredundant-decls (system headers make this too noisy) 1260dnl -Wtraditional (combines too many unrelated messages, only a few useful) 1261dnl -Wwrite-strings (too noisy, but should review occasionally). This 1262dnl is enabled for ncurses using "--enable-const". 1263dnl -pedantic 1264dnl 1265dnl Parameter: 1266dnl $1 is an optional list of gcc warning flags that a particular 1267dnl application might want to use, e.g., "no-unused" for 1268dnl -Wno-unused 1269dnl Special: 1270dnl If $with_ext_const is "yes", add a check for -Wwrite-strings 1271dnl 1272AC_DEFUN([CF_GCC_WARNINGS], 1273[ 1274AC_REQUIRE([CF_GCC_VERSION]) 1275CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS) 1276CF_CLANG_COMPILER(GCC,CLANG_COMPILER,CFLAGS) 1277 1278cat > conftest.$ac_ext <<EOF 1279#line __oline__ "${as_me:-configure}" 1280int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; } 1281EOF 1282 1283if test "$INTEL_COMPILER" = yes 1284then 1285# The "-wdXXX" options suppress warnings: 1286# remark #1419: external declaration in primary source file 1287# remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem) 1288# remark #1684: conversion from pointer to same-sized integral type (potential portability problem) 1289# remark #193: zero used for undefined preprocessing identifier 1290# remark #593: variable "curs_sb_left_arrow" was set but never used 1291# remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits 1292# remark #869: parameter "tw" was never referenced 1293# remark #981: operands are evaluated in unspecified order 1294# warning #279: controlling expression is constant 1295 1296 AC_CHECKING([for $CC warning options]) 1297 cf_save_CFLAGS="$CFLAGS" 1298 EXTRA_CFLAGS="-Wall" 1299 for cf_opt in \ 1300 wd1419 \ 1301 wd1683 \ 1302 wd1684 \ 1303 wd193 \ 1304 wd593 \ 1305 wd279 \ 1306 wd810 \ 1307 wd869 \ 1308 wd981 1309 do 1310 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" 1311 if AC_TRY_EVAL(ac_compile); then 1312 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt) 1313 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" 1314 fi 1315 done 1316 CFLAGS="$cf_save_CFLAGS" 1317 1318elif test "$GCC" = yes 1319then 1320 AC_CHECKING([for $CC warning options]) 1321 cf_save_CFLAGS="$CFLAGS" 1322 EXTRA_CFLAGS= 1323 cf_warn_CONST="" 1324 test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings" 1325 cf_gcc_warnings="Wignored-qualifiers Wlogical-op Wvarargs" 1326 test "x$CLANG_COMPILER" = xyes && cf_gcc_warnings= 1327 for cf_opt in W Wall \ 1328 Wbad-function-cast \ 1329 Wcast-align \ 1330 Wcast-qual \ 1331 Wdeclaration-after-statement \ 1332 Wextra \ 1333 Winline \ 1334 Wmissing-declarations \ 1335 Wmissing-prototypes \ 1336 Wnested-externs \ 1337 Wpointer-arith \ 1338 Wshadow \ 1339 Wstrict-prototypes \ 1340 Wundef $cf_gcc_warnings $cf_warn_CONST $1 1341 do 1342 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" 1343 if AC_TRY_EVAL(ac_compile); then 1344 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt) 1345 case $cf_opt in 1346 (Wcast-qual) 1347 CPPFLAGS="$CPPFLAGS -DXTSTRINGDEFINES" 1348 ;; 1349 (Winline) 1350 case $GCC_VERSION in 1351 ([[34]].*) 1352 CF_VERBOSE(feature is broken in gcc $GCC_VERSION) 1353 continue;; 1354 esac 1355 ;; 1356 (Wpointer-arith) 1357 case $GCC_VERSION in 1358 ([[12]].*) 1359 CF_VERBOSE(feature is broken in gcc $GCC_VERSION) 1360 continue;; 1361 esac 1362 ;; 1363 esac 1364 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" 1365 fi 1366 done 1367 CFLAGS="$cf_save_CFLAGS" 1368fi 1369rm -rf conftest* 1370 1371AC_SUBST(EXTRA_CFLAGS) 1372])dnl 1373dnl --------------------------------------------------------------------------- 1374dnl CF_GETOPT_HEADER version: 6 updated: 2014/07/22 14:45:54 1375dnl ---------------- 1376dnl Check for getopt's variables which are commonly defined in stdlib.h, 1377dnl unistd.h or (nonstandard) in getopt.h 1378AC_DEFUN([CF_GETOPT_HEADER], 1379[ 1380AC_HAVE_HEADERS(unistd.h getopt.h) 1381AC_CACHE_CHECK(for header declaring getopt variables,cf_cv_getopt_header,[ 1382cf_cv_getopt_header=none 1383for cf_header in stdio.h stdlib.h unistd.h getopt.h 1384do 1385AC_TRY_COMPILE([ 1386#include <$cf_header>], 1387[int x = optind; char *y = optarg], 1388[cf_cv_getopt_header=$cf_header 1389 break]) 1390done 1391]) 1392if test $cf_cv_getopt_header != none ; then 1393 AC_DEFINE(HAVE_GETOPT_HEADER,1,[Define to 1 if getopt variables are declared in header]) 1394fi 1395if test $cf_cv_getopt_header = getopt.h ; then 1396 AC_DEFINE(NEED_GETOPT_H,1,[Define to 1 if we must include getopt.h]) 1397fi 1398])dnl 1399dnl --------------------------------------------------------------------------- 1400dnl CF_GNU_SOURCE version: 7 updated: 2016/08/05 05:15:37 1401dnl ------------- 1402dnl Check if we must define _GNU_SOURCE to get a reasonable value for 1403dnl _XOPEN_SOURCE, upon which many POSIX definitions depend. This is a defect 1404dnl (or misfeature) of glibc2, which breaks portability of many applications, 1405dnl since it is interwoven with GNU extensions. 1406dnl 1407dnl Well, yes we could work around it... 1408AC_DEFUN([CF_GNU_SOURCE], 1409[ 1410AC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[ 1411AC_TRY_COMPILE([#include <sys/types.h>],[ 1412#ifndef _XOPEN_SOURCE 1413make an error 1414#endif], 1415 [cf_cv_gnu_source=no], 1416 [cf_save="$CPPFLAGS" 1417 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" 1418 AC_TRY_COMPILE([#include <sys/types.h>],[ 1419#ifdef _XOPEN_SOURCE 1420make an error 1421#endif], 1422 [cf_cv_gnu_source=no], 1423 [cf_cv_gnu_source=yes]) 1424 CPPFLAGS="$cf_save" 1425 ]) 1426]) 1427 1428if test "$cf_cv_gnu_source" = yes 1429then 1430AC_CACHE_CHECK(if we should also define _DEFAULT_SOURCE,cf_cv_default_source,[ 1431CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" 1432 AC_TRY_COMPILE([#include <sys/types.h>],[ 1433#ifdef _DEFAULT_SOURCE 1434make an error 1435#endif], 1436 [cf_cv_default_source=no], 1437 [cf_cv_default_source=yes]) 1438 ]) 1439test "$cf_cv_default_source" = yes && CPPFLAGS="$CPPFLAGS -D_DEFAULT_SOURCE" 1440fi 1441])dnl 1442dnl --------------------------------------------------------------------------- 1443dnl CF_HEADER_PATH version: 13 updated: 2015/04/15 19:08:48 1444dnl -------------- 1445dnl Construct a search-list of directories for a nonstandard header-file 1446dnl 1447dnl Parameters 1448dnl $1 = the variable to return as result 1449dnl $2 = the package name 1450AC_DEFUN([CF_HEADER_PATH], 1451[ 1452$1= 1453 1454# collect the current set of include-directories from compiler flags 1455cf_header_path_list="" 1456if test -n "${CFLAGS}${CPPFLAGS}" ; then 1457 for cf_header_path in $CPPFLAGS $CFLAGS 1458 do 1459 case $cf_header_path in 1460 (-I*) 1461 cf_header_path=`echo ".$cf_header_path" |sed -e 's/^...//' -e 's,/include$,,'` 1462 CF_ADD_SUBDIR_PATH($1,$2,include,$cf_header_path,NONE) 1463 cf_header_path_list="$cf_header_path_list [$]$1" 1464 ;; 1465 esac 1466 done 1467fi 1468 1469# add the variations for the package we are looking for 1470CF_SUBDIR_PATH($1,$2,include) 1471 1472test "$includedir" != NONE && \ 1473test "$includedir" != "/usr/include" && \ 1474test -d "$includedir" && { 1475 test -d $includedir && $1="[$]$1 $includedir" 1476 test -d $includedir/$2 && $1="[$]$1 $includedir/$2" 1477} 1478 1479test "$oldincludedir" != NONE && \ 1480test "$oldincludedir" != "/usr/include" && \ 1481test -d "$oldincludedir" && { 1482 test -d $oldincludedir && $1="[$]$1 $oldincludedir" 1483 test -d $oldincludedir/$2 && $1="[$]$1 $oldincludedir/$2" 1484} 1485 1486$1="[$]$1 $cf_header_path_list" 1487])dnl 1488dnl --------------------------------------------------------------------------- 1489dnl CF_INTEL_COMPILER version: 7 updated: 2015/04/12 15:39:00 1490dnl ----------------- 1491dnl Check if the given compiler is really the Intel compiler for Linux. It 1492dnl tries to imitate gcc, but does not return an error when it finds a mismatch 1493dnl between prototypes, e.g., as exercised by CF_MISSING_CHECK. 1494dnl 1495dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to 1496dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from 1497dnl the wrappers for gcc and g++ warnings. 1498dnl 1499dnl $1 = GCC (default) or GXX 1500dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS 1501dnl $3 = CFLAGS (default) or CXXFLAGS 1502AC_DEFUN([CF_INTEL_COMPILER],[ 1503AC_REQUIRE([AC_CANONICAL_HOST]) 1504ifelse([$2],,INTEL_COMPILER,[$2])=no 1505 1506if test "$ifelse([$1],,[$1],GCC)" = yes ; then 1507 case $host_os in 1508 (linux*|gnu*) 1509 AC_MSG_CHECKING(if this is really Intel ifelse([$1],GXX,C++,C) compiler) 1510 cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])" 1511 ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -no-gcc" 1512 AC_TRY_COMPILE([],[ 1513#ifdef __INTEL_COMPILER 1514#else 1515make an error 1516#endif 1517],[ifelse([$2],,INTEL_COMPILER,[$2])=yes 1518cf_save_CFLAGS="$cf_save_CFLAGS -we147" 1519],[]) 1520 ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS" 1521 AC_MSG_RESULT($ifelse([$2],,INTEL_COMPILER,[$2])) 1522 ;; 1523 esac 1524fi 1525])dnl 1526dnl --------------------------------------------------------------------------- 1527dnl CF_LIBRARY_PATH version: 10 updated: 2015/04/15 19:08:48 1528dnl --------------- 1529dnl Construct a search-list of directories for a nonstandard library-file 1530dnl 1531dnl Parameters 1532dnl $1 = the variable to return as result 1533dnl $2 = the package name 1534AC_DEFUN([CF_LIBRARY_PATH], 1535[ 1536$1= 1537cf_library_path_list="" 1538if test -n "${LDFLAGS}${LIBS}" ; then 1539 for cf_library_path in $LDFLAGS $LIBS 1540 do 1541 case $cf_library_path in 1542 (-L*) 1543 cf_library_path=`echo ".$cf_library_path" |sed -e 's/^...//' -e 's,/lib$,,'` 1544 CF_ADD_SUBDIR_PATH($1,$2,lib,$cf_library_path,NONE) 1545 cf_library_path_list="$cf_library_path_list [$]$1" 1546 ;; 1547 esac 1548 done 1549fi 1550 1551CF_SUBDIR_PATH($1,$2,lib) 1552 1553$1="$cf_library_path_list [$]$1" 1554])dnl 1555dnl --------------------------------------------------------------------------- 1556dnl CF_MAKE_DOCS version: 4 updated: 2015/07/04 21:43:03 1557dnl ------------ 1558dnl $1 = name(s) to generate rules for 1559dnl $2 = suffix of corresponding manpages used as input. 1560dnl 1561dnl This works best if called at the end of configure.in, following CF_WITH_MAN2HTML 1562define([CF_MAKE_DOCS],[ 1563test -z "$cf_make_docs" && cf_make_docs=0 1564 1565cf_output=makefile 1566test -f "$cf_output" || cf_output=Makefile 1567 1568if test "$cf_make_docs" = 0 1569then 1570cat >>$cf_output <<CF_EOF 1571################################################################################ 1572## generated by $0 1573.SUFFIXES : .html .$2 .man .ps .pdf .txt 1574 1575${NROFF_NOTE}.$2.txt : 1576${NROFF_NOTE} [\$](SHELL) -c "tbl [\$]*.$2 | nroff -man | col -bx" >[\$]@ 1577 1578${GROFF_NOTE}.ps.pdf : 1579${GROFF_NOTE} ps2pdf [\$]*.ps 1580${GROFF_NOTE} 1581${GROFF_NOTE}.$2.ps : 1582${GROFF_NOTE} [\$](SHELL) -c "tbl [\$]*.$2 | groff -man" >[\$]@ 1583${GROFF_NOTE} 1584${GROFF_NOTE}.$2.txt : 1585${GROFF_NOTE} GROFF_NO_SGR=stupid [\$](SHELL) -c "tbl [\$]*.$2 | nroff -Tascii -man | col -bx" >[\$]@ 1586 1587${MAN2HTML_NOTE}.$2.html : 1588${MAN2HTML_NOTE} ./${MAN2HTML_TEMP} [\$]* $2 man >[\$]@ 1589 1590CF_EOF 1591 cf_make_docs=1 1592fi 1593 1594for cf_name in $1 1595do 1596cat >>$cf_output <<CF_EOF 1597################################################################################ 1598${NROFF_NOTE}docs docs-$cf_name :: $cf_name.txt 1599${MAN2HTML_NOTE}docs docs-$cf_name :: $cf_name.html 1600${GROFF_NOTE}docs docs-$cf_name :: $cf_name.pdf 1601${GROFF_NOTE}docs docs-$cf_name :: $cf_name.ps 1602${GROFF_NOTE}docs docs-$cf_name :: $cf_name.txt 1603 1604clean \\ 1605docs-clean :: 1606${NROFF_NOTE} rm -f $cf_name.txt 1607${MAN2HTML_NOTE} rm -f $cf_name.html 1608${GROFF_NOTE} rm -f $cf_name.pdf 1609${GROFF_NOTE} rm -f $cf_name.ps 1610${GROFF_NOTE} rm -f $cf_name.txt 1611 1612${NROFF_NOTE}$cf_name.txt : $cf_name.$2 1613${MAN2HTML_NOTE}$cf_name.html : $cf_name.$2 1614${GROFF_NOTE}$cf_name.pdf : $cf_name.ps 1615${GROFF_NOTE}$cf_name.ps : $cf_name.$2 1616${GROFF_NOTE}$cf_name.txt : $cf_name.$2 1617CF_EOF 1618done 1619])dnl 1620dnl --------------------------------------------------------------------------- 1621dnl CF_MAKE_TAGS version: 6 updated: 2010/10/23 15:52:32 1622dnl ------------ 1623dnl Generate tags/TAGS targets for makefiles. Do not generate TAGS if we have 1624dnl a monocase filesystem. 1625AC_DEFUN([CF_MAKE_TAGS],[ 1626AC_REQUIRE([CF_MIXEDCASE_FILENAMES]) 1627 1628AC_CHECK_PROGS(CTAGS, exctags ctags) 1629AC_CHECK_PROGS(ETAGS, exetags etags) 1630 1631AC_CHECK_PROG(MAKE_LOWER_TAGS, ${CTAGS:-ctags}, yes, no) 1632 1633if test "$cf_cv_mixedcase" = yes ; then 1634 AC_CHECK_PROG(MAKE_UPPER_TAGS, ${ETAGS:-etags}, yes, no) 1635else 1636 MAKE_UPPER_TAGS=no 1637fi 1638 1639if test "$MAKE_UPPER_TAGS" = yes ; then 1640 MAKE_UPPER_TAGS= 1641else 1642 MAKE_UPPER_TAGS="#" 1643fi 1644 1645if test "$MAKE_LOWER_TAGS" = yes ; then 1646 MAKE_LOWER_TAGS= 1647else 1648 MAKE_LOWER_TAGS="#" 1649fi 1650 1651AC_SUBST(CTAGS) 1652AC_SUBST(ETAGS) 1653 1654AC_SUBST(MAKE_UPPER_TAGS) 1655AC_SUBST(MAKE_LOWER_TAGS) 1656])dnl 1657dnl --------------------------------------------------------------------------- 1658dnl CF_MIXEDCASE_FILENAMES version: 7 updated: 2015/04/12 15:39:00 1659dnl ---------------------- 1660dnl Check if the file-system supports mixed-case filenames. If we're able to 1661dnl create a lowercase name and see it as uppercase, it doesn't support that. 1662AC_DEFUN([CF_MIXEDCASE_FILENAMES], 1663[ 1664AC_CACHE_CHECK(if filesystem supports mixed-case filenames,cf_cv_mixedcase,[ 1665if test "$cross_compiling" = yes ; then 1666 case $target_alias in 1667 (*-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-msys*|*-mingw*|*-uwin*) 1668 cf_cv_mixedcase=no 1669 ;; 1670 (*) 1671 cf_cv_mixedcase=yes 1672 ;; 1673 esac 1674else 1675 rm -f conftest CONFTEST 1676 echo test >conftest 1677 if test -f CONFTEST ; then 1678 cf_cv_mixedcase=no 1679 else 1680 cf_cv_mixedcase=yes 1681 fi 1682 rm -f conftest CONFTEST 1683fi 1684]) 1685test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES,1,[Define to 1 if filesystem supports mixed-case filenames.]) 1686])dnl 1687dnl --------------------------------------------------------------------------- 1688dnl CF_MSG_LOG version: 5 updated: 2010/10/23 15:52:32 1689dnl ---------- 1690dnl Write a debug message to config.log, along with the line number in the 1691dnl configure script. 1692AC_DEFUN([CF_MSG_LOG],[ 1693echo "${as_me:-configure}:__oline__: testing $* ..." 1>&AC_FD_CC 1694])dnl 1695dnl --------------------------------------------------------------------------- 1696dnl CF_NCURSES_CC_CHECK version: 4 updated: 2007/07/29 10:39:05 1697dnl ------------------- 1698dnl Check if we can compile with ncurses' header file 1699dnl $1 is the cache variable to set 1700dnl $2 is the header-file to include 1701dnl $3 is the root name (ncurses or ncursesw) 1702AC_DEFUN([CF_NCURSES_CC_CHECK],[ 1703 AC_TRY_COMPILE([ 1704]ifelse($3,ncursesw,[ 1705#define _XOPEN_SOURCE_EXTENDED 1706#undef HAVE_LIBUTF8_H /* in case we used CF_UTF8_LIB */ 1707#define HAVE_LIBUTF8_H /* to force ncurses' header file to use cchar_t */ 1708])[ 1709#include <$2>],[ 1710#ifdef NCURSES_VERSION 1711]ifelse($3,ncursesw,[ 1712#ifndef WACS_BSSB 1713 make an error 1714#endif 1715])[ 1716printf("%s\n", NCURSES_VERSION); 1717#else 1718#ifdef __NCURSES_H 1719printf("old\n"); 1720#else 1721 make an error 1722#endif 1723#endif 1724 ] 1725 ,[$1=$2] 1726 ,[$1=no]) 1727])dnl 1728dnl --------------------------------------------------------------------------- 1729dnl CF_NCURSES_CONFIG version: 20 updated: 2018/01/03 04:47:33 1730dnl ----------------- 1731dnl Tie together the configure-script macros for ncurses, preferring these in 1732dnl order: 1733dnl a) ".pc" files for pkg-config, using $NCURSES_CONFIG_PKG 1734dnl b) the "-config" script from ncurses, using $NCURSES_CONFIG 1735dnl c) just plain libraries 1736dnl 1737dnl $1 is the root library name (default: "ncurses") 1738AC_DEFUN([CF_NCURSES_CONFIG],[ 1739AC_REQUIRE([CF_PKG_CONFIG]) 1740cf_ncuconfig_root=ifelse($1,,ncurses,$1) 1741cf_have_ncuconfig=no 1742 1743if test "x${PKG_CONFIG:=none}" != xnone; then 1744 AC_MSG_CHECKING(pkg-config for $cf_ncuconfig_root) 1745 if "$PKG_CONFIG" --exists $cf_ncuconfig_root ; then 1746 AC_MSG_RESULT(yes) 1747 1748 AC_MSG_CHECKING(if the $cf_ncuconfig_root package files work) 1749 cf_have_ncuconfig=unknown 1750 1751 cf_save_CPPFLAGS="$CPPFLAGS" 1752 cf_save_LIBS="$LIBS" 1753 1754 CPPFLAGS="$CPPFLAGS `$PKG_CONFIG --cflags $cf_ncuconfig_root`" 1755 CF_ADD_LIBS(`$PKG_CONFIG --libs $cf_ncuconfig_root`) 1756 1757 AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>], 1758 [initscr(); mousemask(0,0); tgoto((char *)0, 0, 0);], 1759 [AC_TRY_RUN([#include <${cf_cv_ncurses_header:-curses.h}> 1760 int main(void) 1761 { char *xx = curses_version(); return (xx == 0); }], 1762 [cf_have_ncuconfig=yes], 1763 [cf_have_ncuconfig=no], 1764 [cf_have_ncuconfig=maybe])], 1765 [cf_have_ncuconfig=no]) 1766 AC_MSG_RESULT($cf_have_ncuconfig) 1767 test "$cf_have_ncuconfig" = maybe && cf_have_ncuconfig=yes 1768 if test "$cf_have_ncuconfig" != "yes" 1769 then 1770 CPPFLAGS="$cf_save_CPPFLAGS" 1771 LIBS="$cf_save_LIBS" 1772 NCURSES_CONFIG_PKG=none 1773 else 1774 AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries]) 1775 NCURSES_CONFIG_PKG=$cf_ncuconfig_root 1776 CF_TERM_HEADER 1777 fi 1778 1779 else 1780 AC_MSG_RESULT(no) 1781 NCURSES_CONFIG_PKG=none 1782 fi 1783else 1784 NCURSES_CONFIG_PKG=none 1785fi 1786 1787if test "x$cf_have_ncuconfig" = "xno"; then 1788 cf_ncurses_config="${cf_ncuconfig_root}${NCURSES_CONFIG_SUFFIX}-config"; echo "Looking for ${cf_ncurses_config}" 1789 1790 CF_ACVERSION_CHECK(2.52, 1791 [AC_CHECK_TOOLS(NCURSES_CONFIG, ${cf_ncurses_config} ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config, none)], 1792 [AC_PATH_PROGS(NCURSES_CONFIG, ${cf_ncurses_config} ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config, none)]) 1793 1794 if test "$NCURSES_CONFIG" != none ; then 1795 1796 CPPFLAGS="$CPPFLAGS `$NCURSES_CONFIG --cflags`" 1797 CF_ADD_LIBS(`$NCURSES_CONFIG --libs`) 1798 1799 # even with config script, some packages use no-override for curses.h 1800 CF_CURSES_HEADER(ifelse($1,,ncurses,$1)) 1801 1802 dnl like CF_NCURSES_CPPFLAGS 1803 AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries]) 1804 1805 dnl like CF_NCURSES_LIBS 1806 CF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_ncuconfig_root) 1807 AC_DEFINE_UNQUOTED($cf_nculib_ROOT) 1808 1809 dnl like CF_NCURSES_VERSION 1810 cf_cv_ncurses_version=`$NCURSES_CONFIG --version` 1811 1812 else 1813 1814 CF_NCURSES_CPPFLAGS(ifelse($1,,ncurses,$1)) 1815 CF_NCURSES_LIBS(ifelse($1,,ncurses,$1)) 1816 1817 fi 1818else 1819 NCURSES_CONFIG=none 1820fi 1821])dnl 1822dnl --------------------------------------------------------------------------- 1823dnl CF_NCURSES_CPPFLAGS version: 21 updated: 2012/10/06 08:57:51 1824dnl ------------------- 1825dnl Look for the SVr4 curses clone 'ncurses' in the standard places, adjusting 1826dnl the CPPFLAGS variable so we can include its header. 1827dnl 1828dnl The header files may be installed as either curses.h, or ncurses.h (would 1829dnl be obsolete, except that some packagers prefer this name to distinguish it 1830dnl from a "native" curses implementation). If not installed for overwrite, 1831dnl the curses.h file would be in an ncurses subdirectory (e.g., 1832dnl /usr/include/ncurses), but someone may have installed overwriting the 1833dnl vendor's curses. Only very old versions (pre-1.9.2d, the first autoconf'd 1834dnl version) of ncurses don't define either __NCURSES_H or NCURSES_VERSION in 1835dnl the header. 1836dnl 1837dnl If the installer has set $CFLAGS or $CPPFLAGS so that the ncurses header 1838dnl is already in the include-path, don't even bother with this, since we cannot 1839dnl easily determine which file it is. In this case, it has to be <curses.h>. 1840dnl 1841dnl The optional parameter gives the root name of the library, in case it is 1842dnl not installed as the default curses library. That is how the 1843dnl wide-character version of ncurses is installed. 1844AC_DEFUN([CF_NCURSES_CPPFLAGS], 1845[AC_REQUIRE([CF_WITH_CURSES_DIR]) 1846 1847AC_PROVIDE([CF_CURSES_CPPFLAGS])dnl 1848cf_ncuhdr_root=ifelse($1,,ncurses,$1) 1849 1850test -n "$cf_cv_curses_dir" && \ 1851test "$cf_cv_curses_dir" != "no" && { \ 1852 CF_ADD_INCDIR($cf_cv_curses_dir/include/$cf_ncuhdr_root) 1853} 1854 1855AC_CACHE_CHECK(for $cf_ncuhdr_root header in include-path, cf_cv_ncurses_h,[ 1856 cf_header_list="$cf_ncuhdr_root/curses.h $cf_ncuhdr_root/ncurses.h" 1857 ( test "$cf_ncuhdr_root" = ncurses || test "$cf_ncuhdr_root" = ncursesw ) && cf_header_list="$cf_header_list curses.h ncurses.h" 1858 for cf_header in $cf_header_list 1859 do 1860 CF_NCURSES_CC_CHECK(cf_cv_ncurses_h,$cf_header,$1) 1861 test "$cf_cv_ncurses_h" != no && break 1862 done 1863]) 1864 1865CF_NCURSES_HEADER 1866CF_TERM_HEADER 1867 1868# some applications need this, but should check for NCURSES_VERSION 1869AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries]) 1870 1871CF_NCURSES_VERSION 1872])dnl 1873dnl --------------------------------------------------------------------------- 1874dnl CF_NCURSES_HEADER version: 4 updated: 2015/04/15 19:08:48 1875dnl ----------------- 1876dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common 1877dnl variations of ncurses' installs. 1878dnl 1879dnl See also CF_CURSES_HEADER, which sets the same cache variable. 1880AC_DEFUN([CF_NCURSES_HEADER],[ 1881 1882if test "$cf_cv_ncurses_h" != no ; then 1883 cf_cv_ncurses_header=$cf_cv_ncurses_h 1884else 1885 1886AC_CACHE_CHECK(for $cf_ncuhdr_root include-path, cf_cv_ncurses_h2,[ 1887 test -n "$verbose" && echo 1888 CF_HEADER_PATH(cf_search,$cf_ncuhdr_root) 1889 test -n "$verbose" && echo search path $cf_search 1890 cf_save2_CPPFLAGS="$CPPFLAGS" 1891 for cf_incdir in $cf_search 1892 do 1893 CF_ADD_INCDIR($cf_incdir) 1894 for cf_header in \ 1895 ncurses.h \ 1896 curses.h 1897 do 1898 CF_NCURSES_CC_CHECK(cf_cv_ncurses_h2,$cf_header,$1) 1899 if test "$cf_cv_ncurses_h2" != no ; then 1900 cf_cv_ncurses_h2=$cf_incdir/$cf_header 1901 test -n "$verbose" && echo $ac_n " ... found $ac_c" 1>&AC_FD_MSG 1902 break 1903 fi 1904 test -n "$verbose" && echo " ... tested $cf_incdir/$cf_header" 1>&AC_FD_MSG 1905 done 1906 CPPFLAGS="$cf_save2_CPPFLAGS" 1907 test "$cf_cv_ncurses_h2" != no && break 1908 done 1909 test "$cf_cv_ncurses_h2" = no && AC_MSG_ERROR(not found) 1910 ]) 1911 1912 CF_DIRNAME(cf_1st_incdir,$cf_cv_ncurses_h2) 1913 cf_cv_ncurses_header=`basename $cf_cv_ncurses_h2` 1914 if test `basename $cf_1st_incdir` = $cf_ncuhdr_root ; then 1915 cf_cv_ncurses_header=$cf_ncuhdr_root/$cf_cv_ncurses_header 1916 fi 1917 CF_ADD_INCDIR($cf_1st_incdir) 1918 1919fi 1920 1921# Set definitions to allow ifdef'ing for ncurses.h 1922 1923case $cf_cv_ncurses_header in 1924(*ncurses.h) 1925 AC_DEFINE(HAVE_NCURSES_H,1,[Define to 1 if we have ncurses.h]) 1926 ;; 1927esac 1928 1929case $cf_cv_ncurses_header in 1930(ncurses/curses.h|ncurses/ncurses.h) 1931 AC_DEFINE(HAVE_NCURSES_NCURSES_H,1,[Define to 1 if we have ncurses/ncurses.h]) 1932 ;; 1933(ncursesw/curses.h|ncursesw/ncurses.h) 1934 AC_DEFINE(HAVE_NCURSESW_NCURSES_H,1,[Define to 1 if we have ncursesw/ncurses.h]) 1935 ;; 1936esac 1937 1938])dnl 1939dnl --------------------------------------------------------------------------- 1940dnl CF_NCURSES_LIBS version: 17 updated: 2015/04/15 19:08:48 1941dnl --------------- 1942dnl Look for the ncurses library. This is a little complicated on Linux, 1943dnl because it may be linked with the gpm (general purpose mouse) library. 1944dnl Some distributions have gpm linked with (bsd) curses, which makes it 1945dnl unusable with ncurses. However, we don't want to link with gpm unless 1946dnl ncurses has a dependency, since gpm is normally set up as a shared library, 1947dnl and the linker will record a dependency. 1948dnl 1949dnl The optional parameter gives the root name of the library, in case it is 1950dnl not installed as the default curses library. That is how the 1951dnl wide-character version of ncurses is installed. 1952AC_DEFUN([CF_NCURSES_LIBS], 1953[AC_REQUIRE([CF_NCURSES_CPPFLAGS]) 1954 1955cf_nculib_root=ifelse($1,,ncurses,$1) 1956 # This works, except for the special case where we find gpm, but 1957 # ncurses is in a nonstandard location via $LIBS, and we really want 1958 # to link gpm. 1959cf_ncurses_LIBS="" 1960cf_ncurses_SAVE="$LIBS" 1961AC_CHECK_LIB(gpm,Gpm_Open, 1962 [AC_CHECK_LIB(gpm,initscr, 1963 [LIBS="$cf_ncurses_SAVE"], 1964 [cf_ncurses_LIBS="-lgpm"])]) 1965 1966case $host_os in 1967(freebsd*) 1968 # This is only necessary if you are linking against an obsolete 1969 # version of ncurses (but it should do no harm, since it's static). 1970 if test "$cf_nculib_root" = ncurses ; then 1971 AC_CHECK_LIB(mytinfo,tgoto,[cf_ncurses_LIBS="-lmytinfo $cf_ncurses_LIBS"]) 1972 fi 1973 ;; 1974esac 1975 1976CF_ADD_LIBS($cf_ncurses_LIBS) 1977 1978if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" ) 1979then 1980 CF_ADD_LIBS(-l$cf_nculib_root) 1981else 1982 CF_FIND_LIBRARY($cf_nculib_root,$cf_nculib_root, 1983 [#include <${cf_cv_ncurses_header:-curses.h}>], 1984 [initscr()], 1985 initscr) 1986fi 1987 1988if test -n "$cf_ncurses_LIBS" ; then 1989 AC_MSG_CHECKING(if we can link $cf_nculib_root without $cf_ncurses_LIBS) 1990 cf_ncurses_SAVE="$LIBS" 1991 for p in $cf_ncurses_LIBS ; do 1992 q=`echo $LIBS | sed -e "s%$p %%" -e "s%$p$%%"` 1993 if test "$q" != "$LIBS" ; then 1994 LIBS="$q" 1995 fi 1996 done 1997 AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>], 1998 [initscr(); mousemask(0,0); tgoto((char *)0, 0, 0);], 1999 [AC_MSG_RESULT(yes)], 2000 [AC_MSG_RESULT(no) 2001 LIBS="$cf_ncurses_SAVE"]) 2002fi 2003 2004CF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_nculib_root) 2005AC_DEFINE_UNQUOTED($cf_nculib_ROOT) 2006])dnl 2007dnl --------------------------------------------------------------------------- 2008dnl CF_NCURSES_PTHREADS version: 2 updated: 2016/04/22 05:07:41 2009dnl ------------------- 2010dnl Use this followup check to ensure that we link with pthreads if ncurses 2011dnl uses it. 2012AC_DEFUN([CF_NCURSES_PTHREADS],[ 2013: ${cf_nculib_root:=ifelse($1,,ncurses,$1)} 2014AC_CHECK_LIB($cf_nculib_root,_nc_init_pthreads, 2015 cf_cv_ncurses_pthreads=yes, 2016 cf_cv_ncurses_pthreads=no) 2017if test "$cf_cv_ncurses_pthreads" = yes 2018then 2019 CF_ADD_LIBS(-lpthread) 2020fi 2021])dnl 2022dnl --------------------------------------------------------------------------- 2023dnl CF_NCURSES_VERSION version: 15 updated: 2017/05/09 19:26:10 2024dnl ------------------ 2025dnl Check for the version of ncurses, to aid in reporting bugs, etc. 2026dnl Call CF_CURSES_CPPFLAGS first, or CF_NCURSES_CPPFLAGS. We don't use 2027dnl AC_REQUIRE since that does not work with the shell's if/then/else/fi. 2028AC_DEFUN([CF_NCURSES_VERSION], 2029[ 2030AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl 2031AC_CACHE_CHECK(for ncurses version, cf_cv_ncurses_version,[ 2032 cf_cv_ncurses_version=no 2033 cf_tempfile=out$$ 2034 rm -f $cf_tempfile 2035 AC_TRY_RUN([ 2036#include <${cf_cv_ncurses_header:-curses.h}> 2037#include <stdio.h> 2038int main(void) 2039{ 2040 FILE *fp = fopen("$cf_tempfile", "w"); 2041#ifdef NCURSES_VERSION 2042# ifdef NCURSES_VERSION_PATCH 2043 fprintf(fp, "%s.%d\n", NCURSES_VERSION, NCURSES_VERSION_PATCH); 2044# else 2045 fprintf(fp, "%s\n", NCURSES_VERSION); 2046# endif 2047#else 2048# ifdef __NCURSES_H 2049 fprintf(fp, "old\n"); 2050# else 2051 make an error 2052# endif 2053#endif 2054 ${cf_cv_main_return:-return}(0); 2055}],[ 2056 cf_cv_ncurses_version=`cat $cf_tempfile`],,[ 2057 2058 # This will not work if the preprocessor splits the line after the 2059 # Autoconf token. The 'unproto' program does that. 2060 cat > conftest.$ac_ext <<EOF 2061#include <${cf_cv_ncurses_header:-curses.h}> 2062#undef Autoconf 2063#ifdef NCURSES_VERSION 2064Autoconf NCURSES_VERSION 2065#else 2066#ifdef __NCURSES_H 2067Autoconf "old" 2068#endif 2069; 2070#endif 2071EOF 2072 cf_try="$ac_cpp conftest.$ac_ext 2>&AC_FD_CC | grep '^Autoconf ' >conftest.out" 2073 AC_TRY_EVAL(cf_try) 2074 if test -f conftest.out ; then 2075 cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[[^"]]*"%%' -e 's%".*%%'` 2076 test -n "$cf_out" && cf_cv_ncurses_version="$cf_out" 2077 rm -f conftest.out 2078 fi 2079]) 2080 rm -f $cf_tempfile 2081]) 2082test "$cf_cv_ncurses_version" = no || AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries]) 2083])dnl 2084dnl --------------------------------------------------------------------------- 2085dnl CF_NO_LEAKS_OPTION version: 6 updated: 2015/04/12 15:39:00 2086dnl ------------------ 2087dnl see CF_WITH_NO_LEAKS 2088AC_DEFUN([CF_NO_LEAKS_OPTION],[ 2089AC_MSG_CHECKING(if you want to use $1 for testing) 2090AC_ARG_WITH($1, 2091 [$2], 2092 [AC_DEFINE_UNQUOTED($3,1,"Define to 1 if you want to use $1 for testing.")ifelse([$4],,[ 2093 $4 2094]) 2095 : ${with_cflags:=-g} 2096 : ${with_no_leaks:=yes} 2097 with_$1=yes], 2098 [with_$1=]) 2099AC_MSG_RESULT(${with_$1:-no}) 2100 2101case .$with_cflags in 2102(.*-g*) 2103 case .$CFLAGS in 2104 (.*-g*) 2105 ;; 2106 (*) 2107 CF_ADD_CFLAGS([-g]) 2108 ;; 2109 esac 2110 ;; 2111esac 2112])dnl 2113dnl --------------------------------------------------------------------------- 2114dnl CF_PATH_SYNTAX version: 16 updated: 2015/04/18 08:56:57 2115dnl -------------- 2116dnl Check the argument to see that it looks like a pathname. Rewrite it if it 2117dnl begins with one of the prefix/exec_prefix variables, and then again if the 2118dnl result begins with 'NONE'. This is necessary to work around autoconf's 2119dnl delayed evaluation of those symbols. 2120AC_DEFUN([CF_PATH_SYNTAX],[ 2121if test "x$prefix" != xNONE; then 2122 cf_path_syntax="$prefix" 2123else 2124 cf_path_syntax="$ac_default_prefix" 2125fi 2126 2127case ".[$]$1" in 2128(.\[$]\(*\)*|.\'*\'*) 2129 ;; 2130(..|./*|.\\*) 2131 ;; 2132(.[[a-zA-Z]]:[[\\/]]*) # OS/2 EMX 2133 ;; 2134(.\[$]{*prefix}*|.\[$]{*dir}*) 2135 eval $1="[$]$1" 2136 case ".[$]$1" in 2137 (.NONE/*) 2138 $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%` 2139 ;; 2140 esac 2141 ;; 2142(.no|.NONE/*) 2143 $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%` 2144 ;; 2145(*) 2146 ifelse([$2],,[AC_MSG_ERROR([expected a pathname, not \"[$]$1\"])],$2) 2147 ;; 2148esac 2149])dnl 2150dnl --------------------------------------------------------------------------- 2151dnl CF_PDCURSES_X11 version: 13 updated: 2012/10/06 16:39:58 2152dnl --------------- 2153dnl Configure for PDCurses' X11 library 2154AC_DEFUN([CF_PDCURSES_X11],[ 2155AC_REQUIRE([CF_X_ATHENA]) 2156 2157CF_ACVERSION_CHECK(2.52, 2158 [AC_CHECK_TOOLS(XCURSES_CONFIG, xcurses-config, none)], 2159 [AC_PATH_PROGS(XCURSES_CONFIG, xcurses-config, none)]) 2160 2161if test "$XCURSES_CONFIG" != none ; then 2162 2163CPPFLAGS="$CPPFLAGS `$XCURSES_CONFIG --cflags`" 2164CF_ADD_LIBS(`$XCURSES_CONFIG --libs`) 2165 2166cf_cv_lib_XCurses=yes 2167 2168else 2169 2170LDFLAGS="$LDFLAGS $X_LIBS" 2171CF_CHECK_CFLAGS($X_CFLAGS) 2172AC_CHECK_LIB(X11,XOpenDisplay, 2173 [CF_ADD_LIBS(-lX11)],, 2174 [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS]) 2175AC_CACHE_CHECK(for XCurses library,cf_cv_lib_XCurses,[ 2176CF_ADD_LIBS(-lXCurses) 2177AC_TRY_LINK([ 2178#include <xcurses.h> 2179char *XCursesProgramName = "test"; 2180],[XCursesExit();], 2181[cf_cv_lib_XCurses=yes], 2182[cf_cv_lib_XCurses=no]) 2183]) 2184 2185fi 2186 2187if test $cf_cv_lib_XCurses = yes ; then 2188 AC_DEFINE(UNIX,1,[Define to 1 if using PDCurses on Unix]) 2189 AC_DEFINE(XCURSES,1,[Define to 1 if using PDCurses on Unix]) 2190 AC_CHECK_HEADER(xcurses.h, AC_DEFINE(HAVE_XCURSES,1,[Define to 1 if using PDCurses on Unix])) 2191else 2192 AC_MSG_ERROR(Cannot link with XCurses) 2193fi 2194])dnl 2195dnl --------------------------------------------------------------------------- 2196dnl CF_PKG_CONFIG version: 10 updated: 2015/04/26 18:06:58 2197dnl ------------- 2198dnl Check for the package-config program, unless disabled by command-line. 2199AC_DEFUN([CF_PKG_CONFIG], 2200[ 2201AC_MSG_CHECKING(if you want to use pkg-config) 2202AC_ARG_WITH(pkg-config, 2203 [ --with-pkg-config{=path} enable/disable use of pkg-config], 2204 [cf_pkg_config=$withval], 2205 [cf_pkg_config=yes]) 2206AC_MSG_RESULT($cf_pkg_config) 2207 2208case $cf_pkg_config in 2209(no) 2210 PKG_CONFIG=none 2211 ;; 2212(yes) 2213 CF_ACVERSION_CHECK(2.52, 2214 [AC_PATH_TOOL(PKG_CONFIG, pkg-config, none)], 2215 [AC_PATH_PROG(PKG_CONFIG, pkg-config, none)]) 2216 ;; 2217(*) 2218 PKG_CONFIG=$withval 2219 ;; 2220esac 2221 2222test -z "$PKG_CONFIG" && PKG_CONFIG=none 2223if test "$PKG_CONFIG" != none ; then 2224 CF_PATH_SYNTAX(PKG_CONFIG) 2225elif test "x$cf_pkg_config" != xno ; then 2226 AC_MSG_WARN(pkg-config is not installed) 2227fi 2228 2229AC_SUBST(PKG_CONFIG) 2230])dnl 2231dnl --------------------------------------------------------------------------- 2232dnl CF_POSIX_C_SOURCE version: 9 updated: 2015/04/12 15:39:00 2233dnl ----------------- 2234dnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed. 2235dnl 2236dnl POSIX.1-1990 _POSIX_SOURCE 2237dnl POSIX.1-1990 and _POSIX_SOURCE and 2238dnl POSIX.2-1992 C-Language _POSIX_C_SOURCE=2 2239dnl Bindings Option 2240dnl POSIX.1b-1993 _POSIX_C_SOURCE=199309L 2241dnl POSIX.1c-1996 _POSIX_C_SOURCE=199506L 2242dnl X/Open 2000 _POSIX_C_SOURCE=200112L 2243dnl 2244dnl Parameters: 2245dnl $1 is the nominal value for _POSIX_C_SOURCE 2246AC_DEFUN([CF_POSIX_C_SOURCE], 2247[ 2248cf_POSIX_C_SOURCE=ifelse([$1],,199506L,[$1]) 2249 2250cf_save_CFLAGS="$CFLAGS" 2251cf_save_CPPFLAGS="$CPPFLAGS" 2252 2253CF_REMOVE_DEFINE(cf_trim_CFLAGS,$cf_save_CFLAGS,_POSIX_C_SOURCE) 2254CF_REMOVE_DEFINE(cf_trim_CPPFLAGS,$cf_save_CPPFLAGS,_POSIX_C_SOURCE) 2255 2256AC_CACHE_CHECK(if we should define _POSIX_C_SOURCE,cf_cv_posix_c_source,[ 2257 CF_MSG_LOG(if the symbol is already defined go no further) 2258 AC_TRY_COMPILE([#include <sys/types.h>],[ 2259#ifndef _POSIX_C_SOURCE 2260make an error 2261#endif], 2262 [cf_cv_posix_c_source=no], 2263 [cf_want_posix_source=no 2264 case .$cf_POSIX_C_SOURCE in 2265 (.[[12]]??*) 2266 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" 2267 ;; 2268 (.2) 2269 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" 2270 cf_want_posix_source=yes 2271 ;; 2272 (.*) 2273 cf_want_posix_source=yes 2274 ;; 2275 esac 2276 if test "$cf_want_posix_source" = yes ; then 2277 AC_TRY_COMPILE([#include <sys/types.h>],[ 2278#ifdef _POSIX_SOURCE 2279make an error 2280#endif],[], 2281 cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE") 2282 fi 2283 CF_MSG_LOG(ifdef from value $cf_POSIX_C_SOURCE) 2284 CFLAGS="$cf_trim_CFLAGS" 2285 CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source" 2286 CF_MSG_LOG(if the second compile does not leave our definition intact error) 2287 AC_TRY_COMPILE([#include <sys/types.h>],[ 2288#ifndef _POSIX_C_SOURCE 2289make an error 2290#endif],, 2291 [cf_cv_posix_c_source=no]) 2292 CFLAGS="$cf_save_CFLAGS" 2293 CPPFLAGS="$cf_save_CPPFLAGS" 2294 ]) 2295]) 2296 2297if test "$cf_cv_posix_c_source" != no ; then 2298 CFLAGS="$cf_trim_CFLAGS" 2299 CPPFLAGS="$cf_trim_CPPFLAGS" 2300 CF_ADD_CFLAGS($cf_cv_posix_c_source) 2301fi 2302 2303])dnl 2304dnl --------------------------------------------------------------------------- 2305dnl CF_PROG_CC version: 4 updated: 2014/07/12 18:57:58 2306dnl ---------- 2307dnl standard check for CC, plus followup sanity checks 2308dnl $1 = optional parameter to pass to AC_PROG_CC to specify compiler name 2309AC_DEFUN([CF_PROG_CC],[ 2310ifelse($1,,[AC_PROG_CC],[AC_PROG_CC($1)]) 2311CF_GCC_VERSION 2312CF_ACVERSION_CHECK(2.52, 2313 [AC_PROG_CC_STDC], 2314 [CF_ANSI_CC_REQD]) 2315CF_CC_ENV_FLAGS 2316])dnl 2317dnl --------------------------------------------------------------------------- 2318dnl CF_PROG_GROFF version: 3 updated: 2018/01/07 13:16:19 2319dnl ------------- 2320dnl Check if groff is available, for cases (such as html output) where nroff 2321dnl is not enough. 2322AC_DEFUN([CF_PROG_GROFF],[ 2323AC_PATH_PROG(GROFF_PATH,groff,no) 2324AC_PATH_PROGS(NROFF_PATH,nroff mandoc,no) 2325AC_PATH_PROG(TBL_PATH,tbl,cat) 2326if test "x$GROFF_PATH" = xno 2327then 2328 NROFF_NOTE= 2329 GROFF_NOTE="#" 2330else 2331 NROFF_NOTE="#" 2332 GROFF_NOTE= 2333fi 2334AC_SUBST(GROFF_NOTE) 2335AC_SUBST(NROFF_NOTE) 2336])dnl 2337dnl --------------------------------------------------------------------------- 2338dnl CF_PROG_LINT version: 3 updated: 2016/05/22 15:25:54 2339dnl ------------ 2340AC_DEFUN([CF_PROG_LINT], 2341[ 2342AC_CHECK_PROGS(LINT, lint cppcheck splint) 2343AC_SUBST(LINT_OPTS) 2344])dnl 2345dnl --------------------------------------------------------------------------- 2346dnl CF_REMOVE_DEFINE version: 3 updated: 2010/01/09 11:05:50 2347dnl ---------------- 2348dnl Remove all -U and -D options that refer to the given symbol from a list 2349dnl of C compiler options. This works around the problem that not all 2350dnl compilers process -U and -D options from left-to-right, so a -U option 2351dnl cannot be used to cancel the effect of a preceding -D option. 2352dnl 2353dnl $1 = target (which could be the same as the source variable) 2354dnl $2 = source (including '$') 2355dnl $3 = symbol to remove 2356define([CF_REMOVE_DEFINE], 2357[ 2358$1=`echo "$2" | \ 2359 sed -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[[ ]]/ /g' \ 2360 -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[$]//g'` 2361])dnl 2362dnl --------------------------------------------------------------------------- 2363dnl CF_SUBDIR_PATH version: 7 updated: 2014/12/04 04:33:06 2364dnl -------------- 2365dnl Construct a search-list for a nonstandard header/lib-file 2366dnl $1 = the variable to return as result 2367dnl $2 = the package name 2368dnl $3 = the subdirectory, e.g., bin, include or lib 2369AC_DEFUN([CF_SUBDIR_PATH], 2370[ 2371$1= 2372 2373CF_ADD_SUBDIR_PATH($1,$2,$3,$prefix,NONE) 2374 2375for cf_subdir_prefix in \ 2376 /usr \ 2377 /usr/local \ 2378 /usr/pkg \ 2379 /opt \ 2380 /opt/local \ 2381 [$]HOME 2382do 2383 CF_ADD_SUBDIR_PATH($1,$2,$3,$cf_subdir_prefix,$prefix) 2384done 2385])dnl 2386dnl --------------------------------------------------------------------------- 2387dnl CF_TERM_HEADER version: 4 updated: 2015/04/15 19:08:48 2388dnl -------------- 2389dnl Look for term.h, which is part of X/Open curses. It defines the interface 2390dnl to terminfo database. Usually it is in the same include-path as curses.h, 2391dnl but some packagers change this, breaking various applications. 2392AC_DEFUN([CF_TERM_HEADER],[ 2393AC_CACHE_CHECK(for terminfo header, cf_cv_term_header,[ 2394case ${cf_cv_ncurses_header} in 2395(*/ncurses.h|*/ncursesw.h) 2396 cf_term_header=`echo "$cf_cv_ncurses_header" | sed -e 's%ncurses[[^.]]*\.h$%term.h%'` 2397 ;; 2398(*) 2399 cf_term_header=term.h 2400 ;; 2401esac 2402 2403for cf_test in $cf_term_header "ncurses/term.h" "ncursesw/term.h" 2404do 2405AC_TRY_COMPILE([#include <stdio.h> 2406#include <${cf_cv_ncurses_header:-curses.h}> 2407#include <$cf_test> 2408],[int x = auto_left_margin],[ 2409 cf_cv_term_header="$cf_test"],[ 2410 cf_cv_term_header=unknown 2411 ]) 2412 test "$cf_cv_term_header" != unknown && break 2413done 2414]) 2415 2416# Set definitions to allow ifdef'ing to accommodate subdirectories 2417 2418case $cf_cv_term_header in 2419(*term.h) 2420 AC_DEFINE(HAVE_TERM_H,1,[Define to 1 if we have term.h]) 2421 ;; 2422esac 2423 2424case $cf_cv_term_header in 2425(ncurses/term.h) 2426 AC_DEFINE(HAVE_NCURSES_TERM_H,1,[Define to 1 if we have ncurses/term.h]) 2427 ;; 2428(ncursesw/term.h) 2429 AC_DEFINE(HAVE_NCURSESW_TERM_H,1,[Define to 1 if we have ncursesw/term.h]) 2430 ;; 2431esac 2432])dnl 2433dnl --------------------------------------------------------------------------- 2434dnl CF_TRIM_X_LIBS version: 3 updated: 2015/04/12 15:39:00 2435dnl -------------- 2436dnl Trim extra base X libraries added as a workaround for inconsistent library 2437dnl dependencies returned by "new" pkg-config files. 2438AC_DEFUN([CF_TRIM_X_LIBS],[ 2439 for cf_trim_lib in Xmu Xt X11 2440 do 2441 case "$LIBS" in 2442 (*-l$cf_trim_lib\ *-l$cf_trim_lib*) 2443 LIBS=`echo "$LIBS " | sed -e 's/ / /g' -e 's%-l'"$cf_trim_lib"' %%' -e 's/ $//'` 2444 CF_VERBOSE(..trimmed $LIBS) 2445 ;; 2446 esac 2447 done 2448]) 2449dnl --------------------------------------------------------------------------- 2450dnl CF_TRY_PKG_CONFIG version: 5 updated: 2013/07/06 21:27:06 2451dnl ----------------- 2452dnl This is a simple wrapper to use for pkg-config, for libraries which may be 2453dnl available in that form. 2454dnl 2455dnl $1 = package name 2456dnl $2 = extra logic to use, if any, after updating CFLAGS and LIBS 2457dnl $3 = logic to use if pkg-config does not have the package 2458AC_DEFUN([CF_TRY_PKG_CONFIG],[ 2459AC_REQUIRE([CF_PKG_CONFIG]) 2460 2461if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists $1; then 2462 CF_VERBOSE(found package $1) 2463 cf_pkgconfig_incs="`$PKG_CONFIG --cflags $1 2>/dev/null`" 2464 cf_pkgconfig_libs="`$PKG_CONFIG --libs $1 2>/dev/null`" 2465 CF_VERBOSE(package $1 CFLAGS: $cf_pkgconfig_incs) 2466 CF_VERBOSE(package $1 LIBS: $cf_pkgconfig_libs) 2467 CF_ADD_CFLAGS($cf_pkgconfig_incs) 2468 CF_ADD_LIBS($cf_pkgconfig_libs) 2469 ifelse([$2],,:,[$2]) 2470else 2471 cf_pkgconfig_incs= 2472 cf_pkgconfig_libs= 2473 ifelse([$3],,:,[$3]) 2474fi 2475]) 2476dnl --------------------------------------------------------------------------- 2477dnl CF_TRY_XOPEN_SOURCE version: 1 updated: 2011/10/30 17:09:50 2478dnl ------------------- 2479dnl If _XOPEN_SOURCE is not defined in the compile environment, check if we 2480dnl can define it successfully. 2481AC_DEFUN([CF_TRY_XOPEN_SOURCE],[ 2482AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[ 2483 AC_TRY_COMPILE([ 2484#include <stdlib.h> 2485#include <string.h> 2486#include <sys/types.h> 2487],[ 2488#ifndef _XOPEN_SOURCE 2489make an error 2490#endif], 2491 [cf_cv_xopen_source=no], 2492 [cf_save="$CPPFLAGS" 2493 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" 2494 AC_TRY_COMPILE([ 2495#include <stdlib.h> 2496#include <string.h> 2497#include <sys/types.h> 2498],[ 2499#ifdef _XOPEN_SOURCE 2500make an error 2501#endif], 2502 [cf_cv_xopen_source=no], 2503 [cf_cv_xopen_source=$cf_XOPEN_SOURCE]) 2504 CPPFLAGS="$cf_save" 2505 ]) 2506]) 2507 2508if test "$cf_cv_xopen_source" != no ; then 2509 CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE) 2510 CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE) 2511 cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source" 2512 CF_ADD_CFLAGS($cf_temp_xopen_source) 2513fi 2514]) 2515dnl --------------------------------------------------------------------------- 2516dnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59 2517dnl -------- 2518dnl Make an uppercase version of a variable 2519dnl $1=uppercase($2) 2520AC_DEFUN([CF_UPPER], 2521[ 2522$1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` 2523])dnl 2524dnl --------------------------------------------------------------------------- 2525dnl CF_UTF8_LIB version: 8 updated: 2012/10/06 08:57:51 2526dnl ----------- 2527dnl Check for multibyte support, and if not found, utf8 compatibility library 2528AC_DEFUN([CF_UTF8_LIB], 2529[ 2530AC_CACHE_CHECK(for multibyte character support,cf_cv_utf8_lib,[ 2531 cf_save_LIBS="$LIBS" 2532 AC_TRY_LINK([ 2533#include <stdlib.h>],[putwc(0,0);], 2534 [cf_cv_utf8_lib=yes], 2535 [CF_FIND_LINKAGE([ 2536#include <libutf8.h>],[putwc(0,0);],utf8, 2537 [cf_cv_utf8_lib=add-on], 2538 [cf_cv_utf8_lib=no]) 2539])]) 2540 2541# HAVE_LIBUTF8_H is used by ncurses if curses.h is shared between 2542# ncurses/ncursesw: 2543if test "$cf_cv_utf8_lib" = "add-on" ; then 2544 AC_DEFINE(HAVE_LIBUTF8_H,1,[Define to 1 if we should include libutf8.h]) 2545 CF_ADD_INCDIR($cf_cv_header_path_utf8) 2546 CF_ADD_LIBDIR($cf_cv_library_path_utf8) 2547 CF_ADD_LIBS($cf_cv_library_file_utf8) 2548fi 2549])dnl 2550dnl --------------------------------------------------------------------------- 2551dnl CF_VERBOSE version: 3 updated: 2007/07/29 09:55:12 2552dnl ---------- 2553dnl Use AC_VERBOSE w/o the warnings 2554AC_DEFUN([CF_VERBOSE], 2555[test -n "$verbose" && echo " $1" 1>&AC_FD_MSG 2556CF_MSG_LOG([$1]) 2557])dnl 2558dnl --------------------------------------------------------------------------- 2559dnl CF_WITH_CURSES_DIR version: 3 updated: 2010/11/20 17:02:38 2560dnl ------------------ 2561dnl Wrapper for AC_ARG_WITH to specify directory under which to look for curses 2562dnl libraries. 2563AC_DEFUN([CF_WITH_CURSES_DIR],[ 2564 2565AC_MSG_CHECKING(for specific curses-directory) 2566AC_ARG_WITH(curses-dir, 2567 [ --with-curses-dir=DIR directory in which (n)curses is installed], 2568 [cf_cv_curses_dir=$withval], 2569 [cf_cv_curses_dir=no]) 2570AC_MSG_RESULT($cf_cv_curses_dir) 2571 2572if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" ) 2573then 2574 CF_PATH_SYNTAX(withval) 2575 if test -d "$cf_cv_curses_dir" 2576 then 2577 CF_ADD_INCDIR($cf_cv_curses_dir/include) 2578 CF_ADD_LIBDIR($cf_cv_curses_dir/lib) 2579 fi 2580fi 2581])dnl 2582dnl --------------------------------------------------------------------------- 2583dnl CF_WITH_DBMALLOC version: 7 updated: 2010/06/21 17:26:47 2584dnl ---------------- 2585dnl Configure-option for dbmalloc. The optional parameter is used to override 2586dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests. 2587AC_DEFUN([CF_WITH_DBMALLOC],[ 2588CF_NO_LEAKS_OPTION(dbmalloc, 2589 [ --with-dbmalloc test: use Conor Cahill's dbmalloc library], 2590 [USE_DBMALLOC]) 2591 2592if test "$with_dbmalloc" = yes ; then 2593 AC_CHECK_HEADER(dbmalloc.h, 2594 [AC_CHECK_LIB(dbmalloc,[debug_malloc]ifelse([$1],,[],[,$1]))]) 2595fi 2596])dnl 2597dnl --------------------------------------------------------------------------- 2598dnl CF_WITH_DMALLOC version: 7 updated: 2010/06/21 17:26:47 2599dnl --------------- 2600dnl Configure-option for dmalloc. The optional parameter is used to override 2601dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests. 2602AC_DEFUN([CF_WITH_DMALLOC],[ 2603CF_NO_LEAKS_OPTION(dmalloc, 2604 [ --with-dmalloc test: use Gray Watson's dmalloc library], 2605 [USE_DMALLOC]) 2606 2607if test "$with_dmalloc" = yes ; then 2608 AC_CHECK_HEADER(dmalloc.h, 2609 [AC_CHECK_LIB(dmalloc,[dmalloc_debug]ifelse([$1],,[],[,$1]))]) 2610fi 2611])dnl 2612dnl --------------------------------------------------------------------------- 2613dnl CF_WITH_MAN2HTML version: 7 updated: 2018/01/07 13:16:19 2614dnl ---------------- 2615dnl Check for man2html and groff. Prefer man2html over groff, but use groff 2616dnl as a fallback. See 2617dnl 2618dnl http://invisible-island.net/scripts/man2html.html 2619dnl 2620dnl Generate a shell script which hides the differences between the two. 2621dnl 2622dnl We name that "man2html.tmp". 2623dnl 2624dnl The shell script can be removed later, e.g., using "make distclean". 2625AC_DEFUN([CF_WITH_MAN2HTML],[ 2626AC_REQUIRE([CF_PROG_GROFF]) 2627 2628case "x${with_man2html}" in 2629(xno) 2630 cf_man2html=no 2631 ;; 2632(x|xyes) 2633 AC_PATH_PROG(cf_man2html,man2html,no) 2634 case "x$cf_man2html" in 2635 (x/*) 2636 AC_MSG_CHECKING(for the modified Earl Hood script) 2637 if ( $cf_man2html -help 2>&1 | grep 'Make an index of headers at the end' >/dev/null ) 2638 then 2639 cf_man2html_ok=yes 2640 else 2641 cf_man2html=no 2642 cf_man2html_ok=no 2643 fi 2644 AC_MSG_RESULT($cf_man2html_ok) 2645 ;; 2646 (*) 2647 cf_man2html=no 2648 ;; 2649 esac 2650esac 2651 2652AC_MSG_CHECKING(for program to convert manpage to html) 2653AC_ARG_WITH(man2html, 2654 [ --with-man2html=XXX use XXX rather than groff], 2655 [cf_man2html=$withval], 2656 [cf_man2html=$cf_man2html]) 2657 2658cf_with_groff=no 2659 2660case $cf_man2html in 2661(yes) 2662 AC_MSG_RESULT(man2html) 2663 AC_PATH_PROG(cf_man2html,man2html,no) 2664 ;; 2665(no|groff|*/groff*) 2666 cf_with_groff=yes 2667 cf_man2html=$GROFF_PATH 2668 AC_MSG_RESULT($cf_man2html) 2669 ;; 2670(*) 2671 AC_MSG_RESULT($cf_man2html) 2672 ;; 2673esac 2674 2675MAN2HTML_TEMP="man2html.tmp" 2676 cat >$MAN2HTML_TEMP <<CF_EOF 2677#!$SHELL 2678# Temporary script generated by CF_WITH_MAN2HTML 2679# Convert inputs to html, sending result to standard output. 2680# 2681# Parameters: 2682# \${1} = rootname of file to convert 2683# \${2} = suffix of file to convert, e.g., "1" 2684# \${3} = macros to use, e.g., "man" 2685# 2686ROOT=\[$]1 2687TYPE=\[$]2 2688MACS=\[$]3 2689 2690unset LANG 2691unset LC_ALL 2692unset LC_CTYPE 2693unset LANGUAGE 2694GROFF_NO_SGR=stupid 2695export GROFF_NO_SGR 2696 2697CF_EOF 2698 2699if test "x$cf_with_groff" = xyes 2700then 2701 MAN2HTML_NOTE="$GROFF_NOTE" 2702 MAN2HTML_PATH="$GROFF_PATH" 2703 cat >>$MAN2HTML_TEMP <<CF_EOF 2704$SHELL -c "$TBL_PATH \${ROOT}.\${TYPE} | $GROFF_PATH -P -o0 -I\${ROOT}_ -Thtml -\${MACS}" 2705CF_EOF 2706else 2707 MAN2HTML_NOTE="" 2708 CF_PATH_SYNTAX(cf_man2html) 2709 MAN2HTML_PATH="$cf_man2html" 2710 AC_MSG_CHECKING(for $cf_man2html top/bottom margins) 2711 2712 # for this example, expect 3 lines of content, the remainder is head/foot 2713 cat >conftest.in <<CF_EOF 2714.TH HEAD1 HEAD2 HEAD3 HEAD4 HEAD5 2715.SH SECTION 2716MARKER 2717CF_EOF 2718 2719 LC_ALL=C LC_CTYPE=C LANG=C LANGUAGE=C $NROFF_PATH -man conftest.in >conftest.out 2720 2721 cf_man2html_1st=`fgrep -n MARKER conftest.out |sed -e 's/^[[^0-9]]*://' -e 's/:.*//'` 2722 cf_man2html_top=`expr $cf_man2html_1st - 2` 2723 cf_man2html_bot=`wc -l conftest.out |sed -e 's/[[^0-9]]//g'` 2724 cf_man2html_bot=`expr $cf_man2html_bot - 2 - $cf_man2html_top` 2725 cf_man2html_top_bot="-topm=$cf_man2html_top -botm=$cf_man2html_bot" 2726 2727 AC_MSG_RESULT($cf_man2html_top_bot) 2728 2729 AC_MSG_CHECKING(for pagesize to use) 2730 for cf_block in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2731 do 2732 cat >>conftest.in <<CF_EOF 2733.nf 27340 27351 27362 27373 27384 27395 27406 27417 27428 27439 2744CF_EOF 2745 done 2746 2747 LC_ALL=C LC_CTYPE=C LANG=C LANGUAGE=C $NROFF_PATH -man conftest.in >conftest.out 2748 cf_man2html_page=`fgrep -n HEAD1 conftest.out |tail -n 1 |sed -e 's/^[[^0-9]]*://' -e 's/:.*//'` 2749 test -z "$cf_man2html_page" && cf_man2html_page=99999 2750 test "$cf_man2html_page" -gt 100 && cf_man2html_page=99999 2751 2752 rm -rf conftest* 2753 AC_MSG_RESULT($cf_man2html_page) 2754 2755 cat >>$MAN2HTML_TEMP <<CF_EOF 2756: \${MAN2HTML_PATH=$MAN2HTML_PATH} 2757MAN2HTML_OPTS="\$MAN2HTML_OPTS -index -title="\$ROOT\(\$TYPE\)" -compress -pgsize $cf_man2html_page" 2758case \${TYPE} in 2759(ms) 2760 $TBL_PATH \${ROOT}.\${TYPE} | $NROFF_PATH -\${MACS} | \$MAN2HTML_PATH -topm=0 -botm=0 \$MAN2HTML_OPTS 2761 ;; 2762(*) 2763 $TBL_PATH \${ROOT}.\${TYPE} | $NROFF_PATH -\${MACS} | \$MAN2HTML_PATH $cf_man2html_top_bot \$MAN2HTML_OPTS 2764 ;; 2765esac 2766CF_EOF 2767fi 2768 2769chmod 700 $MAN2HTML_TEMP 2770 2771AC_SUBST(MAN2HTML_NOTE) 2772AC_SUBST(MAN2HTML_PATH) 2773AC_SUBST(MAN2HTML_TEMP) 2774])dnl 2775dnl --------------------------------------------------------------------------- 2776dnl CF_WITH_NCURSES_ETC version: 5 updated: 2016/02/20 19:23:20 2777dnl ------------------- 2778dnl Use this macro for programs which use any variant of "curses", e.g., 2779dnl "ncurses", and "PDCurses". Programs that can use curses and some unrelated 2780dnl library (such as slang) should use a "--with-screen=XXX" option. 2781dnl 2782dnl This does not use AC_DEFUN, because that would tell autoconf to run each 2783dnl of the macros inside this one - before this macro. 2784define([CF_WITH_NCURSES_ETC],[ 2785CF_WITH_CURSES_DIR 2786 2787cf_cv_screen=curses 2788 2789AC_MSG_CHECKING(for specified curses library type) 2790AC_ARG_WITH(screen, 2791 [ --with-screen=XXX use specified curses-libraries], 2792 [cf_cv_screen=$withval],[ 2793 2794AC_ARG_WITH(ncursesw, 2795 [ --with-ncursesw use wide ncurses-libraries], 2796 [cf_cv_screen=ncursesw],[ 2797 2798AC_ARG_WITH(ncurses, 2799 [ --with-ncurses use ncurses-libraries], 2800 [cf_cv_screen=ncurses],[ 2801 2802AC_ARG_WITH(pdcurses, 2803 [ --with-pdcurses compile/link with pdcurses X11 library], 2804 [cf_cv_screen=pdcurses],[ 2805 2806AC_ARG_WITH(curses-colr, 2807 [ --with-curses-colr compile/link with HPUX 10.x color-curses], 2808 [cf_cv_screen=curses_colr],[ 2809 2810AC_ARG_WITH(curses-5lib, 2811 [ --with-curses-5lib compile/link with SunOS 5lib curses], 2812 [cf_cv_screen=curses_5lib])])])])])]) 2813 2814AC_MSG_RESULT($cf_cv_screen) 2815 2816case $cf_cv_screen in 2817(curses|curses_*) 2818 CF_CURSES_CONFIG 2819 ;; 2820(ncursesw*) 2821 CF_UTF8_LIB 2822 CF_NCURSES_CONFIG($cf_cv_screen) 2823 ;; 2824(ncurses*) 2825 CF_NCURSES_CONFIG($cf_cv_screen) 2826 ;; 2827(pdcurses) 2828 CF_PDCURSES_X11 2829 ;; 2830(*) 2831 AC_MSG_ERROR(unexpected screen-value: $cf_cv_screen) 2832 ;; 2833esac 2834 2835CF_NCURSES_PTHREADS($cf_cv_screen) 2836 2837])dnl 2838dnl --------------------------------------------------------------------------- 2839dnl CF_WITH_VALGRIND version: 1 updated: 2006/12/14 18:00:21 2840dnl ---------------- 2841AC_DEFUN([CF_WITH_VALGRIND],[ 2842CF_NO_LEAKS_OPTION(valgrind, 2843 [ --with-valgrind test: use valgrind], 2844 [USE_VALGRIND]) 2845])dnl 2846dnl --------------------------------------------------------------------------- 2847dnl CF_XOPEN_CURSES version: 13 updated: 2015/12/12 20:59:52 2848dnl --------------- 2849dnl Test if we should define X/Open source for curses, needed on Digital Unix 2850dnl 4.x, to see the extended functions, but breaks on IRIX 6.x. 2851dnl 2852dnl The getbegyx() check is needed for HPUX, which omits legacy macros such 2853dnl as getbegy(). The latter is better design, but the former is standard. 2854AC_DEFUN([CF_XOPEN_CURSES], 2855[ 2856AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl 2857AC_CACHE_CHECK(definition to turn on extended curses functions,cf_cv_need_xopen_extension,[ 2858cf_cv_need_xopen_extension=unknown 2859AC_TRY_LINK([ 2860#include <stdlib.h> 2861#include <${cf_cv_ncurses_header:-curses.h}>],[ 2862#if defined(NCURSES_VERSION_PATCH) 2863#if (NCURSES_VERSION_PATCH < 20100501) && (NCURSES_VERSION_PATCH >= 20100403) 2864 make an error 2865#endif 2866#endif 2867#ifdef NCURSES_VERSION 2868 cchar_t check; 2869 int check2 = curs_set((int)sizeof(check)); 2870#endif 2871 long x = winnstr(stdscr, "", 0); 2872 int x1, y1; 2873 getbegyx(stdscr, y1, x1)], 2874 [cf_cv_need_xopen_extension=none], 2875 [ 2876 for cf_try_xopen_extension in _XOPEN_SOURCE_EXTENDED NCURSES_WIDECHAR 2877 do 2878 AC_TRY_LINK([ 2879#define $cf_try_xopen_extension 1 2880#include <stdlib.h> 2881#include <${cf_cv_ncurses_header:-curses.h}>],[ 2882#ifdef NCURSES_VERSION 2883 cchar_t check; 2884 int check2 = curs_set((int)sizeof(check)); 2885#endif 2886 long x = winnstr(stdscr, "", 0); 2887 int x1, y1; 2888 getbegyx(stdscr, y1, x1)], 2889 [cf_cv_need_xopen_extension=$cf_try_xopen_extension; break]) 2890 done 2891 ]) 2892]) 2893 2894case $cf_cv_need_xopen_extension in 2895(*_*) 2896 CPPFLAGS="$CPPFLAGS -D$cf_cv_need_xopen_extension" 2897 ;; 2898esac 2899 2900])dnl 2901dnl --------------------------------------------------------------------------- 2902dnl CF_XOPEN_SOURCE version: 52 updated: 2016/08/27 12:21:42 2903dnl --------------- 2904dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions, 2905dnl or adapt to the vendor's definitions to get equivalent functionality, 2906dnl without losing the common non-POSIX features. 2907dnl 2908dnl Parameters: 2909dnl $1 is the nominal value for _XOPEN_SOURCE 2910dnl $2 is the nominal value for _POSIX_C_SOURCE 2911AC_DEFUN([CF_XOPEN_SOURCE],[ 2912AC_REQUIRE([AC_CANONICAL_HOST]) 2913 2914cf_XOPEN_SOURCE=ifelse([$1],,500,[$1]) 2915cf_POSIX_C_SOURCE=ifelse([$2],,199506L,[$2]) 2916cf_xopen_source= 2917 2918case $host_os in 2919(aix[[4-7]]*) 2920 cf_xopen_source="-D_ALL_SOURCE" 2921 ;; 2922(msys) 2923 cf_XOPEN_SOURCE=600 2924 ;; 2925(darwin[[0-8]].*) 2926 cf_xopen_source="-D_APPLE_C_SOURCE" 2927 ;; 2928(darwin*) 2929 cf_xopen_source="-D_DARWIN_C_SOURCE" 2930 cf_XOPEN_SOURCE= 2931 ;; 2932(freebsd*|dragonfly*) 2933 # 5.x headers associate 2934 # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L 2935 # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L 2936 cf_POSIX_C_SOURCE=200112L 2937 cf_XOPEN_SOURCE=600 2938 cf_xopen_source="-D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" 2939 ;; 2940(hpux11*) 2941 cf_xopen_source="-D_HPUX_SOURCE -D_XOPEN_SOURCE=500" 2942 ;; 2943(hpux*) 2944 cf_xopen_source="-D_HPUX_SOURCE" 2945 ;; 2946(irix[[56]].*) 2947 cf_xopen_source="-D_SGI_SOURCE" 2948 cf_XOPEN_SOURCE= 2949 ;; 2950(linux*|uclinux*|gnu*|mint*|k*bsd*-gnu|cygwin) 2951 CF_GNU_SOURCE 2952 ;; 2953(minix*) 2954 cf_xopen_source="-D_NETBSD_SOURCE" # POSIX.1-2001 features are ifdef'd with this... 2955 ;; 2956(mirbsd*) 2957 # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <sys/select.h> and other headers which use u_int / u_short types 2958 cf_XOPEN_SOURCE= 2959 CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE) 2960 ;; 2961(netbsd*) 2962 cf_xopen_source="-D_NETBSD_SOURCE" # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw 2963 ;; 2964(openbsd[[4-9]]*) 2965 # setting _XOPEN_SOURCE lower than 500 breaks g++ compile with wchar.h, needed for ncursesw 2966 cf_xopen_source="-D_BSD_SOURCE" 2967 cf_XOPEN_SOURCE=600 2968 ;; 2969(openbsd*) 2970 # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw 2971 ;; 2972(osf[[45]]*) 2973 cf_xopen_source="-D_OSF_SOURCE" 2974 ;; 2975(nto-qnx*) 2976 cf_xopen_source="-D_QNX_SOURCE" 2977 ;; 2978(sco*) 2979 # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer 2980 ;; 2981(solaris2.*) 2982 cf_xopen_source="-D__EXTENSIONS__" 2983 cf_cv_xopen_source=broken 2984 ;; 2985(sysv4.2uw2.*) # Novell/SCO UnixWare 2.x (tested on 2.1.2) 2986 cf_XOPEN_SOURCE= 2987 cf_POSIX_C_SOURCE= 2988 ;; 2989(*) 2990 CF_TRY_XOPEN_SOURCE 2991 CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE) 2992 ;; 2993esac 2994 2995if test -n "$cf_xopen_source" ; then 2996 CF_ADD_CFLAGS($cf_xopen_source,true) 2997fi 2998 2999dnl In anything but the default case, we may have system-specific setting 3000dnl which is still not guaranteed to provide all of the entrypoints that 3001dnl _XOPEN_SOURCE would yield. 3002if test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then 3003 AC_MSG_CHECKING(if _XOPEN_SOURCE really is set) 3004 AC_TRY_COMPILE([#include <stdlib.h>],[ 3005#ifndef _XOPEN_SOURCE 3006make an error 3007#endif], 3008 [cf_XOPEN_SOURCE_set=yes], 3009 [cf_XOPEN_SOURCE_set=no]) 3010 AC_MSG_RESULT($cf_XOPEN_SOURCE_set) 3011 if test $cf_XOPEN_SOURCE_set = yes 3012 then 3013 AC_TRY_COMPILE([#include <stdlib.h>],[ 3014#if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE 3015make an error 3016#endif], 3017 [cf_XOPEN_SOURCE_set_ok=yes], 3018 [cf_XOPEN_SOURCE_set_ok=no]) 3019 if test $cf_XOPEN_SOURCE_set_ok = no 3020 then 3021 AC_MSG_WARN(_XOPEN_SOURCE is lower than requested) 3022 fi 3023 else 3024 CF_TRY_XOPEN_SOURCE 3025 fi 3026fi 3027]) 3028dnl --------------------------------------------------------------------------- 3029dnl CF_X_ATHENA version: 23 updated: 2015/04/12 15:39:00 3030dnl ----------- 3031dnl Check for Xaw (Athena) libraries 3032dnl 3033dnl Sets $cf_x_athena according to the flavor of Xaw which is used. 3034AC_DEFUN([CF_X_ATHENA], 3035[ 3036cf_x_athena=${cf_x_athena:-Xaw} 3037 3038AC_MSG_CHECKING(if you want to link with Xaw 3d library) 3039withval= 3040AC_ARG_WITH(Xaw3d, 3041 [ --with-Xaw3d link with Xaw 3d library]) 3042if test "$withval" = yes ; then 3043 cf_x_athena=Xaw3d 3044 AC_MSG_RESULT(yes) 3045else 3046 AC_MSG_RESULT(no) 3047fi 3048 3049AC_MSG_CHECKING(if you want to link with Xaw 3d xft library) 3050withval= 3051AC_ARG_WITH(Xaw3dxft, 3052 [ --with-Xaw3dxft link with Xaw 3d xft library]) 3053if test "$withval" = yes ; then 3054 cf_x_athena=Xaw3dxft 3055 AC_MSG_RESULT(yes) 3056else 3057 AC_MSG_RESULT(no) 3058fi 3059 3060AC_MSG_CHECKING(if you want to link with neXT Athena library) 3061withval= 3062AC_ARG_WITH(neXtaw, 3063 [ --with-neXtaw link with neXT Athena library]) 3064if test "$withval" = yes ; then 3065 cf_x_athena=neXtaw 3066 AC_MSG_RESULT(yes) 3067else 3068 AC_MSG_RESULT(no) 3069fi 3070 3071AC_MSG_CHECKING(if you want to link with Athena-Plus library) 3072withval= 3073AC_ARG_WITH(XawPlus, 3074 [ --with-XawPlus link with Athena-Plus library]) 3075if test "$withval" = yes ; then 3076 cf_x_athena=XawPlus 3077 AC_MSG_RESULT(yes) 3078else 3079 AC_MSG_RESULT(no) 3080fi 3081 3082cf_x_athena_lib="" 3083 3084if test "$PKG_CONFIG" != none ; then 3085 cf_athena_list= 3086 test "$cf_x_athena" = Xaw && cf_athena_list="xaw8 xaw7 xaw6" 3087 for cf_athena_pkg in \ 3088 $cf_athena_list \ 3089 ${cf_x_athena} \ 3090 ${cf_x_athena}-devel \ 3091 lib${cf_x_athena} \ 3092 lib${cf_x_athena}-devel 3093 do 3094 CF_TRY_PKG_CONFIG($cf_athena_pkg,[ 3095 cf_x_athena_lib="$cf_pkgconfig_libs" 3096 CF_UPPER(cf_x_athena_LIBS,HAVE_LIB_$cf_x_athena) 3097 AC_DEFINE_UNQUOTED($cf_x_athena_LIBS) 3098 3099 CF_TRIM_X_LIBS 3100 3101AC_CACHE_CHECK(for usable $cf_x_athena/Xmu package,cf_cv_xaw_compat,[ 3102AC_TRY_LINK([ 3103#include <X11/Xmu/CharSet.h> 3104],[ 3105int check = XmuCompareISOLatin1("big", "small") 3106],[cf_cv_xaw_compat=yes],[cf_cv_xaw_compat=no])]) 3107 3108 if test "$cf_cv_xaw_compat" = no 3109 then 3110 # workaround for broken ".pc" files... 3111 case "$cf_x_athena_lib" in 3112 (*-lXmu*) 3113 ;; 3114 (*) 3115 CF_VERBOSE(work around broken package) 3116 cf_save_xmu="$LIBS" 3117 cf_first_lib=`echo "$cf_save_xmu" | sed -e 's/^[ ][ ]*//' -e 's/ .*//'` 3118 CF_TRY_PKG_CONFIG(xmu,[ 3119 LIBS="$cf_save_xmu" 3120 CF_ADD_LIB_AFTER($cf_first_lib,$cf_pkgconfig_libs) 3121 ],[ 3122 CF_ADD_LIB_AFTER($cf_first_lib,-lXmu) 3123 ]) 3124 CF_TRIM_X_LIBS 3125 ;; 3126 esac 3127 fi 3128 3129 break]) 3130 done 3131fi 3132 3133if test -z "$cf_x_athena_lib" ; then 3134 CF_X_EXT 3135 CF_X_TOOLKIT 3136 CF_X_ATHENA_CPPFLAGS($cf_x_athena) 3137 CF_X_ATHENA_LIBS($cf_x_athena) 3138fi 3139])dnl 3140dnl --------------------------------------------------------------------------- 3141dnl CF_X_ATHENA_CPPFLAGS version: 5 updated: 2010/05/26 17:35:30 3142dnl -------------------- 3143dnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of 3144dnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw. 3145AC_DEFUN([CF_X_ATHENA_CPPFLAGS], 3146[ 3147cf_x_athena_root=ifelse([$1],,Xaw,[$1]) 3148cf_x_athena_inc="" 3149 3150for cf_path in default \ 3151 /usr/contrib/X11R6 \ 3152 /usr/contrib/X11R5 \ 3153 /usr/lib/X11R5 \ 3154 /usr/local 3155do 3156 if test -z "$cf_x_athena_inc" ; then 3157 cf_save="$CPPFLAGS" 3158 cf_test=X11/$cf_x_athena_root/SimpleMenu.h 3159 if test $cf_path != default ; then 3160 CPPFLAGS="$cf_save -I$cf_path/include" 3161 AC_MSG_CHECKING(for $cf_test in $cf_path) 3162 else 3163 AC_MSG_CHECKING(for $cf_test) 3164 fi 3165 AC_TRY_COMPILE([ 3166#include <X11/Intrinsic.h> 3167#include <$cf_test>],[], 3168 [cf_result=yes], 3169 [cf_result=no]) 3170 AC_MSG_RESULT($cf_result) 3171 if test "$cf_result" = yes ; then 3172 cf_x_athena_inc=$cf_path 3173 break 3174 else 3175 CPPFLAGS="$cf_save" 3176 fi 3177 fi 3178done 3179 3180if test -z "$cf_x_athena_inc" ; then 3181 AC_MSG_WARN( 3182[Unable to successfully find Athena header files with test program]) 3183elif test "$cf_x_athena_inc" != default ; then 3184 CPPFLAGS="$CPPFLAGS -I$cf_x_athena_inc" 3185fi 3186]) 3187dnl --------------------------------------------------------------------------- 3188dnl CF_X_ATHENA_LIBS version: 12 updated: 2011/07/17 19:55:02 3189dnl ---------------- 3190dnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of 3191dnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw. 3192AC_DEFUN([CF_X_ATHENA_LIBS], 3193[AC_REQUIRE([CF_X_TOOLKIT]) 3194cf_x_athena_root=ifelse([$1],,Xaw,[$1]) 3195cf_x_athena_lib="" 3196 3197for cf_path in default \ 3198 /usr/contrib/X11R6 \ 3199 /usr/contrib/X11R5 \ 3200 /usr/lib/X11R5 \ 3201 /usr/local 3202do 3203 for cf_lib in \ 3204 ${cf_x_athena_root} \ 3205 ${cf_x_athena_root}7 \ 3206 ${cf_x_athena_root}6 3207 do 3208 for cf_libs in \ 3209 "-l$cf_lib -lXmu" \ 3210 "-l$cf_lib -lXpm -lXmu" \ 3211 "-l${cf_lib}_s -lXmu_s" 3212 do 3213 if test -z "$cf_x_athena_lib" ; then 3214 cf_save="$LIBS" 3215 cf_test=XawSimpleMenuAddGlobalActions 3216 if test $cf_path != default ; then 3217 CF_ADD_LIBS(-L$cf_path/lib $cf_libs) 3218 AC_MSG_CHECKING(for $cf_libs in $cf_path) 3219 else 3220 CF_ADD_LIBS($cf_libs) 3221 AC_MSG_CHECKING(for $cf_test in $cf_libs) 3222 fi 3223 AC_TRY_LINK([ 3224#include <X11/Intrinsic.h> 3225#include <X11/$cf_x_athena_root/SimpleMenu.h> 3226],[ 3227$cf_test((XtAppContext) 0)], 3228 [cf_result=yes], 3229 [cf_result=no]) 3230 AC_MSG_RESULT($cf_result) 3231 if test "$cf_result" = yes ; then 3232 cf_x_athena_lib="$cf_libs" 3233 break 3234 fi 3235 LIBS="$cf_save" 3236 fi 3237 done # cf_libs 3238 test -n "$cf_x_athena_lib" && break 3239 done # cf_lib 3240done 3241 3242if test -z "$cf_x_athena_lib" ; then 3243 AC_MSG_ERROR( 3244[Unable to successfully link Athena library (-l$cf_x_athena_root) with test program]) 3245fi 3246 3247CF_UPPER(cf_x_athena_LIBS,HAVE_LIB_$cf_x_athena) 3248AC_DEFINE_UNQUOTED($cf_x_athena_LIBS) 3249]) 3250dnl --------------------------------------------------------------------------- 3251dnl CF_X_EXT version: 3 updated: 2010/06/02 05:03:05 3252dnl -------- 3253AC_DEFUN([CF_X_EXT],[ 3254CF_TRY_PKG_CONFIG(Xext,,[ 3255 AC_CHECK_LIB(Xext,XextCreateExtension, 3256 [CF_ADD_LIB(Xext)])]) 3257])dnl 3258dnl --------------------------------------------------------------------------- 3259dnl CF_X_TOOLKIT version: 23 updated: 2015/04/12 15:39:00 3260dnl ------------ 3261dnl Check for X Toolkit libraries 3262AC_DEFUN([CF_X_TOOLKIT], 3263[ 3264AC_REQUIRE([AC_PATH_XTRA]) 3265AC_REQUIRE([CF_CHECK_CACHE]) 3266 3267# OSX is schizoid about who owns /usr/X11 (old) versus /opt/X11 (new), and (and 3268# in some cases has installed dummy files in the former, other cases replaced 3269# it with a link to the new location). This complicates the configure script. 3270# Check for that pitfall, and recover using pkg-config 3271# 3272# If none of these are set, the configuration is almost certainly broken. 3273if test -z "${X_CFLAGS}${X_PRE_LIBS}${X_LIBS}${X_EXTRA_LIBS}" 3274then 3275 CF_TRY_PKG_CONFIG(x11,,[AC_MSG_WARN(unable to find X11 library)]) 3276 CF_TRY_PKG_CONFIG(ice,,[AC_MSG_WARN(unable to find ICE library)]) 3277 CF_TRY_PKG_CONFIG(sm,,[AC_MSG_WARN(unable to find SM library)]) 3278 CF_TRY_PKG_CONFIG(xt,,[AC_MSG_WARN(unable to find Xt library)]) 3279fi 3280 3281cf_have_X_LIBS=no 3282 3283CF_TRY_PKG_CONFIG(xt,[ 3284 3285 case "x$LIBS" in 3286 (*-lX11*) 3287 ;; 3288 (*) 3289# we have an "xt" package, but it may omit Xt's dependency on X11 3290AC_CACHE_CHECK(for usable X dependency,cf_cv_xt_x11_compat,[ 3291AC_TRY_LINK([ 3292#include <X11/Xlib.h> 3293],[ 3294 int rc1 = XDrawLine((Display*) 0, (Drawable) 0, (GC) 0, 0, 0, 0, 0); 3295 int rc2 = XClearWindow((Display*) 0, (Window) 0); 3296 int rc3 = XMoveWindow((Display*) 0, (Window) 0, 0, 0); 3297 int rc4 = XMoveResizeWindow((Display*)0, (Window)0, 0, 0, 0, 0); 3298],[cf_cv_xt_x11_compat=yes],[cf_cv_xt_x11_compat=no])]) 3299 if test "$cf_cv_xt_x11_compat" = no 3300 then 3301 CF_VERBOSE(work around broken X11 dependency) 3302 # 2010/11/19 - good enough until a working Xt on Xcb is delivered. 3303 CF_TRY_PKG_CONFIG(x11,,[CF_ADD_LIB_AFTER(-lXt,-lX11)]) 3304 fi 3305 ;; 3306 esac 3307 3308AC_CACHE_CHECK(for usable X Toolkit package,cf_cv_xt_ice_compat,[ 3309AC_TRY_LINK([ 3310#include <X11/Shell.h> 3311],[int num = IceConnectionNumber(0) 3312],[cf_cv_xt_ice_compat=yes],[cf_cv_xt_ice_compat=no])]) 3313 3314 if test "$cf_cv_xt_ice_compat" = no 3315 then 3316 # workaround for broken ".pc" files used for X Toolkit. 3317 case "x$X_PRE_LIBS" in 3318 (*-lICE*) 3319 case "x$LIBS" in 3320 (*-lICE*) 3321 ;; 3322 (*) 3323 CF_VERBOSE(work around broken ICE dependency) 3324 CF_TRY_PKG_CONFIG(ice, 3325 [CF_TRY_PKG_CONFIG(sm)], 3326 [CF_ADD_LIB_AFTER(-lXt,$X_PRE_LIBS)]) 3327 ;; 3328 esac 3329 ;; 3330 esac 3331 fi 3332 3333 cf_have_X_LIBS=yes 3334],[ 3335 3336 LDFLAGS="$X_LIBS $LDFLAGS" 3337 CF_CHECK_CFLAGS($X_CFLAGS) 3338 3339 AC_CHECK_FUNC(XOpenDisplay,,[ 3340 AC_CHECK_LIB(X11,XOpenDisplay, 3341 [CF_ADD_LIB(X11)],, 3342 [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])]) 3343 3344 AC_CHECK_FUNC(XtAppInitialize,,[ 3345 AC_CHECK_LIB(Xt, XtAppInitialize, 3346 [AC_DEFINE(HAVE_LIBXT,1,[Define to 1 if we can compile with the Xt library]) 3347 cf_have_X_LIBS=Xt 3348 LIBS="-lXt $X_PRE_LIBS $LIBS $X_EXTRA_LIBS"],, 3349 [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])]) 3350]) 3351 3352if test $cf_have_X_LIBS = no ; then 3353 AC_MSG_WARN( 3354[Unable to successfully link X Toolkit library (-lXt) with 3355test program. You will have to check and add the proper libraries by hand 3356to makefile.]) 3357fi 3358])dnl 3359dnl --------------------------------------------------------------------------- 3360dnl CF__CURSES_HEAD version: 2 updated: 2010/10/23 15:54:49 3361dnl --------------- 3362dnl Define a reusable chunk which includes <curses.h> and <term.h> when they 3363dnl are both available. 3364define([CF__CURSES_HEAD],[ 3365#ifdef HAVE_XCURSES 3366#include <xcurses.h> 3367char * XCursesProgramName = "test"; 3368#else 3369#include <${cf_cv_ncurses_header:-curses.h}> 3370#if defined(NCURSES_VERSION) && defined(HAVE_NCURSESW_TERM_H) 3371#include <ncursesw/term.h> 3372#elif defined(NCURSES_VERSION) && defined(HAVE_NCURSES_TERM_H) 3373#include <ncurses/term.h> 3374#elif defined(HAVE_TERM_H) 3375#include <term.h> 3376#endif 3377#endif 3378]) 3379