Fix powerpc software sqrtf (bug 17967).
[glibc.git] / configure.ac
blob8043a27c3fa8c0efe7114fd0d4e50ddf99bc9951
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([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]),
190               [hidden=$enableval],
191               [hidden=yes])
192 if test "x$hidden" = xno; then
193   AC_DEFINE(NO_HIDDEN)
196 AC_ARG_ENABLE([bind-now],
197               AC_HELP_STRING([--enable-bind-now],
198                              [disable lazy relocations in DSOs]),
199               [bindnow=$enableval],
200               [bindnow=no])
201 AC_SUBST(bindnow)
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],
209               [static_nss=no])
210 dnl Enable static NSS also if we build no shared objects.
211 if test x"$static_nss" = xyes || test x"$shared" = xno; then
212   static_nss=yes
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],
220               [force_install=yes])
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],
227               [maintainer=no])
229 dnl On some platforms we allow dropping compatibility with all kernel
230 dnl versions.
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],
235               [])
236 dnl Prevent unreasonable values.
237 if test "$minimum_kernel" = yes || test "$minimum_kernel" = no; then
238   # Better nothing than this.
239   minimum_kernel=""
240 else
241   if test "$minimum_kernel" = current; then
242     minimum_kernel=`uname -r 2>/dev/null` || minimum_kernel=
243   fi
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
248 dnl appropriate.
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],
253               [])
254 AC_SUBST(all_warnings)
256 AC_ARG_ENABLE([werror],
257               AC_HELP_STRING([--disable-werror],
258                              [do not build with -Werror]),
259               [enable_werror=$enableval],
260               [enable_werror=yes])
261 AC_SUBST(enable_werror)
263 AC_ARG_ENABLE([multi-arch],
264               AC_HELP_STRING([--enable-multi-arch],
265                              [enable single DSO with optimizations for multiple architectures]),
266               [multi_arch=$enableval],
267               [multi_arch=default])
269 AC_ARG_ENABLE([nss-crypt],
270               AC_HELP_STRING([--enable-nss-crypt],
271                              [enable libcrypt to use nss]),
272               [nss_crypt=$enableval],
273               [nss_crypt=no])
274 if test x$nss_crypt = xyes; then
275   nss_includes=-I$(nss-config --includedir 2>/dev/null)
276   if test $? -ne 0; then
277     AC_MSG_ERROR([cannot find include directory with nss-config])
278   fi
279   old_CFLAGS="$CFLAGS"
280   CFLAGS="$CFLAGS $nss_includes"
281   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([typedef int PRBool;
282 #include <hasht.h>
283 #include <nsslowhash.h>
284 void f (void) { NSSLOW_Init (); }])],
285              libc_cv_nss_crypt=yes,
286              AC_MSG_ERROR([
287 cannot find NSS headers with lowlevel hash function interfaces]))
288   old_LIBS="$LIBS"
289   LIBS="$LIBS -lfreebl3"
290   AC_LINK_IFELSE([AC_LANG_PROGRAM([typedef int PRBool;
291 #include <hasht.h>
292 #include <nsslowhash.h>],
293                                   [NSSLOW_Init();])],
294                  libc_cv_nss_crypt=yes,
295                  AC_MSG_ERROR([
296 cannot link program using lowlevel NSS hash functions]))
297   CFLAGS="$old_CFLAGS"
298   LIBS="$old_LIBS"
299 else
300   libc_cv_nss_crypt=no
302 AC_SUBST(libc_cv_nss_crypt)
305 AC_ARG_ENABLE([obsolete-rpc],
306               AC_HELP_STRING([--enable-obsolete-rpc],
307                              [build and install the obsolete RPC code for link-time usage]),
308               [link_obsolete_rpc=$enableval],
309               [link_obsolete_rpc=no])
310 AC_SUBST(link_obsolete_rpc)
312 if test "$link_obsolete_rpc" = yes; then
313   AC_DEFINE(LINK_OBSOLETE_RPC)
316 AC_ARG_ENABLE([systemtap],
317               [AS_HELP_STRING([--enable-systemtap],
318                [enable systemtap static probe points @<:@default=no@:>@])],
319               [systemtap=$enableval],
320               [systemtap=no])
321 if test "x$systemtap" != xno; then
322   AC_CACHE_CHECK([for systemtap static probe support], libc_cv_sdt, [dnl
323   old_CFLAGS="$CFLAGS"
324   CFLAGS="-std=gnu99 $CFLAGS"
325   AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <sys/sdt.h>
326 void foo (int i, void *p)
328   asm ("" STAP_PROBE_ASM (foo, bar, STAP_PROBE_ASM_TEMPLATE (2)) ""
329        :: STAP_PROBE_ASM_OPERANDS (2, i, p));
330 }]])], [libc_cv_sdt=yes], [libc_cv_sdt=no])
331   CFLAGS="$old_CFLAGS"])
332   if test $libc_cv_sdt = yes; then
333     AC_DEFINE([USE_STAP_PROBE])
334   elif test "x$systemtap" != xauto; then
335     AC_MSG_FAILURE([systemtap support needs sys/sdt.h with asm support])
336   fi
339 AC_ARG_ENABLE([build-nscd],
340               [AS_HELP_STRING([--disable-build-nscd],
341                [disable building and installing the nscd daemon])],
342               [build_nscd=$enableval],
343               [build_nscd=default])
344 AC_SUBST(build_nscd)
346 # Note the use of $use_nscd is near the bottom of the file.
347 AC_ARG_ENABLE([nscd],
348               [AS_HELP_STRING([--disable-nscd],
349                [library functions will not contact the nscd daemon])],
350               [use_nscd=$enableval],
351               [use_nscd=yes])
353 AC_ARG_ENABLE([pt_chown],
354               [AS_HELP_STRING([--enable-pt_chown],
355                [Enable building and installing pt_chown])],
356               [build_pt_chown=$enableval],
357               [build_pt_chown=no])
358 AC_SUBST(build_pt_chown)
359 if test "$build_pt_chown" = yes; then
360   AC_DEFINE(HAVE_PT_CHOWN)
363 # The abi-tags file uses a fairly simplistic model for name recognition that
364 # can't distinguish i486-pc-linux-gnu fully from i486-pc-gnu.  So we mutate a
365 # $host_os of `gnu*' here to be `gnu-gnu*' just so that it can tell.
366 # This doesn't get used much beyond that, so it's fairly safe.
367 case "$host_os" in
368 linux*)
369   ;;
370 gnu*)
371   host_os=`echo $host_os | sed -e 's/gnu/gnu-gnu/'`
372   ;;
373 esac
375 # We keep the original values in `$config_*' and never modify them, so we
376 # can write them unchanged into config.make.  Everything else uses
377 # $machine, $vendor, and $os, and changes them whenever convenient.
378 config_machine=$host_cpu config_vendor=$host_vendor config_os=$host_os
380 # Don't allow vendor == "unknown"
381 test "$config_vendor" = unknown && config_vendor=
382 config_os="`echo $config_os | sed 's/^unknown-//'`"
384 # Some configurations imply other options.
385 elf=yes
387 # The configure fragment of an add-on port can modify these to supplement
388 # or override the table in the case statement below.  No fragment should
389 # ever change the config_* variables, however.
390 machine=$config_machine
391 vendor=$config_vendor
392 os=$config_os
393 base_os=''
395 submachine=
396 AC_ARG_WITH([cpu],
397             AS_HELP_STRING([--with-cpu=CPU], [select code for CPU variant]),
398             [dnl
399   case "$withval" in
400   yes|'') AC_MSG_ERROR([--with-cpu requires an argument]) ;;
401   no) ;;
402   *) submachine="$withval" ;;
403   esac
406 dnl Let sysdeps/*/preconfigure act here, like they can in add-ons.
407 LIBC_PRECONFIGURE([$srcdir], [for sysdeps])
409 # An add-on can set this when it wants to disable the sanity check below.
410 libc_config_ok=no
412 dnl Having this here, though empty, makes sure that if add-ons' fragments
413 dnl do AC_CONFIG_SUBDIRS([some-dir]), which just sets $subdirs, then
414 dnl our AC_OUTPUT will actually use it.
415 AC_CONFIG_SUBDIRS()
417 case "$enable_add_ons" in
418 ''|no) add_ons= ;;
419 yes|'*')
420  add_ons=`cd $srcdir && ls -d 2> /dev/null */configure */sysdeps |
421           sed 's@/[[^/]]*$@@' | sort | uniq`
422          add_ons_automatic=yes
423          ;;
424 *) add_ons=`echo "$enable_add_ons" | sed 's/,/ /g'`
425        add_ons_automatic=no ;;
426 esac
428 configured_add_ons=
429 add_ons_sfx=
430 add_ons_pfx=
431 if test x"$add_ons" != x; then
432   for f in $add_ons; do
433     # Some sanity checks
434     case "$f" in
435     crypt)
436       AC_MSG_ERROR([
437 *** It seems that you're using an old \`crypt' add-on.  crypt is now
438 *** part of glibc and using the old add-on will not work with this
439 *** release.  Start again with fresh sources and without the old
440 *** \`crypt' add-on.])
441     ;;
442     localedata)
443       AC_MSG_ERROR([
444 *** It seems that you're using an old \`localedata' add-on.  localedata
445 *** is now part of glibc and using the old add-on will not work with
446 *** this release.  Start again with fresh sources and without the old
447 *** \`localedata' add-on.])
448     ;;
449     esac
450   done
452   # Now source each add-on's configure fragment.
453   # The fragments can use $srcdir/$libc_add_on to find themselves,
454   # and test $add_ons_automatic to see if they were explicitly requested.
455   # A fragment can clear (or even change) $libc_add_on to affect
456   # whether it goes into the list to be actually used in the build.
457   use_add_ons=
458   for libc_add_on in $add_ons; do
459     # Test whether such a directory really exists.
460     # It can be absolute, or relative to $srcdir, or relative to the build dir.
461     case "$libc_add_on" in
462     /*)
463       libc_add_on_srcdir=$libc_add_on
464       ;;
465     *)
466       test -d "$srcdir/$libc_add_on" || {
467         if test -d "$libc_add_on"; then
468           libc_add_on="`pwd`/$libc_add_on"
469         else
470           AC_MSG_ERROR(add-on directory \"$libc_add_on\" does not exist)
471         fi
472       }
473       libc_add_on_srcdir=$srcdir/$libc_add_on
474       ;;
475     esac
477     libc_add_on_frag=$libc_add_on_srcdir/configure
478     libc_add_on_canonical=
479     libc_add_on_config_subdirs=
480     if test -r "$libc_add_on_frag"; then
481       AC_MSG_NOTICE(running configure fragment for add-on $libc_add_on)
482       libc_add_on_canonical=unknown
483       libc_add_on_subdirs=
484       . "$libc_add_on_frag"
485       test -z "$libc_add_on" || {
486         configured_add_ons="$configured_add_ons $libc_add_on"
487         if test "x$libc_add_on_canonical" = xunknown; then
488           AC_MSG_ERROR(fragment must set \$libc_add_on_canonical)
489         fi
490         for d in $libc_add_on_subdirs; do
491           case "$libc_add_on" in
492           /*) subdir_srcdir="$libc_add_on" ;;
493           *) subdir_srcdir="\$(..)$libc_add_on" ;;
494           esac
495           case "$d" in
496           .)
497             d="${libc_add_on_canonical:-$libc_add_on}"
498             ;;
499           /*)
500             subdir_srcdir="$d"
501             ;;
502           *)
503             subdir_srcdir="$subdir_srcdir/$d"
504             ;;
505           esac
506           d=`echo "$d" | sed 's@/*$@@;s@^.*/@@'`
507           add_on_subdirs="$add_on_subdirs $d"
508           test "$subdir_srcdir" = "\$(..)$d" || config_vars="$config_vars
509 $d-srcdir = $subdir_srcdir"
510         done
511         for d in $libc_add_on_config_subdirs; do
512           case "$d" in
513           /*) AC_MSG_ERROR(dnl
514 fragment uses absolute path in \$libc_add_on_config_subdirs) ;;
515           esac
516           if test ! -d "$libc_add_on_srcdir/$d"; then
517             AC_MSG_ERROR(fragment wants to configure missing directory $d)
518           fi
519           case "$libc_add_on" in
520           /*) AC_MSG_ERROR(dnl
521 relative path required for add-on using \$libc_add_on_config_subdirs) ;;
522           esac
523           subdirs="$subdirs $libc_add_on/$d"
524         done
525       }
526     fi
527     if test -n "$libc_add_on"; then
528       LIBC_PRECONFIGURE([$libc_add_on_srcdir], [add-on $libc_add_on for])
529       use_add_ons="$use_add_ons $libc_add_on"
530       add_ons_pfx="$add_ons_pfx $libc_add_on/"
531       test -z "$libc_add_on_canonical" ||
532       add_ons_sfx="$add_ons_sfx /$libc_add_on_canonical"
533     fi
534   done
535   # Use echo to strip excess whitespace.
536   add_ons="`echo $use_add_ons`"
538 AC_SUBST(add_ons)
539 AC_SUBST(add_on_subdirs)
543 ### I put this here to prevent those annoying emails from people who cannot
544 ### read and try to compile glibc on unsupported platforms.  --drepper
546 ### By using the undocumented --enable-hacker-mode option for configure
547 ### one can skip this test to make the configuration not fail for unsupported
548 ### platforms.
550 if test -z "$enable_hacker_mode" && test x"$libc_config_ok" != xyes; then
551   case "$machine-$host_os" in
552   *-linux* | *-gnu*)
553     ;;
554   *)
555     echo "*** The GNU C library is currently not available for this platform."
556     echo "*** So far nobody cared to port it and if there is no volunteer it"
557     echo "*** might never happen.  So, if you have interest to see glibc on"
558     echo "*** this platform visit"
559     echo "***   http://www.gnu.org/software/libc/porting.html"
560     echo "*** and join the group of porters"
561     exit 1
562     ;;
563   esac
566 # Set base_machine if not set by a preconfigure fragment.
567 test -n "$base_machine" || base_machine=$machine
568 AC_SUBST(base_machine)
570 # For the multi-arch option we need support in the assembler & linker.
571 AC_CACHE_CHECK([for assembler and linker STT_GNU_IFUNC support],
572                libc_cv_ld_gnu_indirect_function, [dnl
573 cat > conftest.S <<EOF
574 .type foo,%gnu_indirect_function
575 foo:
576 .globl _start
577 _start:
578 .globl __start
579 __start:
580 .data
581 #ifdef _LP64
582 .quad foo
583 #else
584 .long foo
585 #endif
587 libc_cv_ld_gnu_indirect_function=no
588 if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
589             -nostartfiles -nostdlib \
590             -o conftest conftest.S 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
591   # Do a link to see if the backend supports IFUNC relocs.
592   $READELF -r conftest 1>&AS_MESSAGE_LOG_FD
593   LC_ALL=C $READELF -r conftest | grep 'no relocations' >/dev/null || {
594     libc_cv_ld_gnu_indirect_function=yes
595   }
597 rm -f conftest*])
599 AC_MSG_CHECKING(whether .text pseudo-op must be used)
600 AC_CACHE_VAL(libc_cv_dot_text, [dnl
601 cat > conftest.s <<EOF
602 .text
604 libc_cv_dot_text=
605 if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
606   libc_cv_dot_text=.text
608 rm -f conftest*])
609 if test -z "$libc_cv_dot_text"; then
610   AC_MSG_RESULT(no)
611 else
612   AC_MSG_RESULT(yes)
615 if test x"$libc_cv_ld_gnu_indirect_function" != xyes; then
616   if test x"$multi_arch" = xyes; then
617     AC_MSG_ERROR([--enable-multi-arch support requires assembler and linker support])
618   else
619     multi_arch=no
620   fi
622 multi_arch_d=
623 if test x"$multi_arch" != xno; then
624   multi_arch_d=/multiarch
627 # Compute the list of sysdep directories for this configuration.
628 # This can take a while to compute.
629 sysdep_dir=$srcdir/sysdeps
630 AC_MSG_CHECKING(sysdep dirs)
631 dnl We need to use [ and ] for other purposes for a while now.
632 changequote(,)dnl
633 # Make sco3.2v4 become sco3.2.4 and sunos4.1.1_U1 become sunos4.1.1.U1.
634 os="`echo $os | sed 's/\([0-9A-Z]\)[v_]\([0-9A-Z]\)/\1.\2/g'`"
636 test "x$base_os" != x || case "$os" in
637 gnu*)
638   base_os=mach/hurd ;;
639 linux*)
640   base_os=unix/sysv ;;
641 esac
643 # For sunos4.1.1, try sunos4.1.1, then sunos4.1, then sunos4, then sunos.
644 tail=$os
645 ostry=$os
646 while o=`echo $tail | sed 's/\.[^.]*$//'`; test $o != $tail; do
647   ostry="$ostry /$o"
648   tail=$o
649 done
650 o=`echo $tail | sed 's/[0-9]*$//'`
651 if test $o != $tail; then
652   ostry="$ostry /$o"
654 # For linux-gnu, try linux-gnu, then linux.
655 o=`echo $tail | sed 's/-.*$//'`
656 if test $o != $tail; then
657   ostry="$ostry /$o"
660 # For unix/sysv/sysv4, try unix/sysv/sysv4, then unix/sysv, then unix.
661 base=
662 tail=$base_os
663 while b=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$b"; do
664   set $b
665   base="$base /$1"
666   tail="$2"
667 done
669 # For sparc/sparc32, try sparc/sparc32 and then sparc.
670 mach=
671 tail=$machine${submachine:+/$submachine}
672 while m=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$m"; do
673   set $m
674   # Prepend the machine's FPU directory unless --without-fp.
675   if test "$with_fp" = yes; then
676     maybe_fpu=/fpu
677   else
678     maybe_fpu=/nofpu
679   fi
680   # For each machine term, try it with and then without /multiarch.
681   for try_fpu in $maybe_fpu ''; do
682     for try_multi in $multi_arch_d ''; do
683       mach="$mach /$1$try_fpu$try_multi"
684     done
685   done
686   tail="$2"
687 done
689 dnl We are done with glob and regexp uses of [ and ]; return to autoconf.
690 changequote([,])dnl
692 # Find what sysdep directories exist.
693 sysnames_add_ons=
694 sysnames=
695 for b in $base ''; do
696   for m0 in $mach ''; do
697     for v in /$vendor ''; do
698       test "$v" = / && continue
699       for o in /$ostry ''; do
700         test "$o" = / && continue
701         for m in $mach ''; do
702           for d in $add_ons_pfx ''; do
703             for a in $add_ons_sfx ''; do
704               try_suffix="$m0$b$v$o$m"
705               if test -n "$try_suffix"; then
706                 try_srcdir="${srcdir}/"
707                 case "$d" in
708                 /*) try_srcdir= ;;
709                 esac
710                 try="${d}sysdeps$try_suffix$a"
711                 test -n "$enable_debug_configure" &&
712                 echo "$0 [DEBUG]: try $try" >&2
713                 if test -d "$try_srcdir$try"; then
714                   sysnames="$sysnames $try"
715                   { test -n "$o" || test -n "$b"; } && os_used=t
716                   { test -n "$m" || test -n "$m0"; } && machine_used=t
717                   case x${m0:-$m} in
718                   x*/$submachine) submachine_used=t ;;
719                   esac
720                   if test -n "$d"; then
721                     case "$sysnames_add_ons" in
722                     *" $d "*) ;;
723                     *|'') sysnames_add_ons="$sysnames_add_ons $d" ;;
724                     esac
725                   fi
726                 fi
727               fi
728             done
729           done
730         done
731       done
732     done
733   done
734 done
736 # If the assembler supports gnu_indirect_function symbol type and the
737 # architecture supports multi-arch, we enable multi-arch by default.
738 case $sysnames_add_ons$sysnames in
739 *"$multi_arch_d"*)
740   ;;
742   test x"$multi_arch" = xdefault && multi_arch=no
743   ;;
744 esac
745 if test x"$multi_arch" != xno; then
746   AC_DEFINE(USE_MULTIARCH)
748 AC_SUBST(multi_arch)
750 if test -z "$os_used" && test "$os" != none; then
751   AC_MSG_ERROR(Operating system $os is not supported.)
753 if test -z "$machine_used" && test "$machine" != none; then
754   AC_MSG_ERROR(The $machine is not supported.)
756 if test -z "$submachine_used" && test -n "$submachine"; then
757   AC_MSG_ERROR(The $submachine subspecies of $host_cpu is not supported.)
759 AC_SUBST(submachine)
761 # We have now validated the configuration.
763 # Expand the list of system names into a full list of directories
764 # from each element's parent name and Implies file (if present).
765 set $sysnames
766 names=
767 while test $# -gt 0; do
768   name=$1
769   shift
771   case " $names " in *" $name "*)
772     # Already in the list.
773     continue
774   esac
776   # Report each name as we discover it, so there is no long pause in output.
777   echo $ECHO_N "$name $ECHO_C" >&AS_MESSAGE_FD
779   name_base=`echo $name | sed -e 's@\(.*sysdeps\)/.*@\1@'`
781   case $name in
782     /*) xsrcdir= ;;
783     *)  xsrcdir=$srcdir/ ;;
784   esac
785   test -n "$enable_debug_configure" &&
786   echo "[DEBUG]: name/Implies $xsrcdir$name/Implies" >&2
788   for implies_file in Implies Implies-before Implies-after; do
789     implies_type=`echo $implies_file | sed s/-/_/`
790     eval ${implies_type}=
791     if test -f $xsrcdir$name/$implies_file; then
792       # Collect more names from the `Implies' file (removing comments).
793       implied_candidate="`sed 's/#.*$//' < $xsrcdir$name/$implies_file`"
794       for x in $implied_candidate; do
795         found=no
796         if test -d $xsrcdir$name_base/$x; then
797           eval "${implies_type}=\"\$${implies_type} \$name_base/\$x\""
798           found=yes
799         fi
800         for d in $add_ons_pfx ''; do
801           try="${d}sysdeps/$x"
802           case $d in
803            /*) try_srcdir= ;;
804            *) try_srcdir=$srcdir/ ;;
805           esac
806           test -n "$enable_debug_configure" &&
807            echo "[DEBUG]: $name $implies_file $x try($d) {$try_srcdir}$try" >&2
808           if test $try != $xsrcdir$name_base/$x && test -d $try_srcdir$try;
809           then
810             eval "${implies_type}=\"\$${implies_type} \$try\""
811             found=yes
812             case "$sysnames_add_ons" in
813             *" $d "*) ;;
814             *|'') sysnames_add_ons="$sysnames_add_ons $d" ;;
815             esac
816           fi
817         done
818         if test $found = no; then
819           AC_MSG_WARN($name/$implies_file specifies nonexistent $x)
820         fi
821       done
822     fi
823   done
825   # Add NAME to the list of names.
826   names="$names $name"
828   # Find the parent of NAME, using the empty string if it has none.
829 changequote(,)dnl
830   parent="`echo $name | sed -n -e 's=/[^/]*$==' -e '/sysdeps$/q' -e p`"
831 changequote([,])dnl
833   test -n "$enable_debug_configure" &&
834     echo "[DEBUG]: $name Implies='$Implies' rest='$*' parent='$parent' \
835 Implies_before='$Implies_before' Implies_after='$Implies_after'" >&2
837   # Add the names implied by NAME, and NAME's parent (if it has one), to
838   # the list of names to be processed (the argument list).  We prepend the
839   # implied names to the list and append the parent.  We want implied
840   # directories to come before further directories inferred from the
841   # configuration components; this ensures that for sysv4, unix/common
842   # (implied by unix/sysv/sysv4) comes before unix/sysv (in ostry (here $*)
843   # after sysv4).
844   sysnames="`echo $Implies $* $Implies_before $parent $Implies_after`"
845   test -n "$sysnames" && set $sysnames
846 done
848 # Add the default directories.
849 default_sysnames="sysdeps/generic"
850 sysnames="$names $default_sysnames"
851 AC_SUBST(sysnames)
852 # The other names were emitted during the scan.
853 AC_MSG_RESULT($default_sysnames)
855 # Collect the list of add-ons that supply partial sysdeps trees.
856 sysdeps_add_ons=
857 for add_on in $add_ons; do
858   case "$add_on" in
859   /*) xsrcdir= ;;
860   *) xsrcdir="$srcdir/" ;;
861   esac
863   test -d "$xsrcdir$add_on/sysdeps" || {
864     case "$configured_add_ons " in
865     *" $add_on "*) ;;
866     *|'')
867       AC_MSG_ERROR(add-on $add_on has no configure fragment or sysdeps tree)
868       ;;
869     esac
870     continue
871   }
873   sysdeps_add_ons="$sysdeps_add_ons $add_on"
874   case "$sysnames_add_ons" in
875   *" $add_on/ "*) ;;
876   *|'')
877     AC_MSG_WARN(add-on $add_on contributed no sysdeps directories)
878     continue ;;
879   esac
881   found=no
882   for d in $sysnames; do
883     case "$d" in
884     $add_on/sysdeps/*) ;;
885     *) continue ;;
886     esac
887     (cd "$xsrcdir$d" && for f in *[[!~]]; do
888        case "$f" in
889        sys|bits)
890          for ff in $f/*.h; do
891            test -d "$ff" || { test -e "$ff" && exit 88; }
892          done
893          ;;
894        *)
895          test -d "$f" || { test -e "$f" && exit 88; }
896          ;;
897        esac
898      done)
899     if test $? -eq 88; then
900       found=yes
901       break
902     fi
903   done
904   if test $found = no; then
905     AC_MSG_WARN(add-on $add_on contributed no useful sysdeps directories)
906   fi
907 done
908 AC_SUBST(sysdeps_add_ons)
911 ### Locate tools.
913 AC_PROG_INSTALL
914 if test "$INSTALL" = "${srcdir}/scripts/install-sh -c"; then
915   # The makefiles need to use a different form to find it in $srcdir.
916   INSTALL='\$(..)./scripts/install-sh -c'
918 AC_PROG_LN_S
920 LIBC_PROG_BINUTILS
922 # Accept binutils 2.22 or newer.
923 AC_CHECK_PROG_VER(AS, $AS, --version,
924                   [GNU assembler.* \([0-9]*\.[0-9.]*\)],
925                   [2.1[0-9][0-9]*|2.2[2-9]*|2.[3-9][0-9]*|[3-9].*|[1-9][0-9]*],
926                   AS=: critic_missing="$critic_missing as")
927 AC_CHECK_PROG_VER(LD, $LD, --version,
928                   [GNU ld.* \([0-9][0-9]*\.[0-9.]*\)],
929                   [2.1[0-9][0-9]*|2.2[2-9]*|2.[3-9][0-9]*|[3-9].*|[1-9][0-9]*],
930                   LD=: critic_missing="$critic_missing ld")
932 # These programs are version sensitive.
933 AC_CHECK_TOOL_PREFIX
934 AC_CHECK_PROG_VER(MAKE, gnumake gmake make, --version,
935   [GNU Make[^0-9]*\([0-9][0-9.]*\)],
936   [3.79* | 3.[89]* | [4-9].* | [1-9][0-9]*], critic_missing="$critic_missing make")
938 AC_CHECK_PROG_VER(MSGFMT, gnumsgfmt gmsgfmt msgfmt, --version,
939   [GNU gettext.* \([0-9]*\.[0-9.]*\)],
940   [0.10.3[6-9]* | 0.10.[4-9][0-9]* | 0.1[1-9]* | 0.[2-9][0-9]* | [1-9].*],
941   MSGFMT=: aux_missing="$aux_missing msgfmt")
942 AC_CHECK_PROG_VER(MAKEINFO, makeinfo, --version,
943   [GNU texinfo.* \([0-9][0-9.]*\)],
944   [4.[7-9]*|4.[1-9][0-9]*|[5-9].*],
945   MAKEINFO=: aux_missing="$aux_missing makeinfo")
946 AC_CHECK_PROG_VER(SED, sed, --version,
947   [GNU sed[^0-9]* \([0-9]*\.[0-9.]*\)],
948   [3.0[2-9]*|3.[1-9]*|[4-9]*],
949   SED=: aux_missing="$aux_missing sed")
950 AC_CHECK_PROG_VER(AWK, gawk, --version,
951   [GNU Awk[^0-9]*\([0-9][0-9.]*\)],
952   [3.1.[2-9]*|3.[2-9]*|[4-9]*], critic_missing="$critic_missing gawk")
954 AC_CACHE_CHECK([if $CC is sufficient to build libc], libc_cv_compiler_ok, [
955 AC_TRY_COMPILE([], [
956 #if !defined __GNUC__ || __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6)
957 #error insufficient compiler
958 #endif],
959                [libc_cv_compiler_ok=yes],
960                [libc_cv_compiler_ok=no])])
961 AS_IF([test $libc_cv_compiler_ok != yes],
962       [critic_missing="$critic_missing compiler"])
964 AC_CHECK_TOOL(NM, nm, false)
966 if test "x$maintainer" = "xyes"; then
967   AC_CHECK_PROGS(AUTOCONF, autoconf, no)
968   case "x$AUTOCONF" in
969   xno|x|x:) AUTOCONF=no ;;
970   *)
971     AC_CACHE_CHECK(dnl
972   whether $AUTOCONF${ACFLAGS:+ }$ACFLAGS works, libc_cv_autoconf_works, [dnl
973     if (cd $srcdir; $AUTOCONF $ACFLAGS configure.ac > /dev/null 2>&1); then
974       libc_cv_autoconf_works=yes
975     else
976       libc_cv_autoconf_works=no
977     fi])
978     test $libc_cv_autoconf_works = yes || AUTOCONF=no
979     ;;
980   esac
981   if test "x$AUTOCONF" = xno; then
982     aux_missing="$aux_missing autoconf"
983   fi
984 else
985   AUTOCONF=no
988 test -n "$critic_missing" && AC_MSG_ERROR([
989 *** These critical programs are missing or too old:$critic_missing
990 *** Check the INSTALL file for required versions.])
992 test -n "$aux_missing" && AC_MSG_WARN([
993 *** These auxiliary programs are missing or incompatible versions:$aux_missing
994 *** some features will be disabled.
995 *** Check the INSTALL file for required versions.])
997 # if using special system headers, find out the compiler's sekrit
998 # header directory and add that to the list.  NOTE: Only does the right
999 # thing on a system that doesn't need fixincludes.  (Not presently a problem.)
1000 if test -n "$sysheaders"; then
1001   SYSINCLUDES=-nostdinc
1002   for d in include include-fixed; do
1003     i=`$CC -print-file-name="$d"` && test "x$i" != x && test "x$i" != "x$d" &&
1004     SYSINCLUDES="$SYSINCLUDES -isystem $i"
1005   done
1006   SYSINCLUDES="$SYSINCLUDES \
1007 -isystem `echo $sysheaders | sed 's/:/ -isystem /g'`"
1008   if test -n "$CXX"; then
1009     CXX_SYSINCLUDES=
1010     for cxxheaders in `$CXX -v -S -x c++ /dev/null -o /dev/null 2>&1 \
1011     | sed -n -e '1,/#include/d' -e 's/^ \(\/.*\/[cg]++\)/\1/p'`; do
1012       test "x$cxxheaders" != x &&
1013       CXX_SYSINCLUDES="$CXX_SYSINCLUDES -isystem $cxxheaders"
1014     done
1015   fi
1017 AC_SUBST(SYSINCLUDES)
1018 AC_SUBST(CXX_SYSINCLUDES)
1020 # Test if LD_LIBRARY_PATH contains the notation for the current directory
1021 # since this would lead to problems installing/building glibc.
1022 # LD_LIBRARY_PATH contains the current directory if one of the following
1023 # is true:
1024 # - one of the terminals (":" and ";") is the first or last sign
1025 # - two terminals occur directly after each other
1026 # - the path contains an element with a dot in it
1027 AC_MSG_CHECKING(LD_LIBRARY_PATH variable)
1028 changequote(,)dnl
1029 case ${LD_LIBRARY_PATH} in
1030   [:\;]* | *[:\;] | *[:\;][:\;]* |  *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* )
1031     ld_library_path_setting="contains current directory"
1032     ;;
1033   *)
1034     ld_library_path_setting="ok"
1035     ;;
1036 esac
1037 changequote([,])dnl
1038 AC_MSG_RESULT($ld_library_path_setting)
1039 if test "$ld_library_path_setting" != "ok"; then
1040 AC_MSG_ERROR([
1041 *** LD_LIBRARY_PATH shouldn't contain the current directory when
1042 *** building glibc. Please change the environment variable
1043 *** and run configure again.])
1046 AC_CACHE_CHECK(whether GCC supports -static-libgcc, libc_cv_gcc_static_libgcc, [dnl
1047 if $CC -v -static-libgcc 2>&1 | grep 'unrecognized option.*static-libgcc' >/dev/null; then
1048   libc_cv_gcc_static_libgcc=
1049 else
1050   libc_cv_gcc_static_libgcc=-static-libgcc
1051 fi])
1052 AC_SUBST(libc_cv_gcc_static_libgcc)
1054 AC_PATH_PROG(BASH_SHELL, bash, no)
1056 AC_PATH_PROG(PERL, perl, no)
1057 if test "$PERL" != no &&
1058    (eval `$PERL -V:apiversion`; test `expr "$apiversion" \< 5` -ne 0); then
1059   PERL=no
1061 AC_PATH_PROG(INSTALL_INFO, install-info, no,
1062              $PATH:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin)
1063 AC_CHECK_PROG_VER(BISON, bison, --version,
1064                   [bison (GNU Bison) \([0-9]*\.[0-9.]*\)],
1065                   [2.7*|[3-9].*|[1-9][0-9]*],
1066                   BISON=no)
1068 AC_CACHE_CHECK(for libc-friendly stddef.h, libc_cv_friendly_stddef, [dnl
1069 AC_TRY_COMPILE(dnl
1070 [#define __need_size_t
1071 #define __need_wchar_t
1072 #include <stddef.h>
1073 #define __need_NULL
1074 #include <stddef.h>], [size_t size; wchar_t wchar;
1075 #ifdef offsetof
1076 #error stddef.h ignored __need_*
1077 #endif
1078 if (&size == NULL || &wchar == NULL) abort ();],
1079                libc_cv_friendly_stddef=yes,
1080                libc_cv_friendly_stddef=no)])
1081 if test $libc_cv_friendly_stddef = yes; then
1082   config_vars="$config_vars
1083 override stddef.h = # The installed <stddef.h> seems to be libc-friendly."
1086 AC_CACHE_CHECK(whether we need to use -P to assemble .S files,
1087                libc_cv_need_minus_P, [dnl
1088 cat > conftest.S <<EOF
1089 #include "confdefs.h"
1090 /* Nothing whatsoever.  */
1092 if AC_TRY_COMMAND(${CC-cc} $CPPFLAGS $ASFLAGS -c conftest.S 1>&AS_MESSAGE_LOG_FD); then
1093   libc_cv_need_minus_P=no
1094 else
1095   libc_cv_need_minus_P=yes
1097 rm -f conftest*])
1098 if test $libc_cv_need_minus_P = yes; then
1099   config_vars="$config_vars
1100 asm-CPPFLAGS = -P # The assembler can't grok cpp's # line directives."
1103 AC_CACHE_CHECK(for .set assembler directive, libc_cv_asm_set_directive, [dnl
1104 cat > conftest.s <<EOF
1105 ${libc_cv_dot_text}
1106 foo:
1107 .set glibc_conftest_frobozz,foo
1108 .globl glibc_conftest_frobozz
1110 # The alpha-dec-osf1 assembler gives only a warning for `.set'
1111 # (but it doesn't work), so we must do a linking check to be sure.
1112 cat > conftest1.c <<\EOF
1113 extern int glibc_conftest_frobozz;
1114 void _start() { glibc_conftest_frobozz = 1; }
1116 if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
1117             -nostartfiles -nostdlib \
1118             -o conftest conftest.s conftest1.c 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
1119   libc_cv_asm_set_directive=yes
1120 else
1121   libc_cv_asm_set_directive=no
1123 rm -f conftest*])
1124 if test $libc_cv_asm_set_directive = yes; then
1125   AC_DEFINE(HAVE_ASM_SET_DIRECTIVE)
1128 AC_CACHE_CHECK(for assembler gnu_unique_object symbol type,
1129                libc_cv_asm_unique_object, [dnl
1130 cat > conftest.s <<EOF
1131 ${libc_cv_dot_text}
1132 _sym:
1133 .type _sym, %gnu_unique_object
1135 if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
1136   libc_cv_asm_unique_object=yes
1137 else
1138   libc_cv_asm_unique_object=no
1140 rm -f conftest*])
1141 if test $libc_cv_asm_unique_object = yes; then
1142   AC_DEFINE(HAVE_ASM_UNIQUE_OBJECT)
1145 AC_CACHE_CHECK(for .previous assembler directive,
1146                libc_cv_asm_previous_directive, [dnl
1147 cat > conftest.s <<EOF
1148 .section foo_section
1149 .previous
1151 if AC_TRY_COMMAND(${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
1152   libc_cv_asm_previous_directive=yes
1153 else
1154   libc_cv_asm_previous_directive=no
1156 rm -f conftest*])
1157 if test $libc_cv_asm_previous_directive = yes; then
1158   AC_DEFINE(HAVE_ASM_PREVIOUS_DIRECTIVE)
1159 else
1160   AC_CACHE_CHECK(for .popsection assembler directive,
1161                  libc_cv_asm_popsection_directive, [dnl
1162   cat > conftest.s <<EOF
1163 .pushsection foo_section
1164 .popsection
1166   if AC_TRY_COMMAND(${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
1167     libc_cv_asm_popsection_directive=yes
1168   else
1169     libc_cv_asm_popsection_directive=no
1170   fi
1171   rm -f conftest*])
1172   if test $libc_cv_asm_popsection_directive = yes; then
1173     AC_DEFINE(HAVE_ASM_POPSECTION_DIRECTIVE)
1174   fi
1176 AC_CACHE_CHECK(for .protected and .hidden assembler directive,
1177                libc_cv_asm_protected_directive, [dnl
1178 cat > conftest.s <<EOF
1179 .protected foo
1180 foo:
1181 .hidden bar
1182 bar:
1184 if AC_TRY_COMMAND(${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
1185   libc_cv_asm_protected_directive=yes
1186 else
1187   AC_MSG_ERROR(assembler support for symbol visibility is required)
1189 rm -f conftest*])
1191 if test $libc_cv_asm_protected_directive = yes; then
1192   AC_CACHE_CHECK(whether __attribute__((visibility())) is supported,
1193                  libc_cv_visibility_attribute,
1194                  [cat > conftest.c <<EOF
1195                   int foo __attribute__ ((visibility ("hidden"))) = 1;
1196                   int bar __attribute__ ((visibility ("protected"))) = 1;
1198                   libc_cv_visibility_attribute=no
1199                   if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
1200                     if grep '\.hidden.*foo' conftest.s >/dev/null; then
1201                       if grep '\.protected.*bar' conftest.s >/dev/null; then
1202                         libc_cv_visibility_attribute=yes
1203                       fi
1204                     fi
1205                   fi
1206                   rm -f conftest.{c,s}
1207                  ])
1208   if test $libc_cv_visibility_attribute != yes; then
1209     AC_MSG_ERROR(compiler support for visibility attribute is required)
1210   fi
1213 if test $libc_cv_visibility_attribute = yes; then
1214   AC_CACHE_CHECK(for broken __attribute__((visibility())),
1215                  libc_cv_broken_visibility_attribute,
1216                  [cat > conftest.c <<EOF
1217                   int foo (int x);
1218                   int bar (int x) __asm__ ("foo") __attribute__ ((visibility ("hidden")));
1219                   int bar (int x) { return x; }
1221                   libc_cv_broken_visibility_attribute=yes
1222                   if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
1223 changequote(,)dnl
1224                     if grep '\.hidden[  _]foo' conftest.s >/dev/null; then
1225 changequote([,])dnl
1226                       libc_cv_broken_visibility_attribute=no
1227                     fi
1228                   fi
1229                   rm -f conftest.c conftest.s
1230                  ])
1231   if test $libc_cv_broken_visibility_attribute = yes; then
1232     AC_MSG_ERROR(working compiler support for visibility attribute is required)
1233   fi
1236 AC_CACHE_CHECK(for broken __attribute__((alias())),
1237                libc_cv_broken_alias_attribute,
1238                [cat > conftest.c <<EOF
1239                extern int foo (int x) __asm ("xyzzy");
1240                int bar (int x) { return x; }
1241                extern __typeof (bar) foo __attribute ((weak, alias ("bar")));
1242                extern int dfoo;
1243                extern __typeof (dfoo) dfoo __asm ("abccb");
1244                int dfoo = 1;
1246                libc_cv_broken_alias_attribute=yes
1247                if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
1248                  if grep 'xyzzy' conftest.s >/dev/null &&
1249                     grep 'abccb' conftest.s >/dev/null; then
1250                    libc_cv_broken_alias_attribute=no
1251                  fi
1252                fi
1253                rm -f conftest.c conftest.s
1254                ])
1255 if test $libc_cv_broken_alias_attribute = yes; then
1256   AC_MSG_ERROR(working alias attribute support required)
1259 if test $libc_cv_visibility_attribute = yes; then
1260   AC_CACHE_CHECK(whether to put _rtld_local into .sdata section,
1261                  libc_cv_have_sdata_section,
1262                  [echo "int i;" > conftest.c
1263                   libc_cv_have_sdata_section=no
1264                   if ${CC-cc} $LDFLAGS -fPIC -shared -Wl,--verbose conftest.c -o conftest.so 2>&1 \
1265                      | grep '\.sdata' >/dev/null; then
1266                     libc_cv_have_sdata_section=yes
1267                   fi
1268                   rm -f conftest.c conftest.so
1269                  ])
1270   if test $libc_cv_have_sdata_section = yes; then
1271     AC_DEFINE(HAVE_SDATA_SECTION)
1272   fi
1275 AC_CACHE_CHECK(for .preinit_array/.init_array/.fini_array support,
1276                libc_cv_initfini_array, [dnl
1277 LIBC_TRY_LINK_STATIC([
1278 int foo (void) { return 1; }
1279 int (*fp) (void) __attribute__ ((section (".init_array"))) = foo;
1281   [if $READELF -S conftest | fgrep INIT_ARRAY > /dev/null; then
1282     libc_cv_initfini_array=yes
1283   else
1284     libc_cv_initfini_array=no
1285   fi],
1286   [libc_cv_initfini_array=no])
1288 if test $libc_cv_initfini_array != yes; then
1289   AC_MSG_ERROR([Need linker with .init_array/.fini_array support.])
1292 AC_CACHE_CHECK(whether to use .ctors/.dtors header and trailer,
1293                libc_cv_ctors_header, [dnl
1294   libc_cv_ctors_header=yes
1295   LIBC_TRY_LINK_STATIC([
1296 __attribute__ ((constructor)) void ctor (void) { asm (""); }
1297 __attribute__ ((destructor))  void dtor (void) { asm (""); }
1299               [dnl
1300       AS_IF([$READELF -WS conftest$ac_exeext | $AWK '
1301         { gsub(/\@<:@ */, "@<:@") }
1302         $2 == ".ctors" || $2 == ".dtors" {
1303           size = strtonum("0x" $6)
1304           align = strtonum("0x" $NF)
1305           seen@<:@$2@:>@ = 1
1306           stub@<:@$2@:>@ = size == align * 2
1307         }
1308         END {
1309           ctors_ok = !seen@<:@".ctors"@:>@ || stub@<:@".ctors"@:>@
1310           dtors_ok = !seen@<:@".dtors"@:>@ || stub@<:@".dtors"@:>@
1311           exit ((ctors_ok && dtors_ok) ? 0 : 1)
1312         }
1313       '], [libc_cv_ctors_header=no])
1314     ], [dnl
1315       AC_MSG_ERROR([missing __attribute__ ((constructor)) support??])
1316     ])
1318 if test $libc_cv_ctors_header = no; then
1319   AC_DEFINE(NO_CTORS_DTORS_SECTIONS)
1322 AC_CACHE_CHECK(for libunwind-support in compiler,
1323                libc_cv_cc_with_libunwind, [
1324   cat > conftest.c <<EOF
1325 int main (void) { return 0; }
1327   if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -static -o conftest \
1328      conftest.c -v 2>&1 >/dev/null | grep ' -lunwind ' >/dev/null; then
1329     libc_cv_cc_with_libunwind=yes
1330   else
1331     libc_cv_cc_with_libunwind=no
1332   fi
1333   rm -f conftest*])
1334 AC_SUBST(libc_cv_cc_with_libunwind)
1335 if test $libc_cv_cc_with_libunwind = yes; then
1336   AC_DEFINE(HAVE_CC_WITH_LIBUNWIND)
1339 LIBC_LINKER_FEATURE([-z nodelete], [-Wl,--enable-new-dtags,-z,nodelete],
1340                     [libc_cv_z_nodelete=yes],
1341                     [AC_MSG_ERROR(linker with -z nodelete support required)])
1343 LIBC_LINKER_FEATURE([-z nodlopen], [-Wl,--enable-new-dtags,-z,nodlopen],
1344                     [libc_cv_z_nodlopen=yes],
1345                     [AC_MSG_ERROR(linker with -z nodlopen support required)])
1347 LIBC_LINKER_FEATURE([-z initfirst], [-Wl,--enable-new-dtags,-z,initfirst],
1348                     [libc_cv_z_initfirst=yes],
1349                     [AC_MSG_ERROR(linker with -z initfirst support required)])
1351 AC_CACHE_CHECK(for -Bgroup option,
1352                libc_cv_Bgroup, [dnl
1353 cat > conftest.c <<EOF
1354 int _start (void) { return 42; }
1356 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1357                             -fPIC -shared -o conftest.so conftest.c
1358                             -Wl,-Bgroup -nostdlib 1>&AS_MESSAGE_LOG_FD])
1359 then
1360   libc_cv_Bgroup=yes
1361 else
1362   libc_cv_Bgroup=no
1364 rm -f conftest*])
1365 AC_SUBST(libc_cv_Bgroup)
1367 ASFLAGS_config=
1368 AC_CACHE_CHECK(whether --noexecstack is desirable for .S files,
1369                libc_cv_as_noexecstack, [dnl
1370 cat > conftest.c <<EOF
1371 void foo (void) { }
1373 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS
1374                    -S -o conftest.s conftest.c 1>&AS_MESSAGE_LOG_FD]) \
1375    && grep .note.GNU-stack conftest.s >/dev/null \
1376    && AC_TRY_COMMAND([${CC-cc} $ASFLAGS -Wa,--noexecstack
1377                       -c -o conftest.o conftest.s 1>&AS_MESSAGE_LOG_FD])
1378 then
1379   libc_cv_as_noexecstack=yes
1380 else
1381   libc_cv_as_noexecstack=no
1383 rm -f conftest*])
1384 if test $libc_cv_as_noexecstack = yes; then
1385   ASFLAGS_config="$ASFLAGS_config -Wa,--noexecstack"
1387 AC_SUBST(ASFLAGS_config)
1389 AC_CACHE_CHECK(for -z combreloc,
1390                libc_cv_z_combreloc, [dnl
1391 cat > conftest.c <<EOF
1392 extern int bar (int);
1393 extern int mumble;
1394 int foo (void) { return bar (mumble); }
1396 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1397                         -fPIC -shared -o conftest.so conftest.c
1398                         -nostdlib -nostartfiles
1399                         -Wl,-z,combreloc 1>&AS_MESSAGE_LOG_FD])
1400 then
1401 dnl The following test is a bit weak.  We must use a tool which can test
1402 dnl cross-platform since the gcc used can be a cross compiler.  Without
1403 dnl introducing new options this is not easily doable.  Instead use a tool
1404 dnl which always is cross-platform: readelf.  To detect whether -z combreloc
1405 dnl look for a section named .rel.dyn.
1406   if $READELF -S conftest.so | grep '\.rel\(a\|\)\.dyn' > /dev/null; then
1407     libc_cv_z_combreloc=yes
1408   else
1409     libc_cv_z_combreloc=no
1410   fi
1411 else
1412   libc_cv_z_combreloc=no
1414 rm -f conftest*])
1415 if test "$libc_cv_z_combreloc" = yes; then
1416   AC_DEFINE(HAVE_Z_COMBRELOC)
1418 AC_SUBST(libc_cv_z_combreloc)
1420 LIBC_LINKER_FEATURE([-z execstack], [-Wl,-z,execstack],
1421                     [libc_cv_z_execstack=yes], [libc_cv_z_execstack=no])
1422 AC_SUBST(libc_cv_z_execstack)
1424 AC_CACHE_CHECK(for -fpie, libc_cv_fpie, [dnl
1425 LIBC_TRY_CC_OPTION([-fpie], [libc_cv_fpie=yes], [libc_cv_fpie=no])
1428 AC_SUBST(libc_cv_fpie)
1430 AC_CACHE_CHECK(for --hash-style option,
1431                libc_cv_hashstyle, [dnl
1432 cat > conftest.c <<EOF
1433 int _start (void) { return 42; }
1435 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1436                             -fPIC -shared -o conftest.so conftest.c
1437                             -Wl,--hash-style=both -nostdlib 1>&AS_MESSAGE_LOG_FD])
1438 then
1439   libc_cv_hashstyle=yes
1440 else
1441   libc_cv_hashstyle=no
1443 rm -f conftest*])
1444 AC_SUBST(libc_cv_hashstyle)
1446 # The linker's default -shared behavior is good enough if it
1447 # does these things that our custom linker scripts ensure that
1448 # all allocated NOTE sections come first.
1449 if test "$use_default_link" = default; then
1450   AC_CACHE_CHECK([for sufficient default -shared layout],
1451                   libc_cv_use_default_link, [dnl
1452   libc_cv_use_default_link=no
1453   cat > conftest.s <<\EOF
1454           .section .note.a,"a",%note
1455           .balign 4
1456           .long 4,4,9
1457           .string "GNU"
1458           .string "foo"
1459           .section .note.b,"a",%note
1460           .balign 4
1461           .long 4,4,9
1462           .string "GNU"
1463           .string "bar"
1465   if AC_TRY_COMMAND([dnl
1466   ${CC-cc} $ASFLAGS -shared -o conftest.so conftest.s 1>&AS_MESSAGE_LOG_FD]) &&
1467        ac_try=`$READELF -S conftest.so | sed -n \
1468          ['${x;p;}
1469           s/^ *\[ *[1-9][0-9]*\]  *\([^ ][^ ]*\)  *\([^ ][^ ]*\) .*$/\2 \1/
1470           t a
1471           b
1472           : a
1473           H']`
1474   then
1475     libc_seen_a=no libc_seen_b=no
1476     set -- $ac_try
1477     while test $# -ge 2 -a "$1" = NOTE; do
1478       case "$2" in
1479       .note.a) libc_seen_a=yes ;;
1480       .note.b) libc_seen_b=yes ;;
1481       esac
1482       shift 2
1483     done
1484     case "$libc_seen_a$libc_seen_b" in
1485     yesyes)
1486       libc_cv_use_default_link=yes
1487       ;;
1488     *)
1489       echo >&AS_MESSAGE_LOG_FD "\
1490 $libc_seen_a$libc_seen_b from:
1491 $ac_try"
1492       ;;
1493     esac
1494   fi
1495   rm -f conftest*])
1496   use_default_link=$libc_cv_use_default_link
1499 AC_CACHE_CHECK(linker output format, libc_cv_output_format, [dnl
1500 if libc_cv_output_format=`
1501 ${CC-cc} -nostartfiles -nostdlib -Wl,--print-output-format 2>&AS_MESSAGE_LOG_FD`
1502 then
1503   :
1504 else
1505   libc_cv_output_format=
1507 test -n "$libc_cv_output_format" || libc_cv_output_format=unknown])
1508 AC_SUBST(libc_cv_output_format)
1510 AC_CACHE_CHECK(for -fno-toplevel-reorder -fno-section-anchors, libc_cv_fno_toplevel_reorder, [dnl
1511 cat > conftest.c <<EOF
1512 int foo;
1514 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -fno-toplevel-reorder -fno-section-anchors
1515                             conftest.c 1>&AS_MESSAGE_LOG_FD])
1516 then
1517   libc_cv_fno_toplevel_reorder=yes
1518 else
1519   libc_cv_fno_toplevel_reorder=no
1521 rm -f conftest*])
1522 if test $libc_cv_fno_toplevel_reorder = yes; then
1523   fno_unit_at_a_time="-fno-toplevel-reorder -fno-section-anchors"
1524 else
1525   fno_unit_at_a_time=-fno-unit-at-a-time
1527 AC_SUBST(fno_unit_at_a_time)
1529 AC_CACHE_CHECK(for -fstack-protector, libc_cv_ssp, [dnl
1530 LIBC_TRY_CC_OPTION([$CFLAGS $CPPFLAGS -Werror -fstack-protector],
1531                    [libc_cv_ssp=yes],
1532                    [libc_cv_ssp=no])
1534 AC_SUBST(libc_cv_ssp)
1536 AC_CACHE_CHECK(for -fgnu89-inline, libc_cv_gnu89_inline, [dnl
1537 cat > conftest.c <<EOF
1538 int foo;
1539 #ifdef __GNUC_GNU_INLINE__
1540 main () { return 0;}
1541 #else
1542 #error
1543 #endif
1545 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -std=gnu99 -fgnu89-inline
1546                             -o conftest.s conftest.c 1>&AS_MESSAGE_LOG_FD])
1547 then
1548   libc_cv_gnu89_inline=yes
1549 else
1550   libc_cv_gnu89_inline=no
1552 rm -f conftest*])
1553 if test $libc_cv_gnu89_inline = yes; then
1554   gnu89_inline=-fgnu89-inline
1555 else
1556   gnu89_inline=
1558 AC_SUBST(gnu89_inline)
1560 AC_CACHE_CHECK(whether cc puts quotes around section names,
1561                libc_cv_have_section_quotes,
1562                [cat > conftest.c <<EOF
1563                 static const int foo
1564                 __attribute__ ((section ("bar"))) = 1;
1566                 if ${CC-cc} -S conftest.c -o conftest.s; then
1567                   if grep '\.section.*"bar"' conftest.s >/dev/null; then
1568                     libc_cv_have_section_quotes=yes
1569                   else
1570                     libc_cv_have_section_quotes=no
1571                   fi
1572                 else
1573                   libc_cv_have_section_quotes=unknown
1574                 fi
1575                 rm -f conftest.{c,s}
1576                 ])
1577 if test $libc_cv_have_section_quotes = yes; then
1578   AC_DEFINE(HAVE_SECTION_QUOTES)
1581 AC_CACHE_CHECK(for assembler .weak directive, libc_cv_asm_weak_directive,
1582                [dnl
1583 cat > conftest.s <<EOF
1584 ${libc_cv_dot_text}
1585 .globl foo
1586 foo:
1587 .weak foo
1588 .weak bar; bar = foo
1590 if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
1591   libc_cv_asm_weak_directive=yes
1592 else
1593   libc_cv_asm_weak_directive=no
1595 rm -f conftest*])
1597 if test $libc_cv_asm_weak_directive = no; then
1598   AC_CACHE_CHECK(for assembler .weakext directive,
1599                  libc_cv_asm_weakext_directive,
1600                  [dnl
1601 cat > conftest.s <<EOF
1602 ${libc_cv_dot_text}
1603 .globl foo
1604 foo:
1605 .weakext bar foo
1606 .weakext baz
1607 .globl baz
1608 baz:
1610   if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
1611     libc_cv_asm_weakext_directive=yes
1612   else
1613     libc_cv_asm_weakext_directive=no
1614   fi
1615   rm -f conftest*])
1617 fi # no .weak
1619 if test $libc_cv_asm_weak_directive = yes; then
1620   AC_DEFINE(HAVE_ASM_WEAK_DIRECTIVE)
1621 elif test $libc_cv_asm_weakext_directive = yes; then
1622   AC_DEFINE(HAVE_ASM_WEAKEXT_DIRECTIVE)
1625 AC_CACHE_CHECK(for ld --no-whole-archive, libc_cv_ld_no_whole_archive, [dnl
1626 cat > conftest.c <<\EOF
1627 _start () {}
1628 int __eh_pc;
1629 __throw () {}
1631 dnl No \ in command here because it ends up inside ''.
1632 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1633                             -nostdlib -nostartfiles -Wl,--no-whole-archive
1634                             -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD]); then
1635   libc_cv_ld_no_whole_archive=yes
1636 else
1637   libc_cv_ld_no_whole_archive=no
1639 rm -f conftest*])
1640 if test $libc_cv_ld_no_whole_archive = no; then
1641   AC_MSG_ERROR([support for --no-whole-archive is needed])
1644 AC_CACHE_CHECK(for gcc -fexceptions, libc_cv_gcc_exceptions, [dnl
1645 cat > conftest.c <<\EOF
1646 _start () {}
1647 int __eh_pc;
1648 __throw () {}
1650 dnl No \ in command here because it ends up inside ''.
1651 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1652                             -nostdlib -nostartfiles -fexceptions
1653                             -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD]); then
1654   libc_cv_gcc_exceptions=yes
1655 else
1656   libc_cv_gcc_exceptions=no
1658 rm -f conftest*])
1659 if test $libc_cv_gcc_exceptions = yes; then
1660   exceptions=-fexceptions
1662 AC_SUBST(exceptions)dnl
1664 AC_CACHE_CHECK(for __builtin_memset, libc_cv_gcc_builtin_memset, [dnl
1665 cat > conftest.c <<\EOF
1666 void zero (void *x)
1668   __builtin_memset (x, 0, 1000);
1672 if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | fgrep "memset" > /dev/null]);
1673 then
1674   libc_cv_gcc_builtin_memset=no
1675 else
1676   libc_cv_gcc_builtin_memset=yes
1678 rm -f conftest* ])
1679 if test "$libc_cv_gcc_builtin_memset" = yes ; then
1680   AC_DEFINE(HAVE_BUILTIN_MEMSET)
1683 AC_CACHE_CHECK(for redirection of built-in functions, libc_cv_gcc_builtin_redirection, [dnl
1684 cat > conftest.c <<\EOF
1685 extern char *strstr (const char *, const char *) __asm ("my_strstr");
1686 char *foo (const char *a, const char *b)
1688   return __builtin_strstr (a, b);
1692 if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | fgrep "my_strstr" > /dev/null]);
1693 then
1694   libc_cv_gcc_builtin_redirection=yes
1695 else
1696   libc_cv_gcc_builtin_redirection=no
1698 rm -f conftest* ])
1699 if test "$libc_cv_gcc_builtin_redirection" = no; then
1700   AC_MSG_ERROR([support for the symbol redirection needed])
1703 dnl Check whether the compiler supports the __thread keyword.
1704 AC_CACHE_CHECK([for __thread], libc_cv_gcc___thread,
1705 [cat > conftest.c <<\EOF
1706 __thread int a = 42;
1708 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c >&AS_MESSAGE_LOG_FD]); then
1709   libc_cv_gcc___thread=yes
1710 else
1711   libc_cv_gcc___thread=no
1713 rm -f conftest*])
1714 if test "$libc_cv_gcc___thread" = no; then
1715   AC_MSG_ERROR([support for the __thread keyword is required])
1718 dnl Check whether the compiler supports the tls_model attribute.
1719 AC_CACHE_CHECK([for tls_model attribute], libc_cv_gcc_tls_model_attr, [dnl
1720 cat > conftest.c <<\EOF
1721 extern __thread int a __attribute__((tls_model ("initial-exec")));
1723 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -Werror conftest.c >&AS_MESSAGE_LOG_FD]); then
1724   libc_cv_gcc_tls_model_attr=yes
1725 else
1726   libc_cv_gcc_tls_model_attr=no
1728 rm -f conftest*])
1729 if test "$libc_cv_gcc_tls_model_attr" = no; then
1730   AC_MSG_ERROR([support for the tls_model attribute is required])
1733 dnl Determine how to disable generation of FMA instructions.
1734 AC_CACHE_CHECK([for compiler option to disable generation of FMA instructions],
1735                libc_cv_cc_nofma, [dnl
1736 libc_cv_cc_nofma=
1737 for opt in -ffp-contract=off -mno-fused-madd; do
1738   LIBC_TRY_CC_OPTION([$opt], [libc_cv_cc_nofma=$opt; break])
1739 done])
1740 AC_SUBST(libc_cv_cc_nofma)
1742 if test -n "$submachine"; then
1743   AC_CACHE_CHECK([for compiler option for CPU variant],
1744                  libc_cv_cc_submachine, [dnl
1745   libc_cv_cc_submachine=no
1746   for opt in "-march=$submachine" "-mcpu=$submachine"; do
1747     LIBC_TRY_CC_OPTION([$opt], [
1748       libc_cv_cc_submachine="$opt"
1749       break], [])
1750   done])
1751   if test "x$libc_cv_cc_submachine" = xno; then
1752     AC_MSG_ERROR([${CC-cc} does not support $submachine])
1753   fi
1755 AC_SUBST(libc_cv_cc_submachine)
1757 AC_CACHE_CHECK(if $CC accepts -fno-tree-loop-distribute-patterns with \
1758 __attribute__ ((__optimize__)), libc_cv_cc_loop_to_function, [dnl
1759 cat > conftest.c <<EOF
1760 void
1761 __attribute__ ((__optimize__ ("-fno-tree-loop-distribute-patterns")))
1762 foo (void) {}
1764 libc_cv_cc_loop_to_function=no
1765 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c])
1766 then
1767   libc_cv_cc_loop_to_function=yes
1769 rm -f conftest*])
1770 if test $libc_cv_cc_loop_to_function = yes; then
1771   AC_DEFINE(HAVE_CC_INHIBIT_LOOP_TO_LIBCALL)
1773 AC_SUBST(libc_cv_cc_loop_to_function)
1775 dnl Check whether we have the gd library available.
1776 AC_MSG_CHECKING(for libgd)
1777 if test "$with_gd" != "no"; then
1778   old_CFLAGS="$CFLAGS"
1779   CFLAGS="$CFLAGS $libgd_include"
1780   old_LDFLAGS="$LDFLAGS"
1781   LDFLAGS="$LDFLAGS $libgd_ldflags"
1782   old_LIBS="$LIBS"
1783   LIBS="$LIBS -lgd -lpng -lz -lm"
1784   AC_TRY_LINK([#include <gd.h>], [gdImagePng (0, 0)], LIBGD=yes, LIBGD=no)
1785   CFLAGS="$old_CFLAGS"
1786   LDFLAGS="$old_LDFLAGS"
1787   LIBS="$old_LIBS"
1788 else
1789   LIBGD=no
1791 AC_MSG_RESULT($LIBGD)
1792 AC_SUBST(LIBGD)
1794 # SELinux detection
1795 if test x$with_selinux = xno ; then
1796   have_selinux=no;
1797 else
1798   # See if we have the SELinux library
1799   AC_CHECK_LIB(selinux, is_selinux_enabled,
1800                have_selinux=yes, have_selinux=no)
1801   if test x$with_selinux = xyes ; then
1802     if test x$have_selinux = xno ; then
1803       AC_MSG_ERROR([SELinux explicitly required, but SELinux library not found])
1804     fi
1805   fi
1807 # Check if we're building with SELinux support.
1808 if test "x$have_selinux" = xyes; then
1809   AC_DEFINE(HAVE_SELINUX, 1, [SELinux support])
1811   # See if we have the libaudit library
1812   AC_CHECK_LIB(audit, audit_log_user_avc_message,
1813                have_libaudit=yes, have_libaudit=no)
1814   if test "x$have_libaudit" = xyes; then
1815     AC_DEFINE(HAVE_LIBAUDIT, 1, [SELinux libaudit support])
1816   fi
1817   AC_SUBST(have_libaudit)
1819   # See if we have the libcap library
1820   AC_CHECK_LIB(cap, cap_init, have_libcap=yes, have_libcap=no)
1821   if test "x$have_libcap" = xyes; then
1822     AC_DEFINE(HAVE_LIBCAP, 1, [SELinux libcap support])
1823   fi
1824   AC_SUBST(have_libcap)
1826 AC_SUBST(have_selinux)
1828 dnl check for the size of 'long double'.
1829 AC_CHECK_SIZEOF(long double, 0)
1830 sizeof_long_double=$ac_cv_sizeof_long_double
1831 AC_SUBST(sizeof_long_double)
1833 CPPUNDEFS=
1834 dnl Check for silly hacked compilers predefining _FORTIFY_SOURCE.
1835 dnl Since we are building the implementations of the fortified functions here,
1836 dnl having the macro defined interacts very badly.
1837 AC_CACHE_CHECK([for _FORTIFY_SOURCE predefine], libc_cv_predef_fortify_source,
1838 [AC_TRY_COMPILE([], [
1839 #ifdef _FORTIFY_SOURCE
1840 # error bogon
1841 #endif],
1842                 [libc_cv_predef_fortify_source=no],
1843                 [libc_cv_predef_fortify_source=yes])])
1844 if test $libc_cv_predef_fortify_source = yes; then
1845   CPPUNDEFS="${CPPUNDEFS:+$CPPUNDEFS }-U_FORTIFY_SOURCE"
1847 AC_SUBST(CPPUNDEFS)
1849 dnl Check for silly hacked compilers inserting -fstack-protector.
1850 dnl This breaks badly for the early startup code we compile, since
1851 dnl the compiled code can refer to a magic machine-dependent location
1852 dnl for the canary value before we have sufficient setup for that to
1853 dnl work.  It's also questionable to build all of libc with this flag
1854 dnl even when you're doing that for most applications you build, since
1855 dnl libc's code is so heavily-used and performance-sensitive.  If we
1856 dnl ever really want to make that work, it should be enabled explicitly
1857 dnl in the libc build, not inherited from implicit compiler settings.
1858 AC_CACHE_CHECK([whether $CC implicitly enables -fstack-protector],
1859                libc_cv_predef_stack_protector, [
1860 AC_TRY_COMPILE([extern void foobar (char *);],
1861                [char large_array[2048]; foobar (large_array);], [
1862 libc_undefs=`$NM -u conftest.o |
1863   LC_ALL=C $AWK '$1 == "U" { print $2 | "sort -u"; next } { exit(1) }' \
1864     2>&AS_MESSAGE_LOG_FD` || {
1865   AC_MSG_ERROR([confusing output from $NM -u])
1867 echo >&AS_MESSAGE_LOG_FD "libc_undefs='$libc_undefs'"
1868 # On some architectures, there are architecture-specific undefined
1869 # symbols (resolved by the linker), so filter out unknown symbols.
1870 # This will fail to produce the correct result if the compiler
1871 # defaults to -fstack-protector but this produces an undefined symbol
1872 # other than __stack_chk_fail.  However, compilers like that have not
1873 # been encountered in practice.
1874 libc_undefs=`echo "$libc_undefs" | egrep '^(foobar|__stack_chk_fail)$'`
1875 case "$libc_undefs" in
1876 foobar) libc_cv_predef_stack_protector=no ;;
1877 '__stack_chk_fail
1878 foobar') libc_cv_predef_stack_protector=yes ;;
1879 *) AC_MSG_ERROR([unexpected symbols in test: $libc_undefs]) ;;
1880 esac],
1881                [AC_MSG_ERROR([test compilation failed])])
1883 libc_extra_cflags=
1884 if test $libc_cv_predef_stack_protector = yes; then
1885   libc_extra_cflags="$libc_extra_cflags -fno-stack-protector"
1887 libc_extra_cppflags=
1889 # Some linkers on some architectures support __ehdr_start but with
1890 # bugs.  Make sure usage of it does not create relocations in the
1891 # output (as the linker should resolve them all for us).
1892 AC_CACHE_CHECK([whether the linker provides working __ehdr_start],
1893                libc_cv_ehdr_start, [
1894 old_CFLAGS="$CFLAGS"
1895 old_LDFLAGS="$LDFLAGS"
1896 old_LIBS="$LIBS"
1897 CFLAGS="$CFLAGS -fPIC"
1898 LDFLAGS="$LDFLAGS -nostdlib -nostartfiles -shared"
1899 LIBS=
1900 AC_LINK_IFELSE([AC_LANG_SOURCE([
1901 typedef struct {
1902   char foo;
1903   long val;
1904 } Ehdr;
1905 extern const Ehdr __ehdr_start __attribute__ ((visibility ("hidden")));
1906 long ehdr (void) { return __ehdr_start.val; }
1907 ])],
1908                [if $READELF -r conftest | fgrep __ehdr_start >/dev/null; then
1909                   libc_cv_ehdr_start=broken
1910                 else
1911                   libc_cv_ehdr_start=yes
1912                 fi], [libc_cv_ehdr_start=no])
1913 CFLAGS="$old_CFLAGS"
1914 LDFLAGS="$old_LDFLAGS"
1915 LIBS="$old_LIBS"
1917 if test "$libc_cv_ehdr_start" = yes; then
1918   AC_DEFINE([HAVE_EHDR_START])
1919 elif test "$libc_cv_ehdr_start" = broken; then
1920   AC_MSG_WARN([linker is broken -- you should upgrade])
1923 AC_CACHE_CHECK(for __builtin_trap with no external dependencies,
1924                libc_cv_builtin_trap, [dnl
1925 libc_cv_builtin_trap=no
1926 AC_TRY_COMPILE([], [__builtin_trap ()], [
1927 libc_undefs=`$NM -u conftest.o |
1928   LC_ALL=C $AWK '$1 == "U" { print $2 | "sort -u"; next } { exit(1) }' \
1929     2>&AS_MESSAGE_LOG_FD` || {
1930   AC_MSG_ERROR([confusing output from $NM -u])
1932 echo >&AS_MESSAGE_LOG_FD "libc_undefs='$libc_undefs'"
1933 if test -z "$libc_undefs"; then
1934   libc_cv_builtin_trap=yes
1935 fi])])
1936 if test $libc_cv_builtin_trap = yes; then
1937   AC_DEFINE([HAVE_BUILTIN_TRAP])
1940 ### End of automated tests.
1941 ### Now run sysdeps configure fragments.
1943 # They also can set these variables.
1944 use_ldconfig=no
1945 ldd_rewrite_script=no
1946 libc_cv_sysconfdir=$sysconfdir
1947 libc_cv_localstatedir=$localstatedir
1948 libc_cv_gcc_unwind_find_fde=no
1949 libc_cv_idn=no
1951 # Iterate over all the sysdep directories we will use, running their
1952 # configure fragments.
1953 for dir in $sysnames; do
1954   case $dir in
1955     /*) dest=$dir ;;
1956     *)  dest=$srcdir/$dir ;;
1957   esac
1958   if test -r $dest/configure; then
1959     AC_MSG_RESULT(running configure fragment for $dir)
1960     . $dest/configure
1961   fi
1962 done
1964 AC_SUBST(libc_extra_cflags)
1965 AC_SUBST(libc_extra_cppflags)
1967 if test x$libc_cv_gcc_unwind_find_fde = xyes; then
1968   AC_DEFINE(EXPORT_UNWIND_FIND_FDE)
1970 AC_SUBST(libc_cv_gcc_unwind_find_fde)
1972 # A sysdeps configure fragment can reset this if IFUNC is not actually
1973 # usable even though the assembler knows how to generate the symbol type.
1974 if test x"$libc_cv_ld_gnu_indirect_function" = xyes; then
1975   AC_DEFINE(HAVE_IFUNC)
1978 # This is far from the AC_ARG_ENABLE that sets it so that a sysdeps
1979 # configure fragment can override the value to prevent this AC_DEFINE.
1980 AC_SUBST(use_nscd)
1981 if test "x$use_nscd" != xno; then
1982   AC_DEFINE([USE_NSCD])
1984 if test "x$build_nscd" = xdefault; then
1985   build_nscd=$use_nscd
1988 # Test for old glibc 2.0.x headers so that they can be removed properly
1989 # Search only in includedir.
1990 AC_MSG_CHECKING(for old glibc 2.0.x headers)
1991 if eval test -f "${includedir}/elfclass.h" -a -f "${includedir}/fcntlbits.h"
1992 then
1993   old_glibc_headers=yes
1994 else
1995   old_glibc_headers=no
1997 AC_MSG_RESULT($old_glibc_headers)
1998 if test ${old_glibc_headers} = yes; then
1999   AC_MSG_WARN(*** During \"make install\" old headers from glibc 2.0.x will)
2000   AC_MSG_WARN(*** be removed.)
2002 AC_SUBST(old_glibc_headers)
2004 AC_SUBST(libc_cv_slibdir)
2005 AC_SUBST(libc_cv_rtlddir)
2006 AC_SUBST(libc_cv_localedir)
2007 AC_SUBST(libc_cv_sysconfdir)
2008 AC_SUBST(libc_cv_localstatedir)
2009 AC_SUBST(libc_cv_rootsbindir)
2010 AC_SUBST(libc_cv_forced_unwind)
2012 if test x$use_ldconfig = xyes; then
2013   AC_DEFINE(USE_LDCONFIG)
2015 AC_SUBST(use_ldconfig)
2016 AC_SUBST(ldd_rewrite_script)
2018 AC_SUBST(static)
2019 AC_SUBST(shared)
2021 AC_CACHE_CHECK([whether -fPIC is default], libc_cv_pic_default,
2022 [libc_cv_pic_default=yes
2023 cat > conftest.c <<EOF
2024 #if defined __PIC__ || defined __pic__ || defined PIC || defined pic
2025 # error PIC is default.
2026 #endif
2028 if eval "${CC-cc} -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
2029   libc_cv_pic_default=no
2031 rm -f conftest.*])
2032 AC_SUBST(libc_cv_pic_default)
2034 AC_SUBST(profile)
2035 AC_SUBST(static_nss)
2037 AC_SUBST(DEFINES)
2039 dnl See sysdeps/mach/configure.ac for this variable.
2040 AC_SUBST(mach_interface_list)
2042 VERSION=`sed -n -e 's/^#define VERSION "\([^"]*\)"/\1/p' < $srcdir/version.h`
2043 RELEASE=`sed -n -e 's/^#define RELEASE "\([^"]*\)"/\1/p' < $srcdir/version.h`
2044 AC_SUBST(VERSION)
2045 AC_SUBST(RELEASE)
2047 AC_CONFIG_FILES([config.make Makefile])
2048 AC_CONFIG_COMMANDS([default],[[
2049 case $CONFIG_FILES in *config.make*)
2050 echo "$config_vars" >> config.make;;
2051 esac
2052 test -d bits || mkdir bits]],[[config_vars='$config_vars']])
2053 AC_OUTPUT