Enable AVX2 optimized memset only if -mavx2 works
[glibc.git] / configure.ac
blob566ecb276d42e36a9dc8d42ca01e5edf847c6378
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
29   CPP=
31 if test -z "$CPP"; then
32   CPP="$CC -E"
34 AC_SUBST(CPP)dnl
35 ])# AC_PROG_CPP
37 # We require GCC.  Override _AC_PROG_CC_C89 here to work around the Autoconf
38 # issue discussed in
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.
43 AC_CONFIG_SUBDIRS()
45 AC_CANONICAL_HOST
47 AC_PROG_CC
48 if test $host != $build; then
49   AC_CHECK_PROGS(BUILD_CC, gcc cc)
51 AC_SUBST(cross_compiling)
52 AC_PROG_CPP
53 # We need the C++ compiler only for testing.
54 AC_PROG_CXX
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.
62 config_vars=
64 # Check for a --with-gd argument and set libgd-LDFLAGS in config.make.
65 AC_ARG_WITH([gd],
66             AC_HELP_STRING([--with-gd=DIR],
67                            [find libgd include dir and library with prefix DIR]),
68             [dnl
69 case "$with_gd" in
70 yes|''|no) ;;
71 *) libgd_include="-I$withval/include"
72    libgd_ldflags="-L$withval/lib" ;;
73 esac
75 AC_ARG_WITH([gd-include],
76             AC_HELP_STRING([--with-gd-include=DIR],
77                            [find libgd include files in DIR]),
78             [dnl
79 case "$with_gd_include" in
80 ''|no) ;;
81 *) libgd_include="-I$withval" ;;
82 esac
84 AC_ARG_WITH([gd-lib],
85             AC_HELP_STRING([--with-gd-lib=DIR],
86                            [find libgd library files in DIR]),
87             [dnl
88 case "$with_gd_lib" in
89 ''|no) ;;
90 *) libgd_ldflags="-L$withval" ;;
91 esac
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.
104 AC_ARG_WITH([fp],
105             AC_HELP_STRING([--with-fp],
106                            [if using floating-point hardware @<:@default=yes@:>@]),
107             [with_fp=$withval],
108             [with_fp=yes])
109 AC_SUBST(with_fp)
110 AC_ARG_WITH([binutils],
111             AC_HELP_STRING([--with-binutils=PATH],
112                            [specify location of binutils (as and ld)]),
113             [path_binutils=$withval],
114             [path_binutils=''])
115 AC_ARG_WITH([selinux],
116             AC_HELP_STRING([--with-selinux],
117                            [if building with SELinux support]),
118             [with_selinux=$withval],
119             [with_selinux=auto])
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],
127             [sysheaders=''])
128 AC_SUBST(sysheaders)
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],
141               [enable_sanity=yes])
143 AC_ARG_ENABLE([shared],
144               AC_HELP_STRING([--enable-shared],
145                              [build shared library @<:@default=yes if GNU ld@:>@]),
146               [shared=$enableval],
147               [shared=yes])
148 AC_ARG_ENABLE([profile],
149               AC_HELP_STRING([--enable-profile],
150                              [build profiled library @<:@default=no@:>@]),
151               [profile=$enableval],
152               [profile=no])
154 AC_ARG_ENABLE([oldest-abi],
155               AC_HELP_STRING([--enable-oldest-abi=ABI],
156                              [configure the oldest ABI supported @<:@e.g. 2.2@:>@ @<:@default=glibc default@:>@]),
157               [oldest_abi=$enableval],
158               [oldest_abi=no])
159 if test "$oldest_abi" = yes || test "$oldest_abi" = no; then
160   oldest_abi=default
161 else
162   AC_DEFINE_UNQUOTED(GLIBC_OLDEST_ABI, "$oldest_abi")
164 AC_SUBST(oldest_abi)
166 AC_ARG_ENABLE([hardcoded-path-in-tests],
167               AC_HELP_STRING([--enable-hardcoded-path-in-tests],
168                              [hardcode newly built glibc path in tests @<:@default=no@:>@]),
169               [hardcoded_path_in_tests=$enableval],
170               [hardcoded_path_in_tests=no])
171 AC_SUBST(hardcoded_path_in_tests)
173 AC_ARG_ENABLE([stackguard-randomization],
174               AC_HELP_STRING([--enable-stackguard-randomization],
175                              [initialize __stack_chk_guard canary with a random number at program start]),
176               [enable_stackguard_randomize=$enableval],
177               [enable_stackguard_randomize=no])
178 if test "$enable_stackguard_randomize" = yes; then
179   AC_DEFINE(ENABLE_STACKGUARD_RANDOMIZE)
182 AC_ARG_ENABLE([lock-elision],
183               AC_HELP_STRING([--enable-lock-elision[=yes/no]],
184                              [Enable lock elision for pthread mutexes by default]),
185               [enable_lock_elision=$enableval],
186               [enable_lock_elision=no])
187 AC_SUBST(enable_lock_elision)
188 if test "$enable_lock_elision" = yes ; then
189   AC_DEFINE(ENABLE_LOCK_ELISION)
192 dnl Generic infrastructure for drop-in additions to libc.
193 AC_ARG_ENABLE([add-ons],
194               AC_HELP_STRING([--enable-add-ons@<:@=DIRS...@:>@],
195                              [configure and build add-ons in DIR1,DIR2,...
196                               search for add-ons if no parameter given]),
197                              , [enable_add_ons=yes])
199 AC_ARG_ENABLE([hidden-plt],
200               AC_HELP_STRING([--disable-hidden-plt],
201                              [do not hide internal function calls to avoid PLT]),
202               [hidden=$enableval],
203               [hidden=yes])
204 if test "x$hidden" = xno; then
205   AC_DEFINE(NO_HIDDEN)
208 AC_ARG_ENABLE([bind-now],
209               AC_HELP_STRING([--enable-bind-now],
210                              [disable lazy relocations in DSOs]),
211               [bindnow=$enableval],
212               [bindnow=no])
213 AC_SUBST(bindnow)
215 dnl On some platforms we cannot use dynamic loading.  We must provide
216 dnl static NSS modules.
217 AC_ARG_ENABLE([static-nss],
218               AC_HELP_STRING([--enable-static-nss],
219                              [build static NSS modules @<:@default=no@:>@]),
220               [static_nss=$enableval],
221               [static_nss=no])
222 dnl Enable static NSS also if we build no shared objects.
223 if test x"$static_nss" = xyes || test x"$shared" = xno; then
224   static_nss=yes
225   AC_DEFINE(DO_STATIC_NSS)
228 AC_ARG_ENABLE([force-install],
229               AC_HELP_STRING([--disable-force-install],
230                              [don't force installation of files from this package, even if they are older than the installed files]),
231               [force_install=$enableval],
232               [force_install=yes])
233 AC_SUBST(force_install)
235 AC_ARG_ENABLE([maintainer-mode],
236               AC_HELP_STRING([--enable-maintainer-mode],
237                              [enable make rules and dependencies not useful (and sometimes confusing) to the casual installer]),
238               [maintainer=$enableval],
239               [maintainer=no])
241 dnl On some platforms we allow dropping compatibility with all kernel
242 dnl versions.
243 AC_ARG_ENABLE([kernel],
244               AC_HELP_STRING([--enable-kernel=VERSION],
245                              [compile for compatibility with kernel not older than VERSION]),
246               [minimum_kernel=$enableval],
247               [])
248 dnl Prevent unreasonable values.
249 if test "$minimum_kernel" = yes || test "$minimum_kernel" = no; then
250   # Better nothing than this.
251   minimum_kernel=""
252 else
253   if test "$minimum_kernel" = current; then
254     minimum_kernel=`uname -r 2>/dev/null` || minimum_kernel=
255   fi
258 dnl For the development we sometimes want gcc to issue even more warnings.
259 dnl This is not the default since many of the extra warnings are not
260 dnl appropriate.
261 AC_ARG_ENABLE([all-warnings],
262               AC_HELP_STRING([--enable-all-warnings],
263                              [enable all useful warnings gcc can issue]),
264               [all_warnings=$enableval],
265               [])
266 AC_SUBST(all_warnings)
268 AC_ARG_ENABLE([multi-arch],
269               AC_HELP_STRING([--enable-multi-arch],
270                              [enable single DSO with optimizations for multiple architectures]),
271               [multi_arch=$enableval],
272               [multi_arch=default])
274 AC_ARG_ENABLE([nss-crypt],
275               AC_HELP_STRING([--enable-nss-crypt],
276                              [enable libcrypt to use nss]),
277               [nss_crypt=$enableval],
278               [nss_crypt=no])
279 if test x$nss_crypt = xyes; then
280   nss_includes=-I$(nss-config --includedir 2>/dev/null)
281   if test $? -ne 0; then
282     AC_MSG_ERROR([cannot find include directory with nss-config])
283   fi
284   old_CFLAGS="$CFLAGS"
285   CFLAGS="$CFLAGS $nss_includes"
286   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([typedef int PRBool;
287 #include <hasht.h>
288 #include <nsslowhash.h>
289 void f (void) { NSSLOW_Init (); }])],
290              libc_cv_nss_crypt=yes,
291              AC_MSG_ERROR([
292 cannot find NSS headers with lowlevel hash function interfaces]))
293   old_LIBS="$LIBS"
294   LIBS="$LIBS -lfreebl3"
295   AC_LINK_IFELSE([AC_LANG_PROGRAM([typedef int PRBool;
296 #include <hasht.h>
297 #include <nsslowhash.h>],
298                                   [NSSLOW_Init();])],
299                  libc_cv_nss_crypt=yes,
300                  AC_MSG_ERROR([
301 cannot link program using lowlevel NSS hash functions]))
302   CFLAGS="$old_CFLAGS"
303   LIBS="$old_LIBS"
304 else
305   libc_cv_nss_crypt=no
307 AC_SUBST(libc_cv_nss_crypt)
310 AC_ARG_ENABLE([obsolete-rpc],
311               AC_HELP_STRING([--enable-obsolete-rpc],
312                              [build and install the obsolete RPC code for link-time usage]),
313               [link_obsolete_rpc=$enableval],
314               [link_obsolete_rpc=no])
315 AC_SUBST(link_obsolete_rpc)
317 if test "$link_obsolete_rpc" = yes; then
318   AC_DEFINE(LINK_OBSOLETE_RPC)
321 AC_ARG_ENABLE([systemtap],
322               [AS_HELP_STRING([--enable-systemtap],
323                [enable systemtap static probe points @<:@default=no@:>@])],
324               [systemtap=$enableval],
325               [systemtap=no])
326 if test "x$systemtap" != xno; then
327   AC_CACHE_CHECK([for systemtap static probe support], libc_cv_sdt, [dnl
328   old_CFLAGS="$CFLAGS"
329   CFLAGS="-std=gnu99 $CFLAGS"
330   AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <sys/sdt.h>
331 void foo (int i, void *p)
333   asm ("" STAP_PROBE_ASM (foo, bar, STAP_PROBE_ASM_TEMPLATE (2)) ""
334        :: STAP_PROBE_ASM_OPERANDS (2, i, p));
335 }]])], [libc_cv_sdt=yes], [libc_cv_sdt=no])
336   CFLAGS="$old_CFLAGS"])
337   if test $libc_cv_sdt = yes; then
338     AC_DEFINE([USE_STAP_PROBE])
339   elif test "x$systemtap" != xauto; then
340     AC_MSG_FAILURE([systemtap support needs sys/sdt.h with asm support])
341   fi
344 AC_ARG_ENABLE([build-nscd],
345               [AS_HELP_STRING([--disable-build-nscd],
346                [disable building and installing the nscd daemon])],
347               [build_nscd=$enableval],
348               [build_nscd=default])
349 AC_SUBST(build_nscd)
351 # Note the use of $use_nscd is near the bottom of the file.
352 AC_ARG_ENABLE([nscd],
353               [AS_HELP_STRING([--disable-nscd],
354                [library functions will not contact the nscd daemon])],
355               [use_nscd=$enableval],
356               [use_nscd=yes])
358 AC_ARG_ENABLE([pt_chown],
359               [AS_HELP_STRING([--enable-pt_chown],
360                [Enable building and installing pt_chown])],
361               [build_pt_chown=$enableval],
362               [build_pt_chown=no])
363 AC_SUBST(build_pt_chown)
364 if test "$build_pt_chown" = yes; then
365   AC_DEFINE(HAVE_PT_CHOWN)
368 # The way shlib-versions is used to generate soversions.mk uses a
369 # fairly simplistic model for name recognition that can't distinguish
370 # i486-pc-linux-gnu fully from i486-pc-gnu.  So we mutate a $host_os
371 # of `gnu*' here to be `gnu-gnu*' just so that shlib-versions can
372 # tell.  This doesn't get used much beyond that, so it's fairly safe.
373 case "$host_os" in
374 linux*)
375   ;;
376 gnu*)
377   host_os=`echo $host_os | sed -e 's/gnu/gnu-gnu/'`
378   ;;
379 esac
381 # We keep the original values in `$config_*' and never modify them, so we
382 # can write them unchanged into config.make.  Everything else uses
383 # $machine, $vendor, and $os, and changes them whenever convenient.
384 config_machine=$host_cpu config_vendor=$host_vendor config_os=$host_os
386 # Don't allow vendor == "unknown"
387 test "$config_vendor" = unknown && config_vendor=
388 config_os="`echo $config_os | sed 's/^unknown-//'`"
390 # Some configurations imply other options.
391 elf=yes
393 # The configure fragment of an add-on port can modify these to supplement
394 # or override the table in the case statement below.  No fragment should
395 # ever change the config_* variables, however.
396 machine=$config_machine
397 vendor=$config_vendor
398 os=$config_os
399 base_os=''
401 submachine=
402 AC_ARG_WITH([cpu],
403             AS_HELP_STRING([--with-cpu=CPU], [select code for CPU variant]),
404             [dnl
405   case "$withval" in
406   yes|'') AC_MSG_ERROR([--with-cpu requires an argument]) ;;
407   no) ;;
408   *) submachine="$withval" ;;
409   esac
412 dnl Let sysdeps/*/preconfigure act here, like they can in add-ons.
413 LIBC_PRECONFIGURE([$srcdir], [for sysdeps])
415 # An add-on can set this when it wants to disable the sanity check below.
416 libc_config_ok=no
418 dnl Having this here, though empty, makes sure that if add-ons' fragments
419 dnl do AC_CONFIG_SUBDIRS([some-dir]), which just sets $subdirs, then
420 dnl our AC_OUTPUT will actually use it.
421 AC_CONFIG_SUBDIRS()
423 case "$enable_add_ons" in
424 ''|no) add_ons= ;;
425 yes|'*')
426  add_ons=`cd $srcdir && ls -d 2> /dev/null */configure */sysdeps |
427           sed 's@/[[^/]]*$@@' | sort | uniq`
428          add_ons_automatic=yes
429          ;;
430 *) add_ons=`echo "$enable_add_ons" | sed 's/,/ /g'`
431        add_ons_automatic=no ;;
432 esac
434 configured_add_ons=
435 add_ons_sfx=
436 add_ons_pfx=
437 if test x"$add_ons" != x; then
438   for f in $add_ons; do
439     # Some sanity checks
440     case "$f" in
441     crypt)
442       AC_MSG_ERROR([
443 *** It seems that you're using an old \`crypt' add-on.  crypt is now
444 *** part of glibc and using the old add-on will not work with this
445 *** release.  Start again with fresh sources and without the old
446 *** \`crypt' add-on.])
447     ;;
448     localedata)
449       AC_MSG_ERROR([
450 *** It seems that you're using an old \`localedata' add-on.  localedata
451 *** is now part of glibc and using the old add-on will not work with
452 *** this release.  Start again with fresh sources and without the old
453 *** \`localedata' add-on.])
454     ;;
455     esac
456   done
458   # Now source each add-on's configure fragment.
459   # The fragments can use $srcdir/$libc_add_on to find themselves,
460   # and test $add_ons_automatic to see if they were explicitly requested.
461   # A fragment can clear (or even change) $libc_add_on to affect
462   # whether it goes into the list to be actually used in the build.
463   use_add_ons=
464   for libc_add_on in $add_ons; do
465     # Test whether such a directory really exists.
466     # It can be absolute, or relative to $srcdir, or relative to the build dir.
467     case "$libc_add_on" in
468     /*)
469       libc_add_on_srcdir=$libc_add_on
470       ;;
471     *)
472       test -d "$srcdir/$libc_add_on" || {
473         if test -d "$libc_add_on"; then
474           libc_add_on="`pwd`/$libc_add_on"
475         else
476           AC_MSG_ERROR(add-on directory \"$libc_add_on\" does not exist)
477         fi
478       }
479       libc_add_on_srcdir=$srcdir/$libc_add_on
480       ;;
481     esac
483     libc_add_on_frag=$libc_add_on_srcdir/configure
484     libc_add_on_canonical=
485     libc_add_on_config_subdirs=
486     if test -r "$libc_add_on_frag"; then
487       AC_MSG_NOTICE(running configure fragment for add-on $libc_add_on)
488       libc_add_on_canonical=unknown
489       libc_add_on_subdirs=
490       . "$libc_add_on_frag"
491       test -z "$libc_add_on" || {
492         configured_add_ons="$configured_add_ons $libc_add_on"
493         if test "x$libc_add_on_canonical" = xunknown; then
494           AC_MSG_ERROR(fragment must set \$libc_add_on_canonical)
495         fi
496         for d in $libc_add_on_subdirs; do
497           case "$libc_add_on" in
498           /*) subdir_srcdir="$libc_add_on" ;;
499           *) subdir_srcdir="\$(..)$libc_add_on" ;;
500           esac
501           case "$d" in
502           .)
503             d="${libc_add_on_canonical:-$libc_add_on}"
504             ;;
505           /*)
506             subdir_srcdir="$d"
507             ;;
508           *)
509             subdir_srcdir="$subdir_srcdir/$d"
510             ;;
511           esac
512           d=`echo "$d" | sed 's@/*$@@;s@^.*/@@'`
513           add_on_subdirs="$add_on_subdirs $d"
514           test "$subdir_srcdir" = "\$(..)$d" || config_vars="$config_vars
515 $d-srcdir = $subdir_srcdir"
516         done
517         for d in $libc_add_on_config_subdirs; do
518           case "$d" in
519           /*) AC_MSG_ERROR(dnl
520 fragment uses absolute path in \$libc_add_on_config_subdirs) ;;
521           esac
522           if test ! -d "$libc_add_on_srcdir/$d"; then
523             AC_MSG_ERROR(fragment wants to configure missing directory $d)
524           fi
525           case "$libc_add_on" in
526           /*) AC_MSG_ERROR(dnl
527 relative path required for add-on using \$libc_add_on_config_subdirs) ;;
528           esac
529           subdirs="$subdirs $libc_add_on/$d"
530         done
531       }
532     fi
533     if test -n "$libc_add_on"; then
534       LIBC_PRECONFIGURE([$libc_add_on_srcdir], [add-on $libc_add_on for])
535       use_add_ons="$use_add_ons $libc_add_on"
536       add_ons_pfx="$add_ons_pfx $libc_add_on/"
537       test -z "$libc_add_on_canonical" ||
538       add_ons_sfx="$add_ons_sfx /$libc_add_on_canonical"
539     fi
540   done
541   # Use echo to strip excess whitespace.
542   add_ons="`echo $use_add_ons`"
544 AC_SUBST(add_ons)
545 AC_SUBST(add_on_subdirs)
549 ### I put this here to prevent those annoying emails from people who cannot
550 ### read and try to compile glibc on unsupported platforms.  --drepper
552 ### By using the undocumented --enable-hacker-mode option for configure
553 ### one can skip this test to make the configuration not fail for unsupported
554 ### platforms.
556 if test -z "$enable_hacker_mode" && test x"$libc_config_ok" != xyes; then
557   case "$machine-$host_os" in
558   *-linux* | *-gnu*)
559     ;;
560   *)
561     echo "*** The GNU C library is currently not available for this platform."
562     echo "*** So far nobody cared to port it and if there is no volunteer it"
563     echo "*** might never happen.  So, if you have interest to see glibc on"
564     echo "*** this platform visit"
565     echo "***   http://www.gnu.org/software/libc/porting.html"
566     echo "*** and join the group of porters"
567     exit 1
568     ;;
569   esac
572 # Set base_machine if not set by a preconfigure fragment.
573 test -n "$base_machine" || base_machine=$machine
574 AC_SUBST(base_machine)
576 # For the multi-arch option we need support in the assembler & linker.
577 AC_CACHE_CHECK([for assembler and linker STT_GNU_IFUNC support],
578                libc_cv_ld_gnu_indirect_function, [dnl
579 cat > conftest.S <<EOF
580 .type foo,%gnu_indirect_function
581 foo:
582 .globl _start
583 _start:
584 .globl __start
585 __start:
586 .data
587 #ifdef _LP64
588 .quad foo
589 #else
590 .long foo
591 #endif
593 libc_cv_ld_gnu_indirect_function=no
594 if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
595             -nostartfiles -nostdlib \
596             -o conftest conftest.S 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
597   # Do a link to see if the backend supports IFUNC relocs.
598   $READELF -r conftest 1>&AS_MESSAGE_LOG_FD
599   LC_ALL=C $READELF -r conftest | grep 'no relocations' >/dev/null || {
600     libc_cv_ld_gnu_indirect_function=yes
601   }
603 rm -f conftest*])
605 AC_MSG_CHECKING(whether .text pseudo-op must be used)
606 AC_CACHE_VAL(libc_cv_dot_text, [dnl
607 cat > conftest.s <<EOF
608 .text
610 libc_cv_dot_text=
611 if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
612   libc_cv_dot_text=.text
614 rm -f conftest*])
615 if test -z "$libc_cv_dot_text"; then
616   AC_MSG_RESULT(no)
617 else
618   AC_MSG_RESULT(yes)
621 if test x"$libc_cv_ld_gnu_indirect_function" != xyes; then
622   if test x"$multi_arch" = xyes; then
623     AC_MSG_ERROR([--enable-multi-arch support requires assembler and linker support])
624   else
625     multi_arch=no
626   fi
628 multi_arch_d=
629 if test x"$multi_arch" != xno; then
630   multi_arch_d=/multiarch
633 # Compute the list of sysdep directories for this configuration.
634 # This can take a while to compute.
635 sysdep_dir=$srcdir/sysdeps
636 AC_MSG_CHECKING(sysdep dirs)
637 dnl We need to use [ and ] for other purposes for a while now.
638 changequote(,)dnl
639 # Make sco3.2v4 become sco3.2.4 and sunos4.1.1_U1 become sunos4.1.1.U1.
640 os="`echo $os | sed 's/\([0-9A-Z]\)[v_]\([0-9A-Z]\)/\1.\2/g'`"
642 test "x$base_os" != x || case "$os" in
643 gnu*)
644   base_os=mach/hurd ;;
645 linux*)
646   base_os=unix/sysv ;;
647 esac
649 # For sunos4.1.1, try sunos4.1.1, then sunos4.1, then sunos4, then sunos.
650 tail=$os
651 ostry=$os
652 while o=`echo $tail | sed 's/\.[^.]*$//'`; test $o != $tail; do
653   ostry="$ostry /$o"
654   tail=$o
655 done
656 o=`echo $tail | sed 's/[0-9]*$//'`
657 if test $o != $tail; then
658   ostry="$ostry /$o"
660 # For linux-gnu, try linux-gnu, then linux.
661 o=`echo $tail | sed 's/-.*$//'`
662 if test $o != $tail; then
663   ostry="$ostry /$o"
666 # For unix/sysv/sysv4, try unix/sysv/sysv4, then unix/sysv, then unix.
667 base=
668 tail=$base_os
669 while b=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$b"; do
670   set $b
671   base="$base /$1"
672   tail="$2"
673 done
675 # For sparc/sparc32, try sparc/sparc32 and then sparc.
676 mach=
677 tail=$machine${submachine:+/$submachine}
678 while m=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$m"; do
679   set $m
680   # Prepend the machine's FPU directory unless --without-fp.
681   if test "$with_fp" = yes; then
682     maybe_fpu=/fpu
683   else
684     maybe_fpu=/nofpu
685   fi
686   # For each machine term, try it with and then without /multiarch.
687   for try_fpu in $maybe_fpu ''; do
688     for try_multi in $multi_arch_d ''; do
689       mach="$mach /$1$try_fpu$try_multi"
690     done
691   done
692   tail="$2"
693 done
695 dnl We are done with glob and regexp uses of [ and ]; return to autoconf.
696 changequote([,])dnl
698 # Find what sysdep directories exist.
699 sysnames_add_ons=
700 sysnames=
701 for b in $base ''; do
702   for m0 in $mach ''; do
703     for v in /$vendor ''; do
704       test "$v" = / && continue
705       for o in /$ostry ''; do
706         test "$o" = / && continue
707         for m in $mach ''; do
708           for d in $add_ons_pfx ''; do
709             for a in $add_ons_sfx ''; do
710               try_suffix="$m0$b$v$o$m"
711               if test -n "$try_suffix"; then
712                 try_srcdir="${srcdir}/"
713                 case "$d" in
714                 /*) try_srcdir= ;;
715                 esac
716                 try="${d}sysdeps$try_suffix$a"
717                 test -n "$enable_debug_configure" &&
718                 echo "$0 [DEBUG]: try $try" >&2
719                 if test -d "$try_srcdir$try"; then
720                   sysnames="$sysnames $try"
721                   { test -n "$o" || test -n "$b"; } && os_used=t
722                   { test -n "$m" || test -n "$m0"; } && machine_used=t
723                   case x${m0:-$m} in
724                   x*/$submachine) submachine_used=t ;;
725                   esac
726                   if test -n "$d"; then
727                     case "$sysnames_add_ons" in
728                     *" $d "*) ;;
729                     *|'') sysnames_add_ons="$sysnames_add_ons $d" ;;
730                     esac
731                   fi
732                 fi
733               fi
734             done
735           done
736         done
737       done
738     done
739   done
740 done
742 # If the assembler supports gnu_indirect_function symbol type and the
743 # architecture supports multi-arch, we enable multi-arch by default.
744 case $sysnames_add_ons$sysnames in
745 *"$multi_arch_d"*)
746   ;;
748   test x"$multi_arch" = xdefault && multi_arch=no
749   ;;
750 esac
751 if test x"$multi_arch" != xno; then
752   AC_DEFINE(USE_MULTIARCH)
754 AC_SUBST(multi_arch)
756 if test -z "$os_used" && test "$os" != none; then
757   AC_MSG_ERROR(Operating system $os is not supported.)
759 if test -z "$machine_used" && test "$machine" != none; then
760   AC_MSG_ERROR(The $machine is not supported.)
762 if test -z "$submachine_used" && test -n "$submachine"; then
763   AC_MSG_ERROR(The $submachine subspecies of $host_cpu is not supported.)
765 AC_SUBST(submachine)
767 # We have now validated the configuration.
769 # Expand the list of system names into a full list of directories
770 # from each element's parent name and Implies file (if present).
771 set $sysnames
772 names=
773 while test $# -gt 0; do
774   name=$1
775   shift
777   case " $names " in *" $name "*)
778     # Already in the list.
779     continue
780   esac
782   # Report each name as we discover it, so there is no long pause in output.
783   echo $ECHO_N "$name $ECHO_C" >&AS_MESSAGE_FD
785   name_base=`echo $name | sed -e 's@\(.*sysdeps\)/.*@\1@'`
787   case $name in
788     /*) xsrcdir= ;;
789     *)  xsrcdir=$srcdir/ ;;
790   esac
791   test -n "$enable_debug_configure" &&
792   echo "[DEBUG]: name/Implies $xsrcdir$name/Implies" >&2
794   for implies_file in Implies Implies-before Implies-after; do
795     implies_type=`echo $implies_file | sed s/-/_/`
796     eval ${implies_type}=
797     if test -f $xsrcdir$name/$implies_file; then
798       # Collect more names from the `Implies' file (removing comments).
799       implied_candidate="`sed 's/#.*$//' < $xsrcdir$name/$implies_file`"
800       for x in $implied_candidate; do
801         found=no
802         if test -d $xsrcdir$name_base/$x; then
803           eval "${implies_type}=\"\$${implies_type} \$name_base/\$x\""
804           found=yes
805         fi
806         for d in $add_ons_pfx ''; do
807           try="${d}sysdeps/$x"
808           case $d in
809            /*) try_srcdir= ;;
810            *) try_srcdir=$srcdir/ ;;
811           esac
812           test -n "$enable_debug_configure" &&
813            echo "[DEBUG]: $name $implies_file $x try($d) {$try_srcdir}$try" >&2
814           if test $try != $xsrcdir$name_base/$x && test -d $try_srcdir$try;
815           then
816             eval "${implies_type}=\"\$${implies_type} \$try\""
817             found=yes
818             case "$sysnames_add_ons" in
819             *" $d "*) ;;
820             *|'') sysnames_add_ons="$sysnames_add_ons $d" ;;
821             esac
822           fi
823         done
824         if test $found = no; then
825           AC_MSG_WARN($name/$implies_file specifies nonexistent $x)
826         fi
827       done
828     fi
829   done
831   # Add NAME to the list of names.
832   names="$names $name"
834   # Find the parent of NAME, using the empty string if it has none.
835 changequote(,)dnl
836   parent="`echo $name | sed -n -e 's=/[^/]*$==' -e '/sysdeps$/q' -e p`"
837 changequote([,])dnl
839   test -n "$enable_debug_configure" &&
840     echo "[DEBUG]: $name Implies='$Implies' rest='$*' parent='$parent' \
841 Implies_before='$Implies_before' Implies_after='$Implies_after'" >&2
843   # Add the names implied by NAME, and NAME's parent (if it has one), to
844   # the list of names to be processed (the argument list).  We prepend the
845   # implied names to the list and append the parent.  We want implied
846   # directories to come before further directories inferred from the
847   # configuration components; this ensures that for sysv4, unix/common
848   # (implied by unix/sysv/sysv4) comes before unix/sysv (in ostry (here $*)
849   # after sysv4).
850   sysnames="`echo $Implies $* $Implies_before $parent $Implies_after`"
851   test -n "$sysnames" && set $sysnames
852 done
854 # Add the default directories.
855 default_sysnames="sysdeps/generic"
856 sysnames="$names $default_sysnames"
857 AC_SUBST(sysnames)
858 # The other names were emitted during the scan.
859 AC_MSG_RESULT($default_sysnames)
861 # Collect the list of add-ons that supply partial sysdeps trees.
862 sysdeps_add_ons=
863 for add_on in $add_ons; do
864   case "$add_on" in
865   /*) xsrcdir= ;;
866   *) xsrcdir="$srcdir/" ;;
867   esac
869   test -d "$xsrcdir$add_on/sysdeps" || {
870     case "$configured_add_ons " in
871     *" $add_on "*) ;;
872     *|'')
873       AC_MSG_ERROR(add-on $add_on has no configure fragment or sysdeps tree)
874       ;;
875     esac
876     continue
877   }
879   sysdeps_add_ons="$sysdeps_add_ons $add_on"
880   case "$sysnames_add_ons" in
881   *" $add_on/ "*) ;;
882   *|'')
883     AC_MSG_WARN(add-on $add_on contributed no sysdeps directories)
884     continue ;;
885   esac
887   found=no
888   for d in $sysnames; do
889     case "$d" in
890     $add_on/sysdeps/*) ;;
891     *) continue ;;
892     esac
893     (cd "$xsrcdir$d" && for f in *[[!~]]; do
894        case "$f" in
895        sys|bits)
896          for ff in $f/*.h; do
897            test -d "$ff" || { test -e "$ff" && exit 88; }
898          done
899          ;;
900        *)
901          test -d "$f" || { test -e "$f" && exit 88; }
902          ;;
903        esac
904      done)
905     if test $? -eq 88; then
906       found=yes
907       break
908     fi
909   done
910   if test $found = no; then
911     AC_MSG_WARN(add-on $add_on contributed no useful sysdeps directories)
912   fi
913 done
914 AC_SUBST(sysdeps_add_ons)
917 ### Locate tools.
919 AC_PROG_INSTALL
920 if test "$INSTALL" = "${srcdir}/scripts/install-sh -c"; then
921   # The makefiles need to use a different form to find it in $srcdir.
922   INSTALL='\$(..)./scripts/install-sh -c'
924 AC_PROG_LN_S
926 LIBC_PROG_BINUTILS
928 # Accept binutils 2.20 or newer.
929 AC_CHECK_PROG_VER(AS, $AS, --version,
930                   [GNU assembler.* \([0-9]*\.[0-9.]*\)],
931                   [2.1[0-9][0-9]*|2.[2-9][0-9]*|[3-9].*|[1-9][0-9]*], AS=: critic_missing="$critic_missing as")
932 AC_CHECK_PROG_VER(LD, $LD, --version,
933                   [GNU ld.* \([0-9][0-9]*\.[0-9.]*\)],
934                   [2.1[0-9][0-9]*|2.[2-9][0-9]*|[3-9].*|[1-9][0-9]*], LD=: critic_missing="$critic_missing ld")
936 # These programs are version sensitive.
937 AC_CHECK_TOOL_PREFIX
938 AC_CHECK_PROG_VER(CC, ${ac_tool_prefix}gcc ${ac_tool_prefix}cc, -v,
939   [version \([egcygnustpi-]*[0-9.]*\)], [4.[4-9].* | 4.[1-9][0-9].* | [5-9].* ],
940   critic_missing="$critic_missing gcc")
941 AC_CHECK_PROG_VER(MAKE, gnumake gmake make, --version,
942   [GNU Make[^0-9]*\([0-9][0-9.]*\)],
943   [3.79* | 3.[89]* | [4-9].* | [1-9][0-9]*], critic_missing="$critic_missing make")
945 AC_CHECK_PROG_VER(MSGFMT, gnumsgfmt gmsgfmt msgfmt, --version,
946   [GNU gettext.* \([0-9]*\.[0-9.]*\)],
947   [0.10.3[6-9]* | 0.10.[4-9][0-9]* | 0.1[1-9]* | 0.[2-9][0-9]* | [1-9].*],
948   MSGFMT=: aux_missing="$aux_missing msgfmt")
949 AC_CHECK_PROG_VER(MAKEINFO, makeinfo, --version,
950   [GNU texinfo.* \([0-9][0-9.]*\)],
951   [4.[5-9]*|4.[1-9][0-9]*|[5-9].*],
952   MAKEINFO=: aux_missing="$aux_missing makeinfo")
953 AC_CHECK_PROG_VER(SED, sed, --version,
954   [GNU sed[^0-9]* \([0-9]*\.[0-9.]*\)],
955   [3.0[2-9]*|3.[1-9]*|[4-9]*],
956   SED=: aux_missing="$aux_missing sed")
957 AC_CHECK_PROG_VER(AWK, gawk, --version,
958   [GNU Awk[^0-9]*\([0-9][0-9.]*\)],
959   [3.1.[2-9]*|3.[2-9]*|[4-9]*], critic_missing="$critic_missing gawk")
961 AC_CHECK_TOOL(NM, nm, false)
963 if test "x$maintainer" = "xyes"; then
964   AC_CHECK_PROGS(AUTOCONF, autoconf, no)
965   case "x$AUTOCONF" in
966   xno|x|x:) AUTOCONF=no ;;
967   *)
968     AC_CACHE_CHECK(dnl
969   whether $AUTOCONF${ACFLAGS:+ }$ACFLAGS works, libc_cv_autoconf_works, [dnl
970     if (cd $srcdir; $AUTOCONF $ACFLAGS configure.ac > /dev/null 2>&1); then
971       libc_cv_autoconf_works=yes
972     else
973       libc_cv_autoconf_works=no
974     fi])
975     test $libc_cv_autoconf_works = yes || AUTOCONF=no
976     ;;
977   esac
978   if test "x$AUTOCONF" = xno; then
979     aux_missing="$aux_missing autoconf"
980   fi
981 else
982   AUTOCONF=no
985 test -n "$critic_missing" && AC_MSG_ERROR([
986 *** These critical programs are missing or too old:$critic_missing
987 *** Check the INSTALL file for required versions.])
989 test -n "$aux_missing" && AC_MSG_WARN([
990 *** These auxiliary programs are missing or incompatible versions:$aux_missing
991 *** some features will be disabled.
992 *** Check the INSTALL file for required versions.])
994 # if using special system headers, find out the compiler's sekrit
995 # header directory and add that to the list.  NOTE: Only does the right
996 # thing on a system that doesn't need fixincludes.  (Not presently a problem.)
997 if test -n "$sysheaders"; then
998   SYSINCLUDES=-nostdinc
999   for d in include include-fixed; do
1000     i=`$CC -print-file-name="$d"` && test "x$i" != x && test "x$i" != "x$d" &&
1001     SYSINCLUDES="$SYSINCLUDES -isystem $i"
1002   done
1003   SYSINCLUDES="$SYSINCLUDES \
1004 -isystem `echo $sysheaders | sed 's/:/ -isystem /g'`"
1005   if test -n "$CXX"; then
1006     CXX_SYSINCLUDES=
1007     for cxxheaders in `$CXX -v -S -x c++ /dev/null -o /dev/null 2>&1 \
1008     | sed -n -e '1,/#include/d' -e 's/^ \(\/.*\/[cg]++\)/\1/p'`; do
1009       test "x$cxxheaders" != x &&
1010       CXX_SYSINCLUDES="$CXX_SYSINCLUDES -isystem $cxxheaders"
1011     done
1012   fi
1014 AC_SUBST(SYSINCLUDES)
1015 AC_SUBST(CXX_SYSINCLUDES)
1017 # Test if LD_LIBRARY_PATH contains the notation for the current directory
1018 # since this would lead to problems installing/building glibc.
1019 # LD_LIBRARY_PATH contains the current directory if one of the following
1020 # is true:
1021 # - one of the terminals (":" and ";") is the first or last sign
1022 # - two terminals occur directly after each other
1023 # - the path contains an element with a dot in it
1024 AC_MSG_CHECKING(LD_LIBRARY_PATH variable)
1025 changequote(,)dnl
1026 case ${LD_LIBRARY_PATH} in
1027   [:\;]* | *[:\;] | *[:\;][:\;]* |  *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* )
1028     ld_library_path_setting="contains current directory"
1029     ;;
1030   *)
1031     ld_library_path_setting="ok"
1032     ;;
1033 esac
1034 changequote([,])dnl
1035 AC_MSG_RESULT($ld_library_path_setting)
1036 if test "$ld_library_path_setting" != "ok"; then
1037 AC_MSG_ERROR([
1038 *** LD_LIBRARY_PATH shouldn't contain the current directory when
1039 *** building glibc. Please change the environment variable
1040 *** and run configure again.])
1043 AC_CACHE_CHECK(whether GCC supports -static-libgcc, libc_cv_gcc_static_libgcc, [dnl
1044 if $CC -v -static-libgcc 2>&1 | grep 'unrecognized option.*static-libgcc' >/dev/null; then
1045   libc_cv_gcc_static_libgcc=
1046 else
1047   libc_cv_gcc_static_libgcc=-static-libgcc
1048 fi])
1049 AC_SUBST(libc_cv_gcc_static_libgcc)
1051 AC_PATH_PROG(BASH_SHELL, bash, no)
1053 AC_PATH_PROG(PERL, perl, no)
1054 if test "$PERL" != no &&
1055    (eval `$PERL -V:apiversion`; test `expr "$apiversion" \< 5` -ne 0); then
1056   PERL=no
1058 AC_PATH_PROG(INSTALL_INFO, install-info, no,
1059              $PATH:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin)
1060 AC_PATH_PROG(BISON, bison, no, $PATH:/usr/local/bin:/usr/bin:/bin)
1062 AC_CACHE_CHECK(for libc-friendly stddef.h, libc_cv_friendly_stddef, [dnl
1063 AC_TRY_COMPILE(dnl
1064 [#define __need_size_t
1065 #define __need_wchar_t
1066 #include <stddef.h>
1067 #define __need_NULL
1068 #include <stddef.h>], [size_t size; wchar_t wchar;
1069 #ifdef offsetof
1070 #error stddef.h ignored __need_*
1071 #endif
1072 if (&size == NULL || &wchar == NULL) abort ();],
1073                libc_cv_friendly_stddef=yes,
1074                libc_cv_friendly_stddef=no)])
1075 if test $libc_cv_friendly_stddef = yes; then
1076   config_vars="$config_vars
1077 override stddef.h = # The installed <stddef.h> seems to be libc-friendly."
1080 AC_CACHE_CHECK(whether we need to use -P to assemble .S files,
1081                libc_cv_need_minus_P, [dnl
1082 cat > conftest.S <<EOF
1083 #include "confdefs.h"
1084 /* Nothing whatsoever.  */
1086 if AC_TRY_COMMAND(${CC-cc} $CPPFLAGS $ASFLAGS -c conftest.S 1>&AS_MESSAGE_LOG_FD); then
1087   libc_cv_need_minus_P=no
1088 else
1089   libc_cv_need_minus_P=yes
1091 rm -f conftest*])
1092 if test $libc_cv_need_minus_P = yes; then
1093   config_vars="$config_vars
1094 asm-CPPFLAGS = -P # The assembler can't grok cpp's # line directives."
1097 AC_CACHE_CHECK(for .set assembler directive, libc_cv_asm_set_directive, [dnl
1098 cat > conftest.s <<EOF
1099 ${libc_cv_dot_text}
1100 foo:
1101 .set glibc_conftest_frobozz,foo
1102 .globl glibc_conftest_frobozz
1104 # The alpha-dec-osf1 assembler gives only a warning for `.set'
1105 # (but it doesn't work), so we must do a linking check to be sure.
1106 cat > conftest1.c <<\EOF
1107 extern int glibc_conftest_frobozz;
1108 void _start() { glibc_conftest_frobozz = 1; }
1110 if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
1111             -nostartfiles -nostdlib \
1112             -o conftest conftest.s conftest1.c 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
1113   libc_cv_asm_set_directive=yes
1114 else
1115   libc_cv_asm_set_directive=no
1117 rm -f conftest*])
1118 if test $libc_cv_asm_set_directive = yes; then
1119   AC_DEFINE(HAVE_ASM_SET_DIRECTIVE)
1122 AC_CACHE_CHECK(for assembler gnu_unique_object symbol type,
1123                libc_cv_asm_unique_object, [dnl
1124 cat > conftest.s <<EOF
1125 ${libc_cv_dot_text}
1126 _sym:
1127 .type _sym, %gnu_unique_object
1129 if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
1130   libc_cv_asm_unique_object=yes
1131 else
1132   libc_cv_asm_unique_object=no
1134 rm -f conftest*])
1135 if test $libc_cv_asm_unique_object = yes; then
1136   AC_DEFINE(HAVE_ASM_UNIQUE_OBJECT)
1139 AC_CACHE_CHECK(for .previous assembler directive,
1140                libc_cv_asm_previous_directive, [dnl
1141 cat > conftest.s <<EOF
1142 .section foo_section
1143 .previous
1145 if AC_TRY_COMMAND(${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
1146   libc_cv_asm_previous_directive=yes
1147 else
1148   libc_cv_asm_previous_directive=no
1150 rm -f conftest*])
1151 if test $libc_cv_asm_previous_directive = yes; then
1152   AC_DEFINE(HAVE_ASM_PREVIOUS_DIRECTIVE)
1153 else
1154   AC_CACHE_CHECK(for .popsection assembler directive,
1155                  libc_cv_asm_popsection_directive, [dnl
1156   cat > conftest.s <<EOF
1157 .pushsection foo_section
1158 .popsection
1160   if AC_TRY_COMMAND(${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
1161     libc_cv_asm_popsection_directive=yes
1162   else
1163     libc_cv_asm_popsection_directive=no
1164   fi
1165   rm -f conftest*])
1166   if test $libc_cv_asm_popsection_directive = yes; then
1167     AC_DEFINE(HAVE_ASM_POPSECTION_DIRECTIVE)
1168   fi
1170 AC_CACHE_CHECK(for .protected and .hidden assembler directive,
1171                libc_cv_asm_protected_directive, [dnl
1172 cat > conftest.s <<EOF
1173 .protected foo
1174 foo:
1175 .hidden bar
1176 bar:
1178 if AC_TRY_COMMAND(${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
1179   libc_cv_asm_protected_directive=yes
1180 else
1181   AC_MSG_ERROR(assembler support for symbol visibility is required)
1183 rm -f conftest*])
1185 if test $libc_cv_asm_protected_directive = yes; then
1186   AC_CACHE_CHECK(whether __attribute__((visibility())) is supported,
1187                  libc_cv_visibility_attribute,
1188                  [cat > conftest.c <<EOF
1189                   int foo __attribute__ ((visibility ("hidden"))) = 1;
1190                   int bar __attribute__ ((visibility ("protected"))) = 1;
1192                   libc_cv_visibility_attribute=no
1193                   if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
1194                     if grep '\.hidden.*foo' conftest.s >/dev/null; then
1195                       if grep '\.protected.*bar' conftest.s >/dev/null; then
1196                         libc_cv_visibility_attribute=yes
1197                       fi
1198                     fi
1199                   fi
1200                   rm -f conftest.{c,s}
1201                  ])
1202   if test $libc_cv_visibility_attribute != yes; then
1203     AC_MSG_ERROR(compiler support for visibility attribute is required)
1204   fi
1207 if test $libc_cv_visibility_attribute = yes; then
1208   AC_CACHE_CHECK(for broken __attribute__((visibility())),
1209                  libc_cv_broken_visibility_attribute,
1210                  [cat > conftest.c <<EOF
1211                   int foo (int x);
1212                   int bar (int x) __asm__ ("foo") __attribute__ ((visibility ("hidden")));
1213                   int bar (int x) { return x; }
1215                   libc_cv_broken_visibility_attribute=yes
1216                   if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
1217 changequote(,)dnl
1218                     if grep '\.hidden[  _]foo' conftest.s >/dev/null; then
1219 changequote([,])dnl
1220                       libc_cv_broken_visibility_attribute=no
1221                     fi
1222                   fi
1223                   rm -f conftest.c conftest.s
1224                  ])
1225   if test $libc_cv_broken_visibility_attribute = yes; then
1226     AC_MSG_ERROR(working compiler support for visibility attribute is required)
1227   fi
1230 AC_CACHE_CHECK(for broken __attribute__((alias())),
1231                libc_cv_broken_alias_attribute,
1232                [cat > conftest.c <<EOF
1233                extern int foo (int x) __asm ("xyzzy");
1234                int bar (int x) { return x; }
1235                extern __typeof (bar) foo __attribute ((weak, alias ("bar")));
1236                extern int dfoo;
1237                extern __typeof (dfoo) dfoo __asm ("abccb");
1238                int dfoo = 1;
1240                libc_cv_broken_alias_attribute=yes
1241                if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
1242                  if grep 'xyzzy' conftest.s >/dev/null &&
1243                     grep 'abccb' conftest.s >/dev/null; then
1244                    libc_cv_broken_alias_attribute=no
1245                  fi
1246                fi
1247                rm -f conftest.c conftest.s
1248                ])
1249 if test $libc_cv_broken_alias_attribute = yes; then
1250   AC_MSG_ERROR(working alias attribute support required)
1253 if test $libc_cv_visibility_attribute = yes; then
1254   AC_CACHE_CHECK(whether to put _rtld_local into .sdata section,
1255                  libc_cv_have_sdata_section,
1256                  [echo "int i;" > conftest.c
1257                   libc_cv_have_sdata_section=no
1258                   if ${CC-cc} $LDFLAGS -fPIC -shared -Wl,--verbose conftest.c -o conftest.so 2>&1 \
1259                      | grep '\.sdata' >/dev/null; then
1260                     libc_cv_have_sdata_section=yes
1261                   fi
1262                   rm -f conftest.c conftest.so
1263                  ])
1264   if test $libc_cv_have_sdata_section = yes; then
1265     AC_DEFINE(HAVE_SDATA_SECTION)
1266   fi
1269 AC_CACHE_CHECK(for .preinit_array/.init_array/.fini_array support,
1270                libc_cv_initfini_array, [dnl
1271 LIBC_TRY_LINK_STATIC([
1272 int foo (void) { return 1; }
1273 int (*fp) (void) __attribute__ ((section (".init_array"))) = foo;
1275   [if $READELF -S conftest | fgrep INIT_ARRAY > /dev/null; then
1276     libc_cv_initfini_array=yes
1277   else
1278     libc_cv_initfini_array=no
1279   fi],
1280   [libc_cv_initfini_array=no])
1282 if test $libc_cv_initfini_array != yes; then
1283   AC_MSG_ERROR([Need linker with .init_array/.fini_array support.])
1286 AC_CACHE_CHECK(whether to use .ctors/.dtors header and trailer,
1287                libc_cv_ctors_header, [dnl
1288   libc_cv_ctors_header=yes
1289   LIBC_TRY_LINK_STATIC([
1290 __attribute__ ((constructor)) void ctor (void) { asm (""); }
1291 __attribute__ ((destructor))  void dtor (void) { asm (""); }
1293               [dnl
1294       AS_IF([$READELF -WS conftest$ac_exeext | $AWK '
1295         { gsub(/\@<:@ */, "@<:@") }
1296         $2 == ".ctors" || $2 == ".dtors" {
1297           size = strtonum("0x" $6)
1298           align = strtonum("0x" $NF)
1299           seen@<:@$2@:>@ = 1
1300           stub@<:@$2@:>@ = size == align * 2
1301         }
1302         END {
1303           ctors_ok = !seen@<:@".ctors"@:>@ || stub@<:@".ctors"@:>@
1304           dtors_ok = !seen@<:@".dtors"@:>@ || stub@<:@".dtors"@:>@
1305           exit ((ctors_ok && dtors_ok) ? 0 : 1)
1306         }
1307       '], [libc_cv_ctors_header=no])
1308     ], [dnl
1309       AC_MSG_ERROR([missing __attribute__ ((constructor)) support??])
1310     ])
1312 if test $libc_cv_ctors_header = no; then
1313   AC_DEFINE(NO_CTORS_DTORS_SECTIONS)
1316 AC_CACHE_CHECK(for libunwind-support in compiler,
1317                libc_cv_cc_with_libunwind, [
1318   cat > conftest.c <<EOF
1319 int main (void) { return 0; }
1321   if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -static -o conftest \
1322      conftest.c -v 2>&1 >/dev/null | grep ' -lunwind ' >/dev/null; then
1323     libc_cv_cc_with_libunwind=yes
1324   else
1325     libc_cv_cc_with_libunwind=no
1326   fi
1327   rm -f conftest*])
1328 AC_SUBST(libc_cv_cc_with_libunwind)
1329 if test $libc_cv_cc_with_libunwind = yes; then
1330   AC_DEFINE(HAVE_CC_WITH_LIBUNWIND)
1333 LIBC_LINKER_FEATURE([-z nodelete], [-Wl,--enable-new-dtags,-z,nodelete],
1334                     [libc_cv_z_nodelete=yes],
1335                     [AC_MSG_ERROR(linker with -z nodelete support required)])
1337 LIBC_LINKER_FEATURE([-z nodlopen], [-Wl,--enable-new-dtags,-z,nodlopen],
1338                     [libc_cv_z_nodlopen=yes],
1339                     [AC_MSG_ERROR(linker with -z nodlopen support required)])
1341 LIBC_LINKER_FEATURE([-z initfirst], [-Wl,--enable-new-dtags,-z,initfirst],
1342                     [libc_cv_z_initfirst=yes],
1343                     [AC_MSG_ERROR(linker with -z initfirst support required)])
1345 AC_CACHE_CHECK(for -Bgroup option,
1346                libc_cv_Bgroup, [dnl
1347 cat > conftest.c <<EOF
1348 int _start (void) { return 42; }
1350 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1351                             -fPIC -shared -o conftest.so conftest.c
1352                             -Wl,-Bgroup -nostdlib 1>&AS_MESSAGE_LOG_FD])
1353 then
1354   libc_cv_Bgroup=yes
1355 else
1356   libc_cv_Bgroup=no
1358 rm -f conftest*])
1359 AC_SUBST(libc_cv_Bgroup)
1361 ASFLAGS_config=
1362 AC_CACHE_CHECK(whether --noexecstack is desirable for .S files,
1363                libc_cv_as_noexecstack, [dnl
1364 cat > conftest.c <<EOF
1365 void foo (void) { }
1367 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS
1368                    -S -o conftest.s conftest.c 1>&AS_MESSAGE_LOG_FD]) \
1369    && grep .note.GNU-stack conftest.s >/dev/null \
1370    && AC_TRY_COMMAND([${CC-cc} $ASFLAGS -Wa,--noexecstack
1371                       -c -o conftest.o conftest.s 1>&AS_MESSAGE_LOG_FD])
1372 then
1373   libc_cv_as_noexecstack=yes
1374 else
1375   libc_cv_as_noexecstack=no
1377 rm -f conftest*])
1378 if test $libc_cv_as_noexecstack = yes; then
1379   ASFLAGS_config="$ASFLAGS_config -Wa,--noexecstack"
1381 AC_SUBST(ASFLAGS_config)
1383 AC_CACHE_CHECK(for -z combreloc,
1384                libc_cv_z_combreloc, [dnl
1385 cat > conftest.c <<EOF
1386 extern int bar (int);
1387 extern int mumble;
1388 int foo (void) { return bar (mumble); }
1390 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1391                         -fPIC -shared -o conftest.so conftest.c
1392                         -nostdlib -nostartfiles
1393                         -Wl,-z,combreloc 1>&AS_MESSAGE_LOG_FD])
1394 then
1395 dnl The following test is a bit weak.  We must use a tool which can test
1396 dnl cross-platform since the gcc used can be a cross compiler.  Without
1397 dnl introducing new options this is not easily doable.  Instead use a tool
1398 dnl which always is cross-platform: readelf.  To detect whether -z combreloc
1399 dnl look for a section named .rel.dyn.
1400   if $READELF -S conftest.so | grep '\.rel\(a\|\)\.dyn' > /dev/null; then
1401     libc_cv_z_combreloc=yes
1402   else
1403     libc_cv_z_combreloc=no
1404   fi
1405 else
1406   libc_cv_z_combreloc=no
1408 rm -f conftest*])
1409 if test "$libc_cv_z_combreloc" = yes; then
1410   AC_DEFINE(HAVE_Z_COMBRELOC)
1412 AC_SUBST(libc_cv_z_combreloc)
1414 LIBC_LINKER_FEATURE([-z execstack], [-Wl,-z,execstack],
1415                     [libc_cv_z_execstack=yes], [libc_cv_z_execstack=no])
1416 AC_SUBST(libc_cv_z_execstack)
1418 AC_CACHE_CHECK(for -fpie, libc_cv_fpie, [dnl
1419 LIBC_TRY_CC_OPTION([-fpie], [libc_cv_fpie=yes], [libc_cv_fpie=no])
1422 AC_SUBST(libc_cv_fpie)
1424 AC_CACHE_CHECK(for --hash-style option,
1425                libc_cv_hashstyle, [dnl
1426 cat > conftest.c <<EOF
1427 int _start (void) { return 42; }
1429 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1430                             -fPIC -shared -o conftest.so conftest.c
1431                             -Wl,--hash-style=both -nostdlib 1>&AS_MESSAGE_LOG_FD])
1432 then
1433   libc_cv_hashstyle=yes
1434 else
1435   libc_cv_hashstyle=no
1437 rm -f conftest*])
1438 AC_SUBST(libc_cv_hashstyle)
1440 # The linker's default -shared behavior is good enough if it
1441 # does these things that our custom linker scripts ensure that
1442 # all allocated NOTE sections come first.
1443 if test "$use_default_link" = default; then
1444   AC_CACHE_CHECK([for sufficient default -shared layout],
1445                   libc_cv_use_default_link, [dnl
1446   libc_cv_use_default_link=no
1447   cat > conftest.s <<\EOF
1448           .section .note.a,"a",%note
1449           .balign 4
1450           .long 4,4,9
1451           .string "GNU"
1452           .string "foo"
1453           .section .note.b,"a",%note
1454           .balign 4
1455           .long 4,4,9
1456           .string "GNU"
1457           .string "bar"
1459   if AC_TRY_COMMAND([dnl
1460   ${CC-cc} $ASFLAGS -shared -o conftest.so conftest.s 1>&AS_MESSAGE_LOG_FD]) &&
1461        ac_try=`$READELF -S conftest.so | sed -n \
1462          ['${x;p;}
1463           s/^ *\[ *[1-9][0-9]*\]  *\([^ ][^ ]*\)  *\([^ ][^ ]*\) .*$/\2 \1/
1464           t a
1465           b
1466           : a
1467           H']`
1468   then
1469     libc_seen_a=no libc_seen_b=no
1470     set -- $ac_try
1471     while test $# -ge 2 -a "$1" = NOTE; do
1472       case "$2" in
1473       .note.a) libc_seen_a=yes ;;
1474       .note.b) libc_seen_b=yes ;;
1475       esac
1476       shift 2
1477     done
1478     case "$libc_seen_a$libc_seen_b" in
1479     yesyes)
1480       libc_cv_use_default_link=yes
1481       ;;
1482     *)
1483       echo >&AS_MESSAGE_LOG_FD "\
1484 $libc_seen_a$libc_seen_b from:
1485 $ac_try"
1486       ;;
1487     esac
1488   fi
1489   rm -f conftest*])
1490   use_default_link=$libc_cv_use_default_link
1493 AC_CACHE_CHECK(linker output format, libc_cv_output_format, [dnl
1494 if libc_cv_output_format=`
1495 ${CC-cc} -nostartfiles -nostdlib -Wl,--print-output-format 2>&AS_MESSAGE_LOG_FD`
1496 then
1497   :
1498 else
1499   libc_cv_output_format=
1501 test -n "$libc_cv_output_format" || libc_cv_output_format=unknown])
1502 AC_SUBST(libc_cv_output_format)
1504 AC_CACHE_CHECK(for -fno-toplevel-reorder -fno-section-anchors, libc_cv_fno_toplevel_reorder, [dnl
1505 cat > conftest.c <<EOF
1506 int foo;
1508 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -fno-toplevel-reorder -fno-section-anchors
1509                             conftest.c 1>&AS_MESSAGE_LOG_FD])
1510 then
1511   libc_cv_fno_toplevel_reorder=yes
1512 else
1513   libc_cv_fno_toplevel_reorder=no
1515 rm -f conftest*])
1516 if test $libc_cv_fno_toplevel_reorder = yes; then
1517   fno_unit_at_a_time="-fno-toplevel-reorder -fno-section-anchors"
1518 else
1519   fno_unit_at_a_time=-fno-unit-at-a-time
1521 AC_SUBST(fno_unit_at_a_time)
1523 AC_CACHE_CHECK(for -fstack-protector, libc_cv_ssp, [dnl
1524 LIBC_TRY_CC_OPTION([$CFLAGS $CPPFLAGS -Werror -fstack-protector],
1525                    [libc_cv_ssp=yes],
1526                    [libc_cv_ssp=no])
1528 AC_SUBST(libc_cv_ssp)
1530 AC_CACHE_CHECK(for -fgnu89-inline, libc_cv_gnu89_inline, [dnl
1531 cat > conftest.c <<EOF
1532 int foo;
1533 #ifdef __GNUC_GNU_INLINE__
1534 main () { return 0;}
1535 #else
1536 #error
1537 #endif
1539 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -std=gnu99 -fgnu89-inline
1540                             -o conftest.s conftest.c 1>&AS_MESSAGE_LOG_FD])
1541 then
1542   libc_cv_gnu89_inline=yes
1543 else
1544   libc_cv_gnu89_inline=no
1546 rm -f conftest*])
1547 if test $libc_cv_gnu89_inline = yes; then
1548   gnu89_inline=-fgnu89-inline
1549 else
1550   gnu89_inline=
1552 AC_SUBST(gnu89_inline)
1554 AC_CACHE_CHECK(whether cc puts quotes around section names,
1555                libc_cv_have_section_quotes,
1556                [cat > conftest.c <<EOF
1557                 static const int foo
1558                 __attribute__ ((section ("bar"))) = 1;
1560                 if ${CC-cc} -S conftest.c -o conftest.s; then
1561                   if grep '\.section.*"bar"' conftest.s >/dev/null; then
1562                     libc_cv_have_section_quotes=yes
1563                   else
1564                     libc_cv_have_section_quotes=no
1565                   fi
1566                 else
1567                   libc_cv_have_section_quotes=unknown
1568                 fi
1569                 rm -f conftest.{c,s}
1570                 ])
1571 if test $libc_cv_have_section_quotes = yes; then
1572   AC_DEFINE(HAVE_SECTION_QUOTES)
1575 AC_CACHE_CHECK(for assembler .weak directive, libc_cv_asm_weak_directive,
1576                [dnl
1577 cat > conftest.s <<EOF
1578 ${libc_cv_dot_text}
1579 .globl foo
1580 foo:
1581 .weak foo
1582 .weak bar; bar = foo
1584 if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
1585   libc_cv_asm_weak_directive=yes
1586 else
1587   libc_cv_asm_weak_directive=no
1589 rm -f conftest*])
1591 if test $libc_cv_asm_weak_directive = no; then
1592   AC_CACHE_CHECK(for assembler .weakext directive,
1593                  libc_cv_asm_weakext_directive,
1594                  [dnl
1595 cat > conftest.s <<EOF
1596 ${libc_cv_dot_text}
1597 .globl foo
1598 foo:
1599 .weakext bar foo
1600 .weakext baz
1601 .globl baz
1602 baz:
1604   if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
1605     libc_cv_asm_weakext_directive=yes
1606   else
1607     libc_cv_asm_weakext_directive=no
1608   fi
1609   rm -f conftest*])
1611 fi # no .weak
1613 if test $libc_cv_asm_weak_directive = yes; then
1614   AC_DEFINE(HAVE_ASM_WEAK_DIRECTIVE)
1615 elif test $libc_cv_asm_weakext_directive = yes; then
1616   AC_DEFINE(HAVE_ASM_WEAKEXT_DIRECTIVE)
1619 AC_CACHE_CHECK(for ld --no-whole-archive, libc_cv_ld_no_whole_archive, [dnl
1620 cat > conftest.c <<\EOF
1621 _start () {}
1622 int __eh_pc;
1623 __throw () {}
1625 dnl No \ in command here because it ends up inside ''.
1626 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1627                             -nostdlib -nostartfiles -Wl,--no-whole-archive
1628                             -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD]); then
1629   libc_cv_ld_no_whole_archive=yes
1630 else
1631   libc_cv_ld_no_whole_archive=no
1633 rm -f conftest*])
1634 if test $libc_cv_ld_no_whole_archive = no; then
1635   AC_MSG_ERROR([support for --no-whole-archive is needed])
1638 AC_CACHE_CHECK(for gcc -fexceptions, libc_cv_gcc_exceptions, [dnl
1639 cat > conftest.c <<\EOF
1640 _start () {}
1641 int __eh_pc;
1642 __throw () {}
1644 dnl No \ in command here because it ends up inside ''.
1645 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1646                             -nostdlib -nostartfiles -fexceptions
1647                             -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD]); then
1648   libc_cv_gcc_exceptions=yes
1649 else
1650   libc_cv_gcc_exceptions=no
1652 rm -f conftest*])
1653 if test $libc_cv_gcc_exceptions = yes; then
1654   exceptions=-fexceptions
1656 AC_SUBST(exceptions)dnl
1658 AC_CACHE_CHECK(for __builtin_memset, libc_cv_gcc_builtin_memset, [dnl
1659 cat > conftest.c <<\EOF
1660 void zero (void *x)
1662   __builtin_memset (x, 0, 1000);
1666 if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | fgrep "memset" > /dev/null]);
1667 then
1668   libc_cv_gcc_builtin_memset=no
1669 else
1670   libc_cv_gcc_builtin_memset=yes
1672 rm -f conftest* ])
1673 if test "$libc_cv_gcc_builtin_memset" = yes ; then
1674   AC_DEFINE(HAVE_BUILTIN_MEMSET)
1677 AC_CACHE_CHECK(for redirection of built-in functions, libc_cv_gcc_builtin_redirection, [dnl
1678 cat > conftest.c <<\EOF
1679 extern char *strstr (const char *, const char *) __asm ("my_strstr");
1680 char *foo (const char *a, const char *b)
1682   return __builtin_strstr (a, b);
1686 if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | fgrep "my_strstr" > /dev/null]);
1687 then
1688   libc_cv_gcc_builtin_redirection=yes
1689 else
1690   libc_cv_gcc_builtin_redirection=no
1692 rm -f conftest* ])
1693 if test "$libc_cv_gcc_builtin_redirection" = no; then
1694   AC_MSG_ERROR([support for the symbol redirection needed])
1697 dnl Check whether the compiler supports the __thread keyword.
1698 AC_CACHE_CHECK([for __thread], libc_cv_gcc___thread,
1699 [cat > conftest.c <<\EOF
1700 __thread int a = 42;
1702 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c >&AS_MESSAGE_LOG_FD]); then
1703   libc_cv_gcc___thread=yes
1704 else
1705   libc_cv_gcc___thread=no
1707 rm -f conftest*])
1708 if test "$libc_cv_gcc___thread" = no; then
1709   AC_MSG_ERROR([support for the __thread keyword is required])
1712 dnl Check whether the compiler supports the tls_model attribute.
1713 AC_CACHE_CHECK([for tls_model attribute], libc_cv_gcc_tls_model_attr, [dnl
1714 cat > conftest.c <<\EOF
1715 extern __thread int a __attribute__((tls_model ("initial-exec")));
1717 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -Werror conftest.c >&AS_MESSAGE_LOG_FD]); then
1718   libc_cv_gcc_tls_model_attr=yes
1719 else
1720   libc_cv_gcc_tls_model_attr=no
1722 rm -f conftest*])
1723 if test "$libc_cv_gcc_tls_model_attr" = no; then
1724   AC_MSG_ERROR([support for the tls_model attribute is required])
1727 dnl Determine how to disable generation of FMA instructions.
1728 AC_CACHE_CHECK([for compiler option to disable generation of FMA instructions],
1729                libc_cv_cc_nofma, [dnl
1730 libc_cv_cc_nofma=
1731 for opt in -ffp-contract=off -mno-fused-madd; do
1732   LIBC_TRY_CC_OPTION([$opt], [libc_cv_cc_nofma=$opt; break])
1733 done])
1734 AC_SUBST(libc_cv_cc_nofma)
1736 if test -n "$submachine"; then
1737   AC_CACHE_CHECK([for compiler option for CPU variant],
1738                  libc_cv_cc_submachine, [dnl
1739   libc_cv_cc_submachine=no
1740   for opt in "-march=$submachine" "-mcpu=$submachine"; do
1741     LIBC_TRY_CC_OPTION([$opt], [
1742       libc_cv_cc_submachine="$opt"
1743       break], [])
1744   done])
1745   if test "x$libc_cv_cc_submachine" = xno; then
1746     AC_MSG_ERROR([${CC-cc} does not support $submachine])
1747   fi
1749 AC_SUBST(libc_cv_cc_submachine)
1751 AC_CACHE_CHECK(if $CC accepts -fno-tree-loop-distribute-patterns with \
1752 __attribute__ ((__optimize__)), libc_cv_cc_loop_to_function, [dnl
1753 cat > conftest.c <<EOF
1754 void
1755 __attribute__ ((__optimize__ ("-fno-tree-loop-distribute-patterns")))
1756 foo (void) {}
1758 libc_cv_cc_loop_to_function=no
1759 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c])
1760 then
1761   libc_cv_cc_loop_to_function=yes
1763 rm -f conftest*])
1764 if test $libc_cv_cc_loop_to_function = yes; then
1765   AC_DEFINE(HAVE_CC_INHIBIT_LOOP_TO_LIBCALL)
1767 AC_SUBST(libc_cv_cc_loop_to_function)
1769 dnl Check whether we have the gd library available.
1770 AC_MSG_CHECKING(for libgd)
1771 if test "$with_gd" != "no"; then
1772   old_CFLAGS="$CFLAGS"
1773   CFLAGS="$CFLAGS $libgd_include"
1774   old_LDFLAGS="$LDFLAGS"
1775   LDFLAGS="$LDFLAGS $libgd_ldflags"
1776   old_LIBS="$LIBS"
1777   LIBS="$LIBS -lgd -lpng -lz -lm"
1778   AC_TRY_LINK([#include <gd.h>], [gdImagePng (0, 0)], LIBGD=yes, LIBGD=no)
1779   CFLAGS="$old_CFLAGS"
1780   LDFLAGS="$old_LDFLAGS"
1781   LIBS="$old_LIBS"
1782 else
1783   LIBGD=no
1785 AC_MSG_RESULT($LIBGD)
1786 AC_SUBST(LIBGD)
1788 # SELinux detection
1789 if test x$with_selinux = xno ; then
1790   have_selinux=no;
1791 else
1792   # See if we have the SELinux library
1793   AC_CHECK_LIB(selinux, is_selinux_enabled,
1794                have_selinux=yes, have_selinux=no)
1795   if test x$with_selinux = xyes ; then
1796     if test x$have_selinux = xno ; then
1797       AC_MSG_ERROR([SELinux explicitly required, but SELinux library not found])
1798     fi
1799   fi
1801 # Check if we're building with SELinux support.
1802 if test "x$have_selinux" = xyes; then
1803   AC_DEFINE(HAVE_SELINUX, 1, [SELinux support])
1805   # See if we have the libaudit library
1806   AC_CHECK_LIB(audit, audit_log_user_avc_message,
1807                have_libaudit=yes, have_libaudit=no)
1808   if test "x$have_libaudit" = xyes; then
1809     AC_DEFINE(HAVE_LIBAUDIT, 1, [SELinux libaudit support])
1810   fi
1811   AC_SUBST(have_libaudit)
1813   # See if we have the libcap library
1814   AC_CHECK_LIB(cap, cap_init, have_libcap=yes, have_libcap=no)
1815   if test "x$have_libcap" = xyes; then
1816     AC_DEFINE(HAVE_LIBCAP, 1, [SELinux libcap support])
1817   fi
1818   AC_SUBST(have_libcap)
1820 AC_SUBST(have_selinux)
1822 dnl check for the size of 'long double'.
1823 AC_CHECK_SIZEOF(long double, 0)
1824 sizeof_long_double=$ac_cv_sizeof_long_double
1825 AC_SUBST(sizeof_long_double)
1827 CPPUNDEFS=
1828 dnl Check for silly hacked compilers predefining _FORTIFY_SOURCE.
1829 dnl Since we are building the implementations of the fortified functions here,
1830 dnl having the macro defined interacts very badly.
1831 AC_CACHE_CHECK([for _FORTIFY_SOURCE predefine], libc_cv_predef_fortify_source,
1832 [AC_TRY_COMPILE([], [
1833 #ifdef _FORTIFY_SOURCE
1834 # error bogon
1835 #endif],
1836                 [libc_cv_predef_fortify_source=no],
1837                 [libc_cv_predef_fortify_source=yes])])
1838 if test $libc_cv_predef_fortify_source = yes; then
1839   CPPUNDEFS="${CPPUNDEFS:+$CPPUNDEFS }-U_FORTIFY_SOURCE"
1841 AC_SUBST(CPPUNDEFS)
1843 dnl Check for silly hacked compilers inserting -fstack-protector.
1844 dnl This breaks badly for the early startup code we compile, since
1845 dnl the compiled code can refer to a magic machine-dependent location
1846 dnl for the canary value before we have sufficient setup for that to
1847 dnl work.  It's also questionable to build all of libc with this flag
1848 dnl even when you're doing that for most applications you build, since
1849 dnl libc's code is so heavily-used and performance-sensitive.  If we
1850 dnl ever really want to make that work, it should be enabled explicitly
1851 dnl in the libc build, not inherited from implicit compiler settings.
1852 AC_CACHE_CHECK([whether $CC implicitly enables -fstack-protector],
1853                libc_cv_predef_stack_protector, [
1854 AC_TRY_COMPILE([extern void foobar (char *);],
1855                [char large_array[2048]; foobar (large_array);], [
1856 libc_undefs=`$NM -u conftest.o |
1857   LC_ALL=C $AWK '$1 == "U" { print $2 | "sort -u"; next } { exit(1) }' \
1858     2>&AS_MESSAGE_LOG_FD` || {
1859   AC_MSG_ERROR([confusing output from $NM -u])
1861 echo >&AS_MESSAGE_LOG_FD "libc_undefs='$libc_undefs'"
1862 # On some architectures, there are architecture-specific undefined
1863 # symbols (resolved by the linker), so filter out unknown symbols.
1864 # This will fail to produce the correct result if the compiler
1865 # defaults to -fstack-protector but this produces an undefined symbol
1866 # other than __stack_chk_fail.  However, compilers like that have not
1867 # been encountered in practice.
1868 libc_undefs=`echo "$libc_undefs" | egrep '^(foobar|__stack_chk_fail)$'`
1869 case "$libc_undefs" in
1870 foobar) libc_cv_predef_stack_protector=no ;;
1871 '__stack_chk_fail
1872 foobar') libc_cv_predef_stack_protector=yes ;;
1873 *) AC_MSG_ERROR([unexpected symbols in test: $libc_undefs]) ;;
1874 esac],
1875                [AC_MSG_ERROR([test compilation failed])])
1877 libc_extra_cflags=
1878 if test $libc_cv_predef_stack_protector = yes; then
1879   libc_extra_cflags="$libc_extra_cflags -fno-stack-protector"
1881 libc_extra_cppflags=
1883 AC_CACHE_CHECK([whether the linker provides __ehdr_start],
1884                libc_cv_ehdr_start, [
1885 old_CFLAGS="$CFLAGS"
1886 old_LDFLAGS="$LDFLAGS"
1887 old_LIBS="$LIBS"
1888 CFLAGS="$CFLAGS -fPIC"
1889 LDFLAGS="$LDFLAGS -nostdlib -nostartfiles -shared"
1890 LIBS=
1891 AC_LINK_IFELSE([AC_LANG_SOURCE([
1892 extern const char __ehdr_start __attribute__ ((visibility ("hidden")));
1893 const char *ehdr (void) { return &__ehdr_start; }
1894 ])],
1895                [libc_cv_ehdr_start=yes], [libc_cv_ehdr_start=no])
1896 CFLAGS="$old_CFLAGS"
1897 LDFLAGS="$old_LDFLAGS"
1898 LIBS="$old_LIBS"
1900 if test $libc_cv_ehdr_start = yes; then
1901   AC_DEFINE([HAVE_EHDR_START])
1904 ### End of automated tests.
1905 ### Now run sysdeps configure fragments.
1907 # They also can set these variables.
1908 use_ldconfig=no
1909 ldd_rewrite_script=no
1910 libc_cv_sysconfdir=$sysconfdir
1911 libc_cv_localstatedir=$localstatedir
1912 libc_cv_gcc_unwind_find_fde=no
1913 libc_cv_idn=no
1915 # Iterate over all the sysdep directories we will use, running their
1916 # configure fragments.
1917 for dir in $sysnames; do
1918   case $dir in
1919     /*) dest=$dir ;;
1920     *)  dest=$srcdir/$dir ;;
1921   esac
1922   if test -r $dest/configure; then
1923     AC_MSG_RESULT(running configure fragment for $dir)
1924     . $dest/configure
1925   fi
1926 done
1928 AC_SUBST(libc_extra_cflags)
1929 AC_SUBST(libc_extra_cppflags)
1931 if test x$libc_cv_gcc_unwind_find_fde = xyes; then
1932   AC_DEFINE(EXPORT_UNWIND_FIND_FDE)
1934 AC_SUBST(libc_cv_gcc_unwind_find_fde)
1936 # A sysdeps configure fragment can reset this if IFUNC is not actually
1937 # usable even though the assembler knows how to generate the symbol type.
1938 if test x"$libc_cv_ld_gnu_indirect_function" = xyes; then
1939   AC_DEFINE(HAVE_IFUNC)
1942 # This is far from the AC_ARG_ENABLE that sets it so that a sysdeps
1943 # configure fragment can override the value to prevent this AC_DEFINE.
1944 AC_SUBST(use_nscd)
1945 if test "x$use_nscd" != xno; then
1946   AC_DEFINE([USE_NSCD])
1948 if test "x$build_nscd" = xdefault; then
1949   build_nscd=$use_nscd
1952 # Test for old glibc 2.0.x headers so that they can be removed properly
1953 # Search only in includedir.
1954 AC_MSG_CHECKING(for old glibc 2.0.x headers)
1955 if eval test -f "${includedir}/elfclass.h" -a -f "${includedir}/fcntlbits.h"
1956 then
1957   old_glibc_headers=yes
1958 else
1959   old_glibc_headers=no
1961 AC_MSG_RESULT($old_glibc_headers)
1962 if test ${old_glibc_headers} = yes; then
1963   AC_MSG_WARN(*** During \"make install\" old headers from glibc 2.0.x will)
1964   AC_MSG_WARN(*** be removed.)
1966 AC_SUBST(old_glibc_headers)
1968 AC_SUBST(libc_cv_slibdir)
1969 AC_SUBST(libc_cv_rtlddir)
1970 AC_SUBST(libc_cv_localedir)
1971 AC_SUBST(libc_cv_sysconfdir)
1972 AC_SUBST(libc_cv_localstatedir)
1973 AC_SUBST(libc_cv_rootsbindir)
1974 AC_SUBST(libc_cv_forced_unwind)
1976 if test x$use_ldconfig = xyes; then
1977   AC_DEFINE(USE_LDCONFIG)
1979 AC_SUBST(use_ldconfig)
1980 AC_SUBST(ldd_rewrite_script)
1982 AC_SUBST(static)
1983 AC_SUBST(shared)
1985 AC_CACHE_CHECK([whether -fPIC is default], libc_cv_pic_default,
1986 [libc_cv_pic_default=yes
1987 cat > conftest.c <<EOF
1988 #if defined __PIC__ || defined __pic__ || defined PIC || defined pic
1989 # error PIC is default.
1990 #endif
1992 if eval "${CC-cc} -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
1993   libc_cv_pic_default=no
1995 rm -f conftest.*])
1996 AC_SUBST(libc_cv_pic_default)
1998 AC_SUBST(profile)
1999 AC_SUBST(static_nss)
2001 AC_SUBST(DEFINES)
2003 dnl See sysdeps/mach/configure.ac for this variable.
2004 AC_SUBST(mach_interface_list)
2006 VERSION=`sed -n -e 's/^#define VERSION "\([^"]*\)"/\1/p' < $srcdir/version.h`
2007 RELEASE=`sed -n -e 's/^#define RELEASE "\([^"]*\)"/\1/p' < $srcdir/version.h`
2008 AC_SUBST(VERSION)
2009 AC_SUBST(RELEASE)
2011 AC_CONFIG_FILES([config.make Makefile])
2012 AC_CONFIG_COMMANDS([default],[[
2013 case $CONFIG_FILES in *config.make*)
2014 echo "$config_vars" >> config.make;;
2015 esac
2016 test -d bits || mkdir bits]],[[config_vars='$config_vars']])
2017 AC_OUTPUT