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