"Fossies" - the Fresh Open Source Software Archive 
Member "c_count-7.20/aclocal.m4" (8 Jan 2021, 46405 Bytes) of package /linux/privat/c_count-7.20.tgz:
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":
7.19_vs_7.20.
1 dnl $Id: aclocal.m4,v 7.20 2021/01/08 21:08:21 tom Exp $
2 dnl ---------------------------------------------------------------------------
3 dnl Copyright 1999-2020,2021 -- Thomas E. Dickey
4 dnl
5 dnl Permission is hereby granted, free of charge, to any person obtaining a
6 dnl copy of this software and associated documentation files (the
7 dnl "Software"), to deal in the Software without restriction, including
8 dnl without limitation the rights to use, copy, modify, merge, publish,
9 dnl distribute, distribute with modifications, sublicense, and/or sell
10 dnl copies of the Software, and to permit persons to whom the Software is
11 dnl furnished to do so, subject to the following conditions:
12 dnl
13 dnl The above copyright notice and this permission notice shall be included
14 dnl in all copies or portions of the Software.
15 dnl
16 dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19 dnl IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
20 dnl DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
21 dnl OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
22 dnl THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 dnl
24 dnl Except as contained in this notice, the name(s) of the above copyright
25 dnl holders shall not be used in advertising or otherwise to promote the
26 dnl sale, use or other dealings in this Software without prior written
27 dnl authorization.
28 dnl
29 dnl see
30 dnl https://invisible-island.net/autoconf/
31 dnl ---------------------------------------------------------------------------
32 dnl ---------------------------------------------------------------------------
33 dnl CF_ADD_CFLAGS version: 15 updated: 2020/12/31 10:54:15
34 dnl -------------
35 dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS
36 dnl $1 = flags to add
37 dnl $2 = if given makes this macro verbose.
38 dnl
39 dnl Put any preprocessor definitions that use quoted strings in $EXTRA_CPPFLAGS,
40 dnl to simplify use of $CPPFLAGS in compiler checks, etc., that are easily
41 dnl confused by the quotes (which require backslashes to keep them usable).
42 AC_DEFUN([CF_ADD_CFLAGS],
43 [
44 cf_fix_cppflags=no
45 cf_new_cflags=
46 cf_new_cppflags=
47 cf_new_extra_cppflags=
48
49 for cf_add_cflags in $1
50 do
51 case "$cf_fix_cppflags" in
52 (no)
53 case "$cf_add_cflags" in
54 (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C)
55 case "$cf_add_cflags" in
56 (-D*)
57 cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^-D[[^=]]*='\''\"[[^"]]*//'`
58
59 test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \
60 && test -z "${cf_tst_cflags}" \
61 && cf_fix_cppflags=yes
62
63 if test "$cf_fix_cppflags" = yes ; then
64 CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags)
65 continue
66 elif test "${cf_tst_cflags}" = "\"'" ; then
67 CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags)
68 continue
69 fi
70 ;;
71 esac
72 case "$CPPFLAGS" in
73 (*$cf_add_cflags)
74 ;;
75 (*)
76 case "$cf_add_cflags" in
77 (-D*)
78 cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'`
79 CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,$cf_tst_cppflags)
80 ;;
81 esac
82 CF_APPEND_TEXT(cf_new_cppflags,$cf_add_cflags)
83 ;;
84 esac
85 ;;
86 (*)
87 CF_APPEND_TEXT(cf_new_cflags,$cf_add_cflags)
88 ;;
89 esac
90 ;;
91 (yes)
92 CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags)
93
94 cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^[[^"]]*"'\''//'`
95
96 test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \
97 && test -z "${cf_tst_cflags}" \
98 && cf_fix_cppflags=no
99 ;;
100 esac
101 done
102
103 if test -n "$cf_new_cflags" ; then
104 ifelse([$2],,,[CF_VERBOSE(add to \$CFLAGS $cf_new_cflags)])
105 CF_APPEND_TEXT(CFLAGS,$cf_new_cflags)
106 fi
107
108 if test -n "$cf_new_cppflags" ; then
109 ifelse([$2],,,[CF_VERBOSE(add to \$CPPFLAGS $cf_new_cppflags)])
110 CF_APPEND_TEXT(CPPFLAGS,$cf_new_cppflags)
111 fi
112
113 if test -n "$cf_new_extra_cppflags" ; then
114 ifelse([$2],,,[CF_VERBOSE(add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags)])
115 CF_APPEND_TEXT(EXTRA_CPPFLAGS,$cf_new_extra_cppflags)
116 fi
117
118 AC_SUBST(EXTRA_CPPFLAGS)
119
120 ])dnl
121 dnl ---------------------------------------------------------------------------
122 dnl CF_ANSI_CC_CHECK version: 13 updated: 2012/10/06 11:17:15
123 dnl ----------------
124 dnl This was originally adapted from the macros 'fp_PROG_CC_STDC' and
125 dnl 'fp_C_PROTOTYPES' in the sharutils 4.2 distribution.
126 AC_DEFUN([CF_ANSI_CC_CHECK],
127 [
128 CF_CC_ENV_FLAGS
129
130 AC_CACHE_CHECK(for ${CC:-cc} option to accept ANSI C, cf_cv_ansi_cc,[
131 cf_cv_ansi_cc=no
132 cf_save_CFLAGS="$CFLAGS"
133 cf_save_CPPFLAGS="$CPPFLAGS"
134 # Don't try gcc -ansi; that turns off useful extensions and
135 # breaks some systems' header files.
136 # AIX -qlanglvl=ansi
137 # Ultrix and OSF/1 -std1
138 # HP-UX -Aa -D_HPUX_SOURCE
139 # SVR4 -Xc
140 # UnixWare 1.2 (cannot use -Xc, since ANSI/POSIX clashes)
141 for cf_arg in "-DCC_HAS_PROTOS" \
142 "" \
143 -qlanglvl=ansi \
144 -std1 \
145 -Ae \
146 "-Aa -D_HPUX_SOURCE" \
147 -Xc
148 do
149 CF_ADD_CFLAGS($cf_arg)
150 AC_TRY_COMPILE(
151 [
152 #ifndef CC_HAS_PROTOS
153 #if !defined(__STDC__) || (__STDC__ != 1)
154 choke me
155 #endif
156 #endif
157 ],[
158 int test (int i, double x);
159 struct s1 {int (*f) (int a);};
160 struct s2 {int (*f) (double a);};],
161 [cf_cv_ansi_cc="$cf_arg"; break])
162 done
163 CFLAGS="$cf_save_CFLAGS"
164 CPPFLAGS="$cf_save_CPPFLAGS"
165 ])
166
167 if test "$cf_cv_ansi_cc" != "no"; then
168 if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then
169 CF_ADD_CFLAGS($cf_cv_ansi_cc)
170 else
171 AC_DEFINE(CC_HAS_PROTOS,1,[Define to 1 if C compiler supports prototypes])
172 fi
173 fi
174 ])dnl
175 dnl ---------------------------------------------------------------------------
176 dnl CF_ANSI_CC_REQD version: 4 updated: 2008/03/23 14:48:54
177 dnl ---------------
178 dnl For programs that must use an ANSI compiler, obtain compiler options that
179 dnl will make it recognize prototypes. We'll do preprocessor checks in other
180 dnl macros, since tools such as unproto can fake prototypes, but only part of
181 dnl the preprocessor.
182 AC_DEFUN([CF_ANSI_CC_REQD],
183 [AC_REQUIRE([CF_ANSI_CC_CHECK])
184 if test "$cf_cv_ansi_cc" = "no"; then
185 AC_MSG_ERROR(
186 [Your compiler does not appear to recognize prototypes.
187 You have the following choices:
188 a. adjust your compiler options
189 b. get an up-to-date compiler
190 c. use a wrapper such as unproto])
191 fi
192 ])dnl
193 dnl ---------------------------------------------------------------------------
194 dnl CF_APPEND_TEXT version: 1 updated: 2017/02/25 18:58:55
195 dnl --------------
196 dnl use this macro for appending text without introducing an extra blank at
197 dnl the beginning
198 define([CF_APPEND_TEXT],
199 [
200 test -n "[$]$1" && $1="[$]$1 "
201 $1="[$]{$1}$2"
202 ])dnl
203 dnl ---------------------------------------------------------------------------
204 dnl CF_ARG_DISABLE version: 3 updated: 1999/03/30 17:24:31
205 dnl --------------
206 dnl Allow user to disable a normally-on option.
207 AC_DEFUN([CF_ARG_DISABLE],
208 [CF_ARG_OPTION($1,[$2],[$3],[$4],yes)])dnl
209 dnl ---------------------------------------------------------------------------
210 dnl CF_ARG_ENABLE version: 3 updated: 1999/03/30 17:24:31
211 dnl -------------
212 dnl Allow user to enable a normally-off option.
213 AC_DEFUN([CF_ARG_ENABLE],
214 [CF_ARG_OPTION($1,[$2],[$3],[$4],no)])dnl
215 dnl ---------------------------------------------------------------------------
216 dnl CF_ARG_OPTION version: 5 updated: 2015/05/10 19:52:14
217 dnl -------------
218 dnl Restricted form of AC_ARG_ENABLE that ensures user doesn't give bogus
219 dnl values.
220 dnl
221 dnl Parameters:
222 dnl $1 = option name
223 dnl $2 = help-string
224 dnl $3 = action to perform if option is not default
225 dnl $4 = action if perform if option is default
226 dnl $5 = default option value (either 'yes' or 'no')
227 AC_DEFUN([CF_ARG_OPTION],
228 [AC_ARG_ENABLE([$1],[$2],[test "$enableval" != ifelse([$5],no,yes,no) && enableval=ifelse([$5],no,no,yes)
229 if test "$enableval" != "$5" ; then
230 ifelse([$3],,[ :]dnl
231 ,[ $3]) ifelse([$4],,,[
232 else
233 $4])
234 fi],[enableval=$5 ifelse([$4],,,[
235 $4
236 ])dnl
237 ])])dnl
238 dnl ---------------------------------------------------------------------------
239 dnl CF_CC_ENV_FLAGS version: 10 updated: 2020/12/31 18:40:20
240 dnl ---------------
241 dnl Check for user's environment-breakage by stuffing CFLAGS/CPPFLAGS content
242 dnl into CC. This will not help with broken scripts that wrap the compiler
243 dnl with options, but eliminates a more common category of user confusion.
244 dnl
245 dnl In particular, it addresses the problem of being able to run the C
246 dnl preprocessor in a consistent manner.
247 dnl
248 dnl Caveat: this also disallows blanks in the pathname for the compiler, but
249 dnl the nuisance of having inconsistent settings for compiler and preprocessor
250 dnl outweighs that limitation.
251 AC_DEFUN([CF_CC_ENV_FLAGS],
252 [
253 # This should have been defined by AC_PROG_CC
254 : "${CC:=cc}"
255
256 AC_MSG_CHECKING(\$CFLAGS variable)
257 case "x$CFLAGS" in
258 (*-[[IUD]]*)
259 AC_MSG_RESULT(broken)
260 AC_MSG_WARN(your environment uses the CFLAGS variable to hold CPPFLAGS options)
261 cf_flags="$CFLAGS"
262 CFLAGS=
263 for cf_arg in $cf_flags
264 do
265 CF_ADD_CFLAGS($cf_arg)
266 done
267 ;;
268 (*)
269 AC_MSG_RESULT(ok)
270 ;;
271 esac
272
273 AC_MSG_CHECKING(\$CC variable)
274 case "$CC" in
275 (*[[\ \ ]]-*)
276 AC_MSG_RESULT(broken)
277 AC_MSG_WARN(your environment uses the CC variable to hold CFLAGS/CPPFLAGS options)
278 # humor him...
279 cf_prog=`echo "$CC" | sed -e 's/ / /g' -e 's/[[ ]]* / /g' -e 's/[[ ]]*[[ ]]-[[^ ]].*//'`
280 cf_flags=`echo "$CC" | ${AWK:-awk} -v prog="$cf_prog" '{ printf("%s", [substr]([$]0,1+length(prog))); }'`
281 CC="$cf_prog"
282 for cf_arg in $cf_flags
283 do
284 case "x$cf_arg" in
285 (x-[[IUDfgOW]]*)
286 CF_ADD_CFLAGS($cf_arg)
287 ;;
288 (*)
289 CC="$CC $cf_arg"
290 ;;
291 esac
292 done
293 CF_VERBOSE(resulting CC: '$CC')
294 CF_VERBOSE(resulting CFLAGS: '$CFLAGS')
295 CF_VERBOSE(resulting CPPFLAGS: '$CPPFLAGS')
296 ;;
297 (*)
298 AC_MSG_RESULT(ok)
299 ;;
300 esac
301 ])dnl
302 dnl ---------------------------------------------------------------------------
303 dnl CF_CHECK_CACHE version: 13 updated: 2020/12/31 10:54:15
304 dnl --------------
305 dnl Check if we're accidentally using a cache from a different machine.
306 dnl Derive the system name, as a check for reusing the autoconf cache.
307 dnl
308 dnl If we've packaged config.guess and config.sub, run that (since it does a
309 dnl better job than uname). Normally we'll use AC_CANONICAL_HOST, but allow
310 dnl an extra parameter that we may override, e.g., for AC_CANONICAL_SYSTEM
311 dnl which is useful in cross-compiles.
312 dnl
313 dnl Note: we would use $ac_config_sub, but that is one of the places where
314 dnl autoconf 2.5x broke compatibility with autoconf 2.13
315 AC_DEFUN([CF_CHECK_CACHE],
316 [
317 if test -f "$srcdir/config.guess" || test -f "$ac_aux_dir/config.guess" ; then
318 ifelse([$1],,[AC_CANONICAL_HOST],[$1])
319 system_name="$host_os"
320 else
321 system_name="`(uname -s -r) 2>/dev/null`"
322 if test -z "$system_name" ; then
323 system_name="`(hostname) 2>/dev/null`"
324 fi
325 fi
326 test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name",[Define to the system name.])
327 AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"])
328
329 test -z "$system_name" && system_name="$cf_cv_system_name"
330 test -n "$cf_cv_system_name" && AC_MSG_RESULT(Configuring for $cf_cv_system_name)
331
332 if test ".$system_name" != ".$cf_cv_system_name" ; then
333 AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name))
334 AC_MSG_ERROR("Please remove config.cache and try again.")
335 fi
336 ])dnl
337 dnl ---------------------------------------------------------------------------
338 dnl CF_CLANG_COMPILER version: 8 updated: 2021/01/01 13:31:04
339 dnl -----------------
340 dnl Check if the given compiler is really clang. clang's C driver defines
341 dnl __GNUC__ (fooling the configure script into setting $GCC to yes) but does
342 dnl not ignore some gcc options.
343 dnl
344 dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to
345 dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from
346 dnl the wrappers for gcc and g++ warnings.
347 dnl
348 dnl $1 = GCC (default) or GXX
349 dnl $2 = CLANG_COMPILER (default)
350 dnl $3 = CFLAGS (default) or CXXFLAGS
351 AC_DEFUN([CF_CLANG_COMPILER],[
352 ifelse([$2],,CLANG_COMPILER,[$2])=no
353
354 if test "$ifelse([$1],,[$1],GCC)" = yes ; then
355 AC_MSG_CHECKING(if this is really Clang ifelse([$1],GXX,C++,C) compiler)
356 cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])"
357 AC_TRY_COMPILE([],[
358 #ifdef __clang__
359 #else
360 make an error
361 #endif
362 ],[ifelse([$2],,CLANG_COMPILER,[$2])=yes
363 ],[])
364 ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS"
365 AC_MSG_RESULT($ifelse([$2],,CLANG_COMPILER,[$2]))
366 fi
367
368 CLANG_VERSION=none
369
370 if test "x$ifelse([$2],,CLANG_COMPILER,[$2])" = "xyes" ; then
371 case "$CC" in
372 (c[[1-9]][[0-9]]|*/c[[1-9]][[0-9]])
373 AC_MSG_WARN(replacing broken compiler alias $CC)
374 CFLAGS="$CFLAGS -std=`echo "$CC" | sed -e 's%.*/%%'`"
375 CC=clang
376 ;;
377 esac
378
379 AC_MSG_CHECKING(version of $CC)
380 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.]].*//'`"
381 test -z "$CLANG_VERSION" && CLANG_VERSION=unknown
382 AC_MSG_RESULT($CLANG_VERSION)
383
384 for cf_clang_opt in \
385 -Qunused-arguments \
386 -Wno-error=implicit-function-declaration
387 do
388 AC_MSG_CHECKING(if option $cf_clang_opt works)
389 cf_save_CFLAGS="$CFLAGS"
390 CFLAGS="$CFLAGS $cf_clang_opt"
391 AC_TRY_LINK([
392 #include <stdio.h>],[
393 printf("hello!\\n");],[
394 cf_clang_optok=yes],[
395 cf_clang_optok=no])
396 AC_MSG_RESULT($cf_clang_optok)
397 CFLAGS="$cf_save_CFLAGS"
398 if test "$cf_clang_optok" = yes; then
399 CF_VERBOSE(adding option $cf_clang_opt)
400 CF_APPEND_TEXT(CFLAGS,$cf_clang_opt)
401 fi
402 done
403 fi
404 ])
405 dnl ---------------------------------------------------------------------------
406 dnl CF_CONST_X_STRING version: 6 updated: 2021/01/01 13:31:04
407 dnl -----------------
408 dnl The X11R4-X11R6 Xt specification uses an ambiguous String type for most
409 dnl character-strings.
410 dnl
411 dnl It is ambiguous because the specification accommodated the pre-ANSI
412 dnl compilers bundled by more than one vendor in lieu of providing a standard C
413 dnl compiler other than by costly add-ons. Because of this, the specification
414 dnl did not take into account the use of const for telling the compiler that
415 dnl string literals would be in readonly memory.
416 dnl
417 dnl As a workaround, one could (starting with X11R5) define XTSTRINGDEFINES, to
418 dnl let the compiler decide how to represent Xt's strings which were #define'd.
419 dnl That does not solve the problem of using the block of Xt's strings which
420 dnl are compiled into the library (and is less efficient than one might want).
421 dnl
422 dnl Xt specification 7 introduces the _CONST_X_STRING symbol which is used both
423 dnl when compiling the library and compiling using the library, to tell the
424 dnl compiler that String is const.
425 AC_DEFUN([CF_CONST_X_STRING],
426 [
427 AC_REQUIRE([AC_PATH_XTRA])
428
429 CF_SAVE_XTRA_FLAGS([CF_CONST_X_STRING])
430
431 AC_TRY_COMPILE(
432 [
433 #include <stdlib.h>
434 #include <X11/Intrinsic.h>
435 ],
436 [String foo = malloc(1); (void)foo],[
437
438 AC_CACHE_CHECK(for X11/Xt const-feature,cf_cv_const_x_string,[
439 AC_TRY_COMPILE(
440 [
441 #define _CONST_X_STRING /* X11R7.8 (perhaps) */
442 #undef XTSTRINGDEFINES /* X11R5 and later */
443 #include <stdlib.h>
444 #include <X11/Intrinsic.h>
445 ],[String foo = malloc(1); *foo = 0],[
446 cf_cv_const_x_string=no
447 ],[
448 cf_cv_const_x_string=yes
449 ])
450 ])
451
452 CF_RESTORE_XTRA_FLAGS([CF_CONST_X_STRING])
453
454 case "$cf_cv_const_x_string" in
455 (no)
456 CF_APPEND_TEXT(CPPFLAGS,-DXTSTRINGDEFINES)
457 ;;
458 (*)
459 CF_APPEND_TEXT(CPPFLAGS,-D_CONST_X_STRING)
460 ;;
461 esac
462
463 ])
464 ])dnl
465 dnl ---------------------------------------------------------------------------
466 dnl CF_DISABLE_ECHO version: 13 updated: 2015/04/18 08:56:57
467 dnl ---------------
468 dnl You can always use "make -n" to see the actual options, but it's hard to
469 dnl pick out/analyze warning messages when the compile-line is long.
470 dnl
471 dnl Sets:
472 dnl ECHO_LT - symbol to control if libtool is verbose
473 dnl ECHO_LD - symbol to prefix "cc -o" lines
474 dnl RULE_CC - symbol to put before implicit "cc -c" lines (e.g., .c.o)
475 dnl SHOW_CC - symbol to put before explicit "cc -c" lines
476 dnl ECHO_CC - symbol to put before any "cc" line
477 dnl
478 AC_DEFUN([CF_DISABLE_ECHO],[
479 AC_MSG_CHECKING(if you want to see long compiling messages)
480 CF_ARG_DISABLE(echo,
481 [ --disable-echo do not display "compiling" commands],
482 [
483 ECHO_LT='--silent'
484 ECHO_LD='@echo linking [$]@;'
485 RULE_CC='@echo compiling [$]<'
486 SHOW_CC='@echo compiling [$]@'
487 ECHO_CC='@'
488 ],[
489 ECHO_LT=''
490 ECHO_LD=''
491 RULE_CC=''
492 SHOW_CC=''
493 ECHO_CC=''
494 ])
495 AC_MSG_RESULT($enableval)
496 AC_SUBST(ECHO_LT)
497 AC_SUBST(ECHO_LD)
498 AC_SUBST(RULE_CC)
499 AC_SUBST(SHOW_CC)
500 AC_SUBST(ECHO_CC)
501 ])dnl
502 dnl ---------------------------------------------------------------------------
503 dnl CF_DISABLE_LEAKS version: 8 updated: 2021/01/05 20:05:09
504 dnl ----------------
505 dnl Combine no-leak checks with the libraries or tools that are used for the
506 dnl checks.
507 AC_DEFUN([CF_DISABLE_LEAKS],[
508
509 AC_REQUIRE([CF_WITH_DMALLOC])
510 AC_REQUIRE([CF_WITH_DBMALLOC])
511 AC_REQUIRE([CF_WITH_VALGRIND])
512
513 AC_MSG_CHECKING(if you want to perform memory-leak testing)
514 AC_ARG_ENABLE(leaks,
515 [ --disable-leaks test: free permanent memory, analyze leaks],
516 [enable_leaks=no],
517 [enable_leaks=yes])
518 dnl TODO - drop with_no_leaks
519 if test "x$enable_leaks" = xno; then with_no_leaks=yes; else with_no_leaks=no; fi
520 AC_MSG_RESULT($with_no_leaks)
521
522 if test "$enable_leaks" = no ; then
523 AC_DEFINE(NO_LEAKS,1,[Define to 1 if you want to perform memory-leak testing.])
524 AC_DEFINE(YY_NO_LEAKS,1,[Define to 1 if you want to perform memory-leak testing.])
525 fi
526 ])dnl
527 dnl ---------------------------------------------------------------------------
528 dnl CF_ENABLE_WARNINGS version: 9 updated: 2021/01/05 19:40:50
529 dnl ------------------
530 dnl Configure-option to enable gcc warnings
531 dnl
532 dnl $1 = extra options to add, if supported
533 dnl $2 = option for checking attributes. By default, this is done when
534 dnl warnings are enabled. For other values:
535 dnl yes: always do this, e.g., to use in generated library-headers
536 dnl no: never do this
537 AC_DEFUN([CF_ENABLE_WARNINGS],[
538 if test "$GCC" = yes || test "$GXX" = yes
539 then
540 CF_FIX_WARNINGS(CFLAGS)
541 CF_FIX_WARNINGS(CPPFLAGS)
542 CF_FIX_WARNINGS(LDFLAGS)
543 AC_MSG_CHECKING(if you want to turn on gcc warnings)
544 CF_ARG_ENABLE(warnings,
545 [ --enable-warnings test: turn on gcc compiler warnings],
546 [enable_warnings=yes],
547 [enable_warnings=no])
548 AC_MSG_RESULT($enable_warnings)
549 if test "$enable_warnings" = "yes"
550 then
551 ifelse($2,,[CF_GCC_ATTRIBUTES])
552 CF_GCC_WARNINGS($1)
553 fi
554 ifelse($2,yes,[CF_GCC_ATTRIBUTES])
555 fi
556 ])dnl
557 dnl ---------------------------------------------------------------------------
558 dnl CF_FIX_WARNINGS version: 3 updated: 2020/12/31 18:40:20
559 dnl ---------------
560 dnl Warning flags do not belong in CFLAGS, CPPFLAGS, etc. Any of gcc's
561 dnl "-Werror" flags can interfere with configure-checks. Those go into
562 dnl EXTRA_CFLAGS.
563 dnl
564 dnl $1 = variable name to repair
565 define([CF_FIX_WARNINGS],[
566 if test "$GCC" = yes || test "$GXX" = yes
567 then
568 case [$]$1 in
569 (*-Werror=*)
570 CF_VERBOSE(repairing $1: [$]$1)
571 cf_temp_flags=
572 for cf_temp_scan in [$]$1
573 do
574 case "x$cf_temp_scan" in
575 (x-Werror=*)
576 CF_APPEND_TEXT(EXTRA_CFLAGS,$cf_temp_scan)
577 ;;
578 (*)
579 CF_APPEND_TEXT(cf_temp_flags,$cf_temp_scan)
580 ;;
581 esac
582 done
583 $1="$cf_temp_flags"
584 CF_VERBOSE(... fixed [$]$1)
585 CF_VERBOSE(... extra $EXTRA_CFLAGS)
586 ;;
587 esac
588 fi
589 AC_SUBST(EXTRA_CFLAGS)
590 ])dnl
591 dnl ---------------------------------------------------------------------------
592 dnl CF_GCC_ATTRIBUTES version: 23 updated: 2021/01/03 18:30:50
593 dnl -----------------
594 dnl Test for availability of useful gcc __attribute__ directives to quiet
595 dnl compiler warnings. Though useful, not all are supported -- and contrary
596 dnl to documentation, unrecognized directives cause older compilers to barf.
597 AC_DEFUN([CF_GCC_ATTRIBUTES],
598 [AC_REQUIRE([AC_PROG_FGREP])dnl
599
600 if test "$GCC" = yes || test "$GXX" = yes
601 then
602 cat > conftest.i <<EOF
603 #ifndef GCC_PRINTF
604 #define GCC_PRINTF 0
605 #endif
606 #ifndef GCC_SCANF
607 #define GCC_SCANF 0
608 #endif
609 #ifndef GCC_NORETURN
610 #define GCC_NORETURN /* nothing */
611 #endif
612 #ifndef GCC_UNUSED
613 #define GCC_UNUSED /* nothing */
614 #endif
615 EOF
616 if test "$GCC" = yes
617 then
618 AC_CHECKING([for $CC __attribute__ directives])
619 cat > "conftest.$ac_ext" <<EOF
620 #line __oline__ "${as_me:-configure}"
621 #include "confdefs.h"
622 #include "conftest.h"
623 #include "conftest.i"
624 #if GCC_PRINTF
625 #define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
626 #else
627 #define GCC_PRINTFLIKE(fmt,var) /*nothing*/
628 #endif
629 #if GCC_SCANF
630 #define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var)))
631 #else
632 #define GCC_SCANFLIKE(fmt,var) /*nothing*/
633 #endif
634 extern void wow(char *,...) GCC_SCANFLIKE(1,2);
635 extern void oops(char *,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN;
636 extern void foo(void) GCC_NORETURN;
637 int main(int argc GCC_UNUSED, char *argv[[]] GCC_UNUSED) { (void)argc; (void)argv; return 0; }
638 EOF
639 cf_printf_attribute=no
640 cf_scanf_attribute=no
641 for cf_attribute in scanf printf unused noreturn
642 do
643 CF_UPPER(cf_ATTRIBUTE,$cf_attribute)
644 cf_directive="__attribute__(($cf_attribute))"
645 echo "checking for $CC $cf_directive" 1>&AC_FD_CC
646
647 case "$cf_attribute" in
648 (printf)
649 cf_printf_attribute=yes
650 cat >conftest.h <<EOF
651 #define GCC_$cf_ATTRIBUTE 1
652 EOF
653 ;;
654 (scanf)
655 cf_scanf_attribute=yes
656 cat >conftest.h <<EOF
657 #define GCC_$cf_ATTRIBUTE 1
658 EOF
659 ;;
660 (*)
661 cat >conftest.h <<EOF
662 #define GCC_$cf_ATTRIBUTE $cf_directive
663 EOF
664 ;;
665 esac
666
667 if AC_TRY_EVAL(ac_compile); then
668 test -n "$verbose" && AC_MSG_RESULT(... $cf_attribute)
669 cat conftest.h >>confdefs.h
670 case "$cf_attribute" in
671 (noreturn)
672 AC_DEFINE_UNQUOTED(GCC_NORETURN,$cf_directive,[Define to noreturn-attribute for gcc])
673 ;;
674 (printf)
675 cf_value='/* nothing */'
676 if test "$cf_printf_attribute" != no ; then
677 cf_value='__attribute__((format(printf,fmt,var)))'
678 AC_DEFINE(GCC_PRINTF,1,[Define to 1 if the compiler supports gcc-like printf attribute.])
679 fi
680 AC_DEFINE_UNQUOTED(GCC_PRINTFLIKE(fmt,var),$cf_value,[Define to printf-attribute for gcc])
681 ;;
682 (scanf)
683 cf_value='/* nothing */'
684 if test "$cf_scanf_attribute" != no ; then
685 cf_value='__attribute__((format(scanf,fmt,var)))'
686 AC_DEFINE(GCC_SCANF,1,[Define to 1 if the compiler supports gcc-like scanf attribute.])
687 fi
688 AC_DEFINE_UNQUOTED(GCC_SCANFLIKE(fmt,var),$cf_value,[Define to sscanf-attribute for gcc])
689 ;;
690 (unused)
691 AC_DEFINE_UNQUOTED(GCC_UNUSED,$cf_directive,[Define to unused-attribute for gcc])
692 ;;
693 esac
694 fi
695 done
696 else
697 ${FGREP-fgrep} define conftest.i >>confdefs.h
698 fi
699 rm -rf ./conftest*
700 fi
701 ])dnl
702 dnl ---------------------------------------------------------------------------
703 dnl CF_GCC_VERSION version: 8 updated: 2019/09/07 13:38:36
704 dnl --------------
705 dnl Find version of gcc, and (because icc/clang pretend to be gcc without being
706 dnl compatible), attempt to determine if icc/clang is actually used.
707 AC_DEFUN([CF_GCC_VERSION],[
708 AC_REQUIRE([AC_PROG_CC])
709 GCC_VERSION=none
710 if test "$GCC" = yes ; then
711 AC_MSG_CHECKING(version of $CC)
712 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.]].*//'`"
713 test -z "$GCC_VERSION" && GCC_VERSION=unknown
714 AC_MSG_RESULT($GCC_VERSION)
715 fi
716 CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS)
717 CF_CLANG_COMPILER(GCC,CLANG_COMPILER,CFLAGS)
718 ])dnl
719 dnl ---------------------------------------------------------------------------
720 dnl CF_GCC_WARNINGS version: 41 updated: 2021/01/01 16:53:59
721 dnl ---------------
722 dnl Check if the compiler supports useful warning options. There's a few that
723 dnl we don't use, simply because they're too noisy:
724 dnl
725 dnl -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x)
726 dnl -Winline (usually not worthwhile)
727 dnl -Wredundant-decls (system headers make this too noisy)
728 dnl -Wtraditional (combines too many unrelated messages, only a few useful)
729 dnl -Wwrite-strings (too noisy, but should review occasionally). This
730 dnl is enabled for ncurses using "--enable-const".
731 dnl -pedantic
732 dnl
733 dnl Parameter:
734 dnl $1 is an optional list of gcc warning flags that a particular
735 dnl application might want to use, e.g., "no-unused" for
736 dnl -Wno-unused
737 dnl Special:
738 dnl If $with_ext_const is "yes", add a check for -Wwrite-strings
739 dnl
740 AC_DEFUN([CF_GCC_WARNINGS],
741 [
742 AC_REQUIRE([CF_GCC_VERSION])
743 if test "x$have_x" = xyes; then CF_CONST_X_STRING fi
744 cat > "conftest.$ac_ext" <<EOF
745 #line __oline__ "${as_me:-configure}"
746 int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; }
747 EOF
748 if test "$INTEL_COMPILER" = yes
749 then
750 # The "-wdXXX" options suppress warnings:
751 # remark #1419: external declaration in primary source file
752 # remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
753 # remark #1684: conversion from pointer to same-sized integral type (potential portability problem)
754 # remark #193: zero used for undefined preprocessing identifier
755 # remark #593: variable "curs_sb_left_arrow" was set but never used
756 # remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits
757 # remark #869: parameter "tw" was never referenced
758 # remark #981: operands are evaluated in unspecified order
759 # warning #279: controlling expression is constant
760
761 AC_CHECKING([for $CC warning options])
762 cf_save_CFLAGS="$CFLAGS"
763 EXTRA_CFLAGS="$EXTRA_CFLAGS -Wall"
764 for cf_opt in \
765 wd1419 \
766 wd1683 \
767 wd1684 \
768 wd193 \
769 wd593 \
770 wd279 \
771 wd810 \
772 wd869 \
773 wd981
774 do
775 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
776 if AC_TRY_EVAL(ac_compile); then
777 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
778 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
779 fi
780 done
781 CFLAGS="$cf_save_CFLAGS"
782 elif test "$GCC" = yes && test "$GCC_VERSION" != "unknown"
783 then
784 AC_CHECKING([for $CC warning options])
785 cf_save_CFLAGS="$CFLAGS"
786 cf_warn_CONST=""
787 test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings"
788 cf_gcc_warnings="Wignored-qualifiers Wlogical-op Wvarargs"
789 test "x$CLANG_COMPILER" = xyes && cf_gcc_warnings=
790 for cf_opt in W Wall \
791 Wbad-function-cast \
792 Wcast-align \
793 Wcast-qual \
794 Wdeclaration-after-statement \
795 Wextra \
796 Winline \
797 Wmissing-declarations \
798 Wmissing-prototypes \
799 Wnested-externs \
800 Wpointer-arith \
801 Wshadow \
802 Wstrict-prototypes \
803 Wundef Wno-inline $cf_gcc_warnings $cf_warn_CONST $1
804 do
805 CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
806 if AC_TRY_EVAL(ac_compile); then
807 test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
808 case "$cf_opt" in
809 (Winline)
810 case "$GCC_VERSION" in
811 ([[34]].*)
812 CF_VERBOSE(feature is broken in gcc $GCC_VERSION)
813 continue;;
814 esac
815 ;;
816 (Wpointer-arith)
817 case "$GCC_VERSION" in
818 ([[12]].*)
819 CF_VERBOSE(feature is broken in gcc $GCC_VERSION)
820 continue;;
821 esac
822 ;;
823 esac
824 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
825 fi
826 done
827 CFLAGS="$cf_save_CFLAGS"
828 fi
829 rm -rf ./conftest*
830
831 AC_SUBST(EXTRA_CFLAGS)
832 ])dnl
833 dnl ---------------------------------------------------------------------------
834 dnl CF_GETOPT_HEADER version: 7 updated: 2021/01/01 13:31:04
835 dnl ----------------
836 dnl Check for getopt's variables which are commonly defined in stdlib.h,
837 dnl unistd.h or (nonstandard) in getopt.h
838 AC_DEFUN([CF_GETOPT_HEADER],
839 [
840 AC_HAVE_HEADERS(unistd.h getopt.h)
841 AC_CACHE_CHECK(for header declaring getopt variables,cf_cv_getopt_header,[
842 cf_cv_getopt_header=none
843 for cf_header in stdio.h stdlib.h unistd.h getopt.h
844 do
845 AC_TRY_COMPILE([
846 #include <$cf_header>],
847 [int x = optind; char *y = optarg],
848 [cf_cv_getopt_header=$cf_header
849 break])
850 done
851 ])
852 if test "$cf_cv_getopt_header" != none ; then
853 AC_DEFINE(HAVE_GETOPT_HEADER,1,[Define to 1 if getopt variables are declared in header])
854 fi
855 if test "$cf_cv_getopt_header" = getopt.h ; then
856 AC_DEFINE(NEED_GETOPT_H,1,[Define to 1 if we must include getopt.h])
857 fi
858 ])dnl
859 dnl ---------------------------------------------------------------------------
860 dnl CF_INTEL_COMPILER version: 8 updated: 2021/01/01 16:53:59
861 dnl -----------------
862 dnl Check if the given compiler is really the Intel compiler for Linux. It
863 dnl tries to imitate gcc, but does not return an error when it finds a mismatch
864 dnl between prototypes, e.g., as exercised by CF_MISSING_CHECK.
865 dnl
866 dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to
867 dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from
868 dnl the wrappers for gcc and g++ warnings.
869 dnl
870 dnl $1 = GCC (default) or GXX
871 dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS
872 dnl $3 = CFLAGS (default) or CXXFLAGS
873 AC_DEFUN([CF_INTEL_COMPILER],[
874 AC_REQUIRE([AC_CANONICAL_HOST])
875 ifelse([$2],,INTEL_COMPILER,[$2])=no
876
877 if test "$ifelse([$1],,[$1],GCC)" = yes ; then
878 case "$host_os" in
879 (linux*|gnu*)
880 AC_MSG_CHECKING(if this is really Intel ifelse([$1],GXX,C++,C) compiler)
881 cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])"
882 ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -no-gcc"
883 AC_TRY_COMPILE([],[
884 #ifdef __INTEL_COMPILER
885 #else
886 make an error
887 #endif
888 ],[ifelse([$2],,INTEL_COMPILER,[$2])=yes
889 cf_save_CFLAGS="$cf_save_CFLAGS -we147"
890 ],[])
891 ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS"
892 AC_MSG_RESULT($ifelse([$2],,INTEL_COMPILER,[$2]))
893 ;;
894 esac
895 fi
896 ])dnl
897 dnl ---------------------------------------------------------------------------
898 dnl CF_MAKE_DOCS version: 4 updated: 2015/07/04 21:43:03
899 dnl ------------
900 dnl $1 = name(s) to generate rules for
901 dnl $2 = suffix of corresponding manpages used as input.
902 dnl
903 dnl This works best if called at the end of configure.in, following CF_WITH_MAN2HTML
904 define([CF_MAKE_DOCS],[
905 test -z "$cf_make_docs" && cf_make_docs=0
906
907 cf_output=makefile
908 test -f "$cf_output" || cf_output=Makefile
909
910 if test "$cf_make_docs" = 0
911 then
912 cat >>$cf_output <<CF_EOF
913 ################################################################################
914 ## generated by $0
915 .SUFFIXES : .html .$2 .man .ps .pdf .txt
916
917 ${NROFF_NOTE}.$2.txt :
918 ${NROFF_NOTE} [\$](SHELL) -c "tbl [\$]*.$2 | nroff -man | col -bx" >[\$]@
919
920 ${GROFF_NOTE}.ps.pdf :
921 ${GROFF_NOTE} ps2pdf [\$]*.ps
922 ${GROFF_NOTE}
923 ${GROFF_NOTE}.$2.ps :
924 ${GROFF_NOTE} [\$](SHELL) -c "tbl [\$]*.$2 | groff -man" >[\$]@
925 ${GROFF_NOTE}
926 ${GROFF_NOTE}.$2.txt :
927 ${GROFF_NOTE} GROFF_NO_SGR=stupid [\$](SHELL) -c "tbl [\$]*.$2 | nroff -Tascii -man | col -bx" >[\$]@
928
929 ${MAN2HTML_NOTE}.$2.html :
930 ${MAN2HTML_NOTE} ./${MAN2HTML_TEMP} [\$]* $2 man >[\$]@
931
932 CF_EOF
933 cf_make_docs=1
934 fi
935
936 for cf_name in $1
937 do
938 cat >>$cf_output <<CF_EOF
939 ################################################################################
940 ${NROFF_NOTE}docs docs-$cf_name :: $cf_name.txt
941 ${MAN2HTML_NOTE}docs docs-$cf_name :: $cf_name.html
942 ${GROFF_NOTE}docs docs-$cf_name :: $cf_name.pdf
943 ${GROFF_NOTE}docs docs-$cf_name :: $cf_name.ps
944 ${GROFF_NOTE}docs docs-$cf_name :: $cf_name.txt
945
946 clean \\
947 docs-clean ::
948 ${NROFF_NOTE} rm -f $cf_name.txt
949 ${MAN2HTML_NOTE} rm -f $cf_name.html
950 ${GROFF_NOTE} rm -f $cf_name.pdf
951 ${GROFF_NOTE} rm -f $cf_name.ps
952 ${GROFF_NOTE} rm -f $cf_name.txt
953
954 ${NROFF_NOTE}$cf_name.txt : $cf_name.$2
955 ${MAN2HTML_NOTE}$cf_name.html : $cf_name.$2
956 ${GROFF_NOTE}$cf_name.pdf : $cf_name.ps
957 ${GROFF_NOTE}$cf_name.ps : $cf_name.$2
958 ${GROFF_NOTE}$cf_name.txt : $cf_name.$2
959 CF_EOF
960 done
961 ])dnl
962 dnl ---------------------------------------------------------------------------
963 dnl CF_MAKE_PHONY version: 3 updated: 2021/01/08 16:08:21
964 dnl -------------
965 dnl Check if the make-program handles a ".PHONY" target, e.g,. a target which
966 dnl acts as a placeholder.
967 dnl
968 dnl The ".PHONY" feature was proposed in 2011 here
969 dnl https://www.austingroupbugs.net/view.php?id=523
970 dnl and is scheduled for release in P1003.1 Issue 8 (late 2022).
971 dnl
972 dnl This is not supported by SVr4 make (or SunOS 4, 4.3SD, etc), but works with
973 dnl a few others (i.e., GNU make and the non-POSIX "BSD" make):
974 dnl
975 dnl + This is a GNU make feature (since April 1988, but in turn from binutils,
976 dnl date unspecified).
977 dnl
978 dnl + It was adopted in NetBSD make in June 1995.
979 dnl
980 dnl + The other BSD make programs are derived from the NetBSD make (and for
981 dnl that reason are not actually different "implementations").
982 dnl
983 dnl + Some features of NetBSD make were actually adapted from pmake, which
984 dnl began as a modified GNU make starting in 1993.
985 dnl
986 dnl + Version 3.8 of the dmake program in January 1992 also implemented this
987 dnl GNU make extension, but is less well known than the BSD make.
988 AC_DEFUN([CF_MAKE_PHONY],[
989 AC_CACHE_CHECK(for \".PHONY\" make-support, cf_cv_make_PHONY,[
990 rm -rf conftest*
991 (
992 mkdir conftest || exit 1
993 cd conftest
994 cat >makefile <<'CF_EOF'
995 .PHONY: always
996 DATA=0
997 always: always.out
998 @echo "** making [$]@ [$](DATA)"
999 once: once.out
1000 @echo "** making [$]@ [$](DATA)"
1001 always.out:
1002 @echo "** making [$]@ [$](DATA)"
1003 echo [$](DATA) > [$]@
1004 once.out:
1005 @echo "** making [$]@ [$](DATA)"
1006 echo [$](DATA) > [$]@
1007 CF_EOF
1008 for cf_data in 1 2 3
1009 do
1010 ${MAKE:-make} always DATA=$cf_data
1011 ${MAKE:-make} once DATA=$cf_data
1012 ${MAKE:-make} -t always once
1013 if test -f always ; then
1014 echo "no (case 1)" > ../conftest.tmp
1015 elif test ! -f always.out ; then
1016 echo "no (case 2)" > ../conftest.tmp
1017 elif test ! -f once.out ; then
1018 echo "no (case 3)" > ../conftest.tmp
1019 elif ! cmp -s always.out once.out ; then
1020 echo "no (case 4)" > ../conftest.tmp
1021 diff always.out once.out
1022 else
1023 cf_check="`cat always.out`"
1024 if test "x$cf_check" != "x$cf_data" ; then
1025 echo "no (case 5)" > ../conftest.tmp
1026 else
1027 echo yes > ../conftest.tmp
1028 rm -f ./*.out
1029 continue
1030 fi
1031 fi
1032 break
1033 done
1034 ) >&AC_FD_CC 2>&1
1035 cf_cv_make_PHONY="`cat conftest.tmp`"
1036 rm -rf conftest*
1037 ])
1038 MAKE_NO_PHONY="#"
1039 MAKE_PHONY="#"
1040 test "x$cf_cv_make_PHONY" = xyes && MAKE_PHONY=
1041 test "x$cf_cv_make_PHONY" != xyes && MAKE_NO_PHONY=
1042 AC_SUBST(MAKE_NO_PHONY)
1043 AC_SUBST(MAKE_PHONY)
1044 ])dnl
1045 dnl ---------------------------------------------------------------------------
1046 dnl CF_MAKE_TAGS version: 6 updated: 2010/10/23 15:52:32
1047 dnl ------------
1048 dnl Generate tags/TAGS targets for makefiles. Do not generate TAGS if we have
1049 dnl a monocase filesystem.
1050 AC_DEFUN([CF_MAKE_TAGS],[
1051 AC_REQUIRE([CF_MIXEDCASE_FILENAMES])
1052
1053 AC_CHECK_PROGS(CTAGS, exctags ctags)
1054 AC_CHECK_PROGS(ETAGS, exetags etags)
1055
1056 AC_CHECK_PROG(MAKE_LOWER_TAGS, ${CTAGS:-ctags}, yes, no)
1057
1058 if test "$cf_cv_mixedcase" = yes ; then
1059 AC_CHECK_PROG(MAKE_UPPER_TAGS, ${ETAGS:-etags}, yes, no)
1060 else
1061 MAKE_UPPER_TAGS=no
1062 fi
1063
1064 if test "$MAKE_UPPER_TAGS" = yes ; then
1065 MAKE_UPPER_TAGS=
1066 else
1067 MAKE_UPPER_TAGS="#"
1068 fi
1069
1070 if test "$MAKE_LOWER_TAGS" = yes ; then
1071 MAKE_LOWER_TAGS=
1072 else
1073 MAKE_LOWER_TAGS="#"
1074 fi
1075
1076 AC_SUBST(CTAGS)
1077 AC_SUBST(ETAGS)
1078
1079 AC_SUBST(MAKE_UPPER_TAGS)
1080 AC_SUBST(MAKE_LOWER_TAGS)
1081 ])dnl
1082 dnl ---------------------------------------------------------------------------
1083 dnl CF_MIXEDCASE_FILENAMES version: 9 updated: 2021/01/01 16:53:59
1084 dnl ----------------------
1085 dnl Check if the file-system supports mixed-case filenames. If we're able to
1086 dnl create a lowercase name and see it as uppercase, it doesn't support that.
1087 AC_DEFUN([CF_MIXEDCASE_FILENAMES],
1088 [
1089 AC_CACHE_CHECK(if filesystem supports mixed-case filenames,cf_cv_mixedcase,[
1090 if test "$cross_compiling" = yes ; then
1091 case "$target_alias" in
1092 (*-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-msys*|*-mingw*|*-uwin*|darwin*)
1093 cf_cv_mixedcase=no
1094 ;;
1095 (*)
1096 cf_cv_mixedcase=yes
1097 ;;
1098 esac
1099 else
1100 rm -f conftest CONFTEST
1101 echo test >conftest
1102 if test -f CONFTEST ; then
1103 cf_cv_mixedcase=no
1104 else
1105 cf_cv_mixedcase=yes
1106 fi
1107 rm -f conftest CONFTEST
1108 fi
1109 ])
1110 test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES,1,[Define to 1 if filesystem supports mixed-case filenames.])
1111 ])dnl
1112 dnl ---------------------------------------------------------------------------
1113 dnl CF_MSG_LOG version: 5 updated: 2010/10/23 15:52:32
1114 dnl ----------
1115 dnl Write a debug message to config.log, along with the line number in the
1116 dnl configure script.
1117 AC_DEFUN([CF_MSG_LOG],[
1118 echo "${as_me:-configure}:__oline__: testing $* ..." 1>&AC_FD_CC
1119 ])dnl
1120 dnl ---------------------------------------------------------------------------
1121 dnl CF_NO_LEAKS_OPTION version: 8 updated: 2021/01/05 20:05:09
1122 dnl ------------------
1123 dnl see CF_WITH_NO_LEAKS
1124 AC_DEFUN([CF_NO_LEAKS_OPTION],[
1125 AC_MSG_CHECKING(if you want to use $1 for testing)
1126 AC_ARG_WITH($1,
1127 [$2],
1128 [AC_DEFINE_UNQUOTED($3,1,"Define to 1 if you want to use $1 for testing.")ifelse([$4],,[
1129 $4
1130 ])
1131 : "${with_cflags:=-g}"
1132 : "${enable_leaks:=no}"
1133 with_$1=yes],
1134 [with_$1=])
1135 AC_MSG_RESULT(${with_$1:-no})
1136
1137 case ".$with_cflags" in
1138 (.*-g*)
1139 case .$CFLAGS in
1140 (.*-g*)
1141 ;;
1142 (*)
1143 CF_ADD_CFLAGS([-g])
1144 ;;
1145 esac
1146 ;;
1147 esac
1148 ])dnl
1149 dnl ---------------------------------------------------------------------------
1150 dnl CF_PATH_SYNTAX version: 18 updated: 2020/12/31 18:40:20
1151 dnl --------------
1152 dnl Check the argument to see that it looks like a pathname. Rewrite it if it
1153 dnl begins with one of the prefix/exec_prefix variables, and then again if the
1154 dnl result begins with 'NONE'. This is necessary to work around autoconf's
1155 dnl delayed evaluation of those symbols.
1156 AC_DEFUN([CF_PATH_SYNTAX],[
1157 if test "x$prefix" != xNONE; then
1158 cf_path_syntax="$prefix"
1159 else
1160 cf_path_syntax="$ac_default_prefix"
1161 fi
1162
1163 case ".[$]$1" in
1164 (.\[$]\(*\)*|.\'*\'*)
1165 ;;
1166 (..|./*|.\\*)
1167 ;;
1168 (.[[a-zA-Z]]:[[\\/]]*) # OS/2 EMX
1169 ;;
1170 (.\[$]\{*prefix\}*|.\[$]\{*dir\}*)
1171 eval $1="[$]$1"
1172 case ".[$]$1" in
1173 (.NONE/*)
1174 $1=`echo "[$]$1" | sed -e s%NONE%$cf_path_syntax%`
1175 ;;
1176 esac
1177 ;;
1178 (.no|.NONE/*)
1179 $1=`echo "[$]$1" | sed -e s%NONE%$cf_path_syntax%`
1180 ;;
1181 (*)
1182 ifelse([$2],,[AC_MSG_ERROR([expected a pathname, not \"[$]$1\"])],$2)
1183 ;;
1184 esac
1185 ])dnl
1186 dnl ---------------------------------------------------------------------------
1187 dnl CF_PROG_EXT version: 15 updated: 2021/01/02 09:31:20
1188 dnl -----------
1189 dnl Compute $PROG_EXT, used for non-Unix ports, such as OS/2 EMX.
1190 AC_DEFUN([CF_PROG_EXT],
1191 [
1192 AC_REQUIRE([CF_CHECK_CACHE])
1193 case "$cf_cv_system_name" in
1194 (os2*)
1195 CFLAGS="$CFLAGS -Zmt"
1196 CF_APPEND_TEXT(CPPFLAGS,-D__ST_MT_ERRNO__)
1197 CXXFLAGS="$CXXFLAGS -Zmt"
1198 # autoconf's macro sets -Zexe and suffix both, which conflict:w
1199 LDFLAGS="$LDFLAGS -Zmt -Zcrtdll"
1200 ac_cv_exeext=.exe
1201 ;;
1202 esac
1203
1204 AC_EXEEXT
1205 AC_OBJEXT
1206
1207 PROG_EXT="$EXEEXT"
1208 AC_SUBST(PROG_EXT)
1209 test -n "$PROG_EXT" && AC_DEFINE_UNQUOTED(PROG_EXT,"$PROG_EXT",[Define to the program extension (normally blank)])
1210 ])dnl
1211 dnl ---------------------------------------------------------------------------
1212 dnl CF_PROG_GROFF version: 3 updated: 2018/01/07 13:16:19
1213 dnl -------------
1214 dnl Check if groff is available, for cases (such as html output) where nroff
1215 dnl is not enough.
1216 AC_DEFUN([CF_PROG_GROFF],[
1217 AC_PATH_PROG(GROFF_PATH,groff,no)
1218 AC_PATH_PROGS(NROFF_PATH,nroff mandoc,no)
1219 AC_PATH_PROG(TBL_PATH,tbl,cat)
1220 if test "x$GROFF_PATH" = xno
1221 then
1222 NROFF_NOTE=
1223 GROFF_NOTE="#"
1224 else
1225 NROFF_NOTE="#"
1226 GROFF_NOTE=
1227 fi
1228 AC_SUBST(GROFF_NOTE)
1229 AC_SUBST(NROFF_NOTE)
1230 ])dnl
1231 dnl ---------------------------------------------------------------------------
1232 dnl CF_PROG_LINT version: 4 updated: 2019/11/20 18:55:37
1233 dnl ------------
1234 AC_DEFUN([CF_PROG_LINT],
1235 [
1236 AC_CHECK_PROGS(LINT, lint cppcheck splint)
1237 case "x$LINT" in
1238 (xcppcheck|x*/cppcheck)
1239 test -z "$LINT_OPTS" && LINT_OPTS="--enable=all"
1240 ;;
1241 esac
1242 AC_SUBST(LINT_OPTS)
1243 ])dnl
1244 dnl ---------------------------------------------------------------------------
1245 dnl CF_REMOVE_DEFINE version: 3 updated: 2010/01/09 11:05:50
1246 dnl ----------------
1247 dnl Remove all -U and -D options that refer to the given symbol from a list
1248 dnl of C compiler options. This works around the problem that not all
1249 dnl compilers process -U and -D options from left-to-right, so a -U option
1250 dnl cannot be used to cancel the effect of a preceding -D option.
1251 dnl
1252 dnl $1 = target (which could be the same as the source variable)
1253 dnl $2 = source (including '$')
1254 dnl $3 = symbol to remove
1255 define([CF_REMOVE_DEFINE],
1256 [
1257 $1=`echo "$2" | \
1258 sed -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[[ ]]/ /g' \
1259 -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[$]//g'`
1260 ])dnl
1261 dnl ---------------------------------------------------------------------------
1262 dnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59
1263 dnl --------
1264 dnl Make an uppercase version of a variable
1265 dnl $1=uppercase($2)
1266 AC_DEFUN([CF_UPPER],
1267 [
1268 $1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
1269 ])dnl
1270 dnl ---------------------------------------------------------------------------
1271 dnl CF_VERBOSE version: 3 updated: 2007/07/29 09:55:12
1272 dnl ----------
1273 dnl Use AC_VERBOSE w/o the warnings
1274 AC_DEFUN([CF_VERBOSE],
1275 [test -n "$verbose" && echo " $1" 1>&AC_FD_MSG
1276 CF_MSG_LOG([$1])
1277 ])dnl
1278 dnl ---------------------------------------------------------------------------
1279 dnl CF_WITHOUT_X version: 2 updated: 2020/10/04 10:05:20
1280 dnl ------------
1281 dnl Use this to cancel the check for X headers/libraries which would be pulled
1282 dnl in via CF_GCC_WARNINGS.
1283 define([CF_WITHOUT_X],
1284 AC_DEFUN([AC_PATH_XTRA],[])
1285 AC_DEFUN([CF_SAVE_XTRA_FLAGS],[])
1286 AC_DEFUN([CF_RESTORE_XTRA_FLAGS],[])
1287 AC_DEFUN([CF_CONST_X_STRING],[echo "skipping X-const check";])dnl
1288 [])dnl
1289 dnl ---------------------------------------------------------------------------
1290 dnl CF_WITH_DBMALLOC version: 7 updated: 2010/06/21 17:26:47
1291 dnl ----------------
1292 dnl Configure-option for dbmalloc. The optional parameter is used to override
1293 dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests.
1294 AC_DEFUN([CF_WITH_DBMALLOC],[
1295 CF_NO_LEAKS_OPTION(dbmalloc,
1296 [ --with-dbmalloc test: use Conor Cahill's dbmalloc library],
1297 [USE_DBMALLOC])
1298
1299 if test "$with_dbmalloc" = yes ; then
1300 AC_CHECK_HEADER(dbmalloc.h,
1301 [AC_CHECK_LIB(dbmalloc,[debug_malloc]ifelse([$1],,[],[,$1]))])
1302 fi
1303 ])dnl
1304 dnl ---------------------------------------------------------------------------
1305 dnl CF_WITH_DMALLOC version: 7 updated: 2010/06/21 17:26:47
1306 dnl ---------------
1307 dnl Configure-option for dmalloc. The optional parameter is used to override
1308 dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests.
1309 AC_DEFUN([CF_WITH_DMALLOC],[
1310 CF_NO_LEAKS_OPTION(dmalloc,
1311 [ --with-dmalloc test: use Gray Watson's dmalloc library],
1312 [USE_DMALLOC])
1313
1314 if test "$with_dmalloc" = yes ; then
1315 AC_CHECK_HEADER(dmalloc.h,
1316 [AC_CHECK_LIB(dmalloc,[dmalloc_debug]ifelse([$1],,[],[,$1]))])
1317 fi
1318 ])dnl
1319 dnl ---------------------------------------------------------------------------
1320 dnl CF_WITH_MAN2HTML version: 12 updated: 2021/01/03 18:30:50
1321 dnl ----------------
1322 dnl Check for man2html and groff. Prefer man2html over groff, but use groff
1323 dnl as a fallback. See
1324 dnl
1325 dnl http://invisible-island.net/scripts/man2html.html
1326 dnl
1327 dnl Generate a shell script which hides the differences between the two.
1328 dnl
1329 dnl We name that "man2html.tmp".
1330 dnl
1331 dnl The shell script can be removed later, e.g., using "make distclean".
1332 AC_DEFUN([CF_WITH_MAN2HTML],[
1333 AC_REQUIRE([CF_PROG_GROFF])dnl
1334 AC_REQUIRE([AC_PROG_FGREP])dnl
1335
1336 case "x${with_man2html}" in
1337 (xno)
1338 cf_man2html=no
1339 ;;
1340 (x|xyes)
1341 AC_PATH_PROG(cf_man2html,man2html,no)
1342 case "x$cf_man2html" in
1343 (x/*)
1344 AC_MSG_CHECKING(for the modified Earl Hood script)
1345 if ( $cf_man2html -help 2>&1 | grep 'Make an index of headers at the end' >/dev/null )
1346 then
1347 cf_man2html_ok=yes
1348 else
1349 cf_man2html=no
1350 cf_man2html_ok=no
1351 fi
1352 AC_MSG_RESULT($cf_man2html_ok)
1353 ;;
1354 (*)
1355 cf_man2html=no
1356 ;;
1357 esac
1358 esac
1359
1360 AC_MSG_CHECKING(for program to convert manpage to html)
1361 AC_ARG_WITH(man2html,
1362 [ --with-man2html=XXX use XXX rather than groff],
1363 [cf_man2html=$withval],
1364 [cf_man2html=$cf_man2html])
1365
1366 cf_with_groff=no
1367
1368 case $cf_man2html in
1369 (yes)
1370 AC_MSG_RESULT(man2html)
1371 AC_PATH_PROG(cf_man2html,man2html,no)
1372 ;;
1373 (no|groff|*/groff*)
1374 cf_with_groff=yes
1375 cf_man2html=$GROFF_PATH
1376 AC_MSG_RESULT($cf_man2html)
1377 ;;
1378 (*)
1379 AC_MSG_RESULT($cf_man2html)
1380 ;;
1381 esac
1382
1383 MAN2HTML_TEMP="man2html.tmp"
1384 cat >$MAN2HTML_TEMP <<CF_EOF
1385 #!$SHELL
1386 # Temporary script generated by CF_WITH_MAN2HTML
1387 # Convert inputs to html, sending result to standard output.
1388 #
1389 # Parameters:
1390 # \${1} = rootname of file to convert
1391 # \${2} = suffix of file to convert, e.g., "1"
1392 # \${3} = macros to use, e.g., "man"
1393 #
1394 ROOT=\[$]1
1395 TYPE=\[$]2
1396 MACS=\[$]3
1397
1398 unset LANG
1399 unset LC_ALL
1400 unset LC_CTYPE
1401 unset LANGUAGE
1402 GROFF_NO_SGR=stupid
1403 export GROFF_NO_SGR
1404
1405 CF_EOF
1406
1407 NROFF_OPTS=
1408 if test "x$cf_with_groff" = xyes
1409 then
1410 MAN2HTML_NOTE="$GROFF_NOTE"
1411 MAN2HTML_PATH="$GROFF_PATH"
1412 cat >>$MAN2HTML_TEMP <<CF_EOF
1413 $SHELL -c "$TBL_PATH \${ROOT}.\${TYPE} | $GROFF_PATH -P -o0 -I\${ROOT}_ -Thtml -\${MACS}"
1414 CF_EOF
1415 else
1416 # disable hyphenation if this is groff
1417 if test "x$GROFF_PATH" != xno
1418 then
1419 AC_MSG_CHECKING(if nroff is really groff)
1420 cf_check_groff="`$NROFF_PATH --version 2>/dev/null | grep groff`"
1421 test -n "$cf_check_groff" && cf_check_groff=yes
1422 test -n "$cf_check_groff" || cf_check_groff=no
1423 AC_MSG_RESULT($cf_check_groff)
1424 test "x$cf_check_groff" = xyes && NROFF_OPTS="-rHY=0"
1425 fi
1426 MAN2HTML_NOTE=""
1427 CF_PATH_SYNTAX(cf_man2html)
1428 MAN2HTML_PATH="$cf_man2html"
1429 AC_MSG_CHECKING(for $cf_man2html top/bottom margins)
1430
1431 # for this example, expect 3 lines of content, the remainder is head/foot
1432 cat >conftest.in <<CF_EOF
1433 .TH HEAD1 HEAD2 HEAD3 HEAD4 HEAD5
1434 .SH SECTION
1435 MARKER
1436 CF_EOF
1437
1438 LC_ALL=C LC_CTYPE=C LANG=C LANGUAGE=C $NROFF_PATH -man conftest.in >conftest.out
1439
1440 cf_man2html_1st="`${FGREP-fgrep} -n MARKER conftest.out |sed -e 's/^[[^0-9]]*://' -e 's/:.*//'`"
1441 cf_man2html_top=`expr "$cf_man2html_1st" - 2`
1442 cf_man2html_bot="`wc -l conftest.out |sed -e 's/[[^0-9]]//g'`"
1443 cf_man2html_bot=`expr "$cf_man2html_bot" - 2 - "$cf_man2html_top"`
1444 cf_man2html_top_bot="-topm=$cf_man2html_top -botm=$cf_man2html_bot"
1445
1446 AC_MSG_RESULT($cf_man2html_top_bot)
1447
1448 AC_MSG_CHECKING(for pagesize to use)
1449 for cf_block in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
1450 do
1451 cat >>conftest.in <<CF_EOF
1452 .nf
1453 0
1454 1
1455 2
1456 3
1457 4
1458 5
1459 6
1460 7
1461 8
1462 9
1463 CF_EOF
1464 done
1465
1466 LC_ALL=C LC_CTYPE=C LANG=C LANGUAGE=C $NROFF_PATH -man conftest.in >conftest.out
1467 cf_man2html_page="`${FGREP-fgrep} -n HEAD1 conftest.out |sed -n '$p' |sed -e 's/^[[^0-9]]*://' -e 's/:.*//'`"
1468 test -z "$cf_man2html_page" && cf_man2html_page=99999
1469 test "$cf_man2html_page" -gt 100 && cf_man2html_page=99999
1470
1471 rm -rf conftest*
1472 AC_MSG_RESULT($cf_man2html_page)
1473
1474 cat >>$MAN2HTML_TEMP <<CF_EOF
1475 : \${MAN2HTML_PATH=$MAN2HTML_PATH}
1476 MAN2HTML_OPTS="\$MAN2HTML_OPTS -index -title=\"\$ROOT(\$TYPE)\" -compress -pgsize $cf_man2html_page"
1477 case \${TYPE} in
1478 (ms)
1479 $TBL_PATH \${ROOT}.\${TYPE} | $NROFF_PATH $NROFF_OPTS -\${MACS} | \$MAN2HTML_PATH -topm=0 -botm=0 \$MAN2HTML_OPTS
1480 ;;
1481 (*)
1482 $TBL_PATH \${ROOT}.\${TYPE} | $NROFF_PATH $NROFF_OPTS -\${MACS} | \$MAN2HTML_PATH $cf_man2html_top_bot \$MAN2HTML_OPTS
1483 ;;
1484 esac
1485 CF_EOF
1486 fi
1487
1488 chmod 700 $MAN2HTML_TEMP
1489
1490 AC_SUBST(MAN2HTML_NOTE)
1491 AC_SUBST(MAN2HTML_PATH)
1492 AC_SUBST(MAN2HTML_TEMP)
1493 ])dnl
1494 dnl ---------------------------------------------------------------------------
1495 dnl CF_WITH_VALGRIND version: 1 updated: 2006/12/14 18:00:21
1496 dnl ----------------
1497 AC_DEFUN([CF_WITH_VALGRIND],[
1498 CF_NO_LEAKS_OPTION(valgrind,
1499 [ --with-valgrind test: use valgrind],
1500 [USE_VALGRIND])
1501 ])dnl