"Fossies" - the Fresh Open Source Software Archive

Member "xterm-379/aclocal.m4" (10 Feb 2023, 165168 Bytes) of package /linux/misc/xterm-379.tgz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "aclocal.m4": 377_vs_379.

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