-
-
Notifications
You must be signed in to change notification settings - Fork 66
/
configure.ac
1135 lines (1027 loc) · 38 KB
/
configure.ac
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
# configure.ac - Process with autoconf to produce a configure script
#
# 2012, Jonathan Toppins <[email protected]>
# 2017-2024 Reini Urban <[email protected]>
#
# Copyright (c) 2012, 2013 Cisco Systems
# Copyright (c) 2017-2024 Reini Urban
# All rights reserved.
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use,
# copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following
# conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#
# -*- Autoconf -*-
# Autoconf requirements
AC_PREREQ([2.69])
# information on the package
AC_INIT([Safe C Library],
[m4_esyscmd(build-aux/version-gen.sh .tarball-version)],
[https://github.com/rurban/safeclib/issues],
[safeclib],
[http://github.com/rurban/safeclib/])
# Configure the configure script
# ===============================================
# unique source file --- primitive safety check
AC_CONFIG_SRCDIR([src/abort_handler_s.c])
# extra autoconf macros are kept here
AC_CONFIG_MACRO_DIR([m4])
# place to put some extra build scripts
AC_CONFIG_AUX_DIR([build-aux])
# Other tool initializations
# ===============================================
# really severe build strictness also place generated object files (.o)
# into the same directory as their source files, in order to avoid
# collisions when non-recursive make is used.
AM_INIT_AUTOMAKE([1.10 no-define foreign subdir-objects dist-bzip2 dist-xz])
# Check if automake supports 'pretty' builds, if so enable them by default
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
# this is missing with mingw 1.0
# m4_pattern_allow([AM_PROG_AR])
# AM_PROG_AR
AC_CHECK_TOOLS([AR], [gcc-ar ar])
AC_CHECK_TOOLS([RANLIB], [gcc-ranlib ranlib])
AC_CHECK_TOOLS([NM], [gcc-nm nm])
# Enable LibTool as we are building a library
#LT_PREREQ([2.2.6]) # TODO: don't really know what to put here so leave
# it out for now
LT_INIT
# Initialize pkg-config since we are installing a .pc file
PKG_INSTALLDIR
# Global Variable & Defaults
# ===============================================
# Keep this in sync with what is passed in AC_INIT
TARBALL_VERSION_FILE=".tarball-version"
# Initial values for automake variables AM_*
AM_CPPFLAGS="-I\$(top_srcdir)/include"
dnl we manually export the symbols via dllexport, we only use shared
dnl no libtool -DDLL_EXPORT support yet
dnl case $host_os in
dnl mingw*|msys*)
dnl AC_MSG_NOTICE([--disable-static on mingw])
dnl lt_prog_compiler_static=
dnl enable_static=no
dnl ;;
dnl esac
ISODATE=`date +%Y-%m-%d`
AC_SUBST(ISODATE)
AC_CANONICAL_HOST
# Configure options
# ===============================================
# User switches
AC_ARG_ENABLE(gcov,
AS_HELP_STRING([--enable-gcov],
[turn on test coverage @<:@default=no@:>@]),
[case "${enableval}" in
yes) enable_gcov=true ; gcov=gcov ;;
no) enable_gcov=false ;;
*) enable_gcov=true ; gcov="${enableval}" ;;
esac], [enable_gcov=false ])
AC_MSG_CHECKING([for --enable-gcov])
if test "x$enable_gcov" = "xtrue" ; then
dnl if test "$GCC" = yes; then
dnl AC_MSG_ERROR([gcov only works if gcc is used])
dnl fi
dnl You might need the compiler-specific gcov: e.g. gcov-mp-6
GCOV="$gcov"
AC_MSG_RESULT([gcov=$gcov])
AC_SUBST(GCOV)
GCOV_CFLAGS="-fprofile-arcs -ftest-coverage"
AC_SUBST(GCOV_CFLAGS)
dnl libtool 1.5.22 and lower strip -fprofile-arcs from the flags
dnl passed to the linker, which is a bug; -fprofile-arcs implicitly
dnl links in -lgcov, so we do it explicitly here for the same effect
GCOV_LIBS=-lgcov
AC_SUBST(GCOV_LIBS)
else
AC_MSG_RESULT([no (default)])
fi
AM_CONDITIONAL(ENABLE_GCOV, test "x$enable_gcov" = "xtrue")
AC_ARG_ENABLE(debug,
AS_HELP_STRING([--enable-debug],
[compile library w/ debugging symbols (-g)
@<:@default=no@:>@]),
[case "${enableval}" in
yes) enable_debug=true ;;
no) enable_debug=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;;
esac], [enable_debug=false ])
AC_MSG_CHECKING([for --enable-debug])
if test "x$enable_debug" = "xtrue" ; then
if test "x$enable_gcov" = "xtrue" ; then
DEBUG_CFLAGS="-g"
else
DEBUG_CFLAGS="-g -O2"
fi
if test "x`uname -o`" = "xDarwin" -a x$cross_compiling = xno; then
enable_shared=no
enable_shared_with_static_runtimes=no
fi
AC_MSG_RESULT([yes CFLAGS = $DEBUG_CFLAGS])
AM_CPPFLAGS="${AM_CPPFLAGS} -DDEBUG"
else
if test "x$enable_gcov" = "xtrue"; then
DEBUG_CFLAGS="-g"
else
# default release optimization
DEBUG_CFLAGS="-O2"
if test x$GCC = xyes; then
DEBUG_CFLAGS="-O2 -D_FORTIFY_SOURCE=2"
fi
fi
AC_MSG_RESULT([no CFLAGS = $DEBUG_CFLAGS])
fi
if test "x$CFLAGS" = "x-g -O2" -o "x$CFLAGS" = "x-g"; then
# by doing it this way we suppress automake's assumption that if
# CFLAGS is empty lets compile the code with '-g -O2'.
CFLAGS="${DEBUG_CFLAGS}"
else
AC_MSG_WARN([CFLAGS is not empty, will attempt to apply optimization
flags to 'AM_CFLAGS' but depending on the contents of
CFLAGS these may be overridden.
CFLAGS = '$CFLAGS'])
fi
AM_CONDITIONAL(ENABLE_DEBUG, test "x$enable_debug" = "xtrue")
AC_ARG_ENABLE(extensions,
AS_HELP_STRING([--disable-extensions],
[This library contains additional functions not defined
in the C11 specification. Disable to omit these.
@<:@default=no@:>@]),
[case "${enableval}" in
yes) enable_extensions=true ;;
no) enable_extensions=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --disable-extensions]) ;;
esac], [enable_extensions=true])
AC_MSG_CHECKING([for --disable-extensions])
if test "x$enable_extensions" = "xfalse" ; then
AC_MSG_RESULT([yes])
INSERT_EXTS="#define SAFECLIB_DISABLE_EXTENSIONS 1"
else
AC_MSG_RESULT([no (default)])
INSERT_EXTS="#undef SAFECLIB_DISABLE_EXTENSIONS"
fi
# AC_DEFINE([SAFECLIB_DISABLE_EXTENSIONS], 1,
# [Define to 1 to disable additional functions not defined
# in the C11 appendix K specification])
AC_SUBST(INSERT_EXTS)
AM_CONDITIONAL(ENABLE_EXTS, test "x$enable_extensions" = "xtrue")
AC_ARG_ENABLE(memmax,
AS_HELP_STRING([--enable-memmax],
[specify the largest object size allowed for the
mem* functions @<:@default=256MB@:>@]),
[case "${enableval}" in
@<:@0-9@:>@*) enable_memmax=${enableval} ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-memmax]) ;;
esac], [enable_memmax="(256UL << 20) /* 256MB */" ])
AC_MSG_CHECKING([for --enable-memmax])
AC_MSG_RESULT([$enable_memmax])
# AC_DEFINE([RSIZE_MAX_MEM], [ $enable_memmax ],
# [Maximum object size the mem* functions will allow,
# default is 256MB])
RSIZE_MAX_MEM=$enable_memmax
AC_SUBST(RSIZE_MAX_MEM)
AC_ARG_ENABLE(strmax,
AS_HELP_STRING([--enable-strmax],
[specify the largest object size allowed for the
str* functions @<:@default=4KB@:>@]),
[case "${enableval}" in
@<:@0-9@:>@*) enable_strmax=${enableval} ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-strmax]) ;;
esac], [enable_strmax="(4UL << 10) /* 4KB */" ])
AC_MSG_CHECKING([for --enable-strmax])
AC_MSG_RESULT([$enable_strmax])
RSIZE_MAX_STR=$enable_strmax
AC_SUBST(RSIZE_MAX_STR)
AC_ARG_ENABLE(nullslack,
AS_HELP_STRING([--disable-nullslack],
[Do not null out the remaining part of a string if it is
not completely used @<:@default=no@:>@]),
[case "${enableval}" in
yes) enable_nullslack=true ;;
no) enable_nullslack=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --disable-nullslack]) ;;
esac], [enable_nullslack=true ])
AC_MSG_CHECKING([for --disable-nullslack])
if test "x$enable_nullslack" = "xtrue" ; then
AC_MSG_RESULT([no (default)])
INSERT_NULLSLACK="#define SAFECLIB_STR_NULL_SLACK 1"
# AC_DEFINE([SAFECLIB_STR_NULL_SLACK], 1,
# [Define to 1 to null out the remaining part of a string
# buffer if it is not completely used])
else
AC_MSG_RESULT([yes])
INSERT_NULLSLACK="#undef SAFECLIB_STR_NULL_SLACK"
fi
AC_SUBST(INSERT_NULLSLACK)
AC_ARG_ENABLE(constraint-handler,
AS_HELP_STRING([--disable-constraint-handler],
[Disable C11 invoke_safe_{str,mem}_constraint_handler
for performance, smaller size and less flexibility.
@<:@default=no@:>@]),
[case "${enableval}" in
yes) enable_constraint_handler=true ;;
no) enable_constraint_handler=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --disable-constraint-handler]) ;;
esac], [enable_constraint_handler=true])
AC_MSG_CHECKING([for --disable-constraint-handler])
if test "x$enable_constraint_handler" = "xfalse" ; then
AC_MSG_RESULT([yes])
INSERT_CONSTRAINT_HANDLER="#define SAFECLIB_DISABLE_CONSTRAINT_HANDLER 1"
else
AC_MSG_RESULT([no (default)])
INSERT_CONSTRAINT_HANDLER="#undef SAFECLIB_DISABLE_CONSTRAINT_HANDLER"
fi
AC_SUBST(INSERT_CONSTRAINT_HANDLER)
AC_ARG_ENABLE(unsafe,
AS_HELP_STRING([--enable-unsafe],
[Include unsafe std C11 functions: tmpnam_s @<:@default=no@:>@]),
[case "${enableval}" in
yes) enable_unsafe=true ;;
no) enable_unsafe=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-unsafe]) ;;
esac], [enable_unsafe=no ])
AC_MSG_CHECKING([for --enable-unsafe])
if test "x$enable_unsafe" = "xtrue" ; then
AC_MSG_RESULT([yes])
INSERT_UNSAFE="#define SAFECLIB_ENABLE_UNSAFE 1"
else
AC_MSG_RESULT([no])
INSERT_UNSAFE="#undef SAFECLIB_ENABLE_UNSAFE"
fi
AC_SUBST(INSERT_UNSAFE)
AM_CONDITIONAL([ENABLE_UNSAFE], test "x$enable_unsafe" = "xtrue")
AC_ARG_ENABLE(norm-compat,
AS_HELP_STRING([--enable-norm-compat],
[Enable NFKC and NFKD modes for wcsnorm. @<:@default=no@:>@]),
[case "${enableval}" in
yes) enable_norm_compat=true ;;
no) enable_norm_compat=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-norm-compat]) ;;
esac], [enable_norm_compat=false ])
AC_MSG_CHECKING([for --enable-norm-compat])
if test "x$enable_norm_compat" = "xtrue" ; then
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_NORM_COMPAT], 1,
[Define to 1 to enable the compat normalization modes for wcsnorm_s
NFKC and NFKD])
else
AC_MSG_RESULT([no (default)])
fi
AC_ARG_ENABLE(warn-dmax,
AS_HELP_STRING([--enable-warn-dmax],
[Enable dmax checks against __builtin_object_size(dest). @<:@default=no@:>@]),
[case "${enableval}" in
yes) enable_warn_dmax=true ;;
no) enable_warn_dmax=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-warn-dmax]) ;;
esac], [enable_warn_dmax=false ])
AC_MSG_CHECKING([for --enable-warn-dmax])
if test "x$enable_warn_dmax" = "xtrue" ; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no (default)])
fi
AC_ARG_ENABLE(error-dmax,
AS_HELP_STRING([--enable-error-dmax],
[Make --enable-warn-dmax fatal. @<:@default=no@:>@]),
[case "${enableval}" in
yes) enable_error_dmax=true ;;
no) enable_error_dmax=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-error-dmax]) ;;
esac], [enable_error_dmax=false ])
AC_MSG_CHECKING([for --enable-error-dmax])
if test "x$enable_error_dmax" = "xtrue" ; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no (default)])
fi
AC_ARG_WITH(default-handler,
AS_HELP_STRING([--with-default-handler=<ignore|abort>],
[enforce compile-time default-handler]),
[case "${withval}" in
ignore) default_handler=ignore ;;
abort) default_handler=abort ;;
*) AC_MSG_ERROR([bad value ${withval} for --with-default-handler=]) ;;
esac], [])
AC_MSG_CHECKING([for --with-default-handler])
if test -n "$default_handler" ; then
AC_MSG_RESULT([$default_handler])
INSERT_DEFAULT_HANDLER="#define SAFECLIB_DEFAULT_HANDLER ${default_handler}_handler_s"
else
AC_MSG_RESULT([no (default)])
INSERT_DEFAULT_HANDLER="#undef SAFECLIB_DEFAULT_HANDLER"
fi
AC_SUBST(INSERT_DEFAULT_HANDLER)
AC_ARG_ENABLE(doc,
AS_HELP_STRING([--disable-doc],
[disable documentation @<:@default=no@:>@]),
[case "${enableval}" in
yes) enable_doc=true ;;
no) enable_doc=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-doc]) ;;
esac], [enable_doc=true])
AM_CONDITIONAL(ENABLE_DOC, test "x$enable_doc" = "xtrue")
dnl for windows dllimport. checking pic_flag DLL_EXPORT would be better,
dnl but this is only enabled for the shared objs, and we need it in the config
dnl for our tests.
if test "x$enable_shared" = "xno" ; then
INSERT_DISABLE_DLLIMPORT="#define DISABLE_DLLIMPORT 1"
else
INSERT_DISABLE_DLLIMPORT="#undef DISABLE_DLLIMPORT"
fi
AC_SUBST(INSERT_DISABLE_DLLIMPORT)
# Maintainer switches
AC_ARG_ENABLE(debug-build,
AS_HELP_STRING([--enable-debug-build],
[turn on build debugging, generally is not needed
unless you are the maintainer @<:@default=no@:>@]),
[case "${enableval}" in
yes) enable_debug_build=true ;;
no) enable_debug_build=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-debug-build]) ;;
esac], [enable_debug_build=false ])
AM_CONDITIONAL(ENABLE_DEBUG_BUILD, test "x$enable_debug_build" = "xtrue")
AC_ARG_ENABLE(hardening,
AS_HELP_STRING([--disable-hardening],
[disable hardening @<:@default=no@:>@]),
[case "${enableval}" in
yes) enable_hardening=true ;;
no) enable_hardening=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-hardening]) ;;
esac], [enable_hardening=true])
AC_MSG_NOTICE([Check programs])
# ===============================================
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
AM_PROG_CC_C_O
#AC_PROG_CC_C99
#AC_PROG_CC_C11
if test "x$ac_cv_prog_cc_c99" = "xno"; then
dnl we really should ERROR, lets see how far can come without
AC_MSG_WARN([This compiler ${CC} has no c99 support])
INSERT_SAFECLIB_HAVE_C99="#undef SAFECLIB_HAVE_C99"
else
AC_DEFINE([SAFECLIB_HAVE_C99], 1,
[Defined to 1 when the compiler supports c99, mostly (...) macros])
if test "x$ac_cv_prog_cc_c99" != "x"; then
AC_MSG_RESULT([added $ac_cv_prog_cc_c99 to CFLAGS])
AM_CFLAGS="$AM_CFLAGS $ac_cv_prog_cc_c99"
fi
INSERT_SAFECLIB_HAVE_C99="#define SAFECLIB_HAVE_C99 1"
fi
dnl AM_CONDITIONAL([SAFECLIB_HAVE_C99], [test "x$ac_cv_prog_cc_c99=no" != "xno"])
AC_SUBST(SAFECLIB_HAVE_C99)
AC_SUBST(INSERT_SAFECLIB_HAVE_C99)
if test "x$ac_cv_prog_cc_c11" != "xno"; then
AC_DEFINE([HAVE_C11], 1,
[Defined to 1 when the compiler supports c11])
if test "x$ac_cv_prog_cc_c11" != "x"; then
AC_MSG_RESULT([added $ac_cv_prog_cc_c11 to CFLAGS])
AM_CFLAGS="$AM_CFLAGS $ac_cv_prog_cc_c11"
fi
fi
AC_SUBST(HAVE_C11)
dnl c++ needs less warnings
if test -z $ax_compiler_cxx; then
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
[#ifndef __cplusplus
#error "no C++"
#endif]])],
[ax_compiler_cxx=yes;],
[ax_compiler_cxx=no;])
fi
if test "$ax_compiler_cxx" = "yes" ; then
AC_DEFINE([HAVE_CXX], 1,
[Defined to 1 when the compiler is C++])
dnl ax_cv_check_cflags__Wnested_externs=no
dnl ax_cv_check_cflags__Wmissing_prototypes=no
dnl ax_cv_check_cflags__Wstrict_prototypes=no
dnl ax_cv_check_cflags__Wimplicit_function_declaration=no
dnl ax_cv_check_cflags__Wdeclaration_after_statement=no
dnl ax_cv_check_cflags__Wold_style_definition=no
dnl ax_cv_check_cflags__Wjump_misses_init=no
fi
dnl we still have some empty src files
ax_cv_check_ldflags___Wl___fatal_warnings=no
ax_cv_check_ldflags___Wl__fatal_warnings=no
dnl sprintf_s passing through to vsnprintf_s
ax_cv_check_cflags__Wformat_2=no
ax_cv_check_cflags__Wformat_nonliteral=no
dnl windows mult. decl are not properly sorted out yet
dnl const -Wdiscarded-qualifiers is stricter on mingw
case $host_os in
mingw*|cygwin*|msys*)
ax_cv_check_cflags__Wredundant_decls=no
ax_enable_compile_warnings=yes
;;
esac
dnl gcc 4.2 fails with -Wmissing-format-attribute
dnl https://gcc.gnu.org/bugzilla/show_bug.cgi?id=28492
if test "x$GCC" != "x" ; then
AC_MSG_CHECKING([for -Wmissing-format-attribute usability])
old_cflags="$CFLAGS"
CFLAGS="-Wmissing-format-attribute -Werror"
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[
#include <stdio.h>
#include <stdarg.h>
void myvsprintf(char *dest, const char *fmt, va_list ap);
int mysprintf(char *dest, const char *fmt, ...);
int myvsprintf(char *dest, const char *fmt, va_list ap) {
return vsprintf(dest, fmt, ap);
}
int mysprintf(char *dest, const char *fmt, ...) {
va_list ap;
int ret;
va_start(ap, fmt);
ret = myvsprintf(dest, fmt, ap);
va_end(ap);
return ret;
}
]],[[
const char* fmt = "%s";
char dest[12];
return mysprintf(dest, fmt) ? 0: 1;
]]
)],
[ AC_MSG_RESULT([yes])],
[ AC_MSG_RESULT([no])
ax_cv_check_cflags__Winline=no
ax_cv_check_cflags__Wmissing_format_attribute=no
],
[ AC_MSG_RESULT([no (cross)])
ax_cv_check_cflags__Winline=no
ax_cv_check_cflags__Wmissing_format_attribute=no
])
CFLAGS="$old_cflags"
fi
AX_COMPILER_FLAGS
case $host_os in
mingw*|cygwin*)
WARN_CFLAGS="-Wall -Wextra"
;;
esac
dnl older non-c99 g++ complain about __VA_ARGS__, for();
if test "x$ac_cv_prog_cc_c99" = "xno" -a x$ax_compiler_cxx = xyes; then
WARN_CFLAGS=`echo $WARN_CFLAGS | sed -e"s,-Werror ,,"`
fi
AX_CHECK_COMPILE_FLAG([-Werror=unknown-warning-option],
[ax_ccf_err="-Werror=unknown-warning-option"],[ax_ccf_err=""])
# Try Intel's libmpx dynamic pointer bounds checker,
# available for gcc-5+ and icc-15.0+, but disabled on gcc by default. --enable-libmpx
# https://gcc.gnu.org/wiki/Intel%20MPX%20support%20in%20the%20GCC%20compiler
# and https://intel-mpx.github.io/design/
# See also https://github.com/google/sanitizers/wiki/AddressSanitizerIntelMemoryProtectionExtensions
dnl gcc: slows down the optimizer with gcc-5.0. 5.3 should be better.
dnl AX_CHECK_COMPILE_FLAG([-fcheck-pointer-bounds -mmpx],
dnl [CFLAGS="$CFLAGS -fcheck-pointer-bounds -mmpx" LDFLAGS="$LDFLAGS -lmpx -lmpxwrappers"],
dnl [],[$ax_ccf_err])
#AX_APPEND_COMPILE_FLAGS(["-fcheck-pointer-bounds -mmpx"],
# [CFLAGS],[$ax_ccf_err])
dnl icc:
if test x$ac_compiler_gnu = xno -a -n "$ax_ccf_err"; then
AX_CHECK_COMPILE_FLAG([-check-pointers-mpx=rw],
[CFLAGS="$CFLAGS -check-pointers-mpx=rw" LIBS="$LIBS -lmpx -lchkp"],
[],[$ax_ccf_err])
#AX_APPEND_COMPILE_FLAGS(["-check-pointers-mpx=rw"],
# [CFLAGS],[$ax_ccf_err])
fi
dnl windows mult. decl are not properly sorted out yet
case $host_os in
mingw*|cygwin*|msys*)
dnl gcc 3.4 cannot do -Wno-attributes
AX_APPEND_COMPILE_FLAGS([-Wno-attributes -Wno-discarded-qualifiers],
[WARN_CFLAGS],[$ax_ccf_err])
dnl AM_LDFLAGS=`echo $AM_LDFLAGS|sed -e"s/-Wl,--as-needed -Wl,--no-as-needed//"`
dnl x86 needs that for _mm_mfence
AX_CHECK_COMPILE_FLAG([-msse2],
[CFLAGS="$CFLAGS -msse2" LDFLAGS="$LDFLAGS -msse2"],
[],[$ax_ccf_err])
;;
esac
if test "x$enable_hardening" = "xtrue" ; then
AX_APPEND_COMPILE_FLAGS(
[-fstack-protector-strong -fstack-clash-protection -fcf-protection \
-fno-strict-aliasing -fno-strict-overflow -fno-delete-null-pointer-checks \
-fno-lifetime-dse],
[WARN_CFLAGS],[$ax_ccf_err])
AX_APPEND_LINK_FLAGS(
[-fstack-protector-strong -fstack-clash-protection -fcf-protection],
[WARN_LDFLAGS],[$ax_ccf_err])
fi
if test x$ax_cv_check_cflags__Wrestrict = xyes; then
AC_DEFINE([HAVE_WARNING_RESTRICT], 1, [Have -Wrestrict])
fi
PEDANTIC="-pedantic"
WARN_CFLAGS_TEST="-Wall -Wextra"
if test x$ac_compiler_gnu = xno; then
AX_CHECK_COMPILE_FLAG([-pedantic],
[PEDANTIC="-pedantic"],
[PEDANTIC=""
WARN_CFLAGS_TEST=""],[$ax_ccf_err])
AX_CHECK_COMPILE_FLAG([-Werror],
[],
[WARN_CFLAGS=""
WARN_CFLAGS_TEST=""],[$ax_ccf_err])
fi
AC_SUBST(PEDANTIC, $PEDANTIC)
AX_GCC_BUILTIN(__builtin_object_size)
dnl against -Werror,-Wgcc-compat fortify errors, only on clang
INSERT_OBJECT_SIZE="#undef HAVE___BUILTIN_OBJECT_SIZE"
INSERT_WARN_DMAX="#undef HAVE_WARN_DMAX"
INSERT_ERROR_DMAX="#undef HAVE_ERROR_DMAX"
if test x$ax_cv_have___builtin_object_size = xyes; then
AX_CHECK_COMPILE_FLAG([-Wuser-defined-warnings],
[have_user_defined_warnings="yes"],[have_user_defined_warnings="no"])
AX_CHECK_COMPILE_FLAG([$ax_ccf_err -Wgcc-compat],
[WARN_CFLAGS="$WARN_CFLAGS -Wno-gcc-compat"],[])
if test $have_user_defined_warnings = yes; then
AX_APPEND_COMPILE_FLAGS([-Wno-error=user-defined-warnings],
[WARN_CFLAGS],[$ax_ccf_err])
AC_DEFINE([HAVE_USER_DEFINED_WARNINGS], 1, [Uses -Wuser-defined-warnings])
fi
INSERT_OBJECT_SIZE="# define HAVE___BUILTIN_OBJECT_SIZE 1"
if test "x$enable_warn_dmax" = "xtrue" ; then
INSERT_WARN_DMAX="# define HAVE_WARN_DMAX 1"
fi
if test "x$enable_error_dmax" = "xtrue" ; then
INSERT_WARN_DMAX="#define HAVE_WARN_DMAX 1"
INSERT_ERROR_DMAX="#define HAVE_ERROR_DMAX 1"
fi
else
if test "x$enable_warn_dmax" = "xtrue" ; then
AC_MSG_RESULT([warn-dmax ignored, no __builtin_object_size])
fi
fi
AC_SUBST(INSERT_OBJECT_SIZE)
AC_SUBST(INSERT_WARN_DMAX)
AC_SUBST(INSERT_ERROR_DMAX)
AC_MSG_CHECKING([for diagnose_if attribute])
old_cflags="$CFLAGS"
CFLAGS="-Werror"
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[
#include <stdio.h>
int myfunc(char *ptr)
__attribute__((diagnose_if(!ptr, "empty ptr", "error")));
int myfunc(char *ptr) {
return ptr ? 1 : 0;
}
]],[[
char dest[12];
return myfunc(dest);
]]
)],
[ AC_MSG_RESULT([yes])
have_attribute_diagnose_if=yes
WARN_CFLAGS_TESTS="$WARN_CFLAGS_TESTS -Wno-gcc-compat"
AC_DEFINE([HAVE_ATTRIBUTE_DIAGNOSE_IF], 1,
[Defined to 1 when the compiler supports attribute diagnose_if, since clang-5])
],
[ AC_MSG_RESULT([no])
have_attribute_diagnose_if=no
],
[ AC_MSG_RESULT([no (cross)])
have_attribute_diagnose_if=no
])
CFLAGS="$old_cflags"
AM_CONDITIONAL([HAVE_ATTRIBUTE_DIAGNOSE_IF], [test "x$have_attribute_diagnose_if" = "xyes"])
AC_SUBST(WARN_CFLAGS_TEST, $WARN_CFLAGS_TEST)
AX_ASM_INLINE()
dnl Was needed for wcsnorm_s / mark.h. So far not needed anymore
dnl AX_CHECK_COMPILE_FLAG([-fbracket-depth=512],
dnl [AM_CFLAGS="$AM_CFLAGS -fbracket-depth=512"], [], [], [])
AM_CONDITIONAL([HAVE_MINGW], [test "x$host_os" = "xmingw32"])
AM_CONDITIONAL([HAVE_MINGW_CROSS],
[test "x$host_os" = "xmingw32" -a "x$build_os" != "xmingw32"])
if test "x$host_os" = "xmingw32" -a "x$build_os" != "xmingw32"; then
AC_CHECK_PROGS([WINE], [wine])
if test -z "$WINE"; then
AC_MSG_WARN([wine not found - cannot check cross-compiled executables])
else
AC_MSG_RESULT([ wine found - test with make check-wine])
AM_CFLAGS="$AM_CFLAGS -D_WINE_MSVCRT"
fi
fi
AC_CHECK_PROGS([DOXYGEN], [doxygen])
if test -z "$DOXYGEN";
then AC_MSG_WARN([doxygen not found - continuing without doxygen support])
fi
AC_CHECK_PROGS([POD2MAN], [pod2man])
if test -z "POD2MAN";
then AC_MSG_WARN([pod2man not found - continuing without pod2man support])
fi
AC_CHECK_PROGS([PANDOC], [pandoc])
if test -z "$PANDOC";
then AC_MSG_WARN([pandoc not found - README.rst cannot be generated from README.md])
fi
AM_CONDITIONAL([HAVE_DSYMUTIL], [test -n "$ac_ct_DSYMUTIL"])
case $host_os in
darwin*)
enable_valgrind_helgrind=no
enable_valgrind_drd=no
;;
esac
dnl passes only on some systems. --enable-valgrind-sgcheck
AX_VALGRIND_DFLT([sgcheck], [off])
AX_VALGRIND_CHECK()
# Checks for libraries
# ===============================================
# None
AC_MSG_NOTICE([Check header files])
# ===============================================
AC_HEADER_STDC
AC_HEADER_STDBOOL
AC_HEADER_TIME
AC_CHECK_HEADERS([sys/time.h])
AC_CHECK_HEADERS([stdlib.h \
memory.h \
ctype.h \
malloc.h \
string.h \
limits.h \
stddef.h \
unistd.h \
sys/types.h \
inttypes.h \
stdint.h \
errno.h \
wchar.h \
langinfo.h \
valgrind/valgrind.h \
intrin.h \
xmmintrin.h \
emmintrin.h \
x86intrin.h \
arm_neon.h \
arm_acle.h \
mmintrin.h \
altivec.h \
spe.h \
mbarrier.h \
])
INSERT_SYS_TYPES_H=""
if test "x$ac_cv_header_sys_types_h" = "xyes"; then
INSERT_SYS_TYPES_H="#include <sys/types.h>"
fi
AC_SUBST(INSERT_SYS_TYPES_H)
INSERT_INTTYPES_H=""
if test "x$ac_cv_header_inttypes_h" = "xyes"; then
INSERT_INTTYPES_H="#include <inttypes.h>"
fi
AC_SUBST(INSERT_INTTYPES_H)
INSERT_STDINT_H=""
if test "x$ac_cv_header_stdint_h" = "xyes"; then
INSERT_STDINT_H="#include <stdint.h>"
fi
AC_SUBST(INSERT_STDINT_H)
INSERT_ERRNO_H=""
if test "x$ac_cv_header_errno_h" = "xyes"; then
INSERT_ERRNO_H="#include <errno.h>"
fi
AC_SUBST(INSERT_ERRNO_H)
INSERT_BOOL_SUPPORT="#include <stdbool.h>"
if test "x$ac_cv_header_stdbool_h" = "xno"; then
INSERT_BOOL_SUPPORT="
# define bool _Bool
# define false 0
# define true 1
# define __bool_true_false_are_defined 1
"
if test "x$ac_cv_type__bool" = "xno"; then
INSERT_BOOL_SUPPORT="
#ifdef __cplusplus
typedef bool _Bool;
#else
# define _Bool unsigned char
#endif
$INSERT_BOOL_SUPPORT
"
fi
fi
AC_SUBST(INSERT_BOOL_SUPPORT)
AC_MSG_NOTICE([Check typedefs, structures, and compiler characteristics])
# ===============================================
AC_C_CONST
AC_C_INLINE
AC_C_RESTRICT
AC_TYPE_SIZE_T
AC_TYPE_INT32_T
AC_TYPE_UINT8_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_TYPE_UINTPTR_T
AC_CHECK_SIZEOF(size_t)
AC_CHECK_TYPE([errno_t],
[FALLBACK_ERRNO_T=""],
[FALLBACK_ERRNO_T="typedef int errno_t;"],
[[#include <errno.h>]])
AC_SUBST(FALLBACK_ERRNO_T)
AC_TYPE_MBSTATE_T
AC_CHECK_MEMBER(struct tm.tm_gmtoff,
[AC_DEFINE(HAVE_TM_GMTOFF, 1,
[Define if struct tm has the tm_gmtoff member.])],
,
[#include <time.h>])
AX_COMPILE_CHECK_SIZEOF(time_t, [#include <time.h>])
AC_CHECK_TYPE([wchar_t],[],[],[[#include <wchar.h>]])
AX_GCC_BUILTIN(__builtin_ctz)
AX_GCC_BUILTIN(__builtin_constant_p)
INSERT_CONSTANT_P="#undef HAVE___BUILTIN_CONSTANT_P"
if test x$ax_cv_have___builtin_constant_p = xyes; then
INSERT_CONSTANT_P="#define HAVE___BUILTIN_CONSTANT_P 1"
fi
AC_SUBST(INSERT_CONSTANT_P)
AX_GCC_FUNC_ATTRIBUTE(format)
AX_GCC_FUNC_ATTRIBUTE(malloc)
AX_GCC_FUNC_ATTRIBUTE(returns_nonnull)
#not yet supported, planned since 2008
AX_GCC_FUNC_ATTRIBUTE(format_wprintf)
AX_GCC_FUNC_ATTRIBUTE(format_wscanf)
if test x$ax_cv_have_func_attribute_format_wprintf = xyes; then
HAVE_ATTRIBUTE_FORMAT_WPRINTF=1
else
HAVE_ATTRIBUTE_FORMAT_WPRINTF=0
fi
if test x$ax_cv_have_func_attribute_format_wscanf = xyes; then
HAVE_ATTRIBUTE_FORMAT_WSCANF=1
else
HAVE_ATTRIBUTE_FORMAT_WSCANF=0
fi
AC_SUBST(HAVE_ATTRIBUTE_FORMAT_WPRINTF)
AC_SUBST(HAVE_ATTRIBUTE_FORMAT_WSCANF)
builtins_chk="memcpy memmove memset strcpy strncpy strcat strncat
printf sprintf snprintf swprintf
vfprintf vfwprintf vsprintf vsnprintf"
#AX_GCC_BUILTIN(__builtin___memcpy_chk)
#AX_GCC_BUILTIN(__builtin___memmove_chk)
#AX_GCC_BUILTIN(__builtin___memset_chk)
#AX_GCC_BUILTIN(__builtin___strcpy_chk)
#AX_GCC_BUILTIN(__builtin___strncpy_chk)
#AX_GCC_BUILTIN(__builtin___strcat_chk)
#AX_GCC_BUILTIN(__builtin___strncat_chk)
#AX_GCC_BUILTIN(__builtin___printf_chk)
#AX_GCC_BUILTIN(__builtin___sprintf_chk)
#AX_GCC_BUILTIN(__builtin___snprintf_chk)
#AX_GCC_BUILTIN(__builtin___swprintf_chk)
#AX_GCC_BUILTIN(__builtin___vfprintf_chk)
#AX_GCC_BUILTIN(__builtin___vfwprintf_chk)
#AX_GCC_BUILTIN(__builtin___vsprintf_chk)
#AX_GCC_BUILTIN(__builtin___vsnprintf_chk)
builtins_bounds="narrow_ptr_bounds copy_ptr_bounds init_ptr_bounds
set_ptr_bounds null_ptr_bounds
chk_ptr_lbounds chk_ptr_ubounds chk_ptr_bounds get_ptr_lbound get_ptr_ubound"
#for b in $builtins_bounds; do
# AX_GCC_BUILTIN([__builtin___bnd_$b])
#done
#AX_GCC_BUILTIN(__builtin___bnd_narrow_ptr_bounds)
#AX_GCC_BUILTIN(__builtin___bnd_init_ptr_bounds)
#AX_GCC_BUILTIN(__builtin___bnd_copy_ptr_bounds)
AX_GCC_BUILTIN(__builtin___bnd_set_ptr_bounds)
AX_GCC_BUILTIN(__builtin___bnd_null_ptr_bounds)
#AX_GCC_BUILTIN(__builtin___bnd_chk_ptr_lbounds)
#AX_GCC_BUILTIN(__builtin___bnd_chk_ptr_ubounds)
AX_GCC_BUILTIN(__builtin___bnd_chk_ptr_bounds)
#AX_GCC_BUILTIN(__builtin___bnd_get_ptr_lbound)
#AX_GCC_BUILTIN(__builtin___bnd_get_ptr_ubound)
dnl arm intrinsic barriers
AX_GCC_BUILTIN(__dsb)
AX_GCC_BUILTIN(__isb)
AX_GCC_BUILTIN(__builtin___dsb)
AX_GCC_BUILTIN(__builtin___isb)
AC_CHECK_FUNCS([ vswprintf vswscanf mbsrtowcs ])
dnl this user choice needs to probe first for the default
AC_ARG_ENABLE(wchar,
AS_HELP_STRING([--disable-wchar],
[Disable multibyte and wchar support. @<:@default=no@:>@]),
[case "${enableval}" in
yes) enable_wchar=true ;;
no) enable_wchar=false ;;
dnl early mingw32 have only crippled wchar support: only wcscmp, wcslen
*) if test x$ac_cv_type_wchar_t = xyes -a x$ac_cv_func_vswprintf = xyes \
-a x$ac_cv_header_wchar_h = xyes
then
enable_wchar=true
else
AC_MSG_WARN([no proper wchar support])
enable_wchar=false
fi ;;
esac], [enable_wchar=true])
AC_MSG_CHECKING([for --disable-wchar or broken wchar usability])
dnl catch mingw32 1.0 with crippled wchar
if test x$ac_cv_header_wchar_h = xyes -a x$enable_wchar = xtrue \
-a x$ac_cv_func_vswprintf = xyes \
-a x$ac_cv_func_mbsrtowcs = xyes -a x$ac_cv_func_vswscanf = xyes
then
enable_wchar=true
else
enable_wchar=false
fi
if test "x$enable_wchar" = "xtrue" ; then
AC_MSG_RESULT([no (default)])
else
AC_MSG_RESULT([yes])
fi
AC_MSG_NOTICE([Check library functions])
# ===============================================
# dynamic checks if registered via malloc (e.g. libmpx)
AC_CHECK_FUNCS([__bnd_chk_ptr_bounds __bnd_set_ptr_bounds __bnd_null_ptr_bounds])
dnl bos enabled chk functions (but not yet usable)
#for b in $builtins_chk; do
AC_CHECK_FUNCS([__memcpy_chk __memmove_chk __memset_chk \
__strcpy_chk __strncpy_chk __strcat_chk __strncat_chk \
__printf_chk __sprintf_chk __snprintf_chk \
__vfprintf_chk __vfwprintf_chk __vsprintf_chk __vsnprintf_chk \
__vsscanf_chk ])
#done
dnl They need to include the relevant intrin header first
dnl TODO: probe for MEMORY_BARRIER and COMPILER_BARRIER here
dnl AC_CHECK_FUNCS([ __sync_synchronize MemoryBarrier _mm_mfence _mm_sfence \
dnl __machine_rw_barrier ])
AC_FUNC_MEMCMP
dnl no header needed as is checks if the linker can find it
dnl mbstowcs missing on cygwin64
AC_CHECK_FUNCS([ memset strcmp strcasecmp strcasestr strcspn strpbrk strspn \
strnstr strnlen strrchr memrchr strstr bcmp secure_getenv timingsafe_memcmp \
timingsafe_bcmp explicit_bzero explicit_memset \
asctime_r ctime_r gmtime_r localtime_r memccpy stpcpy stpncpy strerror])
if test "x$enable_wchar" = "xtrue" ; then
AC_CHECK_FUNCS([ wmemchr wmemcmp wcscmp wcsstr \
vswprintf vsnwprintf vswscanf mbsrtowcs mbstowcs iswdigit iswspace \
towlower towupper towctrans ])
AC_CHECK_FUNCS([ __swprintf_chk __vfwprintf_chk __vswscanf_chk ])
fi
dnl add the extensions, pretending we want them
echo "#define __STDC_WANT_LIB_EXT1__ 1" >>confdefs.h
dnl native safec shadowing functions (should be none)
AC_CHECK_FUNCS([_memcpy_s_chk _memmove_s_chk _memset_s_chk _memcmp_s_chk \
_strcpy_s_chk _strncpy_s_chk _strcat_s_chk _strncat_s_chk _strnlen_s_chk \
_printf_s_chk _sprintf_s_chk _snprintf_s_chk \
_vfprintf_s_chk _vsprintf_s_chk _vsnprintf_s_chk])
dnl native C11 Annex K functions
dnl vsnprintf_s vsnwprintf_s strtok_s wcstok_s deviate in mingw from c11
AC_CHECK_FUNCS(
[ memset_s memcpy_s memmove_s memzero_s memchr_s memrchr_s memccpy_s \
sprintf_s strcat_s strcpy_s strncat_s strncpy_s \
strnlen_s strtok_s strerror_s vsprintf_s tmpnam_s snprintf_s vsnprintf_s \
strspn_s strset_s strchr_s strrchr_s strstr_s strzero_s strnset_s \
stpcpy_s stpncpy_s \
sscanf_s fscanf_s scanf_s vfscanf_s \
vsscanf_s vscanf_s printf_s fprintf_s tmpfile_s vfprintf_s vprintf_s \
fopen_s freopen_s gets_s bsearch_s qsort_s gmtime_s localtime_s \
asctime_s ctime_s getenv_s ])
if test "x$enable_wchar" = "xtrue" ; then
AC_CHECK_FUNCS(
[ mbsrtowcs_s mbstowcs_s wcsrtombs_s wcstombs_s \
wcrtomb_s wctomb_s wcsnlen_s wcscpy_s wcsncpy_s wcscat_s wcsncat_s \
wmemcpy_s wmemmove_s wcstok_s vswprintf_s swprintf_s vfwprintf_s \
vwprintf_s wprintf_s snwprintf_s fwprintf_s swscanf_s vswscanf_s wscanf_s \
vfwscanf_s fwscanf_s vwscanf_s vsnwprintf_s wcsstr_s wmemcmp_s \
wcscmp_s wcsncmp_s wcsicmp_s wcsset_s wcsnset_s wcscoll_s wcslwr_s \
wcsupr_s towfc_s wcsfc_s ])
AC_CHECK_FUNCS([ _swprintf_s_chk _vfwprintf_s_chk ])
fi
dnl but delete it, because we override it case by case
$GREP -v '__STDC_WANT_LIB_EXT1__' confdefs.h > confdefs.h.tmp
mv confdefs.h.tmp confdefs.h
AM_CONDITIONAL([HAVE_WCSSTR], [test "x$ac_cv_func_wcsstr" = "xyes"])
AM_CONDITIONAL([HAVE_MBSTOWCS], [test "x$ac_cv_func_mbstowcs" = "xyes"])
AM_CONDITIONAL([HAVE_VSNWPRINTF_S], [test "x$ac_cv_func_vsnwprintf_s" = "xyes"])
AM_CONDITIONAL([HAVE_MEMCPY_S], [test "x$ac_cv_func_memcpy_s" = "xyes"])
AM_CONDITIONAL([HAVE_TIMINGSAFE_BCMP],
[test "x$ac_cv_func_timingsafe_memcmp" = "xyes" -a "x$ac_cv_func_timingsafe_bcmp" = "xyes" ])