1dnl $Id: aclocal.m4,v 1.59 2023/01/05 22:53:11 tom Exp $ 2dnl Macros for byacc configure script (Thomas E. Dickey) 3dnl --------------------------------------------------------------------------- 4dnl Copyright 2004-2022,2023 Thomas E. Dickey 5dnl 6dnl Permission is hereby granted, free of charge, to any person obtaining a 7dnl copy of this software and associated documentation files (the 8dnl "Software"), to deal in the Software without restriction, including 9dnl without limitation the rights to use, copy, modify, merge, publish, 10dnl distribute, distribute with modifications, sublicense, and/or sell 11dnl copies of the Software, and to permit persons to whom the Software is 12dnl furnished to do so, subject to the following conditions: 13dnl 14dnl The above copyright notice and this permission notice shall be included 15dnl in all copies or portions of the Software. 16dnl 17dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 18dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 20dnl IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 21dnl DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 22dnl OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR 23dnl THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24dnl 25dnl Except as contained in this notice, the name(s) of the above copyright 26dnl holders shall not be used in advertising or otherwise to promote the 27dnl sale, use or other dealings in this Software without prior written 28dnl authorization. 29dnl --------------------------------------------------------------------------- 30dnl --------------------------------------------------------------------------- 31dnl CF_ACVERSION_CHECK version: 5 updated: 2014/06/04 19:11:49 32dnl ------------------ 33dnl Conditionally generate script according to whether we're using a given autoconf. 34dnl 35dnl $1 = version to compare against 36dnl $2 = code to use if AC_ACVERSION is at least as high as $1. 37dnl $3 = code to use if AC_ACVERSION is older than $1. 38define([CF_ACVERSION_CHECK], 39[ 40ifdef([AC_ACVERSION], ,[ifdef([AC_AUTOCONF_VERSION],[m4_copy([AC_AUTOCONF_VERSION],[AC_ACVERSION])],[m4_copy([m4_PACKAGE_VERSION],[AC_ACVERSION])])])dnl 41ifdef([m4_version_compare], 42[m4_if(m4_version_compare(m4_defn([AC_ACVERSION]), [$1]), -1, [$3], [$2])], 43[CF_ACVERSION_COMPARE( 44AC_PREREQ_CANON(AC_PREREQ_SPLIT([$1])), 45AC_PREREQ_CANON(AC_PREREQ_SPLIT(AC_ACVERSION)), AC_ACVERSION, [$2], [$3])])])dnl 46dnl --------------------------------------------------------------------------- 47dnl CF_ACVERSION_COMPARE version: 3 updated: 2012/10/03 18:39:53 48dnl -------------------- 49dnl CF_ACVERSION_COMPARE(MAJOR1, MINOR1, TERNARY1, 50dnl MAJOR2, MINOR2, TERNARY2, 51dnl PRINTABLE2, not FOUND, FOUND) 52define([CF_ACVERSION_COMPARE], 53[ifelse(builtin([eval], [$2 < $5]), 1, 54[ifelse([$8], , ,[$8])], 55[ifelse([$9], , ,[$9])])])dnl 56dnl --------------------------------------------------------------------------- 57dnl CF_ADD_CFLAGS version: 15 updated: 2020/12/31 10:54:15 58dnl ------------- 59dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS 60dnl $1 = flags to add 61dnl $2 = if given makes this macro verbose. 62dnl 63dnl Put any preprocessor definitions that use quoted strings in $EXTRA_CPPFLAGS, 64dnl to simplify use of $CPPFLAGS in compiler checks, etc., that are easily 65dnl confused by the quotes (which require backslashes to keep them usable). 66AC_DEFUN([CF_ADD_CFLAGS], 67[ 68cf_fix_cppflags=no 69cf_new_cflags= 70cf_new_cppflags= 71cf_new_extra_cppflags= 72 73for cf_add_cflags in $1 74do 75case "$cf_fix_cppflags" in 76(no) 77 case "$cf_add_cflags" in 78 (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) 79 case "$cf_add_cflags" in 80 (-D*) 81 cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^-D[[^=]]*='\''\"[[^"]]*//'` 82 83 test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ 84 && test -z "${cf_tst_cflags}" \ 85 && cf_fix_cppflags=yes 86 87 if test "$cf_fix_cppflags" = yes ; then 88 CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags) 89 continue 90 elif test "${cf_tst_cflags}" = "\"'" ; then 91 CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags) 92 continue 93 fi 94 ;; 95 esac 96 case "$CPPFLAGS" in 97 (*$cf_add_cflags) 98 ;; 99 (*) 100 case "$cf_add_cflags" in 101 (-D*) 102 cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` 103 CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,$cf_tst_cppflags) 104 ;; 105 esac 106 CF_APPEND_TEXT(cf_new_cppflags,$cf_add_cflags) 107 ;; 108 esac 109 ;; 110 (*) 111 CF_APPEND_TEXT(cf_new_cflags,$cf_add_cflags) 112 ;; 113 esac 114 ;; 115(yes) 116 CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags) 117 118 cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^[[^"]]*"'\''//'` 119 120 test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ 121 && test -z "${cf_tst_cflags}" \ 122 && cf_fix_cppflags=no 123 ;; 124esac 125done 126 127if test -n "$cf_new_cflags" ; then 128 ifelse([$2],,,[CF_VERBOSE(add to \$CFLAGS $cf_new_cflags)]) 129 CF_APPEND_TEXT(CFLAGS,$cf_new_cflags) 130fi 131 132if test -n "$cf_new_cppflags" ; then 133 ifelse([$2],,,[CF_VERBOSE(add to \$CPPFLAGS $cf_new_cppflags)]) 134 CF_APPEND_TEXT(CPPFLAGS,$cf_new_cppflags) 135fi 136 137if test -n "$cf_new_extra_cppflags" ; then 138 ifelse([$2],,,[CF_VERBOSE(add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags)]) 139 CF_APPEND_TEXT(EXTRA_CPPFLAGS,$cf_new_extra_cppflags) 140fi 141 142AC_SUBST(EXTRA_CPPFLAGS) 143 144])dnl 145dnl --------------------------------------------------------------------------- 146dnl CF_APPEND_CFLAGS version: 3 updated: 2021/09/05 17:25:40 147dnl ---------------- 148dnl Use CF_ADD_CFLAGS after first checking for potential redefinitions. 149dnl $1 = flags to add 150dnl $2 = if given makes this macro verbose. 151define([CF_APPEND_CFLAGS], 152[ 153for cf_add_cflags in $1 154do 155 case "x$cf_add_cflags" in 156 (x-[[DU]]*) 157 CF_REMOVE_CFLAGS($cf_add_cflags,CFLAGS,[$2]) 158 CF_REMOVE_CFLAGS($cf_add_cflags,CPPFLAGS,[$2]) 159 ;; 160 esac 161 CF_ADD_CFLAGS([$cf_add_cflags],[$2]) 162done 163])dnl 164dnl --------------------------------------------------------------------------- 165dnl CF_APPEND_TEXT version: 1 updated: 2017/02/25 18:58:55 166dnl -------------- 167dnl use this macro for appending text without introducing an extra blank at 168dnl the beginning 169define([CF_APPEND_TEXT], 170[ 171 test -n "[$]$1" && $1="[$]$1 " 172 $1="[$]{$1}$2" 173])dnl 174dnl --------------------------------------------------------------------------- 175dnl CF_ARG_DISABLE version: 3 updated: 1999/03/30 17:24:31 176dnl -------------- 177dnl Allow user to disable a normally-on option. 178AC_DEFUN([CF_ARG_DISABLE], 179[CF_ARG_OPTION($1,[$2],[$3],[$4],yes)])dnl 180dnl --------------------------------------------------------------------------- 181dnl CF_ARG_ENABLE version: 3 updated: 1999/03/30 17:24:31 182dnl ------------- 183dnl Allow user to enable a normally-off option. 184AC_DEFUN([CF_ARG_ENABLE], 185[CF_ARG_OPTION($1,[$2],[$3],[$4],no)])dnl 186dnl --------------------------------------------------------------------------- 187dnl CF_ARG_OPTION version: 5 updated: 2015/05/10 19:52:14 188dnl ------------- 189dnl Restricted form of AC_ARG_ENABLE that ensures user doesn't give bogus 190dnl values. 191dnl 192dnl Parameters: 193dnl $1 = option name 194dnl $2 = help-string 195dnl $3 = action to perform if option is not default 196dnl $4 = action if perform if option is default 197dnl $5 = default option value (either 'yes' or 'no') 198AC_DEFUN([CF_ARG_OPTION], 199[AC_ARG_ENABLE([$1],[$2],[test "$enableval" != ifelse([$5],no,yes,no) && enableval=ifelse([$5],no,no,yes) 200 if test "$enableval" != "$5" ; then 201ifelse([$3],,[ :]dnl 202,[ $3]) ifelse([$4],,,[ 203 else 204 $4]) 205 fi],[enableval=$5 ifelse([$4],,,[ 206 $4 207])dnl 208])])dnl 209dnl --------------------------------------------------------------------------- 210dnl CF_C11_NORETURN version: 3 updated: 2021/03/28 11:36:23 211dnl --------------- 212AC_DEFUN([CF_C11_NORETURN], 213[ 214AC_MSG_CHECKING(if you want to use C11 _Noreturn feature) 215CF_ARG_ENABLE(stdnoreturn, 216 [ --enable-stdnoreturn enable C11 _Noreturn feature for diagnostics], 217 [enable_stdnoreturn=yes], 218 [enable_stdnoreturn=no]) 219AC_MSG_RESULT($enable_stdnoreturn) 220 221if test $enable_stdnoreturn = yes; then 222AC_CACHE_CHECK([for C11 _Noreturn feature], cf_cv_c11_noreturn, 223 [AC_TRY_COMPILE([ 224#include <stdio.h> 225#include <stdlib.h> 226#include <stdnoreturn.h> 227static _Noreturn void giveup(void) { exit(0); } 228 ], 229 [if (feof(stdin)) giveup()], 230 cf_cv_c11_noreturn=yes, 231 cf_cv_c11_noreturn=no) 232 ]) 233else 234 cf_cv_c11_noreturn=no, 235fi 236 237if test "$cf_cv_c11_noreturn" = yes; then 238 AC_DEFINE(HAVE_STDNORETURN_H, 1,[Define if <stdnoreturn.h> header is available and working]) 239 AC_DEFINE_UNQUOTED(STDC_NORETURN,_Noreturn,[Define if C11 _Noreturn keyword is supported]) 240 HAVE_STDNORETURN_H=1 241else 242 HAVE_STDNORETURN_H=0 243fi 244 245AC_SUBST(HAVE_STDNORETURN_H) 246AC_SUBST(STDC_NORETURN) 247])dnl 248dnl --------------------------------------------------------------------------- 249dnl CF_CC_ENV_FLAGS version: 10 updated: 2020/12/31 18:40:20 250dnl --------------- 251dnl Check for user's environment-breakage by stuffing CFLAGS/CPPFLAGS content 252dnl into CC. This will not help with broken scripts that wrap the compiler 253dnl with options, but eliminates a more common category of user confusion. 254dnl 255dnl In particular, it addresses the problem of being able to run the C 256dnl preprocessor in a consistent manner. 257dnl 258dnl Caveat: this also disallows blanks in the pathname for the compiler, but 259dnl the nuisance of having inconsistent settings for compiler and preprocessor 260dnl outweighs that limitation. 261AC_DEFUN([CF_CC_ENV_FLAGS], 262[ 263# This should have been defined by AC_PROG_CC 264: "${CC:=cc}" 265 266AC_MSG_CHECKING(\$CFLAGS variable) 267case "x$CFLAGS" in 268(*-[[IUD]]*) 269 AC_MSG_RESULT(broken) 270 AC_MSG_WARN(your environment uses the CFLAGS variable to hold CPPFLAGS options) 271 cf_flags="$CFLAGS" 272 CFLAGS= 273 for cf_arg in $cf_flags 274 do 275 CF_ADD_CFLAGS($cf_arg) 276 done 277 ;; 278(*) 279 AC_MSG_RESULT(ok) 280 ;; 281esac 282 283AC_MSG_CHECKING(\$CC variable) 284case "$CC" in 285(*[[\ \ ]]-*) 286 AC_MSG_RESULT(broken) 287 AC_MSG_WARN(your environment uses the CC variable to hold CFLAGS/CPPFLAGS options) 288 # humor him... 289 cf_prog=`echo "$CC" | sed -e 's/ / /g' -e 's/[[ ]]* / /g' -e 's/[[ ]]*[[ ]]-[[^ ]].*//'` 290 cf_flags=`echo "$CC" | ${AWK:-awk} -v prog="$cf_prog" '{ printf("%s", [substr]([$]0,1+length(prog))); }'` 291 CC="$cf_prog" 292 for cf_arg in $cf_flags 293 do 294 case "x$cf_arg" in 295 (x-[[IUDfgOW]]*) 296 CF_ADD_CFLAGS($cf_arg) 297 ;; 298 (*) 299 CC="$CC $cf_arg" 300 ;; 301 esac 302 done 303 CF_VERBOSE(resulting CC: '$CC') 304 CF_VERBOSE(resulting CFLAGS: '$CFLAGS') 305 CF_VERBOSE(resulting CPPFLAGS: '$CPPFLAGS') 306 ;; 307(*) 308 AC_MSG_RESULT(ok) 309 ;; 310esac 311])dnl 312dnl --------------------------------------------------------------------------- 313dnl CF_CHECK_CACHE version: 13 updated: 2020/12/31 10:54:15 314dnl -------------- 315dnl Check if we're accidentally using a cache from a different machine. 316dnl Derive the system name, as a check for reusing the autoconf cache. 317dnl 318dnl If we've packaged config.guess and config.sub, run that (since it does a 319dnl better job than uname). Normally we'll use AC_CANONICAL_HOST, but allow 320dnl an extra parameter that we may override, e.g., for AC_CANONICAL_SYSTEM 321dnl which is useful in cross-compiles. 322dnl 323dnl Note: we would use $ac_config_sub, but that is one of the places where 324dnl autoconf 2.5x broke compatibility with autoconf 2.13 325AC_DEFUN([CF_CHECK_CACHE], 326[ 327if test -f "$srcdir/config.guess" || test -f "$ac_aux_dir/config.guess" ; then 328 ifelse([$1],,[AC_CANONICAL_HOST],[$1]) 329 system_name="$host_os" 330else 331 system_name="`(uname -s -r) 2>/dev/null`" 332 if test -z "$system_name" ; then 333 system_name="`(hostname) 2>/dev/null`" 334 fi 335fi 336test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name",[Define to the system name.]) 337AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"]) 338 339test -z "$system_name" && system_name="$cf_cv_system_name" 340test -n "$cf_cv_system_name" && AC_MSG_RESULT(Configuring for $cf_cv_system_name) 341 342if test ".$system_name" != ".$cf_cv_system_name" ; then 343 AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)) 344 AC_MSG_ERROR("Please remove config.cache and try again.") 345fi 346])dnl 347dnl --------------------------------------------------------------------------- 348dnl CF_CLANG_COMPILER version: 8 updated: 2021/01/01 13:31:04 349dnl ----------------- 350dnl Check if the given compiler is really clang. clang's C driver defines 351dnl __GNUC__ (fooling the configure script into setting $GCC to yes) but does 352dnl not ignore some gcc options. 353dnl 354dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to 355dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from 356dnl the wrappers for gcc and g++ warnings. 357dnl 358dnl $1 = GCC (default) or GXX 359dnl $2 = CLANG_COMPILER (default) 360dnl $3 = CFLAGS (default) or CXXFLAGS 361AC_DEFUN([CF_CLANG_COMPILER],[ 362ifelse([$2],,CLANG_COMPILER,[$2])=no 363 364if test "$ifelse([$1],,[$1],GCC)" = yes ; then 365 AC_MSG_CHECKING(if this is really Clang ifelse([$1],GXX,C++,C) compiler) 366 cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])" 367 AC_TRY_COMPILE([],[ 368#ifdef __clang__ 369#else 370make an error 371#endif 372],[ifelse([$2],,CLANG_COMPILER,[$2])=yes 373],[]) 374 ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS" 375 AC_MSG_RESULT($ifelse([$2],,CLANG_COMPILER,[$2])) 376fi 377 378CLANG_VERSION=none 379 380if test "x$ifelse([$2],,CLANG_COMPILER,[$2])" = "xyes" ; then 381 case "$CC" in 382 (c[[1-9]][[0-9]]|*/c[[1-9]][[0-9]]) 383 AC_MSG_WARN(replacing broken compiler alias $CC) 384 CFLAGS="$CFLAGS -std=`echo "$CC" | sed -e 's%.*/%%'`" 385 CC=clang 386 ;; 387 esac 388 389 AC_MSG_CHECKING(version of $CC) 390 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.]].*//'`" 391 test -z "$CLANG_VERSION" && CLANG_VERSION=unknown 392 AC_MSG_RESULT($CLANG_VERSION) 393 394 for cf_clang_opt in \ 395 -Qunused-arguments \ 396 -Wno-error=implicit-function-declaration 397 do 398 AC_MSG_CHECKING(if option $cf_clang_opt works) 399 cf_save_CFLAGS="$CFLAGS" 400 CFLAGS="$CFLAGS $cf_clang_opt" 401 AC_TRY_LINK([ 402 #include <stdio.h>],[ 403 printf("hello!\\n");],[ 404 cf_clang_optok=yes],[ 405 cf_clang_optok=no]) 406 AC_MSG_RESULT($cf_clang_optok) 407 CFLAGS="$cf_save_CFLAGS" 408 if test "$cf_clang_optok" = yes; then 409 CF_VERBOSE(adding option $cf_clang_opt) 410 CF_APPEND_TEXT(CFLAGS,$cf_clang_opt) 411 fi 412 done 413fi 414]) 415dnl --------------------------------------------------------------------------- 416dnl CF_CONST_X_STRING version: 7 updated: 2021/06/07 17:39:17 417dnl ----------------- 418dnl The X11R4-X11R6 Xt specification uses an ambiguous String type for most 419dnl character-strings. 420dnl 421dnl It is ambiguous because the specification accommodated the pre-ANSI 422dnl compilers bundled by more than one vendor in lieu of providing a standard C 423dnl compiler other than by costly add-ons. Because of this, the specification 424dnl did not take into account the use of const for telling the compiler that 425dnl string literals would be in readonly memory. 426dnl 427dnl As a workaround, one could (starting with X11R5) define XTSTRINGDEFINES, to 428dnl let the compiler decide how to represent Xt's strings which were #define'd. 429dnl That does not solve the problem of using the block of Xt's strings which 430dnl are compiled into the library (and is less efficient than one might want). 431dnl 432dnl Xt specification 7 introduces the _CONST_X_STRING symbol which is used both 433dnl when compiling the library and compiling using the library, to tell the 434dnl compiler that String is const. 435AC_DEFUN([CF_CONST_X_STRING], 436[ 437AC_REQUIRE([AC_PATH_XTRA]) 438 439CF_SAVE_XTRA_FLAGS([CF_CONST_X_STRING]) 440 441AC_TRY_COMPILE( 442[ 443#include <stdlib.h> 444#include <X11/Intrinsic.h> 445], 446[String foo = malloc(1); free((void*)foo)],[ 447 448AC_CACHE_CHECK(for X11/Xt const-feature,cf_cv_const_x_string,[ 449 AC_TRY_COMPILE( 450 [ 451#define _CONST_X_STRING /* X11R7.8 (perhaps) */ 452#undef XTSTRINGDEFINES /* X11R5 and later */ 453#include <stdlib.h> 454#include <X11/Intrinsic.h> 455 ],[String foo = malloc(1); *foo = 0],[ 456 cf_cv_const_x_string=no 457 ],[ 458 cf_cv_const_x_string=yes 459 ]) 460]) 461 462CF_RESTORE_XTRA_FLAGS([CF_CONST_X_STRING]) 463 464case "$cf_cv_const_x_string" in 465(no) 466 CF_APPEND_TEXT(CPPFLAGS,-DXTSTRINGDEFINES) 467 ;; 468(*) 469 CF_APPEND_TEXT(CPPFLAGS,-D_CONST_X_STRING) 470 ;; 471esac 472 473]) 474])dnl 475dnl --------------------------------------------------------------------------- 476dnl CF_DISABLE_ECHO version: 14 updated: 2021/09/04 06:35:04 477dnl --------------- 478dnl You can always use "make -n" to see the actual options, but it is hard to 479dnl pick out/analyze warning messages when the compile-line is long. 480dnl 481dnl Sets: 482dnl ECHO_LT - symbol to control if libtool is verbose 483dnl ECHO_LD - symbol to prefix "cc -o" lines 484dnl RULE_CC - symbol to put before implicit "cc -c" lines (e.g., .c.o) 485dnl SHOW_CC - symbol to put before explicit "cc -c" lines 486dnl ECHO_CC - symbol to put before any "cc" line 487dnl 488AC_DEFUN([CF_DISABLE_ECHO],[ 489AC_MSG_CHECKING(if you want to see long compiling messages) 490CF_ARG_DISABLE(echo, 491 [ --disable-echo do not display "compiling" commands], 492 [ 493 ECHO_LT='--silent' 494 ECHO_LD='@echo linking [$]@;' 495 RULE_CC='@echo compiling [$]<' 496 SHOW_CC='@echo compiling [$]@' 497 ECHO_CC='@' 498],[ 499 ECHO_LT='' 500 ECHO_LD='' 501 RULE_CC='' 502 SHOW_CC='' 503 ECHO_CC='' 504]) 505AC_MSG_RESULT($enableval) 506AC_SUBST(ECHO_LT) 507AC_SUBST(ECHO_LD) 508AC_SUBST(RULE_CC) 509AC_SUBST(SHOW_CC) 510AC_SUBST(ECHO_CC) 511])dnl 512dnl --------------------------------------------------------------------------- 513dnl CF_DISABLE_LEAKS version: 9 updated: 2021/04/03 16:41:50 514dnl ---------------- 515dnl Combine no-leak checks with the libraries or tools that are used for the 516dnl checks. 517AC_DEFUN([CF_DISABLE_LEAKS],[ 518 519AC_REQUIRE([CF_WITH_DMALLOC]) 520AC_REQUIRE([CF_WITH_DBMALLOC]) 521AC_REQUIRE([CF_WITH_VALGRIND]) 522 523AC_MSG_CHECKING(if you want to perform memory-leak testing) 524AC_ARG_ENABLE(leaks, 525 [ --disable-leaks test: free permanent memory, analyze leaks], 526 [enable_leaks=$enableval], 527 [enable_leaks=yes]) 528dnl with_no_leaks is more readable... 529if test "x$enable_leaks" = xno; then with_no_leaks=yes; else with_no_leaks=no; fi 530AC_MSG_RESULT($with_no_leaks) 531 532if test "$enable_leaks" = no ; then 533 AC_DEFINE(NO_LEAKS,1,[Define to 1 if you want to perform memory-leak testing.]) 534 AC_DEFINE(YY_NO_LEAKS,1,[Define to 1 if you want to perform memory-leak testing.]) 535fi 536])dnl 537dnl --------------------------------------------------------------------------- 538dnl CF_ENABLE_WARNINGS version: 9 updated: 2021/01/05 19:40:50 539dnl ------------------ 540dnl Configure-option to enable gcc warnings 541dnl 542dnl $1 = extra options to add, if supported 543dnl $2 = option for checking attributes. By default, this is done when 544dnl warnings are enabled. For other values: 545dnl yes: always do this, e.g., to use in generated library-headers 546dnl no: never do this 547AC_DEFUN([CF_ENABLE_WARNINGS],[ 548if test "$GCC" = yes || test "$GXX" = yes 549then 550CF_FIX_WARNINGS(CFLAGS) 551CF_FIX_WARNINGS(CPPFLAGS) 552CF_FIX_WARNINGS(LDFLAGS) 553AC_MSG_CHECKING(if you want to turn on gcc warnings) 554CF_ARG_ENABLE(warnings, 555 [ --enable-warnings test: turn on gcc compiler warnings], 556 [enable_warnings=yes], 557 [enable_warnings=no]) 558AC_MSG_RESULT($enable_warnings) 559if test "$enable_warnings" = "yes" 560then 561 ifelse($2,,[CF_GCC_ATTRIBUTES]) 562 CF_GCC_WARNINGS($1) 563fi 564ifelse($2,yes,[CF_GCC_ATTRIBUTES]) 565fi 566])dnl 567dnl --------------------------------------------------------------------------- 568dnl CF_FIX_WARNINGS version: 4 updated: 2021/12/16 18:22:31 569dnl --------------- 570dnl Warning flags do not belong in CFLAGS, CPPFLAGS, etc. Any of gcc's 571dnl "-Werror" flags can interfere with configure-checks. Those go into 572dnl EXTRA_CFLAGS. 573dnl 574dnl $1 = variable name to repair 575define([CF_FIX_WARNINGS],[ 576if test "$GCC" = yes || test "$GXX" = yes 577then 578 case [$]$1 in 579 (*-Werror=*) 580 cf_temp_flags= 581 for cf_temp_scan in [$]$1 582 do 583 case "x$cf_temp_scan" in 584 (x-Werror=format*) 585 CF_APPEND_TEXT(cf_temp_flags,$cf_temp_scan) 586 ;; 587 (x-Werror=*) 588 CF_APPEND_TEXT(EXTRA_CFLAGS,$cf_temp_scan) 589 ;; 590 (*) 591 CF_APPEND_TEXT(cf_temp_flags,$cf_temp_scan) 592 ;; 593 esac 594 done 595 if test "x[$]$1" != "x$cf_temp_flags" 596 then 597 CF_VERBOSE(repairing $1: [$]$1) 598 $1="$cf_temp_flags" 599 CF_VERBOSE(... fixed [$]$1) 600 CF_VERBOSE(... extra $EXTRA_CFLAGS) 601 fi 602 ;; 603 esac 604fi 605AC_SUBST(EXTRA_CFLAGS) 606])dnl 607dnl --------------------------------------------------------------------------- 608dnl CF_GCC_ATTRIBUTES version: 24 updated: 2021/03/20 12:00:25 609dnl ----------------- 610dnl Test for availability of useful gcc __attribute__ directives to quiet 611dnl compiler warnings. Though useful, not all are supported -- and contrary 612dnl to documentation, unrecognized directives cause older compilers to barf. 613AC_DEFUN([CF_GCC_ATTRIBUTES], 614[AC_REQUIRE([AC_PROG_FGREP])dnl 615AC_REQUIRE([CF_C11_NORETURN])dnl 616 617if test "$GCC" = yes || test "$GXX" = yes 618then 619cat > conftest.i <<EOF 620#ifndef GCC_PRINTF 621#define GCC_PRINTF 0 622#endif 623#ifndef GCC_SCANF 624#define GCC_SCANF 0 625#endif 626#ifndef GCC_NORETURN 627#define GCC_NORETURN /* nothing */ 628#endif 629#ifndef GCC_UNUSED 630#define GCC_UNUSED /* nothing */ 631#endif 632EOF 633if test "$GCC" = yes 634then 635 AC_CHECKING([for $CC __attribute__ directives]) 636cat > "conftest.$ac_ext" <<EOF 637#line __oline__ "${as_me:-configure}" 638#include <stdio.h> 639#include "confdefs.h" 640#include "conftest.h" 641#include "conftest.i" 642#if GCC_PRINTF 643#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var))) 644#else 645#define GCC_PRINTFLIKE(fmt,var) /*nothing*/ 646#endif 647#if GCC_SCANF 648#define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var))) 649#else 650#define GCC_SCANFLIKE(fmt,var) /*nothing*/ 651#endif 652extern void wow(char *,...) GCC_SCANFLIKE(1,2); 653extern GCC_NORETURN void oops(char *,...) GCC_PRINTFLIKE(1,2); 654extern GCC_NORETURN void foo(void); 655int main(int argc GCC_UNUSED, char *argv[[]] GCC_UNUSED) { (void)argc; (void)argv; return 0; } 656EOF 657 cf_printf_attribute=no 658 cf_scanf_attribute=no 659 for cf_attribute in scanf printf unused noreturn 660 do 661 CF_UPPER(cf_ATTRIBUTE,$cf_attribute) 662 cf_directive="__attribute__(($cf_attribute))" 663 echo "checking for $CC $cf_directive" 1>&AC_FD_CC 664 665 case "$cf_attribute" in 666 (printf) 667 cf_printf_attribute=yes 668 cat >conftest.h <<EOF 669#define GCC_$cf_ATTRIBUTE 1 670EOF 671 ;; 672 (scanf) 673 cf_scanf_attribute=yes 674 cat >conftest.h <<EOF 675#define GCC_$cf_ATTRIBUTE 1 676EOF 677 ;; 678 (*) 679 cat >conftest.h <<EOF 680#define GCC_$cf_ATTRIBUTE $cf_directive 681EOF 682 ;; 683 esac 684 685 if AC_TRY_EVAL(ac_compile); then 686 test -n "$verbose" && AC_MSG_RESULT(... $cf_attribute) 687 cat conftest.h >>confdefs.h 688 case "$cf_attribute" in 689 (noreturn) 690 AC_DEFINE_UNQUOTED(GCC_NORETURN,$cf_directive,[Define to noreturn-attribute for gcc]) 691 ;; 692 (printf) 693 cf_value='/* nothing */' 694 if test "$cf_printf_attribute" != no ; then 695 cf_value='__attribute__((format(printf,fmt,var)))' 696 AC_DEFINE(GCC_PRINTF,1,[Define to 1 if the compiler supports gcc-like printf attribute.]) 697 fi 698 AC_DEFINE_UNQUOTED(GCC_PRINTFLIKE(fmt,var),$cf_value,[Define to printf-attribute for gcc]) 699 ;; 700 (scanf) 701 cf_value='/* nothing */' 702 if test "$cf_scanf_attribute" != no ; then 703 cf_value='__attribute__((format(scanf,fmt,var)))' 704 AC_DEFINE(GCC_SCANF,1,[Define to 1 if the compiler supports gcc-like scanf attribute.]) 705 fi 706 AC_DEFINE_UNQUOTED(GCC_SCANFLIKE(fmt,var),$cf_value,[Define to sscanf-attribute for gcc]) 707 ;; 708 (unused) 709 AC_DEFINE_UNQUOTED(GCC_UNUSED,$cf_directive,[Define to unused-attribute for gcc]) 710 ;; 711 esac 712 fi 713 done 714else 715 ${FGREP-fgrep} define conftest.i >>confdefs.h 716fi 717rm -rf ./conftest* 718fi 719])dnl 720dnl --------------------------------------------------------------------------- 721dnl CF_GCC_VERSION version: 8 updated: 2019/09/07 13:38:36 722dnl -------------- 723dnl Find version of gcc, and (because icc/clang pretend to be gcc without being 724dnl compatible), attempt to determine if icc/clang is actually used. 725AC_DEFUN([CF_GCC_VERSION],[ 726AC_REQUIRE([AC_PROG_CC]) 727GCC_VERSION=none 728if test "$GCC" = yes ; then 729 AC_MSG_CHECKING(version of $CC) 730 GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(GCC[[^)]]*) //' -e 's/^.*(Debian[[^)]]*) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`" 731 test -z "$GCC_VERSION" && GCC_VERSION=unknown 732 AC_MSG_RESULT($GCC_VERSION) 733fi 734CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS) 735CF_CLANG_COMPILER(GCC,CLANG_COMPILER,CFLAGS) 736])dnl 737dnl --------------------------------------------------------------------------- 738dnl CF_GCC_WARNINGS version: 41 updated: 2021/01/01 16:53:59 739dnl --------------- 740dnl Check if the compiler supports useful warning options. There's a few that 741dnl we don't use, simply because they're too noisy: 742dnl 743dnl -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x) 744dnl -Winline (usually not worthwhile) 745dnl -Wredundant-decls (system headers make this too noisy) 746dnl -Wtraditional (combines too many unrelated messages, only a few useful) 747dnl -Wwrite-strings (too noisy, but should review occasionally). This 748dnl is enabled for ncurses using "--enable-const". 749dnl -pedantic 750dnl 751dnl Parameter: 752dnl $1 is an optional list of gcc warning flags that a particular 753dnl application might want to use, e.g., "no-unused" for 754dnl -Wno-unused 755dnl Special: 756dnl If $with_ext_const is "yes", add a check for -Wwrite-strings 757dnl 758AC_DEFUN([CF_GCC_WARNINGS], 759[ 760AC_REQUIRE([CF_GCC_VERSION]) 761if test "x$have_x" = xyes; then CF_CONST_X_STRING fi 762cat > "conftest.$ac_ext" <<EOF 763#line __oline__ "${as_me:-configure}" 764int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; } 765EOF 766if test "$INTEL_COMPILER" = yes 767then 768# The "-wdXXX" options suppress warnings: 769# remark #1419: external declaration in primary source file 770# remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem) 771# remark #1684: conversion from pointer to same-sized integral type (potential portability problem) 772# remark #193: zero used for undefined preprocessing identifier 773# remark #593: variable "curs_sb_left_arrow" was set but never used 774# remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits 775# remark #869: parameter "tw" was never referenced 776# remark #981: operands are evaluated in unspecified order 777# warning #279: controlling expression is constant 778 779 AC_CHECKING([for $CC warning options]) 780 cf_save_CFLAGS="$CFLAGS" 781 EXTRA_CFLAGS="$EXTRA_CFLAGS -Wall" 782 for cf_opt in \ 783 wd1419 \ 784 wd1683 \ 785 wd1684 \ 786 wd193 \ 787 wd593 \ 788 wd279 \ 789 wd810 \ 790 wd869 \ 791 wd981 792 do 793 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" 794 if AC_TRY_EVAL(ac_compile); then 795 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt) 796 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" 797 fi 798 done 799 CFLAGS="$cf_save_CFLAGS" 800elif test "$GCC" = yes && test "$GCC_VERSION" != "unknown" 801then 802 AC_CHECKING([for $CC warning options]) 803 cf_save_CFLAGS="$CFLAGS" 804 cf_warn_CONST="" 805 test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings" 806 cf_gcc_warnings="Wignored-qualifiers Wlogical-op Wvarargs" 807 test "x$CLANG_COMPILER" = xyes && cf_gcc_warnings= 808 for cf_opt in W Wall \ 809 Wbad-function-cast \ 810 Wcast-align \ 811 Wcast-qual \ 812 Wdeclaration-after-statement \ 813 Wextra \ 814 Winline \ 815 Wmissing-declarations \ 816 Wmissing-prototypes \ 817 Wnested-externs \ 818 Wpointer-arith \ 819 Wshadow \ 820 Wstrict-prototypes \ 821 Wundef Wno-inline $cf_gcc_warnings $cf_warn_CONST $1 822 do 823 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" 824 if AC_TRY_EVAL(ac_compile); then 825 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt) 826 case "$cf_opt" in 827 (Winline) 828 case "$GCC_VERSION" in 829 ([[34]].*) 830 CF_VERBOSE(feature is broken in gcc $GCC_VERSION) 831 continue;; 832 esac 833 ;; 834 (Wpointer-arith) 835 case "$GCC_VERSION" in 836 ([[12]].*) 837 CF_VERBOSE(feature is broken in gcc $GCC_VERSION) 838 continue;; 839 esac 840 ;; 841 esac 842 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" 843 fi 844 done 845 CFLAGS="$cf_save_CFLAGS" 846fi 847rm -rf ./conftest* 848 849AC_SUBST(EXTRA_CFLAGS) 850])dnl 851dnl --------------------------------------------------------------------------- 852dnl CF_GETOPT_HEADER version: 8 updated: 2021/06/19 19:16:16 853dnl ---------------- 854dnl Check for getopt's variables which are commonly defined in stdlib.h, 855dnl unistd.h or (nonstandard) in getopt.h 856AC_DEFUN([CF_GETOPT_HEADER], 857[ 858AC_HAVE_HEADERS(unistd.h getopt.h) 859AC_CACHE_CHECK(for header declaring getopt variables,cf_cv_getopt_header,[ 860cf_cv_getopt_header=none 861for cf_header in stdio.h stdlib.h unistd.h getopt.h 862do 863AC_TRY_COMPILE([ 864#include <$cf_header>], 865[int x = optind; char *y = optarg; (void)x; (void)y], 866[cf_cv_getopt_header=$cf_header 867 break]) 868done 869]) 870if test "$cf_cv_getopt_header" != none ; then 871 AC_DEFINE(HAVE_GETOPT_HEADER,1,[Define to 1 if getopt variables are declared in header]) 872fi 873if test "$cf_cv_getopt_header" = getopt.h ; then 874 AC_DEFINE(NEED_GETOPT_H,1,[Define to 1 if we must include getopt.h]) 875fi 876])dnl 877dnl --------------------------------------------------------------------------- 878dnl CF_GNU_SOURCE version: 10 updated: 2018/12/10 20:09:41 879dnl ------------- 880dnl Check if we must define _GNU_SOURCE to get a reasonable value for 881dnl _XOPEN_SOURCE, upon which many POSIX definitions depend. This is a defect 882dnl (or misfeature) of glibc2, which breaks portability of many applications, 883dnl since it is interwoven with GNU extensions. 884dnl 885dnl Well, yes we could work around it... 886dnl 887dnl Parameters: 888dnl $1 is the nominal value for _XOPEN_SOURCE 889AC_DEFUN([CF_GNU_SOURCE], 890[ 891cf_gnu_xopen_source=ifelse($1,,500,$1) 892 893AC_CACHE_CHECK(if this is the GNU C library,cf_cv_gnu_library,[ 894AC_TRY_COMPILE([#include <sys/types.h>],[ 895 #if __GLIBC__ > 0 && __GLIBC_MINOR__ >= 0 896 return 0; 897 #elif __NEWLIB__ > 0 && __NEWLIB_MINOR__ >= 0 898 return 0; 899 #else 900 # error not GNU C library 901 #endif], 902 [cf_cv_gnu_library=yes], 903 [cf_cv_gnu_library=no]) 904]) 905 906if test x$cf_cv_gnu_library = xyes; then 907 908 # With glibc 2.19 (13 years after this check was begun), _DEFAULT_SOURCE 909 # was changed to help a little. newlib incorporated the change about 4 910 # years later. 911 AC_CACHE_CHECK(if _DEFAULT_SOURCE can be used as a basis,cf_cv_gnu_library_219,[ 912 cf_save="$CPPFLAGS" 913 CF_APPEND_TEXT(CPPFLAGS,-D_DEFAULT_SOURCE) 914 AC_TRY_COMPILE([#include <sys/types.h>],[ 915 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 19) || (__GLIBC__ > 2) 916 return 0; 917 #elif (__NEWLIB__ == 2 && __NEWLIB_MINOR__ >= 4) || (__GLIBC__ > 3) 918 return 0; 919 #else 920 # error GNU C library __GLIBC__.__GLIBC_MINOR__ is too old 921 #endif], 922 [cf_cv_gnu_library_219=yes], 923 [cf_cv_gnu_library_219=no]) 924 CPPFLAGS="$cf_save" 925 ]) 926 927 if test "x$cf_cv_gnu_library_219" = xyes; then 928 cf_save="$CPPFLAGS" 929 AC_CACHE_CHECK(if _XOPEN_SOURCE=$cf_gnu_xopen_source works with _DEFAULT_SOURCE,cf_cv_gnu_dftsrc_219,[ 930 CF_ADD_CFLAGS(-D_DEFAULT_SOURCE -D_XOPEN_SOURCE=$cf_gnu_xopen_source) 931 AC_TRY_COMPILE([ 932 #include <limits.h> 933 #include <sys/types.h> 934 ],[ 935 #if (_XOPEN_SOURCE >= $cf_gnu_xopen_source) && (MB_LEN_MAX > 1) 936 return 0; 937 #else 938 # error GNU C library is too old 939 #endif], 940 [cf_cv_gnu_dftsrc_219=yes], 941 [cf_cv_gnu_dftsrc_219=no]) 942 ]) 943 test "x$cf_cv_gnu_dftsrc_219" = "xyes" || CPPFLAGS="$cf_save" 944 else 945 cf_cv_gnu_dftsrc_219=maybe 946 fi 947 948 if test "x$cf_cv_gnu_dftsrc_219" != xyes; then 949 950 AC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[ 951 AC_TRY_COMPILE([#include <sys/types.h>],[ 952 #ifndef _XOPEN_SOURCE 953 #error expected _XOPEN_SOURCE to be defined 954 #endif], 955 [cf_cv_gnu_source=no], 956 [cf_save="$CPPFLAGS" 957 CF_ADD_CFLAGS(-D_GNU_SOURCE) 958 AC_TRY_COMPILE([#include <sys/types.h>],[ 959 #ifdef _XOPEN_SOURCE 960 #error expected _XOPEN_SOURCE to be undefined 961 #endif], 962 [cf_cv_gnu_source=no], 963 [cf_cv_gnu_source=yes]) 964 CPPFLAGS="$cf_save" 965 ]) 966 ]) 967 968 if test "$cf_cv_gnu_source" = yes 969 then 970 AC_CACHE_CHECK(if we should also define _DEFAULT_SOURCE,cf_cv_default_source,[ 971 CF_APPEND_TEXT(CPPFLAGS,-D_GNU_SOURCE) 972 AC_TRY_COMPILE([#include <sys/types.h>],[ 973 #ifdef _DEFAULT_SOURCE 974 #error expected _DEFAULT_SOURCE to be undefined 975 #endif], 976 [cf_cv_default_source=no], 977 [cf_cv_default_source=yes]) 978 ]) 979 if test "$cf_cv_default_source" = yes 980 then 981 CF_APPEND_TEXT(CPPFLAGS,-D_DEFAULT_SOURCE) 982 fi 983 fi 984 fi 985 986fi 987])dnl 988dnl --------------------------------------------------------------------------- 989dnl CF_INTEL_COMPILER version: 8 updated: 2021/01/01 16:53:59 990dnl ----------------- 991dnl Check if the given compiler is really the Intel compiler for Linux. It 992dnl tries to imitate gcc, but does not return an error when it finds a mismatch 993dnl between prototypes, e.g., as exercised by CF_MISSING_CHECK. 994dnl 995dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to 996dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from 997dnl the wrappers for gcc and g++ warnings. 998dnl 999dnl $1 = GCC (default) or GXX 1000dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS 1001dnl $3 = CFLAGS (default) or CXXFLAGS 1002AC_DEFUN([CF_INTEL_COMPILER],[ 1003AC_REQUIRE([AC_CANONICAL_HOST]) 1004ifelse([$2],,INTEL_COMPILER,[$2])=no 1005 1006if test "$ifelse([$1],,[$1],GCC)" = yes ; then 1007 case "$host_os" in 1008 (linux*|gnu*) 1009 AC_MSG_CHECKING(if this is really Intel ifelse([$1],GXX,C++,C) compiler) 1010 cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])" 1011 ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -no-gcc" 1012 AC_TRY_COMPILE([],[ 1013#ifdef __INTEL_COMPILER 1014#else 1015make an error 1016#endif 1017],[ifelse([$2],,INTEL_COMPILER,[$2])=yes 1018cf_save_CFLAGS="$cf_save_CFLAGS -we147" 1019],[]) 1020 ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS" 1021 AC_MSG_RESULT($ifelse([$2],,INTEL_COMPILER,[$2])) 1022 ;; 1023 esac 1024fi 1025])dnl 1026dnl --------------------------------------------------------------------------- 1027dnl CF_MAKE_DOCS version: 5 updated: 2021/01/10 16:05:11 1028dnl ------------ 1029dnl $1 = name(s) to generate rules for 1030dnl $2 = suffix of corresponding manpages used as input. 1031dnl 1032dnl This works best if called at the end of configure.in, following CF_WITH_MAN2HTML 1033define([CF_MAKE_DOCS],[ 1034test -z "$cf_make_docs" && cf_make_docs=0 1035 1036cf_output=makefile 1037test -f "$cf_output" || cf_output=Makefile 1038 1039if test "$cf_make_docs" = 0 1040then 1041cat >>$cf_output <<CF_EOF 1042################################################################################ 1043## generated by $0 1044.SUFFIXES : .html .$2 .man .ps .pdf .txt 1045 1046${NROFF_NOTE}.$2.txt : 1047${NROFF_NOTE} [\$](SHELL) -c "tbl [\$]*.$2 | nroff -man | col -bx" >[\$]@ 1048 1049${GROFF_NOTE}.ps.pdf : 1050${GROFF_NOTE} ps2pdf [\$]*.ps 1051${GROFF_NOTE} 1052${GROFF_NOTE}.$2.ps : 1053${GROFF_NOTE} [\$](SHELL) -c "tbl [\$]*.$2 | groff -man" >[\$]@ 1054${GROFF_NOTE} 1055${GROFF_NOTE}.$2.txt : 1056${GROFF_NOTE} GROFF_NO_SGR=stupid [\$](SHELL) -c "tbl [\$]*.$2 | nroff -rHY=0 -Tascii -man | col -bx" >[\$]@ 1057 1058${MAN2HTML_NOTE}.$2.html : 1059${MAN2HTML_NOTE} ./${MAN2HTML_TEMP} [\$]* $2 man >[\$]@ 1060 1061CF_EOF 1062 cf_make_docs=1 1063fi 1064 1065for cf_name in $1 1066do 1067cat >>$cf_output <<CF_EOF 1068################################################################################ 1069${NROFF_NOTE}docs docs-$cf_name :: $cf_name.txt 1070${MAN2HTML_NOTE}docs docs-$cf_name :: $cf_name.html 1071${GROFF_NOTE}docs docs-$cf_name :: $cf_name.pdf 1072${GROFF_NOTE}docs docs-$cf_name :: $cf_name.ps 1073${GROFF_NOTE}docs docs-$cf_name :: $cf_name.txt 1074 1075clean \\ 1076docs-clean :: 1077${NROFF_NOTE} rm -f $cf_name.txt 1078${MAN2HTML_NOTE} rm -f $cf_name.html 1079${GROFF_NOTE} rm -f $cf_name.pdf 1080${GROFF_NOTE} rm -f $cf_name.ps 1081${GROFF_NOTE} rm -f $cf_name.txt 1082 1083${NROFF_NOTE}$cf_name.txt : $cf_name.$2 1084${MAN2HTML_NOTE}$cf_name.html : $cf_name.$2 1085${GROFF_NOTE}$cf_name.pdf : $cf_name.ps 1086${GROFF_NOTE}$cf_name.ps : $cf_name.$2 1087${GROFF_NOTE}$cf_name.txt : $cf_name.$2 1088CF_EOF 1089done 1090])dnl 1091dnl --------------------------------------------------------------------------- 1092dnl CF_MAKE_TAGS version: 6 updated: 2010/10/23 15:52:32 1093dnl ------------ 1094dnl Generate tags/TAGS targets for makefiles. Do not generate TAGS if we have 1095dnl a monocase filesystem. 1096AC_DEFUN([CF_MAKE_TAGS],[ 1097AC_REQUIRE([CF_MIXEDCASE_FILENAMES]) 1098 1099AC_CHECK_PROGS(CTAGS, exctags ctags) 1100AC_CHECK_PROGS(ETAGS, exetags etags) 1101 1102AC_CHECK_PROG(MAKE_LOWER_TAGS, ${CTAGS:-ctags}, yes, no) 1103 1104if test "$cf_cv_mixedcase" = yes ; then 1105 AC_CHECK_PROG(MAKE_UPPER_TAGS, ${ETAGS:-etags}, yes, no) 1106else 1107 MAKE_UPPER_TAGS=no 1108fi 1109 1110if test "$MAKE_UPPER_TAGS" = yes ; then 1111 MAKE_UPPER_TAGS= 1112else 1113 MAKE_UPPER_TAGS="#" 1114fi 1115 1116if test "$MAKE_LOWER_TAGS" = yes ; then 1117 MAKE_LOWER_TAGS= 1118else 1119 MAKE_LOWER_TAGS="#" 1120fi 1121 1122AC_SUBST(CTAGS) 1123AC_SUBST(ETAGS) 1124 1125AC_SUBST(MAKE_UPPER_TAGS) 1126AC_SUBST(MAKE_LOWER_TAGS) 1127])dnl 1128dnl --------------------------------------------------------------------------- 1129dnl CF_MIXEDCASE_FILENAMES version: 9 updated: 2021/01/01 16:53:59 1130dnl ---------------------- 1131dnl Check if the file-system supports mixed-case filenames. If we're able to 1132dnl create a lowercase name and see it as uppercase, it doesn't support that. 1133AC_DEFUN([CF_MIXEDCASE_FILENAMES], 1134[ 1135AC_CACHE_CHECK(if filesystem supports mixed-case filenames,cf_cv_mixedcase,[ 1136if test "$cross_compiling" = yes ; then 1137 case "$target_alias" in 1138 (*-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-msys*|*-mingw*|*-uwin*|darwin*) 1139 cf_cv_mixedcase=no 1140 ;; 1141 (*) 1142 cf_cv_mixedcase=yes 1143 ;; 1144 esac 1145else 1146 rm -f conftest CONFTEST 1147 echo test >conftest 1148 if test -f CONFTEST ; then 1149 cf_cv_mixedcase=no 1150 else 1151 cf_cv_mixedcase=yes 1152 fi 1153 rm -f conftest CONFTEST 1154fi 1155]) 1156test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES,1,[Define to 1 if filesystem supports mixed-case filenames.]) 1157])dnl 1158dnl --------------------------------------------------------------------------- 1159dnl CF_MKSTEMP version: 12 updated: 2023/01/05 17:53:11 1160dnl ---------- 1161dnl Check for a working mkstemp. This creates two files, checks that they are 1162dnl successfully created and distinct (AmigaOS apparently fails on the last). 1163AC_DEFUN([CF_MKSTEMP],[ 1164AC_CHECK_HEADERS( \ 1165unistd.h \ 1166) 1167AC_CACHE_CHECK(for working mkstemp, cf_cv_func_mkstemp,[ 1168rm -rf ./conftest* 1169AC_TRY_RUN([ 1170$ac_includes_default 1171 1172int main(void) 1173{ 1174 char *tmpl = "conftestXXXXXX"; 1175 char name[2][80]; 1176 int n; 1177 int result = 0; 1178 int fd; 1179 struct stat sb; 1180 1181 umask(077); 1182 for (n = 0; n < 2; ++n) { 1183 strcpy(name[n], tmpl); 1184 if ((fd = mkstemp(name[n])) >= 0) { 1185 if (!strcmp(name[n], tmpl) 1186 || stat(name[n], &sb) != 0 1187 || (sb.st_mode & S_IFMT) != S_IFREG 1188 || (sb.st_mode & 077) != 0) { 1189 result = 1; 1190 } 1191 close(fd); 1192 } 1193 } 1194 if (result == 0 1195 && !strcmp(name[0], name[1])) 1196 result = 1; 1197 ${cf_cv_main_return:-return}(result); 1198} 1199],[cf_cv_func_mkstemp=yes 1200],[cf_cv_func_mkstemp=no 1201],[cf_cv_func_mkstemp=maybe]) 1202]) 1203if test "x$cf_cv_func_mkstemp" = xmaybe ; then 1204 AC_CHECK_FUNC(mkstemp) 1205fi 1206if test "x$cf_cv_func_mkstemp" = xyes || test "x$ac_cv_func_mkstemp" = xyes ; then 1207 AC_DEFINE(HAVE_MKSTEMP,1,[Define to 1 if mkstemp() is available and working.]) 1208fi 1209])dnl 1210dnl --------------------------------------------------------------------------- 1211dnl CF_MSG_LOG version: 5 updated: 2010/10/23 15:52:32 1212dnl ---------- 1213dnl Write a debug message to config.log, along with the line number in the 1214dnl configure script. 1215AC_DEFUN([CF_MSG_LOG],[ 1216echo "${as_me:-configure}:__oline__: testing $* ..." 1>&AC_FD_CC 1217])dnl 1218dnl --------------------------------------------------------------------------- 1219dnl CF_NO_LEAKS_OPTION version: 9 updated: 2021/06/13 19:45:41 1220dnl ------------------ 1221dnl see CF_WITH_NO_LEAKS 1222dnl 1223dnl $1 = option/name 1224dnl $2 = help-text 1225dnl $3 = symbol to define if the option is set 1226dnl $4 = additional actions to take if the option is set 1227AC_DEFUN([CF_NO_LEAKS_OPTION],[ 1228AC_MSG_CHECKING(if you want to use $1 for testing) 1229AC_ARG_WITH($1, 1230 [$2], 1231 [case "x$withval" in 1232 (x|xno) ;; 1233 (*) 1234 : "${with_cflags:=-g}" 1235 : "${enable_leaks:=no}" 1236 with_$1=yes 1237 AC_DEFINE_UNQUOTED($3,1,"Define to 1 if you want to use $1 for testing.")ifelse([$4],,[ 1238 $4 1239]) 1240 ;; 1241 esac], 1242 [with_$1=]) 1243AC_MSG_RESULT(${with_$1:-no}) 1244 1245case ".$with_cflags" in 1246(.*-g*) 1247 case .$CFLAGS in 1248 (.*-g*) 1249 ;; 1250 (*) 1251 CF_ADD_CFLAGS([-g]) 1252 ;; 1253 esac 1254 ;; 1255esac 1256])dnl 1257dnl --------------------------------------------------------------------------- 1258dnl CF_PATH_SYNTAX version: 18 updated: 2020/12/31 18:40:20 1259dnl -------------- 1260dnl Check the argument to see that it looks like a pathname. Rewrite it if it 1261dnl begins with one of the prefix/exec_prefix variables, and then again if the 1262dnl result begins with 'NONE'. This is necessary to work around autoconf's 1263dnl delayed evaluation of those symbols. 1264AC_DEFUN([CF_PATH_SYNTAX],[ 1265if test "x$prefix" != xNONE; then 1266 cf_path_syntax="$prefix" 1267else 1268 cf_path_syntax="$ac_default_prefix" 1269fi 1270 1271case ".[$]$1" in 1272(.\[$]\(*\)*|.\'*\'*) 1273 ;; 1274(..|./*|.\\*) 1275 ;; 1276(.[[a-zA-Z]]:[[\\/]]*) # OS/2 EMX 1277 ;; 1278(.\[$]\{*prefix\}*|.\[$]\{*dir\}*) 1279 eval $1="[$]$1" 1280 case ".[$]$1" in 1281 (.NONE/*) 1282 $1=`echo "[$]$1" | sed -e s%NONE%$cf_path_syntax%` 1283 ;; 1284 esac 1285 ;; 1286(.no|.NONE/*) 1287 $1=`echo "[$]$1" | sed -e s%NONE%$cf_path_syntax%` 1288 ;; 1289(*) 1290 ifelse([$2],,[AC_MSG_ERROR([expected a pathname, not \"[$]$1\"])],$2) 1291 ;; 1292esac 1293])dnl 1294dnl --------------------------------------------------------------------------- 1295dnl CF_POSIX_C_SOURCE version: 11 updated: 2018/12/31 20:46:17 1296dnl ----------------- 1297dnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed. 1298dnl 1299dnl POSIX.1-1990 _POSIX_SOURCE 1300dnl POSIX.1-1990 and _POSIX_SOURCE and 1301dnl POSIX.2-1992 C-Language _POSIX_C_SOURCE=2 1302dnl Bindings Option 1303dnl POSIX.1b-1993 _POSIX_C_SOURCE=199309L 1304dnl POSIX.1c-1996 _POSIX_C_SOURCE=199506L 1305dnl X/Open 2000 _POSIX_C_SOURCE=200112L 1306dnl 1307dnl Parameters: 1308dnl $1 is the nominal value for _POSIX_C_SOURCE 1309AC_DEFUN([CF_POSIX_C_SOURCE], 1310[AC_REQUIRE([CF_POSIX_VISIBLE])dnl 1311 1312if test "$cf_cv_posix_visible" = no; then 1313 1314cf_POSIX_C_SOURCE=ifelse([$1],,199506L,[$1]) 1315 1316cf_save_CFLAGS="$CFLAGS" 1317cf_save_CPPFLAGS="$CPPFLAGS" 1318 1319CF_REMOVE_DEFINE(cf_trim_CFLAGS,$cf_save_CFLAGS,_POSIX_C_SOURCE) 1320CF_REMOVE_DEFINE(cf_trim_CPPFLAGS,$cf_save_CPPFLAGS,_POSIX_C_SOURCE) 1321 1322AC_CACHE_CHECK(if we should define _POSIX_C_SOURCE,cf_cv_posix_c_source,[ 1323 CF_MSG_LOG(if the symbol is already defined go no further) 1324 AC_TRY_COMPILE([#include <sys/types.h>],[ 1325#ifndef _POSIX_C_SOURCE 1326make an error 1327#endif], 1328 [cf_cv_posix_c_source=no], 1329 [cf_want_posix_source=no 1330 case .$cf_POSIX_C_SOURCE in 1331 (.[[12]]??*) 1332 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" 1333 ;; 1334 (.2) 1335 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" 1336 cf_want_posix_source=yes 1337 ;; 1338 (.*) 1339 cf_want_posix_source=yes 1340 ;; 1341 esac 1342 if test "$cf_want_posix_source" = yes ; then 1343 AC_TRY_COMPILE([#include <sys/types.h>],[ 1344#ifdef _POSIX_SOURCE 1345make an error 1346#endif],[], 1347 cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE") 1348 fi 1349 CF_MSG_LOG(ifdef from value $cf_POSIX_C_SOURCE) 1350 CFLAGS="$cf_trim_CFLAGS" 1351 CPPFLAGS="$cf_trim_CPPFLAGS" 1352 CF_APPEND_TEXT(CPPFLAGS,$cf_cv_posix_c_source) 1353 CF_MSG_LOG(if the second compile does not leave our definition intact error) 1354 AC_TRY_COMPILE([#include <sys/types.h>],[ 1355#ifndef _POSIX_C_SOURCE 1356make an error 1357#endif],, 1358 [cf_cv_posix_c_source=no]) 1359 CFLAGS="$cf_save_CFLAGS" 1360 CPPFLAGS="$cf_save_CPPFLAGS" 1361 ]) 1362]) 1363 1364if test "$cf_cv_posix_c_source" != no ; then 1365 CFLAGS="$cf_trim_CFLAGS" 1366 CPPFLAGS="$cf_trim_CPPFLAGS" 1367 CF_ADD_CFLAGS($cf_cv_posix_c_source) 1368fi 1369 1370fi # cf_cv_posix_visible 1371 1372])dnl 1373dnl --------------------------------------------------------------------------- 1374dnl CF_POSIX_VISIBLE version: 1 updated: 2018/12/31 20:46:17 1375dnl ---------------- 1376dnl POSIX documents test-macros which an application may set before any system 1377dnl headers are included to make features available. 1378dnl 1379dnl Some BSD platforms (originally FreeBSD, but copied by a few others) 1380dnl diverged from POSIX in 2002 by setting symbols which make all of the most 1381dnl recent features visible in the system header files unless the application 1382dnl overrides the corresponding test-macros. Doing that introduces portability 1383dnl problems. 1384dnl 1385dnl This macro makes a special check for the symbols used for this, to avoid a 1386dnl conflicting definition. 1387AC_DEFUN([CF_POSIX_VISIBLE], 1388[ 1389AC_CACHE_CHECK(if the POSIX test-macros are already defined,cf_cv_posix_visible,[ 1390AC_TRY_COMPILE([#include <stdio.h>],[ 1391#if defined(__POSIX_VISIBLE) && ((__POSIX_VISIBLE - 0L) > 0) \ 1392 && defined(__XSI_VISIBLE) && ((__XSI_VISIBLE - 0L) > 0) \ 1393 && defined(__BSD_VISIBLE) && ((__BSD_VISIBLE - 0L) > 0) \ 1394 && defined(__ISO_C_VISIBLE) && ((__ISO_C_VISIBLE - 0L) > 0) 1395#error conflicting symbols found 1396#endif 1397],[cf_cv_posix_visible=no],[cf_cv_posix_visible=yes]) 1398]) 1399])dnl 1400dnl --------------------------------------------------------------------------- 1401dnl CF_PROG_AWK version: 1 updated: 2006/09/16 11:40:59 1402dnl ----------- 1403dnl Check for awk, ensure that the check found something. 1404AC_DEFUN([CF_PROG_AWK], 1405[ 1406AC_PROG_AWK 1407test -z "$AWK" && AC_MSG_ERROR(No awk program found) 1408])dnl 1409dnl --------------------------------------------------------------------------- 1410dnl CF_PROG_CC version: 5 updated: 2019/12/31 08:53:54 1411dnl ---------- 1412dnl standard check for CC, plus followup sanity checks 1413dnl $1 = optional parameter to pass to AC_PROG_CC to specify compiler name 1414AC_DEFUN([CF_PROG_CC],[ 1415CF_ACVERSION_CHECK(2.53, 1416 [AC_MSG_WARN(this will incorrectly handle gnatgcc choice) 1417 AC_REQUIRE([AC_PROG_CC])], 1418 []) 1419ifelse($1,,[AC_PROG_CC],[AC_PROG_CC($1)]) 1420CF_GCC_VERSION 1421CF_ACVERSION_CHECK(2.52, 1422 [AC_PROG_CC_STDC], 1423 [CF_ANSI_CC_REQD]) 1424CF_CC_ENV_FLAGS 1425])dnl 1426dnl --------------------------------------------------------------------------- 1427dnl CF_PROG_GROFF version: 3 updated: 2018/01/07 13:16:19 1428dnl ------------- 1429dnl Check if groff is available, for cases (such as html output) where nroff 1430dnl is not enough. 1431AC_DEFUN([CF_PROG_GROFF],[ 1432AC_PATH_PROG(GROFF_PATH,groff,no) 1433AC_PATH_PROGS(NROFF_PATH,nroff mandoc,no) 1434AC_PATH_PROG(TBL_PATH,tbl,cat) 1435if test "x$GROFF_PATH" = xno 1436then 1437 NROFF_NOTE= 1438 GROFF_NOTE="#" 1439else 1440 NROFF_NOTE="#" 1441 GROFF_NOTE= 1442fi 1443AC_SUBST(GROFF_NOTE) 1444AC_SUBST(NROFF_NOTE) 1445])dnl 1446dnl --------------------------------------------------------------------------- 1447dnl CF_PROG_LINT version: 5 updated: 2022/08/20 15:44:13 1448dnl ------------ 1449AC_DEFUN([CF_PROG_LINT], 1450[ 1451AC_CHECK_PROGS(LINT, lint cppcheck splint) 1452case "x$LINT" in 1453(xcppcheck|x*/cppcheck) 1454 test -z "$LINT_OPTS" && LINT_OPTS="--enable=all" 1455 ;; 1456esac 1457AC_SUBST(LINT_OPTS) 1458AC_SUBST(LINT_LIBS) 1459])dnl 1460dnl --------------------------------------------------------------------------- 1461dnl CF_REMOVE_CFLAGS version: 3 updated: 2021/09/05 17:25:40 1462dnl ---------------- 1463dnl Remove a given option from CFLAGS/CPPFLAGS 1464dnl $1 = option to remove 1465dnl $2 = variable to update 1466dnl $3 = nonempty to allow verbose message 1467define([CF_REMOVE_CFLAGS], 1468[ 1469cf_tmp_cflag=`echo "x$1" | sed -e 's/^.//' -e 's/=.*//'` 1470while true 1471do 1472 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'` 1473 test "[$]$2" != "$cf_old_cflag" || break 1474 ifelse([$3],,,[CF_VERBOSE(removing old option $1 from $2)]) 1475 $2="$cf_old_cflag" 1476done 1477])dnl 1478dnl --------------------------------------------------------------------------- 1479dnl CF_REMOVE_DEFINE version: 3 updated: 2010/01/09 11:05:50 1480dnl ---------------- 1481dnl Remove all -U and -D options that refer to the given symbol from a list 1482dnl of C compiler options. This works around the problem that not all 1483dnl compilers process -U and -D options from left-to-right, so a -U option 1484dnl cannot be used to cancel the effect of a preceding -D option. 1485dnl 1486dnl $1 = target (which could be the same as the source variable) 1487dnl $2 = source (including '$') 1488dnl $3 = symbol to remove 1489define([CF_REMOVE_DEFINE], 1490[ 1491$1=`echo "$2" | \ 1492 sed -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[[ ]]/ /g' \ 1493 -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[$]//g'` 1494])dnl 1495dnl --------------------------------------------------------------------------- 1496dnl CF_TRY_XOPEN_SOURCE version: 4 updated: 2022/09/10 15:16:16 1497dnl ------------------- 1498dnl If _XOPEN_SOURCE is not defined in the compile environment, check if we 1499dnl can define it successfully. 1500AC_DEFUN([CF_TRY_XOPEN_SOURCE],[ 1501AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[ 1502 AC_TRY_COMPILE(CF__XOPEN_SOURCE_HEAD,CF__XOPEN_SOURCE_BODY, 1503 [cf_cv_xopen_source=no], 1504 [cf_save="$CPPFLAGS" 1505 CF_APPEND_TEXT(CPPFLAGS,-D_XOPEN_SOURCE=$cf_XOPEN_SOURCE) 1506 AC_TRY_COMPILE(CF__XOPEN_SOURCE_HEAD,CF__XOPEN_SOURCE_BODY, 1507 [cf_cv_xopen_source=no], 1508 [cf_cv_xopen_source=$cf_XOPEN_SOURCE]) 1509 CPPFLAGS="$cf_save" 1510 ]) 1511]) 1512 1513if test "$cf_cv_xopen_source" != no ; then 1514 CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE) 1515 CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE) 1516 cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source" 1517 CF_APPEND_CFLAGS($cf_temp_xopen_source) 1518fi 1519]) 1520dnl --------------------------------------------------------------------------- 1521dnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59 1522dnl -------- 1523dnl Make an uppercase version of a variable 1524dnl $1=uppercase($2) 1525AC_DEFUN([CF_UPPER], 1526[ 1527$1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` 1528])dnl 1529dnl --------------------------------------------------------------------------- 1530dnl CF_VERBOSE version: 3 updated: 2007/07/29 09:55:12 1531dnl ---------- 1532dnl Use AC_VERBOSE w/o the warnings 1533AC_DEFUN([CF_VERBOSE], 1534[test -n "$verbose" && echo " $1" 1>&AC_FD_MSG 1535CF_MSG_LOG([$1]) 1536])dnl 1537dnl --------------------------------------------------------------------------- 1538dnl CF_WITHOUT_X version: 3 updated: 2021/01/13 16:51:52 1539dnl ------------ 1540dnl Use this to cancel the check for X headers/libraries which would be pulled 1541dnl in via CF_GCC_WARNINGS. 1542define([CF_WITHOUT_X], 1543AC_DEFUN([AC_PATH_XTRA],[]) 1544AC_DEFUN([CF_SAVE_XTRA_FLAGS],[]) 1545AC_DEFUN([CF_RESTORE_XTRA_FLAGS],[]) 1546AC_DEFUN([CF_CONST_X_STRING],[echo "skipping X-const check";])dnl 1547AC_SUBST(X_CFLAGS) 1548AC_SUBST(X_LIBS) 1549[])dnl 1550dnl --------------------------------------------------------------------------- 1551dnl CF_WITH_DBMALLOC version: 7 updated: 2010/06/21 17:26:47 1552dnl ---------------- 1553dnl Configure-option for dbmalloc. The optional parameter is used to override 1554dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests. 1555AC_DEFUN([CF_WITH_DBMALLOC],[ 1556CF_NO_LEAKS_OPTION(dbmalloc, 1557 [ --with-dbmalloc test: use Conor Cahill's dbmalloc library], 1558 [USE_DBMALLOC]) 1559 1560if test "$with_dbmalloc" = yes ; then 1561 AC_CHECK_HEADER(dbmalloc.h, 1562 [AC_CHECK_LIB(dbmalloc,[debug_malloc]ifelse([$1],,[],[,$1]))]) 1563fi 1564])dnl 1565dnl --------------------------------------------------------------------------- 1566dnl CF_WITH_DMALLOC version: 7 updated: 2010/06/21 17:26:47 1567dnl --------------- 1568dnl Configure-option for dmalloc. The optional parameter is used to override 1569dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests. 1570AC_DEFUN([CF_WITH_DMALLOC],[ 1571CF_NO_LEAKS_OPTION(dmalloc, 1572 [ --with-dmalloc test: use Gray Watson's dmalloc library], 1573 [USE_DMALLOC]) 1574 1575if test "$with_dmalloc" = yes ; then 1576 AC_CHECK_HEADER(dmalloc.h, 1577 [AC_CHECK_LIB(dmalloc,[dmalloc_debug]ifelse([$1],,[],[,$1]))]) 1578fi 1579])dnl 1580dnl --------------------------------------------------------------------------- 1581dnl CF_WITH_MAN2HTML version: 12 updated: 2021/01/03 18:30:50 1582dnl ---------------- 1583dnl Check for man2html and groff. Prefer man2html over groff, but use groff 1584dnl as a fallback. See 1585dnl 1586dnl http://invisible-island.net/scripts/man2html.html 1587dnl 1588dnl Generate a shell script which hides the differences between the two. 1589dnl 1590dnl We name that "man2html.tmp". 1591dnl 1592dnl The shell script can be removed later, e.g., using "make distclean". 1593AC_DEFUN([CF_WITH_MAN2HTML],[ 1594AC_REQUIRE([CF_PROG_GROFF])dnl 1595AC_REQUIRE([AC_PROG_FGREP])dnl 1596 1597case "x${with_man2html}" in 1598(xno) 1599 cf_man2html=no 1600 ;; 1601(x|xyes) 1602 AC_PATH_PROG(cf_man2html,man2html,no) 1603 case "x$cf_man2html" in 1604 (x/*) 1605 AC_MSG_CHECKING(for the modified Earl Hood script) 1606 if ( $cf_man2html -help 2>&1 | grep 'Make an index of headers at the end' >/dev/null ) 1607 then 1608 cf_man2html_ok=yes 1609 else 1610 cf_man2html=no 1611 cf_man2html_ok=no 1612 fi 1613 AC_MSG_RESULT($cf_man2html_ok) 1614 ;; 1615 (*) 1616 cf_man2html=no 1617 ;; 1618 esac 1619esac 1620 1621AC_MSG_CHECKING(for program to convert manpage to html) 1622AC_ARG_WITH(man2html, 1623 [ --with-man2html=XXX use XXX rather than groff], 1624 [cf_man2html=$withval], 1625 [cf_man2html=$cf_man2html]) 1626 1627cf_with_groff=no 1628 1629case $cf_man2html in 1630(yes) 1631 AC_MSG_RESULT(man2html) 1632 AC_PATH_PROG(cf_man2html,man2html,no) 1633 ;; 1634(no|groff|*/groff*) 1635 cf_with_groff=yes 1636 cf_man2html=$GROFF_PATH 1637 AC_MSG_RESULT($cf_man2html) 1638 ;; 1639(*) 1640 AC_MSG_RESULT($cf_man2html) 1641 ;; 1642esac 1643 1644MAN2HTML_TEMP="man2html.tmp" 1645 cat >$MAN2HTML_TEMP <<CF_EOF 1646#!$SHELL 1647# Temporary script generated by CF_WITH_MAN2HTML 1648# Convert inputs to html, sending result to standard output. 1649# 1650# Parameters: 1651# \${1} = rootname of file to convert 1652# \${2} = suffix of file to convert, e.g., "1" 1653# \${3} = macros to use, e.g., "man" 1654# 1655ROOT=\[$]1 1656TYPE=\[$]2 1657MACS=\[$]3 1658 1659unset LANG 1660unset LC_ALL 1661unset LC_CTYPE 1662unset LANGUAGE 1663GROFF_NO_SGR=stupid 1664export GROFF_NO_SGR 1665 1666CF_EOF 1667 1668NROFF_OPTS= 1669if test "x$cf_with_groff" = xyes 1670then 1671 MAN2HTML_NOTE="$GROFF_NOTE" 1672 MAN2HTML_PATH="$GROFF_PATH" 1673 cat >>$MAN2HTML_TEMP <<CF_EOF 1674$SHELL -c "$TBL_PATH \${ROOT}.\${TYPE} | $GROFF_PATH -P -o0 -I\${ROOT}_ -Thtml -\${MACS}" 1675CF_EOF 1676else 1677 # disable hyphenation if this is groff 1678 if test "x$GROFF_PATH" != xno 1679 then 1680 AC_MSG_CHECKING(if nroff is really groff) 1681 cf_check_groff="`$NROFF_PATH --version 2>/dev/null | grep groff`" 1682 test -n "$cf_check_groff" && cf_check_groff=yes 1683 test -n "$cf_check_groff" || cf_check_groff=no 1684 AC_MSG_RESULT($cf_check_groff) 1685 test "x$cf_check_groff" = xyes && NROFF_OPTS="-rHY=0" 1686 fi 1687 MAN2HTML_NOTE="" 1688 CF_PATH_SYNTAX(cf_man2html) 1689 MAN2HTML_PATH="$cf_man2html" 1690 AC_MSG_CHECKING(for $cf_man2html top/bottom margins) 1691 1692 # for this example, expect 3 lines of content, the remainder is head/foot 1693 cat >conftest.in <<CF_EOF 1694.TH HEAD1 HEAD2 HEAD3 HEAD4 HEAD5 1695.SH SECTION 1696MARKER 1697CF_EOF 1698 1699 LC_ALL=C LC_CTYPE=C LANG=C LANGUAGE=C $NROFF_PATH -man conftest.in >conftest.out 1700 1701 cf_man2html_1st="`${FGREP-fgrep} -n MARKER conftest.out |sed -e 's/^[[^0-9]]*://' -e 's/:.*//'`" 1702 cf_man2html_top=`expr "$cf_man2html_1st" - 2` 1703 cf_man2html_bot="`wc -l conftest.out |sed -e 's/[[^0-9]]//g'`" 1704 cf_man2html_bot=`expr "$cf_man2html_bot" - 2 - "$cf_man2html_top"` 1705 cf_man2html_top_bot="-topm=$cf_man2html_top -botm=$cf_man2html_bot" 1706 1707 AC_MSG_RESULT($cf_man2html_top_bot) 1708 1709 AC_MSG_CHECKING(for pagesize to use) 1710 for cf_block in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1711 do 1712 cat >>conftest.in <<CF_EOF 1713.nf 17140 17151 17162 17173 17184 17195 17206 17217 17228 17239 1724CF_EOF 1725 done 1726 1727 LC_ALL=C LC_CTYPE=C LANG=C LANGUAGE=C $NROFF_PATH -man conftest.in >conftest.out 1728 cf_man2html_page="`${FGREP-fgrep} -n HEAD1 conftest.out |sed -n '$p' |sed -e 's/^[[^0-9]]*://' -e 's/:.*//'`" 1729 test -z "$cf_man2html_page" && cf_man2html_page=99999 1730 test "$cf_man2html_page" -gt 100 && cf_man2html_page=99999 1731 1732 rm -rf conftest* 1733 AC_MSG_RESULT($cf_man2html_page) 1734 1735 cat >>$MAN2HTML_TEMP <<CF_EOF 1736: \${MAN2HTML_PATH=$MAN2HTML_PATH} 1737MAN2HTML_OPTS="\$MAN2HTML_OPTS -index -title=\"\$ROOT(\$TYPE)\" -compress -pgsize $cf_man2html_page" 1738case \${TYPE} in 1739(ms) 1740 $TBL_PATH \${ROOT}.\${TYPE} | $NROFF_PATH $NROFF_OPTS -\${MACS} | \$MAN2HTML_PATH -topm=0 -botm=0 \$MAN2HTML_OPTS 1741 ;; 1742(*) 1743 $TBL_PATH \${ROOT}.\${TYPE} | $NROFF_PATH $NROFF_OPTS -\${MACS} | \$MAN2HTML_PATH $cf_man2html_top_bot \$MAN2HTML_OPTS 1744 ;; 1745esac 1746CF_EOF 1747fi 1748 1749chmod 700 $MAN2HTML_TEMP 1750 1751AC_SUBST(MAN2HTML_NOTE) 1752AC_SUBST(MAN2HTML_PATH) 1753AC_SUBST(MAN2HTML_TEMP) 1754])dnl 1755dnl --------------------------------------------------------------------------- 1756dnl CF_WITH_VALGRIND version: 1 updated: 2006/12/14 18:00:21 1757dnl ---------------- 1758AC_DEFUN([CF_WITH_VALGRIND],[ 1759CF_NO_LEAKS_OPTION(valgrind, 1760 [ --with-valgrind test: use valgrind], 1761 [USE_VALGRIND]) 1762])dnl 1763dnl --------------------------------------------------------------------------- 1764dnl CF_XOPEN_SOURCE version: 63 updated: 2022/12/29 10:10:26 1765dnl --------------- 1766dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions, 1767dnl or adapt to the vendor's definitions to get equivalent functionality, 1768dnl without losing the common non-POSIX features. 1769dnl 1770dnl Parameters: 1771dnl $1 is the nominal value for _XOPEN_SOURCE 1772dnl $2 is the nominal value for _POSIX_C_SOURCE 1773AC_DEFUN([CF_XOPEN_SOURCE],[ 1774AC_REQUIRE([AC_CANONICAL_HOST]) 1775AC_REQUIRE([CF_POSIX_VISIBLE]) 1776 1777if test "$cf_cv_posix_visible" = no; then 1778 1779cf_XOPEN_SOURCE=ifelse([$1],,500,[$1]) 1780cf_POSIX_C_SOURCE=ifelse([$2],,199506L,[$2]) 1781cf_xopen_source= 1782 1783case "$host_os" in 1784(aix[[4-7]]*) 1785 cf_xopen_source="-D_ALL_SOURCE" 1786 ;; 1787(msys) 1788 cf_XOPEN_SOURCE=600 1789 ;; 1790(darwin[[0-8]].*) 1791 cf_xopen_source="-D_APPLE_C_SOURCE" 1792 ;; 1793(darwin*) 1794 cf_xopen_source="-D_DARWIN_C_SOURCE" 1795 cf_XOPEN_SOURCE= 1796 ;; 1797(freebsd*|dragonfly*|midnightbsd*) 1798 # 5.x headers associate 1799 # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L 1800 # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L 1801 cf_POSIX_C_SOURCE=200112L 1802 cf_XOPEN_SOURCE=600 1803 cf_xopen_source="-D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" 1804 ;; 1805(hpux11*) 1806 cf_xopen_source="-D_HPUX_SOURCE -D_XOPEN_SOURCE=500" 1807 ;; 1808(hpux*) 1809 cf_xopen_source="-D_HPUX_SOURCE" 1810 ;; 1811(irix[[56]].*) 1812 cf_xopen_source="-D_SGI_SOURCE" 1813 cf_XOPEN_SOURCE= 1814 ;; 1815(linux*gnu|linux*gnuabi64|linux*gnuabin32|linux*gnueabi|linux*gnueabihf|linux*gnux32|uclinux*|gnu*|mint*|k*bsd*-gnu|cygwin) 1816 CF_GNU_SOURCE($cf_XOPEN_SOURCE) 1817 ;; 1818(minix*) 1819 cf_xopen_source="-D_NETBSD_SOURCE" # POSIX.1-2001 features are ifdef'd with this... 1820 ;; 1821(mirbsd*) 1822 # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <sys/select.h> and other headers which use u_int / u_short types 1823 cf_XOPEN_SOURCE= 1824 CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE) 1825 ;; 1826(netbsd*) 1827 cf_xopen_source="-D_NETBSD_SOURCE" # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw 1828 ;; 1829(openbsd[[6-9]]*) 1830 # OpenBSD 6.x has broken locale support, both compile-time and runtime. 1831 # see https://www.mail-archive.com/bugs@openbsd.org/msg13200.html 1832 # Abusing the conformance level is a workaround. 1833 AC_MSG_WARN(this system does not provide usable locale support) 1834 cf_xopen_source="-D_BSD_SOURCE" 1835 cf_XOPEN_SOURCE=700 1836 ;; 1837(openbsd[[4-5]]*) 1838 # setting _XOPEN_SOURCE lower than 500 breaks g++ compile with wchar.h, needed for ncursesw 1839 cf_xopen_source="-D_BSD_SOURCE" 1840 cf_XOPEN_SOURCE=600 1841 ;; 1842(openbsd*) 1843 # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw 1844 ;; 1845(osf[[45]]*) 1846 cf_xopen_source="-D_OSF_SOURCE" 1847 ;; 1848(nto-qnx*) 1849 cf_xopen_source="-D_QNX_SOURCE" 1850 ;; 1851(sco*) 1852 # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer 1853 ;; 1854(solaris2.*) 1855 cf_xopen_source="-D__EXTENSIONS__" 1856 cf_cv_xopen_source=broken 1857 ;; 1858(sysv4.2uw2.*) # Novell/SCO UnixWare 2.x (tested on 2.1.2) 1859 cf_XOPEN_SOURCE= 1860 cf_POSIX_C_SOURCE= 1861 ;; 1862(*) 1863 CF_TRY_XOPEN_SOURCE 1864 cf_save_xopen_cppflags="$CPPFLAGS" 1865 CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE) 1866 # Some of these niche implementations use copy/paste, double-check... 1867 if test "$cf_cv_xopen_source" != no ; then 1868 CF_VERBOSE(checking if _POSIX_C_SOURCE inteferes) 1869 AC_TRY_COMPILE(CF__XOPEN_SOURCE_HEAD,CF__XOPEN_SOURCE_BODY,,[ 1870 AC_MSG_WARN(_POSIX_C_SOURCE definition is not usable) 1871 CPPFLAGS="$cf_save_xopen_cppflags"]) 1872 fi 1873 ;; 1874esac 1875 1876if test -n "$cf_xopen_source" ; then 1877 CF_APPEND_CFLAGS($cf_xopen_source,true) 1878fi 1879 1880dnl In anything but the default case, we may have system-specific setting 1881dnl which is still not guaranteed to provide all of the entrypoints that 1882dnl _XOPEN_SOURCE would yield. 1883if test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then 1884 AC_MSG_CHECKING(if _XOPEN_SOURCE really is set) 1885 AC_TRY_COMPILE([#include <stdlib.h>],[ 1886#ifndef _XOPEN_SOURCE 1887make an error 1888#endif], 1889 [cf_XOPEN_SOURCE_set=yes], 1890 [cf_XOPEN_SOURCE_set=no]) 1891 AC_MSG_RESULT($cf_XOPEN_SOURCE_set) 1892 if test "$cf_XOPEN_SOURCE_set" = yes 1893 then 1894 AC_TRY_COMPILE([#include <stdlib.h>],[ 1895#if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE 1896make an error 1897#endif], 1898 [cf_XOPEN_SOURCE_set_ok=yes], 1899 [cf_XOPEN_SOURCE_set_ok=no]) 1900 if test "$cf_XOPEN_SOURCE_set_ok" = no 1901 then 1902 AC_MSG_WARN(_XOPEN_SOURCE is lower than requested) 1903 fi 1904 else 1905 CF_TRY_XOPEN_SOURCE 1906 fi 1907fi 1908fi # cf_cv_posix_visible 1909]) 1910dnl --------------------------------------------------------------------------- 1911dnl CF__XOPEN_SOURCE_BODY version: 1 updated: 2022/09/10 15:17:35 1912dnl --------------------- 1913dnl body of test when test-compiling for _XOPEN_SOURCE check 1914define([CF__XOPEN_SOURCE_BODY], 1915[ 1916#ifndef _XOPEN_SOURCE 1917make an error 1918#endif 1919]) 1920dnl --------------------------------------------------------------------------- 1921dnl CF__XOPEN_SOURCE_HEAD version: 1 updated: 2022/09/10 15:17:03 1922dnl --------------------- 1923dnl headers to include when test-compiling for _XOPEN_SOURCE check 1924define([CF__XOPEN_SOURCE_HEAD], 1925[ 1926#include <stdlib.h> 1927#include <string.h> 1928#include <sys/types.h> 1929]) 1930