1dnl Project : tin - a Usenet reader 2dnl Module : aclocal.m4 3dnl Author : Thomas E. Dickey <dickey@invisible-island.net> 4dnl Created : 1995-08-24 5dnl Updated : 2020-11-30 6dnl Notes : 7dnl 8dnl Copyright (c) 1995-2020 Thomas E. Dickey <dickey@invisible-island.net> 9dnl All rights reserved. 10dnl 11dnl Redistribution and use in source and binary forms, with or without 12dnl modification, are permitted provided that the following conditions 13dnl are met: 14dnl 1. Redistributions of source code must retain the above copyright 15dnl notice, this list of conditions and the following disclaimer. 16dnl 2. Redistributions in binary form must reproduce the above copyright 17dnl notice, this list of conditions and the following disclaimer in the 18dnl documentation and/or other materials provided with the distribution. 19dnl 3. The name of the author may not be used to endorse or promote 20dnl products derived from this software without specific prior written 21dnl permission. 22dnl 23dnl THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 24dnl OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25dnl WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26dnl ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 27dnl DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28dnl DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 29dnl GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30dnl INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 31dnl WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 32dnl NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 33dnl SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34dnl 35dnl 36dnl Macros used in TIN auto-configuration script. 37dnl https://invisible-island.net/autoconf/ 38dnl 39dnl --------------------------------------------------------------------------- 40dnl --------------------------------------------------------------------------- 41dnl AC_ISC_POSIX version: 2 updated: 2002/04/17 21:09:56 42dnl ------------ 43dnl Inserted as requested by gettext 0.10.40 44dnl File from /usr/share/aclocal 45dnl isc-posix.m4 46dnl ==================== 47#serial 1 48# This test replaces the one in autoconf. 49# Currently this macro should have the same name as the autoconf macro 50# because gettext's gettext.m4 (distributed in the automake package) 51# still uses it. Otherwise, the use in gettext.m4 makes autoheader 52# give these diagnostics: 53# configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX 54# configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX 55 56undefine([AC_ISC_POSIX]) 57 58AC_DEFUN([AC_ISC_POSIX], 59 [ 60 dnl This test replaces the obsolescent AC_ISC_POSIX kludge. 61 AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"]) 62 ] 63) 64dnl --------------------------------------------------------------------------- 65dnl AM_GNU_GETTEXT version: 14 updated: 2015/04/15 19:08:48 66dnl -------------- 67dnl Usage: Just like AM_WITH_NLS, which see. 68AC_DEFUN([AM_GNU_GETTEXT], 69 [AC_REQUIRE([AC_PROG_MAKE_SET])dnl 70 AC_REQUIRE([AC_CANONICAL_HOST])dnl 71 AC_REQUIRE([AC_PROG_RANLIB])dnl 72 AC_REQUIRE([AC_HEADER_STDC])dnl 73 AC_REQUIRE([AC_C_INLINE])dnl 74 AC_REQUIRE([AC_TYPE_OFF_T])dnl 75 AC_REQUIRE([AC_TYPE_SIZE_T])dnl 76 AC_REQUIRE([AC_FUNC_ALLOCA])dnl 77 AC_REQUIRE([AC_FUNC_MMAP])dnl 78 AC_REQUIRE([jm_GLIBC21])dnl 79 AC_REQUIRE([CF_PROG_CC])dnl 80 81 AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \ 82stdlib.h string.h unistd.h sys/param.h]) 83 AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getcwd getegid geteuid \ 84getgid getuid mempcpy munmap putenv setenv setlocale stpcpy strchr strcasecmp \ 85strdup strtoul tsearch __argz_count __argz_stringify __argz_next]) 86 87 AM_ICONV 88 AM_LANGINFO_CODESET 89 AM_LC_MESSAGES 90 AM_WITH_NLS([$1],[$2],[$3],[$4]) 91 92 if test "x$CATOBJEXT" != "x"; then 93 if test "x$ALL_LINGUAS" = "x"; then 94 LINGUAS= 95 else 96 AC_MSG_CHECKING(for catalogs to be installed) 97 NEW_LINGUAS= 98 for presentlang in $ALL_LINGUAS; do 99 useit=no 100 for desiredlang in ${LINGUAS-$ALL_LINGUAS}; do 101 # Use the presentlang catalog if desiredlang is 102 # a. equal to presentlang, or 103 # b. a variant of presentlang (because in this case, 104 # presentlang can be used as a fallback for messages 105 # which are not translated in the desiredlang catalog). 106 case "$desiredlang" in 107 "$presentlang"*) useit=yes;; 108 esac 109 done 110 if test $useit = yes; then 111 NEW_LINGUAS="$NEW_LINGUAS $presentlang" 112 fi 113 done 114 LINGUAS=$NEW_LINGUAS 115 AC_MSG_RESULT($LINGUAS) 116 fi 117 118 dnl Construct list of names of catalog files to be constructed. 119 if test -n "$LINGUAS"; then 120 for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done 121 fi 122 fi 123 124 dnl Enable libtool support if the surrounding package wishes it. 125 INTL_LIBTOOL_SUFFIX_PREFIX=ifelse([$1], use-libtool, [l], []) 126 AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX) 127])dnl 128dnl --------------------------------------------------------------------------- 129dnl AM_ICONV version: 12 updated: 2007/07/30 19:12:03 130dnl -------- 131dnl Inserted as requested by gettext 0.10.40 132dnl File from /usr/share/aclocal 133dnl iconv.m4 134dnl ==================== 135dnl serial AM2 136dnl 137dnl From Bruno Haible. 138dnl 139dnl ==================== 140dnl Modified to use CF_FIND_LINKAGE and CF_ADD_SEARCHPATH, to broaden the 141dnl range of locations searched. Retain the same cache-variable naming to 142dnl allow reuse with the other gettext macros -Thomas E Dickey 143AC_DEFUN([AM_ICONV], 144[ 145 dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and 146 dnl those with the standalone portable GNU libiconv installed). 147 148 AC_ARG_WITH([libiconv-prefix], 149[ --with-libiconv-prefix=DIR 150 search for libiconv in DIR/include and DIR/lib], [ 151 CF_ADD_OPTIONAL_PATH($withval, libiconv) 152 ]) 153 154 AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [ 155 CF_FIND_LINKAGE(CF__ICONV_HEAD, 156 CF__ICONV_BODY, 157 iconv, 158 am_cv_func_iconv=yes, 159 am_cv_func_iconv=["no, consider installing GNU libiconv"])]) 160 161 if test "$am_cv_func_iconv" = yes; then 162 AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.]) 163 164 AC_CACHE_CHECK([if the declaration of iconv() needs const.], 165 am_cv_proto_iconv_const,[ 166 AC_TRY_COMPILE(CF__ICONV_HEAD [ 167extern 168#ifdef __cplusplus 169"C" 170#endif 171#if defined(__STDC__) || defined(__cplusplus) 172size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); 173#else 174size_t iconv(); 175#endif 176],[], am_cv_proto_iconv_const=no, 177 am_cv_proto_iconv_const=yes)]) 178 179 if test "$am_cv_proto_iconv_const" = yes ; then 180 am_cv_proto_iconv_arg1="const" 181 else 182 am_cv_proto_iconv_arg1="" 183 fi 184 185 AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1, 186 [Define as const if the declaration of iconv() needs const.]) 187 fi 188 189 LIBICONV= 190 if test "$cf_cv_find_linkage_iconv" = yes; then 191 CF_ADD_INCDIR($cf_cv_header_path_iconv) 192 if test -n "$cf_cv_library_file_iconv" ; then 193 LIBICONV="-liconv" 194 CF_ADD_LIBDIR($cf_cv_library_path_iconv) 195 fi 196 fi 197 198 AC_SUBST(LIBICONV) 199])dnl 200dnl --------------------------------------------------------------------------- 201dnl AM_LANGINFO_CODESET version: 5 updated: 2020/03/10 18:53:47 202dnl ------------------- 203dnl Inserted as requested by gettext 0.10.40 204dnl File from /usr/share/aclocal 205dnl codeset.m4 206dnl ==================== 207dnl serial AM1 208dnl 209dnl From Bruno Haible. 210AC_DEFUN([AM_LANGINFO_CODESET], 211[ 212AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset, 213 [AC_TRY_LINK([#include <langinfo.h>], 214 [char* cs = nl_langinfo(CODESET); (void)cs], 215 am_cv_langinfo_codeset=yes, 216 am_cv_langinfo_codeset=no) 217 ]) 218 if test $am_cv_langinfo_codeset = yes; then 219 AC_DEFINE(HAVE_LANGINFO_CODESET, 1, 220 [Define if you have <langinfo.h> and nl_langinfo(CODESET).]) 221 fi 222])dnl 223dnl --------------------------------------------------------------------------- 224dnl AM_LC_MESSAGES version: 5 updated: 2015/05/10 19:52:14 225dnl -------------- 226dnl Inserted as requested by gettext 0.10.40 227dnl File from /usr/share/aclocal 228dnl lcmessage.m4 229dnl ==================== 230dnl Check whether LC_MESSAGES is available in <locale.h>. 231dnl Ulrich Drepper <drepper@cygnus.com>, 1995. 232dnl 233dnl This file can be copied and used freely without restrictions. It can 234dnl be used in projects which are not available under the GNU General Public 235dnl License or the GNU Library General Public License but which still want 236dnl to provide support for the GNU gettext functionality. 237dnl Please note that the actual code of the GNU gettext library is covered 238dnl by the GNU Library General Public License, and the rest of the GNU 239dnl gettext package package is covered by the GNU General Public License. 240dnl They are *not* in the public domain. 241dnl 242dnl serial 2 243dnl 244AC_DEFUN([AM_LC_MESSAGES], 245[if test $ac_cv_header_locale_h = yes; then 246 AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES, 247 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES], 248 am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)]) 249 if test $am_cv_val_LC_MESSAGES = yes; then 250 AC_DEFINE(HAVE_LC_MESSAGES, 1, 251 [Define if your <locale.h> file defines LC_MESSAGES.]) 252 fi 253fi])dnl 254dnl --------------------------------------------------------------------------- 255dnl AM_MULTIBYTE_ABLE version: 10 updated: 2019/12/31 20:39:42 256dnl ----------------- 257dnl 258dnl check for required multibyte/widechar functions 259dnl Urs Janssen <urs@tin.org> 20021006 260dnl Usage: AM_MULTIBYTE_ABLE 261AC_DEFUN([AM_MULTIBYTE_ABLE], 262[ 263 AC_CACHE_CHECK([for wide char and multibyte support], am_cv_multibyte_able, 264 [AC_TRY_LINK([#include <stdio.h> 265#ifdef HAVE_STDLIB_H 266# include <stdlib.h> 267#endif /* HAVE_STDLIB_H */ 268#ifdef HAVE_WCHAR_H 269# include <wchar.h> 270#endif /* HAVE_WCHAR_H */ 271#ifdef HAVE_WCTYPE_H 272# include <wctype.h> 273#endif /* HAVE_WCTYPE_H */ 274], 275 [const char icb[5] = {0xa4, 0xa4, 0xa4, 0xe5, 0x00}; 276 char ocb[5]; 277 wchar_t wcb[5]; 278 wchar_t wcb2[5]; 279 wchar_t format[3]; 280 281 putwc(0, 0); 282 fputwc(0, 0); 283 fwide(0, 0); 284 mbtowc(wcb, icb, MB_CUR_MAX); 285 mbstowcs(wcb, icb, 5); 286 (void) iswalnum((wint_t) wcb[0]); 287 (void) iswcntrl((wint_t) wcb[0]); 288 (void) iswdigit((wint_t) wcb[0]); 289 (void) iswgraph((wint_t) wcb[0]); 290 (void) iswprint((wint_t) wcb[0]); 291 (void) iswspace((wint_t) wcb[0]); 292 (void) towupper((wint_t) wcb[0]); 293 /* (void) iswupper((wint_t) wcb[0]); */ 294 /* (void) towlower((wint_t) wcb[0]); */ 295 /* (void) iswlower((wint_t) wcb[0]); */ 296 (void) iswalpha((wint_t) wcb[0]); 297 /* (void) iswblank((wint_t) wcb[0]); */ 298 /* (void) iswpunct((wint_t) wcb[0]); */ 299 /* (void) iswxdigit((wint_t) wcb[0]); */ 300 /* (void) iswctype((wint_t) wcb[0], wctype("print")); */ 301 /* (void) towctranse((wint_t) wcb[0], wctrans("toupper")); */ 302 (void) wcslen(wcb); 303 /* (void) wcsnlen(wcb, 4); */ 304 wcwidth((wint_t) wcb[0]); 305 wcswidth(wcb, 5); 306 wcstombs(ocb, wcb, 5); 307 wctomb(ocb, wcb[0]); 308 wcscat(wcb2, wcb); 309 wcscpy(wcb2, wcb); 310 mbstowcs(format, "%s", 2); 311 swprintf(wcb, 5, format, "test"); 312 wcsncat(wcb2, wcb, 5);], 313 am_cv_multibyte_able=yes, 314 [cf_save_LIBS="$LIBS" 315 LIBS="-lutf8 $LIBS" 316 AC_TRY_LINK([#include <libutf8.h>], 317 [const char icb[5] = {0xa4, 0xa4, 0xa4, 0xe5, 0x00}; 318 char ocb[5]; 319 wchar_t wcb[5]; 320 wchar_t wcb2[5]; 321 wchar_t format[3]; 322 323 putwc(0, 0); 324 fputwc(0, 0); 325 fwide(0, 0); 326 mbtowc(wcb, icb, MB_CUR_MAX); 327 mbstowcs(wcb, icb, 5); 328 (void) iswalnum((wint_t) wcb[0]); 329 (void) iswcntrl((wint_t) wcb[0]); 330 (void) iswdigit((wint_t) wcb[0]); 331 (void) iswgraph((wint_t) wcb[0]); 332 (void) iswprint((wint_t) wcb[0]); 333 (void) iswspace((wint_t) wcb[0]); 334 (void) towupper((wint_t) wcb[0]); 335 /* (void) iswupper((wint_t) wcb[0]); */ 336 /* (void) towlower((wint_t) wcb[0]); */ 337 /* (void) iswlower((wint_t) wcb[0]); */ 338 (void) iswalpha((wint_t) wcb[0]); 339 /* (void) iswblank((wint_t) wcb[0]); */ 340 /* (void) iswpunct((wint_t) wcb[0]); */ 341 /* (void) iswxdigit((wint_t) wcb[0]); */ 342 /* (void) iswctype((wint_t) wcb[0], wctype("print")); */ 343 /* (void) towctranse((wint_t) wcb[0], wctrans("toupper")); */ 344 (void) wcslen(wcb); 345 /* (void) wcsnlen(wcb, 4); */ 346 wcwidth((wint_t) wcb[0]); 347 wcswidth(wcb, 5); 348 wcstombs(ocb, wcb, 5); 349 wctomb(ocb, wcb[0]); 350 wcscat(wcb2, wcb); 351 wcscpy(wcb2, wcb); 352 mbstowcs(format, "%s", 2); 353 swprintf(wcb, 5, format, "test"); 354 wcsncat(wcb2, wcb, 5);], 355 [am_cv_multibyte_able=libutf8], 356 [am_cv_multibyte_able=no]) 357 LIBS="$cf_save_LIBS" 358 ]) 359 ]) 360 if test "$am_cv_multibyte_able" != no; then 361 if test "$am_cv_multibyte_able" = libutf8; then 362 AC_DEFINE(HAVE_LIBUTF8_H,1,[Define this to 1 if we have header libutf8.h]) 363 LIBS="-lutf8 $LIBS" 364 fi 365 AC_DEFINE(MULTIBYTE_ABLE, 1, 366 [Define if you have swprintf() and co.]) 367 fi 368]) 369dnl --------------------------------------------------------------------------- 370dnl AM_PATH_PROG_WITH_TEST version: 9 updated: 2015/04/15 19:08:48 371dnl ---------------------- 372dnl Inserted as requested by gettext 0.10.40 373dnl File from /usr/share/aclocal 374dnl progtest.m4 375dnl ==================== 376dnl Search path for a program which passes the given test. 377dnl Ulrich Drepper <drepper@cygnus.com>, 1996. 378dnl 379dnl This file can be copied and used freely without restrictions. It can 380dnl be used in projects which are not available under the GNU General Public 381dnl License or the GNU Library General Public License but which still want 382dnl to provide support for the GNU gettext functionality. 383dnl Please note that the actual code of the GNU gettext library is covered 384dnl by the GNU Library General Public License, and the rest of the GNU 385dnl gettext package package is covered by the GNU General Public License. 386dnl They are *not* in the public domain. 387dnl 388dnl serial 2 389dnl 390dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, 391dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) 392AC_DEFUN([AM_PATH_PROG_WITH_TEST], 393[# Extract the first word of "$2", so it can be a program name with args. 394AC_REQUIRE([CF_PATHSEP]) 395set dummy $2; ac_word=[$]2 396AC_MSG_CHECKING([for $ac_word]) 397AC_CACHE_VAL(ac_cv_path_$1, 398[case "[$]$1" in 399 [[\\/]*|?:[\\/]]*) 400 ac_cv_path_$1="[$]$1" # Let the user override the test with a path. 401 ;; 402 *) 403 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" 404 for ac_dir in ifelse([$5], , $PATH, [$5]); do 405 test -z "$ac_dir" && ac_dir=. 406 if test -f $ac_dir/$ac_word$ac_exeext; then 407 if [$3]; then 408 ac_cv_path_$1="$ac_dir/$ac_word$ac_exeext" 409 break 410 fi 411 fi 412 done 413 IFS="$ac_save_ifs" 414dnl If no 4th arg is given, leave the cache variable unset, 415dnl so AC_PATH_PROGS will keep looking. 416ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" 417])dnl 418 ;; 419esac])dnl 420$1="$ac_cv_path_$1" 421if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then 422 AC_MSG_RESULT([$]$1) 423else 424 AC_MSG_RESULT(no) 425fi 426AC_SUBST($1)dnl 427])dnl 428dnl --------------------------------------------------------------------------- 429dnl AM_WITH_NLS version: 29 updated: 2018/02/21 21:26:03 430dnl ----------- 431dnl Inserted as requested by gettext 0.10.40 432dnl File from /usr/share/aclocal 433dnl gettext.m4 434dnl ==================== 435dnl Macro to add for using GNU gettext. 436dnl Ulrich Drepper <drepper@cygnus.com>, 1995. 437dnl ==================== 438dnl Modified to use CF_FIND_LINKAGE and CF_ADD_SEARCHPATH, to broaden the 439dnl range of locations searched. Retain the same cache-variable naming to 440dnl allow reuse with the other gettext macros -Thomas E Dickey 441dnl ==================== 442dnl 443dnl This file can be copied and used freely without restrictions. It can 444dnl be used in projects which are not available under the GNU General Public 445dnl License or the GNU Library General Public License but which still want 446dnl to provide support for the GNU gettext functionality. 447dnl Please note that the actual code of the GNU gettext library is covered 448dnl by the GNU Library General Public License, and the rest of the GNU 449dnl gettext package package is covered by the GNU General Public License. 450dnl They are *not* in the public domain. 451dnl 452dnl serial 10 453dnl 454dnl Usage: AM_WITH_NLS([TOOLSYMBOL], [NEEDSYMBOL], [LIBDIR], [ENABLED]). 455dnl If TOOLSYMBOL is specified and is 'use-libtool', then a libtool library 456dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static, 457dnl depending on --{enable,disable}-{shared,static} and on the presence of 458dnl AM-DISABLE-SHARED). Otherwise, a static library 459dnl $(top_builddir)/intl/libintl.a will be created. 460dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext 461dnl implementations (in libc or libintl) without the ngettext() function 462dnl will be ignored. 463dnl LIBDIR is used to find the intl libraries. If empty, 464dnl the value `$(top_builddir)/intl/' is used. 465dnl ENABLED is used to control the default for the related --enable-nls, since 466dnl not all application developers want this feature by default, e.g., lynx. 467dnl 468dnl The result of the configuration is one of three cases: 469dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled 470dnl and used. 471dnl Catalog format: GNU --> install in $(datadir) 472dnl Catalog extension: .mo after installation, .gmo in source tree 473dnl 2) GNU gettext has been found in the system's C library. 474dnl Catalog format: GNU --> install in $(datadir) 475dnl Catalog extension: .mo after installation, .gmo in source tree 476dnl 3) No internationalization, always use English msgid. 477dnl Catalog format: none 478dnl Catalog extension: none 479dnl The use of .gmo is historical (it was needed to avoid overwriting the 480dnl GNU format catalogs when building on a platform with an X/Open gettext), 481dnl but we keep it in order not to force irrelevant filename changes on the 482dnl maintainers. 483dnl 484AC_DEFUN([AM_WITH_NLS], 485[AC_MSG_CHECKING([whether NLS is requested]) 486 dnl Default is enabled NLS 487 ifelse([$4],,[ 488 AC_ARG_ENABLE(nls, 489 [ --disable-nls do not use Native Language Support], 490 USE_NLS=$enableval, USE_NLS=yes)],[ 491 AC_ARG_ENABLE(nls, 492 [ --enable-nls use Native Language Support], 493 USE_NLS=$enableval, USE_NLS=no)]) 494 AC_MSG_RESULT($USE_NLS) 495 AC_SUBST(USE_NLS) 496 497 BUILD_INCLUDED_LIBINTL=no 498 USE_INCLUDED_LIBINTL=no 499 INTLLIBS= 500 501 dnl If we use NLS figure out what method 502 if test "$USE_NLS" = "yes"; then 503 dnl We need to process the po/ directory. 504 POSUB=po 505 AC_DEFINE(ENABLE_NLS, 1, 506 [Define to 1 if translation of program messages to the user's native language 507 is requested.]) 508 AC_MSG_CHECKING([whether included gettext is requested]) 509 AC_ARG_WITH(included-gettext, 510 [ --with-included-gettext use the GNU gettext library included here], 511 nls_cv_force_use_gnu_gettext=$withval, 512 nls_cv_force_use_gnu_gettext=no) 513 AC_MSG_RESULT($nls_cv_force_use_gnu_gettext) 514 515 nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" 516 if test "$nls_cv_force_use_gnu_gettext" != "yes"; then 517 dnl User does not insist on using GNU NLS library. Figure out what 518 dnl to use. If GNU gettext is available we use this. Else we may have 519 dnl to fall back to GNU NLS library. 520 CATOBJEXT=NONE 521 522 dnl Save these (possibly-set) variables for reference. If the user 523 dnl overrode these to provide full pathnames, then warn if not actually 524 dnl GNU gettext, but do not override their values. Also, if they were 525 dnl overridden, suppress the part of the library test which prevents it 526 dnl from finding anything other than GNU gettext. Doing this also 527 dnl suppresses a bogus search for the intl library. 528 cf_save_msgfmt_path="$MSGFMT" 529 cf_save_xgettext_path="$XGETTEXT" 530 531 dnl Search for GNU msgfmt in the PATH. 532 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, 533 [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :) 534 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) 535 AC_SUBST(MSGFMT) 536 537 dnl Search for GNU xgettext in the PATH. 538 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, 539 [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :) 540 541 cf_save_OPTS_1="$CPPFLAGS" 542 if test "x$cf_save_msgfmt_path" = "x$MSGFMT" && \ 543 test "x$cf_save_xgettext_path" = "x$XGETTEXT" ; then 544 CF_ADD_CFLAGS(-DIGNORE_MSGFMT_HACK) 545 fi 546 547 cf_save_LIBS_1="$LIBS" 548 CF_ADD_LIBS($LIBICONV) 549 550 CF_FIND_LINKAGE(CF__INTL_HEAD, 551 CF__INTL_BODY($2), 552 intl, 553 cf_cv_func_gettext=yes, 554 cf_cv_func_gettext=no) 555 556 AC_MSG_CHECKING([for libintl.h and gettext()]) 557 AC_MSG_RESULT($cf_cv_func_gettext) 558 559 LIBS="$cf_save_LIBS_1" 560 CPPFLAGS="$cf_save_OPTS_1" 561 562 if test "$cf_cv_func_gettext" = yes ; then 563 AC_DEFINE(HAVE_LIBINTL_H,1,[Define to 1 if we have libintl.h]) 564 565 dnl If an already present or preinstalled GNU gettext() is found, 566 dnl use it. But if this macro is used in GNU gettext, and GNU 567 dnl gettext is already preinstalled in libintl, we update this 568 dnl libintl. (Cf. the install rule in intl/Makefile.in.) 569 if test "$PACKAGE" != gettext; then 570 AC_DEFINE(HAVE_GETTEXT, 1, 571 [Define if the GNU gettext() function is already present or preinstalled.]) 572 573 CF_ADD_INCDIR($cf_cv_header_path_intl) 574 575 if test -n "$cf_cv_library_file_intl" ; then 576 dnl If iconv() is in a separate libiconv library, then anyone 577 dnl linking with libintl{.a,.so} also needs to link with 578 dnl libiconv. 579 INTLLIBS="$cf_cv_library_file_intl $LIBICONV" 580 CF_ADD_LIBDIR($cf_cv_library_path_intl,INTLLIBS) 581 fi 582 583 gt_save_LIBS="$LIBS" 584 LIBS="$LIBS $INTLLIBS" 585 AC_CHECK_FUNCS(dcgettext) 586 LIBS="$gt_save_LIBS" 587 588 CATOBJEXT=.gmo 589 fi 590 elif test -z "$MSGFMT" || test -z "$XGETTEXT" ; then 591 AC_MSG_WARN(disabling NLS feature) 592 sed -e /ENABLE_NLS/d confdefs.h >confdefs.tmp 593 mv confdefs.tmp confdefs.h 594 ALL_LINGUAS= 595 CATOBJEXT=.ignored 596 MSGFMT=":" 597 GMSGFMT=":" 598 XGETTEXT=":" 599 POSUB= 600 BUILD_INCLUDED_LIBINTL=no 601 USE_INCLUDED_LIBINTL=no 602 USE_NLS=no 603 nls_cv_use_gnu_gettext=no 604 fi 605 606 if test "$CATOBJEXT" = "NONE"; then 607 dnl GNU gettext is not found in the C library. 608 dnl Fall back on GNU gettext library. 609 nls_cv_use_gnu_gettext=maybe 610 fi 611 fi 612 613 if test "$nls_cv_use_gnu_gettext" != "no"; then 614 CATOBJEXT=.gmo 615 if test -f $srcdir/intl/libintl.h ; then 616 dnl Mark actions used to generate GNU NLS library. 617 INTLOBJS="\$(GETTOBJS)" 618 BUILD_INCLUDED_LIBINTL=yes 619 USE_INCLUDED_LIBINTL=yes 620 INTLLIBS="ifelse([$3],[],\$(top_builddir)/intl,[$3])/libintl.ifelse([$1], use-libtool, [l], [])a $LIBICONV" 621 LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` 622 elif test "$nls_cv_use_gnu_gettext" = "yes"; then 623 nls_cv_use_gnu_gettext=no 624 AC_MSG_WARN(no NLS library is packaged with this application) 625 fi 626 fi 627 628 dnl Test whether we really found GNU msgfmt. 629 if test "$GMSGFMT" != ":"; then 630 if $GMSGFMT --statistics /dev/null >/dev/null 2>&1; then 631 : ; 632 else 633 AC_MSG_WARN([found msgfmt program is not GNU msgfmt]) 634 fi 635 fi 636 637 dnl Test whether we really found GNU xgettext. 638 if test "$XGETTEXT" != ":"; then 639 if $XGETTEXT --omit-header /dev/null >/dev/null 2>&1; then 640 : ; 641 else 642 AC_MSG_WARN([found xgettext program is not GNU xgettext]) 643 fi 644 fi 645 fi 646 647 if test "$XGETTEXT" != ":"; then 648 AC_OUTPUT_COMMANDS( 649 [for ac_file in $CONFIG_FILES; do 650 651 # Support "outfile[:infile[:infile...]]" 652 case "$ac_file" in 653 *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; 654 esac 655 656 # PO directories have a Makefile.in generated from Makefile.inn. 657 case "$ac_file" in 658 */[Mm]akefile.in) 659 # Adjust a relative srcdir. 660 ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` 661 ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" 662 ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` 663 ac_base=`basename $ac_file .in` 664 # In autoconf-2.13 it is called $ac_given_srcdir. 665 # In autoconf-2.50 it is called $srcdir. 666 test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" 667 668 case "$ac_given_srcdir" in 669 .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; 670 /*) top_srcdir="$ac_given_srcdir" ;; 671 *) top_srcdir="$ac_dots$ac_given_srcdir" ;; 672 esac 673 674 if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then 675 rm -f "$ac_dir/POTFILES" 676 test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" 677 sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," -e "\$s/\(.*\) \\\\/\1/" < "$ac_given_srcdir/$ac_dir/POTFILES.in" > "$ac_dir/POTFILES" 678 test -n "$as_me" && echo "$as_me: creating $ac_dir/$ac_base" || echo "creating $ac_dir/$ac_base" 679 sed -e "/POTFILES =/r $ac_dir/POTFILES" "$ac_dir/$ac_base.in" > "$ac_dir/$ac_base" 680 fi 681 ;; 682 esac 683 done]) 684 685 dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL 686 dnl to 'yes' because some of the testsuite requires it. 687 if test "$PACKAGE" = gettext; then 688 BUILD_INCLUDED_LIBINTL=yes 689 fi 690 691 dnl intl/plural.c is generated from intl/plural.y. It requires bison, 692 dnl because plural.y uses bison specific features. It requires at least 693 dnl bison-1.26 because earlier versions generate a plural.c that doesn't 694 dnl compile. 695 dnl bison is only needed for the maintainer (who touches plural.y). But in 696 dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put 697 dnl the rule in general Makefile. Now, some people carelessly touch the 698 dnl files or have a broken "make" program, hence the plural.c rule will 699 dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not 700 dnl present or too old. 701 if test "$nls_cv_use_gnu_gettext" = "yes"; then 702 AC_CHECK_PROGS([INTLBISON], [bison]) 703 if test -z "$INTLBISON"; then 704 ac_verc_fail=yes 705 else 706 dnl Found it, now check the version. 707 AC_MSG_CHECKING([version of bison]) 708changequote(<<,>>)dnl 709 ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'` 710 case $ac_prog_version in 711 '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; 712 1.2[6-9]*|1.[3-9][0-9]*|[2-9].*) 713changequote([,])dnl 714 ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; 715 *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; 716 esac 717 AC_MSG_RESULT([$ac_prog_version]) 718 fi 719 if test $ac_verc_fail = yes; then 720 INTLBISON=: 721 fi 722 fi 723 724 dnl These rules are solely for the distribution goal. While doing this 725 dnl we only have to keep exactly one list of the available catalogs 726 dnl in configure.in. 727 for lang in $ALL_LINGUAS; do 728 GMOFILES="$GMOFILES $lang.gmo" 729 POFILES="$POFILES $lang.po" 730 done 731 fi 732 733 dnl Make all variables we use known to autoconf. 734 AC_SUBST(BUILD_INCLUDED_LIBINTL) 735 AC_SUBST(USE_INCLUDED_LIBINTL) 736 AC_SUBST(CATALOGS) 737 AC_SUBST(CATOBJEXT) 738 AC_SUBST(GMOFILES) 739 AC_SUBST(INTLLIBS) 740 AC_SUBST(INTLOBJS) 741 AC_SUBST(POFILES) 742 AC_SUBST(POSUB) 743 744 dnl For backward compatibility. Some configure.ins may be using this. 745 nls_cv_header_intl= 746 nls_cv_header_libgt= 747 748 dnl For backward compatibility. Some Makefiles may be using this. 749 DATADIRNAME=share 750 AC_SUBST(DATADIRNAME) 751 752 dnl For backward compatibility. Some Makefiles may be using this. 753 INSTOBJEXT=.mo 754 AC_SUBST(INSTOBJEXT) 755 756 dnl For backward compatibility. Some Makefiles may be using this. 757 GENCAT=gencat 758 AC_SUBST(GENCAT) 759])dnl 760dnl --------------------------------------------------------------------------- 761dnl CF_ACVERSION_CHECK version: 5 updated: 2014/06/04 19:11:49 762dnl ------------------ 763dnl Conditionally generate script according to whether we're using a given autoconf. 764dnl 765dnl $1 = version to compare against 766dnl $2 = code to use if AC_ACVERSION is at least as high as $1. 767dnl $3 = code to use if AC_ACVERSION is older than $1. 768define([CF_ACVERSION_CHECK], 769[ 770ifdef([AC_ACVERSION], ,[ifdef([AC_AUTOCONF_VERSION],[m4_copy([AC_AUTOCONF_VERSION],[AC_ACVERSION])],[m4_copy([m4_PACKAGE_VERSION],[AC_ACVERSION])])])dnl 771ifdef([m4_version_compare], 772[m4_if(m4_version_compare(m4_defn([AC_ACVERSION]), [$1]), -1, [$3], [$2])], 773[CF_ACVERSION_COMPARE( 774AC_PREREQ_CANON(AC_PREREQ_SPLIT([$1])), 775AC_PREREQ_CANON(AC_PREREQ_SPLIT(AC_ACVERSION)), AC_ACVERSION, [$2], [$3])])])dnl 776dnl --------------------------------------------------------------------------- 777dnl CF_ACVERSION_COMPARE version: 3 updated: 2012/10/03 18:39:53 778dnl -------------------- 779dnl CF_ACVERSION_COMPARE(MAJOR1, MINOR1, TERNARY1, 780dnl MAJOR2, MINOR2, TERNARY2, 781dnl PRINTABLE2, not FOUND, FOUND) 782define([CF_ACVERSION_COMPARE], 783[ifelse(builtin([eval], [$2 < $5]), 1, 784[ifelse([$8], , ,[$8])], 785[ifelse([$9], , ,[$9])])])dnl 786dnl --------------------------------------------------------------------------- 787dnl CF_ADD_CFLAGS version: 14 updated: 2020/04/04 16:16:13 788dnl ------------- 789dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS 790dnl $1 = flags to add 791dnl $2 = if given makes this macro verbose. 792dnl 793dnl Put any preprocessor definitions that use quoted strings in $EXTRA_CPPFLAGS, 794dnl to simplify use of $CPPFLAGS in compiler checks, etc., that are easily 795dnl confused by the quotes (which require backslashes to keep them usable). 796AC_DEFUN([CF_ADD_CFLAGS], 797[ 798cf_fix_cppflags=no 799cf_new_cflags= 800cf_new_cppflags= 801cf_new_extra_cppflags= 802 803for cf_add_cflags in $1 804do 805case $cf_fix_cppflags in 806no) 807 case $cf_add_cflags in 808 -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) 809 case $cf_add_cflags in 810 -D*) 811 cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[[^=]]*='\''\"[[^"]]*//'` 812 813 test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ 814 && test -z "${cf_tst_cflags}" \ 815 && cf_fix_cppflags=yes 816 817 if test $cf_fix_cppflags = yes ; then 818 CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags) 819 continue 820 elif test "${cf_tst_cflags}" = "\"'" ; then 821 CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags) 822 continue 823 fi 824 ;; 825 esac 826 case "$CPPFLAGS" in 827 *$cf_add_cflags) 828 ;; 829 *) 830 case $cf_add_cflags in 831 -D*) 832 cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` 833 CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,$cf_tst_cppflags) 834 ;; 835 esac 836 CF_APPEND_TEXT(cf_new_cppflags,$cf_add_cflags) 837 ;; 838 esac 839 ;; 840 *) 841 CF_APPEND_TEXT(cf_new_cflags,$cf_add_cflags) 842 ;; 843 esac 844 ;; 845yes) 846 CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags) 847 848 cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[[^"]]*"'\''//'` 849 850 test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ 851 && test -z "${cf_tst_cflags}" \ 852 && cf_fix_cppflags=no 853 ;; 854esac 855done 856 857if test -n "$cf_new_cflags" ; then 858 ifelse([$2],,,[CF_VERBOSE(add to \$CFLAGS $cf_new_cflags)]) 859 CF_APPEND_TEXT(CFLAGS,$cf_new_cflags) 860fi 861 862if test -n "$cf_new_cppflags" ; then 863 ifelse([$2],,,[CF_VERBOSE(add to \$CPPFLAGS $cf_new_cppflags)]) 864 CF_APPEND_TEXT(CPPFLAGS,$cf_new_cppflags) 865fi 866 867if test -n "$cf_new_extra_cppflags" ; then 868 ifelse([$2],,,[CF_VERBOSE(add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags)]) 869 CF_APPEND_TEXT(EXTRA_CPPFLAGS,$cf_new_extra_cppflags) 870fi 871 872AC_SUBST(EXTRA_CPPFLAGS) 873 874])dnl 875dnl --------------------------------------------------------------------------- 876dnl CF_ADD_INCDIR version: 15 updated: 2018/06/20 20:23:13 877dnl ------------- 878dnl Add an include-directory to $CPPFLAGS. Don't add /usr/include, since it's 879dnl redundant. We don't normally need to add -I/usr/local/include for gcc, 880dnl but old versions (and some misinstalled ones) need that. To make things 881dnl worse, gcc 3.x may give error messages if -I/usr/local/include is added to 882dnl the include-path). 883AC_DEFUN([CF_ADD_INCDIR], 884[ 885if test -n "$1" ; then 886 for cf_add_incdir in $1 887 do 888 while test $cf_add_incdir != /usr/include 889 do 890 if test -d $cf_add_incdir 891 then 892 cf_have_incdir=no 893 if test -n "$CFLAGS$CPPFLAGS" ; then 894 # a loop is needed to ensure we can add subdirs of existing dirs 895 for cf_test_incdir in $CFLAGS $CPPFLAGS ; do 896 if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then 897 cf_have_incdir=yes; break 898 fi 899 done 900 fi 901 902 if test "$cf_have_incdir" = no ; then 903 if test "$cf_add_incdir" = /usr/local/include ; then 904 if test "$GCC" = yes 905 then 906 cf_save_CPPFLAGS=$CPPFLAGS 907 CF_APPEND_TEXT(CPPFLAGS,-I$cf_add_incdir) 908 AC_TRY_COMPILE([#include <stdio.h>], 909 [printf("Hello")], 910 [], 911 [cf_have_incdir=yes]) 912 CPPFLAGS=$cf_save_CPPFLAGS 913 fi 914 fi 915 fi 916 917 if test "$cf_have_incdir" = no ; then 918 CF_VERBOSE(adding $cf_add_incdir to include-path) 919 ifelse([$2],,CPPFLAGS,[$2])="$ifelse([$2],,CPPFLAGS,[$2]) -I$cf_add_incdir" 920 921 cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'` 922 test "$cf_top_incdir" = "$cf_add_incdir" && break 923 cf_add_incdir="$cf_top_incdir" 924 else 925 break 926 fi 927 else 928 break 929 fi 930 done 931 done 932fi 933])dnl 934dnl --------------------------------------------------------------------------- 935dnl CF_ADD_LIB version: 2 updated: 2010/06/02 05:03:05 936dnl ---------- 937dnl Add a library, used to enforce consistency. 938dnl 939dnl $1 = library to add, without the "-l" 940dnl $2 = variable to update (default $LIBS) 941AC_DEFUN([CF_ADD_LIB],[CF_ADD_LIBS(-l$1,ifelse($2,,LIBS,[$2]))])dnl 942dnl --------------------------------------------------------------------------- 943dnl CF_ADD_LIBDIR version: 10 updated: 2015/04/18 08:56:57 944dnl ------------- 945dnl Adds to the library-path 946dnl 947dnl Some machines have trouble with multiple -L options. 948dnl 949dnl $1 is the (list of) directory(s) to add 950dnl $2 is the optional name of the variable to update (default LDFLAGS) 951dnl 952AC_DEFUN([CF_ADD_LIBDIR], 953[ 954if test -n "$1" ; then 955 for cf_add_libdir in $1 956 do 957 if test $cf_add_libdir = /usr/lib ; then 958 : 959 elif test -d $cf_add_libdir 960 then 961 cf_have_libdir=no 962 if test -n "$LDFLAGS$LIBS" ; then 963 # a loop is needed to ensure we can add subdirs of existing dirs 964 for cf_test_libdir in $LDFLAGS $LIBS ; do 965 if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then 966 cf_have_libdir=yes; break 967 fi 968 done 969 fi 970 if test "$cf_have_libdir" = no ; then 971 CF_VERBOSE(adding $cf_add_libdir to library-path) 972 ifelse([$2],,LDFLAGS,[$2])="-L$cf_add_libdir $ifelse([$2],,LDFLAGS,[$2])" 973 fi 974 fi 975 done 976fi 977])dnl 978dnl --------------------------------------------------------------------------- 979dnl CF_ADD_LIBS version: 3 updated: 2019/11/02 16:47:33 980dnl ----------- 981dnl Add one or more libraries, used to enforce consistency. Libraries are 982dnl prepended to an existing list, since their dependencies are assumed to 983dnl already exist in the list. 984dnl 985dnl $1 = libraries to add, with the "-l", etc. 986dnl $2 = variable to update (default $LIBS) 987AC_DEFUN([CF_ADD_LIBS],[ 988cf_add_libs="[$]ifelse($2,,LIBS,[$2])" 989# reverse order 990cf_add_0lib= 991for cf_add_1lib in $1; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done 992# filter duplicates 993for cf_add_1lib in $cf_add_0lib; do 994 for cf_add_2lib in $cf_add_libs; do 995 if test "x$cf_add_1lib" = "x$cf_add_2lib"; then 996 cf_add_1lib= 997 break 998 fi 999 done 1000 test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" 1001done 1002ifelse($2,,LIBS,[$2])="$cf_add_libs" 1003])dnl 1004dnl --------------------------------------------------------------------------- 1005dnl CF_ADD_LIB_AFTER version: 3 updated: 2013/07/09 21:27:22 1006dnl ---------------- 1007dnl Add a given library after another, e.g., following the one it satisfies a 1008dnl dependency for. 1009dnl 1010dnl $1 = the first library 1011dnl $2 = its dependency 1012AC_DEFUN([CF_ADD_LIB_AFTER],[ 1013CF_VERBOSE(...before $LIBS) 1014LIBS=`echo "$LIBS" | sed -e "s/[[ ]][[ ]]*/ /g" -e "s%$1 %$1 $2 %" -e 's% % %g'` 1015CF_VERBOSE(...after $LIBS) 1016])dnl 1017dnl --------------------------------------------------------------------------- 1018dnl CF_ADD_OPTIONAL_PATH version: 3 updated: 2015/05/10 19:52:14 1019dnl -------------------- 1020dnl Add an optional search-path to the compile/link variables. 1021dnl See CF_WITH_PATH 1022dnl 1023dnl $1 = shell variable containing the result of --with-XXX=[DIR] 1024dnl $2 = module to look for. 1025AC_DEFUN([CF_ADD_OPTIONAL_PATH],[ 1026case "$1" in 1027no) 1028 ;; 1029yes) 1030 ;; 1031*) 1032 CF_ADD_SEARCHPATH([$1], [AC_MSG_ERROR(cannot find $2 under $1)]) 1033 ;; 1034esac 1035])dnl 1036dnl --------------------------------------------------------------------------- 1037dnl CF_ADD_SEARCHPATH version: 5 updated: 2009/01/11 20:40:21 1038dnl ----------------- 1039dnl Set $CPPFLAGS and $LDFLAGS with the directories given via the parameter. 1040dnl They can be either the common root of include- and lib-directories, or the 1041dnl lib-directory (to allow for things like lib64 directories). 1042dnl See also CF_FIND_LINKAGE. 1043dnl 1044dnl $1 is the list of colon-separated directory names to search. 1045dnl $2 is the action to take if a parameter does not yield a directory. 1046AC_DEFUN([CF_ADD_SEARCHPATH], 1047[ 1048AC_REQUIRE([CF_PATHSEP]) 1049for cf_searchpath in `echo "$1" | tr $PATH_SEPARATOR ' '`; do 1050 if test -d $cf_searchpath/include; then 1051 CF_ADD_INCDIR($cf_searchpath/include) 1052 elif test -d $cf_searchpath/../include ; then 1053 CF_ADD_INCDIR($cf_searchpath/../include) 1054 ifelse([$2],,,[else 1055$2]) 1056 fi 1057 if test -d $cf_searchpath/lib; then 1058 CF_ADD_LIBDIR($cf_searchpath/lib) 1059 elif test -d $cf_searchpath ; then 1060 CF_ADD_LIBDIR($cf_searchpath) 1061 ifelse([$2],,,[else 1062$2]) 1063 fi 1064done 1065]) 1066dnl --------------------------------------------------------------------------- 1067dnl CF_ADD_SUBDIR_PATH version: 4 updated: 2013/10/08 17:47:05 1068dnl ------------------ 1069dnl Append to a search-list for a nonstandard header/lib-file 1070dnl $1 = the variable to return as result 1071dnl $2 = the package name 1072dnl $3 = the subdirectory, e.g., bin, include or lib 1073dnl $4 = the directory under which we will test for subdirectories 1074dnl $5 = a directory that we do not want $4 to match 1075AC_DEFUN([CF_ADD_SUBDIR_PATH], 1076[ 1077test "x$4" != "x$5" && \ 1078test -d "$4" && \ 1079ifelse([$5],NONE,,[(test -z "$5" || test x$5 = xNONE || test "x$4" != "x$5") &&]) { 1080 test -n "$verbose" && echo " ... testing for $3-directories under $4" 1081 test -d $4/$3 && $1="[$]$1 $4/$3" 1082 test -d $4/$3/$2 && $1="[$]$1 $4/$3/$2" 1083 test -d $4/$3/$2/$3 && $1="[$]$1 $4/$3/$2/$3" 1084 test -d $4/$2/$3 && $1="[$]$1 $4/$2/$3" 1085 test -d $4/$2/$3/$2 && $1="[$]$1 $4/$2/$3/$2" 1086} 1087])dnl 1088dnl --------------------------------------------------------------------------- 1089dnl CF_ANSI_CC_CHECK version: 13 updated: 2012/10/06 11:17:15 1090dnl ---------------- 1091dnl This was originally adapted from the macros 'fp_PROG_CC_STDC' and 1092dnl 'fp_C_PROTOTYPES' in the sharutils 4.2 distribution. 1093AC_DEFUN([CF_ANSI_CC_CHECK], 1094[ 1095CF_CC_ENV_FLAGS 1096 1097AC_CACHE_CHECK(for ${CC:-cc} option to accept ANSI C, cf_cv_ansi_cc,[ 1098cf_cv_ansi_cc=no 1099cf_save_CFLAGS="$CFLAGS" 1100cf_save_CPPFLAGS="$CPPFLAGS" 1101# Don't try gcc -ansi; that turns off useful extensions and 1102# breaks some systems' header files. 1103# AIX -qlanglvl=ansi 1104# Ultrix and OSF/1 -std1 1105# HP-UX -Aa -D_HPUX_SOURCE 1106# SVR4 -Xc 1107# UnixWare 1.2 (cannot use -Xc, since ANSI/POSIX clashes) 1108for cf_arg in "-DCC_HAS_PROTOS" \ 1109 "" \ 1110 -qlanglvl=ansi \ 1111 -std1 \ 1112 -Ae \ 1113 "-Aa -D_HPUX_SOURCE" \ 1114 -Xc 1115do 1116 CF_ADD_CFLAGS($cf_arg) 1117 AC_TRY_COMPILE( 1118[ 1119#ifndef CC_HAS_PROTOS 1120#if !defined(__STDC__) || (__STDC__ != 1) 1121choke me 1122#endif 1123#endif 1124],[ 1125 int test (int i, double x); 1126 struct s1 {int (*f) (int a);}; 1127 struct s2 {int (*f) (double a);};], 1128 [cf_cv_ansi_cc="$cf_arg"; break]) 1129done 1130CFLAGS="$cf_save_CFLAGS" 1131CPPFLAGS="$cf_save_CPPFLAGS" 1132]) 1133 1134if test "$cf_cv_ansi_cc" != "no"; then 1135if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then 1136 CF_ADD_CFLAGS($cf_cv_ansi_cc) 1137else 1138 AC_DEFINE(CC_HAS_PROTOS,1,[Define to 1 if C compiler supports prototypes]) 1139fi 1140fi 1141])dnl 1142dnl --------------------------------------------------------------------------- 1143dnl CF_ANSI_CC_REQD version: 4 updated: 2008/03/23 14:48:54 1144dnl --------------- 1145dnl For programs that must use an ANSI compiler, obtain compiler options that 1146dnl will make it recognize prototypes. We'll do preprocessor checks in other 1147dnl macros, since tools such as unproto can fake prototypes, but only part of 1148dnl the preprocessor. 1149AC_DEFUN([CF_ANSI_CC_REQD], 1150[AC_REQUIRE([CF_ANSI_CC_CHECK]) 1151if test "$cf_cv_ansi_cc" = "no"; then 1152 AC_MSG_ERROR( 1153[Your compiler does not appear to recognize prototypes. 1154You have the following choices: 1155 a. adjust your compiler options 1156 b. get an up-to-date compiler 1157 c. use a wrapper such as unproto]) 1158fi 1159])dnl 1160dnl --------------------------------------------------------------------------- 1161dnl CF_APPEND_TEXT version: 1 updated: 2017/02/25 18:58:55 1162dnl -------------- 1163dnl use this macro for appending text without introducing an extra blank at 1164dnl the beginning 1165define([CF_APPEND_TEXT], 1166[ 1167 test -n "[$]$1" && $1="[$]$1 " 1168 $1="[$]{$1}$2" 1169])dnl 1170dnl --------------------------------------------------------------------------- 1171dnl CF_ARG_DISABLE version: 3 updated: 1999/03/30 17:24:31 1172dnl -------------- 1173dnl Allow user to disable a normally-on option. 1174AC_DEFUN([CF_ARG_DISABLE], 1175[CF_ARG_OPTION($1,[$2],[$3],[$4],yes)])dnl 1176dnl --------------------------------------------------------------------------- 1177dnl CF_ARG_ENABLE version: 3 updated: 1999/03/30 17:24:31 1178dnl ------------- 1179dnl Allow user to enable a normally-off option. 1180AC_DEFUN([CF_ARG_ENABLE], 1181[CF_ARG_OPTION($1,[$2],[$3],[$4],no)])dnl 1182dnl --------------------------------------------------------------------------- 1183dnl CF_ARG_OPTION version: 5 updated: 2015/05/10 19:52:14 1184dnl ------------- 1185dnl Restricted form of AC_ARG_ENABLE that ensures user doesn't give bogus 1186dnl values. 1187dnl 1188dnl Parameters: 1189dnl $1 = option name 1190dnl $2 = help-string 1191dnl $3 = action to perform if option is not default 1192dnl $4 = action if perform if option is default 1193dnl $5 = default option value (either 'yes' or 'no') 1194AC_DEFUN([CF_ARG_OPTION], 1195[AC_ARG_ENABLE([$1],[$2],[test "$enableval" != ifelse([$5],no,yes,no) && enableval=ifelse([$5],no,no,yes) 1196 if test "$enableval" != "$5" ; then 1197ifelse([$3],,[ :]dnl 1198,[ $3]) ifelse([$4],,,[ 1199 else 1200 $4]) 1201 fi],[enableval=$5 ifelse([$4],,,[ 1202 $4 1203])dnl 1204])])dnl 1205dnl --------------------------------------------------------------------------- 1206dnl CF_ARG_WITH version: 4 updated: 2008/03/23 14:48:54 1207dnl ----------- 1208dnl Restricted form of AC_ARG_WITH that requires user to specify a value 1209dnl $1 = option name 1210dnl $2 = help message 1211dnl $3 = variable to set with the --with value 1212dnl $4 = default value, if any, must be constant. 1213dnl $5 = default value shown for --help if $4 is empty. 1214AC_DEFUN([CF_ARG_WITH], 1215[AC_ARG_WITH($1,[$2 ](default: ifelse($4,,ifelse($5,,empty,$5),$4)),, 1216ifelse($4,,[withval="${$3}"],[withval="${$3-$4}"]))dnl 1217ifelse($4,,[test -n "$withval" && \ 1218],[test -z "$withval" && withval=no 1219])dnl 1220case "$withval" in #(vi 1221yes) 1222 AC_MSG_ERROR(expected a value for --with-$1) 1223 ;; #(vi 1224no) withval="" 1225 ;; 1226esac 1227$3="$withval" 1228])dnl 1229dnl --------------------------------------------------------------------------- 1230dnl CF_AR_FLAGS version: 7 updated: 2020/04/04 11:37:29 1231dnl ----------- 1232dnl Check for suitable "ar" (archiver) options for updating an archive. 1233dnl 1234dnl In particular, handle some obsolete cases where the "-" might be omitted, 1235dnl as well as a workaround for breakage of make's archive rules by the GNU 1236dnl binutils "ar" program. 1237AC_DEFUN([CF_AR_FLAGS],[ 1238AC_REQUIRE([CF_PROG_AR]) 1239 1240AC_CACHE_CHECK(for options to update archives, cf_cv_ar_flags,[ 1241 case $cf_cv_system_name in 1242 *-msvc*) 1243 cf_cv_ar_flags='' 1244 cat >mk_static_lib.sh <<-EOF 1245 #!$SHELL 1246 MSVC_BIN="[$]AR" 1247 out="\[$]1" 1248 shift 1249 exec \[$]MSVC_BIN -out:"\[$]out" \[$]@ 1250 EOF 1251 chmod +x mk_static_lib.sh 1252 AR=`pwd`/mk_static_lib.sh 1253 ;; 1254 *) 1255 cf_cv_ar_flags=unknown 1256 for cf_ar_flags in -curvU -curv curv -crv crv -cqv cqv -rv rv 1257 do 1258 1259 # check if $ARFLAGS already contains this choice 1260 if test "x$ARFLAGS" != "x" ; then 1261 cf_check_ar_flags=`echo "x$ARFLAGS" | sed -e "s/$cf_ar_flags\$//" -e "s/$cf_ar_flags / /"` 1262 if test "x$ARFLAGS" != "$cf_check_ar_flags" ; then 1263 cf_cv_ar_flags= 1264 break 1265 fi 1266 fi 1267 1268 rm -f conftest.$ac_cv_objext 1269 rm -f conftest.a 1270 1271 cat >conftest.$ac_ext <<EOF 1272#line __oline__ "configure" 1273int testdata[[3]] = { 123, 456, 789 }; 1274EOF 1275 if AC_TRY_EVAL(ac_compile) ; then 1276 echo "$AR $ARFLAGS $cf_ar_flags conftest.a conftest.$ac_cv_objext" >&AC_FD_CC 1277 $AR $ARFLAGS $cf_ar_flags conftest.a conftest.$ac_cv_objext 2>&AC_FD_CC 1>/dev/null 1278 if test -f conftest.a ; then 1279 cf_cv_ar_flags=$cf_ar_flags 1280 break 1281 fi 1282 else 1283 CF_VERBOSE(cannot compile test-program) 1284 break 1285 fi 1286 done 1287 rm -f conftest.a conftest.$ac_ext conftest.$ac_cv_objext 1288 ;; 1289 esac 1290]) 1291 1292if test -n "$ARFLAGS" ; then 1293 if test -n "$cf_cv_ar_flags" ; then 1294 ARFLAGS="$ARFLAGS $cf_cv_ar_flags" 1295 fi 1296else 1297 ARFLAGS=$cf_cv_ar_flags 1298fi 1299 1300AC_SUBST(ARFLAGS) 1301]) 1302dnl --------------------------------------------------------------------------- 1303dnl CF_BUILD_CC version: 8 updated: 2018/01/04 20:31:04 1304dnl ----------- 1305dnl If we're cross-compiling, allow the user to override the tools and their 1306dnl options. The configure script is oriented toward identifying the host 1307dnl compiler, etc., but we need a build compiler to generate parts of the 1308dnl source. 1309dnl 1310dnl $1 = default for $CPPFLAGS 1311dnl $2 = default for $LIBS 1312AC_DEFUN([CF_BUILD_CC],[ 1313CF_ACVERSION_CHECK(2.52,, 1314 [AC_REQUIRE([CF_PROG_EXT])]) 1315if test "$cross_compiling" = yes ; then 1316 1317 # defaults that we might want to override 1318 : ${BUILD_CFLAGS:=''} 1319 : ${BUILD_CPPFLAGS:='ifelse([$1],,,[$1])'} 1320 : ${BUILD_LDFLAGS:=''} 1321 : ${BUILD_LIBS:='ifelse([$2],,,[$2])'} 1322 : ${BUILD_EXEEXT:='$x'} 1323 : ${BUILD_OBJEXT:='o'} 1324 1325 AC_ARG_WITH(build-cc, 1326 [ --with-build-cc=XXX the build C compiler ($BUILD_CC)], 1327 [BUILD_CC="$withval"], 1328 [AC_CHECK_PROGS(BUILD_CC, [gcc clang c99 c89 cc cl],none)]) 1329 AC_MSG_CHECKING(for native build C compiler) 1330 AC_MSG_RESULT($BUILD_CC) 1331 1332 AC_MSG_CHECKING(for native build C preprocessor) 1333 AC_ARG_WITH(build-cpp, 1334 [ --with-build-cpp=XXX the build C preprocessor ($BUILD_CPP)], 1335 [BUILD_CPP="$withval"], 1336 [BUILD_CPP='${BUILD_CC} -E']) 1337 AC_MSG_RESULT($BUILD_CPP) 1338 1339 AC_MSG_CHECKING(for native build C flags) 1340 AC_ARG_WITH(build-cflags, 1341 [ --with-build-cflags=XXX the build C compiler-flags ($BUILD_CFLAGS)], 1342 [BUILD_CFLAGS="$withval"]) 1343 AC_MSG_RESULT($BUILD_CFLAGS) 1344 1345 AC_MSG_CHECKING(for native build C preprocessor-flags) 1346 AC_ARG_WITH(build-cppflags, 1347 [ --with-build-cppflags=XXX the build C preprocessor-flags ($BUILD_CPPFLAGS)], 1348 [BUILD_CPPFLAGS="$withval"]) 1349 AC_MSG_RESULT($BUILD_CPPFLAGS) 1350 1351 AC_MSG_CHECKING(for native build linker-flags) 1352 AC_ARG_WITH(build-ldflags, 1353 [ --with-build-ldflags=XXX the build linker-flags ($BUILD_LDFLAGS)], 1354 [BUILD_LDFLAGS="$withval"]) 1355 AC_MSG_RESULT($BUILD_LDFLAGS) 1356 1357 AC_MSG_CHECKING(for native build linker-libraries) 1358 AC_ARG_WITH(build-libs, 1359 [ --with-build-libs=XXX the build libraries (${BUILD_LIBS})], 1360 [BUILD_LIBS="$withval"]) 1361 AC_MSG_RESULT($BUILD_LIBS) 1362 1363 # this assumes we're on Unix. 1364 BUILD_EXEEXT= 1365 BUILD_OBJEXT=o 1366 1367 : ${BUILD_CC:='${CC}'} 1368 1369 if ( test "$BUILD_CC" = "$CC" || test "$BUILD_CC" = '${CC}' ) ; then 1370 AC_MSG_ERROR([Cross-build requires two compilers. 1371Use --with-build-cc to specify the native compiler.]) 1372 fi 1373 1374else 1375 : ${BUILD_CC:='${CC}'} 1376 : ${BUILD_CPP:='${CPP}'} 1377 : ${BUILD_CFLAGS:='${CFLAGS}'} 1378 : ${BUILD_CPPFLAGS:='${CPPFLAGS}'} 1379 : ${BUILD_LDFLAGS:='${LDFLAGS}'} 1380 : ${BUILD_LIBS:='${LIBS}'} 1381 : ${BUILD_EXEEXT:='$x'} 1382 : ${BUILD_OBJEXT:='o'} 1383fi 1384 1385AC_SUBST(BUILD_CC) 1386AC_SUBST(BUILD_CPP) 1387AC_SUBST(BUILD_CFLAGS) 1388AC_SUBST(BUILD_CPPFLAGS) 1389AC_SUBST(BUILD_LDFLAGS) 1390AC_SUBST(BUILD_LIBS) 1391AC_SUBST(BUILD_EXEEXT) 1392AC_SUBST(BUILD_OBJEXT) 1393])dnl 1394dnl --------------------------------------------------------------------------- 1395dnl CF_BUNDLED_CANLOCK version: 1 updated: 2020/01/09 20:03:25 1396dnl ------------------ 1397dnl Top-level macro for configuring an application with a bundled copy of 1398dnl the canlock library. 1399dnl 1400dnl $1 specifies the top of the directory containing CANLOCK's include/lib dirs. 1401dnl That is assigned to $cf_canlock_home, which may be updated. 1402AC_DEFUN([CF_BUNDLED_CANLOCK], 1403[ 1404cf_canlock_home=$1 1405CANDIR_MAKE= 1406CANLIBS= 1407CAN_CPPFLAGS= 1408CAN_MAKEFILE= 1409 1410case .$cf_canlock_home in #(vi 1411.no) #(vi 1412 CF_VERBOSE(using bundled canlock) 1413 CANLIBS='-L../libcanlock -lcanlock' 1414 CAN_CPPFLAGS='-I$(top_builddir)/libcanlock/include -I$(top_srcdir)/libcanlock/include' 1415 CAN_MAKEFILE='libcanlock/Makefile' 1416 ;; 1417.yes) #(vi 1418 CF_FIND_CANLOCK( 1419 cf_canlock_cppflags, 1420 cf_canlock_libs, 1421 [ 1422 CANDIR_MAKE='#' 1423 CANLIBS="$cf_canlock_libs" 1424 CAN_CPPFLAGS="$cf_canlock_cppflags" 1425 CF_VERBOSE(using installed canlock) 1426 ],[ 1427 CF_VERBOSE(using bundled canlock because no installed canlock was found) 1428 CANLIBS='-L../libcanlock -lcanlock' 1429 CAN_CPPFLAGS='-I$(top_builddir)/libcanlock/include -I$(top_srcdir)/libcanlock/include' 1430 CAN_MAKEFILE='libcanlock/Makefile' 1431 ]) 1432 ;; 1433.*) 1434 CF_PATH_SYNTAX(cf_canlock_home) 1435 CANDIR_MAKE='#' 1436 CANLIBS="-L${cf_canlock_home}/lib -lcanlock" 1437 CAN_CPPFLAGS="-I${cf_canlock_home}/include" 1438 CF_VERBOSE(using installed canlock $cf_canlock_home) 1439 ;; 1440esac 1441 1442AC_DEFINE(USE_CANLOCK,1,[Define this to 1 to use Cancel-Locks]) 1443 1444AC_SUBST(CANDIR_MAKE) 1445AC_SUBST(CANLIBS) 1446AC_SUBST(CAN_CPPFLAGS) 1447AC_SUBST(CAN_MAKEFILE) 1448])dnl 1449dnl --------------------------------------------------------------------------- 1450dnl CF_BUNDLED_INTL version: 19 updated: 2018/06/20 20:23:13 1451dnl --------------- 1452dnl Top-level macro for configuring an application with a bundled copy of 1453dnl the intl and po directories for gettext. 1454dnl 1455dnl $1 specifies either Makefile or makefile, defaulting to the former. 1456dnl $2 if nonempty sets the option to --enable-nls rather than to --disable-nls 1457dnl 1458dnl Sets variables which can be used to substitute in makefiles: 1459dnl GT_YES - "#" comment unless building intl library, otherwise empty 1460dnl GT_NO - "#" comment if building intl library, otherwise empty 1461dnl INTLDIR_MAKE - to make ./intl directory 1462dnl MSG_DIR_MAKE - to make ./po directory 1463dnl SUB_MAKEFILE - list of makefiles in ./intl, ./po directories 1464dnl 1465dnl Defines: 1466dnl HAVE_LIBGETTEXT_H if we're using ./intl 1467dnl NLS_TEXTDOMAIN 1468dnl 1469dnl Environment: 1470dnl ALL_LINGUAS if set, lists the root names of the ".po" files. 1471dnl CONFIG_H assumed to be "config.h" 1472dnl PACKAGE must be set, used as default for textdomain 1473dnl VERSION may be set, otherwise extract from "VERSION" file. 1474dnl 1475AC_DEFUN([CF_BUNDLED_INTL],[ 1476cf_makefile=ifelse($1,,Makefile,$1) 1477 1478dnl Set of available languages (based on source distribution). Note that 1479dnl setting $LINGUAS overrides $ALL_LINGUAS. Some environments set $LINGUAS 1480dnl rather than $LC_ALL 1481test -z "$ALL_LINGUAS" && ALL_LINGUAS=`test -d $srcdir/po && cd $srcdir/po && echo *.po|sed -e 's/\.po//g' -e 's/*//'` 1482 1483# Allow override of "config.h" definition: 1484: ${CONFIG_H:=config.h} 1485AC_SUBST(CONFIG_H) 1486 1487if test -z "$PACKAGE" ; then 1488 AC_MSG_ERROR([[CF_BUNDLED_INTL] used without setting [PACKAGE] variable]) 1489fi 1490 1491if test -z "$VERSION" ; then 1492if test -f $srcdir/VERSION ; then 1493 VERSION=`sed -e '2,$d' $srcdir/VERSION|cut -f1` 1494else 1495 VERSION=unknown 1496fi 1497fi 1498AC_SUBST(VERSION) 1499 1500AM_GNU_GETTEXT(,,,[$2]) 1501 1502if test "$USE_NLS" = yes ; then 1503 AC_ARG_WITH(textdomain, 1504 [ --with-textdomain=PKG NLS text-domain (default is package name)], 1505 [NLS_TEXTDOMAIN=$withval], 1506 [NLS_TEXTDOMAIN=$PACKAGE]) 1507 AC_DEFINE_UNQUOTED(NLS_TEXTDOMAIN,"$NLS_TEXTDOMAIN",[Define to the nls textdomain value]) 1508 AC_SUBST(NLS_TEXTDOMAIN) 1509fi 1510 1511INTLDIR_MAKE= 1512MSG_DIR_MAKE= 1513SUB_MAKEFILE= 1514 1515dnl this updates SUB_MAKEFILE and MSG_DIR_MAKE: 1516CF_OUR_MESSAGES($1) 1517 1518if test "$USE_INCLUDED_LIBINTL" = yes ; then 1519 if test "$nls_cv_force_use_gnu_gettext" = yes ; then 1520 : 1521 elif test "$nls_cv_use_gnu_gettext" = yes ; then 1522 : 1523 else 1524 INTLDIR_MAKE="#" 1525 fi 1526 if test -z "$INTLDIR_MAKE"; then 1527 AC_DEFINE(HAVE_LIBGETTEXT_H,1,[Define to 1 if we have libgettext.h]) 1528 for cf_makefile in \ 1529 $srcdir/intl/Makefile.in \ 1530 $srcdir/intl/makefile.in 1531 do 1532 if test -f "$cf_makefile" ; then 1533 SUB_MAKEFILE="$SUB_MAKEFILE `echo \"${cf_makefile}\"|sed -e 's,^'$srcdir/',,' -e 's/\.in$//'`:${cf_makefile}" 1534 break 1535 fi 1536 done 1537 fi 1538else 1539 INTLDIR_MAKE="#" 1540 if test "$USE_NLS" = yes ; then 1541 AC_CHECK_HEADERS(libintl.h) 1542 fi 1543fi 1544 1545if test -z "$INTLDIR_MAKE" ; then 1546 CF_APPEND_TEXT(CPPFLAGS,-I../intl) 1547fi 1548 1549dnl FIXME: we use this in lynx (the alternative is a spurious dependency upon 1550dnl GNU make) 1551if test "$BUILD_INCLUDED_LIBINTL" = yes ; then 1552 GT_YES="#" 1553 GT_NO= 1554else 1555 GT_YES= 1556 GT_NO="#" 1557fi 1558 1559AC_SUBST(INTLDIR_MAKE) 1560AC_SUBST(MSG_DIR_MAKE) 1561AC_SUBST(GT_YES) 1562AC_SUBST(GT_NO) 1563 1564dnl FIXME: the underlying AM_GNU_GETTEXT macro either needs some fixes or a 1565dnl little documentation. It doesn't define anything so that we can ifdef our 1566dnl own code, except ENABLE_NLS, which is too vague to be of any use. 1567 1568if test "$USE_INCLUDED_LIBINTL" = yes ; then 1569 if test "$nls_cv_force_use_gnu_gettext" = yes ; then 1570 AC_DEFINE(HAVE_GETTEXT,1,[Define to 1 if we have gettext function]) 1571 elif test "$nls_cv_use_gnu_gettext" = yes ; then 1572 AC_DEFINE(HAVE_GETTEXT,1,[Define to 1 if we have gettext function]) 1573 fi 1574 if test -n "$nls_cv_header_intl" ; then 1575 AC_DEFINE(HAVE_LIBINTL_H,1,[Define to 1 if we have header-file for libintl]) 1576 fi 1577fi 1578])dnl 1579dnl --------------------------------------------------------------------------- 1580dnl CF_BUNDLED_PCRE version: 4 updated: 2009/12/24 04:20:51 1581dnl --------------- 1582dnl Top-level macro for configuring an application with a bundled copy of 1583dnl the pcre library. 1584dnl 1585dnl $1 specifies the top of the directory containing PCRE's include, lib dirs. 1586dnl That is assigned to $cf_pcre_home, which may be updated. 1587AC_DEFUN([CF_BUNDLED_PCRE], 1588[ 1589cf_pcre_home=$1 1590PCREDIR_MAKE= 1591PCREDIR_LIBS= 1592PCREDIR_CPPFLAGS= 1593 1594case .$cf_pcre_home in #(vi 1595.no) #(vi 1596 # setup to compile the bundled PCRE: 1597# . $srcdir/pcre/version.sh 1598 AC_SUBST(PCRE_MAJOR) 1599 AC_SUBST(PCRE_MINOR) 1600 AC_SUBST(PCRE_DATE) 1601 AC_SUBST(PCRE_DEFINES) 1602 ;; 1603.yes) #(vi 1604 CF_FIND_PCRE( 1605 cf_pcre_cppflags, 1606 cf_pcre_libs, 1607 [ 1608 PCREDIR_MAKE='#' 1609 PCREDIR_LIBS="$cf_pcre_libs" 1610 PCREDIR_CPPFLAGS="$cf_pcre_cppflags" 1611 ],[ 1612 CF_VERBOSE(using bundled pcre because no installed pcre was found) 1613 AC_SUBST(PCRE_MAJOR) 1614 AC_SUBST(PCRE_MINOR) 1615 AC_SUBST(PCRE_DATE) 1616 AC_SUBST(PCRE_DEFINES) 1617 cf_pcre_home=no 1618 ]) 1619 ;; 1620.*) 1621 CF_PATH_SYNTAX(cf_pcre_home) 1622 PCREDIR_MAKE='#' 1623 PCREDIR_LIBS="-L${cf_pcre_home}/lib -lpcre" 1624 PCREDIR_CPPFLAGS="-I${cf_pcre_home}/include" 1625 ;; 1626esac 1627 1628AC_SUBST(PCREDIR_MAKE) 1629AC_SUBST(PCREDIR_LIBS) 1630AC_SUBST(PCREDIR_CPPFLAGS) 1631])dnl 1632dnl --------------------------------------------------------------------------- 1633dnl CF_CC_ENV_FLAGS version: 9 updated: 2018/07/29 18:03:26 1634dnl --------------- 1635dnl Check for user's environment-breakage by stuffing CFLAGS/CPPFLAGS content 1636dnl into CC. This will not help with broken scripts that wrap the compiler 1637dnl with options, but eliminates a more common category of user confusion. 1638dnl 1639dnl In particular, it addresses the problem of being able to run the C 1640dnl preprocessor in a consistent manner. 1641dnl 1642dnl Caveat: this also disallows blanks in the pathname for the compiler, but 1643dnl the nuisance of having inconsistent settings for compiler and preprocessor 1644dnl outweighs that limitation. 1645AC_DEFUN([CF_CC_ENV_FLAGS], 1646[ 1647# This should have been defined by AC_PROG_CC 1648: ${CC:=cc} 1649 1650AC_MSG_CHECKING(\$CFLAGS variable) 1651case "x$CFLAGS" in 1652*-[[IUD]]*) 1653 AC_MSG_RESULT(broken) 1654 AC_MSG_WARN(your environment uses the CFLAGS variable to hold CPPFLAGS options) 1655 cf_flags="$CFLAGS" 1656 CFLAGS= 1657 for cf_arg in $cf_flags 1658 do 1659 CF_ADD_CFLAGS($cf_arg) 1660 done 1661 ;; 1662*) 1663 AC_MSG_RESULT(ok) 1664 ;; 1665esac 1666 1667AC_MSG_CHECKING(\$CC variable) 1668case "$CC" in 1669*[[\ \ ]]-*) 1670 AC_MSG_RESULT(broken) 1671 AC_MSG_WARN(your environment uses the CC variable to hold CFLAGS/CPPFLAGS options) 1672 # humor him... 1673 cf_prog=`echo "$CC" | sed -e 's/ / /g' -e 's/[[ ]]* / /g' -e 's/[[ ]]*[[ ]]-[[^ ]].*//'` 1674 cf_flags=`echo "$CC" | ${AWK:-awk} -v prog="$cf_prog" '{ printf("%s", [substr]([$]0,1+length(prog))); }'` 1675 CC="$cf_prog" 1676 for cf_arg in $cf_flags 1677 do 1678 case "x$cf_arg" in 1679 x-[[IUDfgOW]]*) 1680 CF_ADD_CFLAGS($cf_arg) 1681 ;; 1682 *) 1683 CC="$CC $cf_arg" 1684 ;; 1685 esac 1686 done 1687 CF_VERBOSE(resulting CC: '$CC') 1688 CF_VERBOSE(resulting CFLAGS: '$CFLAGS') 1689 CF_VERBOSE(resulting CPPFLAGS: '$CPPFLAGS') 1690 ;; 1691*) 1692 AC_MSG_RESULT(ok) 1693 ;; 1694esac 1695])dnl 1696dnl --------------------------------------------------------------------------- 1697dnl CF_CHECK_1_DECL version: 5 updated: 2001/07/22 21:09:16 1698dnl --------------- 1699dnl Check for missing declarations in the system headers (adapted from vile). 1700dnl 1701dnl CHECK_DECL_FLAG and CHECK_DECL_HDRS must be set in configure.in 1702AC_DEFUN([CF_CHECK_1_DECL], 1703[ 1704AC_MSG_CHECKING([for missing "$1" extern]) 1705AC_CACHE_VAL([cf_cv_func_$1],[ 1706CF_MSG_LOG([for missing "$1" external]) 1707cf_save_CFLAGS="$CFLAGS" 1708CFLAGS="$CFLAGS $CHECK_DECL_FLAG" 1709AC_TRY_LINK([ 1710$CHECK_DECL_HDRS 1711 1712#undef $1 1713struct zowie { int a; double b; struct zowie *c; char d; }; 1714extern struct zowie *$1(); 1715], 1716[ 1717], 1718[if test -n "$CHECK_DECL_HDRS" ; then 1719# try to work around system headers which are infested with non-standard syntax 1720CF_UPPER(cf_1_up,$1) 1721AC_TRY_COMPILE([ 1722#define DECL_${cf_1_up} 1723$CHECK_DECL_HDRS 1724],[long x = 0], 1725[eval 'cf_cv_func_'$1'=yes'], 1726[eval 'cf_cv_func_'$1'=no']) 1727else 1728eval 'cf_cv_func_'$1'=yes' 1729fi 1730], 1731[eval 'cf_cv_func_'$1'=no']) 1732CFLAGS="$cf_save_CFLAGS" 1733]) 1734eval 'cf_result=$cf_cv_func_'$1 1735AC_MSG_RESULT($cf_result) 1736test $cf_result = yes && AC_DEFINE_UNQUOTED(DECL_$2) 1737])dnl 1738dnl --------------------------------------------------------------------------- 1739dnl CF_CHECK_CACHE version: 12 updated: 2012/10/02 20:55:03 1740dnl -------------- 1741dnl Check if we're accidentally using a cache from a different machine. 1742dnl Derive the system name, as a check for reusing the autoconf cache. 1743dnl 1744dnl If we've packaged config.guess and config.sub, run that (since it does a 1745dnl better job than uname). Normally we'll use AC_CANONICAL_HOST, but allow 1746dnl an extra parameter that we may override, e.g., for AC_CANONICAL_SYSTEM 1747dnl which is useful in cross-compiles. 1748dnl 1749dnl Note: we would use $ac_config_sub, but that is one of the places where 1750dnl autoconf 2.5x broke compatibility with autoconf 2.13 1751AC_DEFUN([CF_CHECK_CACHE], 1752[ 1753if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then 1754 ifelse([$1],,[AC_CANONICAL_HOST],[$1]) 1755 system_name="$host_os" 1756else 1757 system_name="`(uname -s -r) 2>/dev/null`" 1758 if test -z "$system_name" ; then 1759 system_name="`(hostname) 2>/dev/null`" 1760 fi 1761fi 1762test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name",[Define to the system name.]) 1763AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"]) 1764 1765test -z "$system_name" && system_name="$cf_cv_system_name" 1766test -n "$cf_cv_system_name" && AC_MSG_RESULT(Configuring for $cf_cv_system_name) 1767 1768if test ".$system_name" != ".$cf_cv_system_name" ; then 1769 AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)) 1770 AC_MSG_ERROR("Please remove config.cache and try again.") 1771fi 1772])dnl 1773dnl --------------------------------------------------------------------------- 1774dnl CF_CHECK_CFLAGS version: 3 updated: 2014/07/22 05:32:57 1775dnl --------------- 1776dnl Conditionally add to $CFLAGS and $CPPFLAGS values which are derived from 1777dnl a build-configuration such as imake. These have the pitfall that they 1778dnl often contain compiler-specific options which we cannot use, mixed with 1779dnl preprocessor options that we usually can. 1780AC_DEFUN([CF_CHECK_CFLAGS], 1781[ 1782CF_VERBOSE(checking additions to CFLAGS) 1783cf_check_cflags="$CFLAGS" 1784cf_check_cppflags="$CPPFLAGS" 1785CF_ADD_CFLAGS($1,yes) 1786if test "x$cf_check_cflags" != "x$CFLAGS" ; then 1787AC_TRY_LINK([#include <stdio.h>],[printf("Hello world");],, 1788 [CF_VERBOSE(test-compile failed. Undoing change to \$CFLAGS) 1789 if test "x$cf_check_cppflags" != "x$CPPFLAGS" ; then 1790 CF_VERBOSE(but keeping change to \$CPPFLAGS) 1791 fi 1792 CFLAGS="$cf_check_flags"]) 1793fi 1794])dnl 1795dnl --------------------------------------------------------------------------- 1796dnl CF_CHECK_DECL version: 2 updated: 1997/08/28 23:57:55 1797dnl ------------- 1798AC_DEFUN([CF_CHECK_DECL], 1799[for ac_func in $1 1800do 1801CF_UPPER(ac_tr_func,$ac_func) 1802CF_CHECK_1_DECL(${ac_func}, ${ac_tr_func})dnl 1803done 1804])dnl 1805dnl --------------------------------------------------------------------------- 1806dnl CF_CHECK_ERRNO version: 13 updated: 2020/03/10 18:53:47 1807dnl -------------- 1808dnl Check for data that is usually declared in <stdio.h> or <errno.h>, e.g., 1809dnl the 'errno' variable. Define a DECL_xxx symbol if we must declare it 1810dnl ourselves. 1811dnl 1812dnl $1 = the name to check 1813dnl $2 = the assumed type 1814AC_DEFUN([CF_CHECK_ERRNO], 1815[ 1816AC_CACHE_CHECK(if external $1 is declared, cf_cv_dcl_$1,[ 1817 AC_TRY_COMPILE([ 1818#ifdef HAVE_STDLIB_H 1819#include <stdlib.h> 1820#endif 1821#include <stdio.h> 1822#include <sys/types.h> 1823#include <errno.h> ], 1824 ifelse([$2],,int,[$2]) x = (ifelse([$2],,int,[$2])) $1; (void)x, 1825 [cf_cv_dcl_$1=yes], 1826 [cf_cv_dcl_$1=no]) 1827]) 1828 1829if test "$cf_cv_dcl_$1" = no ; then 1830 CF_UPPER(cf_result,decl_$1) 1831 AC_DEFINE_UNQUOTED($cf_result) 1832fi 1833 1834# It's possible (for near-UNIX clones) that the data doesn't exist 1835CF_CHECK_EXTERN_DATA($1,ifelse([$2],,int,[$2])) 1836])dnl 1837dnl --------------------------------------------------------------------------- 1838dnl CF_CHECK_EXTERN_DATA version: 4 updated: 2015/04/18 08:56:57 1839dnl -------------------- 1840dnl Check for existence of external data in the current set of libraries. If 1841dnl we can modify it, it's real enough. 1842dnl $1 = the name to check 1843dnl $2 = its type 1844AC_DEFUN([CF_CHECK_EXTERN_DATA], 1845[ 1846AC_CACHE_CHECK(if external $1 exists, cf_cv_have_$1,[ 1847 AC_TRY_LINK([ 1848#undef $1 1849extern $2 $1; 1850], 1851 [$1 = 2], 1852 [cf_cv_have_$1=yes], 1853 [cf_cv_have_$1=no]) 1854]) 1855 1856if test "$cf_cv_have_$1" = yes ; then 1857 CF_UPPER(cf_result,have_$1) 1858 AC_DEFINE_UNQUOTED($cf_result) 1859fi 1860 1861])dnl 1862dnl --------------------------------------------------------------------------- 1863dnl CF_CHECK_FD_SET version: 5 updated: 2012/10/06 11:17:15 1864dnl --------------- 1865dnl Check if the fd_set type and corresponding macros are defined. 1866AC_DEFUN([CF_CHECK_FD_SET], 1867[ 1868AC_REQUIRE([CF_TYPE_FD_SET]) 1869AC_CACHE_CHECK([for fd_set macros],cf_cv_macros_fd_set,[ 1870AC_TRY_COMPILE([ 1871#include <sys/types.h> 1872#if USE_SYS_SELECT_H 1873# include <sys/select.h> 1874#else 1875# ifdef HAVE_SYS_TIME_H 1876# include <sys/time.h> 1877# ifdef TIME_WITH_SYS_TIME 1878# include <time.h> 1879# endif 1880# else 1881# include <time.h> 1882# endif 1883#endif 1884],[ 1885 fd_set read_bits; 1886 FD_ZERO(&read_bits); 1887 FD_SET(0, &read_bits);], 1888 [cf_cv_macros_fd_set=yes], 1889 [cf_cv_macros_fd_set=no])]) 1890test $cf_cv_macros_fd_set = yes && AC_DEFINE(HAVE_TYPE_FD_SET,1,[Define to 1 if type fd_set is declared]) 1891])dnl 1892dnl --------------------------------------------------------------------------- 1893dnl CF_CHECK_HEADERS version: 3 updated: 2000/11/03 11:14:19 1894dnl ---------------- 1895dnl AC_CHECK_HEADERS(sys/socket.h) fails on OS/2 EMX because it demands that 1896dnl <sys/types.h> be included first. 1897dnl 1898dnl Also <sys/dir.h> and <sys/dirent.h> and <sys/stat.h>, but we normally do 1899dnl not do our own tests via AC_CHECK_HEADERS for those. 1900AC_DEFUN([CF_CHECK_HEADERS],[ 1901for cf_hdr in $1 1902do 1903 AC_MSG_CHECKING(for $cf_hdr) 1904 AC_TRY_CPP([ 1905#include <sys/types.h> 1906#include <$cf_hdr> 1907],[cf_found=yes],[cf_found=no]) 1908AC_MSG_RESULT($cf_found) 1909if test $cf_found = yes ; then 1910 CF_UPPER(cf_tr_hdr,$cf_hdr) 1911 AC_DEFINE_UNQUOTED(HAVE_${cf_tr_hdr}) 1912fi 1913done 1914])dnl 1915dnl --------------------------------------------------------------------------- 1916dnl CF_CHECK_IPV6 version: 3 updated: 2004/01/22 17:38:22 1917dnl ------------- 1918dnl Check for IPV6 configuration. 1919AC_DEFUN([CF_CHECK_IPV6],[ 1920CF_FIND_IPV6_TYPE 1921CF_FIND_IPV6_LIBS 1922 1923CF_FUNC_GETADDRINFO 1924 1925if test "$cf_cv_getaddrinfo" != "yes"; then 1926 if test "$cf_cv_ipv6type" != "linux"; then 1927 AC_MSG_WARN( 1928[You must get working getaddrinfo() function, 1929or you can specify "--disable-ipv6"]) 1930 else 1931 AC_MSG_WARN( 1932[The getaddrinfo() implementation on your system seems be buggy. 1933You should upgrade your system library to the newest version 1934of GNU C library (aka glibc).]) 1935 fi 1936fi 1937 1938])dnl 1939dnl --------------------------------------------------------------------------- 1940dnl CF_CHECK_NESTED_PARAMS version: 3 updated: 2019/12/31 20:39:42 1941dnl ---------------------- 1942dnl Check if the compiler allows nested parameter lists (some don't) 1943AC_DEFUN([CF_CHECK_NESTED_PARAMS], 1944[ 1945AC_MSG_CHECKING([if nested parameters work]) 1946AC_CACHE_VAL(cf_cv_nested_params,[ 1947 AC_TRY_COMPILE([], 1948 [extern void (*sigdisp(int sig, void (*func)(int sig)))(int sig)], 1949 [cf_cv_nested_params=yes], 1950 [cf_cv_nested_params=no]) 1951]) 1952AC_MSG_RESULT($cf_cv_nested_params) 1953test $cf_cv_nested_params = yes && AC_DEFINE(HAVE_NESTED_PARAMS,1,[Define this to 1 if the compiler allows nested parameter lists]) 1954])dnl 1955dnl --------------------------------------------------------------------------- 1956dnl CF_CLANG_COMPILER version: 6 updated: 2020/11/26 17:37:55 1957dnl ----------------- 1958dnl Check if the given compiler is really clang. clang's C driver defines 1959dnl __GNUC__ (fooling the configure script into setting $GCC to yes) but does 1960dnl not ignore some gcc options. 1961dnl 1962dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to 1963dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from 1964dnl the wrappers for gcc and g++ warnings. 1965dnl 1966dnl $1 = GCC (default) or GXX 1967dnl $2 = CLANG_COMPILER (default) 1968dnl $3 = CFLAGS (default) or CXXFLAGS 1969AC_DEFUN([CF_CLANG_COMPILER],[ 1970ifelse([$2],,CLANG_COMPILER,[$2])=no 1971 1972if test "$ifelse([$1],,[$1],GCC)" = yes ; then 1973 AC_MSG_CHECKING(if this is really Clang ifelse([$1],GXX,C++,C) compiler) 1974 cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])" 1975 AC_TRY_COMPILE([],[ 1976#ifdef __clang__ 1977#else 1978make an error 1979#endif 1980],[ifelse([$2],,CLANG_COMPILER,[$2])=yes 1981],[]) 1982 ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS" 1983 AC_MSG_RESULT($ifelse([$2],,CLANG_COMPILER,[$2])) 1984fi 1985 1986CLANG_VERSION=none 1987 1988if test "x$ifelse([$2],,CLANG_COMPILER,[$2])" = "xyes" ; then 1989 case "$CC" in 1990 c[[1-9]][[0-9]]|*/c[[1-9]][[0-9]]) 1991 AC_MSG_WARN(replacing broken compiler alias $CC) 1992 CFLAGS="$CFLAGS -std=`echo "$CC" | sed -e 's%.*/%%'`" 1993 CC=clang 1994 ;; 1995 esac 1996 1997 AC_MSG_CHECKING(version of $CC) 1998 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.]].*//'`" 1999 test -z "$CLANG_VERSION" && CLANG_VERSION=unknown 2000 AC_MSG_RESULT($CLANG_VERSION) 2001 2002 for cf_clang_opt in \ 2003 -Qunused-arguments \ 2004 -Wno-error=implicit-function-declaration 2005 do 2006 AC_MSG_CHECKING(if option $cf_clang_opt works) 2007 cf_save_CFLAGS="$CFLAGS" 2008 CFLAGS="$CFLAGS $cf_clang_opt" 2009 AC_TRY_LINK([ 2010 #include <stdio.h>],[ 2011 printf("hello!\n");],[ 2012 cf_clang_optok=yes],[ 2013 cf_clang_optok=no]) 2014 AC_MSG_RESULT($cf_clang_optok) 2015 CFLAGS="$cf_save_CFLAGS" 2016 if test $cf_clang_optok = yes; then 2017 CF_VERBOSE(adding option $cf_clang_opt) 2018 CF_APPEND_TEXT(CFLAGS,$cf_clang_opt) 2019 fi 2020 done 2021fi 2022]) 2023dnl --------------------------------------------------------------------------- 2024dnl CF_COLOR_CURSES version: 8 updated: 2012/11/08 20:57:52 2025dnl --------------- 2026dnl Check if curses supports color. (Note that while SVr3 curses supports 2027dnl color, it does this differently from SVr4 curses; more work would be needed 2028dnl to accommodate SVr3). 2029dnl 2030AC_DEFUN([CF_COLOR_CURSES], 2031[ 2032AC_MSG_CHECKING(if curses supports color attributes) 2033AC_CACHE_VAL(cf_cv_color_curses,[ 2034 AC_TRY_LINK([ 2035#include <${cf_cv_ncurses_header:-curses.h}> 2036], 2037 [chtype x = COLOR_BLUE; 2038 has_colors(); 2039 start_color(); 2040#ifndef NCURSES_BROKEN 2041 wbkgd(curscr, getbkgd(stdscr)); /* X/Open XPG4 aka SVr4 Curses */ 2042#endif 2043 ], 2044 [cf_cv_color_curses=yes], 2045 [cf_cv_color_curses=no]) 2046 ]) 2047AC_MSG_RESULT($cf_cv_color_curses) 2048if test $cf_cv_color_curses = yes ; then 2049 AC_DEFINE(COLOR_CURSES,1,[Define to 1 if if curses supports color attributes]) 2050 test ".$cf_cv_ncurses_broken" != .yes && AC_DEFINE(HAVE_GETBKGD,1,[Define to 1 if curses has getbkgd function]) 2051fi 2052])dnl 2053dnl --------------------------------------------------------------------------- 2054dnl CF_COMPTYPE version: 3 updated: 2019/12/31 20:39:42 2055dnl ----------- 2056dnl Check if the compiler uses 'void *' for qsort's compare function parameters 2057dnl (i.e., it's an ANSI prototype). 2058AC_DEFUN([CF_COMPTYPE], 2059[ 2060AC_MSG_CHECKING([for ANSI qsort]) 2061AC_CACHE_VAL(cf_cv_comptype,[ 2062 AC_TRY_COMPILE([ 2063#ifdef HAVE_STDLIB_H 2064#include <stdlib.h> 2065#endif], 2066 [extern int compare(const void *, const void *); 2067 char *foo = "string"; 2068 qsort(foo, sizeof(foo)/sizeof(*foo), sizeof(*foo), compare)], 2069 [cf_cv_comptype=yes], 2070 [cf_cv_comptype=no]) 2071]) 2072AC_MSG_RESULT($cf_cv_comptype) 2073if test $cf_cv_comptype = yes; then 2074 AC_DEFINE(HAVE_COMPTYPE_VOID,1,[Define this to 1 if qsort uses void*]) 2075else 2076 AC_DEFINE(HAVE_COMPTYPE_CHAR,1,[Define this to 1 if qsort uses char*]) 2077fi 2078])dnl 2079dnl --------------------------------------------------------------------------- 2080dnl CF_CONST_X_STRING version: 4 updated: 2020/03/10 18:53:47 2081dnl ----------------- 2082dnl The X11R4-X11R6 Xt specification uses an ambiguous String type for most 2083dnl character-strings. 2084dnl 2085dnl It is ambiguous because the specification accommodated the pre-ANSI 2086dnl compilers bundled by more than one vendor in lieu of providing a standard C 2087dnl compiler other than by costly add-ons. Because of this, the specification 2088dnl did not take into account the use of const for telling the compiler that 2089dnl string literals would be in readonly memory. 2090dnl 2091dnl As a workaround, one could (starting with X11R5) define XTSTRINGDEFINES, to 2092dnl let the compiler decide how to represent Xt's strings which were #define'd. 2093dnl That does not solve the problem of using the block of Xt's strings which 2094dnl are compiled into the library (and is less efficient than one might want). 2095dnl 2096dnl Xt specification 7 introduces the _CONST_X_STRING symbol which is used both 2097dnl when compiling the library and compiling using the library, to tell the 2098dnl compiler that String is const. 2099AC_DEFUN([CF_CONST_X_STRING], 2100[ 2101AC_REQUIRE([AC_PATH_XTRA]) 2102 2103CF_SAVE_XTRA_FLAGS([CF_CONST_X_STRING]) 2104 2105AC_TRY_COMPILE( 2106[ 2107#include <stdlib.h> 2108#include <X11/Intrinsic.h> 2109], 2110[String foo = malloc(1); (void)foo],[ 2111 2112AC_CACHE_CHECK(for X11/Xt const-feature,cf_cv_const_x_string,[ 2113 AC_TRY_COMPILE( 2114 [ 2115#define _CONST_X_STRING /* X11R7.8 (perhaps) */ 2116#undef XTSTRINGDEFINES /* X11R5 and later */ 2117#include <stdlib.h> 2118#include <X11/Intrinsic.h> 2119 ],[String foo = malloc(1); *foo = 0],[ 2120 cf_cv_const_x_string=no 2121 ],[ 2122 cf_cv_const_x_string=yes 2123 ]) 2124]) 2125 2126CF_RESTORE_XTRA_FLAGS([CF_CONST_X_STRING]) 2127 2128case $cf_cv_const_x_string in 2129no) 2130 CF_APPEND_TEXT(CPPFLAGS,-DXTSTRINGDEFINES) 2131 ;; 2132*) 2133 CF_APPEND_TEXT(CPPFLAGS,-D_CONST_X_STRING) 2134 ;; 2135esac 2136 2137]) 2138])dnl 2139dnl --------------------------------------------------------------------------- 2140dnl CF_COREFILE version: 5 updated: 2019/12/31 20:39:42 2141dnl ----------- 2142dnl Check if the application can dump core (for debugging). 2143AC_DEFUN([CF_COREFILE], 2144[ 2145AC_MSG_CHECKING([if application can dump core]) 2146AC_CACHE_VAL(cf_cv_corefile,[ 2147 AC_TRY_RUN([ 2148#include <signal.h> 2149#include <sys/types.h> 2150#include <sys/stat.h> 2151int found() 2152{ 2153 struct stat sb; 2154 return ((stat("core", &sb) == 0 /* UNIX */ 2155 || stat("conftest.core", &sb) == 0 /* FreeBSD */ 2156 ) 2157 && ((sb.st_mode & S_IFMT) == S_IFREG)); 2158} 2159int main() 2160{ 2161#ifdef __amiga__ 2162/* Nicholas d'Alterio (nagd@ic.ac.uk) reports that the check for ability to 2163 * core dump causes the machine to crash - reason unknown (gcc 2.7.2) 2164 */ 2165 ${cf_cv_main_return:-return}(1); 2166#else 2167 int pid, status; 2168 if (found()) 2169 unlink("core"); 2170 if (found()) 2171 ${cf_cv_main_return:-return}(1); 2172 if ((pid = fork()) != 0) { 2173 while (wait(&status) <= 0) 2174 ; 2175 } else { 2176 abort(); /* this will dump core, if anything will */ 2177 } 2178 if (found()) { 2179 unlink("core"); 2180 ${cf_cv_main_return:-return}(0); 2181 } 2182 ${cf_cv_main_return:-return}(1); 2183#endif 2184}], 2185 [cf_cv_corefile=yes], 2186 [cf_cv_corefile=no], 2187 [cf_cv_corefile=unknown])]) 2188AC_MSG_RESULT($cf_cv_corefile) 2189test $cf_cv_corefile = yes && AC_DEFINE(HAVE_COREFILE,1,[Define this to 1 if the application can dump core]) 2190])dnl 2191dnl --------------------------------------------------------------------------- 2192dnl CF_CPP_CONCATS version: 3 updated: 2019/12/31 20:39:42 2193dnl -------------- 2194dnl Test for ANSI token expansion (used in 'assert'). 2195AC_DEFUN([CF_CPP_CONCATS], 2196[ 2197AC_MSG_CHECKING([for ansi token concatenation]) 2198AC_CACHE_VAL(cf_cv_cpp_concats,[ 2199 AC_TRY_COMPILE([ 2200#define concat(a,b) a ## b], 2201 [char *firstlast = "y", *s = concat(first,last)], 2202 [cf_cv_cpp_concats=yes], 2203 [cf_cv_cpp_concats=no]) 2204]) 2205AC_MSG_RESULT($cf_cv_cpp_concats) 2206test $cf_cv_cpp_concats = yes && AC_DEFINE(CPP_DOES_CONCAT,1,[Define this to 1 for ansi token concatenation]) 2207])dnl 2208dnl --------------------------------------------------------------------------- 2209dnl CF_CPP_EXPANDS version: 3 updated: 2019/12/31 20:39:42 2210dnl -------------- 2211dnl Test for ANSI token expansion (used in 'assert'). 2212AC_DEFUN([CF_CPP_EXPANDS], 2213[ 2214AC_MSG_CHECKING([for ansi token expansion/substitution]) 2215AC_CACHE_VAL(cf_cv_cpp_expands,[ 2216 AC_TRY_COMPILE([ 2217#define string(n) #n], 2218 [char *s = string(token)], 2219 [cf_cv_cpp_expands=yes], 2220 [cf_cv_cpp_expands=no]) 2221]) 2222AC_MSG_RESULT($cf_cv_cpp_expands) 2223test $cf_cv_cpp_expands = yes && AC_DEFINE(CPP_DOES_EXPAND,1,[Define this to 1 for ansi token expansion/substitution]) 2224])dnl 2225dnl --------------------------------------------------------------------------- 2226dnl CF_CURSES_CONFIG version: 2 updated: 2006/10/29 11:06:27 2227dnl ---------------- 2228dnl Tie together the configure-script macros for curses. It may be ncurses, 2229dnl but unless asked, we do not make a special search for ncurses. However, 2230dnl still check for the ncurses version number, for use in other macros. 2231AC_DEFUN([CF_CURSES_CONFIG], 2232[ 2233CF_CURSES_CPPFLAGS 2234CF_NCURSES_VERSION 2235CF_CURSES_LIBS 2236])dnl 2237dnl --------------------------------------------------------------------------- 2238dnl CF_CURSES_CPPFLAGS version: 13 updated: 2018/06/20 20:23:13 2239dnl ------------------ 2240dnl Look for the curses headers. 2241AC_DEFUN([CF_CURSES_CPPFLAGS],[ 2242 2243AC_CACHE_CHECK(for extra include directories,cf_cv_curses_incdir,[ 2244cf_cv_curses_incdir=no 2245case $host_os in 2246hpux10.*) 2247 if test "x$cf_cv_screen" = "xcurses_colr" 2248 then 2249 test -d /usr/include/curses_colr && \ 2250 cf_cv_curses_incdir="-I/usr/include/curses_colr" 2251 fi 2252 ;; 2253sunos3*|sunos4*) 2254 if test "x$cf_cv_screen" = "xcurses_5lib" 2255 then 2256 test -d /usr/5lib && \ 2257 test -d /usr/5include && \ 2258 cf_cv_curses_incdir="-I/usr/5include" 2259 fi 2260 ;; 2261esac 2262]) 2263if test "$cf_cv_curses_incdir" != no 2264then 2265 CF_APPEND_TEXT(CPPFLAGS,$cf_cv_curses_incdir) 2266fi 2267 2268CF_CURSES_HEADER 2269CF_TERM_HEADER 2270])dnl 2271dnl --------------------------------------------------------------------------- 2272dnl CF_CURSES_HEADER version: 5 updated: 2015/04/23 20:35:30 2273dnl ---------------- 2274dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common 2275dnl variations of ncurses' installs. 2276dnl 2277dnl $1 = ncurses when looking for ncurses, or is empty 2278AC_DEFUN([CF_CURSES_HEADER],[ 2279AC_CACHE_CHECK(if we have identified curses headers,cf_cv_ncurses_header,[ 2280cf_cv_ncurses_header=none 2281for cf_header in \ 2282 ncurses.h ifelse($1,,,[$1/ncurses.h]) \ 2283 curses.h ifelse($1,,,[$1/curses.h]) ifelse($1,,[ncurses/ncurses.h ncurses/curses.h]) 2284do 2285AC_TRY_COMPILE([#include <${cf_header}>], 2286 [initscr(); tgoto("?", 0,0)], 2287 [cf_cv_ncurses_header=$cf_header; break],[]) 2288done 2289]) 2290 2291if test "$cf_cv_ncurses_header" = none ; then 2292 AC_MSG_ERROR(No curses header-files found) 2293fi 2294 2295# cheat, to get the right #define's for HAVE_NCURSES_H, etc. 2296AC_CHECK_HEADERS($cf_cv_ncurses_header) 2297])dnl 2298dnl --------------------------------------------------------------------------- 2299dnl CF_CURSES_LIBS version: 42 updated: 2018/06/20 20:23:13 2300dnl -------------- 2301dnl Look for the curses libraries. Older curses implementations may require 2302dnl termcap/termlib to be linked as well. Call CF_CURSES_CPPFLAGS first. 2303AC_DEFUN([CF_CURSES_LIBS],[ 2304 2305AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl 2306AC_MSG_CHECKING(if we have identified curses libraries) 2307AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>], 2308 [initscr(); tgoto("?", 0,0)], 2309 cf_result=yes, 2310 cf_result=no) 2311AC_MSG_RESULT($cf_result) 2312 2313if test "$cf_result" = no ; then 2314case $host_os in 2315freebsd*) 2316 AC_CHECK_LIB(mytinfo,tgoto,[CF_ADD_LIBS(-lmytinfo)]) 2317 ;; 2318hpux10.*) 2319 # Looking at HPUX 10.20, the Hcurses library is the oldest (1997), cur_colr 2320 # next (1998), and xcurses "newer" (2000). There is no header file for 2321 # Hcurses; the subdirectory curses_colr has the headers (curses.h and 2322 # term.h) for cur_colr 2323 if test "x$cf_cv_screen" = "xcurses_colr" 2324 then 2325 AC_CHECK_LIB(cur_colr,initscr,[ 2326 CF_ADD_LIBS(-lcur_colr) 2327 ac_cv_func_initscr=yes 2328 ],[ 2329 AC_CHECK_LIB(Hcurses,initscr,[ 2330 # HP's header uses __HP_CURSES, but user claims _HP_CURSES. 2331 CF_ADD_LIBS(-lHcurses) 2332 CF_APPEND_TEXT(CPPFLAGS,-D__HP_CURSES -D_HP_CURSES) 2333 ac_cv_func_initscr=yes 2334 ])]) 2335 fi 2336 ;; 2337linux*) 2338 case `arch 2>/dev/null` in 2339 x86_64) 2340 if test -d /lib64 2341 then 2342 CF_ADD_LIBDIR(/lib64) 2343 else 2344 CF_ADD_LIBDIR(/lib) 2345 fi 2346 ;; 2347 *) 2348 CF_ADD_LIBDIR(/lib) 2349 ;; 2350 esac 2351 ;; 2352sunos3*|sunos4*) 2353 if test "x$cf_cv_screen" = "xcurses_5lib" 2354 then 2355 if test -d /usr/5lib ; then 2356 CF_ADD_LIBDIR(/usr/5lib) 2357 CF_ADD_LIBS(-lcurses -ltermcap) 2358 fi 2359 fi 2360 ac_cv_func_initscr=yes 2361 ;; 2362esac 2363 2364if test ".$ac_cv_func_initscr" != .yes ; then 2365 cf_save_LIBS="$LIBS" 2366 2367 if test ".${cf_cv_ncurses_version:-no}" != .no 2368 then 2369 cf_check_list="ncurses curses cursesX" 2370 else 2371 cf_check_list="cursesX curses ncurses" 2372 fi 2373 2374 # Check for library containing tgoto. Do this before curses library 2375 # because it may be needed to link the test-case for initscr. 2376 if test "x$cf_term_lib" = x 2377 then 2378 AC_CHECK_FUNC(tgoto,[cf_term_lib=predefined],[ 2379 for cf_term_lib in $cf_check_list otermcap termcap tinfo termlib unknown 2380 do 2381 AC_CHECK_LIB($cf_term_lib,tgoto,[ 2382 : ${cf_nculib_root:=$cf_term_lib} 2383 break 2384 ]) 2385 done 2386 ]) 2387 fi 2388 2389 # Check for library containing initscr 2390 test "$cf_term_lib" != predefined && test "$cf_term_lib" != unknown && LIBS="-l$cf_term_lib $cf_save_LIBS" 2391 if test "x$cf_curs_lib" = x 2392 then 2393 for cf_curs_lib in $cf_check_list xcurses jcurses pdcurses unknown 2394 do 2395 LIBS="-l$cf_curs_lib $cf_save_LIBS" 2396 if test "$cf_term_lib" = unknown || test "$cf_term_lib" = "$cf_curs_lib" ; then 2397 AC_MSG_CHECKING(if we can link with $cf_curs_lib library) 2398 AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>], 2399 [initscr()], 2400 [cf_result=yes], 2401 [cf_result=no]) 2402 AC_MSG_RESULT($cf_result) 2403 test $cf_result = yes && break 2404 elif test "$cf_curs_lib" = "$cf_term_lib" ; then 2405 cf_result=no 2406 elif test "$cf_term_lib" != predefined ; then 2407 AC_MSG_CHECKING(if we need both $cf_curs_lib and $cf_term_lib libraries) 2408 AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>], 2409 [initscr(); tgoto((char *)0, 0, 0);], 2410 [cf_result=no], 2411 [ 2412 LIBS="-l$cf_curs_lib -l$cf_term_lib $cf_save_LIBS" 2413 AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>], 2414 [initscr()], 2415 [cf_result=yes], 2416 [cf_result=error]) 2417 ]) 2418 AC_MSG_RESULT($cf_result) 2419 test $cf_result != error && break 2420 fi 2421 done 2422 fi 2423 test $cf_curs_lib = unknown && AC_MSG_ERROR(no curses library found) 2424fi 2425fi 2426 2427])dnl 2428dnl --------------------------------------------------------------------------- 2429dnl CF_CURSES_TERMCAP version: 12 updated: 2015/05/15 19:42:24 2430dnl ----------------- 2431dnl Check if we should include <curses.h> to pick up prototypes for termcap 2432dnl functions. On terminfo systems, these are normally declared in <curses.h>, 2433dnl but may be in <term.h>. We check for termcap.h as an alternate, but it 2434dnl isn't standard (usually associated with GNU termcap). 2435dnl 2436dnl The 'tgoto()' function is declared in both terminfo and termcap. 2437dnl 2438dnl See CF_TYPE_OUTCHAR for more details. 2439AC_DEFUN([CF_CURSES_TERMCAP], 2440[ 2441AC_REQUIRE([CF_CURSES_TERM_H]) 2442AC_CACHE_CHECK(if we should include curses.h or termcap.h, cf_cv_need_curses_h,[ 2443cf_save_CPPFLAGS="$CPPFLAGS" 2444cf_cv_need_curses_h=no 2445 2446for cf_t_opts in "" "NEED_TERMCAP_H" 2447do 2448for cf_c_opts in "" "NEED_CURSES_H" 2449do 2450 2451 CPPFLAGS="$cf_save_CPPFLAGS $CHECK_DECL_FLAG" 2452 test -n "$cf_c_opts" && CPPFLAGS="$CPPFLAGS -D$cf_c_opts" 2453 test -n "$cf_t_opts" && CPPFLAGS="$CPPFLAGS -D$cf_t_opts" 2454 2455 AC_TRY_LINK([/* $cf_c_opts $cf_t_opts */ 2456$CHECK_DECL_HDRS], 2457 [char *x = (char *)tgoto("")], 2458 [test "$cf_cv_need_curses_h" = no && { 2459 cf_cv_need_curses_h=maybe 2460 cf_ok_c_opts=$cf_c_opts 2461 cf_ok_t_opts=$cf_t_opts 2462 }], 2463 [echo "Recompiling with corrected call (C:$cf_c_opts, T:$cf_t_opts)" >&AC_FD_CC 2464 AC_TRY_LINK([ 2465$CHECK_DECL_HDRS], 2466 [char *x = (char *)tgoto("",0,0)], 2467 [cf_cv_need_curses_h=yes 2468 cf_ok_c_opts=$cf_c_opts 2469 cf_ok_t_opts=$cf_t_opts])]) 2470 2471 CPPFLAGS="$cf_save_CPPFLAGS" 2472 test "$cf_cv_need_curses_h" = yes && break 2473done 2474 test "$cf_cv_need_curses_h" = yes && break 2475done 2476 2477if test "$cf_cv_need_curses_h" != no ; then 2478 echo "Curses/termcap test = $cf_cv_need_curses_h (C:$cf_ok_c_opts, T:$cf_ok_t_opts)" >&AC_FD_CC 2479 if test -n "$cf_ok_c_opts" ; then 2480 if test -n "$cf_ok_t_opts" ; then 2481 cf_cv_need_curses_h=both 2482 else 2483 cf_cv_need_curses_h=curses.h 2484 fi 2485 elif test -n "$cf_ok_t_opts" ; then 2486 cf_cv_need_curses_h=termcap.h 2487 elif test "$cf_cv_term_header" != no ; then 2488 cf_cv_need_curses_h=term.h 2489 else 2490 cf_cv_need_curses_h=no 2491 fi 2492fi 2493]) 2494 2495case $cf_cv_need_curses_h in 2496both) 2497 AC_DEFINE_UNQUOTED(NEED_CURSES_H,1,[Define to 1 if we must include curses.h]) 2498 AC_DEFINE_UNQUOTED(NEED_TERMCAP_H,1,[Define to 1 if we must include termcap.h]) 2499 ;; 2500curses.h) 2501 AC_DEFINE_UNQUOTED(NEED_CURSES_H,1,[Define to 1 if we must include curses.h]) 2502 ;; 2503term.h) 2504 AC_DEFINE_UNQUOTED(NEED_TERM_H,1,[Define to 1 if we must include term.h]) 2505 ;; 2506termcap.h) 2507 AC_DEFINE_UNQUOTED(NEED_TERMCAP_H,1,[Define to 1 if we must include termcap.h]) 2508 ;; 2509esac 2510 2511])dnl 2512dnl --------------------------------------------------------------------------- 2513dnl CF_CURSES_TERM_H version: 12 updated: 2020/03/19 20:23:48 2514dnl ---------------- 2515dnl SVr4 curses should have term.h as well (where it puts the definitions of 2516dnl the low-level interface). This may not be true in old/broken implementations, 2517dnl as well as in misconfigured systems (e.g., gcc configured for Solaris 2.4 2518dnl running with Solaris 2.5.1). 2519AC_DEFUN([CF_CURSES_TERM_H], 2520[ 2521AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl 2522 2523AC_CACHE_CHECK(for term.h, cf_cv_term_header,[ 2524 2525# If we found <ncurses/curses.h>, look for <ncurses/term.h>, but always look 2526# for <term.h> if we do not find the variant. 2527 2528cf_header_list="term.h ncurses/term.h ncursesw/term.h" 2529 2530case ${cf_cv_ncurses_header:-curses.h} in 2531*/*) 2532 cf_header_item=`echo ${cf_cv_ncurses_header:-curses.h} | sed -e 's%\..*%%' -e 's%/.*%/%'`term.h 2533 cf_header_list="$cf_header_item $cf_header_list" 2534 ;; 2535esac 2536 2537for cf_header in $cf_header_list 2538do 2539 AC_TRY_COMPILE([ 2540#include <${cf_cv_ncurses_header:-curses.h}> 2541#include <${cf_header}>], 2542 [WINDOW *x; (void)x], 2543 [cf_cv_term_header=$cf_header 2544 break], 2545 [cf_cv_term_header=no]) 2546done 2547 2548case $cf_cv_term_header in 2549no) 2550 # If curses is ncurses, some packagers still mess it up by trying to make 2551 # us use GNU termcap. This handles the most common case. 2552 for cf_header in ncurses/term.h ncursesw/term.h 2553 do 2554 AC_TRY_COMPILE([ 2555#include <${cf_cv_ncurses_header:-curses.h}> 2556#ifdef NCURSES_VERSION 2557#include <${cf_header}> 2558#else 2559make an error 2560#endif], 2561 [WINDOW *x; (void)x], 2562 [cf_cv_term_header=$cf_header 2563 break], 2564 [cf_cv_term_header=no]) 2565 done 2566 ;; 2567esac 2568]) 2569 2570case $cf_cv_term_header in 2571term.h) 2572 AC_DEFINE(HAVE_TERM_H,1,[Define to 1 if we have term.h]) 2573 ;; 2574ncurses/term.h) 2575 AC_DEFINE(HAVE_NCURSES_TERM_H,1,[Define to 1 if we have ncurses/term.h]) 2576 ;; 2577ncursesw/term.h) 2578 AC_DEFINE(HAVE_NCURSESW_TERM_H,1,[Define to 1 if we have ncursesw/term.h]) 2579 ;; 2580esac 2581])dnl 2582dnl --------------------------------------------------------------------------- 2583dnl CF_DEFAULT_SHELL version: 7 updated: 2019/12/31 20:39:42 2584dnl ---------------- 2585dnl Look for a Bourne-shell compatible program from a list that we know about: 2586dnl ash Almquist Shell (sh based) 2587dnl bash Bourne Again Shell (sh, ksh based) 2588dnl dash Debian Almquist Shell (sh based) 2589dnl jsh Job Control Bourne Shell (sh based) 2590dnl keysh Key Shell (ksh based) 2591dnl ksh Korn Shell (sh based) 2592dnl mksh MirBSD Korn shell (pdksh based) 2593dnl pdksh Public-domain ksh 2594dnl sh Bourne Shell or POSIX Shell 2595dnl zsh Z Shell (sh, ksh based) 2596dnl On BSD systems look for a C Shell compatible program: 2597dnl csh C Shell 2598dnl tcsh TENEX C Shell (csh based) 2599AC_DEFUN([CF_DEFAULT_SHELL], 2600[ 2601AC_MSG_CHECKING(for the default shell program) 2602cf_shell_progs="ifelse($1,,sh,[$1])" 2603if test -z "$cf_shell_progs" ; then 2604 cf_shell_progs="sh ksh bash zsh pdksh mksh jsh keysh ash dash" 2605 # TIN preferred default shell for BSD systems is csh. Others are sh. 2606 AC_TRY_COMPILE([ 2607#include <sys/params.h>],[ 2608#if (defined(BSD) && (BSD >= 199103)) 2609#else 2610make an error 2611#endif 2612],[$cf_shell_progs="csh tcsh $cf_shell_progs"]) 2613fi 2614CF_MSG_LOG(paths of shell programs: $cf_shell_progs) 2615if test -s /etc/shells && test `egrep -c -v '^(#| | |$)' /etc/shells` -gt 0; then 2616 CF_MSG_LOG(/etc/shells) 2617 for cf_prog in $cf_shell_progs 2618 do 2619 case $cf_prog in 2620 /*) 2621 cf_pattern="^"$cf_prog"$" 2622 ;; 2623 */*) 2624 AC_MSG_ERROR(Program name must be absolute or filename: $cf_prog) 2625 ;; 2626 *) 2627 cf_pattern="/"$cf_prog"$" 2628 ;; 2629 esac 2630 cf_path=`egrep $cf_pattern /etc/shells 2>/dev/null` 2631 if test -n "$cf_path" 2632 then 2633 for cf_shell in $cf_path 2634 do 2635 if test -f "$cf_shell" 2636 then 2637 DEFAULT_SHELL="$cf_shell" 2638 break 2639 fi 2640 done 2641 fi 2642 if test -n "$DEFAULT_SHELL" 2643 then 2644 break 2645 fi 2646 done 2647 AC_MSG_RESULT($DEFAULT_SHELL) 2648else 2649 CF_MSG_LOG($PATH) 2650AC_PATH_PROGS(DEFAULT_SHELL, 2651 $cf_shell_progs,, 2652 $PATH:/bin:/usr/bin:/usr/xpg4/bin:/bin/posix:/usr/bin/posix:/usr/old/bin:/usr/local/bin) 2653fi 2654if test -z "$DEFAULT_SHELL" ; then 2655 AC_MSG_WARN( 2656Cannot find the default shell you specified: $cf_shell_progs) 2657 if test -f /bin/false ; then 2658 AC_MSG_WARN(Using /bin/false instead) 2659 DEFAULT_SHELL=/bin/false 2660 else 2661 AC_MSG_ERROR(Cannot use /bin/false because it does not exist) 2662 fi 2663fi 2664AC_DEFINE_UNQUOTED(DEFAULT_SHELL,"$DEFAULT_SHELL",[Define this to the default shell-program]) 2665])dnl 2666dnl --------------------------------------------------------------------------- 2667dnl CF_DEFINE_STRING version: 3 updated: 2019/12/31 20:39:42 2668dnl ---------------- 2669dnl Define a string which may contain escaped quotes or backslashes 2670dnl $1 = symbol to define 2671dnl $2 = the information we want to quote 2672AC_DEFUN([CF_DEFINE_STRING], 2673[ 2674cf_define=`echo $2|sed -e 's/\\\\/\\\\134/g' -e 's/^[[ ]]\\+//' -e 's/[[ ]]\\+$//' -e 's/"/\\\\042/g'` 2675AC_DEFINE_UNQUOTED($1, "$cf_define", [Define a value for $1]) 2676])dnl 2677dnl --------------------------------------------------------------------------- 2678dnl CF_DIRNAME version: 4 updated: 2002/12/21 19:25:52 2679dnl ---------- 2680dnl "dirname" is not portable, so we fake it with a shell script. 2681AC_DEFUN([CF_DIRNAME],[$1=`echo $2 | sed -e 's%/[[^/]]*$%%'`])dnl 2682dnl --------------------------------------------------------------------------- 2683dnl CF_DISABLE_ECHO version: 13 updated: 2015/04/18 08:56:57 2684dnl --------------- 2685dnl You can always use "make -n" to see the actual options, but it's hard to 2686dnl pick out/analyze warning messages when the compile-line is long. 2687dnl 2688dnl Sets: 2689dnl ECHO_LT - symbol to control if libtool is verbose 2690dnl ECHO_LD - symbol to prefix "cc -o" lines 2691dnl RULE_CC - symbol to put before implicit "cc -c" lines (e.g., .c.o) 2692dnl SHOW_CC - symbol to put before explicit "cc -c" lines 2693dnl ECHO_CC - symbol to put before any "cc" line 2694dnl 2695AC_DEFUN([CF_DISABLE_ECHO],[ 2696AC_MSG_CHECKING(if you want to see long compiling messages) 2697CF_ARG_DISABLE(echo, 2698 [ --disable-echo do not display "compiling" commands], 2699 [ 2700 ECHO_LT='--silent' 2701 ECHO_LD='@echo linking [$]@;' 2702 RULE_CC='@echo compiling [$]<' 2703 SHOW_CC='@echo compiling [$]@' 2704 ECHO_CC='@' 2705],[ 2706 ECHO_LT='' 2707 ECHO_LD='' 2708 RULE_CC='' 2709 SHOW_CC='' 2710 ECHO_CC='' 2711]) 2712AC_MSG_RESULT($enableval) 2713AC_SUBST(ECHO_LT) 2714AC_SUBST(ECHO_LD) 2715AC_SUBST(RULE_CC) 2716AC_SUBST(SHOW_CC) 2717AC_SUBST(ECHO_CC) 2718])dnl 2719dnl --------------------------------------------------------------------------- 2720dnl CF_ERRNO version: 5 updated: 1997/11/30 12:44:39 2721dnl -------- 2722dnl Check if 'errno' is declared in <errno.h> 2723AC_DEFUN([CF_ERRNO], 2724[ 2725CF_CHECK_ERRNO(errno) 2726])dnl 2727dnl --------------------------------------------------------------------------- 2728dnl CF_FIND_CANLOCK version: 1 updated: 2020/01/09 20:03:25 2729dnl --------------- 2730dnl Look for CANLOCK, to use instead of a bundled copy of CANLOCK. 2731dnl 2732dnl $1 = variable to set with CANLOCK's CPPFLAGS 2733dnl $2 = variable to set with CANLOCK's LIBS 2734dnl $3 = action to take on success 2735dnl $4 = action to take on failure 2736AC_DEFUN([CF_FIND_CANLOCK],[ 2737AC_REQUIRE([CF_PKG_CONFIG]) 2738 2739cf_save_CFLAGS="$CFLAGS" 2740cf_save_LIBS="$LIBS" 2741cf_find_CANLOCK=yes 2742 2743CF_TRY_PKG_CONFIG(libcanlock3,,[ 2744 CF_TRY_PKG_CONFIG(libcanlock,,[ 2745 cf_pkgconfig_incs= 2746 cf_pkgconfig_libs= 2747 for cf_canlock_lib in canlock3 canlock 2748 do 2749 AC_CHECK_LIB($cf_canlock_lib,cl_clear_secret,[ 2750 cf_pkgconfig_libs="-l$cf_canlock_lib" 2751 break 2752 ]) 2753 done 2754 if test -z "$cf_pkgconfig_libs" ; then 2755 cf_find_CANLOCK=no 2756 else 2757 AC_CHECK_HEADERS(libcanlock-3/canlock.h canlock.h) 2758 fi 2759 ]) 2760 ]) 2761 2762CFLAGS="$cf_save_CFLAGS" 2763LIBS="$cf_save_LIBS" 2764 2765$1="$cf_pkgconfig_incs" 2766$2="$cf_pkgconfig_libs" 2767 2768if test "$cf_find_CANLOCK" = yes; then 2769 $3 2770else 2771 $4 2772fi 2773])dnl 2774dnl --------------------------------------------------------------------------- 2775dnl CF_FIND_IPV6_LIBS version: 8 updated: 2015/04/15 19:08:48 2776dnl ----------------- 2777dnl Based on the IPV6 stack type, look for the corresponding library. 2778AC_DEFUN([CF_FIND_IPV6_LIBS],[ 2779AC_REQUIRE([CF_FIND_IPV6_TYPE]) 2780 2781cf_ipv6lib=none 2782cf_ipv6dir=none 2783 2784AC_MSG_CHECKING(for IPv6 library if required) 2785case $cf_cv_ipv6type in 2786solaris) 2787 ;; 2788inria) 2789 ;; 2790kame) 2791 dnl http://www.kame.net/ 2792 cf_ipv6lib=inet6 2793 cf_ipv6dir=v6 2794 ;; 2795linux-glibc) 2796 ;; 2797linux-libinet6) 2798 dnl http://www.v6.linux.or.jp/ 2799 cf_ipv6lib=inet6 2800 cf_ipv6dir=inet6 2801 ;; 2802toshiba) 2803 cf_ipv6lib=inet6 2804 cf_ipv6dir=v6 2805 ;; 2806v6d) 2807 cf_ipv6lib=v6 2808 cf_ipv6dir=v6 2809 ;; 2810zeta) 2811 cf_ipv6lib=inet6 2812 cf_ipv6dir=v6 2813 ;; 2814esac 2815AC_MSG_RESULT($cf_ipv6lib) 2816 2817if test "$cf_ipv6lib" != "none"; then 2818 2819 AC_TRY_LINK([ 2820#include <sys/types.h> 2821#include <netdb.h> 2822#include <netinet/in.h> 2823#include <netinet/ip6.h>], 2824 [getaddrinfo(0, 0, 0, 0)],,[ 2825 CF_HEADER_PATH(cf_search,$cf_ipv6dir) 2826 for cf_incdir in $cf_search 2827 do 2828 cf_header=$cf_incdir/netinet/ip6.h 2829 if test -f $cf_header 2830 then 2831 CF_ADD_INCDIR($cf_incdir) 2832 test -n "$verbose" && echo " ... found $cf_header" 1>&AC_FD_MSG 2833 break 2834 fi 2835 test -n "$verbose" && echo " ... tested $cf_header" 1>&AC_FD_MSG 2836 done 2837 ]) 2838 2839 CF_FIND_LIBRARY([$cf_ipv6lib],[$cf_ipv6dir],[ 2840#include <sys/types.h> 2841#include <netdb.h> 2842#include <netinet/in.h> 2843#include <netinet/ip6.h>], 2844 [getaddrinfo(0, 0, 0, 0)], 2845 [getaddrinfo], 2846 noexit) 2847 if test $cf_found_library = no ; then 2848 AC_MSG_ERROR( 2849[No $cf_ipv6lib library found, cannot continue. You must fetch lib$cf_ipv6lib.a 2850from an appropriate IPv6 kit and compile beforehand.]) 2851 fi 2852fi 2853 2854])dnl 2855dnl --------------------------------------------------------------------------- 2856dnl CF_FIND_IPV6_TYPE version: 6 updated: 2015/04/15 19:08:48 2857dnl ----------------- 2858AC_DEFUN([CF_FIND_IPV6_TYPE],[ 2859AC_CACHE_CHECK(ipv6 stack type, cf_cv_ipv6type, [ 2860cf_cv_ipv6type=unknown 2861for i in solaris inria kame linux-glibc linux-libinet6 toshiba v6d zeta 2862do 2863 case $i in 2864 solaris) 2865 if test "SunOS" = "`uname -s`" 2866 then 2867 if test -f /usr/include/netinet/ip6.h 2868 then 2869 cf_cv_ipv6type=$i 2870 fi 2871 fi 2872 ;; 2873 inria) 2874 dnl http://www.kame.net/ 2875 AC_EGREP_CPP(yes, [ 2876#include <netinet/in.h> 2877#ifdef IPV6_INRIA_VERSION 2878yes 2879#endif], [cf_cv_ipv6type=$i]) 2880 ;; 2881 kame) 2882 dnl http://www.kame.net/ 2883 AC_EGREP_CPP(yes, [ 2884#include <netinet/in.h> 2885#ifdef __KAME__ 2886yes 2887#endif], [cf_cv_ipv6type=$i]) 2888 ;; 2889 linux-glibc) 2890 dnl http://www.v6.linux.or.jp/ 2891 AC_EGREP_CPP(yes, [ 2892#include <features.h> 2893#if defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 2894yes 2895#endif], [cf_cv_ipv6type=$i]) 2896 ;; 2897 linux-libinet6) 2898 dnl http://www.v6.linux.or.jp/ 2899 if test -d /usr/inet6 2900 then 2901 cf_cv_ipv6type=$i 2902 elif test -f /usr/include/netinet/ip6.h 2903 then 2904 cf_cv_ipv6type=$i 2905 fi 2906 ;; 2907 toshiba) 2908 AC_EGREP_CPP(yes, [ 2909#include <sys/param.h> 2910#ifdef _TOSHIBA_INET6 2911yes 2912#endif], [cf_cv_ipv6type=$i]) 2913 ;; 2914 v6d) 2915 AC_EGREP_CPP(yes, [ 2916#include </usr/local/v6/include/sys/v6config.h> 2917#ifdef __V6D__ 2918yes 2919#endif], [cf_cv_ipv6type=$i]) 2920 ;; 2921 zeta) 2922 AC_EGREP_CPP(yes, [ 2923#include <sys/param.h> 2924#ifdef _ZETA_MINAMI_INET6 2925yes 2926#endif], [cf_cv_ipv6type=$i]) 2927 ;; 2928 esac 2929 if test "$cf_cv_ipv6type" != "unknown"; then 2930 break 2931 fi 2932done 2933]) 2934])dnl 2935dnl --------------------------------------------------------------------------- 2936dnl CF_FIND_LIBRARY version: 9 updated: 2008/03/23 14:48:54 2937dnl --------------- 2938dnl Look for a non-standard library, given parameters for AC_TRY_LINK. We 2939dnl prefer a standard location, and use -L options only if we do not find the 2940dnl library in the standard library location(s). 2941dnl $1 = library name 2942dnl $2 = library class, usually the same as library name 2943dnl $3 = includes 2944dnl $4 = code fragment to compile/link 2945dnl $5 = corresponding function-name 2946dnl $6 = flag, nonnull if failure should not cause an error-exit 2947dnl 2948dnl Sets the variable "$cf_libdir" as a side-effect, so we can see if we had 2949dnl to use a -L option. 2950AC_DEFUN([CF_FIND_LIBRARY], 2951[ 2952 eval 'cf_cv_have_lib_'$1'=no' 2953 cf_libdir="" 2954 AC_CHECK_FUNC($5, 2955 eval 'cf_cv_have_lib_'$1'=yes',[ 2956 cf_save_LIBS="$LIBS" 2957 AC_MSG_CHECKING(for $5 in -l$1) 2958 LIBS="-l$1 $LIBS" 2959 AC_TRY_LINK([$3],[$4], 2960 [AC_MSG_RESULT(yes) 2961 eval 'cf_cv_have_lib_'$1'=yes' 2962 ], 2963 [AC_MSG_RESULT(no) 2964 CF_LIBRARY_PATH(cf_search,$2) 2965 for cf_libdir in $cf_search 2966 do 2967 AC_MSG_CHECKING(for -l$1 in $cf_libdir) 2968 LIBS="-L$cf_libdir -l$1 $cf_save_LIBS" 2969 AC_TRY_LINK([$3],[$4], 2970 [AC_MSG_RESULT(yes) 2971 eval 'cf_cv_have_lib_'$1'=yes' 2972 break], 2973 [AC_MSG_RESULT(no) 2974 LIBS="$cf_save_LIBS"]) 2975 done 2976 ]) 2977 ]) 2978eval 'cf_found_library=[$]cf_cv_have_lib_'$1 2979ifelse($6,,[ 2980if test $cf_found_library = no ; then 2981 AC_MSG_ERROR(Cannot link $1 library) 2982fi 2983]) 2984])dnl 2985dnl --------------------------------------------------------------------------- 2986dnl CF_FIND_LINKAGE version: 21 updated: 2018/06/20 20:23:13 2987dnl --------------- 2988dnl Find a library (specifically the linkage used in the code fragment), 2989dnl searching for it if it is not already in the library path. 2990dnl See also CF_ADD_SEARCHPATH. 2991dnl 2992dnl Parameters (4-on are optional): 2993dnl $1 = headers for library entrypoint 2994dnl $2 = code fragment for library entrypoint 2995dnl $3 = the library name without the "-l" option or ".so" suffix. 2996dnl $4 = action to perform if successful (default: update CPPFLAGS, etc) 2997dnl $5 = action to perform if not successful 2998dnl $6 = module name, if not the same as the library name 2999dnl $7 = extra libraries 3000dnl 3001dnl Sets these variables: 3002dnl $cf_cv_find_linkage_$3 - yes/no according to whether linkage is found 3003dnl $cf_cv_header_path_$3 - include-directory if needed 3004dnl $cf_cv_library_path_$3 - library-directory if needed 3005dnl $cf_cv_library_file_$3 - library-file if needed, e.g., -l$3 3006AC_DEFUN([CF_FIND_LINKAGE],[ 3007 3008# If the linkage is not already in the $CPPFLAGS/$LDFLAGS configuration, these 3009# will be set on completion of the AC_TRY_LINK below. 3010cf_cv_header_path_$3= 3011cf_cv_library_path_$3= 3012 3013CF_MSG_LOG([Starting [FIND_LINKAGE]($3,$6)]) 3014 3015cf_save_LIBS="$LIBS" 3016 3017AC_TRY_LINK([$1],[$2],[ 3018 cf_cv_find_linkage_$3=yes 3019 cf_cv_header_path_$3=/usr/include 3020 cf_cv_library_path_$3=/usr/lib 3021],[ 3022 3023LIBS="-l$3 $7 $cf_save_LIBS" 3024 3025AC_TRY_LINK([$1],[$2],[ 3026 cf_cv_find_linkage_$3=yes 3027 cf_cv_header_path_$3=/usr/include 3028 cf_cv_library_path_$3=/usr/lib 3029 cf_cv_library_file_$3="-l$3" 3030],[ 3031 cf_cv_find_linkage_$3=no 3032 LIBS="$cf_save_LIBS" 3033 3034 CF_VERBOSE(find linkage for $3 library) 3035 CF_MSG_LOG([Searching for headers in [FIND_LINKAGE]($3,$6)]) 3036 3037 cf_save_CPPFLAGS="$CPPFLAGS" 3038 cf_test_CPPFLAGS="$CPPFLAGS" 3039 3040 CF_HEADER_PATH(cf_search,ifelse([$6],,[$3],[$6])) 3041 for cf_cv_header_path_$3 in $cf_search 3042 do 3043 if test -d $cf_cv_header_path_$3 ; then 3044 CF_VERBOSE(... testing $cf_cv_header_path_$3) 3045 CPPFLAGS="$cf_save_CPPFLAGS" 3046 CF_APPEND_TEXT(CPPFLAGS,-I$cf_cv_header_path_$3) 3047 AC_TRY_COMPILE([$1],[$2],[ 3048 CF_VERBOSE(... found $3 headers in $cf_cv_header_path_$3) 3049 cf_cv_find_linkage_$3=maybe 3050 cf_test_CPPFLAGS="$CPPFLAGS" 3051 break],[ 3052 CPPFLAGS="$cf_save_CPPFLAGS" 3053 ]) 3054 fi 3055 done 3056 3057 if test "$cf_cv_find_linkage_$3" = maybe ; then 3058 3059 CF_MSG_LOG([Searching for $3 library in [FIND_LINKAGE]($3,$6)]) 3060 3061 cf_save_LIBS="$LIBS" 3062 cf_save_LDFLAGS="$LDFLAGS" 3063 3064 ifelse([$6],,,[ 3065 CPPFLAGS="$cf_test_CPPFLAGS" 3066 LIBS="-l$3 $7 $cf_save_LIBS" 3067 AC_TRY_LINK([$1],[$2],[ 3068 CF_VERBOSE(... found $3 library in system) 3069 cf_cv_find_linkage_$3=yes]) 3070 CPPFLAGS="$cf_save_CPPFLAGS" 3071 LIBS="$cf_save_LIBS" 3072 ]) 3073 3074 if test "$cf_cv_find_linkage_$3" != yes ; then 3075 CF_LIBRARY_PATH(cf_search,$3) 3076 for cf_cv_library_path_$3 in $cf_search 3077 do 3078 if test -d $cf_cv_library_path_$3 ; then 3079 CF_VERBOSE(... testing $cf_cv_library_path_$3) 3080 CPPFLAGS="$cf_test_CPPFLAGS" 3081 LIBS="-l$3 $7 $cf_save_LIBS" 3082 LDFLAGS="$cf_save_LDFLAGS -L$cf_cv_library_path_$3" 3083 AC_TRY_LINK([$1],[$2],[ 3084 CF_VERBOSE(... found $3 library in $cf_cv_library_path_$3) 3085 cf_cv_find_linkage_$3=yes 3086 cf_cv_library_file_$3="-l$3" 3087 break],[ 3088 CPPFLAGS="$cf_save_CPPFLAGS" 3089 LIBS="$cf_save_LIBS" 3090 LDFLAGS="$cf_save_LDFLAGS" 3091 ]) 3092 fi 3093 done 3094 CPPFLAGS="$cf_save_CPPFLAGS" 3095 LDFLAGS="$cf_save_LDFLAGS" 3096 fi 3097 3098 else 3099 cf_cv_find_linkage_$3=no 3100 fi 3101 ],$7) 3102]) 3103 3104LIBS="$cf_save_LIBS" 3105 3106if test "$cf_cv_find_linkage_$3" = yes ; then 3107ifelse([$4],,[ 3108 CF_ADD_INCDIR($cf_cv_header_path_$3) 3109 CF_ADD_LIBDIR($cf_cv_library_path_$3) 3110 CF_ADD_LIB($3) 3111],[$4]) 3112else 3113ifelse([$5],,AC_MSG_WARN(Cannot find $3 library),[$5]) 3114fi 3115])dnl 3116dnl --------------------------------------------------------------------------- 3117dnl CF_FIND_PCRE version: 1 updated: 2020/01/01 16:29:19 3118dnl ------------ 3119dnl Look for PCRE, to use instead of a bundled copy of PCRE. 3120dnl 3121dnl $1 = variable to set with PCRE's CPPFLAGS 3122dnl $2 = variable to set with PCRE's LIBS 3123dnl $3 = action to take on success 3124dnl $4 = action to take on failure 3125AC_DEFUN([CF_FIND_PCRE],[ 3126AC_REQUIRE([CF_PKG_CONFIG]) 3127 3128cf_save_CFLAGS="$CFLAGS" 3129cf_save_LIBS="$LIBS" 3130cf_find_PCRE=yes 3131 3132CF_TRY_PKG_CONFIG(libpcre2,,[ 3133 CF_TRY_PKG_CONFIG(libpcre,,[ 3134 AC_CHECK_LIB(pcre,pcre_compile,[ 3135 CF_ADD_LIB(pcre) 3136 AC_CHECK_LIB(pcre2-posix,regcomp,[ 3137 CF_ADD_LIB(pcre2-posix)],[ 3138 AC_CHECK_LIB(pcreposix,regcomp,[ 3139 CF_ADD_LIB(pcreposix) 3140 ],[ 3141 cf_find_PCRE=no 3142 ]) 3143 ]) 3144 ],[ 3145 cf_find_PCRE=no 3146 ]) 3147 ]) 3148 ]) 3149 3150CFLAGS="$cf_save_CFLAGS" 3151LIBS="$cf_save_LIBS" 3152 3153$1="$cf_pkgconfig_incs" 3154$2="$cf_pkgconfig_libs" 3155 3156if test "$cf_find_PCRE" = yes; then 3157 $3 3158else 3159 $4 3160fi 3161])dnl 3162dnl --------------------------------------------------------------------------- 3163dnl CF_FIX_SLASHES version: 2 updated: 2001/05/27 21:36:02 3164dnl -------------- 3165dnl OS/2 and Cygwin ports may pick up backslashes in pathnames, which are not 3166dnl usable in quoted strings. Fix them. 3167dnl $1=fixed($2) 3168AC_DEFUN([CF_FIX_SLASHES], 3169[ 3170case $cf_cv_system_name in #(vi 3171os2*|cygwin*) 3172 $1=`echo "[$]$1" | sed -e 's%\\\\%/%g'` 3173 ;; 3174esac 3175])dnl 3176dnl --------------------------------------------------------------------------- 3177dnl CF_FUNC_ALLOCA version: 2 updated: 2009/01/06 19:35:17 3178dnl -------------- 3179dnl workaround for bison 1.875c (compound breakage in Linux stdlib.h and 3180dnl bison's output make bison try to use alloca()). 3181AC_DEFUN([CF_FUNC_ALLOCA], 3182[ 3183AC_FUNC_ALLOCA 3184 3185case $host_os in 3186linux*|gnu*) 3187 # workaround for bison 1.875c (compound breakage in Linux stdlib.h 3188 # and bison's output make bison try to use alloca()). 3189 if test -z "$GCC" ; then 3190 CPPFLAGS="$CPPFLAGS -DYYSTACK_USE_ALLOCA=0" 3191 ALLOCA="" 3192 elif test "$INTEL_COMPILER" = yes ; then 3193 CPPFLAGS="$CPPFLAGS -DYYSTACK_USE_ALLOCA=0" 3194 ALLOCA="" 3195 fi 3196 ;; 3197esac 3198])dnl 3199dnl --------------------------------------------------------------------------- 3200dnl CF_FUNC_FORK version: 4 updated: 2010/10/23 15:52:32 3201dnl ------------ 3202dnl Check if 'fork()' is available, and working. Amiga (and possibly other 3203dnl machines) have a non-working 'fork()' entrypoint. 3204AC_DEFUN([CF_FUNC_FORK], 3205[AC_MSG_CHECKING([for fork]) 3206AC_CACHE_VAL(cf_cv_func_fork,[ 3207AC_TRY_RUN([ 3208int main() 3209{ 3210 if (fork() < 0) 3211 ${cf_cv_main_return:-return}(1); 3212 ${cf_cv_main_return:-return}(0); 3213}], [cf_cv_func_fork=yes], 3214 [cf_cv_func_fork=no], 3215 [cf_cv_func_fork=unknown]) 3216])dnl 3217AC_MSG_RESULT($cf_cv_func_fork) 3218test $cf_cv_func_fork = yes && AC_DEFINE(HAVE_FORK) 3219])dnl 3220dnl --------------------------------------------------------------------------- 3221dnl CF_FUNC_GETADDRINFO version: 9 updated: 2017/05/10 18:31:29 3222dnl ------------------- 3223dnl Look for a working version of getaddrinfo(), for IPV6 support. 3224AC_DEFUN([CF_FUNC_GETADDRINFO],[ 3225AC_CACHE_CHECK(working getaddrinfo, cf_cv_getaddrinfo,[ 3226AC_TRY_RUN([ 3227#include <sys/types.h> 3228#include <netdb.h> 3229#include <string.h> 3230#include <sys/socket.h> 3231#include <netinet/in.h> 3232 3233#define expect(a,b) if (strcmp(a,b) != 0) goto bad 3234 3235int main(void) 3236{ 3237 int passive, gaierr, inet4 = 0, inet6 = 0; 3238 struct addrinfo hints, *ai, *aitop; 3239 char straddr[INET6_ADDRSTRLEN], strport[16]; 3240 3241 for (passive = 0; passive <= 1; passive++) { 3242 memset(&hints, 0, sizeof(hints)); 3243 hints.ai_family = AF_UNSPEC; 3244 hints.ai_flags = passive ? AI_PASSIVE : 0; 3245 hints.ai_socktype = SOCK_STREAM; 3246 if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) { 3247 (void)gai_strerror(gaierr); 3248 goto bad; 3249 } 3250 for (ai = aitop; ai; ai = ai->ai_next) { 3251 if (ai->ai_addr == NULL || 3252 ai->ai_addrlen == 0 || 3253 getnameinfo(ai->ai_addr, ai->ai_addrlen, 3254 straddr, sizeof(straddr), strport, sizeof(strport), 3255 NI_NUMERICHOST|NI_NUMERICSERV) != 0) { 3256 goto bad; 3257 } 3258 switch (ai->ai_family) { 3259 case AF_INET: 3260 expect(strport, "54321"); 3261 if (passive) { 3262 expect(straddr, "0.0.0.0"); 3263 } else { 3264 expect(straddr, "127.0.0.1"); 3265 } 3266 inet4++; 3267 break; 3268 case AF_INET6: 3269 expect(strport, "54321"); 3270 if (passive) { 3271 expect(straddr, "::"); 3272 } else { 3273 expect(straddr, "::1"); 3274 } 3275 inet6++; 3276 break; 3277 case AF_UNSPEC: 3278 goto bad; 3279 break; 3280 default: 3281 /* another family support? */ 3282 break; 3283 } 3284 } 3285 } 3286 3287 if (!(inet4 == 0 || inet4 == 2)) 3288 goto bad; 3289 if (!(inet6 == 0 || inet6 == 2)) 3290 goto bad; 3291 3292 if (aitop) 3293 freeaddrinfo(aitop); 3294 ${cf_cv_main_return:-return}(0); 3295 3296 bad: 3297 if (aitop) 3298 freeaddrinfo(aitop); 3299 ${cf_cv_main_return:-return}(1); 3300} 3301], 3302[cf_cv_getaddrinfo=yes], 3303[cf_cv_getaddrinfo=no], 3304[cf_cv_getaddrinfo=unknown]) 3305]) 3306if test "$cf_cv_getaddrinfo" = yes ; then 3307 AC_DEFINE(HAVE_GAI_STRERROR,1,[Define to 1 if we have gai_strerror function]) 3308 AC_DEFINE(HAVE_GETADDRINFO,1,[Define to 1 if we have getaddrinfo function]) 3309fi 3310])dnl 3311dnl --------------------------------------------------------------------------- 3312dnl CF_FUNC_MEMMOVE version: 9 updated: 2017/01/21 11:06:25 3313dnl --------------- 3314dnl Check for memmove, or a bcopy that can handle overlapping copy. If neither 3315dnl is found, add our own version of memmove to the list of objects. 3316AC_DEFUN([CF_FUNC_MEMMOVE], 3317[ 3318AC_CHECK_FUNC(memmove,,[ 3319AC_CHECK_FUNC(bcopy,[ 3320 AC_CACHE_CHECK(if bcopy does overlapping moves,cf_cv_good_bcopy,[ 3321 AC_TRY_RUN([ 3322int main(void) { 3323 static char data[] = "abcdefghijklmnopqrstuwwxyz"; 3324 char temp[40]; 3325 bcopy(data, temp, sizeof(data)); 3326 bcopy(temp+10, temp, 15); 3327 bcopy(temp+5, temp+15, 10); 3328 ${cf_cv_main_return:-return} (strcmp(temp, "klmnopqrstuwwxypqrstuwwxyz")); 3329} 3330 ], 3331 [cf_cv_good_bcopy=yes], 3332 [cf_cv_good_bcopy=no], 3333 [cf_cv_good_bcopy=unknown]) 3334 ]) 3335 ],[cf_cv_good_bcopy=no]) 3336 if test "$cf_cv_good_bcopy" = yes ; then 3337 AC_DEFINE(USE_OK_BCOPY,1,[Define to 1 to use bcopy when memmove is unavailable]) 3338 else 3339 AC_DEFINE(USE_MY_MEMMOVE,1,[Define to 1 to use replacement function when memmove is unavailable]) 3340 fi 3341])])dnl 3342dnl --------------------------------------------------------------------------- 3343dnl CF_FUNC_SYSTEM version: 6 updated: 2019/12/31 20:39:42 3344dnl -------------- 3345dnl Check if the 'system()' function returns a usable status, or if not, try 3346dnl to use the status returned by a SIGCHLD. 3347AC_DEFUN([CF_FUNC_SYSTEM], 3348[ 3349AC_REQUIRE([CF_UNION_WAIT]) 3350AC_MSG_CHECKING(if the system function returns usable child-status) 3351AC_CACHE_VAL(cf_cv_system_status,[ 3352 AC_TRY_RUN([ 3353#include <stdio.h> 3354#include <signal.h> 3355#if HAVE_SYS_WAIT_H 3356#include <sys/wait.h> 3357#endif 3358 3359RETSIGTYPE signal_handler (int sig) 3360{ 3361#if HAVE_TYPE_UNIONWAIT 3362 union wait wait_status; 3363#else 3364 int wait_status = 1; 3365#endif 3366 int system_status; 3367 wait (&wait_status); 3368 system_status = WEXITSTATUS(wait_status); /* should be nonzero */ 3369 ${cf_cv_main_return:-return}(system_status != 23); 3370} 3371 3372int main() 3373{ 3374 /* this looks weird, but apparently the SIGCHLD gets there first on 3375 * machines where 'system()' doesn't return a usable code, so ... 3376 */ 3377 signal (SIGCHLD, signal_handler); 3378 system("exit 23"); 3379 ${cf_cv_main_return:-return}(1); 3380} 3381], 3382 [cf_cv_system_status=no], 3383 [AC_TRY_RUN( 3384 [int main() { ${cf_cv_main_return:-return}(system("exit 23") != (23 << 8)); }], 3385 [cf_cv_system_status=yes], 3386 [cf_cv_system_status=unknown], 3387 [cf_cv_system_status=unknown])], 3388 [cf_cv_system_status=unknown]) 3389]) 3390AC_MSG_RESULT($cf_cv_system_status) 3391test $cf_cv_system_status = no && AC_DEFINE(USE_SYSTEM_STATUS,1,[Define this to 1 if the system function returns usable exit-status]) 3392])dnl 3393dnl --------------------------------------------------------------------------- 3394dnl CF_GCC_VERSION version: 8 updated: 2019/09/07 13:38:36 3395dnl -------------- 3396dnl Find version of gcc, and (because icc/clang pretend to be gcc without being 3397dnl compatible), attempt to determine if icc/clang is actually used. 3398AC_DEFUN([CF_GCC_VERSION],[ 3399AC_REQUIRE([AC_PROG_CC]) 3400GCC_VERSION=none 3401if test "$GCC" = yes ; then 3402 AC_MSG_CHECKING(version of $CC) 3403 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.]].*//'`" 3404 test -z "$GCC_VERSION" && GCC_VERSION=unknown 3405 AC_MSG_RESULT($GCC_VERSION) 3406fi 3407CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS) 3408CF_CLANG_COMPILER(GCC,CLANG_COMPILER,CFLAGS) 3409])dnl 3410dnl --------------------------------------------------------------------------- 3411dnl CF_GCC_WARNINGS version: 38 updated: 2020/08/28 15:08:28 3412dnl --------------- 3413dnl Check if the compiler supports useful warning options. There's a few that 3414dnl we don't use, simply because they're too noisy: 3415dnl 3416dnl -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x) 3417dnl -Winline (usually not worthwhile) 3418dnl -Wredundant-decls (system headers make this too noisy) 3419dnl -Wtraditional (combines too many unrelated messages, only a few useful) 3420dnl -Wwrite-strings (too noisy, but should review occasionally). This 3421dnl is enabled for ncurses using "--enable-const". 3422dnl -pedantic 3423dnl 3424dnl Parameter: 3425dnl $1 is an optional list of gcc warning flags that a particular 3426dnl application might want to use, e.g., "no-unused" for 3427dnl -Wno-unused 3428dnl Special: 3429dnl If $with_ext_const is "yes", add a check for -Wwrite-strings 3430dnl 3431AC_DEFUN([CF_GCC_WARNINGS], 3432[ 3433AC_REQUIRE([CF_GCC_VERSION]) 3434if test "x$have_x" = xyes; then CF_CONST_X_STRING fi 3435cat > conftest.$ac_ext <<EOF 3436#line __oline__ "${as_me:-configure}" 3437int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; } 3438EOF 3439if test "$INTEL_COMPILER" = yes 3440then 3441# The "-wdXXX" options suppress warnings: 3442# remark #1419: external declaration in primary source file 3443# remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem) 3444# remark #1684: conversion from pointer to same-sized integral type (potential portability problem) 3445# remark #193: zero used for undefined preprocessing identifier 3446# remark #593: variable "curs_sb_left_arrow" was set but never used 3447# remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits 3448# remark #869: parameter "tw" was never referenced 3449# remark #981: operands are evaluated in unspecified order 3450# warning #279: controlling expression is constant 3451 3452 AC_CHECKING([for $CC warning options]) 3453 cf_save_CFLAGS="$CFLAGS" 3454 EXTRA_CFLAGS="$EXTRA_CFLAGS -Wall" 3455 for cf_opt in \ 3456 wd1419 \ 3457 wd1683 \ 3458 wd1684 \ 3459 wd193 \ 3460 wd593 \ 3461 wd279 \ 3462 wd810 \ 3463 wd869 \ 3464 wd981 3465 do 3466 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" 3467 if AC_TRY_EVAL(ac_compile); then 3468 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt) 3469 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" 3470 fi 3471 done 3472 CFLAGS="$cf_save_CFLAGS" 3473elif test "$GCC" = yes && test "$GCC_VERSION" != "unknown" 3474then 3475 AC_CHECKING([for $CC warning options]) 3476 cf_save_CFLAGS="$CFLAGS" 3477 cf_warn_CONST="" 3478 test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings" 3479 cf_gcc_warnings="Wignored-qualifiers Wlogical-op Wvarargs" 3480 test "x$CLANG_COMPILER" = xyes && cf_gcc_warnings= 3481 for cf_opt in W Wall \ 3482 Wbad-function-cast \ 3483 Wcast-align \ 3484 Wcast-qual \ 3485 Wdeclaration-after-statement \ 3486 Wextra \ 3487 Winline \ 3488 Wmissing-declarations \ 3489 Wmissing-prototypes \ 3490 Wnested-externs \ 3491 Wpointer-arith \ 3492 Wshadow \ 3493 Wstrict-prototypes \ 3494 Wundef Wno-inline $cf_gcc_warnings $cf_warn_CONST $1 3495 do 3496 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" 3497 if AC_TRY_EVAL(ac_compile); then 3498 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt) 3499 case $cf_opt in 3500 Winline) 3501 case $GCC_VERSION in 3502 [[34]].*) 3503 CF_VERBOSE(feature is broken in gcc $GCC_VERSION) 3504 continue;; 3505 esac 3506 ;; 3507 Wpointer-arith) 3508 case $GCC_VERSION in 3509 [[12]].*) 3510 CF_VERBOSE(feature is broken in gcc $GCC_VERSION) 3511 continue;; 3512 esac 3513 ;; 3514 esac 3515 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" 3516 fi 3517 done 3518 CFLAGS="$cf_save_CFLAGS" 3519fi 3520rm -rf conftest* 3521 3522AC_SUBST(EXTRA_CFLAGS) 3523])dnl 3524dnl --------------------------------------------------------------------------- 3525dnl CF_GNU_SOURCE version: 10 updated: 2018/12/10 20:09:41 3526dnl ------------- 3527dnl Check if we must define _GNU_SOURCE to get a reasonable value for 3528dnl _XOPEN_SOURCE, upon which many POSIX definitions depend. This is a defect 3529dnl (or misfeature) of glibc2, which breaks portability of many applications, 3530dnl since it is interwoven with GNU extensions. 3531dnl 3532dnl Well, yes we could work around it... 3533dnl 3534dnl Parameters: 3535dnl $1 is the nominal value for _XOPEN_SOURCE 3536AC_DEFUN([CF_GNU_SOURCE], 3537[ 3538cf_gnu_xopen_source=ifelse($1,,500,$1) 3539 3540AC_CACHE_CHECK(if this is the GNU C library,cf_cv_gnu_library,[ 3541AC_TRY_COMPILE([#include <sys/types.h>],[ 3542 #if __GLIBC__ > 0 && __GLIBC_MINOR__ >= 0 3543 return 0; 3544 #elif __NEWLIB__ > 0 && __NEWLIB_MINOR__ >= 0 3545 return 0; 3546 #else 3547 # error not GNU C library 3548 #endif], 3549 [cf_cv_gnu_library=yes], 3550 [cf_cv_gnu_library=no]) 3551]) 3552 3553if test x$cf_cv_gnu_library = xyes; then 3554 3555 # With glibc 2.19 (13 years after this check was begun), _DEFAULT_SOURCE 3556 # was changed to help a little. newlib incorporated the change about 4 3557 # years later. 3558 AC_CACHE_CHECK(if _DEFAULT_SOURCE can be used as a basis,cf_cv_gnu_library_219,[ 3559 cf_save="$CPPFLAGS" 3560 CF_APPEND_TEXT(CPPFLAGS,-D_DEFAULT_SOURCE) 3561 AC_TRY_COMPILE([#include <sys/types.h>],[ 3562 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 19) || (__GLIBC__ > 2) 3563 return 0; 3564 #elif (__NEWLIB__ == 2 && __NEWLIB_MINOR__ >= 4) || (__GLIBC__ > 3) 3565 return 0; 3566 #else 3567 # error GNU C library __GLIBC__.__GLIBC_MINOR__ is too old 3568 #endif], 3569 [cf_cv_gnu_library_219=yes], 3570 [cf_cv_gnu_library_219=no]) 3571 CPPFLAGS="$cf_save" 3572 ]) 3573 3574 if test "x$cf_cv_gnu_library_219" = xyes; then 3575 cf_save="$CPPFLAGS" 3576 AC_CACHE_CHECK(if _XOPEN_SOURCE=$cf_gnu_xopen_source works with _DEFAULT_SOURCE,cf_cv_gnu_dftsrc_219,[ 3577 CF_ADD_CFLAGS(-D_DEFAULT_SOURCE -D_XOPEN_SOURCE=$cf_gnu_xopen_source) 3578 AC_TRY_COMPILE([ 3579 #include <limits.h> 3580 #include <sys/types.h> 3581 ],[ 3582 #if (_XOPEN_SOURCE >= $cf_gnu_xopen_source) && (MB_LEN_MAX > 1) 3583 return 0; 3584 #else 3585 # error GNU C library is too old 3586 #endif], 3587 [cf_cv_gnu_dftsrc_219=yes], 3588 [cf_cv_gnu_dftsrc_219=no]) 3589 ]) 3590 test "x$cf_cv_gnu_dftsrc_219" = "xyes" || CPPFLAGS="$cf_save" 3591 else 3592 cf_cv_gnu_dftsrc_219=maybe 3593 fi 3594 3595 if test "x$cf_cv_gnu_dftsrc_219" != xyes; then 3596 3597 AC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[ 3598 AC_TRY_COMPILE([#include <sys/types.h>],[ 3599 #ifndef _XOPEN_SOURCE 3600 #error expected _XOPEN_SOURCE to be defined 3601 #endif], 3602 [cf_cv_gnu_source=no], 3603 [cf_save="$CPPFLAGS" 3604 CF_ADD_CFLAGS(-D_GNU_SOURCE) 3605 AC_TRY_COMPILE([#include <sys/types.h>],[ 3606 #ifdef _XOPEN_SOURCE 3607 #error expected _XOPEN_SOURCE to be undefined 3608 #endif], 3609 [cf_cv_gnu_source=no], 3610 [cf_cv_gnu_source=yes]) 3611 CPPFLAGS="$cf_save" 3612 ]) 3613 ]) 3614 3615 if test "$cf_cv_gnu_source" = yes 3616 then 3617 AC_CACHE_CHECK(if we should also define _DEFAULT_SOURCE,cf_cv_default_source,[ 3618 CF_APPEND_TEXT(CPPFLAGS,-D_GNU_SOURCE) 3619 AC_TRY_COMPILE([#include <sys/types.h>],[ 3620 #ifdef _DEFAULT_SOURCE 3621 #error expected _DEFAULT_SOURCE to be undefined 3622 #endif], 3623 [cf_cv_default_source=no], 3624 [cf_cv_default_source=yes]) 3625 ]) 3626 if test "$cf_cv_default_source" = yes 3627 then 3628 CF_APPEND_TEXT(CPPFLAGS,-D_DEFAULT_SOURCE) 3629 fi 3630 fi 3631 fi 3632 3633fi 3634])dnl 3635dnl --------------------------------------------------------------------------- 3636dnl CF_HEADER_PATH version: 13 updated: 2015/04/15 19:08:48 3637dnl -------------- 3638dnl Construct a search-list of directories for a nonstandard header-file 3639dnl 3640dnl Parameters 3641dnl $1 = the variable to return as result 3642dnl $2 = the package name 3643AC_DEFUN([CF_HEADER_PATH], 3644[ 3645$1= 3646 3647# collect the current set of include-directories from compiler flags 3648cf_header_path_list="" 3649if test -n "${CFLAGS}${CPPFLAGS}" ; then 3650 for cf_header_path in $CPPFLAGS $CFLAGS 3651 do 3652 case $cf_header_path in 3653 -I*) 3654 cf_header_path=`echo ".$cf_header_path" |sed -e 's/^...//' -e 's,/include$,,'` 3655 CF_ADD_SUBDIR_PATH($1,$2,include,$cf_header_path,NONE) 3656 cf_header_path_list="$cf_header_path_list [$]$1" 3657 ;; 3658 esac 3659 done 3660fi 3661 3662# add the variations for the package we are looking for 3663CF_SUBDIR_PATH($1,$2,include) 3664 3665test "$includedir" != NONE && \ 3666test "$includedir" != "/usr/include" && \ 3667test -d "$includedir" && { 3668 test -d $includedir && $1="[$]$1 $includedir" 3669 test -d $includedir/$2 && $1="[$]$1 $includedir/$2" 3670} 3671 3672test "$oldincludedir" != NONE && \ 3673test "$oldincludedir" != "/usr/include" && \ 3674test -d "$oldincludedir" && { 3675 test -d $oldincludedir && $1="[$]$1 $oldincludedir" 3676 test -d $oldincludedir/$2 && $1="[$]$1 $oldincludedir/$2" 3677} 3678 3679$1="[$]$1 $cf_header_path_list" 3680])dnl 3681dnl --------------------------------------------------------------------------- 3682dnl CF_INTEL_COMPILER version: 7 updated: 2015/04/12 15:39:00 3683dnl ----------------- 3684dnl Check if the given compiler is really the Intel compiler for Linux. It 3685dnl tries to imitate gcc, but does not return an error when it finds a mismatch 3686dnl between prototypes, e.g., as exercised by CF_MISSING_CHECK. 3687dnl 3688dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to 3689dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from 3690dnl the wrappers for gcc and g++ warnings. 3691dnl 3692dnl $1 = GCC (default) or GXX 3693dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS 3694dnl $3 = CFLAGS (default) or CXXFLAGS 3695AC_DEFUN([CF_INTEL_COMPILER],[ 3696AC_REQUIRE([AC_CANONICAL_HOST]) 3697ifelse([$2],,INTEL_COMPILER,[$2])=no 3698 3699if test "$ifelse([$1],,[$1],GCC)" = yes ; then 3700 case $host_os in 3701 linux*|gnu*) 3702 AC_MSG_CHECKING(if this is really Intel ifelse([$1],GXX,C++,C) compiler) 3703 cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])" 3704 ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -no-gcc" 3705 AC_TRY_COMPILE([],[ 3706#ifdef __INTEL_COMPILER 3707#else 3708make an error 3709#endif 3710],[ifelse([$2],,INTEL_COMPILER,[$2])=yes 3711cf_save_CFLAGS="$cf_save_CFLAGS -we147" 3712],[]) 3713 ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS" 3714 AC_MSG_RESULT($ifelse([$2],,INTEL_COMPILER,[$2])) 3715 ;; 3716 esac 3717fi 3718])dnl 3719dnl --------------------------------------------------------------------------- 3720dnl CF_LIBRARY_PATH version: 10 updated: 2015/04/15 19:08:48 3721dnl --------------- 3722dnl Construct a search-list of directories for a nonstandard library-file 3723dnl 3724dnl Parameters 3725dnl $1 = the variable to return as result 3726dnl $2 = the package name 3727AC_DEFUN([CF_LIBRARY_PATH], 3728[ 3729$1= 3730cf_library_path_list="" 3731if test -n "${LDFLAGS}${LIBS}" ; then 3732 for cf_library_path in $LDFLAGS $LIBS 3733 do 3734 case $cf_library_path in 3735 -L*) 3736 cf_library_path=`echo ".$cf_library_path" |sed -e 's/^...//' -e 's,/lib$,,'` 3737 CF_ADD_SUBDIR_PATH($1,$2,lib,$cf_library_path,NONE) 3738 cf_library_path_list="$cf_library_path_list [$]$1" 3739 ;; 3740 esac 3741 done 3742fi 3743 3744CF_SUBDIR_PATH($1,$2,lib) 3745 3746$1="$cf_library_path_list [$]$1" 3747])dnl 3748dnl --------------------------------------------------------------------------- 3749dnl CF_LIB_PREFIX version: 13 updated: 2020/04/04 10:11:47 3750dnl ------------- 3751dnl Compute the library-prefix for the given host system 3752dnl $1 = variable to set 3753define([CF_LIB_PREFIX], 3754[ 3755 case $cf_cv_system_name in 3756 OS/2*|os2*) 3757 if test "$DFT_LWR_MODEL" = libtool; then 3758 LIB_PREFIX='lib' 3759 else 3760 LIB_PREFIX='' 3761 fi 3762 ;; 3763 *-msvc*) 3764 LIB_PREFIX='' 3765 ;; 3766 *) LIB_PREFIX='lib' 3767 ;; 3768 esac 3769ifelse($1,,,[$1=$LIB_PREFIX]) 3770 AC_SUBST(LIB_PREFIX) 3771])dnl 3772dnl --------------------------------------------------------------------------- 3773dnl CF_LOCKFILE version: 2 updated: 2001/05/26 12:41:02 3774dnl ----------- 3775dnl Check for functions that we can use for file-locking. Simply checking for 3776dnl existence is not sufficient, since fcntl, for example, uses definitions 3777dnl that are not in every version of the header. 3778AC_DEFUN([CF_LOCKFILE], 3779[ 3780AC_CHECK_HEADERS(unistd.h fcntl.h sys/file.h) 3781AC_CHECK_FUNC(fcntl) 3782AC_CHECK_FUNC(lockf) 3783AC_CHECK_FUNC(flock,,,[ 3784 CF_RECHECK_FUNC(flock,bsd,cf_cv_lockfile,[AC_MSG_WARN(no lock function found)])]) 3785 3786AC_CACHE_CHECK(for file-locking functions,cf_cv_lockfile,[ 3787cf_cv_lockfile= 3788for cf_lock in fcntl lockf flock 3789do 3790if eval 'test ${ac_cv_func_'$cf_lock'+set} = set'; then 3791 case $cf_lock in #(vi 3792 fcntl) #(vi 3793 AC_TRY_COMPILE([ 3794#include <stdio.h> 3795#ifdef HAVE_UNISTD_H 3796#include <unistd.h> 3797#endif 3798#ifdef HAVE_FCNTL_H 3799#include <fcntl.h> 3800#endif 3801],[ 3802 struct flock flk; 3803 int block = 1; 3804 int fd = 0; 3805 int rc; 3806 3807 flk.l_type = F_WRLCK; 3808 flk.l_whence = SEEK_SET; 3809 flk.l_start = 0; 3810 flk.l_len = 0; 3811 rc = fcntl(fd, block ? F_SETLKW : F_SETLK, &flk) 3812 && fcntl(fd, F_GETLK, &flk) 3813 && fcntl(fd, F_SETLK, &flk); 3814 ],,continue) 3815 ;; 3816 lockf) #(vi 3817 AC_TRY_COMPILE([ 3818#include <stdio.h> 3819#ifdef HAVE_UNISTD_H 3820#include <unistd.h> 3821#endif 3822#ifdef HAVE_FCNTL_H 3823#include <fcntl.h> 3824#endif 3825],[ 3826 int block = 1, fd = 0; 3827 int ret = lockf(fd, block ? F_LOCK : F_TLOCK, 0L) 3828 && lockf(fd, F_TEST, 0L) 3829 && lockf(fd, F_ULOCK, 0L); 3830 ],,[continue]) 3831 ;; 3832 flock) 3833 AC_TRY_COMPILE([ 3834#include <stdio.h> 3835#ifdef HAVE_UNISTD_H 3836#include <unistd.h> 3837#endif 3838#ifdef HAVE_FCNTL_H 3839#include <fcntl.h> 3840#endif 3841#ifdef HAVE_SYS_FILE_H 3842#include <sys/file.h> 3843#endif 3844],[ 3845 int block = 1, fd = 0; 3846 int ret = flock(fd, (LOCK_EX|LOCK_NB)) 3847 && flock(fd, LOCK_UN) 3848 && flock(fd, block ? LOCK_EX : (LOCK_EX | LOCK_NB)); 3849 ],,[continue]) 3850 ;; 3851 esac 3852 cf_cv_lockfile="$cf_cv_lockfile $cf_lock" 3853fi 3854done 3855]) 3856])dnl 3857dnl --------------------------------------------------------------------------- 3858dnl CF_MAKEFLAGS version: 18 updated: 2018/02/21 21:26:03 3859dnl ------------ 3860dnl Some 'make' programs support ${MAKEFLAGS}, some ${MFLAGS}, to pass 'make' 3861dnl options to lower-levels. It's very useful for "make -n" -- if we have it. 3862dnl (GNU 'make' does both, something POSIX 'make', which happens to make the 3863dnl ${MAKEFLAGS} variable incompatible because it adds the assignments :-) 3864AC_DEFUN([CF_MAKEFLAGS], 3865[ 3866AC_CACHE_CHECK(for makeflags variable, cf_cv_makeflags,[ 3867 cf_cv_makeflags='' 3868 for cf_option in '-${MAKEFLAGS}' '${MFLAGS}' 3869 do 3870 cat >cf_makeflags.tmp <<CF_EOF 3871SHELL = $SHELL 3872all : 3873 @ echo '.$cf_option' 3874CF_EOF 3875 cf_result=`${MAKE:-make} -k -f cf_makeflags.tmp 2>/dev/null | fgrep -v "ing directory" | sed -e 's,[[ ]]*$,,'` 3876 case "$cf_result" in 3877 .*k|.*kw) 3878 cf_result=`${MAKE:-make} -k -f cf_makeflags.tmp CC=cc 2>/dev/null` 3879 case "$cf_result" in 3880 .*CC=*) cf_cv_makeflags= 3881 ;; 3882 *) cf_cv_makeflags=$cf_option 3883 ;; 3884 esac 3885 break 3886 ;; 3887 .-) 3888 ;; 3889 *) 3890 CF_MSG_LOG(given option \"$cf_option\", no match \"$cf_result\") 3891 ;; 3892 esac 3893 done 3894 rm -f cf_makeflags.tmp 3895]) 3896 3897AC_SUBST(cf_cv_makeflags) 3898])dnl 3899dnl --------------------------------------------------------------------------- 3900dnl CF_MSG_LOG version: 5 updated: 2010/10/23 15:52:32 3901dnl ---------- 3902dnl Write a debug message to config.log, along with the line number in the 3903dnl configure script. 3904AC_DEFUN([CF_MSG_LOG],[ 3905echo "${as_me:-configure}:__oline__: testing $* ..." 1>&AC_FD_CC 3906])dnl 3907dnl --------------------------------------------------------------------------- 3908dnl CF_NCURSES_BROKEN version: 8 updated: 2012/11/08 20:57:52 3909dnl ----------------- 3910dnl Check for pre-1.9.9g ncurses (among other problems, the most obvious is 3911dnl that color combinations don't work). 3912AC_DEFUN([CF_NCURSES_BROKEN], 3913[ 3914AC_REQUIRE([CF_NCURSES_VERSION]) 3915if test "$cf_cv_ncurses_version" != no ; then 3916AC_MSG_CHECKING(for obsolete/broken version of ncurses) 3917AC_CACHE_VAL(cf_cv_ncurses_broken,[ 3918AC_TRY_COMPILE([ 3919#include <${cf_cv_ncurses_header:-curses.h}>],[ 3920#if defined(NCURSES_VERSION) && defined(wgetbkgd) 3921 make an error 3922#else 3923 int x = 1 3924#endif 3925], 3926 [cf_cv_ncurses_broken=no], 3927 [cf_cv_ncurses_broken=yes]) 3928]) 3929AC_MSG_RESULT($cf_cv_ncurses_broken) 3930if test "$cf_cv_ncurses_broken" = yes ; then 3931 AC_MSG_WARN(hmm... you should get an up-to-date version of ncurses) 3932 AC_DEFINE(NCURSES_BROKEN,1,[Define to 1 if you have an obsolete version of ncurses]) 3933fi 3934fi 3935])dnl 3936dnl --------------------------------------------------------------------------- 3937dnl CF_NCURSES_CC_CHECK version: 4 updated: 2007/07/29 10:39:05 3938dnl ------------------- 3939dnl Check if we can compile with ncurses' header file 3940dnl $1 is the cache variable to set 3941dnl $2 is the header-file to include 3942dnl $3 is the root name (ncurses or ncursesw) 3943AC_DEFUN([CF_NCURSES_CC_CHECK],[ 3944 AC_TRY_COMPILE([ 3945]ifelse($3,ncursesw,[ 3946#define _XOPEN_SOURCE_EXTENDED 3947#undef HAVE_LIBUTF8_H /* in case we used CF_UTF8_LIB */ 3948#define HAVE_LIBUTF8_H /* to force ncurses' header file to use cchar_t */ 3949])[ 3950#include <$2>],[ 3951#ifdef NCURSES_VERSION 3952]ifelse($3,ncursesw,[ 3953#ifndef WACS_BSSB 3954 make an error 3955#endif 3956])[ 3957printf("%s\n", NCURSES_VERSION); 3958#else 3959#ifdef __NCURSES_H 3960printf("old\n"); 3961#else 3962 make an error 3963#endif 3964#endif 3965 ] 3966 ,[$1=$2] 3967 ,[$1=no]) 3968])dnl 3969dnl --------------------------------------------------------------------------- 3970dnl CF_NCURSES_CONFIG version: 23 updated: 2020/02/27 05:21:59 3971dnl ----------------- 3972dnl Tie together the configure-script macros for ncurses, preferring these in 3973dnl order: 3974dnl a) ".pc" files for pkg-config, using $NCURSES_CONFIG_PKG 3975dnl b) the "-config" script from ncurses, using $NCURSES_CONFIG 3976dnl c) just plain libraries 3977dnl 3978dnl $1 is the root library name (default: "ncurses") 3979AC_DEFUN([CF_NCURSES_CONFIG],[ 3980AC_REQUIRE([CF_PKG_CONFIG]) 3981cf_ncuconfig_root=ifelse($1,,ncurses,$1) 3982cf_have_ncuconfig=no 3983 3984if test "x${PKG_CONFIG:=none}" != xnone; then 3985 AC_MSG_CHECKING(pkg-config for $cf_ncuconfig_root) 3986 if "$PKG_CONFIG" --exists $cf_ncuconfig_root ; then 3987 AC_MSG_RESULT(yes) 3988 3989 AC_MSG_CHECKING(if the $cf_ncuconfig_root package files work) 3990 cf_have_ncuconfig=unknown 3991 3992 cf_save_CFLAGS="$CFLAGS" 3993 cf_save_CPPFLAGS="$CPPFLAGS" 3994 cf_save_LIBS="$LIBS" 3995 3996 cf_pkg_cflags=`$PKG_CONFIG --cflags $cf_ncuconfig_root` 3997 cf_pkg_libs=`$PKG_CONFIG --libs $cf_ncuconfig_root` 3998 3999 # while -W for passing linker flags is prevalent, it is not "standard". 4000 # At least one wrapper for c89/c99 (in Apple's xcode) has its own 4001 # incompatible _and_ non-standard -W option which gives an error. Work 4002 # around that pitfall. 4003 case "x${CC}@@${cf_pkg_libs}@${cf_pkg_cflags}" in 4004 x*c[[89]]9@@*-W*) 4005 CF_ADD_CFLAGS($cf_pkg_cflags) 4006 CF_ADD_LIBS($cf_pkg_libs) 4007 4008 AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>], 4009 [initscr(); mousemask(0,0); tigetstr((char *)0);], 4010 [AC_TRY_RUN([#include <${cf_cv_ncurses_header:-curses.h}> 4011 int main(void) 4012 { char *xx = curses_version(); return (xx == 0); }], 4013 [cf_test_ncuconfig=yes], 4014 [cf_test_ncuconfig=no], 4015 [cf_test_ncuconfig=maybe])], 4016 [cf_test_ncuconfig=no]) 4017 4018 CFLAGS="$cf_save_CFLAGS" 4019 CPPFLAGS="$cf_save_CPPFLAGS" 4020 LIBS="$cf_save_LIBS" 4021 4022 if test "x$cf_test_ncuconfig" != xyes; then 4023 cf_temp=`echo "x$cf_pkg_cflags" | sed -e s/^x// -e 's/-W[[^ ]]*//g'` 4024 cf_pkg_cflags="$cf_temp" 4025 cf_temp=`echo "x$cf_pkg_libs" | sed -e s/^x// -e 's/-W[[^ ]]*//g'` 4026 cf_pkg_libs="$cf_temp" 4027 fi 4028 ;; 4029 esac 4030 4031 CF_ADD_CFLAGS($cf_pkg_cflags) 4032 CF_ADD_LIBS($cf_pkg_libs) 4033 4034 AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>], 4035 [initscr(); mousemask(0,0); tigetstr((char *)0);], 4036 [AC_TRY_RUN([#include <${cf_cv_ncurses_header:-curses.h}> 4037 int main(void) 4038 { char *xx = curses_version(); return (xx == 0); }], 4039 [cf_have_ncuconfig=yes], 4040 [cf_have_ncuconfig=no], 4041 [cf_have_ncuconfig=maybe])], 4042 [cf_have_ncuconfig=no]) 4043 AC_MSG_RESULT($cf_have_ncuconfig) 4044 test "$cf_have_ncuconfig" = maybe && cf_have_ncuconfig=yes 4045 if test "$cf_have_ncuconfig" != "yes" 4046 then 4047 CPPFLAGS="$cf_save_CPPFLAGS" 4048 LIBS="$cf_save_LIBS" 4049 NCURSES_CONFIG_PKG=none 4050 else 4051 AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries]) 4052 NCURSES_CONFIG_PKG=$cf_ncuconfig_root 4053 CF_TERM_HEADER 4054 fi 4055 4056 else 4057 AC_MSG_RESULT(no) 4058 NCURSES_CONFIG_PKG=none 4059 fi 4060else 4061 NCURSES_CONFIG_PKG=none 4062fi 4063 4064if test "x$cf_have_ncuconfig" = "xno"; then 4065 cf_ncurses_config="${cf_ncuconfig_root}${NCURSES_CONFIG_SUFFIX}-config"; echo "Looking for ${cf_ncurses_config}" 4066 4067 CF_ACVERSION_CHECK(2.52, 4068 [AC_CHECK_TOOLS(NCURSES_CONFIG, ${cf_ncurses_config} ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config, none)], 4069 [AC_PATH_PROGS(NCURSES_CONFIG, ${cf_ncurses_config} ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config, none)]) 4070 4071 if test "$NCURSES_CONFIG" != none ; then 4072 4073 CF_ADD_CFLAGS(`$NCURSES_CONFIG --cflags`) 4074 CF_ADD_LIBS(`$NCURSES_CONFIG --libs`) 4075 4076 # even with config script, some packages use no-override for curses.h 4077 CF_CURSES_HEADER(ifelse($1,,ncurses,$1)) 4078 4079 dnl like CF_NCURSES_CPPFLAGS 4080 AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries]) 4081 4082 dnl like CF_NCURSES_LIBS 4083 CF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_ncuconfig_root) 4084 AC_DEFINE_UNQUOTED($cf_nculib_ROOT) 4085 4086 dnl like CF_NCURSES_VERSION 4087 cf_cv_ncurses_version=`$NCURSES_CONFIG --version` 4088 4089 else 4090 4091 CF_NCURSES_CPPFLAGS(ifelse($1,,ncurses,$1)) 4092 CF_NCURSES_LIBS(ifelse($1,,ncurses,$1)) 4093 4094 fi 4095else 4096 NCURSES_CONFIG=none 4097fi 4098])dnl 4099dnl --------------------------------------------------------------------------- 4100dnl CF_NCURSES_CPPFLAGS version: 21 updated: 2012/10/06 08:57:51 4101dnl ------------------- 4102dnl Look for the SVr4 curses clone 'ncurses' in the standard places, adjusting 4103dnl the CPPFLAGS variable so we can include its header. 4104dnl 4105dnl The header files may be installed as either curses.h, or ncurses.h (would 4106dnl be obsolete, except that some packagers prefer this name to distinguish it 4107dnl from a "native" curses implementation). If not installed for overwrite, 4108dnl the curses.h file would be in an ncurses subdirectory (e.g., 4109dnl /usr/include/ncurses), but someone may have installed overwriting the 4110dnl vendor's curses. Only very old versions (pre-1.9.2d, the first autoconf'd 4111dnl version) of ncurses don't define either __NCURSES_H or NCURSES_VERSION in 4112dnl the header. 4113dnl 4114dnl If the installer has set $CFLAGS or $CPPFLAGS so that the ncurses header 4115dnl is already in the include-path, don't even bother with this, since we cannot 4116dnl easily determine which file it is. In this case, it has to be <curses.h>. 4117dnl 4118dnl The optional parameter gives the root name of the library, in case it is 4119dnl not installed as the default curses library. That is how the 4120dnl wide-character version of ncurses is installed. 4121AC_DEFUN([CF_NCURSES_CPPFLAGS], 4122[AC_REQUIRE([CF_WITH_CURSES_DIR]) 4123 4124AC_PROVIDE([CF_CURSES_CPPFLAGS])dnl 4125cf_ncuhdr_root=ifelse($1,,ncurses,$1) 4126 4127test -n "$cf_cv_curses_dir" && \ 4128test "$cf_cv_curses_dir" != "no" && { \ 4129 CF_ADD_INCDIR($cf_cv_curses_dir/include/$cf_ncuhdr_root) 4130} 4131 4132AC_CACHE_CHECK(for $cf_ncuhdr_root header in include-path, cf_cv_ncurses_h,[ 4133 cf_header_list="$cf_ncuhdr_root/curses.h $cf_ncuhdr_root/ncurses.h" 4134 ( test "$cf_ncuhdr_root" = ncurses || test "$cf_ncuhdr_root" = ncursesw ) && cf_header_list="$cf_header_list curses.h ncurses.h" 4135 for cf_header in $cf_header_list 4136 do 4137 CF_NCURSES_CC_CHECK(cf_cv_ncurses_h,$cf_header,$1) 4138 test "$cf_cv_ncurses_h" != no && break 4139 done 4140]) 4141 4142CF_NCURSES_HEADER 4143CF_TERM_HEADER 4144 4145# some applications need this, but should check for NCURSES_VERSION 4146AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries]) 4147 4148CF_NCURSES_VERSION 4149])dnl 4150dnl --------------------------------------------------------------------------- 4151dnl CF_NCURSES_HEADER version: 4 updated: 2015/04/15 19:08:48 4152dnl ----------------- 4153dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common 4154dnl variations of ncurses' installs. 4155dnl 4156dnl See also CF_CURSES_HEADER, which sets the same cache variable. 4157AC_DEFUN([CF_NCURSES_HEADER],[ 4158 4159if test "$cf_cv_ncurses_h" != no ; then 4160 cf_cv_ncurses_header=$cf_cv_ncurses_h 4161else 4162 4163AC_CACHE_CHECK(for $cf_ncuhdr_root include-path, cf_cv_ncurses_h2,[ 4164 test -n "$verbose" && echo 4165 CF_HEADER_PATH(cf_search,$cf_ncuhdr_root) 4166 test -n "$verbose" && echo search path $cf_search 4167 cf_save2_CPPFLAGS="$CPPFLAGS" 4168 for cf_incdir in $cf_search 4169 do 4170 CF_ADD_INCDIR($cf_incdir) 4171 for cf_header in \ 4172 ncurses.h \ 4173 curses.h 4174 do 4175 CF_NCURSES_CC_CHECK(cf_cv_ncurses_h2,$cf_header,$1) 4176 if test "$cf_cv_ncurses_h2" != no ; then 4177 cf_cv_ncurses_h2=$cf_incdir/$cf_header 4178 test -n "$verbose" && echo $ac_n " ... found $ac_c" 1>&AC_FD_MSG 4179 break 4180 fi 4181 test -n "$verbose" && echo " ... tested $cf_incdir/$cf_header" 1>&AC_FD_MSG 4182 done 4183 CPPFLAGS="$cf_save2_CPPFLAGS" 4184 test "$cf_cv_ncurses_h2" != no && break 4185 done 4186 test "$cf_cv_ncurses_h2" = no && AC_MSG_ERROR(not found) 4187 ]) 4188 4189 CF_DIRNAME(cf_1st_incdir,$cf_cv_ncurses_h2) 4190 cf_cv_ncurses_header=`basename $cf_cv_ncurses_h2` 4191 if test `basename $cf_1st_incdir` = $cf_ncuhdr_root ; then 4192 cf_cv_ncurses_header=$cf_ncuhdr_root/$cf_cv_ncurses_header 4193 fi 4194 CF_ADD_INCDIR($cf_1st_incdir) 4195 4196fi 4197 4198# Set definitions to allow ifdef'ing for ncurses.h 4199 4200case $cf_cv_ncurses_header in 4201*ncurses.h) 4202 AC_DEFINE(HAVE_NCURSES_H,1,[Define to 1 if we have ncurses.h]) 4203 ;; 4204esac 4205 4206case $cf_cv_ncurses_header in 4207ncurses/curses.h|ncurses/ncurses.h) 4208 AC_DEFINE(HAVE_NCURSES_NCURSES_H,1,[Define to 1 if we have ncurses/ncurses.h]) 4209 ;; 4210ncursesw/curses.h|ncursesw/ncurses.h) 4211 AC_DEFINE(HAVE_NCURSESW_NCURSES_H,1,[Define to 1 if we have ncursesw/ncurses.h]) 4212 ;; 4213esac 4214 4215])dnl 4216dnl --------------------------------------------------------------------------- 4217dnl CF_NCURSES_LIBS version: 17 updated: 2015/04/15 19:08:48 4218dnl --------------- 4219dnl Look for the ncurses library. This is a little complicated on Linux, 4220dnl because it may be linked with the gpm (general purpose mouse) library. 4221dnl Some distributions have gpm linked with (bsd) curses, which makes it 4222dnl unusable with ncurses. However, we don't want to link with gpm unless 4223dnl ncurses has a dependency, since gpm is normally set up as a shared library, 4224dnl and the linker will record a dependency. 4225dnl 4226dnl The optional parameter gives the root name of the library, in case it is 4227dnl not installed as the default curses library. That is how the 4228dnl wide-character version of ncurses is installed. 4229AC_DEFUN([CF_NCURSES_LIBS], 4230[AC_REQUIRE([CF_NCURSES_CPPFLAGS]) 4231 4232cf_nculib_root=ifelse($1,,ncurses,$1) 4233 # This works, except for the special case where we find gpm, but 4234 # ncurses is in a nonstandard location via $LIBS, and we really want 4235 # to link gpm. 4236cf_ncurses_LIBS="" 4237cf_ncurses_SAVE="$LIBS" 4238AC_CHECK_LIB(gpm,Gpm_Open, 4239 [AC_CHECK_LIB(gpm,initscr, 4240 [LIBS="$cf_ncurses_SAVE"], 4241 [cf_ncurses_LIBS="-lgpm"])]) 4242 4243case $host_os in 4244freebsd*) 4245 # This is only necessary if you are linking against an obsolete 4246 # version of ncurses (but it should do no harm, since it's static). 4247 if test "$cf_nculib_root" = ncurses ; then 4248 AC_CHECK_LIB(mytinfo,tgoto,[cf_ncurses_LIBS="-lmytinfo $cf_ncurses_LIBS"]) 4249 fi 4250 ;; 4251esac 4252 4253CF_ADD_LIBS($cf_ncurses_LIBS) 4254 4255if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" ) 4256then 4257 CF_ADD_LIBS(-l$cf_nculib_root) 4258else 4259 CF_FIND_LIBRARY($cf_nculib_root,$cf_nculib_root, 4260 [#include <${cf_cv_ncurses_header:-curses.h}>], 4261 [initscr()], 4262 initscr) 4263fi 4264 4265if test -n "$cf_ncurses_LIBS" ; then 4266 AC_MSG_CHECKING(if we can link $cf_nculib_root without $cf_ncurses_LIBS) 4267 cf_ncurses_SAVE="$LIBS" 4268 for p in $cf_ncurses_LIBS ; do 4269 q=`echo $LIBS | sed -e "s%$p %%" -e "s%$p$%%"` 4270 if test "$q" != "$LIBS" ; then 4271 LIBS="$q" 4272 fi 4273 done 4274 AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>], 4275 [initscr(); mousemask(0,0); tigetstr((char *)0);], 4276 [AC_MSG_RESULT(yes)], 4277 [AC_MSG_RESULT(no) 4278 LIBS="$cf_ncurses_SAVE"]) 4279fi 4280 4281CF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_nculib_root) 4282AC_DEFINE_UNQUOTED($cf_nculib_ROOT) 4283])dnl 4284dnl --------------------------------------------------------------------------- 4285dnl CF_NCURSES_VERSION version: 15 updated: 2017/05/09 19:26:10 4286dnl ------------------ 4287dnl Check for the version of ncurses, to aid in reporting bugs, etc. 4288dnl Call CF_CURSES_CPPFLAGS first, or CF_NCURSES_CPPFLAGS. We don't use 4289dnl AC_REQUIRE since that does not work with the shell's if/then/else/fi. 4290AC_DEFUN([CF_NCURSES_VERSION], 4291[ 4292AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl 4293AC_CACHE_CHECK(for ncurses version, cf_cv_ncurses_version,[ 4294 cf_cv_ncurses_version=no 4295 cf_tempfile=out$$ 4296 rm -f $cf_tempfile 4297 AC_TRY_RUN([ 4298#include <${cf_cv_ncurses_header:-curses.h}> 4299#include <stdio.h> 4300int main(void) 4301{ 4302 FILE *fp = fopen("$cf_tempfile", "w"); 4303#ifdef NCURSES_VERSION 4304# ifdef NCURSES_VERSION_PATCH 4305 fprintf(fp, "%s.%d\n", NCURSES_VERSION, NCURSES_VERSION_PATCH); 4306# else 4307 fprintf(fp, "%s\n", NCURSES_VERSION); 4308# endif 4309#else 4310# ifdef __NCURSES_H 4311 fprintf(fp, "old\n"); 4312# else 4313 make an error 4314# endif 4315#endif 4316 ${cf_cv_main_return:-return}(0); 4317}],[ 4318 cf_cv_ncurses_version=`cat $cf_tempfile`],,[ 4319 4320 # This will not work if the preprocessor splits the line after the 4321 # Autoconf token. The 'unproto' program does that. 4322 cat > conftest.$ac_ext <<EOF 4323#include <${cf_cv_ncurses_header:-curses.h}> 4324#undef Autoconf 4325#ifdef NCURSES_VERSION 4326Autoconf NCURSES_VERSION 4327#else 4328#ifdef __NCURSES_H 4329Autoconf "old" 4330#endif 4331; 4332#endif 4333EOF 4334 cf_try="$ac_cpp conftest.$ac_ext 2>&AC_FD_CC | grep '^Autoconf ' >conftest.out" 4335 AC_TRY_EVAL(cf_try) 4336 if test -f conftest.out ; then 4337 cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[[^"]]*"%%' -e 's%".*%%'` 4338 test -n "$cf_out" && cf_cv_ncurses_version="$cf_out" 4339 rm -f conftest.out 4340 fi 4341]) 4342 rm -f $cf_tempfile 4343]) 4344test "$cf_cv_ncurses_version" = no || AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries]) 4345])dnl 4346dnl --------------------------------------------------------------------------- 4347dnl CF_NETLIBS version: 11 updated: 2015/04/15 19:08:48 4348dnl ---------- 4349dnl After checking for functions in the default $LIBS, make a further check 4350dnl for the functions that are netlib-related (these aren't always in the 4351dnl libc, etc., and have to be handled specially because there are conflicting 4352dnl and broken implementations. 4353dnl Common library requirements (in order): 4354dnl -lresolv -lsocket -lnsl 4355dnl -lnsl -lsocket 4356dnl -lsocket 4357dnl -lbsd 4358dnl -lnetwork 4359AC_DEFUN([CF_NETLIBS],[ 4360cf_test_netlibs=no 4361 4362AC_MSG_CHECKING(for network libraries) 4363 4364AC_CACHE_VAL(cf_cv_netlibs,[ 4365AC_MSG_RESULT(working...) 4366 4367cf_cv_netlibs="" 4368cf_test_netlibs=yes 4369 4370case $host_os in 4371mingw*) 4372 AC_CHECK_HEADERS( windows.h winsock.h winsock2.h ) 4373 4374 if test "$ac_cv_header_winsock2_h" = "yes" ; then 4375 cf_winsock_lib="-lws2_32" 4376 elif test "$ac_cv_header_winsock_h" = "yes" ; then 4377 cf_winsock_lib="-lwsock32" 4378 fi 4379 4380 cf_save_LIBS="$LIBS" 4381 CF_ADD_LIBS($cf_winsock_lib) 4382 4383 AC_TRY_LINK([ 4384#ifdef HAVE_WINDOWS_H 4385#undef WIN32_LEAN_AND_MEAN 4386#define WIN32_LEAN_AND_MEAN 4387#include <windows.h> 4388#ifdef HAVE_WINSOCK2_H 4389#include <winsock2.h> 4390#else 4391#ifdef HAVE_WINSOCK_H 4392#include <winsock.h> 4393#endif 4394#endif 4395#endif 4396],[ 4397 char buffer[1024]; 4398 gethostname(buffer, sizeof(buffer));], 4399 [cf_cv_netlibs="$cf_winsock_lib $cf_cv_netlibs"], 4400 [AC_MSG_ERROR(Cannot link against winsock library)]) 4401 4402 LIBS="$cf_save_LIBS" 4403 ;; 4404*) 4405 AC_CHECK_FUNCS(gethostname,,[ 4406 CF_RECHECK_FUNC(gethostname,nsl,cf_cv_netlibs,[ 4407 CF_RECHECK_FUNC(gethostname,socket,cf_cv_netlibs)])]) 4408 4409 AC_CHECK_LIB(inet, main, cf_cv_netlibs="-linet $cf_cv_netlibs") 4410 4411 if test "$ac_cv_func_lsocket" != no ; then 4412 AC_CHECK_FUNCS(socket,,[ 4413 CF_RECHECK_FUNC(socket,socket,cf_cv_netlibs,[ 4414 CF_RECHECK_FUNC(socket,bsd,cf_cv_netlibs)])]) 4415 fi 4416 4417 AC_CHECK_FUNCS(gethostbyname,,[ 4418 CF_RECHECK_FUNC(gethostbyname,nsl,cf_cv_netlibs)]) 4419 4420 AC_CHECK_FUNCS(inet_ntoa,,[ 4421 CF_RECHECK_FUNC(inet_ntoa,nsl,cf_cv_netlibs)]) 4422 4423 AC_CHECK_FUNCS(gethostbyname,,[ 4424 CF_RECHECK_FUNC(gethostbyname,network,cf_cv_netlibs)]) 4425 4426 AC_CHECK_FUNCS(strcasecmp,,[ 4427 CF_RECHECK_FUNC(strcasecmp,resolv,cf_cv_netlibs)]) 4428 ;; 4429esac 4430]) 4431 4432case $cf_cv_netlibs in 4433*ws2_32*) 4434 AC_DEFINE(USE_WINSOCK2_H,1,[Define to 1 if we should include winsock2.h]) 4435 ;; 4436esac 4437 4438CF_ADD_LIBS($cf_cv_netlibs) 4439test $cf_test_netlibs = no && echo "$cf_cv_netlibs" >&AC_FD_MSG 4440])dnl 4441dnl --------------------------------------------------------------------------- 4442dnl CF_NO_LEAKS_OPTION version: 6 updated: 2015/04/12 15:39:00 4443dnl ------------------ 4444dnl see CF_WITH_NO_LEAKS 4445AC_DEFUN([CF_NO_LEAKS_OPTION],[ 4446AC_MSG_CHECKING(if you want to use $1 for testing) 4447AC_ARG_WITH($1, 4448 [$2], 4449 [AC_DEFINE_UNQUOTED($3,1,"Define to 1 if you want to use $1 for testing.")ifelse([$4],,[ 4450 $4 4451]) 4452 : ${with_cflags:=-g} 4453 : ${with_no_leaks:=yes} 4454 with_$1=yes], 4455 [with_$1=]) 4456AC_MSG_RESULT(${with_$1:-no}) 4457 4458case .$with_cflags in 4459.*-g*) 4460 case .$CFLAGS in 4461 .*-g*) 4462 ;; 4463 *) 4464 CF_ADD_CFLAGS([-g]) 4465 ;; 4466 esac 4467 ;; 4468esac 4469])dnl 4470dnl --------------------------------------------------------------------------- 4471dnl CF_OUR_MESSAGES version: 7 updated: 2004/09/12 19:45:55 4472dnl --------------- 4473dnl Check if we use the messages included with this program 4474dnl 4475dnl $1 specifies either Makefile or makefile, defaulting to the former. 4476dnl 4477dnl Sets variables which can be used to substitute in makefiles: 4478dnl MSG_DIR_MAKE - to make ./po directory 4479dnl SUB_MAKEFILE - makefile in ./po directory (see CF_BUNDLED_INTL) 4480dnl 4481AC_DEFUN([CF_OUR_MESSAGES], 4482[ 4483cf_makefile=ifelse($1,,Makefile,$1) 4484 4485use_our_messages=no 4486if test "$USE_NLS" = yes ; then 4487if test -d $srcdir/po ; then 4488AC_MSG_CHECKING(if we should use included message-library) 4489 AC_ARG_ENABLE(included-msgs, 4490 [ --disable-included-msgs use included messages, for i18n support], 4491 [use_our_messages=$enableval], 4492 [use_our_messages=yes]) 4493fi 4494AC_MSG_RESULT($use_our_messages) 4495fi 4496 4497MSG_DIR_MAKE="#" 4498if test "$use_our_messages" = yes 4499then 4500 SUB_MAKEFILE="$SUB_MAKEFILE po/$cf_makefile.in:$srcdir/po/$cf_makefile.inn" 4501 MSG_DIR_MAKE= 4502fi 4503 4504AC_SUBST(MSG_DIR_MAKE) 4505AC_SUBST(SUB_MAKEFILE) 4506])dnl 4507dnl --------------------------------------------------------------------------- 4508dnl CF_PATHSEP version: 7 updated: 2015/04/12 15:39:00 4509dnl ---------- 4510dnl Provide a value for the $PATH and similar separator (or amend the value 4511dnl as provided in autoconf 2.5x). 4512AC_DEFUN([CF_PATHSEP], 4513[ 4514 AC_MSG_CHECKING(for PATH separator) 4515 case $cf_cv_system_name in 4516 os2*) PATH_SEPARATOR=';' ;; 4517 *) ${PATH_SEPARATOR:=':'} ;; 4518 esac 4519ifelse([$1],,,[$1=$PATH_SEPARATOR]) 4520 AC_SUBST(PATH_SEPARATOR) 4521 AC_MSG_RESULT($PATH_SEPARATOR) 4522])dnl 4523dnl --------------------------------------------------------------------------- 4524dnl CF_PATH_EDITOR version: 6 updated: 2019/12/31 20:39:42 4525dnl -------------- 4526dnl Look for the default editor (vi) 4527AC_DEFUN([CF_PATH_EDITOR], 4528[ 4529AC_MSG_CHECKING(for default editor) 4530CF_ARG_WITH(editor, 4531 [ --with-editor=PROG specify editor], 4532 [DEFAULT_EDITOR],,vi) 4533if test -z "$DEFAULT_EDITOR" ; then 4534 if test -n "$EDITOR" ; then 4535 DEFAULT_EDITOR="$EDITOR" 4536 elif test -n "$VISUAL" ; then 4537 DEFAULT_EDITOR="$VISUAL" 4538 else 4539 AC_PATH_PROG(DEFAULT_EDITOR,vi,vi,$PATH:/usr/bin:/usr/ucb) 4540 fi 4541fi 4542AC_MSG_RESULT($DEFAULT_EDITOR) 4543AC_DEFINE_UNQUOTED(DEFAULT_EDITOR,"$DEFAULT_EDITOR",[Define this to the default editor]) 4544])dnl 4545dnl --------------------------------------------------------------------------- 4546dnl CF_PATH_MAILBOX version: 5 updated: 2019/12/31 20:39:42 4547dnl --------------- 4548dnl Look for the directory that contains incoming mail. I would check for an 4549dnl actual mail-file, to verify this, but that is not always easy to arrange. 4550AC_DEFUN([CF_PATH_MAILBOX], 4551[ 4552AC_MSG_CHECKING(for incoming-mail directory) 4553CF_ARG_WITH(mailbox, 4554 [ --with-mailbox=DIR directory for incoming mailboxes], 4555 [DEFAULT_MAILBOX]) 4556if test -z "$DEFAULT_MAILBOX" ; then 4557for cf_dir in \ 4558 /var/spool/mail \ 4559 /usr/spool/mail \ 4560 /var/mail \ 4561 /usr/mail \ 4562 /mail 4563 do 4564 if test -d $cf_dir ; then 4565 DEFAULT_MAILBOX=$cf_dir 4566 break 4567 fi 4568 done 4569fi 4570if test -n "$DEFAULT_MAILBOX" ; then 4571 AC_DEFINE_UNQUOTED(DEFAULT_MAILBOX,"$DEFAULT_MAILBOX",[Define this to the directory for incoming mailboxes]) 4572else 4573 DEFAULT_MAILBOX=none 4574fi 4575AC_MSG_RESULT($DEFAULT_MAILBOX) 4576])dnl 4577dnl --------------------------------------------------------------------------- 4578dnl CF_PATH_MAILER version: 7 updated: 2019/12/31 20:39:42 4579dnl -------------- 4580dnl Look for the program that sends outgoing mail. 4581AC_DEFUN([CF_PATH_MAILER], 4582[ 4583AC_PATH_PROG(DEFAULT_MAILER,sendmail,,$PATH:/usr/sbin:/usr/lib) 4584CF_ARG_WITH(mailer, 4585 [ --with-mailer=PROG specify default mailer-program], 4586 [DEFAULT_MAILER],,mailx) 4587if test -z "$DEFAULT_MAILER" ; then 4588AC_PATH_PROG(DEFAULT_MAILER,mailx,,$PATH:/usr/bin) 4589fi 4590if test -z "$DEFAULT_MAILER" ; then 4591AC_PATH_PROG(DEFAULT_MAILER,mail,,$PATH:/usr/bin) 4592fi 4593AC_MSG_CHECKING(for default mailer) 4594if test -n "$DEFAULT_MAILER" ; then 4595 CF_FIX_SLASHES(ac_cv_path_DEFAULT_MAILER) 4596 CF_FIX_SLASHES(DEFAULT_MAILER) 4597 AC_DEFINE_UNQUOTED(DEFAULT_MAILER,"$DEFAULT_MAILER",[Define this to the default mailer-program]) 4598else 4599 DEFAULT_MAILER=none 4600fi 4601AC_MSG_RESULT($DEFAULT_MAILER) 4602])dnl 4603dnl --------------------------------------------------------------------------- 4604dnl CF_PATH_SYNTAX version: 16 updated: 2015/04/18 08:56:57 4605dnl -------------- 4606dnl Check the argument to see that it looks like a pathname. Rewrite it if it 4607dnl begins with one of the prefix/exec_prefix variables, and then again if the 4608dnl result begins with 'NONE'. This is necessary to work around autoconf's 4609dnl delayed evaluation of those symbols. 4610AC_DEFUN([CF_PATH_SYNTAX],[ 4611if test "x$prefix" != xNONE; then 4612 cf_path_syntax="$prefix" 4613else 4614 cf_path_syntax="$ac_default_prefix" 4615fi 4616 4617case ".[$]$1" in 4618.\[$]\(*\)*|.\'*\'*) 4619 ;; 4620..|./*|.\\*) 4621 ;; 4622.[[a-zA-Z]]:[[\\/]]*) # OS/2 EMX 4623 ;; 4624.\[$]{*prefix}*|.\[$]{*dir}*) 4625 eval $1="[$]$1" 4626 case ".[$]$1" in 4627 .NONE/*) 4628 $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%` 4629 ;; 4630 esac 4631 ;; 4632.no|.NONE/*) 4633 $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%` 4634 ;; 4635*) 4636 ifelse([$2],,[AC_MSG_ERROR([expected a pathname, not \"[$]$1\"])],$2) 4637 ;; 4638esac 4639])dnl 4640dnl --------------------------------------------------------------------------- 4641dnl CF_PDCURSES_X11 version: 14 updated: 2018/06/20 20:23:13 4642dnl --------------- 4643dnl Configure for PDCurses' X11 library 4644AC_DEFUN([CF_PDCURSES_X11],[ 4645AC_REQUIRE([CF_X_ATHENA]) 4646 4647CF_ACVERSION_CHECK(2.52, 4648 [AC_CHECK_TOOLS(XCURSES_CONFIG, xcurses-config, none)], 4649 [AC_PATH_PROGS(XCURSES_CONFIG, xcurses-config, none)]) 4650 4651if test "$XCURSES_CONFIG" != none ; then 4652 4653CF_ADD_CFLAGS(`$XCURSES_CONFIG --cflags`) 4654CF_ADD_LIBS(`$XCURSES_CONFIG --libs`) 4655 4656cf_cv_lib_XCurses=yes 4657 4658else 4659 4660LDFLAGS="$LDFLAGS $X_LIBS" 4661CF_CHECK_CFLAGS($X_CFLAGS) 4662AC_CHECK_LIB(X11,XOpenDisplay, 4663 [CF_ADD_LIBS(-lX11)],, 4664 [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS]) 4665AC_CACHE_CHECK(for XCurses library,cf_cv_lib_XCurses,[ 4666CF_ADD_LIBS(-lXCurses) 4667AC_TRY_LINK([ 4668#include <xcurses.h> 4669char *XCursesProgramName = "test"; 4670],[XCursesExit();], 4671[cf_cv_lib_XCurses=yes], 4672[cf_cv_lib_XCurses=no]) 4673]) 4674 4675fi 4676 4677if test $cf_cv_lib_XCurses = yes ; then 4678 AC_DEFINE(UNIX,1,[Define to 1 if using PDCurses on Unix]) 4679 AC_DEFINE(XCURSES,1,[Define to 1 if using PDCurses on Unix]) 4680 AC_CHECK_HEADER(xcurses.h, AC_DEFINE(HAVE_XCURSES,1,[Define to 1 if using PDCurses on Unix])) 4681else 4682 AC_MSG_ERROR(Cannot link with XCurses) 4683fi 4684])dnl 4685dnl --------------------------------------------------------------------------- 4686dnl CF_PKG_CONFIG version: 10 updated: 2015/04/26 18:06:58 4687dnl ------------- 4688dnl Check for the package-config program, unless disabled by command-line. 4689AC_DEFUN([CF_PKG_CONFIG], 4690[ 4691AC_MSG_CHECKING(if you want to use pkg-config) 4692AC_ARG_WITH(pkg-config, 4693 [ --with-pkg-config{=path} enable/disable use of pkg-config], 4694 [cf_pkg_config=$withval], 4695 [cf_pkg_config=yes]) 4696AC_MSG_RESULT($cf_pkg_config) 4697 4698case $cf_pkg_config in 4699no) 4700 PKG_CONFIG=none 4701 ;; 4702yes) 4703 CF_ACVERSION_CHECK(2.52, 4704 [AC_PATH_TOOL(PKG_CONFIG, pkg-config, none)], 4705 [AC_PATH_PROG(PKG_CONFIG, pkg-config, none)]) 4706 ;; 4707*) 4708 PKG_CONFIG=$withval 4709 ;; 4710esac 4711 4712test -z "$PKG_CONFIG" && PKG_CONFIG=none 4713if test "$PKG_CONFIG" != none ; then 4714 CF_PATH_SYNTAX(PKG_CONFIG) 4715elif test "x$cf_pkg_config" != xno ; then 4716 AC_MSG_WARN(pkg-config is not installed) 4717fi 4718 4719AC_SUBST(PKG_CONFIG) 4720])dnl 4721dnl --------------------------------------------------------------------------- 4722dnl CF_POSIX_C_SOURCE version: 11 updated: 2018/12/31 20:46:17 4723dnl ----------------- 4724dnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed. 4725dnl 4726dnl POSIX.1-1990 _POSIX_SOURCE 4727dnl POSIX.1-1990 and _POSIX_SOURCE and 4728dnl POSIX.2-1992 C-Language _POSIX_C_SOURCE=2 4729dnl Bindings Option 4730dnl POSIX.1b-1993 _POSIX_C_SOURCE=199309L 4731dnl POSIX.1c-1996 _POSIX_C_SOURCE=199506L 4732dnl X/Open 2000 _POSIX_C_SOURCE=200112L 4733dnl 4734dnl Parameters: 4735dnl $1 is the nominal value for _POSIX_C_SOURCE 4736AC_DEFUN([CF_POSIX_C_SOURCE], 4737[AC_REQUIRE([CF_POSIX_VISIBLE])dnl 4738 4739if test "$cf_cv_posix_visible" = no; then 4740 4741cf_POSIX_C_SOURCE=ifelse([$1],,199506L,[$1]) 4742 4743cf_save_CFLAGS="$CFLAGS" 4744cf_save_CPPFLAGS="$CPPFLAGS" 4745 4746CF_REMOVE_DEFINE(cf_trim_CFLAGS,$cf_save_CFLAGS,_POSIX_C_SOURCE) 4747CF_REMOVE_DEFINE(cf_trim_CPPFLAGS,$cf_save_CPPFLAGS,_POSIX_C_SOURCE) 4748 4749AC_CACHE_CHECK(if we should define _POSIX_C_SOURCE,cf_cv_posix_c_source,[ 4750 CF_MSG_LOG(if the symbol is already defined go no further) 4751 AC_TRY_COMPILE([#include <sys/types.h>],[ 4752#ifndef _POSIX_C_SOURCE 4753make an error 4754#endif], 4755 [cf_cv_posix_c_source=no], 4756 [cf_want_posix_source=no 4757 case .$cf_POSIX_C_SOURCE in 4758 .[[12]]??*) 4759 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" 4760 ;; 4761 .2) 4762 cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" 4763 cf_want_posix_source=yes 4764 ;; 4765 .*) 4766 cf_want_posix_source=yes 4767 ;; 4768 esac 4769 if test "$cf_want_posix_source" = yes ; then 4770 AC_TRY_COMPILE([#include <sys/types.h>],[ 4771#ifdef _POSIX_SOURCE 4772make an error 4773#endif],[], 4774 cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE") 4775 fi 4776 CF_MSG_LOG(ifdef from value $cf_POSIX_C_SOURCE) 4777 CFLAGS="$cf_trim_CFLAGS" 4778 CPPFLAGS="$cf_trim_CPPFLAGS" 4779 CF_APPEND_TEXT(CPPFLAGS,$cf_cv_posix_c_source) 4780 CF_MSG_LOG(if the second compile does not leave our definition intact error) 4781 AC_TRY_COMPILE([#include <sys/types.h>],[ 4782#ifndef _POSIX_C_SOURCE 4783make an error 4784#endif],, 4785 [cf_cv_posix_c_source=no]) 4786 CFLAGS="$cf_save_CFLAGS" 4787 CPPFLAGS="$cf_save_CPPFLAGS" 4788 ]) 4789]) 4790 4791if test "$cf_cv_posix_c_source" != no ; then 4792 CFLAGS="$cf_trim_CFLAGS" 4793 CPPFLAGS="$cf_trim_CPPFLAGS" 4794 CF_ADD_CFLAGS($cf_cv_posix_c_source) 4795fi 4796 4797fi # cf_cv_posix_visible 4798 4799])dnl 4800dnl --------------------------------------------------------------------------- 4801dnl CF_POSIX_JC version: 4 updated: 2019/12/31 20:39:42 4802dnl ----------- 4803dnl Check if we have POSIX-style job control (i.e., sigaction), or if we must 4804dnl use the signal functions. Use AC_CHECK_FUNCS(sigaction) first. 4805AC_DEFUN([CF_POSIX_JC],[ 4806 4807AC_REQUIRE([AC_TYPE_SIGNAL]) 4808AC_REQUIRE([CF_SIG_ARGS]) 4809 4810if test "$ac_cv_func_sigaction" = yes; then 4811 4812AC_CACHE_CHECK(whether sigaction needs _POSIX_SOURCE,cf_cv_sigact_bad,[ 4813AC_TRY_COMPILE([ 4814#include <sys/types.h> 4815#include <signal.h>],[struct sigaction act], 4816 [cf_cv_sigact_bad=no],[cf_cv_sigact_bad=yes]) 4817]) 4818 4819test "$cf_cv_sigact_bad" = yes && AC_DEFINE(SVR4_ACTION,1,[Define this to 1 if sigaction needs _POSIX_SOURCE]) 4820 4821AC_CACHE_CHECK(if we have sigaction/related functions,cf_cv_sigaction_funcs,[ 4822AC_TRY_LINK([ 4823#ifdef SVR4_ACTION 4824#define _POSIX_SOURCE 4825#endif 4826#include <sys/types.h> 4827#include <signal.h>],[ 4828 RETSIGTYPE (*func)(SIG_ARGS) = SIG_IGN; 4829 struct sigaction sa, osa; 4830 sa.sa_handler = func; 4831 sa.sa_flags = 0; 4832 sigemptyset (&sa.sa_mask); 4833 sigaction (SIGBUS,&sa,&osa);], 4834 [cf_cv_sigaction_funcs=yes], 4835 [cf_cv_sigaction_funcs=no])]) 4836 4837test "$cf_cv_sigaction_funcs" = yes && AC_DEFINE(HAVE_POSIX_JC,1,[Define this to 1 if we have POSIX-style job-control functions]) 4838 4839fi 4840])dnl 4841dnl --------------------------------------------------------------------------- 4842dnl CF_POSIX_VISIBLE version: 1 updated: 2018/12/31 20:46:17 4843dnl ---------------- 4844dnl POSIX documents test-macros which an application may set before any system 4845dnl headers are included to make features available. 4846dnl 4847dnl Some BSD platforms (originally FreeBSD, but copied by a few others) 4848dnl diverged from POSIX in 2002 by setting symbols which make all of the most 4849dnl recent features visible in the system header files unless the application 4850dnl overrides the corresponding test-macros. Doing that introduces portability 4851dnl problems. 4852dnl 4853dnl This macro makes a special check for the symbols used for this, to avoid a 4854dnl conflicting definition. 4855AC_DEFUN([CF_POSIX_VISIBLE], 4856[ 4857AC_CACHE_CHECK(if the POSIX test-macros are already defined,cf_cv_posix_visible,[ 4858AC_TRY_COMPILE([#include <stdio.h>],[ 4859#if defined(__POSIX_VISIBLE) && ((__POSIX_VISIBLE - 0L) > 0) \ 4860 && defined(__XSI_VISIBLE) && ((__XSI_VISIBLE - 0L) > 0) \ 4861 && defined(__BSD_VISIBLE) && ((__BSD_VISIBLE - 0L) > 0) \ 4862 && defined(__ISO_C_VISIBLE) && ((__ISO_C_VISIBLE - 0L) > 0) 4863#error conflicting symbols found 4864#endif 4865],[cf_cv_posix_visible=no],[cf_cv_posix_visible=yes]) 4866]) 4867])dnl 4868dnl --------------------------------------------------------------------------- 4869dnl CF_PROG_AR version: 1 updated: 2009/01/01 20:15:22 4870dnl ---------- 4871dnl Check for archiver "ar". 4872AC_DEFUN([CF_PROG_AR],[ 4873AC_CHECK_TOOL(AR, ar, ar) 4874]) 4875dnl --------------------------------------------------------------------------- 4876dnl CF_PROG_CC version: 5 updated: 2019/12/31 08:53:54 4877dnl ---------- 4878dnl standard check for CC, plus followup sanity checks 4879dnl $1 = optional parameter to pass to AC_PROG_CC to specify compiler name 4880AC_DEFUN([CF_PROG_CC],[ 4881CF_ACVERSION_CHECK(2.53, 4882 [AC_MSG_WARN(this will incorrectly handle gnatgcc choice) 4883 AC_REQUIRE([AC_PROG_CC])], 4884 []) 4885ifelse($1,,[AC_PROG_CC],[AC_PROG_CC($1)]) 4886CF_GCC_VERSION 4887CF_ACVERSION_CHECK(2.52, 4888 [AC_PROG_CC_STDC], 4889 [CF_ANSI_CC_REQD]) 4890CF_CC_ENV_FLAGS 4891])dnl 4892dnl --------------------------------------------------------------------------- 4893dnl CF_PROG_EXT version: 14 updated: 2018/06/20 20:23:13 4894dnl ----------- 4895dnl Compute $PROG_EXT, used for non-Unix ports, such as OS/2 EMX. 4896AC_DEFUN([CF_PROG_EXT], 4897[ 4898AC_REQUIRE([CF_CHECK_CACHE]) 4899case $cf_cv_system_name in 4900os2*) 4901 CFLAGS="$CFLAGS -Zmt" 4902 CF_APPEND_TEXT(CPPFLAGS,-D__ST_MT_ERRNO__) 4903 CXXFLAGS="$CXXFLAGS -Zmt" 4904 # autoconf's macro sets -Zexe and suffix both, which conflict:w 4905 LDFLAGS="$LDFLAGS -Zmt -Zcrtdll" 4906 ac_cv_exeext=.exe 4907 ;; 4908esac 4909 4910AC_EXEEXT 4911AC_OBJEXT 4912 4913PROG_EXT="$EXEEXT" 4914AC_SUBST(PROG_EXT) 4915test -n "$PROG_EXT" && AC_DEFINE_UNQUOTED(PROG_EXT,"$PROG_EXT",[Define to the program extension (normally blank)]) 4916])dnl 4917dnl --------------------------------------------------------------------------- 4918dnl CF_PROG_SUM_R version: 3 updated: 2019/12/31 20:39:42 4919dnl ------------- 4920dnl See if sum can take -r 4921AC_DEFUN([CF_PROG_SUM_R], 4922[ 4923if test $ac_cv_path_PATH_SUM 4924then 4925AC_MSG_CHECKING([if $ac_cv_path_PATH_SUM takes -r]) 4926AC_CACHE_VAL(ac_cv_prog_sum_r,[ 4927if AC_TRY_COMMAND($ac_cv_path_PATH_SUM -r config.log 1>&AC_FD_CC) 4928then 4929 ac_cv_prog_sum_r=yes 4930else 4931 ac_cv_prog_sum_r=no 4932fi 4933]) 4934if test $ac_cv_prog_sum_r = yes; then 4935 AC_DEFINE(SUM_TAKES_DASH_R,1,[Define this if the sum command support -r option]) 4936 AC_DEFINE_UNQUOTED(PATH_SUM_R, "$ac_cv_path_PATH_SUM -r", [Define this to the sum command, with -r option if supported]) 4937else 4938 AC_DEFINE_UNQUOTED(PATH_SUM_R, "$ac_cv_path_PATH_SUM") 4939fi 4940AC_MSG_RESULT($ac_cv_prog_sum_r) 4941fi 4942])dnl 4943dnl --------------------------------------------------------------------------- 4944dnl CF_PROG_YACC version: 2 updated: 1997/12/16 11:20:41 4945dnl ------------ 4946dnl A better version of AC_PROC_YACC, verifies that we'll only choose bison if 4947dnl we'll be able to compile with it. Bison uses alloca, which isn't all that 4948dnl portable. 4949AC_DEFUN([CF_PROG_YACC], 4950[ 4951AC_REQUIRE([AC_PROG_CC]) 4952AC_CACHE_VAL(cf_cv_prog_YACC,[ 4953if test -n "$YACC" ; then 4954 cf_cv_prog_YACC="$YACC" # Let the user override the test. 4955else 4956cat >conftest.y <<EOF 4957%{ 4958void yyerror(s) char *s; { } 4959%} 4960%token NUMBER 4961%% 4962time : NUMBER ':' NUMBER 4963 ; 4964%% 4965int yylex() { return NUMBER; } 4966int main() { return yyparse(); } 4967EOF 4968 for cf_prog in 'bison -y' byacc yacc 4969 do 4970 rm -f y.tab.[ch] 4971 AC_MSG_CHECKING(for $cf_prog) 4972 cf_command="$cf_prog conftest.y" 4973 cf_result=no 4974 if AC_TRY_EVAL(cf_command) && test -s y.tab.c ; then 4975 mv y.tab.c conftest.c 4976 rm -f y.tab.h 4977 if test "$cf_prog" = 'bison -y' ; then 4978 if AC_TRY_EVAL(ac_link) && test -s conftest ; then 4979 cf_result=yes 4980 fi 4981 else 4982 cf_result=yes 4983 fi 4984 fi 4985 AC_MSG_RESULT($cf_result) 4986 if test $cf_result = yes ; then 4987 cf_cv_prog_YACC="$cf_prog" 4988 break 4989 fi 4990 done 4991fi 4992]) 4993YACC="$cf_cv_prog_YACC" 4994AC_SUBST(YACC)dnl 4995])dnl 4996dnl --------------------------------------------------------------------------- 4997dnl CF_PW_GECOS version: 3 updated: 2019/12/31 20:39:42 4998dnl ----------- 4999dnl Check if the passwd-struct defines the '.pw_gecos' member (useful 5000dnl in decoding user names). 5001AC_DEFUN([CF_PW_GECOS], 5002[ 5003AC_CACHE_CHECK([for passwd.pw_gecos], cf_cv_pw_gecos,[ 5004 AC_TRY_COMPILE([ 5005#include <pwd.h> 5006],[ 5007 struct passwd foo; 5008 char bar = foo.pw_gecos], 5009 [cf_cv_pw_gecos=yes], 5010 [cf_cv_pw_gecos=no])]) 5011test $cf_cv_pw_gecos = no && AC_DEFINE(DONT_HAVE_PW_GECOS,1,[Define this to 1 if passwd struct has .pw_gecos]) 5012])dnl 5013dnl --------------------------------------------------------------------------- 5014dnl CF_RECHECK_FUNC version: 3 updated: 2000/10/18 19:29:13 5015dnl --------------- 5016dnl Re-check on a function to see if we can pick it up by adding a library. 5017dnl $1 = function to check 5018dnl $2 = library to check in 5019dnl $3 = environment to update (e.g., $LIBS) 5020dnl $4 = what to do if this fails 5021dnl 5022dnl This uses 'unset' if the shell happens to support it, but leaves the 5023dnl configuration variable set to 'unknown' if not. This is a little better 5024dnl than the normal autoconf test, which gives misleading results if a test 5025dnl for the function is made (e.g., with AC_CHECK_FUNC) after this macro is 5026dnl used (autoconf does not distinguish between a null token and one that is 5027dnl set to 'no'). 5028AC_DEFUN([CF_RECHECK_FUNC],[ 5029AC_CHECK_LIB($2,$1,[ 5030 CF_UPPER(cf_tr_func,$1) 5031 AC_DEFINE_UNQUOTED(HAVE_$cf_tr_func) 5032 ac_cv_func_$1=yes 5033 if test "$cf_used_lib_$2" != yes ; then cf_used_lib_$2=yes; $3="-l$2 [$]$3"; fi],[ 5034 ac_cv_func_$1=unknown 5035 unset ac_cv_func_$1 2>/dev/null 5036 $4], 5037 [[$]$3]) 5038])dnl 5039dnl --------------------------------------------------------------------------- 5040dnl CF_REMOVE_DEFINE version: 3 updated: 2010/01/09 11:05:50 5041dnl ---------------- 5042dnl Remove all -U and -D options that refer to the given symbol from a list 5043dnl of C compiler options. This works around the problem that not all 5044dnl compilers process -U and -D options from left-to-right, so a -U option 5045dnl cannot be used to cancel the effect of a preceding -D option. 5046dnl 5047dnl $1 = target (which could be the same as the source variable) 5048dnl $2 = source (including '$') 5049dnl $3 = symbol to remove 5050define([CF_REMOVE_DEFINE], 5051[ 5052$1=`echo "$2" | \ 5053 sed -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[[ ]]/ /g' \ 5054 -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[$]//g'` 5055])dnl 5056dnl --------------------------------------------------------------------------- 5057dnl CF_RESTORE_XTRA_FLAGS version: 1 updated: 2020/01/11 16:47:45 5058dnl --------------------- 5059dnl Restore flags saved in CF_SAVE_XTRA_FLAGS 5060dnl $1 = name of current macro 5061define([CF_RESTORE_XTRA_FLAGS], 5062[ 5063LIBS="$cf_save_LIBS_$1" 5064CFLAGS="$cf_save_CFLAGS_$1" 5065CPPFLAGS="$cf_save_CPPFLAGS_$1" 5066])dnl 5067dnl --------------------------------------------------------------------------- 5068dnl CF_SAVE_XTRA_FLAGS version: 1 updated: 2020/01/11 16:46:44 5069dnl ------------------ 5070dnl Use this macro to save CFLAGS/CPPFLAGS/LIBS before checks against X headers 5071dnl and libraries which do not update those variables. 5072dnl 5073dnl $1 = name of current macro 5074define([CF_SAVE_XTRA_FLAGS], 5075[ 5076cf_save_LIBS_$1="$LIBS" 5077cf_save_CFLAGS_$1="$CFLAGS" 5078cf_save_CPPFLAGS_$1="$CPPFLAGS" 5079LIBS="$LIBS ${X_PRE_LIBS} ${X_LIBS} ${X_EXTRA_LIBS}" 5080for cf_X_CFLAGS in $X_CFLAGS 5081do 5082 case "x$cf_X_CFLAGS" in 5083 x-[[IUD]]*) 5084 CPPFLAGS="$CPPFLAGS $cf_X_CFLAGS" 5085 ;; 5086 *) 5087 CFLAGS="$CFLAGS $cf_X_CFLAGS" 5088 ;; 5089 esac 5090done 5091])dnl 5092dnl --------------------------------------------------------------------------- 5093dnl CF_SIGWINCH version: 3 updated: 2020/03/10 18:53:47 5094dnl ----------- 5095dnl Use this macro after CF_XOPEN_SOURCE, but do not require it (not all 5096dnl programs need this test). 5097dnl 5098dnl This is really a Mac OS X 10.4.3 workaround. Defining _POSIX_C_SOURCE 5099dnl forces SIGWINCH to be undefined (breaks xterm, ncurses). Oddly, the struct 5100dnl winsize declaration is left alone - we may revisit this if Apple choose to 5101dnl break that part of the interface as well. 5102AC_DEFUN([CF_SIGWINCH], 5103[ 5104AC_CACHE_CHECK(if SIGWINCH is defined,cf_cv_define_sigwinch,[ 5105 AC_TRY_COMPILE([ 5106#include <sys/types.h> 5107#include <sys/signal.h> 5108],[int x = SIGWINCH; (void)x], 5109 [cf_cv_define_sigwinch=yes], 5110 [AC_TRY_COMPILE([ 5111#undef _XOPEN_SOURCE 5112#undef _POSIX_SOURCE 5113#undef _POSIX_C_SOURCE 5114#include <sys/types.h> 5115#include <sys/signal.h> 5116],[int x = SIGWINCH; (void)x], 5117 [cf_cv_define_sigwinch=maybe], 5118 [cf_cv_define_sigwinch=no]) 5119]) 5120]) 5121 5122if test "$cf_cv_define_sigwinch" = maybe ; then 5123AC_CACHE_CHECK(for actual SIGWINCH definition,cf_cv_fixup_sigwinch,[ 5124cf_cv_fixup_sigwinch=unknown 5125cf_sigwinch=32 5126while test $cf_sigwinch != 1 5127do 5128 AC_TRY_COMPILE([ 5129#undef _XOPEN_SOURCE 5130#undef _POSIX_SOURCE 5131#undef _POSIX_C_SOURCE 5132#include <sys/types.h> 5133#include <sys/signal.h> 5134],[ 5135#if SIGWINCH != $cf_sigwinch 5136make an error 5137#endif 5138int x = SIGWINCH; (void)x], 5139 [cf_cv_fixup_sigwinch=$cf_sigwinch 5140 break]) 5141 5142cf_sigwinch=`expr $cf_sigwinch - 1` 5143done 5144]) 5145 5146 if test "$cf_cv_fixup_sigwinch" != unknown ; then 5147 CPPFLAGS="$CPPFLAGS -DSIGWINCH=$cf_cv_fixup_sigwinch" 5148 fi 5149fi 5150])dnl 5151dnl --------------------------------------------------------------------------- 5152dnl CF_SIG_ARGS version: 3 updated: 2019/12/31 20:39:42 5153dnl ----------- 5154dnl Check for systems that have signal-handlers prototyped with one argument 5155dnl versus those with more than one argument, define the symbol SIG_ARGS to 5156dnl match. (If it's empty, that's ok too). 5157AC_DEFUN([CF_SIG_ARGS], 5158[ 5159AC_MSG_CHECKING([declaration of signal arguments]) 5160AC_CACHE_VAL(cf_cv_sig_args,[ 5161cf_cv_sig_args= 5162for cf_test in "int sig" "int sig, ..." 5163do 5164 AC_TRY_COMPILE([ 5165#include <signal.h>], 5166 [extern RETSIGTYPE catch($cf_test); signal(SIGINT, catch)], 5167 [cf_cv_sig_args="$cf_test";break]) 5168done 5169]) 5170AC_MSG_RESULT($cf_cv_sig_args) 5171AC_DEFINE_UNQUOTED(SIG_ARGS,$cf_cv_sig_args,[Define this to 1 if signal handlers are prototyped with more than one argument]) 5172])dnl 5173dnl --------------------------------------------------------------------------- 5174dnl CF_SIG_CONST version: 5 updated: 2019/12/31 20:39:42 5175dnl ------------ 5176dnl Check for systems where the special signal constants aren't prototyped 5177dnl (there's a lot of them, and the compiler can generate a lot of warning 5178dnl messages that make it hard to pick out genuine errors). 5179AC_DEFUN([CF_SIG_CONST], 5180[ 5181AC_REQUIRE([CF_SIG_ARGS]) 5182AC_MSG_CHECKING([for redefinable signal constants]) 5183AC_CACHE_VAL(cf_cv_sig_const,[ 5184cf_cv_sig_const=no 5185if test -n "$cf_cv_sig_args"; then 5186 cf_test=`echo $cf_cv_sig_args|sed -e s/sig//` 5187 AC_TRY_RUN([ 5188#define NEW_DFL ((RETSIGTYPE (*)($cf_test))0) 5189#define NEW_IGN ((RETSIGTYPE (*)($cf_test))1) 5190#define NEW_ERR ((RETSIGTYPE (*)($cf_test))-1) 5191 5192#include <signal.h> 5193 5194int main() 5195{ 5196 if (NEW_DFL != SIG_DFL 5197 || NEW_IGN != SIG_IGN 5198 || NEW_ERR != SIG_ERR 5199 /* at least one system won't let me redefine these! */ 5200#undef SIG_DFL 5201#undef SIG_IGN 5202#undef SIG_ERR 5203#define SIG_DFL NEW_DFL 5204#define SIG_IGN NEW_IGN 5205#define SIG_ERR NEW_ERR 5206 || NEW_DFL != SIG_DFL) 5207 ${cf_cv_main_return:-return}(1); 5208 signal(SIGINT, SIG_DFL); 5209 ${cf_cv_main_return:-return}(0); 5210}], 5211 [cf_cv_sig_const=yes], 5212 [cf_cv_sig_const=no], 5213 [cf_cv_sig_const=unknown]) 5214fi 5215]) 5216AC_MSG_RESULT($cf_cv_sig_const) 5217test "$cf_cv_sig_const" = yes && AC_DEFINE(DECL_SIG_CONST,1,[Define this to 1 for redefinable signal constants]) 5218])dnl 5219dnl --------------------------------------------------------------------------- 5220dnl CF_SIZECHANGE version: 16 updated: 2020/03/19 20:46:13 5221dnl ------------- 5222dnl Check for definitions & structures needed for window size-changing 5223dnl 5224dnl https://stackoverflow.com/questions/18878141/difference-between-structures-ttysize-and-winsize/50769952#50769952 5225AC_DEFUN([CF_SIZECHANGE], 5226[ 5227AC_REQUIRE([CF_STRUCT_TERMIOS]) 5228AC_CACHE_CHECK(declaration of size-change, cf_cv_sizechange,[ 5229 cf_cv_sizechange=unknown 5230 cf_save_CPPFLAGS="$CPPFLAGS" 5231 5232for cf_opts in "" "NEED_PTEM_H" 5233do 5234 5235 CPPFLAGS="$cf_save_CPPFLAGS" 5236 if test -n "$cf_opts" 5237 then 5238 CF_APPEND_TEXT(CPPFLAGS,-D$cf_opts) 5239 fi 5240 AC_TRY_COMPILE([#include <sys/types.h> 5241#ifdef HAVE_TERMIOS_H 5242#include <termios.h> 5243#else 5244#ifdef HAVE_TERMIO_H 5245#include <termio.h> 5246#endif 5247#endif 5248 5249#ifdef NEED_PTEM_H 5250/* This is a workaround for SCO: they neglected to define struct winsize in 5251 * termios.h -- it's only in termio.h and ptem.h 5252 */ 5253#include <sys/stream.h> 5254#include <sys/ptem.h> 5255#endif 5256 5257#ifdef HAVE_SYS_IOCTL_H 5258#include <sys/ioctl.h> 5259#endif 5260],[ 5261#ifdef TIOCGSIZE 5262 struct ttysize win; /* SunOS 3.0... */ 5263 int y = win.ts_lines = 2; 5264 int x = win.ts_cols = 1; 5265 (void)y; 5266 (void)x; 5267#else 5268#ifdef TIOCGWINSZ 5269 struct winsize win; /* everything else */ 5270 int y = win.ws_row = 2; 5271 int x = win.ws_col = 1; 5272 (void)y; 5273 (void)x; 5274#else 5275 no TIOCGSIZE or TIOCGWINSZ 5276#endif /* TIOCGWINSZ */ 5277#endif /* TIOCGSIZE */ 5278 ], 5279 [cf_cv_sizechange=yes], 5280 [cf_cv_sizechange=no]) 5281 5282 CPPFLAGS="$cf_save_CPPFLAGS" 5283 if test "$cf_cv_sizechange" = yes ; then 5284 echo "size-change succeeded ($cf_opts)" >&AC_FD_CC 5285 test -n "$cf_opts" && cf_cv_sizechange="$cf_opts" 5286 break 5287 fi 5288done 5289]) 5290if test "$cf_cv_sizechange" != no ; then 5291 AC_DEFINE(HAVE_SIZECHANGE,1,[Define to 1 if sizechange declarations are provided]) 5292 case $cf_cv_sizechange in 5293 NEED*) 5294 AC_DEFINE_UNQUOTED($cf_cv_sizechange ) 5295 ;; 5296 esac 5297fi 5298])dnl 5299dnl --------------------------------------------------------------------------- 5300dnl CF_SOCKS version: 9 updated: 2012/11/08 20:57:52 5301dnl -------- 5302dnl Check for socks library 5303dnl $1 = the [optional] directory in which the library may be found 5304AC_DEFUN([CF_SOCKS],[ 5305 CF_ADD_OPTIONAL_PATH($1, [socks library]) 5306 CF_FIND_LINKAGE([ 5307#include <stdio.h> 5308],[ 5309 Raccept((char *)0) 5310], 5311 socks) 5312 5313 if test "x$cf_cv_find_linkage_socks" = "xyes" ; then 5314 AC_DEFINE(SOCKS,1,[Define to 1 if we are using socks library]) 5315 5316 AC_DEFINE(accept,Raccept,[Define to override function name if using socks library]) 5317 AC_DEFINE(bind,Rbind,[Define to override function name if using socks library]) 5318 AC_DEFINE(connect,Rconnect,[Define to override function name if using socks library]) 5319 AC_DEFINE(getpeername,Rgetpeername,[Define to override function name if using socks library]) 5320 AC_DEFINE(getsockname,Rgetsockname,[Define to override function name if using socks library]) 5321 AC_DEFINE(listen,Rlisten,[Define to override function name if using socks library]) 5322 AC_DEFINE(recvfrom,Rrecvfrom,[Define to override function name if using socks library]) 5323 AC_DEFINE(select,Rselect,[Define to override function name if using socks library]) 5324 else 5325 AC_MSG_ERROR(cannot link with socks library) 5326 fi 5327])dnl 5328dnl --------------------------------------------------------------------------- 5329dnl CF_SOCKS5 version: 12 updated: 2012/11/08 20:57:52 5330dnl --------- 5331dnl Check for socks5 configuration 5332dnl $1 = the [optional] directory in which the library may be found 5333AC_DEFUN([CF_SOCKS5],[ 5334 CF_ADD_OPTIONAL_PATH($1, [socks5 library]) 5335 5336CF_ADD_LIBS(-lsocks5) 5337 5338AC_DEFINE(USE_SOCKS5,1,[Define to 1 if we are using socks5 library]) 5339AC_DEFINE(SOCKS,1,[Define to 1 if we are using socks library]) 5340 5341AC_MSG_CHECKING(if the socks library uses socks4 prefix) 5342cf_use_socks4=error 5343AC_TRY_LINK([ 5344#include <socks.h>],[ 5345 Rinit((char *)0)], 5346 [AC_DEFINE(USE_SOCKS4_PREFIX,1,[Define to 1 if socks library uses socks4 prefix]) 5347 cf_use_socks4=yes], 5348 [AC_TRY_LINK([#include <socks.h>], 5349 [SOCKSinit((char *)0)], 5350 [cf_use_socks4=no], 5351 [AC_MSG_ERROR(Cannot link with socks5 library)])]) 5352AC_MSG_RESULT($cf_use_socks4) 5353 5354if test "$cf_use_socks4" = "yes" ; then 5355 AC_DEFINE(accept,Raccept) 5356 AC_DEFINE(bind,Rbind) 5357 AC_DEFINE(connect,Rconnect) 5358 AC_DEFINE(getpeername,Rgetpeername) 5359 AC_DEFINE(getsockname,Rgetsockname) 5360 AC_DEFINE(listen,Rlisten) 5361 AC_DEFINE(recvfrom,Rrecvfrom) 5362 AC_DEFINE(select,Rselect) 5363else 5364 AC_DEFINE(accept,SOCKSaccept) 5365 AC_DEFINE(getpeername,SOCKSgetpeername) 5366 AC_DEFINE(getsockname,SOCKSgetsockname) 5367 AC_DEFINE(recvfrom,SOCKSrecvfrom) 5368fi 5369 5370AC_MSG_CHECKING(if socks5p.h is available) 5371AC_TRY_COMPILE([ 5372#define INCLUDE_PROTOTYPES 5373#include <socks.h>],[ 5374 init((char *)0)], 5375 [cf_use_socks5p_h=yes], 5376 [cf_use_socks5p_h=no]) 5377AC_MSG_RESULT($cf_use_socks5p_h) 5378 5379test "$cf_use_socks5p_h" = yes && AC_DEFINE(INCLUDE_PROTOTYPES,1,[Define to 1 if needed to declare prototypes in socks headers]) 5380])dnl 5381dnl --------------------------------------------------------------------------- 5382dnl CF_STRERROR version: 2 updated: 2001/07/11 09:34:49 5383dnl ----------- 5384dnl Check for strerror(), or it is not found, for the related data. POSIX 5385dnl requires strerror(), so only old systems such as SunOS lack it. 5386AC_DEFUN([CF_STRERROR],[ 5387AC_CHECK_FUNCS(strerror, AC_DEFINE(HAVE_STRERROR),[CF_SYS_ERRLIST]) 5388])dnl 5389dnl --------------------------------------------------------------------------- 5390dnl CF_STRUCT_TERMIOS version: 11 updated: 2020/03/19 20:46:13 5391dnl ----------------- 5392dnl Some machines require _POSIX_SOURCE to completely define struct termios. 5393AC_DEFUN([CF_STRUCT_TERMIOS],[ 5394AC_REQUIRE([CF_XOPEN_SOURCE]) 5395 5396AC_CHECK_HEADERS( \ 5397termio.h \ 5398termios.h \ 5399unistd.h \ 5400sys/ioctl.h \ 5401sys/termio.h \ 5402) 5403 5404if test "$ac_cv_header_termios_h" = yes ; then 5405 case "$CFLAGS $CPPFLAGS" in 5406 *-D_POSIX_SOURCE*) 5407 termios_bad=dunno ;; 5408 *) termios_bad=maybe ;; 5409 esac 5410 if test "$termios_bad" = maybe ; then 5411 AC_MSG_CHECKING(whether termios.h needs _POSIX_SOURCE) 5412 AC_TRY_COMPILE([#include <termios.h>], 5413 [struct termios foo; int x = foo.c_iflag = 1; (void)x], 5414 termios_bad=no, [ 5415 AC_TRY_COMPILE([ 5416#define _POSIX_SOURCE 5417#include <termios.h>], 5418 [struct termios foo; int x = foo.c_iflag = 2; (void)x], 5419 termios_bad=unknown, 5420 termios_bad=yes AC_DEFINE(_POSIX_SOURCE,1,[Define to 1 if we must define _POSIX_SOURCE])) 5421 ]) 5422 AC_MSG_RESULT($termios_bad) 5423 fi 5424fi 5425])dnl 5426dnl --------------------------------------------------------------------------- 5427dnl CF_SUBDIR_PATH version: 7 updated: 2014/12/04 04:33:06 5428dnl -------------- 5429dnl Construct a search-list for a nonstandard header/lib-file 5430dnl $1 = the variable to return as result 5431dnl $2 = the package name 5432dnl $3 = the subdirectory, e.g., bin, include or lib 5433AC_DEFUN([CF_SUBDIR_PATH], 5434[ 5435$1= 5436 5437CF_ADD_SUBDIR_PATH($1,$2,$3,$prefix,NONE) 5438 5439for cf_subdir_prefix in \ 5440 /usr \ 5441 /usr/local \ 5442 /usr/pkg \ 5443 /opt \ 5444 /opt/local \ 5445 [$]HOME 5446do 5447 CF_ADD_SUBDIR_PATH($1,$2,$3,$cf_subdir_prefix,$prefix) 5448done 5449])dnl 5450dnl --------------------------------------------------------------------------- 5451dnl CF_SYS_ERRLIST version: 6 updated: 2001/12/30 13:03:23 5452dnl -------------- 5453dnl Check for declaration of sys_nerr and sys_errlist in one of stdio.h and 5454dnl errno.h. Declaration of sys_errlist on BSD4.4 interferes with our 5455dnl declaration. Reported by Keith Bostic. 5456AC_DEFUN([CF_SYS_ERRLIST], 5457[ 5458 CF_CHECK_ERRNO(sys_nerr) 5459 CF_CHECK_ERRNO(sys_errlist) 5460])dnl 5461dnl --------------------------------------------------------------------------- 5462dnl CF_SYS_SELECT_TIMEVAL version: 5 updated: 2019/12/31 20:39:42 5463dnl --------------------- 5464dnl Check if there is a conflict between <sys/select.h> and <sys/time.h>. 5465dnl This is known to be a problem with SCO. 5466AC_DEFUN([CF_SYS_SELECT_TIMEVAL], 5467[ 5468AC_MSG_CHECKING(if sys/time.h conflicts with sys/select.h) 5469AC_CACHE_VAL(cf_cv_sys_select_timeval,[ 5470for cf_opts in no yes 5471do 5472AC_TRY_COMPILE([ 5473#define yes 1 5474#define no 0 5475#if $cf_opts 5476#define timeval fake_timeval 5477#endif 5478#include <sys/types.h> 5479#ifdef TIME_WITH_SYS_TIME 5480# include <sys/time.h> 5481# include <time.h> 5482#else 5483# ifdef HAVE_SYS_TIME_H 5484# include <sys/time.h> 5485# else 5486# include <time.h> 5487# endif 5488#endif 5489#undef timeval 5490#ifdef HAVE_SYS_SELECT_H 5491# include <sys/select.h> 5492#endif 5493],[struct timeval foo], 5494 [cf_cv_sys_select_timeval=$cf_opts 5495 break], 5496 [cf_cv_sys_select_timeval=no]) 5497done 5498]) 5499AC_MSG_RESULT($cf_cv_sys_select_timeval) 5500test $cf_cv_sys_select_timeval = yes && AC_DEFINE(NEED_TIMEVAL_FIX,1,[Define this to 1 if sys/time.h conflicts with sys/select.h]) 5501]) 5502dnl --------------------------------------------------------------------------- 5503dnl CF_TERMCAP_LIBS version: 15 updated: 2015/04/15 19:08:48 5504dnl --------------- 5505dnl Look for termcap libraries, or the equivalent in terminfo. 5506dnl 5507dnl The optional parameter may be "ncurses", "ncursesw". 5508AC_DEFUN([CF_TERMCAP_LIBS], 5509[ 5510AC_CACHE_VAL(cf_cv_termlib,[ 5511cf_cv_termlib=none 5512AC_TRY_LINK([],[char *x=(char*)tgoto("",0,0)], 5513[AC_TRY_LINK([],[int x=tigetstr("")], 5514 [cf_cv_termlib=terminfo], 5515 [cf_cv_termlib=termcap]) 5516 CF_VERBOSE(using functions in predefined $cf_cv_termlib LIBS) 5517],[ 5518ifelse([$1],,,[ 5519case "$1" in 5520ncurses*) 5521 CF_NCURSES_CONFIG($1) 5522 cf_cv_termlib=terminfo 5523 ;; 5524esac 5525]) 5526if test "$cf_cv_termlib" = none; then 5527 # FreeBSD's linker gives bogus results for AC_CHECK_LIB, saying that 5528 # tgetstr lives in -lcurses when it is only an unsatisfied extern. 5529 cf_save_LIBS="$LIBS" 5530 for cf_lib in tinfo curses ncurses termlib termcap 5531 do 5532 LIBS="-l$cf_lib $cf_save_LIBS" 5533 for cf_func in tigetstr tgetstr 5534 do 5535 AC_MSG_CHECKING(for $cf_func in -l$cf_lib) 5536 AC_TRY_LINK([],[int x=$cf_func("")],[cf_result=yes],[cf_result=no]) 5537 AC_MSG_RESULT($cf_result) 5538 if test "$cf_result" = yes ; then 5539 if test "$cf_func" = tigetstr ; then 5540 cf_cv_termlib=terminfo 5541 else 5542 cf_cv_termlib=termcap 5543 fi 5544 break 5545 fi 5546 done 5547 test "$cf_result" = yes && break 5548 done 5549 test "$cf_result" = no && LIBS="$cf_save_LIBS" 5550fi 5551if test "$cf_cv_termlib" = none; then 5552 # allow curses library for broken AIX system. 5553 AC_CHECK_LIB(curses, initscr, [CF_ADD_LIBS(-lcurses)]) 5554 AC_CHECK_LIB(termcap, tgoto, [CF_ADD_LIBS(-ltermcap) cf_cv_termlib=termcap]) 5555fi 5556]) 5557if test "$cf_cv_termlib" = none; then 5558 AC_MSG_WARN([Cannot find -ltermlib, -lcurses, or -ltermcap]) 5559fi 5560])])dnl 5561dnl --------------------------------------------------------------------------- 5562dnl CF_TERMIOS version: 3 updated: 2019/12/31 20:39:42 5563dnl ---------- 5564dnl See if we can link with the termios functions tcsetattr/tcgetattr 5565AC_DEFUN([CF_TERMIOS], 5566[ 5567AC_MSG_CHECKING([for nonconflicting termios.h]) 5568AC_CACHE_VAL(cf_cv_use_termios_h,[ 5569 AC_TRY_LINK([ 5570#ifdef HAVE_IOCTL_H 5571# include <ioctl.h> 5572#else 5573# ifdef HAVE_SYS_IOCTL_H 5574# include <sys/ioctl.h> 5575# endif 5576#endif 5577 5578#if !defined(sun) || !defined(NL0) 5579#include <termios.h> 5580#endif 5581],[ 5582 struct termios save_tty; 5583 (void) tcsetattr (0, TCSANOW, &save_tty); 5584 (void) tcgetattr (0, &save_tty)], 5585 [cf_cv_use_termios_h=yes], 5586 [cf_cv_use_termios_h=no]) 5587]) 5588AC_MSG_RESULT($cf_cv_use_termios_h) 5589if test $cf_cv_use_termios_h = yes; then 5590 AC_DEFINE(HAVE_TERMIOS_H,1,[Define this to 1 if we have header termios.h]) 5591 AC_DEFINE(HAVE_TCGETATTR,1,[Define this to 1 if we have function tcgetattr]) 5592 AC_DEFINE(HAVE_TCSETATTR,1,[Define this to 1 if we have function tcsetattr]) 5593fi 5594])dnl 5595dnl --------------------------------------------------------------------------- 5596dnl CF_TERM_HEADER version: 5 updated: 2020/03/19 20:23:48 5597dnl -------------- 5598dnl Look for term.h, which is part of X/Open curses. It defines the interface 5599dnl to terminfo database. Usually it is in the same include-path as curses.h, 5600dnl but some packagers change this, breaking various applications. 5601AC_DEFUN([CF_TERM_HEADER],[ 5602AC_CACHE_CHECK(for terminfo header, cf_cv_term_header,[ 5603case ${cf_cv_ncurses_header} in 5604*/ncurses.h|*/ncursesw.h) 5605 cf_term_header=`echo "$cf_cv_ncurses_header" | sed -e 's%ncurses[[^.]]*\.h$%term.h%'` 5606 ;; 5607*) 5608 cf_term_header=term.h 5609 ;; 5610esac 5611 5612for cf_test in $cf_term_header "ncurses/term.h" "ncursesw/term.h" 5613do 5614AC_TRY_COMPILE([#include <stdio.h> 5615#include <${cf_cv_ncurses_header:-curses.h}> 5616#include <$cf_test> 5617],[int x = auto_left_margin; (void)x],[ 5618 cf_cv_term_header="$cf_test"],[ 5619 cf_cv_term_header=unknown 5620 ]) 5621 test "$cf_cv_term_header" != unknown && break 5622done 5623]) 5624 5625# Set definitions to allow ifdef'ing to accommodate subdirectories 5626 5627case $cf_cv_term_header in 5628*term.h) 5629 AC_DEFINE(HAVE_TERM_H,1,[Define to 1 if we have term.h]) 5630 ;; 5631esac 5632 5633case $cf_cv_term_header in 5634ncurses/term.h) 5635 AC_DEFINE(HAVE_NCURSES_TERM_H,1,[Define to 1 if we have ncurses/term.h]) 5636 ;; 5637ncursesw/term.h) 5638 AC_DEFINE(HAVE_NCURSESW_TERM_H,1,[Define to 1 if we have ncursesw/term.h]) 5639 ;; 5640esac 5641])dnl 5642dnl --------------------------------------------------------------------------- 5643dnl CF_TIOCGWINSZ version: 6 updated: 2019/12/31 20:39:42 5644dnl ------------- 5645dnl On some systems ioctl(fd, TIOCGWINSZ, &size) will always return {0,0} until 5646dnl ioctl(fd, TIOCSWINSZ, &size) is called to explicitly set the size of the 5647dnl screen. 5648dnl 5649dnl Attempt to determine if we're on such a system by running a test-program. 5650dnl This won't work, of course, if the configure script is run in batch mode, 5651dnl since we've got to have access to the terminal. 5652dnl 5653dnl CHECK_DECL_FLAG and CHECK_DECL_HDRS must be set in configure.in 5654AC_DEFUN([CF_TIOCGWINSZ], 5655[ 5656AC_MSG_CHECKING([for working TIOCGWINSZ]) 5657AC_CACHE_VAL(cf_cv_use_tiocgwinsz,[ 5658 cf_save_CFLAGS="$CFLAGS" 5659 CFLAGS="$CFLAGS -D__CPROTO__ $CHECK_DECL_FLAG" 5660 AC_TRY_RUN([ 5661$CHECK_DECL_HDRS 5662int main() 5663{ 5664 int fd; 5665 for (fd = 0; fd <= 2; fd++) { /* try in/out/err in case redirected */ 5666#ifdef TIOCGSIZE 5667 struct ttysize size; 5668 if (ioctl (0, TIOCGSIZE, &size) == 0 5669 && size.ts_lines > 0 5670 && size.ts_cols > 0) 5671 ${cf_cv_main_return:-return}(0); 5672#else 5673 struct winsize size; 5674 if (ioctl(0, TIOCGWINSZ, &size) == 0 5675 && size.ws_row > 0 5676 && size.ws_col > 0) 5677 ${cf_cv_main_return:-return}(0); 5678#endif 5679 } 5680 ${cf_cv_main_return:-return}(0); /* we cannot guarantee this is run interactively */ 5681}], 5682 [cf_cv_use_tiocgwinsz=yes], 5683 [cf_cv_use_tiocgwinsz=no], 5684 [cf_cv_use_tiocgwinsz=unknown]) 5685 rm -f autoconf.h 5686 CFLAGS="$cf_save_CFLAGS"]) 5687AC_MSG_RESULT($cf_cv_use_tiocgwinsz) 5688test $cf_cv_use_tiocgwinsz != yes && AC_DEFINE(DONT_HAVE_SIGWINCH,1,[Define this to 1 for working TIOCGWINSZ]) 5689])dnl 5690dnl --------------------------------------------------------------------------- 5691dnl CF_TM_GMTOFF version: 3 updated: 2012/11/08 20:57:52 5692dnl ------------ 5693dnl Check if the tm-struct defines the '.tm_gmtoff' member (useful in decoding 5694dnl dates). 5695AC_DEFUN([CF_TM_GMTOFF], 5696[ 5697AC_MSG_CHECKING([for tm.tm_gmtoff]) 5698AC_CACHE_VAL(cf_cv_tm_gmtoff,[ 5699 AC_TRY_COMPILE([ 5700#ifdef TIME_WITH_SYS_TIME 5701# include <sys/time.h> 5702# include <time.h> 5703#else 5704# ifdef HAVE_SYS_TIME_H 5705# include <sys/time.h> 5706# else 5707# include <time.h> 5708# endif 5709#endif 5710],[ 5711 struct tm foo; 5712 long bar = foo.tm_gmtoff], 5713 [cf_cv_tm_gmtoff=yes], 5714 [cf_cv_tm_gmtoff=no])]) 5715AC_MSG_RESULT($cf_cv_tm_gmtoff) 5716test $cf_cv_tm_gmtoff = no && AC_DEFINE(DONT_HAVE_TM_GMTOFF,1,[Define to 1 if the tm-struct defines .tm_gmtoff member]) 5717])dnl 5718dnl --------------------------------------------------------------------------- 5719dnl CF_TRIM_X_LIBS version: 3 updated: 2015/04/12 15:39:00 5720dnl -------------- 5721dnl Trim extra base X libraries added as a workaround for inconsistent library 5722dnl dependencies returned by "new" pkg-config files. 5723AC_DEFUN([CF_TRIM_X_LIBS],[ 5724 for cf_trim_lib in Xmu Xt X11 5725 do 5726 case "$LIBS" in 5727 *-l$cf_trim_lib\ *-l$cf_trim_lib*) 5728 LIBS=`echo "$LIBS " | sed -e 's/ / /g' -e 's%-l'"$cf_trim_lib"' %%' -e 's/ $//'` 5729 CF_VERBOSE(..trimmed $LIBS) 5730 ;; 5731 esac 5732 done 5733]) 5734dnl --------------------------------------------------------------------------- 5735dnl CF_TRY_PKG_CONFIG version: 5 updated: 2013/07/06 21:27:06 5736dnl ----------------- 5737dnl This is a simple wrapper to use for pkg-config, for libraries which may be 5738dnl available in that form. 5739dnl 5740dnl $1 = package name 5741dnl $2 = extra logic to use, if any, after updating CFLAGS and LIBS 5742dnl $3 = logic to use if pkg-config does not have the package 5743AC_DEFUN([CF_TRY_PKG_CONFIG],[ 5744AC_REQUIRE([CF_PKG_CONFIG]) 5745 5746if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists $1; then 5747 CF_VERBOSE(found package $1) 5748 cf_pkgconfig_incs="`$PKG_CONFIG --cflags $1 2>/dev/null`" 5749 cf_pkgconfig_libs="`$PKG_CONFIG --libs $1 2>/dev/null`" 5750 CF_VERBOSE(package $1 CFLAGS: $cf_pkgconfig_incs) 5751 CF_VERBOSE(package $1 LIBS: $cf_pkgconfig_libs) 5752 CF_ADD_CFLAGS($cf_pkgconfig_incs) 5753 CF_ADD_LIBS($cf_pkgconfig_libs) 5754 ifelse([$2],,:,[$2]) 5755else 5756 cf_pkgconfig_incs= 5757 cf_pkgconfig_libs= 5758 ifelse([$3],,:,[$3]) 5759fi 5760]) 5761dnl --------------------------------------------------------------------------- 5762dnl CF_TRY_XOPEN_SOURCE version: 2 updated: 2018/06/20 20:23:13 5763dnl ------------------- 5764dnl If _XOPEN_SOURCE is not defined in the compile environment, check if we 5765dnl can define it successfully. 5766AC_DEFUN([CF_TRY_XOPEN_SOURCE],[ 5767AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[ 5768 AC_TRY_COMPILE([ 5769#include <stdlib.h> 5770#include <string.h> 5771#include <sys/types.h> 5772],[ 5773#ifndef _XOPEN_SOURCE 5774make an error 5775#endif], 5776 [cf_cv_xopen_source=no], 5777 [cf_save="$CPPFLAGS" 5778 CF_APPEND_TEXT(CPPFLAGS,-D_XOPEN_SOURCE=$cf_XOPEN_SOURCE) 5779 AC_TRY_COMPILE([ 5780#include <stdlib.h> 5781#include <string.h> 5782#include <sys/types.h> 5783],[ 5784#ifdef _XOPEN_SOURCE 5785make an error 5786#endif], 5787 [cf_cv_xopen_source=no], 5788 [cf_cv_xopen_source=$cf_XOPEN_SOURCE]) 5789 CPPFLAGS="$cf_save" 5790 ]) 5791]) 5792 5793if test "$cf_cv_xopen_source" != no ; then 5794 CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE) 5795 CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE) 5796 cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source" 5797 CF_ADD_CFLAGS($cf_temp_xopen_source) 5798fi 5799]) 5800dnl --------------------------------------------------------------------------- 5801dnl CF_TYPE_FD_SET version: 6 updated: 2020/03/10 18:53:47 5802dnl -------------- 5803dnl Check for the declaration of fd_set. Some platforms declare it in 5804dnl <sys/types.h>, and some in <sys/select.h>, which requires <sys/types.h>. 5805dnl Finally, if we are using this for an X application, Xpoll.h may include 5806dnl <sys/select.h>, so we don't want to do it twice. 5807AC_DEFUN([CF_TYPE_FD_SET], 5808[ 5809AC_CHECK_HEADERS(X11/Xpoll.h) 5810 5811AC_CACHE_CHECK(for declaration of fd_set,cf_cv_type_fd_set, 5812 [CF_MSG_LOG(sys/types alone) 5813AC_TRY_COMPILE([ 5814#include <sys/types.h>], 5815 [fd_set x; (void)x], 5816 [cf_cv_type_fd_set=sys/types.h], 5817 [CF_MSG_LOG(X11/Xpoll.h) 5818AC_TRY_COMPILE([ 5819#ifdef HAVE_X11_XPOLL_H 5820#include <X11/Xpoll.h> 5821#endif], 5822 [fd_set x; (void)x], 5823 [cf_cv_type_fd_set=X11/Xpoll.h], 5824 [CF_MSG_LOG(sys/select.h) 5825AC_TRY_COMPILE([ 5826#include <sys/types.h> 5827#include <sys/select.h>], 5828 [fd_set x; (void)x], 5829 [cf_cv_type_fd_set=sys/select.h], 5830 [cf_cv_type_fd_set=unknown])])])]) 5831if test $cf_cv_type_fd_set = sys/select.h ; then 5832 AC_DEFINE(USE_SYS_SELECT_H,1,[Define to 1 to include sys/select.h to declare fd_set]) 5833fi 5834]) 5835dnl --------------------------------------------------------------------------- 5836dnl CF_TYPE_OUTCHAR version: 15 updated: 2015/05/15 19:42:24 5837dnl --------------- 5838dnl Check for return and param type of 3rd -- OutChar() -- param of tputs(). 5839dnl 5840dnl For this check, and for CF_CURSES_TERMCAP, the $CHECK_DECL_HDRS variable 5841dnl must point to a header file containing this (or equivalent): 5842dnl 5843dnl #ifdef NEED_CURSES_H 5844dnl # ifdef HAVE_NCURSES_NCURSES_H 5845dnl # include <ncurses/ncurses.h> 5846dnl # else 5847dnl # ifdef HAVE_NCURSES_H 5848dnl # include <ncurses.h> 5849dnl # else 5850dnl # include <curses.h> 5851dnl # endif 5852dnl # endif 5853dnl #endif 5854dnl 5855dnl #ifdef HAVE_NCURSES_TERM_H 5856dnl # include <ncurses/term.h> 5857dnl #else 5858dnl # ifdef HAVE_TERM_H 5859dnl # include <term.h> 5860dnl # endif 5861dnl #endif 5862dnl 5863dnl #if NEED_TERMCAP_H 5864dnl # include <termcap.h> 5865dnl #endif 5866dnl 5867AC_DEFUN([CF_TYPE_OUTCHAR], 5868[ 5869AC_REQUIRE([CF_CURSES_TERMCAP]) 5870 5871AC_CACHE_CHECK(declaration of tputs 3rd param, cf_cv_type_outchar,[ 5872 5873cf_cv_type_outchar="int OutChar(int)" 5874cf_cv_found=no 5875cf_save_CPPFLAGS="$CPPFLAGS" 5876CPPFLAGS="$CPPFLAGS $CHECK_DECL_FLAG" 5877 5878for P in int void; do 5879for Q in int void; do 5880for R in int char; do 5881for S in "" const; do 5882 CF_MSG_LOG(loop variables [P:[$]P, Q:[$]Q, R:[$]R, S:[$]S]) 5883 AC_TRY_COMPILE([$CHECK_DECL_HDRS], 5884 [extern $Q OutChar($R); 5885 extern $P tputs ($S char *string, int nlines, $Q (*_f)($R)); 5886 tputs("", 1, OutChar)], 5887 [cf_cv_type_outchar="$Q OutChar($R)" 5888 cf_cv_found=yes 5889 break]) 5890done 5891 test $cf_cv_found = yes && break 5892done 5893 test $cf_cv_found = yes && break 5894done 5895 test $cf_cv_found = yes && break 5896done 5897]) 5898 5899case $cf_cv_type_outchar in 5900int*) 5901 AC_DEFINE(OUTC_RETURN,1,[Define to 1 if tputs outc function returns a value]) 5902 ;; 5903esac 5904case $cf_cv_type_outchar in 5905*char*) 5906 AC_DEFINE(OUTC_ARGS,char c,[Define to actual type to override tputs outc parameter type]) 5907 ;; 5908esac 5909 5910CPPFLAGS="$cf_save_CPPFLAGS" 5911])dnl 5912dnl --------------------------------------------------------------------------- 5913dnl CF_TYPE_SIGACTION version: 4 updated: 2012/10/06 17:56:13 5914dnl ----------------- 5915dnl 5916AC_DEFUN([CF_TYPE_SIGACTION], 5917[ 5918AC_MSG_CHECKING([for type sigaction_t]) 5919AC_CACHE_VAL(cf_cv_type_sigaction,[ 5920 AC_TRY_COMPILE([ 5921#include <signal.h>], 5922 [sigaction_t x], 5923 [cf_cv_type_sigaction=yes], 5924 [cf_cv_type_sigaction=no])]) 5925AC_MSG_RESULT($cf_cv_type_sigaction) 5926test "$cf_cv_type_sigaction" = yes && AC_DEFINE(HAVE_TYPE_SIGACTION,1,[Define to 1 if we have the sigaction_t type]) 5927])dnl 5928dnl --------------------------------------------------------------------------- 5929dnl CF_UNION_WAIT version: 7 updated: 2020/03/19 20:23:48 5930dnl ------------- 5931dnl Check to see if the BSD-style union wait is declared. Some platforms may 5932dnl use this, though it is deprecated in favor of the 'int' type in Posix. 5933dnl Some vendors provide a bogus implementation that declares union wait, but 5934dnl uses the 'int' type instead; we try to spot these by checking for the 5935dnl associated macros. 5936dnl 5937dnl Ahem. Some implementers cast the status value to an int*, as an attempt to 5938dnl use the macros for either union wait or int. So we do a check compile to 5939dnl see if the macros are defined and apply to an int. 5940dnl 5941dnl Sets: $cf_cv_type_unionwait 5942dnl Defines: HAVE_TYPE_UNIONWAIT 5943AC_DEFUN([CF_UNION_WAIT], 5944[ 5945AC_REQUIRE([CF_WAIT_HEADERS]) 5946AC_MSG_CHECKING([for union wait]) 5947AC_CACHE_VAL(cf_cv_type_unionwait,[ 5948 AC_TRY_LINK($cf_wait_headers, 5949 [int x; 5950 int y = WEXITSTATUS(x); 5951 int z = WTERMSIG(x); 5952 wait(&x); 5953 (void)x; 5954 (void)y; 5955 (void)z; 5956 ], 5957 [cf_cv_type_unionwait=no 5958 echo compiles ok w/o union wait 1>&AC_FD_CC 5959 ],[ 5960 AC_TRY_LINK($cf_wait_headers, 5961 [union wait x; 5962#ifdef WEXITSTATUS 5963 int y = WEXITSTATUS(x); 5964#endif 5965#ifdef WTERMSIG 5966 int z = WTERMSIG(x); 5967#endif 5968 wait(&x); 5969 (void)x; 5970#ifdef WEXITSTATUS 5971 (void)y; 5972#endif 5973#ifdef WTERMSIG 5974 (void)z; 5975#endif 5976 ], 5977 [cf_cv_type_unionwait=yes 5978 echo compiles ok with union wait and possibly macros too 1>&AC_FD_CC 5979 ], 5980 [cf_cv_type_unionwait=no])])]) 5981AC_MSG_RESULT($cf_cv_type_unionwait) 5982test $cf_cv_type_unionwait = yes && AC_DEFINE(HAVE_TYPE_UNIONWAIT,1,[Define to 1 if type unionwait is declared]) 5983])dnl 5984dnl --------------------------------------------------------------------------- 5985dnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59 5986dnl -------- 5987dnl Make an uppercase version of a variable 5988dnl $1=uppercase($2) 5989AC_DEFUN([CF_UPPER], 5990[ 5991$1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` 5992])dnl 5993dnl --------------------------------------------------------------------------- 5994dnl CF_VA_COPY version: 6 updated: 2018/12/04 18:14:25 5995dnl ---------- 5996dnl check for va_copy, part of stdarg.h starting with ISO C 1999. 5997dnl Also, workaround for glibc's __va_copy, by checking for both. 5998dnl Finally, try to accommodate pre-ISO C 1999 headers. 5999AC_DEFUN([CF_VA_COPY],[ 6000AC_CACHE_CHECK(for va_copy, cf_cv_have_va_copy,[ 6001AC_TRY_LINK([ 6002#include <stdarg.h> 6003],[ 6004 static va_list dst; 6005 static va_list src; 6006 va_copy(dst, src)], 6007 cf_cv_have_va_copy=yes, 6008 cf_cv_have_va_copy=no)]) 6009 6010if test "$cf_cv_have_va_copy" = yes; 6011then 6012 AC_DEFINE(HAVE_VA_COPY,1,[Define to 1 if we have va_copy]) 6013else # !cf_cv_have_va_copy 6014 6015AC_CACHE_CHECK(for __va_copy, cf_cv_have___va_copy,[ 6016AC_TRY_LINK([ 6017#include <stdarg.h> 6018],[ 6019 static va_list dst; 6020 static va_list src; 6021 __va_copy(dst, src)], 6022 cf_cv_have___va_copy=yes, 6023 cf_cv_have___va_copy=no)]) 6024 6025if test "$cf_cv_have___va_copy" = yes 6026then 6027 AC_DEFINE(HAVE___VA_COPY,1,[Define to 1 if we have __va_copy]) 6028else # !cf_cv_have___va_copy 6029 6030AC_CACHE_CHECK(for __builtin_va_copy, cf_cv_have___builtin_va_copy,[ 6031AC_TRY_LINK([ 6032#include <stdarg.h> 6033],[ 6034 static va_list dst; 6035 static va_list src; 6036 __builtin_va_copy(dst, src)], 6037 cf_cv_have___builtin_va_copy=yes, 6038 cf_cv_have___builtin_va_copy=no)]) 6039 6040test "$cf_cv_have___builtin_va_copy" = yes && 6041 AC_DEFINE(HAVE___BUILTIN_VA_COPY,1,[Define to 1 if we have __builtin_va_copy]) 6042 6043fi # cf_cv_have___va_copy 6044 6045fi # cf_cv_have_va_copy 6046 6047case "${cf_cv_have_va_copy}${cf_cv_have___va_copy}${cf_cv_have___builtin_va_copy}" in 6048*yes*) 6049 ;; 6050 6051*) 6052 AC_CACHE_CHECK(if we can simply copy va_list, cf_cv_pointer_va_list,[ 6053AC_TRY_LINK([ 6054#include <stdarg.h> 6055],[ 6056 va_list dst; 6057 va_list src; 6058 dst = src], 6059 cf_cv_pointer_va_list=yes, 6060 cf_cv_pointer_va_list=no)]) 6061 6062 if test "$cf_cv_pointer_va_list" = no 6063 then 6064 AC_CACHE_CHECK(if we can copy va_list indirectly, cf_cv_array_va_list,[ 6065AC_TRY_LINK([ 6066#include <stdarg.h> 6067],[ 6068 va_list dst; 6069 va_list src; 6070 *dst = *src], 6071 cf_cv_array_va_list=yes, 6072 cf_cv_array_va_list=no)]) 6073 test "$cf_cv_array_va_list" = yes && AC_DEFINE(ARRAY_VA_LIST,1,[Define to 1 if we can copy va_list indirectly]) 6074 fi 6075 ;; 6076esac 6077]) 6078dnl --------------------------------------------------------------------------- 6079dnl CF_VERBOSE version: 3 updated: 2007/07/29 09:55:12 6080dnl ---------- 6081dnl Use AC_VERBOSE w/o the warnings 6082AC_DEFUN([CF_VERBOSE], 6083[test -n "$verbose" && echo " $1" 1>&AC_FD_MSG 6084CF_MSG_LOG([$1]) 6085])dnl 6086dnl --------------------------------------------------------------------------- 6087dnl CF_WAIT_HEADERS version: 2 updated: 1997/10/21 19:45:33 6088dnl --------------- 6089dnl Build up an expression $cf_wait_headers with the header files needed to 6090dnl compile against the prototypes for 'wait()', 'waitpid()', etc. Assume it's 6091dnl Posix, which uses <sys/types.h> and <sys/wait.h>, but allow SVr4 variation 6092dnl with <wait.h>. 6093AC_DEFUN([CF_WAIT_HEADERS], 6094[ 6095AC_HAVE_HEADERS(sys/wait.h) 6096cf_wait_headers="#include <sys/types.h> 6097" 6098if test $ac_cv_header_sys_wait_h = yes; then 6099cf_wait_headers="$cf_wait_headers 6100#include <sys/wait.h> 6101" 6102else 6103AC_HAVE_HEADERS(wait.h) 6104AC_HAVE_HEADERS(waitstatus.h) 6105if test $ac_cv_header_wait_h = yes; then 6106cf_wait_headers="$cf_wait_headers 6107#include <wait.h> 6108" 6109fi 6110if test $ac_cv_header_waitstatus_h = yes; then 6111cf_wait_headers="$cf_wait_headers 6112#include <waitstatus.h> 6113" 6114fi 6115fi 6116])dnl 6117dnl --------------------------------------------------------------------------- 6118dnl CF_WITH_CURSES_DIR version: 3 updated: 2010/11/20 17:02:38 6119dnl ------------------ 6120dnl Wrapper for AC_ARG_WITH to specify directory under which to look for curses 6121dnl libraries. 6122AC_DEFUN([CF_WITH_CURSES_DIR],[ 6123 6124AC_MSG_CHECKING(for specific curses-directory) 6125AC_ARG_WITH(curses-dir, 6126 [ --with-curses-dir=DIR directory in which (n)curses is installed], 6127 [cf_cv_curses_dir=$withval], 6128 [cf_cv_curses_dir=no]) 6129AC_MSG_RESULT($cf_cv_curses_dir) 6130 6131if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" ) 6132then 6133 CF_PATH_SYNTAX(withval) 6134 if test -d "$cf_cv_curses_dir" 6135 then 6136 CF_ADD_INCDIR($cf_cv_curses_dir/include) 6137 CF_ADD_LIBDIR($cf_cv_curses_dir/lib) 6138 fi 6139fi 6140])dnl 6141dnl --------------------------------------------------------------------------- 6142dnl CF_WITH_DBMALLOC version: 7 updated: 2010/06/21 17:26:47 6143dnl ---------------- 6144dnl Configure-option for dbmalloc. The optional parameter is used to override 6145dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests. 6146AC_DEFUN([CF_WITH_DBMALLOC],[ 6147CF_NO_LEAKS_OPTION(dbmalloc, 6148 [ --with-dbmalloc test: use Conor Cahill's dbmalloc library], 6149 [USE_DBMALLOC]) 6150 6151if test "$with_dbmalloc" = yes ; then 6152 AC_CHECK_HEADER(dbmalloc.h, 6153 [AC_CHECK_LIB(dbmalloc,[debug_malloc]ifelse([$1],,[],[,$1]))]) 6154fi 6155])dnl 6156dnl --------------------------------------------------------------------------- 6157dnl CF_WITH_DFTENV version: 6 updated: 2019/12/31 20:39:42 6158dnl -------------- 6159dnl Wrapper for AC_ARG_WITH to inherit/override an environment variable's 6160dnl "#define" in the compile. 6161dnl $1 = option name 6162dnl $2 = help-message 6163dnl $3 = name of variable to inherit/override 6164dnl $4 = default value of variable, if any 6165AC_DEFUN([CF_WITH_DFTENV], 6166[AC_ARG_WITH($1,[$2 ](default: ifelse($4,,empty,$4)),, 6167ifelse($4,,[withval="${$3}"],[withval="${$3-$4}"])) 6168case "$withval" in #(vi 6169yes|no) 6170 AC_MSG_ERROR(expected a value for --with-$1) 6171 ;; 6172esac 6173$3="$withval" 6174AC_DEFINE_UNQUOTED($3,"[$]$3",[Define $2])dnl 6175])dnl 6176dnl --------------------------------------------------------------------------- 6177dnl CF_WITH_DMALLOC version: 7 updated: 2010/06/21 17:26:47 6178dnl --------------- 6179dnl Configure-option for dmalloc. The optional parameter is used to override 6180dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests. 6181AC_DEFUN([CF_WITH_DMALLOC],[ 6182CF_NO_LEAKS_OPTION(dmalloc, 6183 [ --with-dmalloc test: use Gray Watson's dmalloc library], 6184 [USE_DMALLOC]) 6185 6186if test "$with_dmalloc" = yes ; then 6187 AC_CHECK_HEADER(dmalloc.h, 6188 [AC_CHECK_LIB(dmalloc,[dmalloc_debug]ifelse([$1],,[],[,$1]))]) 6189fi 6190])dnl 6191dnl --------------------------------------------------------------------------- 6192dnl CF_WITH_PATH version: 11 updated: 2012/09/29 15:04:19 6193dnl ------------ 6194dnl Wrapper for AC_ARG_WITH to ensure that user supplies a pathname, not just 6195dnl defaulting to yes/no. 6196dnl 6197dnl $1 = option name 6198dnl $2 = help-text 6199dnl $3 = environment variable to set 6200dnl $4 = default value, shown in the help-message, must be a constant 6201dnl $5 = default value, if it's an expression & cannot be in the help-message 6202dnl 6203AC_DEFUN([CF_WITH_PATH], 6204[AC_ARG_WITH($1,[$2 ](default: ifelse([$4],,empty,[$4])),, 6205ifelse([$4],,[withval="${$3}"],[withval="${$3:-ifelse([$5],,[$4],[$5])}"]))dnl 6206if ifelse([$5],,true,[test -n "$5"]) ; then 6207CF_PATH_SYNTAX(withval) 6208fi 6209eval $3="$withval" 6210AC_SUBST($3)dnl 6211])dnl 6212dnl --------------------------------------------------------------------------- 6213dnl CF_WITH_PROGRAM version: 7 updated: 2019/12/31 20:39:42 6214dnl --------------- 6215dnl Wrapper for AC_PATH_PROG, with command-line option. 6216dnl Params: 6217dnl $1 = program name 6218dnl $2 = help-string (I'd use format, but someone's disable it in autoconf) 6219dnl $3 = caller-supplied default if no --with option is given. If this is 6220dnl blank, the macro uses AC_PATH_PROG. 6221AC_DEFUN([CF_WITH_PROGRAM], 6222[dnl 6223define([cf_path_name], PATH_[]translit($1, [a-z], [A-Z]))dnl 6224define([cf_have_name], HAVE_[]translit($1, [a-z], [A-Z]))dnl 6225AC_ARG_WITH($1,[$2],ifelse($3,, 6226[case "$withval" in #(vi 6227 yes[)] 6228 AC_MSG_ERROR(expected a value for --with-$1) 6229 ;; #(vi 6230 no[)] 6231 ;; #(vi 6232 *[)] 6233 # user supplied option-value for "--with-$1=path" 6234 AC_MSG_CHECKING(for $1) 6235 ac_cv_path_]cf_path_name[="$withval" 6236 AC_DEFINE_UNQUOTED(cf_path_name,"$withval",[Define this to the pathname for $1])dnl 6237 AC_DEFINE(cf_have_name,1,[Define this to 1 if the $1 program exists])dnl 6238 AC_MSG_RESULT($withval) 6239 ;; 6240 esac],[$3]),[ 6241 # user did not specify "--with-$1"; do automatic check 6242 AC_PATH_PROG(cf_path_name,$1) 6243 if test -n "$cf_path_name"; then 6244 AC_DEFINE_UNQUOTED(cf_path_name,"$cf_path_name")dnl 6245 AC_DEFINE(cf_have_name)dnl 6246 fi 6247])dnl 6248undefine([cf_path_name])undefine([cf_have_name])])dnl 6249dnl --------------------------------------------------------------------------- 6250dnl CF_WITH_VALUE version: 4 updated: 2019/12/31 20:39:42 6251dnl ------------- 6252dnl Wrapper for AC_ARG_WITH to ensure that if the user supplies a value, it is 6253dnl not simply defaulting to yes/no. Empty strings are ok if the macro is 6254dnl invoked without a default value 6255dnl $1 = option name 6256dnl $2 = help-message 6257dnl $3 = variable to inherit/override 6258dnl $4 = default value, if any. 6259AC_DEFUN([CF_WITH_VALUE], 6260[CF_ARG_WITH($1,[$2],[$3],[$4]) 6261 AC_DEFINE_UNQUOTED($3,"$withval",[Define a value for $1])dnl 6262])dnl 6263dnl --------------------------------------------------------------------------- 6264dnl CF_XOPEN_CURSES version: 15 updated: 2020/03/19 20:23:48 6265dnl --------------- 6266dnl Test if we should define X/Open source for curses, needed on Digital Unix 6267dnl 4.x, to see the extended functions, but breaks on IRIX 6.x. 6268dnl 6269dnl The getbegyx() check is needed for HPUX, which omits legacy macros such 6270dnl as getbegy(). The latter is better design, but the former is standard. 6271AC_DEFUN([CF_XOPEN_CURSES], 6272[ 6273AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl 6274AC_CACHE_CHECK(definition to turn on extended curses functions,cf_cv_need_xopen_extension,[ 6275cf_cv_need_xopen_extension=unknown 6276AC_TRY_LINK([ 6277#include <stdlib.h> 6278#include <${cf_cv_ncurses_header:-curses.h}>],[ 6279#if defined(NCURSES_VERSION_PATCH) 6280#if (NCURSES_VERSION_PATCH < 20100501) && (NCURSES_VERSION_PATCH >= 20100403) 6281 make an error 6282#endif 6283#endif 6284#ifdef NCURSES_VERSION 6285 cchar_t check; 6286 int check2 = curs_set((int)sizeof(check)); 6287#endif 6288 long x = winnstr(stdscr, "", 0); 6289 int x1, y1; 6290#ifdef NCURSES_VERSION 6291 (void)check2; 6292#endif 6293 getbegyx(stdscr, y1, x1); 6294 (void)x; 6295 (void)y1; 6296 (void)x1; 6297 ], 6298 [cf_cv_need_xopen_extension=none], 6299 [ 6300 for cf_try_xopen_extension in _XOPEN_SOURCE_EXTENDED NCURSES_WIDECHAR 6301 do 6302 AC_TRY_LINK([ 6303#define $cf_try_xopen_extension 1 6304#include <stdlib.h> 6305#include <${cf_cv_ncurses_header:-curses.h}>],[ 6306#ifdef NCURSES_VERSION 6307 cchar_t check; 6308 int check2 = curs_set((int)sizeof(check)); 6309#endif 6310 long x = winnstr(stdscr, "", 0); 6311 int x1, y1; 6312 getbegyx(stdscr, y1, x1); 6313#ifdef NCURSES_VERSION 6314 (void)check2; 6315#endif 6316 (void)x; 6317 (void)y1; 6318 (void)x1; 6319 ], 6320 [cf_cv_need_xopen_extension=$cf_try_xopen_extension; break]) 6321 done 6322 ]) 6323]) 6324 6325case $cf_cv_need_xopen_extension in 6326*_*) 6327 CF_APPEND_TEXT(CPPFLAGS,-D$cf_cv_need_xopen_extension) 6328 ;; 6329esac 6330 6331])dnl 6332dnl --------------------------------------------------------------------------- 6333dnl CF_XOPEN_SOURCE version: 55 updated: 2018/12/31 20:46:17 6334dnl --------------- 6335dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions, 6336dnl or adapt to the vendor's definitions to get equivalent functionality, 6337dnl without losing the common non-POSIX features. 6338dnl 6339dnl Parameters: 6340dnl $1 is the nominal value for _XOPEN_SOURCE 6341dnl $2 is the nominal value for _POSIX_C_SOURCE 6342AC_DEFUN([CF_XOPEN_SOURCE],[ 6343AC_REQUIRE([AC_CANONICAL_HOST]) 6344AC_REQUIRE([CF_POSIX_VISIBLE]) 6345 6346if test "$cf_cv_posix_visible" = no; then 6347 6348cf_XOPEN_SOURCE=ifelse([$1],,500,[$1]) 6349cf_POSIX_C_SOURCE=ifelse([$2],,199506L,[$2]) 6350cf_xopen_source= 6351 6352case $host_os in 6353aix[[4-7]]*) 6354 cf_xopen_source="-D_ALL_SOURCE" 6355 ;; 6356msys) 6357 cf_XOPEN_SOURCE=600 6358 ;; 6359darwin[[0-8]].*) 6360 cf_xopen_source="-D_APPLE_C_SOURCE" 6361 ;; 6362darwin*) 6363 cf_xopen_source="-D_DARWIN_C_SOURCE" 6364 cf_XOPEN_SOURCE= 6365 ;; 6366freebsd*|dragonfly*|midnightbsd*) 6367 # 5.x headers associate 6368 # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L 6369 # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L 6370 cf_POSIX_C_SOURCE=200112L 6371 cf_XOPEN_SOURCE=600 6372 cf_xopen_source="-D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" 6373 ;; 6374hpux11*) 6375 cf_xopen_source="-D_HPUX_SOURCE -D_XOPEN_SOURCE=500" 6376 ;; 6377hpux*) 6378 cf_xopen_source="-D_HPUX_SOURCE" 6379 ;; 6380irix[[56]].*) 6381 cf_xopen_source="-D_SGI_SOURCE" 6382 cf_XOPEN_SOURCE= 6383 ;; 6384linux*|uclinux*|gnu*|mint*|k*bsd*-gnu|cygwin) 6385 CF_GNU_SOURCE($cf_XOPEN_SOURCE) 6386 ;; 6387minix*) 6388 cf_xopen_source="-D_NETBSD_SOURCE" # POSIX.1-2001 features are ifdef'd with this... 6389 ;; 6390mirbsd*) 6391 # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <sys/select.h> and other headers which use u_int / u_short types 6392 cf_XOPEN_SOURCE= 6393 CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE) 6394 ;; 6395netbsd*) 6396 cf_xopen_source="-D_NETBSD_SOURCE" # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw 6397 ;; 6398openbsd[[4-9]]*) 6399 # setting _XOPEN_SOURCE lower than 500 breaks g++ compile with wchar.h, needed for ncursesw 6400 cf_xopen_source="-D_BSD_SOURCE" 6401 cf_XOPEN_SOURCE=600 6402 ;; 6403openbsd*) 6404 # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw 6405 ;; 6406osf[[45]]*) 6407 cf_xopen_source="-D_OSF_SOURCE" 6408 ;; 6409nto-qnx*) 6410 cf_xopen_source="-D_QNX_SOURCE" 6411 ;; 6412sco*) 6413 # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer 6414 ;; 6415solaris2.*) 6416 cf_xopen_source="-D__EXTENSIONS__" 6417 cf_cv_xopen_source=broken 6418 ;; 6419sysv4.2uw2.*) # Novell/SCO UnixWare 2.x (tested on 2.1.2) 6420 cf_XOPEN_SOURCE= 6421 cf_POSIX_C_SOURCE= 6422 ;; 6423*) 6424 CF_TRY_XOPEN_SOURCE 6425 CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE) 6426 ;; 6427esac 6428 6429if test -n "$cf_xopen_source" ; then 6430 CF_ADD_CFLAGS($cf_xopen_source,true) 6431fi 6432 6433dnl In anything but the default case, we may have system-specific setting 6434dnl which is still not guaranteed to provide all of the entrypoints that 6435dnl _XOPEN_SOURCE would yield. 6436if test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then 6437 AC_MSG_CHECKING(if _XOPEN_SOURCE really is set) 6438 AC_TRY_COMPILE([#include <stdlib.h>],[ 6439#ifndef _XOPEN_SOURCE 6440make an error 6441#endif], 6442 [cf_XOPEN_SOURCE_set=yes], 6443 [cf_XOPEN_SOURCE_set=no]) 6444 AC_MSG_RESULT($cf_XOPEN_SOURCE_set) 6445 if test $cf_XOPEN_SOURCE_set = yes 6446 then 6447 AC_TRY_COMPILE([#include <stdlib.h>],[ 6448#if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE 6449make an error 6450#endif], 6451 [cf_XOPEN_SOURCE_set_ok=yes], 6452 [cf_XOPEN_SOURCE_set_ok=no]) 6453 if test $cf_XOPEN_SOURCE_set_ok = no 6454 then 6455 AC_MSG_WARN(_XOPEN_SOURCE is lower than requested) 6456 fi 6457 else 6458 CF_TRY_XOPEN_SOURCE 6459 fi 6460fi 6461fi # cf_cv_posix_visible 6462]) 6463dnl --------------------------------------------------------------------------- 6464dnl CF_X_ATHENA version: 24 updated: 2020/03/10 18:53:47 6465dnl ----------- 6466dnl Check for Xaw (Athena) libraries 6467dnl 6468dnl Sets $cf_x_athena according to the flavor of Xaw which is used. 6469AC_DEFUN([CF_X_ATHENA], 6470[ 6471cf_x_athena=${cf_x_athena:-Xaw} 6472 6473AC_MSG_CHECKING(if you want to link with Xaw 3d library) 6474withval= 6475AC_ARG_WITH(Xaw3d, 6476 [ --with-Xaw3d link with Xaw 3d library]) 6477if test "$withval" = yes ; then 6478 cf_x_athena=Xaw3d 6479 AC_MSG_RESULT(yes) 6480else 6481 AC_MSG_RESULT(no) 6482fi 6483 6484AC_MSG_CHECKING(if you want to link with Xaw 3d xft library) 6485withval= 6486AC_ARG_WITH(Xaw3dxft, 6487 [ --with-Xaw3dxft link with Xaw 3d xft library]) 6488if test "$withval" = yes ; then 6489 cf_x_athena=Xaw3dxft 6490 AC_MSG_RESULT(yes) 6491else 6492 AC_MSG_RESULT(no) 6493fi 6494 6495AC_MSG_CHECKING(if you want to link with neXT Athena library) 6496withval= 6497AC_ARG_WITH(neXtaw, 6498 [ --with-neXtaw link with neXT Athena library]) 6499if test "$withval" = yes ; then 6500 cf_x_athena=neXtaw 6501 AC_MSG_RESULT(yes) 6502else 6503 AC_MSG_RESULT(no) 6504fi 6505 6506AC_MSG_CHECKING(if you want to link with Athena-Plus library) 6507withval= 6508AC_ARG_WITH(XawPlus, 6509 [ --with-XawPlus link with Athena-Plus library]) 6510if test "$withval" = yes ; then 6511 cf_x_athena=XawPlus 6512 AC_MSG_RESULT(yes) 6513else 6514 AC_MSG_RESULT(no) 6515fi 6516 6517cf_x_athena_lib="" 6518 6519if test "$PKG_CONFIG" != none ; then 6520 cf_athena_list= 6521 test "$cf_x_athena" = Xaw && cf_athena_list="xaw8 xaw7 xaw6" 6522 for cf_athena_pkg in \ 6523 $cf_athena_list \ 6524 ${cf_x_athena} \ 6525 ${cf_x_athena}-devel \ 6526 lib${cf_x_athena} \ 6527 lib${cf_x_athena}-devel 6528 do 6529 CF_TRY_PKG_CONFIG($cf_athena_pkg,[ 6530 cf_x_athena_lib="$cf_pkgconfig_libs" 6531 CF_UPPER(cf_x_athena_LIBS,HAVE_LIB_$cf_x_athena) 6532 AC_DEFINE_UNQUOTED($cf_x_athena_LIBS) 6533 6534 CF_TRIM_X_LIBS 6535 6536AC_CACHE_CHECK(for usable $cf_x_athena/Xmu package,cf_cv_xaw_compat,[ 6537AC_TRY_LINK([ 6538#include <X11/Xmu/CharSet.h> 6539],[ 6540int check = XmuCompareISOLatin1("big", "small"); 6541(void)check; 6542],[cf_cv_xaw_compat=yes],[cf_cv_xaw_compat=no])]) 6543 6544 if test "$cf_cv_xaw_compat" = no 6545 then 6546 # workaround for broken ".pc" files... 6547 case "$cf_x_athena_lib" in 6548 *-lXmu*) 6549 ;; 6550 *) 6551 CF_VERBOSE(work around broken package) 6552 cf_save_xmu="$LIBS" 6553 cf_first_lib=`echo "$cf_save_xmu" | sed -e 's/^[ ][ ]*//' -e 's/ .*//'` 6554 CF_TRY_PKG_CONFIG(xmu,[ 6555 LIBS="$cf_save_xmu" 6556 CF_ADD_LIB_AFTER($cf_first_lib,$cf_pkgconfig_libs) 6557 ],[ 6558 CF_ADD_LIB_AFTER($cf_first_lib,-lXmu) 6559 ]) 6560 CF_TRIM_X_LIBS 6561 ;; 6562 esac 6563 fi 6564 6565 break]) 6566 done 6567fi 6568 6569if test -z "$cf_x_athena_lib" ; then 6570 CF_X_EXT 6571 CF_X_TOOLKIT 6572 CF_X_ATHENA_CPPFLAGS($cf_x_athena) 6573 CF_X_ATHENA_LIBS($cf_x_athena) 6574fi 6575])dnl 6576dnl --------------------------------------------------------------------------- 6577dnl CF_X_ATHENA_CPPFLAGS version: 8 updated: 2020/01/16 05:21:56 6578dnl -------------------- 6579dnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of 6580dnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw. 6581AC_DEFUN([CF_X_ATHENA_CPPFLAGS], 6582[ 6583AC_REQUIRE([AC_PATH_XTRA]) 6584cf_x_athena_root=ifelse([$1],,Xaw,[$1]) 6585cf_x_athena_inc="" 6586 6587for cf_path in default \ 6588 /usr/contrib/X11R6 \ 6589 /usr/contrib/X11R5 \ 6590 /usr/lib/X11R5 \ 6591 /usr/local 6592do 6593 if test -z "$cf_x_athena_inc" ; then 6594 CF_SAVE_XTRA_FLAGS([CF_X_ATHENA_CPPFLAGS]) 6595 cf_test=X11/$cf_x_athena_root/SimpleMenu.h 6596 if test $cf_path != default ; then 6597 CF_APPEND_TEXT(CPPFLAGS,-I$cf_path/include) 6598 AC_MSG_CHECKING(for $cf_test in $cf_path) 6599 else 6600 AC_MSG_CHECKING(for $cf_test) 6601 fi 6602 AC_TRY_COMPILE([ 6603#include <X11/Intrinsic.h> 6604#include <$cf_test>],[], 6605 [cf_result=yes], 6606 [cf_result=no]) 6607 AC_MSG_RESULT($cf_result) 6608 CF_RESTORE_XTRA_FLAGS([CF_X_ATHENA_CPPFLAGS]) 6609 if test "$cf_result" = yes ; then 6610 test "$cf_path" = default && cf_x_athena_inc=default 6611 test "$cf_path" != default && cf_x_athena_inc=$cf_path/include 6612 break 6613 fi 6614 fi 6615done 6616 6617if test -z "$cf_x_athena_inc" ; then 6618 AC_MSG_WARN([Unable to find Athena header files]) 6619elif test "$cf_x_athena_inc" != default ; then 6620 CF_APPEND_TEXT(CPPFLAGS,-I$cf_x_athena_inc) 6621fi 6622]) 6623dnl --------------------------------------------------------------------------- 6624dnl CF_X_ATHENA_LIBS version: 13 updated: 2020/01/11 18:16:10 6625dnl ---------------- 6626dnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of 6627dnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw. 6628AC_DEFUN([CF_X_ATHENA_LIBS], 6629[AC_REQUIRE([CF_X_TOOLKIT]) 6630cf_x_athena_root=ifelse([$1],,Xaw,[$1]) 6631cf_x_athena_lib="" 6632 6633for cf_path in default \ 6634 /usr/contrib/X11R6 \ 6635 /usr/contrib/X11R5 \ 6636 /usr/lib/X11R5 \ 6637 /usr/local 6638do 6639 for cf_lib in \ 6640 ${cf_x_athena_root} \ 6641 ${cf_x_athena_root}7 \ 6642 ${cf_x_athena_root}6 6643 do 6644 for cf_libs in \ 6645 "-l$cf_lib -lXmu" \ 6646 "-l$cf_lib -lXpm -lXmu" \ 6647 "-l${cf_lib}_s -lXmu_s" 6648 do 6649 test -n "$cf_x_athena_lib" && break 6650 6651 CF_SAVE_XTRA_FLAGS([CF_X_ATHENA_LIBS]) 6652 cf_test=XawSimpleMenuAddGlobalActions 6653 test "$cf_path" != default && cf_libs="-L$cf_path/lib $cf_libs" 6654 CF_ADD_LIBS($cf_libs) 6655 AC_MSG_CHECKING(for $cf_test in $cf_libs) 6656 AC_TRY_LINK([ 6657#include <X11/Intrinsic.h> 6658#include <X11/$cf_x_athena_root/SimpleMenu.h> 6659],[ 6660$cf_test((XtAppContext) 0)], 6661 [cf_result=yes], 6662 [cf_result=no]) 6663 AC_MSG_RESULT($cf_result) 6664 CF_RESTORE_XTRA_FLAGS([CF_X_ATHENA_LIBS]) 6665 6666 if test "$cf_result" = yes ; then 6667 cf_x_athena_lib="$cf_libs" 6668 break 6669 fi 6670 done # cf_libs 6671 test -n "$cf_x_athena_lib" && break 6672 done # cf_lib 6673done 6674 6675if test -z "$cf_x_athena_lib" ; then 6676 AC_MSG_ERROR( 6677[Unable to successfully link Athena library (-l$cf_x_athena_root) with test program]) 6678fi 6679 6680CF_ADD_LIBS($cf_x_athena_lib) 6681CF_UPPER(cf_x_athena_LIBS,HAVE_LIB_$cf_x_athena) 6682AC_DEFINE_UNQUOTED($cf_x_athena_LIBS) 6683]) 6684dnl --------------------------------------------------------------------------- 6685dnl CF_X_EXT version: 3 updated: 2010/06/02 05:03:05 6686dnl -------- 6687AC_DEFUN([CF_X_EXT],[ 6688CF_TRY_PKG_CONFIG(Xext,,[ 6689 AC_CHECK_LIB(Xext,XextCreateExtension, 6690 [CF_ADD_LIB(Xext)])]) 6691])dnl 6692dnl --------------------------------------------------------------------------- 6693dnl CF_X_TOOLKIT version: 25 updated: 2020/03/10 17:26:15 6694dnl ------------ 6695dnl Check for X Toolkit libraries 6696AC_DEFUN([CF_X_TOOLKIT], 6697[ 6698AC_REQUIRE([AC_PATH_XTRA]) 6699AC_REQUIRE([CF_CHECK_CACHE]) 6700 6701# OSX is schizoid about who owns /usr/X11 (old) versus /opt/X11 (new) (and 6702# in some cases has installed dummy files in the former, other cases replaced 6703# it with a link to the new location). This complicates the configure script. 6704# Check for that pitfall, and recover using pkg-config 6705# 6706# If none of these are set, the configuration is almost certainly broken. 6707if test -z "${X_CFLAGS}${X_PRE_LIBS}${X_LIBS}${X_EXTRA_LIBS}" 6708then 6709 CF_TRY_PKG_CONFIG(x11,,[AC_MSG_WARN(unable to find X11 library)]) 6710 CF_TRY_PKG_CONFIG(ice,,[AC_MSG_WARN(unable to find ICE library)]) 6711 CF_TRY_PKG_CONFIG(sm,,[AC_MSG_WARN(unable to find SM library)]) 6712 CF_TRY_PKG_CONFIG(xt,,[AC_MSG_WARN(unable to find Xt library)]) 6713else 6714 LIBS="$X_PRE_LIBS $LIBS $X_EXTRA_LIBS" 6715fi 6716 6717cf_have_X_LIBS=no 6718 6719CF_TRY_PKG_CONFIG(xt,[ 6720 6721 case "x$LIBS" in 6722 *-lX11*) 6723 ;; 6724 *) 6725# we have an "xt" package, but it may omit Xt's dependency on X11 6726AC_CACHE_CHECK(for usable X dependency,cf_cv_xt_x11_compat,[ 6727AC_TRY_LINK([ 6728#include <X11/Xlib.h> 6729],[ 6730 int rc1 = XDrawLine((Display*) 0, (Drawable) 0, (GC) 0, 0, 0, 0, 0); 6731 int rc2 = XClearWindow((Display*) 0, (Window) 0); 6732 int rc3 = XMoveWindow((Display*) 0, (Window) 0, 0, 0); 6733 int rc4 = XMoveResizeWindow((Display*)0, (Window)0, 0, 0, 0, 0); 6734],[cf_cv_xt_x11_compat=yes],[cf_cv_xt_x11_compat=no])]) 6735 if test "$cf_cv_xt_x11_compat" = no 6736 then 6737 CF_VERBOSE(work around broken X11 dependency) 6738 # 2010/11/19 - good enough until a working Xt on Xcb is delivered. 6739 CF_TRY_PKG_CONFIG(x11,,[CF_ADD_LIB_AFTER(-lXt,-lX11)]) 6740 fi 6741 ;; 6742 esac 6743 6744AC_CACHE_CHECK(for usable X Toolkit package,cf_cv_xt_ice_compat,[ 6745AC_TRY_LINK([ 6746#include <X11/Shell.h> 6747],[int num = IceConnectionNumber(0); (void) num 6748],[cf_cv_xt_ice_compat=yes],[cf_cv_xt_ice_compat=no])]) 6749 6750 if test "$cf_cv_xt_ice_compat" = no 6751 then 6752 # workaround for broken ".pc" files used for X Toolkit. 6753 case "x$X_PRE_LIBS" in 6754 *-lICE*) 6755 case "x$LIBS" in 6756 *-lICE*) 6757 ;; 6758 *) 6759 CF_VERBOSE(work around broken ICE dependency) 6760 CF_TRY_PKG_CONFIG(ice, 6761 [CF_TRY_PKG_CONFIG(sm)], 6762 [CF_ADD_LIB_AFTER(-lXt,$X_PRE_LIBS)]) 6763 ;; 6764 esac 6765 ;; 6766 esac 6767 fi 6768 6769 cf_have_X_LIBS=yes 6770],[ 6771 6772 LDFLAGS="$X_LIBS $LDFLAGS" 6773 CF_CHECK_CFLAGS($X_CFLAGS) 6774 6775 AC_CHECK_FUNC(XOpenDisplay,,[ 6776 AC_CHECK_LIB(X11,XOpenDisplay, 6777 [CF_ADD_LIB(X11)])]) 6778 6779 AC_CHECK_FUNC(XtAppInitialize,,[ 6780 AC_CHECK_LIB(Xt, XtAppInitialize, 6781 [AC_DEFINE(HAVE_LIBXT,1,[Define to 1 if we can compile with the Xt library]) 6782 cf_have_X_LIBS=Xt 6783 LIBS="-lXt $LIBS"])]) 6784]) 6785 6786if test $cf_have_X_LIBS = no ; then 6787 AC_MSG_WARN( 6788[Unable to successfully link X Toolkit library (-lXt) with 6789test program. You will have to check and add the proper libraries by hand 6790to makefile.]) 6791fi 6792])dnl 6793dnl --------------------------------------------------------------------------- 6794dnl CF__ICONV_BODY version: 2 updated: 2007/07/26 17:35:47 6795dnl -------------- 6796dnl Test-code needed for iconv compile-checks 6797define([CF__ICONV_BODY],[ 6798 iconv_t cd = iconv_open("",""); 6799 iconv(cd,NULL,NULL,NULL,NULL); 6800 iconv_close(cd);] 6801)dnl 6802dnl --------------------------------------------------------------------------- 6803dnl CF__ICONV_HEAD version: 1 updated: 2007/07/26 15:57:03 6804dnl -------------- 6805dnl Header-files needed for iconv compile-checks 6806define([CF__ICONV_HEAD],[ 6807#include <stdlib.h> 6808#include <iconv.h>] 6809)dnl 6810dnl --------------------------------------------------------------------------- 6811dnl CF__INTL_BODY version: 3 updated: 2017/07/10 20:13:33 6812dnl ------------- 6813dnl Test-code needed for libintl compile-checks 6814dnl $1 = parameter 2 from AM_WITH_NLS 6815define([CF__INTL_BODY],[ 6816 bindtextdomain ("", ""); 6817 return (int) gettext ("") 6818 ifelse([$1], need-ngettext, [ + (int) ngettext ("", "", 0)], []) 6819#ifndef IGNORE_MSGFMT_HACK 6820 [ + _nl_msg_cat_cntr] 6821#endif 6822]) 6823dnl --------------------------------------------------------------------------- 6824dnl CF__INTL_HEAD version: 1 updated: 2007/07/26 17:35:47 6825dnl ------------- 6826dnl Header-files needed for libintl compile-checks 6827define([CF__INTL_HEAD],[ 6828#include <libintl.h> 6829extern int _nl_msg_cat_cntr; 6830])dnl 6831dnl --------------------------------------------------------------------------- 6832dnl jm_GLIBC21 version: 4 updated: 2015/05/10 19:52:14 6833dnl ---------- 6834dnl Inserted as requested by gettext 0.10.40 6835dnl File from /usr/share/aclocal 6836dnl glibc21.m4 6837dnl ==================== 6838dnl serial 2 6839dnl 6840dnl Test for the GNU C Library, version 2.1 or newer. 6841dnl From Bruno Haible. 6842AC_DEFUN([jm_GLIBC21], 6843[ 6844AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer, 6845 ac_cv_gnu_library_2_1, 6846 [AC_EGREP_CPP([Lucky GNU user], 6847 [ 6848#include <features.h> 6849#ifdef __GNU_LIBRARY__ 6850 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2) 6851 Lucky GNU user 6852 #endif 6853#endif 6854 ], 6855 ac_cv_gnu_library_2_1=yes, 6856 ac_cv_gnu_library_2_1=no)]) 6857 AC_SUBST(GLIBC21) 6858 GLIBC21="$ac_cv_gnu_library_2_1" 6859]) 6860