forked from bminor/glibc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
1846 lines (1673 loc) · 55.8 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
dnl Process this file with autoconf to produce a configure script.
dnl Note we do not use AC_PREREQ here! See aclocal.m4 for what we use instead.
AC_INIT([GNU C Library], [(see version.h)], [https://sourceware.org/bugzilla/],
[glibc], [https://www.gnu.org/software/glibc/])
AC_CONFIG_SRCDIR([include/features.h])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_AUX_DIR([scripts])
ACX_PKGVERSION([GNU libc])
ACX_BUGURL([https://www.gnu.org/software/libc/bugs.html])
AC_DEFINE_UNQUOTED([PKGVERSION], ["$PKGVERSION"],
[Package description])
AC_DEFINE_UNQUOTED([REPORT_BUGS_TO], ["$REPORT_BUGS_TO"],
[Bug reporting address])
# Glibc should not depend on any header files
AC_DEFUN([_AC_INCLUDES_DEFAULT_REQUIREMENTS],
[m4_divert_text([DEFAULTS],
[ac_includes_default='/* none */'])])
# We require GCC, and by default use its preprocessor. Override AC_PROG_CPP
# here to work around the Autoconf issue discussed in
# <https://sourceware.org/ml/libc-alpha/2013-01/msg00721.html>.
AC_DEFUN([AC_PROG_CPP],
[AC_REQUIRE([AC_PROG_CC])dnl
AC_ARG_VAR([CPP], [C preprocessor])dnl
_AC_ARG_VAR_CPPFLAGS()dnl
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
fi
if test -z "$CPP"; then
CPP="$CC -E"
fi
AC_SUBST(CPP)dnl
])# AC_PROG_CPP
# We require GCC. Override _AC_PROG_CC_C89 here to work around the Autoconf
# issue discussed in
# <https://sourceware.org/ml/libc-alpha/2013-01/msg00757.html>.
AC_DEFUN([_AC_PROG_CC_C89], [[$1]])
dnl This is here so we can set $subdirs directly based on configure fragments.
AC_CONFIG_SUBDIRS()
AC_CANONICAL_HOST
AC_PROG_CC
if test $host != $build; then
AC_CHECK_PROGS(BUILD_CC, gcc cc)
fi
AC_SUBST(cross_compiling)
AC_PROG_CPP
# We need the C++ compiler only for testing.
AC_PROG_CXX
# It's useless to us if it can't link programs (e.g. missing -lstdc++).
AC_CACHE_CHECK([whether $CXX can link programs], libc_cv_cxx_link_ok, [dnl
AC_LANG_PUSH([C++])
# Default, dynamic case.
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
[libc_cv_cxx_link_ok=yes],
[libc_cv_cxx_link_ok=no])
# Static case.
old_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -static"
AC_LINK_IFELSE([AC_LANG_SOURCE([
#include <iostream>
int
main()
{
std::cout << "Hello, world!";
return 0;
}
])],
[],
[libc_cv_cxx_link_ok=no])
LDFLAGS="$old_LDFLAGS"
AC_LANG_POP([C++])])
AS_IF([test $libc_cv_cxx_link_ok != yes], [CXX=])
if test "`cd $srcdir; pwd -P`" = "`pwd -P`"; then
AC_MSG_ERROR([you must configure in a separate build directory])
fi
# This will get text that should go into config.make.
config_vars=
# Check for a --with-gd argument and set libgd-LDFLAGS in config.make.
AC_ARG_WITH([gd],
AS_HELP_STRING([--with-gd=DIR],
[find libgd include dir and library with prefix DIR]),
[dnl
case "$with_gd" in
yes|''|no) ;;
*) libgd_include="-I$withval/include"
libgd_ldflags="-L$withval/lib" ;;
esac
])
AC_ARG_WITH([gd-include],
AS_HELP_STRING([--with-gd-include=DIR],
[find libgd include files in DIR]),
[dnl
case "$with_gd_include" in
''|no) ;;
*) libgd_include="-I$withval" ;;
esac
])
AC_ARG_WITH([gd-lib],
AS_HELP_STRING([--with-gd-lib=DIR],
[find libgd library files in DIR]),
[dnl
case "$with_gd_lib" in
''|no) ;;
*) libgd_ldflags="-L$withval" ;;
esac
])
if test -n "$libgd_include"; then
config_vars="$config_vars
CFLAGS-memusagestat.c = $libgd_include"
fi
if test -n "$libgd_ldflags"; then
config_vars="$config_vars
libgd-LDFLAGS = $libgd_ldflags"
fi
dnl Arguments to specify presence of other packages/features.
AC_ARG_WITH([binutils],
AS_HELP_STRING([--with-binutils=PATH],
[specify location of binutils (as and ld)]),
[path_binutils=$withval],
[path_binutils=''])
AC_ARG_WITH([selinux],
AS_HELP_STRING([--with-selinux],
[if building with SELinux support]),
[with_selinux=$withval],
[with_selinux=auto])
AC_ARG_WITH([headers],
AS_HELP_STRING([--with-headers=PATH],
[location of system headers to use
(for example /usr/src/linux/include)
@<:@default=compiler default@:>@]),
[sysheaders=$withval],
[sysheaders=''])
AC_SUBST(sysheaders)
AC_SUBST(use_default_link)
AC_ARG_WITH([default-link],
AS_HELP_STRING([--with-default-link],
[do not use explicit linker scripts]),
[use_default_link=$withval],
[use_default_link=no])
dnl Additional build flags injection.
AC_ARG_WITH([nonshared-cflags],
AS_HELP_STRING([--with-nonshared-cflags=CFLAGS],
[build nonshared libraries with additional CFLAGS]),
[extra_nonshared_cflags=$withval],
[extra_nonshared_cflags=])
AC_SUBST(extra_nonshared_cflags)
AC_ARG_WITH([rtld-early-cflags],
AS_HELP_STRING([--with-rtld-early-cflags=CFLAGS],
[build early initialization with additional CFLAGS]),
[rtld_early_cflags=$withval],
[rtld_early_cflags=])
AC_SUBST(rtld_early_cflags)
AC_ARG_WITH([timeoutfactor],
AS_HELP_STRING([--with-timeoutfactor=NUM],
[specify an integer to scale the timeout]),
[timeoutfactor=$withval],
[timeoutfactor=1])
AC_DEFINE_UNQUOTED(TIMEOUTFACTOR, $timeoutfactor)
AC_ARG_ENABLE([sanity-checks],
AS_HELP_STRING([--disable-sanity-checks],
[really do not use threads (should not be used except in special situations) @<:@default=yes@:>@]),
[enable_sanity=$enableval],
[enable_sanity=yes])
AC_ARG_ENABLE([shared],
AS_HELP_STRING([--enable-shared],
[build shared library @<:@default=yes if GNU ld@:>@]),
[shared=$enableval],
[shared=yes])
AC_ARG_ENABLE([profile],
AS_HELP_STRING([--enable-profile],
[build profiled library @<:@default=no@:>@]),
[profile=$enableval],
[profile=no])
AC_ARG_ENABLE([default-pie],
AS_HELP_STRING([--disable-default-pie],
[Do not build glibc programs and the testsuite as PIE @<:@default=no@:>@]),
[default_pie=$enableval],
[default_pie=yes])
AC_ARG_ENABLE([timezone-tools],
AS_HELP_STRING([--disable-timezone-tools],
[do not install timezone tools @<:@default=install@:>@]),
[enable_timezone_tools=$enableval],
[enable_timezone_tools=yes])
AC_SUBST(enable_timezone_tools)
AC_ARG_ENABLE([hardcoded-path-in-tests],
AS_HELP_STRING([--enable-hardcoded-path-in-tests],
[hardcode newly built glibc path in tests @<:@default=no@:>@]),
[hardcoded_path_in_tests=$enableval],
[hardcoded_path_in_tests=no])
AC_SUBST(hardcoded_path_in_tests)
AC_ARG_ENABLE([hidden-plt],
AS_HELP_STRING([--disable-hidden-plt],
[do not hide internal function calls to avoid PLT]),
[hidden=$enableval],
[hidden=yes])
if test "x$hidden" = xno; then
AC_DEFINE(NO_HIDDEN)
fi
AC_ARG_ENABLE([bind-now],
AS_HELP_STRING([--enable-bind-now],
[disable lazy relocations in DSOs]),
[bindnow=$enableval],
[bindnow=no])
AC_SUBST(bindnow)
if test "x$bindnow" = xyes; then
AC_DEFINE(BIND_NOW)
fi
dnl Build glibc with -fstack-protector, -fstack-protector-all, or
dnl -fstack-protector-strong.
AC_ARG_ENABLE([stack-protector],
AS_HELP_STRING([--enable-stack-protector=@<:@yes|no|all|strong@:>@],
[Use -fstack-protector[-all|-strong] to detect glibc buffer overflows]),
[enable_stack_protector=$enableval],
[enable_stack_protector=no])
case "$enable_stack_protector" in
all|yes|no|strong) ;;
*) AC_MSG_ERROR([Not a valid argument for --enable-stack-protector: \"$enable_stack_protector\"]);;
esac
dnl On some platforms we cannot use dynamic loading. We must provide
dnl static NSS modules.
AC_ARG_ENABLE([static-nss],
AS_HELP_STRING([--enable-static-nss],
[build static NSS modules @<:@default=no@:>@]),
[static_nss=$enableval],
[static_nss=no])
dnl Enable static NSS also if we build no shared objects.
if test x"$static_nss" = xyes || test x"$shared" = xno; then
static_nss=yes
AC_DEFINE(DO_STATIC_NSS)
fi
AC_ARG_ENABLE([force-install],
AS_HELP_STRING([--disable-force-install],
[don't force installation of files from this package, even if they are older than the installed files]),
[force_install=$enableval],
[force_install=yes])
AC_SUBST(force_install)
AC_ARG_ENABLE([maintainer-mode],
AS_HELP_STRING([--enable-maintainer-mode],
[enable make rules and dependencies not useful (and sometimes confusing) to the casual installer]),
[maintainer=$enableval],
[maintainer=no])
dnl On some platforms we allow dropping compatibility with all kernel
dnl versions.
AC_ARG_ENABLE([kernel],
AS_HELP_STRING([--enable-kernel=VERSION],
[compile for compatibility with kernel not older than VERSION]),
[minimum_kernel=$enableval],
[])
dnl Prevent unreasonable values.
if test "$minimum_kernel" = yes || test "$minimum_kernel" = no; then
# Better nothing than this.
minimum_kernel=""
else
if test "$minimum_kernel" = current; then
minimum_kernel=`uname -r 2>/dev/null` || minimum_kernel=
fi
fi
dnl For the development we sometimes want gcc to issue even more warnings.
dnl This is not the default since many of the extra warnings are not
dnl appropriate.
AC_ARG_ENABLE([all-warnings],
AS_HELP_STRING([--enable-all-warnings],
[enable all useful warnings gcc can issue]),
[all_warnings=$enableval],
[])
AC_SUBST(all_warnings)
AC_ARG_ENABLE([werror],
AS_HELP_STRING([--disable-werror],
[do not build with -Werror]),
[enable_werror=$enableval],
[enable_werror=yes])
AC_SUBST(enable_werror)
AC_ARG_ENABLE([multi-arch],
AS_HELP_STRING([--enable-multi-arch],
[enable single DSO with optimizations for multiple architectures]),
[multi_arch=$enableval],
[multi_arch=default])
AC_ARG_ENABLE([experimental-malloc],
AS_HELP_STRING([--disable-experimental-malloc],
[disable experimental malloc features]),
[experimental_malloc=$enableval],
[experimental_malloc=yes])
AC_SUBST(experimental_malloc)
AC_ARG_ENABLE([memory-tagging],
AS_HELP_STRING([--enable-memory-tagging],
[enable memory tagging if supported by the architecture @<:@default=no@:>@]),
[memory_tagging=$enableval],
[memory_tagging=no])
if test "$memory_tagging" = yes; then
# Only enable this on architectures that support it.
case $host_cpu in
aarch64)
AC_DEFINE(USE_MTAG)
;;
esac
fi
AC_SUBST(memory_tagging)
AC_ARG_ENABLE([crypt],
AS_HELP_STRING([--disable-crypt],
[do not build nor install the passphrase hashing library, libcrypt]),
[build_crypt=$enableval],
[build_crypt=yes])
AC_SUBST(build_crypt)
AC_ARG_ENABLE([nss-crypt],
AS_HELP_STRING([--enable-nss-crypt],
[enable libcrypt to use nss]),
[nss_crypt=$enableval],
[nss_crypt=no])
if test x$build_libcrypt = xno && test x$nss_crypt = xyes; then
AC_MSG_WARN([--enable-nss-crypt has no effect when libcrypt is disabled])
nss_crypt=no
fi
if test x$nss_crypt = xyes; then
nss_includes=-I$(nss-config --includedir 2>/dev/null)
if test $? -ne 0; then
AC_MSG_ERROR([cannot find include directory with nss-config])
fi
nspr_includes=-I$(nspr-config --includedir 2>/dev/null)
if test $? -ne 0; then
AC_MSG_ERROR([cannot find include directory with nspr-config])
fi
old_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $nss_includes $nspr_includes"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([typedef int PRBool;
#include <hasht.h>
#include <nsslowhash.h>
void f (void) { NSSLOW_Init (); }])],
libc_cv_nss_crypt=yes,
AC_MSG_ERROR([
cannot find NSS headers with lowlevel hash function interfaces]))
old_LIBS="$LIBS"
old_LDFLAGS="$LDFLAGS"
LIBS="$LIBS -lfreebl3"
AC_LINK_IFELSE([AC_LANG_PROGRAM([typedef int PRBool;
#include <hasht.h>
#include <nsslowhash.h>],
[NSSLOW_Init();])],
libc_cv_nss_crypt=yes,
AC_MSG_ERROR([
cannot link program using lowlevel NSS hash functions]))
# Check to see if there is a static NSS cryptographic library.
# If there isn't then we can't link anything with libcrypt.a,
# and that might mean disabling some static tests.
LDFLAGS="$LDFLAGS -static"
AC_LINK_IFELSE([AC_LANG_PROGRAM([typedef int PRBool;
#include <hasht.h>
#include <nsslowhash.h>],
[NSSLOW_Init();])],
libc_cv_static_nss_crypt=yes,
libc_cv_static_nss_crypt=no)
LDFLAGS="$old_LDFLAGS"
CFLAGS="$old_CFLAGS"
LIBS="$old_LIBS"
else
libc_cv_nss_crypt=no
libc_cv_static_nss_crypt=no
fi
AC_SUBST(libc_cv_nss_crypt)
AC_SUBST(libc_cv_static_nss_crypt)
AC_ARG_ENABLE([systemtap],
[AS_HELP_STRING([--enable-systemtap],
[enable systemtap static probe points @<:@default=no@:>@])],
[systemtap=$enableval],
[systemtap=no])
if test "x$systemtap" != xno; then
AC_CACHE_CHECK([for systemtap static probe support], libc_cv_sdt, [dnl
old_CFLAGS="$CFLAGS"
CFLAGS="-std=gnu11 $CFLAGS"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <sys/sdt.h>
void foo (int i, void *p)
{
asm ("" STAP_PROBE_ASM (foo, bar, STAP_PROBE_ASM_TEMPLATE (2)) ""
:: STAP_PROBE_ASM_OPERANDS (2, i, p));
}]])], [libc_cv_sdt=yes], [libc_cv_sdt=no])
CFLAGS="$old_CFLAGS"])
if test $libc_cv_sdt = yes; then
AC_DEFINE([USE_STAP_PROBE])
elif test "x$systemtap" != xauto; then
AC_MSG_FAILURE([systemtap support needs sys/sdt.h with asm support])
fi
fi
AC_ARG_ENABLE([build-nscd],
[AS_HELP_STRING([--disable-build-nscd],
[disable building and installing the nscd daemon])],
[build_nscd=$enableval],
[build_nscd=default])
AC_SUBST(build_nscd)
# Note the use of $use_nscd is near the bottom of the file.
AC_ARG_ENABLE([nscd],
[AS_HELP_STRING([--disable-nscd],
[library functions will not contact the nscd daemon])],
[use_nscd=$enableval],
[use_nscd=yes])
AC_ARG_ENABLE([pt_chown],
[AS_HELP_STRING([--enable-pt_chown],
[Enable building and installing pt_chown])],
[build_pt_chown=$enableval],
[build_pt_chown=no])
AC_SUBST(build_pt_chown)
if test "$build_pt_chown" = yes; then
AC_DEFINE(HAVE_PT_CHOWN)
fi
AC_ARG_ENABLE([tunables],
[AS_HELP_STRING([--enable-tunables],
[Enable tunables support. Known values are 'yes', 'no' and 'valstring'])],
[have_tunables=$enableval],
[have_tunables=yes])
AC_SUBST(have_tunables)
if test "$have_tunables" = yes; then
AC_DEFINE(HAVE_TUNABLES)
fi
# The abi-tags file uses a fairly simplistic model for name recognition that
# can't distinguish i486-pc-linux-gnu fully from i486-pc-gnu. So we mutate a
# $host_os of `gnu*' here to be `gnu-gnu*' just so that it can tell.
# This doesn't get used much beyond that, so it's fairly safe.
case "$host_os" in
linux*)
;;
gnu*)
host_os=`echo $host_os | sed -e 's/gnu/gnu-gnu/'`
;;
esac
AC_ARG_ENABLE([mathvec],
[AS_HELP_STRING([--enable-mathvec],
[Enable building and installing mathvec @<:@default depends on architecture@:>@])],
[build_mathvec=$enableval],
[build_mathvec=notset])
AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[]], [[
#ifndef __CET__
# error no CET compiler support
#endif]])],
[libc_cv_compiler_default_cet=yes],
[libc_cv_compiler_default_cet=no])
AC_ARG_ENABLE([cet],
AS_HELP_STRING([--enable-cet],
[enable Intel Control-flow Enforcement Technology (CET), x86 only]),
[enable_cet=$enableval],
[enable_cet=$libc_cv_compiler_default_cet])
AC_ARG_ENABLE([scv],
AC_HELP_STRING([--disable-scv],
[syscalls will not use scv instruction, even if the kernel supports it, powerpc only]),
[use_scv=$enableval],
[use_scv=yes])
AS_IF([[test "$use_scv" != "no"]],[AC_DEFINE(USE_PPC_SCV)])
# We keep the original values in `$config_*' and never modify them, so we
# can write them unchanged into config.make. Everything else uses
# $machine, $vendor, and $os, and changes them whenever convenient.
config_machine=$host_cpu config_vendor=$host_vendor config_os=$host_os
# Don't allow vendor == "unknown"
test "$config_vendor" = unknown && config_vendor=
config_os="`echo $config_os | sed 's/^unknown-//'`"
# Some configurations imply other options.
elf=yes
# The configure fragment of a port can modify these to supplement
# or override the table in the case statement below. No fragment should
# ever change the config_* variables, however.
machine=$config_machine
vendor=$config_vendor
os=$config_os
base_os=''
submachine=
AC_ARG_WITH([cpu],
AS_HELP_STRING([--with-cpu=CPU], [select code for CPU variant]),
[dnl
case "$withval" in
yes|'') AC_MSG_ERROR([--with-cpu requires an argument]) ;;
no) ;;
*) submachine="$withval" ;;
esac
])
# An preconfigure script can set this when it wants to disable the sanity
# check below.
libc_config_ok=no
# A preconfigure script for a system that may or may not use fpu
# sysdeps directories sets this to a preprocessor conditional for
# whether to use such directories.
with_fp_cond=1
dnl Let sysdeps/*/preconfigure act here.
LIBC_PRECONFIGURE([$srcdir], [for sysdeps])
###
### By using the undocumented --enable-hacker-mode option for configure
### one can skip this test to make the configuration not fail for unsupported
### platforms.
###
if test -z "$enable_hacker_mode" && test x"$libc_config_ok" != xyes; then
case "$machine-$host_os" in
*-linux* | *-gnu*)
;;
*)
AC_MSG_ERROR([
*** The GNU C library is currently unavailable for this platform.
*** If you are interested in seeing glibc on this platform visit
*** the "How to submit a new port" in the wiki:
*** https://sourceware.org/glibc/wiki/#Development
*** and join the community!])
;;
esac
fi
# Set base_machine if not set by a preconfigure fragment.
test -n "$base_machine" || base_machine=$machine
AC_SUBST(base_machine)
### Locate tools.
AC_PROG_INSTALL
if test "$INSTALL" = "${srcdir}/scripts/install-sh -c"; then
# The makefiles need to use a different form to find it in $srcdir.
INSTALL='\$(..)./scripts/install-sh -c'
fi
AC_PROG_LN_S
LIBC_PROG_BINUTILS
# Accept binutils 2.25 or newer.
libc_cv_with_lld=no
case $($LD --version) in
"GNU gold"*)
# Accept gold 1.14 or higher
AC_CHECK_PROG_VER(LD, $LD, --version,
[GNU gold.* \([0-9][0-9]*\.[0-9.]*\)],
[1.1[4-9]*|1.[2-9][0-9]*|1.1[0-9][0-9]*|[2-9].*|[1-9][0-9]*],
LD=: critic_missing="$critic_missing GNU gold")
;;
"LLD"*)
# Accept LLD 13.0.0 or higher
AC_CHECK_PROG_VER(LD, $LD, --version,
[LLD.* \([0-9][0-9]*\.[0-9.]*\)],
[1[3-9].*|[2-9][0-9].*],
LD=: critic_missing="$critic_missing LLD")
libc_cv_with_lld=yes
;;
*)
AC_CHECK_PROG_VER(LD, $LD, --version,
[GNU ld.* \([0-9][0-9]*\.[0-9.]*\)],
[2.1[0-9][0-9]*|2.2[5-9]*|2.[3-9][0-9]*|[3-9].*|[1-9][0-9]*],
LD=: critic_missing="$critic_missing GNU ld")
;;
esac
LIBC_CONFIG_VAR([with-lld], [$libc_cv_with_lld])
# These programs are version sensitive.
AC_CHECK_PROG_VER(MAKE, gnumake gmake make, --version,
[GNU Make[^0-9]*\([0-9][0-9.]*\)],
[[4-9].* | [1-9][0-9]*], critic_missing="$critic_missing make")
AC_CHECK_PROG_VER(MSGFMT, gnumsgfmt gmsgfmt msgfmt, --version,
[GNU gettext.* \([0-9]*\.[0-9.]*\)],
[0.10.3[6-9]* | 0.10.[4-9][0-9]* | 0.1[1-9]* | 0.[2-9][0-9]* | [1-9].*],
MSGFMT=: aux_missing="$aux_missing msgfmt")
AC_CHECK_PROG_VER(MAKEINFO, makeinfo, --version,
[GNU texinfo.* \([0-9][0-9.]*\)],
[4.[7-9]*|4.[1-9][0-9]*|[5-9].*],
MAKEINFO=: aux_missing="$aux_missing makeinfo")
AC_CHECK_PROG_VER(SED, sed, --version,
[GNU sed[^0-9]* \([0-9]*\.[0-9.]*\)],
[3.0[2-9]*|3.[1-9]*|[4-9]*],
SED=: aux_missing="$aux_missing sed")
AC_CHECK_PROG_VER(AWK, gawk, --version,
[GNU Awk[^0-9]*\([0-9][0-9.]*\)],
[3.1.[2-9]*|3.[2-9]*|[4-9]*], critic_missing="$critic_missing gawk")
AC_CHECK_PROG_VER(BISON, bison, --version,
[bison (GNU Bison) \([0-9]*\.[0-9.]*\)],
[2.7*|[3-9].*|[1-9][0-9]*], critic_missing="$critic_missing bison")
AC_CACHE_CHECK([if $CC is sufficient to build libc], libc_cv_compiler_ok, [
AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[]], [[
#if !defined __GNUC__ || __GNUC__ < 6 || (__GNUC__ == 6 && __GNUC_MINOR__ < 2)
#error insufficient compiler
#endif]])],
[libc_cv_compiler_ok=yes],
[libc_cv_compiler_ok=no])])
AS_IF([test $libc_cv_compiler_ok != yes],
[critic_missing="$critic_missing compiler"])
if test "x$maintainer" = "xyes"; then
AC_CHECK_PROGS(AUTOCONF, autoconf, no)
case "x$AUTOCONF" in
xno|x|x:) AUTOCONF=no ;;
*)
AC_CACHE_CHECK(dnl
whether $AUTOCONF${ACFLAGS:+ }$ACFLAGS works, libc_cv_autoconf_works, [dnl
if (cd $srcdir; $AUTOCONF $ACFLAGS configure.ac > /dev/null 2>&1); then
libc_cv_autoconf_works=yes
else
libc_cv_autoconf_works=no
fi])
test $libc_cv_autoconf_works = yes || AUTOCONF=no
;;
esac
if test "x$AUTOCONF" = xno; then
aux_missing="$aux_missing autoconf"
fi
else
AUTOCONF=no
fi
# Check for python3 if available, or else python.
AC_CHECK_PROG_VER(PYTHON_PROG, python3 python, --version,
[Python \([0-9][0-9.]*\)],
[3.[4-9]*|3.[1-9][0-9]*|[4-9].*|[1-9][0-9]*],
critic_missing="$critic_missing python")
PYTHON="$PYTHON_PROG -B"
AC_SUBST(PYTHON)
test -n "$critic_missing" && AC_MSG_ERROR([
*** These critical programs are missing or too old:$critic_missing
*** Check the INSTALL file for required versions.])
test -n "$aux_missing" && AC_MSG_WARN([
*** These auxiliary programs are missing or incompatible versions:$aux_missing
*** some features or tests will be disabled.
*** Check the INSTALL file for required versions.])
# Determine whether to use fpu or nofpu sysdeps directories.
AC_CACHE_CHECK([for use of fpu sysdeps directories],
libc_cv_with_fp, [dnl
cat > conftest.c <<EOF
#if $with_fp_cond
int dummy;
#else
# error "no hardware floating point"
#endif
EOF
libc_cv_with_fp=no
if ${CC-cc} $CFLAGS $CPPFLAGS -S conftest.c -o conftest.s \
1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ; then
libc_cv_with_fp=yes
fi
rm -f conftest*])
AC_SUBST(libc_cv_with_fp)
AC_CACHE_CHECK(for -fstack-protector, libc_cv_ssp, [dnl
LIBC_TRY_CC_OPTION([$CFLAGS $CPPFLAGS -Werror -fstack-protector],
[libc_cv_ssp=yes],
[libc_cv_ssp=no])
])
AC_CACHE_CHECK(for -fstack-protector-strong, libc_cv_ssp_strong, [dnl
LIBC_TRY_CC_OPTION([$CFLAGS $CPPFLAGS -Werror -fstack-protector-strong],
[libc_cv_ssp_strong=yes],
[libc_cv_ssp_strong=no])
])
AC_CACHE_CHECK(for -fstack-protector-all, libc_cv_ssp_all, [dnl
LIBC_TRY_CC_OPTION([$CFLAGS $CPPFLAGS -Werror -fstack-protector-all],
[libc_cv_ssp_all=yes],
[libc_cv_ssp_all=no])
])
stack_protector=
no_stack_protector=
if test "$libc_cv_ssp" = yes; then
no_stack_protector="-fno-stack-protector -DSTACK_PROTECTOR_LEVEL=0"
AC_DEFINE(HAVE_CC_NO_STACK_PROTECTOR)
fi
if test "$enable_stack_protector" = yes && test "$libc_cv_ssp" = yes; then
stack_protector="-fstack-protector"
AC_DEFINE(STACK_PROTECTOR_LEVEL, 1)
elif test "$enable_stack_protector" = all && test "$libc_cv_ssp_all" = yes; then
stack_protector="-fstack-protector-all"
AC_DEFINE(STACK_PROTECTOR_LEVEL, 2)
elif test "$enable_stack_protector" = strong && test "$libc_cv_ssp_strong" = yes; then
stack_protector="-fstack-protector-strong"
AC_DEFINE(STACK_PROTECTOR_LEVEL, 3)
else
stack_protector="-fno-stack-protector"
AC_DEFINE(STACK_PROTECTOR_LEVEL, 0)
fi
AC_SUBST(libc_cv_ssp)
AC_SUBST(stack_protector)
AC_SUBST(no_stack_protector)
if test -n "$stack_protector"; then
dnl Don't run configure tests with stack-protection on, to avoid problems with
dnl bootstrapping.
no_ssp=-fno-stack-protector
else
no_ssp=
if test "$enable_stack_protector" != no; then
AC_MSG_ERROR([--enable-stack-protector=$enable_stack_protector specified, but specified level of stack protection is not supported by the compiler.])
fi
fi
# For the multi-arch option we need support in the assembler & linker.
AC_CACHE_CHECK([for assembler and linker STT_GNU_IFUNC support],
libc_cv_ld_gnu_indirect_function, [dnl
cat > conftest.S <<EOF
.type foo,%gnu_indirect_function
foo:
.globl _start
_start:
.globl __start
__start:
.data
#ifdef _LP64
.quad foo
#else
.long foo
#endif
EOF
libc_cv_ld_gnu_indirect_function=no
if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
-nostartfiles -nostdlib $no_ssp \
-o conftest conftest.S 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
# Do a link to see if the backend supports IFUNC relocs.
$READELF -r conftest 1>&AS_MESSAGE_LOG_FD
LC_ALL=C $READELF -Wr conftest | grep -q 'IRELATIVE\|R_SPARC_JMP_IREL' && {
libc_cv_ld_gnu_indirect_function=yes
}
fi
rm -f conftest*])
# Check if gcc supports attribute ifunc as it is used in libc_ifunc macro.
AC_CACHE_CHECK([for gcc attribute ifunc support],
libc_cv_gcc_indirect_function, [dnl
cat > conftest.c <<EOF
extern int func (int);
int used_func (int a)
{
return a;
}
static void *resolver ()
{
return &used_func;
}
extern __typeof (func) func __attribute__ ((ifunc ("resolver")));
EOF
libc_cv_gcc_indirect_function=no
if ${CC-cc} -c conftest.c -o conftest.o 1>&AS_MESSAGE_LOG_FD \
2>&AS_MESSAGE_LOG_FD ; then
if $READELF -s conftest.o | grep IFUNC >/dev/null 2>&AS_MESSAGE_LOG_FD; then
libc_cv_gcc_indirect_function=yes
fi
fi
rm -f conftest*])
# Check if linker supports textrel relocation with ifunc (used on elf/tests).
# Note that it relies on libc_cv_ld_gnu_indirect_function test above.
AC_CACHE_CHECK([whether the linker supports textrels along with ifunc],
libc_cv_textrel_ifunc, [dnl
cat > conftest.S <<EOF
.type foo,%gnu_indirect_function
foo:
.globl _start
_start:
.globl __start
__start:
.data
#ifdef _LP64
.quad foo
#else
.long foo
#endif
.text
.globl address
address:
#ifdef _LP64
.quad address
#else
.long address
#endif
EOF
libc_cv_textrel_ifunc=no
if test $libc_cv_ld_gnu_indirect_function = yes; then
if AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -nostartfiles -nostdlib $no_ssp -pie -o conftest conftest.S); then
libc_cv_textrel_ifunc=yes
fi
fi
rm -f conftest*])
AC_SUBST(libc_cv_textrel_ifunc)
# Check if CC supports attribute retain as it is used in attribute_used_retain macro.
AC_CACHE_CHECK([for GNU attribute retain support],
libc_cv_gnu_retain, [dnl
cat > conftest.c <<EOF
static int var __attribute__ ((used, retain, section ("__libc_atexit")));
EOF
libc_cv_gnu_retain=no
if ${CC-cc} -Werror -c conftest.c -o /dev/null 1>&AS_MESSAGE_LOG_FD \
2>&AS_MESSAGE_LOG_FD ; then
libc_cv_gnu_retain=yes
fi
rm -f conftest*])
if test $libc_cv_gnu_retain = yes; then
AC_DEFINE(HAVE_GNU_RETAIN)
fi
LIBC_CONFIG_VAR([have-gnu-retain], [$libc_cv_gnu_retain])
# Check if gcc warns about alias for function with incompatible types.
AC_CACHE_CHECK([if compiler warns about alias for function with incompatible types],
libc_cv_gcc_incompatible_alias, [dnl
cat > conftest.c <<EOF
int __redirect_foo (const void *s, int c);
__typeof (__redirect_foo) *foo_impl (void) __asm__ ("foo");
__typeof (__redirect_foo) *foo_impl (void)
{
return 0;
}
extern __typeof (__redirect_foo) foo_alias __attribute__ ((alias ("foo")));
EOF
libc_cv_gcc_incompatible_alias=yes
if ${CC-cc} -Werror -c conftest.c -o conftest.o 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ; then
libc_cv_gcc_incompatible_alias=no
fi
rm -f conftest*])
if test x"$libc_cv_ld_gnu_indirect_function" != xyes; then
if test x"$multi_arch" = xyes; then
AC_MSG_ERROR([--enable-multi-arch support requires assembler and linker support])
else
multi_arch=no
fi
fi
if test x"$libc_cv_gcc_indirect_function" != xyes; then
# GCC 8+ emits a warning for alias with incompatible types and it might
# fail to build ifunc resolvers aliases to either weak or internal
# symbols. Disables multiarch build in this case.
if test x"$libc_cv_gcc_incompatible_alias" = xyes; then
AC_MSG_WARN([gcc emits a warning for alias between functions of incompatible types])
if test x"$multi_arch" = xyes; then
AC_MSG_ERROR([--enable-multi-arch support requires a gcc with gnu-indirect-function support])
fi
AC_MSG_WARN([Multi-arch is disabled.])
multi_arch=no
elif test x"$multi_arch" = xyes; then
AC_MSG_WARN([--enable-multi-arch support recommends a gcc with gnu-indirect-function support.
Please use a gcc which supports it by default or configure gcc with --enable-gnu-indirect-function])
fi
fi
multi_arch_d=
if test x"$multi_arch" != xno; then
multi_arch_d=/multiarch
fi
# Compute the list of sysdep directories for this configuration.
# This can take a while to compute.
sysdep_dir=$srcdir/sysdeps
AC_MSG_CHECKING(sysdep dirs)
dnl We need to use [ and ] for other purposes for a while now.
changequote(,)dnl
# Make sco3.2v4 become sco3.2.4 and sunos4.1.1_U1 become sunos4.1.1.U1.
os="`echo $os | sed 's/\([0-9A-Z]\)[v_]\([0-9A-Z]\)/\1.\2/g'`"
test "x$base_os" != x || case "$os" in
gnu*)
base_os=mach/hurd ;;
linux*)
base_os=unix/sysv ;;
esac
# For sunos4.1.1, try sunos4.1.1, then sunos4.1, then sunos4, then sunos.
tail=$os
ostry=$os
while o=`echo $tail | sed 's/\.[^.]*$//'`; test $o != $tail; do
ostry="$ostry /$o"
tail=$o
done
o=`echo $tail | sed 's/[0-9]*$//'`
if test $o != $tail; then
ostry="$ostry /$o"
fi
# For linux-gnu, try linux-gnu, then linux.
o=`echo $tail | sed 's/-.*$//'`
if test $o != $tail; then
ostry="$ostry /$o"
fi
# For unix/sysv/sysv4, try unix/sysv/sysv4, then unix/sysv, then unix.
base=
tail=$base_os
while b=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$b"; do
set $b
base="$base /$1"
tail="$2"
done
# For sparc/sparc32, try sparc/sparc32 and then sparc.
mach=
tail=$machine${submachine:+/$submachine}
while m=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$m"; do
set $m
# Prepend the machine's FPU directory unless the architecture specific
# preconfigure disables it.
if test "$libc_cv_with_fp" = yes; then
maybe_fpu=/fpu
else
maybe_fpu=/nofpu
fi
# For each machine term, try it with and then without /multiarch.
for try_fpu in $maybe_fpu ''; do
for try_multi in $multi_arch_d ''; do
mach="$mach /$1$try_fpu$try_multi"
done
done
tail="$2"
done
dnl We are done with glob and regexp uses of [ and ]; return to autoconf.
changequote([,])dnl
# Find what sysdep directories exist.
sysnames=
for b in $base ''; do
for m0 in $mach ''; do
for v in /$vendor ''; do
test "$v" = / && continue
for o in /$ostry ''; do
test "$o" = / && continue
for m in $mach ''; do
try_suffix="$m0$b$v$o$m"
if test -n "$try_suffix"; then
try_srcdir="${srcdir}/"
try="sysdeps$try_suffix"
test -n "$enable_debug_configure" &&
echo "$0 [DEBUG]: try $try" >&2
if test -d "$try_srcdir$try"; then
sysnames="$sysnames $try"
{ test -n "$o" || test -n "$b"; } && os_used=t
{ test -n "$m" || test -n "$m0"; } && machine_used=t
case x${m0:-$m} in
x*/$submachine) submachine_used=t ;;
esac
fi
fi
done
done
done
done
done
# If the assembler supports gnu_indirect_function symbol type and the
# architecture supports multi-arch, we enable multi-arch by default.
case $sysnames in
*"$multi_arch_d"*)
;;
*)
test x"$multi_arch" = xdefault && multi_arch=no