1 dnl Process this file with autoconf to produce a configure script.
3 AC_PREREQ(2.53)dnl dnl Minimum Autoconf version required.
4 AC_INIT([GNU C Library], [(see version.h)], [glibc])
5 AC_CONFIG_SRCDIR([include/features.h])
6 AC_CONFIG_HEADERS([config.h])
7 AC_CONFIG_AUX_DIR([scripts])
9 dnl This is here so we can set $subdirs directly based on configure fragments.
15 if test $host != $build; then
16 AC_CHECK_PROGS(BUILD_CC, gcc cc)
18 AC_SUBST(cross_compiling)
20 # We need the C++ compiler only for testing.
23 if test "`cd $srcdir; /bin/pwd`" = "`/bin/pwd`"; then
24 AC_MSG_ERROR([you must configure in a separate build directory])
27 # This will get text that should go into config.make.
30 # Check for a --with-gd argument and set libgd-LDFLAGS in config.make.
32 AC_HELP_STRING([--with-gd=DIR],
33 [find libgd include dir and library with prefix DIR]),
37 *) libgd_include="-I$withval/include"
38 libgd_ldflags="-L$withval/lib" ;;
41 AC_ARG_WITH([gd-include],
42 AC_HELP_STRING([--with-gd-include=DIR],
43 [find libgd include files in DIR]),
45 case "$with_gd_include" in
47 *) libgd_include="-I$withval" ;;
51 AC_HELP_STRING([--with-gd-lib=DIR],
52 [find libgd library files in DIR]),
54 case "$with_gd_lib" in
56 *) libgd_ldflags="-L$withval" ;;
60 if test -n "$libgd_include"; then
61 config_vars="$config_vars
62 CFLAGS-memusagestat.c = $libgd_include"
64 if test -n "$libgd_ldflags"; then
65 config_vars="$config_vars
66 libgd-LDFLAGS = $libgd_ldflags"
69 dnl Arguments to specify presence of other packages/features.
71 AC_HELP_STRING([--with-fp],
72 [if using floating-point hardware @<:@default=yes@:>@]),
76 AC_ARG_WITH([binutils],
77 AC_HELP_STRING([--with-binutils=PATH],
78 [specify location of binutils (as and ld)]),
79 [path_binutils=$withval],
82 AC_HELP_STRING([--with-elf],
83 [if using the ELF object format]),
86 AC_ARG_WITH([selinux],
87 AC_HELP_STRING([--with-selinux],
88 [if building with SELinux support]),
89 [with_selinux=$withval],
92 AC_HELP_STRING([--with-xcoff],
93 [if using the XCOFF object format]),
97 AC_ARG_WITH([headers],
98 AC_HELP_STRING([--with-headers=PATH],
99 [location of system headers to use
100 (for example /usr/src/linux/include)
101 @<:@default=compiler default@:>@]),
102 [sysheaders=$withval],
105 AC_SUBST(use_default_link)
106 AC_ARG_WITH([default-link],
107 AC_HELP_STRING([--with-default-link],
108 [do not use explicit linker scripts]),
109 [use_default_link=$withval],
110 [use_default_link=default])
112 AC_ARG_ENABLE([sanity-checks],
113 AC_HELP_STRING([--disable-sanity-checks],
114 [really do not use threads (should not be used except in special situations) @<:@default=yes@:>@]),
115 [enable_sanity=$enableval],
118 AC_SUBST(enable_check_abi)
119 AC_ARG_ENABLE([check-abi],
120 AC_HELP_STRING([--enable-check-abi],
121 [do "make check-abi" in "make check" (no/warn/yes)
122 @<:@default=no@:>@]),
123 [enable_check_abi=$enableval],
124 [enable_check_abi=no])
126 dnl Arguments to enable or disable building the static, shared, profiled,
127 dnl and -fomit-frame-pointer libraries.
128 dnl I've disabled this for now since we cannot build glibc without static
129 dnl libraries built in the moment.
130 dnl AC_ARG_ENABLE([static],
131 dnl AC_HELP_STRING([--enable-static],
132 dnl [build static library @<:@default=yes@:>@]),
133 dnl [static=$enableval],
136 AC_ARG_ENABLE([shared],
137 AC_HELP_STRING([--enable-shared],
138 [build shared library @<:@default=yes if GNU ld & ELF@:>@]),
141 AC_ARG_ENABLE([profile],
142 AC_HELP_STRING([--enable-profile],
143 [build profiled library @<:@default=no@:>@]),
144 [profile=$enableval],
146 AC_ARG_ENABLE([omitfp],
147 AC_HELP_STRING([--enable-omitfp],
148 [build undebuggable optimized library @<:@default=no@:>@]),
151 AC_ARG_ENABLE([bounded],
152 AC_HELP_STRING([--enable-bounded],
153 [build with runtime bounds checking @<:@default=no@:>@]),
154 [bounded=$enableval],
156 AC_ARG_ENABLE([versioning],
157 AC_HELP_STRING([--disable-versioning],
158 [do not include versioning information in the library objects @<:@default=yes if supported@:>@]),
159 [enable_versioning=$enableval],
160 [enable_versioning=yes])
162 AC_ARG_ENABLE([oldest-abi],
163 AC_HELP_STRING([--enable-oldest-abi=ABI],
164 [configure the oldest ABI supported @<:@e.g. 2.2@:>@ @<:@default=glibc default@:>@]),
165 [oldest_abi=$enableval],
167 if test "$oldest_abi" = yes || test "$oldest_abi" = no; then
170 AC_DEFINE_UNQUOTED(GLIBC_OLDEST_ABI, "$oldest_abi")
174 AC_ARG_ENABLE([stackguard-randomization],
175 AC_HELP_STRING([--enable-stackguard-randomization],
176 [initialize __stack_chk_guard canary with a random number at program start]),
177 [enable_stackguard_randomize=$enableval],
178 [enable_stackguard_randomize=no])
179 if test "$enable_stackguard_randomize" = yes; then
180 AC_DEFINE(ENABLE_STACKGUARD_RANDOMIZE)
183 dnl Generic infrastructure for drop-in additions to libc.
184 AC_ARG_ENABLE([add-ons],
185 AC_HELP_STRING([--enable-add-ons@<:@=DIRS...@:>@],
186 [configure and build add-ons in DIR1,DIR2,...
187 search for add-ons if no parameter given]),
188 , [enable_add_ons=yes])
190 dnl Let the user avoid using TLS. Don't know why but...
192 AC_HELP_STRING([--with-tls],
193 [enable support for TLS]),
197 AC_ARG_ENABLE([hidden-plt],
198 AC_HELP_STRING([--disable-hidden-plt],
199 [do not hide internal function calls to avoid PLT]),
202 if test "x$hidden" = xno; then
206 AC_ARG_ENABLE([bind-now],
207 AC_HELP_STRING([--enable-bind-now],
208 [disable lazy relocations in DSOs]),
209 [bindnow=$enableval],
213 dnl On some platforms we cannot use dynamic loading. We must provide
214 dnl static NSS modules.
215 AC_ARG_ENABLE([static-nss],
216 AC_HELP_STRING([--enable-static-nss],
217 [build static NSS modules @<:@default=no@:>@]),
218 [static_nss=$enableval],
220 dnl Enable static NSS also if we build no shared objects.
221 if test x"$static_nss" = xyes || test x"$shared" = xno; then
223 AC_DEFINE(DO_STATIC_NSS)
226 AC_ARG_ENABLE([force-install],
227 AC_HELP_STRING([--disable-force-install],
228 [don't force installation of files from this package, even if they are older than the installed files]),
229 [force_install=$enableval],
231 AC_SUBST(force_install)
233 dnl On some platforms we allow dropping compatibility with all kernel
235 AC_ARG_ENABLE([kernel],
236 AC_HELP_STRING([--enable-kernel=VERSION],
237 [compile for compatibility with kernel not older than VERSION]),
238 [minimum_kernel=$enableval],
240 dnl Prevent unreasonable values.
241 if test "$minimum_kernel" = yes || test "$minimum_kernel" = no; then
242 # Better nothing than this.
245 if test "$minimum_kernel" = current; then
246 minimum_kernel=`uname -r 2>/dev/null` || minimum_kernel=
250 dnl For the development we sometimes want gcc to issue even more warnings.
251 dnl This is not the default since many of the extra warnings are not
253 AC_ARG_ENABLE([all-warnings],
254 AC_HELP_STRING([--enable-all-warnings],
255 [enable all useful warnings gcc can issue]),
256 [all_warnings=$enableval],
258 AC_SUBST(all_warnings)
260 AC_ARG_ENABLE([multi-arch],
261 AC_HELP_STRING([--enable-multi-arch],
262 [enable single DSO with optimizations for multiple architectures]),
263 [multi_arch=$enableval],
264 [multi_arch=default])
266 AC_ARG_ENABLE([nss-crypt],
267 AC_HELP_STRING([--enable-nss-crypt],
268 [enable libcrypt to use nss]),
269 [nss_crypt=$enableval],
271 if test x$nss_crypt = xyes; then
272 nss_includes=-I$(nss-config --includedir 2>/dev/null)
273 if test $? -ne 0; then
274 AC_MSG_ERROR([cannot find include directory with nss-config])
277 CFLAGS="$CFLAGS $nss_includes"
278 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([typedef int PRBool;
280 #include <nsslowhash.h>
281 void f (void) { NSSLOW_Init (); }])],
282 libc_cv_nss_crypt=yes,
284 cannot find NSS headers with lowlevel hash function interfaces]))
286 LIBS="$LIBS -lfreebl3"
287 AC_LINK_IFELSE([AC_LANG_PROGRAM([typedef int PRBool;
289 #include <nsslowhash.h>],
291 libc_cv_nss_crypt=yes,
293 cannot link program using lowlevel NSS hash functions]))
299 AC_SUBST(libc_cv_nss_crypt)
301 # The way shlib-versions is used to generate soversions.mk uses a
302 # fairly simplistic model for name recognition that can't distinguish
303 # i486-pc-linux-gnu fully from i486-pc-gnu. So we mutate a $host_os
304 # of `gnu*' here to be `gnu-gnu*' just so that shlib-versions can
305 # tell. This doesn't get used much beyond that, so it's fairly safe.
310 host_os=`echo $host_os | sed -e 's/gnu/gnu-gnu/'`
314 # We keep the original values in `$config_*' and never modify them, so we
315 # can write them unchanged into config.make. Everything else uses
316 # $machine, $vendor, and $os, and changes them whenever convenient.
317 config_machine=$host_cpu config_vendor=$host_vendor config_os=$host_os
319 # Don't allow vendor == "unknown"
320 test "$config_vendor" = unknown && config_vendor=
321 config_os="`echo $config_os | sed 's/^unknown-//'`"
323 # Some configurations imply other options.
325 # i586-linuxaout is mangled into i586-pc-linux-gnuaout
326 linux*ecoff* | linux*aout* | gnu*aout* | gnu*ecoff*)
328 gnu* | linux* | freebsd* | netbsd* | sysv4* | solaris2* | irix6*)
329 # These systems (almost) always use the ELF format.
333 # These systems are always xcoff
339 # The configure fragment of an add-on port can modify these to supplement
340 # or override the table in the case statement below. No fragment should
341 # ever change the config_* variables, however.
342 machine=$config_machine
343 vendor=$config_vendor
347 # config.guess on some IBM machines says `rs6000' instead of `powerpc'.
349 if test "$machine" = rs6000; then
353 # Braindead PowerPC box with absolutely no FPU.
354 case "$machine-$host_os" in
362 AS_HELP_STRING([--with-cpu=CPU], [select code for CPU variant]),
365 yes|'') AC_MSG_ERROR([--with-cpu requires an argument]) ;;
367 *) submachine="$withval" ;;
371 # An add-on can set this when it wants to disable the sanity check below.
374 dnl Having this here, though empty, makes sure that if add-ons' fragments
375 dnl do AC_CONFIG_SUBDIRS([some-dir]), which just sets $subdirs, then
376 dnl our AC_OUTPUT will actually use it.
379 case "$enable_add_ons" in
382 add_ons=`cd $srcdir && ls -d 2> /dev/null */configure */sysdeps |
383 sed 's@/[[^/]]*$@@' | sort | uniq`
384 add_ons_automatic=yes
386 *) add_ons=`echo "$enable_add_ons" | sed 's/,/ /g'`
387 add_ons_automatic=no ;;
393 if test x"$add_ons" != x; then
394 for f in $add_ons; do
399 *** It seems that you're using an old \`crypt' add-on. crypt is now
400 *** part of glibc and using the old add-on will not work with this
401 *** release. Start again with fresh sources and without the old
402 *** \`crypt' add-on.])
406 *** It seems that you're using an old \`localedata' add-on. localedata
407 *** is now part of glibc and using the old add-on will not work with
408 *** this release. Start again with fresh sources and without the old
409 *** \`localedata' add-on.])
414 # Now source each add-on's configure fragment.
415 # The fragments can use $srcdir/$libc_add_on to find themselves,
416 # and test $add_ons_automatic to see if they were explicitly requested.
417 # A fragment can clear (or even change) $libc_add_on to affect
418 # whether it goes into the list to be actually used in the build.
420 for libc_add_on in $add_ons; do
421 # Test whether such a directory really exists.
422 # It can be absolute, or relative to $srcdir, or relative to the build dir.
423 case "$libc_add_on" in
425 libc_add_on_srcdir=$libc_add_on
428 test -d "$srcdir/$libc_add_on" || {
429 if test -d "$libc_add_on"; then
430 libc_add_on="`pwd`/$libc_add_on"
432 AC_MSG_ERROR(add-on directory \"$libc_add_on\" does not exist)
435 libc_add_on_srcdir=$srcdir/$libc_add_on
439 libc_add_on_frag=$libc_add_on_srcdir/configure
440 libc_add_on_canonical=
441 libc_add_on_config_subdirs=
442 if test -r "$libc_add_on_frag"; then
443 AC_MSG_NOTICE(running configure fragment for add-on $libc_add_on)
444 libc_add_on_canonical=unknown
446 . "$libc_add_on_frag"
447 test -z "$libc_add_on" || {
448 configured_add_ons="$configured_add_ons $libc_add_on"
449 if test "x$libc_add_on_canonical" = xunknown; then
450 AC_MSG_ERROR(fragment must set \$libc_add_on_canonical)
452 for d in $libc_add_on_subdirs; do
453 case "$libc_add_on" in
454 /*) subdir_srcdir="$libc_add_on" ;;
455 *) subdir_srcdir="\$(..)$libc_add_on" ;;
459 d="${libc_add_on_canonical:-$libc_add_on}"
465 subdir_srcdir="$subdir_srcdir/$d"
468 d=`echo "$d" | sed 's@/*$@@;s@^.*/@@'`
469 add_on_subdirs="$add_on_subdirs $d"
470 test "$subdir_srcdir" = "\$(..)$d" || config_vars="$config_vars
471 $d-srcdir = $subdir_srcdir"
473 for d in $libc_add_on_config_subdirs; do
476 fragment uses absolute path in \$libc_add_on_config_subdirs) ;;
478 if test ! -d "$libc_add_on_srcdir/$d"; then
479 AC_MSG_ERROR(fragment wants to configure missing directory $d)
481 case "$libc_add_on" in
483 relative path required for add-on using \$libc_add_on_config_subdirs) ;;
485 subdirs="$subdirs $libc_add_on/$d"
489 if test -n "$libc_add_on"; then
490 if frags=`ls -d $libc_add_on_srcdir/sysdeps/*/preconfigure 2> /dev/null`
492 AC_MSG_CHECKING(add-on $libc_add_on for preconfigure fragments)
493 for frag in $frags; do
494 name=`echo "$frag" | sed 's@/[[^/]]*$@@;s@^.*/@@'`
495 echo $ECHO_N "$name $ECHO_C" >&AS_MESSAGE_FD
500 use_add_ons="$use_add_ons $libc_add_on"
501 add_ons_pfx="$add_ons_pfx $libc_add_on/"
502 test -z "$libc_add_on_canonical" ||
503 add_ons_sfx="$add_ons_sfx /$libc_add_on_canonical"
506 # Use echo to strip excess whitespace.
507 add_ons="`echo $use_add_ons`"
510 AC_SUBST(add_on_subdirs)
514 ### I put this here to prevent those annoying emails from people who cannot
515 ### read and try to compile glibc on unsupported platforms. --drepper
517 ### By using the undocumented --enable-hacker-mode option for configure
518 ### one can skip this test to make the configuration not fail for unsupported
521 if test -z "$enable_hacker_mode" && test x"$libc_config_ok" != xyes; then
522 case "$machine-$host_os" in
523 *-linux* | *-gnu* | arm*-none* | powerpc-aix4.3.*)
526 echo "*** The GNU C library is currently not available for this platform."
527 echo "*** So far nobody cared to port it and if there is no volunteer it"
528 echo "*** might never happen. So, if you have interest to see glibc on"
529 echo "*** this platform visit"
530 echo "*** http://www.gnu.org/software/libc/porting.html"
531 echo "*** and join the group of porters"
537 dnl We need to use [ and ] for other purposes for a while now.
539 # Expand the configuration machine name into a subdirectory by architecture
540 # type and particular chip. If an add-on configure fragment already set
541 # base_machine, we don't change it.
542 test -n "$base_machine" || case "$machine" in
543 a29k | am29000) base_machine=a29k machine=a29k ;;
544 c3[012]) base_machine=cx0 machine=cx0/c30 ;;
545 c4[04]) base_machine=cx0 machine=cx0/c40 ;;
546 i[34567]86) base_machine=i386 machine=i386/$machine ;;
547 ia64) base_machine=ia64 machine=ia64 ;;
548 m88???) base_machine=m88k machine=m88k/$machine ;;
549 m88k) base_machine=m88k machine=m88k/m88100 ;;
550 powerpc) base_machine=powerpc machine=powerpc/powerpc32 ;;
551 powerpc64) base_machine=powerpc machine=powerpc/powerpc64 ;;
552 s390) base_machine=s390 machine=s390/s390-32 ;;
553 s390x) base_machine=s390 machine=s390/s390-64 ;;
554 sh3*) base_machine=sh machine=sh/sh3 ;;
555 sh4*) base_machine=sh machine=sh/sh4 ;;
557 base_machine=sparc machine=sparc/sparc32 ;;
558 sparcv8 | supersparc | hypersparc)
559 base_machine=sparc machine=sparc/sparc32/sparcv8 ;;
560 sparcv8plus | sparcv8plusa | sparcv9)
561 base_machine=sparc machine=sparc/sparc32/sparcv9 ;;
562 sparcv8plusb | sparcv9b)
563 base_machine=sparc machine=sparc/sparc32/sparcv9/sparcv9b ;;
565 base_machine=sparc machine=sparc/sparc32/sparcv9/sparcv9v ;;
567 base_machine=sparc machine=sparc/sparc32/sparcv9/sparcv9v2 ;;
569 base_machine=sparc machine=sparc/sparc64 ;;
571 base_machine=sparc machine=sparc/sparc64/sparcv9b ;;
573 base_machine=sparc machine=sparc/sparc64/sparcv9v ;;
575 base_machine=sparc machine=sparc/sparc64/sparcv9v2 ;;
576 *) base_machine=$machine ;;
579 AC_SUBST(base_machine)
581 if test "$base_machine" = "i386"; then
582 AC_DEFINE(USE_REGPARMS)
585 # For the multi-arch option we need support in the assembler.
586 AC_CACHE_CHECK([for assembler gnu_indirect_function symbol type support],
587 libc_cv_asm_gnu_indirect_function, [dnl
588 cat > conftest.s <<EOF
589 .type foo,%gnu_indirect_function
591 if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD;
593 libc_cv_asm_gnu_indirect_function=yes
595 libc_cv_asm_gnu_indirect_function=no
599 AC_MSG_CHECKING(whether .text pseudo-op must be used)
600 AC_CACHE_VAL(libc_cv_dot_text, [dnl
601 cat > conftest.s <<EOF
605 if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
606 libc_cv_dot_text=.text
609 if test -z "$libc_cv_dot_text"; then
615 AC_CACHE_CHECK(for assembler global-symbol directive,
616 libc_cv_asm_global_directive, [dnl
617 libc_cv_asm_global_directive=UNKNOWN
618 for ac_globl in .globl .global .EXPORT; do
619 cat > conftest.s <<EOF
624 if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
625 libc_cv_asm_global_directive=${ac_globl}
628 test $libc_cv_asm_global_directive != UNKNOWN && break
630 if test $libc_cv_asm_global_directive = UNKNOWN; then
631 AC_MSG_ERROR(cannot determine asm global directive)
633 AC_DEFINE_UNQUOTED(ASM_GLOBAL_DIRECTIVE, ${libc_cv_asm_global_directive})
636 AC_CACHE_CHECK(for assembler .type directive prefix,
637 libc_cv_asm_type_prefix, [dnl
638 libc_cv_asm_type_prefix=no
639 for ac_try_prefix in '@' '%' '#'; do
640 cat > conftest.s <<EOF
642 ${libc_cv_asm_global_directive} foo
643 .type foo, ${ac_try_prefix}object
648 if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
649 libc_cv_asm_type_prefix=${ac_try_prefix}
652 test "x$libc_cv_asm_type_prefix" != xno && break
654 if test "x$libc_cv_asm_type_prefix" != xno; then
655 AC_DEFINE_UNQUOTED(ASM_TYPE_DIRECTIVE_PREFIX, ${libc_cv_asm_type_prefix})
658 if test x"$libc_cv_asm_gnu_indirect_function" != xyes -a x"$libc_cv_asm_type_prefix" = xno; then
659 if test x"$multi_arch" = xyes; then
660 AC_MSG_ERROR([--enable-multi-arch support requires assembler and linker support])
665 if test x"$multi_arch" != xno; then
666 multi_arch_d=/multiarch
669 # Compute the list of sysdep directories for this configuration.
670 # This can take a while to compute.
671 sysdep_dir=$srcdir/sysdeps
672 AC_MSG_CHECKING(sysdep dirs)
673 dnl We need to use [ and ] for other purposes for a while now.
675 # Make sco3.2v4 become sco3.2.4 and sunos4.1.1_U1 become sunos4.1.1.U1.
676 os="`echo $os | sed 's/\([0-9A-Z]\)[v_]\([0-9A-Z]\)/\1.\2/g'`"
678 test "x$base_os" != x || case "$os" in
681 netbsd* | 386bsd* | freebsd* | bsdi*)
682 base_os=unix/bsd/bsd4.4 ;;
683 osf* | sunos* | ultrix* | newsos* | dynix* | *bsd*)
685 sysv* | isc* | esix* | sco* | minix* | irix4* | linux*)
688 base_os=unix/sysv/irix6/$os ;;
690 base_os=unix/sysv/sysv4 ;;
692 base_os=unix/sysv/hpux/$os ;;
694 base_os=unix/sysv/aix/aix4.3 ;;
696 base_os=standalone ;;
699 # For sunos4.1.1, try sunos4.1.1, then sunos4.1, then sunos4, then sunos.
702 while o=`echo $tail | sed 's/\.[^.]*$//'`; test $o != $tail; do
706 o=`echo $tail | sed 's/[0-9]*$//'`
707 if test $o != $tail; then
710 # For linux-gnu, try linux-gnu, then linux.
711 o=`echo $tail | sed 's/-.*$//'`
712 if test $o != $tail; then
716 # For unix/sysv/sysv4, try unix/sysv/sysv4, then unix/sysv, then unix.
719 while b=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$b"; do
725 # For sparc/sparc32, try sparc/sparc32 and then sparc.
727 tail=$machine${submachine:+/$submachine}
728 while m=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$m"; do
730 # Prepend the machine's FPU directory unless --without-fp.
731 if test "$with_fp" = yes; then
734 mach="$mach /$1/nofpu"
740 dnl We are done with glob and regexp uses of [ and ]; return to autoconf.
743 # Find what sysdep directories exist.
746 for b in $base ''; do
747 for m0 in $mach ''; do
748 for v in /$vendor ''; do
749 test "$v" = / && continue
750 for o in /$ostry ''; do
751 test "$o" = / && continue
752 for m in $multi_arch_d $mach ''; do
753 for d in $add_ons_pfx ''; do
754 for a in $add_ons_sfx ''; do
755 if test -n "$m0$m0sub$b$v$o$m$msub"; then
756 try_srcdir="${srcdir}/"
760 try="${d}sysdeps$m0$m0sub$b$v$o$m$msub$a"
761 test -n "$enable_debug_configure" &&
762 echo "$0 [DEBUG]: try $try" >&2
763 if test -d "$try_srcdir$try"; then
764 sysnames="$sysnames $try"
765 { test -n "$o" || test -n "$b"; } && os_used=t
766 { test -n "$m" || test -n "$m0"; } && machine_used=t
768 x*/$submachine) submachine_used=t ;;
770 if test -n "$d"; then
771 case "$sysnames_add_ons" in
773 *|'') sysnames_add_ons="$sysnames_add_ons $d" ;;
786 # If the assembler supports gnu_indirect_function symbol type and the
787 # architecture supports multi-arch, we enable multi-arch by default.
788 case $sysnames_add_ons$sysnames in
792 test x"$multi_arch" = xdefault && multi_arch=no
795 if test x"$multi_arch" != xno; then
796 AC_DEFINE(USE_MULTIARCH)
800 if test -z "$os_used" && test "$os" != none; then
801 AC_MSG_ERROR(Operating system $os is not supported.)
803 if test -z "$machine_used" && test "$machine" != none; then
804 AC_MSG_ERROR(The $machine is not supported.)
806 if test -z "$submachine_used" && test -n "$submachine"; then
807 AC_MSG_ERROR(The $submachine subspecies of $host_cpu is not supported.)
811 # We have now validated the configuration.
814 # If using ELF, look for an `elf' subdirectory of each machine directory.
815 # We prepend these rather than inserting them whereever the machine appears
816 # because things specified by the machine's ELF ABI should override
817 # OS-specific things, and should always be the same for any OS on the
818 # machine (otherwise what's the point of an ABI?).
819 if test "$elf" = yes; then
821 for d in $add_ons_pfx ''; do
823 if test -d $srcdir/${d}sysdeps$m/elf; then
824 elf_dirs="$elf_dirs ${d}sysdeps$m/elf"
828 sysnames="`echo $elf_dirs | sed -e 's,//,/,g'` $sysnames"
832 # Expand the list of system names into a full list of directories
833 # from each element's parent name and Implies file (if present).
836 while test $# -gt 0; do
840 case " $names " in *" $name "*)
841 # Already in the list.
845 # Report each name as we discover it, so there is no long pause in output.
846 echo $ECHO_N "$name $ECHO_C" >&AS_MESSAGE_FD
848 name_base=`echo $name | sed -e 's@\(.*sysdeps\)/.*@\1@'`
852 *) xsrcdir=$srcdir/ ;;
854 test -n "$enable_debug_configure" &&
855 echo "[DEBUG]: name/Implies $xsrcdir$name/Implies" >&2
857 if test -f $xsrcdir$name/Implies; then
858 # Collect more names from the `Implies' file (removing comments).
859 implied_candidate="`sed 's/#.*$//' < $xsrcdir$name/Implies`"
861 for x in $implied_candidate; do
863 if test -d $xsrcdir$name_base/$x; then
864 implied="$implied $name_base/$x";
867 for d in $add_ons_pfx ''; do
871 *) try_srcdir=$srcdir/ ;;
873 test -n "$enable_debug_configure" &&
874 echo "[DEBUG]: $name implied $x try($d) {$try_srcdir}$try" >&2
875 if test $try != $xsrcdir$name_base/$x && test -d $try_srcdir$try;
877 implied="$implied $try"
879 case "$sysnames_add_ons" in
881 *|'') sysnames_add_ons="$sysnames_add_ons $d" ;;
885 if test $found = no; then
886 AC_MSG_WARN($name/Implies specifies nonexistent $x)
893 # Add NAME to the list of names.
896 # Find the parent of NAME, using the empty string if it has none.
898 parent="`echo $name | sed -n -e 's=/[^/]*$==' -e '/sysdeps$/q' -e p`"
901 # Add the names implied by NAME, and NAME's parent (if it has one), to
902 # the list of names to be processed (the argument list). We prepend the
903 # implied names to the list and append the parent. We want implied
904 # directories to come before further directories inferred from the
905 # configuration components; this ensures that for sysv4, unix/common
906 # (implied by unix/sysv/sysv4) comes before unix/sysv (in ostry (here $*)
908 sysnames="`echo $implied $* $parent`"
909 test -n "$sysnames" && set $sysnames
912 # Add the default directories.
913 default_sysnames=sysdeps/generic
914 if test "$elf" = yes; then
915 default_sysnames="sysdeps/generic/elf $default_sysnames"
917 sysnames="$names $default_sysnames"
919 # The other names were emitted during the scan.
920 AC_MSG_RESULT($default_sysnames)
922 # Collect the list of add-ons that supply partial sysdeps trees.
924 for add_on in $add_ons; do
927 *) xsrcdir="$srcdir/" ;;
930 test -d "$xsrcdir$add_on/sysdeps" || {
931 case "$configured_add_ons " in
934 AC_MSG_ERROR(add-on $add_on has no configure fragment or sysdeps tree)
940 sysdeps_add_ons="$sysdeps_add_ons $add_on"
941 case "$sysnames_add_ons" in
944 AC_MSG_WARN(add-on $add_on contributed no sysdeps directories)
949 for d in $sysnames; do
951 $add_on/sysdeps/*) ;;
954 (cd "$xsrcdir$d" && for f in *[[!~]]; do
958 test -d "$ff" || { test -e "$ff" && exit 88; }
962 test -d "$f" || { test -e "$f" && exit 88; }
966 if test $? -eq 88; then
971 if test $found = no; then
972 AC_MSG_WARN(add-on $add_on contributed no useful sysdeps directories)
975 AC_SUBST(sysdeps_add_ons)
981 if test "$INSTALL" = "${srcdir}/scripts/install-sh -c"; then
982 # The makefiles need to use a different form to find it in $srcdir.
983 INSTALL='\$(..)./scripts/install-sh -c'
988 AC_SUBST(MIG)dnl Needed by sysdeps/mach/configure.in
990 # Accept binutils 2.13 or newer.
991 AC_CHECK_PROG_VER(AS, $AS, --version,
992 [GNU assembler.* \([0-9]*\.[0-9.]*\)],
993 [2.1[3-9]*|2.1[0-9][0-9]*|2.[2-9][0-9]*|[3-9].*|[1-9][0-9]*], AS=: critic_missing="$critic_missing as")
994 AC_CHECK_PROG_VER(LD, $LD, --version,
995 [GNU ld.* \([0-9][0-9]*\.[0-9.]*\)],
996 [2.1[3-9]*|2.1[0-9][0-9]*|2.[2-9][0-9]*|[3-9].*|[1-9][0-9]*], LD=: critic_missing="$critic_missing ld")
998 # We need the physical current working directory. We cannot use the
999 # "pwd -P" shell builtin since that's not portable. Instead we try to
1000 # find a pwd binary. Note that assigning to the PWD environment
1001 # variable might have some interesting side effects, so we don't do
1003 AC_PATH_PROG(PWD_P, pwd, no)
1004 if test "$PWD_P" = no; then
1005 AC_MSG_ERROR(*** A pwd binary could not be found.)
1008 # These programs are version sensitive.
1009 AC_CHECK_TOOL_PREFIX
1010 AC_CHECK_PROG_VER(CC, ${ac_tool_prefix}gcc ${ac_tool_prefix}cc, -v,
1011 [version \([egcygnustpi-]*[0-9.]*\)], [3.4* | 4.[0-9]* ],
1012 critic_missing="$critic_missing gcc")
1013 AC_CHECK_PROG_VER(MAKE, gnumake gmake make, --version,
1014 [GNU Make[^0-9]*\([0-9][0-9.]*\)],
1015 [3.79* | 3.[89]*], critic_missing="$critic_missing make")
1017 AC_CHECK_PROG_VER(MSGFMT, gnumsgfmt gmsgfmt msgfmt, --version,
1018 [GNU gettext.* \([0-9]*\.[0-9.]*\)],
1019 [0.10.3[6-9]* | 0.10.[4-9][0-9]* | 0.1[1-9]* | 0.[2-9][0-9]* | [1-9].*],
1020 MSGFMT=: aux_missing="$aux_missing msgfmt")
1021 AC_CHECK_PROG_VER(MAKEINFO, makeinfo, --version,
1022 [GNU texinfo.* \([0-9][0-9.]*\)],
1024 MAKEINFO=: aux_missing="$aux_missing makeinfo")
1025 AC_CHECK_PROG_VER(SED, sed, --version,
1026 [GNU sed version \([0-9]*\.[0-9.]*\)],
1027 [3.0[2-9]*|3.[1-9]*|[4-9]*],
1028 SED=: aux_missing="$aux_missing sed")
1030 AC_CHECK_TOOL(READELF, readelf, false)
1032 AC_CHECK_PROGS(AUTOCONF, autoconf, no)
1033 case "x$AUTOCONF" in
1034 xno|x|x:) AUTOCONF=no ;;
1037 whether $AUTOCONF${ACFLAGS:+ }$ACFLAGS works, libc_cv_autoconf_works, [dnl
1038 if (cd $srcdir; $AUTOCONF $ACFLAGS configure.in > /dev/null 2>&1); then
1039 libc_cv_autoconf_works=yes
1041 libc_cv_autoconf_works=no
1043 test $libc_cv_autoconf_works = yes || AUTOCONF=no
1046 if test "x$AUTOCONF" = xno; then
1047 aux_missing="$aux_missing autoconf"
1050 test -n "$critic_missing" && AC_MSG_ERROR([
1051 *** These critical programs are missing or too old:$critic_missing
1052 *** Check the INSTALL file for required versions.])
1054 test -n "$aux_missing" && AC_MSG_WARN([
1055 *** These auxiliary programs are missing or incompatible versions:$aux_missing
1056 *** some features will be disabled.
1057 *** Check the INSTALL file for required versions.])
1059 # if using special system headers, find out the compiler's sekrit
1060 # header directory and add that to the list. NOTE: Only does the right
1061 # thing on a system that doesn't need fixincludes. (Not presently a problem.)
1062 if test -n "$sysheaders"; then
1063 SYSINCLUDES=-nostdinc
1064 for d in include include-fixed; do
1065 i=`$CC -print-file-name="$d"` && test "x$i" != x && test "x$i" != "x$d" &&
1066 SYSINCLUDES="$SYSINCLUDES -isystem $i"
1068 SYSINCLUDES="$SYSINCLUDES \
1069 -isystem `echo $sysheaders | sed 's/:/ -isystem /g'`"
1070 if test -n "$CXX"; then
1071 cxxversion=`$CXX -dumpversion 2>&AS_MESSAGE_LOG_FD` &&
1072 cxxmachine=`$CXX -dumpmachine 2>&AS_MESSAGE_LOG_FD` &&
1073 cxxheaders=`$CXX -print-file-name=../../../../include/c++/`"$cxxversion" &&
1074 CXX_SYSINCLUDES="-isystem $cxxheaders \
1075 -isystem $cxxheaders/$cxxmachine -isystem $cxxheaders/backward"
1078 AC_SUBST(SYSINCLUDES)
1079 AC_SUBST(CXX_SYSINCLUDES)
1081 # ranlib is never necessary on Linux and Hurd systems
1084 # Test if LD_LIBRARY_PATH contains the notation for the current directory
1085 # since this would lead to problems installing/building glibc.
1086 # LD_LIBRARY_PATH contains the current directory if one of the following
1088 # - one of the terminals (":" and ";") is the first or last sign
1089 # - two terminals occur directly after each other
1090 # - the path contains an element with a dot in it
1091 AC_MSG_CHECKING(LD_LIBRARY_PATH variable)
1093 case ${LD_LIBRARY_PATH} in
1094 [:\;]* | *[:\;] | *[:\;][:\;]* | *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* )
1095 ld_library_path_setting="contains current directory"
1098 ld_library_path_setting="ok"
1102 AC_MSG_RESULT($ld_library_path_setting)
1103 if test "$ld_library_path_setting" != "ok"; then
1105 *** LD_LIBRARY_PATH shouldn't contain the current directory when
1106 *** building glibc. Please change the environment variable
1107 *** and run configure again.])
1110 AC_CACHE_CHECK(whether GCC supports -static-libgcc, libc_cv_gcc_static_libgcc, [dnl
1111 if $CC -v -static-libgcc 2>&1 | grep -q 'unrecognized option.*static-libgcc'; then
1112 libc_cv_gcc_static_libgcc=
1114 libc_cv_gcc_static_libgcc=-static-libgcc
1116 AC_SUBST(libc_cv_gcc_static_libgcc)
1118 AC_PATH_PROG(BASH_SHELL, bash, no)
1119 if test "$BASH_SHELL" != no &&
1120 $BASH_SHELL -c 'test "$BASH_VERSINFO" \
1121 && test "$BASH_VERSINFO" -ge 2 >&/dev/null'; then
1122 libc_cv_have_bash2=yes
1124 libc_cv_have_bash2=no
1126 AC_SUBST(libc_cv_have_bash2)
1128 dnl We need a ksh compatible shell for tzselect.
1129 if test "$BASH_SHELL" = no; then
1130 AC_PATH_PROG(KSH, ksh, no)
1131 if test "$KSH" = no; then
1134 libc_cv_have_ksh=yes
1139 libc_cv_have_ksh=yes
1141 AC_SUBST(libc_cv_have_ksh)
1144 AC_PATH_PROG(PERL, perl, no)
1145 if test "$PERL" != no &&
1146 (eval `$PERL -V:apiversion`; test `expr "$apiversion" \< 5` -ne 0); then
1149 AC_PATH_PROG(INSTALL_INFO, install-info, no,
1150 $PATH:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin)
1151 AC_PATH_PROG(BISON, bison, no, $PATH:/usr/local/bin:/usr/bin:/bin)
1153 AC_CACHE_CHECK(for signed size_t type, libc_cv_signed_size_t, [dnl
1154 echo '#include <stddef.h>
1155 FOOBAR __SIZE_TYPE__ FOOBAR' > conftest.c
1156 if eval "$ac_cpp conftest.c 2>/dev/null" \
1157 | grep '^FOOBAR.*unsigned.*FOOBAR$' >/dev/null; then
1158 libc_cv_signed_size_t=no
1160 libc_cv_signed_size_t=yes
1163 if test $libc_cv_signed_size_t = yes; then
1164 dnl Do this by hand instead of AC_DEFINE so can add #undef to avoid warnings.
1165 cat >> confdefs.h <<\EOF
1166 #undef __SIZE_TYPE__
1167 #define __SIZE_TYPE__ unsigned
1171 AC_CACHE_CHECK(for libc-friendly stddef.h, libc_cv_friendly_stddef, [dnl
1173 [#define __need_size_t
1174 #define __need_wchar_t
1177 #include <stddef.h>], [size_t size; wchar_t wchar;
1179 #error stddef.h ignored __need_*
1181 if (&size == NULL || &wchar == NULL) abort ();],
1182 libc_cv_friendly_stddef=yes,
1183 libc_cv_friendly_stddef=no)])
1184 if test $libc_cv_friendly_stddef = yes; then
1185 config_vars="$config_vars
1186 override stddef.h = # The installed <stddef.h> seems to be libc-friendly."
1189 AC_CACHE_CHECK(whether we need to use -P to assemble .S files,
1190 libc_cv_need_minus_P, [dnl
1191 cat > conftest.S <<EOF
1192 #include "confdefs.h"
1193 /* Nothing whatsoever. */
1195 if AC_TRY_COMMAND(${CC-cc} $CPPFLAGS $ASFLAGS -c conftest.S 1>&AS_MESSAGE_LOG_FD); then
1196 libc_cv_need_minus_P=no
1198 libc_cv_need_minus_P=yes
1201 if test $libc_cv_need_minus_P = yes; then
1202 config_vars="$config_vars
1203 asm-CPPFLAGS = -P # The assembler can't grok cpp's # line directives."
1206 AC_CACHE_CHECK(for .set assembler directive, libc_cv_asm_set_directive, [dnl
1207 cat > conftest.s <<EOF
1210 .set glibc_conftest_frobozz,foo
1211 $libc_cv_asm_global_directive glibc_conftest_frobozz
1213 # The alpha-dec-osf1 assembler gives only a warning for `.set'
1214 # (but it doesn't work), so we must do a linking check to be sure.
1215 cat > conftest1.c <<\EOF
1216 extern int glibc_conftest_frobozz;
1217 void _start() { glibc_conftest_frobozz = 1; }
1219 if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
1220 -nostartfiles -nostdlib \
1221 -o conftest conftest.s conftest1.c 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
1222 libc_cv_asm_set_directive=yes
1224 libc_cv_asm_set_directive=no
1227 if test $libc_cv_asm_set_directive = yes; then
1228 AC_DEFINE(HAVE_ASM_SET_DIRECTIVE)
1231 AC_CACHE_CHECK(for assembler gnu_unique_object symbol type,
1232 libc_cv_asm_unique_object, [dnl
1233 cat > conftest.s <<EOF
1236 .type _sym, ${libc_cv_asm_type_prefix}gnu_unique_object
1238 if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
1239 libc_cv_asm_unique_object=yes
1241 libc_cv_asm_unique_object=no
1244 if test $libc_cv_asm_unique_object = yes; then
1245 AC_DEFINE(HAVE_ASM_UNIQUE_OBJECT)
1248 AC_CACHE_CHECK(for .symver assembler directive, libc_cv_asm_symver_directive,
1249 [cat > conftest.s <<EOF
1252 .symver _sym,sym@VERS
1254 if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
1255 libc_cv_asm_symver_directive=yes
1257 libc_cv_asm_symver_directive=no
1260 AC_CACHE_CHECK(for ld --version-script, libc_cv_ld_version_script_option, [dnl
1261 if test $libc_cv_asm_symver_directive = yes; then
1262 cat > conftest.s <<EOF
1265 .symver _sym,sym@VERS
1267 cat > conftest.map <<EOF
1276 if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
1277 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $LDFLAGS -shared
1278 -o conftest.so conftest.o
1279 -nostartfiles -nostdlib
1280 -Wl,--version-script,conftest.map
1281 1>&AS_MESSAGE_LOG_FD]);
1283 libc_cv_ld_version_script_option=yes
1285 libc_cv_ld_version_script_option=no
1288 libc_cv_ld_version_script_option=no
1291 libc_cv_ld_version_script_option=no
1294 if test $shared != no &&
1295 test $libc_cv_asm_symver_directive = yes &&
1296 test $libc_cv_ld_version_script_option = yes &&
1297 test $enable_versioning = yes; then
1299 AC_DEFINE(DO_VERSIONING)
1303 AC_SUBST(VERSIONING)
1305 if test $elf = yes && test $shared != no && test $VERSIONING = no; then
1307 *** WARNING: You should not compile GNU libc without versioning. Not using
1308 *** versioning will introduce incompatibilities so that old binaries
1309 *** will not run anymore.
1310 *** For versioning you need recent binutils (binutils-2.8.1.0.23 or newer)."
1312 if test $elf = yes; then
1313 AC_CACHE_CHECK(for .previous assembler directive,
1314 libc_cv_asm_previous_directive, [dnl
1315 cat > conftest.s <<EOF
1316 .section foo_section
1319 if AC_TRY_COMMAND(${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
1320 libc_cv_asm_previous_directive=yes
1322 libc_cv_asm_previous_directive=no
1325 if test $libc_cv_asm_previous_directive = yes; then
1326 AC_DEFINE(HAVE_ASM_PREVIOUS_DIRECTIVE)
1328 AC_CACHE_CHECK(for .popsection assembler directive,
1329 libc_cv_asm_popsection_directive, [dnl
1330 cat > conftest.s <<EOF
1331 .pushsection foo_section
1334 if AC_TRY_COMMAND(${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
1335 libc_cv_asm_popsection_directive=yes
1337 libc_cv_asm_popsection_directive=no
1340 if test $libc_cv_asm_popsection_directive = yes; then
1341 AC_DEFINE(HAVE_ASM_POPSECTION_DIRECTIVE)
1344 AC_CACHE_CHECK(for .protected and .hidden assembler directive,
1345 libc_cv_asm_protected_directive, [dnl
1346 cat > conftest.s <<EOF
1352 if AC_TRY_COMMAND(${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
1353 libc_cv_asm_protected_directive=yes
1355 AC_MSG_ERROR(assembler support for symbol visibility is required)
1359 if test $libc_cv_asm_protected_directive = yes; then
1360 AC_CACHE_CHECK(whether __attribute__((visibility())) is supported,
1361 libc_cv_visibility_attribute,
1362 [cat > conftest.c <<EOF
1363 int foo __attribute__ ((visibility ("hidden"))) = 1;
1364 int bar __attribute__ ((visibility ("protected"))) = 1;
1366 libc_cv_visibility_attribute=no
1367 if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
1368 if grep '\.hidden.*foo' conftest.s >/dev/null; then
1369 if grep '\.protected.*bar' conftest.s >/dev/null; then
1370 libc_cv_visibility_attribute=yes
1374 rm -f conftest.{c,s}
1376 if test $libc_cv_visibility_attribute != yes; then
1377 AC_MSG_ERROR(compiler support for visibility attribute is required)
1381 if test $libc_cv_visibility_attribute = yes; then
1382 AC_CACHE_CHECK(for broken __attribute__((visibility())),
1383 libc_cv_broken_visibility_attribute,
1384 [cat > conftest.c <<EOF
1386 int bar (int x) __asm__ ("foo") __attribute__ ((visibility ("hidden")));
1387 int bar (int x) { return x; }
1389 libc_cv_broken_visibility_attribute=yes
1390 if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
1392 if grep '\.hidden[ _]foo' conftest.s >/dev/null; then
1394 libc_cv_broken_visibility_attribute=no
1397 rm -f conftest.c conftest.s
1399 if test $libc_cv_broken_visibility_attribute = yes; then
1400 AC_MSG_ERROR(working compiler support for visibility attribute is required)
1404 AC_CACHE_CHECK(for broken __attribute__((alias())),
1405 libc_cv_broken_alias_attribute,
1406 [cat > conftest.c <<EOF
1407 extern int foo (int x) __asm ("xyzzy");
1408 int bar (int x) { return x; }
1409 extern __typeof (bar) foo __attribute ((weak, alias ("bar")));
1411 extern __typeof (dfoo) dfoo __asm ("abccb");
1414 libc_cv_broken_alias_attribute=yes
1415 if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
1416 if grep 'xyzzy' conftest.s >/dev/null &&
1417 grep 'abccb' conftest.s >/dev/null; then
1418 libc_cv_broken_alias_attribute=no
1421 rm -f conftest.c conftest.s
1423 if test $libc_cv_broken_alias_attribute = yes; then
1424 AC_MSG_ERROR(working alias attribute support required)
1427 if test $libc_cv_visibility_attribute = yes; then
1428 AC_CACHE_CHECK(whether to put _rtld_local into .sdata section,
1429 libc_cv_have_sdata_section,
1430 [echo "int i;" > conftest.c
1431 libc_cv_have_sdata_section=no
1432 if ${CC-cc} $LDFLAGS -fPIC -shared -Wl,--verbose conftest.c -o conftest.so 2>&1 \
1433 | grep '\.sdata' >/dev/null; then
1434 libc_cv_have_sdata_section=yes
1436 rm -f conftest.c conftest.so
1438 if test $libc_cv_have_sdata_section = yes; then
1439 AC_DEFINE(HAVE_SDATA_SECTION)
1443 AC_CACHE_CHECK(for .preinit_array/.init_array/.fini_array support,
1444 libc_cv_initfini_array, [dnl
1445 cat > conftest.c <<EOF
1446 int _start (void) { return 0; }
1447 int __start (void) { return 0; }
1448 int foo (void) { return 1; }
1449 int (*fp) (void) __attribute__ ((section (".init_array"))) = foo;
1451 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -o conftest conftest.c
1452 -static -nostartfiles -nostdlib 1>&AS_MESSAGE_LOG_FD])
1454 if $READELF -S conftest | fgrep INIT_ARRAY > /dev/null; then
1455 libc_cv_initfini_array=yes
1457 libc_cv_initfini_array=no
1460 libc_cv_initfini_array=no
1463 if test $libc_cv_initfini_array != yes; then
1464 AC_MSG_ERROR([Need linker with .init_array/.fini_array support.])
1467 AC_CACHE_CHECK(whether to use .ctors/.dtors header and trailer,
1468 libc_cv_ctors_header, [dnl
1469 libc_cv_ctors_header=yes
1471 __attribute__ ((constructor)) void ctor (void) { puts("ctor"); }
1472 __attribute__ ((destructor)) void dtor (void) { puts("dtor"); }
1475 AS_IF([$READELF -WS conftest$ac_exeext | $AWK '
1476 { gsub(/\@<:@ */, "@<:@") }
1477 $2 == ".ctors" || $2 == ".dtors" {
1478 size = strtonum("0x" $6)
1479 align = strtonum("0x" $NF)
1481 stub@<:@$2@:>@ = size == align * 2
1484 ctors_ok = !seen@<:@".ctors"@:>@ || stub@<:@".ctors"@:>@
1485 dtors_ok = !seen@<:@".dtors"@:>@ || stub@<:@".dtors"@:>@
1486 exit ((ctors_ok && dtors_ok) ? 0 : 1)
1488 '], [libc_cv_ctors_header=no])
1490 AC_MSG_ERROR([missing __attribute__ ((constructor)) support??])
1493 if test $libc_cv_ctors_header = no; then
1494 AC_DEFINE(NO_CTORS_DTORS_SECTIONS)
1497 AC_CACHE_CHECK(for libunwind-support in compiler,
1498 libc_cv_cc_with_libunwind, [
1499 cat > conftest.c <<EOF
1500 int main (void) { return 0; }
1502 if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -static -o conftest \
1503 conftest.c -v 2>&1 >/dev/null | grep -q " -lunwind "; then
1504 libc_cv_cc_with_libunwind=yes
1506 libc_cv_cc_with_libunwind=no
1509 AC_SUBST(libc_cv_cc_with_libunwind)
1510 if test $libc_cv_cc_with_libunwind = yes; then
1511 AC_DEFINE(HAVE_CC_WITH_LIBUNWIND)
1514 AC_CACHE_CHECK(for -z nodelete option,
1515 libc_cv_z_nodelete, [dnl
1516 cat > conftest.c <<EOF
1517 int _start (void) { return 42; }
1519 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1520 -fPIC -shared -o conftest.so conftest.c
1521 -nostartfiles -nostdlib
1522 -Wl,--enable-new-dtags,-z,nodelete 1>&AS_MESSAGE_LOG_FD])
1524 libc_cv_z_nodelete=yes
1526 AC_MSG_ERROR(linker with -z nodelete support required)
1530 AC_CACHE_CHECK(for -z nodlopen option,
1531 libc_cv_z_nodlopen, [dnl
1532 cat > conftest.c <<EOF
1533 int _start (void) { return 42; }
1535 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1536 -fPIC -shared -o conftest.so conftest.c
1537 -nostartfiles -nostdlib
1538 -Wl,--enable-new-dtags,-z,nodlopen 1>&AS_MESSAGE_LOG_FD])
1540 libc_cv_z_nodlopen=yes
1542 AC_MSG_ERROR(linker with -z nodlopen support required)
1546 AC_CACHE_CHECK(for -z initfirst option,
1547 libc_cv_z_initfirst, [dnl
1548 cat > conftest.c <<EOF
1549 int _start (void) { return 42; }
1551 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1552 -fPIC -shared -o conftest.so conftest.c
1553 -nostartfiles -nostdlib
1554 -Wl,--enable-new-dtags,-z,initfirst 1>&AS_MESSAGE_LOG_FD])
1556 libc_cv_z_initfirst=yes
1558 AC_MSG_ERROR(linker with -z initfirst support required)
1562 # Add-on fragments can set these for other machines.
1563 libc_commonpagesize=${libc_commonpagesize:-no}
1564 libc_relro_required=${libc_relro_required:-no}
1565 case "$base_machine" in
1566 i[[34567]]86 | x86_64 | powerpc* | s390*)
1567 libc_commonpagesize=0x1000
1568 libc_relro_required=yes
1571 libc_commonpagesize=0x2000
1572 libc_relro_required=yes
1575 libc_commonpagesize=0x4000
1578 libc_commonpagesize=0x10000
1579 libc_relro_required=yes
1583 if test $libc_commonpagesize != no; then
1584 AC_CACHE_CHECK(for -z relro option,
1585 libc_cv_z_relro, [dnl
1587 AC_LANG_CONFTEST([AC_LANG_SOURCE([[
1588 int _start (void) { return 42; }
1589 extern void _exit (int);
1590 /* Since these pointers are const, they should go in rodata.
1591 Since they refer to functions that have to be resolved by
1592 dynamic linking, they should instead go in RELRO data. */
1593 const void *const relro[] = { &_start, &_exit, 0 };
1594 /* GNU ld fails to produce RELRO data when it's very small and there is no
1595 normal writable data following it, or if only uninitialized (.bss) data
1596 follows it, or only very small writable data. */
1597 int data[0x10000] = { 1, };
1599 cat > conftest.awk <<\EOF
1602 commonpagesize = strtonum(commonpagesize)
1604 { print "LINE:", $0 > "/dev/stderr" }
1606 vaddr = strtonum($3)
1607 memsz = strtonum($6)
1609 printf "vaddr %#x memsz %#x end %#x commonpagesize %#x\n", \
1610 vaddr, memsz, end, commonpagesize > "/dev/stderr"
1611 result = (end % commonpagesize == 0) ? "yes" : "broken"
1613 END { print result }
1615 AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1616 -fPIC -shared -o conftest.so conftest.c
1617 -nostartfiles -nostdlib
1618 -Wl,-z,relro 1>&AS_MESSAGE_LOG_FD]) &&
1619 AC_TRY_COMMAND([$READELF -Wl conftest.so > conftest.ph]) &&
1621 $AWK -v commonpagesize=$libc_commonpagesize -f conftest.awk
1622 conftest.ph > conftest.cps
1624 libc_cv_z_relro=`cat conftest.cps 2>&AS_MESSAGE_LOG_FD`
1626 if { test "x$libc_relro_required" = xyes &&
1627 test "x$libc_cv_z_relro" != xyes
1630 AC_MSG_ERROR(linker with -z relro support required)
1633 AC_MSG_WARN([missing architecture parameter to check for working -z relro])
1636 AC_CACHE_CHECK(for -Bgroup option,
1637 libc_cv_Bgroup, [dnl
1638 cat > conftest.c <<EOF
1639 int _start (void) { return 42; }
1641 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1642 -fPIC -shared -o conftest.so conftest.c
1643 -Wl,-Bgroup -nostdlib 1>&AS_MESSAGE_LOG_FD])
1650 AC_SUBST(libc_cv_Bgroup)
1652 AC_CACHE_CHECK(for libgcc_s suffix,
1653 libc_cv_libgcc_s_suffix, [dnl
1654 cat > conftest.c <<EOF
1655 int main (void) { return 0; }
1658 libc_cv_libgcc_s_suffix=`${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
1659 -fPIC -shared -shared-libgcc -o conftest.so \
1660 conftest.c -v 2>&1 >/dev/null \
1661 | sed -n 's/^.* -lgcc_s\([^ ]*\) .*$/\1/p'`
1664 AC_SUBST(libc_cv_libgcc_s_suffix)
1666 AC_CACHE_CHECK(for --as-needed option,
1667 libc_cv_as_needed, [dnl
1668 cat > conftest.c <<EOF
1669 int main (void) { return 0; }
1671 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1672 -fPIC -shared -o conftest.so conftest.c
1673 -lgcc_s$libc_cv_libgcc_s_suffix -Wl,--as-needed
1674 -nostdlib 1>&AS_MESSAGE_LOG_FD])
1676 libc_cv_as_needed=yes
1678 libc_cv_as_needed=no
1681 AC_SUBST(libc_cv_as_needed)
1684 AC_CACHE_CHECK(whether --noexecstack is desirable for .S files,
1685 libc_cv_as_noexecstack, [dnl
1686 cat > conftest.c <<EOF
1689 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS
1690 -S -o conftest.s conftest.c 1>&AS_MESSAGE_LOG_FD]) \
1691 && grep -q .note.GNU-stack conftest.s \
1692 && AC_TRY_COMMAND([${CC-cc} $ASFLAGS -Wa,--noexecstack
1693 -c -o conftest.o conftest.s 1>&AS_MESSAGE_LOG_FD])
1695 libc_cv_as_noexecstack=yes
1697 libc_cv_as_noexecstack=no
1700 if test $libc_cv_as_noexecstack = yes; then
1701 ASFLAGS_config="$ASFLAGS_config -Wa,--noexecstack"
1703 AC_SUBST(ASFLAGS_config)
1705 AC_CACHE_CHECK(for -z combreloc,
1706 libc_cv_z_combreloc, [dnl
1707 cat > conftest.c <<EOF
1708 extern int bar (int);
1710 int foo (void) { return bar (mumble); }
1712 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1713 -fPIC -shared -o conftest.so conftest.c
1714 -nostdlib -nostartfiles
1715 -Wl,-z,combreloc 1>&AS_MESSAGE_LOG_FD])
1717 dnl The following test is a bit weak. We must use a tool which can test
1718 dnl cross-platform since the gcc used can be a cross compiler. Without
1719 dnl introducing new options this is not easily doable. Instead use a tool
1720 dnl which always is cross-platform: readelf. To detect whether -z combreloc
1721 dnl look for a section named .rel.dyn.
1722 if $READELF -S conftest.so | grep '\.rel\(a\|\)\.dyn' > /dev/null; then
1723 libc_cv_z_combreloc=yes
1725 libc_cv_z_combreloc=no
1728 libc_cv_z_combreloc=no
1731 if test "$libc_cv_z_combreloc" = yes; then
1732 AC_DEFINE(HAVE_Z_COMBRELOC)
1734 AC_SUBST(libc_cv_z_combreloc)
1736 AC_CACHE_CHECK(for -z execstack,
1737 libc_cv_z_execstack, [dnl
1738 cat > conftest.c <<EOF
1739 int _start (void) { return 42; }
1741 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1742 -fPIC -shared -o conftest.so conftest.c
1743 -Wl,-z,execstack -nostdlib
1744 1>&AS_MESSAGE_LOG_FD])
1746 libc_cv_z_execstack=yes
1748 libc_cv_z_execstack=no
1751 AC_SUBST(libc_cv_z_execstack)
1753 AC_CACHE_CHECK(for -fpie, libc_cv_fpie, [dnl
1754 cat > conftest.c <<EOF
1756 main () { return 0;}
1758 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -pie -fpie
1759 -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD])
1767 AC_SUBST(libc_cv_fpie)
1769 AC_CACHE_CHECK(for --hash-style option,
1770 libc_cv_hashstyle, [dnl
1771 cat > conftest.c <<EOF
1772 int _start (void) { return 42; }
1774 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1775 -fPIC -shared -o conftest.so conftest.c
1776 -Wl,--hash-style=both -nostdlib 1>&AS_MESSAGE_LOG_FD])
1778 libc_cv_hashstyle=yes
1780 libc_cv_hashstyle=no
1783 AC_SUBST(libc_cv_hashstyle)
1785 # The linker's default -shared behavior is good enough if it
1786 # does these things that our custom linker scripts ensure that
1787 # all allocated NOTE sections come first.
1788 if test "$use_default_link" = default; then
1789 AC_CACHE_CHECK([for sufficient default -shared layout],
1790 libc_cv_use_default_link, [dnl
1791 libc_cv_use_default_link=no
1792 cat > conftest.s <<\EOF
1793 .section .note.a,"a",%note
1798 .section .note.b,"a",%note
1804 if AC_TRY_COMMAND([dnl
1805 ${CC-cc} $ASFLAGS -shared -o conftest.so conftest.s 1>&AS_MESSAGE_LOG_FD]) &&
1806 ac_try=`$READELF -S conftest.so | sed -n \
1808 s/^ *\[ *[1-9][0-9]*\] *\([^ ][^ ]*\) *\([^ ][^ ]*\) .*$/\2 \1/
1814 libc_seen_a=no libc_seen_b=no
1816 while test $# -ge 2 -a "$1" = NOTE; do
1818 .note.a) libc_seen_a=yes ;;
1819 .note.b) libc_seen_b=yes ;;
1823 case "$libc_seen_a$libc_seen_b" in
1825 libc_cv_use_default_link=yes
1828 echo >&AS_MESSAGE_LOG_FD "\
1829 $libc_seen_a$libc_seen_b from:
1835 use_default_link=$libc_cv_use_default_link
1839 AC_CACHE_CHECK(linker output format, libc_cv_output_format, [dnl
1840 if libc_cv_output_format=`
1841 ${CC-cc} -nostartfiles -nostdlib -Wl,--print-output-format 2>&AS_MESSAGE_LOG_FD`
1845 libc_cv_output_format=
1847 test -n "$libc_cv_output_format" || libc_cv_output_format=unknown])
1848 AC_SUBST(libc_cv_output_format)
1850 AC_CACHE_CHECK(for -fno-toplevel-reorder -fno-section-anchors, libc_cv_fno_toplevel_reorder, [dnl
1851 cat > conftest.c <<EOF
1854 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -fno-toplevel-reorder -fno-section-anchors
1855 conftest.c 1>&AS_MESSAGE_LOG_FD])
1857 libc_cv_fno_toplevel_reorder=yes
1859 libc_cv_fno_toplevel_reorder=no
1862 if test $libc_cv_fno_toplevel_reorder = yes; then
1863 fno_unit_at_a_time="-fno-toplevel-reorder -fno-section-anchors"
1865 fno_unit_at_a_time=-fno-unit-at-a-time
1867 AC_SUBST(fno_unit_at_a_time)
1869 AC_CACHE_CHECK(for -fstack-protector, libc_cv_ssp, [dnl
1870 cat > conftest.c <<EOF
1872 main () { return 0;}
1874 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -Werror -fstack-protector
1875 -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD])
1882 AC_SUBST(libc_cv_ssp)
1884 AC_CACHE_CHECK(for -fgnu89-inline, libc_cv_gnu89_inline, [dnl
1885 cat > conftest.c <<EOF
1887 #ifdef __GNUC_GNU_INLINE__
1888 main () { return 0;}
1893 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -std=gnu99 -fgnu89-inline
1894 -o conftest.s conftest.c 1>&AS_MESSAGE_LOG_FD])
1896 libc_cv_gnu89_inline=yes
1898 libc_cv_gnu89_inline=no
1901 if test $libc_cv_gnu89_inline = yes; then
1902 gnu89_inline=-fgnu89-inline
1906 AC_SUBST(gnu89_inline)
1908 if test $elf != yes; then
1909 AC_CACHE_CHECK(for .init and .fini sections, libc_cv_have_initfini,
1910 [AC_TRY_COMPILE(, [asm (".section .init");
1911 asm (".section .fini");
1912 asm ("${libc_cv_dot_text}");],
1913 libc_cv_have_initfini=yes,
1914 libc_cv_have_initfini=no)])
1915 AC_SUBST(libc_cv_have_initfini)dnl
1916 if test $libc_cv_have_initfini = yes; then
1917 AC_DEFINE(HAVE_INITFINI)
1921 if test $elf = yes; then
1922 AC_CACHE_CHECK(whether cc puts quotes around section names,
1923 libc_cv_have_section_quotes,
1924 [cat > conftest.c <<EOF
1925 static const int foo
1926 __attribute__ ((section ("bar"))) = 1;
1928 if ${CC-cc} -S conftest.c -o conftest.s; then
1929 if grep '\.section.*"bar"' conftest.s >/dev/null; then
1930 libc_cv_have_section_quotes=yes
1932 libc_cv_have_section_quotes=no
1935 libc_cv_have_section_quotes=unknown
1937 rm -f conftest.{c,s}
1939 if test $libc_cv_have_section_quotes = yes; then
1940 AC_DEFINE(HAVE_SECTION_QUOTES)
1944 dnl AC_CHECK_ASM_UNDERSCORE([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
1945 AC_DEFUN(AC_CHECK_ASM_UNDERSCORE,
1946 [cat > conftest.$ac_ext <<EOF
1947 dnl This sometimes fails to find confdefs.h, for some reason.
1948 dnl [#]line $LINENO "[$]0"
1949 [#]line $LINENO "configure"
1950 #include "confdefs.h"
1951 void underscore_test(void) {
1954 if AC_TRY_EVAL(ac_compile); then
1955 if grep _underscore_test conftest* >/dev/null; then
1956 ifelse([$1], , :, [rm -f conftest*
1959 ifelse([$2], , , [rm -f conftest*
1963 echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD
1964 cat conftest.$ac_ext >&AS_MESSAGE_LOG_FD
1965 ifelse([$2], , , [rm -f conftest*
1970 if test $elf = yes; then
1971 libc_cv_asm_underscores=no
1973 if test $ac_cv_prog_cc_works = yes; then
1974 AC_CACHE_CHECK(for _ prefix on C symbol names, libc_cv_asm_underscores,
1975 [AC_TRY_LINK([asm ("_glibc_foobar:");], [glibc_foobar ();],
1976 libc_cv_asm_underscores=yes,
1977 libc_cv_asm_underscores=no)])
1979 AC_CACHE_CHECK(for _ prefix on C symbol names, libc_cv_asm_underscores,
1980 [AC_CHECK_ASM_UNDERSCORE(libc_cv_asm_underscores=yes,
1981 libc_cv_asm_underscores=no)])
1984 if test $libc_cv_asm_underscores = no; then
1985 AC_DEFINE(NO_UNDERSCORES)
1988 if test $elf = yes; then
1989 libc_cv_weak_symbols=yes
1992 AC_CACHE_CHECK(for assembler .weak directive, libc_cv_asm_weak_directive,
1994 cat > conftest.s <<EOF
1996 ${libc_cv_asm_global_directive} foo
1999 .weak bar; bar = foo
2001 if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
2002 libc_cv_asm_weak_directive=yes
2004 libc_cv_asm_weak_directive=no
2008 if test $libc_cv_asm_weak_directive = no; then
2009 AC_CACHE_CHECK(for assembler .weakext directive,
2010 libc_cv_asm_weakext_directive,
2012 cat > conftest.s <<EOF
2014 ${libc_cv_asm_global_directive} foo
2018 ${libc_cv_asm_global_directive} baz
2021 if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
2022 libc_cv_asm_weakext_directive=yes
2024 libc_cv_asm_weakext_directive=no
2030 if test $libc_cv_asm_weak_directive = yes; then
2031 AC_DEFINE(HAVE_ASM_WEAK_DIRECTIVE)
2032 elif test $libc_cv_asm_weakext_directive = yes; then
2033 AC_DEFINE(HAVE_ASM_WEAKEXT_DIRECTIVE)
2036 AC_CACHE_CHECK(whether CFI directives are supported, libc_cv_asm_cfi_directives, [dnl
2038 sparc/sparc64*) cfi_offset=2047;;
2041 cat > conftest.s <<EOF
2043 .type func,%function
2047 .cfi_rel_offset 1, $cfi_offset
2050 if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
2051 libc_cv_asm_cfi_directives=yes
2053 libc_cv_asm_cfi_directives=no
2056 if test $libc_cv_asm_cfi_directives = yes; then
2057 AC_DEFINE(HAVE_ASM_CFI_DIRECTIVES)
2060 AC_CACHE_CHECK(for ld --no-whole-archive, libc_cv_ld_no_whole_archive, [dnl
2061 cat > conftest.c <<\EOF
2066 dnl No \ in command here because it ends up inside ''.
2067 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
2068 -nostdlib -nostartfiles -Wl,--no-whole-archive
2069 -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD]); then
2070 libc_cv_ld_no_whole_archive=yes
2072 libc_cv_ld_no_whole_archive=no
2075 if test $libc_cv_ld_no_whole_archive = no; then
2076 AC_MSG_ERROR([support for --no-whole-archive is needed])
2079 AC_CACHE_CHECK(for gcc -fexceptions, libc_cv_gcc_exceptions, [dnl
2080 cat > conftest.c <<\EOF
2085 dnl No \ in command here because it ends up inside ''.
2086 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
2087 -nostdlib -nostartfiles -fexceptions
2088 -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD]); then
2089 libc_cv_gcc_exceptions=yes
2091 libc_cv_gcc_exceptions=no
2094 if test $libc_cv_gcc_exceptions = yes; then
2095 exceptions=-fexceptions
2097 AC_SUBST(exceptions)dnl
2099 if test "$host_cpu" = powerpc ; then
2100 # Check for a bug present in at least versions 2.8.x of GCC
2101 # and versions 1.0.x of EGCS.
2102 AC_CACHE_CHECK(whether clobbering cr0 causes problems,libc_cv_c_asmcr0_bug,[dnl
2103 AC_TRY_COMPILE([int tester(int x) { asm ("" : : : "cc"); return x & 123; }],,
2104 libc_cv_c_asmcr0_bug='no',
2105 libc_cv_c_asmcr0_bug='yes')])
2106 if test "$libc_cv_c_asmcr0_bug" != 'no'; then
2107 AC_DEFINE(BROKEN_PPC_ASM_CR0)
2111 dnl Check whether compiler understands __builtin_expect.
2112 AC_CACHE_CHECK(for __builtin_expect, libc_cv_gcc_builtin_expect,
2113 [cat > conftest.c <<EOF
2114 #line $LINENO "configure"
2117 a = __builtin_expect (a, 10);
2118 return a == 10 ? 0 : 1;
2121 dnl No \ in command here because it ends up inside ''.
2122 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -nostdlib -nostartfiles
2123 -o conftest conftest.c -lgcc >&AS_MESSAGE_LOG_FD]); then
2124 libc_cv_gcc_builtin_expect=yes
2126 libc_cv_gcc_builtin_expect=no
2129 if test "$libc_cv_gcc_builtin_expect" = no; then
2130 AC_MSG_ERROR([support for __builtin_expect needed])
2133 AC_CACHE_CHECK(for __builtin_memset, libc_cv_gcc_builtin_memset, [dnl
2134 cat > conftest.c <<\EOF
2137 __builtin_memset (x, 0, 1000);
2141 if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | fgrep "memset" > /dev/null]);
2143 libc_cv_gcc_builtin_memset=no
2145 libc_cv_gcc_builtin_memset=yes
2148 if test "$libc_cv_gcc_builtin_memset" = yes ; then
2149 AC_DEFINE(HAVE_BUILTIN_MEMSET)
2152 AC_CACHE_CHECK(for redirection of built-in functions, libc_cv_gcc_builtin_redirection, [dnl
2153 cat > conftest.c <<\EOF
2154 extern char *strstr (const char *, const char *) __asm ("my_strstr");
2155 char *foo (const char *a, const char *b)
2157 return __builtin_strstr (a, b);
2161 if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | fgrep "my_strstr" > /dev/null]);
2163 libc_cv_gcc_builtin_redirection=yes
2165 libc_cv_gcc_builtin_redirection=no
2168 if test "$libc_cv_gcc_builtin_redirection" = no; then
2169 AC_MSG_ERROR([support for the symbol redirection needed])
2172 dnl Check whether the compiler supports the __thread keyword.
2173 AC_CACHE_CHECK([for __thread], libc_cv_gcc___thread,
2174 [cat > conftest.c <<\EOF
2175 __thread int a = 42;
2177 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c >&AS_MESSAGE_LOG_FD]); then
2178 libc_cv_gcc___thread=yes
2180 libc_cv_gcc___thread=no
2183 if test "$libc_cv_gcc___thread" = no; then
2184 AC_MSG_ERROR([support for the __thread keyword is required])
2187 dnl Check whether the compiler supports the tls_model attribute.
2188 AC_CACHE_CHECK([for tls_model attribute], libc_cv_gcc_tls_model_attr, [dnl
2189 cat > conftest.c <<\EOF
2190 extern __thread int a __attribute__((tls_model ("initial-exec")));
2192 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -Werror conftest.c >&AS_MESSAGE_LOG_FD]); then
2193 libc_cv_gcc_tls_model_attr=yes
2195 libc_cv_gcc_tls_model_attr=no
2198 if test "$libc_cv_gcc_tls_model_attr" = no; then
2199 AC_MSG_ERROR([support for the tls_model attribute is required])
2202 if test -n "$submachine"; then
2203 AC_CACHE_CHECK([for compiler option for CPU variant],
2204 libc_cv_cc_submachine, [dnl
2205 libc_cv_cc_submachine=no
2206 for opt in "-march=$submachine" "-mcpu=$submachine"; do
2207 if AC_TRY_COMMAND([${CC-cc} $opt -xc /dev/null -S -o /dev/null]); then
2208 libc_cv_cc_submachine="$opt"
2212 if test "x$libc_cv_cc_submachine" = xno; then
2213 AC_MSG_ERROR([${CC-cc} does not support $submachine])
2216 AC_SUBST(libc_cv_cc_submachine)
2218 dnl Check whether we have the gd library available.
2219 AC_MSG_CHECKING(for libgd)
2220 if test "$with_gd" != "no"; then
2221 old_CFLAGS="$CFLAGS"
2222 CFLAGS="$CFLAGS $libgd_include"
2223 old_LDFLAGS="$LDFLAGS"
2224 LDFLAGS="$LDFLAGS $libgd_ldflags"
2226 LIBS="$LIBS -lgd -lpng -lz -lm"
2227 AC_TRY_LINK([#include <gd.h>], [gdImagePng (0, 0)], LIBGD=yes, LIBGD=no)
2228 CFLAGS="$old_CFLAGS"
2229 LDFLAGS="$old_LDFLAGS"
2234 AC_MSG_RESULT($LIBGD)
2238 if test x$with_selinux = xno ; then
2241 # See if we have the SELinux library
2242 AC_CHECK_LIB(selinux, is_selinux_enabled,
2243 have_selinux=yes, have_selinux=no)
2244 # See if we have the SELinux header with the NSCD permissions in it.
2245 if test x$have_selinux = xyes ; then
2246 AC_MSG_CHECKING([for NSCD Flask permissions in selinux/av_permissions.h])
2247 AC_TRY_COMPILE([#include <selinux/av_permissions.h>],
2248 [#ifdef NSCD__SHMEMHOST
2251 #error NSCD__SHMEMHOST not defined
2253 have_selinux=yes, have_selinux=no)
2254 AC_MSG_RESULT($have_selinux)
2257 if test x$with_selinux = xyes ; then
2258 if test x$have_selinux = xno ; then
2259 AC_MSG_ERROR([SELinux explicitly required, but sufficiently recent SELinux library not found])
2263 # Check if we're building with SELinux support.
2264 if test "x$have_selinux" = xyes; then
2265 AC_DEFINE(HAVE_SELINUX, 1, [SELinux support])
2267 # See if we have the libaudit library
2268 AC_CHECK_LIB(audit, audit_log_user_avc_message,
2269 have_libaudit=yes, have_libaudit=no)
2270 if test "x$have_libaudit" = xyes; then
2271 AC_DEFINE(HAVE_LIBAUDIT, 1, [SELinux libaudit support])
2273 AC_SUBST(have_libaudit)
2275 # See if we have the libcap library
2276 AC_CHECK_LIB(cap, cap_init, have_libcap=yes, have_libcap=no)
2277 if test "x$have_libcap" = xyes; then
2278 AC_DEFINE(HAVE_LIBCAP, 1, [SELinux libcap support])
2280 AC_SUBST(have_libcap)
2282 AC_SUBST(have_selinux)
2284 dnl check for the size of 'long double'.
2285 AC_CHECK_SIZEOF(long double, 0)
2286 sizeof_long_double=$ac_cv_sizeof_long_double
2287 AC_SUBST(sizeof_long_double)
2289 ### End of automated tests.
2290 ### Now run sysdeps configure fragments.
2292 # They also can set these variables.
2294 ldd_rewrite_script=no
2295 libc_cv_sysconfdir=$sysconfdir
2296 libc_cv_gcc_unwind_find_fde=no
2299 # Iterate over all the sysdep directories we will use, running their
2300 # configure fragments.
2301 for dir in $sysnames; do
2304 *) dest=$srcdir/$dir ;;
2306 if test -r $dest/configure; then
2307 AC_MSG_RESULT(running configure fragment for $dir)
2312 if test x$libc_cv_gcc_unwind_find_fde = xyes; then
2313 AC_DEFINE(EXPORT_UNWIND_FIND_FDE)
2315 AC_SUBST(libc_cv_gcc_unwind_find_fde)
2317 # Test for old glibc 2.0.x headers so that they can be removed properly
2318 # Search only in includedir.
2319 AC_MSG_CHECKING(for old glibc 2.0.x headers)
2320 if eval test -f "${includedir}/elfclass.h" -a -f "${includedir}/fcntlbits.h"
2322 old_glibc_headers=yes
2324 old_glibc_headers=no
2326 AC_MSG_RESULT($old_glibc_headers)
2327 if test ${old_glibc_headers} = yes; then
2328 AC_MSG_WARN(*** During \"make install\" old headers from glibc 2.0.x will)
2329 AC_MSG_WARN(*** be removed.)
2331 AC_SUBST(old_glibc_headers)
2333 AC_SUBST(libc_cv_slibdir)
2334 AC_SUBST(libc_cv_localedir)
2335 AC_SUBST(libc_cv_sysconfdir)
2336 AC_SUBST(libc_cv_rootsbindir)
2337 AC_SUBST(libc_cv_forced_unwind)
2339 dnl sysdeps/CPU/configure.in checks set this via arch-specific asm tests
2340 AC_SUBST(libc_cv_cpp_asm_debuginfo)
2341 AC_SUBST(libc_cv_cc_sse4)
2342 AC_SUBST(libc_cv_cc_avx)
2343 AC_SUBST(libc_cv_cc_novzeroupper)
2344 AC_SUBST(libc_cv_as_i686)
2346 AC_SUBST(use_ldconfig)
2347 AC_SUBST(ldd_rewrite_script)
2349 AC_SUBST(elf) AC_SUBST(xcoff)
2350 if test $elf = yes; then
2353 if test $xcoff = yes; then
2354 AC_DEFINE(HAVE_XCOFF)
2359 if test $shared = default; then
2363 AC_CACHE_CHECK([whether -fPIC is default], libc_cv_pic_default,
2364 [libc_cv_pic_default=yes
2365 cat > conftest.c <<EOF
2366 #if defined __PIC__ || defined __pic__ || defined PIC || defined pic
2367 # error PIC is default.
2370 if eval "${CC-cc} -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
2371 libc_cv_pic_default=no
2374 AC_SUBST(libc_cv_pic_default)
2379 AC_SUBST(static_nss)
2380 AC_SUBST(nopic_initfini)
2384 dnl See sysdeps/mach/configure.in for this variable.
2385 AC_SUBST(mach_interface_list)
2387 if test "`(cd $srcdir; pwd)`" = "`pwd`"; then
2390 config_makefile=Makefile
2393 VERSION=`sed -n -e 's/^#define VERSION "\([^"]*\)"/\1/p' < $srcdir/version.h`
2394 RELEASE=`sed -n -e 's/^#define RELEASE "\([^"]*\)"/\1/p' < $srcdir/version.h`
2398 AC_CONFIG_FILES([config.make ${config_makefile}])
2399 AC_CONFIG_COMMANDS([default],[[
2400 case $CONFIG_FILES in *config.make*)
2401 echo "$config_vars" >> config.make;;
2403 test -d bits || mkdir bits]],[[config_vars='$config_vars']])