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/], [glibc])
4 AC_CONFIG_SRCDIR([include/features.h])
5 AC_CONFIG_HEADERS([config.h])
6 AC_CONFIG_AUX_DIR([scripts])
8 ACX_PKGVERSION([GNU libc])
9 ACX_BUGURL([http://www.gnu.org/software/libc/bugs.html])
10 AC_DEFINE_UNQUOTED([PKGVERSION], ["$PKGVERSION"],
11 [Package description])
12 AC_DEFINE_UNQUOTED([REPORT_BUGS_TO], ["$REPORT_BUGS_TO"],
13 [Bug reporting address])
15 # Glibc should not depend on any header files
16 AC_DEFUN([_AC_INCLUDES_DEFAULT_REQUIREMENTS],
17 [m4_divert_text([DEFAULTS],
18 [ac_includes_default='/* none */'])])
20 # We require GCC, and by default use its preprocessor. Override AC_PROG_CPP
21 # here to work around the Autoconf issue discussed in
22 # <https://sourceware.org/ml/libc-alpha/2013-01/msg00721.html>.
23 AC_DEFUN([AC_PROG_CPP],
24 [AC_REQUIRE([AC_PROG_CC])dnl
25 AC_ARG_VAR([CPP], [C preprocessor])dnl
26 _AC_ARG_VAR_CPPFLAGS()dnl
27 # On Suns, sometimes $CPP names a directory.
28 if test -n "$CPP" && test -d "$CPP"; then
31 if test -z "$CPP"; then
37 # We require GCC. Override _AC_PROG_CC_C89 here to work around the Autoconf
39 # <https://sourceware.org/ml/libc-alpha/2013-01/msg00757.html>.
40 AC_DEFUN([_AC_PROG_CC_C89], [[$1]])
42 dnl This is here so we can set $subdirs directly based on configure fragments.
48 if test $host != $build; then
49 AC_CHECK_PROGS(BUILD_CC, gcc cc)
51 AC_SUBST(cross_compiling)
53 AC_CHECK_TOOL(READELF, readelf, false)
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 AC_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 AC_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 AC_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 AC_HELP_STRING([--with-binutils=PATH],
132 [specify location of binutils (as and ld)]),
133 [path_binutils=$withval],
135 AC_ARG_WITH([selinux],
136 AC_HELP_STRING([--with-selinux],
137 [if building with SELinux support]),
138 [with_selinux=$withval],
141 AC_ARG_WITH([headers],
142 AC_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 AC_HELP_STRING([--with-default-link],
153 [do not use explicit linker scripts]),
154 [use_default_link=$withval],
155 [use_default_link=default])
157 AC_ARG_ENABLE([sanity-checks],
158 AC_HELP_STRING([--disable-sanity-checks],
159 [really do not use threads (should not be used except in special situations) @<:@default=yes@:>@]),
160 [enable_sanity=$enableval],
163 AC_ARG_ENABLE([shared],
164 AC_HELP_STRING([--enable-shared],
165 [build shared library @<:@default=yes if GNU ld@:>@]),
168 AC_ARG_ENABLE([profile],
169 AC_HELP_STRING([--enable-profile],
170 [build profiled library @<:@default=no@:>@]),
171 [profile=$enableval],
173 AC_ARG_ENABLE([timezone-tools],
174 AC_HELP_STRING([--disable-timezone-tools],
175 [do not install timezone tools @<:@default=install@:>@]),
176 [enable_timezone_tools=$enableval],
177 [enable_timezone_tools=yes])
178 AC_SUBST(enable_timezone_tools)
180 AC_ARG_ENABLE([hardcoded-path-in-tests],
181 AC_HELP_STRING([--enable-hardcoded-path-in-tests],
182 [hardcode newly built glibc path in tests @<:@default=no@:>@]),
183 [hardcoded_path_in_tests=$enableval],
184 [hardcoded_path_in_tests=no])
185 AC_SUBST(hardcoded_path_in_tests)
187 AC_ARG_ENABLE([stackguard-randomization],
188 AC_HELP_STRING([--enable-stackguard-randomization],
189 [initialize __stack_chk_guard canary with a random number at program start]),
190 [enable_stackguard_randomize=$enableval],
191 [enable_stackguard_randomize=no])
192 if test "$enable_stackguard_randomize" = yes; then
193 AC_DEFINE(ENABLE_STACKGUARD_RANDOMIZE)
196 AC_ARG_ENABLE([hidden-plt],
197 AC_HELP_STRING([--disable-hidden-plt],
198 [do not hide internal function calls to avoid PLT]),
201 if test "x$hidden" = xno; then
205 AC_ARG_ENABLE([bind-now],
206 AC_HELP_STRING([--enable-bind-now],
207 [disable lazy relocations in DSOs]),
208 [bindnow=$enableval],
211 if test "x$bindnow" = xyes; then
215 dnl Build glibc with -fstack-protector, -fstack-protector-all, or
216 dnl -fstack-protector-strong.
217 AC_ARG_ENABLE([stack-protector],
218 AC_HELP_STRING([--enable-stack-protector=@<:@yes|no|all|strong@:>@],
219 [Use -fstack-protector[-all|-strong] to detect glibc buffer overflows]),
220 [enable_stack_protector=$enableval],
221 [enable_stack_protector=no])
222 case "$enable_stack_protector" in
223 all|yes|no|strong) ;;
224 *) AC_MSG_ERROR([Not a valid argument for --enable-stack-protector: \"$enable_stack_protector\"]);;
227 dnl On some platforms we cannot use dynamic loading. We must provide
228 dnl static NSS modules.
229 AC_ARG_ENABLE([static-nss],
230 AC_HELP_STRING([--enable-static-nss],
231 [build static NSS modules @<:@default=no@:>@]),
232 [static_nss=$enableval],
234 dnl Enable static NSS also if we build no shared objects.
235 if test x"$static_nss" = xyes || test x"$shared" = xno; then
237 AC_DEFINE(DO_STATIC_NSS)
240 AC_ARG_ENABLE([force-install],
241 AC_HELP_STRING([--disable-force-install],
242 [don't force installation of files from this package, even if they are older than the installed files]),
243 [force_install=$enableval],
245 AC_SUBST(force_install)
247 AC_ARG_ENABLE([maintainer-mode],
248 AC_HELP_STRING([--enable-maintainer-mode],
249 [enable make rules and dependencies not useful (and sometimes confusing) to the casual installer]),
250 [maintainer=$enableval],
253 dnl On some platforms we allow dropping compatibility with all kernel
255 AC_ARG_ENABLE([kernel],
256 AC_HELP_STRING([--enable-kernel=VERSION],
257 [compile for compatibility with kernel not older than VERSION]),
258 [minimum_kernel=$enableval],
260 dnl Prevent unreasonable values.
261 if test "$minimum_kernel" = yes || test "$minimum_kernel" = no; then
262 # Better nothing than this.
265 if test "$minimum_kernel" = current; then
266 minimum_kernel=`uname -r 2>/dev/null` || minimum_kernel=
270 dnl For the development we sometimes want gcc to issue even more warnings.
271 dnl This is not the default since many of the extra warnings are not
273 AC_ARG_ENABLE([all-warnings],
274 AC_HELP_STRING([--enable-all-warnings],
275 [enable all useful warnings gcc can issue]),
276 [all_warnings=$enableval],
278 AC_SUBST(all_warnings)
280 AC_ARG_ENABLE([werror],
281 AC_HELP_STRING([--disable-werror],
282 [do not build with -Werror]),
283 [enable_werror=$enableval],
285 AC_SUBST(enable_werror)
287 AC_ARG_ENABLE([multi-arch],
288 AC_HELP_STRING([--enable-multi-arch],
289 [enable single DSO with optimizations for multiple architectures]),
290 [multi_arch=$enableval],
291 [multi_arch=default])
293 AC_ARG_ENABLE([experimental-malloc],
294 AC_HELP_STRING([--disable-experimental-malloc],
295 [disable experimental malloc features]),
296 [experimental_malloc=$enableval],
297 [experimental_malloc=yes])
298 AC_SUBST(experimental_malloc)
300 AC_ARG_ENABLE([nss-crypt],
301 AC_HELP_STRING([--enable-nss-crypt],
302 [enable libcrypt to use nss]),
303 [nss_crypt=$enableval],
305 if test x$nss_crypt = xyes; then
306 nss_includes=-I$(nss-config --includedir 2>/dev/null)
307 if test $? -ne 0; then
308 AC_MSG_ERROR([cannot find include directory with nss-config])
310 nspr_includes=-I$(nspr-config --includedir 2>/dev/null)
311 if test $? -ne 0; then
312 AC_MSG_ERROR([cannot find include directory with nspr-config])
315 CFLAGS="$CFLAGS $nss_includes $nspr_includes"
316 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([typedef int PRBool;
318 #include <nsslowhash.h>
319 void f (void) { NSSLOW_Init (); }])],
320 libc_cv_nss_crypt=yes,
322 cannot find NSS headers with lowlevel hash function interfaces]))
324 old_LDFLAGS="$LDFLAGS"
325 LIBS="$LIBS -lfreebl3"
326 AC_LINK_IFELSE([AC_LANG_PROGRAM([typedef int PRBool;
328 #include <nsslowhash.h>],
330 libc_cv_nss_crypt=yes,
332 cannot link program using lowlevel NSS hash functions]))
333 # Check to see if there is a static NSS cryptographic library.
334 # If there isn't then we can't link anything with libcrypt.a,
335 # and that might mean disabling some static tests.
336 LDFLAGS="$LDFLAGS -static"
337 AC_LINK_IFELSE([AC_LANG_PROGRAM([typedef int PRBool;
339 #include <nsslowhash.h>],
341 libc_cv_static_nss_crypt=yes,
342 libc_cv_static_nss_crypt=no)
343 LDFLAGS="$old_LDFLAGS"
348 libc_cv_static_nss_crypt=no
350 AC_SUBST(libc_cv_nss_crypt)
351 AC_SUBST(libc_cv_static_nss_crypt)
354 AC_ARG_ENABLE([obsolete-rpc],
355 AC_HELP_STRING([--enable-obsolete-rpc],
356 [build and install the obsolete RPC code for link-time usage]),
357 [link_obsolete_rpc=$enableval],
358 [link_obsolete_rpc=no])
359 AC_SUBST(link_obsolete_rpc)
361 if test "$link_obsolete_rpc" = yes; then
362 AC_DEFINE(LINK_OBSOLETE_RPC)
365 AC_ARG_ENABLE([obsolete-nsl],
366 AC_HELP_STRING([--enable-obsolete-nsl],
367 [build and install the obsolete libnsl library and depending NSS modules]),
368 [build_obsolete_nsl=$enableval],
369 [build_obsolete_nsl=no])
370 AC_SUBST(build_obsolete_nsl)
372 if test "$build_obsolete_nsl" = yes; then
373 AC_DEFINE(LINK_OBSOLETE_NSL)
376 AC_ARG_ENABLE([systemtap],
377 [AS_HELP_STRING([--enable-systemtap],
378 [enable systemtap static probe points @<:@default=no@:>@])],
379 [systemtap=$enableval],
381 if test "x$systemtap" != xno; then
382 AC_CACHE_CHECK([for systemtap static probe support], libc_cv_sdt, [dnl
384 CFLAGS="-std=gnu11 $CFLAGS"
385 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <sys/sdt.h>
386 void foo (int i, void *p)
388 asm ("" STAP_PROBE_ASM (foo, bar, STAP_PROBE_ASM_TEMPLATE (2)) ""
389 :: STAP_PROBE_ASM_OPERANDS (2, i, p));
390 }]])], [libc_cv_sdt=yes], [libc_cv_sdt=no])
391 CFLAGS="$old_CFLAGS"])
392 if test $libc_cv_sdt = yes; then
393 AC_DEFINE([USE_STAP_PROBE])
394 elif test "x$systemtap" != xauto; then
395 AC_MSG_FAILURE([systemtap support needs sys/sdt.h with asm support])
399 AC_ARG_ENABLE([build-nscd],
400 [AS_HELP_STRING([--disable-build-nscd],
401 [disable building and installing the nscd daemon])],
402 [build_nscd=$enableval],
403 [build_nscd=default])
406 # Note the use of $use_nscd is near the bottom of the file.
407 AC_ARG_ENABLE([nscd],
408 [AS_HELP_STRING([--disable-nscd],
409 [library functions will not contact the nscd daemon])],
410 [use_nscd=$enableval],
413 AC_ARG_ENABLE([pt_chown],
414 [AS_HELP_STRING([--enable-pt_chown],
415 [Enable building and installing pt_chown])],
416 [build_pt_chown=$enableval],
418 AC_SUBST(build_pt_chown)
419 if test "$build_pt_chown" = yes; then
420 AC_DEFINE(HAVE_PT_CHOWN)
423 AC_ARG_ENABLE([tunables],
424 [AS_HELP_STRING([--enable-tunables],
425 [Enable tunables support. Known values are 'yes', 'no' and 'valstring'])],
426 [have_tunables=$enableval],
428 AC_SUBST(have_tunables)
429 if test "$have_tunables" = yes; then
430 AC_DEFINE(HAVE_TUNABLES)
433 # The abi-tags file uses a fairly simplistic model for name recognition that
434 # can't distinguish i486-pc-linux-gnu fully from i486-pc-gnu. So we mutate a
435 # $host_os of `gnu*' here to be `gnu-gnu*' just so that it can tell.
436 # This doesn't get used much beyond that, so it's fairly safe.
441 host_os=`echo $host_os | sed -e 's/gnu/gnu-gnu/'`
445 AC_ARG_ENABLE([mathvec],
446 [AS_HELP_STRING([--enable-mathvec],
447 [Enable building and installing mathvec @<:@default depends on architecture@:>@])],
448 [build_mathvec=$enableval],
449 [build_mathvec=notset])
451 # We keep the original values in `$config_*' and never modify them, so we
452 # can write them unchanged into config.make. Everything else uses
453 # $machine, $vendor, and $os, and changes them whenever convenient.
454 config_machine=$host_cpu config_vendor=$host_vendor config_os=$host_os
456 # Don't allow vendor == "unknown"
457 test "$config_vendor" = unknown && config_vendor=
458 config_os="`echo $config_os | sed 's/^unknown-//'`"
460 # Some configurations imply other options.
463 # The configure fragment of a port can modify these to supplement
464 # or override the table in the case statement below. No fragment should
465 # ever change the config_* variables, however.
466 machine=$config_machine
467 vendor=$config_vendor
473 AS_HELP_STRING([--with-cpu=CPU], [select code for CPU variant]),
476 yes|'') AC_MSG_ERROR([--with-cpu requires an argument]) ;;
478 *) submachine="$withval" ;;
482 # An preconfigure script can set this when it wants to disable the sanity
486 # A preconfigure script for a system that may or may not use fpu
487 # sysdeps directories sets this to a preprocessor conditional for
488 # whether to use such directories.
491 dnl Let sysdeps/*/preconfigure act here.
492 LIBC_PRECONFIGURE([$srcdir], [for sysdeps])
496 ### By using the undocumented --enable-hacker-mode option for configure
497 ### one can skip this test to make the configuration not fail for unsupported
500 if test -z "$enable_hacker_mode" && test x"$libc_config_ok" != xyes; then
501 case "$machine-$host_os" in
506 *** The GNU C library is currently unavailable for this platform.
507 *** If you are interested in seeing glibc on this platform visit
508 *** the "How to submit a new port" in the wiki:
509 *** https://sourceware.org/glibc/wiki/#Development
510 *** and join the community!])
515 # Set base_machine if not set by a preconfigure fragment.
516 test -n "$base_machine" || base_machine=$machine
517 AC_SUBST(base_machine)
519 # Determine whether to use fpu or nofpu sysdeps directories.
520 AC_CACHE_CHECK([for use of fpu sysdeps directories],
521 libc_cv_with_fp, [dnl
522 cat > conftest.c <<EOF
526 # error "no hardware floating point"
530 if ${CC-cc} $CFLAGS $CPPFLAGS -S conftest.c -o conftest.s \
531 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ; then
535 AC_SUBST(libc_cv_with_fp)
537 AC_CACHE_CHECK(for -fstack-protector, libc_cv_ssp, [dnl
538 LIBC_TRY_CC_OPTION([$CFLAGS $CPPFLAGS -Werror -fstack-protector],
543 AC_CACHE_CHECK(for -fstack-protector-strong, libc_cv_ssp_strong, [dnl
544 LIBC_TRY_CC_OPTION([$CFLAGS $CPPFLAGS -Werror -fstack-protector-strong],
545 [libc_cv_ssp_strong=yes],
546 [libc_cv_ssp_strong=no])
549 AC_CACHE_CHECK(for -fstack-protector-all, libc_cv_ssp_all, [dnl
550 LIBC_TRY_CC_OPTION([$CFLAGS $CPPFLAGS -Werror -fstack-protector-all],
551 [libc_cv_ssp_all=yes],
552 [libc_cv_ssp_all=no])
557 if test "$libc_cv_ssp" = yes; then
558 no_stack_protector="-fno-stack-protector -DSTACK_PROTECTOR_LEVEL=0"
559 AC_DEFINE(HAVE_CC_NO_STACK_PROTECTOR)
562 if test "$enable_stack_protector" = yes && test "$libc_cv_ssp" = yes; then
563 stack_protector="-fstack-protector"
564 AC_DEFINE(STACK_PROTECTOR_LEVEL, 1)
565 elif test "$enable_stack_protector" = all && test "$libc_cv_ssp_all" = yes; then
566 stack_protector="-fstack-protector-all"
567 AC_DEFINE(STACK_PROTECTOR_LEVEL, 2)
568 elif test "$enable_stack_protector" = strong && test "$libc_cv_ssp_strong" = yes; then
569 stack_protector="-fstack-protector-strong"
570 AC_DEFINE(STACK_PROTECTOR_LEVEL, 3)
572 stack_protector="-fno-stack-protector"
573 AC_DEFINE(STACK_PROTECTOR_LEVEL, 0)
575 AC_SUBST(libc_cv_ssp)
576 AC_SUBST(stack_protector)
577 AC_SUBST(no_stack_protector)
579 if test -n "$stack_protector"; then
580 dnl Don't run configure tests with stack-protection on, to avoid problems with
582 no_ssp=-fno-stack-protector
586 if test "$enable_stack_protector" != no; then
587 AC_MSG_ERROR([--enable-stack-protector=$enable_stack_protector specified, but specified level of stack protection is not supported by the compiler.])
591 # For the multi-arch option we need support in the assembler & linker.
592 AC_CACHE_CHECK([for assembler and linker STT_GNU_IFUNC support],
593 libc_cv_ld_gnu_indirect_function, [dnl
594 cat > conftest.S <<EOF
595 .type foo,%gnu_indirect_function
608 libc_cv_ld_gnu_indirect_function=no
609 if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
610 -nostartfiles -nostdlib $no_ssp \
611 -o conftest conftest.S 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
612 # Do a link to see if the backend supports IFUNC relocs.
613 $READELF -r conftest 1>&AS_MESSAGE_LOG_FD
614 LC_ALL=C $READELF -r conftest | grep 'no relocations' >/dev/null || {
615 libc_cv_ld_gnu_indirect_function=yes
620 # Check if gcc supports attribute ifunc as it is used in libc_ifunc macro.
621 AC_CACHE_CHECK([for gcc attribute ifunc support],
622 libc_cv_gcc_indirect_function, [dnl
623 cat > conftest.c <<EOF
624 extern int func (int);
625 int used_func (int a)
629 static void *resolver ()
633 extern __typeof (func) func __attribute__ ((ifunc ("resolver")));
635 libc_cv_gcc_indirect_function=no
636 if ${CC-cc} -c conftest.c -o conftest.o 1>&AS_MESSAGE_LOG_FD \
637 2>&AS_MESSAGE_LOG_FD ; then
638 if $READELF -s conftest.o | grep IFUNC >/dev/null 2>&AS_MESSAGE_LOG_FD; then
639 libc_cv_gcc_indirect_function=yes
644 # Check if gcc warns about alias for function with incompatible types.
645 AC_CACHE_CHECK([if compiler warns about alias for function with incompatible types],
646 libc_cv_gcc_incompatible_alias, [dnl
647 cat > conftest.c <<EOF
648 int __redirect_foo (const void *s, int c);
650 __typeof (__redirect_foo) *foo_impl (void) __asm__ ("foo");
651 __typeof (__redirect_foo) *foo_impl (void)
656 extern __typeof (__redirect_foo) foo_alias __attribute__ ((alias ("foo")));
658 libc_cv_gcc_incompatible_alias=yes
659 if ${CC-cc} -Werror -c conftest.c -o conftest.o 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ; then
660 libc_cv_gcc_incompatible_alias=no
664 if test x"$libc_cv_ld_gnu_indirect_function" != xyes; then
665 if test x"$multi_arch" = xyes; then
666 AC_MSG_ERROR([--enable-multi-arch support requires assembler and linker support])
671 if test x"$libc_cv_gcc_indirect_function" != xyes; then
672 # GCC 8+ emits a warning for alias with incompatible types and it might
673 # fail to build ifunc resolvers aliases to either weak or internal
674 # symbols. Disables multiarch build in this case.
675 if test x"$libc_cv_gcc_incompatible_alias" == xyes; then
676 AC_MSG_WARN([gcc emits a warning for alias between functions of incompatible types])
677 if test x"$multi_arch" = xyes; then
678 AC_MSG_ERROR([--enable-multi-arch support requires a gcc with gnu-indirect-function support])
680 AC_MSG_WARN([Multi-arch is disabled.])
682 elif test x"$multi_arch" = xyes; then
683 AC_MSG_WARN([--enable-multi-arch support recommends a gcc with gnu-indirect-function support.
684 Please use a gcc which supports it by default or configure gcc with --enable-gnu-indirect-function])
688 if test x"$multi_arch" != xno; then
689 multi_arch_d=/multiarch
692 # Compute the list of sysdep directories for this configuration.
693 # This can take a while to compute.
694 sysdep_dir=$srcdir/sysdeps
695 AC_MSG_CHECKING(sysdep dirs)
696 dnl We need to use [ and ] for other purposes for a while now.
698 # Make sco3.2v4 become sco3.2.4 and sunos4.1.1_U1 become sunos4.1.1.U1.
699 os="`echo $os | sed 's/\([0-9A-Z]\)[v_]\([0-9A-Z]\)/\1.\2/g'`"
701 test "x$base_os" != x || case "$os" in
708 # For sunos4.1.1, try sunos4.1.1, then sunos4.1, then sunos4, then sunos.
711 while o=`echo $tail | sed 's/\.[^.]*$//'`; test $o != $tail; do
715 o=`echo $tail | sed 's/[0-9]*$//'`
716 if test $o != $tail; then
719 # For linux-gnu, try linux-gnu, then linux.
720 o=`echo $tail | sed 's/-.*$//'`
721 if test $o != $tail; then
725 # For unix/sysv/sysv4, try unix/sysv/sysv4, then unix/sysv, then unix.
728 while b=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$b"; do
734 # For sparc/sparc32, try sparc/sparc32 and then sparc.
736 tail=$machine${submachine:+/$submachine}
737 while m=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$m"; do
739 # Prepend the machine's FPU directory unless --without-fp.
740 if test "$libc_cv_with_fp" = yes; then
745 # For each machine term, try it with and then without /multiarch.
746 for try_fpu in $maybe_fpu ''; do
747 for try_multi in $multi_arch_d ''; do
748 mach="$mach /$1$try_fpu$try_multi"
754 dnl We are done with glob and regexp uses of [ and ]; return to autoconf.
757 # Find what sysdep directories exist.
759 for b in $base ''; do
760 for m0 in $mach ''; do
761 for v in /$vendor ''; do
762 test "$v" = / && continue
763 for o in /$ostry ''; do
764 test "$o" = / && continue
765 for m in $mach ''; do
766 try_suffix="$m0$b$v$o$m"
767 if test -n "$try_suffix"; then
768 try_srcdir="${srcdir}/"
769 try="sysdeps$try_suffix"
770 test -n "$enable_debug_configure" &&
771 echo "$0 [DEBUG]: try $try" >&2
772 if test -d "$try_srcdir$try"; then
773 sysnames="$sysnames $try"
774 { test -n "$o" || test -n "$b"; } && os_used=t
775 { test -n "$m" || test -n "$m0"; } && machine_used=t
777 x*/$submachine) submachine_used=t ;;
787 # If the assembler supports gnu_indirect_function symbol type and the
788 # architecture supports multi-arch, we enable multi-arch by default.
793 test x"$multi_arch" = xdefault && multi_arch=no
796 if test x"$multi_arch" != xno; then
797 AC_DEFINE(USE_MULTIARCH)
801 if test -z "$os_used" && test "$os" != none; then
802 AC_MSG_ERROR(Operating system $os is not supported.)
804 if test -z "$machine_used" && test "$machine" != none; then
805 AC_MSG_ERROR(The $machine is not supported.)
807 if test -z "$submachine_used" && test -n "$submachine"; then
808 AC_MSG_ERROR(The $submachine subspecies of $host_cpu is not supported.)
812 # We have now validated the configuration.
814 # Expand the list of system names into a full list of directories
815 # from each element's parent name and Implies file (if present).
818 while test $# -gt 0; do
822 case " $names " in *" $name "*)
823 # Already in the list.
827 # Report each name as we discover it, so there is no long pause in output.
828 echo $ECHO_N "$name $ECHO_C" >&AS_MESSAGE_FD
830 name_base=`echo $name | sed -e 's@\(.*sysdeps\)/.*@\1@'`
834 *) xsrcdir=$srcdir/ ;;
836 test -n "$enable_debug_configure" &&
837 echo "[DEBUG]: name/Implies $xsrcdir$name/Implies" >&2
839 for implies_file in Implies Implies-before Implies-after; do
840 implies_type=`echo $implies_file | sed s/-/_/`
841 eval ${implies_type}=
842 if test -f $xsrcdir$name/$implies_file; then
843 # Collect more names from the `Implies' file (removing comments).
844 implied_candidate="`sed 's/#.*$//' < $xsrcdir$name/$implies_file`"
845 for x in $implied_candidate; do
847 if test -d $xsrcdir$name_base/$x; then
848 eval "${implies_type}=\"\$${implies_type} \$name_base/\$x\""
853 test -n "$enable_debug_configure" &&
854 echo "[DEBUG]: $name $implies_file $x try() {$try_srcdir}$try" >&2
855 if test $try != $xsrcdir$name_base/$x && test -d $try_srcdir$try;
857 eval "${implies_type}=\"\$${implies_type} \$try\""
860 if test $found = no; then
861 AC_MSG_WARN($name/$implies_file specifies nonexistent $x)
867 # Add NAME to the list of names.
870 # Find the parent of NAME, using the empty string if it has none.
872 parent="`echo $name | sed -n -e 's=/[^/]*$==' -e '/sysdeps$/q' -e p`"
875 test -n "$enable_debug_configure" &&
876 echo "[DEBUG]: $name Implies='$Implies' rest='$*' parent='$parent' \
877 Implies_before='$Implies_before' Implies_after='$Implies_after'" >&2
879 # Add the names implied by NAME, and NAME's parent (if it has one), to
880 # the list of names to be processed (the argument list). We prepend the
881 # implied names to the list and append the parent. We want implied
882 # directories to come before further directories inferred from the
883 # configuration components; this ensures that for sysv4, unix/common
884 # (implied by unix/sysv/sysv4) comes before unix/sysv (in ostry (here $*)
886 sysnames="`echo $Implies $* $Implies_before $parent $Implies_after`"
887 test -n "$sysnames" && set $sysnames
890 # Add the default directories.
891 default_sysnames="sysdeps/generic"
892 sysnames="$names $default_sysnames"
894 # The other names were emitted during the scan.
895 AC_MSG_RESULT($default_sysnames)
901 if test "$INSTALL" = "${srcdir}/scripts/install-sh -c"; then
902 # The makefiles need to use a different form to find it in $srcdir.
903 INSTALL='\$(..)./scripts/install-sh -c'
909 # Accept binutils 2.25 or newer.
910 AC_CHECK_PROG_VER(AS, $AS, --version,
911 [GNU assembler.* \([0-9]*\.[0-9.]*\)],
912 [2.1[0-9][0-9]*|2.2[5-9]*|2.[3-9][0-9]*|[3-9].*|[1-9][0-9]*],
913 AS=: critic_missing="$critic_missing as")
915 if test -n "`$LD --version | sed -n 's/^GNU \(gold\).*$/\1/p'`"; then
916 # Accept gold 1.14 or higher
917 AC_CHECK_PROG_VER(LD, $LD, --version,
918 [GNU gold.* \([0-9][0-9]*\.[0-9.]*\)],
919 [1.1[4-9]*|1.[2-9][0-9]*|1.1[0-9][0-9]*|[2-9].*|[1-9][0-9]*],
920 LD=: critic_missing="$critic_missing GNU gold")
922 AC_CHECK_PROG_VER(LD, $LD, --version,
923 [GNU ld.* \([0-9][0-9]*\.[0-9.]*\)],
924 [2.1[0-9][0-9]*|2.2[5-9]*|2.[3-9][0-9]*|[3-9].*|[1-9][0-9]*],
925 LD=: critic_missing="$critic_missing GNU ld")
928 # These programs are version sensitive.
930 AC_CHECK_PROG_VER(MAKE, gnumake gmake make, --version,
931 [GNU Make[^0-9]*\([0-9][0-9.]*\)],
932 [3.79* | 3.[89]* | [4-9].* | [1-9][0-9]*], critic_missing="$critic_missing make")
934 AC_CHECK_PROG_VER(MSGFMT, gnumsgfmt gmsgfmt msgfmt, --version,
935 [GNU gettext.* \([0-9]*\.[0-9.]*\)],
936 [0.10.3[6-9]* | 0.10.[4-9][0-9]* | 0.1[1-9]* | 0.[2-9][0-9]* | [1-9].*],
937 MSGFMT=: aux_missing="$aux_missing msgfmt")
938 AC_CHECK_PROG_VER(MAKEINFO, makeinfo, --version,
939 [GNU texinfo.* \([0-9][0-9.]*\)],
940 [4.[7-9]*|4.[1-9][0-9]*|[5-9].*],
941 MAKEINFO=: aux_missing="$aux_missing makeinfo")
942 AC_CHECK_PROG_VER(SED, sed, --version,
943 [GNU sed[^0-9]* \([0-9]*\.[0-9.]*\)],
944 [3.0[2-9]*|3.[1-9]*|[4-9]*],
945 SED=: aux_missing="$aux_missing sed")
946 AC_CHECK_PROG_VER(AWK, gawk, --version,
947 [GNU Awk[^0-9]*\([0-9][0-9.]*\)],
948 [3.1.[2-9]*|3.[2-9]*|[4-9]*], critic_missing="$critic_missing gawk")
949 AC_CHECK_PROG_VER(BISON, bison, --version,
950 [bison (GNU Bison) \([0-9]*\.[0-9.]*\)],
951 [2.7*|[3-9].*|[1-9][0-9]*], critic_missing="$critic_missing bison")
953 AC_CACHE_CHECK([if $CC is sufficient to build libc], libc_cv_compiler_ok, [
955 #if !defined __GNUC__ || __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 9)
956 #error insufficient compiler
958 [libc_cv_compiler_ok=yes],
959 [libc_cv_compiler_ok=no])])
960 AS_IF([test $libc_cv_compiler_ok != yes],
961 [critic_missing="$critic_missing compiler"])
963 AC_CHECK_TOOL(NM, nm, false)
965 if test "x$maintainer" = "xyes"; then
966 AC_CHECK_PROGS(AUTOCONF, autoconf, no)
968 xno|x|x:) AUTOCONF=no ;;
971 whether $AUTOCONF${ACFLAGS:+ }$ACFLAGS works, libc_cv_autoconf_works, [dnl
972 if (cd $srcdir; $AUTOCONF $ACFLAGS configure.ac > /dev/null 2>&1); then
973 libc_cv_autoconf_works=yes
975 libc_cv_autoconf_works=no
977 test $libc_cv_autoconf_works = yes || AUTOCONF=no
980 if test "x$AUTOCONF" = xno; then
981 aux_missing="$aux_missing autoconf"
987 # Check for python3 if available, or else python.
988 AC_CHECK_PROGS(PYTHON_PROG, python3 python,no)
989 case "x$PYTHON_PROG" in
990 xno|x|x:) PYTHON_PROG=no ;;
994 if test "x$PYTHON_PROG" = xno; then
995 aux_missing="$aux_missing python"
997 PYTHON="$PYTHON_PROG -B"
1001 test -n "$critic_missing" && AC_MSG_ERROR([
1002 *** These critical programs are missing or too old:$critic_missing
1003 *** Check the INSTALL file for required versions.])
1005 test -n "$aux_missing" && AC_MSG_WARN([
1006 *** These auxiliary programs are missing or incompatible versions:$aux_missing
1007 *** some features or tests will be disabled.
1008 *** Check the INSTALL file for required versions.])
1010 # if using special system headers, find out the compiler's sekrit
1011 # header directory and add that to the list. NOTE: Only does the right
1012 # thing on a system that doesn't need fixincludes. (Not presently a problem.)
1013 if test -n "$sysheaders"; then
1014 SYSINCLUDES=-nostdinc
1015 for d in include include-fixed; do
1016 i=`$CC -print-file-name="$d"` && test "x$i" != x && test "x$i" != "x$d" &&
1017 SYSINCLUDES="$SYSINCLUDES -isystem $i"
1019 SYSINCLUDES="$SYSINCLUDES \
1020 -isystem `echo $sysheaders | sed 's/:/ -isystem /g'`"
1021 if test -n "$CXX"; then
1023 for cxxheaders in `$CXX -v -S -x c++ /dev/null -o /dev/null 2>&1 \
1024 | sed -n -e '1,/#include/d' -e 's/^ \(\/.*\/[cg]++\)/\1/p'`; do
1025 test "x$cxxheaders" != x &&
1026 CXX_SYSINCLUDES="$CXX_SYSINCLUDES -isystem $cxxheaders"
1030 AC_SUBST(SYSINCLUDES)
1031 AC_SUBST(CXX_SYSINCLUDES)
1033 # Obtain some C++ header file paths. This is used to make a local
1034 # copy of those headers in Makerules.
1035 if test -n "$CXX"; then
1036 find_cxx_header () {
1037 echo "#include <$1>" | $CXX -M -MP -x c++ - 2>/dev/null \
1038 | sed -n "\,$1:,{s/:\$//;p}"
1040 CXX_CSTDLIB_HEADER="$(find_cxx_header cstdlib)"
1041 CXX_CMATH_HEADER="$(find_cxx_header cmath)"
1042 CXX_BITS_STD_ABS_H="$(find_cxx_header bits/std_abs.h)"
1044 AC_SUBST(CXX_CSTDLIB_HEADER)
1045 AC_SUBST(CXX_CMATH_HEADER)
1046 AC_SUBST(CXX_BITS_STD_ABS_H)
1048 # Test if LD_LIBRARY_PATH contains the notation for the current directory
1049 # since this would lead to problems installing/building glibc.
1050 # LD_LIBRARY_PATH contains the current directory if one of the following
1052 # - one of the terminals (":" and ";") is the first or last sign
1053 # - two terminals occur directly after each other
1054 # - the path contains an element with a dot in it
1055 AC_MSG_CHECKING(LD_LIBRARY_PATH variable)
1057 case ${LD_LIBRARY_PATH} in
1058 [:\;]* | *[:\;] | *[:\;][:\;]* | *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* )
1059 ld_library_path_setting="contains current directory"
1062 ld_library_path_setting="ok"
1066 AC_MSG_RESULT($ld_library_path_setting)
1067 if test "$ld_library_path_setting" != "ok"; then
1069 *** LD_LIBRARY_PATH shouldn't contain the current directory when
1070 *** building glibc. Please change the environment variable
1071 *** and run configure again.])
1074 AC_PATH_PROG(BASH_SHELL, bash, no)
1076 AC_PATH_PROG(PERL, perl, no)
1077 if test "$PERL" != no &&
1078 (eval `$PERL -V:apiversion`; test `expr "$apiversion" \< 5` -ne 0); then
1081 AC_PATH_PROG(INSTALL_INFO, install-info, no,
1082 $PATH:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin)
1084 AC_CACHE_CHECK(for .set assembler directive, libc_cv_asm_set_directive, [dnl
1085 cat > conftest.s <<EOF
1088 .set glibc_conftest_frobozz,foo
1089 .globl glibc_conftest_frobozz
1091 # The alpha-dec-osf1 assembler gives only a warning for `.set'
1092 # (but it doesn't work), so we must do a linking check to be sure.
1093 cat > conftest1.c <<\EOF
1094 extern int glibc_conftest_frobozz;
1095 void _start() { glibc_conftest_frobozz = 1; }
1097 if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
1098 -nostartfiles -nostdlib $no_ssp \
1099 -o conftest conftest.s conftest1.c 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
1100 libc_cv_asm_set_directive=yes
1102 libc_cv_asm_set_directive=no
1105 if test $libc_cv_asm_set_directive = yes; then
1106 AC_DEFINE(HAVE_ASM_SET_DIRECTIVE)
1109 AC_CACHE_CHECK(linker support for protected data symbol,
1110 libc_cv_protected_data,
1111 [cat > conftest.c <<EOF
1112 int bar __attribute__ ((visibility ("protected"))) = 1;
1114 libc_cv_protected_data=no
1115 if AC_TRY_COMMAND(${CC-cc} -nostdlib -nostartfiles $no_ssp -fPIC -shared conftest.c -o conftest.so); then
1116 cat > conftest.c <<EOF
1118 int main (void) { return bar; }
1120 if AC_TRY_COMMAND(${CC-cc} -nostdlib -nostartfiles $no_ssp conftest.c -o conftest conftest.so); then
1121 libc_cv_protected_data=yes
1126 AC_SUBST(libc_cv_protected_data)
1128 AC_CACHE_CHECK(linker support for INSERT in linker script,
1130 [cat > conftest.c <<EOF
1131 const int __attribute__ ((section(".bar"))) bar = 0x12345678;
1132 int test (void) { return bar; }
1134 cat > conftest.t <<EOF
1139 INSERT AFTER .rela.dyn;
1142 if AC_TRY_COMMAND([${CC-cc} -nostdlib -nostartfiles $no_ssp -fPIC -shared conftest.c -Wl,-T,conftest.t -o conftest.so]); then
1147 AC_SUBST(libc_cv_insert)
1149 AC_CACHE_CHECK(for broken __attribute__((alias())),
1150 libc_cv_broken_alias_attribute,
1151 [cat > conftest.c <<EOF
1152 extern int foo (int x) __asm ("xyzzy");
1153 int bar (int x) { return x; }
1154 extern __typeof (bar) foo __attribute ((weak, alias ("bar")));
1156 extern __typeof (dfoo) dfoo __asm ("abccb");
1159 libc_cv_broken_alias_attribute=yes
1160 if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
1161 if grep 'xyzzy' conftest.s >/dev/null &&
1162 grep 'abccb' conftest.s >/dev/null; then
1163 libc_cv_broken_alias_attribute=no
1166 rm -f conftest.c conftest.s
1168 if test $libc_cv_broken_alias_attribute = yes; then
1169 AC_MSG_ERROR(working alias attribute support required)
1172 AC_CACHE_CHECK(whether to put _rtld_local into .sdata section,
1173 libc_cv_have_sdata_section,
1174 [echo "int i;" > conftest.c
1175 libc_cv_have_sdata_section=no
1176 if ${CC-cc} $LDFLAGS -fPIC -shared -Wl,--verbose conftest.c -o conftest.so 2>&1 \
1177 | grep '\.sdata' >/dev/null; then
1178 libc_cv_have_sdata_section=yes
1180 rm -f conftest.c conftest.so
1182 if test $libc_cv_have_sdata_section = yes; then
1183 AC_DEFINE(HAVE_SDATA_SECTION)
1186 AC_CACHE_CHECK(whether to use .ctors/.dtors header and trailer,
1187 libc_cv_ctors_header, [dnl
1188 libc_cv_ctors_header=yes
1189 LIBC_TRY_LINK_STATIC([
1190 __attribute__ ((constructor)) void ctor (void) { asm (""); }
1191 __attribute__ ((destructor)) void dtor (void) { asm (""); }
1194 AS_IF([$READELF -WS conftest$ac_exeext | $AWK '
1195 { gsub(/\@<:@ */, "@<:@") }
1196 $2 == ".ctors" || $2 == ".dtors" {
1197 size = strtonum("0x" $6)
1198 align = strtonum("0x" $NF)
1200 stub@<:@$2@:>@ = size == align * 2
1203 ctors_ok = !seen@<:@".ctors"@:>@ || stub@<:@".ctors"@:>@
1204 dtors_ok = !seen@<:@".dtors"@:>@ || stub@<:@".dtors"@:>@
1205 exit ((ctors_ok && dtors_ok) ? 0 : 1)
1207 '], [libc_cv_ctors_header=no])
1209 AC_MSG_ERROR([missing __attribute__ ((constructor)) support??])
1212 if test $libc_cv_ctors_header = no; then
1213 AC_DEFINE(NO_CTORS_DTORS_SECTIONS)
1216 AC_CACHE_CHECK(for libunwind-support in compiler,
1217 libc_cv_cc_with_libunwind, [
1218 cat > conftest.c <<EOF
1219 int main (void) { return 0; }
1221 if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -static -o conftest \
1222 conftest.c -v 2>&1 >/dev/null | grep ' -lunwind ' >/dev/null; then
1223 libc_cv_cc_with_libunwind=yes
1225 libc_cv_cc_with_libunwind=no
1228 AC_SUBST(libc_cv_cc_with_libunwind)
1229 if test $libc_cv_cc_with_libunwind = yes; then
1230 AC_DEFINE(HAVE_CC_WITH_LIBUNWIND)
1234 AC_CACHE_CHECK(whether --noexecstack is desirable for .S files,
1235 libc_cv_as_noexecstack, [dnl
1236 cat > conftest.c <<EOF
1239 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS
1240 -S -o conftest.s conftest.c 1>&AS_MESSAGE_LOG_FD]) \
1241 && grep .note.GNU-stack conftest.s >/dev/null \
1242 && AC_TRY_COMMAND([${CC-cc} $ASFLAGS -Wa,--noexecstack
1243 -c -o conftest.o conftest.s 1>&AS_MESSAGE_LOG_FD])
1245 libc_cv_as_noexecstack=yes
1247 libc_cv_as_noexecstack=no
1250 if test $libc_cv_as_noexecstack = yes; then
1251 ASFLAGS_config="$ASFLAGS_config -Wa,--noexecstack"
1253 AC_SUBST(ASFLAGS_config)
1255 AC_CACHE_CHECK(for -z combreloc,
1256 libc_cv_z_combreloc, [dnl
1257 cat > conftest.c <<EOF
1258 extern int bar (int);
1260 int foo (void) { return bar (mumble); }
1262 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1263 -fPIC -shared $no_ssp -o conftest.so conftest.c
1264 -nostdlib -nostartfiles
1265 -Wl,-z,combreloc 1>&AS_MESSAGE_LOG_FD])
1267 dnl The following test is a bit weak. We must use a tool which can test
1268 dnl cross-platform since the gcc used can be a cross compiler. Without
1269 dnl introducing new options this is not easily doable. Instead use a tool
1270 dnl which always is cross-platform: readelf. To detect whether -z combreloc
1271 dnl look for a section named .rel.dyn or .rela.dyn.
1272 if $READELF -S conftest.so | grep -E '.rela?.dyn' > /dev/null; then
1273 libc_cv_z_combreloc=yes
1275 libc_cv_z_combreloc=no
1278 libc_cv_z_combreloc=no
1281 if test "$libc_cv_z_combreloc" = yes; then
1282 AC_DEFINE(HAVE_Z_COMBRELOC)
1284 AC_SUBST(libc_cv_z_combreloc)
1286 LIBC_LINKER_FEATURE([-z execstack], [-Wl,-z,execstack],
1287 [libc_cv_z_execstack=yes], [libc_cv_z_execstack=no])
1288 AC_SUBST(libc_cv_z_execstack)
1290 AC_CACHE_CHECK(for -fpie, libc_cv_fpie, [dnl
1291 LIBC_TRY_CC_OPTION([-fpie], [libc_cv_fpie=yes], [libc_cv_fpie=no])
1294 AC_SUBST(libc_cv_fpie)
1296 AC_CACHE_CHECK(for --hash-style option,
1297 libc_cv_hashstyle, [dnl
1298 cat > conftest.c <<EOF
1299 int _start (void) { return 42; }
1301 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp
1302 -fPIC -shared -o conftest.so conftest.c
1303 -Wl,--hash-style=both -nostdlib 1>&AS_MESSAGE_LOG_FD])
1305 libc_cv_hashstyle=yes
1307 libc_cv_hashstyle=no
1310 AC_SUBST(libc_cv_hashstyle)
1312 # The linker's default -shared behavior is good enough if it
1313 # does these things that our custom linker scripts ensure that
1314 # all allocated NOTE sections come first.
1315 if test "$use_default_link" = default; then
1316 AC_CACHE_CHECK([for sufficient default -shared layout],
1317 libc_cv_use_default_link, [dnl
1318 libc_cv_use_default_link=no
1319 cat > conftest.s <<\EOF
1320 .section .note.a,"a",%note
1325 .section .note.b,"a",%note
1331 if AC_TRY_COMMAND([dnl
1332 ${CC-cc} $ASFLAGS -shared -o conftest.so conftest.s 1>&AS_MESSAGE_LOG_FD]) &&
1333 ac_try=`$READELF -S conftest.so | sed -n \
1335 s/^ *\[ *[1-9][0-9]*\] *\([^ ][^ ]*\) *\([^ ][^ ]*\) .*$/\2 \1/
1341 libc_seen_a=no libc_seen_b=no
1343 while test $# -ge 2 -a "$1" = NOTE; do
1345 .note.a) libc_seen_a=yes ;;
1346 .note.b) libc_seen_b=yes ;;
1350 case "$libc_seen_a$libc_seen_b" in
1352 libc_cv_use_default_link=yes
1355 echo >&AS_MESSAGE_LOG_FD "\
1356 $libc_seen_a$libc_seen_b from:
1362 use_default_link=$libc_cv_use_default_link
1365 AC_CACHE_CHECK(for GLOB_DAT reloc,
1366 libc_cv_has_glob_dat, [dnl
1367 cat > conftest.c <<EOF
1369 int foo (void) { return mumble; }
1371 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1372 -fPIC -shared -o conftest.so conftest.c
1373 -nostdlib -nostartfiles $no_ssp
1374 1>&AS_MESSAGE_LOG_FD])
1376 dnl look for GLOB_DAT relocation.
1377 if $READELF -rW conftest.so | grep '_GLOB_DAT' > /dev/null; then
1378 libc_cv_has_glob_dat=yes
1380 libc_cv_has_glob_dat=no
1383 libc_cv_has_glob_dat=no
1386 AC_SUBST(libc_cv_has_glob_dat)
1388 AC_CACHE_CHECK(linker output format, libc_cv_output_format, [dnl
1389 if libc_cv_output_format=`
1390 ${CC-cc} -nostartfiles -nostdlib $no_ssp -Wl,--print-output-format 2>&AS_MESSAGE_LOG_FD`
1394 libc_cv_output_format=
1396 test -n "$libc_cv_output_format" || libc_cv_output_format=unknown])
1397 AC_SUBST(libc_cv_output_format)
1399 AC_CACHE_CHECK(for -fno-toplevel-reorder -fno-section-anchors, libc_cv_fno_toplevel_reorder, [dnl
1400 cat > conftest.c <<EOF
1403 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -fno-toplevel-reorder -fno-section-anchors
1404 conftest.c 1>&AS_MESSAGE_LOG_FD])
1406 libc_cv_fno_toplevel_reorder=yes
1408 libc_cv_fno_toplevel_reorder=no
1411 if test $libc_cv_fno_toplevel_reorder = yes; then
1412 fno_unit_at_a_time="-fno-toplevel-reorder -fno-section-anchors"
1414 fno_unit_at_a_time=-fno-unit-at-a-time
1416 AC_SUBST(fno_unit_at_a_time)
1418 AC_CACHE_CHECK([for -mtls-dialect=gnu2], libc_cv_mtls_dialect_gnu2,
1420 cat > conftest.c <<EOF
1427 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -fPIC -mtls-dialect=gnu2
1428 conftest.c 1>&AS_MESSAGE_LOG_FD])
1430 libc_cv_mtls_dialect_gnu2=yes
1432 libc_cv_mtls_dialect_gnu2=no
1435 AC_SUBST(libc_cv_mtls_dialect_gnu2)
1436 LIBC_CONFIG_VAR([have-mtls-dialect-gnu2], [$libc_cv_mtls_dialect_gnu2])
1438 AC_CACHE_CHECK(whether cc puts quotes around section names,
1439 libc_cv_have_section_quotes,
1440 [cat > conftest.c <<EOF
1441 static const int foo
1442 __attribute__ ((section ("bar"))) = 1;
1444 if ${CC-cc} -S conftest.c -o conftest.s; then
1445 if grep '\.section.*"bar"' conftest.s >/dev/null; then
1446 libc_cv_have_section_quotes=yes
1448 libc_cv_have_section_quotes=no
1451 libc_cv_have_section_quotes=unknown
1453 rm -f conftest.{c,s}
1455 if test $libc_cv_have_section_quotes = yes; then
1456 AC_DEFINE(HAVE_SECTION_QUOTES)
1459 AC_CACHE_CHECK(for __builtin_memset, libc_cv_gcc_builtin_memset, [dnl
1460 cat > conftest.c <<\EOF
1463 __builtin_memset (x, 0, 1000);
1467 if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | grep -F "memset" > /dev/null]);
1469 libc_cv_gcc_builtin_memset=no
1471 libc_cv_gcc_builtin_memset=yes
1474 if test "$libc_cv_gcc_builtin_memset" = yes ; then
1475 AC_DEFINE(HAVE_BUILTIN_MEMSET)
1478 AC_CACHE_CHECK(for redirection of built-in functions, libc_cv_gcc_builtin_redirection, [dnl
1479 cat > conftest.c <<\EOF
1480 extern char *strstr (const char *, const char *) __asm ("my_strstr");
1481 char *foo (const char *a, const char *b)
1483 return __builtin_strstr (a, b);
1487 if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | grep -F "my_strstr" > /dev/null]);
1489 libc_cv_gcc_builtin_redirection=yes
1491 libc_cv_gcc_builtin_redirection=no
1494 if test "$libc_cv_gcc_builtin_redirection" = no; then
1495 AC_MSG_ERROR([support for the symbol redirection needed])
1498 dnl Determine how to disable generation of FMA instructions.
1499 AC_CACHE_CHECK([for compiler option to disable generation of FMA instructions],
1500 libc_cv_cc_nofma, [dnl
1502 for opt in -ffp-contract=off -mno-fused-madd; do
1503 LIBC_TRY_CC_OPTION([$opt], [libc_cv_cc_nofma=$opt; break])
1505 AC_SUBST(libc_cv_cc_nofma)
1507 if test -n "$submachine"; then
1508 AC_CACHE_CHECK([for compiler option for CPU variant],
1509 libc_cv_cc_submachine, [dnl
1510 libc_cv_cc_submachine=no
1511 for opt in "-march=$submachine" "-mcpu=$submachine"; do
1512 LIBC_TRY_CC_OPTION([$opt], [
1513 libc_cv_cc_submachine="$opt"
1516 if test "x$libc_cv_cc_submachine" = xno; then
1517 AC_MSG_ERROR([${CC-cc} does not support $submachine])
1520 AC_SUBST(libc_cv_cc_submachine)
1522 AC_CACHE_CHECK(if $CC accepts -fno-tree-loop-distribute-patterns with \
1523 __attribute__ ((__optimize__)), libc_cv_cc_loop_to_function, [dnl
1524 cat > conftest.c <<EOF
1526 __attribute__ ((__optimize__ ("-fno-tree-loop-distribute-patterns")))
1529 libc_cv_cc_loop_to_function=no
1530 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c])
1532 libc_cv_cc_loop_to_function=yes
1535 if test $libc_cv_cc_loop_to_function = yes; then
1536 AC_DEFINE(HAVE_CC_INHIBIT_LOOP_TO_LIBCALL)
1538 AC_SUBST(libc_cv_cc_loop_to_function)
1540 dnl Check whether we have the gd library available.
1541 AC_MSG_CHECKING(for libgd)
1542 if test "$with_gd" != "no"; then
1543 old_CFLAGS="$CFLAGS"
1544 CFLAGS="$CFLAGS $libgd_include"
1545 old_LDFLAGS="$LDFLAGS"
1546 LDFLAGS="$LDFLAGS $libgd_ldflags"
1548 LIBS="$LIBS -lgd -lpng -lz -lm"
1549 AC_TRY_LINK([#include <gd.h>], [gdImagePng (0, 0)], LIBGD=yes, LIBGD=no)
1550 CFLAGS="$old_CFLAGS"
1551 LDFLAGS="$old_LDFLAGS"
1556 AC_MSG_RESULT($LIBGD)
1560 if test x$with_selinux = xno ; then
1563 # See if we have the SELinux library
1564 AC_CHECK_LIB(selinux, is_selinux_enabled,
1565 have_selinux=yes, have_selinux=no)
1566 if test x$with_selinux = xyes ; then
1567 if test x$have_selinux = xno ; then
1568 AC_MSG_ERROR([SELinux explicitly required, but SELinux library not found])
1572 # Check if we're building with SELinux support.
1573 if test "x$have_selinux" = xyes; then
1574 AC_DEFINE(HAVE_SELINUX, 1, [SELinux support])
1576 # See if we have the libaudit library
1577 AC_CHECK_LIB(audit, audit_log_user_avc_message,
1578 have_libaudit=yes, have_libaudit=no)
1579 if test "x$have_libaudit" = xyes; then
1580 AC_DEFINE(HAVE_LIBAUDIT, 1, [SELinux libaudit support])
1582 AC_SUBST(have_libaudit)
1584 # See if we have the libcap library
1585 AC_CHECK_LIB(cap, cap_init, have_libcap=yes, have_libcap=no)
1586 if test "x$have_libcap" = xyes; then
1587 AC_DEFINE(HAVE_LIBCAP, 1, [SELinux libcap support])
1589 AC_SUBST(have_libcap)
1591 AC_SUBST(have_selinux)
1594 dnl Check for silly hacked compilers predefining _FORTIFY_SOURCE.
1595 dnl Since we are building the implementations of the fortified functions here,
1596 dnl having the macro defined interacts very badly.
1597 AC_CACHE_CHECK([for _FORTIFY_SOURCE predefine], libc_cv_predef_fortify_source,
1598 [AC_TRY_COMPILE([], [
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 # Some linkers on some architectures support __ehdr_start but with
1610 # bugs. Make sure usage of it does not create relocations in the
1611 # output (as the linker should resolve them all for us).
1612 AC_CACHE_CHECK([whether the linker provides working __ehdr_start],
1613 libc_cv_ehdr_start, [
1614 old_CFLAGS="$CFLAGS"
1615 old_LDFLAGS="$LDFLAGS"
1617 CFLAGS="$CFLAGS -fPIC"
1618 LDFLAGS="$LDFLAGS -nostdlib -nostartfiles -shared $no_ssp"
1620 AC_LINK_IFELSE([AC_LANG_SOURCE([
1625 extern const Ehdr __ehdr_start __attribute__ ((visibility ("hidden")));
1626 long ehdr (void) { return __ehdr_start.val; }
1628 [if $READELF -r conftest | grep -F __ehdr_start >/dev/null; then
1629 libc_cv_ehdr_start=broken
1631 libc_cv_ehdr_start=yes
1632 fi], [libc_cv_ehdr_start=no])
1633 CFLAGS="$old_CFLAGS"
1634 LDFLAGS="$old_LDFLAGS"
1637 if test "$libc_cv_ehdr_start" = yes; then
1638 AC_DEFINE([HAVE_EHDR_START])
1639 elif test "$libc_cv_ehdr_start" = broken; then
1640 AC_MSG_WARN([linker is broken -- you should upgrade])
1643 AC_CACHE_CHECK(for __builtin_trap with no external dependencies,
1644 libc_cv_builtin_trap, [dnl
1645 libc_cv_builtin_trap=no
1646 AC_TRY_COMPILE([], [__builtin_trap ()], [
1647 libc_undefs=`$NM -u conftest.o |
1648 LC_ALL=C $AWK '$1 == "U" { print $2 | "sort -u"; next } { exit(1) }' \
1649 2>&AS_MESSAGE_LOG_FD` || {
1650 AC_MSG_ERROR([confusing output from $NM -u])
1652 echo >&AS_MESSAGE_LOG_FD "libc_undefs='$libc_undefs'"
1653 if test -z "$libc_undefs"; then
1654 libc_cv_builtin_trap=yes
1656 if test $libc_cv_builtin_trap = yes; then
1657 AC_DEFINE([HAVE_BUILTIN_TRAP])
1660 dnl C++ feature tests.
1663 AC_CACHE_CHECK([whether the C++ compiler supports thread_local],
1664 libc_cv_cxx_thread_local, [
1665 old_CXXFLAGS="$CXXFLAGS"
1666 CXXFLAGS="$CXXFLAGS -std=gnu++11"
1667 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
1670 // Compiler support.
1677 S * get () { return &s; }
1679 // libstdc++ support.
1680 #ifndef _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL
1681 #error __cxa_thread_atexit_impl not supported
1684 [libc_cv_cxx_thread_local=yes],
1685 [libc_cv_cxx_thread_local=no])
1686 CXXFLAGS="$old_CXXFLAGS"
1688 AC_SUBST(libc_cv_cxx_thread_local)
1691 dnl End of C++ feature tests.
1693 ### End of automated tests.
1694 ### Now run sysdeps configure fragments.
1696 # They also can set these variables.
1698 ldd_rewrite_script=no
1699 libc_cv_sysconfdir=$sysconfdir
1700 libc_cv_localstatedir=$localstatedir
1701 libc_cv_gcc_unwind_find_fde=no
1704 # Iterate over all the sysdep directories we will use, running their
1705 # configure fragments.
1706 for dir in $sysnames; do
1709 *) dest=$srcdir/$dir ;;
1711 if test -r $dest/configure; then
1712 AC_MSG_RESULT(running configure fragment for $dir)
1717 if test x"$build_mathvec" = xnotset; then
1720 LIBC_CONFIG_VAR([build-mathvec], [$build_mathvec])
1722 AC_SUBST(libc_extra_cflags)
1723 AC_SUBST(libc_extra_cppflags)
1725 if test x$libc_cv_gcc_unwind_find_fde = xyes; then
1726 AC_DEFINE(EXPORT_UNWIND_FIND_FDE)
1728 AC_SUBST(libc_cv_gcc_unwind_find_fde)
1730 # A sysdeps configure fragment can reset this if IFUNC is not actually
1731 # usable even though the assembler knows how to generate the symbol type.
1732 if test x"$libc_cv_ld_gnu_indirect_function" = xyes; then
1733 AC_DEFINE(HAVE_IFUNC)
1736 if test x"$libc_cv_gcc_indirect_function" = xyes; then
1737 AC_DEFINE(HAVE_GCC_IFUNC)
1740 # This is far from the AC_ARG_ENABLE that sets it so that a sysdeps
1741 # configure fragment can override the value to prevent this AC_DEFINE.
1743 if test "x$use_nscd" != xno; then
1744 AC_DEFINE([USE_NSCD])
1746 if test "x$build_nscd" = xdefault; then
1747 build_nscd=$use_nscd
1750 AC_SUBST(libc_cv_slibdir)
1751 AC_SUBST(libc_cv_rtlddir)
1752 AC_SUBST(libc_cv_complocaledir)
1753 AC_SUBST(libc_cv_sysconfdir)
1754 AC_SUBST(libc_cv_localstatedir)
1755 AC_SUBST(libc_cv_rootsbindir)
1757 if test x$use_ldconfig = xyes; then
1758 AC_DEFINE(USE_LDCONFIG)
1760 AC_SUBST(use_ldconfig)
1761 AC_SUBST(ldd_rewrite_script)
1766 AC_CACHE_CHECK([whether -fPIC is default], libc_cv_pic_default,
1767 [libc_cv_pic_default=yes
1768 cat > conftest.c <<EOF
1769 #if defined __PIC__ || defined __pic__ || defined PIC || defined pic
1770 # error PIC is default.
1773 if eval "${CC-cc} -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
1774 libc_cv_pic_default=no
1777 AC_SUBST(libc_cv_pic_default)
1779 AC_CACHE_CHECK([whether -fPIE is default], libc_cv_pie_default,
1780 [libc_cv_pie_default=yes
1781 cat > conftest.c <<EOF
1782 #if defined __PIE__ || defined __pie__ || defined PIE || defined pie
1783 # error PIE is default.
1786 if eval "${CC-cc} -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
1787 libc_cv_pie_default=no
1790 AC_SUBST(libc_cv_pie_default)
1792 # Set the `multidir' variable by grabbing the variable from the compiler.
1793 # We do it once and save the result in a generated makefile.
1794 libc_cv_multidir=`${CC-cc} $CFLAGS $CPPFLAGS -print-multi-directory`
1795 AC_SUBST(libc_cv_multidir)
1798 AC_SUBST(static_nss)
1802 dnl See sysdeps/mach/configure.ac for this variable.
1803 AC_SUBST(mach_interface_list)
1805 VERSION=`sed -n -e 's/^#define VERSION "\([^"]*\)"/\1/p' < $srcdir/version.h`
1806 RELEASE=`sed -n -e 's/^#define RELEASE "\([^"]*\)"/\1/p' < $srcdir/version.h`
1810 AC_CONFIG_FILES([config.make Makefile])
1811 AC_CONFIG_COMMANDS([default],[[
1812 case $CONFIG_FILES in *config.make*)
1813 echo "$config_vars" >> config.make;;
1815 test -d bits || mkdir bits]],[[config_vars='$config_vars']])