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