1 dnl Process this file with autoconf to produce a configure script.
2 dnl Note we do not use AC_PREREQ here! See aclocal.m4 for what we use instead.
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 ACX_PKGVERSION([GNU libc])
9 ACX_BUGURL([http://www.gnu.org/software/libc/bugs.html])
10 AC_DEFINE_UNQUOTED([PKGVERSION], ["$PKGVERSION"],
11 [Package description])
12 AC_DEFINE_UNQUOTED([REPORT_BUGS_TO], ["$REPORT_BUGS_TO"],
13 [Bug reporting address])
15 # Glibc should not depend on any header files
16 AC_DEFUN([_AC_INCLUDES_DEFAULT_REQUIREMENTS],
17 [m4_divert_text([DEFAULTS],
18 [ac_includes_default='/* none */'])])
20 # We require GCC, and by default use its preprocessor. Override AC_PROG_CPP
21 # here to work around the Autoconf issue discussed in
22 # <http://sourceware.org/ml/libc-alpha/2013-01/msg00721.html>.
23 AC_DEFUN([AC_PROG_CPP],
24 [AC_REQUIRE([AC_PROG_CC])dnl
25 AC_ARG_VAR([CPP], [C preprocessor])dnl
26 _AC_ARG_VAR_CPPFLAGS()dnl
27 # On Suns, sometimes $CPP names a directory.
28 if test -n "$CPP" && test -d "$CPP"; then
31 if test -z "$CPP"; then
37 # We require GCC. Override _AC_PROG_CC_C89 here to work around the Autoconf
39 # <http://sourceware.org/ml/libc-alpha/2013-01/msg00757.html>.
40 AC_DEFUN([_AC_PROG_CC_C89], [[$1]])
42 dnl This is here so we can set $subdirs directly based on configure fragments.
48 if test $host != $build; then
49 AC_CHECK_PROGS(BUILD_CC, gcc cc)
51 AC_SUBST(cross_compiling)
53 # We need the C++ compiler only for testing.
55 AC_CHECK_TOOL(READELF, readelf, false)
57 if test "`cd $srcdir; /bin/pwd`" = "`/bin/pwd`"; then
58 AC_MSG_ERROR([you must configure in a separate build directory])
61 # This will get text that should go into config.make.
64 # Check for a --with-gd argument and set libgd-LDFLAGS in config.make.
66 AC_HELP_STRING([--with-gd=DIR],
67 [find libgd include dir and library with prefix DIR]),
71 *) libgd_include="-I$withval/include"
72 libgd_ldflags="-L$withval/lib" ;;
75 AC_ARG_WITH([gd-include],
76 AC_HELP_STRING([--with-gd-include=DIR],
77 [find libgd include files in DIR]),
79 case "$with_gd_include" in
81 *) libgd_include="-I$withval" ;;
85 AC_HELP_STRING([--with-gd-lib=DIR],
86 [find libgd library files in DIR]),
88 case "$with_gd_lib" in
90 *) libgd_ldflags="-L$withval" ;;
94 if test -n "$libgd_include"; then
95 config_vars="$config_vars
96 CFLAGS-memusagestat.c = $libgd_include"
98 if test -n "$libgd_ldflags"; then
99 config_vars="$config_vars
100 libgd-LDFLAGS = $libgd_ldflags"
103 dnl Arguments to specify presence of other packages/features.
105 AC_HELP_STRING([--with-fp],
106 [if using floating-point hardware @<:@default=yes@:>@]),
110 AC_ARG_WITH([binutils],
111 AC_HELP_STRING([--with-binutils=PATH],
112 [specify location of binutils (as and ld)]),
113 [path_binutils=$withval],
115 AC_ARG_WITH([selinux],
116 AC_HELP_STRING([--with-selinux],
117 [if building with SELinux support]),
118 [with_selinux=$withval],
121 AC_ARG_WITH([headers],
122 AC_HELP_STRING([--with-headers=PATH],
123 [location of system headers to use
124 (for example /usr/src/linux/include)
125 @<:@default=compiler default@:>@]),
126 [sysheaders=$withval],
130 AC_SUBST(use_default_link)
131 AC_ARG_WITH([default-link],
132 AC_HELP_STRING([--with-default-link],
133 [do not use explicit linker scripts]),
134 [use_default_link=$withval],
135 [use_default_link=default])
137 AC_ARG_ENABLE([sanity-checks],
138 AC_HELP_STRING([--disable-sanity-checks],
139 [really do not use threads (should not be used except in special situations) @<:@default=yes@:>@]),
140 [enable_sanity=$enableval],
143 AC_ARG_ENABLE([shared],
144 AC_HELP_STRING([--enable-shared],
145 [build shared library @<:@default=yes if GNU ld@:>@]),
148 AC_ARG_ENABLE([profile],
149 AC_HELP_STRING([--enable-profile],
150 [build profiled library @<:@default=no@:>@]),
151 [profile=$enableval],
153 AC_ARG_ENABLE([versioning],
154 AC_HELP_STRING([--disable-versioning],
155 [do not include versioning information in the library objects @<:@default=yes if supported@:>@]),
156 [enable_versioning=$enableval],
157 [enable_versioning=yes])
159 AC_ARG_ENABLE([oldest-abi],
160 AC_HELP_STRING([--enable-oldest-abi=ABI],
161 [configure the oldest ABI supported @<:@e.g. 2.2@:>@ @<:@default=glibc default@:>@]),
162 [oldest_abi=$enableval],
164 if test "$oldest_abi" = yes || test "$oldest_abi" = no; then
167 AC_DEFINE_UNQUOTED(GLIBC_OLDEST_ABI, "$oldest_abi")
171 AC_ARG_ENABLE([hardcoded-path-in-tests],
172 AC_HELP_STRING([--enable-hardcoded-path-in-tests],
173 [hardcode newly built glibc path in tests @<:@default=no@:>@]),
174 [hardcoded_path_in_tests=$enableval],
175 [hardcoded_path_in_tests=no])
176 AC_SUBST(hardcoded_path_in_tests)
178 AC_ARG_ENABLE([stackguard-randomization],
179 AC_HELP_STRING([--enable-stackguard-randomization],
180 [initialize __stack_chk_guard canary with a random number at program start]),
181 [enable_stackguard_randomize=$enableval],
182 [enable_stackguard_randomize=no])
183 if test "$enable_stackguard_randomize" = yes; then
184 AC_DEFINE(ENABLE_STACKGUARD_RANDOMIZE)
187 AC_ARG_ENABLE([lock-elision],
188 AC_HELP_STRING([--enable-lock-elision[=yes/no]],
189 [Enable lock elision for pthread mutexes by default]),
190 [enable_lock_elision=$enableval],
191 [enable_lock_elision=no])
192 if test "$enable_lock_elision" = yes ; then
193 AC_DEFINE(ENABLE_LOCK_ELISION)
196 dnl Generic infrastructure for drop-in additions to libc.
197 AC_ARG_ENABLE([add-ons],
198 AC_HELP_STRING([--enable-add-ons@<:@=DIRS...@:>@],
199 [configure and build add-ons in DIR1,DIR2,...
200 search for add-ons if no parameter given]),
201 , [enable_add_ons=yes])
203 AC_ARG_ENABLE([hidden-plt],
204 AC_HELP_STRING([--disable-hidden-plt],
205 [do not hide internal function calls to avoid PLT]),
208 if test "x$hidden" = xno; then
212 AC_ARG_ENABLE([bind-now],
213 AC_HELP_STRING([--enable-bind-now],
214 [disable lazy relocations in DSOs]),
215 [bindnow=$enableval],
219 dnl On some platforms we cannot use dynamic loading. We must provide
220 dnl static NSS modules.
221 AC_ARG_ENABLE([static-nss],
222 AC_HELP_STRING([--enable-static-nss],
223 [build static NSS modules @<:@default=no@:>@]),
224 [static_nss=$enableval],
226 dnl Enable static NSS also if we build no shared objects.
227 if test x"$static_nss" = xyes || test x"$shared" = xno; then
229 AC_DEFINE(DO_STATIC_NSS)
232 AC_ARG_ENABLE([force-install],
233 AC_HELP_STRING([--disable-force-install],
234 [don't force installation of files from this package, even if they are older than the installed files]),
235 [force_install=$enableval],
237 AC_SUBST(force_install)
239 dnl On some platforms we allow dropping compatibility with all kernel
241 AC_ARG_ENABLE([kernel],
242 AC_HELP_STRING([--enable-kernel=VERSION],
243 [compile for compatibility with kernel not older than VERSION]),
244 [minimum_kernel=$enableval],
246 dnl Prevent unreasonable values.
247 if test "$minimum_kernel" = yes || test "$minimum_kernel" = no; then
248 # Better nothing than this.
251 if test "$minimum_kernel" = current; then
252 minimum_kernel=`uname -r 2>/dev/null` || minimum_kernel=
256 dnl For the development we sometimes want gcc to issue even more warnings.
257 dnl This is not the default since many of the extra warnings are not
259 AC_ARG_ENABLE([all-warnings],
260 AC_HELP_STRING([--enable-all-warnings],
261 [enable all useful warnings gcc can issue]),
262 [all_warnings=$enableval],
264 AC_SUBST(all_warnings)
266 AC_ARG_ENABLE([multi-arch],
267 AC_HELP_STRING([--enable-multi-arch],
268 [enable single DSO with optimizations for multiple architectures]),
269 [multi_arch=$enableval],
270 [multi_arch=default])
272 AC_ARG_ENABLE([nss-crypt],
273 AC_HELP_STRING([--enable-nss-crypt],
274 [enable libcrypt to use nss]),
275 [nss_crypt=$enableval],
277 if test x$nss_crypt = xyes; then
278 nss_includes=-I$(nss-config --includedir 2>/dev/null)
279 if test $? -ne 0; then
280 AC_MSG_ERROR([cannot find include directory with nss-config])
283 CFLAGS="$CFLAGS $nss_includes"
284 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([typedef int PRBool;
286 #include <nsslowhash.h>
287 void f (void) { NSSLOW_Init (); }])],
288 libc_cv_nss_crypt=yes,
290 cannot find NSS headers with lowlevel hash function interfaces]))
292 LIBS="$LIBS -lfreebl3"
293 AC_LINK_IFELSE([AC_LANG_PROGRAM([typedef int PRBool;
295 #include <nsslowhash.h>],
297 libc_cv_nss_crypt=yes,
299 cannot link program using lowlevel NSS hash functions]))
305 AC_SUBST(libc_cv_nss_crypt)
308 AC_ARG_ENABLE([obsolete-rpc],
309 AC_HELP_STRING([--enable-obsolete-rpc],
310 [build and install the obsolete RPC code for link-time usage]),
311 [link_obsolete_rpc=$enableval],
312 [link_obsolete_rpc=no])
313 AC_SUBST(link_obsolete_rpc)
315 if test "$link_obsolete_rpc" = yes; then
316 AC_DEFINE(LINK_OBSOLETE_RPC)
319 AC_ARG_ENABLE([systemtap],
320 [AS_HELP_STRING([--enable-systemtap],
321 [enable systemtap static probe points @<:@default=no@:>@])],
322 [systemtap=$enableval],
324 if test "x$systemtap" != xno; then
325 AC_CACHE_CHECK([for systemtap static probe support], libc_cv_sdt, [dnl
327 CFLAGS="-std=gnu99 $CFLAGS"
328 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <sys/sdt.h>
329 void foo (int i, void *p)
331 asm ("" STAP_PROBE_ASM (foo, bar, STAP_PROBE_ASM_TEMPLATE (2)) ""
332 :: STAP_PROBE_ASM_OPERANDS (2, i, p));
333 }]])], [libc_cv_sdt=yes], [libc_cv_sdt=no])
334 CFLAGS="$old_CFLAGS"])
335 if test $libc_cv_sdt = yes; then
336 AC_DEFINE([USE_STAP_PROBE])
337 elif test "x$systemtap" != xauto; then
338 AC_MSG_FAILURE([systemtap support needs sys/sdt.h with asm support])
342 AC_ARG_ENABLE([build-nscd],
343 [AS_HELP_STRING([--disable-build-nscd],
344 [disable building and installing the nscd daemon])],
345 [build_nscd=$enableval],
346 [build_nscd=default])
349 # Note the use of $use_nscd is near the bottom of the file.
350 AC_ARG_ENABLE([nscd],
351 [AS_HELP_STRING([--disable-nscd],
352 [library functions will not contact the nscd daemon])],
353 [use_nscd=$enableval],
356 AC_ARG_ENABLE([pt_chown],
357 [AS_HELP_STRING([--enable-pt_chown],
358 [Enable building and installing pt_chown])],
359 [build_pt_chown=$enableval],
361 AC_SUBST(build_pt_chown)
362 if test $build_pt_chown = yes; then
363 AC_DEFINE(HAVE_PT_CHOWN)
366 # The way shlib-versions is used to generate soversions.mk uses a
367 # fairly simplistic model for name recognition that can't distinguish
368 # i486-pc-linux-gnu fully from i486-pc-gnu. So we mutate a $host_os
369 # of `gnu*' here to be `gnu-gnu*' just so that shlib-versions can
370 # tell. This doesn't get used much beyond that, so it's fairly safe.
375 host_os=`echo $host_os | sed -e 's/gnu/gnu-gnu/'`
379 # We keep the original values in `$config_*' and never modify them, so we
380 # can write them unchanged into config.make. Everything else uses
381 # $machine, $vendor, and $os, and changes them whenever convenient.
382 config_machine=$host_cpu config_vendor=$host_vendor config_os=$host_os
384 # Don't allow vendor == "unknown"
385 test "$config_vendor" = unknown && config_vendor=
386 config_os="`echo $config_os | sed 's/^unknown-//'`"
388 # Some configurations imply other options.
391 # The configure fragment of an add-on port can modify these to supplement
392 # or override the table in the case statement below. No fragment should
393 # ever change the config_* variables, however.
394 machine=$config_machine
395 vendor=$config_vendor
399 # config.guess on some IBM machines says `rs6000' instead of `powerpc'.
401 if test "$machine" = rs6000; then
405 # Braindead PowerPC box with absolutely no FPU.
406 case "$machine-$host_os" in
414 AS_HELP_STRING([--with-cpu=CPU], [select code for CPU variant]),
417 yes|'') AC_MSG_ERROR([--with-cpu requires an argument]) ;;
419 *) submachine="$withval" ;;
423 dnl Let sysdeps/*/preconfigure act here, like they can in add-ons.
424 LIBC_PRECONFIGURE([$srcdir], [for sysdeps])
426 # An add-on can set this when it wants to disable the sanity check below.
429 dnl Having this here, though empty, makes sure that if add-ons' fragments
430 dnl do AC_CONFIG_SUBDIRS([some-dir]), which just sets $subdirs, then
431 dnl our AC_OUTPUT will actually use it.
434 case "$enable_add_ons" in
437 add_ons=`cd $srcdir && ls -d 2> /dev/null */configure */sysdeps |
438 sed 's@/[[^/]]*$@@' | sort | uniq`
439 add_ons_automatic=yes
441 *) add_ons=`echo "$enable_add_ons" | sed 's/,/ /g'`
442 add_ons_automatic=no ;;
448 if test x"$add_ons" != x; then
449 for f in $add_ons; do
454 *** It seems that you're using an old \`crypt' add-on. crypt is now
455 *** part of glibc and using the old add-on will not work with this
456 *** release. Start again with fresh sources and without the old
457 *** \`crypt' add-on.])
461 *** It seems that you're using an old \`localedata' add-on. localedata
462 *** is now part of glibc and using the old add-on will not work with
463 *** this release. Start again with fresh sources and without the old
464 *** \`localedata' add-on.])
469 # Now source each add-on's configure fragment.
470 # The fragments can use $srcdir/$libc_add_on to find themselves,
471 # and test $add_ons_automatic to see if they were explicitly requested.
472 # A fragment can clear (or even change) $libc_add_on to affect
473 # whether it goes into the list to be actually used in the build.
475 for libc_add_on in $add_ons; do
476 # Test whether such a directory really exists.
477 # It can be absolute, or relative to $srcdir, or relative to the build dir.
478 case "$libc_add_on" in
480 libc_add_on_srcdir=$libc_add_on
483 test -d "$srcdir/$libc_add_on" || {
484 if test -d "$libc_add_on"; then
485 libc_add_on="`pwd`/$libc_add_on"
487 AC_MSG_ERROR(add-on directory \"$libc_add_on\" does not exist)
490 libc_add_on_srcdir=$srcdir/$libc_add_on
494 libc_add_on_frag=$libc_add_on_srcdir/configure
495 libc_add_on_canonical=
496 libc_add_on_config_subdirs=
497 if test -r "$libc_add_on_frag"; then
498 AC_MSG_NOTICE(running configure fragment for add-on $libc_add_on)
499 libc_add_on_canonical=unknown
501 . "$libc_add_on_frag"
502 test -z "$libc_add_on" || {
503 configured_add_ons="$configured_add_ons $libc_add_on"
504 if test "x$libc_add_on_canonical" = xunknown; then
505 AC_MSG_ERROR(fragment must set \$libc_add_on_canonical)
507 for d in $libc_add_on_subdirs; do
508 case "$libc_add_on" in
509 /*) subdir_srcdir="$libc_add_on" ;;
510 *) subdir_srcdir="\$(..)$libc_add_on" ;;
514 d="${libc_add_on_canonical:-$libc_add_on}"
520 subdir_srcdir="$subdir_srcdir/$d"
523 d=`echo "$d" | sed 's@/*$@@;s@^.*/@@'`
524 add_on_subdirs="$add_on_subdirs $d"
525 test "$subdir_srcdir" = "\$(..)$d" || config_vars="$config_vars
526 $d-srcdir = $subdir_srcdir"
528 for d in $libc_add_on_config_subdirs; do
531 fragment uses absolute path in \$libc_add_on_config_subdirs) ;;
533 if test ! -d "$libc_add_on_srcdir/$d"; then
534 AC_MSG_ERROR(fragment wants to configure missing directory $d)
536 case "$libc_add_on" in
538 relative path required for add-on using \$libc_add_on_config_subdirs) ;;
540 subdirs="$subdirs $libc_add_on/$d"
544 if test -n "$libc_add_on"; then
545 LIBC_PRECONFIGURE([$libc_add_on_srcdir], [add-on $libc_add_on for])
546 use_add_ons="$use_add_ons $libc_add_on"
547 add_ons_pfx="$add_ons_pfx $libc_add_on/"
548 test -z "$libc_add_on_canonical" ||
549 add_ons_sfx="$add_ons_sfx /$libc_add_on_canonical"
552 # Use echo to strip excess whitespace.
553 add_ons="`echo $use_add_ons`"
556 AC_SUBST(add_on_subdirs)
560 ### I put this here to prevent those annoying emails from people who cannot
561 ### read and try to compile glibc on unsupported platforms. --drepper
563 ### By using the undocumented --enable-hacker-mode option for configure
564 ### one can skip this test to make the configuration not fail for unsupported
567 if test -z "$enable_hacker_mode" && test x"$libc_config_ok" != xyes; then
568 case "$machine-$host_os" in
572 echo "*** The GNU C library is currently not available for this platform."
573 echo "*** So far nobody cared to port it and if there is no volunteer it"
574 echo "*** might never happen. So, if you have interest to see glibc on"
575 echo "*** this platform visit"
576 echo "*** http://www.gnu.org/software/libc/porting.html"
577 echo "*** and join the group of porters"
583 dnl We need to use [ and ] for other purposes for a while now.
585 # Expand the configuration machine name into a subdirectory by architecture
586 # type and particular chip. If an add-on configure fragment already set
587 # base_machine, we don't change it.
588 test -n "$base_machine" || case "$machine" in
589 i[4567]86) base_machine=i386 machine=i386/$machine ;;
590 powerpc) base_machine=powerpc machine=powerpc/powerpc32 ;;
591 powerpc64) base_machine=powerpc machine=powerpc/powerpc64 ;;
592 s390) base_machine=s390 machine=s390/s390-32 ;;
593 s390x) base_machine=s390 machine=s390/s390-64 ;;
594 sh3*) base_machine=sh machine=sh/sh3 ;;
595 sh4*) base_machine=sh machine=sh/sh4 ;;
597 base_machine=sparc machine=sparc/sparc32 ;;
598 sparcv8 | supersparc | hypersparc)
599 base_machine=sparc machine=sparc/sparc32/sparcv8 ;;
600 sparcv8plus | sparcv8plusa | sparcv9)
601 base_machine=sparc machine=sparc/sparc32/sparcv9 ;;
602 sparcv8plusb | sparcv9b)
603 base_machine=sparc machine=sparc/sparc32/sparcv9/sparcv9b ;;
605 base_machine=sparc machine=sparc/sparc32/sparcv9/sparcv9v ;;
607 base_machine=sparc machine=sparc/sparc32/sparcv9/sparcv9v2 ;;
609 base_machine=sparc machine=sparc/sparc64 ;;
611 base_machine=sparc machine=sparc/sparc64/sparcv9b ;;
613 base_machine=sparc machine=sparc/sparc64/sparcv9v ;;
615 base_machine=sparc machine=sparc/sparc64/sparcv9v2 ;;
616 *) base_machine=$machine ;;
619 AC_SUBST(base_machine)
621 if test "$base_machine" = "i386"; then
622 AC_DEFINE(USE_REGPARMS)
625 # For the multi-arch option we need support in the assembler & linker.
626 AC_CACHE_CHECK([for assembler and linker STT_GNU_IFUNC support],
627 libc_cv_ld_gnu_indirect_function, [dnl
628 cat > conftest.S <<EOF
629 .type foo,%gnu_indirect_function
642 libc_cv_ld_gnu_indirect_function=no
643 if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
644 -nostartfiles -nostdlib \
645 -o conftest conftest.S 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
646 # Do a link to see if the backend supports IFUNC relocs.
647 $READELF -r conftest 1>&AS_MESSAGE_LOG_FD
648 LC_ALL=C $READELF -r conftest | grep 'no relocations' >/dev/null || {
649 libc_cv_ld_gnu_indirect_function=yes
654 AC_MSG_CHECKING(whether .text pseudo-op must be used)
655 AC_CACHE_VAL(libc_cv_dot_text, [dnl
656 cat > conftest.s <<EOF
660 if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
661 libc_cv_dot_text=.text
664 if test -z "$libc_cv_dot_text"; then
670 if test x"$libc_cv_ld_gnu_indirect_function" != xyes; then
671 if test x"$multi_arch" = xyes; then
672 AC_MSG_ERROR([--enable-multi-arch support requires assembler and linker support])
678 if test x"$multi_arch" != xno; then
679 multi_arch_d=/multiarch
682 # Compute the list of sysdep directories for this configuration.
683 # This can take a while to compute.
684 sysdep_dir=$srcdir/sysdeps
685 AC_MSG_CHECKING(sysdep dirs)
686 dnl We need to use [ and ] for other purposes for a while now.
688 # Make sco3.2v4 become sco3.2.4 and sunos4.1.1_U1 become sunos4.1.1.U1.
689 os="`echo $os | sed 's/\([0-9A-Z]\)[v_]\([0-9A-Z]\)/\1.\2/g'`"
691 test "x$base_os" != x || case "$os" in
698 # For sunos4.1.1, try sunos4.1.1, then sunos4.1, then sunos4, then sunos.
701 while o=`echo $tail | sed 's/\.[^.]*$//'`; test $o != $tail; do
705 o=`echo $tail | sed 's/[0-9]*$//'`
706 if test $o != $tail; then
709 # For linux-gnu, try linux-gnu, then linux.
710 o=`echo $tail | sed 's/-.*$//'`
711 if test $o != $tail; then
715 # For unix/sysv/sysv4, try unix/sysv/sysv4, then unix/sysv, then unix.
718 while b=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$b"; do
724 # For sparc/sparc32, try sparc/sparc32 and then sparc.
726 tail=$machine${submachine:+/$submachine}
727 while m=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$m"; do
729 # Prepend the machine's FPU directory unless --without-fp.
730 if test "$with_fp" = yes; then
735 # For each machine term, try it with and then without /multiarch.
736 for try_fpu in $maybe_fpu ''; do
737 for try_multi in $multi_arch_d ''; do
738 mach="$mach /$1$try_fpu$try_multi"
744 dnl We are done with glob and regexp uses of [ and ]; return to autoconf.
747 # Find what sysdep directories exist.
750 for b in $base ''; do
751 for m0 in $mach ''; do
752 for v in /$vendor ''; do
753 test "$v" = / && continue
754 for o in /$ostry ''; do
755 test "$o" = / && continue
756 for m in $mach ''; do
757 for d in $add_ons_pfx ''; do
758 for a in $add_ons_sfx ''; do
759 try_suffix="$m0$b$v$o$m"
760 if test -n "$try_suffix"; then
761 try_srcdir="${srcdir}/"
765 try="${d}sysdeps$try_suffix$a"
766 test -n "$enable_debug_configure" &&
767 echo "$0 [DEBUG]: try $try" >&2
768 if test -d "$try_srcdir$try"; then
769 sysnames="$sysnames $try"
770 { test -n "$o" || test -n "$b"; } && os_used=t
771 { test -n "$m" || test -n "$m0"; } && machine_used=t
773 x*/$submachine) submachine_used=t ;;
775 if test -n "$d"; then
776 case "$sysnames_add_ons" in
778 *|'') sysnames_add_ons="$sysnames_add_ons $d" ;;
791 # If the assembler supports gnu_indirect_function symbol type and the
792 # architecture supports multi-arch, we enable multi-arch by default.
793 case $sysnames_add_ons$sysnames in
797 test x"$multi_arch" = xdefault && multi_arch=no
800 if test x"$multi_arch" != xno; then
801 AC_DEFINE(USE_MULTIARCH)
805 if test -z "$os_used" && test "$os" != none; then
806 AC_MSG_ERROR(Operating system $os is not supported.)
808 if test -z "$machine_used" && test "$machine" != none; then
809 AC_MSG_ERROR(The $machine is not supported.)
811 if test -z "$submachine_used" && test -n "$submachine"; then
812 AC_MSG_ERROR(The $submachine subspecies of $host_cpu is not supported.)
816 # We have now validated the configuration.
818 # Expand the list of system names into a full list of directories
819 # from each element's parent name and Implies file (if present).
822 while test $# -gt 0; do
826 case " $names " in *" $name "*)
827 # Already in the list.
831 # Report each name as we discover it, so there is no long pause in output.
832 echo $ECHO_N "$name $ECHO_C" >&AS_MESSAGE_FD
834 name_base=`echo $name | sed -e 's@\(.*sysdeps\)/.*@\1@'`
838 *) xsrcdir=$srcdir/ ;;
840 test -n "$enable_debug_configure" &&
841 echo "[DEBUG]: name/Implies $xsrcdir$name/Implies" >&2
843 for implies_file in Implies Implies-before Implies-after; do
844 implies_type=`echo $implies_file | sed s/-/_/`
845 eval ${implies_type}=
846 if test -f $xsrcdir$name/$implies_file; then
847 # Collect more names from the `Implies' file (removing comments).
848 implied_candidate="`sed 's/#.*$//' < $xsrcdir$name/$implies_file`"
849 for x in $implied_candidate; do
851 if test -d $xsrcdir$name_base/$x; then
852 eval "${implies_type}=\"\$${implies_type} \$name_base/\$x\""
855 for d in $add_ons_pfx ''; do
859 *) try_srcdir=$srcdir/ ;;
861 test -n "$enable_debug_configure" &&
862 echo "[DEBUG]: $name $implies_file $x try($d) {$try_srcdir}$try" >&2
863 if test $try != $xsrcdir$name_base/$x && test -d $try_srcdir$try;
865 eval "${implies_type}=\"\$${implies_type} \$try\""
867 case "$sysnames_add_ons" in
869 *|'') sysnames_add_ons="$sysnames_add_ons $d" ;;
873 if test $found = no; then
874 AC_MSG_WARN($name/$implies_file specifies nonexistent $x)
880 # Add NAME to the list of names.
883 # Find the parent of NAME, using the empty string if it has none.
885 parent="`echo $name | sed -n -e 's=/[^/]*$==' -e '/sysdeps$/q' -e p`"
888 test -n "$enable_debug_configure" &&
889 echo "[DEBUG]: $name Implies='$Implies' rest='$*' parent='$parent' \
890 Implies_before='$Implies_before' Implies_after='$Implies_after'" >&2
892 # Add the names implied by NAME, and NAME's parent (if it has one), to
893 # the list of names to be processed (the argument list). We prepend the
894 # implied names to the list and append the parent. We want implied
895 # directories to come before further directories inferred from the
896 # configuration components; this ensures that for sysv4, unix/common
897 # (implied by unix/sysv/sysv4) comes before unix/sysv (in ostry (here $*)
899 sysnames="`echo $Implies $* $Implies_before $parent $Implies_after`"
900 test -n "$sysnames" && set $sysnames
903 # Add the default directories.
904 default_sysnames="sysdeps/generic"
905 sysnames="$names $default_sysnames"
907 # The other names were emitted during the scan.
908 AC_MSG_RESULT($default_sysnames)
910 # Collect the list of add-ons that supply partial sysdeps trees.
912 for add_on in $add_ons; do
915 *) xsrcdir="$srcdir/" ;;
918 test -d "$xsrcdir$add_on/sysdeps" || {
919 case "$configured_add_ons " in
922 AC_MSG_ERROR(add-on $add_on has no configure fragment or sysdeps tree)
928 sysdeps_add_ons="$sysdeps_add_ons $add_on"
929 case "$sysnames_add_ons" in
932 AC_MSG_WARN(add-on $add_on contributed no sysdeps directories)
937 for d in $sysnames; do
939 $add_on/sysdeps/*) ;;
942 (cd "$xsrcdir$d" && for f in *[[!~]]; do
946 test -d "$ff" || { test -e "$ff" && exit 88; }
950 test -d "$f" || { test -e "$f" && exit 88; }
954 if test $? -eq 88; then
959 if test $found = no; then
960 AC_MSG_WARN(add-on $add_on contributed no useful sysdeps directories)
963 AC_SUBST(sysdeps_add_ons)
969 if test "$INSTALL" = "${srcdir}/scripts/install-sh -c"; then
970 # The makefiles need to use a different form to find it in $srcdir.
971 INSTALL='\$(..)./scripts/install-sh -c'
977 # Accept binutils 2.20 or newer.
978 AC_CHECK_PROG_VER(AS, $AS, --version,
979 [GNU assembler.* \([0-9]*\.[0-9.]*\)],
980 [2.1[0-9][0-9]*|2.[2-9][0-9]*|[3-9].*|[1-9][0-9]*], AS=: critic_missing="$critic_missing as")
981 AC_CHECK_PROG_VER(LD, $LD, --version,
982 [GNU ld.* \([0-9][0-9]*\.[0-9.]*\)],
983 [2.1[0-9][0-9]*|2.[2-9][0-9]*|[3-9].*|[1-9][0-9]*], LD=: critic_missing="$critic_missing ld")
985 # These programs are version sensitive.
987 AC_CHECK_PROG_VER(CC, ${ac_tool_prefix}gcc ${ac_tool_prefix}cc, -v,
988 [version \([egcygnustpi-]*[0-9.]*\)], [4.[4-9].* | 4.[1-9][0-9].* | [5-9].* ],
989 critic_missing="$critic_missing gcc")
990 AC_CHECK_PROG_VER(MAKE, gnumake gmake make, --version,
991 [GNU Make[^0-9]*\([0-9][0-9.]*\)],
992 [3.79* | 3.[89]*], critic_missing="$critic_missing make")
994 AC_CHECK_PROG_VER(MSGFMT, gnumsgfmt gmsgfmt msgfmt, --version,
995 [GNU gettext.* \([0-9]*\.[0-9.]*\)],
996 [0.10.3[6-9]* | 0.10.[4-9][0-9]* | 0.1[1-9]* | 0.[2-9][0-9]* | [1-9].*],
997 MSGFMT=: aux_missing="$aux_missing msgfmt")
998 AC_CHECK_PROG_VER(MAKEINFO, makeinfo, --version,
999 [GNU texinfo.* \([0-9][0-9.]*\)],
1000 [4.[5-9]*|4.[1-9][0-9]*|[5-9].*],
1001 MAKEINFO=: aux_missing="$aux_missing makeinfo")
1002 AC_CHECK_PROG_VER(SED, sed, --version,
1003 [GNU sed[^0-9]* \([0-9]*\.[0-9.]*\)],
1004 [3.0[2-9]*|3.[1-9]*|[4-9]*],
1005 SED=: aux_missing="$aux_missing sed")
1006 AC_CHECK_PROG_VER(AWK, gawk, --version,
1007 [GNU Awk[^0-9]*\([0-9][0-9.]*\)],
1008 [3.1.[2-9]*|3.[2-9]*|[4-9]*], critic_missing="$critic_missing gawk")
1010 AC_CHECK_TOOL(NM, nm, false)
1012 AC_CHECK_PROGS(AUTOCONF, autoconf, no)
1013 case "x$AUTOCONF" in
1014 xno|x|x:) AUTOCONF=no ;;
1017 whether $AUTOCONF${ACFLAGS:+ }$ACFLAGS works, libc_cv_autoconf_works, [dnl
1018 if (cd $srcdir; $AUTOCONF $ACFLAGS configure.in > /dev/null 2>&1); then
1019 libc_cv_autoconf_works=yes
1021 libc_cv_autoconf_works=no
1023 test $libc_cv_autoconf_works = yes || AUTOCONF=no
1026 if test "x$AUTOCONF" = xno; then
1027 aux_missing="$aux_missing autoconf"
1030 test -n "$critic_missing" && AC_MSG_ERROR([
1031 *** These critical programs are missing or too old:$critic_missing
1032 *** Check the INSTALL file for required versions.])
1034 test -n "$aux_missing" && AC_MSG_WARN([
1035 *** These auxiliary programs are missing or incompatible versions:$aux_missing
1036 *** some features will be disabled.
1037 *** Check the INSTALL file for required versions.])
1039 # if using special system headers, find out the compiler's sekrit
1040 # header directory and add that to the list. NOTE: Only does the right
1041 # thing on a system that doesn't need fixincludes. (Not presently a problem.)
1042 if test -n "$sysheaders"; then
1043 SYSINCLUDES=-nostdinc
1044 for d in include include-fixed; do
1045 i=`$CC -print-file-name="$d"` && test "x$i" != x && test "x$i" != "x$d" &&
1046 SYSINCLUDES="$SYSINCLUDES -isystem $i"
1048 SYSINCLUDES="$SYSINCLUDES \
1049 -isystem `echo $sysheaders | sed 's/:/ -isystem /g'`"
1050 if test -n "$CXX"; then
1052 for cxxheaders in `$CXX -v -S -x c++ /dev/null -o /dev/null 2>&1 \
1053 | sed -n -e '1,/#include/d' -e 's/^ \(\/.*\/[cg]++\)/\1/p'`; do
1054 test "x$cxxheaders" != x &&
1055 CXX_SYSINCLUDES="$CXX_SYSINCLUDES -isystem $cxxheaders"
1059 AC_SUBST(SYSINCLUDES)
1060 AC_SUBST(CXX_SYSINCLUDES)
1062 # Test if LD_LIBRARY_PATH contains the notation for the current directory
1063 # since this would lead to problems installing/building glibc.
1064 # LD_LIBRARY_PATH contains the current directory if one of the following
1066 # - one of the terminals (":" and ";") is the first or last sign
1067 # - two terminals occur directly after each other
1068 # - the path contains an element with a dot in it
1069 AC_MSG_CHECKING(LD_LIBRARY_PATH variable)
1071 case ${LD_LIBRARY_PATH} in
1072 [:\;]* | *[:\;] | *[:\;][:\;]* | *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* )
1073 ld_library_path_setting="contains current directory"
1076 ld_library_path_setting="ok"
1080 AC_MSG_RESULT($ld_library_path_setting)
1081 if test "$ld_library_path_setting" != "ok"; then
1083 *** LD_LIBRARY_PATH shouldn't contain the current directory when
1084 *** building glibc. Please change the environment variable
1085 *** and run configure again.])
1088 AC_CACHE_CHECK(whether GCC supports -static-libgcc, libc_cv_gcc_static_libgcc, [dnl
1089 if $CC -v -static-libgcc 2>&1 | grep 'unrecognized option.*static-libgcc' >/dev/null; then
1090 libc_cv_gcc_static_libgcc=
1092 libc_cv_gcc_static_libgcc=-static-libgcc
1094 AC_SUBST(libc_cv_gcc_static_libgcc)
1096 AC_PATH_PROG(BASH_SHELL, bash, no)
1097 if test "$BASH_SHELL" != no &&
1098 $BASH_SHELL -c 'test "$BASH_VERSINFO" \
1099 && test "$BASH_VERSINFO" -ge 2 >&/dev/null'; then
1100 libc_cv_have_bash2=yes
1102 libc_cv_have_bash2=no
1104 AC_SUBST(libc_cv_have_bash2)
1106 dnl We need a ksh compatible shell for tzselect.
1107 if test "$BASH_SHELL" = no; then
1108 AC_PATH_PROG(KSH, ksh, no)
1109 if test "$KSH" = no; then
1112 libc_cv_have_ksh=yes
1117 libc_cv_have_ksh=yes
1119 AC_SUBST(libc_cv_have_ksh)
1121 AC_PATH_PROG(PERL, perl, no)
1122 if test "$PERL" != no &&
1123 (eval `$PERL -V:apiversion`; test `expr "$apiversion" \< 5` -ne 0); then
1126 AC_PATH_PROG(INSTALL_INFO, install-info, no,
1127 $PATH:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin)
1128 AC_PATH_PROG(BISON, bison, no, $PATH:/usr/local/bin:/usr/bin:/bin)
1130 AC_CACHE_CHECK(for libc-friendly stddef.h, libc_cv_friendly_stddef, [dnl
1132 [#define __need_size_t
1133 #define __need_wchar_t
1136 #include <stddef.h>], [size_t size; wchar_t wchar;
1138 #error stddef.h ignored __need_*
1140 if (&size == NULL || &wchar == NULL) abort ();],
1141 libc_cv_friendly_stddef=yes,
1142 libc_cv_friendly_stddef=no)])
1143 if test $libc_cv_friendly_stddef = yes; then
1144 config_vars="$config_vars
1145 override stddef.h = # The installed <stddef.h> seems to be libc-friendly."
1148 AC_CACHE_CHECK(whether we need to use -P to assemble .S files,
1149 libc_cv_need_minus_P, [dnl
1150 cat > conftest.S <<EOF
1151 #include "confdefs.h"
1152 /* Nothing whatsoever. */
1154 if AC_TRY_COMMAND(${CC-cc} $CPPFLAGS $ASFLAGS -c conftest.S 1>&AS_MESSAGE_LOG_FD); then
1155 libc_cv_need_minus_P=no
1157 libc_cv_need_minus_P=yes
1160 if test $libc_cv_need_minus_P = yes; then
1161 config_vars="$config_vars
1162 asm-CPPFLAGS = -P # The assembler can't grok cpp's # line directives."
1165 AC_CACHE_CHECK(for .set assembler directive, libc_cv_asm_set_directive, [dnl
1166 cat > conftest.s <<EOF
1169 .set glibc_conftest_frobozz,foo
1170 .globl glibc_conftest_frobozz
1172 # The alpha-dec-osf1 assembler gives only a warning for `.set'
1173 # (but it doesn't work), so we must do a linking check to be sure.
1174 cat > conftest1.c <<\EOF
1175 extern int glibc_conftest_frobozz;
1176 void _start() { glibc_conftest_frobozz = 1; }
1178 if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
1179 -nostartfiles -nostdlib \
1180 -o conftest conftest.s conftest1.c 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
1181 libc_cv_asm_set_directive=yes
1183 libc_cv_asm_set_directive=no
1186 if test $libc_cv_asm_set_directive = yes; then
1187 AC_DEFINE(HAVE_ASM_SET_DIRECTIVE)
1190 AC_CACHE_CHECK(for assembler gnu_unique_object symbol type,
1191 libc_cv_asm_unique_object, [dnl
1192 cat > conftest.s <<EOF
1195 .type _sym, %gnu_unique_object
1197 if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
1198 libc_cv_asm_unique_object=yes
1200 libc_cv_asm_unique_object=no
1203 if test $libc_cv_asm_unique_object = yes; then
1204 AC_DEFINE(HAVE_ASM_UNIQUE_OBJECT)
1207 AC_CACHE_CHECK(for .symver assembler directive, libc_cv_asm_symver_directive,
1208 [cat > conftest.s <<EOF
1211 .symver _sym,sym@VERS
1213 if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
1214 libc_cv_asm_symver_directive=yes
1216 libc_cv_asm_symver_directive=no
1219 AC_CACHE_CHECK(for ld --version-script, libc_cv_ld_version_script_option, [dnl
1220 if test $libc_cv_asm_symver_directive = yes; then
1221 cat > conftest.s <<EOF
1224 .symver _sym,sym@VERS
1226 cat > conftest.map <<EOF
1235 if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
1236 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $LDFLAGS -shared
1237 -o conftest.so conftest.o
1238 -nostartfiles -nostdlib
1239 -Wl,--version-script,conftest.map
1240 1>&AS_MESSAGE_LOG_FD]);
1242 libc_cv_ld_version_script_option=yes
1244 libc_cv_ld_version_script_option=no
1247 libc_cv_ld_version_script_option=no
1250 libc_cv_ld_version_script_option=no
1253 if test $shared != no &&
1254 test $libc_cv_asm_symver_directive = yes &&
1255 test $libc_cv_ld_version_script_option = yes &&
1256 test $enable_versioning = yes; then
1258 AC_DEFINE(DO_VERSIONING)
1262 AC_SUBST(VERSIONING)
1264 if test $shared != no && test $VERSIONING = no; then
1266 *** WARNING: You should not compile GNU libc without versioning. Not using
1267 *** versioning will introduce incompatibilities so that old binaries
1268 *** will not run anymore.
1269 *** For versioning you need recent binutils (binutils-2.8.1.0.23 or newer)."
1271 AC_CACHE_CHECK(for .previous assembler directive,
1272 libc_cv_asm_previous_directive, [dnl
1273 cat > conftest.s <<EOF
1274 .section foo_section
1277 if AC_TRY_COMMAND(${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
1278 libc_cv_asm_previous_directive=yes
1280 libc_cv_asm_previous_directive=no
1283 if test $libc_cv_asm_previous_directive = yes; then
1284 AC_DEFINE(HAVE_ASM_PREVIOUS_DIRECTIVE)
1286 AC_CACHE_CHECK(for .popsection assembler directive,
1287 libc_cv_asm_popsection_directive, [dnl
1288 cat > conftest.s <<EOF
1289 .pushsection foo_section
1292 if AC_TRY_COMMAND(${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
1293 libc_cv_asm_popsection_directive=yes
1295 libc_cv_asm_popsection_directive=no
1298 if test $libc_cv_asm_popsection_directive = yes; then
1299 AC_DEFINE(HAVE_ASM_POPSECTION_DIRECTIVE)
1302 AC_CACHE_CHECK(for .protected and .hidden assembler directive,
1303 libc_cv_asm_protected_directive, [dnl
1304 cat > conftest.s <<EOF
1310 if AC_TRY_COMMAND(${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
1311 libc_cv_asm_protected_directive=yes
1313 AC_MSG_ERROR(assembler support for symbol visibility is required)
1317 if test $libc_cv_asm_protected_directive = yes; then
1318 AC_CACHE_CHECK(whether __attribute__((visibility())) is supported,
1319 libc_cv_visibility_attribute,
1320 [cat > conftest.c <<EOF
1321 int foo __attribute__ ((visibility ("hidden"))) = 1;
1322 int bar __attribute__ ((visibility ("protected"))) = 1;
1324 libc_cv_visibility_attribute=no
1325 if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
1326 if grep '\.hidden.*foo' conftest.s >/dev/null; then
1327 if grep '\.protected.*bar' conftest.s >/dev/null; then
1328 libc_cv_visibility_attribute=yes
1332 rm -f conftest.{c,s}
1334 if test $libc_cv_visibility_attribute != yes; then
1335 AC_MSG_ERROR(compiler support for visibility attribute is required)
1339 if test $libc_cv_visibility_attribute = yes; then
1340 AC_CACHE_CHECK(for broken __attribute__((visibility())),
1341 libc_cv_broken_visibility_attribute,
1342 [cat > conftest.c <<EOF
1344 int bar (int x) __asm__ ("foo") __attribute__ ((visibility ("hidden")));
1345 int bar (int x) { return x; }
1347 libc_cv_broken_visibility_attribute=yes
1348 if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
1350 if grep '\.hidden[ _]foo' conftest.s >/dev/null; then
1352 libc_cv_broken_visibility_attribute=no
1355 rm -f conftest.c conftest.s
1357 if test $libc_cv_broken_visibility_attribute = yes; then
1358 AC_MSG_ERROR(working compiler support for visibility attribute is required)
1362 AC_CACHE_CHECK(for broken __attribute__((alias())),
1363 libc_cv_broken_alias_attribute,
1364 [cat > conftest.c <<EOF
1365 extern int foo (int x) __asm ("xyzzy");
1366 int bar (int x) { return x; }
1367 extern __typeof (bar) foo __attribute ((weak, alias ("bar")));
1369 extern __typeof (dfoo) dfoo __asm ("abccb");
1372 libc_cv_broken_alias_attribute=yes
1373 if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
1374 if grep 'xyzzy' conftest.s >/dev/null &&
1375 grep 'abccb' conftest.s >/dev/null; then
1376 libc_cv_broken_alias_attribute=no
1379 rm -f conftest.c conftest.s
1381 if test $libc_cv_broken_alias_attribute = yes; then
1382 AC_MSG_ERROR(working alias attribute support required)
1385 if test $libc_cv_visibility_attribute = yes; then
1386 AC_CACHE_CHECK(whether to put _rtld_local into .sdata section,
1387 libc_cv_have_sdata_section,
1388 [echo "int i;" > conftest.c
1389 libc_cv_have_sdata_section=no
1390 if ${CC-cc} $LDFLAGS -fPIC -shared -Wl,--verbose conftest.c -o conftest.so 2>&1 \
1391 | grep '\.sdata' >/dev/null; then
1392 libc_cv_have_sdata_section=yes
1394 rm -f conftest.c conftest.so
1396 if test $libc_cv_have_sdata_section = yes; then
1397 AC_DEFINE(HAVE_SDATA_SECTION)
1401 AC_CACHE_CHECK(for .preinit_array/.init_array/.fini_array support,
1402 libc_cv_initfini_array, [dnl
1403 LIBC_TRY_LINK_STATIC([
1404 int foo (void) { return 1; }
1405 int (*fp) (void) __attribute__ ((section (".init_array"))) = foo;
1407 [if $READELF -S conftest | fgrep INIT_ARRAY > /dev/null; then
1408 libc_cv_initfini_array=yes
1410 libc_cv_initfini_array=no
1412 [libc_cv_initfini_array=no])
1414 if test $libc_cv_initfini_array != yes; then
1415 AC_MSG_ERROR([Need linker with .init_array/.fini_array support.])
1418 AC_CACHE_CHECK(whether to use .ctors/.dtors header and trailer,
1419 libc_cv_ctors_header, [dnl
1420 libc_cv_ctors_header=yes
1421 LIBC_TRY_LINK_STATIC([
1422 __attribute__ ((constructor)) void ctor (void) { asm (""); }
1423 __attribute__ ((destructor)) void dtor (void) { asm (""); }
1426 AS_IF([$READELF -WS conftest$ac_exeext | $AWK '
1427 { gsub(/\@<:@ */, "@<:@") }
1428 $2 == ".ctors" || $2 == ".dtors" {
1429 size = strtonum("0x" $6)
1430 align = strtonum("0x" $NF)
1432 stub@<:@$2@:>@ = size == align * 2
1435 ctors_ok = !seen@<:@".ctors"@:>@ || stub@<:@".ctors"@:>@
1436 dtors_ok = !seen@<:@".dtors"@:>@ || stub@<:@".dtors"@:>@
1437 exit ((ctors_ok && dtors_ok) ? 0 : 1)
1439 '], [libc_cv_ctors_header=no])
1441 AC_MSG_ERROR([missing __attribute__ ((constructor)) support??])
1444 if test $libc_cv_ctors_header = no; then
1445 AC_DEFINE(NO_CTORS_DTORS_SECTIONS)
1448 AC_CACHE_CHECK(for libunwind-support in compiler,
1449 libc_cv_cc_with_libunwind, [
1450 cat > conftest.c <<EOF
1451 int main (void) { return 0; }
1453 if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -static -o conftest \
1454 conftest.c -v 2>&1 >/dev/null | grep ' -lunwind ' >/dev/null; then
1455 libc_cv_cc_with_libunwind=yes
1457 libc_cv_cc_with_libunwind=no
1460 AC_SUBST(libc_cv_cc_with_libunwind)
1461 if test $libc_cv_cc_with_libunwind = yes; then
1462 AC_DEFINE(HAVE_CC_WITH_LIBUNWIND)
1465 LIBC_LINKER_FEATURE([-z nodelete], [-Wl,--enable-new-dtags,-z,nodelete],
1466 [libc_cv_z_nodelete=yes],
1467 [AC_MSG_ERROR(linker with -z nodelete support required)])
1469 LIBC_LINKER_FEATURE([-z nodlopen], [-Wl,--enable-new-dtags,-z,nodlopen],
1470 [libc_cv_z_nodlopen=yes],
1471 [AC_MSG_ERROR(linker with -z nodlopen support required)])
1473 LIBC_LINKER_FEATURE([-z initfirst], [-Wl,--enable-new-dtags,-z,initfirst],
1474 [libc_cv_z_initfirst=yes],
1475 [AC_MSG_ERROR(linker with -z initfirst support required)])
1477 # Add-on fragments can set these for other machines.
1478 libc_commonpagesize=${libc_commonpagesize:-no}
1479 libc_relro_required=${libc_relro_required:-no}
1480 case "$base_machine" in
1481 i[[34567]]86 | x86_64 | powerpc* | s390*)
1482 libc_commonpagesize=0x1000
1483 libc_relro_required=yes
1486 libc_commonpagesize=0x2000
1487 libc_relro_required=yes
1491 if test $libc_commonpagesize != no; then
1492 AC_CACHE_CHECK(for -z relro option,
1493 libc_cv_z_relro, [dnl
1495 AC_LANG_CONFTEST([AC_LANG_SOURCE([[
1496 int _start (void) { return 42; }
1497 extern void _exit (int);
1498 /* Since these pointers are const, they should go in rodata.
1499 Since they refer to functions that have to be resolved by
1500 dynamic linking, they should instead go in RELRO data. */
1501 const void *const relro[] = { &_start, &_exit, 0 };
1502 /* GNU ld fails to produce RELRO data when it's very small and there is no
1503 normal writable data following it, or if only uninitialized (.bss) data
1504 follows it, or only very small writable data. */
1505 int data[0x10000] = { 1, };
1507 cat > conftest.awk <<\EOF
1510 commonpagesize = strtonum(commonpagesize)
1512 { print "LINE:", $0 > "/dev/stderr" }
1514 vaddr = strtonum($3)
1515 memsz = strtonum($6)
1517 printf "vaddr %#x memsz %#x end %#x commonpagesize %#x\n", \
1518 vaddr, memsz, end, commonpagesize > "/dev/stderr"
1519 result = (end % commonpagesize == 0) ? "yes" : "broken"
1521 END { print result }
1523 AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1524 -fPIC -shared -o conftest.so conftest.c
1525 -nostartfiles -nostdlib
1526 -Wl,-z,relro 1>&AS_MESSAGE_LOG_FD]) &&
1527 AC_TRY_COMMAND([$READELF -Wl conftest.so > conftest.ph]) &&
1529 $AWK -v commonpagesize=$libc_commonpagesize -f conftest.awk
1530 conftest.ph > conftest.cps
1532 libc_cv_z_relro=`cat conftest.cps 2>&AS_MESSAGE_LOG_FD`
1534 if { test "x$libc_relro_required" = xyes &&
1535 test "x$libc_cv_z_relro" != xyes
1538 AC_MSG_ERROR(linker with -z relro support required)
1541 AC_MSG_WARN([missing architecture parameter to check for working -z relro])
1544 AC_CACHE_CHECK(for -Bgroup option,
1545 libc_cv_Bgroup, [dnl
1546 cat > conftest.c <<EOF
1547 int _start (void) { return 42; }
1549 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1550 -fPIC -shared -o conftest.so conftest.c
1551 -Wl,-Bgroup -nostdlib 1>&AS_MESSAGE_LOG_FD])
1558 AC_SUBST(libc_cv_Bgroup)
1561 AC_CACHE_CHECK(whether --noexecstack is desirable for .S files,
1562 libc_cv_as_noexecstack, [dnl
1563 cat > conftest.c <<EOF
1566 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS
1567 -S -o conftest.s conftest.c 1>&AS_MESSAGE_LOG_FD]) \
1568 && grep .note.GNU-stack conftest.s >/dev/null \
1569 && AC_TRY_COMMAND([${CC-cc} $ASFLAGS -Wa,--noexecstack
1570 -c -o conftest.o conftest.s 1>&AS_MESSAGE_LOG_FD])
1572 libc_cv_as_noexecstack=yes
1574 libc_cv_as_noexecstack=no
1577 if test $libc_cv_as_noexecstack = yes; then
1578 ASFLAGS_config="$ASFLAGS_config -Wa,--noexecstack"
1580 AC_SUBST(ASFLAGS_config)
1582 AC_CACHE_CHECK(for -z combreloc,
1583 libc_cv_z_combreloc, [dnl
1584 cat > conftest.c <<EOF
1585 extern int bar (int);
1587 int foo (void) { return bar (mumble); }
1589 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1590 -fPIC -shared -o conftest.so conftest.c
1591 -nostdlib -nostartfiles
1592 -Wl,-z,combreloc 1>&AS_MESSAGE_LOG_FD])
1594 dnl The following test is a bit weak. We must use a tool which can test
1595 dnl cross-platform since the gcc used can be a cross compiler. Without
1596 dnl introducing new options this is not easily doable. Instead use a tool
1597 dnl which always is cross-platform: readelf. To detect whether -z combreloc
1598 dnl look for a section named .rel.dyn.
1599 if $READELF -S conftest.so | grep '\.rel\(a\|\)\.dyn' > /dev/null; then
1600 libc_cv_z_combreloc=yes
1602 libc_cv_z_combreloc=no
1605 libc_cv_z_combreloc=no
1608 if test "$libc_cv_z_combreloc" = yes; then
1609 AC_DEFINE(HAVE_Z_COMBRELOC)
1611 AC_SUBST(libc_cv_z_combreloc)
1613 LIBC_LINKER_FEATURE([-z execstack], [-Wl,-z,execstack],
1614 [libc_cv_z_execstack=yes], [libc_cv_z_execstack=no])
1615 AC_SUBST(libc_cv_z_execstack)
1617 AC_CACHE_CHECK(for -fpie, libc_cv_fpie, [dnl
1618 LIBC_TRY_CC_OPTION([-fpie], [libc_cv_fpie=yes], [libc_cv_fpie=no])
1621 AC_SUBST(libc_cv_fpie)
1623 AC_CACHE_CHECK(for --hash-style option,
1624 libc_cv_hashstyle, [dnl
1625 cat > conftest.c <<EOF
1626 int _start (void) { return 42; }
1628 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1629 -fPIC -shared -o conftest.so conftest.c
1630 -Wl,--hash-style=both -nostdlib 1>&AS_MESSAGE_LOG_FD])
1632 libc_cv_hashstyle=yes
1634 libc_cv_hashstyle=no
1637 AC_SUBST(libc_cv_hashstyle)
1639 # The linker's default -shared behavior is good enough if it
1640 # does these things that our custom linker scripts ensure that
1641 # all allocated NOTE sections come first.
1642 if test "$use_default_link" = default; then
1643 AC_CACHE_CHECK([for sufficient default -shared layout],
1644 libc_cv_use_default_link, [dnl
1645 libc_cv_use_default_link=no
1646 cat > conftest.s <<\EOF
1647 .section .note.a,"a",%note
1652 .section .note.b,"a",%note
1658 if AC_TRY_COMMAND([dnl
1659 ${CC-cc} $ASFLAGS -shared -o conftest.so conftest.s 1>&AS_MESSAGE_LOG_FD]) &&
1660 ac_try=`$READELF -S conftest.so | sed -n \
1662 s/^ *\[ *[1-9][0-9]*\] *\([^ ][^ ]*\) *\([^ ][^ ]*\) .*$/\2 \1/
1668 libc_seen_a=no libc_seen_b=no
1670 while test $# -ge 2 -a "$1" = NOTE; do
1672 .note.a) libc_seen_a=yes ;;
1673 .note.b) libc_seen_b=yes ;;
1677 case "$libc_seen_a$libc_seen_b" in
1679 libc_cv_use_default_link=yes
1682 echo >&AS_MESSAGE_LOG_FD "\
1683 $libc_seen_a$libc_seen_b from:
1689 use_default_link=$libc_cv_use_default_link
1692 AC_CACHE_CHECK(linker output format, libc_cv_output_format, [dnl
1693 if libc_cv_output_format=`
1694 ${CC-cc} -nostartfiles -nostdlib -Wl,--print-output-format 2>&AS_MESSAGE_LOG_FD`
1698 libc_cv_output_format=
1700 test -n "$libc_cv_output_format" || libc_cv_output_format=unknown])
1701 AC_SUBST(libc_cv_output_format)
1703 AC_CACHE_CHECK(for -fno-toplevel-reorder -fno-section-anchors, libc_cv_fno_toplevel_reorder, [dnl
1704 cat > conftest.c <<EOF
1707 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -fno-toplevel-reorder -fno-section-anchors
1708 conftest.c 1>&AS_MESSAGE_LOG_FD])
1710 libc_cv_fno_toplevel_reorder=yes
1712 libc_cv_fno_toplevel_reorder=no
1715 if test $libc_cv_fno_toplevel_reorder = yes; then
1716 fno_unit_at_a_time="-fno-toplevel-reorder -fno-section-anchors"
1718 fno_unit_at_a_time=-fno-unit-at-a-time
1720 AC_SUBST(fno_unit_at_a_time)
1722 AC_CACHE_CHECK(for -fstack-protector, libc_cv_ssp, [dnl
1723 LIBC_TRY_CC_OPTION([$CFLAGS $CPPFLAGS -Werror -fstack-protector],
1727 AC_SUBST(libc_cv_ssp)
1729 AC_CACHE_CHECK(for -fgnu89-inline, libc_cv_gnu89_inline, [dnl
1730 cat > conftest.c <<EOF
1732 #ifdef __GNUC_GNU_INLINE__
1733 main () { return 0;}
1738 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -std=gnu99 -fgnu89-inline
1739 -o conftest.s conftest.c 1>&AS_MESSAGE_LOG_FD])
1741 libc_cv_gnu89_inline=yes
1743 libc_cv_gnu89_inline=no
1746 if test $libc_cv_gnu89_inline = yes; then
1747 gnu89_inline=-fgnu89-inline
1751 AC_SUBST(gnu89_inline)
1753 AC_CACHE_CHECK(whether cc puts quotes around section names,
1754 libc_cv_have_section_quotes,
1755 [cat > conftest.c <<EOF
1756 static const int foo
1757 __attribute__ ((section ("bar"))) = 1;
1759 if ${CC-cc} -S conftest.c -o conftest.s; then
1760 if grep '\.section.*"bar"' conftest.s >/dev/null; then
1761 libc_cv_have_section_quotes=yes
1763 libc_cv_have_section_quotes=no
1766 libc_cv_have_section_quotes=unknown
1768 rm -f conftest.{c,s}
1770 if test $libc_cv_have_section_quotes = yes; then
1771 AC_DEFINE(HAVE_SECTION_QUOTES)
1774 AC_CACHE_CHECK(for assembler .weak directive, libc_cv_asm_weak_directive,
1776 cat > conftest.s <<EOF
1781 .weak bar; bar = foo
1783 if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
1784 libc_cv_asm_weak_directive=yes
1786 libc_cv_asm_weak_directive=no
1790 if test $libc_cv_asm_weak_directive = no; then
1791 AC_CACHE_CHECK(for assembler .weakext directive,
1792 libc_cv_asm_weakext_directive,
1794 cat > conftest.s <<EOF
1803 if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
1804 libc_cv_asm_weakext_directive=yes
1806 libc_cv_asm_weakext_directive=no
1812 if test $libc_cv_asm_weak_directive = yes; then
1813 AC_DEFINE(HAVE_ASM_WEAK_DIRECTIVE)
1814 elif test $libc_cv_asm_weakext_directive = yes; then
1815 AC_DEFINE(HAVE_ASM_WEAKEXT_DIRECTIVE)
1818 AC_CACHE_CHECK(whether CFI directives are supported, libc_cv_asm_cfi_directives, [dnl
1820 sparc/sparc64*) cfi_offset=2047;;
1823 cat > conftest.s <<EOF
1825 .type func,%function
1829 .cfi_rel_offset 1, $cfi_offset
1832 if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
1833 libc_cv_asm_cfi_directives=yes
1835 libc_cv_asm_cfi_directives=no
1838 if test $libc_cv_asm_cfi_directives = yes; then
1839 AC_DEFINE(HAVE_ASM_CFI_DIRECTIVES)
1842 AC_CACHE_CHECK(for ld --no-whole-archive, libc_cv_ld_no_whole_archive, [dnl
1843 cat > conftest.c <<\EOF
1848 dnl No \ in command here because it ends up inside ''.
1849 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1850 -nostdlib -nostartfiles -Wl,--no-whole-archive
1851 -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD]); then
1852 libc_cv_ld_no_whole_archive=yes
1854 libc_cv_ld_no_whole_archive=no
1857 if test $libc_cv_ld_no_whole_archive = no; then
1858 AC_MSG_ERROR([support for --no-whole-archive is needed])
1861 AC_CACHE_CHECK(for gcc -fexceptions, libc_cv_gcc_exceptions, [dnl
1862 cat > conftest.c <<\EOF
1867 dnl No \ in command here because it ends up inside ''.
1868 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1869 -nostdlib -nostartfiles -fexceptions
1870 -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD]); then
1871 libc_cv_gcc_exceptions=yes
1873 libc_cv_gcc_exceptions=no
1876 if test $libc_cv_gcc_exceptions = yes; then
1877 exceptions=-fexceptions
1879 AC_SUBST(exceptions)dnl
1881 if test "$host_cpu" = powerpc ; then
1882 # Check for a bug present in at least versions 2.8.x of GCC
1883 # and versions 1.0.x of EGCS.
1884 AC_CACHE_CHECK(whether clobbering cr0 causes problems,libc_cv_c_asmcr0_bug,[dnl
1885 AC_TRY_COMPILE([int tester(int x) { asm ("" : : : "cc"); return x & 123; }],,
1886 libc_cv_c_asmcr0_bug='no',
1887 libc_cv_c_asmcr0_bug='yes')])
1888 if test "$libc_cv_c_asmcr0_bug" != 'no'; then
1889 AC_DEFINE(BROKEN_PPC_ASM_CR0)
1893 AC_CACHE_CHECK(for __builtin_memset, libc_cv_gcc_builtin_memset, [dnl
1894 cat > conftest.c <<\EOF
1897 __builtin_memset (x, 0, 1000);
1901 if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | fgrep "memset" > /dev/null]);
1903 libc_cv_gcc_builtin_memset=no
1905 libc_cv_gcc_builtin_memset=yes
1908 if test "$libc_cv_gcc_builtin_memset" = yes ; then
1909 AC_DEFINE(HAVE_BUILTIN_MEMSET)
1912 AC_CACHE_CHECK(for redirection of built-in functions, libc_cv_gcc_builtin_redirection, [dnl
1913 cat > conftest.c <<\EOF
1914 extern char *strstr (const char *, const char *) __asm ("my_strstr");
1915 char *foo (const char *a, const char *b)
1917 return __builtin_strstr (a, b);
1921 if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | fgrep "my_strstr" > /dev/null]);
1923 libc_cv_gcc_builtin_redirection=yes
1925 libc_cv_gcc_builtin_redirection=no
1928 if test "$libc_cv_gcc_builtin_redirection" = no; then
1929 AC_MSG_ERROR([support for the symbol redirection needed])
1932 dnl Check whether the compiler supports the __thread keyword.
1933 AC_CACHE_CHECK([for __thread], libc_cv_gcc___thread,
1934 [cat > conftest.c <<\EOF
1935 __thread int a = 42;
1937 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c >&AS_MESSAGE_LOG_FD]); then
1938 libc_cv_gcc___thread=yes
1940 libc_cv_gcc___thread=no
1943 if test "$libc_cv_gcc___thread" = no; then
1944 AC_MSG_ERROR([support for the __thread keyword is required])
1947 dnl Check whether the compiler supports the tls_model attribute.
1948 AC_CACHE_CHECK([for tls_model attribute], libc_cv_gcc_tls_model_attr, [dnl
1949 cat > conftest.c <<\EOF
1950 extern __thread int a __attribute__((tls_model ("initial-exec")));
1952 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -Werror conftest.c >&AS_MESSAGE_LOG_FD]); then
1953 libc_cv_gcc_tls_model_attr=yes
1955 libc_cv_gcc_tls_model_attr=no
1958 if test "$libc_cv_gcc_tls_model_attr" = no; then
1959 AC_MSG_ERROR([support for the tls_model attribute is required])
1962 dnl Determine how to disable generation of FMA instructions.
1963 AC_CACHE_CHECK([for compiler option to disable generation of FMA instructions],
1964 libc_cv_cc_nofma, [dnl
1966 for opt in -ffp-contract=off -mno-fused-madd; do
1967 LIBC_TRY_CC_OPTION([$opt], [libc_cv_cc_nofma=$opt; break])
1969 AC_SUBST(libc_cv_cc_nofma)
1971 if test -n "$submachine"; then
1972 AC_CACHE_CHECK([for compiler option for CPU variant],
1973 libc_cv_cc_submachine, [dnl
1974 libc_cv_cc_submachine=no
1975 for opt in "-march=$submachine" "-mcpu=$submachine"; do
1976 LIBC_TRY_CC_OPTION([$opt], [
1977 libc_cv_cc_submachine="$opt"
1980 if test "x$libc_cv_cc_submachine" = xno; then
1981 AC_MSG_ERROR([${CC-cc} does not support $submachine])
1984 AC_SUBST(libc_cv_cc_submachine)
1986 AC_CACHE_CHECK(if $CC accepts -fno-tree-loop-distribute-patterns with \
1987 __attribute__ ((__optimize__)), libc_cv_cc_loop_to_function, [dnl
1988 cat > conftest.c <<EOF
1990 __attribute__ ((__optimize__ ("-fno-tree-loop-distribute-patterns")))
1993 libc_cv_cc_loop_to_function=no
1994 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c])
1996 libc_cv_cc_loop_to_function=yes
1999 if test $libc_cv_cc_loop_to_function = yes; then
2000 AC_DEFINE(HAVE_CC_INHIBIT_LOOP_TO_LIBCALL)
2002 AC_SUBST(libc_cv_cc_loop_to_function)
2004 dnl Check whether we have the gd library available.
2005 AC_MSG_CHECKING(for libgd)
2006 if test "$with_gd" != "no"; then
2007 old_CFLAGS="$CFLAGS"
2008 CFLAGS="$CFLAGS $libgd_include"
2009 old_LDFLAGS="$LDFLAGS"
2010 LDFLAGS="$LDFLAGS $libgd_ldflags"
2012 LIBS="$LIBS -lgd -lpng -lz -lm"
2013 AC_TRY_LINK([#include <gd.h>], [gdImagePng (0, 0)], LIBGD=yes, LIBGD=no)
2014 CFLAGS="$old_CFLAGS"
2015 LDFLAGS="$old_LDFLAGS"
2020 AC_MSG_RESULT($LIBGD)
2024 if test x$with_selinux = xno ; then
2027 # See if we have the SELinux library
2028 AC_CHECK_LIB(selinux, is_selinux_enabled,
2029 have_selinux=yes, have_selinux=no)
2030 # See if we have the SELinux header with the NSCD permissions in it.
2031 if test x$have_selinux = xyes ; then
2032 AC_MSG_CHECKING([for NSCD Flask permissions in selinux/av_permissions.h])
2033 AC_TRY_COMPILE([#include <selinux/av_permissions.h>],
2034 [#ifdef NSCD__SHMEMHOST
2037 #error NSCD__SHMEMHOST not defined
2039 have_selinux=yes, have_selinux=no)
2040 AC_MSG_RESULT($have_selinux)
2043 if test x$with_selinux = xyes ; then
2044 if test x$have_selinux = xno ; then
2045 AC_MSG_ERROR([SELinux explicitly required, but sufficiently recent SELinux library not found])
2049 # Check if we're building with SELinux support.
2050 if test "x$have_selinux" = xyes; then
2051 AC_DEFINE(HAVE_SELINUX, 1, [SELinux support])
2053 # See if we have the libaudit library
2054 AC_CHECK_LIB(audit, audit_log_user_avc_message,
2055 have_libaudit=yes, have_libaudit=no)
2056 if test "x$have_libaudit" = xyes; then
2057 AC_DEFINE(HAVE_LIBAUDIT, 1, [SELinux libaudit support])
2059 AC_SUBST(have_libaudit)
2061 # See if we have the libcap library
2062 AC_CHECK_LIB(cap, cap_init, have_libcap=yes, have_libcap=no)
2063 if test "x$have_libcap" = xyes; then
2064 AC_DEFINE(HAVE_LIBCAP, 1, [SELinux libcap support])
2066 AC_SUBST(have_libcap)
2068 AC_SUBST(have_selinux)
2070 dnl check for the size of 'long double'.
2071 AC_CHECK_SIZEOF(long double, 0)
2072 sizeof_long_double=$ac_cv_sizeof_long_double
2073 AC_SUBST(sizeof_long_double)
2076 dnl Check for silly hacked compilers predefining _FORTIFY_SOURCE.
2077 dnl Since we are building the implementations of the fortified functions here,
2078 dnl having the macro defined interacts very badly.
2079 AC_CACHE_CHECK([for _FORTIFY_SOURCE predefine], libc_cv_predef_fortify_source,
2080 [AC_TRY_COMPILE([], [
2081 #ifdef _FORTIFY_SOURCE
2084 [libc_cv_predef_fortify_source=no],
2085 [libc_cv_predef_fortify_source=yes])])
2086 if test $libc_cv_predef_fortify_source = yes; then
2087 CPPUNDEFS="${CPPUNDEFS:+$CPPUNDEFS }-U_FORTIFY_SOURCE"
2091 dnl Check for silly hacked compilers inserting -fstack-protector.
2092 dnl This breaks badly for the early startup code we compile, since
2093 dnl the compiled code can refer to a magic machine-dependent location
2094 dnl for the canary value before we have sufficient setup for that to
2095 dnl work. It's also questionable to build all of libc with this flag
2096 dnl even when you're doing that for most applications you build, since
2097 dnl libc's code is so heavily-used and performance-sensitive. If we
2098 dnl ever really want to make that work, it should be enabled explicitly
2099 dnl in the libc build, not inherited from implicit compiler settings.
2100 AC_CACHE_CHECK([whether $CC implicitly enables -fstack-protector],
2101 libc_cv_predef_stack_protector, [
2102 AC_TRY_COMPILE([extern void foobar (char *);],
2103 [char large_array[2048]; foobar (large_array);], [
2104 libc_undefs=`$NM -u conftest.o |
2105 LC_ALL=C $AWK '$1 == "U" { print $2 | "sort -u"; next } { exit(1) }' \
2106 2>&AS_MESSAGE_LOG_FD` || {
2107 AC_MSG_ERROR([confusing output from $NM -u])
2109 echo >&AS_MESSAGE_LOG_FD "libc_undefs='$libc_undefs'"
2110 # On some architectures, there are architecture-specific undefined
2111 # symbols (resolved by the linker), so filter out unknown symbols.
2112 # This will fail to produce the correct result if the compiler
2113 # defaults to -fstack-protector but this produces an undefined symbol
2114 # other than __stack_chk_fail. However, compilers like that have not
2115 # been encountered in practice.
2116 libc_undefs=`echo "$libc_undefs" | egrep '^(foobar|__stack_chk_fail)$'`
2117 case "$libc_undefs" in
2118 foobar) libc_cv_predef_stack_protector=no ;;
2120 foobar') libc_cv_predef_stack_protector=yes ;;
2121 *) AC_MSG_ERROR([unexpected symbols in test: $libc_undefs]) ;;
2123 [AC_MSG_ERROR([test compilation failed])])
2126 if test $libc_cv_predef_stack_protector = yes; then
2127 libc_extra_cflags=-fno-stack-protector
2129 AC_SUBST(libc_extra_cflags)
2131 ### End of automated tests.
2132 ### Now run sysdeps configure fragments.
2134 # They also can set these variables.
2136 ldd_rewrite_script=no
2137 libc_cv_sysconfdir=$sysconfdir
2138 libc_cv_localstatedir=$localstatedir
2139 libc_cv_gcc_unwind_find_fde=no
2142 # Iterate over all the sysdep directories we will use, running their
2143 # configure fragments.
2144 for dir in $sysnames; do
2147 *) dest=$srcdir/$dir ;;
2149 if test -r $dest/configure; then
2150 AC_MSG_RESULT(running configure fragment for $dir)
2155 if test x$libc_cv_gcc_unwind_find_fde = xyes; then
2156 AC_DEFINE(EXPORT_UNWIND_FIND_FDE)
2158 AC_SUBST(libc_cv_gcc_unwind_find_fde)
2160 # A sysdeps configure fragment can reset this if IFUNC is not actually
2161 # usable even though the assembler knows how to generate the symbol type.
2162 if test x"$libc_cv_ld_gnu_indirect_function" = xyes; then
2163 AC_DEFINE(HAVE_IFUNC)
2166 # This is far from the AC_ARG_ENABLE that sets it so that a sysdeps
2167 # configure fragment can override the value to prevent this AC_DEFINE.
2169 if test "x$use_nscd" != xno; then
2170 AC_DEFINE([USE_NSCD])
2172 if test "x$build_nscd" = xdefault; then
2173 build_nscd=$use_nscd
2176 # Test for old glibc 2.0.x headers so that they can be removed properly
2177 # Search only in includedir.
2178 AC_MSG_CHECKING(for old glibc 2.0.x headers)
2179 if eval test -f "${includedir}/elfclass.h" -a -f "${includedir}/fcntlbits.h"
2181 old_glibc_headers=yes
2183 old_glibc_headers=no
2185 AC_MSG_RESULT($old_glibc_headers)
2186 if test ${old_glibc_headers} = yes; then
2187 AC_MSG_WARN(*** During \"make install\" old headers from glibc 2.0.x will)
2188 AC_MSG_WARN(*** be removed.)
2190 AC_SUBST(old_glibc_headers)
2192 AC_SUBST(libc_cv_slibdir)
2193 AC_SUBST(libc_cv_rtlddir)
2194 AC_SUBST(libc_cv_localedir)
2195 AC_SUBST(libc_cv_sysconfdir)
2196 AC_SUBST(libc_cv_localstatedir)
2197 AC_SUBST(libc_cv_rootsbindir)
2198 AC_SUBST(libc_cv_forced_unwind)
2200 if test x$use_ldconfig = xyes; then
2201 AC_DEFINE(USE_LDCONFIG)
2203 AC_SUBST(use_ldconfig)
2204 AC_SUBST(ldd_rewrite_script)
2209 AC_CACHE_CHECK([whether -fPIC is default], libc_cv_pic_default,
2210 [libc_cv_pic_default=yes
2211 cat > conftest.c <<EOF
2212 #if defined __PIC__ || defined __pic__ || defined PIC || defined pic
2213 # error PIC is default.
2216 if eval "${CC-cc} -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
2217 libc_cv_pic_default=no
2220 AC_SUBST(libc_cv_pic_default)
2223 AC_SUBST(static_nss)
2227 dnl See sysdeps/mach/configure.in for this variable.
2228 AC_SUBST(mach_interface_list)
2230 VERSION=`sed -n -e 's/^#define VERSION "\([^"]*\)"/\1/p' < $srcdir/version.h`
2231 RELEASE=`sed -n -e 's/^#define RELEASE "\([^"]*\)"/\1/p' < $srcdir/version.h`
2235 AC_CONFIG_FILES([config.make Makefile])
2236 AC_CONFIG_COMMANDS([default],[[
2237 case $CONFIG_FILES in *config.make*)
2238 echo "$config_vars" >> config.make;;
2240 test -d bits || mkdir bits]],[[config_vars='$config_vars']])