aclocal.m4 revision 5307cd1a
1dnl $XTermId: aclocal.m4,v 1.507 2023/02/10 09:13:16 tom Exp $ 2dnl 3dnl --------------------------------------------------------------------------- 4dnl 5dnl Copyright 1997-2022,2023 by Thomas E. Dickey 6dnl 7dnl All Rights Reserved 8dnl 9dnl Permission is hereby granted, free of charge, to any person obtaining a 10dnl copy of this software and associated documentation files (the 11dnl "Software"), to deal in the Software without restriction, including 12dnl without limitation the rights to use, copy, modify, merge, publish, 13dnl distribute, sublicense, and/or sell copies of the Software, and to 14dnl permit persons to whom the Software is furnished to do so, subject to 15dnl the following conditions: 16dnl 17dnl The above copyright notice and this permission notice shall be included 18dnl in all copies or substantial portions of the Software. 19dnl 20dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 21dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 23dnl IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY 24dnl CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 25dnl TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 26dnl SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27dnl 28dnl Except as contained in this notice, the name(s) of the above copyright 29dnl holders shall not be used in advertising or otherwise to promote the 30dnl sale, use or other dealings in this Software without prior written 31dnl authorization. 32dnl 33dnl --------------------------------------------------------------------------- 34dnl See 35dnl https://invisible-island.net/autoconf/autoconf.html 36dnl https://invisible-island.net/autoconf/my-autoconf.html 37dnl --------------------------------------------------------------------------- 38dnl --------------------------------------------------------------------------- 39dnl AM_LANGINFO_CODESET version: 7 updated: 2023/01/11 04:05:23 40dnl ------------------- 41dnl Inserted as requested by gettext 0.10.40 42dnl File from /usr/share/aclocal 43dnl codeset.m4 44dnl ==================== 45dnl serial AM1 46dnl 47dnl From Bruno Haible. 48AC_DEFUN([AM_LANGINFO_CODESET], 49[ 50AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset, 51 [AC_TRY_LINK([ 52$ac_includes_default 53#include <langinfo.h>], 54 [char* cs = nl_langinfo(CODESET); (void)cs], 55 am_cv_langinfo_codeset=yes, 56 am_cv_langinfo_codeset=no) 57 ]) 58 if test "$am_cv_langinfo_codeset" = yes; then 59 AC_DEFINE(HAVE_LANGINFO_CODESET, 1, 60 [Define if you have <langinfo.h> and nl_langinfo(CODESET).]) 61 fi 62])dnl 63dnl --------------------------------------------------------------------------- 64dnl CF_ACVERSION_CHECK version: 5 updated: 2014/06/04 19:11:49 65dnl ------------------ 66dnl Conditionally generate script according to whether we're using a given autoconf. 67dnl 68dnl $1 = version to compare against 69dnl $2 = code to use if AC_ACVERSION is at least as high as $1. 70dnl $3 = code to use if AC_ACVERSION is older than $1. 71define([CF_ACVERSION_CHECK], 72[ 73ifdef([AC_ACVERSION], ,[ifdef([AC_AUTOCONF_VERSION],[m4_copy([AC_AUTOCONF_VERSION],[AC_ACVERSION])],[m4_copy([m4_PACKAGE_VERSION],[AC_ACVERSION])])])dnl 74ifdef([m4_version_compare], 75[m4_if(m4_version_compare(m4_defn([AC_ACVERSION]), [$1]), -1, [$3], [$2])], 76[CF_ACVERSION_COMPARE( 77AC_PREREQ_CANON(AC_PREREQ_SPLIT([$1])), 78AC_PREREQ_CANON(AC_PREREQ_SPLIT(AC_ACVERSION)), AC_ACVERSION, [$2], [$3])])])dnl 79dnl --------------------------------------------------------------------------- 80dnl CF_ACVERSION_COMPARE version: 3 updated: 2012/10/03 18:39:53 81dnl -------------------- 82dnl CF_ACVERSION_COMPARE(MAJOR1, MINOR1, TERNARY1, 83dnl MAJOR2, MINOR2, TERNARY2, 84dnl PRINTABLE2, not FOUND, FOUND) 85define([CF_ACVERSION_COMPARE], 86[ifelse(builtin([eval], [$2 < $5]), 1, 87[ifelse([$8], , ,[$8])], 88[ifelse([$9], , ,[$9])])])dnl 89dnl --------------------------------------------------------------------------- 90dnl CF_ADD_CFLAGS version: 15 updated: 2020/12/31 10:54:15 91dnl ------------- 92dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS 93dnl $1 = flags to add 94dnl $2 = if given makes this macro verbose. 95dnl 96dnl Put any preprocessor definitions that use quoted strings in $EXTRA_CPPFLAGS, 97dnl to simplify use of $CPPFLAGS in compiler checks, etc., that are easily 98dnl confused by the quotes (which require backslashes to keep them usable). 99AC_DEFUN([CF_ADD_CFLAGS], 100[ 101cf_fix_cppflags=no 102cf_new_cflags= 103cf_new_cppflags= 104cf_new_extra_cppflags= 105 106for cf_add_cflags in $1 107do 108case "$cf_fix_cppflags" in 109(no) 110 case "$cf_add_cflags" in 111 (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) 112 case "$cf_add_cflags" in 113 (-D*) 114 cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^-D[[^=]]*='\''\"[[^"]]*//'` 115 116 test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ 117 && test -z "${cf_tst_cflags}" \ 118 && cf_fix_cppflags=yes 119 120 if test "$cf_fix_cppflags" = yes ; then 121 CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags) 122 continue 123 elif test "${cf_tst_cflags}" = "\"'" ; then 124 CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags) 125 continue 126 fi 127 ;; 128 esac 129 case "$CPPFLAGS" in 130 (*$cf_add_cflags) 131 ;; 132 (*) 133 case "$cf_add_cflags" in 134 (-D*) 135 cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` 136 CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,$cf_tst_cppflags) 137 ;; 138 esac 139 CF_APPEND_TEXT(cf_new_cppflags,$cf_add_cflags) 140 ;; 141 esac 142 ;; 143 (*) 144 CF_APPEND_TEXT(cf_new_cflags,$cf_add_cflags) 145 ;; 146 esac 147 ;; 148(yes) 149 CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags) 150 151 cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^[[^"]]*"'\''//'` 152 153 test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ 154 && test -z "${cf_tst_cflags}" \ 155 && cf_fix_cppflags=no 156 ;; 157esac 158done 159 160if test -n "$cf_new_cflags" ; then 161 ifelse([$2],,,[CF_VERBOSE(add to \$CFLAGS $cf_new_cflags)]) 162 CF_APPEND_TEXT(CFLAGS,$cf_new_cflags) 163fi 164 165if test -n "$cf_new_cppflags" ; then 166 ifelse([$2],,,[CF_VERBOSE(add to \$CPPFLAGS $cf_new_cppflags)]) 167 CF_APPEND_TEXT(CPPFLAGS,$cf_new_cppflags) 168fi 169 170if test -n "$cf_new_extra_cppflags" ; then 171 ifelse([$2],,,[CF_VERBOSE(add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags)]) 172 CF_APPEND_TEXT(EXTRA_CPPFLAGS,$cf_new_extra_cppflags) 173fi 174 175AC_SUBST(EXTRA_CPPFLAGS) 176 177])dnl 178dnl --------------------------------------------------------------------------- 179dnl CF_ADD_LIB version: 2 updated: 2010/06/02 05:03:05 180dnl ---------- 181dnl Add a library, used to enforce consistency. 182dnl 183dnl $1 = library to add, without the "-l" 184dnl $2 = variable to update (default $LIBS) 185AC_DEFUN([CF_ADD_LIB],[CF_ADD_LIBS(-l$1,ifelse($2,,LIBS,[$2]))])dnl 186dnl --------------------------------------------------------------------------- 187dnl CF_ADD_LIBS version: 3 updated: 2019/11/02 16:47:33 188dnl ----------- 189dnl Add one or more libraries, used to enforce consistency. Libraries are 190dnl prepended to an existing list, since their dependencies are assumed to 191dnl already exist in the list. 192dnl 193dnl $1 = libraries to add, with the "-l", etc. 194dnl $2 = variable to update (default $LIBS) 195AC_DEFUN([CF_ADD_LIBS],[ 196cf_add_libs="[$]ifelse($2,,LIBS,[$2])" 197# reverse order 198cf_add_0lib= 199for cf_add_1lib in $1; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done 200# filter duplicates 201for cf_add_1lib in $cf_add_0lib; do 202 for cf_add_2lib in $cf_add_libs; do 203 if test "x$cf_add_1lib" = "x$cf_add_2lib"; then 204 cf_add_1lib= 205 break 206 fi 207 done 208 test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" 209done 210ifelse($2,,LIBS,[$2])="$cf_add_libs" 211])dnl 212dnl --------------------------------------------------------------------------- 213dnl CF_ADD_LIB_AFTER version: 3 updated: 2013/07/09 21:27:22 214dnl ---------------- 215dnl Add a given library after another, e.g., following the one it satisfies a 216dnl dependency for. 217dnl 218dnl $1 = the first library 219dnl $2 = its dependency 220AC_DEFUN([CF_ADD_LIB_AFTER],[ 221CF_VERBOSE(...before $LIBS) 222LIBS=`echo "$LIBS" | sed -e "s/[[ ]][[ ]]*/ /g" -e "s%$1 %$1 $2 %" -e 's% % %g'` 223CF_VERBOSE(...after $LIBS) 224])dnl 225dnl --------------------------------------------------------------------------- 226dnl CF_APPEND_CFLAGS version: 3 updated: 2021/09/05 17:25:40 227dnl ---------------- 228dnl Use CF_ADD_CFLAGS after first checking for potential redefinitions. 229dnl $1 = flags to add 230dnl $2 = if given makes this macro verbose. 231define([CF_APPEND_CFLAGS], 232[ 233for cf_add_cflags in $1 234do 235 case "x$cf_add_cflags" in 236 (x-[[DU]]*) 237 CF_REMOVE_CFLAGS($cf_add_cflags,CFLAGS,[$2]) 238 CF_REMOVE_CFLAGS($cf_add_cflags,CPPFLAGS,[$2]) 239 ;; 240 esac 241 CF_ADD_CFLAGS([$cf_add_cflags],[$2]) 242done 243])dnl 244dnl --------------------------------------------------------------------------- 245dnl CF_APPEND_TEXT version: 1 updated: 2017/02/25 18:58:55 246dnl -------------- 247dnl use this macro for appending text without introducing an extra blank at 248dnl the beginning 249define([CF_APPEND_TEXT], 250[ 251 test -n "[$]$1" && $1="[$]$1 " 252 $1="[$]{$1}$2" 253])dnl 254dnl --------------------------------------------------------------------------- 255dnl CF_ARG_DISABLE version: 3 updated: 1999/03/30 17:24:31 256dnl -------------- 257dnl Allow user to disable a normally-on option. 258AC_DEFUN([CF_ARG_DISABLE], 259[CF_ARG_OPTION($1,[$2],[$3],[$4],yes)])dnl 260dnl --------------------------------------------------------------------------- 261dnl CF_ARG_ENABLE version: 3 updated: 1999/03/30 17:24:31 262dnl ------------- 263dnl Allow user to enable a normally-off option. 264AC_DEFUN([CF_ARG_ENABLE], 265[CF_ARG_OPTION($1,[$2],[$3],[$4],no)])dnl 266dnl --------------------------------------------------------------------------- 267dnl CF_ARG_OPTION version: 5 updated: 2015/05/10 19:52:14 268dnl ------------- 269dnl Restricted form of AC_ARG_ENABLE that ensures user doesn't give bogus 270dnl values. 271dnl 272dnl Parameters: 273dnl $1 = option name 274dnl $2 = help-string 275dnl $3 = action to perform if option is not default 276dnl $4 = action if perform if option is default 277dnl $5 = default option value (either 'yes' or 'no') 278AC_DEFUN([CF_ARG_OPTION], 279[AC_ARG_ENABLE([$1],[$2],[test "$enableval" != ifelse([$5],no,yes,no) && enableval=ifelse([$5],no,no,yes) 280 if test "$enableval" != "$5" ; then 281ifelse([$3],,[ :]dnl 282,[ $3]) ifelse([$4],,,[ 283 else 284 $4]) 285 fi],[enableval=$5 ifelse([$4],,,[ 286 $4 287])dnl 288])])dnl 289dnl --------------------------------------------------------------------------- 290dnl CF_C11_NORETURN version: 4 updated: 2023/02/18 17:41:25 291dnl --------------- 292AC_DEFUN([CF_C11_NORETURN], 293[ 294AC_MSG_CHECKING(if you want to use C11 _Noreturn feature) 295CF_ARG_ENABLE(stdnoreturn, 296 [ --enable-stdnoreturn enable C11 _Noreturn feature for diagnostics], 297 [enable_stdnoreturn=yes], 298 [enable_stdnoreturn=no]) 299AC_MSG_RESULT($enable_stdnoreturn) 300 301if test $enable_stdnoreturn = yes; then 302AC_CACHE_CHECK([for C11 _Noreturn feature], cf_cv_c11_noreturn, 303 [AC_TRY_COMPILE([ 304$ac_includes_default 305#include <stdnoreturn.h> 306static _Noreturn void giveup(void) { exit(0); } 307 ], 308 [if (feof(stdin)) giveup()], 309 cf_cv_c11_noreturn=yes, 310 cf_cv_c11_noreturn=no) 311 ]) 312else 313 cf_cv_c11_noreturn=no, 314fi 315 316if test "$cf_cv_c11_noreturn" = yes; then 317 AC_DEFINE(HAVE_STDNORETURN_H, 1,[Define if <stdnoreturn.h> header is available and working]) 318 AC_DEFINE_UNQUOTED(STDC_NORETURN,_Noreturn,[Define if C11 _Noreturn keyword is supported]) 319 HAVE_STDNORETURN_H=1 320else 321 HAVE_STDNORETURN_H=0 322fi 323 324AC_SUBST(HAVE_STDNORETURN_H) 325AC_SUBST(STDC_NORETURN) 326])dnl 327dnl --------------------------------------------------------------------------- 328dnl CF_CC_ENV_FLAGS version: 11 updated: 2023/02/20 11:15:46 329dnl --------------- 330dnl Check for user's environment-breakage by stuffing CFLAGS/CPPFLAGS content 331dnl into CC. This will not help with broken scripts that wrap the compiler 332dnl with options, but eliminates a more common category of user confusion. 333dnl 334dnl In particular, it addresses the problem of being able to run the C 335dnl preprocessor in a consistent manner. 336dnl 337dnl Caveat: this also disallows blanks in the pathname for the compiler, but 338dnl the nuisance of having inconsistent settings for compiler and preprocessor 339dnl outweighs that limitation. 340AC_DEFUN([CF_CC_ENV_FLAGS], 341[ 342# This should have been defined by AC_PROG_CC 343: "${CC:=cc}" 344 345AC_MSG_CHECKING(\$CFLAGS variable) 346case "x$CFLAGS" in 347(*-[[IUD]]*) 348 AC_MSG_RESULT(broken) 349 AC_MSG_WARN(your environment uses the CFLAGS variable to hold CPPFLAGS options) 350 cf_flags="$CFLAGS" 351 CFLAGS= 352 for cf_arg in $cf_flags 353 do 354 CF_ADD_CFLAGS($cf_arg) 355 done 356 ;; 357(*) 358 AC_MSG_RESULT(ok) 359 ;; 360esac 361 362AC_MSG_CHECKING(\$CC variable) 363case "$CC" in 364(*[[\ \ ]]-*) 365 AC_MSG_RESULT(broken) 366 AC_MSG_WARN(your environment uses the CC variable to hold CFLAGS/CPPFLAGS options) 367 # humor him... 368 cf_prog=`echo "$CC" | sed -e 's/ / /g' -e 's/[[ ]]* / /g' -e 's/[[ ]]*[[ ]]-[[^ ]].*//'` 369 cf_flags=`echo "$CC" | sed -e "s%^$cf_prog%%"` 370 CC="$cf_prog" 371 for cf_arg in $cf_flags 372 do 373 case "x$cf_arg" in 374 (x-[[IUDfgOW]]*) 375 CF_ADD_CFLAGS($cf_arg) 376 ;; 377 (*) 378 CC="$CC $cf_arg" 379 ;; 380 esac 381 done 382 CF_VERBOSE(resulting CC: '$CC') 383 CF_VERBOSE(resulting CFLAGS: '$CFLAGS') 384 CF_VERBOSE(resulting CPPFLAGS: '$CPPFLAGS') 385 ;; 386(*) 387 AC_MSG_RESULT(ok) 388 ;; 389esac 390])dnl 391dnl --------------------------------------------------------------------------- 392dnl CF_CHECK_CACHE version: 13 updated: 2020/12/31 10:54:15 393dnl -------------- 394dnl Check if we're accidentally using a cache from a different machine. 395dnl Derive the system name, as a check for reusing the autoconf cache. 396dnl 397dnl If we've packaged config.guess and config.sub, run that (since it does a 398dnl better job than uname). Normally we'll use AC_CANONICAL_HOST, but allow 399dnl an extra parameter that we may override, e.g., for AC_CANONICAL_SYSTEM 400dnl which is useful in cross-compiles. 401dnl 402dnl Note: we would use $ac_config_sub, but that is one of the places where 403dnl autoconf 2.5x broke compatibility with autoconf 2.13 404AC_DEFUN([CF_CHECK_CACHE], 405[ 406if test -f "$srcdir/config.guess" || test -f "$ac_aux_dir/config.guess" ; then 407 ifelse([$1],,[AC_CANONICAL_HOST],[$1]) 408 system_name="$host_os" 409else 410 system_name="`(uname -s -r) 2>/dev/null`" 411 if test -z "$system_name" ; then 412 system_name="`(hostname) 2>/dev/null`" 413 fi 414fi 415test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name",[Define to the system name.]) 416AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"]) 417 418test -z "$system_name" && system_name="$cf_cv_system_name" 419test -n "$cf_cv_system_name" && AC_MSG_RESULT(Configuring for $cf_cv_system_name) 420 421if test ".$system_name" != ".$cf_cv_system_name" ; then 422 AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)) 423 AC_MSG_ERROR("Please remove config.cache and try again.") 424fi 425])dnl 426dnl --------------------------------------------------------------------------- 427dnl CF_CHECK_CFLAGS version: 4 updated: 2021/01/02 19:22:58 428dnl --------------- 429dnl Conditionally add to $CFLAGS and $CPPFLAGS values which are derived from 430dnl a build-configuration such as imake. These have the pitfall that they 431dnl often contain compiler-specific options which we cannot use, mixed with 432dnl preprocessor options that we usually can. 433AC_DEFUN([CF_CHECK_CFLAGS], 434[ 435CF_VERBOSE(checking additions to CFLAGS) 436cf_check_cflags="$CFLAGS" 437cf_check_cppflags="$CPPFLAGS" 438CF_ADD_CFLAGS($1,yes) 439if test "x$cf_check_cflags" != "x$CFLAGS" ; then 440AC_TRY_LINK([#include <stdio.h>],[printf("Hello world");],, 441 [CF_VERBOSE(test-compile failed. Undoing change to \$CFLAGS) 442 if test "x$cf_check_cppflags" != "x$CPPFLAGS" ; then 443 CF_VERBOSE(but keeping change to \$CPPFLAGS) 444 fi 445 CFLAGS="$cf_check_cflags"]) 446fi 447])dnl 448dnl --------------------------------------------------------------------------- 449dnl CF_CHECK_ERRNO version: 14 updated: 2023/02/18 17:41:25 450dnl -------------- 451dnl Check for data that is usually declared in <stdio.h> or <errno.h>, e.g., 452dnl the 'errno' variable. Define a DECL_xxx symbol if we must declare it 453dnl ourselves. 454dnl 455dnl $1 = the name to check 456dnl $2 = the assumed type 457AC_DEFUN([CF_CHECK_ERRNO], 458[ 459AC_CACHE_CHECK(if external $1 is declared, cf_cv_dcl_$1,[ 460 AC_TRY_COMPILE([ 461$ac_includes_default 462#include <errno.h> ], 463 ifelse([$2],,int,[$2]) x = (ifelse([$2],,int,[$2])) $1; (void)x, 464 [cf_cv_dcl_$1=yes], 465 [cf_cv_dcl_$1=no]) 466]) 467 468if test "$cf_cv_dcl_$1" = no ; then 469 CF_UPPER(cf_result,decl_$1) 470 AC_DEFINE_UNQUOTED($cf_result) 471fi 472 473# It's possible (for near-UNIX clones) that the data doesn't exist 474CF_CHECK_EXTERN_DATA($1,ifelse([$2],,int,[$2])) 475])dnl 476dnl --------------------------------------------------------------------------- 477dnl CF_CHECK_EXTERN_DATA version: 5 updated: 2021/09/04 06:35:04 478dnl -------------------- 479dnl Check for existence of external data in the current set of libraries. If 480dnl we can modify it, it is real enough. 481dnl $1 = the name to check 482dnl $2 = its type 483AC_DEFUN([CF_CHECK_EXTERN_DATA], 484[ 485AC_CACHE_CHECK(if external $1 exists, cf_cv_have_$1,[ 486 AC_TRY_LINK([ 487#undef $1 488extern $2 $1; 489], 490 [$1 = 2], 491 [cf_cv_have_$1=yes], 492 [cf_cv_have_$1=no]) 493]) 494 495if test "$cf_cv_have_$1" = yes ; then 496 CF_UPPER(cf_result,have_$1) 497 AC_DEFINE_UNQUOTED($cf_result) 498fi 499 500])dnl 501dnl --------------------------------------------------------------------------- 502dnl CF_CLANG_COMPILER version: 9 updated: 2023/02/18 17:41:25 503dnl ----------------- 504dnl Check if the given compiler is really clang. clang's C driver defines 505dnl __GNUC__ (fooling the configure script into setting $GCC to yes) but does 506dnl not ignore some gcc options. 507dnl 508dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to 509dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from 510dnl the wrappers for gcc and g++ warnings. 511dnl 512dnl $1 = GCC (default) or GXX 513dnl $2 = CLANG_COMPILER (default) 514dnl $3 = CFLAGS (default) or CXXFLAGS 515AC_DEFUN([CF_CLANG_COMPILER],[ 516ifelse([$2],,CLANG_COMPILER,[$2])=no 517 518if test "$ifelse([$1],,[$1],GCC)" = yes ; then 519 AC_MSG_CHECKING(if this is really Clang ifelse([$1],GXX,C++,C) compiler) 520 cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])" 521 AC_TRY_COMPILE([],[ 522#ifdef __clang__ 523#else 524#error __clang__ is not defined 525#endif 526],[ifelse([$2],,CLANG_COMPILER,[$2])=yes 527],[]) 528 ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS" 529 AC_MSG_RESULT($ifelse([$2],,CLANG_COMPILER,[$2])) 530fi 531 532CLANG_VERSION=none 533 534if test "x$ifelse([$2],,CLANG_COMPILER,[$2])" = "xyes" ; then 535 case "$CC" in 536 (c[[1-9]][[0-9]]|*/c[[1-9]][[0-9]]) 537 AC_MSG_WARN(replacing broken compiler alias $CC) 538 CFLAGS="$CFLAGS -std=`echo "$CC" | sed -e 's%.*/%%'`" 539 CC=clang 540 ;; 541 esac 542 543 AC_MSG_CHECKING(version of $CC) 544 CLANG_VERSION="`$CC --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(CLANG[[^)]]*) //' -e 's/^.*(Debian[[^)]]*) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`" 545 test -z "$CLANG_VERSION" && CLANG_VERSION=unknown 546 AC_MSG_RESULT($CLANG_VERSION) 547 548 for cf_clang_opt in \ 549 -Qunused-arguments \ 550 -Wno-error=implicit-function-declaration 551 do 552 AC_MSG_CHECKING(if option $cf_clang_opt works) 553 cf_save_CFLAGS="$CFLAGS" 554 CFLAGS="$CFLAGS $cf_clang_opt" 555 AC_TRY_LINK([ 556 #include <stdio.h>],[ 557 printf("hello!\\n");],[ 558 cf_clang_optok=yes],[ 559 cf_clang_optok=no]) 560 AC_MSG_RESULT($cf_clang_optok) 561 CFLAGS="$cf_save_CFLAGS" 562 if test "$cf_clang_optok" = yes; then 563 CF_VERBOSE(adding option $cf_clang_opt) 564 CF_APPEND_TEXT(CFLAGS,$cf_clang_opt) 565 fi 566 done 567fi 568]) 569dnl --------------------------------------------------------------------------- 570dnl CF_CONST_X_STRING version: 7 updated: 2021/06/07 17:39:17 571dnl ----------------- 572dnl The X11R4-X11R6 Xt specification uses an ambiguous String type for most 573dnl character-strings. 574dnl 575dnl It is ambiguous because the specification accommodated the pre-ANSI 576dnl compilers bundled by more than one vendor in lieu of providing a standard C 577dnl compiler other than by costly add-ons. Because of this, the specification 578dnl did not take into account the use of const for telling the compiler that 579dnl string literals would be in readonly memory. 580dnl 581dnl As a workaround, one could (starting with X11R5) define XTSTRINGDEFINES, to 582dnl let the compiler decide how to represent Xt's strings which were #define'd. 583dnl That does not solve the problem of using the block of Xt's strings which 584dnl are compiled into the library (and is less efficient than one might want). 585dnl 586dnl Xt specification 7 introduces the _CONST_X_STRING symbol which is used both 587dnl when compiling the library and compiling using the library, to tell the 588dnl compiler that String is const. 589AC_DEFUN([CF_CONST_X_STRING], 590[ 591AC_REQUIRE([AC_PATH_XTRA]) 592 593CF_SAVE_XTRA_FLAGS([CF_CONST_X_STRING]) 594 595AC_TRY_COMPILE( 596[ 597#include <stdlib.h> 598#include <X11/Intrinsic.h> 599], 600[String foo = malloc(1); free((void*)foo)],[ 601 602AC_CACHE_CHECK(for X11/Xt const-feature,cf_cv_const_x_string,[ 603 AC_TRY_COMPILE( 604 [ 605#define _CONST_X_STRING /* X11R7.8 (perhaps) */ 606#undef XTSTRINGDEFINES /* X11R5 and later */ 607#include <stdlib.h> 608#include <X11/Intrinsic.h> 609 ],[String foo = malloc(1); *foo = 0],[ 610 cf_cv_const_x_string=no 611 ],[ 612 cf_cv_const_x_string=yes 613 ]) 614]) 615 616CF_RESTORE_XTRA_FLAGS([CF_CONST_X_STRING]) 617 618case "$cf_cv_const_x_string" in 619(no) 620 CF_APPEND_TEXT(CPPFLAGS,-DXTSTRINGDEFINES) 621 ;; 622(*) 623 CF_APPEND_TEXT(CPPFLAGS,-D_CONST_X_STRING) 624 ;; 625esac 626 627]) 628])dnl 629dnl --------------------------------------------------------------------------- 630dnl CF_DISABLE_DESKTOP version: 2 updated: 2011/04/22 05:17:37 631dnl ------------------ 632dnl Handle a configure option "--disable-desktop", which sets a shell 633dnl variable $desktop_utils to a "#" if the feature is not wanted, or to an 634dnl empty string if enabled. The variable is used to substitute in front of 635dnl corresponding makefile-rules. 636dnl 637dnl It also tells the configure script to substitute the environment variable 638dnl $DESKTOP_FLAGS, which can be used by external scripts to customize the 639dnl invocation of desktop-file-util. 640dnl 641dnl $1 = program name 642AC_DEFUN([CF_DISABLE_DESKTOP],[ 643# Comment-out the install-desktop rule if the desktop-utils are not found. 644AC_MSG_CHECKING(if you want to install desktop files) 645CF_ARG_OPTION(desktop, 646 [ --disable-desktop disable install of $1 desktop files], 647 [enable_desktop=$enableval], 648 [enable_desktop=$enableval],yes) 649AC_MSG_RESULT($enable_desktop) 650 651desktop_utils= 652if test "$enable_desktop" = yes ; then 653AC_CHECK_PROG(desktop_utils,desktop-file-install,yes,no) 654fi 655 656test "$desktop_utils" = yes && desktop_utils= || desktop_utils="#" 657AC_SUBST(DESKTOP_FLAGS) 658]) 659dnl --------------------------------------------------------------------------- 660dnl CF_DISABLE_ECHO version: 14 updated: 2021/09/04 06:35:04 661dnl --------------- 662dnl You can always use "make -n" to see the actual options, but it is hard to 663dnl pick out/analyze warning messages when the compile-line is long. 664dnl 665dnl Sets: 666dnl ECHO_LT - symbol to control if libtool is verbose 667dnl ECHO_LD - symbol to prefix "cc -o" lines 668dnl RULE_CC - symbol to put before implicit "cc -c" lines (e.g., .c.o) 669dnl SHOW_CC - symbol to put before explicit "cc -c" lines 670dnl ECHO_CC - symbol to put before any "cc" line 671dnl 672AC_DEFUN([CF_DISABLE_ECHO],[ 673AC_MSG_CHECKING(if you want to see long compiling messages) 674CF_ARG_DISABLE(echo, 675 [ --disable-echo do not display "compiling" commands], 676 [ 677 ECHO_LT='--silent' 678 ECHO_LD='@echo linking [$]@;' 679 RULE_CC='@echo compiling [$]<' 680 SHOW_CC='@echo compiling [$]@' 681 ECHO_CC='@' 682],[ 683 ECHO_LT='' 684 ECHO_LD='' 685 RULE_CC='' 686 SHOW_CC='' 687 ECHO_CC='' 688]) 689AC_MSG_RESULT($enableval) 690AC_SUBST(ECHO_LT) 691AC_SUBST(ECHO_LD) 692AC_SUBST(RULE_CC) 693AC_SUBST(SHOW_CC) 694AC_SUBST(ECHO_CC) 695])dnl 696dnl --------------------------------------------------------------------------- 697dnl CF_DISABLE_LEAKS version: 9 updated: 2021/04/03 16:41:50 698dnl ---------------- 699dnl Combine no-leak checks with the libraries or tools that are used for the 700dnl checks. 701AC_DEFUN([CF_DISABLE_LEAKS],[ 702 703AC_REQUIRE([CF_WITH_DMALLOC]) 704AC_REQUIRE([CF_WITH_DBMALLOC]) 705AC_REQUIRE([CF_WITH_VALGRIND]) 706 707AC_MSG_CHECKING(if you want to perform memory-leak testing) 708AC_ARG_ENABLE(leaks, 709 [ --disable-leaks test: free permanent memory, analyze leaks], 710 [enable_leaks=$enableval], 711 [enable_leaks=yes]) 712dnl with_no_leaks is more readable... 713if test "x$enable_leaks" = xno; then with_no_leaks=yes; else with_no_leaks=no; fi 714AC_MSG_RESULT($with_no_leaks) 715 716if test "$enable_leaks" = no ; then 717 AC_DEFINE(NO_LEAKS,1,[Define to 1 if you want to perform memory-leak testing.]) 718 AC_DEFINE(YY_NO_LEAKS,1,[Define to 1 if you want to perform memory-leak testing.]) 719fi 720])dnl 721dnl --------------------------------------------------------------------------- 722dnl CF_DISABLE_RPATH_HACK version: 3 updated: 2021/01/05 20:14:44 723dnl --------------------- 724dnl The rpath-hack makes it simpler to build programs, particularly with the 725dnl *BSD ports which may have essential libraries in unusual places. But it 726dnl can interfere with building an executable for the base system. Use this 727dnl option in that case. 728AC_DEFUN([CF_DISABLE_RPATH_HACK], 729[ 730AC_MSG_CHECKING(if rpath-hack should be disabled) 731CF_ARG_DISABLE(rpath-hack, 732 [ --disable-rpath-hack don't add rpath options for additional libraries], 733 [enable_rpath_hack=no], 734 [enable_rpath_hack=yes]) 735dnl TODO - drop cf_disable_rpath_hack 736if test "x$enable_rpath_hack" = xno; then cf_disable_rpath_hack=yes; else cf_disable_rpath_hack=no; fi 737AC_MSG_RESULT($cf_disable_rpath_hack) 738 739if test "$enable_rpath_hack" = yes ; then 740 CF_RPATH_HACK 741fi 742]) 743dnl --------------------------------------------------------------------------- 744dnl CF_ENABLE_NARROWPROTO version: 6 updated: 2020/12/31 18:40:20 745dnl --------------------- 746dnl If this is not set properly, Xaw's scrollbars will not work. 747dnl The so-called "modular" configuration for X.org omits most of the 748dnl configure checks that would be needed to provide compatibility with 749dnl older X builds. This one breaks things noticeably. 750AC_DEFUN([CF_ENABLE_NARROWPROTO], 751[ 752AC_MSG_CHECKING(if you want narrow prototypes for X libraries) 753 754case `$ac_config_guess` in 755(*freebsd*|*gnu*|*irix5*|*irix6*|*netbsd*|*openbsd*|*qnx*|*sco*|*sgi*) 756 cf_default_narrowproto=yes 757 ;; 758(*) 759 cf_default_narrowproto=no 760 ;; 761esac 762 763CF_ARG_OPTION(narrowproto, 764 [ --enable-narrowproto enable narrow prototypes for X libraries], 765 [enable_narrowproto=$enableval], 766 [enable_narrowproto=$cf_default_narrowproto], 767 [$cf_default_narrowproto]) 768AC_MSG_RESULT($enable_narrowproto) 769]) 770dnl --------------------------------------------------------------------------- 771dnl CF_ENABLE_WARNINGS version: 9 updated: 2021/01/05 19:40:50 772dnl ------------------ 773dnl Configure-option to enable gcc warnings 774dnl 775dnl $1 = extra options to add, if supported 776dnl $2 = option for checking attributes. By default, this is done when 777dnl warnings are enabled. For other values: 778dnl yes: always do this, e.g., to use in generated library-headers 779dnl no: never do this 780AC_DEFUN([CF_ENABLE_WARNINGS],[ 781if test "$GCC" = yes || test "$GXX" = yes 782then 783CF_FIX_WARNINGS(CFLAGS) 784CF_FIX_WARNINGS(CPPFLAGS) 785CF_FIX_WARNINGS(LDFLAGS) 786AC_MSG_CHECKING(if you want to turn on gcc warnings) 787CF_ARG_ENABLE(warnings, 788 [ --enable-warnings test: turn on gcc compiler warnings], 789 [enable_warnings=yes], 790 [enable_warnings=no]) 791AC_MSG_RESULT($enable_warnings) 792if test "$enable_warnings" = "yes" 793then 794 ifelse($2,,[CF_GCC_ATTRIBUTES]) 795 CF_GCC_WARNINGS($1) 796fi 797ifelse($2,yes,[CF_GCC_ATTRIBUTES]) 798fi 799])dnl 800dnl --------------------------------------------------------------------------- 801dnl CF_ERRNO version: 5 updated: 1997/11/30 12:44:39 802dnl -------- 803dnl Check if 'errno' is declared in <errno.h> 804AC_DEFUN([CF_ERRNO], 805[ 806CF_CHECK_ERRNO(errno) 807])dnl 808dnl --------------------------------------------------------------------------- 809dnl CF_FIX_WARNINGS version: 4 updated: 2021/12/16 18:22:31 810dnl --------------- 811dnl Warning flags do not belong in CFLAGS, CPPFLAGS, etc. Any of gcc's 812dnl "-Werror" flags can interfere with configure-checks. Those go into 813dnl EXTRA_CFLAGS. 814dnl 815dnl $1 = variable name to repair 816define([CF_FIX_WARNINGS],[ 817if test "$GCC" = yes || test "$GXX" = yes 818then 819 case [$]$1 in 820 (*-Werror=*) 821 cf_temp_flags= 822 for cf_temp_scan in [$]$1 823 do 824 case "x$cf_temp_scan" in 825 (x-Werror=format*) 826 CF_APPEND_TEXT(cf_temp_flags,$cf_temp_scan) 827 ;; 828 (x-Werror=*) 829 CF_APPEND_TEXT(EXTRA_CFLAGS,$cf_temp_scan) 830 ;; 831 (*) 832 CF_APPEND_TEXT(cf_temp_flags,$cf_temp_scan) 833 ;; 834 esac 835 done 836 if test "x[$]$1" != "x$cf_temp_flags" 837 then 838 CF_VERBOSE(repairing $1: [$]$1) 839 $1="$cf_temp_flags" 840 CF_VERBOSE(... fixed [$]$1) 841 CF_VERBOSE(... extra $EXTRA_CFLAGS) 842 fi 843 ;; 844 esac 845fi 846AC_SUBST(EXTRA_CFLAGS) 847])dnl 848dnl --------------------------------------------------------------------------- 849dnl CF_FUNC_GRANTPT version: 15 updated: 2020/12/31 18:40:20 850dnl --------------- 851dnl Check for grantpt versus openpty, as well as functions that "should" be 852dnl available if grantpt is available. 853AC_DEFUN([CF_FUNC_GRANTPT],[ 854 855AC_CHECK_HEADERS( \ 856stropts.h \ 857) 858 859cf_func_grantpt="grantpt ptsname" 860cf_prefer_openpt=no 861case $host_os in 862(darwin[[0-9]].*) 863 ;; 864(openbsd[[0-9]].*) 865 # The POSIX entrypoints exist, but have never worked. 866 ;; 867(linux*) 868 cf_func_grantpt="$cf_func_grantpt posix_openpt" 869 cf_prefer_openpt=yes 870 ;; 871(*) 872 cf_func_grantpt="$cf_func_grantpt posix_openpt" 873 ;; 874esac 875 876AC_CHECK_FUNCS($cf_func_grantpt) 877 878cf_grantpt_opts= 879if test "x$ac_cv_func_grantpt" = "xyes" ; then 880 AC_MSG_CHECKING(if grantpt really works) 881 AC_TRY_LINK(CF__GRANTPT_HEAD,CF__GRANTPT_BODY,[ 882 AC_TRY_RUN(CF__GRANTPT_HEAD 883int main(void) 884{ 885CF__GRANTPT_BODY 886} 887, 888,ac_cv_func_grantpt=no 889,ac_cv_func_grantpt=maybe) 890 ],ac_cv_func_grantpt=no) 891 AC_MSG_RESULT($ac_cv_func_grantpt) 892 893 if test "x$ac_cv_func_grantpt" != "xno" ; then 894 895 if test "x$ac_cv_func_grantpt" = "xyes" ; then 896 AC_MSG_CHECKING(for pty features) 897dnl if we have no stropts.h, skip the checks for streams modules 898 if test "x$ac_cv_header_stropts_h" = xyes 899 then 900 cf_pty_this=0 901 else 902 cf_pty_this=3 903 fi 904 905 cf_pty_defines= 906 while test $cf_pty_this != 6 907 do 908 909 cf_pty_feature= 910 cf_pty_next="`expr $cf_pty_this + 1`" 911 CF_MSG_LOG(pty feature test $cf_pty_next:5) 912 AC_TRY_RUN(#define CONFTEST $cf_pty_this 913$cf_pty_defines 914CF__GRANTPT_HEAD 915int main(void) 916{ 917CF__GRANTPT_BODY 918} 919, 920[ 921 case $cf_pty_next in 922 (1) # - streams 923 cf_pty_feature=ptem 924 ;; 925 (2) # - streams 926 cf_pty_feature=ldterm 927 ;; 928 (3) # - streams 929 cf_pty_feature=ttcompat 930 ;; 931 (4) 932 cf_pty_feature=pty_isatty 933 ;; 934 (5) 935 cf_pty_feature=pty_tcsetattr 936 ;; 937 (6) 938 cf_pty_feature=tty_tcsetattr 939 ;; 940 esac 941],[ 942 case $cf_pty_next in 943 (1|2|3) 944 CF_MSG_LOG(skipping remaining streams features $cf_pty_this..2) 945 cf_pty_next=3 946 ;; 947 esac 948]) 949 if test -n "$cf_pty_feature" 950 then 951 cf_pty_defines="$cf_pty_defines 952#define CONFTEST_$cf_pty_feature 1 953" 954 cf_grantpt_opts="$cf_grantpt_opts $cf_pty_feature" 955 fi 956 957 cf_pty_this=$cf_pty_next 958 done 959 AC_MSG_RESULT($cf_grantpt_opts) 960 cf_grantpt_opts=`echo "$cf_grantpt_opts" | sed -e 's/ isatty//'` 961 fi 962 fi 963fi 964 965dnl If we found grantpt, but no features, e.g., for streams or if we are not 966dnl able to use tcsetattr, then give openpty a try. In particular, Darwin 10.7 967dnl has a more functional openpty than posix_openpt. 968dnl 969dnl There is no configure run-test for openpty, since older implementations do 970dnl not always run properly as a non-root user. For that reason, we also allow 971dnl the configure script to suppress this check entirely with $disable_openpty. 972if test "x$cf_prefer_posix_openpt" = "xyes" && test "x$ac_cv_func_posix_openpt" = "xyes" ; then 973 CF_VERBOSE(prefer posix_openpt over openpty) 974elif test "x$disable_openpty" != "xyes" || test -z "$cf_grantpt_opts" ; then 975 AC_CHECK_LIB(util, openpty, [cf_have_openpty=yes],[cf_have_openpty=no]) 976 if test "$cf_have_openpty" = yes ; then 977 ac_cv_func_grantpt=no 978 LIBS="-lutil $LIBS" 979 AC_DEFINE(HAVE_OPENPTY,1,[Define to 1 if you have the openpty function]) 980 AC_CHECK_HEADERS( \ 981 util.h \ 982 libutil.h \ 983 pty.h \ 984 ) 985 fi 986fi 987 988dnl If we did not settle on using openpty, fill in the definitions for grantpt. 989if test "x$ac_cv_func_grantpt" != xno 990then 991 CF_VERBOSE(will rely upon grantpt) 992 AC_DEFINE(HAVE_WORKING_GRANTPT,1,[Define to 1 if the grantpt function seems to work]) 993 for cf_feature in $cf_grantpt_opts 994 do 995 cf_feature=`echo "$cf_feature" | sed -e 's/ //g'` 996 CF_UPPER(cf_FEATURE,$cf_feature) 997 AC_DEFINE_UNQUOTED(HAVE_GRANTPT_$cf_FEATURE) 998 done 999elif test "x$cf_have_openpty" = xno 1000then 1001 CF_VERBOSE(will rely upon BSD-pseudoterminals) 1002else 1003 CF_VERBOSE(will rely upon openpty) 1004fi 1005])dnl 1006dnl --------------------------------------------------------------------------- 1007dnl CF_FUNC_TGETENT version: 26 updated: 2023/02/10 04:11:55 1008dnl --------------- 1009dnl Check for tgetent function in termcap library. If we cannot find this, 1010dnl we'll use the $LINES and $COLUMNS environment variables to pass screen 1011dnl size information to subprocesses. (We cannot use terminfo's compatibility 1012dnl function, since it cannot provide the termcap-format data). 1013dnl 1014dnl If the --disable-full-tgetent option is given, we'll settle for the first 1015dnl tgetent function we find. Since the search list in that case does not 1016dnl include the termcap library, that allows us to default to terminfo. 1017AC_DEFUN([CF_FUNC_TGETENT], 1018[ 1019# compute a reasonable value for $TERM to give tgetent(), since we may be 1020# running in 'screen', which sets $TERMCAP to a specific entry that is not 1021# necessarily in /etc/termcap - unsetenv is not portable, so we cannot simply 1022# discard $TERMCAP. 1023cf_TERMVAR=vt100 1024if test -n "$TERMCAP" 1025then 1026 cf_TERMCAP=`echo "$TERMCAP" | tr '\n' ' ' | sed -e 's/^..|//' -e 's/|.*//'` 1027 case "$cf_TERMCAP" in 1028 (screen*.*) 1029 ;; 1030 (*) 1031 cf_TERMVAR="$cf_TERMCAP" 1032 ;; 1033 esac 1034fi 1035test -z "$cf_TERMVAR" && cf_TERMVAR=vt100 1036 1037# BSD termcap used no header file 1038# SVr4 provided termcap prototypes as a legacy feature in term.h 1039# GNU termcap provided termcap prototypes in termcap.h 1040# ncurses provides termcap prototypes in both term.h and termcap.h 1041# 1042# The terminfo-based termcap interfaces do not provide a full tgetent (i.e., do 1043# not return the text of the termcap entry in the buffer), but as a special 1044# case, FreeBSD provides ncurses' termcap.h with a modified termcap reader that 1045# returns the termcap text. 1046AC_CHECK_HEADERS(termcap.h) 1047 1048cf_termcap_h="\ 1049#ifdef HAVE_TERMCAP_H 1050#include <termcap.h> 1051#else 1052extern int tgetent(char *, const char *); 1053#endif" 1054 1055AC_MSG_CHECKING(if we want full tgetent function) 1056CF_ARG_DISABLE(full-tgetent, 1057 [ --disable-full-tgetent disable check for full tgetent function], 1058 cf_full_tgetent=no, 1059 cf_full_tgetent=yes,yes) 1060AC_MSG_RESULT($cf_full_tgetent) 1061 1062if test "$cf_full_tgetent" = yes ; then 1063 cf_test_message="full tgetent" 1064else 1065 cf_test_message="tgetent" 1066fi 1067 1068AC_CACHE_CHECK(for $cf_test_message function,cf_cv_lib_tgetent,[ 1069cf_save_LIBS="$LIBS" 1070cf_cv_lib_tgetent=no 1071cf_TERMLIB="termlib ncursesw ncurses curses" 1072if test "$cf_full_tgetent" = yes ; then 1073 cf_TERMLIB="otermcap termcap $cf_TERMLIB" 1074 cf_TERMTST="buffer[[0]] == 0" 1075else 1076 cf_TERMLIB="tinfow tinfo $cf_TERMLIB" 1077 cf_TERMTST="0" 1078fi 1079for cf_termlib in '' $cf_TERMLIB ; do 1080 LIBS="$cf_save_LIBS" 1081 test -n "$cf_termlib" && { CF_ADD_LIB($cf_termlib) } 1082 AC_TRY_RUN([ 1083$cf_termcap_h 1084 1085/* terminfo implementations ignore the buffer argument, making it useless for 1086 * the xterm application, which uses this information to make a new TERMCAP 1087 * environment variable. 1088 */ 1089int main(void) 1090{ 1091 char buffer[1024]; 1092 buffer[0] = 0; 1093 tgetent(buffer, "$cf_TERMVAR"); 1094 ${cf_cv_main_return:-return} ($cf_TERMTST); }], 1095 [echo "yes, there is a termcap/tgetent in $cf_termlib" 1>&AC_FD_CC 1096 if test -n "$cf_termlib" ; then 1097 cf_cv_lib_tgetent="-l$cf_termlib" 1098 else 1099 cf_cv_lib_tgetent=yes 1100 fi 1101 break], 1102 [echo "no, there is no termcap/tgetent in $cf_termlib" 1>&AC_FD_CC], 1103 [echo "cross-compiling, cannot verify if a termcap/tgetent is present in $cf_termlib" 1>&AC_FD_CC]) 1104done 1105LIBS="$cf_save_LIBS" 1106]) 1107 1108# If we found a working tgetent(), set LIBS and check for termcap.h. 1109# (LIBS cannot be set inside AC_CACHE_CHECK; the commands there should 1110# not have side effects other than setting the cache variable, because 1111# they are not executed when a cached value exists.) 1112if test "x$cf_cv_lib_tgetent" != xno ; then 1113 test "x$cf_cv_lib_tgetent" != xyes && { CF_ADD_LIBS($cf_cv_lib_tgetent) } 1114 AC_DEFINE(USE_TERMCAP,1,[Define 1 to indicate that working tgetent is found]) 1115 if test "$cf_full_tgetent" = no ; then 1116 AC_TRY_COMPILE([ 1117#include <termcap.h>],[ 1118#ifdef NCURSES_VERSION 1119make an error 1120#endif],[AC_DEFINE(HAVE_TERMCAP_H)]) 1121 fi 1122else 1123 # If we didn't find a tgetent() that supports the buffer 1124 # argument, look again to see whether we can find even 1125 # a crippled one. A crippled tgetent() is still useful to 1126 # validate values for the TERM environment variable given to 1127 # child processes. 1128 AC_CACHE_CHECK(for partial tgetent function,cf_cv_lib_part_tgetent,[ 1129 cf_cv_lib_part_tgetent=no 1130 for cf_termlib in $cf_TERMLIB ; do 1131 LIBS="$cf_save_LIBS -l$cf_termlib" 1132 AC_TRY_LINK([$cf_termcap_h],[tgetent(0, "$cf_TERMVAR")], 1133 [echo "there is a terminfo/tgetent in $cf_termlib" 1>&AC_FD_CC 1134 cf_cv_lib_part_tgetent="-l$cf_termlib" 1135 break]) 1136 done 1137 LIBS="$cf_save_LIBS" 1138 ]) 1139 1140 if test "$cf_cv_lib_part_tgetent" != no ; then 1141 CF_ADD_LIBS($cf_cv_lib_part_tgetent) 1142 # If this is linking against ncurses, we'll trigger the 1143 # ifdef in resize.c that turns the termcap stuff back off. 1144 AC_DEFINE(USE_TERMINFO,1,[Define to 1 to indicate that terminfo provides the tgetent interface]) 1145 fi 1146fi 1147])dnl 1148dnl --------------------------------------------------------------------------- 1149dnl CF_GCC_ATTRIBUTES version: 24 updated: 2021/03/20 12:00:25 1150dnl ----------------- 1151dnl Test for availability of useful gcc __attribute__ directives to quiet 1152dnl compiler warnings. Though useful, not all are supported -- and contrary 1153dnl to documentation, unrecognized directives cause older compilers to barf. 1154AC_DEFUN([CF_GCC_ATTRIBUTES], 1155[AC_REQUIRE([AC_PROG_FGREP])dnl 1156AC_REQUIRE([CF_C11_NORETURN])dnl 1157 1158if test "$GCC" = yes || test "$GXX" = yes 1159then 1160cat > conftest.i <<EOF 1161#ifndef GCC_PRINTF 1162#define GCC_PRINTF 0 1163#endif 1164#ifndef GCC_SCANF 1165#define GCC_SCANF 0 1166#endif 1167#ifndef GCC_NORETURN 1168#define GCC_NORETURN /* nothing */ 1169#endif 1170#ifndef GCC_UNUSED 1171#define GCC_UNUSED /* nothing */ 1172#endif 1173EOF 1174if test "$GCC" = yes 1175then 1176 AC_CHECKING([for $CC __attribute__ directives]) 1177cat > "conftest.$ac_ext" <<EOF 1178#line __oline__ "${as_me:-configure}" 1179#include <stdio.h> 1180#include "confdefs.h" 1181#include "conftest.h" 1182#include "conftest.i" 1183#if GCC_PRINTF 1184#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var))) 1185#else 1186#define GCC_PRINTFLIKE(fmt,var) /*nothing*/ 1187#endif 1188#if GCC_SCANF 1189#define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var))) 1190#else 1191#define GCC_SCANFLIKE(fmt,var) /*nothing*/ 1192#endif 1193extern void wow(char *,...) GCC_SCANFLIKE(1,2); 1194extern GCC_NORETURN void oops(char *,...) GCC_PRINTFLIKE(1,2); 1195extern GCC_NORETURN void foo(void); 1196int main(int argc GCC_UNUSED, char *argv[[]] GCC_UNUSED) { (void)argc; (void)argv; return 0; } 1197EOF 1198 cf_printf_attribute=no 1199 cf_scanf_attribute=no 1200 for cf_attribute in scanf printf unused noreturn 1201 do 1202 CF_UPPER(cf_ATTRIBUTE,$cf_attribute) 1203 cf_directive="__attribute__(($cf_attribute))" 1204 echo "checking for $CC $cf_directive" 1>&AC_FD_CC 1205 1206 case "$cf_attribute" in 1207 (printf) 1208 cf_printf_attribute=yes 1209 cat >conftest.h <<EOF 1210#define GCC_$cf_ATTRIBUTE 1 1211EOF 1212 ;; 1213 (scanf) 1214 cf_scanf_attribute=yes 1215 cat >conftest.h <<EOF 1216#define GCC_$cf_ATTRIBUTE 1 1217EOF 1218 ;; 1219 (*) 1220 cat >conftest.h <<EOF 1221#define GCC_$cf_ATTRIBUTE $cf_directive 1222EOF 1223 ;; 1224 esac 1225 1226 if AC_TRY_EVAL(ac_compile); then 1227 test -n "$verbose" && AC_MSG_RESULT(... $cf_attribute) 1228 cat conftest.h >>confdefs.h 1229 case "$cf_attribute" in 1230 (noreturn) 1231 AC_DEFINE_UNQUOTED(GCC_NORETURN,$cf_directive,[Define to noreturn-attribute for gcc]) 1232 ;; 1233 (printf) 1234 cf_value='/* nothing */' 1235 if test "$cf_printf_attribute" != no ; then 1236 cf_value='__attribute__((format(printf,fmt,var)))' 1237 AC_DEFINE(GCC_PRINTF,1,[Define to 1 if the compiler supports gcc-like printf attribute.]) 1238 fi 1239 AC_DEFINE_UNQUOTED(GCC_PRINTFLIKE(fmt,var),$cf_value,[Define to printf-attribute for gcc]) 1240 ;; 1241 (scanf) 1242 cf_value='/* nothing */' 1243 if test "$cf_scanf_attribute" != no ; then 1244 cf_value='__attribute__((format(scanf,fmt,var)))' 1245 AC_DEFINE(GCC_SCANF,1,[Define to 1 if the compiler supports gcc-like scanf attribute.]) 1246 fi 1247 AC_DEFINE_UNQUOTED(GCC_SCANFLIKE(fmt,var),$cf_value,[Define to sscanf-attribute for gcc]) 1248 ;; 1249 (unused) 1250 AC_DEFINE_UNQUOTED(GCC_UNUSED,$cf_directive,[Define to unused-attribute for gcc]) 1251 ;; 1252 esac 1253 fi 1254 done 1255else 1256 ${FGREP-fgrep} define conftest.i >>confdefs.h 1257fi 1258rm -rf ./conftest* 1259fi 1260])dnl 1261dnl --------------------------------------------------------------------------- 1262dnl CF_GCC_VERSION version: 8 updated: 2019/09/07 13:38:36 1263dnl -------------- 1264dnl Find version of gcc, and (because icc/clang pretend to be gcc without being 1265dnl compatible), attempt to determine if icc/clang is actually used. 1266AC_DEFUN([CF_GCC_VERSION],[ 1267AC_REQUIRE([AC_PROG_CC]) 1268GCC_VERSION=none 1269if test "$GCC" = yes ; then 1270 AC_MSG_CHECKING(version of $CC) 1271 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.]].*//'`" 1272 test -z "$GCC_VERSION" && GCC_VERSION=unknown 1273 AC_MSG_RESULT($GCC_VERSION) 1274fi 1275CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS) 1276CF_CLANG_COMPILER(GCC,CLANG_COMPILER,CFLAGS) 1277])dnl 1278dnl --------------------------------------------------------------------------- 1279dnl CF_GCC_WARNINGS version: 41 updated: 2021/01/01 16:53:59 1280dnl --------------- 1281dnl Check if the compiler supports useful warning options. There's a few that 1282dnl we don't use, simply because they're too noisy: 1283dnl 1284dnl -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x) 1285dnl -Winline (usually not worthwhile) 1286dnl -Wredundant-decls (system headers make this too noisy) 1287dnl -Wtraditional (combines too many unrelated messages, only a few useful) 1288dnl -Wwrite-strings (too noisy, but should review occasionally). This 1289dnl is enabled for ncurses using "--enable-const". 1290dnl -pedantic 1291dnl 1292dnl Parameter: 1293dnl $1 is an optional list of gcc warning flags that a particular 1294dnl application might want to use, e.g., "no-unused" for 1295dnl -Wno-unused 1296dnl Special: 1297dnl If $with_ext_const is "yes", add a check for -Wwrite-strings 1298dnl 1299AC_DEFUN([CF_GCC_WARNINGS], 1300[ 1301AC_REQUIRE([CF_GCC_VERSION]) 1302if test "x$have_x" = xyes; then CF_CONST_X_STRING fi 1303cat > "conftest.$ac_ext" <<EOF 1304#line __oline__ "${as_me:-configure}" 1305int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; } 1306EOF 1307if test "$INTEL_COMPILER" = yes 1308then 1309# The "-wdXXX" options suppress warnings: 1310# remark #1419: external declaration in primary source file 1311# remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem) 1312# remark #1684: conversion from pointer to same-sized integral type (potential portability problem) 1313# remark #193: zero used for undefined preprocessing identifier 1314# remark #593: variable "curs_sb_left_arrow" was set but never used 1315# remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits 1316# remark #869: parameter "tw" was never referenced 1317# remark #981: operands are evaluated in unspecified order 1318# warning #279: controlling expression is constant 1319 1320 AC_CHECKING([for $CC warning options]) 1321 cf_save_CFLAGS="$CFLAGS" 1322 EXTRA_CFLAGS="$EXTRA_CFLAGS -Wall" 1323 for cf_opt in \ 1324 wd1419 \ 1325 wd1683 \ 1326 wd1684 \ 1327 wd193 \ 1328 wd593 \ 1329 wd279 \ 1330 wd810 \ 1331 wd869 \ 1332 wd981 1333 do 1334 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" 1335 if AC_TRY_EVAL(ac_compile); then 1336 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt) 1337 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" 1338 fi 1339 done 1340 CFLAGS="$cf_save_CFLAGS" 1341elif test "$GCC" = yes && test "$GCC_VERSION" != "unknown" 1342then 1343 AC_CHECKING([for $CC warning options]) 1344 cf_save_CFLAGS="$CFLAGS" 1345 cf_warn_CONST="" 1346 test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings" 1347 cf_gcc_warnings="Wignored-qualifiers Wlogical-op Wvarargs" 1348 test "x$CLANG_COMPILER" = xyes && cf_gcc_warnings= 1349 for cf_opt in W Wall \ 1350 Wbad-function-cast \ 1351 Wcast-align \ 1352 Wcast-qual \ 1353 Wdeclaration-after-statement \ 1354 Wextra \ 1355 Winline \ 1356 Wmissing-declarations \ 1357 Wmissing-prototypes \ 1358 Wnested-externs \ 1359 Wpointer-arith \ 1360 Wshadow \ 1361 Wstrict-prototypes \ 1362 Wundef Wno-inline $cf_gcc_warnings $cf_warn_CONST $1 1363 do 1364 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" 1365 if AC_TRY_EVAL(ac_compile); then 1366 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt) 1367 case "$cf_opt" in 1368 (Winline) 1369 case "$GCC_VERSION" in 1370 ([[34]].*) 1371 CF_VERBOSE(feature is broken in gcc $GCC_VERSION) 1372 continue;; 1373 esac 1374 ;; 1375 (Wpointer-arith) 1376 case "$GCC_VERSION" in 1377 ([[12]].*) 1378 CF_VERBOSE(feature is broken in gcc $GCC_VERSION) 1379 continue;; 1380 esac 1381 ;; 1382 esac 1383 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" 1384 fi 1385 done 1386 CFLAGS="$cf_save_CFLAGS" 1387fi 1388rm -rf ./conftest* 1389 1390AC_SUBST(EXTRA_CFLAGS) 1391])dnl 1392dnl --------------------------------------------------------------------------- 1393dnl CF_GNU_SOURCE version: 10 updated: 2018/12/10 20:09:41 1394dnl ------------- 1395dnl Check if we must define _GNU_SOURCE to get a reasonable value for 1396dnl _XOPEN_SOURCE, upon which many POSIX definitions depend. This is a defect 1397dnl (or misfeature) of glibc2, which breaks portability of many applications, 1398dnl since it is interwoven with GNU extensions. 1399dnl 1400dnl Well, yes we could work around it... 1401dnl 1402dnl Parameters: 1403dnl $1 is the nominal value for _XOPEN_SOURCE 1404AC_DEFUN([CF_GNU_SOURCE], 1405[ 1406cf_gnu_xopen_source=ifelse($1,,500,$1) 1407 1408AC_CACHE_CHECK(if this is the GNU C library,cf_cv_gnu_library,[ 1409AC_TRY_COMPILE([#include <sys/types.h>],[ 1410 #if __GLIBC__ > 0 && __GLIBC_MINOR__ >= 0 1411 return 0; 1412 #elif __NEWLIB__ > 0 && __NEWLIB_MINOR__ >= 0 1413 return 0; 1414 #else 1415 # error not GNU C library 1416 #endif], 1417 [cf_cv_gnu_library=yes], 1418 [cf_cv_gnu_library=no]) 1419]) 1420 1421if test x$cf_cv_gnu_library = xyes; then 1422 1423 # With glibc 2.19 (13 years after this check was begun), _DEFAULT_SOURCE 1424 # was changed to help a little. newlib incorporated the change about 4 1425 # years later. 1426 AC_CACHE_CHECK(if _DEFAULT_SOURCE can be used as a basis,cf_cv_gnu_library_219,[ 1427 cf_save="$CPPFLAGS" 1428 CF_APPEND_TEXT(CPPFLAGS,-D_DEFAULT_SOURCE) 1429 AC_TRY_COMPILE([#include <sys/types.h>],[ 1430 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 19) || (__GLIBC__ > 2) 1431 return 0; 1432 #elif (__NEWLIB__ == 2 && __NEWLIB_MINOR__ >= 4) || (__GLIBC__ > 3) 1433 return 0; 1434 #else 1435 # error GNU C library __GLIBC__.__GLIBC_MINOR__ is too old 1436 #endif], 1437 [cf_cv_gnu_library_219=yes], 1438 [cf_cv_gnu_library_219=no]) 1439 CPPFLAGS="$cf_save" 1440 ]) 1441 1442 if test "x$cf_cv_gnu_library_219" = xyes; then 1443 cf_save="$CPPFLAGS" 1444 AC_CACHE_CHECK(if _XOPEN_SOURCE=$cf_gnu_xopen_source works with _DEFAULT_SOURCE,cf_cv_gnu_dftsrc_219,[ 1445 CF_ADD_CFLAGS(-D_DEFAULT_SOURCE -D_XOPEN_SOURCE=$cf_gnu_xopen_source) 1446 AC_TRY_COMPILE([ 1447 #include <limits.h> 1448 #include <sys/types.h> 1449 ],[ 1450 #if (_XOPEN_SOURCE >= $cf_gnu_xopen_source) && (MB_LEN_MAX > 1) 1451 return 0; 1452 #else 1453 # error GNU C library is too old 1454 #endif], 1455 [cf_cv_gnu_dftsrc_219=yes], 1456 [cf_cv_gnu_dftsrc_219=no]) 1457 ]) 1458 test "x$cf_cv_gnu_dftsrc_219" = "xyes" || CPPFLAGS="$cf_save" 1459 else 1460 cf_cv_gnu_dftsrc_219=maybe 1461 fi 1462 1463 if test "x$cf_cv_gnu_dftsrc_219" != xyes; then 1464 1465 AC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[ 1466 AC_TRY_COMPILE([#include <sys/types.h>],[ 1467 #ifndef _XOPEN_SOURCE 1468 #error expected _XOPEN_SOURCE to be defined 1469 #endif], 1470 [cf_cv_gnu_source=no], 1471 [cf_save="$CPPFLAGS" 1472 CF_ADD_CFLAGS(-D_GNU_SOURCE) 1473 AC_TRY_COMPILE([#include <sys/types.h>],[ 1474 #ifdef _XOPEN_SOURCE 1475 #error expected _XOPEN_SOURCE to be undefined 1476 #endif], 1477 [cf_cv_gnu_source=no], 1478 [cf_cv_gnu_source=yes]) 1479 CPPFLAGS="$cf_save" 1480 ]) 1481 ]) 1482 1483 if test "$cf_cv_gnu_source" = yes 1484 then 1485 AC_CACHE_CHECK(if we should also define _DEFAULT_SOURCE,cf_cv_default_source,[ 1486 CF_APPEND_TEXT(CPPFLAGS,-D_GNU_SOURCE) 1487 AC_TRY_COMPILE([#include <sys/types.h>],[ 1488 #ifdef _DEFAULT_SOURCE 1489 #error expected _DEFAULT_SOURCE to be undefined 1490 #endif], 1491 [cf_cv_default_source=no], 1492 [cf_cv_default_source=yes]) 1493 ]) 1494 if test "$cf_cv_default_source" = yes 1495 then 1496 CF_APPEND_TEXT(CPPFLAGS,-D_DEFAULT_SOURCE) 1497 fi 1498 fi 1499 fi 1500 1501fi 1502])dnl 1503dnl --------------------------------------------------------------------------- 1504dnl CF_HELP_MESSAGE version: 4 updated: 2019/12/31 08:53:54 1505dnl --------------- 1506dnl Insert text into the help-message, for readability, from AC_ARG_WITH. 1507AC_DEFUN([CF_HELP_MESSAGE], 1508[CF_ACVERSION_CHECK(2.53,[],[ 1509AC_DIVERT_HELP($1)])dnl 1510])dnl 1511dnl --------------------------------------------------------------------------- 1512dnl CF_IMAKE_CFLAGS version: 34 updated: 2020/12/31 18:40:20 1513dnl --------------- 1514dnl Use imake to obtain compiler flags. We could, in principle, write tests to 1515dnl get these, but if imake is properly configured there is no point in doing 1516dnl this. 1517dnl 1518dnl Parameters (used in constructing a sample Imakefile): 1519dnl $1 = optional value to append to $IMAKE_CFLAGS 1520dnl $2 = optional value to append to $IMAKE_LOADFLAGS 1521AC_DEFUN([CF_IMAKE_CFLAGS], 1522[ 1523AC_PATH_PROGS(IMAKE,xmkmf imake) 1524 1525if test -n "$IMAKE" ; then 1526 1527case $IMAKE in 1528(*/imake) 1529 cf_imake_opts="-DUseInstalled=YES" 1530 ;; 1531(*/util/xmkmf) 1532 # A single parameter tells xmkmf where the config-files are: 1533 cf_imake_opts="`echo "$IMAKE"|sed -e s,/config/util/xmkmf,,`" 1534 ;; 1535(*) 1536 cf_imake_opts= 1537 ;; 1538esac 1539 1540# If it's installed properly, imake (or its wrapper, xmkmf) will point to the 1541# config directory. 1542if mkdir conftestdir; then 1543 CDPATH=; export CDPATH 1544 cf_makefile=`cd "$srcdir" || exit;pwd`/Imakefile 1545 cd conftestdir 1546 1547 cat >fix_cflags.sed <<'CF_EOF' 1548s/\\//g 1549s/[[ ]][[ ]]*/ /g 1550s/"//g 1551:pack 1552s/\(=[[^ ]][[^ ]]*\) \([[^-]]\)/\1 \2/g 1553t pack 1554s/\(-D[[a-zA-Z0-9_]][[a-zA-Z0-9_]]*\)=\([[^\'0-9 ]][[^ ]]*\)/\1='\\"\2\\"'/g 1555s/^IMAKE[[ ]]/IMAKE_CFLAGS="/ 1556s/ / /g 1557s/$/"/ 1558CF_EOF 1559 1560 cat >fix_lflags.sed <<'CF_EOF' 1561s/^IMAKE[[ ]]*/IMAKE_LOADFLAGS="/ 1562s/$/"/ 1563CF_EOF 1564 1565 echo >./Imakefile 1566 test -f "$cf_makefile" && cat "$cf_makefile" >>./Imakefile 1567 1568 cat >> ./Imakefile <<'CF_EOF' 1569findstddefs: 1570 @echo IMAKE ${ALLDEFINES}ifelse([$1],,,[ $1]) | sed -f fix_cflags.sed 1571 @echo IMAKE ${EXTRA_LOAD_FLAGS}ifelse([$2],,,[ $2]) | sed -f fix_lflags.sed 1572CF_EOF 1573 1574 if ( $IMAKE "$cf_imake_opts" 1>/dev/null 2>&AC_FD_CC && test -f Makefile) 1575 then 1576 CF_VERBOSE(Using $IMAKE $cf_imake_opts) 1577 else 1578 # sometimes imake doesn't have the config path compiled in. Find it. 1579 cf_config= 1580 for cf_libpath in $X_LIBS $LIBS ; do 1581 case "$cf_libpath" in 1582 (-L*) 1583 cf_libpath=`echo ".$cf_libpath" | sed -e 's/^...//'` 1584 cf_libpath="$cf_libpath/X11/config" 1585 if test -d "$cf_libpath" ; then 1586 cf_config="$cf_libpath" 1587 break 1588 fi 1589 ;; 1590 esac 1591 done 1592 if test -z "$cf_config" ; then 1593 AC_MSG_WARN(Could not find imake config-directory) 1594 else 1595 cf_imake_opts="$cf_imake_opts -I$cf_config" 1596 if ( "$IMAKE" -v "$cf_imake_opts" 2>&AC_FD_CC) 1597 then 1598 CF_VERBOSE(Using $IMAKE $cf_config) 1599 else 1600 AC_MSG_WARN(Cannot run $IMAKE) 1601 fi 1602 fi 1603 fi 1604 1605 # GNU make sometimes prints "make[1]: Entering...", which 1606 # would confuse us. 1607 eval "`make findstddefs 2>/dev/null | grep -v make`" 1608 1609 cd .. 1610 rm -rf conftestdir 1611 1612 # We use ${ALLDEFINES} rather than ${STD_DEFINES} because the former 1613 # declares XTFUNCPROTO there. However, some vendors (e.g., SGI) have 1614 # modified it to support site.cf, adding a kludge for the /usr/include 1615 # directory. Try to filter that out, otherwise gcc won't find its 1616 # headers. 1617 if test -n "$GCC" ; then 1618 if test -n "$IMAKE_CFLAGS" ; then 1619 cf_nostdinc="" 1620 cf_std_incl="" 1621 cf_cpp_opts="" 1622 for cf_opt in $IMAKE_CFLAGS 1623 do 1624 case "$cf_opt" in 1625 (-nostdinc) 1626 cf_nostdinc="$cf_opt" 1627 ;; 1628 (-I/usr/include) 1629 cf_std_incl="$cf_opt" 1630 ;; 1631 (*) 1632 cf_cpp_opts="$cf_cpp_opts $cf_opt" 1633 ;; 1634 esac 1635 done 1636 if test -z "$cf_nostdinc" ; then 1637 IMAKE_CFLAGS="$cf_cpp_opts $cf_std_incl" 1638 elif test -z "$cf_std_incl" ; then 1639 IMAKE_CFLAGS="$cf_cpp_opts $cf_nostdinc" 1640 else 1641 CF_VERBOSE(suppressed \"$cf_nostdinc\" and \"$cf_std_incl\") 1642 IMAKE_CFLAGS="$cf_cpp_opts" 1643 fi 1644 fi 1645 fi 1646fi 1647 1648# Some imake configurations define PROJECTROOT with an empty value. Remove 1649# the empty definition. 1650case $IMAKE_CFLAGS in 1651(*-DPROJECTROOT=/*) 1652 ;; 1653(*) 1654 IMAKE_CFLAGS=`echo "$IMAKE_CFLAGS" |sed -e "s,-DPROJECTROOT=[[ ]], ,"` 1655 ;; 1656esac 1657 1658fi 1659 1660CF_VERBOSE(IMAKE_CFLAGS $IMAKE_CFLAGS) 1661CF_VERBOSE(IMAKE_LOADFLAGS $IMAKE_LOADFLAGS) 1662 1663AC_SUBST(IMAKE_CFLAGS) 1664AC_SUBST(IMAKE_LOADFLAGS) 1665])dnl 1666dnl --------------------------------------------------------------------------- 1667dnl CF_INPUT_METHOD version: 5 updated: 2021/06/07 17:39:17 1668dnl --------------- 1669dnl Check if the X libraries support input-method 1670AC_DEFUN([CF_INPUT_METHOD], 1671[ 1672AC_CACHE_CHECK([if X libraries support input-method],cf_cv_input_method,[ 1673AC_TRY_LINK([ 1674#include <X11/IntrinsicP.h> 1675#include <X11/Xatom.h> 1676#include <X11/Xutil.h> 1677#include <X11/Xmu/Atoms.h> 1678#include <X11/Xmu/Converters.h> 1679#include <X11/Xaw/XawImP.h> 1680],[ 1681{ 1682 XIM xim; 1683 XIMStyles *xim_styles = 0; 1684 XIMStyle input_style; 1685 Widget w = XtCreateWidget("none", (WidgetClass)0, None, (ArgList)0, 0); 1686 1687 XSetLocaleModifiers("@im=none"); 1688 xim = XOpenIM(XtDisplay(w), NULL, NULL, NULL); 1689 XGetIMValues(xim, XNQueryInputStyle, &xim_styles, NULL); 1690 XCloseIM(xim); 1691 input_style = (XIMPreeditNothing | XIMStatusNothing); 1692 (void)xim_styles; 1693 (void)input_style; 1694} 1695], 1696[cf_cv_input_method=yes], 1697[cf_cv_input_method=no])]) 1698])dnl 1699dnl --------------------------------------------------------------------------- 1700dnl CF_INTEL_COMPILER version: 9 updated: 2023/02/18 17:41:25 1701dnl ----------------- 1702dnl Check if the given compiler is really the Intel compiler for Linux. It 1703dnl tries to imitate gcc, but does not return an error when it finds a mismatch 1704dnl between prototypes, e.g., as exercised by CF_MISSING_CHECK. 1705dnl 1706dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to 1707dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from 1708dnl the wrappers for gcc and g++ warnings. 1709dnl 1710dnl $1 = GCC (default) or GXX 1711dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS 1712dnl $3 = CFLAGS (default) or CXXFLAGS 1713AC_DEFUN([CF_INTEL_COMPILER],[ 1714AC_REQUIRE([AC_CANONICAL_HOST]) 1715ifelse([$2],,INTEL_COMPILER,[$2])=no 1716 1717if test "$ifelse([$1],,[$1],GCC)" = yes ; then 1718 case "$host_os" in 1719 (linux*|gnu*) 1720 AC_MSG_CHECKING(if this is really Intel ifelse([$1],GXX,C++,C) compiler) 1721 cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])" 1722 ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -no-gcc" 1723 AC_TRY_COMPILE([],[ 1724#ifdef __INTEL_COMPILER 1725#else 1726#error __INTEL_COMPILER is not defined 1727#endif 1728],[ifelse([$2],,INTEL_COMPILER,[$2])=yes 1729cf_save_CFLAGS="$cf_save_CFLAGS -we147" 1730],[]) 1731 ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS" 1732 AC_MSG_RESULT($ifelse([$2],,INTEL_COMPILER,[$2])) 1733 ;; 1734 esac 1735fi 1736])dnl 1737dnl --------------------------------------------------------------------------- 1738dnl CF_LASTLOG version: 7 updated: 2021/01/02 09:31:20 1739dnl ---------- 1740dnl Check for header defining _PATH_LASTLOG, or failing that, see if the lastlog 1741dnl file exists. 1742AC_DEFUN([CF_LASTLOG], 1743[ 1744AC_CHECK_HEADERS(lastlog.h paths.h) 1745AC_CACHE_CHECK(for lastlog path,cf_cv_path_lastlog,[ 1746AC_TRY_COMPILE([ 1747#include <sys/types.h> 1748#ifdef HAVE_LASTLOG_H 1749#include <lastlog.h> 1750#else 1751#ifdef HAVE_PATHS_H 1752#include <paths.h> 1753#endif 1754#endif],[char *path = _PATH_LASTLOG; (void)path], 1755 [cf_cv_path_lastlog="_PATH_LASTLOG"], 1756 [if test -f /usr/adm/lastlog ; then 1757 cf_cv_path_lastlog=/usr/adm/lastlog 1758 else 1759 cf_cv_path_lastlog=no 1760 fi]) 1761]) 1762test "$cf_cv_path_lastlog" != no && AC_DEFINE(USE_LASTLOG,1,[Define to 1 if we can define lastlog pathname]) 1763])dnl 1764dnl --------------------------------------------------------------------------- 1765dnl CF_LD_RPATH_OPT version: 9 updated: 2021/01/01 13:31:04 1766dnl --------------- 1767dnl For the given system and compiler, find the compiler flags to pass to the 1768dnl loader to use the "rpath" feature. 1769AC_DEFUN([CF_LD_RPATH_OPT], 1770[ 1771AC_REQUIRE([CF_CHECK_CACHE]) 1772 1773LD_RPATH_OPT= 1774if test "x$cf_cv_enable_rpath" != xno 1775then 1776 AC_MSG_CHECKING(for an rpath option) 1777 case "$cf_cv_system_name" in 1778 (irix*) 1779 if test "$GCC" = yes; then 1780 LD_RPATH_OPT="-Wl,-rpath," 1781 else 1782 LD_RPATH_OPT="-rpath " 1783 fi 1784 ;; 1785 (linux*|gnu*|k*bsd*-gnu|freebsd*) 1786 LD_RPATH_OPT="-Wl,-rpath," 1787 ;; 1788 (openbsd[[2-9]].*|mirbsd*) 1789 LD_RPATH_OPT="-Wl,-rpath," 1790 ;; 1791 (dragonfly*) 1792 LD_RPATH_OPT="-rpath " 1793 ;; 1794 (netbsd*) 1795 LD_RPATH_OPT="-Wl,-rpath," 1796 ;; 1797 (osf*|mls+*) 1798 LD_RPATH_OPT="-rpath " 1799 ;; 1800 (solaris2*) 1801 LD_RPATH_OPT="-R" 1802 ;; 1803 (*) 1804 ;; 1805 esac 1806 AC_MSG_RESULT($LD_RPATH_OPT) 1807 1808 case "x$LD_RPATH_OPT" in 1809 (x-R*) 1810 AC_MSG_CHECKING(if we need a space after rpath option) 1811 cf_save_LIBS="$LIBS" 1812 CF_ADD_LIBS(${LD_RPATH_OPT}$libdir) 1813 AC_TRY_LINK(, , cf_rpath_space=no, cf_rpath_space=yes) 1814 LIBS="$cf_save_LIBS" 1815 AC_MSG_RESULT($cf_rpath_space) 1816 test "$cf_rpath_space" = yes && LD_RPATH_OPT="$LD_RPATH_OPT " 1817 ;; 1818 esac 1819fi 1820])dnl 1821dnl --------------------------------------------------------------------------- 1822dnl CF_MAKE_TAGS version: 6 updated: 2010/10/23 15:52:32 1823dnl ------------ 1824dnl Generate tags/TAGS targets for makefiles. Do not generate TAGS if we have 1825dnl a monocase filesystem. 1826AC_DEFUN([CF_MAKE_TAGS],[ 1827AC_REQUIRE([CF_MIXEDCASE_FILENAMES]) 1828 1829AC_CHECK_PROGS(CTAGS, exctags ctags) 1830AC_CHECK_PROGS(ETAGS, exetags etags) 1831 1832AC_CHECK_PROG(MAKE_LOWER_TAGS, ${CTAGS:-ctags}, yes, no) 1833 1834if test "$cf_cv_mixedcase" = yes ; then 1835 AC_CHECK_PROG(MAKE_UPPER_TAGS, ${ETAGS:-etags}, yes, no) 1836else 1837 MAKE_UPPER_TAGS=no 1838fi 1839 1840if test "$MAKE_UPPER_TAGS" = yes ; then 1841 MAKE_UPPER_TAGS= 1842else 1843 MAKE_UPPER_TAGS="#" 1844fi 1845 1846if test "$MAKE_LOWER_TAGS" = yes ; then 1847 MAKE_LOWER_TAGS= 1848else 1849 MAKE_LOWER_TAGS="#" 1850fi 1851 1852AC_SUBST(CTAGS) 1853AC_SUBST(ETAGS) 1854 1855AC_SUBST(MAKE_UPPER_TAGS) 1856AC_SUBST(MAKE_LOWER_TAGS) 1857])dnl 1858dnl --------------------------------------------------------------------------- 1859dnl CF_MATH_LIB version: 11 updated: 2022/07/27 19:01:48 1860dnl ----------- 1861dnl Checks for libraries. At least one UNIX system, Apple Macintosh 1862dnl Rhapsody 5.5, does not have -lm. We cannot use the simpler 1863dnl AC_CHECK_LIB(m,sin), because that fails for C++. 1864AC_DEFUN([CF_MATH_LIB], 1865[ 1866AC_CACHE_CHECK(if -lm needed for math functions, 1867 cf_cv_need_libm,[ 1868 AC_TRY_LINK([ 1869 #include <stdio.h> 1870 #include <stdlib.h> 1871 #include <math.h> 1872 ], 1873 [double x = rand(); printf("result = %g\\n", ]ifelse([$2],,sin(x),$2)[)], 1874 [cf_cv_need_libm=no], 1875 [cf_cv_need_libm=yes])]) 1876 1877if test "$cf_cv_need_libm" = yes 1878then 1879 1880 cf_save_LIBS="$LIBS" 1881 LIBS="$LIBS -lm" 1882 AC_CACHE_CHECK(if -lm is available for math functions, 1883 cf_cv_have_libm,[ 1884 AC_TRY_LINK([ 1885 #include <stdio.h> 1886 #include <stdlib.h> 1887 #include <math.h> 1888 ], 1889 [double x = rand(); printf("result = %g\\n", ]ifelse([$2],,sin(x),$2)[)], 1890 [cf_cv_have_libm=yes], 1891 [cf_cv_have_libm=no])]) 1892 LIBS="$cf_save_LIBS" 1893 1894 if test "$cf_cv_have_libm" = yes 1895 then 1896 ifelse($1,,[CF_ADD_LIB(m)],[$1=-lm]) 1897 fi 1898else 1899 cf_cv_have_libm=yes 1900fi 1901 1902if test "$cf_cv_have_libm" = yes 1903then 1904 AC_DEFINE(HAVE_MATH_FUNCS,1,[Define to 1 if math functions are available]) 1905fi 1906]) 1907dnl --------------------------------------------------------------------------- 1908dnl CF_MIXEDCASE_FILENAMES version: 9 updated: 2021/01/01 16:53:59 1909dnl ---------------------- 1910dnl Check if the file-system supports mixed-case filenames. If we're able to 1911dnl create a lowercase name and see it as uppercase, it doesn't support that. 1912AC_DEFUN([CF_MIXEDCASE_FILENAMES], 1913[ 1914AC_CACHE_CHECK(if filesystem supports mixed-case filenames,cf_cv_mixedcase,[ 1915if test "$cross_compiling" = yes ; then 1916 case "$target_alias" in 1917 (*-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-msys*|*-mingw*|*-uwin*|darwin*) 1918 cf_cv_mixedcase=no 1919 ;; 1920 (*) 1921 cf_cv_mixedcase=yes 1922 ;; 1923 esac 1924else 1925 rm -f conftest CONFTEST 1926 echo test >conftest 1927 if test -f CONFTEST ; then 1928 cf_cv_mixedcase=no 1929 else 1930 cf_cv_mixedcase=yes 1931 fi 1932 rm -f conftest CONFTEST 1933fi 1934]) 1935test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES,1,[Define to 1 if filesystem supports mixed-case filenames.]) 1936])dnl 1937dnl --------------------------------------------------------------------------- 1938dnl CF_MKSTEMP version: 12 updated: 2023/01/05 17:53:11 1939dnl ---------- 1940dnl Check for a working mkstemp. This creates two files, checks that they are 1941dnl successfully created and distinct (AmigaOS apparently fails on the last). 1942AC_DEFUN([CF_MKSTEMP],[ 1943AC_CHECK_HEADERS( \ 1944unistd.h \ 1945) 1946AC_CACHE_CHECK(for working mkstemp, cf_cv_func_mkstemp,[ 1947rm -rf ./conftest* 1948AC_TRY_RUN([ 1949$ac_includes_default 1950 1951int main(void) 1952{ 1953 char *tmpl = "conftestXXXXXX"; 1954 char name[2][80]; 1955 int n; 1956 int result = 0; 1957 int fd; 1958 struct stat sb; 1959 1960 umask(077); 1961 for (n = 0; n < 2; ++n) { 1962 strcpy(name[n], tmpl); 1963 if ((fd = mkstemp(name[n])) >= 0) { 1964 if (!strcmp(name[n], tmpl) 1965 || stat(name[n], &sb) != 0 1966 || (sb.st_mode & S_IFMT) != S_IFREG 1967 || (sb.st_mode & 077) != 0) { 1968 result = 1; 1969 } 1970 close(fd); 1971 } 1972 } 1973 if (result == 0 1974 && !strcmp(name[0], name[1])) 1975 result = 1; 1976 ${cf_cv_main_return:-return}(result); 1977} 1978],[cf_cv_func_mkstemp=yes 1979],[cf_cv_func_mkstemp=no 1980],[cf_cv_func_mkstemp=maybe]) 1981]) 1982if test "x$cf_cv_func_mkstemp" = xmaybe ; then 1983 AC_CHECK_FUNC(mkstemp) 1984fi 1985if test "x$cf_cv_func_mkstemp" = xyes || test "x$ac_cv_func_mkstemp" = xyes ; then 1986 AC_DEFINE(HAVE_MKSTEMP,1,[Define to 1 if mkstemp() is available and working.]) 1987fi 1988])dnl 1989dnl --------------------------------------------------------------------------- 1990dnl CF_MSG_LOG version: 5 updated: 2010/10/23 15:52:32 1991dnl ---------- 1992dnl Write a debug message to config.log, along with the line number in the 1993dnl configure script. 1994AC_DEFUN([CF_MSG_LOG],[ 1995echo "${as_me:-configure}:__oline__: testing $* ..." 1>&AC_FD_CC 1996])dnl 1997dnl --------------------------------------------------------------------------- 1998dnl CF_NO_LEAKS_OPTION version: 9 updated: 2021/06/13 19:45:41 1999dnl ------------------ 2000dnl see CF_WITH_NO_LEAKS 2001dnl 2002dnl $1 = option/name 2003dnl $2 = help-text 2004dnl $3 = symbol to define if the option is set 2005dnl $4 = additional actions to take if the option is set 2006AC_DEFUN([CF_NO_LEAKS_OPTION],[ 2007AC_MSG_CHECKING(if you want to use $1 for testing) 2008AC_ARG_WITH($1, 2009 [$2], 2010 [case "x$withval" in 2011 (x|xno) ;; 2012 (*) 2013 : "${with_cflags:=-g}" 2014 : "${enable_leaks:=no}" 2015 with_$1=yes 2016 AC_DEFINE_UNQUOTED($3,1,"Define to 1 if you want to use $1 for testing.")ifelse([$4],,[ 2017 $4 2018]) 2019 ;; 2020 esac], 2021 [with_$1=]) 2022AC_MSG_RESULT(${with_$1:-no}) 2023 2024case ".$with_cflags" in 2025(.*-g*) 2026 case .$CFLAGS in 2027 (.*-g*) 2028 ;; 2029 (*) 2030 CF_ADD_CFLAGS([-g]) 2031 ;; 2032 esac 2033 ;; 2034esac 2035])dnl 2036dnl --------------------------------------------------------------------------- 2037dnl CF_PATHSEP version: 8 updated: 2021/01/01 13:31:04 2038dnl ---------- 2039dnl Provide a value for the $PATH and similar separator (or amend the value 2040dnl as provided in autoconf 2.5x). 2041AC_DEFUN([CF_PATHSEP], 2042[ 2043 AC_MSG_CHECKING(for PATH separator) 2044 case "$cf_cv_system_name" in 2045 (os2*) PATH_SEPARATOR=';' ;; 2046 (*) ${PATH_SEPARATOR:=':'} ;; 2047 esac 2048ifelse([$1],,,[$1=$PATH_SEPARATOR]) 2049 AC_SUBST(PATH_SEPARATOR) 2050 AC_MSG_RESULT($PATH_SEPARATOR) 2051])dnl 2052dnl --------------------------------------------------------------------------- 2053dnl CF_PATH_PROG version: 12 updated: 2021/01/02 09:31:20 2054dnl ------------ 2055dnl Check for a given program, defining corresponding symbol. 2056dnl $1 = environment variable, which is suffixed by "_PATH" in the #define. 2057dnl $2 = program name to find. 2058dnl $3 = optional list of additional program names to test. 2059dnl $4 = $PATH 2060dnl 2061dnl If there is more than one token in the result, #define the remaining tokens 2062dnl to $1_ARGS. We need this for 'install' in particular. 2063dnl 2064dnl FIXME: we should allow this to be overridden by environment variables 2065dnl 2066AC_DEFUN([CF_PATH_PROG],[ 2067AC_REQUIRE([CF_PATHSEP]) 2068test -z "[$]$1" && $1="$2" 2069AC_PATH_PROGS($1,[$]$1 $2 ifelse($3,,,$3),[$]$1, ifelse($4,,,$4)) 2070 2071cf_path_prog="" 2072cf_path_args="" 2073IFS="${IFS:- }"; cf_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR" 2074for cf_temp in $ac_cv_path_$1 2075do 2076 if test -z "$cf_path_prog" ; then 2077 if test "$with_full_paths" = yes ; then 2078 CF_PATH_SYNTAX(cf_temp,break) 2079 cf_path_prog="$cf_temp" 2080 else 2081 cf_path_prog="`basename "$cf_temp"`" 2082 fi 2083 elif test -z "$cf_path_args" ; then 2084 cf_path_args="$cf_temp" 2085 else 2086 cf_path_args="$cf_path_args $cf_temp" 2087 fi 2088done 2089IFS="$cf_save_ifs" 2090 2091if test -n "$cf_path_prog" ; then 2092 CF_MSG_LOG(defining path for ${cf_path_prog}) 2093 AC_DEFINE_UNQUOTED($1_PATH,"$cf_path_prog",Define to pathname $1) 2094 test -n "$cf_path_args" && AC_DEFINE_UNQUOTED($1_ARGS,"$cf_path_args",Define to provide args for $1) 2095fi 2096])dnl 2097dnl --------------------------------------------------------------------------- 2098dnl CF_PATH_SYNTAX version: 18 updated: 2020/12/31 18:40:20 2099dnl -------------- 2100dnl Check the argument to see that it looks like a pathname. Rewrite it if it 2101dnl begins with one of the prefix/exec_prefix variables, and then again if the 2102dnl result begins with 'NONE'. This is necessary to work around autoconf's 2103dnl delayed evaluation of those symbols. 2104AC_DEFUN([CF_PATH_SYNTAX],[ 2105if test "x$prefix" != xNONE; then 2106 cf_path_syntax="$prefix" 2107else 2108 cf_path_syntax="$ac_default_prefix" 2109fi 2110 2111case ".[$]$1" in 2112(.\[$]\(*\)*|.\'*\'*) 2113 ;; 2114(..|./*|.\\*) 2115 ;; 2116(.[[a-zA-Z]]:[[\\/]]*) # OS/2 EMX 2117 ;; 2118(.\[$]\{*prefix\}*|.\[$]\{*dir\}*) 2119 eval $1="[$]$1" 2120 case ".[$]$1" in 2121 (.NONE/*) 2122 $1=`echo "[$]$1" | sed -e s%NONE%$cf_path_syntax%` 2123 ;; 2124 esac 2125 ;; 2126(.no|.NONE/*) 2127 $1=`echo "[$]$1" | sed -e s%NONE%$cf_path_syntax%` 2128 ;; 2129(*) 2130 ifelse([$2],,[AC_MSG_ERROR([expected a pathname, not \"[$]$1\"])],$2) 2131 ;; 2132esac 2133])dnl 2134dnl --------------------------------------------------------------------------- 2135dnl CF_PKG_CONFIG version: 12 updated: 2021/10/10 20:18:09 2136dnl ------------- 2137dnl Check for the package-config program, unless disabled by command-line. 2138dnl 2139dnl Sets $PKG_CONFIG to the pathname of the pkg-config program. 2140AC_DEFUN([CF_PKG_CONFIG], 2141[ 2142AC_MSG_CHECKING(if you want to use pkg-config) 2143AC_ARG_WITH(pkg-config, 2144 [ --with-pkg-config{=path} enable/disable use of pkg-config], 2145 [cf_pkg_config=$withval], 2146 [cf_pkg_config=yes]) 2147AC_MSG_RESULT($cf_pkg_config) 2148 2149case "$cf_pkg_config" in 2150(no) 2151 PKG_CONFIG=none 2152 ;; 2153(yes) 2154 CF_ACVERSION_CHECK(2.52, 2155 [AC_PATH_TOOL(PKG_CONFIG, pkg-config, none)], 2156 [AC_PATH_PROG(PKG_CONFIG, pkg-config, none)]) 2157 ;; 2158(*) 2159 PKG_CONFIG=$withval 2160 ;; 2161esac 2162 2163test -z "$PKG_CONFIG" && PKG_CONFIG=none 2164if test "$PKG_CONFIG" != none ; then 2165 CF_PATH_SYNTAX(PKG_CONFIG) 2166elif test "x$cf_pkg_config" != xno ; then 2167 AC_MSG_WARN(pkg-config is not installed) 2168fi 2169 2170AC_SUBST(PKG_CONFIG) 2171])dnl 2172dnl --------------------------------------------------------------------------- 2173dnl CF_POSIX_C_SOURCE version: 12 updated: 2023/02/18 17:41:25 2174dnl ----------------- 2175dnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed. 2176dnl 2177dnl POSIX.1-1990 _POSIX_SOURCE 2178dnl POSIX.1-1990 and _POSIX_SOURCE and 2179dnl POSIX.2-1992 C-Language _POSIX_C_SOURCE=2 2180dnl Bindings Option 2181dnl POSIX.1b-1993 _POSIX_C_SOURCE=199309L 2182dnl POSIX.1c-1996 _POSIX_C_SOURCE=199506L 2183dnl X/Open 2000 _POSIX_C_SOURCE=200112L 2184dnl 2185dnl Parameters: 2186dnl $1 is the nominal value for _POSIX_C_SOURCE 2187AC_DEFUN([CF_POSIX_C_SOURCE], 2188[AC_REQUIRE([CF_POSIX_VISIBLE])dnl 2189 2190if test "$cf_cv_posix_visible" = no; then 2191 2192cf_POSIX_C_SOURCE=ifelse([$1],,199506L,[$1]) 2193 2194cf_save_CFLAGS="$CFLAGS" 2195cf_save_CPPFLAGS="$CPPFLAGS" 2196 2197CF_REMOVE_DEFINE(cf_trim_CFLAGS,$cf_save_CFLAGS,_POSIX_C_SOURCE) 2198CF_REMOVE_DEFINE(cf_trim_CPPFLAGS,$cf_save_CPPFLAGS,_POSIX_C_SOURCE) 2199 2200AC_CACHE_CHECK(if we should define _POSIX_C_SOURCE,cf_cv_posix_c_source,[ 2201 CF_MSG_LOG(if the symbol is already defined go no further) 2202 AC_TRY_COMPILE([#include <sys/types.h>],[ 2203#ifndef _POSIX_C_SOURCE 2204#error _POSIX_C_SOURCE is not defined 2205#endif], 2206 [cf_cv_posix_c_source=no], 2207 [cf_want_posix_source=no 2208 case .$cf_POSIX_C_SOURCE in 2209 (.[[12]]??*) 2210 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" 2211 ;; 2212 (.2) 2213 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" 2214 cf_want_posix_source=yes 2215 ;; 2216 (.*) 2217 cf_want_posix_source=yes 2218 ;; 2219 esac 2220 if test "$cf_want_posix_source" = yes ; then 2221 AC_TRY_COMPILE([#include <sys/types.h>],[ 2222#ifdef _POSIX_SOURCE 2223#error _POSIX_SOURCE is defined 2224#endif],[], 2225 cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE") 2226 fi 2227 CF_MSG_LOG(ifdef from value $cf_POSIX_C_SOURCE) 2228 CFLAGS="$cf_trim_CFLAGS" 2229 CPPFLAGS="$cf_trim_CPPFLAGS" 2230 CF_APPEND_TEXT(CPPFLAGS,$cf_cv_posix_c_source) 2231 CF_MSG_LOG(if the second compile does not leave our definition intact error) 2232 AC_TRY_COMPILE([#include <sys/types.h>],[ 2233#ifndef _POSIX_C_SOURCE 2234#error _POSIX_C_SOURCE is not defined 2235#endif],, 2236 [cf_cv_posix_c_source=no]) 2237 CFLAGS="$cf_save_CFLAGS" 2238 CPPFLAGS="$cf_save_CPPFLAGS" 2239 ]) 2240]) 2241 2242if test "$cf_cv_posix_c_source" != no ; then 2243 CFLAGS="$cf_trim_CFLAGS" 2244 CPPFLAGS="$cf_trim_CPPFLAGS" 2245 CF_ADD_CFLAGS($cf_cv_posix_c_source) 2246fi 2247 2248fi # cf_cv_posix_visible 2249 2250])dnl 2251dnl --------------------------------------------------------------------------- 2252dnl CF_POSIX_SAVED_IDS version: 10 updated: 2023/01/05 17:53:42 2253dnl ------------------ 2254dnl 2255dnl Check first if saved-ids are always supported. Some systems 2256dnl may require runtime checks. 2257AC_DEFUN([CF_POSIX_SAVED_IDS], 2258[ 2259AC_CHECK_HEADERS( \ 2260sys/param.h \ 2261) 2262 2263AC_CACHE_CHECK(if POSIX saved-ids are supported,cf_cv_posix_saved_ids,[ 2264AC_TRY_LINK( 2265[ 2266#include <unistd.h> 2267#ifdef HAVE_SYS_PARAM_H 2268#include <sys/param.h> /* this may define "BSD" */ 2269#endif 2270],[ 2271#if defined(_POSIX_SAVED_IDS) && (_POSIX_SAVED_IDS > 0) 2272 void *p = (void *) seteuid; 2273 int x = seteuid(geteuid()); 2274 (void)p; 2275 (void)x; 2276#elif defined(BSD) && (BSD >= 199103) 2277/* The BSD's may implement the runtime check - and it fails. 2278 * However, saved-ids work almost like POSIX (close enough for most uses). 2279 */ 2280#else 2281make an error 2282#endif 2283],[cf_cv_posix_saved_ids=yes 2284],[ 2285AC_TRY_RUN([ 2286$ac_includes_default 2287 2288int main(void) 2289{ 2290 void *p = (void *) seteuid; 2291 long code = sysconf(_SC_SAVED_IDS); 2292 (void)p; 2293 ${cf_cv_main_return:-return} ((code > 0) ? 0 : 1); 2294}], 2295 cf_cv_posix_saved_ids=yes, 2296 cf_cv_posix_saved_ids=no, 2297 cf_cv_posix_saved_ids=unknown) 2298]) 2299]) 2300 2301test "$cf_cv_posix_saved_ids" = yes && AC_DEFINE(HAVE_POSIX_SAVED_IDS,1,[Define to 1 if POSIX saved-ids are supported]) 2302]) 2303dnl --------------------------------------------------------------------------- 2304dnl CF_POSIX_VISIBLE version: 1 updated: 2018/12/31 20:46:17 2305dnl ---------------- 2306dnl POSIX documents test-macros which an application may set before any system 2307dnl headers are included to make features available. 2308dnl 2309dnl Some BSD platforms (originally FreeBSD, but copied by a few others) 2310dnl diverged from POSIX in 2002 by setting symbols which make all of the most 2311dnl recent features visible in the system header files unless the application 2312dnl overrides the corresponding test-macros. Doing that introduces portability 2313dnl problems. 2314dnl 2315dnl This macro makes a special check for the symbols used for this, to avoid a 2316dnl conflicting definition. 2317AC_DEFUN([CF_POSIX_VISIBLE], 2318[ 2319AC_CACHE_CHECK(if the POSIX test-macros are already defined,cf_cv_posix_visible,[ 2320AC_TRY_COMPILE([#include <stdio.h>],[ 2321#if defined(__POSIX_VISIBLE) && ((__POSIX_VISIBLE - 0L) > 0) \ 2322 && defined(__XSI_VISIBLE) && ((__XSI_VISIBLE - 0L) > 0) \ 2323 && defined(__BSD_VISIBLE) && ((__BSD_VISIBLE - 0L) > 0) \ 2324 && defined(__ISO_C_VISIBLE) && ((__ISO_C_VISIBLE - 0L) > 0) 2325#error conflicting symbols found 2326#endif 2327],[cf_cv_posix_visible=no],[cf_cv_posix_visible=yes]) 2328]) 2329])dnl 2330dnl --------------------------------------------------------------------------- 2331dnl CF_POSIX_WAIT version: 5 updated: 2023/01/05 19:26:07 2332dnl ------------- 2333dnl Check for POSIX wait support 2334AC_DEFUN([CF_POSIX_WAIT], 2335[ 2336AC_REQUIRE([AC_HEADER_SYS_WAIT]) 2337AC_CACHE_CHECK(for POSIX wait functions,cf_cv_posix_wait,[ 2338AC_TRY_LINK([ 2339$ac_includes_default 2340 2341#ifdef HAVE_SYS_WAIT_H 2342#include <sys/wait.h> 2343#endif 2344],[ 2345 int stat_loc; 2346 pid_t pid = waitpid(-1, &stat_loc, WNOHANG|WUNTRACED); 2347 pid_t pid2 = wait(&stat_loc); 2348 (void)pid; 2349 (void)pid2; 2350], 2351[cf_cv_posix_wait=yes], 2352[cf_cv_posix_wait=no]) 2353]) 2354test "$cf_cv_posix_wait" = yes && AC_DEFINE(USE_POSIX_WAIT,1,[Define to 1 if we have POSIX wait functions]) 2355])dnl 2356dnl --------------------------------------------------------------------------- 2357dnl CF_PROCFS_CWD version: 4 updated: 2020/12/31 18:40:20 2358dnl ------------- 2359dnl Find /proc tree (may be in a different place) which implements the "cwd" 2360dnl link. 2361AC_DEFUN([CF_PROCFS_CWD],[ 2362AC_CACHE_CHECK(for proc tree with cwd-support,cf_cv_procfs_cwd,[ 2363cf_cv_procfs_cwd=no 2364for cf_path in /proc /compat/linux/proc /usr/compat/linux/proc 2365do 2366 if test -d "$cf_path" && \ 2367 test -d "$cf_path"/$$ && \ 2368 { test -d "$cf_path"/$$/cwd || \ 2369 test -L "$cf_path"/$$/cwd; }; then 2370 cf_cv_procfs_cwd="$cf_path" 2371 break 2372 fi 2373done 2374]) 2375])dnl 2376dnl --------------------------------------------------------------------------- 2377dnl CF_PROG_CC version: 5 updated: 2019/12/31 08:53:54 2378dnl ---------- 2379dnl standard check for CC, plus followup sanity checks 2380dnl $1 = optional parameter to pass to AC_PROG_CC to specify compiler name 2381AC_DEFUN([CF_PROG_CC],[ 2382CF_ACVERSION_CHECK(2.53, 2383 [AC_MSG_WARN(this will incorrectly handle gnatgcc choice) 2384 AC_REQUIRE([AC_PROG_CC])], 2385 []) 2386ifelse($1,,[AC_PROG_CC],[AC_PROG_CC($1)]) 2387CF_GCC_VERSION 2388CF_ACVERSION_CHECK(2.52, 2389 [AC_PROG_CC_STDC], 2390 [CF_ANSI_CC_REQD]) 2391CF_CC_ENV_FLAGS 2392])dnl 2393dnl --------------------------------------------------------------------------- 2394dnl CF_PROG_GROFF version: 3 updated: 2018/01/07 13:16:19 2395dnl ------------- 2396dnl Check if groff is available, for cases (such as html output) where nroff 2397dnl is not enough. 2398AC_DEFUN([CF_PROG_GROFF],[ 2399AC_PATH_PROG(GROFF_PATH,groff,no) 2400AC_PATH_PROGS(NROFF_PATH,nroff mandoc,no) 2401AC_PATH_PROG(TBL_PATH,tbl,cat) 2402if test "x$GROFF_PATH" = xno 2403then 2404 NROFF_NOTE= 2405 GROFF_NOTE="#" 2406else 2407 NROFF_NOTE="#" 2408 GROFF_NOTE= 2409fi 2410AC_SUBST(GROFF_NOTE) 2411AC_SUBST(NROFF_NOTE) 2412])dnl 2413dnl --------------------------------------------------------------------------- 2414dnl CF_PROG_LINT version: 5 updated: 2022/08/20 15:44:13 2415dnl ------------ 2416AC_DEFUN([CF_PROG_LINT], 2417[ 2418AC_CHECK_PROGS(LINT, lint cppcheck splint) 2419case "x$LINT" in 2420(xcppcheck|x*/cppcheck) 2421 test -z "$LINT_OPTS" && LINT_OPTS="--enable=all" 2422 ;; 2423esac 2424AC_SUBST(LINT_OPTS) 2425AC_SUBST(LINT_LIBS) 2426])dnl 2427dnl --------------------------------------------------------------------------- 2428dnl CF_REGEX version: 18 updated: 2021/01/01 16:53:59 2429dnl -------- 2430dnl Attempt to determine if we've got one of the flavors of regular-expression 2431dnl code that we can support. 2432AC_DEFUN([CF_REGEX], 2433[ 2434 2435cf_regex_func=no 2436cf_regex_libs= 2437case "$host_os" in 2438(mingw*) 2439 # -lsystre -ltre -lintl -liconv 2440 AC_CHECK_LIB(systre,regcomp,[ 2441 AC_CHECK_LIB(iconv,libiconv_open,[CF_ADD_LIB(iconv)]) 2442 AC_CHECK_LIB(intl,libintl_gettext,[CF_ADD_LIB(intl)]) 2443 AC_CHECK_LIB(tre,tre_regcomp,[CF_ADD_LIB(tre)]) 2444 CF_ADD_LIB(systre) 2445 cf_regex_func=regcomp 2446 ],[ 2447 AC_CHECK_LIB(gnurx,regcomp,[ 2448 CF_ADD_LIB(gnurx) 2449 cf_regex_func=regcomp]) 2450 ]) 2451 ;; 2452(*) 2453 cf_regex_libs="regex re" 2454 AC_CHECK_FUNC(regcomp,[cf_regex_func=regcomp],[ 2455 for cf_regex_lib in $cf_regex_libs 2456 do 2457 AC_CHECK_LIB($cf_regex_lib,regcomp,[ 2458 CF_ADD_LIB($cf_regex_lib) 2459 cf_regex_func=regcomp 2460 break]) 2461 done 2462 ]) 2463 ;; 2464esac 2465 2466if test "$cf_regex_func" = no ; then 2467 AC_CHECK_FUNC(compile,[cf_regex_func=compile],[ 2468 AC_CHECK_LIB(gen,compile,[ 2469 CF_ADD_LIB(gen) 2470 cf_regex_func=compile])]) 2471fi 2472 2473if test "$cf_regex_func" = no ; then 2474 AC_MSG_WARN(cannot find regular expression library) 2475fi 2476 2477AC_CACHE_CHECK(for regular-expression headers,cf_cv_regex_hdrs,[ 2478 2479cf_cv_regex_hdrs=no 2480case "$cf_regex_func" in 2481(compile) 2482 for cf_regex_hdr in regexp.h regexpr.h 2483 do 2484 AC_TRY_LINK([#include <$cf_regex_hdr>],[ 2485 char *p = compile("", "", "", 0); 2486 int x = step("", ""); 2487 (void)p; 2488 (void)x; 2489 ],[ 2490 cf_cv_regex_hdrs=$cf_regex_hdr 2491 break 2492 ]) 2493 done 2494 ;; 2495(*) 2496 for cf_regex_hdr in regex.h 2497 do 2498 AC_TRY_LINK([#include <sys/types.h> 2499#include <$cf_regex_hdr>],[ 2500 regex_t *p = 0; 2501 int x = regcomp(p, "", 0); 2502 int y = regexec(p, "", 0, 0, 0); 2503 (void)x; 2504 (void)y; 2505 regfree(p); 2506 ],[ 2507 cf_cv_regex_hdrs=$cf_regex_hdr 2508 break 2509 ]) 2510 done 2511 ;; 2512esac 2513 2514]) 2515 2516case "$cf_cv_regex_hdrs" in 2517 (no) AC_MSG_WARN(no regular expression header found) ;; 2518 (regex.h) AC_DEFINE(HAVE_REGEX_H_FUNCS,1,[Define to 1 to include regex.h for regular expressions]) ;; 2519 (regexp.h) AC_DEFINE(HAVE_REGEXP_H_FUNCS,1,[Define to 1 to include regexp.h for regular expressions]) ;; 2520 (regexpr.h) AC_DEFINE(HAVE_REGEXPR_H_FUNCS,1,[Define to 1 to include regexpr.h for regular expressions]) ;; 2521esac 2522])dnl 2523dnl --------------------------------------------------------------------------- 2524dnl CF_REMOVE_CFLAGS version: 3 updated: 2021/09/05 17:25:40 2525dnl ---------------- 2526dnl Remove a given option from CFLAGS/CPPFLAGS 2527dnl $1 = option to remove 2528dnl $2 = variable to update 2529dnl $3 = nonempty to allow verbose message 2530define([CF_REMOVE_CFLAGS], 2531[ 2532cf_tmp_cflag=`echo "x$1" | sed -e 's/^.//' -e 's/=.*//'` 2533while true 2534do 2535 cf_old_cflag=`echo "x[$]$2" | sed -e 's/^.//' -e 's/[[ ]][[ ]]*-/ -/g' -e "s%$cf_tmp_cflag\\(=[[^ ]][[^ ]]*\\)\?%%" -e 's/^[[ ]]*//' -e 's%[[ ]][[ ]]*-D% -D%g' -e 's%[[ ]][[ ]]*-I% -I%g'` 2536 test "[$]$2" != "$cf_old_cflag" || break 2537 ifelse([$3],,,[CF_VERBOSE(removing old option $1 from $2)]) 2538 $2="$cf_old_cflag" 2539done 2540])dnl 2541dnl --------------------------------------------------------------------------- 2542dnl CF_REMOVE_DEFINE version: 3 updated: 2010/01/09 11:05:50 2543dnl ---------------- 2544dnl Remove all -U and -D options that refer to the given symbol from a list 2545dnl of C compiler options. This works around the problem that not all 2546dnl compilers process -U and -D options from left-to-right, so a -U option 2547dnl cannot be used to cancel the effect of a preceding -D option. 2548dnl 2549dnl $1 = target (which could be the same as the source variable) 2550dnl $2 = source (including '$') 2551dnl $3 = symbol to remove 2552define([CF_REMOVE_DEFINE], 2553[ 2554$1=`echo "$2" | \ 2555 sed -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[[ ]]/ /g' \ 2556 -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[$]//g'` 2557])dnl 2558dnl --------------------------------------------------------------------------- 2559dnl CF_RESTORE_XTRA_FLAGS version: 1 updated: 2020/01/11 16:47:45 2560dnl --------------------- 2561dnl Restore flags saved in CF_SAVE_XTRA_FLAGS 2562dnl $1 = name of current macro 2563define([CF_RESTORE_XTRA_FLAGS], 2564[ 2565LIBS="$cf_save_LIBS_$1" 2566CFLAGS="$cf_save_CFLAGS_$1" 2567CPPFLAGS="$cf_save_CPPFLAGS_$1" 2568])dnl 2569dnl --------------------------------------------------------------------------- 2570dnl CF_RPATH_HACK version: 13 updated: 2021/01/03 18:30:50 2571dnl ------------- 2572AC_DEFUN([CF_RPATH_HACK], 2573[AC_REQUIRE([AC_PROG_FGREP])dnl 2574AC_REQUIRE([CF_LD_RPATH_OPT])dnl 2575 2576AC_MSG_CHECKING(for updated LDFLAGS) 2577if test -n "$LD_RPATH_OPT" ; then 2578 AC_MSG_RESULT(maybe) 2579 2580 AC_CHECK_PROGS(cf_ldd_prog,ldd,no) 2581 cf_rpath_list="/usr/lib /lib" 2582 if test "$cf_ldd_prog" != no 2583 then 2584 cf_rpath_oops= 2585 2586AC_TRY_LINK([#include <stdio.h>], 2587 [printf("Hello");], 2588 [cf_rpath_oops=`"$cf_ldd_prog" "conftest$ac_exeext" | ${FGREP-fgrep} ' not found' | sed -e 's% =>.*$%%' |sort | uniq` 2589 cf_rpath_list=`"$cf_ldd_prog" "conftest$ac_exeext" | ${FGREP-fgrep} / | sed -e 's%^.*[[ ]]/%/%' -e 's%/[[^/]][[^/]]*$%%' |sort | uniq`]) 2590 2591 # If we passed the link-test, but get a "not found" on a given library, 2592 # this could be due to inept reconfiguration of gcc to make it only 2593 # partly honor /usr/local/lib (or whatever). Sometimes this behavior 2594 # is intentional, e.g., installing gcc in /usr/bin and suppressing the 2595 # /usr/local libraries. 2596 if test -n "$cf_rpath_oops" 2597 then 2598 for cf_rpath_src in $cf_rpath_oops 2599 do 2600 for cf_rpath_dir in \ 2601 /usr/local \ 2602 /usr/pkg \ 2603 /opt/sfw 2604 do 2605 if test -f "$cf_rpath_dir/lib/$cf_rpath_src" 2606 then 2607 CF_VERBOSE(...adding -L$cf_rpath_dir/lib to LDFLAGS for $cf_rpath_src) 2608 LDFLAGS="$LDFLAGS -L$cf_rpath_dir/lib" 2609 break 2610 fi 2611 done 2612 done 2613 fi 2614 fi 2615 2616 CF_VERBOSE(...checking EXTRA_LDFLAGS $EXTRA_LDFLAGS) 2617 2618 CF_RPATH_HACK_2(LDFLAGS) 2619 CF_RPATH_HACK_2(LIBS) 2620 2621 CF_VERBOSE(...checked EXTRA_LDFLAGS $EXTRA_LDFLAGS) 2622else 2623 AC_MSG_RESULT(no) 2624fi 2625AC_SUBST(EXTRA_LDFLAGS) 2626])dnl 2627dnl --------------------------------------------------------------------------- 2628dnl CF_RPATH_HACK_2 version: 8 updated: 2021/01/01 13:31:04 2629dnl --------------- 2630dnl Do one set of substitutions for CF_RPATH_HACK, adding an rpath option to 2631dnl EXTRA_LDFLAGS for each -L option found. 2632dnl 2633dnl $cf_rpath_list contains a list of directories to ignore. 2634dnl 2635dnl $1 = variable name to update. The LDFLAGS variable should be the only one, 2636dnl but LIBS often has misplaced -L options. 2637AC_DEFUN([CF_RPATH_HACK_2], 2638[ 2639CF_VERBOSE(...checking $1 [$]$1) 2640 2641cf_rpath_dst= 2642for cf_rpath_src in [$]$1 2643do 2644 case "$cf_rpath_src" in 2645 (-L*) 2646 2647 # check if this refers to a directory which we will ignore 2648 cf_rpath_skip=no 2649 if test -n "$cf_rpath_list" 2650 then 2651 for cf_rpath_item in $cf_rpath_list 2652 do 2653 if test "x$cf_rpath_src" = "x-L$cf_rpath_item" 2654 then 2655 cf_rpath_skip=yes 2656 break 2657 fi 2658 done 2659 fi 2660 2661 if test "$cf_rpath_skip" = no 2662 then 2663 # transform the option 2664 if test "$LD_RPATH_OPT" = "-R " ; then 2665 cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%-R %"` 2666 else 2667 cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%$LD_RPATH_OPT%"` 2668 fi 2669 2670 # if we have not already added this, add it now 2671 cf_rpath_tst=`echo "$EXTRA_LDFLAGS" | sed -e "s%$cf_rpath_tmp %%"` 2672 if test "x$cf_rpath_tst" = "x$EXTRA_LDFLAGS" 2673 then 2674 CF_VERBOSE(...Filter $cf_rpath_src ->$cf_rpath_tmp) 2675 EXTRA_LDFLAGS="$cf_rpath_tmp $EXTRA_LDFLAGS" 2676 fi 2677 fi 2678 ;; 2679 esac 2680 cf_rpath_dst="$cf_rpath_dst $cf_rpath_src" 2681done 2682$1=$cf_rpath_dst 2683 2684CF_VERBOSE(...checked $1 [$]$1) 2685AC_SUBST(EXTRA_LDFLAGS) 2686])dnl 2687dnl --------------------------------------------------------------------------- 2688dnl CF_SAVE_XTRA_FLAGS version: 1 updated: 2020/01/11 16:46:44 2689dnl ------------------ 2690dnl Use this macro to save CFLAGS/CPPFLAGS/LIBS before checks against X headers 2691dnl and libraries which do not update those variables. 2692dnl 2693dnl $1 = name of current macro 2694define([CF_SAVE_XTRA_FLAGS], 2695[ 2696cf_save_LIBS_$1="$LIBS" 2697cf_save_CFLAGS_$1="$CFLAGS" 2698cf_save_CPPFLAGS_$1="$CPPFLAGS" 2699LIBS="$LIBS ${X_PRE_LIBS} ${X_LIBS} ${X_EXTRA_LIBS}" 2700for cf_X_CFLAGS in $X_CFLAGS 2701do 2702 case "x$cf_X_CFLAGS" in 2703 x-[[IUD]]*) 2704 CPPFLAGS="$CPPFLAGS $cf_X_CFLAGS" 2705 ;; 2706 *) 2707 CFLAGS="$CFLAGS $cf_X_CFLAGS" 2708 ;; 2709 esac 2710done 2711])dnl 2712dnl --------------------------------------------------------------------------- 2713dnl CF_SETITIMER version: 1 updated: 2023/01/25 19:55:24 2714dnl ------------ 2715AC_DEFUN([CF_SETITIMER], 2716[ 2717AC_CACHE_CHECK(if setitimer is available,cf_cv_func_setitimer,[ 2718AC_TRY_COMPILE([ 2719$ac_includes_default 2720#include <sys/time.h> 2721],[ 2722 struct itimerval it; 2723 memset(&it, 0, sizeof(struct itimerval)); 2724 it.it_value.tv_sec = 1; 2725 setitimer(ITIMER_REAL, &it, NULL); 2726], 2727[cf_cv_func_setitimer=yes], 2728[cf_cv_func_setitimer=no]) 2729]) 2730test "$cf_cv_func_setitimer" != no && AC_DEFINE(HAVE_SETITIMER,1,[Define to 1 if setitimer is available]) 2731])dnl 2732dnl --------------------------------------------------------------------------- 2733dnl CF_SIGWINCH version: 7 updated: 2023/02/18 17:41:25 2734dnl ----------- 2735dnl Use this macro after CF_XOPEN_SOURCE, but do not require it (not all 2736dnl programs need this test). 2737dnl 2738dnl This is really a Mac OS X 10.4.3 workaround. Defining _POSIX_C_SOURCE 2739dnl forces SIGWINCH to be undefined (breaks xterm, ncurses). Oddly, the struct 2740dnl winsize declaration is left alone - we may revisit this if Apple choose to 2741dnl break that part of the interface as well. 2742AC_DEFUN([CF_SIGWINCH], 2743[ 2744AC_CACHE_CHECK(if SIGWINCH is defined,cf_cv_define_sigwinch,[ 2745 AC_TRY_COMPILE([ 2746#include <sys/types.h> 2747#include <sys/signal.h> 2748],[int x = SIGWINCH; (void)x], 2749 [cf_cv_define_sigwinch=yes], 2750 [AC_TRY_COMPILE([ 2751#undef _XOPEN_SOURCE 2752#undef _POSIX_SOURCE 2753#undef _POSIX_C_SOURCE 2754#include <sys/types.h> 2755#include <sys/signal.h> 2756],[int x = SIGWINCH; (void)x], 2757 [cf_cv_define_sigwinch=maybe], 2758 [cf_cv_define_sigwinch=no]) 2759]) 2760]) 2761 2762if test "$cf_cv_define_sigwinch" = maybe ; then 2763AC_CACHE_CHECK(for actual SIGWINCH definition,cf_cv_fixup_sigwinch,[ 2764cf_cv_fixup_sigwinch=unknown 2765cf_sigwinch=32 2766while test "$cf_sigwinch" != 1 2767do 2768 AC_TRY_COMPILE([ 2769#undef _XOPEN_SOURCE 2770#undef _POSIX_SOURCE 2771#undef _POSIX_C_SOURCE 2772#include <sys/types.h> 2773#include <sys/signal.h> 2774],[ 2775#if SIGWINCH != $cf_sigwinch 2776#error SIGWINCH is not $cf_sigwinch 2777#endif 2778int x = SIGWINCH; (void)x], 2779 [cf_cv_fixup_sigwinch=$cf_sigwinch 2780 break]) 2781 2782cf_sigwinch="`expr "$cf_sigwinch" - 1`" 2783done 2784]) 2785 2786 if test "$cf_cv_fixup_sigwinch" != unknown ; then 2787 CPPFLAGS="$CPPFLAGS -DSIGWINCH=$cf_cv_fixup_sigwinch" 2788 fi 2789fi 2790])dnl 2791dnl --------------------------------------------------------------------------- 2792dnl CF_SIG_ATOMIC_T version: 5 updated: 2020/03/10 18:53:47 2793dnl --------------- 2794dnl signal handler, but there are some gcc dependencies in that recommendation. 2795dnl Try anyway. 2796AC_DEFUN([CF_SIG_ATOMIC_T], 2797[ 2798AC_MSG_CHECKING(for signal global datatype) 2799AC_CACHE_VAL(cf_cv_sig_atomic_t,[ 2800 for cf_type in \ 2801 "volatile sig_atomic_t" \ 2802 "sig_atomic_t" \ 2803 "int" 2804 do 2805 AC_TRY_COMPILE([ 2806#include <sys/types.h> 2807#include <signal.h> 2808#include <stdio.h> 2809 2810extern $cf_type x; 2811$cf_type x; 2812static void handler(int sig) 2813{ 2814 (void)sig; 2815 x = 5; 2816}], 2817 [signal(SIGINT, handler); 2818 x = 1], 2819 [cf_cv_sig_atomic_t=$cf_type], 2820 [cf_cv_sig_atomic_t=no]) 2821 test "$cf_cv_sig_atomic_t" != no && break 2822 done 2823 ]) 2824AC_MSG_RESULT($cf_cv_sig_atomic_t) 2825test "$cf_cv_sig_atomic_t" != no && AC_DEFINE_UNQUOTED(SIG_ATOMIC_T, $cf_cv_sig_atomic_t,[Define to signal global datatype]) 2826])dnl 2827dnl --------------------------------------------------------------------------- 2828dnl CF_STRUCT_LASTLOG version: 4 updated: 2023/01/05 17:56:31 2829dnl ----------------- 2830dnl Check for header defining struct lastlog, ensure that its .ll_time member 2831dnl is compatible with time(). 2832AC_DEFUN([CF_STRUCT_LASTLOG], 2833[ 2834AC_CHECK_HEADERS(lastlog.h) 2835AC_CACHE_CHECK(for struct lastlog,cf_cv_struct_lastlog,[ 2836AC_TRY_RUN([ 2837$ac_includes_default 2838 2839#include <time.h> 2840#include <lastlog.h> 2841 2842int main(void) 2843{ 2844 struct lastlog data; 2845 return (sizeof(data.ll_time) != sizeof(time_t)); 2846}],[ 2847cf_cv_struct_lastlog=yes],[ 2848cf_cv_struct_lastlog=no],[ 2849cf_cv_struct_lastlog=unknown])]) 2850 2851test $cf_cv_struct_lastlog != no && AC_DEFINE(USE_STRUCT_LASTLOG,1,[Define to 1 if we have struct lastlog]) 2852])dnl 2853dnl --------------------------------------------------------------------------- 2854dnl CF_SVR4 version: 5 updated: 2012/10/04 05:24:07 2855dnl ------- 2856dnl Check if this is an SVR4 system. We need the definition for xterm 2857AC_DEFUN([CF_SVR4], 2858[ 2859AC_CHECK_LIB(elf, elf_begin,[ 2860AC_CACHE_CHECK(if this is an SVR4 system, cf_cv_svr4,[ 2861AC_TRY_COMPILE([ 2862#if defined(__CYGWIN__) 2863make an error 2864#endif 2865#include <elf.h> 2866#include <sys/termio.h> 2867],[ 2868static struct termio d_tio; 2869 d_tio.c_cc[VINTR] = 0; 2870 d_tio.c_cc[VQUIT] = 0; 2871 d_tio.c_cc[VERASE] = 0; 2872 d_tio.c_cc[VKILL] = 0; 2873 d_tio.c_cc[VEOF] = 0; 2874 d_tio.c_cc[VEOL] = 0; 2875 d_tio.c_cc[VMIN] = 0; 2876 d_tio.c_cc[VTIME] = 0; 2877 d_tio.c_cc[VLNEXT] = 0; 2878], 2879[cf_cv_svr4=yes], 2880[cf_cv_svr4=no]) 2881]) 2882]) 2883test "$cf_cv_svr4" = yes && AC_DEFINE(SVR4,1,[Define to 1 if this is an SVR4 system]) 2884])dnl 2885dnl --------------------------------------------------------------------------- 2886dnl CF_SYSV version: 16 updated: 2020/01/11 16:46:44 2887dnl ------- 2888dnl Check if this is a SYSV platform, e.g., as used in <X11/Xos.h>, and whether 2889dnl defining it will be helpful. The following features are used to check: 2890dnl 2891dnl a) bona-fide SVSV doesn't use const for sys_errlist[]. Since this is a 2892dnl legacy (pre-ANSI) feature, const should not apply. Modern systems only 2893dnl declare strerror(). Xos.h declares the legacy form of str_errlist[], and 2894dnl a compile-time error will result from trying to assign to a const array. 2895dnl 2896dnl b) compile with headers that exist on SYSV hosts. 2897dnl 2898dnl c) compile with type definitions that differ on SYSV hosts from standard C. 2899AC_DEFUN([CF_SYSV], 2900[ 2901AC_REQUIRE([AC_PATH_XTRA]) 2902 2903CF_SAVE_XTRA_FLAGS([CF_SYSV]) 2904 2905AC_CHECK_HEADERS( \ 2906termios.h \ 2907stdlib.h \ 2908X11/Intrinsic.h \ 2909) 2910 2911AC_REQUIRE([CF_SYS_ERRLIST]) 2912 2913AC_CACHE_CHECK(if we should define SYSV,cf_cv_sysv,[ 2914AC_TRY_COMPILE([ 2915#undef SYSV 2916#define SYSV 1 /* get Xos.h to declare sys_errlist[] */ 2917#ifdef HAVE_STDLIB_H 2918#include <stdlib.h> /* look for wchar_t */ 2919#endif 2920#ifdef HAVE_X11_INTRINSIC_H 2921#include <X11/Intrinsic.h> /* Intrinsic.h has other traps... */ 2922#endif 2923#ifdef HAVE_TERMIOS_H /* needed for HPUX 10.20 */ 2924#include <termios.h> 2925#define STRUCT_TERMIOS struct termios 2926#else 2927#define STRUCT_TERMIOS struct termio 2928#endif 2929#include <curses.h> 2930#include <term.h> /* eliminate most BSD hacks */ 2931#include <errno.h> /* declare sys_errlist on older systems */ 2932#include <sys/termio.h> /* eliminate most of the remaining ones */ 2933],[ 2934static STRUCT_TERMIOS d_tio; 2935 d_tio.c_cc[VINTR] = 0; 2936 d_tio.c_cc[VQUIT] = 0; 2937 d_tio.c_cc[VERASE] = 0; 2938 d_tio.c_cc[VKILL] = 0; 2939 d_tio.c_cc[VEOF] = 0; 2940 d_tio.c_cc[VEOL] = 0; 2941 d_tio.c_cc[VMIN] = 0; 2942 d_tio.c_cc[VTIME] = 0; 2943#if defined(HAVE_SYS_ERRLIST) && !defined(DECL_SYS_ERRLIST) 2944sys_errlist[0] = ""; /* Cygwin mis-declares this */ 2945#endif 2946], 2947[cf_cv_sysv=yes], 2948[cf_cv_sysv=no]) 2949]) 2950test "$cf_cv_sysv" = yes && AC_DEFINE(SYSV,1,[Define to 1 if this is an SYSV system]) 2951 2952CF_RESTORE_XTRA_FLAGS([CF_SYSV]) 2953])dnl 2954dnl --------------------------------------------------------------------------- 2955dnl CF_SYSV_UTMP version: 7 updated: 2021/01/02 09:31:20 2956dnl ------------ 2957dnl Check if this is a SYSV flavor of UTMP 2958AC_DEFUN([CF_SYSV_UTMP], 2959[ 2960AC_CACHE_CHECK(if $cf_cv_have_utmp is SYSV flavor,cf_cv_sysv_utmp,[ 2961test "$cf_cv_have_utmp" = "utmp" && cf_prefix="ut" || cf_prefix="utx" 2962AC_TRY_LINK([ 2963#include <sys/types.h> 2964#include <${cf_cv_have_utmp}.h>],[ 2965struct $cf_cv_have_utmp x; 2966 set${cf_prefix}ent (); 2967 get${cf_prefix}id(&x); 2968 put${cf_prefix}line(&x); 2969 end${cf_prefix}ent();], 2970 [cf_cv_sysv_utmp=yes], 2971 [cf_cv_sysv_utmp=no]) 2972]) 2973test "$cf_cv_sysv_utmp" = yes && AC_DEFINE(USE_SYSV_UTMP,1,[Define to 1 if utmp is SYSV flavor]) 2974])dnl 2975dnl --------------------------------------------------------------------------- 2976dnl CF_SYS_ERRLIST version: 6 updated: 2001/12/30 13:03:23 2977dnl -------------- 2978dnl Check for declaration of sys_nerr and sys_errlist in one of stdio.h and 2979dnl errno.h. Declaration of sys_errlist on BSD4.4 interferes with our 2980dnl declaration. Reported by Keith Bostic. 2981AC_DEFUN([CF_SYS_ERRLIST], 2982[ 2983 CF_CHECK_ERRNO(sys_nerr) 2984 CF_CHECK_ERRNO(sys_errlist) 2985])dnl 2986dnl --------------------------------------------------------------------------- 2987dnl CF_TERMIOS_TYPES version: 2 updated: 2020/03/10 18:53:47 2988dnl ---------------- 2989dnl https://pubs.opengroup.org/onlinepubs/009695399/basedefs/termios.h.html 2990dnl says that tcflag_t, speed_t and cc_t are typedef'd. If they are not, 2991dnl fallback to historical values. 2992AC_DEFUN([CF_TERMIOS_TYPES],[ 2993 2994AC_CACHE_CHECK(for termios type tcflag_t, cf_cv_havetype_tcflag_t,[ 2995 AC_TRY_COMPILE([#include <termios.h>],[ 2996 tcflag_t x = 0; (void)x], 2997 [cf_cv_havetype_tcflag_t=yes], 2998 [cf_cv_havetype_tcflag_t=no]) 2999]) 3000test "$cf_cv_havetype_tcflag_t" = no && AC_DEFINE(tcflag_t,unsigned long,[Define usable value of tcflag_t if not declared]) 3001 3002AC_CACHE_CHECK(for termios type speed_t, cf_cv_havetype_speed_t,[ 3003 AC_TRY_COMPILE([#include <termios.h>],[ 3004 speed_t x = 0; (void)x], 3005 [cf_cv_havetype_speed_t=yes], 3006 [cf_cv_havetype_speed_t=no]) 3007]) 3008test "$cf_cv_havetype_speed_t" = no && AC_DEFINE(speed_t,unsigned short,[Define usable value of speed_t if not declared]) 3009 3010AC_CACHE_CHECK(for termios type cc_t, cf_cv_havetype_cc_t,[ 3011 AC_TRY_COMPILE([#include <termios.h>],[ 3012 cc_t x = 0; (void)x], 3013 [cf_cv_havetype_cc_t=yes], 3014 [cf_cv_havetype_cc_t=no]) 3015]) 3016test "$cf_cv_havetype_cc_t" = no && AC_DEFINE(cc_t,unsigned char,[Define usable value of cc_t if not declared]) 3017])dnl 3018dnl --------------------------------------------------------------------------- 3019dnl CF_TERMIO_C_ISPEED version: 4 updated: 2020/03/10 18:53:47 3020dnl ------------------ 3021dnl Check for SGI's broken redefinition of baud rates introduced in IRIX 6.5 3022dnl (there doesn't appear to be a useful predefined symbol). 3023AC_DEFUN([CF_TERMIO_C_ISPEED], 3024[ 3025AC_CACHE_CHECK(for IRIX 6.5 baud-rate redefinitions,cf_cv_termio_c_ispeed,[ 3026AC_TRY_COMPILE([ 3027#include <sys/types.h> 3028#include <sys/termio.h>],[ 3029struct termio foo; 3030foo.c_ispeed = B38400; 3031foo.c_ospeed = B9600; 3032(void)foo; 3033],[cf_cv_termio_c_ispeed=yes 3034],[cf_cv_termio_c_ispeed=no]) 3035]) 3036test "$cf_cv_termio_c_ispeed" = yes && AC_DEFINE(HAVE_TERMIO_C_ISPEED,1,[define 1 if we have IRIX 6.5 baud-rate redefinitions]) 3037])dnl 3038dnl --------------------------------------------------------------------------- 3039dnl CF_TRIM_X_LIBS version: 3 updated: 2015/04/12 15:39:00 3040dnl -------------- 3041dnl Trim extra base X libraries added as a workaround for inconsistent library 3042dnl dependencies returned by "new" pkg-config files. 3043AC_DEFUN([CF_TRIM_X_LIBS],[ 3044 for cf_trim_lib in Xmu Xt X11 3045 do 3046 case "$LIBS" in 3047 (*-l$cf_trim_lib\ *-l$cf_trim_lib*) 3048 LIBS=`echo "$LIBS " | sed -e 's/ / /g' -e 's%-l'"$cf_trim_lib"' %%' -e 's/ $//'` 3049 CF_VERBOSE(..trimmed $LIBS) 3050 ;; 3051 esac 3052 done 3053]) 3054dnl --------------------------------------------------------------------------- 3055dnl CF_TRY_PKG_CONFIG version: 6 updated: 2020/12/31 10:54:15 3056dnl ----------------- 3057dnl This is a simple wrapper to use for pkg-config, for libraries which may be 3058dnl available in that form. 3059dnl 3060dnl $1 = package name, which may be a shell variable 3061dnl $2 = extra logic to use, if any, after updating CFLAGS and LIBS 3062dnl $3 = logic to use if pkg-config does not have the package 3063AC_DEFUN([CF_TRY_PKG_CONFIG],[ 3064AC_REQUIRE([CF_PKG_CONFIG]) 3065 3066if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists "$1"; then 3067 CF_VERBOSE(found package $1) 3068 cf_pkgconfig_incs="`$PKG_CONFIG --cflags "$1" 2>/dev/null`" 3069 cf_pkgconfig_libs="`$PKG_CONFIG --libs "$1" 2>/dev/null`" 3070 CF_VERBOSE(package $1 CFLAGS: $cf_pkgconfig_incs) 3071 CF_VERBOSE(package $1 LIBS: $cf_pkgconfig_libs) 3072 CF_ADD_CFLAGS($cf_pkgconfig_incs) 3073 CF_ADD_LIBS($cf_pkgconfig_libs) 3074 ifelse([$2],,:,[$2]) 3075else 3076 cf_pkgconfig_incs= 3077 cf_pkgconfig_libs= 3078 ifelse([$3],,:,[$3]) 3079fi 3080]) 3081dnl --------------------------------------------------------------------------- 3082dnl CF_TRY_XOPEN_SOURCE version: 4 updated: 2022/09/10 15:16:16 3083dnl ------------------- 3084dnl If _XOPEN_SOURCE is not defined in the compile environment, check if we 3085dnl can define it successfully. 3086AC_DEFUN([CF_TRY_XOPEN_SOURCE],[ 3087AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[ 3088 AC_TRY_COMPILE(CF__XOPEN_SOURCE_HEAD,CF__XOPEN_SOURCE_BODY, 3089 [cf_cv_xopen_source=no], 3090 [cf_save="$CPPFLAGS" 3091 CF_APPEND_TEXT(CPPFLAGS,-D_XOPEN_SOURCE=$cf_XOPEN_SOURCE) 3092 AC_TRY_COMPILE(CF__XOPEN_SOURCE_HEAD,CF__XOPEN_SOURCE_BODY, 3093 [cf_cv_xopen_source=no], 3094 [cf_cv_xopen_source=$cf_XOPEN_SOURCE]) 3095 CPPFLAGS="$cf_save" 3096 ]) 3097]) 3098 3099if test "$cf_cv_xopen_source" != no ; then 3100 CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE) 3101 CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE) 3102 cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source" 3103 CF_APPEND_CFLAGS($cf_temp_xopen_source) 3104fi 3105]) 3106dnl --------------------------------------------------------------------------- 3107dnl CF_TTY_GROUP version: 15 updated: 2023/01/05 17:57:39 3108dnl ------------ 3109dnl Check if the system has a tty-group defined. This is used in xterm when 3110dnl setting pty ownership. 3111dnl 3112dnl The check relies upon running a test-program, which calls ttyname. If this 3113dnl is run in batch mode, or if autoconf uses shell functions, the extra layer 3114dnl of eval/call may close stdin, making calls to ttyname fail. To work around 3115dnl that, fall back to "/dev/tty". 3116AC_DEFUN([CF_TTY_GROUP], 3117[AC_REQUIRE([AC_PROG_EGREP])dnl 3118AC_MSG_CHECKING(for explicit tty group name) 3119AC_ARG_WITH(tty-group, 3120 [ --with-tty-group=XXX use XXX for the tty-group], 3121 [cf_tty_group=$withval], 3122 [cf_tty_group=auto...]) 3123test -z "$cf_tty_group" && cf_tty_group=auto... 3124test "$cf_tty_group" = yes && cf_tty_group=auto... 3125AC_MSG_RESULT($cf_tty_group) 3126 3127if test "$cf_tty_group" = "auto..." ; then 3128AC_CACHE_CHECK(for tty group name,cf_cv_tty_group_name,[ 3129 3130# If we are configuring as root, it is hard to get a clue about the tty group. 3131# But we'll guess based on how our connection is set up - assuming it is done 3132# properly. 3133 3134cf_uid="`id | sed -e 's/^[^=]*=//' -e 's/(.*$//'`" 3135# )vi 3136if test "$cf_uid" != 0 ; then 3137cf_cv_tty_group_name= 3138cf_tty_name="`tty`" 3139test "$cf_tty_name" = "not a tty" && cf_tty_name=/dev/tty 3140test -z "$cf_tty_name" && cf_tty_name=/dev/tty 3141if test -c "$cf_tty_name" 3142then 3143 cf_option="-lL" 3144 3145 # Expect listing to have fields like this: 3146 #-rwxrwxrwx 1 user group 34293 Jul 18 16:29 pathname 3147 ls $cf_option "$cf_tty_name" >conftest.out 3148 read cf_mode cf_links cf_usr cf_grp cf_size cf_date1 cf_date2 cf_date3 cf_rest <conftest.out 3149 if test -z "$cf_rest" ; then 3150 cf_option="${cf_option}g" 3151 ls "$cf_option" "$cf_tty_name" >conftest.out 3152 read cf_mode cf_links cf_usr cf_grp cf_size cf_date1 cf_date2 cf_date3 cf_rest <conftest.out 3153 fi 3154 rm -f conftest.out 3155 cf_cv_tty_group_name=$cf_grp 3156fi 3157fi 3158 3159# If we cannot deduce the tty group, fall back on hardcoded cases 3160 3161if test -z "$cf_cv_tty_group_name" 3162then 3163case $host_os in 3164(osf*) 3165 cf_cv_tty_group_name="terminal" 3166 ;; 3167(*) 3168 cf_cv_tty_group_name="unknown" 3169 if ( ${EGREP-egrep} '^tty:' /etc/group 2>/dev/null 1>/dev/null ) then 3170 cf_cv_tty_group_name="tty" 3171 fi 3172 ;; 3173esac 3174fi 3175]) 3176cf_tty_group="$cf_cv_tty_group_name" 3177else 3178 # if configure option, always do this 3179 AC_DEFINE(USE_TTY_GROUP,1,[Define to 1 if we have a tty groupname]) 3180fi 3181 3182AC_DEFINE_UNQUOTED(TTY_GROUP_NAME,"$cf_tty_group",[Define to the name use for tty group]) 3183 3184# This is only a double-check that the group-name we obtained above really 3185# does apply to the device. We cannot perform this test if we are in batch 3186# mode, or if we are cross-compiling. 3187 3188AC_CACHE_CHECK(if we may use the $cf_tty_group group,cf_cv_tty_group,[ 3189cf_tty_name="`tty`" 3190if test "$cf_tty_name" != "not a tty" 3191then 3192AC_TRY_RUN([ 3193$ac_includes_default 3194 3195#include <grp.h> 3196 3197int main(void) 3198{ 3199 struct stat sb; 3200 struct group *ttygrp; 3201 int fd; 3202 char *name; 3203 3204 for (fd = 0; fd < 3; ++fd) { 3205 if ((name = ttyname(fd)) != 0) 3206 break; 3207 } 3208 if (name == 0) 3209 name = "/dev/tty"; 3210 3211 ttygrp = getgrnam(TTY_GROUP_NAME); 3212 endgrent(); 3213 3214 if (ttygrp != 0 3215 && name != 0 3216 && stat(name, &sb) == 0 3217 && sb.st_gid != getgid() 3218 && sb.st_gid == ttygrp->gr_gid) { 3219 ${cf_cv_main_return:-return} (0); 3220 } 3221 ${cf_cv_main_return:-return} (1); 3222} 3223 ], 3224 [cf_cv_tty_group=yes], 3225 [cf_cv_tty_group=no], 3226 [cf_cv_tty_group=unknown]) 3227elif test "$cross_compiling" = yes; then 3228 cf_cv_tty_group=unknown 3229else 3230 cf_cv_tty_group=yes 3231fi 3232]) 3233 3234if test $cf_cv_tty_group = no ; then 3235 AC_MSG_WARN(Cannot use $cf_tty_group group) 3236else 3237 AC_DEFINE(USE_TTY_GROUP) 3238fi 3239])dnl 3240dnl --------------------------------------------------------------------------- 3241dnl CF_TYPE_CC_T version: 3 updated: 2020/03/10 18:53:47 3242dnl ------------ 3243dnl Check for cc_t type, used in termio. 3244AC_DEFUN([CF_TYPE_CC_T], 3245[ 3246AC_MSG_CHECKING(for cc_t in <termios.h> or <termio.h>) 3247AC_CACHE_VAL(cf_cv_type_cc_t,[ 3248 AC_TRY_COMPILE([ 3249#include <sys/types.h> 3250#if defined(HAVE_TERMIOS_H) 3251#include <termios.h> 3252#else 3253#include <termio.h> 3254#include <sys/ioctl.h> 3255#endif 3256], 3257 [cc_t x; (void)x], 3258 [cf_cv_type_cc_t=yes], 3259 [cf_cv_type_cc_t=no]) 3260 ]) 3261AC_MSG_RESULT($cf_cv_type_cc_t) 3262test $cf_cv_type_cc_t = no && AC_DEFINE(cc_t, unsigned char,[Define to cc_t type used in termio]) 3263])dnl 3264dnl --------------------------------------------------------------------------- 3265dnl CF_TYPE_FD_MASK version: 3 updated: 2012/10/04 06:57:36 3266dnl --------------- 3267dnl Check for the declaration of fd_mask, which is like fd_set, associated 3268dnl with select(). The check for fd_set should have pulled in this as well, 3269dnl but there is a special case for Mac OS X, possibly other BSD-derived 3270dnl platforms. 3271AC_DEFUN([CF_TYPE_FD_MASK], 3272[ 3273AC_REQUIRE([CF_TYPE_FD_SET]) 3274 3275AC_CACHE_CHECK(for declaration of fd_mask,cf_cv_type_fd_mask,[ 3276 if test x$cf_cv_type_fd_set = xX11/Xpoll.h ; then 3277 AC_TRY_COMPILE([ 3278#include <X11/Xpoll.h>],[fd_mask x],, 3279 [CF_MSG_LOG(if we must define CSRG_BASED) 3280# Xosdefs.h on Mac OS X may not define this (but it should). 3281 AC_TRY_COMPILE([ 3282#define CSRG_BASED 3283#include <X11/Xpoll.h>],[fd_mask x], 3284 cf_cv_type_fd_mask=CSRG_BASED)]) 3285 else 3286 cf_cv_type_fd_mask=$cf_cv_type_fd_set 3287 fi 3288]) 3289if test x$cf_cv_type_fd_mask = xCSRG_BASED ; then 3290 AC_DEFINE(CSRG_BASED,1,[Define to 1 if needed for declaring fd_mask()]) 3291fi 3292])dnl 3293dnl --------------------------------------------------------------------------- 3294dnl CF_TYPE_FD_SET version: 6 updated: 2020/03/10 18:53:47 3295dnl -------------- 3296dnl Check for the declaration of fd_set. Some platforms declare it in 3297dnl <sys/types.h>, and some in <sys/select.h>, which requires <sys/types.h>. 3298dnl Finally, if we are using this for an X application, Xpoll.h may include 3299dnl <sys/select.h>, so we don't want to do it twice. 3300AC_DEFUN([CF_TYPE_FD_SET], 3301[ 3302AC_CHECK_HEADERS(X11/Xpoll.h) 3303 3304AC_CACHE_CHECK(for declaration of fd_set,cf_cv_type_fd_set, 3305 [CF_MSG_LOG(sys/types alone) 3306AC_TRY_COMPILE([ 3307#include <sys/types.h>], 3308 [fd_set x; (void)x], 3309 [cf_cv_type_fd_set=sys/types.h], 3310 [CF_MSG_LOG(X11/Xpoll.h) 3311AC_TRY_COMPILE([ 3312#ifdef HAVE_X11_XPOLL_H 3313#include <X11/Xpoll.h> 3314#endif], 3315 [fd_set x; (void)x], 3316 [cf_cv_type_fd_set=X11/Xpoll.h], 3317 [CF_MSG_LOG(sys/select.h) 3318AC_TRY_COMPILE([ 3319#include <sys/types.h> 3320#include <sys/select.h>], 3321 [fd_set x; (void)x], 3322 [cf_cv_type_fd_set=sys/select.h], 3323 [cf_cv_type_fd_set=unknown])])])]) 3324if test $cf_cv_type_fd_set = sys/select.h ; then 3325 AC_DEFINE(USE_SYS_SELECT_H,1,[Define to 1 to include sys/select.h to declare fd_set]) 3326fi 3327]) 3328dnl --------------------------------------------------------------------------- 3329dnl CF_TYPE_NFDS_T version: 1 updated: 2023/02/26 20:20:10 3330dnl -------------- 3331dnl Check for nfds_t type, used in poll. 3332AC_DEFUN([CF_TYPE_NFDS_T], 3333[ 3334AC_MSG_CHECKING(for nfds_t in <poll.h>) 3335AC_CACHE_VAL(cf_cv_type_nfds_t,[ 3336 AC_TRY_COMPILE([ 3337$ac_includes_default 3338#include <poll.h> 3339], 3340 [nfds_t x; (void)x], 3341 [cf_cv_type_nfds_t=yes], 3342 [cf_cv_type_nfds_t=no]) 3343 ]) 3344AC_MSG_RESULT($cf_cv_type_nfds_t) 3345test $cf_cv_type_nfds_t = no && AC_DEFINE(nfds_t, unsigned,[Define to nfds_t type used in poll]) 3346])dnl 3347dnl --------------------------------------------------------------------------- 3348dnl CF_UNDO_CFLAGS version: 1 updated: 2011/07/02 09:27:51 3349dnl -------------- 3350dnl Remove flags from $CFLAGS or similar shell variable using sed. 3351dnl $1 = variable 3352dnl $2 = message 3353dnl $3 = pattern to remove 3354AC_DEFUN([CF_UNDO_CFLAGS], 3355[ 3356 CF_VERBOSE(removing $2 flags from $1) 3357 $1=`echo "[$]$1" | sed -e 's/$3//'` 3358 CF_VERBOSE(...result [$]$1) 3359])dnl 3360dnl --------------------------------------------------------------------------- 3361dnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59 3362dnl -------- 3363dnl Make an uppercase version of a variable 3364dnl $1=uppercase($2) 3365AC_DEFUN([CF_UPPER], 3366[ 3367$1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` 3368])dnl 3369dnl --------------------------------------------------------------------------- 3370dnl CF_UTEMPTER version: 4 updated: 2012/10/04 20:12:20 3371dnl ----------- 3372dnl Try to link with utempter library 3373AC_DEFUN([CF_UTEMPTER], 3374[ 3375AC_CACHE_CHECK(if we can link with utempter library,cf_cv_have_utempter,[ 3376cf_save_LIBS="$LIBS" 3377CF_ADD_LIB(utempter) 3378AC_TRY_LINK([ 3379#include <utempter.h> 3380],[ 3381 addToUtmp("/dev/tty", 0, 1); 3382 removeFromUtmp(); 3383],[ 3384 cf_cv_have_utempter=yes],[ 3385 cf_cv_have_utempter=no]) 3386LIBS="$cf_save_LIBS" 3387]) 3388if test "$cf_cv_have_utempter" = yes ; then 3389 AC_DEFINE(USE_UTEMPTER,1,[Define to 1 if we can/should link with utempter]) 3390 CF_ADD_LIB(utempter) 3391fi 3392])dnl 3393dnl --------------------------------------------------------------------------- 3394dnl CF_UTMP version: 12 updated: 2021/01/02 09:31:20 3395dnl ------- 3396dnl Check for UTMP/UTMPX headers 3397AC_DEFUN([CF_UTMP], 3398[ 3399AC_REQUIRE([CF_LASTLOG]) 3400 3401AC_CACHE_CHECK(for utmp implementation,cf_cv_have_utmp,[ 3402 cf_cv_have_utmp=no 3403for cf_header in utmpx utmp ; do 3404cf_utmp_includes=" 3405#include <sys/types.h> 3406#include <${cf_header}.h> 3407#define getutent getutxent 3408#ifdef USE_LASTLOG 3409#include <lastlog.h> /* may conflict with utmpx.h on Linux */ 3410#endif 3411" 3412 AC_TRY_COMPILE([$cf_utmp_includes], 3413 [struct $cf_header x; 3414 char *name = x.ut_name; /* utmp.h and compatible definitions */ 3415 (void)x; 3416 (void)name; 3417 ], 3418 [cf_cv_have_utmp=$cf_header 3419 break], 3420 [ 3421 AC_TRY_COMPILE([$cf_utmp_includes], 3422 [struct $cf_header x; 3423 char *name = x.ut_user; /* utmpx.h must declare this */ 3424 (void)x; 3425 (void)name; 3426 ], 3427 [cf_cv_have_utmp=$cf_header 3428 break 3429 ])]) 3430done 3431]) 3432 3433if test "$cf_cv_have_utmp" != no ; then 3434 AC_DEFINE(HAVE_UTMP,1,[Define to 1 if the utmp interface is available]) 3435 test "$cf_cv_have_utmp" = utmpx && AC_DEFINE(UTMPX_FOR_UTMP,1,[Define if we have utmpx interface]) 3436 CF_UTMP_UT_HOST 3437 CF_UTMP_UT_SYSLEN 3438 CF_UTMP_UT_NAME 3439 CF_UTMP_UT_XSTATUS 3440 CF_UTMP_UT_XTIME 3441 CF_UTMP_UT_SESSION 3442 CF_SYSV_UTMP 3443fi 3444])dnl 3445dnl --------------------------------------------------------------------------- 3446dnl CF_UTMP_GROUP version: 2 updated: 2020/12/31 10:54:15 3447dnl ------------- 3448dnl Find the utmp/utmpx file and determine its group to allow setgid programs 3449dnl to manipulate it, e.g., when there is no intermediary. 3450AC_DEFUN([CF_UTMP_GROUP],[ 3451AC_REQUIRE([CF_UTMP]) 3452if test $cf_cv_have_utmp != no ; then 3453AC_CACHE_CHECK(for utmp/utmpx group,cf_cv_utmp_group,[ 3454for cf_utmp_path in /var/adm /var/run 3455do 3456 for cf_utmp_file in utmpx utmp 3457 do 3458 if test -f $cf_utmp_path/$cf_utmp_file 3459 then 3460 cf_cv_utmp_group=root 3461 3462 cf_option="-lL" 3463 3464 # Expect listing to have fields like this: 3465 #-r--r--r-- 1 user group 34293 Jul 18 16:29 pathname 3466 ls "$cf_option" "$cf_utmp_path/$cf_utmp_file" >conftest 3467 read cf_mode cf_links cf_usr cf_grp cf_size cf_date1 cf_date2 cf_date3 cf_rest <conftest 3468 if test -z "$cf_rest" ; then 3469 cf_option="${cf_option}g" 3470 ls "$cf_option" "$cf_utmp_path/$cf_utmp_file" >conftest 3471 read cf_mode cf_links cf_usr cf_grp cf_size cf_date1 cf_date2 cf_date3 cf_rest <conftest 3472 fi 3473 rm -f conftest 3474 3475 # If we have a pathname, and the date fields look right, assume we've 3476 # captured the group as well. 3477 if test -n "$cf_rest" ; then 3478 cf_test=`echo "${cf_date2}${cf_date3}" | sed -e 's/[[0-9:]]//g'` 3479 if test -z "$cf_test" ; then 3480 cf_cv_utmp_group=$cf_grp; 3481 fi 3482 fi 3483 break 3484 fi 3485 done 3486 test -n "$cf_cv_utmp_group" && break 3487done 3488]) 3489else 3490 AC_MSG_ERROR(cannot find utmp group) 3491fi 3492])dnl 3493dnl --------------------------------------------------------------------------- 3494dnl CF_UTMP_UT_HOST version: 10 updated: 2021/01/02 09:31:20 3495dnl --------------- 3496dnl Check if UTMP/UTMPX struct defines ut_host member 3497AC_DEFUN([CF_UTMP_UT_HOST], 3498[ 3499if test "$cf_cv_have_utmp" != no ; then 3500AC_MSG_CHECKING(if ${cf_cv_have_utmp}.ut_host is declared) 3501AC_CACHE_VAL(cf_cv_have_utmp_ut_host,[ 3502 AC_TRY_COMPILE([ 3503#include <sys/types.h> 3504#include <${cf_cv_have_utmp}.h>], 3505 [struct $cf_cv_have_utmp x; 3506 char *y = &x.ut_host[0]; 3507 (void)x; 3508 (void)y], 3509 [cf_cv_have_utmp_ut_host=yes], 3510 [cf_cv_have_utmp_ut_host=no]) 3511 ]) 3512AC_MSG_RESULT($cf_cv_have_utmp_ut_host) 3513test "$cf_cv_have_utmp_ut_host" != no && AC_DEFINE(HAVE_UTMP_UT_HOST,1,[Define to 1 if UTMP/UTMPX struct defines ut_host member]) 3514fi 3515])dnl 3516dnl --------------------------------------------------------------------------- 3517dnl CF_UTMP_UT_NAME version: 8 updated: 2021/01/02 09:31:20 3518dnl --------------- 3519dnl Check if UTMP/UTMPX struct defines ut_name member 3520AC_DEFUN([CF_UTMP_UT_NAME], 3521[ 3522if test "$cf_cv_have_utmp" != no ; then 3523AC_CACHE_CHECK(if ${cf_cv_have_utmp}.ut_name is declared,cf_cv_have_utmp_ut_name,[ 3524 cf_cv_have_utmp_ut_name=no 3525cf_utmp_includes=" 3526#include <sys/types.h> 3527#include <${cf_cv_have_utmp}.h> 3528#define getutent getutxent 3529#ifdef USE_LASTLOG 3530#include <lastlog.h> /* may conflict with utmpx.h on Linux */ 3531#endif 3532" 3533for cf_header in ut_name ut_user ; do 3534 AC_TRY_COMPILE([$cf_utmp_includes], 3535 [struct $cf_cv_have_utmp x; 3536 char *name = x.$cf_header; 3537 (void)x; 3538 (void)name; 3539 ], 3540 [cf_cv_have_utmp_ut_name=$cf_header 3541 break]) 3542done 3543]) 3544 3545case "$cf_cv_have_utmp_ut_name" in 3546(no) 3547 AC_MSG_ERROR(Cannot find declaration for ut.ut_name) 3548 ;; 3549(ut_user) 3550 AC_DEFINE(ut_name,ut_user,[Define to rename UTMP/UTMPX struct ut_name member]) 3551 ;; 3552esac 3553fi 3554])dnl 3555dnl --------------------------------------------------------------------------- 3556dnl CF_UTMP_UT_SESSION version: 9 updated: 2021/06/07 17:39:17 3557dnl ------------------ 3558dnl Check if UTMP/UTMPX struct defines ut_session member 3559AC_DEFUN([CF_UTMP_UT_SESSION], 3560[ 3561if test "$cf_cv_have_utmp" != no ; then 3562AC_CACHE_CHECK(if ${cf_cv_have_utmp}.ut_session is declared, cf_cv_have_utmp_ut_session,[ 3563 AC_TRY_COMPILE([ 3564#include <sys/types.h> 3565#include <${cf_cv_have_utmp}.h>], 3566 [static struct $cf_cv_have_utmp x; 3567 long y = x.ut_session; 3568 (void)x; 3569 (void)y], 3570 [cf_cv_have_utmp_ut_session=yes], 3571 [cf_cv_have_utmp_ut_session=no]) 3572]) 3573if test "$cf_cv_have_utmp_ut_session" != no ; then 3574 AC_DEFINE(HAVE_UTMP_UT_SESSION,1,[Define to 1 if UTMP/UTMPX struct defines ut_session member]) 3575fi 3576fi 3577])dnl 3578dnl --------------------------------------------------------------------------- 3579dnl CF_UTMP_UT_SYSLEN version: 4 updated: 2021/01/02 09:31:20 3580dnl ----------------- 3581dnl Check if UTMP/UTMPX struct defines ut_syslen member 3582AC_DEFUN([CF_UTMP_UT_SYSLEN], 3583[ 3584if test "$cf_cv_have_utmp" != no ; then 3585AC_MSG_CHECKING(if ${cf_cv_have_utmp}.ut_syslen is declared) 3586AC_CACHE_VAL(cf_cv_have_utmp_ut_syslen,[ 3587 AC_TRY_COMPILE([ 3588#include <sys/types.h> 3589#include <${cf_cv_have_utmp}.h>], 3590 [struct $cf_cv_have_utmp x; 3591 int y = x.ut_syslen; 3592 (void)x; 3593 (void)y], 3594 [cf_cv_have_utmp_ut_syslen=yes], 3595 [cf_cv_have_utmp_ut_syslen=no]) 3596 ]) 3597AC_MSG_RESULT($cf_cv_have_utmp_ut_syslen) 3598test "$cf_cv_have_utmp_ut_syslen" != no && AC_DEFINE(HAVE_UTMP_UT_SYSLEN,1,[Define to 1 if UTMP/UTMPX struct defines ut_syslen member]) 3599fi 3600])dnl 3601dnl --------------------------------------------------------------------------- 3602dnl CF_UTMP_UT_XSTATUS version: 6 updated: 2021/01/02 09:31:20 3603dnl ------------------ 3604dnl Check for known variants on the UTMP/UTMPX struct's exit-status as reported 3605dnl by various people: 3606dnl 3607dnl ut_exit.__e_exit (HPUX 11 - David Ellement, also in glibc2) 3608dnl ut_exit.e_exit (SVR4) 3609dnl ut_exit.ut_e_exit (os390 - Greg Smith) 3610dnl ut_exit.ut_exit (Tru64 4.0f - Jeremie Petit, 4.0e - Tomas Vanhala) 3611dnl 3612dnl Note: utmp_xstatus is not a conventional compatibility definition in the 3613dnl system header files. 3614AC_DEFUN([CF_UTMP_UT_XSTATUS], 3615[ 3616if test "$cf_cv_have_utmp" != no ; then 3617AC_CACHE_CHECK(for exit-status in $cf_cv_have_utmp,cf_cv_have_utmp_ut_xstatus,[ 3618for cf_result in \ 3619 ut_exit.__e_exit \ 3620 ut_exit.e_exit \ 3621 ut_exit.ut_e_exit \ 3622 ut_exit.ut_exit 3623do 3624AC_TRY_COMPILE([ 3625#include <sys/types.h> 3626#include <${cf_cv_have_utmp}.h>], 3627 [struct $cf_cv_have_utmp x; 3628 long y = x.$cf_result = 0; 3629 (void)x; 3630 (void)y], 3631 [cf_cv_have_utmp_ut_xstatus=$cf_result 3632 break], 3633 [cf_cv_have_utmp_ut_xstatus=no]) 3634done 3635]) 3636if test "$cf_cv_have_utmp_ut_xstatus" != no ; then 3637 AC_DEFINE(HAVE_UTMP_UT_XSTATUS,1,[Define to 1 if UTMP/UTMPX has exit-status member]) 3638 AC_DEFINE_UNQUOTED(ut_xstatus,$cf_cv_have_utmp_ut_xstatus,[Define if needed to rename member ut_xstatus of UTMP/UTMPX]) 3639fi 3640fi 3641])dnl 3642dnl --------------------------------------------------------------------------- 3643dnl CF_UTMP_UT_XTIME version: 11 updated: 2021/01/02 09:31:20 3644dnl ---------------- 3645dnl Check if UTMP/UTMPX struct defines ut_xtime member 3646AC_DEFUN([CF_UTMP_UT_XTIME], 3647[ 3648if test "$cf_cv_have_utmp" != no ; then 3649AC_CACHE_CHECK(if ${cf_cv_have_utmp}.ut_xtime is declared, cf_cv_have_utmp_ut_xtime,[ 3650 AC_TRY_COMPILE([ 3651#include <sys/types.h> 3652#include <${cf_cv_have_utmp}.h>], 3653 [struct $cf_cv_have_utmp x; 3654 long y = x.ut_xtime = 0; 3655 (void)x; 3656 (void)y], 3657 [cf_cv_have_utmp_ut_xtime=yes], 3658 [AC_TRY_COMPILE([ 3659#include <sys/types.h> 3660#include <${cf_cv_have_utmp}.h>], 3661 [struct $cf_cv_have_utmp x; 3662 long y = x.ut_tv.tv_sec; 3663 (void)x; 3664 (void)y], 3665 [cf_cv_have_utmp_ut_xtime=define], 3666 [cf_cv_have_utmp_ut_xtime=no]) 3667 ]) 3668]) 3669if test "$cf_cv_have_utmp_ut_xtime" != no ; then 3670 AC_DEFINE(HAVE_UTMP_UT_XTIME,1,[Define to 1 if UTMP/UTMPX struct defines ut_xtime member]) 3671 if test "$cf_cv_have_utmp_ut_xtime" = define ; then 3672 AC_DEFINE(ut_xtime,ut_tv.tv_sec,[Define if needed to alternate name for utmpx.ut_xtime member]) 3673 fi 3674fi 3675fi 3676])dnl 3677dnl --------------------------------------------------------------------------- 3678dnl CF_VERBOSE version: 3 updated: 2007/07/29 09:55:12 3679dnl ---------- 3680dnl Use AC_VERBOSE w/o the warnings 3681AC_DEFUN([CF_VERBOSE], 3682[test -n "$verbose" && echo " $1" 1>&AC_FD_MSG 3683CF_MSG_LOG([$1]) 3684])dnl 3685dnl --------------------------------------------------------------------------- 3686dnl CF_WITH_APP_CLASS version: 3 updated: 2015/04/12 15:39:00 3687dnl ----------------- 3688dnl Handle configure option "--with-app-class", setting the $APP_CLASS 3689dnl variable, used for X resources. 3690dnl 3691dnl $1 = default value. 3692AC_DEFUN([CF_WITH_APP_CLASS],[ 3693AC_MSG_CHECKING(for X applications class) 3694AC_ARG_WITH(app-class, 3695 [ --with-app-class=XXX override X applications class (default $1)], 3696 [APP_CLASS=$withval], 3697 [APP_CLASS=$1]) 3698 3699case x$APP_CLASS in 3700(*[[/@,%]]*) 3701 AC_MSG_WARN(X applications class cannot contain punctuation) 3702 APP_CLASS=$1 3703 ;; 3704(x[[A-Z]]*) 3705 ;; 3706(*) 3707 AC_MSG_WARN([X applications class must start with capital, ignoring $APP_CLASS]) 3708 APP_CLASS=$1 3709 ;; 3710esac 3711 3712AC_MSG_RESULT($APP_CLASS) 3713 3714AC_SUBST(APP_CLASS) 3715])dnl 3716dnl --------------------------------------------------------------------------- 3717dnl CF_WITH_APP_DEFAULTS version: 6 updated: 2015/01/02 09:05:50 3718dnl -------------------- 3719dnl Handle configure option "--with-app-defaults", setting these shell 3720dnl variables: 3721dnl 3722dnl $APPSDIR is the option value, used for installing app-defaults files. 3723dnl $no_appsdir is a "#" (comment) if "--without-app-defaults" is given. 3724dnl 3725dnl Most Linux's use this: 3726dnl /usr/share/X11/app-defaults 3727dnl Debian uses this: 3728dnl /etc/X11/app-defaults 3729dnl DragonFlyBSD ports uses this: 3730dnl /usr/pkg/lib/X11/app-defaults 3731dnl FreeBSD ports use these: 3732dnl /usr/local/lib/X11/app-defaults 3733dnl /usr/local/share/X11/app-defaults 3734dnl Mandriva has these: 3735dnl /usr/lib/X11/app-defaults 3736dnl /usr/lib64/X11/app-defaults 3737dnl NetBSD has these 3738dnl /usr/X11R7/lib/X11/app-defaults 3739dnl OpenSolaris uses 3740dnl 32-bit: 3741dnl /usr/X11/etc/X11/app-defaults 3742dnl /usr/X11/share/X11/app-defaults 3743dnl /usr/X11/lib/X11/app-defaults 3744dnl OSX uses 3745dnl /opt/local/share/X11/app-defaults (MacPorts) 3746dnl /opt/X11/share/X11/app-defaults (non-ports) 3747dnl 64-bit: 3748dnl /usr/X11/etc/X11/app-defaults 3749dnl /usr/X11/share/X11/app-defaults (I mkdir'd this) 3750dnl /usr/X11/lib/amd64/X11/app-defaults 3751dnl Solaris10 uses (in this order): 3752dnl /usr/openwin/lib/X11/app-defaults 3753dnl /usr/X11/lib/X11/app-defaults 3754AC_DEFUN([CF_WITH_APP_DEFAULTS],[ 3755AC_MSG_CHECKING(for directory to install resource files) 3756AC_ARG_WITH(app-defaults, 3757 [ --with-app-defaults=DIR directory in which to install resource files (EPREFIX/lib/X11/app-defaults)], 3758 [APPSDIR=$withval], 3759 [APPSDIR='${exec_prefix}/lib/X11/app-defaults']) 3760 3761if test "x[$]APPSDIR" = xauto 3762then 3763 APPSDIR='${exec_prefix}/lib/X11/app-defaults' 3764 for cf_path in \ 3765 /opt/local/share/X11/app-defaults \ 3766 /opt/X11/share/X11/app-defaults \ 3767 /usr/share/X11/app-defaults \ 3768 /usr/X11/share/X11/app-defaults \ 3769 /usr/X11/lib/X11/app-defaults \ 3770 /usr/lib/X11/app-defaults \ 3771 /etc/X11/app-defaults \ 3772 /usr/pkg/lib/X11/app-defaults \ 3773 /usr/X11R7/lib/X11/app-defaults \ 3774 /usr/X11R6/lib/X11/app-defaults \ 3775 /usr/X11R5/lib/X11/app-defaults \ 3776 /usr/X11R4/lib/X11/app-defaults \ 3777 /usr/local/lib/X11/app-defaults \ 3778 /usr/local/share/X11/app-defaults \ 3779 /usr/lib64/X11/app-defaults 3780 do 3781 if test -d "$cf_path" ; then 3782 APPSDIR="$cf_path" 3783 break 3784 fi 3785 done 3786else 3787 cf_path=$APPSDIR 3788 CF_PATH_SYNTAX(cf_path) 3789fi 3790 3791AC_MSG_RESULT($APPSDIR) 3792AC_SUBST(APPSDIR) 3793 3794no_appsdir= 3795if test "$APPSDIR" = no 3796then 3797 no_appsdir="#" 3798else 3799 EXTRA_INSTALL_DIRS="$EXTRA_INSTALL_DIRS \$(APPSDIR)" 3800fi 3801AC_SUBST(no_appsdir) 3802])dnl 3803dnl --------------------------------------------------------------------------- 3804dnl CF_WITH_DBMALLOC version: 7 updated: 2010/06/21 17:26:47 3805dnl ---------------- 3806dnl Configure-option for dbmalloc. The optional parameter is used to override 3807dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests. 3808AC_DEFUN([CF_WITH_DBMALLOC],[ 3809CF_NO_LEAKS_OPTION(dbmalloc, 3810 [ --with-dbmalloc test: use Conor Cahill's dbmalloc library], 3811 [USE_DBMALLOC]) 3812 3813if test "$with_dbmalloc" = yes ; then 3814 AC_CHECK_HEADER(dbmalloc.h, 3815 [AC_CHECK_LIB(dbmalloc,[debug_malloc]ifelse([$1],,[],[,$1]))]) 3816fi 3817])dnl 3818dnl --------------------------------------------------------------------------- 3819dnl CF_WITH_DESKTOP_CATEGORY version: 9 updated: 2021/01/03 18:30:50 3820dnl ------------------------ 3821dnl Taking into account the absence of standardization of desktop categories 3822dnl take a look to see whether other applications on the current system are 3823dnl assigned any/all of a set of suggested categories. 3824dnl 3825dnl $1 = program name 3826dnl $2 = case-pattern to match comparable desktop files to obtain category 3827dnl This pattern may contain wildcards. 3828dnl $3 = suggested categories, also a case-pattern but without wildcards, 3829dnl since it doubles as a default value for a shell case-statement. 3830dnl $4 = categories to use if no match is found on the build-machine for the 3831dnl --with-desktop-category "auto" setting. 3832dnl 3833dnl The macro tells the configure script to substitute the $DESKTOP_CATEGORY 3834dnl value. 3835AC_DEFUN([CF_WITH_DESKTOP_CATEGORY],[ 3836AC_REQUIRE([AC_PROG_EGREP])dnl 3837AC_REQUIRE([CF_DISABLE_DESKTOP])dnl 3838if test -z "$desktop_utils" 3839then 3840 AC_MSG_CHECKING(for requested desktop-category) 3841 AC_ARG_WITH(desktop-category, 3842 [ --with-desktop-category=XXX one or more desktop catgories or auto], 3843 [cf_desktop_want=$withval], 3844 [cf_desktop_want=auto]) 3845 AC_MSG_RESULT($cf_desktop_want) 3846 3847 if test "$cf_desktop_want" = auto 3848 then 3849 rm -rf conftest* 3850 cf_desktop_also= 3851 for cf_desktop_dir in \ 3852 /usr/share/app-install \ 3853 /usr/share/applications 3854 do 3855 if test -d $cf_desktop_dir 3856 then 3857 find $cf_desktop_dir -name '*.desktop' | \ 3858 while true 3859 do 3860 read cf_desktop_path 3861 test -z "$cf_desktop_path" && break 3862 cf_desktop_name=`basename "$cf_desktop_path" .desktop` 3863 case $cf_desktop_name in 3864 ($1|*-$1|$2) 3865 CF_VERBOSE(inspect $cf_desktop_path) 3866 ${EGREP-egrep} '^Categories=' "$cf_desktop_path" | \ 3867 tr ';' '\n' | \ 3868 sed -e 's%^.*=%%' -e '/^$/d' >>conftest.1 3869 ;; 3870 esac 3871 done 3872 fi 3873 done 3874 if test -s conftest.1 3875 then 3876 cf_desktop_last= 3877 sort conftest.1 | \ 3878 while true 3879 do 3880 read cf_desktop_this 3881 test -z "$cf_desktop_this" && break 3882 if test -s conftest.2 3883 then 3884 grep -w "$cf_desktop_this" conftest.2 >/dev/null && continue 3885 elif test -s conftest.3 3886 then 3887 grep -w "$cf_desktop_this" conftest.3 >/dev/null && continue 3888 fi 3889 case "$cf_desktop_this" in 3890 (-*) 3891 ;; 3892 (Qt*|*Xfce*|*[[ABCDEFGHIJKLMNOPQRSTUVWXYZ]][[ABCDEFGHIJKLMNOPQRSTUVWXYZ]]*) 3893 CF_VERBOSE(ignored $cf_desktop_this) 3894 echo "$cf_desktop_this" >> conftest.3 3895 ;; 3896 ($3) 3897 CF_VERBOSE(applied $cf_desktop_this) 3898 test "x$cf_desktop_last" != "x$cf_desktop_this" && echo "$cf_desktop_this" >>conftest.2 3899 ;; 3900 esac 3901 cf_desktop_last=$cf_desktop_this 3902 done 3903 cf_desktop_want="`tr '\n' ';' < conftest.2`" 3904 fi 3905 if test -n "$cf_desktop_want" 3906 then 3907 if test "$cf_desktop_want" = auto 3908 then 3909 cf_desktop_want= 3910 else 3911 # do a sanity check on the semicolon-separated list, ignore on failure 3912 cf_desktop_test=`echo "$cf_desktop_want" | sed -e 's/[[^;]]//g'` 3913 test -z "$cf_desktop_test" && cf_desktop_want= 3914 cf_desktop_test=`echo "$cf_desktop_want" | sed -e 's/^.*;$/./g'` 3915 test -z "$cf_desktop_test" && cf_desktop_want= 3916 fi 3917 fi 3918 if test -z "$cf_desktop_want" 3919 then 3920 cf_desktop_want="ifelse([$4],,ifelse([$3],,[Application;],[`echo "$3" | sed -e 's/\*//g' -e 's/|/;/g' -e 's/[[;]]*$/;/g'`]),[$4])" 3921 CF_VERBOSE(no usable value found for desktop category, using $cf_desktop_want) 3922 fi 3923 fi 3924 DESKTOP_CATEGORY=`echo "$cf_desktop_want" | sed -e 's/[[ ,]]/;/g'` 3925 CF_VERBOSE(will use Categories=$DESKTOP_CATEGORY) 3926 AC_SUBST(DESKTOP_CATEGORY) 3927fi 3928]) 3929dnl --------------------------------------------------------------------------- 3930dnl CF_WITH_DMALLOC version: 7 updated: 2010/06/21 17:26:47 3931dnl --------------- 3932dnl Configure-option for dmalloc. The optional parameter is used to override 3933dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests. 3934AC_DEFUN([CF_WITH_DMALLOC],[ 3935CF_NO_LEAKS_OPTION(dmalloc, 3936 [ --with-dmalloc test: use Gray Watson's dmalloc library], 3937 [USE_DMALLOC]) 3938 3939if test "$with_dmalloc" = yes ; then 3940 AC_CHECK_HEADER(dmalloc.h, 3941 [AC_CHECK_LIB(dmalloc,[dmalloc_debug]ifelse([$1],,[],[,$1]))]) 3942fi 3943])dnl 3944dnl --------------------------------------------------------------------------- 3945dnl CF_WITH_ICONDIR version: 5 updated: 2012/07/22 09:18:02 3946dnl --------------- 3947dnl Handle configure option "--with-icondir", setting these shell variables: 3948dnl 3949dnl $ICONDIR is the option value, used for installing icon files. 3950dnl $no_icondir is a "#" (comment) if "--without-icondir" is given. 3951AC_DEFUN([CF_WITH_ICONDIR],[ 3952AC_MSG_CHECKING(for directory to install icons) 3953AC_ARG_WITH(icondir, 3954 [ --with-icondir=DIR directory in which to install icons for desktop], 3955 [ICONDIR=$withval], 3956 [test -z "$ICONDIR" && ICONDIR=no]) 3957 3958if test "x[$]ICONDIR" = xauto 3959then 3960 ICONDIR='${datadir}/icons' 3961 for cf_path in \ 3962 /usr/share/icons \ 3963 /usr/X11R6/share/icons 3964 do 3965 if test -d "$cf_path" ; then 3966 ICONDIR="$cf_path" 3967 break 3968 fi 3969 done 3970else 3971 cf_path=$ICONDIR 3972 CF_PATH_SYNTAX(cf_path) 3973fi 3974AC_MSG_RESULT($ICONDIR) 3975AC_SUBST(ICONDIR) 3976 3977no_icondir= 3978if test "$ICONDIR" = no 3979then 3980 no_icondir="#" 3981else 3982 EXTRA_INSTALL_DIRS="$EXTRA_INSTALL_DIRS \$(ICONDIR)" 3983fi 3984AC_SUBST(no_icondir) 3985])dnl 3986dnl --------------------------------------------------------------------------- 3987dnl CF_WITH_ICON_NAME version: 3 updated: 2015/04/12 15:39:00 3988dnl ----------------- 3989dnl Allow a default icon-name to be overridden. 3990dnl $1 = default icon name 3991AC_DEFUN([CF_WITH_ICON_NAME],[ 3992AC_MSG_CHECKING(for the icon name) 3993AC_ARG_WITH(icon-name, 3994 [ --with-icon-name=XXXX override icon name (default: $1)], 3995 [ICON_NAME="$withval"], 3996 [ICON_NAME=$1]) 3997case "x$ICON_NAME" in 3998(xyes|xno|x) 3999 ICON_NAME=$1 4000 ;; 4001esac 4002AC_SUBST(ICON_NAME) 4003AC_MSG_RESULT($ICON_NAME) 4004])dnl 4005dnl --------------------------------------------------------------------------- 4006dnl CF_WITH_ICON_SYMLINK version: 2 updated: 2015/04/12 15:39:00 4007dnl -------------------- 4008dnl Workaround for systems which are (mis)configured to map all icon references 4009dnl for xterm into "xterm" name. For instance, recent (2013) KDE ignores both 4010dnl the name given in the .desktop file (xterm-color) and the application name 4011dnl (xterm-dev). 4012dnl 4013dnl $1 = default icon name to use if symlink is wanted 4014AC_DEFUN([CF_WITH_ICON_SYMLINK],[ 4015AC_MSG_CHECKING(for icon symlink to use) 4016AC_ARG_WITH(icon-symlink, 4017 [ --with-icon-symlink=XXX make symbolic link for icon name (default: $1)], 4018 [ICON_SYMLINK="$withval"], 4019 [ICON_SYMLINK=NONE]) 4020case "x$ICON_SYMLINK" in 4021(xyes) 4022 ICON_SYMLINK=$1 4023 ;; 4024(xno|x) 4025 ICON_SYMLINK=NONE 4026 ;; 4027esac 4028AC_SUBST(ICON_SYMLINK) 4029AC_MSG_RESULT($ICON_SYMLINK) 4030])dnl 4031dnl --------------------------------------------------------------------------- 4032dnl CF_WITH_ICON_THEME version: 13 updated: 2020/12/31 10:54:15 4033dnl ------------------ 4034dnl If asked, check for prerequisites and setup symbols to permit installing 4035dnl one or more application icons in the Red Hat icon-theme directory 4036dnl hierarchy. 4037dnl 4038dnl If the prerequisites are missing, give a warning and revert to the long- 4039dnl standing pixmaps directory. 4040dnl 4041dnl Parameters: 4042dnl 4043dnl $1 = application icon. This can be a list, and is not optional. 4044dnl $2 = default theme (defaults to hicolor) 4045dnl $3 = formats (defaults to list [.svg .png .xpm]) 4046dnl $4 = alternate icon if no theme is used (defaults to $1). 4047dnl 4048dnl Result: 4049dnl ICON_NAME = basename of first item in $1, unless already set 4050dnl ICON_LIST = reprocessed $1 4051dnl ICON_THEME = reprocessed $2 4052dnl ICON_FORMAT = reprocessed $3 4053AC_DEFUN([CF_WITH_ICON_THEME], 4054[ 4055ifelse([$1],,[ 4056 AC_MSG_ERROR([macro [CF_WITH_ICON_THEME] requires application-icon name]) 4057],[ 4058 4059CF_WITH_PIXMAPDIR 4060CF_WITH_ICONDIR 4061 4062AC_MSG_CHECKING(if icon theme should be used) 4063AC_ARG_WITH(icon-theme, 4064 [ --with-icon-theme=XXX install icons into desktop theme (hicolor)], 4065 [ICON_THEME=$withval], 4066 [ICON_THEME=no]) 4067 4068case "x$ICON_THEME" in 4069(xno) 4070 ;; 4071(x|xyes) 4072 ICON_THEME=ifelse([$2],,hicolor,$2) 4073 ;; 4074esac 4075AC_MSG_RESULT($ICON_THEME) 4076 4077if test "x$ICON_THEME" = xno 4078then 4079 if test "x$ICONDIR" != xno 4080 then 4081 CF_VERBOSE(ignoring icondir without theme) 4082 no_icondir="#" 4083 fi 4084else 4085 if test "x$ICONDIR" = xno 4086 then 4087 AC_MSG_ERROR(icondir must be set for icon theme) 4088 fi 4089fi 4090 4091: ${ICON_FORMAT:=ifelse([$3],,[".svg .png .xpm"],[$3])} 4092 4093ICON_LIST= 4094 4095ifelse([$4],,[cf_icon_list=$1],[ 4096if test "x$ICON_THEME" != xno 4097then 4098 cf_icon_list="$1" 4099else 4100 cf_icon_list="$4" 4101fi 4102]) 4103 4104AC_MSG_CHECKING([for icon(s) to install]) 4105for cf_name in $cf_icon_list 4106do 4107 CF_VERBOSE(using $ICON_FORMAT) 4108 for cf_suffix in $ICON_FORMAT 4109 do 4110 cf_icon="${cf_name}${cf_suffix}" 4111 cf_left=`echo "$cf_icon" | sed -e 's/:.*//'` 4112 if test ! -f "${cf_left}" 4113 then 4114 if test "x$srcdir" != "x." 4115 then 4116 cf_icon="${srcdir}/${cf_left}" 4117 cf_left=`echo "$cf_icon" | sed -e 's/:.*//'` 4118 if test ! -f "${cf_left}" 4119 then 4120 continue 4121 fi 4122 else 4123 continue 4124 fi 4125 fi 4126 if test "x$ICON_THEME" != xno 4127 then 4128 cf_base=`basename "$cf_left"` 4129 cf_trim=`echo "$cf_base" | sed -e 's/_[[0-9]][[0-9]]x[[0-9]][[0-9]]\././'` 4130 case "x${cf_base}" in 4131 (*:*) 4132 cf_next=$cf_base 4133 # user-defined mapping 4134 ;; 4135 (*.png) 4136 cf_size=`file "$cf_left"|sed -e 's/^[[^:]]*://' -e 's/^.*[[^0-9]]\([[0-9]][[0-9]]* x [[0-9]][[0-9]]*\)[[^0-9]].*$/\1/' -e 's/ //g'` 4137 if test -z "$cf_size" 4138 then 4139 AC_MSG_WARN(cannot determine size of $cf_left) 4140 continue 4141 fi 4142 cf_next="$cf_size/apps/$cf_trim" 4143 ;; 4144 (*.svg) 4145 cf_next="scalable/apps/$cf_trim" 4146 ;; 4147 (*.xpm) 4148 CF_VERBOSE(ignored XPM file in icon theme) 4149 continue 4150 ;; 4151 (*_[[0-9]][[0-9]]*x[[0-9]][[0-9]]*.*) 4152 cf_size=`echo "$cf_left"|sed -e 's/^.*_\([[0-9]][[0-9]]*x[[0-9]][[0-9]]*\)\..*$/\1/'` 4153 cf_left=`echo "$cf_left"|sed -e 's/^\(.*\)_\([[0-9]][[0-9]]*x[[0-9]][[0-9]]*\)\(\..*\)$/\1\3/'` 4154 cf_next="$cf_size/apps/$cf_base" 4155 ;; 4156 esac 4157 CF_VERBOSE(adding $cf_next) 4158 cf_icon="${cf_icon}:${cf_next}" 4159 fi 4160 test -n "$ICON_LIST" && ICON_LIST="$ICON_LIST " 4161 ICON_LIST="$ICON_LIST${cf_icon}" 4162 if test -z "$ICON_NAME" 4163 then 4164 ICON_NAME=`basename "$cf_icon" | sed -e 's/[[.:]].*//'` 4165 fi 4166 done 4167done 4168 4169if test -n "$verbose" 4170then 4171 AC_MSG_CHECKING(result) 4172fi 4173AC_MSG_RESULT($ICON_LIST) 4174 4175if test -z "$ICON_LIST" 4176then 4177 AC_MSG_ERROR(no icons found) 4178fi 4179]) 4180 4181AC_MSG_CHECKING(for icon name) 4182AC_MSG_RESULT($ICON_NAME) 4183 4184AC_SUBST(ICON_FORMAT) 4185AC_SUBST(ICON_THEME) 4186AC_SUBST(ICON_LIST) 4187AC_SUBST(ICON_NAME) 4188])dnl 4189dnl --------------------------------------------------------------------------- 4190dnl CF_WITH_IMAKE_CFLAGS version: 12 updated: 2022/02/24 17:10:03 4191dnl -------------------- 4192dnl xterm and similar programs build more readily when propped up with imake's 4193dnl hand-tuned definitions. If we do not use imake, provide fallbacks for the 4194dnl most common definitions that we're not likely to do by autoconf tests. 4195AC_DEFUN([CF_WITH_IMAKE_CFLAGS],[ 4196AC_REQUIRE([CF_ENABLE_NARROWPROTO]) 4197 4198AC_MSG_CHECKING(if we should use imake to help) 4199CF_ARG_DISABLE(imake, 4200 [ --disable-imake disable use of imake for definitions], 4201 [enable_imake=no], 4202 [enable_imake=yes]) 4203AC_MSG_RESULT($enable_imake) 4204 4205if test "$enable_imake" = yes ; then 4206 CF_IMAKE_CFLAGS(ifelse([$1],,,[$1])) 4207fi 4208 4209if test -n "$IMAKE" && test -n "$IMAKE_CFLAGS" ; then 4210 CF_ADD_CFLAGS($IMAKE_CFLAGS) 4211else 4212 IMAKE_CFLAGS= 4213 IMAKE_LOADFLAGS= 4214 CF_VERBOSE(make fallback definitions) 4215 4216 # We prefer config.guess' values when we can get them, to avoid 4217 # inconsistent results with uname (AIX for instance). However, 4218 # config.guess is not always consistent either. 4219 case $host_os in 4220 (*[[0-9]].[[0-9]]*) 4221 UNAME_RELEASE="$host_os" 4222 ;; 4223 (*) 4224 UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown 4225 ;; 4226 esac 4227 4228 case .$UNAME_RELEASE in 4229 (*[[0-9]].[[0-9]]*) 4230 OSMAJORVERSION=`echo "$UNAME_RELEASE" |sed -e 's/^[[^0-9]]*//' -e 's/\..*//'` 4231 OSMINORVERSION=`echo "$UNAME_RELEASE" |sed -e 's/^[[^0-9]]*//' -e 's/^[[^.]]*\.//' -e 's/\..*//' -e 's/[[^0-9]].*//' ` 4232 test -z "$OSMAJORVERSION" && OSMAJORVERSION=1 4233 test -z "$OSMINORVERSION" && OSMINORVERSION=0 4234 IMAKE_CFLAGS="-DOSMAJORVERSION=$OSMAJORVERSION -DOSMINORVERSION=$OSMINORVERSION $IMAKE_CFLAGS" 4235 ;; 4236 esac 4237 4238 # FUNCPROTO is standard with X11R6, but XFree86 drops it, leaving some 4239 # fallback/fragments for NeedPrototypes, etc. 4240 IMAKE_CFLAGS="-DFUNCPROTO=15 $IMAKE_CFLAGS" 4241 4242 # If this is not set properly, Xaw's scrollbars will not work 4243 if test "$enable_narrowproto" = yes ; then 4244 IMAKE_CFLAGS="-DNARROWPROTO=1 $IMAKE_CFLAGS" 4245 fi 4246 4247 # Other special definitions: 4248 case $host_os in 4249 (aix*) 4250 # imake on AIX 5.1 defines AIXV3. really. 4251 IMAKE_CFLAGS="-DAIXV3 -DAIXV4 $IMAKE_CFLAGS" 4252 ;; 4253 (irix[[56]].*) 4254 # these are needed to make SIGWINCH work in xterm 4255 IMAKE_CFLAGS="-DSYSV -DSVR4 $IMAKE_CFLAGS" 4256 ;; 4257 esac 4258 4259 # "modern" systems install X applications in /usr/bin. Other systems may 4260 # use one of the X release-based directories. 4261 case "$CFLAGS $CPPFLAGS $IMAKE_CFLAGS" in 4262 (*-DPROJECTROOT*) 4263 ;; 4264 (*) 4265 for cf_dir in /usr/X11R7 /usr/X11R6 /usr/X11R5 4266 do 4267 if test -d "$cf_dir/bin" 4268 then 4269 IMAKE_CFLAGS="$IMAKE_CFLAGS -DPROJECTROOT=\\\"$cf_dir\\\"" 4270 break 4271 fi 4272 done 4273 ;; 4274 esac 4275 4276 CF_ADD_CFLAGS($IMAKE_CFLAGS) 4277 4278 AC_SUBST(IMAKE_CFLAGS) 4279 AC_SUBST(IMAKE_LOADFLAGS) 4280fi 4281])dnl 4282dnl --------------------------------------------------------------------------- 4283dnl CF_WITH_MAN2HTML version: 12 updated: 2021/01/03 18:30:50 4284dnl ---------------- 4285dnl Check for man2html and groff. Prefer man2html over groff, but use groff 4286dnl as a fallback. See 4287dnl 4288dnl http://invisible-island.net/scripts/man2html.html 4289dnl 4290dnl Generate a shell script which hides the differences between the two. 4291dnl 4292dnl We name that "man2html.tmp". 4293dnl 4294dnl The shell script can be removed later, e.g., using "make distclean". 4295AC_DEFUN([CF_WITH_MAN2HTML],[ 4296AC_REQUIRE([CF_PROG_GROFF])dnl 4297AC_REQUIRE([AC_PROG_FGREP])dnl 4298 4299case "x${with_man2html}" in 4300(xno) 4301 cf_man2html=no 4302 ;; 4303(x|xyes) 4304 AC_PATH_PROG(cf_man2html,man2html,no) 4305 case "x$cf_man2html" in 4306 (x/*) 4307 AC_MSG_CHECKING(for the modified Earl Hood script) 4308 if ( $cf_man2html -help 2>&1 | grep 'Make an index of headers at the end' >/dev/null ) 4309 then 4310 cf_man2html_ok=yes 4311 else 4312 cf_man2html=no 4313 cf_man2html_ok=no 4314 fi 4315 AC_MSG_RESULT($cf_man2html_ok) 4316 ;; 4317 (*) 4318 cf_man2html=no 4319 ;; 4320 esac 4321esac 4322 4323AC_MSG_CHECKING(for program to convert manpage to html) 4324AC_ARG_WITH(man2html, 4325 [ --with-man2html=XXX use XXX rather than groff], 4326 [cf_man2html=$withval], 4327 [cf_man2html=$cf_man2html]) 4328 4329cf_with_groff=no 4330 4331case $cf_man2html in 4332(yes) 4333 AC_MSG_RESULT(man2html) 4334 AC_PATH_PROG(cf_man2html,man2html,no) 4335 ;; 4336(no|groff|*/groff*) 4337 cf_with_groff=yes 4338 cf_man2html=$GROFF_PATH 4339 AC_MSG_RESULT($cf_man2html) 4340 ;; 4341(*) 4342 AC_MSG_RESULT($cf_man2html) 4343 ;; 4344esac 4345 4346MAN2HTML_TEMP="man2html.tmp" 4347 cat >$MAN2HTML_TEMP <<CF_EOF 4348#!$SHELL 4349# Temporary script generated by CF_WITH_MAN2HTML 4350# Convert inputs to html, sending result to standard output. 4351# 4352# Parameters: 4353# \${1} = rootname of file to convert 4354# \${2} = suffix of file to convert, e.g., "1" 4355# \${3} = macros to use, e.g., "man" 4356# 4357ROOT=\[$]1 4358TYPE=\[$]2 4359MACS=\[$]3 4360 4361unset LANG 4362unset LC_ALL 4363unset LC_CTYPE 4364unset LANGUAGE 4365GROFF_NO_SGR=stupid 4366export GROFF_NO_SGR 4367 4368CF_EOF 4369 4370NROFF_OPTS= 4371if test "x$cf_with_groff" = xyes 4372then 4373 MAN2HTML_NOTE="$GROFF_NOTE" 4374 MAN2HTML_PATH="$GROFF_PATH" 4375 cat >>$MAN2HTML_TEMP <<CF_EOF 4376$SHELL -c "$TBL_PATH \${ROOT}.\${TYPE} | $GROFF_PATH -P -o0 -I\${ROOT}_ -Thtml -\${MACS}" 4377CF_EOF 4378else 4379 # disable hyphenation if this is groff 4380 if test "x$GROFF_PATH" != xno 4381 then 4382 AC_MSG_CHECKING(if nroff is really groff) 4383 cf_check_groff="`$NROFF_PATH --version 2>/dev/null | grep groff`" 4384 test -n "$cf_check_groff" && cf_check_groff=yes 4385 test -n "$cf_check_groff" || cf_check_groff=no 4386 AC_MSG_RESULT($cf_check_groff) 4387 test "x$cf_check_groff" = xyes && NROFF_OPTS="-rHY=0" 4388 fi 4389 MAN2HTML_NOTE="" 4390 CF_PATH_SYNTAX(cf_man2html) 4391 MAN2HTML_PATH="$cf_man2html" 4392 AC_MSG_CHECKING(for $cf_man2html top/bottom margins) 4393 4394 # for this example, expect 3 lines of content, the remainder is head/foot 4395 cat >conftest.in <<CF_EOF 4396.TH HEAD1 HEAD2 HEAD3 HEAD4 HEAD5 4397.SH SECTION 4398MARKER 4399CF_EOF 4400 4401 LC_ALL=C LC_CTYPE=C LANG=C LANGUAGE=C $NROFF_PATH -man conftest.in >conftest.out 4402 4403 cf_man2html_1st="`${FGREP-fgrep} -n MARKER conftest.out |sed -e 's/^[[^0-9]]*://' -e 's/:.*//'`" 4404 cf_man2html_top=`expr "$cf_man2html_1st" - 2` 4405 cf_man2html_bot="`wc -l conftest.out |sed -e 's/[[^0-9]]//g'`" 4406 cf_man2html_bot=`expr "$cf_man2html_bot" - 2 - "$cf_man2html_top"` 4407 cf_man2html_top_bot="-topm=$cf_man2html_top -botm=$cf_man2html_bot" 4408 4409 AC_MSG_RESULT($cf_man2html_top_bot) 4410 4411 AC_MSG_CHECKING(for pagesize to use) 4412 for cf_block in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 4413 do 4414 cat >>conftest.in <<CF_EOF 4415.nf 44160 44171 44182 44193 44204 44215 44226 44237 44248 44259 4426CF_EOF 4427 done 4428 4429 LC_ALL=C LC_CTYPE=C LANG=C LANGUAGE=C $NROFF_PATH -man conftest.in >conftest.out 4430 cf_man2html_page="`${FGREP-fgrep} -n HEAD1 conftest.out |sed -n '$p' |sed -e 's/^[[^0-9]]*://' -e 's/:.*//'`" 4431 test -z "$cf_man2html_page" && cf_man2html_page=99999 4432 test "$cf_man2html_page" -gt 100 && cf_man2html_page=99999 4433 4434 rm -rf conftest* 4435 AC_MSG_RESULT($cf_man2html_page) 4436 4437 cat >>$MAN2HTML_TEMP <<CF_EOF 4438: \${MAN2HTML_PATH=$MAN2HTML_PATH} 4439MAN2HTML_OPTS="\$MAN2HTML_OPTS -index -title=\"\$ROOT(\$TYPE)\" -compress -pgsize $cf_man2html_page" 4440case \${TYPE} in 4441(ms) 4442 $TBL_PATH \${ROOT}.\${TYPE} | $NROFF_PATH $NROFF_OPTS -\${MACS} | \$MAN2HTML_PATH -topm=0 -botm=0 \$MAN2HTML_OPTS 4443 ;; 4444(*) 4445 $TBL_PATH \${ROOT}.\${TYPE} | $NROFF_PATH $NROFF_OPTS -\${MACS} | \$MAN2HTML_PATH $cf_man2html_top_bot \$MAN2HTML_OPTS 4446 ;; 4447esac 4448CF_EOF 4449fi 4450 4451chmod 700 $MAN2HTML_TEMP 4452 4453AC_SUBST(MAN2HTML_NOTE) 4454AC_SUBST(MAN2HTML_PATH) 4455AC_SUBST(MAN2HTML_TEMP) 4456])dnl 4457dnl --------------------------------------------------------------------------- 4458dnl CF_WITH_PCRE version: 12 updated: 2017/07/29 22:57:34 4459dnl ------------ 4460dnl Add PCRE (Perl-compatible regular expressions) to the build if it is 4461dnl available and the user requests it. Assume the application will otherwise 4462dnl use the POSIX interface. 4463dnl 4464dnl TODO allow $withval to specify package location 4465AC_DEFUN([CF_WITH_PCRE], 4466[ 4467AC_REQUIRE([CF_PKG_CONFIG]) 4468 4469AC_MSG_CHECKING(if you want to use PCRE for regular-expressions) 4470AC_ARG_WITH(pcre, 4471 [ --with-pcre use PCRE for regular-expressions]) 4472test -z "$with_pcre" && with_pcre=no 4473AC_MSG_RESULT($with_pcre) 4474 4475if test "$with_pcre" != no ; then 4476 CF_TRY_PKG_CONFIG(libpcre,,[ 4477 AC_CHECK_LIB(pcre,pcre_compile,, 4478 AC_MSG_ERROR(Cannot find PCRE library))]) 4479 4480 AC_DEFINE(HAVE_LIB_PCRE,1,[Define to 1 if we can/should compile with the PCRE library]) 4481 4482 case $LIBS in 4483 (*pcreposix*) 4484 ;; 4485 (*) 4486 AC_CHECK_LIB(pcreposix,pcreposix_regcomp, 4487 [AC_DEFINE(HAVE_PCREPOSIX_H,1,[Define to 1 if we should include pcreposix.h]) 4488 CF_ADD_LIB(pcreposix)], 4489 [AC_CHECK_LIB(pcreposix,regcomp,[ 4490 AC_DEFINE(HAVE_PCREPOSIX_H,1,[Define to 1 if we should include pcreposix.h]) 4491 CF_ADD_LIB(pcreposix)], 4492 AC_MSG_ERROR(Cannot find PCRE POSIX library)])) 4493 ;; 4494 esac 4495fi 4496])dnl 4497dnl --------------------------------------------------------------------------- 4498dnl CF_WITH_PCRE2 version: 6 updated: 2021/08/11 20:35:34 4499dnl ------------- 4500dnl Add PCRE2 (Perl-compatible regular expressions v2) to the build if it is 4501dnl available and the user requests it. Assume the application will otherwise 4502dnl use the POSIX interface. 4503dnl 4504dnl TODO allow $withval to specify package location 4505AC_DEFUN([CF_WITH_PCRE2], 4506[ 4507AC_REQUIRE([CF_PKG_CONFIG]) 4508 4509AC_MSG_CHECKING(if you want to use PCRE2 for regular-expressions) 4510AC_ARG_WITH(pcre2, 4511 [ --with-pcre2 use PCRE2 for regular-expressions]) 4512test -z "$with_pcre2" && with_pcre2=no 4513AC_MSG_RESULT($with_pcre2) 4514 4515if test "x$with_pcre2" != xno ; then 4516 cf_with_pcre2_ok=no 4517 for cf_with_pcre2 in libpcre2 libpcre2-posix libpcre 4518 do 4519 CF_TRY_PKG_CONFIG($cf_with_pcre2,[cf_with_pcre2_ok=yes; break]) 4520 done 4521 cf_with_pcre2_ok=yes || AC_MSG_ERROR(Cannot find PCRE2 library) 4522 4523 AC_DEFINE(HAVE_LIB_PCRE2,1,[Define to 1 if we can/should compile with the PCRE2 library]) 4524 4525 # if pkgconfig gave no results, look for the libraries directly 4526 case "$LIBS" in 4527 (*pcre2-posix*|*pcreposix*) 4528 ;; 4529 (*) 4530 AC_CHECK_LIB(pcre2-posix,regcomp,[ 4531 CF_ADD_LIB(pcre2-posix)], 4532 [AC_CHECK_LIB(pcreposix,regcomp,[ 4533 CF_ADD_LIB(pcreposix) 4534 ],[AC_MSG_ERROR(Cannot find PCRE2 POSIX library)])]) 4535 ;; 4536 esac 4537 4538 # either way, check for the library header files 4539 AC_CHECK_HEADERS(pcre2posix.h pcreposix.h) 4540 AC_CHECK_FUNCS(PCRE2regcomp) 4541fi 4542])dnl 4543dnl --------------------------------------------------------------------------- 4544dnl CF_WITH_PIXMAPDIR version: 3 updated: 2012/07/22 09:18:02 4545dnl ----------------- 4546dnl Handle configure option "--with-pixmapdir", setting these shell variables: 4547dnl 4548dnl $PIXMAPDIR is the option value, used for installing pixmap files. 4549dnl $no_pixmapdir is a "#" (comment) if "--without-pixmapdir" is given. 4550AC_DEFUN([CF_WITH_PIXMAPDIR],[ 4551AC_MSG_CHECKING(for directory to install pixmaps) 4552AC_ARG_WITH(pixmapdir, 4553 [ --with-pixmapdir=DIR directory in which to install pixmaps (DATADIR/pixmaps)], 4554 [PIXMAPDIR=$withval], 4555 [test -z "$PIXMAPDIR" && PIXMAPDIR='${datadir}/pixmaps']) 4556 4557if test "x[$]PIXMAPDIR" = xauto 4558then 4559 PIXMAPDIR='${datadir}/pixmaps' 4560 for cf_path in \ 4561 /usr/share/pixmaps \ 4562 /usr/X11R6/share/pixmaps 4563 do 4564 if test -d "$cf_path" ; then 4565 PIXMAPDIR="$cf_path" 4566 break 4567 fi 4568 done 4569else 4570 cf_path=$PIXMAPDIR 4571 CF_PATH_SYNTAX(cf_path) 4572fi 4573AC_MSG_RESULT($PIXMAPDIR) 4574AC_SUBST(PIXMAPDIR) 4575 4576no_pixmapdir= 4577if test "$PIXMAPDIR" = no 4578then 4579 no_pixmapdir="#" 4580else 4581 EXTRA_INSTALL_DIRS="$EXTRA_INSTALL_DIRS \$(PIXMAPDIR)" 4582fi 4583AC_SUBST(no_pixmapdir) 4584])dnl 4585dnl --------------------------------------------------------------------------- 4586dnl CF_WITH_VALGRIND version: 1 updated: 2006/12/14 18:00:21 4587dnl ---------------- 4588AC_DEFUN([CF_WITH_VALGRIND],[ 4589CF_NO_LEAKS_OPTION(valgrind, 4590 [ --with-valgrind test: use valgrind], 4591 [USE_VALGRIND]) 4592])dnl 4593dnl --------------------------------------------------------------------------- 4594dnl CF_WITH_XINERAMA version: 1 updated: 2016/05/28 14:41:12 4595dnl ---------------- 4596AC_DEFUN([CF_WITH_XINERAMA], 4597[ 4598AC_MSG_CHECKING(if you want to use the Xinerama extension) 4599AC_ARG_WITH(xinerama, 4600[ --without-xinerama do not use Xinerama extension for multiscreen support], 4601 [cf_with_xinerama="$withval"], 4602 [cf_with_xinerama=yes]) 4603AC_MSG_RESULT($cf_with_xinerama) 4604if test "$cf_with_xinerama" = yes; then 4605 CF_XINERAMA 4606fi 4607])dnl 4608dnl --------------------------------------------------------------------------- 4609dnl CF_WITH_XPM version: 3 updated: 2012/10/04 06:57:36 4610dnl ----------- 4611dnl Test for Xpm library, update compiler/loader flags if it is wanted and 4612dnl found. 4613dnl 4614dnl Also sets ICON_SUFFIX 4615AC_DEFUN([CF_WITH_XPM], 4616[ 4617ICON_SUFFIX=.xbm 4618 4619cf_save_cppflags="${CPPFLAGS}" 4620cf_save_ldflags="${LDFLAGS}" 4621 4622AC_MSG_CHECKING(if you want to use the Xpm library for colored icon) 4623AC_ARG_WITH(xpm, 4624[ --with-xpm=DIR use Xpm library for colored icon, may specify path], 4625 [cf_Xpm_library="$withval"], 4626 [cf_Xpm_library=yes]) 4627AC_MSG_RESULT($cf_Xpm_library) 4628 4629if test "$cf_Xpm_library" != no ; then 4630 if test "$cf_Xpm_library" != yes ; then 4631 CPPFLAGS="$CPPFLAGS -I$withval/include" 4632 LDFLAGS="$LDFLAGS -L$withval/lib" 4633 fi 4634 AC_CHECK_HEADER(X11/xpm.h,[ 4635 AC_CHECK_LIB(Xpm, XpmCreatePixmapFromData,[ 4636 AC_DEFINE(HAVE_LIBXPM,1,[Define to 1 if we should use Xpm library]) 4637 ICON_SUFFIX=.xpm 4638 LIBS="-lXpm $LIBS"], 4639 [CPPFLAGS="${cf_save_cppflags}" LDFLAGS="${cf_save_ldflags}"], 4640 [-lX11 $X_LIBS])], 4641 [CPPFLAGS="${cf_save_cppflags}" LDFLAGS="${cf_save_ldflags}"]) 4642fi 4643 4644AC_SUBST(ICON_SUFFIX) 4645])dnl 4646dnl --------------------------------------------------------------------------- 4647dnl CF_XBOOL_RESULT version: 3 updated: 2015/04/12 15:39:00 4648dnl --------------- 4649dnl Translate an autoconf boolean yes/no into X11's booleans, e.g., True/False. 4650dnl Allow for more than two values, e.g., "maybe", still using the same leading 4651dnl capital convention. 4652dnl 4653dnl $1 = symbol to define 4654dnl $2 = symbol holding value 4655dnl $3 = description 4656define([CF_XBOOL_RESULT],[ 4657AC_MSG_RESULT([$]$2) 4658case [$]$2 in 4659(yes) 4660 $2=true 4661 ;; 4662(no) 4663 $2=false 4664 ;; 4665esac 4666cf_xbool1=`echo "[$]$2"|sed -e 's/^\(.\).*/\1/'` 4667CF_UPPER(cf_xbool1,$cf_xbool1) 4668cf_xbool2=`echo "[$]$2"|sed -e 's/^.//'` 4669$2=${cf_xbool1}${cf_xbool2} 4670AC_DEFINE_UNQUOTED($1,[$]$2,$3) 4671AC_SUBST($2) 4672]) 4673dnl --------------------------------------------------------------------------- 4674dnl CF_XINERAMA version: 2 updated: 2015/02/15 15:18:41 4675dnl ----------- 4676AC_DEFUN([CF_XINERAMA],[ 4677CF_TRY_PKG_CONFIG(xinerama,[ 4678 AC_DEFINE(HAVE_X11_EXTENSIONS_XINERAMA_H)],[ 4679 AC_CHECK_LIB(Xinerama,XineramaQueryScreens, 4680 [CF_ADD_LIB(Xinerama) 4681 AC_CHECK_HEADERS( \ 4682 X11/extensions/Xinerama.h \ 4683 ) 4684 ]) 4685 ]) 4686])dnl 4687dnl --------------------------------------------------------------------------- 4688dnl CF_XKB_BELL_EXT version: 6 updated: 2020/03/10 18:53:47 4689dnl --------------- 4690dnl Check for XKB bell extension 4691AC_DEFUN([CF_XKB_BELL_EXT],[ 4692AC_REQUIRE([AC_PATH_XTRA]) 4693 4694CF_SAVE_XTRA_FLAGS([CF_XKB_BELL_EXT]) 4695 4696AC_CACHE_CHECK(for XKB Bell extension, cf_cv_xkb_bell_ext,[ 4697AC_TRY_LINK([ 4698#include <X11/Intrinsic.h> 4699#include <X11/XKBlib.h> /* has the prototype */ 4700#include <X11/extensions/XKBbells.h> /* has the XkbBI_xxx definitions */ 4701],[ 4702 int x = (XkbBI_Info |XkbBI_MinorError |XkbBI_MajorError |XkbBI_TerminalBell |XkbBI_MarginBell); 4703 Atom y = 0; 4704 (void)x; 4705 XkbBell((Display *)0, (Widget)0, 0, y); 4706],[cf_cv_xkb_bell_ext=yes],[cf_cv_xkb_bell_ext=no]) 4707]) 4708test "$cf_cv_xkb_bell_ext" = yes && AC_DEFINE(HAVE_XKB_BELL_EXT,1,[Define 1 if we have XKB Bell extension]) 4709 4710CF_RESTORE_XTRA_FLAGS([CF_XKB_BELL_EXT]) 4711]) 4712dnl --------------------------------------------------------------------------- 4713dnl CF_XKB_KEYCODE_TO_KEYSYM version: 3 updated: 2020/03/10 18:53:47 4714dnl ------------------------ 4715dnl Some older vendor-unix systems made a practice of delivering fragments of 4716dnl Xkb, requiring test-compiles. 4717AC_DEFUN([CF_XKB_KEYCODE_TO_KEYSYM],[ 4718AC_CACHE_CHECK(if we can use XkbKeycodeToKeysym, cf_cv_xkb_keycode_to_keysym,[ 4719AC_TRY_COMPILE([ 4720#include <X11/Xlib.h> 4721#include <X11/XKBlib.h> 4722],[ 4723 KeySym keysym = XkbKeycodeToKeysym((Display *)0, 0, 0, 0); 4724 (void)keysym; 4725],[ 4726cf_cv_xkb_keycode_to_keysym=yes 4727],[ 4728cf_cv_xkb_keycode_to_keysym=no 4729]) 4730]) 4731 4732if test $cf_cv_xkb_keycode_to_keysym = yes 4733then 4734 AC_CHECK_FUNCS(XkbKeycodeToKeysym) 4735fi 4736]) 4737dnl --------------------------------------------------------------------------- 4738dnl CF_XKB_QUERY_EXTENSION version: 2 updated: 2012/09/28 20:23:46 4739dnl ---------------------- 4740dnl see ifdef in scrollbar.c - iron out here 4741AC_DEFUN([CF_XKB_QUERY_EXTENSION],[ 4742AC_CACHE_CHECK(if we can use XkbQueryExtension, cf_cv_xkb_query_extension,[ 4743AC_TRY_COMPILE([ 4744#include <X11/Xlib.h> 4745#include <X11/extensions/XKB.h> 4746#include <X11/XKBlib.h> 4747],[ 4748 int xkbmajor = XkbMajorVersion; 4749 int xkbminor = XkbMinorVersion; 4750 int xkbopcode, xkbevent, xkberror; 4751 4752 if (XkbLibraryVersion(&xkbmajor, &xkbminor) 4753 && XkbQueryExtension((Display *)0, 4754 &xkbopcode, 4755 &xkbevent, 4756 &xkberror, 4757 &xkbmajor, 4758 &xkbminor)) 4759 return 0; 4760],[ 4761cf_cv_xkb_query_extension=yes 4762],[ 4763cf_cv_xkb_query_extension=no 4764]) 4765]) 4766 4767if test $cf_cv_xkb_query_extension = yes 4768then 4769 AC_CHECK_FUNCS(XkbQueryExtension) 4770fi 4771]) 4772dnl --------------------------------------------------------------------------- 4773dnl CF_XOPEN_SOURCE version: 64 updated: 2023/02/18 17:41:25 4774dnl --------------- 4775dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions, 4776dnl or adapt to the vendor's definitions to get equivalent functionality, 4777dnl without losing the common non-POSIX features. 4778dnl 4779dnl Parameters: 4780dnl $1 is the nominal value for _XOPEN_SOURCE 4781dnl $2 is the nominal value for _POSIX_C_SOURCE 4782AC_DEFUN([CF_XOPEN_SOURCE],[ 4783AC_REQUIRE([AC_CANONICAL_HOST]) 4784AC_REQUIRE([CF_POSIX_VISIBLE]) 4785 4786if test "$cf_cv_posix_visible" = no; then 4787 4788cf_XOPEN_SOURCE=ifelse([$1],,500,[$1]) 4789cf_POSIX_C_SOURCE=ifelse([$2],,199506L,[$2]) 4790cf_xopen_source= 4791 4792case "$host_os" in 4793(aix[[4-7]]*) 4794 cf_xopen_source="-D_ALL_SOURCE" 4795 ;; 4796(darwin[[0-8]].*) 4797 cf_xopen_source="-D_APPLE_C_SOURCE" 4798 ;; 4799(darwin*) 4800 cf_xopen_source="-D_DARWIN_C_SOURCE" 4801 cf_XOPEN_SOURCE= 4802 ;; 4803(freebsd*|dragonfly*|midnightbsd*) 4804 # 5.x headers associate 4805 # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L 4806 # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L 4807 cf_POSIX_C_SOURCE=200112L 4808 cf_XOPEN_SOURCE=600 4809 cf_xopen_source="-D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" 4810 ;; 4811(hpux11*) 4812 cf_xopen_source="-D_HPUX_SOURCE -D_XOPEN_SOURCE=500" 4813 ;; 4814(hpux*) 4815 cf_xopen_source="-D_HPUX_SOURCE" 4816 ;; 4817(irix[[56]].*) 4818 cf_xopen_source="-D_SGI_SOURCE" 4819 cf_XOPEN_SOURCE= 4820 ;; 4821(linux*gnu|linux*gnuabi64|linux*gnuabin32|linux*gnueabi|linux*gnueabihf|linux*gnux32|uclinux*|gnu*|mint*|k*bsd*-gnu|cygwin|msys) 4822 CF_GNU_SOURCE($cf_XOPEN_SOURCE) 4823 ;; 4824(minix*) 4825 cf_xopen_source="-D_NETBSD_SOURCE" # POSIX.1-2001 features are ifdef'd with this... 4826 ;; 4827(mirbsd*) 4828 # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <sys/select.h> and other headers which use u_int / u_short types 4829 cf_XOPEN_SOURCE= 4830 CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE) 4831 ;; 4832(netbsd*) 4833 cf_xopen_source="-D_NETBSD_SOURCE" # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw 4834 ;; 4835(openbsd[[6-9]]*) 4836 # OpenBSD 6.x has broken locale support, both compile-time and runtime. 4837 # see https://www.mail-archive.com/bugs@openbsd.org/msg13200.html 4838 # Abusing the conformance level is a workaround. 4839 AC_MSG_WARN(this system does not provide usable locale support) 4840 cf_xopen_source="-D_BSD_SOURCE" 4841 cf_XOPEN_SOURCE=700 4842 ;; 4843(openbsd[[4-5]]*) 4844 # setting _XOPEN_SOURCE lower than 500 breaks g++ compile with wchar.h, needed for ncursesw 4845 cf_xopen_source="-D_BSD_SOURCE" 4846 cf_XOPEN_SOURCE=600 4847 ;; 4848(openbsd*) 4849 # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw 4850 ;; 4851(osf[[45]]*) 4852 cf_xopen_source="-D_OSF_SOURCE" 4853 ;; 4854(nto-qnx*) 4855 cf_xopen_source="-D_QNX_SOURCE" 4856 ;; 4857(sco*) 4858 # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer 4859 ;; 4860(solaris2.*) 4861 cf_xopen_source="-D__EXTENSIONS__" 4862 cf_cv_xopen_source=broken 4863 ;; 4864(sysv4.2uw2.*) # Novell/SCO UnixWare 2.x (tested on 2.1.2) 4865 cf_XOPEN_SOURCE= 4866 cf_POSIX_C_SOURCE= 4867 ;; 4868(*) 4869 CF_TRY_XOPEN_SOURCE 4870 cf_save_xopen_cppflags="$CPPFLAGS" 4871 CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE) 4872 # Some of these niche implementations use copy/paste, double-check... 4873 if test "$cf_cv_xopen_source" != no ; then 4874 CF_VERBOSE(checking if _POSIX_C_SOURCE inteferes) 4875 AC_TRY_COMPILE(CF__XOPEN_SOURCE_HEAD,CF__XOPEN_SOURCE_BODY,,[ 4876 AC_MSG_WARN(_POSIX_C_SOURCE definition is not usable) 4877 CPPFLAGS="$cf_save_xopen_cppflags"]) 4878 fi 4879 ;; 4880esac 4881 4882if test -n "$cf_xopen_source" ; then 4883 CF_APPEND_CFLAGS($cf_xopen_source,true) 4884fi 4885 4886dnl In anything but the default case, we may have system-specific setting 4887dnl which is still not guaranteed to provide all of the entrypoints that 4888dnl _XOPEN_SOURCE would yield. 4889if test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then 4890 AC_MSG_CHECKING(if _XOPEN_SOURCE really is set) 4891 AC_TRY_COMPILE([#include <stdlib.h>],[ 4892#ifndef _XOPEN_SOURCE 4893#error _XOPEN_SOURCE is not defined 4894#endif], 4895 [cf_XOPEN_SOURCE_set=yes], 4896 [cf_XOPEN_SOURCE_set=no]) 4897 AC_MSG_RESULT($cf_XOPEN_SOURCE_set) 4898 if test "$cf_XOPEN_SOURCE_set" = yes 4899 then 4900 AC_TRY_COMPILE([#include <stdlib.h>],[ 4901#if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE 4902#error (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE 4903#endif], 4904 [cf_XOPEN_SOURCE_set_ok=yes], 4905 [cf_XOPEN_SOURCE_set_ok=no]) 4906 if test "$cf_XOPEN_SOURCE_set_ok" = no 4907 then 4908 AC_MSG_WARN(_XOPEN_SOURCE is lower than requested) 4909 fi 4910 else 4911 CF_TRY_XOPEN_SOURCE 4912 fi 4913fi 4914fi # cf_cv_posix_visible 4915]) 4916dnl --------------------------------------------------------------------------- 4917dnl CF_X_ATHENA version: 25 updated: 2023/01/11 04:05:23 4918dnl ----------- 4919dnl Check for Xaw (Athena) libraries 4920dnl 4921dnl Sets $cf_x_athena according to the flavor of Xaw which is used. 4922AC_DEFUN([CF_X_ATHENA], 4923[ 4924cf_x_athena=${cf_x_athena:-Xaw} 4925 4926AC_MSG_CHECKING(if you want to link with Xaw 3d library) 4927withval= 4928AC_ARG_WITH(Xaw3d, 4929 [ --with-Xaw3d link with Xaw 3d library]) 4930if test "$withval" = yes ; then 4931 cf_x_athena=Xaw3d 4932 AC_MSG_RESULT(yes) 4933else 4934 AC_MSG_RESULT(no) 4935fi 4936 4937AC_MSG_CHECKING(if you want to link with Xaw 3d xft library) 4938withval= 4939AC_ARG_WITH(Xaw3dxft, 4940 [ --with-Xaw3dxft link with Xaw 3d xft library]) 4941if test "$withval" = yes ; then 4942 cf_x_athena=Xaw3dxft 4943 AC_MSG_RESULT(yes) 4944else 4945 AC_MSG_RESULT(no) 4946fi 4947 4948AC_MSG_CHECKING(if you want to link with neXT Athena library) 4949withval= 4950AC_ARG_WITH(neXtaw, 4951 [ --with-neXtaw link with neXT Athena library]) 4952if test "$withval" = yes ; then 4953 cf_x_athena=neXtaw 4954 AC_MSG_RESULT(yes) 4955else 4956 AC_MSG_RESULT(no) 4957fi 4958 4959AC_MSG_CHECKING(if you want to link with Athena-Plus library) 4960withval= 4961AC_ARG_WITH(XawPlus, 4962 [ --with-XawPlus link with Athena-Plus library]) 4963if test "$withval" = yes ; then 4964 cf_x_athena=XawPlus 4965 AC_MSG_RESULT(yes) 4966else 4967 AC_MSG_RESULT(no) 4968fi 4969 4970cf_x_athena_lib="" 4971 4972if test "$PKG_CONFIG" != none ; then 4973 cf_athena_list= 4974 test "$cf_x_athena" = Xaw && cf_athena_list="xaw8 xaw7 xaw6" 4975 for cf_athena_pkg in \ 4976 $cf_athena_list \ 4977 ${cf_x_athena} \ 4978 ${cf_x_athena}-devel \ 4979 lib${cf_x_athena} \ 4980 lib${cf_x_athena}-devel 4981 do 4982 CF_TRY_PKG_CONFIG($cf_athena_pkg,[ 4983 cf_x_athena_lib="$cf_pkgconfig_libs" 4984 CF_UPPER(cf_x_athena_LIBS,HAVE_LIB_$cf_x_athena) 4985 AC_DEFINE_UNQUOTED($cf_x_athena_LIBS) 4986 4987 CF_TRIM_X_LIBS 4988 4989AC_CACHE_CHECK(for usable $cf_x_athena/Xmu package,cf_cv_xaw_compat,[ 4990AC_TRY_LINK([ 4991$ac_includes_default 4992#include <X11/Xmu/CharSet.h> 4993],[ 4994int check = XmuCompareISOLatin1("big", "small"); 4995(void)check; 4996],[cf_cv_xaw_compat=yes],[cf_cv_xaw_compat=no])]) 4997 4998 if test "$cf_cv_xaw_compat" = no 4999 then 5000 # workaround for broken ".pc" files... 5001 case "$cf_x_athena_lib" in 5002 (*-lXmu*) 5003 ;; 5004 (*) 5005 CF_VERBOSE(work around broken package) 5006 cf_save_xmu="$LIBS" 5007 cf_first_lib=`echo "$cf_save_xmu" | sed -e 's/^[ ][ ]*//' -e 's/ .*//'` 5008 CF_TRY_PKG_CONFIG(xmu,[ 5009 LIBS="$cf_save_xmu" 5010 CF_ADD_LIB_AFTER($cf_first_lib,$cf_pkgconfig_libs) 5011 ],[ 5012 CF_ADD_LIB_AFTER($cf_first_lib,-lXmu) 5013 ]) 5014 CF_TRIM_X_LIBS 5015 ;; 5016 esac 5017 fi 5018 5019 break]) 5020 done 5021fi 5022 5023if test -z "$cf_x_athena_lib" ; then 5024 CF_X_EXT 5025 CF_X_TOOLKIT 5026 CF_X_ATHENA_CPPFLAGS($cf_x_athena) 5027 CF_X_ATHENA_LIBS($cf_x_athena) 5028fi 5029])dnl 5030dnl --------------------------------------------------------------------------- 5031dnl CF_X_ATHENA_CPPFLAGS version: 9 updated: 2020/12/31 10:54:15 5032dnl -------------------- 5033dnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of 5034dnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw. 5035AC_DEFUN([CF_X_ATHENA_CPPFLAGS], 5036[ 5037AC_REQUIRE([AC_PATH_XTRA]) 5038cf_x_athena_root=ifelse([$1],,Xaw,[$1]) 5039cf_x_athena_inc="" 5040 5041for cf_path in default \ 5042 /usr/contrib/X11R6 \ 5043 /usr/contrib/X11R5 \ 5044 /usr/lib/X11R5 \ 5045 /usr/local 5046do 5047 if test -z "$cf_x_athena_inc" ; then 5048 CF_SAVE_XTRA_FLAGS([CF_X_ATHENA_CPPFLAGS]) 5049 cf_test=X11/$cf_x_athena_root/SimpleMenu.h 5050 if test "$cf_path" != default ; then 5051 CF_APPEND_TEXT(CPPFLAGS,-I$cf_path/include) 5052 AC_MSG_CHECKING(for $cf_test in $cf_path) 5053 else 5054 AC_MSG_CHECKING(for $cf_test) 5055 fi 5056 AC_TRY_COMPILE([ 5057#include <X11/Intrinsic.h> 5058#include <$cf_test>],[], 5059 [cf_result=yes], 5060 [cf_result=no]) 5061 AC_MSG_RESULT($cf_result) 5062 CF_RESTORE_XTRA_FLAGS([CF_X_ATHENA_CPPFLAGS]) 5063 if test "$cf_result" = yes ; then 5064 test "$cf_path" = default && cf_x_athena_inc=default 5065 test "$cf_path" != default && cf_x_athena_inc="$cf_path/include" 5066 break 5067 fi 5068 fi 5069done 5070 5071if test -z "$cf_x_athena_inc" ; then 5072 AC_MSG_WARN([Unable to find Athena header files]) 5073elif test "$cf_x_athena_inc" != default ; then 5074 CF_APPEND_TEXT(CPPFLAGS,-I$cf_x_athena_inc) 5075fi 5076]) 5077dnl --------------------------------------------------------------------------- 5078dnl CF_X_ATHENA_LIBS version: 14 updated: 2023/01/11 04:05:23 5079dnl ---------------- 5080dnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of 5081dnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw. 5082AC_DEFUN([CF_X_ATHENA_LIBS], 5083[AC_REQUIRE([CF_X_TOOLKIT]) 5084cf_x_athena_root=ifelse([$1],,Xaw,[$1]) 5085cf_x_athena_lib="" 5086 5087for cf_path in default \ 5088 /usr/contrib/X11R6 \ 5089 /usr/contrib/X11R5 \ 5090 /usr/lib/X11R5 \ 5091 /usr/local 5092do 5093 for cf_lib in \ 5094 ${cf_x_athena_root} \ 5095 ${cf_x_athena_root}7 \ 5096 ${cf_x_athena_root}6 5097 do 5098 for cf_libs in \ 5099 "-l$cf_lib -lXmu" \ 5100 "-l$cf_lib -lXpm -lXmu" \ 5101 "-l${cf_lib}_s -lXmu_s" 5102 do 5103 test -n "$cf_x_athena_lib" && break 5104 5105 CF_SAVE_XTRA_FLAGS([CF_X_ATHENA_LIBS]) 5106 cf_test=XawSimpleMenuAddGlobalActions 5107 test "$cf_path" != default && cf_libs="-L$cf_path/lib $cf_libs" 5108 CF_ADD_LIBS($cf_libs) 5109 AC_MSG_CHECKING(for $cf_test in $cf_libs) 5110 AC_TRY_LINK([ 5111$ac_includes_default 5112#include <X11/Intrinsic.h> 5113#include <X11/$cf_x_athena_root/SimpleMenu.h> 5114],[ 5115$cf_test((XtAppContext) 0)], 5116 [cf_result=yes], 5117 [cf_result=no]) 5118 AC_MSG_RESULT($cf_result) 5119 CF_RESTORE_XTRA_FLAGS([CF_X_ATHENA_LIBS]) 5120 5121 if test "$cf_result" = yes ; then 5122 cf_x_athena_lib="$cf_libs" 5123 break 5124 fi 5125 done # cf_libs 5126 test -n "$cf_x_athena_lib" && break 5127 done # cf_lib 5128done 5129 5130if test -z "$cf_x_athena_lib" ; then 5131 AC_MSG_ERROR( 5132[Unable to successfully link Athena library (-l$cf_x_athena_root) with test program]) 5133fi 5134 5135CF_ADD_LIBS($cf_x_athena_lib) 5136CF_UPPER(cf_x_athena_LIBS,HAVE_LIB_$cf_x_athena) 5137AC_DEFINE_UNQUOTED($cf_x_athena_LIBS) 5138]) 5139dnl --------------------------------------------------------------------------- 5140dnl CF_X_EXT version: 3 updated: 2010/06/02 05:03:05 5141dnl -------- 5142AC_DEFUN([CF_X_EXT],[ 5143CF_TRY_PKG_CONFIG(Xext,,[ 5144 AC_CHECK_LIB(Xext,XextCreateExtension, 5145 [CF_ADD_LIB(Xext)])]) 5146])dnl 5147dnl --------------------------------------------------------------------------- 5148dnl CF_X_EXT_DOUBLE_BUFFER version: 1 updated: 2019/07/18 21:09:40 5149dnl ---------------------- 5150AC_DEFUN([CF_X_EXT_DOUBLE_BUFFER],[ 5151AC_REQUIRE([CF_X_EXT]) 5152AC_CHECK_HEADER(X11/extensions/Xdbe.h, 5153 AC_DEFINE(HAVE_X11_EXTENSIONS_XDBE_H,1,[Define to 1 if we have X11/extensions/Xdbe.h]) 5154 AC_CHECK_FUNC(XdbeSwapBuffers, 5155 [AC_DEFINE(HAVE_XDBESWAPBUFFERS,1,[Define to 1 if we have XdbeSwapBuffers]) 5156 cf_x_ext_double_buffer=yes])) 5157])dnl 5158dnl --------------------------------------------------------------------------- 5159dnl CF_X_FONTCONFIG version: 7 updated: 2020/03/10 18:53:47 5160dnl --------------- 5161dnl Check for fontconfig library, a dependency of the X FreeType library. 5162AC_DEFUN([CF_X_FONTCONFIG], 5163[ 5164AC_REQUIRE([CF_X_FREETYPE]) 5165 5166if test "$cf_cv_found_freetype" = yes ; then 5167AC_CACHE_CHECK(for usable Xft/fontconfig package,cf_cv_xft_compat,[ 5168AC_TRY_LINK([ 5169#include <X11/Xft/Xft.h> 5170],[ 5171 XftPattern *pat = 0; 5172 XftPatternBuild(pat, 5173 XFT_FAMILY, XftTypeString, "mono", 5174 (void *) 0); 5175],[cf_cv_xft_compat=yes],[cf_cv_xft_compat=no]) 5176]) 5177 5178if test "$cf_cv_xft_compat" = no 5179then 5180 # workaround for broken ".pc" files used for Xft. 5181 case "$cf_cv_x_freetype_libs" in 5182 (*-lfontconfig*) 5183 ;; 5184 (*) 5185 CF_VERBOSE(work around broken package) 5186 cf_save_fontconfig="$LIBS" 5187 CF_TRY_PKG_CONFIG(fontconfig,[ 5188 CF_ADD_CFLAGS($cf_pkgconfig_incs) 5189 LIBS="$cf_save_fontconfig" 5190 CF_ADD_LIB_AFTER(-lXft,$cf_pkgconfig_libs) 5191 ],[ 5192 CF_ADD_LIB_AFTER(-lXft,-lfontconfig) 5193 ]) 5194 ;; 5195 esac 5196fi 5197fi 5198])dnl 5199dnl --------------------------------------------------------------------------- 5200dnl CF_X_FREETYPE version: 28 updated: 2020/03/10 18:53:47 5201dnl ------------- 5202dnl Check for X FreeType headers and libraries (XFree86 4.x, etc). 5203dnl 5204dnl First check for the appropriate config program, since the developers for 5205dnl these libraries change their configuration (and config program) more or 5206dnl less randomly. If we cannot find the config program, do not bother trying 5207dnl to guess the latest variation of include/lib directories. 5208dnl 5209dnl If either or both of these configure-script options are not given, rely on 5210dnl the output of the config program to provide the cflags/libs options: 5211dnl --with-freetype-cflags 5212dnl --with-freetype-libs 5213AC_DEFUN([CF_X_FREETYPE], 5214[ 5215AC_REQUIRE([CF_PKG_CONFIG]) 5216 5217cf_cv_x_freetype_incs=no 5218cf_cv_x_freetype_libs=no 5219cf_extra_freetype_libs= 5220FREETYPE_CONFIG=none 5221FREETYPE_PARAMS= 5222 5223AC_MSG_CHECKING(for FreeType configuration script) 5224AC_ARG_WITH(freetype-config, 5225 [ --with-freetype-config configure script to use for FreeType], 5226 [cf_cv_x_freetype_cfgs="$withval"], 5227 [cf_cv_x_freetype_cfgs=auto]) 5228test -z $cf_cv_x_freetype_cfgs && cf_cv_x_freetype_cfgs=auto 5229test $cf_cv_x_freetype_cfgs = no && cf_cv_x_freetype_cfgs=none 5230AC_MSG_RESULT($cf_cv_x_freetype_cfgs) 5231 5232case $cf_cv_x_freetype_cfgs in 5233(none) 5234 AC_MSG_CHECKING(if you specified -D/-I options for FreeType) 5235 AC_ARG_WITH(freetype-cflags, 5236 [ --with-freetype-cflags -D/-I options for compiling with FreeType], 5237 [cf_cv_x_freetype_incs="$with_freetype_cflags"], 5238 [cf_cv_x_freetype_incs=no]) 5239 AC_MSG_RESULT($cf_cv_x_freetype_incs) 5240 5241 AC_MSG_CHECKING(if you specified -L/-l options for FreeType) 5242 AC_ARG_WITH(freetype-libs, 5243 [ --with-freetype-libs -L/-l options to link FreeType], 5244 [cf_cv_x_freetype_libs="$with_freetype_libs"], 5245 [cf_cv_x_freetype_libs=no]) 5246 AC_MSG_RESULT($cf_cv_x_freetype_libs) 5247 ;; 5248(auto) 5249 if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists xft; then 5250 FREETYPE_CONFIG=$PKG_CONFIG 5251 FREETYPE_PARAMS=xft 5252 else 5253 AC_PATH_PROG(FREETYPE_CONFIG, freetype-config, none) 5254 if test "$FREETYPE_CONFIG" != none; then 5255 FREETYPE_CONFIG=$FREETYPE_CONFIG 5256 cf_extra_freetype_libs="-lXft" 5257 else 5258 AC_PATH_PROG(FREETYPE_OLD_CONFIG, xft-config, none) 5259 if test "$FREETYPE_OLD_CONFIG" != none; then 5260 FREETYPE_CONFIG=$FREETYPE_OLD_CONFIG 5261 fi 5262 fi 5263 fi 5264 ;; 5265(pkg*) 5266 if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists xft; then 5267 FREETYPE_CONFIG=$cf_cv_x_freetype_cfgs 5268 FREETYPE_PARAMS=xft 5269 else 5270 AC_MSG_WARN(cannot find pkg-config for Xft) 5271 fi 5272 ;; 5273(*) 5274 AC_PATH_PROG(FREETYPE_XFT_CONFIG, $cf_cv_x_freetype_cfgs, none) 5275 if test "$FREETYPE_XFT_CONFIG" != none; then 5276 FREETYPE_CONFIG=$FREETYPE_XFT_CONFIG 5277 else 5278 AC_MSG_WARN(cannot find config script for Xft) 5279 fi 5280 ;; 5281esac 5282 5283if test "$FREETYPE_CONFIG" != none ; then 5284 AC_MSG_CHECKING(for FreeType config) 5285 AC_MSG_RESULT($FREETYPE_CONFIG $FREETYPE_PARAMS) 5286 5287 if test "$cf_cv_x_freetype_incs" = no ; then 5288 AC_MSG_CHECKING(for $FREETYPE_CONFIG cflags) 5289 cf_cv_x_freetype_incs="`$FREETYPE_CONFIG $FREETYPE_PARAMS --cflags 2>/dev/null`" 5290 AC_MSG_RESULT($cf_cv_x_freetype_incs) 5291 fi 5292 5293 if test "$cf_cv_x_freetype_libs" = no ; then 5294 AC_MSG_CHECKING(for $FREETYPE_CONFIG libs) 5295 cf_cv_x_freetype_libs="$cf_extra_freetype_libs `$FREETYPE_CONFIG $FREETYPE_PARAMS --libs 2>/dev/null`" 5296 AC_MSG_RESULT($cf_cv_x_freetype_libs) 5297 fi 5298fi 5299 5300if test "$cf_cv_x_freetype_incs" = no ; then 5301 cf_cv_x_freetype_incs= 5302fi 5303 5304if test "$cf_cv_x_freetype_libs" = no ; then 5305 cf_cv_x_freetype_libs=-lXft 5306fi 5307 5308AC_MSG_CHECKING(if we can link with FreeType libraries) 5309 5310cf_save_LIBS="$LIBS" 5311cf_save_INCS="$CPPFLAGS" 5312 5313CF_ADD_LIBS($cf_cv_x_freetype_libs) 5314CPPFLAGS="$CPPFLAGS $cf_cv_x_freetype_incs" 5315 5316AC_TRY_LINK([ 5317#include <X11/Xlib.h> 5318#include <X11/extensions/Xrender.h> 5319#include <X11/Xft/Xft.h>],[ 5320 XftPattern *pat = XftNameParse ("name"); (void)pat], 5321 [cf_cv_found_freetype=yes], 5322 [cf_cv_found_freetype=no]) 5323AC_MSG_RESULT($cf_cv_found_freetype) 5324 5325LIBS="$cf_save_LIBS" 5326CPPFLAGS="$cf_save_INCS" 5327 5328if test "$cf_cv_found_freetype" = yes ; then 5329 CF_ADD_LIBS($cf_cv_x_freetype_libs) 5330 CF_ADD_CFLAGS($cf_cv_x_freetype_incs) 5331 AC_DEFINE(XRENDERFONT,1,[Define to 1 if we can/should link with FreeType libraries]) 5332 5333AC_CHECK_FUNCS( \ 5334 XftDrawCharSpec \ 5335 XftDrawSetClip \ 5336 XftDrawSetClipRectangles \ 5337) 5338 5339else 5340 AC_MSG_WARN(No libraries found for FreeType) 5341 CPPFLAGS=`echo "$CPPFLAGS" | sed -e s/-DXRENDERFONT//` 5342fi 5343 5344# FIXME: revisit this if needed 5345AC_SUBST(HAVE_TYPE_FCCHAR32) 5346AC_SUBST(HAVE_TYPE_XFTCHARSPEC) 5347]) 5348dnl --------------------------------------------------------------------------- 5349dnl CF_X_TOOLKIT version: 27 updated: 2023/01/11 04:05:23 5350dnl ------------ 5351dnl Check for X Toolkit libraries 5352AC_DEFUN([CF_X_TOOLKIT], 5353[ 5354AC_REQUIRE([AC_PATH_XTRA]) 5355AC_REQUIRE([CF_CHECK_CACHE]) 5356 5357# OSX is schizoid about who owns /usr/X11 (old) versus /opt/X11 (new) (and 5358# in some cases has installed dummy files in the former, other cases replaced 5359# it with a link to the new location). This complicates the configure script. 5360# Check for that pitfall, and recover using pkg-config 5361# 5362# If none of these are set, the configuration is almost certainly broken. 5363if test -z "${X_CFLAGS}${X_PRE_LIBS}${X_LIBS}${X_EXTRA_LIBS}" 5364then 5365 CF_TRY_PKG_CONFIG(x11,,[AC_MSG_WARN(unable to find X11 library)]) 5366 CF_TRY_PKG_CONFIG(ice,,[AC_MSG_WARN(unable to find ICE library)]) 5367 CF_TRY_PKG_CONFIG(sm,,[AC_MSG_WARN(unable to find SM library)]) 5368 CF_TRY_PKG_CONFIG(xt,,[AC_MSG_WARN(unable to find Xt library)]) 5369else 5370 LIBS="$X_PRE_LIBS $LIBS $X_EXTRA_LIBS" 5371fi 5372 5373cf_have_X_LIBS=no 5374 5375CF_TRY_PKG_CONFIG(xt,[ 5376 5377 case "x$LIBS" in 5378 (*-lX11*) 5379 ;; 5380 (*) 5381# we have an "xt" package, but it may omit Xt's dependency on X11 5382AC_CACHE_CHECK(for usable X dependency,cf_cv_xt_x11_compat,[ 5383AC_TRY_LINK([ 5384$ac_includes_default 5385#include <X11/Xlib.h> 5386],[ 5387 int rc1 = XDrawLine((Display*) 0, (Drawable) 0, (GC) 0, 0, 0, 0, 0); 5388 int rc2 = XClearWindow((Display*) 0, (Window) 0); 5389 int rc3 = XMoveWindow((Display*) 0, (Window) 0, 0, 0); 5390 int rc4 = XMoveResizeWindow((Display*)0, (Window)0, 0, 0, 0, 0); 5391],[cf_cv_xt_x11_compat=yes],[cf_cv_xt_x11_compat=no])]) 5392 if test "$cf_cv_xt_x11_compat" = no 5393 then 5394 CF_VERBOSE(work around broken X11 dependency) 5395 # 2010/11/19 - good enough until a working Xt on Xcb is delivered. 5396 CF_TRY_PKG_CONFIG(x11,,[CF_ADD_LIB_AFTER(-lXt,-lX11)]) 5397 fi 5398 ;; 5399 esac 5400 5401AC_CACHE_CHECK(for usable X Toolkit package,cf_cv_xt_ice_compat,[ 5402AC_TRY_LINK([ 5403$ac_includes_default 5404#include <X11/Shell.h> 5405],[int num = IceConnectionNumber(0); (void) num 5406],[cf_cv_xt_ice_compat=yes],[cf_cv_xt_ice_compat=no])]) 5407 5408 if test "$cf_cv_xt_ice_compat" = no 5409 then 5410 # workaround for broken ".pc" files used for X Toolkit. 5411 case "x$X_PRE_LIBS" in 5412 (*-lICE*) 5413 case "x$LIBS" in 5414 (*-lICE*) 5415 ;; 5416 (*) 5417 CF_VERBOSE(work around broken ICE dependency) 5418 CF_TRY_PKG_CONFIG(ice, 5419 [CF_TRY_PKG_CONFIG(sm)], 5420 [CF_ADD_LIB_AFTER(-lXt,$X_PRE_LIBS)]) 5421 ;; 5422 esac 5423 ;; 5424 esac 5425 fi 5426 5427 cf_have_X_LIBS=yes 5428],[ 5429 5430 LDFLAGS="$X_LIBS $LDFLAGS" 5431 CF_CHECK_CFLAGS($X_CFLAGS) 5432 5433 AC_CHECK_FUNC(XOpenDisplay,,[ 5434 AC_CHECK_LIB(X11,XOpenDisplay, 5435 [CF_ADD_LIB(X11)])]) 5436 5437 AC_CHECK_FUNC(XtAppInitialize,,[ 5438 AC_CHECK_LIB(Xt, XtAppInitialize, 5439 [AC_DEFINE(HAVE_LIBXT,1,[Define to 1 if we can compile with the Xt library]) 5440 cf_have_X_LIBS=Xt 5441 LIBS="-lXt $LIBS"])]) 5442]) 5443 5444if test "$cf_have_X_LIBS" = no ; then 5445 AC_MSG_WARN( 5446[Unable to successfully link X Toolkit library (-lXt) with 5447test program. You will have to check and add the proper libraries by hand 5448to makefile.]) 5449fi 5450])dnl 5451dnl --------------------------------------------------------------------------- 5452dnl CF__GRANTPT_BODY version: 6 updated: 2021/06/07 17:39:17 5453dnl ---------------- 5454dnl Body for workability check of grantpt. 5455define([CF__GRANTPT_BODY],[ 5456 int code = 0; 5457 int pty; 5458 int tty; 5459 char *slave; 5460 struct termios tio; 5461 5462 (void)tio; 5463 signal(SIGALRM, my_timeout); 5464 5465 if (alarm(2) == 9) 5466 failed(9); 5467 else if ((pty = posix_openpt(O_RDWR)) < 0) 5468 failed(1); 5469 else if (grantpt(pty) < 0) 5470 failed(2); 5471 else if (unlockpt(pty) < 0) 5472 failed(3); 5473 else if ((slave = ptsname(pty)) == 0) 5474 failed(4); 5475#if (CONFTEST == 3) || defined(CONFTEST_isatty) 5476 else if (!isatty(pty)) 5477 failed(4); 5478#endif 5479#if CONFTEST >= 4 5480 else if (tcgetattr(pty, &tio) < 0) 5481 failed(20); 5482 else if (tcsetattr(pty, TCSAFLUSH, &tio) < 0) 5483 failed(21); 5484#endif 5485 /* BSD posix_openpt does not treat pty as a terminal until slave is opened. 5486 * Linux does treat it that way. 5487 */ 5488 else if ((tty = open(slave, O_RDWR)) < 0) 5489 failed(5); 5490#ifdef CONFTEST 5491#ifdef I_PUSH 5492#if (CONFTEST == 0) || defined(CONFTEST_ptem) 5493 else if (ioctl(tty, I_PUSH, "ptem") < 0) 5494 failed(10); 5495#endif 5496#if (CONFTEST == 1) || defined(CONFTEST_ldterm) 5497 else if (ioctl(tty, I_PUSH, "ldterm") < 0) 5498 failed(11); 5499#endif 5500#if (CONFTEST == 2) || defined(CONFTEST_ttcompat) 5501 else if (ioctl(tty, I_PUSH, "ttcompat") < 0) 5502 failed(12); 5503#endif 5504#endif /* I_PUSH */ 5505#if CONFTEST >= 5 5506 else if (tcgetattr(tty, &tio) < 0) 5507 failed(30); 5508 else if (tcsetattr(tty, TCSAFLUSH, &tio) < 0) 5509 failed(31); 5510#endif 5511#endif /* CONFTEST */ 5512 (void) tty; 5513 ${cf_cv_main_return:-return}(code); 5514]) 5515dnl --------------------------------------------------------------------------- 5516dnl CF__GRANTPT_HEAD version: 4 updated: 2020/03/10 18:53:47 5517dnl ---------------- 5518dnl Headers for workability check of grantpt. 5519define([CF__GRANTPT_HEAD],[ 5520#include <stdlib.h> 5521#include <stdio.h> 5522#include <termios.h> 5523#include <unistd.h> 5524#include <signal.h> 5525#include <fcntl.h> 5526#include <errno.h> 5527 5528#ifndef HAVE_POSIX_OPENPT 5529#undef posix_openpt 5530#define posix_openpt(mode) open("/dev/ptmx", mode) 5531#endif 5532 5533#ifdef HAVE_STROPTS_H 5534#include <stropts.h> 5535#endif 5536 5537static void failed(int code) 5538{ 5539 perror("conftest"); 5540 exit(code); 5541} 5542 5543static void my_timeout(int sig) 5544{ 5545 (void)sig; 5546 exit(99); 5547} 5548]) 5549dnl --------------------------------------------------------------------------- 5550dnl CF__XOPEN_SOURCE_BODY version: 2 updated: 2023/02/18 17:41:25 5551dnl --------------------- 5552dnl body of test when test-compiling for _XOPEN_SOURCE check 5553define([CF__XOPEN_SOURCE_BODY], 5554[ 5555#ifndef _XOPEN_SOURCE 5556#error _XOPEN_SOURCE is not defined 5557#endif 5558]) 5559dnl --------------------------------------------------------------------------- 5560dnl CF__XOPEN_SOURCE_HEAD version: 2 updated: 2023/02/18 17:41:25 5561dnl --------------------- 5562dnl headers to include when test-compiling for _XOPEN_SOURCE check 5563define([CF__XOPEN_SOURCE_HEAD], 5564[ 5565$ac_includes_default 5566]) 5567