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)
566 if test "$INSTALL" = "${srcdir}/scripts/install-sh -c"; then
567 # The makefiles need to use a different form to find it in $srcdir.
568 INSTALL='\$(..)./scripts/install-sh -c'
574 # Accept binutils 2.25 or newer.
576 case $($LD --version) in
578 # Accept gold 1.14 or higher
579 AC_CHECK_PROG_VER(LD, $LD, --version,
580 [GNU gold.* \([0-9][0-9]*\.[0-9.]*\)],
581 [1.1[4-9]*|1.[2-9][0-9]*|1.1[0-9][0-9]*|[2-9].*|[1-9][0-9]*],
582 LD=: critic_missing="$critic_missing GNU gold")
585 # Accept LLD 13.0.0 or higher
586 AC_CHECK_PROG_VER(LD, $LD, --version,
587 [LLD.* \([0-9][0-9]*\.[0-9.]*\)],
588 [1[3-9].*|[2-9][0-9].*],
589 LD=: critic_missing="$critic_missing LLD")
593 AC_CHECK_PROG_VER(LD, $LD, --version,
594 [GNU ld.* \([0-9][0-9]*\.[0-9.]*\)],
595 [2.1[0-9][0-9]*|2.2[5-9]*|2.[3-9][0-9]*|[3-9].*|[1-9][0-9]*],
596 LD=: critic_missing="$critic_missing GNU ld")
599 LIBC_CONFIG_VAR([with-lld], [$libc_cv_with_lld])
601 # These programs are version sensitive.
602 AC_CHECK_PROG_VER(MAKE, gnumake gmake make, --version,
603 [GNU Make[^0-9]*\([0-9][0-9.]*\)],
604 [[4-9].* | [1-9][0-9]*], critic_missing="$critic_missing make")
606 AC_CHECK_PROG_VER(MSGFMT, gnumsgfmt gmsgfmt msgfmt, --version,
607 [GNU gettext.* \([0-9]*\.[0-9.]*\)],
608 [0.10.3[6-9]* | 0.10.[4-9][0-9]* | 0.1[1-9]* | 0.[2-9][0-9]* | [1-9].*],
609 MSGFMT=: aux_missing="$aux_missing msgfmt")
610 AC_CHECK_PROG_VER(MAKEINFO, makeinfo, --version,
611 [GNU texinfo.* \([0-9][0-9.]*\)],
612 [4.[7-9]*|4.[1-9][0-9]*|[5-9].*],
613 MAKEINFO=: aux_missing="$aux_missing makeinfo")
614 AC_CHECK_PROG_VER(SED, sed, --version,
615 [GNU sed[^0-9]* \([0-9]*\.[0-9.]*\)],
616 [3.0[2-9]*|3.[1-9]*|[4-9]*],
617 SED=: aux_missing="$aux_missing sed")
618 AC_CHECK_PROG_VER(AWK, gawk, --version,
619 [GNU Awk[^0-9]*\([0-9][0-9.]*\)],
620 [3.1.[2-9]*|3.[2-9]*|[4-9]*], critic_missing="$critic_missing gawk")
621 AC_CHECK_PROG_VER(BISON, bison, --version,
622 [bison (GNU Bison) \([0-9]*\.[0-9.]*\)],
623 [2.7*|[3-9].*|[1-9][0-9]*], critic_missing="$critic_missing bison")
625 AC_CACHE_CHECK([if $CC is sufficient to build libc], libc_cv_compiler_ok, [
626 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[]], [[
627 #if !defined __GNUC__ || __GNUC__ < 6 || (__GNUC__ == 6 && __GNUC_MINOR__ < 2)
628 #error insufficient compiler
630 [libc_cv_compiler_ok=yes],
631 [libc_cv_compiler_ok=no])])
632 AS_IF([test $libc_cv_compiler_ok != yes],
633 [critic_missing="$critic_missing compiler"])
635 AC_CHECK_TOOL(NM, nm, false)
637 if test "x$maintainer" = "xyes"; then
638 AC_CHECK_PROGS(AUTOCONF, autoconf, no)
640 xno|x|x:) AUTOCONF=no ;;
643 whether $AUTOCONF${ACFLAGS:+ }$ACFLAGS works, libc_cv_autoconf_works, [dnl
644 if (cd $srcdir; $AUTOCONF $ACFLAGS configure.ac > /dev/null 2>&1); then
645 libc_cv_autoconf_works=yes
647 libc_cv_autoconf_works=no
649 test $libc_cv_autoconf_works = yes || AUTOCONF=no
652 if test "x$AUTOCONF" = xno; then
653 aux_missing="$aux_missing autoconf"
659 # Check for python3 if available, or else python.
660 AC_CHECK_PROG_VER(PYTHON_PROG, python3 python, --version,
661 [Python \([0-9][0-9.]*\)],
662 [3.[4-9]*|3.[1-9][0-9]*|[4-9].*|[1-9][0-9]*],
663 critic_missing="$critic_missing python")
664 PYTHON="$PYTHON_PROG -B"
667 test -n "$critic_missing" && AC_MSG_ERROR([
668 *** These critical programs are missing or too old:$critic_missing
669 *** Check the INSTALL file for required versions.])
671 test -n "$aux_missing" && AC_MSG_WARN([
672 *** These auxiliary programs are missing or incompatible versions:$aux_missing
673 *** some features or tests will be disabled.
674 *** Check the INSTALL file for required versions.])
677 # Determine whether to use fpu or nofpu sysdeps directories.
678 AC_CACHE_CHECK([for use of fpu sysdeps directories],
679 libc_cv_with_fp, [dnl
680 cat > conftest.c <<EOF
684 # error "no hardware floating point"
688 if ${CC-cc} $CFLAGS $CPPFLAGS -S conftest.c -o conftest.s \
689 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ; then
693 AC_SUBST(libc_cv_with_fp)
695 AC_CACHE_CHECK(for -fstack-protector, libc_cv_ssp, [dnl
696 LIBC_TRY_CC_OPTION([$CFLAGS $CPPFLAGS -Werror -fstack-protector],
701 AC_CACHE_CHECK(for -fstack-protector-strong, libc_cv_ssp_strong, [dnl
702 LIBC_TRY_CC_OPTION([$CFLAGS $CPPFLAGS -Werror -fstack-protector-strong],
703 [libc_cv_ssp_strong=yes],
704 [libc_cv_ssp_strong=no])
707 AC_CACHE_CHECK(for -fstack-protector-all, libc_cv_ssp_all, [dnl
708 LIBC_TRY_CC_OPTION([$CFLAGS $CPPFLAGS -Werror -fstack-protector-all],
709 [libc_cv_ssp_all=yes],
710 [libc_cv_ssp_all=no])
715 if test "$libc_cv_ssp" = yes; then
716 no_stack_protector="-fno-stack-protector -DSTACK_PROTECTOR_LEVEL=0"
717 AC_DEFINE(HAVE_CC_NO_STACK_PROTECTOR)
720 if test "$enable_stack_protector" = yes && test "$libc_cv_ssp" = yes; then
721 stack_protector="-fstack-protector"
722 AC_DEFINE(STACK_PROTECTOR_LEVEL, 1)
723 elif test "$enable_stack_protector" = all && test "$libc_cv_ssp_all" = yes; then
724 stack_protector="-fstack-protector-all"
725 AC_DEFINE(STACK_PROTECTOR_LEVEL, 2)
726 elif test "$enable_stack_protector" = strong && test "$libc_cv_ssp_strong" = yes; then
727 stack_protector="-fstack-protector-strong"
728 AC_DEFINE(STACK_PROTECTOR_LEVEL, 3)
730 stack_protector="-fno-stack-protector"
731 AC_DEFINE(STACK_PROTECTOR_LEVEL, 0)
733 AC_SUBST(libc_cv_ssp)
734 AC_SUBST(stack_protector)
735 AC_SUBST(no_stack_protector)
737 if test -n "$stack_protector"; then
738 dnl Don't run configure tests with stack-protection on, to avoid problems with
740 no_ssp=-fno-stack-protector
744 if test "$enable_stack_protector" != no; then
745 AC_MSG_ERROR([--enable-stack-protector=$enable_stack_protector specified, but specified level of stack protection is not supported by the compiler.])
749 # For the multi-arch option we need support in the assembler & linker.
750 AC_CACHE_CHECK([for assembler and linker STT_GNU_IFUNC support],
751 libc_cv_ld_gnu_indirect_function, [dnl
752 cat > conftest.S <<EOF
753 .type foo,%gnu_indirect_function
766 libc_cv_ld_gnu_indirect_function=no
767 if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
768 -nostartfiles -nostdlib $no_ssp \
769 -o conftest conftest.S 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
770 # Do a link to see if the backend supports IFUNC relocs.
771 $READELF -r conftest 1>&AS_MESSAGE_LOG_FD
772 LC_ALL=C $READELF -Wr conftest | grep -q 'IRELATIVE\|R_SPARC_JMP_IREL' && {
773 libc_cv_ld_gnu_indirect_function=yes
778 # Check if gcc supports attribute ifunc as it is used in libc_ifunc macro.
779 AC_CACHE_CHECK([for gcc attribute ifunc support],
780 libc_cv_gcc_indirect_function, [dnl
781 cat > conftest.c <<EOF
782 extern int func (int);
783 int used_func (int a)
787 static void *resolver ()
791 extern __typeof (func) func __attribute__ ((ifunc ("resolver")));
793 libc_cv_gcc_indirect_function=no
794 if ${CC-cc} -c conftest.c -o conftest.o 1>&AS_MESSAGE_LOG_FD \
795 2>&AS_MESSAGE_LOG_FD ; then
796 if $READELF -s conftest.o | grep IFUNC >/dev/null 2>&AS_MESSAGE_LOG_FD; then
797 libc_cv_gcc_indirect_function=yes
802 # Check if linker supports textrel relocation with ifunc (used on elf/tests).
803 # Note that it relies on libc_cv_ld_gnu_indirect_function test above.
804 AC_CACHE_CHECK([whether the linker supports textrels along with ifunc],
805 libc_cv_textrel_ifunc, [dnl
806 cat > conftest.S <<EOF
807 .type foo,%gnu_indirect_function
828 libc_cv_textrel_ifunc=no
829 if test $libc_cv_ld_gnu_indirect_function = yes; then
830 if AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -nostartfiles -nostdlib $no_ssp -pie -o conftest conftest.S); then
831 libc_cv_textrel_ifunc=yes
835 AC_SUBST(libc_cv_textrel_ifunc)
837 # Check if CC supports attribute retain as it is used in attribute_used_retain macro.
838 AC_CACHE_CHECK([for GNU attribute retain support],
839 libc_cv_gnu_retain, [dnl
840 cat > conftest.c <<EOF
841 static int var __attribute__ ((used, retain, section ("__libc_atexit")));
843 libc_cv_gnu_retain=no
844 if ${CC-cc} -Werror -c conftest.c -o /dev/null 1>&AS_MESSAGE_LOG_FD \
845 2>&AS_MESSAGE_LOG_FD ; then
846 libc_cv_gnu_retain=yes
849 if test $libc_cv_gnu_retain = yes; then
850 AC_DEFINE(HAVE_GNU_RETAIN)
852 LIBC_CONFIG_VAR([have-gnu-retain], [$libc_cv_gnu_retain])
854 # Check if gcc warns about alias for function with incompatible types.
855 AC_CACHE_CHECK([if compiler warns about alias for function with incompatible types],
856 libc_cv_gcc_incompatible_alias, [dnl
857 cat > conftest.c <<EOF
858 int __redirect_foo (const void *s, int c);
860 __typeof (__redirect_foo) *foo_impl (void) __asm__ ("foo");
861 __typeof (__redirect_foo) *foo_impl (void)
866 extern __typeof (__redirect_foo) foo_alias __attribute__ ((alias ("foo")));
868 libc_cv_gcc_incompatible_alias=yes
869 if ${CC-cc} -Werror -c conftest.c -o conftest.o 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ; then
870 libc_cv_gcc_incompatible_alias=no
874 if test x"$libc_cv_ld_gnu_indirect_function" != xyes; then
875 if test x"$multi_arch" = xyes; then
876 AC_MSG_ERROR([--enable-multi-arch support requires assembler and linker support])
881 if test x"$libc_cv_gcc_indirect_function" != xyes; then
882 # GCC 8+ emits a warning for alias with incompatible types and it might
883 # fail to build ifunc resolvers aliases to either weak or internal
884 # symbols. Disables multiarch build in this case.
885 if test x"$libc_cv_gcc_incompatible_alias" = xyes; then
886 AC_MSG_WARN([gcc emits a warning for alias between functions of incompatible types])
887 if test x"$multi_arch" = xyes; then
888 AC_MSG_ERROR([--enable-multi-arch support requires a gcc with gnu-indirect-function support])
890 AC_MSG_WARN([Multi-arch is disabled.])
892 elif test x"$multi_arch" = xyes; then
893 AC_MSG_WARN([--enable-multi-arch support recommends a gcc with gnu-indirect-function support.
894 Please use a gcc which supports it by default or configure gcc with --enable-gnu-indirect-function])
898 if test x"$multi_arch" != xno; then
899 multi_arch_d=/multiarch
902 # Compute the list of sysdep directories for this configuration.
903 # This can take a while to compute.
904 sysdep_dir=$srcdir/sysdeps
905 AC_MSG_CHECKING(sysdep dirs)
906 dnl We need to use [ and ] for other purposes for a while now.
908 # Make sco3.2v4 become sco3.2.4 and sunos4.1.1_U1 become sunos4.1.1.U1.
909 os="`echo $os | sed 's/\([0-9A-Z]\)[v_]\([0-9A-Z]\)/\1.\2/g'`"
911 test "x$base_os" != x || case "$os" in
918 # For sunos4.1.1, try sunos4.1.1, then sunos4.1, then sunos4, then sunos.
921 while o=`echo $tail | sed 's/\.[^.]*$//'`; test $o != $tail; do
925 o=`echo $tail | sed 's/[0-9]*$//'`
926 if test $o != $tail; then
929 # For linux-gnu, try linux-gnu, then linux.
930 o=`echo $tail | sed 's/-.*$//'`
931 if test $o != $tail; then
935 # For unix/sysv/sysv4, try unix/sysv/sysv4, then unix/sysv, then unix.
938 while b=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$b"; do
944 # For sparc/sparc32, try sparc/sparc32 and then sparc.
946 tail=$machine${submachine:+/$submachine}
947 while m=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$m"; do
949 # Prepend the machine's FPU directory unless the architecture specific
950 # preconfigure disables it.
951 if test "$libc_cv_with_fp" = yes; then
956 # For each machine term, try it with and then without /multiarch.
957 for try_fpu in $maybe_fpu ''; do
958 for try_multi in $multi_arch_d ''; do
959 mach="$mach /$1$try_fpu$try_multi"
965 dnl We are done with glob and regexp uses of [ and ]; return to autoconf.
968 # Find what sysdep directories exist.
970 for b in $base ''; do
971 for m0 in $mach ''; do
972 for v in /$vendor ''; do
973 test "$v" = / && continue
974 for o in /$ostry ''; do
975 test "$o" = / && continue
976 for m in $mach ''; do
977 try_suffix="$m0$b$v$o$m"
978 if test -n "$try_suffix"; then
979 try_srcdir="${srcdir}/"
980 try="sysdeps$try_suffix"
981 test -n "$enable_debug_configure" &&
982 echo "$0 [DEBUG]: try $try" >&2
983 if test -d "$try_srcdir$try"; then
984 sysnames="$sysnames $try"
985 { test -n "$o" || test -n "$b"; } && os_used=t
986 { test -n "$m" || test -n "$m0"; } && machine_used=t
988 x*/$submachine) submachine_used=t ;;
998 # If the assembler supports gnu_indirect_function symbol type and the
999 # architecture supports multi-arch, we enable multi-arch by default.
1004 test x"$multi_arch" = xdefault && multi_arch=no
1007 if test x"$multi_arch" != xno; then
1008 AC_DEFINE(USE_MULTIARCH)
1010 AC_SUBST(multi_arch)
1012 if test -z "$os_used" && test "$os" != none; then
1013 AC_MSG_ERROR(Operating system $os is not supported.)
1015 if test -z "$machine_used" && test "$machine" != none; then
1016 AC_MSG_ERROR(The $machine is not supported.)
1018 if test -z "$submachine_used" && test -n "$submachine"; then
1019 AC_MSG_ERROR(The $submachine subspecies of $host_cpu is not supported.)
1021 AC_SUBST(submachine)
1023 # We have now validated the configuration.
1025 # Expand the list of system names into a full list of directories
1026 # from each element's parent name and Implies file (if present).
1029 while test $# -gt 0; do
1033 case " $names " in *" $name "*)
1034 # Already in the list.
1038 # Report each name as we discover it, so there is no long pause in output.
1039 echo $ECHO_N "$name $ECHO_C" >&AS_MESSAGE_FD
1041 name_base=`echo $name | sed -e 's@\(.*sysdeps\)/.*@\1@'`
1045 *) xsrcdir=$srcdir/ ;;
1047 test -n "$enable_debug_configure" &&
1048 echo "[DEBUG]: name/Implies $xsrcdir$name/Implies" >&2
1050 for implies_file in Implies Implies-before Implies-after; do
1051 implies_type=`echo $implies_file | sed s/-/_/`
1052 eval ${implies_type}=
1053 if test -f $xsrcdir$name/$implies_file; then
1054 # Collect more names from the `Implies' file (removing comments).
1055 implied_candidate="`sed 's/#.*$//' < $xsrcdir$name/$implies_file`"
1056 for x in $implied_candidate; do
1058 if test -d $xsrcdir$name_base/$x; then
1059 eval "${implies_type}=\"\$${implies_type} \$name_base/\$x\""
1064 test -n "$enable_debug_configure" &&
1065 echo "[DEBUG]: $name $implies_file $x try() {$try_srcdir}$try" >&2
1066 if test $try != $xsrcdir$name_base/$x && test -d $try_srcdir$try;
1068 eval "${implies_type}=\"\$${implies_type} \$try\""
1071 if test $found = no; then
1072 AC_MSG_WARN($name/$implies_file specifies nonexistent $x)
1078 # Add NAME to the list of names.
1079 names="$names $name"
1081 # Find the parent of NAME, using the empty string if it has none.
1083 parent="`echo $name | sed -n -e 's=/[^/]*$==' -e '/sysdeps$/q' -e p`"
1086 test -n "$enable_debug_configure" &&
1087 echo "[DEBUG]: $name Implies='$Implies' rest='$*' parent='$parent' \
1088 Implies_before='$Implies_before' Implies_after='$Implies_after'" >&2
1090 # Add the names implied by NAME, and NAME's parent (if it has one), to
1091 # the list of names to be processed (the argument list). We prepend the
1092 # implied names to the list and append the parent. We want implied
1093 # directories to come before further directories inferred from the
1094 # configuration components; this ensures that for sysv4, unix/common
1095 # (implied by unix/sysv/sysv4) comes before unix/sysv (in ostry (here $*)
1097 sysnames="`echo $Implies $* $Implies_before $parent $Implies_after`"
1098 test -n "$sysnames" && set $sysnames
1101 # Add the default directories.
1102 default_sysnames="sysdeps/generic"
1103 sysnames="$names $default_sysnames"
1105 # The other names were emitted during the scan.
1106 AC_MSG_RESULT($default_sysnames)
1108 # if using special system headers, find out the compiler's sekrit
1109 # header directory and add that to the list. NOTE: Only does the right
1110 # thing on a system that doesn't need fixincludes. (Not presently a problem.)
1111 if test -n "$sysheaders"; then
1112 SYSINCLUDES=-nostdinc
1113 for d in include include-fixed; do
1114 i=`$CC -print-file-name="$d"` && test "x$i" != x && test "x$i" != "x$d" &&
1115 SYSINCLUDES="$SYSINCLUDES -isystem $i"
1117 SYSINCLUDES="$SYSINCLUDES \
1118 -isystem `echo $sysheaders | sed 's/:/ -isystem /g'`"
1119 if test -n "$CXX"; then
1121 for cxxheaders in `$CXX -v -S -x c++ /dev/null -o /dev/null 2>&1 \
1122 | sed -n -e '1,/#include/d' -e 's/^ \(\/.*\/[cg]++\)/\1/p'`; do
1123 test "x$cxxheaders" != x &&
1124 CXX_SYSINCLUDES="$CXX_SYSINCLUDES -isystem $cxxheaders"
1128 AC_SUBST(SYSINCLUDES)
1129 AC_SUBST(CXX_SYSINCLUDES)
1131 # Obtain some C++ header file paths. This is used to make a local
1132 # copy of those headers in Makerules.
1133 if test -n "$CXX"; then
1134 find_cxx_header () {
1135 echo "#include <$1>" | $CXX -H -fsyntax-only -x c++ - 2>&1 \
1136 | $AWK '$1 == "."{print $2}'
1138 CXX_CSTDLIB_HEADER="$(find_cxx_header cstdlib)"
1139 CXX_CMATH_HEADER="$(find_cxx_header cmath)"
1140 CXX_BITS_STD_ABS_H="$(find_cxx_header bits/std_abs.h)"
1142 AC_SUBST(CXX_CSTDLIB_HEADER)
1143 AC_SUBST(CXX_CMATH_HEADER)
1144 AC_SUBST(CXX_BITS_STD_ABS_H)
1146 # Test if LD_LIBRARY_PATH contains the notation for the current directory
1147 # since this would lead to problems installing/building glibc.
1148 # LD_LIBRARY_PATH contains the current directory if one of the following
1150 # - one of the terminals (":" and ";") is the first or last sign
1151 # - two terminals occur directly after each other
1152 # - the path contains an element with a dot in it
1153 AC_MSG_CHECKING(LD_LIBRARY_PATH variable)
1155 case ${LD_LIBRARY_PATH} in
1156 [:\;]* | *[:\;] | *[:\;][:\;]* | *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* )
1157 ld_library_path_setting="contains current directory"
1160 ld_library_path_setting="ok"
1164 AC_MSG_RESULT($ld_library_path_setting)
1165 if test "$ld_library_path_setting" != "ok"; then
1167 *** LD_LIBRARY_PATH shouldn't contain the current directory when
1168 *** building glibc. Please change the environment variable
1169 *** and run configure again.])
1172 AC_PATH_PROG(BASH_SHELL, bash, no)
1174 AC_PATH_PROG(PERL, perl, no)
1175 if test "$PERL" != no &&
1176 (eval `$PERL -V:apiversion`; test `expr "$apiversion" \< 5` -ne 0); then
1179 AC_PATH_PROG(INSTALL_INFO, install-info, no,
1180 $PATH:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin)
1182 AC_CACHE_CHECK(for .set assembler directive, libc_cv_asm_set_directive, [dnl
1183 cat > conftest.s <<EOF
1186 .set glibc_conftest_frobozz,foo
1187 .globl glibc_conftest_frobozz
1189 # The alpha-dec-osf1 assembler gives only a warning for `.set'
1190 # (but it doesn't work), so we must do a linking check to be sure.
1191 cat > conftest1.c <<\EOF
1192 extern int glibc_conftest_frobozz;
1193 void _start() { glibc_conftest_frobozz = 1; }
1195 if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
1196 -nostartfiles -nostdlib $no_ssp \
1197 -o conftest conftest.s conftest1.c 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
1198 libc_cv_asm_set_directive=yes
1200 libc_cv_asm_set_directive=no
1203 if test $libc_cv_asm_set_directive = yes; then
1204 AC_DEFINE(HAVE_ASM_SET_DIRECTIVE)
1207 AC_CACHE_CHECK(linker support for protected data symbol,
1208 libc_cv_protected_data,
1209 [cat > conftest.c <<EOF
1210 int bar __attribute__ ((visibility ("protected"))) = 1;
1212 libc_cv_protected_data=no
1213 if AC_TRY_COMMAND(${CC-cc} -nostdlib -nostartfiles $no_ssp -fPIC -shared conftest.c -o conftest.so); then
1214 cat > conftest.c <<EOF
1216 int main (void) { return bar; }
1218 if AC_TRY_COMMAND(${CC-cc} -nostdlib -nostartfiles $no_ssp conftest.c -o conftest conftest.so); then
1219 libc_cv_protected_data=yes
1224 AC_SUBST(libc_cv_protected_data)
1226 AC_CACHE_CHECK(linker support for INSERT in linker script,
1228 [cat > conftest.c <<EOF
1229 int __attribute__ ((section(".bar"))) bar = 0x12345678;
1230 int test (void) { return bar; }
1232 cat > conftest.t <<EOF
1237 INSERT AFTER .rela.dyn;
1240 if AC_TRY_COMMAND([${CC-cc} -nostdlib -nostartfiles $no_ssp -fPIC -shared conftest.c -Wl,-T,conftest.t -o conftest.so]); then
1245 AC_SUBST(libc_cv_insert)
1247 AC_CACHE_CHECK(for broken __attribute__((alias())),
1248 libc_cv_broken_alias_attribute,
1249 [cat > conftest.c <<EOF
1250 extern int foo (int x) __asm ("xyzzy");
1251 int bar (int x) { return x; }
1252 extern __typeof (bar) foo __attribute ((weak, alias ("bar")));
1254 extern __typeof (dfoo) dfoo __asm ("abccb");
1257 libc_cv_broken_alias_attribute=yes
1258 if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
1259 if grep 'xyzzy' conftest.s >/dev/null &&
1260 grep 'abccb' conftest.s >/dev/null; then
1261 libc_cv_broken_alias_attribute=no
1264 rm -f conftest.c conftest.s
1266 if test $libc_cv_broken_alias_attribute = yes; then
1267 AC_MSG_ERROR(working alias attribute support required)
1270 AC_CACHE_CHECK(whether to put _rtld_local into .sdata section,
1271 libc_cv_have_sdata_section,
1272 [echo "int i;" > conftest.c
1273 libc_cv_have_sdata_section=no
1274 if ${CC-cc} $LDFLAGS -fPIC -shared -Wl,--verbose conftest.c -o conftest.so 2>&1 \
1275 | grep '\.sdata' >/dev/null; then
1276 libc_cv_have_sdata_section=yes
1278 rm -f conftest.c conftest.so
1280 if test $libc_cv_have_sdata_section = yes; then
1281 AC_DEFINE(HAVE_SDATA_SECTION)
1284 AC_CACHE_CHECK(for libunwind-support in compiler,
1285 libc_cv_cc_with_libunwind, [
1286 cat > conftest.c <<EOF
1287 int main (void) { return 0; }
1289 if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -static -o conftest \
1290 conftest.c -v 2>&1 >/dev/null | grep ' -lunwind ' >/dev/null; then
1291 libc_cv_cc_with_libunwind=yes
1293 libc_cv_cc_with_libunwind=no
1296 AC_SUBST(libc_cv_cc_with_libunwind)
1297 if test $libc_cv_cc_with_libunwind = yes; then
1298 AC_DEFINE(HAVE_CC_WITH_LIBUNWIND)
1302 AC_CACHE_CHECK(whether --noexecstack is desirable for .S files,
1303 libc_cv_as_noexecstack, [dnl
1304 cat > conftest.c <<EOF
1307 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS
1308 -S -o conftest.s conftest.c 1>&AS_MESSAGE_LOG_FD]) \
1309 && grep .note.GNU-stack conftest.s >/dev/null \
1310 && AC_TRY_COMMAND([${CC-cc} $ASFLAGS -Wa,--noexecstack
1311 -c -o conftest.o conftest.s 1>&AS_MESSAGE_LOG_FD])
1313 libc_cv_as_noexecstack=yes
1315 libc_cv_as_noexecstack=no
1318 if test $libc_cv_as_noexecstack = yes; then
1319 ASFLAGS_config="$ASFLAGS_config -Wa,--noexecstack"
1321 AC_SUBST(ASFLAGS_config)
1323 LIBC_LINKER_FEATURE([-z execstack], [-Wl,-z,execstack],
1324 [libc_cv_z_execstack=yes], [libc_cv_z_execstack=no])
1325 AC_SUBST(libc_cv_z_execstack)
1327 LIBC_LINKER_FEATURE([-z start-stop-gc], [-Wl,-z,start-stop-gc],
1328 [libc_cv_z_start_stop_gc=yes], [libc_cv_z_start_stop_gc=no])
1329 LIBC_CONFIG_VAR([have-z-start-stop-gc], [$libc_cv_z_start_stop_gc])
1331 LIBC_LINKER_FEATURE([--depaudit], [-Wl,--depaudit,x],
1332 [libc_cv_depaudit=yes], [libc_cv_depaudit=no])
1333 LIBC_CONFIG_VAR([have-depaudit], [$libc_cv_depaudit])
1335 LIBC_LINKER_FEATURE([-z pack-relative-relocs],
1336 [-Wl,-z,pack-relative-relocs],
1337 [libc_cv_dt_relr=yes], [libc_cv_dt_relr=no])
1338 LIBC_CONFIG_VAR([have-dt-relr], [$libc_cv_dt_relr])
1340 LIBC_LINKER_FEATURE([--no-dynamic-linker],
1341 [-Wl,--no-dynamic-linker],
1342 [libc_cv_no_dynamic_linker=yes],
1343 [libc_cv_no_dynamic_linker=no])
1344 LIBC_CONFIG_VAR([have-no-dynamic-linker], [$libc_cv_no_dynamic_linker])
1346 AC_CACHE_CHECK(for -static-pie, libc_cv_static_pie, [dnl
1347 LIBC_TRY_CC_OPTION([-static-pie],
1348 [libc_cv_static_pie=yes],
1349 [libc_cv_static_pie=no])
1351 LIBC_CONFIG_VAR([have-static-pie], [$libc_cv_static_pie])
1353 AC_CACHE_CHECK(for -fpie, libc_cv_fpie, [dnl
1354 LIBC_TRY_CC_OPTION([-fpie], [libc_cv_fpie=yes], [libc_cv_fpie=no])
1357 AC_SUBST(libc_cv_fpie)
1359 AC_CACHE_CHECK(for GLOB_DAT reloc,
1360 libc_cv_has_glob_dat, [dnl
1361 cat > conftest.c <<EOF
1363 int foo (void) { return mumble; }
1365 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1366 -fPIC -shared -o conftest.so conftest.c
1367 -nostdlib -nostartfiles $no_ssp
1368 1>&AS_MESSAGE_LOG_FD])
1370 dnl look for GLOB_DAT relocation.
1371 if $READELF -rW conftest.so | grep '_GLOB_DAT' > /dev/null; then
1372 libc_cv_has_glob_dat=yes
1374 libc_cv_has_glob_dat=no
1377 libc_cv_has_glob_dat=no
1380 AC_SUBST(libc_cv_has_glob_dat)
1382 AC_CACHE_CHECK([for -mtls-dialect=gnu2], libc_cv_mtls_dialect_gnu2,
1384 cat > conftest.c <<EOF
1391 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -fPIC -mtls-dialect=gnu2 -nostdlib -nostartfiles
1392 conftest.c -o conftest 1>&AS_MESSAGE_LOG_FD])
1394 libc_cv_mtls_dialect_gnu2=yes
1396 libc_cv_mtls_dialect_gnu2=no
1399 AC_SUBST(libc_cv_mtls_dialect_gnu2)
1400 LIBC_CONFIG_VAR([have-mtls-dialect-gnu2], [$libc_cv_mtls_dialect_gnu2])
1402 dnl clang emits an warning for a double alias redirection, to warn the
1403 dnl original symbol is sed even when weak definition overriddes it.
1404 dnl It is a usual pattern for weak_alias, where multiple alias point to
1406 AC_CACHE_CHECK([if -Wno-ignored-attributes is required for aliases],
1407 libc_cv_wno_ignored_attributes, [dnl
1408 cat > conftest.c <<EOF
1412 extern __typeof (__foo) foo __attribute__ ((weak, alias ("__foo")));
1413 extern __typeof (__foo) bar __attribute__ ((weak, alias ("foo")));
1415 libc_cv_wno_ignored_attributes=""
1416 if ! AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -Werror -c conftest.c])
1418 libc_cv_wno_ignored_attributes="-Wno-ignored-attributes"
1421 LIBC_CONFIG_VAR([config-cflags-wno-ignored-attributes],
1422 [$libc_cv_wno_ignored_attributes])
1424 AC_CACHE_CHECK(whether cc puts quotes around section names,
1425 libc_cv_have_section_quotes,
1426 [cat > conftest.c <<EOF
1427 static const int foo
1428 __attribute__ ((section ("bar"))) = 1;
1430 if ${CC-cc} -S conftest.c -o conftest.s; then
1431 if grep '\.section.*"bar"' conftest.s >/dev/null; then
1432 libc_cv_have_section_quotes=yes
1434 libc_cv_have_section_quotes=no
1437 libc_cv_have_section_quotes=unknown
1439 rm -f conftest.{c,s}
1441 if test $libc_cv_have_section_quotes = yes; then
1442 AC_DEFINE(HAVE_SECTION_QUOTES)
1445 AC_CACHE_CHECK(for __builtin_memset, libc_cv_gcc_builtin_memset, [dnl
1446 cat > conftest.c <<\EOF
1449 __builtin_memset (x, 0, 1000);
1453 if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | grep -F "memset" > /dev/null]);
1455 libc_cv_gcc_builtin_memset=no
1457 libc_cv_gcc_builtin_memset=yes
1460 if test "$libc_cv_gcc_builtin_memset" = yes ; then
1461 AC_DEFINE(HAVE_BUILTIN_MEMSET)
1464 AC_CACHE_CHECK(for redirection of built-in functions, libc_cv_gcc_builtin_redirection, [dnl
1465 cat > conftest.c <<\EOF
1466 extern char *strstr (const char *, const char *) __asm ("my_strstr");
1467 char *foo (const char *a, const char *b)
1469 return __builtin_strstr (a, b);
1473 if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | grep -F "my_strstr" > /dev/null]);
1475 libc_cv_gcc_builtin_redirection=yes
1477 libc_cv_gcc_builtin_redirection=no
1480 if test "$libc_cv_gcc_builtin_redirection" = no; then
1481 AC_MSG_ERROR([support for the symbol redirection needed])
1484 dnl Determine how to disable generation of FMA instructions.
1485 AC_CACHE_CHECK([for compiler option to disable generation of FMA instructions],
1486 libc_cv_cc_nofma, [dnl
1488 for opt in -ffp-contract=off -mno-fused-madd; do
1489 LIBC_TRY_CC_OPTION([$opt], [libc_cv_cc_nofma=$opt; break])
1491 AC_SUBST(libc_cv_cc_nofma)
1493 if test -n "$submachine"; then
1494 AC_CACHE_CHECK([for compiler option for CPU variant],
1495 libc_cv_cc_submachine, [dnl
1496 libc_cv_cc_submachine=no
1497 for opt in "-march=$submachine" "-mcpu=$submachine"; do
1498 LIBC_TRY_CC_OPTION([$opt], [
1499 libc_cv_cc_submachine="$opt"
1502 if test "x$libc_cv_cc_submachine" = xno; then
1503 AC_MSG_ERROR([${CC-cc} does not support $submachine])
1506 AC_SUBST(libc_cv_cc_submachine)
1508 dnl Determine if compiler supports -fsignaling-nans
1509 AC_CACHE_CHECK([for compiler option that -fsignaling-nans],
1510 libc_cv_cc_signaling_nans, [dnl
1511 LIBC_TRY_CC_OPTION([-Werror -fsignaling-nans],
1512 [libc_cv_cc_signaling_nans=-fsignaling-nans],
1513 [libc_cv_cc_signaling_nans=])
1515 LIBC_CONFIG_VAR([config-cflags-signaling-nans],
1516 [$libc_cv_cc_signaling_nans])
1518 AC_CACHE_CHECK(if $CC accepts -fno-tree-loop-distribute-patterns with \
1519 __attribute__ ((__optimize__)), libc_cv_cc_loop_to_function, [dnl
1520 cat > conftest.c <<EOF
1522 __attribute__ ((__optimize__ ("-fno-tree-loop-distribute-patterns")))
1525 libc_cv_cc_loop_to_function=no
1526 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c])
1528 libc_cv_cc_loop_to_function=yes
1531 if test $libc_cv_cc_loop_to_function = yes; then
1532 AC_DEFINE(HAVE_CC_INHIBIT_LOOP_TO_LIBCALL)
1534 AC_SUBST(libc_cv_cc_loop_to_function)
1536 dnl Check whether we have the gd library available.
1537 AC_MSG_CHECKING(for libgd)
1538 if test "$with_gd" != "no"; then
1539 old_CFLAGS="$CFLAGS"
1540 CFLAGS="$CFLAGS $libgd_include"
1541 old_LDFLAGS="$LDFLAGS"
1542 LDFLAGS="$LDFLAGS $libgd_ldflags"
1544 LIBS="$LIBS -lgd -lpng -lz -lm"
1545 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <gd.h>]], [[gdImagePng (0, 0)]])],
1546 [LIBGD=yes], [LIBGD=no])
1547 CFLAGS="$old_CFLAGS"
1548 LDFLAGS="$old_LDFLAGS"
1553 AC_MSG_RESULT($LIBGD)
1557 if test x$with_selinux = xno ; then
1560 # See if we have the SELinux library
1561 AC_CHECK_LIB(selinux, is_selinux_enabled,
1562 have_selinux=yes, have_selinux=no)
1563 if test x$with_selinux = xyes ; then
1564 if test x$have_selinux = xno ; then
1565 AC_MSG_ERROR([SELinux explicitly required, but SELinux library not found])
1569 # Check if we're building with SELinux support.
1570 if test "x$have_selinux" = xyes; then
1571 AC_DEFINE(HAVE_SELINUX, 1, [SELinux support])
1573 # See if we have the libaudit library
1574 AC_CHECK_LIB(audit, audit_log_user_avc_message,
1575 have_libaudit=yes, have_libaudit=no)
1576 if test "x$have_libaudit" = xyes; then
1577 AC_DEFINE(HAVE_LIBAUDIT, 1, [SELinux libaudit support])
1579 AC_SUBST(have_libaudit)
1581 # See if we have the libcap library
1582 AC_CHECK_LIB(cap, cap_init, have_libcap=yes, have_libcap=no)
1583 if test "x$have_libcap" = xyes; then
1584 AC_DEFINE(HAVE_LIBCAP, 1, [SELinux libcap support])
1586 AC_SUBST(have_libcap)
1588 AC_SUBST(have_selinux)
1591 dnl Check for silly hacked compilers predefining _FORTIFY_SOURCE.
1592 dnl Since we are building the implementations of the fortified functions here,
1593 dnl having the macro defined interacts very badly.
1594 dnl _FORTIFY_SOURCE requires compiler optimization level 1 (gcc -O1)
1595 dnl and above (see "man FEATURE_TEST_MACROS").
1596 dnl So do NOT replace AC_COMPILE_IFELSE with AC_PREPROC_IFELSE.
1597 AC_CACHE_CHECK([for _FORTIFY_SOURCE predefine], libc_cv_predef_fortify_source,
1598 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1599 #ifdef _FORTIFY_SOURCE
1602 [libc_cv_predef_fortify_source=no],
1603 [libc_cv_predef_fortify_source=yes])])
1604 if test $libc_cv_predef_fortify_source = yes; then
1605 CPPUNDEFS="${CPPUNDEFS:+$CPPUNDEFS }-U_FORTIFY_SOURCE"
1609 dnl Starting with binutils 2.35, GAS can attach multiple symbol versions
1610 dnl to one symbol (PR 23840).
1611 AC_CACHE_CHECK(whether the assembler requires one version per symbol,
1612 libc_cv_symver_needs_alias, [dnl
1613 cat > conftest.s <<EOF
1617 .symver testfunc, testfunc1@VERSION1
1618 .symver testfunc, testfunc1@VERSION2
1620 libc_cv_symver_needs_alias=no
1621 if ${CC-cc} $ASFLAGS -c conftest.s 2>&AS_MESSAGE_LOG_FD; then
1622 libc_cv_symver_needs_alias=no
1624 libc_cv_symver_needs_alias=yes
1628 if test "$libc_cv_symver_needs_alias" = yes; then
1629 AC_DEFINE(SYMVER_NEEDS_ALIAS)
1632 AC_CACHE_CHECK(for __builtin_trap with no external dependencies,
1633 libc_cv_builtin_trap, [dnl
1634 libc_cv_builtin_trap=no
1635 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[__builtin_trap ()]])],[
1636 libc_undefs=`$NM -u conftest.o |
1637 LC_ALL=C $AWK '$1 == "U" { print $2 | "sort -u"; next } { exit(1) }' \
1638 2>&AS_MESSAGE_LOG_FD` || {
1639 AC_MSG_ERROR([confusing output from $NM -u])
1641 echo >&AS_MESSAGE_LOG_FD "libc_undefs='$libc_undefs'"
1642 if test -z "$libc_undefs"; then
1643 libc_cv_builtin_trap=yes
1645 if test $libc_cv_builtin_trap = yes; then
1646 AC_DEFINE([HAVE_BUILTIN_TRAP])
1649 dnl C++ feature tests.
1652 AC_CACHE_CHECK([whether the C++ compiler supports thread_local],
1653 libc_cv_cxx_thread_local, [
1654 old_CXXFLAGS="$CXXFLAGS"
1655 CXXFLAGS="$CXXFLAGS -std=gnu++11"
1656 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
1659 // Compiler support.
1666 S * get () { return &s; }
1668 // libstdc++ support.
1669 #ifndef _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL
1670 #error __cxa_thread_atexit_impl not supported
1673 [libc_cv_cxx_thread_local=yes],
1674 [libc_cv_cxx_thread_local=no])
1675 CXXFLAGS="$old_CXXFLAGS"
1677 AC_SUBST(libc_cv_cxx_thread_local)
1680 dnl End of C++ feature tests.
1682 ### End of automated tests.
1683 ### Now run sysdeps configure fragments.
1685 # They also can set these variables.
1687 ldd_rewrite_script=no
1688 libc_cv_sysconfdir=$sysconfdir
1689 libc_cv_localstatedir=$localstatedir
1690 libc_cv_gcc_unwind_find_fde=no
1694 # Iterate over all the sysdep directories we will use, running their
1695 # configure fragments.
1696 for dir in $sysnames; do
1699 *) dest=$srcdir/$dir ;;
1701 if test -r $dest/configure; then
1702 AC_MSG_RESULT(running configure fragment for $dir)
1707 if test x"$build_mathvec" = xnotset; then
1710 LIBC_CONFIG_VAR([build-mathvec], [$build_mathvec])
1712 AC_SUBST(libc_extra_cflags)
1713 AC_SUBST(libc_extra_cppflags)
1715 if test x$libc_cv_gcc_unwind_find_fde = xyes; then
1716 AC_DEFINE(EXPORT_UNWIND_FIND_FDE)
1718 AC_SUBST(libc_cv_gcc_unwind_find_fde)
1720 # A sysdeps configure fragment can reset this if IFUNC is not actually
1721 # usable even though the assembler knows how to generate the symbol type.
1722 if test x"$libc_cv_ld_gnu_indirect_function" = xyes; then
1723 AC_DEFINE(HAVE_IFUNC)
1725 LIBC_CONFIG_VAR([have-ifunc], [$libc_cv_ld_gnu_indirect_function])
1727 if test x"$libc_cv_gcc_indirect_function" = xyes; then
1728 AC_DEFINE(HAVE_GCC_IFUNC)
1730 LIBC_CONFIG_VAR([have-gcc-ifunc], [$libc_cv_gcc_indirect_function])
1732 # This is far from the AC_ARG_ENABLE that sets it so that a sysdeps
1733 # configure fragment can override the value to prevent this AC_DEFINE.
1735 if test "x$use_nscd" != xno; then
1736 AC_DEFINE([USE_NSCD])
1738 if test "x$build_nscd" = xdefault; then
1739 build_nscd=$use_nscd
1742 AC_SUBST(libc_cv_slibdir)
1743 AC_SUBST(libc_cv_rtlddir)
1744 AC_SUBST(libc_cv_complocaledir)
1745 AC_SUBST(libc_cv_sysconfdir)
1746 AC_SUBST(libc_cv_localstatedir)
1747 AC_SUBST(libc_cv_rootsbindir)
1749 if test x$use_ldconfig = xyes; then
1750 AC_DEFINE(USE_LDCONFIG)
1752 AC_SUBST(use_ldconfig)
1753 AC_SUBST(ldd_rewrite_script)
1758 AC_CACHE_CHECK([whether -fPIC is default], libc_cv_pic_default,
1759 [libc_cv_pic_default=yes
1760 cat > conftest.c <<EOF
1761 #if defined __PIC__ || defined __pic__ || defined PIC || defined pic
1762 # error PIC is default.
1765 if eval "${CC-cc} -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
1766 libc_cv_pic_default=no
1769 LIBC_CONFIG_VAR([build-pic-default], [$libc_cv_pic_default])
1771 AC_CACHE_CHECK([whether -fPIE is default], libc_cv_cc_pie_default,
1772 [libc_cv_cc_pie_default=yes
1773 cat > conftest.c <<EOF
1774 #if defined __PIE__ || defined __pie__ || defined PIE || defined pie
1775 # error PIE is default.
1778 if eval "${CC-cc} -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
1779 libc_cv_cc_pie_default=no
1782 LIBC_CONFIG_VAR([cc-pie-default], [$libc_cv_cc_pie_default])
1784 AC_MSG_CHECKING(if we can build programs as PIE)
1785 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#ifdef PIE_UNSUPPORTED
1786 # error PIE is not supported
1787 #endif]])], [libc_cv_pie_supported=yes], [libc_cv_pie_supported=no])
1788 AC_MSG_RESULT($libc_cv_pie_supported)
1789 # Disable build-pie-default if target does not support it or glibc is
1790 # configured with --disable-default-pie.
1791 if test "x$default_pie" = xno; then
1792 build_pie_default=no
1794 build_pie_default=$libc_cv_pie_supported
1796 LIBC_CONFIG_VAR([build-pie-default], [$build_pie_default])
1798 AC_MSG_CHECKING(if we can build static PIE programs)
1799 libc_cv_static_pie_supported=$libc_cv_pie_supported
1800 if test "x$libc_cv_pie_supported" != xno \
1801 -a "$libc_cv_no_dynamic_linker" = yes; then
1802 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#ifndef SUPPORT_STATIC_PIE
1803 # error static PIE is not supported
1804 #endif]])], [libc_cv_static_pie_supported=yes],
1805 [libc_cv_static_pie_supported=no])
1807 AC_MSG_RESULT($libc_cv_static_pie_supported)
1809 # Enable static-pie only if it is available and glibc isn't configured
1810 # with --disable-default-pie.
1811 if test "x$default_pie" = xno; then
1812 libc_cv_static_pie=no
1814 libc_cv_static_pie=$libc_cv_static_pie_supported
1816 if test "$libc_cv_static_pie" = "yes"; then
1817 AC_DEFINE(ENABLE_STATIC_PIE)
1819 LIBC_CONFIG_VAR([enable-static-pie], [$libc_cv_static_pie])
1821 # Set the `multidir' variable by grabbing the variable from the compiler.
1822 # We do it once and save the result in a generated makefile.
1823 libc_cv_multidir=`${CC-cc} $CFLAGS $CPPFLAGS -print-multi-directory`
1824 AC_SUBST(libc_cv_multidir)
1827 AC_SUBST(static_nss)
1831 dnl See sysdeps/mach/configure.ac for this variable.
1832 AC_SUBST(mach_interface_list)
1834 VERSION=`sed -n -e 's/^#define VERSION "\([^"]*\)"/\1/p' < $srcdir/version.h`
1835 RELEASE=`sed -n -e 's/^#define RELEASE "\([^"]*\)"/\1/p' < $srcdir/version.h`
1839 if test "$pthread_in_libc" = yes; then
1840 AC_DEFINE(PTHREAD_IN_LIBC)
1842 AC_SUBST(pthread_in_libc)
1844 AC_CONFIG_FILES([config.make Makefile])
1845 AC_CONFIG_COMMANDS([default],[[
1846 case $CONFIG_FILES in *config.make*)
1847 echo "$config_vars" >> config.make;;
1849 test -d bits || mkdir bits]],[[config_vars='$config_vars']])