"Fossies" - the Fresh Open Source Software Archive

Member "xterm-368/aclocal.m4" (7 Jun 2021, 159552 Bytes) of package /linux/misc/xterm-368.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": 367_vs_368.

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