1 dnl Process this file with autoconf to produce a configure script.
2 dnl Note we do not use AC_PREREQ here! See aclocal.m4 for what we use instead.
3 AC_INIT([GNU C Library], [(see version.h)], [https://sourceware.org/bugzilla/],
4 [glibc], [https://www.gnu.org/software/glibc/])
5 AC_CONFIG_SRCDIR([include/features.h])
6 AC_CONFIG_HEADERS([config.h])
7 AC_CONFIG_AUX_DIR([scripts])
9 ACX_PKGVERSION([GNU libc])
10 ACX_BUGURL([https://www.gnu.org/software/libc/bugs.html])
11 AC_DEFINE_UNQUOTED([PKGVERSION], ["$PKGVERSION"],
12 [Package description])
13 AC_DEFINE_UNQUOTED([REPORT_BUGS_TO], ["$REPORT_BUGS_TO"],
14 [Bug reporting address])
16 # Glibc should not depend on any header files
17 AC_DEFUN([_AC_INCLUDES_DEFAULT_REQUIREMENTS],
18 [m4_divert_text([DEFAULTS],
19 [ac_includes_default='/* none */'])])
21 # We require GCC, and by default use its preprocessor. Override AC_PROG_CPP
22 # here to work around the Autoconf issue discussed in
23 # <https://sourceware.org/ml/libc-alpha/2013-01/msg00721.html>.
24 AC_DEFUN([AC_PROG_CPP],
25 [AC_REQUIRE([AC_PROG_CC])dnl
26 AC_ARG_VAR([CPP], [C preprocessor])dnl
27 _AC_ARG_VAR_CPPFLAGS()dnl
28 # On Suns, sometimes $CPP names a directory.
29 if test -n "$CPP" && test -d "$CPP"; then
32 if test -z "$CPP"; then
38 # We require GCC. Override _AC_PROG_CC_C89 here to work around the Autoconf
40 # <https://sourceware.org/ml/libc-alpha/2013-01/msg00757.html>.
41 AC_DEFUN([_AC_PROG_CC_C89], [[$1]])
43 dnl This is here so we can set $subdirs directly based on configure fragments.
49 if test $host != $build; then
50 AC_CHECK_PROGS(BUILD_CC, gcc cc)
52 AC_SUBST(cross_compiling)
54 AC_CHECK_TOOL(READELF, readelf, false)
55 AC_CHECK_TOOL(OBJDUMP, objdump, false)
57 # We need the C++ compiler only for testing.
59 # It's useless to us if it can't link programs (e.g. missing -lstdc++).
60 AC_CACHE_CHECK([whether $CXX can link programs], libc_cv_cxx_link_ok, [dnl
62 # Default, dynamic case.
63 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
64 [libc_cv_cxx_link_ok=yes],
65 [libc_cv_cxx_link_ok=no])
67 old_LDFLAGS="$LDFLAGS"
68 LDFLAGS="$LDFLAGS -static"
69 AC_LINK_IFELSE([AC_LANG_SOURCE([
75 std::cout << "Hello, world!";
80 [libc_cv_cxx_link_ok=no])
81 LDFLAGS="$old_LDFLAGS"
83 AS_IF([test $libc_cv_cxx_link_ok != yes], [CXX=])
85 if test "`cd $srcdir; pwd -P`" = "`pwd -P`"; then
86 AC_MSG_ERROR([you must configure in a separate build directory])
89 # This will get text that should go into config.make.
92 # Check for a --with-gd argument and set libgd-LDFLAGS in config.make.
94 AS_HELP_STRING([--with-gd=DIR],
95 [find libgd include dir and library with prefix DIR]),
99 *) libgd_include="-I$withval/include"
100 libgd_ldflags="-L$withval/lib" ;;
103 AC_ARG_WITH([gd-include],
104 AS_HELP_STRING([--with-gd-include=DIR],
105 [find libgd include files in DIR]),
107 case "$with_gd_include" in
109 *) libgd_include="-I$withval" ;;
112 AC_ARG_WITH([gd-lib],
113 AS_HELP_STRING([--with-gd-lib=DIR],
114 [find libgd library files in DIR]),
116 case "$with_gd_lib" in
118 *) libgd_ldflags="-L$withval" ;;
122 if test -n "$libgd_include"; then
123 config_vars="$config_vars
124 CFLAGS-memusagestat.c = $libgd_include"
126 if test -n "$libgd_ldflags"; then
127 config_vars="$config_vars
128 libgd-LDFLAGS = $libgd_ldflags"
131 dnl Arguments to specify presence of other packages/features.
132 AC_ARG_WITH([binutils],
133 AS_HELP_STRING([--with-binutils=PATH],
134 [specify location of binutils (as and ld)]),
135 [path_binutils=$withval],
137 AC_ARG_WITH([selinux],
138 AS_HELP_STRING([--with-selinux],
139 [if building with SELinux support]),
140 [with_selinux=$withval],
143 AC_ARG_WITH([headers],
144 AS_HELP_STRING([--with-headers=PATH],
145 [location of system headers to use
146 (for example /usr/src/linux/include)
147 @<:@default=compiler default@:>@]),
148 [sysheaders=$withval],
152 AC_SUBST(use_default_link)
153 AC_ARG_WITH([default-link],
154 AS_HELP_STRING([--with-default-link],
155 [do not use explicit linker scripts]),
156 [use_default_link=$withval],
157 [use_default_link=no])
159 dnl Additional build flags injection.
160 AC_ARG_WITH([nonshared-cflags],
161 AS_HELP_STRING([--with-nonshared-cflags=CFLAGS],
162 [build nonshared libraries with additional CFLAGS]),
163 [extra_nonshared_cflags=$withval],
164 [extra_nonshared_cflags=])
165 AC_SUBST(extra_nonshared_cflags)
166 AC_ARG_WITH([rtld-early-cflags],
167 AS_HELP_STRING([--with-rtld-early-cflags=CFLAGS],
168 [build early initialization with additional CFLAGS]),
169 [rtld_early_cflags=$withval],
170 [rtld_early_cflags=])
171 AC_SUBST(rtld_early_cflags)
173 AC_ARG_WITH([timeoutfactor],
174 AS_HELP_STRING([--with-timeoutfactor=NUM],
175 [specify an integer to scale the timeout]),
176 [timeoutfactor=$withval],
178 AC_DEFINE_UNQUOTED(TIMEOUTFACTOR, $timeoutfactor)
180 AC_ARG_ENABLE([sanity-checks],
181 AS_HELP_STRING([--disable-sanity-checks],
182 [really do not use threads (should not be used except in special situations) @<:@default=yes@:>@]),
183 [enable_sanity=$enableval],
186 AC_ARG_ENABLE([shared],
187 AS_HELP_STRING([--enable-shared],
188 [build shared library @<:@default=yes if GNU ld@:>@]),
191 AC_ARG_ENABLE([profile],
192 AS_HELP_STRING([--enable-profile],
193 [build profiled library @<:@default=no@:>@]),
194 [profile=$enableval],
196 AC_ARG_ENABLE([default-pie],
197 AS_HELP_STRING([--disable-default-pie],
198 [Do not build glibc programs and the testsuite as PIE @<:@default=no@:>@]),
199 [default_pie=$enableval],
201 AC_ARG_ENABLE([timezone-tools],
202 AS_HELP_STRING([--disable-timezone-tools],
203 [do not install timezone tools @<:@default=install@:>@]),
204 [enable_timezone_tools=$enableval],
205 [enable_timezone_tools=yes])
206 AC_SUBST(enable_timezone_tools)
208 AC_ARG_ENABLE([hardcoded-path-in-tests],
209 AS_HELP_STRING([--enable-hardcoded-path-in-tests],
210 [hardcode newly built glibc path in tests @<:@default=no@:>@]),
211 [hardcoded_path_in_tests=$enableval],
212 [hardcoded_path_in_tests=no])
213 AC_SUBST(hardcoded_path_in_tests)
215 AC_ARG_ENABLE([hidden-plt],
216 AS_HELP_STRING([--disable-hidden-plt],
217 [do not hide internal function calls to avoid PLT]),
220 if test "x$hidden" = xno; then
224 AC_ARG_ENABLE([bind-now],
225 AS_HELP_STRING([--enable-bind-now],
226 [disable lazy relocations in DSOs]),
227 [bindnow=$enableval],
230 if test "x$bindnow" = xyes; then
234 dnl Build glibc with -fstack-protector, -fstack-protector-all, or
235 dnl -fstack-protector-strong.
236 AC_ARG_ENABLE([stack-protector],
237 AS_HELP_STRING([--enable-stack-protector=@<:@yes|no|all|strong@:>@],
238 [Use -fstack-protector[-all|-strong] to detect glibc buffer overflows]),
239 [enable_stack_protector=$enableval],
240 [enable_stack_protector=no])
241 case "$enable_stack_protector" in
242 all|yes|no|strong) ;;
243 *) AC_MSG_ERROR([Not a valid argument for --enable-stack-protector: \"$enable_stack_protector\"]);;
246 dnl On some platforms we cannot use dynamic loading. We must provide
247 dnl static NSS modules.
248 AC_ARG_ENABLE([static-nss],
249 AS_HELP_STRING([--enable-static-nss],
250 [build static NSS modules @<:@default=no@:>@]),
251 [static_nss=$enableval],
253 dnl Enable static NSS also if we build no shared objects.
254 if test x"$static_nss" = xyes || test x"$shared" = xno; then
256 AC_DEFINE(DO_STATIC_NSS)
259 AC_ARG_ENABLE([force-install],
260 AS_HELP_STRING([--disable-force-install],
261 [don't force installation of files from this package, even if they are older than the installed files]),
262 [force_install=$enableval],
264 AC_SUBST(force_install)
266 AC_ARG_ENABLE([maintainer-mode],
267 AS_HELP_STRING([--enable-maintainer-mode],
268 [enable make rules and dependencies not useful (and sometimes confusing) to the casual installer]),
269 [maintainer=$enableval],
272 dnl On some platforms we allow dropping compatibility with all kernel
274 AC_ARG_ENABLE([kernel],
275 AS_HELP_STRING([--enable-kernel=VERSION],
276 [compile for compatibility with kernel not older than VERSION]),
277 [minimum_kernel=$enableval],
279 dnl Prevent unreasonable values.
280 if test "$minimum_kernel" = yes || test "$minimum_kernel" = no; then
281 # Better nothing than this.
284 if test "$minimum_kernel" = current; then
285 minimum_kernel=`uname -r 2>/dev/null` || minimum_kernel=
289 dnl For the development we sometimes want gcc to issue even more warnings.
290 dnl This is not the default since many of the extra warnings are not
292 AC_ARG_ENABLE([all-warnings],
293 AS_HELP_STRING([--enable-all-warnings],
294 [enable all useful warnings gcc can issue]),
295 [all_warnings=$enableval],
297 AC_SUBST(all_warnings)
299 AC_ARG_ENABLE([werror],
300 AS_HELP_STRING([--disable-werror],
301 [do not build with -Werror]),
302 [enable_werror=$enableval],
304 AC_SUBST(enable_werror)
306 AC_ARG_ENABLE([multi-arch],
307 AS_HELP_STRING([--enable-multi-arch],
308 [enable single DSO with optimizations for multiple architectures]),
309 [multi_arch=$enableval],
310 [multi_arch=default])
312 AC_ARG_ENABLE([experimental-malloc],
313 AS_HELP_STRING([--disable-experimental-malloc],
314 [disable experimental malloc features]),
315 [experimental_malloc=$enableval],
316 [experimental_malloc=yes])
317 AC_SUBST(experimental_malloc)
319 AC_ARG_ENABLE([memory-tagging],
320 AS_HELP_STRING([--enable-memory-tagging],
321 [enable memory tagging if supported by the architecture @<:@default=no@:>@]),
322 [memory_tagging=$enableval],
324 if test "$memory_tagging" = yes; then
325 # Only enable this on architectures that support it.
332 AC_SUBST(memory_tagging)
334 AC_ARG_ENABLE([crypt],
335 AS_HELP_STRING([--disable-crypt],
336 [do not build nor install the passphrase hashing library, libcrypt]),
337 [build_crypt=$enableval],
339 AC_SUBST(build_crypt)
341 AC_ARG_ENABLE([nss-crypt],
342 AS_HELP_STRING([--enable-nss-crypt],
343 [enable libcrypt to use nss]),
344 [nss_crypt=$enableval],
346 if test x$build_libcrypt = xno && test x$nss_crypt = xyes; then
347 AC_MSG_WARN([--enable-nss-crypt has no effect when libcrypt is disabled])
350 if test x$nss_crypt = xyes; then
351 nss_includes=-I$(nss-config --includedir 2>/dev/null)
352 if test $? -ne 0; then
353 AC_MSG_ERROR([cannot find include directory with nss-config])
355 nspr_includes=-I$(nspr-config --includedir 2>/dev/null)
356 if test $? -ne 0; then
357 AC_MSG_ERROR([cannot find include directory with nspr-config])
360 CFLAGS="$CFLAGS $nss_includes $nspr_includes"
361 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([typedef int PRBool;
363 #include <nsslowhash.h>
364 void f (void) { NSSLOW_Init (); }])],
365 libc_cv_nss_crypt=yes,
367 cannot find NSS headers with lowlevel hash function interfaces]))
369 old_LDFLAGS="$LDFLAGS"
370 LIBS="$LIBS -lfreebl3"
371 AC_LINK_IFELSE([AC_LANG_PROGRAM([typedef int PRBool;
373 #include <nsslowhash.h>],
375 libc_cv_nss_crypt=yes,
377 cannot link program using lowlevel NSS hash functions]))
378 # Check to see if there is a static NSS cryptographic library.
379 # If there isn't then we can't link anything with libcrypt.a,
380 # and that might mean disabling some static tests.
381 LDFLAGS="$LDFLAGS -static"
382 AC_LINK_IFELSE([AC_LANG_PROGRAM([typedef int PRBool;
384 #include <nsslowhash.h>],
386 libc_cv_static_nss_crypt=yes,
387 libc_cv_static_nss_crypt=no)
388 LDFLAGS="$old_LDFLAGS"
393 libc_cv_static_nss_crypt=no
395 AC_SUBST(libc_cv_nss_crypt)
396 AC_SUBST(libc_cv_static_nss_crypt)
399 AC_ARG_ENABLE([systemtap],
400 [AS_HELP_STRING([--enable-systemtap],
401 [enable systemtap static probe points @<:@default=no@:>@])],
402 [systemtap=$enableval],
404 if test "x$systemtap" != xno; then
405 AC_CACHE_CHECK([for systemtap static probe support], libc_cv_sdt, [dnl
407 CFLAGS="-std=gnu11 $CFLAGS"
408 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <sys/sdt.h>
409 void foo (int i, void *p)
411 asm ("" STAP_PROBE_ASM (foo, bar, STAP_PROBE_ASM_TEMPLATE (2)) ""
412 :: STAP_PROBE_ASM_OPERANDS (2, i, p));
413 }]])], [libc_cv_sdt=yes], [libc_cv_sdt=no])
414 CFLAGS="$old_CFLAGS"])
415 if test $libc_cv_sdt = yes; then
416 AC_DEFINE([USE_STAP_PROBE])
417 elif test "x$systemtap" != xauto; then
418 AC_MSG_FAILURE([systemtap support needs sys/sdt.h with asm support])
422 AC_ARG_ENABLE([build-nscd],
423 [AS_HELP_STRING([--disable-build-nscd],
424 [disable building and installing the nscd daemon])],
425 [build_nscd=$enableval],
426 [build_nscd=default])
429 # Note the use of $use_nscd is near the bottom of the file.
430 AC_ARG_ENABLE([nscd],
431 [AS_HELP_STRING([--disable-nscd],
432 [library functions will not contact the nscd daemon])],
433 [use_nscd=$enableval],
436 AC_ARG_ENABLE([pt_chown],
437 [AS_HELP_STRING([--enable-pt_chown],
438 [Enable building and installing pt_chown])],
439 [build_pt_chown=$enableval],
441 AC_SUBST(build_pt_chown)
442 if test "$build_pt_chown" = yes; then
443 AC_DEFINE(HAVE_PT_CHOWN)
446 AC_ARG_ENABLE([tunables],
447 [AS_HELP_STRING([--enable-tunables],
448 [Enable tunables support. Known values are 'yes', 'no' and 'valstring'])],
449 [have_tunables=$enableval],
451 AC_SUBST(have_tunables)
452 if test "$have_tunables" = yes; then
453 AC_DEFINE(HAVE_TUNABLES)
456 # The abi-tags file uses a fairly simplistic model for name recognition that
457 # can't distinguish i486-pc-linux-gnu fully from i486-pc-gnu. So we mutate a
458 # $host_os of `gnu*' here to be `gnu-gnu*' just so that it can tell.
459 # This doesn't get used much beyond that, so it's fairly safe.
464 host_os=`echo $host_os | sed -e 's/gnu/gnu-gnu/'`
468 AC_ARG_ENABLE([mathvec],
469 [AS_HELP_STRING([--enable-mathvec],
470 [Enable building and installing mathvec @<:@default depends on architecture@:>@])],
471 [build_mathvec=$enableval],
472 [build_mathvec=notset])
474 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[]], [[
476 # error no CET compiler support
478 [libc_cv_compiler_default_cet=yes],
479 [libc_cv_compiler_default_cet=no])
482 AS_HELP_STRING([--enable-cet],
483 [enable Intel Control-flow Enforcement Technology (CET), x86 only]),
484 [enable_cet=$enableval],
485 [enable_cet=$libc_cv_compiler_default_cet])
488 AC_HELP_STRING([--disable-scv],
489 [syscalls will not use scv instruction, even if the kernel supports it, powerpc only]),
490 [use_scv=$enableval],
493 AS_IF([[test "$use_scv" != "no"]],[AC_DEFINE(USE_PPC_SCV)])
495 # We keep the original values in `$config_*' and never modify them, so we
496 # can write them unchanged into config.make. Everything else uses
497 # $machine, $vendor, and $os, and changes them whenever convenient.
498 config_machine=$host_cpu config_vendor=$host_vendor config_os=$host_os
500 # Don't allow vendor == "unknown"
501 test "$config_vendor" = unknown && config_vendor=
502 config_os="`echo $config_os | sed 's/^unknown-//'`"
504 # Some configurations imply other options.
507 # The configure fragment of a port can modify these to supplement
508 # or override the table in the case statement below. No fragment should
509 # ever change the config_* variables, however.
510 machine=$config_machine
511 vendor=$config_vendor
517 AS_HELP_STRING([--with-cpu=CPU], [select code for CPU variant]),
520 yes|'') AC_MSG_ERROR([--with-cpu requires an argument]) ;;
522 *) submachine="$withval" ;;
526 # An preconfigure script can set this when it wants to disable the sanity
530 # A preconfigure script for a system that may or may not use fpu
531 # sysdeps directories sets this to a preprocessor conditional for
532 # whether to use such directories.
535 dnl Let sysdeps/*/preconfigure act here.
536 LIBC_PRECONFIGURE([$srcdir], [for sysdeps])
540 ### By using the undocumented --enable-hacker-mode option for configure
541 ### one can skip this test to make the configuration not fail for unsupported
544 if test -z "$enable_hacker_mode" && test x"$libc_config_ok" != xyes; then
545 case "$machine-$host_os" in
550 *** The GNU C library is currently unavailable for this platform.
551 *** If you are interested in seeing glibc on this platform visit
552 *** the "How to submit a new port" in the wiki:
553 *** https://sourceware.org/glibc/wiki/#Development
554 *** and join the community!])
559 # Set base_machine if not set by a preconfigure fragment.
560 test -n "$base_machine" || base_machine=$machine
561 AC_SUBST(base_machine)
563 # Determine whether to use fpu or nofpu sysdeps directories.
564 AC_CACHE_CHECK([for use of fpu sysdeps directories],
565 libc_cv_with_fp, [dnl
566 cat > conftest.c <<EOF
570 # error "no hardware floating point"
574 if ${CC-cc} $CFLAGS $CPPFLAGS -S conftest.c -o conftest.s \
575 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ; then
579 AC_SUBST(libc_cv_with_fp)
581 AC_CACHE_CHECK(for -fstack-protector, libc_cv_ssp, [dnl
582 LIBC_TRY_CC_OPTION([$CFLAGS $CPPFLAGS -Werror -fstack-protector],
587 AC_CACHE_CHECK(for -fstack-protector-strong, libc_cv_ssp_strong, [dnl
588 LIBC_TRY_CC_OPTION([$CFLAGS $CPPFLAGS -Werror -fstack-protector-strong],
589 [libc_cv_ssp_strong=yes],
590 [libc_cv_ssp_strong=no])
593 AC_CACHE_CHECK(for -fstack-protector-all, libc_cv_ssp_all, [dnl
594 LIBC_TRY_CC_OPTION([$CFLAGS $CPPFLAGS -Werror -fstack-protector-all],
595 [libc_cv_ssp_all=yes],
596 [libc_cv_ssp_all=no])
601 if test "$libc_cv_ssp" = yes; then
602 no_stack_protector="-fno-stack-protector -DSTACK_PROTECTOR_LEVEL=0"
603 AC_DEFINE(HAVE_CC_NO_STACK_PROTECTOR)
606 if test "$enable_stack_protector" = yes && test "$libc_cv_ssp" = yes; then
607 stack_protector="-fstack-protector"
608 AC_DEFINE(STACK_PROTECTOR_LEVEL, 1)
609 elif test "$enable_stack_protector" = all && test "$libc_cv_ssp_all" = yes; then
610 stack_protector="-fstack-protector-all"
611 AC_DEFINE(STACK_PROTECTOR_LEVEL, 2)
612 elif test "$enable_stack_protector" = strong && test "$libc_cv_ssp_strong" = yes; then
613 stack_protector="-fstack-protector-strong"
614 AC_DEFINE(STACK_PROTECTOR_LEVEL, 3)
616 stack_protector="-fno-stack-protector"
617 AC_DEFINE(STACK_PROTECTOR_LEVEL, 0)
619 AC_SUBST(libc_cv_ssp)
620 AC_SUBST(stack_protector)
621 AC_SUBST(no_stack_protector)
623 if test -n "$stack_protector"; then
624 dnl Don't run configure tests with stack-protection on, to avoid problems with
626 no_ssp=-fno-stack-protector
630 if test "$enable_stack_protector" != no; then
631 AC_MSG_ERROR([--enable-stack-protector=$enable_stack_protector specified, but specified level of stack protection is not supported by the compiler.])
635 # For the multi-arch option we need support in the assembler & linker.
636 AC_CACHE_CHECK([for assembler and linker STT_GNU_IFUNC support],
637 libc_cv_ld_gnu_indirect_function, [dnl
638 cat > conftest.S <<EOF
639 .type foo,%gnu_indirect_function
652 libc_cv_ld_gnu_indirect_function=no
653 if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
654 -nostartfiles -nostdlib $no_ssp \
655 -o conftest conftest.S 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
656 # Do a link to see if the backend supports IFUNC relocs.
657 $READELF -r conftest 1>&AS_MESSAGE_LOG_FD
658 LC_ALL=C $READELF -Wr conftest | grep -q 'IRELATIVE\|R_SPARC_JMP_IREL' && {
659 libc_cv_ld_gnu_indirect_function=yes
664 # Check if gcc supports attribute ifunc as it is used in libc_ifunc macro.
665 AC_CACHE_CHECK([for gcc attribute ifunc support],
666 libc_cv_gcc_indirect_function, [dnl
667 cat > conftest.c <<EOF
668 extern int func (int);
669 int used_func (int a)
673 static void *resolver ()
677 extern __typeof (func) func __attribute__ ((ifunc ("resolver")));
679 libc_cv_gcc_indirect_function=no
680 if ${CC-cc} -c conftest.c -o conftest.o 1>&AS_MESSAGE_LOG_FD \
681 2>&AS_MESSAGE_LOG_FD ; then
682 if $READELF -s conftest.o | grep IFUNC >/dev/null 2>&AS_MESSAGE_LOG_FD; then
683 libc_cv_gcc_indirect_function=yes
688 # Check if linker supports textrel relocation with ifunc (used on elf/tests).
689 # Note that it relies on libc_cv_ld_gnu_indirect_function test above.
690 AC_CACHE_CHECK([whether the linker supports textrels along with ifunc],
691 libc_cv_textrel_ifunc, [dnl
692 cat > conftest.S <<EOF
693 .type foo,%gnu_indirect_function
714 libc_cv_textrel_ifunc=no
715 if test $libc_cv_ld_gnu_indirect_function = yes; then
716 if AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -nostartfiles -nostdlib $no_ssp -pie -o conftest conftest.S); then
717 libc_cv_textrel_ifunc=yes
721 AC_SUBST(libc_cv_textrel_ifunc)
723 # Check if CC supports attribute retain as it is used in attribute_used_retain macro.
724 AC_CACHE_CHECK([for GNU attribute retain support],
725 libc_cv_gnu_retain, [dnl
726 cat > conftest.c <<EOF
727 static int var __attribute__ ((used, retain, section ("__libc_atexit")));
729 libc_cv_gnu_retain=no
730 if ${CC-cc} -Werror -c conftest.c -o /dev/null 1>&AS_MESSAGE_LOG_FD \
731 2>&AS_MESSAGE_LOG_FD ; then
732 libc_cv_gnu_retain=yes
735 if test $libc_cv_gnu_retain = yes; then
736 AC_DEFINE(HAVE_GNU_RETAIN)
738 LIBC_CONFIG_VAR([have-gnu-retain], [$libc_cv_gnu_retain])
740 # Check if gcc warns about alias for function with incompatible types.
741 AC_CACHE_CHECK([if compiler warns about alias for function with incompatible types],
742 libc_cv_gcc_incompatible_alias, [dnl
743 cat > conftest.c <<EOF
744 int __redirect_foo (const void *s, int c);
746 __typeof (__redirect_foo) *foo_impl (void) __asm__ ("foo");
747 __typeof (__redirect_foo) *foo_impl (void)
752 extern __typeof (__redirect_foo) foo_alias __attribute__ ((alias ("foo")));
754 libc_cv_gcc_incompatible_alias=yes
755 if ${CC-cc} -Werror -c conftest.c -o conftest.o 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ; then
756 libc_cv_gcc_incompatible_alias=no
760 if test x"$libc_cv_ld_gnu_indirect_function" != xyes; then
761 if test x"$multi_arch" = xyes; then
762 AC_MSG_ERROR([--enable-multi-arch support requires assembler and linker support])
767 if test x"$libc_cv_gcc_indirect_function" != xyes; then
768 # GCC 8+ emits a warning for alias with incompatible types and it might
769 # fail to build ifunc resolvers aliases to either weak or internal
770 # symbols. Disables multiarch build in this case.
771 if test x"$libc_cv_gcc_incompatible_alias" = xyes; then
772 AC_MSG_WARN([gcc emits a warning for alias between functions of incompatible types])
773 if test x"$multi_arch" = xyes; then
774 AC_MSG_ERROR([--enable-multi-arch support requires a gcc with gnu-indirect-function support])
776 AC_MSG_WARN([Multi-arch is disabled.])
778 elif test x"$multi_arch" = xyes; then
779 AC_MSG_WARN([--enable-multi-arch support recommends a gcc with gnu-indirect-function support.
780 Please use a gcc which supports it by default or configure gcc with --enable-gnu-indirect-function])
784 if test x"$multi_arch" != xno; then
785 multi_arch_d=/multiarch
788 # Compute the list of sysdep directories for this configuration.
789 # This can take a while to compute.
790 sysdep_dir=$srcdir/sysdeps
791 AC_MSG_CHECKING(sysdep dirs)
792 dnl We need to use [ and ] for other purposes for a while now.
794 # Make sco3.2v4 become sco3.2.4 and sunos4.1.1_U1 become sunos4.1.1.U1.
795 os="`echo $os | sed 's/\([0-9A-Z]\)[v_]\([0-9A-Z]\)/\1.\2/g'`"
797 test "x$base_os" != x || case "$os" in
804 # For sunos4.1.1, try sunos4.1.1, then sunos4.1, then sunos4, then sunos.
807 while o=`echo $tail | sed 's/\.[^.]*$//'`; test $o != $tail; do
811 o=`echo $tail | sed 's/[0-9]*$//'`
812 if test $o != $tail; then
815 # For linux-gnu, try linux-gnu, then linux.
816 o=`echo $tail | sed 's/-.*$//'`
817 if test $o != $tail; then
821 # For unix/sysv/sysv4, try unix/sysv/sysv4, then unix/sysv, then unix.
824 while b=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$b"; do
830 # For sparc/sparc32, try sparc/sparc32 and then sparc.
832 tail=$machine${submachine:+/$submachine}
833 while m=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$m"; do
835 # Prepend the machine's FPU directory unless the architecture specific
836 # preconfigure disables it.
837 if test "$libc_cv_with_fp" = yes; then
842 # For each machine term, try it with and then without /multiarch.
843 for try_fpu in $maybe_fpu ''; do
844 for try_multi in $multi_arch_d ''; do
845 mach="$mach /$1$try_fpu$try_multi"
851 dnl We are done with glob and regexp uses of [ and ]; return to autoconf.
854 # Find what sysdep directories exist.
856 for b in $base ''; do
857 for m0 in $mach ''; do
858 for v in /$vendor ''; do
859 test "$v" = / && continue
860 for o in /$ostry ''; do
861 test "$o" = / && continue
862 for m in $mach ''; do
863 try_suffix="$m0$b$v$o$m"
864 if test -n "$try_suffix"; then
865 try_srcdir="${srcdir}/"
866 try="sysdeps$try_suffix"
867 test -n "$enable_debug_configure" &&
868 echo "$0 [DEBUG]: try $try" >&2
869 if test -d "$try_srcdir$try"; then
870 sysnames="$sysnames $try"
871 { test -n "$o" || test -n "$b"; } && os_used=t
872 { test -n "$m" || test -n "$m0"; } && machine_used=t
874 x*/$submachine) submachine_used=t ;;
884 # If the assembler supports gnu_indirect_function symbol type and the
885 # architecture supports multi-arch, we enable multi-arch by default.
890 test x"$multi_arch" = xdefault && multi_arch=no
893 if test x"$multi_arch" != xno; then
894 AC_DEFINE(USE_MULTIARCH)
898 if test -z "$os_used" && test "$os" != none; then
899 AC_MSG_ERROR(Operating system $os is not supported.)
901 if test -z "$machine_used" && test "$machine" != none; then
902 AC_MSG_ERROR(The $machine is not supported.)
904 if test -z "$submachine_used" && test -n "$submachine"; then
905 AC_MSG_ERROR(The $submachine subspecies of $host_cpu is not supported.)
909 # We have now validated the configuration.
911 # Expand the list of system names into a full list of directories
912 # from each element's parent name and Implies file (if present).
915 while test $# -gt 0; do
919 case " $names " in *" $name "*)
920 # Already in the list.
924 # Report each name as we discover it, so there is no long pause in output.
925 echo $ECHO_N "$name $ECHO_C" >&AS_MESSAGE_FD
927 name_base=`echo $name | sed -e 's@\(.*sysdeps\)/.*@\1@'`
931 *) xsrcdir=$srcdir/ ;;
933 test -n "$enable_debug_configure" &&
934 echo "[DEBUG]: name/Implies $xsrcdir$name/Implies" >&2
936 for implies_file in Implies Implies-before Implies-after; do
937 implies_type=`echo $implies_file | sed s/-/_/`
938 eval ${implies_type}=
939 if test -f $xsrcdir$name/$implies_file; then
940 # Collect more names from the `Implies' file (removing comments).
941 implied_candidate="`sed 's/#.*$//' < $xsrcdir$name/$implies_file`"
942 for x in $implied_candidate; do
944 if test -d $xsrcdir$name_base/$x; then
945 eval "${implies_type}=\"\$${implies_type} \$name_base/\$x\""
950 test -n "$enable_debug_configure" &&
951 echo "[DEBUG]: $name $implies_file $x try() {$try_srcdir}$try" >&2
952 if test $try != $xsrcdir$name_base/$x && test -d $try_srcdir$try;
954 eval "${implies_type}=\"\$${implies_type} \$try\""
957 if test $found = no; then
958 AC_MSG_WARN($name/$implies_file specifies nonexistent $x)
964 # Add NAME to the list of names.
967 # Find the parent of NAME, using the empty string if it has none.
969 parent="`echo $name | sed -n -e 's=/[^/]*$==' -e '/sysdeps$/q' -e p`"
972 test -n "$enable_debug_configure" &&
973 echo "[DEBUG]: $name Implies='$Implies' rest='$*' parent='$parent' \
974 Implies_before='$Implies_before' Implies_after='$Implies_after'" >&2
976 # Add the names implied by NAME, and NAME's parent (if it has one), to
977 # the list of names to be processed (the argument list). We prepend the
978 # implied names to the list and append the parent. We want implied
979 # directories to come before further directories inferred from the
980 # configuration components; this ensures that for sysv4, unix/common
981 # (implied by unix/sysv/sysv4) comes before unix/sysv (in ostry (here $*)
983 sysnames="`echo $Implies $* $Implies_before $parent $Implies_after`"
984 test -n "$sysnames" && set $sysnames
987 # Add the default directories.
988 default_sysnames="sysdeps/generic"
989 sysnames="$names $default_sysnames"
991 # The other names were emitted during the scan.
992 AC_MSG_RESULT($default_sysnames)
998 if test "$INSTALL" = "${srcdir}/scripts/install-sh -c"; then
999 # The makefiles need to use a different form to find it in $srcdir.
1000 INSTALL='\$(..)./scripts/install-sh -c'
1006 # Accept binutils 2.25 or newer.
1007 AC_CHECK_PROG_VER(AS, $AS, --version,
1008 [GNU assembler.* \([0-9]*\.[0-9.]*\)],
1009 [2.1[0-9][0-9]*|2.2[5-9]*|2.[3-9][0-9]*|[3-9].*|[1-9][0-9]*],
1010 AS=: critic_missing="$critic_missing as")
1013 case $($LD --version) in
1015 # Accept gold 1.14 or higher
1016 AC_CHECK_PROG_VER(LD, $LD, --version,
1017 [GNU gold.* \([0-9][0-9]*\.[0-9.]*\)],
1018 [1.1[4-9]*|1.[2-9][0-9]*|1.1[0-9][0-9]*|[2-9].*|[1-9][0-9]*],
1019 LD=: critic_missing="$critic_missing GNU gold")
1022 # Accept LLD 13.0.0 or higher
1023 AC_CHECK_PROG_VER(LD, $LD, --version,
1024 [LLD.* \([0-9][0-9]*\.[0-9.]*\)],
1025 [1[3-9].*|[2-9][0-9].*],
1026 LD=: critic_missing="$critic_missing LLD")
1027 libc_cv_with_lld=yes
1030 AC_CHECK_PROG_VER(LD, $LD, --version,
1031 [GNU ld.* \([0-9][0-9]*\.[0-9.]*\)],
1032 [2.1[0-9][0-9]*|2.2[5-9]*|2.[3-9][0-9]*|[3-9].*|[1-9][0-9]*],
1033 LD=: critic_missing="$critic_missing GNU ld")
1036 LIBC_CONFIG_VAR([with-lld], [$libc_cv_with_lld])
1038 # These programs are version sensitive.
1039 AC_CHECK_PROG_VER(MAKE, gnumake gmake make, --version,
1040 [GNU Make[^0-9]*\([0-9][0-9.]*\)],
1041 [[4-9].* | [1-9][0-9]*], critic_missing="$critic_missing make")
1043 AC_CHECK_PROG_VER(MSGFMT, gnumsgfmt gmsgfmt msgfmt, --version,
1044 [GNU gettext.* \([0-9]*\.[0-9.]*\)],
1045 [0.10.3[6-9]* | 0.10.[4-9][0-9]* | 0.1[1-9]* | 0.[2-9][0-9]* | [1-9].*],
1046 MSGFMT=: aux_missing="$aux_missing msgfmt")
1047 AC_CHECK_PROG_VER(MAKEINFO, makeinfo, --version,
1048 [GNU texinfo.* \([0-9][0-9.]*\)],
1049 [4.[7-9]*|4.[1-9][0-9]*|[5-9].*],
1050 MAKEINFO=: aux_missing="$aux_missing makeinfo")
1051 AC_CHECK_PROG_VER(SED, sed, --version,
1052 [GNU sed[^0-9]* \([0-9]*\.[0-9.]*\)],
1053 [3.0[2-9]*|3.[1-9]*|[4-9]*],
1054 SED=: aux_missing="$aux_missing sed")
1055 AC_CHECK_PROG_VER(AWK, gawk, --version,
1056 [GNU Awk[^0-9]*\([0-9][0-9.]*\)],
1057 [3.1.[2-9]*|3.[2-9]*|[4-9]*], critic_missing="$critic_missing gawk")
1058 AC_CHECK_PROG_VER(BISON, bison, --version,
1059 [bison (GNU Bison) \([0-9]*\.[0-9.]*\)],
1060 [2.7*|[3-9].*|[1-9][0-9]*], critic_missing="$critic_missing bison")
1062 AC_CACHE_CHECK([if $CC is sufficient to build libc], libc_cv_compiler_ok, [
1063 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[]], [[
1064 #if !defined __GNUC__ || __GNUC__ < 6 || (__GNUC__ == 6 && __GNUC_MINOR__ < 2)
1065 #error insufficient compiler
1067 [libc_cv_compiler_ok=yes],
1068 [libc_cv_compiler_ok=no])])
1069 AS_IF([test $libc_cv_compiler_ok != yes],
1070 [critic_missing="$critic_missing compiler"])
1072 AC_CHECK_TOOL(NM, nm, false)
1074 if test "x$maintainer" = "xyes"; then
1075 AC_CHECK_PROGS(AUTOCONF, autoconf, no)
1076 case "x$AUTOCONF" in
1077 xno|x|x:) AUTOCONF=no ;;
1080 whether $AUTOCONF${ACFLAGS:+ }$ACFLAGS works, libc_cv_autoconf_works, [dnl
1081 if (cd $srcdir; $AUTOCONF $ACFLAGS configure.ac > /dev/null 2>&1); then
1082 libc_cv_autoconf_works=yes
1084 libc_cv_autoconf_works=no
1086 test $libc_cv_autoconf_works = yes || AUTOCONF=no
1089 if test "x$AUTOCONF" = xno; then
1090 aux_missing="$aux_missing autoconf"
1096 # Check for python3 if available, or else python.
1097 AC_CHECK_PROG_VER(PYTHON_PROG, python3 python, --version,
1098 [Python \([0-9][0-9.]*\)],
1099 [3.[4-9]*|3.[1-9][0-9]*|[4-9].*|[1-9][0-9]*],
1100 critic_missing="$critic_missing python")
1101 PYTHON="$PYTHON_PROG -B"
1104 test -n "$critic_missing" && AC_MSG_ERROR([
1105 *** These critical programs are missing or too old:$critic_missing
1106 *** Check the INSTALL file for required versions.])
1108 test -n "$aux_missing" && AC_MSG_WARN([
1109 *** These auxiliary programs are missing or incompatible versions:$aux_missing
1110 *** some features or tests will be disabled.
1111 *** Check the INSTALL file for required versions.])
1113 # if using special system headers, find out the compiler's sekrit
1114 # header directory and add that to the list. NOTE: Only does the right
1115 # thing on a system that doesn't need fixincludes. (Not presently a problem.)
1116 if test -n "$sysheaders"; then
1117 SYSINCLUDES=-nostdinc
1118 for d in include include-fixed; do
1119 i=`$CC -print-file-name="$d"` && test "x$i" != x && test "x$i" != "x$d" &&
1120 SYSINCLUDES="$SYSINCLUDES -isystem $i"
1122 SYSINCLUDES="$SYSINCLUDES \
1123 -isystem `echo $sysheaders | sed 's/:/ -isystem /g'`"
1124 if test -n "$CXX"; then
1126 for cxxheaders in `$CXX -v -S -x c++ /dev/null -o /dev/null 2>&1 \
1127 | sed -n -e '1,/#include/d' -e 's/^ \(\/.*\/[cg]++\)/\1/p'`; do
1128 test "x$cxxheaders" != x &&
1129 CXX_SYSINCLUDES="$CXX_SYSINCLUDES -isystem $cxxheaders"
1133 AC_SUBST(SYSINCLUDES)
1134 AC_SUBST(CXX_SYSINCLUDES)
1136 # Obtain some C++ header file paths. This is used to make a local
1137 # copy of those headers in Makerules.
1138 if test -n "$CXX"; then
1139 find_cxx_header () {
1140 echo "#include <$1>" | $CXX -M -MP -x c++ - 2>/dev/null \
1141 | sed -n "\,$1:,{s/:\$//;p}"
1143 CXX_CSTDLIB_HEADER="$(find_cxx_header cstdlib)"
1144 CXX_CMATH_HEADER="$(find_cxx_header cmath)"
1145 CXX_BITS_STD_ABS_H="$(find_cxx_header bits/std_abs.h)"
1147 AC_SUBST(CXX_CSTDLIB_HEADER)
1148 AC_SUBST(CXX_CMATH_HEADER)
1149 AC_SUBST(CXX_BITS_STD_ABS_H)
1151 # Test if LD_LIBRARY_PATH contains the notation for the current directory
1152 # since this would lead to problems installing/building glibc.
1153 # LD_LIBRARY_PATH contains the current directory if one of the following
1155 # - one of the terminals (":" and ";") is the first or last sign
1156 # - two terminals occur directly after each other
1157 # - the path contains an element with a dot in it
1158 AC_MSG_CHECKING(LD_LIBRARY_PATH variable)
1160 case ${LD_LIBRARY_PATH} in
1161 [:\;]* | *[:\;] | *[:\;][:\;]* | *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* )
1162 ld_library_path_setting="contains current directory"
1165 ld_library_path_setting="ok"
1169 AC_MSG_RESULT($ld_library_path_setting)
1170 if test "$ld_library_path_setting" != "ok"; then
1172 *** LD_LIBRARY_PATH shouldn't contain the current directory when
1173 *** building glibc. Please change the environment variable
1174 *** and run configure again.])
1177 AC_PATH_PROG(BASH_SHELL, bash, no)
1179 AC_PATH_PROG(PERL, perl, no)
1180 if test "$PERL" != no &&
1181 (eval `$PERL -V:apiversion`; test `expr "$apiversion" \< 5` -ne 0); then
1184 AC_PATH_PROG(INSTALL_INFO, install-info, no,
1185 $PATH:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin)
1187 AC_CACHE_CHECK(for .set assembler directive, libc_cv_asm_set_directive, [dnl
1188 cat > conftest.s <<EOF
1191 .set glibc_conftest_frobozz,foo
1192 .globl glibc_conftest_frobozz
1194 # The alpha-dec-osf1 assembler gives only a warning for `.set'
1195 # (but it doesn't work), so we must do a linking check to be sure.
1196 cat > conftest1.c <<\EOF
1197 extern int glibc_conftest_frobozz;
1198 void _start() { glibc_conftest_frobozz = 1; }
1200 if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
1201 -nostartfiles -nostdlib $no_ssp \
1202 -o conftest conftest.s conftest1.c 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
1203 libc_cv_asm_set_directive=yes
1205 libc_cv_asm_set_directive=no
1208 if test $libc_cv_asm_set_directive = yes; then
1209 AC_DEFINE(HAVE_ASM_SET_DIRECTIVE)
1212 AC_CACHE_CHECK(linker support for protected data symbol,
1213 libc_cv_protected_data,
1214 [cat > conftest.c <<EOF
1215 int bar __attribute__ ((visibility ("protected"))) = 1;
1217 libc_cv_protected_data=no
1218 if AC_TRY_COMMAND(${CC-cc} -nostdlib -nostartfiles $no_ssp -fPIC -shared conftest.c -o conftest.so); then
1219 cat > conftest.c <<EOF
1221 int main (void) { return bar; }
1223 if AC_TRY_COMMAND(${CC-cc} -nostdlib -nostartfiles $no_ssp conftest.c -o conftest conftest.so); then
1224 libc_cv_protected_data=yes
1229 AC_SUBST(libc_cv_protected_data)
1231 AC_CACHE_CHECK(linker support for INSERT in linker script,
1233 [cat > conftest.c <<EOF
1234 int __attribute__ ((section(".bar"))) bar = 0x12345678;
1235 int test (void) { return bar; }
1237 cat > conftest.t <<EOF
1242 INSERT AFTER .rela.dyn;
1245 if AC_TRY_COMMAND([${CC-cc} -nostdlib -nostartfiles $no_ssp -fPIC -shared conftest.c -Wl,-T,conftest.t -o conftest.so]); then
1250 AC_SUBST(libc_cv_insert)
1252 AC_CACHE_CHECK(for broken __attribute__((alias())),
1253 libc_cv_broken_alias_attribute,
1254 [cat > conftest.c <<EOF
1255 extern int foo (int x) __asm ("xyzzy");
1256 int bar (int x) { return x; }
1257 extern __typeof (bar) foo __attribute ((weak, alias ("bar")));
1259 extern __typeof (dfoo) dfoo __asm ("abccb");
1262 libc_cv_broken_alias_attribute=yes
1263 if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
1264 if grep 'xyzzy' conftest.s >/dev/null &&
1265 grep 'abccb' conftest.s >/dev/null; then
1266 libc_cv_broken_alias_attribute=no
1269 rm -f conftest.c conftest.s
1271 if test $libc_cv_broken_alias_attribute = yes; then
1272 AC_MSG_ERROR(working alias attribute support required)
1275 AC_CACHE_CHECK(whether to put _rtld_local into .sdata section,
1276 libc_cv_have_sdata_section,
1277 [echo "int i;" > conftest.c
1278 libc_cv_have_sdata_section=no
1279 if ${CC-cc} $LDFLAGS -fPIC -shared -Wl,--verbose conftest.c -o conftest.so 2>&1 \
1280 | grep '\.sdata' >/dev/null; then
1281 libc_cv_have_sdata_section=yes
1283 rm -f conftest.c conftest.so
1285 if test $libc_cv_have_sdata_section = yes; then
1286 AC_DEFINE(HAVE_SDATA_SECTION)
1289 AC_CACHE_CHECK(for libunwind-support in compiler,
1290 libc_cv_cc_with_libunwind, [
1291 cat > conftest.c <<EOF
1292 int main (void) { return 0; }
1294 if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -static -o conftest \
1295 conftest.c -v 2>&1 >/dev/null | grep ' -lunwind ' >/dev/null; then
1296 libc_cv_cc_with_libunwind=yes
1298 libc_cv_cc_with_libunwind=no
1301 AC_SUBST(libc_cv_cc_with_libunwind)
1302 if test $libc_cv_cc_with_libunwind = yes; then
1303 AC_DEFINE(HAVE_CC_WITH_LIBUNWIND)
1307 AC_CACHE_CHECK(whether --noexecstack is desirable for .S files,
1308 libc_cv_as_noexecstack, [dnl
1309 cat > conftest.c <<EOF
1312 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS
1313 -S -o conftest.s conftest.c 1>&AS_MESSAGE_LOG_FD]) \
1314 && grep .note.GNU-stack conftest.s >/dev/null \
1315 && AC_TRY_COMMAND([${CC-cc} $ASFLAGS -Wa,--noexecstack
1316 -c -o conftest.o conftest.s 1>&AS_MESSAGE_LOG_FD])
1318 libc_cv_as_noexecstack=yes
1320 libc_cv_as_noexecstack=no
1323 if test $libc_cv_as_noexecstack = yes; then
1324 ASFLAGS_config="$ASFLAGS_config -Wa,--noexecstack"
1326 AC_SUBST(ASFLAGS_config)
1328 LIBC_LINKER_FEATURE([-z execstack], [-Wl,-z,execstack],
1329 [libc_cv_z_execstack=yes], [libc_cv_z_execstack=no])
1330 AC_SUBST(libc_cv_z_execstack)
1332 LIBC_LINKER_FEATURE([-z start-stop-gc], [-Wl,-z,start-stop-gc],
1333 [libc_cv_z_start_stop_gc=yes], [libc_cv_z_start_stop_gc=no])
1334 LIBC_CONFIG_VAR([have-z-start-stop-gc], [$libc_cv_z_start_stop_gc])
1336 LIBC_LINKER_FEATURE([--depaudit], [-Wl,--depaudit,x],
1337 [libc_cv_depaudit=yes], [libc_cv_depaudit=no])
1338 LIBC_CONFIG_VAR([have-depaudit], [$libc_cv_depaudit])
1340 LIBC_LINKER_FEATURE([-z pack-relative-relocs],
1341 [-Wl,-z,pack-relative-relocs],
1342 [libc_cv_dt_relr=yes], [libc_cv_dt_relr=no])
1343 LIBC_CONFIG_VAR([have-dt-relr], [$libc_cv_dt_relr])
1345 LIBC_LINKER_FEATURE([--no-dynamic-linker],
1346 [-Wl,--no-dynamic-linker],
1347 [libc_cv_no_dynamic_linker=yes],
1348 [libc_cv_no_dynamic_linker=no])
1349 LIBC_CONFIG_VAR([have-no-dynamic-linker], [$libc_cv_no_dynamic_linker])
1351 AC_CACHE_CHECK(for -static-pie, libc_cv_static_pie, [dnl
1352 LIBC_TRY_CC_OPTION([-static-pie],
1353 [libc_cv_static_pie=yes],
1354 [libc_cv_static_pie=no])
1356 LIBC_CONFIG_VAR([have-static-pie], [$libc_cv_static_pie])
1358 AC_CACHE_CHECK(for -fpie, libc_cv_fpie, [dnl
1359 LIBC_TRY_CC_OPTION([-fpie], [libc_cv_fpie=yes], [libc_cv_fpie=no])
1362 AC_SUBST(libc_cv_fpie)
1364 AC_CACHE_CHECK(for GLOB_DAT reloc,
1365 libc_cv_has_glob_dat, [dnl
1366 cat > conftest.c <<EOF
1368 int foo (void) { return mumble; }
1370 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1371 -fPIC -shared -o conftest.so conftest.c
1372 -nostdlib -nostartfiles $no_ssp
1373 1>&AS_MESSAGE_LOG_FD])
1375 dnl look for GLOB_DAT relocation.
1376 if $READELF -rW conftest.so | grep '_GLOB_DAT' > /dev/null; then
1377 libc_cv_has_glob_dat=yes
1379 libc_cv_has_glob_dat=no
1382 libc_cv_has_glob_dat=no
1385 AC_SUBST(libc_cv_has_glob_dat)
1387 AC_CACHE_CHECK([for -mtls-dialect=gnu2], libc_cv_mtls_dialect_gnu2,
1389 cat > conftest.c <<EOF
1396 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -fPIC -mtls-dialect=gnu2 -nostdlib -nostartfiles
1397 conftest.c -o conftest 1>&AS_MESSAGE_LOG_FD])
1399 libc_cv_mtls_dialect_gnu2=yes
1401 libc_cv_mtls_dialect_gnu2=no
1404 AC_SUBST(libc_cv_mtls_dialect_gnu2)
1405 LIBC_CONFIG_VAR([have-mtls-dialect-gnu2], [$libc_cv_mtls_dialect_gnu2])
1407 AC_CACHE_CHECK(whether cc puts quotes around section names,
1408 libc_cv_have_section_quotes,
1409 [cat > conftest.c <<EOF
1410 static const int foo
1411 __attribute__ ((section ("bar"))) = 1;
1413 if ${CC-cc} -S conftest.c -o conftest.s; then
1414 if grep '\.section.*"bar"' conftest.s >/dev/null; then
1415 libc_cv_have_section_quotes=yes
1417 libc_cv_have_section_quotes=no
1420 libc_cv_have_section_quotes=unknown
1422 rm -f conftest.{c,s}
1424 if test $libc_cv_have_section_quotes = yes; then
1425 AC_DEFINE(HAVE_SECTION_QUOTES)
1428 AC_CACHE_CHECK(for __builtin_memset, libc_cv_gcc_builtin_memset, [dnl
1429 cat > conftest.c <<\EOF
1432 __builtin_memset (x, 0, 1000);
1436 if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | grep -F "memset" > /dev/null]);
1438 libc_cv_gcc_builtin_memset=no
1440 libc_cv_gcc_builtin_memset=yes
1443 if test "$libc_cv_gcc_builtin_memset" = yes ; then
1444 AC_DEFINE(HAVE_BUILTIN_MEMSET)
1447 AC_CACHE_CHECK(for redirection of built-in functions, libc_cv_gcc_builtin_redirection, [dnl
1448 cat > conftest.c <<\EOF
1449 extern char *strstr (const char *, const char *) __asm ("my_strstr");
1450 char *foo (const char *a, const char *b)
1452 return __builtin_strstr (a, b);
1456 if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | grep -F "my_strstr" > /dev/null]);
1458 libc_cv_gcc_builtin_redirection=yes
1460 libc_cv_gcc_builtin_redirection=no
1463 if test "$libc_cv_gcc_builtin_redirection" = no; then
1464 AC_MSG_ERROR([support for the symbol redirection needed])
1467 dnl Determine how to disable generation of FMA instructions.
1468 AC_CACHE_CHECK([for compiler option to disable generation of FMA instructions],
1469 libc_cv_cc_nofma, [dnl
1471 for opt in -ffp-contract=off -mno-fused-madd; do
1472 LIBC_TRY_CC_OPTION([$opt], [libc_cv_cc_nofma=$opt; break])
1474 AC_SUBST(libc_cv_cc_nofma)
1476 if test -n "$submachine"; then
1477 AC_CACHE_CHECK([for compiler option for CPU variant],
1478 libc_cv_cc_submachine, [dnl
1479 libc_cv_cc_submachine=no
1480 for opt in "-march=$submachine" "-mcpu=$submachine"; do
1481 LIBC_TRY_CC_OPTION([$opt], [
1482 libc_cv_cc_submachine="$opt"
1485 if test "x$libc_cv_cc_submachine" = xno; then
1486 AC_MSG_ERROR([${CC-cc} does not support $submachine])
1489 AC_SUBST(libc_cv_cc_submachine)
1491 AC_CACHE_CHECK(if $CC accepts -fno-tree-loop-distribute-patterns with \
1492 __attribute__ ((__optimize__)), libc_cv_cc_loop_to_function, [dnl
1493 cat > conftest.c <<EOF
1495 __attribute__ ((__optimize__ ("-fno-tree-loop-distribute-patterns")))
1498 libc_cv_cc_loop_to_function=no
1499 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c])
1501 libc_cv_cc_loop_to_function=yes
1504 if test $libc_cv_cc_loop_to_function = yes; then
1505 AC_DEFINE(HAVE_CC_INHIBIT_LOOP_TO_LIBCALL)
1507 AC_SUBST(libc_cv_cc_loop_to_function)
1509 dnl Check whether we have the gd library available.
1510 AC_MSG_CHECKING(for libgd)
1511 if test "$with_gd" != "no"; then
1512 old_CFLAGS="$CFLAGS"
1513 CFLAGS="$CFLAGS $libgd_include"
1514 old_LDFLAGS="$LDFLAGS"
1515 LDFLAGS="$LDFLAGS $libgd_ldflags"
1517 LIBS="$LIBS -lgd -lpng -lz -lm"
1518 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <gd.h>]], [[gdImagePng (0, 0)]])],
1519 [LIBGD=yes], [LIBGD=no])
1520 CFLAGS="$old_CFLAGS"
1521 LDFLAGS="$old_LDFLAGS"
1526 AC_MSG_RESULT($LIBGD)
1530 if test x$with_selinux = xno ; then
1533 # See if we have the SELinux library
1534 AC_CHECK_LIB(selinux, is_selinux_enabled,
1535 have_selinux=yes, have_selinux=no)
1536 if test x$with_selinux = xyes ; then
1537 if test x$have_selinux = xno ; then
1538 AC_MSG_ERROR([SELinux explicitly required, but SELinux library not found])
1542 # Check if we're building with SELinux support.
1543 if test "x$have_selinux" = xyes; then
1544 AC_DEFINE(HAVE_SELINUX, 1, [SELinux support])
1546 # See if we have the libaudit library
1547 AC_CHECK_LIB(audit, audit_log_user_avc_message,
1548 have_libaudit=yes, have_libaudit=no)
1549 if test "x$have_libaudit" = xyes; then
1550 AC_DEFINE(HAVE_LIBAUDIT, 1, [SELinux libaudit support])
1552 AC_SUBST(have_libaudit)
1554 # See if we have the libcap library
1555 AC_CHECK_LIB(cap, cap_init, have_libcap=yes, have_libcap=no)
1556 if test "x$have_libcap" = xyes; then
1557 AC_DEFINE(HAVE_LIBCAP, 1, [SELinux libcap support])
1559 AC_SUBST(have_libcap)
1561 AC_SUBST(have_selinux)
1564 dnl Check for silly hacked compilers predefining _FORTIFY_SOURCE.
1565 dnl Since we are building the implementations of the fortified functions here,
1566 dnl having the macro defined interacts very badly.
1567 dnl _FORTIFY_SOURCE requires compiler optimization level 1 (gcc -O1)
1568 dnl and above (see "man FEATURE_TEST_MACROS").
1569 dnl So do NOT replace AC_COMPILE_IFELSE with AC_PREPROC_IFELSE.
1570 AC_CACHE_CHECK([for _FORTIFY_SOURCE predefine], libc_cv_predef_fortify_source,
1571 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1572 #ifdef _FORTIFY_SOURCE
1575 [libc_cv_predef_fortify_source=no],
1576 [libc_cv_predef_fortify_source=yes])])
1577 if test $libc_cv_predef_fortify_source = yes; then
1578 CPPUNDEFS="${CPPUNDEFS:+$CPPUNDEFS }-U_FORTIFY_SOURCE"
1582 dnl Starting with binutils 2.35, GAS can attach multiple symbol versions
1583 dnl to one symbol (PR 23840).
1584 AC_CACHE_CHECK(whether the assembler requires one version per symbol,
1585 libc_cv_symver_needs_alias, [dnl
1586 cat > conftest.s <<EOF
1590 .symver testfunc, testfunc1@VERSION1
1591 .symver testfunc, testfunc1@VERSION2
1593 libc_cv_symver_needs_alias=no
1594 if ${CC-cc} $ASFLAGS -c conftest.s 2>&AS_MESSAGE_LOG_FD; then
1595 libc_cv_symver_needs_alias=no
1597 libc_cv_symver_needs_alias=yes
1601 if test "$libc_cv_symver_needs_alias" = yes; then
1602 AC_DEFINE(SYMVER_NEEDS_ALIAS)
1605 AC_CACHE_CHECK(for __builtin_trap with no external dependencies,
1606 libc_cv_builtin_trap, [dnl
1607 libc_cv_builtin_trap=no
1608 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[__builtin_trap ()]])],[
1609 libc_undefs=`$NM -u conftest.o |
1610 LC_ALL=C $AWK '$1 == "U" { print $2 | "sort -u"; next } { exit(1) }' \
1611 2>&AS_MESSAGE_LOG_FD` || {
1612 AC_MSG_ERROR([confusing output from $NM -u])
1614 echo >&AS_MESSAGE_LOG_FD "libc_undefs='$libc_undefs'"
1615 if test -z "$libc_undefs"; then
1616 libc_cv_builtin_trap=yes
1618 if test $libc_cv_builtin_trap = yes; then
1619 AC_DEFINE([HAVE_BUILTIN_TRAP])
1622 dnl C++ feature tests.
1625 AC_CACHE_CHECK([whether the C++ compiler supports thread_local],
1626 libc_cv_cxx_thread_local, [
1627 old_CXXFLAGS="$CXXFLAGS"
1628 CXXFLAGS="$CXXFLAGS -std=gnu++11"
1629 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
1632 // Compiler support.
1639 S * get () { return &s; }
1641 // libstdc++ support.
1642 #ifndef _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL
1643 #error __cxa_thread_atexit_impl not supported
1646 [libc_cv_cxx_thread_local=yes],
1647 [libc_cv_cxx_thread_local=no])
1648 CXXFLAGS="$old_CXXFLAGS"
1650 AC_SUBST(libc_cv_cxx_thread_local)
1653 dnl End of C++ feature tests.
1655 ### End of automated tests.
1656 ### Now run sysdeps configure fragments.
1658 # They also can set these variables.
1660 ldd_rewrite_script=no
1661 libc_cv_sysconfdir=$sysconfdir
1662 libc_cv_localstatedir=$localstatedir
1663 libc_cv_gcc_unwind_find_fde=no
1667 # Iterate over all the sysdep directories we will use, running their
1668 # configure fragments.
1669 for dir in $sysnames; do
1672 *) dest=$srcdir/$dir ;;
1674 if test -r $dest/configure; then
1675 AC_MSG_RESULT(running configure fragment for $dir)
1680 if test x"$build_mathvec" = xnotset; then
1683 LIBC_CONFIG_VAR([build-mathvec], [$build_mathvec])
1685 AC_SUBST(libc_extra_cflags)
1686 AC_SUBST(libc_extra_cppflags)
1688 if test x$libc_cv_gcc_unwind_find_fde = xyes; then
1689 AC_DEFINE(EXPORT_UNWIND_FIND_FDE)
1691 AC_SUBST(libc_cv_gcc_unwind_find_fde)
1693 # A sysdeps configure fragment can reset this if IFUNC is not actually
1694 # usable even though the assembler knows how to generate the symbol type.
1695 if test x"$libc_cv_ld_gnu_indirect_function" = xyes; then
1696 AC_DEFINE(HAVE_IFUNC)
1698 LIBC_CONFIG_VAR([have-ifunc], [$libc_cv_ld_gnu_indirect_function])
1700 if test x"$libc_cv_gcc_indirect_function" = xyes; then
1701 AC_DEFINE(HAVE_GCC_IFUNC)
1703 LIBC_CONFIG_VAR([have-gcc-ifunc], [$libc_cv_gcc_indirect_function])
1705 # This is far from the AC_ARG_ENABLE that sets it so that a sysdeps
1706 # configure fragment can override the value to prevent this AC_DEFINE.
1708 if test "x$use_nscd" != xno; then
1709 AC_DEFINE([USE_NSCD])
1711 if test "x$build_nscd" = xdefault; then
1712 build_nscd=$use_nscd
1715 AC_SUBST(libc_cv_slibdir)
1716 AC_SUBST(libc_cv_rtlddir)
1717 AC_SUBST(libc_cv_complocaledir)
1718 AC_SUBST(libc_cv_sysconfdir)
1719 AC_SUBST(libc_cv_localstatedir)
1720 AC_SUBST(libc_cv_rootsbindir)
1722 if test x$use_ldconfig = xyes; then
1723 AC_DEFINE(USE_LDCONFIG)
1725 AC_SUBST(use_ldconfig)
1726 AC_SUBST(ldd_rewrite_script)
1731 AC_CACHE_CHECK([whether -fPIC is default], libc_cv_pic_default,
1732 [libc_cv_pic_default=yes
1733 cat > conftest.c <<EOF
1734 #if defined __PIC__ || defined __pic__ || defined PIC || defined pic
1735 # error PIC is default.
1738 if eval "${CC-cc} -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
1739 libc_cv_pic_default=no
1742 LIBC_CONFIG_VAR([build-pic-default], [$libc_cv_pic_default])
1744 AC_CACHE_CHECK([whether -fPIE is default], libc_cv_cc_pie_default,
1745 [libc_cv_cc_pie_default=yes
1746 cat > conftest.c <<EOF
1747 #if defined __PIE__ || defined __pie__ || defined PIE || defined pie
1748 # error PIE is default.
1751 if eval "${CC-cc} -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
1752 libc_cv_cc_pie_default=no
1755 LIBC_CONFIG_VAR([cc-pie-default], [$libc_cv_cc_pie_default])
1757 AC_MSG_CHECKING(if we can build programs as PIE)
1758 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#ifdef PIE_UNSUPPORTED
1759 # error PIE is not supported
1760 #endif]])], [libc_cv_pie_supported=yes], [libc_cv_pie_supported=no])
1761 AC_MSG_RESULT($libc_cv_pie_supported)
1762 # Disable build-pie-default if target does not support it or glibc is
1763 # configured with --disable-default-pie.
1764 if test "x$default_pie" = xno; then
1765 build_pie_default=no
1767 build_pie_default=$libc_cv_pie_supported
1769 LIBC_CONFIG_VAR([build-pie-default], [$build_pie_default])
1771 AC_MSG_CHECKING(if we can build static PIE programs)
1772 libc_cv_static_pie_supported=$libc_cv_pie_supported
1773 if test "x$libc_cv_pie_supported" != xno \
1774 -a "$libc_cv_no_dynamic_linker" = yes; then
1775 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#ifndef SUPPORT_STATIC_PIE
1776 # error static PIE is not supported
1777 #endif]])], [libc_cv_static_pie_supported=yes],
1778 [libc_cv_static_pie_supported=no])
1780 AC_MSG_RESULT($libc_cv_static_pie_supported)
1782 # Enable static-pie only if it is available and glibc isn't configured
1783 # with --disable-default-pie.
1784 if test "x$default_pie" = xno; then
1785 libc_cv_static_pie=no
1787 libc_cv_static_pie=$libc_cv_static_pie_supported
1789 if test "$libc_cv_static_pie" = "yes"; then
1790 AC_DEFINE(ENABLE_STATIC_PIE)
1792 LIBC_CONFIG_VAR([enable-static-pie], [$libc_cv_static_pie])
1794 # Set the `multidir' variable by grabbing the variable from the compiler.
1795 # We do it once and save the result in a generated makefile.
1796 libc_cv_multidir=`${CC-cc} $CFLAGS $CPPFLAGS -print-multi-directory`
1797 AC_SUBST(libc_cv_multidir)
1800 AC_SUBST(static_nss)
1804 dnl See sysdeps/mach/configure.ac for this variable.
1805 AC_SUBST(mach_interface_list)
1807 VERSION=`sed -n -e 's/^#define VERSION "\([^"]*\)"/\1/p' < $srcdir/version.h`
1808 RELEASE=`sed -n -e 's/^#define RELEASE "\([^"]*\)"/\1/p' < $srcdir/version.h`
1812 if test "$pthread_in_libc" = yes; then
1813 AC_DEFINE(PTHREAD_IN_LIBC)
1815 AC_SUBST(pthread_in_libc)
1817 AC_CONFIG_FILES([config.make Makefile])
1818 AC_CONFIG_COMMANDS([default],[[
1819 case $CONFIG_FILES in *config.make*)
1820 echo "$config_vars" >> config.make;;
1822 test -d bits || mkdir bits]],[[config_vars='$config_vars']])