1 dnl Process this file with autoconf to produce a configure script.
2 AC_PREREQ(2.53)dnl dnl Minimum Autoconf version required.
3 AC_INIT([GNU C Library], [(see version.h)], [http://sourceware.org/bugzilla/], [glibc])
4 AC_CONFIG_SRCDIR([include/features.h])
5 AC_CONFIG_HEADERS([config.h])
6 AC_CONFIG_AUX_DIR([scripts])
8 dnl This is here so we can set $subdirs directly based on configure fragments.
14 if test $host != $build; then
15 AC_CHECK_PROGS(BUILD_CC, gcc cc)
17 AC_SUBST(cross_compiling)
19 # We need the C++ compiler only for testing.
22 if test "`cd $srcdir; /bin/pwd`" = "`/bin/pwd`"; then
23 AC_MSG_ERROR([you must configure in a separate build directory])
26 # This will get text that should go into config.make.
29 # Check for a --with-gd argument and set libgd-LDFLAGS in config.make.
31 AC_HELP_STRING([--with-gd=DIR],
32 [find libgd include dir and library with prefix DIR]),
36 *) libgd_include="-I$withval/include"
37 libgd_ldflags="-L$withval/lib" ;;
40 AC_ARG_WITH([gd-include],
41 AC_HELP_STRING([--with-gd-include=DIR],
42 [find libgd include files in DIR]),
44 case "$with_gd_include" in
46 *) libgd_include="-I$withval" ;;
50 AC_HELP_STRING([--with-gd-lib=DIR],
51 [find libgd library files in DIR]),
53 case "$with_gd_lib" in
55 *) libgd_ldflags="-L$withval" ;;
59 if test -n "$libgd_include"; then
60 config_vars="$config_vars
61 CFLAGS-memusagestat.c = $libgd_include"
63 if test -n "$libgd_ldflags"; then
64 config_vars="$config_vars
65 libgd-LDFLAGS = $libgd_ldflags"
68 dnl Arguments to specify presence of other packages/features.
70 AC_HELP_STRING([--with-fp],
71 [if using floating-point hardware @<:@default=yes@:>@]),
75 AC_ARG_WITH([binutils],
76 AC_HELP_STRING([--with-binutils=PATH],
77 [specify location of binutils (as and ld)]),
78 [path_binutils=$withval],
81 AC_HELP_STRING([--with-elf],
82 [if using the ELF object format]),
85 AC_ARG_WITH([selinux],
86 AC_HELP_STRING([--with-selinux],
87 [if building with SELinux support]),
88 [with_selinux=$withval],
91 AC_ARG_WITH([headers],
92 AC_HELP_STRING([--with-headers=PATH],
93 [location of system headers to use
94 (for example /usr/src/linux/include)
95 @<:@default=compiler default@:>@]),
96 [sysheaders=$withval],
99 AC_SUBST(use_default_link)
100 AC_ARG_WITH([default-link],
101 AC_HELP_STRING([--with-default-link],
102 [do not use explicit linker scripts]),
103 [use_default_link=$withval],
104 [use_default_link=default])
106 AC_ARG_ENABLE([sanity-checks],
107 AC_HELP_STRING([--disable-sanity-checks],
108 [really do not use threads (should not be used except in special situations) @<:@default=yes@:>@]),
109 [enable_sanity=$enableval],
112 AC_SUBST(enable_check_abi)
113 AC_ARG_ENABLE([check-abi],
114 AC_HELP_STRING([--enable-check-abi],
115 [do "make check-abi" in "make check" (no/warn/yes)
116 @<:@default=no@:>@]),
117 [enable_check_abi=$enableval],
118 [enable_check_abi=no])
120 dnl Arguments to enable or disable building the static, shared, profiled,
121 dnl and -fomit-frame-pointer libraries.
122 dnl I've disabled this for now since we cannot build glibc without static
123 dnl libraries built in the moment.
124 dnl AC_ARG_ENABLE([static],
125 dnl AC_HELP_STRING([--enable-static],
126 dnl [build static library @<:@default=yes@:>@]),
127 dnl [static=$enableval],
130 AC_ARG_ENABLE([shared],
131 AC_HELP_STRING([--enable-shared],
132 [build shared library @<:@default=yes if GNU ld & ELF@:>@]),
135 AC_ARG_ENABLE([profile],
136 AC_HELP_STRING([--enable-profile],
137 [build profiled library @<:@default=no@:>@]),
138 [profile=$enableval],
140 AC_ARG_ENABLE([bounded],
141 AC_HELP_STRING([--enable-bounded],
142 [build with runtime bounds checking @<:@default=no@:>@]),
143 [bounded=$enableval],
145 AC_ARG_ENABLE([versioning],
146 AC_HELP_STRING([--disable-versioning],
147 [do not include versioning information in the library objects @<:@default=yes if supported@:>@]),
148 [enable_versioning=$enableval],
149 [enable_versioning=yes])
151 AC_ARG_ENABLE([oldest-abi],
152 AC_HELP_STRING([--enable-oldest-abi=ABI],
153 [configure the oldest ABI supported @<:@e.g. 2.2@:>@ @<:@default=glibc default@:>@]),
154 [oldest_abi=$enableval],
156 if test "$oldest_abi" = yes || test "$oldest_abi" = no; then
159 AC_DEFINE_UNQUOTED(GLIBC_OLDEST_ABI, "$oldest_abi")
163 AC_ARG_ENABLE([stackguard-randomization],
164 AC_HELP_STRING([--enable-stackguard-randomization],
165 [initialize __stack_chk_guard canary with a random number at program start]),
166 [enable_stackguard_randomize=$enableval],
167 [enable_stackguard_randomize=no])
168 if test "$enable_stackguard_randomize" = yes; then
169 AC_DEFINE(ENABLE_STACKGUARD_RANDOMIZE)
172 dnl Generic infrastructure for drop-in additions to libc.
173 AC_ARG_ENABLE([add-ons],
174 AC_HELP_STRING([--enable-add-ons@<:@=DIRS...@:>@],
175 [configure and build add-ons in DIR1,DIR2,...
176 search for add-ons if no parameter given]),
177 , [enable_add_ons=yes])
179 AC_ARG_ENABLE([hidden-plt],
180 AC_HELP_STRING([--disable-hidden-plt],
181 [do not hide internal function calls to avoid PLT]),
184 if test "x$hidden" = xno; then
188 AC_ARG_ENABLE([bind-now],
189 AC_HELP_STRING([--enable-bind-now],
190 [disable lazy relocations in DSOs]),
191 [bindnow=$enableval],
195 dnl On some platforms we cannot use dynamic loading. We must provide
196 dnl static NSS modules.
197 AC_ARG_ENABLE([static-nss],
198 AC_HELP_STRING([--enable-static-nss],
199 [build static NSS modules @<:@default=no@:>@]),
200 [static_nss=$enableval],
202 dnl Enable static NSS also if we build no shared objects.
203 if test x"$static_nss" = xyes || test x"$shared" = xno; then
205 AC_DEFINE(DO_STATIC_NSS)
208 AC_ARG_ENABLE([force-install],
209 AC_HELP_STRING([--disable-force-install],
210 [don't force installation of files from this package, even if they are older than the installed files]),
211 [force_install=$enableval],
213 AC_SUBST(force_install)
215 dnl On some platforms we allow dropping compatibility with all kernel
217 AC_ARG_ENABLE([kernel],
218 AC_HELP_STRING([--enable-kernel=VERSION],
219 [compile for compatibility with kernel not older than VERSION]),
220 [minimum_kernel=$enableval],
222 dnl Prevent unreasonable values.
223 if test "$minimum_kernel" = yes || test "$minimum_kernel" = no; then
224 # Better nothing than this.
227 if test "$minimum_kernel" = current; then
228 minimum_kernel=`uname -r 2>/dev/null` || minimum_kernel=
232 dnl For the development we sometimes want gcc to issue even more warnings.
233 dnl This is not the default since many of the extra warnings are not
235 AC_ARG_ENABLE([all-warnings],
236 AC_HELP_STRING([--enable-all-warnings],
237 [enable all useful warnings gcc can issue]),
238 [all_warnings=$enableval],
240 AC_SUBST(all_warnings)
242 AC_ARG_ENABLE([multi-arch],
243 AC_HELP_STRING([--enable-multi-arch],
244 [enable single DSO with optimizations for multiple architectures]),
245 [multi_arch=$enableval],
246 [multi_arch=default])
248 AC_ARG_ENABLE([nss-crypt],
249 AC_HELP_STRING([--enable-nss-crypt],
250 [enable libcrypt to use nss]),
251 [nss_crypt=$enableval],
253 if test x$nss_crypt = xyes; then
254 nss_includes=-I$(nss-config --includedir 2>/dev/null)
255 if test $? -ne 0; then
256 AC_MSG_ERROR([cannot find include directory with nss-config])
259 CFLAGS="$CFLAGS $nss_includes"
260 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([typedef int PRBool;
262 #include <nsslowhash.h>
263 void f (void) { NSSLOW_Init (); }])],
264 libc_cv_nss_crypt=yes,
266 cannot find NSS headers with lowlevel hash function interfaces]))
268 LIBS="$LIBS -lfreebl3"
269 AC_LINK_IFELSE([AC_LANG_PROGRAM([typedef int PRBool;
271 #include <nsslowhash.h>],
273 libc_cv_nss_crypt=yes,
275 cannot link program using lowlevel NSS hash functions]))
281 AC_SUBST(libc_cv_nss_crypt)
283 # The way shlib-versions is used to generate soversions.mk uses a
284 # fairly simplistic model for name recognition that can't distinguish
285 # i486-pc-linux-gnu fully from i486-pc-gnu. So we mutate a $host_os
286 # of `gnu*' here to be `gnu-gnu*' just so that shlib-versions can
287 # tell. This doesn't get used much beyond that, so it's fairly safe.
292 host_os=`echo $host_os | sed -e 's/gnu/gnu-gnu/'`
296 # We keep the original values in `$config_*' and never modify them, so we
297 # can write them unchanged into config.make. Everything else uses
298 # $machine, $vendor, and $os, and changes them whenever convenient.
299 config_machine=$host_cpu config_vendor=$host_vendor config_os=$host_os
301 # Don't allow vendor == "unknown"
302 test "$config_vendor" = unknown && config_vendor=
303 config_os="`echo $config_os | sed 's/^unknown-//'`"
305 # Some configurations imply other options.
308 # The configure fragment of an add-on port can modify these to supplement
309 # or override the table in the case statement below. No fragment should
310 # ever change the config_* variables, however.
311 machine=$config_machine
312 vendor=$config_vendor
316 # config.guess on some IBM machines says `rs6000' instead of `powerpc'.
318 if test "$machine" = rs6000; then
322 # Braindead PowerPC box with absolutely no FPU.
323 case "$machine-$host_os" in
331 AS_HELP_STRING([--with-cpu=CPU], [select code for CPU variant]),
334 yes|'') AC_MSG_ERROR([--with-cpu requires an argument]) ;;
336 *) submachine="$withval" ;;
340 # An add-on can set this when it wants to disable the sanity check below.
343 dnl Having this here, though empty, makes sure that if add-ons' fragments
344 dnl do AC_CONFIG_SUBDIRS([some-dir]), which just sets $subdirs, then
345 dnl our AC_OUTPUT will actually use it.
348 case "$enable_add_ons" in
351 add_ons=`cd $srcdir && ls -d 2> /dev/null */configure */sysdeps |
352 sed 's@/[[^/]]*$@@' | sort | uniq`
353 add_ons_automatic=yes
355 *) add_ons=`echo "$enable_add_ons" | sed 's/,/ /g'`
356 add_ons_automatic=no ;;
362 if test x"$add_ons" != x; then
363 for f in $add_ons; do
368 *** It seems that you're using an old \`crypt' add-on. crypt is now
369 *** part of glibc and using the old add-on will not work with this
370 *** release. Start again with fresh sources and without the old
371 *** \`crypt' add-on.])
375 *** It seems that you're using an old \`localedata' add-on. localedata
376 *** is now part of glibc and using the old add-on will not work with
377 *** this release. Start again with fresh sources and without the old
378 *** \`localedata' add-on.])
383 # Now source each add-on's configure fragment.
384 # The fragments can use $srcdir/$libc_add_on to find themselves,
385 # and test $add_ons_automatic to see if they were explicitly requested.
386 # A fragment can clear (or even change) $libc_add_on to affect
387 # whether it goes into the list to be actually used in the build.
389 for libc_add_on in $add_ons; do
390 # Test whether such a directory really exists.
391 # It can be absolute, or relative to $srcdir, or relative to the build dir.
392 case "$libc_add_on" in
394 libc_add_on_srcdir=$libc_add_on
397 test -d "$srcdir/$libc_add_on" || {
398 if test -d "$libc_add_on"; then
399 libc_add_on="`pwd`/$libc_add_on"
401 AC_MSG_ERROR(add-on directory \"$libc_add_on\" does not exist)
404 libc_add_on_srcdir=$srcdir/$libc_add_on
408 libc_add_on_frag=$libc_add_on_srcdir/configure
409 libc_add_on_canonical=
410 libc_add_on_config_subdirs=
411 if test -r "$libc_add_on_frag"; then
412 AC_MSG_NOTICE(running configure fragment for add-on $libc_add_on)
413 libc_add_on_canonical=unknown
415 . "$libc_add_on_frag"
416 test -z "$libc_add_on" || {
417 configured_add_ons="$configured_add_ons $libc_add_on"
418 if test "x$libc_add_on_canonical" = xunknown; then
419 AC_MSG_ERROR(fragment must set \$libc_add_on_canonical)
421 for d in $libc_add_on_subdirs; do
422 case "$libc_add_on" in
423 /*) subdir_srcdir="$libc_add_on" ;;
424 *) subdir_srcdir="\$(..)$libc_add_on" ;;
428 d="${libc_add_on_canonical:-$libc_add_on}"
434 subdir_srcdir="$subdir_srcdir/$d"
437 d=`echo "$d" | sed 's@/*$@@;s@^.*/@@'`
438 add_on_subdirs="$add_on_subdirs $d"
439 test "$subdir_srcdir" = "\$(..)$d" || config_vars="$config_vars
440 $d-srcdir = $subdir_srcdir"
442 for d in $libc_add_on_config_subdirs; do
445 fragment uses absolute path in \$libc_add_on_config_subdirs) ;;
447 if test ! -d "$libc_add_on_srcdir/$d"; then
448 AC_MSG_ERROR(fragment wants to configure missing directory $d)
450 case "$libc_add_on" in
452 relative path required for add-on using \$libc_add_on_config_subdirs) ;;
454 subdirs="$subdirs $libc_add_on/$d"
458 if test -n "$libc_add_on"; then
459 if frags=`ls -d $libc_add_on_srcdir/sysdeps/*/preconfigure 2> /dev/null`
461 AC_MSG_CHECKING(add-on $libc_add_on for preconfigure fragments)
462 for frag in $frags; do
463 name=`echo "$frag" | sed 's@/[[^/]]*$@@;s@^.*/@@'`
464 echo $ECHO_N "$name $ECHO_C" >&AS_MESSAGE_FD
469 use_add_ons="$use_add_ons $libc_add_on"
470 add_ons_pfx="$add_ons_pfx $libc_add_on/"
471 test -z "$libc_add_on_canonical" ||
472 add_ons_sfx="$add_ons_sfx /$libc_add_on_canonical"
475 # Use echo to strip excess whitespace.
476 add_ons="`echo $use_add_ons`"
479 AC_SUBST(add_on_subdirs)
483 ### I put this here to prevent those annoying emails from people who cannot
484 ### read and try to compile glibc on unsupported platforms. --drepper
486 ### By using the undocumented --enable-hacker-mode option for configure
487 ### one can skip this test to make the configuration not fail for unsupported
490 if test -z "$enable_hacker_mode" && test x"$libc_config_ok" != xyes; then
491 case "$machine-$host_os" in
492 *-linux* | *-gnu* | arm*-none*)
495 echo "*** The GNU C library is currently not available for this platform."
496 echo "*** So far nobody cared to port it and if there is no volunteer it"
497 echo "*** might never happen. So, if you have interest to see glibc on"
498 echo "*** this platform visit"
499 echo "*** http://www.gnu.org/software/libc/porting.html"
500 echo "*** and join the group of porters"
506 dnl We need to use [ and ] for other purposes for a while now.
508 # Expand the configuration machine name into a subdirectory by architecture
509 # type and particular chip. If an add-on configure fragment already set
510 # base_machine, we don't change it.
511 test -n "$base_machine" || case "$machine" in
512 i[34567]86) base_machine=i386 machine=i386/$machine ;;
513 ia64) base_machine=ia64 machine=ia64 ;;
514 powerpc) base_machine=powerpc machine=powerpc/powerpc32 ;;
515 powerpc64) base_machine=powerpc machine=powerpc/powerpc64 ;;
516 s390) base_machine=s390 machine=s390/s390-32 ;;
517 s390x) base_machine=s390 machine=s390/s390-64 ;;
518 sh3*) base_machine=sh machine=sh/sh3 ;;
519 sh4*) base_machine=sh machine=sh/sh4 ;;
521 base_machine=sparc machine=sparc/sparc32 ;;
522 sparcv8 | supersparc | hypersparc)
523 base_machine=sparc machine=sparc/sparc32/sparcv8 ;;
524 sparcv8plus | sparcv8plusa | sparcv9)
525 base_machine=sparc machine=sparc/sparc32/sparcv9 ;;
526 sparcv8plusb | sparcv9b)
527 base_machine=sparc machine=sparc/sparc32/sparcv9/sparcv9b ;;
529 base_machine=sparc machine=sparc/sparc32/sparcv9/sparcv9v ;;
531 base_machine=sparc machine=sparc/sparc32/sparcv9/sparcv9v2 ;;
533 base_machine=sparc machine=sparc/sparc64 ;;
535 base_machine=sparc machine=sparc/sparc64/sparcv9b ;;
537 base_machine=sparc machine=sparc/sparc64/sparcv9v ;;
539 base_machine=sparc machine=sparc/sparc64/sparcv9v2 ;;
540 *) base_machine=$machine ;;
543 AC_SUBST(base_machine)
545 if test "$base_machine" = "i386"; then
546 AC_DEFINE(USE_REGPARMS)
549 # For the multi-arch option we need support in the assembler.
550 AC_CACHE_CHECK([for assembler gnu_indirect_function symbol type support],
551 libc_cv_asm_gnu_indirect_function, [dnl
552 cat > conftest.s <<EOF
553 .type foo,%gnu_indirect_function
555 if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD;
557 libc_cv_asm_gnu_indirect_function=yes
559 libc_cv_asm_gnu_indirect_function=no
563 AC_MSG_CHECKING(whether .text pseudo-op must be used)
564 AC_CACHE_VAL(libc_cv_dot_text, [dnl
565 cat > conftest.s <<EOF
569 if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
570 libc_cv_dot_text=.text
573 if test -z "$libc_cv_dot_text"; then
579 AC_CACHE_CHECK(for assembler global-symbol directive,
580 libc_cv_asm_global_directive, [dnl
581 libc_cv_asm_global_directive=UNKNOWN
582 for ac_globl in .globl .global .EXPORT; do
583 cat > conftest.s <<EOF
588 if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
589 libc_cv_asm_global_directive=${ac_globl}
592 test $libc_cv_asm_global_directive != UNKNOWN && break
594 if test $libc_cv_asm_global_directive = UNKNOWN; then
595 AC_MSG_ERROR(cannot determine asm global directive)
597 AC_DEFINE_UNQUOTED(ASM_GLOBAL_DIRECTIVE, ${libc_cv_asm_global_directive})
600 AC_CACHE_CHECK(for assembler .type directive prefix,
601 libc_cv_asm_type_prefix, [dnl
602 libc_cv_asm_type_prefix=no
603 for ac_try_prefix in '@' '%' '#'; do
604 cat > conftest.s <<EOF
606 ${libc_cv_asm_global_directive} foo
607 .type foo, ${ac_try_prefix}object
612 if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
613 libc_cv_asm_type_prefix=${ac_try_prefix}
616 test "x$libc_cv_asm_type_prefix" != xno && break
618 if test "x$libc_cv_asm_type_prefix" != xno; then
619 AC_DEFINE_UNQUOTED(ASM_TYPE_DIRECTIVE_PREFIX, ${libc_cv_asm_type_prefix})
622 if test x"$libc_cv_asm_gnu_indirect_function" != xyes -a x"$libc_cv_asm_type_prefix" = xno; then
623 if test x"$multi_arch" = xyes; then
624 AC_MSG_ERROR([--enable-multi-arch support requires assembler and linker support])
629 if test x"$multi_arch" != xno; then
630 multi_arch_d=/multiarch
633 # Compute the list of sysdep directories for this configuration.
634 # This can take a while to compute.
635 sysdep_dir=$srcdir/sysdeps
636 AC_MSG_CHECKING(sysdep dirs)
637 dnl We need to use [ and ] for other purposes for a while now.
639 # Make sco3.2v4 become sco3.2.4 and sunos4.1.1_U1 become sunos4.1.1.U1.
640 os="`echo $os | sed 's/\([0-9A-Z]\)[v_]\([0-9A-Z]\)/\1.\2/g'`"
642 test "x$base_os" != x || case "$os" in
645 netbsd* | 386bsd* | freebsd* | bsdi*)
646 base_os=unix/bsd/bsd4.4 ;;
647 osf* | sunos* | ultrix* | newsos* | dynix* | *bsd*)
649 sysv* | isc* | esix* | sco* | minix* | irix4* | linux*)
652 base_os=unix/sysv/irix6/$os ;;
654 base_os=unix/sysv/sysv4 ;;
656 base_os=standalone ;;
659 # For sunos4.1.1, try sunos4.1.1, then sunos4.1, then sunos4, then sunos.
662 while o=`echo $tail | sed 's/\.[^.]*$//'`; test $o != $tail; do
666 o=`echo $tail | sed 's/[0-9]*$//'`
667 if test $o != $tail; then
670 # For linux-gnu, try linux-gnu, then linux.
671 o=`echo $tail | sed 's/-.*$//'`
672 if test $o != $tail; then
676 # For unix/sysv/sysv4, try unix/sysv/sysv4, then unix/sysv, then unix.
679 while b=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$b"; do
685 # For sparc/sparc32, try sparc/sparc32 and then sparc.
687 tail=$machine${submachine:+/$submachine}
688 while m=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$m"; do
690 # Prepend the machine's FPU directory unless --without-fp.
691 if test "$with_fp" = yes; then
694 mach="$mach /$1/nofpu"
700 dnl We are done with glob and regexp uses of [ and ]; return to autoconf.
703 # Find what sysdep directories exist.
706 for b in $base ''; do
707 for m0 in $mach ''; do
708 for v in /$vendor ''; do
709 test "$v" = / && continue
710 for o in /$ostry ''; do
711 test "$o" = / && continue
712 for m in $multi_arch_d $mach ''; do
713 for d in $add_ons_pfx ''; do
714 for a in $add_ons_sfx ''; do
715 if test -n "$m0$m0sub$b$v$o$m$msub"; then
716 try_srcdir="${srcdir}/"
720 try="${d}sysdeps$m0$m0sub$b$v$o$m$msub$a"
721 test -n "$enable_debug_configure" &&
722 echo "$0 [DEBUG]: try $try" >&2
723 if test -d "$try_srcdir$try"; then
724 sysnames="$sysnames $try"
725 { test -n "$o" || test -n "$b"; } && os_used=t
726 { test -n "$m" || test -n "$m0"; } && machine_used=t
728 x*/$submachine) submachine_used=t ;;
730 if test -n "$d"; then
731 case "$sysnames_add_ons" in
733 *|'') sysnames_add_ons="$sysnames_add_ons $d" ;;
746 # If the assembler supports gnu_indirect_function symbol type and the
747 # architecture supports multi-arch, we enable multi-arch by default.
748 case $sysnames_add_ons$sysnames in
752 test x"$multi_arch" = xdefault && multi_arch=no
755 if test x"$multi_arch" != xno; then
756 AC_DEFINE(USE_MULTIARCH)
760 if test -z "$os_used" && test "$os" != none; then
761 AC_MSG_ERROR(Operating system $os is not supported.)
763 if test -z "$machine_used" && test "$machine" != none; then
764 AC_MSG_ERROR(The $machine is not supported.)
766 if test -z "$submachine_used" && test -n "$submachine"; then
767 AC_MSG_ERROR(The $submachine subspecies of $host_cpu is not supported.)
771 # We have now validated the configuration.
774 # If using ELF, look for an `elf' subdirectory of each machine directory.
775 # We prepend these rather than inserting them whereever the machine appears
776 # because things specified by the machine's ELF ABI should override
777 # OS-specific things, and should always be the same for any OS on the
778 # machine (otherwise what's the point of an ABI?).
779 if test "$elf" = yes; then
781 for d in $add_ons_pfx ''; do
783 if test -d $srcdir/${d}sysdeps$m/elf; then
784 elf_dirs="$elf_dirs ${d}sysdeps$m/elf"
788 sysnames="`echo $elf_dirs | sed -e 's,//,/,g'` $sysnames"
792 # Expand the list of system names into a full list of directories
793 # from each element's parent name and Implies file (if present).
796 while test $# -gt 0; do
800 case " $names " in *" $name "*)
801 # Already in the list.
805 # Report each name as we discover it, so there is no long pause in output.
806 echo $ECHO_N "$name $ECHO_C" >&AS_MESSAGE_FD
808 name_base=`echo $name | sed -e 's@\(.*sysdeps\)/.*@\1@'`
812 *) xsrcdir=$srcdir/ ;;
814 test -n "$enable_debug_configure" &&
815 echo "[DEBUG]: name/Implies $xsrcdir$name/Implies" >&2
817 if test -f $xsrcdir$name/Implies; then
818 # Collect more names from the `Implies' file (removing comments).
819 implied_candidate="`sed 's/#.*$//' < $xsrcdir$name/Implies`"
821 for x in $implied_candidate; do
823 if test -d $xsrcdir$name_base/$x; then
824 implied="$implied $name_base/$x";
827 for d in $add_ons_pfx ''; do
831 *) try_srcdir=$srcdir/ ;;
833 test -n "$enable_debug_configure" &&
834 echo "[DEBUG]: $name implied $x try($d) {$try_srcdir}$try" >&2
835 if test $try != $xsrcdir$name_base/$x && test -d $try_srcdir$try;
837 implied="$implied $try"
839 case "$sysnames_add_ons" in
841 *|'') sysnames_add_ons="$sysnames_add_ons $d" ;;
845 if test $found = no; then
846 AC_MSG_WARN($name/Implies specifies nonexistent $x)
853 # Add NAME to the list of names.
856 # Find the parent of NAME, using the empty string if it has none.
858 parent="`echo $name | sed -n -e 's=/[^/]*$==' -e '/sysdeps$/q' -e p`"
861 # Add the names implied by NAME, and NAME's parent (if it has one), to
862 # the list of names to be processed (the argument list). We prepend the
863 # implied names to the list and append the parent. We want implied
864 # directories to come before further directories inferred from the
865 # configuration components; this ensures that for sysv4, unix/common
866 # (implied by unix/sysv/sysv4) comes before unix/sysv (in ostry (here $*)
868 sysnames="`echo $implied $* $parent`"
869 test -n "$sysnames" && set $sysnames
872 # Add the default directories.
873 default_sysnames=sysdeps/generic
874 if test "$elf" = yes; then
875 default_sysnames="sysdeps/generic/elf $default_sysnames"
877 sysnames="$names $default_sysnames"
879 # The other names were emitted during the scan.
880 AC_MSG_RESULT($default_sysnames)
882 # Collect the list of add-ons that supply partial sysdeps trees.
884 for add_on in $add_ons; do
887 *) xsrcdir="$srcdir/" ;;
890 test -d "$xsrcdir$add_on/sysdeps" || {
891 case "$configured_add_ons " in
894 AC_MSG_ERROR(add-on $add_on has no configure fragment or sysdeps tree)
900 sysdeps_add_ons="$sysdeps_add_ons $add_on"
901 case "$sysnames_add_ons" in
904 AC_MSG_WARN(add-on $add_on contributed no sysdeps directories)
909 for d in $sysnames; do
911 $add_on/sysdeps/*) ;;
914 (cd "$xsrcdir$d" && for f in *[[!~]]; do
918 test -d "$ff" || { test -e "$ff" && exit 88; }
922 test -d "$f" || { test -e "$f" && exit 88; }
926 if test $? -eq 88; then
931 if test $found = no; then
932 AC_MSG_WARN(add-on $add_on contributed no useful sysdeps directories)
935 AC_SUBST(sysdeps_add_ons)
941 if test "$INSTALL" = "${srcdir}/scripts/install-sh -c"; then
942 # The makefiles need to use a different form to find it in $srcdir.
943 INSTALL='\$(..)./scripts/install-sh -c'
948 AC_SUBST(MIG)dnl Needed by sysdeps/mach/configure.in
950 # Accept binutils 2.13 or newer.
951 AC_CHECK_PROG_VER(AS, $AS, --version,
952 [GNU assembler.* \([0-9]*\.[0-9.]*\)],
953 [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")
954 AC_CHECK_PROG_VER(LD, $LD, --version,
955 [GNU ld.* \([0-9][0-9]*\.[0-9.]*\)],
956 [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")
958 # We need the physical current working directory. We cannot use the
959 # "pwd -P" shell builtin since that's not portable. Instead we try to
960 # find a pwd binary. Note that assigning to the PWD environment
961 # variable might have some interesting side effects, so we don't do
963 AC_PATH_PROG(PWD_P, pwd, no)
964 if test "$PWD_P" = no; then
965 AC_MSG_ERROR(*** A pwd binary could not be found.)
968 # These programs are version sensitive.
970 AC_CHECK_PROG_VER(CC, ${ac_tool_prefix}gcc ${ac_tool_prefix}cc, -v,
971 [version \([egcygnustpi-]*[0-9.]*\)], [3.4* | 4.[0-9]* ],
972 critic_missing="$critic_missing gcc")
973 AC_CHECK_PROG_VER(MAKE, gnumake gmake make, --version,
974 [GNU Make[^0-9]*\([0-9][0-9.]*\)],
975 [3.79* | 3.[89]*], critic_missing="$critic_missing make")
977 AC_CHECK_PROG_VER(MSGFMT, gnumsgfmt gmsgfmt msgfmt, --version,
978 [GNU gettext.* \([0-9]*\.[0-9.]*\)],
979 [0.10.3[6-9]* | 0.10.[4-9][0-9]* | 0.1[1-9]* | 0.[2-9][0-9]* | [1-9].*],
980 MSGFMT=: aux_missing="$aux_missing msgfmt")
981 AC_CHECK_PROG_VER(MAKEINFO, makeinfo, --version,
982 [GNU texinfo.* \([0-9][0-9.]*\)],
984 MAKEINFO=: aux_missing="$aux_missing makeinfo")
985 AC_CHECK_PROG_VER(SED, sed, --version,
986 [GNU sed version \([0-9]*\.[0-9.]*\)],
987 [3.0[2-9]*|3.[1-9]*|[4-9]*],
988 SED=: aux_missing="$aux_missing sed")
990 AC_CHECK_TOOL(READELF, readelf, false)
992 AC_CHECK_PROGS(AUTOCONF, autoconf, no)
994 xno|x|x:) AUTOCONF=no ;;
997 whether $AUTOCONF${ACFLAGS:+ }$ACFLAGS works, libc_cv_autoconf_works, [dnl
998 if (cd $srcdir; $AUTOCONF $ACFLAGS configure.in > /dev/null 2>&1); then
999 libc_cv_autoconf_works=yes
1001 libc_cv_autoconf_works=no
1003 test $libc_cv_autoconf_works = yes || AUTOCONF=no
1006 if test "x$AUTOCONF" = xno; then
1007 aux_missing="$aux_missing autoconf"
1010 test -n "$critic_missing" && AC_MSG_ERROR([
1011 *** These critical programs are missing or too old:$critic_missing
1012 *** Check the INSTALL file for required versions.])
1014 test -n "$aux_missing" && AC_MSG_WARN([
1015 *** These auxiliary programs are missing or incompatible versions:$aux_missing
1016 *** some features will be disabled.
1017 *** Check the INSTALL file for required versions.])
1019 # if using special system headers, find out the compiler's sekrit
1020 # header directory and add that to the list. NOTE: Only does the right
1021 # thing on a system that doesn't need fixincludes. (Not presently a problem.)
1022 if test -n "$sysheaders"; then
1023 SYSINCLUDES=-nostdinc
1024 for d in include include-fixed; do
1025 i=`$CC -print-file-name="$d"` && test "x$i" != x && test "x$i" != "x$d" &&
1026 SYSINCLUDES="$SYSINCLUDES -isystem $i"
1028 SYSINCLUDES="$SYSINCLUDES \
1029 -isystem `echo $sysheaders | sed 's/:/ -isystem /g'`"
1030 if test -n "$CXX"; then
1032 cxxversion=`$CXX -dumpversion 2>&AS_MESSAGE_LOG_FD` &&
1033 cxxmachine=`$CXX -dumpmachine 2>&AS_MESSAGE_LOG_FD` &&
1034 for d in include "$cxxmachine/include"; do
1035 i=../../../../$d/c++/$cxxversion
1036 cxxheaders=`$CXX -print-file-name="$i"` &&
1037 test "x$cxxheaders" != x && test "x$i" != "x$cxxheaders" &&
1038 CXX_SYSINCLUDES="$CXX_SYSINCLUDES -isystem $cxxheaders \
1039 -isystem $cxxheaders/$cxxmachine -isystem $cxxheaders/backward"
1043 AC_SUBST(SYSINCLUDES)
1044 AC_SUBST(CXX_SYSINCLUDES)
1046 # ranlib is never necessary on Linux and Hurd systems
1049 # Test if LD_LIBRARY_PATH contains the notation for the current directory
1050 # since this would lead to problems installing/building glibc.
1051 # LD_LIBRARY_PATH contains the current directory if one of the following
1053 # - one of the terminals (":" and ";") is the first or last sign
1054 # - two terminals occur directly after each other
1055 # - the path contains an element with a dot in it
1056 AC_MSG_CHECKING(LD_LIBRARY_PATH variable)
1058 case ${LD_LIBRARY_PATH} in
1059 [:\;]* | *[:\;] | *[:\;][:\;]* | *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* )
1060 ld_library_path_setting="contains current directory"
1063 ld_library_path_setting="ok"
1067 AC_MSG_RESULT($ld_library_path_setting)
1068 if test "$ld_library_path_setting" != "ok"; then
1070 *** LD_LIBRARY_PATH shouldn't contain the current directory when
1071 *** building glibc. Please change the environment variable
1072 *** and run configure again.])
1075 AC_CACHE_CHECK(whether GCC supports -static-libgcc, libc_cv_gcc_static_libgcc, [dnl
1076 if $CC -v -static-libgcc 2>&1 | grep -q 'unrecognized option.*static-libgcc'; then
1077 libc_cv_gcc_static_libgcc=
1079 libc_cv_gcc_static_libgcc=-static-libgcc
1081 AC_SUBST(libc_cv_gcc_static_libgcc)
1083 AC_PATH_PROG(BASH_SHELL, bash, no)
1084 if test "$BASH_SHELL" != no &&
1085 $BASH_SHELL -c 'test "$BASH_VERSINFO" \
1086 && test "$BASH_VERSINFO" -ge 2 >&/dev/null'; then
1087 libc_cv_have_bash2=yes
1089 libc_cv_have_bash2=no
1091 AC_SUBST(libc_cv_have_bash2)
1093 dnl We need a ksh compatible shell for tzselect.
1094 if test "$BASH_SHELL" = no; then
1095 AC_PATH_PROG(KSH, ksh, no)
1096 if test "$KSH" = no; then
1099 libc_cv_have_ksh=yes
1104 libc_cv_have_ksh=yes
1106 AC_SUBST(libc_cv_have_ksh)
1109 AC_PATH_PROG(PERL, perl, no)
1110 if test "$PERL" != no &&
1111 (eval `$PERL -V:apiversion`; test `expr "$apiversion" \< 5` -ne 0); then
1114 AC_PATH_PROG(INSTALL_INFO, install-info, no,
1115 $PATH:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin)
1116 AC_PATH_PROG(BISON, bison, no, $PATH:/usr/local/bin:/usr/bin:/bin)
1118 AC_CACHE_CHECK(for signed size_t type, libc_cv_signed_size_t, [dnl
1119 echo '#include <stddef.h>
1120 FOOBAR __SIZE_TYPE__ FOOBAR' > conftest.c
1121 if eval "$ac_cpp conftest.c 2>/dev/null" \
1122 | grep '^FOOBAR.*unsigned.*FOOBAR$' >/dev/null; then
1123 libc_cv_signed_size_t=no
1125 libc_cv_signed_size_t=yes
1128 if test $libc_cv_signed_size_t = yes; then
1129 dnl Do this by hand instead of AC_DEFINE so can add #undef to avoid warnings.
1130 cat >> confdefs.h <<\EOF
1131 #undef __SIZE_TYPE__
1132 #define __SIZE_TYPE__ unsigned
1136 AC_CACHE_CHECK(for libc-friendly stddef.h, libc_cv_friendly_stddef, [dnl
1138 [#define __need_size_t
1139 #define __need_wchar_t
1142 #include <stddef.h>], [size_t size; wchar_t wchar;
1144 #error stddef.h ignored __need_*
1146 if (&size == NULL || &wchar == NULL) abort ();],
1147 libc_cv_friendly_stddef=yes,
1148 libc_cv_friendly_stddef=no)])
1149 if test $libc_cv_friendly_stddef = yes; then
1150 config_vars="$config_vars
1151 override stddef.h = # The installed <stddef.h> seems to be libc-friendly."
1154 AC_CACHE_CHECK(whether we need to use -P to assemble .S files,
1155 libc_cv_need_minus_P, [dnl
1156 cat > conftest.S <<EOF
1157 #include "confdefs.h"
1158 /* Nothing whatsoever. */
1160 if AC_TRY_COMMAND(${CC-cc} $CPPFLAGS $ASFLAGS -c conftest.S 1>&AS_MESSAGE_LOG_FD); then
1161 libc_cv_need_minus_P=no
1163 libc_cv_need_minus_P=yes
1166 if test $libc_cv_need_minus_P = yes; then
1167 config_vars="$config_vars
1168 asm-CPPFLAGS = -P # The assembler can't grok cpp's # line directives."
1171 AC_CACHE_CHECK(for .set assembler directive, libc_cv_asm_set_directive, [dnl
1172 cat > conftest.s <<EOF
1175 .set glibc_conftest_frobozz,foo
1176 $libc_cv_asm_global_directive glibc_conftest_frobozz
1178 # The alpha-dec-osf1 assembler gives only a warning for `.set'
1179 # (but it doesn't work), so we must do a linking check to be sure.
1180 cat > conftest1.c <<\EOF
1181 extern int glibc_conftest_frobozz;
1182 void _start() { glibc_conftest_frobozz = 1; }
1184 if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
1185 -nostartfiles -nostdlib \
1186 -o conftest conftest.s conftest1.c 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
1187 libc_cv_asm_set_directive=yes
1189 libc_cv_asm_set_directive=no
1192 if test $libc_cv_asm_set_directive = yes; then
1193 AC_DEFINE(HAVE_ASM_SET_DIRECTIVE)
1196 AC_CACHE_CHECK(for assembler gnu_unique_object symbol type,
1197 libc_cv_asm_unique_object, [dnl
1198 cat > conftest.s <<EOF
1201 .type _sym, ${libc_cv_asm_type_prefix}gnu_unique_object
1203 if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
1204 libc_cv_asm_unique_object=yes
1206 libc_cv_asm_unique_object=no
1209 if test $libc_cv_asm_unique_object = yes; then
1210 AC_DEFINE(HAVE_ASM_UNIQUE_OBJECT)
1213 AC_CACHE_CHECK(for .symver assembler directive, libc_cv_asm_symver_directive,
1214 [cat > conftest.s <<EOF
1217 .symver _sym,sym@VERS
1219 if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
1220 libc_cv_asm_symver_directive=yes
1222 libc_cv_asm_symver_directive=no
1225 AC_CACHE_CHECK(for ld --version-script, libc_cv_ld_version_script_option, [dnl
1226 if test $libc_cv_asm_symver_directive = yes; then
1227 cat > conftest.s <<EOF
1230 .symver _sym,sym@VERS
1232 cat > conftest.map <<EOF
1241 if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
1242 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $LDFLAGS -shared
1243 -o conftest.so conftest.o
1244 -nostartfiles -nostdlib
1245 -Wl,--version-script,conftest.map
1246 1>&AS_MESSAGE_LOG_FD]);
1248 libc_cv_ld_version_script_option=yes
1250 libc_cv_ld_version_script_option=no
1253 libc_cv_ld_version_script_option=no
1256 libc_cv_ld_version_script_option=no
1259 if test $shared != no &&
1260 test $libc_cv_asm_symver_directive = yes &&
1261 test $libc_cv_ld_version_script_option = yes &&
1262 test $enable_versioning = yes; then
1264 AC_DEFINE(DO_VERSIONING)
1268 AC_SUBST(VERSIONING)
1270 if test $elf = yes && test $shared != no && test $VERSIONING = no; then
1272 *** WARNING: You should not compile GNU libc without versioning. Not using
1273 *** versioning will introduce incompatibilities so that old binaries
1274 *** will not run anymore.
1275 *** For versioning you need recent binutils (binutils-2.8.1.0.23 or newer)."
1277 if test $elf = yes; then
1278 AC_CACHE_CHECK(for .previous assembler directive,
1279 libc_cv_asm_previous_directive, [dnl
1280 cat > conftest.s <<EOF
1281 .section foo_section
1284 if AC_TRY_COMMAND(${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
1285 libc_cv_asm_previous_directive=yes
1287 libc_cv_asm_previous_directive=no
1290 if test $libc_cv_asm_previous_directive = yes; then
1291 AC_DEFINE(HAVE_ASM_PREVIOUS_DIRECTIVE)
1293 AC_CACHE_CHECK(for .popsection assembler directive,
1294 libc_cv_asm_popsection_directive, [dnl
1295 cat > conftest.s <<EOF
1296 .pushsection foo_section
1299 if AC_TRY_COMMAND(${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
1300 libc_cv_asm_popsection_directive=yes
1302 libc_cv_asm_popsection_directive=no
1305 if test $libc_cv_asm_popsection_directive = yes; then
1306 AC_DEFINE(HAVE_ASM_POPSECTION_DIRECTIVE)
1309 AC_CACHE_CHECK(for .protected and .hidden assembler directive,
1310 libc_cv_asm_protected_directive, [dnl
1311 cat > conftest.s <<EOF
1317 if AC_TRY_COMMAND(${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
1318 libc_cv_asm_protected_directive=yes
1320 AC_MSG_ERROR(assembler support for symbol visibility is required)
1324 if test $libc_cv_asm_protected_directive = yes; then
1325 AC_CACHE_CHECK(whether __attribute__((visibility())) is supported,
1326 libc_cv_visibility_attribute,
1327 [cat > conftest.c <<EOF
1328 int foo __attribute__ ((visibility ("hidden"))) = 1;
1329 int bar __attribute__ ((visibility ("protected"))) = 1;
1331 libc_cv_visibility_attribute=no
1332 if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
1333 if grep '\.hidden.*foo' conftest.s >/dev/null; then
1334 if grep '\.protected.*bar' conftest.s >/dev/null; then
1335 libc_cv_visibility_attribute=yes
1339 rm -f conftest.{c,s}
1341 if test $libc_cv_visibility_attribute != yes; then
1342 AC_MSG_ERROR(compiler support for visibility attribute is required)
1346 if test $libc_cv_visibility_attribute = yes; then
1347 AC_CACHE_CHECK(for broken __attribute__((visibility())),
1348 libc_cv_broken_visibility_attribute,
1349 [cat > conftest.c <<EOF
1351 int bar (int x) __asm__ ("foo") __attribute__ ((visibility ("hidden")));
1352 int bar (int x) { return x; }
1354 libc_cv_broken_visibility_attribute=yes
1355 if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
1357 if grep '\.hidden[ _]foo' conftest.s >/dev/null; then
1359 libc_cv_broken_visibility_attribute=no
1362 rm -f conftest.c conftest.s
1364 if test $libc_cv_broken_visibility_attribute = yes; then
1365 AC_MSG_ERROR(working compiler support for visibility attribute is required)
1369 AC_CACHE_CHECK(for broken __attribute__((alias())),
1370 libc_cv_broken_alias_attribute,
1371 [cat > conftest.c <<EOF
1372 extern int foo (int x) __asm ("xyzzy");
1373 int bar (int x) { return x; }
1374 extern __typeof (bar) foo __attribute ((weak, alias ("bar")));
1376 extern __typeof (dfoo) dfoo __asm ("abccb");
1379 libc_cv_broken_alias_attribute=yes
1380 if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
1381 if grep 'xyzzy' conftest.s >/dev/null &&
1382 grep 'abccb' conftest.s >/dev/null; then
1383 libc_cv_broken_alias_attribute=no
1386 rm -f conftest.c conftest.s
1388 if test $libc_cv_broken_alias_attribute = yes; then
1389 AC_MSG_ERROR(working alias attribute support required)
1392 if test $libc_cv_visibility_attribute = yes; then
1393 AC_CACHE_CHECK(whether to put _rtld_local into .sdata section,
1394 libc_cv_have_sdata_section,
1395 [echo "int i;" > conftest.c
1396 libc_cv_have_sdata_section=no
1397 if ${CC-cc} $LDFLAGS -fPIC -shared -Wl,--verbose conftest.c -o conftest.so 2>&1 \
1398 | grep '\.sdata' >/dev/null; then
1399 libc_cv_have_sdata_section=yes
1401 rm -f conftest.c conftest.so
1403 if test $libc_cv_have_sdata_section = yes; then
1404 AC_DEFINE(HAVE_SDATA_SECTION)
1408 AC_CACHE_CHECK(for .preinit_array/.init_array/.fini_array support,
1409 libc_cv_initfini_array, [dnl
1410 cat > conftest.c <<EOF
1411 int _start (void) { return 0; }
1412 int __start (void) { return 0; }
1413 int foo (void) { return 1; }
1414 int (*fp) (void) __attribute__ ((section (".init_array"))) = foo;
1416 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -o conftest conftest.c
1417 -static -nostartfiles -nostdlib 1>&AS_MESSAGE_LOG_FD])
1419 if $READELF -S conftest | fgrep INIT_ARRAY > /dev/null; then
1420 libc_cv_initfini_array=yes
1422 libc_cv_initfini_array=no
1425 libc_cv_initfini_array=no
1428 if test $libc_cv_initfini_array != yes; then
1429 AC_MSG_ERROR([Need linker with .init_array/.fini_array support.])
1432 AC_CACHE_CHECK(whether to use .ctors/.dtors header and trailer,
1433 libc_cv_ctors_header, [dnl
1434 libc_cv_ctors_header=yes
1436 __attribute__ ((constructor)) void ctor (void) { puts("ctor"); }
1437 __attribute__ ((destructor)) void dtor (void) { puts("dtor"); }
1440 AS_IF([$READELF -WS conftest$ac_exeext | $AWK '
1441 { gsub(/\@<:@ */, "@<:@") }
1442 $2 == ".ctors" || $2 == ".dtors" {
1443 size = strtonum("0x" $6)
1444 align = strtonum("0x" $NF)
1446 stub@<:@$2@:>@ = size == align * 2
1449 ctors_ok = !seen@<:@".ctors"@:>@ || stub@<:@".ctors"@:>@
1450 dtors_ok = !seen@<:@".dtors"@:>@ || stub@<:@".dtors"@:>@
1451 exit ((ctors_ok && dtors_ok) ? 0 : 1)
1453 '], [libc_cv_ctors_header=no])
1455 AC_MSG_ERROR([missing __attribute__ ((constructor)) support??])
1458 if test $libc_cv_ctors_header = no; then
1459 AC_DEFINE(NO_CTORS_DTORS_SECTIONS)
1462 AC_CACHE_CHECK(for libunwind-support in compiler,
1463 libc_cv_cc_with_libunwind, [
1464 cat > conftest.c <<EOF
1465 int main (void) { return 0; }
1467 if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -static -o conftest \
1468 conftest.c -v 2>&1 >/dev/null | grep -q " -lunwind "; then
1469 libc_cv_cc_with_libunwind=yes
1471 libc_cv_cc_with_libunwind=no
1474 AC_SUBST(libc_cv_cc_with_libunwind)
1475 if test $libc_cv_cc_with_libunwind = yes; then
1476 AC_DEFINE(HAVE_CC_WITH_LIBUNWIND)
1479 AC_CACHE_CHECK(for -z nodelete option,
1480 libc_cv_z_nodelete, [dnl
1481 cat > conftest.c <<EOF
1482 int _start (void) { return 42; }
1484 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1485 -fPIC -shared -o conftest.so conftest.c
1486 -nostartfiles -nostdlib
1487 -Wl,--enable-new-dtags,-z,nodelete 1>&AS_MESSAGE_LOG_FD])
1489 libc_cv_z_nodelete=yes
1491 AC_MSG_ERROR(linker with -z nodelete support required)
1495 AC_CACHE_CHECK(for -z nodlopen option,
1496 libc_cv_z_nodlopen, [dnl
1497 cat > conftest.c <<EOF
1498 int _start (void) { return 42; }
1500 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1501 -fPIC -shared -o conftest.so conftest.c
1502 -nostartfiles -nostdlib
1503 -Wl,--enable-new-dtags,-z,nodlopen 1>&AS_MESSAGE_LOG_FD])
1505 libc_cv_z_nodlopen=yes
1507 AC_MSG_ERROR(linker with -z nodlopen support required)
1511 AC_CACHE_CHECK(for -z initfirst option,
1512 libc_cv_z_initfirst, [dnl
1513 cat > conftest.c <<EOF
1514 int _start (void) { return 42; }
1516 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1517 -fPIC -shared -o conftest.so conftest.c
1518 -nostartfiles -nostdlib
1519 -Wl,--enable-new-dtags,-z,initfirst 1>&AS_MESSAGE_LOG_FD])
1521 libc_cv_z_initfirst=yes
1523 AC_MSG_ERROR(linker with -z initfirst support required)
1527 # Add-on fragments can set these for other machines.
1528 libc_commonpagesize=${libc_commonpagesize:-no}
1529 libc_relro_required=${libc_relro_required:-no}
1530 case "$base_machine" in
1531 i[[34567]]86 | x86_64 | powerpc* | s390*)
1532 libc_commonpagesize=0x1000
1533 libc_relro_required=yes
1536 libc_commonpagesize=0x2000
1537 libc_relro_required=yes
1540 libc_commonpagesize=0x4000
1543 libc_commonpagesize=0x10000
1544 libc_relro_required=yes
1548 if test $libc_commonpagesize != no; then
1549 AC_CACHE_CHECK(for -z relro option,
1550 libc_cv_z_relro, [dnl
1552 AC_LANG_CONFTEST([AC_LANG_SOURCE([[
1553 int _start (void) { return 42; }
1554 extern void _exit (int);
1555 /* Since these pointers are const, they should go in rodata.
1556 Since they refer to functions that have to be resolved by
1557 dynamic linking, they should instead go in RELRO data. */
1558 const void *const relro[] = { &_start, &_exit, 0 };
1559 /* GNU ld fails to produce RELRO data when it's very small and there is no
1560 normal writable data following it, or if only uninitialized (.bss) data
1561 follows it, or only very small writable data. */
1562 int data[0x10000] = { 1, };
1564 cat > conftest.awk <<\EOF
1567 commonpagesize = strtonum(commonpagesize)
1569 { print "LINE:", $0 > "/dev/stderr" }
1571 vaddr = strtonum($3)
1572 memsz = strtonum($6)
1574 printf "vaddr %#x memsz %#x end %#x commonpagesize %#x\n", \
1575 vaddr, memsz, end, commonpagesize > "/dev/stderr"
1576 result = (end % commonpagesize == 0) ? "yes" : "broken"
1578 END { print result }
1580 AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1581 -fPIC -shared -o conftest.so conftest.c
1582 -nostartfiles -nostdlib
1583 -Wl,-z,relro 1>&AS_MESSAGE_LOG_FD]) &&
1584 AC_TRY_COMMAND([$READELF -Wl conftest.so > conftest.ph]) &&
1586 $AWK -v commonpagesize=$libc_commonpagesize -f conftest.awk
1587 conftest.ph > conftest.cps
1589 libc_cv_z_relro=`cat conftest.cps 2>&AS_MESSAGE_LOG_FD`
1591 if { test "x$libc_relro_required" = xyes &&
1592 test "x$libc_cv_z_relro" != xyes
1595 AC_MSG_ERROR(linker with -z relro support required)
1598 AC_MSG_WARN([missing architecture parameter to check for working -z relro])
1601 AC_CACHE_CHECK(for -Bgroup option,
1602 libc_cv_Bgroup, [dnl
1603 cat > conftest.c <<EOF
1604 int _start (void) { return 42; }
1606 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1607 -fPIC -shared -o conftest.so conftest.c
1608 -Wl,-Bgroup -nostdlib 1>&AS_MESSAGE_LOG_FD])
1615 AC_SUBST(libc_cv_Bgroup)
1617 AC_CACHE_CHECK(for libgcc_s suffix,
1618 libc_cv_libgcc_s_suffix, [dnl
1619 cat > conftest.c <<EOF
1620 int main (void) { return 0; }
1623 libc_cv_libgcc_s_suffix=`${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
1624 -fPIC -shared -shared-libgcc -o conftest.so \
1625 conftest.c -v 2>&1 >/dev/null \
1626 | sed -n 's/^.* -lgcc_s\([^ ]*\) .*$/\1/p'`
1629 AC_SUBST(libc_cv_libgcc_s_suffix)
1631 AC_CACHE_CHECK(for --as-needed option,
1632 libc_cv_as_needed, [dnl
1633 cat > conftest.c <<EOF
1634 int main (void) { return 0; }
1636 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1637 -fPIC -shared -o conftest.so conftest.c
1638 -lgcc_s$libc_cv_libgcc_s_suffix -Wl,--as-needed
1639 -nostdlib 1>&AS_MESSAGE_LOG_FD])
1641 libc_cv_as_needed=yes
1643 libc_cv_as_needed=no
1646 AC_SUBST(libc_cv_as_needed)
1649 AC_CACHE_CHECK(whether --noexecstack is desirable for .S files,
1650 libc_cv_as_noexecstack, [dnl
1651 cat > conftest.c <<EOF
1654 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS
1655 -S -o conftest.s conftest.c 1>&AS_MESSAGE_LOG_FD]) \
1656 && grep -q .note.GNU-stack conftest.s \
1657 && AC_TRY_COMMAND([${CC-cc} $ASFLAGS -Wa,--noexecstack
1658 -c -o conftest.o conftest.s 1>&AS_MESSAGE_LOG_FD])
1660 libc_cv_as_noexecstack=yes
1662 libc_cv_as_noexecstack=no
1665 if test $libc_cv_as_noexecstack = yes; then
1666 ASFLAGS_config="$ASFLAGS_config -Wa,--noexecstack"
1668 AC_SUBST(ASFLAGS_config)
1670 AC_CACHE_CHECK(for -z combreloc,
1671 libc_cv_z_combreloc, [dnl
1672 cat > conftest.c <<EOF
1673 extern int bar (int);
1675 int foo (void) { return bar (mumble); }
1677 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1678 -fPIC -shared -o conftest.so conftest.c
1679 -nostdlib -nostartfiles
1680 -Wl,-z,combreloc 1>&AS_MESSAGE_LOG_FD])
1682 dnl The following test is a bit weak. We must use a tool which can test
1683 dnl cross-platform since the gcc used can be a cross compiler. Without
1684 dnl introducing new options this is not easily doable. Instead use a tool
1685 dnl which always is cross-platform: readelf. To detect whether -z combreloc
1686 dnl look for a section named .rel.dyn.
1687 if $READELF -S conftest.so | grep '\.rel\(a\|\)\.dyn' > /dev/null; then
1688 libc_cv_z_combreloc=yes
1690 libc_cv_z_combreloc=no
1693 libc_cv_z_combreloc=no
1696 if test "$libc_cv_z_combreloc" = yes; then
1697 AC_DEFINE(HAVE_Z_COMBRELOC)
1699 AC_SUBST(libc_cv_z_combreloc)
1701 AC_CACHE_CHECK(for -z execstack,
1702 libc_cv_z_execstack, [dnl
1703 cat > conftest.c <<EOF
1704 int _start (void) { return 42; }
1706 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1707 -fPIC -shared -o conftest.so conftest.c
1708 -Wl,-z,execstack -nostdlib
1709 1>&AS_MESSAGE_LOG_FD])
1711 libc_cv_z_execstack=yes
1713 libc_cv_z_execstack=no
1716 AC_SUBST(libc_cv_z_execstack)
1718 AC_CACHE_CHECK(for -fpie, libc_cv_fpie, [dnl
1719 cat > conftest.c <<EOF
1721 main () { return 0;}
1723 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -pie -fpie
1724 -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD])
1732 AC_SUBST(libc_cv_fpie)
1734 AC_CACHE_CHECK(for --hash-style option,
1735 libc_cv_hashstyle, [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,--hash-style=both -nostdlib 1>&AS_MESSAGE_LOG_FD])
1743 libc_cv_hashstyle=yes
1745 libc_cv_hashstyle=no
1748 AC_SUBST(libc_cv_hashstyle)
1750 # The linker's default -shared behavior is good enough if it
1751 # does these things that our custom linker scripts ensure that
1752 # all allocated NOTE sections come first.
1753 if test "$use_default_link" = default; then
1754 AC_CACHE_CHECK([for sufficient default -shared layout],
1755 libc_cv_use_default_link, [dnl
1756 libc_cv_use_default_link=no
1757 cat > conftest.s <<\EOF
1758 .section .note.a,"a",%note
1763 .section .note.b,"a",%note
1769 if AC_TRY_COMMAND([dnl
1770 ${CC-cc} $ASFLAGS -shared -o conftest.so conftest.s 1>&AS_MESSAGE_LOG_FD]) &&
1771 ac_try=`$READELF -S conftest.so | sed -n \
1773 s/^ *\[ *[1-9][0-9]*\] *\([^ ][^ ]*\) *\([^ ][^ ]*\) .*$/\2 \1/
1779 libc_seen_a=no libc_seen_b=no
1781 while test $# -ge 2 -a "$1" = NOTE; do
1783 .note.a) libc_seen_a=yes ;;
1784 .note.b) libc_seen_b=yes ;;
1788 case "$libc_seen_a$libc_seen_b" in
1790 libc_cv_use_default_link=yes
1793 echo >&AS_MESSAGE_LOG_FD "\
1794 $libc_seen_a$libc_seen_b from:
1800 use_default_link=$libc_cv_use_default_link
1804 AC_CACHE_CHECK(linker output format, libc_cv_output_format, [dnl
1805 if libc_cv_output_format=`
1806 ${CC-cc} -nostartfiles -nostdlib -Wl,--print-output-format 2>&AS_MESSAGE_LOG_FD`
1810 libc_cv_output_format=
1812 test -n "$libc_cv_output_format" || libc_cv_output_format=unknown])
1813 AC_SUBST(libc_cv_output_format)
1815 AC_CACHE_CHECK(for -fno-toplevel-reorder -fno-section-anchors, libc_cv_fno_toplevel_reorder, [dnl
1816 cat > conftest.c <<EOF
1819 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -fno-toplevel-reorder -fno-section-anchors
1820 conftest.c 1>&AS_MESSAGE_LOG_FD])
1822 libc_cv_fno_toplevel_reorder=yes
1824 libc_cv_fno_toplevel_reorder=no
1827 if test $libc_cv_fno_toplevel_reorder = yes; then
1828 fno_unit_at_a_time="-fno-toplevel-reorder -fno-section-anchors"
1830 fno_unit_at_a_time=-fno-unit-at-a-time
1832 AC_SUBST(fno_unit_at_a_time)
1834 AC_CACHE_CHECK(for -fstack-protector, libc_cv_ssp, [dnl
1835 cat > conftest.c <<EOF
1837 main () { return 0;}
1839 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -Werror -fstack-protector
1840 -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD])
1847 AC_SUBST(libc_cv_ssp)
1849 AC_CACHE_CHECK(for -fgnu89-inline, libc_cv_gnu89_inline, [dnl
1850 cat > conftest.c <<EOF
1852 #ifdef __GNUC_GNU_INLINE__
1853 main () { return 0;}
1858 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -std=gnu99 -fgnu89-inline
1859 -o conftest.s conftest.c 1>&AS_MESSAGE_LOG_FD])
1861 libc_cv_gnu89_inline=yes
1863 libc_cv_gnu89_inline=no
1866 if test $libc_cv_gnu89_inline = yes; then
1867 gnu89_inline=-fgnu89-inline
1871 AC_SUBST(gnu89_inline)
1873 if test $elf != yes; then
1874 AC_CACHE_CHECK(for .init and .fini sections, libc_cv_have_initfini,
1875 [AC_TRY_COMPILE(, [asm (".section .init");
1876 asm (".section .fini");
1877 asm ("${libc_cv_dot_text}");],
1878 libc_cv_have_initfini=yes,
1879 libc_cv_have_initfini=no)])
1880 AC_SUBST(libc_cv_have_initfini)dnl
1881 if test $libc_cv_have_initfini = yes; then
1882 AC_DEFINE(HAVE_INITFINI)
1886 if test $elf = yes; then
1887 AC_CACHE_CHECK(whether cc puts quotes around section names,
1888 libc_cv_have_section_quotes,
1889 [cat > conftest.c <<EOF
1890 static const int foo
1891 __attribute__ ((section ("bar"))) = 1;
1893 if ${CC-cc} -S conftest.c -o conftest.s; then
1894 if grep '\.section.*"bar"' conftest.s >/dev/null; then
1895 libc_cv_have_section_quotes=yes
1897 libc_cv_have_section_quotes=no
1900 libc_cv_have_section_quotes=unknown
1902 rm -f conftest.{c,s}
1904 if test $libc_cv_have_section_quotes = yes; then
1905 AC_DEFINE(HAVE_SECTION_QUOTES)
1909 dnl AC_CHECK_ASM_UNDERSCORE([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
1910 AC_DEFUN(AC_CHECK_ASM_UNDERSCORE,
1911 [cat > conftest.$ac_ext <<EOF
1912 dnl This sometimes fails to find confdefs.h, for some reason.
1913 dnl [#]line $LINENO "[$]0"
1914 [#]line $LINENO "configure"
1915 #include "confdefs.h"
1916 void underscore_test(void) {
1919 if AC_TRY_EVAL(ac_compile); then
1920 if grep _underscore_test conftest* >/dev/null; then
1921 ifelse([$1], , :, [rm -f conftest*
1924 ifelse([$2], , , [rm -f conftest*
1928 echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD
1929 cat conftest.$ac_ext >&AS_MESSAGE_LOG_FD
1930 ifelse([$2], , , [rm -f conftest*
1935 if test $elf = yes; then
1936 libc_cv_asm_underscores=no
1938 if test $ac_cv_prog_cc_works = yes; then
1939 AC_CACHE_CHECK(for _ prefix on C symbol names, libc_cv_asm_underscores,
1940 [AC_TRY_LINK([asm ("_glibc_foobar:");], [glibc_foobar ();],
1941 libc_cv_asm_underscores=yes,
1942 libc_cv_asm_underscores=no)])
1944 AC_CACHE_CHECK(for _ prefix on C symbol names, libc_cv_asm_underscores,
1945 [AC_CHECK_ASM_UNDERSCORE(libc_cv_asm_underscores=yes,
1946 libc_cv_asm_underscores=no)])
1949 if test $libc_cv_asm_underscores = no; then
1950 AC_DEFINE(NO_UNDERSCORES)
1953 if test $elf = yes; then
1954 libc_cv_weak_symbols=yes
1957 AC_CACHE_CHECK(for assembler .weak directive, libc_cv_asm_weak_directive,
1959 cat > conftest.s <<EOF
1961 ${libc_cv_asm_global_directive} foo
1964 .weak bar; bar = foo
1966 if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
1967 libc_cv_asm_weak_directive=yes
1969 libc_cv_asm_weak_directive=no
1973 if test $libc_cv_asm_weak_directive = no; then
1974 AC_CACHE_CHECK(for assembler .weakext directive,
1975 libc_cv_asm_weakext_directive,
1977 cat > conftest.s <<EOF
1979 ${libc_cv_asm_global_directive} foo
1983 ${libc_cv_asm_global_directive} baz
1986 if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
1987 libc_cv_asm_weakext_directive=yes
1989 libc_cv_asm_weakext_directive=no
1995 if test $libc_cv_asm_weak_directive = yes; then
1996 AC_DEFINE(HAVE_ASM_WEAK_DIRECTIVE)
1997 elif test $libc_cv_asm_weakext_directive = yes; then
1998 AC_DEFINE(HAVE_ASM_WEAKEXT_DIRECTIVE)
2001 AC_CACHE_CHECK(whether CFI directives are supported, libc_cv_asm_cfi_directives, [dnl
2003 sparc/sparc64*) cfi_offset=2047;;
2006 cat > conftest.s <<EOF
2008 .type func,%function
2012 .cfi_rel_offset 1, $cfi_offset
2015 if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
2016 libc_cv_asm_cfi_directives=yes
2018 libc_cv_asm_cfi_directives=no
2021 if test $libc_cv_asm_cfi_directives = yes; then
2022 AC_DEFINE(HAVE_ASM_CFI_DIRECTIVES)
2025 AC_CACHE_CHECK(for ld --no-whole-archive, libc_cv_ld_no_whole_archive, [dnl
2026 cat > conftest.c <<\EOF
2031 dnl No \ in command here because it ends up inside ''.
2032 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
2033 -nostdlib -nostartfiles -Wl,--no-whole-archive
2034 -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD]); then
2035 libc_cv_ld_no_whole_archive=yes
2037 libc_cv_ld_no_whole_archive=no
2040 if test $libc_cv_ld_no_whole_archive = no; then
2041 AC_MSG_ERROR([support for --no-whole-archive is needed])
2044 AC_CACHE_CHECK(for gcc -fexceptions, libc_cv_gcc_exceptions, [dnl
2045 cat > conftest.c <<\EOF
2050 dnl No \ in command here because it ends up inside ''.
2051 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
2052 -nostdlib -nostartfiles -fexceptions
2053 -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD]); then
2054 libc_cv_gcc_exceptions=yes
2056 libc_cv_gcc_exceptions=no
2059 if test $libc_cv_gcc_exceptions = yes; then
2060 exceptions=-fexceptions
2062 AC_SUBST(exceptions)dnl
2064 if test "$host_cpu" = powerpc ; then
2065 # Check for a bug present in at least versions 2.8.x of GCC
2066 # and versions 1.0.x of EGCS.
2067 AC_CACHE_CHECK(whether clobbering cr0 causes problems,libc_cv_c_asmcr0_bug,[dnl
2068 AC_TRY_COMPILE([int tester(int x) { asm ("" : : : "cc"); return x & 123; }],,
2069 libc_cv_c_asmcr0_bug='no',
2070 libc_cv_c_asmcr0_bug='yes')])
2071 if test "$libc_cv_c_asmcr0_bug" != 'no'; then
2072 AC_DEFINE(BROKEN_PPC_ASM_CR0)
2076 dnl Check whether compiler understands __builtin_expect.
2077 AC_CACHE_CHECK(for __builtin_expect, libc_cv_gcc_builtin_expect,
2078 [cat > conftest.c <<EOF
2079 #line $LINENO "configure"
2082 a = __builtin_expect (a, 10);
2083 return a == 10 ? 0 : 1;
2086 dnl No \ in command here because it ends up inside ''.
2087 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -nostdlib -nostartfiles
2088 -o conftest conftest.c -lgcc >&AS_MESSAGE_LOG_FD]); then
2089 libc_cv_gcc_builtin_expect=yes
2091 libc_cv_gcc_builtin_expect=no
2094 if test "$libc_cv_gcc_builtin_expect" = no; then
2095 AC_MSG_ERROR([support for __builtin_expect needed])
2098 AC_CACHE_CHECK(for __builtin_memset, libc_cv_gcc_builtin_memset, [dnl
2099 cat > conftest.c <<\EOF
2102 __builtin_memset (x, 0, 1000);
2106 if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | fgrep "memset" > /dev/null]);
2108 libc_cv_gcc_builtin_memset=no
2110 libc_cv_gcc_builtin_memset=yes
2113 if test "$libc_cv_gcc_builtin_memset" = yes ; then
2114 AC_DEFINE(HAVE_BUILTIN_MEMSET)
2117 AC_CACHE_CHECK(for redirection of built-in functions, libc_cv_gcc_builtin_redirection, [dnl
2118 cat > conftest.c <<\EOF
2119 extern char *strstr (const char *, const char *) __asm ("my_strstr");
2120 char *foo (const char *a, const char *b)
2122 return __builtin_strstr (a, b);
2126 if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | fgrep "my_strstr" > /dev/null]);
2128 libc_cv_gcc_builtin_redirection=yes
2130 libc_cv_gcc_builtin_redirection=no
2133 if test "$libc_cv_gcc_builtin_redirection" = no; then
2134 AC_MSG_ERROR([support for the symbol redirection needed])
2137 dnl Check whether the compiler supports the __thread keyword.
2138 AC_CACHE_CHECK([for __thread], libc_cv_gcc___thread,
2139 [cat > conftest.c <<\EOF
2140 __thread int a = 42;
2142 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c >&AS_MESSAGE_LOG_FD]); then
2143 libc_cv_gcc___thread=yes
2145 libc_cv_gcc___thread=no
2148 if test "$libc_cv_gcc___thread" = no; then
2149 AC_MSG_ERROR([support for the __thread keyword is required])
2152 dnl Check whether the compiler supports the tls_model attribute.
2153 AC_CACHE_CHECK([for tls_model attribute], libc_cv_gcc_tls_model_attr, [dnl
2154 cat > conftest.c <<\EOF
2155 extern __thread int a __attribute__((tls_model ("initial-exec")));
2157 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -Werror conftest.c >&AS_MESSAGE_LOG_FD]); then
2158 libc_cv_gcc_tls_model_attr=yes
2160 libc_cv_gcc_tls_model_attr=no
2163 if test "$libc_cv_gcc_tls_model_attr" = no; then
2164 AC_MSG_ERROR([support for the tls_model attribute is required])
2167 if test -n "$submachine"; then
2168 AC_CACHE_CHECK([for compiler option for CPU variant],
2169 libc_cv_cc_submachine, [dnl
2170 libc_cv_cc_submachine=no
2171 for opt in "-march=$submachine" "-mcpu=$submachine"; do
2172 if AC_TRY_COMMAND([${CC-cc} $opt -xc /dev/null -S -o /dev/null]); then
2173 libc_cv_cc_submachine="$opt"
2177 if test "x$libc_cv_cc_submachine" = xno; then
2178 AC_MSG_ERROR([${CC-cc} does not support $submachine])
2181 AC_SUBST(libc_cv_cc_submachine)
2183 dnl Check whether we have the gd library available.
2184 AC_MSG_CHECKING(for libgd)
2185 if test "$with_gd" != "no"; then
2186 old_CFLAGS="$CFLAGS"
2187 CFLAGS="$CFLAGS $libgd_include"
2188 old_LDFLAGS="$LDFLAGS"
2189 LDFLAGS="$LDFLAGS $libgd_ldflags"
2191 LIBS="$LIBS -lgd -lpng -lz -lm"
2192 AC_TRY_LINK([#include <gd.h>], [gdImagePng (0, 0)], LIBGD=yes, LIBGD=no)
2193 CFLAGS="$old_CFLAGS"
2194 LDFLAGS="$old_LDFLAGS"
2199 AC_MSG_RESULT($LIBGD)
2203 if test x$with_selinux = xno ; then
2206 # See if we have the SELinux library
2207 AC_CHECK_LIB(selinux, is_selinux_enabled,
2208 have_selinux=yes, have_selinux=no)
2209 # See if we have the SELinux header with the NSCD permissions in it.
2210 if test x$have_selinux = xyes ; then
2211 AC_MSG_CHECKING([for NSCD Flask permissions in selinux/av_permissions.h])
2212 AC_TRY_COMPILE([#include <selinux/av_permissions.h>],
2213 [#ifdef NSCD__SHMEMHOST
2216 #error NSCD__SHMEMHOST not defined
2218 have_selinux=yes, have_selinux=no)
2219 AC_MSG_RESULT($have_selinux)
2222 if test x$with_selinux = xyes ; then
2223 if test x$have_selinux = xno ; then
2224 AC_MSG_ERROR([SELinux explicitly required, but sufficiently recent SELinux library not found])
2228 # Check if we're building with SELinux support.
2229 if test "x$have_selinux" = xyes; then
2230 AC_DEFINE(HAVE_SELINUX, 1, [SELinux support])
2232 # See if we have the libaudit library
2233 AC_CHECK_LIB(audit, audit_log_user_avc_message,
2234 have_libaudit=yes, have_libaudit=no)
2235 if test "x$have_libaudit" = xyes; then
2236 AC_DEFINE(HAVE_LIBAUDIT, 1, [SELinux libaudit support])
2238 AC_SUBST(have_libaudit)
2240 # See if we have the libcap library
2241 AC_CHECK_LIB(cap, cap_init, have_libcap=yes, have_libcap=no)
2242 if test "x$have_libcap" = xyes; then
2243 AC_DEFINE(HAVE_LIBCAP, 1, [SELinux libcap support])
2245 AC_SUBST(have_libcap)
2247 AC_SUBST(have_selinux)
2249 dnl check for the size of 'long double'.
2250 AC_CHECK_SIZEOF(long double, 0)
2251 sizeof_long_double=$ac_cv_sizeof_long_double
2252 AC_SUBST(sizeof_long_double)
2254 ### End of automated tests.
2255 ### Now run sysdeps configure fragments.
2257 # They also can set these variables.
2259 ldd_rewrite_script=no
2260 libc_cv_sysconfdir=$sysconfdir
2261 libc_cv_gcc_unwind_find_fde=no
2264 # Iterate over all the sysdep directories we will use, running their
2265 # configure fragments.
2266 for dir in $sysnames; do
2269 *) dest=$srcdir/$dir ;;
2271 if test -r $dest/configure; then
2272 AC_MSG_RESULT(running configure fragment for $dir)
2277 if test x$libc_cv_gcc_unwind_find_fde = xyes; then
2278 AC_DEFINE(EXPORT_UNWIND_FIND_FDE)
2280 AC_SUBST(libc_cv_gcc_unwind_find_fde)
2282 # Test for old glibc 2.0.x headers so that they can be removed properly
2283 # Search only in includedir.
2284 AC_MSG_CHECKING(for old glibc 2.0.x headers)
2285 if eval test -f "${includedir}/elfclass.h" -a -f "${includedir}/fcntlbits.h"
2287 old_glibc_headers=yes
2289 old_glibc_headers=no
2291 AC_MSG_RESULT($old_glibc_headers)
2292 if test ${old_glibc_headers} = yes; then
2293 AC_MSG_WARN(*** During \"make install\" old headers from glibc 2.0.x will)
2294 AC_MSG_WARN(*** be removed.)
2296 AC_SUBST(old_glibc_headers)
2298 AC_SUBST(libc_cv_slibdir)
2299 AC_SUBST(libc_cv_localedir)
2300 AC_SUBST(libc_cv_sysconfdir)
2301 AC_SUBST(libc_cv_rootsbindir)
2302 AC_SUBST(libc_cv_forced_unwind)
2304 dnl sysdeps/CPU/configure.in checks set this via arch-specific asm tests
2305 AC_SUBST(libc_cv_cpp_asm_debuginfo)
2306 AC_SUBST(libc_cv_cc_sse4)
2307 AC_SUBST(libc_cv_cc_avx)
2308 AC_SUBST(libc_cv_cc_novzeroupper)
2309 AC_SUBST(libc_cv_cc_fma4)
2310 AC_SUBST(libc_cv_as_i686)
2312 AC_SUBST(use_ldconfig)
2313 AC_SUBST(ldd_rewrite_script)
2317 if test $shared = default; then
2321 AC_CACHE_CHECK([whether -fPIC is default], libc_cv_pic_default,
2322 [libc_cv_pic_default=yes
2323 cat > conftest.c <<EOF
2324 #if defined __PIC__ || defined __pic__ || defined PIC || defined pic
2325 # error PIC is default.
2328 if eval "${CC-cc} -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
2329 libc_cv_pic_default=no
2332 AC_SUBST(libc_cv_pic_default)
2336 AC_SUBST(static_nss)
2337 AC_SUBST(nopic_initfini)
2341 dnl See sysdeps/mach/configure.in for this variable.
2342 AC_SUBST(mach_interface_list)
2344 if test "`(cd $srcdir; pwd)`" = "`pwd`"; then
2347 config_makefile=Makefile
2350 VERSION=`sed -n -e 's/^#define VERSION "\([^"]*\)"/\1/p' < $srcdir/version.h`
2351 RELEASE=`sed -n -e 's/^#define RELEASE "\([^"]*\)"/\1/p' < $srcdir/version.h`
2355 AC_CONFIG_FILES([config.make ${config_makefile}])
2356 AC_CONFIG_COMMANDS([default],[[
2357 case $CONFIG_FILES in *config.make*)
2358 echo "$config_vars" >> config.make;;
2360 test -d bits || mkdir bits]],[[config_vars='$config_vars']])