-
Notifications
You must be signed in to change notification settings - Fork 103
/
aclocal.m4
10109 lines (9533 loc) · 288 KB
/
aclocal.m4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
dnl***************************************************************************
dnl Copyright 2018-2022,2023 Thomas E. Dickey *
dnl Copyright 1998-2017,2018 Free Software Foundation, Inc. *
dnl *
dnl Permission is hereby granted, free of charge, to any person obtaining a *
dnl copy of this software and associated documentation files (the *
dnl "Software"), to deal in the Software without restriction, including *
dnl without limitation the rights to use, copy, modify, merge, publish, *
dnl distribute, distribute with modifications, sublicense, and/or sell *
dnl copies of the Software, and to permit persons to whom the Software is *
dnl furnished to do so, subject to the following conditions: *
dnl *
dnl The above copyright notice and this permission notice shall be included *
dnl in all copies or substantial portions of the Software. *
dnl *
dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
dnl IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
dnl DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
dnl OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
dnl THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
dnl *
dnl Except as contained in this notice, the name(s) of the above copyright *
dnl holders shall not be used in advertising or otherwise to promote the *
dnl sale, use or other dealings in this Software without prior written *
dnl authorization. *
dnl***************************************************************************
dnl
dnl Author: Thomas E. Dickey 1995-on
dnl
dnl $Id: aclocal.m4,v 1.1037 2023/03/05 19:30:13 tom Exp $
dnl Macros used in NCURSES auto-configuration script.
dnl
dnl These macros are maintained separately from NCURSES. The copyright on
dnl this file applies to the aggregation of macros and does not affect use of
dnl these macros in other applications.
dnl
dnl See these pages for additional information:
dnl https://invisible-island.net/autoconf/
dnl https://invisible-island.net/autoconf/my-autoconf.html
dnl
dnl ---------------------------------------------------------------------------
dnl ---------------------------------------------------------------------------
dnl AM_LANGINFO_CODESET version: 7 updated: 2023/01/11 04:05:23
dnl -------------------
dnl Inserted as requested by gettext 0.10.40
dnl File from /usr/share/aclocal
dnl codeset.m4
dnl ====================
dnl serial AM1
dnl
dnl From Bruno Haible.
AC_DEFUN([AM_LANGINFO_CODESET],
[
AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
[AC_TRY_LINK([
$ac_includes_default
#include <langinfo.h>],
[char* cs = nl_langinfo(CODESET); (void)cs],
am_cv_langinfo_codeset=yes,
am_cv_langinfo_codeset=no)
])
if test "$am_cv_langinfo_codeset" = yes; then
AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
[Define if you have <langinfo.h> and nl_langinfo(CODESET).])
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_ABI_DEFAULTS version: 4 updated: 2023/01/07 16:32:06
dnl ---------------
dnl Provide configure-script defaults for different ncurses ABIs.
AC_DEFUN([CF_ABI_DEFAULTS],[
AC_REQUIRE([CF_NCURSES_WITH_ABI_VERSION])
# ABI 5 defaults:
cf_dft_ccharw_max=5
cf_dft_chtype=auto
cf_dft_ext_colors=no
cf_dft_ext_const=no
cf_dft_ext_mouse=no
cf_dft_ext_putwin=no
cf_dft_ext_spfuncs=no
cf_dft_filter_syms=no
cf_dft_interop=no
cf_dft_mmask_t=auto
cf_dft_opaque_curses=no
cf_dft_ordinate_type=short
cf_dft_signed_char=no
cf_dft_tparm_arg=long
cf_dft_with_lp64=no
# ABI 6 defaults:
case x$cf_cv_abi_default in
(x[[6789]])
cf_dft_chtype=uint32_t
cf_dft_ext_colors=yes
cf_dft_ext_const=yes
cf_dft_ext_mouse=yes
cf_dft_ext_putwin=yes
cf_dft_ext_spfuncs=yes
cf_dft_filter_syms=yes
cf_dft_interop=yes
cf_dft_mmask_t=uint32_t
cf_dft_tparm_arg=intptr_t
cf_dft_with_lp64=yes
;;
esac
# ABI 7 defaults:
case x$cf_cv_abi_default in
(x[[789]])
cf_dft_ccharw_max=6
cf_dft_mmask_t=uint64_t
cf_dft_opaque_curses=yes
cf_dft_ordinate_type=int
cf_dft_signed_char=yes
# also: remove the wgetch-events feature in ABI 7
;;
esac
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_ACVERSION_CHECK version: 5 updated: 2014/06/04 19:11:49
dnl ------------------
dnl Conditionally generate script according to whether we're using a given autoconf.
dnl
dnl $1 = version to compare against
dnl $2 = code to use if AC_ACVERSION is at least as high as $1.
dnl $3 = code to use if AC_ACVERSION is older than $1.
define([CF_ACVERSION_CHECK],
[
ifdef([AC_ACVERSION], ,[ifdef([AC_AUTOCONF_VERSION],[m4_copy([AC_AUTOCONF_VERSION],[AC_ACVERSION])],[m4_copy([m4_PACKAGE_VERSION],[AC_ACVERSION])])])dnl
ifdef([m4_version_compare],
[m4_if(m4_version_compare(m4_defn([AC_ACVERSION]), [$1]), -1, [$3], [$2])],
[CF_ACVERSION_COMPARE(
AC_PREREQ_CANON(AC_PREREQ_SPLIT([$1])),
AC_PREREQ_CANON(AC_PREREQ_SPLIT(AC_ACVERSION)), AC_ACVERSION, [$2], [$3])])])dnl
dnl ---------------------------------------------------------------------------
dnl CF_ACVERSION_COMPARE version: 3 updated: 2012/10/03 18:39:53
dnl --------------------
dnl CF_ACVERSION_COMPARE(MAJOR1, MINOR1, TERNARY1,
dnl MAJOR2, MINOR2, TERNARY2,
dnl PRINTABLE2, not FOUND, FOUND)
define([CF_ACVERSION_COMPARE],
[ifelse(builtin([eval], [$2 < $5]), 1,
[ifelse([$8], , ,[$8])],
[ifelse([$9], , ,[$9])])])dnl
dnl ---------------------------------------------------------------------------
dnl CF_ADA_INCLUDE_DIRS version: 8 updated: 2013/10/14 04:24:07
dnl -------------------
dnl Construct the list of include-options for the C programs in the Ada95
dnl binding.
AC_DEFUN([CF_ADA_INCLUDE_DIRS],
[
ACPPFLAGS="-I. -I../include -I../../include $ACPPFLAGS"
if test "$srcdir" != "."; then
ACPPFLAGS="-I\${srcdir}/../../include $ACPPFLAGS"
fi
if test "$GCC" != yes; then
ACPPFLAGS="$ACPPFLAGS -I\${includedir}"
elif test "$includedir" != "/usr/include"; then
if test "$includedir" = '${prefix}/include' ; then
if test x$prefix != x/usr ; then
ACPPFLAGS="$ACPPFLAGS -I\${includedir}"
fi
else
ACPPFLAGS="$ACPPFLAGS -I\${includedir}"
fi
fi
AC_SUBST(ACPPFLAGS)
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_ADD_ADAFLAGS version: 1 updated: 2010/06/19 15:22:18
dnl ---------------
dnl Add to $ADAFLAGS, which is substituted into makefile and scripts.
AC_DEFUN([CF_ADD_ADAFLAGS],[
ADAFLAGS="$ADAFLAGS $1"
AC_SUBST(ADAFLAGS)
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_ADD_CFLAGS version: 15 updated: 2020/12/31 10:54:15
dnl -------------
dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS
dnl $1 = flags to add
dnl $2 = if given makes this macro verbose.
dnl
dnl Put any preprocessor definitions that use quoted strings in $EXTRA_CPPFLAGS,
dnl to simplify use of $CPPFLAGS in compiler checks, etc., that are easily
dnl confused by the quotes (which require backslashes to keep them usable).
AC_DEFUN([CF_ADD_CFLAGS],
[
cf_fix_cppflags=no
cf_new_cflags=
cf_new_cppflags=
cf_new_extra_cppflags=
for cf_add_cflags in $1
do
case "$cf_fix_cppflags" in
(no)
case "$cf_add_cflags" in
(-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C)
case "$cf_add_cflags" in
(-D*)
cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^-D[[^=]]*='\''\"[[^"]]*//'`
test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \
&& test -z "${cf_tst_cflags}" \
&& cf_fix_cppflags=yes
if test "$cf_fix_cppflags" = yes ; then
CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags)
continue
elif test "${cf_tst_cflags}" = "\"'" ; then
CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags)
continue
fi
;;
esac
case "$CPPFLAGS" in
(*$cf_add_cflags)
;;
(*)
case "$cf_add_cflags" in
(-D*)
cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'`
CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,$cf_tst_cppflags)
;;
esac
CF_APPEND_TEXT(cf_new_cppflags,$cf_add_cflags)
;;
esac
;;
(*)
CF_APPEND_TEXT(cf_new_cflags,$cf_add_cflags)
;;
esac
;;
(yes)
CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags)
cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^[[^"]]*"'\''//'`
test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \
&& test -z "${cf_tst_cflags}" \
&& cf_fix_cppflags=no
;;
esac
done
if test -n "$cf_new_cflags" ; then
ifelse([$2],,,[CF_VERBOSE(add to \$CFLAGS $cf_new_cflags)])
CF_APPEND_TEXT(CFLAGS,$cf_new_cflags)
fi
if test -n "$cf_new_cppflags" ; then
ifelse([$2],,,[CF_VERBOSE(add to \$CPPFLAGS $cf_new_cppflags)])
CF_APPEND_TEXT(CPPFLAGS,$cf_new_cppflags)
fi
if test -n "$cf_new_extra_cppflags" ; then
ifelse([$2],,,[CF_VERBOSE(add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags)])
CF_APPEND_TEXT(EXTRA_CPPFLAGS,$cf_new_extra_cppflags)
fi
AC_SUBST(EXTRA_CPPFLAGS)
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_ADD_CXXFLAGS version: 1 updated: 2020/04/04 16:16:13
dnl ---------------
dnl Copy non-preprocessor flags to $CXXFLAGS, preprocessor flags to $CPPFLAGS
dnl The second parameter if given makes this macro verbose.
dnl
dnl Put any preprocessor definitions that use quoted strings in $EXTRA_CPPFLAGS,
dnl to simplify use of $CPPFLAGS in compiler checks, etc., that are easily
dnl confused by the quotes (which require backslashes to keep them usable).
AC_DEFUN([CF_ADD_CXXFLAGS],
[
cf_save_CXXFLAGS="$CFLAGS"
CFLAGS="$CXXFLAGS"
CF_ADD_CFLAGS($1 ifelse($2,,,[,$2]))
CXXFLAGS="$CFLAGS"
CFLAGS="$cf_save_CXXFLAGS"
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_ADD_INCDIR version: 17 updated: 2021/09/04 06:35:04
dnl -------------
dnl Add an include-directory to $CPPFLAGS. Don't add /usr/include, since it is
dnl redundant. We don't normally need to add -I/usr/local/include for gcc,
dnl but old versions (and some misinstalled ones) need that. To make things
dnl worse, gcc 3.x may give error messages if -I/usr/local/include is added to
dnl the include-path).
AC_DEFUN([CF_ADD_INCDIR],
[
if test -n "$1" ; then
for cf_add_incdir in $1
do
while test "$cf_add_incdir" != /usr/include
do
if test -d "$cf_add_incdir"
then
cf_have_incdir=no
if test -n "$CFLAGS$CPPFLAGS" ; then
# a loop is needed to ensure we can add subdirs of existing dirs
for cf_test_incdir in $CFLAGS $CPPFLAGS ; do
if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then
cf_have_incdir=yes; break
fi
done
fi
if test "$cf_have_incdir" = no ; then
if test "$cf_add_incdir" = /usr/local/include ; then
if test "$GCC" = yes
then
cf_save_CPPFLAGS=$CPPFLAGS
CF_APPEND_TEXT(CPPFLAGS,-I$cf_add_incdir)
AC_TRY_COMPILE([#include <stdio.h>],
[printf("Hello")],
[],
[cf_have_incdir=yes])
CPPFLAGS=$cf_save_CPPFLAGS
fi
fi
fi
if test "$cf_have_incdir" = no ; then
CF_VERBOSE(adding $cf_add_incdir to include-path)
ifelse([$2],,CPPFLAGS,[$2])="$ifelse([$2],,CPPFLAGS,[$2]) -I$cf_add_incdir"
cf_top_incdir=`echo "$cf_add_incdir" | sed -e 's%/include/.*$%/include%'`
test "$cf_top_incdir" = "$cf_add_incdir" && break
cf_add_incdir="$cf_top_incdir"
else
break
fi
else
break
fi
done
done
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_ADD_LIB version: 2 updated: 2010/06/02 05:03:05
dnl ----------
dnl Add a library, used to enforce consistency.
dnl
dnl $1 = library to add, without the "-l"
dnl $2 = variable to update (default $LIBS)
AC_DEFUN([CF_ADD_LIB],[CF_ADD_LIBS(-l$1,ifelse($2,,LIBS,[$2]))])dnl
dnl ---------------------------------------------------------------------------
dnl CF_ADD_LIBDIR version: 11 updated: 2020/12/31 20:19:42
dnl -------------
dnl Adds to the library-path
dnl
dnl Some machines have trouble with multiple -L options.
dnl
dnl $1 is the (list of) directory(s) to add
dnl $2 is the optional name of the variable to update (default LDFLAGS)
dnl
AC_DEFUN([CF_ADD_LIBDIR],
[
if test -n "$1" ; then
for cf_add_libdir in $1
do
if test "$cf_add_libdir" = /usr/lib ; then
:
elif test -d "$cf_add_libdir"
then
cf_have_libdir=no
if test -n "$LDFLAGS$LIBS" ; then
# a loop is needed to ensure we can add subdirs of existing dirs
for cf_test_libdir in $LDFLAGS $LIBS ; do
if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then
cf_have_libdir=yes; break
fi
done
fi
if test "$cf_have_libdir" = no ; then
CF_VERBOSE(adding $cf_add_libdir to library-path)
ifelse([$2],,LDFLAGS,[$2])="-L$cf_add_libdir $ifelse([$2],,LDFLAGS,[$2])"
fi
fi
done
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_ADD_LIBS version: 3 updated: 2019/11/02 16:47:33
dnl -----------
dnl Add one or more libraries, used to enforce consistency. Libraries are
dnl prepended to an existing list, since their dependencies are assumed to
dnl already exist in the list.
dnl
dnl $1 = libraries to add, with the "-l", etc.
dnl $2 = variable to update (default $LIBS)
AC_DEFUN([CF_ADD_LIBS],[
cf_add_libs="[$]ifelse($2,,LIBS,[$2])"
# reverse order
cf_add_0lib=
for cf_add_1lib in $1; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done
# filter duplicates
for cf_add_1lib in $cf_add_0lib; do
for cf_add_2lib in $cf_add_libs; do
if test "x$cf_add_1lib" = "x$cf_add_2lib"; then
cf_add_1lib=
break
fi
done
test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs"
done
ifelse($2,,LIBS,[$2])="$cf_add_libs"
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_ADD_SUBDIR_PATH version: 5 updated: 2020/12/31 20:19:42
dnl ------------------
dnl Append to a search-list for a nonstandard header/lib-file
dnl $1 = the variable to return as result
dnl $2 = the package name
dnl $3 = the subdirectory, e.g., bin, include or lib
dnl $4 = the directory under which we will test for subdirectories
dnl $5 = a directory that we do not want $4 to match
AC_DEFUN([CF_ADD_SUBDIR_PATH],
[
test "x$4" != "x$5" && \
test -d "$4" && \
ifelse([$5],NONE,,[{ test -z "$5" || test "x$5" = xNONE || test "x$4" != "x$5"; } &&]) {
test -n "$verbose" && echo " ... testing for $3-directories under $4"
test -d "$4/$3" && $1="[$]$1 $4/$3"
test -d "$4/$3/$2" && $1="[$]$1 $4/$3/$2"
test -d "$4/$3/$2/$3" && $1="[$]$1 $4/$3/$2/$3"
test -d "$4/$2/$3" && $1="[$]$1 $4/$2/$3"
test -d "$4/$2/$3/$2" && $1="[$]$1 $4/$2/$3/$2"
}
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_APPEND_CFLAGS version: 3 updated: 2021/09/05 17:25:40
dnl ----------------
dnl Use CF_ADD_CFLAGS after first checking for potential redefinitions.
dnl $1 = flags to add
dnl $2 = if given makes this macro verbose.
define([CF_APPEND_CFLAGS],
[
for cf_add_cflags in $1
do
case "x$cf_add_cflags" in
(x-[[DU]]*)
CF_REMOVE_CFLAGS($cf_add_cflags,CFLAGS,[$2])
CF_REMOVE_CFLAGS($cf_add_cflags,CPPFLAGS,[$2])
;;
esac
CF_ADD_CFLAGS([$cf_add_cflags],[$2])
done
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_APPEND_TEXT version: 1 updated: 2017/02/25 18:58:55
dnl --------------
dnl use this macro for appending text without introducing an extra blank at
dnl the beginning
define([CF_APPEND_TEXT],
[
test -n "[$]$1" && $1="[$]$1 "
$1="[$]{$1}$2"
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_ARG_DISABLE version: 3 updated: 1999/03/30 17:24:31
dnl --------------
dnl Allow user to disable a normally-on option.
AC_DEFUN([CF_ARG_DISABLE],
[CF_ARG_OPTION($1,[$2],[$3],[$4],yes)])dnl
dnl ---------------------------------------------------------------------------
dnl CF_ARG_ENABLE version: 3 updated: 1999/03/30 17:24:31
dnl -------------
dnl Allow user to enable a normally-off option.
AC_DEFUN([CF_ARG_ENABLE],
[CF_ARG_OPTION($1,[$2],[$3],[$4],no)])dnl
dnl ---------------------------------------------------------------------------
dnl CF_ARG_OPTION version: 5 updated: 2015/05/10 19:52:14
dnl -------------
dnl Restricted form of AC_ARG_ENABLE that ensures user doesn't give bogus
dnl values.
dnl
dnl Parameters:
dnl $1 = option name
dnl $2 = help-string
dnl $3 = action to perform if option is not default
dnl $4 = action if perform if option is default
dnl $5 = default option value (either 'yes' or 'no')
AC_DEFUN([CF_ARG_OPTION],
[AC_ARG_ENABLE([$1],[$2],[test "$enableval" != ifelse([$5],no,yes,no) && enableval=ifelse([$5],no,no,yes)
if test "$enableval" != "$5" ; then
ifelse([$3],,[ :]dnl
,[ $3]) ifelse([$4],,,[
else
$4])
fi],[enableval=$5 ifelse([$4],,,[
$4
])dnl
])])dnl
dnl ---------------------------------------------------------------------------
dnl CF_AR_FLAGS version: 9 updated: 2021/01/01 13:31:04
dnl -----------
dnl Check for suitable "ar" (archiver) options for updating an archive.
dnl
dnl In particular, handle some obsolete cases where the "-" might be omitted,
dnl as well as a workaround for breakage of make's archive rules by the GNU
dnl binutils "ar" program.
AC_DEFUN([CF_AR_FLAGS],[
AC_REQUIRE([CF_PROG_AR])
AC_CACHE_CHECK(for options to update archives, cf_cv_ar_flags,[
case "$cf_cv_system_name" in
(*-msvc*)
cf_cv_ar_flags=''
cat >mk_static_lib.sh <<-EOF
#!$SHELL
MSVC_BIN="[$]AR"
out="\[$]1"
shift
exec \[$]MSVC_BIN -out:"\[$]out" \[$]@
EOF
chmod +x mk_static_lib.sh
AR=`pwd`/mk_static_lib.sh
;;
(*)
cf_cv_ar_flags=unknown
for cf_ar_flags in -curvU -curv curv -crv crv -cqv cqv -rv rv
do
# check if $ARFLAGS already contains this choice
if test "x$ARFLAGS" != "x" ; then
cf_check_ar_flags=`echo "x$ARFLAGS" | sed -e "s/$cf_ar_flags\$//" -e "s/$cf_ar_flags / /"`
if test "x$ARFLAGS" != "$cf_check_ar_flags" ; then
cf_cv_ar_flags=
break
fi
fi
rm -f "conftest.$ac_cv_objext"
rm -f conftest.a
cat >"conftest.$ac_ext" <<EOF
#line __oline__ "configure"
int testdata[[3]] = { 123, 456, 789 };
EOF
if AC_TRY_EVAL(ac_compile) ; then
echo "$AR $ARFLAGS $cf_ar_flags conftest.a conftest.$ac_cv_objext" >&AC_FD_CC
$AR $ARFLAGS "$cf_ar_flags" conftest.a "conftest.$ac_cv_objext" 2>&AC_FD_CC 1>/dev/null
if test -f conftest.a ; then
cf_cv_ar_flags="$cf_ar_flags"
break
fi
else
CF_VERBOSE(cannot compile test-program)
break
fi
done
rm -f conftest.a "conftest.$ac_ext" "conftest.$ac_cv_objext"
;;
esac
])
if test -n "$ARFLAGS" ; then
if test -n "$cf_cv_ar_flags" ; then
ARFLAGS="$ARFLAGS $cf_cv_ar_flags"
fi
else
ARFLAGS=$cf_cv_ar_flags
fi
AC_SUBST(ARFLAGS)
])
dnl ---------------------------------------------------------------------------
dnl CF_AWK_BIG_PRINTF version: 5 updated: 2015/04/17 21:13:04
dnl -----------------
dnl Check if awk can handle big strings using printf. Some older versions of
dnl awk choke on large strings passed via "%s".
dnl
dnl $1 = desired string size
dnl $2 = variable to set with result
AC_DEFUN([CF_AWK_BIG_PRINTF],
[
case x$AWK in
(x)
eval $2=no
;;
(*)
if ( ${AWK} 'BEGIN { xx = "x"; while (length(xx) < $1) { xx = xx "x"; }; printf("%s\n", xx); }' 2>/dev/null \
| $AWK '{ printf "%d\n", length([$]0); }' 2>/dev/null | $AWK 'BEGIN { eqls=0; recs=0; } { recs++; if ([$]0 == 12000) eqls++; } END { if (recs != 1 || eqls != 1) exit 1; }' 2>/dev/null >/dev/null ) ; then
eval $2=yes
else
eval $2=no
fi
;;
esac
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_BOOL_DECL version: 8 updated: 2004/01/30 15:51:18
dnl ------------
dnl Test if 'bool' is a builtin type in the configured C++ compiler. Some
dnl older compilers (e.g., gcc 2.5.8) don't support 'bool' directly; gcc
dnl 2.6.3 does, in anticipation of the ANSI C++ standard.
dnl
dnl Treat the configuration-variable specially here, since we're directly
dnl substituting its value (i.e., 1/0).
dnl
dnl $1 is the shell variable to store the result in, if not $cv_cv_builtin_bool
AC_DEFUN([CF_BOOL_DECL],
[
AC_MSG_CHECKING(if we should include stdbool.h)
AC_CACHE_VAL(cf_cv_header_stdbool_h,[
AC_TRY_COMPILE([],[bool foo = false],
[cf_cv_header_stdbool_h=0],
[AC_TRY_COMPILE([
#ifndef __BEOS__
#include <stdbool.h>
#endif
],[bool foo = false],
[cf_cv_header_stdbool_h=1],
[cf_cv_header_stdbool_h=0])])])
if test "$cf_cv_header_stdbool_h" = 1
then AC_MSG_RESULT(yes)
else AC_MSG_RESULT(no)
fi
AC_MSG_CHECKING([for builtin bool type])
AC_CACHE_VAL(ifelse($1,,cf_cv_builtin_bool,[$1]),[
AC_TRY_COMPILE([
#include <stdio.h>
#include <sys/types.h>
],[bool x = false],
[ifelse($1,,cf_cv_builtin_bool,[$1])=1],
[ifelse($1,,cf_cv_builtin_bool,[$1])=0])
])
if test "$ifelse($1,,cf_cv_builtin_bool,[$1])" = 1
then AC_MSG_RESULT(yes)
else AC_MSG_RESULT(no)
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_BOOL_SIZE version: 20 updated: 2023/02/18 17:41:25
dnl ------------
dnl Test for the size of 'bool' in the configured C++ compiler (e.g., a type).
dnl Don't bother looking for bool.h, since it has been deprecated.
dnl
dnl If the current compiler is C rather than C++, we get the bool definition
dnl from <stdbool.h>.
AC_DEFUN([CF_BOOL_SIZE],
[
AC_CHECK_SIZEOF(bool,,[
$ac_includes_default
#if defined(__cplusplus)
#ifdef HAVE_GXX_BUILTIN_H
#include <g++/builtin.h>
#elif HAVE_GPP_BUILTIN_H
#include <gpp/builtin.h>
#elif HAVE_BUILTIN_H
#include <builtin.h>
#endif
#else
#if $cf_cv_header_stdbool_h
#include <stdbool.h>
#endif
#endif
])
AC_CACHE_CHECK(for type of bool, cf_cv_type_of_bool,[
rm -f cf_test.out
AC_TRY_RUN([
$ac_includes_default
#if defined(__cplusplus)
#ifdef HAVE_GXX_BUILTIN_H
#include <g++/builtin.h>
#elif HAVE_GPP_BUILTIN_H
#include <gpp/builtin.h>
#elif HAVE_BUILTIN_H
#include <builtin.h>
#endif
#else
#if $cf_cv_header_stdbool_h
#include <stdbool.h>
#endif
#endif
int main(void)
{
FILE *fp = fopen("cf_test.out", "w");
if (fp != 0) {
bool x = true;
if ((bool)(-x) >= 0)
fputs("unsigned ", fp);
if (sizeof(x) == sizeof(int)) fputs("int", fp);
else if (sizeof(x) == sizeof(char)) fputs("char", fp);
else if (sizeof(x) == sizeof(short))fputs("short",fp);
else if (sizeof(x) == sizeof(long)) fputs("long", fp);
fclose(fp);
}
${cf_cv_main_return:-return}(0);
}
],
[cf_cv_type_of_bool=`cat cf_test.out`
if test -z "$cf_cv_type_of_bool"; then
cf_cv_type_of_bool=unknown
fi],
[cf_cv_type_of_bool=unknown],
[
case x$ac_cv_sizeof_bool in
(x1) cf_cv_type_of_bool="unsigned char";;
(x2) cf_cv_type_of_bool="unsigned short";;
(x4) cf_cv_type_of_bool="unsigned int";;
(x8) cf_cv_type_of_bool="unsigned long";;
(*) cf_cv_type_of_bool=unknown;;
esac
])
rm -f cf_test.out
])
if test "$cf_cv_type_of_bool" = unknown ; then
case .$NCURSES_BOOL in
(.auto|.) NCURSES_BOOL=unsigned;;
esac
AC_MSG_WARN(Assuming $NCURSES_BOOL for type of bool)
cf_cv_type_of_bool=$NCURSES_BOOL
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_BUILD_CC version: 11 updated: 2022/12/04 15:40:08
dnl -----------
dnl If we're cross-compiling, allow the user to override the tools and their
dnl options. The configure script is oriented toward identifying the host
dnl compiler, etc., but we need a build compiler to generate parts of the
dnl source.
dnl
dnl $1 = default for $CPPFLAGS
dnl $2 = default for $LIBS
AC_DEFUN([CF_BUILD_CC],[
CF_ACVERSION_CHECK(2.52,,
[AC_REQUIRE([CF_PROG_EXT])])
if test "$cross_compiling" = yes ; then
# defaults that we might want to override
: ${BUILD_CFLAGS:=''}
: ${BUILD_CPPFLAGS:='ifelse([$1],,,[$1])'}
: ${BUILD_LDFLAGS:=''}
: ${BUILD_LIBS:='ifelse([$2],,,[$2])'}
: ${BUILD_EXEEXT:='$x'}
: ${BUILD_OBJEXT:='o'}
AC_ARG_WITH(build-cc,
[ --with-build-cc=XXX the build C compiler ($BUILD_CC)],
[BUILD_CC="$withval"],
[AC_CHECK_PROGS(BUILD_CC, [gcc clang c99 c89 cc cl],none)])
AC_MSG_CHECKING(for native build C compiler)
AC_MSG_RESULT($BUILD_CC)
AC_MSG_CHECKING(for native build C preprocessor)
AC_ARG_WITH(build-cpp,
[ --with-build-cpp=XXX the build C preprocessor ($BUILD_CPP)],
[BUILD_CPP="$withval"],
[BUILD_CPP='${BUILD_CC} -E'])
AC_MSG_RESULT($BUILD_CPP)
AC_MSG_CHECKING(for native build C flags)
AC_ARG_WITH(build-cflags,
[ --with-build-cflags=XXX the build C compiler-flags ($BUILD_CFLAGS)],
[BUILD_CFLAGS="$withval"])
AC_MSG_RESULT($BUILD_CFLAGS)
AC_MSG_CHECKING(for native build C preprocessor-flags)
AC_ARG_WITH(build-cppflags,
[ --with-build-cppflags=XXX the build C preprocessor-flags ($BUILD_CPPFLAGS)],
[BUILD_CPPFLAGS="$withval"])
AC_MSG_RESULT($BUILD_CPPFLAGS)
AC_MSG_CHECKING(for native build linker-flags)
AC_ARG_WITH(build-ldflags,
[ --with-build-ldflags=XXX the build linker-flags ($BUILD_LDFLAGS)],
[BUILD_LDFLAGS="$withval"])
AC_MSG_RESULT($BUILD_LDFLAGS)
AC_MSG_CHECKING(for native build linker-libraries)
AC_ARG_WITH(build-libs,
[ --with-build-libs=XXX the build libraries (${BUILD_LIBS})],
[BUILD_LIBS="$withval"])
AC_MSG_RESULT($BUILD_LIBS)
# this assumes we're on Unix.
BUILD_EXEEXT=
BUILD_OBJEXT=o
: ${BUILD_CC:='${CC}'}
AC_MSG_CHECKING(if the build-compiler "$BUILD_CC" works)
cf_save_crossed=$cross_compiling
cf_save_ac_link=$ac_link
cross_compiling=no
cf_build_cppflags=$BUILD_CPPFLAGS
test "$cf_build_cppflags" = "#" && cf_build_cppflags=
ac_link='$BUILD_CC -o "conftest$ac_exeext" $BUILD_CFLAGS $cf_build_cppflags $BUILD_LDFLAGS "conftest.$ac_ext" $BUILD_LIBS >&AS_MESSAGE_LOG_FD'
AC_TRY_RUN([#include <stdio.h>
int main(int argc, char *argv[])
{
${cf_cv_main_return:-return}(argc < 0 || argv == 0 || argv[0] == 0);
}
],
cf_ok_build_cc=yes,
cf_ok_build_cc=no,
cf_ok_build_cc=unknown)
cross_compiling=$cf_save_crossed
ac_link=$cf_save_ac_link
AC_MSG_RESULT($cf_ok_build_cc)
if test "$cf_ok_build_cc" != yes
then
AC_MSG_ERROR([Cross-build requires two compilers.
Use --with-build-cc to specify the native compiler.])
fi
else
: ${BUILD_CC:='${CC}'}
: ${BUILD_CPP:='${CPP}'}
: ${BUILD_CFLAGS:='${CFLAGS}'}
: ${BUILD_CPPFLAGS:='${CPPFLAGS}'}
: ${BUILD_LDFLAGS:='${LDFLAGS}'}
: ${BUILD_LIBS:='${LIBS}'}
: ${BUILD_EXEEXT:='$x'}
: ${BUILD_OBJEXT:='o'}
fi
AC_SUBST(BUILD_CC)
AC_SUBST(BUILD_CPP)
AC_SUBST(BUILD_CFLAGS)
AC_SUBST(BUILD_CPPFLAGS)
AC_SUBST(BUILD_LDFLAGS)
AC_SUBST(BUILD_LIBS)
AC_SUBST(BUILD_EXEEXT)
AC_SUBST(BUILD_OBJEXT)
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_C11_NORETURN version: 4 updated: 2023/02/18 17:41:25
dnl ---------------
AC_DEFUN([CF_C11_NORETURN],
[
AC_MSG_CHECKING(if you want to use C11 _Noreturn feature)
CF_ARG_ENABLE(stdnoreturn,
[ --enable-stdnoreturn enable C11 _Noreturn feature for diagnostics],
[enable_stdnoreturn=yes],
[enable_stdnoreturn=no])
AC_MSG_RESULT($enable_stdnoreturn)
if test $enable_stdnoreturn = yes; then
AC_CACHE_CHECK([for C11 _Noreturn feature], cf_cv_c11_noreturn,
[AC_TRY_COMPILE([
$ac_includes_default
#include <stdnoreturn.h>
static _Noreturn void giveup(void) { exit(0); }
],
[if (feof(stdin)) giveup()],
cf_cv_c11_noreturn=yes,
cf_cv_c11_noreturn=no)
])
else
cf_cv_c11_noreturn=no,
fi
if test "$cf_cv_c11_noreturn" = yes; then
AC_DEFINE(HAVE_STDNORETURN_H, 1,[Define if <stdnoreturn.h> header is available and working])
AC_DEFINE_UNQUOTED(STDC_NORETURN,_Noreturn,[Define if C11 _Noreturn keyword is supported])
HAVE_STDNORETURN_H=1
else
HAVE_STDNORETURN_H=0
fi
AC_SUBST(HAVE_STDNORETURN_H)
AC_SUBST(STDC_NORETURN)
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_CC_ENV_FLAGS version: 11 updated: 2023/02/20 11:15:46
dnl ---------------
dnl Check for user's environment-breakage by stuffing CFLAGS/CPPFLAGS content
dnl into CC. This will not help with broken scripts that wrap the compiler
dnl with options, but eliminates a more common category of user confusion.
dnl
dnl In particular, it addresses the problem of being able to run the C
dnl preprocessor in a consistent manner.
dnl
dnl Caveat: this also disallows blanks in the pathname for the compiler, but
dnl the nuisance of having inconsistent settings for compiler and preprocessor
dnl outweighs that limitation.
AC_DEFUN([CF_CC_ENV_FLAGS],
[
# This should have been defined by AC_PROG_CC
: "${CC:=cc}"
AC_MSG_CHECKING(\$CFLAGS variable)
case "x$CFLAGS" in
(*-[[IUD]]*)
AC_MSG_RESULT(broken)
AC_MSG_WARN(your environment uses the CFLAGS variable to hold CPPFLAGS options)
cf_flags="$CFLAGS"
CFLAGS=
for cf_arg in $cf_flags
do
CF_ADD_CFLAGS($cf_arg)
done
;;
(*)
AC_MSG_RESULT(ok)
;;
esac
AC_MSG_CHECKING(\$CC variable)
case "$CC" in
(*[[\ \ ]]-*)
AC_MSG_RESULT(broken)
AC_MSG_WARN(your environment uses the CC variable to hold CFLAGS/CPPFLAGS options)
# humor him...
cf_prog=`echo "$CC" | sed -e 's/ / /g' -e 's/[[ ]]* / /g' -e 's/[[ ]]*[[ ]]-[[^ ]].*//'`
cf_flags=`echo "$CC" | sed -e "s%^$cf_prog%%"`
CC="$cf_prog"
for cf_arg in $cf_flags
do
case "x$cf_arg" in
(x-[[IUDfgOW]]*)
CF_ADD_CFLAGS($cf_arg)
;;
(*)
CC="$CC $cf_arg"
;;
esac
done
CF_VERBOSE(resulting CC: '$CC')
CF_VERBOSE(resulting CFLAGS: '$CFLAGS')
CF_VERBOSE(resulting CPPFLAGS: '$CPPFLAGS')
;;
(*)
AC_MSG_RESULT(ok)
;;
esac
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_CFG_DEFAULTS version: 16 updated: 2021/01/04 19:33:05
dnl ---------------
dnl Determine the default configuration into which we'll install ncurses. This
dnl can be overridden by the user's command-line options. There's two items to
dnl look for:
dnl 1. the prefix (e.g., /usr)
dnl 2. the header files (e.g., /usr/include/ncurses)
dnl We'll look for a previous installation of ncurses and use the same defaults.
dnl
dnl We don't use AC_PREFIX_DEFAULT, because it gets evaluated too soon, and
dnl we don't use AC_PREFIX_PROGRAM, because we cannot distinguish ncurses's
dnl programs from a vendor's.
AC_DEFUN([CF_CFG_DEFAULTS],
[AC_REQUIRE([AC_PROG_FGREP])dnl
AC_MSG_CHECKING(for prefix)
if test "x$prefix" = "xNONE" ; then
case "$cf_cv_system_name" in
# non-vendor systems don't have a conflict
(openbsd*|freebsd*|mirbsd*|linux*|cygwin*|msys*|k*bsd*-gnu|mingw*)
prefix=/usr
;;
(*) prefix=$ac_default_prefix
;;
esac
fi
AC_MSG_RESULT($prefix)
if test "x$prefix" = "xNONE" ; then
AC_MSG_CHECKING(for default include-directory)
test -n "$verbose" && echo 1>&AC_FD_MSG
for cf_symbol in \
"$includedir" \
"$includedir/ncurses" \
"$prefix/include" \
"$prefix/include/ncurses" \
/usr/local/include \
/usr/local/include/ncurses \
/usr/include \
/usr/include/ncurses