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)], [http://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 # <http://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 # <http://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 # We need the C++ compiler only for testing.
55 AC_CHECK_TOOL(READELF, readelf, false)
57 if test "`cd $srcdir; /bin/pwd`" = "`/bin/pwd`"; then
58 AC_MSG_ERROR([you must configure in a separate build directory])
61 # This will get text that should go into config.make.
64 # Check for a --with-gd argument and set libgd-LDFLAGS in config.make.
66 AC_HELP_STRING([--with-gd=DIR],
67 [find libgd include dir and library with prefix DIR]),
71 *) libgd_include="-I$withval/include"
72 libgd_ldflags="-L$withval/lib" ;;
75 AC_ARG_WITH([gd-include],
76 AC_HELP_STRING([--with-gd-include=DIR],
77 [find libgd include files in DIR]),
79 case "$with_gd_include" in
81 *) libgd_include="-I$withval" ;;
85 AC_HELP_STRING([--with-gd-lib=DIR],
86 [find libgd library files in DIR]),
88 case "$with_gd_lib" in
90 *) libgd_ldflags="-L$withval" ;;
94 if test -n "$libgd_include"; then
95 config_vars="$config_vars
96 CFLAGS-memusagestat.c = $libgd_include"
98 if test -n "$libgd_ldflags"; then
99 config_vars="$config_vars
100 libgd-LDFLAGS = $libgd_ldflags"
103 dnl Arguments to specify presence of other packages/features.
105 AC_HELP_STRING([--with-fp],
106 [if using floating-point hardware @<:@default=yes@:>@]),
110 AC_ARG_WITH([binutils],
111 AC_HELP_STRING([--with-binutils=PATH],
112 [specify location of binutils (as and ld)]),
113 [path_binutils=$withval],
115 AC_ARG_WITH([selinux],
116 AC_HELP_STRING([--with-selinux],
117 [if building with SELinux support]),
118 [with_selinux=$withval],
121 AC_ARG_WITH([headers],
122 AC_HELP_STRING([--with-headers=PATH],
123 [location of system headers to use
124 (for example /usr/src/linux/include)
125 @<:@default=compiler default@:>@]),
126 [sysheaders=$withval],
130 AC_SUBST(use_default_link)
131 AC_ARG_WITH([default-link],
132 AC_HELP_STRING([--with-default-link],
133 [do not use explicit linker scripts]),
134 [use_default_link=$withval],
135 [use_default_link=default])
137 AC_ARG_ENABLE([sanity-checks],
138 AC_HELP_STRING([--disable-sanity-checks],
139 [really do not use threads (should not be used except in special situations) @<:@default=yes@:>@]),
140 [enable_sanity=$enableval],
143 AC_ARG_ENABLE([shared],
144 AC_HELP_STRING([--enable-shared],
145 [build shared library @<:@default=yes if GNU ld@:>@]),
148 AC_ARG_ENABLE([profile],
149 AC_HELP_STRING([--enable-profile],
150 [build profiled library @<:@default=no@:>@]),
151 [profile=$enableval],
153 AC_ARG_ENABLE([versioning],
154 AC_HELP_STRING([--disable-versioning],
155 [do not include versioning information in the library objects @<:@default=yes if supported@:>@]),
156 [enable_versioning=$enableval],
157 [enable_versioning=yes])
159 AC_ARG_ENABLE([oldest-abi],
160 AC_HELP_STRING([--enable-oldest-abi=ABI],
161 [configure the oldest ABI supported @<:@e.g. 2.2@:>@ @<:@default=glibc default@:>@]),
162 [oldest_abi=$enableval],
164 if test "$oldest_abi" = yes || test "$oldest_abi" = no; then
167 AC_DEFINE_UNQUOTED(GLIBC_OLDEST_ABI, "$oldest_abi")
171 AC_ARG_ENABLE([hardcoded-path-in-tests],
172 AC_HELP_STRING([--enable-hardcoded-path-in-tests],
173 [hardcode newly built glibc path in tests @<:@default=no@:>@]),
174 [hardcoded_path_in_tests=$enableval],
175 [hardcoded_path_in_tests=no])
176 AC_SUBST(hardcoded_path_in_tests)
178 AC_ARG_ENABLE([stackguard-randomization],
179 AC_HELP_STRING([--enable-stackguard-randomization],
180 [initialize __stack_chk_guard canary with a random number at program start]),
181 [enable_stackguard_randomize=$enableval],
182 [enable_stackguard_randomize=no])
183 if test "$enable_stackguard_randomize" = yes; then
184 AC_DEFINE(ENABLE_STACKGUARD_RANDOMIZE)
187 dnl Generic infrastructure for drop-in additions to libc.
188 AC_ARG_ENABLE([add-ons],
189 AC_HELP_STRING([--enable-add-ons@<:@=DIRS...@:>@],
190 [configure and build add-ons in DIR1,DIR2,...
191 search for add-ons if no parameter given]),
192 , [enable_add_ons=yes])
194 AC_ARG_ENABLE([hidden-plt],
195 AC_HELP_STRING([--disable-hidden-plt],
196 [do not hide internal function calls to avoid PLT]),
199 if test "x$hidden" = xno; then
203 AC_ARG_ENABLE([bind-now],
204 AC_HELP_STRING([--enable-bind-now],
205 [disable lazy relocations in DSOs]),
206 [bindnow=$enableval],
210 dnl On some platforms we cannot use dynamic loading. We must provide
211 dnl static NSS modules.
212 AC_ARG_ENABLE([static-nss],
213 AC_HELP_STRING([--enable-static-nss],
214 [build static NSS modules @<:@default=no@:>@]),
215 [static_nss=$enableval],
217 dnl Enable static NSS also if we build no shared objects.
218 if test x"$static_nss" = xyes || test x"$shared" = xno; then
220 AC_DEFINE(DO_STATIC_NSS)
223 AC_ARG_ENABLE([force-install],
224 AC_HELP_STRING([--disable-force-install],
225 [don't force installation of files from this package, even if they are older than the installed files]),
226 [force_install=$enableval],
228 AC_SUBST(force_install)
230 dnl On some platforms we allow dropping compatibility with all kernel
232 AC_ARG_ENABLE([kernel],
233 AC_HELP_STRING([--enable-kernel=VERSION],
234 [compile for compatibility with kernel not older than VERSION]),
235 [minimum_kernel=$enableval],
237 dnl Prevent unreasonable values.
238 if test "$minimum_kernel" = yes || test "$minimum_kernel" = no; then
239 # Better nothing than this.
242 if test "$minimum_kernel" = current; then
243 minimum_kernel=`uname -r 2>/dev/null` || minimum_kernel=
247 dnl For the development we sometimes want gcc to issue even more warnings.
248 dnl This is not the default since many of the extra warnings are not
250 AC_ARG_ENABLE([all-warnings],
251 AC_HELP_STRING([--enable-all-warnings],
252 [enable all useful warnings gcc can issue]),
253 [all_warnings=$enableval],
255 AC_SUBST(all_warnings)
257 AC_ARG_ENABLE([multi-arch],
258 AC_HELP_STRING([--enable-multi-arch],
259 [enable single DSO with optimizations for multiple architectures]),
260 [multi_arch=$enableval],
261 [multi_arch=default])
263 AC_ARG_ENABLE([nss-crypt],
264 AC_HELP_STRING([--enable-nss-crypt],
265 [enable libcrypt to use nss]),
266 [nss_crypt=$enableval],
268 if test x$nss_crypt = xyes; then
269 nss_includes=-I$(nss-config --includedir 2>/dev/null)
270 if test $? -ne 0; then
271 AC_MSG_ERROR([cannot find include directory with nss-config])
274 CFLAGS="$CFLAGS $nss_includes"
275 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([typedef int PRBool;
277 #include <nsslowhash.h>
278 void f (void) { NSSLOW_Init (); }])],
279 libc_cv_nss_crypt=yes,
281 cannot find NSS headers with lowlevel hash function interfaces]))
283 LIBS="$LIBS -lfreebl3"
284 AC_LINK_IFELSE([AC_LANG_PROGRAM([typedef int PRBool;
286 #include <nsslowhash.h>],
288 libc_cv_nss_crypt=yes,
290 cannot link program using lowlevel NSS hash functions]))
296 AC_SUBST(libc_cv_nss_crypt)
299 AC_ARG_ENABLE([obsolete-rpc],
300 AC_HELP_STRING([--enable-obsolete-rpc],
301 [build and install the obsolete RPC code for link-time usage]),
302 [link_obsolete_rpc=$enableval],
303 [link_obsolete_rpc=no])
304 AC_SUBST(link_obsolete_rpc)
306 if test "$link_obsolete_rpc" = yes; then
307 AC_DEFINE(LINK_OBSOLETE_RPC)
310 AC_ARG_ENABLE([systemtap],
311 [AS_HELP_STRING([--enable-systemtap],
312 [enable systemtap static probe points @<:@default=no@:>@])],
313 [systemtap=$enableval],
315 if test "x$systemtap" != xno; then
316 AC_CACHE_CHECK([for systemtap static probe support], libc_cv_sdt, [dnl
318 CFLAGS="-std=gnu99 $CFLAGS"
319 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <sys/sdt.h>
320 void foo (int i, void *p)
322 asm ("" STAP_PROBE_ASM (foo, bar, STAP_PROBE_ASM_TEMPLATE (2)) ""
323 :: STAP_PROBE_ASM_OPERANDS (2, i, p));
324 }]])], [libc_cv_sdt=yes], [libc_cv_sdt=no])
325 CFLAGS="$old_CFLAGS"])
326 if test $libc_cv_sdt = yes; then
327 AC_DEFINE([USE_STAP_PROBE])
328 elif test "x$systemtap" != xauto; then
329 AC_MSG_FAILURE([systemtap support needs sys/sdt.h with asm support])
333 AC_ARG_ENABLE([build-nscd],
334 [AS_HELP_STRING([--disable-build-nscd],
335 [disable building and installing the nscd daemon])],
336 [build_nscd=$enableval],
337 [build_nscd=default])
340 # Note the use of $use_nscd is near the bottom of the file.
341 AC_ARG_ENABLE([nscd],
342 [AS_HELP_STRING([--disable-nscd],
343 [library functions will not contact the nscd daemon])],
344 [use_nscd=$enableval],
347 # The way shlib-versions is used to generate soversions.mk uses a
348 # fairly simplistic model for name recognition that can't distinguish
349 # i486-pc-linux-gnu fully from i486-pc-gnu. So we mutate a $host_os
350 # of `gnu*' here to be `gnu-gnu*' just so that shlib-versions can
351 # tell. This doesn't get used much beyond that, so it's fairly safe.
356 host_os=`echo $host_os | sed -e 's/gnu/gnu-gnu/'`
360 # We keep the original values in `$config_*' and never modify them, so we
361 # can write them unchanged into config.make. Everything else uses
362 # $machine, $vendor, and $os, and changes them whenever convenient.
363 config_machine=$host_cpu config_vendor=$host_vendor config_os=$host_os
365 # Don't allow vendor == "unknown"
366 test "$config_vendor" = unknown && config_vendor=
367 config_os="`echo $config_os | sed 's/^unknown-//'`"
369 # Some configurations imply other options.
372 # The configure fragment of an add-on port can modify these to supplement
373 # or override the table in the case statement below. No fragment should
374 # ever change the config_* variables, however.
375 machine=$config_machine
376 vendor=$config_vendor
380 # config.guess on some IBM machines says `rs6000' instead of `powerpc'.
382 if test "$machine" = rs6000; then
386 # Braindead PowerPC box with absolutely no FPU.
387 case "$machine-$host_os" in
395 AS_HELP_STRING([--with-cpu=CPU], [select code for CPU variant]),
398 yes|'') AC_MSG_ERROR([--with-cpu requires an argument]) ;;
400 *) submachine="$withval" ;;
404 dnl Let sysdeps/*/preconfigure act here, like they can in add-ons.
405 LIBC_PRECONFIGURE([$srcdir], [for sysdeps])
407 # An add-on can set this when it wants to disable the sanity check below.
410 dnl Having this here, though empty, makes sure that if add-ons' fragments
411 dnl do AC_CONFIG_SUBDIRS([some-dir]), which just sets $subdirs, then
412 dnl our AC_OUTPUT will actually use it.
415 case "$enable_add_ons" in
418 add_ons=`cd $srcdir && ls -d 2> /dev/null */configure */sysdeps |
419 sed 's@/[[^/]]*$@@' | sort | uniq`
420 add_ons_automatic=yes
422 *) add_ons=`echo "$enable_add_ons" | sed 's/,/ /g'`
423 add_ons_automatic=no ;;
429 if test x"$add_ons" != x; then
430 for f in $add_ons; do
435 *** It seems that you're using an old \`crypt' add-on. crypt is now
436 *** part of glibc and using the old add-on will not work with this
437 *** release. Start again with fresh sources and without the old
438 *** \`crypt' add-on.])
442 *** It seems that you're using an old \`localedata' add-on. localedata
443 *** is now part of glibc and using the old add-on will not work with
444 *** this release. Start again with fresh sources and without the old
445 *** \`localedata' add-on.])
450 # Now source each add-on's configure fragment.
451 # The fragments can use $srcdir/$libc_add_on to find themselves,
452 # and test $add_ons_automatic to see if they were explicitly requested.
453 # A fragment can clear (or even change) $libc_add_on to affect
454 # whether it goes into the list to be actually used in the build.
456 for libc_add_on in $add_ons; do
457 # Test whether such a directory really exists.
458 # It can be absolute, or relative to $srcdir, or relative to the build dir.
459 case "$libc_add_on" in
461 libc_add_on_srcdir=$libc_add_on
464 test -d "$srcdir/$libc_add_on" || {
465 if test -d "$libc_add_on"; then
466 libc_add_on="`pwd`/$libc_add_on"
468 AC_MSG_ERROR(add-on directory \"$libc_add_on\" does not exist)
471 libc_add_on_srcdir=$srcdir/$libc_add_on
475 libc_add_on_frag=$libc_add_on_srcdir/configure
476 libc_add_on_canonical=
477 libc_add_on_config_subdirs=
478 if test -r "$libc_add_on_frag"; then
479 AC_MSG_NOTICE(running configure fragment for add-on $libc_add_on)
480 libc_add_on_canonical=unknown
482 . "$libc_add_on_frag"
483 test -z "$libc_add_on" || {
484 configured_add_ons="$configured_add_ons $libc_add_on"
485 if test "x$libc_add_on_canonical" = xunknown; then
486 AC_MSG_ERROR(fragment must set \$libc_add_on_canonical)
488 for d in $libc_add_on_subdirs; do
489 case "$libc_add_on" in
490 /*) subdir_srcdir="$libc_add_on" ;;
491 *) subdir_srcdir="\$(..)$libc_add_on" ;;
495 d="${libc_add_on_canonical:-$libc_add_on}"
501 subdir_srcdir="$subdir_srcdir/$d"
504 d=`echo "$d" | sed 's@/*$@@;s@^.*/@@'`
505 add_on_subdirs="$add_on_subdirs $d"
506 test "$subdir_srcdir" = "\$(..)$d" || config_vars="$config_vars
507 $d-srcdir = $subdir_srcdir"
509 for d in $libc_add_on_config_subdirs; do
512 fragment uses absolute path in \$libc_add_on_config_subdirs) ;;
514 if test ! -d "$libc_add_on_srcdir/$d"; then
515 AC_MSG_ERROR(fragment wants to configure missing directory $d)
517 case "$libc_add_on" in
519 relative path required for add-on using \$libc_add_on_config_subdirs) ;;
521 subdirs="$subdirs $libc_add_on/$d"
525 if test -n "$libc_add_on"; then
526 LIBC_PRECONFIGURE([$libc_add_on_srcdir], [add-on $libc_add_on for])
527 use_add_ons="$use_add_ons $libc_add_on"
528 add_ons_pfx="$add_ons_pfx $libc_add_on/"
529 test -z "$libc_add_on_canonical" ||
530 add_ons_sfx="$add_ons_sfx /$libc_add_on_canonical"
533 # Use echo to strip excess whitespace.
534 add_ons="`echo $use_add_ons`"
537 AC_SUBST(add_on_subdirs)
541 ### I put this here to prevent those annoying emails from people who cannot
542 ### read and try to compile glibc on unsupported platforms. --drepper
544 ### By using the undocumented --enable-hacker-mode option for configure
545 ### one can skip this test to make the configuration not fail for unsupported
548 if test -z "$enable_hacker_mode" && test x"$libc_config_ok" != xyes; then
549 case "$machine-$host_os" in
553 echo "*** The GNU C library is currently not available for this platform."
554 echo "*** So far nobody cared to port it and if there is no volunteer it"
555 echo "*** might never happen. So, if you have interest to see glibc on"
556 echo "*** this platform visit"
557 echo "*** http://www.gnu.org/software/libc/porting.html"
558 echo "*** and join the group of porters"
564 dnl We need to use [ and ] for other purposes for a while now.
566 # Expand the configuration machine name into a subdirectory by architecture
567 # type and particular chip. If an add-on configure fragment already set
568 # base_machine, we don't change it.
569 test -n "$base_machine" || case "$machine" in
570 i[4567]86) base_machine=i386 machine=i386/$machine ;;
571 powerpc) base_machine=powerpc machine=powerpc/powerpc32 ;;
572 powerpc64) base_machine=powerpc machine=powerpc/powerpc64 ;;
573 s390) base_machine=s390 machine=s390/s390-32 ;;
574 s390x) base_machine=s390 machine=s390/s390-64 ;;
575 sh3*) base_machine=sh machine=sh/sh3 ;;
576 sh4*) base_machine=sh machine=sh/sh4 ;;
578 base_machine=sparc machine=sparc/sparc32 ;;
579 sparcv8 | supersparc | hypersparc)
580 base_machine=sparc machine=sparc/sparc32/sparcv8 ;;
581 sparcv8plus | sparcv8plusa | sparcv9)
582 base_machine=sparc machine=sparc/sparc32/sparcv9 ;;
583 sparcv8plusb | sparcv9b)
584 base_machine=sparc machine=sparc/sparc32/sparcv9/sparcv9b ;;
586 base_machine=sparc machine=sparc/sparc32/sparcv9/sparcv9v ;;
588 base_machine=sparc machine=sparc/sparc32/sparcv9/sparcv9v2 ;;
590 base_machine=sparc machine=sparc/sparc64 ;;
592 base_machine=sparc machine=sparc/sparc64/sparcv9b ;;
594 base_machine=sparc machine=sparc/sparc64/sparcv9v ;;
596 base_machine=sparc machine=sparc/sparc64/sparcv9v2 ;;
597 *) base_machine=$machine ;;
600 AC_SUBST(base_machine)
602 if test "$base_machine" = "i386"; then
603 AC_DEFINE(USE_REGPARMS)
606 # For the multi-arch option we need support in the assembler & linker.
607 AC_CACHE_CHECK([for assembler and linker STT_GNU_IFUNC support],
608 libc_cv_ld_gnu_indirect_function, [dnl
609 cat > conftest.S <<EOF
610 .type foo,%gnu_indirect_function
623 libc_cv_ld_gnu_indirect_function=no
624 if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
625 -nostartfiles -nostdlib \
626 -o conftest conftest.S 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
627 # Do a link to see if the backend supports IFUNC relocs.
628 $READELF -r conftest 1>&AS_MESSAGE_LOG_FD
629 LC_ALL=C $READELF -r conftest | grep 'no relocations' >/dev/null || {
630 libc_cv_ld_gnu_indirect_function=yes
635 AC_MSG_CHECKING(whether .text pseudo-op must be used)
636 AC_CACHE_VAL(libc_cv_dot_text, [dnl
637 cat > conftest.s <<EOF
641 if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
642 libc_cv_dot_text=.text
645 if test -z "$libc_cv_dot_text"; then
651 if test x"$libc_cv_ld_gnu_indirect_function" != xyes; then
652 if test x"$multi_arch" = xyes; then
653 AC_MSG_ERROR([--enable-multi-arch support requires assembler and linker support])
659 if test x"$multi_arch" != xno; then
660 multi_arch_d=/multiarch
663 # Compute the list of sysdep directories for this configuration.
664 # This can take a while to compute.
665 sysdep_dir=$srcdir/sysdeps
666 AC_MSG_CHECKING(sysdep dirs)
667 dnl We need to use [ and ] for other purposes for a while now.
669 # Make sco3.2v4 become sco3.2.4 and sunos4.1.1_U1 become sunos4.1.1.U1.
670 os="`echo $os | sed 's/\([0-9A-Z]\)[v_]\([0-9A-Z]\)/\1.\2/g'`"
672 test "x$base_os" != x || case "$os" in
679 # For sunos4.1.1, try sunos4.1.1, then sunos4.1, then sunos4, then sunos.
682 while o=`echo $tail | sed 's/\.[^.]*$//'`; test $o != $tail; do
686 o=`echo $tail | sed 's/[0-9]*$//'`
687 if test $o != $tail; then
690 # For linux-gnu, try linux-gnu, then linux.
691 o=`echo $tail | sed 's/-.*$//'`
692 if test $o != $tail; then
696 # For unix/sysv/sysv4, try unix/sysv/sysv4, then unix/sysv, then unix.
699 while b=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$b"; do
705 # For sparc/sparc32, try sparc/sparc32 and then sparc.
707 tail=$machine${submachine:+/$submachine}
708 while m=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$m"; do
710 # Prepend the machine's FPU directory unless --without-fp.
711 if test "$with_fp" = yes; then
716 # For each machine term, try it with and then without /multiarch.
717 for try_fpu in $maybe_fpu ''; do
718 for try_multi in $multi_arch_d ''; do
719 mach="$mach /$1$try_fpu$try_multi"
725 dnl We are done with glob and regexp uses of [ and ]; return to autoconf.
728 # Find what sysdep directories exist.
731 for b in $base ''; do
732 for m0 in $mach ''; do
733 for v in /$vendor ''; do
734 test "$v" = / && continue
735 for o in /$ostry ''; do
736 test "$o" = / && continue
737 for m in $mach ''; do
738 for d in $add_ons_pfx ''; do
739 for a in $add_ons_sfx ''; do
740 try_suffix="$m0$b$v$o$m"
741 if test -n "$try_suffix"; then
742 try_srcdir="${srcdir}/"
746 try="${d}sysdeps$try_suffix$a"
747 test -n "$enable_debug_configure" &&
748 echo "$0 [DEBUG]: try $try" >&2
749 if test -d "$try_srcdir$try"; then
750 sysnames="$sysnames $try"
751 { test -n "$o" || test -n "$b"; } && os_used=t
752 { test -n "$m" || test -n "$m0"; } && machine_used=t
754 x*/$submachine) submachine_used=t ;;
756 if test -n "$d"; then
757 case "$sysnames_add_ons" in
759 *|'') sysnames_add_ons="$sysnames_add_ons $d" ;;
772 # If the assembler supports gnu_indirect_function symbol type and the
773 # architecture supports multi-arch, we enable multi-arch by default.
774 case $sysnames_add_ons$sysnames in
778 test x"$multi_arch" = xdefault && multi_arch=no
781 if test x"$multi_arch" != xno; then
782 AC_DEFINE(USE_MULTIARCH)
786 if test -z "$os_used" && test "$os" != none; then
787 AC_MSG_ERROR(Operating system $os is not supported.)
789 if test -z "$machine_used" && test "$machine" != none; then
790 AC_MSG_ERROR(The $machine is not supported.)
792 if test -z "$submachine_used" && test -n "$submachine"; then
793 AC_MSG_ERROR(The $submachine subspecies of $host_cpu is not supported.)
797 # We have now validated the configuration.
799 # Expand the list of system names into a full list of directories
800 # from each element's parent name and Implies file (if present).
803 while test $# -gt 0; do
807 case " $names " in *" $name "*)
808 # Already in the list.
812 # Report each name as we discover it, so there is no long pause in output.
813 echo $ECHO_N "$name $ECHO_C" >&AS_MESSAGE_FD
815 name_base=`echo $name | sed -e 's@\(.*sysdeps\)/.*@\1@'`
819 *) xsrcdir=$srcdir/ ;;
821 test -n "$enable_debug_configure" &&
822 echo "[DEBUG]: name/Implies $xsrcdir$name/Implies" >&2
824 for implies_file in Implies Implies-before Implies-after; do
825 implies_type=`echo $implies_file | sed s/-/_/`
826 eval ${implies_type}=
827 if test -f $xsrcdir$name/$implies_file; then
828 # Collect more names from the `Implies' file (removing comments).
829 implied_candidate="`sed 's/#.*$//' < $xsrcdir$name/$implies_file`"
830 for x in $implied_candidate; do
832 if test -d $xsrcdir$name_base/$x; then
833 eval "${implies_type}=\"\$${implies_type} \$name_base/\$x\""
836 for d in $add_ons_pfx ''; do
840 *) try_srcdir=$srcdir/ ;;
842 test -n "$enable_debug_configure" &&
843 echo "[DEBUG]: $name $implies_file $x try($d) {$try_srcdir}$try" >&2
844 if test $try != $xsrcdir$name_base/$x && test -d $try_srcdir$try;
846 eval "${implies_type}=\"\$${implies_type} \$try\""
848 case "$sysnames_add_ons" in
850 *|'') sysnames_add_ons="$sysnames_add_ons $d" ;;
854 if test $found = no; then
855 AC_MSG_WARN($name/$implies_file specifies nonexistent $x)
861 # Add NAME to the list of names.
864 # Find the parent of NAME, using the empty string if it has none.
866 parent="`echo $name | sed -n -e 's=/[^/]*$==' -e '/sysdeps$/q' -e p`"
869 test -n "$enable_debug_configure" &&
870 echo "[DEBUG]: $name Implies='$Implies' rest='$*' parent='$parent' \
871 Implies_before='$Implies_before' Implies_after='$Implies_after'" >&2
873 # Add the names implied by NAME, and NAME's parent (if it has one), to
874 # the list of names to be processed (the argument list). We prepend the
875 # implied names to the list and append the parent. We want implied
876 # directories to come before further directories inferred from the
877 # configuration components; this ensures that for sysv4, unix/common
878 # (implied by unix/sysv/sysv4) comes before unix/sysv (in ostry (here $*)
880 sysnames="`echo $Implies $* $Implies_before $parent $Implies_after`"
881 test -n "$sysnames" && set $sysnames
884 # Add the default directories.
885 default_sysnames="sysdeps/generic"
886 sysnames="$names $default_sysnames"
888 # The other names were emitted during the scan.
889 AC_MSG_RESULT($default_sysnames)
891 # Collect the list of add-ons that supply partial sysdeps trees.
893 for add_on in $add_ons; do
896 *) xsrcdir="$srcdir/" ;;
899 test -d "$xsrcdir$add_on/sysdeps" || {
900 case "$configured_add_ons " in
903 AC_MSG_ERROR(add-on $add_on has no configure fragment or sysdeps tree)
909 sysdeps_add_ons="$sysdeps_add_ons $add_on"
910 case "$sysnames_add_ons" in
913 AC_MSG_WARN(add-on $add_on contributed no sysdeps directories)
918 for d in $sysnames; do
920 $add_on/sysdeps/*) ;;
923 (cd "$xsrcdir$d" && for f in *[[!~]]; do
927 test -d "$ff" || { test -e "$ff" && exit 88; }
931 test -d "$f" || { test -e "$f" && exit 88; }
935 if test $? -eq 88; then
940 if test $found = no; then
941 AC_MSG_WARN(add-on $add_on contributed no useful sysdeps directories)
944 AC_SUBST(sysdeps_add_ons)
950 if test "$INSTALL" = "${srcdir}/scripts/install-sh -c"; then
951 # The makefiles need to use a different form to find it in $srcdir.
952 INSTALL='\$(..)./scripts/install-sh -c'
958 # Accept binutils 2.20 or newer.
959 AC_CHECK_PROG_VER(AS, $AS, --version,
960 [GNU assembler.* \([0-9]*\.[0-9.]*\)],
961 [2.1[0-9][0-9]*|2.[2-9][0-9]*|[3-9].*|[1-9][0-9]*], AS=: critic_missing="$critic_missing as")
962 AC_CHECK_PROG_VER(LD, $LD, --version,
963 [GNU ld.* \([0-9][0-9]*\.[0-9.]*\)],
964 [2.1[0-9][0-9]*|2.[2-9][0-9]*|[3-9].*|[1-9][0-9]*], LD=: critic_missing="$critic_missing ld")
966 # These programs are version sensitive.
968 AC_CHECK_PROG_VER(CC, ${ac_tool_prefix}gcc ${ac_tool_prefix}cc, -v,
969 [version \([egcygnustpi-]*[0-9.]*\)], [4.[3-9].* | 4.[1-9][0-9].* | [5-9].* ],
970 critic_missing="$critic_missing gcc")
971 AC_CHECK_PROG_VER(MAKE, gnumake gmake make, --version,
972 [GNU Make[^0-9]*\([0-9][0-9.]*\)],
973 [3.79* | 3.[89]*], critic_missing="$critic_missing make")
975 AC_CHECK_PROG_VER(MSGFMT, gnumsgfmt gmsgfmt msgfmt, --version,
976 [GNU gettext.* \([0-9]*\.[0-9.]*\)],
977 [0.10.3[6-9]* | 0.10.[4-9][0-9]* | 0.1[1-9]* | 0.[2-9][0-9]* | [1-9].*],
978 MSGFMT=: aux_missing="$aux_missing msgfmt")
979 AC_CHECK_PROG_VER(MAKEINFO, makeinfo, --version,
980 [GNU texinfo.* \([0-9][0-9.]*\)],
981 [4.[5-9]*|4.[1-9][0-9]*|[5-9].*],
982 MAKEINFO=: aux_missing="$aux_missing makeinfo")
983 AC_CHECK_PROG_VER(SED, sed, --version,
984 [GNU sed[^0-9]* \([0-9]*\.[0-9.]*\)],
985 [3.0[2-9]*|3.[1-9]*|[4-9]*],
986 SED=: aux_missing="$aux_missing sed")
987 AC_CHECK_PROG_VER(AWK, gawk, --version,
988 [GNU Awk[^0-9]*\([0-9][0-9.]*\)],
989 [3.1.[2-9]*|3.[2-9]*|[4-9]*], critic_missing="$critic_missing gawk")
991 AC_CHECK_TOOL(NM, nm, false)
993 AC_CHECK_PROGS(AUTOCONF, autoconf, no)
995 xno|x|x:) AUTOCONF=no ;;
998 whether $AUTOCONF${ACFLAGS:+ }$ACFLAGS works, libc_cv_autoconf_works, [dnl
999 if (cd $srcdir; $AUTOCONF $ACFLAGS configure.in > /dev/null 2>&1); then
1000 libc_cv_autoconf_works=yes
1002 libc_cv_autoconf_works=no
1004 test $libc_cv_autoconf_works = yes || AUTOCONF=no
1007 if test "x$AUTOCONF" = xno; then
1008 aux_missing="$aux_missing autoconf"
1011 test -n "$critic_missing" && AC_MSG_ERROR([
1012 *** These critical programs are missing or too old:$critic_missing
1013 *** Check the INSTALL file for required versions.])
1015 test -n "$aux_missing" && AC_MSG_WARN([
1016 *** These auxiliary programs are missing or incompatible versions:$aux_missing
1017 *** some features will be disabled.
1018 *** Check the INSTALL file for required versions.])
1020 # if using special system headers, find out the compiler's sekrit
1021 # header directory and add that to the list. NOTE: Only does the right
1022 # thing on a system that doesn't need fixincludes. (Not presently a problem.)
1023 if test -n "$sysheaders"; then
1024 SYSINCLUDES=-nostdinc
1025 for d in include include-fixed; do
1026 i=`$CC -print-file-name="$d"` && test "x$i" != x && test "x$i" != "x$d" &&
1027 SYSINCLUDES="$SYSINCLUDES -isystem $i"
1029 SYSINCLUDES="$SYSINCLUDES \
1030 -isystem `echo $sysheaders | sed 's/:/ -isystem /g'`"
1031 if test -n "$CXX"; then
1033 for cxxheaders in `$CXX -v -S -x c++ /dev/null -o /dev/null 2>&1 \
1034 | sed -n -e '1,/#include/d' -e 's/^ \(\/.*\/[cg]++\)/\1/p'`; do
1035 test "x$cxxheaders" != x &&
1036 CXX_SYSINCLUDES="$CXX_SYSINCLUDES -isystem $cxxheaders"
1040 AC_SUBST(SYSINCLUDES)
1041 AC_SUBST(CXX_SYSINCLUDES)
1043 # Test if LD_LIBRARY_PATH contains the notation for the current directory
1044 # since this would lead to problems installing/building glibc.
1045 # LD_LIBRARY_PATH contains the current directory if one of the following
1047 # - one of the terminals (":" and ";") is the first or last sign
1048 # - two terminals occur directly after each other
1049 # - the path contains an element with a dot in it
1050 AC_MSG_CHECKING(LD_LIBRARY_PATH variable)
1052 case ${LD_LIBRARY_PATH} in
1053 [:\;]* | *[:\;] | *[:\;][:\;]* | *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* )
1054 ld_library_path_setting="contains current directory"
1057 ld_library_path_setting="ok"
1061 AC_MSG_RESULT($ld_library_path_setting)
1062 if test "$ld_library_path_setting" != "ok"; then
1064 *** LD_LIBRARY_PATH shouldn't contain the current directory when
1065 *** building glibc. Please change the environment variable
1066 *** and run configure again.])
1069 AC_CACHE_CHECK(whether GCC supports -static-libgcc, libc_cv_gcc_static_libgcc, [dnl
1070 if $CC -v -static-libgcc 2>&1 | grep 'unrecognized option.*static-libgcc' >/dev/null; then
1071 libc_cv_gcc_static_libgcc=
1073 libc_cv_gcc_static_libgcc=-static-libgcc
1075 AC_SUBST(libc_cv_gcc_static_libgcc)
1077 AC_PATH_PROG(BASH_SHELL, bash, no)
1078 if test "$BASH_SHELL" != no &&
1079 $BASH_SHELL -c 'test "$BASH_VERSINFO" \
1080 && test "$BASH_VERSINFO" -ge 2 >&/dev/null'; then
1081 libc_cv_have_bash2=yes
1083 libc_cv_have_bash2=no
1085 AC_SUBST(libc_cv_have_bash2)
1087 dnl We need a ksh compatible shell for tzselect.
1088 if test "$BASH_SHELL" = no; then
1089 AC_PATH_PROG(KSH, ksh, no)
1090 if test "$KSH" = no; then
1093 libc_cv_have_ksh=yes
1098 libc_cv_have_ksh=yes
1100 AC_SUBST(libc_cv_have_ksh)
1102 AC_PATH_PROG(PERL, perl, no)
1103 if test "$PERL" != no &&
1104 (eval `$PERL -V:apiversion`; test `expr "$apiversion" \< 5` -ne 0); then
1107 AC_PATH_PROG(INSTALL_INFO, install-info, no,
1108 $PATH:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin)
1109 AC_PATH_PROG(BISON, bison, no, $PATH:/usr/local/bin:/usr/bin:/bin)
1111 AC_CACHE_CHECK(for libc-friendly stddef.h, libc_cv_friendly_stddef, [dnl
1113 [#define __need_size_t
1114 #define __need_wchar_t
1117 #include <stddef.h>], [size_t size; wchar_t wchar;
1119 #error stddef.h ignored __need_*
1121 if (&size == NULL || &wchar == NULL) abort ();],
1122 libc_cv_friendly_stddef=yes,
1123 libc_cv_friendly_stddef=no)])
1124 if test $libc_cv_friendly_stddef = yes; then
1125 config_vars="$config_vars
1126 override stddef.h = # The installed <stddef.h> seems to be libc-friendly."
1129 AC_CACHE_CHECK(whether we need to use -P to assemble .S files,
1130 libc_cv_need_minus_P, [dnl
1131 cat > conftest.S <<EOF
1132 #include "confdefs.h"
1133 /* Nothing whatsoever. */
1135 if AC_TRY_COMMAND(${CC-cc} $CPPFLAGS $ASFLAGS -c conftest.S 1>&AS_MESSAGE_LOG_FD); then
1136 libc_cv_need_minus_P=no
1138 libc_cv_need_minus_P=yes
1141 if test $libc_cv_need_minus_P = yes; then
1142 config_vars="$config_vars
1143 asm-CPPFLAGS = -P # The assembler can't grok cpp's # line directives."
1146 AC_CACHE_CHECK(for .set assembler directive, libc_cv_asm_set_directive, [dnl
1147 cat > conftest.s <<EOF
1150 .set glibc_conftest_frobozz,foo
1151 .globl glibc_conftest_frobozz
1153 # The alpha-dec-osf1 assembler gives only a warning for `.set'
1154 # (but it doesn't work), so we must do a linking check to be sure.
1155 cat > conftest1.c <<\EOF
1156 extern int glibc_conftest_frobozz;
1157 void _start() { glibc_conftest_frobozz = 1; }
1159 if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
1160 -nostartfiles -nostdlib \
1161 -o conftest conftest.s conftest1.c 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
1162 libc_cv_asm_set_directive=yes
1164 libc_cv_asm_set_directive=no
1167 if test $libc_cv_asm_set_directive = yes; then
1168 AC_DEFINE(HAVE_ASM_SET_DIRECTIVE)
1171 AC_CACHE_CHECK(for assembler gnu_unique_object symbol type,
1172 libc_cv_asm_unique_object, [dnl
1173 cat > conftest.s <<EOF
1176 .type _sym, %gnu_unique_object
1178 if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
1179 libc_cv_asm_unique_object=yes
1181 libc_cv_asm_unique_object=no
1184 if test $libc_cv_asm_unique_object = yes; then
1185 AC_DEFINE(HAVE_ASM_UNIQUE_OBJECT)
1188 AC_CACHE_CHECK(for .symver assembler directive, libc_cv_asm_symver_directive,
1189 [cat > conftest.s <<EOF
1192 .symver _sym,sym@VERS
1194 if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
1195 libc_cv_asm_symver_directive=yes
1197 libc_cv_asm_symver_directive=no
1200 AC_CACHE_CHECK(for ld --version-script, libc_cv_ld_version_script_option, [dnl
1201 if test $libc_cv_asm_symver_directive = yes; then
1202 cat > conftest.s <<EOF
1205 .symver _sym,sym@VERS
1207 cat > conftest.map <<EOF
1216 if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
1217 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $LDFLAGS -shared
1218 -o conftest.so conftest.o
1219 -nostartfiles -nostdlib
1220 -Wl,--version-script,conftest.map
1221 1>&AS_MESSAGE_LOG_FD]);
1223 libc_cv_ld_version_script_option=yes
1225 libc_cv_ld_version_script_option=no
1228 libc_cv_ld_version_script_option=no
1231 libc_cv_ld_version_script_option=no
1234 if test $shared != no &&
1235 test $libc_cv_asm_symver_directive = yes &&
1236 test $libc_cv_ld_version_script_option = yes &&
1237 test $enable_versioning = yes; then
1239 AC_DEFINE(DO_VERSIONING)
1243 AC_SUBST(VERSIONING)
1245 if test $shared != no && test $VERSIONING = no; then
1247 *** WARNING: You should not compile GNU libc without versioning. Not using
1248 *** versioning will introduce incompatibilities so that old binaries
1249 *** will not run anymore.
1250 *** For versioning you need recent binutils (binutils-2.8.1.0.23 or newer)."
1252 AC_CACHE_CHECK(for .previous assembler directive,
1253 libc_cv_asm_previous_directive, [dnl
1254 cat > conftest.s <<EOF
1255 .section foo_section
1258 if AC_TRY_COMMAND(${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
1259 libc_cv_asm_previous_directive=yes
1261 libc_cv_asm_previous_directive=no
1264 if test $libc_cv_asm_previous_directive = yes; then
1265 AC_DEFINE(HAVE_ASM_PREVIOUS_DIRECTIVE)
1267 AC_CACHE_CHECK(for .popsection assembler directive,
1268 libc_cv_asm_popsection_directive, [dnl
1269 cat > conftest.s <<EOF
1270 .pushsection foo_section
1273 if AC_TRY_COMMAND(${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
1274 libc_cv_asm_popsection_directive=yes
1276 libc_cv_asm_popsection_directive=no
1279 if test $libc_cv_asm_popsection_directive = yes; then
1280 AC_DEFINE(HAVE_ASM_POPSECTION_DIRECTIVE)
1283 AC_CACHE_CHECK(for .protected and .hidden assembler directive,
1284 libc_cv_asm_protected_directive, [dnl
1285 cat > conftest.s <<EOF
1291 if AC_TRY_COMMAND(${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
1292 libc_cv_asm_protected_directive=yes
1294 AC_MSG_ERROR(assembler support for symbol visibility is required)
1298 if test $libc_cv_asm_protected_directive = yes; then
1299 AC_CACHE_CHECK(whether __attribute__((visibility())) is supported,
1300 libc_cv_visibility_attribute,
1301 [cat > conftest.c <<EOF
1302 int foo __attribute__ ((visibility ("hidden"))) = 1;
1303 int bar __attribute__ ((visibility ("protected"))) = 1;
1305 libc_cv_visibility_attribute=no
1306 if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
1307 if grep '\.hidden.*foo' conftest.s >/dev/null; then
1308 if grep '\.protected.*bar' conftest.s >/dev/null; then
1309 libc_cv_visibility_attribute=yes
1313 rm -f conftest.{c,s}
1315 if test $libc_cv_visibility_attribute != yes; then
1316 AC_MSG_ERROR(compiler support for visibility attribute is required)
1320 if test $libc_cv_visibility_attribute = yes; then
1321 AC_CACHE_CHECK(for broken __attribute__((visibility())),
1322 libc_cv_broken_visibility_attribute,
1323 [cat > conftest.c <<EOF
1325 int bar (int x) __asm__ ("foo") __attribute__ ((visibility ("hidden")));
1326 int bar (int x) { return x; }
1328 libc_cv_broken_visibility_attribute=yes
1329 if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
1331 if grep '\.hidden[ _]foo' conftest.s >/dev/null; then
1333 libc_cv_broken_visibility_attribute=no
1336 rm -f conftest.c conftest.s
1338 if test $libc_cv_broken_visibility_attribute = yes; then
1339 AC_MSG_ERROR(working compiler support for visibility attribute is required)
1343 AC_CACHE_CHECK(for broken __attribute__((alias())),
1344 libc_cv_broken_alias_attribute,
1345 [cat > conftest.c <<EOF
1346 extern int foo (int x) __asm ("xyzzy");
1347 int bar (int x) { return x; }
1348 extern __typeof (bar) foo __attribute ((weak, alias ("bar")));
1350 extern __typeof (dfoo) dfoo __asm ("abccb");
1353 libc_cv_broken_alias_attribute=yes
1354 if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
1355 if grep 'xyzzy' conftest.s >/dev/null &&
1356 grep 'abccb' conftest.s >/dev/null; then
1357 libc_cv_broken_alias_attribute=no
1360 rm -f conftest.c conftest.s
1362 if test $libc_cv_broken_alias_attribute = yes; then
1363 AC_MSG_ERROR(working alias attribute support required)
1366 if test $libc_cv_visibility_attribute = yes; then
1367 AC_CACHE_CHECK(whether to put _rtld_local into .sdata section,
1368 libc_cv_have_sdata_section,
1369 [echo "int i;" > conftest.c
1370 libc_cv_have_sdata_section=no
1371 if ${CC-cc} $LDFLAGS -fPIC -shared -Wl,--verbose conftest.c -o conftest.so 2>&1 \
1372 | grep '\.sdata' >/dev/null; then
1373 libc_cv_have_sdata_section=yes
1375 rm -f conftest.c conftest.so
1377 if test $libc_cv_have_sdata_section = yes; then
1378 AC_DEFINE(HAVE_SDATA_SECTION)
1382 AC_CACHE_CHECK(for .preinit_array/.init_array/.fini_array support,
1383 libc_cv_initfini_array, [dnl
1384 LIBC_TRY_LINK_STATIC([
1385 int foo (void) { return 1; }
1386 int (*fp) (void) __attribute__ ((section (".init_array"))) = foo;
1388 [if $READELF -S conftest | fgrep INIT_ARRAY > /dev/null; then
1389 libc_cv_initfini_array=yes
1391 libc_cv_initfini_array=no
1393 [libc_cv_initfini_array=no])
1395 if test $libc_cv_initfini_array != yes; then
1396 AC_MSG_ERROR([Need linker with .init_array/.fini_array support.])
1399 AC_CACHE_CHECK(whether to use .ctors/.dtors header and trailer,
1400 libc_cv_ctors_header, [dnl
1401 libc_cv_ctors_header=yes
1402 LIBC_TRY_LINK_STATIC([
1403 __attribute__ ((constructor)) void ctor (void) { asm (""); }
1404 __attribute__ ((destructor)) void dtor (void) { asm (""); }
1407 AS_IF([$READELF -WS conftest$ac_exeext | $AWK '
1408 { gsub(/\@<:@ */, "@<:@") }
1409 $2 == ".ctors" || $2 == ".dtors" {
1410 size = strtonum("0x" $6)
1411 align = strtonum("0x" $NF)
1413 stub@<:@$2@:>@ = size == align * 2
1416 ctors_ok = !seen@<:@".ctors"@:>@ || stub@<:@".ctors"@:>@
1417 dtors_ok = !seen@<:@".dtors"@:>@ || stub@<:@".dtors"@:>@
1418 exit ((ctors_ok && dtors_ok) ? 0 : 1)
1420 '], [libc_cv_ctors_header=no])
1422 AC_MSG_ERROR([missing __attribute__ ((constructor)) support??])
1425 if test $libc_cv_ctors_header = no; then
1426 AC_DEFINE(NO_CTORS_DTORS_SECTIONS)
1429 AC_CACHE_CHECK(for libunwind-support in compiler,
1430 libc_cv_cc_with_libunwind, [
1431 cat > conftest.c <<EOF
1432 int main (void) { return 0; }
1434 if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -static -o conftest \
1435 conftest.c -v 2>&1 >/dev/null | grep ' -lunwind ' >/dev/null; then
1436 libc_cv_cc_with_libunwind=yes
1438 libc_cv_cc_with_libunwind=no
1441 AC_SUBST(libc_cv_cc_with_libunwind)
1442 if test $libc_cv_cc_with_libunwind = yes; then
1443 AC_DEFINE(HAVE_CC_WITH_LIBUNWIND)
1446 LIBC_LINKER_FEATURE([-z nodelete], [-Wl,--enable-new-dtags,-z,nodelete],
1447 [libc_cv_z_nodelete=yes],
1448 [AC_MSG_ERROR(linker with -z nodelete support required)])
1450 LIBC_LINKER_FEATURE([-z nodlopen], [-Wl,--enable-new-dtags,-z,nodlopen],
1451 [libc_cv_z_nodlopen=yes],
1452 [AC_MSG_ERROR(linker with -z nodlopen support required)])
1454 LIBC_LINKER_FEATURE([-z initfirst], [-Wl,--enable-new-dtags,-z,initfirst],
1455 [libc_cv_z_initfirst=yes],
1456 [AC_MSG_ERROR(linker with -z initfirst support required)])
1458 # Add-on fragments can set these for other machines.
1459 libc_commonpagesize=${libc_commonpagesize:-no}
1460 libc_relro_required=${libc_relro_required:-no}
1461 case "$base_machine" in
1462 i[[34567]]86 | x86_64 | powerpc* | s390*)
1463 libc_commonpagesize=0x1000
1464 libc_relro_required=yes
1467 libc_commonpagesize=0x2000
1468 libc_relro_required=yes
1472 if test $libc_commonpagesize != no; then
1473 AC_CACHE_CHECK(for -z relro option,
1474 libc_cv_z_relro, [dnl
1476 AC_LANG_CONFTEST([AC_LANG_SOURCE([[
1477 int _start (void) { return 42; }
1478 extern void _exit (int);
1479 /* Since these pointers are const, they should go in rodata.
1480 Since they refer to functions that have to be resolved by
1481 dynamic linking, they should instead go in RELRO data. */
1482 const void *const relro[] = { &_start, &_exit, 0 };
1483 /* GNU ld fails to produce RELRO data when it's very small and there is no
1484 normal writable data following it, or if only uninitialized (.bss) data
1485 follows it, or only very small writable data. */
1486 int data[0x10000] = { 1, };
1488 cat > conftest.awk <<\EOF
1491 commonpagesize = strtonum(commonpagesize)
1493 { print "LINE:", $0 > "/dev/stderr" }
1495 vaddr = strtonum($3)
1496 memsz = strtonum($6)
1498 printf "vaddr %#x memsz %#x end %#x commonpagesize %#x\n", \
1499 vaddr, memsz, end, commonpagesize > "/dev/stderr"
1500 result = (end % commonpagesize == 0) ? "yes" : "broken"
1502 END { print result }
1504 AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1505 -fPIC -shared -o conftest.so conftest.c
1506 -nostartfiles -nostdlib
1507 -Wl,-z,relro 1>&AS_MESSAGE_LOG_FD]) &&
1508 AC_TRY_COMMAND([$READELF -Wl conftest.so > conftest.ph]) &&
1510 $AWK -v commonpagesize=$libc_commonpagesize -f conftest.awk
1511 conftest.ph > conftest.cps
1513 libc_cv_z_relro=`cat conftest.cps 2>&AS_MESSAGE_LOG_FD`
1515 if { test "x$libc_relro_required" = xyes &&
1516 test "x$libc_cv_z_relro" != xyes
1519 AC_MSG_ERROR(linker with -z relro support required)
1522 AC_MSG_WARN([missing architecture parameter to check for working -z relro])
1525 AC_CACHE_CHECK(for -Bgroup option,
1526 libc_cv_Bgroup, [dnl
1527 cat > conftest.c <<EOF
1528 int _start (void) { return 42; }
1530 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1531 -fPIC -shared -o conftest.so conftest.c
1532 -Wl,-Bgroup -nostdlib 1>&AS_MESSAGE_LOG_FD])
1539 AC_SUBST(libc_cv_Bgroup)
1542 AC_CACHE_CHECK(whether --noexecstack is desirable for .S files,
1543 libc_cv_as_noexecstack, [dnl
1544 cat > conftest.c <<EOF
1547 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS
1548 -S -o conftest.s conftest.c 1>&AS_MESSAGE_LOG_FD]) \
1549 && grep .note.GNU-stack conftest.s >/dev/null \
1550 && AC_TRY_COMMAND([${CC-cc} $ASFLAGS -Wa,--noexecstack
1551 -c -o conftest.o conftest.s 1>&AS_MESSAGE_LOG_FD])
1553 libc_cv_as_noexecstack=yes
1555 libc_cv_as_noexecstack=no
1558 if test $libc_cv_as_noexecstack = yes; then
1559 ASFLAGS_config="$ASFLAGS_config -Wa,--noexecstack"
1561 AC_SUBST(ASFLAGS_config)
1563 AC_CACHE_CHECK(for -z combreloc,
1564 libc_cv_z_combreloc, [dnl
1565 cat > conftest.c <<EOF
1566 extern int bar (int);
1568 int foo (void) { return bar (mumble); }
1570 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1571 -fPIC -shared -o conftest.so conftest.c
1572 -nostdlib -nostartfiles
1573 -Wl,-z,combreloc 1>&AS_MESSAGE_LOG_FD])
1575 dnl The following test is a bit weak. We must use a tool which can test
1576 dnl cross-platform since the gcc used can be a cross compiler. Without
1577 dnl introducing new options this is not easily doable. Instead use a tool
1578 dnl which always is cross-platform: readelf. To detect whether -z combreloc
1579 dnl look for a section named .rel.dyn.
1580 if $READELF -S conftest.so | grep '\.rel\(a\|\)\.dyn' > /dev/null; then
1581 libc_cv_z_combreloc=yes
1583 libc_cv_z_combreloc=no
1586 libc_cv_z_combreloc=no
1589 if test "$libc_cv_z_combreloc" = yes; then
1590 AC_DEFINE(HAVE_Z_COMBRELOC)
1592 AC_SUBST(libc_cv_z_combreloc)
1594 LIBC_LINKER_FEATURE([-z execstack], [-Wl,-z,execstack],
1595 [libc_cv_z_execstack=yes], [libc_cv_z_execstack=no])
1596 AC_SUBST(libc_cv_z_execstack)
1598 AC_CACHE_CHECK(for -fpie, libc_cv_fpie, [dnl
1599 LIBC_TRY_CC_OPTION([-fpie], [libc_cv_fpie=yes], [libc_cv_fpie=no])
1602 AC_SUBST(libc_cv_fpie)
1604 AC_CACHE_CHECK(for --hash-style option,
1605 libc_cv_hashstyle, [dnl
1606 cat > conftest.c <<EOF
1607 int _start (void) { return 42; }
1609 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1610 -fPIC -shared -o conftest.so conftest.c
1611 -Wl,--hash-style=both -nostdlib 1>&AS_MESSAGE_LOG_FD])
1613 libc_cv_hashstyle=yes
1615 libc_cv_hashstyle=no
1618 AC_SUBST(libc_cv_hashstyle)
1620 # The linker's default -shared behavior is good enough if it
1621 # does these things that our custom linker scripts ensure that
1622 # all allocated NOTE sections come first.
1623 if test "$use_default_link" = default; then
1624 AC_CACHE_CHECK([for sufficient default -shared layout],
1625 libc_cv_use_default_link, [dnl
1626 libc_cv_use_default_link=no
1627 cat > conftest.s <<\EOF
1628 .section .note.a,"a",%note
1633 .section .note.b,"a",%note
1639 if AC_TRY_COMMAND([dnl
1640 ${CC-cc} $ASFLAGS -shared -o conftest.so conftest.s 1>&AS_MESSAGE_LOG_FD]) &&
1641 ac_try=`$READELF -S conftest.so | sed -n \
1643 s/^ *\[ *[1-9][0-9]*\] *\([^ ][^ ]*\) *\([^ ][^ ]*\) .*$/\2 \1/
1649 libc_seen_a=no libc_seen_b=no
1651 while test $# -ge 2 -a "$1" = NOTE; do
1653 .note.a) libc_seen_a=yes ;;
1654 .note.b) libc_seen_b=yes ;;
1658 case "$libc_seen_a$libc_seen_b" in
1660 libc_cv_use_default_link=yes
1663 echo >&AS_MESSAGE_LOG_FD "\
1664 $libc_seen_a$libc_seen_b from:
1670 use_default_link=$libc_cv_use_default_link
1673 AC_CACHE_CHECK(linker output format, libc_cv_output_format, [dnl
1674 if libc_cv_output_format=`
1675 ${CC-cc} -nostartfiles -nostdlib -Wl,--print-output-format 2>&AS_MESSAGE_LOG_FD`
1679 libc_cv_output_format=
1681 test -n "$libc_cv_output_format" || libc_cv_output_format=unknown])
1682 AC_SUBST(libc_cv_output_format)
1684 AC_CACHE_CHECK(for -fno-toplevel-reorder -fno-section-anchors, libc_cv_fno_toplevel_reorder, [dnl
1685 cat > conftest.c <<EOF
1688 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -fno-toplevel-reorder -fno-section-anchors
1689 conftest.c 1>&AS_MESSAGE_LOG_FD])
1691 libc_cv_fno_toplevel_reorder=yes
1693 libc_cv_fno_toplevel_reorder=no
1696 if test $libc_cv_fno_toplevel_reorder = yes; then
1697 fno_unit_at_a_time="-fno-toplevel-reorder -fno-section-anchors"
1699 fno_unit_at_a_time=-fno-unit-at-a-time
1701 AC_SUBST(fno_unit_at_a_time)
1703 AC_CACHE_CHECK(for -fstack-protector, libc_cv_ssp, [dnl
1704 LIBC_TRY_CC_OPTION([$CFLAGS $CPPFLAGS -Werror -fstack-protector],
1708 AC_SUBST(libc_cv_ssp)
1710 AC_CACHE_CHECK(for -fgnu89-inline, libc_cv_gnu89_inline, [dnl
1711 cat > conftest.c <<EOF
1713 #ifdef __GNUC_GNU_INLINE__
1714 main () { return 0;}
1719 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -std=gnu99 -fgnu89-inline
1720 -o conftest.s conftest.c 1>&AS_MESSAGE_LOG_FD])
1722 libc_cv_gnu89_inline=yes
1724 libc_cv_gnu89_inline=no
1727 if test $libc_cv_gnu89_inline = yes; then
1728 gnu89_inline=-fgnu89-inline
1732 AC_SUBST(gnu89_inline)
1734 AC_CACHE_CHECK(whether cc puts quotes around section names,
1735 libc_cv_have_section_quotes,
1736 [cat > conftest.c <<EOF
1737 static const int foo
1738 __attribute__ ((section ("bar"))) = 1;
1740 if ${CC-cc} -S conftest.c -o conftest.s; then
1741 if grep '\.section.*"bar"' conftest.s >/dev/null; then
1742 libc_cv_have_section_quotes=yes
1744 libc_cv_have_section_quotes=no
1747 libc_cv_have_section_quotes=unknown
1749 rm -f conftest.{c,s}
1751 if test $libc_cv_have_section_quotes = yes; then
1752 AC_DEFINE(HAVE_SECTION_QUOTES)
1755 AC_CACHE_CHECK(for assembler .weak directive, libc_cv_asm_weak_directive,
1757 cat > conftest.s <<EOF
1762 .weak bar; bar = foo
1764 if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
1765 libc_cv_asm_weak_directive=yes
1767 libc_cv_asm_weak_directive=no
1771 if test $libc_cv_asm_weak_directive = no; then
1772 AC_CACHE_CHECK(for assembler .weakext directive,
1773 libc_cv_asm_weakext_directive,
1775 cat > conftest.s <<EOF
1784 if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
1785 libc_cv_asm_weakext_directive=yes
1787 libc_cv_asm_weakext_directive=no
1793 if test $libc_cv_asm_weak_directive = yes; then
1794 AC_DEFINE(HAVE_ASM_WEAK_DIRECTIVE)
1795 elif test $libc_cv_asm_weakext_directive = yes; then
1796 AC_DEFINE(HAVE_ASM_WEAKEXT_DIRECTIVE)
1799 AC_CACHE_CHECK(whether CFI directives are supported, libc_cv_asm_cfi_directives, [dnl
1801 sparc/sparc64*) cfi_offset=2047;;
1804 cat > conftest.s <<EOF
1806 .type func,%function
1810 .cfi_rel_offset 1, $cfi_offset
1813 if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
1814 libc_cv_asm_cfi_directives=yes
1816 libc_cv_asm_cfi_directives=no
1819 if test $libc_cv_asm_cfi_directives = yes; then
1820 AC_DEFINE(HAVE_ASM_CFI_DIRECTIVES)
1823 AC_CACHE_CHECK(for ld --no-whole-archive, libc_cv_ld_no_whole_archive, [dnl
1824 cat > conftest.c <<\EOF
1829 dnl No \ in command here because it ends up inside ''.
1830 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1831 -nostdlib -nostartfiles -Wl,--no-whole-archive
1832 -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD]); then
1833 libc_cv_ld_no_whole_archive=yes
1835 libc_cv_ld_no_whole_archive=no
1838 if test $libc_cv_ld_no_whole_archive = no; then
1839 AC_MSG_ERROR([support for --no-whole-archive is needed])
1842 AC_CACHE_CHECK(for gcc -fexceptions, libc_cv_gcc_exceptions, [dnl
1843 cat > conftest.c <<\EOF
1848 dnl No \ in command here because it ends up inside ''.
1849 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1850 -nostdlib -nostartfiles -fexceptions
1851 -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD]); then
1852 libc_cv_gcc_exceptions=yes
1854 libc_cv_gcc_exceptions=no
1857 if test $libc_cv_gcc_exceptions = yes; then
1858 exceptions=-fexceptions
1860 AC_SUBST(exceptions)dnl
1862 if test "$host_cpu" = powerpc ; then
1863 # Check for a bug present in at least versions 2.8.x of GCC
1864 # and versions 1.0.x of EGCS.
1865 AC_CACHE_CHECK(whether clobbering cr0 causes problems,libc_cv_c_asmcr0_bug,[dnl
1866 AC_TRY_COMPILE([int tester(int x) { asm ("" : : : "cc"); return x & 123; }],,
1867 libc_cv_c_asmcr0_bug='no',
1868 libc_cv_c_asmcr0_bug='yes')])
1869 if test "$libc_cv_c_asmcr0_bug" != 'no'; then
1870 AC_DEFINE(BROKEN_PPC_ASM_CR0)
1874 AC_CACHE_CHECK(for __builtin_memset, libc_cv_gcc_builtin_memset, [dnl
1875 cat > conftest.c <<\EOF
1878 __builtin_memset (x, 0, 1000);
1882 if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | fgrep "memset" > /dev/null]);
1884 libc_cv_gcc_builtin_memset=no
1886 libc_cv_gcc_builtin_memset=yes
1889 if test "$libc_cv_gcc_builtin_memset" = yes ; then
1890 AC_DEFINE(HAVE_BUILTIN_MEMSET)
1893 AC_CACHE_CHECK(for redirection of built-in functions, libc_cv_gcc_builtin_redirection, [dnl
1894 cat > conftest.c <<\EOF
1895 extern char *strstr (const char *, const char *) __asm ("my_strstr");
1896 char *foo (const char *a, const char *b)
1898 return __builtin_strstr (a, b);
1902 if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | fgrep "my_strstr" > /dev/null]);
1904 libc_cv_gcc_builtin_redirection=yes
1906 libc_cv_gcc_builtin_redirection=no
1909 if test "$libc_cv_gcc_builtin_redirection" = no; then
1910 AC_MSG_ERROR([support for the symbol redirection needed])
1913 dnl Check whether the compiler supports the __thread keyword.
1914 AC_CACHE_CHECK([for __thread], libc_cv_gcc___thread,
1915 [cat > conftest.c <<\EOF
1916 __thread int a = 42;
1918 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c >&AS_MESSAGE_LOG_FD]); then
1919 libc_cv_gcc___thread=yes
1921 libc_cv_gcc___thread=no
1924 if test "$libc_cv_gcc___thread" = no; then
1925 AC_MSG_ERROR([support for the __thread keyword is required])
1928 dnl Check whether the compiler supports the tls_model attribute.
1929 AC_CACHE_CHECK([for tls_model attribute], libc_cv_gcc_tls_model_attr, [dnl
1930 cat > conftest.c <<\EOF
1931 extern __thread int a __attribute__((tls_model ("initial-exec")));
1933 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -Werror conftest.c >&AS_MESSAGE_LOG_FD]); then
1934 libc_cv_gcc_tls_model_attr=yes
1936 libc_cv_gcc_tls_model_attr=no
1939 if test "$libc_cv_gcc_tls_model_attr" = no; then
1940 AC_MSG_ERROR([support for the tls_model attribute is required])
1943 dnl Determine how to disable generation of FMA instructions.
1944 AC_CACHE_CHECK([for compiler option to disable generation of FMA instructions],
1945 libc_cv_cc_nofma, [dnl
1947 for opt in -ffp-contract=off -mno-fused-madd; do
1948 LIBC_TRY_CC_OPTION([$opt], [libc_cv_cc_nofma=$opt; break])
1950 AC_SUBST(libc_cv_cc_nofma)
1952 if test -n "$submachine"; then
1953 AC_CACHE_CHECK([for compiler option for CPU variant],
1954 libc_cv_cc_submachine, [dnl
1955 libc_cv_cc_submachine=no
1956 for opt in "-march=$submachine" "-mcpu=$submachine"; do
1957 LIBC_TRY_CC_OPTION([$opt], [
1958 libc_cv_cc_submachine="$opt"
1961 if test "x$libc_cv_cc_submachine" = xno; then
1962 AC_MSG_ERROR([${CC-cc} does not support $submachine])
1965 AC_SUBST(libc_cv_cc_submachine)
1967 AC_CACHE_CHECK(if $CC accepts -fno-tree-loop-distribute-patterns with \
1968 __attribute__ ((__optimize__)), libc_cv_cc_loop_to_function, [dnl
1969 cat > conftest.c <<EOF
1971 __attribute__ ((__optimize__ ("-fno-tree-loop-distribute-patterns")))
1974 libc_cv_cc_loop_to_function=no
1975 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c])
1977 libc_cv_cc_loop_to_function=yes
1980 if test $libc_cv_cc_loop_to_function = yes; then
1981 AC_DEFINE(HAVE_CC_INHIBIT_LOOP_TO_LIBCALL)
1983 AC_SUBST(libc_cv_cc_loop_to_function)
1985 dnl Check whether we have the gd library available.
1986 AC_MSG_CHECKING(for libgd)
1987 if test "$with_gd" != "no"; then
1988 old_CFLAGS="$CFLAGS"
1989 CFLAGS="$CFLAGS $libgd_include"
1990 old_LDFLAGS="$LDFLAGS"
1991 LDFLAGS="$LDFLAGS $libgd_ldflags"
1993 LIBS="$LIBS -lgd -lpng -lz -lm"
1994 AC_TRY_LINK([#include <gd.h>], [gdImagePng (0, 0)], LIBGD=yes, LIBGD=no)
1995 CFLAGS="$old_CFLAGS"
1996 LDFLAGS="$old_LDFLAGS"
2001 AC_MSG_RESULT($LIBGD)
2005 if test x$with_selinux = xno ; then
2008 # See if we have the SELinux library
2009 AC_CHECK_LIB(selinux, is_selinux_enabled,
2010 have_selinux=yes, have_selinux=no)
2011 # See if we have the SELinux header with the NSCD permissions in it.
2012 if test x$have_selinux = xyes ; then
2013 AC_MSG_CHECKING([for NSCD Flask permissions in selinux/av_permissions.h])
2014 AC_TRY_COMPILE([#include <selinux/av_permissions.h>],
2015 [#ifdef NSCD__SHMEMHOST
2018 #error NSCD__SHMEMHOST not defined
2020 have_selinux=yes, have_selinux=no)
2021 AC_MSG_RESULT($have_selinux)
2024 if test x$with_selinux = xyes ; then
2025 if test x$have_selinux = xno ; then
2026 AC_MSG_ERROR([SELinux explicitly required, but sufficiently recent SELinux library not found])
2030 # Check if we're building with SELinux support.
2031 if test "x$have_selinux" = xyes; then
2032 AC_DEFINE(HAVE_SELINUX, 1, [SELinux support])
2034 # See if we have the libaudit library
2035 AC_CHECK_LIB(audit, audit_log_user_avc_message,
2036 have_libaudit=yes, have_libaudit=no)
2037 if test "x$have_libaudit" = xyes; then
2038 AC_DEFINE(HAVE_LIBAUDIT, 1, [SELinux libaudit support])
2040 AC_SUBST(have_libaudit)
2042 # See if we have the libcap library
2043 AC_CHECK_LIB(cap, cap_init, have_libcap=yes, have_libcap=no)
2044 if test "x$have_libcap" = xyes; then
2045 AC_DEFINE(HAVE_LIBCAP, 1, [SELinux libcap support])
2047 AC_SUBST(have_libcap)
2049 AC_SUBST(have_selinux)
2051 dnl check for the size of 'long double'.
2052 AC_CHECK_SIZEOF(long double, 0)
2053 sizeof_long_double=$ac_cv_sizeof_long_double
2054 AC_SUBST(sizeof_long_double)
2057 dnl Check for silly hacked compilers predefining _FORTIFY_SOURCE.
2058 dnl Since we are building the implementations of the fortified functions here,
2059 dnl having the macro defined interacts very badly.
2060 AC_CACHE_CHECK([for _FORTIFY_SOURCE predefine], libc_cv_predef_fortify_source,
2061 [AC_TRY_COMPILE([], [
2062 #ifdef _FORTIFY_SOURCE
2065 [libc_cv_predef_fortify_source=no],
2066 [libc_cv_predef_fortify_source=yes])])
2067 if test $libc_cv_predef_fortify_source = yes; then
2068 CPPUNDEFS="${CPPUNDEFS:+$CPPUNDEFS }-U_FORTIFY_SOURCE"
2072 dnl Check for silly hacked compilers inserting -fstack-protector.
2073 dnl This breaks badly for the early startup code we compile, since
2074 dnl the compiled code can refer to a magic machine-dependent location
2075 dnl for the canary value before we have sufficient setup for that to
2076 dnl work. It's also questionable to build all of libc with this flag
2077 dnl even when you're doing that for most applications you build, since
2078 dnl libc's code is so heavily-used and performance-sensitive. If we
2079 dnl ever really want to make that work, it should be enabled explicitly
2080 dnl in the libc build, not inherited from implicit compiler settings.
2081 AC_CACHE_CHECK([whether $CC implicitly enables -fstack-protector],
2082 libc_cv_predef_stack_protector, [
2083 AC_TRY_COMPILE([extern void foobar (char *);],
2084 [char large_array[2048]; foobar (large_array);], [
2085 libc_undefs=`$NM -u conftest.o |
2086 LC_ALL=C $AWK '$1 == "U" { print $2 | "sort -u"; next } { exit(1) }' \
2087 2>&AS_MESSAGE_LOG_FD` || {
2088 AC_MSG_ERROR([confusing output from $NM -u])
2090 echo >&AS_MESSAGE_LOG_FD "libc_undefs='$libc_undefs'"
2091 # On some architectures, there are architecture-specific undefined
2092 # symbols (resolved by the linker), so filter out unknown symbols.
2093 # This will fail to produce the correct result if the compiler
2094 # defaults to -fstack-protector but this produces an undefined symbol
2095 # other than __stack_chk_fail. However, compilers like that have not
2096 # been encountered in practice.
2097 libc_undefs=`echo "$libc_undefs" | egrep '^(foobar|__stack_chk_fail)$'`
2098 case "$libc_undefs" in
2099 foobar) libc_cv_predef_stack_protector=no ;;
2101 foobar') libc_cv_predef_stack_protector=yes ;;
2102 *) AC_MSG_ERROR([unexpected symbols in test: $libc_undefs]) ;;
2104 [AC_MSG_ERROR([test compilation failed])])
2107 if test $libc_cv_predef_stack_protector = yes; then
2108 libc_extra_cflags=-fno-stack-protector
2110 AC_SUBST(libc_extra_cflags)
2112 ### End of automated tests.
2113 ### Now run sysdeps configure fragments.
2115 # They also can set these variables.
2117 ldd_rewrite_script=no
2118 libc_cv_sysconfdir=$sysconfdir
2119 libc_cv_localstatedir=$localstatedir
2120 libc_cv_gcc_unwind_find_fde=no
2123 # Iterate over all the sysdep directories we will use, running their
2124 # configure fragments.
2125 for dir in $sysnames; do
2128 *) dest=$srcdir/$dir ;;
2130 if test -r $dest/configure; then
2131 AC_MSG_RESULT(running configure fragment for $dir)
2136 if test x$libc_cv_gcc_unwind_find_fde = xyes; then
2137 AC_DEFINE(EXPORT_UNWIND_FIND_FDE)
2139 AC_SUBST(libc_cv_gcc_unwind_find_fde)
2141 # A sysdeps configure fragment can reset this if IFUNC is not actually
2142 # usable even though the assembler knows how to generate the symbol type.
2143 if test x"$libc_cv_ld_gnu_indirect_function" = xyes; then
2144 AC_DEFINE(HAVE_IFUNC)
2147 # This is far from the AC_ARG_ENABLE that sets it so that a sysdeps
2148 # configure fragment can override the value to prevent this AC_DEFINE.
2150 if test "x$use_nscd" != xno; then
2151 AC_DEFINE([USE_NSCD])
2153 if test "x$build_nscd" = xdefault; then
2154 build_nscd=$use_nscd
2157 # Test for old glibc 2.0.x headers so that they can be removed properly
2158 # Search only in includedir.
2159 AC_MSG_CHECKING(for old glibc 2.0.x headers)
2160 if eval test -f "${includedir}/elfclass.h" -a -f "${includedir}/fcntlbits.h"
2162 old_glibc_headers=yes
2164 old_glibc_headers=no
2166 AC_MSG_RESULT($old_glibc_headers)
2167 if test ${old_glibc_headers} = yes; then
2168 AC_MSG_WARN(*** During \"make install\" old headers from glibc 2.0.x will)
2169 AC_MSG_WARN(*** be removed.)
2171 AC_SUBST(old_glibc_headers)
2173 AC_SUBST(libc_cv_slibdir)
2174 AC_SUBST(libc_cv_rtlddir)
2175 AC_SUBST(libc_cv_localedir)
2176 AC_SUBST(libc_cv_sysconfdir)
2177 AC_SUBST(libc_cv_localstatedir)
2178 AC_SUBST(libc_cv_rootsbindir)
2179 AC_SUBST(libc_cv_forced_unwind)
2181 if test x$use_ldconfig = xyes; then
2182 AC_DEFINE(USE_LDCONFIG)
2184 AC_SUBST(use_ldconfig)
2185 AC_SUBST(ldd_rewrite_script)
2190 AC_CACHE_CHECK([whether -fPIC is default], libc_cv_pic_default,
2191 [libc_cv_pic_default=yes
2192 cat > conftest.c <<EOF
2193 #if defined __PIC__ || defined __pic__ || defined PIC || defined pic
2194 # error PIC is default.
2197 if eval "${CC-cc} -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
2198 libc_cv_pic_default=no
2201 AC_SUBST(libc_cv_pic_default)
2204 AC_SUBST(static_nss)
2208 dnl See sysdeps/mach/configure.in for this variable.
2209 AC_SUBST(mach_interface_list)
2211 VERSION=`sed -n -e 's/^#define VERSION "\([^"]*\)"/\1/p' < $srcdir/version.h`
2212 RELEASE=`sed -n -e 's/^#define RELEASE "\([^"]*\)"/\1/p' < $srcdir/version.h`
2216 AC_CONFIG_FILES([config.make Makefile])
2217 AC_CONFIG_COMMANDS([default],[[
2218 case $CONFIG_FILES in *config.make*)
2219 echo "$config_vars" >> config.make;;
2221 test -d bits || mkdir bits]],[[config_vars='$config_vars']])