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
1064 cxxversion=`$CXX -dumpversion 2>&AS_MESSAGE_LOG_FD` &&
1065 cxxmachine=`$CXX -dumpmachine 2>&AS_MESSAGE_LOG_FD` &&
1066 cxxheaders=`$CXX -print-file-name=../../../../include/c++/`"$cxxversion" &&
1067 CXX_SYSINCLUDES="-isystem $cxxheaders \
1068 -isystem $cxxheaders/$cxxmachine -isystem $cxxheaders/backward"
1071 AC_SUBST(SYSINCLUDES)
1072 AC_SUBST(CXX_SYSINCLUDES)
1074 # ranlib is never necessary on Linux and Hurd systems
1077 # Test if LD_LIBRARY_PATH contains the notation for the current directory
1078 # since this would lead to problems installing/building glibc.
1079 # LD_LIBRARY_PATH contains the current directory if one of the following
1081 # - one of the terminals (":" and ";") is the first or last sign
1082 # - two terminals occur directly after each other
1083 # - the path contains an element with a dot in it
1084 AC_MSG_CHECKING(LD_LIBRARY_PATH variable)
1086 case ${LD_LIBRARY_PATH} in
1087 [:\;]* | *[:\;] | *[:\;][:\;]* | *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* )
1088 ld_library_path_setting="contains current directory"
1091 ld_library_path_setting="ok"
1095 AC_MSG_RESULT($ld_library_path_setting)
1096 if test "$ld_library_path_setting" != "ok"; then
1098 *** LD_LIBRARY_PATH shouldn't contain the current directory when
1099 *** building glibc. Please change the environment variable
1100 *** and run configure again.])
1103 AC_CACHE_CHECK(whether GCC supports -static-libgcc, libc_cv_gcc_static_libgcc, [dnl
1104 if $CC -v -static-libgcc 2>&1 | grep -q 'unrecognized option.*static-libgcc'; then
1105 libc_cv_gcc_static_libgcc=
1107 libc_cv_gcc_static_libgcc=-static-libgcc
1109 AC_SUBST(libc_cv_gcc_static_libgcc)
1111 AC_PATH_PROG(BASH_SHELL, bash, no)
1112 if test "$BASH_SHELL" != no &&
1113 $BASH_SHELL -c 'test "$BASH_VERSINFO" \
1114 && test "$BASH_VERSINFO" -ge 2 >&/dev/null'; then
1115 libc_cv_have_bash2=yes
1117 libc_cv_have_bash2=no
1119 AC_SUBST(libc_cv_have_bash2)
1121 dnl We need a ksh compatible shell for tzselect.
1122 if test "$BASH_SHELL" = no; then
1123 AC_PATH_PROG(KSH, ksh, no)
1124 if test "$KSH" = no; then
1127 libc_cv_have_ksh=yes
1132 libc_cv_have_ksh=yes
1134 AC_SUBST(libc_cv_have_ksh)
1137 AC_PATH_PROG(PERL, perl, no)
1138 if test "$PERL" != no &&
1139 (eval `$PERL -V:apiversion`; test `expr "$apiversion" \< 5` -ne 0); then
1142 AC_PATH_PROG(INSTALL_INFO, install-info, no,
1143 $PATH:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin)
1144 AC_PATH_PROG(BISON, bison, no, $PATH:/usr/local/bin:/usr/bin:/bin)
1146 AC_CACHE_CHECK(for signed size_t type, libc_cv_signed_size_t, [dnl
1147 echo '#include <stddef.h>
1148 FOOBAR __SIZE_TYPE__ FOOBAR' > conftest.c
1149 if eval "$ac_cpp conftest.c 2>/dev/null" \
1150 | grep '^FOOBAR.*unsigned.*FOOBAR$' >/dev/null; then
1151 libc_cv_signed_size_t=no
1153 libc_cv_signed_size_t=yes
1156 if test $libc_cv_signed_size_t = yes; then
1157 dnl Do this by hand instead of AC_DEFINE so can add #undef to avoid warnings.
1158 cat >> confdefs.h <<\EOF
1159 #undef __SIZE_TYPE__
1160 #define __SIZE_TYPE__ unsigned
1164 AC_CACHE_CHECK(for libc-friendly stddef.h, libc_cv_friendly_stddef, [dnl
1166 [#define __need_size_t
1167 #define __need_wchar_t
1170 #include <stddef.h>], [size_t size; wchar_t wchar;
1172 #error stddef.h ignored __need_*
1174 if (&size == NULL || &wchar == NULL) abort ();],
1175 libc_cv_friendly_stddef=yes,
1176 libc_cv_friendly_stddef=no)])
1177 if test $libc_cv_friendly_stddef = yes; then
1178 config_vars="$config_vars
1179 override stddef.h = # The installed <stddef.h> seems to be libc-friendly."
1182 AC_CACHE_CHECK(whether we need to use -P to assemble .S files,
1183 libc_cv_need_minus_P, [dnl
1184 cat > conftest.S <<EOF
1185 #include "confdefs.h"
1186 /* Nothing whatsoever. */
1188 if AC_TRY_COMMAND(${CC-cc} $CPPFLAGS $ASFLAGS -c conftest.S 1>&AS_MESSAGE_LOG_FD); then
1189 libc_cv_need_minus_P=no
1191 libc_cv_need_minus_P=yes
1194 if test $libc_cv_need_minus_P = yes; then
1195 config_vars="$config_vars
1196 asm-CPPFLAGS = -P # The assembler can't grok cpp's # line directives."
1199 AC_CACHE_CHECK(for .set assembler directive, libc_cv_asm_set_directive, [dnl
1200 cat > conftest.s <<EOF
1203 .set glibc_conftest_frobozz,foo
1204 $libc_cv_asm_global_directive glibc_conftest_frobozz
1206 # The alpha-dec-osf1 assembler gives only a warning for `.set'
1207 # (but it doesn't work), so we must do a linking check to be sure.
1208 cat > conftest1.c <<\EOF
1209 extern int glibc_conftest_frobozz;
1210 void _start() { glibc_conftest_frobozz = 1; }
1212 if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
1213 -nostartfiles -nostdlib \
1214 -o conftest conftest.s conftest1.c 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
1215 libc_cv_asm_set_directive=yes
1217 libc_cv_asm_set_directive=no
1220 if test $libc_cv_asm_set_directive = yes; then
1221 AC_DEFINE(HAVE_ASM_SET_DIRECTIVE)
1224 AC_CACHE_CHECK(for assembler gnu_unique_object symbol type,
1225 libc_cv_asm_unique_object, [dnl
1226 cat > conftest.s <<EOF
1229 .type _sym, ${libc_cv_asm_type_prefix}gnu_unique_object
1231 if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
1232 libc_cv_asm_unique_object=yes
1234 libc_cv_asm_unique_object=no
1237 if test $libc_cv_asm_unique_object = yes; then
1238 AC_DEFINE(HAVE_ASM_UNIQUE_OBJECT)
1241 AC_CACHE_CHECK(for .symver assembler directive, libc_cv_asm_symver_directive,
1242 [cat > conftest.s <<EOF
1245 .symver _sym,sym@VERS
1247 if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
1248 libc_cv_asm_symver_directive=yes
1250 libc_cv_asm_symver_directive=no
1253 AC_CACHE_CHECK(for ld --version-script, libc_cv_ld_version_script_option, [dnl
1254 if test $libc_cv_asm_symver_directive = yes; then
1255 cat > conftest.s <<EOF
1258 .symver _sym,sym@VERS
1260 cat > conftest.map <<EOF
1269 if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
1270 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $LDFLAGS -shared
1271 -o conftest.so conftest.o
1272 -nostartfiles -nostdlib
1273 -Wl,--version-script,conftest.map
1274 1>&AS_MESSAGE_LOG_FD]);
1276 libc_cv_ld_version_script_option=yes
1278 libc_cv_ld_version_script_option=no
1281 libc_cv_ld_version_script_option=no
1284 libc_cv_ld_version_script_option=no
1287 if test $shared != no &&
1288 test $libc_cv_asm_symver_directive = yes &&
1289 test $libc_cv_ld_version_script_option = yes &&
1290 test $enable_versioning = yes; then
1292 AC_DEFINE(DO_VERSIONING)
1296 AC_SUBST(VERSIONING)
1298 if test $elf = yes && test $shared != no && test $VERSIONING = no; then
1300 *** WARNING: You should not compile GNU libc without versioning. Not using
1301 *** versioning will introduce incompatibilities so that old binaries
1302 *** will not run anymore.
1303 *** For versioning you need recent binutils (binutils-2.8.1.0.23 or newer)."
1305 if test $elf = yes; then
1306 AC_CACHE_CHECK(for .previous assembler directive,
1307 libc_cv_asm_previous_directive, [dnl
1308 cat > conftest.s <<EOF
1309 .section foo_section
1312 if AC_TRY_COMMAND(${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
1313 libc_cv_asm_previous_directive=yes
1315 libc_cv_asm_previous_directive=no
1318 if test $libc_cv_asm_previous_directive = yes; then
1319 AC_DEFINE(HAVE_ASM_PREVIOUS_DIRECTIVE)
1321 AC_CACHE_CHECK(for .popsection assembler directive,
1322 libc_cv_asm_popsection_directive, [dnl
1323 cat > conftest.s <<EOF
1324 .pushsection foo_section
1327 if AC_TRY_COMMAND(${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
1328 libc_cv_asm_popsection_directive=yes
1330 libc_cv_asm_popsection_directive=no
1333 if test $libc_cv_asm_popsection_directive = yes; then
1334 AC_DEFINE(HAVE_ASM_POPSECTION_DIRECTIVE)
1337 AC_CACHE_CHECK(for .protected and .hidden assembler directive,
1338 libc_cv_asm_protected_directive, [dnl
1339 cat > conftest.s <<EOF
1345 if AC_TRY_COMMAND(${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
1346 libc_cv_asm_protected_directive=yes
1348 AC_MSG_ERROR(assembler support for symbol visibility is required)
1352 if test $libc_cv_asm_protected_directive = yes; then
1353 AC_CACHE_CHECK(whether __attribute__((visibility())) is supported,
1354 libc_cv_visibility_attribute,
1355 [cat > conftest.c <<EOF
1356 int foo __attribute__ ((visibility ("hidden"))) = 1;
1357 int bar __attribute__ ((visibility ("protected"))) = 1;
1359 libc_cv_visibility_attribute=no
1360 if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
1361 if grep '\.hidden.*foo' conftest.s >/dev/null; then
1362 if grep '\.protected.*bar' conftest.s >/dev/null; then
1363 libc_cv_visibility_attribute=yes
1367 rm -f conftest.{c,s}
1369 if test $libc_cv_visibility_attribute != yes; then
1370 AC_MSG_ERROR(compiler support for visibility attribute is required)
1374 if test $libc_cv_visibility_attribute = yes; then
1375 AC_CACHE_CHECK(for broken __attribute__((visibility())),
1376 libc_cv_broken_visibility_attribute,
1377 [cat > conftest.c <<EOF
1379 int bar (int x) __asm__ ("foo") __attribute__ ((visibility ("hidden")));
1380 int bar (int x) { return x; }
1382 libc_cv_broken_visibility_attribute=yes
1383 if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
1385 if grep '\.hidden[ _]foo' conftest.s >/dev/null; then
1387 libc_cv_broken_visibility_attribute=no
1390 rm -f conftest.c conftest.s
1392 if test $libc_cv_broken_visibility_attribute = yes; then
1393 AC_MSG_ERROR(working compiler support for visibility attribute is required)
1397 AC_CACHE_CHECK(for broken __attribute__((alias())),
1398 libc_cv_broken_alias_attribute,
1399 [cat > conftest.c <<EOF
1400 extern int foo (int x) __asm ("xyzzy");
1401 int bar (int x) { return x; }
1402 extern __typeof (bar) foo __attribute ((weak, alias ("bar")));
1404 extern __typeof (dfoo) dfoo __asm ("abccb");
1407 libc_cv_broken_alias_attribute=yes
1408 if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
1409 if grep 'xyzzy' conftest.s >/dev/null &&
1410 grep 'abccb' conftest.s >/dev/null; then
1411 libc_cv_broken_alias_attribute=no
1414 rm -f conftest.c conftest.s
1416 if test $libc_cv_broken_alias_attribute = yes; then
1417 AC_MSG_ERROR(working alias attribute support required)
1420 if test $libc_cv_visibility_attribute = yes; then
1421 AC_CACHE_CHECK(whether to put _rtld_local into .sdata section,
1422 libc_cv_have_sdata_section,
1423 [echo "int i;" > conftest.c
1424 libc_cv_have_sdata_section=no
1425 if ${CC-cc} $LDFLAGS -fPIC -shared -Wl,--verbose conftest.c -o conftest.so 2>&1 \
1426 | grep '\.sdata' >/dev/null; then
1427 libc_cv_have_sdata_section=yes
1429 rm -f conftest.c conftest.so
1431 if test $libc_cv_have_sdata_section = yes; then
1432 AC_DEFINE(HAVE_SDATA_SECTION)
1436 AC_CACHE_CHECK(for .preinit_array/.init_array/.fini_array support,
1437 libc_cv_initfini_array, [dnl
1438 cat > conftest.c <<EOF
1439 int _start (void) { return 0; }
1440 int __start (void) { return 0; }
1441 int foo (void) { return 1; }
1442 int (*fp) (void) __attribute__ ((section (".init_array"))) = foo;
1444 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -o conftest conftest.c
1445 -static -nostartfiles -nostdlib 1>&AS_MESSAGE_LOG_FD])
1447 if $READELF -S conftest | fgrep INIT_ARRAY > /dev/null; then
1448 libc_cv_initfini_array=yes
1450 libc_cv_initfini_array=no
1453 libc_cv_initfini_array=no
1456 if test $libc_cv_initfini_array != yes; then
1457 AC_MSG_ERROR([Need linker with .init_array/.fini_array support.])
1460 AC_CACHE_CHECK(whether to use .ctors/.dtors header and trailer,
1461 libc_cv_ctors_header, [dnl
1462 libc_cv_ctors_header=yes
1464 __attribute__ ((constructor)) void ctor (void) { puts("ctor"); }
1465 __attribute__ ((destructor)) void dtor (void) { puts("dtor"); }
1468 AS_IF([$READELF -WS conftest$ac_exeext | $AWK '
1469 { gsub(/\@<:@ */, "@<:@") }
1470 $2 == ".ctors" || $2 == ".dtors" {
1471 size = strtonum("0x" $6)
1472 align = strtonum("0x" $NF)
1474 stub@<:@$2@:>@ = size == align * 2
1477 ctors_ok = !seen@<:@".ctors"@:>@ || stub@<:@".ctors"@:>@
1478 dtors_ok = !seen@<:@".dtors"@:>@ || stub@<:@".dtors"@:>@
1479 exit ((ctors_ok && dtors_ok) ? 0 : 1)
1481 '], [libc_cv_ctors_header=no])
1483 AC_MSG_ERROR([missing __attribute__ ((constructor)) support??])
1486 if test $libc_cv_ctors_header = no; then
1487 AC_DEFINE(NO_CTORS_DTORS_SECTIONS)
1490 AC_CACHE_CHECK(for libunwind-support in compiler,
1491 libc_cv_cc_with_libunwind, [
1492 cat > conftest.c <<EOF
1493 int main (void) { return 0; }
1495 if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -static -o conftest \
1496 conftest.c -v 2>&1 >/dev/null | grep -q " -lunwind "; then
1497 libc_cv_cc_with_libunwind=yes
1499 libc_cv_cc_with_libunwind=no
1502 AC_SUBST(libc_cv_cc_with_libunwind)
1503 if test $libc_cv_cc_with_libunwind = yes; then
1504 AC_DEFINE(HAVE_CC_WITH_LIBUNWIND)
1507 AC_CACHE_CHECK(for -z nodelete option,
1508 libc_cv_z_nodelete, [dnl
1509 cat > conftest.c <<EOF
1510 int _start (void) { return 42; }
1512 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1513 -fPIC -shared -o conftest.so conftest.c
1514 -nostartfiles -nostdlib
1515 -Wl,--enable-new-dtags,-z,nodelete 1>&AS_MESSAGE_LOG_FD])
1517 libc_cv_z_nodelete=yes
1519 AC_MSG_ERROR(linker with -z nodelete support required)
1523 AC_CACHE_CHECK(for -z nodlopen option,
1524 libc_cv_z_nodlopen, [dnl
1525 cat > conftest.c <<EOF
1526 int _start (void) { return 42; }
1528 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1529 -fPIC -shared -o conftest.so conftest.c
1530 -nostartfiles -nostdlib
1531 -Wl,--enable-new-dtags,-z,nodlopen 1>&AS_MESSAGE_LOG_FD])
1533 libc_cv_z_nodlopen=yes
1535 AC_MSG_ERROR(linker with -z nodlopen support required)
1539 AC_CACHE_CHECK(for -z initfirst option,
1540 libc_cv_z_initfirst, [dnl
1541 cat > conftest.c <<EOF
1542 int _start (void) { return 42; }
1544 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1545 -fPIC -shared -o conftest.so conftest.c
1546 -nostartfiles -nostdlib
1547 -Wl,--enable-new-dtags,-z,initfirst 1>&AS_MESSAGE_LOG_FD])
1549 libc_cv_z_initfirst=yes
1551 AC_MSG_ERROR(linker with -z initfirst support required)
1555 # Add-on fragments can set these for other machines.
1556 libc_commonpagesize=${libc_commonpagesize:-no}
1557 libc_relro_required=${libc_relro_required:-no}
1558 case "$base_machine" in
1559 i[[34567]]86 | x86_64 | powerpc* | s390*)
1560 libc_commonpagesize=0x1000
1561 libc_relro_required=yes
1564 libc_commonpagesize=0x2000
1565 libc_relro_required=yes
1568 libc_commonpagesize=0x4000
1571 libc_commonpagesize=0x10000
1572 libc_relro_required=yes
1576 if test $libc_commonpagesize != no; then
1577 AC_CACHE_CHECK(for -z relro option,
1578 libc_cv_z_relro, [dnl
1580 AC_LANG_CONFTEST([AC_LANG_SOURCE([[
1581 int _start (void) { return 42; }
1582 extern void _exit (int);
1583 /* Since these pointers are const, they should go in rodata.
1584 Since they refer to functions that have to be resolved by
1585 dynamic linking, they should instead go in RELRO data. */
1586 const void *const relro[] = { &_start, &_exit, 0 };
1587 /* GNU ld fails to produce RELRO data when it's very small and there is no
1588 normal writable data following it, or if only uninitialized (.bss) data
1589 follows it, or only very small writable data. */
1590 int data[0x10000] = { 1, };
1592 cat > conftest.awk <<\EOF
1595 commonpagesize = strtonum(commonpagesize)
1597 { print "LINE:", $0 > "/dev/stderr" }
1599 vaddr = strtonum($3)
1600 memsz = strtonum($6)
1602 printf "vaddr %#x memsz %#x end %#x commonpagesize %#x\n", \
1603 vaddr, memsz, end, commonpagesize > "/dev/stderr"
1604 result = (end % commonpagesize == 0) ? "yes" : "broken"
1606 END { print result }
1608 AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1609 -fPIC -shared -o conftest.so conftest.c
1610 -nostartfiles -nostdlib
1611 -Wl,-z,relro 1>&AS_MESSAGE_LOG_FD]) &&
1612 AC_TRY_COMMAND([$READELF -Wl conftest.so > conftest.ph]) &&
1614 $AWK -v commonpagesize=$libc_commonpagesize -f conftest.awk
1615 conftest.ph > conftest.cps
1617 libc_cv_z_relro=`cat conftest.cps 2>&AS_MESSAGE_LOG_FD`
1619 if { test "x$libc_relro_required" = xyes &&
1620 test "x$libc_cv_z_relro" != xyes
1623 AC_MSG_ERROR(linker with -z relro support required)
1626 AC_MSG_WARN([missing architecture parameter to check for working -z relro])
1629 AC_CACHE_CHECK(for -Bgroup option,
1630 libc_cv_Bgroup, [dnl
1631 cat > conftest.c <<EOF
1632 int _start (void) { return 42; }
1634 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1635 -fPIC -shared -o conftest.so conftest.c
1636 -Wl,-Bgroup -nostdlib 1>&AS_MESSAGE_LOG_FD])
1643 AC_SUBST(libc_cv_Bgroup)
1645 AC_CACHE_CHECK(for libgcc_s suffix,
1646 libc_cv_libgcc_s_suffix, [dnl
1647 cat > conftest.c <<EOF
1648 int main (void) { return 0; }
1651 libc_cv_libgcc_s_suffix=`${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
1652 -fPIC -shared -shared-libgcc -o conftest.so \
1653 conftest.c -v 2>&1 >/dev/null \
1654 | sed -n 's/^.* -lgcc_s\([^ ]*\) .*$/\1/p'`
1657 AC_SUBST(libc_cv_libgcc_s_suffix)
1659 AC_CACHE_CHECK(for --as-needed option,
1660 libc_cv_as_needed, [dnl
1661 cat > conftest.c <<EOF
1662 int main (void) { return 0; }
1664 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1665 -fPIC -shared -o conftest.so conftest.c
1666 -lgcc_s$libc_cv_libgcc_s_suffix -Wl,--as-needed
1667 -nostdlib 1>&AS_MESSAGE_LOG_FD])
1669 libc_cv_as_needed=yes
1671 libc_cv_as_needed=no
1674 AC_SUBST(libc_cv_as_needed)
1677 AC_CACHE_CHECK(whether --noexecstack is desirable for .S files,
1678 libc_cv_as_noexecstack, [dnl
1679 cat > conftest.c <<EOF
1682 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS
1683 -S -o conftest.s conftest.c 1>&AS_MESSAGE_LOG_FD]) \
1684 && grep -q .note.GNU-stack conftest.s \
1685 && AC_TRY_COMMAND([${CC-cc} $ASFLAGS -Wa,--noexecstack
1686 -c -o conftest.o conftest.s 1>&AS_MESSAGE_LOG_FD])
1688 libc_cv_as_noexecstack=yes
1690 libc_cv_as_noexecstack=no
1693 if test $libc_cv_as_noexecstack = yes; then
1694 ASFLAGS_config="$ASFLAGS_config -Wa,--noexecstack"
1696 AC_SUBST(ASFLAGS_config)
1698 AC_CACHE_CHECK(for -z combreloc,
1699 libc_cv_z_combreloc, [dnl
1700 cat > conftest.c <<EOF
1701 extern int bar (int);
1703 int foo (void) { return bar (mumble); }
1705 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1706 -fPIC -shared -o conftest.so conftest.c
1707 -nostdlib -nostartfiles
1708 -Wl,-z,combreloc 1>&AS_MESSAGE_LOG_FD])
1710 dnl The following test is a bit weak. We must use a tool which can test
1711 dnl cross-platform since the gcc used can be a cross compiler. Without
1712 dnl introducing new options this is not easily doable. Instead use a tool
1713 dnl which always is cross-platform: readelf. To detect whether -z combreloc
1714 dnl look for a section named .rel.dyn.
1715 if $READELF -S conftest.so | grep '\.rel\(a\|\)\.dyn' > /dev/null; then
1716 libc_cv_z_combreloc=yes
1718 libc_cv_z_combreloc=no
1721 libc_cv_z_combreloc=no
1724 if test "$libc_cv_z_combreloc" = yes; then
1725 AC_DEFINE(HAVE_Z_COMBRELOC)
1727 AC_SUBST(libc_cv_z_combreloc)
1729 AC_CACHE_CHECK(for -z execstack,
1730 libc_cv_z_execstack, [dnl
1731 cat > conftest.c <<EOF
1732 int _start (void) { return 42; }
1734 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1735 -fPIC -shared -o conftest.so conftest.c
1736 -Wl,-z,execstack -nostdlib
1737 1>&AS_MESSAGE_LOG_FD])
1739 libc_cv_z_execstack=yes
1741 libc_cv_z_execstack=no
1744 AC_SUBST(libc_cv_z_execstack)
1746 AC_CACHE_CHECK(for -fpie, libc_cv_fpie, [dnl
1747 cat > conftest.c <<EOF
1749 main () { return 0;}
1751 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -pie -fpie
1752 -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD])
1760 AC_SUBST(libc_cv_fpie)
1762 AC_CACHE_CHECK(for --hash-style option,
1763 libc_cv_hashstyle, [dnl
1764 cat > conftest.c <<EOF
1765 int _start (void) { return 42; }
1767 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1768 -fPIC -shared -o conftest.so conftest.c
1769 -Wl,--hash-style=both -nostdlib 1>&AS_MESSAGE_LOG_FD])
1771 libc_cv_hashstyle=yes
1773 libc_cv_hashstyle=no
1776 AC_SUBST(libc_cv_hashstyle)
1778 # The linker's default -shared behavior is good enough if it
1779 # does these things that our custom linker scripts ensure that
1780 # all allocated NOTE sections come first.
1781 if test "$use_default_link" = default; then
1782 AC_CACHE_CHECK([for sufficient default -shared layout],
1783 libc_cv_use_default_link, [dnl
1784 libc_cv_use_default_link=no
1785 cat > conftest.s <<\EOF
1786 .section .note.a,"a",%note
1791 .section .note.b,"a",%note
1797 if AC_TRY_COMMAND([dnl
1798 ${CC-cc} $ASFLAGS -shared -o conftest.so conftest.s 1>&AS_MESSAGE_LOG_FD]) &&
1799 ac_try=`$READELF -S conftest.so | sed -n \
1801 s/^ *\[ *[1-9][0-9]*\] *\([^ ][^ ]*\) *\([^ ][^ ]*\) .*$/\2 \1/
1807 libc_seen_a=no libc_seen_b=no
1809 while test $# -ge 2 -a "$1" = NOTE; do
1811 .note.a) libc_seen_a=yes ;;
1812 .note.b) libc_seen_b=yes ;;
1816 case "$libc_seen_a$libc_seen_b" in
1818 libc_cv_use_default_link=yes
1821 echo >&AS_MESSAGE_LOG_FD "\
1822 $libc_seen_a$libc_seen_b from:
1828 use_default_link=$libc_cv_use_default_link
1832 AC_CACHE_CHECK(linker output format, libc_cv_output_format, [dnl
1833 if libc_cv_output_format=`
1834 ${CC-cc} -nostartfiles -nostdlib -Wl,--print-output-format 2>&AS_MESSAGE_LOG_FD`
1838 libc_cv_output_format=
1840 test -n "$libc_cv_output_format" || libc_cv_output_format=unknown])
1841 AC_SUBST(libc_cv_output_format)
1843 AC_CACHE_CHECK(for -fno-toplevel-reorder -fno-section-anchors, libc_cv_fno_toplevel_reorder, [dnl
1844 cat > conftest.c <<EOF
1847 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -fno-toplevel-reorder -fno-section-anchors
1848 conftest.c 1>&AS_MESSAGE_LOG_FD])
1850 libc_cv_fno_toplevel_reorder=yes
1852 libc_cv_fno_toplevel_reorder=no
1855 if test $libc_cv_fno_toplevel_reorder = yes; then
1856 fno_unit_at_a_time="-fno-toplevel-reorder -fno-section-anchors"
1858 fno_unit_at_a_time=-fno-unit-at-a-time
1860 AC_SUBST(fno_unit_at_a_time)
1862 AC_CACHE_CHECK(for -fstack-protector, libc_cv_ssp, [dnl
1863 cat > conftest.c <<EOF
1865 main () { return 0;}
1867 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -Werror -fstack-protector
1868 -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD])
1875 AC_SUBST(libc_cv_ssp)
1877 AC_CACHE_CHECK(for -fgnu89-inline, libc_cv_gnu89_inline, [dnl
1878 cat > conftest.c <<EOF
1880 #ifdef __GNUC_GNU_INLINE__
1881 main () { return 0;}
1886 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -std=gnu99 -fgnu89-inline
1887 -o conftest.s conftest.c 1>&AS_MESSAGE_LOG_FD])
1889 libc_cv_gnu89_inline=yes
1891 libc_cv_gnu89_inline=no
1894 if test $libc_cv_gnu89_inline = yes; then
1895 gnu89_inline=-fgnu89-inline
1899 AC_SUBST(gnu89_inline)
1901 if test $elf != yes; then
1902 AC_CACHE_CHECK(for .init and .fini sections, libc_cv_have_initfini,
1903 [AC_TRY_COMPILE(, [asm (".section .init");
1904 asm (".section .fini");
1905 asm ("${libc_cv_dot_text}");],
1906 libc_cv_have_initfini=yes,
1907 libc_cv_have_initfini=no)])
1908 AC_SUBST(libc_cv_have_initfini)dnl
1909 if test $libc_cv_have_initfini = yes; then
1910 AC_DEFINE(HAVE_INITFINI)
1914 if test $elf = yes; then
1915 AC_CACHE_CHECK(whether cc puts quotes around section names,
1916 libc_cv_have_section_quotes,
1917 [cat > conftest.c <<EOF
1918 static const int foo
1919 __attribute__ ((section ("bar"))) = 1;
1921 if ${CC-cc} -S conftest.c -o conftest.s; then
1922 if grep '\.section.*"bar"' conftest.s >/dev/null; then
1923 libc_cv_have_section_quotes=yes
1925 libc_cv_have_section_quotes=no
1928 libc_cv_have_section_quotes=unknown
1930 rm -f conftest.{c,s}
1932 if test $libc_cv_have_section_quotes = yes; then
1933 AC_DEFINE(HAVE_SECTION_QUOTES)
1937 dnl AC_CHECK_ASM_UNDERSCORE([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
1938 AC_DEFUN(AC_CHECK_ASM_UNDERSCORE,
1939 [cat > conftest.$ac_ext <<EOF
1940 dnl This sometimes fails to find confdefs.h, for some reason.
1941 dnl [#]line $LINENO "[$]0"
1942 [#]line $LINENO "configure"
1943 #include "confdefs.h"
1944 void underscore_test(void) {
1947 if AC_TRY_EVAL(ac_compile); then
1948 if grep _underscore_test conftest* >/dev/null; then
1949 ifelse([$1], , :, [rm -f conftest*
1952 ifelse([$2], , , [rm -f conftest*
1956 echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD
1957 cat conftest.$ac_ext >&AS_MESSAGE_LOG_FD
1958 ifelse([$2], , , [rm -f conftest*
1963 if test $elf = yes; then
1964 libc_cv_asm_underscores=no
1966 if test $ac_cv_prog_cc_works = yes; then
1967 AC_CACHE_CHECK(for _ prefix on C symbol names, libc_cv_asm_underscores,
1968 [AC_TRY_LINK([asm ("_glibc_foobar:");], [glibc_foobar ();],
1969 libc_cv_asm_underscores=yes,
1970 libc_cv_asm_underscores=no)])
1972 AC_CACHE_CHECK(for _ prefix on C symbol names, libc_cv_asm_underscores,
1973 [AC_CHECK_ASM_UNDERSCORE(libc_cv_asm_underscores=yes,
1974 libc_cv_asm_underscores=no)])
1977 if test $libc_cv_asm_underscores = no; then
1978 AC_DEFINE(NO_UNDERSCORES)
1981 if test $elf = yes; then
1982 libc_cv_weak_symbols=yes
1985 AC_CACHE_CHECK(for assembler .weak directive, libc_cv_asm_weak_directive,
1987 cat > conftest.s <<EOF
1989 ${libc_cv_asm_global_directive} foo
1992 .weak bar; bar = foo
1994 if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
1995 libc_cv_asm_weak_directive=yes
1997 libc_cv_asm_weak_directive=no
2001 if test $libc_cv_asm_weak_directive = no; then
2002 AC_CACHE_CHECK(for assembler .weakext directive,
2003 libc_cv_asm_weakext_directive,
2005 cat > conftest.s <<EOF
2007 ${libc_cv_asm_global_directive} foo
2011 ${libc_cv_asm_global_directive} baz
2014 if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
2015 libc_cv_asm_weakext_directive=yes
2017 libc_cv_asm_weakext_directive=no
2023 if test $libc_cv_asm_weak_directive = yes; then
2024 AC_DEFINE(HAVE_ASM_WEAK_DIRECTIVE)
2025 elif test $libc_cv_asm_weakext_directive = yes; then
2026 AC_DEFINE(HAVE_ASM_WEAKEXT_DIRECTIVE)
2029 AC_CACHE_CHECK(whether CFI directives are supported, libc_cv_asm_cfi_directives, [dnl
2031 sparc/sparc64*) cfi_offset=2047;;
2034 cat > conftest.s <<EOF
2036 .type func,%function
2040 .cfi_rel_offset 1, $cfi_offset
2043 if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
2044 libc_cv_asm_cfi_directives=yes
2046 libc_cv_asm_cfi_directives=no
2049 if test $libc_cv_asm_cfi_directives = yes; then
2050 AC_DEFINE(HAVE_ASM_CFI_DIRECTIVES)
2053 AC_CACHE_CHECK(for ld --no-whole-archive, libc_cv_ld_no_whole_archive, [dnl
2054 cat > conftest.c <<\EOF
2059 dnl No \ in command here because it ends up inside ''.
2060 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
2061 -nostdlib -nostartfiles -Wl,--no-whole-archive
2062 -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD]); then
2063 libc_cv_ld_no_whole_archive=yes
2065 libc_cv_ld_no_whole_archive=no
2068 if test $libc_cv_ld_no_whole_archive = no; then
2069 AC_MSG_ERROR([support for --no-whole-archive is needed])
2072 AC_CACHE_CHECK(for gcc -fexceptions, libc_cv_gcc_exceptions, [dnl
2073 cat > conftest.c <<\EOF
2078 dnl No \ in command here because it ends up inside ''.
2079 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
2080 -nostdlib -nostartfiles -fexceptions
2081 -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD]); then
2082 libc_cv_gcc_exceptions=yes
2084 libc_cv_gcc_exceptions=no
2087 if test $libc_cv_gcc_exceptions = yes; then
2088 exceptions=-fexceptions
2090 AC_SUBST(exceptions)dnl
2092 if test "$host_cpu" = powerpc ; then
2093 # Check for a bug present in at least versions 2.8.x of GCC
2094 # and versions 1.0.x of EGCS.
2095 AC_CACHE_CHECK(whether clobbering cr0 causes problems,libc_cv_c_asmcr0_bug,[dnl
2096 AC_TRY_COMPILE([int tester(int x) { asm ("" : : : "cc"); return x & 123; }],,
2097 libc_cv_c_asmcr0_bug='no',
2098 libc_cv_c_asmcr0_bug='yes')])
2099 if test "$libc_cv_c_asmcr0_bug" != 'no'; then
2100 AC_DEFINE(BROKEN_PPC_ASM_CR0)
2104 dnl Check whether compiler understands __builtin_expect.
2105 AC_CACHE_CHECK(for __builtin_expect, libc_cv_gcc_builtin_expect,
2106 [cat > conftest.c <<EOF
2107 #line $LINENO "configure"
2110 a = __builtin_expect (a, 10);
2111 return a == 10 ? 0 : 1;
2114 dnl No \ in command here because it ends up inside ''.
2115 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -nostdlib -nostartfiles
2116 -o conftest conftest.c -lgcc >&AS_MESSAGE_LOG_FD]); then
2117 libc_cv_gcc_builtin_expect=yes
2119 libc_cv_gcc_builtin_expect=no
2122 if test "$libc_cv_gcc_builtin_expect" = no; then
2123 AC_MSG_ERROR([support for __builtin_expect needed])
2126 AC_CACHE_CHECK(for __builtin_memset, libc_cv_gcc_builtin_memset, [dnl
2127 cat > conftest.c <<\EOF
2130 __builtin_memset (x, 0, 1000);
2134 if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | fgrep "memset" > /dev/null]);
2136 libc_cv_gcc_builtin_memset=no
2138 libc_cv_gcc_builtin_memset=yes
2141 if test "$libc_cv_gcc_builtin_memset" = yes ; then
2142 AC_DEFINE(HAVE_BUILTIN_MEMSET)
2145 AC_CACHE_CHECK(for redirection of built-in functions, libc_cv_gcc_builtin_redirection, [dnl
2146 cat > conftest.c <<\EOF
2147 extern char *strstr (const char *, const char *) __asm ("my_strstr");
2148 char *foo (const char *a, const char *b)
2150 return __builtin_strstr (a, b);
2154 if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | fgrep "my_strstr" > /dev/null]);
2156 libc_cv_gcc_builtin_redirection=yes
2158 libc_cv_gcc_builtin_redirection=no
2161 if test "$libc_cv_gcc_builtin_redirection" = no; then
2162 AC_MSG_ERROR([support for the symbol redirection needed])
2165 dnl Check whether the compiler supports the __thread keyword.
2166 AC_CACHE_CHECK([for __thread], libc_cv_gcc___thread,
2167 [cat > conftest.c <<\EOF
2168 __thread int a = 42;
2170 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c >&AS_MESSAGE_LOG_FD]); then
2171 libc_cv_gcc___thread=yes
2173 libc_cv_gcc___thread=no
2176 if test "$libc_cv_gcc___thread" = no; then
2177 AC_MSG_ERROR([support for the __thread keyword is required])
2180 dnl Check whether the compiler supports the tls_model attribute.
2181 AC_CACHE_CHECK([for tls_model attribute], libc_cv_gcc_tls_model_attr, [dnl
2182 cat > conftest.c <<\EOF
2183 extern __thread int a __attribute__((tls_model ("initial-exec")));
2185 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -Werror conftest.c >&AS_MESSAGE_LOG_FD]); then
2186 libc_cv_gcc_tls_model_attr=yes
2188 libc_cv_gcc_tls_model_attr=no
2191 if test "$libc_cv_gcc_tls_model_attr" = no; then
2192 AC_MSG_ERROR([support for the tls_model attribute is required])
2195 if test -n "$submachine"; then
2196 AC_CACHE_CHECK([for compiler option for CPU variant],
2197 libc_cv_cc_submachine, [dnl
2198 libc_cv_cc_submachine=no
2199 for opt in "-march=$submachine" "-mcpu=$submachine"; do
2200 if AC_TRY_COMMAND([${CC-cc} $opt -xc /dev/null -S -o /dev/null]); then
2201 libc_cv_cc_submachine="$opt"
2205 if test "x$libc_cv_cc_submachine" = xno; then
2206 AC_MSG_ERROR([${CC-cc} does not support $submachine])
2209 AC_SUBST(libc_cv_cc_submachine)
2211 dnl Check whether we have the gd library available.
2212 AC_MSG_CHECKING(for libgd)
2213 if test "$with_gd" != "no"; then
2214 old_CFLAGS="$CFLAGS"
2215 CFLAGS="$CFLAGS $libgd_include"
2216 old_LDFLAGS="$LDFLAGS"
2217 LDFLAGS="$LDFLAGS $libgd_ldflags"
2219 LIBS="$LIBS -lgd -lpng -lz -lm"
2220 AC_TRY_LINK([#include <gd.h>], [gdImagePng (0, 0)], LIBGD=yes, LIBGD=no)
2221 CFLAGS="$old_CFLAGS"
2222 LDFLAGS="$old_LDFLAGS"
2227 AC_MSG_RESULT($LIBGD)
2231 if test x$with_selinux = xno ; then
2234 # See if we have the SELinux library
2235 AC_CHECK_LIB(selinux, is_selinux_enabled,
2236 have_selinux=yes, have_selinux=no)
2237 # See if we have the SELinux header with the NSCD permissions in it.
2238 if test x$have_selinux = xyes ; then
2239 AC_MSG_CHECKING([for NSCD Flask permissions in selinux/av_permissions.h])
2240 AC_TRY_COMPILE([#include <selinux/av_permissions.h>],
2241 [#ifdef NSCD__SHMEMHOST
2244 #error NSCD__SHMEMHOST not defined
2246 have_selinux=yes, have_selinux=no)
2247 AC_MSG_RESULT($have_selinux)
2250 if test x$with_selinux = xyes ; then
2251 if test x$have_selinux = xno ; then
2252 AC_MSG_ERROR([SELinux explicitly required, but sufficiently recent SELinux library not found])
2256 # Check if we're building with SELinux support.
2257 if test "x$have_selinux" = xyes; then
2258 AC_DEFINE(HAVE_SELINUX, 1, [SELinux support])
2260 # See if we have the libaudit library
2261 AC_CHECK_LIB(audit, audit_log_user_avc_message,
2262 have_libaudit=yes, have_libaudit=no)
2263 if test "x$have_libaudit" = xyes; then
2264 AC_DEFINE(HAVE_LIBAUDIT, 1, [SELinux libaudit support])
2266 AC_SUBST(have_libaudit)
2268 # See if we have the libcap library
2269 AC_CHECK_LIB(cap, cap_init, have_libcap=yes, have_libcap=no)
2270 if test "x$have_libcap" = xyes; then
2271 AC_DEFINE(HAVE_LIBCAP, 1, [SELinux libcap support])
2273 AC_SUBST(have_libcap)
2275 AC_SUBST(have_selinux)
2277 dnl check for the size of 'long double'.
2278 AC_CHECK_SIZEOF(long double, 0)
2279 sizeof_long_double=$ac_cv_sizeof_long_double
2280 AC_SUBST(sizeof_long_double)
2282 ### End of automated tests.
2283 ### Now run sysdeps configure fragments.
2285 # They also can set these variables.
2287 ldd_rewrite_script=no
2288 libc_cv_sysconfdir=$sysconfdir
2289 libc_cv_gcc_unwind_find_fde=no
2292 # Iterate over all the sysdep directories we will use, running their
2293 # configure fragments.
2294 for dir in $sysnames; do
2297 *) dest=$srcdir/$dir ;;
2299 if test -r $dest/configure; then
2300 AC_MSG_RESULT(running configure fragment for $dir)
2305 if test x$libc_cv_gcc_unwind_find_fde = xyes; then
2306 AC_DEFINE(EXPORT_UNWIND_FIND_FDE)
2308 AC_SUBST(libc_cv_gcc_unwind_find_fde)
2310 # Test for old glibc 2.0.x headers so that they can be removed properly
2311 # Search only in includedir.
2312 AC_MSG_CHECKING(for old glibc 2.0.x headers)
2313 if eval test -f "${includedir}/elfclass.h" -a -f "${includedir}/fcntlbits.h"
2315 old_glibc_headers=yes
2317 old_glibc_headers=no
2319 AC_MSG_RESULT($old_glibc_headers)
2320 if test ${old_glibc_headers} = yes; then
2321 AC_MSG_WARN(*** During \"make install\" old headers from glibc 2.0.x will)
2322 AC_MSG_WARN(*** be removed.)
2324 AC_SUBST(old_glibc_headers)
2326 AC_SUBST(libc_cv_slibdir)
2327 AC_SUBST(libc_cv_localedir)
2328 AC_SUBST(libc_cv_sysconfdir)
2329 AC_SUBST(libc_cv_rootsbindir)
2330 AC_SUBST(libc_cv_forced_unwind)
2332 dnl sysdeps/CPU/configure.in checks set this via arch-specific asm tests
2333 AC_SUBST(libc_cv_cpp_asm_debuginfo)
2334 AC_SUBST(libc_cv_cc_sse4)
2335 AC_SUBST(libc_cv_cc_avx)
2336 AC_SUBST(libc_cv_cc_novzeroupper)
2337 AC_SUBST(libc_cv_as_i686)
2339 AC_SUBST(use_ldconfig)
2340 AC_SUBST(ldd_rewrite_script)
2342 AC_SUBST(elf) AC_SUBST(xcoff)
2343 if test $elf = yes; then
2346 if test $xcoff = yes; then
2347 AC_DEFINE(HAVE_XCOFF)
2352 if test $shared = default; then
2356 AC_CACHE_CHECK([whether -fPIC is default], libc_cv_pic_default,
2357 [libc_cv_pic_default=yes
2358 cat > conftest.c <<EOF
2359 #if defined __PIC__ || defined __pic__ || defined PIC || defined pic
2360 # error PIC is default.
2363 if eval "${CC-cc} -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
2364 libc_cv_pic_default=no
2367 AC_SUBST(libc_cv_pic_default)
2372 AC_SUBST(static_nss)
2373 AC_SUBST(nopic_initfini)
2377 dnl See sysdeps/mach/configure.in for this variable.
2378 AC_SUBST(mach_interface_list)
2380 if test "`(cd $srcdir; pwd)`" = "`pwd`"; then
2383 config_makefile=Makefile
2386 VERSION=`sed -n -e 's/^#define VERSION "\([^"]*\)"/\1/p' < $srcdir/version.h`
2387 RELEASE=`sed -n -e 's/^#define RELEASE "\([^"]*\)"/\1/p' < $srcdir/version.h`
2391 AC_CONFIG_FILES([config.make ${config_makefile}])
2392 AC_CONFIG_COMMANDS([default],[[
2393 case $CONFIG_FILES in *config.make*)
2394 echo "$config_vars" >> config.make;;
2396 test -d bits || mkdir bits]],[[config_vars='$config_vars']])