aclocal.m4 revision 04b94745
104b94745Smrgdnl $XTermId: aclocal.m4,v 1.526 2024/05/11 17:41:03 tom Exp $ 2d522f475Smrgdnl 3d522f475Smrgdnl --------------------------------------------------------------------------- 4d522f475Smrgdnl 504b94745Smrgdnl Copyright 1997-2023,2024 by Thomas E. Dickey 6d522f475Smrgdnl 7d522f475Smrgdnl All Rights Reserved 8d522f475Smrgdnl 920d2c4d2Smrgdnl Permission is hereby granted, free of charge, to any person obtaining a 1020d2c4d2Smrgdnl copy of this software and associated documentation files (the 1120d2c4d2Smrgdnl "Software"), to deal in the Software without restriction, including 1220d2c4d2Smrgdnl without limitation the rights to use, copy, modify, merge, publish, 1320d2c4d2Smrgdnl distribute, sublicense, and/or sell copies of the Software, and to 1420d2c4d2Smrgdnl permit persons to whom the Software is furnished to do so, subject to 1520d2c4d2Smrgdnl the following conditions: 160bd37d32Smrgdnl 1720d2c4d2Smrgdnl The above copyright notice and this permission notice shall be included 1820d2c4d2Smrgdnl in all copies or substantial portions of the Software. 190bd37d32Smrgdnl 2020d2c4d2Smrgdnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 2120d2c4d2Smrgdnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 2220d2c4d2Smrgdnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 2320d2c4d2Smrgdnl IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY 2420d2c4d2Smrgdnl CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 2520d2c4d2Smrgdnl TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 2620d2c4d2Smrgdnl SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 270bd37d32Smrgdnl 2820d2c4d2Smrgdnl Except as contained in this notice, the name(s) of the above copyright 2920d2c4d2Smrgdnl holders shall not be used in advertising or otherwise to promote the 3020d2c4d2Smrgdnl sale, use or other dealings in this Software without prior written 3120d2c4d2Smrgdnl authorization. 32d522f475Smrgdnl 33d522f475Smrgdnl --------------------------------------------------------------------------- 3420d2c4d2Smrgdnl See 35f2e35a3aSmrgdnl https://invisible-island.net/autoconf/autoconf.html 36f2e35a3aSmrgdnl https://invisible-island.net/autoconf/my-autoconf.html 3720d2c4d2Smrgdnl --------------------------------------------------------------------------- 38d522f475Smrgdnl --------------------------------------------------------------------------- 395307cd1aSmrgdnl AM_LANGINFO_CODESET version: 7 updated: 2023/01/11 04:05:23 40d522f475Smrgdnl ------------------- 41d522f475Smrgdnl Inserted as requested by gettext 0.10.40 42d522f475Smrgdnl File from /usr/share/aclocal 43d522f475Smrgdnl codeset.m4 44d522f475Smrgdnl ==================== 45d522f475Smrgdnl serial AM1 46d522f475Smrgdnl 47d522f475Smrgdnl From Bruno Haible. 48d522f475SmrgAC_DEFUN([AM_LANGINFO_CODESET], 49d522f475Smrg[ 502e4f8982SmrgAC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset, 515307cd1aSmrg [AC_TRY_LINK([ 525307cd1aSmrg$ac_includes_default 535307cd1aSmrg#include <langinfo.h>], 54f2e35a3aSmrg [char* cs = nl_langinfo(CODESET); (void)cs], 552e4f8982Smrg am_cv_langinfo_codeset=yes, 562e4f8982Smrg am_cv_langinfo_codeset=no) 572e4f8982Smrg ]) 58f2e35a3aSmrg if test "$am_cv_langinfo_codeset" = yes; then 592e4f8982Smrg AC_DEFINE(HAVE_LANGINFO_CODESET, 1, 602e4f8982Smrg [Define if you have <langinfo.h> and nl_langinfo(CODESET).]) 612e4f8982Smrg fi 62d522f475Smrg])dnl 63d522f475Smrgdnl --------------------------------------------------------------------------- 6401037d57Smrgdnl CF_ACVERSION_CHECK version: 5 updated: 2014/06/04 19:11:49 65e39b573cSmrgdnl ------------------ 66e39b573cSmrgdnl Conditionally generate script according to whether we're using a given autoconf. 67e39b573cSmrgdnl 68e39b573cSmrgdnl $1 = version to compare against 69e39b573cSmrgdnl $2 = code to use if AC_ACVERSION is at least as high as $1. 70e39b573cSmrgdnl $3 = code to use if AC_ACVERSION is older than $1. 710bd37d32Smrgdefine([CF_ACVERSION_CHECK], 72e39b573cSmrg[ 7301037d57Smrgifdef([AC_ACVERSION], ,[ifdef([AC_AUTOCONF_VERSION],[m4_copy([AC_AUTOCONF_VERSION],[AC_ACVERSION])],[m4_copy([m4_PACKAGE_VERSION],[AC_ACVERSION])])])dnl 74e39b573cSmrgifdef([m4_version_compare], 75e39b573cSmrg[m4_if(m4_version_compare(m4_defn([AC_ACVERSION]), [$1]), -1, [$3], [$2])], 76e39b573cSmrg[CF_ACVERSION_COMPARE( 77e39b573cSmrgAC_PREREQ_CANON(AC_PREREQ_SPLIT([$1])), 78e39b573cSmrgAC_PREREQ_CANON(AC_PREREQ_SPLIT(AC_ACVERSION)), AC_ACVERSION, [$2], [$3])])])dnl 79e39b573cSmrgdnl --------------------------------------------------------------------------- 800bd37d32Smrgdnl CF_ACVERSION_COMPARE version: 3 updated: 2012/10/03 18:39:53 81e39b573cSmrgdnl -------------------- 82e39b573cSmrgdnl CF_ACVERSION_COMPARE(MAJOR1, MINOR1, TERNARY1, 83e39b573cSmrgdnl MAJOR2, MINOR2, TERNARY2, 84e39b573cSmrgdnl PRINTABLE2, not FOUND, FOUND) 850bd37d32Smrgdefine([CF_ACVERSION_COMPARE], 86e39b573cSmrg[ifelse(builtin([eval], [$2 < $5]), 1, 87e39b573cSmrg[ifelse([$8], , ,[$8])], 88e39b573cSmrg[ifelse([$9], , ,[$9])])])dnl 89e39b573cSmrgdnl --------------------------------------------------------------------------- 90f2e35a3aSmrgdnl CF_ADD_CFLAGS version: 15 updated: 2020/12/31 10:54:15 91d522f475Smrgdnl ------------- 92d522f475Smrgdnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS 93f2e35a3aSmrgdnl $1 = flags to add 94f2e35a3aSmrgdnl $2 = if given makes this macro verbose. 95d522f475Smrgdnl 96d522f475Smrgdnl Put any preprocessor definitions that use quoted strings in $EXTRA_CPPFLAGS, 97d522f475Smrgdnl to simplify use of $CPPFLAGS in compiler checks, etc., that are easily 98d522f475Smrgdnl confused by the quotes (which require backslashes to keep them usable). 99d522f475SmrgAC_DEFUN([CF_ADD_CFLAGS], 100d522f475Smrg[ 101d522f475Smrgcf_fix_cppflags=no 102d522f475Smrgcf_new_cflags= 103d522f475Smrgcf_new_cppflags= 104d522f475Smrgcf_new_extra_cppflags= 105d522f475Smrg 106d522f475Smrgfor cf_add_cflags in $1 107d522f475Smrgdo 108f2e35a3aSmrgcase "$cf_fix_cppflags" in 10901037d57Smrg(no) 110f2e35a3aSmrg case "$cf_add_cflags" in 11101037d57Smrg (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) 112f2e35a3aSmrg case "$cf_add_cflags" in 11301037d57Smrg (-D*) 114f2e35a3aSmrg cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^-D[[^=]]*='\''\"[[^"]]*//'` 115d522f475Smrg 11601037d57Smrg test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ 11720d2c4d2Smrg && test -z "${cf_tst_cflags}" \ 11820d2c4d2Smrg && cf_fix_cppflags=yes 119d522f475Smrg 120f2e35a3aSmrg if test "$cf_fix_cppflags" = yes ; then 121913cc679Smrg CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags) 122d522f475Smrg continue 123d522f475Smrg elif test "${cf_tst_cflags}" = "\"'" ; then 124913cc679Smrg CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags) 125d522f475Smrg continue 126d522f475Smrg fi 127d522f475Smrg ;; 128d522f475Smrg esac 129d522f475Smrg case "$CPPFLAGS" in 13001037d57Smrg (*$cf_add_cflags) 131d522f475Smrg ;; 13201037d57Smrg (*) 133f2e35a3aSmrg case "$cf_add_cflags" in 13401037d57Smrg (-D*) 13520d2c4d2Smrg cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` 13620d2c4d2Smrg CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,$cf_tst_cppflags) 13720d2c4d2Smrg ;; 13820d2c4d2Smrg esac 139913cc679Smrg CF_APPEND_TEXT(cf_new_cppflags,$cf_add_cflags) 140d522f475Smrg ;; 141d522f475Smrg esac 142d522f475Smrg ;; 14301037d57Smrg (*) 144913cc679Smrg CF_APPEND_TEXT(cf_new_cflags,$cf_add_cflags) 145d522f475Smrg ;; 146d522f475Smrg esac 147d522f475Smrg ;; 14801037d57Smrg(yes) 149913cc679Smrg CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags) 150d522f475Smrg 151f2e35a3aSmrg cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^[[^"]]*"'\''//'` 152d522f475Smrg 15301037d57Smrg test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ 15420d2c4d2Smrg && test -z "${cf_tst_cflags}" \ 15520d2c4d2Smrg && cf_fix_cppflags=no 156d522f475Smrg ;; 157d522f475Smrgesac 158d522f475Smrgdone 159d522f475Smrg 160d522f475Smrgif test -n "$cf_new_cflags" ; then 16120d2c4d2Smrg ifelse([$2],,,[CF_VERBOSE(add to \$CFLAGS $cf_new_cflags)]) 162913cc679Smrg CF_APPEND_TEXT(CFLAGS,$cf_new_cflags) 163d522f475Smrgfi 164d522f475Smrg 165d522f475Smrgif test -n "$cf_new_cppflags" ; then 16620d2c4d2Smrg ifelse([$2],,,[CF_VERBOSE(add to \$CPPFLAGS $cf_new_cppflags)]) 167913cc679Smrg CF_APPEND_TEXT(CPPFLAGS,$cf_new_cppflags) 168d522f475Smrgfi 169d522f475Smrg 170d522f475Smrgif test -n "$cf_new_extra_cppflags" ; then 17120d2c4d2Smrg ifelse([$2],,,[CF_VERBOSE(add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags)]) 172913cc679Smrg CF_APPEND_TEXT(EXTRA_CPPFLAGS,$cf_new_extra_cppflags) 173d522f475Smrgfi 174d522f475Smrg 175d522f475SmrgAC_SUBST(EXTRA_CPPFLAGS) 176d522f475Smrg 177d522f475Smrg])dnl 178d522f475Smrgdnl --------------------------------------------------------------------------- 17920d2c4d2Smrgdnl CF_ADD_LIB version: 2 updated: 2010/06/02 05:03:05 18020d2c4d2Smrgdnl ---------- 18120d2c4d2Smrgdnl Add a library, used to enforce consistency. 18220d2c4d2Smrgdnl 18320d2c4d2Smrgdnl $1 = library to add, without the "-l" 18420d2c4d2Smrgdnl $2 = variable to update (default $LIBS) 18520d2c4d2SmrgAC_DEFUN([CF_ADD_LIB],[CF_ADD_LIBS(-l$1,ifelse($2,,LIBS,[$2]))])dnl 18620d2c4d2Smrgdnl --------------------------------------------------------------------------- 187f2e35a3aSmrgdnl CF_ADD_LIBS version: 3 updated: 2019/11/02 16:47:33 18820d2c4d2Smrgdnl ----------- 18901037d57Smrgdnl Add one or more libraries, used to enforce consistency. Libraries are 19001037d57Smrgdnl prepended to an existing list, since their dependencies are assumed to 19101037d57Smrgdnl already exist in the list. 19220d2c4d2Smrgdnl 19320d2c4d2Smrgdnl $1 = libraries to add, with the "-l", etc. 19420d2c4d2Smrgdnl $2 = variable to update (default $LIBS) 19501037d57SmrgAC_DEFUN([CF_ADD_LIBS],[ 196f2e35a3aSmrgcf_add_libs="[$]ifelse($2,,LIBS,[$2])" 197f2e35a3aSmrg# reverse order 198f2e35a3aSmrgcf_add_0lib= 199f2e35a3aSmrgfor cf_add_1lib in $1; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done 200f2e35a3aSmrg# filter duplicates 201f2e35a3aSmrgfor cf_add_1lib in $cf_add_0lib; do 202f2e35a3aSmrg for cf_add_2lib in $cf_add_libs; do 203f2e35a3aSmrg if test "x$cf_add_1lib" = "x$cf_add_2lib"; then 20401037d57Smrg cf_add_1lib= 20501037d57Smrg break 20601037d57Smrg fi 20701037d57Smrg done 208f2e35a3aSmrg test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" 20901037d57Smrgdone 21001037d57Smrgifelse($2,,LIBS,[$2])="$cf_add_libs" 21101037d57Smrg])dnl 21220d2c4d2Smrgdnl --------------------------------------------------------------------------- 213e0a2b6dfSmrgdnl CF_ADD_LIB_AFTER version: 3 updated: 2013/07/09 21:27:22 2146879286fSmrgdnl ---------------- 2156879286fSmrgdnl Add a given library after another, e.g., following the one it satisfies a 2166879286fSmrgdnl dependency for. 2176879286fSmrgdnl 2186879286fSmrgdnl $1 = the first library 2196879286fSmrgdnl $2 = its dependency 2206879286fSmrgAC_DEFUN([CF_ADD_LIB_AFTER],[ 2216879286fSmrgCF_VERBOSE(...before $LIBS) 222e0a2b6dfSmrgLIBS=`echo "$LIBS" | sed -e "s/[[ ]][[ ]]*/ /g" -e "s%$1 %$1 $2 %" -e 's% % %g'` 2236879286fSmrgCF_VERBOSE(...after $LIBS) 2246879286fSmrg])dnl 2256879286fSmrgdnl --------------------------------------------------------------------------- 226a5ae21e4Smrgdnl CF_APPEND_CFLAGS version: 3 updated: 2021/09/05 17:25:40 227a5ae21e4Smrgdnl ---------------- 228a5ae21e4Smrgdnl Use CF_ADD_CFLAGS after first checking for potential redefinitions. 229a5ae21e4Smrgdnl $1 = flags to add 230a5ae21e4Smrgdnl $2 = if given makes this macro verbose. 231a5ae21e4Smrgdefine([CF_APPEND_CFLAGS], 232a5ae21e4Smrg[ 233a5ae21e4Smrgfor cf_add_cflags in $1 234a5ae21e4Smrgdo 235a5ae21e4Smrg case "x$cf_add_cflags" in 236a5ae21e4Smrg (x-[[DU]]*) 237a5ae21e4Smrg CF_REMOVE_CFLAGS($cf_add_cflags,CFLAGS,[$2]) 238a5ae21e4Smrg CF_REMOVE_CFLAGS($cf_add_cflags,CPPFLAGS,[$2]) 239a5ae21e4Smrg ;; 240a5ae21e4Smrg esac 241a5ae21e4Smrg CF_ADD_CFLAGS([$cf_add_cflags],[$2]) 242a5ae21e4Smrgdone 243a5ae21e4Smrg])dnl 244a5ae21e4Smrgdnl --------------------------------------------------------------------------- 245913cc679Smrgdnl CF_APPEND_TEXT version: 1 updated: 2017/02/25 18:58:55 246913cc679Smrgdnl -------------- 247913cc679Smrgdnl use this macro for appending text without introducing an extra blank at 248913cc679Smrgdnl the beginning 249913cc679Smrgdefine([CF_APPEND_TEXT], 250913cc679Smrg[ 251913cc679Smrg test -n "[$]$1" && $1="[$]$1 " 252913cc679Smrg $1="[$]{$1}$2" 253913cc679Smrg])dnl 254913cc679Smrgdnl --------------------------------------------------------------------------- 255d522f475Smrgdnl CF_ARG_DISABLE version: 3 updated: 1999/03/30 17:24:31 256d522f475Smrgdnl -------------- 257d522f475Smrgdnl Allow user to disable a normally-on option. 258d522f475SmrgAC_DEFUN([CF_ARG_DISABLE], 259d522f475Smrg[CF_ARG_OPTION($1,[$2],[$3],[$4],yes)])dnl 260d522f475Smrgdnl --------------------------------------------------------------------------- 261d522f475Smrgdnl CF_ARG_ENABLE version: 3 updated: 1999/03/30 17:24:31 262d522f475Smrgdnl ------------- 263d522f475Smrgdnl Allow user to enable a normally-off option. 264d522f475SmrgAC_DEFUN([CF_ARG_ENABLE], 265d522f475Smrg[CF_ARG_OPTION($1,[$2],[$3],[$4],no)])dnl 266d522f475Smrgdnl --------------------------------------------------------------------------- 2672e4f8982Smrgdnl CF_ARG_OPTION version: 5 updated: 2015/05/10 19:52:14 268d522f475Smrgdnl ------------- 269d522f475Smrgdnl Restricted form of AC_ARG_ENABLE that ensures user doesn't give bogus 270d522f475Smrgdnl values. 271d522f475Smrgdnl 272d522f475Smrgdnl Parameters: 273d522f475Smrgdnl $1 = option name 274d522f475Smrgdnl $2 = help-string 275d522f475Smrgdnl $3 = action to perform if option is not default 276d522f475Smrgdnl $4 = action if perform if option is default 277d522f475Smrgdnl $5 = default option value (either 'yes' or 'no') 278d522f475SmrgAC_DEFUN([CF_ARG_OPTION], 27920d2c4d2Smrg[AC_ARG_ENABLE([$1],[$2],[test "$enableval" != ifelse([$5],no,yes,no) && enableval=ifelse([$5],no,no,yes) 2802e4f8982Smrg if test "$enableval" != "$5" ; then 28120d2c4d2Smrgifelse([$3],,[ :]dnl 28220d2c4d2Smrg,[ $3]) ifelse([$4],,,[ 2832e4f8982Smrg else 2842e4f8982Smrg $4]) 2852e4f8982Smrg fi],[enableval=$5 ifelse([$4],,,[ 2862e4f8982Smrg $4 287d522f475Smrg])dnl 2882e4f8982Smrg])])dnl 289d522f475Smrgdnl --------------------------------------------------------------------------- 2905307cd1aSmrgdnl CF_C11_NORETURN version: 4 updated: 2023/02/18 17:41:25 291ad37e533Smrgdnl --------------- 292ad37e533SmrgAC_DEFUN([CF_C11_NORETURN], 293ad37e533Smrg[ 294ad37e533SmrgAC_MSG_CHECKING(if you want to use C11 _Noreturn feature) 295ad37e533SmrgCF_ARG_ENABLE(stdnoreturn, 296ad37e533Smrg [ --enable-stdnoreturn enable C11 _Noreturn feature for diagnostics], 297ad37e533Smrg [enable_stdnoreturn=yes], 298ad37e533Smrg [enable_stdnoreturn=no]) 299ad37e533SmrgAC_MSG_RESULT($enable_stdnoreturn) 300ad37e533Smrg 301ad37e533Smrgif test $enable_stdnoreturn = yes; then 302ad37e533SmrgAC_CACHE_CHECK([for C11 _Noreturn feature], cf_cv_c11_noreturn, 303ad37e533Smrg [AC_TRY_COMPILE([ 3045307cd1aSmrg$ac_includes_default 305ad37e533Smrg#include <stdnoreturn.h> 306ae137402Smrgstatic _Noreturn void giveup(void) { exit(0); } 307ad37e533Smrg ], 308ad37e533Smrg [if (feof(stdin)) giveup()], 309ad37e533Smrg cf_cv_c11_noreturn=yes, 310ad37e533Smrg cf_cv_c11_noreturn=no) 311ad37e533Smrg ]) 312ad37e533Smrgelse 313ad37e533Smrg cf_cv_c11_noreturn=no, 314ad37e533Smrgfi 315ad37e533Smrg 316ad37e533Smrgif test "$cf_cv_c11_noreturn" = yes; then 317ae137402Smrg AC_DEFINE(HAVE_STDNORETURN_H, 1,[Define if <stdnoreturn.h> header is available and working]) 318ad37e533Smrg AC_DEFINE_UNQUOTED(STDC_NORETURN,_Noreturn,[Define if C11 _Noreturn keyword is supported]) 319ad37e533Smrg HAVE_STDNORETURN_H=1 320ad37e533Smrgelse 321ad37e533Smrg HAVE_STDNORETURN_H=0 322ad37e533Smrgfi 323ad37e533Smrg 324ad37e533SmrgAC_SUBST(HAVE_STDNORETURN_H) 325ae137402SmrgAC_SUBST(STDC_NORETURN) 326ad37e533Smrg])dnl 327ad37e533Smrgdnl --------------------------------------------------------------------------- 3285307cd1aSmrgdnl CF_CC_ENV_FLAGS version: 11 updated: 2023/02/20 11:15:46 3290bd37d32Smrgdnl --------------- 3300bd37d32Smrgdnl Check for user's environment-breakage by stuffing CFLAGS/CPPFLAGS content 331913cc679Smrgdnl into CC. This will not help with broken scripts that wrap the compiler 332913cc679Smrgdnl with options, but eliminates a more common category of user confusion. 333913cc679Smrgdnl 334913cc679Smrgdnl In particular, it addresses the problem of being able to run the C 335913cc679Smrgdnl preprocessor in a consistent manner. 3362e4f8982Smrgdnl 3372e4f8982Smrgdnl Caveat: this also disallows blanks in the pathname for the compiler, but 3382e4f8982Smrgdnl the nuisance of having inconsistent settings for compiler and preprocessor 3392e4f8982Smrgdnl outweighs that limitation. 3400bd37d32SmrgAC_DEFUN([CF_CC_ENV_FLAGS], 3410bd37d32Smrg[ 3420bd37d32Smrg# This should have been defined by AC_PROG_CC 343f2e35a3aSmrg: "${CC:=cc}" 344f2e35a3aSmrg 345f2e35a3aSmrgAC_MSG_CHECKING(\$CFLAGS variable) 346f2e35a3aSmrgcase "x$CFLAGS" in 347f2e35a3aSmrg(*-[[IUD]]*) 348f2e35a3aSmrg AC_MSG_RESULT(broken) 349f2e35a3aSmrg AC_MSG_WARN(your environment uses the CFLAGS variable to hold CPPFLAGS options) 350f2e35a3aSmrg cf_flags="$CFLAGS" 351f2e35a3aSmrg CFLAGS= 352f2e35a3aSmrg for cf_arg in $cf_flags 353f2e35a3aSmrg do 354f2e35a3aSmrg CF_ADD_CFLAGS($cf_arg) 355f2e35a3aSmrg done 356f2e35a3aSmrg ;; 357f2e35a3aSmrg(*) 358f2e35a3aSmrg AC_MSG_RESULT(ok) 359f2e35a3aSmrg ;; 360f2e35a3aSmrgesac 3610bd37d32Smrg 3620bd37d32SmrgAC_MSG_CHECKING(\$CC variable) 36301037d57Smrgcase "$CC" in 3642e4f8982Smrg(*[[\ \ ]]-*) 3650bd37d32Smrg AC_MSG_RESULT(broken) 366f2e35a3aSmrg AC_MSG_WARN(your environment uses the CC variable to hold CFLAGS/CPPFLAGS options) 3670bd37d32Smrg # humor him... 368913cc679Smrg cf_prog=`echo "$CC" | sed -e 's/ / /g' -e 's/[[ ]]* / /g' -e 's/[[ ]]*[[ ]]-[[^ ]].*//'` 3695307cd1aSmrg cf_flags=`echo "$CC" | sed -e "s%^$cf_prog%%"` 370913cc679Smrg CC="$cf_prog" 371913cc679Smrg for cf_arg in $cf_flags 372913cc679Smrg do 373913cc679Smrg case "x$cf_arg" in 374913cc679Smrg (x-[[IUDfgOW]]*) 375913cc679Smrg CF_ADD_CFLAGS($cf_arg) 376913cc679Smrg ;; 377913cc679Smrg (*) 378913cc679Smrg CC="$CC $cf_arg" 379913cc679Smrg ;; 380913cc679Smrg esac 381913cc679Smrg done 3822e4f8982Smrg CF_VERBOSE(resulting CC: '$CC') 3832e4f8982Smrg CF_VERBOSE(resulting CFLAGS: '$CFLAGS') 3842e4f8982Smrg CF_VERBOSE(resulting CPPFLAGS: '$CPPFLAGS') 3850bd37d32Smrg ;; 38601037d57Smrg(*) 3870bd37d32Smrg AC_MSG_RESULT(ok) 3880bd37d32Smrg ;; 3890bd37d32Smrgesac 3900bd37d32Smrg])dnl 3910bd37d32Smrgdnl --------------------------------------------------------------------------- 392f2e35a3aSmrgdnl CF_CHECK_CACHE version: 13 updated: 2020/12/31 10:54:15 393d522f475Smrgdnl -------------- 394d522f475Smrgdnl Check if we're accidentally using a cache from a different machine. 395d522f475Smrgdnl Derive the system name, as a check for reusing the autoconf cache. 396d522f475Smrgdnl 397d522f475Smrgdnl If we've packaged config.guess and config.sub, run that (since it does a 398d522f475Smrgdnl better job than uname). Normally we'll use AC_CANONICAL_HOST, but allow 399d522f475Smrgdnl an extra parameter that we may override, e.g., for AC_CANONICAL_SYSTEM 400d522f475Smrgdnl which is useful in cross-compiles. 401d522f475Smrgdnl 402d522f475Smrgdnl Note: we would use $ac_config_sub, but that is one of the places where 403d522f475Smrgdnl autoconf 2.5x broke compatibility with autoconf 2.13 404d522f475SmrgAC_DEFUN([CF_CHECK_CACHE], 405d522f475Smrg[ 406f2e35a3aSmrgif test -f "$srcdir/config.guess" || test -f "$ac_aux_dir/config.guess" ; then 407d522f475Smrg ifelse([$1],,[AC_CANONICAL_HOST],[$1]) 408d522f475Smrg system_name="$host_os" 409d522f475Smrgelse 410d522f475Smrg system_name="`(uname -s -r) 2>/dev/null`" 411d522f475Smrg if test -z "$system_name" ; then 412d522f475Smrg system_name="`(hostname) 2>/dev/null`" 413d522f475Smrg fi 414d522f475Smrgfi 4150bd37d32Smrgtest -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name",[Define to the system name.]) 416d522f475SmrgAC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"]) 417d522f475Smrg 418d522f475Smrgtest -z "$system_name" && system_name="$cf_cv_system_name" 419d522f475Smrgtest -n "$cf_cv_system_name" && AC_MSG_RESULT(Configuring for $cf_cv_system_name) 420d522f475Smrg 421d522f475Smrgif test ".$system_name" != ".$cf_cv_system_name" ; then 422d522f475Smrg AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)) 423d522f475Smrg AC_MSG_ERROR("Please remove config.cache and try again.") 424d522f475Smrgfi 425d522f475Smrg])dnl 426d522f475Smrgdnl --------------------------------------------------------------------------- 427f2e35a3aSmrgdnl CF_CHECK_CFLAGS version: 4 updated: 2021/01/02 19:22:58 428d522f475Smrgdnl --------------- 429d522f475Smrgdnl Conditionally add to $CFLAGS and $CPPFLAGS values which are derived from 430d522f475Smrgdnl a build-configuration such as imake. These have the pitfall that they 431d522f475Smrgdnl often contain compiler-specific options which we cannot use, mixed with 432d522f475Smrgdnl preprocessor options that we usually can. 433d522f475SmrgAC_DEFUN([CF_CHECK_CFLAGS], 434d522f475Smrg[ 435d522f475SmrgCF_VERBOSE(checking additions to CFLAGS) 436d522f475Smrgcf_check_cflags="$CFLAGS" 437d522f475Smrgcf_check_cppflags="$CPPFLAGS" 438d522f475SmrgCF_ADD_CFLAGS($1,yes) 43901037d57Smrgif test "x$cf_check_cflags" != "x$CFLAGS" ; then 440d522f475SmrgAC_TRY_LINK([#include <stdio.h>],[printf("Hello world");],, 441d522f475Smrg [CF_VERBOSE(test-compile failed. Undoing change to \$CFLAGS) 44201037d57Smrg if test "x$cf_check_cppflags" != "x$CPPFLAGS" ; then 443d522f475Smrg CF_VERBOSE(but keeping change to \$CPPFLAGS) 444d522f475Smrg fi 445f2e35a3aSmrg CFLAGS="$cf_check_cflags"]) 446d522f475Smrgfi 447d522f475Smrg])dnl 448d522f475Smrgdnl --------------------------------------------------------------------------- 4495307cd1aSmrgdnl CF_CHECK_ERRNO version: 14 updated: 2023/02/18 17:41:25 450d522f475Smrgdnl -------------- 451d522f475Smrgdnl Check for data that is usually declared in <stdio.h> or <errno.h>, e.g., 452d522f475Smrgdnl the 'errno' variable. Define a DECL_xxx symbol if we must declare it 453d522f475Smrgdnl ourselves. 454d522f475Smrgdnl 455d522f475Smrgdnl $1 = the name to check 4562eaa94a1Schristosdnl $2 = the assumed type 457d522f475SmrgAC_DEFUN([CF_CHECK_ERRNO], 458d522f475Smrg[ 459d522f475SmrgAC_CACHE_CHECK(if external $1 is declared, cf_cv_dcl_$1,[ 4602e4f8982Smrg AC_TRY_COMPILE([ 4615307cd1aSmrg$ac_includes_default 462d522f475Smrg#include <errno.h> ], 463f2e35a3aSmrg ifelse([$2],,int,[$2]) x = (ifelse([$2],,int,[$2])) $1; (void)x, 4642e4f8982Smrg [cf_cv_dcl_$1=yes], 4652e4f8982Smrg [cf_cv_dcl_$1=no]) 466d522f475Smrg]) 467d522f475Smrg 468d522f475Smrgif test "$cf_cv_dcl_$1" = no ; then 4692e4f8982Smrg CF_UPPER(cf_result,decl_$1) 4702e4f8982Smrg AC_DEFINE_UNQUOTED($cf_result) 471d522f475Smrgfi 472d522f475Smrg 473d522f475Smrg# It's possible (for near-UNIX clones) that the data doesn't exist 47420d2c4d2SmrgCF_CHECK_EXTERN_DATA($1,ifelse([$2],,int,[$2])) 475d522f475Smrg])dnl 476d522f475Smrgdnl --------------------------------------------------------------------------- 477a5ae21e4Smrgdnl CF_CHECK_EXTERN_DATA version: 5 updated: 2021/09/04 06:35:04 478d522f475Smrgdnl -------------------- 479d522f475Smrgdnl Check for existence of external data in the current set of libraries. If 480a5ae21e4Smrgdnl we can modify it, it is real enough. 481d522f475Smrgdnl $1 = the name to check 482d522f475Smrgdnl $2 = its type 483d522f475SmrgAC_DEFUN([CF_CHECK_EXTERN_DATA], 484d522f475Smrg[ 485d522f475SmrgAC_CACHE_CHECK(if external $1 exists, cf_cv_have_$1,[ 4862e4f8982Smrg AC_TRY_LINK([ 487d522f475Smrg#undef $1 488d522f475Smrgextern $2 $1; 489d522f475Smrg], 4902e4f8982Smrg [$1 = 2], 4912e4f8982Smrg [cf_cv_have_$1=yes], 4922e4f8982Smrg [cf_cv_have_$1=no]) 493d522f475Smrg]) 494d522f475Smrg 495d522f475Smrgif test "$cf_cv_have_$1" = yes ; then 4962e4f8982Smrg CF_UPPER(cf_result,have_$1) 4972e4f8982Smrg AC_DEFINE_UNQUOTED($cf_result) 498d522f475Smrgfi 499d522f475Smrg 500d522f475Smrg])dnl 501d522f475Smrgdnl --------------------------------------------------------------------------- 5025307cd1aSmrgdnl CF_CLANG_COMPILER version: 9 updated: 2023/02/18 17:41:25 5030bd37d32Smrgdnl ----------------- 5040bd37d32Smrgdnl Check if the given compiler is really clang. clang's C driver defines 5050bd37d32Smrgdnl __GNUC__ (fooling the configure script into setting $GCC to yes) but does 5060bd37d32Smrgdnl not ignore some gcc options. 5070bd37d32Smrgdnl 5080bd37d32Smrgdnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to 5090bd37d32Smrgdnl ensure that it is not mistaken for gcc/g++. It is normally invoked from 5100bd37d32Smrgdnl the wrappers for gcc and g++ warnings. 5110bd37d32Smrgdnl 5120bd37d32Smrgdnl $1 = GCC (default) or GXX 513e0a2b6dfSmrgdnl $2 = CLANG_COMPILER (default) 5140bd37d32Smrgdnl $3 = CFLAGS (default) or CXXFLAGS 5150bd37d32SmrgAC_DEFUN([CF_CLANG_COMPILER],[ 5160bd37d32Smrgifelse([$2],,CLANG_COMPILER,[$2])=no 5170bd37d32Smrg 5180bd37d32Smrgif test "$ifelse([$1],,[$1],GCC)" = yes ; then 5190bd37d32Smrg AC_MSG_CHECKING(if this is really Clang ifelse([$1],GXX,C++,C) compiler) 5200bd37d32Smrg cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])" 5210bd37d32Smrg AC_TRY_COMPILE([],[ 5220bd37d32Smrg#ifdef __clang__ 5230bd37d32Smrg#else 5245307cd1aSmrg#error __clang__ is not defined 5250bd37d32Smrg#endif 5260bd37d32Smrg],[ifelse([$2],,CLANG_COMPILER,[$2])=yes 5270bd37d32Smrg],[]) 5280bd37d32Smrg ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS" 5290bd37d32Smrg AC_MSG_RESULT($ifelse([$2],,CLANG_COMPILER,[$2])) 5300bd37d32Smrgfi 531f2e35a3aSmrg 532f2e35a3aSmrgCLANG_VERSION=none 533f2e35a3aSmrg 534f2e35a3aSmrgif test "x$ifelse([$2],,CLANG_COMPILER,[$2])" = "xyes" ; then 535f2e35a3aSmrg case "$CC" in 536f2e35a3aSmrg (c[[1-9]][[0-9]]|*/c[[1-9]][[0-9]]) 537f2e35a3aSmrg AC_MSG_WARN(replacing broken compiler alias $CC) 538f2e35a3aSmrg CFLAGS="$CFLAGS -std=`echo "$CC" | sed -e 's%.*/%%'`" 539f2e35a3aSmrg CC=clang 540f2e35a3aSmrg ;; 541f2e35a3aSmrg esac 542f2e35a3aSmrg 543f2e35a3aSmrg AC_MSG_CHECKING(version of $CC) 544f2e35a3aSmrg 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.]].*//'`" 545f2e35a3aSmrg test -z "$CLANG_VERSION" && CLANG_VERSION=unknown 546f2e35a3aSmrg AC_MSG_RESULT($CLANG_VERSION) 547f2e35a3aSmrg 548f2e35a3aSmrg for cf_clang_opt in \ 549f2e35a3aSmrg -Qunused-arguments \ 550f2e35a3aSmrg -Wno-error=implicit-function-declaration 551f2e35a3aSmrg do 552f2e35a3aSmrg AC_MSG_CHECKING(if option $cf_clang_opt works) 553f2e35a3aSmrg cf_save_CFLAGS="$CFLAGS" 554f2e35a3aSmrg CFLAGS="$CFLAGS $cf_clang_opt" 555f2e35a3aSmrg AC_TRY_LINK([ 556f2e35a3aSmrg #include <stdio.h>],[ 557f2e35a3aSmrg printf("hello!\\n");],[ 558f2e35a3aSmrg cf_clang_optok=yes],[ 559f2e35a3aSmrg cf_clang_optok=no]) 560f2e35a3aSmrg AC_MSG_RESULT($cf_clang_optok) 561f2e35a3aSmrg CFLAGS="$cf_save_CFLAGS" 562f2e35a3aSmrg if test "$cf_clang_optok" = yes; then 563f2e35a3aSmrg CF_VERBOSE(adding option $cf_clang_opt) 564f2e35a3aSmrg CF_APPEND_TEXT(CFLAGS,$cf_clang_opt) 565f2e35a3aSmrg fi 566f2e35a3aSmrg done 567f2e35a3aSmrgfi 5680bd37d32Smrg]) 5690bd37d32Smrgdnl --------------------------------------------------------------------------- 57004b94745Smrgdnl CF_CONST_X_STRING version: 8 updated: 2023/12/01 17:22:50 571f2e35a3aSmrgdnl ----------------- 572f2e35a3aSmrgdnl The X11R4-X11R6 Xt specification uses an ambiguous String type for most 573f2e35a3aSmrgdnl character-strings. 574f2e35a3aSmrgdnl 575f2e35a3aSmrgdnl It is ambiguous because the specification accommodated the pre-ANSI 576f2e35a3aSmrgdnl compilers bundled by more than one vendor in lieu of providing a standard C 577f2e35a3aSmrgdnl compiler other than by costly add-ons. Because of this, the specification 578f2e35a3aSmrgdnl did not take into account the use of const for telling the compiler that 579f2e35a3aSmrgdnl string literals would be in readonly memory. 580f2e35a3aSmrgdnl 581f2e35a3aSmrgdnl As a workaround, one could (starting with X11R5) define XTSTRINGDEFINES, to 582f2e35a3aSmrgdnl let the compiler decide how to represent Xt's strings which were #define'd. 583f2e35a3aSmrgdnl That does not solve the problem of using the block of Xt's strings which 584f2e35a3aSmrgdnl are compiled into the library (and is less efficient than one might want). 585f2e35a3aSmrgdnl 586f2e35a3aSmrgdnl Xt specification 7 introduces the _CONST_X_STRING symbol which is used both 587f2e35a3aSmrgdnl when compiling the library and compiling using the library, to tell the 588f2e35a3aSmrgdnl compiler that String is const. 589f2e35a3aSmrgAC_DEFUN([CF_CONST_X_STRING], 590f2e35a3aSmrg[ 591f2e35a3aSmrgAC_REQUIRE([AC_PATH_XTRA]) 592f2e35a3aSmrg 593f2e35a3aSmrgCF_SAVE_XTRA_FLAGS([CF_CONST_X_STRING]) 594f2e35a3aSmrg 595f2e35a3aSmrgAC_TRY_COMPILE( 596f2e35a3aSmrg[ 597f2e35a3aSmrg#include <stdlib.h> 598f2e35a3aSmrg#include <X11/Intrinsic.h> 599f2e35a3aSmrg], 600ae137402Smrg[String foo = malloc(1); free((void*)foo)],[ 601f2e35a3aSmrg 602f2e35a3aSmrgAC_CACHE_CHECK(for X11/Xt const-feature,cf_cv_const_x_string,[ 603f2e35a3aSmrg AC_TRY_COMPILE( 604f2e35a3aSmrg [ 60504b94745Smrg#undef _CONST_X_STRING 606f2e35a3aSmrg#define _CONST_X_STRING /* X11R7.8 (perhaps) */ 607f2e35a3aSmrg#undef XTSTRINGDEFINES /* X11R5 and later */ 608f2e35a3aSmrg#include <stdlib.h> 609f2e35a3aSmrg#include <X11/Intrinsic.h> 610f2e35a3aSmrg ],[String foo = malloc(1); *foo = 0],[ 611f2e35a3aSmrg cf_cv_const_x_string=no 612f2e35a3aSmrg ],[ 613f2e35a3aSmrg cf_cv_const_x_string=yes 614f2e35a3aSmrg ]) 615f2e35a3aSmrg]) 616f2e35a3aSmrg 617f2e35a3aSmrgCF_RESTORE_XTRA_FLAGS([CF_CONST_X_STRING]) 618f2e35a3aSmrg 619f2e35a3aSmrgcase "$cf_cv_const_x_string" in 620f2e35a3aSmrg(no) 621f2e35a3aSmrg CF_APPEND_TEXT(CPPFLAGS,-DXTSTRINGDEFINES) 622f2e35a3aSmrg ;; 623f2e35a3aSmrg(*) 624f2e35a3aSmrg CF_APPEND_TEXT(CPPFLAGS,-D_CONST_X_STRING) 625f2e35a3aSmrg ;; 626f2e35a3aSmrgesac 627f2e35a3aSmrg 628f2e35a3aSmrg]) 629f2e35a3aSmrg])dnl 630f2e35a3aSmrgdnl --------------------------------------------------------------------------- 631e39b573cSmrgdnl CF_DISABLE_DESKTOP version: 2 updated: 2011/04/22 05:17:37 632e39b573cSmrgdnl ------------------ 633e39b573cSmrgdnl Handle a configure option "--disable-desktop", which sets a shell 634e39b573cSmrgdnl variable $desktop_utils to a "#" if the feature is not wanted, or to an 635e39b573cSmrgdnl empty string if enabled. The variable is used to substitute in front of 636e39b573cSmrgdnl corresponding makefile-rules. 637e39b573cSmrgdnl 638e39b573cSmrgdnl It also tells the configure script to substitute the environment variable 639e39b573cSmrgdnl $DESKTOP_FLAGS, which can be used by external scripts to customize the 640e39b573cSmrgdnl invocation of desktop-file-util. 641e39b573cSmrgdnl 642e39b573cSmrgdnl $1 = program name 643e39b573cSmrgAC_DEFUN([CF_DISABLE_DESKTOP],[ 644e39b573cSmrg# Comment-out the install-desktop rule if the desktop-utils are not found. 645e39b573cSmrgAC_MSG_CHECKING(if you want to install desktop files) 646e39b573cSmrgCF_ARG_OPTION(desktop, 647e39b573cSmrg [ --disable-desktop disable install of $1 desktop files], 648e39b573cSmrg [enable_desktop=$enableval], 649e39b573cSmrg [enable_desktop=$enableval],yes) 650e39b573cSmrgAC_MSG_RESULT($enable_desktop) 651e39b573cSmrg 652e39b573cSmrgdesktop_utils= 653e39b573cSmrgif test "$enable_desktop" = yes ; then 654e39b573cSmrgAC_CHECK_PROG(desktop_utils,desktop-file-install,yes,no) 655e39b573cSmrgfi 656e39b573cSmrg 657e39b573cSmrgtest "$desktop_utils" = yes && desktop_utils= || desktop_utils="#" 658e39b573cSmrgAC_SUBST(DESKTOP_FLAGS) 659e39b573cSmrg]) 660e39b573cSmrgdnl --------------------------------------------------------------------------- 661a5ae21e4Smrgdnl CF_DISABLE_ECHO version: 14 updated: 2021/09/04 06:35:04 662d522f475Smrgdnl --------------- 663a5ae21e4Smrgdnl You can always use "make -n" to see the actual options, but it is hard to 664d522f475Smrgdnl pick out/analyze warning messages when the compile-line is long. 665d522f475Smrgdnl 666d522f475Smrgdnl Sets: 667d522f475Smrgdnl ECHO_LT - symbol to control if libtool is verbose 668d522f475Smrgdnl ECHO_LD - symbol to prefix "cc -o" lines 669d522f475Smrgdnl RULE_CC - symbol to put before implicit "cc -c" lines (e.g., .c.o) 670d522f475Smrgdnl SHOW_CC - symbol to put before explicit "cc -c" lines 671d522f475Smrgdnl ECHO_CC - symbol to put before any "cc" line 672d522f475Smrgdnl 673d522f475SmrgAC_DEFUN([CF_DISABLE_ECHO],[ 674d522f475SmrgAC_MSG_CHECKING(if you want to see long compiling messages) 675d522f475SmrgCF_ARG_DISABLE(echo, 6760bd37d32Smrg [ --disable-echo do not display "compiling" commands], 677d522f475Smrg [ 6782e4f8982Smrg ECHO_LT='--silent' 6792e4f8982Smrg ECHO_LD='@echo linking [$]@;' 6802e4f8982Smrg RULE_CC='@echo compiling [$]<' 6812e4f8982Smrg SHOW_CC='@echo compiling [$]@' 6822e4f8982Smrg ECHO_CC='@' 683d522f475Smrg],[ 6842e4f8982Smrg ECHO_LT='' 6852e4f8982Smrg ECHO_LD='' 6862e4f8982Smrg RULE_CC='' 6872e4f8982Smrg SHOW_CC='' 6882e4f8982Smrg ECHO_CC='' 689d522f475Smrg]) 690d522f475SmrgAC_MSG_RESULT($enableval) 691d522f475SmrgAC_SUBST(ECHO_LT) 692d522f475SmrgAC_SUBST(ECHO_LD) 693d522f475SmrgAC_SUBST(RULE_CC) 694d522f475SmrgAC_SUBST(SHOW_CC) 695d522f475SmrgAC_SUBST(ECHO_CC) 696d522f475Smrg])dnl 697d522f475Smrgdnl --------------------------------------------------------------------------- 698ae137402Smrgdnl CF_DISABLE_LEAKS version: 9 updated: 2021/04/03 16:41:50 6990bd37d32Smrgdnl ---------------- 7000bd37d32Smrgdnl Combine no-leak checks with the libraries or tools that are used for the 7010bd37d32Smrgdnl checks. 7020bd37d32SmrgAC_DEFUN([CF_DISABLE_LEAKS],[ 7030bd37d32Smrg 7040bd37d32SmrgAC_REQUIRE([CF_WITH_DMALLOC]) 7050bd37d32SmrgAC_REQUIRE([CF_WITH_DBMALLOC]) 7060bd37d32SmrgAC_REQUIRE([CF_WITH_VALGRIND]) 7070bd37d32Smrg 7080bd37d32SmrgAC_MSG_CHECKING(if you want to perform memory-leak testing) 7090bd37d32SmrgAC_ARG_ENABLE(leaks, 7100bd37d32Smrg [ --disable-leaks test: free permanent memory, analyze leaks], 711ae137402Smrg [enable_leaks=$enableval], 712f2e35a3aSmrg [enable_leaks=yes]) 713ae137402Smrgdnl with_no_leaks is more readable... 714f2e35a3aSmrgif test "x$enable_leaks" = xno; then with_no_leaks=yes; else with_no_leaks=no; fi 7150bd37d32SmrgAC_MSG_RESULT($with_no_leaks) 7160bd37d32Smrg 717f2e35a3aSmrgif test "$enable_leaks" = no ; then 7180bd37d32Smrg AC_DEFINE(NO_LEAKS,1,[Define to 1 if you want to perform memory-leak testing.]) 7190bd37d32Smrg AC_DEFINE(YY_NO_LEAKS,1,[Define to 1 if you want to perform memory-leak testing.]) 7200bd37d32Smrgfi 7210bd37d32Smrg])dnl 7220bd37d32Smrgdnl --------------------------------------------------------------------------- 723f2e35a3aSmrgdnl CF_DISABLE_RPATH_HACK version: 3 updated: 2021/01/05 20:14:44 72420d2c4d2Smrgdnl --------------------- 72520d2c4d2Smrgdnl The rpath-hack makes it simpler to build programs, particularly with the 72620d2c4d2Smrgdnl *BSD ports which may have essential libraries in unusual places. But it 72720d2c4d2Smrgdnl can interfere with building an executable for the base system. Use this 72820d2c4d2Smrgdnl option in that case. 72920d2c4d2SmrgAC_DEFUN([CF_DISABLE_RPATH_HACK], 73020d2c4d2Smrg[ 731a1f3da82SmrgAC_MSG_CHECKING(if rpath-hack should be disabled) 73220d2c4d2SmrgCF_ARG_DISABLE(rpath-hack, 73320d2c4d2Smrg [ --disable-rpath-hack don't add rpath options for additional libraries], 734f2e35a3aSmrg [enable_rpath_hack=no], 735f2e35a3aSmrg [enable_rpath_hack=yes]) 736f2e35a3aSmrgdnl TODO - drop cf_disable_rpath_hack 737f2e35a3aSmrgif test "x$enable_rpath_hack" = xno; then cf_disable_rpath_hack=yes; else cf_disable_rpath_hack=no; fi 73820d2c4d2SmrgAC_MSG_RESULT($cf_disable_rpath_hack) 739f2e35a3aSmrg 740f2e35a3aSmrgif test "$enable_rpath_hack" = yes ; then 74120d2c4d2Smrg CF_RPATH_HACK 74220d2c4d2Smrgfi 74320d2c4d2Smrg]) 74420d2c4d2Smrgdnl --------------------------------------------------------------------------- 745f2e35a3aSmrgdnl CF_ENABLE_NARROWPROTO version: 6 updated: 2020/12/31 18:40:20 746d522f475Smrgdnl --------------------- 747d522f475Smrgdnl If this is not set properly, Xaw's scrollbars will not work. 748d522f475Smrgdnl The so-called "modular" configuration for X.org omits most of the 749d522f475Smrgdnl configure checks that would be needed to provide compatibility with 750d522f475Smrgdnl older X builds. This one breaks things noticeably. 751d522f475SmrgAC_DEFUN([CF_ENABLE_NARROWPROTO], 752d522f475Smrg[ 753d522f475SmrgAC_MSG_CHECKING(if you want narrow prototypes for X libraries) 754d522f475Smrg 75501037d57Smrgcase `$ac_config_guess` in 756f2e35a3aSmrg(*freebsd*|*gnu*|*irix5*|*irix6*|*netbsd*|*openbsd*|*qnx*|*sco*|*sgi*) 757d522f475Smrg cf_default_narrowproto=yes 758d522f475Smrg ;; 75901037d57Smrg(*) 760d522f475Smrg cf_default_narrowproto=no 761d522f475Smrg ;; 762d522f475Smrgesac 763d522f475Smrg 764d522f475SmrgCF_ARG_OPTION(narrowproto, 765d522f475Smrg [ --enable-narrowproto enable narrow prototypes for X libraries], 766d522f475Smrg [enable_narrowproto=$enableval], 767d522f475Smrg [enable_narrowproto=$cf_default_narrowproto], 768d522f475Smrg [$cf_default_narrowproto]) 769d522f475SmrgAC_MSG_RESULT($enable_narrowproto) 770d522f475Smrg]) 771d522f475Smrgdnl --------------------------------------------------------------------------- 772f2e35a3aSmrgdnl CF_ENABLE_WARNINGS version: 9 updated: 2021/01/05 19:40:50 773f2e35a3aSmrgdnl ------------------ 774f2e35a3aSmrgdnl Configure-option to enable gcc warnings 775f2e35a3aSmrgdnl 776f2e35a3aSmrgdnl $1 = extra options to add, if supported 777f2e35a3aSmrgdnl $2 = option for checking attributes. By default, this is done when 778f2e35a3aSmrgdnl warnings are enabled. For other values: 779f2e35a3aSmrgdnl yes: always do this, e.g., to use in generated library-headers 780f2e35a3aSmrgdnl no: never do this 781f2e35a3aSmrgAC_DEFUN([CF_ENABLE_WARNINGS],[ 782f2e35a3aSmrgif test "$GCC" = yes || test "$GXX" = yes 783f2e35a3aSmrgthen 784f2e35a3aSmrgCF_FIX_WARNINGS(CFLAGS) 785f2e35a3aSmrgCF_FIX_WARNINGS(CPPFLAGS) 786f2e35a3aSmrgCF_FIX_WARNINGS(LDFLAGS) 787f2e35a3aSmrgAC_MSG_CHECKING(if you want to turn on gcc warnings) 788f2e35a3aSmrgCF_ARG_ENABLE(warnings, 789f2e35a3aSmrg [ --enable-warnings test: turn on gcc compiler warnings], 790f2e35a3aSmrg [enable_warnings=yes], 791f2e35a3aSmrg [enable_warnings=no]) 792f2e35a3aSmrgAC_MSG_RESULT($enable_warnings) 793f2e35a3aSmrgif test "$enable_warnings" = "yes" 794f2e35a3aSmrgthen 795f2e35a3aSmrg ifelse($2,,[CF_GCC_ATTRIBUTES]) 796f2e35a3aSmrg CF_GCC_WARNINGS($1) 797f2e35a3aSmrgfi 798f2e35a3aSmrgifelse($2,yes,[CF_GCC_ATTRIBUTES]) 799f2e35a3aSmrgfi 800f2e35a3aSmrg])dnl 801f2e35a3aSmrgdnl --------------------------------------------------------------------------- 802d522f475Smrgdnl CF_ERRNO version: 5 updated: 1997/11/30 12:44:39 803d522f475Smrgdnl -------- 804d522f475Smrgdnl Check if 'errno' is declared in <errno.h> 805d522f475SmrgAC_DEFUN([CF_ERRNO], 806d522f475Smrg[ 807d522f475SmrgCF_CHECK_ERRNO(errno) 808d522f475Smrg])dnl 809d522f475Smrgdnl --------------------------------------------------------------------------- 8104419d26bSmrgdnl CF_FIX_WARNINGS version: 4 updated: 2021/12/16 18:22:31 811f2e35a3aSmrgdnl --------------- 812f2e35a3aSmrgdnl Warning flags do not belong in CFLAGS, CPPFLAGS, etc. Any of gcc's 813f2e35a3aSmrgdnl "-Werror" flags can interfere with configure-checks. Those go into 814f2e35a3aSmrgdnl EXTRA_CFLAGS. 815f2e35a3aSmrgdnl 816f2e35a3aSmrgdnl $1 = variable name to repair 817f2e35a3aSmrgdefine([CF_FIX_WARNINGS],[ 818f2e35a3aSmrgif test "$GCC" = yes || test "$GXX" = yes 819f2e35a3aSmrgthen 820f2e35a3aSmrg case [$]$1 in 821f2e35a3aSmrg (*-Werror=*) 822f2e35a3aSmrg cf_temp_flags= 823f2e35a3aSmrg for cf_temp_scan in [$]$1 824f2e35a3aSmrg do 825f2e35a3aSmrg case "x$cf_temp_scan" in 8264419d26bSmrg (x-Werror=format*) 8274419d26bSmrg CF_APPEND_TEXT(cf_temp_flags,$cf_temp_scan) 8284419d26bSmrg ;; 829f2e35a3aSmrg (x-Werror=*) 830f2e35a3aSmrg CF_APPEND_TEXT(EXTRA_CFLAGS,$cf_temp_scan) 831f2e35a3aSmrg ;; 832f2e35a3aSmrg (*) 833f2e35a3aSmrg CF_APPEND_TEXT(cf_temp_flags,$cf_temp_scan) 834f2e35a3aSmrg ;; 835f2e35a3aSmrg esac 836f2e35a3aSmrg done 8374419d26bSmrg if test "x[$]$1" != "x$cf_temp_flags" 8384419d26bSmrg then 8394419d26bSmrg CF_VERBOSE(repairing $1: [$]$1) 8404419d26bSmrg $1="$cf_temp_flags" 8414419d26bSmrg CF_VERBOSE(... fixed [$]$1) 8424419d26bSmrg CF_VERBOSE(... extra $EXTRA_CFLAGS) 8434419d26bSmrg fi 844f2e35a3aSmrg ;; 845f2e35a3aSmrg esac 846f2e35a3aSmrgfi 847f2e35a3aSmrgAC_SUBST(EXTRA_CFLAGS) 848f2e35a3aSmrg])dnl 849f2e35a3aSmrgdnl --------------------------------------------------------------------------- 85004b94745Smrgdnl CF_FUNC_GETTIME version: 3 updated: 2024/05/11 13:40:02 85104b94745Smrgdnl --------------- 85204b94745Smrgdnl Check for gettimeofday or clock_gettime. In 2023, the former is still more 85304b94745Smrgdnl widely supported, but "deprecated" (2008), so we will use the latter if it 85404b94745Smrgdnl is available, to reduce compiler warnings. 85504b94745SmrgAC_DEFUN([CF_FUNC_GETTIME],[ 85604b94745Smrgcf_save_libs="$LIBS" 85704b94745SmrgAC_CHECK_FUNC(clock_gettime, 85804b94745Smrg cf_cv_test_clock_gettime=yes, 85904b94745Smrg AC_CHECK_LIB(rt, clock_gettime, 86004b94745Smrg [LIBS="-lrt $LIBS" 86104b94745Smrg cf_cv_test_clock_gettime=yes], 86204b94745Smrg cf_cv_test_clock_gettime=no)) 86304b94745Smrg 86404b94745Smrgif test "$cf_cv_test_clock_gettime" = yes ; then 86504b94745SmrgAC_CACHE_CHECK(if clock_gettime links,cf_cv_func_clock_gettime,[ 86604b94745Smrg AC_TRY_LINK([ 86704b94745Smrg$ac_includes_default 86804b94745Smrg#include <time.h> 86904b94745Smrg ], 87004b94745Smrg [struct timespec ts; 87104b94745Smrg int rc = clock_gettime(CLOCK_REALTIME, &ts) 87204b94745Smrg + clock_gettime(CLOCK_MONOTONIC, &ts); 87304b94745Smrg (void) rc; (void)ts], 87404b94745Smrg [cf_cv_func_clock_gettime=yes], 87504b94745Smrg [cf_cv_func_clock_gettime=no]) 87604b94745Smrg]) 87704b94745Smrgelse 87804b94745Smrg cf_cv_func_clock_gettime=no 87904b94745Smrgfi 88004b94745Smrg 88104b94745Smrgif test "$cf_cv_func_clock_gettime" = yes 88204b94745Smrgthen 88304b94745Smrg AC_DEFINE(HAVE_CLOCK_GETTIME,1,[Define to 1 if we have clock_gettime function]) 88404b94745Smrgelse 88504b94745SmrgAC_CHECK_FUNC(gettimeofday, 88604b94745Smrg AC_DEFINE(HAVE_GETTIMEOFDAY,1,[Define to 1 if we have gettimeofday function]),[ 88704b94745Smrg 88804b94745SmrgAC_CHECK_LIB(bsd, gettimeofday, 88904b94745Smrg AC_DEFINE(HAVE_GETTIMEOFDAY,1,[Define to 1 if we have gettimeofday function]) 89004b94745Smrg CF_ADD_LIB(bsd))])dnl CLIX: bzero, select, gettimeofday 89104b94745Smrgfi 89204b94745Smrg])dnl 89304b94745Smrgdnl --------------------------------------------------------------------------- 894f2e35a3aSmrgdnl CF_FUNC_GRANTPT version: 15 updated: 2020/12/31 18:40:20 895d522f475Smrgdnl --------------- 8960bd37d32Smrgdnl Check for grantpt versus openpty, as well as functions that "should" be 8970bd37d32Smrgdnl available if grantpt is available. 8980bd37d32SmrgAC_DEFUN([CF_FUNC_GRANTPT],[ 8990bd37d32Smrg 9000bd37d32SmrgAC_CHECK_HEADERS( \ 9010bd37d32Smrgstropts.h \ 9020bd37d32Smrg) 9030bd37d32Smrg 9040bd37d32Smrgcf_func_grantpt="grantpt ptsname" 905f2e35a3aSmrgcf_prefer_openpt=no 90601037d57Smrgcase $host_os in 90701037d57Smrg(darwin[[0-9]].*) 9080bd37d32Smrg ;; 909f2e35a3aSmrg(openbsd[[0-9]].*) 910f2e35a3aSmrg # The POSIX entrypoints exist, but have never worked. 911f2e35a3aSmrg ;; 912f2e35a3aSmrg(linux*) 913f2e35a3aSmrg cf_func_grantpt="$cf_func_grantpt posix_openpt" 914f2e35a3aSmrg cf_prefer_openpt=yes 915f2e35a3aSmrg ;; 91601037d57Smrg(*) 9170bd37d32Smrg cf_func_grantpt="$cf_func_grantpt posix_openpt" 9180bd37d32Smrg ;; 9190bd37d32Smrgesac 9200bd37d32Smrg 9210bd37d32SmrgAC_CHECK_FUNCS($cf_func_grantpt) 9220bd37d32Smrg 9230bd37d32Smrgcf_grantpt_opts= 9240bd37d32Smrgif test "x$ac_cv_func_grantpt" = "xyes" ; then 9250bd37d32Smrg AC_MSG_CHECKING(if grantpt really works) 9260bd37d32Smrg AC_TRY_LINK(CF__GRANTPT_HEAD,CF__GRANTPT_BODY,[ 9270bd37d32Smrg AC_TRY_RUN(CF__GRANTPT_HEAD 9280bd37d32Smrgint main(void) 9290bd37d32Smrg{ 9300bd37d32SmrgCF__GRANTPT_BODY 931d522f475Smrg} 9320bd37d32Smrg, 9330bd37d32Smrg,ac_cv_func_grantpt=no 9340bd37d32Smrg,ac_cv_func_grantpt=maybe) 9350bd37d32Smrg ],ac_cv_func_grantpt=no) 9360bd37d32Smrg AC_MSG_RESULT($ac_cv_func_grantpt) 9370bd37d32Smrg 9380bd37d32Smrg if test "x$ac_cv_func_grantpt" != "xno" ; then 9390bd37d32Smrg 9400bd37d32Smrg if test "x$ac_cv_func_grantpt" = "xyes" ; then 9410bd37d32Smrg AC_MSG_CHECKING(for pty features) 9420bd37d32Smrgdnl if we have no stropts.h, skip the checks for streams modules 9430bd37d32Smrg if test "x$ac_cv_header_stropts_h" = xyes 9440bd37d32Smrg then 9450bd37d32Smrg cf_pty_this=0 9460bd37d32Smrg else 9470bd37d32Smrg cf_pty_this=3 9480bd37d32Smrg fi 9490bd37d32Smrg 9500bd37d32Smrg cf_pty_defines= 9510bd37d32Smrg while test $cf_pty_this != 6 9520bd37d32Smrg do 9530bd37d32Smrg 9540bd37d32Smrg cf_pty_feature= 955f2e35a3aSmrg cf_pty_next="`expr $cf_pty_this + 1`" 9560bd37d32Smrg CF_MSG_LOG(pty feature test $cf_pty_next:5) 9570bd37d32Smrg AC_TRY_RUN(#define CONFTEST $cf_pty_this 9580bd37d32Smrg$cf_pty_defines 9590bd37d32SmrgCF__GRANTPT_HEAD 9600bd37d32Smrgint main(void) 9610bd37d32Smrg{ 9620bd37d32SmrgCF__GRANTPT_BODY 9630bd37d32Smrg} 9640bd37d32Smrg, 9650bd37d32Smrg[ 96601037d57Smrg case $cf_pty_next in 96701037d57Smrg (1) # - streams 9680bd37d32Smrg cf_pty_feature=ptem 9690bd37d32Smrg ;; 97001037d57Smrg (2) # - streams 9710bd37d32Smrg cf_pty_feature=ldterm 9720bd37d32Smrg ;; 97301037d57Smrg (3) # - streams 9740bd37d32Smrg cf_pty_feature=ttcompat 9750bd37d32Smrg ;; 97601037d57Smrg (4) 9770bd37d32Smrg cf_pty_feature=pty_isatty 9780bd37d32Smrg ;; 97901037d57Smrg (5) 9800bd37d32Smrg cf_pty_feature=pty_tcsetattr 9810bd37d32Smrg ;; 98201037d57Smrg (6) 9830bd37d32Smrg cf_pty_feature=tty_tcsetattr 9840bd37d32Smrg ;; 9850bd37d32Smrg esac 9860bd37d32Smrg],[ 98701037d57Smrg case $cf_pty_next in 98801037d57Smrg (1|2|3) 9890bd37d32Smrg CF_MSG_LOG(skipping remaining streams features $cf_pty_this..2) 9900bd37d32Smrg cf_pty_next=3 9910bd37d32Smrg ;; 9920bd37d32Smrg esac 9930bd37d32Smrg]) 9940bd37d32Smrg if test -n "$cf_pty_feature" 9950bd37d32Smrg then 9960bd37d32Smrg cf_pty_defines="$cf_pty_defines 9970bd37d32Smrg#define CONFTEST_$cf_pty_feature 1 9980bd37d32Smrg" 9990bd37d32Smrg cf_grantpt_opts="$cf_grantpt_opts $cf_pty_feature" 10000bd37d32Smrg fi 10010bd37d32Smrg 10020bd37d32Smrg cf_pty_this=$cf_pty_next 10030bd37d32Smrg done 10040bd37d32Smrg AC_MSG_RESULT($cf_grantpt_opts) 10050bd37d32Smrg cf_grantpt_opts=`echo "$cf_grantpt_opts" | sed -e 's/ isatty//'` 10060bd37d32Smrg fi 1007d522f475Smrg fi 10080bd37d32Smrgfi 10090bd37d32Smrg 10100bd37d32Smrgdnl If we found grantpt, but no features, e.g., for streams or if we are not 10110bd37d32Smrgdnl able to use tcsetattr, then give openpty a try. In particular, Darwin 10.7 10120bd37d32Smrgdnl has a more functional openpty than posix_openpt. 10130bd37d32Smrgdnl 10140bd37d32Smrgdnl There is no configure run-test for openpty, since older implementations do 10150bd37d32Smrgdnl not always run properly as a non-root user. For that reason, we also allow 10160bd37d32Smrgdnl the configure script to suppress this check entirely with $disable_openpty. 1017f2e35a3aSmrgif test "x$cf_prefer_posix_openpt" = "xyes" && test "x$ac_cv_func_posix_openpt" = "xyes" ; then 1018f2e35a3aSmrg CF_VERBOSE(prefer posix_openpt over openpty) 1019f2e35a3aSmrgelif test "x$disable_openpty" != "xyes" || test -z "$cf_grantpt_opts" ; then 10200bd37d32Smrg AC_CHECK_LIB(util, openpty, [cf_have_openpty=yes],[cf_have_openpty=no]) 10210bd37d32Smrg if test "$cf_have_openpty" = yes ; then 10220bd37d32Smrg ac_cv_func_grantpt=no 10230bd37d32Smrg LIBS="-lutil $LIBS" 10240bd37d32Smrg AC_DEFINE(HAVE_OPENPTY,1,[Define to 1 if you have the openpty function]) 10250bd37d32Smrg AC_CHECK_HEADERS( \ 10260bd37d32Smrg util.h \ 10270bd37d32Smrg libutil.h \ 10280bd37d32Smrg pty.h \ 10290bd37d32Smrg ) 10300bd37d32Smrg fi 10310bd37d32Smrgfi 10320bd37d32Smrg 10330bd37d32Smrgdnl If we did not settle on using openpty, fill in the definitions for grantpt. 10340bd37d32Smrgif test "x$ac_cv_func_grantpt" != xno 10350bd37d32Smrgthen 10360bd37d32Smrg CF_VERBOSE(will rely upon grantpt) 10370bd37d32Smrg AC_DEFINE(HAVE_WORKING_GRANTPT,1,[Define to 1 if the grantpt function seems to work]) 10380bd37d32Smrg for cf_feature in $cf_grantpt_opts 10390bd37d32Smrg do 10400bd37d32Smrg cf_feature=`echo "$cf_feature" | sed -e 's/ //g'` 10410bd37d32Smrg CF_UPPER(cf_FEATURE,$cf_feature) 10420bd37d32Smrg AC_DEFINE_UNQUOTED(HAVE_GRANTPT_$cf_FEATURE) 10430bd37d32Smrg done 10440bd37d32Smrgelif test "x$cf_have_openpty" = xno 10450bd37d32Smrgthen 10460bd37d32Smrg CF_VERBOSE(will rely upon BSD-pseudoterminals) 10470bd37d32Smrgelse 10480bd37d32Smrg CF_VERBOSE(will rely upon openpty) 10490bd37d32Smrgfi 10500bd37d32Smrg])dnl 1051d522f475Smrgdnl --------------------------------------------------------------------------- 105204b94745Smrgdnl CF_FUNC_STRFTIME version: 2 updated: 2023/12/01 20:44:51 105304b94745Smrgdnl ---------------- 105404b94745SmrgAC_DEFUN([CF_FUNC_STRFTIME], 105504b94745Smrg[ 105604b94745SmrgAC_CACHE_CHECK(for strftime function,cf_cv_func_strftime,[ 105704b94745SmrgAC_TRY_LINK([ 105804b94745Smrg$ac_includes_default 105904b94745Smrg#include <time.h> 106004b94745Smrg],[ 106104b94745Smrg time_t now = time((time_t*)0); 106204b94745Smrg struct tm *tm = localtime(&now); 106304b94745Smrg char buffer[80]; 106404b94745Smrg size_t result = strftime(buffer, sizeof(buffer), "%c", tm); 106504b94745Smrg 106604b94745Smrg (void)result; 106704b94745Smrg (void)buffer; 106804b94745Smrg],[cf_cv_func_strftime=yes],[cf_cv_func_strftime=no]) 106904b94745Smrg]) 107004b94745Smrg 107104b94745Smrgtest "$cf_cv_func_strftime" = yes && AC_DEFINE(HAVE_STRFTIME,1,[Define to 1 to indicate that strftime function is present]) 107204b94745Smrg])dnl 107304b94745Smrgdnl --------------------------------------------------------------------------- 107404b94745Smrgdnl CF_FUNC_TGETENT version: 27 updated: 2023/12/01 17:22:50 1075d522f475Smrgdnl --------------- 1076d522f475Smrgdnl Check for tgetent function in termcap library. If we cannot find this, 1077d522f475Smrgdnl we'll use the $LINES and $COLUMNS environment variables to pass screen 1078d522f475Smrgdnl size information to subprocesses. (We cannot use terminfo's compatibility 1079d522f475Smrgdnl function, since it cannot provide the termcap-format data). 1080d522f475Smrgdnl 1081d522f475Smrgdnl If the --disable-full-tgetent option is given, we'll settle for the first 1082d522f475Smrgdnl tgetent function we find. Since the search list in that case does not 1083d522f475Smrgdnl include the termcap library, that allows us to default to terminfo. 1084d522f475SmrgAC_DEFUN([CF_FUNC_TGETENT], 1085d522f475Smrg[ 1086d522f475Smrg# compute a reasonable value for $TERM to give tgetent(), since we may be 1087d522f475Smrg# running in 'screen', which sets $TERMCAP to a specific entry that is not 1088d522f475Smrg# necessarily in /etc/termcap - unsetenv is not portable, so we cannot simply 1089d522f475Smrg# discard $TERMCAP. 1090d522f475Smrgcf_TERMVAR=vt100 1091e39b573cSmrgif test -n "$TERMCAP" 1092e39b573cSmrgthen 1093e39b573cSmrg cf_TERMCAP=`echo "$TERMCAP" | tr '\n' ' ' | sed -e 's/^..|//' -e 's/|.*//'` 109401037d57Smrg case "$cf_TERMCAP" in 109501037d57Smrg (screen*.*) 1096e39b573cSmrg ;; 109701037d57Smrg (*) 1098e39b573cSmrg cf_TERMVAR="$cf_TERMCAP" 1099e39b573cSmrg ;; 1100e39b573cSmrg esac 1101e39b573cSmrgfi 1102d522f475Smrgtest -z "$cf_TERMVAR" && cf_TERMVAR=vt100 1103d522f475Smrg 1104f2e35a3aSmrg# BSD termcap used no header file 1105f2e35a3aSmrg# SVr4 provided termcap prototypes as a legacy feature in term.h 1106f2e35a3aSmrg# GNU termcap provided termcap prototypes in termcap.h 1107f2e35a3aSmrg# ncurses provides termcap prototypes in both term.h and termcap.h 1108f2e35a3aSmrg# 1109f2e35a3aSmrg# The terminfo-based termcap interfaces do not provide a full tgetent (i.e., do 1110f2e35a3aSmrg# not return the text of the termcap entry in the buffer), but as a special 1111f2e35a3aSmrg# case, FreeBSD provides ncurses' termcap.h with a modified termcap reader that 1112f2e35a3aSmrg# returns the termcap text. 1113f2e35a3aSmrgAC_CHECK_HEADERS(termcap.h) 1114f2e35a3aSmrg 11155307cd1aSmrgcf_termcap_h="\ 11165307cd1aSmrg#ifdef HAVE_TERMCAP_H 11175307cd1aSmrg#include <termcap.h> 11185307cd1aSmrg#else 11195307cd1aSmrgextern int tgetent(char *, const char *); 11205307cd1aSmrg#endif" 11215307cd1aSmrg 1122d522f475SmrgAC_MSG_CHECKING(if we want full tgetent function) 1123d522f475SmrgCF_ARG_DISABLE(full-tgetent, 1124d522f475Smrg [ --disable-full-tgetent disable check for full tgetent function], 1125d522f475Smrg cf_full_tgetent=no, 1126d522f475Smrg cf_full_tgetent=yes,yes) 1127d522f475SmrgAC_MSG_RESULT($cf_full_tgetent) 1128d522f475Smrg 1129d522f475Smrgif test "$cf_full_tgetent" = yes ; then 1130d522f475Smrg cf_test_message="full tgetent" 1131d522f475Smrgelse 1132d522f475Smrg cf_test_message="tgetent" 1133d522f475Smrgfi 1134d522f475Smrg 1135d522f475SmrgAC_CACHE_CHECK(for $cf_test_message function,cf_cv_lib_tgetent,[ 1136d522f475Smrgcf_save_LIBS="$LIBS" 1137d522f475Smrgcf_cv_lib_tgetent=no 11385307cd1aSmrgcf_TERMLIB="termlib ncursesw ncurses curses" 1139d522f475Smrgif test "$cf_full_tgetent" = yes ; then 11405307cd1aSmrg cf_TERMLIB="otermcap termcap $cf_TERMLIB" 1141d522f475Smrg cf_TERMTST="buffer[[0]] == 0" 1142d522f475Smrgelse 11435307cd1aSmrg cf_TERMLIB="tinfow tinfo $cf_TERMLIB" 1144d522f475Smrg cf_TERMTST="0" 1145d522f475Smrgfi 1146d522f475Smrgfor cf_termlib in '' $cf_TERMLIB ; do 1147d522f475Smrg LIBS="$cf_save_LIBS" 11482e4f8982Smrg test -n "$cf_termlib" && { CF_ADD_LIB($cf_termlib) } 1149d522f475Smrg AC_TRY_RUN([ 11505307cd1aSmrg$cf_termcap_h 11515307cd1aSmrg 1152d522f475Smrg/* terminfo implementations ignore the buffer argument, making it useless for 1153d522f475Smrg * the xterm application, which uses this information to make a new TERMCAP 1154d522f475Smrg * environment variable. 1155d522f475Smrg */ 1156f2e35a3aSmrgint main(void) 1157d522f475Smrg{ 1158d522f475Smrg char buffer[1024]; 1159d522f475Smrg buffer[0] = 0; 1160d522f475Smrg tgetent(buffer, "$cf_TERMVAR"); 1161d522f475Smrg ${cf_cv_main_return:-return} ($cf_TERMTST); }], 1162d522f475Smrg [echo "yes, there is a termcap/tgetent in $cf_termlib" 1>&AC_FD_CC 1163d522f475Smrg if test -n "$cf_termlib" ; then 1164d522f475Smrg cf_cv_lib_tgetent="-l$cf_termlib" 1165d522f475Smrg else 1166d522f475Smrg cf_cv_lib_tgetent=yes 1167d522f475Smrg fi 1168d522f475Smrg break], 1169d522f475Smrg [echo "no, there is no termcap/tgetent in $cf_termlib" 1>&AC_FD_CC], 1170d522f475Smrg [echo "cross-compiling, cannot verify if a termcap/tgetent is present in $cf_termlib" 1>&AC_FD_CC]) 1171d522f475Smrgdone 1172d522f475SmrgLIBS="$cf_save_LIBS" 1173d522f475Smrg]) 1174d522f475Smrg 1175d522f475Smrg# If we found a working tgetent(), set LIBS and check for termcap.h. 1176d522f475Smrg# (LIBS cannot be set inside AC_CACHE_CHECK; the commands there should 1177d522f475Smrg# not have side effects other than setting the cache variable, because 1178d522f475Smrg# they are not executed when a cached value exists.) 1179e39b573cSmrgif test "x$cf_cv_lib_tgetent" != xno ; then 11802e4f8982Smrg test "x$cf_cv_lib_tgetent" != xyes && { CF_ADD_LIBS($cf_cv_lib_tgetent) } 11810bd37d32Smrg AC_DEFINE(USE_TERMCAP,1,[Define 1 to indicate that working tgetent is found]) 118220d2c4d2Smrg if test "$cf_full_tgetent" = no ; then 118320d2c4d2Smrg AC_TRY_COMPILE([ 1184d522f475Smrg#include <termcap.h>],[ 1185d522f475Smrg#ifdef NCURSES_VERSION 118604b94745Smrg#error do not use ncurses termcap.h 1187d522f475Smrg#endif],[AC_DEFINE(HAVE_TERMCAP_H)]) 118820d2c4d2Smrg fi 1189d522f475Smrgelse 1190d522f475Smrg # If we didn't find a tgetent() that supports the buffer 1191d522f475Smrg # argument, look again to see whether we can find even 1192d522f475Smrg # a crippled one. A crippled tgetent() is still useful to 1193d522f475Smrg # validate values for the TERM environment variable given to 1194d522f475Smrg # child processes. 1195d522f475Smrg AC_CACHE_CHECK(for partial tgetent function,cf_cv_lib_part_tgetent,[ 1196d522f475Smrg cf_cv_lib_part_tgetent=no 1197d522f475Smrg for cf_termlib in $cf_TERMLIB ; do 1198d522f475Smrg LIBS="$cf_save_LIBS -l$cf_termlib" 11995307cd1aSmrg AC_TRY_LINK([$cf_termcap_h],[tgetent(0, "$cf_TERMVAR")], 1200d522f475Smrg [echo "there is a terminfo/tgetent in $cf_termlib" 1>&AC_FD_CC 1201d522f475Smrg cf_cv_lib_part_tgetent="-l$cf_termlib" 1202d522f475Smrg break]) 1203d522f475Smrg done 1204d522f475Smrg LIBS="$cf_save_LIBS" 1205d522f475Smrg ]) 1206d522f475Smrg 1207d522f475Smrg if test "$cf_cv_lib_part_tgetent" != no ; then 120820d2c4d2Smrg CF_ADD_LIBS($cf_cv_lib_part_tgetent) 1209d522f475Smrg # If this is linking against ncurses, we'll trigger the 1210d522f475Smrg # ifdef in resize.c that turns the termcap stuff back off. 12110bd37d32Smrg AC_DEFINE(USE_TERMINFO,1,[Define to 1 to indicate that terminfo provides the tgetent interface]) 1212d522f475Smrg fi 1213d522f475Smrgfi 1214d522f475Smrg])dnl 1215d522f475Smrgdnl --------------------------------------------------------------------------- 1216ad37e533Smrgdnl CF_GCC_ATTRIBUTES version: 24 updated: 2021/03/20 12:00:25 1217d522f475Smrgdnl ----------------- 1218d522f475Smrgdnl Test for availability of useful gcc __attribute__ directives to quiet 1219d522f475Smrgdnl compiler warnings. Though useful, not all are supported -- and contrary 1220d522f475Smrgdnl to documentation, unrecognized directives cause older compilers to barf. 1221d522f475SmrgAC_DEFUN([CF_GCC_ATTRIBUTES], 1222f2e35a3aSmrg[AC_REQUIRE([AC_PROG_FGREP])dnl 1223ad37e533SmrgAC_REQUIRE([CF_C11_NORETURN])dnl 1224f2e35a3aSmrg 1225f2e35a3aSmrgif test "$GCC" = yes || test "$GXX" = yes 1226d522f475Smrgthen 1227d522f475Smrgcat > conftest.i <<EOF 1228d522f475Smrg#ifndef GCC_PRINTF 1229d522f475Smrg#define GCC_PRINTF 0 1230d522f475Smrg#endif 1231d522f475Smrg#ifndef GCC_SCANF 1232d522f475Smrg#define GCC_SCANF 0 1233d522f475Smrg#endif 1234d522f475Smrg#ifndef GCC_NORETURN 1235d522f475Smrg#define GCC_NORETURN /* nothing */ 1236d522f475Smrg#endif 1237d522f475Smrg#ifndef GCC_UNUSED 1238d522f475Smrg#define GCC_UNUSED /* nothing */ 1239d522f475Smrg#endif 1240d522f475SmrgEOF 1241d522f475Smrgif test "$GCC" = yes 1242d522f475Smrgthen 1243d522f475Smrg AC_CHECKING([for $CC __attribute__ directives]) 1244f2e35a3aSmrgcat > "conftest.$ac_ext" <<EOF 12456879286fSmrg#line __oline__ "${as_me:-configure}" 12465307cd1aSmrg#include <stdio.h> 1247d522f475Smrg#include "confdefs.h" 1248d522f475Smrg#include "conftest.h" 1249d522f475Smrg#include "conftest.i" 1250d522f475Smrg#if GCC_PRINTF 1251d522f475Smrg#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var))) 1252d522f475Smrg#else 1253d522f475Smrg#define GCC_PRINTFLIKE(fmt,var) /*nothing*/ 1254d522f475Smrg#endif 1255d522f475Smrg#if GCC_SCANF 1256d522f475Smrg#define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var))) 1257d522f475Smrg#else 1258d522f475Smrg#define GCC_SCANFLIKE(fmt,var) /*nothing*/ 1259d522f475Smrg#endif 1260d522f475Smrgextern void wow(char *,...) GCC_SCANFLIKE(1,2); 1261ad37e533Smrgextern GCC_NORETURN void oops(char *,...) GCC_PRINTFLIKE(1,2); 1262ad37e533Smrgextern GCC_NORETURN void foo(void); 1263f2e35a3aSmrgint main(int argc GCC_UNUSED, char *argv[[]] GCC_UNUSED) { (void)argc; (void)argv; return 0; } 1264d522f475SmrgEOF 126520d2c4d2Smrg cf_printf_attribute=no 126620d2c4d2Smrg cf_scanf_attribute=no 1267d522f475Smrg for cf_attribute in scanf printf unused noreturn 1268d522f475Smrg do 1269d522f475Smrg CF_UPPER(cf_ATTRIBUTE,$cf_attribute) 1270d522f475Smrg cf_directive="__attribute__(($cf_attribute))" 1271d522f475Smrg echo "checking for $CC $cf_directive" 1>&AC_FD_CC 127220d2c4d2Smrg 1273f2e35a3aSmrg case "$cf_attribute" in 127401037d57Smrg (printf) 127520d2c4d2Smrg cf_printf_attribute=yes 127620d2c4d2Smrg cat >conftest.h <<EOF 1277d522f475Smrg#define GCC_$cf_ATTRIBUTE 1 1278d522f475SmrgEOF 1279d522f475Smrg ;; 128001037d57Smrg (scanf) 128120d2c4d2Smrg cf_scanf_attribute=yes 128220d2c4d2Smrg cat >conftest.h <<EOF 128320d2c4d2Smrg#define GCC_$cf_ATTRIBUTE 1 128420d2c4d2SmrgEOF 128520d2c4d2Smrg ;; 128601037d57Smrg (*) 128720d2c4d2Smrg cat >conftest.h <<EOF 1288d522f475Smrg#define GCC_$cf_ATTRIBUTE $cf_directive 1289d522f475SmrgEOF 1290d522f475Smrg ;; 1291d522f475Smrg esac 129220d2c4d2Smrg 1293d522f475Smrg if AC_TRY_EVAL(ac_compile); then 1294d522f475Smrg test -n "$verbose" && AC_MSG_RESULT(... $cf_attribute) 1295d522f475Smrg cat conftest.h >>confdefs.h 1296f2e35a3aSmrg case "$cf_attribute" in 129701037d57Smrg (noreturn) 12980bd37d32Smrg AC_DEFINE_UNQUOTED(GCC_NORETURN,$cf_directive,[Define to noreturn-attribute for gcc]) 12990bd37d32Smrg ;; 130001037d57Smrg (printf) 13010bd37d32Smrg cf_value='/* nothing */' 13020bd37d32Smrg if test "$cf_printf_attribute" != no ; then 13030bd37d32Smrg cf_value='__attribute__((format(printf,fmt,var)))' 13040bd37d32Smrg AC_DEFINE(GCC_PRINTF,1,[Define to 1 if the compiler supports gcc-like printf attribute.]) 130520d2c4d2Smrg fi 13060bd37d32Smrg AC_DEFINE_UNQUOTED(GCC_PRINTFLIKE(fmt,var),$cf_value,[Define to printf-attribute for gcc]) 130720d2c4d2Smrg ;; 130801037d57Smrg (scanf) 13090bd37d32Smrg cf_value='/* nothing */' 13100bd37d32Smrg if test "$cf_scanf_attribute" != no ; then 13110bd37d32Smrg cf_value='__attribute__((format(scanf,fmt,var)))' 13120bd37d32Smrg AC_DEFINE(GCC_SCANF,1,[Define to 1 if the compiler supports gcc-like scanf attribute.]) 131320d2c4d2Smrg fi 13140bd37d32Smrg AC_DEFINE_UNQUOTED(GCC_SCANFLIKE(fmt,var),$cf_value,[Define to sscanf-attribute for gcc]) 13150bd37d32Smrg ;; 131601037d57Smrg (unused) 13170bd37d32Smrg AC_DEFINE_UNQUOTED(GCC_UNUSED,$cf_directive,[Define to unused-attribute for gcc]) 131820d2c4d2Smrg ;; 131920d2c4d2Smrg esac 1320d522f475Smrg fi 1321d522f475Smrg done 1322d522f475Smrgelse 1323f2e35a3aSmrg ${FGREP-fgrep} define conftest.i >>confdefs.h 1324d522f475Smrgfi 1325f2e35a3aSmrgrm -rf ./conftest* 1326d522f475Smrgfi 1327d522f475Smrg])dnl 1328d522f475Smrgdnl --------------------------------------------------------------------------- 132904b94745Smrgdnl CF_GCC_VERSION version: 9 updated: 2023/03/05 14:30:13 1330d522f475Smrgdnl -------------- 1331f2e35a3aSmrgdnl Find version of gcc, and (because icc/clang pretend to be gcc without being 1332f2e35a3aSmrgdnl compatible), attempt to determine if icc/clang is actually used. 1333d522f475SmrgAC_DEFUN([CF_GCC_VERSION],[ 1334d522f475SmrgAC_REQUIRE([AC_PROG_CC]) 1335d522f475SmrgGCC_VERSION=none 1336d522f475Smrgif test "$GCC" = yes ; then 1337d522f475Smrg AC_MSG_CHECKING(version of $CC) 133804b94745Smrg GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^[[^(]]*([[^)]][[^)]]*) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`" 1339d522f475Smrg test -z "$GCC_VERSION" && GCC_VERSION=unknown 1340d522f475Smrg AC_MSG_RESULT($GCC_VERSION) 1341d522f475Smrgfi 1342f2e35a3aSmrgCF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS) 1343f2e35a3aSmrgCF_CLANG_COMPILER(GCC,CLANG_COMPILER,CFLAGS) 1344d522f475Smrg])dnl 1345d522f475Smrgdnl --------------------------------------------------------------------------- 1346f2e35a3aSmrgdnl CF_GCC_WARNINGS version: 41 updated: 2021/01/01 16:53:59 1347d522f475Smrgdnl --------------- 1348d522f475Smrgdnl Check if the compiler supports useful warning options. There's a few that 1349d522f475Smrgdnl we don't use, simply because they're too noisy: 1350d522f475Smrgdnl 1351d522f475Smrgdnl -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x) 1352f2e35a3aSmrgdnl -Winline (usually not worthwhile) 1353d522f475Smrgdnl -Wredundant-decls (system headers make this too noisy) 1354d522f475Smrgdnl -Wtraditional (combines too many unrelated messages, only a few useful) 1355d522f475Smrgdnl -Wwrite-strings (too noisy, but should review occasionally). This 1356d522f475Smrgdnl is enabled for ncurses using "--enable-const". 1357d522f475Smrgdnl -pedantic 1358d522f475Smrgdnl 1359d522f475Smrgdnl Parameter: 1360d522f475Smrgdnl $1 is an optional list of gcc warning flags that a particular 1361d522f475Smrgdnl application might want to use, e.g., "no-unused" for 1362d522f475Smrgdnl -Wno-unused 1363d522f475Smrgdnl Special: 1364d522f475Smrgdnl If $with_ext_const is "yes", add a check for -Wwrite-strings 1365d522f475Smrgdnl 1366d522f475SmrgAC_DEFUN([CF_GCC_WARNINGS], 1367d522f475Smrg[ 1368d522f475SmrgAC_REQUIRE([CF_GCC_VERSION]) 1369f2e35a3aSmrgif test "x$have_x" = xyes; then CF_CONST_X_STRING fi 1370f2e35a3aSmrgcat > "conftest.$ac_ext" <<EOF 13716879286fSmrg#line __oline__ "${as_me:-configure}" 1372d522f475Smrgint main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; } 1373d522f475SmrgEOF 1374d522f475Smrgif test "$INTEL_COMPILER" = yes 1375d522f475Smrgthen 1376d522f475Smrg# The "-wdXXX" options suppress warnings: 1377d522f475Smrg# remark #1419: external declaration in primary source file 1378d522f475Smrg# remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem) 1379d522f475Smrg# remark #1684: conversion from pointer to same-sized integral type (potential portability problem) 1380d522f475Smrg# remark #193: zero used for undefined preprocessing identifier 1381d522f475Smrg# remark #593: variable "curs_sb_left_arrow" was set but never used 1382d522f475Smrg# remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits 1383d522f475Smrg# remark #869: parameter "tw" was never referenced 1384d522f475Smrg# remark #981: operands are evaluated in unspecified order 1385956cc18dSsnj# warning #279: controlling expression is constant 1386d522f475Smrg 1387d522f475Smrg AC_CHECKING([for $CC warning options]) 1388d522f475Smrg cf_save_CFLAGS="$CFLAGS" 1389f2e35a3aSmrg EXTRA_CFLAGS="$EXTRA_CFLAGS -Wall" 1390d522f475Smrg for cf_opt in \ 1391d522f475Smrg wd1419 \ 1392d522f475Smrg wd1683 \ 1393d522f475Smrg wd1684 \ 1394d522f475Smrg wd193 \ 1395d522f475Smrg wd593 \ 1396956cc18dSsnj wd279 \ 1397d522f475Smrg wd810 \ 1398d522f475Smrg wd869 \ 1399d522f475Smrg wd981 1400d522f475Smrg do 1401d522f475Smrg CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" 1402d522f475Smrg if AC_TRY_EVAL(ac_compile); then 1403d522f475Smrg test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt) 1404d522f475Smrg EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" 1405d522f475Smrg fi 1406d522f475Smrg done 1407d522f475Smrg CFLAGS="$cf_save_CFLAGS" 1408f2e35a3aSmrgelif test "$GCC" = yes && test "$GCC_VERSION" != "unknown" 1409d522f475Smrgthen 1410d522f475Smrg AC_CHECKING([for $CC warning options]) 1411d522f475Smrg cf_save_CFLAGS="$CFLAGS" 1412d522f475Smrg cf_warn_CONST="" 1413d522f475Smrg test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings" 1414e0a2b6dfSmrg cf_gcc_warnings="Wignored-qualifiers Wlogical-op Wvarargs" 1415e0a2b6dfSmrg test "x$CLANG_COMPILER" = xyes && cf_gcc_warnings= 141620d2c4d2Smrg for cf_opt in W Wall \ 1417d522f475Smrg Wbad-function-cast \ 1418d522f475Smrg Wcast-align \ 1419d522f475Smrg Wcast-qual \ 1420e0a2b6dfSmrg Wdeclaration-after-statement \ 1421e0a2b6dfSmrg Wextra \ 1422d522f475Smrg Winline \ 1423d522f475Smrg Wmissing-declarations \ 1424d522f475Smrg Wmissing-prototypes \ 1425d522f475Smrg Wnested-externs \ 1426d522f475Smrg Wpointer-arith \ 1427d522f475Smrg Wshadow \ 1428d522f475Smrg Wstrict-prototypes \ 1429f2e35a3aSmrg Wundef Wno-inline $cf_gcc_warnings $cf_warn_CONST $1 1430d522f475Smrg do 1431d522f475Smrg CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" 1432d522f475Smrg if AC_TRY_EVAL(ac_compile); then 1433d522f475Smrg test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt) 1434f2e35a3aSmrg case "$cf_opt" in 143501037d57Smrg (Winline) 1436f2e35a3aSmrg case "$GCC_VERSION" in 143701037d57Smrg ([[34]].*) 1438d522f475Smrg CF_VERBOSE(feature is broken in gcc $GCC_VERSION) 1439d522f475Smrg continue;; 1440d522f475Smrg esac 1441d522f475Smrg ;; 144201037d57Smrg (Wpointer-arith) 1443f2e35a3aSmrg case "$GCC_VERSION" in 144401037d57Smrg ([[12]].*) 14450bd37d32Smrg CF_VERBOSE(feature is broken in gcc $GCC_VERSION) 14460bd37d32Smrg continue;; 14470bd37d32Smrg esac 14480bd37d32Smrg ;; 1449d522f475Smrg esac 1450d522f475Smrg EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" 1451d522f475Smrg fi 1452d522f475Smrg done 1453d522f475Smrg CFLAGS="$cf_save_CFLAGS" 1454d522f475Smrgfi 1455f2e35a3aSmrgrm -rf ./conftest* 1456d522f475Smrg 1457d522f475SmrgAC_SUBST(EXTRA_CFLAGS) 1458d522f475Smrg])dnl 1459d522f475Smrgdnl --------------------------------------------------------------------------- 1460f2e35a3aSmrgdnl CF_GNU_SOURCE version: 10 updated: 2018/12/10 20:09:41 1461d522f475Smrgdnl ------------- 1462d522f475Smrgdnl Check if we must define _GNU_SOURCE to get a reasonable value for 1463d522f475Smrgdnl _XOPEN_SOURCE, upon which many POSIX definitions depend. This is a defect 1464d522f475Smrgdnl (or misfeature) of glibc2, which breaks portability of many applications, 1465d522f475Smrgdnl since it is interwoven with GNU extensions. 1466d522f475Smrgdnl 1467d522f475Smrgdnl Well, yes we could work around it... 1468f2e35a3aSmrgdnl 1469f2e35a3aSmrgdnl Parameters: 1470f2e35a3aSmrgdnl $1 is the nominal value for _XOPEN_SOURCE 1471d522f475SmrgAC_DEFUN([CF_GNU_SOURCE], 1472d522f475Smrg[ 1473f2e35a3aSmrgcf_gnu_xopen_source=ifelse($1,,500,$1) 1474f2e35a3aSmrg 1475f2e35a3aSmrgAC_CACHE_CHECK(if this is the GNU C library,cf_cv_gnu_library,[ 1476d522f475SmrgAC_TRY_COMPILE([#include <sys/types.h>],[ 1477f2e35a3aSmrg #if __GLIBC__ > 0 && __GLIBC_MINOR__ >= 0 1478f2e35a3aSmrg return 0; 1479f2e35a3aSmrg #elif __NEWLIB__ > 0 && __NEWLIB_MINOR__ >= 0 1480f2e35a3aSmrg return 0; 1481f2e35a3aSmrg #else 1482f2e35a3aSmrg # error not GNU C library 1483f2e35a3aSmrg #endif], 1484f2e35a3aSmrg [cf_cv_gnu_library=yes], 1485f2e35a3aSmrg [cf_cv_gnu_library=no]) 1486d522f475Smrg]) 1487913cc679Smrg 1488f2e35a3aSmrgif test x$cf_cv_gnu_library = xyes; then 1489f2e35a3aSmrg 1490f2e35a3aSmrg # With glibc 2.19 (13 years after this check was begun), _DEFAULT_SOURCE 1491f2e35a3aSmrg # was changed to help a little. newlib incorporated the change about 4 1492f2e35a3aSmrg # years later. 1493f2e35a3aSmrg AC_CACHE_CHECK(if _DEFAULT_SOURCE can be used as a basis,cf_cv_gnu_library_219,[ 1494f2e35a3aSmrg cf_save="$CPPFLAGS" 1495f2e35a3aSmrg CF_APPEND_TEXT(CPPFLAGS,-D_DEFAULT_SOURCE) 1496f2e35a3aSmrg AC_TRY_COMPILE([#include <sys/types.h>],[ 1497f2e35a3aSmrg #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 19) || (__GLIBC__ > 2) 1498f2e35a3aSmrg return 0; 1499f2e35a3aSmrg #elif (__NEWLIB__ == 2 && __NEWLIB_MINOR__ >= 4) || (__GLIBC__ > 3) 1500f2e35a3aSmrg return 0; 1501f2e35a3aSmrg #else 1502f2e35a3aSmrg # error GNU C library __GLIBC__.__GLIBC_MINOR__ is too old 1503f2e35a3aSmrg #endif], 1504f2e35a3aSmrg [cf_cv_gnu_library_219=yes], 1505f2e35a3aSmrg [cf_cv_gnu_library_219=no]) 1506f2e35a3aSmrg CPPFLAGS="$cf_save" 1507913cc679Smrg ]) 1508f2e35a3aSmrg 1509f2e35a3aSmrg if test "x$cf_cv_gnu_library_219" = xyes; then 1510f2e35a3aSmrg cf_save="$CPPFLAGS" 1511f2e35a3aSmrg AC_CACHE_CHECK(if _XOPEN_SOURCE=$cf_gnu_xopen_source works with _DEFAULT_SOURCE,cf_cv_gnu_dftsrc_219,[ 1512f2e35a3aSmrg CF_ADD_CFLAGS(-D_DEFAULT_SOURCE -D_XOPEN_SOURCE=$cf_gnu_xopen_source) 1513f2e35a3aSmrg AC_TRY_COMPILE([ 1514f2e35a3aSmrg #include <limits.h> 1515f2e35a3aSmrg #include <sys/types.h> 1516f2e35a3aSmrg ],[ 1517f2e35a3aSmrg #if (_XOPEN_SOURCE >= $cf_gnu_xopen_source) && (MB_LEN_MAX > 1) 1518f2e35a3aSmrg return 0; 1519f2e35a3aSmrg #else 1520f2e35a3aSmrg # error GNU C library is too old 1521f2e35a3aSmrg #endif], 1522f2e35a3aSmrg [cf_cv_gnu_dftsrc_219=yes], 1523f2e35a3aSmrg [cf_cv_gnu_dftsrc_219=no]) 1524f2e35a3aSmrg ]) 1525f2e35a3aSmrg test "x$cf_cv_gnu_dftsrc_219" = "xyes" || CPPFLAGS="$cf_save" 1526f2e35a3aSmrg else 1527f2e35a3aSmrg cf_cv_gnu_dftsrc_219=maybe 1528f2e35a3aSmrg fi 1529f2e35a3aSmrg 1530f2e35a3aSmrg if test "x$cf_cv_gnu_dftsrc_219" != xyes; then 1531f2e35a3aSmrg 1532f2e35a3aSmrg AC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[ 1533f2e35a3aSmrg AC_TRY_COMPILE([#include <sys/types.h>],[ 1534f2e35a3aSmrg #ifndef _XOPEN_SOURCE 1535f2e35a3aSmrg #error expected _XOPEN_SOURCE to be defined 1536f2e35a3aSmrg #endif], 1537f2e35a3aSmrg [cf_cv_gnu_source=no], 1538f2e35a3aSmrg [cf_save="$CPPFLAGS" 1539f2e35a3aSmrg CF_ADD_CFLAGS(-D_GNU_SOURCE) 1540f2e35a3aSmrg AC_TRY_COMPILE([#include <sys/types.h>],[ 1541f2e35a3aSmrg #ifdef _XOPEN_SOURCE 1542f2e35a3aSmrg #error expected _XOPEN_SOURCE to be undefined 1543f2e35a3aSmrg #endif], 1544f2e35a3aSmrg [cf_cv_gnu_source=no], 1545f2e35a3aSmrg [cf_cv_gnu_source=yes]) 1546f2e35a3aSmrg CPPFLAGS="$cf_save" 1547f2e35a3aSmrg ]) 1548f2e35a3aSmrg ]) 1549f2e35a3aSmrg 1550f2e35a3aSmrg if test "$cf_cv_gnu_source" = yes 1551f2e35a3aSmrg then 1552f2e35a3aSmrg AC_CACHE_CHECK(if we should also define _DEFAULT_SOURCE,cf_cv_default_source,[ 1553f2e35a3aSmrg CF_APPEND_TEXT(CPPFLAGS,-D_GNU_SOURCE) 1554f2e35a3aSmrg AC_TRY_COMPILE([#include <sys/types.h>],[ 1555f2e35a3aSmrg #ifdef _DEFAULT_SOURCE 1556f2e35a3aSmrg #error expected _DEFAULT_SOURCE to be undefined 1557f2e35a3aSmrg #endif], 1558f2e35a3aSmrg [cf_cv_default_source=no], 1559f2e35a3aSmrg [cf_cv_default_source=yes]) 1560f2e35a3aSmrg ]) 1561f2e35a3aSmrg if test "$cf_cv_default_source" = yes 1562f2e35a3aSmrg then 1563f2e35a3aSmrg CF_APPEND_TEXT(CPPFLAGS,-D_DEFAULT_SOURCE) 1564f2e35a3aSmrg fi 1565f2e35a3aSmrg fi 1566f2e35a3aSmrg fi 1567f2e35a3aSmrg 1568913cc679Smrgfi 1569d522f475Smrg])dnl 1570d522f475Smrgdnl --------------------------------------------------------------------------- 1571f2e35a3aSmrgdnl CF_HELP_MESSAGE version: 4 updated: 2019/12/31 08:53:54 1572d522f475Smrgdnl --------------- 1573d522f475Smrgdnl Insert text into the help-message, for readability, from AC_ARG_WITH. 1574d522f475SmrgAC_DEFUN([CF_HELP_MESSAGE], 1575f2e35a3aSmrg[CF_ACVERSION_CHECK(2.53,[],[ 1576f2e35a3aSmrgAC_DIVERT_HELP($1)])dnl 1577d522f475Smrg])dnl 1578d522f475Smrgdnl --------------------------------------------------------------------------- 1579f2e35a3aSmrgdnl CF_IMAKE_CFLAGS version: 34 updated: 2020/12/31 18:40:20 1580d522f475Smrgdnl --------------- 1581d522f475Smrgdnl Use imake to obtain compiler flags. We could, in principle, write tests to 1582d522f475Smrgdnl get these, but if imake is properly configured there is no point in doing 1583d522f475Smrgdnl this. 1584d522f475Smrgdnl 1585d522f475Smrgdnl Parameters (used in constructing a sample Imakefile): 1586d522f475Smrgdnl $1 = optional value to append to $IMAKE_CFLAGS 1587d522f475Smrgdnl $2 = optional value to append to $IMAKE_LOADFLAGS 1588d522f475SmrgAC_DEFUN([CF_IMAKE_CFLAGS], 1589d522f475Smrg[ 1590d522f475SmrgAC_PATH_PROGS(IMAKE,xmkmf imake) 1591d522f475Smrg 1592d522f475Smrgif test -n "$IMAKE" ; then 1593d522f475Smrg 159401037d57Smrgcase $IMAKE in 159501037d57Smrg(*/imake) 159601037d57Smrg cf_imake_opts="-DUseInstalled=YES" 1597d522f475Smrg ;; 159801037d57Smrg(*/util/xmkmf) 1599d522f475Smrg # A single parameter tells xmkmf where the config-files are: 1600f2e35a3aSmrg cf_imake_opts="`echo "$IMAKE"|sed -e s,/config/util/xmkmf,,`" 1601d522f475Smrg ;; 160201037d57Smrg(*) 1603d522f475Smrg cf_imake_opts= 1604d522f475Smrg ;; 1605d522f475Smrgesac 1606d522f475Smrg 1607d522f475Smrg# If it's installed properly, imake (or its wrapper, xmkmf) will point to the 1608d522f475Smrg# config directory. 1609d522f475Smrgif mkdir conftestdir; then 1610d522f475Smrg CDPATH=; export CDPATH 1611f2e35a3aSmrg cf_makefile=`cd "$srcdir" || exit;pwd`/Imakefile 1612d522f475Smrg cd conftestdir 1613d522f475Smrg 1614d522f475Smrg cat >fix_cflags.sed <<'CF_EOF' 1615d522f475Smrgs/\\//g 1616d522f475Smrgs/[[ ]][[ ]]*/ /g 1617d522f475Smrgs/"//g 1618d522f475Smrg:pack 1619d522f475Smrgs/\(=[[^ ]][[^ ]]*\) \([[^-]]\)/\1 \2/g 1620d522f475Smrgt pack 1621d522f475Smrgs/\(-D[[a-zA-Z0-9_]][[a-zA-Z0-9_]]*\)=\([[^\'0-9 ]][[^ ]]*\)/\1='\\"\2\\"'/g 1622d522f475Smrgs/^IMAKE[[ ]]/IMAKE_CFLAGS="/ 1623d522f475Smrgs/ / /g 1624d522f475Smrgs/$/"/ 1625d522f475SmrgCF_EOF 1626d522f475Smrg 1627d522f475Smrg cat >fix_lflags.sed <<'CF_EOF' 1628d522f475Smrgs/^IMAKE[[ ]]*/IMAKE_LOADFLAGS="/ 1629d522f475Smrgs/$/"/ 1630d522f475SmrgCF_EOF 1631d522f475Smrg 1632d522f475Smrg echo >./Imakefile 1633f2e35a3aSmrg test -f "$cf_makefile" && cat "$cf_makefile" >>./Imakefile 1634d522f475Smrg 1635d522f475Smrg cat >> ./Imakefile <<'CF_EOF' 1636d522f475Smrgfindstddefs: 163720d2c4d2Smrg @echo IMAKE ${ALLDEFINES}ifelse([$1],,,[ $1]) | sed -f fix_cflags.sed 163820d2c4d2Smrg @echo IMAKE ${EXTRA_LOAD_FLAGS}ifelse([$2],,,[ $2]) | sed -f fix_lflags.sed 1639d522f475SmrgCF_EOF 1640d522f475Smrg 1641f2e35a3aSmrg if ( $IMAKE "$cf_imake_opts" 1>/dev/null 2>&AC_FD_CC && test -f Makefile) 1642d522f475Smrg then 1643d522f475Smrg CF_VERBOSE(Using $IMAKE $cf_imake_opts) 1644d522f475Smrg else 1645d522f475Smrg # sometimes imake doesn't have the config path compiled in. Find it. 1646d522f475Smrg cf_config= 1647d522f475Smrg for cf_libpath in $X_LIBS $LIBS ; do 1648f2e35a3aSmrg case "$cf_libpath" in 164901037d57Smrg (-L*) 1650f2e35a3aSmrg cf_libpath=`echo ".$cf_libpath" | sed -e 's/^...//'` 1651f2e35a3aSmrg cf_libpath="$cf_libpath/X11/config" 1652f2e35a3aSmrg if test -d "$cf_libpath" ; then 1653f2e35a3aSmrg cf_config="$cf_libpath" 1654d522f475Smrg break 1655d522f475Smrg fi 1656d522f475Smrg ;; 1657d522f475Smrg esac 1658d522f475Smrg done 1659d522f475Smrg if test -z "$cf_config" ; then 1660d522f475Smrg AC_MSG_WARN(Could not find imake config-directory) 1661d522f475Smrg else 1662d522f475Smrg cf_imake_opts="$cf_imake_opts -I$cf_config" 1663f2e35a3aSmrg if ( "$IMAKE" -v "$cf_imake_opts" 2>&AC_FD_CC) 1664d522f475Smrg then 1665d522f475Smrg CF_VERBOSE(Using $IMAKE $cf_config) 1666d522f475Smrg else 1667d522f475Smrg AC_MSG_WARN(Cannot run $IMAKE) 1668d522f475Smrg fi 1669d522f475Smrg fi 1670d522f475Smrg fi 1671d522f475Smrg 1672d522f475Smrg # GNU make sometimes prints "make[1]: Entering...", which 1673d522f475Smrg # would confuse us. 1674f2e35a3aSmrg eval "`make findstddefs 2>/dev/null | grep -v make`" 1675d522f475Smrg 1676d522f475Smrg cd .. 1677d522f475Smrg rm -rf conftestdir 1678d522f475Smrg 1679d522f475Smrg # We use ${ALLDEFINES} rather than ${STD_DEFINES} because the former 1680d522f475Smrg # declares XTFUNCPROTO there. However, some vendors (e.g., SGI) have 1681d522f475Smrg # modified it to support site.cf, adding a kludge for the /usr/include 1682d522f475Smrg # directory. Try to filter that out, otherwise gcc won't find its 1683d522f475Smrg # headers. 1684d522f475Smrg if test -n "$GCC" ; then 1685d522f475Smrg if test -n "$IMAKE_CFLAGS" ; then 1686d522f475Smrg cf_nostdinc="" 1687d522f475Smrg cf_std_incl="" 1688d522f475Smrg cf_cpp_opts="" 1689d522f475Smrg for cf_opt in $IMAKE_CFLAGS 1690d522f475Smrg do 1691d522f475Smrg case "$cf_opt" in 169201037d57Smrg (-nostdinc) 1693d522f475Smrg cf_nostdinc="$cf_opt" 1694d522f475Smrg ;; 169501037d57Smrg (-I/usr/include) 1696d522f475Smrg cf_std_incl="$cf_opt" 1697d522f475Smrg ;; 169801037d57Smrg (*) 1699d522f475Smrg cf_cpp_opts="$cf_cpp_opts $cf_opt" 1700d522f475Smrg ;; 1701d522f475Smrg esac 1702d522f475Smrg done 1703d522f475Smrg if test -z "$cf_nostdinc" ; then 1704d522f475Smrg IMAKE_CFLAGS="$cf_cpp_opts $cf_std_incl" 1705d522f475Smrg elif test -z "$cf_std_incl" ; then 1706d522f475Smrg IMAKE_CFLAGS="$cf_cpp_opts $cf_nostdinc" 1707d522f475Smrg else 1708d522f475Smrg CF_VERBOSE(suppressed \"$cf_nostdinc\" and \"$cf_std_incl\") 1709d522f475Smrg IMAKE_CFLAGS="$cf_cpp_opts" 1710d522f475Smrg fi 1711d522f475Smrg fi 1712d522f475Smrg fi 1713d522f475Smrgfi 1714d522f475Smrg 1715d522f475Smrg# Some imake configurations define PROJECTROOT with an empty value. Remove 1716d522f475Smrg# the empty definition. 1717d522f475Smrgcase $IMAKE_CFLAGS in 171801037d57Smrg(*-DPROJECTROOT=/*) 1719d522f475Smrg ;; 172001037d57Smrg(*) 1721d522f475Smrg IMAKE_CFLAGS=`echo "$IMAKE_CFLAGS" |sed -e "s,-DPROJECTROOT=[[ ]], ,"` 1722d522f475Smrg ;; 1723d522f475Smrgesac 1724d522f475Smrg 1725d522f475Smrgfi 1726d522f475Smrg 1727d522f475SmrgCF_VERBOSE(IMAKE_CFLAGS $IMAKE_CFLAGS) 1728d522f475SmrgCF_VERBOSE(IMAKE_LOADFLAGS $IMAKE_LOADFLAGS) 1729d522f475Smrg 1730d522f475SmrgAC_SUBST(IMAKE_CFLAGS) 1731d522f475SmrgAC_SUBST(IMAKE_LOADFLAGS) 1732d522f475Smrg])dnl 1733d522f475Smrgdnl --------------------------------------------------------------------------- 1734ae137402Smrgdnl CF_INPUT_METHOD version: 5 updated: 2021/06/07 17:39:17 1735d522f475Smrgdnl --------------- 1736d522f475Smrgdnl Check if the X libraries support input-method 1737d522f475SmrgAC_DEFUN([CF_INPUT_METHOD], 1738d522f475Smrg[ 1739d522f475SmrgAC_CACHE_CHECK([if X libraries support input-method],cf_cv_input_method,[ 1740d522f475SmrgAC_TRY_LINK([ 1741d522f475Smrg#include <X11/IntrinsicP.h> 1742d522f475Smrg#include <X11/Xatom.h> 1743d522f475Smrg#include <X11/Xutil.h> 1744d522f475Smrg#include <X11/Xmu/Atoms.h> 1745d522f475Smrg#include <X11/Xmu/Converters.h> 1746d522f475Smrg#include <X11/Xaw/XawImP.h> 1747d522f475Smrg],[ 1748d522f475Smrg{ 1749d522f475Smrg XIM xim; 1750d522f475Smrg XIMStyles *xim_styles = 0; 1751d522f475Smrg XIMStyle input_style; 1752ae137402Smrg Widget w = XtCreateWidget("none", (WidgetClass)0, None, (ArgList)0, 0); 1753d522f475Smrg 1754d522f475Smrg XSetLocaleModifiers("@im=none"); 1755d522f475Smrg xim = XOpenIM(XtDisplay(w), NULL, NULL, NULL); 1756d522f475Smrg XGetIMValues(xim, XNQueryInputStyle, &xim_styles, NULL); 1757d522f475Smrg XCloseIM(xim); 1758d522f475Smrg input_style = (XIMPreeditNothing | XIMStatusNothing); 1759f2e35a3aSmrg (void)xim_styles; 1760f2e35a3aSmrg (void)input_style; 1761d522f475Smrg} 1762d522f475Smrg], 1763d522f475Smrg[cf_cv_input_method=yes], 1764d522f475Smrg[cf_cv_input_method=no])]) 1765d522f475Smrg])dnl 1766d522f475Smrgdnl --------------------------------------------------------------------------- 17675307cd1aSmrgdnl CF_INTEL_COMPILER version: 9 updated: 2023/02/18 17:41:25 1768d522f475Smrgdnl ----------------- 1769d522f475Smrgdnl Check if the given compiler is really the Intel compiler for Linux. It 1770d522f475Smrgdnl tries to imitate gcc, but does not return an error when it finds a mismatch 1771d522f475Smrgdnl between prototypes, e.g., as exercised by CF_MISSING_CHECK. 1772d522f475Smrgdnl 1773d522f475Smrgdnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to 1774d522f475Smrgdnl ensure that it is not mistaken for gcc/g++. It is normally invoked from 1775d522f475Smrgdnl the wrappers for gcc and g++ warnings. 1776d522f475Smrgdnl 1777d522f475Smrgdnl $1 = GCC (default) or GXX 1778d522f475Smrgdnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS 1779d522f475Smrgdnl $3 = CFLAGS (default) or CXXFLAGS 1780d522f475SmrgAC_DEFUN([CF_INTEL_COMPILER],[ 17810bd37d32SmrgAC_REQUIRE([AC_CANONICAL_HOST]) 178220d2c4d2Smrgifelse([$2],,INTEL_COMPILER,[$2])=no 1783d522f475Smrg 178420d2c4d2Smrgif test "$ifelse([$1],,[$1],GCC)" = yes ; then 1785f2e35a3aSmrg case "$host_os" in 178601037d57Smrg (linux*|gnu*) 178720d2c4d2Smrg AC_MSG_CHECKING(if this is really Intel ifelse([$1],GXX,C++,C) compiler) 178820d2c4d2Smrg cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])" 178920d2c4d2Smrg ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -no-gcc" 1790d522f475Smrg AC_TRY_COMPILE([],[ 1791d522f475Smrg#ifdef __INTEL_COMPILER 1792d522f475Smrg#else 17935307cd1aSmrg#error __INTEL_COMPILER is not defined 1794d522f475Smrg#endif 179520d2c4d2Smrg],[ifelse([$2],,INTEL_COMPILER,[$2])=yes 1796894e0ac8Smrgcf_save_CFLAGS="$cf_save_CFLAGS -we147" 1797d522f475Smrg],[]) 179820d2c4d2Smrg ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS" 179920d2c4d2Smrg AC_MSG_RESULT($ifelse([$2],,INTEL_COMPILER,[$2])) 1800d522f475Smrg ;; 1801d522f475Smrg esac 1802d522f475Smrgfi 1803d522f475Smrg])dnl 1804d522f475Smrgdnl --------------------------------------------------------------------------- 180504b94745Smrgdnl CF_LASTLOG version: 8 updated: 2023/12/01 17:22:50 1806d522f475Smrgdnl ---------- 1807d522f475Smrgdnl Check for header defining _PATH_LASTLOG, or failing that, see if the lastlog 1808d522f475Smrgdnl file exists. 1809d522f475SmrgAC_DEFUN([CF_LASTLOG], 1810d522f475Smrg[ 1811d522f475SmrgAC_CHECK_HEADERS(lastlog.h paths.h) 1812d522f475SmrgAC_CACHE_CHECK(for lastlog path,cf_cv_path_lastlog,[ 1813d522f475SmrgAC_TRY_COMPILE([ 1814d522f475Smrg#include <sys/types.h> 1815d522f475Smrg#ifdef HAVE_LASTLOG_H 1816d522f475Smrg#include <lastlog.h> 1817d522f475Smrg#else 1818d522f475Smrg#ifdef HAVE_PATHS_H 1819d522f475Smrg#include <paths.h> 1820d522f475Smrg#endif 182104b94745Smrg#endif],[static char path[] = _PATH_LASTLOG; (void)path], 1822d522f475Smrg [cf_cv_path_lastlog="_PATH_LASTLOG"], 1823d522f475Smrg [if test -f /usr/adm/lastlog ; then 1824d522f475Smrg cf_cv_path_lastlog=/usr/adm/lastlog 1825d522f475Smrg else 1826d522f475Smrg cf_cv_path_lastlog=no 1827d522f475Smrg fi]) 1828d522f475Smrg]) 1829f2e35a3aSmrgtest "$cf_cv_path_lastlog" != no && AC_DEFINE(USE_LASTLOG,1,[Define to 1 if we can define lastlog pathname]) 1830d522f475Smrg])dnl 1831d522f475Smrgdnl --------------------------------------------------------------------------- 1832f2e35a3aSmrgdnl CF_LD_RPATH_OPT version: 9 updated: 2021/01/01 13:31:04 183320d2c4d2Smrgdnl --------------- 183420d2c4d2Smrgdnl For the given system and compiler, find the compiler flags to pass to the 183520d2c4d2Smrgdnl loader to use the "rpath" feature. 183620d2c4d2SmrgAC_DEFUN([CF_LD_RPATH_OPT], 183720d2c4d2Smrg[ 183820d2c4d2SmrgAC_REQUIRE([CF_CHECK_CACHE]) 183920d2c4d2Smrg 184020d2c4d2SmrgLD_RPATH_OPT= 1841f2e35a3aSmrgif test "x$cf_cv_enable_rpath" != xno 1842f2e35a3aSmrgthen 1843f2e35a3aSmrg AC_MSG_CHECKING(for an rpath option) 1844f2e35a3aSmrg case "$cf_cv_system_name" in 1845f2e35a3aSmrg (irix*) 1846f2e35a3aSmrg if test "$GCC" = yes; then 1847f2e35a3aSmrg LD_RPATH_OPT="-Wl,-rpath," 1848f2e35a3aSmrg else 1849f2e35a3aSmrg LD_RPATH_OPT="-rpath " 1850f2e35a3aSmrg fi 1851f2e35a3aSmrg ;; 1852f2e35a3aSmrg (linux*|gnu*|k*bsd*-gnu|freebsd*) 185320d2c4d2Smrg LD_RPATH_OPT="-Wl,-rpath," 1854f2e35a3aSmrg ;; 1855f2e35a3aSmrg (openbsd[[2-9]].*|mirbsd*) 1856f2e35a3aSmrg LD_RPATH_OPT="-Wl,-rpath," 1857f2e35a3aSmrg ;; 1858f2e35a3aSmrg (dragonfly*) 185920d2c4d2Smrg LD_RPATH_OPT="-rpath " 1860f2e35a3aSmrg ;; 1861f2e35a3aSmrg (netbsd*) 1862f2e35a3aSmrg LD_RPATH_OPT="-Wl,-rpath," 1863f2e35a3aSmrg ;; 1864f2e35a3aSmrg (osf*|mls+*) 1865f2e35a3aSmrg LD_RPATH_OPT="-rpath " 1866f2e35a3aSmrg ;; 1867f2e35a3aSmrg (solaris2*) 1868f2e35a3aSmrg LD_RPATH_OPT="-R" 1869f2e35a3aSmrg ;; 1870f2e35a3aSmrg (*) 1871f2e35a3aSmrg ;; 1872f2e35a3aSmrg esac 1873f2e35a3aSmrg AC_MSG_RESULT($LD_RPATH_OPT) 1874f2e35a3aSmrg 1875f2e35a3aSmrg case "x$LD_RPATH_OPT" in 1876f2e35a3aSmrg (x-R*) 1877f2e35a3aSmrg AC_MSG_CHECKING(if we need a space after rpath option) 1878f2e35a3aSmrg cf_save_LIBS="$LIBS" 1879f2e35a3aSmrg CF_ADD_LIBS(${LD_RPATH_OPT}$libdir) 1880f2e35a3aSmrg AC_TRY_LINK(, , cf_rpath_space=no, cf_rpath_space=yes) 1881f2e35a3aSmrg LIBS="$cf_save_LIBS" 1882f2e35a3aSmrg AC_MSG_RESULT($cf_rpath_space) 1883f2e35a3aSmrg test "$cf_rpath_space" = yes && LD_RPATH_OPT="$LD_RPATH_OPT " 1884f2e35a3aSmrg ;; 1885f2e35a3aSmrg esac 1886f2e35a3aSmrgfi 188720d2c4d2Smrg])dnl 188820d2c4d2Smrgdnl --------------------------------------------------------------------------- 18896879286fSmrgdnl CF_MAKE_TAGS version: 6 updated: 2010/10/23 15:52:32 189020d2c4d2Smrgdnl ------------ 189120d2c4d2Smrgdnl Generate tags/TAGS targets for makefiles. Do not generate TAGS if we have 189220d2c4d2Smrgdnl a monocase filesystem. 189320d2c4d2SmrgAC_DEFUN([CF_MAKE_TAGS],[ 189420d2c4d2SmrgAC_REQUIRE([CF_MIXEDCASE_FILENAMES]) 189520d2c4d2Smrg 189620d2c4d2SmrgAC_CHECK_PROGS(CTAGS, exctags ctags) 189720d2c4d2SmrgAC_CHECK_PROGS(ETAGS, exetags etags) 189820d2c4d2Smrg 18996879286fSmrgAC_CHECK_PROG(MAKE_LOWER_TAGS, ${CTAGS:-ctags}, yes, no) 190020d2c4d2Smrg 190120d2c4d2Smrgif test "$cf_cv_mixedcase" = yes ; then 19026879286fSmrg AC_CHECK_PROG(MAKE_UPPER_TAGS, ${ETAGS:-etags}, yes, no) 190320d2c4d2Smrgelse 190420d2c4d2Smrg MAKE_UPPER_TAGS=no 190520d2c4d2Smrgfi 190620d2c4d2Smrg 190720d2c4d2Smrgif test "$MAKE_UPPER_TAGS" = yes ; then 190820d2c4d2Smrg MAKE_UPPER_TAGS= 190920d2c4d2Smrgelse 191020d2c4d2Smrg MAKE_UPPER_TAGS="#" 191120d2c4d2Smrgfi 191220d2c4d2Smrg 191320d2c4d2Smrgif test "$MAKE_LOWER_TAGS" = yes ; then 191420d2c4d2Smrg MAKE_LOWER_TAGS= 191520d2c4d2Smrgelse 191620d2c4d2Smrg MAKE_LOWER_TAGS="#" 191720d2c4d2Smrgfi 191820d2c4d2Smrg 191920d2c4d2SmrgAC_SUBST(CTAGS) 192020d2c4d2SmrgAC_SUBST(ETAGS) 192120d2c4d2Smrg 192220d2c4d2SmrgAC_SUBST(MAKE_UPPER_TAGS) 192320d2c4d2SmrgAC_SUBST(MAKE_LOWER_TAGS) 192420d2c4d2Smrg])dnl 192520d2c4d2Smrgdnl --------------------------------------------------------------------------- 19265307cd1aSmrgdnl CF_MATH_LIB version: 11 updated: 2022/07/27 19:01:48 1927894e0ac8Smrgdnl ----------- 1928894e0ac8Smrgdnl Checks for libraries. At least one UNIX system, Apple Macintosh 1929894e0ac8Smrgdnl Rhapsody 5.5, does not have -lm. We cannot use the simpler 1930894e0ac8Smrgdnl AC_CHECK_LIB(m,sin), because that fails for C++. 1931894e0ac8SmrgAC_DEFUN([CF_MATH_LIB], 1932894e0ac8Smrg[ 1933894e0ac8SmrgAC_CACHE_CHECK(if -lm needed for math functions, 1934894e0ac8Smrg cf_cv_need_libm,[ 1935894e0ac8Smrg AC_TRY_LINK([ 19365307cd1aSmrg #include <stdio.h> 19375307cd1aSmrg #include <stdlib.h> 19385307cd1aSmrg #include <math.h> 1939894e0ac8Smrg ], 1940f2e35a3aSmrg [double x = rand(); printf("result = %g\\n", ]ifelse([$2],,sin(x),$2)[)], 1941894e0ac8Smrg [cf_cv_need_libm=no], 1942894e0ac8Smrg [cf_cv_need_libm=yes])]) 19435307cd1aSmrg 1944894e0ac8Smrgif test "$cf_cv_need_libm" = yes 1945894e0ac8Smrgthen 19465307cd1aSmrg 19475307cd1aSmrg cf_save_LIBS="$LIBS" 19485307cd1aSmrg LIBS="$LIBS -lm" 19495307cd1aSmrg AC_CACHE_CHECK(if -lm is available for math functions, 19505307cd1aSmrg cf_cv_have_libm,[ 19515307cd1aSmrg AC_TRY_LINK([ 19525307cd1aSmrg #include <stdio.h> 19535307cd1aSmrg #include <stdlib.h> 19545307cd1aSmrg #include <math.h> 19555307cd1aSmrg ], 19565307cd1aSmrg [double x = rand(); printf("result = %g\\n", ]ifelse([$2],,sin(x),$2)[)], 19575307cd1aSmrg [cf_cv_have_libm=yes], 19585307cd1aSmrg [cf_cv_have_libm=no])]) 19595307cd1aSmrg LIBS="$cf_save_LIBS" 19605307cd1aSmrg 19615307cd1aSmrg if test "$cf_cv_have_libm" = yes 19625307cd1aSmrg then 19635307cd1aSmrg ifelse($1,,[CF_ADD_LIB(m)],[$1=-lm]) 19645307cd1aSmrg fi 19655307cd1aSmrgelse 19665307cd1aSmrg cf_cv_have_libm=yes 19675307cd1aSmrgfi 19685307cd1aSmrg 19695307cd1aSmrgif test "$cf_cv_have_libm" = yes 19705307cd1aSmrgthen 19715307cd1aSmrg AC_DEFINE(HAVE_MATH_FUNCS,1,[Define to 1 if math functions are available]) 1972894e0ac8Smrgfi 1973894e0ac8Smrg]) 1974894e0ac8Smrgdnl --------------------------------------------------------------------------- 1975f2e35a3aSmrgdnl CF_MIXEDCASE_FILENAMES version: 9 updated: 2021/01/01 16:53:59 197620d2c4d2Smrgdnl ---------------------- 197720d2c4d2Smrgdnl Check if the file-system supports mixed-case filenames. If we're able to 197820d2c4d2Smrgdnl create a lowercase name and see it as uppercase, it doesn't support that. 197920d2c4d2SmrgAC_DEFUN([CF_MIXEDCASE_FILENAMES], 198020d2c4d2Smrg[ 198120d2c4d2SmrgAC_CACHE_CHECK(if filesystem supports mixed-case filenames,cf_cv_mixedcase,[ 198220d2c4d2Smrgif test "$cross_compiling" = yes ; then 1983f2e35a3aSmrg case "$target_alias" in 1984f2e35a3aSmrg (*-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-msys*|*-mingw*|*-uwin*|darwin*) 198520d2c4d2Smrg cf_cv_mixedcase=no 198620d2c4d2Smrg ;; 198701037d57Smrg (*) 198820d2c4d2Smrg cf_cv_mixedcase=yes 198920d2c4d2Smrg ;; 199020d2c4d2Smrg esac 199120d2c4d2Smrgelse 199220d2c4d2Smrg rm -f conftest CONFTEST 199320d2c4d2Smrg echo test >conftest 199420d2c4d2Smrg if test -f CONFTEST ; then 199520d2c4d2Smrg cf_cv_mixedcase=no 199620d2c4d2Smrg else 199720d2c4d2Smrg cf_cv_mixedcase=yes 199820d2c4d2Smrg fi 199920d2c4d2Smrg rm -f conftest CONFTEST 200020d2c4d2Smrgfi 200120d2c4d2Smrg]) 20020bd37d32Smrgtest "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES,1,[Define to 1 if filesystem supports mixed-case filenames.]) 200320d2c4d2Smrg])dnl 200420d2c4d2Smrgdnl --------------------------------------------------------------------------- 200504b94745Smrgdnl CF_MKSTEMP version: 13 updated: 2023/12/01 17:22:50 20065307cd1aSmrgdnl ---------- 20075307cd1aSmrgdnl Check for a working mkstemp. This creates two files, checks that they are 20085307cd1aSmrgdnl successfully created and distinct (AmigaOS apparently fails on the last). 20095307cd1aSmrgAC_DEFUN([CF_MKSTEMP],[ 20105307cd1aSmrgAC_CHECK_HEADERS( \ 20115307cd1aSmrgunistd.h \ 20125307cd1aSmrg) 20135307cd1aSmrgAC_CACHE_CHECK(for working mkstemp, cf_cv_func_mkstemp,[ 20145307cd1aSmrgrm -rf ./conftest* 20155307cd1aSmrgAC_TRY_RUN([ 20165307cd1aSmrg$ac_includes_default 20175307cd1aSmrg 20185307cd1aSmrgint main(void) 20195307cd1aSmrg{ 202004b94745Smrg static char tmpl[] = "conftestXXXXXX"; 20215307cd1aSmrg char name[2][80]; 20225307cd1aSmrg int n; 20235307cd1aSmrg int result = 0; 20245307cd1aSmrg int fd; 20255307cd1aSmrg struct stat sb; 20265307cd1aSmrg 20275307cd1aSmrg umask(077); 20285307cd1aSmrg for (n = 0; n < 2; ++n) { 20295307cd1aSmrg strcpy(name[n], tmpl); 20305307cd1aSmrg if ((fd = mkstemp(name[n])) >= 0) { 20315307cd1aSmrg if (!strcmp(name[n], tmpl) 20325307cd1aSmrg || stat(name[n], &sb) != 0 20335307cd1aSmrg || (sb.st_mode & S_IFMT) != S_IFREG 20345307cd1aSmrg || (sb.st_mode & 077) != 0) { 20355307cd1aSmrg result = 1; 20365307cd1aSmrg } 20375307cd1aSmrg close(fd); 20385307cd1aSmrg } 20395307cd1aSmrg } 20405307cd1aSmrg if (result == 0 20415307cd1aSmrg && !strcmp(name[0], name[1])) 20425307cd1aSmrg result = 1; 20435307cd1aSmrg ${cf_cv_main_return:-return}(result); 20445307cd1aSmrg} 20455307cd1aSmrg],[cf_cv_func_mkstemp=yes 20465307cd1aSmrg],[cf_cv_func_mkstemp=no 20475307cd1aSmrg],[cf_cv_func_mkstemp=maybe]) 20485307cd1aSmrg]) 20495307cd1aSmrgif test "x$cf_cv_func_mkstemp" = xmaybe ; then 20505307cd1aSmrg AC_CHECK_FUNC(mkstemp) 20515307cd1aSmrgfi 20525307cd1aSmrgif test "x$cf_cv_func_mkstemp" = xyes || test "x$ac_cv_func_mkstemp" = xyes ; then 20535307cd1aSmrg AC_DEFINE(HAVE_MKSTEMP,1,[Define to 1 if mkstemp() is available and working.]) 20545307cd1aSmrgfi 20555307cd1aSmrg])dnl 20565307cd1aSmrgdnl --------------------------------------------------------------------------- 20576879286fSmrgdnl CF_MSG_LOG version: 5 updated: 2010/10/23 15:52:32 2058d522f475Smrgdnl ---------- 2059d522f475Smrgdnl Write a debug message to config.log, along with the line number in the 2060d522f475Smrgdnl configure script. 2061d522f475SmrgAC_DEFUN([CF_MSG_LOG],[ 20626879286fSmrgecho "${as_me:-configure}:__oline__: testing $* ..." 1>&AC_FD_CC 2063d522f475Smrg])dnl 2064d522f475Smrgdnl --------------------------------------------------------------------------- 2065a5ae21e4Smrgdnl CF_NO_LEAKS_OPTION version: 9 updated: 2021/06/13 19:45:41 20660bd37d32Smrgdnl ------------------ 20670bd37d32Smrgdnl see CF_WITH_NO_LEAKS 2068a5ae21e4Smrgdnl 2069a5ae21e4Smrgdnl $1 = option/name 2070a5ae21e4Smrgdnl $2 = help-text 2071a5ae21e4Smrgdnl $3 = symbol to define if the option is set 2072a5ae21e4Smrgdnl $4 = additional actions to take if the option is set 20730bd37d32SmrgAC_DEFUN([CF_NO_LEAKS_OPTION],[ 20740bd37d32SmrgAC_MSG_CHECKING(if you want to use $1 for testing) 20750bd37d32SmrgAC_ARG_WITH($1, 20760bd37d32Smrg [$2], 2077a5ae21e4Smrg [case "x$withval" in 2078a5ae21e4Smrg (x|xno) ;; 2079a5ae21e4Smrg (*) 2080a5ae21e4Smrg : "${with_cflags:=-g}" 2081a5ae21e4Smrg : "${enable_leaks:=no}" 2082a5ae21e4Smrg with_$1=yes 2083a5ae21e4Smrg AC_DEFINE_UNQUOTED($3,1,"Define to 1 if you want to use $1 for testing.")ifelse([$4],,[ 20840bd37d32Smrg $4 20850bd37d32Smrg]) 2086a5ae21e4Smrg ;; 2087a5ae21e4Smrg esac], 20880bd37d32Smrg [with_$1=]) 20890bd37d32SmrgAC_MSG_RESULT(${with_$1:-no}) 20900bd37d32Smrg 2091f2e35a3aSmrgcase ".$with_cflags" in 209201037d57Smrg(.*-g*) 209301037d57Smrg case .$CFLAGS in 209401037d57Smrg (.*-g*) 20950bd37d32Smrg ;; 209601037d57Smrg (*) 20970bd37d32Smrg CF_ADD_CFLAGS([-g]) 20980bd37d32Smrg ;; 20990bd37d32Smrg esac 21000bd37d32Smrg ;; 21010bd37d32Smrgesac 21020bd37d32Smrg])dnl 21030bd37d32Smrgdnl --------------------------------------------------------------------------- 2104f2e35a3aSmrgdnl CF_PATHSEP version: 8 updated: 2021/01/01 13:31:04 2105956cc18dSsnjdnl ---------- 21060bd37d32Smrgdnl Provide a value for the $PATH and similar separator (or amend the value 21070bd37d32Smrgdnl as provided in autoconf 2.5x). 2108956cc18dSsnjAC_DEFUN([CF_PATHSEP], 2109956cc18dSsnj[ 21100bd37d32Smrg AC_MSG_CHECKING(for PATH separator) 2111f2e35a3aSmrg case "$cf_cv_system_name" in 211201037d57Smrg (os2*) PATH_SEPARATOR=';' ;; 211301037d57Smrg (*) ${PATH_SEPARATOR:=':'} ;; 2114956cc18dSsnj esac 211520d2c4d2Smrgifelse([$1],,,[$1=$PATH_SEPARATOR]) 2116956cc18dSsnj AC_SUBST(PATH_SEPARATOR) 21170bd37d32Smrg AC_MSG_RESULT($PATH_SEPARATOR) 2118956cc18dSsnj])dnl 2119956cc18dSsnjdnl --------------------------------------------------------------------------- 2120f2e35a3aSmrgdnl CF_PATH_PROG version: 12 updated: 2021/01/02 09:31:20 2121d522f475Smrgdnl ------------ 2122d522f475Smrgdnl Check for a given program, defining corresponding symbol. 2123d522f475Smrgdnl $1 = environment variable, which is suffixed by "_PATH" in the #define. 2124d522f475Smrgdnl $2 = program name to find. 2125d522f475Smrgdnl $3 = optional list of additional program names to test. 2126f2e35a3aSmrgdnl $4 = $PATH 2127d522f475Smrgdnl 2128d522f475Smrgdnl If there is more than one token in the result, #define the remaining tokens 2129d522f475Smrgdnl to $1_ARGS. We need this for 'install' in particular. 2130d522f475Smrgdnl 2131d522f475Smrgdnl FIXME: we should allow this to be overridden by environment variables 2132d522f475Smrgdnl 2133d522f475SmrgAC_DEFUN([CF_PATH_PROG],[ 2134956cc18dSsnjAC_REQUIRE([CF_PATHSEP]) 2135f2e35a3aSmrgtest -z "[$]$1" && $1="$2" 2136f2e35a3aSmrgAC_PATH_PROGS($1,[$]$1 $2 ifelse($3,,,$3),[$]$1, ifelse($4,,,$4)) 2137d522f475Smrg 2138d522f475Smrgcf_path_prog="" 2139d522f475Smrgcf_path_args="" 21406879286fSmrgIFS="${IFS:- }"; cf_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR" 2141d522f475Smrgfor cf_temp in $ac_cv_path_$1 2142d522f475Smrgdo 2143d522f475Smrg if test -z "$cf_path_prog" ; then 2144d522f475Smrg if test "$with_full_paths" = yes ; then 2145d522f475Smrg CF_PATH_SYNTAX(cf_temp,break) 2146d522f475Smrg cf_path_prog="$cf_temp" 2147d522f475Smrg else 2148f2e35a3aSmrg cf_path_prog="`basename "$cf_temp"`" 2149d522f475Smrg fi 2150d522f475Smrg elif test -z "$cf_path_args" ; then 2151d522f475Smrg cf_path_args="$cf_temp" 2152d522f475Smrg else 2153d522f475Smrg cf_path_args="$cf_path_args $cf_temp" 2154d522f475Smrg fi 2155d522f475Smrgdone 2156d522f475SmrgIFS="$cf_save_ifs" 2157d522f475Smrg 2158d522f475Smrgif test -n "$cf_path_prog" ; then 2159d522f475Smrg CF_MSG_LOG(defining path for ${cf_path_prog}) 21600bd37d32Smrg AC_DEFINE_UNQUOTED($1_PATH,"$cf_path_prog",Define to pathname $1) 21610bd37d32Smrg test -n "$cf_path_args" && AC_DEFINE_UNQUOTED($1_ARGS,"$cf_path_args",Define to provide args for $1) 2162d522f475Smrgfi 2163d522f475Smrg])dnl 2164d522f475Smrgdnl --------------------------------------------------------------------------- 2165f2e35a3aSmrgdnl CF_PATH_SYNTAX version: 18 updated: 2020/12/31 18:40:20 2166d522f475Smrgdnl -------------- 2167d522f475Smrgdnl Check the argument to see that it looks like a pathname. Rewrite it if it 2168d522f475Smrgdnl begins with one of the prefix/exec_prefix variables, and then again if the 2169d522f475Smrgdnl result begins with 'NONE'. This is necessary to work around autoconf's 2170d522f475Smrgdnl delayed evaluation of those symbols. 2171d522f475SmrgAC_DEFUN([CF_PATH_SYNTAX],[ 2172d522f475Smrgif test "x$prefix" != xNONE; then 21732e4f8982Smrg cf_path_syntax="$prefix" 2174d522f475Smrgelse 21752e4f8982Smrg cf_path_syntax="$ac_default_prefix" 2176d522f475Smrgfi 2177d522f475Smrg 217801037d57Smrgcase ".[$]$1" in 217901037d57Smrg(.\[$]\(*\)*|.\'*\'*) 21802e4f8982Smrg ;; 218101037d57Smrg(..|./*|.\\*) 21822e4f8982Smrg ;; 218301037d57Smrg(.[[a-zA-Z]]:[[\\/]]*) # OS/2 EMX 21842e4f8982Smrg ;; 2185f2e35a3aSmrg(.\[$]\{*prefix\}*|.\[$]\{*dir\}*) 21862e4f8982Smrg eval $1="[$]$1" 21872e4f8982Smrg case ".[$]$1" in 21882e4f8982Smrg (.NONE/*) 2189f2e35a3aSmrg $1=`echo "[$]$1" | sed -e s%NONE%$cf_path_syntax%` 21902e4f8982Smrg ;; 21912e4f8982Smrg esac 21922e4f8982Smrg ;; 219301037d57Smrg(.no|.NONE/*) 2194f2e35a3aSmrg $1=`echo "[$]$1" | sed -e s%NONE%$cf_path_syntax%` 21952e4f8982Smrg ;; 219601037d57Smrg(*) 21972e4f8982Smrg ifelse([$2],,[AC_MSG_ERROR([expected a pathname, not \"[$]$1\"])],$2) 21982e4f8982Smrg ;; 2199d522f475Smrgesac 2200d522f475Smrg])dnl 2201d522f475Smrgdnl --------------------------------------------------------------------------- 220204b94745Smrgdnl CF_PKG_CONFIG version: 13 updated: 2023/10/28 11:59:01 2203956cc18dSsnjdnl ------------- 2204956cc18dSsnjdnl Check for the package-config program, unless disabled by command-line. 22054419d26bSmrgdnl 22064419d26bSmrgdnl Sets $PKG_CONFIG to the pathname of the pkg-config program. 2207956cc18dSsnjAC_DEFUN([CF_PKG_CONFIG], 2208956cc18dSsnj[ 2209956cc18dSsnjAC_MSG_CHECKING(if you want to use pkg-config) 2210956cc18dSsnjAC_ARG_WITH(pkg-config, 221104b94745Smrg [[ --with-pkg-config[=CMD] enable/disable use of pkg-config and its name CMD]], 2212956cc18dSsnj [cf_pkg_config=$withval], 2213956cc18dSsnj [cf_pkg_config=yes]) 2214956cc18dSsnjAC_MSG_RESULT($cf_pkg_config) 2215956cc18dSsnj 2216f2e35a3aSmrgcase "$cf_pkg_config" in 221701037d57Smrg(no) 2218956cc18dSsnj PKG_CONFIG=none 2219956cc18dSsnj ;; 222001037d57Smrg(yes) 2221e39b573cSmrg CF_ACVERSION_CHECK(2.52, 2222e39b573cSmrg [AC_PATH_TOOL(PKG_CONFIG, pkg-config, none)], 2223e39b573cSmrg [AC_PATH_PROG(PKG_CONFIG, pkg-config, none)]) 2224956cc18dSsnj ;; 222501037d57Smrg(*) 2226956cc18dSsnj PKG_CONFIG=$withval 2227956cc18dSsnj ;; 2228956cc18dSsnjesac 2229956cc18dSsnj 2230956cc18dSsnjtest -z "$PKG_CONFIG" && PKG_CONFIG=none 2231956cc18dSsnjif test "$PKG_CONFIG" != none ; then 2232956cc18dSsnj CF_PATH_SYNTAX(PKG_CONFIG) 22332e4f8982Smrgelif test "x$cf_pkg_config" != xno ; then 223401037d57Smrg AC_MSG_WARN(pkg-config is not installed) 2235956cc18dSsnjfi 2236956cc18dSsnj 2237956cc18dSsnjAC_SUBST(PKG_CONFIG) 2238956cc18dSsnj])dnl 2239956cc18dSsnjdnl --------------------------------------------------------------------------- 22405307cd1aSmrgdnl CF_POSIX_C_SOURCE version: 12 updated: 2023/02/18 17:41:25 2241d522f475Smrgdnl ----------------- 2242d522f475Smrgdnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed. 2243d522f475Smrgdnl 2244d522f475Smrgdnl POSIX.1-1990 _POSIX_SOURCE 2245d522f475Smrgdnl POSIX.1-1990 and _POSIX_SOURCE and 2246d522f475Smrgdnl POSIX.2-1992 C-Language _POSIX_C_SOURCE=2 2247d522f475Smrgdnl Bindings Option 2248d522f475Smrgdnl POSIX.1b-1993 _POSIX_C_SOURCE=199309L 2249d522f475Smrgdnl POSIX.1c-1996 _POSIX_C_SOURCE=199506L 2250d522f475Smrgdnl X/Open 2000 _POSIX_C_SOURCE=200112L 2251d522f475Smrgdnl 2252d522f475Smrgdnl Parameters: 2253d522f475Smrgdnl $1 is the nominal value for _POSIX_C_SOURCE 2254d522f475SmrgAC_DEFUN([CF_POSIX_C_SOURCE], 2255f2e35a3aSmrg[AC_REQUIRE([CF_POSIX_VISIBLE])dnl 2256f2e35a3aSmrg 2257f2e35a3aSmrgif test "$cf_cv_posix_visible" = no; then 2258f2e35a3aSmrg 225920d2c4d2Smrgcf_POSIX_C_SOURCE=ifelse([$1],,199506L,[$1]) 2260d522f475Smrg 2261d522f475Smrgcf_save_CFLAGS="$CFLAGS" 2262d522f475Smrgcf_save_CPPFLAGS="$CPPFLAGS" 2263d522f475Smrg 2264d522f475SmrgCF_REMOVE_DEFINE(cf_trim_CFLAGS,$cf_save_CFLAGS,_POSIX_C_SOURCE) 2265d522f475SmrgCF_REMOVE_DEFINE(cf_trim_CPPFLAGS,$cf_save_CPPFLAGS,_POSIX_C_SOURCE) 2266d522f475Smrg 2267d522f475SmrgAC_CACHE_CHECK(if we should define _POSIX_C_SOURCE,cf_cv_posix_c_source,[ 2268d522f475Smrg CF_MSG_LOG(if the symbol is already defined go no further) 2269d522f475Smrg AC_TRY_COMPILE([#include <sys/types.h>],[ 2270d522f475Smrg#ifndef _POSIX_C_SOURCE 22715307cd1aSmrg#error _POSIX_C_SOURCE is not defined 2272d522f475Smrg#endif], 2273d522f475Smrg [cf_cv_posix_c_source=no], 2274d522f475Smrg [cf_want_posix_source=no 227501037d57Smrg case .$cf_POSIX_C_SOURCE in 227601037d57Smrg (.[[12]]??*) 2277d522f475Smrg cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" 2278d522f475Smrg ;; 227901037d57Smrg (.2) 2280d522f475Smrg cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" 2281d522f475Smrg cf_want_posix_source=yes 2282d522f475Smrg ;; 228301037d57Smrg (.*) 2284d522f475Smrg cf_want_posix_source=yes 2285d522f475Smrg ;; 2286d522f475Smrg esac 2287d522f475Smrg if test "$cf_want_posix_source" = yes ; then 2288d522f475Smrg AC_TRY_COMPILE([#include <sys/types.h>],[ 2289d522f475Smrg#ifdef _POSIX_SOURCE 22905307cd1aSmrg#error _POSIX_SOURCE is defined 2291d522f475Smrg#endif],[], 2292d522f475Smrg cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE") 2293d522f475Smrg fi 2294d522f475Smrg CF_MSG_LOG(ifdef from value $cf_POSIX_C_SOURCE) 2295d522f475Smrg CFLAGS="$cf_trim_CFLAGS" 2296f2e35a3aSmrg CPPFLAGS="$cf_trim_CPPFLAGS" 2297f2e35a3aSmrg CF_APPEND_TEXT(CPPFLAGS,$cf_cv_posix_c_source) 2298d522f475Smrg CF_MSG_LOG(if the second compile does not leave our definition intact error) 2299d522f475Smrg AC_TRY_COMPILE([#include <sys/types.h>],[ 2300d522f475Smrg#ifndef _POSIX_C_SOURCE 23015307cd1aSmrg#error _POSIX_C_SOURCE is not defined 2302d522f475Smrg#endif],, 2303d522f475Smrg [cf_cv_posix_c_source=no]) 2304d522f475Smrg CFLAGS="$cf_save_CFLAGS" 2305d522f475Smrg CPPFLAGS="$cf_save_CPPFLAGS" 2306d522f475Smrg ]) 2307d522f475Smrg]) 2308d522f475Smrg 2309d522f475Smrgif test "$cf_cv_posix_c_source" != no ; then 2310d522f475Smrg CFLAGS="$cf_trim_CFLAGS" 2311d522f475Smrg CPPFLAGS="$cf_trim_CPPFLAGS" 231220d2c4d2Smrg CF_ADD_CFLAGS($cf_cv_posix_c_source) 2313d522f475Smrgfi 2314d522f475Smrg 2315f2e35a3aSmrgfi # cf_cv_posix_visible 2316f2e35a3aSmrg 2317d522f475Smrg])dnl 2318d522f475Smrgdnl --------------------------------------------------------------------------- 231904b94745Smrgdnl CF_POSIX_SAVED_IDS version: 12 updated: 2023/12/03 19:55:51 2320d522f475Smrgdnl ------------------ 2321d522f475Smrgdnl 2322d522f475Smrgdnl Check first if saved-ids are always supported. Some systems 2323d522f475Smrgdnl may require runtime checks. 2324d522f475SmrgAC_DEFUN([CF_POSIX_SAVED_IDS], 2325d522f475Smrg[ 2326d522f475SmrgAC_CHECK_HEADERS( \ 2327d522f475Smrgsys/param.h \ 2328d522f475Smrg) 2329d522f475Smrg 2330d522f475SmrgAC_CACHE_CHECK(if POSIX saved-ids are supported,cf_cv_posix_saved_ids,[ 2331d522f475SmrgAC_TRY_LINK( 2332d522f475Smrg[ 2333d522f475Smrg#include <unistd.h> 2334d522f475Smrg#ifdef HAVE_SYS_PARAM_H 2335d522f475Smrg#include <sys/param.h> /* this may define "BSD" */ 2336d522f475Smrg#endif 2337d522f475Smrg],[ 2338d522f475Smrg#if defined(_POSIX_SAVED_IDS) && (_POSIX_SAVED_IDS > 0) 233904b94745Smrg int (*my_seteuid)(uid_t) = seteuid; 234004b94745Smrg int x = my_seteuid(geteuid()); 2341f2e35a3aSmrg (void)x; 2342d522f475Smrg#elif defined(BSD) && (BSD >= 199103) 2343d522f475Smrg/* The BSD's may implement the runtime check - and it fails. 2344d522f475Smrg * However, saved-ids work almost like POSIX (close enough for most uses). 2345d522f475Smrg */ 2346d522f475Smrg#else 234704b94745Smrg#error no saved-ids found 2348d522f475Smrg#endif 2349d522f475Smrg],[cf_cv_posix_saved_ids=yes 2350d522f475Smrg],[ 2351d522f475SmrgAC_TRY_RUN([ 23525307cd1aSmrg$ac_includes_default 23535307cd1aSmrg 2354f2e35a3aSmrgint main(void) 2355d522f475Smrg{ 2356d522f475Smrg void *p = (void *) seteuid; 2357d522f475Smrg long code = sysconf(_SC_SAVED_IDS); 2358f2e35a3aSmrg (void)p; 2359d522f475Smrg ${cf_cv_main_return:-return} ((code > 0) ? 0 : 1); 2360d522f475Smrg}], 2361d522f475Smrg cf_cv_posix_saved_ids=yes, 2362d522f475Smrg cf_cv_posix_saved_ids=no, 2363d522f475Smrg cf_cv_posix_saved_ids=unknown) 2364d522f475Smrg]) 2365d522f475Smrg]) 2366d522f475Smrg 23670bd37d32Smrgtest "$cf_cv_posix_saved_ids" = yes && AC_DEFINE(HAVE_POSIX_SAVED_IDS,1,[Define to 1 if POSIX saved-ids are supported]) 2368d522f475Smrg]) 2369d522f475Smrgdnl --------------------------------------------------------------------------- 2370f2e35a3aSmrgdnl CF_POSIX_VISIBLE version: 1 updated: 2018/12/31 20:46:17 2371f2e35a3aSmrgdnl ---------------- 2372f2e35a3aSmrgdnl POSIX documents test-macros which an application may set before any system 2373f2e35a3aSmrgdnl headers are included to make features available. 2374f2e35a3aSmrgdnl 2375f2e35a3aSmrgdnl Some BSD platforms (originally FreeBSD, but copied by a few others) 2376f2e35a3aSmrgdnl diverged from POSIX in 2002 by setting symbols which make all of the most 2377f2e35a3aSmrgdnl recent features visible in the system header files unless the application 2378f2e35a3aSmrgdnl overrides the corresponding test-macros. Doing that introduces portability 2379f2e35a3aSmrgdnl problems. 2380f2e35a3aSmrgdnl 2381f2e35a3aSmrgdnl This macro makes a special check for the symbols used for this, to avoid a 2382f2e35a3aSmrgdnl conflicting definition. 2383f2e35a3aSmrgAC_DEFUN([CF_POSIX_VISIBLE], 2384f2e35a3aSmrg[ 2385f2e35a3aSmrgAC_CACHE_CHECK(if the POSIX test-macros are already defined,cf_cv_posix_visible,[ 2386f2e35a3aSmrgAC_TRY_COMPILE([#include <stdio.h>],[ 2387f2e35a3aSmrg#if defined(__POSIX_VISIBLE) && ((__POSIX_VISIBLE - 0L) > 0) \ 2388f2e35a3aSmrg && defined(__XSI_VISIBLE) && ((__XSI_VISIBLE - 0L) > 0) \ 2389f2e35a3aSmrg && defined(__BSD_VISIBLE) && ((__BSD_VISIBLE - 0L) > 0) \ 2390f2e35a3aSmrg && defined(__ISO_C_VISIBLE) && ((__ISO_C_VISIBLE - 0L) > 0) 2391f2e35a3aSmrg#error conflicting symbols found 2392f2e35a3aSmrg#endif 2393f2e35a3aSmrg],[cf_cv_posix_visible=no],[cf_cv_posix_visible=yes]) 2394f2e35a3aSmrg]) 2395f2e35a3aSmrg])dnl 2396f2e35a3aSmrgdnl --------------------------------------------------------------------------- 23975307cd1aSmrgdnl CF_POSIX_WAIT version: 5 updated: 2023/01/05 19:26:07 2398d522f475Smrgdnl ------------- 2399d522f475Smrgdnl Check for POSIX wait support 2400d522f475SmrgAC_DEFUN([CF_POSIX_WAIT], 2401d522f475Smrg[ 2402d522f475SmrgAC_REQUIRE([AC_HEADER_SYS_WAIT]) 2403d522f475SmrgAC_CACHE_CHECK(for POSIX wait functions,cf_cv_posix_wait,[ 2404d522f475SmrgAC_TRY_LINK([ 24055307cd1aSmrg$ac_includes_default 24065307cd1aSmrg 2407d522f475Smrg#ifdef HAVE_SYS_WAIT_H 2408d522f475Smrg#include <sys/wait.h> 2409d522f475Smrg#endif 2410d522f475Smrg],[ 2411d522f475Smrg int stat_loc; 2412d522f475Smrg pid_t pid = waitpid(-1, &stat_loc, WNOHANG|WUNTRACED); 2413d522f475Smrg pid_t pid2 = wait(&stat_loc); 2414f2e35a3aSmrg (void)pid; 2415f2e35a3aSmrg (void)pid2; 2416d522f475Smrg], 2417d522f475Smrg[cf_cv_posix_wait=yes], 2418d522f475Smrg[cf_cv_posix_wait=no]) 2419d522f475Smrg]) 24200bd37d32Smrgtest "$cf_cv_posix_wait" = yes && AC_DEFINE(USE_POSIX_WAIT,1,[Define to 1 if we have POSIX wait functions]) 2421d522f475Smrg])dnl 2422d522f475Smrgdnl --------------------------------------------------------------------------- 2423f2e35a3aSmrgdnl CF_PROCFS_CWD version: 4 updated: 2020/12/31 18:40:20 2424d522f475Smrgdnl ------------- 2425d522f475Smrgdnl Find /proc tree (may be in a different place) which implements the "cwd" 2426d522f475Smrgdnl link. 2427d522f475SmrgAC_DEFUN([CF_PROCFS_CWD],[ 2428d522f475SmrgAC_CACHE_CHECK(for proc tree with cwd-support,cf_cv_procfs_cwd,[ 2429d522f475Smrgcf_cv_procfs_cwd=no 2430d522f475Smrgfor cf_path in /proc /compat/linux/proc /usr/compat/linux/proc 2431d522f475Smrgdo 2432f2e35a3aSmrg if test -d "$cf_path" && \ 2433f2e35a3aSmrg test -d "$cf_path"/$$ && \ 2434f2e35a3aSmrg { test -d "$cf_path"/$$/cwd || \ 2435f2e35a3aSmrg test -L "$cf_path"/$$/cwd; }; then 2436f2e35a3aSmrg cf_cv_procfs_cwd="$cf_path" 2437d522f475Smrg break 2438d522f475Smrg fi 2439d522f475Smrgdone 2440d522f475Smrg]) 2441d522f475Smrg])dnl 2442d522f475Smrgdnl --------------------------------------------------------------------------- 2443f2e35a3aSmrgdnl CF_PROG_CC version: 5 updated: 2019/12/31 08:53:54 24440bd37d32Smrgdnl ---------- 24450bd37d32Smrgdnl standard check for CC, plus followup sanity checks 24460bd37d32Smrgdnl $1 = optional parameter to pass to AC_PROG_CC to specify compiler name 24470bd37d32SmrgAC_DEFUN([CF_PROG_CC],[ 2448f2e35a3aSmrgCF_ACVERSION_CHECK(2.53, 2449f2e35a3aSmrg [AC_MSG_WARN(this will incorrectly handle gnatgcc choice) 2450f2e35a3aSmrg AC_REQUIRE([AC_PROG_CC])], 2451f2e35a3aSmrg []) 24520bd37d32Smrgifelse($1,,[AC_PROG_CC],[AC_PROG_CC($1)]) 24530bd37d32SmrgCF_GCC_VERSION 24540bd37d32SmrgCF_ACVERSION_CHECK(2.52, 24550bd37d32Smrg [AC_PROG_CC_STDC], 24560bd37d32Smrg [CF_ANSI_CC_REQD]) 245701037d57SmrgCF_CC_ENV_FLAGS 2458d522f475Smrg])dnl 2459d522f475Smrgdnl --------------------------------------------------------------------------- 2460f2e35a3aSmrgdnl CF_PROG_GROFF version: 3 updated: 2018/01/07 13:16:19 24610bd37d32Smrgdnl ------------- 24620bd37d32Smrgdnl Check if groff is available, for cases (such as html output) where nroff 24630bd37d32Smrgdnl is not enough. 24640bd37d32SmrgAC_DEFUN([CF_PROG_GROFF],[ 24650bd37d32SmrgAC_PATH_PROG(GROFF_PATH,groff,no) 2466f2e35a3aSmrgAC_PATH_PROGS(NROFF_PATH,nroff mandoc,no) 2467f2e35a3aSmrgAC_PATH_PROG(TBL_PATH,tbl,cat) 24680bd37d32Smrgif test "x$GROFF_PATH" = xno 24690bd37d32Smrgthen 24700bd37d32Smrg NROFF_NOTE= 24710bd37d32Smrg GROFF_NOTE="#" 24720bd37d32Smrgelse 24730bd37d32Smrg NROFF_NOTE="#" 24740bd37d32Smrg GROFF_NOTE= 24750bd37d32Smrgfi 24760bd37d32SmrgAC_SUBST(GROFF_NOTE) 24770bd37d32SmrgAC_SUBST(NROFF_NOTE) 2478d522f475Smrg])dnl 2479d522f475Smrgdnl --------------------------------------------------------------------------- 24805307cd1aSmrgdnl CF_PROG_LINT version: 5 updated: 2022/08/20 15:44:13 24812e4f8982Smrgdnl ------------ 24822e4f8982SmrgAC_DEFUN([CF_PROG_LINT], 24832e4f8982Smrg[ 24842e4f8982SmrgAC_CHECK_PROGS(LINT, lint cppcheck splint) 2485f2e35a3aSmrgcase "x$LINT" in 2486f2e35a3aSmrg(xcppcheck|x*/cppcheck) 2487f2e35a3aSmrg test -z "$LINT_OPTS" && LINT_OPTS="--enable=all" 2488f2e35a3aSmrg ;; 2489f2e35a3aSmrgesac 24902e4f8982SmrgAC_SUBST(LINT_OPTS) 24915307cd1aSmrgAC_SUBST(LINT_LIBS) 24922e4f8982Smrg])dnl 24932e4f8982Smrgdnl --------------------------------------------------------------------------- 2494f2e35a3aSmrgdnl CF_REGEX version: 18 updated: 2021/01/01 16:53:59 2495d522f475Smrgdnl -------- 2496d522f475Smrgdnl Attempt to determine if we've got one of the flavors of regular-expression 2497d522f475Smrgdnl code that we can support. 2498d522f475SmrgAC_DEFUN([CF_REGEX], 2499d522f475Smrg[ 250020d2c4d2Smrg 250120d2c4d2Smrgcf_regex_func=no 2502f2e35a3aSmrgcf_regex_libs= 2503f2e35a3aSmrgcase "$host_os" in 250401037d57Smrg(mingw*) 2505f2e35a3aSmrg # -lsystre -ltre -lintl -liconv 2506f2e35a3aSmrg AC_CHECK_LIB(systre,regcomp,[ 2507f2e35a3aSmrg AC_CHECK_LIB(iconv,libiconv_open,[CF_ADD_LIB(iconv)]) 2508f2e35a3aSmrg AC_CHECK_LIB(intl,libintl_gettext,[CF_ADD_LIB(intl)]) 2509f2e35a3aSmrg AC_CHECK_LIB(tre,tre_regcomp,[CF_ADD_LIB(tre)]) 2510f2e35a3aSmrg CF_ADD_LIB(systre) 2511f2e35a3aSmrg cf_regex_func=regcomp 2512f2e35a3aSmrg ],[ 2513f2e35a3aSmrg AC_CHECK_LIB(gnurx,regcomp,[ 2514f2e35a3aSmrg CF_ADD_LIB(gnurx) 2515f2e35a3aSmrg cf_regex_func=regcomp]) 2516f2e35a3aSmrg ]) 2517f2e35a3aSmrg ;; 2518f2e35a3aSmrg(*) 2519f2e35a3aSmrg cf_regex_libs="regex re" 2520f2e35a3aSmrg AC_CHECK_FUNC(regcomp,[cf_regex_func=regcomp],[ 2521f2e35a3aSmrg for cf_regex_lib in $cf_regex_libs 2522f2e35a3aSmrg do 2523f2e35a3aSmrg AC_CHECK_LIB($cf_regex_lib,regcomp,[ 2524f2e35a3aSmrg CF_ADD_LIB($cf_regex_lib) 2525f2e35a3aSmrg cf_regex_func=regcomp 2526f2e35a3aSmrg break]) 2527f2e35a3aSmrg done 2528f2e35a3aSmrg ]) 25296879286fSmrg ;; 25306879286fSmrgesac 25316879286fSmrg 253220d2c4d2Smrgif test "$cf_regex_func" = no ; then 253320d2c4d2Smrg AC_CHECK_FUNC(compile,[cf_regex_func=compile],[ 253420d2c4d2Smrg AC_CHECK_LIB(gen,compile,[ 253520d2c4d2Smrg CF_ADD_LIB(gen) 253620d2c4d2Smrg cf_regex_func=compile])]) 253720d2c4d2Smrgfi 253820d2c4d2Smrg 253920d2c4d2Smrgif test "$cf_regex_func" = no ; then 254020d2c4d2Smrg AC_MSG_WARN(cannot find regular expression library) 254120d2c4d2Smrgfi 254220d2c4d2Smrg 254320d2c4d2SmrgAC_CACHE_CHECK(for regular-expression headers,cf_cv_regex_hdrs,[ 254420d2c4d2Smrg 254520d2c4d2Smrgcf_cv_regex_hdrs=no 2546f2e35a3aSmrgcase "$cf_regex_func" in 254701037d57Smrg(compile) 254820d2c4d2Smrg for cf_regex_hdr in regexp.h regexpr.h 254920d2c4d2Smrg do 255020d2c4d2Smrg AC_TRY_LINK([#include <$cf_regex_hdr>],[ 255120d2c4d2Smrg char *p = compile("", "", "", 0); 2552d522f475Smrg int x = step("", ""); 2553f2e35a3aSmrg (void)p; 2554f2e35a3aSmrg (void)x; 255520d2c4d2Smrg ],[ 255620d2c4d2Smrg cf_cv_regex_hdrs=$cf_regex_hdr 255720d2c4d2Smrg break 255820d2c4d2Smrg ]) 255920d2c4d2Smrg done 256020d2c4d2Smrg ;; 256101037d57Smrg(*) 256220d2c4d2Smrg for cf_regex_hdr in regex.h 256320d2c4d2Smrg do 256420d2c4d2Smrg AC_TRY_LINK([#include <sys/types.h> 256520d2c4d2Smrg#include <$cf_regex_hdr>],[ 2566f2e35a3aSmrg regex_t *p = 0; 256720d2c4d2Smrg int x = regcomp(p, "", 0); 256820d2c4d2Smrg int y = regexec(p, "", 0, 0, 0); 2569f2e35a3aSmrg (void)x; 2570f2e35a3aSmrg (void)y; 257120d2c4d2Smrg regfree(p); 257220d2c4d2Smrg ],[ 257320d2c4d2Smrg cf_cv_regex_hdrs=$cf_regex_hdr 257420d2c4d2Smrg break 257520d2c4d2Smrg ]) 257620d2c4d2Smrg done 257720d2c4d2Smrg ;; 257820d2c4d2Smrgesac 257920d2c4d2Smrg 2580d522f475Smrg]) 258120d2c4d2Smrg 2582f2e35a3aSmrgcase "$cf_cv_regex_hdrs" in 25832e4f8982Smrg (no) AC_MSG_WARN(no regular expression header found) ;; 25842e4f8982Smrg (regex.h) AC_DEFINE(HAVE_REGEX_H_FUNCS,1,[Define to 1 to include regex.h for regular expressions]) ;; 25852e4f8982Smrg (regexp.h) AC_DEFINE(HAVE_REGEXP_H_FUNCS,1,[Define to 1 to include regexp.h for regular expressions]) ;; 25862e4f8982Smrg (regexpr.h) AC_DEFINE(HAVE_REGEXPR_H_FUNCS,1,[Define to 1 to include regexpr.h for regular expressions]) ;; 2587d522f475Smrgesac 2588d522f475Smrg])dnl 2589d522f475Smrgdnl --------------------------------------------------------------------------- 2590a5ae21e4Smrgdnl CF_REMOVE_CFLAGS version: 3 updated: 2021/09/05 17:25:40 2591a5ae21e4Smrgdnl ---------------- 2592a5ae21e4Smrgdnl Remove a given option from CFLAGS/CPPFLAGS 2593a5ae21e4Smrgdnl $1 = option to remove 2594a5ae21e4Smrgdnl $2 = variable to update 2595a5ae21e4Smrgdnl $3 = nonempty to allow verbose message 2596a5ae21e4Smrgdefine([CF_REMOVE_CFLAGS], 2597a5ae21e4Smrg[ 2598a5ae21e4Smrgcf_tmp_cflag=`echo "x$1" | sed -e 's/^.//' -e 's/=.*//'` 2599a5ae21e4Smrgwhile true 2600a5ae21e4Smrgdo 2601a5ae21e4Smrg cf_old_cflag=`echo "x[$]$2" | sed -e 's/^.//' -e 's/[[ ]][[ ]]*-/ -/g' -e "s%$cf_tmp_cflag\\(=[[^ ]][[^ ]]*\\)\?%%" -e 's/^[[ ]]*//' -e 's%[[ ]][[ ]]*-D% -D%g' -e 's%[[ ]][[ ]]*-I% -I%g'` 2602a5ae21e4Smrg test "[$]$2" != "$cf_old_cflag" || break 2603a5ae21e4Smrg ifelse([$3],,,[CF_VERBOSE(removing old option $1 from $2)]) 2604a5ae21e4Smrg $2="$cf_old_cflag" 2605a5ae21e4Smrgdone 2606a5ae21e4Smrg])dnl 2607a5ae21e4Smrgdnl --------------------------------------------------------------------------- 260820d2c4d2Smrgdnl CF_REMOVE_DEFINE version: 3 updated: 2010/01/09 11:05:50 2609d522f475Smrgdnl ---------------- 2610d522f475Smrgdnl Remove all -U and -D options that refer to the given symbol from a list 2611d522f475Smrgdnl of C compiler options. This works around the problem that not all 2612d522f475Smrgdnl compilers process -U and -D options from left-to-right, so a -U option 2613d522f475Smrgdnl cannot be used to cancel the effect of a preceding -D option. 2614d522f475Smrgdnl 2615d522f475Smrgdnl $1 = target (which could be the same as the source variable) 2616d522f475Smrgdnl $2 = source (including '$') 2617d522f475Smrgdnl $3 = symbol to remove 2618d522f475Smrgdefine([CF_REMOVE_DEFINE], 2619d522f475Smrg[ 2620d522f475Smrg$1=`echo "$2" | \ 262120d2c4d2Smrg sed -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[[ ]]/ /g' \ 262220d2c4d2Smrg -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[$]//g'` 262320d2c4d2Smrg])dnl 262420d2c4d2Smrgdnl --------------------------------------------------------------------------- 2625f2e35a3aSmrgdnl CF_RESTORE_XTRA_FLAGS version: 1 updated: 2020/01/11 16:47:45 2626f2e35a3aSmrgdnl --------------------- 2627f2e35a3aSmrgdnl Restore flags saved in CF_SAVE_XTRA_FLAGS 2628f2e35a3aSmrgdnl $1 = name of current macro 2629f2e35a3aSmrgdefine([CF_RESTORE_XTRA_FLAGS], 2630f2e35a3aSmrg[ 2631f2e35a3aSmrgLIBS="$cf_save_LIBS_$1" 2632f2e35a3aSmrgCFLAGS="$cf_save_CFLAGS_$1" 2633f2e35a3aSmrgCPPFLAGS="$cf_save_CPPFLAGS_$1" 2634f2e35a3aSmrg])dnl 2635f2e35a3aSmrgdnl --------------------------------------------------------------------------- 2636f2e35a3aSmrgdnl CF_RPATH_HACK version: 13 updated: 2021/01/03 18:30:50 263720d2c4d2Smrgdnl ------------- 263820d2c4d2SmrgAC_DEFUN([CF_RPATH_HACK], 2639f2e35a3aSmrg[AC_REQUIRE([AC_PROG_FGREP])dnl 2640f2e35a3aSmrgAC_REQUIRE([CF_LD_RPATH_OPT])dnl 2641f2e35a3aSmrg 264220d2c4d2SmrgAC_MSG_CHECKING(for updated LDFLAGS) 264320d2c4d2Smrgif test -n "$LD_RPATH_OPT" ; then 264420d2c4d2Smrg AC_MSG_RESULT(maybe) 264520d2c4d2Smrg 264620d2c4d2Smrg AC_CHECK_PROGS(cf_ldd_prog,ldd,no) 264720d2c4d2Smrg cf_rpath_list="/usr/lib /lib" 264820d2c4d2Smrg if test "$cf_ldd_prog" != no 264920d2c4d2Smrg then 2650a1f3da82Smrg cf_rpath_oops= 2651a1f3da82Smrg 265220d2c4d2SmrgAC_TRY_LINK([#include <stdio.h>], 265320d2c4d2Smrg [printf("Hello");], 2654f2e35a3aSmrg [cf_rpath_oops=`"$cf_ldd_prog" "conftest$ac_exeext" | ${FGREP-fgrep} ' not found' | sed -e 's% =>.*$%%' |sort | uniq` 2655f2e35a3aSmrg cf_rpath_list=`"$cf_ldd_prog" "conftest$ac_exeext" | ${FGREP-fgrep} / | sed -e 's%^.*[[ ]]/%/%' -e 's%/[[^/]][[^/]]*$%%' |sort | uniq`]) 2656a1f3da82Smrg 2657a1f3da82Smrg # If we passed the link-test, but get a "not found" on a given library, 2658a1f3da82Smrg # this could be due to inept reconfiguration of gcc to make it only 2659a1f3da82Smrg # partly honor /usr/local/lib (or whatever). Sometimes this behavior 2660a1f3da82Smrg # is intentional, e.g., installing gcc in /usr/bin and suppressing the 2661a1f3da82Smrg # /usr/local libraries. 2662a1f3da82Smrg if test -n "$cf_rpath_oops" 2663a1f3da82Smrg then 2664a1f3da82Smrg for cf_rpath_src in $cf_rpath_oops 2665a1f3da82Smrg do 2666a1f3da82Smrg for cf_rpath_dir in \ 2667a1f3da82Smrg /usr/local \ 2668a1f3da82Smrg /usr/pkg \ 2669a1f3da82Smrg /opt/sfw 2670a1f3da82Smrg do 2671f2e35a3aSmrg if test -f "$cf_rpath_dir/lib/$cf_rpath_src" 2672a1f3da82Smrg then 2673a1f3da82Smrg CF_VERBOSE(...adding -L$cf_rpath_dir/lib to LDFLAGS for $cf_rpath_src) 2674a1f3da82Smrg LDFLAGS="$LDFLAGS -L$cf_rpath_dir/lib" 2675a1f3da82Smrg break 2676a1f3da82Smrg fi 2677a1f3da82Smrg done 2678a1f3da82Smrg done 2679a1f3da82Smrg fi 268020d2c4d2Smrg fi 268120d2c4d2Smrg 268220d2c4d2Smrg CF_VERBOSE(...checking EXTRA_LDFLAGS $EXTRA_LDFLAGS) 268320d2c4d2Smrg 268420d2c4d2Smrg CF_RPATH_HACK_2(LDFLAGS) 268520d2c4d2Smrg CF_RPATH_HACK_2(LIBS) 268620d2c4d2Smrg 268720d2c4d2Smrg CF_VERBOSE(...checked EXTRA_LDFLAGS $EXTRA_LDFLAGS) 2688e0a2b6dfSmrgelse 2689e0a2b6dfSmrg AC_MSG_RESULT(no) 269020d2c4d2Smrgfi 269120d2c4d2SmrgAC_SUBST(EXTRA_LDFLAGS) 269220d2c4d2Smrg])dnl 269320d2c4d2Smrgdnl --------------------------------------------------------------------------- 2694f2e35a3aSmrgdnl CF_RPATH_HACK_2 version: 8 updated: 2021/01/01 13:31:04 269520d2c4d2Smrgdnl --------------- 269620d2c4d2Smrgdnl Do one set of substitutions for CF_RPATH_HACK, adding an rpath option to 269720d2c4d2Smrgdnl EXTRA_LDFLAGS for each -L option found. 269820d2c4d2Smrgdnl 269920d2c4d2Smrgdnl $cf_rpath_list contains a list of directories to ignore. 270020d2c4d2Smrgdnl 270120d2c4d2Smrgdnl $1 = variable name to update. The LDFLAGS variable should be the only one, 270220d2c4d2Smrgdnl but LIBS often has misplaced -L options. 270320d2c4d2SmrgAC_DEFUN([CF_RPATH_HACK_2], 270420d2c4d2Smrg[ 270520d2c4d2SmrgCF_VERBOSE(...checking $1 [$]$1) 270620d2c4d2Smrg 270720d2c4d2Smrgcf_rpath_dst= 270820d2c4d2Smrgfor cf_rpath_src in [$]$1 270920d2c4d2Smrgdo 2710f2e35a3aSmrg case "$cf_rpath_src" in 271101037d57Smrg (-L*) 271220d2c4d2Smrg 271320d2c4d2Smrg # check if this refers to a directory which we will ignore 271420d2c4d2Smrg cf_rpath_skip=no 271520d2c4d2Smrg if test -n "$cf_rpath_list" 271620d2c4d2Smrg then 271720d2c4d2Smrg for cf_rpath_item in $cf_rpath_list 271820d2c4d2Smrg do 271920d2c4d2Smrg if test "x$cf_rpath_src" = "x-L$cf_rpath_item" 272020d2c4d2Smrg then 272120d2c4d2Smrg cf_rpath_skip=yes 272220d2c4d2Smrg break 272320d2c4d2Smrg fi 272420d2c4d2Smrg done 272520d2c4d2Smrg fi 272620d2c4d2Smrg 272720d2c4d2Smrg if test "$cf_rpath_skip" = no 272820d2c4d2Smrg then 272920d2c4d2Smrg # transform the option 273020d2c4d2Smrg if test "$LD_RPATH_OPT" = "-R " ; then 273120d2c4d2Smrg cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%-R %"` 273220d2c4d2Smrg else 273320d2c4d2Smrg cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%$LD_RPATH_OPT%"` 273420d2c4d2Smrg fi 273520d2c4d2Smrg 273620d2c4d2Smrg # if we have not already added this, add it now 273720d2c4d2Smrg cf_rpath_tst=`echo "$EXTRA_LDFLAGS" | sed -e "s%$cf_rpath_tmp %%"` 273820d2c4d2Smrg if test "x$cf_rpath_tst" = "x$EXTRA_LDFLAGS" 273920d2c4d2Smrg then 274020d2c4d2Smrg CF_VERBOSE(...Filter $cf_rpath_src ->$cf_rpath_tmp) 274120d2c4d2Smrg EXTRA_LDFLAGS="$cf_rpath_tmp $EXTRA_LDFLAGS" 274220d2c4d2Smrg fi 274320d2c4d2Smrg fi 274420d2c4d2Smrg ;; 274520d2c4d2Smrg esac 274620d2c4d2Smrg cf_rpath_dst="$cf_rpath_dst $cf_rpath_src" 274720d2c4d2Smrgdone 274820d2c4d2Smrg$1=$cf_rpath_dst 274920d2c4d2Smrg 275020d2c4d2SmrgCF_VERBOSE(...checked $1 [$]$1) 275120d2c4d2SmrgAC_SUBST(EXTRA_LDFLAGS) 2752d522f475Smrg])dnl 2753d522f475Smrgdnl --------------------------------------------------------------------------- 2754f2e35a3aSmrgdnl CF_SAVE_XTRA_FLAGS version: 1 updated: 2020/01/11 16:46:44 2755f2e35a3aSmrgdnl ------------------ 2756f2e35a3aSmrgdnl Use this macro to save CFLAGS/CPPFLAGS/LIBS before checks against X headers 2757f2e35a3aSmrgdnl and libraries which do not update those variables. 2758f2e35a3aSmrgdnl 2759f2e35a3aSmrgdnl $1 = name of current macro 2760f2e35a3aSmrgdefine([CF_SAVE_XTRA_FLAGS], 2761f2e35a3aSmrg[ 2762f2e35a3aSmrgcf_save_LIBS_$1="$LIBS" 2763f2e35a3aSmrgcf_save_CFLAGS_$1="$CFLAGS" 2764f2e35a3aSmrgcf_save_CPPFLAGS_$1="$CPPFLAGS" 2765f2e35a3aSmrgLIBS="$LIBS ${X_PRE_LIBS} ${X_LIBS} ${X_EXTRA_LIBS}" 2766f2e35a3aSmrgfor cf_X_CFLAGS in $X_CFLAGS 2767f2e35a3aSmrgdo 2768f2e35a3aSmrg case "x$cf_X_CFLAGS" in 2769f2e35a3aSmrg x-[[IUD]]*) 2770f2e35a3aSmrg CPPFLAGS="$CPPFLAGS $cf_X_CFLAGS" 2771f2e35a3aSmrg ;; 2772f2e35a3aSmrg *) 2773f2e35a3aSmrg CFLAGS="$CFLAGS $cf_X_CFLAGS" 2774f2e35a3aSmrg ;; 2775f2e35a3aSmrg esac 2776f2e35a3aSmrgdone 2777f2e35a3aSmrg])dnl 2778f2e35a3aSmrgdnl --------------------------------------------------------------------------- 27795307cd1aSmrgdnl CF_SETITIMER version: 1 updated: 2023/01/25 19:55:24 27805307cd1aSmrgdnl ------------ 27815307cd1aSmrgAC_DEFUN([CF_SETITIMER], 27825307cd1aSmrg[ 27835307cd1aSmrgAC_CACHE_CHECK(if setitimer is available,cf_cv_func_setitimer,[ 27845307cd1aSmrgAC_TRY_COMPILE([ 27855307cd1aSmrg$ac_includes_default 27865307cd1aSmrg#include <sys/time.h> 27875307cd1aSmrg],[ 27885307cd1aSmrg struct itimerval it; 27895307cd1aSmrg memset(&it, 0, sizeof(struct itimerval)); 27905307cd1aSmrg it.it_value.tv_sec = 1; 27915307cd1aSmrg setitimer(ITIMER_REAL, &it, NULL); 27925307cd1aSmrg], 27935307cd1aSmrg[cf_cv_func_setitimer=yes], 27945307cd1aSmrg[cf_cv_func_setitimer=no]) 27955307cd1aSmrg]) 27965307cd1aSmrgtest "$cf_cv_func_setitimer" != no && AC_DEFINE(HAVE_SETITIMER,1,[Define to 1 if setitimer is available]) 27975307cd1aSmrg])dnl 27985307cd1aSmrgdnl --------------------------------------------------------------------------- 27995307cd1aSmrgdnl CF_SIGWINCH version: 7 updated: 2023/02/18 17:41:25 2800d522f475Smrgdnl ----------- 2801d522f475Smrgdnl Use this macro after CF_XOPEN_SOURCE, but do not require it (not all 2802d522f475Smrgdnl programs need this test). 2803d522f475Smrgdnl 2804f2e35a3aSmrgdnl This is really a Mac OS X 10.4.3 workaround. Defining _POSIX_C_SOURCE 2805d522f475Smrgdnl forces SIGWINCH to be undefined (breaks xterm, ncurses). Oddly, the struct 2806d522f475Smrgdnl winsize declaration is left alone - we may revisit this if Apple choose to 2807d522f475Smrgdnl break that part of the interface as well. 2808d522f475SmrgAC_DEFUN([CF_SIGWINCH], 2809d522f475Smrg[ 2810d522f475SmrgAC_CACHE_CHECK(if SIGWINCH is defined,cf_cv_define_sigwinch,[ 2811d522f475Smrg AC_TRY_COMPILE([ 2812d522f475Smrg#include <sys/types.h> 2813d522f475Smrg#include <sys/signal.h> 2814f2e35a3aSmrg],[int x = SIGWINCH; (void)x], 2815d522f475Smrg [cf_cv_define_sigwinch=yes], 2816d522f475Smrg [AC_TRY_COMPILE([ 2817d522f475Smrg#undef _XOPEN_SOURCE 2818d522f475Smrg#undef _POSIX_SOURCE 2819d522f475Smrg#undef _POSIX_C_SOURCE 2820d522f475Smrg#include <sys/types.h> 2821d522f475Smrg#include <sys/signal.h> 2822f2e35a3aSmrg],[int x = SIGWINCH; (void)x], 2823d522f475Smrg [cf_cv_define_sigwinch=maybe], 2824d522f475Smrg [cf_cv_define_sigwinch=no]) 2825d522f475Smrg]) 2826d522f475Smrg]) 2827d522f475Smrg 2828d522f475Smrgif test "$cf_cv_define_sigwinch" = maybe ; then 2829d522f475SmrgAC_CACHE_CHECK(for actual SIGWINCH definition,cf_cv_fixup_sigwinch,[ 2830d522f475Smrgcf_cv_fixup_sigwinch=unknown 2831d522f475Smrgcf_sigwinch=32 2832f2e35a3aSmrgwhile test "$cf_sigwinch" != 1 2833d522f475Smrgdo 2834d522f475Smrg AC_TRY_COMPILE([ 2835d522f475Smrg#undef _XOPEN_SOURCE 2836d522f475Smrg#undef _POSIX_SOURCE 2837d522f475Smrg#undef _POSIX_C_SOURCE 2838d522f475Smrg#include <sys/types.h> 2839d522f475Smrg#include <sys/signal.h> 2840d522f475Smrg],[ 2841d522f475Smrg#if SIGWINCH != $cf_sigwinch 28425307cd1aSmrg#error SIGWINCH is not $cf_sigwinch 2843d522f475Smrg#endif 2844f2e35a3aSmrgint x = SIGWINCH; (void)x], 2845d522f475Smrg [cf_cv_fixup_sigwinch=$cf_sigwinch 2846d522f475Smrg break]) 2847d522f475Smrg 2848f2e35a3aSmrgcf_sigwinch="`expr "$cf_sigwinch" - 1`" 2849d522f475Smrgdone 2850d522f475Smrg]) 2851d522f475Smrg 2852d522f475Smrg if test "$cf_cv_fixup_sigwinch" != unknown ; then 2853d522f475Smrg CPPFLAGS="$CPPFLAGS -DSIGWINCH=$cf_cv_fixup_sigwinch" 2854d522f475Smrg fi 2855d522f475Smrgfi 2856d522f475Smrg])dnl 2857d522f475Smrgdnl --------------------------------------------------------------------------- 2858f2e35a3aSmrgdnl CF_SIG_ATOMIC_T version: 5 updated: 2020/03/10 18:53:47 2859d522f475Smrgdnl --------------- 2860f2e35a3aSmrgdnl signal handler, but there are some gcc dependencies in that recommendation. 2861d522f475Smrgdnl Try anyway. 2862d522f475SmrgAC_DEFUN([CF_SIG_ATOMIC_T], 2863d522f475Smrg[ 2864d522f475SmrgAC_MSG_CHECKING(for signal global datatype) 2865d522f475SmrgAC_CACHE_VAL(cf_cv_sig_atomic_t,[ 2866d522f475Smrg for cf_type in \ 2867d522f475Smrg "volatile sig_atomic_t" \ 2868d522f475Smrg "sig_atomic_t" \ 2869d522f475Smrg "int" 2870d522f475Smrg do 2871d522f475Smrg AC_TRY_COMPILE([ 2872d522f475Smrg#include <sys/types.h> 2873d522f475Smrg#include <signal.h> 2874d522f475Smrg#include <stdio.h> 2875d522f475Smrg 2876d522f475Smrgextern $cf_type x; 2877d522f475Smrg$cf_type x; 2878d522f475Smrgstatic void handler(int sig) 2879d522f475Smrg{ 2880f2e35a3aSmrg (void)sig; 2881d522f475Smrg x = 5; 2882d522f475Smrg}], 2883d522f475Smrg [signal(SIGINT, handler); 2884d522f475Smrg x = 1], 2885d522f475Smrg [cf_cv_sig_atomic_t=$cf_type], 2886d522f475Smrg [cf_cv_sig_atomic_t=no]) 2887d522f475Smrg test "$cf_cv_sig_atomic_t" != no && break 2888d522f475Smrg done 2889d522f475Smrg ]) 2890d522f475SmrgAC_MSG_RESULT($cf_cv_sig_atomic_t) 28910bd37d32Smrgtest "$cf_cv_sig_atomic_t" != no && AC_DEFINE_UNQUOTED(SIG_ATOMIC_T, $cf_cv_sig_atomic_t,[Define to signal global datatype]) 2892d522f475Smrg])dnl 2893d522f475Smrgdnl --------------------------------------------------------------------------- 28945307cd1aSmrgdnl CF_STRUCT_LASTLOG version: 4 updated: 2023/01/05 17:56:31 2895d522f475Smrgdnl ----------------- 2896d522f475Smrgdnl Check for header defining struct lastlog, ensure that its .ll_time member 2897d522f475Smrgdnl is compatible with time(). 2898d522f475SmrgAC_DEFUN([CF_STRUCT_LASTLOG], 2899d522f475Smrg[ 2900d522f475SmrgAC_CHECK_HEADERS(lastlog.h) 2901d522f475SmrgAC_CACHE_CHECK(for struct lastlog,cf_cv_struct_lastlog,[ 2902d522f475SmrgAC_TRY_RUN([ 29035307cd1aSmrg$ac_includes_default 29045307cd1aSmrg 2905d522f475Smrg#include <time.h> 2906d522f475Smrg#include <lastlog.h> 2907d522f475Smrg 2908f2e35a3aSmrgint main(void) 2909d522f475Smrg{ 2910d522f475Smrg struct lastlog data; 2911d522f475Smrg return (sizeof(data.ll_time) != sizeof(time_t)); 2912d522f475Smrg}],[ 2913d522f475Smrgcf_cv_struct_lastlog=yes],[ 2914d522f475Smrgcf_cv_struct_lastlog=no],[ 2915d522f475Smrgcf_cv_struct_lastlog=unknown])]) 2916d522f475Smrg 29170bd37d32Smrgtest $cf_cv_struct_lastlog != no && AC_DEFINE(USE_STRUCT_LASTLOG,1,[Define to 1 if we have struct lastlog]) 2918d522f475Smrg])dnl 2919d522f475Smrgdnl --------------------------------------------------------------------------- 292004b94745Smrgdnl CF_SVR4 version: 6 updated: 2023/12/01 17:22:50 2921d522f475Smrgdnl ------- 2922d522f475Smrgdnl Check if this is an SVR4 system. We need the definition for xterm 2923d522f475SmrgAC_DEFUN([CF_SVR4], 2924d522f475Smrg[ 2925d522f475SmrgAC_CHECK_LIB(elf, elf_begin,[ 2926d522f475SmrgAC_CACHE_CHECK(if this is an SVR4 system, cf_cv_svr4,[ 2927d522f475SmrgAC_TRY_COMPILE([ 29280bd37d32Smrg#if defined(__CYGWIN__) 292904b94745Smrg#error Cygwin is not SVr4 29300bd37d32Smrg#endif 2931d522f475Smrg#include <elf.h> 2932d522f475Smrg#include <sys/termio.h> 2933d522f475Smrg],[ 2934d522f475Smrgstatic struct termio d_tio; 2935d522f475Smrg d_tio.c_cc[VINTR] = 0; 2936d522f475Smrg d_tio.c_cc[VQUIT] = 0; 2937d522f475Smrg d_tio.c_cc[VERASE] = 0; 2938d522f475Smrg d_tio.c_cc[VKILL] = 0; 2939d522f475Smrg d_tio.c_cc[VEOF] = 0; 2940d522f475Smrg d_tio.c_cc[VEOL] = 0; 2941d522f475Smrg d_tio.c_cc[VMIN] = 0; 2942d522f475Smrg d_tio.c_cc[VTIME] = 0; 2943d522f475Smrg d_tio.c_cc[VLNEXT] = 0; 2944d522f475Smrg], 2945d522f475Smrg[cf_cv_svr4=yes], 2946d522f475Smrg[cf_cv_svr4=no]) 2947d522f475Smrg]) 2948d522f475Smrg]) 29490bd37d32Smrgtest "$cf_cv_svr4" = yes && AC_DEFINE(SVR4,1,[Define to 1 if this is an SVR4 system]) 2950d522f475Smrg])dnl 2951d522f475Smrgdnl --------------------------------------------------------------------------- 2952f2e35a3aSmrgdnl CF_SYSV version: 16 updated: 2020/01/11 16:46:44 2953d522f475Smrgdnl ------- 2954d522f475Smrgdnl Check if this is a SYSV platform, e.g., as used in <X11/Xos.h>, and whether 2955d522f475Smrgdnl defining it will be helpful. The following features are used to check: 2956d522f475Smrgdnl 2957d522f475Smrgdnl a) bona-fide SVSV doesn't use const for sys_errlist[]. Since this is a 2958d522f475Smrgdnl legacy (pre-ANSI) feature, const should not apply. Modern systems only 2959d522f475Smrgdnl declare strerror(). Xos.h declares the legacy form of str_errlist[], and 2960d522f475Smrgdnl a compile-time error will result from trying to assign to a const array. 2961d522f475Smrgdnl 2962d522f475Smrgdnl b) compile with headers that exist on SYSV hosts. 2963d522f475Smrgdnl 2964d522f475Smrgdnl c) compile with type definitions that differ on SYSV hosts from standard C. 2965d522f475SmrgAC_DEFUN([CF_SYSV], 2966d522f475Smrg[ 2967f2e35a3aSmrgAC_REQUIRE([AC_PATH_XTRA]) 2968f2e35a3aSmrg 2969f2e35a3aSmrgCF_SAVE_XTRA_FLAGS([CF_SYSV]) 2970f2e35a3aSmrg 2971d522f475SmrgAC_CHECK_HEADERS( \ 2972d522f475Smrgtermios.h \ 2973d522f475Smrgstdlib.h \ 2974d522f475SmrgX11/Intrinsic.h \ 2975d522f475Smrg) 2976d522f475Smrg 2977d522f475SmrgAC_REQUIRE([CF_SYS_ERRLIST]) 2978d522f475Smrg 2979d522f475SmrgAC_CACHE_CHECK(if we should define SYSV,cf_cv_sysv,[ 2980d522f475SmrgAC_TRY_COMPILE([ 2981d522f475Smrg#undef SYSV 2982d522f475Smrg#define SYSV 1 /* get Xos.h to declare sys_errlist[] */ 2983d522f475Smrg#ifdef HAVE_STDLIB_H 2984d522f475Smrg#include <stdlib.h> /* look for wchar_t */ 2985d522f475Smrg#endif 2986d522f475Smrg#ifdef HAVE_X11_INTRINSIC_H 2987d522f475Smrg#include <X11/Intrinsic.h> /* Intrinsic.h has other traps... */ 2988d522f475Smrg#endif 29890bd37d32Smrg#ifdef HAVE_TERMIOS_H /* needed for HPUX 10.20 */ 29900bd37d32Smrg#include <termios.h> 29910bd37d32Smrg#define STRUCT_TERMIOS struct termios 29920bd37d32Smrg#else 29930bd37d32Smrg#define STRUCT_TERMIOS struct termio 29940bd37d32Smrg#endif 2995d522f475Smrg#include <curses.h> 2996d522f475Smrg#include <term.h> /* eliminate most BSD hacks */ 2997d522f475Smrg#include <errno.h> /* declare sys_errlist on older systems */ 2998d522f475Smrg#include <sys/termio.h> /* eliminate most of the remaining ones */ 2999d522f475Smrg],[ 3000d522f475Smrgstatic STRUCT_TERMIOS d_tio; 3001d522f475Smrg d_tio.c_cc[VINTR] = 0; 3002d522f475Smrg d_tio.c_cc[VQUIT] = 0; 3003d522f475Smrg d_tio.c_cc[VERASE] = 0; 3004d522f475Smrg d_tio.c_cc[VKILL] = 0; 3005d522f475Smrg d_tio.c_cc[VEOF] = 0; 3006d522f475Smrg d_tio.c_cc[VEOL] = 0; 3007d522f475Smrg d_tio.c_cc[VMIN] = 0; 3008d522f475Smrg d_tio.c_cc[VTIME] = 0; 3009d522f475Smrg#if defined(HAVE_SYS_ERRLIST) && !defined(DECL_SYS_ERRLIST) 3010d522f475Smrgsys_errlist[0] = ""; /* Cygwin mis-declares this */ 3011d522f475Smrg#endif 3012d522f475Smrg], 3013d522f475Smrg[cf_cv_sysv=yes], 3014d522f475Smrg[cf_cv_sysv=no]) 3015d522f475Smrg]) 30160bd37d32Smrgtest "$cf_cv_sysv" = yes && AC_DEFINE(SYSV,1,[Define to 1 if this is an SYSV system]) 3017f2e35a3aSmrg 3018f2e35a3aSmrgCF_RESTORE_XTRA_FLAGS([CF_SYSV]) 3019d522f475Smrg])dnl 3020d522f475Smrgdnl --------------------------------------------------------------------------- 3021f2e35a3aSmrgdnl CF_SYSV_UTMP version: 7 updated: 2021/01/02 09:31:20 3022d522f475Smrgdnl ------------ 3023d522f475Smrgdnl Check if this is a SYSV flavor of UTMP 3024d522f475SmrgAC_DEFUN([CF_SYSV_UTMP], 3025d522f475Smrg[ 3026d522f475SmrgAC_CACHE_CHECK(if $cf_cv_have_utmp is SYSV flavor,cf_cv_sysv_utmp,[ 3027d522f475Smrgtest "$cf_cv_have_utmp" = "utmp" && cf_prefix="ut" || cf_prefix="utx" 3028d522f475SmrgAC_TRY_LINK([ 3029d522f475Smrg#include <sys/types.h> 3030d522f475Smrg#include <${cf_cv_have_utmp}.h>],[ 3031d522f475Smrgstruct $cf_cv_have_utmp x; 3032d522f475Smrg set${cf_prefix}ent (); 3033d522f475Smrg get${cf_prefix}id(&x); 3034d522f475Smrg put${cf_prefix}line(&x); 3035d522f475Smrg end${cf_prefix}ent();], 3036d522f475Smrg [cf_cv_sysv_utmp=yes], 3037d522f475Smrg [cf_cv_sysv_utmp=no]) 3038d522f475Smrg]) 3039f2e35a3aSmrgtest "$cf_cv_sysv_utmp" = yes && AC_DEFINE(USE_SYSV_UTMP,1,[Define to 1 if utmp is SYSV flavor]) 3040d522f475Smrg])dnl 3041d522f475Smrgdnl --------------------------------------------------------------------------- 3042d522f475Smrgdnl CF_SYS_ERRLIST version: 6 updated: 2001/12/30 13:03:23 3043d522f475Smrgdnl -------------- 3044d522f475Smrgdnl Check for declaration of sys_nerr and sys_errlist in one of stdio.h and 3045d522f475Smrgdnl errno.h. Declaration of sys_errlist on BSD4.4 interferes with our 3046d522f475Smrgdnl declaration. Reported by Keith Bostic. 3047d522f475SmrgAC_DEFUN([CF_SYS_ERRLIST], 3048d522f475Smrg[ 3049d522f475Smrg CF_CHECK_ERRNO(sys_nerr) 3050d522f475Smrg CF_CHECK_ERRNO(sys_errlist) 3051d522f475Smrg])dnl 3052d522f475Smrgdnl --------------------------------------------------------------------------- 3053f2e35a3aSmrgdnl CF_TERMIOS_TYPES version: 2 updated: 2020/03/10 18:53:47 3054f2e35a3aSmrgdnl ---------------- 3055f2e35a3aSmrgdnl https://pubs.opengroup.org/onlinepubs/009695399/basedefs/termios.h.html 3056f2e35a3aSmrgdnl says that tcflag_t, speed_t and cc_t are typedef'd. If they are not, 3057f2e35a3aSmrgdnl fallback to historical values. 3058f2e35a3aSmrgAC_DEFUN([CF_TERMIOS_TYPES],[ 3059f2e35a3aSmrg 3060f2e35a3aSmrgAC_CACHE_CHECK(for termios type tcflag_t, cf_cv_havetype_tcflag_t,[ 3061f2e35a3aSmrg AC_TRY_COMPILE([#include <termios.h>],[ 3062f2e35a3aSmrg tcflag_t x = 0; (void)x], 3063f2e35a3aSmrg [cf_cv_havetype_tcflag_t=yes], 3064f2e35a3aSmrg [cf_cv_havetype_tcflag_t=no]) 3065f2e35a3aSmrg]) 3066f2e35a3aSmrgtest "$cf_cv_havetype_tcflag_t" = no && AC_DEFINE(tcflag_t,unsigned long,[Define usable value of tcflag_t if not declared]) 3067f2e35a3aSmrg 3068f2e35a3aSmrgAC_CACHE_CHECK(for termios type speed_t, cf_cv_havetype_speed_t,[ 3069f2e35a3aSmrg AC_TRY_COMPILE([#include <termios.h>],[ 3070f2e35a3aSmrg speed_t x = 0; (void)x], 3071f2e35a3aSmrg [cf_cv_havetype_speed_t=yes], 3072f2e35a3aSmrg [cf_cv_havetype_speed_t=no]) 3073f2e35a3aSmrg]) 3074f2e35a3aSmrgtest "$cf_cv_havetype_speed_t" = no && AC_DEFINE(speed_t,unsigned short,[Define usable value of speed_t if not declared]) 3075f2e35a3aSmrg 3076f2e35a3aSmrgAC_CACHE_CHECK(for termios type cc_t, cf_cv_havetype_cc_t,[ 3077f2e35a3aSmrg AC_TRY_COMPILE([#include <termios.h>],[ 3078f2e35a3aSmrg cc_t x = 0; (void)x], 3079f2e35a3aSmrg [cf_cv_havetype_cc_t=yes], 3080f2e35a3aSmrg [cf_cv_havetype_cc_t=no]) 3081f2e35a3aSmrg]) 3082f2e35a3aSmrgtest "$cf_cv_havetype_cc_t" = no && AC_DEFINE(cc_t,unsigned char,[Define usable value of cc_t if not declared]) 3083f2e35a3aSmrg])dnl 3084f2e35a3aSmrgdnl --------------------------------------------------------------------------- 3085f2e35a3aSmrgdnl CF_TERMIO_C_ISPEED version: 4 updated: 2020/03/10 18:53:47 3086d522f475Smrgdnl ------------------ 3087d522f475Smrgdnl Check for SGI's broken redefinition of baud rates introduced in IRIX 6.5 3088d522f475Smrgdnl (there doesn't appear to be a useful predefined symbol). 3089d522f475SmrgAC_DEFUN([CF_TERMIO_C_ISPEED], 3090d522f475Smrg[ 3091d522f475SmrgAC_CACHE_CHECK(for IRIX 6.5 baud-rate redefinitions,cf_cv_termio_c_ispeed,[ 3092d522f475SmrgAC_TRY_COMPILE([ 3093d522f475Smrg#include <sys/types.h> 3094d522f475Smrg#include <sys/termio.h>],[ 3095d522f475Smrgstruct termio foo; 3096d522f475Smrgfoo.c_ispeed = B38400; 3097d522f475Smrgfoo.c_ospeed = B9600; 3098f2e35a3aSmrg(void)foo; 3099d522f475Smrg],[cf_cv_termio_c_ispeed=yes 3100d522f475Smrg],[cf_cv_termio_c_ispeed=no]) 3101d522f475Smrg]) 31020bd37d32Smrgtest "$cf_cv_termio_c_ispeed" = yes && AC_DEFINE(HAVE_TERMIO_C_ISPEED,1,[define 1 if we have IRIX 6.5 baud-rate redefinitions]) 3103d522f475Smrg])dnl 3104d522f475Smrgdnl --------------------------------------------------------------------------- 310501037d57Smrgdnl CF_TRIM_X_LIBS version: 3 updated: 2015/04/12 15:39:00 3106e0a2b6dfSmrgdnl -------------- 3107e0a2b6dfSmrgdnl Trim extra base X libraries added as a workaround for inconsistent library 3108e0a2b6dfSmrgdnl dependencies returned by "new" pkg-config files. 3109e0a2b6dfSmrgAC_DEFUN([CF_TRIM_X_LIBS],[ 3110e0a2b6dfSmrg for cf_trim_lib in Xmu Xt X11 3111e0a2b6dfSmrg do 3112e0a2b6dfSmrg case "$LIBS" in 311301037d57Smrg (*-l$cf_trim_lib\ *-l$cf_trim_lib*) 3114e0a2b6dfSmrg LIBS=`echo "$LIBS " | sed -e 's/ / /g' -e 's%-l'"$cf_trim_lib"' %%' -e 's/ $//'` 3115e0a2b6dfSmrg CF_VERBOSE(..trimmed $LIBS) 3116e0a2b6dfSmrg ;; 3117e0a2b6dfSmrg esac 3118e0a2b6dfSmrg done 3119e0a2b6dfSmrg]) 3120e0a2b6dfSmrgdnl --------------------------------------------------------------------------- 3121f2e35a3aSmrgdnl CF_TRY_PKG_CONFIG version: 6 updated: 2020/12/31 10:54:15 312220d2c4d2Smrgdnl ----------------- 312320d2c4d2Smrgdnl This is a simple wrapper to use for pkg-config, for libraries which may be 312420d2c4d2Smrgdnl available in that form. 312520d2c4d2Smrgdnl 3126f2e35a3aSmrgdnl $1 = package name, which may be a shell variable 312720d2c4d2Smrgdnl $2 = extra logic to use, if any, after updating CFLAGS and LIBS 312820d2c4d2Smrgdnl $3 = logic to use if pkg-config does not have the package 312920d2c4d2SmrgAC_DEFUN([CF_TRY_PKG_CONFIG],[ 313020d2c4d2SmrgAC_REQUIRE([CF_PKG_CONFIG]) 313120d2c4d2Smrg 3132f2e35a3aSmrgif test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists "$1"; then 313320d2c4d2Smrg CF_VERBOSE(found package $1) 3134f2e35a3aSmrg cf_pkgconfig_incs="`$PKG_CONFIG --cflags "$1" 2>/dev/null`" 3135f2e35a3aSmrg cf_pkgconfig_libs="`$PKG_CONFIG --libs "$1" 2>/dev/null`" 313620d2c4d2Smrg CF_VERBOSE(package $1 CFLAGS: $cf_pkgconfig_incs) 313720d2c4d2Smrg CF_VERBOSE(package $1 LIBS: $cf_pkgconfig_libs) 313820d2c4d2Smrg CF_ADD_CFLAGS($cf_pkgconfig_incs) 313920d2c4d2Smrg CF_ADD_LIBS($cf_pkgconfig_libs) 314020d2c4d2Smrg ifelse([$2],,:,[$2]) 314120d2c4d2Smrgelse 3142e0a2b6dfSmrg cf_pkgconfig_incs= 3143e0a2b6dfSmrg cf_pkgconfig_libs= 314420d2c4d2Smrg ifelse([$3],,:,[$3]) 314520d2c4d2Smrgfi 314620d2c4d2Smrg]) 314720d2c4d2Smrgdnl --------------------------------------------------------------------------- 31485307cd1aSmrgdnl CF_TRY_XOPEN_SOURCE version: 4 updated: 2022/09/10 15:16:16 31490bd37d32Smrgdnl ------------------- 31500bd37d32Smrgdnl If _XOPEN_SOURCE is not defined in the compile environment, check if we 31510bd37d32Smrgdnl can define it successfully. 31520bd37d32SmrgAC_DEFUN([CF_TRY_XOPEN_SOURCE],[ 31530bd37d32SmrgAC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[ 31545307cd1aSmrg AC_TRY_COMPILE(CF__XOPEN_SOURCE_HEAD,CF__XOPEN_SOURCE_BODY, 31550bd37d32Smrg [cf_cv_xopen_source=no], 31560bd37d32Smrg [cf_save="$CPPFLAGS" 3157f2e35a3aSmrg CF_APPEND_TEXT(CPPFLAGS,-D_XOPEN_SOURCE=$cf_XOPEN_SOURCE) 31585307cd1aSmrg AC_TRY_COMPILE(CF__XOPEN_SOURCE_HEAD,CF__XOPEN_SOURCE_BODY, 31595307cd1aSmrg [cf_cv_xopen_source=no], 31605307cd1aSmrg [cf_cv_xopen_source=$cf_XOPEN_SOURCE]) 31615307cd1aSmrg CPPFLAGS="$cf_save" 31620bd37d32Smrg ]) 31630bd37d32Smrg]) 31640bd37d32Smrg 31650bd37d32Smrgif test "$cf_cv_xopen_source" != no ; then 31660bd37d32Smrg CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE) 31670bd37d32Smrg CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE) 31680bd37d32Smrg cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source" 3169a5ae21e4Smrg CF_APPEND_CFLAGS($cf_temp_xopen_source) 31700bd37d32Smrgfi 31710bd37d32Smrg]) 31720bd37d32Smrgdnl --------------------------------------------------------------------------- 317304b94745Smrgdnl CF_TTY_GROUP version: 17 updated: 2023/12/01 17:22:50 3174d522f475Smrgdnl ------------ 3175d522f475Smrgdnl Check if the system has a tty-group defined. This is used in xterm when 3176d522f475Smrgdnl setting pty ownership. 3177f2e35a3aSmrgdnl 3178f2e35a3aSmrgdnl The check relies upon running a test-program, which calls ttyname. If this 3179f2e35a3aSmrgdnl is run in batch mode, or if autoconf uses shell functions, the extra layer 3180f2e35a3aSmrgdnl of eval/call may close stdin, making calls to ttyname fail. To work around 3181f2e35a3aSmrgdnl that, fall back to "/dev/tty". 3182d522f475SmrgAC_DEFUN([CF_TTY_GROUP], 3183f2e35a3aSmrg[AC_REQUIRE([AC_PROG_EGREP])dnl 3184d522f475SmrgAC_MSG_CHECKING(for explicit tty group name) 3185d522f475SmrgAC_ARG_WITH(tty-group, 318604b94745Smrg [[ --with-tty-group[=XXX] use XXX for the tty-group]], 3187d522f475Smrg [cf_tty_group=$withval], 3188d522f475Smrg [cf_tty_group=auto...]) 3189d522f475Smrgtest -z "$cf_tty_group" && cf_tty_group=auto... 3190d522f475Smrgtest "$cf_tty_group" = yes && cf_tty_group=auto... 3191d522f475SmrgAC_MSG_RESULT($cf_tty_group) 3192d522f475Smrg 3193d522f475Smrgif test "$cf_tty_group" = "auto..." ; then 3194d522f475SmrgAC_CACHE_CHECK(for tty group name,cf_cv_tty_group_name,[ 3195d522f475Smrg 3196d522f475Smrg# If we are configuring as root, it is hard to get a clue about the tty group. 3197d522f475Smrg# But we'll guess based on how our connection is set up - assuming it is done 3198d522f475Smrg# properly. 3199d522f475Smrg 3200f2e35a3aSmrgcf_uid="`id | sed -e 's/^[^=]*=//' -e 's/(.*$//'`" 3201d522f475Smrg# )vi 3202d522f475Smrgif test "$cf_uid" != 0 ; then 3203d522f475Smrgcf_cv_tty_group_name= 3204f2e35a3aSmrgcf_tty_name="`tty`" 3205d522f475Smrgtest "$cf_tty_name" = "not a tty" && cf_tty_name=/dev/tty 3206d522f475Smrgtest -z "$cf_tty_name" && cf_tty_name=/dev/tty 3207d522f475Smrgif test -c "$cf_tty_name" 3208d522f475Smrgthen 3209f2e35a3aSmrg cf_option="-lL" 3210d522f475Smrg 3211d522f475Smrg # Expect listing to have fields like this: 3212d522f475Smrg #-rwxrwxrwx 1 user group 34293 Jul 18 16:29 pathname 3213f2e35a3aSmrg ls $cf_option "$cf_tty_name" >conftest.out 3214d522f475Smrg read cf_mode cf_links cf_usr cf_grp cf_size cf_date1 cf_date2 cf_date3 cf_rest <conftest.out 3215d522f475Smrg if test -z "$cf_rest" ; then 3216f2e35a3aSmrg cf_option="${cf_option}g" 3217f2e35a3aSmrg ls "$cf_option" "$cf_tty_name" >conftest.out 3218d522f475Smrg read cf_mode cf_links cf_usr cf_grp cf_size cf_date1 cf_date2 cf_date3 cf_rest <conftest.out 3219d522f475Smrg fi 3220d522f475Smrg rm -f conftest.out 3221d522f475Smrg cf_cv_tty_group_name=$cf_grp 3222d522f475Smrgfi 3223d522f475Smrgfi 3224d522f475Smrg 3225d522f475Smrg# If we cannot deduce the tty group, fall back on hardcoded cases 3226d522f475Smrg 3227d522f475Smrgif test -z "$cf_cv_tty_group_name" 3228d522f475Smrgthen 322901037d57Smrgcase $host_os in 323001037d57Smrg(osf*) 3231d522f475Smrg cf_cv_tty_group_name="terminal" 3232d522f475Smrg ;; 323301037d57Smrg(*) 3234d522f475Smrg cf_cv_tty_group_name="unknown" 3235f2e35a3aSmrg if ( ${EGREP-egrep} '^tty:' /etc/group 2>/dev/null 1>/dev/null ) then 3236d522f475Smrg cf_cv_tty_group_name="tty" 3237d522f475Smrg fi 3238d522f475Smrg ;; 3239d522f475Smrgesac 3240d522f475Smrgfi 3241d522f475Smrg]) 3242d522f475Smrgcf_tty_group="$cf_cv_tty_group_name" 3243d522f475Smrgelse 3244d522f475Smrg # if configure option, always do this 32450bd37d32Smrg AC_DEFINE(USE_TTY_GROUP,1,[Define to 1 if we have a tty groupname]) 3246d522f475Smrgfi 3247d522f475Smrg 32480bd37d32SmrgAC_DEFINE_UNQUOTED(TTY_GROUP_NAME,"$cf_tty_group",[Define to the name use for tty group]) 3249d522f475Smrg 3250d522f475Smrg# This is only a double-check that the group-name we obtained above really 3251d522f475Smrg# does apply to the device. We cannot perform this test if we are in batch 3252d522f475Smrg# mode, or if we are cross-compiling. 3253d522f475Smrg 3254d522f475SmrgAC_CACHE_CHECK(if we may use the $cf_tty_group group,cf_cv_tty_group,[ 3255f2e35a3aSmrgcf_tty_name="`tty`" 3256d522f475Smrgif test "$cf_tty_name" != "not a tty" 3257d522f475Smrgthen 3258d522f475SmrgAC_TRY_RUN([ 32595307cd1aSmrg$ac_includes_default 32605307cd1aSmrg 3261d522f475Smrg#include <grp.h> 32625307cd1aSmrg 3263f2e35a3aSmrgint main(void) 3264d522f475Smrg{ 326504b94745Smrg static char default_tty[] = "/dev/tty"; 3266d522f475Smrg struct stat sb; 3267f2e35a3aSmrg struct group *ttygrp; 3268f2e35a3aSmrg int fd; 3269f2e35a3aSmrg char *name; 3270d522f475Smrg 3271f2e35a3aSmrg for (fd = 0; fd < 3; ++fd) { 3272f2e35a3aSmrg if ((name = ttyname(fd)) != 0) 3273f2e35a3aSmrg break; 3274f2e35a3aSmrg } 3275f2e35a3aSmrg if (name == 0) 327604b94745Smrg name = default_tty; 3277f2e35a3aSmrg 3278f2e35a3aSmrg ttygrp = getgrnam(TTY_GROUP_NAME); 3279d522f475Smrg endgrent(); 3280f2e35a3aSmrg 3281d522f475Smrg if (ttygrp != 0 3282d522f475Smrg && name != 0 3283d522f475Smrg && stat(name, &sb) == 0 3284d522f475Smrg && sb.st_gid != getgid() 3285d522f475Smrg && sb.st_gid == ttygrp->gr_gid) { 3286d522f475Smrg ${cf_cv_main_return:-return} (0); 3287d522f475Smrg } 3288d522f475Smrg ${cf_cv_main_return:-return} (1); 3289d522f475Smrg} 3290d522f475Smrg ], 3291d522f475Smrg [cf_cv_tty_group=yes], 3292d522f475Smrg [cf_cv_tty_group=no], 3293d522f475Smrg [cf_cv_tty_group=unknown]) 3294d522f475Smrgelif test "$cross_compiling" = yes; then 3295d522f475Smrg cf_cv_tty_group=unknown 3296d522f475Smrgelse 3297d522f475Smrg cf_cv_tty_group=yes 3298d522f475Smrgfi 3299d522f475Smrg]) 3300d522f475Smrg 3301d522f475Smrgif test $cf_cv_tty_group = no ; then 3302d522f475Smrg AC_MSG_WARN(Cannot use $cf_tty_group group) 3303d522f475Smrgelse 3304d522f475Smrg AC_DEFINE(USE_TTY_GROUP) 3305d522f475Smrgfi 3306d522f475Smrg])dnl 3307d522f475Smrgdnl --------------------------------------------------------------------------- 3308f2e35a3aSmrgdnl CF_TYPE_CC_T version: 3 updated: 2020/03/10 18:53:47 33090bd37d32Smrgdnl ------------ 33100bd37d32Smrgdnl Check for cc_t type, used in termio. 33110bd37d32SmrgAC_DEFUN([CF_TYPE_CC_T], 33120bd37d32Smrg[ 33130bd37d32SmrgAC_MSG_CHECKING(for cc_t in <termios.h> or <termio.h>) 33140bd37d32SmrgAC_CACHE_VAL(cf_cv_type_cc_t,[ 33150bd37d32Smrg AC_TRY_COMPILE([ 33160bd37d32Smrg#include <sys/types.h> 33170bd37d32Smrg#if defined(HAVE_TERMIOS_H) 33180bd37d32Smrg#include <termios.h> 33190bd37d32Smrg#else 33200bd37d32Smrg#include <termio.h> 33210bd37d32Smrg#include <sys/ioctl.h> 33220bd37d32Smrg#endif 33230bd37d32Smrg], 3324f2e35a3aSmrg [cc_t x; (void)x], 33250bd37d32Smrg [cf_cv_type_cc_t=yes], 33260bd37d32Smrg [cf_cv_type_cc_t=no]) 33270bd37d32Smrg ]) 33280bd37d32SmrgAC_MSG_RESULT($cf_cv_type_cc_t) 33290bd37d32Smrgtest $cf_cv_type_cc_t = no && AC_DEFINE(cc_t, unsigned char,[Define to cc_t type used in termio]) 33300bd37d32Smrg])dnl 33310bd37d32Smrgdnl --------------------------------------------------------------------------- 33320bd37d32Smrgdnl CF_TYPE_FD_MASK version: 3 updated: 2012/10/04 06:57:36 3333d522f475Smrgdnl --------------- 3334d522f475Smrgdnl Check for the declaration of fd_mask, which is like fd_set, associated 3335d522f475Smrgdnl with select(). The check for fd_set should have pulled in this as well, 3336d522f475Smrgdnl but there is a special case for Mac OS X, possibly other BSD-derived 3337d522f475Smrgdnl platforms. 3338d522f475SmrgAC_DEFUN([CF_TYPE_FD_MASK], 3339d522f475Smrg[ 3340d522f475SmrgAC_REQUIRE([CF_TYPE_FD_SET]) 3341d522f475Smrg 3342d522f475SmrgAC_CACHE_CHECK(for declaration of fd_mask,cf_cv_type_fd_mask,[ 3343d522f475Smrg if test x$cf_cv_type_fd_set = xX11/Xpoll.h ; then 3344d522f475Smrg AC_TRY_COMPILE([ 3345d522f475Smrg#include <X11/Xpoll.h>],[fd_mask x],, 3346d522f475Smrg [CF_MSG_LOG(if we must define CSRG_BASED) 3347d522f475Smrg# Xosdefs.h on Mac OS X may not define this (but it should). 3348d522f475Smrg AC_TRY_COMPILE([ 3349d522f475Smrg#define CSRG_BASED 3350d522f475Smrg#include <X11/Xpoll.h>],[fd_mask x], 3351d522f475Smrg cf_cv_type_fd_mask=CSRG_BASED)]) 3352d522f475Smrg else 3353d522f475Smrg cf_cv_type_fd_mask=$cf_cv_type_fd_set 3354d522f475Smrg fi 3355d522f475Smrg]) 3356d522f475Smrgif test x$cf_cv_type_fd_mask = xCSRG_BASED ; then 33570bd37d32Smrg AC_DEFINE(CSRG_BASED,1,[Define to 1 if needed for declaring fd_mask()]) 3358d522f475Smrgfi 3359d522f475Smrg])dnl 3360d522f475Smrgdnl --------------------------------------------------------------------------- 3361f2e35a3aSmrgdnl CF_TYPE_FD_SET version: 6 updated: 2020/03/10 18:53:47 3362d522f475Smrgdnl -------------- 3363d522f475Smrgdnl Check for the declaration of fd_set. Some platforms declare it in 3364d522f475Smrgdnl <sys/types.h>, and some in <sys/select.h>, which requires <sys/types.h>. 3365d522f475Smrgdnl Finally, if we are using this for an X application, Xpoll.h may include 3366d522f475Smrgdnl <sys/select.h>, so we don't want to do it twice. 3367d522f475SmrgAC_DEFUN([CF_TYPE_FD_SET], 3368d522f475Smrg[ 3369d522f475SmrgAC_CHECK_HEADERS(X11/Xpoll.h) 3370d522f475Smrg 3371d522f475SmrgAC_CACHE_CHECK(for declaration of fd_set,cf_cv_type_fd_set, 3372d522f475Smrg [CF_MSG_LOG(sys/types alone) 3373d522f475SmrgAC_TRY_COMPILE([ 3374d522f475Smrg#include <sys/types.h>], 3375f2e35a3aSmrg [fd_set x; (void)x], 3376d522f475Smrg [cf_cv_type_fd_set=sys/types.h], 3377d522f475Smrg [CF_MSG_LOG(X11/Xpoll.h) 3378d522f475SmrgAC_TRY_COMPILE([ 3379d522f475Smrg#ifdef HAVE_X11_XPOLL_H 3380d522f475Smrg#include <X11/Xpoll.h> 3381d522f475Smrg#endif], 3382f2e35a3aSmrg [fd_set x; (void)x], 3383d522f475Smrg [cf_cv_type_fd_set=X11/Xpoll.h], 3384d522f475Smrg [CF_MSG_LOG(sys/select.h) 3385d522f475SmrgAC_TRY_COMPILE([ 3386d522f475Smrg#include <sys/types.h> 3387d522f475Smrg#include <sys/select.h>], 3388f2e35a3aSmrg [fd_set x; (void)x], 3389d522f475Smrg [cf_cv_type_fd_set=sys/select.h], 3390d522f475Smrg [cf_cv_type_fd_set=unknown])])])]) 3391d522f475Smrgif test $cf_cv_type_fd_set = sys/select.h ; then 33920bd37d32Smrg AC_DEFINE(USE_SYS_SELECT_H,1,[Define to 1 to include sys/select.h to declare fd_set]) 3393d522f475Smrgfi 3394d522f475Smrg]) 3395d522f475Smrgdnl --------------------------------------------------------------------------- 33965307cd1aSmrgdnl CF_TYPE_NFDS_T version: 1 updated: 2023/02/26 20:20:10 33975307cd1aSmrgdnl -------------- 33985307cd1aSmrgdnl Check for nfds_t type, used in poll. 33995307cd1aSmrgAC_DEFUN([CF_TYPE_NFDS_T], 34005307cd1aSmrg[ 34015307cd1aSmrgAC_MSG_CHECKING(for nfds_t in <poll.h>) 34025307cd1aSmrgAC_CACHE_VAL(cf_cv_type_nfds_t,[ 34035307cd1aSmrg AC_TRY_COMPILE([ 34045307cd1aSmrg$ac_includes_default 34055307cd1aSmrg#include <poll.h> 34065307cd1aSmrg], 34075307cd1aSmrg [nfds_t x; (void)x], 34085307cd1aSmrg [cf_cv_type_nfds_t=yes], 34095307cd1aSmrg [cf_cv_type_nfds_t=no]) 34105307cd1aSmrg ]) 34115307cd1aSmrgAC_MSG_RESULT($cf_cv_type_nfds_t) 34125307cd1aSmrgtest $cf_cv_type_nfds_t = no && AC_DEFINE(nfds_t, unsigned,[Define to nfds_t type used in poll]) 34135307cd1aSmrg])dnl 34145307cd1aSmrgdnl --------------------------------------------------------------------------- 3415e39b573cSmrgdnl CF_UNDO_CFLAGS version: 1 updated: 2011/07/02 09:27:51 3416e39b573cSmrgdnl -------------- 3417e39b573cSmrgdnl Remove flags from $CFLAGS or similar shell variable using sed. 3418e39b573cSmrgdnl $1 = variable 3419e39b573cSmrgdnl $2 = message 3420e39b573cSmrgdnl $3 = pattern to remove 3421e39b573cSmrgAC_DEFUN([CF_UNDO_CFLAGS], 3422e39b573cSmrg[ 3423e39b573cSmrg CF_VERBOSE(removing $2 flags from $1) 3424e39b573cSmrg $1=`echo "[$]$1" | sed -e 's/$3//'` 3425e39b573cSmrg CF_VERBOSE(...result [$]$1) 3426e39b573cSmrg])dnl 3427e39b573cSmrgdnl --------------------------------------------------------------------------- 3428d522f475Smrgdnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59 3429d522f475Smrgdnl -------- 3430d522f475Smrgdnl Make an uppercase version of a variable 3431d522f475Smrgdnl $1=uppercase($2) 3432d522f475SmrgAC_DEFUN([CF_UPPER], 3433d522f475Smrg[ 3434d522f475Smrg$1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` 3435d522f475Smrg])dnl 3436d522f475Smrgdnl --------------------------------------------------------------------------- 34370bd37d32Smrgdnl CF_UTEMPTER version: 4 updated: 2012/10/04 20:12:20 3438d522f475Smrgdnl ----------- 3439d522f475Smrgdnl Try to link with utempter library 3440d522f475SmrgAC_DEFUN([CF_UTEMPTER], 3441d522f475Smrg[ 3442d522f475SmrgAC_CACHE_CHECK(if we can link with utempter library,cf_cv_have_utempter,[ 3443d522f475Smrgcf_save_LIBS="$LIBS" 344420d2c4d2SmrgCF_ADD_LIB(utempter) 3445d522f475SmrgAC_TRY_LINK([ 3446d522f475Smrg#include <utempter.h> 3447d522f475Smrg],[ 3448d522f475Smrg addToUtmp("/dev/tty", 0, 1); 3449d522f475Smrg removeFromUtmp(); 3450d522f475Smrg],[ 3451d522f475Smrg cf_cv_have_utempter=yes],[ 3452d522f475Smrg cf_cv_have_utempter=no]) 3453d522f475SmrgLIBS="$cf_save_LIBS" 3454d522f475Smrg]) 3455d522f475Smrgif test "$cf_cv_have_utempter" = yes ; then 34560bd37d32Smrg AC_DEFINE(USE_UTEMPTER,1,[Define to 1 if we can/should link with utempter]) 345720d2c4d2Smrg CF_ADD_LIB(utempter) 3458d522f475Smrgfi 3459d522f475Smrg])dnl 3460d522f475Smrgdnl --------------------------------------------------------------------------- 3461f2e35a3aSmrgdnl CF_UTMP version: 12 updated: 2021/01/02 09:31:20 3462d522f475Smrgdnl ------- 3463d522f475Smrgdnl Check for UTMP/UTMPX headers 3464d522f475SmrgAC_DEFUN([CF_UTMP], 3465d522f475Smrg[ 3466d522f475SmrgAC_REQUIRE([CF_LASTLOG]) 3467d522f475Smrg 3468d522f475SmrgAC_CACHE_CHECK(for utmp implementation,cf_cv_have_utmp,[ 3469d522f475Smrg cf_cv_have_utmp=no 3470d522f475Smrgfor cf_header in utmpx utmp ; do 3471d522f475Smrgcf_utmp_includes=" 3472d522f475Smrg#include <sys/types.h> 3473d522f475Smrg#include <${cf_header}.h> 3474d522f475Smrg#define getutent getutxent 3475d522f475Smrg#ifdef USE_LASTLOG 3476d522f475Smrg#include <lastlog.h> /* may conflict with utmpx.h on Linux */ 3477d522f475Smrg#endif 3478d522f475Smrg" 3479d522f475Smrg AC_TRY_COMPILE([$cf_utmp_includes], 3480d522f475Smrg [struct $cf_header x; 3481d522f475Smrg char *name = x.ut_name; /* utmp.h and compatible definitions */ 3482f2e35a3aSmrg (void)x; 3483f2e35a3aSmrg (void)name; 3484d522f475Smrg ], 3485d522f475Smrg [cf_cv_have_utmp=$cf_header 3486d522f475Smrg break], 3487d522f475Smrg [ 3488d522f475Smrg AC_TRY_COMPILE([$cf_utmp_includes], 3489d522f475Smrg [struct $cf_header x; 3490d522f475Smrg char *name = x.ut_user; /* utmpx.h must declare this */ 3491f2e35a3aSmrg (void)x; 3492f2e35a3aSmrg (void)name; 3493d522f475Smrg ], 3494d522f475Smrg [cf_cv_have_utmp=$cf_header 3495d522f475Smrg break 3496d522f475Smrg ])]) 3497d522f475Smrgdone 3498d522f475Smrg]) 3499d522f475Smrg 3500f2e35a3aSmrgif test "$cf_cv_have_utmp" != no ; then 35010bd37d32Smrg AC_DEFINE(HAVE_UTMP,1,[Define to 1 if the utmp interface is available]) 3502f2e35a3aSmrg test "$cf_cv_have_utmp" = utmpx && AC_DEFINE(UTMPX_FOR_UTMP,1,[Define if we have utmpx interface]) 3503d522f475Smrg CF_UTMP_UT_HOST 3504d522f475Smrg CF_UTMP_UT_SYSLEN 3505d522f475Smrg CF_UTMP_UT_NAME 3506d522f475Smrg CF_UTMP_UT_XSTATUS 3507d522f475Smrg CF_UTMP_UT_XTIME 3508d522f475Smrg CF_UTMP_UT_SESSION 3509d522f475Smrg CF_SYSV_UTMP 3510d522f475Smrgfi 3511d522f475Smrg])dnl 3512d522f475Smrgdnl --------------------------------------------------------------------------- 3513f2e35a3aSmrgdnl CF_UTMP_GROUP version: 2 updated: 2020/12/31 10:54:15 3514d522f475Smrgdnl ------------- 3515d522f475Smrgdnl Find the utmp/utmpx file and determine its group to allow setgid programs 3516d522f475Smrgdnl to manipulate it, e.g., when there is no intermediary. 3517d522f475SmrgAC_DEFUN([CF_UTMP_GROUP],[ 3518d522f475SmrgAC_REQUIRE([CF_UTMP]) 3519d522f475Smrgif test $cf_cv_have_utmp != no ; then 3520d522f475SmrgAC_CACHE_CHECK(for utmp/utmpx group,cf_cv_utmp_group,[ 3521d522f475Smrgfor cf_utmp_path in /var/adm /var/run 3522d522f475Smrgdo 3523d522f475Smrg for cf_utmp_file in utmpx utmp 3524d522f475Smrg do 3525d522f475Smrg if test -f $cf_utmp_path/$cf_utmp_file 3526d522f475Smrg then 3527d522f475Smrg cf_cv_utmp_group=root 3528d522f475Smrg 3529f2e35a3aSmrg cf_option="-lL" 3530d522f475Smrg 3531d522f475Smrg # Expect listing to have fields like this: 3532d522f475Smrg #-r--r--r-- 1 user group 34293 Jul 18 16:29 pathname 3533f2e35a3aSmrg ls "$cf_option" "$cf_utmp_path/$cf_utmp_file" >conftest 3534d522f475Smrg read cf_mode cf_links cf_usr cf_grp cf_size cf_date1 cf_date2 cf_date3 cf_rest <conftest 3535d522f475Smrg if test -z "$cf_rest" ; then 3536f2e35a3aSmrg cf_option="${cf_option}g" 3537f2e35a3aSmrg ls "$cf_option" "$cf_utmp_path/$cf_utmp_file" >conftest 3538d522f475Smrg read cf_mode cf_links cf_usr cf_grp cf_size cf_date1 cf_date2 cf_date3 cf_rest <conftest 3539d522f475Smrg fi 3540d522f475Smrg rm -f conftest 3541d522f475Smrg 3542d522f475Smrg # If we have a pathname, and the date fields look right, assume we've 3543d522f475Smrg # captured the group as well. 3544d522f475Smrg if test -n "$cf_rest" ; then 3545d522f475Smrg cf_test=`echo "${cf_date2}${cf_date3}" | sed -e 's/[[0-9:]]//g'` 3546d522f475Smrg if test -z "$cf_test" ; then 3547d522f475Smrg cf_cv_utmp_group=$cf_grp; 3548d522f475Smrg fi 3549d522f475Smrg fi 3550d522f475Smrg break 3551d522f475Smrg fi 3552d522f475Smrg done 3553d522f475Smrg test -n "$cf_cv_utmp_group" && break 3554d522f475Smrgdone 3555d522f475Smrg]) 3556d522f475Smrgelse 3557d522f475Smrg AC_MSG_ERROR(cannot find utmp group) 3558d522f475Smrgfi 3559d522f475Smrg])dnl 3560d522f475Smrgdnl --------------------------------------------------------------------------- 3561f2e35a3aSmrgdnl CF_UTMP_UT_HOST version: 10 updated: 2021/01/02 09:31:20 3562d522f475Smrgdnl --------------- 3563d522f475Smrgdnl Check if UTMP/UTMPX struct defines ut_host member 3564d522f475SmrgAC_DEFUN([CF_UTMP_UT_HOST], 3565d522f475Smrg[ 3566f2e35a3aSmrgif test "$cf_cv_have_utmp" != no ; then 3567d522f475SmrgAC_MSG_CHECKING(if ${cf_cv_have_utmp}.ut_host is declared) 3568d522f475SmrgAC_CACHE_VAL(cf_cv_have_utmp_ut_host,[ 3569d522f475Smrg AC_TRY_COMPILE([ 3570d522f475Smrg#include <sys/types.h> 3571d522f475Smrg#include <${cf_cv_have_utmp}.h>], 3572f2e35a3aSmrg [struct $cf_cv_have_utmp x; 3573f2e35a3aSmrg char *y = &x.ut_host[0]; 3574f2e35a3aSmrg (void)x; 3575f2e35a3aSmrg (void)y], 3576d522f475Smrg [cf_cv_have_utmp_ut_host=yes], 3577d522f475Smrg [cf_cv_have_utmp_ut_host=no]) 3578d522f475Smrg ]) 3579d522f475SmrgAC_MSG_RESULT($cf_cv_have_utmp_ut_host) 3580f2e35a3aSmrgtest "$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]) 3581d522f475Smrgfi 3582d522f475Smrg])dnl 3583d522f475Smrgdnl --------------------------------------------------------------------------- 3584f2e35a3aSmrgdnl CF_UTMP_UT_NAME version: 8 updated: 2021/01/02 09:31:20 3585d522f475Smrgdnl --------------- 3586d522f475Smrgdnl Check if UTMP/UTMPX struct defines ut_name member 3587d522f475SmrgAC_DEFUN([CF_UTMP_UT_NAME], 3588d522f475Smrg[ 3589f2e35a3aSmrgif test "$cf_cv_have_utmp" != no ; then 3590d522f475SmrgAC_CACHE_CHECK(if ${cf_cv_have_utmp}.ut_name is declared,cf_cv_have_utmp_ut_name,[ 3591d522f475Smrg cf_cv_have_utmp_ut_name=no 3592d522f475Smrgcf_utmp_includes=" 3593d522f475Smrg#include <sys/types.h> 3594d522f475Smrg#include <${cf_cv_have_utmp}.h> 3595d522f475Smrg#define getutent getutxent 3596d522f475Smrg#ifdef USE_LASTLOG 3597d522f475Smrg#include <lastlog.h> /* may conflict with utmpx.h on Linux */ 3598d522f475Smrg#endif 3599d522f475Smrg" 3600d522f475Smrgfor cf_header in ut_name ut_user ; do 3601d522f475Smrg AC_TRY_COMPILE([$cf_utmp_includes], 3602d522f475Smrg [struct $cf_cv_have_utmp x; 3603d522f475Smrg char *name = x.$cf_header; 3604f2e35a3aSmrg (void)x; 3605f2e35a3aSmrg (void)name; 3606d522f475Smrg ], 3607d522f475Smrg [cf_cv_have_utmp_ut_name=$cf_header 3608d522f475Smrg break]) 3609d522f475Smrgdone 3610d522f475Smrg]) 3611d522f475Smrg 3612f2e35a3aSmrgcase "$cf_cv_have_utmp_ut_name" in 361301037d57Smrg(no) 3614d522f475Smrg AC_MSG_ERROR(Cannot find declaration for ut.ut_name) 3615d522f475Smrg ;; 361601037d57Smrg(ut_user) 36170bd37d32Smrg AC_DEFINE(ut_name,ut_user,[Define to rename UTMP/UTMPX struct ut_name member]) 3618d522f475Smrg ;; 3619d522f475Smrgesac 3620d522f475Smrgfi 3621d522f475Smrg])dnl 3622d522f475Smrgdnl --------------------------------------------------------------------------- 3623ae137402Smrgdnl CF_UTMP_UT_SESSION version: 9 updated: 2021/06/07 17:39:17 3624d522f475Smrgdnl ------------------ 3625d522f475Smrgdnl Check if UTMP/UTMPX struct defines ut_session member 3626d522f475SmrgAC_DEFUN([CF_UTMP_UT_SESSION], 3627d522f475Smrg[ 3628f2e35a3aSmrgif test "$cf_cv_have_utmp" != no ; then 3629d522f475SmrgAC_CACHE_CHECK(if ${cf_cv_have_utmp}.ut_session is declared, cf_cv_have_utmp_ut_session,[ 3630d522f475Smrg AC_TRY_COMPILE([ 3631d522f475Smrg#include <sys/types.h> 3632d522f475Smrg#include <${cf_cv_have_utmp}.h>], 3633ae137402Smrg [static struct $cf_cv_have_utmp x; 3634f2e35a3aSmrg long y = x.ut_session; 3635f2e35a3aSmrg (void)x; 3636f2e35a3aSmrg (void)y], 3637d522f475Smrg [cf_cv_have_utmp_ut_session=yes], 3638d522f475Smrg [cf_cv_have_utmp_ut_session=no]) 3639d522f475Smrg]) 3640f2e35a3aSmrgif test "$cf_cv_have_utmp_ut_session" != no ; then 36410bd37d32Smrg AC_DEFINE(HAVE_UTMP_UT_SESSION,1,[Define to 1 if UTMP/UTMPX struct defines ut_session member]) 3642d522f475Smrgfi 3643d522f475Smrgfi 3644d522f475Smrg])dnl 3645d522f475Smrgdnl --------------------------------------------------------------------------- 3646f2e35a3aSmrgdnl CF_UTMP_UT_SYSLEN version: 4 updated: 2021/01/02 09:31:20 3647d522f475Smrgdnl ----------------- 3648d522f475Smrgdnl Check if UTMP/UTMPX struct defines ut_syslen member 3649d522f475SmrgAC_DEFUN([CF_UTMP_UT_SYSLEN], 3650d522f475Smrg[ 3651f2e35a3aSmrgif test "$cf_cv_have_utmp" != no ; then 3652d522f475SmrgAC_MSG_CHECKING(if ${cf_cv_have_utmp}.ut_syslen is declared) 3653d522f475SmrgAC_CACHE_VAL(cf_cv_have_utmp_ut_syslen,[ 3654d522f475Smrg AC_TRY_COMPILE([ 3655d522f475Smrg#include <sys/types.h> 3656d522f475Smrg#include <${cf_cv_have_utmp}.h>], 3657f2e35a3aSmrg [struct $cf_cv_have_utmp x; 3658f2e35a3aSmrg int y = x.ut_syslen; 3659f2e35a3aSmrg (void)x; 3660f2e35a3aSmrg (void)y], 3661d522f475Smrg [cf_cv_have_utmp_ut_syslen=yes], 3662d522f475Smrg [cf_cv_have_utmp_ut_syslen=no]) 3663d522f475Smrg ]) 3664d522f475SmrgAC_MSG_RESULT($cf_cv_have_utmp_ut_syslen) 3665f2e35a3aSmrgtest "$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]) 3666d522f475Smrgfi 3667d522f475Smrg])dnl 3668d522f475Smrgdnl --------------------------------------------------------------------------- 3669f2e35a3aSmrgdnl CF_UTMP_UT_XSTATUS version: 6 updated: 2021/01/02 09:31:20 3670d522f475Smrgdnl ------------------ 3671d522f475Smrgdnl Check for known variants on the UTMP/UTMPX struct's exit-status as reported 3672d522f475Smrgdnl by various people: 3673d522f475Smrgdnl 3674d522f475Smrgdnl ut_exit.__e_exit (HPUX 11 - David Ellement, also in glibc2) 3675d522f475Smrgdnl ut_exit.e_exit (SVR4) 3676d522f475Smrgdnl ut_exit.ut_e_exit (os390 - Greg Smith) 3677d522f475Smrgdnl ut_exit.ut_exit (Tru64 4.0f - Jeremie Petit, 4.0e - Tomas Vanhala) 3678d522f475Smrgdnl 3679d522f475Smrgdnl Note: utmp_xstatus is not a conventional compatibility definition in the 3680d522f475Smrgdnl system header files. 3681d522f475SmrgAC_DEFUN([CF_UTMP_UT_XSTATUS], 3682d522f475Smrg[ 3683f2e35a3aSmrgif test "$cf_cv_have_utmp" != no ; then 3684d522f475SmrgAC_CACHE_CHECK(for exit-status in $cf_cv_have_utmp,cf_cv_have_utmp_ut_xstatus,[ 3685d522f475Smrgfor cf_result in \ 3686d522f475Smrg ut_exit.__e_exit \ 3687d522f475Smrg ut_exit.e_exit \ 3688d522f475Smrg ut_exit.ut_e_exit \ 3689d522f475Smrg ut_exit.ut_exit 3690d522f475Smrgdo 3691d522f475SmrgAC_TRY_COMPILE([ 3692d522f475Smrg#include <sys/types.h> 3693d522f475Smrg#include <${cf_cv_have_utmp}.h>], 3694f2e35a3aSmrg [struct $cf_cv_have_utmp x; 3695f2e35a3aSmrg long y = x.$cf_result = 0; 3696f2e35a3aSmrg (void)x; 3697f2e35a3aSmrg (void)y], 3698d522f475Smrg [cf_cv_have_utmp_ut_xstatus=$cf_result 3699d522f475Smrg break], 3700d522f475Smrg [cf_cv_have_utmp_ut_xstatus=no]) 3701d522f475Smrgdone 3702d522f475Smrg]) 3703f2e35a3aSmrgif test "$cf_cv_have_utmp_ut_xstatus" != no ; then 37040bd37d32Smrg AC_DEFINE(HAVE_UTMP_UT_XSTATUS,1,[Define to 1 if UTMP/UTMPX has exit-status member]) 37050bd37d32Smrg AC_DEFINE_UNQUOTED(ut_xstatus,$cf_cv_have_utmp_ut_xstatus,[Define if needed to rename member ut_xstatus of UTMP/UTMPX]) 3706d522f475Smrgfi 3707d522f475Smrgfi 3708d522f475Smrg])dnl 3709d522f475Smrgdnl --------------------------------------------------------------------------- 3710f2e35a3aSmrgdnl CF_UTMP_UT_XTIME version: 11 updated: 2021/01/02 09:31:20 3711d522f475Smrgdnl ---------------- 3712d522f475Smrgdnl Check if UTMP/UTMPX struct defines ut_xtime member 3713d522f475SmrgAC_DEFUN([CF_UTMP_UT_XTIME], 3714d522f475Smrg[ 3715f2e35a3aSmrgif test "$cf_cv_have_utmp" != no ; then 3716d522f475SmrgAC_CACHE_CHECK(if ${cf_cv_have_utmp}.ut_xtime is declared, cf_cv_have_utmp_ut_xtime,[ 3717d522f475Smrg AC_TRY_COMPILE([ 3718d522f475Smrg#include <sys/types.h> 3719d522f475Smrg#include <${cf_cv_have_utmp}.h>], 3720f2e35a3aSmrg [struct $cf_cv_have_utmp x; 3721f2e35a3aSmrg long y = x.ut_xtime = 0; 3722f2e35a3aSmrg (void)x; 3723f2e35a3aSmrg (void)y], 3724d522f475Smrg [cf_cv_have_utmp_ut_xtime=yes], 3725d522f475Smrg [AC_TRY_COMPILE([ 3726d522f475Smrg#include <sys/types.h> 3727d522f475Smrg#include <${cf_cv_have_utmp}.h>], 3728f2e35a3aSmrg [struct $cf_cv_have_utmp x; 3729f2e35a3aSmrg long y = x.ut_tv.tv_sec; 3730f2e35a3aSmrg (void)x; 3731f2e35a3aSmrg (void)y], 3732d522f475Smrg [cf_cv_have_utmp_ut_xtime=define], 3733d522f475Smrg [cf_cv_have_utmp_ut_xtime=no]) 3734d522f475Smrg ]) 3735d522f475Smrg]) 3736f2e35a3aSmrgif test "$cf_cv_have_utmp_ut_xtime" != no ; then 37370bd37d32Smrg AC_DEFINE(HAVE_UTMP_UT_XTIME,1,[Define to 1 if UTMP/UTMPX struct defines ut_xtime member]) 3738f2e35a3aSmrg if test "$cf_cv_have_utmp_ut_xtime" = define ; then 37390bd37d32Smrg AC_DEFINE(ut_xtime,ut_tv.tv_sec,[Define if needed to alternate name for utmpx.ut_xtime member]) 3740d522f475Smrg fi 3741d522f475Smrgfi 3742d522f475Smrgfi 3743d522f475Smrg])dnl 3744d522f475Smrgdnl --------------------------------------------------------------------------- 3745d522f475Smrgdnl CF_VERBOSE version: 3 updated: 2007/07/29 09:55:12 3746d522f475Smrgdnl ---------- 3747d522f475Smrgdnl Use AC_VERBOSE w/o the warnings 3748d522f475SmrgAC_DEFUN([CF_VERBOSE], 3749d522f475Smrg[test -n "$verbose" && echo " $1" 1>&AC_FD_MSG 3750d522f475SmrgCF_MSG_LOG([$1]) 3751d522f475Smrg])dnl 3752d522f475Smrgdnl --------------------------------------------------------------------------- 375301037d57Smrgdnl CF_WITH_APP_CLASS version: 3 updated: 2015/04/12 15:39:00 3754e39b573cSmrgdnl ----------------- 3755e39b573cSmrgdnl Handle configure option "--with-app-class", setting the $APP_CLASS 3756e39b573cSmrgdnl variable, used for X resources. 3757e39b573cSmrgdnl 3758e39b573cSmrgdnl $1 = default value. 37590bd37d32SmrgAC_DEFUN([CF_WITH_APP_CLASS],[ 3760e39b573cSmrgAC_MSG_CHECKING(for X applications class) 3761e39b573cSmrgAC_ARG_WITH(app-class, 3762e39b573cSmrg [ --with-app-class=XXX override X applications class (default $1)], 3763e39b573cSmrg [APP_CLASS=$withval], 3764e39b573cSmrg [APP_CLASS=$1]) 3765e39b573cSmrg 376601037d57Smrgcase x$APP_CLASS in 376701037d57Smrg(*[[/@,%]]*) 3768e39b573cSmrg AC_MSG_WARN(X applications class cannot contain punctuation) 3769e39b573cSmrg APP_CLASS=$1 3770e39b573cSmrg ;; 377101037d57Smrg(x[[A-Z]]*) 3772e39b573cSmrg ;; 377301037d57Smrg(*) 3774e39b573cSmrg AC_MSG_WARN([X applications class must start with capital, ignoring $APP_CLASS]) 3775e39b573cSmrg APP_CLASS=$1 3776e39b573cSmrg ;; 3777e39b573cSmrgesac 3778e39b573cSmrg 3779e39b573cSmrgAC_MSG_RESULT($APP_CLASS) 3780e39b573cSmrg 3781e39b573cSmrgAC_SUBST(APP_CLASS) 3782e39b573cSmrg])dnl 3783e39b573cSmrgdnl --------------------------------------------------------------------------- 378401037d57Smrgdnl CF_WITH_APP_DEFAULTS version: 6 updated: 2015/01/02 09:05:50 3785e39b573cSmrgdnl -------------------- 3786e39b573cSmrgdnl Handle configure option "--with-app-defaults", setting these shell 3787e39b573cSmrgdnl variables: 37880bd37d32Smrgdnl 37890bd37d32Smrgdnl $APPSDIR is the option value, used for installing app-defaults files. 3790e39b573cSmrgdnl $no_appsdir is a "#" (comment) if "--without-app-defaults" is given. 37910bd37d32Smrgdnl 37920bd37d32Smrgdnl Most Linux's use this: 37930bd37d32Smrgdnl /usr/share/X11/app-defaults 37940bd37d32Smrgdnl Debian uses this: 37950bd37d32Smrgdnl /etc/X11/app-defaults 37960bd37d32Smrgdnl DragonFlyBSD ports uses this: 37970bd37d32Smrgdnl /usr/pkg/lib/X11/app-defaults 37980bd37d32Smrgdnl FreeBSD ports use these: 37990bd37d32Smrgdnl /usr/local/lib/X11/app-defaults 38000bd37d32Smrgdnl /usr/local/share/X11/app-defaults 38010bd37d32Smrgdnl Mandriva has these: 38020bd37d32Smrgdnl /usr/lib/X11/app-defaults 38030bd37d32Smrgdnl /usr/lib64/X11/app-defaults 38040bd37d32Smrgdnl NetBSD has these 38050bd37d32Smrgdnl /usr/X11R7/lib/X11/app-defaults 38060bd37d32Smrgdnl OpenSolaris uses 38070bd37d32Smrgdnl 32-bit: 38080bd37d32Smrgdnl /usr/X11/etc/X11/app-defaults 38090bd37d32Smrgdnl /usr/X11/share/X11/app-defaults 38100bd37d32Smrgdnl /usr/X11/lib/X11/app-defaults 381101037d57Smrgdnl OSX uses 381201037d57Smrgdnl /opt/local/share/X11/app-defaults (MacPorts) 381301037d57Smrgdnl /opt/X11/share/X11/app-defaults (non-ports) 38140bd37d32Smrgdnl 64-bit: 38150bd37d32Smrgdnl /usr/X11/etc/X11/app-defaults 38160bd37d32Smrgdnl /usr/X11/share/X11/app-defaults (I mkdir'd this) 38170bd37d32Smrgdnl /usr/X11/lib/amd64/X11/app-defaults 38180bd37d32Smrgdnl Solaris10 uses (in this order): 38190bd37d32Smrgdnl /usr/openwin/lib/X11/app-defaults 38200bd37d32Smrgdnl /usr/X11/lib/X11/app-defaults 38210bd37d32SmrgAC_DEFUN([CF_WITH_APP_DEFAULTS],[ 3822e39b573cSmrgAC_MSG_CHECKING(for directory to install resource files) 38230bd37d32SmrgAC_ARG_WITH(app-defaults, 38240bd37d32Smrg [ --with-app-defaults=DIR directory in which to install resource files (EPREFIX/lib/X11/app-defaults)], 38250bd37d32Smrg [APPSDIR=$withval], 38260bd37d32Smrg [APPSDIR='${exec_prefix}/lib/X11/app-defaults']) 38270bd37d32Smrg 38280bd37d32Smrgif test "x[$]APPSDIR" = xauto 38290bd37d32Smrgthen 38300bd37d32Smrg APPSDIR='${exec_prefix}/lib/X11/app-defaults' 38310bd37d32Smrg for cf_path in \ 383201037d57Smrg /opt/local/share/X11/app-defaults \ 383301037d57Smrg /opt/X11/share/X11/app-defaults \ 38340bd37d32Smrg /usr/share/X11/app-defaults \ 38350bd37d32Smrg /usr/X11/share/X11/app-defaults \ 38360bd37d32Smrg /usr/X11/lib/X11/app-defaults \ 38370bd37d32Smrg /usr/lib/X11/app-defaults \ 38380bd37d32Smrg /etc/X11/app-defaults \ 38390bd37d32Smrg /usr/pkg/lib/X11/app-defaults \ 38400bd37d32Smrg /usr/X11R7/lib/X11/app-defaults \ 38410bd37d32Smrg /usr/X11R6/lib/X11/app-defaults \ 38420bd37d32Smrg /usr/X11R5/lib/X11/app-defaults \ 38430bd37d32Smrg /usr/X11R4/lib/X11/app-defaults \ 38440bd37d32Smrg /usr/local/lib/X11/app-defaults \ 38450bd37d32Smrg /usr/local/share/X11/app-defaults \ 38460bd37d32Smrg /usr/lib64/X11/app-defaults 38470bd37d32Smrg do 38480bd37d32Smrg if test -d "$cf_path" ; then 38490bd37d32Smrg APPSDIR="$cf_path" 38500bd37d32Smrg break 38510bd37d32Smrg fi 38520bd37d32Smrg done 38530bd37d32Smrgelse 38540bd37d32Smrg cf_path=$APPSDIR 38550bd37d32Smrg CF_PATH_SYNTAX(cf_path) 38560bd37d32Smrgfi 38570bd37d32Smrg 38580bd37d32SmrgAC_MSG_RESULT($APPSDIR) 38590bd37d32SmrgAC_SUBST(APPSDIR) 3860e39b573cSmrg 3861e39b573cSmrgno_appsdir= 38620bd37d32Smrgif test "$APPSDIR" = no 38630bd37d32Smrgthen 38640bd37d32Smrg no_appsdir="#" 38650bd37d32Smrgelse 38660bd37d32Smrg EXTRA_INSTALL_DIRS="$EXTRA_INSTALL_DIRS \$(APPSDIR)" 38670bd37d32Smrgfi 3868e39b573cSmrgAC_SUBST(no_appsdir) 3869e39b573cSmrg])dnl 3870e39b573cSmrgdnl --------------------------------------------------------------------------- 38710bd37d32Smrgdnl CF_WITH_DBMALLOC version: 7 updated: 2010/06/21 17:26:47 38720bd37d32Smrgdnl ---------------- 38730bd37d32Smrgdnl Configure-option for dbmalloc. The optional parameter is used to override 38740bd37d32Smrgdnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests. 38750bd37d32SmrgAC_DEFUN([CF_WITH_DBMALLOC],[ 38760bd37d32SmrgCF_NO_LEAKS_OPTION(dbmalloc, 38770bd37d32Smrg [ --with-dbmalloc test: use Conor Cahill's dbmalloc library], 38780bd37d32Smrg [USE_DBMALLOC]) 38790bd37d32Smrg 38800bd37d32Smrgif test "$with_dbmalloc" = yes ; then 38810bd37d32Smrg AC_CHECK_HEADER(dbmalloc.h, 38820bd37d32Smrg [AC_CHECK_LIB(dbmalloc,[debug_malloc]ifelse([$1],,[],[,$1]))]) 38830bd37d32Smrgfi 38840bd37d32Smrg])dnl 38850bd37d32Smrgdnl --------------------------------------------------------------------------- 388604b94745Smrgdnl CF_WITH_DESKTOP_CATEGORY version: 10 updated: 2023/12/02 06:55:40 3887e39b573cSmrgdnl ------------------------ 3888e39b573cSmrgdnl Taking into account the absence of standardization of desktop categories 3889e39b573cSmrgdnl take a look to see whether other applications on the current system are 3890e39b573cSmrgdnl assigned any/all of a set of suggested categories. 3891e39b573cSmrgdnl 3892e39b573cSmrgdnl $1 = program name 3893e39b573cSmrgdnl $2 = case-pattern to match comparable desktop files to obtain category 3894e39b573cSmrgdnl This pattern may contain wildcards. 3895e39b573cSmrgdnl $3 = suggested categories, also a case-pattern but without wildcards, 38960bd37d32Smrgdnl since it doubles as a default value for a shell case-statement. 38970bd37d32Smrgdnl $4 = categories to use if no match is found on the build-machine for the 38980bd37d32Smrgdnl --with-desktop-category "auto" setting. 3899e39b573cSmrgdnl 3900e39b573cSmrgdnl The macro tells the configure script to substitute the $DESKTOP_CATEGORY 3901e39b573cSmrgdnl value. 3902e39b573cSmrgAC_DEFUN([CF_WITH_DESKTOP_CATEGORY],[ 3903f2e35a3aSmrgAC_REQUIRE([AC_PROG_EGREP])dnl 3904f2e35a3aSmrgAC_REQUIRE([CF_DISABLE_DESKTOP])dnl 3905e39b573cSmrgif test -z "$desktop_utils" 3906e39b573cSmrgthen 3907e39b573cSmrg AC_MSG_CHECKING(for requested desktop-category) 3908e39b573cSmrg AC_ARG_WITH(desktop-category, 390904b94745Smrg [ --with-desktop-category=XXX one or more desktop categories or auto], 3910e39b573cSmrg [cf_desktop_want=$withval], 3911e39b573cSmrg [cf_desktop_want=auto]) 3912e39b573cSmrg AC_MSG_RESULT($cf_desktop_want) 3913e39b573cSmrg 3914e39b573cSmrg if test "$cf_desktop_want" = auto 3915e39b573cSmrg then 3916e39b573cSmrg rm -rf conftest* 3917e39b573cSmrg cf_desktop_also= 3918e39b573cSmrg for cf_desktop_dir in \ 3919e39b573cSmrg /usr/share/app-install \ 3920e39b573cSmrg /usr/share/applications 3921e39b573cSmrg do 3922e39b573cSmrg if test -d $cf_desktop_dir 3923e39b573cSmrg then 3924e39b573cSmrg find $cf_desktop_dir -name '*.desktop' | \ 3925e39b573cSmrg while true 3926e39b573cSmrg do 3927e39b573cSmrg read cf_desktop_path 3928e39b573cSmrg test -z "$cf_desktop_path" && break 3929f2e35a3aSmrg cf_desktop_name=`basename "$cf_desktop_path" .desktop` 393001037d57Smrg case $cf_desktop_name in 393101037d57Smrg ($1|*-$1|$2) 3932e39b573cSmrg CF_VERBOSE(inspect $cf_desktop_path) 3933f2e35a3aSmrg ${EGREP-egrep} '^Categories=' "$cf_desktop_path" | \ 3934e39b573cSmrg tr ';' '\n' | \ 3935e39b573cSmrg sed -e 's%^.*=%%' -e '/^$/d' >>conftest.1 3936e39b573cSmrg ;; 3937e39b573cSmrg esac 3938e39b573cSmrg done 3939e39b573cSmrg fi 3940e39b573cSmrg done 3941e39b573cSmrg if test -s conftest.1 3942e39b573cSmrg then 3943e39b573cSmrg cf_desktop_last= 3944e39b573cSmrg sort conftest.1 | \ 3945e39b573cSmrg while true 3946e39b573cSmrg do 3947e39b573cSmrg read cf_desktop_this 3948e39b573cSmrg test -z "$cf_desktop_this" && break 3949f2e35a3aSmrg if test -s conftest.2 3950f2e35a3aSmrg then 3951f2e35a3aSmrg grep -w "$cf_desktop_this" conftest.2 >/dev/null && continue 3952f2e35a3aSmrg elif test -s conftest.3 3953f2e35a3aSmrg then 3954f2e35a3aSmrg grep -w "$cf_desktop_this" conftest.3 >/dev/null && continue 3955f2e35a3aSmrg fi 3956f2e35a3aSmrg case "$cf_desktop_this" in 3957f2e35a3aSmrg (-*) 3958f2e35a3aSmrg ;; 3959f2e35a3aSmrg (Qt*|*Xfce*|*[[ABCDEFGHIJKLMNOPQRSTUVWXYZ]][[ABCDEFGHIJKLMNOPQRSTUVWXYZ]]*) 3960f2e35a3aSmrg CF_VERBOSE(ignored $cf_desktop_this) 3961f2e35a3aSmrg echo "$cf_desktop_this" >> conftest.3 3962e39b573cSmrg ;; 396301037d57Smrg ($3) 3964f2e35a3aSmrg CF_VERBOSE(applied $cf_desktop_this) 3965f2e35a3aSmrg test "x$cf_desktop_last" != "x$cf_desktop_this" && echo "$cf_desktop_this" >>conftest.2 3966e39b573cSmrg ;; 3967e39b573cSmrg esac 3968e39b573cSmrg cf_desktop_last=$cf_desktop_this 3969e39b573cSmrg done 3970f2e35a3aSmrg cf_desktop_want="`tr '\n' ';' < conftest.2`" 3971e39b573cSmrg fi 39720bd37d32Smrg if test -n "$cf_desktop_want" 39730bd37d32Smrg then 39740bd37d32Smrg if test "$cf_desktop_want" = auto 39750bd37d32Smrg then 39760bd37d32Smrg cf_desktop_want= 39770bd37d32Smrg else 39780bd37d32Smrg # do a sanity check on the semicolon-separated list, ignore on failure 39790bd37d32Smrg cf_desktop_test=`echo "$cf_desktop_want" | sed -e 's/[[^;]]//g'` 39800bd37d32Smrg test -z "$cf_desktop_test" && cf_desktop_want= 39810bd37d32Smrg cf_desktop_test=`echo "$cf_desktop_want" | sed -e 's/^.*;$/./g'` 39820bd37d32Smrg test -z "$cf_desktop_test" && cf_desktop_want= 39830bd37d32Smrg fi 39840bd37d32Smrg fi 39850bd37d32Smrg if test -z "$cf_desktop_want" 39860bd37d32Smrg then 39870bd37d32Smrg cf_desktop_want="ifelse([$4],,ifelse([$3],,[Application;],[`echo "$3" | sed -e 's/\*//g' -e 's/|/;/g' -e 's/[[;]]*$/;/g'`]),[$4])" 39880bd37d32Smrg CF_VERBOSE(no usable value found for desktop category, using $cf_desktop_want) 39890bd37d32Smrg fi 3990e39b573cSmrg fi 3991e39b573cSmrg DESKTOP_CATEGORY=`echo "$cf_desktop_want" | sed -e 's/[[ ,]]/;/g'` 39920bd37d32Smrg CF_VERBOSE(will use Categories=$DESKTOP_CATEGORY) 3993e39b573cSmrg AC_SUBST(DESKTOP_CATEGORY) 3994e39b573cSmrgfi 3995e39b573cSmrg]) 3996e39b573cSmrgdnl --------------------------------------------------------------------------- 39970bd37d32Smrgdnl CF_WITH_DMALLOC version: 7 updated: 2010/06/21 17:26:47 3998e39b573cSmrgdnl --------------- 39990bd37d32Smrgdnl Configure-option for dmalloc. The optional parameter is used to override 40000bd37d32Smrgdnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests. 40010bd37d32SmrgAC_DEFUN([CF_WITH_DMALLOC],[ 40020bd37d32SmrgCF_NO_LEAKS_OPTION(dmalloc, 40030bd37d32Smrg [ --with-dmalloc test: use Gray Watson's dmalloc library], 40040bd37d32Smrg [USE_DMALLOC]) 40050bd37d32Smrg 40060bd37d32Smrgif test "$with_dmalloc" = yes ; then 40070bd37d32Smrg AC_CHECK_HEADER(dmalloc.h, 40080bd37d32Smrg [AC_CHECK_LIB(dmalloc,[dmalloc_debug]ifelse([$1],,[],[,$1]))]) 40090bd37d32Smrgfi 40100bd37d32Smrg])dnl 40110bd37d32Smrgdnl --------------------------------------------------------------------------- 40120bd37d32Smrgdnl CF_WITH_ICONDIR version: 5 updated: 2012/07/22 09:18:02 40130bd37d32Smrgdnl --------------- 40140bd37d32Smrgdnl Handle configure option "--with-icondir", setting these shell variables: 40150bd37d32Smrgdnl 40160bd37d32Smrgdnl $ICONDIR is the option value, used for installing icon files. 4017e39b573cSmrgdnl $no_icondir is a "#" (comment) if "--without-icondir" is given. 4018e39b573cSmrgAC_DEFUN([CF_WITH_ICONDIR],[ 4019e39b573cSmrgAC_MSG_CHECKING(for directory to install icons) 40200bd37d32SmrgAC_ARG_WITH(icondir, 40210bd37d32Smrg [ --with-icondir=DIR directory in which to install icons for desktop], 40220bd37d32Smrg [ICONDIR=$withval], 40230bd37d32Smrg [test -z "$ICONDIR" && ICONDIR=no]) 40240bd37d32Smrg 40250bd37d32Smrgif test "x[$]ICONDIR" = xauto 40260bd37d32Smrgthen 40270bd37d32Smrg ICONDIR='${datadir}/icons' 40280bd37d32Smrg for cf_path in \ 40290bd37d32Smrg /usr/share/icons \ 40300bd37d32Smrg /usr/X11R6/share/icons 40310bd37d32Smrg do 40320bd37d32Smrg if test -d "$cf_path" ; then 40330bd37d32Smrg ICONDIR="$cf_path" 40340bd37d32Smrg break 40350bd37d32Smrg fi 40360bd37d32Smrg done 40370bd37d32Smrgelse 40380bd37d32Smrg cf_path=$ICONDIR 40390bd37d32Smrg CF_PATH_SYNTAX(cf_path) 40400bd37d32Smrgfi 40410bd37d32SmrgAC_MSG_RESULT($ICONDIR) 40420bd37d32SmrgAC_SUBST(ICONDIR) 4043e39b573cSmrg 4044e39b573cSmrgno_icondir= 40450bd37d32Smrgif test "$ICONDIR" = no 40460bd37d32Smrgthen 40470bd37d32Smrg no_icondir="#" 40480bd37d32Smrgelse 40490bd37d32Smrg EXTRA_INSTALL_DIRS="$EXTRA_INSTALL_DIRS \$(ICONDIR)" 40500bd37d32Smrgfi 4051e39b573cSmrgAC_SUBST(no_icondir) 4052e39b573cSmrg])dnl 4053e39b573cSmrgdnl --------------------------------------------------------------------------- 405404b94745Smrgdnl CF_WITH_ICON_NAME version: 4 updated: 2023/11/23 06:40:35 40550bd37d32Smrgdnl ----------------- 40560bd37d32Smrgdnl Allow a default icon-name to be overridden. 40570bd37d32Smrgdnl $1 = default icon name 40580bd37d32SmrgAC_DEFUN([CF_WITH_ICON_NAME],[ 40590bd37d32SmrgAC_MSG_CHECKING(for the icon name) 40600bd37d32SmrgAC_ARG_WITH(icon-name, 406104b94745Smrg [[ --with-icon-name[=XXX] override icon name (default: $1)]], 40620bd37d32Smrg [ICON_NAME="$withval"], 40630bd37d32Smrg [ICON_NAME=$1]) 40640bd37d32Smrgcase "x$ICON_NAME" in 406501037d57Smrg(xyes|xno|x) 40660bd37d32Smrg ICON_NAME=$1 40670bd37d32Smrg ;; 40680bd37d32Smrgesac 40690bd37d32SmrgAC_SUBST(ICON_NAME) 40700bd37d32SmrgAC_MSG_RESULT($ICON_NAME) 40710bd37d32Smrg])dnl 40720bd37d32Smrgdnl --------------------------------------------------------------------------- 407304b94745Smrgdnl CF_WITH_ICON_SYMLINK version: 3 updated: 2023/11/23 06:40:35 40740bd37d32Smrgdnl -------------------- 40750bd37d32Smrgdnl Workaround for systems which are (mis)configured to map all icon references 40760bd37d32Smrgdnl for xterm into "xterm" name. For instance, recent (2013) KDE ignores both 40770bd37d32Smrgdnl the name given in the .desktop file (xterm-color) and the application name 40780bd37d32Smrgdnl (xterm-dev). 40790bd37d32Smrgdnl 40800bd37d32Smrgdnl $1 = default icon name to use if symlink is wanted 40810bd37d32SmrgAC_DEFUN([CF_WITH_ICON_SYMLINK],[ 40820bd37d32SmrgAC_MSG_CHECKING(for icon symlink to use) 40830bd37d32SmrgAC_ARG_WITH(icon-symlink, 408404b94745Smrg [[ --with-icon-symlink[=XXX] make symbolic link for icon name (default: $1)]], 40850bd37d32Smrg [ICON_SYMLINK="$withval"], 40860bd37d32Smrg [ICON_SYMLINK=NONE]) 40870bd37d32Smrgcase "x$ICON_SYMLINK" in 408801037d57Smrg(xyes) 40890bd37d32Smrg ICON_SYMLINK=$1 40900bd37d32Smrg ;; 409101037d57Smrg(xno|x) 40920bd37d32Smrg ICON_SYMLINK=NONE 40930bd37d32Smrg ;; 40940bd37d32Smrgesac 40950bd37d32SmrgAC_SUBST(ICON_SYMLINK) 40960bd37d32SmrgAC_MSG_RESULT($ICON_SYMLINK) 40970bd37d32Smrg])dnl 40980bd37d32Smrgdnl --------------------------------------------------------------------------- 409904b94745Smrgdnl CF_WITH_ICON_THEME version: 14 updated: 2023/11/23 06:40:35 41000bd37d32Smrgdnl ------------------ 41010bd37d32Smrgdnl If asked, check for prerequisites and setup symbols to permit installing 41020bd37d32Smrgdnl one or more application icons in the Red Hat icon-theme directory 410301037d57Smrgdnl hierarchy. 41040bd37d32Smrgdnl 41050bd37d32Smrgdnl If the prerequisites are missing, give a warning and revert to the long- 41060bd37d32Smrgdnl standing pixmaps directory. 41070bd37d32Smrgdnl 41080bd37d32Smrgdnl Parameters: 41090bd37d32Smrgdnl 41100bd37d32Smrgdnl $1 = application icon. This can be a list, and is not optional. 41110bd37d32Smrgdnl $2 = default theme (defaults to hicolor) 41120bd37d32Smrgdnl $3 = formats (defaults to list [.svg .png .xpm]) 41130bd37d32Smrgdnl $4 = alternate icon if no theme is used (defaults to $1). 41140bd37d32Smrgdnl 41150bd37d32Smrgdnl Result: 4116f2e35a3aSmrgdnl ICON_NAME = basename of first item in $1, unless already set 41170bd37d32Smrgdnl ICON_LIST = reprocessed $1 41180bd37d32Smrgdnl ICON_THEME = reprocessed $2 41190bd37d32Smrgdnl ICON_FORMAT = reprocessed $3 41200bd37d32SmrgAC_DEFUN([CF_WITH_ICON_THEME], 41210bd37d32Smrg[ 41220bd37d32Smrgifelse([$1],,[ 41230bd37d32Smrg AC_MSG_ERROR([macro [CF_WITH_ICON_THEME] requires application-icon name]) 41240bd37d32Smrg],[ 41250bd37d32Smrg 41260bd37d32SmrgCF_WITH_PIXMAPDIR 41270bd37d32SmrgCF_WITH_ICONDIR 41280bd37d32Smrg 41290bd37d32SmrgAC_MSG_CHECKING(if icon theme should be used) 41300bd37d32SmrgAC_ARG_WITH(icon-theme, 413104b94745Smrg [[ --with-icon-theme[=XXX] install icons into desktop theme (hicolor)]], 41320bd37d32Smrg [ICON_THEME=$withval], 41330bd37d32Smrg [ICON_THEME=no]) 41340bd37d32Smrg 413501037d57Smrgcase "x$ICON_THEME" in 413601037d57Smrg(xno) 41370bd37d32Smrg ;; 413801037d57Smrg(x|xyes) 41390bd37d32Smrg ICON_THEME=ifelse([$2],,hicolor,$2) 41400bd37d32Smrg ;; 41410bd37d32Smrgesac 41420bd37d32SmrgAC_MSG_RESULT($ICON_THEME) 41430bd37d32Smrg 41440bd37d32Smrgif test "x$ICON_THEME" = xno 41450bd37d32Smrgthen 41460bd37d32Smrg if test "x$ICONDIR" != xno 41470bd37d32Smrg then 41480bd37d32Smrg CF_VERBOSE(ignoring icondir without theme) 41490bd37d32Smrg no_icondir="#" 41500bd37d32Smrg fi 41510bd37d32Smrgelse 41520bd37d32Smrg if test "x$ICONDIR" = xno 41530bd37d32Smrg then 41540bd37d32Smrg AC_MSG_ERROR(icondir must be set for icon theme) 41550bd37d32Smrg fi 41560bd37d32Smrgfi 41570bd37d32Smrg 41580bd37d32Smrg: ${ICON_FORMAT:=ifelse([$3],,[".svg .png .xpm"],[$3])} 41590bd37d32Smrg 41600bd37d32SmrgICON_LIST= 41610bd37d32Smrg 41620bd37d32Smrgifelse([$4],,[cf_icon_list=$1],[ 41630bd37d32Smrgif test "x$ICON_THEME" != xno 41640bd37d32Smrgthen 41650bd37d32Smrg cf_icon_list="$1" 41660bd37d32Smrgelse 41670bd37d32Smrg cf_icon_list="$4" 41680bd37d32Smrgfi 41690bd37d32Smrg]) 41700bd37d32Smrg 41710bd37d32SmrgAC_MSG_CHECKING([for icon(s) to install]) 41720bd37d32Smrgfor cf_name in $cf_icon_list 41730bd37d32Smrgdo 41740bd37d32Smrg CF_VERBOSE(using $ICON_FORMAT) 41750bd37d32Smrg for cf_suffix in $ICON_FORMAT 41760bd37d32Smrg do 41770bd37d32Smrg cf_icon="${cf_name}${cf_suffix}" 41780bd37d32Smrg cf_left=`echo "$cf_icon" | sed -e 's/:.*//'` 41790bd37d32Smrg if test ! -f "${cf_left}" 41800bd37d32Smrg then 41810bd37d32Smrg if test "x$srcdir" != "x." 41820bd37d32Smrg then 41830bd37d32Smrg cf_icon="${srcdir}/${cf_left}" 41840bd37d32Smrg cf_left=`echo "$cf_icon" | sed -e 's/:.*//'` 41850bd37d32Smrg if test ! -f "${cf_left}" 41860bd37d32Smrg then 41870bd37d32Smrg continue 41880bd37d32Smrg fi 41890bd37d32Smrg else 41900bd37d32Smrg continue 41910bd37d32Smrg fi 41920bd37d32Smrg fi 41930bd37d32Smrg if test "x$ICON_THEME" != xno 41940bd37d32Smrg then 4195f2e35a3aSmrg cf_base=`basename "$cf_left"` 41960bd37d32Smrg cf_trim=`echo "$cf_base" | sed -e 's/_[[0-9]][[0-9]]x[[0-9]][[0-9]]\././'` 419701037d57Smrg case "x${cf_base}" in 419801037d57Smrg (*:*) 41990bd37d32Smrg cf_next=$cf_base 42000bd37d32Smrg # user-defined mapping 42010bd37d32Smrg ;; 420201037d57Smrg (*.png) 42030bd37d32Smrg 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'` 42040bd37d32Smrg if test -z "$cf_size" 42050bd37d32Smrg then 42060bd37d32Smrg AC_MSG_WARN(cannot determine size of $cf_left) 42070bd37d32Smrg continue 42080bd37d32Smrg fi 42090bd37d32Smrg cf_next="$cf_size/apps/$cf_trim" 42100bd37d32Smrg ;; 421101037d57Smrg (*.svg) 42120bd37d32Smrg cf_next="scalable/apps/$cf_trim" 42130bd37d32Smrg ;; 421401037d57Smrg (*.xpm) 42150bd37d32Smrg CF_VERBOSE(ignored XPM file in icon theme) 42160bd37d32Smrg continue 42170bd37d32Smrg ;; 421801037d57Smrg (*_[[0-9]][[0-9]]*x[[0-9]][[0-9]]*.*) 42190bd37d32Smrg cf_size=`echo "$cf_left"|sed -e 's/^.*_\([[0-9]][[0-9]]*x[[0-9]][[0-9]]*\)\..*$/\1/'` 42200bd37d32Smrg cf_left=`echo "$cf_left"|sed -e 's/^\(.*\)_\([[0-9]][[0-9]]*x[[0-9]][[0-9]]*\)\(\..*\)$/\1\3/'` 42210bd37d32Smrg cf_next="$cf_size/apps/$cf_base" 42220bd37d32Smrg ;; 42230bd37d32Smrg esac 42240bd37d32Smrg CF_VERBOSE(adding $cf_next) 42250bd37d32Smrg cf_icon="${cf_icon}:${cf_next}" 42260bd37d32Smrg fi 42270bd37d32Smrg test -n "$ICON_LIST" && ICON_LIST="$ICON_LIST " 42280bd37d32Smrg ICON_LIST="$ICON_LIST${cf_icon}" 42290bd37d32Smrg if test -z "$ICON_NAME" 42300bd37d32Smrg then 4231f2e35a3aSmrg ICON_NAME=`basename "$cf_icon" | sed -e 's/[[.:]].*//'` 42320bd37d32Smrg fi 42330bd37d32Smrg done 42340bd37d32Smrgdone 42350bd37d32Smrg 42360bd37d32Smrgif test -n "$verbose" 42370bd37d32Smrgthen 42380bd37d32Smrg AC_MSG_CHECKING(result) 42390bd37d32Smrgfi 42400bd37d32SmrgAC_MSG_RESULT($ICON_LIST) 42410bd37d32Smrg 42420bd37d32Smrgif test -z "$ICON_LIST" 42430bd37d32Smrgthen 42440bd37d32Smrg AC_MSG_ERROR(no icons found) 42450bd37d32Smrgfi 42460bd37d32Smrg]) 42470bd37d32Smrg 42480bd37d32SmrgAC_MSG_CHECKING(for icon name) 42490bd37d32SmrgAC_MSG_RESULT($ICON_NAME) 42500bd37d32Smrg 42510bd37d32SmrgAC_SUBST(ICON_FORMAT) 42520bd37d32SmrgAC_SUBST(ICON_THEME) 42530bd37d32SmrgAC_SUBST(ICON_LIST) 42540bd37d32SmrgAC_SUBST(ICON_NAME) 42550bd37d32Smrg])dnl 42560bd37d32Smrgdnl --------------------------------------------------------------------------- 42574419d26bSmrgdnl CF_WITH_IMAKE_CFLAGS version: 12 updated: 2022/02/24 17:10:03 4258d522f475Smrgdnl -------------------- 4259d522f475Smrgdnl xterm and similar programs build more readily when propped up with imake's 4260d522f475Smrgdnl hand-tuned definitions. If we do not use imake, provide fallbacks for the 4261d522f475Smrgdnl most common definitions that we're not likely to do by autoconf tests. 4262d522f475SmrgAC_DEFUN([CF_WITH_IMAKE_CFLAGS],[ 4263d522f475SmrgAC_REQUIRE([CF_ENABLE_NARROWPROTO]) 4264d522f475Smrg 4265d522f475SmrgAC_MSG_CHECKING(if we should use imake to help) 4266d522f475SmrgCF_ARG_DISABLE(imake, 4267d522f475Smrg [ --disable-imake disable use of imake for definitions], 4268d522f475Smrg [enable_imake=no], 4269d522f475Smrg [enable_imake=yes]) 4270d522f475SmrgAC_MSG_RESULT($enable_imake) 4271d522f475Smrg 4272d522f475Smrgif test "$enable_imake" = yes ; then 427320d2c4d2Smrg CF_IMAKE_CFLAGS(ifelse([$1],,,[$1])) 4274d522f475Smrgfi 4275d522f475Smrg 4276d522f475Smrgif test -n "$IMAKE" && test -n "$IMAKE_CFLAGS" ; then 4277d522f475Smrg CF_ADD_CFLAGS($IMAKE_CFLAGS) 4278d522f475Smrgelse 4279d522f475Smrg IMAKE_CFLAGS= 4280d522f475Smrg IMAKE_LOADFLAGS= 4281d522f475Smrg CF_VERBOSE(make fallback definitions) 4282d522f475Smrg 4283d522f475Smrg # We prefer config.guess' values when we can get them, to avoid 4284d522f475Smrg # inconsistent results with uname (AIX for instance). However, 4285d522f475Smrg # config.guess is not always consistent either. 4286d522f475Smrg case $host_os in 428701037d57Smrg (*[[0-9]].[[0-9]]*) 4288d522f475Smrg UNAME_RELEASE="$host_os" 4289d522f475Smrg ;; 429001037d57Smrg (*) 4291d522f475Smrg UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown 4292d522f475Smrg ;; 4293d522f475Smrg esac 4294d522f475Smrg 4295d522f475Smrg case .$UNAME_RELEASE in 429601037d57Smrg (*[[0-9]].[[0-9]]*) 4297d522f475Smrg OSMAJORVERSION=`echo "$UNAME_RELEASE" |sed -e 's/^[[^0-9]]*//' -e 's/\..*//'` 4298d522f475Smrg OSMINORVERSION=`echo "$UNAME_RELEASE" |sed -e 's/^[[^0-9]]*//' -e 's/^[[^.]]*\.//' -e 's/\..*//' -e 's/[[^0-9]].*//' ` 4299d522f475Smrg test -z "$OSMAJORVERSION" && OSMAJORVERSION=1 4300d522f475Smrg test -z "$OSMINORVERSION" && OSMINORVERSION=0 4301d522f475Smrg IMAKE_CFLAGS="-DOSMAJORVERSION=$OSMAJORVERSION -DOSMINORVERSION=$OSMINORVERSION $IMAKE_CFLAGS" 4302d522f475Smrg ;; 4303d522f475Smrg esac 4304d522f475Smrg 4305d522f475Smrg # FUNCPROTO is standard with X11R6, but XFree86 drops it, leaving some 4306d522f475Smrg # fallback/fragments for NeedPrototypes, etc. 4307d522f475Smrg IMAKE_CFLAGS="-DFUNCPROTO=15 $IMAKE_CFLAGS" 4308d522f475Smrg 4309d522f475Smrg # If this is not set properly, Xaw's scrollbars will not work 4310d522f475Smrg if test "$enable_narrowproto" = yes ; then 4311d522f475Smrg IMAKE_CFLAGS="-DNARROWPROTO=1 $IMAKE_CFLAGS" 4312d522f475Smrg fi 4313d522f475Smrg 4314d522f475Smrg # Other special definitions: 4315d522f475Smrg case $host_os in 431601037d57Smrg (aix*) 4317d522f475Smrg # imake on AIX 5.1 defines AIXV3. really. 4318d522f475Smrg IMAKE_CFLAGS="-DAIXV3 -DAIXV4 $IMAKE_CFLAGS" 4319d522f475Smrg ;; 432001037d57Smrg (irix[[56]].*) 4321d522f475Smrg # these are needed to make SIGWINCH work in xterm 4322d522f475Smrg IMAKE_CFLAGS="-DSYSV -DSVR4 $IMAKE_CFLAGS" 4323d522f475Smrg ;; 4324d522f475Smrg esac 4325d522f475Smrg 43264419d26bSmrg # "modern" systems install X applications in /usr/bin. Other systems may 43274419d26bSmrg # use one of the X release-based directories. 43284419d26bSmrg case "$CFLAGS $CPPFLAGS $IMAKE_CFLAGS" in 43294419d26bSmrg (*-DPROJECTROOT*) 43304419d26bSmrg ;; 43314419d26bSmrg (*) 43324419d26bSmrg for cf_dir in /usr/X11R7 /usr/X11R6 /usr/X11R5 43334419d26bSmrg do 43344419d26bSmrg if test -d "$cf_dir/bin" 43354419d26bSmrg then 43364419d26bSmrg IMAKE_CFLAGS="$IMAKE_CFLAGS -DPROJECTROOT=\\\"$cf_dir\\\"" 43374419d26bSmrg break 43384419d26bSmrg fi 43394419d26bSmrg done 43404419d26bSmrg ;; 43414419d26bSmrg esac 43424419d26bSmrg 4343d522f475Smrg CF_ADD_CFLAGS($IMAKE_CFLAGS) 4344d522f475Smrg 4345d522f475Smrg AC_SUBST(IMAKE_CFLAGS) 4346d522f475Smrg AC_SUBST(IMAKE_LOADFLAGS) 4347d522f475Smrgfi 4348d522f475Smrg])dnl 4349d522f475Smrgdnl --------------------------------------------------------------------------- 435004b94745Smrgdnl CF_WITH_MAN2HTML version: 13 updated: 2023/11/23 06:40:35 435101037d57Smrgdnl ---------------- 4352f2e35a3aSmrgdnl Check for man2html and groff. Prefer man2html over groff, but use groff 4353f2e35a3aSmrgdnl as a fallback. See 4354f2e35a3aSmrgdnl 4355f2e35a3aSmrgdnl http://invisible-island.net/scripts/man2html.html 4356f2e35a3aSmrgdnl 435701037d57Smrgdnl Generate a shell script which hides the differences between the two. 435801037d57Smrgdnl 435901037d57Smrgdnl We name that "man2html.tmp". 436001037d57Smrgdnl 436101037d57Smrgdnl The shell script can be removed later, e.g., using "make distclean". 436201037d57SmrgAC_DEFUN([CF_WITH_MAN2HTML],[ 4363f2e35a3aSmrgAC_REQUIRE([CF_PROG_GROFF])dnl 4364f2e35a3aSmrgAC_REQUIRE([AC_PROG_FGREP])dnl 4365f2e35a3aSmrg 4366f2e35a3aSmrgcase "x${with_man2html}" in 4367f2e35a3aSmrg(xno) 4368f2e35a3aSmrg cf_man2html=no 4369f2e35a3aSmrg ;; 4370f2e35a3aSmrg(x|xyes) 4371f2e35a3aSmrg AC_PATH_PROG(cf_man2html,man2html,no) 4372f2e35a3aSmrg case "x$cf_man2html" in 4373f2e35a3aSmrg (x/*) 4374f2e35a3aSmrg AC_MSG_CHECKING(for the modified Earl Hood script) 4375f2e35a3aSmrg if ( $cf_man2html -help 2>&1 | grep 'Make an index of headers at the end' >/dev/null ) 4376f2e35a3aSmrg then 4377f2e35a3aSmrg cf_man2html_ok=yes 4378f2e35a3aSmrg else 4379f2e35a3aSmrg cf_man2html=no 4380f2e35a3aSmrg cf_man2html_ok=no 4381f2e35a3aSmrg fi 4382f2e35a3aSmrg AC_MSG_RESULT($cf_man2html_ok) 4383f2e35a3aSmrg ;; 4384f2e35a3aSmrg (*) 4385f2e35a3aSmrg cf_man2html=no 4386f2e35a3aSmrg ;; 4387f2e35a3aSmrg esac 4388f2e35a3aSmrgesac 438901037d57Smrg 439001037d57SmrgAC_MSG_CHECKING(for program to convert manpage to html) 439101037d57SmrgAC_ARG_WITH(man2html, 439204b94745Smrg [[ --with-man2html[=XXX] use XXX rather than groff]], 439301037d57Smrg [cf_man2html=$withval], 4394f2e35a3aSmrg [cf_man2html=$cf_man2html]) 439501037d57Smrg 439601037d57Smrgcf_with_groff=no 439701037d57Smrg 439801037d57Smrgcase $cf_man2html in 439901037d57Smrg(yes) 440001037d57Smrg AC_MSG_RESULT(man2html) 440101037d57Smrg AC_PATH_PROG(cf_man2html,man2html,no) 440201037d57Smrg ;; 440301037d57Smrg(no|groff|*/groff*) 440401037d57Smrg cf_with_groff=yes 440501037d57Smrg cf_man2html=$GROFF_PATH 440601037d57Smrg AC_MSG_RESULT($cf_man2html) 440701037d57Smrg ;; 440801037d57Smrg(*) 440901037d57Smrg AC_MSG_RESULT($cf_man2html) 441001037d57Smrg ;; 441101037d57Smrgesac 441201037d57Smrg 441301037d57SmrgMAN2HTML_TEMP="man2html.tmp" 441401037d57Smrg cat >$MAN2HTML_TEMP <<CF_EOF 44152e4f8982Smrg#!$SHELL 441601037d57Smrg# Temporary script generated by CF_WITH_MAN2HTML 441701037d57Smrg# Convert inputs to html, sending result to standard output. 441801037d57Smrg# 441901037d57Smrg# Parameters: 44202e4f8982Smrg# \${1} = rootname of file to convert 44212e4f8982Smrg# \${2} = suffix of file to convert, e.g., "1" 44222e4f8982Smrg# \${3} = macros to use, e.g., "man" 442301037d57Smrg# 442401037d57SmrgROOT=\[$]1 442501037d57SmrgTYPE=\[$]2 442601037d57SmrgMACS=\[$]3 442701037d57Smrg 442801037d57Smrgunset LANG 442901037d57Smrgunset LC_ALL 443001037d57Smrgunset LC_CTYPE 443101037d57Smrgunset LANGUAGE 443201037d57SmrgGROFF_NO_SGR=stupid 443301037d57Smrgexport GROFF_NO_SGR 443401037d57Smrg 443501037d57SmrgCF_EOF 443601037d57Smrg 4437f2e35a3aSmrgNROFF_OPTS= 443801037d57Smrgif test "x$cf_with_groff" = xyes 443901037d57Smrgthen 444001037d57Smrg MAN2HTML_NOTE="$GROFF_NOTE" 444101037d57Smrg MAN2HTML_PATH="$GROFF_PATH" 444201037d57Smrg cat >>$MAN2HTML_TEMP <<CF_EOF 4443f2e35a3aSmrg$SHELL -c "$TBL_PATH \${ROOT}.\${TYPE} | $GROFF_PATH -P -o0 -I\${ROOT}_ -Thtml -\${MACS}" 444401037d57SmrgCF_EOF 444501037d57Smrgelse 4446f2e35a3aSmrg # disable hyphenation if this is groff 4447f2e35a3aSmrg if test "x$GROFF_PATH" != xno 4448f2e35a3aSmrg then 4449f2e35a3aSmrg AC_MSG_CHECKING(if nroff is really groff) 4450f2e35a3aSmrg cf_check_groff="`$NROFF_PATH --version 2>/dev/null | grep groff`" 4451f2e35a3aSmrg test -n "$cf_check_groff" && cf_check_groff=yes 4452f2e35a3aSmrg test -n "$cf_check_groff" || cf_check_groff=no 4453f2e35a3aSmrg AC_MSG_RESULT($cf_check_groff) 4454f2e35a3aSmrg test "x$cf_check_groff" = xyes && NROFF_OPTS="-rHY=0" 4455f2e35a3aSmrg fi 445601037d57Smrg MAN2HTML_NOTE="" 445701037d57Smrg CF_PATH_SYNTAX(cf_man2html) 445801037d57Smrg MAN2HTML_PATH="$cf_man2html" 445901037d57Smrg AC_MSG_CHECKING(for $cf_man2html top/bottom margins) 446001037d57Smrg 446101037d57Smrg # for this example, expect 3 lines of content, the remainder is head/foot 446201037d57Smrg cat >conftest.in <<CF_EOF 446301037d57Smrg.TH HEAD1 HEAD2 HEAD3 HEAD4 HEAD5 446401037d57Smrg.SH SECTION 446501037d57SmrgMARKER 446601037d57SmrgCF_EOF 446701037d57Smrg 4468f2e35a3aSmrg LC_ALL=C LC_CTYPE=C LANG=C LANGUAGE=C $NROFF_PATH -man conftest.in >conftest.out 446901037d57Smrg 4470f2e35a3aSmrg cf_man2html_1st="`${FGREP-fgrep} -n MARKER conftest.out |sed -e 's/^[[^0-9]]*://' -e 's/:.*//'`" 4471f2e35a3aSmrg cf_man2html_top=`expr "$cf_man2html_1st" - 2` 4472f2e35a3aSmrg cf_man2html_bot="`wc -l conftest.out |sed -e 's/[[^0-9]]//g'`" 4473f2e35a3aSmrg cf_man2html_bot=`expr "$cf_man2html_bot" - 2 - "$cf_man2html_top"` 447401037d57Smrg cf_man2html_top_bot="-topm=$cf_man2html_top -botm=$cf_man2html_bot" 447501037d57Smrg 447601037d57Smrg AC_MSG_RESULT($cf_man2html_top_bot) 447701037d57Smrg 447801037d57Smrg AC_MSG_CHECKING(for pagesize to use) 447901037d57Smrg for cf_block in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 448001037d57Smrg do 448101037d57Smrg cat >>conftest.in <<CF_EOF 448201037d57Smrg.nf 448301037d57Smrg0 448401037d57Smrg1 448501037d57Smrg2 448601037d57Smrg3 448701037d57Smrg4 448801037d57Smrg5 448901037d57Smrg6 449001037d57Smrg7 449101037d57Smrg8 449201037d57Smrg9 449301037d57SmrgCF_EOF 449401037d57Smrg done 449501037d57Smrg 4496f2e35a3aSmrg LC_ALL=C LC_CTYPE=C LANG=C LANGUAGE=C $NROFF_PATH -man conftest.in >conftest.out 4497f2e35a3aSmrg cf_man2html_page="`${FGREP-fgrep} -n HEAD1 conftest.out |sed -n '$p' |sed -e 's/^[[^0-9]]*://' -e 's/:.*//'`" 449801037d57Smrg test -z "$cf_man2html_page" && cf_man2html_page=99999 449901037d57Smrg test "$cf_man2html_page" -gt 100 && cf_man2html_page=99999 450001037d57Smrg 450101037d57Smrg rm -rf conftest* 450201037d57Smrg AC_MSG_RESULT($cf_man2html_page) 450301037d57Smrg 450401037d57Smrg cat >>$MAN2HTML_TEMP <<CF_EOF 450501037d57Smrg: \${MAN2HTML_PATH=$MAN2HTML_PATH} 4506f2e35a3aSmrgMAN2HTML_OPTS="\$MAN2HTML_OPTS -index -title=\"\$ROOT(\$TYPE)\" -compress -pgsize $cf_man2html_page" 450701037d57Smrgcase \${TYPE} in 450801037d57Smrg(ms) 4509f2e35a3aSmrg $TBL_PATH \${ROOT}.\${TYPE} | $NROFF_PATH $NROFF_OPTS -\${MACS} | \$MAN2HTML_PATH -topm=0 -botm=0 \$MAN2HTML_OPTS 451001037d57Smrg ;; 451101037d57Smrg(*) 4512f2e35a3aSmrg $TBL_PATH \${ROOT}.\${TYPE} | $NROFF_PATH $NROFF_OPTS -\${MACS} | \$MAN2HTML_PATH $cf_man2html_top_bot \$MAN2HTML_OPTS 451301037d57Smrg ;; 451401037d57Smrgesac 451501037d57SmrgCF_EOF 451601037d57Smrgfi 451701037d57Smrg 451801037d57Smrgchmod 700 $MAN2HTML_TEMP 451901037d57Smrg 452001037d57SmrgAC_SUBST(MAN2HTML_NOTE) 452101037d57SmrgAC_SUBST(MAN2HTML_PATH) 452201037d57SmrgAC_SUBST(MAN2HTML_TEMP) 452301037d57Smrg])dnl 452401037d57Smrgdnl --------------------------------------------------------------------------- 4525f2e35a3aSmrgdnl CF_WITH_PCRE version: 12 updated: 2017/07/29 22:57:34 4526d522f475Smrgdnl ------------ 4527d522f475Smrgdnl Add PCRE (Perl-compatible regular expressions) to the build if it is 4528d522f475Smrgdnl available and the user requests it. Assume the application will otherwise 4529d522f475Smrgdnl use the POSIX interface. 4530d522f475Smrgdnl 4531d522f475Smrgdnl TODO allow $withval to specify package location 4532d522f475SmrgAC_DEFUN([CF_WITH_PCRE], 4533d522f475Smrg[ 453420d2c4d2SmrgAC_REQUIRE([CF_PKG_CONFIG]) 453520d2c4d2Smrg 4536d522f475SmrgAC_MSG_CHECKING(if you want to use PCRE for regular-expressions) 4537d522f475SmrgAC_ARG_WITH(pcre, 4538d522f475Smrg [ --with-pcre use PCRE for regular-expressions]) 4539d522f475Smrgtest -z "$with_pcre" && with_pcre=no 4540d522f475SmrgAC_MSG_RESULT($with_pcre) 4541d522f475Smrg 4542d522f475Smrgif test "$with_pcre" != no ; then 454320d2c4d2Smrg CF_TRY_PKG_CONFIG(libpcre,,[ 454420d2c4d2Smrg AC_CHECK_LIB(pcre,pcre_compile,, 454520d2c4d2Smrg AC_MSG_ERROR(Cannot find PCRE library))]) 454620d2c4d2Smrg 4547f2e35a3aSmrg AC_DEFINE(HAVE_LIB_PCRE,1,[Define to 1 if we can/should compile with the PCRE library]) 454820d2c4d2Smrg 4549f2e35a3aSmrg case $LIBS in 4550f2e35a3aSmrg (*pcreposix*) 4551f2e35a3aSmrg ;; 4552f2e35a3aSmrg (*) 4553f2e35a3aSmrg AC_CHECK_LIB(pcreposix,pcreposix_regcomp, 4554f2e35a3aSmrg [AC_DEFINE(HAVE_PCREPOSIX_H,1,[Define to 1 if we should include pcreposix.h]) 4555f2e35a3aSmrg CF_ADD_LIB(pcreposix)], 4556f2e35a3aSmrg [AC_CHECK_LIB(pcreposix,regcomp,[ 4557f2e35a3aSmrg AC_DEFINE(HAVE_PCREPOSIX_H,1,[Define to 1 if we should include pcreposix.h]) 4558f2e35a3aSmrg CF_ADD_LIB(pcreposix)], 4559f2e35a3aSmrg AC_MSG_ERROR(Cannot find PCRE POSIX library)])) 4560f2e35a3aSmrg ;; 4561f2e35a3aSmrg esac 4562f2e35a3aSmrgfi 4563f2e35a3aSmrg])dnl 4564f2e35a3aSmrgdnl --------------------------------------------------------------------------- 4565a5ae21e4Smrgdnl CF_WITH_PCRE2 version: 6 updated: 2021/08/11 20:35:34 4566f2e35a3aSmrgdnl ------------- 4567f2e35a3aSmrgdnl Add PCRE2 (Perl-compatible regular expressions v2) to the build if it is 4568f2e35a3aSmrgdnl available and the user requests it. Assume the application will otherwise 4569f2e35a3aSmrgdnl use the POSIX interface. 4570f2e35a3aSmrgdnl 4571f2e35a3aSmrgdnl TODO allow $withval to specify package location 4572f2e35a3aSmrgAC_DEFUN([CF_WITH_PCRE2], 4573f2e35a3aSmrg[ 4574f2e35a3aSmrgAC_REQUIRE([CF_PKG_CONFIG]) 4575f2e35a3aSmrg 4576f2e35a3aSmrgAC_MSG_CHECKING(if you want to use PCRE2 for regular-expressions) 4577f2e35a3aSmrgAC_ARG_WITH(pcre2, 4578f2e35a3aSmrg [ --with-pcre2 use PCRE2 for regular-expressions]) 4579f2e35a3aSmrgtest -z "$with_pcre2" && with_pcre2=no 4580f2e35a3aSmrgAC_MSG_RESULT($with_pcre2) 4581f2e35a3aSmrg 4582f2e35a3aSmrgif test "x$with_pcre2" != xno ; then 4583f2e35a3aSmrg cf_with_pcre2_ok=no 4584f2e35a3aSmrg for cf_with_pcre2 in libpcre2 libpcre2-posix libpcre 4585f2e35a3aSmrg do 4586f2e35a3aSmrg CF_TRY_PKG_CONFIG($cf_with_pcre2,[cf_with_pcre2_ok=yes; break]) 4587f2e35a3aSmrg done 4588f2e35a3aSmrg cf_with_pcre2_ok=yes || AC_MSG_ERROR(Cannot find PCRE2 library) 4589f2e35a3aSmrg 4590f2e35a3aSmrg AC_DEFINE(HAVE_LIB_PCRE2,1,[Define to 1 if we can/should compile with the PCRE2 library]) 4591f2e35a3aSmrg 4592f2e35a3aSmrg # if pkgconfig gave no results, look for the libraries directly 4593f2e35a3aSmrg case "$LIBS" in 4594f2e35a3aSmrg (*pcre2-posix*|*pcreposix*) 4595f2e35a3aSmrg ;; 4596f2e35a3aSmrg (*) 4597f2e35a3aSmrg AC_CHECK_LIB(pcre2-posix,regcomp,[ 4598f2e35a3aSmrg CF_ADD_LIB(pcre2-posix)], 4599f2e35a3aSmrg [AC_CHECK_LIB(pcreposix,regcomp,[ 4600f2e35a3aSmrg CF_ADD_LIB(pcreposix) 4601f2e35a3aSmrg ],[AC_MSG_ERROR(Cannot find PCRE2 POSIX library)])]) 4602f2e35a3aSmrg ;; 4603f2e35a3aSmrg esac 4604f2e35a3aSmrg 4605f2e35a3aSmrg # either way, check for the library header files 4606f2e35a3aSmrg AC_CHECK_HEADERS(pcre2posix.h pcreposix.h) 4607a5ae21e4Smrg AC_CHECK_FUNCS(PCRE2regcomp) 4608d522f475Smrgfi 4609d522f475Smrg])dnl 4610d522f475Smrgdnl --------------------------------------------------------------------------- 46110bd37d32Smrgdnl CF_WITH_PIXMAPDIR version: 3 updated: 2012/07/22 09:18:02 46120bd37d32Smrgdnl ----------------- 46130bd37d32Smrgdnl Handle configure option "--with-pixmapdir", setting these shell variables: 46140bd37d32Smrgdnl 46150bd37d32Smrgdnl $PIXMAPDIR is the option value, used for installing pixmap files. 46160bd37d32Smrgdnl $no_pixmapdir is a "#" (comment) if "--without-pixmapdir" is given. 46170bd37d32SmrgAC_DEFUN([CF_WITH_PIXMAPDIR],[ 46180bd37d32SmrgAC_MSG_CHECKING(for directory to install pixmaps) 46190bd37d32SmrgAC_ARG_WITH(pixmapdir, 46200bd37d32Smrg [ --with-pixmapdir=DIR directory in which to install pixmaps (DATADIR/pixmaps)], 46210bd37d32Smrg [PIXMAPDIR=$withval], 46220bd37d32Smrg [test -z "$PIXMAPDIR" && PIXMAPDIR='${datadir}/pixmaps']) 46230bd37d32Smrg 46240bd37d32Smrgif test "x[$]PIXMAPDIR" = xauto 46250bd37d32Smrgthen 46260bd37d32Smrg PIXMAPDIR='${datadir}/pixmaps' 46270bd37d32Smrg for cf_path in \ 46280bd37d32Smrg /usr/share/pixmaps \ 46290bd37d32Smrg /usr/X11R6/share/pixmaps 46300bd37d32Smrg do 46310bd37d32Smrg if test -d "$cf_path" ; then 46320bd37d32Smrg PIXMAPDIR="$cf_path" 46330bd37d32Smrg break 46340bd37d32Smrg fi 46350bd37d32Smrg done 46360bd37d32Smrgelse 46370bd37d32Smrg cf_path=$PIXMAPDIR 46380bd37d32Smrg CF_PATH_SYNTAX(cf_path) 46390bd37d32Smrgfi 46400bd37d32SmrgAC_MSG_RESULT($PIXMAPDIR) 46410bd37d32SmrgAC_SUBST(PIXMAPDIR) 46420bd37d32Smrg 46430bd37d32Smrgno_pixmapdir= 46440bd37d32Smrgif test "$PIXMAPDIR" = no 46450bd37d32Smrgthen 46460bd37d32Smrg no_pixmapdir="#" 46470bd37d32Smrgelse 46480bd37d32Smrg EXTRA_INSTALL_DIRS="$EXTRA_INSTALL_DIRS \$(PIXMAPDIR)" 46490bd37d32Smrgfi 46500bd37d32SmrgAC_SUBST(no_pixmapdir) 46510bd37d32Smrg])dnl 46520bd37d32Smrgdnl --------------------------------------------------------------------------- 465304b94745Smrgdnl CF_WITH_UTMP_PATH version: 1 updated: 2023/09/04 16:05:17 465404b94745Smrgdnl ----------------- 465504b94745Smrgdnl utmp and wtmp have different pathnames on different systems, but there 465604b94745Smrgdnl are only a few common choices. Note that they may not necessarily appear 465704b94745Smrgdnl in the same directories. Prefer utmpx/wtmpx to utmp/wtmp, since that's 465804b94745Smrgdnl the way the configure script is designed. 465904b94745SmrgAC_DEFUN([CF_WITH_UTMP_PATH],[ 466004b94745SmrgAC_ARG_WITH(utmp-path, 466104b94745Smrg [ --with-utmp-path=XXX use XXX rather than auto for utmp path], 466204b94745Smrg [cf_utmp_path=$withval], 466304b94745Smrg [cf_utmp_path=auto]) 466404b94745Smrgif test "$cf_utmp_path" = auto ; then 466504b94745Smrg for cf_utmp_path in /etc/utmp /var/adm/utmp /var/log/utmp /var/run/utmp 466604b94745Smrg do 466704b94745Smrg if test -f ${cf_utmp_path}x ; then 466804b94745Smrg cf_utmp_path=${cf_utmp_path}x 466904b94745Smrg break 467004b94745Smrg elif test -f $cf_utmp_path ; then 467104b94745Smrg break 467204b94745Smrg fi 467304b94745Smrg done 467404b94745Smrgelse 467504b94745Smrg CF_PATH_SYNTAX(cf_utmp_path) 467604b94745Smrgfi 467704b94745SmrgUTMP_PATH=$cf_utmp_path 467804b94745SmrgUTMP_NAME=`echo "$cf_utmp_path" | sed -e 's,^.*/,,'` 467904b94745SmrgAC_SUBST(UTMP_NAME) 468004b94745SmrgAC_SUBST(UTMP_PATH) 468104b94745Smrg])dnl 468204b94745Smrgdnl --------------------------------------------------------------------------- 46830bd37d32Smrgdnl CF_WITH_VALGRIND version: 1 updated: 2006/12/14 18:00:21 46840bd37d32Smrgdnl ---------------- 46850bd37d32SmrgAC_DEFUN([CF_WITH_VALGRIND],[ 46860bd37d32SmrgCF_NO_LEAKS_OPTION(valgrind, 46870bd37d32Smrg [ --with-valgrind test: use valgrind], 46880bd37d32Smrg [USE_VALGRIND]) 46890bd37d32Smrg])dnl 46900bd37d32Smrgdnl --------------------------------------------------------------------------- 469104b94745Smrgdnl CF_WITH_WTMP_PATH version: 2 updated: 2023/10/02 17:22:48 469204b94745Smrgdnl ----------------- 469304b94745Smrgdnl Like CF_WITH_UTMP_PATH, but for the wtmp file. 469404b94745SmrgAC_DEFUN([CF_WITH_WTMP_PATH],[ 469504b94745SmrgAC_ARG_WITH(wtmp-path, 469604b94745Smrg [ --with-wtmp-path=XXX use XXX rather than auto for wtmp path], 469704b94745Smrg [cf_wtmp_path=$withval], 469804b94745Smrg [cf_wtmp_path=auto]) 469904b94745Smrgif test "$cf_wtmp_path" = auto ; then 470004b94745Smrg for cf_wtmp_path in /etc/wtmp /var/adm/wtmp /var/run/wtmp /var/log/wtmp 470104b94745Smrg do 470204b94745Smrg if test -f ${cf_wtmp_path}x ; then 470304b94745Smrg cf_wtmp_path=${cf_wtmp_path}x 470404b94745Smrg break 470504b94745Smrg elif test -f $cf_wtmp_path/wtmp ; then 470604b94745Smrg break 470704b94745Smrg fi 470804b94745Smrg done 470904b94745Smrgelse 471004b94745Smrg CF_PATH_SYNTAX(cf_wtmp_path) 471104b94745Smrgfi 471204b94745SmrgWTMP_PATH=$cf_wtmp_path 471304b94745SmrgWTMP_NAME=`echo "$cf_wtmp_path" | sed -e 's,^.*/,,'` 471404b94745SmrgAC_SUBST(WTMP_NAME) 471504b94745SmrgAC_SUBST(WTMP_PATH) 471604b94745Smrg])dnl 471704b94745Smrgdnl --------------------------------------------------------------------------- 47182e4f8982Smrgdnl CF_WITH_XINERAMA version: 1 updated: 2016/05/28 14:41:12 47192e4f8982Smrgdnl ---------------- 47202e4f8982SmrgAC_DEFUN([CF_WITH_XINERAMA], 47212e4f8982Smrg[ 47222e4f8982SmrgAC_MSG_CHECKING(if you want to use the Xinerama extension) 47232e4f8982SmrgAC_ARG_WITH(xinerama, 47242e4f8982Smrg[ --without-xinerama do not use Xinerama extension for multiscreen support], 47252e4f8982Smrg [cf_with_xinerama="$withval"], 47262e4f8982Smrg [cf_with_xinerama=yes]) 47272e4f8982SmrgAC_MSG_RESULT($cf_with_xinerama) 47282e4f8982Smrgif test "$cf_with_xinerama" = yes; then 47292e4f8982Smrg CF_XINERAMA 47302e4f8982Smrgfi 47312e4f8982Smrg])dnl 47322e4f8982Smrgdnl --------------------------------------------------------------------------- 473304b94745Smrgdnl CF_WITH_XPM version: 4 updated: 2023/11/23 06:40:35 47340bd37d32Smrgdnl ----------- 47350bd37d32Smrgdnl Test for Xpm library, update compiler/loader flags if it is wanted and 47360bd37d32Smrgdnl found. 47370bd37d32Smrgdnl 47380bd37d32Smrgdnl Also sets ICON_SUFFIX 47390bd37d32SmrgAC_DEFUN([CF_WITH_XPM], 47400bd37d32Smrg[ 47410bd37d32SmrgICON_SUFFIX=.xbm 47420bd37d32Smrg 47430bd37d32Smrgcf_save_cppflags="${CPPFLAGS}" 47440bd37d32Smrgcf_save_ldflags="${LDFLAGS}" 47450bd37d32Smrg 47460bd37d32SmrgAC_MSG_CHECKING(if you want to use the Xpm library for colored icon) 47470bd37d32SmrgAC_ARG_WITH(xpm, 474804b94745Smrg[[ --with-xpm[=DIR] use Xpm library for colored icon, may specify path]], 47490bd37d32Smrg [cf_Xpm_library="$withval"], 47500bd37d32Smrg [cf_Xpm_library=yes]) 47510bd37d32SmrgAC_MSG_RESULT($cf_Xpm_library) 47520bd37d32Smrg 47530bd37d32Smrgif test "$cf_Xpm_library" != no ; then 47540bd37d32Smrg if test "$cf_Xpm_library" != yes ; then 47550bd37d32Smrg CPPFLAGS="$CPPFLAGS -I$withval/include" 47560bd37d32Smrg LDFLAGS="$LDFLAGS -L$withval/lib" 47570bd37d32Smrg fi 47580bd37d32Smrg AC_CHECK_HEADER(X11/xpm.h,[ 47590bd37d32Smrg AC_CHECK_LIB(Xpm, XpmCreatePixmapFromData,[ 47600bd37d32Smrg AC_DEFINE(HAVE_LIBXPM,1,[Define to 1 if we should use Xpm library]) 47610bd37d32Smrg ICON_SUFFIX=.xpm 47620bd37d32Smrg LIBS="-lXpm $LIBS"], 47630bd37d32Smrg [CPPFLAGS="${cf_save_cppflags}" LDFLAGS="${cf_save_ldflags}"], 47640bd37d32Smrg [-lX11 $X_LIBS])], 47650bd37d32Smrg [CPPFLAGS="${cf_save_cppflags}" LDFLAGS="${cf_save_ldflags}"]) 47660bd37d32Smrgfi 47670bd37d32Smrg 47680bd37d32SmrgAC_SUBST(ICON_SUFFIX) 47690bd37d32Smrg])dnl 47700bd37d32Smrgdnl --------------------------------------------------------------------------- 477101037d57Smrgdnl CF_XBOOL_RESULT version: 3 updated: 2015/04/12 15:39:00 47720bd37d32Smrgdnl --------------- 47730bd37d32Smrgdnl Translate an autoconf boolean yes/no into X11's booleans, e.g., True/False. 47740bd37d32Smrgdnl Allow for more than two values, e.g., "maybe", still using the same leading 47750bd37d32Smrgdnl capital convention. 47760bd37d32Smrgdnl 47770bd37d32Smrgdnl $1 = symbol to define 47780bd37d32Smrgdnl $2 = symbol holding value 47790bd37d32Smrgdnl $3 = description 47800bd37d32Smrgdefine([CF_XBOOL_RESULT],[ 47810bd37d32SmrgAC_MSG_RESULT([$]$2) 478201037d57Smrgcase [$]$2 in 478301037d57Smrg(yes) 47840bd37d32Smrg $2=true 47850bd37d32Smrg ;; 478601037d57Smrg(no) 47870bd37d32Smrg $2=false 47880bd37d32Smrg ;; 47890bd37d32Smrgesac 47900bd37d32Smrgcf_xbool1=`echo "[$]$2"|sed -e 's/^\(.\).*/\1/'` 47910bd37d32SmrgCF_UPPER(cf_xbool1,$cf_xbool1) 47920bd37d32Smrgcf_xbool2=`echo "[$]$2"|sed -e 's/^.//'` 47930bd37d32Smrg$2=${cf_xbool1}${cf_xbool2} 47940bd37d32SmrgAC_DEFINE_UNQUOTED($1,[$]$2,$3) 47950bd37d32SmrgAC_SUBST($2) 47960bd37d32Smrg]) 47970bd37d32Smrgdnl --------------------------------------------------------------------------- 479801037d57Smrgdnl CF_XINERAMA version: 2 updated: 2015/02/15 15:18:41 479901037d57Smrgdnl ----------- 480001037d57SmrgAC_DEFUN([CF_XINERAMA],[ 480101037d57SmrgCF_TRY_PKG_CONFIG(xinerama,[ 480201037d57Smrg AC_DEFINE(HAVE_X11_EXTENSIONS_XINERAMA_H)],[ 480301037d57Smrg AC_CHECK_LIB(Xinerama,XineramaQueryScreens, 480401037d57Smrg [CF_ADD_LIB(Xinerama) 480501037d57Smrg AC_CHECK_HEADERS( \ 480601037d57Smrg X11/extensions/Xinerama.h \ 480701037d57Smrg ) 480801037d57Smrg ]) 480901037d57Smrg ]) 481001037d57Smrg])dnl 481101037d57Smrgdnl --------------------------------------------------------------------------- 481204b94745Smrgdnl CF_XKB_BELL_EXT version: 7 updated: 2023/12/01 17:22:50 4813d522f475Smrgdnl --------------- 4814d522f475Smrgdnl Check for XKB bell extension 4815d522f475SmrgAC_DEFUN([CF_XKB_BELL_EXT],[ 4816f2e35a3aSmrgAC_REQUIRE([AC_PATH_XTRA]) 4817f2e35a3aSmrg 4818f2e35a3aSmrgCF_SAVE_XTRA_FLAGS([CF_XKB_BELL_EXT]) 4819f2e35a3aSmrg 4820d522f475SmrgAC_CACHE_CHECK(for XKB Bell extension, cf_cv_xkb_bell_ext,[ 4821d522f475SmrgAC_TRY_LINK([ 4822956cc18dSsnj#include <X11/Intrinsic.h> 4823d522f475Smrg#include <X11/XKBlib.h> /* has the prototype */ 4824d522f475Smrg#include <X11/extensions/XKBbells.h> /* has the XkbBI_xxx definitions */ 4825d522f475Smrg],[ 4826956cc18dSsnj int x = (XkbBI_Info |XkbBI_MinorError |XkbBI_MajorError |XkbBI_TerminalBell |XkbBI_MarginBell); 4827f2e35a3aSmrg Atom y = 0; 4828f2e35a3aSmrg (void)x; 482904b94745Smrg XkbBell((Display *)0, (Window)0, 0, y); 4830d522f475Smrg],[cf_cv_xkb_bell_ext=yes],[cf_cv_xkb_bell_ext=no]) 4831d522f475Smrg]) 48320bd37d32Smrgtest "$cf_cv_xkb_bell_ext" = yes && AC_DEFINE(HAVE_XKB_BELL_EXT,1,[Define 1 if we have XKB Bell extension]) 4833f2e35a3aSmrg 4834f2e35a3aSmrgCF_RESTORE_XTRA_FLAGS([CF_XKB_BELL_EXT]) 48350bd37d32Smrg]) 48360bd37d32Smrgdnl --------------------------------------------------------------------------- 4837f2e35a3aSmrgdnl CF_XKB_KEYCODE_TO_KEYSYM version: 3 updated: 2020/03/10 18:53:47 48380bd37d32Smrgdnl ------------------------ 48390bd37d32Smrgdnl Some older vendor-unix systems made a practice of delivering fragments of 48400bd37d32Smrgdnl Xkb, requiring test-compiles. 48410bd37d32SmrgAC_DEFUN([CF_XKB_KEYCODE_TO_KEYSYM],[ 48420bd37d32SmrgAC_CACHE_CHECK(if we can use XkbKeycodeToKeysym, cf_cv_xkb_keycode_to_keysym,[ 48430bd37d32SmrgAC_TRY_COMPILE([ 48440bd37d32Smrg#include <X11/Xlib.h> 48450bd37d32Smrg#include <X11/XKBlib.h> 48460bd37d32Smrg],[ 48470bd37d32Smrg KeySym keysym = XkbKeycodeToKeysym((Display *)0, 0, 0, 0); 4848f2e35a3aSmrg (void)keysym; 48490bd37d32Smrg],[ 48500bd37d32Smrgcf_cv_xkb_keycode_to_keysym=yes 48510bd37d32Smrg],[ 48520bd37d32Smrgcf_cv_xkb_keycode_to_keysym=no 48530bd37d32Smrg]) 48540bd37d32Smrg]) 48550bd37d32Smrg 48560bd37d32Smrgif test $cf_cv_xkb_keycode_to_keysym = yes 48570bd37d32Smrgthen 48580bd37d32Smrg AC_CHECK_FUNCS(XkbKeycodeToKeysym) 48590bd37d32Smrgfi 48600bd37d32Smrg]) 48610bd37d32Smrgdnl --------------------------------------------------------------------------- 48620bd37d32Smrgdnl CF_XKB_QUERY_EXTENSION version: 2 updated: 2012/09/28 20:23:46 48630bd37d32Smrgdnl ---------------------- 48640bd37d32Smrgdnl see ifdef in scrollbar.c - iron out here 48650bd37d32SmrgAC_DEFUN([CF_XKB_QUERY_EXTENSION],[ 48660bd37d32SmrgAC_CACHE_CHECK(if we can use XkbQueryExtension, cf_cv_xkb_query_extension,[ 48670bd37d32SmrgAC_TRY_COMPILE([ 48680bd37d32Smrg#include <X11/Xlib.h> 48690bd37d32Smrg#include <X11/extensions/XKB.h> 48700bd37d32Smrg#include <X11/XKBlib.h> 48710bd37d32Smrg],[ 48720bd37d32Smrg int xkbmajor = XkbMajorVersion; 48730bd37d32Smrg int xkbminor = XkbMinorVersion; 48740bd37d32Smrg int xkbopcode, xkbevent, xkberror; 48750bd37d32Smrg 48760bd37d32Smrg if (XkbLibraryVersion(&xkbmajor, &xkbminor) 48770bd37d32Smrg && XkbQueryExtension((Display *)0, 48780bd37d32Smrg &xkbopcode, 48790bd37d32Smrg &xkbevent, 48800bd37d32Smrg &xkberror, 48810bd37d32Smrg &xkbmajor, 48820bd37d32Smrg &xkbminor)) 48830bd37d32Smrg return 0; 48840bd37d32Smrg],[ 48850bd37d32Smrgcf_cv_xkb_query_extension=yes 48860bd37d32Smrg],[ 48870bd37d32Smrgcf_cv_xkb_query_extension=no 48880bd37d32Smrg]) 48890bd37d32Smrg]) 48900bd37d32Smrg 48910bd37d32Smrgif test $cf_cv_xkb_query_extension = yes 48920bd37d32Smrgthen 48930bd37d32Smrg AC_CHECK_FUNCS(XkbQueryExtension) 48940bd37d32Smrgfi 4895d522f475Smrg]) 4896d522f475Smrgdnl --------------------------------------------------------------------------- 489704b94745Smrgdnl CF_XOPEN_SOURCE version: 67 updated: 2023/09/06 18:55:27 4898d522f475Smrgdnl --------------- 4899d522f475Smrgdnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions, 4900d522f475Smrgdnl or adapt to the vendor's definitions to get equivalent functionality, 4901d522f475Smrgdnl without losing the common non-POSIX features. 4902d522f475Smrgdnl 4903d522f475Smrgdnl Parameters: 4904d522f475Smrgdnl $1 is the nominal value for _XOPEN_SOURCE 4905d522f475Smrgdnl $2 is the nominal value for _POSIX_C_SOURCE 490604b94745Smrgdnl 490704b94745Smrgdnl The default case prefers _XOPEN_SOURCE over _POSIX_C_SOURCE if the 490804b94745Smrgdnl implementation predefines it, because X/Open and most implementations agree 490904b94745Smrgdnl that the latter is a legacy or "aligned" value. 491004b94745Smrgdnl 491104b94745Smrgdnl Because _XOPEN_SOURCE is preferred, if defining _POSIX_C_SOURCE turns 491204b94745Smrgdnl that off, then refrain from setting _POSIX_C_SOURCE explicitly. 491304b94745Smrgdnl 491404b94745Smrgdnl References: 491504b94745Smrgdnl https://pubs.opengroup.org/onlinepubs/007904975/functions/xsh_chap02_02.html 491604b94745Smrgdnl https://docs.oracle.com/cd/E19253-01/816-5175/standards-5/index.html 491704b94745Smrgdnl https://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html 4918d522f475SmrgAC_DEFUN([CF_XOPEN_SOURCE],[ 49190bd37d32SmrgAC_REQUIRE([AC_CANONICAL_HOST]) 4920f2e35a3aSmrgAC_REQUIRE([CF_POSIX_VISIBLE]) 4921f2e35a3aSmrg 4922f2e35a3aSmrgif test "$cf_cv_posix_visible" = no; then 4923d522f475Smrg 492420d2c4d2Smrgcf_XOPEN_SOURCE=ifelse([$1],,500,[$1]) 492520d2c4d2Smrgcf_POSIX_C_SOURCE=ifelse([$2],,199506L,[$2]) 492620d2c4d2Smrgcf_xopen_source= 4927d522f475Smrg 4928f2e35a3aSmrgcase "$host_os" in 492901037d57Smrg(aix[[4-7]]*) 493020d2c4d2Smrg cf_xopen_source="-D_ALL_SOURCE" 493120d2c4d2Smrg ;; 493201037d57Smrg(darwin[[0-8]].*) 493320d2c4d2Smrg cf_xopen_source="-D_APPLE_C_SOURCE" 493420d2c4d2Smrg ;; 493501037d57Smrg(darwin*) 493620d2c4d2Smrg cf_xopen_source="-D_DARWIN_C_SOURCE" 49370bd37d32Smrg cf_XOPEN_SOURCE= 4938d522f475Smrg ;; 4939f2e35a3aSmrg(freebsd*|dragonfly*|midnightbsd*) 4940d522f475Smrg # 5.x headers associate 4941d522f475Smrg # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L 4942d522f475Smrg # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L 4943d522f475Smrg cf_POSIX_C_SOURCE=200112L 4944d522f475Smrg cf_XOPEN_SOURCE=600 494520d2c4d2Smrg cf_xopen_source="-D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" 494620d2c4d2Smrg ;; 494701037d57Smrg(hpux11*) 494820d2c4d2Smrg cf_xopen_source="-D_HPUX_SOURCE -D_XOPEN_SOURCE=500" 4949d522f475Smrg ;; 495001037d57Smrg(hpux*) 495120d2c4d2Smrg cf_xopen_source="-D_HPUX_SOURCE" 4952d522f475Smrg ;; 495301037d57Smrg(irix[[56]].*) 495420d2c4d2Smrg cf_xopen_source="-D_SGI_SOURCE" 49550bd37d32Smrg cf_XOPEN_SOURCE= 4956d522f475Smrg ;; 495704b94745Smrg(linux*gnu|linux*gnuabi64|linux*gnuabin32|linux*gnueabi|linux*gnueabihf|linux*gnux32|uclinux*|gnu*|mint*|k*bsd*-gnu|cygwin|msys|mingw*|linux*uclibc) 4958f2e35a3aSmrg CF_GNU_SOURCE($cf_XOPEN_SOURCE) 4959d522f475Smrg ;; 496001037d57Smrg(minix*) 496101037d57Smrg cf_xopen_source="-D_NETBSD_SOURCE" # POSIX.1-2001 features are ifdef'd with this... 496201037d57Smrg ;; 496301037d57Smrg(mirbsd*) 49640bd37d32Smrg # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <sys/select.h> and other headers which use u_int / u_short types 49650bd37d32Smrg cf_XOPEN_SOURCE= 49660bd37d32Smrg CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE) 4967d522f475Smrg ;; 496801037d57Smrg(netbsd*) 49690bd37d32Smrg cf_xopen_source="-D_NETBSD_SOURCE" # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw 49700bd37d32Smrg ;; 4971ae137402Smrg(openbsd[[6-9]]*) 4972ae137402Smrg # OpenBSD 6.x has broken locale support, both compile-time and runtime. 4973ae137402Smrg # see https://www.mail-archive.com/bugs@openbsd.org/msg13200.html 4974ae137402Smrg # Abusing the conformance level is a workaround. 4975ae137402Smrg AC_MSG_WARN(this system does not provide usable locale support) 4976ae137402Smrg cf_xopen_source="-D_BSD_SOURCE" 4977ae137402Smrg cf_XOPEN_SOURCE=700 4978ae137402Smrg ;; 4979ae137402Smrg(openbsd[[4-5]]*) 49800bd37d32Smrg # setting _XOPEN_SOURCE lower than 500 breaks g++ compile with wchar.h, needed for ncursesw 49810bd37d32Smrg cf_xopen_source="-D_BSD_SOURCE" 49820bd37d32Smrg cf_XOPEN_SOURCE=600 4983d522f475Smrg ;; 498401037d57Smrg(openbsd*) 4985d522f475Smrg # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw 4986d522f475Smrg ;; 498701037d57Smrg(osf[[45]]*) 498820d2c4d2Smrg cf_xopen_source="-D_OSF_SOURCE" 4989d522f475Smrg ;; 499001037d57Smrg(nto-qnx*) 499120d2c4d2Smrg cf_xopen_source="-D_QNX_SOURCE" 4992d522f475Smrg ;; 499301037d57Smrg(sco*) 4994d522f475Smrg # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer 4995d522f475Smrg ;; 499601037d57Smrg(solaris2.*) 499720d2c4d2Smrg cf_xopen_source="-D__EXTENSIONS__" 4998894e0ac8Smrg cf_cv_xopen_source=broken 4999d522f475Smrg ;; 500001037d57Smrg(sysv4.2uw2.*) # Novell/SCO UnixWare 2.x (tested on 2.1.2) 500101037d57Smrg cf_XOPEN_SOURCE= 500201037d57Smrg cf_POSIX_C_SOURCE= 500301037d57Smrg ;; 500401037d57Smrg(*) 50050bd37d32Smrg CF_TRY_XOPEN_SOURCE 50065307cd1aSmrg cf_save_xopen_cppflags="$CPPFLAGS" 5007d522f475Smrg CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE) 50085307cd1aSmrg # Some of these niche implementations use copy/paste, double-check... 500904b94745Smrg if test "$cf_cv_xopen_source" = no ; then 501004b94745Smrg CF_VERBOSE(checking if _POSIX_C_SOURCE interferes with _XOPEN_SOURCE) 50115307cd1aSmrg AC_TRY_COMPILE(CF__XOPEN_SOURCE_HEAD,CF__XOPEN_SOURCE_BODY,,[ 50125307cd1aSmrg AC_MSG_WARN(_POSIX_C_SOURCE definition is not usable) 50135307cd1aSmrg CPPFLAGS="$cf_save_xopen_cppflags"]) 50145307cd1aSmrg fi 5015d522f475Smrg ;; 5016d522f475Smrgesac 501720d2c4d2Smrg 501820d2c4d2Smrgif test -n "$cf_xopen_source" ; then 5019a5ae21e4Smrg CF_APPEND_CFLAGS($cf_xopen_source,true) 502020d2c4d2Smrgfi 50210bd37d32Smrg 50220bd37d32Smrgdnl In anything but the default case, we may have system-specific setting 50230bd37d32Smrgdnl which is still not guaranteed to provide all of the entrypoints that 50240bd37d32Smrgdnl _XOPEN_SOURCE would yield. 50250bd37d32Smrgif test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then 50260bd37d32Smrg AC_MSG_CHECKING(if _XOPEN_SOURCE really is set) 50270bd37d32Smrg AC_TRY_COMPILE([#include <stdlib.h>],[ 50280bd37d32Smrg#ifndef _XOPEN_SOURCE 50295307cd1aSmrg#error _XOPEN_SOURCE is not defined 50300bd37d32Smrg#endif], 50310bd37d32Smrg [cf_XOPEN_SOURCE_set=yes], 50320bd37d32Smrg [cf_XOPEN_SOURCE_set=no]) 50330bd37d32Smrg AC_MSG_RESULT($cf_XOPEN_SOURCE_set) 5034f2e35a3aSmrg if test "$cf_XOPEN_SOURCE_set" = yes 50350bd37d32Smrg then 50360bd37d32Smrg AC_TRY_COMPILE([#include <stdlib.h>],[ 50370bd37d32Smrg#if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE 50385307cd1aSmrg#error (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE 50390bd37d32Smrg#endif], 50400bd37d32Smrg [cf_XOPEN_SOURCE_set_ok=yes], 50410bd37d32Smrg [cf_XOPEN_SOURCE_set_ok=no]) 5042f2e35a3aSmrg if test "$cf_XOPEN_SOURCE_set_ok" = no 50430bd37d32Smrg then 50440bd37d32Smrg AC_MSG_WARN(_XOPEN_SOURCE is lower than requested) 50450bd37d32Smrg fi 50460bd37d32Smrg else 50470bd37d32Smrg CF_TRY_XOPEN_SOURCE 50480bd37d32Smrg fi 50490bd37d32Smrgfi 5050f2e35a3aSmrgfi # cf_cv_posix_visible 5051d522f475Smrg]) 5052d522f475Smrgdnl --------------------------------------------------------------------------- 50535307cd1aSmrgdnl CF_X_ATHENA version: 25 updated: 2023/01/11 04:05:23 5054d522f475Smrgdnl ----------- 5055d522f475Smrgdnl Check for Xaw (Athena) libraries 5056d522f475Smrgdnl 5057d522f475Smrgdnl Sets $cf_x_athena according to the flavor of Xaw which is used. 5058d522f475SmrgAC_DEFUN([CF_X_ATHENA], 505920d2c4d2Smrg[ 50606879286fSmrgcf_x_athena=${cf_x_athena:-Xaw} 5061d522f475Smrg 5062d522f475SmrgAC_MSG_CHECKING(if you want to link with Xaw 3d library) 5063d522f475Smrgwithval= 5064d522f475SmrgAC_ARG_WITH(Xaw3d, 5065d522f475Smrg [ --with-Xaw3d link with Xaw 3d library]) 5066d522f475Smrgif test "$withval" = yes ; then 5067d522f475Smrg cf_x_athena=Xaw3d 5068d522f475Smrg AC_MSG_RESULT(yes) 5069d522f475Smrgelse 5070d522f475Smrg AC_MSG_RESULT(no) 5071d522f475Smrgfi 5072d522f475Smrg 507301037d57SmrgAC_MSG_CHECKING(if you want to link with Xaw 3d xft library) 507401037d57Smrgwithval= 507501037d57SmrgAC_ARG_WITH(Xaw3dxft, 507601037d57Smrg [ --with-Xaw3dxft link with Xaw 3d xft library]) 507701037d57Smrgif test "$withval" = yes ; then 507801037d57Smrg cf_x_athena=Xaw3dxft 507901037d57Smrg AC_MSG_RESULT(yes) 508001037d57Smrgelse 508101037d57Smrg AC_MSG_RESULT(no) 508201037d57Smrgfi 508301037d57Smrg 5084d522f475SmrgAC_MSG_CHECKING(if you want to link with neXT Athena library) 5085d522f475Smrgwithval= 5086d522f475SmrgAC_ARG_WITH(neXtaw, 5087d522f475Smrg [ --with-neXtaw link with neXT Athena library]) 5088d522f475Smrgif test "$withval" = yes ; then 5089d522f475Smrg cf_x_athena=neXtaw 5090d522f475Smrg AC_MSG_RESULT(yes) 5091d522f475Smrgelse 5092d522f475Smrg AC_MSG_RESULT(no) 5093d522f475Smrgfi 5094d522f475Smrg 5095d522f475SmrgAC_MSG_CHECKING(if you want to link with Athena-Plus library) 5096d522f475Smrgwithval= 5097d522f475SmrgAC_ARG_WITH(XawPlus, 5098d522f475Smrg [ --with-XawPlus link with Athena-Plus library]) 5099d522f475Smrgif test "$withval" = yes ; then 5100d522f475Smrg cf_x_athena=XawPlus 5101d522f475Smrg AC_MSG_RESULT(yes) 5102d522f475Smrgelse 5103d522f475Smrg AC_MSG_RESULT(no) 5104d522f475Smrgfi 5105d522f475Smrg 5106d522f475Smrgcf_x_athena_lib="" 5107d522f475Smrg 510820d2c4d2Smrgif test "$PKG_CONFIG" != none ; then 510920d2c4d2Smrg cf_athena_list= 511020d2c4d2Smrg test "$cf_x_athena" = Xaw && cf_athena_list="xaw8 xaw7 xaw6" 511120d2c4d2Smrg for cf_athena_pkg in \ 511220d2c4d2Smrg $cf_athena_list \ 511320d2c4d2Smrg ${cf_x_athena} \ 511420d2c4d2Smrg ${cf_x_athena}-devel \ 511520d2c4d2Smrg lib${cf_x_athena} \ 511620d2c4d2Smrg lib${cf_x_athena}-devel 511720d2c4d2Smrg do 511820d2c4d2Smrg CF_TRY_PKG_CONFIG($cf_athena_pkg,[ 511920d2c4d2Smrg cf_x_athena_lib="$cf_pkgconfig_libs" 512020d2c4d2Smrg CF_UPPER(cf_x_athena_LIBS,HAVE_LIB_$cf_x_athena) 512120d2c4d2Smrg AC_DEFINE_UNQUOTED($cf_x_athena_LIBS) 51226879286fSmrg 5123e0a2b6dfSmrg CF_TRIM_X_LIBS 5124e0a2b6dfSmrg 51256879286fSmrgAC_CACHE_CHECK(for usable $cf_x_athena/Xmu package,cf_cv_xaw_compat,[ 51266879286fSmrgAC_TRY_LINK([ 51275307cd1aSmrg$ac_includes_default 51286879286fSmrg#include <X11/Xmu/CharSet.h> 51296879286fSmrg],[ 5130f2e35a3aSmrgint check = XmuCompareISOLatin1("big", "small"); 5131f2e35a3aSmrg(void)check; 51326879286fSmrg],[cf_cv_xaw_compat=yes],[cf_cv_xaw_compat=no])]) 51336879286fSmrg 51346879286fSmrg if test "$cf_cv_xaw_compat" = no 51356879286fSmrg then 51366879286fSmrg # workaround for broken ".pc" files... 513701037d57Smrg case "$cf_x_athena_lib" in 513801037d57Smrg (*-lXmu*) 51396879286fSmrg ;; 514001037d57Smrg (*) 51416879286fSmrg CF_VERBOSE(work around broken package) 5142e0a2b6dfSmrg cf_save_xmu="$LIBS" 5143e0a2b6dfSmrg cf_first_lib=`echo "$cf_save_xmu" | sed -e 's/^[ ][ ]*//' -e 's/ .*//'` 5144e0a2b6dfSmrg CF_TRY_PKG_CONFIG(xmu,[ 5145e0a2b6dfSmrg LIBS="$cf_save_xmu" 5146e0a2b6dfSmrg CF_ADD_LIB_AFTER($cf_first_lib,$cf_pkgconfig_libs) 5147e0a2b6dfSmrg ],[ 5148e0a2b6dfSmrg CF_ADD_LIB_AFTER($cf_first_lib,-lXmu) 5149e0a2b6dfSmrg ]) 5150e0a2b6dfSmrg CF_TRIM_X_LIBS 51516879286fSmrg ;; 51526879286fSmrg esac 51536879286fSmrg fi 51546879286fSmrg 515520d2c4d2Smrg break]) 515620d2c4d2Smrg done 515720d2c4d2Smrgfi 515820d2c4d2Smrg 515920d2c4d2Smrgif test -z "$cf_x_athena_lib" ; then 516020d2c4d2Smrg CF_X_EXT 516120d2c4d2Smrg CF_X_TOOLKIT 516220d2c4d2Smrg CF_X_ATHENA_CPPFLAGS($cf_x_athena) 516320d2c4d2Smrg CF_X_ATHENA_LIBS($cf_x_athena) 516420d2c4d2Smrgfi 5165d522f475Smrg])dnl 5166d522f475Smrgdnl --------------------------------------------------------------------------- 5167f2e35a3aSmrgdnl CF_X_ATHENA_CPPFLAGS version: 9 updated: 2020/12/31 10:54:15 5168d522f475Smrgdnl -------------------- 5169d522f475Smrgdnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of 5170d522f475Smrgdnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw. 5171d522f475SmrgAC_DEFUN([CF_X_ATHENA_CPPFLAGS], 5172d522f475Smrg[ 5173f2e35a3aSmrgAC_REQUIRE([AC_PATH_XTRA]) 517420d2c4d2Smrgcf_x_athena_root=ifelse([$1],,Xaw,[$1]) 517520d2c4d2Smrgcf_x_athena_inc="" 5176d522f475Smrg 5177d522f475Smrgfor cf_path in default \ 5178d522f475Smrg /usr/contrib/X11R6 \ 5179d522f475Smrg /usr/contrib/X11R5 \ 5180d522f475Smrg /usr/lib/X11R5 \ 5181d522f475Smrg /usr/local 5182d522f475Smrgdo 518320d2c4d2Smrg if test -z "$cf_x_athena_inc" ; then 5184f2e35a3aSmrg CF_SAVE_XTRA_FLAGS([CF_X_ATHENA_CPPFLAGS]) 5185d522f475Smrg cf_test=X11/$cf_x_athena_root/SimpleMenu.h 5186f2e35a3aSmrg if test "$cf_path" != default ; then 5187f2e35a3aSmrg CF_APPEND_TEXT(CPPFLAGS,-I$cf_path/include) 5188d522f475Smrg AC_MSG_CHECKING(for $cf_test in $cf_path) 5189d522f475Smrg else 5190d522f475Smrg AC_MSG_CHECKING(for $cf_test) 5191d522f475Smrg fi 5192d522f475Smrg AC_TRY_COMPILE([ 5193d522f475Smrg#include <X11/Intrinsic.h> 5194d522f475Smrg#include <$cf_test>],[], 5195d522f475Smrg [cf_result=yes], 5196d522f475Smrg [cf_result=no]) 5197d522f475Smrg AC_MSG_RESULT($cf_result) 5198f2e35a3aSmrg CF_RESTORE_XTRA_FLAGS([CF_X_ATHENA_CPPFLAGS]) 5199d522f475Smrg if test "$cf_result" = yes ; then 5200f2e35a3aSmrg test "$cf_path" = default && cf_x_athena_inc=default 5201f2e35a3aSmrg test "$cf_path" != default && cf_x_athena_inc="$cf_path/include" 5202d522f475Smrg break 5203d522f475Smrg fi 5204d522f475Smrg fi 5205d522f475Smrgdone 5206d522f475Smrg 520720d2c4d2Smrgif test -z "$cf_x_athena_inc" ; then 5208f2e35a3aSmrg AC_MSG_WARN([Unable to find Athena header files]) 520920d2c4d2Smrgelif test "$cf_x_athena_inc" != default ; then 5210f2e35a3aSmrg CF_APPEND_TEXT(CPPFLAGS,-I$cf_x_athena_inc) 5211d522f475Smrgfi 5212d522f475Smrg]) 5213d522f475Smrgdnl --------------------------------------------------------------------------- 52145307cd1aSmrgdnl CF_X_ATHENA_LIBS version: 14 updated: 2023/01/11 04:05:23 5215d522f475Smrgdnl ---------------- 5216d522f475Smrgdnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of 5217d522f475Smrgdnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw. 5218d522f475SmrgAC_DEFUN([CF_X_ATHENA_LIBS], 5219d522f475Smrg[AC_REQUIRE([CF_X_TOOLKIT]) 522020d2c4d2Smrgcf_x_athena_root=ifelse([$1],,Xaw,[$1]) 5221d522f475Smrgcf_x_athena_lib="" 5222d522f475Smrg 5223d522f475Smrgfor cf_path in default \ 5224d522f475Smrg /usr/contrib/X11R6 \ 5225d522f475Smrg /usr/contrib/X11R5 \ 5226d522f475Smrg /usr/lib/X11R5 \ 5227d522f475Smrg /usr/local 5228d522f475Smrgdo 5229d522f475Smrg for cf_lib in \ 52300bd37d32Smrg ${cf_x_athena_root} \ 52310bd37d32Smrg ${cf_x_athena_root}7 \ 52320bd37d32Smrg ${cf_x_athena_root}6 52330bd37d32Smrg do 52340bd37d32Smrg for cf_libs in \ 52350bd37d32Smrg "-l$cf_lib -lXmu" \ 52360bd37d32Smrg "-l$cf_lib -lXpm -lXmu" \ 52370bd37d32Smrg "-l${cf_lib}_s -lXmu_s" 5238d522f475Smrg do 5239f2e35a3aSmrg test -n "$cf_x_athena_lib" && break 5240f2e35a3aSmrg 5241f2e35a3aSmrg CF_SAVE_XTRA_FLAGS([CF_X_ATHENA_LIBS]) 5242f2e35a3aSmrg cf_test=XawSimpleMenuAddGlobalActions 5243f2e35a3aSmrg test "$cf_path" != default && cf_libs="-L$cf_path/lib $cf_libs" 5244f2e35a3aSmrg CF_ADD_LIBS($cf_libs) 5245f2e35a3aSmrg AC_MSG_CHECKING(for $cf_test in $cf_libs) 5246f2e35a3aSmrg AC_TRY_LINK([ 52475307cd1aSmrg$ac_includes_default 5248a1f3da82Smrg#include <X11/Intrinsic.h> 5249a1f3da82Smrg#include <X11/$cf_x_athena_root/SimpleMenu.h> 5250a1f3da82Smrg],[ 5251a1f3da82Smrg$cf_test((XtAppContext) 0)], 5252f2e35a3aSmrg [cf_result=yes], 5253f2e35a3aSmrg [cf_result=no]) 5254f2e35a3aSmrg AC_MSG_RESULT($cf_result) 5255f2e35a3aSmrg CF_RESTORE_XTRA_FLAGS([CF_X_ATHENA_LIBS]) 5256f2e35a3aSmrg 5257f2e35a3aSmrg if test "$cf_result" = yes ; then 5258f2e35a3aSmrg cf_x_athena_lib="$cf_libs" 5259f2e35a3aSmrg break 5260d522f475Smrg fi 52610bd37d32Smrg done # cf_libs 52620bd37d32Smrg test -n "$cf_x_athena_lib" && break 52630bd37d32Smrg done # cf_lib 5264d522f475Smrgdone 5265d522f475Smrg 5266d522f475Smrgif test -z "$cf_x_athena_lib" ; then 5267d522f475Smrg AC_MSG_ERROR( 5268d522f475Smrg[Unable to successfully link Athena library (-l$cf_x_athena_root) with test program]) 5269d522f475Smrgfi 5270d522f475Smrg 5271f2e35a3aSmrgCF_ADD_LIBS($cf_x_athena_lib) 5272d522f475SmrgCF_UPPER(cf_x_athena_LIBS,HAVE_LIB_$cf_x_athena) 5273d522f475SmrgAC_DEFINE_UNQUOTED($cf_x_athena_LIBS) 5274d522f475Smrg]) 5275d522f475Smrgdnl --------------------------------------------------------------------------- 527620d2c4d2Smrgdnl CF_X_EXT version: 3 updated: 2010/06/02 05:03:05 527720d2c4d2Smrgdnl -------- 527820d2c4d2SmrgAC_DEFUN([CF_X_EXT],[ 527920d2c4d2SmrgCF_TRY_PKG_CONFIG(Xext,,[ 528020d2c4d2Smrg AC_CHECK_LIB(Xext,XextCreateExtension, 528120d2c4d2Smrg [CF_ADD_LIB(Xext)])]) 528220d2c4d2Smrg])dnl 528320d2c4d2Smrgdnl --------------------------------------------------------------------------- 5284f2e35a3aSmrgdnl CF_X_EXT_DOUBLE_BUFFER version: 1 updated: 2019/07/18 21:09:40 5285f2e35a3aSmrgdnl ---------------------- 5286f2e35a3aSmrgAC_DEFUN([CF_X_EXT_DOUBLE_BUFFER],[ 5287f2e35a3aSmrgAC_REQUIRE([CF_X_EXT]) 5288f2e35a3aSmrgAC_CHECK_HEADER(X11/extensions/Xdbe.h, 5289f2e35a3aSmrg AC_DEFINE(HAVE_X11_EXTENSIONS_XDBE_H,1,[Define to 1 if we have X11/extensions/Xdbe.h]) 5290f2e35a3aSmrg AC_CHECK_FUNC(XdbeSwapBuffers, 5291f2e35a3aSmrg [AC_DEFINE(HAVE_XDBESWAPBUFFERS,1,[Define to 1 if we have XdbeSwapBuffers]) 5292f2e35a3aSmrg cf_x_ext_double_buffer=yes])) 5293f2e35a3aSmrg])dnl 5294f2e35a3aSmrgdnl --------------------------------------------------------------------------- 5295f2e35a3aSmrgdnl CF_X_FONTCONFIG version: 7 updated: 2020/03/10 18:53:47 52966879286fSmrgdnl --------------- 52976879286fSmrgdnl Check for fontconfig library, a dependency of the X FreeType library. 52986879286fSmrgAC_DEFUN([CF_X_FONTCONFIG], 52996879286fSmrg[ 53006879286fSmrgAC_REQUIRE([CF_X_FREETYPE]) 53016879286fSmrg 5302e39b573cSmrgif test "$cf_cv_found_freetype" = yes ; then 53036879286fSmrgAC_CACHE_CHECK(for usable Xft/fontconfig package,cf_cv_xft_compat,[ 53046879286fSmrgAC_TRY_LINK([ 53056879286fSmrg#include <X11/Xft/Xft.h> 53066879286fSmrg],[ 5307f2e35a3aSmrg XftPattern *pat = 0; 53086879286fSmrg XftPatternBuild(pat, 53096879286fSmrg XFT_FAMILY, XftTypeString, "mono", 53106879286fSmrg (void *) 0); 53116879286fSmrg],[cf_cv_xft_compat=yes],[cf_cv_xft_compat=no]) 53126879286fSmrg]) 53136879286fSmrg 53146879286fSmrgif test "$cf_cv_xft_compat" = no 53156879286fSmrgthen 53166879286fSmrg # workaround for broken ".pc" files used for Xft. 531701037d57Smrg case "$cf_cv_x_freetype_libs" in 531801037d57Smrg (*-lfontconfig*) 53196879286fSmrg ;; 532001037d57Smrg (*) 53216879286fSmrg CF_VERBOSE(work around broken package) 5322e0a2b6dfSmrg cf_save_fontconfig="$LIBS" 5323e0a2b6dfSmrg CF_TRY_PKG_CONFIG(fontconfig,[ 5324e0a2b6dfSmrg CF_ADD_CFLAGS($cf_pkgconfig_incs) 5325e0a2b6dfSmrg LIBS="$cf_save_fontconfig" 5326e0a2b6dfSmrg CF_ADD_LIB_AFTER(-lXft,$cf_pkgconfig_libs) 5327e0a2b6dfSmrg ],[ 5328e0a2b6dfSmrg CF_ADD_LIB_AFTER(-lXft,-lfontconfig) 5329e0a2b6dfSmrg ]) 53306879286fSmrg ;; 53316879286fSmrg esac 53326879286fSmrgfi 5333e39b573cSmrgfi 53346879286fSmrg])dnl 53356879286fSmrgdnl --------------------------------------------------------------------------- 5336f2e35a3aSmrgdnl CF_X_FREETYPE version: 28 updated: 2020/03/10 18:53:47 5337d522f475Smrgdnl ------------- 5338d522f475Smrgdnl Check for X FreeType headers and libraries (XFree86 4.x, etc). 5339d522f475Smrgdnl 5340d522f475Smrgdnl First check for the appropriate config program, since the developers for 5341d522f475Smrgdnl these libraries change their configuration (and config program) more or 5342d522f475Smrgdnl less randomly. If we cannot find the config program, do not bother trying 5343d522f475Smrgdnl to guess the latest variation of include/lib directories. 5344d522f475Smrgdnl 5345d522f475Smrgdnl If either or both of these configure-script options are not given, rely on 5346d522f475Smrgdnl the output of the config program to provide the cflags/libs options: 5347d522f475Smrgdnl --with-freetype-cflags 5348d522f475Smrgdnl --with-freetype-libs 5349d522f475SmrgAC_DEFUN([CF_X_FREETYPE], 5350d522f475Smrg[ 5351956cc18dSsnjAC_REQUIRE([CF_PKG_CONFIG]) 5352956cc18dSsnj 53530bd37d32Smrgcf_cv_x_freetype_incs=no 53540bd37d32Smrgcf_cv_x_freetype_libs=no 5355d522f475Smrgcf_extra_freetype_libs= 5356956cc18dSsnjFREETYPE_CONFIG=none 5357d522f475SmrgFREETYPE_PARAMS= 5358d522f475Smrg 53590bd37d32SmrgAC_MSG_CHECKING(for FreeType configuration script) 53600bd37d32SmrgAC_ARG_WITH(freetype-config, 53610bd37d32Smrg [ --with-freetype-config configure script to use for FreeType], 53620bd37d32Smrg [cf_cv_x_freetype_cfgs="$withval"], 53630bd37d32Smrg [cf_cv_x_freetype_cfgs=auto]) 53640bd37d32Smrgtest -z $cf_cv_x_freetype_cfgs && cf_cv_x_freetype_cfgs=auto 53650bd37d32Smrgtest $cf_cv_x_freetype_cfgs = no && cf_cv_x_freetype_cfgs=none 53660bd37d32SmrgAC_MSG_RESULT($cf_cv_x_freetype_cfgs) 53670bd37d32Smrg 53680bd37d32Smrgcase $cf_cv_x_freetype_cfgs in 536901037d57Smrg(none) 53700bd37d32Smrg AC_MSG_CHECKING(if you specified -D/-I options for FreeType) 53710bd37d32Smrg AC_ARG_WITH(freetype-cflags, 53720bd37d32Smrg [ --with-freetype-cflags -D/-I options for compiling with FreeType], 53730bd37d32Smrg [cf_cv_x_freetype_incs="$with_freetype_cflags"], 53740bd37d32Smrg [cf_cv_x_freetype_incs=no]) 53750bd37d32Smrg AC_MSG_RESULT($cf_cv_x_freetype_incs) 53760bd37d32Smrg 53770bd37d32Smrg AC_MSG_CHECKING(if you specified -L/-l options for FreeType) 53780bd37d32Smrg AC_ARG_WITH(freetype-libs, 53790bd37d32Smrg [ --with-freetype-libs -L/-l options to link FreeType], 53800bd37d32Smrg [cf_cv_x_freetype_libs="$with_freetype_libs"], 53810bd37d32Smrg [cf_cv_x_freetype_libs=no]) 53820bd37d32Smrg AC_MSG_RESULT($cf_cv_x_freetype_libs) 53830bd37d32Smrg ;; 538401037d57Smrg(auto) 53850bd37d32Smrg if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists xft; then 53860bd37d32Smrg FREETYPE_CONFIG=$PKG_CONFIG 53870bd37d32Smrg FREETYPE_PARAMS=xft 53880bd37d32Smrg else 53890bd37d32Smrg AC_PATH_PROG(FREETYPE_CONFIG, freetype-config, none) 53900bd37d32Smrg if test "$FREETYPE_CONFIG" != none; then 53910bd37d32Smrg FREETYPE_CONFIG=$FREETYPE_CONFIG 53920bd37d32Smrg cf_extra_freetype_libs="-lXft" 53930bd37d32Smrg else 53940bd37d32Smrg AC_PATH_PROG(FREETYPE_OLD_CONFIG, xft-config, none) 53950bd37d32Smrg if test "$FREETYPE_OLD_CONFIG" != none; then 53960bd37d32Smrg FREETYPE_CONFIG=$FREETYPE_OLD_CONFIG 53970bd37d32Smrg fi 53980bd37d32Smrg fi 53990bd37d32Smrg fi 54000bd37d32Smrg ;; 540101037d57Smrg(pkg*) 54020bd37d32Smrg if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists xft; then 54030bd37d32Smrg FREETYPE_CONFIG=$cf_cv_x_freetype_cfgs 54040bd37d32Smrg FREETYPE_PARAMS=xft 54050bd37d32Smrg else 54060bd37d32Smrg AC_MSG_WARN(cannot find pkg-config for Xft) 54070bd37d32Smrg fi 54080bd37d32Smrg ;; 540901037d57Smrg(*) 54100bd37d32Smrg AC_PATH_PROG(FREETYPE_XFT_CONFIG, $cf_cv_x_freetype_cfgs, none) 5411d522f475Smrg if test "$FREETYPE_XFT_CONFIG" != none; then 5412d522f475Smrg FREETYPE_CONFIG=$FREETYPE_XFT_CONFIG 5413d522f475Smrg else 54140bd37d32Smrg AC_MSG_WARN(cannot find config script for Xft) 5415d522f475Smrg fi 54160bd37d32Smrg ;; 54170bd37d32Smrgesac 5418d522f475Smrg 5419956cc18dSsnjif test "$FREETYPE_CONFIG" != none ; then 54200bd37d32Smrg AC_MSG_CHECKING(for FreeType config) 54210bd37d32Smrg AC_MSG_RESULT($FREETYPE_CONFIG $FREETYPE_PARAMS) 5422d522f475Smrg 5423956cc18dSsnj if test "$cf_cv_x_freetype_incs" = no ; then 5424956cc18dSsnj AC_MSG_CHECKING(for $FREETYPE_CONFIG cflags) 5425956cc18dSsnj cf_cv_x_freetype_incs="`$FREETYPE_CONFIG $FREETYPE_PARAMS --cflags 2>/dev/null`" 5426956cc18dSsnj AC_MSG_RESULT($cf_cv_x_freetype_incs) 5427956cc18dSsnj fi 5428d522f475Smrg 5429956cc18dSsnj if test "$cf_cv_x_freetype_libs" = no ; then 5430956cc18dSsnj AC_MSG_CHECKING(for $FREETYPE_CONFIG libs) 5431956cc18dSsnj cf_cv_x_freetype_libs="$cf_extra_freetype_libs `$FREETYPE_CONFIG $FREETYPE_PARAMS --libs 2>/dev/null`" 5432956cc18dSsnj AC_MSG_RESULT($cf_cv_x_freetype_libs) 5433956cc18dSsnj fi 5434d522f475Smrgfi 5435d522f475Smrg 5436d522f475Smrgif test "$cf_cv_x_freetype_incs" = no ; then 5437d522f475Smrg cf_cv_x_freetype_incs= 5438d522f475Smrgfi 5439d522f475Smrg 5440d522f475Smrgif test "$cf_cv_x_freetype_libs" = no ; then 5441d522f475Smrg cf_cv_x_freetype_libs=-lXft 5442d522f475Smrgfi 5443d522f475Smrg 5444d522f475SmrgAC_MSG_CHECKING(if we can link with FreeType libraries) 5445d522f475Smrg 5446d522f475Smrgcf_save_LIBS="$LIBS" 5447d522f475Smrgcf_save_INCS="$CPPFLAGS" 5448d522f475Smrg 544920d2c4d2SmrgCF_ADD_LIBS($cf_cv_x_freetype_libs) 5450956cc18dSsnjCPPFLAGS="$CPPFLAGS $cf_cv_x_freetype_incs" 5451d522f475Smrg 5452d522f475SmrgAC_TRY_LINK([ 5453d522f475Smrg#include <X11/Xlib.h> 5454d522f475Smrg#include <X11/extensions/Xrender.h> 5455d522f475Smrg#include <X11/Xft/Xft.h>],[ 5456f2e35a3aSmrg XftPattern *pat = XftNameParse ("name"); (void)pat], 5457d522f475Smrg [cf_cv_found_freetype=yes], 5458d522f475Smrg [cf_cv_found_freetype=no]) 5459d522f475SmrgAC_MSG_RESULT($cf_cv_found_freetype) 5460d522f475Smrg 5461d522f475SmrgLIBS="$cf_save_LIBS" 5462d522f475SmrgCPPFLAGS="$cf_save_INCS" 5463d522f475Smrg 5464d522f475Smrgif test "$cf_cv_found_freetype" = yes ; then 546520d2c4d2Smrg CF_ADD_LIBS($cf_cv_x_freetype_libs) 5466d522f475Smrg CF_ADD_CFLAGS($cf_cv_x_freetype_incs) 54670bd37d32Smrg AC_DEFINE(XRENDERFONT,1,[Define to 1 if we can/should link with FreeType libraries]) 5468d522f475Smrg 5469d522f475SmrgAC_CHECK_FUNCS( \ 5470d522f475Smrg XftDrawCharSpec \ 5471d522f475Smrg XftDrawSetClip \ 5472d522f475Smrg XftDrawSetClipRectangles \ 5473d522f475Smrg) 5474d522f475Smrg 5475d522f475Smrgelse 5476d522f475Smrg AC_MSG_WARN(No libraries found for FreeType) 5477d522f475Smrg CPPFLAGS=`echo "$CPPFLAGS" | sed -e s/-DXRENDERFONT//` 5478d522f475Smrgfi 5479d522f475Smrg 5480d522f475Smrg# FIXME: revisit this if needed 5481d522f475SmrgAC_SUBST(HAVE_TYPE_FCCHAR32) 5482d522f475SmrgAC_SUBST(HAVE_TYPE_XFTCHARSPEC) 5483d522f475Smrg]) 5484d522f475Smrgdnl --------------------------------------------------------------------------- 54855307cd1aSmrgdnl CF_X_TOOLKIT version: 27 updated: 2023/01/11 04:05:23 5486d522f475Smrgdnl ------------ 5487d522f475Smrgdnl Check for X Toolkit libraries 5488d522f475SmrgAC_DEFUN([CF_X_TOOLKIT], 5489d522f475Smrg[ 5490d522f475SmrgAC_REQUIRE([AC_PATH_XTRA]) 5491d522f475SmrgAC_REQUIRE([CF_CHECK_CACHE]) 5492d522f475Smrg 5493f2e35a3aSmrg# OSX is schizoid about who owns /usr/X11 (old) versus /opt/X11 (new) (and 549401037d57Smrg# in some cases has installed dummy files in the former, other cases replaced 549501037d57Smrg# it with a link to the new location). This complicates the configure script. 549601037d57Smrg# Check for that pitfall, and recover using pkg-config 549701037d57Smrg# 549801037d57Smrg# If none of these are set, the configuration is almost certainly broken. 549901037d57Smrgif test -z "${X_CFLAGS}${X_PRE_LIBS}${X_LIBS}${X_EXTRA_LIBS}" 550001037d57Smrgthen 550101037d57Smrg CF_TRY_PKG_CONFIG(x11,,[AC_MSG_WARN(unable to find X11 library)]) 550201037d57Smrg CF_TRY_PKG_CONFIG(ice,,[AC_MSG_WARN(unable to find ICE library)]) 550301037d57Smrg CF_TRY_PKG_CONFIG(sm,,[AC_MSG_WARN(unable to find SM library)]) 550401037d57Smrg CF_TRY_PKG_CONFIG(xt,,[AC_MSG_WARN(unable to find Xt library)]) 5505f2e35a3aSmrgelse 5506f2e35a3aSmrg LIBS="$X_PRE_LIBS $LIBS $X_EXTRA_LIBS" 550701037d57Smrgfi 550801037d57Smrg 5509d522f475Smrgcf_have_X_LIBS=no 5510d522f475Smrg 551120d2c4d2SmrgCF_TRY_PKG_CONFIG(xt,[ 551220d2c4d2Smrg 551301037d57Smrg case "x$LIBS" in 551401037d57Smrg (*-lX11*) 55156879286fSmrg ;; 551601037d57Smrg (*) 55176879286fSmrg# we have an "xt" package, but it may omit Xt's dependency on X11 55186879286fSmrgAC_CACHE_CHECK(for usable X dependency,cf_cv_xt_x11_compat,[ 55196879286fSmrgAC_TRY_LINK([ 55205307cd1aSmrg$ac_includes_default 55216879286fSmrg#include <X11/Xlib.h> 55226879286fSmrg],[ 55236879286fSmrg int rc1 = XDrawLine((Display*) 0, (Drawable) 0, (GC) 0, 0, 0, 0, 0); 55246879286fSmrg int rc2 = XClearWindow((Display*) 0, (Window) 0); 55256879286fSmrg int rc3 = XMoveWindow((Display*) 0, (Window) 0, 0, 0); 55266879286fSmrg int rc4 = XMoveResizeWindow((Display*)0, (Window)0, 0, 0, 0, 0); 55276879286fSmrg],[cf_cv_xt_x11_compat=yes],[cf_cv_xt_x11_compat=no])]) 55286879286fSmrg if test "$cf_cv_xt_x11_compat" = no 55296879286fSmrg then 55306879286fSmrg CF_VERBOSE(work around broken X11 dependency) 55316879286fSmrg # 2010/11/19 - good enough until a working Xt on Xcb is delivered. 55326879286fSmrg CF_TRY_PKG_CONFIG(x11,,[CF_ADD_LIB_AFTER(-lXt,-lX11)]) 55336879286fSmrg fi 553420d2c4d2Smrg ;; 553520d2c4d2Smrg esac 553620d2c4d2Smrg 55376879286fSmrgAC_CACHE_CHECK(for usable X Toolkit package,cf_cv_xt_ice_compat,[ 55386879286fSmrgAC_TRY_LINK([ 55395307cd1aSmrg$ac_includes_default 55406879286fSmrg#include <X11/Shell.h> 5541f2e35a3aSmrg],[int num = IceConnectionNumber(0); (void) num 55426879286fSmrg],[cf_cv_xt_ice_compat=yes],[cf_cv_xt_ice_compat=no])]) 55436879286fSmrg 55446879286fSmrg if test "$cf_cv_xt_ice_compat" = no 55456879286fSmrg then 55466879286fSmrg # workaround for broken ".pc" files used for X Toolkit. 554701037d57Smrg case "x$X_PRE_LIBS" in 554801037d57Smrg (*-lICE*) 554901037d57Smrg case "x$LIBS" in 555001037d57Smrg (*-lICE*) 55516879286fSmrg ;; 555201037d57Smrg (*) 55536879286fSmrg CF_VERBOSE(work around broken ICE dependency) 55546879286fSmrg CF_TRY_PKG_CONFIG(ice, 55556879286fSmrg [CF_TRY_PKG_CONFIG(sm)], 55566879286fSmrg [CF_ADD_LIB_AFTER(-lXt,$X_PRE_LIBS)]) 55576879286fSmrg ;; 55586879286fSmrg esac 55596879286fSmrg ;; 55606879286fSmrg esac 55616879286fSmrg fi 55626879286fSmrg 556320d2c4d2Smrg cf_have_X_LIBS=yes 556420d2c4d2Smrg],[ 556520d2c4d2Smrg 556620d2c4d2Smrg LDFLAGS="$X_LIBS $LDFLAGS" 556720d2c4d2Smrg CF_CHECK_CFLAGS($X_CFLAGS) 5568d522f475Smrg 556920d2c4d2Smrg AC_CHECK_FUNC(XOpenDisplay,,[ 557020d2c4d2Smrg AC_CHECK_LIB(X11,XOpenDisplay, 5571f2e35a3aSmrg [CF_ADD_LIB(X11)])]) 5572d522f475Smrg 557320d2c4d2Smrg AC_CHECK_FUNC(XtAppInitialize,,[ 557420d2c4d2Smrg AC_CHECK_LIB(Xt, XtAppInitialize, 55750bd37d32Smrg [AC_DEFINE(HAVE_LIBXT,1,[Define to 1 if we can compile with the Xt library]) 557620d2c4d2Smrg cf_have_X_LIBS=Xt 5577f2e35a3aSmrg LIBS="-lXt $LIBS"])]) 557820d2c4d2Smrg]) 5579d522f475Smrg 5580f2e35a3aSmrgif test "$cf_have_X_LIBS" = no ; then 5581d522f475Smrg AC_MSG_WARN( 5582d522f475Smrg[Unable to successfully link X Toolkit library (-lXt) with 5583d522f475Smrgtest program. You will have to check and add the proper libraries by hand 5584d522f475Smrgto makefile.]) 5585d522f475Smrgfi 5586d522f475Smrg])dnl 55870bd37d32Smrgdnl --------------------------------------------------------------------------- 5588ae137402Smrgdnl CF__GRANTPT_BODY version: 6 updated: 2021/06/07 17:39:17 55890bd37d32Smrgdnl ---------------- 55900bd37d32Smrgdnl Body for workability check of grantpt. 55910bd37d32Smrgdefine([CF__GRANTPT_BODY],[ 55920bd37d32Smrg int code = 0; 55930bd37d32Smrg int pty; 55940bd37d32Smrg int tty; 55950bd37d32Smrg char *slave; 55960bd37d32Smrg struct termios tio; 55970bd37d32Smrg 5598f2e35a3aSmrg (void)tio; 55990bd37d32Smrg signal(SIGALRM, my_timeout); 56000bd37d32Smrg 56010bd37d32Smrg if (alarm(2) == 9) 56020bd37d32Smrg failed(9); 56030bd37d32Smrg else if ((pty = posix_openpt(O_RDWR)) < 0) 56040bd37d32Smrg failed(1); 5605ae137402Smrg else if (grantpt(pty) < 0) 56060bd37d32Smrg failed(2); 5607ae137402Smrg else if (unlockpt(pty) < 0) 56080bd37d32Smrg failed(3); 56090bd37d32Smrg else if ((slave = ptsname(pty)) == 0) 56100bd37d32Smrg failed(4); 56110bd37d32Smrg#if (CONFTEST == 3) || defined(CONFTEST_isatty) 56120bd37d32Smrg else if (!isatty(pty)) 56130bd37d32Smrg failed(4); 56140bd37d32Smrg#endif 56150bd37d32Smrg#if CONFTEST >= 4 5616ae137402Smrg else if (tcgetattr(pty, &tio) < 0) 56170bd37d32Smrg failed(20); 5618ae137402Smrg else if (tcsetattr(pty, TCSAFLUSH, &tio) < 0) 56190bd37d32Smrg failed(21); 56200bd37d32Smrg#endif 56210bd37d32Smrg /* BSD posix_openpt does not treat pty as a terminal until slave is opened. 56220bd37d32Smrg * Linux does treat it that way. 56230bd37d32Smrg */ 56240bd37d32Smrg else if ((tty = open(slave, O_RDWR)) < 0) 56250bd37d32Smrg failed(5); 56260bd37d32Smrg#ifdef CONFTEST 56270bd37d32Smrg#ifdef I_PUSH 56280bd37d32Smrg#if (CONFTEST == 0) || defined(CONFTEST_ptem) 5629ae137402Smrg else if (ioctl(tty, I_PUSH, "ptem") < 0) 56300bd37d32Smrg failed(10); 56310bd37d32Smrg#endif 56320bd37d32Smrg#if (CONFTEST == 1) || defined(CONFTEST_ldterm) 5633ae137402Smrg else if (ioctl(tty, I_PUSH, "ldterm") < 0) 56340bd37d32Smrg failed(11); 56350bd37d32Smrg#endif 56360bd37d32Smrg#if (CONFTEST == 2) || defined(CONFTEST_ttcompat) 5637ae137402Smrg else if (ioctl(tty, I_PUSH, "ttcompat") < 0) 56380bd37d32Smrg failed(12); 56390bd37d32Smrg#endif 56400bd37d32Smrg#endif /* I_PUSH */ 56410bd37d32Smrg#if CONFTEST >= 5 5642ae137402Smrg else if (tcgetattr(tty, &tio) < 0) 56430bd37d32Smrg failed(30); 5644ae137402Smrg else if (tcsetattr(tty, TCSAFLUSH, &tio) < 0) 56450bd37d32Smrg failed(31); 56460bd37d32Smrg#endif 56470bd37d32Smrg#endif /* CONFTEST */ 5648ae137402Smrg (void) tty; 56490bd37d32Smrg ${cf_cv_main_return:-return}(code); 56500bd37d32Smrg]) 56510bd37d32Smrgdnl --------------------------------------------------------------------------- 5652f2e35a3aSmrgdnl CF__GRANTPT_HEAD version: 4 updated: 2020/03/10 18:53:47 56530bd37d32Smrgdnl ---------------- 56540bd37d32Smrgdnl Headers for workability check of grantpt. 56550bd37d32Smrgdefine([CF__GRANTPT_HEAD],[ 56560bd37d32Smrg#include <stdlib.h> 5657f2e35a3aSmrg#include <stdio.h> 56580bd37d32Smrg#include <termios.h> 56590bd37d32Smrg#include <unistd.h> 56600bd37d32Smrg#include <signal.h> 56610bd37d32Smrg#include <fcntl.h> 56620bd37d32Smrg#include <errno.h> 56630bd37d32Smrg 56640bd37d32Smrg#ifndef HAVE_POSIX_OPENPT 56650bd37d32Smrg#undef posix_openpt 56660bd37d32Smrg#define posix_openpt(mode) open("/dev/ptmx", mode) 56670bd37d32Smrg#endif 56680bd37d32Smrg 56690bd37d32Smrg#ifdef HAVE_STROPTS_H 56700bd37d32Smrg#include <stropts.h> 56710bd37d32Smrg#endif 56720bd37d32Smrg 56730bd37d32Smrgstatic void failed(int code) 56740bd37d32Smrg{ 56750bd37d32Smrg perror("conftest"); 56760bd37d32Smrg exit(code); 56770bd37d32Smrg} 56780bd37d32Smrg 56790bd37d32Smrgstatic void my_timeout(int sig) 56800bd37d32Smrg{ 5681f2e35a3aSmrg (void)sig; 56820bd37d32Smrg exit(99); 56830bd37d32Smrg} 56840bd37d32Smrg]) 56855307cd1aSmrgdnl --------------------------------------------------------------------------- 56865307cd1aSmrgdnl CF__XOPEN_SOURCE_BODY version: 2 updated: 2023/02/18 17:41:25 56875307cd1aSmrgdnl --------------------- 56885307cd1aSmrgdnl body of test when test-compiling for _XOPEN_SOURCE check 56895307cd1aSmrgdefine([CF__XOPEN_SOURCE_BODY], 56905307cd1aSmrg[ 56915307cd1aSmrg#ifndef _XOPEN_SOURCE 56925307cd1aSmrg#error _XOPEN_SOURCE is not defined 56935307cd1aSmrg#endif 56945307cd1aSmrg]) 56955307cd1aSmrgdnl --------------------------------------------------------------------------- 56965307cd1aSmrgdnl CF__XOPEN_SOURCE_HEAD version: 2 updated: 2023/02/18 17:41:25 56975307cd1aSmrgdnl --------------------- 56985307cd1aSmrgdnl headers to include when test-compiling for _XOPEN_SOURCE check 56995307cd1aSmrgdefine([CF__XOPEN_SOURCE_HEAD], 57005307cd1aSmrg[ 57015307cd1aSmrg$ac_includes_default 57025307cd1aSmrg]) 5703