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