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)], [http://sourceware.org/bugzilla/], [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 AC_ARG_ENABLE([hidden-plt],
191 AC_HELP_STRING([--disable-hidden-plt],
192 [do not hide internal function calls to avoid PLT]),
195 if test "x$hidden" = xno; then
199 AC_ARG_ENABLE([bind-now],
200 AC_HELP_STRING([--enable-bind-now],
201 [disable lazy relocations in DSOs]),
202 [bindnow=$enableval],
206 dnl On some platforms we cannot use dynamic loading. We must provide
207 dnl static NSS modules.
208 AC_ARG_ENABLE([static-nss],
209 AC_HELP_STRING([--enable-static-nss],
210 [build static NSS modules @<:@default=no@:>@]),
211 [static_nss=$enableval],
213 dnl Enable static NSS also if we build no shared objects.
214 if test x"$static_nss" = xyes || test x"$shared" = xno; then
216 AC_DEFINE(DO_STATIC_NSS)
219 AC_ARG_ENABLE([force-install],
220 AC_HELP_STRING([--disable-force-install],
221 [don't force installation of files from this package, even if they are older than the installed files]),
222 [force_install=$enableval],
224 AC_SUBST(force_install)
226 dnl On some platforms we allow dropping compatibility with all kernel
228 AC_ARG_ENABLE([kernel],
229 AC_HELP_STRING([--enable-kernel=VERSION],
230 [compile for compatibility with kernel not older than VERSION]),
231 [minimum_kernel=$enableval],
233 dnl Prevent unreasonable values.
234 if test "$minimum_kernel" = yes || test "$minimum_kernel" = no; then
235 # Better nothing than this.
238 if test "$minimum_kernel" = current; then
239 minimum_kernel=`uname -r 2>/dev/null` || minimum_kernel=
243 dnl For the development we sometimes want gcc to issue even more warnings.
244 dnl This is not the default since many of the extra warnings are not
246 AC_ARG_ENABLE([all-warnings],
247 AC_HELP_STRING([--enable-all-warnings],
248 [enable all useful warnings gcc can issue]),
249 [all_warnings=$enableval],
251 AC_SUBST(all_warnings)
253 AC_ARG_ENABLE([multi-arch],
254 AC_HELP_STRING([--enable-multi-arch],
255 [enable single DSO with optimizations for multiple architectures]),
256 [multi_arch=$enableval],
257 [multi_arch=default])
259 AC_ARG_ENABLE([nss-crypt],
260 AC_HELP_STRING([--enable-nss-crypt],
261 [enable libcrypt to use nss]),
262 [nss_crypt=$enableval],
264 if test x$nss_crypt = xyes; then
265 nss_includes=-I$(nss-config --includedir 2>/dev/null)
266 if test $? -ne 0; then
267 AC_MSG_ERROR([cannot find include directory with nss-config])
270 CFLAGS="$CFLAGS $nss_includes"
271 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([typedef int PRBool;
273 #include <nsslowhash.h>
274 void f (void) { NSSLOW_Init (); }])],
275 libc_cv_nss_crypt=yes,
277 cannot find NSS headers with lowlevel hash function interfaces]))
279 LIBS="$LIBS -lfreebl3"
280 AC_LINK_IFELSE([AC_LANG_PROGRAM([typedef int PRBool;
282 #include <nsslowhash.h>],
284 libc_cv_nss_crypt=yes,
286 cannot link program using lowlevel NSS hash functions]))
292 AC_SUBST(libc_cv_nss_crypt)
294 # The way shlib-versions is used to generate soversions.mk uses a
295 # fairly simplistic model for name recognition that can't distinguish
296 # i486-pc-linux-gnu fully from i486-pc-gnu. So we mutate a $host_os
297 # of `gnu*' here to be `gnu-gnu*' just so that shlib-versions can
298 # tell. This doesn't get used much beyond that, so it's fairly safe.
303 host_os=`echo $host_os | sed -e 's/gnu/gnu-gnu/'`
307 # We keep the original values in `$config_*' and never modify them, so we
308 # can write them unchanged into config.make. Everything else uses
309 # $machine, $vendor, and $os, and changes them whenever convenient.
310 config_machine=$host_cpu config_vendor=$host_vendor config_os=$host_os
312 # Don't allow vendor == "unknown"
313 test "$config_vendor" = unknown && config_vendor=
314 config_os="`echo $config_os | sed 's/^unknown-//'`"
316 # Some configurations imply other options.
318 # i586-linuxaout is mangled into i586-pc-linux-gnuaout
319 linux*ecoff* | linux*aout* | gnu*aout* | gnu*ecoff*)
321 gnu* | linux* | freebsd* | netbsd* | sysv4* | solaris2* | irix6*)
322 # These systems (almost) always use the ELF format.
326 # These systems are always xcoff
332 # The configure fragment of an add-on port can modify these to supplement
333 # or override the table in the case statement below. No fragment should
334 # ever change the config_* variables, however.
335 machine=$config_machine
336 vendor=$config_vendor
340 # config.guess on some IBM machines says `rs6000' instead of `powerpc'.
342 if test "$machine" = rs6000; then
346 # Braindead PowerPC box with absolutely no FPU.
347 case "$machine-$host_os" in
355 AS_HELP_STRING([--with-cpu=CPU], [select code for CPU variant]),
358 yes|'') AC_MSG_ERROR([--with-cpu requires an argument]) ;;
360 *) submachine="$withval" ;;
364 # An add-on can set this when it wants to disable the sanity check below.
367 dnl Having this here, though empty, makes sure that if add-ons' fragments
368 dnl do AC_CONFIG_SUBDIRS([some-dir]), which just sets $subdirs, then
369 dnl our AC_OUTPUT will actually use it.
372 case "$enable_add_ons" in
375 add_ons=`cd $srcdir && ls -d 2> /dev/null */configure */sysdeps |
376 sed 's@/[[^/]]*$@@' | sort | uniq`
377 add_ons_automatic=yes
379 *) add_ons=`echo "$enable_add_ons" | sed 's/,/ /g'`
380 add_ons_automatic=no ;;
386 if test x"$add_ons" != x; then
387 for f in $add_ons; do
392 *** It seems that you're using an old \`crypt' add-on. crypt is now
393 *** part of glibc and using the old add-on will not work with this
394 *** release. Start again with fresh sources and without the old
395 *** \`crypt' add-on.])
399 *** It seems that you're using an old \`localedata' add-on. localedata
400 *** is now part of glibc and using the old add-on will not work with
401 *** this release. Start again with fresh sources and without the old
402 *** \`localedata' add-on.])
407 # Now source each add-on's configure fragment.
408 # The fragments can use $srcdir/$libc_add_on to find themselves,
409 # and test $add_ons_automatic to see if they were explicitly requested.
410 # A fragment can clear (or even change) $libc_add_on to affect
411 # whether it goes into the list to be actually used in the build.
413 for libc_add_on in $add_ons; do
414 # Test whether such a directory really exists.
415 # It can be absolute, or relative to $srcdir, or relative to the build dir.
416 case "$libc_add_on" in
418 libc_add_on_srcdir=$libc_add_on
421 test -d "$srcdir/$libc_add_on" || {
422 if test -d "$libc_add_on"; then
423 libc_add_on="`pwd`/$libc_add_on"
425 AC_MSG_ERROR(add-on directory \"$libc_add_on\" does not exist)
428 libc_add_on_srcdir=$srcdir/$libc_add_on
432 libc_add_on_frag=$libc_add_on_srcdir/configure
433 libc_add_on_canonical=
434 libc_add_on_config_subdirs=
435 if test -r "$libc_add_on_frag"; then
436 AC_MSG_NOTICE(running configure fragment for add-on $libc_add_on)
437 libc_add_on_canonical=unknown
439 . "$libc_add_on_frag"
440 test -z "$libc_add_on" || {
441 configured_add_ons="$configured_add_ons $libc_add_on"
442 if test "x$libc_add_on_canonical" = xunknown; then
443 AC_MSG_ERROR(fragment must set \$libc_add_on_canonical)
445 for d in $libc_add_on_subdirs; do
446 case "$libc_add_on" in
447 /*) subdir_srcdir="$libc_add_on" ;;
448 *) subdir_srcdir="\$(..)$libc_add_on" ;;
452 d="${libc_add_on_canonical:-$libc_add_on}"
458 subdir_srcdir="$subdir_srcdir/$d"
461 d=`echo "$d" | sed 's@/*$@@;s@^.*/@@'`
462 add_on_subdirs="$add_on_subdirs $d"
463 test "$subdir_srcdir" = "\$(..)$d" || config_vars="$config_vars
464 $d-srcdir = $subdir_srcdir"
466 for d in $libc_add_on_config_subdirs; do
469 fragment uses absolute path in \$libc_add_on_config_subdirs) ;;
471 if test ! -d "$libc_add_on_srcdir/$d"; then
472 AC_MSG_ERROR(fragment wants to configure missing directory $d)
474 case "$libc_add_on" in
476 relative path required for add-on using \$libc_add_on_config_subdirs) ;;
478 subdirs="$subdirs $libc_add_on/$d"
482 if test -n "$libc_add_on"; then
483 if frags=`ls -d $libc_add_on_srcdir/sysdeps/*/preconfigure 2> /dev/null`
485 AC_MSG_CHECKING(add-on $libc_add_on for preconfigure fragments)
486 for frag in $frags; do
487 name=`echo "$frag" | sed 's@/[[^/]]*$@@;s@^.*/@@'`
488 echo $ECHO_N "$name $ECHO_C" >&AS_MESSAGE_FD
493 use_add_ons="$use_add_ons $libc_add_on"
494 add_ons_pfx="$add_ons_pfx $libc_add_on/"
495 test -z "$libc_add_on_canonical" ||
496 add_ons_sfx="$add_ons_sfx /$libc_add_on_canonical"
499 # Use echo to strip excess whitespace.
500 add_ons="`echo $use_add_ons`"
503 AC_SUBST(add_on_subdirs)
507 ### I put this here to prevent those annoying emails from people who cannot
508 ### read and try to compile glibc on unsupported platforms. --drepper
510 ### By using the undocumented --enable-hacker-mode option for configure
511 ### one can skip this test to make the configuration not fail for unsupported
514 if test -z "$enable_hacker_mode" && test x"$libc_config_ok" != xyes; then
515 case "$machine-$host_os" in
516 *-linux* | *-gnu* | arm*-none* | powerpc-aix4.3.*)
519 echo "*** The GNU C library is currently not available for this platform."
520 echo "*** So far nobody cared to port it and if there is no volunteer it"
521 echo "*** might never happen. So, if you have interest to see glibc on"
522 echo "*** this platform visit"
523 echo "*** http://www.gnu.org/software/libc/porting.html"
524 echo "*** and join the group of porters"
530 dnl We need to use [ and ] for other purposes for a while now.
532 # Expand the configuration machine name into a subdirectory by architecture
533 # type and particular chip. If an add-on configure fragment already set
534 # base_machine, we don't change it.
535 test -n "$base_machine" || case "$machine" in
536 a29k | am29000) base_machine=a29k machine=a29k ;;
537 c3[012]) base_machine=cx0 machine=cx0/c30 ;;
538 c4[04]) base_machine=cx0 machine=cx0/c40 ;;
539 i[34567]86) base_machine=i386 machine=i386/$machine ;;
540 ia64) base_machine=ia64 machine=ia64 ;;
541 m88???) base_machine=m88k machine=m88k/$machine ;;
542 m88k) base_machine=m88k machine=m88k/m88100 ;;
543 powerpc) base_machine=powerpc machine=powerpc/powerpc32 ;;
544 powerpc64) base_machine=powerpc machine=powerpc/powerpc64 ;;
545 s390) base_machine=s390 machine=s390/s390-32 ;;
546 s390x) base_machine=s390 machine=s390/s390-64 ;;
547 sh3*) base_machine=sh machine=sh/sh3 ;;
548 sh4*) base_machine=sh machine=sh/sh4 ;;
550 base_machine=sparc machine=sparc/sparc32 ;;
551 sparcv8 | supersparc | hypersparc)
552 base_machine=sparc machine=sparc/sparc32/sparcv8 ;;
553 sparcv8plus | sparcv8plusa | sparcv9)
554 base_machine=sparc machine=sparc/sparc32/sparcv9 ;;
555 sparcv8plusb | sparcv9b)
556 base_machine=sparc machine=sparc/sparc32/sparcv9/sparcv9b ;;
558 base_machine=sparc machine=sparc/sparc32/sparcv9/sparcv9v ;;
560 base_machine=sparc machine=sparc/sparc32/sparcv9/sparcv9v2 ;;
562 base_machine=sparc machine=sparc/sparc64 ;;
564 base_machine=sparc machine=sparc/sparc64/sparcv9b ;;
566 base_machine=sparc machine=sparc/sparc64/sparcv9v ;;
568 base_machine=sparc machine=sparc/sparc64/sparcv9v2 ;;
569 *) base_machine=$machine ;;
572 AC_SUBST(base_machine)
574 if test "$base_machine" = "i386"; then
575 AC_DEFINE(USE_REGPARMS)
578 # For the multi-arch option we need support in the assembler.
579 AC_CACHE_CHECK([for assembler gnu_indirect_function symbol type support],
580 libc_cv_asm_gnu_indirect_function, [dnl
581 cat > conftest.s <<EOF
582 .type foo,%gnu_indirect_function
584 if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD;
586 libc_cv_asm_gnu_indirect_function=yes
588 libc_cv_asm_gnu_indirect_function=no
592 AC_MSG_CHECKING(whether .text pseudo-op must be used)
593 AC_CACHE_VAL(libc_cv_dot_text, [dnl
594 cat > conftest.s <<EOF
598 if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
599 libc_cv_dot_text=.text
602 if test -z "$libc_cv_dot_text"; then
608 AC_CACHE_CHECK(for assembler global-symbol directive,
609 libc_cv_asm_global_directive, [dnl
610 libc_cv_asm_global_directive=UNKNOWN
611 for ac_globl in .globl .global .EXPORT; do
612 cat > conftest.s <<EOF
617 if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
618 libc_cv_asm_global_directive=${ac_globl}
621 test $libc_cv_asm_global_directive != UNKNOWN && break
623 if test $libc_cv_asm_global_directive = UNKNOWN; then
624 AC_MSG_ERROR(cannot determine asm global directive)
626 AC_DEFINE_UNQUOTED(ASM_GLOBAL_DIRECTIVE, ${libc_cv_asm_global_directive})
629 AC_CACHE_CHECK(for assembler .type directive prefix,
630 libc_cv_asm_type_prefix, [dnl
631 libc_cv_asm_type_prefix=no
632 for ac_try_prefix in '@' '%' '#'; do
633 cat > conftest.s <<EOF
635 ${libc_cv_asm_global_directive} foo
636 .type foo, ${ac_try_prefix}object
641 if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
642 libc_cv_asm_type_prefix=${ac_try_prefix}
645 test "x$libc_cv_asm_type_prefix" != xno && break
647 if test "x$libc_cv_asm_type_prefix" != xno; then
648 AC_DEFINE_UNQUOTED(ASM_TYPE_DIRECTIVE_PREFIX, ${libc_cv_asm_type_prefix})
651 if test x"$libc_cv_asm_gnu_indirect_function" != xyes -a x"$libc_cv_asm_type_prefix" = xno; then
652 if test x"$multi_arch" = xyes; then
653 AC_MSG_ERROR([--enable-multi-arch support requires assembler and linker support])
658 if test x"$multi_arch" != xno; then
659 multi_arch_d=/multiarch
662 # Compute the list of sysdep directories for this configuration.
663 # This can take a while to compute.
664 sysdep_dir=$srcdir/sysdeps
665 AC_MSG_CHECKING(sysdep dirs)
666 dnl We need to use [ and ] for other purposes for a while now.
668 # Make sco3.2v4 become sco3.2.4 and sunos4.1.1_U1 become sunos4.1.1.U1.
669 os="`echo $os | sed 's/\([0-9A-Z]\)[v_]\([0-9A-Z]\)/\1.\2/g'`"
671 test "x$base_os" != x || case "$os" in
674 netbsd* | 386bsd* | freebsd* | bsdi*)
675 base_os=unix/bsd/bsd4.4 ;;
676 osf* | sunos* | ultrix* | newsos* | dynix* | *bsd*)
678 sysv* | isc* | esix* | sco* | minix* | irix4* | linux*)
681 base_os=unix/sysv/irix6/$os ;;
683 base_os=unix/sysv/sysv4 ;;
685 base_os=unix/sysv/hpux/$os ;;
687 base_os=unix/sysv/aix/aix4.3 ;;
689 base_os=standalone ;;
692 # For sunos4.1.1, try sunos4.1.1, then sunos4.1, then sunos4, then sunos.
695 while o=`echo $tail | sed 's/\.[^.]*$//'`; test $o != $tail; do
699 o=`echo $tail | sed 's/[0-9]*$//'`
700 if test $o != $tail; then
703 # For linux-gnu, try linux-gnu, then linux.
704 o=`echo $tail | sed 's/-.*$//'`
705 if test $o != $tail; then
709 # For unix/sysv/sysv4, try unix/sysv/sysv4, then unix/sysv, then unix.
712 while b=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$b"; do
718 # For sparc/sparc32, try sparc/sparc32 and then sparc.
720 tail=$machine${submachine:+/$submachine}
721 while m=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$m"; do
723 # Prepend the machine's FPU directory unless --without-fp.
724 if test "$with_fp" = yes; then
727 mach="$mach /$1/nofpu"
733 dnl We are done with glob and regexp uses of [ and ]; return to autoconf.
736 # Find what sysdep directories exist.
739 for b in $base ''; do
740 for m0 in $mach ''; do
741 for v in /$vendor ''; do
742 test "$v" = / && continue
743 for o in /$ostry ''; do
744 test "$o" = / && continue
745 for m in $multi_arch_d $mach ''; do
746 for d in $add_ons_pfx ''; do
747 for a in $add_ons_sfx ''; do
748 if test -n "$m0$m0sub$b$v$o$m$msub"; then
749 try_srcdir="${srcdir}/"
753 try="${d}sysdeps$m0$m0sub$b$v$o$m$msub$a"
754 test -n "$enable_debug_configure" &&
755 echo "$0 [DEBUG]: try $try" >&2
756 if test -d "$try_srcdir$try"; then
757 sysnames="$sysnames $try"
758 { test -n "$o" || test -n "$b"; } && os_used=t
759 { test -n "$m" || test -n "$m0"; } && machine_used=t
761 x*/$submachine) submachine_used=t ;;
763 if test -n "$d"; then
764 case "$sysnames_add_ons" in
766 *|'') sysnames_add_ons="$sysnames_add_ons $d" ;;
779 # If the assembler supports gnu_indirect_function symbol type and the
780 # architecture supports multi-arch, we enable multi-arch by default.
781 case $sysnames_add_ons$sysnames in
785 test x"$multi_arch" = xdefault && multi_arch=no
788 if test x"$multi_arch" != xno; then
789 AC_DEFINE(USE_MULTIARCH)
793 if test -z "$os_used" && test "$os" != none; then
794 AC_MSG_ERROR(Operating system $os is not supported.)
796 if test -z "$machine_used" && test "$machine" != none; then
797 AC_MSG_ERROR(The $machine is not supported.)
799 if test -z "$submachine_used" && test -n "$submachine"; then
800 AC_MSG_ERROR(The $submachine subspecies of $host_cpu is not supported.)
804 # We have now validated the configuration.
807 # If using ELF, look for an `elf' subdirectory of each machine directory.
808 # We prepend these rather than inserting them whereever the machine appears
809 # because things specified by the machine's ELF ABI should override
810 # OS-specific things, and should always be the same for any OS on the
811 # machine (otherwise what's the point of an ABI?).
812 if test "$elf" = yes; then
814 for d in $add_ons_pfx ''; do
816 if test -d $srcdir/${d}sysdeps$m/elf; then
817 elf_dirs="$elf_dirs ${d}sysdeps$m/elf"
821 sysnames="`echo $elf_dirs | sed -e 's,//,/,g'` $sysnames"
825 # Expand the list of system names into a full list of directories
826 # from each element's parent name and Implies file (if present).
829 while test $# -gt 0; do
833 case " $names " in *" $name "*)
834 # Already in the list.
838 # Report each name as we discover it, so there is no long pause in output.
839 echo $ECHO_N "$name $ECHO_C" >&AS_MESSAGE_FD
841 name_base=`echo $name | sed -e 's@\(.*sysdeps\)/.*@\1@'`
845 *) xsrcdir=$srcdir/ ;;
847 test -n "$enable_debug_configure" &&
848 echo "[DEBUG]: name/Implies $xsrcdir$name/Implies" >&2
850 if test -f $xsrcdir$name/Implies; then
851 # Collect more names from the `Implies' file (removing comments).
852 implied_candidate="`sed 's/#.*$//' < $xsrcdir$name/Implies`"
854 for x in $implied_candidate; do
856 if test -d $xsrcdir$name_base/$x; then
857 implied="$implied $name_base/$x";
860 for d in $add_ons_pfx ''; do
864 *) try_srcdir=$srcdir/ ;;
866 test -n "$enable_debug_configure" &&
867 echo "[DEBUG]: $name implied $x try($d) {$try_srcdir}$try" >&2
868 if test $try != $xsrcdir$name_base/$x && test -d $try_srcdir$try;
870 implied="$implied $try"
872 case "$sysnames_add_ons" in
874 *|'') sysnames_add_ons="$sysnames_add_ons $d" ;;
878 if test $found = no; then
879 AC_MSG_WARN($name/Implies specifies nonexistent $x)
886 # Add NAME to the list of names.
889 # Find the parent of NAME, using the empty string if it has none.
891 parent="`echo $name | sed -n -e 's=/[^/]*$==' -e '/sysdeps$/q' -e p`"
894 # Add the names implied by NAME, and NAME's parent (if it has one), to
895 # the list of names to be processed (the argument list). We prepend the
896 # implied names to the list and append the parent. We want implied
897 # directories to come before further directories inferred from the
898 # configuration components; this ensures that for sysv4, unix/common
899 # (implied by unix/sysv/sysv4) comes before unix/sysv (in ostry (here $*)
901 sysnames="`echo $implied $* $parent`"
902 test -n "$sysnames" && set $sysnames
905 # Add the default directories.
906 default_sysnames=sysdeps/generic
907 if test "$elf" = yes; then
908 default_sysnames="sysdeps/generic/elf $default_sysnames"
910 sysnames="$names $default_sysnames"
912 # The other names were emitted during the scan.
913 AC_MSG_RESULT($default_sysnames)
915 # Collect the list of add-ons that supply partial sysdeps trees.
917 for add_on in $add_ons; do
920 *) xsrcdir="$srcdir/" ;;
923 test -d "$xsrcdir$add_on/sysdeps" || {
924 case "$configured_add_ons " in
927 AC_MSG_ERROR(add-on $add_on has no configure fragment or sysdeps tree)
933 sysdeps_add_ons="$sysdeps_add_ons $add_on"
934 case "$sysnames_add_ons" in
937 AC_MSG_WARN(add-on $add_on contributed no sysdeps directories)
942 for d in $sysnames; do
944 $add_on/sysdeps/*) ;;
947 (cd "$xsrcdir$d" && for f in *[[!~]]; do
951 test -d "$ff" || { test -e "$ff" && exit 88; }
955 test -d "$f" || { test -e "$f" && exit 88; }
959 if test $? -eq 88; then
964 if test $found = no; then
965 AC_MSG_WARN(add-on $add_on contributed no useful sysdeps directories)
968 AC_SUBST(sysdeps_add_ons)
974 if test "$INSTALL" = "${srcdir}/scripts/install-sh -c"; then
975 # The makefiles need to use a different form to find it in $srcdir.
976 INSTALL='\$(..)./scripts/install-sh -c'
981 AC_SUBST(MIG)dnl Needed by sysdeps/mach/configure.in
983 # Accept binutils 2.13 or newer.
984 AC_CHECK_PROG_VER(AS, $AS, --version,
985 [GNU assembler.* \([0-9]*\.[0-9.]*\)],
986 [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")
987 AC_CHECK_PROG_VER(LD, $LD, --version,
988 [GNU ld.* \([0-9][0-9]*\.[0-9.]*\)],
989 [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")
991 # We need the physical current working directory. We cannot use the
992 # "pwd -P" shell builtin since that's not portable. Instead we try to
993 # find a pwd binary. Note that assigning to the PWD environment
994 # variable might have some interesting side effects, so we don't do
996 AC_PATH_PROG(PWD_P, pwd, no)
997 if test "$PWD_P" = no; then
998 AC_MSG_ERROR(*** A pwd binary could not be found.)
1001 # These programs are version sensitive.
1002 AC_CHECK_TOOL_PREFIX
1003 AC_CHECK_PROG_VER(CC, ${ac_tool_prefix}gcc ${ac_tool_prefix}cc, -v,
1004 [version \([egcygnustpi-]*[0-9.]*\)], [3.4* | 4.[0-9]* ],
1005 critic_missing="$critic_missing gcc")
1006 AC_CHECK_PROG_VER(MAKE, gnumake gmake make, --version,
1007 [GNU Make[^0-9]*\([0-9][0-9.]*\)],
1008 [3.79* | 3.[89]*], critic_missing="$critic_missing make")
1010 AC_CHECK_PROG_VER(MSGFMT, gnumsgfmt gmsgfmt msgfmt, --version,
1011 [GNU gettext.* \([0-9]*\.[0-9.]*\)],
1012 [0.10.3[6-9]* | 0.10.[4-9][0-9]* | 0.1[1-9]* | 0.[2-9][0-9]* | [1-9].*],
1013 MSGFMT=: aux_missing="$aux_missing msgfmt")
1014 AC_CHECK_PROG_VER(MAKEINFO, makeinfo, --version,
1015 [GNU texinfo.* \([0-9][0-9.]*\)],
1017 MAKEINFO=: aux_missing="$aux_missing makeinfo")
1018 AC_CHECK_PROG_VER(SED, sed, --version,
1019 [GNU sed version \([0-9]*\.[0-9.]*\)],
1020 [3.0[2-9]*|3.[1-9]*|[4-9]*],
1021 SED=: aux_missing="$aux_missing sed")
1023 AC_CHECK_TOOL(READELF, readelf, false)
1025 AC_CHECK_PROGS(AUTOCONF, autoconf, no)
1026 case "x$AUTOCONF" in
1027 xno|x|x:) AUTOCONF=no ;;
1030 whether $AUTOCONF${ACFLAGS:+ }$ACFLAGS works, libc_cv_autoconf_works, [dnl
1031 if (cd $srcdir; $AUTOCONF $ACFLAGS configure.in > /dev/null 2>&1); then
1032 libc_cv_autoconf_works=yes
1034 libc_cv_autoconf_works=no
1036 test $libc_cv_autoconf_works = yes || AUTOCONF=no
1039 if test "x$AUTOCONF" = xno; then
1040 aux_missing="$aux_missing autoconf"
1043 test -n "$critic_missing" && AC_MSG_ERROR([
1044 *** These critical programs are missing or too old:$critic_missing
1045 *** Check the INSTALL file for required versions.])
1047 test -n "$aux_missing" && AC_MSG_WARN([
1048 *** These auxiliary programs are missing or incompatible versions:$aux_missing
1049 *** some features will be disabled.
1050 *** Check the INSTALL file for required versions.])
1052 # if using special system headers, find out the compiler's sekrit
1053 # header directory and add that to the list. NOTE: Only does the right
1054 # thing on a system that doesn't need fixincludes. (Not presently a problem.)
1055 if test -n "$sysheaders"; then
1056 SYSINCLUDES=-nostdinc
1057 for d in include include-fixed; do
1058 i=`$CC -print-file-name="$d"` && test "x$i" != x && test "x$i" != "x$d" &&
1059 SYSINCLUDES="$SYSINCLUDES -isystem $i"
1061 SYSINCLUDES="$SYSINCLUDES \
1062 -isystem `echo $sysheaders | sed 's/:/ -isystem /g'`"
1063 if test -n "$CXX"; then
1065 cxxversion=`$CXX -dumpversion 2>&AS_MESSAGE_LOG_FD` &&
1066 cxxmachine=`$CXX -dumpmachine 2>&AS_MESSAGE_LOG_FD` &&
1067 for d in include "$cxxmachine/include"; do
1068 i=../../../../$d/c++/$cxxversion
1069 cxxheaders=`$CXX -print-file-name="$i"` &&
1070 test "x$cxxheaders" != x && test "x$i" != "x$cxxheaders" &&
1071 CXX_SYSINCLUDES="$CXX_SYSINCLUDES -isystem $cxxheaders \
1072 -isystem $cxxheaders/$cxxmachine -isystem $cxxheaders/backward"
1076 AC_SUBST(SYSINCLUDES)
1077 AC_SUBST(CXX_SYSINCLUDES)
1079 # ranlib is never necessary on Linux and Hurd systems
1082 # Test if LD_LIBRARY_PATH contains the notation for the current directory
1083 # since this would lead to problems installing/building glibc.
1084 # LD_LIBRARY_PATH contains the current directory if one of the following
1086 # - one of the terminals (":" and ";") is the first or last sign
1087 # - two terminals occur directly after each other
1088 # - the path contains an element with a dot in it
1089 AC_MSG_CHECKING(LD_LIBRARY_PATH variable)
1091 case ${LD_LIBRARY_PATH} in
1092 [:\;]* | *[:\;] | *[:\;][:\;]* | *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* )
1093 ld_library_path_setting="contains current directory"
1096 ld_library_path_setting="ok"
1100 AC_MSG_RESULT($ld_library_path_setting)
1101 if test "$ld_library_path_setting" != "ok"; then
1103 *** LD_LIBRARY_PATH shouldn't contain the current directory when
1104 *** building glibc. Please change the environment variable
1105 *** and run configure again.])
1108 AC_CACHE_CHECK(whether GCC supports -static-libgcc, libc_cv_gcc_static_libgcc, [dnl
1109 if $CC -v -static-libgcc 2>&1 | grep -q 'unrecognized option.*static-libgcc'; then
1110 libc_cv_gcc_static_libgcc=
1112 libc_cv_gcc_static_libgcc=-static-libgcc
1114 AC_SUBST(libc_cv_gcc_static_libgcc)
1116 AC_PATH_PROG(BASH_SHELL, bash, no)
1117 if test "$BASH_SHELL" != no &&
1118 $BASH_SHELL -c 'test "$BASH_VERSINFO" \
1119 && test "$BASH_VERSINFO" -ge 2 >&/dev/null'; then
1120 libc_cv_have_bash2=yes
1122 libc_cv_have_bash2=no
1124 AC_SUBST(libc_cv_have_bash2)
1126 dnl We need a ksh compatible shell for tzselect.
1127 if test "$BASH_SHELL" = no; then
1128 AC_PATH_PROG(KSH, ksh, no)
1129 if test "$KSH" = no; then
1132 libc_cv_have_ksh=yes
1137 libc_cv_have_ksh=yes
1139 AC_SUBST(libc_cv_have_ksh)
1142 AC_PATH_PROG(PERL, perl, no)
1143 if test "$PERL" != no &&
1144 (eval `$PERL -V:apiversion`; test `expr "$apiversion" \< 5` -ne 0); then
1147 AC_PATH_PROG(INSTALL_INFO, install-info, no,
1148 $PATH:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin)
1149 AC_PATH_PROG(BISON, bison, no, $PATH:/usr/local/bin:/usr/bin:/bin)
1151 AC_CACHE_CHECK(for signed size_t type, libc_cv_signed_size_t, [dnl
1152 echo '#include <stddef.h>
1153 FOOBAR __SIZE_TYPE__ FOOBAR' > conftest.c
1154 if eval "$ac_cpp conftest.c 2>/dev/null" \
1155 | grep '^FOOBAR.*unsigned.*FOOBAR$' >/dev/null; then
1156 libc_cv_signed_size_t=no
1158 libc_cv_signed_size_t=yes
1161 if test $libc_cv_signed_size_t = yes; then
1162 dnl Do this by hand instead of AC_DEFINE so can add #undef to avoid warnings.
1163 cat >> confdefs.h <<\EOF
1164 #undef __SIZE_TYPE__
1165 #define __SIZE_TYPE__ unsigned
1169 AC_CACHE_CHECK(for libc-friendly stddef.h, libc_cv_friendly_stddef, [dnl
1171 [#define __need_size_t
1172 #define __need_wchar_t
1175 #include <stddef.h>], [size_t size; wchar_t wchar;
1177 #error stddef.h ignored __need_*
1179 if (&size == NULL || &wchar == NULL) abort ();],
1180 libc_cv_friendly_stddef=yes,
1181 libc_cv_friendly_stddef=no)])
1182 if test $libc_cv_friendly_stddef = yes; then
1183 config_vars="$config_vars
1184 override stddef.h = # The installed <stddef.h> seems to be libc-friendly."
1187 AC_CACHE_CHECK(whether we need to use -P to assemble .S files,
1188 libc_cv_need_minus_P, [dnl
1189 cat > conftest.S <<EOF
1190 #include "confdefs.h"
1191 /* Nothing whatsoever. */
1193 if AC_TRY_COMMAND(${CC-cc} $CPPFLAGS $ASFLAGS -c conftest.S 1>&AS_MESSAGE_LOG_FD); then
1194 libc_cv_need_minus_P=no
1196 libc_cv_need_minus_P=yes
1199 if test $libc_cv_need_minus_P = yes; then
1200 config_vars="$config_vars
1201 asm-CPPFLAGS = -P # The assembler can't grok cpp's # line directives."
1204 AC_CACHE_CHECK(for .set assembler directive, libc_cv_asm_set_directive, [dnl
1205 cat > conftest.s <<EOF
1208 .set glibc_conftest_frobozz,foo
1209 $libc_cv_asm_global_directive glibc_conftest_frobozz
1211 # The alpha-dec-osf1 assembler gives only a warning for `.set'
1212 # (but it doesn't work), so we must do a linking check to be sure.
1213 cat > conftest1.c <<\EOF
1214 extern int glibc_conftest_frobozz;
1215 void _start() { glibc_conftest_frobozz = 1; }
1217 if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
1218 -nostartfiles -nostdlib \
1219 -o conftest conftest.s conftest1.c 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
1220 libc_cv_asm_set_directive=yes
1222 libc_cv_asm_set_directive=no
1225 if test $libc_cv_asm_set_directive = yes; then
1226 AC_DEFINE(HAVE_ASM_SET_DIRECTIVE)
1229 AC_CACHE_CHECK(for assembler gnu_unique_object symbol type,
1230 libc_cv_asm_unique_object, [dnl
1231 cat > conftest.s <<EOF
1234 .type _sym, ${libc_cv_asm_type_prefix}gnu_unique_object
1236 if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
1237 libc_cv_asm_unique_object=yes
1239 libc_cv_asm_unique_object=no
1242 if test $libc_cv_asm_unique_object = yes; then
1243 AC_DEFINE(HAVE_ASM_UNIQUE_OBJECT)
1246 AC_CACHE_CHECK(for .symver assembler directive, libc_cv_asm_symver_directive,
1247 [cat > conftest.s <<EOF
1250 .symver _sym,sym@VERS
1252 if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
1253 libc_cv_asm_symver_directive=yes
1255 libc_cv_asm_symver_directive=no
1258 AC_CACHE_CHECK(for ld --version-script, libc_cv_ld_version_script_option, [dnl
1259 if test $libc_cv_asm_symver_directive = yes; then
1260 cat > conftest.s <<EOF
1263 .symver _sym,sym@VERS
1265 cat > conftest.map <<EOF
1274 if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
1275 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $LDFLAGS -shared
1276 -o conftest.so conftest.o
1277 -nostartfiles -nostdlib
1278 -Wl,--version-script,conftest.map
1279 1>&AS_MESSAGE_LOG_FD]);
1281 libc_cv_ld_version_script_option=yes
1283 libc_cv_ld_version_script_option=no
1286 libc_cv_ld_version_script_option=no
1289 libc_cv_ld_version_script_option=no
1292 if test $shared != no &&
1293 test $libc_cv_asm_symver_directive = yes &&
1294 test $libc_cv_ld_version_script_option = yes &&
1295 test $enable_versioning = yes; then
1297 AC_DEFINE(DO_VERSIONING)
1301 AC_SUBST(VERSIONING)
1303 if test $elf = yes && test $shared != no && test $VERSIONING = no; then
1305 *** WARNING: You should not compile GNU libc without versioning. Not using
1306 *** versioning will introduce incompatibilities so that old binaries
1307 *** will not run anymore.
1308 *** For versioning you need recent binutils (binutils-2.8.1.0.23 or newer)."
1310 if test $elf = yes; then
1311 AC_CACHE_CHECK(for .previous assembler directive,
1312 libc_cv_asm_previous_directive, [dnl
1313 cat > conftest.s <<EOF
1314 .section foo_section
1317 if AC_TRY_COMMAND(${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
1318 libc_cv_asm_previous_directive=yes
1320 libc_cv_asm_previous_directive=no
1323 if test $libc_cv_asm_previous_directive = yes; then
1324 AC_DEFINE(HAVE_ASM_PREVIOUS_DIRECTIVE)
1326 AC_CACHE_CHECK(for .popsection assembler directive,
1327 libc_cv_asm_popsection_directive, [dnl
1328 cat > conftest.s <<EOF
1329 .pushsection foo_section
1332 if AC_TRY_COMMAND(${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
1333 libc_cv_asm_popsection_directive=yes
1335 libc_cv_asm_popsection_directive=no
1338 if test $libc_cv_asm_popsection_directive = yes; then
1339 AC_DEFINE(HAVE_ASM_POPSECTION_DIRECTIVE)
1342 AC_CACHE_CHECK(for .protected and .hidden assembler directive,
1343 libc_cv_asm_protected_directive, [dnl
1344 cat > conftest.s <<EOF
1350 if AC_TRY_COMMAND(${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
1351 libc_cv_asm_protected_directive=yes
1353 AC_MSG_ERROR(assembler support for symbol visibility is required)
1357 if test $libc_cv_asm_protected_directive = yes; then
1358 AC_CACHE_CHECK(whether __attribute__((visibility())) is supported,
1359 libc_cv_visibility_attribute,
1360 [cat > conftest.c <<EOF
1361 int foo __attribute__ ((visibility ("hidden"))) = 1;
1362 int bar __attribute__ ((visibility ("protected"))) = 1;
1364 libc_cv_visibility_attribute=no
1365 if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
1366 if grep '\.hidden.*foo' conftest.s >/dev/null; then
1367 if grep '\.protected.*bar' conftest.s >/dev/null; then
1368 libc_cv_visibility_attribute=yes
1372 rm -f conftest.{c,s}
1374 if test $libc_cv_visibility_attribute != yes; then
1375 AC_MSG_ERROR(compiler support for visibility attribute is required)
1379 if test $libc_cv_visibility_attribute = yes; then
1380 AC_CACHE_CHECK(for broken __attribute__((visibility())),
1381 libc_cv_broken_visibility_attribute,
1382 [cat > conftest.c <<EOF
1384 int bar (int x) __asm__ ("foo") __attribute__ ((visibility ("hidden")));
1385 int bar (int x) { return x; }
1387 libc_cv_broken_visibility_attribute=yes
1388 if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
1390 if grep '\.hidden[ _]foo' conftest.s >/dev/null; then
1392 libc_cv_broken_visibility_attribute=no
1395 rm -f conftest.c conftest.s
1397 if test $libc_cv_broken_visibility_attribute = yes; then
1398 AC_MSG_ERROR(working compiler support for visibility attribute is required)
1402 AC_CACHE_CHECK(for broken __attribute__((alias())),
1403 libc_cv_broken_alias_attribute,
1404 [cat > conftest.c <<EOF
1405 extern int foo (int x) __asm ("xyzzy");
1406 int bar (int x) { return x; }
1407 extern __typeof (bar) foo __attribute ((weak, alias ("bar")));
1409 extern __typeof (dfoo) dfoo __asm ("abccb");
1412 libc_cv_broken_alias_attribute=yes
1413 if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
1414 if grep 'xyzzy' conftest.s >/dev/null &&
1415 grep 'abccb' conftest.s >/dev/null; then
1416 libc_cv_broken_alias_attribute=no
1419 rm -f conftest.c conftest.s
1421 if test $libc_cv_broken_alias_attribute = yes; then
1422 AC_MSG_ERROR(working alias attribute support required)
1425 if test $libc_cv_visibility_attribute = yes; then
1426 AC_CACHE_CHECK(whether to put _rtld_local into .sdata section,
1427 libc_cv_have_sdata_section,
1428 [echo "int i;" > conftest.c
1429 libc_cv_have_sdata_section=no
1430 if ${CC-cc} $LDFLAGS -fPIC -shared -Wl,--verbose conftest.c -o conftest.so 2>&1 \
1431 | grep '\.sdata' >/dev/null; then
1432 libc_cv_have_sdata_section=yes
1434 rm -f conftest.c conftest.so
1436 if test $libc_cv_have_sdata_section = yes; then
1437 AC_DEFINE(HAVE_SDATA_SECTION)
1441 AC_CACHE_CHECK(for .preinit_array/.init_array/.fini_array support,
1442 libc_cv_initfini_array, [dnl
1443 cat > conftest.c <<EOF
1444 int _start (void) { return 0; }
1445 int __start (void) { return 0; }
1446 int foo (void) { return 1; }
1447 int (*fp) (void) __attribute__ ((section (".init_array"))) = foo;
1449 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -o conftest conftest.c
1450 -static -nostartfiles -nostdlib 1>&AS_MESSAGE_LOG_FD])
1452 if $READELF -S conftest | fgrep INIT_ARRAY > /dev/null; then
1453 libc_cv_initfini_array=yes
1455 libc_cv_initfini_array=no
1458 libc_cv_initfini_array=no
1461 if test $libc_cv_initfini_array != yes; then
1462 AC_MSG_ERROR([Need linker with .init_array/.fini_array support.])
1465 AC_CACHE_CHECK(whether to use .ctors/.dtors header and trailer,
1466 libc_cv_ctors_header, [dnl
1467 libc_cv_ctors_header=yes
1469 __attribute__ ((constructor)) void ctor (void) { puts("ctor"); }
1470 __attribute__ ((destructor)) void dtor (void) { puts("dtor"); }
1473 AS_IF([$READELF -WS conftest$ac_exeext | $AWK '
1474 { gsub(/\@<:@ */, "@<:@") }
1475 $2 == ".ctors" || $2 == ".dtors" {
1476 size = strtonum("0x" $6)
1477 align = strtonum("0x" $NF)
1479 stub@<:@$2@:>@ = size == align * 2
1482 ctors_ok = !seen@<:@".ctors"@:>@ || stub@<:@".ctors"@:>@
1483 dtors_ok = !seen@<:@".dtors"@:>@ || stub@<:@".dtors"@:>@
1484 exit ((ctors_ok && dtors_ok) ? 0 : 1)
1486 '], [libc_cv_ctors_header=no])
1488 AC_MSG_ERROR([missing __attribute__ ((constructor)) support??])
1491 if test $libc_cv_ctors_header = no; then
1492 AC_DEFINE(NO_CTORS_DTORS_SECTIONS)
1495 AC_CACHE_CHECK(for libunwind-support in compiler,
1496 libc_cv_cc_with_libunwind, [
1497 cat > conftest.c <<EOF
1498 int main (void) { return 0; }
1500 if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -static -o conftest \
1501 conftest.c -v 2>&1 >/dev/null | grep -q " -lunwind "; then
1502 libc_cv_cc_with_libunwind=yes
1504 libc_cv_cc_with_libunwind=no
1507 AC_SUBST(libc_cv_cc_with_libunwind)
1508 if test $libc_cv_cc_with_libunwind = yes; then
1509 AC_DEFINE(HAVE_CC_WITH_LIBUNWIND)
1512 AC_CACHE_CHECK(for -z nodelete option,
1513 libc_cv_z_nodelete, [dnl
1514 cat > conftest.c <<EOF
1515 int _start (void) { return 42; }
1517 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1518 -fPIC -shared -o conftest.so conftest.c
1519 -nostartfiles -nostdlib
1520 -Wl,--enable-new-dtags,-z,nodelete 1>&AS_MESSAGE_LOG_FD])
1522 libc_cv_z_nodelete=yes
1524 AC_MSG_ERROR(linker with -z nodelete support required)
1528 AC_CACHE_CHECK(for -z nodlopen option,
1529 libc_cv_z_nodlopen, [dnl
1530 cat > conftest.c <<EOF
1531 int _start (void) { return 42; }
1533 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1534 -fPIC -shared -o conftest.so conftest.c
1535 -nostartfiles -nostdlib
1536 -Wl,--enable-new-dtags,-z,nodlopen 1>&AS_MESSAGE_LOG_FD])
1538 libc_cv_z_nodlopen=yes
1540 AC_MSG_ERROR(linker with -z nodlopen support required)
1544 AC_CACHE_CHECK(for -z initfirst option,
1545 libc_cv_z_initfirst, [dnl
1546 cat > conftest.c <<EOF
1547 int _start (void) { return 42; }
1549 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1550 -fPIC -shared -o conftest.so conftest.c
1551 -nostartfiles -nostdlib
1552 -Wl,--enable-new-dtags,-z,initfirst 1>&AS_MESSAGE_LOG_FD])
1554 libc_cv_z_initfirst=yes
1556 AC_MSG_ERROR(linker with -z initfirst support required)
1560 # Add-on fragments can set these for other machines.
1561 libc_commonpagesize=${libc_commonpagesize:-no}
1562 libc_relro_required=${libc_relro_required:-no}
1563 case "$base_machine" in
1564 i[[34567]]86 | x86_64 | powerpc* | s390*)
1565 libc_commonpagesize=0x1000
1566 libc_relro_required=yes
1569 libc_commonpagesize=0x2000
1570 libc_relro_required=yes
1573 libc_commonpagesize=0x4000
1576 libc_commonpagesize=0x10000
1577 libc_relro_required=yes
1581 if test $libc_commonpagesize != no; then
1582 AC_CACHE_CHECK(for -z relro option,
1583 libc_cv_z_relro, [dnl
1585 AC_LANG_CONFTEST([AC_LANG_SOURCE([[
1586 int _start (void) { return 42; }
1587 extern void _exit (int);
1588 /* Since these pointers are const, they should go in rodata.
1589 Since they refer to functions that have to be resolved by
1590 dynamic linking, they should instead go in RELRO data. */
1591 const void *const relro[] = { &_start, &_exit, 0 };
1592 /* GNU ld fails to produce RELRO data when it's very small and there is no
1593 normal writable data following it, or if only uninitialized (.bss) data
1594 follows it, or only very small writable data. */
1595 int data[0x10000] = { 1, };
1597 cat > conftest.awk <<\EOF
1600 commonpagesize = strtonum(commonpagesize)
1602 { print "LINE:", $0 > "/dev/stderr" }
1604 vaddr = strtonum($3)
1605 memsz = strtonum($6)
1607 printf "vaddr %#x memsz %#x end %#x commonpagesize %#x\n", \
1608 vaddr, memsz, end, commonpagesize > "/dev/stderr"
1609 result = (end % commonpagesize == 0) ? "yes" : "broken"
1611 END { print result }
1613 AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1614 -fPIC -shared -o conftest.so conftest.c
1615 -nostartfiles -nostdlib
1616 -Wl,-z,relro 1>&AS_MESSAGE_LOG_FD]) &&
1617 AC_TRY_COMMAND([$READELF -Wl conftest.so > conftest.ph]) &&
1619 $AWK -v commonpagesize=$libc_commonpagesize -f conftest.awk
1620 conftest.ph > conftest.cps
1622 libc_cv_z_relro=`cat conftest.cps 2>&AS_MESSAGE_LOG_FD`
1624 if { test "x$libc_relro_required" = xyes &&
1625 test "x$libc_cv_z_relro" != xyes
1628 AC_MSG_ERROR(linker with -z relro support required)
1631 AC_MSG_WARN([missing architecture parameter to check for working -z relro])
1634 AC_CACHE_CHECK(for -Bgroup option,
1635 libc_cv_Bgroup, [dnl
1636 cat > conftest.c <<EOF
1637 int _start (void) { return 42; }
1639 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1640 -fPIC -shared -o conftest.so conftest.c
1641 -Wl,-Bgroup -nostdlib 1>&AS_MESSAGE_LOG_FD])
1648 AC_SUBST(libc_cv_Bgroup)
1650 AC_CACHE_CHECK(for libgcc_s suffix,
1651 libc_cv_libgcc_s_suffix, [dnl
1652 cat > conftest.c <<EOF
1653 int main (void) { return 0; }
1656 libc_cv_libgcc_s_suffix=`${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
1657 -fPIC -shared -shared-libgcc -o conftest.so \
1658 conftest.c -v 2>&1 >/dev/null \
1659 | sed -n 's/^.* -lgcc_s\([^ ]*\) .*$/\1/p'`
1662 AC_SUBST(libc_cv_libgcc_s_suffix)
1664 AC_CACHE_CHECK(for --as-needed option,
1665 libc_cv_as_needed, [dnl
1666 cat > conftest.c <<EOF
1667 int main (void) { return 0; }
1669 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1670 -fPIC -shared -o conftest.so conftest.c
1671 -lgcc_s$libc_cv_libgcc_s_suffix -Wl,--as-needed
1672 -nostdlib 1>&AS_MESSAGE_LOG_FD])
1674 libc_cv_as_needed=yes
1676 libc_cv_as_needed=no
1679 AC_SUBST(libc_cv_as_needed)
1682 AC_CACHE_CHECK(whether --noexecstack is desirable for .S files,
1683 libc_cv_as_noexecstack, [dnl
1684 cat > conftest.c <<EOF
1687 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS
1688 -S -o conftest.s conftest.c 1>&AS_MESSAGE_LOG_FD]) \
1689 && grep -q .note.GNU-stack conftest.s \
1690 && AC_TRY_COMMAND([${CC-cc} $ASFLAGS -Wa,--noexecstack
1691 -c -o conftest.o conftest.s 1>&AS_MESSAGE_LOG_FD])
1693 libc_cv_as_noexecstack=yes
1695 libc_cv_as_noexecstack=no
1698 if test $libc_cv_as_noexecstack = yes; then
1699 ASFLAGS_config="$ASFLAGS_config -Wa,--noexecstack"
1701 AC_SUBST(ASFLAGS_config)
1703 AC_CACHE_CHECK(for -z combreloc,
1704 libc_cv_z_combreloc, [dnl
1705 cat > conftest.c <<EOF
1706 extern int bar (int);
1708 int foo (void) { return bar (mumble); }
1710 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1711 -fPIC -shared -o conftest.so conftest.c
1712 -nostdlib -nostartfiles
1713 -Wl,-z,combreloc 1>&AS_MESSAGE_LOG_FD])
1715 dnl The following test is a bit weak. We must use a tool which can test
1716 dnl cross-platform since the gcc used can be a cross compiler. Without
1717 dnl introducing new options this is not easily doable. Instead use a tool
1718 dnl which always is cross-platform: readelf. To detect whether -z combreloc
1719 dnl look for a section named .rel.dyn.
1720 if $READELF -S conftest.so | grep '\.rel\(a\|\)\.dyn' > /dev/null; then
1721 libc_cv_z_combreloc=yes
1723 libc_cv_z_combreloc=no
1726 libc_cv_z_combreloc=no
1729 if test "$libc_cv_z_combreloc" = yes; then
1730 AC_DEFINE(HAVE_Z_COMBRELOC)
1732 AC_SUBST(libc_cv_z_combreloc)
1734 AC_CACHE_CHECK(for -z execstack,
1735 libc_cv_z_execstack, [dnl
1736 cat > conftest.c <<EOF
1737 int _start (void) { return 42; }
1739 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1740 -fPIC -shared -o conftest.so conftest.c
1741 -Wl,-z,execstack -nostdlib
1742 1>&AS_MESSAGE_LOG_FD])
1744 libc_cv_z_execstack=yes
1746 libc_cv_z_execstack=no
1749 AC_SUBST(libc_cv_z_execstack)
1751 AC_CACHE_CHECK(for -fpie, libc_cv_fpie, [dnl
1752 cat > conftest.c <<EOF
1754 main () { return 0;}
1756 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -pie -fpie
1757 -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD])
1765 AC_SUBST(libc_cv_fpie)
1767 AC_CACHE_CHECK(for --hash-style option,
1768 libc_cv_hashstyle, [dnl
1769 cat > conftest.c <<EOF
1770 int _start (void) { return 42; }
1772 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1773 -fPIC -shared -o conftest.so conftest.c
1774 -Wl,--hash-style=both -nostdlib 1>&AS_MESSAGE_LOG_FD])
1776 libc_cv_hashstyle=yes
1778 libc_cv_hashstyle=no
1781 AC_SUBST(libc_cv_hashstyle)
1783 # The linker's default -shared behavior is good enough if it
1784 # does these things that our custom linker scripts ensure that
1785 # all allocated NOTE sections come first.
1786 if test "$use_default_link" = default; then
1787 AC_CACHE_CHECK([for sufficient default -shared layout],
1788 libc_cv_use_default_link, [dnl
1789 libc_cv_use_default_link=no
1790 cat > conftest.s <<\EOF
1791 .section .note.a,"a",%note
1796 .section .note.b,"a",%note
1802 if AC_TRY_COMMAND([dnl
1803 ${CC-cc} $ASFLAGS -shared -o conftest.so conftest.s 1>&AS_MESSAGE_LOG_FD]) &&
1804 ac_try=`$READELF -S conftest.so | sed -n \
1806 s/^ *\[ *[1-9][0-9]*\] *\([^ ][^ ]*\) *\([^ ][^ ]*\) .*$/\2 \1/
1812 libc_seen_a=no libc_seen_b=no
1814 while test $# -ge 2 -a "$1" = NOTE; do
1816 .note.a) libc_seen_a=yes ;;
1817 .note.b) libc_seen_b=yes ;;
1821 case "$libc_seen_a$libc_seen_b" in
1823 libc_cv_use_default_link=yes
1826 echo >&AS_MESSAGE_LOG_FD "\
1827 $libc_seen_a$libc_seen_b from:
1833 use_default_link=$libc_cv_use_default_link
1837 AC_CACHE_CHECK(linker output format, libc_cv_output_format, [dnl
1838 if libc_cv_output_format=`
1839 ${CC-cc} -nostartfiles -nostdlib -Wl,--print-output-format 2>&AS_MESSAGE_LOG_FD`
1843 libc_cv_output_format=
1845 test -n "$libc_cv_output_format" || libc_cv_output_format=unknown])
1846 AC_SUBST(libc_cv_output_format)
1848 AC_CACHE_CHECK(for -fno-toplevel-reorder -fno-section-anchors, libc_cv_fno_toplevel_reorder, [dnl
1849 cat > conftest.c <<EOF
1852 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -fno-toplevel-reorder -fno-section-anchors
1853 conftest.c 1>&AS_MESSAGE_LOG_FD])
1855 libc_cv_fno_toplevel_reorder=yes
1857 libc_cv_fno_toplevel_reorder=no
1860 if test $libc_cv_fno_toplevel_reorder = yes; then
1861 fno_unit_at_a_time="-fno-toplevel-reorder -fno-section-anchors"
1863 fno_unit_at_a_time=-fno-unit-at-a-time
1865 AC_SUBST(fno_unit_at_a_time)
1867 AC_CACHE_CHECK(for -fstack-protector, libc_cv_ssp, [dnl
1868 cat > conftest.c <<EOF
1870 main () { return 0;}
1872 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -Werror -fstack-protector
1873 -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD])
1880 AC_SUBST(libc_cv_ssp)
1882 AC_CACHE_CHECK(for -fgnu89-inline, libc_cv_gnu89_inline, [dnl
1883 cat > conftest.c <<EOF
1885 #ifdef __GNUC_GNU_INLINE__
1886 main () { return 0;}
1891 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -std=gnu99 -fgnu89-inline
1892 -o conftest.s conftest.c 1>&AS_MESSAGE_LOG_FD])
1894 libc_cv_gnu89_inline=yes
1896 libc_cv_gnu89_inline=no
1899 if test $libc_cv_gnu89_inline = yes; then
1900 gnu89_inline=-fgnu89-inline
1904 AC_SUBST(gnu89_inline)
1906 if test $elf != yes; then
1907 AC_CACHE_CHECK(for .init and .fini sections, libc_cv_have_initfini,
1908 [AC_TRY_COMPILE(, [asm (".section .init");
1909 asm (".section .fini");
1910 asm ("${libc_cv_dot_text}");],
1911 libc_cv_have_initfini=yes,
1912 libc_cv_have_initfini=no)])
1913 AC_SUBST(libc_cv_have_initfini)dnl
1914 if test $libc_cv_have_initfini = yes; then
1915 AC_DEFINE(HAVE_INITFINI)
1919 if test $elf = yes; then
1920 AC_CACHE_CHECK(whether cc puts quotes around section names,
1921 libc_cv_have_section_quotes,
1922 [cat > conftest.c <<EOF
1923 static const int foo
1924 __attribute__ ((section ("bar"))) = 1;
1926 if ${CC-cc} -S conftest.c -o conftest.s; then
1927 if grep '\.section.*"bar"' conftest.s >/dev/null; then
1928 libc_cv_have_section_quotes=yes
1930 libc_cv_have_section_quotes=no
1933 libc_cv_have_section_quotes=unknown
1935 rm -f conftest.{c,s}
1937 if test $libc_cv_have_section_quotes = yes; then
1938 AC_DEFINE(HAVE_SECTION_QUOTES)
1942 dnl AC_CHECK_ASM_UNDERSCORE([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
1943 AC_DEFUN(AC_CHECK_ASM_UNDERSCORE,
1944 [cat > conftest.$ac_ext <<EOF
1945 dnl This sometimes fails to find confdefs.h, for some reason.
1946 dnl [#]line $LINENO "[$]0"
1947 [#]line $LINENO "configure"
1948 #include "confdefs.h"
1949 void underscore_test(void) {
1952 if AC_TRY_EVAL(ac_compile); then
1953 if grep _underscore_test conftest* >/dev/null; then
1954 ifelse([$1], , :, [rm -f conftest*
1957 ifelse([$2], , , [rm -f conftest*
1961 echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD
1962 cat conftest.$ac_ext >&AS_MESSAGE_LOG_FD
1963 ifelse([$2], , , [rm -f conftest*
1968 if test $elf = yes; then
1969 libc_cv_asm_underscores=no
1971 if test $ac_cv_prog_cc_works = yes; then
1972 AC_CACHE_CHECK(for _ prefix on C symbol names, libc_cv_asm_underscores,
1973 [AC_TRY_LINK([asm ("_glibc_foobar:");], [glibc_foobar ();],
1974 libc_cv_asm_underscores=yes,
1975 libc_cv_asm_underscores=no)])
1977 AC_CACHE_CHECK(for _ prefix on C symbol names, libc_cv_asm_underscores,
1978 [AC_CHECK_ASM_UNDERSCORE(libc_cv_asm_underscores=yes,
1979 libc_cv_asm_underscores=no)])
1982 if test $libc_cv_asm_underscores = no; then
1983 AC_DEFINE(NO_UNDERSCORES)
1986 if test $elf = yes; then
1987 libc_cv_weak_symbols=yes
1990 AC_CACHE_CHECK(for assembler .weak directive, libc_cv_asm_weak_directive,
1992 cat > conftest.s <<EOF
1994 ${libc_cv_asm_global_directive} foo
1997 .weak bar; bar = foo
1999 if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
2000 libc_cv_asm_weak_directive=yes
2002 libc_cv_asm_weak_directive=no
2006 if test $libc_cv_asm_weak_directive = no; then
2007 AC_CACHE_CHECK(for assembler .weakext directive,
2008 libc_cv_asm_weakext_directive,
2010 cat > conftest.s <<EOF
2012 ${libc_cv_asm_global_directive} foo
2016 ${libc_cv_asm_global_directive} baz
2019 if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
2020 libc_cv_asm_weakext_directive=yes
2022 libc_cv_asm_weakext_directive=no
2028 if test $libc_cv_asm_weak_directive = yes; then
2029 AC_DEFINE(HAVE_ASM_WEAK_DIRECTIVE)
2030 elif test $libc_cv_asm_weakext_directive = yes; then
2031 AC_DEFINE(HAVE_ASM_WEAKEXT_DIRECTIVE)
2034 AC_CACHE_CHECK(whether CFI directives are supported, libc_cv_asm_cfi_directives, [dnl
2036 sparc/sparc64*) cfi_offset=2047;;
2039 cat > conftest.s <<EOF
2041 .type func,%function
2045 .cfi_rel_offset 1, $cfi_offset
2048 if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
2049 libc_cv_asm_cfi_directives=yes
2051 libc_cv_asm_cfi_directives=no
2054 if test $libc_cv_asm_cfi_directives = yes; then
2055 AC_DEFINE(HAVE_ASM_CFI_DIRECTIVES)
2058 AC_CACHE_CHECK(for ld --no-whole-archive, libc_cv_ld_no_whole_archive, [dnl
2059 cat > conftest.c <<\EOF
2064 dnl No \ in command here because it ends up inside ''.
2065 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
2066 -nostdlib -nostartfiles -Wl,--no-whole-archive
2067 -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD]); then
2068 libc_cv_ld_no_whole_archive=yes
2070 libc_cv_ld_no_whole_archive=no
2073 if test $libc_cv_ld_no_whole_archive = no; then
2074 AC_MSG_ERROR([support for --no-whole-archive is needed])
2077 AC_CACHE_CHECK(for gcc -fexceptions, libc_cv_gcc_exceptions, [dnl
2078 cat > conftest.c <<\EOF
2083 dnl No \ in command here because it ends up inside ''.
2084 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
2085 -nostdlib -nostartfiles -fexceptions
2086 -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD]); then
2087 libc_cv_gcc_exceptions=yes
2089 libc_cv_gcc_exceptions=no
2092 if test $libc_cv_gcc_exceptions = yes; then
2093 exceptions=-fexceptions
2095 AC_SUBST(exceptions)dnl
2097 if test "$host_cpu" = powerpc ; then
2098 # Check for a bug present in at least versions 2.8.x of GCC
2099 # and versions 1.0.x of EGCS.
2100 AC_CACHE_CHECK(whether clobbering cr0 causes problems,libc_cv_c_asmcr0_bug,[dnl
2101 AC_TRY_COMPILE([int tester(int x) { asm ("" : : : "cc"); return x & 123; }],,
2102 libc_cv_c_asmcr0_bug='no',
2103 libc_cv_c_asmcr0_bug='yes')])
2104 if test "$libc_cv_c_asmcr0_bug" != 'no'; then
2105 AC_DEFINE(BROKEN_PPC_ASM_CR0)
2109 dnl Check whether compiler understands __builtin_expect.
2110 AC_CACHE_CHECK(for __builtin_expect, libc_cv_gcc_builtin_expect,
2111 [cat > conftest.c <<EOF
2112 #line $LINENO "configure"
2115 a = __builtin_expect (a, 10);
2116 return a == 10 ? 0 : 1;
2119 dnl No \ in command here because it ends up inside ''.
2120 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -nostdlib -nostartfiles
2121 -o conftest conftest.c -lgcc >&AS_MESSAGE_LOG_FD]); then
2122 libc_cv_gcc_builtin_expect=yes
2124 libc_cv_gcc_builtin_expect=no
2127 if test "$libc_cv_gcc_builtin_expect" = no; then
2128 AC_MSG_ERROR([support for __builtin_expect needed])
2131 AC_CACHE_CHECK(for __builtin_memset, libc_cv_gcc_builtin_memset, [dnl
2132 cat > conftest.c <<\EOF
2135 __builtin_memset (x, 0, 1000);
2139 if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | fgrep "memset" > /dev/null]);
2141 libc_cv_gcc_builtin_memset=no
2143 libc_cv_gcc_builtin_memset=yes
2146 if test "$libc_cv_gcc_builtin_memset" = yes ; then
2147 AC_DEFINE(HAVE_BUILTIN_MEMSET)
2150 AC_CACHE_CHECK(for redirection of built-in functions, libc_cv_gcc_builtin_redirection, [dnl
2151 cat > conftest.c <<\EOF
2152 extern char *strstr (const char *, const char *) __asm ("my_strstr");
2153 char *foo (const char *a, const char *b)
2155 return __builtin_strstr (a, b);
2159 if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | fgrep "my_strstr" > /dev/null]);
2161 libc_cv_gcc_builtin_redirection=yes
2163 libc_cv_gcc_builtin_redirection=no
2166 if test "$libc_cv_gcc_builtin_redirection" = no; then
2167 AC_MSG_ERROR([support for the symbol redirection needed])
2170 dnl Check whether the compiler supports the __thread keyword.
2171 AC_CACHE_CHECK([for __thread], libc_cv_gcc___thread,
2172 [cat > conftest.c <<\EOF
2173 __thread int a = 42;
2175 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c >&AS_MESSAGE_LOG_FD]); then
2176 libc_cv_gcc___thread=yes
2178 libc_cv_gcc___thread=no
2181 if test "$libc_cv_gcc___thread" = no; then
2182 AC_MSG_ERROR([support for the __thread keyword is required])
2185 dnl Check whether the compiler supports the tls_model attribute.
2186 AC_CACHE_CHECK([for tls_model attribute], libc_cv_gcc_tls_model_attr, [dnl
2187 cat > conftest.c <<\EOF
2188 extern __thread int a __attribute__((tls_model ("initial-exec")));
2190 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -Werror conftest.c >&AS_MESSAGE_LOG_FD]); then
2191 libc_cv_gcc_tls_model_attr=yes
2193 libc_cv_gcc_tls_model_attr=no
2196 if test "$libc_cv_gcc_tls_model_attr" = no; then
2197 AC_MSG_ERROR([support for the tls_model attribute is required])
2200 if test -n "$submachine"; then
2201 AC_CACHE_CHECK([for compiler option for CPU variant],
2202 libc_cv_cc_submachine, [dnl
2203 libc_cv_cc_submachine=no
2204 for opt in "-march=$submachine" "-mcpu=$submachine"; do
2205 if AC_TRY_COMMAND([${CC-cc} $opt -xc /dev/null -S -o /dev/null]); then
2206 libc_cv_cc_submachine="$opt"
2210 if test "x$libc_cv_cc_submachine" = xno; then
2211 AC_MSG_ERROR([${CC-cc} does not support $submachine])
2214 AC_SUBST(libc_cv_cc_submachine)
2216 dnl Check whether we have the gd library available.
2217 AC_MSG_CHECKING(for libgd)
2218 if test "$with_gd" != "no"; then
2219 old_CFLAGS="$CFLAGS"
2220 CFLAGS="$CFLAGS $libgd_include"
2221 old_LDFLAGS="$LDFLAGS"
2222 LDFLAGS="$LDFLAGS $libgd_ldflags"
2224 LIBS="$LIBS -lgd -lpng -lz -lm"
2225 AC_TRY_LINK([#include <gd.h>], [gdImagePng (0, 0)], LIBGD=yes, LIBGD=no)
2226 CFLAGS="$old_CFLAGS"
2227 LDFLAGS="$old_LDFLAGS"
2232 AC_MSG_RESULT($LIBGD)
2236 if test x$with_selinux = xno ; then
2239 # See if we have the SELinux library
2240 AC_CHECK_LIB(selinux, is_selinux_enabled,
2241 have_selinux=yes, have_selinux=no)
2242 # See if we have the SELinux header with the NSCD permissions in it.
2243 if test x$have_selinux = xyes ; then
2244 AC_MSG_CHECKING([for NSCD Flask permissions in selinux/av_permissions.h])
2245 AC_TRY_COMPILE([#include <selinux/av_permissions.h>],
2246 [#ifdef NSCD__SHMEMHOST
2249 #error NSCD__SHMEMHOST not defined
2251 have_selinux=yes, have_selinux=no)
2252 AC_MSG_RESULT($have_selinux)
2255 if test x$with_selinux = xyes ; then
2256 if test x$have_selinux = xno ; then
2257 AC_MSG_ERROR([SELinux explicitly required, but sufficiently recent SELinux library not found])
2261 # Check if we're building with SELinux support.
2262 if test "x$have_selinux" = xyes; then
2263 AC_DEFINE(HAVE_SELINUX, 1, [SELinux support])
2265 # See if we have the libaudit library
2266 AC_CHECK_LIB(audit, audit_log_user_avc_message,
2267 have_libaudit=yes, have_libaudit=no)
2268 if test "x$have_libaudit" = xyes; then
2269 AC_DEFINE(HAVE_LIBAUDIT, 1, [SELinux libaudit support])
2271 AC_SUBST(have_libaudit)
2273 # See if we have the libcap library
2274 AC_CHECK_LIB(cap, cap_init, have_libcap=yes, have_libcap=no)
2275 if test "x$have_libcap" = xyes; then
2276 AC_DEFINE(HAVE_LIBCAP, 1, [SELinux libcap support])
2278 AC_SUBST(have_libcap)
2280 AC_SUBST(have_selinux)
2282 dnl check for the size of 'long double'.
2283 AC_CHECK_SIZEOF(long double, 0)
2284 sizeof_long_double=$ac_cv_sizeof_long_double
2285 AC_SUBST(sizeof_long_double)
2287 ### End of automated tests.
2288 ### Now run sysdeps configure fragments.
2290 # They also can set these variables.
2292 ldd_rewrite_script=no
2293 libc_cv_sysconfdir=$sysconfdir
2294 libc_cv_gcc_unwind_find_fde=no
2297 # Iterate over all the sysdep directories we will use, running their
2298 # configure fragments.
2299 for dir in $sysnames; do
2302 *) dest=$srcdir/$dir ;;
2304 if test -r $dest/configure; then
2305 AC_MSG_RESULT(running configure fragment for $dir)
2310 if test x$libc_cv_gcc_unwind_find_fde = xyes; then
2311 AC_DEFINE(EXPORT_UNWIND_FIND_FDE)
2313 AC_SUBST(libc_cv_gcc_unwind_find_fde)
2315 # Test for old glibc 2.0.x headers so that they can be removed properly
2316 # Search only in includedir.
2317 AC_MSG_CHECKING(for old glibc 2.0.x headers)
2318 if eval test -f "${includedir}/elfclass.h" -a -f "${includedir}/fcntlbits.h"
2320 old_glibc_headers=yes
2322 old_glibc_headers=no
2324 AC_MSG_RESULT($old_glibc_headers)
2325 if test ${old_glibc_headers} = yes; then
2326 AC_MSG_WARN(*** During \"make install\" old headers from glibc 2.0.x will)
2327 AC_MSG_WARN(*** be removed.)
2329 AC_SUBST(old_glibc_headers)
2331 AC_SUBST(libc_cv_slibdir)
2332 AC_SUBST(libc_cv_localedir)
2333 AC_SUBST(libc_cv_sysconfdir)
2334 AC_SUBST(libc_cv_rootsbindir)
2335 AC_SUBST(libc_cv_forced_unwind)
2337 dnl sysdeps/CPU/configure.in checks set this via arch-specific asm tests
2338 AC_SUBST(libc_cv_cpp_asm_debuginfo)
2339 AC_SUBST(libc_cv_cc_sse4)
2340 AC_SUBST(libc_cv_cc_avx)
2341 AC_SUBST(libc_cv_cc_novzeroupper)
2342 AC_SUBST(libc_cv_as_i686)
2344 AC_SUBST(use_ldconfig)
2345 AC_SUBST(ldd_rewrite_script)
2347 AC_SUBST(elf) AC_SUBST(xcoff)
2348 if test $elf = yes; then
2351 if test $xcoff = yes; then
2352 AC_DEFINE(HAVE_XCOFF)
2357 if test $shared = default; then
2361 AC_CACHE_CHECK([whether -fPIC is default], libc_cv_pic_default,
2362 [libc_cv_pic_default=yes
2363 cat > conftest.c <<EOF
2364 #if defined __PIC__ || defined __pic__ || defined PIC || defined pic
2365 # error PIC is default.
2368 if eval "${CC-cc} -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
2369 libc_cv_pic_default=no
2372 AC_SUBST(libc_cv_pic_default)
2377 AC_SUBST(static_nss)
2378 AC_SUBST(nopic_initfini)
2382 dnl See sysdeps/mach/configure.in for this variable.
2383 AC_SUBST(mach_interface_list)
2385 if test "`(cd $srcdir; pwd)`" = "`pwd`"; then
2388 config_makefile=Makefile
2391 VERSION=`sed -n -e 's/^#define VERSION "\([^"]*\)"/\1/p' < $srcdir/version.h`
2392 RELEASE=`sed -n -e 's/^#define RELEASE "\([^"]*\)"/\1/p' < $srcdir/version.h`
2396 AC_CONFIG_FILES([config.make ${config_makefile}])
2397 AC_CONFIG_COMMANDS([default],[[
2398 case $CONFIG_FILES in *config.make*)
2399 echo "$config_vars" >> config.make;;
2401 test -d bits || mkdir bits]],[[config_vars='$config_vars']])