This repository has been archived by the owner on Feb 5, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 951
/
configure.ac
1872 lines (1700 loc) · 55.7 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])
AC_CONFIG_SRCDIR([include/features.h])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_AUX_DIR([scripts])
ACX_PKGVERSION([GNU libc])
ACX_BUGURL([http://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
AC_CHECK_TOOL(READELF, readelf, false)
# 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],
AC_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],
AC_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],
AC_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],
AC_HELP_STRING([--with-binutils=PATH],
[specify location of binutils (as and ld)]),
[path_binutils=$withval],
[path_binutils=''])
AC_ARG_WITH([selinux],
AC_HELP_STRING([--with-selinux],
[if building with SELinux support]),
[with_selinux=$withval],
[with_selinux=auto])
AC_ARG_WITH([headers],
AC_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],
AC_HELP_STRING([--with-default-link],
[do not use explicit linker scripts]),
[use_default_link=$withval],
[use_default_link=default])
dnl Additional build flags injection.
AC_ARG_WITH([nonshared-cflags],
AC_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_ENABLE([sanity-checks],
AC_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],
AC_HELP_STRING([--enable-shared],
[build shared library @<:@default=yes if GNU ld@:>@]),
[shared=$enableval],
[shared=yes])
AC_ARG_ENABLE([profile],
AC_HELP_STRING([--enable-profile],
[build profiled library @<:@default=no@:>@]),
[profile=$enableval],
[profile=no])
AC_ARG_ENABLE([static-pie],
AC_HELP_STRING([--enable-static-pie],
[enable static PIE support and use it in the testsuite @<:@default=no@:>@]),
[static_pie=$enableval],
[static_pie=no])
AC_ARG_ENABLE([timezone-tools],
AC_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],
AC_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([stackguard-randomization],
AC_HELP_STRING([--enable-stackguard-randomization],
[initialize __stack_chk_guard canary with a random number at program start]),
[enable_stackguard_randomize=$enableval],
[enable_stackguard_randomize=no])
if test "$enable_stackguard_randomize" = yes; then
AC_DEFINE(ENABLE_STACKGUARD_RANDOMIZE)
fi
AC_ARG_ENABLE([hidden-plt],
AC_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],
AC_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],
AC_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],
AC_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],
AC_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],
AC_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],
AC_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],
AC_HELP_STRING([--enable-all-warnings],
[enable all useful warnings gcc can issue]),
[all_warnings=$enableval],
[])
AC_SUBST(all_warnings)
AC_ARG_ENABLE([werror],
AC_HELP_STRING([--disable-werror],
[do not build with -Werror]),
[enable_werror=$enableval],
[enable_werror=yes])
AC_SUBST(enable_werror)
AC_ARG_ENABLE([multi-arch],
AC_HELP_STRING([--enable-multi-arch],
[enable single DSO with optimizations for multiple architectures]),
[multi_arch=$enableval],
[multi_arch=default])
AC_ARG_ENABLE([experimental-malloc],
AC_HELP_STRING([--disable-experimental-malloc],
[disable experimental malloc features]),
[experimental_malloc=$enableval],
[experimental_malloc=yes])
AC_SUBST(experimental_malloc)
AC_ARG_ENABLE([crypt],
AC_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],
AC_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([obsolete-rpc],
AC_HELP_STRING([--enable-obsolete-rpc],
[build and install the obsolete RPC code for link-time usage]),
[link_obsolete_rpc=$enableval],
[link_obsolete_rpc=no])
AC_SUBST(link_obsolete_rpc)
if test "$link_obsolete_rpc" = yes; then
AC_DEFINE(LINK_OBSOLETE_RPC)
fi
AC_ARG_ENABLE([obsolete-nsl],
AC_HELP_STRING([--enable-obsolete-nsl],
[build and install the obsolete libnsl library and depending NSS modules]),
[build_obsolete_nsl=$enableval],
[build_obsolete_nsl=no])
AC_SUBST(build_obsolete_nsl)
if test "$build_obsolete_nsl" = yes; then
AC_DEFINE(LINK_OBSOLETE_NSL)
fi
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_ARG_ENABLE([cet],
AC_HELP_STRING([--enable-cet],
[enable Intel Control-flow Enforcement Technology (CET), x86 only]),
[enable_cet=$enableval],
[enable_cet=no])
# 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)
# 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 -r conftest | grep 'no relocations' >/dev/null || {
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 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 --without-fp.
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
;;
esac
if test x"$multi_arch" != xno; then
AC_DEFINE(USE_MULTIARCH)
fi
AC_SUBST(multi_arch)
if test -z "$os_used" && test "$os" != none; then
AC_MSG_ERROR(Operating system $os is not supported.)
fi
if test -z "$machine_used" && test "$machine" != none; then
AC_MSG_ERROR(The $machine is not supported.)
fi
if test -z "$submachine_used" && test -n "$submachine"; then
AC_MSG_ERROR(The $submachine subspecies of $host_cpu is not supported.)
fi
AC_SUBST(submachine)
# We have now validated the configuration.
# Expand the list of system names into a full list of directories
# from each element's parent name and Implies file (if present).
set $sysnames
names=
while test $# -gt 0; do
name=$1
shift
case " $names " in *" $name "*)
# Already in the list.
continue
esac
# Report each name as we discover it, so there is no long pause in output.
echo $ECHO_N "$name $ECHO_C" >&AS_MESSAGE_FD
name_base=`echo $name | sed -e 's@\(.*sysdeps\)/.*@\1@'`
case $name in
/*) xsrcdir= ;;
*) xsrcdir=$srcdir/ ;;
esac
test -n "$enable_debug_configure" &&
echo "[DEBUG]: name/Implies $xsrcdir$name/Implies" >&2
for implies_file in Implies Implies-before Implies-after; do
implies_type=`echo $implies_file | sed s/-/_/`
eval ${implies_type}=
if test -f $xsrcdir$name/$implies_file; then
# Collect more names from the `Implies' file (removing comments).
implied_candidate="`sed 's/#.*$//' < $xsrcdir$name/$implies_file`"
for x in $implied_candidate; do
found=no
if test -d $xsrcdir$name_base/$x; then
eval "${implies_type}=\"\$${implies_type} \$name_base/\$x\""
found=yes
fi
try="sysdeps/$x"
try_srcdir=$srcdir/
test -n "$enable_debug_configure" &&
echo "[DEBUG]: $name $implies_file $x try() {$try_srcdir}$try" >&2
if test $try != $xsrcdir$name_base/$x && test -d $try_srcdir$try;
then
eval "${implies_type}=\"\$${implies_type} \$try\""
found=yes
fi
if test $found = no; then
AC_MSG_WARN($name/$implies_file specifies nonexistent $x)
fi
done
fi
done
# Add NAME to the list of names.
names="$names $name"
# Find the parent of NAME, using the empty string if it has none.
changequote(,)dnl
parent="`echo $name | sed -n -e 's=/[^/]*$==' -e '/sysdeps$/q' -e p`"
changequote([,])dnl
test -n "$enable_debug_configure" &&
echo "[DEBUG]: $name Implies='$Implies' rest='$*' parent='$parent' \
Implies_before='$Implies_before' Implies_after='$Implies_after'" >&2
# Add the names implied by NAME, and NAME's parent (if it has one), to
# the list of names to be processed (the argument list). We prepend the
# implied names to the list and append the parent. We want implied
# directories to come before further directories inferred from the
# configuration components; this ensures that for sysv4, unix/common
# (implied by unix/sysv/sysv4) comes before unix/sysv (in ostry (here $*)
# after sysv4).
sysnames="`echo $Implies $* $Implies_before $parent $Implies_after`"
test -n "$sysnames" && set $sysnames
done
# Add the default directories.
default_sysnames="sysdeps/generic"
sysnames="$names $default_sysnames"
AC_SUBST(sysnames)
# The other names were emitted during the scan.
AC_MSG_RESULT($default_sysnames)
### 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.
AC_CHECK_PROG_VER(AS, $AS, --version,
[GNU assembler.* \([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]*],
AS=: critic_missing="$critic_missing as")
if test -n "`$LD --version | sed -n 's/^GNU \(gold\).*$/\1/p'`"; then
# 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")
else
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")
fi
# These programs are version sensitive.
AC_CHECK_TOOL_PREFIX
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_TRY_COMPILE([], [
#if !defined __GNUC__ || __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 9)
#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"])
AC_CHECK_TOOL(NM, nm, false)
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