1 dnl Process this file with autoconf to produce a configure script.
2 AC_PREREQ(2.53)dnl dnl Minimum Autoconf version required.
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 dnl This is here so we can set $subdirs directly based on configure fragments.
14 if test $host != $build; then
15 AC_CHECK_PROGS(BUILD_CC, gcc cc)
17 AC_SUBST(cross_compiling)
19 # We need the C++ compiler only for testing.
22 if test "`cd $srcdir; /bin/pwd`" = "`/bin/pwd`"; then
23 AC_MSG_ERROR([you must configure in a separate build directory])
26 # This will get text that should go into config.make.
29 # Check for a --with-gd argument and set libgd-LDFLAGS in config.make.
31 AC_HELP_STRING([--with-gd=DIR],
32 [find libgd include dir and library with prefix DIR]),
36 *) libgd_include="-I$withval/include"
37 libgd_ldflags="-L$withval/lib" ;;
40 AC_ARG_WITH([gd-include],
41 AC_HELP_STRING([--with-gd-include=DIR],
42 [find libgd include files in DIR]),
44 case "$with_gd_include" in
46 *) libgd_include="-I$withval" ;;
50 AC_HELP_STRING([--with-gd-lib=DIR],
51 [find libgd library files in DIR]),
53 case "$with_gd_lib" in
55 *) libgd_ldflags="-L$withval" ;;
59 if test -n "$libgd_include"; then
60 config_vars="$config_vars
61 CFLAGS-memusagestat.c = $libgd_include"
63 if test -n "$libgd_ldflags"; then
64 config_vars="$config_vars
65 libgd-LDFLAGS = $libgd_ldflags"
68 dnl Arguments to specify presence of other packages/features.
70 AC_HELP_STRING([--with-fp],
71 [if using floating-point hardware @<:@default=yes@:>@]),
75 AC_ARG_WITH([binutils],
76 AC_HELP_STRING([--with-binutils=PATH],
77 [specify location of binutils (as and ld)]),
78 [path_binutils=$withval],
81 AC_HELP_STRING([--with-elf],
82 [if using the ELF object format]),
85 AC_ARG_WITH([selinux],
86 AC_HELP_STRING([--with-selinux],
87 [if building with SELinux support]),
88 [with_selinux=$withval],
91 AC_HELP_STRING([--with-xcoff],
92 [if using the XCOFF object format]),
96 AC_ARG_WITH([headers],
97 AC_HELP_STRING([--with-headers=PATH],
98 [location of system headers to use
99 (for example /usr/src/linux/include)
100 @<:@default=compiler default@:>@]),
101 [sysheaders=$withval],
104 AC_SUBST(use_default_link)
105 AC_ARG_WITH([default-link],
106 AC_HELP_STRING([--with-default-link],
107 [do not use explicit linker scripts]),
108 [use_default_link=$withval],
109 [use_default_link=default])
111 AC_ARG_ENABLE([sanity-checks],
112 AC_HELP_STRING([--disable-sanity-checks],
113 [really do not use threads (should not be used except in special situations) @<:@default=yes@:>@]),
114 [enable_sanity=$enableval],
117 AC_SUBST(enable_check_abi)
118 AC_ARG_ENABLE([check-abi],
119 AC_HELP_STRING([--enable-check-abi],
120 [do "make check-abi" in "make check" (no/warn/yes)
121 @<:@default=no@:>@]),
122 [enable_check_abi=$enableval],
123 [enable_check_abi=no])
125 dnl Arguments to enable or disable building the static, shared, profiled,
126 dnl and -fomit-frame-pointer libraries.
127 dnl I've disabled this for now since we cannot build glibc without static
128 dnl libraries built in the moment.
129 dnl AC_ARG_ENABLE([static],
130 dnl AC_HELP_STRING([--enable-static],
131 dnl [build static library @<:@default=yes@:>@]),
132 dnl [static=$enableval],
135 AC_ARG_ENABLE([shared],
136 AC_HELP_STRING([--enable-shared],
137 [build shared library @<:@default=yes if GNU ld & ELF@:>@]),
140 AC_ARG_ENABLE([profile],
141 AC_HELP_STRING([--enable-profile],
142 [build profiled library @<:@default=no@:>@]),
143 [profile=$enableval],
145 AC_ARG_ENABLE([bounded],
146 AC_HELP_STRING([--enable-bounded],
147 [build with runtime bounds checking @<:@default=no@:>@]),
148 [bounded=$enableval],
150 AC_ARG_ENABLE([versioning],
151 AC_HELP_STRING([--disable-versioning],
152 [do not include versioning information in the library objects @<:@default=yes if supported@:>@]),
153 [enable_versioning=$enableval],
154 [enable_versioning=yes])
156 AC_ARG_ENABLE([oldest-abi],
157 AC_HELP_STRING([--enable-oldest-abi=ABI],
158 [configure the oldest ABI supported @<:@e.g. 2.2@:>@ @<:@default=glibc default@:>@]),
159 [oldest_abi=$enableval],
161 if test "$oldest_abi" = yes || test "$oldest_abi" = no; then
164 AC_DEFINE_UNQUOTED(GLIBC_OLDEST_ABI, "$oldest_abi")
168 AC_ARG_ENABLE([stackguard-randomization],
169 AC_HELP_STRING([--enable-stackguard-randomization],
170 [initialize __stack_chk_guard canary with a random number at program start]),
171 [enable_stackguard_randomize=$enableval],
172 [enable_stackguard_randomize=no])
173 if test "$enable_stackguard_randomize" = yes; then
174 AC_DEFINE(ENABLE_STACKGUARD_RANDOMIZE)
177 dnl Generic infrastructure for drop-in additions to libc.
178 AC_ARG_ENABLE([add-ons],
179 AC_HELP_STRING([--enable-add-ons@<:@=DIRS...@:>@],
180 [configure and build add-ons in DIR1,DIR2,...
181 search for add-ons if no parameter given]),
182 , [enable_add_ons=yes])
184 AC_ARG_ENABLE([hidden-plt],
185 AC_HELP_STRING([--disable-hidden-plt],
186 [do not hide internal function calls to avoid PLT]),
189 if test "x$hidden" = xno; then
193 AC_ARG_ENABLE([bind-now],
194 AC_HELP_STRING([--enable-bind-now],
195 [disable lazy relocations in DSOs]),
196 [bindnow=$enableval],
200 dnl On some platforms we cannot use dynamic loading. We must provide
201 dnl static NSS modules.
202 AC_ARG_ENABLE([static-nss],
203 AC_HELP_STRING([--enable-static-nss],
204 [build static NSS modules @<:@default=no@:>@]),
205 [static_nss=$enableval],
207 dnl Enable static NSS also if we build no shared objects.
208 if test x"$static_nss" = xyes || test x"$shared" = xno; then
210 AC_DEFINE(DO_STATIC_NSS)
213 AC_ARG_ENABLE([force-install],
214 AC_HELP_STRING([--disable-force-install],
215 [don't force installation of files from this package, even if they are older than the installed files]),
216 [force_install=$enableval],
218 AC_SUBST(force_install)
220 dnl On some platforms we allow dropping compatibility with all kernel
222 AC_ARG_ENABLE([kernel],
223 AC_HELP_STRING([--enable-kernel=VERSION],
224 [compile for compatibility with kernel not older than VERSION]),
225 [minimum_kernel=$enableval],
227 dnl Prevent unreasonable values.
228 if test "$minimum_kernel" = yes || test "$minimum_kernel" = no; then
229 # Better nothing than this.
232 if test "$minimum_kernel" = current; then
233 minimum_kernel=`uname -r 2>/dev/null` || minimum_kernel=
237 dnl For the development we sometimes want gcc to issue even more warnings.
238 dnl This is not the default since many of the extra warnings are not
240 AC_ARG_ENABLE([all-warnings],
241 AC_HELP_STRING([--enable-all-warnings],
242 [enable all useful warnings gcc can issue]),
243 [all_warnings=$enableval],
245 AC_SUBST(all_warnings)
247 AC_ARG_ENABLE([multi-arch],
248 AC_HELP_STRING([--enable-multi-arch],
249 [enable single DSO with optimizations for multiple architectures]),
250 [multi_arch=$enableval],
251 [multi_arch=default])
253 AC_ARG_ENABLE([nss-crypt],
254 AC_HELP_STRING([--enable-nss-crypt],
255 [enable libcrypt to use nss]),
256 [nss_crypt=$enableval],
258 if test x$nss_crypt = xyes; then
259 nss_includes=-I$(nss-config --includedir 2>/dev/null)
260 if test $? -ne 0; then
261 AC_MSG_ERROR([cannot find include directory with nss-config])
264 CFLAGS="$CFLAGS $nss_includes"
265 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([typedef int PRBool;
267 #include <nsslowhash.h>
268 void f (void) { NSSLOW_Init (); }])],
269 libc_cv_nss_crypt=yes,
271 cannot find NSS headers with lowlevel hash function interfaces]))
273 LIBS="$LIBS -lfreebl3"
274 AC_LINK_IFELSE([AC_LANG_PROGRAM([typedef int PRBool;
276 #include <nsslowhash.h>],
278 libc_cv_nss_crypt=yes,
280 cannot link program using lowlevel NSS hash functions]))
286 AC_SUBST(libc_cv_nss_crypt)
288 # The way shlib-versions is used to generate soversions.mk uses a
289 # fairly simplistic model for name recognition that can't distinguish
290 # i486-pc-linux-gnu fully from i486-pc-gnu. So we mutate a $host_os
291 # of `gnu*' here to be `gnu-gnu*' just so that shlib-versions can
292 # tell. This doesn't get used much beyond that, so it's fairly safe.
297 host_os=`echo $host_os | sed -e 's/gnu/gnu-gnu/'`
301 # We keep the original values in `$config_*' and never modify them, so we
302 # can write them unchanged into config.make. Everything else uses
303 # $machine, $vendor, and $os, and changes them whenever convenient.
304 config_machine=$host_cpu config_vendor=$host_vendor config_os=$host_os
306 # Don't allow vendor == "unknown"
307 test "$config_vendor" = unknown && config_vendor=
308 config_os="`echo $config_os | sed 's/^unknown-//'`"
310 # Some configurations imply other options.
312 # i586-linuxaout is mangled into i586-pc-linux-gnuaout
313 linux*ecoff* | linux*aout* | gnu*aout* | gnu*ecoff*)
315 gnu* | linux* | freebsd* | netbsd* | sysv4* | solaris2* | irix6*)
316 # These systems (almost) always use the ELF format.
320 # These systems are always xcoff
326 # The configure fragment of an add-on port can modify these to supplement
327 # or override the table in the case statement below. No fragment should
328 # ever change the config_* variables, however.
329 machine=$config_machine
330 vendor=$config_vendor
334 # config.guess on some IBM machines says `rs6000' instead of `powerpc'.
336 if test "$machine" = rs6000; then
340 # Braindead PowerPC box with absolutely no FPU.
341 case "$machine-$host_os" in
349 AS_HELP_STRING([--with-cpu=CPU], [select code for CPU variant]),
352 yes|'') AC_MSG_ERROR([--with-cpu requires an argument]) ;;
354 *) submachine="$withval" ;;
358 # An add-on can set this when it wants to disable the sanity check below.
361 dnl Having this here, though empty, makes sure that if add-ons' fragments
362 dnl do AC_CONFIG_SUBDIRS([some-dir]), which just sets $subdirs, then
363 dnl our AC_OUTPUT will actually use it.
366 case "$enable_add_ons" in
369 add_ons=`cd $srcdir && ls -d 2> /dev/null */configure */sysdeps |
370 sed 's@/[[^/]]*$@@' | sort | uniq`
371 add_ons_automatic=yes
373 *) add_ons=`echo "$enable_add_ons" | sed 's/,/ /g'`
374 add_ons_automatic=no ;;
380 if test x"$add_ons" != x; then
381 for f in $add_ons; do
386 *** It seems that you're using an old \`crypt' add-on. crypt is now
387 *** part of glibc and using the old add-on will not work with this
388 *** release. Start again with fresh sources and without the old
389 *** \`crypt' add-on.])
393 *** It seems that you're using an old \`localedata' add-on. localedata
394 *** is now part of glibc and using the old add-on will not work with
395 *** this release. Start again with fresh sources and without the old
396 *** \`localedata' add-on.])
401 # Now source each add-on's configure fragment.
402 # The fragments can use $srcdir/$libc_add_on to find themselves,
403 # and test $add_ons_automatic to see if they were explicitly requested.
404 # A fragment can clear (or even change) $libc_add_on to affect
405 # whether it goes into the list to be actually used in the build.
407 for libc_add_on in $add_ons; do
408 # Test whether such a directory really exists.
409 # It can be absolute, or relative to $srcdir, or relative to the build dir.
410 case "$libc_add_on" in
412 libc_add_on_srcdir=$libc_add_on
415 test -d "$srcdir/$libc_add_on" || {
416 if test -d "$libc_add_on"; then
417 libc_add_on="`pwd`/$libc_add_on"
419 AC_MSG_ERROR(add-on directory \"$libc_add_on\" does not exist)
422 libc_add_on_srcdir=$srcdir/$libc_add_on
426 libc_add_on_frag=$libc_add_on_srcdir/configure
427 libc_add_on_canonical=
428 libc_add_on_config_subdirs=
429 if test -r "$libc_add_on_frag"; then
430 AC_MSG_NOTICE(running configure fragment for add-on $libc_add_on)
431 libc_add_on_canonical=unknown
433 . "$libc_add_on_frag"
434 test -z "$libc_add_on" || {
435 configured_add_ons="$configured_add_ons $libc_add_on"
436 if test "x$libc_add_on_canonical" = xunknown; then
437 AC_MSG_ERROR(fragment must set \$libc_add_on_canonical)
439 for d in $libc_add_on_subdirs; do
440 case "$libc_add_on" in
441 /*) subdir_srcdir="$libc_add_on" ;;
442 *) subdir_srcdir="\$(..)$libc_add_on" ;;
446 d="${libc_add_on_canonical:-$libc_add_on}"
452 subdir_srcdir="$subdir_srcdir/$d"
455 d=`echo "$d" | sed 's@/*$@@;s@^.*/@@'`
456 add_on_subdirs="$add_on_subdirs $d"
457 test "$subdir_srcdir" = "\$(..)$d" || config_vars="$config_vars
458 $d-srcdir = $subdir_srcdir"
460 for d in $libc_add_on_config_subdirs; do
463 fragment uses absolute path in \$libc_add_on_config_subdirs) ;;
465 if test ! -d "$libc_add_on_srcdir/$d"; then
466 AC_MSG_ERROR(fragment wants to configure missing directory $d)
468 case "$libc_add_on" in
470 relative path required for add-on using \$libc_add_on_config_subdirs) ;;
472 subdirs="$subdirs $libc_add_on/$d"
476 if test -n "$libc_add_on"; then
477 if frags=`ls -d $libc_add_on_srcdir/sysdeps/*/preconfigure 2> /dev/null`
479 AC_MSG_CHECKING(add-on $libc_add_on for preconfigure fragments)
480 for frag in $frags; do
481 name=`echo "$frag" | sed 's@/[[^/]]*$@@;s@^.*/@@'`
482 echo $ECHO_N "$name $ECHO_C" >&AS_MESSAGE_FD
487 use_add_ons="$use_add_ons $libc_add_on"
488 add_ons_pfx="$add_ons_pfx $libc_add_on/"
489 test -z "$libc_add_on_canonical" ||
490 add_ons_sfx="$add_ons_sfx /$libc_add_on_canonical"
493 # Use echo to strip excess whitespace.
494 add_ons="`echo $use_add_ons`"
497 AC_SUBST(add_on_subdirs)
501 ### I put this here to prevent those annoying emails from people who cannot
502 ### read and try to compile glibc on unsupported platforms. --drepper
504 ### By using the undocumented --enable-hacker-mode option for configure
505 ### one can skip this test to make the configuration not fail for unsupported
508 if test -z "$enable_hacker_mode" && test x"$libc_config_ok" != xyes; then
509 case "$machine-$host_os" in
510 *-linux* | *-gnu* | arm*-none* | powerpc-aix4.3.*)
513 echo "*** The GNU C library is currently not available for this platform."
514 echo "*** So far nobody cared to port it and if there is no volunteer it"
515 echo "*** might never happen. So, if you have interest to see glibc on"
516 echo "*** this platform visit"
517 echo "*** http://www.gnu.org/software/libc/porting.html"
518 echo "*** and join the group of porters"
524 dnl We need to use [ and ] for other purposes for a while now.
526 # Expand the configuration machine name into a subdirectory by architecture
527 # type and particular chip. If an add-on configure fragment already set
528 # base_machine, we don't change it.
529 test -n "$base_machine" || case "$machine" in
530 i[34567]86) base_machine=i386 machine=i386/$machine ;;
531 ia64) base_machine=ia64 machine=ia64 ;;
532 powerpc) base_machine=powerpc machine=powerpc/powerpc32 ;;
533 powerpc64) base_machine=powerpc machine=powerpc/powerpc64 ;;
534 s390) base_machine=s390 machine=s390/s390-32 ;;
535 s390x) base_machine=s390 machine=s390/s390-64 ;;
536 sh3*) base_machine=sh machine=sh/sh3 ;;
537 sh4*) base_machine=sh machine=sh/sh4 ;;
539 base_machine=sparc machine=sparc/sparc32 ;;
540 sparcv8 | supersparc | hypersparc)
541 base_machine=sparc machine=sparc/sparc32/sparcv8 ;;
542 sparcv8plus | sparcv8plusa | sparcv9)
543 base_machine=sparc machine=sparc/sparc32/sparcv9 ;;
544 sparcv8plusb | sparcv9b)
545 base_machine=sparc machine=sparc/sparc32/sparcv9/sparcv9b ;;
547 base_machine=sparc machine=sparc/sparc32/sparcv9/sparcv9v ;;
549 base_machine=sparc machine=sparc/sparc32/sparcv9/sparcv9v2 ;;
551 base_machine=sparc machine=sparc/sparc64 ;;
553 base_machine=sparc machine=sparc/sparc64/sparcv9b ;;
555 base_machine=sparc machine=sparc/sparc64/sparcv9v ;;
557 base_machine=sparc machine=sparc/sparc64/sparcv9v2 ;;
558 *) base_machine=$machine ;;
561 AC_SUBST(base_machine)
563 if test "$base_machine" = "i386"; then
564 AC_DEFINE(USE_REGPARMS)
567 # For the multi-arch option we need support in the assembler.
568 AC_CACHE_CHECK([for assembler gnu_indirect_function symbol type support],
569 libc_cv_asm_gnu_indirect_function, [dnl
570 cat > conftest.s <<EOF
571 .type foo,%gnu_indirect_function
573 if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD;
575 libc_cv_asm_gnu_indirect_function=yes
577 libc_cv_asm_gnu_indirect_function=no
581 AC_MSG_CHECKING(whether .text pseudo-op must be used)
582 AC_CACHE_VAL(libc_cv_dot_text, [dnl
583 cat > conftest.s <<EOF
587 if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
588 libc_cv_dot_text=.text
591 if test -z "$libc_cv_dot_text"; then
597 AC_CACHE_CHECK(for assembler global-symbol directive,
598 libc_cv_asm_global_directive, [dnl
599 libc_cv_asm_global_directive=UNKNOWN
600 for ac_globl in .globl .global .EXPORT; do
601 cat > conftest.s <<EOF
606 if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
607 libc_cv_asm_global_directive=${ac_globl}
610 test $libc_cv_asm_global_directive != UNKNOWN && break
612 if test $libc_cv_asm_global_directive = UNKNOWN; then
613 AC_MSG_ERROR(cannot determine asm global directive)
615 AC_DEFINE_UNQUOTED(ASM_GLOBAL_DIRECTIVE, ${libc_cv_asm_global_directive})
618 AC_CACHE_CHECK(for assembler .type directive prefix,
619 libc_cv_asm_type_prefix, [dnl
620 libc_cv_asm_type_prefix=no
621 for ac_try_prefix in '@' '%' '#'; do
622 cat > conftest.s <<EOF
624 ${libc_cv_asm_global_directive} foo
625 .type foo, ${ac_try_prefix}object
630 if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
631 libc_cv_asm_type_prefix=${ac_try_prefix}
634 test "x$libc_cv_asm_type_prefix" != xno && break
636 if test "x$libc_cv_asm_type_prefix" != xno; then
637 AC_DEFINE_UNQUOTED(ASM_TYPE_DIRECTIVE_PREFIX, ${libc_cv_asm_type_prefix})
640 if test x"$libc_cv_asm_gnu_indirect_function" != xyes -a x"$libc_cv_asm_type_prefix" = xno; then
641 if test x"$multi_arch" = xyes; then
642 AC_MSG_ERROR([--enable-multi-arch support requires assembler and linker support])
647 if test x"$multi_arch" != xno; then
648 multi_arch_d=/multiarch
651 # Compute the list of sysdep directories for this configuration.
652 # This can take a while to compute.
653 sysdep_dir=$srcdir/sysdeps
654 AC_MSG_CHECKING(sysdep dirs)
655 dnl We need to use [ and ] for other purposes for a while now.
657 # Make sco3.2v4 become sco3.2.4 and sunos4.1.1_U1 become sunos4.1.1.U1.
658 os="`echo $os | sed 's/\([0-9A-Z]\)[v_]\([0-9A-Z]\)/\1.\2/g'`"
660 test "x$base_os" != x || case "$os" in
663 netbsd* | 386bsd* | freebsd* | bsdi*)
664 base_os=unix/bsd/bsd4.4 ;;
665 osf* | sunos* | ultrix* | newsos* | dynix* | *bsd*)
667 sysv* | isc* | esix* | sco* | minix* | irix4* | linux*)
670 base_os=unix/sysv/irix6/$os ;;
672 base_os=unix/sysv/sysv4 ;;
674 base_os=unix/sysv/hpux/$os ;;
676 base_os=unix/sysv/aix/aix4.3 ;;
678 base_os=standalone ;;
681 # For sunos4.1.1, try sunos4.1.1, then sunos4.1, then sunos4, then sunos.
684 while o=`echo $tail | sed 's/\.[^.]*$//'`; test $o != $tail; do
688 o=`echo $tail | sed 's/[0-9]*$//'`
689 if test $o != $tail; then
692 # For linux-gnu, try linux-gnu, then linux.
693 o=`echo $tail | sed 's/-.*$//'`
694 if test $o != $tail; then
698 # For unix/sysv/sysv4, try unix/sysv/sysv4, then unix/sysv, then unix.
701 while b=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$b"; do
707 # For sparc/sparc32, try sparc/sparc32 and then sparc.
709 tail=$machine${submachine:+/$submachine}
710 while m=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$m"; do
712 # Prepend the machine's FPU directory unless --without-fp.
713 if test "$with_fp" = yes; then
716 mach="$mach /$1/nofpu"
722 dnl We are done with glob and regexp uses of [ and ]; return to autoconf.
725 # Find what sysdep directories exist.
728 for b in $base ''; do
729 for m0 in $mach ''; do
730 for v in /$vendor ''; do
731 test "$v" = / && continue
732 for o in /$ostry ''; do
733 test "$o" = / && continue
734 for m in $multi_arch_d $mach ''; do
735 for d in $add_ons_pfx ''; do
736 for a in $add_ons_sfx ''; do
737 if test -n "$m0$m0sub$b$v$o$m$msub"; then
738 try_srcdir="${srcdir}/"
742 try="${d}sysdeps$m0$m0sub$b$v$o$m$msub$a"
743 test -n "$enable_debug_configure" &&
744 echo "$0 [DEBUG]: try $try" >&2
745 if test -d "$try_srcdir$try"; then
746 sysnames="$sysnames $try"
747 { test -n "$o" || test -n "$b"; } && os_used=t
748 { test -n "$m" || test -n "$m0"; } && machine_used=t
750 x*/$submachine) submachine_used=t ;;
752 if test -n "$d"; then
753 case "$sysnames_add_ons" in
755 *|'') sysnames_add_ons="$sysnames_add_ons $d" ;;
768 # If the assembler supports gnu_indirect_function symbol type and the
769 # architecture supports multi-arch, we enable multi-arch by default.
770 case $sysnames_add_ons$sysnames in
774 test x"$multi_arch" = xdefault && multi_arch=no
777 if test x"$multi_arch" != xno; then
778 AC_DEFINE(USE_MULTIARCH)
782 if test -z "$os_used" && test "$os" != none; then
783 AC_MSG_ERROR(Operating system $os is not supported.)
785 if test -z "$machine_used" && test "$machine" != none; then
786 AC_MSG_ERROR(The $machine is not supported.)
788 if test -z "$submachine_used" && test -n "$submachine"; then
789 AC_MSG_ERROR(The $submachine subspecies of $host_cpu is not supported.)
793 # We have now validated the configuration.
796 # If using ELF, look for an `elf' subdirectory of each machine directory.
797 # We prepend these rather than inserting them whereever the machine appears
798 # because things specified by the machine's ELF ABI should override
799 # OS-specific things, and should always be the same for any OS on the
800 # machine (otherwise what's the point of an ABI?).
801 if test "$elf" = yes; then
803 for d in $add_ons_pfx ''; do
805 if test -d $srcdir/${d}sysdeps$m/elf; then
806 elf_dirs="$elf_dirs ${d}sysdeps$m/elf"
810 sysnames="`echo $elf_dirs | sed -e 's,//,/,g'` $sysnames"
814 # Expand the list of system names into a full list of directories
815 # from each element's parent name and Implies file (if present).
818 while test $# -gt 0; do
822 case " $names " in *" $name "*)
823 # Already in the list.
827 # Report each name as we discover it, so there is no long pause in output.
828 echo $ECHO_N "$name $ECHO_C" >&AS_MESSAGE_FD
830 name_base=`echo $name | sed -e 's@\(.*sysdeps\)/.*@\1@'`
834 *) xsrcdir=$srcdir/ ;;
836 test -n "$enable_debug_configure" &&
837 echo "[DEBUG]: name/Implies $xsrcdir$name/Implies" >&2
839 if test -f $xsrcdir$name/Implies; then
840 # Collect more names from the `Implies' file (removing comments).
841 implied_candidate="`sed 's/#.*$//' < $xsrcdir$name/Implies`"
843 for x in $implied_candidate; do
845 if test -d $xsrcdir$name_base/$x; then
846 implied="$implied $name_base/$x";
849 for d in $add_ons_pfx ''; do
853 *) try_srcdir=$srcdir/ ;;
855 test -n "$enable_debug_configure" &&
856 echo "[DEBUG]: $name implied $x try($d) {$try_srcdir}$try" >&2
857 if test $try != $xsrcdir$name_base/$x && test -d $try_srcdir$try;
859 implied="$implied $try"
861 case "$sysnames_add_ons" in
863 *|'') sysnames_add_ons="$sysnames_add_ons $d" ;;
867 if test $found = no; then
868 AC_MSG_WARN($name/Implies specifies nonexistent $x)
875 # Add NAME to the list of names.
878 # Find the parent of NAME, using the empty string if it has none.
880 parent="`echo $name | sed -n -e 's=/[^/]*$==' -e '/sysdeps$/q' -e p`"
883 # Add the names implied by NAME, and NAME's parent (if it has one), to
884 # the list of names to be processed (the argument list). We prepend the
885 # implied names to the list and append the parent. We want implied
886 # directories to come before further directories inferred from the
887 # configuration components; this ensures that for sysv4, unix/common
888 # (implied by unix/sysv/sysv4) comes before unix/sysv (in ostry (here $*)
890 sysnames="`echo $implied $* $parent`"
891 test -n "$sysnames" && set $sysnames
894 # Add the default directories.
895 default_sysnames=sysdeps/generic
896 if test "$elf" = yes; then
897 default_sysnames="sysdeps/generic/elf $default_sysnames"
899 sysnames="$names $default_sysnames"
901 # The other names were emitted during the scan.
902 AC_MSG_RESULT($default_sysnames)
904 # Collect the list of add-ons that supply partial sysdeps trees.
906 for add_on in $add_ons; do
909 *) xsrcdir="$srcdir/" ;;
912 test -d "$xsrcdir$add_on/sysdeps" || {
913 case "$configured_add_ons " in
916 AC_MSG_ERROR(add-on $add_on has no configure fragment or sysdeps tree)
922 sysdeps_add_ons="$sysdeps_add_ons $add_on"
923 case "$sysnames_add_ons" in
926 AC_MSG_WARN(add-on $add_on contributed no sysdeps directories)
931 for d in $sysnames; do
933 $add_on/sysdeps/*) ;;
936 (cd "$xsrcdir$d" && for f in *[[!~]]; do
940 test -d "$ff" || { test -e "$ff" && exit 88; }
944 test -d "$f" || { test -e "$f" && exit 88; }
948 if test $? -eq 88; then
953 if test $found = no; then
954 AC_MSG_WARN(add-on $add_on contributed no useful sysdeps directories)
957 AC_SUBST(sysdeps_add_ons)
963 if test "$INSTALL" = "${srcdir}/scripts/install-sh -c"; then
964 # The makefiles need to use a different form to find it in $srcdir.
965 INSTALL='\$(..)./scripts/install-sh -c'
970 AC_SUBST(MIG)dnl Needed by sysdeps/mach/configure.in
972 # Accept binutils 2.13 or newer.
973 AC_CHECK_PROG_VER(AS, $AS, --version,
974 [GNU assembler.* \([0-9]*\.[0-9.]*\)],
975 [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")
976 AC_CHECK_PROG_VER(LD, $LD, --version,
977 [GNU ld.* \([0-9][0-9]*\.[0-9.]*\)],
978 [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")
980 # We need the physical current working directory. We cannot use the
981 # "pwd -P" shell builtin since that's not portable. Instead we try to
982 # find a pwd binary. Note that assigning to the PWD environment
983 # variable might have some interesting side effects, so we don't do
985 AC_PATH_PROG(PWD_P, pwd, no)
986 if test "$PWD_P" = no; then
987 AC_MSG_ERROR(*** A pwd binary could not be found.)
990 # These programs are version sensitive.
992 AC_CHECK_PROG_VER(CC, ${ac_tool_prefix}gcc ${ac_tool_prefix}cc, -v,
993 [version \([egcygnustpi-]*[0-9.]*\)], [3.4* | 4.[0-9]* ],
994 critic_missing="$critic_missing gcc")
995 AC_CHECK_PROG_VER(MAKE, gnumake gmake make, --version,
996 [GNU Make[^0-9]*\([0-9][0-9.]*\)],
997 [3.79* | 3.[89]*], critic_missing="$critic_missing make")
999 AC_CHECK_PROG_VER(MSGFMT, gnumsgfmt gmsgfmt msgfmt, --version,
1000 [GNU gettext.* \([0-9]*\.[0-9.]*\)],
1001 [0.10.3[6-9]* | 0.10.[4-9][0-9]* | 0.1[1-9]* | 0.[2-9][0-9]* | [1-9].*],
1002 MSGFMT=: aux_missing="$aux_missing msgfmt")
1003 AC_CHECK_PROG_VER(MAKEINFO, makeinfo, --version,
1004 [GNU texinfo.* \([0-9][0-9.]*\)],
1006 MAKEINFO=: aux_missing="$aux_missing makeinfo")
1007 AC_CHECK_PROG_VER(SED, sed, --version,
1008 [GNU sed version \([0-9]*\.[0-9.]*\)],
1009 [3.0[2-9]*|3.[1-9]*|[4-9]*],
1010 SED=: aux_missing="$aux_missing sed")
1012 AC_CHECK_TOOL(READELF, readelf, false)
1014 AC_CHECK_PROGS(AUTOCONF, autoconf, no)
1015 case "x$AUTOCONF" in
1016 xno|x|x:) AUTOCONF=no ;;
1019 whether $AUTOCONF${ACFLAGS:+ }$ACFLAGS works, libc_cv_autoconf_works, [dnl
1020 if (cd $srcdir; $AUTOCONF $ACFLAGS configure.in > /dev/null 2>&1); then
1021 libc_cv_autoconf_works=yes
1023 libc_cv_autoconf_works=no
1025 test $libc_cv_autoconf_works = yes || AUTOCONF=no
1028 if test "x$AUTOCONF" = xno; then
1029 aux_missing="$aux_missing autoconf"
1032 test -n "$critic_missing" && AC_MSG_ERROR([
1033 *** These critical programs are missing or too old:$critic_missing
1034 *** Check the INSTALL file for required versions.])
1036 test -n "$aux_missing" && AC_MSG_WARN([
1037 *** These auxiliary programs are missing or incompatible versions:$aux_missing
1038 *** some features will be disabled.
1039 *** Check the INSTALL file for required versions.])
1041 # if using special system headers, find out the compiler's sekrit
1042 # header directory and add that to the list. NOTE: Only does the right
1043 # thing on a system that doesn't need fixincludes. (Not presently a problem.)
1044 if test -n "$sysheaders"; then
1045 SYSINCLUDES=-nostdinc
1046 for d in include include-fixed; do
1047 i=`$CC -print-file-name="$d"` && test "x$i" != x && test "x$i" != "x$d" &&
1048 SYSINCLUDES="$SYSINCLUDES -isystem $i"
1050 SYSINCLUDES="$SYSINCLUDES \
1051 -isystem `echo $sysheaders | sed 's/:/ -isystem /g'`"
1052 if test -n "$CXX"; then
1054 cxxversion=`$CXX -dumpversion 2>&AS_MESSAGE_LOG_FD` &&
1055 cxxmachine=`$CXX -dumpmachine 2>&AS_MESSAGE_LOG_FD` &&
1056 for d in include "$cxxmachine/include"; do
1057 i=../../../../$d/c++/$cxxversion
1058 cxxheaders=`$CXX -print-file-name="$i"` &&
1059 test "x$cxxheaders" != x && test "x$i" != "x$cxxheaders" &&
1060 CXX_SYSINCLUDES="$CXX_SYSINCLUDES -isystem $cxxheaders \
1061 -isystem $cxxheaders/$cxxmachine -isystem $cxxheaders/backward"
1065 AC_SUBST(SYSINCLUDES)
1066 AC_SUBST(CXX_SYSINCLUDES)
1068 # ranlib is never necessary on Linux and Hurd systems
1071 # Test if LD_LIBRARY_PATH contains the notation for the current directory
1072 # since this would lead to problems installing/building glibc.
1073 # LD_LIBRARY_PATH contains the current directory if one of the following
1075 # - one of the terminals (":" and ";") is the first or last sign
1076 # - two terminals occur directly after each other
1077 # - the path contains an element with a dot in it
1078 AC_MSG_CHECKING(LD_LIBRARY_PATH variable)
1080 case ${LD_LIBRARY_PATH} in
1081 [:\;]* | *[:\;] | *[:\;][:\;]* | *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* )
1082 ld_library_path_setting="contains current directory"
1085 ld_library_path_setting="ok"
1089 AC_MSG_RESULT($ld_library_path_setting)
1090 if test "$ld_library_path_setting" != "ok"; then
1092 *** LD_LIBRARY_PATH shouldn't contain the current directory when
1093 *** building glibc. Please change the environment variable
1094 *** and run configure again.])
1097 AC_CACHE_CHECK(whether GCC supports -static-libgcc, libc_cv_gcc_static_libgcc, [dnl
1098 if $CC -v -static-libgcc 2>&1 | grep -q 'unrecognized option.*static-libgcc'; then
1099 libc_cv_gcc_static_libgcc=
1101 libc_cv_gcc_static_libgcc=-static-libgcc
1103 AC_SUBST(libc_cv_gcc_static_libgcc)
1105 AC_PATH_PROG(BASH_SHELL, bash, no)
1106 if test "$BASH_SHELL" != no &&
1107 $BASH_SHELL -c 'test "$BASH_VERSINFO" \
1108 && test "$BASH_VERSINFO" -ge 2 >&/dev/null'; then
1109 libc_cv_have_bash2=yes
1111 libc_cv_have_bash2=no
1113 AC_SUBST(libc_cv_have_bash2)
1115 dnl We need a ksh compatible shell for tzselect.
1116 if test "$BASH_SHELL" = no; then
1117 AC_PATH_PROG(KSH, ksh, no)
1118 if test "$KSH" = no; then
1121 libc_cv_have_ksh=yes
1126 libc_cv_have_ksh=yes
1128 AC_SUBST(libc_cv_have_ksh)
1131 AC_PATH_PROG(PERL, perl, no)
1132 if test "$PERL" != no &&
1133 (eval `$PERL -V:apiversion`; test `expr "$apiversion" \< 5` -ne 0); then
1136 AC_PATH_PROG(INSTALL_INFO, install-info, no,
1137 $PATH:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin)
1138 AC_PATH_PROG(BISON, bison, no, $PATH:/usr/local/bin:/usr/bin:/bin)
1140 AC_CACHE_CHECK(for signed size_t type, libc_cv_signed_size_t, [dnl
1141 echo '#include <stddef.h>
1142 FOOBAR __SIZE_TYPE__ FOOBAR' > conftest.c
1143 if eval "$ac_cpp conftest.c 2>/dev/null" \
1144 | grep '^FOOBAR.*unsigned.*FOOBAR$' >/dev/null; then
1145 libc_cv_signed_size_t=no
1147 libc_cv_signed_size_t=yes
1150 if test $libc_cv_signed_size_t = yes; then
1151 dnl Do this by hand instead of AC_DEFINE so can add #undef to avoid warnings.
1152 cat >> confdefs.h <<\EOF
1153 #undef __SIZE_TYPE__
1154 #define __SIZE_TYPE__ unsigned
1158 AC_CACHE_CHECK(for libc-friendly stddef.h, libc_cv_friendly_stddef, [dnl
1160 [#define __need_size_t
1161 #define __need_wchar_t
1164 #include <stddef.h>], [size_t size; wchar_t wchar;
1166 #error stddef.h ignored __need_*
1168 if (&size == NULL || &wchar == NULL) abort ();],
1169 libc_cv_friendly_stddef=yes,
1170 libc_cv_friendly_stddef=no)])
1171 if test $libc_cv_friendly_stddef = yes; then
1172 config_vars="$config_vars
1173 override stddef.h = # The installed <stddef.h> seems to be libc-friendly."
1176 AC_CACHE_CHECK(whether we need to use -P to assemble .S files,
1177 libc_cv_need_minus_P, [dnl
1178 cat > conftest.S <<EOF
1179 #include "confdefs.h"
1180 /* Nothing whatsoever. */
1182 if AC_TRY_COMMAND(${CC-cc} $CPPFLAGS $ASFLAGS -c conftest.S 1>&AS_MESSAGE_LOG_FD); then
1183 libc_cv_need_minus_P=no
1185 libc_cv_need_minus_P=yes
1188 if test $libc_cv_need_minus_P = yes; then
1189 config_vars="$config_vars
1190 asm-CPPFLAGS = -P # The assembler can't grok cpp's # line directives."
1193 AC_CACHE_CHECK(for .set assembler directive, libc_cv_asm_set_directive, [dnl
1194 cat > conftest.s <<EOF
1197 .set glibc_conftest_frobozz,foo
1198 $libc_cv_asm_global_directive glibc_conftest_frobozz
1200 # The alpha-dec-osf1 assembler gives only a warning for `.set'
1201 # (but it doesn't work), so we must do a linking check to be sure.
1202 cat > conftest1.c <<\EOF
1203 extern int glibc_conftest_frobozz;
1204 void _start() { glibc_conftest_frobozz = 1; }
1206 if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
1207 -nostartfiles -nostdlib \
1208 -o conftest conftest.s conftest1.c 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
1209 libc_cv_asm_set_directive=yes
1211 libc_cv_asm_set_directive=no
1214 if test $libc_cv_asm_set_directive = yes; then
1215 AC_DEFINE(HAVE_ASM_SET_DIRECTIVE)
1218 AC_CACHE_CHECK(for assembler gnu_unique_object symbol type,
1219 libc_cv_asm_unique_object, [dnl
1220 cat > conftest.s <<EOF
1223 .type _sym, ${libc_cv_asm_type_prefix}gnu_unique_object
1225 if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
1226 libc_cv_asm_unique_object=yes
1228 libc_cv_asm_unique_object=no
1231 if test $libc_cv_asm_unique_object = yes; then
1232 AC_DEFINE(HAVE_ASM_UNIQUE_OBJECT)
1235 AC_CACHE_CHECK(for .symver assembler directive, libc_cv_asm_symver_directive,
1236 [cat > conftest.s <<EOF
1239 .symver _sym,sym@VERS
1241 if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
1242 libc_cv_asm_symver_directive=yes
1244 libc_cv_asm_symver_directive=no
1247 AC_CACHE_CHECK(for ld --version-script, libc_cv_ld_version_script_option, [dnl
1248 if test $libc_cv_asm_symver_directive = yes; then
1249 cat > conftest.s <<EOF
1252 .symver _sym,sym@VERS
1254 cat > conftest.map <<EOF
1263 if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
1264 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $LDFLAGS -shared
1265 -o conftest.so conftest.o
1266 -nostartfiles -nostdlib
1267 -Wl,--version-script,conftest.map
1268 1>&AS_MESSAGE_LOG_FD]);
1270 libc_cv_ld_version_script_option=yes
1272 libc_cv_ld_version_script_option=no
1275 libc_cv_ld_version_script_option=no
1278 libc_cv_ld_version_script_option=no
1281 if test $shared != no &&
1282 test $libc_cv_asm_symver_directive = yes &&
1283 test $libc_cv_ld_version_script_option = yes &&
1284 test $enable_versioning = yes; then
1286 AC_DEFINE(DO_VERSIONING)
1290 AC_SUBST(VERSIONING)
1292 if test $elf = yes && test $shared != no && test $VERSIONING = no; then
1294 *** WARNING: You should not compile GNU libc without versioning. Not using
1295 *** versioning will introduce incompatibilities so that old binaries
1296 *** will not run anymore.
1297 *** For versioning you need recent binutils (binutils-2.8.1.0.23 or newer)."
1299 if test $elf = yes; then
1300 AC_CACHE_CHECK(for .previous assembler directive,
1301 libc_cv_asm_previous_directive, [dnl
1302 cat > conftest.s <<EOF
1303 .section foo_section
1306 if AC_TRY_COMMAND(${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
1307 libc_cv_asm_previous_directive=yes
1309 libc_cv_asm_previous_directive=no
1312 if test $libc_cv_asm_previous_directive = yes; then
1313 AC_DEFINE(HAVE_ASM_PREVIOUS_DIRECTIVE)
1315 AC_CACHE_CHECK(for .popsection assembler directive,
1316 libc_cv_asm_popsection_directive, [dnl
1317 cat > conftest.s <<EOF
1318 .pushsection foo_section
1321 if AC_TRY_COMMAND(${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
1322 libc_cv_asm_popsection_directive=yes
1324 libc_cv_asm_popsection_directive=no
1327 if test $libc_cv_asm_popsection_directive = yes; then
1328 AC_DEFINE(HAVE_ASM_POPSECTION_DIRECTIVE)
1331 AC_CACHE_CHECK(for .protected and .hidden assembler directive,
1332 libc_cv_asm_protected_directive, [dnl
1333 cat > conftest.s <<EOF
1339 if AC_TRY_COMMAND(${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
1340 libc_cv_asm_protected_directive=yes
1342 AC_MSG_ERROR(assembler support for symbol visibility is required)
1346 if test $libc_cv_asm_protected_directive = yes; then
1347 AC_CACHE_CHECK(whether __attribute__((visibility())) is supported,
1348 libc_cv_visibility_attribute,
1349 [cat > conftest.c <<EOF
1350 int foo __attribute__ ((visibility ("hidden"))) = 1;
1351 int bar __attribute__ ((visibility ("protected"))) = 1;
1353 libc_cv_visibility_attribute=no
1354 if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
1355 if grep '\.hidden.*foo' conftest.s >/dev/null; then
1356 if grep '\.protected.*bar' conftest.s >/dev/null; then
1357 libc_cv_visibility_attribute=yes
1361 rm -f conftest.{c,s}
1363 if test $libc_cv_visibility_attribute != yes; then
1364 AC_MSG_ERROR(compiler support for visibility attribute is required)
1368 if test $libc_cv_visibility_attribute = yes; then
1369 AC_CACHE_CHECK(for broken __attribute__((visibility())),
1370 libc_cv_broken_visibility_attribute,
1371 [cat > conftest.c <<EOF
1373 int bar (int x) __asm__ ("foo") __attribute__ ((visibility ("hidden")));
1374 int bar (int x) { return x; }
1376 libc_cv_broken_visibility_attribute=yes
1377 if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
1379 if grep '\.hidden[ _]foo' conftest.s >/dev/null; then
1381 libc_cv_broken_visibility_attribute=no
1384 rm -f conftest.c conftest.s
1386 if test $libc_cv_broken_visibility_attribute = yes; then
1387 AC_MSG_ERROR(working compiler support for visibility attribute is required)
1391 AC_CACHE_CHECK(for broken __attribute__((alias())),
1392 libc_cv_broken_alias_attribute,
1393 [cat > conftest.c <<EOF
1394 extern int foo (int x) __asm ("xyzzy");
1395 int bar (int x) { return x; }
1396 extern __typeof (bar) foo __attribute ((weak, alias ("bar")));
1398 extern __typeof (dfoo) dfoo __asm ("abccb");
1401 libc_cv_broken_alias_attribute=yes
1402 if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
1403 if grep 'xyzzy' conftest.s >/dev/null &&
1404 grep 'abccb' conftest.s >/dev/null; then
1405 libc_cv_broken_alias_attribute=no
1408 rm -f conftest.c conftest.s
1410 if test $libc_cv_broken_alias_attribute = yes; then
1411 AC_MSG_ERROR(working alias attribute support required)
1414 if test $libc_cv_visibility_attribute = yes; then
1415 AC_CACHE_CHECK(whether to put _rtld_local into .sdata section,
1416 libc_cv_have_sdata_section,
1417 [echo "int i;" > conftest.c
1418 libc_cv_have_sdata_section=no
1419 if ${CC-cc} $LDFLAGS -fPIC -shared -Wl,--verbose conftest.c -o conftest.so 2>&1 \
1420 | grep '\.sdata' >/dev/null; then
1421 libc_cv_have_sdata_section=yes
1423 rm -f conftest.c conftest.so
1425 if test $libc_cv_have_sdata_section = yes; then
1426 AC_DEFINE(HAVE_SDATA_SECTION)
1430 AC_CACHE_CHECK(for .preinit_array/.init_array/.fini_array support,
1431 libc_cv_initfini_array, [dnl
1432 cat > conftest.c <<EOF
1433 int _start (void) { return 0; }
1434 int __start (void) { return 0; }
1435 int foo (void) { return 1; }
1436 int (*fp) (void) __attribute__ ((section (".init_array"))) = foo;
1438 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -o conftest conftest.c
1439 -static -nostartfiles -nostdlib 1>&AS_MESSAGE_LOG_FD])
1441 if $READELF -S conftest | fgrep INIT_ARRAY > /dev/null; then
1442 libc_cv_initfini_array=yes
1444 libc_cv_initfini_array=no
1447 libc_cv_initfini_array=no
1450 if test $libc_cv_initfini_array != yes; then
1451 AC_MSG_ERROR([Need linker with .init_array/.fini_array support.])
1454 AC_CACHE_CHECK(whether to use .ctors/.dtors header and trailer,
1455 libc_cv_ctors_header, [dnl
1456 libc_cv_ctors_header=yes
1458 __attribute__ ((constructor)) void ctor (void) { puts("ctor"); }
1459 __attribute__ ((destructor)) void dtor (void) { puts("dtor"); }
1462 AS_IF([$READELF -WS conftest$ac_exeext | $AWK '
1463 { gsub(/\@<:@ */, "@<:@") }
1464 $2 == ".ctors" || $2 == ".dtors" {
1465 size = strtonum("0x" $6)
1466 align = strtonum("0x" $NF)
1468 stub@<:@$2@:>@ = size == align * 2
1471 ctors_ok = !seen@<:@".ctors"@:>@ || stub@<:@".ctors"@:>@
1472 dtors_ok = !seen@<:@".dtors"@:>@ || stub@<:@".dtors"@:>@
1473 exit ((ctors_ok && dtors_ok) ? 0 : 1)
1475 '], [libc_cv_ctors_header=no])
1477 AC_MSG_ERROR([missing __attribute__ ((constructor)) support??])
1480 if test $libc_cv_ctors_header = no; then
1481 AC_DEFINE(NO_CTORS_DTORS_SECTIONS)
1484 AC_CACHE_CHECK(for libunwind-support in compiler,
1485 libc_cv_cc_with_libunwind, [
1486 cat > conftest.c <<EOF
1487 int main (void) { return 0; }
1489 if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -static -o conftest \
1490 conftest.c -v 2>&1 >/dev/null | grep -q " -lunwind "; then
1491 libc_cv_cc_with_libunwind=yes
1493 libc_cv_cc_with_libunwind=no
1496 AC_SUBST(libc_cv_cc_with_libunwind)
1497 if test $libc_cv_cc_with_libunwind = yes; then
1498 AC_DEFINE(HAVE_CC_WITH_LIBUNWIND)
1501 AC_CACHE_CHECK(for -z nodelete option,
1502 libc_cv_z_nodelete, [dnl
1503 cat > conftest.c <<EOF
1504 int _start (void) { return 42; }
1506 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1507 -fPIC -shared -o conftest.so conftest.c
1508 -nostartfiles -nostdlib
1509 -Wl,--enable-new-dtags,-z,nodelete 1>&AS_MESSAGE_LOG_FD])
1511 libc_cv_z_nodelete=yes
1513 AC_MSG_ERROR(linker with -z nodelete support required)
1517 AC_CACHE_CHECK(for -z nodlopen option,
1518 libc_cv_z_nodlopen, [dnl
1519 cat > conftest.c <<EOF
1520 int _start (void) { return 42; }
1522 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1523 -fPIC -shared -o conftest.so conftest.c
1524 -nostartfiles -nostdlib
1525 -Wl,--enable-new-dtags,-z,nodlopen 1>&AS_MESSAGE_LOG_FD])
1527 libc_cv_z_nodlopen=yes
1529 AC_MSG_ERROR(linker with -z nodlopen support required)
1533 AC_CACHE_CHECK(for -z initfirst option,
1534 libc_cv_z_initfirst, [dnl
1535 cat > conftest.c <<EOF
1536 int _start (void) { return 42; }
1538 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1539 -fPIC -shared -o conftest.so conftest.c
1540 -nostartfiles -nostdlib
1541 -Wl,--enable-new-dtags,-z,initfirst 1>&AS_MESSAGE_LOG_FD])
1543 libc_cv_z_initfirst=yes
1545 AC_MSG_ERROR(linker with -z initfirst support required)
1549 # Add-on fragments can set these for other machines.
1550 libc_commonpagesize=${libc_commonpagesize:-no}
1551 libc_relro_required=${libc_relro_required:-no}
1552 case "$base_machine" in
1553 i[[34567]]86 | x86_64 | powerpc* | s390*)
1554 libc_commonpagesize=0x1000
1555 libc_relro_required=yes
1558 libc_commonpagesize=0x2000
1559 libc_relro_required=yes
1562 libc_commonpagesize=0x4000
1565 libc_commonpagesize=0x10000
1566 libc_relro_required=yes
1570 if test $libc_commonpagesize != no; then
1571 AC_CACHE_CHECK(for -z relro option,
1572 libc_cv_z_relro, [dnl
1574 AC_LANG_CONFTEST([AC_LANG_SOURCE([[
1575 int _start (void) { return 42; }
1576 extern void _exit (int);
1577 /* Since these pointers are const, they should go in rodata.
1578 Since they refer to functions that have to be resolved by
1579 dynamic linking, they should instead go in RELRO data. */
1580 const void *const relro[] = { &_start, &_exit, 0 };
1581 /* GNU ld fails to produce RELRO data when it's very small and there is no
1582 normal writable data following it, or if only uninitialized (.bss) data
1583 follows it, or only very small writable data. */
1584 int data[0x10000] = { 1, };
1586 cat > conftest.awk <<\EOF
1589 commonpagesize = strtonum(commonpagesize)
1591 { print "LINE:", $0 > "/dev/stderr" }
1593 vaddr = strtonum($3)
1594 memsz = strtonum($6)
1596 printf "vaddr %#x memsz %#x end %#x commonpagesize %#x\n", \
1597 vaddr, memsz, end, commonpagesize > "/dev/stderr"
1598 result = (end % commonpagesize == 0) ? "yes" : "broken"
1600 END { print result }
1602 AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1603 -fPIC -shared -o conftest.so conftest.c
1604 -nostartfiles -nostdlib
1605 -Wl,-z,relro 1>&AS_MESSAGE_LOG_FD]) &&
1606 AC_TRY_COMMAND([$READELF -Wl conftest.so > conftest.ph]) &&
1608 $AWK -v commonpagesize=$libc_commonpagesize -f conftest.awk
1609 conftest.ph > conftest.cps
1611 libc_cv_z_relro=`cat conftest.cps 2>&AS_MESSAGE_LOG_FD`
1613 if { test "x$libc_relro_required" = xyes &&
1614 test "x$libc_cv_z_relro" != xyes
1617 AC_MSG_ERROR(linker with -z relro support required)
1620 AC_MSG_WARN([missing architecture parameter to check for working -z relro])
1623 AC_CACHE_CHECK(for -Bgroup option,
1624 libc_cv_Bgroup, [dnl
1625 cat > conftest.c <<EOF
1626 int _start (void) { return 42; }
1628 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1629 -fPIC -shared -o conftest.so conftest.c
1630 -Wl,-Bgroup -nostdlib 1>&AS_MESSAGE_LOG_FD])
1637 AC_SUBST(libc_cv_Bgroup)
1639 AC_CACHE_CHECK(for libgcc_s suffix,
1640 libc_cv_libgcc_s_suffix, [dnl
1641 cat > conftest.c <<EOF
1642 int main (void) { return 0; }
1645 libc_cv_libgcc_s_suffix=`${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
1646 -fPIC -shared -shared-libgcc -o conftest.so \
1647 conftest.c -v 2>&1 >/dev/null \
1648 | sed -n 's/^.* -lgcc_s\([^ ]*\) .*$/\1/p'`
1651 AC_SUBST(libc_cv_libgcc_s_suffix)
1653 AC_CACHE_CHECK(for --as-needed option,
1654 libc_cv_as_needed, [dnl
1655 cat > conftest.c <<EOF
1656 int main (void) { return 0; }
1658 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1659 -fPIC -shared -o conftest.so conftest.c
1660 -lgcc_s$libc_cv_libgcc_s_suffix -Wl,--as-needed
1661 -nostdlib 1>&AS_MESSAGE_LOG_FD])
1663 libc_cv_as_needed=yes
1665 libc_cv_as_needed=no
1668 AC_SUBST(libc_cv_as_needed)
1671 AC_CACHE_CHECK(whether --noexecstack is desirable for .S files,
1672 libc_cv_as_noexecstack, [dnl
1673 cat > conftest.c <<EOF
1676 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS
1677 -S -o conftest.s conftest.c 1>&AS_MESSAGE_LOG_FD]) \
1678 && grep -q .note.GNU-stack conftest.s \
1679 && AC_TRY_COMMAND([${CC-cc} $ASFLAGS -Wa,--noexecstack
1680 -c -o conftest.o conftest.s 1>&AS_MESSAGE_LOG_FD])
1682 libc_cv_as_noexecstack=yes
1684 libc_cv_as_noexecstack=no
1687 if test $libc_cv_as_noexecstack = yes; then
1688 ASFLAGS_config="$ASFLAGS_config -Wa,--noexecstack"
1690 AC_SUBST(ASFLAGS_config)
1692 AC_CACHE_CHECK(for -z combreloc,
1693 libc_cv_z_combreloc, [dnl
1694 cat > conftest.c <<EOF
1695 extern int bar (int);
1697 int foo (void) { return bar (mumble); }
1699 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1700 -fPIC -shared -o conftest.so conftest.c
1701 -nostdlib -nostartfiles
1702 -Wl,-z,combreloc 1>&AS_MESSAGE_LOG_FD])
1704 dnl The following test is a bit weak. We must use a tool which can test
1705 dnl cross-platform since the gcc used can be a cross compiler. Without
1706 dnl introducing new options this is not easily doable. Instead use a tool
1707 dnl which always is cross-platform: readelf. To detect whether -z combreloc
1708 dnl look for a section named .rel.dyn.
1709 if $READELF -S conftest.so | grep '\.rel\(a\|\)\.dyn' > /dev/null; then
1710 libc_cv_z_combreloc=yes
1712 libc_cv_z_combreloc=no
1715 libc_cv_z_combreloc=no
1718 if test "$libc_cv_z_combreloc" = yes; then
1719 AC_DEFINE(HAVE_Z_COMBRELOC)
1721 AC_SUBST(libc_cv_z_combreloc)
1723 AC_CACHE_CHECK(for -z execstack,
1724 libc_cv_z_execstack, [dnl
1725 cat > conftest.c <<EOF
1726 int _start (void) { return 42; }
1728 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1729 -fPIC -shared -o conftest.so conftest.c
1730 -Wl,-z,execstack -nostdlib
1731 1>&AS_MESSAGE_LOG_FD])
1733 libc_cv_z_execstack=yes
1735 libc_cv_z_execstack=no
1738 AC_SUBST(libc_cv_z_execstack)
1740 AC_CACHE_CHECK(for -fpie, libc_cv_fpie, [dnl
1741 cat > conftest.c <<EOF
1743 main () { return 0;}
1745 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -pie -fpie
1746 -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD])
1754 AC_SUBST(libc_cv_fpie)
1756 AC_CACHE_CHECK(for --hash-style option,
1757 libc_cv_hashstyle, [dnl
1758 cat > conftest.c <<EOF
1759 int _start (void) { return 42; }
1761 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1762 -fPIC -shared -o conftest.so conftest.c
1763 -Wl,--hash-style=both -nostdlib 1>&AS_MESSAGE_LOG_FD])
1765 libc_cv_hashstyle=yes
1767 libc_cv_hashstyle=no
1770 AC_SUBST(libc_cv_hashstyle)
1772 # The linker's default -shared behavior is good enough if it
1773 # does these things that our custom linker scripts ensure that
1774 # all allocated NOTE sections come first.
1775 if test "$use_default_link" = default; then
1776 AC_CACHE_CHECK([for sufficient default -shared layout],
1777 libc_cv_use_default_link, [dnl
1778 libc_cv_use_default_link=no
1779 cat > conftest.s <<\EOF
1780 .section .note.a,"a",%note
1785 .section .note.b,"a",%note
1791 if AC_TRY_COMMAND([dnl
1792 ${CC-cc} $ASFLAGS -shared -o conftest.so conftest.s 1>&AS_MESSAGE_LOG_FD]) &&
1793 ac_try=`$READELF -S conftest.so | sed -n \
1795 s/^ *\[ *[1-9][0-9]*\] *\([^ ][^ ]*\) *\([^ ][^ ]*\) .*$/\2 \1/
1801 libc_seen_a=no libc_seen_b=no
1803 while test $# -ge 2 -a "$1" = NOTE; do
1805 .note.a) libc_seen_a=yes ;;
1806 .note.b) libc_seen_b=yes ;;
1810 case "$libc_seen_a$libc_seen_b" in
1812 libc_cv_use_default_link=yes
1815 echo >&AS_MESSAGE_LOG_FD "\
1816 $libc_seen_a$libc_seen_b from:
1822 use_default_link=$libc_cv_use_default_link
1826 AC_CACHE_CHECK(linker output format, libc_cv_output_format, [dnl
1827 if libc_cv_output_format=`
1828 ${CC-cc} -nostartfiles -nostdlib -Wl,--print-output-format 2>&AS_MESSAGE_LOG_FD`
1832 libc_cv_output_format=
1834 test -n "$libc_cv_output_format" || libc_cv_output_format=unknown])
1835 AC_SUBST(libc_cv_output_format)
1837 AC_CACHE_CHECK(for -fno-toplevel-reorder -fno-section-anchors, libc_cv_fno_toplevel_reorder, [dnl
1838 cat > conftest.c <<EOF
1841 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -fno-toplevel-reorder -fno-section-anchors
1842 conftest.c 1>&AS_MESSAGE_LOG_FD])
1844 libc_cv_fno_toplevel_reorder=yes
1846 libc_cv_fno_toplevel_reorder=no
1849 if test $libc_cv_fno_toplevel_reorder = yes; then
1850 fno_unit_at_a_time="-fno-toplevel-reorder -fno-section-anchors"
1852 fno_unit_at_a_time=-fno-unit-at-a-time
1854 AC_SUBST(fno_unit_at_a_time)
1856 AC_CACHE_CHECK(for -fstack-protector, libc_cv_ssp, [dnl
1857 cat > conftest.c <<EOF
1859 main () { return 0;}
1861 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -Werror -fstack-protector
1862 -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD])
1869 AC_SUBST(libc_cv_ssp)
1871 AC_CACHE_CHECK(for -fgnu89-inline, libc_cv_gnu89_inline, [dnl
1872 cat > conftest.c <<EOF
1874 #ifdef __GNUC_GNU_INLINE__
1875 main () { return 0;}
1880 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -std=gnu99 -fgnu89-inline
1881 -o conftest.s conftest.c 1>&AS_MESSAGE_LOG_FD])
1883 libc_cv_gnu89_inline=yes
1885 libc_cv_gnu89_inline=no
1888 if test $libc_cv_gnu89_inline = yes; then
1889 gnu89_inline=-fgnu89-inline
1893 AC_SUBST(gnu89_inline)
1895 if test $elf != yes; then
1896 AC_CACHE_CHECK(for .init and .fini sections, libc_cv_have_initfini,
1897 [AC_TRY_COMPILE(, [asm (".section .init");
1898 asm (".section .fini");
1899 asm ("${libc_cv_dot_text}");],
1900 libc_cv_have_initfini=yes,
1901 libc_cv_have_initfini=no)])
1902 AC_SUBST(libc_cv_have_initfini)dnl
1903 if test $libc_cv_have_initfini = yes; then
1904 AC_DEFINE(HAVE_INITFINI)
1908 if test $elf = yes; then
1909 AC_CACHE_CHECK(whether cc puts quotes around section names,
1910 libc_cv_have_section_quotes,
1911 [cat > conftest.c <<EOF
1912 static const int foo
1913 __attribute__ ((section ("bar"))) = 1;
1915 if ${CC-cc} -S conftest.c -o conftest.s; then
1916 if grep '\.section.*"bar"' conftest.s >/dev/null; then
1917 libc_cv_have_section_quotes=yes
1919 libc_cv_have_section_quotes=no
1922 libc_cv_have_section_quotes=unknown
1924 rm -f conftest.{c,s}
1926 if test $libc_cv_have_section_quotes = yes; then
1927 AC_DEFINE(HAVE_SECTION_QUOTES)
1931 dnl AC_CHECK_ASM_UNDERSCORE([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
1932 AC_DEFUN(AC_CHECK_ASM_UNDERSCORE,
1933 [cat > conftest.$ac_ext <<EOF
1934 dnl This sometimes fails to find confdefs.h, for some reason.
1935 dnl [#]line $LINENO "[$]0"
1936 [#]line $LINENO "configure"
1937 #include "confdefs.h"
1938 void underscore_test(void) {
1941 if AC_TRY_EVAL(ac_compile); then
1942 if grep _underscore_test conftest* >/dev/null; then
1943 ifelse([$1], , :, [rm -f conftest*
1946 ifelse([$2], , , [rm -f conftest*
1950 echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD
1951 cat conftest.$ac_ext >&AS_MESSAGE_LOG_FD
1952 ifelse([$2], , , [rm -f conftest*
1957 if test $elf = yes; then
1958 libc_cv_asm_underscores=no
1960 if test $ac_cv_prog_cc_works = yes; then
1961 AC_CACHE_CHECK(for _ prefix on C symbol names, libc_cv_asm_underscores,
1962 [AC_TRY_LINK([asm ("_glibc_foobar:");], [glibc_foobar ();],
1963 libc_cv_asm_underscores=yes,
1964 libc_cv_asm_underscores=no)])
1966 AC_CACHE_CHECK(for _ prefix on C symbol names, libc_cv_asm_underscores,
1967 [AC_CHECK_ASM_UNDERSCORE(libc_cv_asm_underscores=yes,
1968 libc_cv_asm_underscores=no)])
1971 if test $libc_cv_asm_underscores = no; then
1972 AC_DEFINE(NO_UNDERSCORES)
1975 if test $elf = yes; then
1976 libc_cv_weak_symbols=yes
1979 AC_CACHE_CHECK(for assembler .weak directive, libc_cv_asm_weak_directive,
1981 cat > conftest.s <<EOF
1983 ${libc_cv_asm_global_directive} foo
1986 .weak bar; bar = foo
1988 if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
1989 libc_cv_asm_weak_directive=yes
1991 libc_cv_asm_weak_directive=no
1995 if test $libc_cv_asm_weak_directive = no; then
1996 AC_CACHE_CHECK(for assembler .weakext directive,
1997 libc_cv_asm_weakext_directive,
1999 cat > conftest.s <<EOF
2001 ${libc_cv_asm_global_directive} foo
2005 ${libc_cv_asm_global_directive} baz
2008 if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
2009 libc_cv_asm_weakext_directive=yes
2011 libc_cv_asm_weakext_directive=no
2017 if test $libc_cv_asm_weak_directive = yes; then
2018 AC_DEFINE(HAVE_ASM_WEAK_DIRECTIVE)
2019 elif test $libc_cv_asm_weakext_directive = yes; then
2020 AC_DEFINE(HAVE_ASM_WEAKEXT_DIRECTIVE)
2023 AC_CACHE_CHECK(whether CFI directives are supported, libc_cv_asm_cfi_directives, [dnl
2025 sparc/sparc64*) cfi_offset=2047;;
2028 cat > conftest.s <<EOF
2030 .type func,%function
2034 .cfi_rel_offset 1, $cfi_offset
2037 if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
2038 libc_cv_asm_cfi_directives=yes
2040 libc_cv_asm_cfi_directives=no
2043 if test $libc_cv_asm_cfi_directives = yes; then
2044 AC_DEFINE(HAVE_ASM_CFI_DIRECTIVES)
2047 AC_CACHE_CHECK(for ld --no-whole-archive, libc_cv_ld_no_whole_archive, [dnl
2048 cat > conftest.c <<\EOF
2053 dnl No \ in command here because it ends up inside ''.
2054 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
2055 -nostdlib -nostartfiles -Wl,--no-whole-archive
2056 -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD]); then
2057 libc_cv_ld_no_whole_archive=yes
2059 libc_cv_ld_no_whole_archive=no
2062 if test $libc_cv_ld_no_whole_archive = no; then
2063 AC_MSG_ERROR([support for --no-whole-archive is needed])
2066 AC_CACHE_CHECK(for gcc -fexceptions, libc_cv_gcc_exceptions, [dnl
2067 cat > conftest.c <<\EOF
2072 dnl No \ in command here because it ends up inside ''.
2073 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
2074 -nostdlib -nostartfiles -fexceptions
2075 -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD]); then
2076 libc_cv_gcc_exceptions=yes
2078 libc_cv_gcc_exceptions=no
2081 if test $libc_cv_gcc_exceptions = yes; then
2082 exceptions=-fexceptions
2084 AC_SUBST(exceptions)dnl
2086 if test "$host_cpu" = powerpc ; then
2087 # Check for a bug present in at least versions 2.8.x of GCC
2088 # and versions 1.0.x of EGCS.
2089 AC_CACHE_CHECK(whether clobbering cr0 causes problems,libc_cv_c_asmcr0_bug,[dnl
2090 AC_TRY_COMPILE([int tester(int x) { asm ("" : : : "cc"); return x & 123; }],,
2091 libc_cv_c_asmcr0_bug='no',
2092 libc_cv_c_asmcr0_bug='yes')])
2093 if test "$libc_cv_c_asmcr0_bug" != 'no'; then
2094 AC_DEFINE(BROKEN_PPC_ASM_CR0)
2098 dnl Check whether compiler understands __builtin_expect.
2099 AC_CACHE_CHECK(for __builtin_expect, libc_cv_gcc_builtin_expect,
2100 [cat > conftest.c <<EOF
2101 #line $LINENO "configure"
2104 a = __builtin_expect (a, 10);
2105 return a == 10 ? 0 : 1;
2108 dnl No \ in command here because it ends up inside ''.
2109 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -nostdlib -nostartfiles
2110 -o conftest conftest.c -lgcc >&AS_MESSAGE_LOG_FD]); then
2111 libc_cv_gcc_builtin_expect=yes
2113 libc_cv_gcc_builtin_expect=no
2116 if test "$libc_cv_gcc_builtin_expect" = no; then
2117 AC_MSG_ERROR([support for __builtin_expect needed])
2120 AC_CACHE_CHECK(for __builtin_memset, libc_cv_gcc_builtin_memset, [dnl
2121 cat > conftest.c <<\EOF
2124 __builtin_memset (x, 0, 1000);
2128 if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | fgrep "memset" > /dev/null]);
2130 libc_cv_gcc_builtin_memset=no
2132 libc_cv_gcc_builtin_memset=yes
2135 if test "$libc_cv_gcc_builtin_memset" = yes ; then
2136 AC_DEFINE(HAVE_BUILTIN_MEMSET)
2139 AC_CACHE_CHECK(for redirection of built-in functions, libc_cv_gcc_builtin_redirection, [dnl
2140 cat > conftest.c <<\EOF
2141 extern char *strstr (const char *, const char *) __asm ("my_strstr");
2142 char *foo (const char *a, const char *b)
2144 return __builtin_strstr (a, b);
2148 if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | fgrep "my_strstr" > /dev/null]);
2150 libc_cv_gcc_builtin_redirection=yes
2152 libc_cv_gcc_builtin_redirection=no
2155 if test "$libc_cv_gcc_builtin_redirection" = no; then
2156 AC_MSG_ERROR([support for the symbol redirection needed])
2159 dnl Check whether the compiler supports the __thread keyword.
2160 AC_CACHE_CHECK([for __thread], libc_cv_gcc___thread,
2161 [cat > conftest.c <<\EOF
2162 __thread int a = 42;
2164 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c >&AS_MESSAGE_LOG_FD]); then
2165 libc_cv_gcc___thread=yes
2167 libc_cv_gcc___thread=no
2170 if test "$libc_cv_gcc___thread" = no; then
2171 AC_MSG_ERROR([support for the __thread keyword is required])
2174 dnl Check whether the compiler supports the tls_model attribute.
2175 AC_CACHE_CHECK([for tls_model attribute], libc_cv_gcc_tls_model_attr, [dnl
2176 cat > conftest.c <<\EOF
2177 extern __thread int a __attribute__((tls_model ("initial-exec")));
2179 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -Werror conftest.c >&AS_MESSAGE_LOG_FD]); then
2180 libc_cv_gcc_tls_model_attr=yes
2182 libc_cv_gcc_tls_model_attr=no
2185 if test "$libc_cv_gcc_tls_model_attr" = no; then
2186 AC_MSG_ERROR([support for the tls_model attribute is required])
2189 if test -n "$submachine"; then
2190 AC_CACHE_CHECK([for compiler option for CPU variant],
2191 libc_cv_cc_submachine, [dnl
2192 libc_cv_cc_submachine=no
2193 for opt in "-march=$submachine" "-mcpu=$submachine"; do
2194 if AC_TRY_COMMAND([${CC-cc} $opt -xc /dev/null -S -o /dev/null]); then
2195 libc_cv_cc_submachine="$opt"
2199 if test "x$libc_cv_cc_submachine" = xno; then
2200 AC_MSG_ERROR([${CC-cc} does not support $submachine])
2203 AC_SUBST(libc_cv_cc_submachine)
2205 dnl Check whether we have the gd library available.
2206 AC_MSG_CHECKING(for libgd)
2207 if test "$with_gd" != "no"; then
2208 old_CFLAGS="$CFLAGS"
2209 CFLAGS="$CFLAGS $libgd_include"
2210 old_LDFLAGS="$LDFLAGS"
2211 LDFLAGS="$LDFLAGS $libgd_ldflags"
2213 LIBS="$LIBS -lgd -lpng -lz -lm"
2214 AC_TRY_LINK([#include <gd.h>], [gdImagePng (0, 0)], LIBGD=yes, LIBGD=no)
2215 CFLAGS="$old_CFLAGS"
2216 LDFLAGS="$old_LDFLAGS"
2221 AC_MSG_RESULT($LIBGD)
2225 if test x$with_selinux = xno ; then
2228 # See if we have the SELinux library
2229 AC_CHECK_LIB(selinux, is_selinux_enabled,
2230 have_selinux=yes, have_selinux=no)
2231 # See if we have the SELinux header with the NSCD permissions in it.
2232 if test x$have_selinux = xyes ; then
2233 AC_MSG_CHECKING([for NSCD Flask permissions in selinux/av_permissions.h])
2234 AC_TRY_COMPILE([#include <selinux/av_permissions.h>],
2235 [#ifdef NSCD__SHMEMHOST
2238 #error NSCD__SHMEMHOST not defined
2240 have_selinux=yes, have_selinux=no)
2241 AC_MSG_RESULT($have_selinux)
2244 if test x$with_selinux = xyes ; then
2245 if test x$have_selinux = xno ; then
2246 AC_MSG_ERROR([SELinux explicitly required, but sufficiently recent SELinux library not found])
2250 # Check if we're building with SELinux support.
2251 if test "x$have_selinux" = xyes; then
2252 AC_DEFINE(HAVE_SELINUX, 1, [SELinux support])
2254 # See if we have the libaudit library
2255 AC_CHECK_LIB(audit, audit_log_user_avc_message,
2256 have_libaudit=yes, have_libaudit=no)
2257 if test "x$have_libaudit" = xyes; then
2258 AC_DEFINE(HAVE_LIBAUDIT, 1, [SELinux libaudit support])
2260 AC_SUBST(have_libaudit)
2262 # See if we have the libcap library
2263 AC_CHECK_LIB(cap, cap_init, have_libcap=yes, have_libcap=no)
2264 if test "x$have_libcap" = xyes; then
2265 AC_DEFINE(HAVE_LIBCAP, 1, [SELinux libcap support])
2267 AC_SUBST(have_libcap)
2269 AC_SUBST(have_selinux)
2271 dnl check for the size of 'long double'.
2272 AC_CHECK_SIZEOF(long double, 0)
2273 sizeof_long_double=$ac_cv_sizeof_long_double
2274 AC_SUBST(sizeof_long_double)
2276 ### End of automated tests.
2277 ### Now run sysdeps configure fragments.
2279 # They also can set these variables.
2281 ldd_rewrite_script=no
2282 libc_cv_sysconfdir=$sysconfdir
2283 libc_cv_gcc_unwind_find_fde=no
2286 # Iterate over all the sysdep directories we will use, running their
2287 # configure fragments.
2288 for dir in $sysnames; do
2291 *) dest=$srcdir/$dir ;;
2293 if test -r $dest/configure; then
2294 AC_MSG_RESULT(running configure fragment for $dir)
2299 if test x$libc_cv_gcc_unwind_find_fde = xyes; then
2300 AC_DEFINE(EXPORT_UNWIND_FIND_FDE)
2302 AC_SUBST(libc_cv_gcc_unwind_find_fde)
2304 # Test for old glibc 2.0.x headers so that they can be removed properly
2305 # Search only in includedir.
2306 AC_MSG_CHECKING(for old glibc 2.0.x headers)
2307 if eval test -f "${includedir}/elfclass.h" -a -f "${includedir}/fcntlbits.h"
2309 old_glibc_headers=yes
2311 old_glibc_headers=no
2313 AC_MSG_RESULT($old_glibc_headers)
2314 if test ${old_glibc_headers} = yes; then
2315 AC_MSG_WARN(*** During \"make install\" old headers from glibc 2.0.x will)
2316 AC_MSG_WARN(*** be removed.)
2318 AC_SUBST(old_glibc_headers)
2320 AC_SUBST(libc_cv_slibdir)
2321 AC_SUBST(libc_cv_localedir)
2322 AC_SUBST(libc_cv_sysconfdir)
2323 AC_SUBST(libc_cv_rootsbindir)
2324 AC_SUBST(libc_cv_forced_unwind)
2326 dnl sysdeps/CPU/configure.in checks set this via arch-specific asm tests
2327 AC_SUBST(libc_cv_cpp_asm_debuginfo)
2328 AC_SUBST(libc_cv_cc_sse4)
2329 AC_SUBST(libc_cv_cc_avx)
2330 AC_SUBST(libc_cv_cc_novzeroupper)
2331 AC_SUBST(libc_cv_cc_fma4)
2332 AC_SUBST(libc_cv_as_i686)
2334 AC_SUBST(use_ldconfig)
2335 AC_SUBST(ldd_rewrite_script)
2337 AC_SUBST(elf) AC_SUBST(xcoff)
2338 if test $elf = yes; then
2341 if test $xcoff = yes; then
2342 AC_DEFINE(HAVE_XCOFF)
2347 if test $shared = default; then
2351 AC_CACHE_CHECK([whether -fPIC is default], libc_cv_pic_default,
2352 [libc_cv_pic_default=yes
2353 cat > conftest.c <<EOF
2354 #if defined __PIC__ || defined __pic__ || defined PIC || defined pic
2355 # error PIC is default.
2358 if eval "${CC-cc} -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
2359 libc_cv_pic_default=no
2362 AC_SUBST(libc_cv_pic_default)
2366 AC_SUBST(static_nss)
2367 AC_SUBST(nopic_initfini)
2371 dnl See sysdeps/mach/configure.in for this variable.
2372 AC_SUBST(mach_interface_list)
2374 if test "`(cd $srcdir; pwd)`" = "`pwd`"; then
2377 config_makefile=Makefile
2380 VERSION=`sed -n -e 's/^#define VERSION "\([^"]*\)"/\1/p' < $srcdir/version.h`
2381 RELEASE=`sed -n -e 's/^#define RELEASE "\([^"]*\)"/\1/p' < $srcdir/version.h`
2385 AC_CONFIG_FILES([config.make ${config_makefile}])
2386 AC_CONFIG_COMMANDS([default],[[
2387 case $CONFIG_FILES in *config.make*)
2388 echo "$config_vars" >> config.make;;
2390 test -d bits || mkdir bits]],[[config_vars='$config_vars']])