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)
55 # We need the C++ compiler only for testing.
57 # It's useless to us if it can't link programs (e.g. missing -lstdc++).
58 AC_CACHE_CHECK([whether $CXX can link programs], libc_cv_cxx_link_ok, [dnl
60 # Default, dynamic case.
61 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
62 [libc_cv_cxx_link_ok=yes],
63 [libc_cv_cxx_link_ok=no])
65 old_LDFLAGS="$LDFLAGS"
66 LDFLAGS="$LDFLAGS -static"
67 AC_LINK_IFELSE([AC_LANG_SOURCE([
73 std::cout << "Hello, world!";
78 [libc_cv_cxx_link_ok=no])
79 LDFLAGS="$old_LDFLAGS"
81 AS_IF([test $libc_cv_cxx_link_ok != yes], [CXX=])
83 if test "`cd $srcdir; pwd -P`" = "`pwd -P`"; then
84 AC_MSG_ERROR([you must configure in a separate build directory])
87 # This will get text that should go into config.make.
90 # Check for a --with-gd argument and set libgd-LDFLAGS in config.make.
92 AS_HELP_STRING([--with-gd=DIR],
93 [find libgd include dir and library with prefix DIR]),
97 *) libgd_include="-I$withval/include"
98 libgd_ldflags="-L$withval/lib" ;;
101 AC_ARG_WITH([gd-include],
102 AS_HELP_STRING([--with-gd-include=DIR],
103 [find libgd include files in DIR]),
105 case "$with_gd_include" in
107 *) libgd_include="-I$withval" ;;
110 AC_ARG_WITH([gd-lib],
111 AS_HELP_STRING([--with-gd-lib=DIR],
112 [find libgd library files in DIR]),
114 case "$with_gd_lib" in
116 *) libgd_ldflags="-L$withval" ;;
120 if test -n "$libgd_include"; then
121 config_vars="$config_vars
122 CFLAGS-memusagestat.c = $libgd_include"
124 if test -n "$libgd_ldflags"; then
125 config_vars="$config_vars
126 libgd-LDFLAGS = $libgd_ldflags"
129 dnl Arguments to specify presence of other packages/features.
130 AC_ARG_WITH([binutils],
131 AS_HELP_STRING([--with-binutils=PATH],
132 [specify location of binutils (as and ld)]),
133 [path_binutils=$withval],
135 AC_ARG_WITH([selinux],
136 AS_HELP_STRING([--with-selinux],
137 [if building with SELinux support]),
138 [with_selinux=$withval],
141 AC_ARG_WITH([headers],
142 AS_HELP_STRING([--with-headers=PATH],
143 [location of system headers to use
144 (for example /usr/src/linux/include)
145 @<:@default=compiler default@:>@]),
146 [sysheaders=$withval],
150 AC_SUBST(use_default_link)
151 AC_ARG_WITH([default-link],
152 AS_HELP_STRING([--with-default-link],
153 [do not use explicit linker scripts]),
154 [use_default_link=$withval],
155 [use_default_link=no])
157 dnl Additional build flags injection.
158 AC_ARG_WITH([nonshared-cflags],
159 AS_HELP_STRING([--with-nonshared-cflags=CFLAGS],
160 [build nonshared libraries with additional CFLAGS]),
161 [extra_nonshared_cflags=$withval],
162 [extra_nonshared_cflags=])
163 AC_SUBST(extra_nonshared_cflags)
164 AC_ARG_WITH([rtld-early-cflags],
165 AS_HELP_STRING([--with-rtld-early-cflags=CFLAGS],
166 [build early initialization with additional CFLAGS]),
167 [rtld_early_cflags=$withval],
168 [rtld_early_cflags=])
169 AC_SUBST(rtld_early_cflags)
171 AC_ARG_WITH([timeoutfactor],
172 AS_HELP_STRING([--with-timeoutfactor=NUM],
173 [specify an integer to scale the timeout]),
174 [timeoutfactor=$withval],
176 AC_DEFINE_UNQUOTED(TIMEOUTFACTOR, $timeoutfactor)
178 AC_ARG_ENABLE([sanity-checks],
179 AS_HELP_STRING([--disable-sanity-checks],
180 [really do not use threads (should not be used except in special situations) @<:@default=yes@:>@]),
181 [enable_sanity=$enableval],
184 AC_ARG_ENABLE([shared],
185 AS_HELP_STRING([--enable-shared],
186 [build shared library @<:@default=yes if GNU ld@:>@]),
189 AC_ARG_ENABLE([profile],
190 AS_HELP_STRING([--enable-profile],
191 [build profiled library @<:@default=no@:>@]),
192 [profile=$enableval],
194 AC_ARG_ENABLE([default-pie],
195 AS_HELP_STRING([--disable-default-pie],
196 [Do not build glibc programs and the testsuite as PIE @<:@default=no@:>@]),
197 [default_pie=$enableval],
199 AC_ARG_ENABLE([timezone-tools],
200 AS_HELP_STRING([--disable-timezone-tools],
201 [do not install timezone tools @<:@default=install@:>@]),
202 [enable_timezone_tools=$enableval],
203 [enable_timezone_tools=yes])
204 AC_SUBST(enable_timezone_tools)
206 AC_ARG_ENABLE([hardcoded-path-in-tests],
207 AS_HELP_STRING([--enable-hardcoded-path-in-tests],
208 [hardcode newly built glibc path in tests @<:@default=no@:>@]),
209 [hardcoded_path_in_tests=$enableval],
210 [hardcoded_path_in_tests=no])
211 AC_SUBST(hardcoded_path_in_tests)
213 AC_ARG_ENABLE([hidden-plt],
214 AS_HELP_STRING([--disable-hidden-plt],
215 [do not hide internal function calls to avoid PLT]),
218 if test "x$hidden" = xno; then
222 AC_ARG_ENABLE([bind-now],
223 AS_HELP_STRING([--enable-bind-now],
224 [disable lazy relocations in DSOs]),
225 [bindnow=$enableval],
228 if test "x$bindnow" = xyes; then
232 dnl Build glibc with -fstack-protector, -fstack-protector-all, or
233 dnl -fstack-protector-strong.
234 AC_ARG_ENABLE([stack-protector],
235 AS_HELP_STRING([--enable-stack-protector=@<:@yes|no|all|strong@:>@],
236 [Use -fstack-protector[-all|-strong] to detect glibc buffer overflows]),
237 [enable_stack_protector=$enableval],
238 [enable_stack_protector=no])
239 case "$enable_stack_protector" in
240 all|yes|no|strong) ;;
241 *) AC_MSG_ERROR([Not a valid argument for --enable-stack-protector: \"$enable_stack_protector\"]);;
244 dnl On some platforms we cannot use dynamic loading. We must provide
245 dnl static NSS modules.
246 AC_ARG_ENABLE([static-nss],
247 AS_HELP_STRING([--enable-static-nss],
248 [build static NSS modules @<:@default=no@:>@]),
249 [static_nss=$enableval],
251 dnl Enable static NSS also if we build no shared objects.
252 if test x"$static_nss" = xyes || test x"$shared" = xno; then
254 AC_DEFINE(DO_STATIC_NSS)
257 AC_ARG_ENABLE([force-install],
258 AS_HELP_STRING([--disable-force-install],
259 [don't force installation of files from this package, even if they are older than the installed files]),
260 [force_install=$enableval],
262 AC_SUBST(force_install)
264 AC_ARG_ENABLE([maintainer-mode],
265 AS_HELP_STRING([--enable-maintainer-mode],
266 [enable make rules and dependencies not useful (and sometimes confusing) to the casual installer]),
267 [maintainer=$enableval],
270 dnl On some platforms we allow dropping compatibility with all kernel
272 AC_ARG_ENABLE([kernel],
273 AS_HELP_STRING([--enable-kernel=VERSION],
274 [compile for compatibility with kernel not older than VERSION]),
275 [minimum_kernel=$enableval],
277 dnl Prevent unreasonable values.
278 if test "$minimum_kernel" = yes || test "$minimum_kernel" = no; then
279 # Better nothing than this.
282 if test "$minimum_kernel" = current; then
283 minimum_kernel=`uname -r 2>/dev/null` || minimum_kernel=
287 dnl For the development we sometimes want gcc to issue even more warnings.
288 dnl This is not the default since many of the extra warnings are not
290 AC_ARG_ENABLE([all-warnings],
291 AS_HELP_STRING([--enable-all-warnings],
292 [enable all useful warnings gcc can issue]),
293 [all_warnings=$enableval],
295 AC_SUBST(all_warnings)
297 AC_ARG_ENABLE([werror],
298 AS_HELP_STRING([--disable-werror],
299 [do not build with -Werror]),
300 [enable_werror=$enableval],
302 AC_SUBST(enable_werror)
304 AC_ARG_ENABLE([multi-arch],
305 AS_HELP_STRING([--enable-multi-arch],
306 [enable single DSO with optimizations for multiple architectures]),
307 [multi_arch=$enableval],
308 [multi_arch=default])
310 AC_ARG_ENABLE([experimental-malloc],
311 AS_HELP_STRING([--disable-experimental-malloc],
312 [disable experimental malloc features]),
313 [experimental_malloc=$enableval],
314 [experimental_malloc=yes])
315 AC_SUBST(experimental_malloc)
317 AC_ARG_ENABLE([memory-tagging],
318 AS_HELP_STRING([--enable-memory-tagging],
319 [enable memory tagging if supported by the architecture @<:@default=no@:>@]),
320 [memory_tagging=$enableval],
322 if test "$memory_tagging" = yes; then
323 # Only enable this on architectures that support it.
330 AC_SUBST(memory_tagging)
332 AC_ARG_ENABLE([crypt],
333 AS_HELP_STRING([--disable-crypt],
334 [do not build nor install the passphrase hashing library, libcrypt]),
335 [build_crypt=$enableval],
337 AC_SUBST(build_crypt)
339 AC_ARG_ENABLE([nss-crypt],
340 AS_HELP_STRING([--enable-nss-crypt],
341 [enable libcrypt to use nss]),
342 [nss_crypt=$enableval],
344 if test x$build_libcrypt = xno && test x$nss_crypt = xyes; then
345 AC_MSG_WARN([--enable-nss-crypt has no effect when libcrypt is disabled])
348 if test x$nss_crypt = xyes; then
349 nss_includes=-I$(nss-config --includedir 2>/dev/null)
350 if test $? -ne 0; then
351 AC_MSG_ERROR([cannot find include directory with nss-config])
353 nspr_includes=-I$(nspr-config --includedir 2>/dev/null)
354 if test $? -ne 0; then
355 AC_MSG_ERROR([cannot find include directory with nspr-config])
358 CFLAGS="$CFLAGS $nss_includes $nspr_includes"
359 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([typedef int PRBool;
361 #include <nsslowhash.h>
362 void f (void) { NSSLOW_Init (); }])],
363 libc_cv_nss_crypt=yes,
365 cannot find NSS headers with lowlevel hash function interfaces]))
367 old_LDFLAGS="$LDFLAGS"
368 LIBS="$LIBS -lfreebl3"
369 AC_LINK_IFELSE([AC_LANG_PROGRAM([typedef int PRBool;
371 #include <nsslowhash.h>],
373 libc_cv_nss_crypt=yes,
375 cannot link program using lowlevel NSS hash functions]))
376 # Check to see if there is a static NSS cryptographic library.
377 # If there isn't then we can't link anything with libcrypt.a,
378 # and that might mean disabling some static tests.
379 LDFLAGS="$LDFLAGS -static"
380 AC_LINK_IFELSE([AC_LANG_PROGRAM([typedef int PRBool;
382 #include <nsslowhash.h>],
384 libc_cv_static_nss_crypt=yes,
385 libc_cv_static_nss_crypt=no)
386 LDFLAGS="$old_LDFLAGS"
391 libc_cv_static_nss_crypt=no
393 AC_SUBST(libc_cv_nss_crypt)
394 AC_SUBST(libc_cv_static_nss_crypt)
397 AC_ARG_ENABLE([systemtap],
398 [AS_HELP_STRING([--enable-systemtap],
399 [enable systemtap static probe points @<:@default=no@:>@])],
400 [systemtap=$enableval],
402 if test "x$systemtap" != xno; then
403 AC_CACHE_CHECK([for systemtap static probe support], libc_cv_sdt, [dnl
405 CFLAGS="-std=gnu11 $CFLAGS"
406 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <sys/sdt.h>
407 void foo (int i, void *p)
409 asm ("" STAP_PROBE_ASM (foo, bar, STAP_PROBE_ASM_TEMPLATE (2)) ""
410 :: STAP_PROBE_ASM_OPERANDS (2, i, p));
411 }]])], [libc_cv_sdt=yes], [libc_cv_sdt=no])
412 CFLAGS="$old_CFLAGS"])
413 if test $libc_cv_sdt = yes; then
414 AC_DEFINE([USE_STAP_PROBE])
415 elif test "x$systemtap" != xauto; then
416 AC_MSG_FAILURE([systemtap support needs sys/sdt.h with asm support])
420 AC_ARG_ENABLE([build-nscd],
421 [AS_HELP_STRING([--disable-build-nscd],
422 [disable building and installing the nscd daemon])],
423 [build_nscd=$enableval],
424 [build_nscd=default])
427 # Note the use of $use_nscd is near the bottom of the file.
428 AC_ARG_ENABLE([nscd],
429 [AS_HELP_STRING([--disable-nscd],
430 [library functions will not contact the nscd daemon])],
431 [use_nscd=$enableval],
434 AC_ARG_ENABLE([pt_chown],
435 [AS_HELP_STRING([--enable-pt_chown],
436 [Enable building and installing pt_chown])],
437 [build_pt_chown=$enableval],
439 AC_SUBST(build_pt_chown)
440 if test "$build_pt_chown" = yes; then
441 AC_DEFINE(HAVE_PT_CHOWN)
444 AC_ARG_ENABLE([tunables],
445 [AS_HELP_STRING([--enable-tunables],
446 [Enable tunables support. Known values are 'yes', 'no' and 'valstring'])],
447 [have_tunables=$enableval],
449 AC_SUBST(have_tunables)
450 if test "$have_tunables" = yes; then
451 AC_DEFINE(HAVE_TUNABLES)
454 # The abi-tags file uses a fairly simplistic model for name recognition that
455 # can't distinguish i486-pc-linux-gnu fully from i486-pc-gnu. So we mutate a
456 # $host_os of `gnu*' here to be `gnu-gnu*' just so that it can tell.
457 # This doesn't get used much beyond that, so it's fairly safe.
462 host_os=`echo $host_os | sed -e 's/gnu/gnu-gnu/'`
466 AC_ARG_ENABLE([mathvec],
467 [AS_HELP_STRING([--enable-mathvec],
468 [Enable building and installing mathvec @<:@default depends on architecture@:>@])],
469 [build_mathvec=$enableval],
470 [build_mathvec=notset])
472 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[]], [[
474 # error no CET compiler support
476 [libc_cv_compiler_default_cet=yes],
477 [libc_cv_compiler_default_cet=no])
480 AS_HELP_STRING([--enable-cet],
481 [enable Intel Control-flow Enforcement Technology (CET), x86 only]),
482 [enable_cet=$enableval],
483 [enable_cet=$libc_cv_compiler_default_cet])
486 AC_HELP_STRING([--disable-scv],
487 [syscalls will not use scv instruction, even if the kernel supports it, powerpc only]),
488 [use_scv=$enableval],
491 AS_IF([[test "$use_scv" != "no"]],[AC_DEFINE(USE_PPC_SCV)])
493 # We keep the original values in `$config_*' and never modify them, so we
494 # can write them unchanged into config.make. Everything else uses
495 # $machine, $vendor, and $os, and changes them whenever convenient.
496 config_machine=$host_cpu config_vendor=$host_vendor config_os=$host_os
498 # Don't allow vendor == "unknown"
499 test "$config_vendor" = unknown && config_vendor=
500 config_os="`echo $config_os | sed 's/^unknown-//'`"
502 # Some configurations imply other options.
505 # The configure fragment of a port can modify these to supplement
506 # or override the table in the case statement below. No fragment should
507 # ever change the config_* variables, however.
508 machine=$config_machine
509 vendor=$config_vendor
515 AS_HELP_STRING([--with-cpu=CPU], [select code for CPU variant]),
518 yes|'') AC_MSG_ERROR([--with-cpu requires an argument]) ;;
520 *) submachine="$withval" ;;
524 # An preconfigure script can set this when it wants to disable the sanity
528 # A preconfigure script for a system that may or may not use fpu
529 # sysdeps directories sets this to a preprocessor conditional for
530 # whether to use such directories.
533 dnl Let sysdeps/*/preconfigure act here.
534 LIBC_PRECONFIGURE([$srcdir], [for sysdeps])
538 ### By using the undocumented --enable-hacker-mode option for configure
539 ### one can skip this test to make the configuration not fail for unsupported
542 if test -z "$enable_hacker_mode" && test x"$libc_config_ok" != xyes; then
543 case "$machine-$host_os" in
548 *** The GNU C library is currently unavailable for this platform.
549 *** If you are interested in seeing glibc on this platform visit
550 *** the "How to submit a new port" in the wiki:
551 *** https://sourceware.org/glibc/wiki/#Development
552 *** and join the community!])
557 # Set base_machine if not set by a preconfigure fragment.
558 test -n "$base_machine" || base_machine=$machine
559 AC_SUBST(base_machine)
564 if test "$INSTALL" = "${srcdir}/scripts/install-sh -c"; then
565 # The makefiles need to use a different form to find it in $srcdir.
566 INSTALL='\$(..)./scripts/install-sh -c'
572 # Accept binutils 2.25 or newer.
574 case $($LD --version) in
576 # Accept gold 1.14 or higher
577 AC_CHECK_PROG_VER(LD, $LD, --version,
578 [GNU gold.* \([0-9][0-9]*\.[0-9.]*\)],
579 [1.1[4-9]*|1.[2-9][0-9]*|1.1[0-9][0-9]*|[2-9].*|[1-9][0-9]*],
580 LD=: critic_missing="$critic_missing GNU gold")
583 # Accept LLD 13.0.0 or higher
584 AC_CHECK_PROG_VER(LD, $LD, --version,
585 [LLD.* \([0-9][0-9]*\.[0-9.]*\)],
586 [1[3-9].*|[2-9][0-9].*],
587 LD=: critic_missing="$critic_missing LLD")
591 AC_CHECK_PROG_VER(LD, $LD, --version,
592 [GNU ld.* \([0-9][0-9]*\.[0-9.]*\)],
593 [2.1[0-9][0-9]*|2.2[5-9]*|2.[3-9][0-9]*|[3-9].*|[1-9][0-9]*],
594 LD=: critic_missing="$critic_missing GNU ld")
597 LIBC_CONFIG_VAR([with-lld], [$libc_cv_with_lld])
599 # These programs are version sensitive.
600 AC_CHECK_PROG_VER(MAKE, gnumake gmake make, --version,
601 [GNU Make[^0-9]*\([0-9][0-9.]*\)],
602 [[4-9].* | [1-9][0-9]*], critic_missing="$critic_missing make")
604 AC_CHECK_PROG_VER(MSGFMT, gnumsgfmt gmsgfmt msgfmt, --version,
605 [GNU gettext.* \([0-9]*\.[0-9.]*\)],
606 [0.10.3[6-9]* | 0.10.[4-9][0-9]* | 0.1[1-9]* | 0.[2-9][0-9]* | [1-9].*],
607 MSGFMT=: aux_missing="$aux_missing msgfmt")
608 AC_CHECK_PROG_VER(MAKEINFO, makeinfo, --version,
609 [GNU texinfo.* \([0-9][0-9.]*\)],
610 [4.[7-9]*|4.[1-9][0-9]*|[5-9].*],
611 MAKEINFO=: aux_missing="$aux_missing makeinfo")
612 AC_CHECK_PROG_VER(SED, sed, --version,
613 [GNU sed[^0-9]* \([0-9]*\.[0-9.]*\)],
614 [3.0[2-9]*|3.[1-9]*|[4-9]*],
615 SED=: aux_missing="$aux_missing sed")
616 AC_CHECK_PROG_VER(AWK, gawk, --version,
617 [GNU Awk[^0-9]*\([0-9][0-9.]*\)],
618 [3.1.[2-9]*|3.[2-9]*|[4-9]*], critic_missing="$critic_missing gawk")
619 AC_CHECK_PROG_VER(BISON, bison, --version,
620 [bison (GNU Bison) \([0-9]*\.[0-9.]*\)],
621 [2.7*|[3-9].*|[1-9][0-9]*], critic_missing="$critic_missing bison")
623 AC_CACHE_CHECK([if $CC is sufficient to build libc], libc_cv_compiler_ok, [
624 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[]], [[
625 #if !defined __GNUC__ || __GNUC__ < 6 || (__GNUC__ == 6 && __GNUC_MINOR__ < 2)
626 #error insufficient compiler
628 [libc_cv_compiler_ok=yes],
629 [libc_cv_compiler_ok=no])])
630 AS_IF([test $libc_cv_compiler_ok != yes],
631 [critic_missing="$critic_missing compiler"])
633 if test "x$maintainer" = "xyes"; then
634 AC_CHECK_PROGS(AUTOCONF, autoconf, no)
636 xno|x|x:) AUTOCONF=no ;;
639 whether $AUTOCONF${ACFLAGS:+ }$ACFLAGS works, libc_cv_autoconf_works, [dnl
640 if (cd $srcdir; $AUTOCONF $ACFLAGS configure.ac > /dev/null 2>&1); then
641 libc_cv_autoconf_works=yes
643 libc_cv_autoconf_works=no
645 test $libc_cv_autoconf_works = yes || AUTOCONF=no
648 if test "x$AUTOCONF" = xno; then
649 aux_missing="$aux_missing autoconf"
655 # Check for python3 if available, or else python.
656 AC_CHECK_PROG_VER(PYTHON_PROG, python3 python, --version,
657 [Python \([0-9][0-9.]*\)],
658 [3.[4-9]*|3.[1-9][0-9]*|[4-9].*|[1-9][0-9]*],
659 critic_missing="$critic_missing python")
660 PYTHON="$PYTHON_PROG -B"
663 test -n "$critic_missing" && AC_MSG_ERROR([
664 *** These critical programs are missing or too old:$critic_missing
665 *** Check the INSTALL file for required versions.])
667 test -n "$aux_missing" && AC_MSG_WARN([
668 *** These auxiliary programs are missing or incompatible versions:$aux_missing
669 *** some features or tests will be disabled.
670 *** Check the INSTALL file for required versions.])
673 # Determine whether to use fpu or nofpu sysdeps directories.
674 AC_CACHE_CHECK([for use of fpu sysdeps directories],
675 libc_cv_with_fp, [dnl
676 cat > conftest.c <<EOF
680 # error "no hardware floating point"
684 if ${CC-cc} $CFLAGS $CPPFLAGS -S conftest.c -o conftest.s \
685 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ; then
689 AC_SUBST(libc_cv_with_fp)
691 AC_CACHE_CHECK(for -fstack-protector, libc_cv_ssp, [dnl
692 LIBC_TRY_CC_OPTION([$CFLAGS $CPPFLAGS -Werror -fstack-protector],
697 AC_CACHE_CHECK(for -fstack-protector-strong, libc_cv_ssp_strong, [dnl
698 LIBC_TRY_CC_OPTION([$CFLAGS $CPPFLAGS -Werror -fstack-protector-strong],
699 [libc_cv_ssp_strong=yes],
700 [libc_cv_ssp_strong=no])
703 AC_CACHE_CHECK(for -fstack-protector-all, libc_cv_ssp_all, [dnl
704 LIBC_TRY_CC_OPTION([$CFLAGS $CPPFLAGS -Werror -fstack-protector-all],
705 [libc_cv_ssp_all=yes],
706 [libc_cv_ssp_all=no])
711 if test "$libc_cv_ssp" = yes; then
712 no_stack_protector="-fno-stack-protector -DSTACK_PROTECTOR_LEVEL=0"
713 AC_DEFINE(HAVE_CC_NO_STACK_PROTECTOR)
716 if test "$enable_stack_protector" = yes && test "$libc_cv_ssp" = yes; then
717 stack_protector="-fstack-protector"
718 AC_DEFINE(STACK_PROTECTOR_LEVEL, 1)
719 elif test "$enable_stack_protector" = all && test "$libc_cv_ssp_all" = yes; then
720 stack_protector="-fstack-protector-all"
721 AC_DEFINE(STACK_PROTECTOR_LEVEL, 2)
722 elif test "$enable_stack_protector" = strong && test "$libc_cv_ssp_strong" = yes; then
723 stack_protector="-fstack-protector-strong"
724 AC_DEFINE(STACK_PROTECTOR_LEVEL, 3)
726 stack_protector="-fno-stack-protector"
727 AC_DEFINE(STACK_PROTECTOR_LEVEL, 0)
729 AC_SUBST(libc_cv_ssp)
730 AC_SUBST(stack_protector)
731 AC_SUBST(no_stack_protector)
733 if test -n "$stack_protector"; then
734 dnl Don't run configure tests with stack-protection on, to avoid problems with
736 no_ssp=-fno-stack-protector
740 if test "$enable_stack_protector" != no; then
741 AC_MSG_ERROR([--enable-stack-protector=$enable_stack_protector specified, but specified level of stack protection is not supported by the compiler.])
745 # For the multi-arch option we need support in the assembler & linker.
746 AC_CACHE_CHECK([for assembler and linker STT_GNU_IFUNC support],
747 libc_cv_ld_gnu_indirect_function, [dnl
748 cat > conftest.S <<EOF
749 .type foo,%gnu_indirect_function
762 libc_cv_ld_gnu_indirect_function=no
763 if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
764 -nostartfiles -nostdlib $no_ssp \
765 -o conftest conftest.S 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
766 # Do a link to see if the backend supports IFUNC relocs.
767 $READELF -r conftest 1>&AS_MESSAGE_LOG_FD
768 LC_ALL=C $READELF -Wr conftest | grep -q 'IRELATIVE\|R_SPARC_JMP_IREL' && {
769 libc_cv_ld_gnu_indirect_function=yes
774 # Check if gcc supports attribute ifunc as it is used in libc_ifunc macro.
775 AC_CACHE_CHECK([for gcc attribute ifunc support],
776 libc_cv_gcc_indirect_function, [dnl
777 cat > conftest.c <<EOF
778 extern int func (int);
779 int used_func (int a)
783 static void *resolver ()
787 extern __typeof (func) func __attribute__ ((ifunc ("resolver")));
789 libc_cv_gcc_indirect_function=no
790 if ${CC-cc} -c conftest.c -o conftest.o 1>&AS_MESSAGE_LOG_FD \
791 2>&AS_MESSAGE_LOG_FD ; then
792 if $READELF -s conftest.o | grep IFUNC >/dev/null 2>&AS_MESSAGE_LOG_FD; then
793 libc_cv_gcc_indirect_function=yes
798 # Check if linker supports textrel relocation with ifunc (used on elf/tests).
799 # Note that it relies on libc_cv_ld_gnu_indirect_function test above.
800 AC_CACHE_CHECK([whether the linker supports textrels along with ifunc],
801 libc_cv_textrel_ifunc, [dnl
802 cat > conftest.S <<EOF
803 .type foo,%gnu_indirect_function
824 libc_cv_textrel_ifunc=no
825 if test $libc_cv_ld_gnu_indirect_function = yes; then
826 if AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -nostartfiles -nostdlib $no_ssp -pie -o conftest conftest.S); then
827 libc_cv_textrel_ifunc=yes
831 AC_SUBST(libc_cv_textrel_ifunc)
833 # Check if CC supports attribute retain as it is used in attribute_used_retain macro.
834 AC_CACHE_CHECK([for GNU attribute retain support],
835 libc_cv_gnu_retain, [dnl
836 cat > conftest.c <<EOF
837 static int var __attribute__ ((used, retain, section ("__libc_atexit")));
839 libc_cv_gnu_retain=no
840 if ${CC-cc} -Werror -c conftest.c -o /dev/null 1>&AS_MESSAGE_LOG_FD \
841 2>&AS_MESSAGE_LOG_FD ; then
842 libc_cv_gnu_retain=yes
845 if test $libc_cv_gnu_retain = yes; then
846 AC_DEFINE(HAVE_GNU_RETAIN)
848 LIBC_CONFIG_VAR([have-gnu-retain], [$libc_cv_gnu_retain])
850 # Check if gcc warns about alias for function with incompatible types.
851 AC_CACHE_CHECK([if compiler warns about alias for function with incompatible types],
852 libc_cv_gcc_incompatible_alias, [dnl
853 cat > conftest.c <<EOF
854 int __redirect_foo (const void *s, int c);
856 __typeof (__redirect_foo) *foo_impl (void) __asm__ ("foo");
857 __typeof (__redirect_foo) *foo_impl (void)
862 extern __typeof (__redirect_foo) foo_alias __attribute__ ((alias ("foo")));
864 libc_cv_gcc_incompatible_alias=yes
865 if ${CC-cc} -Werror -c conftest.c -o conftest.o 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ; then
866 libc_cv_gcc_incompatible_alias=no
870 if test x"$libc_cv_ld_gnu_indirect_function" != xyes; then
871 if test x"$multi_arch" = xyes; then
872 AC_MSG_ERROR([--enable-multi-arch support requires assembler and linker support])
877 if test x"$libc_cv_gcc_indirect_function" != xyes; then
878 # GCC 8+ emits a warning for alias with incompatible types and it might
879 # fail to build ifunc resolvers aliases to either weak or internal
880 # symbols. Disables multiarch build in this case.
881 if test x"$libc_cv_gcc_incompatible_alias" = xyes; then
882 AC_MSG_WARN([gcc emits a warning for alias between functions of incompatible types])
883 if test x"$multi_arch" = xyes; then
884 AC_MSG_ERROR([--enable-multi-arch support requires a gcc with gnu-indirect-function support])
886 AC_MSG_WARN([Multi-arch is disabled.])
888 elif test x"$multi_arch" = xyes; then
889 AC_MSG_WARN([--enable-multi-arch support recommends a gcc with gnu-indirect-function support.
890 Please use a gcc which supports it by default or configure gcc with --enable-gnu-indirect-function])
894 if test x"$multi_arch" != xno; then
895 multi_arch_d=/multiarch
898 # Compute the list of sysdep directories for this configuration.
899 # This can take a while to compute.
900 sysdep_dir=$srcdir/sysdeps
901 AC_MSG_CHECKING(sysdep dirs)
902 dnl We need to use [ and ] for other purposes for a while now.
904 # Make sco3.2v4 become sco3.2.4 and sunos4.1.1_U1 become sunos4.1.1.U1.
905 os="`echo $os | sed 's/\([0-9A-Z]\)[v_]\([0-9A-Z]\)/\1.\2/g'`"
907 test "x$base_os" != x || case "$os" in
914 # For sunos4.1.1, try sunos4.1.1, then sunos4.1, then sunos4, then sunos.
917 while o=`echo $tail | sed 's/\.[^.]*$//'`; test $o != $tail; do
921 o=`echo $tail | sed 's/[0-9]*$//'`
922 if test $o != $tail; then
925 # For linux-gnu, try linux-gnu, then linux.
926 o=`echo $tail | sed 's/-.*$//'`
927 if test $o != $tail; then
931 # For unix/sysv/sysv4, try unix/sysv/sysv4, then unix/sysv, then unix.
934 while b=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$b"; do
940 # For sparc/sparc32, try sparc/sparc32 and then sparc.
942 tail=$machine${submachine:+/$submachine}
943 while m=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$m"; do
945 # Prepend the machine's FPU directory unless the architecture specific
946 # preconfigure disables it.
947 if test "$libc_cv_with_fp" = yes; then
952 # For each machine term, try it with and then without /multiarch.
953 for try_fpu in $maybe_fpu ''; do
954 for try_multi in $multi_arch_d ''; do
955 mach="$mach /$1$try_fpu$try_multi"
961 dnl We are done with glob and regexp uses of [ and ]; return to autoconf.
964 # Find what sysdep directories exist.
966 for b in $base ''; do
967 for m0 in $mach ''; do
968 for v in /$vendor ''; do
969 test "$v" = / && continue
970 for o in /$ostry ''; do
971 test "$o" = / && continue
972 for m in $mach ''; do
973 try_suffix="$m0$b$v$o$m"
974 if test -n "$try_suffix"; then
975 try_srcdir="${srcdir}/"
976 try="sysdeps$try_suffix"
977 test -n "$enable_debug_configure" &&
978 echo "$0 [DEBUG]: try $try" >&2
979 if test -d "$try_srcdir$try"; then
980 sysnames="$sysnames $try"
981 { test -n "$o" || test -n "$b"; } && os_used=t
982 { test -n "$m" || test -n "$m0"; } && machine_used=t
984 x*/$submachine) submachine_used=t ;;
994 # If the assembler supports gnu_indirect_function symbol type and the
995 # architecture supports multi-arch, we enable multi-arch by default.
1000 test x"$multi_arch" = xdefault && multi_arch=no
1003 if test x"$multi_arch" != xno; then
1004 AC_DEFINE(USE_MULTIARCH)
1006 AC_SUBST(multi_arch)
1008 if test -z "$os_used" && test "$os" != none; then
1009 AC_MSG_ERROR(Operating system $os is not supported.)
1011 if test -z "$machine_used" && test "$machine" != none; then
1012 AC_MSG_ERROR(The $machine is not supported.)
1014 if test -z "$submachine_used" && test -n "$submachine"; then
1015 AC_MSG_ERROR(The $submachine subspecies of $host_cpu is not supported.)
1017 AC_SUBST(submachine)
1019 # We have now validated the configuration.
1021 # Expand the list of system names into a full list of directories
1022 # from each element's parent name and Implies file (if present).
1025 while test $# -gt 0; do
1029 case " $names " in *" $name "*)
1030 # Already in the list.
1034 # Report each name as we discover it, so there is no long pause in output.
1035 echo $ECHO_N "$name $ECHO_C" >&AS_MESSAGE_FD
1037 name_base=`echo $name | sed -e 's@\(.*sysdeps\)/.*@\1@'`
1041 *) xsrcdir=$srcdir/ ;;
1043 test -n "$enable_debug_configure" &&
1044 echo "[DEBUG]: name/Implies $xsrcdir$name/Implies" >&2
1046 for implies_file in Implies Implies-before Implies-after; do
1047 implies_type=`echo $implies_file | sed s/-/_/`
1048 eval ${implies_type}=
1049 if test -f $xsrcdir$name/$implies_file; then
1050 # Collect more names from the `Implies' file (removing comments).
1051 implied_candidate="`sed 's/#.*$//' < $xsrcdir$name/$implies_file`"
1052 for x in $implied_candidate; do
1054 if test -d $xsrcdir$name_base/$x; then
1055 eval "${implies_type}=\"\$${implies_type} \$name_base/\$x\""
1060 test -n "$enable_debug_configure" &&
1061 echo "[DEBUG]: $name $implies_file $x try() {$try_srcdir}$try" >&2
1062 if test $try != $xsrcdir$name_base/$x && test -d $try_srcdir$try;
1064 eval "${implies_type}=\"\$${implies_type} \$try\""
1067 if test $found = no; then
1068 AC_MSG_WARN($name/$implies_file specifies nonexistent $x)
1074 # Add NAME to the list of names.
1075 names="$names $name"
1077 # Find the parent of NAME, using the empty string if it has none.
1079 parent="`echo $name | sed -n -e 's=/[^/]*$==' -e '/sysdeps$/q' -e p`"
1082 test -n "$enable_debug_configure" &&
1083 echo "[DEBUG]: $name Implies='$Implies' rest='$*' parent='$parent' \
1084 Implies_before='$Implies_before' Implies_after='$Implies_after'" >&2
1086 # Add the names implied by NAME, and NAME's parent (if it has one), to
1087 # the list of names to be processed (the argument list). We prepend the
1088 # implied names to the list and append the parent. We want implied
1089 # directories to come before further directories inferred from the
1090 # configuration components; this ensures that for sysv4, unix/common
1091 # (implied by unix/sysv/sysv4) comes before unix/sysv (in ostry (here $*)
1093 sysnames="`echo $Implies $* $Implies_before $parent $Implies_after`"
1094 test -n "$sysnames" && set $sysnames
1097 # Add the default directories.
1098 default_sysnames="sysdeps/generic"
1099 sysnames="$names $default_sysnames"
1101 # The other names were emitted during the scan.
1102 AC_MSG_RESULT($default_sysnames)
1104 # if using special system headers, find out the compiler's sekrit
1105 # header directory and add that to the list. NOTE: Only does the right
1106 # thing on a system that doesn't need fixincludes. (Not presently a problem.)
1107 if test -n "$sysheaders"; then
1108 SYSINCLUDES=-nostdinc
1109 for d in include include-fixed; do
1110 i=`$CC -print-file-name="$d"` && test "x$i" != x && test "x$i" != "x$d" &&
1111 SYSINCLUDES="$SYSINCLUDES -isystem $i"
1113 SYSINCLUDES="$SYSINCLUDES \
1114 -isystem `echo $sysheaders | sed 's/:/ -isystem /g'`"
1115 if test -n "$CXX"; then
1117 for cxxheaders in `$CXX -v -S -x c++ /dev/null -o /dev/null 2>&1 \
1118 | sed -n -e '1,/#include/d' -e 's/^ \(\/.*\/[cg]++\)/\1/p'`; do
1119 test "x$cxxheaders" != x &&
1120 CXX_SYSINCLUDES="$CXX_SYSINCLUDES -isystem $cxxheaders"
1124 AC_SUBST(SYSINCLUDES)
1125 AC_SUBST(CXX_SYSINCLUDES)
1127 # Obtain some C++ header file paths. This is used to make a local
1128 # copy of those headers in Makerules.
1129 if test -n "$CXX"; then
1130 find_cxx_header () {
1131 echo "#include <$1>" | $CXX -H -fsyntax-only -x c++ - 2>&1 \
1132 | $AWK '$1 == "."{print $2}'
1134 CXX_CSTDLIB_HEADER="$(find_cxx_header cstdlib)"
1135 CXX_CMATH_HEADER="$(find_cxx_header cmath)"
1136 CXX_BITS_STD_ABS_H="$(find_cxx_header bits/std_abs.h)"
1138 AC_SUBST(CXX_CSTDLIB_HEADER)
1139 AC_SUBST(CXX_CMATH_HEADER)
1140 AC_SUBST(CXX_BITS_STD_ABS_H)
1142 # Test if LD_LIBRARY_PATH contains the notation for the current directory
1143 # since this would lead to problems installing/building glibc.
1144 # LD_LIBRARY_PATH contains the current directory if one of the following
1146 # - one of the terminals (":" and ";") is the first or last sign
1147 # - two terminals occur directly after each other
1148 # - the path contains an element with a dot in it
1149 AC_MSG_CHECKING(LD_LIBRARY_PATH variable)
1151 case ${LD_LIBRARY_PATH} in
1152 [:\;]* | *[:\;] | *[:\;][:\;]* | *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* )
1153 ld_library_path_setting="contains current directory"
1156 ld_library_path_setting="ok"
1160 AC_MSG_RESULT($ld_library_path_setting)
1161 if test "$ld_library_path_setting" != "ok"; then
1163 *** LD_LIBRARY_PATH shouldn't contain the current directory when
1164 *** building glibc. Please change the environment variable
1165 *** and run configure again.])
1168 AC_PATH_PROG(BASH_SHELL, bash, no)
1170 AC_PATH_PROG(PERL, perl, no)
1171 if test "$PERL" != no &&
1172 (eval `$PERL -V:apiversion`; test `expr "$apiversion" \< 5` -ne 0); then
1175 AC_PATH_PROG(INSTALL_INFO, install-info, no,
1176 $PATH:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin)
1178 AC_CACHE_CHECK(for .set assembler directive, libc_cv_asm_set_directive, [dnl
1179 cat > conftest.s <<EOF
1182 .set glibc_conftest_frobozz,foo
1183 .globl glibc_conftest_frobozz
1185 # The alpha-dec-osf1 assembler gives only a warning for `.set'
1186 # (but it doesn't work), so we must do a linking check to be sure.
1187 cat > conftest1.c <<\EOF
1188 extern int glibc_conftest_frobozz;
1189 void _start() { glibc_conftest_frobozz = 1; }
1191 if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
1192 -nostartfiles -nostdlib $no_ssp \
1193 -o conftest conftest.s conftest1.c 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
1194 libc_cv_asm_set_directive=yes
1196 libc_cv_asm_set_directive=no
1199 if test $libc_cv_asm_set_directive = yes; then
1200 AC_DEFINE(HAVE_ASM_SET_DIRECTIVE)
1203 AC_CACHE_CHECK(linker support for protected data symbol,
1204 libc_cv_protected_data,
1205 [cat > conftest.c <<EOF
1206 int bar __attribute__ ((visibility ("protected"))) = 1;
1208 libc_cv_protected_data=no
1209 if AC_TRY_COMMAND(${CC-cc} -nostdlib -nostartfiles $no_ssp -fPIC -shared conftest.c -o conftest.so); then
1210 cat > conftest.c <<EOF
1212 int main (void) { return bar; }
1214 if AC_TRY_COMMAND(${CC-cc} -nostdlib -nostartfiles $no_ssp conftest.c -o conftest conftest.so); then
1215 libc_cv_protected_data=yes
1220 AC_SUBST(libc_cv_protected_data)
1222 AC_CACHE_CHECK(linker support for INSERT in linker script,
1224 [cat > conftest.c <<EOF
1225 int __attribute__ ((section(".bar"))) bar = 0x12345678;
1226 int test (void) { return bar; }
1228 cat > conftest.t <<EOF
1233 INSERT AFTER .rela.dyn;
1236 if AC_TRY_COMMAND([${CC-cc} -nostdlib -nostartfiles $no_ssp -fPIC -shared conftest.c -Wl,-T,conftest.t -o conftest.so]); then
1241 AC_SUBST(libc_cv_insert)
1243 AC_CACHE_CHECK(for broken __attribute__((alias())),
1244 libc_cv_broken_alias_attribute,
1245 [cat > conftest.c <<EOF
1246 extern int foo (int x) __asm ("xyzzy");
1247 int bar (int x) { return x; }
1248 extern __typeof (bar) foo __attribute ((weak, alias ("bar")));
1250 extern __typeof (dfoo) dfoo __asm ("abccb");
1253 libc_cv_broken_alias_attribute=yes
1254 if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
1255 if grep 'xyzzy' conftest.s >/dev/null &&
1256 grep 'abccb' conftest.s >/dev/null; then
1257 libc_cv_broken_alias_attribute=no
1260 rm -f conftest.c conftest.s
1262 if test $libc_cv_broken_alias_attribute = yes; then
1263 AC_MSG_ERROR(working alias attribute support required)
1266 AC_CACHE_CHECK(whether to put _rtld_local into .sdata section,
1267 libc_cv_have_sdata_section,
1268 [echo "int i;" > conftest.c
1269 libc_cv_have_sdata_section=no
1270 if ${CC-cc} $LDFLAGS -fPIC -shared -Wl,--verbose conftest.c -o conftest.so 2>&1 \
1271 | grep '\.sdata' >/dev/null; then
1272 libc_cv_have_sdata_section=yes
1274 rm -f conftest.c conftest.so
1276 if test $libc_cv_have_sdata_section = yes; then
1277 AC_DEFINE(HAVE_SDATA_SECTION)
1280 AC_CACHE_CHECK(for libunwind-support in compiler,
1281 libc_cv_cc_with_libunwind, [
1282 cat > conftest.c <<EOF
1283 int main (void) { return 0; }
1285 if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -static -o conftest \
1286 conftest.c -v 2>&1 >/dev/null | grep ' -lunwind ' >/dev/null; then
1287 libc_cv_cc_with_libunwind=yes
1289 libc_cv_cc_with_libunwind=no
1292 AC_SUBST(libc_cv_cc_with_libunwind)
1293 if test $libc_cv_cc_with_libunwind = yes; then
1294 AC_DEFINE(HAVE_CC_WITH_LIBUNWIND)
1298 AC_CACHE_CHECK(whether --noexecstack is desirable for .S files,
1299 libc_cv_as_noexecstack, [dnl
1300 cat > conftest.c <<EOF
1303 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS
1304 -S -o conftest.s conftest.c 1>&AS_MESSAGE_LOG_FD]) \
1305 && grep .note.GNU-stack conftest.s >/dev/null \
1306 && AC_TRY_COMMAND([${CC-cc} $ASFLAGS -Wa,--noexecstack
1307 -c -o conftest.o conftest.s 1>&AS_MESSAGE_LOG_FD])
1309 libc_cv_as_noexecstack=yes
1311 libc_cv_as_noexecstack=no
1314 if test $libc_cv_as_noexecstack = yes; then
1315 ASFLAGS_config="$ASFLAGS_config -Wa,--noexecstack"
1317 AC_SUBST(ASFLAGS_config)
1319 LIBC_LINKER_FEATURE([-z execstack], [-Wl,-z,execstack],
1320 [libc_cv_z_execstack=yes], [libc_cv_z_execstack=no])
1321 AC_SUBST(libc_cv_z_execstack)
1323 LIBC_LINKER_FEATURE([-z start-stop-gc], [-Wl,-z,start-stop-gc],
1324 [libc_cv_z_start_stop_gc=yes], [libc_cv_z_start_stop_gc=no])
1325 LIBC_CONFIG_VAR([have-z-start-stop-gc], [$libc_cv_z_start_stop_gc])
1327 LIBC_LINKER_FEATURE([--depaudit], [-Wl,--depaudit,x],
1328 [libc_cv_depaudit=yes], [libc_cv_depaudit=no])
1329 LIBC_CONFIG_VAR([have-depaudit], [$libc_cv_depaudit])
1331 LIBC_LINKER_FEATURE([-z pack-relative-relocs],
1332 [-Wl,-z,pack-relative-relocs],
1333 [libc_cv_dt_relr=yes], [libc_cv_dt_relr=no])
1334 LIBC_CONFIG_VAR([have-dt-relr], [$libc_cv_dt_relr])
1336 LIBC_LINKER_FEATURE([--no-dynamic-linker],
1337 [-Wl,--no-dynamic-linker],
1338 [libc_cv_no_dynamic_linker=yes],
1339 [libc_cv_no_dynamic_linker=no])
1340 LIBC_CONFIG_VAR([have-no-dynamic-linker], [$libc_cv_no_dynamic_linker])
1342 AC_CACHE_CHECK(for -static-pie, libc_cv_static_pie, [dnl
1343 LIBC_TRY_CC_OPTION([-static-pie],
1344 [libc_cv_static_pie=yes],
1345 [libc_cv_static_pie=no])
1347 LIBC_CONFIG_VAR([have-static-pie], [$libc_cv_static_pie])
1349 AC_CACHE_CHECK(for -fpie, libc_cv_fpie, [dnl
1350 LIBC_TRY_CC_OPTION([-fpie], [libc_cv_fpie=yes], [libc_cv_fpie=no])
1353 AC_SUBST(libc_cv_fpie)
1355 AC_CACHE_CHECK(for GLOB_DAT reloc,
1356 libc_cv_has_glob_dat, [dnl
1357 cat > conftest.c <<EOF
1359 int foo (void) { return mumble; }
1361 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1362 -fPIC -shared -o conftest.so conftest.c
1363 -nostdlib -nostartfiles $no_ssp
1364 1>&AS_MESSAGE_LOG_FD])
1366 dnl look for GLOB_DAT relocation.
1367 if $READELF -rW conftest.so | grep '_GLOB_DAT' > /dev/null; then
1368 libc_cv_has_glob_dat=yes
1370 libc_cv_has_glob_dat=no
1373 libc_cv_has_glob_dat=no
1376 AC_SUBST(libc_cv_has_glob_dat)
1378 AC_CACHE_CHECK([for -mtls-dialect=gnu2], libc_cv_mtls_dialect_gnu2,
1380 cat > conftest.c <<EOF
1387 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -fPIC -mtls-dialect=gnu2 -nostdlib -nostartfiles
1388 conftest.c -o conftest 1>&AS_MESSAGE_LOG_FD])
1390 libc_cv_mtls_dialect_gnu2=yes
1392 libc_cv_mtls_dialect_gnu2=no
1395 AC_SUBST(libc_cv_mtls_dialect_gnu2)
1396 LIBC_CONFIG_VAR([have-mtls-dialect-gnu2], [$libc_cv_mtls_dialect_gnu2])
1398 dnl clang emits an warning for a double alias redirection, to warn the
1399 dnl original symbol is sed even when weak definition overriddes it.
1400 dnl It is a usual pattern for weak_alias, where multiple alias point to
1402 AC_CACHE_CHECK([if -Wno-ignored-attributes is required for aliases],
1403 libc_cv_wno_ignored_attributes, [dnl
1404 cat > conftest.c <<EOF
1408 extern __typeof (__foo) foo __attribute__ ((weak, alias ("__foo")));
1409 extern __typeof (__foo) bar __attribute__ ((weak, alias ("foo")));
1411 libc_cv_wno_ignored_attributes=""
1412 if ! AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -Werror -c conftest.c])
1414 libc_cv_wno_ignored_attributes="-Wno-ignored-attributes"
1417 LIBC_CONFIG_VAR([config-cflags-wno-ignored-attributes],
1418 [$libc_cv_wno_ignored_attributes])
1420 AC_CACHE_CHECK(whether cc puts quotes around section names,
1421 libc_cv_have_section_quotes,
1422 [cat > conftest.c <<EOF
1423 static const int foo
1424 __attribute__ ((section ("bar"))) = 1;
1426 if ${CC-cc} -S conftest.c -o conftest.s; then
1427 if grep '\.section.*"bar"' conftest.s >/dev/null; then
1428 libc_cv_have_section_quotes=yes
1430 libc_cv_have_section_quotes=no
1433 libc_cv_have_section_quotes=unknown
1435 rm -f conftest.{c,s}
1437 if test $libc_cv_have_section_quotes = yes; then
1438 AC_DEFINE(HAVE_SECTION_QUOTES)
1441 AC_CACHE_CHECK(for __builtin_memset, libc_cv_gcc_builtin_memset, [dnl
1442 cat > conftest.c <<\EOF
1445 __builtin_memset (x, 0, 1000);
1449 if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | grep -F "memset" > /dev/null]);
1451 libc_cv_gcc_builtin_memset=no
1453 libc_cv_gcc_builtin_memset=yes
1456 if test "$libc_cv_gcc_builtin_memset" = yes ; then
1457 AC_DEFINE(HAVE_BUILTIN_MEMSET)
1460 AC_CACHE_CHECK(for redirection of built-in functions, libc_cv_gcc_builtin_redirection, [dnl
1461 cat > conftest.c <<\EOF
1462 extern char *strstr (const char *, const char *) __asm ("my_strstr");
1463 char *foo (const char *a, const char *b)
1465 return __builtin_strstr (a, b);
1469 if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | grep -F "my_strstr" > /dev/null]);
1471 libc_cv_gcc_builtin_redirection=yes
1473 libc_cv_gcc_builtin_redirection=no
1476 if test "$libc_cv_gcc_builtin_redirection" = no; then
1477 AC_MSG_ERROR([support for the symbol redirection needed])
1480 dnl Determine how to disable generation of FMA instructions.
1481 AC_CACHE_CHECK([for compiler option to disable generation of FMA instructions],
1482 libc_cv_cc_nofma, [dnl
1484 for opt in -ffp-contract=off -mno-fused-madd; do
1485 LIBC_TRY_CC_OPTION([$opt], [libc_cv_cc_nofma=$opt; break])
1487 AC_SUBST(libc_cv_cc_nofma)
1489 if test -n "$submachine"; then
1490 AC_CACHE_CHECK([for compiler option for CPU variant],
1491 libc_cv_cc_submachine, [dnl
1492 libc_cv_cc_submachine=no
1493 for opt in "-march=$submachine" "-mcpu=$submachine"; do
1494 LIBC_TRY_CC_OPTION([$opt], [
1495 libc_cv_cc_submachine="$opt"
1498 if test "x$libc_cv_cc_submachine" = xno; then
1499 AC_MSG_ERROR([${CC-cc} does not support $submachine])
1502 AC_SUBST(libc_cv_cc_submachine)
1504 dnl Determine if compiler supports -fsignaling-nans
1505 AC_CACHE_CHECK([for compiler option that -fsignaling-nans],
1506 libc_cv_cc_signaling_nans, [dnl
1507 LIBC_TRY_CC_OPTION([-Werror -fsignaling-nans],
1508 [libc_cv_cc_signaling_nans=-fsignaling-nans],
1509 [libc_cv_cc_signaling_nans=])
1511 LIBC_CONFIG_VAR([config-cflags-signaling-nans],
1512 [$libc_cv_cc_signaling_nans])
1514 AC_CACHE_CHECK(if $CC accepts -fno-tree-loop-distribute-patterns with \
1515 __attribute__ ((__optimize__)), libc_cv_cc_loop_to_function, [dnl
1516 cat > conftest.c <<EOF
1518 __attribute__ ((__optimize__ ("-fno-tree-loop-distribute-patterns")))
1521 libc_cv_cc_loop_to_function=no
1522 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c])
1524 libc_cv_cc_loop_to_function=yes
1527 if test $libc_cv_cc_loop_to_function = yes; then
1528 AC_DEFINE(HAVE_CC_INHIBIT_LOOP_TO_LIBCALL)
1530 AC_SUBST(libc_cv_cc_loop_to_function)
1532 dnl Check whether we have the gd library available.
1533 AC_MSG_CHECKING(for libgd)
1534 if test "$with_gd" != "no"; then
1535 old_CFLAGS="$CFLAGS"
1536 CFLAGS="$CFLAGS $libgd_include"
1537 old_LDFLAGS="$LDFLAGS"
1538 LDFLAGS="$LDFLAGS $libgd_ldflags"
1540 LIBS="$LIBS -lgd -lpng -lz -lm"
1541 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <gd.h>]], [[gdImagePng (0, 0)]])],
1542 [LIBGD=yes], [LIBGD=no])
1543 CFLAGS="$old_CFLAGS"
1544 LDFLAGS="$old_LDFLAGS"
1549 AC_MSG_RESULT($LIBGD)
1553 if test x$with_selinux = xno ; then
1556 # See if we have the SELinux library
1557 AC_CHECK_LIB(selinux, is_selinux_enabled,
1558 have_selinux=yes, have_selinux=no)
1559 if test x$with_selinux = xyes ; then
1560 if test x$have_selinux = xno ; then
1561 AC_MSG_ERROR([SELinux explicitly required, but SELinux library not found])
1565 # Check if we're building with SELinux support.
1566 if test "x$have_selinux" = xyes; then
1567 AC_DEFINE(HAVE_SELINUX, 1, [SELinux support])
1569 # See if we have the libaudit library
1570 AC_CHECK_LIB(audit, audit_log_user_avc_message,
1571 have_libaudit=yes, have_libaudit=no)
1572 if test "x$have_libaudit" = xyes; then
1573 AC_DEFINE(HAVE_LIBAUDIT, 1, [SELinux libaudit support])
1575 AC_SUBST(have_libaudit)
1577 # See if we have the libcap library
1578 AC_CHECK_LIB(cap, cap_init, have_libcap=yes, have_libcap=no)
1579 if test "x$have_libcap" = xyes; then
1580 AC_DEFINE(HAVE_LIBCAP, 1, [SELinux libcap support])
1582 AC_SUBST(have_libcap)
1584 AC_SUBST(have_selinux)
1587 dnl Check for silly hacked compilers predefining _FORTIFY_SOURCE.
1588 dnl Since we are building the implementations of the fortified functions here,
1589 dnl having the macro defined interacts very badly.
1590 dnl _FORTIFY_SOURCE requires compiler optimization level 1 (gcc -O1)
1591 dnl and above (see "man FEATURE_TEST_MACROS").
1592 dnl So do NOT replace AC_COMPILE_IFELSE with AC_PREPROC_IFELSE.
1593 AC_CACHE_CHECK([for _FORTIFY_SOURCE predefine], libc_cv_predef_fortify_source,
1594 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1595 #ifdef _FORTIFY_SOURCE
1598 [libc_cv_predef_fortify_source=no],
1599 [libc_cv_predef_fortify_source=yes])])
1600 if test $libc_cv_predef_fortify_source = yes; then
1601 CPPUNDEFS="${CPPUNDEFS:+$CPPUNDEFS }-U_FORTIFY_SOURCE"
1605 dnl Starting with binutils 2.35, GAS can attach multiple symbol versions
1606 dnl to one symbol (PR 23840).
1607 AC_CACHE_CHECK(whether the assembler requires one version per symbol,
1608 libc_cv_symver_needs_alias, [dnl
1609 cat > conftest.s <<EOF
1613 .symver testfunc, testfunc1@VERSION1
1614 .symver testfunc, testfunc1@VERSION2
1616 libc_cv_symver_needs_alias=no
1617 if ${CC-cc} $ASFLAGS -c conftest.s 2>&AS_MESSAGE_LOG_FD; then
1618 libc_cv_symver_needs_alias=no
1620 libc_cv_symver_needs_alias=yes
1624 if test "$libc_cv_symver_needs_alias" = yes; then
1625 AC_DEFINE(SYMVER_NEEDS_ALIAS)
1628 AC_CACHE_CHECK(for __builtin_trap with no external dependencies,
1629 libc_cv_builtin_trap, [dnl
1630 libc_cv_builtin_trap=no
1631 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[__builtin_trap ()]])],[
1632 libc_undefs=`$NM -u conftest.o |
1633 LC_ALL=C $AWK '$1 == "U" { print $2 | "sort -u"; next } { exit(1) }' \
1634 2>&AS_MESSAGE_LOG_FD` || {
1635 AC_MSG_ERROR([confusing output from $NM -u])
1637 echo >&AS_MESSAGE_LOG_FD "libc_undefs='$libc_undefs'"
1638 if test -z "$libc_undefs"; then
1639 libc_cv_builtin_trap=yes
1641 if test $libc_cv_builtin_trap = yes; then
1642 AC_DEFINE([HAVE_BUILTIN_TRAP])
1645 dnl C++ feature tests.
1648 AC_CACHE_CHECK([whether the C++ compiler supports thread_local],
1649 libc_cv_cxx_thread_local, [
1650 old_CXXFLAGS="$CXXFLAGS"
1651 CXXFLAGS="$CXXFLAGS -std=gnu++11"
1652 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
1655 // Compiler support.
1662 S * get () { return &s; }
1664 // libstdc++ support.
1665 #ifndef _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL
1666 #error __cxa_thread_atexit_impl not supported
1669 [libc_cv_cxx_thread_local=yes],
1670 [libc_cv_cxx_thread_local=no])
1671 CXXFLAGS="$old_CXXFLAGS"
1673 AC_SUBST(libc_cv_cxx_thread_local)
1676 dnl End of C++ feature tests.
1678 ### End of automated tests.
1679 ### Now run sysdeps configure fragments.
1681 # They also can set these variables.
1683 ldd_rewrite_script=no
1684 libc_cv_sysconfdir=$sysconfdir
1685 libc_cv_localstatedir=$localstatedir
1686 libc_cv_gcc_unwind_find_fde=no
1690 # Iterate over all the sysdep directories we will use, running their
1691 # configure fragments.
1692 for dir in $sysnames; do
1695 *) dest=$srcdir/$dir ;;
1697 if test -r $dest/configure; then
1698 AC_MSG_RESULT(running configure fragment for $dir)
1703 if test x"$build_mathvec" = xnotset; then
1706 LIBC_CONFIG_VAR([build-mathvec], [$build_mathvec])
1708 AC_SUBST(libc_extra_cflags)
1709 AC_SUBST(libc_extra_cppflags)
1711 if test x$libc_cv_gcc_unwind_find_fde = xyes; then
1712 AC_DEFINE(EXPORT_UNWIND_FIND_FDE)
1714 AC_SUBST(libc_cv_gcc_unwind_find_fde)
1716 # A sysdeps configure fragment can reset this if IFUNC is not actually
1717 # usable even though the assembler knows how to generate the symbol type.
1718 if test x"$libc_cv_ld_gnu_indirect_function" = xyes; then
1719 AC_DEFINE(HAVE_IFUNC)
1721 LIBC_CONFIG_VAR([have-ifunc], [$libc_cv_ld_gnu_indirect_function])
1723 if test x"$libc_cv_gcc_indirect_function" = xyes; then
1724 AC_DEFINE(HAVE_GCC_IFUNC)
1726 LIBC_CONFIG_VAR([have-gcc-ifunc], [$libc_cv_gcc_indirect_function])
1728 # This is far from the AC_ARG_ENABLE that sets it so that a sysdeps
1729 # configure fragment can override the value to prevent this AC_DEFINE.
1731 if test "x$use_nscd" != xno; then
1732 AC_DEFINE([USE_NSCD])
1734 if test "x$build_nscd" = xdefault; then
1735 build_nscd=$use_nscd
1738 AC_SUBST(libc_cv_slibdir)
1739 AC_SUBST(libc_cv_rtlddir)
1740 AC_SUBST(libc_cv_complocaledir)
1741 AC_SUBST(libc_cv_sysconfdir)
1742 AC_SUBST(libc_cv_localstatedir)
1743 AC_SUBST(libc_cv_rootsbindir)
1745 if test x$use_ldconfig = xyes; then
1746 AC_DEFINE(USE_LDCONFIG)
1748 AC_SUBST(use_ldconfig)
1749 AC_SUBST(ldd_rewrite_script)
1754 AC_CACHE_CHECK([whether -fPIC is default], libc_cv_pic_default,
1755 [libc_cv_pic_default=yes
1756 cat > conftest.c <<EOF
1757 #if defined __PIC__ || defined __pic__ || defined PIC || defined pic
1758 # error PIC is default.
1761 if eval "${CC-cc} -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
1762 libc_cv_pic_default=no
1765 LIBC_CONFIG_VAR([build-pic-default], [$libc_cv_pic_default])
1767 AC_CACHE_CHECK([whether -fPIE is default], libc_cv_cc_pie_default,
1768 [libc_cv_cc_pie_default=yes
1769 cat > conftest.c <<EOF
1770 #if defined __PIE__ || defined __pie__ || defined PIE || defined pie
1771 # error PIE is default.
1774 if eval "${CC-cc} -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
1775 libc_cv_cc_pie_default=no
1778 LIBC_CONFIG_VAR([cc-pie-default], [$libc_cv_cc_pie_default])
1780 AC_MSG_CHECKING(if we can build programs as PIE)
1781 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#ifdef PIE_UNSUPPORTED
1782 # error PIE is not supported
1783 #endif]])], [libc_cv_pie_supported=yes], [libc_cv_pie_supported=no])
1784 AC_MSG_RESULT($libc_cv_pie_supported)
1785 # Disable build-pie-default if target does not support it or glibc is
1786 # configured with --disable-default-pie.
1787 if test "x$default_pie" = xno; then
1788 build_pie_default=no
1790 build_pie_default=$libc_cv_pie_supported
1792 LIBC_CONFIG_VAR([build-pie-default], [$build_pie_default])
1794 AC_MSG_CHECKING(if we can build static PIE programs)
1795 libc_cv_static_pie_supported=$libc_cv_pie_supported
1796 if test "x$libc_cv_pie_supported" != xno \
1797 -a "$libc_cv_no_dynamic_linker" = yes; then
1798 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#ifndef SUPPORT_STATIC_PIE
1799 # error static PIE is not supported
1800 #endif]])], [libc_cv_static_pie_supported=yes],
1801 [libc_cv_static_pie_supported=no])
1803 AC_MSG_RESULT($libc_cv_static_pie_supported)
1805 # Enable static-pie only if it is available and glibc isn't configured
1806 # with --disable-default-pie.
1807 if test "x$default_pie" = xno; then
1808 libc_cv_static_pie=no
1810 libc_cv_static_pie=$libc_cv_static_pie_supported
1812 if test "$libc_cv_static_pie" = "yes"; then
1813 AC_DEFINE(ENABLE_STATIC_PIE)
1815 LIBC_CONFIG_VAR([enable-static-pie], [$libc_cv_static_pie])
1817 # Set the `multidir' variable by grabbing the variable from the compiler.
1818 # We do it once and save the result in a generated makefile.
1819 libc_cv_multidir=`${CC-cc} $CFLAGS $CPPFLAGS -print-multi-directory`
1820 AC_SUBST(libc_cv_multidir)
1823 AC_SUBST(static_nss)
1827 dnl See sysdeps/mach/configure.ac for this variable.
1828 AC_SUBST(mach_interface_list)
1830 VERSION=`sed -n -e 's/^#define VERSION "\([^"]*\)"/\1/p' < $srcdir/version.h`
1831 RELEASE=`sed -n -e 's/^#define RELEASE "\([^"]*\)"/\1/p' < $srcdir/version.h`
1835 if test "$pthread_in_libc" = yes; then
1836 AC_DEFINE(PTHREAD_IN_LIBC)
1838 AC_SUBST(pthread_in_libc)
1840 AC_CONFIG_FILES([config.make Makefile])
1841 AC_CONFIG_COMMANDS([default],[[
1842 case $CONFIG_FILES in *config.make*)
1843 echo "$config_vars" >> config.make;;
1845 test -d bits || mkdir bits]],[[config_vars='$config_vars']])