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],
140 dnl This is a temporary hack, to help sort out wired-in GCC assumptions.
142 AC_HELP_STRING([--with-clang],
143 [if building with clang (temporary)]),
144 [with_clang=$withval],
146 LIBC_CONFIG_VAR([with-clang], [$with_clang])
147 dnl This is a temporary hack, to help with BFD LD vs LLD debugging.
149 AC_HELP_STRING([--with-lld],
150 [if building/linking with lld (temporary)]),
153 LIBC_CONFIG_VAR([with-lld], [$with_lld])
155 AC_ARG_WITH([headers],
156 AC_HELP_STRING([--with-headers=PATH],
157 [location of system headers to use
158 (for example /usr/src/linux/include)
159 @<:@default=compiler default@:>@]),
160 [sysheaders=$withval],
164 AC_SUBST(use_default_link)
165 AC_ARG_WITH([default-link],
166 AC_HELP_STRING([--with-default-link],
167 [do not use explicit linker scripts]),
168 [use_default_link=$withval],
169 [use_default_link=default])
171 AC_ARG_ENABLE([sanity-checks],
172 AC_HELP_STRING([--disable-sanity-checks],
173 [really do not use threads (should not be used except in special situations) @<:@default=yes@:>@]),
174 [enable_sanity=$enableval],
177 AC_ARG_ENABLE([shared],
178 AC_HELP_STRING([--enable-shared],
179 [build shared library @<:@default=yes if GNU ld@:>@]),
182 AC_ARG_ENABLE([profile],
183 AC_HELP_STRING([--enable-profile],
184 [build profiled library @<:@default=no@:>@]),
185 [profile=$enableval],
187 AC_ARG_ENABLE([static-pie],
188 AC_HELP_STRING([--enable-static-pie],
189 [enable static PIE support and use it in the testsuite @<:@default=no@:>@]),
190 [static_pie=$enableval],
192 AC_ARG_ENABLE([timezone-tools],
193 AC_HELP_STRING([--disable-timezone-tools],
194 [do not install timezone tools @<:@default=install@:>@]),
195 [enable_timezone_tools=$enableval],
196 [enable_timezone_tools=yes])
197 AC_SUBST(enable_timezone_tools)
199 AC_ARG_ENABLE([hardcoded-path-in-tests],
200 AC_HELP_STRING([--enable-hardcoded-path-in-tests],
201 [hardcode newly built glibc path in tests @<:@default=no@:>@]),
202 [hardcoded_path_in_tests=$enableval],
203 [hardcoded_path_in_tests=no])
204 AC_SUBST(hardcoded_path_in_tests)
206 AC_ARG_ENABLE([stackguard-randomization],
207 AC_HELP_STRING([--enable-stackguard-randomization],
208 [initialize __stack_chk_guard canary with a random number at program start]),
209 [enable_stackguard_randomize=$enableval],
210 [enable_stackguard_randomize=no])
211 if test "$enable_stackguard_randomize" = yes; then
212 AC_DEFINE(ENABLE_STACKGUARD_RANDOMIZE)
215 AC_ARG_ENABLE([hidden-plt],
216 AC_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 AC_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 AC_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 AC_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 AC_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 AC_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 AC_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 AC_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 AC_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 AC_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 AC_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([nss-crypt],
320 AC_HELP_STRING([--enable-nss-crypt],
321 [enable libcrypt to use nss]),
322 [nss_crypt=$enableval],
324 if test x$nss_crypt = xyes; then
325 nss_includes=-I$(nss-config --includedir 2>/dev/null)
326 if test $? -ne 0; then
327 AC_MSG_ERROR([cannot find include directory with nss-config])
329 nspr_includes=-I$(nspr-config --includedir 2>/dev/null)
330 if test $? -ne 0; then
331 AC_MSG_ERROR([cannot find include directory with nspr-config])
334 CFLAGS="$CFLAGS $nss_includes $nspr_includes"
335 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([typedef int PRBool;
337 #include <nsslowhash.h>
338 void f (void) { NSSLOW_Init (); }])],
339 libc_cv_nss_crypt=yes,
341 cannot find NSS headers with lowlevel hash function interfaces]))
343 old_LDFLAGS="$LDFLAGS"
344 LIBS="$LIBS -lfreebl3"
345 AC_LINK_IFELSE([AC_LANG_PROGRAM([typedef int PRBool;
347 #include <nsslowhash.h>],
349 libc_cv_nss_crypt=yes,
351 cannot link program using lowlevel NSS hash functions]))
352 # Check to see if there is a static NSS cryptographic library.
353 # If there isn't then we can't link anything with libcrypt.a,
354 # and that might mean disabling some static tests.
355 LDFLAGS="$LDFLAGS -static"
356 AC_LINK_IFELSE([AC_LANG_PROGRAM([typedef int PRBool;
358 #include <nsslowhash.h>],
360 libc_cv_static_nss_crypt=yes,
361 libc_cv_static_nss_crypt=no)
362 LDFLAGS="$old_LDFLAGS"
367 libc_cv_static_nss_crypt=no
369 AC_SUBST(libc_cv_nss_crypt)
370 AC_SUBST(libc_cv_static_nss_crypt)
373 AC_ARG_ENABLE([obsolete-rpc],
374 AC_HELP_STRING([--enable-obsolete-rpc],
375 [build and install the obsolete RPC code for link-time usage]),
376 [link_obsolete_rpc=$enableval],
377 [link_obsolete_rpc=no])
378 AC_SUBST(link_obsolete_rpc)
380 if test "$link_obsolete_rpc" = yes; then
381 AC_DEFINE(LINK_OBSOLETE_RPC)
384 AC_ARG_ENABLE([obsolete-nsl],
385 AC_HELP_STRING([--enable-obsolete-nsl],
386 [build and install the obsolete libnsl library and depending NSS modules]),
387 [build_obsolete_nsl=$enableval],
388 [build_obsolete_nsl=no])
389 AC_SUBST(build_obsolete_nsl)
391 if test "$build_obsolete_nsl" = yes; then
392 AC_DEFINE(LINK_OBSOLETE_NSL)
395 AC_ARG_ENABLE([systemtap],
396 [AS_HELP_STRING([--enable-systemtap],
397 [enable systemtap static probe points @<:@default=no@:>@])],
398 [systemtap=$enableval],
400 if test "x$systemtap" != xno; then
401 AC_CACHE_CHECK([for systemtap static probe support], libc_cv_sdt, [dnl
403 CFLAGS="-std=gnu11 $CFLAGS"
404 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <sys/sdt.h>
405 void foo (int i, void *p)
407 asm ("" STAP_PROBE_ASM (foo, bar, STAP_PROBE_ASM_TEMPLATE (2)) ""
408 :: STAP_PROBE_ASM_OPERANDS (2, i, p));
409 }]])], [libc_cv_sdt=yes], [libc_cv_sdt=no])
410 CFLAGS="$old_CFLAGS"])
411 if test $libc_cv_sdt = yes; then
412 AC_DEFINE([USE_STAP_PROBE])
413 elif test "x$systemtap" != xauto; then
414 AC_MSG_FAILURE([systemtap support needs sys/sdt.h with asm support])
418 AC_ARG_ENABLE([build-nscd],
419 [AS_HELP_STRING([--disable-build-nscd],
420 [disable building and installing the nscd daemon])],
421 [build_nscd=$enableval],
422 [build_nscd=default])
425 # Note the use of $use_nscd is near the bottom of the file.
426 AC_ARG_ENABLE([nscd],
427 [AS_HELP_STRING([--disable-nscd],
428 [library functions will not contact the nscd daemon])],
429 [use_nscd=$enableval],
432 AC_ARG_ENABLE([pt_chown],
433 [AS_HELP_STRING([--enable-pt_chown],
434 [Enable building and installing pt_chown])],
435 [build_pt_chown=$enableval],
437 AC_SUBST(build_pt_chown)
438 if test "$build_pt_chown" = yes; then
439 AC_DEFINE(HAVE_PT_CHOWN)
442 AC_ARG_ENABLE([tunables],
443 [AS_HELP_STRING([--enable-tunables],
444 [Enable tunables support. Known values are 'yes', 'no' and 'valstring'])],
445 [have_tunables=$enableval],
447 AC_SUBST(have_tunables)
448 if test "$have_tunables" = yes; then
449 AC_DEFINE(HAVE_TUNABLES)
452 AC_ARG_ENABLE([float128],
453 AC_HELP_STRING([--disable-float128],
454 [disable float128 support]),
455 [enable_float128=$enableval],
456 [enable_float128=yes])
457 AC_SUBST(enable_float128)
458 if test "$enable_float128" = yes; then
459 AC_DEFINE(WANT_FLOAT128)
462 # The abi-tags file uses a fairly simplistic model for name recognition that
463 # can't distinguish i486-pc-linux-gnu fully from i486-pc-gnu. So we mutate a
464 # $host_os of `gnu*' here to be `gnu-gnu*' just so that it can tell.
465 # This doesn't get used much beyond that, so it's fairly safe.
470 host_os=`echo $host_os | sed -e 's/gnu/gnu-gnu/'`
474 AC_ARG_ENABLE([mathvec],
475 [AS_HELP_STRING([--enable-mathvec],
476 [Enable building and installing mathvec @<:@default depends on architecture@:>@])],
477 [build_mathvec=$enableval],
478 [build_mathvec=notset])
480 # We keep the original values in `$config_*' and never modify them, so we
481 # can write them unchanged into config.make. Everything else uses
482 # $machine, $vendor, and $os, and changes them whenever convenient.
483 config_machine=$host_cpu config_vendor=$host_vendor config_os=$host_os
485 # Don't allow vendor == "unknown"
486 test "$config_vendor" = unknown && config_vendor=
487 config_os="`echo $config_os | sed 's/^unknown-//'`"
489 # Some configurations imply other options.
492 # The configure fragment of a port can modify these to supplement
493 # or override the table in the case statement below. No fragment should
494 # ever change the config_* variables, however.
495 machine=$config_machine
496 vendor=$config_vendor
502 AS_HELP_STRING([--with-cpu=CPU], [select code for CPU variant]),
505 yes|'') AC_MSG_ERROR([--with-cpu requires an argument]) ;;
507 *) submachine="$withval" ;;
511 # An preconfigure script can set this when it wants to disable the sanity
515 # A preconfigure script for a system that may or may not use fpu
516 # sysdeps directories sets this to a preprocessor conditional for
517 # whether to use such directories.
520 dnl Let sysdeps/*/preconfigure act here.
521 LIBC_PRECONFIGURE([$srcdir], [for sysdeps])
525 ### By using the undocumented --enable-hacker-mode option for configure
526 ### one can skip this test to make the configuration not fail for unsupported
529 if test -z "$enable_hacker_mode" && test x"$libc_config_ok" != xyes; then
530 case "$machine-$host_os" in
535 *** The GNU C library is currently unavailable for this platform.
536 *** If you are interested in seeing glibc on this platform visit
537 *** the "How to submit a new port" in the wiki:
538 *** https://sourceware.org/glibc/wiki/#Development
539 *** and join the community!])
544 # Set base_machine if not set by a preconfigure fragment.
545 test -n "$base_machine" || base_machine=$machine
546 AC_SUBST(base_machine)
548 # Determine whether to use fpu or nofpu sysdeps directories.
549 AC_CACHE_CHECK([for use of fpu sysdeps directories],
550 libc_cv_with_fp, [dnl
551 cat > conftest.c <<EOF
555 # error "no hardware floating point"
559 if ${CC-cc} $CFLAGS $CPPFLAGS -S conftest.c -o conftest.s \
560 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ; then
564 AC_SUBST(libc_cv_with_fp)
566 AC_CACHE_CHECK(for -fstack-protector, libc_cv_ssp, [dnl
567 LIBC_TRY_CC_OPTION([$CFLAGS $CPPFLAGS -Werror -fstack-protector],
572 AC_CACHE_CHECK(for -fstack-protector-strong, libc_cv_ssp_strong, [dnl
573 LIBC_TRY_CC_OPTION([$CFLAGS $CPPFLAGS -Werror -fstack-protector-strong],
574 [libc_cv_ssp_strong=yes],
575 [libc_cv_ssp_strong=no])
578 AC_CACHE_CHECK(for -fstack-protector-all, libc_cv_ssp_all, [dnl
579 LIBC_TRY_CC_OPTION([$CFLAGS $CPPFLAGS -Werror -fstack-protector-all],
580 [libc_cv_ssp_all=yes],
581 [libc_cv_ssp_all=no])
586 if test "$libc_cv_ssp" = yes; then
587 no_stack_protector="-fno-stack-protector -DSTACK_PROTECTOR_LEVEL=0"
588 AC_DEFINE(HAVE_CC_NO_STACK_PROTECTOR)
591 if test "$enable_stack_protector" = yes && test "$libc_cv_ssp" = yes; then
592 stack_protector="-fstack-protector"
593 AC_DEFINE(STACK_PROTECTOR_LEVEL, 1)
594 elif test "$enable_stack_protector" = all && test "$libc_cv_ssp_all" = yes; then
595 stack_protector="-fstack-protector-all"
596 AC_DEFINE(STACK_PROTECTOR_LEVEL, 2)
597 elif test "$enable_stack_protector" = strong && test "$libc_cv_ssp_strong" = yes; then
598 stack_protector="-fstack-protector-strong"
599 AC_DEFINE(STACK_PROTECTOR_LEVEL, 3)
601 stack_protector="-fno-stack-protector"
602 AC_DEFINE(STACK_PROTECTOR_LEVEL, 0)
604 AC_SUBST(libc_cv_ssp)
605 AC_SUBST(stack_protector)
606 AC_SUBST(no_stack_protector)
608 if test -n "$stack_protector"; then
609 dnl Don't run configure tests with stack-protection on, to avoid problems with
611 no_ssp=-fno-stack-protector
615 if test "$enable_stack_protector" != no; then
616 AC_MSG_ERROR([--enable-stack-protector=$enable_stack_protector specified, but specified level of stack protection is not supported by the compiler.])
620 # For the multi-arch option we need support in the assembler & linker.
621 AC_CACHE_CHECK([for assembler and linker STT_GNU_IFUNC support],
622 libc_cv_ld_gnu_indirect_function, [dnl
623 cat > conftest.S <<EOF
624 .type foo,%gnu_indirect_function
637 libc_cv_ld_gnu_indirect_function=no
638 if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
639 -nostartfiles -nostdlib $no_ssp \
640 -o conftest conftest.S 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
641 # Do a link to see if the backend supports IFUNC relocs.
642 $READELF -r conftest 1>&AS_MESSAGE_LOG_FD
643 LC_ALL=C $READELF -r conftest | grep 'no relocations' >/dev/null || {
644 libc_cv_ld_gnu_indirect_function=yes
649 # Check if gcc supports attribute ifunc as it is used in libc_ifunc macro.
650 AC_CACHE_CHECK([for gcc attribute ifunc support],
651 libc_cv_gcc_indirect_function, [dnl
652 cat > conftest.c <<EOF
653 extern int func (int);
654 int used_func (int a)
658 static void *resolver ()
662 extern __typeof (func) func __attribute__ ((ifunc ("resolver")));
664 libc_cv_gcc_indirect_function=no
665 if ${CC-cc} -c conftest.c -o conftest.o 1>&AS_MESSAGE_LOG_FD \
666 2>&AS_MESSAGE_LOG_FD ; then
667 if $READELF -s conftest.o | grep IFUNC >/dev/null 2>&AS_MESSAGE_LOG_FD; then
668 libc_cv_gcc_indirect_function=yes
673 # Check if CC supports attribute retain as it is used in attribute_used_retain macro.
674 AC_CACHE_CHECK([for GNU attribute retain support],
675 libc_cv_gnu_retain, [dnl
676 cat > conftest.c <<EOF
677 static int var __attribute__ ((used, retain, section ("__libc_atexit")));
679 libc_cv_gnu_retain=no
680 if ${CC-cc} -Werror -c conftest.c -o /dev/null 1>&AS_MESSAGE_LOG_FD \
681 2>&AS_MESSAGE_LOG_FD ; then
682 libc_cv_gnu_retain=yes
685 if test $libc_cv_gnu_retain = yes; then
686 AC_DEFINE(HAVE_GNU_RETAIN)
688 LIBC_CONFIG_VAR([have-gnu-retain], [$libc_cv_gnu_retain])
690 # Check if gcc warns about alias for function with incompatible types.
691 AC_CACHE_CHECK([if compiler warns about alias for function with incompatible types],
692 libc_cv_gcc_incompatible_alias, [dnl
693 cat > conftest.c <<EOF
694 int __redirect_foo (const void *s, int c);
696 __typeof (__redirect_foo) *foo_impl (void) __asm__ ("foo");
697 __typeof (__redirect_foo) *foo_impl (void)
702 extern __typeof (__redirect_foo) foo_alias __attribute__ ((alias ("foo")));
704 libc_cv_gcc_incompatible_alias=yes
705 if ${CC-cc} -Werror -c conftest.c -o conftest.o 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ; then
706 libc_cv_gcc_incompatible_alias=no
710 if test x"$libc_cv_ld_gnu_indirect_function" != xyes; then
711 if test x"$multi_arch" = xyes; then
712 AC_MSG_ERROR([--enable-multi-arch support requires assembler and linker support])
717 if test x"$libc_cv_gcc_indirect_function" != xyes; then
718 # GCC 8+ emits a warning for alias with incompatible types and it might
719 # fail to build ifunc resolvers aliases to either weak or internal
720 # symbols. Disables multiarch build in this case.
721 if test x"$libc_cv_gcc_incompatible_alias" == xyes; then
722 AC_MSG_WARN([gcc emits a warning for alias between functions of incompatible types])
723 if test x"$multi_arch" = xyes; then
724 AC_MSG_ERROR([--enable-multi-arch support requires a gcc with gnu-indirect-function support])
726 AC_MSG_WARN([Multi-arch is disabled.])
728 elif test x"$multi_arch" = xyes; then
729 AC_MSG_WARN([--enable-multi-arch support recommends a gcc with gnu-indirect-function support.
730 Please use a gcc which supports it by default or configure gcc with --enable-gnu-indirect-function])
734 if test x"$multi_arch" != xno; then
735 multi_arch_d=/multiarch
738 # Compute the list of sysdep directories for this configuration.
739 # This can take a while to compute.
740 sysdep_dir=$srcdir/sysdeps
741 AC_MSG_CHECKING(sysdep dirs)
742 dnl We need to use [ and ] for other purposes for a while now.
744 # Make sco3.2v4 become sco3.2.4 and sunos4.1.1_U1 become sunos4.1.1.U1.
745 os="`echo $os | sed 's/\([0-9A-Z]\)[v_]\([0-9A-Z]\)/\1.\2/g'`"
747 test "x$base_os" != x || case "$os" in
754 # For sunos4.1.1, try sunos4.1.1, then sunos4.1, then sunos4, then sunos.
757 while o=`echo $tail | sed 's/\.[^.]*$//'`; test $o != $tail; do
761 o=`echo $tail | sed 's/[0-9]*$//'`
762 if test $o != $tail; then
765 # For linux-gnu, try linux-gnu, then linux.
766 o=`echo $tail | sed 's/-.*$//'`
767 if test $o != $tail; then
771 # For unix/sysv/sysv4, try unix/sysv/sysv4, then unix/sysv, then unix.
774 while b=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$b"; do
780 # For sparc/sparc32, try sparc/sparc32 and then sparc.
782 tail=$machine${submachine:+/$submachine}
783 while m=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$m"; do
785 # Prepend the machine's FPU directory unless --without-fp.
786 if test "$libc_cv_with_fp" = yes; then
791 # For each machine term, try it with and then without /multiarch.
792 for try_fpu in $maybe_fpu ''; do
793 for try_multi in $multi_arch_d ''; do
794 mach="$mach /$1$try_fpu$try_multi"
800 dnl We are done with glob and regexp uses of [ and ]; return to autoconf.
803 # Find what sysdep directories exist.
805 for b in $base ''; do
806 for m0 in $mach ''; do
807 for v in /$vendor ''; do
808 test "$v" = / && continue
809 for o in /$ostry ''; do
810 test "$o" = / && continue
811 for m in $mach ''; do
812 try_suffix="$m0$b$v$o$m"
813 if test -n "$try_suffix"; then
814 try_srcdir="${srcdir}/"
815 try="sysdeps$try_suffix"
816 test -n "$enable_debug_configure" &&
817 echo "$0 [DEBUG]: try $try" >&2
818 if test -d "$try_srcdir$try"; then
819 sysnames="$sysnames $try"
820 { test -n "$o" || test -n "$b"; } && os_used=t
821 { test -n "$m" || test -n "$m0"; } && machine_used=t
823 x*/$submachine) submachine_used=t ;;
833 # If the assembler supports gnu_indirect_function symbol type and the
834 # architecture supports multi-arch, we enable multi-arch by default.
839 test x"$multi_arch" = xdefault && multi_arch=no
842 if test x"$multi_arch" != xno; then
843 AC_DEFINE(USE_MULTIARCH)
847 if test -z "$os_used" && test "$os" != none; then
848 AC_MSG_ERROR(Operating system $os is not supported.)
850 if test -z "$machine_used" && test "$machine" != none; then
851 AC_MSG_ERROR(The $machine is not supported.)
853 if test -z "$submachine_used" && test -n "$submachine"; then
854 AC_MSG_ERROR(The $submachine subspecies of $host_cpu is not supported.)
858 # We have now validated the configuration.
860 # Expand the list of system names into a full list of directories
861 # from each element's parent name and Implies file (if present).
864 while test $# -gt 0; do
868 case " $names " in *" $name "*)
869 # Already in the list.
873 # Report each name as we discover it, so there is no long pause in output.
874 echo $ECHO_N "$name $ECHO_C" >&AS_MESSAGE_FD
876 name_base=`echo $name | sed -e 's@\(.*sysdeps\)/.*@\1@'`
880 *) xsrcdir=$srcdir/ ;;
882 test -n "$enable_debug_configure" &&
883 echo "[DEBUG]: name/Implies $xsrcdir$name/Implies" >&2
885 for implies_file in Implies Implies-before Implies-after; do
886 implies_type=`echo $implies_file | sed s/-/_/`
887 eval ${implies_type}=
888 if test -f $xsrcdir$name/$implies_file; then
889 # Collect more names from the `Implies' file (removing comments).
890 implied_candidate="`sed 's/#.*$//' < $xsrcdir$name/$implies_file`"
891 for x in $implied_candidate; do
893 if test -d $xsrcdir$name_base/$x; then
894 eval "${implies_type}=\"\$${implies_type} \$name_base/\$x\""
899 test -n "$enable_debug_configure" &&
900 echo "[DEBUG]: $name $implies_file $x try() {$try_srcdir}$try" >&2
901 if test $try != $xsrcdir$name_base/$x && test -d $try_srcdir$try;
903 eval "${implies_type}=\"\$${implies_type} \$try\""
906 if test $found = no; then
907 AC_MSG_WARN($name/$implies_file specifies nonexistent $x)
913 # Add NAME to the list of names.
916 # Find the parent of NAME, using the empty string if it has none.
918 parent="`echo $name | sed -n -e 's=/[^/]*$==' -e '/sysdeps$/q' -e p`"
921 test -n "$enable_debug_configure" &&
922 echo "[DEBUG]: $name Implies='$Implies' rest='$*' parent='$parent' \
923 Implies_before='$Implies_before' Implies_after='$Implies_after'" >&2
925 # Add the names implied by NAME, and NAME's parent (if it has one), to
926 # the list of names to be processed (the argument list). We prepend the
927 # implied names to the list and append the parent. We want implied
928 # directories to come before further directories inferred from the
929 # configuration components; this ensures that for sysv4, unix/common
930 # (implied by unix/sysv/sysv4) comes before unix/sysv (in ostry (here $*)
932 sysnames="`echo $Implies $* $Implies_before $parent $Implies_after`"
933 test -n "$sysnames" && set $sysnames
936 # Add the default directories.
937 default_sysnames="sysdeps/generic"
938 sysnames="$names $default_sysnames"
940 # The other names were emitted during the scan.
941 AC_MSG_RESULT($default_sysnames)
947 if test "$INSTALL" = "${srcdir}/scripts/install-sh -c"; then
948 # The makefiles need to use a different form to find it in $srcdir.
949 INSTALL='\$(..)./scripts/install-sh -c'
955 if test "$with_clang" = no; then
956 # Accept binutils 2.25 or newer.
957 AC_CHECK_PROG_VER(AS, $AS, --version,
958 [GNU assembler.* \([0-9]*\.[0-9.]*\)],
959 [2.1[0-9][0-9]*|2.2[5-9]*|2.[3-9][0-9]*|[3-9].*|[1-9][0-9]*],
960 AS=: critic_missing="$critic_missing as")
963 if test "$with_lld" = no; then
964 if test -n "`$LD --version | sed -n 's/^GNU \(gold\).*$/\1/p'`"; then
965 # Accept gold 1.14 or higher
966 AC_CHECK_PROG_VER(LD, $LD, --version,
967 [GNU gold.* \([0-9][0-9]*\.[0-9.]*\)],
968 [1.1[4-9]*|1.[2-9][0-9]*|1.1[0-9][0-9]*|[2-9].*|[1-9][0-9]*],
969 LD=: critic_missing="$critic_missing GNU gold")
971 AC_CHECK_PROG_VER(LD, $LD, --version,
972 [GNU ld.* \([0-9][0-9]*\.[0-9.]*\)],
973 [2.1[0-9][0-9]*|2.2[5-9]*|2.[3-9][0-9]*|[3-9].*|[1-9][0-9]*],
974 LD=: critic_missing="$critic_missing GNU ld")
978 # These programs are version sensitive.
980 AC_CHECK_PROG_VER(MAKE, gnumake gmake make, --version,
981 [GNU Make[^0-9]*\([0-9][0-9.]*\)],
982 [3.79* | 3.[89]* | [4-9].* | [1-9][0-9]*], critic_missing="$critic_missing make")
984 AC_CHECK_PROG_VER(MSGFMT, gnumsgfmt gmsgfmt msgfmt, --version,
985 [GNU gettext.* \([0-9]*\.[0-9.]*\)],
986 [0.10.3[6-9]* | 0.10.[4-9][0-9]* | 0.1[1-9]* | 0.[2-9][0-9]* | [1-9].*],
987 MSGFMT=: aux_missing="$aux_missing msgfmt")
988 AC_CHECK_PROG_VER(MAKEINFO, makeinfo, --version,
989 [GNU texinfo.* \([0-9][0-9.]*\)],
990 [4.[7-9]*|4.[1-9][0-9]*|[5-9].*],
991 MAKEINFO=: aux_missing="$aux_missing makeinfo")
992 AC_CHECK_PROG_VER(SED, sed, --version,
993 [GNU sed[^0-9]* \([0-9]*\.[0-9.]*\)],
994 [3.0[2-9]*|3.[1-9]*|[4-9]*],
995 SED=: aux_missing="$aux_missing sed")
996 AC_CHECK_PROG_VER(AWK, gawk, --version,
997 [GNU Awk[^0-9]*\([0-9][0-9.]*\)],
998 [3.1.[2-9]*|3.[2-9]*|[4-9]*], critic_missing="$critic_missing gawk")
999 AC_CHECK_PROG_VER(BISON, bison, --version,
1000 [bison (GNU Bison) \([0-9]*\.[0-9.]*\)],
1001 [2.7*|[3-9].*|[1-9][0-9]*], critic_missing="$critic_missing bison")
1003 AC_CACHE_CHECK([if $CC is sufficient to build libc], libc_cv_compiler_ok, [
1004 AC_TRY_COMPILE([], [
1005 #if !defined __GNUC__ || __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 9)
1006 #if !defined __clang__
1007 #error insufficient compiler
1010 [libc_cv_compiler_ok=yes],
1011 [libc_cv_compiler_ok=no])])
1012 AS_IF([test $libc_cv_compiler_ok != yes],
1013 [critic_missing="$critic_missing compiler"])
1015 AC_CHECK_TOOL(NM, nm, false)
1017 if test "x$maintainer" = "xyes"; then
1018 AC_CHECK_PROGS(AUTOCONF, autoconf, no)
1019 case "x$AUTOCONF" in
1020 xno|x|x:) AUTOCONF=no ;;
1023 whether $AUTOCONF${ACFLAGS:+ }$ACFLAGS works, libc_cv_autoconf_works, [dnl
1024 if (cd $srcdir; $AUTOCONF $ACFLAGS configure.ac > /dev/null 2>&1); then
1025 libc_cv_autoconf_works=yes
1027 libc_cv_autoconf_works=no
1029 test $libc_cv_autoconf_works = yes || AUTOCONF=no
1032 if test "x$AUTOCONF" = xno; then
1033 aux_missing="$aux_missing autoconf"
1039 # Check for python3 if available, or else python.
1040 AC_CHECK_PROGS(PYTHON_PROG, python3 python,no)
1041 case "x$PYTHON_PROG" in
1042 xno|x|x:) PYTHON_PROG=no ;;
1046 if test "x$PYTHON_PROG" = xno; then
1047 aux_missing="$aux_missing python"
1049 PYTHON="$PYTHON_PROG -B"
1053 test -n "$critic_missing" && AC_MSG_ERROR([
1054 *** These critical programs are missing or too old:$critic_missing
1055 *** Check the INSTALL file for required versions.])
1057 test -n "$aux_missing" && AC_MSG_WARN([
1058 *** These auxiliary programs are missing or incompatible versions:$aux_missing
1059 *** some features or tests will be disabled.
1060 *** Check the INSTALL file for required versions.])
1062 # if using special system headers, find out the compiler's sekrit
1063 # header directory and add that to the list. NOTE: Only does the right
1064 # thing on a system that doesn't need fixincludes. (Not presently a problem.)
1065 if test -n "$sysheaders"; then
1066 SYSINCLUDES=-nostdinc
1067 for d in include include-fixed; do
1068 i=`$CC -print-file-name="$d"` && test "x$i" != x && test "x$i" != "x$d" &&
1069 SYSINCLUDES="$SYSINCLUDES -isystem $i"
1071 SYSINCLUDES="$SYSINCLUDES \
1072 -isystem `echo $sysheaders | sed 's/:/ -isystem /g'`"
1073 if test -n "$CXX"; then
1075 for cxxheaders in `$CXX -v -S -x c++ /dev/null -o /dev/null 2>&1 \
1076 | sed -n -e '1,/#include/d' -e 's/^ \(\/.*\/[cg]++\)/\1/p'`; do
1077 test "x$cxxheaders" != x &&
1078 CXX_SYSINCLUDES="$CXX_SYSINCLUDES -isystem $cxxheaders"
1082 AC_SUBST(SYSINCLUDES)
1083 AC_SUBST(CXX_SYSINCLUDES)
1085 # Obtain some C++ header file paths. This is used to make a local
1086 # copy of those headers in Makerules.
1088 if test -n "$CXX"; then
1089 # In theory the clang and gcc regexes can be merged, but the
1090 # result is incomprehensible.
1091 if test "$with_clang" != no; then
1092 find_cxx_header () {
1093 echo "#include <$1>" | $CXX -M -MP -x c++ - 2>/dev/null \
1094 | sed -n "\,^[o.-]*[ :] /.*/$1 [\]$,{s,^[o.-]*[ :] /,/,;s/ [\]$//;p}"
1097 find_cxx_header () {
1098 echo "#include <$1>" | $CXX -M -MP -x c++ - 2>/dev/null \
1099 | sed -n "\,$1:,{s/:\$//;p}"
1102 CXX_CSTDLIB_HEADER="$(find_cxx_header cstdlib)"
1103 CXX_CMATH_HEADER="$(find_cxx_header cmath)"
1104 CXX_BITS_STD_ABS_H="$(find_cxx_header bits/std_abs.h)"
1107 AC_SUBST(CXX_CSTDLIB_HEADER)
1108 AC_SUBST(CXX_CMATH_HEADER)
1109 AC_SUBST(CXX_BITS_STD_ABS_H)
1111 # Test if LD_LIBRARY_PATH contains the notation for the current directory
1112 # since this would lead to problems installing/building glibc.
1113 # LD_LIBRARY_PATH contains the current directory if one of the following
1115 # - one of the terminals (":" and ";") is the first or last sign
1116 # - two terminals occur directly after each other
1117 # - the path contains an element with a dot in it
1118 AC_MSG_CHECKING(LD_LIBRARY_PATH variable)
1120 case ${LD_LIBRARY_PATH} in
1121 [:\;]* | *[:\;] | *[:\;][:\;]* | *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* )
1122 ld_library_path_setting="contains current directory"
1125 ld_library_path_setting="ok"
1129 AC_MSG_RESULT($ld_library_path_setting)
1130 if test "$ld_library_path_setting" != "ok"; then
1132 *** LD_LIBRARY_PATH shouldn't contain the current directory when
1133 *** building glibc. Please change the environment variable
1134 *** and run configure again.])
1137 AC_PATH_PROG(BASH_SHELL, bash, no)
1139 AC_PATH_PROG(PERL, perl, no)
1140 if test "$PERL" != no &&
1141 (eval `$PERL -V:apiversion`; test `expr "$apiversion" \< 5` -ne 0); then
1144 AC_PATH_PROG(INSTALL_INFO, install-info, no,
1145 $PATH:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin)
1147 AC_CACHE_CHECK(for .set assembler directive, libc_cv_asm_set_directive, [dnl
1148 cat > conftest.s <<EOF
1151 .set glibc_conftest_frobozz,foo
1152 .globl glibc_conftest_frobozz
1154 # The alpha-dec-osf1 assembler gives only a warning for `.set'
1155 # (but it doesn't work), so we must do a linking check to be sure.
1156 cat > conftest1.c <<\EOF
1157 extern int glibc_conftest_frobozz;
1158 void _start() { glibc_conftest_frobozz = 1; }
1160 if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
1161 -nostartfiles -nostdlib $no_ssp \
1162 -o conftest conftest.s conftest1.c 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
1163 libc_cv_asm_set_directive=yes
1165 libc_cv_asm_set_directive=no
1168 if test $libc_cv_asm_set_directive = yes; then
1169 AC_DEFINE(HAVE_ASM_SET_DIRECTIVE)
1172 AC_CACHE_CHECK(linker support for protected data symbol,
1173 libc_cv_protected_data,
1174 [cat > conftest.c <<EOF
1175 int bar __attribute__ ((visibility ("protected"))) = 1;
1177 libc_cv_protected_data=no
1178 if AC_TRY_COMMAND(${CC-cc} -nostdlib -nostartfiles $no_ssp -fPIC -shared conftest.c -o conftest.so); then
1179 cat > conftest.c <<EOF
1181 int main (void) { return bar; }
1183 if AC_TRY_COMMAND(${CC-cc} -nostdlib -nostartfiles $no_ssp conftest.c -o conftest conftest.so); then
1184 libc_cv_protected_data=yes
1189 AC_SUBST(libc_cv_protected_data)
1191 AC_CACHE_CHECK(linker support for INSERT in linker script,
1193 [cat > conftest.c <<EOF
1194 const int __attribute__ ((section(".bar"))) bar = 0x12345678;
1195 int test (void) { return bar; }
1197 cat > conftest.t <<EOF
1202 INSERT AFTER .rela.dyn;
1205 if AC_TRY_COMMAND([${CC-cc} -nostdlib -nostartfiles $no_ssp -fPIC -shared conftest.c -Wl,-T,conftest.t -o conftest.so]); then
1210 AC_SUBST(libc_cv_insert)
1212 AC_CACHE_CHECK(for broken __attribute__((alias())),
1213 libc_cv_broken_alias_attribute,
1214 [cat > conftest.c <<EOF
1215 extern int foo (int x) __asm ("xyzzy");
1216 int bar (int x) { return x; }
1217 extern __typeof (bar) foo __attribute ((weak, alias ("bar")));
1219 extern __typeof (dfoo) dfoo __asm ("abccb");
1222 libc_cv_broken_alias_attribute=yes
1223 if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
1224 if grep 'xyzzy' conftest.s >/dev/null &&
1225 grep 'abccb' conftest.s >/dev/null; then
1226 libc_cv_broken_alias_attribute=no
1229 rm -f conftest.c conftest.s
1231 if test $libc_cv_broken_alias_attribute = yes; then
1232 AC_MSG_ERROR(working alias attribute support required)
1235 AC_CACHE_CHECK(whether to put _rtld_local into .sdata section,
1236 libc_cv_have_sdata_section,
1237 [echo "int i;" > conftest.c
1238 libc_cv_have_sdata_section=no
1239 if ${CC-cc} $LDFLAGS -fPIC -shared -Wl,--verbose conftest.c -o conftest.so 2>&1 \
1240 | grep '\.sdata' >/dev/null; then
1241 libc_cv_have_sdata_section=yes
1243 rm -f conftest.c conftest.so
1245 if test $libc_cv_have_sdata_section = yes; then
1246 AC_DEFINE(HAVE_SDATA_SECTION)
1249 AC_CACHE_CHECK(whether to use .ctors/.dtors header and trailer,
1250 libc_cv_ctors_header, [dnl
1251 libc_cv_ctors_header=yes
1252 LIBC_TRY_LINK_STATIC([
1253 __attribute__ ((constructor)) void ctor (void) { asm (""); }
1254 __attribute__ ((destructor)) void dtor (void) { asm (""); }
1257 AS_IF([$READELF -WS conftest$ac_exeext | $AWK '
1258 { gsub(/\@<:@ */, "@<:@") }
1259 $2 == ".ctors" || $2 == ".dtors" {
1260 size = strtonum("0x" $6)
1261 align = strtonum("0x" $NF)
1263 stub@<:@$2@:>@ = size == align * 2
1266 ctors_ok = !seen@<:@".ctors"@:>@ || stub@<:@".ctors"@:>@
1267 dtors_ok = !seen@<:@".dtors"@:>@ || stub@<:@".dtors"@:>@
1268 exit ((ctors_ok && dtors_ok) ? 0 : 1)
1270 '], [libc_cv_ctors_header=no])
1272 AC_MSG_ERROR([missing __attribute__ ((constructor)) support??])
1275 if test $libc_cv_ctors_header = no; then
1276 AC_DEFINE(NO_CTORS_DTORS_SECTIONS)
1279 AC_CACHE_CHECK(for libunwind-support in compiler,
1280 libc_cv_cc_with_libunwind, [
1281 cat > conftest.c <<EOF
1282 int main (void) { return 0; }
1284 if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -static -o conftest \
1285 conftest.c -v 2>&1 >/dev/null | grep ' -lunwind ' >/dev/null; then
1286 libc_cv_cc_with_libunwind=yes
1288 libc_cv_cc_with_libunwind=no
1291 AC_SUBST(libc_cv_cc_with_libunwind)
1292 if test $libc_cv_cc_with_libunwind = yes; then
1293 AC_DEFINE(HAVE_CC_WITH_LIBUNWIND)
1297 AC_CACHE_CHECK(whether --noexecstack is desirable for .S files,
1298 libc_cv_as_noexecstack, [dnl
1299 cat > conftest.c <<EOF
1302 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS
1303 -S -o conftest.s conftest.c 1>&AS_MESSAGE_LOG_FD]) \
1304 && grep .note.GNU-stack conftest.s >/dev/null \
1305 && AC_TRY_COMMAND([${CC-cc} $ASFLAGS -Wa,--noexecstack
1306 -c -o conftest.o conftest.s 1>&AS_MESSAGE_LOG_FD])
1308 libc_cv_as_noexecstack=yes
1310 libc_cv_as_noexecstack=no
1313 if test $libc_cv_as_noexecstack = yes; then
1314 ASFLAGS_config="$ASFLAGS_config -Wa,--noexecstack"
1316 AC_SUBST(ASFLAGS_config)
1318 AC_CACHE_CHECK(for -z combreloc,
1319 libc_cv_z_combreloc, [dnl
1320 cat > conftest.c <<EOF
1321 extern int bar (int);
1323 int foo (void) { return bar (mumble); }
1325 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1326 -fPIC -shared $no_ssp -o conftest.so conftest.c
1327 -nostdlib -nostartfiles
1328 -Wl,-z,combreloc 1>&AS_MESSAGE_LOG_FD])
1330 dnl The following test is a bit weak. We must use a tool which can test
1331 dnl cross-platform since the gcc used can be a cross compiler. Without
1332 dnl introducing new options this is not easily doable. Instead use a tool
1333 dnl which always is cross-platform: readelf. To detect whether -z combreloc
1334 dnl look for a section named .rel.dyn or .rela.dyn.
1335 if $READELF -S conftest.so | grep -E '.rela?.dyn' > /dev/null; then
1336 libc_cv_z_combreloc=yes
1338 libc_cv_z_combreloc=no
1341 libc_cv_z_combreloc=no
1344 if test "$libc_cv_z_combreloc" = yes; then
1345 AC_DEFINE(HAVE_Z_COMBRELOC)
1347 AC_SUBST(libc_cv_z_combreloc)
1349 LIBC_LINKER_FEATURE([-z execstack], [-Wl,-z,execstack],
1350 [libc_cv_z_execstack=yes], [libc_cv_z_execstack=no])
1351 AC_SUBST(libc_cv_z_execstack)
1353 LIBC_LINKER_FEATURE([-z start-stop-gc], [-Wl,-z,start-stop-gc],
1354 [libc_cv_z_start_stop_gc=yes], [libc_cv_z_start_stop_gc=no])
1355 LIBC_CONFIG_VAR([have-z-start-stop-gc], [$libc_cv_z_start_stop_gc])
1357 LIBC_LINKER_FEATURE([-z pack-relative-relocs],
1358 [-Wl,-z,pack-relative-relocs],
1359 [libc_cv_dt_relr=yes], [libc_cv_dt_relr=no])
1360 LIBC_CONFIG_VAR([have-dt-relr], [$libc_cv_dt_relr])
1362 LIBC_LINKER_FEATURE([--no-dynamic-linker],
1363 [-Wl,--no-dynamic-linker],
1364 [libc_cv_no_dynamic_linker=yes],
1365 [libc_cv_no_dynamic_linker=no])
1366 LIBC_CONFIG_VAR([have-no-dynamic-linker], [$libc_cv_no_dynamic_linker])
1368 AC_CACHE_CHECK(for -static-pie, libc_cv_static_pie, [dnl
1369 LIBC_TRY_CC_OPTION([-static-pie],
1370 [libc_cv_static_pie=yes],
1371 [libc_cv_static_pie=no])
1373 LIBC_CONFIG_VAR([have-static-pie], [$libc_cv_static_pie])
1375 AC_CACHE_CHECK(for -fpie, libc_cv_fpie, [dnl
1376 LIBC_TRY_CC_OPTION([-fpie], [libc_cv_fpie=yes], [libc_cv_fpie=no])
1379 AC_SUBST(libc_cv_fpie)
1381 AC_CACHE_CHECK(for --hash-style option,
1382 libc_cv_hashstyle, [dnl
1383 cat > conftest.c <<EOF
1384 int _start (void) { return 42; }
1386 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp
1387 -fPIC -shared -o conftest.so conftest.c
1388 -Wl,--hash-style=both -nostdlib 1>&AS_MESSAGE_LOG_FD])
1390 libc_cv_hashstyle=yes
1392 libc_cv_hashstyle=no
1395 AC_SUBST(libc_cv_hashstyle)
1397 # The linker's default -shared behavior is good enough if it
1398 # does these things that our custom linker scripts ensure that
1399 # all allocated NOTE sections come first.
1400 if test "$use_default_link" = default; then
1401 AC_CACHE_CHECK([for sufficient default -shared layout],
1402 libc_cv_use_default_link, [dnl
1403 libc_cv_use_default_link=no
1404 cat > conftest.s <<\EOF
1405 .section .note.a,"a",%note
1410 .section .note.b,"a",%note
1416 if AC_TRY_COMMAND([dnl
1417 ${CC-cc} $ASFLAGS -shared -o conftest.so conftest.s 1>&AS_MESSAGE_LOG_FD]) &&
1418 ac_try=`$READELF -S conftest.so | sed -n \
1420 s/^ *\[ *[1-9][0-9]*\] *\([^ ][^ ]*\) *\([^ ][^ ]*\) .*$/\2 \1/
1426 libc_seen_a=no libc_seen_b=no
1428 while test $# -ge 2 -a "$1" = NOTE; do
1430 .note.a) libc_seen_a=yes ;;
1431 .note.b) libc_seen_b=yes ;;
1435 case "$libc_seen_a$libc_seen_b" in
1437 libc_cv_use_default_link=yes
1440 echo >&AS_MESSAGE_LOG_FD "\
1441 $libc_seen_a$libc_seen_b from:
1447 use_default_link=$libc_cv_use_default_link
1450 AC_CACHE_CHECK(for GLOB_DAT reloc,
1451 libc_cv_has_glob_dat, [dnl
1452 cat > conftest.c <<EOF
1454 int foo (void) { return mumble; }
1456 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1457 -fPIC -shared -o conftest.so conftest.c
1458 -nostdlib -nostartfiles $no_ssp
1459 1>&AS_MESSAGE_LOG_FD])
1461 dnl look for GLOB_DAT relocation.
1462 if $READELF -rW conftest.so | grep '_GLOB_DAT' > /dev/null; then
1463 libc_cv_has_glob_dat=yes
1465 libc_cv_has_glob_dat=no
1468 libc_cv_has_glob_dat=no
1471 AC_SUBST(libc_cv_has_glob_dat)
1473 AC_CACHE_CHECK(for -fno-toplevel-reorder -fno-section-anchors, libc_cv_fno_toplevel_reorder, [dnl
1474 cat > conftest.c <<EOF
1477 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -fno-toplevel-reorder -fno-section-anchors
1478 conftest.c 1>&AS_MESSAGE_LOG_FD])
1480 libc_cv_fno_toplevel_reorder=yes
1482 libc_cv_fno_toplevel_reorder=no
1485 if test $libc_cv_fno_toplevel_reorder = yes; then
1486 fno_unit_at_a_time="-fno-toplevel-reorder -fno-section-anchors"
1488 fno_unit_at_a_time=-fno-unit-at-a-time
1490 AC_SUBST(fno_unit_at_a_time)
1492 AC_CACHE_CHECK([for -mtls-dialect=gnu2], libc_cv_mtls_dialect_gnu2,
1494 cat > conftest.c <<EOF
1501 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -fPIC -mtls-dialect=gnu2
1502 conftest.c 1>&AS_MESSAGE_LOG_FD])
1504 libc_cv_mtls_dialect_gnu2=yes
1506 libc_cv_mtls_dialect_gnu2=no
1509 AC_SUBST(libc_cv_mtls_dialect_gnu2)
1510 LIBC_CONFIG_VAR([have-mtls-dialect-gnu2], [$libc_cv_mtls_dialect_gnu2])
1512 AC_CACHE_CHECK(whether cc puts quotes around section names,
1513 libc_cv_have_section_quotes,
1514 [cat > conftest.c <<EOF
1515 static const int foo
1516 __attribute__ ((section ("bar"))) = 1;
1518 if ${CC-cc} -S conftest.c -o conftest.s; then
1519 if grep '\.section.*"bar"' conftest.s >/dev/null; then
1520 libc_cv_have_section_quotes=yes
1522 libc_cv_have_section_quotes=no
1525 libc_cv_have_section_quotes=unknown
1527 rm -f conftest.{c,s}
1529 if test $libc_cv_have_section_quotes = yes; then
1530 AC_DEFINE(HAVE_SECTION_QUOTES)
1533 AC_CACHE_CHECK(for __builtin_memset, libc_cv_gcc_builtin_memset, [dnl
1534 cat > conftest.c <<\EOF
1537 __builtin_memset (x, 0, 1000);
1541 if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | grep -F "memset" > /dev/null]);
1543 libc_cv_gcc_builtin_memset=no
1545 libc_cv_gcc_builtin_memset=yes
1548 if test "$libc_cv_gcc_builtin_memset" = yes ; then
1549 AC_DEFINE(HAVE_BUILTIN_MEMSET)
1552 AC_CACHE_CHECK(for redirection of built-in functions, libc_cv_gcc_builtin_redirection, [dnl
1553 cat > conftest.c <<\EOF
1554 extern char *strstr (const char *, const char *) __asm ("my_strstr");
1555 char *foo (const char *a, const char *b)
1557 return __builtin_strstr (a, b);
1561 if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | grep -F "strstr" > /dev/null]);
1563 libc_cv_gcc_builtin_redirection=yes
1565 libc_cv_gcc_builtin_redirection=no
1568 if test "$libc_cv_gcc_builtin_redirection" = no; then
1569 AC_MSG_ERROR([support for the symbol redirection needed])
1572 dnl Determine how to disable generation of FMA instructions.
1573 AC_CACHE_CHECK([for compiler option to disable generation of FMA instructions],
1574 libc_cv_cc_nofma, [dnl
1576 for opt in -ffp-contract=off -mno-fused-madd; do
1577 LIBC_TRY_CC_OPTION([$opt], [libc_cv_cc_nofma=$opt; break])
1579 AC_SUBST(libc_cv_cc_nofma)
1581 if test -n "$submachine"; then
1582 AC_CACHE_CHECK([for compiler option for CPU variant],
1583 libc_cv_cc_submachine, [dnl
1584 libc_cv_cc_submachine=no
1585 for opt in "-march=$submachine" "-mcpu=$submachine"; do
1586 LIBC_TRY_CC_OPTION([$opt], [
1587 libc_cv_cc_submachine="$opt"
1590 if test "x$libc_cv_cc_submachine" = xno; then
1591 AC_MSG_ERROR([${CC-cc} does not support $submachine])
1594 AC_SUBST(libc_cv_cc_submachine)
1596 AC_CACHE_CHECK(if $CC accepts -fno-tree-loop-distribute-patterns with \
1597 __attribute__ ((__optimize__)), libc_cv_cc_loop_to_function, [dnl
1598 cat > conftest.c <<EOF
1600 __attribute__ ((__optimize__ ("-fno-tree-loop-distribute-patterns")))
1603 libc_cv_cc_loop_to_function=no
1604 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -Werror -c conftest.c])
1606 libc_cv_cc_loop_to_function=yes
1609 if test $libc_cv_cc_loop_to_function = yes; then
1610 AC_DEFINE(HAVE_CC_INHIBIT_LOOP_TO_LIBCALL)
1612 AC_SUBST(libc_cv_cc_loop_to_function)
1614 dnl Check whether we have the gd library available.
1615 AC_MSG_CHECKING(for libgd)
1616 if test "$with_gd" != "no"; then
1617 old_CFLAGS="$CFLAGS"
1618 CFLAGS="$CFLAGS $libgd_include"
1619 old_LDFLAGS="$LDFLAGS"
1620 LDFLAGS="$LDFLAGS $libgd_ldflags"
1622 LIBS="$LIBS -lgd -lpng -lz -lm"
1623 AC_TRY_LINK([#include <gd.h>], [gdImagePng (0, 0)], LIBGD=yes, LIBGD=no)
1624 CFLAGS="$old_CFLAGS"
1625 LDFLAGS="$old_LDFLAGS"
1630 AC_MSG_RESULT($LIBGD)
1634 if test x$with_selinux = xno ; then
1637 # See if we have the SELinux library
1638 AC_CHECK_LIB(selinux, is_selinux_enabled,
1639 have_selinux=yes, have_selinux=no)
1640 if test x$with_selinux = xyes ; then
1641 if test x$have_selinux = xno ; then
1642 AC_MSG_ERROR([SELinux explicitly required, but SELinux library not found])
1646 # Check if we're building with SELinux support.
1647 if test "x$have_selinux" = xyes; then
1648 AC_DEFINE(HAVE_SELINUX, 1, [SELinux support])
1650 # See if we have the libaudit library
1651 AC_CHECK_LIB(audit, audit_log_user_avc_message,
1652 have_libaudit=yes, have_libaudit=no)
1653 if test "x$have_libaudit" = xyes; then
1654 AC_DEFINE(HAVE_LIBAUDIT, 1, [SELinux libaudit support])
1656 AC_SUBST(have_libaudit)
1658 # See if we have the libcap library
1659 AC_CHECK_LIB(cap, cap_init, have_libcap=yes, have_libcap=no)
1660 if test "x$have_libcap" = xyes; then
1661 AC_DEFINE(HAVE_LIBCAP, 1, [SELinux libcap support])
1663 AC_SUBST(have_libcap)
1665 AC_SUBST(have_selinux)
1668 dnl Check for silly hacked compilers predefining _FORTIFY_SOURCE.
1669 dnl Since we are building the implementations of the fortified functions here,
1670 dnl having the macro defined interacts very badly.
1671 AC_CACHE_CHECK([for _FORTIFY_SOURCE predefine], libc_cv_predef_fortify_source,
1672 [AC_TRY_COMPILE([], [
1673 #ifdef _FORTIFY_SOURCE
1676 [libc_cv_predef_fortify_source=no],
1677 [libc_cv_predef_fortify_source=yes])])
1678 if test $libc_cv_predef_fortify_source = yes; then
1679 CPPUNDEFS="${CPPUNDEFS:+$CPPUNDEFS }-U_FORTIFY_SOURCE"
1683 AC_CACHE_CHECK(for __builtin_trap with no external dependencies,
1684 libc_cv_builtin_trap, [dnl
1685 libc_cv_builtin_trap=no
1686 AC_TRY_COMPILE([], [__builtin_trap ()], [
1687 libc_undefs=`$NM -u conftest.o |
1688 LC_ALL=C $AWK '$1 == "U" { print $2 | "sort -u"; next } { exit(1) }' \
1689 2>&AS_MESSAGE_LOG_FD` || {
1690 AC_MSG_ERROR([confusing output from $NM -u])
1692 echo >&AS_MESSAGE_LOG_FD "libc_undefs='$libc_undefs'"
1693 if test -z "$libc_undefs"; then
1694 libc_cv_builtin_trap=yes
1696 if test $libc_cv_builtin_trap = yes; then
1697 AC_DEFINE([HAVE_BUILTIN_TRAP])
1700 dnl C++ feature tests.
1703 AC_CACHE_CHECK([whether the C++ compiler supports thread_local],
1704 libc_cv_cxx_thread_local, [
1705 old_CXXFLAGS="$CXXFLAGS"
1706 CXXFLAGS="$CXXFLAGS -std=gnu++11"
1707 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
1710 // Compiler support.
1717 S * get () { return &s; }
1719 // libstdc++ support.
1720 #ifndef _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL
1721 #error __cxa_thread_atexit_impl not supported
1724 [libc_cv_cxx_thread_local=yes],
1725 [libc_cv_cxx_thread_local=no])
1726 CXXFLAGS="$old_CXXFLAGS"
1728 AC_SUBST(libc_cv_cxx_thread_local)
1731 dnl End of C++ feature tests.
1733 ### End of automated tests.
1734 ### Now run sysdeps configure fragments.
1736 # They also can set these variables.
1738 ldd_rewrite_script=no
1739 libc_cv_sysconfdir=$sysconfdir
1740 libc_cv_localstatedir=$localstatedir
1741 libc_cv_gcc_unwind_find_fde=no
1744 # Iterate over all the sysdep directories we will use, running their
1745 # configure fragments.
1746 for dir in $sysnames; do
1749 *) dest=$srcdir/$dir ;;
1751 if test -r $dest/configure; then
1752 AC_MSG_RESULT(running configure fragment for $dir)
1757 if test x"$build_mathvec" = xnotset; then
1760 LIBC_CONFIG_VAR([build-mathvec], [$build_mathvec])
1762 AC_SUBST(libc_extra_cflags)
1763 AC_SUBST(libc_extra_cppflags)
1765 if test x$libc_cv_gcc_unwind_find_fde = xyes; then
1766 AC_DEFINE(EXPORT_UNWIND_FIND_FDE)
1768 AC_SUBST(libc_cv_gcc_unwind_find_fde)
1770 # A sysdeps configure fragment can reset this if IFUNC is not actually
1771 # usable even though the assembler knows how to generate the symbol type.
1772 if test x"$libc_cv_ld_gnu_indirect_function" = xyes; then
1773 AC_DEFINE(HAVE_IFUNC)
1776 if test x"$libc_cv_gcc_indirect_function" = xyes; then
1777 AC_DEFINE(HAVE_GCC_IFUNC)
1780 # This is far from the AC_ARG_ENABLE that sets it so that a sysdeps
1781 # configure fragment can override the value to prevent this AC_DEFINE.
1783 if test "x$use_nscd" != xno; then
1784 AC_DEFINE([USE_NSCD])
1786 if test "x$build_nscd" = xdefault; then
1787 build_nscd=$use_nscd
1790 AC_SUBST(libc_cv_slibdir)
1791 AC_SUBST(libc_cv_rtlddir)
1792 AC_SUBST(libc_cv_complocaledir)
1793 AC_SUBST(libc_cv_sysconfdir)
1794 AC_SUBST(libc_cv_localstatedir)
1795 AC_SUBST(libc_cv_rootsbindir)
1797 if test x$use_ldconfig = xyes; then
1798 AC_DEFINE(USE_LDCONFIG)
1800 AC_SUBST(use_ldconfig)
1801 AC_SUBST(ldd_rewrite_script)
1806 AC_CACHE_CHECK([whether -fPIC is default], libc_cv_pic_default,
1807 [libc_cv_pic_default=yes
1808 cat > conftest.c <<EOF
1809 #if defined __PIC__ || defined __pic__ || defined PIC || defined pic
1810 # error PIC is default.
1813 if eval "${CC-cc} -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
1814 libc_cv_pic_default=no
1817 AC_SUBST(libc_cv_pic_default)
1819 AC_CACHE_CHECK([whether -fPIE is default], libc_cv_cc_pie_default,
1820 [libc_cv_cc_pie_default=yes
1821 cat > conftest.c <<EOF
1822 #if defined __PIE__ || defined __pie__ || defined PIE || defined pie
1823 # error PIE is default.
1826 if eval "${CC-cc} -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
1827 libc_cv_cc_pie_default=no
1830 libc_cv_pie_default=$libc_cv_cc_pie_default
1831 AC_SUBST(libc_cv_cc_pie_default)
1832 AC_SUBST(libc_cv_pie_default)
1834 # Set the `multidir' variable by grabbing the variable from the compiler.
1835 # We do it once and save the result in a generated makefile.
1837 if test "$with_clang" = no; then
1838 libc_cv_multidir=`${CC-cc} $CFLAGS $CPPFLAGS -print-multi-directory`
1840 AC_SUBST(libc_cv_multidir)
1842 if test "$static_pie" = yes; then
1843 # The linker must support --no-dynamic-linker.
1844 if test "$libc_cv_no_dynamic_linker" != yes; then
1845 AC_MSG_ERROR([linker support for --no-dynamic-linker needed])
1848 libc_cv_pie_default=yes
1849 AC_DEFINE(ENABLE_STATIC_PIE)
1851 LIBC_CONFIG_VAR([enable-static-pie], [$static_pie])
1854 AC_SUBST(static_nss)
1858 dnl See sysdeps/mach/configure.ac for this variable.
1859 AC_SUBST(mach_interface_list)
1861 VERSION=`sed -n -e 's/^#define VERSION "\([^"]*\)"/\1/p' < $srcdir/version.h`
1862 RELEASE=`sed -n -e 's/^#define RELEASE "\([^"]*\)"/\1/p' < $srcdir/version.h`
1866 AC_CONFIG_FILES([config.make Makefile])
1867 AC_CONFIG_COMMANDS([default],[[
1868 case $CONFIG_FILES in *config.make*)
1869 echo "$config_vars" >> config.make;;
1871 test -d bits || mkdir bits]],[[config_vars='$config_vars']])