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],
154 AC_ARG_ENABLE([hardcoded-path-in-tests],
155 AC_HELP_STRING([--enable-hardcoded-path-in-tests],
156 [hardcode newly built glibc path in tests @<:@default=no@:>@]),
157 [hardcoded_path_in_tests=$enableval],
158 [hardcoded_path_in_tests=no])
159 AC_SUBST(hardcoded_path_in_tests)
161 AC_ARG_ENABLE([stackguard-randomization],
162 AC_HELP_STRING([--enable-stackguard-randomization],
163 [initialize __stack_chk_guard canary with a random number at program start]),
164 [enable_stackguard_randomize=$enableval],
165 [enable_stackguard_randomize=no])
166 if test "$enable_stackguard_randomize" = yes; then
167 AC_DEFINE(ENABLE_STACKGUARD_RANDOMIZE)
170 AC_ARG_ENABLE([lock-elision],
171 AC_HELP_STRING([--enable-lock-elision[=yes/no]],
172 [Enable lock elision for pthread mutexes by default]),
173 [enable_lock_elision=$enableval],
174 [enable_lock_elision=no])
175 AC_SUBST(enable_lock_elision)
176 if test "$enable_lock_elision" = yes ; then
177 AC_DEFINE(ENABLE_LOCK_ELISION)
180 dnl Generic infrastructure for drop-in additions to libc.
181 AC_ARG_ENABLE([add-ons],
182 AC_HELP_STRING([--enable-add-ons@<:@=DIRS...@:>@],
183 [configure and build add-ons in DIR1,DIR2,...
184 search for add-ons if no parameter given]),
185 , [enable_add_ons=yes])
187 AC_ARG_ENABLE([hidden-plt],
188 AC_HELP_STRING([--disable-hidden-plt],
189 [do not hide internal function calls to avoid PLT]),
192 if test "x$hidden" = xno; then
196 AC_ARG_ENABLE([bind-now],
197 AC_HELP_STRING([--enable-bind-now],
198 [disable lazy relocations in DSOs]),
199 [bindnow=$enableval],
203 dnl On some platforms we cannot use dynamic loading. We must provide
204 dnl static NSS modules.
205 AC_ARG_ENABLE([static-nss],
206 AC_HELP_STRING([--enable-static-nss],
207 [build static NSS modules @<:@default=no@:>@]),
208 [static_nss=$enableval],
210 dnl Enable static NSS also if we build no shared objects.
211 if test x"$static_nss" = xyes || test x"$shared" = xno; then
213 AC_DEFINE(DO_STATIC_NSS)
216 AC_ARG_ENABLE([force-install],
217 AC_HELP_STRING([--disable-force-install],
218 [don't force installation of files from this package, even if they are older than the installed files]),
219 [force_install=$enableval],
221 AC_SUBST(force_install)
223 AC_ARG_ENABLE([maintainer-mode],
224 AC_HELP_STRING([--enable-maintainer-mode],
225 [enable make rules and dependencies not useful (and sometimes confusing) to the casual installer]),
226 [maintainer=$enableval],
229 dnl On some platforms we allow dropping compatibility with all kernel
231 AC_ARG_ENABLE([kernel],
232 AC_HELP_STRING([--enable-kernel=VERSION],
233 [compile for compatibility with kernel not older than VERSION]),
234 [minimum_kernel=$enableval],
236 dnl Prevent unreasonable values.
237 if test "$minimum_kernel" = yes || test "$minimum_kernel" = no; then
238 # Better nothing than this.
241 if test "$minimum_kernel" = current; then
242 minimum_kernel=`uname -r 2>/dev/null` || minimum_kernel=
246 dnl For the development we sometimes want gcc to issue even more warnings.
247 dnl This is not the default since many of the extra warnings are not
249 AC_ARG_ENABLE([all-warnings],
250 AC_HELP_STRING([--enable-all-warnings],
251 [enable all useful warnings gcc can issue]),
252 [all_warnings=$enableval],
254 AC_SUBST(all_warnings)
256 AC_ARG_ENABLE([multi-arch],
257 AC_HELP_STRING([--enable-multi-arch],
258 [enable single DSO with optimizations for multiple architectures]),
259 [multi_arch=$enableval],
260 [multi_arch=default])
262 AC_ARG_ENABLE([nss-crypt],
263 AC_HELP_STRING([--enable-nss-crypt],
264 [enable libcrypt to use nss]),
265 [nss_crypt=$enableval],
267 if test x$nss_crypt = xyes; then
268 nss_includes=-I$(nss-config --includedir 2>/dev/null)
269 if test $? -ne 0; then
270 AC_MSG_ERROR([cannot find include directory with nss-config])
273 CFLAGS="$CFLAGS $nss_includes"
274 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([typedef int PRBool;
276 #include <nsslowhash.h>
277 void f (void) { NSSLOW_Init (); }])],
278 libc_cv_nss_crypt=yes,
280 cannot find NSS headers with lowlevel hash function interfaces]))
282 LIBS="$LIBS -lfreebl3"
283 AC_LINK_IFELSE([AC_LANG_PROGRAM([typedef int PRBool;
285 #include <nsslowhash.h>],
287 libc_cv_nss_crypt=yes,
289 cannot link program using lowlevel NSS hash functions]))
295 AC_SUBST(libc_cv_nss_crypt)
298 AC_ARG_ENABLE([obsolete-rpc],
299 AC_HELP_STRING([--enable-obsolete-rpc],
300 [build and install the obsolete RPC code for link-time usage]),
301 [link_obsolete_rpc=$enableval],
302 [link_obsolete_rpc=no])
303 AC_SUBST(link_obsolete_rpc)
305 if test "$link_obsolete_rpc" = yes; then
306 AC_DEFINE(LINK_OBSOLETE_RPC)
309 AC_ARG_ENABLE([systemtap],
310 [AS_HELP_STRING([--enable-systemtap],
311 [enable systemtap static probe points @<:@default=no@:>@])],
312 [systemtap=$enableval],
314 if test "x$systemtap" != xno; then
315 AC_CACHE_CHECK([for systemtap static probe support], libc_cv_sdt, [dnl
317 CFLAGS="-std=gnu99 $CFLAGS"
318 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <sys/sdt.h>
319 void foo (int i, void *p)
321 asm ("" STAP_PROBE_ASM (foo, bar, STAP_PROBE_ASM_TEMPLATE (2)) ""
322 :: STAP_PROBE_ASM_OPERANDS (2, i, p));
323 }]])], [libc_cv_sdt=yes], [libc_cv_sdt=no])
324 CFLAGS="$old_CFLAGS"])
325 if test $libc_cv_sdt = yes; then
326 AC_DEFINE([USE_STAP_PROBE])
327 elif test "x$systemtap" != xauto; then
328 AC_MSG_FAILURE([systemtap support needs sys/sdt.h with asm support])
332 AC_ARG_ENABLE([build-nscd],
333 [AS_HELP_STRING([--disable-build-nscd],
334 [disable building and installing the nscd daemon])],
335 [build_nscd=$enableval],
336 [build_nscd=default])
339 # Note the use of $use_nscd is near the bottom of the file.
340 AC_ARG_ENABLE([nscd],
341 [AS_HELP_STRING([--disable-nscd],
342 [library functions will not contact the nscd daemon])],
343 [use_nscd=$enableval],
346 AC_ARG_ENABLE([pt_chown],
347 [AS_HELP_STRING([--enable-pt_chown],
348 [Enable building and installing pt_chown])],
349 [build_pt_chown=$enableval],
351 AC_SUBST(build_pt_chown)
352 if test "$build_pt_chown" = yes; then
353 AC_DEFINE(HAVE_PT_CHOWN)
356 # We keep the original values in `$config_*' and never modify them, so we
357 # can write them unchanged into config.make. Everything else uses
358 # $machine, $vendor, and $os, and changes them whenever convenient.
359 config_machine=$host_cpu config_vendor=$host_vendor config_os=$host_os
361 # Don't allow vendor == "unknown"
362 test "$config_vendor" = unknown && config_vendor=
363 config_os="`echo $config_os | sed 's/^unknown-//'`"
365 # Some configurations imply other options.
368 # The configure fragment of an add-on port can modify these to supplement
369 # or override the table in the case statement below. No fragment should
370 # ever change the config_* variables, however.
371 machine=$config_machine
372 vendor=$config_vendor
378 AS_HELP_STRING([--with-cpu=CPU], [select code for CPU variant]),
381 yes|'') AC_MSG_ERROR([--with-cpu requires an argument]) ;;
383 *) submachine="$withval" ;;
387 dnl Let sysdeps/*/preconfigure act here, like they can in add-ons.
388 LIBC_PRECONFIGURE([$srcdir], [for sysdeps])
390 # An add-on can set this when it wants to disable the sanity check below.
393 dnl Having this here, though empty, makes sure that if add-ons' fragments
394 dnl do AC_CONFIG_SUBDIRS([some-dir]), which just sets $subdirs, then
395 dnl our AC_OUTPUT will actually use it.
398 case "$enable_add_ons" in
401 add_ons=`cd $srcdir && ls -d 2> /dev/null */configure */sysdeps |
402 sed 's@/[[^/]]*$@@' | sort | uniq`
403 add_ons_automatic=yes
405 *) add_ons=`echo "$enable_add_ons" | sed 's/,/ /g'`
406 add_ons_automatic=no ;;
412 if test x"$add_ons" != x; then
413 for f in $add_ons; do
418 *** It seems that you're using an old \`crypt' add-on. crypt is now
419 *** part of glibc and using the old add-on will not work with this
420 *** release. Start again with fresh sources and without the old
421 *** \`crypt' add-on.])
425 *** It seems that you're using an old \`localedata' add-on. localedata
426 *** is now part of glibc and using the old add-on will not work with
427 *** this release. Start again with fresh sources and without the old
428 *** \`localedata' add-on.])
433 # Now source each add-on's configure fragment.
434 # The fragments can use $srcdir/$libc_add_on to find themselves,
435 # and test $add_ons_automatic to see if they were explicitly requested.
436 # A fragment can clear (or even change) $libc_add_on to affect
437 # whether it goes into the list to be actually used in the build.
439 for libc_add_on in $add_ons; do
440 # Test whether such a directory really exists.
441 # It can be absolute, or relative to $srcdir, or relative to the build dir.
442 case "$libc_add_on" in
444 libc_add_on_srcdir=$libc_add_on
447 test -d "$srcdir/$libc_add_on" || {
448 if test -d "$libc_add_on"; then
449 libc_add_on="`pwd`/$libc_add_on"
451 AC_MSG_ERROR(add-on directory \"$libc_add_on\" does not exist)
454 libc_add_on_srcdir=$srcdir/$libc_add_on
458 libc_add_on_frag=$libc_add_on_srcdir/configure
459 libc_add_on_canonical=
460 libc_add_on_config_subdirs=
461 if test -r "$libc_add_on_frag"; then
462 AC_MSG_NOTICE(running configure fragment for add-on $libc_add_on)
463 libc_add_on_canonical=unknown
465 . "$libc_add_on_frag"
466 test -z "$libc_add_on" || {
467 configured_add_ons="$configured_add_ons $libc_add_on"
468 if test "x$libc_add_on_canonical" = xunknown; then
469 AC_MSG_ERROR(fragment must set \$libc_add_on_canonical)
471 for d in $libc_add_on_subdirs; do
472 case "$libc_add_on" in
473 /*) subdir_srcdir="$libc_add_on" ;;
474 *) subdir_srcdir="\$(..)$libc_add_on" ;;
478 d="${libc_add_on_canonical:-$libc_add_on}"
484 subdir_srcdir="$subdir_srcdir/$d"
487 d=`echo "$d" | sed 's@/*$@@;s@^.*/@@'`
488 add_on_subdirs="$add_on_subdirs $d"
489 test "$subdir_srcdir" = "\$(..)$d" || config_vars="$config_vars
490 $d-srcdir = $subdir_srcdir"
492 for d in $libc_add_on_config_subdirs; do
495 fragment uses absolute path in \$libc_add_on_config_subdirs) ;;
497 if test ! -d "$libc_add_on_srcdir/$d"; then
498 AC_MSG_ERROR(fragment wants to configure missing directory $d)
500 case "$libc_add_on" in
502 relative path required for add-on using \$libc_add_on_config_subdirs) ;;
504 subdirs="$subdirs $libc_add_on/$d"
508 if test -n "$libc_add_on"; then
509 LIBC_PRECONFIGURE([$libc_add_on_srcdir], [add-on $libc_add_on for])
510 use_add_ons="$use_add_ons $libc_add_on"
511 add_ons_pfx="$add_ons_pfx $libc_add_on/"
512 test -z "$libc_add_on_canonical" ||
513 add_ons_sfx="$add_ons_sfx /$libc_add_on_canonical"
516 # Use echo to strip excess whitespace.
517 add_ons="`echo $use_add_ons`"
520 AC_SUBST(add_on_subdirs)
524 ### I put this here to prevent those annoying emails from people who cannot
525 ### read and try to compile glibc on unsupported platforms. --drepper
527 ### By using the undocumented --enable-hacker-mode option for configure
528 ### one can skip this test to make the configuration not fail for unsupported
531 if test -z "$enable_hacker_mode" && test x"$libc_config_ok" != xyes; then
532 case "$machine-$host_os" in
536 echo "*** The GNU C library is currently not available for this platform."
537 echo "*** So far nobody cared to port it and if there is no volunteer it"
538 echo "*** might never happen. So, if you have interest to see glibc on"
539 echo "*** this platform visit"
540 echo "*** http://www.gnu.org/software/libc/porting.html"
541 echo "*** and join the group of porters"
547 # Set base_machine if not set by a preconfigure fragment.
548 test -n "$base_machine" || base_machine=$machine
549 AC_SUBST(base_machine)
551 # For the multi-arch option we need support in the assembler & linker.
552 AC_CACHE_CHECK([for assembler and linker STT_GNU_IFUNC support],
553 libc_cv_ld_gnu_indirect_function, [dnl
554 cat > conftest.S <<EOF
555 .type foo,%gnu_indirect_function
568 libc_cv_ld_gnu_indirect_function=no
569 if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
570 -nostartfiles -nostdlib \
571 -o conftest conftest.S 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
572 # Do a link to see if the backend supports IFUNC relocs.
573 $READELF -r conftest 1>&AS_MESSAGE_LOG_FD
574 LC_ALL=C $READELF -r conftest | grep 'no relocations' >/dev/null || {
575 libc_cv_ld_gnu_indirect_function=yes
580 AC_MSG_CHECKING(whether .text pseudo-op must be used)
581 AC_CACHE_VAL(libc_cv_dot_text, [dnl
582 cat > conftest.s <<EOF
586 if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
587 libc_cv_dot_text=.text
590 if test -z "$libc_cv_dot_text"; then
596 if test x"$libc_cv_ld_gnu_indirect_function" != xyes; then
597 if test x"$multi_arch" = xyes; then
598 AC_MSG_ERROR([--enable-multi-arch support requires assembler and linker support])
604 if test x"$multi_arch" != xno; then
605 multi_arch_d=/multiarch
608 # Compute the list of sysdep directories for this configuration.
609 # This can take a while to compute.
610 sysdep_dir=$srcdir/sysdeps
611 AC_MSG_CHECKING(sysdep dirs)
612 dnl We need to use [ and ] for other purposes for a while now.
614 # Make sco3.2v4 become sco3.2.4 and sunos4.1.1_U1 become sunos4.1.1.U1.
615 os="`echo $os | sed 's/\([0-9A-Z]\)[v_]\([0-9A-Z]\)/\1.\2/g'`"
617 test "x$base_os" != x || case "$os" in
624 # For sunos4.1.1, try sunos4.1.1, then sunos4.1, then sunos4, then sunos.
627 while o=`echo $tail | sed 's/\.[^.]*$//'`; test $o != $tail; do
631 o=`echo $tail | sed 's/[0-9]*$//'`
632 if test $o != $tail; then
635 # For linux-gnu, try linux-gnu, then linux.
636 o=`echo $tail | sed 's/-.*$//'`
637 if test $o != $tail; then
641 # For unix/sysv/sysv4, try unix/sysv/sysv4, then unix/sysv, then unix.
644 while b=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$b"; do
650 # For sparc/sparc32, try sparc/sparc32 and then sparc.
652 tail=$machine${submachine:+/$submachine}
653 while m=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$m"; do
655 # Prepend the machine's FPU directory unless --without-fp.
656 if test "$with_fp" = yes; then
661 # For each machine term, try it with and then without /multiarch.
662 for try_fpu in $maybe_fpu ''; do
663 for try_multi in $multi_arch_d ''; do
664 mach="$mach /$1$try_fpu$try_multi"
670 dnl We are done with glob and regexp uses of [ and ]; return to autoconf.
673 # Find what sysdep directories exist.
676 for b in $base ''; do
677 for m0 in $mach ''; do
678 for v in /$vendor ''; do
679 test "$v" = / && continue
680 for o in /$ostry ''; do
681 test "$o" = / && continue
682 for m in $mach ''; do
683 for d in $add_ons_pfx ''; do
684 for a in $add_ons_sfx ''; do
685 try_suffix="$m0$b$v$o$m"
686 if test -n "$try_suffix"; then
687 try_srcdir="${srcdir}/"
691 try="${d}sysdeps$try_suffix$a"
692 test -n "$enable_debug_configure" &&
693 echo "$0 [DEBUG]: try $try" >&2
694 if test -d "$try_srcdir$try"; then
695 sysnames="$sysnames $try"
696 { test -n "$o" || test -n "$b"; } && os_used=t
697 { test -n "$m" || test -n "$m0"; } && machine_used=t
699 x*/$submachine) submachine_used=t ;;
701 if test -n "$d"; then
702 case "$sysnames_add_ons" in
704 *|'') sysnames_add_ons="$sysnames_add_ons $d" ;;
717 # If the assembler supports gnu_indirect_function symbol type and the
718 # architecture supports multi-arch, we enable multi-arch by default.
719 case $sysnames_add_ons$sysnames in
723 test x"$multi_arch" = xdefault && multi_arch=no
726 if test x"$multi_arch" != xno; then
727 AC_DEFINE(USE_MULTIARCH)
731 if test -z "$os_used" && test "$os" != none; then
732 AC_MSG_ERROR(Operating system $os is not supported.)
734 if test -z "$machine_used" && test "$machine" != none; then
735 AC_MSG_ERROR(The $machine is not supported.)
737 if test -z "$submachine_used" && test -n "$submachine"; then
738 AC_MSG_ERROR(The $submachine subspecies of $host_cpu is not supported.)
742 # We have now validated the configuration.
744 # Expand the list of system names into a full list of directories
745 # from each element's parent name and Implies file (if present).
748 while test $# -gt 0; do
752 case " $names " in *" $name "*)
753 # Already in the list.
757 # Report each name as we discover it, so there is no long pause in output.
758 echo $ECHO_N "$name $ECHO_C" >&AS_MESSAGE_FD
760 name_base=`echo $name | sed -e 's@\(.*sysdeps\)/.*@\1@'`
764 *) xsrcdir=$srcdir/ ;;
766 test -n "$enable_debug_configure" &&
767 echo "[DEBUG]: name/Implies $xsrcdir$name/Implies" >&2
769 for implies_file in Implies Implies-before Implies-after; do
770 implies_type=`echo $implies_file | sed s/-/_/`
771 eval ${implies_type}=
772 if test -f $xsrcdir$name/$implies_file; then
773 # Collect more names from the `Implies' file (removing comments).
774 implied_candidate="`sed 's/#.*$//' < $xsrcdir$name/$implies_file`"
775 for x in $implied_candidate; do
777 if test -d $xsrcdir$name_base/$x; then
778 eval "${implies_type}=\"\$${implies_type} \$name_base/\$x\""
781 for d in $add_ons_pfx ''; do
785 *) try_srcdir=$srcdir/ ;;
787 test -n "$enable_debug_configure" &&
788 echo "[DEBUG]: $name $implies_file $x try($d) {$try_srcdir}$try" >&2
789 if test $try != $xsrcdir$name_base/$x && test -d $try_srcdir$try;
791 eval "${implies_type}=\"\$${implies_type} \$try\""
793 case "$sysnames_add_ons" in
795 *|'') sysnames_add_ons="$sysnames_add_ons $d" ;;
799 if test $found = no; then
800 AC_MSG_WARN($name/$implies_file specifies nonexistent $x)
806 # Add NAME to the list of names.
809 # Find the parent of NAME, using the empty string if it has none.
811 parent="`echo $name | sed -n -e 's=/[^/]*$==' -e '/sysdeps$/q' -e p`"
814 test -n "$enable_debug_configure" &&
815 echo "[DEBUG]: $name Implies='$Implies' rest='$*' parent='$parent' \
816 Implies_before='$Implies_before' Implies_after='$Implies_after'" >&2
818 # Add the names implied by NAME, and NAME's parent (if it has one), to
819 # the list of names to be processed (the argument list). We prepend the
820 # implied names to the list and append the parent. We want implied
821 # directories to come before further directories inferred from the
822 # configuration components; this ensures that for sysv4, unix/common
823 # (implied by unix/sysv/sysv4) comes before unix/sysv (in ostry (here $*)
825 sysnames="`echo $Implies $* $Implies_before $parent $Implies_after`"
826 test -n "$sysnames" && set $sysnames
829 # Add the default directories.
830 default_sysnames="sysdeps/generic"
831 sysnames="$names $default_sysnames"
833 # The other names were emitted during the scan.
834 AC_MSG_RESULT($default_sysnames)
836 # Collect the list of add-ons that supply partial sysdeps trees.
838 for add_on in $add_ons; do
841 *) xsrcdir="$srcdir/" ;;
844 test -d "$xsrcdir$add_on/sysdeps" || {
845 case "$configured_add_ons " in
848 AC_MSG_ERROR(add-on $add_on has no configure fragment or sysdeps tree)
854 sysdeps_add_ons="$sysdeps_add_ons $add_on"
855 case "$sysnames_add_ons" in
858 AC_MSG_WARN(add-on $add_on contributed no sysdeps directories)
863 for d in $sysnames; do
865 $add_on/sysdeps/*) ;;
868 (cd "$xsrcdir$d" && for f in *[[!~]]; do
872 test -d "$ff" || { test -e "$ff" && exit 88; }
876 test -d "$f" || { test -e "$f" && exit 88; }
880 if test $? -eq 88; then
885 if test $found = no; then
886 AC_MSG_WARN(add-on $add_on contributed no useful sysdeps directories)
889 AC_SUBST(sysdeps_add_ons)
895 if test "$INSTALL" = "${srcdir}/scripts/install-sh -c"; then
896 # The makefiles need to use a different form to find it in $srcdir.
897 INSTALL='\$(..)./scripts/install-sh -c'
903 # Accept binutils 2.20 or newer.
904 AC_CHECK_PROG_VER(AS, $AS, --version,
905 [GNU assembler.* \([0-9]*\.[0-9.]*\)],
906 [2.1[0-9][0-9]*|2.[2-9][0-9]*|[3-9].*|[1-9][0-9]*], AS=: critic_missing="$critic_missing as")
907 AC_CHECK_PROG_VER(LD, $LD, --version,
908 [GNU ld.* \([0-9][0-9]*\.[0-9.]*\)],
909 [2.1[0-9][0-9]*|2.[2-9][0-9]*|[3-9].*|[1-9][0-9]*], LD=: critic_missing="$critic_missing ld")
911 # These programs are version sensitive.
913 AC_CHECK_PROG_VER(CC, ${ac_tool_prefix}gcc ${ac_tool_prefix}cc, -v,
914 [version \([egcygnustpi-]*[0-9.]*\)], [4.[4-9].* | 4.[1-9][0-9].* | [5-9].* ],
915 critic_missing="$critic_missing gcc")
916 AC_CHECK_PROG_VER(MAKE, gnumake gmake make, --version,
917 [GNU Make[^0-9]*\([0-9][0-9.]*\)],
918 [3.79* | 3.[89]* | [4-9].* | [1-9][0-9]*], critic_missing="$critic_missing make")
920 AC_CHECK_PROG_VER(MSGFMT, gnumsgfmt gmsgfmt msgfmt, --version,
921 [GNU gettext.* \([0-9]*\.[0-9.]*\)],
922 [0.10.3[6-9]* | 0.10.[4-9][0-9]* | 0.1[1-9]* | 0.[2-9][0-9]* | [1-9].*],
923 MSGFMT=: aux_missing="$aux_missing msgfmt")
924 AC_CHECK_PROG_VER(MAKEINFO, makeinfo, --version,
925 [GNU texinfo.* \([0-9][0-9.]*\)],
926 [4.[5-9]*|4.[1-9][0-9]*|[5-9].*],
927 MAKEINFO=: aux_missing="$aux_missing makeinfo")
928 AC_CHECK_PROG_VER(SED, sed, --version,
929 [GNU sed[^0-9]* \([0-9]*\.[0-9.]*\)],
930 [3.0[2-9]*|3.[1-9]*|[4-9]*],
931 SED=: aux_missing="$aux_missing sed")
932 AC_CHECK_PROG_VER(AWK, gawk, --version,
933 [GNU Awk[^0-9]*\([0-9][0-9.]*\)],
934 [3.1.[2-9]*|3.[2-9]*|[4-9]*], critic_missing="$critic_missing gawk")
936 AC_CHECK_TOOL(NM, nm, false)
938 if test "x$maintainer" = "xyes"; then
939 AC_CHECK_PROGS(AUTOCONF, autoconf, no)
941 xno|x|x:) AUTOCONF=no ;;
944 whether $AUTOCONF${ACFLAGS:+ }$ACFLAGS works, libc_cv_autoconf_works, [dnl
945 if (cd $srcdir; $AUTOCONF $ACFLAGS configure.ac > /dev/null 2>&1); then
946 libc_cv_autoconf_works=yes
948 libc_cv_autoconf_works=no
950 test $libc_cv_autoconf_works = yes || AUTOCONF=no
953 if test "x$AUTOCONF" = xno; then
954 aux_missing="$aux_missing autoconf"
960 test -n "$critic_missing" && AC_MSG_ERROR([
961 *** These critical programs are missing or too old:$critic_missing
962 *** Check the INSTALL file for required versions.])
964 test -n "$aux_missing" && AC_MSG_WARN([
965 *** These auxiliary programs are missing or incompatible versions:$aux_missing
966 *** some features will be disabled.
967 *** Check the INSTALL file for required versions.])
969 # if using special system headers, find out the compiler's sekrit
970 # header directory and add that to the list. NOTE: Only does the right
971 # thing on a system that doesn't need fixincludes. (Not presently a problem.)
972 if test -n "$sysheaders"; then
973 SYSINCLUDES=-nostdinc
974 for d in include include-fixed; do
975 i=`$CC -print-file-name="$d"` && test "x$i" != x && test "x$i" != "x$d" &&
976 SYSINCLUDES="$SYSINCLUDES -isystem $i"
978 SYSINCLUDES="$SYSINCLUDES \
979 -isystem `echo $sysheaders | sed 's/:/ -isystem /g'`"
980 if test -n "$CXX"; then
982 for cxxheaders in `$CXX -v -S -x c++ /dev/null -o /dev/null 2>&1 \
983 | sed -n -e '1,/#include/d' -e 's/^ \(\/.*\/[cg]++\)/\1/p'`; do
984 test "x$cxxheaders" != x &&
985 CXX_SYSINCLUDES="$CXX_SYSINCLUDES -isystem $cxxheaders"
989 AC_SUBST(SYSINCLUDES)
990 AC_SUBST(CXX_SYSINCLUDES)
992 # Test if LD_LIBRARY_PATH contains the notation for the current directory
993 # since this would lead to problems installing/building glibc.
994 # LD_LIBRARY_PATH contains the current directory if one of the following
996 # - one of the terminals (":" and ";") is the first or last sign
997 # - two terminals occur directly after each other
998 # - the path contains an element with a dot in it
999 AC_MSG_CHECKING(LD_LIBRARY_PATH variable)
1001 case ${LD_LIBRARY_PATH} in
1002 [:\;]* | *[:\;] | *[:\;][:\;]* | *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* )
1003 ld_library_path_setting="contains current directory"
1006 ld_library_path_setting="ok"
1010 AC_MSG_RESULT($ld_library_path_setting)
1011 if test "$ld_library_path_setting" != "ok"; then
1013 *** LD_LIBRARY_PATH shouldn't contain the current directory when
1014 *** building glibc. Please change the environment variable
1015 *** and run configure again.])
1018 AC_CACHE_CHECK(whether GCC supports -static-libgcc, libc_cv_gcc_static_libgcc, [dnl
1019 if $CC -v -static-libgcc 2>&1 | grep 'unrecognized option.*static-libgcc' >/dev/null; then
1020 libc_cv_gcc_static_libgcc=
1022 libc_cv_gcc_static_libgcc=-static-libgcc
1024 AC_SUBST(libc_cv_gcc_static_libgcc)
1026 AC_PATH_PROG(BASH_SHELL, bash, no)
1028 AC_PATH_PROG(PERL, perl, no)
1029 if test "$PERL" != no &&
1030 (eval `$PERL -V:apiversion`; test `expr "$apiversion" \< 5` -ne 0); then
1033 AC_PATH_PROG(INSTALL_INFO, install-info, no,
1034 $PATH:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin)
1035 AC_PATH_PROG(BISON, bison, no, $PATH:/usr/local/bin:/usr/bin:/bin)
1037 AC_CACHE_CHECK(for libc-friendly stddef.h, libc_cv_friendly_stddef, [dnl
1039 [#define __need_size_t
1040 #define __need_wchar_t
1043 #include <stddef.h>], [size_t size; wchar_t wchar;
1045 #error stddef.h ignored __need_*
1047 if (&size == NULL || &wchar == NULL) abort ();],
1048 libc_cv_friendly_stddef=yes,
1049 libc_cv_friendly_stddef=no)])
1050 if test $libc_cv_friendly_stddef = yes; then
1051 config_vars="$config_vars
1052 override stddef.h = # The installed <stddef.h> seems to be libc-friendly."
1055 AC_CACHE_CHECK(whether we need to use -P to assemble .S files,
1056 libc_cv_need_minus_P, [dnl
1057 cat > conftest.S <<EOF
1058 #include "confdefs.h"
1059 /* Nothing whatsoever. */
1061 if AC_TRY_COMMAND(${CC-cc} $CPPFLAGS $ASFLAGS -c conftest.S 1>&AS_MESSAGE_LOG_FD); then
1062 libc_cv_need_minus_P=no
1064 libc_cv_need_minus_P=yes
1067 if test $libc_cv_need_minus_P = yes; then
1068 config_vars="$config_vars
1069 asm-CPPFLAGS = -P # The assembler can't grok cpp's # line directives."
1072 AC_CACHE_CHECK(for .set assembler directive, libc_cv_asm_set_directive, [dnl
1073 cat > conftest.s <<EOF
1076 .set glibc_conftest_frobozz,foo
1077 .globl glibc_conftest_frobozz
1079 # The alpha-dec-osf1 assembler gives only a warning for `.set'
1080 # (but it doesn't work), so we must do a linking check to be sure.
1081 cat > conftest1.c <<\EOF
1082 extern int glibc_conftest_frobozz;
1083 void _start() { glibc_conftest_frobozz = 1; }
1085 if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
1086 -nostartfiles -nostdlib \
1087 -o conftest conftest.s conftest1.c 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
1088 libc_cv_asm_set_directive=yes
1090 libc_cv_asm_set_directive=no
1093 if test $libc_cv_asm_set_directive = yes; then
1094 AC_DEFINE(HAVE_ASM_SET_DIRECTIVE)
1097 AC_CACHE_CHECK(for assembler gnu_unique_object symbol type,
1098 libc_cv_asm_unique_object, [dnl
1099 cat > conftest.s <<EOF
1102 .type _sym, %gnu_unique_object
1104 if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
1105 libc_cv_asm_unique_object=yes
1107 libc_cv_asm_unique_object=no
1110 if test $libc_cv_asm_unique_object = yes; then
1111 AC_DEFINE(HAVE_ASM_UNIQUE_OBJECT)
1114 AC_CACHE_CHECK(for .previous assembler directive,
1115 libc_cv_asm_previous_directive, [dnl
1116 cat > conftest.s <<EOF
1117 .section foo_section
1120 if AC_TRY_COMMAND(${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
1121 libc_cv_asm_previous_directive=yes
1123 libc_cv_asm_previous_directive=no
1126 if test $libc_cv_asm_previous_directive = yes; then
1127 AC_DEFINE(HAVE_ASM_PREVIOUS_DIRECTIVE)
1129 AC_CACHE_CHECK(for .popsection assembler directive,
1130 libc_cv_asm_popsection_directive, [dnl
1131 cat > conftest.s <<EOF
1132 .pushsection foo_section
1135 if AC_TRY_COMMAND(${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
1136 libc_cv_asm_popsection_directive=yes
1138 libc_cv_asm_popsection_directive=no
1141 if test $libc_cv_asm_popsection_directive = yes; then
1142 AC_DEFINE(HAVE_ASM_POPSECTION_DIRECTIVE)
1145 AC_CACHE_CHECK(for .protected and .hidden assembler directive,
1146 libc_cv_asm_protected_directive, [dnl
1147 cat > conftest.s <<EOF
1153 if AC_TRY_COMMAND(${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
1154 libc_cv_asm_protected_directive=yes
1156 AC_MSG_ERROR(assembler support for symbol visibility is required)
1160 if test $libc_cv_asm_protected_directive = yes; then
1161 AC_CACHE_CHECK(whether __attribute__((visibility())) is supported,
1162 libc_cv_visibility_attribute,
1163 [cat > conftest.c <<EOF
1164 int foo __attribute__ ((visibility ("hidden"))) = 1;
1165 int bar __attribute__ ((visibility ("protected"))) = 1;
1167 libc_cv_visibility_attribute=no
1168 if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
1169 if grep '\.hidden.*foo' conftest.s >/dev/null; then
1170 if grep '\.protected.*bar' conftest.s >/dev/null; then
1171 libc_cv_visibility_attribute=yes
1175 rm -f conftest.{c,s}
1177 if test $libc_cv_visibility_attribute != yes; then
1178 AC_MSG_ERROR(compiler support for visibility attribute is required)
1182 if test $libc_cv_visibility_attribute = yes; then
1183 AC_CACHE_CHECK(for broken __attribute__((visibility())),
1184 libc_cv_broken_visibility_attribute,
1185 [cat > conftest.c <<EOF
1187 int bar (int x) __asm__ ("foo") __attribute__ ((visibility ("hidden")));
1188 int bar (int x) { return x; }
1190 libc_cv_broken_visibility_attribute=yes
1191 if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
1193 if grep '\.hidden[ _]foo' conftest.s >/dev/null; then
1195 libc_cv_broken_visibility_attribute=no
1198 rm -f conftest.c conftest.s
1200 if test $libc_cv_broken_visibility_attribute = yes; then
1201 AC_MSG_ERROR(working compiler support for visibility attribute is required)
1205 AC_CACHE_CHECK(for broken __attribute__((alias())),
1206 libc_cv_broken_alias_attribute,
1207 [cat > conftest.c <<EOF
1208 extern int foo (int x) __asm ("xyzzy");
1209 int bar (int x) { return x; }
1210 extern __typeof (bar) foo __attribute ((weak, alias ("bar")));
1212 extern __typeof (dfoo) dfoo __asm ("abccb");
1215 libc_cv_broken_alias_attribute=yes
1216 if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
1217 if grep 'xyzzy' conftest.s >/dev/null &&
1218 grep 'abccb' conftest.s >/dev/null; then
1219 libc_cv_broken_alias_attribute=no
1222 rm -f conftest.c conftest.s
1224 if test $libc_cv_broken_alias_attribute = yes; then
1225 AC_MSG_ERROR(working alias attribute support required)
1228 if test $libc_cv_visibility_attribute = yes; then
1229 AC_CACHE_CHECK(whether to put _rtld_local into .sdata section,
1230 libc_cv_have_sdata_section,
1231 [echo "int i;" > conftest.c
1232 libc_cv_have_sdata_section=no
1233 if ${CC-cc} $LDFLAGS -fPIC -shared -Wl,--verbose conftest.c -o conftest.so 2>&1 \
1234 | grep '\.sdata' >/dev/null; then
1235 libc_cv_have_sdata_section=yes
1237 rm -f conftest.c conftest.so
1239 if test $libc_cv_have_sdata_section = yes; then
1240 AC_DEFINE(HAVE_SDATA_SECTION)
1244 AC_CACHE_CHECK(for .preinit_array/.init_array/.fini_array support,
1245 libc_cv_initfini_array, [dnl
1246 LIBC_TRY_LINK_STATIC([
1247 int foo (void) { return 1; }
1248 int (*fp) (void) __attribute__ ((section (".init_array"))) = foo;
1250 [if $READELF -S conftest | fgrep INIT_ARRAY > /dev/null; then
1251 libc_cv_initfini_array=yes
1253 libc_cv_initfini_array=no
1255 [libc_cv_initfini_array=no])
1257 if test $libc_cv_initfini_array != yes; then
1258 AC_MSG_ERROR([Need linker with .init_array/.fini_array support.])
1261 AC_CACHE_CHECK(whether to use .ctors/.dtors header and trailer,
1262 libc_cv_ctors_header, [dnl
1263 libc_cv_ctors_header=yes
1264 LIBC_TRY_LINK_STATIC([
1265 __attribute__ ((constructor)) void ctor (void) { asm (""); }
1266 __attribute__ ((destructor)) void dtor (void) { asm (""); }
1269 AS_IF([$READELF -WS conftest$ac_exeext | $AWK '
1270 { gsub(/\@<:@ */, "@<:@") }
1271 $2 == ".ctors" || $2 == ".dtors" {
1272 size = strtonum("0x" $6)
1273 align = strtonum("0x" $NF)
1275 stub@<:@$2@:>@ = size == align * 2
1278 ctors_ok = !seen@<:@".ctors"@:>@ || stub@<:@".ctors"@:>@
1279 dtors_ok = !seen@<:@".dtors"@:>@ || stub@<:@".dtors"@:>@
1280 exit ((ctors_ok && dtors_ok) ? 0 : 1)
1282 '], [libc_cv_ctors_header=no])
1284 AC_MSG_ERROR([missing __attribute__ ((constructor)) support??])
1287 if test $libc_cv_ctors_header = no; then
1288 AC_DEFINE(NO_CTORS_DTORS_SECTIONS)
1291 AC_CACHE_CHECK(for libunwind-support in compiler,
1292 libc_cv_cc_with_libunwind, [
1293 cat > conftest.c <<EOF
1294 int main (void) { return 0; }
1296 if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -static -o conftest \
1297 conftest.c -v 2>&1 >/dev/null | grep ' -lunwind ' >/dev/null; then
1298 libc_cv_cc_with_libunwind=yes
1300 libc_cv_cc_with_libunwind=no
1303 AC_SUBST(libc_cv_cc_with_libunwind)
1304 if test $libc_cv_cc_with_libunwind = yes; then
1305 AC_DEFINE(HAVE_CC_WITH_LIBUNWIND)
1308 LIBC_LINKER_FEATURE([-z nodelete], [-Wl,--enable-new-dtags,-z,nodelete],
1309 [libc_cv_z_nodelete=yes],
1310 [AC_MSG_ERROR(linker with -z nodelete support required)])
1312 LIBC_LINKER_FEATURE([-z nodlopen], [-Wl,--enable-new-dtags,-z,nodlopen],
1313 [libc_cv_z_nodlopen=yes],
1314 [AC_MSG_ERROR(linker with -z nodlopen support required)])
1316 LIBC_LINKER_FEATURE([-z initfirst], [-Wl,--enable-new-dtags,-z,initfirst],
1317 [libc_cv_z_initfirst=yes],
1318 [AC_MSG_ERROR(linker with -z initfirst support required)])
1320 AC_CACHE_CHECK(for -Bgroup option,
1321 libc_cv_Bgroup, [dnl
1322 cat > conftest.c <<EOF
1323 int _start (void) { return 42; }
1325 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1326 -fPIC -shared -o conftest.so conftest.c
1327 -Wl,-Bgroup -nostdlib 1>&AS_MESSAGE_LOG_FD])
1334 AC_SUBST(libc_cv_Bgroup)
1337 AC_CACHE_CHECK(whether --noexecstack is desirable for .S files,
1338 libc_cv_as_noexecstack, [dnl
1339 cat > conftest.c <<EOF
1342 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS
1343 -S -o conftest.s conftest.c 1>&AS_MESSAGE_LOG_FD]) \
1344 && grep .note.GNU-stack conftest.s >/dev/null \
1345 && AC_TRY_COMMAND([${CC-cc} $ASFLAGS -Wa,--noexecstack
1346 -c -o conftest.o conftest.s 1>&AS_MESSAGE_LOG_FD])
1348 libc_cv_as_noexecstack=yes
1350 libc_cv_as_noexecstack=no
1353 if test $libc_cv_as_noexecstack = yes; then
1354 ASFLAGS_config="$ASFLAGS_config -Wa,--noexecstack"
1356 AC_SUBST(ASFLAGS_config)
1358 AC_CACHE_CHECK(for -z combreloc,
1359 libc_cv_z_combreloc, [dnl
1360 cat > conftest.c <<EOF
1361 extern int bar (int);
1363 int foo (void) { return bar (mumble); }
1365 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1366 -fPIC -shared -o conftest.so conftest.c
1367 -nostdlib -nostartfiles
1368 -Wl,-z,combreloc 1>&AS_MESSAGE_LOG_FD])
1370 dnl The following test is a bit weak. We must use a tool which can test
1371 dnl cross-platform since the gcc used can be a cross compiler. Without
1372 dnl introducing new options this is not easily doable. Instead use a tool
1373 dnl which always is cross-platform: readelf. To detect whether -z combreloc
1374 dnl look for a section named .rel.dyn.
1375 if $READELF -S conftest.so | grep '\.rel\(a\|\)\.dyn' > /dev/null; then
1376 libc_cv_z_combreloc=yes
1378 libc_cv_z_combreloc=no
1381 libc_cv_z_combreloc=no
1384 if test "$libc_cv_z_combreloc" = yes; then
1385 AC_DEFINE(HAVE_Z_COMBRELOC)
1387 AC_SUBST(libc_cv_z_combreloc)
1389 LIBC_LINKER_FEATURE([-z execstack], [-Wl,-z,execstack],
1390 [libc_cv_z_execstack=yes], [libc_cv_z_execstack=no])
1391 AC_SUBST(libc_cv_z_execstack)
1393 AC_CACHE_CHECK(for -fpie, libc_cv_fpie, [dnl
1394 LIBC_TRY_CC_OPTION([-fpie], [libc_cv_fpie=yes], [libc_cv_fpie=no])
1397 AC_SUBST(libc_cv_fpie)
1399 AC_CACHE_CHECK(for --hash-style option,
1400 libc_cv_hashstyle, [dnl
1401 cat > conftest.c <<EOF
1402 int _start (void) { return 42; }
1404 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1405 -fPIC -shared -o conftest.so conftest.c
1406 -Wl,--hash-style=both -nostdlib 1>&AS_MESSAGE_LOG_FD])
1408 libc_cv_hashstyle=yes
1410 libc_cv_hashstyle=no
1413 AC_SUBST(libc_cv_hashstyle)
1415 # The linker's default -shared behavior is good enough if it
1416 # does these things that our custom linker scripts ensure that
1417 # all allocated NOTE sections come first.
1418 if test "$use_default_link" = default; then
1419 AC_CACHE_CHECK([for sufficient default -shared layout],
1420 libc_cv_use_default_link, [dnl
1421 libc_cv_use_default_link=no
1422 cat > conftest.s <<\EOF
1423 .section .note.a,"a",%note
1428 .section .note.b,"a",%note
1434 if AC_TRY_COMMAND([dnl
1435 ${CC-cc} $ASFLAGS -shared -o conftest.so conftest.s 1>&AS_MESSAGE_LOG_FD]) &&
1436 ac_try=`$READELF -S conftest.so | sed -n \
1438 s/^ *\[ *[1-9][0-9]*\] *\([^ ][^ ]*\) *\([^ ][^ ]*\) .*$/\2 \1/
1444 libc_seen_a=no libc_seen_b=no
1446 while test $# -ge 2 -a "$1" = NOTE; do
1448 .note.a) libc_seen_a=yes ;;
1449 .note.b) libc_seen_b=yes ;;
1453 case "$libc_seen_a$libc_seen_b" in
1455 libc_cv_use_default_link=yes
1458 echo >&AS_MESSAGE_LOG_FD "\
1459 $libc_seen_a$libc_seen_b from:
1465 use_default_link=$libc_cv_use_default_link
1468 AC_CACHE_CHECK(linker output format, libc_cv_output_format, [dnl
1469 if libc_cv_output_format=`
1470 ${CC-cc} -nostartfiles -nostdlib -Wl,--print-output-format 2>&AS_MESSAGE_LOG_FD`
1474 libc_cv_output_format=
1476 test -n "$libc_cv_output_format" || libc_cv_output_format=unknown])
1477 AC_SUBST(libc_cv_output_format)
1479 AC_CACHE_CHECK(for -fno-toplevel-reorder -fno-section-anchors, libc_cv_fno_toplevel_reorder, [dnl
1480 cat > conftest.c <<EOF
1483 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -fno-toplevel-reorder -fno-section-anchors
1484 conftest.c 1>&AS_MESSAGE_LOG_FD])
1486 libc_cv_fno_toplevel_reorder=yes
1488 libc_cv_fno_toplevel_reorder=no
1491 if test $libc_cv_fno_toplevel_reorder = yes; then
1492 fno_unit_at_a_time="-fno-toplevel-reorder -fno-section-anchors"
1494 fno_unit_at_a_time=-fno-unit-at-a-time
1496 AC_SUBST(fno_unit_at_a_time)
1498 AC_CACHE_CHECK(for -fstack-protector, libc_cv_ssp, [dnl
1499 LIBC_TRY_CC_OPTION([$CFLAGS $CPPFLAGS -Werror -fstack-protector],
1503 AC_SUBST(libc_cv_ssp)
1505 AC_CACHE_CHECK(for -fgnu89-inline, libc_cv_gnu89_inline, [dnl
1506 cat > conftest.c <<EOF
1508 #ifdef __GNUC_GNU_INLINE__
1509 main () { return 0;}
1514 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -std=gnu99 -fgnu89-inline
1515 -o conftest.s conftest.c 1>&AS_MESSAGE_LOG_FD])
1517 libc_cv_gnu89_inline=yes
1519 libc_cv_gnu89_inline=no
1522 if test $libc_cv_gnu89_inline = yes; then
1523 gnu89_inline=-fgnu89-inline
1527 AC_SUBST(gnu89_inline)
1529 AC_CACHE_CHECK(whether cc puts quotes around section names,
1530 libc_cv_have_section_quotes,
1531 [cat > conftest.c <<EOF
1532 static const int foo
1533 __attribute__ ((section ("bar"))) = 1;
1535 if ${CC-cc} -S conftest.c -o conftest.s; then
1536 if grep '\.section.*"bar"' conftest.s >/dev/null; then
1537 libc_cv_have_section_quotes=yes
1539 libc_cv_have_section_quotes=no
1542 libc_cv_have_section_quotes=unknown
1544 rm -f conftest.{c,s}
1546 if test $libc_cv_have_section_quotes = yes; then
1547 AC_DEFINE(HAVE_SECTION_QUOTES)
1550 AC_CACHE_CHECK(for assembler .weak directive, libc_cv_asm_weak_directive,
1552 cat > conftest.s <<EOF
1557 .weak bar; bar = foo
1559 if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
1560 libc_cv_asm_weak_directive=yes
1562 libc_cv_asm_weak_directive=no
1566 if test $libc_cv_asm_weak_directive = no; then
1567 AC_CACHE_CHECK(for assembler .weakext directive,
1568 libc_cv_asm_weakext_directive,
1570 cat > conftest.s <<EOF
1579 if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
1580 libc_cv_asm_weakext_directive=yes
1582 libc_cv_asm_weakext_directive=no
1588 if test $libc_cv_asm_weak_directive = yes; then
1589 AC_DEFINE(HAVE_ASM_WEAK_DIRECTIVE)
1590 elif test $libc_cv_asm_weakext_directive = yes; then
1591 AC_DEFINE(HAVE_ASM_WEAKEXT_DIRECTIVE)
1594 AC_CACHE_CHECK(for ld --no-whole-archive, libc_cv_ld_no_whole_archive, [dnl
1595 cat > conftest.c <<\EOF
1600 dnl No \ in command here because it ends up inside ''.
1601 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1602 -nostdlib -nostartfiles -Wl,--no-whole-archive
1603 -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD]); then
1604 libc_cv_ld_no_whole_archive=yes
1606 libc_cv_ld_no_whole_archive=no
1609 if test $libc_cv_ld_no_whole_archive = no; then
1610 AC_MSG_ERROR([support for --no-whole-archive is needed])
1613 AC_CACHE_CHECK(for gcc -fexceptions, libc_cv_gcc_exceptions, [dnl
1614 cat > conftest.c <<\EOF
1619 dnl No \ in command here because it ends up inside ''.
1620 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1621 -nostdlib -nostartfiles -fexceptions
1622 -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD]); then
1623 libc_cv_gcc_exceptions=yes
1625 libc_cv_gcc_exceptions=no
1628 if test $libc_cv_gcc_exceptions = yes; then
1629 exceptions=-fexceptions
1631 AC_SUBST(exceptions)dnl
1633 AC_CACHE_CHECK(for __builtin_memset, libc_cv_gcc_builtin_memset, [dnl
1634 cat > conftest.c <<\EOF
1637 __builtin_memset (x, 0, 1000);
1641 if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | fgrep "memset" > /dev/null]);
1643 libc_cv_gcc_builtin_memset=no
1645 libc_cv_gcc_builtin_memset=yes
1648 if test "$libc_cv_gcc_builtin_memset" = yes ; then
1649 AC_DEFINE(HAVE_BUILTIN_MEMSET)
1652 AC_CACHE_CHECK(for redirection of built-in functions, libc_cv_gcc_builtin_redirection, [dnl
1653 cat > conftest.c <<\EOF
1654 extern char *strstr (const char *, const char *) __asm ("my_strstr");
1655 char *foo (const char *a, const char *b)
1657 return __builtin_strstr (a, b);
1661 if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | fgrep "my_strstr" > /dev/null]);
1663 libc_cv_gcc_builtin_redirection=yes
1665 libc_cv_gcc_builtin_redirection=no
1668 if test "$libc_cv_gcc_builtin_redirection" = no; then
1669 AC_MSG_ERROR([support for the symbol redirection needed])
1672 dnl Check whether the compiler supports the __thread keyword.
1673 AC_CACHE_CHECK([for __thread], libc_cv_gcc___thread,
1674 [cat > conftest.c <<\EOF
1675 __thread int a = 42;
1677 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c >&AS_MESSAGE_LOG_FD]); then
1678 libc_cv_gcc___thread=yes
1680 libc_cv_gcc___thread=no
1683 if test "$libc_cv_gcc___thread" = no; then
1684 AC_MSG_ERROR([support for the __thread keyword is required])
1687 dnl Check whether the compiler supports the tls_model attribute.
1688 AC_CACHE_CHECK([for tls_model attribute], libc_cv_gcc_tls_model_attr, [dnl
1689 cat > conftest.c <<\EOF
1690 extern __thread int a __attribute__((tls_model ("initial-exec")));
1692 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -Werror conftest.c >&AS_MESSAGE_LOG_FD]); then
1693 libc_cv_gcc_tls_model_attr=yes
1695 libc_cv_gcc_tls_model_attr=no
1698 if test "$libc_cv_gcc_tls_model_attr" = no; then
1699 AC_MSG_ERROR([support for the tls_model attribute is required])
1702 dnl Determine how to disable generation of FMA instructions.
1703 AC_CACHE_CHECK([for compiler option to disable generation of FMA instructions],
1704 libc_cv_cc_nofma, [dnl
1706 for opt in -ffp-contract=off -mno-fused-madd; do
1707 LIBC_TRY_CC_OPTION([$opt], [libc_cv_cc_nofma=$opt; break])
1709 AC_SUBST(libc_cv_cc_nofma)
1711 if test -n "$submachine"; then
1712 AC_CACHE_CHECK([for compiler option for CPU variant],
1713 libc_cv_cc_submachine, [dnl
1714 libc_cv_cc_submachine=no
1715 for opt in "-march=$submachine" "-mcpu=$submachine"; do
1716 LIBC_TRY_CC_OPTION([$opt], [
1717 libc_cv_cc_submachine="$opt"
1720 if test "x$libc_cv_cc_submachine" = xno; then
1721 AC_MSG_ERROR([${CC-cc} does not support $submachine])
1724 AC_SUBST(libc_cv_cc_submachine)
1726 AC_CACHE_CHECK(if $CC accepts -fno-tree-loop-distribute-patterns with \
1727 __attribute__ ((__optimize__)), libc_cv_cc_loop_to_function, [dnl
1728 cat > conftest.c <<EOF
1730 __attribute__ ((__optimize__ ("-fno-tree-loop-distribute-patterns")))
1733 libc_cv_cc_loop_to_function=no
1734 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c])
1736 libc_cv_cc_loop_to_function=yes
1739 if test $libc_cv_cc_loop_to_function = yes; then
1740 AC_DEFINE(HAVE_CC_INHIBIT_LOOP_TO_LIBCALL)
1742 AC_SUBST(libc_cv_cc_loop_to_function)
1744 dnl Check whether we have the gd library available.
1745 AC_MSG_CHECKING(for libgd)
1746 if test "$with_gd" != "no"; then
1747 old_CFLAGS="$CFLAGS"
1748 CFLAGS="$CFLAGS $libgd_include"
1749 old_LDFLAGS="$LDFLAGS"
1750 LDFLAGS="$LDFLAGS $libgd_ldflags"
1752 LIBS="$LIBS -lgd -lpng -lz -lm"
1753 AC_TRY_LINK([#include <gd.h>], [gdImagePng (0, 0)], LIBGD=yes, LIBGD=no)
1754 CFLAGS="$old_CFLAGS"
1755 LDFLAGS="$old_LDFLAGS"
1760 AC_MSG_RESULT($LIBGD)
1764 if test x$with_selinux = xno ; then
1767 # See if we have the SELinux library
1768 AC_CHECK_LIB(selinux, is_selinux_enabled,
1769 have_selinux=yes, have_selinux=no)
1770 if test x$with_selinux = xyes ; then
1771 if test x$have_selinux = xno ; then
1772 AC_MSG_ERROR([SELinux explicitly required, but SELinux library not found])
1776 # Check if we're building with SELinux support.
1777 if test "x$have_selinux" = xyes; then
1778 AC_DEFINE(HAVE_SELINUX, 1, [SELinux support])
1780 # See if we have the libaudit library
1781 AC_CHECK_LIB(audit, audit_log_user_avc_message,
1782 have_libaudit=yes, have_libaudit=no)
1783 if test "x$have_libaudit" = xyes; then
1784 AC_DEFINE(HAVE_LIBAUDIT, 1, [SELinux libaudit support])
1786 AC_SUBST(have_libaudit)
1788 # See if we have the libcap library
1789 AC_CHECK_LIB(cap, cap_init, have_libcap=yes, have_libcap=no)
1790 if test "x$have_libcap" = xyes; then
1791 AC_DEFINE(HAVE_LIBCAP, 1, [SELinux libcap support])
1793 AC_SUBST(have_libcap)
1795 AC_SUBST(have_selinux)
1797 dnl check for the size of 'long double'.
1798 AC_CHECK_SIZEOF(long double, 0)
1799 sizeof_long_double=$ac_cv_sizeof_long_double
1800 AC_SUBST(sizeof_long_double)
1803 dnl Check for silly hacked compilers predefining _FORTIFY_SOURCE.
1804 dnl Since we are building the implementations of the fortified functions here,
1805 dnl having the macro defined interacts very badly.
1806 AC_CACHE_CHECK([for _FORTIFY_SOURCE predefine], libc_cv_predef_fortify_source,
1807 [AC_TRY_COMPILE([], [
1808 #ifdef _FORTIFY_SOURCE
1811 [libc_cv_predef_fortify_source=no],
1812 [libc_cv_predef_fortify_source=yes])])
1813 if test $libc_cv_predef_fortify_source = yes; then
1814 CPPUNDEFS="${CPPUNDEFS:+$CPPUNDEFS }-U_FORTIFY_SOURCE"
1818 dnl Check for silly hacked compilers inserting -fstack-protector.
1819 dnl This breaks badly for the early startup code we compile, since
1820 dnl the compiled code can refer to a magic machine-dependent location
1821 dnl for the canary value before we have sufficient setup for that to
1822 dnl work. It's also questionable to build all of libc with this flag
1823 dnl even when you're doing that for most applications you build, since
1824 dnl libc's code is so heavily-used and performance-sensitive. If we
1825 dnl ever really want to make that work, it should be enabled explicitly
1826 dnl in the libc build, not inherited from implicit compiler settings.
1827 AC_CACHE_CHECK([whether $CC implicitly enables -fstack-protector],
1828 libc_cv_predef_stack_protector, [
1829 AC_TRY_COMPILE([extern void foobar (char *);],
1830 [char large_array[2048]; foobar (large_array);], [
1831 libc_undefs=`$NM -u conftest.o |
1832 LC_ALL=C $AWK '$1 == "U" { print $2 | "sort -u"; next } { exit(1) }' \
1833 2>&AS_MESSAGE_LOG_FD` || {
1834 AC_MSG_ERROR([confusing output from $NM -u])
1836 echo >&AS_MESSAGE_LOG_FD "libc_undefs='$libc_undefs'"
1837 # On some architectures, there are architecture-specific undefined
1838 # symbols (resolved by the linker), so filter out unknown symbols.
1839 # This will fail to produce the correct result if the compiler
1840 # defaults to -fstack-protector but this produces an undefined symbol
1841 # other than __stack_chk_fail. However, compilers like that have not
1842 # been encountered in practice.
1843 libc_undefs=`echo "$libc_undefs" | egrep '^(foobar|__stack_chk_fail)$'`
1844 case "$libc_undefs" in
1845 foobar) libc_cv_predef_stack_protector=no ;;
1847 foobar') libc_cv_predef_stack_protector=yes ;;
1848 *) AC_MSG_ERROR([unexpected symbols in test: $libc_undefs]) ;;
1850 [AC_MSG_ERROR([test compilation failed])])
1853 if test $libc_cv_predef_stack_protector = yes; then
1854 libc_extra_cflags="$libc_extra_cflags -fno-stack-protector"
1856 libc_extra_cppflags=
1858 # Some linkers on some architectures support __ehdr_start but with
1859 # bugs. Make sure usage of it does not create relocations in the
1860 # output (as the linker should resolve them all for us).
1861 AC_CACHE_CHECK([whether the linker provides working __ehdr_start],
1862 libc_cv_ehdr_start, [
1863 old_CFLAGS="$CFLAGS"
1864 old_LDFLAGS="$LDFLAGS"
1866 CFLAGS="$CFLAGS -fPIC"
1867 LDFLAGS="$LDFLAGS -nostdlib -nostartfiles -shared"
1869 AC_LINK_IFELSE([AC_LANG_SOURCE([
1874 extern const Ehdr __ehdr_start __attribute__ ((visibility ("hidden")));
1875 long ehdr (void) { return __ehdr_start.val; }
1877 [if $READELF -r conftest | fgrep __ehdr_start >/dev/null; then
1878 libc_cv_ehdr_start=broken
1880 libc_cv_ehdr_start=yes
1881 fi], [libc_cv_ehdr_start=no])
1882 CFLAGS="$old_CFLAGS"
1883 LDFLAGS="$old_LDFLAGS"
1886 if test "$libc_cv_ehdr_start" = yes; then
1887 AC_DEFINE([HAVE_EHDR_START])
1888 elif test "$libc_cv_ehdr_start" = broken; then
1889 AC_MSG_WARN([linker is broken -- you should upgrade])
1892 AC_CACHE_CHECK(for __builtin_trap with no external dependencies,
1893 libc_cv_builtin_trap, [dnl
1894 libc_cv_builtin_trap=no
1895 AC_TRY_COMPILE([], [__builtin_trap ()], [
1896 libc_undefs=`$NM -u conftest.o |
1897 LC_ALL=C $AWK '$1 == "U" { print $2 | "sort -u"; next } { exit(1) }' \
1898 2>&AS_MESSAGE_LOG_FD` || {
1899 AC_MSG_ERROR([confusing output from $NM -u])
1901 echo >&AS_MESSAGE_LOG_FD "libc_undefs='$libc_undefs'"
1902 if test -z "$libc_undefs"; then
1903 libc_cv_builtin_trap=yes
1905 if test $libc_cv_builtin_trap = yes; then
1906 AC_DEFINE([HAVE_BUILTIN_TRAP])
1909 ### End of automated tests.
1910 ### Now run sysdeps configure fragments.
1912 # They also can set these variables.
1914 ldd_rewrite_script=no
1915 libc_cv_sysconfdir=$sysconfdir
1916 libc_cv_localstatedir=$localstatedir
1917 libc_cv_gcc_unwind_find_fde=no
1920 # Iterate over all the sysdep directories we will use, running their
1921 # configure fragments.
1922 for dir in $sysnames; do
1925 *) dest=$srcdir/$dir ;;
1927 if test -r $dest/configure; then
1928 AC_MSG_RESULT(running configure fragment for $dir)
1933 AC_SUBST(libc_extra_cflags)
1934 AC_SUBST(libc_extra_cppflags)
1936 if test x$libc_cv_gcc_unwind_find_fde = xyes; then
1937 AC_DEFINE(EXPORT_UNWIND_FIND_FDE)
1939 AC_SUBST(libc_cv_gcc_unwind_find_fde)
1941 # A sysdeps configure fragment can reset this if IFUNC is not actually
1942 # usable even though the assembler knows how to generate the symbol type.
1943 if test x"$libc_cv_ld_gnu_indirect_function" = xyes; then
1944 AC_DEFINE(HAVE_IFUNC)
1947 # This is far from the AC_ARG_ENABLE that sets it so that a sysdeps
1948 # configure fragment can override the value to prevent this AC_DEFINE.
1950 if test "x$use_nscd" != xno; then
1951 AC_DEFINE([USE_NSCD])
1953 if test "x$build_nscd" = xdefault; then
1954 build_nscd=$use_nscd
1957 # Test for old glibc 2.0.x headers so that they can be removed properly
1958 # Search only in includedir.
1959 AC_MSG_CHECKING(for old glibc 2.0.x headers)
1960 if eval test -f "${includedir}/elfclass.h" -a -f "${includedir}/fcntlbits.h"
1962 old_glibc_headers=yes
1964 old_glibc_headers=no
1966 AC_MSG_RESULT($old_glibc_headers)
1967 if test ${old_glibc_headers} = yes; then
1968 AC_MSG_WARN(*** During \"make install\" old headers from glibc 2.0.x will)
1969 AC_MSG_WARN(*** be removed.)
1971 AC_SUBST(old_glibc_headers)
1973 AC_SUBST(libc_cv_slibdir)
1974 AC_SUBST(libc_cv_rtlddir)
1975 AC_SUBST(libc_cv_localedir)
1976 AC_SUBST(libc_cv_sysconfdir)
1977 AC_SUBST(libc_cv_localstatedir)
1978 AC_SUBST(libc_cv_rootsbindir)
1979 AC_SUBST(libc_cv_forced_unwind)
1981 if test x$use_ldconfig = xyes; then
1982 AC_DEFINE(USE_LDCONFIG)
1984 AC_SUBST(use_ldconfig)
1985 AC_SUBST(ldd_rewrite_script)
1990 AC_CACHE_CHECK([whether -fPIC is default], libc_cv_pic_default,
1991 [libc_cv_pic_default=yes
1992 cat > conftest.c <<EOF
1993 #if defined __PIC__ || defined __pic__ || defined PIC || defined pic
1994 # error PIC is default.
1997 if eval "${CC-cc} -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
1998 libc_cv_pic_default=no
2001 AC_SUBST(libc_cv_pic_default)
2004 AC_SUBST(static_nss)
2008 dnl See sysdeps/mach/configure.ac for this variable.
2009 AC_SUBST(mach_interface_list)
2011 VERSION=`sed -n -e 's/^#define VERSION "\([^"]*\)"/\1/p' < $srcdir/version.h`
2012 RELEASE=`sed -n -e 's/^#define RELEASE "\([^"]*\)"/\1/p' < $srcdir/version.h`
2016 AC_CONFIG_FILES([config.make Makefile])
2017 AC_CONFIG_COMMANDS([default],[[
2018 case $CONFIG_FILES in *config.make*)
2019 echo "$config_vars" >> config.make;;
2021 test -d bits || mkdir bits]],[[config_vars='$config_vars']])