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