1dnl $MawkId: aclocal.m4,v 1.84 2019/01/29 02:09:20 tom Exp $ 2dnl custom mawk macros for autoconf 3dnl 4dnl The symbols beginning "CF_MAWK_" were originally written by Mike Brennan, 5dnl renamed for consistency by Thomas E Dickey. 6dnl 7dnl --------------------------------------------------------------------------- 8dnl Copyright: 2008-2017,2019 by Thomas E. Dickey 9dnl 10dnl Permission is hereby granted, free of charge, to any person obtaining a 11dnl copy of this software and associated documentation files (the 12dnl "Software"), to deal in the Software without restriction, including 13dnl without limitation the rights to use, copy, modify, merge, publish, 14dnl distribute, distribute with modifications, sublicense, and/or sell 15dnl copies of the Software, and to permit persons to whom the Software is 16dnl furnished to do so, subject to the following conditions: 17dnl 18dnl The above copyright notice and this permission notice shall be included 19dnl in all copies or portions of the Software. 20dnl 21dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 22dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 24dnl IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 25dnl DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 26dnl OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR 27dnl THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28dnl 29dnl Except as contained in this notice, the name(s) of the above copyright 30dnl holders shall not be used in advertising or otherwise to promote the 31dnl sale, use or other dealings in this Software without prior written 32dnl authorization. 33dnl 34dnl --------------------------------------------------------------------------- 35dnl --------------------------------------------------------------------------- 36dnl CF_ACVERSION_CHECK version: 5 updated: 2014/06/04 19:11:49 37dnl ------------------ 38dnl Conditionally generate script according to whether we're using a given autoconf. 39dnl 40dnl $1 = version to compare against 41dnl $2 = code to use if AC_ACVERSION is at least as high as $1. 42dnl $3 = code to use if AC_ACVERSION is older than $1. 43define([CF_ACVERSION_CHECK], 44[ 45ifdef([AC_ACVERSION], ,[ifdef([AC_AUTOCONF_VERSION],[m4_copy([AC_AUTOCONF_VERSION],[AC_ACVERSION])],[m4_copy([m4_PACKAGE_VERSION],[AC_ACVERSION])])])dnl 46ifdef([m4_version_compare], 47[m4_if(m4_version_compare(m4_defn([AC_ACVERSION]), [$1]), -1, [$3], [$2])], 48[CF_ACVERSION_COMPARE( 49AC_PREREQ_CANON(AC_PREREQ_SPLIT([$1])), 50AC_PREREQ_CANON(AC_PREREQ_SPLIT(AC_ACVERSION)), AC_ACVERSION, [$2], [$3])])])dnl 51dnl --------------------------------------------------------------------------- 52dnl CF_ACVERSION_COMPARE version: 3 updated: 2012/10/03 18:39:53 53dnl -------------------- 54dnl CF_ACVERSION_COMPARE(MAJOR1, MINOR1, TERNARY1, 55dnl MAJOR2, MINOR2, TERNARY2, 56dnl PRINTABLE2, not FOUND, FOUND) 57define([CF_ACVERSION_COMPARE], 58[ifelse(builtin([eval], [$2 < $5]), 1, 59[ifelse([$8], , ,[$8])], 60[ifelse([$9], , ,[$9])])])dnl 61dnl --------------------------------------------------------------------------- 62dnl CF_ADD_CFLAGS version: 13 updated: 2017/02/25 18:57:40 63dnl ------------- 64dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS 65dnl The second parameter if given makes this macro verbose. 66dnl 67dnl Put any preprocessor definitions that use quoted strings in $EXTRA_CPPFLAGS, 68dnl to simplify use of $CPPFLAGS in compiler checks, etc., that are easily 69dnl confused by the quotes (which require backslashes to keep them usable). 70AC_DEFUN([CF_ADD_CFLAGS], 71[ 72cf_fix_cppflags=no 73cf_new_cflags= 74cf_new_cppflags= 75cf_new_extra_cppflags= 76 77for cf_add_cflags in $1 78do 79case $cf_fix_cppflags in 80(no) 81 case $cf_add_cflags in 82 (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) 83 case $cf_add_cflags in 84 (-D*) 85 cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[[^=]]*='\''\"[[^"]]*//'` 86 87 test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ 88 && test -z "${cf_tst_cflags}" \ 89 && cf_fix_cppflags=yes 90 91 if test $cf_fix_cppflags = yes ; then 92 CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags) 93 continue 94 elif test "${cf_tst_cflags}" = "\"'" ; then 95 CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags) 96 continue 97 fi 98 ;; 99 esac 100 case "$CPPFLAGS" in 101 (*$cf_add_cflags) 102 ;; 103 (*) 104 case $cf_add_cflags in 105 (-D*) 106 cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` 107 CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,$cf_tst_cppflags) 108 ;; 109 esac 110 CF_APPEND_TEXT(cf_new_cppflags,$cf_add_cflags) 111 ;; 112 esac 113 ;; 114 (*) 115 CF_APPEND_TEXT(cf_new_cflags,$cf_add_cflags) 116 ;; 117 esac 118 ;; 119(yes) 120 CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags) 121 122 cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[[^"]]*"'\''//'` 123 124 test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ 125 && test -z "${cf_tst_cflags}" \ 126 && cf_fix_cppflags=no 127 ;; 128esac 129done 130 131if test -n "$cf_new_cflags" ; then 132 ifelse([$2],,,[CF_VERBOSE(add to \$CFLAGS $cf_new_cflags)]) 133 CF_APPEND_TEXT(CFLAGS,$cf_new_cflags) 134fi 135 136if test -n "$cf_new_cppflags" ; then 137 ifelse([$2],,,[CF_VERBOSE(add to \$CPPFLAGS $cf_new_cppflags)]) 138 CF_APPEND_TEXT(CPPFLAGS,$cf_new_cppflags) 139fi 140 141if test -n "$cf_new_extra_cppflags" ; then 142 ifelse([$2],,,[CF_VERBOSE(add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags)]) 143 CF_APPEND_TEXT(EXTRA_CPPFLAGS,$cf_new_extra_cppflags) 144fi 145 146AC_SUBST(EXTRA_CPPFLAGS) 147 148])dnl 149dnl --------------------------------------------------------------------------- 150dnl CF_ADD_LIB version: 2 updated: 2010/06/02 05:03:05 151dnl ---------- 152dnl Add a library, used to enforce consistency. 153dnl 154dnl $1 = library to add, without the "-l" 155dnl $2 = variable to update (default $LIBS) 156AC_DEFUN([CF_ADD_LIB],[CF_ADD_LIBS(-l$1,ifelse($2,,LIBS,[$2]))])dnl 157dnl --------------------------------------------------------------------------- 158dnl CF_ADD_LIBS version: 2 updated: 2014/07/13 14:33:27 159dnl ----------- 160dnl Add one or more libraries, used to enforce consistency. Libraries are 161dnl prepended to an existing list, since their dependencies are assumed to 162dnl already exist in the list. 163dnl 164dnl $1 = libraries to add, with the "-l", etc. 165dnl $2 = variable to update (default $LIBS) 166AC_DEFUN([CF_ADD_LIBS],[ 167cf_add_libs="$1" 168# Filter out duplicates - this happens with badly-designed ".pc" files... 169for cf_add_1lib in [$]ifelse($2,,LIBS,[$2]) 170do 171 for cf_add_2lib in $cf_add_libs 172 do 173 if test "x$cf_add_1lib" = "x$cf_add_2lib" 174 then 175 cf_add_1lib= 176 break 177 fi 178 done 179 test -n "$cf_add_1lib" && cf_add_libs="$cf_add_libs $cf_add_1lib" 180done 181ifelse($2,,LIBS,[$2])="$cf_add_libs" 182])dnl 183dnl --------------------------------------------------------------------------- 184dnl CF_APPEND_TEXT version: 1 updated: 2017/02/25 18:58:55 185dnl -------------- 186dnl use this macro for appending text without introducing an extra blank at 187dnl the beginning 188define([CF_APPEND_TEXT], 189[ 190 test -n "[$]$1" && $1="[$]$1 " 191 $1="[$]{$1}$2" 192])dnl 193dnl --------------------------------------------------------------------------- 194dnl CF_ARG_DISABLE version: 3 updated: 1999/03/30 17:24:31 195dnl -------------- 196dnl Allow user to disable a normally-on option. 197AC_DEFUN([CF_ARG_DISABLE], 198[CF_ARG_OPTION($1,[$2],[$3],[$4],yes)])dnl 199dnl --------------------------------------------------------------------------- 200dnl CF_ARG_ENABLE version: 3 updated: 1999/03/30 17:24:31 201dnl ------------- 202dnl Allow user to enable a normally-off option. 203AC_DEFUN([CF_ARG_ENABLE], 204[CF_ARG_OPTION($1,[$2],[$3],[$4],no)])dnl 205dnl --------------------------------------------------------------------------- 206dnl CF_ARG_OPTION version: 5 updated: 2015/05/10 19:52:14 207dnl ------------- 208dnl Restricted form of AC_ARG_ENABLE that ensures user doesn't give bogus 209dnl values. 210dnl 211dnl Parameters: 212dnl $1 = option name 213dnl $2 = help-string 214dnl $3 = action to perform if option is not default 215dnl $4 = action if perform if option is default 216dnl $5 = default option value (either 'yes' or 'no') 217AC_DEFUN([CF_ARG_OPTION], 218[AC_ARG_ENABLE([$1],[$2],[test "$enableval" != ifelse([$5],no,yes,no) && enableval=ifelse([$5],no,no,yes) 219 if test "$enableval" != "$5" ; then 220ifelse([$3],,[ :]dnl 221,[ $3]) ifelse([$4],,,[ 222 else 223 $4]) 224 fi],[enableval=$5 ifelse([$4],,,[ 225 $4 226])dnl 227])])dnl 228dnl --------------------------------------------------------------------------- 229dnl CF_BUILD_CC version: 8 updated: 2018/01/04 20:31:04 230dnl ----------- 231dnl If we're cross-compiling, allow the user to override the tools and their 232dnl options. The configure script is oriented toward identifying the host 233dnl compiler, etc., but we need a build compiler to generate parts of the 234dnl source. 235dnl 236dnl $1 = default for $CPPFLAGS 237dnl $2 = default for $LIBS 238AC_DEFUN([CF_BUILD_CC],[ 239CF_ACVERSION_CHECK(2.52,, 240 [AC_REQUIRE([CF_PROG_EXT])]) 241if test "$cross_compiling" = yes ; then 242 243 # defaults that we might want to override 244 : ${BUILD_CFLAGS:=''} 245 : ${BUILD_CPPFLAGS:='ifelse([$1],,,[$1])'} 246 : ${BUILD_LDFLAGS:=''} 247 : ${BUILD_LIBS:='ifelse([$2],,,[$2])'} 248 : ${BUILD_EXEEXT:='$x'} 249 : ${BUILD_OBJEXT:='o'} 250 251 AC_ARG_WITH(build-cc, 252 [ --with-build-cc=XXX the build C compiler ($BUILD_CC)], 253 [BUILD_CC="$withval"], 254 [AC_CHECK_PROGS(BUILD_CC, [gcc clang c99 c89 cc cl],none)]) 255 AC_MSG_CHECKING(for native build C compiler) 256 AC_MSG_RESULT($BUILD_CC) 257 258 AC_MSG_CHECKING(for native build C preprocessor) 259 AC_ARG_WITH(build-cpp, 260 [ --with-build-cpp=XXX the build C preprocessor ($BUILD_CPP)], 261 [BUILD_CPP="$withval"], 262 [BUILD_CPP='${BUILD_CC} -E']) 263 AC_MSG_RESULT($BUILD_CPP) 264 265 AC_MSG_CHECKING(for native build C flags) 266 AC_ARG_WITH(build-cflags, 267 [ --with-build-cflags=XXX the build C compiler-flags ($BUILD_CFLAGS)], 268 [BUILD_CFLAGS="$withval"]) 269 AC_MSG_RESULT($BUILD_CFLAGS) 270 271 AC_MSG_CHECKING(for native build C preprocessor-flags) 272 AC_ARG_WITH(build-cppflags, 273 [ --with-build-cppflags=XXX the build C preprocessor-flags ($BUILD_CPPFLAGS)], 274 [BUILD_CPPFLAGS="$withval"]) 275 AC_MSG_RESULT($BUILD_CPPFLAGS) 276 277 AC_MSG_CHECKING(for native build linker-flags) 278 AC_ARG_WITH(build-ldflags, 279 [ --with-build-ldflags=XXX the build linker-flags ($BUILD_LDFLAGS)], 280 [BUILD_LDFLAGS="$withval"]) 281 AC_MSG_RESULT($BUILD_LDFLAGS) 282 283 AC_MSG_CHECKING(for native build linker-libraries) 284 AC_ARG_WITH(build-libs, 285 [ --with-build-libs=XXX the build libraries (${BUILD_LIBS})], 286 [BUILD_LIBS="$withval"]) 287 AC_MSG_RESULT($BUILD_LIBS) 288 289 # this assumes we're on Unix. 290 BUILD_EXEEXT= 291 BUILD_OBJEXT=o 292 293 : ${BUILD_CC:='${CC}'} 294 295 if ( test "$BUILD_CC" = "$CC" || test "$BUILD_CC" = '${CC}' ) ; then 296 AC_MSG_ERROR([Cross-build requires two compilers. 297Use --with-build-cc to specify the native compiler.]) 298 fi 299 300else 301 : ${BUILD_CC:='${CC}'} 302 : ${BUILD_CPP:='${CPP}'} 303 : ${BUILD_CFLAGS:='${CFLAGS}'} 304 : ${BUILD_CPPFLAGS:='${CPPFLAGS}'} 305 : ${BUILD_LDFLAGS:='${LDFLAGS}'} 306 : ${BUILD_LIBS:='${LIBS}'} 307 : ${BUILD_EXEEXT:='$x'} 308 : ${BUILD_OBJEXT:='o'} 309fi 310 311AC_SUBST(BUILD_CC) 312AC_SUBST(BUILD_CPP) 313AC_SUBST(BUILD_CFLAGS) 314AC_SUBST(BUILD_CPPFLAGS) 315AC_SUBST(BUILD_LDFLAGS) 316AC_SUBST(BUILD_LIBS) 317AC_SUBST(BUILD_EXEEXT) 318AC_SUBST(BUILD_OBJEXT) 319])dnl 320dnl --------------------------------------------------------------------------- 321dnl CF_CC_ENV_FLAGS version: 9 updated: 2018/07/29 18:03:26 322dnl --------------- 323dnl Check for user's environment-breakage by stuffing CFLAGS/CPPFLAGS content 324dnl into CC. This will not help with broken scripts that wrap the compiler 325dnl with options, but eliminates a more common category of user confusion. 326dnl 327dnl In particular, it addresses the problem of being able to run the C 328dnl preprocessor in a consistent manner. 329dnl 330dnl Caveat: this also disallows blanks in the pathname for the compiler, but 331dnl the nuisance of having inconsistent settings for compiler and preprocessor 332dnl outweighs that limitation. 333AC_DEFUN([CF_CC_ENV_FLAGS], 334[ 335# This should have been defined by AC_PROG_CC 336: ${CC:=cc} 337 338AC_MSG_CHECKING(\$CFLAGS variable) 339case "x$CFLAGS" in 340(*-[[IUD]]*) 341 AC_MSG_RESULT(broken) 342 AC_MSG_WARN(your environment uses the CFLAGS variable to hold CPPFLAGS options) 343 cf_flags="$CFLAGS" 344 CFLAGS= 345 for cf_arg in $cf_flags 346 do 347 CF_ADD_CFLAGS($cf_arg) 348 done 349 ;; 350(*) 351 AC_MSG_RESULT(ok) 352 ;; 353esac 354 355AC_MSG_CHECKING(\$CC variable) 356case "$CC" in 357(*[[\ \ ]]-*) 358 AC_MSG_RESULT(broken) 359 AC_MSG_WARN(your environment uses the CC variable to hold CFLAGS/CPPFLAGS options) 360 # humor him... 361 cf_prog=`echo "$CC" | sed -e 's/ / /g' -e 's/[[ ]]* / /g' -e 's/[[ ]]*[[ ]]-[[^ ]].*//'` 362 cf_flags=`echo "$CC" | ${AWK:-awk} -v prog="$cf_prog" '{ printf("%s", [substr]([$]0,1+length(prog))); }'` 363 CC="$cf_prog" 364 for cf_arg in $cf_flags 365 do 366 case "x$cf_arg" in 367 (x-[[IUDfgOW]]*) 368 CF_ADD_CFLAGS($cf_arg) 369 ;; 370 (*) 371 CC="$CC $cf_arg" 372 ;; 373 esac 374 done 375 CF_VERBOSE(resulting CC: '$CC') 376 CF_VERBOSE(resulting CFLAGS: '$CFLAGS') 377 CF_VERBOSE(resulting CPPFLAGS: '$CPPFLAGS') 378 ;; 379(*) 380 AC_MSG_RESULT(ok) 381 ;; 382esac 383])dnl 384dnl --------------------------------------------------------------------------- 385dnl CF_CHECK_CACHE version: 12 updated: 2012/10/02 20:55:03 386dnl -------------- 387dnl Check if we're accidentally using a cache from a different machine. 388dnl Derive the system name, as a check for reusing the autoconf cache. 389dnl 390dnl If we've packaged config.guess and config.sub, run that (since it does a 391dnl better job than uname). Normally we'll use AC_CANONICAL_HOST, but allow 392dnl an extra parameter that we may override, e.g., for AC_CANONICAL_SYSTEM 393dnl which is useful in cross-compiles. 394dnl 395dnl Note: we would use $ac_config_sub, but that is one of the places where 396dnl autoconf 2.5x broke compatibility with autoconf 2.13 397AC_DEFUN([CF_CHECK_CACHE], 398[ 399if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then 400 ifelse([$1],,[AC_CANONICAL_HOST],[$1]) 401 system_name="$host_os" 402else 403 system_name="`(uname -s -r) 2>/dev/null`" 404 if test -z "$system_name" ; then 405 system_name="`(hostname) 2>/dev/null`" 406 fi 407fi 408test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name",[Define to the system name.]) 409AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"]) 410 411test -z "$system_name" && system_name="$cf_cv_system_name" 412test -n "$cf_cv_system_name" && AC_MSG_RESULT(Configuring for $cf_cv_system_name) 413 414if test ".$system_name" != ".$cf_cv_system_name" ; then 415 AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)) 416 AC_MSG_ERROR("Please remove config.cache and try again.") 417fi 418])dnl 419dnl --------------------------------------------------------------------------- 420dnl CF_CHECK_ENVIRON version: 3 updated: 2010/05/26 16:44:57 421dnl ---------------- 422dnl Check for data that is usually declared in <unistd.h>, e.g., the 'environ' 423dnl variable. Define a DECL_xxx symbol if we must declare it ourselves. 424dnl 425dnl $1 = the name to check 426dnl $2 = the assumed type 427AC_DEFUN([CF_CHECK_ENVIRON], 428[ 429AC_CACHE_CHECK(if external $1 is declared, cf_cv_dcl_$1,[ 430 AC_TRY_COMPILE([ 431#ifdef HAVE_STDLIB_H 432#include <stdlib.h> 433#endif 434#include <unistd.h> ], 435 ifelse([$2],,int,[$2]) x = (ifelse([$2],,int,[$2])) $1, 436 [cf_cv_dcl_$1=yes], 437 [cf_cv_dcl_$1=no]) 438]) 439 440if test "$cf_cv_dcl_$1" = no ; then 441 CF_UPPER(cf_result,decl_$1) 442 AC_DEFINE_UNQUOTED($cf_result) 443fi 444 445# It's possible (for near-UNIX clones) that the data doesn't exist 446CF_CHECK_EXTERN_DATA($1,ifelse([$2],,int,[$2])) 447])dnl 448dnl --------------------------------------------------------------------------- 449dnl CF_CHECK_EXTERN_DATA version: 4 updated: 2015/04/18 08:56:57 450dnl -------------------- 451dnl Check for existence of external data in the current set of libraries. If 452dnl we can modify it, it's real enough. 453dnl $1 = the name to check 454dnl $2 = its type 455AC_DEFUN([CF_CHECK_EXTERN_DATA], 456[ 457AC_CACHE_CHECK(if external $1 exists, cf_cv_have_$1,[ 458 AC_TRY_LINK([ 459#undef $1 460extern $2 $1; 461], 462 [$1 = 2], 463 [cf_cv_have_$1=yes], 464 [cf_cv_have_$1=no]) 465]) 466 467if test "$cf_cv_have_$1" = yes ; then 468 CF_UPPER(cf_result,have_$1) 469 AC_DEFINE_UNQUOTED($cf_result) 470fi 471 472])dnl 473dnl --------------------------------------------------------------------------- 474dnl CF_CLANG_COMPILER version: 2 updated: 2013/11/19 19:23:35 475dnl ----------------- 476dnl Check if the given compiler is really clang. clang's C driver defines 477dnl __GNUC__ (fooling the configure script into setting $GCC to yes) but does 478dnl not ignore some gcc options. 479dnl 480dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to 481dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from 482dnl the wrappers for gcc and g++ warnings. 483dnl 484dnl $1 = GCC (default) or GXX 485dnl $2 = CLANG_COMPILER (default) 486dnl $3 = CFLAGS (default) or CXXFLAGS 487AC_DEFUN([CF_CLANG_COMPILER],[ 488ifelse([$2],,CLANG_COMPILER,[$2])=no 489 490if test "$ifelse([$1],,[$1],GCC)" = yes ; then 491 AC_MSG_CHECKING(if this is really Clang ifelse([$1],GXX,C++,C) compiler) 492 cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])" 493 ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -Qunused-arguments" 494 AC_TRY_COMPILE([],[ 495#ifdef __clang__ 496#else 497make an error 498#endif 499],[ifelse([$2],,CLANG_COMPILER,[$2])=yes 500cf_save_CFLAGS="$cf_save_CFLAGS -Qunused-arguments" 501],[]) 502 ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS" 503 AC_MSG_RESULT($ifelse([$2],,CLANG_COMPILER,[$2])) 504fi 505]) 506dnl --------------------------------------------------------------------------- 507dnl CF_DISABLE_ECHO version: 13 updated: 2015/04/18 08:56:57 508dnl --------------- 509dnl You can always use "make -n" to see the actual options, but it's hard to 510dnl pick out/analyze warning messages when the compile-line is long. 511dnl 512dnl Sets: 513dnl ECHO_LT - symbol to control if libtool is verbose 514dnl ECHO_LD - symbol to prefix "cc -o" lines 515dnl RULE_CC - symbol to put before implicit "cc -c" lines (e.g., .c.o) 516dnl SHOW_CC - symbol to put before explicit "cc -c" lines 517dnl ECHO_CC - symbol to put before any "cc" line 518dnl 519AC_DEFUN([CF_DISABLE_ECHO],[ 520AC_MSG_CHECKING(if you want to see long compiling messages) 521CF_ARG_DISABLE(echo, 522 [ --disable-echo do not display "compiling" commands], 523 [ 524 ECHO_LT='--silent' 525 ECHO_LD='@echo linking [$]@;' 526 RULE_CC='@echo compiling [$]<' 527 SHOW_CC='@echo compiling [$]@' 528 ECHO_CC='@' 529],[ 530 ECHO_LT='' 531 ECHO_LD='' 532 RULE_CC='' 533 SHOW_CC='' 534 ECHO_CC='' 535]) 536AC_MSG_RESULT($enableval) 537AC_SUBST(ECHO_LT) 538AC_SUBST(ECHO_LD) 539AC_SUBST(RULE_CC) 540AC_SUBST(SHOW_CC) 541AC_SUBST(ECHO_CC) 542])dnl 543dnl --------------------------------------------------------------------------- 544dnl CF_DISABLE_LEAKS version: 7 updated: 2012/10/02 20:55:03 545dnl ---------------- 546dnl Combine no-leak checks with the libraries or tools that are used for the 547dnl checks. 548AC_DEFUN([CF_DISABLE_LEAKS],[ 549 550AC_REQUIRE([CF_WITH_DMALLOC]) 551AC_REQUIRE([CF_WITH_DBMALLOC]) 552AC_REQUIRE([CF_WITH_VALGRIND]) 553 554AC_MSG_CHECKING(if you want to perform memory-leak testing) 555AC_ARG_ENABLE(leaks, 556 [ --disable-leaks test: free permanent memory, analyze leaks], 557 [if test "x$enableval" = xno; then with_no_leaks=yes; else with_no_leaks=no; fi], 558 : ${with_no_leaks:=no}) 559AC_MSG_RESULT($with_no_leaks) 560 561if test "$with_no_leaks" = yes ; then 562 AC_DEFINE(NO_LEAKS,1,[Define to 1 if you want to perform memory-leak testing.]) 563 AC_DEFINE(YY_NO_LEAKS,1,[Define to 1 if you want to perform memory-leak testing.]) 564fi 565])dnl 566dnl --------------------------------------------------------------------------- 567dnl CF_ENABLE_TRACE version: 3 updated: 2012/10/04 05:24:07 568dnl --------------- 569AC_DEFUN([CF_ENABLE_TRACE],[ 570AC_MSG_CHECKING(if you want to enable debugging trace) 571CF_ARG_ENABLE(trace, 572 [ --enable-trace test: turn on debug-tracing], 573 [with_trace=yes], 574 [with_trace=no]) 575AC_MSG_RESULT($with_trace) 576if test "$with_trace" = "yes" 577then 578 AC_DEFINE(OPT_TRACE,1,[Define to 1 if you want to enable debugging trace]) 579fi 580])dnl 581dnl --------------------------------------------------------------------------- 582dnl CF_ENABLE_WARNINGS version: 5 updated: 2017/09/29 20:01:16 583dnl ------------------ 584dnl Configure-option to enable gcc warnings 585AC_DEFUN([CF_ENABLE_WARNINGS],[ 586if ( test "$GCC" = yes || test "$GXX" = yes ) 587then 588AC_MSG_CHECKING(if you want to turn on gcc warnings) 589CF_ARG_ENABLE(warnings, 590 [ --enable-warnings test: turn on gcc compiler warnings], 591 [with_warnings=yes], 592 [with_warnings=no]) 593AC_MSG_RESULT($with_warnings) 594if test "$with_warnings" = "yes" 595then 596 CF_GCC_ATTRIBUTES 597 CF_GCC_WARNINGS($1) 598fi 599fi 600])dnl 601dnl --------------------------------------------------------------------------- 602dnl CF_GCC_ATTRIBUTES version: 17 updated: 2015/04/12 15:39:00 603dnl ----------------- 604dnl Test for availability of useful gcc __attribute__ directives to quiet 605dnl compiler warnings. Though useful, not all are supported -- and contrary 606dnl to documentation, unrecognized directives cause older compilers to barf. 607AC_DEFUN([CF_GCC_ATTRIBUTES], 608[ 609if test "$GCC" = yes 610then 611cat > conftest.i <<EOF 612#ifndef GCC_PRINTF 613#define GCC_PRINTF 0 614#endif 615#ifndef GCC_SCANF 616#define GCC_SCANF 0 617#endif 618#ifndef GCC_NORETURN 619#define GCC_NORETURN /* nothing */ 620#endif 621#ifndef GCC_UNUSED 622#define GCC_UNUSED /* nothing */ 623#endif 624EOF 625if test "$GCC" = yes 626then 627 AC_CHECKING([for $CC __attribute__ directives]) 628cat > conftest.$ac_ext <<EOF 629#line __oline__ "${as_me:-configure}" 630#include "confdefs.h" 631#include "conftest.h" 632#include "conftest.i" 633#if GCC_PRINTF 634#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var))) 635#else 636#define GCC_PRINTFLIKE(fmt,var) /*nothing*/ 637#endif 638#if GCC_SCANF 639#define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var))) 640#else 641#define GCC_SCANFLIKE(fmt,var) /*nothing*/ 642#endif 643extern void wow(char *,...) GCC_SCANFLIKE(1,2); 644extern void oops(char *,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN; 645extern void foo(void) GCC_NORETURN; 646int main(int argc GCC_UNUSED, char *argv[[]] GCC_UNUSED) { return 0; } 647EOF 648 cf_printf_attribute=no 649 cf_scanf_attribute=no 650 for cf_attribute in scanf printf unused noreturn 651 do 652 CF_UPPER(cf_ATTRIBUTE,$cf_attribute) 653 cf_directive="__attribute__(($cf_attribute))" 654 echo "checking for $CC $cf_directive" 1>&AC_FD_CC 655 656 case $cf_attribute in 657 (printf) 658 cf_printf_attribute=yes 659 cat >conftest.h <<EOF 660#define GCC_$cf_ATTRIBUTE 1 661EOF 662 ;; 663 (scanf) 664 cf_scanf_attribute=yes 665 cat >conftest.h <<EOF 666#define GCC_$cf_ATTRIBUTE 1 667EOF 668 ;; 669 (*) 670 cat >conftest.h <<EOF 671#define GCC_$cf_ATTRIBUTE $cf_directive 672EOF 673 ;; 674 esac 675 676 if AC_TRY_EVAL(ac_compile); then 677 test -n "$verbose" && AC_MSG_RESULT(... $cf_attribute) 678 cat conftest.h >>confdefs.h 679 case $cf_attribute in 680 (noreturn) 681 AC_DEFINE_UNQUOTED(GCC_NORETURN,$cf_directive,[Define to noreturn-attribute for gcc]) 682 ;; 683 (printf) 684 cf_value='/* nothing */' 685 if test "$cf_printf_attribute" != no ; then 686 cf_value='__attribute__((format(printf,fmt,var)))' 687 AC_DEFINE(GCC_PRINTF,1,[Define to 1 if the compiler supports gcc-like printf attribute.]) 688 fi 689 AC_DEFINE_UNQUOTED(GCC_PRINTFLIKE(fmt,var),$cf_value,[Define to printf-attribute for gcc]) 690 ;; 691 (scanf) 692 cf_value='/* nothing */' 693 if test "$cf_scanf_attribute" != no ; then 694 cf_value='__attribute__((format(scanf,fmt,var)))' 695 AC_DEFINE(GCC_SCANF,1,[Define to 1 if the compiler supports gcc-like scanf attribute.]) 696 fi 697 AC_DEFINE_UNQUOTED(GCC_SCANFLIKE(fmt,var),$cf_value,[Define to sscanf-attribute for gcc]) 698 ;; 699 (unused) 700 AC_DEFINE_UNQUOTED(GCC_UNUSED,$cf_directive,[Define to unused-attribute for gcc]) 701 ;; 702 esac 703 fi 704 done 705else 706 fgrep define conftest.i >>confdefs.h 707fi 708rm -rf conftest* 709fi 710])dnl 711dnl --------------------------------------------------------------------------- 712dnl CF_GCC_VERSION version: 7 updated: 2012/10/18 06:46:33 713dnl -------------- 714dnl Find version of gcc 715AC_DEFUN([CF_GCC_VERSION],[ 716AC_REQUIRE([AC_PROG_CC]) 717GCC_VERSION=none 718if test "$GCC" = yes ; then 719 AC_MSG_CHECKING(version of $CC) 720 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.]].*//'`" 721 test -z "$GCC_VERSION" && GCC_VERSION=unknown 722 AC_MSG_RESULT($GCC_VERSION) 723fi 724])dnl 725dnl --------------------------------------------------------------------------- 726dnl CF_GCC_WARNINGS version: 33 updated: 2018/06/20 20:23:13 727dnl --------------- 728dnl Check if the compiler supports useful warning options. There's a few that 729dnl we don't use, simply because they're too noisy: 730dnl 731dnl -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x) 732dnl -Wredundant-decls (system headers make this too noisy) 733dnl -Wtraditional (combines too many unrelated messages, only a few useful) 734dnl -Wwrite-strings (too noisy, but should review occasionally). This 735dnl is enabled for ncurses using "--enable-const". 736dnl -pedantic 737dnl 738dnl Parameter: 739dnl $1 is an optional list of gcc warning flags that a particular 740dnl application might want to use, e.g., "no-unused" for 741dnl -Wno-unused 742dnl Special: 743dnl If $with_ext_const is "yes", add a check for -Wwrite-strings 744dnl 745AC_DEFUN([CF_GCC_WARNINGS], 746[ 747AC_REQUIRE([CF_GCC_VERSION]) 748CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS) 749CF_CLANG_COMPILER(GCC,CLANG_COMPILER,CFLAGS) 750 751cat > conftest.$ac_ext <<EOF 752#line __oline__ "${as_me:-configure}" 753int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; } 754EOF 755 756if test "$INTEL_COMPILER" = yes 757then 758# The "-wdXXX" options suppress warnings: 759# remark #1419: external declaration in primary source file 760# remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem) 761# remark #1684: conversion from pointer to same-sized integral type (potential portability problem) 762# remark #193: zero used for undefined preprocessing identifier 763# remark #593: variable "curs_sb_left_arrow" was set but never used 764# remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits 765# remark #869: parameter "tw" was never referenced 766# remark #981: operands are evaluated in unspecified order 767# warning #279: controlling expression is constant 768 769 AC_CHECKING([for $CC warning options]) 770 cf_save_CFLAGS="$CFLAGS" 771 EXTRA_CFLAGS="-Wall" 772 for cf_opt in \ 773 wd1419 \ 774 wd1683 \ 775 wd1684 \ 776 wd193 \ 777 wd593 \ 778 wd279 \ 779 wd810 \ 780 wd869 \ 781 wd981 782 do 783 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" 784 if AC_TRY_EVAL(ac_compile); then 785 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt) 786 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" 787 fi 788 done 789 CFLAGS="$cf_save_CFLAGS" 790 791elif test "$GCC" = yes 792then 793 AC_CHECKING([for $CC warning options]) 794 cf_save_CFLAGS="$CFLAGS" 795 EXTRA_CFLAGS= 796 cf_warn_CONST="" 797 test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings" 798 cf_gcc_warnings="Wignored-qualifiers Wlogical-op Wvarargs" 799 test "x$CLANG_COMPILER" = xyes && cf_gcc_warnings= 800 for cf_opt in W Wall \ 801 Wbad-function-cast \ 802 Wcast-align \ 803 Wcast-qual \ 804 Wdeclaration-after-statement \ 805 Wextra \ 806 Winline \ 807 Wmissing-declarations \ 808 Wmissing-prototypes \ 809 Wnested-externs \ 810 Wpointer-arith \ 811 Wshadow \ 812 Wstrict-prototypes \ 813 Wundef $cf_gcc_warnings $cf_warn_CONST $1 814 do 815 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" 816 if AC_TRY_EVAL(ac_compile); then 817 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt) 818 case $cf_opt in 819 (Wcast-qual) 820 CF_APPEND_TEXT(CPPFLAGS,-DXTSTRINGDEFINES) 821 ;; 822 (Winline) 823 case $GCC_VERSION in 824 ([[34]].*) 825 CF_VERBOSE(feature is broken in gcc $GCC_VERSION) 826 continue;; 827 esac 828 ;; 829 (Wpointer-arith) 830 case $GCC_VERSION in 831 ([[12]].*) 832 CF_VERBOSE(feature is broken in gcc $GCC_VERSION) 833 continue;; 834 esac 835 ;; 836 esac 837 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" 838 fi 839 done 840 CFLAGS="$cf_save_CFLAGS" 841fi 842rm -rf conftest* 843 844AC_SUBST(EXTRA_CFLAGS) 845])dnl 846dnl --------------------------------------------------------------------------- 847dnl CF_GNU_SOURCE version: 10 updated: 2018/12/10 20:09:41 848dnl ------------- 849dnl Check if we must define _GNU_SOURCE to get a reasonable value for 850dnl _XOPEN_SOURCE, upon which many POSIX definitions depend. This is a defect 851dnl (or misfeature) of glibc2, which breaks portability of many applications, 852dnl since it is interwoven with GNU extensions. 853dnl 854dnl Well, yes we could work around it... 855dnl 856dnl Parameters: 857dnl $1 is the nominal value for _XOPEN_SOURCE 858AC_DEFUN([CF_GNU_SOURCE], 859[ 860cf_gnu_xopen_source=ifelse($1,,500,$1) 861 862AC_CACHE_CHECK(if this is the GNU C library,cf_cv_gnu_library,[ 863AC_TRY_COMPILE([#include <sys/types.h>],[ 864 #if __GLIBC__ > 0 && __GLIBC_MINOR__ >= 0 865 return 0; 866 #elif __NEWLIB__ > 0 && __NEWLIB_MINOR__ >= 0 867 return 0; 868 #else 869 # error not GNU C library 870 #endif], 871 [cf_cv_gnu_library=yes], 872 [cf_cv_gnu_library=no]) 873]) 874 875if test x$cf_cv_gnu_library = xyes; then 876 877 # With glibc 2.19 (13 years after this check was begun), _DEFAULT_SOURCE 878 # was changed to help a little. newlib incorporated the change about 4 879 # years later. 880 AC_CACHE_CHECK(if _DEFAULT_SOURCE can be used as a basis,cf_cv_gnu_library_219,[ 881 cf_save="$CPPFLAGS" 882 CF_APPEND_TEXT(CPPFLAGS,-D_DEFAULT_SOURCE) 883 AC_TRY_COMPILE([#include <sys/types.h>],[ 884 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 19) || (__GLIBC__ > 2) 885 return 0; 886 #elif (__NEWLIB__ == 2 && __NEWLIB_MINOR__ >= 4) || (__GLIBC__ > 3) 887 return 0; 888 #else 889 # error GNU C library __GLIBC__.__GLIBC_MINOR__ is too old 890 #endif], 891 [cf_cv_gnu_library_219=yes], 892 [cf_cv_gnu_library_219=no]) 893 CPPFLAGS="$cf_save" 894 ]) 895 896 if test "x$cf_cv_gnu_library_219" = xyes; then 897 cf_save="$CPPFLAGS" 898 AC_CACHE_CHECK(if _XOPEN_SOURCE=$cf_gnu_xopen_source works with _DEFAULT_SOURCE,cf_cv_gnu_dftsrc_219,[ 899 CF_ADD_CFLAGS(-D_DEFAULT_SOURCE -D_XOPEN_SOURCE=$cf_gnu_xopen_source) 900 AC_TRY_COMPILE([ 901 #include <limits.h> 902 #include <sys/types.h> 903 ],[ 904 #if (_XOPEN_SOURCE >= $cf_gnu_xopen_source) && (MB_LEN_MAX > 1) 905 return 0; 906 #else 907 # error GNU C library is too old 908 #endif], 909 [cf_cv_gnu_dftsrc_219=yes], 910 [cf_cv_gnu_dftsrc_219=no]) 911 ]) 912 test "x$cf_cv_gnu_dftsrc_219" = "xyes" || CPPFLAGS="$cf_save" 913 else 914 cf_cv_gnu_dftsrc_219=maybe 915 fi 916 917 if test "x$cf_cv_gnu_dftsrc_219" != xyes; then 918 919 AC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[ 920 AC_TRY_COMPILE([#include <sys/types.h>],[ 921 #ifndef _XOPEN_SOURCE 922 #error expected _XOPEN_SOURCE to be defined 923 #endif], 924 [cf_cv_gnu_source=no], 925 [cf_save="$CPPFLAGS" 926 CF_ADD_CFLAGS(-D_GNU_SOURCE) 927 AC_TRY_COMPILE([#include <sys/types.h>],[ 928 #ifdef _XOPEN_SOURCE 929 #error expected _XOPEN_SOURCE to be undefined 930 #endif], 931 [cf_cv_gnu_source=no], 932 [cf_cv_gnu_source=yes]) 933 CPPFLAGS="$cf_save" 934 ]) 935 ]) 936 937 if test "$cf_cv_gnu_source" = yes 938 then 939 AC_CACHE_CHECK(if we should also define _DEFAULT_SOURCE,cf_cv_default_source,[ 940 CF_APPEND_TEXT(CPPFLAGS,-D_GNU_SOURCE) 941 AC_TRY_COMPILE([#include <sys/types.h>],[ 942 #ifdef _DEFAULT_SOURCE 943 #error expected _DEFAULT_SOURCE to be undefined 944 #endif], 945 [cf_cv_default_source=no], 946 [cf_cv_default_source=yes]) 947 ]) 948 if test "$cf_cv_default_source" = yes 949 then 950 CF_APPEND_TEXT(CPPFLAGS,-D_DEFAULT_SOURCE) 951 fi 952 fi 953 fi 954 955fi 956])dnl 957dnl --------------------------------------------------------------------------- 958dnl CF_HELP_MESSAGE version: 3 updated: 1998/01/14 10:56:23 959dnl --------------- 960dnl Insert text into the help-message, for readability, from AC_ARG_WITH. 961AC_DEFUN([CF_HELP_MESSAGE], 962[AC_DIVERT_HELP([$1])dnl 963])dnl 964dnl --------------------------------------------------------------------------- 965dnl CF_INTEL_COMPILER version: 7 updated: 2015/04/12 15:39:00 966dnl ----------------- 967dnl Check if the given compiler is really the Intel compiler for Linux. It 968dnl tries to imitate gcc, but does not return an error when it finds a mismatch 969dnl between prototypes, e.g., as exercised by CF_MISSING_CHECK. 970dnl 971dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to 972dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from 973dnl the wrappers for gcc and g++ warnings. 974dnl 975dnl $1 = GCC (default) or GXX 976dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS 977dnl $3 = CFLAGS (default) or CXXFLAGS 978AC_DEFUN([CF_INTEL_COMPILER],[ 979AC_REQUIRE([AC_CANONICAL_HOST]) 980ifelse([$2],,INTEL_COMPILER,[$2])=no 981 982if test "$ifelse([$1],,[$1],GCC)" = yes ; then 983 case $host_os in 984 (linux*|gnu*) 985 AC_MSG_CHECKING(if this is really Intel ifelse([$1],GXX,C++,C) compiler) 986 cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])" 987 ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -no-gcc" 988 AC_TRY_COMPILE([],[ 989#ifdef __INTEL_COMPILER 990#else 991make an error 992#endif 993],[ifelse([$2],,INTEL_COMPILER,[$2])=yes 994cf_save_CFLAGS="$cf_save_CFLAGS -we147" 995],[]) 996 ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS" 997 AC_MSG_RESULT($ifelse([$2],,INTEL_COMPILER,[$2])) 998 ;; 999 esac 1000fi 1001])dnl 1002dnl --------------------------------------------------------------------------- 1003dnl CF_LARGEFILE version: 11 updated: 2018/06/20 20:23:13 1004dnl ------------ 1005dnl Add checks for large file support. 1006AC_DEFUN([CF_LARGEFILE],[ 1007ifdef([AC_FUNC_FSEEKO],[ 1008 AC_SYS_LARGEFILE 1009 if test "$enable_largefile" != no ; then 1010 AC_FUNC_FSEEKO 1011 1012 # Normally we would collect these definitions in the config.h, 1013 # but (like _XOPEN_SOURCE), some environments rely on having these 1014 # defined before any of the system headers are included. Another 1015 # case comes up with C++, e.g., on AIX the compiler compiles the 1016 # header files by themselves before looking at the body files it is 1017 # told to compile. For ncurses, those header files do not include 1018 # the config.h 1019 if test "$ac_cv_sys_large_files" != no 1020 then 1021 CF_APPEND_TEXT(CPPFLAGS,-D_LARGE_FILES) 1022 fi 1023 if test "$ac_cv_sys_largefile_source" != no 1024 then 1025 CF_APPEND_TEXT(CPPFLAGS,-D_LARGEFILE_SOURCE) 1026 fi 1027 if test "$ac_cv_sys_file_offset_bits" != no 1028 then 1029 CF_APPEND_TEXT(CPPFLAGS,-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits) 1030 fi 1031 1032 AC_CACHE_CHECK(whether to use struct dirent64, cf_cv_struct_dirent64,[ 1033 AC_TRY_COMPILE([ 1034#pragma GCC diagnostic error "-Wincompatible-pointer-types" 1035#include <sys/types.h> 1036#include <dirent.h> 1037 ],[ 1038 /* if transitional largefile support is setup, this is true */ 1039 extern struct dirent64 * readdir(DIR *); 1040 struct dirent64 *x = readdir((DIR *)0); 1041 struct dirent *y = readdir((DIR *)0); 1042 int z = x - y; 1043 ], 1044 [cf_cv_struct_dirent64=yes], 1045 [cf_cv_struct_dirent64=no]) 1046 ]) 1047 test "$cf_cv_struct_dirent64" = yes && AC_DEFINE(HAVE_STRUCT_DIRENT64,1,[Define to 1 if we have struct dirent64]) 1048 fi 1049]) 1050]) 1051dnl --------------------------------------------------------------------------- 1052dnl CF_LOCALE version: 5 updated: 2012/10/06 11:17:15 1053dnl --------- 1054dnl Check if we have setlocale() and its header, <locale.h> 1055dnl The optional parameter $1 tells what to do if we do have locale support. 1056AC_DEFUN([CF_LOCALE], 1057[ 1058AC_MSG_CHECKING(for setlocale()) 1059AC_CACHE_VAL(cf_cv_locale,[ 1060AC_TRY_LINK([#include <locale.h>], 1061 [setlocale(LC_ALL, "")], 1062 [cf_cv_locale=yes], 1063 [cf_cv_locale=no]) 1064 ]) 1065AC_MSG_RESULT($cf_cv_locale) 1066test $cf_cv_locale = yes && { ifelse($1,,AC_DEFINE(LOCALE,1,[Define to 1 if we have locale support]),[$1]) } 1067])dnl 1068dnl --------------------------------------------------------------------------- 1069dnl CF_MAKEFLAGS version: 18 updated: 2018/02/21 21:26:03 1070dnl ------------ 1071dnl Some 'make' programs support ${MAKEFLAGS}, some ${MFLAGS}, to pass 'make' 1072dnl options to lower-levels. It's very useful for "make -n" -- if we have it. 1073dnl (GNU 'make' does both, something POSIX 'make', which happens to make the 1074dnl ${MAKEFLAGS} variable incompatible because it adds the assignments :-) 1075AC_DEFUN([CF_MAKEFLAGS], 1076[ 1077AC_CACHE_CHECK(for makeflags variable, cf_cv_makeflags,[ 1078 cf_cv_makeflags='' 1079 for cf_option in '-${MAKEFLAGS}' '${MFLAGS}' 1080 do 1081 cat >cf_makeflags.tmp <<CF_EOF 1082SHELL = $SHELL 1083all : 1084 @ echo '.$cf_option' 1085CF_EOF 1086 cf_result=`${MAKE:-make} -k -f cf_makeflags.tmp 2>/dev/null | fgrep -v "ing directory" | sed -e 's,[[ ]]*$,,'` 1087 case "$cf_result" in 1088 (.*k|.*kw) 1089 cf_result=`${MAKE:-make} -k -f cf_makeflags.tmp CC=cc 2>/dev/null` 1090 case "$cf_result" in 1091 (.*CC=*) cf_cv_makeflags= 1092 ;; 1093 (*) cf_cv_makeflags=$cf_option 1094 ;; 1095 esac 1096 break 1097 ;; 1098 (.-) 1099 ;; 1100 (*) 1101 CF_MSG_LOG(given option \"$cf_option\", no match \"$cf_result\") 1102 ;; 1103 esac 1104 done 1105 rm -f cf_makeflags.tmp 1106]) 1107 1108AC_SUBST(cf_cv_makeflags) 1109])dnl 1110dnl --------------------------------------------------------------------------- 1111dnl CF_MAKE_TAGS version: 6 updated: 2010/10/23 15:52:32 1112dnl ------------ 1113dnl Generate tags/TAGS targets for makefiles. Do not generate TAGS if we have 1114dnl a monocase filesystem. 1115AC_DEFUN([CF_MAKE_TAGS],[ 1116AC_REQUIRE([CF_MIXEDCASE_FILENAMES]) 1117 1118AC_CHECK_PROGS(CTAGS, exctags ctags) 1119AC_CHECK_PROGS(ETAGS, exetags etags) 1120 1121AC_CHECK_PROG(MAKE_LOWER_TAGS, ${CTAGS:-ctags}, yes, no) 1122 1123if test "$cf_cv_mixedcase" = yes ; then 1124 AC_CHECK_PROG(MAKE_UPPER_TAGS, ${ETAGS:-etags}, yes, no) 1125else 1126 MAKE_UPPER_TAGS=no 1127fi 1128 1129if test "$MAKE_UPPER_TAGS" = yes ; then 1130 MAKE_UPPER_TAGS= 1131else 1132 MAKE_UPPER_TAGS="#" 1133fi 1134 1135if test "$MAKE_LOWER_TAGS" = yes ; then 1136 MAKE_LOWER_TAGS= 1137else 1138 MAKE_LOWER_TAGS="#" 1139fi 1140 1141AC_SUBST(CTAGS) 1142AC_SUBST(ETAGS) 1143 1144AC_SUBST(MAKE_UPPER_TAGS) 1145AC_SUBST(MAKE_LOWER_TAGS) 1146])dnl 1147dnl --------------------------------------------------------------------------- 1148dnl CF_MAWK_CHECK_LIMITS_MSG version: 1 updated: 2008/09/09 19:18:22 1149dnl ------------------------ 1150dnl Write error-message if CF_MAWK_FIND_MAX_INT fails. 1151AC_DEFUN([CF_MAWK_CHECK_LIMITS_MSG], 1152[AC_MSG_ERROR(C program to compute maxint and maxlong failed. 1153Please send bug report to CF_MAWK_MAINTAINER.)])dnl 1154dnl --------------------------------------------------------------------------- 1155dnl CF_MAWK_CHECK_SIZE_T version: 3 updated: 2012/10/25 20:41:47 1156dnl -------------------- 1157dnl Check if size_t is found in the given header file, unless we have already 1158dnl found it. 1159dnl $1 = header to check 1160dnl $2 = symbol to define if size_t is found there. 1161dnl Find size_t. 1162AC_DEFUN([CF_MAWK_CHECK_SIZE_T],[ 1163if test "x$cf_mawk_check_size_t" != xyes ; then 1164 1165AC_CACHE_VAL(cf_cv_size_t_$2,[ 1166 AC_CHECK_HEADER($1,cf_mawk_check_size=ok) 1167 if test "x$cf_mawk_check_size" = xok ; then 1168 AC_CACHE_CHECK(if size_t is declared in $1,cf_cv_size_t_$2,[ 1169 AC_TRY_COMPILE([#include <$1>],[size_t *n], 1170 [cf_cv_size_t_$2=yes], 1171 [cf_cv_size_t_$2=no])]) 1172 fi 1173]) 1174 if test "x$cf_cv_size_t_$2" = xyes ; then 1175 AC_DEFINE_UNQUOTED($2,1,[Define to 1 if we have $1 header]) 1176 cf_mawk_check_size_t=yes 1177 fi 1178fi 1179])dnl 1180dnl --------------------------------------------------------------------------- 1181dnl CF_MAWK_FIND_MAX_INT version: 6 updated: 2017/10/16 20:54:11 1182dnl -------------------- 1183dnl Try to find a definition of MAX__INT from limits.h else compute. 1184AC_DEFUN([CF_MAWK_FIND_MAX_INT], 1185[AC_CHECK_HEADER(limits.h,cf_limits_h=yes) 1186if test "$cf_limits_h" = yes ; then : 1187else 1188AC_CHECK_HEADER(values.h,cf_values_h=yes) 1189 if test "$cf_values_h" = yes ; then 1190 AC_TRY_RUN( 1191[#include <values.h> 1192#include <stdio.h> 1193int main(void) 1194{ FILE *out = fopen("conftest.out", "w") ; 1195 unsigned max_uint = 0; 1196 if ( ! out ) exit(1) ; 1197 fprintf(out, "MAX__INT 0x%x\n", MAXINT) ; 1198 fprintf(out, "MAX__LONG 0x%lx\n", MAXLONG) ; 1199#ifdef MAXUINT 1200 max_uint = MAXUINT; /* not likely (SunOS/Solaris lacks it) */ 1201#else 1202 max_uint = MAXINT; 1203 max_uint <<= 1; 1204 max_uint |= 1; 1205#endif 1206 fprintf(out, "MAX__UINT 0x%lx\n", max_uint) ; 1207 exit(0) ; return(0) ; 1208} 1209], cf_maxint_set=yes,[CF_MAWK_CHECK_LIMITS_MSG]) 1210 fi 1211if test "x$cf_maxint_set" != xyes ; then 1212# compute it -- assumes two's complement 1213AC_TRY_RUN(CF_MAWK_MAX__INT_PROGRAM,:,[CF_MAWK_CHECK_LIMITS_MSG]) 1214fi 1215cat conftest.out | while true 1216do 1217 read name value 1218 test -z "$name" && break 1219 AC_DEFINE_UNQUOTED($name,$value) 1220done 1221rm -f conftest.out 1222fi 1223])dnl 1224dnl --------------------------------------------------------------------------- 1225dnl CF_MAWK_FIND_SIZE_T version: 1 updated: 2008/09/09 19:18:22 1226dnl ------------------- 1227AC_DEFUN([CF_MAWK_FIND_SIZE_T], 1228[CF_MAWK_CHECK_SIZE_T(stddef.h,SIZE_T_STDDEF_H) 1229CF_MAWK_CHECK_SIZE_T(sys/types.h,SIZE_T_TYPES_H)])dnl 1230dnl --------------------------------------------------------------------------- 1231dnl CF_MAWK_FPE_SIGINFO version: 8 updated: 2012/10/25 20:41:47 1232dnl ------------------- 1233dnl SYSv and Solaris FPE checks 1234AC_DEFUN([CF_MAWK_FPE_SIGINFO], 1235[ 1236if test "x$cf_cv_use_sv_siginfo" = "xno" 1237then 1238 AC_CHECK_FUNC(sigvec,cf_have_sigvec=1) 1239 echo "FPE_CHECK 2:get_fpe_codes" >&AC_FD_CC 1240 if test "$cf_have_sigvec" = 1 && ./fpe_check$ac_exeext phoney_arg >> defines.out ; then 1241 : 1242 else 1243 dnl FIXME - look for sigprocmask if we have sigaction 1244 AC_DEFINE(NOINFO_SIGFPE,1,[Define to 1 if we cannot use SYSv siginfo]) 1245 fi 1246fi]) 1247dnl --------------------------------------------------------------------------- 1248dnl CF_MAWK_MAINTAINER version: 2 updated: 2009/07/12 09:10:33 1249dnl ------------------ 1250AC_DEFUN([CF_MAWK_MAINTAINER], [dickey@invisible-island.net]) 1251dnl --------------------------------------------------------------------------- 1252dnl CF_MAWK_MATHLIB version: 3 updated: 2009/12/19 13:18:53 1253dnl --------------- 1254dnl Look for math library. 1255AC_DEFUN([CF_MAWK_MATHLIB],[ 1256if test "${MATHLIB+set}" != set ; then 1257AC_CHECK_LIB(m,log,[MATHLIB=-lm ; LIBS="-lm $LIBS"], 1258[# maybe don't need separate math library 1259AC_CHECK_FUNC(log, log=yes) 1260if test "$log" = yes 1261then 1262 MATHLIB='' # evidently don't need one 1263else 1264 AC_MSG_ERROR( 1265Cannot find a math library. You need to set MATHLIB in config.user) 1266fi])dnl 1267fi 1268AC_SUBST(MATHLIB)])dnl 1269dnl --------------------------------------------------------------------------- 1270dnl CF_MAWK_MAX__INT_PROGRAM version: 4 updated: 2017/10/16 20:54:11 1271dnl ------------------------ 1272dnl C program to compute MAX__INT and MAX__LONG if looking at headers fails 1273AC_DEFUN([CF_MAWK_MAX__INT_PROGRAM], 1274[[#include <stdio.h> 1275int main(void) 1276{ int y ; unsigned yu; long yy ; 1277 FILE *out ; 1278 1279 if ( !(out = fopen("conftest.out","w")) ) exit(1) ; 1280 /* find max int and max long */ 1281 y = 0x1000 ; 1282 while ( y > 0 ) { yu = y; y *= 2 ; } 1283 fprintf(out,"MAX__INT 0x%x\n", y-1) ; 1284 1285 yu = yu - 1; 1286 yu <<= 1; 1287 yu |= 1; 1288 fprintf(out,"MAX__UINT 0x%x\n", y-1) ; 1289 1290 yy = 0x1000 ; 1291 while ( yy > 0 ) yy *= 2 ; 1292 fprintf(out,"MAX__LONG 0x%lx\n", yy-1) ; 1293 exit(0) ; 1294 return 0 ; 1295 }]])dnl 1296dnl --------------------------------------------------------------------------- 1297dnl CF_MAWK_RUN_FPE_TESTS version: 14 updated: 2015/05/02 07:59:43 1298dnl --------------------- 1299dnl These are mawk's dreaded FPE tests. 1300AC_DEFUN([CF_MAWK_RUN_FPE_TESTS], 1301[ 1302AC_CHECK_FUNCS(isnan sigaction) 1303test "$ac_cv_func_sigaction" = yes && sigaction=1 1304 1305AC_CHECK_HEADERS(siginfo.h) 1306test "$ac_cv_header_siginfo_h" = yes && siginfo_h=1 1307 1308AC_CACHE_CHECK(if we should use siginfo,cf_cv_use_sv_siginfo,[ 1309if test "$sigaction" = 1 && test "$siginfo_h" = 1 ; then 1310 cf_cv_use_sv_siginfo=yes 1311else 1312 cf_cv_use_sv_siginfo=no 1313fi 1314]) 1315 1316AC_TYPE_SIGNAL 1317 1318AC_CACHE_CHECK(if we should use sigaction.sa_sigaction,cf_cv_use_sa_sigaction, 1319[ 1320cf_cv_use_sa_sigaction=no 1321if test "$ac_cv_func_sigaction" = yes 1322then 1323 AC_TRY_COMPILE([#include <signal.h>],[ 1324 struct sigaction foo; 1325 foo.sa_sigaction = 0; 1326],[cf_cv_use_sa_sigaction=yes]) 1327fi 1328]) 1329 1330test "$cf_cv_use_sa_sigaction" = yes && AC_DEFINE(HAVE_SIGACTION_SA_SIGACTION,1,[Define to 1 if we should use sigaction.sa_sigaction,cf_cv_use_sa_sigaction]) 1331 1332cf_FPE_DEFS="$CPPFLAGS" 1333cf_FPE_LIBS="$LIBS" 1334cf_FPE_SRCS="$srcdir/fpe_check.c" 1335 1336CPPFLAGS="$CPPFLAGS -I. -DRETSIGTYPE=$ac_cv_type_signal" 1337test "$ac_cv_func_isnan" = yes && CPPFLAGS="$CPPFLAGS -DHAVE_ISNAN" 1338test "$ac_cv_func_nanf" = yes && CPPFLAGS="$CPPFLAGS -DHAVE_NANF" 1339test "$ac_cv_func_sigaction" = yes && CPPFLAGS="$CPPFLAGS -DHAVE_SIGACTION" 1340test "$ac_cv_header_siginfo_h" = yes && CPPFLAGS="$CPPFLAGS -DHAVE_SIGINFO_H" 1341test "$cf_cv_use_sa_sigaction" = yes && CPPFLAGS="$CPPFLAGS -DHAVE_SIGACTION_SA_SIGACTION" 1342 1343LIBS="$MATHLIB $LIBS" 1344 1345echo checking handling of floating point exceptions 1346 1347cat >conftest.$ac_ext <<CF_EOF 1348#include <$cf_FPE_SRCS> 1349CF_EOF 1350 1351rm -f conftest$ac_exeext 1352 1353if AC_TRY_EVAL(ac_link); then 1354 echo "FPE_CHECK 1:check_fpe_traps" >&AC_FD_CC 1355 ./conftest 2>/dev/null 1356 cf_status=$? 1357else 1358 echo "$cf_FPE_SRCS failed to compile" 1>&2 1359 cf_status=100 1360fi 1361 1362echo "FPE_CHECK status=$cf_status" >&AC_FD_CC 1363case $cf_status in 1364 (0) ;; # good news do nothing 1365 (3) # reasonably good news 1366 AC_DEFINE(FPE_TRAPS_ON,1,[Define to 1 if floating-point exception traps are enabled]) 1367 CF_MAWK_FPE_SIGINFO ;; 1368 1369 (1|2|4) # bad news have to turn off traps 1370 # only know how to do this on systemV and solaris 1371 AC_CHECK_HEADER(ieeefp.h, cf_have_ieeefp_h=1) 1372 AC_CHECK_FUNC(fpsetmask, cf_have_fpsetmask=1) 1373 1374 if test "$cf_have_ieeefp_h" = 1 && test "$cf_have_fpsetmask" = 1 ; then 1375 AC_DEFINE(FPE_TRAPS_ON) 1376 AC_DEFINE(USE_IEEEFP_H,1,[Define to 1 we should include ieeefp.h]) 1377 AC_DEFINE_UNQUOTED([TURN_ON_FPE_TRAPS], 1378 [fpsetmask(fpgetmask() | (FP_X_DZ|FP_X_OFL))], 1379 [Define to expression for turning on FPE traps]) 1380 AC_DEFINE_UNQUOTED([TURN_OFF_FPE_TRAPS], 1381 [fpsetmask(fpgetmask() & ~(FP_X_DZ|FP_X_OFL))], 1382 [Define to expression for turning off FPE traps]) 1383 1384 CF_MAWK_FPE_SIGINFO 1385 1386 # look for strtod overflow bug 1387 AC_MSG_CHECKING([strtod bug on overflow]) 1388 1389 rm -f conftest$ac_exeext 1390 CPPFLAGS="$CPPFLAGS -DUSE_IEEEFP_H" 1391 1392 cat >conftest.$ac_ext <<CF_EOF 1393#include <$cf_FPE_SRCS> 1394CF_EOF 1395 1396 if AC_TRY_EVAL(ac_link); then 1397 echo "FPE_CHECK 3:check_strtod_ovf" >&AC_FD_CC 1398 if ./conftest phoney_arg phoney_arg 2>/dev/null 1399 then 1400 AC_MSG_RESULT([no bug]) 1401 else 1402 AC_MSG_RESULT([buggy -- will use work around]) 1403 AC_DEFINE_UNQUOTED(HAVE_STRTOD_OVF_BUG,1,[Define to 1 if strtod has overflow bug]) 1404 fi 1405 else 1406 AC_MSG_RESULT([$cf_FPE_SRCS failed to compile]) 1407 fi 1408 else 1409 if test $cf_status != 4 ; then 1410 AC_DEFINE(FPE_TRAPS_ON) 1411 CF_MAWK_FPE_SIGINFO 1412 fi 1413 1414 [case $cf_status in 1415 (1) 1416 cat 1>&2 <<-'EOF' 1417 Warning: Your system defaults generate floating point exception 1418 on divide by zero but not on overflow. You need to 1419 #define TURN_ON_FPE_TRAPS to handle overflow. 1420EOF 1421 ;; 1422 (2) 1423 cat 1>&2 <<-'EOF' 1424 Warning: Your system defaults generate floating point exception 1425 on overflow but not on divide by zero. You need to 1426 #define TURN_ON_FPE_TRAPS to handle divide by zero. 1427EOF 1428 ;; 1429 (4) 1430 cat 1>&2 <<-'EOF' 1431 Warning: Your system defaults do not generate floating point 1432 exceptions, but your math library does not support this behavior. 1433 You need to 1434 #define TURN_ON_FPE_TRAPS to use fp exceptions for consistency. 1435EOF 1436 ;; 1437 esac] 1438 cat 1>&2 <<-'EOF' 1439 Please report this so I can fix this script to do it automatically. 1440 CF_MAWK_MAINTAINER 1441 You can continue with the build and the resulting mawk will be 1442 useable, but getting FPE_TRAPS_ON correct eventually is best. 1443EOF 1444fi 1445 ;; 1446 1447 (*) # some sort of disaster 1448 if test "x$cross_compiling" = xno 1449 then 1450 cat 1>&2 <<-EOF 1451 The program \`fpe_check' compiled from $cf_FPE_SRCS seems to have 1452 unexpectly blown up. Please report this to CF_MAWK_MAINTAINER 1453EOF 1454 # quit or not ??? 1455 else 1456 cat 1>&2 <<-EOF 1457 The program \`fpe_check' will not work for cross-compiling. 1458 You can continue with the build and the resulting mawk will be 1459 useable, but getting FPE_TRAPS_ON correct eventually is best. 1460EOF 1461 fi 1462 ;; 1463esac 1464 1465CPPFLAGS="$cf_FPE_DEFS" 1466LIBS="$cf_FPE_LIBS" 1467 1468rm -f conftest.$ac_ext fpe_check$ac_exeext # whew!! 1469]) 1470dnl --------------------------------------------------------------------------- 1471dnl CF_MIXEDCASE_FILENAMES version: 7 updated: 2015/04/12 15:39:00 1472dnl ---------------------- 1473dnl Check if the file-system supports mixed-case filenames. If we're able to 1474dnl create a lowercase name and see it as uppercase, it doesn't support that. 1475AC_DEFUN([CF_MIXEDCASE_FILENAMES], 1476[ 1477AC_CACHE_CHECK(if filesystem supports mixed-case filenames,cf_cv_mixedcase,[ 1478if test "$cross_compiling" = yes ; then 1479 case $target_alias in 1480 (*-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-msys*|*-mingw*|*-uwin*) 1481 cf_cv_mixedcase=no 1482 ;; 1483 (*) 1484 cf_cv_mixedcase=yes 1485 ;; 1486 esac 1487else 1488 rm -f conftest CONFTEST 1489 echo test >conftest 1490 if test -f CONFTEST ; then 1491 cf_cv_mixedcase=no 1492 else 1493 cf_cv_mixedcase=yes 1494 fi 1495 rm -f conftest CONFTEST 1496fi 1497]) 1498test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES,1,[Define to 1 if filesystem supports mixed-case filenames.]) 1499])dnl 1500dnl --------------------------------------------------------------------------- 1501dnl CF_MSG_LOG version: 5 updated: 2010/10/23 15:52:32 1502dnl ---------- 1503dnl Write a debug message to config.log, along with the line number in the 1504dnl configure script. 1505AC_DEFUN([CF_MSG_LOG],[ 1506echo "${as_me:-configure}:__oline__: testing $* ..." 1>&AC_FD_CC 1507])dnl 1508dnl --------------------------------------------------------------------------- 1509dnl CF_NO_LEAKS_OPTION version: 6 updated: 2015/04/12 15:39:00 1510dnl ------------------ 1511dnl see CF_WITH_NO_LEAKS 1512AC_DEFUN([CF_NO_LEAKS_OPTION],[ 1513AC_MSG_CHECKING(if you want to use $1 for testing) 1514AC_ARG_WITH($1, 1515 [$2], 1516 [AC_DEFINE_UNQUOTED($3,1,"Define to 1 if you want to use $1 for testing.")ifelse([$4],,[ 1517 $4 1518]) 1519 : ${with_cflags:=-g} 1520 : ${with_no_leaks:=yes} 1521 with_$1=yes], 1522 [with_$1=]) 1523AC_MSG_RESULT(${with_$1:-no}) 1524 1525case .$with_cflags in 1526(.*-g*) 1527 case .$CFLAGS in 1528 (.*-g*) 1529 ;; 1530 (*) 1531 CF_ADD_CFLAGS([-g]) 1532 ;; 1533 esac 1534 ;; 1535esac 1536])dnl 1537dnl --------------------------------------------------------------------------- 1538dnl CF_PATH_SYNTAX version: 16 updated: 2015/04/18 08:56:57 1539dnl -------------- 1540dnl Check the argument to see that it looks like a pathname. Rewrite it if it 1541dnl begins with one of the prefix/exec_prefix variables, and then again if the 1542dnl result begins with 'NONE'. This is necessary to work around autoconf's 1543dnl delayed evaluation of those symbols. 1544AC_DEFUN([CF_PATH_SYNTAX],[ 1545if test "x$prefix" != xNONE; then 1546 cf_path_syntax="$prefix" 1547else 1548 cf_path_syntax="$ac_default_prefix" 1549fi 1550 1551case ".[$]$1" in 1552(.\[$]\(*\)*|.\'*\'*) 1553 ;; 1554(..|./*|.\\*) 1555 ;; 1556(.[[a-zA-Z]]:[[\\/]]*) # OS/2 EMX 1557 ;; 1558(.\[$]{*prefix}*|.\[$]{*dir}*) 1559 eval $1="[$]$1" 1560 case ".[$]$1" in 1561 (.NONE/*) 1562 $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%` 1563 ;; 1564 esac 1565 ;; 1566(.no|.NONE/*) 1567 $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%` 1568 ;; 1569(*) 1570 ifelse([$2],,[AC_MSG_ERROR([expected a pathname, not \"[$]$1\"])],$2) 1571 ;; 1572esac 1573])dnl 1574dnl --------------------------------------------------------------------------- 1575dnl CF_POSIX_C_SOURCE version: 11 updated: 2018/12/31 20:46:17 1576dnl ----------------- 1577dnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed. 1578dnl 1579dnl POSIX.1-1990 _POSIX_SOURCE 1580dnl POSIX.1-1990 and _POSIX_SOURCE and 1581dnl POSIX.2-1992 C-Language _POSIX_C_SOURCE=2 1582dnl Bindings Option 1583dnl POSIX.1b-1993 _POSIX_C_SOURCE=199309L 1584dnl POSIX.1c-1996 _POSIX_C_SOURCE=199506L 1585dnl X/Open 2000 _POSIX_C_SOURCE=200112L 1586dnl 1587dnl Parameters: 1588dnl $1 is the nominal value for _POSIX_C_SOURCE 1589AC_DEFUN([CF_POSIX_C_SOURCE], 1590[AC_REQUIRE([CF_POSIX_VISIBLE])dnl 1591 1592if test "$cf_cv_posix_visible" = no; then 1593 1594cf_POSIX_C_SOURCE=ifelse([$1],,199506L,[$1]) 1595 1596cf_save_CFLAGS="$CFLAGS" 1597cf_save_CPPFLAGS="$CPPFLAGS" 1598 1599CF_REMOVE_DEFINE(cf_trim_CFLAGS,$cf_save_CFLAGS,_POSIX_C_SOURCE) 1600CF_REMOVE_DEFINE(cf_trim_CPPFLAGS,$cf_save_CPPFLAGS,_POSIX_C_SOURCE) 1601 1602AC_CACHE_CHECK(if we should define _POSIX_C_SOURCE,cf_cv_posix_c_source,[ 1603 CF_MSG_LOG(if the symbol is already defined go no further) 1604 AC_TRY_COMPILE([#include <sys/types.h>],[ 1605#ifndef _POSIX_C_SOURCE 1606make an error 1607#endif], 1608 [cf_cv_posix_c_source=no], 1609 [cf_want_posix_source=no 1610 case .$cf_POSIX_C_SOURCE in 1611 (.[[12]]??*) 1612 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" 1613 ;; 1614 (.2) 1615 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" 1616 cf_want_posix_source=yes 1617 ;; 1618 (.*) 1619 cf_want_posix_source=yes 1620 ;; 1621 esac 1622 if test "$cf_want_posix_source" = yes ; then 1623 AC_TRY_COMPILE([#include <sys/types.h>],[ 1624#ifdef _POSIX_SOURCE 1625make an error 1626#endif],[], 1627 cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE") 1628 fi 1629 CF_MSG_LOG(ifdef from value $cf_POSIX_C_SOURCE) 1630 CFLAGS="$cf_trim_CFLAGS" 1631 CPPFLAGS="$cf_trim_CPPFLAGS" 1632 CF_APPEND_TEXT(CPPFLAGS,$cf_cv_posix_c_source) 1633 CF_MSG_LOG(if the second compile does not leave our definition intact error) 1634 AC_TRY_COMPILE([#include <sys/types.h>],[ 1635#ifndef _POSIX_C_SOURCE 1636make an error 1637#endif],, 1638 [cf_cv_posix_c_source=no]) 1639 CFLAGS="$cf_save_CFLAGS" 1640 CPPFLAGS="$cf_save_CPPFLAGS" 1641 ]) 1642]) 1643 1644if test "$cf_cv_posix_c_source" != no ; then 1645 CFLAGS="$cf_trim_CFLAGS" 1646 CPPFLAGS="$cf_trim_CPPFLAGS" 1647 CF_ADD_CFLAGS($cf_cv_posix_c_source) 1648fi 1649 1650fi # cf_cv_posix_visible 1651 1652])dnl 1653dnl --------------------------------------------------------------------------- 1654dnl CF_POSIX_VISIBLE version: 1 updated: 2018/12/31 20:46:17 1655dnl ---------------- 1656dnl POSIX documents test-macros which an application may set before any system 1657dnl headers are included to make features available. 1658dnl 1659dnl Some BSD platforms (originally FreeBSD, but copied by a few others) 1660dnl diverged from POSIX in 2002 by setting symbols which make all of the most 1661dnl recent features visible in the system header files unless the application 1662dnl overrides the corresponding test-macros. Doing that introduces portability 1663dnl problems. 1664dnl 1665dnl This macro makes a special check for the symbols used for this, to avoid a 1666dnl conflicting definition. 1667AC_DEFUN([CF_POSIX_VISIBLE], 1668[ 1669AC_CACHE_CHECK(if the POSIX test-macros are already defined,cf_cv_posix_visible,[ 1670AC_TRY_COMPILE([#include <stdio.h>],[ 1671#if defined(__POSIX_VISIBLE) && ((__POSIX_VISIBLE - 0L) > 0) \ 1672 && defined(__XSI_VISIBLE) && ((__XSI_VISIBLE - 0L) > 0) \ 1673 && defined(__BSD_VISIBLE) && ((__BSD_VISIBLE - 0L) > 0) \ 1674 && defined(__ISO_C_VISIBLE) && ((__ISO_C_VISIBLE - 0L) > 0) 1675#error conflicting symbols found 1676#endif 1677],[cf_cv_posix_visible=no],[cf_cv_posix_visible=yes]) 1678]) 1679])dnl 1680dnl --------------------------------------------------------------------------- 1681dnl CF_PROG_CC version: 4 updated: 2014/07/12 18:57:58 1682dnl ---------- 1683dnl standard check for CC, plus followup sanity checks 1684dnl $1 = optional parameter to pass to AC_PROG_CC to specify compiler name 1685AC_DEFUN([CF_PROG_CC],[ 1686ifelse($1,,[AC_PROG_CC],[AC_PROG_CC($1)]) 1687CF_GCC_VERSION 1688CF_ACVERSION_CHECK(2.52, 1689 [AC_PROG_CC_STDC], 1690 [CF_ANSI_CC_REQD]) 1691CF_CC_ENV_FLAGS 1692])dnl 1693dnl --------------------------------------------------------------------------- 1694dnl CF_PROG_GROFF version: 3 updated: 2018/01/07 13:16:19 1695dnl ------------- 1696dnl Check if groff is available, for cases (such as html output) where nroff 1697dnl is not enough. 1698AC_DEFUN([CF_PROG_GROFF],[ 1699AC_PATH_PROG(GROFF_PATH,groff,no) 1700AC_PATH_PROGS(NROFF_PATH,nroff mandoc,no) 1701AC_PATH_PROG(TBL_PATH,tbl,cat) 1702if test "x$GROFF_PATH" = xno 1703then 1704 NROFF_NOTE= 1705 GROFF_NOTE="#" 1706else 1707 NROFF_NOTE="#" 1708 GROFF_NOTE= 1709fi 1710AC_SUBST(GROFF_NOTE) 1711AC_SUBST(NROFF_NOTE) 1712])dnl 1713dnl --------------------------------------------------------------------------- 1714dnl CF_PROG_LINT version: 3 updated: 2016/05/22 15:25:54 1715dnl ------------ 1716AC_DEFUN([CF_PROG_LINT], 1717[ 1718AC_CHECK_PROGS(LINT, lint cppcheck splint) 1719AC_SUBST(LINT_OPTS) 1720])dnl 1721dnl --------------------------------------------------------------------------- 1722dnl CF_REGEX version: 12 updated: 2015/04/18 08:56:57 1723dnl -------- 1724dnl Attempt to determine if we've got one of the flavors of regular-expression 1725dnl code that we can support. 1726AC_DEFUN([CF_REGEX], 1727[ 1728 1729cf_regex_func=no 1730 1731cf_regex_libs="regex re" 1732case $host_os in 1733(mingw*) 1734 cf_regex_libs="gnurx $cf_regex_libs" 1735 ;; 1736esac 1737 1738AC_CHECK_FUNC(regcomp,[cf_regex_func=regcomp],[ 1739 for cf_regex_lib in $cf_regex_libs 1740 do 1741 AC_CHECK_LIB($cf_regex_lib,regcomp,[ 1742 CF_ADD_LIB($cf_regex_lib) 1743 cf_regex_func=regcomp 1744 break]) 1745 done 1746]) 1747 1748if test "$cf_regex_func" = no ; then 1749 AC_CHECK_FUNC(compile,[cf_regex_func=compile],[ 1750 AC_CHECK_LIB(gen,compile,[ 1751 CF_ADD_LIB(gen) 1752 cf_regex_func=compile])]) 1753fi 1754 1755if test "$cf_regex_func" = no ; then 1756 AC_MSG_WARN(cannot find regular expression library) 1757fi 1758 1759AC_CACHE_CHECK(for regular-expression headers,cf_cv_regex_hdrs,[ 1760 1761cf_cv_regex_hdrs=no 1762case $cf_regex_func in 1763(compile) 1764 for cf_regex_hdr in regexp.h regexpr.h 1765 do 1766 AC_TRY_LINK([#include <$cf_regex_hdr>],[ 1767 char *p = compile("", "", "", 0); 1768 int x = step("", ""); 1769 ],[ 1770 cf_cv_regex_hdrs=$cf_regex_hdr 1771 break 1772 ]) 1773 done 1774 ;; 1775(*) 1776 for cf_regex_hdr in regex.h 1777 do 1778 AC_TRY_LINK([#include <sys/types.h> 1779#include <$cf_regex_hdr>],[ 1780 regex_t *p; 1781 int x = regcomp(p, "", 0); 1782 int y = regexec(p, "", 0, 0, 0); 1783 regfree(p); 1784 ],[ 1785 cf_cv_regex_hdrs=$cf_regex_hdr 1786 break 1787 ]) 1788 done 1789 ;; 1790esac 1791 1792]) 1793 1794case $cf_cv_regex_hdrs in 1795 (no) AC_MSG_WARN(no regular expression header found) ;; 1796 (regex.h) AC_DEFINE(HAVE_REGEX_H_FUNCS,1,[Define to 1 to include regex.h for regular expressions]) ;; 1797 (regexp.h) AC_DEFINE(HAVE_REGEXP_H_FUNCS,1,[Define to 1 to include regexp.h for regular expressions]) ;; 1798 (regexpr.h) AC_DEFINE(HAVE_REGEXPR_H_FUNCS,1,[Define to 1 to include regexpr.h for regular expressions]) ;; 1799esac 1800])dnl 1801dnl --------------------------------------------------------------------------- 1802dnl CF_REMOVE_DEFINE version: 3 updated: 2010/01/09 11:05:50 1803dnl ---------------- 1804dnl Remove all -U and -D options that refer to the given symbol from a list 1805dnl of C compiler options. This works around the problem that not all 1806dnl compilers process -U and -D options from left-to-right, so a -U option 1807dnl cannot be used to cancel the effect of a preceding -D option. 1808dnl 1809dnl $1 = target (which could be the same as the source variable) 1810dnl $2 = source (including '$') 1811dnl $3 = symbol to remove 1812define([CF_REMOVE_DEFINE], 1813[ 1814$1=`echo "$2" | \ 1815 sed -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[[ ]]/ /g' \ 1816 -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[$]//g'` 1817])dnl 1818dnl --------------------------------------------------------------------------- 1819dnl CF_SET_MATH_LIB_VERSION version: 1 updated: 2013/12/26 20:21:00 1820dnl ----------------------- 1821dnl Check if math.h declares _LIB_VERSION, and if so, whether we can modify it 1822dnl at runtime. Cygwin is known to be broken in this regard (late 2013). 1823AC_DEFUN([CF_SET_MATH_LIB_VERSION],[ 1824AC_CACHE_CHECK(if math.h declares _LIB_VERSION,cf_cv_get_math_lib_version,[ 1825 1826AC_TRY_LINK([ 1827#include <math.h>], 1828 [int foo = _LIB_VERSION], 1829 [cf_cv_get_math_lib_version=yes], 1830 [cf_cv_get_math_lib_version=no]) 1831]) 1832 1833if test "x$cf_cv_get_math_lib_version" = xyes 1834then 1835 AC_CACHE_CHECK(if we can update _LIB_VERSION,cf_cv_set_math_lib_version,[ 1836 1837 AC_TRY_LINK([ 1838#include <math.h>], 1839 [_LIB_VERSION = _IEEE_], 1840 [cf_cv_set_math_lib_version=yes], 1841 [cf_cv_set_math_lib_version=no]) 1842 ]) 1843 if test "x$cf_cv_set_math_lib_version" = xyes 1844 then 1845 AC_DEFINE(HAVE_MATH__LIB_VERSION,1,[Define to 1 if we can set math.h variable _LIB_VERSION]) 1846 else 1847 AC_MSG_WARN(this is probably due to a defect in your system headers) 1848 fi 1849fi 1850])dnl 1851dnl --------------------------------------------------------------------------- 1852dnl CF_SRAND version: 13 updated: 2016/09/05 12:39:46 1853dnl -------- 1854dnl Check for functions similar to srand() and rand(). lrand48() and random() 1855dnl return a 31-bit value, while rand() returns a value less than RAND_MAX 1856dnl which usually is only 16-bits. 1857dnl 1858dnl On MirOS, use arc4random_push() and arc4random(). 1859dnl Some systems support an asymmetric variation of this interface. 1860dnl 1861dnl $1 = optional prefix for resulting shell variables. The default "my_" 1862dnl gives $my_srand and $my_rand to the caller, as well as MY_RAND_MAX. 1863dnl These are all AC_SUBST'd and AC_DEFINE'd. 1864AC_DEFUN([CF_SRAND],[ 1865AC_CACHE_CHECK(for random-integer functions, cf_cv_srand_func,[ 1866cf_cv_srand_func=unknown 1867for cf_func in arc4random_push/arc4random arc4random_stir/arc4random srandom/random srand48/lrand48 srand/rand 1868do 1869 CF_SRAND_PARSE($cf_func,cf_srand_func,cf_rand_func) 1870 1871AC_TRY_LINK([ 1872#ifdef HAVE_STDLIB_H 1873#include <stdlib.h> 1874#endif 1875#ifdef HAVE_LIMITS_H 1876#include <limits.h> 1877#endif 1878],[long seed = 1; $cf_srand_func(seed); seed = $cf_rand_func()], 1879[cf_cv_srand_func=$cf_func 1880 break]) 1881done 1882]) 1883if test "$cf_cv_srand_func" != unknown ; then 1884 AC_CACHE_CHECK(for range of random-integers, cf_cv_rand_max,[ 1885 case $cf_cv_srand_func in 1886 (srand/rand) 1887 cf_cv_rand_max=RAND_MAX 1888 cf_rand_max=16 1889 ;; 1890 (*/arc4random) 1891 cf_cv_rand_max=0xFFFFFFFFUL 1892 cf_rand_max=32 1893 ;; 1894 (*) 1895 cf_cv_rand_max=INT_MAX 1896 cf_rand_max=31 1897 ;; 1898 esac 1899 AC_TRY_COMPILE([ 1900#ifdef HAVE_STDLIB_H 1901#include <stdlib.h> 1902#endif 1903#ifdef HAVE_LIMITS_H 1904#include <limits.h> 1905#endif 1906 ],[long x = $cf_cv_rand_max],, 1907 [cf_cv_rand_max="(1UL<<$cf_rand_max)-1"]) 1908 ]) 1909 1910 case $cf_cv_srand_func in 1911 (*/arc4random) 1912 AC_MSG_CHECKING(if <bsd/stdlib.h> should be included) 1913 AC_TRY_COMPILE([#include <bsd/stdlib.h>], 1914 [void *arc4random(int); 1915 void *x = arc4random(1)], 1916 [cf_bsd_stdlib_h=no], 1917 [AC_TRY_COMPILE([#include <bsd/stdlib.h>], 1918 [unsigned x = arc4random()], 1919 [cf_bsd_stdlib_h=yes], 1920 [cf_bsd_stdlib_h=no])]) 1921 AC_MSG_RESULT($cf_bsd_stdlib_h) 1922 if test "$cf_bsd_stdlib_h" = yes 1923 then 1924 AC_DEFINE(HAVE_BSD_STDLIB_H,1,[Define to 1 if bsd/stdlib.h header should be used]) 1925 else 1926 AC_MSG_CHECKING(if <bsd/random.h> should be included) 1927 AC_TRY_COMPILE([#include <bsd/random.h>], 1928 [void *arc4random(int); 1929 void *x = arc4random(1)], 1930 [cf_bsd_random_h=no], 1931 [AC_TRY_COMPILE([#include <bsd/random.h>], 1932 [unsigned x = arc4random()], 1933 [cf_bsd_random_h=yes], 1934 [cf_bsd_random_h=no])]) 1935 AC_MSG_RESULT($cf_bsd_random_h) 1936 if test "$cf_bsd_random_h" = yes 1937 then 1938 AC_DEFINE(HAVE_BSD_RANDOM_H,1,[Define to 1 if bsd/random.h header should be used]) 1939 else 1940 AC_MSG_WARN(no header file found for arc4random) 1941 fi 1942 fi 1943 ;; 1944 esac 1945 1946 CF_SRAND_PARSE($cf_func,cf_srand_func,cf_rand_func) 1947 1948 CF_UPPER(cf_rand_max,ifelse($1,,my_,$1)rand_max) 1949 AC_DEFINE_UNQUOTED(ifelse($1,,my_,$1)srand,$cf_srand_func,[Define to the name for the srand function]) 1950 AC_DEFINE_UNQUOTED(ifelse($1,,my_,$1)rand, $cf_rand_func,[Define to the name for the rand function]) 1951 AC_DEFINE_UNQUOTED([$]cf_rand_max, $cf_cv_rand_max,[Define to the name for the RAND_MAX constant]) 1952fi 1953])dnl 1954dnl --------------------------------------------------------------------------- 1955dnl CF_SRAND_PARSE version: 2 updated: 2015/04/15 19:08:48 1956dnl -------------- 1957dnl Parse the loop variable for CF_SRAND, with a workaround for asymmetric 1958dnl variations. 1959define([CF_SRAND_PARSE],[ 1960 $2=`echo $1 | sed -e 's%/.*%%'` 1961 $3=`echo $1 | sed -e 's%.*/%%'` 1962 1963 case [$]$2 in 1964 (arc4random_stir) 1965 $2='(void)' 1966 ;; 1967 esac 1968])dnl 1969dnl --------------------------------------------------------------------------- 1970dnl CF_TRY_XOPEN_SOURCE version: 2 updated: 2018/06/20 20:23:13 1971dnl ------------------- 1972dnl If _XOPEN_SOURCE is not defined in the compile environment, check if we 1973dnl can define it successfully. 1974AC_DEFUN([CF_TRY_XOPEN_SOURCE],[ 1975AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[ 1976 AC_TRY_COMPILE([ 1977#include <stdlib.h> 1978#include <string.h> 1979#include <sys/types.h> 1980],[ 1981#ifndef _XOPEN_SOURCE 1982make an error 1983#endif], 1984 [cf_cv_xopen_source=no], 1985 [cf_save="$CPPFLAGS" 1986 CF_APPEND_TEXT(CPPFLAGS,-D_XOPEN_SOURCE=$cf_XOPEN_SOURCE) 1987 AC_TRY_COMPILE([ 1988#include <stdlib.h> 1989#include <string.h> 1990#include <sys/types.h> 1991],[ 1992#ifdef _XOPEN_SOURCE 1993make an error 1994#endif], 1995 [cf_cv_xopen_source=no], 1996 [cf_cv_xopen_source=$cf_XOPEN_SOURCE]) 1997 CPPFLAGS="$cf_save" 1998 ]) 1999]) 2000 2001if test "$cf_cv_xopen_source" != no ; then 2002 CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE) 2003 CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE) 2004 cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source" 2005 CF_ADD_CFLAGS($cf_temp_xopen_source) 2006fi 2007]) 2008dnl --------------------------------------------------------------------------- 2009dnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59 2010dnl -------- 2011dnl Make an uppercase version of a variable 2012dnl $1=uppercase($2) 2013AC_DEFUN([CF_UPPER], 2014[ 2015$1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` 2016])dnl 2017dnl --------------------------------------------------------------------------- 2018dnl CF_VERBOSE version: 3 updated: 2007/07/29 09:55:12 2019dnl ---------- 2020dnl Use AC_VERBOSE w/o the warnings 2021AC_DEFUN([CF_VERBOSE], 2022[test -n "$verbose" && echo " $1" 1>&AC_FD_MSG 2023CF_MSG_LOG([$1]) 2024])dnl 2025dnl --------------------------------------------------------------------------- 2026dnl CF_WITH_DBMALLOC version: 7 updated: 2010/06/21 17:26:47 2027dnl ---------------- 2028dnl Configure-option for dbmalloc. The optional parameter is used to override 2029dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests. 2030AC_DEFUN([CF_WITH_DBMALLOC],[ 2031CF_NO_LEAKS_OPTION(dbmalloc, 2032 [ --with-dbmalloc test: use Conor Cahill's dbmalloc library], 2033 [USE_DBMALLOC]) 2034 2035if test "$with_dbmalloc" = yes ; then 2036 AC_CHECK_HEADER(dbmalloc.h, 2037 [AC_CHECK_LIB(dbmalloc,[debug_malloc]ifelse([$1],,[],[,$1]))]) 2038fi 2039])dnl 2040dnl --------------------------------------------------------------------------- 2041dnl CF_WITH_DMALLOC version: 7 updated: 2010/06/21 17:26:47 2042dnl --------------- 2043dnl Configure-option for dmalloc. The optional parameter is used to override 2044dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests. 2045AC_DEFUN([CF_WITH_DMALLOC],[ 2046CF_NO_LEAKS_OPTION(dmalloc, 2047 [ --with-dmalloc test: use Gray Watson's dmalloc library], 2048 [USE_DMALLOC]) 2049 2050if test "$with_dmalloc" = yes ; then 2051 AC_CHECK_HEADER(dmalloc.h, 2052 [AC_CHECK_LIB(dmalloc,[dmalloc_debug]ifelse([$1],,[],[,$1]))]) 2053fi 2054])dnl 2055dnl --------------------------------------------------------------------------- 2056dnl CF_WITH_MAN2HTML version: 8 updated: 2018/06/27 18:44:03 2057dnl ---------------- 2058dnl Check for man2html and groff. Prefer man2html over groff, but use groff 2059dnl as a fallback. See 2060dnl 2061dnl http://invisible-island.net/scripts/man2html.html 2062dnl 2063dnl Generate a shell script which hides the differences between the two. 2064dnl 2065dnl We name that "man2html.tmp". 2066dnl 2067dnl The shell script can be removed later, e.g., using "make distclean". 2068AC_DEFUN([CF_WITH_MAN2HTML],[ 2069AC_REQUIRE([CF_PROG_GROFF]) 2070 2071case "x${with_man2html}" in 2072(xno) 2073 cf_man2html=no 2074 ;; 2075(x|xyes) 2076 AC_PATH_PROG(cf_man2html,man2html,no) 2077 case "x$cf_man2html" in 2078 (x/*) 2079 AC_MSG_CHECKING(for the modified Earl Hood script) 2080 if ( $cf_man2html -help 2>&1 | grep 'Make an index of headers at the end' >/dev/null ) 2081 then 2082 cf_man2html_ok=yes 2083 else 2084 cf_man2html=no 2085 cf_man2html_ok=no 2086 fi 2087 AC_MSG_RESULT($cf_man2html_ok) 2088 ;; 2089 (*) 2090 cf_man2html=no 2091 ;; 2092 esac 2093esac 2094 2095AC_MSG_CHECKING(for program to convert manpage to html) 2096AC_ARG_WITH(man2html, 2097 [ --with-man2html=XXX use XXX rather than groff], 2098 [cf_man2html=$withval], 2099 [cf_man2html=$cf_man2html]) 2100 2101cf_with_groff=no 2102 2103case $cf_man2html in 2104(yes) 2105 AC_MSG_RESULT(man2html) 2106 AC_PATH_PROG(cf_man2html,man2html,no) 2107 ;; 2108(no|groff|*/groff*) 2109 cf_with_groff=yes 2110 cf_man2html=$GROFF_PATH 2111 AC_MSG_RESULT($cf_man2html) 2112 ;; 2113(*) 2114 AC_MSG_RESULT($cf_man2html) 2115 ;; 2116esac 2117 2118MAN2HTML_TEMP="man2html.tmp" 2119 cat >$MAN2HTML_TEMP <<CF_EOF 2120#!$SHELL 2121# Temporary script generated by CF_WITH_MAN2HTML 2122# Convert inputs to html, sending result to standard output. 2123# 2124# Parameters: 2125# \${1} = rootname of file to convert 2126# \${2} = suffix of file to convert, e.g., "1" 2127# \${3} = macros to use, e.g., "man" 2128# 2129ROOT=\[$]1 2130TYPE=\[$]2 2131MACS=\[$]3 2132 2133unset LANG 2134unset LC_ALL 2135unset LC_CTYPE 2136unset LANGUAGE 2137GROFF_NO_SGR=stupid 2138export GROFF_NO_SGR 2139 2140CF_EOF 2141 2142if test "x$cf_with_groff" = xyes 2143then 2144 MAN2HTML_NOTE="$GROFF_NOTE" 2145 MAN2HTML_PATH="$GROFF_PATH" 2146 cat >>$MAN2HTML_TEMP <<CF_EOF 2147$SHELL -c "$TBL_PATH \${ROOT}.\${TYPE} | $GROFF_PATH -P -o0 -I\${ROOT}_ -Thtml -\${MACS}" 2148CF_EOF 2149else 2150 MAN2HTML_NOTE="" 2151 CF_PATH_SYNTAX(cf_man2html) 2152 MAN2HTML_PATH="$cf_man2html" 2153 AC_MSG_CHECKING(for $cf_man2html top/bottom margins) 2154 2155 # for this example, expect 3 lines of content, the remainder is head/foot 2156 cat >conftest.in <<CF_EOF 2157.TH HEAD1 HEAD2 HEAD3 HEAD4 HEAD5 2158.SH SECTION 2159MARKER 2160CF_EOF 2161 2162 LC_ALL=C LC_CTYPE=C LANG=C LANGUAGE=C $NROFF_PATH -man conftest.in >conftest.out 2163 2164 cf_man2html_1st=`fgrep -n MARKER conftest.out |sed -e 's/^[[^0-9]]*://' -e 's/:.*//'` 2165 cf_man2html_top=`expr $cf_man2html_1st - 2` 2166 cf_man2html_bot=`wc -l conftest.out |sed -e 's/[[^0-9]]//g'` 2167 cf_man2html_bot=`expr $cf_man2html_bot - 2 - $cf_man2html_top` 2168 cf_man2html_top_bot="-topm=$cf_man2html_top -botm=$cf_man2html_bot" 2169 2170 AC_MSG_RESULT($cf_man2html_top_bot) 2171 2172 AC_MSG_CHECKING(for pagesize to use) 2173 for cf_block in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2174 do 2175 cat >>conftest.in <<CF_EOF 2176.nf 21770 21781 21792 21803 21814 21825 21836 21847 21858 21869 2187CF_EOF 2188 done 2189 2190 LC_ALL=C LC_CTYPE=C LANG=C LANGUAGE=C $NROFF_PATH -man conftest.in >conftest.out 2191 cf_man2html_page=`fgrep -n HEAD1 conftest.out |sed -n '$p' |sed -e 's/^[[^0-9]]*://' -e 's/:.*//'` 2192 test -z "$cf_man2html_page" && cf_man2html_page=99999 2193 test "$cf_man2html_page" -gt 100 && cf_man2html_page=99999 2194 2195 rm -rf conftest* 2196 AC_MSG_RESULT($cf_man2html_page) 2197 2198 cat >>$MAN2HTML_TEMP <<CF_EOF 2199: \${MAN2HTML_PATH=$MAN2HTML_PATH} 2200MAN2HTML_OPTS="\$MAN2HTML_OPTS -index -title="\$ROOT\(\$TYPE\)" -compress -pgsize $cf_man2html_page" 2201case \${TYPE} in 2202(ms) 2203 $TBL_PATH \${ROOT}.\${TYPE} | $NROFF_PATH -\${MACS} | \$MAN2HTML_PATH -topm=0 -botm=0 \$MAN2HTML_OPTS 2204 ;; 2205(*) 2206 $TBL_PATH \${ROOT}.\${TYPE} | $NROFF_PATH -\${MACS} | \$MAN2HTML_PATH $cf_man2html_top_bot \$MAN2HTML_OPTS 2207 ;; 2208esac 2209CF_EOF 2210fi 2211 2212chmod 700 $MAN2HTML_TEMP 2213 2214AC_SUBST(MAN2HTML_NOTE) 2215AC_SUBST(MAN2HTML_PATH) 2216AC_SUBST(MAN2HTML_TEMP) 2217])dnl 2218dnl --------------------------------------------------------------------------- 2219dnl CF_WITH_VALGRIND version: 1 updated: 2006/12/14 18:00:21 2220dnl ---------------- 2221AC_DEFUN([CF_WITH_VALGRIND],[ 2222CF_NO_LEAKS_OPTION(valgrind, 2223 [ --with-valgrind test: use valgrind], 2224 [USE_VALGRIND]) 2225])dnl 2226dnl --------------------------------------------------------------------------- 2227dnl CF_XOPEN_SOURCE version: 55 updated: 2018/12/31 20:46:17 2228dnl --------------- 2229dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions, 2230dnl or adapt to the vendor's definitions to get equivalent functionality, 2231dnl without losing the common non-POSIX features. 2232dnl 2233dnl Parameters: 2234dnl $1 is the nominal value for _XOPEN_SOURCE 2235dnl $2 is the nominal value for _POSIX_C_SOURCE 2236AC_DEFUN([CF_XOPEN_SOURCE],[ 2237AC_REQUIRE([AC_CANONICAL_HOST]) 2238AC_REQUIRE([CF_POSIX_VISIBLE]) 2239 2240if test "$cf_cv_posix_visible" = no; then 2241 2242cf_XOPEN_SOURCE=ifelse([$1],,500,[$1]) 2243cf_POSIX_C_SOURCE=ifelse([$2],,199506L,[$2]) 2244cf_xopen_source= 2245 2246case $host_os in 2247(aix[[4-7]]*) 2248 cf_xopen_source="-D_ALL_SOURCE" 2249 ;; 2250(msys) 2251 cf_XOPEN_SOURCE=600 2252 ;; 2253(darwin[[0-8]].*) 2254 cf_xopen_source="-D_APPLE_C_SOURCE" 2255 ;; 2256(darwin*) 2257 cf_xopen_source="-D_DARWIN_C_SOURCE" 2258 cf_XOPEN_SOURCE= 2259 ;; 2260(freebsd*|dragonfly*|midnightbsd*) 2261 # 5.x headers associate 2262 # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L 2263 # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L 2264 cf_POSIX_C_SOURCE=200112L 2265 cf_XOPEN_SOURCE=600 2266 cf_xopen_source="-D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" 2267 ;; 2268(hpux11*) 2269 cf_xopen_source="-D_HPUX_SOURCE -D_XOPEN_SOURCE=500" 2270 ;; 2271(hpux*) 2272 cf_xopen_source="-D_HPUX_SOURCE" 2273 ;; 2274(irix[[56]].*) 2275 cf_xopen_source="-D_SGI_SOURCE" 2276 cf_XOPEN_SOURCE= 2277 ;; 2278(linux*|uclinux*|gnu*|mint*|k*bsd*-gnu|cygwin) 2279 CF_GNU_SOURCE($cf_XOPEN_SOURCE) 2280 ;; 2281(minix*) 2282 cf_xopen_source="-D_NETBSD_SOURCE" # POSIX.1-2001 features are ifdef'd with this... 2283 ;; 2284(mirbsd*) 2285 # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <sys/select.h> and other headers which use u_int / u_short types 2286 cf_XOPEN_SOURCE= 2287 CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE) 2288 ;; 2289(netbsd*) 2290 cf_xopen_source="-D_NETBSD_SOURCE" # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw 2291 ;; 2292(openbsd[[4-9]]*) 2293 # setting _XOPEN_SOURCE lower than 500 breaks g++ compile with wchar.h, needed for ncursesw 2294 cf_xopen_source="-D_BSD_SOURCE" 2295 cf_XOPEN_SOURCE=600 2296 ;; 2297(openbsd*) 2298 # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw 2299 ;; 2300(osf[[45]]*) 2301 cf_xopen_source="-D_OSF_SOURCE" 2302 ;; 2303(nto-qnx*) 2304 cf_xopen_source="-D_QNX_SOURCE" 2305 ;; 2306(sco*) 2307 # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer 2308 ;; 2309(solaris2.*) 2310 cf_xopen_source="-D__EXTENSIONS__" 2311 cf_cv_xopen_source=broken 2312 ;; 2313(sysv4.2uw2.*) # Novell/SCO UnixWare 2.x (tested on 2.1.2) 2314 cf_XOPEN_SOURCE= 2315 cf_POSIX_C_SOURCE= 2316 ;; 2317(*) 2318 CF_TRY_XOPEN_SOURCE 2319 CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE) 2320 ;; 2321esac 2322 2323if test -n "$cf_xopen_source" ; then 2324 CF_ADD_CFLAGS($cf_xopen_source,true) 2325fi 2326 2327dnl In anything but the default case, we may have system-specific setting 2328dnl which is still not guaranteed to provide all of the entrypoints that 2329dnl _XOPEN_SOURCE would yield. 2330if test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then 2331 AC_MSG_CHECKING(if _XOPEN_SOURCE really is set) 2332 AC_TRY_COMPILE([#include <stdlib.h>],[ 2333#ifndef _XOPEN_SOURCE 2334make an error 2335#endif], 2336 [cf_XOPEN_SOURCE_set=yes], 2337 [cf_XOPEN_SOURCE_set=no]) 2338 AC_MSG_RESULT($cf_XOPEN_SOURCE_set) 2339 if test $cf_XOPEN_SOURCE_set = yes 2340 then 2341 AC_TRY_COMPILE([#include <stdlib.h>],[ 2342#if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE 2343make an error 2344#endif], 2345 [cf_XOPEN_SOURCE_set_ok=yes], 2346 [cf_XOPEN_SOURCE_set_ok=no]) 2347 if test $cf_XOPEN_SOURCE_set_ok = no 2348 then 2349 AC_MSG_WARN(_XOPEN_SOURCE is lower than requested) 2350 fi 2351 else 2352 CF_TRY_XOPEN_SOURCE 2353 fi 2354fi 2355fi # cf_cv_posix_visible 2356]) 2357